/external/toybox/ |
D | Android.bp | 69 "toys/lsb/gzip.c", 70 "toys/lsb/hostname.c", 71 "toys/lsb/md5sum.c", 72 "toys/lsb/mktemp.c", 73 "toys/lsb/seq.c", 74 "toys/net/microcom.c", 75 "toys/other/dos2unix.c", 76 "toys/other/readlink.c", 77 "toys/other/setsid.c", 78 "toys/other/stat.c", [all …]
|
D | main.c | 22 struct toy_context toys; variable 33 if (!toys.which && strstart(&name, "toybox")) return toy_list; in toy_find() 65 toys.exitval = 127; in unknown() 66 toys.which = toy_list; in unknown() 73 toys.which = which; in toy_singleinit() 74 toys.argv = argv; in toy_singleinit() 75 toys.toycount = ARRAY_LEN(toy_list); in toy_singleinit() 80 if (CFG_TOYBOX && toys.which == toy_list && toys.argv[2]) in toy_singleinit() 81 if (!(toys.which = toy_find(toys.argv[2]))) unknown(toys.argv[2]); in toy_singleinit() 94 toys.optargs = argv+1; in toy_singleinit() [all …]
|
/external/toybox/toys/net/ |
D | ftpget.c | 68 if (toys.optflags & FLAG_v) fprintf(stderr, "%s\n", toybuf); in xread2line() 79 if (toys.optflags & FLAG_v) fprintf(stderr, s, cmd, arg); in ftp_line() 96 char *s, *remote = toys.optargs[2]; in ftpget_main() 99 if (!(toys.optflags&(FLAG_v-1))) in ftpget_main() 100 toys.optflags |= (toys.which->name[3]=='g') ? FLAG_g : FLAG_s; in ftpget_main() 105 if (!remote) remote = toys.optargs[1]; in ftpget_main() 108 TT.fd = xconnectany(xgetaddrinfo(*toys.optargs, TT.p, 0, SOCK_STREAM, 0, in ftpget_main() 118 if (toys.optflags & FLAG_m) { in ftpget_main() 119 if (toys.optc != 3) error_exit("-m FROM TO"); in ftpget_main() 120 ftp_line("RNFR", toys.optargs[1], 350); in ftpget_main() [all …]
|
/external/toybox/toys/other/ |
D | i2ctools.c | 79 if (toys.optflags & FLAG_y) return; in confirm() 181 if (toys.optflags & FLAG_l) { in i2cdetect_main() 182 if (toys.optc) error_exit("-l doesn't take arguments"); in i2cdetect_main() 184 } else if (toys.optflags & FLAG_F) { in i2cdetect_main() 185 if (toys.optc != 1) error_exit("-F BUS"); in i2cdetect_main() 186 i2cdetect_dash_F(atolx_range(*toys.optargs, 0, INT_MAX)); in i2cdetect_main() 190 if (toys.optflags & FLAG_a) { in i2cdetect_main() 195 if (toys.optc != 1 && toys.optc != 3) error_exit("bad args"); in i2cdetect_main() 196 bus = atolx_range(*toys.optargs, 0, INT_MAX); in i2cdetect_main() 197 if (toys.optc == 3) { in i2cdetect_main() [all …]
|
D | vconfig.c | 33 char *cmd = *toys.optargs; in vconfig_main() 43 for (i=0; i<j; i++) if (!strcmp(toys.optargs[1], types[i])) break; in vconfig_main() 46 error_exit("%s: unknown '%s'", cmd, toys.optargs[1]); in vconfig_main() 57 xstrncpy(request.device1, toys.optargs[1], sizeof(request.device1)); in vconfig_main() 61 if (toys.optargs[2]) request.u.VID = atolx_range(toys.optargs[2], 0, 4094); in vconfig_main() 67 if (toys.optargs[2]) request.u.flag = atolx_range(toys.optargs[2], 0, 1); in vconfig_main() 68 if (toys.optargs[3]) request.vlan_qos = atolx_range(toys.optargs[3], 0, 7); in vconfig_main() 71 if (toys.optargs[2]) in vconfig_main() 72 request.u.skb_priority = atolx_range(toys.optargs[2], 0, INT_MAX); in vconfig_main() 73 if (toys.optargs[3]) request.vlan_qos = atolx_range(toys.optargs[3], 0, 7); in vconfig_main() [all …]
|
D | nsenter.c | 106 return toys.optflags & FLAG_r; in test_r() 111 return toys.optflags & FLAG_f; in test_f() 126 if (CFG_UNSHARE && *toys.which->name=='u') { in unshare_main() 131 if (test_r()) toys.optflags |= FLAG_U; in unshare_main() 134 if (toys.optflags & (1<<i)) f |= flags[i]; in unshare_main() 140 toys.exitval = xrun(toys.optargs); in unshare_main() 151 if (toys.optflags & (1<<i)) { in unshare_main() 153 if (!(toys.optflags & FLAG_t)) error_exit("need -t or =filename"); in unshare_main() 164 if ((toys.optflags & FLAG_p) && !(toys.optflags & FLAG_F)) { in unshare_main() 165 toys.exitval = xrun(toys.optargs); in unshare_main() [all …]
|
D | help.c | 32 toys.which = t; in do_help() 46 if (toys.rebound && !*toys.optargs && !toys.optflags) { in help_main() 47 for (i = 0; i < toys.toycount; i++) { in help_main() 49 toys.which = toy_list+i; in help_main() 56 struct toy_list *t = toys.which; in help_main() 58 if (*toys.optargs && !(t = toy_find(*toys.optargs))) in help_main() 59 error_exit("Unknown command '%s'", *toys.optargs); in help_main() 68 for (i=0; i < toys.toycount; i++) in help_main() 73 for (i = 0; i < toys.toycount; i++) { in help_main()
|
D | mountpoint.c | 26 if (!(toys.optflags & FLAG_q)) printf("%s: not a %s\n", *toys.optargs, gripe); in die() 28 toys.exitval++; in die() 35 char *arg = *toys.optargs; in mountpoint_main() 36 int quiet = toys.optflags & FLAG_q; in mountpoint_main() 40 if (toys.optflags & FLAG_x) { in mountpoint_main() 61 toys.exitval = !(st1.st_dev != st2.st_dev || st1.st_ino == st2.st_ino); in mountpoint_main() 62 if (toys.optflags & FLAG_d) in mountpoint_main() 65 printf("%s is %sa mountpoint\n", *toys.optargs, toys.exitval ? "not " : ""); in mountpoint_main()
|
D | ionice.c | 60 if (!TT.p && !toys.optc) error_exit("Need -p or COMMAND"); in ionice_main() 61 if (toys.optflags == FLAG_p) { in ionice_main() 67 if (-1 == ioprio_set() && !(toys.optflags&FLAG_t)) perror_exit("set"); in ionice_main() 68 if (!TT.p) xexec(toys.optargs); in ionice_main() 76 TT.p = atolx(*toys.optargs); in iorenice_main() 77 if (toys.optc == 1) { in iorenice_main() 88 if (!strcmp(toys.optargs[toys.optc-1], classes[TT.c])) break; in iorenice_main() 89 if (toys.optc == 3 || TT.c == 4) TT.n = atolx(toys.optargs[1]); in iorenice_main()
|
D | taskset.c | 49 char *s = *toys.optargs, *failed = "failed to %s %d's affinity"; in do_taskset() 73 if (i || toys.optc < 2) return; in do_taskset() 76 k = strlen(s = *toys.optargs); in do_taskset() 82 if (digit > 15) error_exit("bad mask '%s'", *toys.optargs); in do_taskset() 101 if (!(toys.optflags & FLAG_p)) { in taskset_main() 102 if (toys.optc < 2) error_exit("Needs 2 args"); in taskset_main() 104 xexec(toys.optargs+1); in taskset_main() 107 pid_t pid = strtol(toys.optargs[toys.optc-1], &c, 10); in taskset_main() 109 if (*c) error_exit("Not int %s", toys.optargs[1]); in taskset_main() 111 if (toys.optflags & FLAG_a) { in taskset_main() [all …]
|
D | chrt.c | 61 if (toys.optflags&FLAG_m) { in chrt_main() 70 if (toys.optflags==FLAG_p && !*toys.optargs) { in chrt_main() 84 if (!*toys.optargs) help_exit("no PRIORITY"); in chrt_main() 85 if (!toys.optargs[1] == !(toys.optflags&FLAG_p)) in chrt_main() 89 if (-1==(pol = highest_bit(toys.optflags&0x2f))) pol = SCHED_RR; in chrt_main() 90 pri = atolx_range(*toys.optargs, sched_get_priority_min(pol), in chrt_main() 92 if (toys.optflags&FLAG_R) pol |= SCHED_RESET_ON_FORK; in chrt_main() 97 if (*(toys.optargs+1)) xexec(toys.optargs+1); in chrt_main()
|
D | sysctl.c | 47 if (!(toys.optflags & FLAG_e)) error_msg("unknown key '%s'", key); in key_error() 80 if (!(toys.optflags & FLAG_n)) xprintf("%s", key); in do_show_keys() 81 if (!(toys.optflags & (FLAG_N|FLAG_n))) xprintf(" = "); in do_show_keys() 83 if (!(toys.optflags & FLAG_N)) xprintf("%s", data); in do_show_keys() 84 if ((toys.optflags & (FLAG_N|FLAG_n)) != (FLAG_N|FLAG_n)) xputc('\n'); in do_show_keys() 99 if ((toys.optflags & FLAG_w) && !value) { in process_key() 108 if (!(value && (!write_key(path, key, value) || (toys.optflags & FLAG_q)))) { in process_key() 120 if (toys.optflags & FLAG_a) dirtree_read("/proc/sys", do_show_keys); in sysctl_main() 123 else if (toys.optflags & FLAG_p) { in sysctl_main() 124 FILE *fp = xfopen(*toys.optargs ? *toys.optargs : "/etc/sysctl.conf", "r"); in sysctl_main() [all …]
|
/external/toybox/toys/pending/ |
D | useradd.c | 44 char *s = *toys.optargs, *entry; 48 if (toys.optc == 2) { 49 if (toys.optflags) help_exit("options with USER GROUP"); 50 xexec((char *[]){"groupadd", toys.optargs[0], toys.optargs[1], 0}); 67 pwd.pw_dir = TT.dir ? TT.dir : xmprintf("/home/%s", *toys.optargs); 81 if (toys.optflags & FLAG_u) { 85 if (toys.optflags & FLAG_S) TT.uid = CFG_TOYBOX_UID_SYS; 92 if (toys.optflags & FLAG_G) TT.gid = xgetgrnam(TT.u_grp)->gr_gid; 95 if (toys.optflags & FLAG_S) TT.gid = CFG_TOYBOX_UID_SYS; 104 if (!(toys.optflags & FLAG_G)) { [all …]
|
D | groupadd.c | 52 entry = xmprintf("%s:%s:%ld:", *toys.optargs, "x", TT.gid); 53 update_password(GROUP_PATH, *toys.optargs, entry); 55 entry = xmprintf("%s:%s::", *toys.optargs, "!"); 56 update_password(SECURE_GROUP_PATH, *toys.optargs, entry); 65 if (toys.optflags && toys.optc == 2) in groupadd_main() 68 if (toys.optc == 2) { //add user to group in groupadd_main() 70 xgetpwnam(*toys.optargs); in groupadd_main() 71 if (!(grp = getgrnam(toys.optargs[1]))) in groupadd_main() 72 error_exit("group '%s' does not exist", toys.optargs[1]); in groupadd_main() 73 if (!grp->gr_mem) entry = xmprintf("%s", *toys.optargs); in groupadd_main() [all …]
|
D | arp.c | 127 resolve_host(toys.optargs[0], &sa); in check_flags() 143 if (!toys.optargs[1]) error_exit("bad syntax"); in set_entry() 145 if (!(toys.optflags & FLAG_D)) { in set_entry() 146 char *ptr = toys.optargs[1]; in set_entry() 163 xstrncpy(ifre.ifr_name, toys.optargs[1], IFNAMSIZ); in set_entry() 165 if ((toys.optflags & FLAG_H) && (ifre.ifr_hwaddr.sa_family != ARPHRD_ETHER)) in set_entry() 171 if (toys.optargs[2]) check_flags(&flags, (toys.optargs+2)); in set_entry() 176 if (toys.optflags & FLAG_v) xprintf("Entry set for %s\n", toys.optargs[0]); in set_entry() 200 if (toys.optargs[1]) check_flags(&flags, (toys.optargs+1)); in delete_entry() 205 if (toys.optflags & FLAG_v) xprintf("Delete entry for %s\n", toys.optargs[0]); in delete_entry() [all …]
|
D | arping.c | 85 if (!(toys.optflags & FLAG_q)) { in done() 90 if (toys.optflags & FLAG_D) exit(!!TT.rcvd_nr); in done() 92 if (toys.optflags & FLAG_U) exit(EXIT_SUCCESS); in done() 108 arp_h->ar_op = (toys.optflags & FLAG_A) ? htons(ARPOP_REPLY) in send_packet() 114 (toys.optflags & FLAG_A) ? &src_pk.sll_addr : &dst_pk.sll_addr, in send_packet() 152 if (toys.optflags & FLAG_D) { in recv_from() 157 if (!(toys.optflags & FLAG_q)) { in recv_from() 174 if (toys.optflags & FLAG_f) done(0); in recv_from() 175 if (!(toys.optflags & FLAG_b)) { in recv_from() 190 if (toys.optflags & FLAG_c) { in send_signal() [all …]
|
D | tcpsvd.c | 180 if (toys.optflags & FLAG_v) { in handle_exit() 182 xprintf("%s: end %d exit %d\n",toys.which->name, pid_n, WEXITSTATUS(status)); in handle_exit() 184 xprintf("%s: end %d signaled %d\n",toys.which->name, pid_n, WTERMSIG(status)); in handle_exit() 185 if (TT.cn > 1) xprintf("%s: status %d/%d\n",toys.which->name, TT.count_all, TT.cn); in handle_exit() 228 port = strtoul(toys.optargs[1], &ptr, 10); in create_bind_sock() 231 if (*ptr) ptr = toys.optargs[1]; in create_bind_sock() 259 if (toys.optflags & FLAG_v) xprintf("got signal %d, exit\n", sig); in handle_signal() 275 TT.udp = (*toys.which->name == 'u'); in tcpsvd_main() 276 if (TT.udp) toys.optflags &= ~FLAG_C; in tcpsvd_main() 278 if (toys.optflags & FLAG_C) { in tcpsvd_main() [all …]
|
D | ipcrm.c | 71 ++toys.argv; in ipcrm_main() 72 if (toys.optc && (!strcmp(*toys.argv, "shm") || in ipcrm_main() 73 !strcmp(*toys.argv, "sem") || !strcmp(*toys.argv, "msg"))) { in ipcrm_main() 74 int t = (toys.argv[0][1] == 'h')? 1 : (toys.argv[0][1] == 's')? 2:3; in ipcrm_main() 76 while (*(++toys.argv)) do_ipcrm(0, t, *toys.argv); in ipcrm_main() 86 if (toys.optc) help_exit("unknown argument: %s", *toys.optargs); in ipcrm_main()
|
/external/toybox/toys/posix/ |
D | test.c | 104 toys.exitval = 2; in test_main() 105 if (CFG_TOYBOX && !strcmp("[", toys.which->name)) in test_main() 106 if (!toys.optc || strcmp("]", toys.optargs[--toys.optc])) in test_main() 110 if (toys.optc) for (pos = paren = pstack = 0; ; pos++) { in test_main() 111 int len = toys.optc-pos; in test_main() 116 result = do_test(toys.optargs+pos, &len); in test_main() 120 if (toys.optargs[pos+1]) { in test_main() 121 if (!strcmp("!", toys.optargs[pos])) { in test_main() 125 if (!strcmp("(", toys.optargs[pos])) { in test_main() 131 result = *toys.optargs[pos++]; in test_main() [all …]
|
D | cksum.c | 54 unsigned crc = (toys.optflags & FLAG_P) ? 0xffffffff : 0; in do_cksum() 59 cksum = (toys.optflags & FLAG_L) ? cksum_le : cksum_be; in do_cksum() 74 if (!(toys.optflags & FLAG_N)) { in do_cksum() 81 printf((toys.optflags & FLAG_H) ? "%08x" : "%u", in do_cksum() 82 (toys.optflags & FLAG_I) ? crc : ~crc); in do_cksum() 83 if (!(toys.optflags&FLAG_N)) printf(" %"PRIu64, llen2); in do_cksum() 84 if (toys.optc) printf(" %s", name); in do_cksum() 90 crc_init(TT.crc_table, toys.optflags & FLAG_L); in cksum_main() 91 loopfiles(toys.optargs, do_cksum); in cksum_main() 96 toys.optflags |= FLAG_H|FLAG_N|FLAG_P|FLAG_L; in crc32_main() [all …]
|
D | wc.c | 45 if (!(!toys.optc && !(toys.optflags & (toys.optflags-1))) && toys.optc!=1) 49 if (toys.optflags&(1<<i)) { 55 if (*toys.optargs) printf(" %s", name); 65 if (toys.optflags == FLAG_c) { in do_wc() 117 if (!toys.optflags) toys.optflags = FLAG_l|FLAG_w|FLAG_c; in wc_main() 118 loopfiles(toys.optargs, do_wc); in wc_main() 119 if (toys.optc>1) show_lengths(TT.totals, "total"); in wc_main()
|
D | cat.c | 56 int i, len, size=(toys.optflags & FLAG_u) ? 1 : sizeof(toybuf); in do_cat() 61 toys.exitval = EXIT_FAILURE; in do_cat() 65 if ((CFG_CAT_V || CFG_CATV) && (toys.optflags&~FLAG_u)) { in do_cat() 69 if (c > 126 && (toys.optflags & FLAG_v)) { in do_cat() 81 if (toys.optflags & FLAG_e) xputc('$'); in do_cat() 82 } else if (toys.optflags & (c==9 ? FLAG_t : FLAG_v)) { in do_cat() 95 loopfiles(toys.optargs, do_cat); in cat_main() 100 toys.optflags ^= FLAG_v; in catv_main() 101 loopfiles(toys.optargs, do_cat); in catv_main()
|
D | cmp.c | 44 toys.exitval = 0; 53 toys.exitval = 1; 54 if (toys.optflags & FLAG_l) 57 if (!(toys.optflags & FLAG_s)) 67 if (!(toys.optflags & FLAG_s)) 69 toys.exitval = 1; 80 toys.exitval = 2; in cmp_main() 81 loopfiles_rw(toys.optargs, O_CLOEXEC|(WARN_ONLY*!(toys.optflags&FLAG_s)), 0, in cmp_main() 83 if (toys.optc == 1) do_cmp(0, "-"); in cmp_main()
|
/external/toybox/lib/ |
D | args.c | 146 if (toys.optflags & opt->dex[0]) { in gotflag() 151 if (clr->arg && (i & toys.optflags & opt->dex[0])) *clr->arg = 0; in gotflag() 152 toys.optflags &= ~opt->dex[0]; in gotflag() 156 toys.optflags |= opt->dex[1]; in gotflag() 160 if (toys.optflags & gof->excludes) { in gotflag() 164 if (opt == bad || !(i & toys.optflags)) continue; in gotflag() 165 if (toys.optflags & bad->dex[2]) break; in gotflag() 187 arg = toys.argv[++gof->argc]; in gotflag() 233 char *options = toys.which->options; in parse_optflaglist() 393 toys.exitval = toys.which->flags >> 24; in get_optflags() [all …]
|
/external/toybox/toys/example/ |
D | logwrapper.c | 24 char *log = getenv("WRAPLOG"), *omnom = basename(*toys.argv), in logwrapper_main() 32 for (i = 0; i<toys.optc; i++) len += 2*strlen(toys.optargs[i])+3; in logwrapper_main() 36 for (i = 0; i<toys.optc; i++) { in logwrapper_main() 39 for (sss = toys.optargs[i]; *sss; sss++) { in logwrapper_main() 59 if (**toys.argv == '/') { in logwrapper_main() 61 if (!strcmp(list->str, *toys.argv)) break; in logwrapper_main() 71 **toys.argv == '/' ? *toys.argv : "logwrapper", getenv("PATH")); in logwrapper_main() 72 *toys.argv = list->str; in logwrapper_main() 73 execve(list->str, toys.argv, environ); in logwrapper_main()
|