Changeset 8190 for trunk/Ohana/src/opihi/cmd.data/queuepop.c
- Timestamp:
- Aug 5, 2006, 3:52:41 AM (20 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/cmd.data/queuepop.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/cmd.data/queuepop.c
r7917 r8190 3 3 int queuepop (int argc, char **argv) { 4 4 5 int N, Key; 5 int N; 6 char *Key; 6 7 char *var; 7 8 char *line; … … 16 17 } 17 18 18 Key = -1;19 Key = NULL; 19 20 if ((N = get_argument (argc, argv, "-key"))) { 20 21 remove_argument (N, &argc, argv); 21 Key = atoi(argv[N]);22 Key = strcreate (argv[N]); 22 23 remove_argument (N, &argc, argv); 23 24 Value = strcreate (argv[N]); … … 38 39 } 39 40 40 if (Key == -1) {41 line = PopQueue (queue);41 if (Key == NULL) { 42 line = PopQueue (queue); 42 43 } else { 43 line = PopQueueMatch (queue, Key, Value);44 line = PopQueueMatch (queue, Key, Value); 44 45 } 45 46 46 47 if (var == NULL) { 47 if (line == NULL) {48 gprint (GP_ERR, "queue %s is empty or match not found\n", argv[1]);49 return (FALSE);50 } else {51 gprint (GP_ERR, "%s\n", line);52 return (TRUE);53 }48 if (line == NULL) { 49 gprint (GP_ERR, "queue %s is empty or match not found\n", argv[1]); 50 return (FALSE); 51 } else { 52 gprint (GP_ERR, "%s\n", line); 53 return (TRUE); 54 } 54 55 } 55 56 … … 61 62 62 63 free (line); 64 if (Key != NULL) free (Key); 65 63 66 return (TRUE); 64 67 }
Note:
See TracChangeset
for help on using the changeset viewer.
