Fix WARNS=4 (-Wshadow -Wcast-qual)

This commit is contained in:
lukem 2009-04-16 05:59:56 +00:00
parent 18f69179c9
commit ed9b940f4a

View File

@ -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 {
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 @@ main(argc, argv)
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 @@ sortoutput(struct output *o)
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)