Changeset 5900 for trunk/Ohana/src/opihi/lib.shell/startup.c
- Timestamp:
- Jan 4, 2006, 10:00:28 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/lib.shell/startup.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/lib.shell/startup.c
r4689 r5900 1 1 # include "opihi.h" 2 2 3 /* program-independent initialization */ 4 void startup (int argc, char **argv) { 3 /* program-independent initialization 4 * these steps do not depend on the opihi implementation 5 * (ie, the supplied commands or data structures) 6 */ 5 7 6 long A, B; 7 8 signal (SIGINT, SIG_IGN); 8 void general_init (int argc, char **argv) { 9 9 10 10 /* init srand for rnd numbers elsewhere */ 11 long A, B; 11 12 A = time(NULL); 12 13 for (B = 0; A == time(NULL); B++); 13 14 srand48(B); 14 15 15 if (0) { 16 /* fix the history list to remove the timestamp */ 17 char *c; 18 int i; 19 HIST_ENTRY **entry; 20 21 entry = history_list (); 22 if (entry != (HIST_ENTRY **) NULL) { 23 for (i = 0; entry[i]; i++) { 24 if ((strlen (entry[i][0].line) > 19) && 25 (entry[i][0].line[2] == '/') && 26 (entry[i][0].line[5] == '/') && 27 (entry[i][0].line[11] == ':') && 28 (entry[i][0].line[14] == ':') && 29 (entry[i][0].line[17] == ':')) { 30 c = entry[i][0].line + 19; 31 memmove (entry[i][0].line, c, strlen(c) + 1); 32 } 33 } 34 } 16 /* set signals */ 17 signal (SIGINT, SIG_IGN); 18 19 /* load config data (.ptolemyrc) */ 20 if (!ConfigInit (&argc, argv)) { 21 fprintf (stderr, "can't find config file. some functions will be unavailable\n"); 35 22 } 36 37 { 23 24 return; 25 } 26 27 void startup (int argc, char **argv) { 38 28 39 29 int i, N, status, ONLY_INPUT, LOAD_RC; … … 57 47 */ 58 48 59 if (!ConfigInit (&argc, argv)) { 60 fprintf (stderr, "can't find config file. some functions will be unavailable\n"); 49 50 51 /* check history file permission */ 52 { 53 FILE *f; 54 char *opihi_history; 55 56 opihi_history = get_variable ("RCFILE"); 57 f = fopen (opihi_history, "a"); 58 if (f == NULL) /* no current history file here */ 59 fprintf (stderr, "can't save history.\n"); 60 else 61 fclose (f); 62 stifle_history (200); 63 read_history (opihi_history); 64 } 65 66 if (0) { 67 /* fix the history list to remove the timestamp */ 68 char *c; 69 int i; 70 HIST_ENTRY **entry; 71 72 entry = history_list (); 73 if (entry != (HIST_ENTRY **) NULL) { 74 for (i = 0; entry[i]; i++) { 75 if ((strlen (entry[i][0].line) > 19) && 76 (entry[i][0].line[2] == '/') && 77 (entry[i][0].line[5] == '/') && 78 (entry[i][0].line[11] == ':') && 79 (entry[i][0].line[14] == ':') && 80 (entry[i][0].line[17] == ':')) { 81 c = entry[i][0].line + 19; 82 memmove (entry[i][0].line, c, strlen(c) + 1); 83 } 84 } 61 85 } 62 86
Note:
See TracChangeset
for help on using the changeset viewer.
