From 4c2a3991673aeecf0285ed1b3cb0992aeb1cfd73 Mon Sep 17 00:00:00 2001 From: Garance A Drosehn Date: Fri, 12 Jul 2002 01:31:46 +0000 Subject: [PATCH] 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 --- usr.sbin/lpr/common_source/common.c | 11 ++++++++++- usr.sbin/lpr/common_source/lp.h | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/usr.sbin/lpr/common_source/common.c b/usr.sbin/lpr/common_source/common.c index e382e69be9a3..c731f9bf3aea 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 e155b4d616d9..20438e38f712 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 */