• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 struct log_data {
2   char *t, *p;
3 
4   int pri;
5 };
6 
7 struct dmesg_data {
8   long n, s;
9 
10   int use_color;
11   time_t tea;
12 };
13 
14 struct gzip_data {
15   int level;
16 };
17 
18 struct hostname_data {
19   char *F;
20 };
21 
22 struct killall_data {
23   char *s;
24 
25   int signum;
26   pid_t cur_pid;
27   char **names;
28   short *err;
29   struct int_list { struct int_list *next; int val; } *pids;
30 };
31 
32 struct md5sum_data {
33   int sawline;
34 };
35 
36 struct mknod_data {
37   char *Z, *m;
38 };
39 
40 struct mktemp_data {
41   char *p, *tmpdir;
42 };
43 
44 struct mount_data {
45   struct arg_list *o;
46   char *t, *O;
47 
48   unsigned long flags;
49   char *opts;
50   int okuser;
51 };
52 
53 struct pidof_data {
54   char *o;
55 };
56 
57 struct seq_data {
58   char *s, *f;
59 
60   int precision, buflen;
61 };
62 
63 struct umount_data {
64   struct arg_list *t;
65 
66   char *types;
67 };
68 
69 struct ifconfig_data {
70   int sockfd;
71 };
72 
73 struct microcom_data {
74   long s;
75 
76   int fd, stok;
77   struct termios old_stdin, old_fd;
78 };
79 
80 struct netcat_data {
81   char *f, *s, *o, *O;
82   long q, p, W, w;
83 
84   unsigned ofd, olast, opos, ocount[2];
85   char obuf[16];
86 };
87 
88 struct netstat_data {
89   struct num_cache *inodes;
90   int wpad;
91 };
92 
93 struct ping_data {
94   char *I;
95   long w, W, i, s, c, t, m;
96 
97   struct sockaddr *sa;
98   int sock;
99   unsigned long sent, recv, fugit, min, max;
100 };
101 
102 struct tunctl_data {
103   char *u;
104 };
105 
106 struct base64_data {
107   long w;
108 
109   unsigned total;
110   unsigned n;  // number of bits used in encoding. 5 for base32, 6 for base64
111   unsigned align;  // number of bits to align to
112 };
113 
114 struct blkdiscard_data {
115   long o, l;
116 };
117 
118 struct blkid_data {
119   struct arg_list *s;
120   char *o;
121 };
122 
123 struct blockdev_data {
124   long setra, setbsz;
125 };
126 
127 struct chrt_data {
128   long p;
129 };
130 
131 struct devmem_data {
132   char *f;
133 };
134 
135 struct dos2unix_data {
136   char *tempfile;
137 };
138 
139 struct fallocate_data {
140   long o, l;
141 };
142 
143 struct fmt_data {
144   long width;
145 
146   int level, pos;
147 };
148 
149 struct free_data {
150   unsigned bits;
151   unsigned long long units;
152   char *buf;
153 };
154 
155 struct getopt_data {
156   struct arg_list *l;
157   char *o, *n;
158 };
159 
160 struct gpiodetect_data {
161   struct double_list *chips;
162   int chip_count;
163 };
164 
165 struct hwclock_data {
166   char *f;
167 };
168 
169 struct i2cdetect_data {
170   long F;
171 };
172 
173 struct ionice_data {
174   long p, n, c;
175 };
176 
177 struct losetup_data {
178   char *j;
179   long o, S;
180 
181   int openflags;
182   dev_t jdev;
183   ino_t jino;
184   char *dir;
185 };
186 
187 struct lsattr_data {
188   long v, p;
189 
190   unsigned add, rm, set;
191   // !add and !rm tell us whether they were used, but `chattr =` is meaningful.
192   int have_set;
193 };
194 
195 struct lsusb_data {
196   char *i;
197   long x, n;
198 
199   void *ids, *class;
200   int count;
201 };
202 
203 struct makedevs_data {
204   char *d;
205 };
206 
207 struct mkswap_data {
208   char *L;
209 };
210 
211 struct modinfo_data {
212   char *F, *k, *b;
213 
214   long mod;
215   int count;
216 };
217 
218 struct nbd_client_data {
219   long b;
220 
221   int nbd;
222 };
223 
224 struct nsenter_data {
225   char *UupnmiC[7];
226   long t;
227 };
228 
229 struct readelf_data {
230   char *x, *p;
231 
232   char *elf, *shstrtab, *f;
233   unsigned long long shoff, phoff, size, shstrtabsz;
234   int bits, endian, shnum, shentsize, phentsize;
235 };
236 
237 struct realpath_data {
238   char *R, *relative_base;
239 };
240 
241 struct rtcwake_data {
242   long t, s;
243   char *m, *d;
244 };
245 
246 struct setfattr_data {
247   char *x, *v, *n;
248 };
249 
250 struct setsid_data {
251   long c;
252 };
253 
254 struct stat_data {
255   char *c;
256 
257   union {
258     struct stat st;
259     struct statfs sf;
260   } stat;
261   char *file, *pattern;
262   int patlen;
263 };
264 
265 struct swapon_data {
266   long p;
267 };
268 
269 struct tac_data {
270   struct double_list *dl;
271 };
272 
273 struct timeout_data {
274   char *s, *k;
275 
276   struct pollfd pfd;
277   sigjmp_buf sj;
278   int fds[2], pid, rc;
279 };
280 
281 struct truncate_data {
282   char *s;
283 
284   long long size;
285   int type;
286 };
287 
288 struct uclampset_data {
289   long M, m, p;
290 };
291 
292 struct watch_data {
293   int n;
294 
295   pid_t pid, oldpid;
296 };
297 
298 struct xxd_data {
299   long s, g, o, l, c;
300 };
301 
302 struct brctl_data {
303     int sockfd;
304 };
305 
306 struct dhcp_data {
307     char *iface;
308     char *pidfile;
309     char *script;
310     long retries;
311     long timeout;
312     long tryagain;
313     struct arg_list *req_opt;
314     char *req_ip;
315     struct arg_list *pkt_opt;
316     char *fdn_name;
317     char *hostname;
318     char *vendor_cls;
319 };
320 
321 struct diff_data {
322   long U;
323   struct arg_list *L;
324   char *F, *S, *new_line_format, *old_line_format, *unchanged_line_format;
325 
326   int dir_num, size, is_binary, is_symlink, differ, change, len[2], *offset[2];
327   struct stat st[2];
328   struct {
329     char **list;
330     int nr_elm;
331   } dir[2];
332   struct {
333     FILE *fp;
334     int len;
335   } file[2];
336   struct {
337     char *name;
338     int len;
339   } link[2];
340 };
341 
342 struct expr_data {
343   char **tok, *delete;
344 };
345 
346 struct getfattr_data {
347   char *n;
348 };
349 
350 struct lsof_data {
351   struct arg_list *p;
352 
353   struct stat *sought_files;
354   struct double_list *all_sockets, *files;
355   int last_shown_pid, shown_header;
356 };
357 
358 struct modprobe_data {
359   struct arg_list *dirs;
360 
361   struct arg_list *probes, *dbase[256];
362   char *cmdopts;
363   int nudeps, symreq;
364 };
365 
366 struct more_data {
367   struct termios inf;
368   int cin_fd;
369 };
370 
371 struct stty_data {
372   char *F;
373 
374   int fd, col;
375   unsigned output_cols;
376 };
377 
378 struct tr_data {
379   short *map;
380   int len1, len2;
381 };
382 
383 struct traceroute_data {
384   long max_ttl;
385   long port;
386   long ttl_probes;
387   char *src_ip;
388   long tos;
389   long wait_time;
390   struct arg_list *loose_source;
391   long pause_time;
392   long first_ttl;
393   char *iface;
394 
395   uint32_t gw_list[9];
396   int recv_sock;
397   int snd_sock;
398   unsigned msg_len;
399   char *packet;
400   uint32_t ident;
401   int istraceroute6;
402 };
403 
404 struct vi_data {
405   char *c, *s;
406 
407   char *filename;
408   int vi_mode, tabstop, list, cur_col, cur_row, scr_row, drawn_row, drawn_col,
409       count0, count1, vi_mov_flag;
410   unsigned screen_height, screen_width;
411   char vi_reg, *last_search;
412   struct str_line {
413     int alloc, len;
414     char *data;
415   } *il;
416   size_t screen, cursor; //offsets
417   //yank buffer
418   struct yank_buf {
419     char reg;
420     int alloc;
421     char *data;
422   } yank;
423 
424   size_t filesize;
425 // mem_block contains RO data that is either original file as mmap
426 // or heap allocated inserted data
427   struct block_list {
428     struct block_list *next, *prev;
429     struct mem_block {
430       size_t size, len;
431       enum alloc_flag {
432         MMAP,  //can be munmap() before exit()
433         HEAP,  //can be free() before exit()
434         STACK, //global or stack perhaps toybuf
435       } alloc;
436       const char *data;
437     } *node;
438   } *text;
439 
440 // slices do not contain actual allocated data but slices of data in mem_block
441 // when file is first opened it has only one slice.
442 // after inserting data into middle new mem_block is allocated for insert data
443 // and 3 slices are created, where first and last slice are pointing to original
444 // mem_block with offsets, and middle slice is pointing to newly allocated block
445 // When deleting, data is not freed but mem_blocks are sliced more such way that
446 // deleted data left between 2 slices
447   struct slice_list {
448     struct slice_list *next, *prev;
449     struct slice {
450       size_t len;
451       const char *data;
452     } *node;
453   } *slices;
454 };
455 
456 struct basename_data {
457   char *s;
458 };
459 
460 struct cal_data {
461   struct tm *now;
462 };
463 
464 struct chgrp_data {
465   uid_t owner;
466   gid_t group;
467   char *owner_name, *group_name;
468   int symfollow;
469 };
470 
471 struct chmod_data {
472   char *mode;
473 };
474 
475 struct cmp_data {
476   long n;
477 
478   int fd;
479   char *name;
480 };
481 
482 struct cp_data {
483   union {
484     // install's options
485     struct {
486       char *g, *o, *m, *t;
487     } i;
488     // cp's options
489     struct {
490       char *t, *preserve;
491     } c;
492   };
493 
494   char *destname;
495   struct stat top;
496   int (*callback)(struct dirtree *try);
497   uid_t uid;
498   gid_t gid;
499   int pflags;
500 };
501 
502 struct cpio_data {
503   char *F, *H, *R;
504 };
505 
506 struct cut_data {
507   char *d, *O;
508   struct arg_list *select[5]; // we treat them the same, so loop through
509 
510   unsigned line;
511   int pairs;
512   regex_t reg;
513 };
514 
515 struct date_data {
516   char *s, *r, *I, *D, *d;
517 
518   unsigned nano;
519 };
520 
521 struct dd_data {
522   // Display fields
523   int show_xfer, show_records;
524   unsigned long long bytes, in_full, in_part, out_full, out_part, start;
525 };
526 
527 struct df_data {
528   struct arg_list *t;
529 
530   int units, width[6];
531 };
532 
533 struct du_data {
534   long d;
535 
536   unsigned long depth, total;
537   dev_t st_dev;
538   void *inodes;
539 };
540 
541 struct env_data {
542   struct arg_list *u;
543   char *e;
544 };
545 
546 struct expand_data {
547   struct arg_list *t;
548 
549   unsigned tabcount, *tab;
550 };
551 
552 struct file_data {
553   int max_name_len;
554   off_t len;
555 };
556 
557 struct find_data {
558   char **filter;
559   struct double_list *argdata;
560   int topdir, xdev, depth;
561   time_t now;
562   long max_bytes;
563   char *start;
564 };
565 
566 struct grep_data {
567   long m, A, B, C;
568   struct arg_list *f, *e, *M, *S, *exclude_dir;
569   char *color;
570 
571   char *purple, *cyan, *red, *green, *grey;
572   struct double_list *reg;
573   int found, tried, delim;
574   struct arg_list **fixed;
575 };
576 
577 struct head_data {
578   long c, n;
579 
580   int file_no;
581 };
582 
583 struct iconv_data {
584   char *f, *t;
585 
586   void *ic;
587 };
588 
589 struct id_data {
590   int is_groups;
591 };
592 
593 struct kill_data {
594   char *s;
595   struct arg_list *o;
596 };
597 
598 struct ln_data {
599   char *t;
600 };
601 
602 struct logger_data {
603   char *p, *t;
604 
605   int priority;
606 };
607 
608 struct ls_data {
609   long w, l, block_size;
610   char *color, *sort;
611 
612   struct dirtree *files, *singledir;
613   unsigned screen_width;
614   int nl_title;
615   char *escmore;
616 };
617 
618 struct mkdir_data {
619   char *m, *Z;
620 };
621 
622 struct mkfifo_data {
623   char *m, *Z;
624 
625   mode_t mode;
626 };
627 
628 struct nice_data {
629   long n;
630 };
631 
632 struct nl_data {
633   char *s, *n, *b;
634   long w, l, v;
635 
636   // Count of consecutive blank lines for -l has to persist between files
637   long lcount, slen;
638 };
639 
640 struct od_data {
641   struct arg_list *t;
642   char *A;
643   long N, w, j;
644 
645   int address_idx;
646   unsigned types, leftover, star;
647   char *buf; // Points to buffers[0] or buffers[1].
648   char *bufs[2]; // Used to detect duplicate lines.
649   off_t pos;
650 };
651 
652 struct paste_data {
653   char *d;
654 
655   int files;
656 };
657 
658 struct patch_data {
659   char *i, *d;
660   long v, p, g, F;
661 
662   void *current_hunk;
663   long oldline, oldlen, newline, newlen, linenum, outnum;
664   int context, state, filein, fileout, filepatch, hunknum;
665   char *tempname;
666 };
667 
668 struct ps_data {
669   union {
670     struct {
671       struct arg_list *G, *g, *U, *u, *t, *s, *p, *O, *o, *P, *k;
672     } ps;
673     struct {
674       long n, m, d, s;
675       struct arg_list *u, *p, *o, *k, *O;
676     } top;
677     struct {
678       char *L;
679       struct arg_list *G, *g, *P, *s, *t, *U, *u;
680       char *d;
681 
682       void *regexes, *snapshot;
683       int signal;
684       pid_t self, match;
685     } pgrep;
686   };
687 
688   struct ps_ptr_len {
689     void *ptr;
690     long len;
691   } gg, GG, pp, PP, ss, tt, uu, UU;
692   struct dirtree *threadparent;
693   unsigned width, height, scroll;
694   dev_t tty;
695   void *fields, *kfields;
696   long long ticks, bits, time;
697   int kcount, forcek, sortpos, pidlen;
698   int (*match_process)(long long *slot);
699   void (*show_process)(void *tb);
700 };
701 
702 struct renice_data {
703   long n;
704 };
705 
706 struct sed_data {
707   char *i;
708   struct arg_list *f, *e;
709 
710   // processed pattern list
711   struct double_list *pattern;
712 
713   char *nextline, *remember, *tarxform;
714   void *restart, *lastregex;
715   long nextlen, rememberlen, count;
716   int fdout, noeol;
717   unsigned xx, tarxlen, xflags;
718   char delim, xftype;
719 };
720 
721 struct sort_data {
722   char *t;
723   struct arg_list *k;
724   char *o, *T, S;
725 
726   void *key_list;
727   unsigned linecount;
728   char **lines, *name;
729 };
730 
731 struct split_data {
732   long n, l, b, a;
733 
734   char *outfile;
735 };
736 
737 struct strings_data {
738   long n;
739   char *t;
740 };
741 
742 struct tail_data {
743   long n, c;
744   char *s;
745 
746   int file_no, last_fd, ss;
747   struct xnotify *not;
748   struct {
749     char *path;
750     int fd;
751     struct dev_ino di;
752   } *F;
753 };
754 
755 struct tar_data {
756   char *f, *C, *I;
757   struct arg_list *T, *X, *xform;
758   long strip;
759   char *to_command, *owner, *group, *mtime, *mode, *sort;
760   struct arg_list *exclude;
761 
762   struct double_list *incl, *excl, *seen;
763   struct string_list *dirs;
764   char *cwd, **xfsed;
765   int fd, ouid, ggid, hlc, warn, sparselen, pid, xfpipe[2];
766   struct dev_ino archive_di;
767   long long *sparse;
768   time_t mtt;
769 
770   // hardlinks seen so far (hlc many)
771   struct {
772     char *arg;
773     struct dev_ino di;
774   } *hlx;
775 
776   // Parsed information about a tar header.
777   struct tar_header {
778     char *name, *link_target, *uname, *gname;
779     long long size, ssize, oldsparse;
780     uid_t uid;
781     gid_t gid;
782     mode_t mode;
783     time_t mtime;
784     dev_t device;
785   } hdr;
786 };
787 
788 struct tee_data {
789   void *outputs;
790   int out;
791 };
792 
793 struct touch_data {
794   char *t, *r, *d;
795 };
796 
797 struct ulimit_data {
798   long P;
799 };
800 
801 struct uniq_data {
802   long w, s, f;
803 
804   long repeats;
805 };
806 
807 struct uudecode_data {
808   char *o;
809 };
810 
811 struct wc_data {
812   unsigned long totals[5];
813 };
814 
815 struct xargs_data {
816   long s, n, P;
817   char *E;
818 
819   long entries, bytes, np;
820   char delim;
821   FILE *tty;
822 };
823 extern union global_union {
824 	struct log_data log;
825 	struct dmesg_data dmesg;
826 	struct gzip_data gzip;
827 	struct hostname_data hostname;
828 	struct killall_data killall;
829 	struct md5sum_data md5sum;
830 	struct mknod_data mknod;
831 	struct mktemp_data mktemp;
832 	struct mount_data mount;
833 	struct pidof_data pidof;
834 	struct seq_data seq;
835 	struct umount_data umount;
836 	struct ifconfig_data ifconfig;
837 	struct microcom_data microcom;
838 	struct netcat_data netcat;
839 	struct netstat_data netstat;
840 	struct ping_data ping;
841 	struct tunctl_data tunctl;
842 	struct base64_data base64;
843 	struct blkdiscard_data blkdiscard;
844 	struct blkid_data blkid;
845 	struct blockdev_data blockdev;
846 	struct chrt_data chrt;
847 	struct devmem_data devmem;
848 	struct dos2unix_data dos2unix;
849 	struct fallocate_data fallocate;
850 	struct fmt_data fmt;
851 	struct free_data free;
852 	struct getopt_data getopt;
853 	struct gpiodetect_data gpiodetect;
854 	struct hwclock_data hwclock;
855 	struct i2cdetect_data i2cdetect;
856 	struct ionice_data ionice;
857 	struct losetup_data losetup;
858 	struct lsattr_data lsattr;
859 	struct lsusb_data lsusb;
860 	struct makedevs_data makedevs;
861 	struct mkswap_data mkswap;
862 	struct modinfo_data modinfo;
863 	struct nbd_client_data nbd_client;
864 	struct nsenter_data nsenter;
865 	struct readelf_data readelf;
866 	struct realpath_data realpath;
867 	struct rtcwake_data rtcwake;
868 	struct setfattr_data setfattr;
869 	struct setsid_data setsid;
870 	struct stat_data stat;
871 	struct swapon_data swapon;
872 	struct tac_data tac;
873 	struct timeout_data timeout;
874 	struct truncate_data truncate;
875 	struct uclampset_data uclampset;
876 	struct watch_data watch;
877 	struct xxd_data xxd;
878 	struct brctl_data brctl;
879 	struct dhcp_data dhcp;
880 	struct diff_data diff;
881 	struct expr_data expr;
882 	struct getfattr_data getfattr;
883 	struct lsof_data lsof;
884 	struct modprobe_data modprobe;
885 	struct more_data more;
886 	struct stty_data stty;
887 	struct tr_data tr;
888 	struct traceroute_data traceroute;
889 	struct vi_data vi;
890 	struct basename_data basename;
891 	struct cal_data cal;
892 	struct chgrp_data chgrp;
893 	struct chmod_data chmod;
894 	struct cmp_data cmp;
895 	struct cp_data cp;
896 	struct cpio_data cpio;
897 	struct cut_data cut;
898 	struct date_data date;
899 	struct dd_data dd;
900 	struct df_data df;
901 	struct du_data du;
902 	struct env_data env;
903 	struct expand_data expand;
904 	struct file_data file;
905 	struct find_data find;
906 	struct grep_data grep;
907 	struct head_data head;
908 	struct iconv_data iconv;
909 	struct id_data id;
910 	struct kill_data kill;
911 	struct ln_data ln;
912 	struct logger_data logger;
913 	struct ls_data ls;
914 	struct mkdir_data mkdir;
915 	struct mkfifo_data mkfifo;
916 	struct nice_data nice;
917 	struct nl_data nl;
918 	struct od_data od;
919 	struct paste_data paste;
920 	struct patch_data patch;
921 	struct ps_data ps;
922 	struct renice_data renice;
923 	struct sed_data sed;
924 	struct sort_data sort;
925 	struct split_data split;
926 	struct strings_data strings;
927 	struct tail_data tail;
928 	struct tar_data tar;
929 	struct tee_data tee;
930 	struct touch_data touch;
931 	struct ulimit_data ulimit;
932 	struct uniq_data uniq;
933 	struct uudecode_data uudecode;
934 	struct wc_data wc;
935 	struct xargs_data xargs;
936 } this;
937