summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorgad <gad@FreeBSD.org>2012-04-30 01:10:13 +0000
committergad <gad@FreeBSD.org>2012-04-30 01:10:13 +0000
commitf897dd9a4be8dd80e43185edf0240b1566bd6e8d (patch)
tree3aee64d7d95941a3ebc5149efda06c5ffd077995 /usr.sbin
parentc518692b2d5df8a7142f20783c37cea469c0b20b (diff)
downloadFreeBSD-src-f897dd9a4be8dd80e43185edf0240b1566bd6e8d.zip
FreeBSD-src-f897dd9a4be8dd80e43185edf0240b1566bd6e8d.tar.gz
Print out a warning message if a `lpc setstatus' is done when
the queue is not 'lpc stop'-ed. In that situation `lpq' will not display the status message to the user, and the operator may think the queue is already stopped when it is not. MFC after: 3 weeks
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/lpr/lpc/cmds.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/usr.sbin/lpr/lpc/cmds.c b/usr.sbin/lpr/lpc/cmds.c
index e9cd994..44516d8 100644
--- a/usr.sbin/lpr/lpc/cmds.c
+++ b/usr.sbin/lpr/lpc/cmds.c
@@ -1009,12 +1009,30 @@ setstatus_gi(int argc __unused, char *argv[] __unused)
void
setstatus_q(struct printer *pp)
{
+ struct stat stbuf;
+ int not_shown;
char lf[MAXPATHLEN];
lock_file_name(pp, lf, sizeof lf);
printf("%s:\n", pp->printer);
upstat(pp, generic_msg, 1);
+
+ /*
+ * Warn the user if 'lpq' will not display this new status-message.
+ * Note that if lock file does not exist, then the queue is enabled
+ * for both queuing and printing.
+ */
+ not_shown = 1;
+ if (stat(lf, &stbuf) >= 0) {
+ if (stbuf.st_mode & LFM_PRINT_DIS)
+ not_shown = 0;
+ }
+ if (not_shown) {
+ printf("\tnote: This queue currently has printing enabled,\n");
+ printf("\t so this -msg will only be shown by 'lpq' if\n");
+ printf("\t a job is actively printing on it.\n");
+ }
}
/*
OpenPOWER on IntegriCloud