cmdtab.c revision 256281
197403Sobrien/* 297403Sobrien * Copyright (c) 1983, 1993 397403Sobrien * The Regents of the University of California. All rights reserved. 497403Sobrien * 597403Sobrien * Redistribution and use in source and binary forms, with or without 697403Sobrien * modification, are permitted provided that the following conditions 797403Sobrien * are met: 897403Sobrien * 1. Redistributions of source code must retain the above copyright 997403Sobrien * notice, this list of conditions and the following disclaimer. 1097403Sobrien * 2. Redistributions in binary form must reproduce the above copyright 1197403Sobrien * notice, this list of conditions and the following disclaimer in the 1297403Sobrien * documentation and/or other materials provided with the distribution. 1397403Sobrien * 4. Neither the name of the University nor the names of its contributors 1497403Sobrien * may be used to endorse or promote products derived from this software 1597403Sobrien * without specific prior written permission. 1697403Sobrien * 1797403Sobrien * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 1897403Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1997403Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2097403Sobrien * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2197403Sobrien * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2297403Sobrien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2397403Sobrien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2497403Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2597403Sobrien * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2697403Sobrien * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2797403Sobrien * SUCH DAMAGE. 2897403Sobrien */ 2997403Sobrien 3097403Sobrien#if 0 3197403Sobrien#ifndef lint 3297403Sobrienstatic char sccsid[] = "@(#)cmdtab.c 8.1 (Berkeley) 6/6/93"; 3397403Sobrien#endif /* not lint */ 3497403Sobrien#endif 3597403Sobrien 3697403Sobrien#include "lp.cdefs.h" /* A cross-platform version of <sys/cdefs.h> */ 3797403Sobrien__FBSDID("$FreeBSD: stable/10/usr.sbin/lpr/lpc/cmdtab.c 216372 2010-12-11 09:38:12Z joel $"); 3897403Sobrien 3997403Sobrien#include "lpc.h" 4097403Sobrien#include "extern.h" 4197403Sobrien 4297403Sobrien/* 4397403Sobrien * lpc -- command tables 4497403Sobrien */ 4597403Sobrienchar aborthelp[] = "terminate a spooling daemon immediately and disable printing"; 4697403Sobrienchar botmqhelp[] = "move job(s) to the bottom of printer queue"; 4797403Sobrienchar cleanhelp[] = "remove cruft files from a queue"; 4897403Sobrienchar enablehelp[] = "turn a spooling queue on"; 4997403Sobrienchar disablehelp[] = "turn a spooling queue off"; 5097403Sobrienchar downhelp[] = "do a 'stop' followed by 'disable' and put a message in status"; 5197403Sobrienchar helphelp[] = "get help on commands"; 5297403Sobrienchar quithelp[] = "exit lpc"; 5397403Sobrienchar restarthelp[] = "kill (if possible) and restart a spooling daemon"; 5497403Sobrienchar setstatushelp[] = "set the status message of a queue, requires\n" 5597403Sobrien "\t\t\"-msg\" before the text of the new message"; 5697403Sobrienchar starthelp[] = "enable printing and start a spooling daemon"; 5797403Sobrienchar statushelp[] = "show status of daemon and queue"; 5897403Sobrienchar stophelp[] = "stop a spooling daemon after current job completes and disable printing"; 5997403Sobrienchar tcleanhelp[] = "test to see what files a clean cmd would remove"; 6097403Sobrienchar topqhelp[] = "move job(s) to the top of printer queue"; 6197403Sobrienchar uphelp[] = "enable everything and restart spooling daemon"; 6297403Sobrien 6397403Sobrien/* Use some abbreviations so entries won't need to wrap */ 6497403Sobrien#define PR LPC_PRIVCMD 6597403Sobrien#define M LPC_MSGOPT 6697403Sobrien 6797403Sobrienstruct cmd cmdtab[] = { 6897403Sobrien { "abort", aborthelp, PR, 0, abort_q }, 6997403Sobrien { "bottomq", botmqhelp, PR, bottomq_cmd, 0 }, 7097403Sobrien { "clean", cleanhelp, PR, clean_gi, clean_q }, 7197403Sobrien { "enable", enablehelp, PR, 0, enable_q }, 7297403Sobrien { "exit", quithelp, 0, quit, 0 }, 7397403Sobrien { "disable", disablehelp, PR, 0, disable_q }, 7497403Sobrien { "down", downhelp, PR|M, down_gi, down_q }, 7597403Sobrien { "help", helphelp, 0, help, 0 }, 7697403Sobrien { "quit", quithelp, 0, quit, 0 }, 7797403Sobrien { "restart", restarthelp, 0, 0, restart_q }, 7897403Sobrien { "start", starthelp, PR, 0, start_q }, 7997403Sobrien { "status", statushelp, 0, 0, status }, 8097403Sobrien { "setstatus", setstatushelp, PR|M, setstatus_gi, setstatus_q }, 8197403Sobrien { "stop", stophelp, PR, 0, stop_q }, 8297403Sobrien { "tclean", tcleanhelp, 0, tclean_gi, clean_q }, 8397403Sobrien { "topq", topqhelp, PR, topq_cmd, 0 }, 8497403Sobrien { "up", uphelp, PR, 0, up_q }, 8597403Sobrien { "?", helphelp, 0, help, 0 }, 8697403Sobrien { "xtopq", topqhelp, PR, topq, 0 }, 8797403Sobrien { 0, 0, 0, 0, 0}, 8897403Sobrien}; 8997403Sobrien 9097403Sobrienint NCMDS = sizeof (cmdtab) / sizeof (cmdtab[0]); 9197403Sobrien