summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ac/ac.c
diff options
context:
space:
mode:
authorsheldonh <sheldonh@FreeBSD.org>1999-06-30 21:46:03 +0000
committersheldonh <sheldonh@FreeBSD.org>1999-06-30 21:46:03 +0000
commita987e5b063b72307e9ab781869ed861743165339 (patch)
tree215fccaf56fc9de4682f9cc0c3a0e8ef864d2974 /usr.sbin/ac/ac.c
parenta9c3f31bb0491224037a1ed7887f14c277021020 (diff)
downloadFreeBSD-src-a987e5b063b72307e9ab781869ed861743165339.zip
FreeBSD-src-a987e5b063b72307e9ab781869ed861743165339.tar.gz
Allow the use of `-' as an argument to the -w option so that standard
input may be used (e.g. gunzip -c /var/log/wtmp.Jan.gz | ac -w - ). PR: 12467 Submitted by: wollman
Diffstat (limited to 'usr.sbin/ac/ac.c')
-rw-r--r--usr.sbin/ac/ac.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/usr.sbin/ac/ac.c b/usr.sbin/ac/ac.c
index 0916d3c..1d73bd0 100644
--- a/usr.sbin/ac/ac.c
+++ b/usr.sbin/ac/ac.c
@@ -15,7 +15,7 @@
#ifndef lint
static const char rcsid[] =
- "$Id: ac.c,v 1.9 1998/05/25 05:21:29 steve Exp $";
+ "$Id: ac.c,v 1.10 1998/07/02 05:34:08 phk Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -106,12 +106,20 @@ file(name)
{
FILE *fp;
- if ((fp = fopen(name, "r")) == NULL)
- err(1, "%s", name);
- /* in case we want to discriminate */
- if (strcmp(_PATH_WTMP, name))
+ /*
+ * Added by GAW...
+ */
+ if (strcmp("-", name) == 0) {
Flags |= AC_W;
- return fp;
+ return (stdin);
+ } else {
+ if ((fp = fopen(name, "r")) == NULL)
+ err(1, "%s", name);
+ /* in case we want to discriminate */
+ if (strcmp(_PATH_WTMP, name))
+ Flags |= AC_W;
+ return fp;
+ }
}
struct tty_list *
OpenPOWER on IntegriCloud