IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 10, 2007, 7:43:40 AM (19 years ago)
Author:
eugene
Message:

fixed macro function error, added restrictions to book selections

File:
1 edited

Legend:

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

    r10996 r11007  
    11# include "basic.h"
    2 
    3 static Command macro_command[] = {
    4   {"create", macro_create, "create a macro *"},
    5   {"delete", macro_delete, "delete a macro *"},
    6   {"list",   macro_list_f, "list a macro *"},
    7   {"edit",   macro_edit,   "edit a macro <not working yet!> *"},
    8   {"read",   macro_read,   "read a macro from a file <not working yet!> *"},
    9   {"write",  macro_write,  "write a macro to a file <not working yet!> *"}
    10 };
    112
    123int macro (int argc, char **argv) {
     
    2718  }
    2819
    29   N = sizeof (macro_command) / sizeof (Command);
     20  CommandF *cmd;
    3021
    31   /* find the macro sub-command which matches from the list. */
    32   /* if sub-command is not found, assume this is creating a new macro */
    33   for (i = 0; i < N; i++) {
    34     if (!strcmp (macro_command[i].name, argv[1])) {
    35       status = (*macro_command[i].func) (argc - 1, argv + 1);
    36       return (status);
    37     }
     22  cmd = find_macro_command (argv[1]);
     23  if (cmd != NULL) {
     24    status = (*cmd) (argc - 1, argv + 1);
     25  } else {
     26    /* sub-command was not found, pass argv[1..N] to macro_create */
     27    status = macro_create (argc, argv);
    3828  }
    3929
    40   /* sub-command was not found, pass argv[1..N] to macro_create */
    41   status = macro_create (argc, argv);
    4230  return (status);
    4331}
Note: See TracChangeset for help on using the changeset viewer.