home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume31 / lprps / part01 < prev    next >
Encoding:
Text File  |  1992-08-13  |  42.7 KB  |  1,566 lines

  1. Newsgroups: comp.sources.misc
  2. From: jjc@jclark.com (James Clark)
  3. Subject:  v31i077:  lprps - interface lpr to a PostScript printer, Part01/02
  4. Message-ID: <csm-v31i077=lprps.133532@sparky.IMD.Sterling.COM>
  5. X-Md4-Signature: 2dbd986849c25cb6b035e9286c16958d
  6. Date: Fri, 14 Aug 1992 18:35:55 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: jjc@jclark.com (James Clark)
  10. Posting-number: Volume 31, Issue 77
  11. Archive-name: lprps/part01
  12. Environment: BSD, SUNOS
  13. Supersedes: lprps: Volume 21, Issue 25
  14.  
  15. This is lprps version 2.3.
  16.  
  17. lprps is a collection of programs for using lpr with a PostScript
  18. printer connected by a bidirectional serial channel.  It has been
  19. tested mainly with Suns running various versions of SunOS (4.0.3, 4.1
  20. and 4.1.1).  It should be easy to port to other 4.3 BSD based systems.
  21. It is not intended for use with System V.
  22.  
  23. It contains the following programs:
  24.  
  25. lprps    handles communication with the printer
  26. psif    allows separate filters to be used for text and PostScript
  27. textps    simple text to PostScript filter
  28. psrev    PostScript page reversal filter
  29. psof    banner filter
  30.  
  31. The file lpr.diff contains some changes to the version of lpr in the
  32. second Berkeley networking release; lprps does not require these
  33. changes, but will work slightly better with them.
  34.  
  35. Some features are:
  36.  
  37. * Deals intelligently with output generated by the printer: printer
  38.   errors (such as ``out of paper'') are logged using syslog; other
  39.   errors and output generated by the user's job are mailed back to the
  40.   user.  Updates status file (displayed by lpq) with printer's current
  41.   status.
  42.  
  43. * Performs printer accounting.
  44.  
  45. * Ensures that the printer is ready to receive the job.
  46.  
  47. * Determines whether file is PostScript or text (by looking at the
  48.   first 2 bytes), and uses the appropriate filter; this is done in
  49.   such a way that you can easily use your favourite text-to-PostScript
  50.   filter.
  51.  
  52. * Can automatically perform page reversal for the benefit of printers
  53.   that stack face-up.
  54.  
  55. * Can easily add your own output filters for TeX, troff or any of the
  56.   other formats supported by lpr.
  57.  
  58. * Page reversal filter supports version 3.0 of Document Structuring
  59.   Conventions.
  60.  
  61. * Text to PostScript filter supports ISO Latin-1.
  62.  
  63. * Supports banner printing.
  64.  
  65. There is no copyright on lprps.
  66.  
  67. See the file INSTALL for installation information.
  68.  
  69. Please report any bugs to me.
  70.  
  71. James Clark
  72. jjc@jclark.com
  73.  
  74. #! /bin/sh
  75. # This is a shell archive.  Remove anything before this line, then unpack
  76. # it by saving it into a file and typing "sh file".  To overwrite existing
  77. # files, type "sh file -c".  You can also feed this as standard input via
  78. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  79. # will see the following message at the end:
  80. #        "End of archive 1 (of 2)."
  81. # Contents:  README INSTALL TODO Makefile textps.man psrev.man
  82. #   lprps.man psif.man psof.man banner.ps lpr.diff
  83. # Wrapped by jjc@jclark on Fri Aug 14 17:43:02 1992
  84. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  85. if test -f 'README' -a "${1}" != "-c" ; then 
  86.   echo shar: Will not clobber existing file \"'README'\"
  87. else
  88. echo shar: Extracting \"'README'\" \(1945 characters\)
  89. sed "s/^X//" >'README' <<'END_OF_FILE'
  90. XThis is lprps version 2.3.
  91. X
  92. Xlprps is a collection of programs for using lpr with a PostScript
  93. Xprinter connected by a bidirectional serial channel.  It has been
  94. Xtested mainly with Suns running various versions of SunOS (4.0.3, 4.1
  95. Xand 4.1.1).  It should be easy to port to other 4.3 BSD based systems.
  96. XIt is not intended for use with System V.
  97. X
  98. XIt contains the following programs:
  99. X
  100. Xlprps    handles communication with the printer
  101. Xpsif    allows separate filters to be used for text and PostScript
  102. Xtextps    simple text to PostScript filter
  103. Xpsrev    PostScript page reversal filter
  104. Xpsof    banner filter
  105. X
  106. XThe file lpr.diff contains some changes to the version of lpr in the
  107. Xsecond Berkeley networking release; lprps does not require these
  108. Xchanges, but will work slightly better with them.
  109. X
  110. XSome features are:
  111. X* Deals intelligently with output generated by the printer: printer
  112. X  errors (such as ``out of paper'') are logged using syslog; other
  113. X  errors and output generated by the user's job are mailed back to the
  114. X  user.  Updates status file (displayed by lpq) with printer's current
  115. X  status.
  116. X
  117. X* Performs printer accounting.
  118. X
  119. X* Ensures that the printer is ready to receive the job.
  120. X
  121. X* Determines whether file is PostScript or text (by looking at the
  122. X  first 2 bytes), and uses the appropriate filter; this is done in
  123. X  such a way that you can easily use your favourite text-to-PostScript
  124. X  filter.
  125. X
  126. X* Can automatically perform page reversal for the benefit of printers
  127. X  that stack face-up.
  128. X
  129. X* Can easily add your own output filters for TeX, troff or any of the
  130. X  other formats supported by lpr.
  131. X
  132. X* Page reversal filter supports version 3.0 of Document Structuring
  133. X  Conventions.
  134. X
  135. X* Text to PostScript filter supports ISO Latin-1.
  136. X
  137. X* Supports banner printing.
  138. X
  139. XThere is no copyright on lprps.
  140. X
  141. XSee the file INSTALL for installation information.
  142. X
  143. XPlease report any bugs to me.
  144. X
  145. XJames Clark
  146. Xjjc@jclark.com
  147. X
  148. X$Id: README,v 1.12 1992/08/14 16:34:21 jjc Exp $
  149. END_OF_FILE
  150. if test 1945 -ne `wc -c <'README'`; then
  151.     echo shar: \"'README'\" unpacked with wrong size!
  152. fi
  153. # end of 'README'
  154. fi
  155. if test -f 'INSTALL' -a "${1}" != "-c" ; then 
  156.   echo shar: Will not clobber existing file \"'INSTALL'\"
  157. else
  158. echo shar: Extracting \"'INSTALL'\" \(3109 characters\)
  159. sed "s/^X//" >'INSTALL' <<'END_OF_FILE'
  160. XYou will need to edit the Makefile. The comments should make it clear
  161. Xwhat needs changing. Do a make; then do a make install as root.
  162. X
  163. XYou need to decide what baud rate you are going to use. If you have a
  164. Xvery old Laserwriter (not a plus), you will have to use 9600;
  165. Xotherwise you should be able to use 38400.
  166. X
  167. XYou need to add an entry in /etc/printcap.  Here's the entry I use:
  168. X
  169. Xlp|ps:\
  170. X    :br#38400:lp=/dev/ttya:mx#0:sf:sh:rw:sb:\
  171. X    :fc#0177777:fs#003:ms=-isig,igncr,cstopb,-echok:\
  172. X    :af=/usr/adm/psacct:lf=/usr/adm/pslog:sd=/usr/spool/pslpd:\
  173. X    :if=/usr/local/lib/psif:
  174. X
  175. XThis entry would be appropriate if you were using /dev/ttya and a baud
  176. Xrate of 38400.  You need to create the spool directory
  177. X(/usr/spool/pslpd), the accounting file (/usr/adm/psacct), and the log
  178. Xfile (/usr/adm/pslog).  The spool directory and the accounting file
  179. Xshould be owned by daemon, the log file by root. You can use other
  180. Xnames if you want.  The `ms' capabability is a Sun extension.  If you
  181. Xdecide to make use of the patches in lpr.diff, you should also add the
  182. X`ex' boolean capability (the patches also add the `ms' capability.)
  183. X
  184. XIf you wish to have banner printing, then you should add
  185. X`of=/usr/local/lib/psof', and remove the `sh' capability.  You will
  186. Xprobably also wnat to modify the banner printing code in banner.ps.
  187. XAs distributed, it provides a fairly minimalist banner page.  Note
  188. Xthat psof requires the `sb' capability.
  189. X
  190. XYou can add easily add other filters. For example, suppose you want to
  191. Xadd a filter for dvi files. Then add an entry to /etc/printcap:
  192. X
  193. X  :df=/usr/local/lib/psdf:
  194. X
  195. XThen create a shell script /usr/local/lib/psdf
  196. X
  197. X#!/bin/sh
  198. X/usr/local/bin/dvitops | /usr/local/lib/lprps "$@"
  199. X
  200. XReplace `/usr/local/bin/dvitops' by the name of your favourite dvi to
  201. Xps program (it must be able to read from the standard input). Then you
  202. Xcan print dvi files with `lpr -d'.
  203. X
  204. XYou must also set the printer's communication parameters. Make sure
  205. Xyou have an entry like this in /etc/remote:
  206. X
  207. X  ttya:dv=/dev/ttya:br#1200:el=^D:
  208. X
  209. XSet the switch on your printer to position labelled 1200 or 0. Then 
  210. X
  211. X  tip ttya
  212. X
  213. X(*)Now carefully type
  214. X
  215. X  executive
  216. X
  217. Xand then RETURN. The printer will not echo this while you are typing.
  218. XIf you typed it correctly, the printer will print a banner and a
  219. Xprompt.  If you get an error message from the printer, type CTRL-D and
  220. Xtry again.  If you don't get any response at all, you probably have a
  221. Xcable problem. Then type
  222. X
  223. X  serverdict begin 0 exitserver
  224. X
  225. Xand RETURN. The printer should say something like
  226. X
  227. X  %%[ exitserver: permanent state may be changed ]%%
  228. X
  229. XThen type
  230. X
  231. X  statusdict begin 25 38400 3 setsccbatch end
  232. X
  233. Xand RETURN. The printer will not echo this. If you get an error message,
  234. Xtype CTRL-D and go back to (*). Otherwise type CTRL-D.
  235. X
  236. XNow check to see that this worked. Type
  237. X
  238. X  executive 
  239. X
  240. Xagain. Then
  241. X
  242. X  statusdict begin 25 sccbatch end = = 
  243. X
  244. XThe printer should say
  245. X
  246. X  3
  247. X  38400
  248. X
  249. XIf it does, type CTRL-D, exit tip, and set the switch on the printer
  250. Xback to the position labelled 9600 or 1.  If not, type CTRL-D and try
  251. Xagain from (*).
  252. X
  253. X$Id: INSTALL,v 1.7 1992/02/01 12:51:59 jjc Exp $
  254. END_OF_FILE
  255. if test 3109 -ne `wc -c <'INSTALL'`; then
  256.     echo shar: \"'INSTALL'\" unpacked with wrong size!
  257. fi
  258. # end of 'INSTALL'
  259. fi
  260. if test -f 'TODO' -a "${1}" != "-c" ; then 
  261.   echo shar: Will not clobber existing file \"'TODO'\"
  262. else
  263. echo shar: Extracting \"'TODO'\" \(145 characters\)
  264. sed "s/^X//" >'TODO' <<'END_OF_FILE'
  265. XDo different intro if errors are being logged.
  266. X
  267. XCatch control characters in lprps.  Handle -c option.
  268. X
  269. Xpsif should either mail or syslog errors.
  270. END_OF_FILE
  271. if test 145 -ne `wc -c <'TODO'`; then
  272.     echo shar: \"'TODO'\" unpacked with wrong size!
  273. fi
  274. # end of 'TODO'
  275. fi
  276. if test -f 'Makefile' -a "${1}" != "-c" ; then 
  277.   echo shar: Will not clobber existing file \"'Makefile'\"
  278. else
  279. echo shar: Extracting \"'Makefile'\" \(3437 characters\)
  280. sed "s/^X//" >'Makefile' <<'END_OF_FILE'
  281. X# $Id: Makefile,v 1.14 1992/08/14 16:41:24 jjc Exp $
  282. X# Define A4 if you use A4 rather than letter size paper.
  283. X# Define IIg to enable a workaround for a bug in the serial
  284. X# driver of the Laserwriter IIf and IIg; this requires the POSIX
  285. X# tcdrain() function.  (I haven't tested this personally.)
  286. XDEFINES=-DA4 #-DIIg
  287. XPREFIX=/usr/local
  288. X# Where to install public executables.
  289. XBINDIR=$(PREFIX)/bin
  290. X# Where to install private executables.
  291. XLIBDIR=$(PREFIX)/lib
  292. X# Define REV_COMMAND to be empty if documents don't need to
  293. X# be printed in reverse order.
  294. XREV_COMMAND=$(BINDIR)/psrev |
  295. X# Where to install the filter for text files.
  296. XTEXT_FILTER=$(LIBDIR)/psif-text
  297. X# Where to install the filter for PostScript files.
  298. XPS_FILTER=$(LIBDIR)/psif-ps
  299. X# Where to install PostScript banner printing code
  300. XBANNER=$(LIBDIR)/banner.ps
  301. X# Filter to convert text to PostScript.  You can use your own instead.
  302. X# It must be able to read from standard input.
  303. XTEXT_TO_PS=$(BINDIR)/textps
  304. XMANROOT=$(PREFIX)/man
  305. X# Manual section for user commands.
  306. XMAN1EXT=1
  307. XMAN1DIR=$(MANROOT)/man$(MAN1EXT)
  308. X# Manual section for system maintenance and operation commands.
  309. XMAN8EXT=8
  310. XMAN8DIR=$(MANROOT)/man$(MAN8EXT)
  311. X
  312. XCC=cc
  313. XCFLAGS=-O $(DEFINES)
  314. X#CFLAGS=-g -Bstatic $(DEFINES)
  315. X# Command for installing programs.
  316. XINSTALL_PROGRAM=install
  317. X# Command for installing man pages.
  318. XINSTALL_DATA=install -m 0444
  319. X
  320. XSHAR=shar
  321. XDIST1=README INSTALL TODO Makefile textps.man psrev.man lprps.man psif.man \
  322. X  psof.man banner.ps lpr.diff
  323. XDIST2=psrev.c lprps.c psif.c textps.c psof.c
  324. X
  325. XPROGS=psrev psif lprps textps psof
  326. X
  327. X.SUFFIXES: .man .n
  328. X
  329. X.man.n:
  330. X    @echo Making $@ from $<
  331. X    @-rm -f $@
  332. X    @sed -e "s;@MAN1EXT@;$(MAN1EXT);" \
  333. X    -e "s;@MAN8EXT@;$(MAN8EXT);" \
  334. X    -e "s;@PS_FILTER@;$(PS_FILTER);" \
  335. X    -e "s;@TEXT_FILTER@;$(TEXT_FILTER);" \
  336. X    -e "s;@BANNER@;$(BANNER);" \
  337. X    $< >$@
  338. X    @chmod 444 $@
  339. X
  340. Xall: psif-text psif-ps $(PROGS) textps.n psrev.n lprps.n psif.n psof.n
  341. X
  342. Xinstall: all
  343. X    -test -d $(LIBDIR) || mkdir $(LIBDIR)
  344. X    -test -d $(BINDIR) || mkdir $(BINDIR)
  345. X    $(INSTALL_PROGRAM) psif $(LIBDIR)/psif
  346. X    $(INSTALL_PROGRAM) lprps $(LIBDIR)/lprps
  347. X    $(INSTALL_PROGRAM) psof $(LIBDIR)/psof
  348. X    $(INSTALL_DATA) banner.ps $(BANNER)
  349. X    $(INSTALL_PROGRAM) textps $(BINDIR)/textps
  350. X    $(INSTALL_PROGRAM) psrev $(BINDIR)/psrev
  351. X    $(INSTALL_PROGRAM) psif-text $(TEXT_FILTER)
  352. X    $(INSTALL_PROGRAM) psif-ps $(PS_FILTER)
  353. X    $(INSTALL_DATA) textps.n $(MAN1DIR)/textps.$(MAN1EXT)
  354. X    $(INSTALL_DATA) psrev.n $(MAN1DIR)/psrev.$(MAN1EXT)
  355. X    $(INSTALL_DATA) lprps.n $(MAN8DIR)/lprps.$(MAN8EXT)
  356. X    $(INSTALL_DATA) psif.n $(MAN8DIR)/psif.$(MAN8EXT)
  357. X    $(INSTALL_DATA) psof.n $(MAN8DIR)/psof.$(MAN8EXT)
  358. X    @echo Now edit /etc/printcap
  359. X
  360. Xlprps: lprps.c
  361. X    $(CC) $(CFLAGS) -o $@ lprps.c
  362. X
  363. Xpsif: psif.c
  364. X    $(CC) $(CFLAGS) -DTEXT_FILTER=\"$(TEXT_FILTER)\" \
  365. X    -DPS_FILTER=\"$(PS_FILTER)\" -o $@ psif.c
  366. X
  367. Xtextps: textps.c
  368. X    $(CC) $(CFLAGS) -o $@ textps.c
  369. X
  370. Xpsrev: psrev.c
  371. X    $(CC) $(CFLAGS) -o $@ psrev.c
  372. X
  373. Xpsof: psof.c
  374. X    $(CC) $(CFLAGS) -DLPRPS=\"$(LIBDIR)/lprps\" \
  375. X    -DBANNER=\"$(BANNER)\" -o $@ psof.c
  376. X
  377. Xpsif-text: Makefile
  378. X    @echo Creating $@
  379. X    @-rm -f $@
  380. X    @echo "#! /bin/sh" > $@
  381. X    @echo "$(TEXT_TO_PS) | $(REV_COMMAND) $(LIBDIR)/lprps \"\$$@\"" >>$@
  382. X    @chmod +x $@
  383. X
  384. Xpsif-ps: Makefile
  385. X    @echo Creating $@
  386. X    @-rm -f $@
  387. X    @echo "#! /bin/sh" > $@
  388. X    @echo "$(REV_COMMAND) $(LIBDIR)/lprps \"\$$@\"" >>$@
  389. X    @chmod +x $@
  390. X
  391. Xdist: part01 part02
  392. X
  393. Xpart01: $(DIST1)
  394. X    rm -f $@
  395. X    $(SHAR) -n1 -e2 $(DIST1) >$@
  396. X
  397. Xpart02: $(DIST2)
  398. X    rm -f $@
  399. X    $(SHAR) -n2 -e2 $(DIST2) >$@
  400. X
  401. Xclean:
  402. X    -rm -f $(PROGS) psif-text psif-ps *.n
  403. END_OF_FILE
  404. if test 3437 -ne `wc -c <'Makefile'`; then
  405.     echo shar: \"'Makefile'\" unpacked with wrong size!
  406. fi
  407. # end of 'Makefile'
  408. fi
  409. if test -f 'textps.man' -a "${1}" != "-c" ; then 
  410.   echo shar: Will not clobber existing file \"'textps.man'\"
  411. else
  412. echo shar: Extracting \"'textps.man'\" \(1311 characters\)
  413. sed "s/^X//" >'textps.man' <<'END_OF_FILE'
  414. X.\" -*- nroff -*-
  415. X.TH TEXTPS @MAN1EXT@
  416. X.\" $Id: textps.man,v 1.2 1992/02/01 12:38:45 jjc Exp $
  417. X.SH NAME
  418. Xtextps \- text to PostScript filter
  419. X.SH SYNOPSIS
  420. X.B textps
  421. X[
  422. X.BI \-c n
  423. X]
  424. X[
  425. X.BI \-l n
  426. X]
  427. X[
  428. X.BI \-m n
  429. X]
  430. X[
  431. X.BI \-t n
  432. X]
  433. X[
  434. X.BI \-v n
  435. X]
  436. X[
  437. X.I filename\|.\|.\|.
  438. X]
  439. X.SH DESCRIPTION
  440. X.B textps
  441. Xis a simple text to PostScript filter.
  442. XIt is usually invoked automatically by a spooler.
  443. XInput files can use ISO Latin-1.
  444. XTwo or more identical overstruck characters are rendered using a bold font.
  445. XTabs are assumed to be set every 8 character positions.
  446. X.B textps
  447. Xis designed to produce good output with
  448. X.B lpr\ \-p
  449. Xor
  450. X.BR pr\ |\ lpr ;
  451. Xif you print unpaginated text,
  452. Xyou will need to increase the
  453. X.B \-t
  454. Xoption and decrease the
  455. X.B \-v
  456. Xor
  457. X.B \-l
  458. Xoption.
  459. X.SH OPTIONS
  460. XThe arguments for all options except
  461. X.B \-l
  462. Xare floating-point numbers.
  463. XThe argument for
  464. X.B \-l
  465. Xmust be a positive integer.
  466. X.TP
  467. X.BI \-c n
  468. XUse
  469. X.I n
  470. Xcharacters to the inch.
  471. X.TP
  472. X.BI \-l n
  473. XUse
  474. X.I n
  475. Xlines per page.
  476. X.TP
  477. X.BI \-m n
  478. XUse a left margin of
  479. X.I n
  480. Xpoints.
  481. X.TP
  482. X.BI \-t n
  483. XPosition the baseline of the first line of text
  484. X.I n
  485. Xpoints below the top of the page.
  486. X.TP
  487. X.BI \-v n
  488. XUse a vertical spacing of
  489. X.I n
  490. Xpoints.
  491. X.LP
  492. XThe default behaviour is
  493. X.BR \-c12\ \-l66\ \-m18\ \-t8\ \-v12 .
  494. X.SH "SEE ALSO"
  495. X.BR psrev (@MAN1EXT@),
  496. X.BR lprps (@MAN8EXT@),
  497. X.BR psif (@MAN8EXT@)
  498. END_OF_FILE
  499. if test 1311 -ne `wc -c <'textps.man'`; then
  500.     echo shar: \"'textps.man'\" unpacked with wrong size!
  501. fi
  502. # end of 'textps.man'
  503. fi
  504. if test -f 'psrev.man' -a "${1}" != "-c" ; then 
  505.   echo shar: Will not clobber existing file \"'psrev.man'\"
  506. else
  507. echo shar: Extracting \"'psrev.man'\" \(778 characters\)
  508. sed "s/^X//" >'psrev.man' <<'END_OF_FILE'
  509. X.\" -*- nroff -*-
  510. X.\" $Id: psrev.man,v 1.1 1991/07/14 14:05:28 jjc Exp $
  511. X.TH PSREV @MAN1EXT@
  512. X.SH NAME
  513. Xpsrev \- PostScript page reversal filter
  514. X.SH SYNOPSIS
  515. X.B psrev
  516. X[
  517. X.I filename
  518. X]
  519. X.SH DESCRIPTION
  520. X.B psrev
  521. Xreverses the order of the pages of a PostScript document.
  522. XUsually
  523. X.B psrev
  524. Xis used with printers that stack face up
  525. Xand is run automatically by the spooler.
  526. XThe document must conform to the Adobe Document Structuring Conventions,
  527. Xpreferably version 3.0.
  528. X.LP
  529. X.B psrev
  530. Xrespects the
  531. X.B %%PageOrder:
  532. Xcomment:
  533. Xif this comment is present and has an argument other than
  534. X.B Ascend
  535. Xthe document will not be reversed.
  536. XA document reversed by
  537. X.B psrev
  538. Xwill contain a
  539. X.B %%PageOrder:\ Descend
  540. Xcomment.
  541. X.SH "SEE ALSO"
  542. X.BR textps (@MAN1EXT@),
  543. X.BR lprps (@MAN8EXT@),
  544. X.BR psif (@MAN8EXT@)
  545. END_OF_FILE
  546. if test 778 -ne `wc -c <'psrev.man'`; then
  547.     echo shar: \"'psrev.man'\" unpacked with wrong size!
  548. fi
  549. # end of 'psrev.man'
  550. fi
  551. if test -f 'lprps.man' -a "${1}" != "-c" ; then 
  552.   echo shar: Will not clobber existing file \"'lprps.man'\"
  553. else
  554. echo shar: Extracting \"'lprps.man'\" \(4380 characters\)
  555. sed "s/^X//" >'lprps.man' <<'END_OF_FILE'
  556. X.\" -*- nroff -*-
  557. X.\" $Id: lprps.man,v 1.3 1992/02/01 12:45:35 jjc Exp $
  558. X.de TQ
  559. X.br
  560. X.ns
  561. X.TP \\$1
  562. X..
  563. X.TH LPRPS @MAN8EXT@
  564. X.SH NAME
  565. Xlprps \- lpr PostScript communication filter
  566. X.SH SYNOPSIS
  567. X.B lprps
  568. X[
  569. X.B \-M
  570. X]
  571. X[
  572. X.BI \-U user
  573. X]
  574. X[
  575. X.B \-c
  576. X]
  577. X[
  578. X.BI \-w n
  579. X]
  580. X[
  581. X.BI \-l n
  582. X]
  583. X[
  584. X.BI \-x n
  585. X]
  586. X[
  587. X.BI \-y n
  588. X]
  589. X[
  590. X.BI \-i n
  591. X]
  592. X[
  593. X.BI \-n \ login_name
  594. X]
  595. X[
  596. X.BI \-h \ host
  597. X]
  598. X[
  599. X.BI \-j \ job
  600. X]
  601. X[
  602. X.BI \-p \ printer
  603. X]
  604. X[
  605. X.BI \-s \ status_file
  606. X]
  607. X[
  608. X.I accounting_file
  609. X]
  610. X.SH DESCRIPTION
  611. X.B lprps
  612. Xhandles communication with a PostScript printer for lpr output filters.
  613. XThe PostScript printer must be connected using a bidirectional serial channel.
  614. XEach output filter should be a pipeline with
  615. X.B lprps\ "$@"
  616. Xas the last command.
  617. XThe other commands in the pipeline should handle conversion into PostScript
  618. Xand possibly page reversal.
  619. XThe command-line syntax of
  620. X.B lprps
  621. Xis such that any argument vector
  622. Xwhich
  623. X.B lpd
  624. Xmight pass to an output file is a legal argument vector for
  625. X.BR lprps .
  626. XThe
  627. X.B psof
  628. Xoutput filter can be used in conjunction with
  629. X.BR lprps .
  630. X.LP
  631. XOutput generated by the PostScript document and errors caused by
  632. Xdefects in the PostScript file are mailed back to the user
  633. X(identified by the
  634. X.B \-n
  635. Xand
  636. X.B \-h
  637. Xoptions).
  638. XIf the
  639. X.B \-M
  640. Xoption is given, this output will instead be written
  641. Xto the standard error file,
  642. Xwhich the spooling system will copy
  643. Xto the error logging file specified by the
  644. X.B lf
  645. Xcapability
  646. X(some versions of lpr have a bug which prevents this happening.)
  647. XOther errors 
  648. X(such as `out of paper' errors)
  649. Xare logged using syslog with the
  650. X.B LOG_LPR
  651. Xfacility.
  652. X.B lprps
  653. Xattempts to update the status file
  654. X(the contents of which are displayed by lpq)
  655. Xwith the printer's status.
  656. X.LP
  657. X.B lprps
  658. Xsupports printer accounting.
  659. XIf this facility is required,
  660. Xa file to contain the accounting information must be specified in 
  661. X.B af
  662. Xcapability in the printcap file.
  663. XThis file should exist, have mode 644 and be owned by daemon.
  664. XThe name of this file will be passed to
  665. X.B lprps
  666. Xin the
  667. X.I accounting_file
  668. Xargument.
  669. XFor each job,
  670. X.B lprps
  671. Xwill append to this file an accounting record specifying the user's name
  672. Xand host together with the number of pages used.
  673. XThe
  674. X.BR pac (8)
  675. Xcommand can then be used to generate an accounting report.
  676. XThe accounting information should be reliable except when
  677. Xthe printer has been turned off or disconnected in the middle of a job.
  678. X.SH OPTIONS
  679. X.LP
  680. XThe following options can be supplied by the output filter script
  681. Xthat calls
  682. X.BR lprps :
  683. X.TP \w'\fB\-U\fIuser'u+3n
  684. X.BI \-U user
  685. X.I user
  686. Xis not a real user;
  687. Xerrors from jobs for
  688. X.I user
  689. Xwill not be mailed back to
  690. X.IR user
  691. Xbut will instead be written to stderr.
  692. XThis option is intended for sites that
  693. Xhave software packages (eg Interleaf) that spool user's jobs using
  694. Xanother userid (eg daemon).
  695. X.TP
  696. X.B \-M
  697. XDon't mail errors back to the user;
  698. Xerrors will be written to stderr.
  699. X.LP
  700. XThe following options are automatically supplied by the spooling system:
  701. X.TP \w'\fB\-n\ \fIname'u+3n
  702. X.BI \-n \ name
  703. XThe user's login name is
  704. X.IR name .
  705. X.TP
  706. X.BI \-h \ host
  707. XThe user's host machine is
  708. X.IR host .
  709. X.TP
  710. X.B \-c
  711. X.TQ
  712. X.BI \-x n
  713. X.TQ
  714. X.BI \-y n
  715. X.TQ
  716. X.BI \-w n
  717. X.TQ
  718. X.BI \-l n
  719. X.TQ
  720. X.BI \-i n
  721. XThese options are ignored.
  722. X.LP
  723. XThe following options are not supplied by the standard version of
  724. Xthe lpr spooling system and
  725. X.B lprps
  726. Xdoes not require them.
  727. XHowever, the lpr system can be modified to supply these options;
  728. X.B lprps
  729. Xwill work slightly better with such a system.
  730. X.TP \w'\fB\-s\fI\ status_file'u+3n
  731. X.BI \-j \ job
  732. XThe job name is
  733. X.IR job .
  734. X.B lprps
  735. Xwill include this in messages mailed to the user.
  736. X.TP
  737. X.BI \-p \ printer
  738. XThe printer name is
  739. X.IR printer .
  740. X.B lprps
  741. Xwill use this in some error messages,
  742. Xand in messages written to the status file.
  743. XIf this option is not specified,
  744. X.B lprps
  745. Xwill attempt to deduce the printer name from the contents of
  746. Xthe status file.
  747. XThis option might also be specified in the output filter script.
  748. X.TP
  749. X.BI \-s \ status_file
  750. XThe name of the status file is
  751. X.IR status_file .
  752. XThe name used by the spooling system for the status file
  753. Xcan be changed by the
  754. X.B st
  755. Xcapability in the printcap entry.
  756. XIf this option is not specified,
  757. X.B lprps
  758. Xwill assume that the name is the default
  759. X.BR status .
  760. XThis option might also be specified in the output filter script.
  761. X.SH "SEE ALSO"
  762. X.BR textps (@MAN1EXT@),
  763. X.BR psrev (@MAN1EXT@),
  764. X.BR syslog.conf (5),
  765. X.BR psif (@MAN8EXT@),
  766. X.BR psof (@MAN8EXT@),
  767. X.BR pac (8),
  768. X.BR lpd (8)
  769. END_OF_FILE
  770. if test 4380 -ne `wc -c <'lprps.man'`; then
  771.     echo shar: \"'lprps.man'\" unpacked with wrong size!
  772. fi
  773. # end of 'lprps.man'
  774. fi
  775. if test -f 'psif.man' -a "${1}" != "-c" ; then 
  776.   echo shar: Will not clobber existing file \"'psif.man'\"
  777. else
  778. echo shar: Extracting \"'psif.man'\" \(1271 characters\)
  779. sed "s/^X//" >'psif.man' <<'END_OF_FILE'
  780. X.\" -*- nroff -*-
  781. X.\" $Id: psif.man,v 1.1 1991/07/14 14:05:13 jjc Exp $
  782. X.TH PSIF @MAN8EXT@
  783. X.SH NAME
  784. Xpsif \- PostScript input filter splitter for lpr
  785. X.SH SYNOPSIS
  786. X.B psif
  787. X[
  788. X.I args\|.\|.\|.
  789. X]
  790. X.SH DESCRIPTION
  791. X.B psif
  792. Xexecutes either
  793. X.B @PS_FILTER@
  794. Xor
  795. X.B @TEXT_FILTER@
  796. Xaccording to whether or not the first two characters of its standard
  797. Xinput are
  798. X.BR %! .
  799. X.B psif
  800. Xwill arrange that the process that it executes sees the same standard
  801. Xinput that it did,
  802. Xand will pass the process the same arguments that it received.
  803. X.LP
  804. XUsually
  805. X.B psif
  806. Xwill be specified as the value of
  807. X.B if
  808. Xcapability in the printcap entry for a PostScript printer;
  809. X.B @TEXT_FILTER@
  810. Xwill be a shell script that runs a text to PostScript filter
  811. Xsuch as
  812. X.BR textps (@MAN1EXT@),
  813. Xfollowed by a PostScript page reversal filter such as
  814. X.BR psrev (@MAN1EXT@)
  815. X(only needed for PostScript printers that stack face up),
  816. Xfollowed by PostScript communication filter such as
  817. X.BR lprps (@MAN8EXT@);
  818. X.B @PS_FILTER@
  819. Xwill be similar except that it will not run the text to PostScript filter.
  820. X.SH FILES
  821. X.TP \w'\fB@TEXT_FILTER@'u+3n
  822. X.B @TEXT_FILTER@
  823. XFilter for text files.
  824. X.TP
  825. X.B @PS_FILTER@
  826. XFilter for PostScript files.
  827. X.SH "SEE ALSO"
  828. X.BR textps (@MAN1EXT@),
  829. X.BR psrev (@MAN1EXT@),
  830. X.BR printcap (5),
  831. X.BR lprps (@MAN8EXT@)
  832. END_OF_FILE
  833. if test 1271 -ne `wc -c <'psif.man'`; then
  834.     echo shar: \"'psif.man'\" unpacked with wrong size!
  835. fi
  836. # end of 'psif.man'
  837. fi
  838. if test -f 'psof.man' -a "${1}" != "-c" ; then 
  839.   echo shar: Will not clobber existing file \"'psof.man'\"
  840. else
  841. echo shar: Extracting \"'psof.man'\" \(1292 characters\)
  842. sed "s/^X//" >'psof.man' <<'END_OF_FILE'
  843. X.\" -*- nroff -*-
  844. X.\" $Id: psof.man,v 1.1 1992/02/01 12:36:32 jjc Exp $
  845. X.TH PSOF @MAN8EXT@
  846. X.SH NAME
  847. Xpsof \- PostScript output/banner filter for lpr
  848. X.SH SYNOPSIS
  849. X.B psof
  850. X[
  851. X.I args\|.\|.\|.
  852. X]
  853. X.SH DESCRIPTION
  854. X.B psof
  855. Xis a PostScript output/banner filter for thr lpr spooling system.
  856. XTo enable banner printing
  857. X.B psof
  858. Xis specified as the
  859. X.B of
  860. Xfilter in the printcap entry;
  861. Xthere must also be an
  862. X.B if
  863. Xfilter,
  864. Xusually
  865. X.BR psif (@MAN8EXT@);
  866. X.B psof
  867. Xrequires that the printcap entry includes the
  868. X.B sb
  869. Xcapability
  870. Xbut does not include the
  871. X.B sh
  872. Xcapability.
  873. XTo disable banner printing, remove the
  874. X.B of
  875. Xcapability and include a
  876. X.B sh
  877. Xcapability.
  878. XThe
  879. X.B lpr
  880. Xsystem supplies various command line arguments to
  881. X.B of
  882. Xfilters;
  883. Xthese are ignored by
  884. X.BR psof .
  885. X.LP
  886. X.B psof
  887. Xwill send the file
  888. X.B @BANNER@
  889. Xto the printer using
  890. X.BR lprps
  891. Xpreceded by definitions of strings
  892. X.BR Job ,
  893. X.BR Class ,
  894. X.B User
  895. Xand
  896. X.BR Date ;
  897. X.B @BANNER@
  898. Xshould contain PostScript code that uses the definitions
  899. Xto print a suitable banner page.
  900. X.LP
  901. XNo accounting information is generated for banner pages.
  902. X.SH FILES
  903. X.B @BANNER@
  904. X\ \ PostScript code to print banner.
  905. X.SH BUGS
  906. XThe banner page will be printed before the job even on printers
  907. Xthat stack face up.
  908. X.SH "SEE ALSO"
  909. X.BR printcap (5),
  910. X.BR lprps (@MAN8EXT@),
  911. X.BR psif (@MAN8EXT@)
  912. END_OF_FILE
  913. if test 1292 -ne `wc -c <'psof.man'`; then
  914.     echo shar: \"'psof.man'\" unpacked with wrong size!
  915. fi
  916. # end of 'psof.man'
  917. fi
  918. if test -f 'banner.ps' -a "${1}" != "-c" ; then 
  919.   echo shar: Will not clobber existing file \"'banner.ps'\"
  920. else
  921. echo shar: Extracting \"'banner.ps'\" \(428 characters\)
  922. sed "s/^X//" >'banner.ps' <<'END_OF_FILE'
  923. X% $Id: banner.ps,v 1.1 1992/02/01 12:42:23 jjc Exp $
  924. X% This prints a banner.
  925. X% psof.c will prepend definitions of Job, User, Class, and Date.
  926. X
  927. X/point-size 36 def
  928. X/line-spacing point-size 1.2 mul def
  929. X/left-margin 18 def
  930. X/first-baseline 720 def
  931. X
  932. X/Helvetica findfont point-size scalefont setfont
  933. X
  934. X
  935. X/i 0 def
  936. X
  937. X[User Job Class Date] {
  938. X    left-margin first-baseline i line-spacing mul sub moveto
  939. X    show
  940. X    /i i 1 add def
  941. X} forall
  942. X
  943. Xshowpage
  944. END_OF_FILE
  945. if test 428 -ne `wc -c <'banner.ps'`; then
  946.     echo shar: \"'banner.ps'\" unpacked with wrong size!
  947. fi
  948. # end of 'banner.ps'
  949. fi
  950. if test -f 'lpr.diff' -a "${1}" != "-c" ; then 
  951.   echo shar: Will not clobber existing file \"'lpr.diff'\"
  952. else
  953. echo shar: Extracting \"'lpr.diff'\" \(17125 characters\)
  954. sed "s/^X//" >'lpr.diff' <<'END_OF_FILE'
  955. XThis file contains some changes to the version of lpr in the second
  956. XBerkeley networking distribution.  This is available for anonymous ftp
  957. Xfrom ftp.uu.net in the directory packages/bsd-sources/usr.sbin/lpr.
  958. X
  959. XThese changes have been tested only under SunOS 4.1.1.  Only lpd has
  960. Xbeen tested.
  961. X
  962. XIn order to compile this version of lpd under SunOS 4.1.1, you may in
  963. Xaddition need lib/libutil/daemon.c, lib/libc/stdio/strerror.c and
  964. Xinclude/paths.h.  You will probably also need to adapt the Makefile.
  965. X
  966. XThe changes are as follows:
  967. X
  968. X1. Use an int rather than a short to store the baud rate.  A short
  969. Xdoesn't work too well for 38400 baud.
  970. X
  971. X2. Implement the `ms' capability as in SunOS.  This a string valued
  972. Xcapability.  The value is a comma separated list of tty modes
  973. Xspecified as for stty(1).  Combination modes are not supported.  The
  974. Ximplementation is based on code from stty.
  975. X
  976. X3. The code uses `sun' as a variable name in several places, but this
  977. Xis defined as a preprocessor name by cc.  Fixed by undefing `sun' where
  978. Xnecessary.
  979. X
  980. X4. Add a new `ex' capability.  This is a boolean capability.  If it's
  981. Xpresent, then the new options (-j, -p and -s) supported by lprps will
  982. Xbe passed to the filter.
  983. X
  984. X5. The SunOS statfs() requires the <sys/vfs.h> rather than
  985. X<sys/mount.h>.
  986. X
  987. X6. In SunOS the fundamental filesystem block size is stored in the
  988. Xf_bsize rather than the f_fsize member of struct stafs.
  989. X
  990. X7. Several pathnames need to be changed for SunOS.
  991. X
  992. XJames Clark
  993. Xjjc@jclark.com
  994. X
  995. Xdiff -rcN ../dist-lpr/common_source/common.c ./common_source/common.c
  996. X*** ../dist-lpr/common_source/common.c    Tue Jan 28 09:59:25 1992
  997. X--- ./common_source/common.c    Tue Jan 28 10:43:55 1992
  998. X***************
  999. X*** 64,69 ****
  1000. X--- 64,70 ----
  1001. X  char    *PF;        /* name of vrast filter (per job) */
  1002. X  char    *FF;        /* form feed string */
  1003. X  char    *TR;        /* trailer string to be output when Q empties */
  1004. X+ char    *MS;        /* list of tty modes to set or clear */
  1005. X  short    SC;        /* suppress multiple copies */
  1006. X  short    SF;        /* suppress FF on each print job */
  1007. X  short    SH;        /* suppress header page */
  1008. X***************
  1009. X*** 74,85 ****
  1010. X  short    PL;        /* page length */
  1011. X  short    PX;        /* page width in pixels */
  1012. X  short    PY;        /* page length in pixels */
  1013. X! short    BR;        /* baud rate if lp is a tty */
  1014. X  int    FC;        /* flags to clear if lp is a tty */
  1015. X  int    FS;        /* flags to set if lp is a tty */
  1016. X  int    XC;        /* flags to clear for local mode */
  1017. X  int    XS;        /* flags to set for local mode */
  1018. X  short    RS;        /* restricted to those with local accounts */
  1019. X  
  1020. X  char    line[BUFSIZ];
  1021. X  char    pbuf[BUFSIZ/2];    /* buffer for printcap strings */
  1022. X--- 75,87 ----
  1023. X  short    PL;        /* page length */
  1024. X  short    PX;        /* page width in pixels */
  1025. X  short    PY;        /* page length in pixels */
  1026. X! int    BR;        /* baud rate if lp is a tty */
  1027. X  int    FC;        /* flags to clear if lp is a tty */
  1028. X  int    FS;        /* flags to set if lp is a tty */
  1029. X  int    XC;        /* flags to clear for local mode */
  1030. X  int    XS;        /* flags to set for local mode */
  1031. X  short    RS;        /* restricted to those with local accounts */
  1032. X+ short    EX;        /* use extended interface */
  1033. X  
  1034. X  char    line[BUFSIZ];
  1035. X  char    pbuf[BUFSIZ/2];    /* buffer for printcap strings */
  1036. Xdiff -rcN ../dist-lpr/common_source/lp.h ./common_source/lp.h
  1037. X*** ../dist-lpr/common_source/lp.h    Tue Jan 28 09:59:50 1992
  1038. X--- ./common_source/lp.h    Tue Jan 28 10:43:28 1992
  1039. X***************
  1040. X*** 78,83 ****
  1041. X--- 78,84 ----
  1042. X  extern char    *CF;        /* name of cifplot filter (per job) */
  1043. X  extern char    *FF;        /* form feed string */
  1044. X  extern char    *TR;        /* trailer string to be output when Q empties */
  1045. X+ extern char    *MS;        /* list of tty modes to set or clear */
  1046. X  extern short    SC;        /* suppress multiple copies */
  1047. X  extern short    SF;        /* suppress FF on each print job */
  1048. X  extern short    SH;        /* suppress header page */
  1049. X***************
  1050. X*** 88,99 ****
  1051. X  extern short    PX;        /* page width in pixels */
  1052. X  extern short    PY;        /* page length in pixels */
  1053. X  extern short    PL;        /* page length */
  1054. X! extern short    BR;        /* baud rate if lp is a tty */
  1055. X  extern int    FC;        /* flags to clear if lp is a tty */
  1056. X  extern int    FS;        /* flags to set if lp is a tty */
  1057. X  extern int    XC;        /* flags to clear for local mode */
  1058. X  extern int    XS;        /* flags to set for local mode */
  1059. X  extern short    RS;        /* restricted to those with local accounts */
  1060. X  
  1061. X  extern char    line[BUFSIZ];
  1062. X  extern char    pbuf[];        /* buffer for printcap entry */
  1063. X--- 89,101 ----
  1064. X  extern short    PX;        /* page width in pixels */
  1065. X  extern short    PY;        /* page length in pixels */
  1066. X  extern short    PL;        /* page length */
  1067. X! extern int    BR;        /* baud rate if lp is a tty */
  1068. X  extern int    FC;        /* flags to clear if lp is a tty */
  1069. X  extern int    FS;        /* flags to set if lp is a tty */
  1070. X  extern int    XC;        /* flags to clear for local mode */
  1071. X  extern int    XS;        /* flags to set for local mode */
  1072. X  extern short    RS;        /* restricted to those with local accounts */
  1073. X+ extern short    EX;        /* use extended interface */
  1074. X  
  1075. X  extern char    line[BUFSIZ];
  1076. X  extern char    pbuf[];        /* buffer for printcap entry */
  1077. Xdiff -rcN ../dist-lpr/common_source/pathnames.h ./common_source/pathnames.h
  1078. X*** ../dist-lpr/common_source/pathnames.h    Tue Jan 28 10:00:15 1992
  1079. X--- ./common_source/pathnames.h    Tue Jan 28 11:22:23 1992
  1080. X***************
  1081. X*** 36,50 ****
  1082. X  #include <paths.h>
  1083. X  
  1084. X  #define    _PATH_DEFDEVLP        "/dev/lp"
  1085. X! #define    _PATH_DEFSPOOL        "/var/spool/output/lpd"
  1086. X  #define    _PATH_HOSTSEQUIV    "/etc/hosts.equiv"
  1087. X  #define    _PATH_HOSTSLPD        "/etc/hosts.lpd"
  1088. X! #define    _PATH_MASTERLOCK    "/var/spool/output/lpd.lock"
  1089. X  #define    _PATH_PR        "/usr/bin/pr"
  1090. X  #define    _PATH_PRINTCAP        "/etc/printcap"
  1091. X! #define    _PATH_SOCKETNAME    "/var/run/printer"
  1092. X! #define    _PATH_VFONT        "/usr/libdata/vfont/"
  1093. X! #define    _PATH_VFONTB        "/usr/libdata/vfont/B"
  1094. X! #define    _PATH_VFONTI        "/usr/libdata/vfont/I"
  1095. X! #define    _PATH_VFONTR        "/usr/libdata/vfont/R"
  1096. X! #define    _PATH_VFONTS        "/usr/libdata/vfont/S"
  1097. X--- 36,50 ----
  1098. X  #include <paths.h>
  1099. X  
  1100. X  #define    _PATH_DEFDEVLP        "/dev/lp"
  1101. X! #define    _PATH_DEFSPOOL        "/var/spool/lpd"
  1102. X  #define    _PATH_HOSTSEQUIV    "/etc/hosts.equiv"
  1103. X  #define    _PATH_HOSTSLPD        "/etc/hosts.lpd"
  1104. X! #define    _PATH_MASTERLOCK    "/var/spool/lpd.lock"
  1105. X  #define    _PATH_PR        "/usr/bin/pr"
  1106. X  #define    _PATH_PRINTCAP        "/etc/printcap"
  1107. X! #define    _PATH_SOCKETNAME    "/dev/printer"
  1108. X! #define    _PATH_VFONT        "/usr/lib/vfont/"
  1109. X! #define    _PATH_VFONTB        "/usr/lib/vfont/B"
  1110. X! #define    _PATH_VFONTI        "/usr/lib/vfont/I"
  1111. X! #define    _PATH_VFONTR        "/usr/lib/vfont/R"
  1112. X! #define    _PATH_VFONTS        "/usr/lib/vfont/S"
  1113. Xdiff -rcN ../dist-lpr/common_source/startdaemon.c ./common_source/startdaemon.c
  1114. X*** ../dist-lpr/common_source/startdaemon.c    Tue Jan 28 10:01:03 1992
  1115. X--- ./common_source/startdaemon.c    Tue Jan 28 10:42:22 1992
  1116. X***************
  1117. X*** 46,51 ****
  1118. X--- 46,55 ----
  1119. X  #include "lp.local.h"
  1120. X  #include "pathnames.h"
  1121. X  
  1122. X+ #ifdef sun
  1123. X+ #undef sun
  1124. X+ #endif
  1125. X+ 
  1126. X  startdaemon(printer)
  1127. X      char *printer;
  1128. X  {
  1129. Xdiff -rcN ../dist-lpr/lpd/lpd.c ./lpd/lpd.c
  1130. X*** ../dist-lpr/lpd/lpd.c    Tue Jan 28 10:03:22 1992
  1131. X--- ./lpd/lpd.c    Tue Jan 28 10:32:51 1992
  1132. X***************
  1133. X*** 72,77 ****
  1134. X--- 72,80 ----
  1135. X  
  1136. X  #include "lp.h"
  1137. X  #include "pathnames.h"
  1138. X+ #ifdef sun
  1139. X+ #undef sun
  1140. X+ #endif
  1141. X  
  1142. X  int    lflag;                /* log requests flag */
  1143. X  int    from_remote;            /* from remote socket */
  1144. Xdiff -rcN ../dist-lpr/lpd/modes.c ./lpd/modes.c
  1145. X*** ../dist-lpr/lpd/modes.c
  1146. X--- ./lpd/modes.c    Tue Jan 28 15:25:21 1992
  1147. X***************
  1148. X*** 0 ****
  1149. X--- 1,232 ----
  1150. X+ /*-
  1151. X+  * Copyright (c) 1991 The Regents of the University of California.
  1152. X+  * All rights reserved.
  1153. X+  *
  1154. X+  * Redistribution and use in source and binary forms, with or without
  1155. X+  * modification, are permitted provided that the following conditions
  1156. X+  * are met:
  1157. X+  * 1. Redistributions of source code must retain the above copyright
  1158. X+  *    notice, this list of conditions and the following disclaimer.
  1159. X+  * 2. Redistributions in binary form must reproduce the above copyright
  1160. X+  *    notice, this list of conditions and the following disclaimer in the
  1161. X+  *    documentation and/or other materials provided with the distribution.
  1162. X+  * 3. All advertising materials mentioning features or use of this software
  1163. X+  *    must display the following acknowledgement:
  1164. X+  *    This product includes software developed by the University of
  1165. X+  *    California, Berkeley and its contributors.
  1166. X+  * 4. Neither the name of the University nor the names of its contributors
  1167. X+  *    may be used to endorse or promote products derived from this software
  1168. X+  *    without specific prior written permission.
  1169. X+  *
  1170. X+  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  1171. X+  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  1172. X+  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  1173. X+  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  1174. X+  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  1175. X+  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  1176. X+  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  1177. X+  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  1178. X+  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  1179. X+  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1180. X+  * SUCH DAMAGE.
  1181. X+  */
  1182. X+ 
  1183. X+ /* This is slightly hacked version of bin/stty/modes.c. */
  1184. X+ 
  1185. X+ #ifndef lint
  1186. X+ static char sccsid[] = "@(#)modes.c    5.4 (Berkeley) 6/10/91";
  1187. X+ #endif /* not lint */
  1188. X+ 
  1189. X+ #include <termios.h>
  1190. X+ #include <string.h>
  1191. X+ 
  1192. X+ struct modes {
  1193. X+     char *name;
  1194. X+     long set;
  1195. X+     long unset;
  1196. X+ };
  1197. X+ 
  1198. X+ static struct modes cmodes[] = {
  1199. X+     "cs5",        CS5, CSIZE,
  1200. X+     "cs6",        CS6, CSIZE,
  1201. X+     "cs7",        CS7, CSIZE,
  1202. X+     "cs8",        CS8, CSIZE,
  1203. X+     "cstopb",    CSTOPB, 0,
  1204. X+     "-cstopb",    0, CSTOPB,
  1205. X+     "cread",    CREAD, 0,
  1206. X+     "-cread",    0, CREAD,
  1207. X+     "parenb",    PARENB, 0,
  1208. X+     "-parenb",    0, PARENB,
  1209. X+     "parodd",    PARODD, 0,
  1210. X+     "-parodd",    0, PARODD,
  1211. X+     "parity",    PARENB | CS7, PARODD | CSIZE,
  1212. X+     "-parity",    CS8, PARODD | PARENB | CSIZE,
  1213. X+     "evenp",    PARENB | CS7, PARODD | CSIZE,
  1214. X+     "-evenp",    CS8, PARODD | PARENB | CSIZE,
  1215. X+     "oddp",        PARENB | CS7 | PARODD, CSIZE,
  1216. X+     "-oddp",    CS8, PARODD | PARENB | CSIZE,
  1217. X+     "pass8",    CS8, PARODD | PARENB | CSIZE,
  1218. X+     "hupcl",    HUPCL, 0,
  1219. X+     "-hupcl",    0, HUPCL,
  1220. X+     "hup",        HUPCL, 0,
  1221. X+     "-hup",        0, HUPCL,
  1222. X+     "clocal",    CLOCAL, 0,
  1223. X+     "-clocal",    0, CLOCAL,
  1224. X+     "crtscts",    CRTSCTS, 0,
  1225. X+     "-crtscts",    0, CRTSCTS,
  1226. X+     NULL
  1227. X+ };
  1228. X+ 
  1229. X+ static struct modes imodes[] = {
  1230. X+     "ignbrk",    IGNBRK, 0,
  1231. X+     "-ignbrk",    0, IGNBRK,
  1232. X+     "brkint",    BRKINT, 0,
  1233. X+     "-brkint",    0, BRKINT,
  1234. X+     "ignpar",    IGNPAR, 0,
  1235. X+     "-ignpar",    0, IGNPAR,
  1236. X+     "parmrk",    PARMRK, 0,
  1237. X+     "-parmrk",    0, PARMRK,
  1238. X+     "inpck",    INPCK, 0,
  1239. X+     "-inpck",    0, INPCK,
  1240. X+     "istrip",    ISTRIP, 0,
  1241. X+     "-istrip",    0, ISTRIP,
  1242. X+     "inlcr",    INLCR, 0,
  1243. X+     "-inlcr",    0, INLCR,
  1244. X+     "igncr",    IGNCR, 0,
  1245. X+     "-igncr",    0, IGNCR,
  1246. X+     "icrnl",    ICRNL, 0,
  1247. X+     "-icrnl",    0, ICRNL,
  1248. X+     "ixon",        IXON, 0,
  1249. X+     "-ixon",    0, IXON,
  1250. X+     "flow",        IXON, 0,
  1251. X+     "-flow",    0, IXON,
  1252. X+     "ixoff",    IXOFF, 0,
  1253. X+     "-ixoff",    0, IXOFF,
  1254. X+     "tandem",    IXOFF, 0,
  1255. X+     "-tandem",    0, IXOFF,
  1256. X+     "ixany",    IXANY, 0,
  1257. X+     "-ixany",    0, IXANY,
  1258. X+     "decctlq",    0, IXANY,
  1259. X+     "-decctlq",    IXANY, 0,
  1260. X+     "imaxbel",    IMAXBEL, 0,
  1261. X+     "-imaxbel",    0, IMAXBEL,
  1262. X+     NULL
  1263. X+ };
  1264. X+ 
  1265. X+ static struct modes lmodes[] = {
  1266. X+     "echo",        ECHO, 0,
  1267. X+     "-echo",    0, ECHO,
  1268. X+     "echoe",    ECHOE, 0,
  1269. X+     "-echoe",    0, ECHOE,
  1270. X+     "crterase",    ECHOE, 0,
  1271. X+     "-crterase",    0, ECHOE,
  1272. X+     "crtbs",    ECHOE, 0,   /* crtbs not supported, close enough */
  1273. X+     "-crtbs",    0, ECHOE,
  1274. X+     "echok",    ECHOK, 0,
  1275. X+     "-echok",    0, ECHOK,
  1276. X+     "echoke",    ECHOKE, 0,
  1277. X+     "-echoke",    0, ECHOKE,
  1278. X+     "crtkill",    ECHOKE, 0,
  1279. X+     "-crtkill",    0, ECHOKE,
  1280. X+ #ifdef ALTWERASE
  1281. X+     "altwerase",    ALTWERASE, 0,
  1282. X+     "-altwerase",    0, ALTWERASE,
  1283. X+ #endif
  1284. X+     "iexten",    IEXTEN, 0,
  1285. X+     "-iexten",    0, IEXTEN,
  1286. X+     "echonl",    ECHONL, 0,
  1287. X+     "-echonl",    0, ECHONL,
  1288. X+     "echoctl",    ECHOCTL, 0,
  1289. X+     "-echoctl",    0, ECHOCTL,
  1290. X+     "ctlecho",    ECHOCTL, 0,
  1291. X+     "-ctlecho",    0, ECHOCTL,
  1292. X+     "echoprt",    ECHOPRT, 0,
  1293. X+     "-echoprt",    0, ECHOPRT,
  1294. X+     "prterase",    ECHOPRT, 0,
  1295. X+     "-prterase",    0, ECHOPRT,
  1296. X+     "isig",        ISIG, 0,
  1297. X+     "-isig",    0, ISIG,
  1298. X+     "icanon",    ICANON, 0,
  1299. X+     "-icanon",    0, ICANON,
  1300. X+     "noflsh",    NOFLSH, 0,
  1301. X+     "-noflsh",    0, NOFLSH,
  1302. X+     "tostop",    TOSTOP, 0,
  1303. X+     "-tostop",    0, TOSTOP,
  1304. X+ #ifdef MDMBUF
  1305. X+     "mdmbuf",    MDMBUF, 0,
  1306. X+     "-mdmbuf",    0, MDMBUF,
  1307. X+ #endif
  1308. X+     "flusho",    FLUSHO, 0,
  1309. X+     "-flusho",    0, FLUSHO,
  1310. X+     "pendin",    PENDIN, 0,
  1311. X+     "-pendin",    0, PENDIN,
  1312. X+     "crt",        ECHOE|ECHOKE|ECHOCTL, ECHOK|ECHOPRT,
  1313. X+     "-crt",        ECHOK, ECHOE|ECHOKE|ECHOCTL,
  1314. X+     "newcrt",    ECHOE|ECHOKE|ECHOCTL, ECHOK|ECHOPRT,
  1315. X+     "-newcrt",    ECHOK, ECHOE|ECHOKE|ECHOCTL, 
  1316. X+ #ifdef NOKERNINFO
  1317. X+     "nokerninfo",    NOKERNINFO, 0,
  1318. X+     "-nokerninfo",    0, NOKERNINFO,
  1319. X+     "kerninfo",    0, NOKERNINFO,
  1320. X+     "-kerninfo",    NOKERNINFO, 0,
  1321. X+ #endif
  1322. X+     NULL
  1323. X+ };
  1324. X+ 
  1325. X+ static struct modes omodes[] = {
  1326. X+     "opost",    OPOST, 0,
  1327. X+     "-opost",    0, OPOST,
  1328. X+     "litout",    0, OPOST,
  1329. X+     "-litout",    OPOST, 0,
  1330. X+     "onlcr",    ONLCR, 0,
  1331. X+     "-onlcr",    0, ONLCR,
  1332. X+ #ifdef OXTABS
  1333. X+     "tabs",        0, OXTABS,    /* "preserve" tabs */
  1334. X+     "-tabs",    OXTABS, 0,
  1335. X+     "xtabs",    OXTABS, 0,
  1336. X+     "-xtabs",    0, OXTABS,
  1337. X+     "oxtabs",    OXTABS, 0,
  1338. X+     "-oxtabs",    0, OXTABS,
  1339. X+ #else
  1340. X+     "tabs",        0, TABDLY,
  1341. X+     "-tabs",    XTABS, TABDLY,
  1342. X+ #endif
  1343. X+     NULL
  1344. X+ };
  1345. X+ 
  1346. X+ #define    CHK(s)    (*name == s[0] && !strcmp(name, s))
  1347. X+ 
  1348. X+ /* Return 0 for OK, -1 on error (analogous to cfset[oi]speed.) */
  1349. X+ 
  1350. X+ setmode(tp, name)
  1351. X+     struct termios *tp;
  1352. X+     char *name;
  1353. X+ {
  1354. X+     register struct modes *mp;
  1355. X+ 
  1356. X+     for (mp = cmodes; mp->name; ++mp)
  1357. X+         if (CHK(mp->name)) {
  1358. X+             tp->c_cflag &= ~mp->unset;
  1359. X+             tp->c_cflag |= mp->set;
  1360. X+             return(0);
  1361. X+         }
  1362. X+     for (mp = imodes; mp->name; ++mp)
  1363. X+         if (CHK(mp->name)) {
  1364. X+             tp->c_iflag &= ~mp->unset;
  1365. X+             tp->c_iflag |= mp->set;
  1366. X+             return(0);
  1367. X+         }
  1368. X+     for (mp = lmodes; mp->name; ++mp)
  1369. X+         if (CHK(mp->name)) {
  1370. X+             tp->c_lflag &= ~mp->unset;
  1371. X+             tp->c_lflag |= mp->set;
  1372. X+             return(0);
  1373. X+         }
  1374. X+     for (mp = omodes; mp->name; ++mp)
  1375. X+         if (CHK(mp->name)) {
  1376. X+             tp->c_oflag &= ~mp->unset;
  1377. X+             tp->c_oflag |= mp->set;
  1378. X+             return(0);
  1379. X+         }
  1380. X+     return(-1);
  1381. X+ }
  1382. Xdiff -rcN ../dist-lpr/lpd/ms.c ./lpd/ms.c
  1383. X*** ../dist-lpr/lpd/ms.c
  1384. X--- ./lpd/ms.c    Tue Jan 28 15:39:30 1992
  1385. X***************
  1386. X*** 0 ****
  1387. X--- 1,48 ----
  1388. X+ /* 
  1389. X+  * Implement ms capability.  Uses POSIX termios interface.
  1390. X+  */
  1391. X+ 
  1392. X+ /* 
  1393. X+  * We don't want to include lp.h because of conflicts between 
  1394. X+  * <termios.h> and <sgtty> in SunOS.
  1395. X+  */
  1396. X+ 
  1397. X+ #include <termios.h>
  1398. X+ #include <syslog.h>
  1399. X+ 
  1400. X+ extern char     *printer;
  1401. X+ extern int    pfd;
  1402. X+ extern char    *MS;
  1403. X+ 
  1404. X+ setms()
  1405. X+ {
  1406. X+     struct termios t;
  1407. X+     char *s;
  1408. X+     
  1409. X+     if (!MS)
  1410. X+         return;
  1411. X+     if (tcgetattr(pfd, &t) < 0) {
  1412. X+         syslog(LOG_ERR, "%s: tcgetattr: %m", printer);
  1413. X+         exit(1);
  1414. X+     }
  1415. X+     
  1416. X+     s = MS;
  1417. X+     for (;;) {
  1418. X+         char *p;
  1419. X+         char saved;
  1420. X+ 
  1421. X+         for (p = s; *p != '\0' && *p != ','; p++)
  1422. X+             ;
  1423. X+         saved = *p;
  1424. X+         *p = '\0';
  1425. X+         if (*s && setmode(&t, s) < 0)
  1426. X+             syslog(LOG_ERR, "%s: unknown mode: %s", printer, s);
  1427. X+         if ((*p = saved) == '\0')
  1428. X+             break;
  1429. X+         s = ++p;
  1430. X+     }
  1431. X+     if (tcsetattr(pfd, TCSADRAIN, &t) < 0) {
  1432. X+         syslog(LOG_ERR, "%s: tcsetattr: %m", printer);
  1433. X+         exit(1);
  1434. X+     }
  1435. X+ }
  1436. Xdiff -rcN ../dist-lpr/lpd/printjob.c ./lpd/printjob.c
  1437. X*** ../dist-lpr/lpd/printjob.c    Tue Jan 28 10:04:03 1992
  1438. X--- ./lpd/printjob.c    Tue Jan 28 15:36:41 1992
  1439. X***************
  1440. X*** 445,451 ****
  1441. X      register char *prog;
  1442. X      int fi, fo;
  1443. X      FILE *fp;
  1444. X!     char *av[15], buf[BUFSIZ];
  1445. X      int pid, p[2], stopped = 0;
  1446. X      union wait status;
  1447. X      struct stat stb;
  1448. X--- 445,451 ----
  1449. X      register char *prog;
  1450. X      int fi, fo;
  1451. X      FILE *fp;
  1452. X!     char *av[21], buf[BUFSIZ];
  1453. X      int pid, p[2], stopped = 0;
  1454. X      union wait status;
  1455. X      struct stat stb;
  1456. X***************
  1457. X*** 576,581 ****
  1458. X--- 576,589 ----
  1459. X          av[0]++;
  1460. X      else
  1461. X          av[0] = prog;
  1462. X+     if (EX) {
  1463. X+         av[n++] = "-j";
  1464. X+             av[n++] = jobname;
  1465. X+         av[n++] = "-p";
  1466. X+         av[n++] = printer;
  1467. X+         av[n++] = "-s";
  1468. X+         av[n++] = ST;
  1469. X+     }
  1470. X      av[n++] = "-n";
  1471. X      av[n++] = logname;
  1472. X      av[n++] = "-h";
  1473. X***************
  1474. X*** 1102,1107 ****
  1475. X--- 1110,1116 ----
  1476. X      VF = pgetstr("vf", &bp);
  1477. X      CF = pgetstr("cf", &bp);
  1478. X      TR = pgetstr("tr", &bp);
  1479. X+     MS = pgetstr("ms", &bp);
  1480. X      RS = pgetflag("rs");
  1481. X      SF = pgetflag("sf");
  1482. X      SH = pgetflag("sh");
  1483. X***************
  1484. X*** 1108,1113 ****
  1485. X--- 1117,1123 ----
  1486. X      SB = pgetflag("sb");
  1487. X      HL = pgetflag("hl");
  1488. X      RW = pgetflag("rw");
  1489. X+     EX = pgetflag("ex");
  1490. X      BR = pgetnum("br");
  1491. X      if ((FC = pgetnum("fc")) < 0)
  1492. X          FC = 0;
  1493. X***************
  1494. X*** 1268,1273 ****
  1495. X--- 1278,1284 ----
  1496. X              exit(1);
  1497. X          }
  1498. X      }
  1499. X+     setms();
  1500. X  }
  1501. X  
  1502. X  /*VARARGS1*/
  1503. Xdiff -rcN ../dist-lpr/lpd/recvjob.c ./lpd/recvjob.c
  1504. X*** ../dist-lpr/lpd/recvjob.c    Tue Jan 28 10:04:17 1992
  1505. X--- ./lpd/recvjob.c    Fri Jan 31 19:29:30 1992
  1506. X***************
  1507. X*** 42,48 ****
  1508. X  
  1509. X  #include "lp.h"
  1510. X  #include "pathnames.h"
  1511. X! #include <sys/mount.h>
  1512. X  
  1513. X  char    *sp = "";
  1514. X  #define ack()    (void) write(1, sp, 1);
  1515. X--- 42,48 ----
  1516. X  
  1517. X  #include "lp.h"
  1518. X  #include "pathnames.h"
  1519. X! #include <sys/vfs.h>
  1520. X  
  1521. X  char    *sp = "";
  1522. X  #define ack()    (void) write(1, sp, 1);
  1523. X***************
  1524. X*** 251,257 ****
  1525. X          syslog(LOG_ERR, "%s: %m", "statfs(\".\")");
  1526. X          return (1);
  1527. X      }
  1528. X!     spacefree = sfb.f_bavail * (sfb.f_fsize / 512);
  1529. X      size = (size + 511) / 512;
  1530. X      if (minfree + size > spacefree)
  1531. X          return(0);
  1532. X--- 251,257 ----
  1533. X          syslog(LOG_ERR, "%s: %m", "statfs(\".\")");
  1534. X          return (1);
  1535. X      }
  1536. X!     spacefree = sfb.f_bavail * (sfb.f_bsize / 512);
  1537. X      size = (size + 511) / 512;
  1538. X      if (minfree + size > spacefree)
  1539. X          return(0);
  1540. END_OF_FILE
  1541. if test 17125 -ne `wc -c <'lpr.diff'`; then
  1542.     echo shar: \"'lpr.diff'\" unpacked with wrong size!
  1543. fi
  1544. # end of 'lpr.diff'
  1545. fi
  1546. echo shar: End of archive 1 \(of 2\).
  1547. cp /dev/null ark1isdone
  1548. MISSING=""
  1549. for I in 1 2 ; do
  1550.     if test ! -f ark${I}isdone ; then
  1551.     MISSING="${MISSING} ${I}"
  1552.     fi
  1553. done
  1554. if test "${MISSING}" = "" ; then
  1555.     echo You have unpacked both archives.
  1556.     rm -f ark[1-9]isdone
  1557. else
  1558.     echo You still need to unpack the following archives:
  1559.     echo "        " ${MISSING}
  1560. fi
  1561. ##  End of shell archive.
  1562. exit 0
  1563.  
  1564. exit 0 # Just in case...
  1565.