Home
last modified time | relevance | path

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

123456789

/external/toybox/
DAndroid.mk61 toys/android/getenforce.c \
62 toys/android/getprop.c \
63 toys/android/load_policy.c \
64 toys/android/restorecon.c \
65 toys/android/runcon.c \
66 toys/android/setenforce.c \
67 toys/android/setprop.c \
68 toys/lsb/dmesg.c \
69 toys/lsb/hostname.c \
70 toys/lsb/killall.c \
[all …]
Dmain.c26 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/
Dtest.c47 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 …]
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()
66 toys.exithelp = 1; in groupadd_main()
70 if (toys.optc == 2) { //add user to group in groupadd_main()
72 xgetpwnam(*toys.optargs); in groupadd_main()
[all …]
Duseradd.c44 char *s = *toys.optargs, *entry;
48 if (toys.optc == 2) {
49 if (toys.optflags) {
50 toys.exithelp = 1;
53 xexec((char *[]){"groupadd", toys.optargs[0], toys.optargs[1], 0});
70 pwd.pw_dir = TT.dir ? TT.dir : xmprintf("/home/%s", *toys.optargs);
84 if (toys.optflags & FLAG_u) {
88 if (toys.optflags & FLAG_S) TT.uid = CFG_TOYBOX_UID_SYS;
95 if (toys.optflags & FLAG_G) TT.gid = xgetgrnam(TT.u_grp)->gr_gid;
98 if (toys.optflags & FLAG_S) TT.gid = CFG_TOYBOX_UID_SYS;
[all …]
Darp.c146 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 …]
Dsh.c293 memcpy(&temp, &toys, sizeof(struct toy_context)); in run_pipeline()
294 memset(&toys, 0, sizeof(struct toy_context)); in run_pipeline()
297 toys.rebound = &rebound; in run_pipeline()
301 cmd->pid = toys.exitval; in run_pipeline()
302 if (toys.optargs != toys.argv+1) free(toys.optargs); in run_pipeline()
303 if (toys.old_umask) umask(toys.old_umask); in run_pipeline()
304 memcpy(&toys, &temp, sizeof(struct toy_context)); in run_pipeline()
353 char *dest = *toys.optargs ? *toys.optargs : getenv("HOME"); in cd_main()
360 exit(*toys.optargs ? atoi(*toys.optargs) : 0); in exit_main()
368 if (isatty(0)) toys.optflags |= FLAG_i; in sh_main()
[all …]
Dnetstat.c180 if ( (toys.optflags & FLAG_W) && (toys.optflags & FLAG_p)) in display_data()
182 else if (toys.optflags & FLAG_W) in display_data()
184 else if (toys.optflags & FLAG_p) in display_data()
193 if (toys.optflags & FLAG_l) { in show_data()
195 } else if (toys.optflags & FLAG_a) display_data(rport, label, rxq, txq, lip, rip, state, inode); in show_data()
227 if (!(toys.optflags & FLAG_n)) { in addr2str()
336 if (toys.optflags & FLAG_l) { in show_unix_sockets()
338 } else if (!(toys.optflags & FLAG_a)) { in show_unix_sockets()
365 if (toys.optflags & FLAG_p) xprintf("%-20s", get_pid_name(inode)); in show_unix_sockets()
486 if ((toys.optflags & FLAG_W) && (toys.optflags & FLAG_p)) in show_header()
[all …]
Darping.c91 if (!(toys.optflags & FLAG_q)) { in done()
96 if (toys.optflags & FLAG_D) exit(!!TT.rcvd_nr); in done()
98 if (toys.optflags & FLAG_U) exit(EXIT_SUCCESS); in done()
114 arp_h->ar_op = (toys.optflags & FLAG_A) ? htons(ARPOP_REPLY) in send_packet()
120 (toys.optflags & FLAG_A) ? &src_pk.sll_addr : &dst_pk.sll_addr, in send_packet()
158 if (toys.optflags & FLAG_D) { in recv_from()
163 if (!(toys.optflags & FLAG_q)) { in recv_from()
181 if (toys.optflags & FLAG_f) done(0); in recv_from()
182 if (!(toys.optflags & FLAG_b)) { in recv_from()
197 if (toys.optflags & FLAG_c) { in send_signal()
[all …]
Dpgrep.c31 #define flag_get(f,v,d) ((toys.optflags & f) ? v : d)
32 #define flag_chk(f) ((toys.optflags & f) ? 1 : 0)
42 if (toys.which->name[1] == 'g') {
77 if (toys.which->name[1] == 'k') { in pgrep_main()
82 if (!TT.signame && *toys.optargs && **toys.optargs == '-') { in pgrep_main()
83 TT.signame = *(toys.optargs++) + 1; in pgrep_main()
94 if (!(flag_chk(FLAG_s) || flag_chk(FLAG_P)) && !*toys.optargs) { in pgrep_main()
95 toys.exithelp++; in pgrep_main()
98 if (*(toys.optargs+1) && !(flag_chk(FLAG_s) || flag_chk(FLAG_P))) { in pgrep_main()
99 toys.exithelp++; in pgrep_main()
[all …]
Dipcrm.c71 ++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) { in ipcrm_main()
87 toys.exithelp++; in ipcrm_main()
88 error_exit("unknown argument: %s", *toys.optargs); in ipcrm_main()
Dtcpsvd.c179 if (toys.optflags & FLAG_v) { in handle_exit()
181 xprintf("%s: end %d exit %d\n",toys.which->name, pid_n, WEXITSTATUS(status)); in handle_exit()
183 xprintf("%s: end %d signaled %d\n",toys.which->name, pid_n, WTERMSIG(status)); in handle_exit()
184 if (TT.cn > 1) xprintf("%s: status %d/%d\n",toys.which->name, TT.count_all, TT.cn); in handle_exit()
227 port = strtoul(toys.optargs[1], &ptr, 10); in create_bind_sock()
230 if (*ptr) ptr = toys.optargs[1]; in create_bind_sock()
258 if (toys.optflags & FLAG_v) xprintf("got signal %d, exit\n", sig); in handle_signal()
274 TT.udp = (*toys.which->name == 'u'); in tcpsvd_main()
275 if (TT.udp) toys.optflags &= ~FLAG_C; in tcpsvd_main()
277 if (toys.optflags & FLAG_C) { in tcpsvd_main()
[all …]
/external/toybox/toys/posix/
Dgrep.c67 int lcount = 0, mcount = 0, which = toys.optflags & FLAG_w ? 2 : 0;
68 char indelim = '\n' * !(toys.optflags&FLAG_z),
69 outdelim = '\n' * !(toys.optflags&FLAG_Z);
95 if (toys.optflags & FLAG_F) {
100 if (toys.optflags & FLAG_x) {
101 int i = (toys.optflags & FLAG_i);
109 if (toys.optflags & FLAG_i) {
129 if (toys.optflags & FLAG_x)
132 if (toys.optflags & FLAG_v) {
133 if (toys.optflags & FLAG_o) {
[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 …]
Dcp.c108 unsigned flags = toys.optflags;
150 fprintf(stderr, "%s: overwrite '%s'", toys.which->name,
159 printf("%s '%s'\n", toys.which->name, s);
190 | (DIRTREE_SYMFOLLOW*!!(toys.optflags&FLAG_L));
292 if (CFG_MV && toys.which->name[0] == 'm')
303 char *destname = toys.optargs[--toys.optc]; in cp_main()
306 if (toys.optc>1 && !destdir) error_exit("'%s' not directory", destname); in cp_main()
307 if (toys.which->name[0] == 'm') toys.optflags |= FLAG_d|FLAG_p|FLAG_R; in cp_main()
308 if (toys.optflags & (FLAG_a|FLAG_p)) umask(0); in cp_main()
314 for (i=0; i<toys.optc; i++) { in cp_main()
[all …]
Dcat.c56 int i, len, size=(toys.optflags & FLAG_u) ? 1 : sizeof(toybuf); in do_cat()
60 if (len < 0) toys.exitval = EXIT_FAILURE; in do_cat()
62 if ((CFG_CAT_V || CFG_CATV) && (toys.optflags&~FLAG_u)) { in do_cat()
66 if (c > 126 && (toys.optflags & FLAG_v)) { in do_cat()
78 if (toys.optflags & FLAG_e) xputc('$'); in do_cat()
79 } else if (toys.optflags & (c==9 ? FLAG_t : FLAG_v)) { in do_cat()
92 loopfiles(toys.optargs, do_cat); in cat_main()
97 toys.optflags ^= FLAG_v; in catv_main()
98 loopfiles(toys.optargs, do_cat); in catv_main()
Ddu.c57 if (toys.optflags & FLAG_h) { in print()
63 if (toys.optflags & FLAG_K) bits = 9; in print()
64 else if (toys.optflags & FLAG_m) bits = 20; in print()
111 if ((toys.optflags & FLAG_x) && (TT.st_dev != node->st.st_dev)) in do_du()
115 if (toys.optflags & FLAG_L) { in do_du()
124 if (!(toys.optflags & FLAG_l) && !node->again) in do_du()
131 return DIRTREE_COMEAGAIN|(DIRTREE_SYMFOLLOW*!!(toys.optflags&FLAG_L)); in do_du()
139 if ((toys.optflags & FLAG_a) || !node->parent in do_du()
140 || (S_ISDIR(node->st.st_mode) && !(toys.optflags & FLAG_s))) in do_du()
153 for (args = toys.optc ? toys.optargs : noargs; *args; args++) in du_main()
[all …]
/external/toybox/toys/other/
Dvconfig.c38 cmd = toys.optargs[0]; in vconfig_main()
45 for (i=0; i<j; i++) if (!strcmp(toys.optargs[1], types[i])) break; in vconfig_main()
48 error_exit("%s: unknown '%s'", cmd, toys.optargs[1]); in vconfig_main()
58 xstrncpy(request.device1, toys.optargs[1], 16); in vconfig_main()
62 if (toys.optargs[2]) request.u.VID = atolx_range(toys.optargs[2], 0, 4094); in vconfig_main()
68 if (toys.optargs[2]) request.u.flag = atolx_range(toys.optargs[2], 0, 1); in vconfig_main()
69 if (toys.optargs[3]) request.vlan_qos = atolx_range(toys.optargs[3], 0, 7); in vconfig_main()
72 if (toys.optargs[2]) in vconfig_main()
73 request.u.skb_priority = atolx_range(toys.optargs[2], 0, INT_MAX); in vconfig_main()
74 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 …]
Dnetcat.c94 if (toys.optflags&FLAG_f) { in netcat_main()
95 if (toys.optc) toys.exithelp++; in netcat_main()
96 } else if (!(toys.optflags&(FLAG_l|FLAG_L)) && toys.optc!=2) toys.exithelp++; in netcat_main()
98 if (toys.exithelp) error_exit("Argument count wrong"); in netcat_main()
122 if (!CFG_NETCAT_LISTEN || !(toys.optflags&(FLAG_L|FLAG_l))) { in netcat_main()
124 lookup_name(*toys.optargs, (uint32_t *)&address.sin_addr); in netcat_main()
125 lookup_port(toys.optargs[1], &address.sin_port); in netcat_main()
143 if ((toys.optflags & FLAG_l) && toys.optc) { in netcat_main()
160 if (toys.optflags&FLAG_t) in netcat_main()
166 if (toys.optflags&FLAG_L) child = fork(); in netcat_main()
[all …]
Dmountpoint.c24 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()
Dtaskset.c38 char *s = *toys.optargs, *failed = "failed to %s %d's affinity"; in do_taskset()
62 if (i || toys.optc < 2) return; in do_taskset()
65 k = strlen(s = *toys.optargs); in do_taskset()
71 if (digit > 15) error_exit("bad mask '%s'", *toys.optargs); in do_taskset()
90 if (!(toys.optflags & FLAG_p)) { in taskset_main()
91 if (toys.optc < 2) error_exit("Needs 2 args"); in taskset_main()
93 xexec(toys.optargs+1); in taskset_main()
96 pid_t pid = strtol(toys.optargs[toys.optc-1], &c, 10); in taskset_main()
98 if (*c) error_exit("Not int %s", toys.optargs[1]); in taskset_main()
100 if (toys.optflags & FLAG_a) { in taskset_main()
/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) { in killall_main()
87 toys.exithelp++; in killall_main()
93 TT.err = xmalloc(2*toys.optc); in killall_main()
[all …]
Dsu.c48 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()
99 toys.exitval = 1; in su_main()
/external/toybox/toys/example/
Dskeleton.c69 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()

123456789