summaryrefslogtreecommitdiffstats
path: root/usr.sbin/lpr
diff options
context:
space:
mode:
authorgad <gad@FreeBSD.org>2002-07-12 01:31:46 +0000
committergad <gad@FreeBSD.org>2002-07-12 01:31:46 +0000
commit793db011bb8b6296e52c98325185a73064ac25e3 (patch)
tree6be998860c1973f2a10080d33a05f1bd0e85ecac /usr.sbin/lpr
parent760cdded06d9b716bbb8b99efb1b1893553b479d (diff)
downloadFreeBSD-src-793db011bb8b6296e52c98325185a73064ac25e3.zip
FreeBSD-src-793db011bb8b6296e52c98325185a73064ac25e3.tar.gz
Add a SQS_QCHANGED option to set_qstate(). This will soon be used by 'lpc'.
Reviewed by: freebsd-print@bostonradio.org MFC after: 3 days
Diffstat (limited to 'usr.sbin/lpr')
-rw-r--r--usr.sbin/lpr/common_source/common.c11
-rw-r--r--usr.sbin/lpr/common_source/lp.h1
2 files changed, 11 insertions, 1 deletions
diff --git a/usr.sbin/lpr/common_source/common.c b/usr.sbin/lpr/common_source/common.c
index e382e69..c731f9b 100644
--- a/usr.sbin/lpr/common_source/common.c
+++ b/usr.sbin/lpr/common_source/common.c
@@ -275,6 +275,7 @@ set_qstate(int action, const char *lfname)
struct stat stbuf;
mode_t chgbits, newbits, oldmask;
const char *failmsg, *okmsg;
+ static const char *nomsg = "no state msg";
int chres, errsav, fd, res, statres;
/*
@@ -298,6 +299,13 @@ set_qstate(int action, const char *lfname)
newbits = LOCK_FILE_MODE;
okmsg = NULL;
failmsg = NULL;
+ if (action & SQS_QCHANGED) {
+ chgbits |= LFM_RESET_QUE;
+ newbits |= LFM_RESET_QUE;
+ /* The okmsg is not actually printed for this case. */
+ okmsg = nomsg;
+ failmsg = "set queue-changed";
+ }
if (action & SQS_DISABLEQ) {
chgbits |= LFM_QUEUE_DIS;
newbits |= LFM_QUEUE_DIS;
@@ -374,7 +382,8 @@ set_qstate(int action, const char *lfname)
case SQS_CHGOK:
case SQS_CREOK:
case SQS_SKIPCREOK:
- printf("\t%s\n", okmsg);
+ if (okmsg != nomsg)
+ printf("\t%s\n", okmsg);
break;
case SQS_CREFAIL:
printf("\tcannot create lock file: %s\n",
diff --git a/usr.sbin/lpr/common_source/lp.h b/usr.sbin/lpr/common_source/lp.h
index e155b4d..20438e3 100644
--- a/usr.sbin/lpr/common_source/lp.h
+++ b/usr.sbin/lpr/common_source/lp.h
@@ -233,6 +233,7 @@ typedef enum { TR_SENDING, TR_RECVING, TR_PRINTING } tr_sendrecv;
#define SQS_STOPP 0x02 /* Stop the printing of jobs */
#define SQS_ENABLEQ 0x10 /* Enable the queuing of new jobs */
#define SQS_STARTP 0x20 /* Start the printing of jobs */
+#define SQS_QCHANGED 0x80 /* The queue has changed (new jobs, etc) */
#define SQS_PARMERR -9 /* Invalid parameters from caller */
#define SQS_CREFAIL -3 /* File did not exist, and create failed */
OpenPOWER on IntegriCloud