From root@ca.lcs.mit.edu Wed Jun 30 10:36:35 1999
Return-Path: <root@ca.lcs.mit.edu>
Received: from khavrinen.lcs.mit.edu (khavrinen.lcs.mit.edu [18.24.4.193])
	by hub.freebsd.org (Postfix) with ESMTP id 4FA8A154BC
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 30 Jun 1999 10:36:34 -0700 (PDT)
	(envelope-from root@ca.lcs.mit.edu)
Received: from ca.lcs.mit.edu (ca.lcs.mit.edu [18.24.10.177])
	by khavrinen.lcs.mit.edu (8.9.1/8.9.1) with ESMTP id NAA25275
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 30 Jun 1999 13:36:33 -0400 (EDT)
	(envelope-from root@ca.lcs.mit.edu)
Received: (from root@localhost)
	by ca.lcs.mit.edu (8.9.3/8.9.3) id NAA19774;
	Wed, 30 Jun 1999 13:32:34 -0400 (EDT)
	(envelope-from root@ca.lcs.mit.edu)
Message-Id: <199906301732.NAA19774@ca.lcs.mit.edu>
Date: Wed, 30 Jun 1999 13:32:34 -0400 (EDT)
From: Charlie Root <root@ca.lcs.mit.edu>
Reply-To: root@ca.lcs.mit.edu
To: FreeBSD-gnats-submit@freebsd.org
Subject: ac(8) does not accept input from stdin
X-Send-Pr-Version: 3.2

>Number:         12467
>Category:       bin
>Synopsis:       ac(8) does not accept input from stdin
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    wollman
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jun 30 10:40:00 PDT 1999
>Closed-Date:    Tue Dec 21 05:25:11 PST 1999
>Last-Modified:  Tue Dec 21 05:25:41 PST 1999
>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:
Responsible-Changed-From-To: freebsd-ports->frebsd-bugs 
Responsible-Changed-By: cpiazza 
Responsible-Changed-When: Wed Jun 30 10:48:03 PDT 1999 
Responsible-Changed-Why:  
Misfiled PR 
Responsible-Changed-From-To: frebsd-bugs->freebsd-bugs 
Responsible-Changed-By: cpiazza 
Responsible-Changed-When: Wed Jun 30 10:50:43 PDT 1999 
Responsible-Changed-Why:  
Typo.. 
Responsible-Changed-From-To: freebsd-bugs->wollman 
Responsible-Changed-By: sheldonh 
Responsible-Changed-When: Wed Jun 30 14:35:27 PDT 1999 
Responsible-Changed-Why:  
Submitter is a committer. (?) 
Responsible-Changed-From-To: wollman->sheldonh 
Responsible-Changed-By: sheldonh 
Responsible-Changed-When: Wed Jun 30 14:46:41 PDT 1999 
Responsible-Changed-Why:  
Garrett lacks one or more of the time and inclination. 
State-Changed-From-To: open->closed 
State-Changed-By: sheldonh 
State-Changed-When: Wed Jun 30 14:47:27 PDT 1999 
State-Changed-Why:  
Committed, thanks. ;-) 
State-Changed-From-To: closed->open 
State-Changed-By: sheldonh 
State-Changed-When: Fri Jul 2 10:31:18 PDT 1999 
State-Changed-Why:  
Commit backed out. The situation has been restored to the state in 
which I found it. 
Responsible-Changed-From-To: sheldonh->wollman 
Responsible-Changed-By: sheldonh 
Responsible-Changed-When: Fri Jul 9 05:30:01 PDT 1999 
Responsible-Changed-Why:  
Who'd have thought so much would be said by so many about so little? :-) 
State-Changed-From-To: open->closed 
State-Changed-By: sheldonh 
State-Changed-When: Tue Dec 21 05:25:11 PST 1999 
State-Changed-Why:  
This one met quite strong resistance. 
>Unformatted:
