Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-5]: src/usr.bin/audio/ctl Pull up revision 1.30 (via patch, req...
details: https://anonhg.NetBSD.org/src/rev/a5100166b338
branches: netbsd-1-5
changeset: 492724:a5100166b338
user: he <he%NetBSD.org@localhost>
date: Sat Feb 09 17:31:59 2002 +0000
description:
Pull up revision 1.30 (via patch, requested by jdolecek):
Remove the old code which made audioctl use stderr for output if
stdout was the same as the audio device. A by-product is that
``audioctl -a > /dev/null'' now works.
diffstat:
usr.bin/audio/ctl/ctl.c | 56 ++++++++++++++++++------------------------------
1 files changed, 21 insertions(+), 35 deletions(-)
diffs (154 lines):
diff -r 4acef0d6bc08 -r a5100166b338 usr.bin/audio/ctl/ctl.c
--- a/usr.bin/audio/ctl/ctl.c Sat Feb 09 17:14:12 2002 +0000
+++ b/usr.bin/audio/ctl/ctl.c Sat Feb 09 17:31:59 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ctl.c,v 1.23.10.1 2002/01/29 23:24:15 he Exp $ */
+/* $NetBSD: ctl.c,v 1.23.10.2 2002/02/09 17:31:59 he Exp $ */
/*
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -60,8 +60,6 @@
void usage __P((void));
int main __P((int argc, char **argv));
-FILE *out = stdout;
-
char *prog;
audio_device_t adev;
@@ -177,63 +175,63 @@
int i;
if (sep)
- fprintf(out, "%s%s", p->name, sep);
+ printf("%s%s", p->name, sep);
switch(p->format) {
case STRING:
- fprintf(out, "%s", (char*)p->valp);
+ printf("%s", (char*)p->valp);
break;
case INT:
- fprintf(out, "%d", *(int*)p->valp);
+ printf("%d", *(int*)p->valp);
break;
case UINT:
- fprintf(out, "%u", *(u_int*)p->valp);
+ printf("%u", *(u_int*)p->valp);
break;
case XINT:
- fprintf(out, "0x%x", *(u_int*)p->valp);
+ printf("0x%x", *(u_int*)p->valp);
break;
case UCHAR:
- fprintf(out, "%u", *(u_char*)p->valp);
+ printf("%u", *(u_char*)p->valp);
break;
case ULONG:
- fprintf(out, "%lu", *(u_long*)p->valp);
+ printf("%lu", *(u_long*)p->valp);
break;
case P_R:
v = *(u_int*)p->valp;
cm = "";
if (v & AUMODE_PLAY) {
if (v & AUMODE_PLAY_ALL)
- fprintf(out, "play");
+ printf("play");
else
- fprintf(out, "playsync");
+ printf("playsync");
cm = ",";
}
if (v & AUMODE_RECORD)
- fprintf(out, "%srecord", cm);
+ printf("%srecord", cm);
break;
case ENC:
v = *(u_int*)p->valp;
encstr = audio_enc_from_val(v);
if (encstr)
- fprintf(out, "%s", encstr);
+ printf("%s", encstr);
else
- fprintf(out, "%u", v);
+ printf("%u", v);
break;
case PROPS:
v = *(u_int*)p->valp;
for (cm = "", i = 0; props[i].name; i++) {
if (v & props[i].prop) {
- fprintf(out, "%s%s", cm, props[i].name);
+ printf("%s%s", cm, props[i].name);
cm = ",";
}
}
break;
case FORMAT:
prfield(p + 1, 0);
- fprintf(out, ",");
+ printf(",");
prfield(p + 3, 0);
- fprintf(out, ",");
+ printf(",");
prfield(p + 4, 0);
- fprintf(out, ",");
+ printf(",");
prfield(p + 5, 0);
break;
default:
@@ -345,7 +343,6 @@
{
int fd, i, ch;
int aflag = 0, wflag = 0;
- struct stat dstat, ostat;
const char *file;
char *sep = "=";
extern char *__progname;
@@ -393,17 +390,6 @@
if (fd < 0)
err(1, "%s", file);
- /* Check if stdout is the same device as the audio device. */
- if (fstat(fd, &dstat) < 0)
- err(1, "fstat audioctl");
- if (fstat(STDOUT_FILENO, &ostat) < 0)
- 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))
- /* We can't write to stdout so use stderr */
- out = stderr;
-
if (!wflag)
getinfo(fd);
@@ -411,7 +397,7 @@
for (i = 0; fields[i].name; i++) {
if (!(fields[i].flags & ALIAS)) {
prfield(&fields[i], sep);
- fprintf(out, "\n");
+ printf("\n");
}
}
} else if (argc > 0 && !aflag) {
@@ -421,9 +407,9 @@
getinfo(fd);
for (i = 0; fields[i].name; i++) {
if (fields[i].flags & SET) {
- fprintf(out, "%s: -> ", fields[i].name);
+ printf("%s: -> ", fields[i].name);
prfield(&fields[i], 0);
- fprintf(out, "\n");
+ printf("\n");
}
}
}
@@ -438,7 +424,7 @@
warnx("field %s does not exist", *argv);
} else {
prfield(p, sep);
- fprintf(out, "\n");
+ printf("\n");
}
argv++;
}
Home |
Main Index |
Thread Index |
Old Index