/external/toybox/ |
D | Android.mk | 63 toys/android/getenforce.c \ 64 toys/android/getprop.c \ 65 toys/android/load_policy.c \ 66 toys/android/restorecon.c \ 67 toys/android/runcon.c \ 68 toys/android/setenforce.c \ 69 toys/android/setprop.c \ 70 toys/lsb/dmesg.c \ 71 toys/lsb/hostname.c \ 72 toys/lsb/killall.c \ [all …]
|
D | main.c | 26 struct toy_context toys; variable 73 toys.which = which; in toy_singleinit() 74 toys.argv = argv; in toy_singleinit() 79 if (CFG_TOYBOX && toys.which == toy_list && toys.argv[2]) in toy_singleinit() 80 if (!(toys.which = toy_find(toys.argv[2]))) return; in toy_singleinit() 87 toys.optargs = argv+1; in toy_singleinit() 88 for (toys.optc = 0; toys.optargs[toys.optc]; toys.optc++); in toy_singleinit() 90 toys.old_umask = umask(0); in toy_singleinit() 91 if (!(which->flags & TOYFLAG_UMASK)) umask(toys.old_umask); in toy_singleinit() 92 toys.signalfd--; in toy_singleinit() [all …]
|
/external/toybox/toys/pending/ |
D | test.c | 47 toys.exitval = 2; in test_main() 48 if (!strcmp("[", toys.which->name)) in test_main() 49 if (!strcmp("]", toys.optargs[--toys.optc])) error_exit("Missing ']'"); in test_main() 50 if (!strcmp("!", toys.optargs[0])) { in test_main() 52 toys.optargs++; in test_main() 53 toys.optc--; in test_main() 55 if (!toys.optc) toys.exitval = 0; in test_main() 56 else if (toys.optargs[0][0] == '-') { in test_main() 57 id = stridx("bcdefghLpSsurwxznt", toys.optargs[0][1]); in test_main() 58 if (id == -1 || toys.optargs[0][2]) error_exit(err_fmt, toys.optargs[0]); in test_main() [all …]
|
D | groupadd.c | 42 if (toys.optflags & FLAG_g) { 46 if (toys.optflags & FLAG_S) TT.gid = CFG_TOYBOX_UID_SYS; 52 entry = xmprintf("%s:%s:%d:", *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() [all …]
|
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 | arp.c | 146 resolve_host(toys.optargs[0], &sa); in check_flags() 162 if (!toys.optargs[1]) error_exit("bad syntax"); in set_entry() 164 if (!(toys.optflags & FLAG_D)) get_hw_add(toys.optargs[1], (char*)&req.arp_ha.sa_data); in set_entry() 168 xstrncpy(ifre.ifr_name, toys.optargs[1], IFNAMSIZ); in set_entry() 170 if ((toys.optflags & FLAG_H) && (ifre.ifr_hwaddr.sa_family != ARPHRD_ETHER)) in set_entry() 176 if (toys.optargs[2]) check_flags(&flags, (toys.optargs+2)); in set_entry() 181 if (toys.optflags & FLAG_v) xprintf("Entry set for %s\n", toys.optargs[0]); in set_entry() 205 if (toys.optargs[1]) check_flags(&flags, (toys.optargs+1)); in delete_entry() 210 if (toys.optflags & FLAG_v) xprintf("Delete entry for %s\n", toys.optargs[0]); in delete_entry() 225 if ((toys.optflags & FLAG_A) || (toys.optflags & FLAG_p)) { in arp_main() [all …]
|
D | sh.c | 296 memcpy(&temp, &toys, sizeof(struct toy_context)); in run_pipeline() 297 memset(&toys, 0, sizeof(struct toy_context)); in run_pipeline() 300 toys.rebound = &rebound; in run_pipeline() 304 cmd->pid = toys.exitval; in run_pipeline() 305 if (toys.optargs != toys.argv+1) free(toys.optargs); in run_pipeline() 306 if (toys.old_umask) umask(toys.old_umask); in run_pipeline() 307 memcpy(&toys, &temp, sizeof(struct toy_context)); in run_pipeline() 356 char *dest = *toys.optargs ? *toys.optargs : getenv("HOME"); in cd_main() 363 exit(*toys.optargs ? atoi(*toys.optargs) : 0); in exit_main() 371 if (isatty(0)) toys.optflags |= FLAG_i; in sh_main() [all …]
|
D | netstat.c | 143 if (!(toys.optflags & FLAG_n) && (pw = getpwuid(uid))) { in display_data() 148 xprintf((toys.optflags & FLAG_W) ? "%-51.51s %-51.51s " : "%-23.23s %-23.23s " in display_data() 151 if ((toys.optflags & FLAG_e)) xprintf("%-10s %-11ld ", user, inode); in display_data() 152 if ((toys.optflags & FLAG_p)) xprintf("%s", get_pid_name(inode)); in display_data() 163 if (toys.optflags & FLAG_l) { in show_data() 166 } else if (toys.optflags & FLAG_a) in show_data() 202 if (!(toys.optflags & FLAG_n)) { in addr2str() 328 if (toys.optflags & FLAG_l) { in show_unix_sockets() 331 } else if (!(toys.optflags & FLAG_a)) { in show_unix_sockets() 362 if (toys.optflags & FLAG_p) xprintf("%-20s", get_pid_name(inode)); in show_unix_sockets() [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() 175 if (toys.optflags & FLAG_f) done(0); in recv_from() 176 if (!(toys.optflags & FLAG_b)) { in recv_from() 191 if (toys.optflags & FLAG_c) { in send_signal() [all …]
|
/external/toybox/toys/posix/ |
D | grep.c | 73 if (name && (toys.optflags&FLAG_H)) printf("%s%c", name, dash); 74 if (!line || (lcount && (toys.optflags&FLAG_n))) 76 if (bcount && (toys.optflags&FLAG_b)) printf("%ld%c", bcount-1, dash); 114 if (toys.optflags & FLAG_F) { in do_grep() 119 if (toys.optflags & FLAG_x) { in do_grep() 120 int i = (toys.optflags & FLAG_i); in do_grep() 128 if (toys.optflags & FLAG_i) s = strnstr(line, seek->arg); in do_grep() 143 if (toys.optflags & FLAG_x) in do_grep() 146 if (!rc && (toys.optflags & FLAG_w)) { in do_grep() 164 if (toys.optflags & FLAG_v) { in do_grep() [all …]
|
D | ulimit.c | 68 if (!(toys.optflags&(FLAG_H-1))) toys.optflags |= FLAG_f; in ulimit_main() 69 if ((toys.optflags&(FLAG_a|FLAG_p)) && toys.optc) error_exit("can't set -ap"); in ulimit_main() 72 if (!(toys.optflags&FLAG_P)) TT.pid = getppid(); in ulimit_main() 77 int get = toys.optflags&(FLAG_a|(1<<i)); in ulimit_main() 80 if (!toys.optc) { in ulimit_main() 81 if (toys.optflags&FLAG_a) printf("-%c: ", flags[i]); in ulimit_main() 84 if (toys.optflags&FLAG_H) in ulimit_main() 94 rlim_t rl = (toys.optflags&FLAG_H) ? rr.rlim_max : rr.rlim_cur; in ulimit_main() 101 if (toys.optflags&(1<<i)) break; in ulimit_main() 104 if (toys.optflags&(FLAG_a|FLAG_p)) return; in ulimit_main() [all …]
|
D | ln.c | 29 char *dest = toys.optargs[--toys.optc], *new; in ln_main() 34 if (!toys.optc) { in ln_main() 35 toys.optc++; in ln_main() 40 if (((toys.optflags&FLAG_n) ? lstat : stat)(dest, &buf) in ln_main() 43 if (toys.optc>1) error_exit("'%s' not a directory", dest); in ln_main() 47 for (i=0; i<toys.optc; i++) { in ln_main() 49 char *oldnew, *try = toys.optargs[i]; in ln_main() 58 if (toys.optflags & FLAG_f) { in ln_main() 67 rc = (toys.optflags & FLAG_s) ? symlink(try, new) : link(try, new); in ln_main() 68 if (toys.optflags & FLAG_f) { in ln_main() [all …]
|
D | id.c | 72 if (toys.optflags&FLAG_n) printf("%s", s); 93 flags = toys.optflags; in do_id() 105 if (toys.optflags&FLAG_u) s_or_u(pw->pw_name, pw->pw_uid, 1); in do_id() 110 if (!(toys.optflags&(FLAG_g|FLAG_Z))) { in do_id() 128 if (!(toys.optflags&FLAG_Z)) { in do_id() 135 int show_separator = !(toys.optflags&FLAG_G); in do_id() 137 if (show_separator) xputc((toys.optflags&FLAG_G) ? ' ' : ','); in do_id() 140 else if (toys.optflags&FLAG_G) s_or_u(grp->gr_name, grp->gr_gid, 0); in do_id() 144 if (toys.optflags&FLAG_G) { in do_id() 154 printf(" context=%s"+!!(toys.optflags&FLAG_Z), context); in do_id() [all …]
|
D | cp.c | 147 unsigned flags = toys.optflags; in cp_node() 189 fprintf(stderr, "%s: overwrite '%s'", toys.which->name, in cp_node() 198 printf("%s '%s'\n", toys.which->name, s); in cp_node() 229 | (DIRTREE_SYMFOLLOW*!!(toys.optflags&FLAG_L)); in cp_node() 360 if (CFG_MV && toys.which->name[0] == 'm') in cp_node() 371 char *destname = toys.optargs[--toys.optc]; in cp_main() 374 if (toys.optc>1 && !destdir) error_exit("'%s' not directory", destname); in cp_main() 376 if (toys.optflags & (FLAG_a|FLAG_p)) { in cp_main() 381 if (CFG_CP_PRESERVE && (toys.optflags & FLAG_preserve)) { in cp_main() 406 for (i=0; i<toys.optc; i++) { in cp_main() [all …]
|
/external/toybox/toys/other/ |
D | vconfig.c | 40 cmd = toys.optargs[0]; in vconfig_main() 47 for (i=0; i<j; i++) if (!strcmp(toys.optargs[1], types[i])) break; in vconfig_main() 50 error_exit("%s: unknown '%s'", cmd, toys.optargs[1]); in vconfig_main() 60 xstrncpy(request.device1, toys.optargs[1], 16); in vconfig_main() 64 if (toys.optargs[2]) request.u.VID = atolx_range(toys.optargs[2], 0, 4094); in vconfig_main() 70 if (toys.optargs[2]) request.u.flag = atolx_range(toys.optargs[2], 0, 1); in vconfig_main() 71 if (toys.optargs[3]) request.vlan_qos = atolx_range(toys.optargs[3], 0, 7); in vconfig_main() 74 if (toys.optargs[2]) in vconfig_main() 75 request.u.skb_priority = atolx_range(toys.optargs[2], 0, INT_MAX); in vconfig_main() 76 if (toys.optargs[3]) request.vlan_qos = atolx_range(toys.optargs[3], 0, 7); in vconfig_main() [all …]
|
D | help.c | 36 if (toys.optflags & FLAG_h) in do_help() 39 toys.which = t; in do_help() 42 if (toys.optflags & FLAG_h) xprintf("</blockquote></pre>\n"); in do_help() 52 if (!(toys.optflags & FLAG_a)) { in help_main() 53 struct toy_list *t = toys.which; in help_main() 55 if (*toys.optargs && !(t = toy_find(*toys.optargs))) in help_main() 56 error_exit("Unknown command '%s'", *toys.optargs); in help_main() 61 if (toys.optflags & FLAG_h) { in help_main() 63 for (i=0; i < toys.toycount; i++) in help_main() 69 for (i = 0; i < toys.toycount; i++) { in help_main() [all …]
|
D | nsenter.c | 103 return toys.optflags & FLAG_r; in test_r() 108 return toys.optflags & FLAG_f; in test_f() 123 if (CFG_UNSHARE && *toys.which->name=='u') { in unshare_main() 128 if (test_r()) toys.optflags |= FLAG_U; in unshare_main() 131 if (toys.optflags & (1<<i)) f |= flags[i]; in unshare_main() 137 toys.exitval = xrun(toys.optargs); in unshare_main() 148 if (toys.optflags & (1<<i)) { in unshare_main() 150 if (!(toys.optflags & FLAG_t)) error_exit("need -t or =filename"); in unshare_main() 162 if ((toys.optflags & FLAG_p) && !(toys.optflags & FLAG_F)) { in unshare_main() 163 toys.exitval = xrun(toys.optargs); in unshare_main() [all …]
|
D | netcat.c | 104 if ((toys.optflags&FLAG_f) ? toys.optc : in netcat_main() 105 (!(toys.optflags&(FLAG_l|FLAG_L)) && toys.optc!=2)) in netcat_main() 130 if (!CFG_NETCAT_LISTEN || !(toys.optflags&(FLAG_L|FLAG_l))) { in netcat_main() 132 lookup_name(*toys.optargs, (uint32_t *)&address.sin_addr); in netcat_main() 133 lookup_port(toys.optargs[1], &address.sin_port); in netcat_main() 151 if ((toys.optflags & FLAG_l) && toys.optc) { in netcat_main() 168 if (toys.optflags&FLAG_t) in netcat_main() 174 if (toys.optflags&FLAG_L) { in netcat_main() 175 toys.stacktop = 0; in netcat_main() 178 if (!child && toys.optc) { in netcat_main() [all …]
|
D | mountpoint.c | 24 if (!(toys.optflags & FLAG_q)) printf("%s: not a %s\n", *toys.optargs, gripe); in die() 26 toys.exitval++; in die() 33 char *arg = *toys.optargs; in mountpoint_main() 34 int quiet = toys.optflags & FLAG_q; in mountpoint_main() 38 if (toys.optflags & FLAG_x) { in mountpoint_main() 58 toys.exitval = !(st1.st_dev != st2.st_dev || st1.st_ino == st2.st_ino); in mountpoint_main() 59 if (toys.optflags & FLAG_d) in mountpoint_main() 62 printf("%s is %sa mountpoint\n", *toys.optargs, toys.exitval ? "not " : ""); in mountpoint_main()
|
D | ionice.c | 62 if (!TT.pid && !toys.optc) error_exit("Need -p or COMMAND"); in ionice_main() 63 if (toys.optflags == FLAG_p) { in ionice_main() 69 if (-1 == ioprio_set() && !(toys.optflags&FLAG_t)) perror_exit("set"); in ionice_main() 70 if (!TT.pid) xexec(toys.optargs); in ionice_main() 78 TT.pid = atolx(*toys.optargs); in iorenice_main() 79 if (toys.optc == 1) { in iorenice_main() 91 if (!strcmp(toys.optargs[toys.optc-1], classes[TT.class])) break; in iorenice_main() 92 if (toys.optc == 3 || TT.class == 4) TT.level = atolx(toys.optargs[1]); in iorenice_main()
|
D | oneit.c | 53 toys.signal = signal; 70 if (toys.optflags & FLAG_3) { in oneit_main() 79 while (!toys.signal) { in oneit_main() 89 while (pid != wait(&i)) if (toys.optflags & FLAG_3) i = write(4, &pid, 4); in oneit_main() 90 if (toys.optflags & FLAG_n) continue; in oneit_main() 92 oneit_signaled((toys.optflags & FLAG_p) ? SIGUSR2 : SIGTERM); in oneit_main() 103 toy_exec(toys.optargs); in oneit_main() 104 execvp(*toys.optargs, toys.optargs); in oneit_main() 105 perror_msg("%s not in PATH=%s", *toys.optargs, getenv("PATH")); in oneit_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 …]
|
/external/toybox/toys/lsb/ |
D | killall.c | 42 if (toys.optflags & FLAG_i) { 56 if (!(toys.optflags & FLAG_q)) perror_msg("pid %d", (int)pid); 57 } else if (toys.optflags & FLAG_v) 67 TT.names = toys.optargs; in killall_main() 70 if (toys.optflags & FLAG_l) { in killall_main() 77 if (toys.optflags & FLAG_q) exit(1); in killall_main() 82 toys.optc--; in killall_main() 86 if (!(toys.optflags & FLAG_l) && !toys.optc) help_exit("no name"); in killall_main() 90 TT.err = xmalloc(2*toys.optc); in killall_main() 91 for (i=0; i<toys.optc; i++) TT.err[i] = ESRCH; in killall_main() [all …]
|
D | su.c | 48 if (*toys.optargs && !strcmp("-", *toys.optargs)) { in su_main() 49 toys.optflags |= FLAG_l; in su_main() 50 toys.optargs++; in su_main() 53 if (*toys.optargs) name = *(toys.optargs++); in su_main() 68 argv = argu = xmalloc(sizeof(char *)*(toys.optc + 4)); in su_main() 71 if (toys.optflags & FLAG_l) { in su_main() 82 if (!(toys.optflags & (FLAG_m|FLAG_p))) { in su_main() 89 if (toys.optflags & FLAG_c) { in su_main() 93 while ((*(argv++) = *(toys.optargs++))); in su_main() 98 toys.exitval = 1; in su_main()
|
/external/toybox/toys/example/ |
D | skeleton.c | 69 printf("Ran %s\n", toys.which->name); 73 if (toys.optflags) printf("flags=%x\n", toys.optflags); 74 if (toys.optflags & FLAG_a) printf("Saw a\n"); 75 if (toys.optflags & FLAG_b) printf("b=%s\n", TT.s.b_string); 76 if (toys.optflags & FLAG_c) printf("c=%ld\n", TT.s.c_number); 82 for (optargs = toys.optargs; *optargs; optargs++) 84 if (toys.optflags & FLAG_walrus) printf("Saw --walrus\n"); 97 printf("Ran %s\n", toys.which->name); in skeleton_alias_main() 98 printf("flags=%x\n", toys.optflags); in skeleton_alias_main() 102 if (toys.optflags & FLAG_b) printf("b=%ld", TT.a.b_number); in skeleton_alias_main()
|