[comp.bugs.4bsd] lpq fix

kutz@bgsuvax.UUCP (Kenneth J. Kutz) (12/09/88)

Description:
            'lpq' displays conflicting messages if the print daemon is
            down.
Repeat By:
             1. /etc/lpc stop queue_name (stop a print queue)
             2. lpq -Pqueue_name (display the newly stopped queue)
Systems:
            4.3 BSD, Mt. Xinu BSD 4.3 + Sun NFS (edu)

Version:
            /usr/src/usr.lib/lpr/displayq.c
	              displayq.c	5.1 (Berkeley) 6/6/85
            or earlier.
Fix:

*** displayq.c.old	Thu Dec  8 15:32:50 1988
--- displayq.c	Thu Dec  8 16:59:59 1988
***************
*** 157,164 ****
  			if (fd >= 0) {
  				(void) flock(fd, LOCK_SH);
  				while ((i = read(fd, line, sizeof(line))) > 0)
  					(void) fwrite(line, 1, i, stdout);
! 				(void) close(fd);	/* unlocks as well */
  			} else
  				putchar('\n');
  		}
--- 157,167 ----
  			if (fd >= 0) {
  				(void) flock(fd, LOCK_SH);
  				while ((i = read(fd, line, sizeof(line))) > 0)
+                                      if (strncmp(line, strcat(printer," is ready and printing"), 24) != 0)
  					(void) fwrite(line, 1, i, stdout);
! 				     else
! 					putchar('\n');
! 			       	(void) close(fd);	/* unlocks as well */
  			} else
  				putchar('\n');
  		}

-- 
--------------------------------------------------------------------
            Kenneth J. Kutz      kutz@andy.bgsu.edu  <OR>
		     ...!osu-cis!bgsuvax!kutz
--------------------------------------------------------------------