cmdtab.c revision 216372
172132Ssemenu/* 272132Ssemenu * Copyright (c) 1983, 1993 372132Ssemenu * The Regents of the University of California. All rights reserved. 472132Ssemenu * 572132Ssemenu * Redistribution and use in source and binary forms, with or without 672132Ssemenu * modification, are permitted provided that the following conditions 772132Ssemenu * are met: 872132Ssemenu * 1. Redistributions of source code must retain the above copyright 972132Ssemenu * notice, this list of conditions and the following disclaimer. 1072132Ssemenu * 2. Redistributions in binary form must reproduce the above copyright 1172132Ssemenu * notice, this list of conditions and the following disclaimer in the 1272132Ssemenu * documentation and/or other materials provided with the distribution. 1372132Ssemenu * 4. Neither the name of the University nor the names of its contributors 1472132Ssemenu * may be used to endorse or promote products derived from this software 1572132Ssemenu * without specific prior written permission. 1672132Ssemenu * 1772132Ssemenu * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 1872132Ssemenu * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1972132Ssemenu * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2072132Ssemenu * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2172132Ssemenu * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2272132Ssemenu * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2372132Ssemenu * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2472132Ssemenu * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2572132Ssemenu * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2672132Ssemenu * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2772132Ssemenu * SUCH DAMAGE. 2872132Ssemenu */ 2972132Ssemenu 3072132Ssemenu#if 0 3172132Ssemenu#ifndef lint 3272132Ssemenustatic char sccsid[] = "@(#)cmdtab.c 8.1 (Berkeley) 6/6/93"; 3372132Ssemenu#endif /* not lint */ 3472132Ssemenu#endif 3572132Ssemenu 3672132Ssemenu#include "lp.cdefs.h" /* A cross-platform version of <sys/cdefs.h> */ 37119418Sobrien__FBSDID("$FreeBSD: head/usr.sbin/lpr/lpc/cmdtab.c 216372 2010-12-11 09:38:12Z joel $"); 3872132Ssemenu 3972132Ssemenu#include "lpc.h" 4072132Ssemenu#include "extern.h" 4172132Ssemenu 4272132Ssemenu/* 4372132Ssemenu * lpc -- command tables 4472132Ssemenu */ 4572132Ssemenuchar aborthelp[] = "terminate a spooling daemon immediately and disable printing"; 4672132Ssemenuchar botmqhelp[] = "move job(s) to the bottom of printer queue"; 4772132Ssemenuchar cleanhelp[] = "remove cruft files from a queue"; 4872132Ssemenuchar enablehelp[] = "turn a spooling queue on"; 4972132Ssemenuchar disablehelp[] = "turn a spooling queue off"; 5072132Ssemenuchar downhelp[] = "do a 'stop' followed by 'disable' and put a message in status"; 5172132Ssemenuchar helphelp[] = "get help on commands"; 5272132Ssemenuchar quithelp[] = "exit lpc"; 5372132Ssemenuchar restarthelp[] = "kill (if possible) and restart a spooling daemon"; 5472132Ssemenuchar setstatushelp[] = "set the status message of a queue, requires\n" 5572132Ssemenu "\t\t\"-msg\" before the text of the new message"; 5672132Ssemenuchar starthelp[] = "enable printing and start a spooling daemon"; 5772132Ssemenuchar statushelp[] = "show status of daemon and queue"; 5872132Ssemenuchar stophelp[] = "stop a spooling daemon after current job completes and disable printing"; 5972132Ssemenuchar tcleanhelp[] = "test to see what files a clean cmd would remove"; 6072132Ssemenuchar topqhelp[] = "move job(s) to the top of printer queue"; 6172132Ssemenuchar uphelp[] = "enable everything and restart spooling daemon"; 6272132Ssemenu 6372132Ssemenu/* Use some abbreviations so entries won't need to wrap */ 6472132Ssemenu#define PR LPC_PRIVCMD 6572132Ssemenu#define M LPC_MSGOPT 6672132Ssemenu 67129844Smariusstruct cmd cmdtab[] = { 68129844Smarius { "abort", aborthelp, PR, 0, abort_q }, 69129844Smarius { "bottomq", botmqhelp, PR, bottomq_cmd, 0 }, 7072132Ssemenu { "clean", cleanhelp, PR, clean_gi, clean_q }, 7172132Ssemenu { "enable", enablehelp, PR, 0, enable_q }, 7272132Ssemenu { "exit", quithelp, 0, quit, 0 }, 7372132Ssemenu { "disable", disablehelp, PR, 0, disable_q }, 7472132Ssemenu { "down", downhelp, PR|M, down_gi, down_q }, 7572132Ssemenu { "help", helphelp, 0, help, 0 }, 7672132Ssemenu { "quit", quithelp, 0, quit, 0 }, 7772132Ssemenu { "restart", restarthelp, 0, 0, restart_q }, 7872132Ssemenu { "start", starthelp, PR, 0, start_q }, 7972132Ssemenu { "status", statushelp, 0, 0, status }, 8072132Ssemenu { "setstatus", setstatushelp, PR|M, setstatus_gi, setstatus_q }, 8172132Ssemenu { "stop", stophelp, PR, 0, stop_q }, 8272132Ssemenu { "tclean", tcleanhelp, 0, tclean_gi, clean_q }, 8372132Ssemenu { "topq", topqhelp, PR, topq_cmd, 0 }, 8472132Ssemenu { "up", uphelp, PR, 0, up_q }, 8572132Ssemenu { "?", helphelp, 0, help, 0 }, 8672132Ssemenu { "xtopq", topqhelp, PR, topq, 0 }, 87109514Sobrien { 0, 0, 0, 0, 0}, 8872132Ssemenu}; 8972132Ssemenu 9072132Ssemenuint NCMDS = sizeof (cmdtab) / sizeof (cmdtab[0]); 9172132Ssemenu