home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-11-29 | 47.1 KB | 1,555 lines |
- Newsgroups: comp.sources.misc
- From: alan@tharr (Alan Saunders)
- Subject: v26i086: QBATCH - a queued batch processing system for UNIX, Patch03b/2
- Message-ID: <1991Nov30.032033.16278@sparky.imd.sterling.com>
- X-Md4-Signature: 8785776b015a1eec3b7a2ddeafcd20eb
- Date: Sat, 30 Nov 1991 03:20:33 GMT
- Approved: kent@sparky.imd.sterling.com
-
- Submitted-by: alan@tharr (Alan Saunders)
- Posting-number: Volume 26, Issue 86
- Archive-name: QBATCH/patch03b
- Environment: UNIX
- Patch-To: QBATCH: Volume 25, Issue 20-25
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of archive 2 (of 2)."
- # Contents: patches/qbatch.p03
- # Wrapped by root@vfib_d on Fri Nov 22 12:15:09 1991
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'patches/qbatch.p03' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'patches/qbatch.p03'\"
- else
- echo shar: Extracting \"'patches/qbatch.p03'\" \(44685 characters\)
- sed "s/^X//" >'patches/qbatch.p03' <<'END_OF_FILE'
- Prereq: 2
- Index: src/patchlevel.h
- X***************
- X*** 1 ****
- X! #define PATCHLEVEL 2
- X--- 1 ----
- X! #define PATCHLEVEL 03
- Index: INSTALL
- X***************
- X*** 16,27 ****
- X here may be overruled by it's contents.
- X
- X Once you are satisfied, change directory to the src directory, and have
- X! a look at config.h. You should find configuration options available
- X! which are supported by your system. If not, there should be enough
- X! information contained therein to allow you to add further options if
- X! you both feel it necessary, and are capable. Define the configuration
- X! for your platform by commenting out those options which are not
- X! supported, and uncommenting those (one in each group) which are.
- X
- X Then look at the Makefile, and ensure that BINDIR is set to where you
- X want the binaries installed, and that MANDIR is where you want the
- X--- 16,30 ----
- X here may be overruled by it's contents.
- X
- X Once you are satisfied, change directory to the src directory, and have
- X! a look at config.ARCH. If you find an entry there which relates to your
- X! architecture, your job is fairly straightforward, simply define the appropriate
- X! architecture in config.h. If an entry for your architecture is not present,
- X! You'll have to do some work on config.h. You should find configuration
- X! options available which are supported by your system. If not, there should
- X! be enough information contained therein to allow you to add further options
- X! if you both feel it necessary, and are capable. Define the configuration for
- X! your platform by commenting out those options which are not supported, and
- X! uncommenting those (one in each group) which are.
- X
- X Then look at the Makefile, and ensure that BINDIR is set to where you
- X want the binaries installed, and that MANDIR is where you want the
- Index: MANIFEST
- X***************
- X*** 49,55 ****
- X src/Makefile 3
- X src/config.c 4
- X src/config.h 4
- X- src/config.ARCH 4
- X src/jdgen 1
- X src/jj.c 4
- X src/jk.c 5
- X--- 49,54 ----
- Index: NEWS
- X***************
- X*** 227,232 ****
- X--- 227,236 ----
- X correct. I've now done this, and if anyone finds more typos I'll scream!!
- X
- X Long environment variables overwriting other data in js.c (and qp.c)
- X+ Pointed out by:
- X+ Gary Faulkner <garyf@solution.uts.amdahl.com>
- X+ Bryan Wright <bryan%sphinx.uucp@uunet.uu.net>
- X+
- X (see changes) Environment variables were being copied into buff without a
- X length check, changed so only (QBUFLEN-1) characters are copied.
- X
- X***************
- X*** 265,267 ****
- X--- 269,381 ----
- X submitting a job, and the job's completion) is:
- X
- X response time = end time - start time
- X+
- X+ ...ADS
- X+
- X+ Issued qbatch.p2 14 Nov 1991
- X+ Current version is 2.2
- X+
- X+ 18th nov 1991
- X+
- X+ qp.c:
- X+
- X+ Bug pointed out by: Michael Gray <mjg@eng.cam.ac.uk>
- X+ change process priority (nice) BEFORE seutid.
- X+ (non root uid's can't increase priority (reduce nice value)!!)
- X+
- X+ Makefile:
- X+
- X+ Changed occurrences of cc to $(CC) to allow definition of compiler.
- X+ (compiles with gcc vn 1.39)
- X+
- X+ Added qbatch.h dependency to logging.o and time.o to force
- X+ recompilation after changing Makefile.
- X+
- X+ config.h/ config.c:
- X+
- X+ Pointed out to me by Michael Hamilton <hamilton@wcc.govt.nz>
- X+ that POSIX conforming cuserid() returns the user name relating
- X+ to the EFFECTIVE user id and not the logged in user id!
- X+ Since js is setuid root, the entry.qe_uname displayed in ql, and
- X+ used by jobdone (and used to send mailed monitors to) is always
- X+ root on a POSIX conformant system.
- X+
- X+ added 3 new defines to config.h, and related code to config.c
- X+ to define the source of the logged in user name.
- X+
- X+ Q_UNAME_ENV if defined will return the LOGNAME set in the
- X+ environment (theoretically, this should be a read
- X+ only environment variable, if it's not this could
- X+ be open to abuse).
- X+
- X+ Q_UNAME_CUSER if defined will return the result of cuserid()
- X+ as originally.
- X+
- X+ Q_UNAME_PWD if defined will extract the name from the passwd
- X+ struct returned by getpwuid(getuid());
- X+ code courtesy of Michael Hamilton but moved to where
- X+ I think it should be in config.[hc]
- X+
- X+ Q_UNAME_LOG if defined will extract the name from the utmp
- X+ entry using the getlogin() call.
- X+
- X+ General:
- X+
- X+ Tidied up sources a bit so that lint doesn't complain so much.
- X+
- X+ Added facility for using predefined configurations defined in
- X+ a new file config.ARCH. If users send me their configurations
- X+ when they have QBATCH working, I can include them in this file
- X+ and we can forestall much hacking of config.h for future users
- X+ on the same architecture.
- X+
- X+ 20 Nov 1991
- X+
- X+ Fixed a 'tail chasing dog' in config.h. If a system needs ???_t
- X+ defining, it needs it first of all in qbatch.h. qbatch.h is
- X+ included before config.h since the latter needs some of the defines
- X+ in qbatch.h???
- X+
- X+ Since I want to keep all architecture variables in the same file
- X+ (config.h) I've added an #ifdef for __QBATCH_H_ around the typedefs
- X+ and #included config.h in qbatch.h. .. Sounds convoluted but it
- X+ does what I want!
- X+
- X+ 21 Nov 1991
- X+
- X+ Ressurected a suggestion by:
- X+ Gary Faulkner <garyf@solution.uts.amdahl.com>
- X+
- X+ who suggested that monitors could be pipes. I implemented a suggestion
- X+ from Peter Da Silva for mailing monitors to the submitting user, assuming
- X+ this would be enough but I had occasion to write a script to submit a
- X+ job remotely (via dial-up uux) and wanted the monitor mailed back to me
- X+ (needed machine name in mail path) so it is now implemented.
- X+
- X+ If the monitor specified, either through a queue default monitor, or
- X+ through the -m option of js or thtough the environment variable MONITOR
- X+ starts with the pipe symbol '|', the monitor after stripping the leading
- X+ '|' will be used as a command to which to pipe the output.
- X+
- X+ Possible uses:
- X+ remote mail (as I needed)
- X+ (actually implemented as:
- X+
- X+ uux -Cpn ${site}!"/usr/local/bin/js -m '|mail `hostname`!`logname`' \
- X+ -n'Postings for `hostname` ' work"<${uniq}.job
- X+
- X+ And it worked!)
- X+ sending monitors direct to printers
- X+ Perhaps piping through a perl script to analyse the monitors
- X+ or even (for the adventurous) have one job create jcl (conditionally?)
- X+ on stdout, and pipe the monitor to js in the same or another queue.
- X+
- X+ Found bug! js was only checking enviroment for MONITOR if queue
- X+ default monitor was NONE. Changed this and made rejection message
- X+ more informative.
- X+
- X+ Added leading zero to patchlevel .. at the rate this is going,
- X+ I'll need it!
- X+
- X+ Issued qbatch.p3 22 Nov 1991
- X+ Current version is 2.03
- Index: doc/chap.04
- X***************
- X*** 100,106 ****
- X (monitors are discussed later.) This option allows a
- X user to define exactly where the monitor for this job
- X will be written it should be a fully specified absolute
- X! pathspec..
- X
- X -s <shell> As mentioned earlier, jobs are by default run under the
- X bourne shell. If the queue is fixed context, the shell
- X--- 100,110 ----
- X (monitors are discussed later.) This option allows a
- X user to define exactly where the monitor for this job
- X will be written it should be a fully specified absolute
- X! pathspec, the word MAIL (in upper case, which causes
- X! the monitor to be mailed to the submitting user) or a
- X! string starting with the pipe ('|') symbol, which
- X! causes the monitor to be piped to a command formed by
- X! stripping the leading pipe symbol from the string.
- X
- X -s <shell> As mentioned earlier, jobs are by default run under the
- X bourne shell. If the queue is fixed context, the shell
- X***************
- X*** 242,247 ****
- X--- 246,253 ----
- X used by the queue (see also MONITORS). So to check the progress
- X of a job, the user can use:
- X more `qf -m <queuename>`
- X+ NOTE: if the monitor is not accessible, (either NONE, MAIL or a
- X+ piped monitor, qf and qt will fail with a message to that effect.
- X
- X -l Provides a one line status report similar to qt -l but with the
- X columns headed.
- Index: doc/chap.05
- X***************
- X*** 83,88 ****
- X--- 83,91 ----
- X
- X In each case, if the monitor determined is a file, that will be used. If
- X it is a directory, a file <queuename>.mon will be used in that directory.
- X+ If the first character of the monitor is a pipe symbol '|', then the pipe
- X+ pipe symbol will be stripped, and the remainder of the string uses as a
- X+ command into which to pipe the output.
- X
- X In the above list, if more than one case is available a source later in the
- X list will overrule a source earlier (a monitor sourced by specifying -m to
- X***************
- X*** 112,126 ****
- X
- X WARNING!
- X
- X! 1. Such private monitors are ONLY used for queues whose default monitor
- X! is NONE.
- X!
- X! 2. Any profile information stored in the monitors will be split up
- X across several directories, thus making accounting and tuning more
- X difficult. (see 5a LOGGING).
- X
- X! 3. using 'more `qf -m <queuename>`' may give startling results when
- X! used for troubleshooting. (The result will depend on the setting
- X of YOUR MONITOR environment variable, and may not have any
- X relationship to the job you wish to check).
- X
- X--- 115,126 ----
- X
- X WARNING!
- X
- X! 1. Any profile information stored in the monitors will be split up
- X across several directories, thus making accounting and tuning more
- X difficult. (see 5a LOGGING).
- X
- X! 2. using 'more `qf -m <queuename>`' may give startling results when
- X! used for troubleshooting. (The result may depend on the setting
- X of YOUR MONITOR environment variable, and may not have any
- X relationship to the job you wish to check).
- X
- Index: doc/quickstart
- X***************
- X*** 122,128 ****
- X before submitting the job.
- X In both cases, if the pathspec refers to a file, then that will be used as
- X a monitor. If it refers to a directory, then in this case (if the queue is
- X! 'fast') a file <pathspec>/fast.mon will be used.
- X
- X NOTE If the monitor is redirected in this way, then using `qf -m fast`
- X will return either the monitor spec of the running job, or the queue
- X--- 122,131 ----
- X before submitting the job.
- X In both cases, if the pathspec refers to a file, then that will be used as
- X a monitor. If it refers to a directory, then in this case (if the queue is
- X! 'fast') a file <pathspec>/fast.mon will be used. If the 'pathspec' is a
- X! string starting with the pipe ('|') symbol, then after stripping the pipe
- X! symbol, the string will be used as the name (and parameters) of a command
- X! to which to pipe the output.
- X
- X NOTE If the monitor is redirected in this way, then using `qf -m fast`
- X will return either the monitor spec of the running job, or the queue
- Index: src/Makefile
- X***************
- X*** 18,23 ****
- X--- 18,26 ----
- X # the bourne shell path
- X SHELL=/bin/sh
- X
- X+ # The compiler to use
- X+ CC=cc
- X+
- X # the path to the mail program.
- X
- X MAILPATH="/usr/ucb/Mail"
- X***************
- X*** 64,90 ****
- X @echo "\n\007programs and scripts ... make complete\n"
- X
- X jj: jj.c qbatch.h config.o
- X! cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o -o $@
- X chmod 06711 $@
- X
- X jk: jk.c qbatch.h config.o
- X! cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o -o $@
- X chmod 06711 $@
- X
- X jm: jm.c qbatch.h config.o
- X! cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o -o $@
- X chmod 06711 $@
- X
- X jn: jn.c qbatch.h config.o
- X! cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o -o $@
- X chmod 06711 $@
- X
- X jr: jr.c qbatch.h config.o
- X! cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o -o $@
- X chmod 06711 $@
- X
- X js: js.c qbatch.h config.o
- X! cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o -o $@
- X chmod 06711 $@
- X
- X qa: qagen Makefile
- X--- 67,93 ----
- X @echo "\n\007programs and scripts ... make complete\n"
- X
- X jj: jj.c qbatch.h config.o
- X! $(CC) $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o -o $@
- X chmod 06711 $@
- X
- X jk: jk.c qbatch.h config.o
- X! $(CC) $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o -o $@
- X chmod 06711 $@
- X
- X jm: jm.c qbatch.h config.o
- X! $(CC) $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o -o $@
- X chmod 06711 $@
- X
- X jn: jn.c qbatch.h config.o
- X! $(CC) $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o -o $@
- X chmod 06711 $@
- X
- X jr: jr.c qbatch.h config.o
- X! $(CC) $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o -o $@
- X chmod 06711 $@
- X
- X js: js.c qbatch.h config.o
- X! $(CC) $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o -o $@
- X chmod 06711 $@
- X
- X qa: qagen Makefile
- X***************
- X*** 92,139 ****
- X chmod 0755 $@
- X
- X qc: qc.c qbatch.h config.o
- X! cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o -o $@
- X chmod 0700 $@
- X
- X qd: qd.c qbatch.h config.o
- X! cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o -o $@
- X chmod 0700 $@
- X
- X qe: qe.c qbatch.h config.o
- X! cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o -o $@
- X chmod 0700 $@
- X
- X qf: qf.c qbatch.h
- X! cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c -o $@
- X chmod 0711 $@
- X
- X qg: qg.c qbatch.h config.o
- X! cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o -o $@
- X chmod 0700 $@
- X
- X qh: qh.c qbatch.h config.o
- X! cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o -o $@
- X chmod 0700 $@
- X
- X ql: ql.c qbatch.h
- X! cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c -o $@
- X chmod 0711 $@
- X
- X qp: qp.c qbatch.h config.o time.o logging.o
- X! cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o time.o \
- X logging.o -o $@
- X chmod 0700 $@
- X
- X qs: qs.c qbatch.h config.o
- X! cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o -o $@
- X chmod 0700 $@
- X
- X qt: qt.c qbatch.h
- X! cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c -o $@
- X chmod 06711 $@
- X
- X qw: qw.c qbatch.h config.o
- X! cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o -o $@
- X chmod 0711 $@
- X
- X jobdone: jdgen Makefile
- X--- 95,142 ----
- X chmod 0755 $@
- X
- X qc: qc.c qbatch.h config.o
- X! $(CC) $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o -o $@
- X chmod 0700 $@
- X
- X qd: qd.c qbatch.h config.o
- X! $(CC) $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o -o $@
- X chmod 0700 $@
- X
- X qe: qe.c qbatch.h config.o
- X! $(CC) $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o -o $@
- X chmod 0700 $@
- X
- X qf: qf.c qbatch.h
- X! $(CC) $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c -o $@
- X chmod 0711 $@
- X
- X qg: qg.c qbatch.h config.o
- X! $(CC) $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o -o $@
- X chmod 0700 $@
- X
- X qh: qh.c qbatch.h config.o
- X! $(CC) $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o -o $@
- X chmod 0700 $@
- X
- X ql: ql.c qbatch.h
- X! $(CC) $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c -o $@
- X chmod 0711 $@
- X
- X qp: qp.c qbatch.h config.o time.o logging.o
- X! $(CC) $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o time.o \
- X logging.o -o $@
- X chmod 0700 $@
- X
- X qs: qs.c qbatch.h config.o
- X! $(CC) $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o -o $@
- X chmod 0700 $@
- X
- X qt: qt.c qbatch.h
- X! $(CC) $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c -o $@
- X chmod 06711 $@
- X
- X qw: qw.c qbatch.h config.o
- X! $(CC) $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o -o $@
- X chmod 0711 $@
- X
- X jobdone: jdgen Makefile
- X***************
- X*** 144,157 ****
- X $(SHELL) rcgen $(SHELL) $(BINDIR) $(QUEUEPATH)
- X chmod 0700 rc.QBATCH
- X
- X! config.o: config.c config.h qbatch.h
- X! cc $(CFLAG) $(QPATHS) $(QDEFINES) -c config.c
- X
- X! time.o: time.c config.h
- X! cc $(CFLAG) $(QPATHS) $(QDEFINES) -c time.c
- X
- X! logging.o: logging.c config.h
- X! cc $(CFLAG) $(QPATHS) $(QDEFINES) -c logging.c
- X
- X qbatch.h: what.h Makefile
- X touch qbatch.h
- X--- 147,160 ----
- X $(SHELL) rcgen $(SHELL) $(BINDIR) $(QUEUEPATH)
- X chmod 0700 rc.QBATCH
- X
- X! config.o: config.c config.h qbatch.h config.ARCH
- X! $(CC) $(CFLAG) $(QPATHS) $(QDEFINES) -c config.c
- X
- X! time.o: time.c config.h qbatch.h
- X! $(CC) $(CFLAG) $(QPATHS) $(QDEFINES) -c time.c
- X
- X! logging.o: logging.c config.h qbatch.h
- X! $(CC) $(CFLAG) $(QPATHS) $(QDEFINES) -c logging.c
- X
- X qbatch.h: what.h Makefile
- X touch qbatch.h
- Index: src/config.c
- X***************
- X*** 92,100 ****
- X void toggle_halt_status(newaction)
- X int newaction;
- X {
- X! #ifdef SIGCONT && SIGSTOP
- X kill ((childid * -1), (((newaction &qh_halt) == 0) ? SIGCONT : SIGSTOP));
- X #endif
- X }
- X #endif /* XPG3PGP */
- X
- X--- 92,102 ----
- X void toggle_halt_status(newaction)
- X int newaction;
- X {
- X! #ifdef SIGCONT
- X! #ifdef SIGSTOP
- X kill ((childid * -1), (((newaction &qh_halt) == 0) ? SIGCONT : SIGSTOP));
- X #endif
- X+ #endif
- X }
- X #endif /* XPG3PGP */
- X
- X***************
- X*** 207,213 ****
- X sigemptyset(&actsig.sa_mask);
- X actsig.sa_flags = 0;
- X actsig.sa_handler = (HANDLER_TYPE (*)())fun;
- X! sigaction(sig, actsig, (struct sigaction *) NULL);
- X }
- X
- X #endif /* SIGACTION */
- X--- 209,215 ----
- X sigemptyset(&actsig.sa_mask);
- X actsig.sa_flags = 0;
- X actsig.sa_handler = (HANDLER_TYPE (*)())fun;
- X! sigaction(sig, &actsig, (struct sigaction *) NULL);
- X }
- X
- X #endif /* SIGACTION */
- X***************
- X*** 241,247 ****
- X actsig.sv_mask = 0;
- X actsig.sv_flags = 0;
- X actsig.sv_handler = (HANDLER_TYPE (*)())sig;
- X! sigvec(sig, actsig, (struct sigvec *) NULL);
- X }
- X #endif /* SIGVEC */
- X void qb_resetterm()
- X--- 243,249 ----
- X actsig.sv_mask = 0;
- X actsig.sv_flags = 0;
- X actsig.sv_handler = (HANDLER_TYPE (*)())sig;
- X! sigvec(sig, &actsig, (struct sigvec *) NULL);
- X }
- X #endif /* SIGVEC */
- X void qb_resetterm()
- X***************
- X*** 320,323 ****
- X--- 322,373 ----
- X #ifdef RE_INSTALL
- X qb_setuser(); /* re-install interrupt handler */
- X #endif /* RE_INSTALL */
- X+ }
- X+ void q_username(str, len)
- X+ char *str;
- X+ int len;
- X+ {
- X+ /*
- X+ * find the logged in name for the user and copy the first len characters
- X+ * to str and null terminate
- X+ */
- X+ #ifdef Q_UNAME_PWD
- X+ #include <pwd.h>
- X+ struct passwd *passwd_info;
- X+ #endif /* Q_UNAME_PWD */
- X+ extern char * getenv();
- X+ char *name, *logname;
- X+ int i;
- X+ logname = getenv ("LOGNAME");
- X+ #ifdef Q_UNAME_PWD
- X+ /*
- X+ * Change to get real user ID - as per XPG3 - as js is setuid-root.
- X+ * hamilton@aladdin.wcc.govt.nz (Nov 1991)
- X+ */
- X+ passwd_info = getpwuid(getuid()) ;
- X+ if (passwd_info) {
- X+ name = passwd_info->pw_name;
- X+ }
- X+ else {
- X+ name = logname;
- X+ }
- X+ #endif /* Q_UNAME_PWD */
- X+ #ifdef Q_UNAME_CUSER
- X+ name = cuserid(entry.qe_uname);
- X+ #endif /* Q_UNAME_CUSER */
- X+ #ifdef Q_UNAME_LOG
- X+ name = getlogin();
- X+ #endif /* Q_UNAME_LOG */
- X+ #ifdef Q_UNAME_ENV
- X+ name = logname;
- X+ #endif /* Q_UNAME_ENV */
- X+ /* common code */
- X+ if (name == NULL) name = logname; /* if all else fails */
- X+ if (name != NULL) {
- X+ for (i = 0; ((i < len) && (name[i] != 0)); i++) str[i] = name[i];
- X+ }
- X+ else {
- X+ for (i = 0; i < len; i++) str[i] = '?'; /* last resort */
- X+ }
- X+ str[i] = 0;
- X }
- Index: src/config.h
- X***************
- X*** 18,23 ****
- X--- 18,53 ----
- X /* config.c. If your system cannot be configured using the existing #defines */
- X /* and code, add another #define or two, and the corresponding code sections.*/
- X
- X+ /* The file config.ARCH contains several pre-defined, claimed to be working */
- X+ /* configurations. If one of these matches your architecture, you can define*/
- X+ /* it here instead of ploughing through this lot! */
- X+ /******************************************************************************
- X+ *
- X+ * we have a circular reference problem!
- X+ *
- X+ * I want all machine /os dependencies in this file but some are needed in
- X+ * qbatch.h so I need to include this twice! once for qbatch.h, and once for
- X+ * everything else!
- X+ * Hence the #ifdef __QBATCH_H_
- X+ *
- X+ * Note don't forget it if you need one or more of these typedef's in config.ARCH
- X+ *
- X+ ******************************************************************************/
- X+ #undef ARCH_DEFINED
- X+ #define SUNSPARC.411
- X+ #include "config.ARCH"
- X+ #ifndef ARCH_DEFINED /* sorry, You'll have to do some work! */
- X+
- X+ #ifdef __QBATCH_H_
- X+
- X+ /* Some systems don't define pid_t, if not typedef it here */
- X+ /*typedef int pid_t;*/
- X+ /* and some don't define these */
- X+ /*typedef short uid_t;*/
- X+ /*typedef short gid_t;*/
- X+
- X+ #else /* __QBATCH_H_ */
- X+
- X /*---------------------------------------------------------------------------*/
- X /* Proces group calls (define only one)
- X /* Allow a signal (SIGKILL, SIGHALT, or SIGCONT) sent to a running job, to be
- X***************
- X*** 106,113 ****
- X /* int but have not changed the analysis macros, so they're still trying to */
- X /* analyse a union wait out of an int without casting it first!!) */
- X
- X! /*typedef int WAIT_TYPE; */ /* XPG3 */
- X! typedef union wait WAIT_TYPE;
- X
- X #define WAIT_XPG3 /* XPG3 */
- X
- X--- 136,143 ----
- X /* int but have not changed the analysis macros, so they're still trying to */
- X /* analyse a union wait out of an int without casting it first!!) */
- X
- X! typedef int WAIT_TYPE; /* XPG3 */
- X! /*typedef union wait WAIT_TYPE;*/
- X
- X #define WAIT_XPG3 /* XPG3 */
- X
- X***************
- X*** 131,143 ****
- X /*define QCLOCK_TICK CLK_TCK */
- X /*define QCLOCK_TICK gethz();*/
- X
- X- /* Some systems don't define pid_t, if not typedef it here */
- X- /*typedef int pid_t;*/
- X- /* and some don't define these */
- X- /*typedef short uid_t;*/
- X- /*typedef short gid_t;*/
- X-
- X /* if needed , define these */
- X
- X /*#define strchr index */
- X /*#define strrchr rindex */
- X--- 161,196 ----
- X /*define QCLOCK_TICK CLK_TCK */
- X /*define QCLOCK_TICK gethz();*/
- X
- X /* if needed , define these */
- X
- X /*#define strchr index */
- X /*#define strrchr rindex */
- X+
- X+ /*---------------------------------------------------------------------------*/
- X+ /* see NEWS for user name problems with POSIX conformant systems. */
- X+ /* Define one of these depending on the required source of the logged in */
- X+ /* user name for use in js (used by ql, jobdone, and qp */
- X+ /*
- X+ *Q_UNAME_ENV if defined will return the LOGNAME set in the
- X+ * environment (theoretically, this should be a read
- X+ * only environment variable, if it's not this could
- X+ * be open to abuse).
- X+ *
- X+ *Q_UNAME_CUSER if defined will return the result of cuserid()
- X+ * as originally.
- X+ *
- X+ *Q_UNAME_PWD if defined will extract the name from the passwd
- X+ * struct returned by getpwuid(getuid());
- X+ * code courtesy of Michael Hamilton but moved to where
- X+ * I think it should be in config.[hc]
- X+ *
- X+ *Q_UNAME_LOG if defined will extract the name from the utmp
- X+ * entry using the getlogin() call.
- X+ */
- X+ #define Q_UNAME_CUSER
- X+ /* #DEFINE Q_UNAME_ENV */
- X+ /* #define Q_UNAME_PWD */
- X+ /* #define Q_UNAME_LOG */
- X+
- X+ #endif /* __QBATCH_H_ */
- X+ #endif /* not ARCH_DEFINED */
- Index: src/jj.c
- X***************
- X*** 12,20 ****
- X #include "qbatch.h"
- X int fpq = 0;
- X int i, l;
- X- int killed = 0;
- X long j, k;
- X- int aflag = 0, kflag = 0;
- X pid_t jpid = 0;
- X uid_t userid = 0, entryno = 0;
- X off_t *entries;
- X--- 12,18 ----
- X***************
- X*** 21,27 ****
- X uid_t *uids;
- X char queue[128];
- X char *queuename;
- X- char buff [128];
- X struct queue_entry entry1;
- X #include "config.h"
- X
- X--- 19,24 ----
- Index: src/jm.c
- X***************
- X*** 11,17 ****
- X
- X #include "qbatch.h"
- X int fpq = 0;
- X! int j, entryno = 0;
- X uid_t uid;
- X int changed = 0;
- X char *queuename;
- X--- 11,18 ----
- X
- X #include "qbatch.h"
- X int fpq = 0;
- X! entryno = 0;
- X! long j;
- X uid_t uid;
- X int changed = 0;
- X char *queuename;
- Index: src/jn.c
- X***************
- X*** 11,17 ****
- X
- X #include "qbatch.h"
- X int fpq = 0;
- X! int j, entryno = 0;
- X uid_t uid;
- X char *queuename;
- X char queue[128];
- X--- 11,18 ----
- X
- X #include "qbatch.h"
- X int fpq = 0;
- X! entryno = 0;
- X! long j;
- X uid_t uid;
- X char *queuename;
- X char queue[128];
- Index: src/js.c
- X***************
- X*** 16,29 ****
- X int fpq = 0;
- X FILE *fpin, *fpout, *fp;
- X char temp [16], *jcl, *jcwd = NULL, *command = NULL;
- X! int i,j,k, debug = 0;
- X int qpuid[10];
- X int qpgid[10];
- X int lflag = 0, sflag = 0, fixedcontext = 0, permission = -1;
- X int gotuid, gotgid;
- X! uid_t jobuid, saveuid, testuid;
- X gid_t jobgid, savegid;
- X- int envcount = 0;
- X int notify = 0;
- X char envar[64];
- X char *fcptr;
- X--- 16,28 ----
- X int fpq = 0;
- X FILE *fpin, *fpout, *fp;
- X char temp [16], *jcl, *jcwd = NULL, *command = NULL;
- X! int i,j, debug = 0;
- X int qpuid[10];
- X int qpgid[10];
- X int lflag = 0, sflag = 0, fixedcontext = 0, permission = -1;
- X int gotuid, gotgid;
- X! uid_t jobuid, saveuid;
- X gid_t jobgid, savegid;
- X int notify = 0;
- X char envar[64];
- X char *fcptr;
- X***************
- X*** 79,85 ****
- X {
- X if (ptr != root) return (-1);
- X ptr = (struct envlist *) malloc (sizeof(struct envlist));
- X! ptr->envptr = malloc(strlen(str)+1);
- X strcpy (ptr->envptr, str);
- X ptr->left = (struct envlist *) NULL;
- X ptr->right = (struct envlist *) NULL;
- X--- 78,84 ----
- X {
- X if (ptr != root) return (-1);
- X ptr = (struct envlist *) malloc (sizeof(struct envlist));
- X! ptr->envptr = (char *) malloc(strlen(str)+1);
- X strcpy (ptr->envptr, str);
- X ptr->left = (struct envlist *) NULL;
- X ptr->right = (struct envlist *) NULL;
- X***************
- X*** 93,99 ****
- X if (ptr->left == (struct envlist *) NULL)
- X {
- X ptr->left = (struct envlist *) malloc (sizeof(struct envlist));
- X! ptr->left->envptr = malloc(strlen(str)+1);
- X strcpy (ptr->left->envptr, str);
- X ptr->left->left = (struct envlist *) NULL;
- X ptr->left->right = (struct envlist *) NULL;
- X--- 92,98 ----
- X if (ptr->left == (struct envlist *) NULL)
- X {
- X ptr->left = (struct envlist *) malloc (sizeof(struct envlist));
- X! ptr->left->envptr = (char *) malloc(strlen(str)+1);
- X strcpy (ptr->left->envptr, str);
- X ptr->left->left = (struct envlist *) NULL;
- X ptr->left->right = (struct envlist *) NULL;
- X***************
- X*** 106,112 ****
- X if (ptr->right == (struct envlist *) NULL)
- X {
- X ptr->right = (struct envlist *) malloc (sizeof(struct envlist));
- X! ptr->right->envptr = malloc(strlen(str)+1);
- X strcpy (ptr->right->envptr, str);
- X ptr->right->left = (struct envlist *) NULL;
- X ptr->right->right = (struct envlist *) NULL;
- X--- 105,111 ----
- X if (ptr->right == (struct envlist *) NULL)
- X {
- X ptr->right = (struct envlist *) malloc (sizeof(struct envlist));
- X! ptr->right->envptr = (char *) malloc(strlen(str)+1);
- X strcpy (ptr->right->envptr, str);
- X ptr->right->left = (struct envlist *) NULL;
- X ptr->right->right = (struct envlist *) NULL;
- X***************
- X*** 116,126 ****
- X return (add_envlist (ptr->right, str));
- X }
- X
- X! void usage(i)
- X! int i;
- X {
- X puts ("Usage: js [-r<replycode>] [-m<monitor>] [-n<jobname>] [-s <shell>] queuename [<jclfile>]");
- X! qb_term (i);
- X }
- X main (argc, argv, envp)
- X int argc;
- X--- 115,125 ----
- X return (add_envlist (ptr->right, str));
- X }
- X
- X! void usage(exit_val)
- X! int exit_val;
- X {
- X puts ("Usage: js [-r<replycode>] [-m<monitor>] [-n<jobname>] [-s <shell>] queuename [<jclfile>]");
- X! qb_term (exit_val);
- X }
- X main (argc, argv, envp)
- X int argc;
- X***************
- X*** 186,205 ****
- X fprintf (stderr, "Queue %s is not accepting entries!\n", queuename);
- X qb_exit(-1);
- X }
- X! if ((strcmp (head.qh_defmon, "NONE") == 0))
- X {
- X! if (*monitor == 0)
- X! {
- X! fcptr = getenv ("MONITOR");
- X! if (fcptr == NULL)
- X {
- X! fprintf(stderr, "No MONITOR environment string.. cannot submit\n");
- X! qb_exit(-1);
- X }
- X! strcpy (monitor, fcptr);
- X! }
- X }
- X! if ((*monitor != 0) && (strcmp(monitor, "MAIL") != 0))
- X {
- X if (*monitor != '/') /* monitor should be full pathspec */
- X { /* so add current working directory */
- X--- 185,206 ----
- X fprintf (stderr, "Queue %s is not accepting entries!\n", queuename);
- X qb_exit(-1);
- X }
- X! if (*monitor == 0)
- X {
- X! fcptr = getenv ("MONITOR");
- X! if (fcptr == NULL)
- X! {
- X! if ((strcmp (head.qh_defmon, "NONE") == 0))
- X {
- X! fprintf(stderr, "Queue default monitor is NONE:\n");
- X! fprintf(stderr, "You have specified no monitor to js and have\n");
- X! fprintf(stderr, "no MONITOR environment string.. cannot submit\n");
- X! qb_exit(-1);
- X }
- X! }
- X! else strcpy (monitor, fcptr);
- X }
- X! if ((*monitor != 0) && (strcmp(monitor, "MAIL") != 0) && (*monitor != '|'))
- X {
- X if (*monitor != '/') /* monitor should be full pathspec */
- X { /* so add current working directory */
- X***************
- X*** 534,540 ****
- X strcpy (entry.qe_tty, buff+i+1);
- X }
- X else strcpy (entry.qe_tty, "");
- X! cuserid(entry.qe_uname);
- X i = head.qh_noentries ++;
- X lseek (fpq, 0, SEEK_SET);
- X write (fpq, &head, sizeof(head));
- X--- 535,541 ----
- X strcpy (entry.qe_tty, buff+i+1);
- X }
- X else strcpy (entry.qe_tty, "");
- X! q_username(entry.qe_uname, 15);
- X i = head.qh_noentries ++;
- X lseek (fpq, 0, SEEK_SET);
- X write (fpq, &head, sizeof(head));
- Index: src/logging.c
- X***************
- X*** 56,62 ****
- X fprintf (log, "\"%s\":", eentry->qe_jobname); /* job name */
- X fprintf (log, "%lu:", q_queued); /* process times are in 1/100*/
- X fprintf (log, "%lu:", q_real); /* seconds (subject to the */
- X! fprintf (log, "%lu:", q_user); /* accuuracy of the clock. */
- X fprintf (log, "%lu\n", q_system);
- X fclose (log);
- X return;
- X--- 56,62 ----
- X fprintf (log, "\"%s\":", eentry->qe_jobname); /* job name */
- X fprintf (log, "%lu:", q_queued); /* process times are in 1/100*/
- X fprintf (log, "%lu:", q_real); /* seconds (subject to the */
- X! fprintf (log, "%lu:", q_user); /* accuracy of the clock. */
- X fprintf (log, "%lu\n", q_system);
- X fclose (log);
- X return;
- Index: src/qbatch.h
- X***************
- X*** 20,25 ****
- X--- 20,29 ----
- X static char QbCR1 []= "@(#) Copyright (c) Vita Services 1990";
- X static char QbCR2 []= "@(#) (c) Vita Fibres 1990 1991";
- X
- X+ #define __QBATCH_H_
- X+ #include "config.h"
- X+ #undef __QBATCH_H_
- X+
- X /* structure of flag byte */
- X #define qh_repeat 1 /* repeat current job flag */
- X #define qh_kill 2 /* kill current job flag */
- Index: src/qc.c
- X***************
- X*** 21,27 ****
- X char queue [64];
- X char qpath [64];
- X char monitor[64];
- X- struct stat status;
- X int fpq;
- X FILE *fp;
- X main (argc, argv)
- X--- 21,26 ----
- X***************
- X*** 80,86 ****
- X }
- X }
- X else strcpy (qpath, SPOOLPATH);
- X! if ((monitor[0] != 0) && (strcmp (monitor, "NONE") != 0) && (strcmp(monitor, "MAIL") != 0))
- X {
- X if (strlen (monitor) > 63)
- X {
- X--- 79,86 ----
- X }
- X }
- X else strcpy (qpath, SPOOLPATH);
- X! if ((monitor[0] != 0) && (strcmp (monitor, "NONE") != 0) && (strcmp(monitor, "MAIL") != 0)
- X! && (monitor [0] != '|'))
- X {
- X if (strlen (monitor) > 63)
- X {
- X***************
- X*** 121,127 ****
- X }
- X else
- X {
- X! if ((strcmp (monitor, "NONE") != 0) && (strcmp(monitor, "MAIL") != 0))
- X {
- X strcpy (monitor, qpath);
- X if (monitor[strlen(monitor) -1] != '/') strcat (monitor, "/");
- X--- 121,128 ----
- X }
- X else
- X {
- X! if ((strcmp (monitor, "NONE") != 0) && (strcmp(monitor, "MAIL") != 0)
- X! && (monitor [0] != '|'))
- X {
- X strcpy (monitor, qpath);
- X if (monitor[strlen(monitor) -1] != '/') strcat (monitor, "/");
- Index: src/qf.c
- X***************
- X*** 13,25 ****
- X int mflag = 0, jflag = 0, qflag = 0, pflag = 0, aflag = 0,rflag = 0, sflag = 0, nflag = 0;
- X int lflag = 0, Lflag=0;
- X char buff[128];
- X! FILE *fpq, *fp;
- X char *queuename;
- X- char *mon, *fcptr;
- X int entryno = 0;
- X time_t now, then;
- X struct tm *jtimes;
- X- int idle;
- X char monitor [128];
- X char tval[32];
- X void q_version()
- X--- 13,23 ----
- X int mflag = 0, jflag = 0, qflag = 0, pflag = 0, aflag = 0,rflag = 0, sflag = 0, nflag = 0;
- X int lflag = 0, Lflag=0;
- X char buff[128];
- X! FILE *fpq;
- X char *queuename;
- X int entryno = 0;
- X time_t now, then;
- X struct tm *jtimes;
- X char monitor [128];
- X char tval[32];
- X void q_version()
- X***************
- X*** 44,56 ****
- X unsigned long val;
- X int opt;
- X {
- X! int temp;
- X char sval[8];
- X *tval = 0;
- X temp = val/8640000;
- X if (temp)
- X {
- X! sprintf(sval, "%d", temp);
- X strcat (tval, sval);
- X if (opt) strcat (tval, " Days ");
- X else strcat (tval, ":");
- X--- 42,54 ----
- X unsigned long val;
- X int opt;
- X {
- X! unsigned long temp;
- X char sval[8];
- X *tval = 0;
- X temp = val/8640000;
- X if (temp)
- X {
- X! sprintf(sval, "%lu", temp);
- X strcat (tval, sval);
- X if (opt) strcat (tval, " Days ");
- X else strcat (tval, ":");
- X***************
- X*** 59,65 ****
- X temp = val/360000;
- X if ((temp) || (*tval))
- X {
- X! sprintf(sval, "%d", temp);
- X strcat (tval, sval);
- X if (opt) strcat (tval, " Hrs ");
- X else strcat (tval, ":");
- X--- 57,63 ----
- X temp = val/360000;
- X if ((temp) || (*tval))
- X {
- X! sprintf(sval, "%lu", temp);
- X strcat (tval, sval);
- X if (opt) strcat (tval, " Hrs ");
- X else strcat (tval, ":");
- X***************
- X*** 69,75 ****
- X if ((temp) || (*tval))
- X {
- X if (*tval) sprintf(sval, "%02d", temp);
- X! else sprintf(sval, "%d", temp);
- X strcat (tval, sval);
- X if (opt) strcat (tval, " Min ");
- X else strcat (tval, ":");
- X--- 67,73 ----
- X if ((temp) || (*tval))
- X {
- X if (*tval) sprintf(sval, "%02d", temp);
- X! else sprintf(sval, "%lu", temp);
- X strcat (tval, sval);
- X if (opt) strcat (tval, " Min ");
- X else strcat (tval, ":");
- X***************
- X*** 76,87 ****
- X val%=6000;
- X }
- X temp = val/100;
- X! if (*tval) sprintf(sval, "%02d", temp);
- X! else sprintf(sval, "%d", temp);
- X strcat (tval, sval);
- X strcat (tval, ".");
- X temp = val%100;
- X! sprintf(sval, "%02d", temp);
- X strcat (tval, sval);
- X strcat (tval, " Sec");
- X return(tval);
- X--- 74,85 ----
- X val%=6000;
- X }
- X temp = val/100;
- X! if (*tval) sprintf(sval, "%02lu", temp);
- X! else sprintf(sval, "%lu", temp);
- X strcat (tval, sval);
- X strcat (tval, ".");
- X temp = val%100;
- X! sprintf(sval, "%02lu", temp);
- X strcat (tval, sval);
- X strcat (tval, " Sec");
- X return(tval);
- X***************
- X*** 266,271 ****
- X--- 264,276 ----
- X fclose (fpq);
- X exit(-1);
- X }
- X+ if ((strcmp (head.qh_defmon, "MAIL") == 0)
- X+ || (*head.qh_defmon == '|'))
- X+ {
- X+ fprintf(stderr, "%s has a piped monitor\007\n", queuename);
- X+ fclose (fpq);
- X+ exit(-1);
- X+ }
- X puts (head.qh_defmon);
- X }
- X else
- X***************
- X*** 307,313 ****
- X }
- X if (mflag != 0)
- X {
- X! if (entry.qe_monitor[0] != 0) puts (entry.qe_monitor);
- X else
- X {
- X if (strcmp (head.qh_defmon, "NONE") == 0)
- X--- 312,329 ----
- X }
- X if (mflag != 0)
- X {
- X! if (entry.qe_monitor[0] != 0)
- X! {
- X! if ((strcmp (entry.qe_monitor, "MAIL") == 0)
- X! || (*entry.qe_monitor == '|'))
- X! {
- X! fprintf(stderr, "This job in %s has a piped monitor\007\n",
- X! queuename);
- X! fclose (fpq);
- X! exit(-1);
- X! }
- X! puts (entry.qe_monitor);
- X! }
- X else
- X {
- X if (strcmp (head.qh_defmon, "NONE") == 0)
- X***************
- X*** 316,321 ****
- X--- 332,344 ----
- X fclose (fpq);
- X exit(-1);
- X }
- X+ if ((strcmp (head.qh_defmon, "MAIL") == 0)
- X+ || (*head.qh_defmon == '|'))
- X+ {
- X+ fprintf(stderr, "%s has a piped monitor\007\n", queuename);
- X+ fclose (fpq);
- X+ exit(-1);
- X+ }
- X puts (head.qh_defmon);
- X }
- X }
- X***************
- X*** 327,332 ****
- X--- 350,362 ----
- X if (strcmp (head.qh_defmon, "NONE") == 0)
- X {
- X fprintf(stderr, "%s has NO default monitor\007\n", queuename);
- X+ fclose (fpq);
- X+ exit(-1);
- X+ }
- X+ if ((strcmp (head.qh_defmon, "MAIL") == 0)
- X+ || (*head.qh_defmon == '|'))
- X+ {
- X+ fprintf(stderr, "%s has a piped monitor\007\n", queuename);
- X fclose (fpq);
- X exit(-1);
- X }
- Index: src/ql.c
- X***************
- X*** 13,21 ****
- X #include <time.h>
- X FILE *fpq;
- X char buff[128];
- X! char started[7], repeated[3], killed[3], enabled[3], stopped[3], halted[3];
- X! char Yes[] = "Yes";
- X! char No[] = "No";
- X struct tm *jtimes;
- X char *queuename;
- X int i, aflag;
- X--- 13,19 ----
- X #include <time.h>
- X FILE *fpq;
- X char buff[128];
- X! char started[7];
- X struct tm *jtimes;
- X char *queuename;
- X int i, aflag;
- Index: src/qp.c
- X***************
- X*** 20,27 ****
- X int fpq = 0;
- X int fplck = 0;
- X int fptemp = 0;
- X! int result;
- X! int interrupt = 0;
- X int mail = 0;
- X FILE *fpin,
- X *mon;
- X--- 20,26 ----
- X int fpq = 0;
- X int fplck = 0;
- X int fptemp = 0;
- X! long result;
- X int mail = 0;
- X FILE *fpin,
- X *mon;
- X***************
- X*** 54,60 ****
- X char * print_time(val)
- X unsigned long val;
- X {
- X! int temp;
- X char sval[8];
- X static char tval[32];
- X *tval = 0;
- X--- 53,59 ----
- X char * print_time(val)
- X unsigned long val;
- X {
- X! unsigned long temp;
- X char sval[8];
- X static char tval[32];
- X *tval = 0;
- X***************
- X*** 61,67 ****
- X temp = val/360000;
- X if (temp)
- X {
- X! sprintf(sval, "%d", temp);
- X strcpy (tval, sval);
- X strcat(tval, ":");
- X val%=360000;
- X--- 60,66 ----
- X temp = val/360000;
- X if (temp)
- X {
- X! sprintf(sval, "%lu", temp);
- X strcpy (tval, sval);
- X strcat(tval, ":");
- X val%=360000;
- X***************
- X*** 69,87 ****
- X temp = val/6000;
- X if ((temp) || (*tval))
- X {
- X! if (*tval) sprintf(sval, "%02d", temp);
- X! else sprintf(sval, "%d", temp);
- X strcat (tval, sval);
- X strcat (tval, ":");
- X val%=6000;
- X }
- X temp = val/100;
- X! if (*tval) sprintf(sval, "%02d", temp);
- X! else sprintf(sval, "%d", temp);
- X strcat (tval, sval);
- X strcat (tval, ".");
- X temp = val%100;
- X! sprintf(sval, "%02d", temp);
- X strcat (tval, sval);
- X return(tval);
- X }
- X--- 68,86 ----
- X temp = val/6000;
- X if ((temp) || (*tval))
- X {
- X! if (*tval) sprintf(sval, "%02lu", temp);
- X! else sprintf(sval, "%lu", temp);
- X strcat (tval, sval);
- X strcat (tval, ":");
- X val%=6000;
- X }
- X temp = val/100;
- X! if (*tval) sprintf(sval, "%02lu", temp);
- X! else sprintf(sval, "%lu", temp);
- X strcat (tval, sval);
- X strcat (tval, ".");
- X temp = val%100;
- X! sprintf(sval, "%02lu", temp);
- X strcat (tval, sval);
- X return(tval);
- X }
- X***************
- X*** 308,314 ****
- X else
- X { /* get entry and fork it */
- X read (fpq, &entry, sizeof (entry));
- X! if ((strcmp (entry.qe_monitor, "MAIL") != 0) && (entry.qe_monitor[0] != 0))
- X {
- X /* check if non-default monitor can be accessed */
- X mon = fopen(entry.qe_monitor, "r");
- X--- 307,314 ----
- X else
- X { /* get entry and fork it */
- X read (fpq, &entry, sizeof (entry));
- X! if ((strcmp (entry.qe_monitor, "MAIL") != 0) && (entry.qe_monitor[0] != 0)
- X! && (*entry.qe_monitor != '|'))
- X {
- X /* check if non-default monitor can be accessed */
- X mon = fopen(entry.qe_monitor, "r");
- X***************
- X*** 333,339 ****
- X }
- X else
- X {
- X! if ((strcmp (entry.qe_monitor, "MAIL") == 0) || (strcmp (head.qh_defmon, "MAIL") == 0))
- X {
- X mail = 1;
- X strcpy (temp, head.qh_spool);
- X--- 333,342 ----
- X }
- X else
- X {
- X! if ((strcmp (entry.qe_monitor, "MAIL") == 0) /* mail */
- X! || (strcmp (head.qh_defmon, "MAIL") == 0) /* mail */
- X! || (*head.qh_defmon == '|') /* pipe */
- X! || (*entry.qe_monitor == '|')) /* pipe */
- X {
- X mail = 1;
- X strcpy (temp, head.qh_spool);
- X***************
- X*** 420,426 ****
- X envvar = &buff1[i];
- X i = strlen(envvar);
- X if (envvar[i-1] == '\n') envvar[i-1] = 0;
- X! envs [j] = malloc(i);
- X strcpy (envs[j++], envvar);
- X if (j > (QMAXENV - 5)) break; /* can't fit any more in table */
- X }
- X--- 423,429 ----
- X envvar = &buff1[i];
- X i = strlen(envvar);
- X if (envvar[i-1] == '\n') envvar[i-1] = 0;
- X! envs [j] = (char *)malloc(i);
- X strcpy (envs[j++], envvar);
- X if (j > (QMAXENV - 5)) break; /* can't fit any more in table */
- X }
- X***************
- X*** 432,438 ****
- X envs[j++] = qentry;
- X j = 0;
- X jtimes = (struct tm *)localtime (&head.qh_start);
- X! if ((entry.qe_monitor[0] != 0) && (strcmp (entry.qe_monitor, "MAIL") !=0))
- X {
- X mon = freopen (entry.qe_monitor, "a", stdout);
- X mon = freopen (entry.qe_monitor, "a", stderr);
- X--- 435,442 ----
- X envs[j++] = qentry;
- X j = 0;
- X jtimes = (struct tm *)localtime (&head.qh_start);
- X! if ((entry.qe_monitor[0] != 0) && (strcmp (entry.qe_monitor, "MAIL") !=0)
- X! && (*entry.qe_monitor != '|'))
- X {
- X mon = freopen (entry.qe_monitor, "a", stdout);
- X mon = freopen (entry.qe_monitor, "a", stderr);
- X***************
- X*** 450,455 ****
- X--- 454,460 ----
- X mon = freopen (head.qh_defmon, "a", stderr);
- X }
- X }
- X+ nice (head.qh_priority); /* set priority */
- X if (setuid (entry.qe_uid) != 0)
- X {
- X perror ("cannot change uid!!");
- X***************
- X*** 456,462 ****
- X exit (-1);
- X }
- X setgid (entry.qe_gid);
- X- nice (head.qh_priority); /* set priority */
- X if (execve (args[0], args, envs) == -1)
- X {
- X perror ("cannot execute job! ");
- X--- 461,466 ----
- X***************
- X*** 487,493 ****
- X q_wait(exit_message);
- X qb_get_timer(&q_real, &q_user, &q_system);
- X childid = 0;
- X! if ((strcmp(entry.qe_monitor, "MAIL") != 0) && (entry.qe_monitor[0] != 0))
- X {
- X mon = fopen (entry.qe_monitor, "a");
- X }
- X--- 491,498 ----
- X q_wait(exit_message);
- X qb_get_timer(&q_real, &q_user, &q_system);
- X childid = 0;
- X! if ((strcmp(entry.qe_monitor, "MAIL") != 0) && (entry.qe_monitor[0] != 0)
- X! && (*entry.qe_monitor != '|'))
- X {
- X mon = fopen (entry.qe_monitor, "a");
- X }
- X***************
- X*** 515,525 ****
- X if (mail)
- X {
- X mon = fopen (temp, "r");
- X #ifdef SUBJECT
- X! sprintf (path, "%s %s \"Monitor for your job in \'%s\' queue\" %s", MAILPATH, SUBJECT, queuename, entry.qe_uname);
- X #else
- X! sprintf (path, "%s %s", MAILPATH, entry.qe_uname);
- X #endif /* SUBJECT */
- X fpin = popen (path, "w");
- X while (fgets (buff, 128, mon) != NULL)
- X fputs (buff, fpin);
- X--- 520,542 ----
- X if (mail)
- X {
- X mon = fopen (temp, "r");
- X+ if ((*head.qh_defmon == '|')
- X+ || (*entry.qe_monitor == '|'))
- X+ {
- X+ if (*head.qh_defmon == '|')
- X+ strcpy(path, &head.qh_defmon[1]); /* stripping '|' */
- X+ else
- X+ strcpy(path, &entry.qe_monitor[1]);
- X+ }
- X+ else
- X+ {
- X #ifdef SUBJECT
- X! sprintf (path, "%s %s \"Monitor for your job in \'%s\' queue\" %s",
- X! MAILPATH, SUBJECT, queuename, entry.qe_uname);
- X #else
- X! sprintf (path, "%s %s", MAILPATH, entry.qe_uname);
- X #endif /* SUBJECT */
- X+ }
- X fpin = popen (path, "w");
- X while (fgets (buff, 128, mon) != NULL)
- X fputs (buff, fpin);
- Index: src/time.c
- X***************
- X*** 46,52 ****
- X #include "config.h"
- X struct tms start_times, end_times;
- X clock_t real_start, real_end;
- X! int clock_tick = 0;
- X void qb_set_timer()
- X {
- X if (!clock_tick) clock_tick = QCLOCK_TICK;
- X--- 46,52 ----
- X #include "config.h"
- X struct tms start_times, end_times;
- X clock_t real_start, real_end;
- X! clock_t clock_tick = 0;
- X void qb_set_timer()
- X {
- X if (!clock_tick) clock_tick = QCLOCK_TICK;
- Index: src/whatgen
- X***************
- X*** 9,12 ****
- X #************************************************************************#
- X set `cat patchlevel.h`
- X echo "static char QbSID[]= \042@(#) QBATCH (c) \tVersion: 2.$3 \
- X! (12 November 1991)\042;">what.h
- X--- 9,12 ----
- X #************************************************************************#
- X set `cat patchlevel.h`
- X echo "static char QbSID[]= \042@(#) QBATCH (c) \tVersion: 2.$3 \
- X! (Fri 22 Nov 91)\042;">what.h
- END_OF_FILE
- if test 44685 -ne `wc -c <'patches/qbatch.p03'`; then
- echo shar: \"'patches/qbatch.p03'\" unpacked with wrong size!
- fi
- # end of 'patches/qbatch.p03'
- fi
- echo shar: End of archive 2 \(of 2\).
- cp /dev/null ark2isdone
- MISSING=""
- for I in 1 2 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked both archives.
- rm -f ark[1-9]isdone
- else
- echo You still need to unpack the following archives:
- echo " " ${MISSING}
- fi
- ## End of shell archive.
- exit 0
-
- exit 0 # Just in case...
- --
- Kent Landfield INTERNET: kent@sparky.IMD.Sterling.COM
- Sterling Software, IMD UUCP: uunet!sparky!kent
- Phone: (402) 291-8300 FAX: (402) 291-4362
- Please send comp.sources.misc-related mail to kent@uunet.uu.net.
-