Changeset 4697 for trunk/Ohana/src/opihi/pantasks/TaskOps.c
- Timestamp:
- Aug 2, 2005, 9:40:50 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/pantasks/TaskOps.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/pantasks/TaskOps.c
r4693 r4697 68 68 fprintf (stderr, "- "); 69 69 } 70 fprintf (stderr, "%-15s %4d %-20s\n", tasks[i][0].name, tasks[i][0].Njobs, tasks[i][0].argv[0]); 70 if (tasks[i][0].argv == NULL) { 71 fprintf (stderr, "%-15s %4d %-20s\n", tasks[i][0].name, tasks[i][0].Njobs, "dynamic"); 72 } else { 73 fprintf (stderr, "%-15s %4d %-20s\n", tasks[i][0].name, tasks[i][0].Njobs, tasks[i][0].argv[0]); 74 } 71 75 if (verbose) { 72 76 fprintf (stderr, " spawn period: %f, polling period: %f, timeout period: %f\n", … … 209 213 } 210 214 211 int ValidateTask (Task *task) { 212 213 if (task[0].argc == 0) { 215 int ValidateTask (Task *task, int RequireStatic) { 216 217 int i, hash; 218 219 /* is a static command defined? */ 220 if (task[0].argc != 0) { 221 if (task[0].argv == NULL) { 222 fprintf (stderr, "task command arguments not defined (programming error)\n"); 223 return (FALSE); 224 } 225 return (TRUE); 226 } 227 if (RequireStatic) { 214 228 fprintf (stderr, "task command not defined\n"); 215 229 return (FALSE); 216 230 } 217 if (task[0].argv == NULL) { 218 fprintf (stderr, "task command arguments not defined (programming error)\n"); 219 return (FALSE); 220 } 221 return (TRUE); 231 232 /* no static command; dynamic command? */ 233 if (task[0].exec != NULL) { 234 for (i = 0; i < task[0].exec[0].Nlines; i++) { 235 hash = TaskHash (task[0].exec[0].line[i]); 236 if (hash == TASK_COMMAND) return (TRUE); 237 } 238 } 239 fprintf (stderr, "task command not defined\n"); 240 return (FALSE); 222 241 } 223 242 … … 250 269 } 251 270 271 Task *GetActiveTask () { 272 Task *task; 273 if (ActiveTask < 0) return (NULL); 274 task = tasks[ActiveTask]; 275 return (task); 276 } 277 278 int TaskHash (char *input) { 279 280 int hash; 281 char *command; 282 283 hash = TASK_NONE; 284 285 command = thisword (input); 286 if (command == NULL) return (TASK_EMPTY); 287 288 if (command[0] == '#') hash = TASK_COMMENT; 289 if (!strcasecmp (command, "END")) hash = TASK_END; 290 if (!strcasecmp (command, "HOST")) hash = TASK_HOST; 291 if (!strcasecmp (command, "NMAX")) hash = TASK_NMAX; 292 if (!strcasecmp (command, "TRANGE")) hash = TASK_TRANGE; 293 if (!strcasecmp (command, "COMMAND")) hash = TASK_COMMAND; 294 if (!strcasecmp (command, "PERIODS")) hash = TASK_PERIODS; 295 if (!strcasecmp (command, "TASK.EXIT")) hash = TASK_EXIT; 296 if (!strcasecmp (command, "TASK.EXEC")) hash = TASK_EXEC; 297 298 free (command); 299 return (hash); 300 } 301 252 302 /*** task timer functions ***/ 253 303
Note:
See TracChangeset
for help on using the changeset viewer.
