summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorgad <gad@FreeBSD.org>2002-07-02 02:48:21 +0000
committergad <gad@FreeBSD.org>2002-07-02 02:48:21 +0000
commitee962e9598cd8f3308bf0825b779fa0b9b9b2730 (patch)
tree005dcbcc5de0848485814207807f49d973168517 /usr.sbin
parent18542852dbfa5b0e2886922a4af68457efb6475a (diff)
downloadFreeBSD-src-ee962e9598cd8f3308bf0825b779fa0b9b9b2730.zip
FreeBSD-src-ee962e9598cd8f3308bf0825b779fa0b9b9b2730.tar.gz
Remove the backup-versions ("x*") of various lpc commands that were
recently rewritten. No one in -current has reported any problems with the newer versions. MFC after: 3 weeks
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/lpr/lpc/cmds.c361
-rw-r--r--usr.sbin/lpr/lpc/cmdtab.c8
-rw-r--r--usr.sbin/lpr/lpc/extern.h8
3 files changed, 0 insertions, 377 deletions
diff --git a/usr.sbin/lpr/lpc/cmds.c b/usr.sbin/lpr/lpc/cmds.c
index 8e28d10..db98422 100644
--- a/usr.sbin/lpr/lpc/cmds.c
+++ b/usr.sbin/lpr/lpc/cmds.c
@@ -78,14 +78,11 @@ static const char rcsid[] =
#define KQT_NODAEMON 0
#define KQT_KILLOK 1
-static void abortpr(struct printer *_pp, int _dis);
static char *args2line(int argc, char **argv);
static int doarg(char *_job);
static int doselect(struct dirent *_d);
static int kill_qtask(const char *lf);
-static void putmsg(struct printer *_pp, int _argc, char **_argv);
static int sortq(const void *_a, const void *_b);
-static void startpr(struct printer *_pp, int _chgenable);
static int touch(struct jobqueue *_jq);
static void unlinkf(char *_name);
static void upstat(struct printer *_pp, const char *_msg, int _notify);
@@ -276,86 +273,6 @@ args2line(int argc, char **argv)
}
/*
- * kill an existing daemon and disable printing.
- */
-void
-doabort(struct printer *pp)
-{
- abortpr(pp, 1);
-}
-
-static void
-abortpr(struct printer *pp, int dis)
-{
- register FILE *fp;
- struct stat stbuf;
- int pid, fd;
- char lf[MAXPATHLEN];
-
- lock_file_name(pp, lf, sizeof lf);
- printf("%s:\n", pp->printer);
-
- /*
- * Turn on the owner execute bit of the lock file to disable printing.
- */
- if (dis) {
- seteuid(euid);
- if (stat(lf, &stbuf) >= 0) {
- if (chmod(lf, stbuf.st_mode | LFM_PRINT_DIS) < 0)
- printf("\tcannot disable printing: %s\n",
- strerror(errno));
- else {
- /* ..call newer upstat() in obsolete code.. */
- upstat(pp, "printing disabled\n", 0);
- /* ..the new upstat() did a setuid(uid).. */
- seteuid(euid);
- printf("\tprinting disabled\n");
- }
- } else if (errno == ENOENT) {
- if ((fd = open(lf, O_WRONLY|O_CREAT,
- LOCK_FILE_MODE | LFM_PRINT_DIS)) < 0)
- printf("\tcannot create lock file: %s\n",
- strerror(errno));
- else {
- (void) close(fd);
- /* ..call newer upstat() in obsolete code.. */
- upstat(pp, "printing disabled\n", 0);
- /* ..the new upstat() did a setuid(uid).. */
- seteuid(euid);
- printf("\tprinting disabled\n");
- printf("\tno daemon to abort\n");
- }
- goto out;
- } else {
- printf("\tcannot stat lock file\n");
- goto out;
- }
- }
- /*
- * Kill the current daemon to stop printing now.
- */
- if ((fp = fopen(lf, "r")) == NULL) {
- printf("\tcannot open lock file\n");
- goto out;
- }
- if (!getline(fp) || flock(fileno(fp), LOCK_SH|LOCK_NB) == 0) {
- (void) fclose(fp); /* unlocks as well */
- printf("\tno daemon to abort\n");
- goto out;
- }
- (void) fclose(fp);
- if (kill(pid = atoi(line), SIGTERM) < 0) {
- if (errno == ESRCH)
- printf("\tno daemon to abort\n");
- else
- printf("\tWarning: daemon (pid %d) not killed\n", pid);
- } else
- printf("\tdaemon (pid %d) killed\n", pid);
-out:
- seteuid(uid);
-}
-
-/*
* Kill the current daemon, to stop printing of the active job.
*/
static int
@@ -946,31 +863,6 @@ unlinkf(char *name)
}
/*
- * Enable queuing to the printer (allow lpr's).
- */
-void
-enable(struct printer *pp)
-{
- struct stat stbuf;
- char lf[MAXPATHLEN];
-
- lock_file_name(pp, lf, sizeof lf);
- printf("%s:\n", pp->printer);
-
- /*
- * Turn off the group execute bit of the lock file to enable queuing.
- */
- seteuid(euid);
- if (stat(lf, &stbuf) >= 0) {
- if (chmod(lf, stbuf.st_mode & ~LFM_QUEUE_DIS) < 0)
- printf("\tcannot enable queuing\n");
- else
- printf("\tqueuing enabled\n");
- }
- seteuid(uid);
-}
-
-/*
* Enable queuing to the printer (allow lpr to add new jobs to the queue).
*/
void
@@ -989,42 +881,6 @@ enable_q(struct printer *pp)
* Disable queuing.
*/
void
-disable(struct printer *pp)
-{
- register int fd;
- struct stat stbuf;
- char lf[MAXPATHLEN];
-
- lock_file_name(pp, lf, sizeof lf);
- printf("%s:\n", pp->printer);
- /*
- * Turn on the group execute bit of the lock file to disable queuing.
- */
- seteuid(euid);
- if (stat(lf, &stbuf) >= 0) {
- if (chmod(lf, stbuf.st_mode | LFM_QUEUE_DIS) < 0)
- printf("\tcannot disable queuing: %s\n",
- strerror(errno));
- else
- printf("\tqueuing disabled\n");
- } else if (errno == ENOENT) {
- if ((fd = open(lf, O_WRONLY|O_CREAT,
- LOCK_FILE_MODE | LFM_QUEUE_DIS)) < 0)
- printf("\tcannot create lock file: %s\n",
- strerror(errno));
- else {
- (void) close(fd);
- printf("\tqueuing disabled\n");
- }
- } else
- printf("\tcannot stat lock file\n");
- seteuid(uid);
-}
-
-/*
- * Disable queuing.
- */
-void
disable_q(struct printer *pp)
{
int setres;
@@ -1038,125 +894,6 @@ disable_q(struct printer *pp)
/*
* Disable queuing and printing and put a message into the status file
- * (reason for being down).
- */
-void
-down(int argc, char *argv[])
-{
- int cmdstatus, more;
- struct printer myprinter, *pp = &myprinter;
-
- if (argc == 1) {
- printf("usage: down {all | printer} [message ...]\n");
- return;
- }
- if (!strcmp(argv[1], "all")) {
- more = firstprinter(pp, &cmdstatus);
- if (cmdstatus)
- goto looperr;
- while (more) {
- putmsg(pp, argc - 2, argv + 2);
- do {
- more = nextprinter(pp, &cmdstatus);
-looperr:
- switch (cmdstatus) {
- case PCAPERR_TCOPEN:
- printf("warning: %s: unresolved "
- "tc= reference(s) ",
- pp->printer);
- case PCAPERR_SUCCESS:
- break;
- default:
- fatal(pp, "%s", pcaperr(cmdstatus));
- }
- } while (more && cmdstatus);
- }
- return;
- }
- init_printer(pp);
- cmdstatus = getprintcap(argv[1], pp);
- switch (cmdstatus) {
- default:
- fatal(pp, "%s", pcaperr(cmdstatus));
- case PCAPERR_NOTFOUND:
- printf("unknown printer %s\n", argv[1]);
- return;
- case PCAPERR_TCOPEN:
- printf("warning: %s: unresolved tc= reference(s)", argv[1]);
- break;
- case PCAPERR_SUCCESS:
- break;
- }
- putmsg(pp, argc - 2, argv + 2);
-}
-
-static void
-putmsg(struct printer *pp, int argc, char **argv)
-{
- register int fd;
- register char *cp1, *cp2;
- char buf[1024];
- char file[MAXPATHLEN];
- struct stat stbuf;
-
- printf("%s:\n", pp->printer);
- /*
- * Turn on the group execute bit of the lock file to disable queuing;
- * turn on the owner execute bit of the lock file to disable printing.
- */
- lock_file_name(pp, file, sizeof file);
- seteuid(euid);
- if (stat(file, &stbuf) >= 0) {
- if (chmod(file, stbuf.st_mode|LFM_PRINT_DIS|LFM_QUEUE_DIS) < 0)
- printf("\tcannot disable queuing: %s\n",
- strerror(errno));
- else
- printf("\tprinter and queuing disabled\n");
- } else if (errno == ENOENT) {
- if ((fd = open(file, O_WRONLY|O_CREAT,
- LOCK_FILE_MODE|LFM_PRINT_DIS|LFM_QUEUE_DIS)) < 0)
- printf("\tcannot create lock file: %s\n",
- strerror(errno));
- else {
- (void) close(fd);
- printf("\tprinter and queuing disabled\n");
- }
- seteuid(uid);
- return;
- } else
- printf("\tcannot stat lock file\n");
- /*
- * Write the message into the status file.
- */
- status_file_name(pp, file, sizeof file);
- fd = open(file, O_WRONLY|O_CREAT|O_EXLOCK, STAT_FILE_MODE);
- if (fd < 0) {
- printf("\tcannot create status file: %s\n", strerror(errno));
- seteuid(uid);
- return;
- }
- seteuid(uid);
- (void) ftruncate(fd, 0);
- if (argc <= 0) {
- (void) write(fd, "\n", 1);
- (void) close(fd);
- return;
- }
- cp1 = buf;
- while (--argc >= 0) {
- cp2 = *argv++;
- while ((size_t)(cp1 - buf) < sizeof(buf) && (*cp1++ = *cp2++))
- ;
- cp1[-1] = ' ';
- }
- cp1[-1] = '\n';
- *cp1 = '\0';
- (void) write(fd, buf, strlen(buf));
- (void) close(fd);
-}
-
-/*
- * Disable queuing and printing and put a message into the status file
* (reason for being down). If the user specified `-msg', then use
* everything after that as the message for the status file. If the
* user did NOT specify `-msg', then the command should take the first
@@ -1222,16 +959,6 @@ quit(int argc __unused, char *argv[] __unused)
* Kill and restart the daemon.
*/
void
-restart(struct printer *pp)
-{
- abortpr(pp, 0);
- startpr(pp, 0);
-}
-
-/*
- * Kill and restart the daemon.
- */
-void
restart_q(struct printer *pp)
{
int killres, setres, startok;
@@ -1288,44 +1015,6 @@ setstatus_q(struct printer *pp)
* Enable printing on the specified printer and startup the daemon.
*/
void
-startcmd(struct printer *pp)
-{
- startpr(pp, 1);
-}
-
-static void
-startpr(struct printer *pp, int chgenable)
-{
- struct stat stbuf;
- char lf[MAXPATHLEN];
-
- lock_file_name(pp, lf, sizeof lf);
- printf("%s:\n", pp->printer);
-
- /*
- * For chgenable==1 ('start'), turn off the LFM_PRINT_DIS bit of the
- * lock file to re-enable printing. For chgenable==2 ('up'), also
- * turn off the LFM_QUEUE_DIS bit to re-enable queueing.
- */
- seteuid(euid);
- if (chgenable && stat(lf, &stbuf) >= 0) {
- mode_t bits = (chgenable == 2 ? 0 : LFM_QUEUE_DIS);
- if (chmod(lf, stbuf.st_mode & (LOCK_FILE_MODE | bits)) < 0)
- printf("\tcannot enable printing\n");
- else
- printf("\tprinting enabled\n");
- }
- if (!startdaemon(pp))
- printf("\tcouldn't start daemon\n");
- else
- printf("\tdaemon started\n");
- seteuid(uid);
-}
-
-/*
- * Enable printing on the specified printer and startup the daemon.
- */
-void
start_q(struct printer *pp)
{
int setres, startok;
@@ -1413,47 +1102,6 @@ status(struct printer *pp)
* printing.
*/
void
-stop(struct printer *pp)
-{
- register int fd;
- struct stat stbuf;
- char lf[MAXPATHLEN];
-
- lock_file_name(pp, lf, sizeof lf);
- printf("%s:\n", pp->printer);
-
- /*
- * Turn on the owner execute bit of the lock file to disable printing.
- */
- seteuid(euid);
- if (stat(lf, &stbuf) >= 0) {
- if (chmod(lf, stbuf.st_mode | LFM_PRINT_DIS) < 0)
- printf("\tcannot disable printing: %s\n",
- strerror(errno));
- else {
- upstat(pp, "printing disabled\n", 0);
- printf("\tprinting disabled\n");
- }
- } else if (errno == ENOENT) {
- if ((fd = open(lf, O_WRONLY|O_CREAT,
- LOCK_FILE_MODE | LFM_PRINT_DIS)) < 0)
- printf("\tcannot create lock file: %s\n",
- strerror(errno));
- else {
- (void) close(fd);
- upstat(pp, "printing disabled\n", 0);
- printf("\tprinting disabled\n");
- }
- } else
- printf("\tcannot stat lock file\n");
- seteuid(uid);
-}
-
-/*
- * Stop the specified daemon after completing the current job and disable
- * printing.
- */
-void
stop_q(struct printer *pp)
{
int setres;
@@ -1634,15 +1282,6 @@ doarg(char *job)
}
/*
- * Enable everything and start printer (undo `down').
- */
-void
-up(struct printer *pp)
-{
- startpr(pp, 2);
-}
-
-/*
* Enable both queuing & printing, and start printer (undo `down').
*/
void
diff --git a/usr.sbin/lpr/lpc/cmdtab.c b/usr.sbin/lpr/lpc/cmdtab.c
index 73dad39d..2d9b17d 100644
--- a/usr.sbin/lpr/lpc/cmdtab.c
+++ b/usr.sbin/lpr/lpc/cmdtab.c
@@ -86,14 +86,6 @@ struct cmd cmdtab[] = {
{ "topq", topqhelp, PR, topq, 0 },
{ "up", uphelp, PR, 0, up_q },
{ "?", helphelp, 0, help, 0 },
- { "xabort", aborthelp, PR, 0, doabort },
- { "xenable", enablehelp, PR, 0, enable },
- { "xdisable", disablehelp, PR, 0, disable },
- { "xdown", downhelp, PR, down, 0 },
- { "xrestart", restarthelp, 0, 0, restart },
- { "xstart", starthelp, PR, 0, startcmd },
- { "xstop", stophelp, PR, 0, stop },
- { "xup", uphelp, PR, 0, up },
{ 0, 0, 0, 0, 0},
};
diff --git a/usr.sbin/lpr/lpc/extern.h b/usr.sbin/lpr/lpc/extern.h
index 9ac011e..c2b3c7c 100644
--- a/usr.sbin/lpr/lpc/extern.h
+++ b/usr.sbin/lpr/lpc/extern.h
@@ -63,14 +63,6 @@ void stop_q(struct printer *_pp);
void tclean_gi(int _argc, char *_argv[]);
void topq(int _argc, char *_argv[]);
void up_q(struct printer *_pp);
-void disable(struct printer *_pp); /* X-version */
-void doabort(struct printer *_pp); /* X-version */
-void down(int _argc, char *_argv[]); /* X-version */
-void enable(struct printer *_pp); /* X-version */
-void restart(struct printer *_pp); /* X-version */
-void startcmd(struct printer *_pp); /* X-version */
-void stop(struct printer *_pp); /* X-version */
-void up(struct printer *_pp); /* X-version */
__END_DECLS
extern int NCMDS;
OpenPOWER on IntegriCloud