jv@mh.nl (Johan Vromans) (06/26/91)
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" -------------------------