Changeset 19125 for trunk/Ohana/src/opihi/pantasks/controller_host.c
- Timestamp:
- Aug 19, 2008, 12:29:10 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/pantasks/controller_host.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/pantasks/controller_host.c
r8548 r19125 3 3 int controller_host (int argc, char **argv) { 4 4 5 int status;5 int N, status, max_threads; 6 6 char command[1024]; 7 7 IOBuffer buffer; 8 8 9 if (argc != 3) { 10 gprint (GP_ERR, "USAGE: controller host (command) (hostname)\n"); 11 return (FALSE); 9 max_threads = 0; 10 if ((N = get_argument (argc, argv, "-threads"))) { 11 remove_argument (N, &argc, argv); 12 max_threads = atoi(argv[N]); 13 remove_argument (N, &argc, argv); 12 14 } 15 16 if (argc != 3) goto usage; 13 17 14 18 /* start controller connection (if needed) */ … … 18 22 } 19 23 20 sprintf (command, "host %s %s", argv[1], argv[2]); 24 // the user may issue any of these commands: 25 // ADD, ON, RETRY, CHECK, OFF, DELETE 26 // we need to catch ADD and DELETE and modify our host table accordingly 27 if (!strcasecmp (argv[1], "ADD")) { 28 AddHost (argv[2], max_threads); 29 } else { 30 if (max_threads) goto usage; 31 } 32 33 if (!strcasecmp (argv[1], "DELETE")) { 34 DeleteHost (argv[2]); 35 } 36 37 if (max_threads) { 38 sprintf (command, "host %s %s -threads %d", argv[1], argv[2], max_threads); 39 } else { 40 sprintf (command, "host %s %s", argv[1], argv[2]); 41 } 21 42 InitIOBuffer (&buffer, 0x100); 22 43 … … 29 50 FreeIOBuffer (&buffer); 30 51 return (TRUE); 52 53 usage: 54 gprint (GP_LOG, "USAGE: controller host (command) (hostname)\n"); 55 gprint (GP_ERR, " valid commands: add, on, retry, check, off, delete\n"); 56 gprint (GP_ERR, " -threads Nthreads is optional for 'add'\n"); 57 return (FALSE); 31 58 } 32 59
Note:
See TracChangeset
for help on using the changeset viewer.
