Lines Matching refs:opts

58 static void dologname(struct fn *fnp, struct opts *clopts);
59 static boolean_t rotatelog(struct fn *fnp, struct opts *opts);
60 static void rotateto(struct fn *fnp, struct opts *opts, int n,
63 static void expirefiles(struct fn *fnp, struct opts *opts);
64 static void dorm(struct opts *opts, const char *msg, struct fn *fnp);
65 static void docmd(struct opts *opts, const char *msg, const char *cmd,
67 static void docopytruncate(struct opts *opts, const char *file,
165 struct opts *clopts = NULL; /* from parsing command line */ in main()
414 struct opts *opts = (struct opts *)arg; in doaftercmd() local
428 docmd(opts, "-a cmd", Sh, "-c", lhs, NULL); in doaftercmd()
436 struct opts *opts = (struct opts *)arg; in do_delayed_gzip() local
445 docmd(opts, "compress old log (-z flag)", Gzip, "-f", lhs, NULL); in do_delayed_gzip()
451 dologname(struct fn *fnp, struct opts *clopts) in dologname()
454 struct opts *cfopts; in dologname()
455 struct opts *allopts; in dologname()
578 rotatelog(struct fn *fnp, struct opts *opts) in rotatelog() argument
594 if (opts_count(opts, "p") && opts_optarg_int(opts, "p") == OPTP_NEVER) in rotatelog()
605 if (opts_count(opts, "N")) in rotatelog()
622 if (opts_count(opts, "s") && in rotatelog()
623 stbuf.st_size < opts_optarg_int(opts, "s")) { in rotatelog()
629 if (opts_count(opts, "p")) { in rotatelog()
630 off_t when = opts_optarg_int(opts, "p"); in rotatelog()
631 struct opts *cfopts; in rotatelog()
667 if (opts_count(opts, "P")) { in rotatelog()
668 off_t last = opts_optarg_int(opts, "P"); in rotatelog()
693 if (opts_count(opts, "l")) { in rotatelog()
701 rotateto(fnp, opts, 0, recentlog, B_FALSE); in rotatelog()
710 rotateto(fnp, opts, 0, recentlog, B_FALSE); in rotatelog()
714 if (opts_count(opts, "o")) in rotatelog()
715 (void) strlcpy(ownerbuf, opts_optarg(opts, "o"), MAXATTR); in rotatelog()
720 if (opts_count(opts, "g")) in rotatelog()
721 group = opts_optarg(opts, "g"); in rotatelog()
728 if (opts_count(opts, "m")) in rotatelog()
729 mode = opts_optarg(opts, "m"); in rotatelog()
737 docmd(opts, NULL, Touch, fname, NULL, NULL); in rotatelog()
738 docmd(opts, NULL, Chown, owner, fname, NULL); in rotatelog()
739 docmd(opts, NULL, Chmod, mode, fname, NULL); in rotatelog()
742 if (opts_count(opts, "R")) { in rotatelog()
743 struct fn *rawcmd = fn_new(opts_optarg(opts, "R")); in rotatelog()
748 docmd(opts, "-R cmd", Sh, "-c", fn_s(cmd), NULL); in rotatelog()
763 if (opts_count(opts, "a")) { in rotatelog()
764 const char *cmd = opts_optarg(opts, "a"); in rotatelog()
766 if (opts_count(opts, "e")) in rotatelog()
767 addrs = lut_add(addrs, opts_optarg(opts, "e"), NULL); in rotatelog()
768 Aftercmds = lut_add(Aftercmds, opts_optarg(opts, "a"), addrs); in rotatelog()
774 if (opts_count(opts, "v") && fname != NULL) in rotatelog()
784 rotateto(struct fn *fnp, struct opts *opts, int n, struct fn *recentlog, in rotateto() argument
787 struct fn *template = fn_new(opts_optarg(opts, "t")); in rotateto()
808 rotateto(newfile, opts, n + 1, recentlog, isgz); in rotateto()
809 else if (hasn && opts_count(opts, "z")) { in rotateto()
817 rotateto(gzfnp, opts, n + 1, recentlog, B_TRUE); in rotateto()
822 if (n == 0 && opts_count(opts, "b")) { in rotateto()
823 const char *cmd = opts_optarg(opts, "b"); in rotateto()
826 docmd(opts, "-b cmd", Sh, "-c", cmd, NULL); in rotateto()
833 docmd(opts, "verify directory exists", Mkdir, "-p", in rotateto()
838 if (n == 0 && opts_count(opts, "c") != 0) { in rotateto()
839 docopytruncate(opts, fn_s(fnp), fn_s(newfile)); in rotateto()
840 } else if (n == 0 && opts_count(opts, "M")) { in rotateto()
841 struct fn *rawcmd = fn_new(opts_optarg(opts, "M")); in rotateto()
847 docmd(opts, "-M cmd", Sh, "-c", fn_s(cmd), NULL); in rotateto()
852 docmd(opts, "rotate log file", Mv, "-f", in rotateto()
862 expirefiles(struct fn *fnp, struct opts *opts) in expirefiles() argument
876 if (opts_count(opts, "zAS") == 0 && opts_optarg_int(opts, "C") == 0) in expirefiles()
886 if (opts_count(opts, "T")) { in expirefiles()
887 template = fn_new(opts_optarg(opts, "T")); in expirefiles()
891 template = fn_new(opts_optarg(opts, "t")); in expirefiles()
894 opts_count(opts, "z") != 0); in expirefiles()
917 if ((count = opts_optarg_int(opts, "C")) > 0) { in expirefiles()
926 dorm(opts, "expire by count rule", nextfnp); in expirefiles()
933 if (opts_count(opts, "S") && (size = opts_optarg_int(opts, "S")) > 0) { in expirefiles()
936 dorm(opts, "expire by size rule", nextfnp); in expirefiles()
942 if (opts_count(opts, "A")) { in expirefiles()
943 int mtime = (int)time(0) - (int)opts_optarg_int(opts, "A"); in expirefiles()
947 dorm(opts, "expire by age rule", nextfnp); in expirefiles()
957 if (opts_count(opts, "z")) { in expirefiles()
958 int zcount = (int)opts_optarg_int(opts, "z"); in expirefiles()
988 dorm(struct opts *opts, const char *msg, struct fn *fnp) in dorm() argument
990 if (opts_count(opts, "E")) { in dorm()
991 struct fn *rawcmd = fn_new(opts_optarg(opts, "E")); in dorm()
997 docmd(opts, msg, Sh, "-c", fn_s(cmd), NULL); in dorm()
1001 docmd(opts, msg, Rm, "-f", fn_s(fnp), NULL); in dorm()
1007 docmd(struct opts *opts, const char *msg, const char *cmd, in docmd() argument
1014 if (opts_count(opts, "vn")) { in docmd()
1033 if (opts_count(opts, "n")) in docmd()
1131 docopytruncate(struct opts *opts, const char *file, const char *file_copy) in docopytruncate() argument
1141 if (opts_count(opts, "vn") != 0) { in docopytruncate()
1148 if (opts_count(opts, "n")) in docopytruncate()