Changeset 7938 for trunk/Ohana/src/opihi/lib.shell/command.c
- Timestamp:
- Jul 19, 2006, 10:26:59 AM (20 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/lib.shell/command.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/lib.shell/command.c
r7917 r7938 1 1 # include "opihi.h" 2 # define VERBOSE02 # define DEBUG 0 3 3 4 int command (char *line, char **outline ) {4 int command (char *line, char **outline, int VERBOSE) { 5 5 6 6 int i, status, argc; … … 26 26 *outline = line; 27 27 28 # if (DEBUG) 29 fprintf (stderr, "line: %s\n", line); 30 # endif 31 28 32 argv = parse_commands (line, &argc); 29 33 if (argc == 0) return (TRUE); /* empty command or assignment */ … … 33 37 for (i = 0; i < argc; i++) targv[i] = argv[i]; 34 38 35 cmd = MatchCommand (argv[0], TRUE, FALSE);39 cmd = MatchCommand (argv[0], VERBOSE, FALSE); 36 40 if (cmd == NULL) { 37 status = FALSE;41 status = -1; 38 42 } else { 39 43 free (argv[0]); … … 53 57 54 58 set_int_variable ("STATUS", status); 55 if (VERBOSE) gprint (GP_ERR, "command: %s, status: %d\n", line, status); 59 60 # if (DEBUG) 61 gprint (GP_ERR, "command: %s, status: %d\n", line, status); 62 # endif 63 56 64 return (status); 57 65 } 66 67 /* parse the input line, search for the corresponding command, and execute it 68 if no match is found, return -1; this is used above to distinguish between 69 a command error and an unknown command. if VERBOSE is true, unknown commands 70 result in an error message. The input line is freed and the resulting parsed 71 line is returned on 'outline' 72 */
Note:
See TracChangeset
for help on using the changeset viewer.
