Article View: comp.protocols.appletalk
Article #3923Using lwpr as a filter
From: Johan Vromans
Date: Wed, 26 Jun 1991 11:29
Date: Wed, 26 Jun 1991 11:29
101 lines
3347 bytes
3347 bytes
The following small patch to samples/lwpr.c makes it possible to use
lwpr as a filter (i.e. takes the file to print from standard input).
I cannot see a reason why this should not be possible.
CAP 6.0, Patchlevel 27.
*** samples/lwpr.c~ Thu Feb 28 13:44:08 1991
--- samples/lwpr.c Wed Jun 26 13:22:28 1991
***************
*** 57,63 ****
usage(pgm)
char *pgm;
{
! fprintf(stderr,"%s [-d<debug args>] [-p printer] file [file]*\n",pgm);
fprintf(stderr, "\tnote: uses PRINTER environment var if printer name\n");
fprintf(stderr, "\tnot given (requires %s)\n",CAPPRINTERS);
exit(1);
--- 57,63 ----
usage(pgm)
char *pgm;
{
! fprintf(stderr,"%s [-d<debug args>] [-p printer] [file|-] [file]*\n",pgm);
fprintf(stderr, "\tnote: uses PRINTER environment var if printer name\n");
fprintf(stderr, "\tnot given (requires %s)\n",CAPPRINTERS);
exit(1);
***************
*** 118,124 ****
for (; optind < argc; optind++ ) {
s = argv[optind];
! if (access(s, R_OK) == 0)
sendfile(s);
else
perror(s);
--- 118,124 ----
for (; optind < argc; optind++ ) {
s = argv[optind];
! if ((access(s, R_OK) == 0) || !strcmp (s, "-"))
sendfile(s);
else
perror(s);
***************
*** 210,216 ****
int eof, wcomp, paperr;
printf("Sending %s\n",fname);
! fd = open(fname,0);
if (fd < 0) {
perror(fname);
return(FALSE);
--- 210,219 ----
int eof, wcomp, paperr;
printf("Sending %s\n",fname);
! if ( strcmp (fname, "-") )
! fd = open(fname,0);
! else
! fd = 0; /* use stdin */
if (fd < 0) {
perror(fname);
return(FALSE);
***************
*** 255,261 ****
eof = handleread(cno);
abSleep(4, TRUE);
}
! close(fd);
return(((eof<0) || (paperr != noErr) || (wcomp != noErr))?TRUE:FALSE);
}
--- 258,265 ----
eof = handleread(cno);
abSleep(4, TRUE);
}
! if ( fd > 0 )
! close(fd);
return(((eof<0) || (paperr != noErr) || (wcomp != noErr))?TRUE:FALSE);
}
*** man/atprint.1~ Thu May 16 13:55:08 1991
--- man/atprint.1 Wed Jun 26 13:26:54 1991
***************
*** 37,42 ****
--- 37,44 ----
.I lwpr
runs in the foreground, establishing a connection to the LaserWriter and
then sending the file.
+ .I filename
+ may be "\-" to specify standard input.
.PP
.I iwpr
functions exactly the same way as
Johan
--
Johan Vromans jv@mh.nl via internet backbones
Multihouse Automatisering bv uucp: ..!{uunet,hp4nl}!mh.nl!jv
Doesburgweg 7, 2803 PL Gouda, The Netherlands phone/fax: +31 1820 62911/62500
------------------------ "Arms are made for hugging" -------------------------
Technical Details
Message-ID:
<1991Jun26.112932.4177@pronto.mh.nl>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!spool.mu.edu!uunet!mcsun!hp4nl!mhres!squirrel!pronto!jvShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!spool.mu.edu!uunet!mcsun!hp4nl!mhres!squirrel!pronto!jv From: jv@mh.nl (Johan Vromans) Newsgroups: comp.protocols.appletalk Subject: Using lwpr as a filter Message-ID: <1991Jun26.112932.4177@pronto.mh.nl> Date: 26 Jun 91 11:29:32 GMT Article-I.D.: pronto.1991Jun26.112932.4177 Sender: jv@pronto.mh.nl (Johan Vromans) Reply-To: Johan Vromans <jv@mh.nl> Organization: Multihouse Automation, the Netherlands Lines: 101 X-Md4-Signature: d5382ecd86892068408fbd9630a92d2c