xref: /freebsd/usr.sbin/lpr/lpc/cmdtab.c (revision c44a6dcebd2fe4f5f48d4139d922985349b090e5)
1dea673e9SRodney W. Grimes /*
2dea673e9SRodney W. Grimes  * Copyright (c) 1983, 1993
3dea673e9SRodney W. Grimes  *	The Regents of the University of California.  All rights reserved.
4dea673e9SRodney W. Grimes  *
5dea673e9SRodney W. Grimes  * Redistribution and use in source and binary forms, with or without
6dea673e9SRodney W. Grimes  * modification, are permitted provided that the following conditions
7dea673e9SRodney W. Grimes  * are met:
8dea673e9SRodney W. Grimes  * 1. Redistributions of source code must retain the above copyright
9dea673e9SRodney W. Grimes  *    notice, this list of conditions and the following disclaimer.
10dea673e9SRodney W. Grimes  * 2. Redistributions in binary form must reproduce the above copyright
11dea673e9SRodney W. Grimes  *    notice, this list of conditions and the following disclaimer in the
12dea673e9SRodney W. Grimes  *    documentation and/or other materials provided with the distribution.
13dea673e9SRodney W. Grimes  * 3. All advertising materials mentioning features or use of this software
14dea673e9SRodney W. Grimes  *    must display the following acknowledgement:
15dea673e9SRodney W. Grimes  *	This product includes software developed by the University of
16dea673e9SRodney W. Grimes  *	California, Berkeley and its contributors.
17dea673e9SRodney W. Grimes  * 4. Neither the name of the University nor the names of its contributors
18dea673e9SRodney W. Grimes  *    may be used to endorse or promote products derived from this software
19dea673e9SRodney W. Grimes  *    without specific prior written permission.
20dea673e9SRodney W. Grimes  *
21dea673e9SRodney W. Grimes  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22dea673e9SRodney W. Grimes  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23dea673e9SRodney W. Grimes  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24dea673e9SRodney W. Grimes  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25dea673e9SRodney W. Grimes  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26dea673e9SRodney W. Grimes  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27dea673e9SRodney W. Grimes  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28dea673e9SRodney W. Grimes  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29dea673e9SRodney W. Grimes  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30dea673e9SRodney W. Grimes  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31dea673e9SRodney W. Grimes  * SUCH DAMAGE.
32dea673e9SRodney W. Grimes  */
33dea673e9SRodney W. Grimes 
34c44a6dceSGarance A Drosehn #if 0
35dea673e9SRodney W. Grimes #ifndef lint
36dea673e9SRodney W. Grimes static char sccsid[] = "@(#)cmdtab.c	8.1 (Berkeley) 6/6/93";
37dea673e9SRodney W. Grimes #endif /* not lint */
38c44a6dceSGarance A Drosehn #endif
39dea673e9SRodney W. Grimes 
40c44a6dceSGarance A Drosehn #include "lp.cdefs.h"		/* A cross-platform version of <sys/cdefs.h> */
41c44a6dceSGarance A Drosehn __FBSDID("$FreeBSD$");
42dea673e9SRodney W. Grimes 
43dea673e9SRodney W. Grimes #include "lpc.h"
44dea673e9SRodney W. Grimes #include "extern.h"
45dea673e9SRodney W. Grimes 
46dea673e9SRodney W. Grimes /*
47dea673e9SRodney W. Grimes  * lpc -- command tables
48dea673e9SRodney W. Grimes  */
49dea673e9SRodney W. Grimes char	aborthelp[] =	"terminate a spooling daemon immediately and disable printing";
50dd8faa9fSGarance A Drosehn char	botmqhelp[] =	"move job(s) to the bottom of printer queue";
51dea673e9SRodney W. Grimes char	cleanhelp[] =	"remove cruft files from a queue";
52dea673e9SRodney W. Grimes char	enablehelp[] =	"turn a spooling queue on";
53dea673e9SRodney W. Grimes char	disablehelp[] =	"turn a spooling queue off";
54dea673e9SRodney W. Grimes char	downhelp[] =	"do a 'stop' followed by 'disable' and put a message in status";
55dea673e9SRodney W. Grimes char	helphelp[] =	"get help on commands";
56dea673e9SRodney W. Grimes char	quithelp[] =	"exit lpc";
57dea673e9SRodney W. Grimes char	restarthelp[] =	"kill (if possible) and restart a spooling daemon";
5854032d11SGarance A Drosehn char	setstatushelp[] = "set the status message of a queue, requires\n"
5954032d11SGarance A Drosehn 			"\t\t\"-msg\" before the text of the new message";
60dea673e9SRodney W. Grimes char	starthelp[] =	"enable printing and start a spooling daemon";
61dea673e9SRodney W. Grimes char	statushelp[] =	"show status of daemon and queue";
62dea673e9SRodney W. Grimes char	stophelp[] =	"stop a spooling daemon after current job completes and disable printing";
63004c9c5dSGarance A Drosehn char	tcleanhelp[] =	"test to see what files a clean cmd would remove";
64dd8faa9fSGarance A Drosehn char	topqhelp[] =	"move job(s) to the top of printer queue";
65dea673e9SRodney W. Grimes char	uphelp[] =	"enable everything and restart spooling daemon";
66dea673e9SRodney W. Grimes 
6754032d11SGarance A Drosehn /* Use some abbreviations so entries won't need to wrap */
6854032d11SGarance A Drosehn #define PR	LPC_PRIVCMD
6954032d11SGarance A Drosehn #define M	LPC_MSGOPT
70004c9c5dSGarance A Drosehn 
71dea673e9SRodney W. Grimes struct cmd cmdtab[] = {
72e8e715faSGarance A Drosehn 	{ "abort",	aborthelp,	PR,	0,		abort_q },
73dd8faa9fSGarance A Drosehn 	{ "bottomq",	botmqhelp,	PR,	bottomq_cmd,	0 },
74c9cb13a0SGarance A Drosehn 	{ "clean",	cleanhelp,	PR,	clean_gi,	clean_q },
75e8e715faSGarance A Drosehn 	{ "enable",	enablehelp,	PR,	0,		enable_q },
76004c9c5dSGarance A Drosehn 	{ "exit",	quithelp,	0,	quit,		0 },
77e8e715faSGarance A Drosehn 	{ "disable",	disablehelp,	PR,	0, 		disable_q },
785b1c34fbSGarance A Drosehn 	{ "down",	downhelp,	PR|M,	down_gi,	down_q },
79004c9c5dSGarance A Drosehn 	{ "help",	helphelp,	0,	help,		0 },
80004c9c5dSGarance A Drosehn 	{ "quit",	quithelp,	0,	quit,		0 },
81e8e715faSGarance A Drosehn 	{ "restart",	restarthelp,	0,	0,		restart_q },
82e8e715faSGarance A Drosehn 	{ "start",	starthelp,	PR,	0,		start_q },
834a1a0dbeSGarrett Wollman 	{ "status",	statushelp,	0,	0,		status },
8454032d11SGarance A Drosehn 	{ "setstatus",	setstatushelp,	PR|M,	setstatus_gi,	setstatus_q },
85e8e715faSGarance A Drosehn 	{ "stop",	stophelp,	PR,	0,		stop_q },
86c9cb13a0SGarance A Drosehn 	{ "tclean",	tcleanhelp,	0,	tclean_gi,	clean_q },
87dd8faa9fSGarance A Drosehn 	{ "topq",	topqhelp,	PR,	topq_cmd,	0 },
88e8e715faSGarance A Drosehn 	{ "up",		uphelp,		PR,	0,		up_q },
89004c9c5dSGarance A Drosehn 	{ "?",		helphelp,	0,	help,		0 },
90dd8faa9fSGarance A Drosehn 	{ "xtopq",	topqhelp,	PR,	topq,		0 },
91004c9c5dSGarance A Drosehn 	{ 0, 0, 0, 0, 0},
92dea673e9SRodney W. Grimes };
93dea673e9SRodney W. Grimes 
94dea673e9SRodney W. Grimes int	NCMDS = sizeof (cmdtab) / sizeof (cmdtab[0]);
95