Lines Matching refs:argv
11 typedef int (*handler_t)(int argc, char** argv);
27 static int help(int argc, char** argv);
28 static int set_discoverable(int argc, char** argv);
29 static int set_name(int argc, char** argv);
30 static int set_pcm_loopback(int argc, char** argv);
31 static int set_sco_route(int argc, char** argv);
54 static int help(int argc, char** argv) { in help() argument
60 const command_t* command = find_command(argv[0]); in help()
62 printf("No command named '%s'.\n", argv[0]); in help()
66 printf("%s %s\n", argv[0], command->help); in help()
70 static int set_discoverable(int argc, char** argv) { in set_discoverable() argument
76 if (strcmp(argv[0], "true") && strcmp(argv[0], "false")) { in set_discoverable()
77 printf("Invalid discoverable mode '%s'.\n", argv[0]); in set_discoverable()
82 if (argv[0][0] == 't') packet[ARRAY_SIZE(packet) - 1] = 0x03; in set_discoverable()
87 static int set_name(int argc, char** argv) { in set_name() argument
93 size_t len = strlen(argv[0]); in set_name()
100 memcpy(&packet[3], argv[0], len + 1); in set_name()
111 memcpy(&packet[6], argv[0], len); in set_name()
115 static int set_pcm_loopback(int argc, char** argv) { in set_pcm_loopback() argument
121 if (strcmp(argv[0], "true") && strcmp(argv[0], "false")) { in set_pcm_loopback()
122 printf("Invalid PCM mode '%s'.\n", argv[0]); in set_pcm_loopback()
127 if (argv[0][0] == 't') packet[ARRAY_SIZE(packet) - 1] = 0x01; in set_pcm_loopback()
132 static int set_sco_route(int argc, char** argv) { in set_sco_route() argument
139 if (!strcmp(argv[0], "pcm")) in set_sco_route()
141 else if (!strcmp(argv[0], "i2s")) in set_sco_route()
143 else if (!strcmp(argv[0], "uart")) in set_sco_route()
147 printf("Invalid SCO route specified: %s\n", argv[0]); in set_sco_route()
157 int main(int argc, char** argv) { in main() argument
159 usage(argv[0]); in main()
163 const command_t* command = find_command(argv[1]); in main()
165 printf("Unrecognized command '%s'.\n", argv[1]); in main()
170 printf("Unhandled command '%s'.\n", argv[1]); in main()
174 return command->handler(argc - 2, &argv[2]); in main()