📄 lprm.c
字号:
#ifndef lintstatic char *sccsid = "@(#)lprm.c 4.1 ULTRIX 7/2/90";#endif/************************************************************************ * * * Copyright (c) 1988 by * * Digital Equipment Corporation, Maynard, MA * * All rights reserved. * * * * This software is furnished under a license and may be used and * * copied only in accordance with the terms of such license and * * with the inclusion of the above copyright notice. This * * software or any other copies thereof may not be provided or * * otherwise made available to any other person. No title to and * * ownership of the software is hereby transferred. * * * * This software is derived from software received from the * * University of California, Berkeley, and from Bell * * Laboratories. Use, duplication, or disclosure is subject to * * restrictions under license agreements with University of * * California and with AT&T. * * * * The information in this software is subject to change without * * notice and should not be construed as a commitment by Digital * * Equipment Corporation. * * * * Digital assumes no responsibility for the use or reliability * * of its software on equipment which is not supplied by Digital. * * * ************************************************************************//* * lprm - remove the current user's spool entry * * lprm [-] [[job #] [user] ...] * * Using information in the lock file, lprm will kill the * currently active daemon (if necessary), remove the associated files, * and startup a new daemon. Priviledged users may remove anyone's spool * entries, otherwise one can only remove their own. *//* SCCS history beginning * *************************************************************** * -- Revision History -- * *************************************************************** * * 1.1 01/11/83 -- sccs * date and time created 83/11/01 20:58:15 by sccs * * *************************************************************** * * 1.2 12/07/88 -- maxwell * moved usage message from stdout to stderr * * * *************************************************************** * * 1.3 19/07/88 -- thoms * Added copyright notice and modification history * * SCCS history end */#include "lp.h"/* * Stuff for handling job specifications */char *user[MAXUSERS]; /* users to process */int users; /* # of users in user array */int requ[MAXREQUESTS]; /* job number of spool entries */int requests; /* # of spool requests */char *person; /* name of person doing lprm */static char *logfile = DEFLOGF;static char luser[16]; /* buffer for person */struct passwd *getpwuid();main(argc, argv) char *argv[];{ register char *arg; struct passwd *p; struct direct **files; int nitems, assasinated = 0; name = argv[0]; gethostname(host, sizeof(host)); if ((p = getpwuid(getuid())) == NULL) fatal("Who are you?"); if (strlen(p->pw_name) >= sizeof(luser)) fatal("Your name is too long"); strcpy(luser, p->pw_name); person = luser; while (--argc) { if ((arg = *++argv)[0] == '-') switch (arg[1]) { case 'L': argc--; logfile = *++argv; (void) freopen(logfile, O_WRONLY|O_APPEND, stderr); break; case 'P': if (arg[2]) printer = &arg[2]; else if (argc > 1) { argc--; printer = *++argv; } break; case '\0': if (!users) { users = -1; break; } default: usage(); } else { if (users < 0) usage(); if (isdigit(arg[0])) { if (requests >= MAXREQUESTS) fatal("Too many requests"); requ[requests++] = atoi(arg); } else { if (users >= MAXUSERS) fatal("Too many users"); user[users++] = arg; } } } if (printer == NULL && (printer = getenv("PRINTER")) == NULL) printer = DEFLP; rmjob();}staticusage(){ fprintf(stderr,"usage: lprm [-] [-Pprinter] [[job #] [user] ...]\n"); exit(2);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -