Date: Mon, 30 Apr 2012 01:10:13 +0000 (UTC) From: Garance A Drosehn <gad@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r234826 - head/usr.sbin/lpr/lpc Message-ID: <201204300110.q3U1ADTT041141@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: gad Date: Mon Apr 30 01:10:13 2012 New Revision: 234826 URL: http://svn.freebsd.org/changeset/base/234826 Log: 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 Modified: head/usr.sbin/lpr/lpc/cmds.c Modified: head/usr.sbin/lpr/lpc/cmds.c ============================================================================== --- head/usr.sbin/lpr/lpc/cmds.c Mon Apr 30 01:08:18 2012 (r234825) +++ head/usr.sbin/lpr/lpc/cmds.c Mon Apr 30 01:10:13 2012 (r234826) @@ -1009,12 +1009,30 @@ setstatus_gi(int argc __unused, char *ar 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"); + } } /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201204300110.q3U1ADTT041141>