rpms/sysvinit/F-11 sysvinit-2.86-wide.patch, NONE, 1.1 sysvinit.spec, 1.73, 1.74

Petr Lautrbach plautrba at fedoraproject.org
Mon Apr 12 13:40:29 UTC 2010


Author: plautrba

Update of /cvs/pkgs/rpms/sysvinit/F-11
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv22201

Modified Files:
	sysvinit.spec 
Added Files:
	sysvinit-2.86-wide.patch 
Log Message:
Add -w option to last command for wide output 
Resolves: rhbz#529952



sysvinit-2.86-wide.patch:
 man/last.1 |    6 ++++--
 src/last.c |   26 +++++++++++++++++---------
 2 files changed, 21 insertions(+), 11 deletions(-)

--- NEW FILE sysvinit-2.86-wide.patch ---
diff --git a/man/last.1 b/man/last.1
index 52391cf..495b4fa 100644
--- a/man/last.1
+++ b/man/last.1
@@ -12,7 +12,7 @@ last, lastb \- show listing of last logged in users
 .RB [ \-R ]
 .RB [ \-\fInum\fP ]
 .RB "[ \-\fBn\fP \fInum\fP ]"
-.RB [ \-adiox ]
+.RB [ \-adiowx ]
 .RB "[ \-\fBf\fP \fIfile\fP ]"
 .RB "[ \-\fBt\fP \fIYYYYMMDDHHMMSS\fP ]"
 .RI [ name... ]
@@ -23,7 +23,7 @@ last, lastb \- show listing of last logged in users
 .RB [ \-\fInum\fP ]
 .RB "[ \-\fBn\fP \fInum\fP ]"
 .RB "[ \-\fBf\fP \fIfile\fP ]"
-.RB [ \-adiox ]
+.RB [ \-adiowx ]
 .RI [ name... ]
 .RI [ tty... ]
 .\"}}}
@@ -76,6 +76,8 @@ This option is like \fB-d\fP in that it displays the IP number of the remote
 host, but it displays the IP number in numbers-and-dots notation.
 .IP \fB\-o\fP
 Read an old-type wtmp file (written by linux-libc5 applications).
+.IP \fB\-w\fP
+Display full user and domain names in the output.
 .IP \fB\-x\fP
 Display the system shutdown entries and run level changes.
 .\"}}}
diff --git a/src/last.c b/src/last.c
index 08a2815..befd6ed 100644
--- a/src/last.c
+++ b/src/last.c
@@ -70,6 +70,8 @@ int showhost = 1;	/* Show hostname too? */
 int altlist = 0;	/* Show hostname at the end. */
 int usedns = 0;		/* Use DNS to lookup the hostname. */
 int useip = 0;		/* Print IP address in number format */
+int name_len = 8;	/* Default print 8 characters of name */
+int domain_len = 16;	/* Default print 16 characters of domain */
 int oldfmt = 0;		/* Use old libc5 format? */
 char **show = NULL;	/* What do they want us to show */
 char *ufile;		/* Filename of this file */
@@ -358,7 +360,7 @@ int list(struct utmp *p, time_t t, int what)
 	char		logintime[32];
 	char		logouttime[32];
 	char		length[32];
-	char		final[128];
+	char		final[512];
 	char		utline[UT_LINESIZE+1];
 	char		domain[256];
 	char		*s, **walk;
@@ -456,20 +458,20 @@ int list(struct utmp *p, time_t t, int what)
 #endif
 		if (!altlist) {
 			snprintf(final, sizeof(final),
-				"%-8.8s %-12.12s %-16.16s "
+				"%-8.*s %-12.12s %-16.*s "
 				"%-16.16s %-7.7s %-12.12s\n",
-				p->ut_name, utline,
-				domain, logintime, logouttime, length);
+				name_len, p->ut_name, utline,
+				domain_len, domain, logintime, logouttime, length);
 		} else {
 			snprintf(final, sizeof(final), 
-				"%-8.8s %-12.12s %-16.16s %-7.7s %-12.12s %s\n",
-				p->ut_name, utline,
+				"%-8.*s %-12.12s %-16.16s %-7.7s %-12.12s %s\n",
+				name_len, p->ut_name, utline,
 				logintime, logouttime, length, domain);
 		}
 	} else
 		snprintf(final, sizeof(final),
-			"%-8.8s %-12.12s %-16.16s %-7.7s %-12.12s\n",
-			p->ut_name, utline,
+			"%-8.*s %-12.12s %-16.16s %-7.7s %-12.12s\n",
+			name_len, p->ut_name, utline,
 			logintime, logouttime, length);
 
 	/*
@@ -566,7 +568,7 @@ int main(int argc, char **argv)
   progname = mybasename(argv[0]);
 
   /* Process the arguments. */
-  while((c = getopt(argc, argv, "f:n:Rxadiot:0123456789")) != EOF)
+  while((c = getopt(argc, argv, "f:n:Rxadiot:0123456789w")) != EOF)
     switch(c) {
 	case 'R':
 		showhost = 0;
@@ -604,6 +606,12 @@ int main(int argc, char **argv)
 			usage(progname);
 		}
 		break;
+	case 'w':
+		if (UT_NAMESIZE > name_len)
+			name_len = UT_NAMESIZE;
+		if (UT_HOSTSIZE > domain_len)
+			domain_len = UT_HOSTSIZE;
+		break;
 	case '0': case '1': case '2': case '3': case '4':
 	case '5': case '6': case '7': case '8': case '9':
 		maxrecs = 10*maxrecs + c - '0';


Index: sysvinit.spec
===================================================================
RCS file: /cvs/pkgs/rpms/sysvinit/F-11/sysvinit.spec,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -p -r1.73 -r1.74
--- sysvinit.spec	26 Feb 2009 05:28:33 -0000	1.73
+++ sysvinit.spec	12 Apr 2010 13:40:28 -0000	1.74
@@ -1,7 +1,7 @@
 Summary: Programs which control basic system processes
 Name: sysvinit
 Version: 2.86
-Release: 27
+Release: 28
 License: GPLv2+
 Group: System Environment/Base
 Source: ftp://ftp.cistron.nl/pub/people/miquels/sysvinit/sysvinit-%{version}.tar.gz
@@ -30,6 +30,7 @@ Patch21: sysvinit-no-abort.patch
 Patch22: 81_killall_avoid_init.dpatch
 Patch23: sysvinit-2.86-pidof-man.patch
 Patch24: sysvinit-2.86-utmpdump.patch
+Patch25: sysvinit-2.86-wide.patch
 Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 Requires: pam >= 0.66-5
 Requires: filesystem >= 2.2.4-1
@@ -107,6 +108,8 @@ management.
 %patch23 -p1 -b .pidof
 # Don't pass around unchecked malloc (and avoid a leak) (#473485)
 %patch24 -p1 -b .wheee
+# Add wide output names with -w (#529952)
+%patch25 -p1 -b .wide
 
 %build
 make %{?_smp_mflags} CC="%{__cc}" CFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE" -C src
@@ -176,6 +179,9 @@ rm -rf $RPM_BUILD_ROOT
 %{_mandir}/man8/sulogin*
 
 %changelog
+* Tue Jan 12 2010 Petr Lautrbach <plautrba at redhat.com> 2.86-28
+- Add -w option to last command for wide output (#529952)
+
 * Wed Feb 25 2009 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 2.86-27
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
 



More information about the scm-commits mailing list