IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 19, 2006, 10:26:59 AM (20 years ago)
Author:
eugene
Message:

unified the client/standalone command functions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/lib.shell/command.c

    r7917 r7938  
    11# include "opihi.h"
    2 # define VERBOSE 0
     2# define DEBUG 0
    33
    4 int command (char *line, char **outline) {
     4int command (char *line, char **outline, int VERBOSE) {
    55
    66  int i, status, argc;
     
    2626  *outline = line;
    2727 
     28  # if (DEBUG)
     29  fprintf (stderr, "line: %s\n", line);
     30  # endif
     31
    2832  argv = parse_commands (line, &argc);
    2933  if (argc == 0) return (TRUE);  /* empty command or assignment */
     
    3337  for (i = 0; i < argc; i++) targv[i] = argv[i];
    3438
    35   cmd = MatchCommand (argv[0], TRUE, FALSE);
     39  cmd = MatchCommand (argv[0], VERBOSE, FALSE);
    3640  if (cmd == NULL) {
    37     status = FALSE;
     41    status = -1;
    3842  } else {
    3943    free (argv[0]);
     
    5357
    5458  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
    5664  return (status);
    5765}
     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.