summaryrefslogtreecommitdiffstats
path: root/usr.sbin/lpr/common_source/displayq.c
diff options
context:
space:
mode:
authorjoerg <joerg@FreeBSD.org>1996-05-05 14:04:33 +0000
committerjoerg <joerg@FreeBSD.org>1996-05-05 14:04:33 +0000
commit0291e848bc787305335af649ac14bc8fe5a19a49 (patch)
treef679484620675241701b875cbab6124b83dc1136 /usr.sbin/lpr/common_source/displayq.c
parent825cd02612729df0559ca26d13d946c625215900 (diff)
downloadFreeBSD-src-0291e848bc787305335af649ac14bc8fe5a19a49.zip
FreeBSD-src-0291e848bc787305335af649ac14bc8fe5a19a49.tar.gz
Vendor-branch import of the 4.4BSD-Lite2 code for lpr. There are
several bugfixes in it that are worth considering. Don't be alarmed about the import conflicts... Obtained from: 4.4BSD-Lite2
Diffstat (limited to 'usr.sbin/lpr/common_source/displayq.c')
-rw-r--r--usr.sbin/lpr/common_source/displayq.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/usr.sbin/lpr/common_source/displayq.c b/usr.sbin/lpr/common_source/displayq.c
index 59d3cc9..34ca840 100644
--- a/usr.sbin/lpr/common_source/displayq.c
+++ b/usr.sbin/lpr/common_source/displayq.c
@@ -32,11 +32,12 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)displayq.c 8.1 (Berkeley) 6/6/93";
+static char sccsid[] = "@(#)displayq.c 8.4 (Berkeley) 4/28/95";
#endif /* not lint */
#include <sys/param.h>
#include <sys/stat.h>
+#include <sys/file.h>
#include <signal.h>
#include <fcntl.h>
@@ -124,7 +125,7 @@ displayq(format)
fatal("cannot examine spooling area\n");
if (stat(LO, &statb) >= 0) {
if (statb.st_mode & 0100) {
- if (sendtorem)
+ if (remote)
printf("%s: ", host);
printf("Warning: %s is down: ", printer);
fd = open(ST, O_RDONLY);
@@ -137,7 +138,7 @@ displayq(format)
putchar('\n');
}
if (statb.st_mode & 010) {
- if (sendtorem)
+ if (remote)
printf("%s: ", host);
printf("Warning: %s queue is turned off\n", printer);
}
@@ -150,8 +151,8 @@ displayq(format)
else {
/* get daemon pid */
cp = current;
- while ((*cp = getc(fp)) != EOF && *cp != '\n')
- cp++;
+ while ((i = getc(fp)) != EOF && i != '\n')
+ *cp++ = i;
*cp = '\0';
i = atoi(current);
if (i <= 0 || kill(i, 0) < 0)
@@ -159,13 +160,13 @@ displayq(format)
else {
/* read current file name */
cp = current;
- while ((*cp = getc(fp)) != EOF && *cp != '\n')
- cp++;
+ while ((i = getc(fp)) != EOF && i != '\n')
+ *cp++ = i;
*cp = '\0';
/*
* Print the status file.
*/
- if (sendtorem)
+ if (remote)
printf("%s: ", host);
fd = open(ST, O_RDONLY);
if (fd >= 0) {
@@ -191,7 +192,7 @@ displayq(format)
}
free(queue);
}
- if (!sendtorem) {
+ if (!remote) {
if (nitems == 0)
puts("no entries");
return;
@@ -215,7 +216,7 @@ displayq(format)
(void) strcpy(cp, user[i]);
}
strcat(line, "\n");
- fd = getport(RM);
+ fd = getport(RM, 0);
if (fd < 0) {
if (from != host)
printf("%s: ", host);
@@ -237,7 +238,7 @@ displayq(format)
void
warn()
{
- if (sendtorem)
+ if (remote)
printf("\n%s: ", host);
puts("Warning: no daemon present");
current[0] = '\0';
@@ -271,7 +272,7 @@ inform(cf)
if (rank < 0)
rank = 0;
- if (sendtorem || garbage || strcmp(cf, current))
+ if (remote || garbage || strcmp(cf, current))
rank++;
j = 0;
while (getline(cfp)) {
@@ -416,7 +417,7 @@ ldump(nfile, file, copies)
else
printf("%-32s", nfile);
if (*file && !stat(file, &lbuf))
- printf(" %qd bytes", lbuf.st_size);
+ printf(" %ld bytes", (long)lbuf.st_size);
else
printf(" ??? bytes");
putchar('\n');
OpenPOWER on IntegriCloud