[Pkg-sysvinit-commits] r1390 - in sysvinit/trunk/debian: . patches

Petter Reinholdtsen pere at alioth.debian.org
Wed Jul 8 20:42:10 UTC 2009


Author: pere
Date: 2009-07-08 20:42:10 +0000 (Wed, 08 Jul 2009)
New Revision: 1390

Added:
   sysvinit/trunk/debian/patches/28_last_full-time.dpatch
Modified:
   sysvinit/trunk/debian/changelog
   sysvinit/trunk/debian/patches/00list
Log:
New patch 28_last_full-time to add a new -F option to last.  Patch
from Olaf Dabrunz and SuSe.

Modified: sysvinit/trunk/debian/changelog
===================================================================
--- sysvinit/trunk/debian/changelog	2009-07-08 18:36:43 UTC (rev 1389)
+++ sysvinit/trunk/debian/changelog	2009-07-08 20:42:10 UTC (rev 1390)
@@ -50,6 +50,8 @@
     of a lintian error.
   * Change symlink from /bin/pidof to /sbin/killall5 from relative to
     absolute, to get rid of lintian message.
+  * New patch 28_last_full-time to add a new -F option to last.  Patch
+    from Olaf Dabrunz and SuSe.
 
  -- Petter Reinholdtsen <pere at debian.org>  Wed, 01 Jul 2009 20:04:20 +0200
 

Modified: sysvinit/trunk/debian/patches/00list
===================================================================
--- sysvinit/trunk/debian/patches/00list	2009-07-08 18:36:43 UTC (rev 1389)
+++ sysvinit/trunk/debian/patches/00list	2009-07-08 20:42:10 UTC (rev 1390)
@@ -11,6 +11,7 @@
 25_last_sanify
 26_last_ipv6
 27_last_usageopts
+28_last_full-time
 30_strip
 31_build_warnings
 40_selinux

Added: sysvinit/trunk/debian/patches/28_last_full-time.dpatch
===================================================================
--- sysvinit/trunk/debian/patches/28_last_full-time.dpatch	                        (rev 0)
+++ sysvinit/trunk/debian/patches/28_last_full-time.dpatch	2009-07-08 20:42:10 UTC (rev 1390)
@@ -0,0 +1,146 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 28_last_full-time.dpatch by Olaf Dabrunz and SuSe.
+
+Add new option -F to last, to output full date string instead of the short
+form provided by default.  See
+<URL:https://bugzilla.novell.com/show_bug.cgi?id=136978> for details.
+
+ at DPATCH@
+diff -urNad trunk~/man/last.1 trunk/man/last.1
+--- trunk~/man/last.1	2009-07-08 22:30:36.000000000 +0200
++++ trunk/man/last.1	2009-07-08 22:30:36.000000000 +0200
+@@ -12,7 +12,7 @@
+ .RB [ \-R ]
+ .RB [ \-\fInum\fP ]
+ .RB "[ \-\fBn\fP \fInum\fP ]"
+-.RB [ \-adiox ]
++.RB [ \-adFiox ]
+ .RB "[ \-\fBf\fP \fIfile\fP ]"
+ .RB "[ \-\fBt\fP \fIYYYYMMDDHHMMSS\fP ]"
+ .RI [ name... ]
+@@ -23,7 +23,7 @@
+ .RB [ \-\fInum\fP ]
+ .RB "[ \-\fBn\fP \fInum\fP ]"
+ .RB "[ \-\fBf\fP \fIfile\fP ]"
+-.RB [ \-adiox ]
++.RB [ \-adFiox ]
+ .RI [ name... ]
+ .RI [ tty... ]
+ .\"}}}
+@@ -71,6 +71,8 @@
+ For non-local logins, Linux stores not only the host name of the remote
+ host but its IP number as well. This option translates the IP number
+ back into a hostname.
++.IP \fB\-F\fP
++Print full login and logout times and dates.
+ .IP \fB\-i\fP
+ 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.
+diff -urNad trunk~/src/last.c trunk/src/last.c
+--- trunk~/src/last.c	2009-07-08 22:30:36.000000000 +0200
++++ trunk/src/last.c	2009-07-08 22:31:21.000000000 +0200
+@@ -70,6 +70,7 @@
+ 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 oldfmt = 0;		/* Use old libc5 format? */
+ char **show = NULL;	/* What do they want us to show */
+ char *ufile;		/* Filename of this file */
+@@ -393,9 +394,13 @@
+ 	 */
+ 	tmp = (time_t)p->ut_time;
+ 	strcpy(logintime, ctime(&tmp));
+-	logintime[16] = 0;
+-	sprintf(logouttime, "- %s", ctime(&t) + 11);
+-	logouttime[7] = 0;
++	if (fulltime)
++		sprintf(logouttime, "- %s", ctime(&t));
++	else {
++		logintime[16] = 0;
++		sprintf(logouttime, "- %s", ctime(&t) + 11);
++		logouttime[7] = 0;
++	}
+ 	secs = t - p->ut_time;
+ 	mins  = (secs / 60) % 60;
+ 	hours = (secs / 3600) % 24;
+@@ -414,13 +419,21 @@
+ 			break;
+ 		case R_NOW:
+ 			length[0] = 0;
+-			sprintf(logouttime, "  still");
+-			sprintf(length, "logged in");
++			if (fulltime)
++				sprintf(logouttime, "  still logged in");
++			else {
++				sprintf(logouttime, "  still");
++				sprintf(length, "logged in");
++			}
+ 			break;
+ 		case R_PHANTOM:
+ 			length[0] = 0;
+-			sprintf(logouttime, "   gone");
+-			sprintf(length, "- no logout");
++			if (fulltime)
++				sprintf(logouttime, "  gone - no logout");
++			else {
++				sprintf(logouttime, "   gone");
++				sprintf(length, "- no logout");
++			}
+ 			break;
+ 		case R_REBOOT:
+ 			break;
+@@ -455,18 +468,23 @@
+ #endif
+ 		if (!altlist) {
+ 			snprintf(final, sizeof(final),
+-				"%-8.8s %-12.12s %-16.16s "
+-				"%-16.16s %-7.7s %-12.12s\n",
++				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);
+ 		} 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,
+ 				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,
+ 			logintime, logouttime, length);
+@@ -496,7 +514,7 @@
+ {
+ 	fprintf(stderr, "Usage: %s [-num | -n num] [-f file] "
+ 			"[-t YYYYMMDDHHMMSS] "
+-			"[-R] [-adiox] [username..] [tty..]\n", s);
++			"[-R] [-adioxF] [username..] [tty..]\n", s);
+ 	exit(1);
+ }
+ 
+@@ -565,7 +583,7 @@
+   progname = mybasename(argv[0]);
+ 
+   /* Process the arguments. */
+-  while((c = getopt(argc, argv, "f:n:Rxadiot:0123456789")) != EOF)
++  while((c = getopt(argc, argv, "f:n:RxadFiot:0123456789")) != EOF)
+     switch(c) {
+ 	case 'R':
+ 		showhost = 0;
+@@ -596,6 +614,9 @@
+ 	case 'a':
+ 		altlist++;
+ 		break;
++	case 'F':
++		fulltime++;
++		break;
+ 	case 't':
+ 		if ((until = parsetm(optarg)) == (time_t)-1) {
+ 			fprintf(stderr, "%s: Invalid time value \"%s\"\n",




More information about the Pkg-sysvinit-commits mailing list