tmpdir \- choose, or check a choice of, temporary directory
.SH SYNOPSIS
.B tmpdir
-.RB [ \-bc ]
-.RB [ \-v
+.RB [ \-bcv ]
+.RB [ \-C
.IR dir ]
.SH USAGE
The
.B "\-c, \-\-cshell"
Output an assignment using C shell syntax.
.TP
-.BI "\-v, --verify " dir
+.B "-v, \-\-verbose"
+Report problems to standard error. Repeat for more verbosity.
+.TP
+.BI "\-C, --check " dir
Don't try to find a temporary directory; just see whether
.I dir
is secure, and exit successfully if it is (and unsuccessfully if it
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)
\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\
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)
{ "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;
case 'c':
shell = sh_csh;
break;
- case 'v':
+ case 'C':
return (!fullcheck(optarg));
break;
+ case 'v':
+ cp.cp_verbose++;
+ break;
default:
duff = 1;
break;