1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
| /* Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
| * Use of this source code is governed by a BSD-style license that can be
| * found in the LICENSE file.
| */
|
| #include <errno.h>
| #include <getopt.h>
| #include <stdio.h>
| #include <stdlib.h>
|
| #include "adhd_alsa.h"
|
| static unsigned arg_verbose = 0;
|
| static void help(void)
| {
| /* TODO(thutt): Add help */
| }
|
| static void process_arguments(int argc, char **argv)
| {
| static struct option options[] = {
| {
| .name = "help",
| .has_arg = no_argument,
| .flag = NULL,
| .val = 256
| },
| {
| .name = "verbose",
| .has_arg = no_argument,
| .flag = NULL,
| .val = 257
| },
| };
|
| while (1) {
| int option_index = 0;
| const int choice = getopt_long(argc, argv, "", options, &option_index);
|
| if (choice == -1) {
| break;
| }
|
| switch (choice) {
| case 256:
| help();
| break;
|
| case 257:
| arg_verbose = 1;
| break;
|
| default:
| printf("?? getopt returned character code 0%o ??\n", choice);
| }
| }
| }
|
|
| int main(int argc, char **argv)
| {
| adhd_alsa_info_t alsa_info;
| process_arguments(argc, argv);
|
| adhd_alsa_get_all_card_info(&alsa_info);
| adhd_alsa_release_card_info(&alsa_info);
| return 0;
| }
|
|