Changeset 25965
- Timestamp:
- Oct 29, 2009, 10:16:52 AM (17 years ago)
- Location:
- trunk/Ohana/src/opihi
- Files:
-
- 1 added
- 5 edited
-
cmd.basic/Makefile (modified) (1 diff)
-
cmd.basic/init.c (modified) (2 diffs)
-
cmd.basic/inthash.c (added)
-
cmd.basic/list.c (modified) (1 diff)
-
cmd.basic/strhash.c (modified) (1 diff)
-
lib.shell/ListOps.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/cmd.basic/Makefile
r19533 r25965 30 30 $(SRC)/help.$(ARCH).o \ 31 31 $(SRC)/input.$(ARCH).o \ 32 $(SRC)/inthash.$(ARCH).o \ 32 33 $(SRC)/list.$(ARCH).o \ 33 34 $(SRC)/list_help.$(ARCH).o \ -
trunk/Ohana/src/opihi/cmd.basic/init.c
r19533 r25965 16 16 int help PROTO((int, char **)); 17 17 int input PROTO((int, char **)); 18 int inthash PROTO((int, char **)); 18 19 int list PROTO((int, char **)); 19 20 int list_help PROTO((int, char **)); … … 61 62 {1, "help", help, "get help on a function *"}, 62 63 {1, "input", input, "read command lines from a file *"}, 64 {1, "inthash", inthash, "generate a hash for a word treated as an integer"}, 63 65 {1, "list", list, "get variable list"}, 64 66 {1, "?", list_help, "list commands *"}, -
trunk/Ohana/src/opihi/cmd.basic/list.c
r16427 r25965 34 34 sprintf (line, "%s:n", argv[1]); 35 35 set_int_variable (line, i); 36 37 return (TRUE); 38 } 39 40 // return an error if -add is given with no other args 41 if ((argc > 2) && (!strcmp (argv[2], "-splitbychar"))) { 42 if (argc < 4) { 43 gprint (GP_ERR, "USAGE: list (root) -splitbychar (char) (word) [(word)...]\n"); 44 return (FALSE); 45 } 46 47 int j, nWords; 48 char splitter; 49 char *new, *word, *ptr; 50 51 nWords = 0; 52 splitter = argv[3][0]; 53 54 for (i = 0; i < argc - 3; i++) { 55 new = strcreate (argv[i+3]); 56 for (j = 0; new[j]; j++) { 57 if (new[j] == splitter) new[j] = ' '; 58 } 59 60 ptr = new; 61 while (ptr) { 62 word = thisword (ptr); 63 if (!word) break; 64 65 sprintf (line, "%s:%d", argv[1], nWords); 66 set_str_variable (line, word); 67 FREE (word); 68 ptr = nextword (ptr); 69 nWords ++; 70 } 71 FREE (new); 72 } 73 sprintf (line, "%s:n", argv[1]); 74 set_int_variable (line, nWords); 36 75 37 76 return (TRUE); -
trunk/Ohana/src/opihi/cmd.basic/strhash.c
r19533 r25965 14 14 15 15 if (argc != 3) { 16 gprint (GP_ERR, "USAGE: strhash (string) (modulus) \n");16 gprint (GP_ERR, "USAGE: strhash (string) (modulus) [-var value]\n"); 17 17 return (FALSE); 18 18 } -
trunk/Ohana/src/opihi/lib.shell/ListOps.c
r16441 r25965 187 187 if (!strcmp (temp, "-x")) goto escape; 188 188 if (!strcmp (temp, "-split")) goto escape; 189 if (!strcmp (temp, "-splitbychar")) goto escape; 189 190 if (!strcmp (temp, "-add")) goto escape; 190 191 if (!strcmp (temp, "-del")) goto escape;
Note:
See TracChangeset
for help on using the changeset viewer.
