summaryrefslogtreecommitdiff
path: root/usr.sbin/ac/ac.c
diff options
context:
space:
mode:
authorPeter Valchev <pvalchev@cvs.openbsd.org>2001-05-24 03:02:33 +0000
committerPeter Valchev <pvalchev@cvs.openbsd.org>2001-05-24 03:02:33 +0000
commit2ab167ff84acbdbd4b085e914cf0c0df18e77c03 (patch)
tree953c0281fdf8b0b54bde67bc890e75cc000a5027 /usr.sbin/ac/ac.c
parentf31553fd50e6e5af57e125a38799de79f8b63fb3 (diff)
- 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/ac.c')
-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);
}