From 213e132f58cfb18b8eda2e64a6ed23ffc6002932 Mon Sep 17 00:00:00 2001 From: joerg Date: Wed, 15 Oct 1997 12:16:37 +0000 Subject: One could be surprised how much bugs can still be found here... Properlay clean the global RM variable if cgetstr() failed for it. Otherwise, a connection attempt to a remote machine was made (and a bogus result code printed) if a local printer followed a remote one in printcap, and you did a `lpq -a', since checkremote() falsely assumed the printer to be a remote one. While i was at it, removed a gratuituous newline printed in front of the remote machine's name, thus making the output more consistent (and better machine-parseable) now. --- usr.sbin/lpr/common_source/displayq.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/usr.sbin/lpr/common_source/displayq.c b/usr.sbin/lpr/common_source/displayq.c index 2903084..286fd82 100644 --- a/usr.sbin/lpr/common_source/displayq.c +++ b/usr.sbin/lpr/common_source/displayq.c @@ -114,7 +114,8 @@ displayq(format) ST = DEFSTAT; if (cgetnum(bp, "ct", &CT) < 0) CT = DEFTIMEOUT; - cgetstr(bp, "rm", &RM); + if (cgetstr(bp, "rm", &RM) < 0) + RM = NULL; if ((cp = checkremote())) printf("Warning: %s\n", cp); @@ -264,7 +265,7 @@ static void warn() { if (remote) - printf("\n%s: ", host); + printf("%s: ", host); puts("Warning: no daemon present"); current[0] = '\0'; } -- cgit v1.1