Changeset 7929 for trunk/Ohana/src/opihi/lib.shell/command_client.c
- Timestamp:
- Jul 18, 2006, 6:58:54 AM (20 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/lib.shell/command_client.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/lib.shell/command_client.c
r7892 r7929 2 2 # define VERBOSE 0 3 3 4 /* this function acts like the standard command parser, 5 but skips the expansion of variables and vectors */ 4 // this function is identical to the normal command.c function, 5 // but it returns -1 for a missing command and does not echo the 6 // 'missing command' error message 7 6 8 int command_client (char *line, char **outline) { 7 9 … … 17 19 } 18 20 21 /* expand anything of the form $fred or $fred$sam, etc */ 22 line = expand_vars (line); /* line is freed here, new one allocated */ 23 /* expand anything of the form fred[N] */ 24 line = expand_vectors (line); /* line is freed here, new one allocated */ 25 /* solve math expresions, assign variable, if needed */ 26 line = parse (line); /* line is freed here, new one allocated */ 27 /* any entry in line of the form {foo} returns value or tmp vector / buffer */ 28 19 29 /* we may have reallocated line, return new pointer */ 20 30 *outline = line; … … 27 37 for (i = 0; i < argc; i++) targv[i] = argv[i]; 28 38 29 cmd = MatchCommand (argv[0], TRUE, FALSE); 39 // use non-verbose mode to skip 'missing command' error message 40 cmd = MatchCommand (argv[0], FALSE, FALSE); 30 41 if (cmd == NULL) { 31 status = FALSE;42 status = -1; 32 43 } else { 33 44 free (argv[0]); … … 40 51 free (argv); 41 52 53 if (!status) { 54 char *msg; 55 msg = get_variable_ptr ("ERRORMSG"); 56 if (msg != (char *) NULL) gprint (GP_ERR, "%s\n", msg); 57 } 58 59 set_int_variable ("STATUS", status); 60 if (VERBOSE) gprint (GP_ERR, "command: %s, status: %d\n", line, status); 42 61 return (status); 43 62 }
Note:
See TracChangeset
for help on using the changeset viewer.
