Changeset 4689 for trunk/Ohana/src/opihi/pantasks
- Timestamp:
- Jul 31, 2005, 1:04:22 PM (21 years ago)
- Location:
- trunk/Ohana/src/opihi/pantasks
- Files:
-
- 1 added
- 1 deleted
- 20 edited
-
CheckJobs.c (modified) (1 diff)
-
CheckSystem.c (modified) (1 diff)
-
CheckTasks.c (modified) (1 diff)
-
ControllerOps.c (modified) (4 diffs)
-
IOBufferOps.c (modified) (1 diff)
-
JobIDOps.c (modified) (1 diff)
-
JobOps.c (modified) (1 diff)
-
LocalJob.c (modified) (1 diff)
-
Makefile (modified) (5 diffs)
-
controller.c (modified) (4 diffs)
-
controller_exit.c (added)
-
controller_output.c (modified) (1 diff)
-
delete.c (modified) (1 diff)
-
kill.c (modified) (1 diff)
-
memstr.c (deleted)
-
scheduler.c (modified) (3 diffs)
-
status.c (modified) (1 diff)
-
task.c (modified) (3 diffs)
-
task_host.c (modified) (1 diff)
-
task_macros.c (modified) (1 diff)
-
task_periods.c (modified) (4 diffs)
-
task_trange.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/pantasks/CheckJobs.c
r4684 r4689 4 4 5 5 Job *job; 6 Task *task;7 6 Macro *macro; 8 int i, found, status; 9 int Ntest; 7 int i, status; 10 8 11 9 /** test all jobs: ready to test? finished? **/ -
trunk/Ohana/src/opihi/pantasks/CheckSystem.c
r4573 r4689 6 6 CheckJobs (); 7 7 CheckControllerOutput (); 8 8 return (TRUE); 9 9 } -
trunk/Ohana/src/opihi/pantasks/CheckTasks.c
r4684 r4689 5 5 Job *job; 6 6 Task *task; 7 Macro *macro; 8 int i, found, status; 9 int Ntest; 7 int status; 10 8 11 9 /** test all tasks: ready to test? ready to run? **/ -
trunk/Ohana/src/opihi/pantasks/ControllerOps.c
r4684 r4689 20 20 GetJobOutput ("stderr", job[0].pid, &job[0].stderr, job[0].stderr_size); 21 21 } 22 return (TRUE); 22 23 } 23 24 … … 157 158 /* construct the controller command portion */ 158 159 if (!strcmp (job[0].task[0].host, "NONE")) { 159 sprintf (cmd, "job" , cmd);160 sprintf (cmd, "job"); 160 161 } else { 161 162 if (job[0].task[0].host_required) { … … 391 392 IOBuffer buffer; 392 393 394 if (!CheckControllerStatus()) return (TRUE); 395 393 396 sprintf (cmd, "kill %d", job[0].pid); 394 397 InitIOBuffer (&buffer, 0x100); … … 400 403 } 401 404 405 int QuitController () { 406 407 int status; 408 char cmd[128]; 409 IOBuffer buffer; 410 411 if (!CheckControllerStatus()) return (TRUE); 412 413 sprintf (cmd, "quit"); 414 InitIOBuffer (&buffer, 0x100); 415 status = ControllerCommand (cmd, CONTROLLER_PROMPT, &buffer); 416 return (TRUE); 417 } 418 402 419 /* memstr returns a view, not an allocated string : don't free */ -
trunk/Ohana/src/opihi/pantasks/IOBufferOps.c
r4450 r4689 59 59 } 60 60 } 61 return (Nread); 61 62 } 62 63 -
trunk/Ohana/src/opihi/pantasks/JobIDOps.c
r4684 r4689 38 38 39 39 JobIDList[JobID] = FALSE; 40 return (TRUE); 40 41 } -
trunk/Ohana/src/opihi/pantasks/JobOps.c
r4684 r4689 56 56 57 57 for (i = 0; i < Njobs; i++) { 58 fprintf (stderr, "%d: %-15s %5d %20s (% x)\n", Njobs, jobs[i][0].task[0].name, jobs[i][0].JobID, jobs[i][0].argv[0],jobs[i][0].argv);58 fprintf (stderr, "%d: %-15s %5d %20s (%lx)\n", Njobs, jobs[i][0].task[0].name, jobs[i][0].JobID, jobs[i][0].argv[0], (long) jobs[i][0].argv); 59 59 } 60 60 return; -
trunk/Ohana/src/opihi/pantasks/LocalJob.c
r4684 r4689 152 152 } 153 153 } 154 return ;154 return (FALSE); 155 155 } 156 156 -
trunk/Ohana/src/opihi/pantasks/Makefile
r4686 r4689 7 7 LIB = $(HOME)/lib 8 8 INC = $(HOME)/include 9 HELP = $(HOME)/help10 9 SDIR = $(HOME)/sched 11 10 # … … 38 37 $(SDIR)/JobIDOps.$(ARCH).o \ 39 38 $(SDIR)/TaskOps.$(ARCH).o \ 40 $(SDIR)/IOBufferOps.$(ARCH).o \ 41 $(SDIR)/memstr.$(ARCH).o 39 $(SDIR)/IOBufferOps.$(ARCH).o 42 40 43 41 cmds = \ … … 50 48 $(SDIR)/controller.$(ARCH).o \ 51 49 $(SDIR)/controller_host.$(ARCH).o \ 50 $(SDIR)/controller_exit.$(ARCH).o \ 52 51 $(SDIR)/controller_check.$(ARCH).o \ 53 52 $(SDIR)/controller_status.$(ARCH).o \ … … 107 106 cp $^ $@ 108 107 109 %.help:110 @if [ ! -d $(DESTHLP) ]; then mkdir -p $(DESTHLP); fi111 rm -f $(HOME)/$*/help/*~112 rm -f $(HOME)/$*/help/#*113 cp $(HOME)/$*/help/* $(DESTHLP)/114 115 108 clean: 116 109 rm -f $(BIN)/*.$(ARCH) … … 136 129 $(CC) $(CFLAGS) -c $*.c -o $@ 137 130 138 139 140 ## -*- makefile -*- 141 # deprecated functions: verify & delete 142 #$(SDIR)/abszero.$(ARCH).o \ 143 #$(SDIR)/cals.$(ARCH).o \ 144 #$(SDIR)/dumpmags.$(ARCH).o \ 145 #$(SDIR)/extract.$(ARCH).o \ 146 #$(SDIR)/gtypes.$(ARCH).o \ 147 #$(SDIR)/photresid.$(ARCH).o \ 148 #$(SDIR)/resid.$(ARCH).o \ 149 #$(SDIR)/zeropts.$(ARCH).o 150 #$(SDIR)/objload.$(ARCH).o \ - make sure we have vect to tv 151 #$(SDIR)/ccdextract.$(ARCH).o \ 152 #$(SDIR)/cmdextract.$(ARCH).o \ 153 #$(SDIR)/dmagextract.$(ARCH).o \ 154 #$(SDIR)/ddmagextract.$(ARCH).o \ 155 156 # future functions, not fully implemented 157 #$(SDIR)/detrend.$(ARCH).o \ 158 #$(SDIR)/getxtra.$(ARCH).o \ 159 #$(SDIR)/addxtra.$(ARCH).o \ 160 161 # functions that need to be updated 162 #$(SDIR)/gregions.$(ARCH).o \ 163 131 %.help: 132 @if [ ! -d $(DESTHLP) ]; then mkdir -p $(DESTHLP); fi 133 rm -f $(HOME)/$*/help/*~ 134 rm -f $(HOME)/$*/help/#* 135 cp $(HOME)/$*/help/* $(DESTHLP)/ -
trunk/Ohana/src/opihi/pantasks/controller.c
r4573 r4689 2 2 3 3 int controller_host PROTO((int, char **)); 4 int controller_exit PROTO((int, char **)); 4 5 int controller_status PROTO((int, char **)); 5 6 int controller_check PROTO((int, char **)); … … 7 8 8 9 static Command controller_cmds[] = { 10 {"exit", controller_exit, "shutdown controller"}, 9 11 {"host", controller_host, "define host for controller"}, 10 12 {"check", controller_check, "check controller host/job"}, … … 16 18 17 19 int status; 18 Function*func;20 CommandF *func; 19 21 20 22 if (argc < 2) { … … 33 35 } 34 36 35 Function*FindControllerCommand (char *cmd) {37 CommandF *FindControllerCommand (char *cmd) { 36 38 37 39 int i, N; -
trunk/Ohana/src/opihi/pantasks/controller_output.c
r4573 r4689 2 2 3 3 int controller_output (int argc, char **argv) { 4 5 int status;6 char command[1024];7 IOBuffer buffer;8 4 9 5 if (argc != 1) { -
trunk/Ohana/src/opihi/pantasks/delete.c
r4552 r4689 3 3 int delete_job (int argc, char **argv) { 4 4 5 Job *job; 6 int JobID, N; 5 int JobID; 7 6 8 7 if (argc < 2) { -
trunk/Ohana/src/opihi/pantasks/kill.c
r4684 r4689 4 4 5 5 Job *job; 6 int JobID , N;6 int JobID; 7 7 8 8 if (argc < 2) { -
trunk/Ohana/src/opihi/pantasks/scheduler.c
r4686 r4689 7 7 # define opihi_rcfile ".schedrc" 8 8 9 void InitBasic ();10 void InitData ();11 void InitSched ();12 13 void welcome () {14 fprintf (stderr, "\n");15 fprintf (stderr, "Welcome to %s - %s\n\n", opihi_name, opihi_description);16 }17 18 9 /* program-dependent initialization */ 19 10 void initialize (int argc, char **argv) { 20 11 21 FILE *f;22 23 12 auto_break = TRUE; 24 13 … … 55 44 set_str_variable ("PROMPT", opihi_prompt); 56 45 set_str_variable ("RCFILE", opihi_rcfile); 57 # define xstr(s) str(s)58 # define str(s) #s59 46 # ifdef HELPDIR_DEFAULT 60 set_str_variable ("HELPDIR", xstr(HELPDIR_DEFAULT));47 set_str_variable ("HELPDIR", MACRO_NAME(HELPDIR_DEFAULT)); 61 48 # endif 62 49 63 /* here we open the history file for append. it this fails, we 64 won't be able to write to it, warn the user. otherwise, this 65 creates the file readline will write to, if it did not exist */ 66 67 /* check history file */ 68 /* rewrite with fstat or stat */ 69 f = fopen (opihi_history, "a"); 70 if (f == NULL) /* no current history file here */ 71 fprintf (stderr, "can't save history.\n"); 72 else 73 fclose (f); 74 75 stifle_history (200); 76 read_history (opihi_history); 50 { /* check history file permission */ 51 FILE *f; 52 f = fopen (opihi_history, "a"); 53 if (f == NULL) /* no current history file here */ 54 fprintf (stderr, "can't save history.\n"); 55 else 56 fclose (f); 57 stifle_history (200); 58 read_history (opihi_history); 59 } 77 60 78 61 signal (SIGINT, SIG_IGN); … … 80 63 } 81 64 65 /* standard welcome message */ 66 void welcome () { 67 fprintf (stderr, "\n"); 68 fprintf (stderr, "Welcome to %s - %s\n\n", opihi_name, opihi_description); 69 } 70 82 71 /* add program-dependent exit functions here */ 83 72 void cleanup () { 84 /* -libdisplay85 73 QuitImage (); 86 QuitGraph (); */ 74 QuitGraph (); 75 QuitController (); 87 76 return; 88 77 } -
trunk/Ohana/src/opihi/pantasks/status.c
r4684 r4689 10 10 ListTasks (FALSE); 11 11 ListJobs (); 12 12 return (TRUE); 13 13 } 14 14 -
trunk/Ohana/src/opihi/pantasks/task.c
r4684 r4689 9 9 int ThisList, status; 10 10 char *input, *outline; 11 Macro *macro;12 11 Task *task; 13 12 14 if ( N = get_argument (argc, argv, "-list")) {13 if ((N = get_argument (argc, argv, "-list"))) { 15 14 remove_argument (N, &argc, argv); 16 15 ListTasks (FALSE); … … 18 17 } 19 18 20 if ( N = get_argument (argc, argv, "-longlist")) {19 if ((N = get_argument (argc, argv, "-longlist"))) { 21 20 remove_argument (N, &argc, argv); 22 21 ListTasks (TRUE); … … 24 23 } 25 24 26 if ( N = get_argument (argc, argv, "-show")) {25 if ((N = get_argument (argc, argv, "-show"))) { 27 26 remove_argument (N, &argc, argv); 28 27 ShowTask (argv[N]); -
trunk/Ohana/src/opihi/pantasks/task_host.c
r4684 r4689 5 5 int N, RequiredHost; 6 6 Task *task; 7 char *taskname;8 7 9 8 RequiredHost = FALSE; 10 if ( N = get_argument (argc, argv, "-required")) {9 if ((N = get_argument (argc, argv, "-required"))) { 11 10 remove_argument (N, &argc, argv); 12 11 RequiredHost = TRUE; -
trunk/Ohana/src/opihi/pantasks/task_macros.c
r4684 r4689 27 27 return (FALSE); 28 28 } 29 30 macro = NULL; 29 31 30 32 /*** identify which Macro in Task this particular macro goes with ***/ -
trunk/Ohana/src/opihi/pantasks/task_periods.c
r4684 r4689 7 7 Task *task; 8 8 9 PollValue = 0; 9 10 Poll = FALSE; 10 if ( N = get_argument (argc, argv, "-poll")) {11 if ((N = get_argument (argc, argv, "-poll"))) { 11 12 Poll = TRUE; 12 13 remove_argument (N, &argc, argv); … … 15 16 } 16 17 18 ExecValue = 0; 17 19 Exec = FALSE; 18 if ( N = get_argument (argc, argv, "-exec")) {20 if ((N = get_argument (argc, argv, "-exec"))) { 19 21 Exec = TRUE; 20 22 remove_argument (N, &argc, argv); … … 23 25 } 24 26 27 TimeoutValue = 0; 25 28 Timeout = FALSE; 26 if ( N = get_argument (argc, argv, "-timeout")) {29 if ((N = get_argument (argc, argv, "-timeout"))) { 27 30 Timeout = TRUE; 28 31 remove_argument (N, &argc, argv); … … 49 52 return (TRUE); 50 53 } 51 52 53 /**54 careful with this: the command is supposed to be realized55 for the Job, not the Task (at execution)56 the code is right, but who calls it when needs to be clarified.57 **/58 -
trunk/Ohana/src/opihi/pantasks/task_trange.c
r4684 r4689 3 3 int task_trange (int argc, char **argv) { 4 4 5 int N , RequiredHost;5 int N; 6 6 Task *task; 7 7 TimeRange range; … … 16 16 keep = false means the time range defines an invalid range */ 17 17 range.keep = TRUE; 18 if ( N = get_argument (argc, argv, "-exclude")) {18 if ((N = get_argument (argc, argv, "-exclude"))) { 19 19 remove_argument (N, &argc, argv); 20 20 range.keep = FALSE;
Note:
See TracChangeset
for help on using the changeset viewer.
