Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Jun 1999 13:32:34 -0400 (EDT)
From:      Charlie Root <root@ca.lcs.mit.edu>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   ports/12467: ac(8) does not accept input from stdin
Message-ID:  <199906301732.NAA19774@ca.lcs.mit.edu>

next in thread | raw e-mail | index | archive | help

>Number:         12467
>Category:       ports
>Synopsis:       ac(8) does not accept input from stdin
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jun 30 10:40:00 PDT 1999
>Closed-Date:
>Last-Modified:
>Originator:     Garrett A. Wollman
>Release:        FreeBSD 4.0-CURRENT i386
>Organization:
MIT Laboratory for Computer Science
>Environment:

	Irrelevant.

>Description:

	If wtmp files are gzipped, you'd like to be able to use ac in a
	pipeline with gunzip.

>How-To-Repeat:

	$ gzip -dc /var/log/wtmp*gz | ac -d -w -
	ac: -: No such file or directory

>Fix:
	
Index: ac.8
===================================================================
RCS file: /home/ncvs/src/usr.sbin/ac/ac.8,v
retrieving revision 1.10
diff -u -r1.10 ac.8
--- ac.8	1997/09/01 06:11:40	1.10
+++ ac.8	1999/06/30 17:26:41
@@ -84,6 +84,9 @@
 .Ar wtmp
 instead of the default file,
 .Pa /var/log/wtmp .
+If
+.Ql \&-
+is specified, read records from the standard input.
 .It Ar users ...
 Display totals for the given individuals only.
 .El
Index: ac.c
===================================================================
RCS file: /home/ncvs/src/usr.sbin/ac/ac.c,v
retrieving revision 1.10
diff -u -r1.10 ac.c
--- ac.c	1998/07/02 05:34:08	1.10
+++ ac.c	1999/06/30 17:25:34
@@ -106,12 +106,20 @@
 {
 	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 *


>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199906301732.NAA19774>