/external/toybox/ |
D | Android.mk | 60 toys/android/getenforce.c \ 61 toys/android/getprop.c \ 62 toys/android/load_policy.c \ 63 toys/android/log.c \ 64 toys/android/restorecon.c \ 65 toys/android/runcon.c \ 66 toys/android/sendevent.c \ 67 toys/android/setenforce.c \ 68 toys/android/setprop.c \ 69 toys/android/start.c \ [all …]
|
D | main.c | 26 struct toy_context toys; variable 72 toys.exitval = 127; in unknown() 73 toys.which = toy_list; in unknown() 80 toys.which = which; in toy_singleinit() 81 toys.argv = argv; in toy_singleinit() 88 if (CFG_TOYBOX && toys.which == toy_list && toys.argv[2]) in toy_singleinit() 89 if (!(toys.which = toy_find(toys.argv[2]))) unknown(toys.argv[2]); in toy_singleinit() 102 toys.optargs = argv+1; in toy_singleinit() 103 for (toys.optc = 0; toys.optargs[toys.optc]; toys.optc++); in toy_singleinit() 105 toys.old_umask = umask(0); 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 | chrt.c | 46 if (toys.optflags&FLAG_m) { in chrt_main() 55 if (TT.pid && !*(toys.optargs+1) && in chrt_main() 56 !(toys.optflags&(FLAG_b|FLAG_f|FLAG_i|FLAG_o|FLAG_r))) { in chrt_main() 71 if (!*toys.optargs) help_exit("missing priority"); in chrt_main() 72 if (TT.pid && *(toys.optargs+1)) help_exit("-p and command"); in chrt_main() 73 if (!TT.pid && !*(toys.optargs+1)) help_exit("missing command"); in chrt_main() 76 if (toys.optflags&FLAG_b) policy = SCHED_BATCH; in chrt_main() 77 else if (toys.optflags&FLAG_f) policy = SCHED_FIFO; in chrt_main() 78 else if (toys.optflags&FLAG_i) policy = SCHED_IDLE; in chrt_main() 79 else if (toys.optflags&FLAG_o) policy = SCHED_OTHER; in chrt_main() [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 | 113 char *dest = *toys.optargs ? *toys.optargs : getenv("HOME"); in cd_main() 120 exit(*toys.optargs ? atoi(*toys.optargs) : 0); in exit_main() 211 memcpy(&temp, &toys, sizeof(struct toy_context)); in run_pipeline() 212 memset(&toys, 0, sizeof(struct toy_context)); in run_pipeline() 215 toys.rebound = &rebound; in run_pipeline() 219 cmd->pid = toys.exitval; in run_pipeline() 220 if (toys.optargs != toys.argv+1) free(toys.optargs); in run_pipeline() 221 if (toys.old_umask) umask(toys.old_umask); in run_pipeline() 222 memcpy(&toys, &temp, sizeof(struct toy_context)); in run_pipeline() 296 } else if (cc=='s') fputs(getbasename(*toys.argv), stdout); in do_prompt() [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 …]
|
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 …]
|
/external/toybox/toys/net/ |
D | ftpget.c | 70 if (toys.optflags & FLAG_v) fprintf(stderr, "%s\n", toybuf); 81 if (toys.optflags & FLAG_v) fprintf(stderr, s, cmd, arg); in ftp_line() 98 char *s, *remote = toys.optargs[2]; in ftpget_main() 101 if (!(toys.optflags&(FLAG_v-1))) in ftpget_main() 102 toys.optflags |= (toys.which->name[3]=='g') ? FLAG_g : FLAG_s; in ftpget_main() 107 if (!remote) remote = toys.optargs[1]; in ftpget_main() 110 TT.fd = xconnect(*toys.optargs, TT.port, 0, SOCK_STREAM, 0, AI_ADDRCONFIG); in ftpget_main() 119 if (toys.optflags & FLAG_m) { in ftpget_main() 120 if (toys.optc != 3) error_exit("-m FROM TO"); in ftpget_main() 121 ftp_line("RNFR", toys.optargs[1], 350); in ftpget_main() [all …]
|
D | netstat.c | 63 if (!(toys.optflags & FLAG_n)) { in addr2str() 148 if (!((toys.optflags & FLAG_l) && (!rport && (state & 0xA))) in show_ip() 149 && !(toys.optflags & FLAG_a) && !(rport & (0x10 | 0x20 | 0x40))) in show_ip() 166 if (!(toys.optflags & FLAG_n) && (pw = bufgetpwuid(uid))) in show_ip() 173 if ((toys.optflags & FLAG_e)) printf(" %-10s %-11ld", toybuf, inode); in show_ip() 174 if ((toys.optflags & FLAG_p)) { in show_ip() 207 if (state==1 && flags && !(toys.optflags&FLAG_a)) continue; in show_unix_sockets() 216 if (toys.optflags & FLAG_p) { in show_unix_sockets() 288 !(toys.optflags&FLAG_e) ? " MSS Window irtt" : "Metric Ref Use"); in display_routes() 304 } else destip = (toys.optflags&FLAG_n) ? "0.0.0.0" : "default"; in display_routes() [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); 109 if (toys.optflags & FLAG_F) { in do_grep() 114 if (toys.optflags & FLAG_x) { in do_grep() 115 int i = (toys.optflags & FLAG_i); in do_grep() 123 if (toys.optflags & FLAG_i) s = strnstr(line, seek->arg); in do_grep() 138 if (toys.optflags & FLAG_x) in do_grep() 141 if (!rc && (toys.optflags & FLAG_w)) { in do_grep() 159 if (toys.optflags & FLAG_v) { in do_grep() [all …]
|
D | ulimit.c | 69 if (!(toys.optflags&(FLAG_H-1))) toys.optflags |= FLAG_f; in ulimit_main() 70 if ((toys.optflags&(FLAG_a|FLAG_p)) && toys.optc) error_exit("can't set -ap"); in ulimit_main() 73 if (!(toys.optflags&FLAG_P)) TT.pid = getppid(); in ulimit_main() 78 int get = toys.optflags&(FLAG_a|(1<<i)); in ulimit_main() 81 if (!toys.optc) { in ulimit_main() 82 if (toys.optflags&FLAG_a) printf("-%c: ", flags[i]); in ulimit_main() 85 if (toys.optflags&FLAG_H) in ulimit_main() 95 rlim_t rl = (toys.optflags&FLAG_H) ? rr.rlim_max : rr.rlim_cur; in ulimit_main() 102 if (toys.optflags&(1<<i)) break; in ulimit_main() 105 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 | 130 unsigned flags = toys.optflags; in cp_node() 172 fprintf(stderr, "%s: overwrite '%s'", toys.which->name, in cp_node() 181 printf("%s '%s'\n", toys.which->name, s); in cp_node() 212 | (DIRTREE_SYMFOLLOW*!!(toys.optflags&FLAG_L)); in cp_node() 343 if (CFG_MV && toys.which->name[0] == 'm') in cp_node() 366 char *destname = toys.optargs[--toys.optc]; in cp_main() 369 if (toys.optc>1 && !destdir) error_exit("'%s' not directory", destname); in cp_main() 371 if (toys.optflags & (FLAG_a|FLAG_p)) { in cp_main() 376 if (CFG_CP_PRESERVE && (toys.optflags & FLAG_preserve)) { in cp_main() 401 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 | 104 return toys.optflags & FLAG_r; in test_r() 109 return toys.optflags & FLAG_f; in test_f() 124 if (CFG_UNSHARE && *toys.which->name=='u') { in unshare_main() 129 if (test_r()) toys.optflags |= FLAG_U; in unshare_main() 132 if (toys.optflags & (1<<i)) f |= flags[i]; in unshare_main() 138 toys.exitval = xrun(toys.optargs); in unshare_main() 149 if (toys.optflags & (1<<i)) { in unshare_main() 151 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 | 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() 59 toys.exitval = !(st1.st_dev != st2.st_dev || st1.st_ino == st2.st_ino); in mountpoint_main() 60 if (toys.optflags & FLAG_d) in mountpoint_main() 63 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()
|
/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 | 70 printf("Ran %s\n", toys.which->name); 74 if (toys.optflags) printf("flags=%llx\n", toys.optflags); 75 if (toys.optflags & FLAG_a) printf("Saw a\n"); 76 if (toys.optflags & FLAG_b) printf("b=%s\n", TT.s.b_string); 77 if (toys.optflags & FLAG_c) printf("c=%ld\n", TT.s.c_number); 83 for (optargs = toys.optargs; *optargs; optargs++) 85 if (toys.optflags & FLAG_walrus) printf("Saw --walrus\n"); 98 printf("Ran %s\n", toys.which->name); in skeleton_alias_main() 99 printf("flags=%llx\n", toys.optflags); in skeleton_alias_main() 103 if (toys.optflags & FLAG_b) printf("b=%ld", TT.a.b_number); in skeleton_alias_main()
|