summaryrefslogtreecommitdiffstats
path: root/usr.sbin/lpr/lpc/lpc.c
diff options
context:
space:
mode:
authorgad <gad@FreeBSD.org>2001-06-25 02:05:03 +0000
committergad <gad@FreeBSD.org>2001-06-25 02:05:03 +0000
commita89ca1efdcee5122d5660c0173acb8a8d1d53225 (patch)
tree5359327b2674f5a90ee19ea58cfbc8d4d7f0864c /usr.sbin/lpr/lpc/lpc.c
parente066fac19f8dd58b76967b86465ce5d78339107b (diff)
downloadFreeBSD-src-a89ca1efdcee5122d5660c0173acb8a8d1d53225.zip
FreeBSD-src-a89ca1efdcee5122d5660c0173acb8a8d1d53225.tar.gz
Make 'lpc clean' somewhat safer. Add an 'lpc tclean' command, which allows
one to see what files would be removed *if* an 'lpc clean' is done. 'tclean' will remove no files, and is therefore not a privileged command. Also, both 'lpc clean' and 'lpc tclean' will now look for 'core' files in spool directories (but not remove them). They also print out an extra line of info when a datafile to be removed is a symlink (from 'lpr -s'), saying what file it is a symlink to. The 'lpc clean' commands also now print out a summary line saying how many queues were checked, how many files were removed (or "would be" removed, for tclean), and how much disk space is involved. For the benefit of those who have many print queues, 'lpc clean all' will only print out the names of print queues where some "interesting" files were found, instead of printing out a header-line for every queue in your printcap file. Reviewed by: freebsd-print@bostonradio.org freebsd-audit@FreeBSD.org MFC after: 2 weeks
Diffstat (limited to 'usr.sbin/lpr/lpc/lpc.c')
-rw-r--r--usr.sbin/lpr/lpc/lpc.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/usr.sbin/lpr/lpc/lpc.c b/usr.sbin/lpr/lpc/lpc.c
index 80e9f3e..d01c935 100644
--- a/usr.sbin/lpr/lpc/lpc.c
+++ b/usr.sbin/lpr/lpc/lpc.c
@@ -115,7 +115,7 @@ main(int argc, char *argv[])
exit(1);
}
if (c->c_generic != 0)
- generic(c->c_generic, argc, argv);
+ generic(c->c_generic, c->c_handler, argc, argv);
else
(*c->c_handler)(argc, argv);
exit(0);
@@ -200,8 +200,16 @@ cmdscanner(void)
printf("?Privileged command\n");
continue;
}
+
+ /*
+ * Two different commands might have the same generic rtn
+ * (eg: "clean" and "tclean"), and just use different
+ * handler routines for distinct command-setup. The handler
+ * routine might also be set on a generic routine for
+ * initial parameter processing.
+ */
if (c->c_generic != 0)
- generic(c->c_generic, margc, margv);
+ generic(c->c_generic, c->c_handler, margc, margv);
else
(*c->c_handler)(margc, margv);
}
OpenPOWER on IntegriCloud