diff options
| author | Garance A Drosehn <gad@FreeBSD.org> | 2000-11-08 00:52:11 +0000 |
|---|---|---|
| committer | Garance A Drosehn <gad@FreeBSD.org> | 2000-11-08 00:52:11 +0000 |
| commit | cdd8df463b7e39a0aa56c663a981bf43ef46f778 (patch) | |
| tree | 587bd33f7ef5546df0a165ebcdd5c00b0925ebb8 | |
| parent | 542962ddf96dd881e925f5f5cadf3ecaede6ef02 (diff) | |
Notes
| -rw-r--r-- | usr.sbin/lpr/lpd/extern.h | 1 | ||||
| -rw-r--r-- | usr.sbin/lpr/lpd/printjob.c | 27 |
2 files changed, 24 insertions, 4 deletions
diff --git a/usr.sbin/lpr/lpd/extern.h b/usr.sbin/lpr/lpd/extern.h index 70c536dbc9c9..d4b4966433b4 100644 --- a/usr.sbin/lpr/lpd/extern.h +++ b/usr.sbin/lpr/lpd/extern.h @@ -38,6 +38,7 @@ extern char scnkey[][HEIGHT]; /* in lpdchar.c */ extern char fromb[]; +extern int lflag; /* in lpd.c */ struct printer; struct termios; diff --git a/usr.sbin/lpr/lpd/printjob.c b/usr.sbin/lpr/lpd/printjob.c index 23f2dbb326bf..51e1b6d9c127 100644 --- a/usr.sbin/lpr/lpd/printjob.c +++ b/usr.sbin/lpr/lpd/printjob.c @@ -339,8 +339,9 @@ printit(pp, file) char *file; { register int i; - char *cp; - int bombed = OK; + char *cp; + int bombed = OK; + int didignorehdr = 0; /* * open control file; ignore if no longer there. @@ -489,7 +490,22 @@ printit(pp, file) continue; default: /* some file to print */ - switch (i = print(pp, line[0], line+1)) { + /* only lowercase cmd-codes include a file-to-print */ + if ((line[0] < 'a') || (line[0] > 'z')) { + /* ignore any other lines */ + if (lflag <= 1) + continue; + if (!didignorehdr) { + syslog(LOG_INFO, "%s: in %s :", + pp->printer, file); + didignorehdr = 1; + } + syslog(LOG_INFO, "%s: ignoring line: '%c' %s", + pp->printer, line[0], &line[1]); + continue; + } + i = print(pp, line[0], line+1); + switch (i) { case ERROR: if (bombed == OK) bombed = FATALERR; @@ -566,8 +582,11 @@ print(pp, format, file) union wait status; struct stat stb; - if (lstat(file, &stb) < 0 || (fi = open(file, O_RDONLY)) < 0) + if (lstat(file, &stb) < 0 || (fi = open(file, O_RDONLY)) < 0) { + syslog(LOG_INFO, "%s: unable to open %s ('%c' line)", + pp->printer, file, format); return(ERROR); + } /* * Check to see if data file is a symbolic link. If so, it should * still point to the same file or someone is trying to print |
