cmdtab.c revision 1553
11553Srgrimes/*
21553Srgrimes * Copyright (c) 1983, 1993
31553Srgrimes *	The Regents of the University of California.  All rights reserved.
41553Srgrimes *
51553Srgrimes * Redistribution and use in source and binary forms, with or without
61553Srgrimes * modification, are permitted provided that the following conditions
71553Srgrimes * are met:
81553Srgrimes * 1. Redistributions of source code must retain the above copyright
91553Srgrimes *    notice, this list of conditions and the following disclaimer.
101553Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
111553Srgrimes *    notice, this list of conditions and the following disclaimer in the
121553Srgrimes *    documentation and/or other materials provided with the distribution.
131553Srgrimes * 3. All advertising materials mentioning features or use of this software
141553Srgrimes *    must display the following acknowledgement:
151553Srgrimes *	This product includes software developed by the University of
161553Srgrimes *	California, Berkeley and its contributors.
171553Srgrimes * 4. Neither the name of the University nor the names of its contributors
181553Srgrimes *    may be used to endorse or promote products derived from this software
191553Srgrimes *    without specific prior written permission.
201553Srgrimes *
211553Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
221553Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
231553Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
241553Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
251553Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
261553Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
271553Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
281553Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
291553Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
301553Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
311553Srgrimes * SUCH DAMAGE.
321553Srgrimes */
331553Srgrimes
341553Srgrimes#ifndef lint
351553Srgrimesstatic char sccsid[] = "@(#)cmdtab.c	8.1 (Berkeley) 6/6/93";
361553Srgrimes#endif /* not lint */
371553Srgrimes
381553Srgrimes#include <sys/cdefs.h>
391553Srgrimes
401553Srgrimes#include "lpc.h"
411553Srgrimes#include "extern.h"
421553Srgrimes
431553Srgrimes/*
441553Srgrimes * lpc -- command tables
451553Srgrimes */
461553Srgrimeschar	aborthelp[] =	"terminate a spooling daemon immediately and disable printing";
471553Srgrimeschar	cleanhelp[] =	"remove cruft files from a queue";
481553Srgrimeschar	enablehelp[] =	"turn a spooling queue on";
491553Srgrimeschar	disablehelp[] =	"turn a spooling queue off";
501553Srgrimeschar	downhelp[] =	"do a 'stop' followed by 'disable' and put a message in status";
511553Srgrimeschar	helphelp[] =	"get help on commands";
521553Srgrimeschar	quithelp[] =	"exit lpc";
531553Srgrimeschar	restarthelp[] =	"kill (if possible) and restart a spooling daemon";
541553Srgrimeschar	starthelp[] =	"enable printing and start a spooling daemon";
551553Srgrimeschar	statushelp[] =	"show status of daemon and queue";
561553Srgrimeschar	stophelp[] =	"stop a spooling daemon after current job completes and disable printing";
571553Srgrimeschar	topqhelp[] =	"put job at top of printer queue";
581553Srgrimeschar	uphelp[] =	"enable everything and restart spooling daemon";
591553Srgrimes
601553Srgrimesstruct cmd cmdtab[] = {
611553Srgrimes	{ "abort",	aborthelp,	doabort,	1 },
621553Srgrimes	{ "clean",	cleanhelp,	clean,		1 },
631553Srgrimes	{ "enable",	enablehelp,	enable,		1 },
641553Srgrimes	{ "exit",	quithelp,	quit,		0 },
651553Srgrimes	{ "disable",	disablehelp,	disable,	1 },
661553Srgrimes	{ "down",	downhelp,	down,		1 },
671553Srgrimes	{ "help",	helphelp,	help,		0 },
681553Srgrimes	{ "quit",	quithelp,	quit,		0 },
691553Srgrimes	{ "restart",	restarthelp,	restart,	0 },
701553Srgrimes	{ "start",	starthelp,	startcmd,	1 },
711553Srgrimes	{ "status",	statushelp,	status,		0 },
721553Srgrimes	{ "stop",	stophelp,	stop,		1 },
731553Srgrimes	{ "topq",	topqhelp,	topq,		1 },
741553Srgrimes	{ "up",		uphelp,		up,		1 },
751553Srgrimes	{ "?",		helphelp,	help,		0 },
761553Srgrimes	{ 0 },
771553Srgrimes};
781553Srgrimes
791553Srgrimesint	NCMDS = sizeof (cmdtab) / sizeof (cmdtab[0]);
80