IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 17, 2007, 3:39:12 PM (19 years ago)
Author:
eugene
Message:

fixed problem with list in macro

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/cmd.basic/list.c

    r10647 r11119  
    55int list (int argc, char **argv) {
    66
    7   int ThisList, depth, i, done;
     7  int ThisList, depth, i, done, found;
    88  char *input, line[1024];
    99  int N, Nbytes, NBYTES, Nread, status;
     
    3737  }
    3838
     39  if ((argc > 2) && (!strcmp (argv[2], "-add"))) {
     40    if (argc == 3) {
     41      gprint (GP_ERR, "USAGE: list (root) -add (word) (word) ...\n");
     42      return (FALSE);
     43    }
     44   
     45    sprintf (line, "%s:n", argv[1]);
     46    N = get_int_variable (line, &found);
     47    for (i = 0; i < argc - 3; i++) {
     48      sprintf (line, "%s:%d", argv[1], N + i);
     49      set_str_variable (line, argv[i+3]);
     50    }
     51    sprintf (line, "%s:n", argv[1]);
     52    set_int_variable (line, N + i);
     53
     54    return (TRUE);
     55  }
     56
    3957  if (argc != 2) {
    40     gprint (GP_ERR, "USAGE: list (root) -- terminate with 'END'\n");
     58    gprint (GP_ERR, "USAGE: list (root)                : supply list data, terminate with 'END'\n");
     59    gprint (GP_ERR, "USAGE: list (root) -x (command)   : create list from shell output\n");
     60    gprint (GP_ERR, "USAGE: list (root) -split (words) : create list from words\n");
     61    gprint (GP_ERR, "USAGE: list (root) -add (words)   : extend a list\n");
    4162    return (FALSE);
    4263  }
Note: See TracChangeset for help on using the changeset viewer.