Home
last modified time | relevance | path

Searched refs:toys (Results 1 – 25 of 247) sorted by relevance

12345678910

/external/toybox/
DAndroid.bp67 "toys/android/getenforce.c",
68 "toys/android/load_policy.c",
69 "toys/android/log.c",
70 "toys/android/restorecon.c",
71 "toys/android/runcon.c",
72 "toys/android/sendevent.c",
73 "toys/android/setenforce.c",
74 "toys/android/setprop.c",
75 "toys/android/start.c",
76 "toys/lsb/dmesg.c",
[all …]
Dmain.c29 struct toy_context toys; variable
75 toys.exitval = 127; in unknown()
76 toys.which = toy_list; in unknown()
83 toys.which = which; in toy_singleinit()
84 toys.argv = argv; in toy_singleinit()
91 if (CFG_TOYBOX && toys.which == toy_list && toys.argv[2]) in toy_singleinit()
92 if (!(toys.which = toy_find(toys.argv[2]))) unknown(toys.argv[2]); in toy_singleinit()
105 toys.optargs = argv+1; in toy_singleinit()
106 for (toys.optc = 0; toys.optargs[toys.optc]; toys.optc++); in toy_singleinit()
108 toys.old_umask = umask(0); in toy_singleinit()
[all …]
/external/toybox/toys/net/
Dftpget.c68 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 = xconnect(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 …]
Dnetcat.c87 if ((toys.optflags&FLAG_f) ? toys.optc : in netcat_main()
88 (!(toys.optflags&(FLAG_l|FLAG_L)) && toys.optc!=2)) in netcat_main()
91 if (toys.optflags&FLAG_4) family = AF_INET; in netcat_main()
92 else if (toys.optflags&FLAG_6) family = AF_INET6; in netcat_main()
94 if (toys.optflags&FLAG_u) type = SOCK_DGRAM; in netcat_main()
99 if (!(toys.optflags&(FLAG_L|FLAG_l))) { in netcat_main()
100 struct addrinfo *addr = xgetaddrinfo(toys.optargs[0], toys.optargs[1], in netcat_main()
134 if (CFG_TOYBOX_FORK && toys.optc && xfork()) goto cleanup; in netcat_main()
145 if (toys.optc) { in netcat_main()
155 if (toys.optflags&FLAG_L) NOEXIT(child = XVFORK()); in netcat_main()
[all …]
Dnetstat.c63 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/other/
Di2ctools.c79 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 …]
Dvconfig.c33 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 …]
Dhelp.c36 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 …]
Dnsenter.c106 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 …]
Dmountpoint.c26 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()
/external/toybox/toys/pending/
Duseradd.c44 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 …]
Dgroupadd.c42 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 …]
Darp.c127 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 …]
Dsh.c113 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 …]
Darping.c85 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 …]
Dtcpsvd.c180 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/posix/
Dtest.c95 toys.exitval = 2; in test_main()
96 if (!strcmp("[", toys.which->name)) in test_main()
97 if (!toys.optc || strcmp("]", toys.optargs[--toys.optc])) in test_main()
101 if (toys.optc) for (pos = paren = pstack = 0; ; pos++) { in test_main()
102 int len = toys.optc-pos; in test_main()
104 if (!toys.optargs[pos]) perror_exit("need arg @%d", pos); in test_main()
107 result = do_test(toys.optargs+pos, &len); in test_main()
111 if (toys.optargs[pos+1]) { in test_main()
112 if (!strcmp("!", toys.optargs[pos])) { in test_main()
116 if (!strcmp("(", toys.optargs[pos])) { in test_main()
[all …]
Dln.c29 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 …]
Did.c72 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_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 …]
Dcksum.c54 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 …]
Dcp.c130 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()
345 if (CFG_MV && toys.which->name[0] == 'm') in cp_node()
368 char *destname = toys.optargs[--toys.optc]; in cp_main()
371 if ((toys.optc>1 || (toys.optflags&FLAG_D)) && !destdir) in cp_main()
374 if (toys.optflags & (FLAG_a|FLAG_p)) in cp_main()
378 if (CFG_CP_PRESERVE && (toys.optflags & FLAG_preserve)) { in cp_main()
404 for (i=0; i<toys.optc; i++) { in cp_main()
[all …]
/external/toybox/toys/lsb/
Dkillall.c42 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 …]
/external/toybox/toys/example/
Dlogwrapper.c24 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()
Dskeleton.c70 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);
77 if (toys.optflags & FLAG_c) printf("c=%ld\n", TT.s.c);
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); in skeleton_alias_main()
/external/toybox/lib/
Dargs.c146 if (toys.optflags & opt->dex[0]) { in gotflag()
152 if (clr->arg && (i & toys.optflags & opt->dex[0])) *clr->arg = 0; in gotflag()
153 toys.optflags &= ~opt->dex[0]; in gotflag()
157 toys.optflags |= opt->dex[1]; in gotflag()
161 if (toys.optflags & gof->excludes) { in gotflag()
166 if (opt == bad || !(i & toys.optflags)) continue; in gotflag()
167 if (toys.optflags & bad->dex[2]) break; in gotflag()
188 arg = toys.argv[++gof->argc]; in gotflag()
234 char *options = toys.which->options; in parse_optflaglist()
391 toys.exitval = toys.which->flags >> 24; in get_optflags()
[all …]

12345678910