From ler@lerlaptop.lerctr.org  Sun Jul 20 09:37:41 2003
Return-Path: <ler@lerlaptop.lerctr.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 7EAF337B401
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 20 Jul 2003 09:37:41 -0700 (PDT)
Received: from lerlaptop.lerctr.org (lerlaptop.lerctr.org [207.158.72.14])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 56D8043FBD
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 20 Jul 2003 09:37:36 -0700 (PDT)
	(envelope-from ler@lerlaptop.lerctr.org)
Received: from lerlaptop.lerctr.org (localhost [127.0.0.1])
	by lerlaptop.lerctr.org (8.12.9/8.12.9) with ESMTP id h6KGbXIc017485
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 20 Jul 2003 11:37:33 -0500 (CDT)
	(envelope-from ler@lerlaptop.lerctr.org)
Received: (from ler@localhost)
	by lerlaptop.lerctr.org (8.12.9/8.12.9/Submit) id h6KGbXmE017484;
	Sun, 20 Jul 2003 11:37:33 -0500 (CDT)
Message-Id: <200307201637.h6KGbXmE017484@lerlaptop.lerctr.org>
Date: Sun, 20 Jul 2003 11:37:33 -0500 (CDT)
From: Larry Rosenman <ler@lerctr.org>
Reply-To: Larry Rosenman <ler@lerctr.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: Update last(1) to allow -n # in addition to -# for number of records
X-Send-Pr-Version: 3.113
X-GNATS-Notify: ler@lerctr.org

>Number:         54661
>Category:       misc
>Synopsis:       Update last(1) to allow -n # in addition to -# for number of records
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jul 20 09:40:17 PDT 2003
>Closed-Date:    Sun Jul 27 03:56:42 PDT 2003
>Last-Modified:  Sun Jul 27 03:56:42 PDT 2003
>Originator:     Larry Rosenman
>Release:        FreeBSD 5.1-CURRENT i386
>Organization:
LERCTR Consulting
>Environment:
System: FreeBSD lerlaptop.lerctr.org 5.1-CURRENT FreeBSD 5.1-CURRENT #29: Fri Jul 18 13:29:29 CDT 2003 ler@lerlaptop.iadfw.net:/usr/obj/usr/src/sys/LERLAPTOP i386


	
>Description:
My UnixWare (System V Release 5) system allows -n # to be used for
the last command, and I find it annoying that the FreeBSD version
doesn't accept this. 

The Patch below will allow both. 

Unfortunately, I'm not a mdoc person, so I did NOT do a man page
patch, as I'm not familiar enough with it.  If a doc person could
point me to the appropriate doc, or make the change, I'd appreciate it.

The patch is to /usr/src/usr.bin/last:
>How-To-Repeat:
type last -n 20, notice error. 
>Fix:

--- last.c.orig	Wed Oct 30 12:19:59 2002
+++ last.c	Sun Jul 20 11:16:00 2003
@@ -113,7 +113,7 @@
 usage(void)
 {
 	(void)fprintf(stderr,
-"usage: last [-#] [-y] [-d [[CC]YY][MMDD]hhmm[.SS]] [-f file] [-h host]\n"
+"usage: last [-#] [-n #] [-y] [-d [[CC]YY][MMDD]hhmm[.SS]] [-f file] [-h host]\n"
 "\t[-t tty] [-s|w] [user ...]\n");
 	exit(1);
 }
@@ -129,7 +129,7 @@
 
 	maxrec = -1;
 	snaptime = 0;
-	while ((ch = getopt(argc, argv, "0123456789d:f:h:st:wy")) != -1)
+	while ((ch = getopt(argc, argv, "0123456789d:f:h:n:st:wy")) != -1)
 		switch (ch) {
 		case '0': case '1': case '2': case '3': case '4':
 		case '5': case '6': case '7': case '8': case '9':
@@ -148,6 +148,9 @@
 			break;
 		case 'd':
 			snaptime = dateconv(optarg);
+			break;
+		case 'n':
+			maxrec = atol(optarg);
 			break;
 		case 'f':
 			file = optarg;

>Release-Note:
>Audit-Trail:

From: "Matthew D. Fuller" <fullermd@over-yonder.net>
To: Larry Rosenman <ler@lerctr.org>
Cc: FreeBSD-gnats-submit@FreeBSD.org
Subject: Re: misc/54661: Update last(1) to allow -n # in addition to -# for number of records
Date: Sun, 20 Jul 2003 12:08:24 -0500

 On Sun, Jul 20, 2003 at 11:37:33AM -0500 I heard the voice of
 Larry Rosenman, and lo! it spake thus:
 > 
 > >Description:
 > My UnixWare (System V Release 5) system allows -n # to be used for
 > the last command, and I find it annoying that the FreeBSD version
 > doesn't accept this. 
 > 
 > The Patch below will allow both. 
 > 
 > Unfortunately, I'm not a mdoc person, so I did NOT do a man page
 > patch, as I'm not familiar enough with it.  If a doc person could
 > point me to the appropriate doc, or make the change, I'd appreciate it.
 
 Try this:
 
 
 Index: last.1
 ===================================================================
 RCS file: /usr/cvs/src/usr.bin/last/last.1,v
 retrieving revision 1.14
 diff -u -r1.14 last.1
 --- last.1	21 Jul 2002 12:45:54 -0000	1.14
 +++ last.1	20 Jul 2003 17:07:10 -0000
 @@ -40,7 +40,8 @@
  .Nd indicate last logins of users and ttys
  .Sh SYNOPSIS
  .Nm
 -.Op Fl Ns Ar n
 +.Op Fl Ns Ar #
 +.Op Fl n Ar #
  .Op Fl y
  .Oo
  .Fl d
 @@ -78,9 +79,12 @@
  .Pp
  The following options are available:
  .Bl -tag -width indent-two
 -.It Fl Ar n
 +.It Xo
 +.Fl Ar # ,
 +.Fl n Ar #
 +.Xc
  Limit the report to
 -.Ar n
 +.Ar #
  lines.
  .It Fl d Ar date
  Specify the snapshot date and time.
 
 
 -- 
 Matthew Fuller     (MF4839)   |  fullermd@over-yonder.net
 Systems/Network Administrator |  http://www.over-yonder.net/~fullermd/
 
 "The only reason I'm burning my candle at both ends, is because I
       haven't figured out how to light the middle yet"
State-Changed-From-To: open->closed 
State-Changed-By: tjr 
State-Changed-When: Sun Jul 27 03:54:39 PDT 2003 
State-Changed-Why:  
I've added the -n option. Thanks for the suggestion. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=54661 
>Unformatted:
