diff options
author | brooks <brooks@FreeBSD.org> | 2005-03-03 15:47:32 +0000 |
---|---|---|
committer | brooks <brooks@FreeBSD.org> | 2005-03-03 15:47:32 +0000 |
commit | 9b003d6928c7213b295225a61c5e7ae6bdb2d04d (patch) | |
tree | 71480dc3dd0e32e6a639b7886e158dd2648b4e88 /usr.sbin/newsyslog/newsyslog.c | |
parent | e701d73efd65befd744fcbf1435f7a78ea4b9b49 (diff) | |
download | FreeBSD-src-9b003d6928c7213b295225a61c5e7ae6bdb2d04d.zip FreeBSD-src-9b003d6928c7213b295225a61c5e7ae6bdb2d04d.tar.gz |
Add the -N option to not rotate any files. This is to be used in
cojunction with -C and is used by /etc/rc.d/newsyslog.
I forgot that this was in my perforce tree and not my running system and
thus committed a non-working newsyslog script.
Reported by: des
Pointy hat: brooks
Diffstat (limited to 'usr.sbin/newsyslog/newsyslog.c')
-rw-r--r-- | usr.sbin/newsyslog/newsyslog.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/usr.sbin/newsyslog/newsyslog.c b/usr.sbin/newsyslog/newsyslog.c index 9967e88..7b3a3aa 100644 --- a/usr.sbin/newsyslog/newsyslog.c +++ b/usr.sbin/newsyslog/newsyslog.c @@ -179,6 +179,7 @@ int createlogs; /* Create (non-GLOB) logfiles which do not */ int verbose = 0; /* Print out what's going on */ int needroot = 1; /* Root privs are necessary */ int noaction = 0; /* Don't do anything, just show it */ +int norotate = 0; /* Don't rotate */ int nosignal; /* Do not send any signals */ int force = 0; /* Force the trim no matter what */ int rotatereq = 0; /* -R = Always rotate the file(s) as given */ @@ -557,7 +558,7 @@ do_entry(struct conf_entry * ent) /* * If the file needs to be rotated, then rotate it. */ - if (ent->rotate) { + if (ent->rotate && !norotate) { if (temp_reason[0] != '\0') ent->r_reason = strdup(temp_reason); if (verbose) @@ -698,7 +699,7 @@ parse_args(int argc, char **argv) *p = '\0'; /* Parse command line options. */ - while ((ch = getopt(argc, argv, "a:d:f:nrsvCD:FR:")) != -1) + while ((ch = getopt(argc, argv, "a:d:f:nrsvCD:FNR:")) != -1) switch (ch) { case 'a': archtodir++; @@ -739,6 +740,9 @@ parse_args(int argc, char **argv) case 'F': force++; break; + case 'N': + norotate++; + break; case 'R': rotatereq++; requestor = strdup(optarg); @@ -749,6 +753,12 @@ parse_args(int argc, char **argv) /* NOTREACHED */ } + if (force && norotate) { + warnx("Only one of -F and -N may be specified."); + usage(); + /* NOTREACHED */ + } + if (rotatereq) { if (optind == argc) { warnx("At least one filename must be given when -R is specified."); @@ -838,7 +848,7 @@ usage(void) { fprintf(stderr, - "usage: newsyslog [-CFnrsv] [-a directory] [-d directory] [-f config-file]\n" + "usage: newsyslog [-CFNnrsv] [-a directory] [-d directory] [-f config-file]\n" " [ [-R requestor] filename ... ]\n"); exit(1); } |