Lines Matching refs:argv
679 static int adb_shell(int argc, const char** argv) { in adb_shell() argument
694 argv[0] = "adb shell"; // So getopt(3) error messages start "adb shell". in adb_shell()
697 __argv = const_cast<char**>(argv); in adb_shell()
701 while ((opt = getopt(argc, const_cast<char**>(argv), "+e:ntTx")) != -1) { in adb_shell()
777 command = android::base::Join(std::vector<const char*>(argv + optind, argv + argc), ' '); in adb_shell()
785 static int adb_abb(int argc, const char** argv) { in adb_abb() argument
804 std::vector<const char*> args(argv + optind, argv + argc); in adb_abb()
814 static int adb_shell_noinput(int argc, const char** argv) { in adb_shell_noinput() argument
820 return adb_shell(argc, argv); in adb_shell_noinput()
1021 static int ppp(int argc, const char** argv) { in ppp() argument
1023 error_exit("adb %s not implemented on Win32", argv[0]); in ppp()
1026 if (argc < 2) error_exit("usage: adb %s <adb service name> [ppp opts]", argv[0]); in ppp()
1028 const char* adb_service_name = argv[1]; in ppp()
1049 ppp_args[i - 1] = argv[i]; in ppp()
1198 static int logcat(int argc, const char** argv) { in logcat() argument
1204 if (!strcmp(argv[0], "longcat")) { in logcat()
1209 ++argv; in logcat()
1211 cmd += " " + escape_arg(*argv++); in logcat()
1238 static int backup(int argc, const char** argv) { in backup() argument
1245 if (!strcmp("-f", argv[i])) { in backup()
1247 filename = argv[i+1]; in backup()
1249 argv[i++] = argv[j++]; in backup()
1252 argv[argc] = nullptr; in backup()
1269 ++argv; in backup()
1271 cmd += " " + escape_arg(*argv++); in backup()
1289 static int restore(int argc, const char** argv) { in restore() argument
1294 const char* filename = argv[1]; in restore()
1516 int adb_commandline(int argc, const char** argv) { in adb_commandline() argument
1538 if (!strcmp(argv[0], "server")) { in adb_commandline()
1540 } else if (!strcmp(argv[0], "nodaemon")) { in adb_commandline()
1542 } else if (!strcmp(argv[0], "fork-server")) { in adb_commandline()
1545 } else if (!strcmp(argv[0], "--reply-fd")) { in adb_commandline()
1547 const char* reply_fd_str = argv[1]; in adb_commandline()
1549 argv++; in adb_commandline()
1555 } else if (!strncmp(argv[0], "-s", 2)) { in adb_commandline()
1556 if (isdigit(argv[0][2])) { in adb_commandline()
1557 serial = argv[0] + 2; in adb_commandline()
1559 if (argc < 2 || argv[0][2] != '\0') error_exit("-s requires an argument"); in adb_commandline()
1560 serial = argv[1]; in adb_commandline()
1562 argv++; in adb_commandline()
1564 } else if (!strncmp(argv[0], "-t", 2)) { in adb_commandline()
1566 if (isdigit(argv[0][2])) { in adb_commandline()
1567 id = argv[0] + 2; in adb_commandline()
1569 id = argv[1]; in adb_commandline()
1571 argv++; in adb_commandline()
1577 } else if (!strcmp(argv[0], "-d")) { in adb_commandline()
1579 } else if (!strcmp(argv[0], "-e")) { in adb_commandline()
1581 } else if (!strcmp(argv[0], "-a")) { in adb_commandline()
1583 } else if (!strncmp(argv[0], "-H", 2)) { in adb_commandline()
1584 if (argv[0][2] == '\0') { in adb_commandline()
1586 server_host_str = argv[1]; in adb_commandline()
1588 argv++; in adb_commandline()
1590 server_host_str = argv[0] + 2; in adb_commandline()
1592 } else if (!strncmp(argv[0], "-P", 2)) { in adb_commandline()
1593 if (argv[0][2] == '\0') { in adb_commandline()
1595 server_port_str = argv[1]; in adb_commandline()
1597 argv++; in adb_commandline()
1599 server_port_str = argv[0] + 2; in adb_commandline()
1601 } else if (!strcmp(argv[0], "-L")) { in adb_commandline()
1603 server_socket_str = argv[1]; in adb_commandline()
1605 argv++; in adb_commandline()
1611 argv++; in adb_commandline()
1683 if (!strncmp(argv[0], "wait-for-", strlen("wait-for-"))) { in adb_commandline()
1684 const char* service = argv[0]; in adb_commandline()
1698 argv++; in adb_commandline()
1702 if (!strcmp(argv[0], "devices")) { in adb_commandline()
1706 } else if (argc == 2 && !strcmp(argv[1], "-l")) { in adb_commandline()
1707 listopt = argv[1]; in adb_commandline()
1712 std::string query = android::base::StringPrintf("host:%s%s", argv[0], listopt); in adb_commandline()
1719 } else if (!strcmp(argv[0], "transport-id")) { in adb_commandline()
1728 } else if (!strcmp(argv[0], "connect")) { in adb_commandline()
1731 std::string query = android::base::StringPrintf("host:connect:%s", argv[1]); in adb_commandline()
1733 } else if (!strcmp(argv[0], "disconnect")) { in adb_commandline()
1737 (argc == 2) ? argv[1] : ""); in adb_commandline()
1739 } else if (!strcmp(argv[0], "abb")) { in adb_commandline()
1740 return adb_abb(argc, argv); in adb_commandline()
1741 } else if (!strcmp(argv[0], "pair")) { in adb_commandline()
1752 password = argv[2]; in adb_commandline()
1755 android::base::StringPrintf("host:pair:%s:%s", password.c_str(), argv[1]); in adb_commandline()
1758 } else if (!strcmp(argv[0], "emu")) { in adb_commandline()
1759 return adb_send_emulator_command(argc, argv, serial); in adb_commandline()
1760 } else if (!strcmp(argv[0], "shell")) { in adb_commandline()
1761 return adb_shell(argc, argv); in adb_commandline()
1762 } else if (!strcmp(argv[0], "exec-in") || !strcmp(argv[0], "exec-out")) { in adb_commandline()
1763 int exec_in = !strcmp(argv[0], "exec-in"); in adb_commandline()
1765 if (argc < 2) error_exit("usage: adb %s command", argv[0]); in adb_commandline()
1768 cmd += argv[1]; in adb_commandline()
1770 argv += 2; in adb_commandline()
1772 cmd += " " + escape_arg(*argv++); in adb_commandline()
1788 } else if (!strcmp(argv[0], "kill-server")) { in adb_commandline()
1790 } else if (!strcmp(argv[0], "sideload")) { in adb_commandline()
1792 if (adb_sideload_install(argv[1], false /* rescue_mode */)) { in adb_commandline()
1797 } else if (!strcmp(argv[0], "rescue")) { in adb_commandline()
1803 if (!strcmp(argv[1], "getprop")) { in adb_commandline()
1809 android::base::StringPrintf("rescue-getprop:%s", argv[2])); in adb_commandline()
1812 } else if (!strcmp(argv[1], "install")) { in adb_commandline()
1814 if (adb_sideload_install(argv[2], true /* rescue_mode */) != 0) { in adb_commandline()
1817 } else if (!strcmp(argv[1], "wipe")) { in adb_commandline()
1818 if (argc != 3 || strcmp(argv[2], "userdata") != 0) { in adb_commandline()
1826 } else if (!strcmp(argv[0], "tcpip")) { in adb_commandline()
1829 if (!android::base::ParseInt(argv[1], &port, 1, 65535)) { in adb_commandline()
1830 error_exit("tcpip: invalid port: %s", argv[1]); in adb_commandline()
1833 } else if (!strcmp(argv[0], "remount")) { in adb_commandline()
1842 args.insert(args.cend(), argv, argv + argc); in adb_commandline()
1845 auto command = android::base::StringPrintf("%s:%s", argv[0], argv[1]); in adb_commandline()
1852 else if (!strcmp(argv[0], "reboot") || in adb_commandline()
1853 !strcmp(argv[0], "reboot-bootloader") || in adb_commandline()
1854 !strcmp(argv[0], "reboot-fastboot") || in adb_commandline()
1855 !strcmp(argv[0], "usb") || in adb_commandline()
1856 !strcmp(argv[0], "disable-verity") || in adb_commandline()
1857 !strcmp(argv[0], "enable-verity")) { in adb_commandline()
1860 if (!strcmp(argv[0], "reboot-bootloader")) { in adb_commandline()
1862 } else if (!strcmp(argv[0], "reboot-fastboot")) { in adb_commandline()
1865 command = android::base::StringPrintf("%s:%s", argv[0], argv[1]); in adb_commandline()
1867 command = android::base::StringPrintf("%s:", argv[0]); in adb_commandline()
1870 } else if (!strcmp(argv[0], "root") || !strcmp(argv[0], "unroot")) { in adb_commandline()
1871 return adb_root(argv[0]) ? 0 : 1; in adb_commandline()
1872 } else if (!strcmp(argv[0], "bugreport")) { in adb_commandline()
1874 return bugreport.DoIt(argc, argv); in adb_commandline()
1875 } else if (!strcmp(argv[0], "forward") || !strcmp(argv[0], "reverse")) { in adb_commandline()
1876 bool reverse = !strcmp(argv[0], "reverse"); in adb_commandline()
1878 if (argc < 1) error_exit("%s requires an argument", argv[0]); in adb_commandline()
1879 ++argv; in adb_commandline()
1890 if (strcmp(argv[0], "--list") == 0) { in adb_commandline()
1893 } else if (strcmp(argv[0], "--remove-all") == 0) { in adb_commandline()
1896 } else if (strcmp(argv[0], "--remove") == 0) { in adb_commandline()
1899 cmd = std::string("killforward:") + argv[1]; in adb_commandline()
1900 } else if (strcmp(argv[0], "--no-rebind") == 0) { in adb_commandline()
1903 if (forward_targets_are_valid(argv[1], argv[2], &error_message)) { in adb_commandline()
1904 cmd = std::string("forward:norebind:") + argv[1] + ";" + argv[2]; in adb_commandline()
1909 if (forward_targets_are_valid(argv[0], argv[1], &error_message)) { in adb_commandline()
1910 cmd = std::string("forward:") + argv[0] + ";" + argv[1]; in adb_commandline()
1931 } else if (!strcmp(argv[0], "mdns")) { in adb_commandline()
1934 ++argv; in adb_commandline()
1942 if (!strcmp(argv[0], "check")) { in adb_commandline()
1943 if (argc != 1) error_exit("mdns %s doesn't take any arguments", argv[0]); in adb_commandline()
1945 } else if (!strcmp(argv[0], "services")) { in adb_commandline()
1946 if (argc != 1) error_exit("mdns %s doesn't take any arguments", argv[0]); in adb_commandline()
1950 error_exit("unknown mdns command [%s]", argv[0]); in adb_commandline()
1956 else if (!strcmp(argv[0], "ls")) { in adb_commandline()
1958 return do_sync_ls(argv[1]) ? 0 : 1; in adb_commandline()
1959 } else if (!strcmp(argv[0], "push")) { in adb_commandline()
1967 parse_push_pull_args(&argv[1], argc - 1, &srcs, &dst, ©_attrs, &sync, &compression, in adb_commandline()
1971 } else if (!strcmp(argv[0], "pull")) { in adb_commandline()
1977 parse_push_pull_args(&argv[1], argc - 1, &srcs, &dst, ©_attrs, nullptr, &compression, in adb_commandline()
1981 } else if (!strcmp(argv[0], "install")) { in adb_commandline()
1983 return install_app(argc, argv); in adb_commandline()
1984 } else if (!strcmp(argv[0], "install-multiple")) { in adb_commandline()
1986 return install_multiple_app(argc, argv); in adb_commandline()
1987 } else if (!strcmp(argv[0], "install-multi-package")) { in adb_commandline()
1989 return install_multi_package(argc, argv); in adb_commandline()
1990 } else if (!strcmp(argv[0], "uninstall")) { in adb_commandline()
1992 return uninstall_app(argc, argv); in adb_commandline()
1993 } else if (!strcmp(argv[0], "sync")) { in adb_commandline()
2004 while ((opt = getopt(argc, const_cast<char**>(argv), "lnz:Z")) != -1) { in adb_commandline()
2026 src = argv[optind]; in adb_commandline()
2048 else if (!strcmp(argv[0], "get-state") || !strcmp(argv[0], "get-serialno") || in adb_commandline()
2049 !strcmp(argv[0], "get-devpath")) { in adb_commandline()
2050 return adb_query_command(format_host_command(argv[0])); in adb_commandline()
2053 else if (!strcmp(argv[0], "logcat") || !strcmp(argv[0], "lolcat") || in adb_commandline()
2054 !strcmp(argv[0], "longcat")) { in adb_commandline()
2055 return logcat(argc, argv); in adb_commandline()
2056 } else if (!strcmp(argv[0], "ppp")) { in adb_commandline()
2057 return ppp(argc, argv); in adb_commandline()
2058 } else if (!strcmp(argv[0], "start-server")) { in adb_commandline()
2065 } else if (!strcmp(argv[0], "backup")) { in adb_commandline()
2066 return backup(argc, argv); in adb_commandline()
2067 } else if (!strcmp(argv[0], "restore")) { in adb_commandline()
2068 return restore(argc, argv); in adb_commandline()
2069 } else if (!strcmp(argv[0], "keygen")) { in adb_commandline()
2073 return adb_auth_keygen(argv[1]); in adb_commandline()
2074 } else if (!strcmp(argv[0], "pubkey")) { in adb_commandline()
2076 return adb_auth_pubkey(argv[1]); in adb_commandline()
2077 } else if (!strcmp(argv[0], "jdwp")) { in adb_commandline()
2079 } else if (!strcmp(argv[0], "track-jdwp")) { in adb_commandline()
2081 } else if (!strcmp(argv[0], "track-app")) { in adb_commandline()
2092 } else if (!strcmp(argv[0], "track-devices")) { in adb_commandline()
2093 if (argc > 2 || (argc == 2 && strcmp(argv[1], "-l"))) { in adb_commandline()
2097 } else if (!strcmp(argv[0], "raw")) { in adb_commandline()
2101 return adb_connect_command_bidirectional(argv[1]); in adb_commandline()
2105 else if (!strcmp(argv[0], "--help") || !strcmp(argv[0], "help") || !strcmp(argv[0], "/?")) { in adb_commandline()
2108 } else if (!strcmp(argv[0], "--version") || !strcmp(argv[0], "version")) { in adb_commandline()
2111 } else if (!strcmp(argv[0], "features")) { in adb_commandline()
2125 } else if (!strcmp(argv[0], "host-features")) { in adb_commandline()
2127 } else if (!strcmp(argv[0], "reconnect")) { in adb_commandline()
2129 return adb_query_command(format_host_command(argv[0])); in adb_commandline()
2131 if (!strcmp(argv[1], "device")) { in adb_commandline()
2135 } else if (!strcmp(argv[1], "offline")) { in adb_commandline()
2142 } else if (!strcmp(argv[0], "inc-server")) { in adb_commandline()
2150 int connection_fd = atoi(argv[1]); in adb_commandline()
2158 int output_fd = atoi(argv[2]); in adb_commandline()
2164 return incremental::serve(connection_fd, output_fd, argc - 3, argv + 3); in adb_commandline()
2167 error_exit("unknown command %s", argv[0]); in adb_commandline()