xref: /netbsd-src/usr.sbin/lpr/lpc/cmdtab.c (revision f6a7372b6097fd95fc056644419fa0f0bda53900)
1*f6a7372bSchristos /*	$NetBSD: cmdtab.c,v 1.8 2006/10/22 21:09:47 christos Exp $	*/
2fe7ed7ceSmrg 
361f28255Scgd /*
4f881d1d4Scgd  * Copyright (c) 1983, 1993
5f881d1d4Scgd  *	The Regents of the University of California.  All rights reserved.
661f28255Scgd  *
761f28255Scgd  * Redistribution and use in source and binary forms, with or without
861f28255Scgd  * modification, are permitted provided that the following conditions
961f28255Scgd  * are met:
1061f28255Scgd  * 1. Redistributions of source code must retain the above copyright
1161f28255Scgd  *    notice, this list of conditions and the following disclaimer.
1261f28255Scgd  * 2. Redistributions in binary form must reproduce the above copyright
1361f28255Scgd  *    notice, this list of conditions and the following disclaimer in the
1461f28255Scgd  *    documentation and/or other materials provided with the distribution.
15326b2259Sagc  * 3. Neither the name of the University nor the names of its contributors
1661f28255Scgd  *    may be used to endorse or promote products derived from this software
1761f28255Scgd  *    without specific prior written permission.
1861f28255Scgd  *
1961f28255Scgd  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2061f28255Scgd  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2161f28255Scgd  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2261f28255Scgd  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2361f28255Scgd  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2461f28255Scgd  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2561f28255Scgd  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2661f28255Scgd  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2761f28255Scgd  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2861f28255Scgd  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2961f28255Scgd  * SUCH DAMAGE.
3061f28255Scgd  */
3161f28255Scgd 
32fe7ed7ceSmrg #include <sys/cdefs.h>
3361f28255Scgd #ifndef lint
34fe7ed7ceSmrg #if 0
35f881d1d4Scgd static char sccsid[] = "@(#)cmdtab.c	8.1 (Berkeley) 6/6/93";
36fe7ed7ceSmrg #else
37*f6a7372bSchristos __RCSID("$NetBSD: cmdtab.c,v 1.8 2006/10/22 21:09:47 christos Exp $");
38fe7ed7ceSmrg #endif
3961f28255Scgd #endif /* not lint */
4061f28255Scgd 
41*f6a7372bSchristos #include <stdio.h>
42f881d1d4Scgd 
43f881d1d4Scgd #include "lpc.h"
44f881d1d4Scgd #include "extern.h"
45f881d1d4Scgd 
4661f28255Scgd /*
4761f28255Scgd  * lpc -- command tables
4861f28255Scgd  */
4904723c3fSchristos #define aborthelp	"terminate a spooling daemon immediately and disable printing"
5004723c3fSchristos #define cleanhelp	"remove cruft files from a queue"
5104723c3fSchristos #define enablehelp	"turn a spooling queue on"
5204723c3fSchristos #define disablehelp	"turn a spooling queue off"
5304723c3fSchristos #define downhelp	"do a 'stop' followed by 'disable' and put a message in status"
5404723c3fSchristos #define helphelp	"get help on commands"
5504723c3fSchristos #define quithelp	"exit lpc"
5604723c3fSchristos #define restarthelp	"kill (if possible) and restart a spooling daemon"
5704723c3fSchristos #define starthelp	"enable printing and start a spooling daemon"
5804723c3fSchristos #define statushelp	"show status of daemon and queue"
5904723c3fSchristos #define stophelp	"stop a spooling daemon after current job completes and disable printing"
6004723c3fSchristos #define topqhelp	"put job at top of printer queue"
6104723c3fSchristos #define uphelp		"enable everything and restart spooling daemon"
6261f28255Scgd 
6361f28255Scgd struct cmd cmdtab[] = {
64f881d1d4Scgd 	{ "abort",	aborthelp,	doabort,	1 },
6561f28255Scgd 	{ "clean",	cleanhelp,	clean,		1 },
6661f28255Scgd 	{ "enable",	enablehelp,	enable,		1 },
6761f28255Scgd 	{ "exit",	quithelp,	quit,		0 },
6861f28255Scgd 	{ "disable",	disablehelp,	disable,	1 },
6961f28255Scgd 	{ "down",	downhelp,	down,		1 },
7061f28255Scgd 	{ "help",	helphelp,	help,		0 },
7161f28255Scgd 	{ "quit",	quithelp,	quit,		0 },
7261f28255Scgd 	{ "restart",	restarthelp,	restart,	0 },
73f881d1d4Scgd 	{ "start",	starthelp,	startcmd,	1 },
7461f28255Scgd 	{ "status",	statushelp,	status,		0 },
7561f28255Scgd 	{ "stop",	stophelp,	stop,		1 },
7661f28255Scgd 	{ "topq",	topqhelp,	topq,		1 },
7761f28255Scgd 	{ "up",		uphelp,		up,		1 },
7861f28255Scgd 	{ "?",		helphelp,	help,		0 },
79*f6a7372bSchristos 	{ .c_name = NULL },
8061f28255Scgd };
8161f28255Scgd 
8261f28255Scgd int	NCMDS = sizeof (cmdtab) / sizeof (cmdtab[0]);
83