2002-01-31 03:03:23 +03:00
|
|
|
/* $NetBSD: mixerctl.c,v 1.17 2002/01/31 00:03:24 augustss Exp $ */
|
1997-05-13 21:35:50 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
1998-11-26 01:17:06 +03:00
|
|
|
* This code is derived from software contributed to The NetBSD Foundation
|
|
|
|
* by Lennart Augustsson (augustss@netbsd.org) and Chuck Cranor.
|
1997-05-13 21:35:50 +04:00
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by the NetBSD
|
|
|
|
* Foundation, Inc. and its contributors.
|
|
|
|
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
|
|
|
* contributors may be used to endorse or promote products derived
|
|
|
|
* from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
|
|
|
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
|
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
1997-10-09 02:19:18 +04:00
|
|
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
|
|
|
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
1997-05-13 21:35:50 +04:00
|
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <err.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/ioctl.h>
|
|
|
|
#include <sys/audioio.h>
|
|
|
|
|
2002-01-31 03:03:23 +03:00
|
|
|
#include <paths.h>
|
1998-08-21 23:45:37 +04:00
|
|
|
|
1997-05-13 21:35:50 +04:00
|
|
|
FILE *out = stdout;
|
2000-12-29 16:30:26 +03:00
|
|
|
int vflag = 0;
|
1997-05-13 21:35:50 +04:00
|
|
|
|
|
|
|
char *prog;
|
|
|
|
|
|
|
|
struct field {
|
|
|
|
char *name;
|
|
|
|
mixer_ctrl_t *valp;
|
|
|
|
mixer_devinfo_t *infp;
|
1997-05-23 21:55:29 +04:00
|
|
|
char changed;
|
1997-05-13 21:35:50 +04:00
|
|
|
} *fields, *rfields;
|
|
|
|
|
|
|
|
mixer_ctrl_t *values;
|
|
|
|
mixer_devinfo_t *infos;
|
|
|
|
|
2000-12-29 16:30:26 +03:00
|
|
|
static char *
|
|
|
|
catstr(char *p, char *q)
|
1997-05-13 21:35:50 +04:00
|
|
|
{
|
|
|
|
char *r = malloc(strlen(p) + strlen(q) + 2);
|
|
|
|
strcpy(r, p);
|
|
|
|
strcat(r, ".");
|
|
|
|
strcat(r, q);
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
2000-12-29 16:30:26 +03:00
|
|
|
static struct field *
|
|
|
|
findfield(char *name)
|
1997-05-13 21:35:50 +04:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
for(i = 0; fields[i].name; i++)
|
|
|
|
if (strcmp(fields[i].name, name) == 0)
|
|
|
|
return &fields[i];
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2000-12-29 16:30:26 +03:00
|
|
|
static void
|
|
|
|
prfield(struct field *p, char *sep, int prvalset)
|
1997-05-13 21:35:50 +04:00
|
|
|
{
|
|
|
|
mixer_ctrl_t *m;
|
1997-05-19 21:32:07 +04:00
|
|
|
int i, n;
|
1997-05-13 21:35:50 +04:00
|
|
|
|
|
|
|
if (sep)
|
|
|
|
fprintf(out, "%s%s", p->name, sep);
|
|
|
|
m = p->valp;
|
|
|
|
switch(m->type) {
|
|
|
|
case AUDIO_MIXER_ENUM:
|
1997-05-23 21:55:29 +04:00
|
|
|
for(i = 0; i < p->infp->un.e.num_mem; i++)
|
|
|
|
if (p->infp->un.e.member[i].ord == m->un.ord)
|
|
|
|
fprintf(out, "%s",
|
|
|
|
p->infp->un.e.member[i].label.name);
|
1997-05-13 21:35:50 +04:00
|
|
|
if (prvalset) {
|
|
|
|
fprintf(out, " [ ");
|
|
|
|
for(i = 0; i < p->infp->un.e.num_mem; i++)
|
2000-12-29 16:30:26 +03:00
|
|
|
fprintf(out, "%s ",
|
|
|
|
p->infp->un.e.member[i].label.name);
|
1997-05-13 21:35:50 +04:00
|
|
|
fprintf(out, "]");
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case AUDIO_MIXER_SET:
|
1997-05-19 21:32:07 +04:00
|
|
|
for(n = i = 0; i < p->infp->un.s.num_mem; i++)
|
|
|
|
if (m->un.mask & p->infp->un.s.member[i].mask)
|
|
|
|
fprintf(out, "%s%s", n++ ? "," : "",
|
|
|
|
p->infp->un.s.member[i].label.name);
|
1997-05-13 21:35:50 +04:00
|
|
|
if (prvalset) {
|
|
|
|
fprintf(out, " { ");
|
|
|
|
for(i = 0; i < p->infp->un.s.num_mem; i++)
|
2000-12-29 16:30:26 +03:00
|
|
|
fprintf(out, "%s ",
|
|
|
|
p->infp->un.s.member[i].label.name);
|
1997-05-13 21:35:50 +04:00
|
|
|
fprintf(out, "}");
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case AUDIO_MIXER_VALUE:
|
|
|
|
if (m->un.value.num_channels == 1)
|
|
|
|
fprintf(out, "%d", m->un.value.level[0]);
|
|
|
|
else
|
|
|
|
fprintf(out, "%d,%d", m->un.value.level[0],
|
|
|
|
m->un.value.level[1]);
|
2000-12-29 16:30:26 +03:00
|
|
|
if (prvalset) {
|
1997-10-19 11:46:04 +04:00
|
|
|
fprintf(out, " %s", p->infp->un.v.units.name);
|
2000-12-29 16:30:26 +03:00
|
|
|
if (p->infp->un.v.delta)
|
|
|
|
fprintf(out, " delta=%d", p->infp->un.v.delta);
|
|
|
|
}
|
1997-05-13 21:35:50 +04:00
|
|
|
break;
|
|
|
|
default:
|
1997-08-25 03:20:04 +04:00
|
|
|
printf("\n");
|
1997-05-13 21:35:50 +04:00
|
|
|
errx(1, "Invalid format.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-12-29 16:30:26 +03:00
|
|
|
static int
|
|
|
|
rdfield(struct field *p, char *q)
|
1997-05-13 21:35:50 +04:00
|
|
|
{
|
|
|
|
mixer_ctrl_t *m;
|
1997-05-23 21:55:29 +04:00
|
|
|
int v, v0, v1, mask;
|
1997-05-13 21:35:50 +04:00
|
|
|
int i;
|
|
|
|
char *s;
|
|
|
|
|
|
|
|
m = p->valp;
|
|
|
|
switch(m->type) {
|
|
|
|
case AUDIO_MIXER_ENUM:
|
|
|
|
for(i = 0; i < p->infp->un.e.num_mem; i++)
|
|
|
|
if (strcmp(p->infp->un.e.member[i].label.name, q) == 0)
|
|
|
|
break;
|
|
|
|
if (i < p->infp->un.e.num_mem)
|
1997-05-19 21:32:07 +04:00
|
|
|
m->un.ord = p->infp->un.e.member[i].ord;
|
1997-05-23 21:55:29 +04:00
|
|
|
else {
|
1997-05-13 21:35:50 +04:00
|
|
|
warnx("Bad enum value %s", q);
|
1997-05-23 21:55:29 +04:00
|
|
|
return 0;
|
|
|
|
}
|
1997-05-13 21:35:50 +04:00
|
|
|
break;
|
|
|
|
case AUDIO_MIXER_SET:
|
1997-05-23 21:55:29 +04:00
|
|
|
mask = 0;
|
1997-05-13 21:35:50 +04:00
|
|
|
for(v = 0; q && *q; q = s) {
|
|
|
|
s = strchr(q, ',');
|
|
|
|
if (s)
|
|
|
|
*s++ = 0;
|
|
|
|
for(i = 0; i < p->infp->un.s.num_mem; i++)
|
2000-12-29 16:30:26 +03:00
|
|
|
if (strcmp(p->infp->un.s.member[i].label.name,
|
|
|
|
q) == 0)
|
1997-05-13 21:35:50 +04:00
|
|
|
break;
|
1997-05-19 21:32:07 +04:00
|
|
|
if (i < p->infp->un.s.num_mem) {
|
1997-05-23 21:55:29 +04:00
|
|
|
mask |= p->infp->un.s.member[i].mask;
|
|
|
|
} else {
|
1997-05-19 20:32:54 +04:00
|
|
|
warnx("Bad set value %s", q);
|
1997-05-23 21:55:29 +04:00
|
|
|
return 0;
|
|
|
|
}
|
1997-05-13 21:35:50 +04:00
|
|
|
}
|
1997-05-23 21:55:29 +04:00
|
|
|
m->un.mask = mask;
|
1997-05-13 21:35:50 +04:00
|
|
|
break;
|
|
|
|
case AUDIO_MIXER_VALUE:
|
|
|
|
if (m->un.value.num_channels == 1) {
|
|
|
|
if (sscanf(q, "%d", &v) == 1) {
|
|
|
|
m->un.value.level[0] = v;
|
|
|
|
} else {
|
|
|
|
warnx("Bad number %s", q);
|
1997-05-23 21:55:29 +04:00
|
|
|
return 0;
|
1997-05-13 21:35:50 +04:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (sscanf(q, "%d,%d", &v0, &v1) == 2) {
|
|
|
|
m->un.value.level[0] = v0;
|
|
|
|
m->un.value.level[1] = v1;
|
|
|
|
} else if (sscanf(q, "%d", &v) == 1) {
|
|
|
|
m->un.value.level[0] = m->un.value.level[1] = v;
|
|
|
|
} else {
|
|
|
|
warnx("Bad numbers %s", q);
|
1997-05-23 21:55:29 +04:00
|
|
|
return 0;
|
1997-05-13 21:35:50 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
errx(1, "Invalid format.");
|
|
|
|
}
|
1997-05-23 21:55:29 +04:00
|
|
|
p->changed = 1;
|
|
|
|
return 1;
|
1997-05-13 21:35:50 +04:00
|
|
|
}
|
|
|
|
|
2000-12-29 16:30:26 +03:00
|
|
|
static int
|
|
|
|
incfield(struct field *p, int inc)
|
|
|
|
{
|
|
|
|
mixer_ctrl_t *m;
|
|
|
|
int i, v;
|
|
|
|
|
|
|
|
m = p->valp;
|
|
|
|
switch(m->type) {
|
|
|
|
case AUDIO_MIXER_ENUM:
|
|
|
|
m->un.ord += inc;
|
|
|
|
if (m->un.ord < 0)
|
|
|
|
m->un.ord = p->infp->un.e.num_mem-1;
|
|
|
|
if (m->un.ord >= p->infp->un.e.num_mem)
|
|
|
|
m->un.ord = 0;
|
|
|
|
break;
|
|
|
|
case AUDIO_MIXER_SET:
|
|
|
|
m->un.mask += inc;
|
|
|
|
if (m->un.mask < 0)
|
|
|
|
m->un.mask = (1 << p->infp->un.s.num_mem) - 1;
|
|
|
|
if (m->un.mask >= (1 << p->infp->un.s.num_mem))
|
|
|
|
m->un.mask = 0;
|
|
|
|
warnx("Can't ++/-- %s", p->name);
|
|
|
|
return 0;
|
|
|
|
case AUDIO_MIXER_VALUE:
|
|
|
|
if (p->infp->un.v.delta)
|
|
|
|
inc *= p->infp->un.v.delta;
|
|
|
|
for (i = 0; i < m->un.value.num_channels; i++) {
|
|
|
|
v = m->un.value.level[i];
|
|
|
|
v += inc;
|
|
|
|
if (v < AUDIO_MIN_GAIN)
|
|
|
|
v = AUDIO_MIN_GAIN;
|
|
|
|
if (v > AUDIO_MAX_GAIN)
|
|
|
|
v = AUDIO_MAX_GAIN;
|
|
|
|
m->un.value.level[i] = v;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
errx(1, "Invalid format.");
|
|
|
|
}
|
|
|
|
p->changed = 1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
wrarg(int fd, char *arg, char *sep)
|
|
|
|
{
|
|
|
|
char *q;
|
|
|
|
struct field *p;
|
|
|
|
mixer_ctrl_t val;
|
|
|
|
int incdec, r;
|
|
|
|
|
|
|
|
q = strchr(arg, '=');
|
|
|
|
if (q == NULL) {
|
|
|
|
int l = strlen(arg);
|
|
|
|
incdec = 0;
|
|
|
|
if (l > 2 && arg[l-2] == '+' && arg[l-1] == '+')
|
|
|
|
incdec = 1;
|
|
|
|
else if (l > 2 && arg[l-2] == '-' && arg[l-1] == '-')
|
|
|
|
incdec = -1;
|
|
|
|
else {
|
|
|
|
warnx("No `=' in %s", arg);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
arg[l-2] = 0;
|
|
|
|
} else
|
|
|
|
*q++ = 0;
|
|
|
|
|
|
|
|
p = findfield(arg);
|
|
|
|
if (p == NULL) {
|
|
|
|
warnx("field %s does not exist", arg);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
val = *p->valp;
|
|
|
|
if (q != NULL)
|
|
|
|
r = rdfield(p, q);
|
|
|
|
else
|
|
|
|
r = incfield(p, incdec);
|
|
|
|
if (r) {
|
|
|
|
if (ioctl(fd, AUDIO_MIXER_WRITE, p->valp) < 0)
|
|
|
|
warn("AUDIO_MIXER_WRITE");
|
|
|
|
else if (sep) {
|
|
|
|
*p->valp = val;
|
|
|
|
prfield(p, ": ", 0);
|
|
|
|
ioctl(fd, AUDIO_MIXER_READ, p->valp);
|
|
|
|
printf(" -> ");
|
|
|
|
prfield(p, 0, 0);
|
|
|
|
printf("\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
prarg(int fd, char *arg, char *sep)
|
|
|
|
{
|
|
|
|
struct field *p;
|
|
|
|
|
|
|
|
p = findfield(arg);
|
|
|
|
if (p == NULL)
|
|
|
|
warnx("field %s does not exist", arg);
|
|
|
|
else
|
|
|
|
prfield(p, sep, vflag), fprintf(out, "\n");
|
|
|
|
}
|
|
|
|
|
1997-10-07 17:55:03 +04:00
|
|
|
int
|
2000-12-29 16:30:26 +03:00
|
|
|
main(int argc, char **argv)
|
1997-05-13 21:35:50 +04:00
|
|
|
{
|
1997-10-07 17:55:03 +04:00
|
|
|
int fd, i, j, ch, pos;
|
2000-12-29 16:30:26 +03:00
|
|
|
int aflag = 0, wflag = 0;
|
1998-04-27 20:52:03 +04:00
|
|
|
char *file;
|
1997-05-13 21:35:50 +04:00
|
|
|
char *sep = "=";
|
|
|
|
mixer_devinfo_t dinfo;
|
|
|
|
int ndev;
|
|
|
|
|
1998-04-27 20:55:23 +04:00
|
|
|
file = getenv("MIXERDEVICE");
|
2002-01-31 03:03:23 +03:00
|
|
|
if (file == NULL)
|
|
|
|
file = _PATH_MIXER;
|
1998-04-27 20:52:03 +04:00
|
|
|
|
1997-05-13 21:35:50 +04:00
|
|
|
prog = *argv;
|
|
|
|
|
2002-01-27 13:09:55 +03:00
|
|
|
while ((ch = getopt(argc, argv, "ad:f:nvw")) != -1) {
|
1997-05-13 21:35:50 +04:00
|
|
|
switch(ch) {
|
|
|
|
case 'a':
|
|
|
|
aflag++;
|
|
|
|
break;
|
|
|
|
case 'w':
|
|
|
|
wflag++;
|
|
|
|
break;
|
|
|
|
case 'v':
|
|
|
|
vflag++;
|
|
|
|
break;
|
|
|
|
case 'n':
|
|
|
|
sep = 0;
|
|
|
|
break;
|
2002-01-27 13:09:55 +03:00
|
|
|
case 'f': /* compatibility */
|
|
|
|
case 'd':
|
1997-05-13 21:35:50 +04:00
|
|
|
file = optarg;
|
|
|
|
break;
|
|
|
|
case '?':
|
|
|
|
default:
|
|
|
|
usage:
|
2002-01-27 13:09:55 +03:00
|
|
|
fprintf(out, "%s [-d file] [-v] [-n] name ...\n", prog);
|
|
|
|
fprintf(out, "%s [-d file] [-v] [-n] -w name=value ...\n",prog);
|
|
|
|
fprintf(out, "%s [-d file] [-v] [-n] -a\n", prog);
|
1997-05-13 21:35:50 +04:00
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
argc -= optind;
|
|
|
|
argv += optind;
|
|
|
|
|
|
|
|
fd = open(file, O_RDWR);
|
2002-01-31 03:03:23 +03:00
|
|
|
/* Try with mixer0. */
|
|
|
|
if (fd < 0 && file == _PATH_MIXER) {
|
|
|
|
file = _PATH_MIXER0;
|
1998-08-21 23:45:37 +04:00
|
|
|
fd = open(file, O_RDWR);
|
|
|
|
}
|
2002-01-31 03:03:23 +03:00
|
|
|
|
1997-05-13 21:35:50 +04:00
|
|
|
if (fd < 0)
|
|
|
|
err(1, "%s", file);
|
|
|
|
|
|
|
|
for(ndev = 0; ; ndev++) {
|
|
|
|
dinfo.index = ndev;
|
|
|
|
if (ioctl(fd, AUDIO_MIXER_DEVINFO, &dinfo) < 0)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
rfields = calloc(ndev, sizeof *rfields);
|
|
|
|
fields = calloc(ndev, sizeof *fields);
|
|
|
|
infos = calloc(ndev, sizeof *infos);
|
|
|
|
values = calloc(ndev, sizeof *values);
|
|
|
|
|
|
|
|
for(i = 0; i < ndev; i++) {
|
|
|
|
infos[i].index = i;
|
|
|
|
ioctl(fd, AUDIO_MIXER_DEVINFO, &infos[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
for(i = 0; i < ndev; i++) {
|
1997-08-25 03:20:04 +04:00
|
|
|
rfields[i].name = infos[i].label.name;
|
1997-05-13 21:35:50 +04:00
|
|
|
rfields[i].valp = &values[i];
|
|
|
|
rfields[i].infp = &infos[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
for(i = 0; i < ndev; i++) {
|
|
|
|
values[i].dev = i;
|
|
|
|
values[i].type = infos[i].type;
|
|
|
|
if (infos[i].type != AUDIO_MIXER_CLASS) {
|
|
|
|
values[i].un.value.num_channels = 2;
|
|
|
|
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)
|
1997-10-07 17:55:03 +04:00
|
|
|
err(1, "AUDIO_MIXER_READ");
|
1997-05-13 21:35:50 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for(j = i = 0; i < ndev; i++) {
|
|
|
|
if (infos[i].type != AUDIO_MIXER_CLASS &&
|
|
|
|
infos[i].type != -1) {
|
|
|
|
fields[j++] = rfields[i];
|
|
|
|
for(pos = infos[i].next; pos != AUDIO_MIXER_LAST;
|
|
|
|
pos = infos[pos].next) {
|
|
|
|
fields[j] = rfields[pos];
|
|
|
|
fields[j].name = catstr(rfields[i].name,
|
|
|
|
infos[pos].label.name);
|
|
|
|
infos[pos].type = -1;
|
|
|
|
j++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1997-08-25 03:20:04 +04:00
|
|
|
for(i = 0; i < j; i++) {
|
1997-10-17 03:28:17 +04:00
|
|
|
int cls = fields[i].infp->mixer_class;
|
|
|
|
if (cls >= 0 && cls < ndev)
|
|
|
|
fields[i].name = catstr(infos[cls].label.name,
|
1997-08-25 03:20:04 +04:00
|
|
|
fields[i].name);
|
|
|
|
}
|
|
|
|
|
1997-05-13 21:35:50 +04:00
|
|
|
if (argc == 0 && aflag && !wflag) {
|
|
|
|
for(i = 0; fields[i].name; i++) {
|
|
|
|
prfield(&fields[i], sep, vflag);
|
|
|
|
fprintf(out, "\n");
|
|
|
|
}
|
|
|
|
} else if (argc > 0 && !aflag) {
|
2000-12-29 16:30:26 +03:00
|
|
|
while(argc--) {
|
|
|
|
if (wflag)
|
|
|
|
wrarg(fd, *argv, sep);
|
|
|
|
else
|
|
|
|
prarg(fd, *argv, sep);
|
|
|
|
argv++;
|
1997-05-13 21:35:50 +04:00
|
|
|
}
|
|
|
|
} else
|
|
|
|
goto usage;
|
|
|
|
exit(0);
|
|
|
|
}
|