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