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. * Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -150,7 +150,7 @@ main(int argc, char *argv[])
struct apm_command command; struct apm_command command;
struct apm_reply reply; struct apm_reply reply;
struct apm_power_info *api = &reply.batterystate; struct apm_power_info *api = &reply.batterystate;
char *sockname = _PATH_APM_SOCKET; const char *sockname = _PATH_APM_SOCKET;
enum apm_action action = NONE; enum apm_action action = NONE;
int ch, doac, dobstate, domin, dopct, dostatus, fd, nodaemon, int ch, doac, dobstate, domin, dopct, dostatus, fd, nodaemon,
rval, verbose; 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. * 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; TAG *defnewp, *sectnewp, *subp;
ENTRY *e_defp, *e_subp; ENTRY *e_defp, *e_subp;
const char *p; const char *p, *slashp;
char *slashp, *machine; char *machine;
char buf[MAXPATHLEN * 2]; char buf[MAXPATHLEN * 2];
int i; 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. * 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 *[])); int main __P((int, char *[]));
static const struct toklist { static const struct toklist {
char *name; const char *name;
int (*func) __P((struct chartbl *, const char *, int arg, int (*func) __P((struct chartbl *, const char *, int arg,
char *, size_t lno)); char *, size_t lno));
int arg; 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. * Copyright (c) 1997 Berkeley Software Design, Inc.
@ -60,7 +60,8 @@ int
main(int argc, char **argv) main(int argc, char **argv)
{ {
int c, domain, i, key, rate, sflag, Sflag, skt; int c, domain, i, key, rate, sflag, Sflag, skt;
char *e, *interface; const char *interface;
char *e;
struct ifreq ifr; struct ifreq ifr;
struct cnwistats cnwis, onwis; struct cnwistats cnwis, onwis;
struct cnwstatus cnws; struct cnwstatus cnws;

View File

@ -37,7 +37,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1988, 1993\n\
#if 0 #if 0
static char sccsid[] = "from: @(#)diskpart.c 8.3 (Berkeley) 11/30/94"; static char sccsid[] = "from: @(#)diskpart.c 8.3 (Berkeley) 11/30/94";
#else #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
#endif /* not lint */ #endif /* not lint */
@ -128,7 +128,8 @@ main(argc, argv)
int curcyl, spc, def, part, layout, j, ch; int curcyl, spc, def, part, layout, j, ch;
int threshhold, numcyls[NPARTITIONS], startcyl[NPARTITIONS]; int threshhold, numcyls[NPARTITIONS], startcyl[NPARTITIONS];
off_t totsize = 0; off_t totsize = 0;
char *lp, *tyname; const char *tyname;
char *lp;
while ((ch = getopt(argc, argv, "pds:")) != -1) { while ((ch = getopt(argc, argv, "pds:")) != -1) {
switch (ch) { switch (ch) {
@ -365,15 +366,15 @@ main(argc, argv)
struct disklabel disk; struct disklabel disk;
struct field { struct field {
char *f_name; const char *f_name;
char *f_defaults; const char *f_defaults;
u_int32_t *f_location; u_int32_t *f_location;
} fields[] = { } fields[] = {
{ "sector size", "512", &disk.d_secsize }, { "sector size", "512", &disk.d_secsize },
{ "#sectors/track", 0, &disk.d_nsectors }, { "#sectors/track", NULL, &disk.d_nsectors },
{ "#tracks/cylinder", 0, &disk.d_ntracks }, { "#tracks/cylinder", NULL, &disk.d_ntracks },
{ "#cylinders", 0, &disk.d_ncylinders }, { "#cylinders", NULL, &disk.d_ncylinders },
{ 0, 0, 0 }, { NULL, NULL, 0 },
}; };
struct disklabel * struct disklabel *
@ -462,7 +463,8 @@ again:
fprintf(stderr, "no default value\n"); fprintf(stderr, "no default value\n");
goto again; goto again;
} }
cp = fp->f_defaults; /* XXX __UNCONST */
cp = __UNCONST(fp->f_defaults);
} }
*fp->f_location = atol(cp); *fp->f_location = atol(cp);
if (*fp->f_location == 0) { if (*fp->f_location == 0) {

View File

@ -40,7 +40,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1990, 1993\n\
#if 0 #if 0
static char sccsid[] = "from: @(#)edquota.c 8.3 (Berkeley) 4/27/95"; static char sccsid[] = "from: @(#)edquota.c 8.3 (Berkeley) 4/27/95";
#else #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
#endif /* not lint */ #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 <unistd.h>
#include "pathnames.h" #include "pathnames.h"
char *qfname = QUOTAFILENAME; const char *qfname = QUOTAFILENAME;
char *qfextension[] = INITQFNAMES; const char *qfextension[] = INITQFNAMES;
char *quotagroup = QUOTAGROUP; const char *quotagroup = QUOTAGROUP;
char tmpfil[] = _PATH_TMP; char tmpfil[] = _PATH_TMP;
struct quotause { struct quotause {
@ -84,7 +84,7 @@ struct quotause {
int main __P((int, char **)); int main __P((int, char **));
void usage __P((void)); void usage __P((void));
int getentry __P((char *, int)); int getentry __P((const char *, int));
struct quotause * struct quotause *
getprivs __P((long, int, char *)); getprivs __P((long, int, char *));
void putprivs __P((long, int, struct quotause *)); void putprivs __P((long, int, struct quotause *));
@ -96,7 +96,7 @@ int readtimes __P((struct quotause *, int));
char * cvtstoa __P((time_t)); char * cvtstoa __P((time_t));
int cvtatos __P((time_t, char *, time_t *)); int cvtatos __P((time_t, char *, time_t *));
void freeprivs __P((struct quotause *)); void freeprivs __P((struct quotause *));
int alldigits __P((char *)); int alldigits __P((const char *));
int hasquota __P((struct fstab *, int, char **)); int hasquota __P((struct fstab *, int, char **));
int int
@ -167,7 +167,7 @@ main(argc, argv)
exit(0); exit(0);
} }
if (soft || hard) { if (soft || hard) {
struct quotause *qup; struct quotause *lqup;
u_int32_t softb, hardb, softi, hardi; u_int32_t softb, hardb, softi, hardi;
if (tflag) if (tflag)
usage(); usage();
@ -185,26 +185,26 @@ main(argc, argv)
if ((id = getentry(*argv, quotatype)) == -1) if ((id = getentry(*argv, quotatype)) == -1)
continue; continue;
curprivs = getprivs(id, quotatype, fs); curprivs = getprivs(id, quotatype, fs);
for (qup = curprivs; qup; qup = qup->next) { for (lqup = curprivs; lqup; lqup = lqup->next) {
if (soft) { if (soft) {
if (softb && if (softb &&
qup->dqblk.dqb_curblocks >= softb && lqup->dqblk.dqb_curblocks >= softb &&
(qup->dqblk.dqb_bsoftlimit == 0 || (lqup->dqblk.dqb_bsoftlimit == 0 ||
qup->dqblk.dqb_curblocks < lqup->dqblk.dqb_curblocks <
qup->dqblk.dqb_bsoftlimit)) lqup->dqblk.dqb_bsoftlimit))
qup->dqblk.dqb_btime = 0; lqup->dqblk.dqb_btime = 0;
if (softi && if (softi &&
qup->dqblk.dqb_curinodes >= softi && lqup->dqblk.dqb_curinodes >= softi &&
(qup->dqblk.dqb_isoftlimit == 0 || (lqup->dqblk.dqb_isoftlimit == 0 ||
qup->dqblk.dqb_curinodes < lqup->dqblk.dqb_curinodes <
qup->dqblk.dqb_isoftlimit)) lqup->dqblk.dqb_isoftlimit))
qup->dqblk.dqb_itime = 0; lqup->dqblk.dqb_itime = 0;
qup->dqblk.dqb_bsoftlimit = softb; lqup->dqblk.dqb_bsoftlimit = softb;
qup->dqblk.dqb_isoftlimit = softi; lqup->dqblk.dqb_isoftlimit = softi;
} }
if (hard) { if (hard) {
qup->dqblk.dqb_bhardlimit = hardb; lqup->dqblk.dqb_bhardlimit = hardb;
qup->dqblk.dqb_ihardlimit = hardi; lqup->dqblk.dqb_ihardlimit = hardi;
} }
} }
putprivs(id, quotatype, curprivs); putprivs(id, quotatype, curprivs);
@ -261,7 +261,7 @@ usage()
*/ */
int int
getentry(name, quotatype) getentry(name, quotatype)
char *name; const char *name;
int quotatype; int quotatype;
{ {
struct passwd *pw; struct passwd *pw;
@ -409,11 +409,11 @@ putprivs(id, quotatype, quplist)
* Take a list of privileges and get it edited. * Take a list of privileges and get it edited.
*/ */
int int
editit(tmpfile) editit(ltmpfile)
char *tmpfile; char *ltmpfile;
{ {
long omask; long omask;
int pid, stat; int pid, lst;
char p[MAX_TMPSTR]; char p[MAX_TMPSTR];
omask = sigblock(sigmask(SIGINT)|sigmask(SIGQUIT)|sigmask(SIGHUP)); omask = sigblock(sigmask(SIGINT)|sigmask(SIGQUIT)|sigmask(SIGHUP));
@ -432,23 +432,23 @@ editit(tmpfile)
return (0); return (0);
} }
if (pid == 0) { if (pid == 0) {
char *ed; const char *ed;
sigsetmask(omask); sigsetmask(omask);
setgid(getgid()); setgid(getgid());
setuid(getuid()); setuid(getuid());
if ((ed = getenv("EDITOR")) == (char *)0) if ((ed = getenv("EDITOR")) == (char *)0)
ed = _PATH_VI; 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"); 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); execlp(_PATH_BSHELL, _PATH_BSHELL, "-c", p, NULL);
err(1, "%s", ed); err(1, "%s", ed);
} }
waitpid(pid, &stat, 0); waitpid(pid, &lst, 0);
sigsetmask(omask); sigsetmask(omask);
if (!WIFEXITED(stat) || WEXITSTATUS(stat) != 0) if (!WIFEXITED(lst) || WEXITSTATUS(lst) != 0)
return (0); return (0);
return (1); return (1);
} }
@ -709,23 +709,23 @@ bad:
* Convert seconds to ASCII times. * Convert seconds to ASCII times.
*/ */
char * char *
cvtstoa(time) cvtstoa(ltime)
time_t time; time_t ltime;
{ {
static char buf[20]; static char buf[20];
if (time % (24 * 60 * 60) == 0) { if (ltime % (24 * 60 * 60) == 0) {
time /= 24 * 60 * 60; ltime /= 24 * 60 * 60;
snprintf(buf, sizeof buf, "%ld day%s", (long)time, snprintf(buf, sizeof buf, "%ld day%s", (long)ltime,
time == 1 ? "" : "s"); ltime == 1 ? "" : "s");
} else if (time % (60 * 60) == 0) { } else if (ltime % (60 * 60) == 0) {
time /= 60 * 60; ltime /= 60 * 60;
sprintf(buf, "%ld hour%s", (long)time, time == 1 ? "" : "s"); sprintf(buf, "%ld hour%s", (long)ltime, ltime == 1 ? "" : "s");
} else if (time % 60 == 0) { } else if (ltime % 60 == 0) {
time /= 60; ltime /= 60;
sprintf(buf, "%ld minute%s", (long)time, time == 1 ? "" : "s"); sprintf(buf, "%ld minute%s", (long)ltime, ltime == 1 ? "" : "s");
} else } else
sprintf(buf, "%ld second%s", (long)time, time == 1 ? "" : "s"); sprintf(buf, "%ld second%s", (long)ltime, ltime == 1 ? "" : "s");
return (buf); return (buf);
} }
@ -733,20 +733,20 @@ cvtstoa(time)
* Convert ASCII input times to seconds. * Convert ASCII input times to seconds.
*/ */
int int
cvtatos(time, units, seconds) cvtatos(ltime, units, seconds)
time_t time; time_t ltime;
char *units; char *units;
time_t *seconds; time_t *seconds;
{ {
if (memcmp(units, "second", 6) == 0) if (memcmp(units, "second", 6) == 0)
*seconds = time; *seconds = ltime;
else if (memcmp(units, "minute", 6) == 0) else if (memcmp(units, "minute", 6) == 0)
*seconds = time * 60; *seconds = ltime * 60;
else if (memcmp(units, "hour", 4) == 0) else if (memcmp(units, "hour", 4) == 0)
*seconds = time * 60 * 60; *seconds = ltime * 60 * 60;
else if (memcmp(units, "day", 3) == 0) else if (memcmp(units, "day", 3) == 0)
*seconds = time * 24 * 60 * 60; *seconds = ltime * 24 * 60 * 60;
else { else {
printf("%s: bad units, specify %s\n", units, printf("%s: bad units, specify %s\n", units,
"days, hours, minutes, or seconds"); "days, hours, minutes, or seconds");
@ -775,7 +775,7 @@ freeprivs(quplist)
*/ */
int int
alldigits(s) alldigits(s)
char *s; const char *s;
{ {
int c; 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. * Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -32,7 +32,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #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 */ #endif /* not lint */
#include <sys/param.h> #include <sys/param.h>
@ -134,9 +134,9 @@ struct ifdrv ifd;
*/ */
static int 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_cmd = cmd;
ifd.ifd_len = len; ifd.ifd_len = len;
ifd.ifd_data = data; ifd.ifd_data = data;
@ -634,7 +634,7 @@ rr_checksum(const u_int32_t *data, int length)
struct stats_values { struct stats_values {
int offset; int offset;
char *name; const char *name;
}; };
struct stats_values stats_values[] = { struct stats_values stats_values[] = {
@ -700,7 +700,7 @@ esh_reset()
} }
static void static void
esh_stats(int get_stats) esh_stats(int lget_stats)
{ {
u_int32_t *stats; u_int32_t *stats;
long long value; long long value;
@ -713,14 +713,14 @@ esh_stats(int get_stats)
stats = rr_stats.rs_stats; stats = rr_stats.rs_stats;
value = (((long long) stats[0x78 / 4]) << 32) | stats[0x7c / 4]; 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); printf("%12lld bytes sent\n", value);
value = ((long long) stats[0xb8 / 4] << 32) | stats[0xbc / 4]; 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); printf("%12lld bytes received\n", value);
for (offset = 0; stats_values[offset].offset != 0; offset++) { 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], printf("%12d %s\n", stats[stats_values[offset].offset / 4],
stats_values[offset].name); 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 * Copyright (C) 2002
* Hidetoshi Shimokawa. All rights reserved. * Hidetoshi Shimokawa. All rights reserved.
@ -388,7 +388,8 @@ show_crom(u_int32_t *crom_buf)
{ {
int i; int i;
struct crom_context cc; struct crom_context cc;
char *desc, info[256]; const char *desc;
char info[256];
static const char *key_types = "ICLD"; static const char *key_types = "ICLD";
struct csrreg *reg; struct csrreg *reg;
struct csrdirectory *dir; 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 * Copyright (C) 2003
* Hidetoshi Shimokawa. All rights reserved. * Hidetoshi Shimokawa. All rights reserved.
@ -82,7 +82,7 @@ struct frac pad_rate[2] = {
{203, 2997}, /* = (8000 - 29.97 * 250)/(29.97 * 250) */ {203, 2997}, /* = (8000 - 29.97 * 250)/(29.97 * 250) */
{1, 15}, /* = (8000 - 25 * 300)/(25 * 300) */ {1, 15}, /* = (8000 - 25 * 300)/(25 * 300) */
}; };
char *system_name[] = {"NTSC", "PAL"}; const char *system_name[] = {"NTSC", "PAL"};
int frame_rate[] = {30, 25}; int frame_rate[] = {30, 25};
#define PSIZE 512 #define PSIZE 512
@ -107,7 +107,7 @@ dvrecv(int d, const char *filename, char ich, int count)
struct fw_pkt *pkt; struct fw_pkt *pkt;
char *pad, *buf; char *pad, *buf;
u_int32_t *ptr; 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 */}; int nblocks[] = {250 /* NTSC */, 300 /* PAL */};
struct iovec wbuf[NPACKET_R]; struct iovec wbuf[NPACKET_R];
@ -199,17 +199,17 @@ again:
fprintf(stderr, "(%d,%d) ", dv->sct, dv->dseq); fprintf(stderr, "(%d,%d) ", dv->sct, dv->dseq);
#endif #endif
if (dv->sct == DV_SCT_HEADER && dv->dseq == 0) { if (dv->sct == DV_SCT_HEADER && dv->dseq == 0) {
if (system < 0) { if (lsystem < 0) {
system = ciph->fdf.dv.fs; lsystem = ciph->fdf.dv.fs;
fprintf(stderr, fprintf(stderr,
"%s\n", system_name[system]); "%s\n", system_name[lsystem]);
} }
/* Fix DSF bit */ /* Fix DSF bit */
if (system == 1 && if (lsystem == 1 &&
(dv->payload[0] & DV_DSF_12) == 0) (dv->payload[0] & DV_DSF_12) == 0)
dv->payload[0] |= DV_DSF_12; dv->payload[0] |= DV_DSF_12;
nb = nblocks[system]; nb = nblocks[lsystem];
fprintf(stderr, "%d", k%10); fprintf(stderr, "%d", k%10);
#if FIX_FRAME #if FIX_FRAME
if (m > 0 && m != nb) { if (m > 0 && m != nb) {
@ -229,7 +229,7 @@ again:
} }
#endif #endif
k++; k++;
if (k % frame_rate[system] == 0) { if (k % frame_rate[lsystem] == 0) {
/* every second */ /* every second */
fprintf(stderr, "\n"); fprintf(stderr, "\n");
} }
@ -268,7 +268,7 @@ dvsend(int d, const char *filename, char ich, int count)
struct dvdbc *dv; struct dvdbc *dv;
struct fw_pkt *pkt; struct fw_pkt *pkt;
int len, tlen, header, fd, frames, packets, vec, offset, nhdr, i; 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]; struct iovec wbuf[TNBUF*2 + NEMPTY];
char *pbuf; char *pbuf;
u_int32_t iso_data, iso_empty, hdr[TNBUF + NEMPTY][3]; u_int32_t iso_data, iso_empty, hdr[TNBUF + NEMPTY][3];
@ -353,42 +353,42 @@ next:
#if 0 #if 0
header = (dv->sct == 0 && dv->dseq == 0); header = (dv->sct == 0 && dv->dseq == 0);
#else #else
header = (packets == 0 || packets % npackets[system] == 0); header = (packets == 0 || packets % npackets[lsystem] == 0);
#endif #endif
ciph = (struct ciphdr *)&hdr[nhdr][1]; ciph = (struct ciphdr *)&hdr[nhdr][1];
if (header) { if (header) {
if (system < 0) { if (lsystem < 0) {
system = ((dv->payload[0] & DV_DSF_12) != 0); lsystem = ((dv->payload[0] & DV_DSF_12) != 0);
printf("%s\n", system_name[system]); printf("%s\n", system_name[lsystem]);
cycle = 1; cycle = 1;
cycle_acc = frame_cycle[system].d * cycle; cycle_acc = frame_cycle[lsystem].d * cycle;
} }
fprintf(stderr, "%d", frames % 10); fprintf(stderr, "%d", frames % 10);
frames ++; frames ++;
if (count > 0 && frames > count) if (count > 0 && frames > count)
break; break;
if (frames % frame_rate[system] == 0) if (frames % frame_rate[lsystem] == 0)
fprintf(stderr, "\n"); fprintf(stderr, "\n");
fflush(stderr); fflush(stderr);
f_cycle = (cycle_acc / frame_cycle[system].d) & 0xf; f_cycle = (cycle_acc / frame_cycle[lsystem].d) & 0xf;
f_frac = (cycle_acc % frame_cycle[system].d f_frac = (cycle_acc % frame_cycle[lsystem].d
* CYCLE_FRAC) / frame_cycle[system].d; * CYCLE_FRAC) / frame_cycle[lsystem].d;
#if 0 #if 0
ciph->fdf.dv.cyc = htons(f_cycle << 12 | f_frac); ciph->fdf.dv.cyc = htons(f_cycle << 12 | f_frac);
#else #else
ciph->fdf.dv.cyc = htons(cycle << 12 | f_frac); ciph->fdf.dv.cyc = htons(cycle << 12 | f_frac);
#endif #endif
cycle_acc += frame_cycle[system].n; cycle_acc += frame_cycle[lsystem].n;
cycle_acc %= frame_cycle[system].d * 0x10; cycle_acc %= frame_cycle[lsystem].d * 0x10;
} else { } else {
ciph->fdf.dv.cyc = 0xffff; ciph->fdf.dv.cyc = 0xffff;
} }
ciph->dbc = packets++ % 256; ciph->dbc = packets++ % 256;
pad_acc += pad_rate[system].n; pad_acc += pad_rate[lsystem].n;
if (pad_acc >= pad_rate[system].d) { if (pad_acc >= pad_rate[lsystem].d) {
pad_acc -= pad_rate[system].d; pad_acc -= pad_rate[lsystem].d;
bcopy(hdr[nhdr], hdr[nhdr+1], sizeof(hdr[0])); bcopy(hdr[nhdr], hdr[nhdr+1], sizeof(hdr[0]));
hdr[nhdr][0] = iso_empty; hdr[nhdr][0] = iso_empty;
wbuf[vec].iov_base = (char *)hdr[nhdr]; wbuf[vec].iov_base = (char *)hdr[nhdr];