Path: utzoo!utgpu!watmath!clyde!att!rutgers!tut.cis.ohio-state.edu!bgsuvax!kutz
From: kutz@bgsuvax.UUCP (Kenneth J. Kutz)
Newsgroups: comp.bugs.4bsd
Subject: lpq fix (displayq.c)
Keywords: lpq bug fix printer queues
Message-ID: <3227@bgsuvax.UUCP>
Date: 8 Dec 88 22:09:26 GMT
Organization: Bowling Green State University B.G., Oh.
Lines: 47



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  
		     ...!osu-cis!bgsuvax!kutz
--------------------------------------------------------------------