2 * ALSA lisp implementation
3 * Copyright (c) 2003 by Jaroslav Kysela <perex@perex.cz>
6 * This library is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as
8 * published by the Free Software Foundation; either version 2.1 of
9 * the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
28 #include "asoundlib.h"
31 static int verbose = 0;
32 static int warning = 0;
35 static void interpret_filename(const char *file)
42 memset(&cfg, 0, sizeof(cfg));
43 if (file != NULL && strcmp(file, "-") != 0) {
44 if ((err = snd_input_stdio_open(&in, file, "r")) < 0) {
45 fprintf(stderr, "unable to open filename '%s' (%s)\n", file, snd_strerror(err));
49 if ((err = snd_input_stdio_attach(&in, stdin, 0)) < 0) {
50 fprintf(stderr, "unable to attach stdin '%s' (%s)\n", file, snd_strerror(err));
54 if (snd_output_stdio_attach(&out, stdout, 0) < 0) {
56 fprintf(stderr, "unable to attach stdout (%s)\n", strerror(errno));
59 cfg.verbose = verbose;
60 cfg.warning = warning;
63 cfg.out = cfg.eout = cfg.vout = cfg.wout = cfg.dout = out;
64 err = alsa_lisp(&cfg, NULL);
66 fprintf(stderr, "alsa lisp returned error %i (%s)\n", err, strerror(err));
68 printf("file %s passed ok via alsa lisp interpreter\n", file);
69 snd_output_close(out);
73 static void usage(void)
75 fprintf(stderr, "usage: alsalisp [-vdw] [file...]\n");
79 int main(int argc, char **argv)
83 while ((c = getopt(argc, argv, "vdw")) != -1) {
104 interpret_filename(NULL);
107 interpret_filename(*argv++);