home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume26 / QBATCH / patch03b < prev    next >
Encoding:
Text File  |  1991-11-29  |  47.1 KB  |  1,555 lines

  1. Newsgroups: comp.sources.misc
  2. From: alan@tharr (Alan Saunders)
  3. Subject:  v26i086:  QBATCH - a queued batch processing system for UNIX, Patch03b/2
  4. Message-ID: <1991Nov30.032033.16278@sparky.imd.sterling.com>
  5. X-Md4-Signature: 8785776b015a1eec3b7a2ddeafcd20eb
  6. Date: Sat, 30 Nov 1991 03:20:33 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: alan@tharr (Alan Saunders)
  10. Posting-number: Volume 26, Issue 86
  11. Archive-name: QBATCH/patch03b
  12. Environment: UNIX
  13. Patch-To: QBATCH: Volume 25, Issue 20-25
  14.  
  15. #! /bin/sh
  16. # This is a shell archive.  Remove anything before this line, then unpack
  17. # it by saving it into a file and typing "sh file".  To overwrite existing
  18. # files, type "sh file -c".  You can also feed this as standard input via
  19. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  20. # will see the following message at the end:
  21. #        "End of archive 2 (of 2)."
  22. # Contents:  patches/qbatch.p03
  23. # Wrapped by root@vfib_d on Fri Nov 22 12:15:09 1991
  24. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  25. if test -f 'patches/qbatch.p03' -a "${1}" != "-c" ; then 
  26.   echo shar: Will not clobber existing file \"'patches/qbatch.p03'\"
  27. else
  28. echo shar: Extracting \"'patches/qbatch.p03'\" \(44685 characters\)
  29. sed "s/^X//" >'patches/qbatch.p03' <<'END_OF_FILE'
  30. Prereq: 2
  31. Index: src/patchlevel.h
  32. X***************
  33. X*** 1 ****
  34. X! #define PATCHLEVEL 2
  35. X--- 1 ----
  36. X! #define PATCHLEVEL 03
  37. Index: INSTALL
  38. X***************
  39. X*** 16,27 ****
  40. X  here may be overruled by it's contents.
  41. X  
  42. X  Once you are satisfied, change directory to the src directory, and have
  43. X! a look at config.h.  You should find configuration options available
  44. X! which are supported by your system.  If not, there should be enough
  45. X! information contained therein to allow you to add further options if
  46. X! you both feel it necessary, and are capable.  Define the configuration
  47. X! for your platform by commenting out those options which are not
  48. X! supported, and uncommenting those (one in each group) which are.
  49. X  
  50. X  Then look at the Makefile, and ensure that BINDIR is set to where you
  51. X  want the binaries installed, and that MANDIR is where you want the
  52. X--- 16,30 ----
  53. X  here may be overruled by it's contents.
  54. X  
  55. X  Once you are satisfied, change directory to the src directory, and have
  56. X! a look at config.ARCH.  If you find an entry there which relates to your
  57. X! architecture, your job is fairly straightforward, simply define the appropriate
  58. X! architecture in config.h.  If an entry for your architecture is not present,
  59. X! You'll have to do some work on config.h.  You should find configuration
  60. X! options available which are supported by your system.  If not, there should
  61. X! be enough information contained therein to allow you to add further options
  62. X! if you both feel it necessary, and are capable.  Define the configuration for
  63. X! your platform by commenting out those options which are not supported, and
  64. X! uncommenting those (one in each group) which are.
  65. X  
  66. X  Then look at the Makefile, and ensure that BINDIR is set to where you
  67. X  want the binaries installed, and that MANDIR is where you want the
  68. Index: MANIFEST
  69. X***************
  70. X*** 49,55 ****
  71. X   src/Makefile               3    
  72. X   src/config.c               4    
  73. X   src/config.h               4    
  74. X-  src/config.ARCH            4    
  75. X   src/jdgen                  1    
  76. X   src/jj.c                   4    
  77. X   src/jk.c                   5    
  78. X--- 49,54 ----
  79. Index: NEWS
  80. X***************
  81. X*** 227,232 ****
  82. X--- 227,236 ----
  83. X  correct.  I've now done this, and if anyone finds more typos I'll scream!!
  84. X  
  85. X  Long environment variables overwriting other data in js.c (and qp.c)
  86. X+ Pointed out by:
  87. X+ Gary Faulkner <garyf@solution.uts.amdahl.com>
  88. X+ Bryan Wright  <bryan%sphinx.uucp@uunet.uu.net>
  89. X+ 
  90. X  (see changes) Environment variables were being copied into buff without a
  91. X  length check, changed so only (QBUFLEN-1) characters are copied.
  92. X  
  93. X***************
  94. X*** 265,267 ****
  95. X--- 269,381 ----
  96. X  submitting a job, and the job's completion) is:
  97. X  
  98. X    response time = end time - start time
  99. X+ 
  100. X+ ...ADS
  101. X+ 
  102. X+ Issued qbatch.p2 14 Nov 1991
  103. X+ Current version is 2.2
  104. X+ 
  105. X+ 18th nov 1991
  106. X+ 
  107. X+ qp.c:
  108. X+ 
  109. X+ Bug pointed out by: Michael Gray <mjg@eng.cam.ac.uk>
  110. X+ change process priority (nice) BEFORE seutid.
  111. X+ (non root uid's can't increase priority (reduce nice value)!!)
  112. X+ 
  113. X+ Makefile:
  114. X+ 
  115. X+ Changed occurrences of cc to $(CC) to allow definition of compiler.
  116. X+ (compiles with gcc vn 1.39)
  117. X+ 
  118. X+ Added qbatch.h dependency to logging.o and time.o to force
  119. X+ recompilation after changing Makefile.
  120. X+ 
  121. X+ config.h/ config.c:
  122. X+ 
  123. X+ Pointed out to me by Michael Hamilton <hamilton@wcc.govt.nz>
  124. X+ that POSIX conforming cuserid() returns the user name relating
  125. X+ to the EFFECTIVE user id and not the logged in user id!
  126. X+ Since js is setuid root, the entry.qe_uname displayed in ql, and
  127. X+ used by jobdone (and used to send mailed monitors to) is always
  128. X+ root on a POSIX conformant system.
  129. X+ 
  130. X+ added 3 new defines to config.h, and related code to config.c
  131. X+ to define the source of the logged in user name.
  132. X+ 
  133. X+ Q_UNAME_ENV if defined will return the LOGNAME set in the
  134. X+       environment (theoretically, this should be a read
  135. X+       only environment variable, if it's not this could
  136. X+       be open to abuse).
  137. X+ 
  138. X+ Q_UNAME_CUSER if defined will return the result of cuserid() 
  139. X+       as originally.
  140. X+ 
  141. X+ Q_UNAME_PWD if defined will extract the name from the passwd
  142. X+       struct returned by getpwuid(getuid());
  143. X+       code courtesy of Michael Hamilton but moved to where
  144. X+       I think it should be in config.[hc]
  145. X+ 
  146. X+ Q_UNAME_LOG if defined will extract the name from the utmp
  147. X+           entry using the getlogin() call.
  148. X+ 
  149. X+ General:
  150. X+ 
  151. X+ Tidied up sources a bit so that lint doesn't complain so much.
  152. X+ 
  153. X+ Added facility for using predefined configurations defined in
  154. X+ a new file config.ARCH.  If users send me their configurations
  155. X+ when they have QBATCH working, I can include them in this file
  156. X+ and we can forestall much hacking of config.h for future users
  157. X+ on the same architecture.
  158. X+ 
  159. X+ 20 Nov 1991
  160. X+ 
  161. X+ Fixed a 'tail chasing dog' in config.h.  If a system needs ???_t
  162. X+ defining, it needs it first of all in qbatch.h.  qbatch.h is 
  163. X+ included before config.h since the latter needs some of the defines
  164. X+ in qbatch.h???
  165. X+ 
  166. X+ Since I want to keep all architecture variables in the same file
  167. X+ (config.h) I've added an #ifdef for __QBATCH_H_ around the typedefs
  168. X+ and #included config.h in qbatch.h.  .. Sounds convoluted but it 
  169. X+ does what I want!
  170. X+ 
  171. X+ 21 Nov 1991
  172. X+ 
  173. X+ Ressurected a suggestion by:
  174. X+ Gary Faulkner <garyf@solution.uts.amdahl.com>
  175. X+ 
  176. X+ who suggested that monitors could be pipes.  I implemented a suggestion
  177. X+ from Peter Da Silva for mailing monitors to the submitting user, assuming
  178. X+ this would be enough but I had occasion to write a script to submit a
  179. X+ job remotely (via dial-up uux) and wanted the monitor mailed back to me
  180. X+ (needed machine name in mail path) so it is now implemented.
  181. X+ 
  182. X+ If the monitor specified, either through a queue default monitor, or
  183. X+ through the -m option of js or thtough the environment variable MONITOR
  184. X+ starts with the pipe symbol '|',  the monitor after stripping the leading
  185. X+ '|' will be used as a command to which to pipe the output.
  186. X+ 
  187. X+ Possible uses:
  188. X+ remote mail (as I needed)
  189. X+ (actually implemented as:
  190. X+ 
  191. X+ uux -Cpn ${site}!"/usr/local/bin/js -m '|mail `hostname`!`logname`' \
  192. X+ -n'Postings for `hostname` ' work"<${uniq}.job
  193. X+ 
  194. X+ And it worked!)
  195. X+ sending monitors direct to printers
  196. X+ Perhaps piping through a perl script to analyse the monitors
  197. X+ or even (for the adventurous) have one job create jcl (conditionally?)
  198. X+ on stdout, and pipe the monitor to js in the same or another queue.
  199. X+ 
  200. X+ Found bug! js was only checking enviroment for MONITOR if queue
  201. X+ default monitor was NONE.  Changed this and made rejection message
  202. X+ more informative.
  203. X+ 
  204. X+ Added leading zero to patchlevel .. at the rate this is going, 
  205. X+ I'll need it!
  206. X+ 
  207. X+ Issued qbatch.p3 22 Nov 1991
  208. X+ Current version is 2.03
  209. Index: doc/chap.04
  210. X***************
  211. X*** 100,106 ****
  212. X              (monitors are discussed later.)  This option allows a
  213. X              user to define exactly where the monitor for this job
  214. X              will be written it should be a fully specified absolute
  215. X!             pathspec..
  216. X  
  217. X      -s <shell>    As mentioned earlier, jobs are by default run under the
  218. X              bourne shell.  If the queue is fixed context, the shell
  219. X--- 100,110 ----
  220. X              (monitors are discussed later.)  This option allows a
  221. X              user to define exactly where the monitor for this job
  222. X              will be written it should be a fully specified absolute
  223. X!             pathspec, the word MAIL (in upper case, which causes
  224. X!             the monitor to be mailed to the submitting user) or a
  225. X!             string starting with the pipe ('|') symbol, which 
  226. X!             causes the monitor to be piped to a command formed by
  227. X!             stripping the leading pipe symbol from the string.
  228. X  
  229. X      -s <shell>    As mentioned earlier, jobs are by default run under the
  230. X              bourne shell.  If the queue is fixed context, the shell
  231. X***************
  232. X*** 242,247 ****
  233. X--- 246,253 ----
  234. X          used by the queue (see also MONITORS).  So to check the progress
  235. X          of a job, the user can use:
  236. X          more `qf -m <queuename>`
  237. X+         NOTE: if the monitor is not accessible, (either NONE, MAIL or a
  238. X+         piped monitor, qf and qt will fail with a message to that effect.
  239. X  
  240. X      -l  Provides a one line status report similar to qt -l but with the
  241. X          columns headed.
  242. Index: doc/chap.05
  243. X***************
  244. X*** 83,88 ****
  245. X--- 83,91 ----
  246. X  
  247. X      In each case, if the monitor determined is a file, that will be used.  If
  248. X      it is a directory, a file <queuename>.mon will be used in that directory.
  249. X+     If the first character of the monitor is a pipe symbol '|', then the pipe
  250. X+     pipe symbol will be stripped, and the remainder of the string uses as a
  251. X+     command into which to pipe the output.
  252. X   
  253. X      In the above list, if more than one case is available a source later in the
  254. X      list will overrule a source earlier (a monitor sourced by specifying -m to
  255. X***************
  256. X*** 112,126 ****
  257. X   
  258. X      WARNING!
  259. X   
  260. X!     1. Such private monitors are ONLY used for queues whose default monitor
  261. X!        is NONE.
  262. X!     
  263. X!     2. Any profile information stored in the monitors will be split up 
  264. X         across several directories, thus making accounting and tuning more
  265. X         difficult. (see 5a LOGGING).
  266. X   
  267. X!     3. using 'more `qf -m <queuename>`' may give startling results when
  268. X!        used for troubleshooting.  (The result will depend on the setting
  269. X         of YOUR MONITOR environment variable, and may not have any
  270. X         relationship to the job you wish to check).
  271. X      
  272. X--- 115,126 ----
  273. X   
  274. X      WARNING!
  275. X   
  276. X!     1. Any profile information stored in the monitors will be split up 
  277. X         across several directories, thus making accounting and tuning more
  278. X         difficult. (see 5a LOGGING).
  279. X   
  280. X!     2. using 'more `qf -m <queuename>`' may give startling results when
  281. X!        used for troubleshooting.  (The result may depend on the setting
  282. X         of YOUR MONITOR environment variable, and may not have any
  283. X         relationship to the job you wish to check).
  284. X      
  285. Index: doc/quickstart
  286. X***************
  287. X*** 122,128 ****
  288. X      before submitting the job.
  289. X      In both cases, if the pathspec refers to a file, then that will be used as
  290. X      a monitor. If it refers to a directory, then in this case (if the queue is
  291. X!     'fast') a file <pathspec>/fast.mon will be used.
  292. X  
  293. X      NOTE If the monitor is redirected in this way, then using `qf -m fast`
  294. X      will return either the monitor spec of the running job, or the queue
  295. X--- 122,131 ----
  296. X      before submitting the job.
  297. X      In both cases, if the pathspec refers to a file, then that will be used as
  298. X      a monitor. If it refers to a directory, then in this case (if the queue is
  299. X!     'fast') a file <pathspec>/fast.mon will be used.  If the 'pathspec' is a
  300. X!     string starting with the pipe ('|') symbol, then after stripping the pipe
  301. X!     symbol, the string will be used as the name (and parameters) of a command
  302. X!     to which to pipe the output.
  303. X  
  304. X      NOTE If the monitor is redirected in this way, then using `qf -m fast`
  305. X      will return either the monitor spec of the running job, or the queue
  306. Index: src/Makefile
  307. X***************
  308. X*** 18,23 ****
  309. X--- 18,26 ----
  310. X  # the bourne shell path
  311. X  SHELL=/bin/sh
  312. X  
  313. X+ # The compiler to use
  314. X+ CC=cc
  315. X+ 
  316. X  # the path to the mail program.
  317. X  
  318. X  MAILPATH="/usr/ucb/Mail"
  319. X***************
  320. X*** 64,90 ****
  321. X      @echo "\n\007programs and scripts ... make complete\n"
  322. X  
  323. X  jj:    jj.c qbatch.h  config.o
  324. X!     cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o  -o $@
  325. X      chmod 06711 $@
  326. X  
  327. X  jk:    jk.c qbatch.h  config.o
  328. X!     cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o  -o $@
  329. X      chmod 06711 $@
  330. X  
  331. X  jm:    jm.c qbatch.h  config.o
  332. X!     cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o  -o $@
  333. X      chmod 06711 $@
  334. X  
  335. X  jn:    jn.c qbatch.h  config.o
  336. X!     cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o  -o $@
  337. X      chmod 06711 $@
  338. X  
  339. X  jr:    jr.c qbatch.h  config.o
  340. X!     cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o  -o $@
  341. X      chmod 06711 $@
  342. X  
  343. X  js:    js.c qbatch.h  config.o
  344. X!     cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o  -o $@
  345. X      chmod 06711 $@
  346. X  
  347. X  qa:    qagen Makefile
  348. X--- 67,93 ----
  349. X      @echo "\n\007programs and scripts ... make complete\n"
  350. X  
  351. X  jj:    jj.c qbatch.h  config.o
  352. X!     $(CC) $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o  -o $@
  353. X      chmod 06711 $@
  354. X  
  355. X  jk:    jk.c qbatch.h  config.o
  356. X!     $(CC) $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o  -o $@
  357. X      chmod 06711 $@
  358. X  
  359. X  jm:    jm.c qbatch.h  config.o
  360. X!     $(CC) $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o  -o $@
  361. X      chmod 06711 $@
  362. X  
  363. X  jn:    jn.c qbatch.h  config.o
  364. X!     $(CC) $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o  -o $@
  365. X      chmod 06711 $@
  366. X  
  367. X  jr:    jr.c qbatch.h  config.o
  368. X!     $(CC) $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o  -o $@
  369. X      chmod 06711 $@
  370. X  
  371. X  js:    js.c qbatch.h  config.o
  372. X!     $(CC) $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o  -o $@
  373. X      chmod 06711 $@
  374. X  
  375. X  qa:    qagen Makefile
  376. X***************
  377. X*** 92,139 ****
  378. X      chmod 0755 $@
  379. X  
  380. X  qc:    qc.c qbatch.h config.o
  381. X!     cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o  -o $@
  382. X      chmod 0700 $@
  383. X  
  384. X  qd:    qd.c qbatch.h  config.o
  385. X!     cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o  -o $@
  386. X      chmod 0700 $@
  387. X  
  388. X  qe:    qe.c qbatch.h  config.o
  389. X!     cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o  -o $@
  390. X      chmod 0700 $@
  391. X  
  392. X  qf:    qf.c qbatch.h
  393. X!     cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c  -o $@
  394. X      chmod 0711 $@
  395. X  
  396. X  qg:    qg.c qbatch.h  config.o
  397. X!     cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o  -o $@
  398. X      chmod 0700 $@
  399. X  
  400. X  qh:    qh.c qbatch.h  config.o
  401. X!     cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o  -o $@
  402. X      chmod 0700 $@
  403. X  
  404. X  ql:    ql.c qbatch.h
  405. X!     cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c -o $@
  406. X      chmod 0711 $@
  407. X  
  408. X  qp:    qp.c qbatch.h  config.o time.o logging.o
  409. X!     cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o time.o \
  410. X      logging.o  -o $@
  411. X      chmod 0700 $@
  412. X  
  413. X  qs:    qs.c qbatch.h  config.o
  414. X!     cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o  -o $@
  415. X      chmod 0700 $@
  416. X  
  417. X  qt:    qt.c qbatch.h
  418. X!     cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c -o $@
  419. X      chmod 06711 $@
  420. X  
  421. X  qw:    qw.c qbatch.h  config.o
  422. X!     cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o  -o $@
  423. X      chmod 0711 $@
  424. X  
  425. X  jobdone:    jdgen Makefile
  426. X--- 95,142 ----
  427. X      chmod 0755 $@
  428. X  
  429. X  qc:    qc.c qbatch.h config.o
  430. X!     $(CC) $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o  -o $@
  431. X      chmod 0700 $@
  432. X  
  433. X  qd:    qd.c qbatch.h  config.o
  434. X!     $(CC) $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o  -o $@
  435. X      chmod 0700 $@
  436. X  
  437. X  qe:    qe.c qbatch.h  config.o
  438. X!     $(CC) $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o  -o $@
  439. X      chmod 0700 $@
  440. X  
  441. X  qf:    qf.c qbatch.h
  442. X!     $(CC) $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c  -o $@
  443. X      chmod 0711 $@
  444. X  
  445. X  qg:    qg.c qbatch.h  config.o
  446. X!     $(CC) $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o  -o $@
  447. X      chmod 0700 $@
  448. X  
  449. X  qh:    qh.c qbatch.h  config.o
  450. X!     $(CC) $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o  -o $@
  451. X      chmod 0700 $@
  452. X  
  453. X  ql:    ql.c qbatch.h
  454. X!     $(CC) $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c -o $@
  455. X      chmod 0711 $@
  456. X  
  457. X  qp:    qp.c qbatch.h  config.o time.o logging.o
  458. X!     $(CC) $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o time.o \
  459. X      logging.o  -o $@
  460. X      chmod 0700 $@
  461. X  
  462. X  qs:    qs.c qbatch.h  config.o
  463. X!     $(CC) $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o  -o $@
  464. X      chmod 0700 $@
  465. X  
  466. X  qt:    qt.c qbatch.h
  467. X!     $(CC) $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c -o $@
  468. X      chmod 06711 $@
  469. X  
  470. X  qw:    qw.c qbatch.h  config.o
  471. X!     $(CC) $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o  -o $@
  472. X      chmod 0711 $@
  473. X  
  474. X  jobdone:    jdgen Makefile
  475. X***************
  476. X*** 144,157 ****
  477. X          $(SHELL) rcgen $(SHELL) $(BINDIR) $(QUEUEPATH)
  478. X          chmod 0700 rc.QBATCH
  479. X  
  480. X! config.o:    config.c config.h qbatch.h
  481. X!         cc $(CFLAG) $(QPATHS) $(QDEFINES) -c config.c
  482. X  
  483. X! time.o:        time.c config.h 
  484. X!         cc $(CFLAG) $(QPATHS) $(QDEFINES) -c time.c
  485. X  
  486. X! logging.o:    logging.c config.h 
  487. X!         cc $(CFLAG) $(QPATHS) $(QDEFINES) -c logging.c
  488. X  
  489. X  qbatch.h:    what.h Makefile
  490. X          touch qbatch.h
  491. X--- 147,160 ----
  492. X          $(SHELL) rcgen $(SHELL) $(BINDIR) $(QUEUEPATH)
  493. X          chmod 0700 rc.QBATCH
  494. X  
  495. X! config.o:    config.c config.h qbatch.h config.ARCH
  496. X!         $(CC) $(CFLAG) $(QPATHS) $(QDEFINES) -c config.c
  497. X  
  498. X! time.o:        time.c config.h qbatch.h
  499. X!         $(CC) $(CFLAG) $(QPATHS) $(QDEFINES) -c time.c
  500. X  
  501. X! logging.o:    logging.c config.h qbatch.h
  502. X!         $(CC) $(CFLAG) $(QPATHS) $(QDEFINES) -c logging.c
  503. X  
  504. X  qbatch.h:    what.h Makefile
  505. X          touch qbatch.h
  506. Index: src/config.c
  507. X***************
  508. X*** 92,100 ****
  509. X  void toggle_halt_status(newaction)
  510. X  int newaction;
  511. X  {
  512. X! #ifdef SIGCONT && SIGSTOP
  513. X      kill ((childid * -1), (((newaction &qh_halt) == 0) ? SIGCONT : SIGSTOP));
  514. X  #endif
  515. X  }
  516. X  #endif /* XPG3PGP */
  517. X  
  518. X--- 92,102 ----
  519. X  void toggle_halt_status(newaction)
  520. X  int newaction;
  521. X  {
  522. X! #ifdef SIGCONT
  523. X! #ifdef SIGSTOP
  524. X      kill ((childid * -1), (((newaction &qh_halt) == 0) ? SIGCONT : SIGSTOP));
  525. X  #endif
  526. X+ #endif
  527. X  }
  528. X  #endif /* XPG3PGP */
  529. X  
  530. X***************
  531. X*** 207,213 ****
  532. X      sigemptyset(&actsig.sa_mask);
  533. X      actsig.sa_flags = 0;
  534. X      actsig.sa_handler = (HANDLER_TYPE (*)())fun;
  535. X!     sigaction(sig, actsig, (struct sigaction *) NULL);
  536. X  }
  537. X  
  538. X  #endif /* SIGACTION */
  539. X--- 209,215 ----
  540. X      sigemptyset(&actsig.sa_mask);
  541. X      actsig.sa_flags = 0;
  542. X      actsig.sa_handler = (HANDLER_TYPE (*)())fun;
  543. X!     sigaction(sig, &actsig, (struct sigaction *) NULL);
  544. X  }
  545. X  
  546. X  #endif /* SIGACTION */
  547. X***************
  548. X*** 241,247 ****
  549. X      actsig.sv_mask = 0;
  550. X      actsig.sv_flags = 0;
  551. X      actsig.sv_handler = (HANDLER_TYPE (*)())sig;
  552. X!     sigvec(sig, actsig, (struct sigvec *) NULL);
  553. X  }
  554. X  #endif /* SIGVEC */
  555. X  void qb_resetterm()
  556. X--- 243,249 ----
  557. X      actsig.sv_mask = 0;
  558. X      actsig.sv_flags = 0;
  559. X      actsig.sv_handler = (HANDLER_TYPE (*)())sig;
  560. X!     sigvec(sig, &actsig, (struct sigvec *) NULL);
  561. X  }
  562. X  #endif /* SIGVEC */
  563. X  void qb_resetterm()
  564. X***************
  565. X*** 320,323 ****
  566. X--- 322,373 ----
  567. X  #ifdef RE_INSTALL
  568. X      qb_setuser();   /* re-install interrupt handler */
  569. X  #endif /* RE_INSTALL */
  570. X+ }
  571. X+ void q_username(str, len)
  572. X+ char *str;
  573. X+ int len;
  574. X+ {
  575. X+ /*
  576. X+ *   find the logged in name for the user and copy the first len characters
  577. X+ *  to str and null terminate
  578. X+ */
  579. X+ #ifdef Q_UNAME_PWD
  580. X+ #include <pwd.h>
  581. X+      struct passwd *passwd_info;
  582. X+ #endif /* Q_UNAME_PWD */
  583. X+      extern char * getenv();
  584. X+      char *name, *logname;
  585. X+      int i;
  586. X+      logname = getenv ("LOGNAME");
  587. X+ #ifdef Q_UNAME_PWD
  588. X+      /*
  589. X+       * Change to get real user ID - as per XPG3 - as js is setuid-root.
  590. X+       * hamilton@aladdin.wcc.govt.nz  (Nov 1991)
  591. X+       */
  592. X+      passwd_info = getpwuid(getuid()) ; 
  593. X+      if (passwd_info) {
  594. X+        name = passwd_info->pw_name;
  595. X+      }
  596. X+      else {
  597. X+        name = logname;
  598. X+      }
  599. X+ #endif /* Q_UNAME_PWD */
  600. X+ #ifdef Q_UNAME_CUSER
  601. X+      name = cuserid(entry.qe_uname);
  602. X+ #endif /* Q_UNAME_CUSER */
  603. X+ #ifdef Q_UNAME_LOG
  604. X+      name = getlogin();
  605. X+ #endif /* Q_UNAME_LOG */
  606. X+ #ifdef Q_UNAME_ENV
  607. X+      name = logname;
  608. X+ #endif /* Q_UNAME_ENV */
  609. X+      /* common code */
  610. X+      if (name == NULL) name = logname; /* if all else fails */
  611. X+      if (name != NULL) {
  612. X+      for (i = 0; ((i < len) && (name[i] != 0)); i++) str[i] = name[i];
  613. X+      }
  614. X+      else {
  615. X+      for (i = 0; i < len; i++) str[i] = '?'; /* last resort */
  616. X+      }
  617. X+      str[i] = 0;
  618. X  }
  619. Index: src/config.h
  620. X***************
  621. X*** 18,23 ****
  622. X--- 18,53 ----
  623. X  /* config.c. If your system cannot be configured using the existing #defines */
  624. X  /* and code, add another #define or two, and the corresponding code sections.*/
  625. X  
  626. X+ /* The file config.ARCH contains several pre-defined, claimed to be working  */
  627. X+ /* configurations.  If one of these matches your architecture, you can define*/
  628. X+ /* it here instead of ploughing through this lot!                 */
  629. X+ /******************************************************************************
  630. X+ *
  631. X+ * we have a circular reference problem!
  632. X+ *
  633. X+ * I want all machine /os dependencies in this file but some are needed in
  634. X+ * qbatch.h so I need to include this twice! once for qbatch.h, and once for
  635. X+ * everything else!
  636. X+ * Hence the #ifdef __QBATCH_H_
  637. X+ *
  638. X+ * Note don't forget it if you need one or more of these typedef's in config.ARCH
  639. X+ *
  640. X+ ******************************************************************************/
  641. X+ #undef ARCH_DEFINED
  642. X+ #define SUNSPARC.411
  643. X+ #include "config.ARCH"
  644. X+ #ifndef ARCH_DEFINED /* sorry, You'll have to do some work! */
  645. X+ 
  646. X+ #ifdef __QBATCH_H_
  647. X+ 
  648. X+ /* Some systems don't define pid_t, if not typedef it here */
  649. X+ /*typedef int pid_t;*/
  650. X+ /* and some don't define these */
  651. X+ /*typedef short uid_t;*/
  652. X+ /*typedef short gid_t;*/
  653. X+ 
  654. X+ #else /* __QBATCH_H_ */
  655. X+ 
  656. X  /*---------------------------------------------------------------------------*/
  657. X  /* Proces group calls (define only one)
  658. X  /* Allow a signal (SIGKILL, SIGHALT, or SIGCONT) sent to a running job, to be
  659. X***************
  660. X*** 106,113 ****
  661. X  /* int but have not changed the analysis macros, so they're still trying to  */
  662. X  /* analyse a union wait out of an int without casting it first!!)            */
  663. X  
  664. X! /*typedef int WAIT_TYPE; */    /* XPG3 */
  665. X! typedef union wait WAIT_TYPE;
  666. X  
  667. X  #define WAIT_XPG3    /* XPG3 */
  668. X  
  669. X--- 136,143 ----
  670. X  /* int but have not changed the analysis macros, so they're still trying to  */
  671. X  /* analyse a union wait out of an int without casting it first!!)            */
  672. X  
  673. X! typedef int WAIT_TYPE;     /* XPG3 */
  674. X! /*typedef union wait WAIT_TYPE;*/
  675. X  
  676. X  #define WAIT_XPG3    /* XPG3 */
  677. X  
  678. X***************
  679. X*** 131,143 ****
  680. X  /*define QCLOCK_TICK CLK_TCK */
  681. X  /*define QCLOCK_TICK gethz();*/
  682. X  
  683. X- /* Some systems don't define pid_t, if not typedef it here */
  684. X- /*typedef int pid_t;*/
  685. X- /* and some don't define these */
  686. X- /*typedef short uid_t;*/
  687. X- /*typedef short gid_t;*/
  688. X- 
  689. X  /* if needed , define these */
  690. X  
  691. X  /*#define strchr index */
  692. X  /*#define strrchr rindex */
  693. X--- 161,196 ----
  694. X  /*define QCLOCK_TICK CLK_TCK */
  695. X  /*define QCLOCK_TICK gethz();*/
  696. X  
  697. X  /* if needed , define these */
  698. X  
  699. X  /*#define strchr index */
  700. X  /*#define strrchr rindex */
  701. X+ 
  702. X+ /*---------------------------------------------------------------------------*/
  703. X+ /* see NEWS for user name problems with POSIX conformant systems.         */
  704. X+ /* Define one of these depending on the required source of the logged in     */
  705. X+ /* user name for use in js (used by ql, jobdone, and qp              */
  706. X+ /*
  707. X+ *Q_UNAME_ENV if defined will return the LOGNAME set in the
  708. X+ *      environment (theoretically, this should be a read
  709. X+ *      only environment variable, if it's not this could
  710. X+ *      be open to abuse).
  711. X+ *
  712. X+ *Q_UNAME_CUSER if defined will return the result of cuserid() 
  713. X+ *      as originally.
  714. X+ *
  715. X+ *Q_UNAME_PWD if defined will extract the name from the passwd
  716. X+ *      struct returned by getpwuid(getuid());
  717. X+ *      code courtesy of Michael Hamilton but moved to where
  718. X+ *      I think it should be in config.[hc]
  719. X+ *
  720. X+ *Q_UNAME_LOG if defined will extract the name from the utmp
  721. X+ *         entry using the getlogin() call.
  722. X+ */
  723. X+ #define Q_UNAME_CUSER
  724. X+ /* #DEFINE Q_UNAME_ENV */
  725. X+ /* #define Q_UNAME_PWD */
  726. X+ /* #define Q_UNAME_LOG */
  727. X+ 
  728. X+ #endif /* __QBATCH_H_ */
  729. X+ #endif /* not ARCH_DEFINED */
  730. Index: src/jj.c
  731. X***************
  732. X*** 12,20 ****
  733. X  #include "qbatch.h"
  734. X  int fpq = 0;
  735. X  int i, l;
  736. X- int killed = 0;
  737. X  long  j, k;
  738. X- int aflag = 0, kflag = 0;
  739. X  pid_t jpid = 0;
  740. X  uid_t userid = 0, entryno = 0;
  741. X  off_t *entries;
  742. X--- 12,18 ----
  743. X***************
  744. X*** 21,27 ****
  745. X  uid_t   *uids;
  746. X  char queue[128];
  747. X  char *queuename;
  748. X- char buff [128];                            
  749. X  struct queue_entry entry1;                            
  750. X  #include "config.h"
  751. X  
  752. X--- 19,24 ----
  753. Index: src/jm.c
  754. X***************
  755. X*** 11,17 ****
  756. X  
  757. X  #include "qbatch.h"
  758. X  int fpq = 0;
  759. X! int j, entryno = 0;
  760. X  uid_t uid;
  761. X  int changed = 0;
  762. X  char *queuename;
  763. X--- 11,18 ----
  764. X  
  765. X  #include "qbatch.h"
  766. X  int fpq = 0;
  767. X! entryno = 0;
  768. X! long j;
  769. X  uid_t uid;
  770. X  int changed = 0;
  771. X  char *queuename;
  772. Index: src/jn.c
  773. X***************
  774. X*** 11,17 ****
  775. X  
  776. X  #include "qbatch.h"
  777. X  int fpq = 0;
  778. X! int j, entryno = 0;
  779. X  uid_t uid;
  780. X  char *queuename;
  781. X  char queue[128];
  782. X--- 11,18 ----
  783. X  
  784. X  #include "qbatch.h"
  785. X  int fpq = 0;
  786. X! entryno = 0;
  787. X! long j;
  788. X  uid_t uid;
  789. X  char *queuename;
  790. X  char queue[128];
  791. Index: src/js.c
  792. X***************
  793. X*** 16,29 ****
  794. X  int fpq = 0;
  795. X  FILE *fpin, *fpout, *fp;
  796. X  char temp [16], *jcl, *jcwd = NULL, *command = NULL;
  797. X! int i,j,k, debug = 0;
  798. X  int qpuid[10];
  799. X  int qpgid[10];
  800. X  int lflag = 0, sflag = 0, fixedcontext = 0, permission = -1;
  801. X  int gotuid, gotgid;
  802. X! uid_t jobuid, saveuid, testuid;
  803. X  gid_t jobgid, savegid; 
  804. X- int envcount = 0;
  805. X  int notify = 0;
  806. X  char envar[64];
  807. X  char *fcptr;
  808. X--- 16,28 ----
  809. X  int fpq = 0;
  810. X  FILE *fpin, *fpout, *fp;
  811. X  char temp [16], *jcl, *jcwd = NULL, *command = NULL;
  812. X! int i,j, debug = 0;
  813. X  int qpuid[10];
  814. X  int qpgid[10];
  815. X  int lflag = 0, sflag = 0, fixedcontext = 0, permission = -1;
  816. X  int gotuid, gotgid;
  817. X! uid_t jobuid, saveuid;
  818. X  gid_t jobgid, savegid; 
  819. X  int notify = 0;
  820. X  char envar[64];
  821. X  char *fcptr;
  822. X***************
  823. X*** 79,85 ****
  824. X      {
  825. X          if (ptr != root) return (-1);
  826. X          ptr = (struct envlist *) malloc (sizeof(struct envlist));
  827. X!         ptr->envptr = malloc(strlen(str)+1);
  828. X          strcpy (ptr->envptr, str);
  829. X          ptr->left = (struct envlist *) NULL;
  830. X          ptr->right = (struct envlist *) NULL;
  831. X--- 78,84 ----
  832. X      {
  833. X          if (ptr != root) return (-1);
  834. X          ptr = (struct envlist *) malloc (sizeof(struct envlist));
  835. X!         ptr->envptr = (char *) malloc(strlen(str)+1);
  836. X          strcpy (ptr->envptr, str);
  837. X          ptr->left = (struct envlist *) NULL;
  838. X          ptr->right = (struct envlist *) NULL;
  839. X***************
  840. X*** 93,99 ****
  841. X          if (ptr->left == (struct envlist *) NULL)
  842. X          {
  843. X              ptr->left = (struct envlist *) malloc (sizeof(struct envlist));
  844. X!             ptr->left->envptr = malloc(strlen(str)+1);
  845. X              strcpy (ptr->left->envptr, str);
  846. X              ptr->left->left = (struct envlist *) NULL;
  847. X              ptr->left->right = (struct envlist *) NULL;
  848. X--- 92,98 ----
  849. X          if (ptr->left == (struct envlist *) NULL)
  850. X          {
  851. X              ptr->left = (struct envlist *) malloc (sizeof(struct envlist));
  852. X!             ptr->left->envptr = (char *) malloc(strlen(str)+1);
  853. X              strcpy (ptr->left->envptr, str);
  854. X              ptr->left->left = (struct envlist *) NULL;
  855. X              ptr->left->right = (struct envlist *) NULL;
  856. X***************
  857. X*** 106,112 ****
  858. X      if (ptr->right == (struct envlist *) NULL)
  859. X      {
  860. X          ptr->right = (struct envlist *) malloc (sizeof(struct envlist));
  861. X!         ptr->right->envptr = malloc(strlen(str)+1);
  862. X          strcpy (ptr->right->envptr, str);
  863. X          ptr->right->left = (struct envlist *) NULL;
  864. X          ptr->right->right = (struct envlist *) NULL;
  865. X--- 105,111 ----
  866. X      if (ptr->right == (struct envlist *) NULL)
  867. X      {
  868. X          ptr->right = (struct envlist *) malloc (sizeof(struct envlist));
  869. X!         ptr->right->envptr = (char *) malloc(strlen(str)+1);
  870. X          strcpy (ptr->right->envptr, str);
  871. X          ptr->right->left = (struct envlist *) NULL;
  872. X          ptr->right->right = (struct envlist *) NULL;
  873. X***************
  874. X*** 116,126 ****
  875. X      return (add_envlist (ptr->right, str));
  876. X  }
  877. X  
  878. X! void usage(i)
  879. X! int i;
  880. X  {
  881. X          puts ("Usage: js [-r<replycode>] [-m<monitor>] [-n<jobname>] [-s <shell>] queuename [<jclfile>]");
  882. X!         qb_term (i);
  883. X  }
  884. X  main (argc, argv, envp)
  885. X  int argc;
  886. X--- 115,125 ----
  887. X      return (add_envlist (ptr->right, str));
  888. X  }
  889. X  
  890. X! void usage(exit_val)
  891. X! int exit_val;
  892. X  {
  893. X          puts ("Usage: js [-r<replycode>] [-m<monitor>] [-n<jobname>] [-s <shell>] queuename [<jclfile>]");
  894. X!         qb_term (exit_val);
  895. X  }
  896. X  main (argc, argv, envp)
  897. X  int argc;
  898. X***************
  899. X*** 186,205 ****
  900. X          fprintf (stderr, "Queue %s is not accepting entries!\n", queuename);
  901. X          qb_exit(-1);
  902. X      }
  903. X!     if ((strcmp (head.qh_defmon, "NONE") == 0))
  904. X      {
  905. X!         if  (*monitor == 0)
  906. X!     {
  907. X!         fcptr = getenv ("MONITOR");
  908. X!         if (fcptr == NULL)
  909. X          {
  910. X!             fprintf(stderr, "No MONITOR environment string.. cannot submit\n");
  911. X!             qb_exit(-1);
  912. X          }
  913. X!         strcpy (monitor, fcptr);
  914. X!     }
  915. X      }
  916. X!     if ((*monitor != 0) && (strcmp(monitor, "MAIL") != 0))
  917. X      {
  918. X          if (*monitor != '/') /* monitor should be full pathspec */
  919. X          { /* so add current working directory */
  920. X--- 185,206 ----
  921. X          fprintf (stderr, "Queue %s is not accepting entries!\n", queuename);
  922. X          qb_exit(-1);
  923. X      }
  924. X!     if  (*monitor == 0)
  925. X      {
  926. X!         fcptr = getenv ("MONITOR");
  927. X!         if (fcptr == NULL)
  928. X!         {
  929. X!         if ((strcmp (head.qh_defmon, "NONE") == 0))
  930. X          {
  931. X!             fprintf(stderr, "Queue default monitor is NONE:\n");
  932. X!             fprintf(stderr, "You have specified no monitor to js and have\n");
  933. X!             fprintf(stderr, "no MONITOR environment string.. cannot submit\n");
  934. X!             qb_exit(-1);
  935. X          }
  936. X!         }
  937. X!         else strcpy (monitor, fcptr);
  938. X      }
  939. X!     if ((*monitor != 0) && (strcmp(monitor, "MAIL") != 0) && (*monitor != '|'))
  940. X      {
  941. X          if (*monitor != '/') /* monitor should be full pathspec */
  942. X          { /* so add current working directory */
  943. X***************
  944. X*** 534,540 ****
  945. X          strcpy (entry.qe_tty, buff+i+1);
  946. X      }
  947. X      else strcpy (entry.qe_tty, "");
  948. X!     cuserid(entry.qe_uname);
  949. X      i = head.qh_noentries ++;
  950. X      lseek (fpq, 0, SEEK_SET);
  951. X      write (fpq, &head, sizeof(head));
  952. X--- 535,541 ----
  953. X          strcpy (entry.qe_tty, buff+i+1);
  954. X      }
  955. X      else strcpy (entry.qe_tty, "");
  956. X!     q_username(entry.qe_uname, 15);
  957. X      i = head.qh_noentries ++;
  958. X      lseek (fpq, 0, SEEK_SET);
  959. X      write (fpq, &head, sizeof(head));
  960. Index: src/logging.c
  961. X***************
  962. X*** 56,62 ****
  963. X      fprintf (log, "\"%s\":", eentry->qe_jobname); /* job name */
  964. X      fprintf (log, "%lu:", q_queued);       /* process times are in 1/100*/
  965. X      fprintf (log, "%lu:", q_real);          /* seconds (subject to the   */
  966. X!     fprintf (log, "%lu:", q_user);          /* accuuracy of the clock.   */
  967. X      fprintf (log, "%lu\n", q_system);
  968. X      fclose (log);
  969. X      return;
  970. X--- 56,62 ----
  971. X      fprintf (log, "\"%s\":", eentry->qe_jobname); /* job name */
  972. X      fprintf (log, "%lu:", q_queued);       /* process times are in 1/100*/
  973. X      fprintf (log, "%lu:", q_real);          /* seconds (subject to the   */
  974. X!     fprintf (log, "%lu:", q_user);          /* accuracy of the clock.   */
  975. X      fprintf (log, "%lu\n", q_system);
  976. X      fclose (log);
  977. X      return;
  978. Index: src/qbatch.h
  979. X***************
  980. X*** 20,25 ****
  981. X--- 20,29 ----
  982. X  static char QbCR1 []= "@(#) Copyright (c) Vita Services 1990";
  983. X  static char QbCR2 []= "@(#)           (c) Vita Fibres   1990 1991";
  984. X  
  985. X+ #define __QBATCH_H_
  986. X+ #include "config.h"
  987. X+ #undef  __QBATCH_H_
  988. X+ 
  989. X  /* structure of flag byte */
  990. X  #define    qh_repeat    1    /* repeat current job flag */
  991. X  #define    qh_kill      2    /* kill current job flag */
  992. Index: src/qc.c
  993. X***************
  994. X*** 21,27 ****
  995. X  char queue [64];
  996. X  char qpath [64];
  997. X  char monitor[64];
  998. X- struct stat status;
  999. X  int fpq;
  1000. X  FILE *fp;
  1001. X  main (argc, argv)
  1002. X--- 21,26 ----
  1003. X***************
  1004. X*** 80,86 ****
  1005. X          }
  1006. X      }
  1007. X      else strcpy (qpath, SPOOLPATH);
  1008. X!     if ((monitor[0] != 0) && (strcmp (monitor, "NONE") != 0) && (strcmp(monitor, "MAIL") != 0))
  1009. X      {
  1010. X          if (strlen (monitor) > 63)
  1011. X          {
  1012. X--- 79,86 ----
  1013. X          }
  1014. X      }
  1015. X      else strcpy (qpath, SPOOLPATH);
  1016. X!     if ((monitor[0] != 0) && (strcmp (monitor, "NONE") != 0) && (strcmp(monitor, "MAIL") != 0)
  1017. X!     &&  (monitor [0] != '|'))
  1018. X      {
  1019. X          if (strlen (monitor) > 63)
  1020. X          {
  1021. X***************
  1022. X*** 121,127 ****
  1023. X      }
  1024. X      else 
  1025. X      {
  1026. X!     if ((strcmp (monitor, "NONE") != 0) && (strcmp(monitor, "MAIL") != 0))
  1027. X      {
  1028. X          strcpy (monitor, qpath);
  1029. X          if (monitor[strlen(monitor) -1] != '/') strcat (monitor, "/");
  1030. X--- 121,128 ----
  1031. X      }
  1032. X      else 
  1033. X      {
  1034. X!     if ((strcmp (monitor, "NONE") != 0) && (strcmp(monitor, "MAIL") != 0)
  1035. X!     &&  (monitor [0] != '|'))
  1036. X      {
  1037. X          strcpy (monitor, qpath);
  1038. X          if (monitor[strlen(monitor) -1] != '/') strcat (monitor, "/");
  1039. Index: src/qf.c
  1040. X***************
  1041. X*** 13,25 ****
  1042. X  int mflag = 0, jflag = 0, qflag = 0, pflag = 0, aflag = 0,rflag = 0, sflag = 0, nflag = 0;
  1043. X  int lflag = 0, Lflag=0;
  1044. X  char buff[128];
  1045. X! FILE *fpq, *fp;
  1046. X  char *queuename;
  1047. X- char *mon, *fcptr;
  1048. X  int entryno = 0;
  1049. X  time_t now, then;
  1050. X  struct tm *jtimes;
  1051. X- int idle;
  1052. X  char monitor [128];
  1053. X  char tval[32];
  1054. X  void q_version()
  1055. X--- 13,23 ----
  1056. X  int mflag = 0, jflag = 0, qflag = 0, pflag = 0, aflag = 0,rflag = 0, sflag = 0, nflag = 0;
  1057. X  int lflag = 0, Lflag=0;
  1058. X  char buff[128];
  1059. X! FILE *fpq;
  1060. X  char *queuename;
  1061. X  int entryno = 0;
  1062. X  time_t now, then;
  1063. X  struct tm *jtimes;
  1064. X  char monitor [128];
  1065. X  char tval[32];
  1066. X  void q_version()
  1067. X***************
  1068. X*** 44,56 ****
  1069. X  unsigned long val;
  1070. X  int opt;
  1071. X  {
  1072. X!     int temp;
  1073. X      char sval[8];
  1074. X      *tval = 0;
  1075. X      temp = val/8640000;
  1076. X      if (temp)
  1077. X      {
  1078. X!         sprintf(sval, "%d", temp);
  1079. X          strcat (tval, sval);
  1080. X          if (opt) strcat (tval, " Days ");
  1081. X          else strcat (tval, ":");
  1082. X--- 42,54 ----
  1083. X  unsigned long val;
  1084. X  int opt;
  1085. X  {
  1086. X!     unsigned long temp;
  1087. X      char sval[8];
  1088. X      *tval = 0;
  1089. X      temp = val/8640000;
  1090. X      if (temp)
  1091. X      {
  1092. X!         sprintf(sval, "%lu", temp);
  1093. X          strcat (tval, sval);
  1094. X          if (opt) strcat (tval, " Days ");
  1095. X          else strcat (tval, ":");
  1096. X***************
  1097. X*** 59,65 ****
  1098. X      temp = val/360000;
  1099. X      if ((temp) || (*tval))
  1100. X      {
  1101. X!         sprintf(sval, "%d", temp);
  1102. X          strcat (tval, sval);
  1103. X          if (opt) strcat (tval, " Hrs ");
  1104. X          else strcat (tval, ":");
  1105. X--- 57,63 ----
  1106. X      temp = val/360000;
  1107. X      if ((temp) || (*tval))
  1108. X      {
  1109. X!         sprintf(sval, "%lu", temp);
  1110. X          strcat (tval, sval);
  1111. X          if (opt) strcat (tval, " Hrs ");
  1112. X          else strcat (tval, ":");
  1113. X***************
  1114. X*** 69,75 ****
  1115. X      if ((temp) || (*tval))
  1116. X      {
  1117. X          if (*tval) sprintf(sval, "%02d", temp);
  1118. X!         else       sprintf(sval, "%d",   temp);
  1119. X          strcat     (tval, sval);
  1120. X          if (opt) strcat (tval, " Min ");
  1121. X          else strcat (tval, ":");
  1122. X--- 67,73 ----
  1123. X      if ((temp) || (*tval))
  1124. X      {
  1125. X          if (*tval) sprintf(sval, "%02d", temp);
  1126. X!         else       sprintf(sval, "%lu",   temp);
  1127. X          strcat     (tval, sval);
  1128. X          if (opt) strcat (tval, " Min ");
  1129. X          else strcat (tval, ":");
  1130. X***************
  1131. X*** 76,87 ****
  1132. X          val%=6000;
  1133. X      }
  1134. X      temp = val/100;
  1135. X!     if (*tval) sprintf(sval, "%02d", temp);
  1136. X!     else       sprintf(sval, "%d",   temp);
  1137. X      strcat     (tval, sval);
  1138. X      strcat       (tval, ".");
  1139. X      temp = val%100;
  1140. X!     sprintf(sval, "%02d", temp);
  1141. X      strcat     (tval, sval);
  1142. X          strcat (tval, " Sec");
  1143. X      return(tval);
  1144. X--- 74,85 ----
  1145. X          val%=6000;
  1146. X      }
  1147. X      temp = val/100;
  1148. X!     if (*tval) sprintf(sval, "%02lu", temp);
  1149. X!     else       sprintf(sval, "%lu",   temp);
  1150. X      strcat     (tval, sval);
  1151. X      strcat       (tval, ".");
  1152. X      temp = val%100;
  1153. X!     sprintf(sval, "%02lu", temp);
  1154. X      strcat     (tval, sval);
  1155. X          strcat (tval, " Sec");
  1156. X      return(tval);
  1157. X***************
  1158. X*** 266,271 ****
  1159. X--- 264,276 ----
  1160. X          fclose (fpq);
  1161. X          exit(-1);
  1162. X      }
  1163. X+     if ((strcmp (head.qh_defmon, "MAIL") == 0)
  1164. X+     ||  (*head.qh_defmon == '|'))
  1165. X+     {
  1166. X+         fprintf(stderr, "%s has a piped monitor\007\n", queuename);
  1167. X+         fclose (fpq);
  1168. X+         exit(-1);
  1169. X+     }
  1170. X      puts (head.qh_defmon);
  1171. X      }
  1172. X      else
  1173. X***************
  1174. X*** 307,313 ****
  1175. X              }
  1176. X              if (mflag != 0)
  1177. X              {
  1178. X!                 if (entry.qe_monitor[0] != 0) puts (entry.qe_monitor);
  1179. X                  else
  1180. X                  {
  1181. X              if (strcmp (head.qh_defmon, "NONE") == 0)
  1182. X--- 312,329 ----
  1183. X              }
  1184. X              if (mflag != 0)
  1185. X              {
  1186. X!                 if (entry.qe_monitor[0] != 0)
  1187. X!         {
  1188. X!             if ((strcmp (entry.qe_monitor, "MAIL") == 0)
  1189. X!             ||  (*entry.qe_monitor == '|'))
  1190. X!             {
  1191. X!                 fprintf(stderr, "This job in %s has a piped monitor\007\n",
  1192. X!                     queuename);
  1193. X!                 fclose (fpq);
  1194. X!                 exit(-1);
  1195. X!             }
  1196. X!             puts (entry.qe_monitor);
  1197. X!         }
  1198. X                  else
  1199. X                  {
  1200. X              if (strcmp (head.qh_defmon, "NONE") == 0)
  1201. X***************
  1202. X*** 316,321 ****
  1203. X--- 332,344 ----
  1204. X                  fclose (fpq);
  1205. X                  exit(-1);
  1206. X              }
  1207. X+             if ((strcmp (head.qh_defmon, "MAIL") == 0)
  1208. X+             ||  (*head.qh_defmon == '|'))
  1209. X+             {
  1210. X+                 fprintf(stderr, "%s has a piped monitor\007\n", queuename);
  1211. X+                 fclose (fpq);
  1212. X+                 exit(-1);
  1213. X+             }
  1214. X              puts (head.qh_defmon);
  1215. X                  }
  1216. X              }
  1217. X***************
  1218. X*** 327,332 ****
  1219. X--- 350,362 ----
  1220. X              if (strcmp (head.qh_defmon, "NONE") == 0)
  1221. X              {
  1222. X                  fprintf(stderr, "%s has NO default monitor\007\n", queuename);
  1223. X+                 fclose (fpq);
  1224. X+                 exit(-1);
  1225. X+             }
  1226. X+             if ((strcmp (head.qh_defmon, "MAIL") == 0)
  1227. X+             ||  (*head.qh_defmon == '|'))
  1228. X+             {
  1229. X+                 fprintf(stderr, "%s has a piped monitor\007\n", queuename);
  1230. X                  fclose (fpq);
  1231. X                  exit(-1);
  1232. X              }
  1233. Index: src/ql.c
  1234. X***************
  1235. X*** 13,21 ****
  1236. X  #include <time.h>
  1237. X  FILE *fpq;
  1238. X  char buff[128];
  1239. X! char started[7], repeated[3], killed[3], enabled[3], stopped[3], halted[3];
  1240. X! char Yes[] = "Yes";
  1241. X! char No[]  = "No"; 
  1242. X  struct tm *jtimes;
  1243. X  char *queuename;
  1244. X  int i, aflag;
  1245. X--- 13,19 ----
  1246. X  #include <time.h>
  1247. X  FILE *fpq;
  1248. X  char buff[128];
  1249. X! char started[7];
  1250. X  struct tm *jtimes;
  1251. X  char *queuename;
  1252. X  int i, aflag;
  1253. Index: src/qp.c
  1254. X***************
  1255. X*** 20,27 ****
  1256. X  int fpq = 0;
  1257. X  int fplck = 0;
  1258. X  int fptemp = 0;
  1259. X! int result;
  1260. X! int interrupt = 0;
  1261. X  int mail = 0;
  1262. X  FILE *fpin,
  1263. X       *mon;
  1264. X--- 20,26 ----
  1265. X  int fpq = 0;
  1266. X  int fplck = 0;
  1267. X  int fptemp = 0;
  1268. X! long result;
  1269. X  int mail = 0;
  1270. X  FILE *fpin,
  1271. X       *mon;
  1272. X***************
  1273. X*** 54,60 ****
  1274. X  char * print_time(val)
  1275. X  unsigned long val;
  1276. X  {
  1277. X!     int temp;
  1278. X      char sval[8];
  1279. X      static char tval[32];
  1280. X      *tval = 0;
  1281. X--- 53,59 ----
  1282. X  char * print_time(val)
  1283. X  unsigned long val;
  1284. X  {
  1285. X!     unsigned long temp;
  1286. X      char sval[8];
  1287. X      static char tval[32];
  1288. X      *tval = 0;
  1289. X***************
  1290. X*** 61,67 ****
  1291. X      temp = val/360000;
  1292. X      if (temp)
  1293. X      {
  1294. X!         sprintf(sval, "%d", temp);
  1295. X          strcpy (tval, sval);
  1296. X          strcat(tval, ":");
  1297. X          val%=360000;
  1298. X--- 60,66 ----
  1299. X      temp = val/360000;
  1300. X      if (temp)
  1301. X      {
  1302. X!         sprintf(sval, "%lu", temp);
  1303. X          strcpy (tval, sval);
  1304. X          strcat(tval, ":");
  1305. X          val%=360000;
  1306. X***************
  1307. X*** 69,87 ****
  1308. X      temp = val/6000;
  1309. X      if ((temp) || (*tval))
  1310. X      {
  1311. X!         if (*tval) sprintf(sval, "%02d", temp);
  1312. X!         else       sprintf(sval, "%d",   temp);
  1313. X          strcat     (tval, sval);
  1314. X          strcat       (tval, ":");
  1315. X          val%=6000;
  1316. X      }
  1317. X      temp = val/100;
  1318. X!     if (*tval) sprintf(sval, "%02d", temp);
  1319. X!     else       sprintf(sval, "%d",   temp);
  1320. X      strcat     (tval, sval);
  1321. X      strcat       (tval, ".");
  1322. X      temp = val%100;
  1323. X!     sprintf(sval, "%02d", temp);
  1324. X      strcat     (tval, sval);
  1325. X      return(tval);
  1326. X  }
  1327. X--- 68,86 ----
  1328. X      temp = val/6000;
  1329. X      if ((temp) || (*tval))
  1330. X      {
  1331. X!         if (*tval) sprintf(sval, "%02lu", temp);
  1332. X!         else       sprintf(sval, "%lu",   temp);
  1333. X          strcat     (tval, sval);
  1334. X          strcat       (tval, ":");
  1335. X          val%=6000;
  1336. X      }
  1337. X      temp = val/100;
  1338. X!     if (*tval) sprintf(sval, "%02lu", temp);
  1339. X!     else       sprintf(sval, "%lu",   temp);
  1340. X      strcat     (tval, sval);
  1341. X      strcat       (tval, ".");
  1342. X      temp = val%100;
  1343. X!     sprintf(sval, "%02lu", temp);
  1344. X      strcat     (tval, sval);
  1345. X      return(tval);
  1346. X  }
  1347. X***************
  1348. X*** 308,314 ****
  1349. X          else
  1350. X          {       /* get entry and fork it */
  1351. X              read (fpq, &entry, sizeof (entry));
  1352. X!             if ((strcmp (entry.qe_monitor, "MAIL") != 0) && (entry.qe_monitor[0] != 0))
  1353. X              {
  1354. X          /* check if non-default monitor can be accessed */
  1355. X          mon = fopen(entry.qe_monitor, "r");
  1356. X--- 307,314 ----
  1357. X          else
  1358. X          {       /* get entry and fork it */
  1359. X              read (fpq, &entry, sizeof (entry));
  1360. X!             if ((strcmp (entry.qe_monitor, "MAIL") != 0) && (entry.qe_monitor[0] != 0)
  1361. X!         &&  (*entry.qe_monitor != '|'))
  1362. X              {
  1363. X          /* check if non-default monitor can be accessed */
  1364. X          mon = fopen(entry.qe_monitor, "r");
  1365. X***************
  1366. X*** 333,339 ****
  1367. X              }
  1368. X              else
  1369. X              {
  1370. X!         if ((strcmp (entry.qe_monitor, "MAIL") == 0) || (strcmp (head.qh_defmon, "MAIL") == 0))
  1371. X          {
  1372. X              mail = 1;
  1373. X                  strcpy (temp, head.qh_spool);
  1374. X--- 333,342 ----
  1375. X              }
  1376. X              else
  1377. X              {
  1378. X!         if ((strcmp (entry.qe_monitor, "MAIL") == 0) /* mail */
  1379. X!         ||  (strcmp (head.qh_defmon,   "MAIL") == 0) /* mail */
  1380. X!         ||  (*head.qh_defmon == '|')                 /* pipe */
  1381. X!         ||  (*entry.qe_monitor == '|'))              /* pipe */
  1382. X          {
  1383. X              mail = 1;
  1384. X                  strcpy (temp, head.qh_spool);
  1385. X***************
  1386. X*** 420,426 ****
  1387. X                  envvar = &buff1[i];
  1388. X                  i = strlen(envvar);
  1389. X                  if (envvar[i-1] == '\n') envvar[i-1] = 0;
  1390. X!                 envs [j] = malloc(i);
  1391. X                  strcpy (envs[j++], envvar);
  1392. X                  if (j > (QMAXENV - 5)) break; /* can't fit any more in table */
  1393. X                  }
  1394. X--- 423,429 ----
  1395. X                  envvar = &buff1[i];
  1396. X                  i = strlen(envvar);
  1397. X                  if (envvar[i-1] == '\n') envvar[i-1] = 0;
  1398. X!                 envs [j] = (char *)malloc(i);
  1399. X                  strcpy (envs[j++], envvar);
  1400. X                  if (j > (QMAXENV - 5)) break; /* can't fit any more in table */
  1401. X                  }
  1402. X***************
  1403. X*** 432,438 ****
  1404. X                      envs[j++] = qentry;
  1405. X              j = 0;
  1406. X                      jtimes = (struct tm *)localtime (&head.qh_start);
  1407. X!                     if ((entry.qe_monitor[0] != 0) && (strcmp (entry.qe_monitor, "MAIL") !=0))
  1408. X                      {
  1409. X                          mon = freopen (entry.qe_monitor, "a", stdout);
  1410. X                          mon = freopen (entry.qe_monitor, "a", stderr);
  1411. X--- 435,442 ----
  1412. X                      envs[j++] = qentry;
  1413. X              j = 0;
  1414. X                      jtimes = (struct tm *)localtime (&head.qh_start);
  1415. X!                     if ((entry.qe_monitor[0] != 0) && (strcmp (entry.qe_monitor, "MAIL") !=0)
  1416. X!             &&  (*entry.qe_monitor != '|'))
  1417. X                      {
  1418. X                          mon = freopen (entry.qe_monitor, "a", stdout);
  1419. X                          mon = freopen (entry.qe_monitor, "a", stderr);
  1420. X***************
  1421. X*** 450,455 ****
  1422. X--- 454,460 ----
  1423. X                  mon = freopen (head.qh_defmon, "a", stderr);
  1424. X              }
  1425. X                      }
  1426. X+                     nice (head.qh_priority);    /* set priority */
  1427. X                      if (setuid (entry.qe_uid) != 0)
  1428. X              {
  1429. X              perror ("cannot change uid!!");
  1430. X***************
  1431. X*** 456,462 ****
  1432. X              exit (-1);
  1433. X              }
  1434. X                      setgid (entry.qe_gid);
  1435. X-                     nice (head.qh_priority);    /* set priority */
  1436. X                      if (execve (args[0], args, envs) == -1)
  1437. X                      {
  1438. X                          perror ("cannot execute job! ");
  1439. X--- 461,466 ----
  1440. X***************
  1441. X*** 487,493 ****
  1442. X          q_wait(exit_message);
  1443. X          qb_get_timer(&q_real, &q_user, &q_system);
  1444. X                  childid = 0;
  1445. X!                 if ((strcmp(entry.qe_monitor, "MAIL") != 0) && (entry.qe_monitor[0] != 0))
  1446. X                  {
  1447. X                      mon = fopen (entry.qe_monitor, "a");
  1448. X                  }
  1449. X--- 491,498 ----
  1450. X          q_wait(exit_message);
  1451. X          qb_get_timer(&q_real, &q_user, &q_system);
  1452. X                  childid = 0;
  1453. X!                 if ((strcmp(entry.qe_monitor, "MAIL") != 0) && (entry.qe_monitor[0] != 0)
  1454. X!         &&  (*entry.qe_monitor != '|'))
  1455. X                  {
  1456. X                      mon = fopen (entry.qe_monitor, "a");
  1457. X                  }
  1458. X***************
  1459. X*** 515,525 ****
  1460. X          if (mail)
  1461. X          {
  1462. X              mon = fopen (temp, "r");
  1463. X  #ifdef SUBJECT
  1464. X!                    sprintf (path, "%s %s \"Monitor for your job in \'%s\' queue\" %s", MAILPATH, SUBJECT, queuename, entry.qe_uname);
  1465. X  #else
  1466. X!             sprintf (path, "%s %s", MAILPATH, entry.qe_uname);
  1467. X  #endif /* SUBJECT */
  1468. X              fpin = popen (path, "w");
  1469. X              while (fgets (buff, 128, mon) != NULL)
  1470. X                  fputs (buff, fpin);
  1471. X--- 520,542 ----
  1472. X          if (mail)
  1473. X          {
  1474. X              mon = fopen (temp, "r");
  1475. X+             if ((*head.qh_defmon == '|')
  1476. X+             ||  (*entry.qe_monitor == '|'))
  1477. X+             {
  1478. X+                 if (*head.qh_defmon == '|')
  1479. X+                     strcpy(path, &head.qh_defmon[1]); /* stripping '|' */
  1480. X+                 else
  1481. X+                     strcpy(path, &entry.qe_monitor[1]);
  1482. X+             }
  1483. X+             else
  1484. X+             {
  1485. X  #ifdef SUBJECT
  1486. X!                 sprintf (path, "%s %s \"Monitor for your job in \'%s\' queue\" %s",
  1487. X!                         MAILPATH, SUBJECT, queuename, entry.qe_uname);
  1488. X  #else
  1489. X!                 sprintf (path, "%s %s", MAILPATH, entry.qe_uname);
  1490. X  #endif /* SUBJECT */
  1491. X+             }
  1492. X              fpin = popen (path, "w");
  1493. X              while (fgets (buff, 128, mon) != NULL)
  1494. X                  fputs (buff, fpin);
  1495. Index: src/time.c
  1496. X***************
  1497. X*** 46,52 ****
  1498. X  #include "config.h"
  1499. X  struct tms start_times, end_times;
  1500. X  clock_t real_start, real_end;
  1501. X! int clock_tick = 0;
  1502. X  void qb_set_timer()
  1503. X  {
  1504. X      if (!clock_tick) clock_tick = QCLOCK_TICK;
  1505. X--- 46,52 ----
  1506. X  #include "config.h"
  1507. X  struct tms start_times, end_times;
  1508. X  clock_t real_start, real_end;
  1509. X! clock_t clock_tick = 0;
  1510. X  void qb_set_timer()
  1511. X  {
  1512. X      if (!clock_tick) clock_tick = QCLOCK_TICK;
  1513. Index: src/whatgen
  1514. X***************
  1515. X*** 9,12 ****
  1516. X  #************************************************************************#
  1517. X  set `cat patchlevel.h`
  1518. X  echo  "static char QbSID[]= \042@(#) QBATCH (c) \tVersion: 2.$3 \
  1519. X! (12 November 1991)\042;">what.h
  1520. X--- 9,12 ----
  1521. X  #************************************************************************#
  1522. X  set `cat patchlevel.h`
  1523. X  echo  "static char QbSID[]= \042@(#) QBATCH (c) \tVersion: 2.$3 \
  1524. X! (Fri 22 Nov 91)\042;">what.h
  1525. END_OF_FILE
  1526. if test 44685 -ne `wc -c <'patches/qbatch.p03'`; then
  1527.     echo shar: \"'patches/qbatch.p03'\" unpacked with wrong size!
  1528. fi
  1529. # end of 'patches/qbatch.p03'
  1530. fi
  1531. echo shar: End of archive 2 \(of 2\).
  1532. cp /dev/null ark2isdone
  1533. MISSING=""
  1534. for I in 1 2 ; do
  1535.     if test ! -f ark${I}isdone ; then
  1536.     MISSING="${MISSING} ${I}"
  1537.     fi
  1538. done
  1539. if test "${MISSING}" = "" ; then
  1540.     echo You have unpacked both archives.
  1541.     rm -f ark[1-9]isdone
  1542. else
  1543.     echo You still need to unpack the following archives:
  1544.     echo "        " ${MISSING}
  1545. fi
  1546. ##  End of shell archive.
  1547. exit 0
  1548.  
  1549. exit 0 # Just in case...
  1550. -- 
  1551. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  1552. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  1553. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  1554. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  1555.