From 2ab167ff84acbdbd4b085e914cf0c0df18e77c03 Mon Sep 17 00:00:00 2001 From: Peter Valchev Date: Thu, 24 May 2001 03:02:33 +0000 Subject: - Let '-' mean stdin. - Correct usage message: -p and -d cannot be usefully used together. - Use __progname in usage() millert@ ok --- usr.sbin/ac/ac.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'usr.sbin/ac/ac.c') 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 @@ -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); } -- cgit v1.2.3