~mdw
/
checkpath
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
tmpdir: Introduce option for verbose reporting, for diagnosing problems.
[checkpath]
/
tmpdir.c
diff --git
a/tmpdir.c
b/tmpdir.c
index
137127a
..
8e704e6
100644
(file)
--- a/
tmpdir.c
+++ b/
tmpdir.c
@@
-225,6
+225,13
@@
static char *goodtmp(void)
return (0);
}
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)
/* --- @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\
\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\
\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();
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_verbose = 0;
- cp.cp_report =
0
;
+ cp.cp_report =
report
;
checkpath_setids(&cp);
pw = getpwuid(me);
if (!pw)
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' },
{ "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 }
};
{ 0, 0, 0, 0 }
};
- int i = mdwopt(argc, argv, "hVu bcv:", opts, 0, 0, 0);
+ int i = mdwopt(argc, argv, "hVu bcv
c
:", opts, 0, 0, 0);
if (i < 0)
break;
if (i < 0)
break;
@@
-331,9
+341,12
@@
int main(int argc, char *argv[])
case 'c':
shell = sh_csh;
break;
case 'c':
shell = sh_csh;
break;
- case '
v
':
+ case '
C
':
return (!fullcheck(optarg));
break;
return (!fullcheck(optarg));
break;
+ case 'v':
+ cp.cp_verbose++;
+ break;
default:
duff = 1;
break;
default:
duff = 1;
break;