├── .config-full ├── .config-minimal ├── .gitignore ├── .indent.pro ├── AUTHORS ├── Android.mk ├── Config.in ├── INSTALL ├── LICENSE ├── Makefile ├── Makefile.custom ├── Makefile.flags ├── Makefile.help ├── README ├── TODO ├── TODO_config_nommu ├── android └── libc │ └── arch-arm │ └── syscalls │ ├── adjtimex.S │ ├── getsid.S │ ├── stime.S │ ├── swapoff.S │ ├── swapon.S │ └── sysinfo.S ├── applets ├── .gitignore ├── Kbuild ├── applet_tables.c ├── applets.c ├── busybox.mkll ├── individual.c ├── install.sh ├── usage.c ├── usage_compressed └── usage_pod.c ├── arch └── i386 │ └── Makefile ├── archival ├── Config.in ├── Kbuild ├── ar.c ├── bbunzip.c ├── bbunzip_test.sh ├── bbunzip_test2.sh ├── bbunzip_test3.sh ├── bz │ ├── LICENSE │ ├── README │ ├── blocksort.c │ ├── bzlib.c │ ├── bzlib.h │ ├── bzlib_private.h │ ├── compress.c │ └── huffman.c ├── bzip2.c ├── cpio.c ├── dpkg.c ├── dpkg_deb.c ├── gzip.c ├── liblzo.h ├── liblzo_interface.h ├── libunarchive │ ├── Kbuild │ ├── data_align.c │ ├── data_extract_all.c │ ├── data_extract_to_stdout.c │ ├── data_skip.c │ ├── decompress_bunzip2.c │ ├── decompress_uncompress.c │ ├── decompress_unlzma.c │ ├── decompress_unzip.c │ ├── filter_accept_all.c │ ├── filter_accept_list.c │ ├── filter_accept_list_reassign.c │ ├── filter_accept_reject_list.c │ ├── find_list_entry.c │ ├── get_header_ar.c │ ├── get_header_cpio.c │ ├── get_header_tar.c │ ├── get_header_tar_bz2.c │ ├── get_header_tar_gz.c │ ├── get_header_tar_lzma.c │ ├── header_list.c │ ├── header_skip.c │ ├── header_verbose_list.c │ ├── init_handle.c │ ├── open_transformer.c │ ├── seek_by_jump.c │ ├── seek_by_read.c │ └── unpack_ar_archive.c ├── lzo1x_1.c ├── lzo1x_1o.c ├── lzo1x_9x.c ├── lzo1x_c.c ├── lzo1x_d.c ├── lzop.c ├── rpm.c ├── rpm2cpio.c ├── tar.c ├── unzip.c └── unzip_doc.txt.bz2 ├── busybox-full.links ├── busybox-full.sources ├── busybox-minimal.links ├── busybox-minimal.sources ├── console-tools ├── Config.in ├── Kbuild ├── chvt.c ├── clear.c ├── deallocvt.c ├── dumpkmap.c ├── kbd_mode.c ├── loadfont.c ├── loadkmap.c ├── openvt.c ├── reset.c ├── resize.c ├── setconsole.c ├── setkeycodes.c ├── setlogcons.c └── showkey.c ├── coreutils ├── Config.in ├── Kbuild ├── basename.c ├── cal.c ├── cat.c ├── catv.c ├── chgrp.c ├── chmod.c ├── chown.c ├── chroot.c ├── cksum.c ├── comm.c ├── cp.c ├── cut.c ├── date.c ├── dd.c ├── df.c ├── dirname.c ├── dos2unix.c ├── du.c ├── echo.c ├── env.c ├── expand.c ├── expr.c ├── false.c ├── fold.c ├── fsync.c ├── head.c ├── hostid.c ├── id.c ├── id_test.sh ├── install.c ├── length.c ├── libcoreutils │ ├── Kbuild │ ├── coreutils.h │ ├── cp_mv_stat.c │ └── getopt_mk_fifo_nod.c ├── ln.c ├── logname.c ├── ls.c ├── md5_sha1_sum.c ├── mkdir.c ├── mkfifo.c ├── mknod.c ├── mv.c ├── nice.c ├── nohup.c ├── od.c ├── od_bloaty.c ├── printenv.c ├── printf.c ├── pwd.c ├── readlink.c ├── realpath.c ├── rm.c ├── rmdir.c ├── seq.c ├── sleep.c ├── sort.c ├── split.c ├── stat.c ├── stty.c ├── sum.c ├── sync.c ├── tac.c ├── tail.c ├── tee.c ├── test.c ├── test_ptr_hack.c ├── touch.c ├── tr.c ├── true.c ├── tty.c ├── uname.c ├── uniq.c ├── usleep.c ├── uudecode.c ├── uuencode.c ├── wc.c ├── who.c ├── whoami.c └── yes.c ├── debianutils ├── Config.in ├── Kbuild ├── mktemp.c ├── pipe_progress.c ├── run_parts.c ├── start_stop_daemon.c └── which.c ├── docs ├── .gitignore ├── Serial-Programming-HOWTO.txt ├── busybox_footer.pod ├── busybox_header.pod ├── cgi │ ├── cl.html │ ├── env.html │ ├── in.html │ ├── interface.html │ └── out.html ├── contributing.txt ├── ctty.htm ├── draft-coar-cgi-v11-03-clean.html ├── ifupdown_design.txt ├── keep_data_small.txt ├── logging_and_backgrounding.txt ├── mdev.txt ├── new-applet-HOWTO.txt ├── nofork_noexec.txt ├── posix_conformance.txt ├── sigint.htm ├── style-guide.txt └── tar_pax.txt ├── e2fsprogs ├── Config.in ├── Kbuild ├── README ├── chattr.c ├── e2fs_defs.h ├── e2fs_lib.c ├── e2fs_lib.h ├── fsck.c ├── lsattr.c └── old_e2fsprogs │ ├── Config.in │ ├── Kbuild │ ├── README │ ├── blkid │ ├── Kbuild │ ├── blkid.h │ ├── blkidP.h │ ├── blkid_getsize.c │ ├── cache.c │ ├── dev.c │ ├── devname.c │ ├── devno.c │ ├── list.c │ ├── list.h │ ├── probe.c │ ├── probe.h │ ├── read.c │ ├── resolve.c │ ├── save.c │ └── tag.c │ ├── chattr.c │ ├── e2fsbb.h │ ├── e2fsck.c │ ├── e2fsck.h │ ├── e2p │ ├── Kbuild │ ├── e2p.h │ ├── feature.c │ ├── fgetsetflags.c │ ├── fgetsetversion.c │ ├── hashstr.c │ ├── iod.c │ ├── ls.c │ ├── mntopts.c │ ├── ostype.c │ ├── parse_num.c │ ├── pe.c │ ├── pf.c │ ├── ps.c │ └── uuid.c │ ├── ext2fs │ ├── Kbuild │ ├── alloc.c │ ├── alloc_sb.c │ ├── alloc_stats.c │ ├── alloc_tables.c │ ├── badblocks.c │ ├── bb_compat.c │ ├── bb_inode.c │ ├── bitmaps.c │ ├── bitops.c │ ├── bitops.h │ ├── block.c │ ├── bmap.c │ ├── bmove.c │ ├── brel.h │ ├── brel_ma.c │ ├── check_desc.c │ ├── closefs.c │ ├── cmp_bitmaps.c │ ├── dblist.c │ ├── dblist_dir.c │ ├── dir_iterate.c │ ├── dirblock.c │ ├── dirhash.c │ ├── dupfs.c │ ├── e2image.h │ ├── expanddir.c │ ├── ext2_err.h │ ├── ext2_ext_attr.h │ ├── ext2_fs.h │ ├── ext2_io.h │ ├── ext2_types.h │ ├── ext2fs.h │ ├── ext2fsP.h │ ├── ext2fs_inline.c │ ├── ext_attr.c │ ├── fileio.c │ ├── finddev.c │ ├── flushb.c │ ├── freefs.c │ ├── gen_bitmap.c │ ├── get_pathname.c │ ├── getsectsize.c │ ├── getsize.c │ ├── icount.c │ ├── imager.c │ ├── ind_block.c │ ├── initialize.c │ ├── inline.c │ ├── inode.c │ ├── inode_io.c │ ├── io_manager.c │ ├── irel.h │ ├── irel_ma.c │ ├── ismounted.c │ ├── jfs_dat.h │ ├── kernel-jbd.h │ ├── kernel-list.h │ ├── link.c │ ├── lookup.c │ ├── mkdir.c │ ├── mkjournal.c │ ├── namei.c │ ├── newdir.c │ ├── openfs.c │ ├── read_bb.c │ ├── read_bb_file.c │ ├── res_gdt.c │ ├── rs_bitmap.c │ ├── rw_bitmaps.c │ ├── sparse.c │ ├── swapfs.c │ ├── test_io.c │ ├── unix_io.c │ ├── unlink.c │ ├── valid_blk.c │ ├── version.c │ └── write_bb_file.c │ ├── fsck.c │ ├── fsck.h │ ├── lsattr.c │ ├── mke2fs.c │ ├── tune2fs.c │ ├── util.c │ ├── util.h │ └── uuid │ ├── Kbuild │ ├── compare.c │ ├── gen_uuid.c │ ├── pack.c │ ├── parse.c │ ├── unpack.c │ ├── unparse.c │ ├── uuid.h │ ├── uuidP.h │ └── uuid_time.c ├── editors ├── Config.in ├── Kbuild ├── awk.c ├── cmp.c ├── diff.c ├── ed.c ├── patch.c ├── patch_toybox.c ├── sed.c ├── sed1line.txt ├── sed_summary.htm └── vi.c ├── examples ├── bootfloppy │ ├── bootfloppy.txt │ ├── display.txt │ ├── etc │ │ ├── fstab │ │ ├── init.d │ │ │ └── rcS │ │ ├── inittab │ │ └── profile │ ├── mkdevs.sh │ ├── mkrootfs.sh │ ├── mksyslinux.sh │ ├── quickstart.txt │ └── syslinux.cfg ├── busybox.spec ├── depmod ├── depmod.pl ├── devfsd.conf ├── dnsd.conf ├── inetd.conf ├── inittab ├── linux-2.6.30_proc_self_exe.patch ├── mdev.conf ├── mdev_fat.conf ├── mk2knr.pl ├── udhcp │ ├── sample.bound │ ├── sample.deconfig │ ├── sample.nak │ ├── sample.renew │ ├── sample.script │ ├── simple.script │ └── udhcpd.conf ├── undeb ├── unrpm ├── var_service │ ├── dhcp_if │ │ ├── convert2ipconf │ │ ├── convert2ntpconf │ │ ├── dhcp_handler │ │ ├── log │ │ │ └── run │ │ ├── p_log │ │ ├── run │ │ └── w_log │ ├── dhcp_if_pinger │ │ └── run │ ├── ftpd │ │ ├── log │ │ │ └── run │ │ ├── p_log │ │ ├── run │ │ └── w_log │ ├── fw │ │ ├── conf │ │ │ ├── 11.22.33.44.ipconf-- │ │ │ ├── 192.168.0.1.ipconf │ │ │ └── lo.ipconf │ │ ├── etc │ │ │ ├── hosts │ │ │ └── resolv.conf │ │ ├── run │ │ └── stat │ ├── getty_tty1 │ │ ├── alt08x16+unimap.fnt │ │ ├── cfg │ │ ├── koi8r_to_uni.trans │ │ ├── login.sh │ │ ├── ru_koi8r.keymap │ │ └── run │ ├── gpm │ │ └── run │ ├── httpd │ │ ├── log │ │ │ └── run │ │ ├── p_log │ │ ├── run │ │ └── w_log │ ├── ifplugd_if │ │ ├── ifplugd_handler │ │ ├── log │ │ │ └── run │ │ ├── p_log │ │ ├── run │ │ └── w_log │ ├── inetd │ │ ├── inetd.conf │ │ ├── log │ │ │ └── run │ │ ├── p_log │ │ ├── run │ │ └── w_log │ ├── nmeter │ │ └── run │ ├── ntpd │ │ ├── log │ │ │ └── run │ │ ├── ntp.script │ │ ├── p_log │ │ ├── run │ │ └── w_log │ └── tftpd │ │ ├── log │ │ └── run │ │ ├── p_log │ │ ├── run │ │ └── w_log └── zcip.script ├── findutils ├── Config.in ├── Kbuild ├── find.c ├── grep.c └── xargs.c ├── include-full ├── applet_tables.h ├── autoconf.h ├── bbconfigopts.h └── usage_compressed.h ├── include-minimal ├── applet_tables.h ├── autoconf.h ├── bbconfigopts.h └── usage_compressed.h ├── include ├── .gitignore ├── android.h ├── applets.h ├── busybox.h ├── dump.h ├── fix_u32.h ├── grp_.h ├── inet_common.h ├── libbb.h ├── platform.h ├── pwd_.h ├── rtc_.h ├── shadow_.h ├── unarchive.h ├── unicode.h ├── usage.h ├── volume_id.h ├── xatonum.h └── xregex.h ├── init ├── Config.in ├── Kbuild ├── halt.c ├── init.c └── mesg.c ├── libbb ├── Config.in ├── Kbuild ├── README ├── android.c ├── appletlib.c ├── ask_confirmation.c ├── bb_askpass.c ├── bb_basename.c ├── bb_do_delay.c ├── bb_pwd.c ├── bb_qsort.c ├── bb_strtod.c ├── bb_strtonum.c ├── change_identity.c ├── chomp.c ├── compare_string_array.c ├── concat_path_file.c ├── concat_subpath_file.c ├── copy_file.c ├── copyfd.c ├── correct_password.c ├── crc32.c ├── create_icmp6_socket.c ├── create_icmp_socket.c ├── default_error_retval.c ├── device_open.c ├── die_if_bad_username.c ├── dump.c ├── error_msg.c ├── error_msg_and_die.c ├── execable.c ├── fclose_nonstdin.c ├── fflush_stdout_and_exit.c ├── fgets_str.c ├── find_mount_point.c ├── find_pid_by_name.c ├── find_root_device.c ├── full_write.c ├── get_console.c ├── get_last_path_component.c ├── get_line_from_file.c ├── getopt32.c ├── getpty.c ├── herror_msg.c ├── herror_msg_and_die.c ├── human_readable.c ├── inet_common.c ├── info_msg.c ├── inode_hash.c ├── isdirectory.c ├── kernel_version.c ├── last_char_is.c ├── lineedit.c ├── lineedit_ptr_hack.c ├── llist.c ├── login.c ├── loop.c ├── make_directory.c ├── makedev.c ├── match_fstype.c ├── md5.c ├── md5prime.c ├── messages.c ├── mode_string.c ├── mtab.c ├── mtab_file.c ├── obscure.c ├── parse_config.c ├── parse_mode.c ├── perror_msg.c ├── perror_msg_and_die.c ├── perror_nomsg.c ├── perror_nomsg_and_die.c ├── pidfile.c ├── platform.c ├── print_flags.c ├── printable.c ├── process_escape_sequence.c ├── procps.c ├── progress.c ├── ptr_to_globals.c ├── pw_encrypt.c ├── pw_encrypt_des.c ├── pw_encrypt_md5.c ├── pw_encrypt_sha.c ├── read.c ├── read_key.c ├── recursive_action.c ├── remove_file.c ├── restricted_shell.c ├── rtc.c ├── run_shell.c ├── safe_gethostname.c ├── safe_poll.c ├── safe_strncpy.c ├── safe_write.c ├── selinux_common.c ├── setup_environment.c ├── sha1.c ├── signals.c ├── simplify_path.c ├── single_argv.c ├── skip_whitespace.c ├── speed_table.c ├── str_tolower.c ├── strrstr.c ├── time.c ├── trim.c ├── u_signal_names.c ├── udp_io.c ├── unicode.c ├── unicode_wcwidth.c ├── update_passwd.c ├── uuencode.c ├── vdprintf.c ├── verror_msg.c ├── vfork_daemon_rexec.c ├── warn_ignoring_args.c ├── wfopen.c ├── wfopen_input.c ├── write.c ├── xatonum.c ├── xatonum_template.c ├── xconnect.c ├── xfunc_die.c ├── xfuncs.c ├── xfuncs_printf.c ├── xgetcwd.c ├── xgethostbyname.c ├── xreadlink.c ├── xrealloc_vector.c └── xregcomp.c ├── libpwdgrp ├── Kbuild ├── pwd_grp.c ├── pwd_grp_internal.c └── uidgid_get.c ├── loginutils ├── Config.in ├── Kbuild ├── addgroup.c ├── adduser.c ├── chpasswd.c ├── cryptpw.c ├── deluser.c ├── getty.c ├── login.c ├── passwd.c ├── su.c ├── sulogin.c └── vlock.c ├── mailutils ├── Config.in ├── Kbuild ├── mail.c ├── mail.h ├── mime.c ├── popmaildir.c └── sendmail.c ├── miscutils ├── Config.in ├── Kbuild ├── adjtimex.c ├── bbconfig.c ├── beep.c ├── chat.c ├── chrt.c ├── crond.c ├── crontab.c ├── dc.c ├── devfsd.c ├── devmem.c ├── eject.c ├── fbsplash.c ├── fbsplash.cfg ├── flash_eraseall.c ├── flash_lock_unlock.c ├── flashcp.c ├── hdparm.c ├── inotifyd.c ├── ionice.c ├── last.c ├── last_fancy.c ├── less.c ├── makedevs.c ├── man.c ├── microcom.c ├── mountpoint.c ├── mt.c ├── raidautorun.c ├── readahead.c ├── runlevel.c ├── rx.c ├── setsid.c ├── strings.c ├── taskset.c ├── time.c ├── timeout.c ├── ttysize.c ├── volname.c ├── wall.c └── watchdog.c ├── modutils ├── Config.in ├── Kbuild ├── depmod.c ├── depmod_process.sh ├── insmod.c ├── lsmod.c ├── modprobe-small.c ├── modprobe.c ├── modutils-24.c ├── modutils.c ├── modutils.h └── rmmod.c ├── networking ├── Config.in ├── Kbuild ├── arp.c ├── arping.c ├── brctl.c ├── dnsd.c ├── ether-wake.c ├── ftpd.c ├── ftpgetput.c ├── hostname.c ├── httpd.c ├── httpd_indexcgi.c ├── httpd_post_upload.txt ├── httpd_ssi.c ├── ifconfig.c ├── ifenslave.c ├── ifplugd.c ├── ifupdown.c ├── inetd.c ├── interface.c ├── ip.c ├── ipcalc.c ├── isrv.c ├── isrv.h ├── isrv_identd.c ├── libiproute │ ├── Kbuild │ ├── ip_common.h │ ├── ip_parse_common_args.c │ ├── ipaddress.c │ ├── iplink.c │ ├── iproute.c │ ├── iprule.c │ ├── iptunnel.c │ ├── libnetlink.c │ ├── libnetlink.h │ ├── ll_addr.c │ ├── ll_map.c │ ├── ll_map.h │ ├── ll_proto.c │ ├── ll_types.c │ ├── rt_names.c │ ├── rt_names.h │ ├── rtm_map.c │ ├── rtm_map.h │ ├── utils.c │ └── utils.h ├── nameif.c ├── nc.c ├── nc_bloaty.c ├── netstat.c ├── nslookup.c ├── ntpd.c ├── ntpd_simple.c ├── ping.c ├── pscan.c ├── route.c ├── slattach.c ├── tc.c ├── tcpudp.c ├── tcpudp_perhost.c ├── tcpudp_perhost.h ├── telnet.c ├── telnetd.c ├── telnetd.ctrlSQ.patch ├── tftp.c ├── traceroute.c ├── tunctl.c ├── udhcp │ ├── Config.in │ ├── Kbuild │ ├── arpping.c │ ├── clientpacket.c │ ├── clientsocket.c │ ├── common.c │ ├── common.h │ ├── dhcpc.c │ ├── dhcpc.h │ ├── dhcpd.c │ ├── dhcpd.h │ ├── dhcprelay.c │ ├── domain_codec.c │ ├── dumpleases.c │ ├── files.c │ ├── leases.c │ ├── options.c │ ├── options.h │ ├── packet.c │ ├── script.c │ ├── serverpacket.c │ ├── signalpipe.c │ ├── socket.c │ └── static_leases.c ├── vconfig.c ├── wget.c └── zcip.c ├── printutils ├── Config.in ├── Kbuild ├── lpd.c └── lpr.c ├── procps ├── Config.in ├── Kbuild ├── free.c ├── fuser.c ├── kill.c ├── nmeter.c ├── pgrep.c ├── pidof.c ├── ps.c ├── ps.posix ├── renice.c ├── sysctl.c ├── top.c ├── uptime.c └── watch.c ├── runit ├── Config.in ├── Kbuild ├── chpst.c ├── runit_lib.c ├── runit_lib.h ├── runsv.c ├── runsvdir.c ├── sv.c └── svlogd.c ├── scripts ├── Kbuild ├── Kbuild.include ├── Makefile.IMA ├── Makefile.build ├── Makefile.clean ├── Makefile.host ├── Makefile.lib ├── basic │ ├── .gitignore │ ├── Makefile │ ├── docproc.c │ ├── fixdep.c │ └── split-include.c ├── bb_release ├── bloat-o-meter ├── checkhelp.awk ├── checkstack.pl ├── cleanup_printf2puts ├── defconfig ├── echo.c ├── find_bad_common_bufsiz ├── find_stray_common_vars ├── fix_ws.sh ├── gcc-version.sh ├── individual ├── kconfig │ ├── .gitignore │ ├── Makefile │ ├── POTFILES.in │ ├── check.sh │ ├── conf.c │ ├── confdata.c │ ├── expr.c │ ├── expr.h │ ├── gconf.c │ ├── gconf.glade │ ├── images.c │ ├── kconfig_load.c │ ├── kxgettext.c │ ├── lex.zconf.c_shipped │ ├── lkc.h │ ├── lkc_proto.h │ ├── lxdialog │ │ ├── .gitignore │ │ ├── BIG.FAT.WARNING │ │ ├── Makefile │ │ ├── check-lxdialog.sh │ │ ├── checklist.c │ │ ├── colors.h │ │ ├── dialog.h │ │ ├── inputbox.c │ │ ├── lxdialog.c │ │ ├── menubox.c │ │ ├── msgbox.c │ │ ├── textbox.c │ │ ├── util.c │ │ └── yesno.c │ ├── mconf.c │ ├── menu.c │ ├── qconf.cc │ ├── qconf.h │ ├── symbol.c │ ├── util.c │ ├── zconf.gperf │ ├── zconf.hash.c_shipped │ ├── zconf.l │ ├── zconf.tab.c_shipped │ └── zconf.y ├── memusage ├── mkconfigs ├── mkdiff_obj ├── mkdiff_obj_bloat ├── mkmakefile ├── objsizes ├── randomtest ├── randomtest.loop ├── sample_pmap ├── showasm ├── trylink └── update_config ├── selinux ├── Config.in ├── Kbuild ├── chcon.c ├── getenforce.c ├── getsebool.c ├── load_policy.c ├── matchpathcon.c ├── runcon.c ├── selinuxenabled.c ├── sestatus.c ├── setenforce.c ├── setfiles.c └── setsebool.c ├── shell ├── Config.in ├── Kbuild ├── README ├── README.job ├── ash.c ├── ash_doc.txt ├── ash_ptr_hack.c ├── ash_test │ ├── ash-alias │ │ ├── alias.right │ │ └── alias.tests │ ├── ash-arith │ │ ├── README.ash │ │ ├── arith-bash1.right │ │ ├── arith-bash1.tests │ │ ├── arith-for.right │ │ ├── arith-for.testsx │ │ ├── arith.right │ │ ├── arith.tests │ │ ├── arith1.sub │ │ └── arith2.sub │ ├── ash-heredoc │ │ ├── heredoc.right │ │ └── heredoc.tests │ ├── ash-invert │ │ ├── invert.right │ │ └── invert.tests │ ├── ash-misc │ │ ├── last_amp.right │ │ ├── last_amp.tests │ │ ├── nulltick1.right │ │ ├── nulltick1.tests │ │ ├── shift1.right │ │ ├── shift1.tests │ │ ├── source1.right │ │ └── source1.tests │ ├── ash-quoting │ │ ├── dollar_squote_bash1.right │ │ └── dollar_squote_bash1.tests │ ├── ash-read │ │ ├── read_REPLY.right │ │ ├── read_REPLY.tests │ │ ├── read_ifs.right │ │ ├── read_ifs.tests │ │ ├── read_n.right │ │ ├── read_n.tests │ │ ├── read_r.right │ │ ├── read_r.tests │ │ ├── read_t.right │ │ └── read_t.tests │ ├── ash-redir │ │ ├── redir.right │ │ ├── redir.tests │ │ ├── redir2.right │ │ ├── redir2.tests │ │ ├── redir3.right │ │ ├── redir3.tests │ │ ├── redir4.right │ │ ├── redir4.tests │ │ ├── redir5.right │ │ ├── redir5.tests │ │ ├── redir6.right │ │ ├── redir6.tests │ │ ├── redir7.right │ │ ├── redir7.tests │ │ ├── redir8.right │ │ └── redir8.tests │ ├── ash-signals │ │ ├── reap1.right │ │ ├── reap1.tests │ │ ├── savetrap.right │ │ ├── savetrap.tests │ │ ├── signal1.right │ │ ├── signal1.tests │ │ ├── signal2.right │ │ ├── signal2.tests │ │ ├── signal3.right │ │ └── signal3.tests │ ├── ash-standalone │ │ ├── noexec_gets_no_env.right │ │ ├── noexec_gets_no_env.tests │ │ ├── nofork_trashes_getopt.right │ │ └── nofork_trashes_getopt.tests │ ├── ash-vars │ │ ├── var1.right │ │ ├── var1.tests │ │ ├── var2.right │ │ ├── var2.tests │ │ ├── var_bash1.right │ │ ├── var_bash1.tests │ │ ├── var_bash2.right │ │ ├── var_bash2.tests │ │ ├── var_bash3.right │ │ ├── var_bash3.tests │ │ ├── var_leak.right │ │ ├── var_leak.tests │ │ ├── var_posix1.right │ │ └── var_posix1.tests │ ├── printenv.c │ ├── recho.c │ ├── run-all │ └── zecho.c ├── bbsh.c ├── brace.txt ├── builtin_read.c ├── builtin_read.h ├── cttyhack.c ├── hush.c ├── hush_doc.txt ├── hush_leaktool.sh ├── hush_test │ ├── .gitignore │ ├── hush-arith │ │ ├── arith.right │ │ ├── arith.tests │ │ ├── arith1.sub │ │ └── arith2.sub │ ├── hush-bugs │ │ ├── and_or_and_backgrounding.right │ │ ├── and_or_and_backgrounding.tests │ │ ├── export_exp.right │ │ └── export_exp.tests │ ├── hush-glob │ │ ├── glob1.right │ │ ├── glob1.tests │ │ ├── glob_and_assign.right │ │ ├── glob_and_assign.tests │ │ ├── glob_redir.right │ │ └── glob_redir.tests │ ├── hush-leak │ │ ├── leak_argv1.right │ │ └── leak_argv1.tests │ ├── hush-misc │ │ ├── and-or.right │ │ ├── and-or.tests │ │ ├── assignment1.right │ │ ├── assignment1.tests │ │ ├── assignment2.rigth │ │ ├── assignment2.tests │ │ ├── break1.right │ │ ├── break1.tests │ │ ├── break2.right │ │ ├── break2.tests │ │ ├── break3.right │ │ ├── break3.tests │ │ ├── break4.right │ │ ├── break4.tests │ │ ├── break5.right │ │ ├── break5.tests │ │ ├── builtin1.right │ │ ├── builtin1.tests │ │ ├── case1.right │ │ ├── case1.tests │ │ ├── colon.right │ │ ├── colon.tests │ │ ├── compound.right │ │ ├── compound.tests │ │ ├── continue1.right │ │ ├── continue1.tests │ │ ├── continue2.right │ │ ├── continue2.tests │ │ ├── continue3.right │ │ ├── continue3.tests │ │ ├── empty_args.right │ │ ├── empty_args.tests │ │ ├── empty_for.right │ │ ├── empty_for.tests │ │ ├── empty_for2.right │ │ ├── empty_for2.tests │ │ ├── env_and_func.right │ │ ├── env_and_func.tests │ │ ├── exec.right │ │ ├── exec.tests │ │ ├── exit1.right │ │ ├── exit1.tests │ │ ├── export-n.right │ │ ├── export-n.tests │ │ ├── export.right │ │ ├── export.tests │ │ ├── for_with_bslashes.right │ │ ├── for_with_bslashes.tests │ │ ├── for_with_keywords.right │ │ ├── for_with_keywords.tests │ │ ├── func1.right │ │ ├── func1.tests │ │ ├── func2.right │ │ ├── func2.tests │ │ ├── func3.right │ │ ├── func3.tests │ │ ├── func4.right │ │ ├── func4.tests │ │ ├── func5.right │ │ ├── func5.tests │ │ ├── func_args1.right │ │ ├── func_args1.tests │ │ ├── func_local1.right │ │ ├── func_local1.tests │ │ ├── func_local2.right │ │ ├── func_local2.tests │ │ ├── heredoc1.right │ │ ├── heredoc1.tests │ │ ├── heredoc2.right │ │ ├── heredoc2.tests │ │ ├── heredoc3.right │ │ ├── heredoc3.tests │ │ ├── heredoc_huge.right │ │ ├── heredoc_huge.tests │ │ ├── if_false_exitcode.right │ │ ├── if_false_exitcode.tests │ │ ├── nommu1.right │ │ ├── nommu1.tests │ │ ├── nommu2.right │ │ ├── nommu2.tests │ │ ├── opts1.right │ │ ├── opts1.tests │ │ ├── pid.right │ │ ├── pid.tests │ │ ├── read.right │ │ ├── read.tests │ │ ├── redir1.right │ │ ├── redir1.tests │ │ ├── redir2.right │ │ ├── redir2.tests │ │ ├── redir3.right │ │ ├── redir3.tests │ │ ├── redir4.right │ │ ├── redir4.tests │ │ ├── redir5.right │ │ ├── redir5.tests │ │ ├── redir6.right │ │ ├── redir6.tests │ │ ├── shift.right │ │ ├── shift.tests │ │ ├── sig_exitcode.right │ │ ├── sig_exitcode.tests │ │ ├── syntax_err.right │ │ ├── syntax_err.tests │ │ ├── syntax_err_negate.right │ │ ├── syntax_err_negate.tests │ │ ├── until1.right │ │ ├── until1.tests │ │ ├── while1.right │ │ ├── while1.tests │ │ ├── while2.right │ │ ├── while2.tests │ │ ├── while_in_subshell.right │ │ └── while_in_subshell.tests │ ├── hush-parsing │ │ ├── argv0.right │ │ ├── argv0.tests │ │ ├── brace1.right │ │ ├── brace1.tests │ │ ├── brace2.right │ │ ├── brace2.tests │ │ ├── escape1.right │ │ ├── escape1.tests │ │ ├── escape2.right │ │ ├── escape2.tests │ │ ├── escape3.right │ │ ├── escape3.tests │ │ ├── escape4.right │ │ ├── escape4.tests │ │ ├── escape5.right │ │ ├── escape5.tests │ │ ├── group1.right │ │ ├── group1.tests │ │ ├── groups_and_keywords1.right │ │ ├── groups_and_keywords1.tests │ │ ├── negate.right │ │ ├── negate.tests │ │ ├── noeol.right │ │ ├── noeol.tests │ │ ├── noeol2.right │ │ ├── noeol2.tests │ │ ├── noeol3.right │ │ ├── noeol3.tests │ │ ├── process_subst.right │ │ ├── process_subst.tests │ │ ├── quote1.right │ │ ├── quote1.tests │ │ ├── quote2.right │ │ ├── quote2.tests │ │ ├── quote3.right │ │ ├── quote3.tests │ │ ├── quote4.right │ │ ├── quote4.tests │ │ ├── redir_space.right │ │ ├── redir_space.tests │ │ ├── starquoted.right │ │ ├── starquoted.tests │ │ ├── starquoted2.right │ │ └── starquoted2.tests │ ├── hush-psubst │ │ ├── emptytick.right │ │ ├── emptytick.tests │ │ ├── tick.right │ │ ├── tick.tests │ │ ├── tick2.right │ │ ├── tick2.tests │ │ ├── tick3.right │ │ ├── tick3.tests │ │ ├── tick4.right │ │ ├── tick4.tests │ │ ├── tick5.right │ │ ├── tick5.tests │ │ ├── tick_huge.right │ │ └── tick_huge.tests │ ├── hush-read │ │ ├── read_REPLY.right │ │ ├── read_REPLY.tests │ │ ├── read_ifs.right │ │ ├── read_ifs.tests │ │ ├── read_n.right │ │ ├── read_n.tests │ │ ├── read_r.right │ │ ├── read_r.tests │ │ ├── read_t.right │ │ └── read_t.tests │ ├── hush-trap │ │ ├── catch.right │ │ ├── catch.tests │ │ ├── exit.right │ │ ├── exit.tests │ │ ├── save-ret.right │ │ ├── save-ret.tests │ │ ├── savetrap.right │ │ ├── savetrap.tests │ │ ├── subshell.right │ │ ├── subshell.tests │ │ ├── usage.right │ │ └── usage.tests │ ├── hush-vars │ │ ├── empty.right │ │ ├── empty.tests │ │ ├── glob_and_vars.right │ │ ├── glob_and_vars.tests │ │ ├── param_expand_alt.right │ │ ├── param_expand_alt.tests │ │ ├── param_expand_assign.right │ │ ├── param_expand_assign.tests │ │ ├── param_expand_default.right │ │ ├── param_expand_default.tests │ │ ├── param_expand_indicate_error.right │ │ ├── param_expand_indicate_error.tests │ │ ├── param_expand_len.right │ │ ├── param_expand_len.tests │ │ ├── param_glob.right │ │ ├── param_glob.tests │ │ ├── param_subshell.right │ │ ├── param_subshell.tests │ │ ├── star.right │ │ ├── star.tests │ │ ├── unset.right │ │ ├── unset.tests │ │ ├── var1.right │ │ ├── var1.tests │ │ ├── var2.right │ │ ├── var2.tests │ │ ├── var3.right │ │ ├── var3.tests │ │ ├── var_expand_in_assign.right │ │ ├── var_expand_in_assign.tests │ │ ├── var_expand_in_redir.right │ │ ├── var_expand_in_redir.tests │ │ ├── var_in_pipes.right │ │ ├── var_in_pipes.tests │ │ ├── var_leaks.right │ │ ├── var_leaks.tests │ │ ├── var_posix1.right │ │ ├── var_posix1.tests │ │ ├── var_preserved.right │ │ ├── var_preserved.tests │ │ ├── var_subst_in_for.right │ │ └── var_subst_in_for.tests │ ├── hush-z_slow │ │ ├── leak_all1.right │ │ ├── leak_all1.tests │ │ ├── leak_all2.right │ │ ├── leak_all2.tests │ │ ├── leak_empty_tick.right │ │ ├── leak_empty_tick.tests │ │ ├── leak_heredoc1.right │ │ ├── leak_heredoc1.tests │ │ ├── leak_var.right │ │ ├── leak_var.tests │ │ ├── leak_var2.right │ │ ├── leak_var2.tests │ │ ├── leak_var3.right │ │ └── leak_var3.tests │ └── run-all ├── lash_unused.c ├── match.c ├── match.h ├── math.c ├── math.h ├── msh_test │ ├── msh-bugs │ │ ├── noeol3.right │ │ ├── noeol3.tests │ │ ├── process_subst.right │ │ ├── process_subst.tests │ │ ├── read.right │ │ ├── read.tests │ │ ├── shift.right │ │ ├── shift.tests │ │ ├── starquoted.right │ │ ├── starquoted.tests │ │ ├── syntax_err.right │ │ ├── syntax_err.tests │ │ ├── var_expand_in_assign.right │ │ ├── var_expand_in_assign.tests │ │ ├── var_expand_in_redir.right │ │ └── var_expand_in_redir.tests │ ├── msh-execution │ │ ├── exitcode_EACCES.right │ │ ├── exitcode_EACCES.tests │ │ ├── exitcode_ENOENT.right │ │ ├── exitcode_ENOENT.tests │ │ ├── many_continues.right │ │ ├── many_continues.tests │ │ ├── nested_break.right │ │ └── nested_break.tests │ ├── msh-misc │ │ ├── tick.right │ │ └── tick.tests │ ├── msh-parsing │ │ ├── argv0.right │ │ ├── argv0.tests │ │ ├── noeol.right │ │ ├── noeol.tests │ │ ├── noeol2.right │ │ ├── noeol2.tests │ │ ├── quote1.right │ │ ├── quote1.tests │ │ ├── quote2.right │ │ ├── quote2.tests │ │ ├── quote3.right │ │ ├── quote3.tests │ │ ├── quote4.right │ │ └── quote4.tests │ ├── msh-vars │ │ ├── star.right │ │ ├── star.tests │ │ ├── var.right │ │ ├── var.tests │ │ ├── var_subst_in_for.right │ │ └── var_subst_in_for.tests │ └── run-all ├── msh_unused.c ├── random.c ├── random.h ├── shell_common.c └── shell_common.h ├── sysklogd ├── Config.in ├── Kbuild ├── klogd.c ├── logger.c ├── logread.c ├── syslogd.c └── syslogd_and_logger.c ├── testsuite ├── README ├── TODO ├── all_sourcecode.tests ├── awk.tests ├── awk_t1.tar.bz2 ├── basename │ ├── basename-does-not-remove-identical-extension │ └── basename-works ├── bunzip2.tests ├── bunzip2 │ ├── bunzip2-reads-from-standard-input │ ├── bunzip2-removes-compressed-file │ └── bzcat-does-not-remove-compressed-file ├── busybox.tests ├── bzcat.tests ├── cat │ ├── cat-prints-a-file │ └── cat-prints-a-file-and-standard-input ├── cmp │ └── cmp-detects-difference ├── comm.tests ├── cp.tests ├── cp │ ├── cp-RHL-does_not_preserve-links │ ├── cp-a-files-to-dir │ ├── cp-a-preserves-links │ ├── cp-copies-empty-file │ ├── cp-copies-large-file │ ├── cp-copies-small-file │ ├── cp-d-files-to-dir │ ├── cp-dev-file │ ├── cp-dir-create-dir │ ├── cp-dir-existing-dir │ ├── cp-does-not-copy-unreadable-file │ ├── cp-files-to-dir │ ├── cp-follows-links │ ├── cp-parents │ ├── cp-preserves-hard-links │ ├── cp-preserves-links │ └── cp-preserves-source-file ├── cpio.tests ├── cut.tests ├── cut │ ├── cut-cuts-a-character │ ├── cut-cuts-a-closed-range │ ├── cut-cuts-a-field │ ├── cut-cuts-an-open-range │ └── cut-cuts-an-unclosed-range ├── date │ ├── date-R-works │ ├── date-format-works │ ├── date-u-works │ ├── date-works │ └── date-works-1 ├── dd │ ├── dd-accepts-if │ ├── dd-accepts-of │ ├── dd-copies-from-standard-input-to-standard-output │ ├── dd-prints-count-to-standard-error │ └── dd-reports-write-errors ├── diff.tests ├── dirname │ ├── dirname-handles-absolute-path │ ├── dirname-handles-empty-path │ ├── dirname-handles-multiple-slashes │ ├── dirname-handles-relative-path │ ├── dirname-handles-root │ ├── dirname-handles-single-component │ └── dirname-works ├── du │ ├── du-h-works │ ├── du-k-works │ ├── du-l-works │ ├── du-m-works │ ├── du-s-works │ └── du-works ├── echo │ ├── echo-does-not-print-newline │ ├── echo-prints-argument │ ├── echo-prints-arguments │ ├── echo-prints-newline │ └── echo-prints-slash-zero ├── expand.tests ├── expand │ └── expand-works-like-GNU ├── expr │ ├── expr-big │ └── expr-works ├── false │ ├── false-is-silent │ └── false-returns-failure ├── find │ └── find-supports-minus-xdev ├── fold.tests ├── grep.tests ├── gunzip.tests ├── gunzip │ └── gunzip-reads-from-standard-input ├── gzip │ ├── gzip-accepts-multiple-files │ ├── gzip-accepts-single-minus │ └── gzip-removes-original-file ├── head │ ├── head-n-works │ └── head-works ├── hostid │ └── hostid-works ├── hostname │ ├── hostname-d-works │ ├── hostname-i-works │ ├── hostname-s-works │ └── hostname-works ├── id │ ├── id-g-works │ ├── id-u-works │ ├── id-un-works │ └── id-ur-works ├── ln │ ├── ln-creates-hard-links │ ├── ln-creates-soft-links │ ├── ln-force-creates-hard-links │ ├── ln-force-creates-soft-links │ ├── ln-preserves-hard-links │ └── ln-preserves-soft-links ├── ls │ ├── ls-1-works │ ├── ls-h-works │ ├── ls-l-works │ └── ls-s-works ├── makedevs.device_table.txt ├── makedevs.tests ├── md5sum │ └── md5sum-verifies-non-binary-file ├── mdev.tests ├── mkdir │ ├── mkdir-makes-a-directory │ └── mkdir-makes-parent-directories ├── mkfs.minix.tests ├── mount.testroot ├── mount.tests ├── msh │ └── msh-supports-underscores-in-variable-names ├── mv │ ├── mv-files-to-dir │ ├── mv-follows-links │ ├── mv-moves-empty-file │ ├── mv-moves-file │ ├── mv-moves-hardlinks │ ├── mv-moves-large-file │ ├── mv-moves-small-file │ ├── mv-moves-symlinks │ ├── mv-moves-unreadable-files │ ├── mv-preserves-hard-links │ ├── mv-preserves-links │ ├── mv-refuses-mv-dir-to-subdir │ └── mv-removes-source-file ├── od.tests ├── parse.tests ├── patch.tests ├── pidof.tests ├── printf.tests ├── pwd │ └── pwd-prints-working-directory ├── readlink.tests ├── rm │ └── rm-removes-file ├── rmdir │ └── rmdir-removes-parent-directories ├── runtest ├── rx.tests ├── sed.tests ├── seq.tests ├── sort.tests ├── start-stop-daemon.tests ├── strings │ └── strings-works-like-GNU ├── sum.tests ├── tail.tests ├── tail │ ├── tail-n-works │ └── tail-works ├── tar.tests ├── tar │ ├── tar-archives-multiple-files │ ├── tar-complains-about-missing-file │ ├── tar-demands-at-least-one-ctx │ ├── tar-demands-at-most-one-ctx │ ├── tar-extracts-all-subdirs │ ├── tar-extracts-file │ ├── tar-extracts-from-standard-input │ ├── tar-extracts-multiple-files │ ├── tar-extracts-to-standard-output │ ├── tar-handles-cz-options │ ├── tar-handles-empty-include-and-non-empty-exclude-list │ ├── tar-handles-exclude-and-extract-lists │ ├── tar-handles-multiple-X-options │ ├── tar-handles-nested-exclude │ ├── tar_with_link_with_size │ └── tar_with_prefix_fields ├── taskset.tests ├── tee │ ├── tee-appends-input │ └── tee-tees-input ├── test.tests ├── testing.sh ├── touch │ ├── touch-creates-file │ ├── touch-does-not-create-file │ └── touch-touches-files-after-non-existent-file ├── tr.tests ├── tr │ ├── tr-d-alnum-works │ ├── tr-d-works │ ├── tr-non-gnu │ ├── tr-rejects-wrong-class │ └── tr-works ├── true │ ├── true-is-silent │ └── true-returns-success ├── umlwrapper.sh ├── unexpand.tests ├── unexpand │ └── unexpand-works-like-GNU ├── uniq.tests ├── unzip.tests ├── uptime │ └── uptime-works ├── uuencode.tests ├── wc │ ├── wc-counts-all │ ├── wc-counts-characters │ ├── wc-counts-lines │ ├── wc-counts-words │ └── wc-prints-longest-line-length ├── wget │ ├── wget--O-overrides--P │ ├── wget-handles-empty-path │ ├── wget-retrieves-google-index │ └── wget-supports--P ├── which │ └── which-uses-default-path ├── xargs.tests └── xargs │ └── xargs-works └── util-linux ├── Config.in ├── Kbuild ├── acpid.c ├── blkid.c ├── dmesg.c ├── fbset.c ├── fdformat.c ├── fdisk.c ├── fdisk_aix.c ├── fdisk_osf.c ├── fdisk_sgi.c ├── fdisk_sun.c ├── findfs.c ├── freeramdisk.c ├── fsck_minix.c ├── getopt.c ├── hexdump.c ├── hwclock.c ├── ipcrm.c ├── ipcs.c ├── losetup.c ├── lspci.c ├── lsusb.c ├── mdev.c ├── minix.h ├── mkfs_ext2.c ├── mkfs_ext2.txt ├── mkfs_ext2_test.sh ├── mkfs_minix.c ├── mkfs_reiser.c ├── mkfs_vfat.c ├── mkswap.c ├── more.c ├── mount.c ├── pivot_root.c ├── rdate.c ├── rdev.c ├── readprofile.c ├── rtcwake.c ├── script.c ├── scriptreplay.c ├── setarch.c ├── swaponoff.c ├── switch_root.c ├── tune2fs.c ├── umount.c └── volume_id ├── Kbuild ├── btrfs.c ├── cramfs.c ├── ext.c ├── fat.c ├── get_devname.c ├── hfs.c ├── iso9660.c ├── jfs.c ├── linux_raid.c ├── linux_swap.c ├── luks.c ├── ntfs.c ├── ocfs2.c ├── reiserfs.c ├── romfs.c ├── sysv.c ├── udf.c ├── unused_highpoint.c ├── unused_hpfs.c ├── unused_isw_raid.c ├── unused_lsi_raid.c ├── unused_lvm.c ├── unused_mac.c ├── unused_minix.c ├── unused_msdos.c ├── unused_nvidia_raid.c ├── unused_promise_raid.c ├── unused_silicon_raid.c ├── unused_ufs.c ├── unused_via_raid.c ├── util.c ├── volume_id.c ├── volume_id_internal.h └── xfs.c /.gitignore: -------------------------------------------------------------------------------- 1 | # 2 | # Kbuild ignores 3 | # 4 | .* 5 | *.o 6 | *.o.* 7 | *.a 8 | *.s 9 | 10 | # 11 | # Never ignore these 12 | # 13 | !.gitignore 14 | !.config* 15 | 16 | # 17 | # Normal output 18 | # 19 | /busybox 20 | /busybox_unstripped* 21 | 22 | # 23 | # Backups / patches 24 | # 25 | *~ 26 | *.orig 27 | *.rej 28 | /*.patch 29 | /.config.old 30 | 31 | # 32 | # debugging stuff 33 | # 34 | core 35 | .gdb_history 36 | .gdbinit 37 | -------------------------------------------------------------------------------- /android/libc/arch-arm/syscalls/adjtimex.S: -------------------------------------------------------------------------------- 1 | /* autogenerated by gensyscalls.py */ 2 | #include 3 | 4 | .text 5 | .type adjtimex, #function 6 | .globl adjtimex 7 | .align 4 8 | .fnstart 9 | 10 | adjtimex: 11 | .save {r4, r7} 12 | stmfd sp!, {r4, r7} 13 | ldr r7, =__NR_adjtimex 14 | swi #0 15 | ldmfd sp!, {r4, r7} 16 | movs r0, r0 17 | bxpl lr 18 | b __set_syscall_errno 19 | .fnend 20 | -------------------------------------------------------------------------------- /android/libc/arch-arm/syscalls/getsid.S: -------------------------------------------------------------------------------- 1 | /* autogenerated by gensyscalls.py */ 2 | #include 3 | 4 | .text 5 | .type getsid, #function 6 | .globl getsid 7 | .align 4 8 | .fnstart 9 | 10 | getsid: 11 | .save {r4, r7} 12 | stmfd sp!, {r4, r7} 13 | ldr r7, =__NR_getsid 14 | swi #0 15 | ldmfd sp!, {r4, r7} 16 | movs r0, r0 17 | bxpl lr 18 | b __set_syscall_errno 19 | .fnend 20 | -------------------------------------------------------------------------------- /android/libc/arch-arm/syscalls/stime.S: -------------------------------------------------------------------------------- 1 | /* autogenerated by gensyscalls.py */ 2 | #define __KERNEL__ 3 | #include 4 | 5 | .text 6 | .type stime, #function 7 | .globl stime 8 | .align 4 9 | .fnstart 10 | 11 | stime: 12 | .save {r4, r7} 13 | stmfd sp!, {r4, r7} 14 | ldr r7, =__NR_stime 15 | swi #0 16 | ldmfd sp!, {r4, r7} 17 | movs r0, r0 18 | bxpl lr 19 | b __set_syscall_errno 20 | .fnend 21 | -------------------------------------------------------------------------------- /android/libc/arch-arm/syscalls/swapoff.S: -------------------------------------------------------------------------------- 1 | /* autogenerated by gensyscalls.py */ 2 | #include 3 | 4 | .text 5 | .type swapoff, #function 6 | .globl swapoff 7 | .align 4 8 | .fnstart 9 | 10 | swapoff: 11 | .save {r4, r7} 12 | stmfd sp!, {r4, r7} 13 | ldr r7, =__NR_swapoff 14 | swi #0 15 | ldmfd sp!, {r4, r7} 16 | movs r0, r0 17 | bxpl lr 18 | b __set_syscall_errno 19 | .fnend 20 | -------------------------------------------------------------------------------- /android/libc/arch-arm/syscalls/swapon.S: -------------------------------------------------------------------------------- 1 | /* autogenerated by gensyscalls.py */ 2 | #include 3 | 4 | .text 5 | .type swapon, #function 6 | .globl swapon 7 | .align 4 8 | .fnstart 9 | 10 | swapon: 11 | .save {r4, r7} 12 | stmfd sp!, {r4, r7} 13 | ldr r7, =__NR_swapon 14 | swi #0 15 | ldmfd sp!, {r4, r7} 16 | movs r0, r0 17 | bxpl lr 18 | b __set_syscall_errno 19 | .fnend 20 | -------------------------------------------------------------------------------- /android/libc/arch-arm/syscalls/sysinfo.S: -------------------------------------------------------------------------------- 1 | /* autogenerated by gensyscalls.py */ 2 | #include 3 | 4 | .text 5 | .type sysinfo, #function 6 | .globl sysinfo 7 | .align 4 8 | .fnstart 9 | 10 | sysinfo: 11 | .save {r4, r7} 12 | stmfd sp!, {r4, r7} 13 | ldr r7, =__NR_sysinfo 14 | swi #0 15 | ldmfd sp!, {r4, r7} 16 | movs r0, r0 17 | bxpl lr 18 | b __set_syscall_errno 19 | .fnend 20 | -------------------------------------------------------------------------------- /applets/.gitignore: -------------------------------------------------------------------------------- 1 | /applet_tables 2 | /usage 3 | -------------------------------------------------------------------------------- /applets/applets.c: -------------------------------------------------------------------------------- 1 | /* vi: set sw=4 ts=4: */ 2 | /* 3 | * Stub for linking busybox binary against libbusybox. 4 | * 5 | * Copyright (C) 2007 Denys Vlasenko 6 | * 7 | * Licensed under GPLv2, see file License in this tarball for details. 8 | */ 9 | 10 | #include 11 | #include "busybox.h" 12 | 13 | #if ENABLE_BUILD_LIBBUSYBOX 14 | int main(int argc UNUSED_PARAM, char **argv) 15 | { 16 | return lbb_main(argv); 17 | } 18 | #endif 19 | -------------------------------------------------------------------------------- /applets/individual.c: -------------------------------------------------------------------------------- 1 | /* Minimal wrapper to build an individual busybox applet. 2 | * 3 | * Copyright 2005 Rob Landley 11 | #include 12 | #include "usage.h" 13 | 14 | int main(int argc, char **argv) 15 | { 16 | applet_name = argv[0]; 17 | return APPLET_main(argc,argv); 18 | } 19 | 20 | void bb_show_usage(void) 21 | { 22 | fputs(APPLET_full_usage "\n", stdout); 23 | exit(EXIT_FAILURE); 24 | } 25 | -------------------------------------------------------------------------------- /arch/i386/Makefile: -------------------------------------------------------------------------------- 1 | # ========================================================================== 2 | # Build system 3 | # ========================================================================== 4 | 5 | # -mpreferred-stack-boundary=2 is essential in preventing gcc 4.2.x 6 | # from aligning stack to 16 bytes. (Which is gcc's way of supporting SSE). 7 | CFLAGS += $(call cc-option,-march=i386 -mpreferred-stack-boundary=2,) 8 | -------------------------------------------------------------------------------- /archival/bbunzip_test2.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Leak test for gunzip. Watch top for growing process size. 3 | 4 | # Just using urandom will make gzip use method 0 (store) - 5 | # not good for test coverage! 6 | 7 | cat /dev/urandom \ 8 | | while true; do read junk; echo "junk $RANDOM $junk"; done \ 9 | | ../busybox gzip \ 10 | | ../busybox gunzip -c >/dev/null 11 | -------------------------------------------------------------------------------- /archival/libunarchive/data_align.c: -------------------------------------------------------------------------------- 1 | /* vi: set sw=4 ts=4: */ 2 | /* 3 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 4 | */ 5 | 6 | #include "libbb.h" 7 | #include "unarchive.h" 8 | 9 | void FAST_FUNC data_align(archive_handle_t *archive_handle, unsigned boundary) 10 | { 11 | unsigned skip_amount = (boundary - (archive_handle->offset % boundary)) % boundary; 12 | 13 | archive_handle->seek(archive_handle->src_fd, skip_amount); 14 | archive_handle->offset += skip_amount; 15 | } 16 | -------------------------------------------------------------------------------- /archival/libunarchive/data_extract_to_stdout.c: -------------------------------------------------------------------------------- 1 | /* vi: set sw=4 ts=4: */ 2 | /* 3 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 4 | */ 5 | 6 | #include "libbb.h" 7 | #include "unarchive.h" 8 | 9 | void FAST_FUNC data_extract_to_stdout(archive_handle_t *archive_handle) 10 | { 11 | bb_copyfd_exact_size(archive_handle->src_fd, 12 | STDOUT_FILENO, 13 | archive_handle->file_header->size); 14 | } 15 | -------------------------------------------------------------------------------- /archival/libunarchive/data_skip.c: -------------------------------------------------------------------------------- 1 | /* vi: set sw=4 ts=4: */ 2 | /* 3 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 4 | */ 5 | 6 | #include "libbb.h" 7 | #include "unarchive.h" 8 | 9 | void FAST_FUNC data_skip(archive_handle_t *archive_handle) 10 | { 11 | archive_handle->seek(archive_handle->src_fd, archive_handle->file_header->size); 12 | } 13 | -------------------------------------------------------------------------------- /archival/libunarchive/filter_accept_all.c: -------------------------------------------------------------------------------- 1 | /* vi: set sw=4 ts=4: */ 2 | /* 3 | * Copyright (C) 2002 by Glenn McGrath 4 | * 5 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 6 | */ 7 | 8 | #include "libbb.h" 9 | #include "unarchive.h" 10 | 11 | /* Accept any non-null name, its not really a filter at all */ 12 | char FAST_FUNC filter_accept_all(archive_handle_t *archive_handle) 13 | { 14 | if (archive_handle->file_header->name) 15 | return EXIT_SUCCESS; 16 | return EXIT_FAILURE; 17 | } 18 | -------------------------------------------------------------------------------- /archival/libunarchive/filter_accept_list.c: -------------------------------------------------------------------------------- 1 | /* vi: set sw=4 ts=4: */ 2 | /* 3 | * Copyright (C) 2002 by Glenn McGrath 4 | * 5 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 6 | */ 7 | 8 | #include "libbb.h" 9 | #include "unarchive.h" 10 | 11 | /* 12 | * Accept names that are in the accept list, ignoring reject list. 13 | */ 14 | char FAST_FUNC filter_accept_list(archive_handle_t *archive_handle) 15 | { 16 | if (find_list_entry(archive_handle->accept, archive_handle->file_header->name)) 17 | return EXIT_SUCCESS; 18 | return EXIT_FAILURE; 19 | } 20 | -------------------------------------------------------------------------------- /archival/libunarchive/header_list.c: -------------------------------------------------------------------------------- 1 | /* vi: set sw=4 ts=4: */ 2 | /* 3 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 4 | */ 5 | #include "libbb.h" 6 | #include "unarchive.h" 7 | 8 | void FAST_FUNC header_list(const file_header_t *file_header) 9 | { 10 | //TODO: cpio -vp DIR should output "DIR/NAME", not just "NAME" */ 11 | puts(file_header->name); 12 | } 13 | -------------------------------------------------------------------------------- /archival/libunarchive/header_skip.c: -------------------------------------------------------------------------------- 1 | /* vi: set sw=4 ts=4: */ 2 | /* 3 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 4 | */ 5 | #include "libbb.h" 6 | #include "unarchive.h" 7 | 8 | void FAST_FUNC header_skip(const file_header_t *file_header UNUSED_PARAM) 9 | { 10 | } 11 | -------------------------------------------------------------------------------- /archival/libunarchive/seek_by_jump.c: -------------------------------------------------------------------------------- 1 | /* vi: set sw=4 ts=4: */ 2 | /* 3 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 4 | */ 5 | 6 | #include "libbb.h" 7 | #include "unarchive.h" 8 | 9 | void FAST_FUNC seek_by_jump(int fd, off_t amount) 10 | { 11 | if (amount 12 | && lseek(fd, amount, SEEK_CUR) == (off_t) -1 13 | ) { 14 | if (errno == ESPIPE) 15 | seek_by_read(fd, amount); 16 | else 17 | bb_perror_msg_and_die("seek failure"); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /archival/libunarchive/seek_by_read.c: -------------------------------------------------------------------------------- 1 | /* vi: set sw=4 ts=4: */ 2 | /* 3 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 4 | */ 5 | 6 | #include "libbb.h" 7 | #include "unarchive.h" 8 | 9 | /* If we are reading through a pipe, or from stdin then we can't lseek, 10 | * we must read and discard the data to skip over it. 11 | */ 12 | void FAST_FUNC seek_by_read(int fd, off_t amount) 13 | { 14 | if (amount) 15 | bb_copyfd_exact_size(fd, -1, amount); 16 | } 17 | -------------------------------------------------------------------------------- /archival/libunarchive/unpack_ar_archive.c: -------------------------------------------------------------------------------- 1 | /* vi: set sw=4 ts=4: */ 2 | /* 3 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 4 | */ 5 | 6 | #include "libbb.h" 7 | #include "unarchive.h" 8 | 9 | void FAST_FUNC unpack_ar_archive(archive_handle_t *ar_archive) 10 | { 11 | char magic[7]; 12 | 13 | xread(ar_archive->src_fd, magic, 7); 14 | if (strncmp(magic, "!", 7) != 0) { 15 | bb_error_msg_and_die("invalid ar magic"); 16 | } 17 | ar_archive->offset += 7; 18 | 19 | while (get_header_ar(ar_archive) == EXIT_SUCCESS) 20 | continue; 21 | } 22 | -------------------------------------------------------------------------------- /archival/unzip_doc.txt.bz2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylex/android_external_busybox/e5493a5af57c1ffb0d933faab0700db1c0e5b82f/archival/unzip_doc.txt.bz2 -------------------------------------------------------------------------------- /console-tools/chvt.c: -------------------------------------------------------------------------------- 1 | /* vi: set sw=4 ts=4: */ 2 | /* 3 | * Mini chvt implementation for busybox 4 | * 5 | * Copyright (C) 1999-2004 by Erik Andersen 6 | * 7 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 8 | */ 9 | #include "libbb.h" 10 | 11 | int chvt_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 12 | int chvt_main(int argc UNUSED_PARAM, char **argv) 13 | { 14 | int num = xatou_range(single_argv(argv), 1, 63); 15 | console_make_active(get_console_fd_or_die(), num); 16 | return EXIT_SUCCESS; 17 | } 18 | -------------------------------------------------------------------------------- /console-tools/clear.c: -------------------------------------------------------------------------------- 1 | /* vi: set sw=4 ts=4: */ 2 | /* 3 | * Mini clear implementation for busybox 4 | * 5 | * Copyright (C) 1999-2004 by Erik Andersen 6 | * 7 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 8 | * 9 | */ 10 | 11 | /* no options, no getopt */ 12 | 13 | #include "libbb.h" 14 | 15 | int clear_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 16 | int clear_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) 17 | { 18 | return printf("\033[H\033[J") != 6; 19 | } 20 | -------------------------------------------------------------------------------- /coreutils/length.c: -------------------------------------------------------------------------------- 1 | /* vi: set sw=4 ts=4: */ 2 | /* 3 | * Licensed under GPLv2, see file LICENSE in this tarball for details. 4 | */ 5 | 6 | /* BB_AUDIT SUSv3 N/A -- Apparently a busybox (obsolete?) extension. */ 7 | 8 | #include "libbb.h" 9 | 10 | /* This is a NOFORK applet. Be very careful! */ 11 | 12 | int length_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 13 | int length_main(int argc, char **argv) 14 | { 15 | if ((argc != 2) || (**(++argv) == '-')) { 16 | bb_show_usage(); 17 | } 18 | 19 | printf("%u\n", (unsigned)strlen(*argv)); 20 | 21 | return fflush_all(); 22 | } 23 | -------------------------------------------------------------------------------- /coreutils/libcoreutils/Kbuild: -------------------------------------------------------------------------------- 1 | # Makefile for busybox 2 | # 3 | # Copyright (C) 1999-2004 by Erik Andersen 4 | # 5 | # Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 6 | 7 | lib-y:= 8 | lib-$(CONFIG_MKFIFO) += getopt_mk_fifo_nod.o 9 | lib-$(CONFIG_MKNOD) += getopt_mk_fifo_nod.o 10 | lib-$(CONFIG_INSTALL) += cp_mv_stat.o 11 | lib-$(CONFIG_CP) += cp_mv_stat.o 12 | lib-$(CONFIG_MV) += cp_mv_stat.o 13 | -------------------------------------------------------------------------------- /coreutils/libcoreutils/coreutils.h: -------------------------------------------------------------------------------- 1 | /* vi: set sw=4 ts=4: */ 2 | /* 3 | * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 4 | */ 5 | 6 | #ifndef COREUTILS_H 7 | #define COREUTILS_H 1 8 | 9 | PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN 10 | 11 | typedef int (*stat_func)(const char *fn, struct stat *ps); 12 | 13 | int cp_mv_stat2(const char *fn, struct stat *fn_stat, stat_func sf) FAST_FUNC; 14 | int cp_mv_stat(const char *fn, struct stat *fn_stat) FAST_FUNC; 15 | 16 | mode_t getopt_mk_fifo_nod(char **argv) FAST_FUNC; 17 | 18 | POP_SAVED_FUNCTION_VISIBILITY 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /debianutils/Kbuild: -------------------------------------------------------------------------------- 1 | # Makefile for busybox 2 | # 3 | # Copyright (C) 1999-2005 by Erik Andersen 4 | # 5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. 6 | 7 | lib-y:= 8 | lib-$(CONFIG_MKTEMP) += mktemp.o 9 | lib-$(CONFIG_PIPE_PROGRESS) += pipe_progress.o 10 | lib-$(CONFIG_RUN_PARTS) += run_parts.o 11 | lib-$(CONFIG_START_STOP_DAEMON) += start_stop_daemon.o 12 | lib-$(CONFIG_WHICH) += which.o 13 | -------------------------------------------------------------------------------- /docs/.gitignore: -------------------------------------------------------------------------------- 1 | /BusyBox.1 2 | /BusyBox.html 3 | /BusyBox.txt 4 | /busybox.pod 5 | -------------------------------------------------------------------------------- /e2fsprogs/Kbuild: -------------------------------------------------------------------------------- 1 | # Makefile for busybox 2 | # 3 | # Copyright (C) 1999-2005 by Erik Andersen 4 | # 5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. 6 | 7 | lib-y:= 8 | 9 | lib-$(CONFIG_CHATTR) += chattr.o e2fs_lib.o 10 | lib-$(CONFIG_LSATTR) += lsattr.o e2fs_lib.o 11 | 12 | lib-$(CONFIG_FSCK) += fsck.o 13 | -------------------------------------------------------------------------------- /e2fsprogs/README: -------------------------------------------------------------------------------- 1 | Authors and contributors of original e2fsprogs: 2 | 3 | Remy Card 4 | Theodore Ts'o 5 | Stephen C. Tweedie 6 | Andreas Gruenbacher, 7 | Kaz Kylheku 8 | F.W. ten Wolde 9 | Jeremy Fitzhardinge 10 | M.J.E. Mol 11 | Miquel van Smoorenburg 12 | Uwe Ohse 13 | -------------------------------------------------------------------------------- /e2fsprogs/old_e2fsprogs/Kbuild: -------------------------------------------------------------------------------- 1 | # Makefile for busybox 2 | # 3 | # Copyright (C) 1999-2005 by Erik Andersen 4 | # 5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. 6 | 7 | lib-y:= 8 | 9 | lib-$(CONFIG_CHATTR) += chattr.o 10 | lib-$(CONFIG_E2FSCK) += e2fsck.o util.o 11 | lib-$(CONFIG_FSCK) += fsck.o util.o 12 | lib-$(CONFIG_LSATTR) += lsattr.o 13 | lib-$(CONFIG_MKE2FS) += mke2fs.o util.o 14 | lib-$(CONFIG_TUNE2FS) += tune2fs.o util.o 15 | 16 | CFLAGS += -include $(srctree)/e2fsprogs/e2fsbb.h 17 | -------------------------------------------------------------------------------- /e2fsprogs/old_e2fsprogs/README: -------------------------------------------------------------------------------- 1 | This is a pretty straight rip from the e2fsprogs pkg. 2 | 3 | See README's in subdirs for specific info. 4 | -------------------------------------------------------------------------------- /e2fsprogs/old_e2fsprogs/e2p/Kbuild: -------------------------------------------------------------------------------- 1 | # Makefile for busybox 2 | # 3 | # Copyright (C) 1999-2005 by Erik Andersen 4 | # 5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. 6 | 7 | NEEDED-$(CONFIG_CHATTR) = y 8 | NEEDED-$(CONFIG_LSATTR) = y 9 | NEEDED-$(CONFIG_MKE2FS) = y 10 | NEEDED-$(CONFIG_TUNE2FS) = y 11 | 12 | lib-y:= 13 | lib-$(NEEDED-y) += fgetsetflags.o fgetsetversion.o pf.o iod.o mntopts.o \ 14 | feature.o ls.o uuid.o pe.o ostype.o ps.o hashstr.o \ 15 | parse_num.o 16 | -------------------------------------------------------------------------------- /e2fsprogs/old_e2fsprogs/ext2fs/ext2_types.h: -------------------------------------------------------------------------------- 1 | /* vi: set sw=4 ts=4: */ 2 | #include 3 | -------------------------------------------------------------------------------- /e2fsprogs/old_e2fsprogs/fsck.h: -------------------------------------------------------------------------------- 1 | /* vi: set sw=4 ts=4: */ 2 | /* 3 | * fsck.h 4 | */ 5 | 6 | #define FSCK_ATTR(x) __attribute__(x) 7 | 8 | #define EXIT_OK 0 9 | #define EXIT_NONDESTRUCT 1 10 | #define EXIT_DESTRUCT 2 11 | #define EXIT_UNCORRECTED 4 12 | #define EXIT_ERROR 8 13 | #define EXIT_USAGE 16 14 | #define FSCK_CANCELED 32 /* Aborted with a signal or ^C */ 15 | 16 | extern char *e2fs_set_sbin_path(void); 17 | -------------------------------------------------------------------------------- /e2fsprogs/old_e2fsprogs/uuid/Kbuild: -------------------------------------------------------------------------------- 1 | # Makefile for busybox 2 | # 3 | # Copyright (C) 1999-2005 by Erik Andersen 4 | # 5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. 6 | 7 | NEEDED-$(CONFIG_E2FSCK) = y 8 | NEEDED-$(CONFIG_FSCK) = y 9 | NEEDED-$(CONFIG_MKE2FS) = y 10 | NEEDED-$(CONFIG_TUNE2FS) = y 11 | 12 | lib-y:= 13 | lib-$(NEEDED-y) += compare.o gen_uuid.o pack.o parse.o unpack.o unparse.o \ 14 | uuid_time.o 15 | -------------------------------------------------------------------------------- /editors/Kbuild: -------------------------------------------------------------------------------- 1 | # Makefile for busybox 2 | # 3 | # Copyright (C) 1999-2005 by Erik Andersen 4 | # 5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. 6 | 7 | lib-y:= 8 | lib-$(CONFIG_AWK) += awk.o 9 | lib-$(CONFIG_CMP) += cmp.o 10 | lib-$(CONFIG_DIFF) += diff.o 11 | lib-$(CONFIG_ED) += ed.o 12 | lib-$(CONFIG_PATCH) += patch.o 13 | lib-$(CONFIG_SED) += sed.o 14 | lib-$(CONFIG_VI) += vi.o 15 | -------------------------------------------------------------------------------- /examples/bootfloppy/display.txt: -------------------------------------------------------------------------------- 1 | 2 | This boot floppy is made with Busybox, uClibc, and the Linux kernel. 3 | Hit RETURN to boot or enter boot parameters at the prompt below. 4 | 5 | -------------------------------------------------------------------------------- /examples/bootfloppy/etc/fstab: -------------------------------------------------------------------------------- 1 | proc /proc proc defaults 0 0 2 | 3 | -------------------------------------------------------------------------------- /examples/bootfloppy/etc/init.d/rcS: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | /bin/mount -a 4 | -------------------------------------------------------------------------------- /examples/bootfloppy/etc/inittab: -------------------------------------------------------------------------------- 1 | ::sysinit:/etc/init.d/rcS 2 | ::respawn:-/bin/sh 3 | tty2::askfirst:-/bin/sh 4 | ::ctrlaltdel:/bin/umount -a -r 5 | 6 | -------------------------------------------------------------------------------- /examples/bootfloppy/etc/profile: -------------------------------------------------------------------------------- 1 | # /etc/profile: system-wide .profile file for the Bourne shells 2 | 3 | echo 4 | echo -n "Processing /etc/profile... " 5 | # no-op 6 | echo "Done" 7 | echo 8 | 9 | -------------------------------------------------------------------------------- /examples/bootfloppy/syslinux.cfg: -------------------------------------------------------------------------------- 1 | display display.txt 2 | default linux 3 | timeout 10 4 | prompt 1 5 | label linux 6 | kernel linux 7 | append initrd=rootfs.gz root=/dev/ram0 8 | -------------------------------------------------------------------------------- /examples/dnsd.conf: -------------------------------------------------------------------------------- 1 | thebox 192.168.1.5 2 | -------------------------------------------------------------------------------- /examples/udhcp/sample.deconfig: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Sample udhcpc deconfig script 3 | 4 | /sbin/ifconfig $interface 0.0.0.0 5 | -------------------------------------------------------------------------------- /examples/udhcp/sample.nak: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Sample udhcpc nak script 3 | 4 | echo Received a NAK: $message 5 | -------------------------------------------------------------------------------- /examples/udhcp/sample.script: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Currently, we only dispatch according to command. However, a more 3 | # elaborate system might dispatch by command and interface or do some 4 | # common initialization first, especially if more dhcp event notifications 5 | # are added. 6 | 7 | exec /usr/share/udhcpc/sample.$1 8 | -------------------------------------------------------------------------------- /examples/var_service/dhcp_if/log/run: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | user=logger 4 | 5 | logdir="/var/log/service/`(cd ..;basename $PWD)`" 6 | mkdir -p "$logdir" 2>/dev/null 7 | chown -R "$user": "$logdir" 8 | chmod -R go-rwxst,u+rwX "$logdir" 9 | rm logdir 10 | ln -s "$logdir" logdir 11 | 12 | # make this dir accessible to logger 13 | chmod a+rX . 14 | 15 | exec >/dev/null 16 | exec 2>&1 17 | exec \ 18 | env - PATH="$PATH" \ 19 | softlimit \ 20 | setuidgid "$user" \ 21 | svlogd -tt "$logdir" 22 | -------------------------------------------------------------------------------- /examples/var_service/dhcp_if/p_log: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cd log/logdir || exit 1 4 | cat @* current | $PAGER 5 | -------------------------------------------------------------------------------- /examples/var_service/dhcp_if/run: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | exec 2>&1 4 | exec &1 | cut -b1-$((w-2))' 5 | -------------------------------------------------------------------------------- /examples/var_service/ftpd/log/run: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | user=logger 4 | 5 | logdir="/var/log/service/`(cd ..;basename $PWD)`" 6 | mkdir -p "$logdir" 2>/dev/null 7 | chown -R "$user": "$logdir" 8 | chmod -R go-rwxst,u+rwX "$logdir" 9 | rm logdir 10 | ln -s "$logdir" logdir 11 | 12 | # make this dir accessible to logger 13 | chmod a+rX . 14 | 15 | exec >/dev/null 16 | exec 2>&1 17 | exec \ 18 | env - PATH="$PATH" \ 19 | softlimit \ 20 | setuidgid "$user" \ 21 | svlogd -tt "$logdir" 22 | -------------------------------------------------------------------------------- /examples/var_service/ftpd/p_log: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cd log/logdir || exit 1 4 | cat @* current | $PAGER 5 | -------------------------------------------------------------------------------- /examples/var_service/ftpd/run: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | #exec >/dev/null 4 | exec 2>&1 5 | exec &1 | cut -b1-$((w-2))' 5 | -------------------------------------------------------------------------------- /examples/var_service/fw/conf/11.22.33.44.ipconf--: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # If we have simple static address... 3 | # 4 | let cfg=cfg+1 5 | if[$cfg]=if 6 | ip[$cfg]=11.22.33.44 7 | ipmask[$cfg]=11.22.33.44/24 8 | gw[$cfg]=11.22.33.1 9 | net[$cfg]=0/0 10 | dns[$cfg]='11.22.33.2 11.22.33.3' 11 | -------------------------------------------------------------------------------- /examples/var_service/fw/conf/192.168.0.1.ipconf: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # A small network with no routers 3 | # (maybe *we* are their router) 4 | # 5 | let cfg=cfg+1 6 | if[$cfg]=if 7 | ip[$cfg]=192.168.0.1 8 | ipmask[$cfg]=192.168.0.1/24 9 | ### gw[$cfg]= 10 | ### net[$cfg]=0/0 11 | ### dns[$cfg]='' 12 | -------------------------------------------------------------------------------- /examples/var_service/fw/conf/lo.ipconf: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Mostly redundant except when you need dns[]=your_static_dns_srv 3 | # 4 | let cfg=cfg+1 5 | if[$cfg]=lo 6 | ip[$cfg]=127.0.0.1 7 | ipmask[$cfg]=127.0.0.1/8 8 | gw[$cfg]='' 9 | net[$cfg]='' 10 | #dns[$cfg]=127.0.0.1 11 | -------------------------------------------------------------------------------- /examples/var_service/fw/etc/hosts: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | echo "\ 3 | # This file is automagically regenerated 4 | # Note! /etc/nsswitch.conf may override this! 5 | 6 | # For loopbacking 7 | 127.0.0.1 localhost 8 | 9 | # Our local IPs" 10 | 11 | hostname=`hostname` 12 | test "$hostname" || hostname=localhost 13 | domain=`(. /boot.conf; echo "$DNSDOMAINNAME")` 14 | test "$domain" && hostname="$hostname $hostname.$domain" 15 | 16 | ip -o a l \ 17 | | grep -F 'inet ' \ 18 | | sed -e 's/^.*inet //' -e 's:[ /].*$: '"$hostname"':' 19 | 20 | echo 21 | echo "# End of /etc/hosts" 22 | -------------------------------------------------------------------------------- /examples/var_service/fw/stat: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | echo; echo "* Firewall:" 4 | { 5 | echo '---FILTER--'; 6 | iptables -v -L -x -n; 7 | echo '---NAT-----'; 8 | iptables -t nat -v -L -x -n; 9 | echo '---MANGLE--'; 10 | iptables -t mangle -v -L -x -n; 11 | } \ 12 | | grep -v '^$' | grep -Fv 'bytes target' | $PAGER 13 | -------------------------------------------------------------------------------- /examples/var_service/getty_tty1/alt08x16+unimap.fnt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylex/android_external_busybox/e5493a5af57c1ffb0d933faab0700db1c0e5b82f/examples/var_service/getty_tty1/alt08x16+unimap.fnt -------------------------------------------------------------------------------- /examples/var_service/getty_tty1/login.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ttyname=`tty` 4 | ttybase="${ttyname%%[0123456789]*}" # strip numeric tail 5 | 6 | if test "$ttybase" = "/dev/tty"; then 7 | tail="${ttyname:8}" 8 | echo "* Setting terminal device's owner to $LOGIN_UID:$LOGIN_GID" 9 | chown "$LOGIN_UID:$LOGIN_GID" "/dev/vcs$tail" "/dev/vcsa$tail" 10 | fi 11 | # We can do this also, but login does it itself 12 | # chown "$LOGIN_UID:$LOGIN_GID" "$ttyname" 13 | -------------------------------------------------------------------------------- /examples/var_service/gpm/run: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | exec >/dev/null 4 | exec 2>&1 5 | exec /dev/null 7 | chown -R "$user": "$logdir" 8 | chmod -R go-rwxst,u+rwX "$logdir" 9 | rm logdir 10 | ln -s "$logdir" logdir 11 | 12 | # make this dir accessible to logger 13 | chmod a+rX . 14 | 15 | exec >/dev/null 16 | exec 2>&1 17 | exec \ 18 | env - PATH="$PATH" \ 19 | softlimit \ 20 | setuidgid "$user" \ 21 | svlogd -tt "$logdir" 22 | -------------------------------------------------------------------------------- /examples/var_service/httpd/p_log: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cd log/logdir || exit 1 4 | cat @* current | $PAGER 5 | -------------------------------------------------------------------------------- /examples/var_service/httpd/run: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | #exec >/dev/null 4 | exec 2>&1 5 | exec &1 | cut -b1-$((w-2))' 5 | -------------------------------------------------------------------------------- /examples/var_service/ifplugd_if/ifplugd_handler: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # parameters: 3 | # $1: interface 4 | # $2: state 5 | 6 | if test -d "/var/service/dhcp_$1"; then 7 | if test x"$2" = x"down"; then 8 | echo "Downing /var/service/dhcp_$1" 9 | sv d "/var/service/dhcp_$1" 10 | fi 11 | if test x"$2" = x"up"; then 12 | echo "Upping /var/service/dhcp_$1" 13 | sv u "/var/service/dhcp_$1" 14 | fi 15 | fi 16 | -------------------------------------------------------------------------------- /examples/var_service/ifplugd_if/log/run: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | user=logger 4 | 5 | logdir="/var/log/service/`(cd ..;basename $PWD)`" 6 | mkdir -p "$logdir" 2>/dev/null 7 | chown -R "$user": "$logdir" 8 | chmod -R go-rwxst,u+rwX "$logdir" 9 | rm logdir 10 | ln -s "$logdir" logdir 11 | 12 | # make this dir accessible to logger 13 | chmod a+rX . 14 | 15 | exec >/dev/null 16 | exec 2>&1 17 | exec \ 18 | env - PATH="$PATH" \ 19 | softlimit \ 20 | setuidgid "$user" \ 21 | svlogd -tt "$logdir" 22 | -------------------------------------------------------------------------------- /examples/var_service/ifplugd_if/p_log: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cd log/logdir || exit 1 4 | cat @* current | $PAGER 5 | -------------------------------------------------------------------------------- /examples/var_service/ifplugd_if/w_log: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cd log/logdir || exit 1 4 | watch -n2 'w=`ttysize w`; h=`ttysize h`; tail -$((h-3)) current 2>&1 | cut -b1-$((w-2))' 5 | -------------------------------------------------------------------------------- /examples/var_service/inetd/log/run: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | user=logger 4 | 5 | logdir="/var/log/service/`(cd ..;basename $PWD)`" 6 | mkdir -p "$logdir" 2>/dev/null 7 | chown -R "$user": "$logdir" 8 | chmod -R go-rwxst,u+rwX "$logdir" 9 | rm logdir 10 | ln -s "$logdir" logdir 11 | 12 | # make this dir accessible to logger 13 | chmod a+rX . 14 | 15 | exec >/dev/null 16 | exec 2>&1 17 | exec \ 18 | env - PATH="$PATH" \ 19 | softlimit \ 20 | setuidgid "$user" \ 21 | svlogd -tt "$logdir" 22 | -------------------------------------------------------------------------------- /examples/var_service/inetd/p_log: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cd log/logdir || exit 1 4 | cat @* current | $PAGER 5 | -------------------------------------------------------------------------------- /examples/var_service/inetd/run: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | #exec >/dev/null 4 | exec 2>&1 5 | exec &1 | cut -b1-$((w-2))' 5 | -------------------------------------------------------------------------------- /examples/var_service/nmeter/run: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | exec >/dev/null 4 | exec 2>&1 5 | exec /proc/self/net/) appeared, 8 | # we need to be root 9 | user="root" 10 | tty="/dev/tty9" 11 | cmd="nmeter '%t %c x %x p%p f %f b %b m %m if%[nif]'" 12 | 13 | chmod -R a+X . # or else env will moan 14 | chown "$user": "$tty" # devfs made happy 15 | 16 | eval exec \ 17 | env - PATH="$PATH" \ 18 | setuidgid "$user" \ 19 | <"$tty" >"$tty" 2>&1 \ 20 | $cmd 21 | -------------------------------------------------------------------------------- /examples/var_service/ntpd/log/run: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | user=logger 4 | 5 | logdir="/var/log/service/`(cd ..;basename $PWD)`" 6 | mkdir -p "$logdir" 2>/dev/null 7 | chown -R "$user": "$logdir" 8 | chmod -R go-rwxst,u+rwX "$logdir" 9 | rm logdir 10 | ln -s "$logdir" logdir 11 | 12 | # make this dir accessible to logger 13 | chmod a+rX . 14 | 15 | exec >/dev/null 16 | exec 2>&1 17 | exec \ 18 | env - PATH="$PATH" \ 19 | softlimit \ 20 | setuidgid "$user" \ 21 | svlogd -tt "$logdir" 22 | -------------------------------------------------------------------------------- /examples/var_service/ntpd/p_log: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cd log/logdir || exit 1 4 | cat @* current | $PAGER 5 | -------------------------------------------------------------------------------- /examples/var_service/ntpd/w_log: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cd log/logdir || exit 1 4 | watch -n2 'w=`ttysize w`; h=`ttysize h`; tail -$((h-3)) current 2>&1 | cut -b1-$((w-2))' 5 | -------------------------------------------------------------------------------- /examples/var_service/tftpd/log/run: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | user=logger 4 | 5 | logdir="/var/log/service/`(cd ..;basename $PWD)`" 6 | mkdir -p "$logdir" 2>/dev/null 7 | chown -R "$user": "$logdir" 8 | chmod -R go-rwxst,u+rwX "$logdir" 9 | rm logdir 10 | ln -s "$logdir" logdir 11 | 12 | # make this dir accessible to logger 13 | chmod a+rX . 14 | 15 | exec >/dev/null 16 | exec 2>&1 17 | exec \ 18 | env - PATH="$PATH" \ 19 | softlimit \ 20 | setuidgid "$user" \ 21 | svlogd -tt "$logdir" 22 | -------------------------------------------------------------------------------- /examples/var_service/tftpd/p_log: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cd log/logdir || exit 1 4 | cat @* current | $PAGER 5 | -------------------------------------------------------------------------------- /examples/var_service/tftpd/run: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | #exec >/dev/null 4 | exec 2>&1 5 | exec &1 | cut -b1-$((w-2))' 5 | -------------------------------------------------------------------------------- /findutils/Kbuild: -------------------------------------------------------------------------------- 1 | # Makefile for busybox 2 | # 3 | # Copyright (C) 1999-2005 by Erik Andersen 4 | # 5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. 6 | 7 | lib-y:= 8 | lib-$(CONFIG_FIND) += find.o 9 | lib-$(CONFIG_GREP) += grep.o 10 | lib-$(CONFIG_XARGS) += xargs.o 11 | -------------------------------------------------------------------------------- /include/.gitignore: -------------------------------------------------------------------------------- 1 | /config 2 | -------------------------------------------------------------------------------- /init/Kbuild: -------------------------------------------------------------------------------- 1 | # Makefile for busybox 2 | # 3 | # Copyright (C) 1999-2005 by Erik Andersen 4 | # 5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. 6 | 7 | lib-y:= 8 | lib-$(CONFIG_HALT) += halt.o 9 | lib-$(CONFIG_INIT) += init.o 10 | lib-$(CONFIG_MESG) += mesg.o 11 | -------------------------------------------------------------------------------- /libbb/README: -------------------------------------------------------------------------------- 1 | Please see the LICENSE file for copyright information (GPLv2) 2 | 3 | libbb is BusyBox's utility library. All of this stuff used to be stuffed into 4 | a single file named utility.c. When I split utility.c to create libbb, some of 5 | the very oldest stuff ended up without their original copyright and licensing 6 | information (which is now lost in the mists of time). If you see something 7 | that you wrote that is mis-attributed, do let me know so we can fix that up. 8 | 9 | Erik Andersen 10 | 11 | 12 | -------------------------------------------------------------------------------- /libbb/bb_basename.c: -------------------------------------------------------------------------------- 1 | /* vi: set sw=4 ts=4: */ 2 | /* 3 | * Utility routines. 4 | * 5 | * Copyright (C) 2007 Denys Vlasenko 6 | * 7 | * Licensed under GPL version 2, see file LICENSE in this tarball for details. 8 | */ 9 | 10 | #include "libbb.h" 11 | 12 | const char* FAST_FUNC bb_basename(const char *name) 13 | { 14 | const char *cp = strrchr(name, '/'); 15 | if (cp) 16 | return cp + 1; 17 | return name; 18 | } 19 | -------------------------------------------------------------------------------- /libbb/bb_do_delay.c: -------------------------------------------------------------------------------- 1 | /* vi: set sw=4 ts=4: */ 2 | /* 3 | * Busybox utility routines. 4 | * 5 | * Copyright (C) 2005 by Tito Ragusa 6 | * 7 | * Licensed under the GPL v2, see the file LICENSE in this tarball. 8 | */ 9 | 10 | #include "libbb.h" 11 | 12 | void FAST_FUNC bb_do_delay(int seconds) 13 | { 14 | time_t start, now; 15 | 16 | start = time(NULL); 17 | do { 18 | sleep(seconds); 19 | now = time(NULL); 20 | } while ((now - start) < seconds); 21 | } 22 | -------------------------------------------------------------------------------- /libbb/bb_qsort.c: -------------------------------------------------------------------------------- 1 | /* vi: set sw=4 ts=4: */ 2 | /* 3 | * Wrapper for common string vector sorting operation 4 | * 5 | * Copyright (c) 2008 Denys Vlasenko 6 | * 7 | * Licensed under GPLv2, see file LICENSE in this tarball for details. 8 | */ 9 | 10 | #include "libbb.h" 11 | 12 | int /* not FAST_FUNC! */ bb_pstrcmp(const void *a, const void *b) 13 | { 14 | return strcmp(*(char**)a, *(char**)b); 15 | } 16 | 17 | void FAST_FUNC qsort_string_vector(char **sv, unsigned count) 18 | { 19 | qsort(sv, count, sizeof(char*), bb_pstrcmp); 20 | } 21 | -------------------------------------------------------------------------------- /libbb/chomp.c: -------------------------------------------------------------------------------- 1 | /* vi: set sw=4 ts=4: */ 2 | /* 3 | * Utility routines. 4 | * 5 | * Copyright (C) many different people. 6 | * If you wrote this, please acknowledge your work. 7 | * 8 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 9 | */ 10 | 11 | #include "libbb.h" 12 | 13 | void FAST_FUNC chomp(char *s) 14 | { 15 | char *lc = last_char_is(s, '\n'); 16 | 17 | if (lc) 18 | *lc = '\0'; 19 | } 20 | -------------------------------------------------------------------------------- /libbb/error_msg.c: -------------------------------------------------------------------------------- 1 | /* vi: set sw=4 ts=4: */ 2 | /* 3 | * Utility routines. 4 | * 5 | * Copyright (C) 1999-2004 by Erik Andersen 6 | * 7 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 8 | */ 9 | 10 | #include "libbb.h" 11 | 12 | void FAST_FUNC bb_error_msg(const char *s, ...) 13 | { 14 | va_list p; 15 | 16 | va_start(p, s); 17 | bb_verror_msg(s, p, NULL); 18 | va_end(p); 19 | } 20 | -------------------------------------------------------------------------------- /libbb/error_msg_and_die.c: -------------------------------------------------------------------------------- 1 | /* vi: set sw=4 ts=4: */ 2 | /* 3 | * Utility routines. 4 | * 5 | * Copyright (C) 1999-2004 by Erik Andersen 6 | * 7 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 8 | */ 9 | 10 | #include "libbb.h" 11 | 12 | void FAST_FUNC bb_error_msg_and_die(const char *s, ...) 13 | { 14 | va_list p; 15 | 16 | va_start(p, s); 17 | bb_verror_msg(s, p, NULL); 18 | va_end(p); 19 | xfunc_die(); 20 | } 21 | -------------------------------------------------------------------------------- /libbb/herror_msg.c: -------------------------------------------------------------------------------- 1 | /* vi: set sw=4 ts=4: */ 2 | /* 3 | * Utility routines. 4 | * 5 | * Copyright (C) 1999-2004 by Erik Andersen 6 | * 7 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 8 | */ 9 | 10 | #include "libbb.h" 11 | 12 | void FAST_FUNC bb_herror_msg(const char *s, ...) 13 | { 14 | va_list p; 15 | 16 | va_start(p, s); 17 | bb_verror_msg(s, p, hstrerror(h_errno)); 18 | va_end(p); 19 | } 20 | -------------------------------------------------------------------------------- /libbb/herror_msg_and_die.c: -------------------------------------------------------------------------------- 1 | /* vi: set sw=4 ts=4: */ 2 | /* 3 | * Utility routines. 4 | * 5 | * Copyright (C) 1999-2004 by Erik Andersen 6 | * 7 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 8 | */ 9 | 10 | #include "libbb.h" 11 | 12 | void FAST_FUNC bb_herror_msg_and_die(const char *s, ...) 13 | { 14 | va_list p; 15 | 16 | va_start(p, s); 17 | bb_verror_msg(s, p, hstrerror(h_errno)); 18 | va_end(p); 19 | xfunc_die(); 20 | } 21 | -------------------------------------------------------------------------------- /libbb/mtab_file.c: -------------------------------------------------------------------------------- 1 | /* vi: set sw=4 ts=4: */ 2 | /* 3 | * Utility routines. 4 | * 5 | * Copyright (C) 1999-2004 by Erik Andersen 6 | * 7 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 8 | */ 9 | 10 | #include "libbb.h" 11 | 12 | /* Busybox mount uses either /proc/mounts or /etc/mtab to 13 | * get the list of currently mounted filesystems */ 14 | const char bb_path_mtab_file[] ALIGN1 = 15 | IF_FEATURE_MTAB_SUPPORT("/etc/mtab")IF_NOT_FEATURE_MTAB_SUPPORT("/proc/mounts"); 16 | -------------------------------------------------------------------------------- /libbb/safe_write.c: -------------------------------------------------------------------------------- 1 | /* vi: set sw=4 ts=4: */ 2 | /* 3 | * Utility routines. 4 | * 5 | * Copyright (C) 1999-2004 by Erik Andersen 6 | * 7 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 8 | */ 9 | 10 | #include "libbb.h" 11 | 12 | ssize_t FAST_FUNC safe_write(int fd, const void *buf, size_t count) 13 | { 14 | ssize_t n; 15 | 16 | do { 17 | n = write(fd, buf, count); 18 | } while (n < 0 && errno == EINTR); 19 | 20 | return n; 21 | } 22 | -------------------------------------------------------------------------------- /libbb/single_argv.c: -------------------------------------------------------------------------------- 1 | /* vi: set sw=4 ts=4: */ 2 | /* 3 | * Utility routines. 4 | * 5 | * Copyright (C) 2009 Denys Vlasenko 6 | * 7 | * Licensed under GPLv2, see file LICENSE in this tarball for details. 8 | */ 9 | #include "libbb.h" 10 | 11 | char* FAST_FUNC single_argv(char **argv) 12 | { 13 | if (!argv[1] || argv[2]) 14 | bb_show_usage(); 15 | return argv[1]; 16 | } 17 | -------------------------------------------------------------------------------- /libbb/str_tolower.c: -------------------------------------------------------------------------------- 1 | /* vi set: sw=4 ts=4: */ 2 | /* Convert string str to lowercase, return str. 3 | * 4 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 5 | */ 6 | #include "libbb.h" 7 | 8 | char* FAST_FUNC str_tolower(char *str) 9 | { 10 | char *c; 11 | for (c = str; *c; ++c) 12 | *c = tolower(*c); 13 | return str; 14 | } 15 | -------------------------------------------------------------------------------- /libbb/vdprintf.c: -------------------------------------------------------------------------------- 1 | /* vi: set sw=4 ts=4: */ 2 | /* 3 | * Utility routines. 4 | * 5 | * Copyright (C) 1999-2004 by Erik Andersen 6 | * 7 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 8 | */ 9 | 10 | #include "libbb.h" 11 | 12 | #if defined(__GLIBC__) && __GLIBC__ < 2 13 | int FAST_FUNC vdprintf(int d, const char *format, va_list ap) 14 | { 15 | char buf[BUF_SIZE]; 16 | int len; 17 | 18 | len = vsnprintf(buf, BUF_SIZE, format, ap); 19 | return write(d, buf, len); 20 | } 21 | #endif 22 | -------------------------------------------------------------------------------- /libbb/warn_ignoring_args.c: -------------------------------------------------------------------------------- 1 | /* vi: set sw=4 ts=4: */ 2 | /* 3 | * warn_ignoring_args implementation for busybox 4 | * 5 | * Copyright (C) 2003 Manuel Novoa III 6 | * 7 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 8 | */ 9 | #include "libbb.h" 10 | 11 | #if ENABLE_DESKTOP 12 | void FAST_FUNC bb_warn_ignoring_args(char *arg) 13 | { 14 | if (arg) { 15 | bb_error_msg("ignoring all arguments"); 16 | } 17 | } 18 | #endif 19 | -------------------------------------------------------------------------------- /libbb/write.c: -------------------------------------------------------------------------------- 1 | /* vi: set sw=4 ts=4: */ 2 | /* 3 | * Utility routines. 4 | * 5 | * Copyright (C) 2008 Bernhard Reutner-Fischer 6 | * 7 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 8 | */ 9 | 10 | #include "libbb.h" 11 | 12 | /* Open file and write string str to it, close file. 13 | * Die on any open or write error. */ 14 | void FAST_FUNC xopen_xwrite_close(const char* file, const char* str) 15 | { 16 | int fd = xopen(file, O_WRONLY); 17 | xwrite_str(fd, str); 18 | close(fd); 19 | } 20 | -------------------------------------------------------------------------------- /libbb/xgethostbyname.c: -------------------------------------------------------------------------------- 1 | /* vi: set sw=4 ts=4: */ 2 | /* 3 | * Mini xgethostbyname implementation. 4 | * 5 | * Copyright (C) 2001 Matt Kraai . 6 | * 7 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 8 | */ 9 | 10 | //#include 11 | #include "libbb.h" 12 | 13 | struct hostent* FAST_FUNC xgethostbyname(const char *name) 14 | { 15 | struct hostent *retval = gethostbyname(name); 16 | if (!retval) 17 | bb_herror_msg_and_die("%s", name); 18 | return retval; 19 | } 20 | -------------------------------------------------------------------------------- /libpwdgrp/Kbuild: -------------------------------------------------------------------------------- 1 | # Makefile for busybox 2 | # 3 | # Copyright (C) 1999-2005 by Erik Andersen 4 | # 5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. 6 | 7 | lib-y := uidgid_get.o 8 | 9 | lib-$(CONFIG_USE_BB_PWD_GRP) += pwd_grp.o 10 | -------------------------------------------------------------------------------- /mailutils/Kbuild: -------------------------------------------------------------------------------- 1 | # Makefile for busybox 2 | # 3 | # Copyright (C) 1999-2005 by Erik Andersen 4 | # 5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. 6 | 7 | lib-y:= 8 | lib-$(CONFIG_MAKEMIME) += mime.o mail.o 9 | lib-$(CONFIG_POPMAILDIR) += popmaildir.o mail.o 10 | lib-$(CONFIG_REFORMIME) += mime.o mail.o 11 | lib-$(CONFIG_SENDMAIL) += sendmail.o mail.o 12 | -------------------------------------------------------------------------------- /miscutils/bbconfig.c: -------------------------------------------------------------------------------- 1 | /* vi: set sw=4 ts=4: */ 2 | /* This file was released into the public domain by Paul Fox. 3 | */ 4 | #include "libbb.h" 5 | #include "bbconfigopts.h" 6 | 7 | int bbconfig_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 8 | int bbconfig_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) 9 | { 10 | printf(bbconfig_config); 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /miscutils/fbsplash.cfg: -------------------------------------------------------------------------------- 1 | # progress bar position 2 | BAR_LEFT=170 3 | BAR_TOP=300 4 | BAR_WIDTH=300 5 | BAR_HEIGHT=20 6 | # progress bar color 7 | BAR_R=80 8 | BAR_G=80 9 | BAR_B=130 10 | -------------------------------------------------------------------------------- /miscutils/raidautorun.c: -------------------------------------------------------------------------------- 1 | /* vi: set sw=4 ts=4: */ 2 | /* 3 | * raidautorun implementation for busybox 4 | * 5 | * Copyright (C) 2006 Bernhard Reutner-Fischer 6 | * 7 | * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 8 | * 9 | */ 10 | 11 | #include "libbb.h" 12 | 13 | #include 14 | #include 15 | 16 | int raidautorun_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 17 | int raidautorun_main(int argc UNUSED_PARAM, char **argv) 18 | { 19 | xioctl(xopen(single_argv(argv), O_RDONLY), RAID_AUTORUN, NULL); 20 | return EXIT_SUCCESS; 21 | } 22 | -------------------------------------------------------------------------------- /modutils/Kbuild: -------------------------------------------------------------------------------- 1 | # Makefile for busybox 2 | # 3 | # Copyright (C) 1999-2005 by Erik Andersen 4 | # 5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. 6 | 7 | lib-y:= 8 | lib-$(CONFIG_MODPROBE_SMALL) += modprobe-small.o 9 | lib-$(CONFIG_DEPMOD) += depmod.o modutils.o 10 | lib-$(CONFIG_INSMOD) += insmod.o modutils.o 11 | lib-$(CONFIG_LSMOD) += lsmod.o modutils.o 12 | lib-$(CONFIG_MODPROBE) += modprobe.o modutils.o 13 | lib-$(CONFIG_RMMOD) += rmmod.o modutils.o 14 | lib-$(CONFIG_FEATURE_2_4_MODULES) += modutils-24.o 15 | -------------------------------------------------------------------------------- /modutils/depmod_process.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Depmod output may be hard to diff. 4 | # This script sorts dependencies within "xx.ko: yy.ko zz.ko" lines, 5 | # and sorts all lines too. 6 | # Usage: 7 | # 8 | # [./busybox] depmod -n | ./depmod_process.sh | sort >OUTFILE 9 | # 10 | # and then you can diff OUTFILEs. Useful for comparing bbox depmod 11 | # with module-init-tools depmod and such. 12 | 13 | while read -r word rest; do 14 | if ! test "${word/*:/}"; then 15 | echo -n "$word " 16 | echo "$rest" | xargs -n1 | sort | xargs 17 | else 18 | echo "$word $rest"; 19 | fi 20 | done 21 | -------------------------------------------------------------------------------- /modutils/modutils-24.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylex/android_external_busybox/e5493a5af57c1ffb0d933faab0700db1c0e5b82f/modutils/modutils-24.c -------------------------------------------------------------------------------- /networking/libiproute/rtm_map.h: -------------------------------------------------------------------------------- 1 | /* vi: set sw=4 ts=4: */ 2 | #ifndef RTM_MAP_H 3 | #define RTM_MAP_H 1 4 | 5 | PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN 6 | 7 | const char *rtnl_rtntype_n2a(int id, char *buf) FAST_FUNC; 8 | int rtnl_rtntype_a2n(int *id, char *arg) FAST_FUNC; 9 | 10 | int get_rt_realms(uint32_t *realms, char *arg) FAST_FUNC; 11 | 12 | POP_SAVED_FUNCTION_VISIBILITY 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /networking/udhcp/common.c: -------------------------------------------------------------------------------- 1 | /* vi: set sw=4 ts=4: */ 2 | /* common.c 3 | * 4 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 5 | */ 6 | #include "common.h" 7 | 8 | #if defined CONFIG_UDHCP_DEBUG && CONFIG_UDHCP_DEBUG >= 1 9 | unsigned dhcp_verbose; 10 | #endif 11 | 12 | const uint8_t MAC_BCAST_ADDR[6] ALIGN2 = { 13 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff 14 | }; 15 | -------------------------------------------------------------------------------- /printutils/Config.in: -------------------------------------------------------------------------------- 1 | # 2 | # For a description of the syntax of this configuration file, 3 | # see scripts/kbuild/config-language.txt. 4 | # 5 | 6 | menu "Print Utilities" 7 | 8 | config LPD 9 | bool "lpd" 10 | default n 11 | help 12 | lpd is a print spooling daemon. 13 | 14 | config LPR 15 | bool "lpr" 16 | default n 17 | help 18 | lpr sends files (or standard input) to a print spooling daemon. 19 | 20 | config LPQ 21 | bool "lpq" 22 | default n 23 | help 24 | lpq is a print spool queue examination and manipulation program. 25 | 26 | endmenu 27 | -------------------------------------------------------------------------------- /printutils/Kbuild: -------------------------------------------------------------------------------- 1 | # Makefile for busybox 2 | # 3 | # Licensed under the GPL v2, see the file LICENSE in this tarball. 4 | 5 | lib-y := 6 | 7 | lib-$(CONFIG_LPD) += lpd.o 8 | lib-$(CONFIG_LPR) += lpr.o 9 | lib-$(CONFIG_LPQ) += lpr.o 10 | -------------------------------------------------------------------------------- /runit/Kbuild: -------------------------------------------------------------------------------- 1 | # Makefile for busybox 2 | # 3 | # Copyright (C) 1999-2005 by Erik Andersen 4 | # 5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. 6 | 7 | lib-y:= 8 | lib-$(CONFIG_RUNSV) += runsv.o runit_lib.o 9 | lib-$(CONFIG_RUNSVDIR) += runsvdir.o runit_lib.o 10 | lib-$(CONFIG_SV) += sv.o runit_lib.o 11 | lib-$(CONFIG_SVLOGD) += svlogd.o runit_lib.o 12 | lib-$(CONFIG_CHPST) += chpst.o 13 | 14 | lib-$(CONFIG_ENVDIR) += chpst.o 15 | lib-$(CONFIG_ENVUIDGID) += chpst.o 16 | lib-$(CONFIG_SETUIDGID) += chpst.o 17 | lib-$(CONFIG_SOFTLIMIT) += chpst.o 18 | -------------------------------------------------------------------------------- /scripts/Kbuild: -------------------------------------------------------------------------------- 1 | ### 2 | # scripts contains sources for various helper programs used throughout 3 | # the kernel for the build process. 4 | # --------------------------------------------------------------------------- 5 | 6 | # Let clean descend into subdirs 7 | subdir- += basic kconfig 8 | -------------------------------------------------------------------------------- /scripts/basic/.gitignore: -------------------------------------------------------------------------------- 1 | hash 2 | fixdep 3 | docproc 4 | split-include 5 | -------------------------------------------------------------------------------- /scripts/cleanup_printf2puts: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Processes current directory recursively: 4 | # printf("abc\n") -> puts("abc"). Beware of fprintf etc... 5 | 6 | # BTW, gcc 4.1.2 already does tha same! Can't believe it... 7 | 8 | grep -lr 'printf\([^%%]*\\n"\)' . | grep '.[ch]$' | xargs -n1 \ 9 | sed -e 's/\([^A-Za-z0-9_]\)printf(\( *"[^%]*\)\\n")/\1puts(\2")/' -i 10 | -------------------------------------------------------------------------------- /scripts/find_bad_common_bufsiz: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # This script finds applets with multiple uses of bb_common_bufsiz1 4 | # (== possible bugs). 5 | # Currently (2007-06-04) reports 3 false positives: 6 | # ./coreutils/diff.c:7 7 | # ./loginutils/getty.c:2 8 | # ./util-linux/mount.c:5 9 | 10 | find -name '*.c' \ 11 | | while read name; do 12 | grep -Hc bb_common_bufsiz1 "$name" 13 | done | grep -v ':[01]$' 14 | -------------------------------------------------------------------------------- /scripts/find_stray_common_vars: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Common variables are elusive, they don't show up in size output! 4 | # This script will show all commons in *.o, sorted by size 5 | 6 | find ! -path './scripts/*' -a ! -name built-in.o -a -name '*.o' \ 7 | | while read name; do 8 | b=`basename "$name"` 9 | nm "$name" | sed "s/^/$b: /" 10 | done | grep -i ' c ' | sort -k2 11 | -------------------------------------------------------------------------------- /scripts/gcc-version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # gcc-version gcc-command 4 | # 5 | # Prints the gcc version of `gcc-command' in a canonical 4-digit form 6 | # such as `0295' for gcc-2.95, `0303' for gcc-3.3, etc. 7 | # 8 | 9 | compiler="$*" 10 | 11 | MAJ_MIN=$(echo __GNUC__ __GNUC_MINOR__ | $compiler -E -xc - | tail -n 1) 12 | printf '%02d%02d\n' $MAJ_MIN 13 | -------------------------------------------------------------------------------- /scripts/kconfig/.gitignore: -------------------------------------------------------------------------------- 1 | # 2 | # Generated files 3 | # 4 | config* 5 | lex.*.c 6 | *.tab.c 7 | *.tab.h 8 | zconf.hash.c 9 | *.moc 10 | lkc_defs.h 11 | 12 | # 13 | # configuration programs 14 | # 15 | conf 16 | mconf 17 | qconf 18 | gconf 19 | kxgettext 20 | -------------------------------------------------------------------------------- /scripts/kconfig/POTFILES.in: -------------------------------------------------------------------------------- 1 | scripts/kconfig/mconf.c 2 | scripts/kconfig/conf.c 3 | scripts/kconfig/confdata.c 4 | scripts/kconfig/gconf.c 5 | scripts/kconfig/qconf.cc 6 | -------------------------------------------------------------------------------- /scripts/kconfig/check.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Needed for systems without gettext 3 | $* -xc -o /dev/null - > /dev/null 2>&1 << EOF 4 | #include 5 | int main() 6 | { 7 | gettext(""); 8 | return 0; 9 | } 10 | EOF 11 | if [ ! "$?" -eq "0" ]; then 12 | echo -DKBUILD_NO_NLS; 13 | fi 14 | 15 | -------------------------------------------------------------------------------- /scripts/kconfig/lxdialog/.gitignore: -------------------------------------------------------------------------------- 1 | # 2 | # Generated files 3 | # 4 | lxdialog 5 | -------------------------------------------------------------------------------- /scripts/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 was used by the Linux 3 | kernel configuration script, and subsequently adapted for busybox. 4 | Please do not bother Savio Lam with questions about this program. 5 | -------------------------------------------------------------------------------- /scripts/memusage: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | busybox=../busybox 4 | 5 | i=4000 6 | echo "Before we started $i copies of '$busybox sleep 10':" 7 | $busybox nmeter '%t %[pn] %m' | head -3 8 | 9 | while test $i != 0; do 10 | $busybox sleep 10 & 11 | i=$((i-1)) 12 | done 13 | sleep 1 14 | 15 | echo "After:" 16 | $busybox nmeter '%t %[pn] %m' | head -3 17 | -------------------------------------------------------------------------------- /scripts/randomtest.loop: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cnt=0 4 | fail=0 5 | 6 | while sleep 1; do 7 | echo "Passes: $cnt Failures: $fail" 8 | ./randomtest >/dev/null || exit #let fail++ 9 | let cnt++ 10 | done 11 | -------------------------------------------------------------------------------- /scripts/sample_pmap: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | busybox=../busybox 4 | 5 | $busybox sleep 10 & 6 | pid=$! 7 | sleep 1 8 | 9 | echo "Memory map of '$busybox sleep 10':" 10 | size $busybox 11 | pmap $pid | env - grep "^[0-9a-f][0-9a-f]* " | sort -r -t " " -k2,999 12 | -------------------------------------------------------------------------------- /scripts/update_config: -------------------------------------------------------------------------------- 1 | #!/bin/sh -ex 2 | # 3 | # Update relevant files after config change 4 | # shade@chemlab.org 5 | 6 | for config in full minimal ; do 7 | rm -f .config.old 8 | cp -f .config-$config .config 9 | make clean prepare busybox.links 10 | make -s show-sources > busybox-$config.sources 11 | mkdir -p include-$config 12 | mv -f include/{autoconf,applet_tables,usage_compressed,bbconfigopts}.h include-$config 13 | mv -f busybox.links busybox-$config.links 14 | rm -f .config 15 | done 16 | -------------------------------------------------------------------------------- /selinux/load_policy.c: -------------------------------------------------------------------------------- 1 | /* 2 | * load_policy 3 | * Author: Yuichi Nakamura 4 | * 5 | * Licensed under GPLv2, see file LICENSE in this tarball for details. 6 | */ 7 | #include "libbb.h" 8 | 9 | int load_policy_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 10 | int load_policy_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) 11 | { 12 | int rc; 13 | 14 | if (argv[1]) { 15 | bb_show_usage(); 16 | } 17 | 18 | rc = selinux_mkload_policy(1); 19 | if (rc < 0) { 20 | bb_perror_msg_and_die("can't load policy"); 21 | } 22 | 23 | return 0; 24 | } 25 | -------------------------------------------------------------------------------- /selinux/selinuxenabled.c: -------------------------------------------------------------------------------- 1 | /* 2 | * selinuxenabled 3 | * 4 | * Based on libselinux 1.33.1 5 | * Port to BusyBox Hiroshi Shinji 6 | * 7 | * Licensed under GPLv2, see file LICENSE in this tarball for details. 8 | */ 9 | #include "libbb.h" 10 | 11 | int selinuxenabled_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 12 | int selinuxenabled_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) 13 | { 14 | return !is_selinux_enabled(); 15 | } 16 | -------------------------------------------------------------------------------- /shell/Kbuild: -------------------------------------------------------------------------------- 1 | # Makefile for busybox 2 | # 3 | # Copyright (C) 1999-2005 by Erik Andersen 4 | # 5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. 6 | 7 | lib-y:= 8 | lib-$(CONFIG_ASH) += ash.o ash_ptr_hack.o shell_common.o builtin_read.o 9 | lib-$(CONFIG_HUSH) += hush.o match.o shell_common.o builtin_read.o 10 | lib-$(CONFIG_CTTYHACK) += cttyhack.o 11 | 12 | lib-$(CONFIG_SH_MATH_SUPPORT) += math.o 13 | lib-$(CONFIG_ASH_RANDOM_SUPPORT) += random.o 14 | lib-$(CONFIG_HUSH_RANDOM_SUPPORT) += random.o 15 | -------------------------------------------------------------------------------- /shell/ash_test/ash-alias/alias.right: -------------------------------------------------------------------------------- 1 | alias: 0 2 | alias: 0 3 | ./alias.tests: line 25: qfoo: not found 4 | quux 5 | -------------------------------------------------------------------------------- /shell/ash_test/ash-arith/README.ash: -------------------------------------------------------------------------------- 1 | there is no support for (( )) constructs in ash 2 | -------------------------------------------------------------------------------- /shell/ash_test/ash-arith/arith-bash1.right: -------------------------------------------------------------------------------- 1 | 1 2 | 0 3 | -------------------------------------------------------------------------------- /shell/ash_test/ash-arith/arith-bash1.tests: -------------------------------------------------------------------------------- 1 | # checks for [[ ]] 2 | 3 | # && and || 4 | [[ a && "" ]]; echo $? 5 | [[ a || "" ]]; echo $? 6 | -------------------------------------------------------------------------------- /shell/ash_test/ash-heredoc/heredoc.right: -------------------------------------------------------------------------------- 1 | there 2 | one - alpha 3 | two - beta 4 | three - gamma 5 | hi\ 6 | there$a 7 | stuff 8 | hi\ 9 | there 10 | EO\ 11 | F 12 | hi 13 | tab 1 14 | tab 2 15 | tab 3 16 | abc 17 | def ghi 18 | jkl mno 19 | fff is a shell function 20 | hi 21 | there 22 | -------------------------------------------------------------------------------- /shell/ash_test/ash-invert/invert.right: -------------------------------------------------------------------------------- 1 | 1 2 | 1 3 | 1 4 | 0 5 | 0 6 | 1 7 | 0 8 | 1 9 | 0 10 | 1 11 | -------------------------------------------------------------------------------- /shell/ash_test/ash-invert/invert.tests: -------------------------------------------------------------------------------- 1 | # tests of return value inversion 2 | # placeholder for future expansion 3 | 4 | # user subshells (...) did this wrong in bash versions before 2.04 5 | 6 | ! ( echo hello | grep h >/dev/null 2>&1 ); echo $? 7 | ! echo hello | grep h >/dev/null 2>&1 ; echo $? 8 | 9 | ! true ; echo $? 10 | ! false; echo $? 11 | 12 | ! (false) ; echo $? 13 | ! (true); echo $? 14 | 15 | ! true | false ; echo $? 16 | ! false | true ; echo $? 17 | 18 | ! (true | false) ; echo $? 19 | ! (false | true) ; echo $? 20 | -------------------------------------------------------------------------------- /shell/ash_test/ash-misc/last_amp.right: -------------------------------------------------------------------------------- 1 | 3 2 | End 3 | -------------------------------------------------------------------------------- /shell/ash_test/ash-misc/last_amp.tests: -------------------------------------------------------------------------------- 1 | $THIS_SH -c 'echo 3&' 2 | d=`date` 3 | while test "`date`" = "$d"; do true; done 4 | d1=`date` 5 | $THIS_SH -c 'sleep 1&' 6 | d2=`date` 7 | test "$d1" = "$d2" || echo BAD 8 | echo End 9 | -------------------------------------------------------------------------------- /shell/ash_test/ash-misc/nulltick1.right: -------------------------------------------------------------------------------- 1 | Test 1 2 | Test 2 3 | Done 4 | -------------------------------------------------------------------------------- /shell/ash_test/ash-misc/nulltick1.tests: -------------------------------------------------------------------------------- 1 | echo Test ` ` 1 2 | echo Test `../sourced.sh 2 | PATH="..:$PATH" 3 | . sourced.sh 4 | rm ../sourced.sh 5 | echo Done 6 | -------------------------------------------------------------------------------- /shell/ash_test/ash-quoting/dollar_squote_bash1.right: -------------------------------------------------------------------------------- 1 | a b 2 | a 3 | b c 4 | def 5 | a'b c"d e\f 6 | a3b c3b e33f 7 | a\80b c08b 8 | a3b c30b 9 | x y 10 | -------------------------------------------------------------------------------- /shell/ash_test/ash-quoting/dollar_squote_bash1.tests: -------------------------------------------------------------------------------- 1 | echo $'a\tb' 2 | echo $'a\nb' $'c\nd''ef' 3 | echo $'a\'b' $'c\"d' $'e\\f' 4 | echo $'a\63b' $'c\063b' $'e\0633f' 5 | echo $'a\80b' $'c\608b' 6 | echo $'a\x33b' $'c\x330b' 7 | echo $'x\x9y' 8 | -------------------------------------------------------------------------------- /shell/ash_test/ash-read/read_REPLY.right: -------------------------------------------------------------------------------- 1 | test 1: | abc1 def | 2 | test 2: | \abc2 d\ef | 3 | test 3: |abc3 def| 4 | test 4: |\abc4 d\ef| 5 | Done 6 | -------------------------------------------------------------------------------- /shell/ash_test/ash-read/read_REPLY.tests: -------------------------------------------------------------------------------- 1 | echo ' \abc1 d\ef ' | ( read ; echo "test 1: |$REPLY|" ) 2 | echo ' \abc2 d\ef ' | ( read -r ; echo "test 2: |$REPLY|" ) 3 | echo ' \abc3 d\ef ' | ( read REPLY; echo "test 3: |$REPLY|" ) 4 | echo ' \abc4 d\ef ' | ( read -r REPLY; echo "test 4: |$REPLY|" ) 5 | echo Done 6 | -------------------------------------------------------------------------------- /shell/ash_test/ash-read/read_ifs.right: -------------------------------------------------------------------------------- 1 | test 1: .a. .b. .c. 2 | test 2: .a. .b. .c. 3 | test 3: .a. .. .b,c. 4 | test 4: .a. .. .b,c. 5 | test 5: .a. .. .c. 6 | test 6: .a. .. .c. .d. 7 | test 7: .a. .. .b,c,d , ,. 8 | test 8: .. .a. .b. .c. 9 | test 9: .a. .b. .c. .. 10 | test A: .. .a. .. .b. .c. 11 | -------------------------------------------------------------------------------- /shell/ash_test/ash-read/read_n.right: -------------------------------------------------------------------------------- 1 | test 2 | tes 3 | tes 4 | -------------------------------------------------------------------------------- /shell/ash_test/ash-read/read_n.tests: -------------------------------------------------------------------------------- 1 | echo 'test' | (read reply; echo "$reply") 2 | echo 'test' | (read -n 3 reply; echo "$reply") 3 | echo 'test' | (read -n3 reply; echo "$reply") 4 | -------------------------------------------------------------------------------- /shell/ash_test/ash-read/read_r.right: -------------------------------------------------------------------------------- 1 | testbest 2 | test\ 3 | -------------------------------------------------------------------------------- /shell/ash_test/ash-read/read_r.tests: -------------------------------------------------------------------------------- 1 | echo -e 'test\\\nbest' | (read reply; echo "$reply") 2 | echo -e 'test\\\nbest' | (read -r reply; echo "$reply") 3 | -------------------------------------------------------------------------------- /shell/ash_test/ash-read/read_t.right: -------------------------------------------------------------------------------- 1 | >< 2 | >< 3 | >test< 4 | >test< 5 | -------------------------------------------------------------------------------- /shell/ash_test/ash-read/read_t.tests: -------------------------------------------------------------------------------- 1 | # bash 3.2 outputs: 2 | 3 | # >< 4 | { echo -n 'te'; sleep 2; echo 'st'; } | (read -t 1 reply; echo ">$reply<") 5 | # >< 6 | { sleep 2; echo 'test'; } | (read -t 1 reply; echo ">$reply<") 7 | # >test< 8 | { echo -n 'te'; sleep 1; echo 'st'; } | (read -t 2 reply; echo ">$reply<") 9 | # >test< 10 | { sleep 1; echo 'test'; } | (read -t 2 reply; echo ">$reply<") 11 | -------------------------------------------------------------------------------- /shell/ash_test/ash-redir/redir.right: -------------------------------------------------------------------------------- 1 | TEST 2 | -------------------------------------------------------------------------------- /shell/ash_test/ash-redir/redir.tests: -------------------------------------------------------------------------------- 1 | # test: closed fds should stay closed 2 | exec 1>&- 3 | echo TEST >TEST 4 | echo JUNK # lost: stdout is closed 5 | cat TEST >&2 6 | rm TEST 7 | -------------------------------------------------------------------------------- /shell/ash_test/ash-redir/redir2.right: -------------------------------------------------------------------------------- 1 | OK 2 | -------------------------------------------------------------------------------- /shell/ash_test/ash-redir/redir2.tests: -------------------------------------------------------------------------------- 1 | # ash once couldn't redirect above fd#9 2 | exec 1>/dev/null 3 | (echo LOST1 >&22) 22>&1 4 | (echo LOST2 >&22) 22>&1 5 | (echo OK >&22) 22>&2 6 | -------------------------------------------------------------------------------- /shell/ash_test/ash-redir/redir3.right: -------------------------------------------------------------------------------- 1 | TEST 2 | ./redir3.tests: line 4: 9: Bad file descriptor 3 | Output to fd#9: 1 4 | -------------------------------------------------------------------------------- /shell/ash_test/ash-redir/redir3.tests: -------------------------------------------------------------------------------- 1 | # redirects to closed descriptors should not leave these descriptors" 2 | # open afterwards 3 | echo TEST 9>/dev/null 4 | echo MUST ERROR OUT >&9 5 | echo "Output to fd#9: $?" 6 | -------------------------------------------------------------------------------- /shell/ash_test/ash-redir/redir4.right: -------------------------------------------------------------------------------- 1 | OK 2 | -------------------------------------------------------------------------------- /shell/ash_test/ash-redir/redir5.right: -------------------------------------------------------------------------------- 1 | ./redir5.tests: line 2: 10: Bad file descriptor 2 | OK 3 | -------------------------------------------------------------------------------- /shell/ash_test/ash-redir/redir5.tests: -------------------------------------------------------------------------------- 1 | # ash uses fd 10 (usually) for reading the script 2 | echo LOST >&10 3 | echo OK 4 | -------------------------------------------------------------------------------- /shell/ash_test/ash-redir/redir6.right: -------------------------------------------------------------------------------- 1 | Hello 2 | OK 3 | -------------------------------------------------------------------------------- /shell/ash_test/ash-redir/redir6.tests: -------------------------------------------------------------------------------- 1 | # we had a bug where this would hang 2 | (head -n 1 unicode.sh 7 | echo -e 'echo Ok >uni\x81code' >>unicode.sh 8 | echo -e 'cat uni\x81code' >>unicode.sh 9 | echo -e 'cat uni?code' >>unicode.sh 10 | . unicode.sh 11 | rm uni*code* 12 | echo Done 13 | -------------------------------------------------------------------------------- /shell/ash_test/ash-redir/redir8.right: -------------------------------------------------------------------------------- 1 | Ok 2 | Ok 3 | Done 4 | -------------------------------------------------------------------------------- /shell/ash_test/ash-redir/redir8.tests: -------------------------------------------------------------------------------- 1 | # Chars above 0x7f are used as special codes. 2 | # 0x81 is CTLESC (see ash.c). 3 | # The bug was that quoting and unquoting of them 4 | # was out of sync for redirect filenames. 5 | 6 | # Subcase when redirect filename is specified in a variable. 7 | 8 | >unicode.sh 9 | echo -e 'v=uni\x81code' >>unicode.sh 10 | echo -e 'echo Ok >"$v"' >>unicode.sh 11 | echo -e 'cat uni\x81code' >>unicode.sh 12 | echo -e 'cat uni?code' >>unicode.sh 13 | . unicode.sh 14 | rm uni*code* 15 | echo Done 16 | -------------------------------------------------------------------------------- /shell/ash_test/ash-signals/reap1.right: -------------------------------------------------------------------------------- 1 | Ok 2 | -------------------------------------------------------------------------------- /shell/ash_test/ash-signals/reap1.tests: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Must not find us alive 4 | { sleep 2; kill -9 $$; } 2>/dev/null & 5 | 6 | sleep 1 & 7 | PID=$! 8 | 9 | # We must exit the loop in one second. 10 | # We had bug 5304: builtins never waited for exited children 11 | while kill -0 $PID >/dev/null 2>&1; do 12 | true 13 | done 14 | echo Ok 15 | -------------------------------------------------------------------------------- /shell/ash_test/ash-signals/savetrap.right: -------------------------------------------------------------------------------- 1 | trap -- 'echo Exiting' EXIT 2 | trap -- 'echo WINCH!' WINCH 3 | trap -- 'echo Exiting' EXIT 4 | trap -- 'echo WINCH!' WINCH 5 | trap -- 'echo Exiting' EXIT 6 | trap -- 'echo WINCH!' WINCH 7 | Done 8 | Exiting 9 | -------------------------------------------------------------------------------- /shell/ash_test/ash-signals/savetrap.tests: -------------------------------------------------------------------------------- 1 | trap 'echo Exiting' EXIT 2 | trap 'echo WINCH!' SIGWINCH 3 | v=` trap ` 4 | echo "$v" 5 | v=$( trap ) 6 | echo "$v" 7 | v=`trap` 8 | echo "$v" 9 | echo Done 10 | -------------------------------------------------------------------------------- /shell/ash_test/ash-signals/signal1.right: -------------------------------------------------------------------------------- 1 | got signal 2 | trap -- 'echo got signal' USR1 3 | sent 1 signal 4 | got signal 5 | wait interrupted 6 | trap -- 'echo got signal' USR1 7 | sent 2 signal 8 | got signal 9 | wait interrupted 10 | trap -- 'echo got signal' USR1 11 | sent 3 signal 12 | got signal 13 | wait interrupted 14 | trap -- 'echo got signal' USR1 15 | sent 4 signal 16 | got signal 17 | wait interrupted 18 | trap -- 'echo got signal' USR1 19 | sent 5 signal 20 | sleep completed 21 | -------------------------------------------------------------------------------- /shell/ash_test/ash-signals/signal2.right: -------------------------------------------------------------------------------- 1 | child sleeps 2 | child exits as expected 3 | parent exits 4 | -------------------------------------------------------------------------------- /shell/ash_test/ash-signals/signal2.tests: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | $THIS_SH -c ' 4 | cleanup() { 5 | echo "child exits as expected" 6 | exit 7 | } 8 | trap cleanup HUP 9 | echo "child sleeps" 10 | sleep 1 11 | echo "BAD exit from child!" 12 | ' & 13 | 14 | child=$! 15 | sleep 0.1 # let child install handler first 16 | kill -HUP $child 17 | wait 18 | echo "parent exits" 19 | -------------------------------------------------------------------------------- /shell/ash_test/ash-signals/signal3.right: -------------------------------------------------------------------------------- 1 | child sleeps 2 | child got HUP 3 | child exits 4 | parent exits 5 | -------------------------------------------------------------------------------- /shell/ash_test/ash-signals/signal3.tests: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | $THIS_SH -c ' 4 | hup() { 5 | echo "child got HUP" 6 | } 7 | trap hup HUP 8 | echo "child sleeps" 9 | sleep 1 10 | echo "child exits" 11 | ' & 12 | 13 | child=$! 14 | sleep 0.1 # let child install handler first 15 | kill -HUP $child 16 | wait 17 | echo "parent exits" 18 | -------------------------------------------------------------------------------- /shell/ash_test/ash-standalone/noexec_gets_no_env.right: -------------------------------------------------------------------------------- 1 | VAR7=VAL 2 | 0 3 | VAR8=VAL 4 | 0 5 | -------------------------------------------------------------------------------- /shell/ash_test/ash-standalone/noexec_gets_no_env.tests: -------------------------------------------------------------------------------- 1 | export VAR7=VAL 2 | env | grep ^VAR7= 3 | echo $? 4 | VAR8=VAL env | grep ^VAR8= 5 | echo $? 6 | -------------------------------------------------------------------------------- /shell/ash_test/ash-standalone/nofork_trashes_getopt.right: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /shell/ash_test/ash-standalone/nofork_trashes_getopt.tests: -------------------------------------------------------------------------------- 1 | # In this test, rm is NOFORK and it modifies getopt internal state 2 | rm -f non_existent_file 3 | # Subsequent hexdump is run as NOEXEC, and thus still uses this state 4 | hexdump &1 9 | echo "should be empty: '$VAR'" 10 | -------------------------------------------------------------------------------- /shell/ash_test/ash-vars/var_posix1.right: -------------------------------------------------------------------------------- 1 | abcdcd 2 | abcdcd 3 | abcdcd 4 | cdcd 5 | babcdcd 6 | babcdcd 7 | ababcdcd 8 | 9 | ababcd 10 | ababcd 11 | ababcd 12 | abab 13 | ababcdc 14 | ababcdc 15 | ababcdcd 16 | 17 | end 18 | -------------------------------------------------------------------------------- /shell/ash_test/ash-vars/var_posix1.tests: -------------------------------------------------------------------------------- 1 | var=ababcdcd 2 | 3 | echo ${var#ab} 4 | echo ${var##ab} 5 | echo ${var#a*b} 6 | echo ${var##a*b} 7 | echo ${var#?} 8 | echo ${var##?} 9 | echo ${var#*} 10 | echo ${var##*} 11 | 12 | echo ${var%cd} 13 | echo ${var%%cd} 14 | echo ${var%c*d} 15 | echo ${var%%c*d} 16 | echo ${var%?} 17 | echo ${var%%?} 18 | echo ${var%*} 19 | echo ${var%%*} 20 | 21 | echo end 22 | -------------------------------------------------------------------------------- /shell/hush_test/.gitignore: -------------------------------------------------------------------------------- 1 | *.fail 2 | *.xx 3 | 4 | /hush 5 | -------------------------------------------------------------------------------- /shell/hush_test/hush-bugs/and_or_and_backgrounding.right: -------------------------------------------------------------------------------- 1 | First 2 | Second 3 | Third 4 | Done 5 | -------------------------------------------------------------------------------- /shell/hush_test/hush-bugs/export_exp.right: -------------------------------------------------------------------------------- 1 | aa0 bb0 2 | a=aa0 b=bb0 3 | aa1 bb1 4 | a=aa1 b=bb1 5 | zzz=zzz 6 | zz=* 7 | Done 8 | -------------------------------------------------------------------------------- /shell/hush_test/hush-bugs/export_exp.tests: -------------------------------------------------------------------------------- 1 | v="a=aa0 b=bb0" 2 | # only 1st arg should be expanded in multiple words 3 | export $v c=$v 4 | echo $a $b 5 | echo $c 6 | 7 | # only 1st arg should be expanded in multiple words 8 | export `echo a=aa1 b=bb1` c=`echo a=aa1 b=bb1` 9 | echo $a $b 10 | echo $c 11 | 12 | >zz=zz 13 | >zzz=zzz 14 | # only 1st arg should be globbed 15 | export zzz* zz=* 16 | env | grep ^zz | sort 17 | rm -rf zz=zz zzz=zzz 18 | 19 | echo Done 20 | -------------------------------------------------------------------------------- /shell/hush_test/hush-glob/glob1.right: -------------------------------------------------------------------------------- 1 | glob1.tests 2 | glob1.tests 3 | -------------------------------------------------------------------------------- /shell/hush_test/hush-glob/glob1.tests: -------------------------------------------------------------------------------- 1 | echo *glob1?t[e]sts* 2 | echo "glob1"?'t'[e]s* 3 | -------------------------------------------------------------------------------- /shell/hush_test/hush-glob/glob_and_assign.right: -------------------------------------------------------------------------------- 1 | ZVAR=z.tmp ZVAR=*.tmp ZVAR=[z].tmp 2 | ZVAR=z.tmp ZVAR=*.tmp ZVAR=[z].tmp 3 | *.tmp 4 | ZVAR=z.tmp z.tmp 5 | ZVAR=z.tmp ZVAR=*.tmp ZVAR=[z].tmp 6 | ZVAR=z.tmp ZVAR=*.tmp ZVAR=[z].tmp 7 | -------------------------------------------------------------------------------- /shell/hush_test/hush-glob/glob_and_assign.tests: -------------------------------------------------------------------------------- 1 | >ZVAR=z.tmp 2 | >z.tmp 3 | ZVAR=*.tmp echo ZVAR=*.tmp "ZVAR=*.tmp" "ZVAR=[z].tmp" 4 | ZVAR=*.tmp /bin/echo ZVAR=*.tmp "ZVAR=*.tmp" "ZVAR=[z].tmp" 5 | ZVAR=*.tmp 6 | echo "$ZVAR" 7 | echo $ZVAR 8 | echo ZVAR=*.tmp "ZVAR=*.tmp" "ZVAR=[z].tmp" 9 | /bin/echo ZVAR=*.tmp "ZVAR=*.tmp" "ZVAR=[z].tmp" 10 | rm ZVAR=z.tmp z.tmp 11 | -------------------------------------------------------------------------------- /shell/hush_test/hush-glob/glob_redir.right: -------------------------------------------------------------------------------- 1 | z.tmp: 2 | ?.tmp: TEST 3 | -------------------------------------------------------------------------------- /shell/hush_test/hush-glob/glob_redir.tests: -------------------------------------------------------------------------------- 1 | # Redirections are not globbed. 2 | # bash: 3 | # if run as "sh", they are not globbed, but 4 | # if run as "bash", they are! 5 | >z.tmp 6 | echo TEST >?.tmp 7 | echo 'z.tmp:' `cat 'z.tmp'` 8 | echo '?.tmp:' `cat '?.tmp'` 9 | rm 'z.tmp' '?.tmp' 10 | -------------------------------------------------------------------------------- /shell/hush_test/hush-leak/leak_argv1.right: -------------------------------------------------------------------------------- 1 | Measuring memory leak... 2 | Ok 3 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/and-or.right: -------------------------------------------------------------------------------- 1 | a1 2 | a4 3 | b1 4 | b3 5 | b4 6 | b6 7 | c4 8 | c5 9 | c7 10 | c8 11 | ff1 12 | ff3 13 | ft2 14 | ft3 15 | tf2 16 | tf3 17 | tt2 18 | tt4 19 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/assignment1.right: -------------------------------------------------------------------------------- 1 | if1:0 2 | while1:0 3 | until1:0 4 | if2:0 5 | while2:0 6 | until2:0 7 | if3:0 8 | while3:0 9 | until3:0 10 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/assignment2.rigth: -------------------------------------------------------------------------------- 1 | hush: can't exec 'a=b': No such file or directory 2 | 1 3 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/assignment2.tests: -------------------------------------------------------------------------------- 1 | # This must not be interpreted as an assignment 2 | a''=b true 3 | echo $? 4 | # (buglet: $? should be 127. it is currently 1) 5 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/break1.right: -------------------------------------------------------------------------------- 1 | A 2 | OK:0 3 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/break1.tests: -------------------------------------------------------------------------------- 1 | while true; do echo A; break; echo B; done 2 | echo OK:$? 3 | 4 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/break2.right: -------------------------------------------------------------------------------- 1 | A 2 | AA 3 | OK:0 4 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/break2.tests: -------------------------------------------------------------------------------- 1 | while true; do 2 | echo A 3 | while true; do echo AA; break 2; echo BB; done 4 | echo B 5 | done 6 | echo OK:$? 7 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/break3.right: -------------------------------------------------------------------------------- 1 | A 2 | OK:0 3 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/break3.tests: -------------------------------------------------------------------------------- 1 | v=break; while true; do echo A; $v; echo B; break; echo C; done 2 | echo OK:$? 3 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/break4.right: -------------------------------------------------------------------------------- 1 | A 2 | AA 3 | TRUE 4 | A 5 | AA 6 | OK:0 7 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/break4.tests: -------------------------------------------------------------------------------- 1 | cond=true 2 | while $cond; do 3 | echo A 4 | if test "$cond" = true; then 5 | cond='echo TRUE' 6 | else 7 | cond=false 8 | fi 9 | while true; do echo AA; continue 2; echo BB; done 10 | echo B 11 | done 12 | echo OK:$? 13 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/break5.right: -------------------------------------------------------------------------------- 1 | A 2 | B 3 | 0 4 | A:a 5 | B 6 | D 7 | A:b 8 | B 9 | D 10 | A:c 11 | B 12 | D 13 | 0 14 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/break5.tests: -------------------------------------------------------------------------------- 1 | while true; do echo A; { echo B; break; echo C; }; echo D; done 2 | echo $? 3 | for v in a b c; do echo A:$v; (echo B; break; echo C); echo D; done 4 | echo $? 5 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/builtin1.right: -------------------------------------------------------------------------------- 1 | VARIABLE=export 2 | OK:0 3 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/builtin1.tests: -------------------------------------------------------------------------------- 1 | # builtins, unlike keywords like "while", can be constructed 2 | # with substitutions 3 | VARIABLE=export 4 | $VARIABLE VARIABLE 5 | env | grep ^VARIABLE 6 | echo OK:$? 7 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/case1.right: -------------------------------------------------------------------------------- 1 | OK_1 2 | OK_1 3 | OK_21 4 | OK_22 5 | OK_23 6 | OK_31 7 | OK_32 8 | OK_41 9 | OK_42 10 | OK_43 11 | OK_44 12 | OK_51 13 | OK_52 14 | OK_53 15 | OK_sub1 16 | OK_sub2 17 | OK_sub3 18 | OK_sub4 19 | OK_sub5 20 | OK_sub6 21 | OK_esac1 22 | Done 23 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/colon.right: -------------------------------------------------------------------------------- 1 | 0 2 | OK: 0 3 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/colon.tests: -------------------------------------------------------------------------------- 1 | false 2 | : 3 | echo $? 4 | (while :; do exit; done) 5 | echo OK: $? 6 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/compound.right: -------------------------------------------------------------------------------- 1 | new group 2 | 0 3 | 1 4 | 2 5 | 3 6 | 4 7 | 5 8 | 6 9 | new group 10 | new group 11 | 0 12 | 1 13 | 2 14 | 3 15 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/compound.tests: -------------------------------------------------------------------------------- 1 | echo new group 2 | echo 0; { :; } 3 | echo 1; { : ;} 4 | echo 2; ({ :; }) 5 | echo 3; ({ : ;}) 6 | echo 4; ( : ) 7 | echo 5; ( :; ) 8 | echo 6; ( : ;) 9 | # not sure if POSIX requires these, but bash accepts them ... 10 | #echo 7; {( : )} 11 | #echo 8; {( :; )} 12 | #echo 9; {( : ;)} 13 | 14 | echo new group 15 | #echo 0; {(:);} 16 | 17 | echo new group 18 | echo 0; (:) 19 | echo 1; (:;) 20 | echo 2; (:); 21 | echo 3; (:;); 22 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/continue1.right: -------------------------------------------------------------------------------- 1 | A:a 2 | A:b 3 | A:c 4 | OK1 5 | A:a 6 | A:b 7 | A:c 8 | OK2 9 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/continue1.tests: -------------------------------------------------------------------------------- 1 | for v in a b c; do echo A:$v; continue 666; done 2 | echo OK1 3 | for v in a b c; do echo A:$v; continue 666; done 4 | echo OK2 5 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/continue2.right: -------------------------------------------------------------------------------- 1 | Ok:1 2 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/continue2.tests: -------------------------------------------------------------------------------- 1 | e='' 2 | (while test $e && exit 1; true; do e=1; continue; done) 3 | echo Ok:$? 4 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/continue3.right: -------------------------------------------------------------------------------- 1 | 0 2 | 0 3 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/continue3.tests: -------------------------------------------------------------------------------- 1 | # Test that "continue" does affect exitcode (sets to 0) 2 | e='' 3 | while echo $?; test $e && exit; true; do e=1; false; continue; done 4 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/empty_args.right: -------------------------------------------------------------------------------- 1 | Null 0th arg: 2 | hush: can't execute '': No such file or directory 3 | 127 4 | Null 1st arg: 5 | 0 6 | Null arg in exec: 7 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/empty_args.tests: -------------------------------------------------------------------------------- 1 | echo Null 0th arg: 2 | "" 3 | echo $? 4 | echo Null 1st arg: 5 | # printf without args would print usage info 6 | printf "" 7 | echo $? 8 | echo Null arg in exec: 9 | exec printf "" 10 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/empty_for.right: -------------------------------------------------------------------------------- 1 | OK: 0 2 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/empty_for.tests: -------------------------------------------------------------------------------- 1 | false 2 | for a in; do echo "HELLO"; done 3 | echo OK: $? 4 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/empty_for2.right: -------------------------------------------------------------------------------- 1 | PARAM:abc 2 | PARAM:d e 3 | PARAM:123 4 | OK: 0 5 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/empty_for2.tests: -------------------------------------------------------------------------------- 1 | if test $# = 0; then 2 | exec "$THIS_SH" $0 abc "d e" 123 3 | fi 4 | false 5 | for v; do echo "PARAM:$v"; done 6 | echo OK: $? 7 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/env_and_func.right: -------------------------------------------------------------------------------- 1 | var=val 2 | var=old 3 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/env_and_func.tests: -------------------------------------------------------------------------------- 1 | var=old 2 | f() { echo "var=$var"; } 3 | var=val f 4 | echo "var=$var" 5 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/exec.right: -------------------------------------------------------------------------------- 1 | pass fd out open 2 | pass fd out dup 3 | pass fd out close 4 | pass fd in open 5 | pass fd in dup 6 | pass fd in close 7 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/exit1.right: -------------------------------------------------------------------------------- 1 | Once 2 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/exit1.tests: -------------------------------------------------------------------------------- 1 | trap "echo Not shown" EXIT 2 | (exit) # must be silent 3 | trap "echo Once; exit" EXIT 4 | { exit; } 5 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/export-n.right: -------------------------------------------------------------------------------- 1 | export aaa1="'''" 2 | export aaa2='' 3 | export aaa3="'''"'abc' 4 | export aaa8='8' 5 | aaa9=9 6 | aaa10=10 7 | Nothing: 8 | Nothing: 9 | Nothing: 10 | Done 11 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/export.right: -------------------------------------------------------------------------------- 1 | export aaa1="'''" 2 | export aaa2='' 3 | export aaa3="'''"'abc' 4 | export aaa4='def'"'''" 5 | export aaa5="'''"'abc'"'''"'def'"'''" 6 | Done 7 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/export.tests: -------------------------------------------------------------------------------- 1 | export aaa1="'''" 2 | export aaa2="" 3 | export aaa3="'''abc" 4 | export aaa4="def'''" 5 | export aaa5="'''abc'''def'''" 6 | export | grep aaa.= 7 | echo Done 8 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/for_with_bslashes.right: -------------------------------------------------------------------------------- 1 | a 2 | b\c 3 | b\\c 4 | b"c 5 | b'c 6 | b$c 7 | b`true`c 8 | Zero:0 9 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/for_with_bslashes.tests: -------------------------------------------------------------------------------- 1 | # UNFIXED BUG. 2 | # commented-out words contain ^C character. 3 | # It's a SPECIAL_VAR_SYMBOL, for now hush does not escape it. 4 | # When it is fixed, update this test. 5 | 6 | for a in 'a' 'b\c' 'b\\c' 'b"c' "b'c" 'b$c' 'b`true`c' ### 'b#c' 7 | do 8 | echo $a 9 | done 10 | echo Zero:$? 11 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/for_with_keywords.right: -------------------------------------------------------------------------------- 1 | do 2 | done 3 | then 4 | OK: 0 5 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/for_with_keywords.tests: -------------------------------------------------------------------------------- 1 | for if in do done then; do echo $if; done 2 | echo OK: $? 3 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/func1.right: -------------------------------------------------------------------------------- 1 | Hello 2 | Zero: 0 3 | One: 1 Param1: World 4 | Zero: 0 Param1: Restored 5 | Multi line function 6 | One: 1 7 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/func1.tests: -------------------------------------------------------------------------------- 1 | f() { echo Hello; } 2 | g () { echo One: $# Param1: $1; } 3 | h ( ) 4 | { 5 | echo -n 'Multi ' && echo -n 'line ' 6 | echo function 7 | false 8 | } 9 | 10 | f 11 | echo Zero: $? 12 | set -- Restored 13 | { g World; } 14 | echo Zero: $? Param1: $1 15 | ( h ) 16 | echo One: $? 17 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/func2.right: -------------------------------------------------------------------------------- 1 | First 0 2 | Second 0 3 | First 1 4 | Second 1 5 | Done 6 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/func2.tests: -------------------------------------------------------------------------------- 1 | i=0 2 | while test $i != 2; do 3 | f() { echo First $i; } 4 | f 5 | f() { echo Second $i; } 6 | f 7 | : $((i++)) 8 | done 9 | echo Done 10 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/func3.right: -------------------------------------------------------------------------------- 1 | One:1 2 | Zero:0 3 | One:1 4 | Five:5 5 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/func3.tests: -------------------------------------------------------------------------------- 1 | f() { false; return; echo BAD; }; 2 | { f; echo One:$?; }; echo Zero:$? 3 | 4 | f() { false; return; }; 5 | f; echo One:$? 6 | 7 | f() { return 5; }; 8 | f; echo Five:$? 9 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/func4.right: -------------------------------------------------------------------------------- 1 | 24 2 | Done 3 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/func4.tests: -------------------------------------------------------------------------------- 1 | func() { 2 | eval "echo \"\${val_${1}}\"" 3 | } 4 | 5 | val_x=24 6 | (func x) 7 | echo Done 8 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/func5.right: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 3 4 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/func5.tests: -------------------------------------------------------------------------------- 1 | f() { echo $1; } 2 | f 1 3 | 4 | # hush fails on this syntax, but i've never seen anyone use it ... 5 | #f() ( echo $1; ) 6 | f 2 7 | 8 | #f() ( echo $1 ) 9 | f 3 10 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/func_args1.right: -------------------------------------------------------------------------------- 1 | params: a b c 2 | 'f 1 2 3' called 3 | params: a b c 4 | 'f 1 2 3' called 5 | params: a b c 6 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/func_args1.tests: -------------------------------------------------------------------------------- 1 | # UNFIXED BUG 2 | 3 | f() { echo "'f $1 $2 $3' called"; } 4 | 5 | set -- a b c 6 | echo "params: $1 $2 $3" 7 | f 1 2 3 8 | echo "params: $1 $2 $3" 9 | true | f 1 2 3 10 | echo "params: $1 $2 $3" 11 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/func_local1.right: -------------------------------------------------------------------------------- 1 | z=a 2 | z=z 3 | Done 4 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/func_local1.tests: -------------------------------------------------------------------------------- 1 | export z=z 2 | f() { local z=a; env | grep ^z; } 3 | f 4 | env | grep ^z 5 | echo Done 6 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/func_local2.right: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 1 4 | 2 5 | 1 6 | 1 7 | 2 8 | 2 9 | 3 10 | 2 11 | 2 12 | 3 13 | 1 14 | Done 15 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/func_local2.tests: -------------------------------------------------------------------------------- 1 | x=1 2 | f() { echo $x; local x=$((x+1)); echo $x; } 3 | g() { f; echo $x; f; local x=$((x+1)); f; echo $x; f; } 4 | f 5 | g 6 | echo $x 7 | echo Done 8 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/heredoc1.right: -------------------------------------------------------------------------------- 1 | qwe 2 | asd 3 | 123 4 | 456 5 | Ok 6 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/heredoc1.tests: -------------------------------------------------------------------------------- 1 | cat <<000; cat <"$0.tmp" 3 | yes "123456789 123456789 123456789 123456789" | head -3000 >>"$0.tmp" 4 | echo 'HERE' >>"$0.tmp" 5 | 6 | yes "123456789 123456789 123456789 123456789" | head -3000 | md5sum 7 | . "$0.tmp" 8 | rm "$0.tmp" 9 | echo End 10 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/if_false_exitcode.right: -------------------------------------------------------------------------------- 1 | Ok:0 2 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/if_false_exitcode.tests: -------------------------------------------------------------------------------- 1 | if false; then echo Bad; fi 2 | echo Ok:$? 3 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/nommu1.right: -------------------------------------------------------------------------------- 1 | Ok 2 | Ok 3 | Ok 4 | Ok 5 | Ok 6 | Ok 7 | Done 8 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/nommu1.tests: -------------------------------------------------------------------------------- 1 | (echo \ 2 | Ok) 3 | ( (echo \ 4 | Ok) ) 5 | ( ( (echo \ 6 | Ok) ) ) 7 | 8 | (echo \Ok) 9 | ( (echo \Ok) ) 10 | ( ( (echo \Ok) ) ) 11 | 12 | echo Done 13 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/nommu2.right: -------------------------------------------------------------------------------- 1 | Ok 2 | Ok 3 | Ok 4 | Ok 5 | Done 6 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/nommu2.tests: -------------------------------------------------------------------------------- 1 | echo Not shown | if true; then echo $(echo Ok); fi 2 | echo Not shown | if true; then echo `echo Ok`; fi 3 | echo Not shown | ( if true; then echo $(echo Ok); fi ) 4 | echo Not shown | ( if true; then echo `echo Ok`; fi ) 5 | echo Done 6 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/opts1.right: -------------------------------------------------------------------------------- 1 | Param1: >-10qwertyuiop< 2 | Done 3 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/opts1.tests: -------------------------------------------------------------------------------- 1 | if test $# = 0; then 2 | exec "$THIS_SH" $0 -10qwertyuiop 3 | fi 4 | echo "Param1: >$1<" 5 | echo Done 6 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/pid.right: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/pid.tests: -------------------------------------------------------------------------------- 1 | test `(echo $$)` = `echo $$`; echo $? 2 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/read.right: -------------------------------------------------------------------------------- 1 | read 2 | cat 3 | echo "REPLY=$REPLY" 4 | REPLY=exec /dev/null 2 | echo Ok 3 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/redir3.right: -------------------------------------------------------------------------------- 1 | hush: can't open '/does/not/exist': No such file or directory 2 | One:1 3 | hush: can't open '/cant/be/created': No such file or directory 4 | One:1 5 | Ok 6 | hush: can't open '/cant/be/created': No such file or directory 7 | Zero:0 8 | hush: can't open '/cant/be/created': No such file or directory 9 | One:1 10 | hush: can't open '/cant/be/created': No such file or directory 11 | One:1 12 | hush: can't open '/cant/be/created': No such file or directory 13 | Zero:0 14 | Done 15 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/redir3.tests: -------------------------------------------------------------------------------- 1 | echo Error >/does/not/exist; echo One:$? 2 | t=BAD 3 | t=Ok >>/cant/be/created; echo One:$? 4 | echo $t 5 | ! >/cant/be/created; echo Zero:$? 6 | exec >/cant/be/created; echo One:$? 7 | exec /bin/true >/cant/be/created; echo One:$? 8 | ! exec /bin/true >/cant/be/created; echo Zero:$? 9 | echo Done 10 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/redir4.right: -------------------------------------------------------------------------------- 1 | shell_test 2 | \shell_test 3 | \shell_test 4 | \shell_test 5 | Here1 6 | Ok1 7 | Here2 8 | Ok2 9 | Here3 10 | Ok3 11 | Here4 12 | Ok4 13 | Now with variable refs 14 | shell_test_1 15 | \shell_test_1 16 | \shell_test_1 17 | \shell_test_1 18 | Done 19 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/redir5.right: -------------------------------------------------------------------------------- 1 | Backgrounded pipes shall have their stdin redirected to /dev/null 2 | Zero:0 3 | Zero:0 4 | Done 5 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/redir5.tests: -------------------------------------------------------------------------------- 1 | echo "Backgrounded pipes shall have their stdin redirected to /dev/null" 2 | 3 | # 1. bash does not redirect stdin to /dev/null if it is interactive. 4 | # hush does it always (this is allowed by standards). 5 | 6 | # 2. Failure will result in this script hanging 7 | 8 | cat & wait; echo Zero:$? 9 | 10 | # This does not work for bash! bash bug? 11 | cat | cat & wait; echo Zero:$? 12 | 13 | echo Done 14 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/redir6.right: -------------------------------------------------------------------------------- 1 | Testing multiple redirections to same fd 2 | Hello 3 | Done1 4 | Done2 5 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/redir6.tests: -------------------------------------------------------------------------------- 1 | echo "Testing multiple redirections to same fd" 2 | # bug was making us lose fd #1 after this: 3 | echo Hello >/dev/null 1>&2 4 | echo Done1 5 | echo Done2 >&2 6 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/shift.right: -------------------------------------------------------------------------------- 1 | ./shift.tests abc d e 2 | ./shift.tests d e 123 3 | ./shift.tests d e 123 4 | ./shift.tests 5 | ./shift.tests 6 | ./shift.tests 7 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/shift.tests: -------------------------------------------------------------------------------- 1 | if test $# = 0; then 2 | exec "$THIS_SH" $0 abc "d e" 123 3 | fi 4 | echo $0 $1 $2 5 | shift 6 | echo $0 $1 $2 7 | shift 999 8 | echo $0 $1 $2 9 | shift 2 10 | echo $0 $1 $2 11 | shift 2 12 | echo $0 $1 $2 13 | shift 14 | echo $0 $1 $2 15 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/sig_exitcode.right: -------------------------------------------------------------------------------- 1 | KILL 2 | 137:137 3 | KILL 4 | 0:0 5 | Done 6 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/sig_exitcode.tests: -------------------------------------------------------------------------------- 1 | exec 2>&1 2 | 3 | $THIS_SH -c 'kill -9 $$' 4 | echo 137:$? 5 | 6 | ! $THIS_SH -c 'kill -9 $$' 7 | echo 0:$? 8 | 9 | echo Done 10 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/syntax_err.right: -------------------------------------------------------------------------------- 1 | shown 2 | hush: syntax error: unterminated ' 3 | test 4 | not shown 5 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/syntax_err.tests: -------------------------------------------------------------------------------- 1 | echo shown 2 | echo test `echo 'aa` 3 | echo not shown 4 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/syntax_err_negate.right: -------------------------------------------------------------------------------- 1 | bash 3.2 fails this 2 | hush: syntax error: ! ! command 3 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/syntax_err_negate.tests: -------------------------------------------------------------------------------- 1 | echo bash 3.2 fails this 2 | ! ! true 3 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/until1.right: -------------------------------------------------------------------------------- 1 | 1 2 | 1 3 | Ok:0 4 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/until1.tests: -------------------------------------------------------------------------------- 1 | x=1 2 | until test "$x" = 4; do echo $x; x=4; done 3 | 4 | # We had a bug in multi-line form 5 | x=1 6 | until test "$x" = 4; do 7 | echo $x 8 | x=4 9 | done 10 | 11 | echo Ok:$? 12 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/while1.right: -------------------------------------------------------------------------------- 1 | OK:0 2 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/while1.tests: -------------------------------------------------------------------------------- 1 | while false; do echo NOT SHOWN; done 2 | echo OK:$? 3 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/while2.right: -------------------------------------------------------------------------------- 1 | Hello 2 | OK:0 3 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/while2.tests: -------------------------------------------------------------------------------- 1 | while echo Hello; false; do echo NOT SHOWN; done 2 | echo OK:$? 3 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/while_in_subshell.right: -------------------------------------------------------------------------------- 1 | OK: 0 2 | -------------------------------------------------------------------------------- /shell/hush_test/hush-misc/while_in_subshell.tests: -------------------------------------------------------------------------------- 1 | (while true; do exit; done) 2 | echo OK: $? 3 | -------------------------------------------------------------------------------- /shell/hush_test/hush-parsing/argv0.right: -------------------------------------------------------------------------------- 1 | OK 2 | -------------------------------------------------------------------------------- /shell/hush_test/hush-parsing/argv0.tests: -------------------------------------------------------------------------------- 1 | if test $# = 0; then 2 | exec "$THIS_SH" "$0" arg 3 | fi 4 | echo OK 5 | -------------------------------------------------------------------------------- /shell/hush_test/hush-parsing/brace1.right: -------------------------------------------------------------------------------- 1 | {abc} 2 | { 3 | } 4 | hush: can't execute '{cmd': No such file or directory 5 | hush: can't execute '{': No such file or directory 6 | hush: can't execute '{': No such file or directory 7 | Done: 127 8 | -------------------------------------------------------------------------------- /shell/hush_test/hush-parsing/brace1.tests: -------------------------------------------------------------------------------- 1 | echo {abc} 2 | echo { 3 | echo } 4 | {cmd 5 | ""{ 6 | {"" 7 | echo Done: $? 8 | -------------------------------------------------------------------------------- /shell/hush_test/hush-parsing/brace2.right: -------------------------------------------------------------------------------- 1 | {q,w} 2 | {q,w} 3 | Done 4 | -------------------------------------------------------------------------------- /shell/hush_test/hush-parsing/brace2.tests: -------------------------------------------------------------------------------- 1 | v='{q,w}' 2 | # Should not brace-expand v value 3 | echo $v 4 | echo "$v" 5 | echo Done 6 | -------------------------------------------------------------------------------- /shell/hush_test/hush-parsing/escape1.right: -------------------------------------------------------------------------------- 1 | \ 2 | a\b 3 | \\ 4 | c\\d 5 | -------------------------------------------------------------------------------- /shell/hush_test/hush-parsing/escape1.tests: -------------------------------------------------------------------------------- 1 | test "$CONFIG_FEATURE_FANCY_ECHO" = "y" || exit 77 2 | 3 | echo "\\" 4 | echo a"\\"b 5 | echo '\\' 6 | echo c'\\'d 7 | -------------------------------------------------------------------------------- /shell/hush_test/hush-parsing/escape2.right: -------------------------------------------------------------------------------- 1 | *?[a]* 2 | a*?[a]*b 3 | *?[a]* 4 | c*?[a]*d 5 | -------------------------------------------------------------------------------- /shell/hush_test/hush-parsing/escape2.tests: -------------------------------------------------------------------------------- 1 | echo "*?[a]*" 2 | echo a"*?[a]*"b 3 | echo '*?[a]*' 4 | echo c'*?[a]*'d 5 | -------------------------------------------------------------------------------- /shell/hush_test/hush-parsing/escape3.right: -------------------------------------------------------------------------------- 1 | v: a \ b \\ c \\\ d \\\\ e 2 | v: a \ b \\ c \\\ d \\\\ e 3 | Unquoted: 4 | .a. 5 | .\. 6 | .b. 7 | .\\. 8 | .c. 9 | .\\\. 10 | .d. 11 | .\\\\. 12 | .e. 13 | Quoted: 14 | .a. 15 | .\. 16 | .b. 17 | .\\. 18 | .c. 19 | .\\\. 20 | .d. 21 | .\\\\. 22 | .e. 23 | done 24 | -------------------------------------------------------------------------------- /shell/hush_test/hush-parsing/escape3.tests: -------------------------------------------------------------------------------- 1 | test "$CONFIG_FEATURE_FANCY_ECHO" = "y" || exit 77 2 | 3 | v='a \ b \\ c \\\ d \\\\ e' 4 | echo v: $v 5 | echo v: "$v" 6 | echo Unquoted: 7 | for a in $v; do echo .$a.; done 8 | echo Quoted: 9 | for a in $v; do echo ".$a."; done 10 | echo done 11 | -------------------------------------------------------------------------------- /shell/hush_test/hush-parsing/escape4.right: -------------------------------------------------------------------------------- 1 | Ok 2 | End 3 | -------------------------------------------------------------------------------- /shell/hush_test/hush-parsing/escape4.tests: -------------------------------------------------------------------------------- 1 | i\ 2 | f tr\ 3 | ue; th\ 4 | en echo "O\ 5 | k"; fi; echo "\ 6 | End" -------------------------------------------------------------------------------- /shell/hush_test/hush-parsing/escape5.right: -------------------------------------------------------------------------------- 1 | a\nb\nc\n 2 | a 3 | b 4 | c 5 | a\nb\nc\n 6 | a 7 | b 8 | c 9 | Done 10 | -------------------------------------------------------------------------------- /shell/hush_test/hush-parsing/escape5.tests: -------------------------------------------------------------------------------- 1 | v="a\nb\nc\n" 2 | echo "$v" 3 | printf "$v" 4 | v='a\nb\nc\n' 5 | echo "$v" 6 | printf "$v" 7 | echo Done 8 | -------------------------------------------------------------------------------- /shell/hush_test/hush-parsing/group1.right: -------------------------------------------------------------------------------- 1 | word} } 2 | -------------------------------------------------------------------------------- /shell/hush_test/hush-parsing/group1.tests: -------------------------------------------------------------------------------- 1 | { echo word} }; } 2 | -------------------------------------------------------------------------------- /shell/hush_test/hush-parsing/groups_and_keywords1.right: -------------------------------------------------------------------------------- 1 | Semicolons after } can be omitted 1: 2 | foo 3 | bar 4 | Semicolons after } can be omitted 2: 5 | foo 6 | bar 7 | Semicolons after fi can be omitted: 8 | foo 9 | bar 10 | baz 11 | Done:0 12 | -------------------------------------------------------------------------------- /shell/hush_test/hush-parsing/groups_and_keywords1.tests: -------------------------------------------------------------------------------- 1 | echo "Semicolons after } can be omitted 1:" 2 | if { echo foo; } then { echo bar; } fi 3 | 4 | echo "Semicolons after } can be omitted 2:" 5 | while { echo foo; } do { echo bar; break; } done 6 | 7 | echo "Semicolons after fi can be omitted:" 8 | while if echo foo; then echo bar; fi do echo baz; break; done 9 | 10 | echo Done:$? 11 | -------------------------------------------------------------------------------- /shell/hush_test/hush-parsing/negate.right: -------------------------------------------------------------------------------- 1 | ! printing ! 2 | 0 3 | 1 4 | 1 5 | 0 6 | 0 7 | 0 8 | ! 9 | a 10 | b 11 | c 12 | ! 1 13 | a 1 14 | b 1 15 | c 1 16 | ! 1 17 | a 1 18 | b 1 19 | c 1 20 | 0 21 | 0 22 | 0 23 | 0 24 | 1 25 | 1 26 | 1 27 | 1 28 | 0 29 | 0 30 | 0 31 | 0 32 | 1 33 | 1 34 | 1 35 | 1 36 | Done 37 | -------------------------------------------------------------------------------- /shell/hush_test/hush-parsing/noeol.right: -------------------------------------------------------------------------------- 1 | HELLO 2 | -------------------------------------------------------------------------------- /shell/hush_test/hush-parsing/noeol.tests: -------------------------------------------------------------------------------- 1 | # next line has no EOL! 2 | echo HELLO -------------------------------------------------------------------------------- /shell/hush_test/hush-parsing/noeol2.right: -------------------------------------------------------------------------------- 1 | 1 2 | -------------------------------------------------------------------------------- /shell/hush_test/hush-parsing/noeol2.tests: -------------------------------------------------------------------------------- 1 | # last line has no EOL! 2 | if true 3 | then 4 | echo 1 5 | else 6 | echo 2 7 | fi -------------------------------------------------------------------------------- /shell/hush_test/hush-parsing/noeol3.right: -------------------------------------------------------------------------------- 1 | hush: syntax error: unterminated " 2 | -------------------------------------------------------------------------------- /shell/hush_test/hush-parsing/noeol3.tests: -------------------------------------------------------------------------------- 1 | # last line has no EOL! 2 | echo "unterminated -------------------------------------------------------------------------------- /shell/hush_test/hush-parsing/process_subst.right: -------------------------------------------------------------------------------- 1 | TESTzzBEST 2 | TEST$(echo zz)BEST 3 | TEST'BEST 4 | -------------------------------------------------------------------------------- /shell/hush_test/hush-parsing/process_subst.tests: -------------------------------------------------------------------------------- 1 | echo "TEST`echo zz;echo;echo`BEST" 2 | echo "TEST`echo '$(echo zz)'`BEST" 3 | echo "TEST`echo "'"`BEST" 4 | -------------------------------------------------------------------------------- /shell/hush_test/hush-parsing/quote1.right: -------------------------------------------------------------------------------- 1 | '1' 2 | -------------------------------------------------------------------------------- /shell/hush_test/hush-parsing/quote1.tests: -------------------------------------------------------------------------------- 1 | a=1 2 | echo "'$a'" 3 | -------------------------------------------------------------------------------- /shell/hush_test/hush-parsing/quote2.right: -------------------------------------------------------------------------------- 1 | >1 2 | -------------------------------------------------------------------------------- /shell/hush_test/hush-parsing/quote2.tests: -------------------------------------------------------------------------------- 1 | a=1 2 | echo ">$a" 3 | -------------------------------------------------------------------------------- /shell/hush_test/hush-parsing/quote3.right: -------------------------------------------------------------------------------- 1 | Testing: in "" 2 | .. 3 | Testing: in '' 4 | .. 5 | Testing: in $empty 6 | Testing: in $empty"" 7 | .. 8 | Testing: in $empty'' 9 | .. 10 | Testing: in "$empty" 11 | .. 12 | Finished 13 | -------------------------------------------------------------------------------- /shell/hush_test/hush-parsing/quote3.tests: -------------------------------------------------------------------------------- 1 | empty='' 2 | 3 | echo 'Testing: in ""' 4 | for a in ""; do echo ".$a."; done 5 | 6 | echo 'Testing: in '"''" 7 | for a in ''; do echo ".$a."; done 8 | 9 | echo 'Testing: in $empty' 10 | for a in $empty; do echo ".$a."; done 11 | 12 | echo 'Testing: in $empty""' 13 | for a in $empty""; do echo ".$a."; done 14 | 15 | echo 'Testing: in $empty'"''" 16 | for a in $empty''; do echo ".$a."; done 17 | 18 | echo 'Testing: in "$empty"' 19 | for a in "$empty"; do echo ".$a."; done 20 | 21 | echo Finished 22 | -------------------------------------------------------------------------------- /shell/hush_test/hush-parsing/quote4.right: -------------------------------------------------------------------------------- 1 | a b 2 | -------------------------------------------------------------------------------- /shell/hush_test/hush-parsing/quote4.tests: -------------------------------------------------------------------------------- 1 | a_b='a b' 2 | echo "$a_b" 3 | -------------------------------------------------------------------------------- /shell/hush_test/hush-parsing/redir_space.right: -------------------------------------------------------------------------------- 1 | z1.tmp: 1 2 | z2.tmp: 1 3 | "z1.tmp z2.tmp": TEST 0 4 | -------------------------------------------------------------------------------- /shell/hush_test/hush-parsing/redir_space.tests: -------------------------------------------------------------------------------- 1 | v='z1.tmp z2.tmp' 2 | echo TEST >$v 3 | echo 'z1.tmp:' `cat 'z1.tmp' 2>/dev/null; echo $?` 4 | echo 'z2.tmp:' `cat 'z2.tmp' 2>/dev/null; echo $?` 5 | echo '"z1.tmp z2.tmp":' `cat 'z1.tmp z2.tmp' 2>/dev/null; echo $?` 6 | rm z*.tmp 7 | -------------------------------------------------------------------------------- /shell/hush_test/hush-parsing/starquoted.right: -------------------------------------------------------------------------------- 1 | .1 abc d e f. 2 | .1. 3 | .abc. 4 | .d e f. 5 | .-1 abc d e f-. 6 | .-1. 7 | .abc. 8 | .d e f-. 9 | -------------------------------------------------------------------------------- /shell/hush_test/hush-parsing/starquoted.tests: -------------------------------------------------------------------------------- 1 | if test $# = 0; then 2 | exec "$THIS_SH" "$0" 1 abc 'd e f' 3 | fi 4 | 5 | for a in "$*"; do echo ".$a."; done 6 | for a in "$@"; do echo ".$a."; done 7 | for a in "-$*-"; do echo ".$a."; done 8 | for a in "-$@-"; do echo ".$a."; done 9 | -------------------------------------------------------------------------------- /shell/hush_test/hush-parsing/starquoted2.right: -------------------------------------------------------------------------------- 1 | Should be printed 2 | Should be printed 3 | Empty: 4 | Empty: 5 | Empty: 6 | -------------------------------------------------------------------------------- /shell/hush_test/hush-psubst/emptytick.right: -------------------------------------------------------------------------------- 1 | 0 2 | 0 3 | hush: can't execute '': No such file or directory 4 | 127 5 | hush: can't execute '': No such file or directory 6 | 127 7 | 0 8 | 0 9 | 0 10 | 0 11 | hush: can't execute '': No such file or directory 12 | 127 13 | hush: can't execute '': No such file or directory 14 | 127 15 | 0 16 | 0 17 | hush: can't execute '': No such file or directory 18 | -------------------------------------------------------------------------------- /shell/hush_test/hush-psubst/emptytick.tests: -------------------------------------------------------------------------------- 1 | true; ``; echo $? 2 | false; ``; echo $? 3 | true; `""`; echo $? 4 | false; `""`; echo $? 5 | true; ` `; echo $? 6 | false; ` `; echo $? 7 | 8 | true; $(); echo $? 9 | false; $(); echo $? 10 | true; $(""); echo $? 11 | false; $(""); echo $? 12 | true; $( ); echo $? 13 | false; $( ); echo $? 14 | 15 | exec ''; echo $? 16 | echo Not reached 17 | -------------------------------------------------------------------------------- /shell/hush_test/hush-psubst/tick.right: -------------------------------------------------------------------------------- 1 | 1 2 | 1 3 | -------------------------------------------------------------------------------- /shell/hush_test/hush-psubst/tick.tests: -------------------------------------------------------------------------------- 1 | true 2 | false; echo `echo $?` 3 | true 4 | { false; echo `echo $?`; } 5 | -------------------------------------------------------------------------------- /shell/hush_test/hush-psubst/tick2.right: -------------------------------------------------------------------------------- 1 | BAZ 2 | -------------------------------------------------------------------------------- /shell/hush_test/hush-psubst/tick2.tests: -------------------------------------------------------------------------------- 1 | if false; then 2 | echo "FOO" 3 | tmp=`echo BAR >&2` 4 | fi 5 | echo BAZ 6 | -------------------------------------------------------------------------------- /shell/hush_test/hush-psubst/tick3.right: -------------------------------------------------------------------------------- 1 | \TESTZZBEST 2 | $TEST 3 | Q 4 | a\bc 5 | a"c 6 | done:0 7 | -------------------------------------------------------------------------------- /shell/hush_test/hush-psubst/tick3.tests: -------------------------------------------------------------------------------- 1 | test "$CONFIG_FEATURE_FANCY_ECHO" = "y" || exit 77 2 | 3 | TEST=Q 4 | # \` is special 5 | echo `echo '\'TEST\`echo ZZ\`BEST` 6 | # \$ and \\ are special 7 | echo `echo \\$TEST` 8 | echo `echo \$TEST` 9 | echo a`echo \\\\b`c 10 | # \" etc are NOT special (passed verbatim WITH \)! 11 | echo a`echo \"`c 12 | echo done:$? 13 | -------------------------------------------------------------------------------- /shell/hush_test/hush-psubst/tick4.right: -------------------------------------------------------------------------------- 1 | (TEST) BEST 2 | TEST) BEST 3 | ((TEST) BEST 4 | ) 5 | abc 6 | a)c 7 | OK: 0 8 | -------------------------------------------------------------------------------- /shell/hush_test/hush-psubst/tick4.tests: -------------------------------------------------------------------------------- 1 | echo $(echo '(TEST)' BEST) 2 | echo $(echo 'TEST)' BEST) 3 | echo $(echo \(\(TEST\) BEST) 4 | echo $(echo \)) 5 | echo $(echo a"`echo "b"`"c ) 6 | echo $(echo a"`echo ")"`"c ) 7 | echo OK: $? 8 | -------------------------------------------------------------------------------- /shell/hush_test/hush-psubst/tick5.right: -------------------------------------------------------------------------------- 1 | 1 2 | -------------------------------------------------------------------------------- /shell/hush_test/hush-psubst/tick5.tests: -------------------------------------------------------------------------------- 1 | true; echo `false` $? 2 | -------------------------------------------------------------------------------- /shell/hush_test/hush-psubst/tick_huge.right: -------------------------------------------------------------------------------- 1 | 546ed3f5c81c780d3ab86ada14824237 - 2 | 546ed3f5c81c780d3ab86ada14824237 - 3 | End 4 | -------------------------------------------------------------------------------- /shell/hush_test/hush-psubst/tick_huge.tests: -------------------------------------------------------------------------------- 1 | # This creates 120k file 2 | yes "123456789 123456789 123456789 123456789" | head -3000 >>"$0.tmp" 3 | 4 | echo "`cat $0.tmp`" | md5sum 5 | rm "$0.tmp" 6 | yes "123456789 123456789 123456789 123456789" | head -3000 | md5sum 7 | echo End 8 | -------------------------------------------------------------------------------- /shell/hush_test/hush-read/read_REPLY.right: -------------------------------------------------------------------------------- 1 | test 1: | abc1 def | 2 | test 2: | \abc2 d\ef | 3 | test 3: |abc3 def| 4 | test 4: |\abc4 d\ef| 5 | Done 6 | -------------------------------------------------------------------------------- /shell/hush_test/hush-read/read_REPLY.tests: -------------------------------------------------------------------------------- 1 | echo ' \abc1 d\ef ' | ( read ; echo "test 1: |$REPLY|" ) 2 | echo ' \abc2 d\ef ' | ( read -r ; echo "test 2: |$REPLY|" ) 3 | echo ' \abc3 d\ef ' | ( read REPLY; echo "test 3: |$REPLY|" ) 4 | echo ' \abc4 d\ef ' | ( read -r REPLY; echo "test 4: |$REPLY|" ) 5 | echo Done 6 | -------------------------------------------------------------------------------- /shell/hush_test/hush-read/read_ifs.right: -------------------------------------------------------------------------------- 1 | test 1: .a. .b. .c. 2 | test 2: .a. .b. .c. 3 | test 3: .a. .. .b,c. 4 | test 4: .a. .. .b,c. 5 | test 5: .a. .. .c. 6 | test 6: .a. .. .c. .d. 7 | test 7: .a. .. .b,c,d , ,. 8 | test 8: .. .a. .b. .c. 9 | test 9: .a. .b. .c. .. 10 | test A: .. .a. .. .b. .c. 11 | -------------------------------------------------------------------------------- /shell/hush_test/hush-read/read_n.right: -------------------------------------------------------------------------------- 1 | test 2 | tes 3 | tes 4 | -------------------------------------------------------------------------------- /shell/hush_test/hush-read/read_n.tests: -------------------------------------------------------------------------------- 1 | echo 'test' | (read reply; echo "$reply") 2 | echo 'test' | (read -n 3 reply; echo "$reply") 3 | echo 'test' | (read -n3 reply; echo "$reply") 4 | -------------------------------------------------------------------------------- /shell/hush_test/hush-read/read_r.right: -------------------------------------------------------------------------------- 1 | testbest 2 | test\ 3 | -------------------------------------------------------------------------------- /shell/hush_test/hush-read/read_r.tests: -------------------------------------------------------------------------------- 1 | echo -e 'test\\\nbest' | (read reply; echo "$reply") 2 | echo -e 'test\\\nbest' | (read -r reply; echo "$reply") 3 | -------------------------------------------------------------------------------- /shell/hush_test/hush-read/read_t.right: -------------------------------------------------------------------------------- 1 | >< 2 | >< 3 | >test< 4 | >test< 5 | -------------------------------------------------------------------------------- /shell/hush_test/hush-read/read_t.tests: -------------------------------------------------------------------------------- 1 | # bash 3.2 outputs: 2 | 3 | # >< 4 | { echo -n 'te'; sleep 2; echo 'st'; } | (read -t 1 reply; echo ">$reply<") 5 | # >< 6 | { sleep 2; echo 'test'; } | (read -t 1 reply; echo ">$reply<") 7 | # >test< 8 | { echo -n 'te'; sleep 1; echo 'st'; } | (read -t 2 reply; echo ">$reply<") 9 | # >test< 10 | { sleep 1; echo 'test'; } | (read -t 2 reply; echo ">$reply<") 11 | -------------------------------------------------------------------------------- /shell/hush_test/hush-trap/catch.right: -------------------------------------------------------------------------------- 1 | sending USR2 2 | caught 3 | sending USR2 4 | sending USR2 5 | USR2 6 | -------------------------------------------------------------------------------- /shell/hush_test/hush-trap/catch.tests: -------------------------------------------------------------------------------- 1 | # avoid ugly warnings about signals not being caught 2 | trap ":" USR1 USR2 3 | 4 | "$THIS_SH" -c ' 5 | trap "echo caught" USR2 6 | echo "sending USR2" 7 | kill -USR2 $$ 8 | 9 | trap "" USR2 10 | echo "sending USR2" 11 | kill -USR2 $$ 12 | 13 | trap "-" USR2 14 | echo "sending USR2" 15 | kill -USR2 $$ 16 | 17 | echo "not reached" 18 | ' 19 | 20 | trap "-" USR1 USR2 21 | -------------------------------------------------------------------------------- /shell/hush_test/hush-trap/exit.right: -------------------------------------------------------------------------------- 1 | cow 2 | moo 3 | -------------------------------------------------------------------------------- /shell/hush_test/hush-trap/exit.tests: -------------------------------------------------------------------------------- 1 | "$THIS_SH" -c 'trap "echo cow" 0' 2 | "$THIS_SH" -c 'trap "echo moo" EXIT' 3 | "$THIS_SH" -c 'trap "echo no" 0; trap 0' 4 | -------------------------------------------------------------------------------- /shell/hush_test/hush-trap/save-ret.right: -------------------------------------------------------------------------------- 1 | YEAH 2 | 0 3 | -------------------------------------------------------------------------------- /shell/hush_test/hush-trap/save-ret.tests: -------------------------------------------------------------------------------- 1 | # make sure we do not corrupt $? across traps 2 | trap "echo YEAH; false" USR1 3 | kill -USR1 $$ 4 | echo $? 5 | -------------------------------------------------------------------------------- /shell/hush_test/hush-trap/savetrap.right: -------------------------------------------------------------------------------- 1 | trap -- 'echo Exiting' EXIT 2 | trap -- 'echo WINCH!' WINCH 3 | trap -- 'echo Exiting' EXIT 4 | trap -- 'echo WINCH!' WINCH 5 | trap -- 'echo Exiting' EXIT 6 | trap -- 'echo WINCH!' WINCH 7 | Done 8 | Exiting 9 | -------------------------------------------------------------------------------- /shell/hush_test/hush-trap/savetrap.tests: -------------------------------------------------------------------------------- 1 | trap 'echo Exiting' EXIT 2 | trap 'echo WINCH!' SIGWINCH 3 | v=` trap ` 4 | echo "$v" 5 | v=$( trap ) 6 | echo "$v" 7 | v=`trap` 8 | echo "$v" 9 | echo Done 10 | -------------------------------------------------------------------------------- /shell/hush_test/hush-trap/subshell.right: -------------------------------------------------------------------------------- 1 | trap -- '' HUP 2 | trap -- '' QUIT 3 | trap -- '' SYS 4 | Ok 5 | trap -- '' HUP 6 | trap -- '' QUIT 7 | trap -- '' SYS 8 | Ok 9 | trap -- '' HUP 10 | trap -- '' QUIT 11 | trap -- '' SYS 12 | Ok 13 | trap -- '' HUP 14 | trap -- '' QUIT 15 | trap -- '' SYS 16 | Ok 17 | trap -- '' HUP 18 | trap -- '' QUIT 19 | trap -- '' SYS 20 | TERM 21 | Done 22 | -------------------------------------------------------------------------------- /shell/hush_test/hush-trap/usage.right: -------------------------------------------------------------------------------- 1 | ___ 2 | ___ 3 | ___ 4 | trap -- 'a' EXIT 5 | trap -- 'a' INT 6 | trap -- 'a' USR1 7 | trap -- 'a' USR2 8 | ___ 9 | ___ 10 | trap -- 'a' USR1 11 | trap -- 'a' USR2 12 | ___ 13 | ___ 14 | trap -- 'a' USR2 15 | -------------------------------------------------------------------------------- /shell/hush_test/hush-trap/usage.tests: -------------------------------------------------------------------------------- 1 | # no output -- default state 2 | echo ___ 3 | trap 4 | 5 | # assign some traps 6 | echo ___ 7 | trap "a" EXIT INT USR1 USR2 8 | 9 | # show them all 10 | echo ___ 11 | trap 12 | 13 | # clear one 14 | echo ___ 15 | trap 0 INT 16 | echo ___ 17 | trap 18 | 19 | # clear another 20 | echo ___ 21 | trap "-" USR1 22 | echo ___ 23 | trap 24 | -------------------------------------------------------------------------------- /shell/hush_test/hush-vars/empty.right: -------------------------------------------------------------------------------- 1 | a b c d e f 1 2 3 4 5 6 7 8 9 0 A B C D E F 2 | a b c d e f 1 2 3 4 5 6 7 8 9 0 A B C D E F 3 | a b c d e f 1 2 3 4 5 6 7 8 9 0 A B C D E F 4 | -------------------------------------------------------------------------------- /shell/hush_test/hush-vars/empty.tests: -------------------------------------------------------------------------------- 1 | e= 2 | 3 | echo a b c d e f 1 2 3 4 5 6 7 8 9 0 A B C D E F 4 | echo a $e b $e c $e d $e e $e f $e 1 $e 2 $e 3 $e 4 $e 5 $e 6 $e 7 $e 8 $e 9 $e 0 $e A $e B $e C $e D $e E $e F 5 | echo $e a $e b $e c $e d $e e $e f $e 1 $e 2 $e 3 $e 4 $e 5 $e 6 $e 7 $e 8 $e 9 $e 0 $e A $e B $e C $e D $e E $e F 6 | -------------------------------------------------------------------------------- /shell/hush_test/hush-vars/glob_and_vars.right: -------------------------------------------------------------------------------- 1 | ./glob_and_vars.right ./glob_and_vars.tests 2 | -------------------------------------------------------------------------------- /shell/hush_test/hush-vars/glob_and_vars.tests: -------------------------------------------------------------------------------- 1 | v=. 2 | echo $v/glob_and_vars.[tr]* 3 | -------------------------------------------------------------------------------- /shell/hush_test/hush-vars/param_expand_alt.right: -------------------------------------------------------------------------------- 1 | hush: syntax error: unterminated ${name} 2 | hush: syntax error: unterminated ${name} 3 | _0 _0 4 | _ _ _ _ _ 5 | _aaaa _ _ _word _word 6 | _ _ _ _ _ 7 | _ _ _ _word _ 8 | _fff _ _ _word _word 9 | -------------------------------------------------------------------------------- /shell/hush_test/hush-vars/param_expand_assign.right: -------------------------------------------------------------------------------- 1 | hush: syntax error: unterminated ${name} 2 | hush: syntax error: unterminated ${name} 3 | 0 4 | 0 5 | hush: $1: cannot assign in this way 6 | hush: $1: cannot assign in this way 7 | hush: $1: cannot assign in this way 8 | hush: $1: cannot assign in this way 9 | _aa 10 | _aa 11 | _aa 12 | _aa 13 | _ 14 | _ 15 | _ 16 | _word 17 | _word 18 | _ 19 | _ 20 | _ 21 | _ 22 | _word 23 | _fff 24 | _fff 25 | _fff 26 | _fff 27 | _fff 28 | -------------------------------------------------------------------------------- /shell/hush_test/hush-vars/param_expand_default.right: -------------------------------------------------------------------------------- 1 | hush: syntax error: unterminated ${name} 2 | hush: syntax error: unterminated ${name} 3 | _0 _0 4 | _ _ _ _word _word 5 | _aaaa _aaaa _aaaa _aaaa _aaaa 6 | _ _ _ _word _word 7 | _ _ _ _ _word 8 | _fff _fff _fff _fff _fff 9 | -------------------------------------------------------------------------------- /shell/hush_test/hush-vars/param_expand_default.tests: -------------------------------------------------------------------------------- 1 | # first try some invalid patterns (do in subshell due to parsing error) 2 | "$THIS_SH" -c 'echo ${-}' 3 | "$THIS_SH" -c 'echo ${:-}' 4 | 5 | # now some funky ones 6 | echo _${#-} _${#:-} 7 | 8 | # now some valid ones 9 | set -- 10 | echo _$1 _${1-} _${1:-} _${1-word} _${1:-word} 11 | 12 | set -- aaaa 13 | echo _$1 _${1-} _${1:-} _${1-word} _${1:-word} 14 | 15 | unset f 16 | echo _$f _${f-} _${f:-} _${f-word} _${f:-word} 17 | 18 | f= 19 | echo _$f _${f-} _${f:-} _${f-word} _${f:-word} 20 | 21 | f=fff 22 | echo _$f _${f-} _${f:-} _${f-word} _${f:-word} 23 | -------------------------------------------------------------------------------- /shell/hush_test/hush-vars/param_expand_indicate_error.right: -------------------------------------------------------------------------------- 1 | hush: syntax error: unterminated ${name} 2 | 0 3 | 0 4 | _ 5 | hush: 1: parameter null or not set 6 | hush: 1: parameter null or not set 7 | hush: 1: message1 8 | hush: 1: message1 9 | _aaaa 10 | _aaaa 11 | _aaaa 12 | _aaaa 13 | _aaaa 14 | _ 15 | hush: f: parameter null or not set 16 | hush: f: parameter null or not set 17 | hush: f: message3 18 | hush: f: message3 19 | _ 20 | _ 21 | hush: f: parameter null or not set 22 | _ 23 | hush: f: message4 24 | _fff 25 | _fff 26 | _fff 27 | _fff 28 | _fff 29 | -------------------------------------------------------------------------------- /shell/hush_test/hush-vars/param_expand_len.right: -------------------------------------------------------------------------------- 1 | 0 0 2 | 4 4 3 | 4 3 2 1 0 0 4 | 0 3 0 5 | -------------------------------------------------------------------------------- /shell/hush_test/hush-vars/param_expand_len.tests: -------------------------------------------------------------------------------- 1 | # make sure len parsing doesnt break arg count 2 | set -- 3 | echo $# ${#} 4 | set -- aaaa bbb cc d 5 | echo $# ${#} 6 | 7 | echo ${#1} ${#2} ${#3} ${#4} ${#5} ${#6} 8 | 9 | unset e 10 | f=abc 11 | g= 12 | echo ${#e} ${#f} ${#g} 13 | -------------------------------------------------------------------------------- /shell/hush_test/hush-vars/param_glob.right: -------------------------------------------------------------------------------- 1 | param_glob.tests 2 | param_glob.tests 3 | param_glob.t* 4 | param_glob.t* 5 | -------------------------------------------------------------------------------- /shell/hush_test/hush-vars/param_glob.tests: -------------------------------------------------------------------------------- 1 | if test $# = 0; then 2 | exec "$THIS_SH" "$0" 'param_glob.t*' 3 | echo NOT SHOWN 4 | exit 5 | fi 6 | echo $* 7 | echo $@ 8 | echo "$*" 9 | echo "$@" 10 | -------------------------------------------------------------------------------- /shell/hush_test/hush-vars/param_subshell.right: -------------------------------------------------------------------------------- 1 | 1=1 2 | 2=2 3 | 3=3 4 | 4=4 5 | 5=5 6 | 6=6 7 | 7=7 8 | -------------------------------------------------------------------------------- /shell/hush_test/hush-vars/param_subshell.tests: -------------------------------------------------------------------------------- 1 | if test $# = 0; then 2 | "$THIS_SH" "$0" 1 2 3 4 5 6 7 8 9 3 | exit 4 | fi 5 | echo 1=$1 6 | { echo 2=$2; } 7 | { echo 3=$3; } & 8 | # cant use usleep as it isnt standard in $PATH -- 9 | # we fail when testing busybox compiled solely as "hush" 10 | wait 11 | ( echo 4=$4 ) 12 | ( echo 5=$5 ) & 13 | wait 14 | true | echo 6=$6 | cat 15 | true | { echo 7=$7; } | cat 16 | -------------------------------------------------------------------------------- /shell/hush_test/hush-vars/star.right: -------------------------------------------------------------------------------- 1 | .1. 2 | .abc. 3 | .d. 4 | .e. 5 | .f. 6 | .1 abc d e f. 7 | -------------------------------------------------------------------------------- /shell/hush_test/hush-vars/star.tests: -------------------------------------------------------------------------------- 1 | if test $# = 0; then 2 | exec "$THIS_SH" star.tests 1 abc 'd e f' 3 | fi 4 | # 'd e f' should be split into 3 separate args: 5 | for a in $*; do echo ".$a."; done 6 | 7 | # must produce .1 abc d e f. 8 | for a in "$*"; do echo ".$a."; done 9 | -------------------------------------------------------------------------------- /shell/hush_test/hush-vars/unset.right: -------------------------------------------------------------------------------- 1 | 0 2 | unset: invalid option -- m 3 | 1 4 | 0 5 | ___ 6 | 0 f g 7 | 0 g 8 | 0 9 | ___ 10 | 0 f g 11 | 0 12 | 0 f g 13 | 0 14 | ___ 15 | hush: HUSH_VERSION: readonly variable 16 | 1 f g 17 | hush: HUSH_VERSION: readonly variable 18 | 1 19 | -------------------------------------------------------------------------------- /shell/hush_test/hush-vars/unset.tests: -------------------------------------------------------------------------------- 1 | # check invalid options are rejected 2 | unset - 3 | echo $? 4 | unset -m a b c 5 | echo $? 6 | 7 | # check funky usage 8 | unset 9 | echo $? 10 | 11 | # check normal usage 12 | echo ___ 13 | f=f g=g 14 | echo $? $f $g 15 | unset f 16 | echo $? $f $g 17 | unset g 18 | echo $? $f $g 19 | 20 | echo ___ 21 | f=f g=g 22 | echo $? $f $g 23 | unset f g 24 | echo $? $f $g 25 | f=f g=g 26 | echo $? $f $g 27 | unset -v f g 28 | echo $? $f $g 29 | 30 | # check read only vars 31 | echo ___ 32 | f=f g=g 33 | unset HUSH_VERSION 34 | echo $? $f $g 35 | unset f HUSH_VERSION g 36 | echo $? $f $g 37 | -------------------------------------------------------------------------------- /shell/hush_test/hush-vars/var1.right: -------------------------------------------------------------------------------- 1 | http://busybox.net 2 | http://busybox.net_abc 3 | 1 1 4 | 1 1 5 | -------------------------------------------------------------------------------- /shell/hush_test/hush-vars/var1.tests: -------------------------------------------------------------------------------- 1 | URL=http://busybox.net 2 | 3 | echo $URL 4 | echo ${URL}_abc 5 | 6 | true 7 | false; echo $? ${?} 8 | true 9 | { false; echo $? ${?}; } 10 | -------------------------------------------------------------------------------- /shell/hush_test/hush-vars/var2.right: -------------------------------------------------------------------------------- 1 | http://busybox.net 2 | http://busybox.net_abc 3 | -------------------------------------------------------------------------------- /shell/hush_test/hush-vars/var2.tests: -------------------------------------------------------------------------------- 1 | _1=http://busybox.net 2 | 3 | echo $_1 4 | echo ${_1}_abc 5 | -------------------------------------------------------------------------------- /shell/hush_test/hush-vars/var3.right: -------------------------------------------------------------------------------- 1 | hush: syntax error: unterminated ${name} 2 | hush: syntax error: unterminated ${name} 3 | -------------------------------------------------------------------------------- /shell/hush_test/hush-vars/var3.tests: -------------------------------------------------------------------------------- 1 | # reject invalid vars 2 | "$THIS_SH" -c 'echo ${1q}' 3 | "$THIS_SH" -c 'echo ${&}' 4 | #"$THIS_SH" -c 'echo ${$}' -- this is valid as it's the same as $$ 5 | -------------------------------------------------------------------------------- /shell/hush_test/hush-vars/var_expand_in_assign.right: -------------------------------------------------------------------------------- 1 | . . 2 | .abc d e. 3 | .abc d e. 4 | .abc d e. 5 | .abc d e. 6 | -------------------------------------------------------------------------------- /shell/hush_test/hush-vars/var_expand_in_assign.tests: -------------------------------------------------------------------------------- 1 | if test $# = 0; then 2 | exec "$THIS_SH" "$0" abc "d e" 3 | fi 4 | 5 | space=' ' 6 | echo .$space. 7 | 8 | a=$* 9 | echo .$a. 10 | a=$@ 11 | echo .$a. 12 | a="$*" 13 | echo .$a. 14 | a="$@" 15 | echo .$a. 16 | -------------------------------------------------------------------------------- /shell/hush_test/hush-vars/var_expand_in_redir.right: -------------------------------------------------------------------------------- 1 | TEST1 2 | TEST2 3 | TEST3 4 | -------------------------------------------------------------------------------- /shell/hush_test/hush-vars/var_expand_in_redir.tests: -------------------------------------------------------------------------------- 1 | if test $# = 0; then 2 | exec "$THIS_SH" "$0" abc "d e" 3 | fi 4 | 5 | echo TEST1 >"$1.out" 6 | echo TEST2 >"$2.out" 7 | # bash says: "$@.out": ambiguous redirect 8 | # ash handles it as if it is '$*' - we do the same 9 | echo TEST3 >"$@.out" 10 | 11 | cat abc.out "d e.out" "abc d e.out" 12 | 13 | rm abc.out "d e.out" "abc d e.out" 14 | -------------------------------------------------------------------------------- /shell/hush_test/hush-vars/var_in_pipes.right: -------------------------------------------------------------------------------- 1 | b=1 2 | b=2 3 | b=3 4 | b=4 5 | b=5 6 | b=6 7 | -------------------------------------------------------------------------------- /shell/hush_test/hush-vars/var_in_pipes.tests: -------------------------------------------------------------------------------- 1 | b=1 env | grep ^b= 2 | true | b=2 env | grep ^b= 3 | a=1 true | b=3 env | grep ^b= 4 | 5 | (b=4 env) | grep ^b= 6 | (true | b=5 env) | grep ^b= 7 | (a=1 true | b=6 env) | grep ^b= 8 | -------------------------------------------------------------------------------- /shell/hush_test/hush-vars/var_leaks.right: -------------------------------------------------------------------------------- 1 | OK 2 | -------------------------------------------------------------------------------- /shell/hush_test/hush-vars/var_leaks.tests: -------------------------------------------------------------------------------- 1 | # external program 2 | a=b /bin/true 3 | env | grep ^a= 4 | 5 | # builtin 6 | a=b true 7 | env | grep ^a= 8 | 9 | # exec with redirection only 10 | # in bash, this leaks! 11 | a=b exec 1>&1 12 | env | grep ^a= 13 | 14 | echo OK 15 | -------------------------------------------------------------------------------- /shell/hush_test/hush-vars/var_posix1.right: -------------------------------------------------------------------------------- 1 | Empty: 2 | Empty: 3 | Empty: 4 | Empty: 5 | Empty: 6 | Empty: 7 | Empty: 8 | Empty: 9 | Empty: 10 | Empty: 11 | Empty: 12 | Empty: 13 | Empty: 14 | Empty: 15 | Empty: 16 | Empty: 17 | abcdcd 18 | abcdcd 19 | abcdcd 20 | cdcd 21 | babcdcd 22 | babcdcd 23 | ababcdcd 24 | Empty: 25 | ababcdcd}_tail 26 | ababcd 27 | ababcd 28 | ababcd 29 | abab 30 | ababcdc 31 | ababcdc 32 | ababcdcd 33 | Empty: 34 | ababcdcd}_tail 35 | ababcdcd 36 | end 37 | -------------------------------------------------------------------------------- /shell/hush_test/hush-vars/var_preserved.right: -------------------------------------------------------------------------------- 1 | a=b 2 | a=b 3 | a=b 4 | OK 5 | -------------------------------------------------------------------------------- /shell/hush_test/hush-vars/var_preserved.tests: -------------------------------------------------------------------------------- 1 | export a=b 2 | 3 | # external program 4 | a=c /bin/true 5 | env | grep ^a= 6 | 7 | # builtin 8 | a=d true 9 | env | grep ^a= 10 | 11 | # exec with redirection only 12 | # in bash, this leaks! 13 | a=e exec 1>&1 14 | env | grep ^a= 15 | 16 | echo OK 17 | -------------------------------------------------------------------------------- /shell/hush_test/hush-vars/var_subst_in_for.right: -------------------------------------------------------------------------------- 1 | Testing: in x y z 2 | .x. 3 | .y. 4 | .z. 5 | Testing: in u $empty v 6 | .u. 7 | .v. 8 | Testing: in u " $empty" v 9 | .u. 10 | . . 11 | .v. 12 | Testing: in u $empty $empty$a v 13 | .u. 14 | .a. 15 | .v. 16 | Testing: in $a_b 17 | .a. 18 | .b. 19 | Testing: in $* 20 | .abc. 21 | .d. 22 | .e. 23 | Testing: in $@ 24 | .abc. 25 | .d. 26 | .e. 27 | Testing: in -$*- 28 | .-abc. 29 | .d. 30 | .e-. 31 | Testing: in -$@- 32 | .-abc. 33 | .d. 34 | .e-. 35 | Testing: in $a_b -$a_b- 36 | .a. 37 | .b. 38 | .-a. 39 | .b-. 40 | Finished 41 | -------------------------------------------------------------------------------- /shell/hush_test/hush-z_slow/leak_all1.right: -------------------------------------------------------------------------------- 1 | Warm up 2 | Measuring memory leak... 3 | Ok 4 | -------------------------------------------------------------------------------- /shell/hush_test/hush-z_slow/leak_all2.right: -------------------------------------------------------------------------------- 1 | Warm up 2 | Measuring memory leak... 3 | Ok 4 | -------------------------------------------------------------------------------- /shell/hush_test/hush-z_slow/leak_empty_tick.right: -------------------------------------------------------------------------------- 1 | Warm up 2 | Measuring memory leak... 3 | Ok 4 | -------------------------------------------------------------------------------- /shell/hush_test/hush-z_slow/leak_empty_tick.tests: -------------------------------------------------------------------------------- 1 | echo "Warm up" 2 | i=1 3 | while test $i != 9; do 4 | `true` 5 | : $((i++)) 6 | done 7 | 8 | memleak 9 | 10 | echo "Measuring memory leak..." 11 | i=1 12 | while test $i != 199; do 13 | `true` 14 | : $((i++)) 15 | done 16 | i=1 17 | while test $i != 199; do 18 | `true` 19 | : $((i++)) 20 | done 21 | 22 | memleak 23 | kb=$? 24 | if test $kb -le 4; then 25 | echo Ok #$kb 26 | else 27 | echo "Bad: $kb kb (or more) leaked" 28 | fi 29 | -------------------------------------------------------------------------------- /shell/hush_test/hush-z_slow/leak_heredoc1.right: -------------------------------------------------------------------------------- 1 | Warm up 2 | Measuring memory leak... 3 | Ok 4 | -------------------------------------------------------------------------------- /shell/hush_test/hush-z_slow/leak_var.right: -------------------------------------------------------------------------------- 1 | Measuring memory leak... 2 | Ok 3 | -------------------------------------------------------------------------------- /shell/hush_test/hush-z_slow/leak_var2.right: -------------------------------------------------------------------------------- 1 | Warm up 2 | Measuring memory leak... 3 | Ok 4 | -------------------------------------------------------------------------------- /shell/hush_test/hush-z_slow/leak_var3.right: -------------------------------------------------------------------------------- 1 | Warm up 2 | Measuring memory leak... 3 | Ok 4 | -------------------------------------------------------------------------------- /shell/msh_test/msh-bugs/noeol3.right: -------------------------------------------------------------------------------- 1 | hush: syntax error: unterminated " 2 | -------------------------------------------------------------------------------- /shell/msh_test/msh-bugs/noeol3.tests: -------------------------------------------------------------------------------- 1 | # last line has no EOL! 2 | echo "unterminated -------------------------------------------------------------------------------- /shell/msh_test/msh-bugs/process_subst.right: -------------------------------------------------------------------------------- 1 | TESTzzBEST 2 | TEST$(echo zz)BEST 3 | TEST'BEST 4 | -------------------------------------------------------------------------------- /shell/msh_test/msh-bugs/process_subst.tests: -------------------------------------------------------------------------------- 1 | echo "TEST`echo zz;echo;echo`BEST" 2 | echo "TEST`echo '$(echo zz)'`BEST" 3 | echo "TEST`echo "'"`BEST" 4 | -------------------------------------------------------------------------------- /shell/msh_test/msh-bugs/read.right: -------------------------------------------------------------------------------- 1 | read 2 | cat 3 | echo "REPLY=$REPLY" 4 | REPLY=exec "$1.out" 6 | echo TEST2 >"$2.out" 7 | # bash says: "$@.out": ambiguous redirect 8 | # ash handles it as if it is '$*' - we do the same 9 | echo TEST3 >"$@.out" 10 | 11 | cat abc.out "d e.out" "abc d e.out" 12 | 13 | rm abc.out "d e.out" "abc d e.out" 14 | -------------------------------------------------------------------------------- /shell/msh_test/msh-execution/exitcode_EACCES.right: -------------------------------------------------------------------------------- 1 | ./: can't execute 2 | 126 3 | -------------------------------------------------------------------------------- /shell/msh_test/msh-execution/exitcode_EACCES.tests: -------------------------------------------------------------------------------- 1 | ./ 2 | echo $? 3 | -------------------------------------------------------------------------------- /shell/msh_test/msh-execution/exitcode_ENOENT.right: -------------------------------------------------------------------------------- 1 | ./does_not_exist_for_sure: not found 2 | 127 3 | -------------------------------------------------------------------------------- /shell/msh_test/msh-execution/exitcode_ENOENT.tests: -------------------------------------------------------------------------------- 1 | ./does_not_exist_for_sure 2 | echo $? 3 | -------------------------------------------------------------------------------- /shell/msh_test/msh-execution/many_continues.right: -------------------------------------------------------------------------------- 1 | OK 2 | -------------------------------------------------------------------------------- /shell/msh_test/msh-execution/many_continues.tests: -------------------------------------------------------------------------------- 1 | if test $# = 0; then 2 | # Child will kill us in 1 second 3 | "$THIS_SH" "$0" $$ & 4 | 5 | # Loop many, many times 6 | trap 'echo OK; exit 0' 15 7 | while true; do 8 | continue 9 | done 10 | echo BAD 11 | exit 1 12 | fi 13 | 14 | sleep 1 15 | kill $1 16 | -------------------------------------------------------------------------------- /shell/msh_test/msh-execution/nested_break.right: -------------------------------------------------------------------------------- 1 | A 2 | B 3 | iteration 4 | C 5 | A 6 | B 7 | iteration 8 | D 9 | -------------------------------------------------------------------------------- /shell/msh_test/msh-execution/nested_break.tests: -------------------------------------------------------------------------------- 1 | # Testcase for http://bugs.busybox.net/view.php?id=846 2 | 3 | n=0 4 | while : 5 | do 6 | echo A 7 | while : 8 | do 9 | echo B 10 | break 11 | done 12 | echo iteration 13 | [ $n = 1 ] && break 14 | echo C 15 | n=`expr $n + 1` 16 | done 17 | echo D 18 | -------------------------------------------------------------------------------- /shell/msh_test/msh-misc/tick.right: -------------------------------------------------------------------------------- 1 | 1 2 | 1 3 | -------------------------------------------------------------------------------- /shell/msh_test/msh-misc/tick.tests: -------------------------------------------------------------------------------- 1 | true 2 | false; echo `echo $?` 3 | true 4 | { false; echo `echo $?`; } 5 | -------------------------------------------------------------------------------- /shell/msh_test/msh-parsing/argv0.right: -------------------------------------------------------------------------------- 1 | OK 2 | -------------------------------------------------------------------------------- /shell/msh_test/msh-parsing/argv0.tests: -------------------------------------------------------------------------------- 1 | if test $# = 0; then 2 | exec "$THIS_SH" "$0" arg 3 | fi 4 | echo OK 5 | -------------------------------------------------------------------------------- /shell/msh_test/msh-parsing/noeol.right: -------------------------------------------------------------------------------- 1 | HELLO 2 | -------------------------------------------------------------------------------- /shell/msh_test/msh-parsing/noeol.tests: -------------------------------------------------------------------------------- 1 | # next line has no EOL! 2 | echo HELLO -------------------------------------------------------------------------------- /shell/msh_test/msh-parsing/noeol2.right: -------------------------------------------------------------------------------- 1 | 1 2 | -------------------------------------------------------------------------------- /shell/msh_test/msh-parsing/noeol2.tests: -------------------------------------------------------------------------------- 1 | # last line has no EOL! 2 | if true 3 | then 4 | echo 1 5 | else 6 | echo 2 7 | fi -------------------------------------------------------------------------------- /shell/msh_test/msh-parsing/quote1.right: -------------------------------------------------------------------------------- 1 | '1' 2 | -------------------------------------------------------------------------------- /shell/msh_test/msh-parsing/quote1.tests: -------------------------------------------------------------------------------- 1 | a=1 2 | echo "'$a'" 3 | -------------------------------------------------------------------------------- /shell/msh_test/msh-parsing/quote2.right: -------------------------------------------------------------------------------- 1 | >1 2 | -------------------------------------------------------------------------------- /shell/msh_test/msh-parsing/quote2.tests: -------------------------------------------------------------------------------- 1 | a=1 2 | echo ">$a" 3 | -------------------------------------------------------------------------------- /shell/msh_test/msh-parsing/quote3.right: -------------------------------------------------------------------------------- 1 | Testing: in $empty"" 2 | .. 3 | Finished 4 | -------------------------------------------------------------------------------- /shell/msh_test/msh-parsing/quote3.tests: -------------------------------------------------------------------------------- 1 | if test $# = 0; then 2 | exec "$THIS_SH" quote3.tests abc "d e" 3 | fi 4 | 5 | echo 'Testing: in $empty""' 6 | empty='' 7 | for a in $empty""; do echo ".$a."; done 8 | echo Finished 9 | -------------------------------------------------------------------------------- /shell/msh_test/msh-parsing/quote4.right: -------------------------------------------------------------------------------- 1 | a b 2 | -------------------------------------------------------------------------------- /shell/msh_test/msh-parsing/quote4.tests: -------------------------------------------------------------------------------- 1 | a_b='a b' 2 | echo "$a_b" 3 | -------------------------------------------------------------------------------- /shell/msh_test/msh-vars/star.right: -------------------------------------------------------------------------------- 1 | .1. 2 | .abc. 3 | .d. 4 | .e. 5 | .f. 6 | .1 abc d e f. 7 | -------------------------------------------------------------------------------- /shell/msh_test/msh-vars/star.tests: -------------------------------------------------------------------------------- 1 | if test $# = 0; then 2 | exec "$THIS_SH" star.tests 1 abc 'd e f' 3 | fi 4 | # 'd e f' should be split into 3 separate args: 5 | for a in $*; do echo ".$a."; done 6 | 7 | # must produce .1 abc d e f. 8 | for a in "$*"; do echo ".$a."; done 9 | -------------------------------------------------------------------------------- /shell/msh_test/msh-vars/var.right: -------------------------------------------------------------------------------- 1 | http://busybox.net 2 | http://busybox.net_abc 3 | 1 4 | 1 5 | -------------------------------------------------------------------------------- /shell/msh_test/msh-vars/var.tests: -------------------------------------------------------------------------------- 1 | URL=http://busybox.net 2 | 3 | echo $URL 4 | echo ${URL}_abc 5 | 6 | true 7 | false; echo $? 8 | true 9 | { false; echo $?; } 10 | -------------------------------------------------------------------------------- /shell/msh_test/msh-vars/var_subst_in_for.right: -------------------------------------------------------------------------------- 1 | Testing: in x y z 2 | .x. 3 | .y. 4 | .z. 5 | Testing: in u $empty v 6 | .u. 7 | .v. 8 | Testing: in u " $empty" v 9 | .u. 10 | . . 11 | .v. 12 | Testing: in u $empty $empty$a v 13 | .u. 14 | .a. 15 | .v. 16 | Testing: in $a_b 17 | .a. 18 | .b. 19 | Testing: in $* 20 | .abc. 21 | .d. 22 | .e. 23 | Testing: in $@ 24 | .abc. 25 | .d. 26 | .e. 27 | Testing: in -$*- 28 | .-abc. 29 | .d. 30 | .e-. 31 | Testing: in -$@- 32 | .-abc. 33 | .d. 34 | .e-. 35 | Testing: in $a_b -$a_b- 36 | .a. 37 | .b. 38 | .-a. 39 | .b-. 40 | Finished 41 | -------------------------------------------------------------------------------- /sysklogd/Kbuild: -------------------------------------------------------------------------------- 1 | # Makefile for busybox 2 | # 3 | # Copyright (C) 1999-2005 by Erik Andersen 4 | # 5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. 6 | 7 | lib-y:= 8 | lib-$(CONFIG_KLOGD) += klogd.o 9 | lib-$(CONFIG_LOGGER) += syslogd_and_logger.o 10 | lib-$(CONFIG_LOGREAD) += logread.o 11 | lib-$(CONFIG_SYSLOGD) += syslogd_and_logger.o 12 | -------------------------------------------------------------------------------- /testsuite/awk_t1.tar.bz2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dylex/android_external_busybox/e5493a5af57c1ffb0d933faab0700db1c0e5b82f/testsuite/awk_t1.tar.bz2 -------------------------------------------------------------------------------- /testsuite/basename/basename-does-not-remove-identical-extension: -------------------------------------------------------------------------------- 1 | test xfoo = x`busybox basename foo foo` 2 | -------------------------------------------------------------------------------- /testsuite/basename/basename-works: -------------------------------------------------------------------------------- 1 | test x$(basename $(pwd)) = x$(busybox basename $(pwd)) 2 | 3 | -------------------------------------------------------------------------------- /testsuite/bunzip2/bunzip2-reads-from-standard-input: -------------------------------------------------------------------------------- 1 | echo foo | bzip2 | busybox bunzip2 > output 2 | echo foo | cmp - output 3 | -------------------------------------------------------------------------------- /testsuite/bunzip2/bunzip2-removes-compressed-file: -------------------------------------------------------------------------------- 1 | echo foo | bzip2 >foo.bz2 2 | busybox bunzip2 foo.bz2 3 | test ! -f foo.bz2 4 | -------------------------------------------------------------------------------- /testsuite/bunzip2/bzcat-does-not-remove-compressed-file: -------------------------------------------------------------------------------- 1 | echo foo | bzip2 >foo.bz2 2 | busybox bzcat foo.bz2 3 | test -f foo.bz2 4 | -------------------------------------------------------------------------------- /testsuite/cat/cat-prints-a-file: -------------------------------------------------------------------------------- 1 | echo I WANT > foo 2 | busybox cat foo >bar 3 | cmp foo bar 4 | -------------------------------------------------------------------------------- /testsuite/cat/cat-prints-a-file-and-standard-input: -------------------------------------------------------------------------------- 1 | echo I WANT > foo 2 | echo SOMETHING | busybox cat foo - >bar 3 | cat >baz <foo 2 | echo bar >bar 3 | set +e 4 | busybox cmp -s foo bar 5 | if [ $? != 0 ] ; then 6 | exit 0; 7 | fi 8 | 9 | exit 1; 10 | -------------------------------------------------------------------------------- /testsuite/cp/cp-RHL-does_not_preserve-links: -------------------------------------------------------------------------------- 1 | mkdir a 2 | >a/file 3 | ln -s file a/link 4 | busybox cp -RHL a b 5 | test ! -L b/link 6 | #sh /dev/tty 2>&1 7 | -------------------------------------------------------------------------------- /testsuite/cp/cp-a-files-to-dir: -------------------------------------------------------------------------------- 1 | echo file number one > file1 2 | echo file number two > file2 3 | ln -s file2 link1 4 | mkdir dir1 5 | # why??? 6 | #TZ=UTC0 touch -d '2000-01-30 05:24:08' dir1/file3 7 | mkdir there 8 | busybox cp -a file1 file2 link1 dir1 there 9 | test -f there/file1 10 | test -f there/file2 11 | test ! -s there/dir1/file3 12 | test -L there/link1 13 | test xfile2 = x`readlink there/link1` 14 | test ! dir1/file3 -ot there/dir1/file3 15 | test ! dir1/file3 -nt there/dir1/file3 16 | -------------------------------------------------------------------------------- /testsuite/cp/cp-a-preserves-links: -------------------------------------------------------------------------------- 1 | touch foo 2 | ln -s foo bar 3 | busybox cp -a bar baz 4 | test -L baz 5 | test xfoo = x`readlink baz` 6 | -------------------------------------------------------------------------------- /testsuite/cp/cp-copies-empty-file: -------------------------------------------------------------------------------- 1 | touch foo 2 | busybox cp foo bar 3 | cmp foo bar 4 | -------------------------------------------------------------------------------- /testsuite/cp/cp-copies-large-file: -------------------------------------------------------------------------------- 1 | dd if=/dev/zero of=foo seek=10k count=1 2>/dev/null 2 | busybox cp foo bar 3 | cmp foo bar 4 | -------------------------------------------------------------------------------- /testsuite/cp/cp-copies-small-file: -------------------------------------------------------------------------------- 1 | echo I WANT > foo 2 | busybox cp foo bar 3 | cmp foo bar 4 | -------------------------------------------------------------------------------- /testsuite/cp/cp-d-files-to-dir: -------------------------------------------------------------------------------- 1 | echo file number one > file1 2 | echo file number two > file2 3 | touch file3 4 | ln -s file2 link1 5 | mkdir there 6 | busybox cp -d file1 file2 file3 link1 there 7 | test -f there/file1 8 | test -f there/file2 9 | test ! -s there/file3 10 | test -L there/link1 11 | test xfile2 = x`readlink there/link1` 12 | -------------------------------------------------------------------------------- /testsuite/cp/cp-dev-file: -------------------------------------------------------------------------------- 1 | busybox cp /dev/null foo 2 | test -f foo 3 | -------------------------------------------------------------------------------- /testsuite/cp/cp-dir-create-dir: -------------------------------------------------------------------------------- 1 | mkdir bar 2 | touch bar/baz 3 | busybox cp -R bar foo 4 | test -f foo/baz 5 | -------------------------------------------------------------------------------- /testsuite/cp/cp-dir-existing-dir: -------------------------------------------------------------------------------- 1 | mkdir bar 2 | touch bar/baz 3 | mkdir foo 4 | busybox cp -R bar foo 5 | test -f foo/bar/baz 6 | -------------------------------------------------------------------------------- /testsuite/cp/cp-does-not-copy-unreadable-file: -------------------------------------------------------------------------------- 1 | touch foo 2 | chmod a-r foo 3 | set +e 4 | if test `id -u` = 0; then 5 | # run as user with nonzero uid 6 | setuidgid 1 busybox cp foo bar 7 | else 8 | busybox cp foo bar 9 | fi 10 | set -e 11 | test ! -f bar 12 | -------------------------------------------------------------------------------- /testsuite/cp/cp-files-to-dir: -------------------------------------------------------------------------------- 1 | echo file number one > file1 2 | echo file number two > file2 3 | touch file3 4 | ln -s file2 link1 5 | mkdir there 6 | busybox cp file1 file2 file3 link1 there 7 | test -f there/file1 8 | test -f there/file2 9 | test ! -s there/file3 10 | test -f there/link1 11 | cmp there/file2 there/link1 12 | -------------------------------------------------------------------------------- /testsuite/cp/cp-follows-links: -------------------------------------------------------------------------------- 1 | touch foo 2 | ln -s foo bar 3 | busybox cp bar baz 4 | test -f baz 5 | -------------------------------------------------------------------------------- /testsuite/cp/cp-parents: -------------------------------------------------------------------------------- 1 | mkdir -p foo/bar/baz 2 | touch foo/bar/baz/file 3 | mkdir dir 4 | busybox cp --parents foo/bar/baz/file dir 5 | test -f dir/foo/bar/baz/file 6 | -------------------------------------------------------------------------------- /testsuite/cp/cp-preserves-hard-links: -------------------------------------------------------------------------------- 1 | # FEATURE: CONFIG_FEATURE_PRESERVE_HARDLINKS 2 | touch foo 3 | ln foo bar 4 | mkdir baz 5 | busybox cp -d foo bar baz 6 | test baz/foo -ef baz/bar 7 | -------------------------------------------------------------------------------- /testsuite/cp/cp-preserves-links: -------------------------------------------------------------------------------- 1 | touch foo 2 | ln -s foo bar 3 | busybox cp -d bar baz 4 | test -L baz 5 | test xfoo = x`readlink baz` 6 | -------------------------------------------------------------------------------- /testsuite/cp/cp-preserves-source-file: -------------------------------------------------------------------------------- 1 | touch foo 2 | busybox cp foo bar 3 | test -f foo 4 | -------------------------------------------------------------------------------- /testsuite/cut.tests: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Copyright 2007 by Denys Vlasenko 4 | # Licensed under GPL v2, see file LICENSE for details. 5 | 6 | . ./testing.sh 7 | 8 | # testing "test name" "options" "expected result" "file input" "stdin" 9 | # file input will be file called "input" 10 | # test can create a file "actual" instead of writing to stdout 11 | 12 | testing "cut '-' (stdin) and multi file handling" \ 13 | "cut -d' ' -f2 - input" \ 14 | "over\n""quick\n" \ 15 | "the quick brown fox\n" \ 16 | "jumps over the lazy dog\n" \ 17 | 18 | exit $FAILCOUNT 19 | -------------------------------------------------------------------------------- /testsuite/cut/cut-cuts-a-character: -------------------------------------------------------------------------------- 1 | test $(echo abcd | busybox cut -c 3) = c 2 | -------------------------------------------------------------------------------- /testsuite/cut/cut-cuts-a-closed-range: -------------------------------------------------------------------------------- 1 | test $(echo abcd | busybox cut -c 1-2) = ab 2 | -------------------------------------------------------------------------------- /testsuite/cut/cut-cuts-a-field: -------------------------------------------------------------------------------- 1 | test $(echo -e "f1\tf2\tf3" | busybox cut -f 2) = f2 2 | -------------------------------------------------------------------------------- /testsuite/cut/cut-cuts-an-open-range: -------------------------------------------------------------------------------- 1 | test $(echo abcd | busybox cut -c -3) = abc 2 | -------------------------------------------------------------------------------- /testsuite/cut/cut-cuts-an-unclosed-range: -------------------------------------------------------------------------------- 1 | test $(echo abcd | busybox cut -c 3-) = cd 2 | -------------------------------------------------------------------------------- /testsuite/date/date-R-works: -------------------------------------------------------------------------------- 1 | test x"`date -R`" = x"`busybox date -R`" 2 | -------------------------------------------------------------------------------- /testsuite/date/date-format-works: -------------------------------------------------------------------------------- 1 | # TODO: gnu date doesn't accept '2000.11.22-11:22:33' format, 2 | # but accepts '2000-11-22 11:22:33'. We must follow. 3 | test x"01/01/99" = x"`busybox date -d 1999.01.01-11:22:33 '+%d/%m/%y'`" 4 | test x"22/11/00" = x"`busybox date -d 2000.11.22-11:22:33 '+%d/%m/%y'`" 5 | -------------------------------------------------------------------------------- /testsuite/date/date-u-works: -------------------------------------------------------------------------------- 1 | test x"Sat Jan 1 11:22:33 UTC 2000" = x"`TZ=CET-1CEST-2 busybox date -u -d 2000.01.01-11:22:33`" 2 | -------------------------------------------------------------------------------- /testsuite/dd/dd-accepts-if: -------------------------------------------------------------------------------- 1 | echo I WANT >foo 2 | test "$(busybox dd if=foo 2>/dev/null)" = "I WANT" 3 | -------------------------------------------------------------------------------- /testsuite/dd/dd-accepts-of: -------------------------------------------------------------------------------- 1 | echo I WANT | busybox dd of=foo 2>/dev/null 2 | echo I WANT | cmp foo - 3 | -------------------------------------------------------------------------------- /testsuite/dd/dd-copies-from-standard-input-to-standard-output: -------------------------------------------------------------------------------- 1 | test "$(echo I WANT | busybox dd 2>/dev/null)" = "I WANT" 2 | -------------------------------------------------------------------------------- /testsuite/dd/dd-prints-count-to-standard-error: -------------------------------------------------------------------------------- 1 | echo I WANT | busybox dd of=foo >/dev/null 2>bar 2 | grep -q records bar 3 | -------------------------------------------------------------------------------- /testsuite/dd/dd-reports-write-errors: -------------------------------------------------------------------------------- 1 | busybox dd if="$0" of=/dev/full 2>/dev/null || status=$? 2 | test $status = 1 3 | -------------------------------------------------------------------------------- /testsuite/dirname/dirname-handles-absolute-path: -------------------------------------------------------------------------------- 1 | test $(busybox dirname /foo/bar/baz) = /foo/bar 2 | -------------------------------------------------------------------------------- /testsuite/dirname/dirname-handles-empty-path: -------------------------------------------------------------------------------- 1 | test $(busybox dirname '') = . 2 | -------------------------------------------------------------------------------- /testsuite/dirname/dirname-handles-multiple-slashes: -------------------------------------------------------------------------------- 1 | test $(busybox dirname foo/bar///baz) = foo/bar 2 | -------------------------------------------------------------------------------- /testsuite/dirname/dirname-handles-relative-path: -------------------------------------------------------------------------------- 1 | test $(busybox dirname foo/bar/baz) = foo/bar 2 | -------------------------------------------------------------------------------- /testsuite/dirname/dirname-handles-root: -------------------------------------------------------------------------------- 1 | test $(busybox dirname /) = / 2 | -------------------------------------------------------------------------------- /testsuite/dirname/dirname-handles-single-component: -------------------------------------------------------------------------------- 1 | test $(busybox dirname foo) = . 2 | -------------------------------------------------------------------------------- /testsuite/dirname/dirname-works: -------------------------------------------------------------------------------- 1 | test x$(dirname $(pwd)) = x$(busybox dirname $(pwd)) 2 | 3 | -------------------------------------------------------------------------------- /testsuite/du/du-h-works: -------------------------------------------------------------------------------- 1 | d=/system/bin 2 | du -h "$d" > logfile.gnu 3 | busybox du -h "$d" > logfile.bb 4 | cmp logfile.gnu logfile.bb 5 | -------------------------------------------------------------------------------- /testsuite/du/du-k-works: -------------------------------------------------------------------------------- 1 | d=/system/bin 2 | du -k "$d" > logfile.gnu 3 | busybox du -k "$d" > logfile.bb 4 | cmp logfile.gnu logfile.bb 5 | -------------------------------------------------------------------------------- /testsuite/du/du-l-works: -------------------------------------------------------------------------------- 1 | d=/system/bin 2 | du -l "$d" > logfile.gnu 3 | busybox du -l "$d" > logfile.bb 4 | cmp logfile.gnu logfile.bb 5 | -------------------------------------------------------------------------------- /testsuite/du/du-m-works: -------------------------------------------------------------------------------- 1 | d=/system/bin 2 | du -m "$d" > logfile.gnu 3 | busybox du -m "$d" > logfile.bb 4 | cmp logfile.gnu logfile.bb 5 | -------------------------------------------------------------------------------- /testsuite/du/du-s-works: -------------------------------------------------------------------------------- 1 | d=/system/bin 2 | du -s "$d" > logfile.gnu 3 | busybox du -s "$d" > logfile.bb 4 | cmp logfile.gnu logfile.bb 5 | -------------------------------------------------------------------------------- /testsuite/du/du-works: -------------------------------------------------------------------------------- 1 | d=/system/bin 2 | du "$d" > logfile.gnu 3 | busybox du "$d" > logfile.bb 4 | cmp logfile.gnu logfile.bb 5 | -------------------------------------------------------------------------------- /testsuite/echo/echo-does-not-print-newline: -------------------------------------------------------------------------------- 1 | test `busybox echo -n word | wc -c` -eq 4 2 | -------------------------------------------------------------------------------- /testsuite/echo/echo-prints-argument: -------------------------------------------------------------------------------- 1 | test xfubar = x`busybox echo fubar` 2 | -------------------------------------------------------------------------------- /testsuite/echo/echo-prints-arguments: -------------------------------------------------------------------------------- 1 | test "`busybox echo foo bar`" = "foo bar" 2 | -------------------------------------------------------------------------------- /testsuite/echo/echo-prints-newline: -------------------------------------------------------------------------------- 1 | test `busybox echo word | wc -c` -eq 5 2 | -------------------------------------------------------------------------------- /testsuite/echo/echo-prints-slash-zero: -------------------------------------------------------------------------------- 1 | test "`busybox echo -e -n 'msg\n\0' | od -t x1 | head -n 1`" = "0000000 6d 73 67 0a 00" 2 | -------------------------------------------------------------------------------- /testsuite/expand.tests: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright 2008 by Denys Vlasenko 3 | # Licensed under GPL v2, see file LICENSE for details. 4 | 5 | . ./testing.sh 6 | 7 | # testing "test name" "options" "expected result" "file input" "stdin" 8 | 9 | testing "expand" \ 10 | "expand" \ 11 | " 12345678 12345678\n" \ 12 | "" \ 13 | "\t12345678\t12345678\n" \ 14 | 15 | testing "expand with unicode characher 0x394" \ 16 | "expand" \ 17 | "Δ 12345ΔΔΔ 12345678\n" \ 18 | "" \ 19 | "Δ\t12345ΔΔΔ\t12345678\n" \ 20 | 21 | exit $FAILCOUNT 22 | -------------------------------------------------------------------------------- /testsuite/expand/expand-works-like-GNU: -------------------------------------------------------------------------------- 1 | rm -f foo bar 2 | echo -e "\ty" | expand -t 3 ../../busybox > foo 3 | echo -e "\ty" | busybox unexpand -t 3 ../../busybox > bar 4 | set +e 5 | test ! -f foo -a -f bar 6 | if [ $? = 0 ] ; then 7 | set -e 8 | diff -q foo bar 9 | fi 10 | rm -f foo bar 11 | echo -e "\ty\tx" | expand -it 3 ../../busybox > foo 12 | echo -e "\ty\tx" | busybox unexpand -it 3 ../../busybox > bar 13 | set +e 14 | test ! -f foo -a -f bar 15 | if [ $? = 0 ] ; then 16 | set -e 17 | diff -q foo bar 18 | fi 19 | -------------------------------------------------------------------------------- /testsuite/expr/expr-big: -------------------------------------------------------------------------------- 1 | # busybox expr 2 | 3 | # 3*1000*1000*1000 overflows 32-bit signed int 4 | res=`busybox expr 0 '<' 3000000000` 5 | [ x"$res" = x1 ] || exit 1 6 | 7 | # 9223372036854775807 = 2^31-1 8 | res=`busybox expr 0 '<' 9223372036854775807` 9 | [ x"$res" = x1 ] || exit 1 10 | # coreutils fails this one! 11 | res=`busybox expr -9223372036854775800 '<' 9223372036854775807` 12 | [ x"$res" = x1 ] || exit 1 13 | 14 | # This one works only by chance 15 | # res=`busybox expr 0 '<' 9223372036854775808` 16 | # [ x"$res" = x1 ] || exit 1 17 | -------------------------------------------------------------------------------- /testsuite/false/false-is-silent: -------------------------------------------------------------------------------- 1 | busybox false 2>&1 | cmp - /dev/null 2 | -------------------------------------------------------------------------------- /testsuite/false/false-returns-failure: -------------------------------------------------------------------------------- 1 | ! busybox false 2 | -------------------------------------------------------------------------------- /testsuite/find/find-supports-minus-xdev: -------------------------------------------------------------------------------- 1 | busybox find . -xdev >/dev/null 2>&1 2 | -------------------------------------------------------------------------------- /testsuite/gunzip.tests: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | . bunzip2.tests 4 | -------------------------------------------------------------------------------- /testsuite/gunzip/gunzip-reads-from-standard-input: -------------------------------------------------------------------------------- 1 | echo foo | gzip | busybox gunzip > output 2 | echo foo | cmp - output 3 | -------------------------------------------------------------------------------- /testsuite/gzip/gzip-accepts-multiple-files: -------------------------------------------------------------------------------- 1 | touch foo bar 2 | busybox gzip foo bar 3 | test -f foo.gz -a -f bar.gz 4 | -------------------------------------------------------------------------------- /testsuite/gzip/gzip-accepts-single-minus: -------------------------------------------------------------------------------- 1 | echo foo | busybox gzip - >/dev/null 2 | -------------------------------------------------------------------------------- /testsuite/gzip/gzip-removes-original-file: -------------------------------------------------------------------------------- 1 | touch foo 2 | busybox gzip foo 3 | test ! -f foo 4 | -------------------------------------------------------------------------------- /testsuite/head/head-n-works: -------------------------------------------------------------------------------- 1 | [ -n "$d" ] || d=.. 2 | head -n 2 "$d/README" > logfile.gnu 3 | busybox head -n 2 "$d/README" > logfile.bb 4 | cmp logfile.gnu logfile.bb 5 | -------------------------------------------------------------------------------- /testsuite/head/head-works: -------------------------------------------------------------------------------- 1 | [ -n "$d" ] || d=.. 2 | head "$d/README" > logfile.gnu 3 | busybox head "$d/README" > logfile.bb 4 | cmp logfile.gnu logfile.bb 5 | -------------------------------------------------------------------------------- /testsuite/hostid/hostid-works: -------------------------------------------------------------------------------- 1 | test x$(hostid) = x$(busybox hostid) 2 | 3 | -------------------------------------------------------------------------------- /testsuite/hostname/hostname-d-works: -------------------------------------------------------------------------------- 1 | test x$(hostname -d) = x$(busybox hostname -d) 2 | 3 | -------------------------------------------------------------------------------- /testsuite/hostname/hostname-i-works: -------------------------------------------------------------------------------- 1 | test x"$SKIP_KNOWN_BUGS" != x"" && exit 2 | 3 | # Observed bug: 4 | # # ./busybox hostname -i 5 | # 127.0.0.1 6 | # # hostname -i 7 | # 127.0.0.1 10.0.0.2 10.32.10.45 8 | 9 | test x$(hostname -i) = x$(busybox hostname -i) 10 | -------------------------------------------------------------------------------- /testsuite/hostname/hostname-s-works: -------------------------------------------------------------------------------- 1 | test x$(hostname -s) = x$(busybox hostname -s) 2 | -------------------------------------------------------------------------------- /testsuite/hostname/hostname-works: -------------------------------------------------------------------------------- 1 | test x$(hostname) = x$(busybox hostname) 2 | -------------------------------------------------------------------------------- /testsuite/id/id-g-works: -------------------------------------------------------------------------------- 1 | test x$(id -g) = x$(busybox id -g) 2 | -------------------------------------------------------------------------------- /testsuite/id/id-u-works: -------------------------------------------------------------------------------- 1 | test x$(id -u) = x$(busybox id -u) 2 | -------------------------------------------------------------------------------- /testsuite/id/id-un-works: -------------------------------------------------------------------------------- 1 | test x$(id -un) = x$(busybox id -un) 2 | -------------------------------------------------------------------------------- /testsuite/id/id-ur-works: -------------------------------------------------------------------------------- 1 | test x$(id -ur) = x$(busybox id -ur) 2 | -------------------------------------------------------------------------------- /testsuite/ln/ln-creates-hard-links: -------------------------------------------------------------------------------- 1 | echo file number one > file1 2 | busybox ln file1 link1 3 | test -f file1 4 | test -f link1 5 | -------------------------------------------------------------------------------- /testsuite/ln/ln-creates-soft-links: -------------------------------------------------------------------------------- 1 | echo file number one > file1 2 | busybox ln -s file1 link1 3 | test -L link1 4 | test xfile1 = x`readlink link1` 5 | -------------------------------------------------------------------------------- /testsuite/ln/ln-force-creates-hard-links: -------------------------------------------------------------------------------- 1 | echo file number one > file1 2 | echo file number two > link1 3 | busybox ln -f file1 link1 4 | test -f file1 5 | test -f link1 6 | -------------------------------------------------------------------------------- /testsuite/ln/ln-force-creates-soft-links: -------------------------------------------------------------------------------- 1 | echo file number one > file1 2 | echo file number two > link1 3 | busybox ln -f -s file1 link1 4 | test -L link1 5 | test xfile1 = x`readlink link1` 6 | -------------------------------------------------------------------------------- /testsuite/ln/ln-preserves-hard-links: -------------------------------------------------------------------------------- 1 | echo file number one > file1 2 | echo file number two > link1 3 | set +e 4 | busybox ln file1 link1 5 | if [ $? != 0 ] ; then 6 | exit 0; 7 | fi 8 | exit 1; 9 | -------------------------------------------------------------------------------- /testsuite/ln/ln-preserves-soft-links: -------------------------------------------------------------------------------- 1 | echo file number one > file1 2 | echo file number two > link1 3 | set +e 4 | busybox ln -s file1 link1 5 | if [ $? != 0 ] ; then 6 | exit 0; 7 | fi 8 | exit 1; 9 | 10 | -------------------------------------------------------------------------------- /testsuite/ls/ls-1-works: -------------------------------------------------------------------------------- 1 | [ -n "$d" ] || d=.. 2 | LC_ALL=C ls -1 "$d" > logfile.gnu 3 | LC_ALL=C busybox ls -1 "$d" > logfile.bb 4 | diff -ubw logfile.gnu logfile.bb 5 | -------------------------------------------------------------------------------- /testsuite/ls/ls-h-works: -------------------------------------------------------------------------------- 1 | [ -n "$d" ] || d=.. 2 | LC_ALL=C ls -h "$d" > logfile.gnu 3 | LC_ALL=C busybox ls -h "$d" > logfile.bb 4 | diff -ubw logfile.gnu logfile.bb 5 | -------------------------------------------------------------------------------- /testsuite/ls/ls-l-works: -------------------------------------------------------------------------------- 1 | test x"$SKIP_KNOWN_BUGS" != x"" && exit 2 | 3 | # busybox does not emit "total NNN" line 4 | 5 | [ -n "$d" ] || d=.. 6 | LC_ALL=C ls -l "$d" > logfile.gnu 7 | LC_ALL=C busybox ls -l "$d" > logfile.bb 8 | diff -ubw logfile.gnu logfile.bb 9 | -------------------------------------------------------------------------------- /testsuite/ls/ls-s-works: -------------------------------------------------------------------------------- 1 | test x"$SKIP_KNOWN_BUGS" != x"" && exit 2 | 3 | # busybox does not emit "total NNN" line 4 | 5 | [ -n "$d" ] || d=.. 6 | LC_ALL=C ls -1s "$d" > logfile.gnu 7 | LC_ALL=C busybox ls -1s "$d" > logfile.bb 8 | diff -ubw logfile.gnu logfile.bb 9 | -------------------------------------------------------------------------------- /testsuite/md5sum/md5sum-verifies-non-binary-file: -------------------------------------------------------------------------------- 1 | touch foo 2 | md5sum foo > bar 3 | busybox md5sum -c bar 4 | -------------------------------------------------------------------------------- /testsuite/mkdir/mkdir-makes-a-directory: -------------------------------------------------------------------------------- 1 | busybox mkdir foo 2 | test -d foo 3 | -------------------------------------------------------------------------------- /testsuite/mkdir/mkdir-makes-parent-directories: -------------------------------------------------------------------------------- 1 | busybox mkdir -p foo/bar 2 | test -d foo -a -d foo/bar 3 | -------------------------------------------------------------------------------- /testsuite/mkfs.minix.tests: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # mkfs.minix tests. 4 | # Copyright 2007 by Denys Vlasenko 5 | # Licensed under GPL v2, see file LICENSE for details. 6 | 7 | . ./testing.sh 8 | 9 | # testing "test name" "options" "expected result" "file input" "stdin" 10 | 11 | testing "mkfs.minix" \ 12 | "dd if=/dev/zero of=input bs=1k count=1024 2>/dev/null; mkfs.minix input; md5sum file1 2 | echo file number two > file2 3 | ln -s file2 link1 4 | mkdir dir1 5 | TZ=UTC0 touch -d '2000-01-30 05:24:08' dir1/file3 6 | mkdir there 7 | busybox mv file1 file2 link1 dir1 there 8 | test -f there/file1 9 | test -f there/file2 10 | test -f there/dir1/file3 11 | test -L there/link1 12 | test xfile2 = x`readlink there/link1` 13 | test ! -e file1 14 | test ! -e file2 15 | test ! -e link1 16 | test ! -e dir1/file3 17 | -------------------------------------------------------------------------------- /testsuite/mv/mv-follows-links: -------------------------------------------------------------------------------- 1 | touch foo 2 | ln -s foo bar 3 | busybox mv bar baz 4 | test -f baz 5 | -------------------------------------------------------------------------------- /testsuite/mv/mv-moves-empty-file: -------------------------------------------------------------------------------- 1 | touch foo 2 | busybox mv foo bar 3 | test ! -e foo 4 | test -f bar 5 | -------------------------------------------------------------------------------- /testsuite/mv/mv-moves-file: -------------------------------------------------------------------------------- 1 | touch foo 2 | busybox mv foo bar 3 | test ! -f foo -a -f bar 4 | -------------------------------------------------------------------------------- /testsuite/mv/mv-moves-hardlinks: -------------------------------------------------------------------------------- 1 | touch foo 2 | ln foo bar 3 | busybox mv bar baz 4 | test ! -f bar -a -f baz 5 | -------------------------------------------------------------------------------- /testsuite/mv/mv-moves-large-file: -------------------------------------------------------------------------------- 1 | dd if=/dev/zero of=foo seek=10k count=1 2>/dev/null 2 | busybox mv foo bar 3 | test ! -e foo 4 | test -f bar 5 | -------------------------------------------------------------------------------- /testsuite/mv/mv-moves-small-file: -------------------------------------------------------------------------------- 1 | echo I WANT > foo 2 | busybox mv foo bar 3 | test ! -e foo 4 | test -f bar 5 | -------------------------------------------------------------------------------- /testsuite/mv/mv-moves-symlinks: -------------------------------------------------------------------------------- 1 | touch foo 2 | ln -s foo bar 3 | busybox mv bar baz 4 | test -f foo 5 | test ! -e bar 6 | test -L baz 7 | -------------------------------------------------------------------------------- /testsuite/mv/mv-moves-unreadable-files: -------------------------------------------------------------------------------- 1 | touch foo 2 | chmod a-r foo 3 | busybox mv foo bar 4 | test ! -e foo 5 | test -f bar 6 | -------------------------------------------------------------------------------- /testsuite/mv/mv-preserves-hard-links: -------------------------------------------------------------------------------- 1 | # FEATURE: CONFIG_FEATURE_PRESERVE_HARDLINKS 2 | touch foo 3 | ln foo bar 4 | mkdir baz 5 | busybox mv foo bar baz 6 | test baz/foo -ef baz/bar 7 | -------------------------------------------------------------------------------- /testsuite/mv/mv-preserves-links: -------------------------------------------------------------------------------- 1 | touch foo 2 | ln -s foo bar 3 | busybox mv bar baz 4 | test -L baz 5 | test xfoo = x`readlink baz` 6 | -------------------------------------------------------------------------------- /testsuite/mv/mv-refuses-mv-dir-to-subdir: -------------------------------------------------------------------------------- 1 | echo file number one > file1 2 | echo file number two > file2 3 | ln -s file2 link1 4 | mkdir dir1 5 | TZ=UTC0 touch -d '2000-01-30 05:24:08' dir1/file3 6 | mkdir there 7 | busybox mv file1 file2 link1 dir1 there 8 | test -f there/file1 9 | test -f there/file2 10 | test -f there/dir1/file3 11 | test -L there/link1 12 | test xfile2 = x`readlink there/link1` 13 | test ! -e file1 14 | test ! -e file2 15 | test ! -e link1 16 | test ! -e dir1/file3 17 | set +e 18 | busybox mv there there/dir1 19 | if [ $? != 0 ] ; then 20 | exit 0; 21 | fi 22 | 23 | exit 1; 24 | -------------------------------------------------------------------------------- /testsuite/mv/mv-removes-source-file: -------------------------------------------------------------------------------- 1 | touch foo 2 | busybox mv foo bar 3 | test ! -e foo 4 | test -f bar 5 | -------------------------------------------------------------------------------- /testsuite/od.tests: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright 2008 by Denys Vlasenko 3 | # Licensed under GPL v2, see file LICENSE for details. 4 | 5 | . ./testing.sh 6 | 7 | # testing "test name" "options" "expected result" "file input" "stdin" 8 | 9 | testing "od -b" \ 10 | "od -b" \ 11 | "\ 12 | 0000000 110 105 114 114 117 13 | 0000005 14 | " \ 15 | "" "HELLO" 16 | 17 | exit $FAILCOUNT 18 | -------------------------------------------------------------------------------- /testsuite/pwd/pwd-prints-working-directory: -------------------------------------------------------------------------------- 1 | test $(pwd) = $(busybox pwd) 2 | -------------------------------------------------------------------------------- /testsuite/rm/rm-removes-file: -------------------------------------------------------------------------------- 1 | touch foo 2 | busybox rm foo 3 | test ! -f foo 4 | -------------------------------------------------------------------------------- /testsuite/rmdir/rmdir-removes-parent-directories: -------------------------------------------------------------------------------- 1 | mkdir -p foo/bar 2 | busybox rmdir -p foo/bar 3 | test ! -d foo 4 | -------------------------------------------------------------------------------- /testsuite/start-stop-daemon.tests: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright 2008 by Denys Vlasenko 3 | # Licensed under GPL v2, see file LICENSE for details. 4 | 5 | . ./testing.sh 6 | 7 | # testing "test name" "cmd" "expected result" "file input" "stdin" 8 | 9 | testing "start-stop-daemon -x without -a" \ 10 | 'start-stop-daemon -S -x true 2>&1; echo $?' \ 11 | "0\n" \ 12 | "" "" 13 | 14 | testing "start-stop-daemon -a without -x" \ 15 | 'start-stop-daemon -S -a false 2>&1; echo $?' \ 16 | "1\n" \ 17 | "" "" 18 | 19 | exit $FAILCOUNT 20 | -------------------------------------------------------------------------------- /testsuite/strings/strings-works-like-GNU: -------------------------------------------------------------------------------- 1 | rm -f foo bar 2 | strings -af ../../busybox > foo 3 | busybox strings -af ../../busybox > bar 4 | set +e 5 | test ! -f foo -a -f bar 6 | if [ $? = 0 ] ; then 7 | set -e 8 | diff -q foo bar 9 | fi 10 | -------------------------------------------------------------------------------- /testsuite/tail.tests: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Copyright 2009 by Denys Vlasenko 4 | # Licensed under GPL v2, see file LICENSE for details. 5 | 6 | . ./testing.sh 7 | 8 | # testing "test name" "command" "expected result" "file input" "stdin" 9 | # file input will be file called "input" 10 | # test can create a file "actual" instead of writing to stdout 11 | 12 | testing "tail: +N with N > file length" \ 13 | "tail -c +55 2>&1; echo \$?" \ 14 | "0\n" \ 15 | "" "qw" 16 | 17 | exit $FAILCOUNT 18 | -------------------------------------------------------------------------------- /testsuite/tail/tail-n-works: -------------------------------------------------------------------------------- 1 | $ECHO -ne "abc\ndef\n123\n" >input 2 | $ECHO -ne "def\n123\n" >logfile.ok 3 | busybox tail -n 2 input > logfile.bb 4 | cmp logfile.ok logfile.bb 5 | -------------------------------------------------------------------------------- /testsuite/tail/tail-works: -------------------------------------------------------------------------------- 1 | $ECHO -ne "abc\ndef\n123\n" >input 2 | $ECHO -ne "def\n123\n" >logfile.ok 3 | busybox tail -2 input > logfile.bb 4 | cmp logfile.ok logfile.bb 5 | -------------------------------------------------------------------------------- /testsuite/tar/tar-archives-multiple-files: -------------------------------------------------------------------------------- 1 | # FEATURE: CONFIG_FEATURE_TAR_CREATE 2 | touch foo bar 3 | busybox tar cf foo.tar foo bar 4 | rm foo bar 5 | tar xf foo.tar 6 | test -f foo -a -f bar 7 | -------------------------------------------------------------------------------- /testsuite/tar/tar-complains-about-missing-file: -------------------------------------------------------------------------------- 1 | touch foo 2 | tar cf foo.tar foo 3 | ! busybox tar xf foo.tar bar 4 | -------------------------------------------------------------------------------- /testsuite/tar/tar-demands-at-least-one-ctx: -------------------------------------------------------------------------------- 1 | ! busybox tar v 2 | -------------------------------------------------------------------------------- /testsuite/tar/tar-demands-at-most-one-ctx: -------------------------------------------------------------------------------- 1 | ! busybox tar tx 2 | -------------------------------------------------------------------------------- /testsuite/tar/tar-extracts-all-subdirs: -------------------------------------------------------------------------------- 1 | # FEATURE: CONFIG_FEATURE_TAR_CREATE 2 | mkdir -p foo/{1,2,3} 3 | mkdir -p foo/1/{10,11} 4 | mkdir -p foo/1/10/{100,101,102} 5 | tar cf foo.tar -C foo . 6 | rm -rf foo/* 7 | busybox tar xf foo.tar -C foo ./1/10 8 | find foo | sort >logfile.bb 9 | rm -rf foo/* 10 | tar xf foo.tar -C foo ./1/10 11 | find foo | sort >logfile.gnu 12 | cmp logfile.gnu logfile.bb 13 | -------------------------------------------------------------------------------- /testsuite/tar/tar-extracts-file: -------------------------------------------------------------------------------- 1 | touch foo 2 | tar cf foo.tar foo 3 | rm foo 4 | busybox tar xf foo.tar 5 | test -f foo 6 | -------------------------------------------------------------------------------- /testsuite/tar/tar-extracts-from-standard-input: -------------------------------------------------------------------------------- 1 | touch foo 2 | tar cf foo.tar foo 3 | rm foo 4 | cat foo.tar | busybox tar x 5 | test -f foo 6 | -------------------------------------------------------------------------------- /testsuite/tar/tar-extracts-multiple-files: -------------------------------------------------------------------------------- 1 | touch foo bar 2 | tar cf foo.tar foo bar 3 | rm foo bar 4 | busybox tar -xf foo.tar 5 | test -f foo 6 | test -f bar 7 | -------------------------------------------------------------------------------- /testsuite/tar/tar-extracts-to-standard-output: -------------------------------------------------------------------------------- 1 | echo foo > foo 2 | tar cf foo.tar foo 3 | cat foo.tar | busybox tar Ox | cmp foo - 4 | -------------------------------------------------------------------------------- /testsuite/tar/tar-handles-cz-options: -------------------------------------------------------------------------------- 1 | # FEATURE: CONFIG_FEATURE_TAR_CREATE 2 | # FEATURE: CONFIG_FEATURE_SEAMLESS_GZ 3 | touch foo 4 | busybox tar czf foo.tar.gz foo 5 | gzip -d foo.tar.gz 6 | -------------------------------------------------------------------------------- /testsuite/tar/tar-handles-empty-include-and-non-empty-exclude-list: -------------------------------------------------------------------------------- 1 | # FEATURE: CONFIG_FEATURE_TAR_FROM 2 | # FEATURE: CONFIG_FEATURE_TAR_CREATE 3 | touch foo 4 | tar cf foo.tar foo 5 | echo foo >foo.exclude 6 | busybox tar xf foo.tar -X foo.exclude 7 | -------------------------------------------------------------------------------- /testsuite/tar/tar-handles-exclude-and-extract-lists: -------------------------------------------------------------------------------- 1 | # FEATURE: CONFIG_FEATURE_TAR_FROM 2 | # FEATURE: CONFIG_FEATURE_TAR_CREATE 3 | touch foo bar baz 4 | tar cf foo.tar foo bar baz 5 | echo foo >foo.exclude 6 | rm foo bar baz 7 | busybox tar xf foo.tar foo bar -X foo.exclude 8 | test ! -f foo -a -f bar -a ! -f baz 9 | -------------------------------------------------------------------------------- /testsuite/tar/tar-handles-multiple-X-options: -------------------------------------------------------------------------------- 1 | # FEATURE: CONFIG_FEATURE_TAR_FROM 2 | # FEATURE: CONFIG_FEATURE_TAR_CREATE 3 | touch foo 4 | touch bar 5 | tar cf foo.tar foo bar 6 | echo foo > foo.exclude 7 | echo bar > bar.exclude 8 | rm foo bar 9 | busybox tar xf foo.tar -X foo.exclude -X bar.exclude 10 | test ! -f foo -a ! -f bar 11 | -------------------------------------------------------------------------------- /testsuite/tar/tar-handles-nested-exclude: -------------------------------------------------------------------------------- 1 | # FEATURE: CONFIG_FEATURE_TAR_FROM 2 | # FEATURE: CONFIG_FEATURE_TAR_CREATE 3 | mkdir foo 4 | touch foo/bar 5 | tar cf foo.tar foo 6 | rm -rf foo 7 | echo foo/bar >foobar.exclude 8 | busybox tar xf foo.tar foo -X foobar.exclude 9 | test -d foo -a ! -f foo/bar 10 | -------------------------------------------------------------------------------- /testsuite/tee/tee-appends-input: -------------------------------------------------------------------------------- 1 | echo i\'m a little teapot >foo 2 | cp foo bar 3 | echo i\'m a little teapot >>foo 4 | echo i\'m a little teapot | busybox tee -a bar >/dev/null 5 | cmp foo bar 6 | -------------------------------------------------------------------------------- /testsuite/tee/tee-tees-input: -------------------------------------------------------------------------------- 1 | echo i\'m a little teapot >foo 2 | echo i\'m a little teapot | busybox tee bar >baz 3 | cmp foo bar && cmp foo baz 4 | -------------------------------------------------------------------------------- /testsuite/touch/touch-creates-file: -------------------------------------------------------------------------------- 1 | busybox touch foo 2 | test -f foo 3 | -------------------------------------------------------------------------------- /testsuite/touch/touch-does-not-create-file: -------------------------------------------------------------------------------- 1 | busybox touch -c foo 2 | test ! -f foo 3 | -------------------------------------------------------------------------------- /testsuite/touch/touch-touches-files-after-non-existent-file: -------------------------------------------------------------------------------- 1 | touch -t 198001010000 bar 2 | busybox touch -c foo bar 3 | test x"`find bar -mtime -1`" = xbar 4 | -------------------------------------------------------------------------------- /testsuite/tr/tr-d-alnum-works: -------------------------------------------------------------------------------- 1 | echo testing | tr -d '[[:alnum:]]' > logfile.gnu 2 | echo testing | busybox tr -d '[[:alnum:]]' > logfile.bb 3 | 4 | diff -u logfile.gnu logfile.bb 5 | -------------------------------------------------------------------------------- /testsuite/tr/tr-d-works: -------------------------------------------------------------------------------- 1 | echo testing | tr -d aeiou > logfile.gnu 2 | echo testing | busybox tr -d aeiou > logfile.bb 3 | 4 | diff -u logfile.gnu logfile.bb 5 | -------------------------------------------------------------------------------- /testsuite/tr/tr-non-gnu: -------------------------------------------------------------------------------- 1 | echo fdhrnzvfu bffvsentr | busybox tr '[a-z]' '[n-z][a-m]' 2 | -------------------------------------------------------------------------------- /testsuite/true/true-is-silent: -------------------------------------------------------------------------------- 1 | busybox true 2>&1 | cmp - /dev/null 2 | -------------------------------------------------------------------------------- /testsuite/true/true-returns-success: -------------------------------------------------------------------------------- 1 | busybox true 2 | -------------------------------------------------------------------------------- /testsuite/umlwrapper.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Wrapper for User Mode Linux emulation environment 4 | 5 | RUNFILE="$(pwd)/${1}.testroot" 6 | if [ -z "$RUNFILE" ] || [ ! -x "$RUNFILE" ] 7 | then 8 | echo "Can't run '$RUNFILE'" 9 | exit 1 10 | fi 11 | 12 | shift 13 | 14 | if [ -z $(which linux) ] 15 | then 16 | echo "No User Mode Linux." 17 | exit 1; 18 | fi 19 | 20 | linux rootfstype=hostfs rw init="$RUNFILE" TESTDIR=`pwd` PATH="$PATH" $* quiet 21 | -------------------------------------------------------------------------------- /testsuite/uptime/uptime-works: -------------------------------------------------------------------------------- 1 | busybox uptime 2 | 3 | -------------------------------------------------------------------------------- /testsuite/wc/wc-counts-all: -------------------------------------------------------------------------------- 1 | # 1 line, 4 words, 20 chars. 2 | test "`echo i\'m a little teapot | busybox wc | sed 's/ */ /g' | sed 's/^ //'`" = '1 4 20' 3 | -------------------------------------------------------------------------------- /testsuite/wc/wc-counts-characters: -------------------------------------------------------------------------------- 1 | test `echo i\'m a little teapot | busybox wc -c` -eq 20 2 | -------------------------------------------------------------------------------- /testsuite/wc/wc-counts-lines: -------------------------------------------------------------------------------- 1 | test `echo i\'m a little teapot | busybox wc -l` -eq 1 2 | -------------------------------------------------------------------------------- /testsuite/wc/wc-counts-words: -------------------------------------------------------------------------------- 1 | test `echo i\'m a little teapot | busybox wc -w` -eq 4 2 | -------------------------------------------------------------------------------- /testsuite/wc/wc-prints-longest-line-length: -------------------------------------------------------------------------------- 1 | test `echo i\'m a little teapot | busybox wc -L` -eq 19 2 | -------------------------------------------------------------------------------- /testsuite/wget/wget--O-overrides--P: -------------------------------------------------------------------------------- 1 | test x"$SKIP_INTERNET_TESTS" != x"" && exit 2 | 3 | mkdir foo 4 | busybox wget -q -O index.html -P foo http://www.google.com/ 5 | test -s index.html 6 | -------------------------------------------------------------------------------- /testsuite/wget/wget-handles-empty-path: -------------------------------------------------------------------------------- 1 | test x"$SKIP_INTERNET_TESTS" != x"" && exit 2 | 3 | busybox wget http://www.google.com 4 | -------------------------------------------------------------------------------- /testsuite/wget/wget-retrieves-google-index: -------------------------------------------------------------------------------- 1 | test x"$SKIP_INTERNET_TESTS" != x"" && exit 2 | 3 | busybox wget -q -O foo http://www.google.com/ 4 | test -s foo 5 | -------------------------------------------------------------------------------- /testsuite/wget/wget-supports--P: -------------------------------------------------------------------------------- 1 | test x"$SKIP_INTERNET_TESTS" != x"" && exit 2 | 3 | mkdir foo 4 | busybox wget -q -P foo http://www.google.com/ 5 | test -s foo/index.html 6 | -------------------------------------------------------------------------------- /testsuite/which/which-uses-default-path: -------------------------------------------------------------------------------- 1 | BUSYBOX=$(type -p busybox) 2 | SAVED_PATH=$PATH 3 | unset PATH 4 | $BUSYBOX which ls 5 | -------------------------------------------------------------------------------- /testsuite/xargs/xargs-works: -------------------------------------------------------------------------------- 1 | [ -n "$d" ] || d=.. 2 | find "$d" -name \*works -type f | xargs md5sum > logfile.gnu 3 | find "$d" -name \*works -type f | busybox xargs md5sum > logfile.bb 4 | diff -u logfile.gnu logfile.bb 5 | -------------------------------------------------------------------------------- /util-linux/blkid.c: -------------------------------------------------------------------------------- 1 | /* vi: set sw=4 ts=4: */ 2 | /* 3 | * Print UUIDs on all filesystems 4 | * 5 | * Copyright (C) 2008 Denys Vlasenko. 6 | * 7 | * Licensed under GPLv2, see file LICENSE in this tarball for details. 8 | */ 9 | 10 | #include "libbb.h" 11 | #include "volume_id.h" 12 | 13 | int blkid_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 14 | int blkid_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) 15 | { 16 | display_uuid_cache(); 17 | return 0; 18 | } 19 | --------------------------------------------------------------------------------