summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ac
diff options
context:
space:
mode:
authorpvalchev <pvalchev@openbsd.org>2001-05-24 03:02:32 +0000
committerpvalchev <pvalchev@openbsd.org>2001-05-24 03:02:32 +0000
commit559b49b09c4c79a16db661606ba5b14d250242f6 (patch)
tree6ea076d9f22ab014a0675fa6a015a4f897813af5 /usr.sbin/ac
parentDon't convert a single space before a tab stop into a tab when the -i (diff)
downloadwireguard-openbsd-559b49b09c4c79a16db661606ba5b14d250242f6.tar.xz
wireguard-openbsd-559b49b09c4c79a16db661606ba5b14d250242f6.zip
- Let '-' mean stdin.
- Correct usage message: -p and -d cannot be usefully used together. - Use __progname in usage() millert@ ok
Diffstat (limited to 'usr.sbin/ac')
-rw-r--r--usr.sbin/ac/ac.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/usr.sbin/ac/ac.c b/usr.sbin/ac/ac.c
index cd166a73b45..d71b7327e36 100644
--- a/usr.sbin/ac/ac.c
+++ b/usr.sbin/ac/ac.c
@@ -14,7 +14,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: ac.c,v 1.8 2001/05/05 07:12:50 mickey Exp $";
+static char rcsid[] = "$Id: ac.c,v 1.9 2001/05/24 03:02:32 pvalchev Exp $";
#endif
#include <sys/types.h>
@@ -104,7 +104,9 @@ file(name)
{
FILE *fp;
- if ((fp = fopen(name, "r")) == NULL)
+ if (strcmp(name, "-") == 0)
+ fp = stdin;
+ else if ((fp = fopen(name, "r")) == NULL)
err(1, "%s", name);
/* in case we want to discriminate */
if (strcmp(_PATH_WTMP, name))
@@ -545,11 +547,14 @@ ac(fp)
void
usage()
{
+ extern char *__progname;
(void)fprintf(stderr,
#ifdef CONSOLE_TTY
- "ac [-dp] [-c console] [-t tty] [-w wtmp] [users ...]\n");
+ "%s [-d | -p] [-c console] [-t tty] [-w wtmp] [users ...]\n",
+ __progname);
#else
- "ac [-dp] [-t tty] [-w wtmp] [users ...]\n");
+ "%s [-d | -p] [-t tty] [-w wtmp] [users ...]\n",
+ __progname);
#endif
exit(1);
}