/third_party/toybox/ |
H A D | main.c | 6 #include "toys.h" 22 struct toy_context toys; variable 68 toys.exitval = 127; in unknown() 69 toys.which = toy_list; in unknown() 76 toys.which = which; in toy_singleinit() 77 toys.argv = argv; in toy_singleinit() 85 if (CFG_TOYBOX && toys.which == toy_list && toys.argv[2]) in toy_singleinit() 86 if (!(toys.which = toy_find(toys in toy_singleinit() [all...] |
/third_party/toybox/porting/liteos_a/ |
H A D | main.c | 6 #include "toys.h" 23 struct toy_context toys; variable 69 toys.exitval = 127; in unknown() 70 toys.which = toy_list; in unknown() 77 toys.which = which; in toy_singleinit() 78 toys.argv = argv; in toy_singleinit() 86 if (CFG_TOYBOX && toys.which == toy_list && toys.argv[2]) in toy_singleinit() 87 if (!(toys.which = toy_find(toys in toy_singleinit() [all...] |
/third_party/toybox/toys/other/ |
H A D | vconfig.c | 26 #include "toys.h" 33 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 in vconfig_main() [all...] |
H A D | help.c | 32 #include "toys.h" 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() 45 // The simple help is just toys.which = toy_find("name"); show_help(stdout); 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 in help_main() [all...] |
H A D | i2ctools.c | 72 #include "toys.h" 185 if (toys.optc) error_exit("-l doesn't take arguments"); in i2cdetect_main() 188 if (toys.optc != 1) error_exit("-F BUS"); in i2cdetect_main() 189 i2cdetect_dash_F(atolx_range(*toys.optargs, 0, INT_MAX)); in i2cdetect_main() 198 if (toys.optc!=1 && toys.optc!=3) help_exit("Needs 1 or 3 arguments"); in i2cdetect_main() 199 bus = atolx_range(*toys.optargs, 0, INT_MAX); in i2cdetect_main() 200 if (toys.optc==3) { in i2cdetect_main() 201 first = atolx_range(toys.optargs[1], 0, 0x7f); in i2cdetect_main() 202 last = atolx_range(toys in i2cdetect_main() [all...] |
H A D | mountpoint.c | 22 #include "toys.h" 26 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 in mountpoint_main() [all...] |
H A D | nsenter.c | 66 #include "toys.h" 106 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 in unshare_main() [all...] |
H A D | ionice.c | 39 #include "toys.h" 60 if (!TT.p && !toys.optc) error_exit("Need -p or COMMAND"); in ionice_main() 61 if (toys.optflags == FLAG_p) { in ionice_main() 67 if (-1 == ioprio_set() && !(toys.optflags&FLAG_t)) perror_exit("set"); in ionice_main() 68 if (!TT.p) xexec(toys.optargs); in ionice_main() 76 TT.p = atolx(*toys.optargs); in iorenice_main() 77 if (toys.optc == 1) { in iorenice_main() 88 if (!strcmp(toys.optargs[toys.optc-1], classes[TT.c])) break; in iorenice_main() 89 if (toys in iorenice_main() [all...] |
H A D | chrt.c | 28 #include "toys.h" 61 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 in chrt_main() [all...] |
H A D | sysctl.c | 27 #include "toys.h" 47 if (!(toys.optflags & FLAG_e)) error_msg("unknown key '%s'", key); in key_error() 80 if (!(toys.optflags & FLAG_n)) xprintf("%s", key); in do_show_keys() 81 if (!(toys.optflags & (FLAG_N|FLAG_n))) xprintf(" = "); in do_show_keys() 83 if (!(toys.optflags & FLAG_N)) xprintf("%s", data); in do_show_keys() 84 if ((toys.optflags & (FLAG_N|FLAG_n)) != (FLAG_N|FLAG_n)) xputc('\n'); in do_show_keys() 99 if ((toys.optflags & FLAG_w) && !value) { in process_key() 108 if (!(value && (!write_key(path, key, value) || (toys.optflags & FLAG_q)))) { in process_key() 120 if (toys.optflags & FLAG_a) dirtree_read("/proc/sys", do_show_keys); in sysctl_main() 123 else if (toys in sysctl_main() [all...] |
/third_party/toybox/toys/pending/ |
H A D | useradd.c | 30 #include "toys.h" 44 char *s = *toys.optargs, *entry; in useradd_main() 48 if (toys.optc == 2) { in useradd_main() 49 if (toys.optflags) help_exit("options with USER GROUP"); in useradd_main() 50 xexec((char *[]){"groupadd", toys.optargs[0], toys.optargs[1], 0}); in useradd_main() 67 pwd.pw_dir = TT.dir ? TT.dir : xmprintf("/home/%s", *toys.optargs); in useradd_main() 81 if (toys.optflags & FLAG_u) { in useradd_main() 85 if (toys.optflags & FLAG_S) TT.uid = CFG_TOYBOX_UID_SYS; in useradd_main() 92 if (toys in useradd_main() [all...] |
H A D | groupadd.c | 24 #include "toys.h" 52 entry = xmprintf("%s:%s:%ld:", *toys.optargs, "x", TT.gid); in new_group() 53 update_password(GROUP_PATH, *toys.optargs, entry); in new_group() 55 entry = xmprintf("%s:%s::", *toys.optargs, "!"); in new_group() 56 update_password(SECURE_GROUP_PATH, *toys.optargs, entry); in new_group() 65 if (toys.optflags && toys.optc == 2) in groupadd_main() 68 if (toys.optc == 2) { //add user to group in groupadd_main() 69 //toys.optargs[0]- user, toys in groupadd_main() [all...] |
H A D | arping.c | 31 #include "toys.h" 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() 174 if (toys.optflags & FLAG_f) done(0); in recv_from() 175 if (!(toys in recv_from() [all...] |
H A D | traceroute.c | 45 #include "toys.h" 117 if (toys.optflags & FLAG_U) { in send_probe4() 164 if ((toys.optflags & FLAG_d) && (setsockopt(sock,SOL_SOCKET, SO_DEBUG, in set_flag_dr() 167 if ((toys.optflags & FLAG_r) && (setsockopt(sock, SOL_SOCKET, SO_DONTROUTE, in set_flag_dr() 221 if (probe && (toys.optflags & FLAG_z)) msleep(TT.pause_time); in do_trace() 270 if (toys.optflags & FLAG_U) { in do_trace() 298 if (!(toys.optflags & FLAG_n)) { in do_trace() 308 if (!(toys.optflags & FLAG_n)) xprintf(")"); in do_trace() 312 if (toys.optflags & FLAG_l) xprintf(" (%d)", rcv_pkt->ip_ttl); in do_trace() 313 if (toys in do_trace() [all...] |
/third_party/toybox/toys/net/ |
H A D | ftpget.c | 46 #include "toys.h" 88 if (toys.optflags & FLAG_v) fprintf(stderr, "%s\n", toybuf); in xread2line() 99 if (toys.optflags & FLAG_v) fprintf(stderr, s, cmd, arg); in ftp_line() 128 char *s, *remote = toys.optargs[2]; in ftpget_main() 133 if (!(toys.optflags&(FLAG_v-1))) in ftpget_main() 134 toys.optflags |= (toys.which->name[3]=='g') ? FLAG_g : FLAG_s; in ftpget_main() 139 if (!remote) remote = toys.optargs[1]; in ftpget_main() 142 TT.fd = xconnectany(xgetaddrinfo(*toys.optargs, TT.p, 0, SOCK_STREAM, 0, in ftpget_main() 159 if (toys in ftpget_main() [all...] |
H A D | netstat.c | 31 #include "toys.h" 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 in display_routes() [all...] |
/third_party/toybox/porting/liteos_a/toys/posix/ |
H A D | du.c | 27 #include "toys.h" 49 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 in do_du() [all...] |
/third_party/toybox/toys/posix/ |
H A D | id.c | 64 #include "toys.h" 72 if (toys.optflags&FLAG_n) printf("%s", s); in s_or_u() 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 in do_id() [all...] |
H A D | test.c | 41 #include "toys.h" 96 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 in test_main() [all...] |
H A D | cksum.c | 36 #include "toys.h" 54 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 in cksum_main() [all...] |
H A D | cmp.c | 22 #include "toys.h" 44 toys.exitval = 0; in do_cmp() 53 toys.exitval = 1; in do_cmp() 54 if (toys.optflags & FLAG_l) in do_cmp() 57 if (!(toys.optflags & FLAG_s)) in do_cmp() 67 if (!(toys.optflags & FLAG_s)) in do_cmp() 69 toys.exitval = 1; in do_cmp() 80 toys.exitval = 2; in cmp_main() 81 loopfiles_rw(toys.optargs, O_CLOEXEC|(WARN_ONLY*!(toys in cmp_main() [all...] |
H A D | wc.c | 28 #include "toys.h" 45 if (!(!toys.optc && !(toys.optflags & (toys.optflags-1))) && toys.optc!=1) in show_lengths() 49 if (toys.optflags&(1<<i)) { in show_lengths() 55 if (*toys.optargs) printf(" %s", name); in show_lengths() 65 if (toys.optflags == FLAG_c) { in do_wc() 116 if (!toys.optflags) toys in wc_main() [all...] |
/third_party/toybox/toys/example/ |
H A D | logwrapper.c | 20 #include "toys.h" 24 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 in logwrapper_main() [all...] |
/third_party/toybox/toys/lsb/ |
H A D | mknod.c | 31 #include "toys.h" 43 type = stridx("pcub", *toys.optargs[1]); in mknod_main() 44 if (type == -1) perror_exit("bad type '%c'", *toys.optargs[1]); in mknod_main() 46 if (toys.optc != 4) perror_exit("need major/minor"); in mknod_main() 48 major = atoi(toys.optargs[2]); in mknod_main() 49 minor = atoi(toys.optargs[3]); in mknod_main() 52 if (toys.optflags & FLAG_Z) in mknod_main() 55 if (mknod(*toys.optargs, mode|modes[type], dev_makedev(major, minor))) in mknod_main() 56 perror_exit_raw(*toys.optargs); in mknod_main()
|
/third_party/toybox/porting/liteos_a/toys/lsb/ |
H A D | umount.c | 26 #include "toys.h" 48 if (toys.optflags & FLAG_v) xprintf("%s unmounted\n", dir); in do_umount() 52 if (dev && !(toys.optflags & FLAG_D)) { in do_umount() 57 if (!ioctl(lfd, 0x4C01) && (toys.optflags & FLAG_v)) in do_umount() 66 if (toys.optflags & FLAG_r) { in do_umount() 68 if (toys.optflags & FLAG_v) xprintf("%s remounted ro\n", dir); in do_umount() 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 in umount_main() [all...] |