rpms/sysvinit/F-12 sysvinit-2.87-wide.patch, NONE, 1.1 sysvinit.spec, 1.78, 1.79

Petr Lautrbach plautrba at fedoraproject.org
Mon Mar 22 09:12:29 UTC 2010


Author: plautrba

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

Modified Files:
	sysvinit.spec 
Added Files:
	sysvinit-2.87-wide.patch 
Log Message:
Add -w option to last command for wide output (#550333)


sysvinit-2.87-wide.patch:
 man/last.1 |    6 ++++--
 src/last.c |   34 +++++++++++++++++++++-------------
 2 files changed, 25 insertions(+), 15 deletions(-)

--- NEW FILE sysvinit-2.87-wide.patch ---
diff --git a/man/last.1 b/man/last.1
index d718485..92bacb5 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 [ \-adFiox ]
+.RB [ \-adFiowx ]
 .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 [ \-adFiox ]
+.RB [ \-adFiowx ]
 .RI [ name... ]
 .RI [ tty... ]
 .\"}}}
@@ -80,6 +80,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 e304a09..06bba47 100644
--- a/src/last.c
+++ b/src/last.c
@@ -71,6 +71,8 @@ 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 fulltime = 0;	/* Print full dates and times */
+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 */
@@ -359,7 +361,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;
@@ -469,24 +471,24 @@ int list(struct utmp *p, time_t t, int what)
 		if (!altlist) {
 			snprintf(final, sizeof(final),
 				fulltime ?
-				"%-8.8s %-12.12s %-16.16s %-24.24s %-26.26s %-12.12s\n" :
-				"%-8.8s %-12.12s %-16.16s %-16.16s %-7.7s %-12.12s\n",
-				p->ut_name, utline,
-				domain, logintime, logouttime, length);
+				"%-8.*s %-12.12s %-16.*s %-24.24s %-26.26s %-12.12s\n" :
+				"%-8.*s %-12.12s %-16.*s %-16.16s %-7.7s %-12.12s\n",
+				name_len, p->ut_name, utline,
+				domain_len, domain, logintime, logouttime, length);
 		} else {
 			snprintf(final, sizeof(final), 
 				fulltime ?
-				"%-8.8s %-12.12s %-24.24s %-26.26s %-12.12s %s\n" :
-				"%-8.8s %-12.12s %-16.16s %-7.7s %-12.12s %s\n",
-				p->ut_name, utline,
+				"%-8.*s %-12.12s %-24.24s %-26.26s %-12.12s %s\n" :
+				"%-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),
 			fulltime ?
-			"%-8.8s %-12.12s %-24.24s %-26.26s %-12.12s\n" :
-			"%-8.8s %-12.12s %-16.16s %-7.7s %-12.12s\n",
-			p->ut_name, utline,
+			"%-8.*s %-12.12s %-24.24s %-26.26s %-12.12s\n" :
+			"%-8.*s %-12.12s %-16.16s %-7.7s %-12.12s\n",
+			name_len, p->ut_name, utline,
 			logintime, logouttime, length);
 
 	/*
@@ -514,7 +516,7 @@ void usage(char *s)
 {
 	fprintf(stderr, "Usage: %s [-num | -n num] [-f file] "
 			"[-t YYYYMMDDHHMMSS] "
-			"[-R] [-adioxF] [username..] [tty..]\n", s);
+			"[-R] [-adioxFw] [username..] [tty..]\n", s);
 	exit(1);
 }
 
@@ -585,7 +587,7 @@ int main(int argc, char **argv)
   progname = mybasename(argv[0]);
 
   /* Process the arguments. */
-  while((c = getopt(argc, argv, "f:n:RxadFiot:0123456789")) != EOF)
+  while((c = getopt(argc, argv, "f:n:RxadFiot:0123456789w")) != EOF)
     switch(c) {
 	case 'R':
 		showhost = 0;
@@ -626,6 +628,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-12/sysvinit.spec,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -p -r1.78 -r1.79
--- sysvinit.spec	8 Mar 2010 18:10:57 -0000	1.78
+++ sysvinit.spec	22 Mar 2010 09:12:29 -0000	1.79
@@ -1,7 +1,7 @@
 Summary: Programs which control basic system processes
 Name: sysvinit
 Version: 2.87
-Release: 2.dsf%{?dist}
+Release: 3.dsf%{?dist}
 License: GPLv2+
 Group: System Environment/Base
 Source: https://alioth.debian.org/frs/download.php/3060/sysvinit-%{version}dsf.tar.gz
@@ -15,6 +15,7 @@ Patch6: sysvinit-2.86-quiet.patch
 Patch10: sysvinit-2.87-pidof.patch
 Patch11: sysvinit-2.86-pidof-man.patch
 Patch12: sysvinit-2.87-sulogin.patch
+Patch13: sysvinit-2.87-wide.patch
 Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 Requires: pam >= 0.66-5
 Requires: filesystem >= 2.2.4-1
@@ -61,7 +62,8 @@ management.
 %patch11 -p1 -b .pidof
 # get_default_context_with_level returns 0 on success (#568530)
 %patch12 -p1 -b .sulogin
-
+# Add wide output names with -w (#550333)
+%patch13 -p1 -b .wide
 
 %build
 make %{?_smp_mflags} CC="%{__cc}" CFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE" LDFLAGS="" LCRYPT="-lcrypt" -C src
@@ -134,6 +136,9 @@ rm -rf $RPM_BUILD_ROOT
 %{_mandir}/man8/sulogin*
 
 %changelog
+* Mon Mar 22 2010 Petr Lautrbach <plautrba at redhat.com> 2.87-3.dsf
+- Add -w option to last command for wide output (#550333)
+
 * Mon Mar 08 2010 Petr Lautrbach <plautrba at redhat.com> 2.87-2.dsf
 - fix using get_default_context_with_level (#568530)
 



More information about the scm-commits mailing list