* Copyright (c) 1983 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
"@(#) Copyright (c) 1983 Regents of the University of California.\n\
static char sccsid
[] = "@(#)lprm.c 5.2 (Berkeley) %G%";
* 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.
* 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 luser
[16]; /* buffer for person */
struct passwd
*getpwuid();
int nitems
, assasinated
= 0;
gethostname(host
, sizeof(host
));
openlog("lpd", 0, LOG_LPR
);
if ((p
= getpwuid(getuid())) == NULL
)
if (strlen(p
->pw_name
) >= sizeof(luser
))
fatal("Your name is too long");
strcpy(luser
, p
->pw_name
);
if ((arg
= *++argv
)[0] == '-')
if (requests
>= MAXREQUESTS
)
fatal("Too many requests");
requ
[requests
++] = atoi(arg
);
if (printer
== NULL
&& (printer
= getenv("PRINTER")) == NULL
)
printf("usage: lprm [-] [-Pprinter] [[job #] [user] ...]\n");