Changeset 11007 for trunk/Ohana/src/opihi/cmd.basic/macro.c
- Timestamp:
- Jan 10, 2007, 7:43:40 AM (19 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/cmd.basic/macro.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/cmd.basic/macro.c
r10996 r11007 1 1 # 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 };11 2 12 3 int macro (int argc, char **argv) { … … 27 18 } 28 19 29 N = sizeof (macro_command) / sizeof (Command);20 CommandF *cmd; 30 21 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); 38 28 } 39 29 40 /* sub-command was not found, pass argv[1..N] to macro_create */41 status = macro_create (argc, argv);42 30 return (status); 43 31 }
Note:
See TracChangeset
for help on using the changeset viewer.
