1 // toys/android/log.c 2 3 struct log_data { 4 char *t, *p; 5 }; 6 7 // toys/example/demo_number.c 8 9 struct demo_number_data { 10 long D; 11 }; 12 13 // toys/example/hello.c 14 15 struct hello_data { 16 int unused; 17 }; 18 19 // toys/example/skeleton.c 20 21 struct skeleton_data { 22 union { 23 struct { 24 char *b; 25 long c; 26 struct arg_list *d; 27 long e; 28 char *also, *blubber; 29 } s; 30 struct { 31 long b; 32 } a; 33 }; 34 35 int more_globals; 36 }; 37 38 // toys/lsb/dmesg.c 39 40 struct dmesg_data { 41 long n, s; 42 43 int use_color; 44 time_t tea; 45 }; 46 47 // toys/lsb/gzip.c 48 49 struct gzip_data { 50 int level; 51 }; 52 53 // toys/lsb/hostname.c 54 55 struct hostname_data { 56 char *F; 57 }; 58 59 // toys/lsb/killall.c 60 61 struct killall_data { 62 char *s; 63 64 int signum; 65 pid_t cur_pid; 66 char **names; 67 short *err; 68 struct int_list { struct int_list *next; int val; } *pids; 69 }; 70 71 // toys/lsb/md5sum.c 72 73 struct md5sum_data { 74 int sawline; 75 76 // Crypto variables blanked after summing 77 unsigned state[5]; 78 unsigned oldstate[5]; 79 uint64_t count; 80 union { 81 char c[64]; 82 unsigned i[16]; 83 } buffer; 84 }; 85 86 // toys/lsb/mknod.c 87 88 struct mknod_data { 89 char *Z, *m; 90 }; 91 92 // toys/lsb/mktemp.c 93 94 struct mktemp_data { 95 char *p, *tmpdir; 96 }; 97 98 // toys/lsb/mount.c 99 100 struct mount_data { 101 struct arg_list *optlist; 102 char *type; 103 char *bigO; 104 105 unsigned long flags; 106 char *opts; 107 int okuser; 108 }; 109 110 // toys/lsb/passwd.c 111 112 struct passwd_data { 113 char *a; 114 }; 115 116 // toys/lsb/pidof.c 117 118 struct pidof_data { 119 char *o; 120 }; 121 122 // toys/lsb/seq.c 123 124 struct seq_data { 125 char *s, *f; 126 127 int precision; 128 }; 129 130 // toys/lsb/su.c 131 #ifdef OHOS_LITE 132 struct su_data { 133 char *s; 134 char *c; 135 }; 136 #endif 137 138 // toys/lsb/umount.c 139 140 struct umount_data { 141 struct arg_list *t; 142 143 char *types; 144 }; 145 146 // toys/net/ftpget.c 147 148 struct ftpget_data { 149 char *u, *p, *P; 150 151 int fd; 152 int datafd; 153 int filefd; 154 }; 155 156 // toys/net/ifconfig.c 157 158 struct ifconfig_data { 159 int sockfd; 160 }; 161 162 // toys/net/microcom.c 163 164 struct microcom_data { 165 char *s; 166 167 int fd; 168 struct termios original_stdin_state, original_fd_state; 169 }; 170 171 // toys/net/netcat.c 172 173 struct netcat_data { 174 char *f, *s; 175 long q, p, W, w; 176 }; 177 178 // toys/net/netstat.c 179 180 struct netstat_data { 181 struct num_cache *inodes; 182 int wpad; 183 };; 184 185 // toys/net/ping.c 186 187 struct ping_data { 188 char *I; 189 long w, W, i, s, c, t, m; 190 191 struct sockaddr *sa; 192 int sock; 193 unsigned long sent, recv, fugit, min, max; 194 }; 195 196 // toys/net/sntp.c 197 198 struct sntp_data { 199 long r; 200 char *p, *m, *M; 201 }; 202 203 // toys/net/tunctl.c 204 205 struct tunctl_data { 206 char *u; 207 }; 208 209 // toys/other/acpi.c 210 211 struct acpi_data { 212 int ac, bat, therm, cool; 213 char *cpath; 214 }; 215 216 // toys/other/base64.c 217 218 struct base64_data { 219 long w; 220 unsigned total; 221 unsigned n; // number of bits used in encoding. 5 for base32, 6 for base64 222 unsigned align; // number of bits to align to 223 }; 224 225 // toys/other/blkid.c 226 227 struct blkid_data { 228 struct arg_list *s; 229 }; 230 231 // toys/other/blockdev.c 232 233 struct blockdev_data { 234 long setbsz, setra; 235 }; 236 237 // toys/other/chrt.c 238 239 struct chrt_data { 240 long p; 241 }; 242 243 // toys/other/dos2unix.c 244 245 struct dos2unix_data { 246 char *tempfile; 247 }; 248 249 // toys/other/fallocate.c 250 251 struct fallocate_data { 252 long o, l; 253 }; 254 255 // toys/other/fmt.c 256 257 struct fmt_data { 258 int width; 259 260 int level, pos; 261 }; 262 263 // toys/other/free.c 264 265 struct free_data { 266 unsigned bits; 267 unsigned long long units; 268 char *buf; 269 }; 270 271 // toys/other/hexedit.c 272 273 struct hexedit_data { 274 char *data; 275 long long len, base; 276 int numlen, undo, undolen; 277 unsigned height; 278 }; 279 280 // toys/other/hwclock.c 281 282 struct hwclock_data { 283 char *f; 284 285 int utc; 286 }; 287 288 // toys/other/ionice.c 289 290 struct ionice_data { 291 long p, n, c; 292 }; 293 294 // toys/other/login.c 295 296 struct login_data { 297 char *h, *f; 298 299 int login_timeout, login_fail_timeout; 300 }; 301 302 // toys/other/losetup.c 303 304 struct losetup_data { 305 char *j; 306 long o, S; 307 308 int openflags; 309 dev_t jdev; 310 ino_t jino; 311 char *dir; 312 }; 313 314 // toys/other/lspci.c 315 316 struct lspci_data { 317 char *i; 318 long n; 319 320 FILE *db; 321 }; 322 323 // toys/other/makedevs.c 324 325 struct makedevs_data { 326 char *d; 327 }; 328 329 // toys/other/mix.c 330 331 struct mix_data { 332 long r, l; 333 char *d, *c; 334 }; 335 336 // toys/other/mkpasswd.c 337 338 struct mkpasswd_data { 339 long P; 340 char *m, *S; 341 }; 342 343 // toys/other/mkswap.c 344 345 struct mkswap_data { 346 char *L; 347 }; 348 349 // toys/other/modinfo.c 350 351 struct modinfo_data { 352 char *F, *k, *b; 353 354 long mod; 355 int count; 356 }; 357 358 // toys/other/nsenter.c 359 360 struct nsenter_data { 361 char *Uupnmi[6]; 362 long t; 363 }; 364 365 // toys/other/oneit.c 366 367 struct oneit_data { 368 char *c; 369 }; 370 371 // toys/other/pwgen.c 372 373 struct pwgen_data { 374 char *r; 375 }; 376 377 // toys/other/reboot.c 378 379 struct reboot_data { 380 char *d; 381 }; 382 383 // toys/other/setfattr.c 384 385 struct setfattr_data { 386 char *x, *v, *n; 387 }; 388 389 // toys/other/sha3sum.c 390 391 struct sha3sum_data { 392 long a; 393 unsigned long long rc[24]; 394 }; 395 396 // toys/other/shred.c 397 398 struct shred_data { 399 long o, n, s; 400 }; 401 402 // toys/other/stat.c 403 404 struct stat_data { 405 char *c; 406 407 union { 408 struct stat st; 409 struct statfs sf; 410 } stat; 411 char *file, *pattern; 412 int patlen; 413 }; 414 415 // toys/other/swapon.c 416 417 struct swapon_data { 418 long p; 419 }; 420 421 // toys/other/switch_root.c 422 423 struct switch_root_data { 424 char *c; 425 426 dev_t rootdev; 427 }; 428 429 // toys/other/tac.c 430 431 struct tac_data { 432 struct double_list *dl; 433 }; 434 435 // toys/other/timeout.c 436 437 struct timeout_data { 438 char *s, *k; 439 440 int nextsig; 441 pid_t pid; 442 struct timeval ktv; 443 struct itimerval itv; 444 }; 445 446 // toys/other/truncate.c 447 448 struct truncate_data { 449 char *s; 450 451 long size; 452 int type; 453 }; 454 455 // toys/other/watch.c 456 457 struct watch_data { 458 int n; 459 460 pid_t pid, oldpid; 461 }; 462 463 // toys/other/xxd.c 464 465 struct xxd_data { 466 long s, g, o, l, c; 467 }; 468 469 // toys/pending/arp.c 470 471 struct arp_data { 472 char *hw_type; 473 char *af_type_A; 474 char *af_type_p; 475 char *interface; 476 477 int sockfd; 478 char *device; 479 }; 480 481 // toys/pending/awk.c 482 struct awk_data { 483 struct arg_list *f; 484 struct arg_list *v; 485 char *F; 486 487 struct scanner_state { 488 char *p; 489 char *progstring; 490 struct arg_list *prog_args; 491 char *filename; 492 char *line; 493 size_t line_size; 494 ssize_t line_len; 495 int line_num; 496 int ch; 497 FILE *fp; 498 // state includes latest token seen 499 int tok; 500 int tokbuiltin; 501 int toktype; 502 char *tokstr; 503 size_t maxtok; 504 size_t toklen; 505 double numval; 506 int error; // Set if lexical error. 507 } *scs; 508 char *tokstr; 509 int prevtok; 510 511 struct compiler_globals { 512 int in_print_stmt; 513 int paren_level; 514 int in_function_body; 515 int funcnum; 516 int nparms; 517 int compile_error_count; 518 int first_begin; 519 int last_begin; 520 int first_end; 521 int last_end; 522 int first_recrule; 523 int last_recrule; 524 int break_dest; 525 int continue_dest; 526 int stack_offset_to_fix; // fixup stack if return in for(e in a) 527 int range_pattern_num; 528 int rule_type; // tkbegin, tkend, or 0 529 } cgl; 530 531 // zvalue: the main awk value type 532 // Can be number or string or both, or else map (array) or regex 533 struct zvalue { 534 unsigned flags; 535 double num; 536 union { // anonymous union not in C99; not going to fix it now. 537 struct zstring *vst; 538 struct zmap *map; 539 regex_t *rx; 540 }; 541 } nozvalue; // to shut up compiler warning TODO FIXME 542 543 struct runtime_globals { 544 struct zvalue cur_arg; 545 //char *filename; // UNUSED 546 FILE *fp; // current data file 547 int narg; // cmdline arg index 548 int nfiles; // num of cmdline data file args processed 549 int eof; // all cmdline files (incl. stdin) read 550 char *recptr; 551 char *recbuf; 552 size_t recbufsize; 553 char *recbuf_multx; 554 size_t recbufsize_multx; 555 struct zstring *zspr; // Global to receive sprintf() string value 556 } rgl; 557 558 // Expanding sequential list 559 struct zlist { 560 char *base, *limit, *avail; 561 size_t size; 562 } globals_table, // global symbol table 563 locals_table, // local symbol table 564 func_def_table; // function symbol table 565 // runtime lists 566 struct zlist literals, fields, zcode, stack; 567 568 char *progname; 569 570 int spec_var_limit; 571 int zcode_last; 572 struct zvalue *stackp; // top of stack ptr 573 574 char *pbuf; // Used for number formatting in num_to_zstring() 575 #define RS_MAX 64 576 char rs_last[RS_MAX]; 577 regex_t rx_rs_default, rx_rs_last; 578 regex_t rx_default, rx_last, rx_printf_fmt; 579 #define FS_MAX 64 580 char fs_last[FS_MAX]; 581 char one_char_fs[4]; 582 int nf_internal; // should match NF 583 char range_sw[64]; // FIXME TODO quick and dirty set of range switches 584 int file_cnt, std_file_cnt; 585 586 struct zfile { 587 struct zfile *next; 588 char *fn; 589 FILE *fp; 590 char mode; // w, a, or r 591 char file_or_pipe; // f or p 592 char is_std_file; 593 char *recbuf; 594 size_t recbufsize; 595 char *recbuf_multi; 596 size_t recbufsize_multi; 597 char *recbuf_multx; 598 size_t recbufsize_multx; 599 int recoffs, endoffs; 600 } *zfiles, *cfile, *zstdout; 601 }; 602 603 // toys/pending/arping.c 604 605 struct arping_data { 606 long count; 607 unsigned long time_out; 608 char *iface; 609 char *src_ip; 610 611 int sockfd; 612 unsigned long start, end; 613 unsigned sent_at, sent_nr, rcvd_nr, brd_sent, rcvd_req, brd_rcv, 614 unicast_flag; 615 }; 616 617 // toys/pending/bc.c 618 619 struct bc_data { 620 // This actually needs to be a BcVm*, but the toybox build 621 // system complains if I make it so. Instead, we'll just cast. 622 char *vm; 623 624 size_t nchars; 625 char *file, sig, max_ibase; 626 uint16_t line_len; 627 }; 628 629 // toys/pending/bootchartd.c 630 631 struct bootchartd_data { 632 char timestamp[32]; 633 long msec; 634 int proc_accounting; 635 636 pid_t pid; 637 }; 638 639 // toys/pending/brctl.c 640 641 struct brctl_data { 642 int sockfd; 643 }; 644 645 // toys/pending/chsh.c 646 647 struct chsh_data { 648 char *s; 649 }; 650 651 // toys/pending/crond.c 652 653 struct crond_data { 654 char *crontabs_dir; 655 char *logfile; 656 int loglevel_d; 657 int loglevel; 658 659 time_t crontabs_dir_mtime; 660 uint8_t flagd; 661 }; 662 663 // toys/pending/crontab.c 664 665 struct crontab_data { 666 char *user; 667 char *cdir; 668 }; 669 670 // toys/pending/dd.c 671 672 struct dd_data { 673 int show_xfer, show_records; 674 unsigned long long bytes, c_count, in_full, in_part, out_full, out_part; 675 struct timeval start; 676 struct { 677 char *name; 678 int fd; 679 unsigned char *buff, *bp; 680 long sz, count; 681 unsigned long long offset; 682 } in, out; 683 unsigned conv, iflag, oflag; 684 }; 685 686 // toys/pending/dhcp.c 687 688 struct dhcp_data { 689 char *iface; 690 char *pidfile; 691 char *script; 692 long retries; 693 long timeout; 694 long tryagain; 695 struct arg_list *req_opt; 696 char *req_ip; 697 struct arg_list *pkt_opt; 698 char *fdn_name; 699 char *hostname; 700 char *vendor_cls; 701 }; 702 703 // toys/pending/dhcp6.c 704 705 struct dhcp6_data { 706 char *interface_name, *pidfile, *script; 707 long retry, timeout, errortimeout; 708 char *req_ip; 709 int length, state, request_length, sock, sock1, status, retval, retries; 710 struct timeval tv; 711 uint8_t transction_id[3]; 712 struct sockaddr_in6 input_socket6; 713 }; 714 715 // toys/pending/dhcpd.c 716 717 struct dhcpd_data { 718 char *iface; 719 long port; 720 }; 721 722 // toys/pending/diff.c 723 724 struct diff_data { 725 long ct; 726 char *start; 727 struct arg_list *L_list; 728 729 int dir_num, size, is_binary, status, change, len[2]; 730 int *offset[2]; 731 struct stat st[2]; 732 }; 733 734 // toys/pending/dumpleases.c 735 736 struct dumpleases_data { 737 char *file; 738 }; 739 740 // toys/pending/expr.c 741 742 struct expr_data { 743 char **tok; // current token, not on the stack since recursive calls mutate it 744 745 char *refree; 746 }; 747 748 // toys/pending/fdisk.c 749 750 struct fdisk_data { 751 long sect_sz; 752 long sectors; 753 long heads; 754 long cylinders; 755 }; 756 757 // toys/pending/fold.c 758 759 struct fold_data { 760 int width; 761 }; 762 763 // toys/pending/fsck.c 764 765 struct fsck_data { 766 int fd_num; 767 char *t_list; 768 769 struct double_list *devices; 770 char *arr_flag; 771 char **arr_type; 772 int negate; 773 int sum_status; 774 int nr_run; 775 int sig_num; 776 long max_nr_run; 777 }; 778 779 // toys/pending/getfattr.c 780 781 struct getfattr_data { 782 char *n; 783 }; 784 785 // toys/pending/getopt.c 786 787 struct getopt_data { 788 struct arg_list *l; 789 char *o, *n; 790 }; 791 792 // toys/pending/getty.c 793 794 struct getty_data { 795 char *issue_str; 796 char *login_str; 797 char *init_str; 798 char *host_str; 799 long timeout; 800 801 char *tty_name; 802 int speeds[20]; 803 int sc; 804 struct termios termios; 805 char buff[128]; 806 }; 807 808 // toys/pending/groupadd.c 809 810 struct groupadd_data { 811 long gid; 812 }; 813 814 // toys/pending/hexdump.c 815 816 struct hexdump_data { 817 long s, n; 818 819 long long len, pos, ppos; 820 const char *fmt; 821 unsigned int fn, bc; // file number and byte count 822 char linebuf[16]; // line buffer - serves double duty for sqeezing repeat 823 // lines and for accumulating full lines accross file 824 // boundaries if necessesary. 825 }; 826 827 // toys/pending/host.c 828 829 struct host_data { 830 char *type_str; 831 }; 832 833 // toys/pending/ip.c 834 835 struct ip_data { 836 char stats, singleline, flush, *filter_dev, gbuf[8192]; 837 int sockfd, connected, from_ok, route_cmd; 838 int8_t addressfamily, is_addr; 839 }; 840 841 // toys/pending/ipcrm.c 842 843 struct ipcrm_data { 844 struct arg_list *qkey; 845 struct arg_list *qid; 846 struct arg_list *skey; 847 struct arg_list *sid; 848 struct arg_list *mkey; 849 struct arg_list *mid; 850 }; 851 852 // toys/pending/ipcs.c 853 854 struct ipcs_data { 855 int id; 856 }; 857 858 // toys/pending/klogd.c 859 860 struct klogd_data { 861 long level; 862 863 int fd; 864 }; 865 866 // toys/pending/last.c 867 868 struct last_data { 869 char *file; 870 871 struct arg_list *list; 872 }; 873 874 // toys/pending/lsof.c 875 876 struct lsof_data { 877 struct arg_list *p; 878 879 struct stat *sought_files; 880 struct double_list *all_sockets, *files; 881 int last_shown_pid, shown_header; 882 }; 883 884 // toys/pending/man.c 885 886 struct man_data { 887 char *M, *k; 888 889 char any, cell, ex, *f, k_done, *line, *m, **sct, **scts, **sufs; 890 regex_t reg; 891 }; 892 893 // toys/pending/mke2fs.c 894 895 struct mke2fs_data { 896 // Command line arguments. 897 long blocksize; 898 long bytes_per_inode; 899 long inodes; // Total inodes in filesystem. 900 long reserved_percent; // Integer precent of space to reserve for root. 901 char *gendir; // Where to read dirtree from. 902 903 // Internal data. 904 struct dirtree *dt; // Tree of files to copy into the new filesystem. 905 unsigned treeblocks; // Blocks used by dt 906 unsigned treeinodes; // Inodes used by dt 907 908 unsigned blocks; // Total blocks in the filesystem. 909 unsigned freeblocks; // Free blocks in the filesystem. 910 unsigned inodespg; // Inodes per group 911 unsigned groups; // Total number of block groups. 912 unsigned blockbits; // Bits per block. (Also blocks per group.) 913 914 // For gene2fs 915 unsigned nextblock; // Next data block to allocate 916 unsigned nextgroup; // Next group we'll be allocating from 917 int fsfd; // File descriptor of filesystem (to output to). 918 }; 919 920 // toys/pending/modprobe.c 921 922 struct modprobe_data { 923 struct arg_list *dirs; 924 925 struct arg_list *probes; 926 struct arg_list *dbase[256]; 927 char *cmdopts; 928 int nudeps; 929 uint8_t symreq; 930 }; 931 932 // toys/pending/more.c 933 934 struct more_data { 935 struct termios inf; 936 int cin_fd; 937 }; 938 939 // toys/pending/openvt.c 940 941 struct openvt_data { 942 long c; 943 }; 944 945 // toys/pending/route.c 946 947 struct route_data { 948 char *family; 949 }; 950 951 // toys/pending/sh.c 952 953 struct sh_data { 954 char *command; 955 956 long lineno; 957 958 struct double_list functions; 959 unsigned options; 960 961 // Running jobs. 962 struct sh_job { 963 struct sh_job *next, *prev; 964 unsigned jobno; 965 966 // Every pipeline has at least one set of arguments or it's Not A Thing 967 struct sh_arg { 968 char **v; 969 int c; 970 } pipeline; 971 972 // null terminated array of running processes in pipeline 973 struct sh_process { 974 struct string_list *delete; // expanded strings 975 int pid, exit; // status? Stopped? Exited? 976 struct sh_arg arg; 977 } *procs, *proc; 978 } *jobs, *job; 979 unsigned jobcnt; 980 }; 981 982 // toys/pending/strace.c 983 984 struct strace_data { 985 long s, p; 986 987 char ioctl[32], *fmt; 988 long regs[256/sizeof(long)], syscall; 989 pid_t pid; 990 int arg; 991 }; 992 993 // toys/pending/stty.c 994 995 struct stty_data { 996 char *device; 997 998 int fd, col; 999 unsigned output_cols; 1000 }; 1001 1002 // toys/pending/sulogin.c 1003 1004 struct sulogin_data { 1005 long timeout; 1006 struct termios crntio; 1007 }; 1008 1009 // toys/pending/syslogd.c 1010 1011 struct syslogd_data { 1012 char *socket; 1013 char *config_file; 1014 char *unix_socket; 1015 char *logfile; 1016 long interval; 1017 long rot_size; 1018 long rot_count; 1019 char *remote_log; 1020 long log_prio; 1021 1022 struct unsocks *lsocks; // list of listen sockets 1023 struct logfile *lfiles; // list of write logfiles 1024 int sigfd[2]; 1025 }; 1026 1027 // toys/pending/tcpsvd.c 1028 1029 struct tcpsvd_data { 1030 char *name; 1031 char *user; 1032 long bn; 1033 char *nmsg; 1034 long cn; 1035 1036 int maxc; 1037 int count_all; 1038 int udp; 1039 }; 1040 1041 // toys/pending/telnet.c 1042 1043 struct telnet_data { 1044 int port; 1045 int sfd; 1046 char buff[128]; 1047 int pbuff; 1048 char iac[256]; 1049 int piac; 1050 char *ttype; 1051 struct termios def_term; 1052 struct termios raw_term; 1053 uint8_t term_ok; 1054 uint8_t term_mode; 1055 uint8_t flags; 1056 unsigned win_width; 1057 unsigned win_height; 1058 }; 1059 1060 // toys/pending/telnetd.c 1061 1062 struct telnetd_data { 1063 char *login_path; 1064 char *issue_path; 1065 int port; 1066 char *host_addr; 1067 long w_sec; 1068 1069 int gmax_fd; 1070 pid_t fork_pid; 1071 }; 1072 1073 // toys/pending/tftp.c 1074 1075 struct tftp_data { 1076 char *local_file; 1077 char *remote_file; 1078 long block_size; 1079 1080 struct sockaddr_storage inaddr; 1081 int af; 1082 }; 1083 1084 // toys/pending/tftpd.c 1085 1086 struct tftpd_data { 1087 char *user; 1088 1089 long sfd; 1090 struct passwd *pw; 1091 }; 1092 1093 // toys/pending/tr.c 1094 1095 struct tr_data { 1096 short map[256]; //map of chars 1097 int len1, len2; 1098 }; 1099 1100 // toys/pending/traceroute.c 1101 1102 struct traceroute_data { 1103 long max_ttl; 1104 long port; 1105 long ttl_probes; 1106 char *src_ip; 1107 long tos; 1108 long wait_time; 1109 struct arg_list *loose_source; 1110 long pause_time; 1111 long first_ttl; 1112 char *iface; 1113 1114 uint32_t gw_list[9]; 1115 int recv_sock; 1116 int snd_sock; 1117 unsigned msg_len; 1118 char *packet; 1119 uint32_t ident; 1120 int istraceroute6; 1121 }; 1122 1123 // toys/pending/useradd.c 1124 1125 struct useradd_data { 1126 char *dir; 1127 char *gecos; 1128 char *shell; 1129 char *u_grp; 1130 long uid; 1131 1132 long gid; 1133 }; 1134 1135 // toys/pending/vi.c 1136 1137 struct vi_data { 1138 int cur_col; 1139 int cur_row; 1140 int scr_row; 1141 int drawn_row; 1142 int drawn_col; 1143 unsigned screen_height; 1144 unsigned screen_width; 1145 int vi_mode; 1146 int count0; 1147 int count1; 1148 int vi_mov_flag; 1149 int modified; 1150 char vi_reg; 1151 char *last_search; 1152 int tabstop; 1153 int list; 1154 }; 1155 1156 // toys/pending/wget.c 1157 1158 struct wget_data { 1159 char *filename; 1160 long redirects; 1161 1162 int sock; 1163 char *url; 1164 #if CFG_WGET_LIBTLS 1165 struct tls *tls; 1166 #elif CFG_WGET_OPENSSL 1167 struct ssl_ctx_st *ctx; 1168 struct ssl_st *ssl; 1169 #endif 1170 }; 1171 1172 // toys/posix/basename.c 1173 1174 struct basename_data { 1175 char *s; 1176 }; 1177 1178 // toys/posix/chgrp.c 1179 1180 struct chgrp_data { 1181 uid_t owner; 1182 gid_t group; 1183 char *owner_name, *group_name; 1184 int symfollow; 1185 }; 1186 1187 // toys/posix/chmod.c 1188 1189 struct chmod_data { 1190 char *mode; 1191 }; 1192 1193 // toys/posix/cksum.c 1194 1195 struct cksum_data { 1196 unsigned crc_table[256]; 1197 }; 1198 1199 // toys/posix/cmp.c 1200 1201 struct cmp_data { 1202 int fd; 1203 char *name; 1204 }; 1205 1206 // toys/posix/cp.c 1207 1208 struct cp_data { 1209 union { 1210 // install's options 1211 struct { 1212 char *g, *o, *m; 1213 } i; 1214 // cp's options 1215 struct { 1216 char *preserve; 1217 } c; 1218 }; 1219 1220 char *destname; 1221 struct stat top; 1222 int (*callback)(struct dirtree *try); 1223 uid_t uid; 1224 gid_t gid; 1225 int pflags; 1226 }; 1227 1228 // toys/posix/cpio.c 1229 1230 struct cpio_data { 1231 char *F, *p, *H; 1232 }; 1233 1234 // toys/posix/cut.c 1235 1236 struct cut_data { 1237 char *d, *O; 1238 struct arg_list *select[5]; // we treat them the same, so loop through 1239 1240 int pairs; 1241 regex_t reg; 1242 }; 1243 1244 // toys/posix/date.c 1245 1246 struct date_data { 1247 char *r, *D, *d; 1248 1249 unsigned nano; 1250 }; 1251 1252 // toys/posix/df.c 1253 1254 struct df_data { 1255 struct arg_list *t; 1256 1257 long units; 1258 int column_widths[5]; 1259 int header_shown; 1260 }; 1261 1262 // toys/posix/du.c 1263 1264 struct du_data { 1265 long d; 1266 1267 unsigned long depth, total; 1268 dev_t st_dev; 1269 void *inodes; 1270 }; 1271 1272 // toys/posix/env.c 1273 1274 struct env_data { 1275 struct arg_list *u; 1276 };; 1277 1278 // toys/posix/expand.c 1279 1280 struct expand_data { 1281 struct arg_list *t; 1282 1283 unsigned tabcount, *tab; 1284 }; 1285 1286 // toys/posix/file.c 1287 1288 struct file_data { 1289 int max_name_len; 1290 1291 off_t len; 1292 }; 1293 1294 // toys/posix/find.c 1295 1296 struct find_data { 1297 char **filter; 1298 struct double_list *argdata; 1299 int topdir, xdev, depth; 1300 time_t now; 1301 long max_bytes; 1302 char *start; 1303 }; 1304 1305 // toys/posix/grep.c 1306 1307 struct grep_data { 1308 long m, A, B, C; 1309 struct arg_list *f, *e, *M, *S, *exclude_dir; 1310 char *color; 1311 1312 char *purple, *cyan, *red, *green, *grey; 1313 struct double_list *reg; 1314 char indelim, outdelim; 1315 int found, tried; 1316 }; 1317 1318 // toys/posix/head.c 1319 1320 struct head_data { 1321 long c, n; 1322 1323 int file_no; 1324 }; 1325 1326 // toys/posix/iconv.c 1327 1328 struct iconv_data { 1329 char *f, *t; 1330 1331 void *ic; 1332 }; 1333 1334 // toys/posix/id.c 1335 1336 struct id_data { 1337 int is_groups; 1338 }; 1339 1340 // toys/posix/kill.c 1341 1342 struct kill_data { 1343 char *s; 1344 struct arg_list *o; 1345 }; 1346 1347 // toys/posix/ln.c 1348 1349 struct ln_data { 1350 char *t; 1351 }; 1352 1353 // toys/posix/logger.c 1354 1355 struct logger_data { 1356 char *p, *t; 1357 }; 1358 1359 // toys/posix/ls.c 1360 1361 struct ls_data { 1362 long l; 1363 char *color; 1364 1365 struct dirtree *files, *singledir; 1366 unsigned screen_width; 1367 int nl_title; 1368 char *escmore; 1369 }; 1370 1371 // toys/posix/mkdir.c 1372 1373 struct mkdir_data { 1374 char *m, *Z; 1375 }; 1376 1377 // toys/posix/mkfifo.c 1378 1379 struct mkfifo_data { 1380 char *m; 1381 char *Z; 1382 1383 mode_t mode; 1384 }; 1385 1386 // toys/posix/nice.c 1387 1388 struct nice_data { 1389 long n; 1390 }; 1391 1392 // toys/posix/nl.c 1393 1394 struct nl_data { 1395 char *s, *n, *b; 1396 long w, l, v; 1397 1398 // Count of consecutive blank lines for -l has to persist between files 1399 long lcount; 1400 long slen; 1401 }; 1402 1403 // toys/posix/od.c 1404 1405 struct od_data { 1406 struct arg_list *t; 1407 char *A; 1408 long N, w, j; 1409 1410 int address_idx; 1411 unsigned types, leftover, star; 1412 char *buf; // Points to buffers[0] or buffers[1]. 1413 char *bufs[2]; // Used to detect duplicate lines. 1414 off_t pos; 1415 }; 1416 1417 // toys/posix/paste.c 1418 1419 struct paste_data { 1420 char *d; 1421 1422 int files; 1423 }; 1424 1425 // toys/posix/patch.c 1426 1427 struct patch_data { 1428 char *i, *d; 1429 long p, g; 1430 1431 struct double_list *current_hunk; 1432 long oldline, oldlen, newline, newlen; 1433 long linenum; 1434 int context, state, filein, fileout, filepatch, hunknum; 1435 char *tempname; 1436 }; 1437 1438 // toys/posix/ps.c 1439 1440 struct ps_data { 1441 union { 1442 struct { 1443 struct arg_list *G, *g, *U, *u, *t, *s, *p, *O, *o, *P, *k; 1444 } ps; 1445 struct { 1446 long n, m, d, s; 1447 struct arg_list *u, *p, *o, *k, *O; 1448 } top; 1449 struct { 1450 char *L; 1451 struct arg_list *G, *g, *P, *s, *t, *U, *u; 1452 char *d; 1453 1454 void *regexes, *snapshot; 1455 int signal; 1456 pid_t self, match; 1457 } pgrep; 1458 }; 1459 1460 struct ptr_len gg, GG, pp, PP, ss, tt, uu, UU; 1461 struct dirtree *threadparent; 1462 unsigned width, height; 1463 dev_t tty; 1464 void *fields, *kfields; 1465 long long ticks, bits, time; 1466 int kcount, forcek, sortpos; 1467 int (*match_process)(long long *slot); 1468 void (*show_process)(void *tb); 1469 }; 1470 1471 // toys/posix/renice.c 1472 1473 struct renice_data { 1474 long n; 1475 }; 1476 1477 // toys/posix/sed.c 1478 1479 struct sed_data { 1480 char *i; 1481 struct arg_list *f, *e; 1482 1483 // processed pattern list 1484 struct double_list *pattern; 1485 1486 char *nextline, *remember; 1487 void *restart, *lastregex; 1488 long nextlen, rememberlen, count; 1489 int fdout, noeol; 1490 unsigned xx; 1491 char delim; 1492 }; 1493 1494 // toys/posix/sort.c 1495 1496 struct sort_data { 1497 char *t; 1498 struct arg_list *k; 1499 char *o, *T, S; 1500 1501 void *key_list; 1502 int linecount; 1503 char **lines, *name; 1504 }; 1505 1506 // toys/posix/split.c 1507 1508 struct split_data { 1509 long n, l, b, a; 1510 1511 char *outfile; 1512 }; 1513 1514 // toys/posix/strings.c 1515 1516 struct strings_data { 1517 long n; 1518 char *t; 1519 }; 1520 1521 // toys/posix/tail.c 1522 1523 struct tail_data { 1524 long n, c; 1525 1526 int file_no, last_fd; 1527 struct xnotify *not; 1528 }; 1529 1530 // toys/posix/tar.c 1531 1532 struct tar_data { 1533 char *f, *C; 1534 struct arg_list *T, *X; 1535 char *to_command, *owner, *group, *mtime, *mode; 1536 struct arg_list *exclude; 1537 1538 struct double_list *incl, *excl, *seen; 1539 struct string_list *dirs; 1540 char *cwd; 1541 int fd, ouid, ggid, hlc, warn, adev, aino, sparselen; 1542 long long *sparse; 1543 time_t mtt; 1544 1545 // hardlinks seen so far (hlc many) 1546 struct { 1547 char *arg; 1548 ino_t ino; 1549 dev_t dev; 1550 } *hlx; 1551 1552 // Parsed information about a tar header. 1553 struct tar_header { 1554 char *name, *link_target, *uname, *gname; 1555 long long size, ssize; 1556 uid_t uid; 1557 gid_t gid; 1558 mode_t mode; 1559 time_t mtime; 1560 dev_t device; 1561 } hdr; 1562 }; 1563 1564 // toys/posix/tee.c 1565 1566 struct tee_data { 1567 void *outputs; 1568 int out; 1569 }; 1570 1571 // toys/posix/touch.c 1572 1573 struct touch_data { 1574 char *t, *r, *d; 1575 }; 1576 1577 // toys/posix/ulimit.c 1578 1579 struct ulimit_data { 1580 long P; 1581 }; 1582 1583 // toys/posix/uniq.c 1584 1585 struct uniq_data { 1586 long w, s, f; 1587 1588 long repeats; 1589 }; 1590 1591 // toys/posix/uudecode.c 1592 1593 struct uudecode_data { 1594 char *o; 1595 }; 1596 1597 // toys/posix/wc.c 1598 1599 struct wc_data { 1600 unsigned long totals[4]; 1601 }; 1602 1603 // toys/posix/xargs.c 1604 1605 struct xargs_data { 1606 long s, n, P; 1607 char *E; 1608 1609 long entries, bytes; 1610 char delim; 1611 FILE *tty; 1612 }; 1613 1614 extern union global_union { 1615 struct log_data log; 1616 struct demo_number_data demo_number; 1617 struct hello_data hello; 1618 struct skeleton_data skeleton; 1619 struct dmesg_data dmesg; 1620 struct gzip_data gzip; 1621 struct hostname_data hostname; 1622 struct killall_data killall; 1623 struct md5sum_data md5sum; 1624 struct mknod_data mknod; 1625 struct mktemp_data mktemp; 1626 struct mount_data mount; 1627 struct passwd_data passwd; 1628 struct pidof_data pidof; 1629 struct seq_data seq; 1630 #ifdef OHOS_LITE 1631 struct su_data su; 1632 #endif 1633 struct umount_data umount; 1634 struct ftpget_data ftpget; 1635 struct ifconfig_data ifconfig; 1636 struct microcom_data microcom; 1637 struct netcat_data netcat; 1638 struct netstat_data netstat; 1639 struct ping_data ping; 1640 struct sntp_data sntp; 1641 struct tunctl_data tunctl; 1642 struct acpi_data acpi; 1643 struct base64_data base64; 1644 struct blkid_data blkid; 1645 struct blockdev_data blockdev; 1646 struct chrt_data chrt; 1647 struct dos2unix_data dos2unix; 1648 struct fallocate_data fallocate; 1649 struct fmt_data fmt; 1650 struct free_data free; 1651 struct hexedit_data hexedit; 1652 struct hwclock_data hwclock; 1653 struct ionice_data ionice; 1654 struct login_data login; 1655 struct losetup_data losetup; 1656 struct lspci_data lspci; 1657 struct makedevs_data makedevs; 1658 struct mix_data mix; 1659 struct mkpasswd_data mkpasswd; 1660 struct mkswap_data mkswap; 1661 struct modinfo_data modinfo; 1662 struct nsenter_data nsenter; 1663 struct oneit_data oneit; 1664 struct pwgen_data pwgen; 1665 struct reboot_data reboot; 1666 struct setfattr_data setfattr; 1667 struct sha3sum_data sha3sum; 1668 struct shred_data shred; 1669 struct stat_data stat; 1670 struct swapon_data swapon; 1671 struct switch_root_data switch_root; 1672 struct tac_data tac; 1673 struct timeout_data timeout; 1674 struct truncate_data truncate; 1675 struct watch_data watch; 1676 struct xxd_data xxd; 1677 struct arp_data arp; 1678 struct arping_data arping; 1679 struct bc_data bc; 1680 struct bootchartd_data bootchartd; 1681 struct brctl_data brctl; 1682 struct chsh_data chsh; 1683 struct crond_data crond; 1684 struct crontab_data crontab; 1685 struct dd_data dd; 1686 struct dhcp_data dhcp; 1687 struct dhcp6_data dhcp6; 1688 struct dhcpd_data dhcpd; 1689 struct diff_data diff; 1690 struct dumpleases_data dumpleases; 1691 struct expr_data expr; 1692 struct fdisk_data fdisk; 1693 struct fold_data fold; 1694 struct fsck_data fsck; 1695 struct getfattr_data getfattr; 1696 struct getopt_data getopt; 1697 struct getty_data getty; 1698 struct groupadd_data groupadd; 1699 struct hexdump_data hexdump; 1700 struct host_data host; 1701 struct ip_data ip; 1702 struct ipcrm_data ipcrm; 1703 struct ipcs_data ipcs; 1704 struct klogd_data klogd; 1705 struct last_data last; 1706 struct lsof_data lsof; 1707 struct man_data man; 1708 struct mke2fs_data mke2fs; 1709 struct modprobe_data modprobe; 1710 struct more_data more; 1711 struct openvt_data openvt; 1712 struct route_data route; 1713 struct sh_data sh; 1714 struct strace_data strace; 1715 struct stty_data stty; 1716 struct sulogin_data sulogin; 1717 struct syslogd_data syslogd; 1718 struct tcpsvd_data tcpsvd; 1719 struct telnet_data telnet; 1720 struct telnetd_data telnetd; 1721 struct tftp_data tftp; 1722 struct tftpd_data tftpd; 1723 struct tr_data tr; 1724 struct traceroute_data traceroute; 1725 struct useradd_data useradd; 1726 struct vi_data vi; 1727 struct awk_data awk; 1728 struct wget_data wget; 1729 struct basename_data basename; 1730 struct chgrp_data chgrp; 1731 struct chmod_data chmod; 1732 struct cksum_data cksum; 1733 struct cmp_data cmp; 1734 struct cp_data cp; 1735 struct cpio_data cpio; 1736 struct cut_data cut; 1737 struct date_data date; 1738 struct df_data df; 1739 struct du_data du; 1740 struct env_data env; 1741 struct expand_data expand; 1742 struct file_data file; 1743 struct find_data find; 1744 struct grep_data grep; 1745 struct head_data head; 1746 struct iconv_data iconv; 1747 struct id_data id; 1748 struct kill_data kill; 1749 struct ln_data ln; 1750 struct logger_data logger; 1751 struct ls_data ls; 1752 struct mkdir_data mkdir; 1753 struct mkfifo_data mkfifo; 1754 struct nice_data nice; 1755 struct nl_data nl; 1756 struct od_data od; 1757 struct paste_data paste; 1758 struct patch_data patch; 1759 struct ps_data ps; 1760 struct renice_data renice; 1761 struct sed_data sed; 1762 struct sort_data sort; 1763 struct split_data split; 1764 struct strings_data strings; 1765 struct tail_data tail; 1766 struct tar_data tar; 1767 struct tee_data tee; 1768 struct touch_data touch; 1769 struct ulimit_data ulimit; 1770 struct uniq_data uniq; 1771 struct uudecode_data uudecode; 1772 struct wc_data wc; 1773 struct xargs_data xargs; 1774 } this; 1775