Module Name: src
Committed By: lukem
Date: Thu Apr 16 05:59:56 UTC 2009
Modified Files:
src/usr.sbin/lastlogin: lastlogin.c
Log Message:
Fix WARNS=4 (-Wshadow -Wcast-qual)
To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/usr.sbin/lastlogin/lastlogin.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.sbin/lastlogin/lastlogin.c
diff -u src/usr.sbin/lastlogin/lastlogin.c:1.13 src/usr.sbin/lastlogin/lastlogin.c:1.14
--- src/usr.sbin/lastlogin/lastlogin.c:1.13 Sat Apr 9 02:13:20 2005
+++ src/usr.sbin/lastlogin/lastlogin.c Thu Apr 16 05:59:56 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: lastlogin.c,v 1.13 2005/04/09 02:13:20 atatat Exp $ */
+/* $NetBSD: lastlogin.c,v 1.14 2009/04/16 05:59:56 lukem Exp $ */
/*
* Copyright (c) 1996 John M. Vinopal
* All rights reserved.
@@ -33,7 +33,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: lastlogin.c,v 1.13 2005/04/09 02:13:20 atatat Exp $");
+__RCSID("$NetBSD: lastlogin.c,v 1.14 2009/04/16 05:59:56 lukem Exp $");
#endif
#include <sys/types.h>
@@ -66,15 +66,6 @@
struct output *next;
};
-static char *logfile =
-#if defined(SUPPORT_UTMPX)
- _PATH_LASTLOGX;
-#elif defined(SUPPORT_UTMP)
- _PATH_LASTLOG;
-#else
- #error "either SUPPORT_UTMP or SUPPORT_UTMPX must be defined"
-#endif
-
#define SORT_NONE 0x0000
#define SORT_REVERSE 0x0001
#define SORT_TIME 0x0002
@@ -108,6 +99,14 @@
int argc;
char *argv[];
{
+ const char *logfile =
+#if defined(SUPPORT_UTMPX)
+ _PATH_LASTLOGX;
+#elif defined(SUPPORT_UTMP)
+ _PATH_LASTLOG;
+#else
+ #error "either SUPPORT_UTMP or SUPPORT_UTMPX must be defined"
+#endif
int ch;
size_t len;
@@ -410,8 +409,8 @@
static int
comparelog(const void *left, const void *right)
{
- struct output *l = *(struct output **)left;
- struct output *r = *(struct output **)right;
+ const struct output *l = *(const struct output * const *)left;
+ const struct output *r = *(const struct output * const *)right;
int order = (sortlog&SORT_REVERSE)?-1:1;
if (l->o_tv.tv_sec < r->o_tv.tv_sec)