IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 36681


Ignore:
Timestamp:
Apr 21, 2014, 10:45:10 AM (12 years ago)
Author:
eugene
Message:

fix macro list option; fix is_list_exec

Location:
trunk/Ohana/src/opihi/lib.shell
Files:
2 edited

Legend:

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

    r36679 r36681  
    185185
    186186// list (word) : nested list
    187 // list (word) -x : not nested list
    188 // list (word) -split : not nested list
     187// list (word) -x : not nested list [-x may be the list of options below]
     188// list -excel (word) -x :
    189189int is_list_data (char *line) {
    190190
    191191  char *comm = NULL;
    192192  char *temp = NULL;
    193   char *ptr  = NULL;
     193  char *name  = NULL;
     194  char *opts  = NULL;
    194195
    195196  comm = thisword (line);
     
    197198  if (strcmp (comm, "list")) goto escape;
    198199
    199   ptr = nextword (line);
    200   if (!strncmp("-excel", ptr, strlen("-excel"))) ptr = nextword (ptr);
    201   if (!strncmp("-excel-style", ptr, strlen("-excel-style"))) ptr = nextword (ptr);
    202   temp = thisword (ptr);
     200  // name == name of the list in question
     201  name = nextword (line);
     202
     203  // skip a -excel or -excel-style modifier
     204  if (!strncmp("-excel", name, strlen("-excel"))) name = nextword (name);
     205  if (!strncmp("-excel-style", name, strlen("-excel-style"))) name = nextword (name);
     206
     207  // get the thing following ptr, if any (opts points at a substring, temp is a new string)
     208  opts = nextword (name);
     209  temp = thisword (opts);
    203210
    204211  /* if (cond) (command) does not define a complete block */
  • trunk/Ohana/src/opihi/lib.shell/macro_list.c

    r7917 r36681  
    1111  }
    1212
    13   macro = MatchMacro (argv[0], FALSE, TRUE);
     13  macro = MatchMacro (argv[1], FALSE, TRUE);
    1414  if (macro == NULL) {
    1515    gprint (GP_ERR, "%s: Macro not found\n", argv[1]);
Note: See TracChangeset for help on using the changeset viewer.