summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authorAlexandre Ratchov <ratchov@cvs.openbsd.org>2008-10-27 00:26:34 +0000
committerAlexandre Ratchov <ratchov@cvs.openbsd.org>2008-10-27 00:26:34 +0000
commite49f338e25ec3f687abb4ac15bf268103da0747a (patch)
tree9b2117020c878f8cda427aad375f988efd9ca146 /regress
parentc115d68c48608bed0ff4568325d5c7e0bef55268 (diff)
rename libsa to libsndio
requested by many, "just go for it" deraadt@
Diffstat (limited to 'regress')
-rw-r--r--regress/lib/libsa/Makefile5
-rw-r--r--regress/lib/libsa/sacap/Makefile6
-rw-r--r--regress/lib/libsa/safd/Makefile6
-rw-r--r--regress/lib/libsa/saplay/Makefile6
-rw-r--r--regress/lib/libsa/sarec/Makefile6
-rw-r--r--regress/lib/libsndio/Makefile5
-rw-r--r--regress/lib/libsndio/cap/Makefile6
-rw-r--r--regress/lib/libsndio/cap/cap.c (renamed from regress/lib/libsa/sacap/sacap.c)40
-rw-r--r--regress/lib/libsndio/fd/Makefile6
-rw-r--r--regress/lib/libsndio/fd/fd.c (renamed from regress/lib/libsa/safd/safd.c)66
-rw-r--r--regress/lib/libsndio/play/Makefile6
-rw-r--r--regress/lib/libsndio/play/play.c (renamed from regress/lib/libsa/saplay/saplay.c)38
-rw-r--r--regress/lib/libsndio/rec/Makefile6
-rw-r--r--regress/lib/libsndio/rec/rec.c (renamed from regress/lib/libsa/sarec/sarec.c)38
14 files changed, 120 insertions, 120 deletions
diff --git a/regress/lib/libsa/Makefile b/regress/lib/libsa/Makefile
deleted file mode 100644
index 0d90aa8e179..00000000000
--- a/regress/lib/libsa/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# $OpenBSD: Makefile,v 1.1 2008/10/26 08:49:44 ratchov Exp $
-
-SUBDIR+= saplay sarec safd sacap
-
-.include <bsd.subdir.mk>
diff --git a/regress/lib/libsa/sacap/Makefile b/regress/lib/libsa/sacap/Makefile
deleted file mode 100644
index 5c1ee3cd7e8..00000000000
--- a/regress/lib/libsa/sacap/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-# $OpenBSD: Makefile,v 1.1 2008/10/26 08:49:44 ratchov Exp $
-PROG= sacap
-LDADD= -lsa
-REGRESS_SKIP=
-
-.include <bsd.regress.mk>
diff --git a/regress/lib/libsa/safd/Makefile b/regress/lib/libsa/safd/Makefile
deleted file mode 100644
index 4f6e3144cbb..00000000000
--- a/regress/lib/libsa/safd/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-# $OpenBSD: Makefile,v 1.1 2008/10/26 08:49:44 ratchov Exp $
-PROG= safd
-LDADD= -lsa
-REGRESS_SKIP=
-
-.include <bsd.regress.mk>
diff --git a/regress/lib/libsa/saplay/Makefile b/regress/lib/libsa/saplay/Makefile
deleted file mode 100644
index d428ce74d41..00000000000
--- a/regress/lib/libsa/saplay/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-# $OpenBSD: Makefile,v 1.1 2008/10/26 08:49:44 ratchov Exp $
-PROG= saplay
-LDADD= -lsa
-REGRESS_SKIP=
-
-.include <bsd.regress.mk>
diff --git a/regress/lib/libsa/sarec/Makefile b/regress/lib/libsa/sarec/Makefile
deleted file mode 100644
index bdc207f97c5..00000000000
--- a/regress/lib/libsa/sarec/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-# $OpenBSD: Makefile,v 1.1 2008/10/26 08:49:44 ratchov Exp $
-PROG= sarec
-LDADD= -lsa
-REGRESS_SKIP=
-
-.include <bsd.regress.mk>
diff --git a/regress/lib/libsndio/Makefile b/regress/lib/libsndio/Makefile
new file mode 100644
index 00000000000..f5f394dc7e3
--- /dev/null
+++ b/regress/lib/libsndio/Makefile
@@ -0,0 +1,5 @@
+# $OpenBSD: Makefile,v 1.1 2008/10/27 00:26:33 ratchov Exp $
+
+SUBDIR+= play rec fd cap
+
+.include <bsd.subdir.mk>
diff --git a/regress/lib/libsndio/cap/Makefile b/regress/lib/libsndio/cap/Makefile
new file mode 100644
index 00000000000..141d859367b
--- /dev/null
+++ b/regress/lib/libsndio/cap/Makefile
@@ -0,0 +1,6 @@
+# $OpenBSD: Makefile,v 1.1 2008/10/27 00:26:33 ratchov Exp $
+PROG= cap
+LDADD= -lsndio
+REGRESS_SKIP=
+
+.include <bsd.regress.mk>
diff --git a/regress/lib/libsa/sacap/sacap.c b/regress/lib/libsndio/cap/cap.c
index 2b46b78a0b0..3933bcd4da7 100644
--- a/regress/lib/libsa/sacap/sacap.c
+++ b/regress/lib/libsndio/cap/cap.c
@@ -5,47 +5,47 @@
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
-#include "libsa.h"
+#include <sndio.h>
-struct sa_par par;
-struct sa_cap cap;
+struct sio_par par;
+struct sio_cap cap;
void
-pr_enc(struct sa_enc *enc)
+pr_enc(struct sio_enc *enc)
{
fprintf(stderr, "%s%d", enc->sig ? "s" : "u", enc->bits);
if (enc->bps > 1)
fprintf(stderr, "%s", enc->le ? "le" : "be");
- if (enc->bps != SA_BPS(enc->bits))
+ if (enc->bps != SIO_BPS(enc->bits))
fprintf(stderr, "%d%s", enc->bps, enc->msb ? "msb" : "lsb");
}
void
-cap_pr(struct sa_cap *cap)
+cap_pr(struct sio_cap *cap)
{
unsigned n, i;
for (n = 0; n < cap->nconf; n++) {
fprintf(stderr, "config %d\n", n);
fprintf(stderr, "\tenc:");
- for (i = 0; i < SA_NENC; i++) {
+ for (i = 0; i < SIO_NENC; i++) {
if (cap->confs[n].enc & (1 << i)) {
fprintf(stderr, " ");
pr_enc(&cap->enc[i]);
}
}
fprintf(stderr, "\n\tpchan:");
- for (i = 0; i < SA_NCHAN; i++) {
+ for (i = 0; i < SIO_NCHAN; i++) {
if (cap->confs[n].pchan & (1 << i))
fprintf(stderr, " %d", cap->pchan[i]);
}
fprintf(stderr, "\n\trchan:");
- for (i = 0; i < SA_NCHAN; i++) {
+ for (i = 0; i < SIO_NCHAN; i++) {
if (cap->confs[n].rchan & (1 << i))
fprintf(stderr, " %d", cap->rchan[i]);
}
fprintf(stderr, "\n\trate:");
- for (i = 0; i < SA_NRATE; i++) {
+ for (i = 0; i < SIO_NRATE; i++) {
if (cap->confs[n].rate & (1 << i))
fprintf(stderr, " %d", cap->rate[i]);
}
@@ -55,22 +55,22 @@ cap_pr(struct sa_cap *cap)
void
usage(void) {
- fprintf(stderr, "usage: sacap [-pr]\n");
+ fprintf(stderr, "usage: cap [-pr]\n");
}
int
main(int argc, char **argv) {
int ch;
- unsigned mode = SA_PLAY | SA_REC;
- struct sa_hdl *hdl;
+ unsigned mode = SIO_PLAY | SIO_REC;
+ struct sio_hdl *hdl;
while ((ch = getopt(argc, argv, "pr")) != -1) {
switch(ch) {
case 'p':
- mode &= ~SA_REC;
+ mode &= ~SIO_REC;
break;
case 'r':
- mode &= ~SA_PLAY;
+ mode &= ~SIO_PLAY;
break;
default:
usage();
@@ -82,16 +82,16 @@ main(int argc, char **argv) {
fprintf(stderr, "-p and -r flags are mutualy exclusive\n");
exit(1);
}
- hdl = sa_open(NULL, mode, 0);
+ hdl = sio_open(NULL, mode, 0);
if (hdl == NULL) {
- fprintf(stderr, "sa_open() failed\n");
+ fprintf(stderr, "sio_open() failed\n");
exit(1);
}
- if (!sa_getcap(hdl, &cap)) {
- fprintf(stderr, "sa_setcap() failed\n");
+ if (!sio_getcap(hdl, &cap)) {
+ fprintf(stderr, "sio_setcap() failed\n");
exit(1);
}
cap_pr(&cap);
- sa_close(hdl);
+ sio_close(hdl);
return 0;
}
diff --git a/regress/lib/libsndio/fd/Makefile b/regress/lib/libsndio/fd/Makefile
new file mode 100644
index 00000000000..431850655cd
--- /dev/null
+++ b/regress/lib/libsndio/fd/Makefile
@@ -0,0 +1,6 @@
+# $OpenBSD: Makefile,v 1.1 2008/10/27 00:26:33 ratchov Exp $
+PROG= fd
+LDADD= -lsndio
+REGRESS_SKIP=
+
+.include <bsd.regress.mk>
diff --git a/regress/lib/libsa/safd/safd.c b/regress/lib/libsndio/fd/fd.c
index 8a6e37d27b0..9a76946bc55 100644
--- a/regress/lib/libsa/safd/safd.c
+++ b/regress/lib/libsndio/fd/fd.c
@@ -6,7 +6,7 @@
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
-#include "libsa.h"
+#include <sndio.h>
struct buf { /* simple circular fifo */
unsigned start; /* first used byte */
@@ -15,8 +15,8 @@ struct buf { /* simple circular fifo */
unsigned char data[BUF_LEN];
};
-char *xstr[] = SA_XSTRINGS;
-struct sa_par par;
+char *xstr[] = SIO_XSTRINGS;
+struct sio_par par;
struct buf playbuf, recbuf;
long long pos = 0;
@@ -93,7 +93,7 @@ buf_write(struct buf *buf, int fd)
* read buffer contents from a file without blocking
*/
unsigned
-buf_rec(struct buf *buf, struct sa_hdl *hdl)
+buf_rec(struct buf *buf, struct sio_hdl *hdl)
{
unsigned count, end, avail, done = 0;
int bpf = par.rchan * par.bps;
@@ -109,10 +109,10 @@ buf_rec(struct buf *buf, struct sa_hdl *hdl)
count = BUF_LEN - end;
if (count > avail)
count = avail;
- n = sa_read(hdl, buf->data + end, count);
+ n = sio_read(hdl, buf->data + end, count);
if (n == 0) {
- if (sa_eof(hdl)) {
- fprintf(stderr, "sa_read() failed\n");
+ if (sio_eof(hdl)) {
+ fprintf(stderr, "sio_read() failed\n");
exit(1);
}
break;
@@ -132,7 +132,7 @@ buf_rec(struct buf *buf, struct sa_hdl *hdl)
* write buffer contents to file, without blocking
*/
unsigned
-buf_play(struct buf *buf, struct sa_hdl *hdl)
+buf_play(struct buf *buf, struct sio_hdl *hdl)
{
unsigned count, done = 0;
int bpf = par.pchan * par.bps;
@@ -144,10 +144,10 @@ buf_play(struct buf *buf, struct sa_hdl *hdl)
count = buf->used;
/* try to confuse the server */
//count = 1 + (rand() % count);
- n = sa_write(hdl, buf->data + buf->start, count);
+ n = sio_write(hdl, buf->data + buf->start, count);
if (n == 0) {
- if (sa_eof(hdl)) {
- fprintf(stderr, "sa_write() failed\n");
+ if (sio_eof(hdl)) {
+ fprintf(stderr, "sio_write() failed\n");
exit(1);
}
break;
@@ -170,7 +170,7 @@ buf_play(struct buf *buf, struct sa_hdl *hdl)
void
usage(void) {
fprintf(stderr,
- "usage: safd [-v] [-r rate] [-c ichan] [-C ochan] [-e enc] "
+ "usage: fd [-v] [-r rate] [-c ichan] [-C ochan] [-e enc] "
"[-i file] [-o file]\n");
}
@@ -178,7 +178,7 @@ int
main(int argc, char **argv) {
int ch, recfd, playfd, events, revents;
char *recpath, *playpath;
- struct sa_hdl *hdl;
+ struct sio_hdl *hdl;
struct pollfd pfd;
struct timeval tv, otv, ntv;
unsigned mode, done;
@@ -189,7 +189,7 @@ main(int argc, char **argv) {
/*
* defaults parameters
*/
- sa_initpar(&par);
+ sio_initpar(&par);
par.sig = 1;
par.bits = 16;
par.pchan = par.rchan = 2;
@@ -216,7 +216,7 @@ main(int argc, char **argv) {
}
break;
case 'e':
- if (!sa_strtoenc(&par, optarg)) {
+ if (!sio_strtoenc(&par, optarg)) {
fprintf(stderr, "%s: unknown encoding\n", optarg);
exit(1);
}
@@ -252,30 +252,30 @@ main(int argc, char **argv) {
}
mode = 0;
if (recpath)
- mode |= SA_REC;
+ mode |= SIO_REC;
if (playpath)
- mode |= SA_PLAY;
+ mode |= SIO_PLAY;
if (mode == 0) {
fprintf(stderr, "-i or -o option required\n");
exit(0);
}
- hdl = sa_open(NULL, mode, 1);
+ hdl = sio_open(NULL, mode, 1);
if (hdl == NULL) {
- fprintf(stderr, "sa_open() failed\n");
+ fprintf(stderr, "sio_open() failed\n");
exit(1);
}
- sa_onmove(hdl, cb, NULL);
- if (!sa_setpar(hdl, &par)) {
- fprintf(stderr, "sa_setpar() failed\n");
+ sio_onmove(hdl, cb, NULL);
+ if (!sio_setpar(hdl, &par)) {
+ fprintf(stderr, "sio_setpar() failed\n");
exit(1);
}
- if (!sa_getpar(hdl, &par)) {
- fprintf(stderr, "sa_setpar() failed\n");
+ if (!sio_getpar(hdl, &par)) {
+ fprintf(stderr, "sio_setpar() failed\n");
exit(1);
}
fprintf(stderr, "using %u%%%u frame buffer\n", par.bufsz, par.round);
- if (!sa_start(hdl)) {
- fprintf(stderr, "sa_start() failed\n");
+ if (!sio_start(hdl)) {
+ fprintf(stderr, "sio_start() failed\n");
exit(1);
}
@@ -316,14 +316,14 @@ main(int argc, char **argv) {
#endif
//fprintf(stderr, "%ld.%06ld: polling for %d\n",
// tv.tv_sec, tv.tv_usec, events);
- sa_pollfd(hdl, &pfd, events);
+ sio_pollfd(hdl, &pfd, events);
while (poll(&pfd, 1, 1000) < 0) {
if (errno == EINTR)
continue;
perror("poll");
exit(1);
}
- revents = sa_revents(hdl, &pfd);
+ revents = sio_revents(hdl, &pfd);
gettimeofday(&ntv, NULL);
timersub(&ntv, &otv, &tv);
//fprintf(stderr, "%ld.%06ld: got %d\n",
@@ -344,20 +344,20 @@ main(int argc, char **argv) {
}
#if 0
if (pos / par.rate > 2) {
- if (!sa_stop(hdl)) {
- fprintf(stderr, "sa_stop failed\n");
+ if (!sio_stop(hdl)) {
+ fprintf(stderr, "sio_stop failed\n");
exit(1);
}
pos = plat = rlat = 0;
fprintf(stderr, "pausing...\n");
sleep(1);
- if (!sa_start(hdl)) {
- fprintf(stderr, "sa_start failed\n");
+ if (!sio_start(hdl)) {
+ fprintf(stderr, "sio_start failed\n");
exit(1);
}
}
#endif
}
- sa_close(hdl);
+ sio_close(hdl);
return 0;
}
diff --git a/regress/lib/libsndio/play/Makefile b/regress/lib/libsndio/play/Makefile
new file mode 100644
index 00000000000..5e2f2020ea0
--- /dev/null
+++ b/regress/lib/libsndio/play/Makefile
@@ -0,0 +1,6 @@
+# $OpenBSD: Makefile,v 1.1 2008/10/27 00:26:33 ratchov Exp $
+PROG= play
+LDADD= -lsndio
+REGRESS_SKIP=
+
+.include <bsd.regress.mk>
diff --git a/regress/lib/libsa/saplay/saplay.c b/regress/lib/libsndio/play/play.c
index 5c9ae2433b2..a3b28b42ba3 100644
--- a/regress/lib/libsa/saplay/saplay.c
+++ b/regress/lib/libsndio/play/play.c
@@ -5,12 +5,12 @@
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
-#include "libsa.h"
+#include "sndio.h"
#define BUFSZ 0x100
unsigned char buf[BUFSZ];
-struct sa_par par;
-char *xstr[] = SA_XSTRINGS;
+struct sio_par par;
+char *xstr[] = SIO_XSTRINGS;
long long realpos = 0, playpos = 0;
@@ -30,19 +30,19 @@ cb(void *addr, int delta)
void
usage(void) {
- fprintf(stderr, "usage: saplay [-r rate] [-c nchan] [-e enc]\n");
+ fprintf(stderr, "usage: play [-r rate] [-c nchan] [-e enc]\n");
}
int
main(int argc, char **argv) {
int ch;
- struct sa_hdl *hdl;
+ struct sio_hdl *hdl;
ssize_t n, len;
/*
* defaults parameters
*/
- sa_initpar(&par);
+ sio_initpar(&par);
par.sig = 1;
par.bits = 16;
par.pchan = 2;
@@ -63,7 +63,7 @@ main(int argc, char **argv) {
}
break;
case 'e':
- if (!sa_strtoenc(&par, optarg)) {
+ if (!sio_strtoenc(&par, optarg)) {
fprintf(stderr, "%s: bad encoding\n", optarg);
exit(1);
}
@@ -92,22 +92,22 @@ main(int argc, char **argv) {
}
}
- hdl = sa_open(NULL, SA_PLAY, 0);
+ hdl = sio_open(NULL, SIO_PLAY, 0);
if (hdl == NULL) {
- fprintf(stderr, "sa_open() failed\n");
+ fprintf(stderr, "sio_open() failed\n");
exit(1);
}
- sa_onmove(hdl, cb, NULL);
- if (!sa_setpar(hdl, &par)) {
- fprintf(stderr, "sa_setpar() failed\n");
+ sio_onmove(hdl, cb, NULL);
+ if (!sio_setpar(hdl, &par)) {
+ fprintf(stderr, "sio_setpar() failed\n");
exit(1);
}
- if (!sa_getpar(hdl, &par)) {
- fprintf(stderr, "sa_getpar() failed\n");
+ if (!sio_getpar(hdl, &par)) {
+ fprintf(stderr, "sio_getpar() failed\n");
exit(1);
}
- if (!sa_start(hdl)) {
- fprintf(stderr, "sa_start() failed\n");
+ if (!sio_start(hdl)) {
+ fprintf(stderr, "sio_start() failed\n");
exit(1);
}
fprintf(stderr, "using %u bytes per buffer, rounding to %u\n",
@@ -121,13 +121,13 @@ main(int argc, char **argv) {
}
if (len == 0)
break;
- n = sa_write(hdl, buf, len);
+ n = sio_write(hdl, buf, len);
if (n == 0) {
- fprintf(stderr, "sa_write: failed\n");
+ fprintf(stderr, "sio_write: failed\n");
exit(1);
}
playpos += n;
}
- sa_close(hdl);
+ sio_close(hdl);
return 0;
}
diff --git a/regress/lib/libsndio/rec/Makefile b/regress/lib/libsndio/rec/Makefile
new file mode 100644
index 00000000000..773e9789f26
--- /dev/null
+++ b/regress/lib/libsndio/rec/Makefile
@@ -0,0 +1,6 @@
+# $OpenBSD: Makefile,v 1.1 2008/10/27 00:26:33 ratchov Exp $
+PROG= rec
+LDADD= -lsndio
+REGRESS_SKIP=
+
+.include <bsd.regress.mk>
diff --git a/regress/lib/libsa/sarec/sarec.c b/regress/lib/libsndio/rec/rec.c
index 269c51210f2..e7d737e8d37 100644
--- a/regress/lib/libsa/sarec/sarec.c
+++ b/regress/lib/libsndio/rec/rec.c
@@ -5,12 +5,12 @@
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
-#include "libsa.h"
+#include "sndio.h"
#define BUFSZ 0x1000
unsigned char buf[BUFSZ];
-struct sa_par par;
-char *xstr[] = SA_XSTRINGS;
+struct sio_par par;
+char *xstr[] = SIO_XSTRINGS;
long long pos = 0;
int rlat = 0;
@@ -27,19 +27,19 @@ cb(void *addr, int delta)
void
usage(void) {
- fprintf(stderr, "usage: sarec [-r rate] [-c nchan] [-e enc]\n");
+ fprintf(stderr, "usage: rec [-r rate] [-c nchan] [-e enc]\n");
}
int
main(int argc, char **argv) {
int ch;
- struct sa_hdl *hdl;
+ struct sio_hdl *hdl;
ssize_t n;
/*
* defaults parameters
*/
- sa_initpar(&par);
+ sio_initpar(&par);
par.sig = 1;
par.bits = 16;
par.rchan = 2;
@@ -61,7 +61,7 @@ main(int argc, char **argv) {
}
break;
case 'e':
- if (!sa_strtoenc(&par, optarg)) {
+ if (!sio_strtoenc(&par, optarg)) {
fprintf(stderr, "%s: unknown encoding\n", optarg);
exit(1);
}
@@ -84,28 +84,28 @@ main(int argc, char **argv) {
}
}
- hdl = sa_open(NULL, SA_REC, 0);
+ hdl = sio_open(NULL, SIO_REC, 0);
if (hdl == NULL) {
- fprintf(stderr, "sa_open() failed\n");
+ fprintf(stderr, "sio_open() failed\n");
exit(1);
}
- sa_onmove(hdl, cb, NULL);
- if (!sa_setpar(hdl, &par)) {
- fprintf(stderr, "sa_setpar() failed\n");
+ sio_onmove(hdl, cb, NULL);
+ if (!sio_setpar(hdl, &par)) {
+ fprintf(stderr, "sio_setpar() failed\n");
exit(1);
}
- if (!sa_getpar(hdl, &par)) {
- fprintf(stderr, "sa_getpar() failed\n");
+ if (!sio_getpar(hdl, &par)) {
+ fprintf(stderr, "sio_getpar() failed\n");
exit(1);
}
- if (!sa_start(hdl)) {
- fprintf(stderr, "sa_start() failed\n");
+ if (!sio_start(hdl)) {
+ fprintf(stderr, "sio_start() failed\n");
exit(1);
}
for (;;) {
- n = sa_read(hdl, buf, BUFSZ);
+ n = sio_read(hdl, buf, BUFSZ);
if (n == 0) {
- fprintf(stderr, "sa_write: failed\n");
+ fprintf(stderr, "sio_write: failed\n");
exit(1);
}
rlat -= n / (int)(par.bps * par.rchan);
@@ -114,6 +114,6 @@ main(int argc, char **argv) {
exit(1);
}
}
- sa_close(hdl);
+ sio_close(hdl);
return 0;
}