Home
last modified time | relevance | path

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

12345678910>>...12

/third_party/toybox/
DBUILD.gn33 "toys/lsb/dmesg.c",
34 "toys/lsb/gzip.c",
35 "toys/lsb/hostname.c",
36 "toys/lsb/killall.c",
37 "toys/lsb/md5sum.c",
38 "toys/lsb/mknod.c",
39 "toys/lsb/mktemp.c",
40 "toys/lsb/mount.c",
41 "toys/lsb/passwd.c",
42 "toys/lsb/pidof.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()
92 if (CFG_TOYBOX && toys.which == toy_list && toys.argv[2]) in toy_singleinit()
93 if (!(toys.which = toy_find(toys.argv[2]))) unknown(toys.argv[2]); in toy_singleinit()
106 toys.optargs = argv+1; in toy_singleinit()
107 for (toys.optc = 0; toys.optargs[toys.optc]; toys.optc++); in toy_singleinit()
109 toys.old_umask = umask(0); in toy_singleinit()
[all …]
/third_party/toybox/porting/liteos_a/
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()
92 if (CFG_TOYBOX && toys.which == toy_list && toys.argv[2]) in toy_singleinit()
93 if (!(toys.which = toy_find(toys.argv[2]))) unknown(toys.argv[2]); in toy_singleinit()
106 toys.optargs = argv+1; in toy_singleinit()
107 for (toys.optc = 0; toys.optargs[toys.optc]; toys.optc++); in toy_singleinit()
109 toys.old_umask = umask(0); in toy_singleinit()
[all …]
/third_party/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 = 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 …]
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 …]
/third_party/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()
Dionice.c62 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()
Doneit.c53 toys.signal = signal;
71 if (toys.optflags & FLAG_3) { in oneit_main()
80 while (!toys.signal) { in oneit_main()
90 while (pid != wait(&i)) if (toys.optflags & FLAG_3) i = write(4, &pid, 4); in oneit_main()
91 if (toys.optflags & FLAG_n) continue; in oneit_main()
93 oneit_signaled((toys.optflags & FLAG_p) ? SIGUSR2 : SIGTERM); in oneit_main()
104 toy_exec(toys.optargs); in oneit_main()
105 execvp(*toys.optargs, toys.optargs); in oneit_main()
106 perror_msg("%s not in PATH=%s", *toys.optargs, getenv("PATH")); in oneit_main()
Dtaskset.c49 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 …]
Dchrt.c61 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()
/third_party/toybox/toys/pending/
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 …]
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 …]
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()
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 …]
/third_party/toybox/toys/posix/
Dtest.c96 toys.exitval = 2; in test_main()
97 if (!strcmp("[", toys.which->name)) in test_main()
98 if (!toys.optc || strcmp("]", toys.optargs[--toys.optc])) in test_main()
102 if (toys.optc) for (pos = paren = pstack = 0; ; pos++) { in test_main()
103 int len = toys.optc-pos; in test_main()
105 if (!toys.optargs[pos]) perror_exit("need arg @%d", pos); in test_main()
108 result = do_test(toys.optargs+pos, &len); in test_main()
112 if (toys.optargs[pos+1]) { in test_main()
113 if (!strcmp("!", toys.optargs[pos])) { in test_main()
117 if (!strcmp("(", toys.optargs[pos])) { in test_main()
[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 …]
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 …]
/third_party/toybox/porting/liteos_a/toys/posix/
Ddu.c49 if (toys.optflags & FLAG_h) { in print()
55 if (toys.optflags & FLAG_K) bits = 9; in print()
56 else if (toys.optflags & FLAG_m) bits = 20; in print()
103 if ((toys.optflags & FLAG_x) && (TT.st_dev != node->st.st_dev)) in do_du()
107 if (toys.optflags & FLAG_L) { in do_du()
116 if (!(toys.optflags & FLAG_l) && !node->again) in do_du()
123 return DIRTREE_COMEAGAIN|(DIRTREE_SYMFOLLOW*!!(toys.optflags&FLAG_L)); in do_du()
130 if ((toys.optflags & FLAG_a) || !node->parent in do_du()
131 || (S_ISDIR(node->st.st_mode) && !(toys.optflags & FLAG_s))) { in do_du()
140 if (toys.optc < 1) help_exit(0); in du_main()
[all …]
Dcat.c56 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 if (!*toys.optargs) help_exit("missing argument"); in cat_main()
96 loopfiles(toys.optargs, do_cat); in cat_main()
101 toys.optflags ^= FLAG_v; in catv_main()
102 loopfiles(toys.optargs, do_cat); in catv_main()
/third_party/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.c71 printf("Ran %s\n", toys.which->name);
75 if (toys.optflags) printf("flags=%llx\n", toys.optflags);
76 if (toys.optflags & FLAG_a) printf("Saw a\n");
77 if (toys.optflags & FLAG_b) printf("b=%s\n", TT.s.b);
78 if (toys.optflags & FLAG_c) printf("c=%ld\n", TT.s.c);
84 for (optargs = toys.optargs; *optargs; optargs++)
86 if (toys.optflags & FLAG_walrus) printf("Saw --walrus\n");
99 printf("Ran %s\n", toys.which->name); in skeleton_alias_main()
100 printf("flags=%llx\n", toys.optflags); in skeleton_alias_main()
104 if (toys.optflags & FLAG_b) printf("b=%ld", TT.a.b); in skeleton_alias_main()
/third_party/toybox/porting/liteos_a/toys/lsb/
Dumount.c48 if (toys.optflags & FLAG_v) xprintf("%s unmounted\n", dir);
52 if (dev && !(toys.optflags & FLAG_D)) {
57 if (!ioctl(lfd, 0x4C01) && (toys.optflags & FLAG_v))
66 if (toys.optflags & FLAG_r) {
68 if (toys.optflags & FLAG_v) xprintf("%s remounted ro\n", dir);
82 if (!toys.optc && !(toys.optflags & FLAG_a)) in umount_main()
85 if (toys.optflags & FLAG_f) flags |= MNT_FORCE; in umount_main()
86 if (toys.optflags & FLAG_l) flags |= MNT_DETACH; in umount_main()
90 if (!(toys.optflags & FLAG_n) && !access(pm, R_OK)) in umount_main()
94 if (toys.optflags & FLAG_a) { in umount_main()
[all …]

12345678910>>...12