home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / sources / misc / 3806 < prev    next >
Encoding:
Text File  |  1992-08-14  |  42.9 KB  |  1,571 lines

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