├── dummy ├── www ├── index.html ├── .htaccess ├── footer.html ├── towel.jpg ├── toycans.png ├── toycans-big.jpg ├── downloads │ └── binaries │ │ ├── toolchains │ │ └── README │ │ └── mkroot │ │ └── README └── release.txt ├── tests ├── files │ ├── zip │ │ ├── d1 │ │ │ └── d2 │ │ │ │ ├── a.txt │ │ │ │ ├── empty.txt │ │ │ │ ├── b.txt │ │ │ │ ├── c.txt │ │ │ │ └── x.txt │ │ └── example.zip │ ├── utf8 │ │ ├── 0xabad1dea.txt │ │ ├── japan.txt │ │ ├── arabic.txt │ │ ├── bad.txt │ │ ├── test1.txt │ │ └── test2.txt │ ├── bc │ │ ├── arrays_results.txt │ │ ├── pi.txt │ │ ├── arctan.txt │ │ ├── misc_results.txt │ │ ├── arrays.txt │ │ ├── misc2_results.txt │ │ ├── misc.txt │ │ ├── sqrt.txt │ │ ├── exponent.txt │ │ ├── log.txt │ │ ├── sqrt_results.txt │ │ ├── script.sh │ │ ├── misc1_results.txt │ │ ├── vars_results.txt │ │ ├── vars.txt │ │ ├── cosine.txt │ │ ├── misc2.txt │ │ ├── power.txt │ │ ├── log_results.txt │ │ ├── exponent_results.txt │ │ ├── modulus_results.txt │ │ ├── divide_results.txt │ │ ├── misc1.txt │ │ ├── cosine_results.txt │ │ ├── subtract_results.txt │ │ ├── multiply_results.txt │ │ ├── modulus.txt │ │ ├── boolean_results.txt │ │ ├── power_results.txt │ │ ├── divide.txt │ │ ├── add_results.txt │ │ ├── subtract.txt │ │ └── multiply.txt │ ├── elf │ │ ├── fdstatic │ │ ├── ndk-elf-note-full │ │ ├── ndk-elf-note-short │ │ └── ndk-elf-note-shflags │ ├── java.class │ ├── tar │ │ ├── tar.7z │ │ ├── tar.tbz2 │ │ ├── tar.tgz │ │ ├── oldsparse.tgz │ │ └── long_path.tar │ ├── blkid │ │ ├── ext2.bz2 │ │ ├── ext3.bz2 │ │ ├── ext4.bz2 │ │ ├── f2fs.bz2 │ │ ├── iso.bz2 │ │ ├── ntfs.bz2 │ │ ├── vfat.bz2 │ │ ├── xfs.bz2 │ │ ├── cramfs.bz2 │ │ ├── fat32.bz2 │ │ ├── minix.bz2 │ │ ├── msdos.bz2 │ │ ├── reiser3.bz2 │ │ └── squashfs.bz2 │ └── bzcat │ │ ├── badcrc.bz2 │ │ └── overflow.bz2 ├── sha224sum.test ├── sha256sum.test ├── sha384sum.test ├── sha3sum.test ├── sha512sum.test ├── uuidgen.test ├── tee.test ├── fallocate.test ├── ps.test ├── kill.test ├── tsort.test ├── uptime.test ├── hostname.test ├── netcat.test ├── README.txt ├── dirname.test ├── more.test ├── comm.test ├── tr.test ├── httpd.test ├── bzcat.test ├── top.test ├── zcat.test ├── killall.test ├── mkfifo.test ├── fstype.test ├── stat.test ├── unicode.test ├── pwd.test ├── bc.test ├── install.test ├── iconv.test ├── link.test ├── uuencode.test ├── pidof.test ├── setfattr.test ├── rev.test ├── id.test ├── uudecode.test ├── cat.test ├── factor.test ├── getfattr.test ├── basename.test ├── demo_number.test ├── mkpasswd.test ├── tac.test ├── strings.test ├── split.test ├── paste.test ├── env.test ├── chown.test ├── losetup.test ├── cksum.test ├── groupdel.test ├── xzcat.test ├── taskset.test ├── fold.test ├── vi.test ├── base64.test ├── truncate.test ├── expand.test ├── base32.test ├── head.test ├── getopt.test ├── timeout.test ├── fmt.test └── lsattr.test ├── scripts ├── prereq │ ├── generated │ │ ├── tags.h │ │ ├── flags.h │ │ └── help.h │ └── build.sh ├── mkroot.sh ├── probes │ ├── README │ ├── GLOBALS │ ├── findglobals │ ├── showasm │ ├── cmd2dpkg │ └── bloatcheck ├── change.sh ├── git-static-index.sh └── install.c ├── toys ├── other │ ├── pwgen.c │ ├── clear.c │ ├── README │ ├── nologin.c │ ├── uuidgen.c │ ├── freeramdisk.c │ ├── usleep.c │ ├── fsfreeze.c │ ├── linux32.c │ ├── w.c │ ├── reset.c │ ├── partprobe.c │ ├── pwdx.c │ ├── tac.c │ ├── fsync.c │ ├── fallocate.c │ ├── readahead.c │ ├── memeater.c │ ├── rev.c │ ├── swapon.c │ ├── flock.c │ ├── pivot_root.c │ ├── mcookie.c │ ├── printenv.c │ ├── setfattr.c │ ├── chroot.c │ ├── swapoff.c │ ├── lsmod.c │ ├── rmmod.c │ ├── chcon.c │ ├── yes.c │ ├── reboot.c │ ├── insmod.c │ ├── hd.c │ ├── setsid.c │ ├── watchdog.c │ ├── mkswap.c │ ├── ts.c │ ├── shuf.c │ ├── free.c │ └── which.c ├── android │ ├── README │ ├── runcon.c │ ├── getenforce.c │ ├── load_policy.c │ ├── setenforce.c │ ├── sendevent.c │ └── restorecon.c ├── posix │ ├── README │ ├── false.c │ ├── true.c │ ├── unlink.c │ ├── dirname.c │ ├── link.c │ ├── tty.c │ ├── sleep.c │ ├── mkfifo.c │ ├── nohup.c │ ├── nice.c │ ├── who.c │ ├── basename.c │ ├── renice.c │ ├── rmdir.c │ ├── mkdir.c │ ├── pwd.c │ ├── uname.c │ ├── uuencode.c │ └── tee.c ├── net │ ├── README │ └── tunctl.c ├── lsb │ ├── README │ ├── sync.c │ ├── pidof.c │ └── mknod.c ├── example │ ├── demo_many_options.c │ ├── hostid.c │ ├── README │ ├── hello.c │ ├── demo_number.c │ └── demo_utf8towc.c └── pending │ └── README ├── mkroot ├── packages │ ├── overlay │ ├── tests │ ├── dynamic │ ├── lfs-sources │ └── busybox ├── README.root ├── record-commands └── tar-for-web.sh ├── .gitignore ├── kconfig ├── lxdialog │ └── BIG.FAT.WARNING └── README ├── LICENSE ├── .github └── workflows │ └── toybox.yml ├── configure └── lib └── toyflags.h /dummy: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /www/index.html: -------------------------------------------------------------------------------- 1 | about.html -------------------------------------------------------------------------------- /tests/files/zip/d1/d2/a.txt: -------------------------------------------------------------------------------- 1 | a 2 | -------------------------------------------------------------------------------- /tests/files/zip/d1/d2/empty.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/sha224sum.test: -------------------------------------------------------------------------------- 1 | sha1sum.test -------------------------------------------------------------------------------- /tests/sha256sum.test: -------------------------------------------------------------------------------- 1 | sha1sum.test -------------------------------------------------------------------------------- /tests/sha384sum.test: -------------------------------------------------------------------------------- 1 | sha1sum.test -------------------------------------------------------------------------------- /tests/sha3sum.test: -------------------------------------------------------------------------------- 1 | sha1sum.test -------------------------------------------------------------------------------- /tests/sha512sum.test: -------------------------------------------------------------------------------- 1 | sha1sum.test -------------------------------------------------------------------------------- /www/.htaccess: -------------------------------------------------------------------------------- 1 | Xbithack on 2 | -------------------------------------------------------------------------------- /scripts/prereq/generated/tags.h: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/files/zip/d1/d2/b.txt: -------------------------------------------------------------------------------- 1 | bb 2 | -------------------------------------------------------------------------------- /tests/files/zip/d1/d2/c.txt: -------------------------------------------------------------------------------- 1 | ccc 2 | -------------------------------------------------------------------------------- /tests/files/utf8/0xabad1dea.txt: -------------------------------------------------------------------------------- 1 | ‮ ασσιλέΜ ‭ 2 | -------------------------------------------------------------------------------- /tests/files/bc/arrays_results.txt: -------------------------------------------------------------------------------- 1 | 2 2 | 4 3 | 2 4 | -------------------------------------------------------------------------------- /tests/files/utf8/japan.txt: -------------------------------------------------------------------------------- 1 | 私はガラスを食べられます。それは私を傷つけません。 -------------------------------------------------------------------------------- /scripts/mkroot.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/printf Moved to mkroot/mkroot.sh\n\c%s 2 | -------------------------------------------------------------------------------- /www/footer.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /www/towel.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landley/toybox/HEAD/www/towel.jpg -------------------------------------------------------------------------------- /www/toycans.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landley/toybox/HEAD/www/toycans.png -------------------------------------------------------------------------------- /toys/other/pwgen.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landley/toybox/HEAD/toys/other/pwgen.c -------------------------------------------------------------------------------- /www/toycans-big.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landley/toybox/HEAD/www/toycans-big.jpg -------------------------------------------------------------------------------- /scripts/probes/README: -------------------------------------------------------------------------------- 1 | Various development scripts to ask questions about a toybox binary. 2 | -------------------------------------------------------------------------------- /tests/files/bc/pi.txt: -------------------------------------------------------------------------------- 1 | for (i = 0; i <= 100; ++i) { 2 | scale = i 3 | 4 * a(1) 4 | } 5 | -------------------------------------------------------------------------------- /tests/files/elf/fdstatic: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landley/toybox/HEAD/tests/files/elf/fdstatic -------------------------------------------------------------------------------- /tests/files/java.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landley/toybox/HEAD/tests/files/java.class -------------------------------------------------------------------------------- /tests/files/tar/tar.7z: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landley/toybox/HEAD/tests/files/tar/tar.7z -------------------------------------------------------------------------------- /tests/files/tar/tar.tbz2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landley/toybox/HEAD/tests/files/tar/tar.tbz2 -------------------------------------------------------------------------------- /tests/files/tar/tar.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landley/toybox/HEAD/tests/files/tar/tar.tgz -------------------------------------------------------------------------------- /tests/files/utf8/arabic.txt: -------------------------------------------------------------------------------- 1 | بلدي الحوامات مليء الثعابين 2 | وأنا لن شراء هذه السجائر مخدوش ذلك. -------------------------------------------------------------------------------- /tests/files/utf8/bad.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landley/toybox/HEAD/tests/files/utf8/bad.txt -------------------------------------------------------------------------------- /tests/files/blkid/ext2.bz2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landley/toybox/HEAD/tests/files/blkid/ext2.bz2 -------------------------------------------------------------------------------- /tests/files/blkid/ext3.bz2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landley/toybox/HEAD/tests/files/blkid/ext3.bz2 -------------------------------------------------------------------------------- /tests/files/blkid/ext4.bz2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landley/toybox/HEAD/tests/files/blkid/ext4.bz2 -------------------------------------------------------------------------------- /tests/files/blkid/f2fs.bz2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landley/toybox/HEAD/tests/files/blkid/f2fs.bz2 -------------------------------------------------------------------------------- /tests/files/blkid/iso.bz2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landley/toybox/HEAD/tests/files/blkid/iso.bz2 -------------------------------------------------------------------------------- /tests/files/blkid/ntfs.bz2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landley/toybox/HEAD/tests/files/blkid/ntfs.bz2 -------------------------------------------------------------------------------- /tests/files/blkid/vfat.bz2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landley/toybox/HEAD/tests/files/blkid/vfat.bz2 -------------------------------------------------------------------------------- /tests/files/blkid/xfs.bz2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landley/toybox/HEAD/tests/files/blkid/xfs.bz2 -------------------------------------------------------------------------------- /tests/files/blkid/cramfs.bz2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landley/toybox/HEAD/tests/files/blkid/cramfs.bz2 -------------------------------------------------------------------------------- /tests/files/blkid/fat32.bz2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landley/toybox/HEAD/tests/files/blkid/fat32.bz2 -------------------------------------------------------------------------------- /tests/files/blkid/minix.bz2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landley/toybox/HEAD/tests/files/blkid/minix.bz2 -------------------------------------------------------------------------------- /tests/files/blkid/msdos.bz2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landley/toybox/HEAD/tests/files/blkid/msdos.bz2 -------------------------------------------------------------------------------- /tests/files/blkid/reiser3.bz2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landley/toybox/HEAD/tests/files/blkid/reiser3.bz2 -------------------------------------------------------------------------------- /tests/files/bzcat/badcrc.bz2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landley/toybox/HEAD/tests/files/bzcat/badcrc.bz2 -------------------------------------------------------------------------------- /tests/files/tar/oldsparse.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landley/toybox/HEAD/tests/files/tar/oldsparse.tgz -------------------------------------------------------------------------------- /tests/files/zip/example.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landley/toybox/HEAD/tests/files/zip/example.zip -------------------------------------------------------------------------------- /tests/files/blkid/squashfs.bz2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landley/toybox/HEAD/tests/files/blkid/squashfs.bz2 -------------------------------------------------------------------------------- /tests/files/bzcat/overflow.bz2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landley/toybox/HEAD/tests/files/bzcat/overflow.bz2 -------------------------------------------------------------------------------- /scripts/prereq/generated/flags.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landley/toybox/HEAD/scripts/prereq/generated/flags.h -------------------------------------------------------------------------------- /tests/files/bc/arctan.txt: -------------------------------------------------------------------------------- 1 | for (i = 1; i <= 100; i++) { 2 | scale = i 3 | a(.267) 4 | a(1) 5 | } 6 | halt 7 | -------------------------------------------------------------------------------- /tests/files/bc/misc_results.txt: -------------------------------------------------------------------------------- 1 | -1284597623836.9 2 | -1284597623836.9 3 | -4483684050181.80 4 | -4483684050181.80 5 | -------------------------------------------------------------------------------- /tests/files/elf/ndk-elf-note-full: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landley/toybox/HEAD/tests/files/elf/ndk-elf-note-full -------------------------------------------------------------------------------- /tests/files/elf/ndk-elf-note-short: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landley/toybox/HEAD/tests/files/elf/ndk-elf-note-short -------------------------------------------------------------------------------- /mkroot/packages/overlay: -------------------------------------------------------------------------------- 1 | #!/bin/echo Try "mkroot/mkroot.sh overlay" 2 | 3 | cp -a "${OVERLAY:=overlay}"/. "$ROOT"/. 4 | -------------------------------------------------------------------------------- /tests/files/elf/ndk-elf-note-shflags: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/landley/toybox/HEAD/tests/files/elf/ndk-elf-note-shflags -------------------------------------------------------------------------------- /tests/files/bc/arrays.txt: -------------------------------------------------------------------------------- 1 | a[0] = 1 2 | a[2-1] = 2 3 | 4 | a[0]+a[0] 5 | 6 | a[2-1]+a[2-1] 7 | 8 | a[5] = 2 9 | a[5.789] 10 | 11 | -------------------------------------------------------------------------------- /tests/files/utf8/test1.txt: -------------------------------------------------------------------------------- 1 | l̴̗̞̠ȩ̸̩̥ṱ̴͍̻ ̴̲͜ͅt̷͇̗̮h̵̥͉̝e̴̡̺̼ ̸̤̜͜ŗ̴͓͉i̶͉͓͎t̷̞̝̻u̶̻̫̗a̴̺͎̯l̴͍͜ͅ ̵̩̲̱c̷̩̟̖o̴̠͍̻m̸͚̬̘ṃ̷̢͜e̵̗͎̫n̸̨̦̖c̷̰̩͎e̴̱̞̗ 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | syntax: glob 2 | /.config* 3 | /.single* 4 | /change/ 5 | /generated/ 6 | /kconfig/mconf 7 | /kconfig/conf 8 | /kconfig/*.c 9 | /toybox 10 | /toybox_unstripped 11 | -------------------------------------------------------------------------------- /tests/files/utf8/test2.txt: -------------------------------------------------------------------------------- 1 | l̴̗̞̠ȩ̸̩̥ṱ̴͍̻ ̴̲͜ͅt̷͇̗̮h̵̥͉̝e̴̡̺̼ ̸̤̜͜ŗ̴͓͉i̶͉͓͎t̷̞̝̻u̶̻̫̗a̴̺͎̯l̴͍͜ͅ ̵̩̲̱c̷̩̟̖o̴̠͍̻m̸͚̬̘ṃ̷̢͜e̵̗͎̫n̸̨̦̖c̷̰̩͎e̴̱̞̗ 2 | the̡ ҉̷ŕ͠͡į͞ţų͠al͘ ̛͏i͘҉s̛ ͜͞ḉ͏om̶͏pl̵͜ęt̴͠e̛ 3 | -------------------------------------------------------------------------------- /toys/android/README: -------------------------------------------------------------------------------- 1 | Android commands 2 | 3 | Commands primarily used by Android, not present in vanilla Linux. 4 | (Mostly SELinux stuff.) 5 | 6 | Bug Elliott Hughes about this. 7 | -------------------------------------------------------------------------------- /tests/files/bc/misc2_results.txt: -------------------------------------------------------------------------------- 1 | xy1 2 | xy2 3 | yx3 4 | xy4 5 | xy5 6 | yx6 7 | xz11 8 | xz12 9 | zx13 10 | xz14 11 | xz15 12 | zx16 13 | -10 14 | -9 15 | -8 16 | -7 17 | -6 18 | -5 19 | 0 20 | -9 21 | -------------------------------------------------------------------------------- /toys/posix/README: -------------------------------------------------------------------------------- 1 | Posix commands 2 | 3 | Commands defined in POSIX-2008, also known as the Single Unix 4 | Specification version 4, available online at 5 | http://pubs.opengroup.org/onlinepubs/9699919799/idx/utilities.html 6 | -------------------------------------------------------------------------------- /kconfig/lxdialog/BIG.FAT.WARNING: -------------------------------------------------------------------------------- 1 | This is NOT the official version of dialog. This version has been 2 | significantly modified from the original. It is for use by the Linux 3 | kernel configuration script. Please do not bother Savio Lam with 4 | questions about this program. 5 | -------------------------------------------------------------------------------- /tests/uuidgen.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | [ -f testing.sh ] && . testing.sh 4 | 5 | #testing "name" "command" "result" "infile" "stdin" 6 | 7 | testing "smoke" "uuidgen | grep -Eq '[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}' && echo okay" "okay\n" "" "" 8 | -------------------------------------------------------------------------------- /tests/files/bc/misc.txt: -------------------------------------------------------------------------------- 1 | 4.1*1.-13^ - 74 - 1284597623841*1.-13^ - 757 2 | 4.1*1.\ 3 | -1\ 4 | 3^ - 74 - 1284597623841*1.\ 5 | -1\ 6 | 3^ - 757 7 | obase = 9 8 | 4.1*1.-13^ - 74 - 1284597623841*1.-13^ - 757 9 | 4.1*1.\ 10 | -1\ 11 | 3^ - 74 - 1284597623841*1.\ 12 | -1\ 13 | 3^ - 757 14 | -------------------------------------------------------------------------------- /tests/tee.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | [ -f testing.sh ] && . testing.sh 4 | 5 | #testing "name" "command" "result" "infile" "stdin" 6 | 7 | testing "" "tee" "one" "" "one" 8 | testing "" "tee -" "two\n" "" "two\n" 9 | testing "" "tee one > two && cmp one two && echo that" "that\n" "" "three" 10 | -------------------------------------------------------------------------------- /tests/fallocate.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #testing "name" "command" "result" "infile" "stdin" 4 | 5 | rm -f foo 6 | testcmd 'simple' '-l 123 foo && stat -c %s foo' '123\n' '' '' 7 | testcmd 'shorter' '-l 12 foo && stat -c %s foo' '123\n' '' '' 8 | testcmd 'longer' '-o 200 -l 12 foo && stat -c %s foo' '212\n' '' '' 9 | -------------------------------------------------------------------------------- /tests/files/bc/sqrt.txt: -------------------------------------------------------------------------------- 1 | scale = 20 2 | sqrt(0) 3 | sqrt(2) 4 | sqrt(4) 5 | sqrt(9) 6 | sqrt(16) 7 | sqrt(25) 8 | sqrt(121) 9 | sqrt(48765) 10 | sqrt(9287356207356) 11 | sqrt(0.189274385967238956872354) 12 | sqrt(12389467137496823.134567829387456283946) 13 | sqrt(.0000000000000000000000000000123) 14 | sqrt(1) 15 | -------------------------------------------------------------------------------- /tests/ps.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | [ -f testing.sh ] && . testing.sh 4 | 5 | #testing "name" "command" "result" "infile" "stdin" 6 | 7 | ln -s "$(which sleep)" xiphoid 8 | (./xiphoid 5 & echo $! > pid.txt) 9 | ID=$(cat pid.txt) 10 | NOSPACE=1 testing "" "ps -o pid $ID" "PID\n$ID\n" "" "" 11 | kill "$ID" 12 | -------------------------------------------------------------------------------- /toys/net/README: -------------------------------------------------------------------------------- 1 | Networking commands 2 | 3 | The Internet Engineering Task Force publishes standards drafts at 4 | https://www.ietf.org/rfc/rfc-index.txt (ala https://www.ietf.org/rfc/rfc3.txt) 5 | and the commands tend to be documented in manual page section 8 6 | https://man7.org/linux/man-pages/dir_section_8.html 7 | -------------------------------------------------------------------------------- /tests/kill.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | [ -f testing.sh ] && . testing.sh 4 | 5 | #testing "name" "command" "result" "infile" "stdin" 6 | 7 | testcmd "" "-l HUP" "1\n" "" "" 8 | testcmd "" "-l 1" "HUP\n" "" "" 9 | testcmd "" "-l 3 KILL" "QUIT\n9\n" "" "" 10 | testcmd "-0 self" "-0 $$ && echo yes" "yes\n" "" "" 11 | -------------------------------------------------------------------------------- /toys/lsb/README: -------------------------------------------------------------------------------- 1 | Linux Standard Base commands 2 | 3 | Commands defined in the Linux Standard Base 4.1: 4 | http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/cmdbehav.html 5 | 6 | Downloadable as one big file from: 7 | http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic.html 8 | -------------------------------------------------------------------------------- /tests/files/bc/exponent.txt: -------------------------------------------------------------------------------- 1 | e(0) 2 | e(0.5) 3 | e(1) 4 | e(1.5) 5 | e(1.74) 6 | e(2) 7 | e(3.2345) 8 | e(5.283957) 9 | e(13.23857) 10 | e(100) 11 | e(283.238957) 12 | e(-0.5) 13 | e(-1) 14 | e(-1.5) 15 | e(-1.74) 16 | e(-2) 17 | e(-3.2345) 18 | e(-5.283957) 19 | e(-13.23857) 20 | e(-100) 21 | e(-283.238957) 22 | e(142.749502399) 23 | -------------------------------------------------------------------------------- /tests/files/bc/log.txt: -------------------------------------------------------------------------------- 1 | l(0) 2 | l(0.5) 3 | l(1) 4 | l(1.5) 5 | l(1.74) 6 | l(2) 7 | l(3.2345) 8 | l(5.283957) 9 | l(13.23857) 10 | l(100) 11 | l(283.238957) 12 | l(-0.5) 13 | l(-1) 14 | l(-1.5) 15 | l(-1.74) 16 | l(-2) 17 | l(-3.2345) 18 | l(-5.283957) 19 | l(-13.23857) 20 | l(-100) 21 | l(-283.238957) 22 | l(10430710.3325472917) 23 | -------------------------------------------------------------------------------- /scripts/probes/GLOBALS: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Show bytes used by each command's GLOBALS() block, based on last build 4 | { 5 | echo -e '#include "toys.h"\nint main(void) {' 6 | sed -n 's/^\tstruct \(.*\)_data .*/printf("%d \1\\n", (int)sizeof(struct \1_data));/p' generated/globals.h 7 | echo '}' 8 | } | "${CROSS_COMPILE}"cc -xc - && ./a.out | sort -n 9 | -------------------------------------------------------------------------------- /tests/tsort.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #testing "name" "command" "result" "infile" "stdin" 4 | 5 | testcmd 'simple' '' 'a\nb\nc\nd\n' '' 'a b b c c d\n' 6 | testcmd 'reversed' '' 'a\nb\nc\nd\n' '' 'c d b c a b' 7 | testcmd '2 pass duplicate killing' '' 'c\nf\na\n' '' 'f a c f' 8 | testcmd 'detect cycle' '>/dev/null 2>/dev/null || echo yes' 'yes\n' '' 'a b b a' 9 | -------------------------------------------------------------------------------- /scripts/probes/findglobals: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Quick and dirty check to see if anybody's leaked global variables. 4 | # We should have this, toy_list, toybuf, libbuf, toys, and toybox_version. 5 | 6 | nm --size-sort generated/unstripped/toybox | grep '[0-9A-Fa-f]* [BCDGRS]' | \ 7 | grep -v GLIBC | while read a b c; do printf '%s %d\t%s\n' $b 0x$a $c; done | \ 8 | sort -k2,2n 9 | -------------------------------------------------------------------------------- /toys/other/clear.c: -------------------------------------------------------------------------------- 1 | /* clear.c - clear the screen 2 | * 3 | * Copyright 2012 Rob Landley 4 | 5 | USE_CLEAR(NEWTOY(clear, NULL, TOYFLAG_USR|TOYFLAG_BIN)) 6 | 7 | config CLEAR 8 | bool "clear" 9 | default y 10 | help 11 | Clear the screen. 12 | */ 13 | 14 | #include "toys.h" 15 | 16 | void clear_main(void) 17 | { 18 | printf("\e[2J\e[H"); 19 | } 20 | -------------------------------------------------------------------------------- /tests/files/bc/sqrt_results.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 1.41421356237309504880 3 | 2.00000000000000000000 4 | 3.00000000000000000000 5 | 4.00000000000000000000 6 | 5.00000000000000000000 7 | 11.00000000000000000000 8 | 220.82798735667542192643 9 | 3047516.39985021245496456781 10 | .435056761776252544285578 11 | 111307983.260397019622398608908 12 | .0000000000000035071355833500363 13 | 1.00000000000000000000 14 | -------------------------------------------------------------------------------- /tests/uptime.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | [ -f testing.sh ] && . testing.sh 4 | 5 | #testing "name" "command" "result" "infile" "stdin" 6 | 7 | testing "uptime" "uptime | grep -q 'load average:' && echo t" "t\n" "" "" 8 | testing "uptime -s" \ 9 | "uptime -s | grep -q '^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9]$' && echo t" \ 10 | "t\n" "" "" 11 | -------------------------------------------------------------------------------- /tests/hostname.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | [ -f testing.sh ] && . testing.sh 4 | 5 | #testing "name" "command" "result" "infile" "stdin" 6 | 7 | HOST="$(cat /proc/sys/kernel/hostname 2>/dev/null)" 8 | skipnot [ $? -eq 0 ] 9 | testing "get" "hostname" "$HOST\n" "" "" 10 | 11 | skipnot [ $(id -u) -eq 0 ] 12 | testing "set" 'hostname "2>&1 | tee"; hostname; hostname "$HOST"' "2>&1 | tee\n" "" "" 13 | -------------------------------------------------------------------------------- /tests/netcat.test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | [ -f testing.sh ] && . testing.sh 4 | 5 | #testing "name" "command" "result" "infile" "stdin" 6 | 7 | { dd if=/dev/zero bs=4k count=1 2>/dev/null | tr '\0' a; echo b; } > testfile 8 | testing "more than buffer bytes left at end" \ 9 | "netcat -lp 1234 wc -c & sleep .1 && cat testfile | netcat 127.0.0.1 1234" \ 10 | "4098\n" "" "" 11 | rm -f testfile 12 | -------------------------------------------------------------------------------- /tests/files/bc/script.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | if [ "$#" -lt 4 ]; then 4 | echo "usage: script.sh