X-Git-Url: https://git.distorted.org.uk/~mdw/checkpath/blobdiff_plain/d8e113174e0b2ceff6426ba27104343c8f41d447..3d62246fb045a0674c43e65fd5eea5e5bfa5a42d:/tmpdir.c diff --git a/tmpdir.c b/tmpdir.c index 137127a..8e704e6 100644 --- a/tmpdir.c +++ b/tmpdir.c @@ -225,6 +225,13 @@ static char *goodtmp(void) return (0); } +/* --- @report@ --- */ + +static void report(unsigned what, int verbose, + const char *p, const char *msg, + void *arg) + { moan("%s", msg); } + /* --- @usage@ --- */ static void usage(FILE *fp) @@ -257,7 +264,8 @@ Options supported:\n\ \n\ -b, --bourne Output a `TMPDIR' setting for Bourne shell users.\n\ -c, --cshell Output a `TMPDIR' setting for C shell users.\n\ --v, --verify PATH Check whether PATH is good, setting exit status.\n\ +-v, --verbose Report problems to standard error.\n\ +-C, --check PATH Check whether PATH is good, setting exit status.\n\ \n\ The default action is to examine the caller's shell and output a suitable\n\ setting for that shell type.\n\ @@ -291,9 +299,9 @@ int main(int argc, char *argv[]) ego(argv[0]); me = getuid(); - cp.cp_what = CP_WRWORLD | CP_WRGRP | CP_WROTHUSR | CP_STICKYOK; + cp.cp_what = CP_WRWORLD | CP_WRGRP | CP_WROTHUSR | CP_STICKYOK | CP_REPORT; cp.cp_verbose = 0; - cp.cp_report = 0; + cp.cp_report = report; checkpath_setids(&cp); pw = getpwuid(me); if (!pw) @@ -308,10 +316,12 @@ int main(int argc, char *argv[]) { "usage", 0, 0, 'u' }, { "bourne", 0, 0, 'b' }, { "cshell", 0, 0, 'c' }, - { "verify", OPTF_ARGREQ, 0, 'v' }, + { "check", OPTF_ARGREQ, 0, 'C' }, + { "verify", OPTF_ARGREQ, 0, 'C' }, + { "verbose", 0, 0, 'v' }, { 0, 0, 0, 0 } }; - int i = mdwopt(argc, argv, "hVu bcv:", opts, 0, 0, 0); + int i = mdwopt(argc, argv, "hVu bcvc:", opts, 0, 0, 0); if (i < 0) break; @@ -331,9 +341,12 @@ int main(int argc, char *argv[]) case 'c': shell = sh_csh; break; - case 'v': + case 'C': return (!fullcheck(optarg)); break; + case 'v': + cp.cp_verbose++; + break; default: duff = 1; break;