peirce@gumby.cc.wmich.edu (Leonard J. Peirce) (07/11/89)
We currently use the LAT printer support in ULTRIX to share our printers between VMS and ULTRIX. My boss, however, doesn't like the default banner page for the ULTRIX jobs and wants me to change it to look more like the VMS banner. Has anyone modified the banner page for lpr? Do I just have to write a new input or output filter? If it's a matter of having to make some serious changes to lpr, well, maybe this might a good rationale for getting sources. As always, thanks in advance for any help..... -- Leonard J. Peirce Internet: peirce@gumby.cc.wmich.edu Western Michigan University peirce@gw.wmich.edu Academic Computer Center UUCP: ...!uunet!sharkey!wmichgw!peirce Kalamazoo, MI 49008 Voice: (616) 387-5469
grr@cbmvax.UUCP (George Robbins) (07/12/89)
In article <797@gumby.cc.wmich.edu> peirce@gumby.cc.wmich.edu (Leonard J. Peirce) writes: > We currently use the LAT printer support in ULTRIX to share our printers > between VMS and ULTRIX. My boss, however, doesn't like the default banner > page for the ULTRIX jobs and wants me to change it to look more like the > VMS banner. > > Has anyone modified the banner page for lpr? Do I just have to write a new > input or output filter? If it's a matter of having to make some serious > changes to lpr, well, maybe this might a good rationale for getting sources. Hmmm, ya think my boss will go the $15K for a commerial source license if I get one of the VMS'oid here to explain how the Ultrix header page is instrinsically defective... Maybe I'll try it! 8-) The header page stuff is done by the filter you invoke as the 'output filter', this is convered in some detail in the section on the printer spooler in the suplementary documents, even if they don't really tell you all you need to know to write a working filter. Luckily, the generic skeleton filter is one of the fragments that Berkely has made freely distributable, so I've appended a little shar file for anyone who likes to play. This does mean that there is no reason DEC couldn't ship the sources of the filters in /usr/examples to allow just this kind of customization, which would save a lot of work, since the skeleton filter basically doesn't do anything but print lines and write accounting info. More likely now that you can share the source, other people who have done various customizations and pretty header pages can share their version... ------------------------ cut and tear here ------------------------------------- #! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create the files: # Makefile # lpf.c # This archive created: Wed Jul 12 04:11:28 1989 export PATH; PATH=/bin:$PATH echo shar: extracting "'Makefile'" '(1418 characters)' if test -f 'Makefile' then echo shar: will not over-write existing file "'Makefile'" else sed 's/^ X//' << \SHAR_EOF > 'Makefile' X# X# Copyright (c) 1987 Regents of the University of California. X# All rights reserved. X# X# Redistribution and use in source and binary forms are permitted X# provided that the above copyright notice and this paragraph are X# duplicated in all such forms and that any documentation, X# advertising materials, and other materials related to such X# distribution and use acknowledge that the software was developed X# by the University of California, Berkeley. The name of the X# University may not be used to endorse or promote products derived X# from this software without specific prior written permission. X# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR X# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED X# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. X# X# @(#)Makefile 5.5 (Berkeley) 6/30/88 X# XCFLAGS= -O XLIBC= /lib/libc.a XLIBDIR= /usr/lib XSRCS= lpf.c XOBJS= lpf.o X Xall: lpf X Xlpf: lpf.c X ${CC} -o $@ ${CFLAGS} lpf.c X Xclean: FRC X rm -f ${OBJS} core lpf X Xdepend: FRC X mkdep -p ${CFLAGS} ${SRCS} X Xinstall: FRC X install -s -o bin -g bin -m 755 lpf ${DESTDIR}/${LIBDIR}/lpf X Xlint: FRC X lint ${CFLAGS} ${SRCS} X Xtags: FRC X ctags ${SRCS} X XFRC: X X# DO NOT DELETE THIS LINE -- mkdep uses it. X# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. X Xlpf: lpf.c /usr/include/stdio.h /usr/include/signal.h Xlpf: /usr/include/machine/trap.h X X# IF YOU PUT ANYTHING HERE IT WILL GO AWAY SHAR_EOF if test 1418 -ne "`wc -c < 'Makefile'`" then echo shar: error transmitting "'Makefile'" '(should have been 1418 characters)' fi fi # end of overwriting check echo shar: extracting "'lpf.c'" '(4323 characters)' if test -f 'lpf.c' then echo shar: will not over-write existing file "'lpf.c'" else sed 's/^ X//' << \SHAR_EOF > 'lpf.c' X/* X * Copyright (c) 1983 Regents of the University of California. X * All rights reserved. X * X * Redistribution and use in source and binary forms are permitted X * provided that the above copyright notice and this paragraph are X * duplicated in all such forms and that any documentation, X * advertising materials, and other materials related to such X * distribution and use acknowledge that the software was developed X * by the University of California, Berkeley. The name of the X * University may not be used to endorse or promote products derived X * from this software without specific prior written permission. X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED X * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. X */ X X#ifndef lint Xchar copyright[] = X"@(#) Copyright (c) 1983 Regents of the University of California.\n\ X All rights reserved.\n"; X#endif /* not lint */ X X#ifndef lint Xstatic char sccsid[] = "@(#)lpf.c 5.3 (Berkeley) 6/30/88"; X#endif /* not lint */ X X/* X * filter which reads the output of nroff and converts lines X * with ^H's to overwritten lines. Thus this works like 'ul' X * but is much better: it can handle more than 2 overwrites X * and it is written with some style. X * modified by kls to use register references instead of arrays X * to try to gain a little speed. X */ X X#include <stdio.h> X#include <signal.h> X X#define MAXWIDTH 132 X#define MAXREP 10 X Xchar buf[MAXREP][MAXWIDTH]; Xint maxcol[MAXREP] = {-1}; Xint lineno; Xint width = 132; /* default line length */ Xint length = 66; /* page length */ Xint indent; /* indentation length */ Xint npages = 1; Xint literal; /* print control characters */ Xchar *name; /* user's login name */ Xchar *host; /* user's machine name */ Xchar *acctfile; /* accounting information file */ X Xmain(argc, argv) X int argc; X char *argv[]; X{ X register FILE *p = stdin, *o = stdout; X register int i, col; X register char *cp; X int done, linedone, maxrep; X char ch, *limit; X X while (--argc) { X if (*(cp = *++argv) == '-') { X switch (cp[1]) { X case 'n': X argc--; X name = *++argv; X break; X X case 'h': X argc--; X host = *++argv; X break; X X case 'w': X if ((i = atoi(&cp[2])) > 0 && i <= MAXWIDTH) X width = i; X break; X X case 'l': X length = atoi(&cp[2]); X break; X X case 'i': X indent = atoi(&cp[2]); X break; X X case 'c': /* Print control chars */ X literal++; X break; X } X } else X acctfile = cp; X } X X for (cp = buf[0], limit = buf[MAXREP]; cp < limit; *cp++ = ' '); X done = 0; X X while (!done) { X col = indent; X maxrep = -1; X linedone = 0; X while (!linedone) { X switch (ch = getc(p)) { X case EOF: X linedone = done = 1; X ch = '\n'; X break; X X case '\f': X lineno = length; X case '\n': X if (maxrep < 0) X maxrep = 0; X linedone = 1; X break; X X case '\b': X if (--col < indent) X col = indent; X break; X X case '\r': X col = indent; X break; X X case '\t': X col = ((col - indent) | 07) + indent + 1; X break; X X case '\031': X /* X * lpd needs to use a different filter to X * print data so stop what we are doing and X * wait for lpd to restart us. X */ X if ((ch = getchar()) == '\1') { X fflush(stdout); X kill(getpid(), SIGSTOP); X break; X } else { X ungetc(ch, stdin); X ch = '\031'; X } X X default: X if (col >= width || !literal && ch < ' ') { X col++; X break; X } X cp = &buf[0][col]; X for (i = 0; i < MAXREP; i++) { X if (i > maxrep) X maxrep = i; X if (*cp == ' ') { X *cp = ch; X if (col > maxcol[i]) X maxcol[i] = col; X break; X } X cp += MAXWIDTH; X } X col++; X break; X } X } X X /* print out lines */ X for (i = 0; i <= maxrep; i++) { X for (cp = buf[i], limit = cp+maxcol[i]; cp <= limit;) { X putc(*cp, o); X *cp++ = ' '; X } X if (i < maxrep) X putc('\r', o); X else X putc(ch, o); X if (++lineno >= length) { X fflush(o); X npages++; X lineno = 0; X } X maxcol[i] = -1; X } X } X if (lineno) { /* be sure to end on a page boundary */ X putchar('\f'); X npages++; X } X if (name && acctfile && access(acctfile, 02) >= 0 && X freopen(acctfile, "a", stdout) != NULL) { X printf("%7.2f\t%s:%s\n", (float)npages, host, name); X } X exit(0); X} SHAR_EOF if test 4323 -ne "`wc -c < 'lpf.c'`" then echo shar: error transmitting "'lpf.c'" '(should have been 4323 characters)' fi fi # end of overwriting check # End of shell archive exit 0 -- George Robbins - now working for, uucp: {uunet|pyramid|rutgers}!cbmvax!grr but no way officially representing arpa: cbmvax!grr@uunet.uu.net Commodore, Engineering Department fone: 215-431-9255 (only by moonlite)