Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37891988
en ru br
Репозитории ALT
5.1: 2.86-alt2
4.1: 2.86-alt2
4.0: 2.86-alt1
3.0: 2.85-alt8
www.altlinux.org/Changes

Группа :: Система/Настройка/Загрузка и инициализация
Пакет: SysVinit

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: sysvinit-2.86-suse-last-F.patch
Скачать


--- sysvinit-2.86.orig/man/last.1	2007-01-06 15:18:07 +0000
+++ sysvinit-2.86/man/last.1	2007-01-06 15:26:23 +0000
@@ -12,7 +12,7 @@ last, lastb \- show listing of last logg
 .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 @@ last, lastb \- show listing of last logg
 .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 @@ with the next flag.
 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.
--- sysvinit-2.86.orig/src/last.c	2007-01-06 15:18:07 +0000
+++ sysvinit-2.86/src/last.c	2007-01-06 15:30:11 +0000
@@ -70,6 +70,7 @@ 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 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 */
@@ -388,9 +389,13 @@ int list(struct utmp *p, time_t t, int w
 	 */
 	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;
@@ -409,13 +414,21 @@ int list(struct utmp *p, time_t t, int w
 			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;
@@ -450,18 +463,23 @@ int list(struct utmp *p, time_t t, int w
 #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);
@@ -491,7 +509,8 @@ void usage(char *s)
 {
 	fprintf(stderr, "Usage: %s [-num | -n num] [-f file] "
 			"[-t YYYYMMDDHHMMSS] "
-			"[-R] [-x] [-o] [username..] [tty..]\n", s);
+			"[-R] [-a] [-d] [-F] [-i] [-o] [-x] "
+			"[username..] [tty..]\n", s);
 	exit(1);
 }
 
@@ -560,7 +579,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:RxadFiot:0123456789")) != EOF)
     switch(c) {
 	case 'R':
 		showhost = 0;
@@ -591,6 +610,9 @@ int main(int argc, char **argv)
 	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",
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin