Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Mar 2003 15:40:15 -0800 (PST)
From:      JD <jimd@siu.edu>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: i386/49023: Mod to LPD (printjob.c) to pass source filename to input filters
Message-ID:  <200303102340.h2ANeFxX081222@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR i386/49023; it has been noted by GNATS.

From: JD <jimd@siu.edu>
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200303102340.h2ANeFxX081222>