diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-07-08 20:46:52 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-07-08 20:46:52 -0400 |
commit | fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch) | |
tree | bdda434976bc09c864f2e4fa6f16ba1952b1e555 /pkg/system/mkscript.cl | |
download | iraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz |
Initial commit
Diffstat (limited to 'pkg/system/mkscript.cl')
-rw-r--r-- | pkg/system/mkscript.cl | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/pkg/system/mkscript.cl b/pkg/system/mkscript.cl new file mode 100644 index 00000000..984cdf27 --- /dev/null +++ b/pkg/system/mkscript.cl @@ -0,0 +1,79 @@ +#{ MKBATCH -- Make a batch script. + +{ + # Make a copy of the script file query parameter and delete the + # file if it exists and not appending. + + scrpt = script + if (access (scrpt) && !append) + delete (scrpt, verify=verify) + + # Outer loop provides return when the user wants to start over. + + while (YES) { + + # Add commands until the user is done. + + while (YES) { + + # Determine the task name and check that it is loaded. + + ltask = task + if (!deftask (ltask)) { + print ("Task ", ltask, " not loaded.") + next + } + + # Edit the task parameters. + + eparam (ltask) + print ("") + + # If the user is verifying then display the command. + + if (verify) { + lparam (ltask) | cmdstr (ltask, hidden=hidden) + cok = YES + if (cok) { + lparam (ltask) | cmdstr (ltask, hidden=hidden, >> scrpt) + print ("", >> scrpt) + } + } else { + lparam (ltask) | cmdstr (ltask, hidden=hidden, >> scrpt) + print ("", >> scrpt) + } + + # Ask if more commands are to be added to the script. + + more = YES + if (!more) + break + } + + # If verifying page the script and let the user decide to start + # over. + + if (verify) { + page (scrpt) + sok = YES + if (sok) + break + else + delete (scrpt, verify=verify) + } else + break + } + + # If the user does not want to submit the script then quit. + + if (!submit) + bye +} + +# Submit the script as a background process. + +print ("Script ", scrpt, " submitted at:") +time +print ("\nScript ", scrpt, " submitted at:", >> logfile) +time (>> logfile) +cl (< scrpt, >>& logfile) & |