Get rid of warnings.

This commit is contained in:
augustss 1997-10-07 13:55:03 +00:00
parent ad681f7eae
commit b217726cdc
3 changed files with 86 additions and 40 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ctl.c,v 1.8 1997/08/25 19:03:12 augustss Exp $ */
/* $NetBSD: ctl.c,v 1.9 1997/10/07 13:55:03 augustss Exp $ */
/*
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@ -45,6 +45,13 @@
#include <sys/ioctl.h>
#include <sys/audioio.h>
struct field *findfield __P((char *name));
void prfield __P((struct field *p, char *sep));
void rdfield __P((struct field *p, char *q));
void getinfo __P((int fd));
void usage __P((void));
int main __P((int argc, char **argv));
FILE *out = stdout;
char *prog;
@ -142,7 +149,8 @@ struct {
};
struct field *
findfield(char *name)
findfield(name)
char *name;
{
int i;
for(i = 0; fields[i].name; i++)
@ -152,7 +160,9 @@ findfield(char *name)
}
void
prfield(struct field *p, char *sep)
prfield(p, sep)
struct field *p;
char *sep;
{
u_int v;
char *cm;
@ -217,7 +227,9 @@ prfield(struct field *p, char *sep)
}
void
rdfield(struct field *p, char *q)
rdfield(p, q)
struct field *p;
char *q;
{
int i;
@ -242,12 +254,13 @@ rdfield(struct field *p, char *q)
}
void
getinfo(int fd)
getinfo(fd)
int fd;
{
int pos, i;
if (ioctl(fd, AUDIO_GETDEV, &adev) < 0)
err(1, NULL);
err(1, "AUDIO_GETDEV");
for(pos = 0, i = 0; ; i++) {
audio_encoding_t enc;
enc.index = i;
@ -261,17 +274,17 @@ getinfo(int fd)
pos += strlen(encbuf+pos);
}
if (ioctl(fd, AUDIO_GETFD, &fullduplex) < 0)
err(1, NULL);
err(1, "AUDIO_GETFD");
if (ioctl(fd, AUDIO_GETPROPS, &properties) < 0)
err(1, NULL);
err(1, "AUDIO_GETPROPS");
if (ioctl(fd, AUDIO_RERROR, &rerror) < 0)
err(1, NULL);
err(1, "AUDIO_RERROR");
if (ioctl(fd, AUDIO_GETINFO, &info) < 0)
err(1, NULL);
err(1, "AUDIO_GETINFO");
}
void
usage(void)
usage()
{
fprintf(out, "%s [-f file] [-n] name ...\n", prog);
fprintf(out, "%s [-f file] [-n] -w name=value ...\n", prog);
@ -279,8 +292,10 @@ usage(void)
exit(1);
}
void
main(int argc, char **argv)
int
main(argc, argv)
int argc;
char **argv;
{
int fd, i, ch;
int aflag = 0, wflag = 0;
@ -320,9 +335,9 @@ main(int argc, char **argv)
/* Check if stdout is the same device as the audio device. */
if (fstat(fd, &dstat) < 0)
err(1, NULL);
err(1, "fstat au");
if (fstat(STDOUT_FILENO, &ostat) < 0)
err(1, NULL);
err(1, "fstat stdout");
if (S_ISCHR(dstat.st_mode) && S_ISCHR(ostat.st_mode) &&
major(dstat.st_dev) == major(ostat.st_dev) &&
minor(dstat.st_dev) == minor(ostat.st_dev))

View File

@ -1,4 +1,4 @@
/* $NetBSD: audioctl.c,v 1.8 1997/08/25 19:03:12 augustss Exp $ */
/* $NetBSD: audioctl.c,v 1.9 1997/10/07 13:55:03 augustss Exp $ */
/*
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@ -45,6 +45,13 @@
#include <sys/ioctl.h>
#include <sys/audioio.h>
struct field *findfield __P((char *name));
void prfield __P((struct field *p, char *sep));
void rdfield __P((struct field *p, char *q));
void getinfo __P((int fd));
void usage __P((void));
int main __P((int argc, char **argv));
FILE *out = stdout;
char *prog;
@ -142,7 +149,8 @@ struct {
};
struct field *
findfield(char *name)
findfield(name)
char *name;
{
int i;
for(i = 0; fields[i].name; i++)
@ -152,7 +160,9 @@ findfield(char *name)
}
void
prfield(struct field *p, char *sep)
prfield(p, sep)
struct field *p;
char *sep;
{
u_int v;
char *cm;
@ -217,7 +227,9 @@ prfield(struct field *p, char *sep)
}
void
rdfield(struct field *p, char *q)
rdfield(p, q)
struct field *p;
char *q;
{
int i;
@ -242,12 +254,13 @@ rdfield(struct field *p, char *q)
}
void
getinfo(int fd)
getinfo(fd)
int fd;
{
int pos, i;
if (ioctl(fd, AUDIO_GETDEV, &adev) < 0)
err(1, NULL);
err(1, "AUDIO_GETDEV");
for(pos = 0, i = 0; ; i++) {
audio_encoding_t enc;
enc.index = i;
@ -261,17 +274,17 @@ getinfo(int fd)
pos += strlen(encbuf+pos);
}
if (ioctl(fd, AUDIO_GETFD, &fullduplex) < 0)
err(1, NULL);
err(1, "AUDIO_GETFD");
if (ioctl(fd, AUDIO_GETPROPS, &properties) < 0)
err(1, NULL);
err(1, "AUDIO_GETPROPS");
if (ioctl(fd, AUDIO_RERROR, &rerror) < 0)
err(1, NULL);
err(1, "AUDIO_RERROR");
if (ioctl(fd, AUDIO_GETINFO, &info) < 0)
err(1, NULL);
err(1, "AUDIO_GETINFO");
}
void
usage(void)
usage()
{
fprintf(out, "%s [-f file] [-n] name ...\n", prog);
fprintf(out, "%s [-f file] [-n] -w name=value ...\n", prog);
@ -279,8 +292,10 @@ usage(void)
exit(1);
}
void
main(int argc, char **argv)
int
main(argc, argv)
int argc;
char **argv;
{
int fd, i, ch;
int aflag = 0, wflag = 0;
@ -320,9 +335,9 @@ main(int argc, char **argv)
/* Check if stdout is the same device as the audio device. */
if (fstat(fd, &dstat) < 0)
err(1, NULL);
err(1, "fstat au");
if (fstat(STDOUT_FILENO, &ostat) < 0)
err(1, NULL);
err(1, "fstat stdout");
if (S_ISCHR(dstat.st_mode) && S_ISCHR(ostat.st_mode) &&
major(dstat.st_dev) == major(ostat.st_dev) &&
minor(dstat.st_dev) == minor(ostat.st_dev))

View File

@ -1,4 +1,4 @@
/* $NetBSD: mixerctl.c,v 1.5 1997/08/24 23:20:04 augustss Exp $ */
/* $NetBSD: mixerctl.c,v 1.6 1997/10/07 14:02:19 augustss Exp $ */
/*
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@ -44,6 +44,12 @@
#include <sys/ioctl.h>
#include <sys/audioio.h>
char *catstr __P((char *p, char *q));
struct field *findfield __P((char *name));
void prfield __P((struct field *p, char *sep, int prvalset));
int rdfield __P((struct field *p, char *q));
int main(int argc, char **argv);
FILE *out = stdout;
char *prog;
@ -59,7 +65,9 @@ mixer_ctrl_t *values;
mixer_devinfo_t *infos;
char *
catstr(char *p, char *q)
catstr(p, q)
char *p;
char *q;
{
char *r = malloc(strlen(p) + strlen(q) + 2);
strcpy(r, p);
@ -69,7 +77,8 @@ catstr(char *p, char *q)
}
struct field *
findfield(char *name)
findfield(name)
char *name;
{
int i;
for(i = 0; fields[i].name; i++)
@ -79,7 +88,10 @@ findfield(char *name)
}
void
prfield(struct field *p, char *sep, int prvalset)
prfield(p, sep, prvalset)
struct field *p;
char *sep;
int prvalset;
{
mixer_ctrl_t *m;
int i, n;
@ -126,7 +138,9 @@ prfield(struct field *p, char *sep, int prvalset)
}
int
rdfield(struct field *p, char *q)
rdfield(p, q)
struct field *p;
char *q;
{
mixer_ctrl_t *m;
int v, v0, v1, mask;
@ -191,10 +205,12 @@ rdfield(struct field *p, char *q)
return 1;
}
void
main(int argc, char **argv)
int
main(argc, argv)
int argc;
char **argv;
{
int fd, r, i, j, ch, pos;
int fd, i, j, ch, pos;
int aflag = 0, wflag = 0, vflag = 0;
char *file = "/dev/mixer";
char *sep = "=";
@ -266,7 +282,7 @@ main(int argc, char **argv)
if (ioctl(fd, AUDIO_MIXER_READ, &values[i]) < 0) {
values[i].un.value.num_channels = 1;
if (ioctl(fd, AUDIO_MIXER_READ, &values[i]) < 0)
err(1, NULL);
err(1, "AUDIO_MIXER_READ");
}
}
}
@ -313,7 +329,7 @@ main(int argc, char **argv)
val = *p->valp;
if (rdfield(p, q)) {
if (ioctl(fd, AUDIO_MIXER_WRITE, p->valp) < 0)
warn(NULL);
warn("AUDIO_MIXER_WRITE");
else if (sep) {
*p->valp = val;
prfield(p, ": ", 0);