Changeset 30614 for trunk/Ohana/src/opihi/lib.shell/command.c
- Timestamp:
- Feb 13, 2011, 11:28:01 AM (15 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/lib.shell/command.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/lib.shell/command.c
r27790 r30614 10 10 Command *cmd; 11 11 12 // rawline = NULL; 13 rawline = strcreate (line); 12 // the input line is never NULL 13 if (!line) { fprintf (stderr, "programming error\n"); abort(); } 14 15 rawline = strcreate (line); // used for error messages which should echo the unparsed line 14 16 15 17 /* force a space between ! and first word: !ls becomes ! ls */ … … 22 24 /* expand anything of the form $fred or $fred$sam, etc */ 23 25 line = expand_vars (line); /* line is freed here, new one allocated */ 26 if (!line) goto escape; 27 24 28 /* expand anything of the form fred[N] */ 25 29 line = expand_vectors (line); /* line is freed here, new one allocated */ 30 if (!line) goto escape; 26 31 27 32 // print the line with the variables and vectors expanded, but before evaluating … … 29 34 if (VERBOSE_SHELL == OPIHI_VERBOSE_ON) gprint (GP_ERR, "opihi: %s\n", line); 30 35 31 /* solve math expresions, assign variable, if needed */ 32 line = parse (line); /* line is freed here, new one allocated */ 33 /* any entry in line of the form {foo} returns value or tmp vector / buffer */ 36 /* solve math expresions, assign variable, if needed. any entry in line of the form {foo} 37 * returns value or tmp vector / buffer */ 38 line = parse (&status, line); /* line is freed here, new one allocated */ 39 if (!status) goto escape; 34 40 35 41 /* we may have reallocated line, return new pointer */ … … 39 45 if (argc == 0) { 40 46 FREE (rawline); 47 set_int_variable ("STATUS", TRUE); 41 48 return (TRUE); /* empty command or assignment */ 42 49 } … … 74 81 FREE (rawline); 75 82 return (status); 83 84 escape: 85 set_int_variable ("STATUS", FALSE); 86 87 # if (DEBUG) 88 gprint (GP_ERR, "command: %s, status: %d\n", line, FALSE); 89 # endif 90 91 FREE (rawline); 92 93 if (VERBOSE_SHELL != OPIHI_VERBOSE_OFF) gprint (GP_ERR, "error on line: %s\n", rawline); 94 95 // return the current value of line, in case it was modified 96 *outline = line; 97 return FALSE; 76 98 } 77 99
Note:
See TracChangeset
for help on using the changeset viewer.
