Skip to content

Commit

Permalink
WARNS=4 love.
Browse files Browse the repository at this point in the history
  • Loading branch information
xtraeme committed May 2, 2008
1 parent 7842d75 commit 9878736
Show file tree
Hide file tree
Showing 9 changed files with 108 additions and 104 deletions.
4 changes: 2 additions & 2 deletions usr.sbin/apm/apm.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $NetBSD: apm.c,v 1.19 2008/04/28 20:24:15 martin Exp $ */
/* $NetBSD: apm.c,v 1.20 2008/05/02 19:59:19 xtraeme Exp $ */

/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
Expand Down Expand Up @@ -150,7 +150,7 @@ main(int argc, char *argv[])
struct apm_command command;
struct apm_reply reply;
struct apm_power_info *api = &reply.batterystate;
char *sockname = _PATH_APM_SOCKET;
const char *sockname = _PATH_APM_SOCKET;
enum apm_action action = NONE;
int ch, doac, dobstate, domin, dopct, dostatus, fd, nodaemon,
rval, verbose;
Expand Down
6 changes: 3 additions & 3 deletions usr.sbin/catman/catman.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $NetBSD: catman.c,v 1.27 2008/04/28 20:24:15 martin Exp $ */
/* $NetBSD: catman.c,v 1.28 2008/05/02 19:59:19 xtraeme Exp $ */

/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
Expand Down Expand Up @@ -134,8 +134,8 @@ setdefentries(char *m_path, char *m_add, const char *sections)
{
TAG *defnewp, *sectnewp, *subp;
ENTRY *e_defp, *e_subp;
const char *p;
char *slashp, *machine;
const char *p, *slashp;
char *machine;
char buf[MAXPATHLEN * 2];
int i;

Expand Down
4 changes: 2 additions & 2 deletions usr.sbin/chrtbl/chrtbl.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $NetBSD: chrtbl.c,v 1.9 2006/03/19 07:04:06 phil Exp $ */
/* $NetBSD: chrtbl.c,v 1.10 2008/05/02 19:59:19 xtraeme Exp $ */

/*
* Copyright (c) 1997 Christos Zoulas. All rights reserved.
Expand Down Expand Up @@ -63,7 +63,7 @@ static int output_binary __P((const struct chartbl *));
int main __P((int, char *[]));

static const struct toklist {
char *name;
const char *name;
int (*func) __P((struct chartbl *, const char *, int arg,
char *, size_t lno));
int arg;
Expand Down
5 changes: 3 additions & 2 deletions usr.sbin/cnwctl/cnwctl.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $NetBSD: cnwctl.c,v 1.6 2001/08/18 17:10:04 ad Exp $ */
/* $NetBSD: cnwctl.c,v 1.7 2008/05/02 19:59:19 xtraeme Exp $ */

/*
* Copyright (c) 1997 Berkeley Software Design, Inc.
Expand Down Expand Up @@ -60,7 +60,8 @@ int
main(int argc, char **argv)
{
int c, domain, i, key, rate, sflag, Sflag, skt;
char *e, *interface;
const char *interface;
char *e;
struct ifreq ifr;
struct cnwistats cnwis, onwis;
struct cnwstatus cnws;
Expand Down
20 changes: 11 additions & 9 deletions usr.sbin/diskpart/diskpart.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1988, 1993\n\
#if 0
static char sccsid[] = "from: @(#)diskpart.c 8.3 (Berkeley) 11/30/94";
#else
__RCSID("$NetBSD: diskpart.c,v 1.15 2004/10/29 21:21:42 dsl Exp $");
__RCSID("$NetBSD: diskpart.c,v 1.16 2008/05/02 19:59:19 xtraeme Exp $");
#endif
#endif /* not lint */

Expand Down Expand Up @@ -128,7 +128,8 @@ main(argc, argv)
int curcyl, spc, def, part, layout, j, ch;
int threshhold, numcyls[NPARTITIONS], startcyl[NPARTITIONS];
off_t totsize = 0;
char *lp, *tyname;
const char *tyname;
char *lp;

while ((ch = getopt(argc, argv, "pds:")) != -1) {
switch (ch) {
Expand Down Expand Up @@ -365,15 +366,15 @@ main(argc, argv)
struct disklabel disk;

struct field {
char *f_name;
char *f_defaults;
const char *f_name;
const char *f_defaults;
u_int32_t *f_location;
} fields[] = {
{ "sector size", "512", &disk.d_secsize },
{ "#sectors/track", 0, &disk.d_nsectors },
{ "#tracks/cylinder", 0, &disk.d_ntracks },
{ "#cylinders", 0, &disk.d_ncylinders },
{ 0, 0, 0 },
{ "#sectors/track", NULL, &disk.d_nsectors },
{ "#tracks/cylinder", NULL, &disk.d_ntracks },
{ "#cylinders", NULL, &disk.d_ncylinders },
{ NULL, NULL, 0 },
};

struct disklabel *
Expand Down Expand Up @@ -462,7 +463,8 @@ promptfordisk(name)
fprintf(stderr, "no default value\n");
goto again;
}
cp = fp->f_defaults;
/* XXX __UNCONST */
cp = __UNCONST(fp->f_defaults);
}
*fp->f_location = atol(cp);
if (*fp->f_location == 0) {
Expand Down
102 changes: 51 additions & 51 deletions usr.sbin/edquota/edquota.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1990, 1993\n\
#if 0
static char sccsid[] = "from: @(#)edquota.c 8.3 (Berkeley) 4/27/95";
#else
__RCSID("$NetBSD: edquota.c,v 1.27 2006/05/26 13:21:47 jnemeth Exp $");
__RCSID("$NetBSD: edquota.c,v 1.28 2008/05/02 19:59:19 xtraeme Exp $");
#endif
#endif /* not lint */

Expand All @@ -66,9 +66,9 @@ __RCSID("$NetBSD: edquota.c,v 1.27 2006/05/26 13:21:47 jnemeth Exp $");
#include <unistd.h>
#include "pathnames.h"

char *qfname = QUOTAFILENAME;
char *qfextension[] = INITQFNAMES;
char *quotagroup = QUOTAGROUP;
const char *qfname = QUOTAFILENAME;
const char *qfextension[] = INITQFNAMES;
const char *quotagroup = QUOTAGROUP;
char tmpfil[] = _PATH_TMP;

struct quotause {
Expand All @@ -84,7 +84,7 @@ struct quotause {

int main __P((int, char **));
void usage __P((void));
int getentry __P((char *, int));
int getentry __P((const char *, int));
struct quotause *
getprivs __P((long, int, char *));
void putprivs __P((long, int, struct quotause *));
Expand All @@ -96,7 +96,7 @@ int readtimes __P((struct quotause *, int));
char * cvtstoa __P((time_t));
int cvtatos __P((time_t, char *, time_t *));
void freeprivs __P((struct quotause *));
int alldigits __P((char *));
int alldigits __P((const char *));
int hasquota __P((struct fstab *, int, char **));

int
Expand Down Expand Up @@ -167,7 +167,7 @@ main(argc, argv)
exit(0);
}
if (soft || hard) {
struct quotause *qup;
struct quotause *lqup;
u_int32_t softb, hardb, softi, hardi;
if (tflag)
usage();
Expand All @@ -185,26 +185,26 @@ main(argc, argv)
if ((id = getentry(*argv, quotatype)) == -1)
continue;
curprivs = getprivs(id, quotatype, fs);
for (qup = curprivs; qup; qup = qup->next) {
for (lqup = curprivs; lqup; lqup = lqup->next) {
if (soft) {
if (softb &&
qup->dqblk.dqb_curblocks >= softb &&
(qup->dqblk.dqb_bsoftlimit == 0 ||
qup->dqblk.dqb_curblocks <
qup->dqblk.dqb_bsoftlimit))
qup->dqblk.dqb_btime = 0;
lqup->dqblk.dqb_curblocks >= softb &&
(lqup->dqblk.dqb_bsoftlimit == 0 ||
lqup->dqblk.dqb_curblocks <
lqup->dqblk.dqb_bsoftlimit))
lqup->dqblk.dqb_btime = 0;
if (softi &&
qup->dqblk.dqb_curinodes >= softi &&
(qup->dqblk.dqb_isoftlimit == 0 ||
qup->dqblk.dqb_curinodes <
qup->dqblk.dqb_isoftlimit))
qup->dqblk.dqb_itime = 0;
qup->dqblk.dqb_bsoftlimit = softb;
qup->dqblk.dqb_isoftlimit = softi;
lqup->dqblk.dqb_curinodes >= softi &&
(lqup->dqblk.dqb_isoftlimit == 0 ||
lqup->dqblk.dqb_curinodes <
lqup->dqblk.dqb_isoftlimit))
lqup->dqblk.dqb_itime = 0;
lqup->dqblk.dqb_bsoftlimit = softb;
lqup->dqblk.dqb_isoftlimit = softi;
}
if (hard) {
qup->dqblk.dqb_bhardlimit = hardb;
qup->dqblk.dqb_ihardlimit = hardi;
lqup->dqblk.dqb_bhardlimit = hardb;
lqup->dqblk.dqb_ihardlimit = hardi;
}
}
putprivs(id, quotatype, curprivs);
Expand Down Expand Up @@ -261,7 +261,7 @@ usage()
*/
int
getentry(name, quotatype)
char *name;
const char *name;
int quotatype;
{
struct passwd *pw;
Expand Down Expand Up @@ -409,11 +409,11 @@ putprivs(id, quotatype, quplist)
* Take a list of privileges and get it edited.
*/
int
editit(tmpfile)
char *tmpfile;
editit(ltmpfile)
char *ltmpfile;
{
long omask;
int pid, stat;
int pid, lst;
char p[MAX_TMPSTR];

omask = sigblock(sigmask(SIGINT)|sigmask(SIGQUIT)|sigmask(SIGHUP));
Expand All @@ -432,23 +432,23 @@ editit(tmpfile)
return (0);
}
if (pid == 0) {
char *ed;
const char *ed;

sigsetmask(omask);
setgid(getgid());
setuid(getuid());
if ((ed = getenv("EDITOR")) == (char *)0)
ed = _PATH_VI;
if (strlen(ed) + strlen(tmpfile) + 2 >= MAX_TMPSTR) {
if (strlen(ed) + strlen(ltmpfile) + 2 >= MAX_TMPSTR) {
err (1, "%s", "editor or filename too long");
}
snprintf (p, MAX_TMPSTR, "%s %s", ed, tmpfile);
snprintf (p, MAX_TMPSTR, "%s %s", ed, ltmpfile);
execlp(_PATH_BSHELL, _PATH_BSHELL, "-c", p, NULL);
err(1, "%s", ed);
}
waitpid(pid, &stat, 0);
waitpid(pid, &lst, 0);
sigsetmask(omask);
if (!WIFEXITED(stat) || WEXITSTATUS(stat) != 0)
if (!WIFEXITED(lst) || WEXITSTATUS(lst) != 0)
return (0);
return (1);
}
Expand Down Expand Up @@ -709,44 +709,44 @@ readtimes(quplist, infd)
* Convert seconds to ASCII times.
*/
char *
cvtstoa(time)
time_t time;
cvtstoa(ltime)
time_t ltime;
{
static char buf[20];

if (time % (24 * 60 * 60) == 0) {
time /= 24 * 60 * 60;
snprintf(buf, sizeof buf, "%ld day%s", (long)time,
time == 1 ? "" : "s");
} else if (time % (60 * 60) == 0) {
time /= 60 * 60;
sprintf(buf, "%ld hour%s", (long)time, time == 1 ? "" : "s");
} else if (time % 60 == 0) {
time /= 60;
sprintf(buf, "%ld minute%s", (long)time, time == 1 ? "" : "s");
if (ltime % (24 * 60 * 60) == 0) {
ltime /= 24 * 60 * 60;
snprintf(buf, sizeof buf, "%ld day%s", (long)ltime,
ltime == 1 ? "" : "s");
} else if (ltime % (60 * 60) == 0) {
ltime /= 60 * 60;
sprintf(buf, "%ld hour%s", (long)ltime, ltime == 1 ? "" : "s");
} else if (ltime % 60 == 0) {
ltime /= 60;
sprintf(buf, "%ld minute%s", (long)ltime, ltime == 1 ? "" : "s");
} else
sprintf(buf, "%ld second%s", (long)time, time == 1 ? "" : "s");
sprintf(buf, "%ld second%s", (long)ltime, ltime == 1 ? "" : "s");
return (buf);
}

/*
* Convert ASCII input times to seconds.
*/
int
cvtatos(time, units, seconds)
time_t time;
cvtatos(ltime, units, seconds)
time_t ltime;
char *units;
time_t *seconds;
{

if (memcmp(units, "second", 6) == 0)
*seconds = time;
*seconds = ltime;
else if (memcmp(units, "minute", 6) == 0)
*seconds = time * 60;
*seconds = ltime * 60;
else if (memcmp(units, "hour", 4) == 0)
*seconds = time * 60 * 60;
*seconds = ltime * 60 * 60;
else if (memcmp(units, "day", 3) == 0)
*seconds = time * 24 * 60 * 60;
*seconds = ltime * 24 * 60 * 60;
else {
printf("%s: bad units, specify %s\n", units,
"days, hours, minutes, or seconds");
Expand Down Expand Up @@ -775,7 +775,7 @@ freeprivs(quplist)
*/
int
alldigits(s)
char *s;
const char *s;
{
int c;

Expand Down
18 changes: 9 additions & 9 deletions usr.sbin/eshconfig/eshconfig.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $NetBSD: eshconfig.c,v 1.7 2008/04/28 20:24:15 martin Exp $ */
/* $NetBSD: eshconfig.c,v 1.8 2008/05/02 19:59:19 xtraeme Exp $ */

/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
Expand Down Expand Up @@ -32,7 +32,7 @@

#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: eshconfig.c,v 1.7 2008/04/28 20:24:15 martin Exp $");
__RCSID("$NetBSD: eshconfig.c,v 1.8 2008/05/02 19:59:19 xtraeme Exp $");
#endif /* not lint */

#include <sys/param.h>
Expand Down Expand Up @@ -134,9 +134,9 @@ struct ifdrv ifd;
*/

static int
drvspec_ioctl(char *name, int fd, int cmd, int len, caddr_t data)
drvspec_ioctl(char *lname, int fd, int cmd, int len, caddr_t data)
{
strcpy(ifd.ifd_name, name);
strcpy(ifd.ifd_name, lname);
ifd.ifd_cmd = cmd;
ifd.ifd_len = len;
ifd.ifd_data = data;
Expand Down Expand Up @@ -634,7 +634,7 @@ rr_checksum(const u_int32_t *data, int length)

struct stats_values {
int offset;
char *name;
const char *name;
};

struct stats_values stats_values[] = {
Expand Down Expand Up @@ -700,7 +700,7 @@ esh_reset()
}

static void
esh_stats(int get_stats)
esh_stats(int lget_stats)
{
u_int32_t *stats;
long long value;
Expand All @@ -713,14 +713,14 @@ esh_stats(int get_stats)
stats = rr_stats.rs_stats;

value = (((long long) stats[0x78 / 4]) << 32) | stats[0x7c / 4];
if (get_stats == 1 || value > 0)
if (lget_stats == 1 || value > 0)
printf("%12lld bytes sent\n", value);
value = ((long long) stats[0xb8 / 4] << 32) | stats[0xbc / 4];
if (get_stats == 1 || value > 0)
if (lget_stats == 1 || value > 0)
printf("%12lld bytes received\n", value);

for (offset = 0; stats_values[offset].offset != 0; offset++) {
if (get_stats == 1 || stats[stats_values[offset].offset / 4] > 0)
if (lget_stats == 1 || stats[stats_values[offset].offset / 4] > 0)
printf("%12d %s\n", stats[stats_values[offset].offset / 4],
stats_values[offset].name);
}
Expand Down
Loading

0 comments on commit 9878736

Please sign in to comment.