- Timestamp:
- May 3, 2010, 8:50:52 AM (16 years ago)
- Location:
- branches/simtest_nebulous_branches
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/simtest_nebulous_branches
- Property svn:mergeinfo changed
-
branches/simtest_nebulous_branches/Ohana
-
Property svn:mergeinfo
set to (toggle deleted branches)
/trunk/Ohana merged eligible /branches/eam_branches/Ohana.20100407 27635-27772 /branches/pap_delete/Ohana 27530-27595
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
branches/simtest_nebulous_branches/Ohana/src/opihi/lib.shell/command.c
r7938 r27840 1 1 # include "opihi.h" 2 2 # define DEBUG 0 3 4 static int VERBOSE_SHELL = OPIHI_VERBOSE_OFF; 3 5 4 6 int command (char *line, char **outline, int VERBOSE) { 5 7 6 8 int i, status, argc; 7 char **argv, **targv ;9 char **argv, **targv, *rawline; 8 10 Command *cmd; 11 12 // rawline = NULL; 13 rawline = strcreate (line); 9 14 10 15 /* force a space between ! and first word: !ls becomes ! ls */ … … 19 24 /* expand anything of the form fred[N] */ 20 25 line = expand_vectors (line); /* line is freed here, new one allocated */ 26 27 // print the line with the variables and vectors expanded, but before evaluating 28 // any in-line math expression 29 if (VERBOSE_SHELL == OPIHI_VERBOSE_ON) gprint (GP_ERR, "opihi: %s\n", line); 30 21 31 /* solve math expresions, assign variable, if needed */ 22 32 line = parse (line); /* line is freed here, new one allocated */ … … 26 36 *outline = line; 27 37 28 # if (DEBUG)29 fprintf (stderr, "line: %s\n", line);30 # endif31 32 38 argv = parse_commands (line, &argc); 33 if (argc == 0) return (TRUE); /* empty command or assignment */ 39 if (argc == 0) { 40 FREE (rawline); 41 return (TRUE); /* empty command or assignment */ 42 } 34 43 35 44 /* save the original values of argv since command may modify the array */ … … 54 63 msg = get_variable_ptr ("ERRORMSG"); 55 64 if (msg != (char *) NULL) gprint (GP_ERR, "%s\n", msg); 65 if (VERBOSE_SHELL != OPIHI_VERBOSE_OFF) gprint (GP_ERR, "error on line: %s\n", rawline); 56 66 } 57 67 … … 62 72 # endif 63 73 74 FREE (rawline); 64 75 return (status); 65 76 } 77 78 void set_verbose_shell(int mode) { 79 VERBOSE_SHELL = mode; 80 } 81 82 int get_verbose_shell(void) { 83 return VERBOSE_SHELL; 84 } 85 86 66 87 67 88 /* parse the input line, search for the corresponding command, and execute it
Note:
See TracChangeset
for help on using the changeset viewer.
