2 * ALSA lisp implementation
3 * Copyright (c) 2003 by Jaroslav Kysela <perex@suse.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 #include "asoundlib.h"
31 static int verbose = 0;
32 static int warning = 0;
35 static void interpret_filename(const char *file)
43 memset(&cfg, 0, sizeof(cfg));
44 if (file != NULL && strcmp(file, "-") != 0) {
45 if ((err = snd_input_stdio_open(&in, file, "r")) < 0) {
46 fprintf(stderr, "unable to open filename '%s' (%s)\n", file, snd_strerror(err));
50 if ((err = snd_input_stdio_attach(&in, stdin, 0)) < 0) {
51 fprintf(stderr, "unable to attach stdin '%s' (%s)\n", file, snd_strerror(err));
55 if (snd_output_stdio_attach(&out, stdout, 0) < 0) {
57 fprintf(stderr, "unable to attach stdout (%s)\n", strerror(errno));
60 err = snd_config_top(&root);
62 fprintf(stderr, "unable to allocate config root\n");
64 cfg.verbose = verbose;
65 cfg.warning = warning;
68 cfg.out = cfg.eout = cfg.vout = cfg.wout = cfg.dout = out;
71 err = alsa_lisp(&cfg, NULL);
74 fprintf(stderr, "alsa lisp returned error %i (%s)\n", err, strerror(err));
76 printf("file %s passed ok via alsa lisp interpreter\n", file);
77 snd_config_save(root, out);
78 snd_output_close(out);
80 snd_config_delete(root);
83 static void usage(void)
85 fprintf(stderr, "usage: alsalisp [-vdw] [file...]\n");
89 int main(int argc, char **argv)
93 while ((c = getopt(argc, argv, "vdw")) != -1) {
114 interpret_filename(NULL);
117 interpret_filename(*argv++);