From owner-freebsd-bugs Mon Mar 10 15:40:19 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B6FE637B401 for ; Mon, 10 Mar 2003 15:40:15 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 551BD43F85 for ; Mon, 10 Mar 2003 15:40:15 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h2ANeFNS081223 for ; Mon, 10 Mar 2003 15:40:15 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h2ANeFxX081222; Mon, 10 Mar 2003 15:40:15 -0800 (PST) Date: Mon, 10 Mar 2003 15:40:15 -0800 (PST) Message-Id: <200303102340.h2ANeFxX081222@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: JD Subject: Re: i386/49023: Mod to LPD (printjob.c) to pass source filename to input filters Reply-To: JD Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR i386/49023; it has been noted by GNATS. From: JD To: freebsd-gnats-submit@FreeBSD.org, jimd@siu.edu Cc: Subject: Re: i386/49023: Mod to LPD (printjob.c) to pass source filename to input filters Date: Mon, 10 Mar 2003 17:46:46 -0600 This is a multi-part message in MIME format. --------------030209080506070601060700 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Slightly modifed PRINTJOB.C.DIFFS to insert new parameters in input filter list only when original filename is found in the control file. --------------030209080506070601060700 Content-Type: text/plain; name="printjob.c.diffs" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="printjob.c.diffs" *** printjob.c.orig Wed Feb 19 17:42:35 2003 --- printjob.c Mon Mar 10 17:10:09 2003 *************** *** 114,119 **** --- 114,121 ---- /* indentation size in static characters */ static char indent[10] = "-i0"; static char jobname[100]; /* job or file name */ + static char ofilename[100]; /* name of (source) file to print - 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 */ *************** *** 439,445 **** */ /* pass 1 */ - while (getline(cfp)) switch (line[0]) { case 'H': --- 441,446 ---- *************** *** 479,485 **** } else strcpy(jobname, " "); continue; - case 'C': if (line[1] != '\0') strlcpy(class, line + 1, sizeof(class)); --- 480,485 ---- *************** *** 554,560 **** title[0] = '\0'; continue; ! case 'N': case 'U': case 'M': case 'R': --- 554,560 ---- title[0] = '\0'; continue; ! case 'N': case 'U': case 'M': case 'R': *************** *** 645,650 **** --- 645,673 ---- (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 + * + */ + origfpos = ftell(cfp); /* get previous file position */ + fseek(cfp, 0L, 0); /* set file position to beginning of file */ + strcpy(ofilename, ""); /* initialize variable */ + while (getline(cfp)) + switch (line[0]){ + case 'N': + if (line[1] != '\0') { + strlcpy(ofilename, line + 1, sizeof(ofilename)); + } + 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 */ *************** *** 780,785 **** --- 803,813 ---- av[n++] = "-h"; av[n++] = origin_host; av[n++] = pp->acct_file; + /* added 20 Feb, 10 Mar 2003 - JD */ + if (strcmp(ofilename, "") != 0) { + av[n++] = "-fn"; + av[n++] = ofilename; + } /* JD */ av[n] = 0; fo = pfd; if (of_pid > 0) { /* stop output filter */ --------------030209080506070601060700-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message