xref: /freebsd/usr.sbin/lpr/lpc/cmdtab.c (revision 54032d1198c27cf2b532645c68f1adb1a19b3145)
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 
34dea673e9SRodney W. Grimes #ifndef lint
354a1a0dbeSGarrett Wollman /*
36dea673e9SRodney W. Grimes static char sccsid[] = "@(#)cmdtab.c	8.1 (Berkeley) 6/6/93";
374a1a0dbeSGarrett Wollman */
384a1a0dbeSGarrett Wollman static const char rcsid[] =
3997d92980SPeter Wemm   "$FreeBSD$";
40dea673e9SRodney W. Grimes #endif /* not lint */
41dea673e9SRodney W. Grimes 
42dea673e9SRodney W. Grimes #include <sys/cdefs.h>
43dea673e9SRodney W. Grimes 
44dea673e9SRodney W. Grimes #include "lpc.h"
45dea673e9SRodney W. Grimes #include "extern.h"
46dea673e9SRodney W. Grimes 
47dea673e9SRodney W. Grimes /*
48dea673e9SRodney W. Grimes  * lpc -- command tables
49dea673e9SRodney W. Grimes  */
50dea673e9SRodney W. Grimes char	aborthelp[] =	"terminate a spooling daemon immediately and disable printing";
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";
64dea673e9SRodney W. Grimes char	topqhelp[] =	"put job at 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 },
73004c9c5dSGarance A Drosehn 	{ "clean",	cleanhelp,	PR,	init_clean,	clean_q },
74e8e715faSGarance A Drosehn 	{ "enable",	enablehelp,	PR,	0,		enable_q },
75004c9c5dSGarance A Drosehn 	{ "exit",	quithelp,	0,	quit,		0 },
76e8e715faSGarance A Drosehn 	{ "disable",	disablehelp,	PR,	0, 		disable_q },
77004c9c5dSGarance A Drosehn 	{ "down",	downhelp,	PR,	down,		0 },
78004c9c5dSGarance A Drosehn 	{ "help",	helphelp,	0,	help,		0 },
79004c9c5dSGarance A Drosehn 	{ "quit",	quithelp,	0,	quit,		0 },
80e8e715faSGarance A Drosehn 	{ "restart",	restarthelp,	0,	0,		restart_q },
81e8e715faSGarance A Drosehn 	{ "start",	starthelp,	PR,	0,		start_q },
824a1a0dbeSGarrett Wollman 	{ "status",	statushelp,	0,	0,		status },
8354032d11SGarance A Drosehn 	{ "setstatus",	setstatushelp,	PR|M,	setstatus_gi,	setstatus_q },
84e8e715faSGarance A Drosehn 	{ "stop",	stophelp,	PR,	0,		stop_q },
85004c9c5dSGarance A Drosehn 	{ "tclean",	tcleanhelp,	0,	init_tclean,	clean_q },
86004c9c5dSGarance A Drosehn 	{ "topq",	topqhelp,	PR,	topq,		0 },
87e8e715faSGarance A Drosehn 	{ "up",		uphelp,		PR,	0,		up_q },
88004c9c5dSGarance A Drosehn 	{ "?",		helphelp,	0,	help,		0 },
89e8e715faSGarance A Drosehn 	{ "xabort",	aborthelp,	PR,	0,		doabort },
90e8e715faSGarance A Drosehn 	{ "xenable",	enablehelp,	PR,	0,		enable },
91e8e715faSGarance A Drosehn 	{ "xdisable",	disablehelp,	PR,	0, 		disable },
92e8e715faSGarance A Drosehn 	{ "xrestart",	restarthelp,	0,	0,		restart },
93e8e715faSGarance A Drosehn 	{ "xstart",	starthelp,	PR,	0,		startcmd },
94e8e715faSGarance A Drosehn 	{ "xstop",	stophelp,	PR,	0,		stop },
95e8e715faSGarance A Drosehn 	{ "xup",	uphelp,		PR,	0,		up },
96004c9c5dSGarance A Drosehn 	{ 0, 0, 0, 0, 0},
97dea673e9SRodney W. Grimes };
98dea673e9SRodney W. Grimes 
99dea673e9SRodney W. Grimes int	NCMDS = sizeof (cmdtab) / sizeof (cmdtab[0]);
100