xref: /freebsd/usr.sbin/lpr/lpc/cmdtab.c (revision 8a16b7a18f5d0b031f09832fd7752fba717e2a97)
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 #if 0
33dea673e9SRodney W. Grimes #ifndef lint
34dea673e9SRodney W. Grimes static char sccsid[] = "@(#)cmdtab.c	8.1 (Berkeley) 6/6/93";
35dea673e9SRodney W. Grimes #endif /* not lint */
36c44a6dceSGarance A Drosehn #endif
37dea673e9SRodney W. Grimes 
38c44a6dceSGarance A Drosehn #include "lp.cdefs.h"		/* A cross-platform version of <sys/cdefs.h> */
39c44a6dceSGarance A Drosehn __FBSDID("$FreeBSD$");
40dea673e9SRodney W. Grimes 
41dea673e9SRodney W. Grimes #include "lpc.h"
42dea673e9SRodney W. Grimes #include "extern.h"
43dea673e9SRodney W. Grimes 
44dea673e9SRodney W. Grimes /*
45dea673e9SRodney W. Grimes  * lpc -- command tables
46dea673e9SRodney W. Grimes  */
47dea673e9SRodney W. Grimes char	aborthelp[] =	"terminate a spooling daemon immediately and disable printing";
48dd8faa9fSGarance A Drosehn char	botmqhelp[] =	"move job(s) to the bottom of printer queue";
49dea673e9SRodney W. Grimes char	cleanhelp[] =	"remove cruft files from a queue";
50dea673e9SRodney W. Grimes char	enablehelp[] =	"turn a spooling queue on";
51dea673e9SRodney W. Grimes char	disablehelp[] =	"turn a spooling queue off";
52dea673e9SRodney W. Grimes char	downhelp[] =	"do a 'stop' followed by 'disable' and put a message in status";
53dea673e9SRodney W. Grimes char	helphelp[] =	"get help on commands";
54dea673e9SRodney W. Grimes char	quithelp[] =	"exit lpc";
55dea673e9SRodney W. Grimes char	restarthelp[] =	"kill (if possible) and restart a spooling daemon";
5654032d11SGarance A Drosehn char	setstatushelp[] = "set the status message of a queue, requires\n"
5754032d11SGarance A Drosehn 			"\t\t\"-msg\" before the text of the new message";
58dea673e9SRodney W. Grimes char	starthelp[] =	"enable printing and start a spooling daemon";
59dea673e9SRodney W. Grimes char	statushelp[] =	"show status of daemon and queue";
60dea673e9SRodney W. Grimes char	stophelp[] =	"stop a spooling daemon after current job completes and disable printing";
61004c9c5dSGarance A Drosehn char	tcleanhelp[] =	"test to see what files a clean cmd would remove";
62dd8faa9fSGarance A Drosehn char	topqhelp[] =	"move job(s) to the top of printer queue";
63dea673e9SRodney W. Grimes char	uphelp[] =	"enable everything and restart spooling daemon";
64dea673e9SRodney W. Grimes 
6554032d11SGarance A Drosehn /* Use some abbreviations so entries won't need to wrap */
6654032d11SGarance A Drosehn #define PR	LPC_PRIVCMD
6754032d11SGarance A Drosehn #define M	LPC_MSGOPT
68004c9c5dSGarance A Drosehn 
69dea673e9SRodney W. Grimes struct cmd cmdtab[] = {
70e8e715faSGarance A Drosehn 	{ "abort",	aborthelp,	PR,	0,		abort_q },
71dd8faa9fSGarance A Drosehn 	{ "bottomq",	botmqhelp,	PR,	bottomq_cmd,	0 },
72c9cb13a0SGarance A Drosehn 	{ "clean",	cleanhelp,	PR,	clean_gi,	clean_q },
73e8e715faSGarance A Drosehn 	{ "enable",	enablehelp,	PR,	0,		enable_q },
74004c9c5dSGarance A Drosehn 	{ "exit",	quithelp,	0,	quit,		0 },
75e8e715faSGarance A Drosehn 	{ "disable",	disablehelp,	PR,	0, 		disable_q },
765b1c34fbSGarance A Drosehn 	{ "down",	downhelp,	PR|M,	down_gi,	down_q },
77004c9c5dSGarance A Drosehn 	{ "help",	helphelp,	0,	help,		0 },
78004c9c5dSGarance A Drosehn 	{ "quit",	quithelp,	0,	quit,		0 },
79e8e715faSGarance A Drosehn 	{ "restart",	restarthelp,	0,	0,		restart_q },
80e8e715faSGarance A Drosehn 	{ "start",	starthelp,	PR,	0,		start_q },
814a1a0dbeSGarrett Wollman 	{ "status",	statushelp,	0,	0,		status },
8254032d11SGarance A Drosehn 	{ "setstatus",	setstatushelp,	PR|M,	setstatus_gi,	setstatus_q },
83e8e715faSGarance A Drosehn 	{ "stop",	stophelp,	PR,	0,		stop_q },
84c9cb13a0SGarance A Drosehn 	{ "tclean",	tcleanhelp,	0,	tclean_gi,	clean_q },
85dd8faa9fSGarance A Drosehn 	{ "topq",	topqhelp,	PR,	topq_cmd,	0 },
86e8e715faSGarance A Drosehn 	{ "up",		uphelp,		PR,	0,		up_q },
87004c9c5dSGarance A Drosehn 	{ "?",		helphelp,	0,	help,		0 },
88dd8faa9fSGarance A Drosehn 	{ "xtopq",	topqhelp,	PR,	topq,		0 },
89004c9c5dSGarance A Drosehn 	{ 0, 0, 0, 0, 0},
90dea673e9SRodney W. Grimes };
91dea673e9SRodney W. Grimes 
92dea673e9SRodney W. Grimes int	NCMDS = sizeof (cmdtab) / sizeof (cmdtab[0]);
93