FreeBSD Bugzilla – Attachment 29345 Details for
Bug 49023
[patch] to lpd(8) (printjob.c) to pass source filename to input filters
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
printjob.c.diffs
printjob.c.diffs (text/plain), 4.27 KB, created by
User1001
on 2004-02-22 07:02:47 UTC
(
hide
)
Description:
printjob.c.diffs
Filename:
MIME Type:
Creator:
User1001
Created:
2004-02-22 07:02:47 UTC
Size:
4.27 KB
patch
obsolete
>*** printjob.c.orig Sat Aug 23 23:20:37 2003 >--- printjob.c Sun Feb 22 00:53:52 2004 >*************** >*** 119,124 **** >--- 119,127 ---- > /* indentation size in static characters */ > static char indent[10] = "-i0"; > static char jobname[100]; /* job or file name */ >+ static char LPD_FILENAME[100]; /* name of (source) file to print - JD*/ >+ static char LPD_FILENAME_VAR[12] = "LPD_FILENAME"; /* new env var - JD */ >+ static long origfpos = 0L; /* original cfp file position - JD */ > static char length[10] = "-l"; /* page length in lines */ > static char logname[32]; /* user's login name */ > static char pxlength[10] = "-y"; /* page length in pixels */ >*************** >*** 385,390 **** >--- 388,394 ---- > > bombed = OK; > didignorehdr = 0; >+ > /* > * open control file; ignore if no longer there. > */ >*************** >*** 444,450 **** > */ > > /* pass 1 */ >- > while (getline(cfp)) > switch (line[0]) { > case 'H': >--- 448,453 ---- >*************** >*** 650,655 **** >--- 653,683 ---- > (void) close(fi); > return (OK); > } >+ >+ /* >+ * reset pointer to config file, parse cf for filename, >+ * reset pointer again to where it was before we got here >+ * >+ * JD 06 March 2003, 30 April 2003 >+ * >+ */ >+ origfpos = ftell(cfp); /* get previous file position */ >+ fseek(cfp, 0L, 0); /* set file position to beginning of file */ >+ strlcpy(LPD_FILENAME, "undefined", sizeof(LPD_FILENAME)); /* init var */ >+ while (getline(cfp)){ >+ switch (line[0]){ >+ case 'N': >+ if (line[1] != '\0') { >+ strlcpy(LPD_FILENAME, line + 1, sizeof(LPD_FILENAME)); >+ if (strncmp(LPD_FILENAME, " ", sizeof(LPD_FILENAME)) == 0) >+ strlcpy(LPD_FILENAME, "undefined", sizeof(LPD_FILENAME)); >+ } >+ continue; >+ default: continue; >+ }} >+ fseek(cfp, origfpos, 0); /* reset file pointer */ >+ /*-------------------- JD */ >+ > switch (format) { > case 'p': /* print file using 'pr' */ > if (pp->filters[LPF_INPUT] == NULL) { /* use output filter */ >*************** >*** 785,790 **** >--- 813,827 ---- > av[n++] = "-h"; > av[n++] = origin_host; > av[n++] = pp->acct_file; >+ /* added 20 Feb 2003, 21 Apr 2003 - JD */ >+ unsetenv(LPD_FILENAME); errno = 0; >+ if (setenv(LPD_FILENAME_VAR, LPD_FILENAME, 1) != 0) { >+ if (errno == ENOMEM) >+ syslog(LOG_ERR, "Not enough memory to set LPD_FILENAME environment variable"); >+ else >+ syslog(LOG_ERR, "Unknown setenv error attempting to set LPD_FILENAME environment variable"); >+ } >+ /* JD */ > av[n] = 0; > fo = pfd; > if (of_pid > 0) { /* stop output filter */ >*************** >*** 949,954 **** >--- 986,1011 ---- > break; > dfcopies++; > } >+ /* >+ JD - 22 Feb 2004: extract spool file name and >+ assign it to environment variable for later use >+ by (local) input filter >+ */ >+ origfpos = ftell(cfp); /* get previous file position */ >+ fseek(cfp, 0L, 0); /* set file position to beginning of file */ >+ strlcpy(LPD_FILENAME, "undefined", sizeof(LPD_FILENAME)); /* initialize variable */ >+ while (getline(cfp)){ >+ switch (line[0]){ >+ case 'N': >+ if (line[1] != '\0') { >+ strlcpy(LPD_FILENAME, line + 1, sizeof(LPD_FILENAME)); >+ if (strncmp(LPD_FILENAME, " ", sizeof(LPD_FILENAME)) == 0) >+ strlcpy(LPD_FILENAME, "undefined", sizeof(LPD_FILENAME)); >+ } >+ continue; >+ default: continue; >+ }} >+ /* JD */ > switch (sendfile(pp, '\3', last+1, *last, dfcopies)) { > case OK: > if (i) >*************** >*** 1065,1070 **** >--- 1122,1136 ---- > av[++narg] = origin_host; > av[++narg] = pp->acct_file; > av[++narg] = NULL; >+ /* added 21 Feb 2004 - JD */ >+ unsetenv(LPD_FILENAME); errno = 0; >+ if (setenv(LPD_FILENAME_VAR, LPD_FILENAME, 1) != 0) { >+ if (errno == ENOMEM) >+ syslog(LOG_ERR, "Not enough memory to set LPD_FILENAME environment variable"); >+ else >+ syslog(LOG_ERR, "Unknown setenv error attempting to set LPD_FILENAME environment variable"); >+ } >+ /* JD */ > } else if (pp->filters[LPF_OUTPUT]) { > filtcmd = pp->filters[LPF_OUTPUT]; > av[0] = filtcmd;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 49023
:
29343
|
29344
| 29345