WARNS=4 love.

This commit is contained in:
xtraeme 2008-05-02 19:59:19 +00:00
parent 5a38da5ccf
commit b2bb69490d
9 changed files with 108 additions and 104 deletions

View File

@ -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.
@ -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;

View File

@ -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.
@ -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;

View File

@ -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.
@ -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;

View File

@ -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.
@ -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;

View File

@ -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 */
@ -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) {
@ -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 *
@ -462,7 +463,8 @@ again:
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) {

View File

@ -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 */
@ -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 {
@ -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 *));
@ -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
@ -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();
@ -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);
@ -261,7 +261,7 @@ usage()
*/
int
getentry(name, quotatype)
char *name;
const char *name;
int quotatype;
{
struct passwd *pw;
@ -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));
@ -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);
}
@ -709,23 +709,23 @@ bad:
* 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);
}
@ -733,20 +733,20 @@ cvtstoa(time)
* 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");
@ -775,7 +775,7 @@ freeprivs(quplist)
*/
int
alldigits(s)
char *s;
const char *s;
{
int c;

View File

@ -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.
@ -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>
@ -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;
@ -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[] = {
@ -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;
@ -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);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: fwcontrol.c,v 1.6 2007/11/06 17:02:15 kiyohara Exp $ */
/* $NetBSD: fwcontrol.c,v 1.7 2008/05/02 19:59:19 xtraeme Exp $ */
/*
* Copyright (C) 2002
* Hidetoshi Shimokawa. All rights reserved.
@ -388,7 +388,8 @@ show_crom(u_int32_t *crom_buf)
{
int i;
struct crom_context cc;
char *desc, info[256];
const char *desc;
char info[256];
static const char *key_types = "ICLD";
struct csrreg *reg;
struct csrdirectory *dir;

View File

@ -1,4 +1,4 @@
/* $NetBSD: fwdv.c,v 1.2 2007/11/06 17:02:15 kiyohara Exp $ */
/* $NetBSD: fwdv.c,v 1.3 2008/05/02 19:59:19 xtraeme Exp $ */
/*
* Copyright (C) 2003
* Hidetoshi Shimokawa. All rights reserved.
@ -82,7 +82,7 @@ struct frac pad_rate[2] = {
{203, 2997}, /* = (8000 - 29.97 * 250)/(29.97 * 250) */
{1, 15}, /* = (8000 - 25 * 300)/(25 * 300) */
};
char *system_name[] = {"NTSC", "PAL"};
const char *system_name[] = {"NTSC", "PAL"};
int frame_rate[] = {30, 25};
#define PSIZE 512
@ -107,7 +107,7 @@ dvrecv(int d, const char *filename, char ich, int count)
struct fw_pkt *pkt;
char *pad, *buf;
u_int32_t *ptr;
int len, tlen, npad, fd, k, m, vec, system = -1, nb;
int len, tlen, npad, fd, k, m, vec, lsystem = -1, nb;
int nblocks[] = {250 /* NTSC */, 300 /* PAL */};
struct iovec wbuf[NPACKET_R];
@ -199,17 +199,17 @@ again:
fprintf(stderr, "(%d,%d) ", dv->sct, dv->dseq);
#endif
if (dv->sct == DV_SCT_HEADER && dv->dseq == 0) {
if (system < 0) {
system = ciph->fdf.dv.fs;
if (lsystem < 0) {
lsystem = ciph->fdf.dv.fs;
fprintf(stderr,
"%s\n", system_name[system]);
"%s\n", system_name[lsystem]);
}
/* Fix DSF bit */
if (system == 1 &&
if (lsystem == 1 &&
(dv->payload[0] & DV_DSF_12) == 0)
dv->payload[0] |= DV_DSF_12;
nb = nblocks[system];
nb = nblocks[lsystem];
fprintf(stderr, "%d", k%10);
#if FIX_FRAME
if (m > 0 && m != nb) {
@ -229,7 +229,7 @@ again:
}
#endif
k++;
if (k % frame_rate[system] == 0) {
if (k % frame_rate[lsystem] == 0) {
/* every second */
fprintf(stderr, "\n");
}
@ -268,7 +268,7 @@ dvsend(int d, const char *filename, char ich, int count)
struct dvdbc *dv;
struct fw_pkt *pkt;
int len, tlen, header, fd, frames, packets, vec, offset, nhdr, i;
int system=-1, pad_acc, cycle_acc, cycle, f_cycle, f_frac;
int lsystem=-1, pad_acc, cycle_acc, cycle, f_cycle, f_frac;
struct iovec wbuf[TNBUF*2 + NEMPTY];
char *pbuf;
u_int32_t iso_data, iso_empty, hdr[TNBUF + NEMPTY][3];
@ -353,42 +353,42 @@ next:
#if 0
header = (dv->sct == 0 && dv->dseq == 0);
#else
header = (packets == 0 || packets % npackets[system] == 0);
header = (packets == 0 || packets % npackets[lsystem] == 0);
#endif
ciph = (struct ciphdr *)&hdr[nhdr][1];
if (header) {
if (system < 0) {
system = ((dv->payload[0] & DV_DSF_12) != 0);
printf("%s\n", system_name[system]);
if (lsystem < 0) {
lsystem = ((dv->payload[0] & DV_DSF_12) != 0);
printf("%s\n", system_name[lsystem]);
cycle = 1;
cycle_acc = frame_cycle[system].d * cycle;
cycle_acc = frame_cycle[lsystem].d * cycle;
}
fprintf(stderr, "%d", frames % 10);
frames ++;
if (count > 0 && frames > count)
break;
if (frames % frame_rate[system] == 0)
if (frames % frame_rate[lsystem] == 0)
fprintf(stderr, "\n");
fflush(stderr);
f_cycle = (cycle_acc / frame_cycle[system].d) & 0xf;
f_frac = (cycle_acc % frame_cycle[system].d
* CYCLE_FRAC) / frame_cycle[system].d;
f_cycle = (cycle_acc / frame_cycle[lsystem].d) & 0xf;
f_frac = (cycle_acc % frame_cycle[lsystem].d
* CYCLE_FRAC) / frame_cycle[lsystem].d;
#if 0
ciph->fdf.dv.cyc = htons(f_cycle << 12 | f_frac);
#else
ciph->fdf.dv.cyc = htons(cycle << 12 | f_frac);
#endif
cycle_acc += frame_cycle[system].n;
cycle_acc %= frame_cycle[system].d * 0x10;
cycle_acc += frame_cycle[lsystem].n;
cycle_acc %= frame_cycle[lsystem].d * 0x10;
} else {
ciph->fdf.dv.cyc = 0xffff;
}
ciph->dbc = packets++ % 256;
pad_acc += pad_rate[system].n;
if (pad_acc >= pad_rate[system].d) {
pad_acc -= pad_rate[system].d;
pad_acc += pad_rate[lsystem].n;
if (pad_acc >= pad_rate[lsystem].d) {
pad_acc -= pad_rate[lsystem].d;
bcopy(hdr[nhdr], hdr[nhdr+1], sizeof(hdr[0]));
hdr[nhdr][0] = iso_empty;
wbuf[vec].iov_base = (char *)hdr[nhdr];