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