Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

(patch) some fixes in last(1)

From: Andrey Matveev <andrushock(at)korovino.net>
Date: Sat Apr 05 2003 - 18:51:50 EST


Changes the following:
- fix date format in error message and comments - proper usage() (add missed `]', remove `n')

Index: usr.bin/last/last.c



RCS file: /cvs/src/usr.bin/last/last.c,v retrieving revision 1.21
diff -u -r1.21 last.c
--- usr.bin/last/last.c	2003/04/05 16:24:59	1.21
+++ usr.bin/last/last.c	2003/04/05 22:41:06

@@ -105,6 +105,7 @@
int want(struct utmp *, int); void wtmp(void); void checkargs(void); +void usage(void); #define NAME_WIDTH 8 #define HOST_WIDTH 24
@@ -163,11 +164,7 @@
break; case '?': default: - (void)fprintf(stderr, - "usage: last [-#] [-cns] [-f file] [-T] [-t tty]" - " [-h host] [-d [[CC]YY][MMDD]hhmm[.SS]" - " [user ...]\n"); - exit(1); + usage(); } if (argc) {

@@ -570,7 +567,7 @@
 /*
  * dateconv --
  * Convert the snapshot time in command line given in the format
- *	[[CC]YY][MMDD]hhmm[.ss]] to a time_t.
+ *	[[CC]YY][MMDD]hhmm[.SS]] to a time_t.
  *	Derived from atime_arg1() in usr.bin/touch/touch.c
  */

 time_t
@@ -588,7 +585,7 @@
 	if ((t = localtime(&timet)) == NULL)
 		err(1, "localtime");
 
-	/* [[yy]yy][mmdd]hhmm[.ss] */
+	/* [[CC]YY][MMDD]hhmm[.SS] */
 	if ((p = strchr(arg, '.')) == NULL)
 		t->tm_sec = 0;		/* Seconds defaults to 0. */
 	else {

@@ -600,12 +597,12 @@
 
 	yearset = 0;
 	switch (strlen(arg)) {
-	case 12:			/* ccyymmddhhmm */
+	case 12:			/* CCYYMMDDhhmm */
 		t->tm_year = ATOI2(arg);
 		t->tm_year *= 100;
 		yearset = 1;
 		/* FALLTHOUGH */
-	case 10:			/* yymmddhhmm */
+	case 10:			/* YYMMDDhhmm */
 		if (yearset) {
 			yearset = ATOI2(arg);
 			t->tm_year += yearset;

@@ -636,8 +633,8 @@
timet = mktime(t); if (timet == -1) terr: errx(1, - "out of range or illegal time specification: [[yy]yy][mmdd]hhmm[.ss]"); - return timet; + "out of range or illegal time specification: [[CC]YY][MMDD]hhmm[.SS]"); + return (timet);

 }    

@@ -657,4 +654,15 @@

 	if (signo == SIGINT)
 		exit(1);
 	(void)fflush(stdout);			/* fix required for rsh */
+}
+
+void
+usage(void)
+{
+	extern char *__progname;
+
+	fprintf(stderr,
+	    "usage: %s [-#] [-csT] [-f file] [-t tty] [-h host]"
+	    " [-d [[CC]YY][MMDD]hhmm[.SS]] [user ...]\n", __progname);
Do you need help?X
+ exit(1);

 } Received on Sat Apr 5 17:50:26 2003

This archive was generated by hypermail 2.1.8 : Wed Aug 23 2006 - 13:29:53 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library