summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TEST_config_noprintf929
-rw-r--r--archival/gzip.c2
-rw-r--r--debianutils/pipe_progress.c4
-rw-r--r--findutils/xargs.c4
-rw-r--r--include/libbb.h2
-rw-r--r--libbb/Kbuild.src1
-rw-r--r--libbb/read.c365
-rw-r--r--libbb/read_printf.c374
-rw-r--r--libbb/xfuncs.c73
-rw-r--r--libbb/xfuncs_printf.c74
-rw-r--r--miscutils/crond.c2
-rw-r--r--networking/tftp.c2
-rw-r--r--networking/wget.c2
13 files changed, 1390 insertions, 444 deletions
diff --git a/TEST_config_noprintf b/TEST_config_noprintf
new file mode 100644
index 0000000..f787e7a
--- /dev/null
+++ b/TEST_config_noprintf
@@ -0,0 +1,929 @@
+#
+# Automatically generated make config: don't edit
+# Busybox version: 1.17.0.git
+# Sun Jun 6 21:38:58 2010
+#
+CONFIG_HAVE_DOT_CONFIG=y
+
+#
+# Busybox Settings
+#
+
+#
+# General Configuration
+#
+CONFIG_DESKTOP=y
+CONFIG_EXTRA_COMPAT=y
+CONFIG_INCLUDE_SUSv2=y
+# CONFIG_USE_PORTABLE_CODE is not set
+CONFIG_FEATURE_BUFFERS_USE_MALLOC=y
+# CONFIG_FEATURE_BUFFERS_GO_ON_STACK is not set
+# CONFIG_FEATURE_BUFFERS_GO_IN_BSS is not set
+CONFIG_SHOW_USAGE=y
+CONFIG_FEATURE_VERBOSE_USAGE=y
+# CONFIG_FEATURE_COMPRESS_USAGE is not set
+# CONFIG_FEATURE_INSTALLER is not set
+# CONFIG_LOCALE_SUPPORT is not set
+CONFIG_UNICODE_SUPPORT=y
+# CONFIG_UNICODE_USING_LOCALE is not set
+CONFIG_FEATURE_CHECK_UNICODE_IN_ENV=y
+CONFIG_SUBST_WCHAR=63
+CONFIG_LAST_SUPPORTED_WCHAR=65535
+CONFIG_UNICODE_COMBINING_WCHARS=y
+CONFIG_UNICODE_WIDE_WCHARS=y
+CONFIG_UNICODE_BIDI_SUPPORT=y
+# CONFIG_UNICODE_NEUTRAL_TABLE is not set
+CONFIG_UNICODE_PRESERVE_BROKEN=y
+CONFIG_LONG_OPTS=y
+CONFIG_FEATURE_DEVPTS=y
+# CONFIG_FEATURE_CLEAN_UP is not set
+CONFIG_FEATURE_UTMP=y
+CONFIG_FEATURE_WTMP=y
+CONFIG_FEATURE_PIDFILE=y
+# CONFIG_FEATURE_SUID is not set
+# CONFIG_FEATURE_SUID_CONFIG is not set
+# CONFIG_FEATURE_SUID_CONFIG_QUIET is not set
+# CONFIG_SELINUX is not set
+# CONFIG_FEATURE_PREFER_APPLETS is not set
+CONFIG_BUSYBOX_EXEC_PATH="/proc/self/exe"
+# CONFIG_FEATURE_SYSLOG is not set
+# CONFIG_FEATURE_HAVE_RPC is not set
+
+#
+# Build Options
+#
+CONFIG_STATIC=y
+# CONFIG_PIE is not set
+# CONFIG_NOMMU is not set
+# CONFIG_BUILD_LIBBUSYBOX is not set
+# CONFIG_FEATURE_INDIVIDUAL is not set
+# CONFIG_FEATURE_SHARED_BUSYBOX is not set
+CONFIG_LFS=y
+CONFIG_CROSS_COMPILER_PREFIX="i486-linux-uclibc-"
+CONFIG_EXTRA_CFLAGS=""
+
+#
+# Debugging Options
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PESSIMIZE is not set
+CONFIG_WERROR=y
+CONFIG_NO_DEBUG_LIB=y
+# CONFIG_DMALLOC is not set
+# CONFIG_EFENCE is not set
+
+#
+# Installation Options
+#
+# CONFIG_INSTALL_NO_USR is not set
+CONFIG_INSTALL_APPLET_SYMLINKS=y
+# CONFIG_INSTALL_APPLET_HARDLINKS is not set
+# CONFIG_INSTALL_APPLET_SCRIPT_WRAPPERS is not set
+# CONFIG_INSTALL_APPLET_DONT is not set
+# CONFIG_INSTALL_SH_APPLET_SYMLINK is not set
+# CONFIG_INSTALL_SH_APPLET_HARDLINK is not set
+# CONFIG_INSTALL_SH_APPLET_SCRIPT_WRAPPER is not set
+CONFIG_PREFIX="./_install"
+
+#
+# Busybox Library Tuning
+#
+CONFIG_PASSWORD_MINLEN=6
+CONFIG_MD5_SIZE_VS_SPEED=2
+CONFIG_FEATURE_FAST_TOP=y
+# CONFIG_FEATURE_ETC_NETWORKS is not set
+CONFIG_FEATURE_EDITING=y
+CONFIG_FEATURE_EDITING_MAX_LEN=1024
+CONFIG_FEATURE_EDITING_VI=y
+CONFIG_FEATURE_EDITING_HISTORY=15
+# CONFIG_FEATURE_EDITING_SAVEHISTORY is not set
+CONFIG_FEATURE_TAB_COMPLETION=y
+CONFIG_FEATURE_USERNAME_COMPLETION=y
+CONFIG_FEATURE_EDITING_FANCY_PROMPT=y
+CONFIG_FEATURE_EDITING_ASK_TERMINAL=y
+CONFIG_FEATURE_NON_POSIX_CP=y
+# CONFIG_FEATURE_VERBOSE_CP_MESSAGE is not set
+CONFIG_FEATURE_COPYBUF_KB=64
+CONFIG_MONOTONIC_SYSCALL=y
+# CONFIG_IOCTL_HEX2STR_ERROR is not set
+CONFIG_FEATURE_HWIB=y
+
+#
+# Applets
+#
+
+#
+# Archival Utilities
+#
+CONFIG_FEATURE_SEAMLESS_XZ=y
+CONFIG_FEATURE_SEAMLESS_LZMA=y
+CONFIG_FEATURE_SEAMLESS_BZ2=y
+CONFIG_FEATURE_SEAMLESS_GZ=y
+CONFIG_FEATURE_SEAMLESS_Z=y
+# CONFIG_AR is not set
+# CONFIG_FEATURE_AR_LONG_FILENAMES is not set
+# CONFIG_FEATURE_AR_CREATE is not set
+# CONFIG_BUNZIP2 is not set
+# CONFIG_BZIP2 is not set
+# CONFIG_CPIO is not set
+# CONFIG_FEATURE_CPIO_O is not set
+# CONFIG_FEATURE_CPIO_P is not set
+# CONFIG_DPKG is not set
+# CONFIG_DPKG_DEB is not set
+# CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY is not set
+# CONFIG_GUNZIP is not set
+# CONFIG_GZIP is not set
+# CONFIG_FEATURE_GZIP_LONG_OPTIONS is not set
+# CONFIG_LZOP is not set
+# CONFIG_LZOP_COMPR_HIGH is not set
+# CONFIG_RPM2CPIO is not set
+# CONFIG_RPM is not set
+# CONFIG_TAR is not set
+# CONFIG_FEATURE_TAR_CREATE is not set
+# CONFIG_FEATURE_TAR_AUTODETECT is not set
+# CONFIG_FEATURE_TAR_FROM is not set
+# CONFIG_FEATURE_TAR_OLDGNU_COMPATIBILITY is not set
+# CONFIG_FEATURE_TAR_OLDSUN_COMPATIBILITY is not set
+# CONFIG_FEATURE_TAR_GNU_EXTENSIONS is not set
+# CONFIG_FEATURE_TAR_LONG_OPTIONS is not set
+# CONFIG_FEATURE_TAR_UNAME_GNAME is not set
+# CONFIG_FEATURE_TAR_NOPRESERVE_TIME is not set
+# CONFIG_FEATURE_TAR_SELINUX is not set
+# CONFIG_UNCOMPRESS is not set
+# CONFIG_UNLZMA is not set
+# CONFIG_FEATURE_LZMA_FAST is not set
+# CONFIG_LZMA is not set
+# CONFIG_UNXZ is not set
+# CONFIG_XZ is not set
+# CONFIG_UNZIP is not set
+
+#
+# Coreutils
+#
+CONFIG_BASENAME=y
+# CONFIG_CAT is not set
+# CONFIG_DATE is not set
+# CONFIG_FEATURE_DATE_ISOFMT is not set
+# CONFIG_FEATURE_DATE_NANO is not set
+# CONFIG_FEATURE_DATE_COMPAT is not set
+# CONFIG_TEST is not set
+# CONFIG_FEATURE_TEST_64 is not set
+# CONFIG_TR is not set
+# CONFIG_FEATURE_TR_CLASSES is not set
+# CONFIG_FEATURE_TR_EQUIV is not set
+# CONFIG_CAL is not set
+# CONFIG_CATV is not set
+# CONFIG_CHGRP is not set
+# CONFIG_CHMOD is not set
+# CONFIG_CHOWN is not set
+# CONFIG_FEATURE_CHOWN_LONG_OPTIONS is not set
+# CONFIG_CHROOT is not set
+# CONFIG_CKSUM is not set
+# CONFIG_COMM is not set
+# CONFIG_CP is not set
+# CONFIG_FEATURE_CP_LONG_OPTIONS is not set
+# CONFIG_CUT is not set
+# CONFIG_DD is not set
+# CONFIG_FEATURE_DD_SIGNAL_HANDLING is not set
+# CONFIG_FEATURE_DD_THIRD_STATUS_LINE is not set
+# CONFIG_FEATURE_DD_IBS_OBS is not set
+# CONFIG_DF is not set
+# CONFIG_FEATURE_DF_FANCY is not set
+# CONFIG_DIRNAME is not set
+# CONFIG_DOS2UNIX is not set
+# CONFIG_UNIX2DOS is not set
+# CONFIG_DU is not set
+# CONFIG_FEATURE_DU_DEFAULT_BLOCKSIZE_1K is not set
+# CONFIG_ECHO is not set
+# CONFIG_FEATURE_FANCY_ECHO is not set
+# CONFIG_ENV is not set
+# CONFIG_FEATURE_ENV_LONG_OPTIONS is not set
+# CONFIG_EXPAND is not set
+# CONFIG_FEATURE_EXPAND_LONG_OPTIONS is not set
+# CONFIG_EXPR is not set
+# CONFIG_EXPR_MATH_SUPPORT_64 is not set
+CONFIG_FALSE=y
+# CONFIG_FOLD is not set
+# CONFIG_FSYNC is not set
+# CONFIG_HEAD is not set
+# CONFIG_FEATURE_FANCY_HEAD is not set
+# CONFIG_HOSTID is not set
+# CONFIG_ID is not set
+# CONFIG_INSTALL is not set
+# CONFIG_FEATURE_INSTALL_LONG_OPTIONS is not set
+# CONFIG_LENGTH is not set
+# CONFIG_LN is not set
+# CONFIG_LOGNAME is not set
+# CONFIG_LS is not set
+# CONFIG_FEATURE_LS_FILETYPES is not set
+# CONFIG_FEATURE_LS_FOLLOWLINKS is not set
+# CONFIG_FEATURE_LS_RECURSIVE is not set
+# CONFIG_FEATURE_LS_SORTFILES is not set
+# CONFIG_FEATURE_LS_TIMESTAMPS is not set
+# CONFIG_FEATURE_LS_USERNAME is not set
+# CONFIG_FEATURE_LS_COLOR is not set
+# CONFIG_FEATURE_LS_COLOR_IS_DEFAULT is not set
+# CONFIG_MD5SUM is not set
+# CONFIG_MKDIR is not set
+# CONFIG_FEATURE_MKDIR_LONG_OPTIONS is not set
+# CONFIG_MKFIFO is not set
+# CONFIG_MKNOD is not set
+# CONFIG_MV is not set
+# CONFIG_FEATURE_MV_LONG_OPTIONS is not set
+# CONFIG_NICE is not set
+# CONFIG_NOHUP is not set
+# CONFIG_OD is not set
+# CONFIG_PRINTENV is not set
+# CONFIG_PRINTF is not set
+# CONFIG_PWD is not set
+# CONFIG_READLINK is not set
+# CONFIG_FEATURE_READLINK_FOLLOW is not set
+# CONFIG_REALPATH is not set
+# CONFIG_RM is not set
+# CONFIG_RMDIR is not set
+# CONFIG_FEATURE_RMDIR_LONG_OPTIONS is not set
+# CONFIG_SEQ is not set
+# CONFIG_SHA1SUM is not set
+# CONFIG_SHA256SUM is not set
+# CONFIG_SHA512SUM is not set
+# CONFIG_SLEEP is not set
+# CONFIG_FEATURE_FANCY_SLEEP is not set
+# CONFIG_FEATURE_FLOAT_SLEEP is not set
+# CONFIG_SORT is not set
+# CONFIG_FEATURE_SORT_BIG is not set
+# CONFIG_SPLIT is not set
+# CONFIG_FEATURE_SPLIT_FANCY is not set
+# CONFIG_STAT is not set
+# CONFIG_FEATURE_STAT_FORMAT is not set
+# CONFIG_STTY is not set
+# CONFIG_SUM is not set
+# CONFIG_SYNC is not set
+# CONFIG_TAC is not set
+# CONFIG_TAIL is not set
+# CONFIG_FEATURE_FANCY_TAIL is not set
+# CONFIG_TEE is not set
+# CONFIG_FEATURE_TEE_USE_BLOCK_IO is not set
+# CONFIG_TOUCH is not set
+CONFIG_TRUE=y
+# CONFIG_TTY is not set
+# CONFIG_UNAME is not set
+# CONFIG_UNEXPAND is not set
+# CONFIG_FEATURE_UNEXPAND_LONG_OPTIONS is not set
+# CONFIG_UNIQ is not set
+# CONFIG_USLEEP is not set
+# CONFIG_UUDECODE is not set
+# CONFIG_UUENCODE is not set
+# CONFIG_WC is not set
+# CONFIG_FEATURE_WC_LARGE is not set
+# CONFIG_WHO is not set
+# CONFIG_WHOAMI is not set
+# CONFIG_YES is not set
+# CONFIG_FEATURE_PRESERVE_HARDLINKS is not set
+# CONFIG_FEATURE_AUTOWIDTH is not set
+# CONFIG_FEATURE_HUMAN_READABLE is not set
+# CONFIG_FEATURE_MD5_SHA1_SUM_CHECK is not set
+
+#
+# Console Utilities
+#
+# CONFIG_CHVT is not set
+# CONFIG_FGCONSOLE is not set
+# CONFIG_CLEAR is not set
+# CONFIG_DEALLOCVT is not set
+# CONFIG_DUMPKMAP is not set
+# CONFIG_KBD_MODE is not set
+# CONFIG_LOADFONT is not set
+# CONFIG_LOADKMAP is not set
+# CONFIG_OPENVT is not set
+# CONFIG_RESET is not set
+# CONFIG_RESIZE is not set
+# CONFIG_FEATURE_RESIZE_PRINT is not set
+# CONFIG_SETCONSOLE is not set
+# CONFIG_FEATURE_SETCONSOLE_LONG_OPTIONS is not set
+# CONFIG_SETFONT is not set
+# CONFIG_FEATURE_SETFONT_TEXTUAL_MAP is not set
+CONFIG_DEFAULT_SETFONT_DIR=""
+# CONFIG_SETKEYCODES is not set
+# CONFIG_SETLOGCONS is not set
+# CONFIG_SHOWKEY is not set
+# CONFIG_FEATURE_LOADFONT_PSF2 is not set
+# CONFIG_FEATURE_LOADFONT_RAW is not set
+
+#
+# Debian Utilities
+#
+# CONFIG_MKTEMP is not set
+CONFIG_PIPE_PROGRESS=y
+# CONFIG_RUN_PARTS is not set
+# CONFIG_FEATURE_RUN_PARTS_LONG_OPTIONS is not set
+# CONFIG_FEATURE_RUN_PARTS_FANCY is not set
+# CONFIG_START_STOP_DAEMON is not set
+# CONFIG_FEATURE_START_STOP_DAEMON_FANCY is not set
+# CONFIG_FEATURE_START_STOP_DAEMON_LONG_OPTIONS is not set
+# CONFIG_WHICH is not set
+
+#
+# Editors
+#
+# CONFIG_AWK is not set
+# CONFIG_FEATURE_AWK_LIBM is not set
+# CONFIG_CMP is not set
+# CONFIG_DIFF is not set
+# CONFIG_FEATURE_DIFF_LONG_OPTIONS is not set
+# CONFIG_FEATURE_DIFF_DIR is not set
+# CONFIG_ED is not set
+# CONFIG_PATCH is not set
+# CONFIG_SED is not set
+# CONFIG_VI is not set
+CONFIG_FEATURE_VI_MAX_LEN=0
+# CONFIG_FEATURE_VI_8BIT is not set
+# CONFIG_FEATURE_VI_COLON is not set
+# CONFIG_FEATURE_VI_YANKMARK is not set
+# CONFIG_FEATURE_VI_SEARCH is not set
+# CONFIG_FEATURE_VI_USE_SIGNALS is not set
+# CONFIG_FEATURE_VI_DOT_CMD is not set
+# CONFIG_FEATURE_VI_READONLY is not set
+# CONFIG_FEATURE_VI_SETOPTS is not set
+# CONFIG_FEATURE_VI_SET is not set
+# CONFIG_FEATURE_VI_WIN_RESIZE is not set
+# CONFIG_FEATURE_VI_ASK_TERMINAL is not set
+# CONFIG_FEATURE_VI_OPTIMIZE_CURSOR is not set
+# CONFIG_FEATURE_ALLOW_EXEC is not set
+
+#
+# Finding Utilities
+#
+# CONFIG_FIND is not set
+# CONFIG_FEATURE_FIND_PRINT0 is not set
+# CONFIG_FEATURE_FIND_MTIME is not set
+# CONFIG_FEATURE_FIND_MMIN is not set
+# CONFIG_FEATURE_FIND_PERM is not set
+# CONFIG_FEATURE_FIND_TYPE is not set
+# CONFIG_FEATURE_FIND_XDEV is not set
+# CONFIG_FEATURE_FIND_MAXDEPTH is not set
+# CONFIG_FEATURE_FIND_NEWER is not set
+# CONFIG_FEATURE_FIND_INUM is not set
+# CONFIG_FEATURE_FIND_EXEC is not set
+# CONFIG_FEATURE_FIND_USER is not set
+# CONFIG_FEATURE_FIND_GROUP is not set
+# CONFIG_FEATURE_FIND_NOT is not set
+# CONFIG_FEATURE_FIND_DEPTH is not set
+# CONFIG_FEATURE_FIND_PAREN is not set
+# CONFIG_FEATURE_FIND_SIZE is not set
+# CONFIG_FEATURE_FIND_PRUNE is not set
+# CONFIG_FEATURE_FIND_DELETE is not set
+# CONFIG_FEATURE_FIND_PATH is not set
+# CONFIG_FEATURE_FIND_REGEX is not set
+# CONFIG_FEATURE_FIND_CONTEXT is not set
+# CONFIG_FEATURE_FIND_LINKS is not set
+# CONFIG_GREP is not set
+# CONFIG_FEATURE_GREP_EGREP_ALIAS is not set
+# CONFIG_FEATURE_GREP_FGREP_ALIAS is not set
+# CONFIG_FEATURE_GREP_CONTEXT is not set
+# CONFIG_XARGS is not set
+# CONFIG_FEATURE_XARGS_SUPPORT_CONFIRMATION is not set
+# CONFIG_FEATURE_XARGS_SUPPORT_QUOTES is not set
+# CONFIG_FEATURE_XARGS_SUPPORT_TERMOPT is not set
+# CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM is not set
+
+#
+# Init Utilities
+#
+# CONFIG_INIT is not set
+# CONFIG_FEATURE_USE_INITTAB is not set
+# CONFIG_FEATURE_KILL_REMOVED is not set
+CONFIG_FEATURE_KILL_DELAY=0
+# CONFIG_FEATURE_INIT_SCTTY is not set
+# CONFIG_FEATURE_INIT_SYSLOG is not set
+# CONFIG_FEATURE_EXTRA_QUIET is not set
+# CONFIG_FEATURE_INIT_COREDUMPS is not set
+# CONFIG_FEATURE_INITRD is not set
+# CONFIG_HALT is not set
+# CONFIG_FEATURE_CALL_TELINIT is not set
+CONFIG_TELINIT_PATH=""
+# CONFIG_MESG is not set
+# CONFIG_BOOTCHARTD is not set
+
+#
+# Login/Password Management Utilities
+#
+# CONFIG_FEATURE_SHADOWPASSWDS is not set
+# CONFIG_USE_BB_PWD_GRP is not set
+# CONFIG_USE_BB_SHADOW is not set
+# CONFIG_USE_BB_CRYPT is not set
+# CONFIG_USE_BB_CRYPT_SHA is not set
+# CONFIG_ADDGROUP is not set
+# CONFIG_FEATURE_ADDGROUP_LONG_OPTIONS is not set
+# CONFIG_FEATURE_ADDUSER_TO_GROUP is not set
+# CONFIG_DELGROUP is not set
+# CONFIG_FEATURE_DEL_USER_FROM_GROUP is not set
+# CONFIG_FEATURE_CHECK_NAMES is not set
+# CONFIG_ADDUSER is not set
+# CONFIG_FEATURE_ADDUSER_LONG_OPTIONS is not set
+CONFIG_FIRST_SYSTEM_ID=0
+CONFIG_LAST_SYSTEM_ID=0
+# CONFIG_DELUSER is not set
+# CONFIG_GETTY is not set
+# CONFIG_LOGIN is not set
+# CONFIG_PAM is not set
+# CONFIG_LOGIN_SCRIPTS is not set
+# CONFIG_FEATURE_NOLOGIN is not set
+# CONFIG_FEATURE_SECURETTY is not set
+# CONFIG_PASSWD is not set
+# CONFIG_FEATURE_PASSWD_WEAK_CHECK is not set
+# CONFIG_CRYPTPW is not set
+# CONFIG_CHPASSWD is not set
+# CONFIG_SU is not set
+# CONFIG_FEATURE_SU_SYSLOG is not set
+# CONFIG_FEATURE_SU_CHECKS_SHELLS is not set
+# CONFIG_SULOGIN is not set
+# CONFIG_VLOCK is not set
+
+#
+# Linux Ext2 FS Progs
+#
+# CONFIG_CHATTR is not set
+# CONFIG_FSCK is not set
+# CONFIG_LSATTR is not set
+# CONFIG_TUNE2FS is not set
+
+#
+# Linux Module Utilities
+#
+# CONFIG_MODINFO is not set
+# CONFIG_MODPROBE_SMALL is not set
+# CONFIG_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE is not set
+# CONFIG_FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED is not set
+# CONFIG_INSMOD is not set
+# CONFIG_RMMOD is not set
+# CONFIG_LSMOD is not set
+# CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT is not set
+# CONFIG_MODPROBE is not set
+# CONFIG_FEATURE_MODPROBE_BLACKLIST is not set
+# CONFIG_DEPMOD is not set
+
+#
+# Options common to multiple modutils
+#
+# CONFIG_FEATURE_2_4_MODULES is not set
+# CONFIG_FEATURE_INSMOD_TRY_MMAP is not set
+# CONFIG_FEATURE_INSMOD_VERSION_CHECKING is not set
+# CONFIG_FEATURE_INSMOD_KSYMOOPS_SYMBOLS is not set
+# CONFIG_FEATURE_INSMOD_LOADINKMEM is not set
+# CONFIG_FEATURE_INSMOD_LOAD_MAP is not set
+# CONFIG_FEATURE_INSMOD_LOAD_MAP_FULL is not set
+# CONFIG_FEATURE_CHECK_TAINTED_MODULE is not set
+# CONFIG_FEATURE_MODUTILS_ALIAS is not set
+# CONFIG_FEATURE_MODUTILS_SYMBOLS is not set
+CONFIG_DEFAULT_MODULES_DIR=""
+CONFIG_DEFAULT_DEPMOD_FILE=""
+
+#
+# Linux System Utilities
+#
+# CONFIG_ACPID is not set
+# CONFIG_FEATURE_ACPID_COMPAT is not set
+# CONFIG_BLKID is not set
+# CONFIG_DMESG is not set
+# CONFIG_FEATURE_DMESG_PRETTY is not set
+# CONFIG_FBSET is not set
+# CONFIG_FEATURE_FBSET_FANCY is not set
+# CONFIG_FEATURE_FBSET_READMODE is not set
+# CONFIG_FDFLUSH is not set
+# CONFIG_FDFORMAT is not set
+# CONFIG_FDISK is not set
+CONFIG_FDISK_SUPPORT_LARGE_DISKS=y
+# CONFIG_FEATURE_FDISK_WRITABLE is not set
+# CONFIG_FEATURE_AIX_LABEL is not set
+# CONFIG_FEATURE_SGI_LABEL is not set
+# CONFIG_FEATURE_SUN_LABEL is not set
+# CONFIG_FEATURE_OSF_LABEL is not set
+# CONFIG_FEATURE_FDISK_ADVANCED is not set
+# CONFIG_FINDFS is not set
+# CONFIG_FLOCK is not set
+# CONFIG_FREERAMDISK is not set
+# CONFIG_FSCK_MINIX is not set
+# CONFIG_MKFS_EXT2 is not set
+# CONFIG_MKFS_MINIX is not set
+# CONFIG_FEATURE_MINIX2 is not set
+# CONFIG_MKFS_REISER is not set
+# CONFIG_MKFS_VFAT is not set
+# CONFIG_GETOPT is not set
+# CONFIG_FEATURE_GETOPT_LONG is not set
+# CONFIG_HEXDUMP is not set
+# CONFIG_FEATURE_HEXDUMP_REVERSE is not set
+# CONFIG_HD is not set
+# CONFIG_HWCLOCK is not set
+# CONFIG_FEATURE_HWCLOCK_LONG_OPTIONS is not set
+# CONFIG_FEATURE_HWCLOCK_ADJTIME_FHS is not set
+# CONFIG_IPCRM is not set
+# CONFIG_IPCS is not set
+# CONFIG_LOSETUP is not set
+# CONFIG_LSPCI is not set
+# CONFIG_LSUSB is not set
+# CONFIG_MDEV is not set
+# CONFIG_FEATURE_MDEV_CONF is not set
+# CONFIG_FEATURE_MDEV_RENAME is not set
+# CONFIG_FEATURE_MDEV_RENAME_REGEXP is not set
+# CONFIG_FEATURE_MDEV_EXEC is not set
+# CONFIG_FEATURE_MDEV_LOAD_FIRMWARE is not set
+# CONFIG_MKSWAP is not set
+# CONFIG_FEATURE_MKSWAP_UUID is not set
+# CONFIG_MORE is not set
+# CONFIG_FEATURE_USE_TERMIOS is not set
+CONFIG_VOLUMEID=y
+# CONFIG_FEATURE_VOLUMEID_EXT is not set
+# CONFIG_FEATURE_VOLUMEID_BTRFS is not set
+# CONFIG_FEATURE_VOLUMEID_REISERFS is not set
+# CONFIG_FEATURE_VOLUMEID_FAT is not set
+# CONFIG_FEATURE_VOLUMEID_HFS is not set
+# CONFIG_FEATURE_VOLUMEID_JFS is not set
+# CONFIG_FEATURE_VOLUMEID_XFS is not set
+# CONFIG_FEATURE_VOLUMEID_NTFS is not set
+# CONFIG_FEATURE_VOLUMEID_ISO9660 is not set
+# CONFIG_FEATURE_VOLUMEID_UDF is not set
+# CONFIG_FEATURE_VOLUMEID_LUKS is not set
+# CONFIG_FEATURE_VOLUMEID_LINUXSWAP is not set
+# CONFIG_FEATURE_VOLUMEID_CRAMFS is not set
+# CONFIG_FEATURE_VOLUMEID_ROMFS is not set
+# CONFIG_FEATURE_VOLUMEID_SYSV is not set
+# CONFIG_FEATURE_VOLUMEID_OCFS2 is not set
+# CONFIG_FEATURE_VOLUMEID_LINUXRAID is not set
+# CONFIG_MOUNT is not set
+# CONFIG_FEATURE_MOUNT_FAKE is not set
+# CONFIG_FEATURE_MOUNT_VERBOSE is not set
+# CONFIG_FEATURE_MOUNT_HELPERS is not set
+# CONFIG_FEATURE_MOUNT_LABEL is not set
+# CONFIG_FEATURE_MOUNT_NFS is not set
+# CONFIG_FEATURE_MOUNT_CIFS is not set
+# CONFIG_FEATURE_MOUNT_FLAGS is not set
+# CONFIG_FEATURE_MOUNT_FSTAB is not set
+# CONFIG_PIVOT_ROOT is not set
+# CONFIG_RDATE is not set
+# CONFIG_RDEV is not set
+# CONFIG_READPROFILE is not set
+# CONFIG_RTCWAKE is not set
+# CONFIG_SCRIPT is not set
+# CONFIG_SCRIPTREPLAY is not set
+# CONFIG_SETARCH is not set
+# CONFIG_SWAPONOFF is not set
+# CONFIG_FEATURE_SWAPON_PRI is not set
+# CONFIG_SWITCH_ROOT is not set
+# CONFIG_UMOUNT is not set
+# CONFIG_FEATURE_UMOUNT_ALL is not set
+# CONFIG_FEATURE_MOUNT_LOOP is not set
+# CONFIG_FEATURE_MOUNT_LOOP_CREATE is not set
+# CONFIG_FEATURE_MTAB_SUPPORT is not set
+
+#
+# Miscellaneous Utilities
+#
+# CONFIG_ADJTIMEX is not set
+# CONFIG_BBCONFIG is not set
+# CONFIG_BEEP is not set
+CONFIG_FEATURE_BEEP_FREQ=0
+CONFIG_FEATURE_BEEP_LENGTH_MS=0
+# CONFIG_CHAT is not set
+# CONFIG_FEATURE_CHAT_NOFAIL is not set
+# CONFIG_FEATURE_CHAT_TTY_HIFI is not set
+# CONFIG_FEATURE_CHAT_IMPLICIT_CR is not set
+# CONFIG_FEATURE_CHAT_SWALLOW_OPTS is not set
+# CONFIG_FEATURE_CHAT_SEND_ESCAPES is not set
+# CONFIG_FEATURE_CHAT_VAR_ABORT_LEN is not set
+# CONFIG_FEATURE_CHAT_CLR_ABORT is not set
+# CONFIG_CHRT is not set
+# CONFIG_CROND is not set
+# CONFIG_FEATURE_CROND_D is not set
+# CONFIG_FEATURE_CROND_CALL_SENDMAIL is not set
+CONFIG_FEATURE_CROND_DIR=""
+# CONFIG_CRONTAB is not set
+# CONFIG_DC is not set
+# CONFIG_FEATURE_DC_LIBM is not set
+# CONFIG_DEVFSD is not set
+# CONFIG_DEVFSD_MODLOAD is not set
+# CONFIG_DEVFSD_FG_NP is not set
+# CONFIG_DEVFSD_VERBOSE is not set
+# CONFIG_FEATURE_DEVFS is not set
+# CONFIG_DEVMEM is not set
+# CONFIG_EJECT is not set
+# CONFIG_FEATURE_EJECT_SCSI is not set
+# CONFIG_FBSPLASH is not set
+# CONFIG_FLASHCP is not set
+# CONFIG_FLASH_LOCK is not set
+# CONFIG_FLASH_UNLOCK is not set
+# CONFIG_FLASH_ERASEALL is not set
+# CONFIG_IONICE is not set
+# CONFIG_INOTIFYD is not set
+# CONFIG_LAST is not set
+# CONFIG_FEATURE_LAST_SMALL is not set
+# CONFIG_FEATURE_LAST_FANCY is not set
+# CONFIG_LESS is not set
+CONFIG_FEATURE_LESS_MAXLINES=0
+# CONFIG_FEATURE_LESS_BRACKETS is not set
+# CONFIG_FEATURE_LESS_FLAGS is not set
+# CONFIG_FEATURE_LESS_MARKS is not set
+# CONFIG_FEATURE_LESS_REGEXP is not set
+# CONFIG_FEATURE_LESS_WINCH is not set
+# CONFIG_FEATURE_LESS_DASHCMD is not set
+# CONFIG_FEATURE_LESS_LINENUMS is not set
+# CONFIG_HDPARM is not set
+# CONFIG_FEATURE_HDPARM_GET_IDENTITY is not set
+# CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF is not set
+# CONFIG_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF is not set
+# CONFIG_FEATURE_HDPARM_HDIO_DRIVE_RESET is not set
+# CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF is not set
+# CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA is not set
+# CONFIG_MAKEDEVS is not set
+# CONFIG_FEATURE_MAKEDEVS_LEAF is not set
+# CONFIG_FEATURE_MAKEDEVS_TABLE is not set
+# CONFIG_MAN is not set
+# CONFIG_MICROCOM is not set
+# CONFIG_MOUNTPOINT is not set
+# CONFIG_MT is not set
+# CONFIG_RAIDAUTORUN is not set
+# CONFIG_READAHEAD is not set
+# CONFIG_RFKILL is not set
+# CONFIG_RUNLEVEL is not set
+# CONFIG_RX is not set
+# CONFIG_SETSID is not set
+# CONFIG_STRINGS is not set
+# CONFIG_TASKSET is not set
+# CONFIG_FEATURE_TASKSET_FANCY is not set
+# CONFIG_TIME is not set
+# CONFIG_TIMEOUT is not set
+# CONFIG_TTYSIZE is not set
+# CONFIG_VOLNAME is not set
+# CONFIG_WALL is not set
+# CONFIG_WATCHDOG is not set
+
+#
+# Networking Utilities
+#
+# CONFIG_FEATURE_IPV6 is not set
+# CONFIG_FEATURE_UNIX_LOCAL is not set
+# CONFIG_FEATURE_PREFER_IPV4_ADDRESS is not set
+# CONFIG_VERBOSE_RESOLUTION_ERRORS is not set
+# CONFIG_ARP is not set
+# CONFIG_ARPING is not set
+# CONFIG_BRCTL is not set
+# CONFIG_FEATURE_BRCTL_FANCY is not set
+# CONFIG_FEATURE_BRCTL_SHOW is not set
+# CONFIG_DNSD is not set
+# CONFIG_ETHER_WAKE is not set
+# CONFIG_FAKEIDENTD is not set
+# CONFIG_FTPD is not set
+# CONFIG_FEATURE_FTP_WRITE is not set
+# CONFIG_FEATURE_FTPD_ACCEPT_BROKEN_LIST is not set
+# CONFIG_FTPGET is not set
+# CONFIG_FTPPUT is not set
+# CONFIG_FEATURE_FTPGETPUT_LONG_OPTIONS is not set
+# CONFIG_HOSTNAME is not set
+# CONFIG_HTTPD is not set
+# CONFIG_FEATURE_HTTPD_RANGES is not set
+# CONFIG_FEATURE_HTTPD_USE_SENDFILE is not set
+# CONFIG_FEATURE_HTTPD_SETUID is not set
+# CONFIG_FEATURE_HTTPD_BASIC_AUTH is not set
+# CONFIG_FEATURE_HTTPD_AUTH_MD5 is not set
+# CONFIG_FEATURE_HTTPD_CGI is not set
+# CONFIG_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR is not set
+# CONFIG_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV is not set
+# CONFIG_FEATURE_HTTPD_ENCODE_URL_STR is not set
+# CONFIG_FEATURE_HTTPD_ERROR_PAGES is not set
+# CONFIG_FEATURE_HTTPD_PROXY is not set
+# CONFIG_IFCONFIG is not set
+# CONFIG_FEATURE_IFCONFIG_STATUS is not set
+# CONFIG_FEATURE_IFCONFIG_SLIP is not set
+# CONFIG_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ is not set
+# CONFIG_FEATURE_IFCONFIG_HW is not set
+# CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS is not set
+# CONFIG_IFENSLAVE is not set
+# CONFIG_IFPLUGD is not set
+# CONFIG_IFUPDOWN is not set
+CONFIG_IFUPDOWN_IFSTATE_PATH=""
+# CONFIG_FEATURE_IFUPDOWN_IP is not set
+# CONFIG_FEATURE_IFUPDOWN_IP_BUILTIN is not set
+# CONFIG_FEATURE_IFUPDOWN_IFCONFIG_BUILTIN is not set
+# CONFIG_FEATURE_IFUPDOWN_IPV4 is not set
+# CONFIG_FEATURE_IFUPDOWN_IPV6 is not set
+# CONFIG_FEATURE_IFUPDOWN_MAPPING is not set
+# CONFIG_FEATURE_IFUPDOWN_EXTERNAL_DHCP is not set
+# CONFIG_INETD is not set
+# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_ECHO is not set
+# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DISCARD is not set
+# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_TIME is not set
+# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DAYTIME is not set
+# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_CHARGEN is not set
+# CONFIG_FEATURE_INETD_RPC is not set
+# CONFIG_IP is not set
+# CONFIG_FEATURE_IP_ADDRESS is not set
+# CONFIG_FEATURE_IP_LINK is not set
+# CONFIG_FEATURE_IP_ROUTE is not set
+# CONFIG_FEATURE_IP_TUNNEL is not set
+# CONFIG_FEATURE_IP_RULE is not set
+# CONFIG_FEATURE_IP_SHORT_FORMS is not set
+# CONFIG_FEATURE_IP_RARE_PROTOCOLS is not set
+# CONFIG_IPADDR is not set
+# CONFIG_IPLINK is not set
+# CONFIG_IPROUTE is not set
+# CONFIG_IPTUNNEL is not set
+# CONFIG_IPRULE is not set
+# CONFIG_IPCALC is not set
+# CONFIG_FEATURE_IPCALC_FANCY is not set
+# CONFIG_FEATURE_IPCALC_LONG_OPTIONS is not set
+# CONFIG_NAMEIF is not set
+# CONFIG_FEATURE_NAMEIF_EXTENDED is not set
+# CONFIG_NC is not set
+# CONFIG_NC_SERVER is not set
+# CONFIG_NC_EXTRA is not set
+# CONFIG_NETSTAT is not set
+# CONFIG_FEATURE_NETSTAT_WIDE is not set
+# CONFIG_FEATURE_NETSTAT_PRG is not set
+# CONFIG_NSLOOKUP is not set
+# CONFIG_NTPD is not set
+# CONFIG_FEATURE_NTPD_SERVER is not set
+# CONFIG_PING is not set
+# CONFIG_PING6 is not set
+# CONFIG_FEATURE_FANCY_PING is not set
+# CONFIG_PSCAN is not set
+# CONFIG_ROUTE is not set
+# CONFIG_SLATTACH is not set
+# CONFIG_TCPSVD is not set
+# CONFIG_TELNET is not set
+# CONFIG_FEATURE_TELNET_TTYPE is not set
+# CONFIG_FEATURE_TELNET_AUTOLOGIN is not set
+# CONFIG_TELNETD is not set
+# CONFIG_FEATURE_TELNETD_STANDALONE is not set
+# CONFIG_FEATURE_TELNETD_INETD_WAIT is not set
+# CONFIG_TFTP is not set
+# CONFIG_TFTPD is not set
+# CONFIG_FEATURE_TFTP_GET is not set
+# CONFIG_FEATURE_TFTP_PUT is not set
+# CONFIG_FEATURE_TFTP_BLOCKSIZE is not set
+# CONFIG_FEATURE_TFTP_PROGRESS_BAR is not set
+# CONFIG_TFTP_DEBUG is not set
+# CONFIG_TRACEROUTE is not set
+# CONFIG_TRACEROUTE6 is not set
+# CONFIG_FEATURE_TRACEROUTE_VERBOSE is not set
+# CONFIG_FEATURE_TRACEROUTE_SOURCE_ROUTE is not set
+# CONFIG_FEATURE_TRACEROUTE_USE_ICMP is not set
+# CONFIG_TUNCTL is not set
+# CONFIG_FEATURE_TUNCTL_UG is not set
+# CONFIG_UDHCPD is not set
+# CONFIG_DHCPRELAY is not set
+# CONFIG_DUMPLEASES is not set
+# CONFIG_FEATURE_UDHCPD_WRITE_LEASES_EARLY is not set
+CONFIG_DHCPD_LEASES_FILE=""
+# CONFIG_UDHCPC is not set
+# CONFIG_FEATURE_UDHCPC_ARPING is not set
+# CONFIG_FEATURE_UDHCP_PORT is not set
+CONFIG_UDHCP_DEBUG=0
+# CONFIG_FEATURE_UDHCP_RFC3397 is not set
+CONFIG_UDHCPC_DEFAULT_SCRIPT=""
+CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS=0
+CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS=""
+# CONFIG_UDPSVD is not set
+# CONFIG_VCONFIG is not set
+# CONFIG_WGET is not set
+# CONFIG_FEATURE_WGET_STATUSBAR is not set
+# CONFIG_FEATURE_WGET_AUTHENTICATION is not set
+# CONFIG_FEATURE_WGET_LONG_OPTIONS is not set
+# CONFIG_ZCIP is not set
+
+#
+# Print Utilities
+#
+# CONFIG_LPD is not set
+# CONFIG_LPR is not set
+# CONFIG_LPQ is not set
+
+#
+# Mail Utilities
+#
+# CONFIG_MAKEMIME is not set
+CONFIG_FEATURE_MIME_CHARSET=""
+# CONFIG_POPMAILDIR is not set
+# CONFIG_FEATURE_POPMAILDIR_DELIVERY is not set
+# CONFIG_REFORMIME is not set
+# CONFIG_FEATURE_REFORMIME_COMPAT is not set
+# CONFIG_SENDMAIL is not set
+
+#
+# Process Utilities
+#
+# CONFIG_FREE is not set
+# CONFIG_FUSER is not set
+# CONFIG_KILL is not set
+# CONFIG_KILLALL is not set
+# CONFIG_KILLALL5 is not set
+# CONFIG_NMETER is not set
+# CONFIG_PGREP is not set
+# CONFIG_PIDOF is not set
+# CONFIG_FEATURE_PIDOF_SINGLE is not set
+# CONFIG_FEATURE_PIDOF_OMIT is not set
+# CONFIG_PKILL is not set
+# CONFIG_PS is not set
+# CONFIG_FEATURE_PS_WIDE is not set
+# CONFIG_FEATURE_PS_TIME is not set
+# CONFIG_FEATURE_PS_ADDITIONAL_COLUMNS is not set
+# CONFIG_FEATURE_PS_UNUSUAL_SYSTEMS is not set
+# CONFIG_RENICE is not set
+# CONFIG_BB_SYSCTL is not set
+# CONFIG_TOP is not set
+# CONFIG_FEATURE_TOP_CPU_USAGE_PERCENTAGE is not set
+# CONFIG_FEATURE_TOP_CPU_GLOBAL_PERCENTS is not set
+# CONFIG_FEATURE_TOP_SMP_CPU is not set
+# CONFIG_FEATURE_TOP_DECIMALS is not set
+# CONFIG_FEATURE_TOP_SMP_PROCESS is not set
+# CONFIG_FEATURE_TOPMEM is not set
+# CONFIG_FEATURE_SHOW_THREADS is not set
+# CONFIG_UPTIME is not set
+# CONFIG_WATCH is not set
+
+#
+# Runit Utilities
+#
+# CONFIG_RUNSV is not set
+# CONFIG_RUNSVDIR is not set
+# CONFIG_FEATURE_RUNSVDIR_LOG is not set
+# CONFIG_SV is not set
+CONFIG_SV_DEFAULT_SERVICE_DIR=""
+# CONFIG_SVLOGD is not set
+# CONFIG_CHPST is not set
+# CONFIG_SETUIDGID is not set
+# CONFIG_ENVUIDGID is not set
+# CONFIG_ENVDIR is not set
+# CONFIG_SOFTLIMIT is not set
+# CONFIG_CHCON is not set
+# CONFIG_FEATURE_CHCON_LONG_OPTIONS is not set
+# CONFIG_GETENFORCE is not set
+# CONFIG_GETSEBOOL is not set
+# CONFIG_LOAD_POLICY is not set
+# CONFIG_MATCHPATHCON is not set
+# CONFIG_RESTORECON is not set
+# CONFIG_RUNCON is not set
+# CONFIG_FEATURE_RUNCON_LONG_OPTIONS is not set
+# CONFIG_SELINUXENABLED is not set
+# CONFIG_SETENFORCE is not set
+# CONFIG_SETFILES is not set
+# CONFIG_FEATURE_SETFILES_CHECK_OPTION is not set
+# CONFIG_SETSEBOOL is not set
+# CONFIG_SESTATUS is not set
+
+#
+# Shells
+#
+# CONFIG_FEATURE_SH_IS_ASH is not set
+# CONFIG_FEATURE_SH_IS_HUSH is not set
+CONFIG_FEATURE_SH_IS_NONE=y
+# CONFIG_FEATURE_BASH_IS_ASH is not set
+# CONFIG_FEATURE_BASH_IS_HUSH is not set
+CONFIG_FEATURE_BASH_IS_NONE=y
+# CONFIG_ASH is not set
+# CONFIG_ASH_BASH_COMPAT is not set
+# CONFIG_ASH_JOB_CONTROL is not set
+# CONFIG_ASH_ALIAS is not set
+# CONFIG_ASH_GETOPTS is not set
+# CONFIG_ASH_BUILTIN_ECHO is not set
+# CONFIG_ASH_BUILTIN_PRINTF is not set
+# CONFIG_ASH_BUILTIN_TEST is not set
+# CONFIG_ASH_CMDCMD is not set
+# CONFIG_ASH_MAIL is not set
+# CONFIG_ASH_OPTIMIZE_FOR_SIZE is not set
+# CONFIG_ASH_RANDOM_SUPPORT is not set
+# CONFIG_ASH_EXPAND_PRMT is not set
+# CONFIG_HUSH is not set
+# CONFIG_HUSH_BASH_COMPAT is not set
+# CONFIG_HUSH_HELP is not set
+# CONFIG_HUSH_INTERACTIVE is not set
+# CONFIG_HUSH_JOB is not set
+# CONFIG_HUSH_TICK is not set
+# CONFIG_HUSH_IF is not set
+# CONFIG_HUSH_LOOPS is not set
+# CONFIG_HUSH_CASE is not set
+# CONFIG_HUSH_FUNCTIONS is not set
+# CONFIG_HUSH_LOCAL is not set
+# CONFIG_HUSH_EXPORT_N is not set
+# CONFIG_HUSH_RANDOM_SUPPORT is not set
+# CONFIG_LASH is not set
+# CONFIG_MSH is not set
+# CONFIG_SH_MATH_SUPPORT is not set
+# CONFIG_SH_MATH_SUPPORT_64 is not set
+# CONFIG_FEATURE_SH_EXTRA_QUIET is not set
+# CONFIG_FEATURE_SH_STANDALONE is not set
+# CONFIG_FEATURE_SH_NOFORK is not set
+# CONFIG_CTTYHACK is not set
+
+#
+# System Logging Utilities
+#
+# CONFIG_SYSLOGD is not set
+# CONFIG_FEATURE_ROTATE_LOGFILE is not set
+# CONFIG_FEATURE_REMOTE_LOG is not set
+# CONFIG_FEATURE_SYSLOGD_DUP is not set
+CONFIG_FEATURE_SYSLOGD_READ_BUFFER_SIZE=0
+# CONFIG_FEATURE_IPC_SYSLOG is not set
+CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE=0
+# CONFIG_LOGREAD is not set
+# CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING is not set
+# CONFIG_KLOGD is not set
+# CONFIG_LOGGER is not set
diff --git a/archival/gzip.c b/archival/gzip.c
index 5cc553a..620897b 100644
--- a/archival/gzip.c
+++ b/archival/gzip.c
@@ -676,7 +676,7 @@ static void check_match(IPos start, IPos match, int length)
if (verbose > 1) {
bb_error_msg("\\[%d,%d]", start - match, length);
do {
- fputc(G1.window[start++], stderr);
+ bb_putchar_stderr(G1.window[start++]);
} while (--length != 0);
}
}
diff --git a/debianutils/pipe_progress.c b/debianutils/pipe_progress.c
index ced5fb3..6adefac 100644
--- a/debianutils/pipe_progress.c
+++ b/debianutils/pipe_progress.c
@@ -24,12 +24,12 @@ int pipe_progress_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
time_t new_time = time(NULL);
if (new_time != t) {
t = new_time;
- fputc('.', stderr);
+ bb_putchar_stderr('.');
}
full_write(STDOUT_FILENO, buf, len);
}
- fputc('\n', stderr);
+ bb_putchar_stderr('\n');
return 0;
}
diff --git a/findutils/xargs.c b/findutils/xargs.c
index 7db374c..9133b8f 100644
--- a/findutils/xargs.c
+++ b/findutils/xargs.c
@@ -529,11 +529,11 @@ int xargs_main(int argc, char **argv)
if (opt & (OPT_INTERACTIVE | OPT_VERBOSE)) {
for (i = 0; args[i]; i++) {
if (i)
- fputc(' ', stderr);
+ bb_putchar_stderr(' ');
fputs(args[i], stderr);
}
if (!(opt & OPT_INTERACTIVE))
- fputc('\n', stderr);
+ bb_putchar_stderr('\n');
}
if (!(opt & OPT_INTERACTIVE) || xargs_ask_confirmation()) {
child_error = xargs_exec(args);
diff --git a/include/libbb.h b/include/libbb.h
index 326179b..3fffa83 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -592,6 +592,8 @@ char *strncpy_IFNAMSIZ(char *dst, const char *src) FAST_FUNC;
/* Guaranteed to NOT be a macro (smallest code). Saves nearly 2k on uclibc.
* But potentially slow, don't use in one-billion-times loops */
int bb_putchar(int ch) FAST_FUNC;
+/* Note: does not use stdio, writes to fd 2 directly */
+int bb_putchar_stderr(char ch) FAST_FUNC;
char *xasprintf(const char *format, ...) __attribute__ ((format(printf, 1, 2))) FAST_FUNC RETURNS_MALLOC;
// gcc-4.1.1 still isn't good enough at optimizing it
// (+200 bytes compared to macro)
diff --git a/libbb/Kbuild.src b/libbb/Kbuild.src
index 1b11d5d..68d04b3 100644
--- a/libbb/Kbuild.src
+++ b/libbb/Kbuild.src
@@ -81,6 +81,7 @@ lib-y += procps.o
lib-y += progress.o
lib-y += ptr_to_globals.o
lib-y += read.o
+lib-y += read_printf.o
lib-y += read_key.o
lib-y += recursive_action.o
lib-y += remove_file.o
diff --git a/libbb/read.c b/libbb/read.c
index b1eb3f2..1ed7c5f 100644
--- a/libbb/read.c
+++ b/libbb/read.c
@@ -8,16 +8,6 @@
*/
#include "libbb.h"
-#define ZIPPED (ENABLE_FEATURE_SEAMLESS_LZMA \
- || ENABLE_FEATURE_SEAMLESS_BZ2 \
- || ENABLE_FEATURE_SEAMLESS_GZ \
- /* || ENABLE_FEATURE_SEAMLESS_Z */ \
-)
-
-#if ZIPPED
-# include "unarchive.h"
-#endif
-
ssize_t FAST_FUNC safe_read(int fd, void *buf, size_t count)
{
ssize_t n;
@@ -29,58 +19,6 @@ ssize_t FAST_FUNC safe_read(int fd, void *buf, size_t count)
return n;
}
-/* Suppose that you are a shell. You start child processes.
- * They work and eventually exit. You want to get user input.
- * You read stdin. But what happens if last child switched
- * its stdin into O_NONBLOCK mode?
- *
- * *** SURPRISE! It will affect the parent too! ***
- * *** BIG SURPRISE! It stays even after child exits! ***
- *
- * This is a design bug in UNIX API.
- * fcntl(0, F_SETFL, fcntl(0, F_GETFL) | O_NONBLOCK);
- * will set nonblocking mode not only on _your_ stdin, but
- * also on stdin of your parent, etc.
- *
- * In general,
- * fd2 = dup(fd1);
- * fcntl(fd2, F_SETFL, fcntl(fd2, F_GETFL) | O_NONBLOCK);
- * sets both fd1 and fd2 to O_NONBLOCK. This includes cases
- * where duping is done implicitly by fork() etc.
- *
- * We need
- * fcntl(fd2, F_SETFD, fcntl(fd2, F_GETFD) | O_NONBLOCK);
- * (note SETFD, not SETFL!) but such thing doesn't exist.
- *
- * Alternatively, we need nonblocking_read(fd, ...) which doesn't
- * require O_NONBLOCK dance at all. Actually, it exists:
- * n = recv(fd, buf, len, MSG_DONTWAIT);
- * "MSG_DONTWAIT:
- * Enables non-blocking operation; if the operation
- * would block, EAGAIN is returned."
- * but recv() works only for sockets!
- *
- * So far I don't see any good solution, I can only propose
- * that affected readers should be careful and use this routine,
- * which detects EAGAIN and uses poll() to wait on the fd.
- * Thankfully, poll() doesn't care about O_NONBLOCK flag.
- */
-ssize_t FAST_FUNC nonblock_safe_read(int fd, void *buf, size_t count)
-{
- struct pollfd pfd[1];
- ssize_t n;
-
- while (1) {
- n = safe_read(fd, buf, count);
- if (n >= 0 || errno != EAGAIN)
- return n;
- /* fd is in O_NONBLOCK mode. Wait using poll and repeat */
- pfd[0].fd = fd;
- pfd[0].events = POLLIN;
- safe_poll(pfd, 1, -1);
- }
-}
-
/*
* Read all of the supplied buffer from a file.
* This does multiple reads as necessary.
@@ -115,60 +53,6 @@ ssize_t FAST_FUNC full_read(int fd, void *buf, size_t len)
return total;
}
-/* Die with an error message if we can't read the entire buffer. */
-void FAST_FUNC xread(int fd, void *buf, size_t count)
-{
- if (count) {
- ssize_t size = full_read(fd, buf, count);
- if ((size_t)size != count)
- bb_error_msg_and_die("short read");
- }
-}
-
-/* Die with an error message if we can't read one character. */
-unsigned char FAST_FUNC xread_char(int fd)
-{
- char tmp;
- xread(fd, &tmp, 1);
- return tmp;
-}
-
-// Reads one line a-la fgets (but doesn't save terminating '\n').
-// Reads byte-by-byte. Useful when it is important to not read ahead.
-// Bytes are appended to pfx (which must be malloced, or NULL).
-char* FAST_FUNC xmalloc_reads(int fd, char *buf, size_t *maxsz_p)
-{
- char *p;
- size_t sz = buf ? strlen(buf) : 0;
- size_t maxsz = maxsz_p ? *maxsz_p : (INT_MAX - 4095);
-
- goto jump_in;
- while (sz < maxsz) {
- if ((size_t)(p - buf) == sz) {
- jump_in:
- buf = xrealloc(buf, sz + 128);
- p = buf + sz;
- sz += 128;
- }
- /* nonblock_safe_read() because we are used by e.g. shells */
- if (nonblock_safe_read(fd, p, 1) != 1) { /* EOF/error */
- if (p == buf) { /* we read nothing */
- free(buf);
- return NULL;
- }
- break;
- }
- if (*p == '\n')
- break;
- p++;
- }
- *p = '\0';
- if (maxsz_p)
- *maxsz_p = p - buf;
- p++;
- return xrealloc(buf, p - buf);
-}
-
ssize_t FAST_FUNC read_close(int fd, void *buf, size_t size)
{
/*int e;*/
@@ -186,252 +70,3 @@ ssize_t FAST_FUNC open_read_close(const char *filename, void *buf, size_t size)
return fd;
return read_close(fd, buf, size);
}
-
-
-// Read (potentially big) files in one go. File size is estimated
-// by stat. Extra '\0' byte is appended.
-void* FAST_FUNC xmalloc_read(int fd, size_t *maxsz_p)
-{
- char *buf;
- size_t size, rd_size, total;
- size_t to_read;
- struct stat st;
-
- to_read = maxsz_p ? *maxsz_p : (INT_MAX - 4095); /* max to read */
-
- /* Estimate file size */
- st.st_size = 0; /* in case fstat fails, assume 0 */
- fstat(fd, &st);
- /* /proc/N/stat files report st_size 0 */
- /* In order to make such files readable, we add small const */
- size = (st.st_size | 0x3ff) + 1;
-
- total = 0;
- buf = NULL;
- while (1) {
- if (to_read < size)
- size = to_read;
- buf = xrealloc(buf, total + size + 1);
- rd_size = full_read(fd, buf + total, size);
- if ((ssize_t)rd_size == (ssize_t)(-1)) { /* error */
- free(buf);
- return NULL;
- }
- total += rd_size;
- if (rd_size < size) /* EOF */
- break;
- if (to_read <= rd_size)
- break;
- to_read -= rd_size;
- /* grow by 1/8, but in [1k..64k] bounds */
- size = ((total / 8) | 0x3ff) + 1;
- if (size > 64*1024)
- size = 64*1024;
- }
- buf = xrealloc(buf, total + 1);
- buf[total] = '\0';
-
- if (maxsz_p)
- *maxsz_p = total;
- return buf;
-}
-
-#ifdef USING_LSEEK_TO_GET_SIZE
-/* Alternatively, file size can be obtained by lseek to the end.
- * The code is slightly bigger. Retained in case fstat approach
- * will not work for some weird cases (/proc, block devices, etc).
- * (NB: lseek also can fail to work for some weird files) */
-
-// Read (potentially big) files in one go. File size is estimated by
-// lseek to end.
-void* FAST_FUNC xmalloc_open_read_close(const char *filename, size_t *maxsz_p)
-{
- char *buf;
- size_t size;
- int fd;
- off_t len;
-
- fd = open(filename, O_RDONLY);
- if (fd < 0)
- return NULL;
-
- /* /proc/N/stat files report len 0 here */
- /* In order to make such files readable, we add small const */
- size = 0x3ff; /* read only 1k on unseekable files */
- len = lseek(fd, 0, SEEK_END) | 0x3ff; /* + up to 1k */
- if (len != (off_t)-1) {
- xlseek(fd, 0, SEEK_SET);
- size = maxsz_p ? *maxsz_p : (INT_MAX - 4095);
- if (len < size)
- size = len;
- }
-
- buf = xmalloc(size + 1);
- size = read_close(fd, buf, size);
- if ((ssize_t)size < 0) {
- free(buf);
- return NULL;
- }
- buf = xrealloc(buf, size + 1);
- buf[size] = '\0';
-
- if (maxsz_p)
- *maxsz_p = size;
- return buf;
-}
-#endif
-
-// Read (potentially big) files in one go. File size is estimated
-// by stat.
-void* FAST_FUNC xmalloc_open_read_close(const char *filename, size_t *maxsz_p)
-{
- char *buf;
- int fd;
-
- fd = open(filename, O_RDONLY);
- if (fd < 0)
- return NULL;
-
- buf = xmalloc_read(fd, maxsz_p);
- close(fd);
- return buf;
-}
-
-void* FAST_FUNC xmalloc_xopen_read_close(const char *filename, size_t *maxsz_p)
-{
- void *buf = xmalloc_open_read_close(filename, maxsz_p);
- if (!buf)
- bb_perror_msg_and_die("can't read '%s'", filename);
- return buf;
-}
-
-/* Used by e.g. rpm which gives us a fd without filename,
- * thus we can't guess the format from filename's extension.
- */
-#if ZIPPED
-void FAST_FUNC setup_unzip_on_fd(int fd /*, int fail_if_not_detected*/)
-{
- const int fail_if_not_detected = 1;
- union {
- uint8_t b[4];
- uint16_t b16[2];
- uint32_t b32[1];
- } magic;
- int offset = -2;
-# if BB_MMU
- IF_DESKTOP(long long) int FAST_FUNC (*xformer)(int src_fd, int dst_fd);
- enum { xformer_prog = 0 };
-# else
- enum { xformer = 0 };
- const char *xformer_prog;
-# endif
-
- /* .gz and .bz2 both have 2-byte signature, and their
- * unpack_XXX_stream wants this header skipped. */
- xread(fd, magic.b16, sizeof(magic.b16));
- if (ENABLE_FEATURE_SEAMLESS_GZ
- && magic.b16[0] == GZIP_MAGIC
- ) {
-# if BB_MMU
- xformer = unpack_gz_stream;
-# else
- xformer_prog = "gunzip";
-# endif
- goto found_magic;
- }
- if (ENABLE_FEATURE_SEAMLESS_BZ2
- && magic.b16[0] == BZIP2_MAGIC
- ) {
-# if BB_MMU
- xformer = unpack_bz2_stream;
-# else
- xformer_prog = "bunzip2";
-# endif
- goto found_magic;
- }
- if (ENABLE_FEATURE_SEAMLESS_XZ
- && magic.b16[0] == XZ_MAGIC1
- ) {
- /* .xz signature: 0xfd, '7', 'z', 'X', 'Z', 0x00 */
- /* More info at: http://tukaani.org/xz/xz-file-format.txt */
- offset = -6;
- xread(fd, magic.b32, sizeof(magic.b32));
- if (magic.b32[0] == XZ_MAGIC2) {
-# if BB_MMU
- xformer = unpack_xz_stream;
- /* unpack_xz_stream wants fd at position 0 */
- xlseek(fd, offset, SEEK_CUR);
-# else
- xformer_prog = "unxz";
-# endif
- goto found_magic;
- }
- }
-
- /* No known magic seen */
- if (fail_if_not_detected)
- bb_error_msg_and_die("no gzip"
- IF_FEATURE_SEAMLESS_BZ2("/bzip2")
- IF_FEATURE_SEAMLESS_XZ("/xz")
- " magic");
- xlseek(fd, offset, SEEK_CUR);
- return;
-
- found_magic:
-# if !BB_MMU
- /* NOMMU version of open_transformer execs
- * an external unzipper that wants
- * file position at the start of the file */
- xlseek(fd, offset, SEEK_CUR);
-# endif
- open_transformer(fd, xformer, xformer_prog);
-}
-#endif /* ZIPPED */
-
-int FAST_FUNC open_zipped(const char *fname)
-{
-#if !ZIPPED
- return open(fname, O_RDONLY);
-#else
- char *sfx;
- int fd;
-
- fd = open(fname, O_RDONLY);
- if (fd < 0)
- return fd;
-
- sfx = strrchr(fname, '.');
- if (sfx) {
- sfx++;
- if (ENABLE_FEATURE_SEAMLESS_LZMA && strcmp(sfx, "lzma") == 0)
- /* .lzma has no header/signature, just trust it */
- open_transformer(fd, unpack_lzma_stream, "unlzma");
- else
- if ((ENABLE_FEATURE_SEAMLESS_GZ && strcmp(sfx, "gz") == 0)
- || (ENABLE_FEATURE_SEAMLESS_BZ2 && strcmp(sfx, "bz2") == 0)
- || (ENABLE_FEATURE_SEAMLESS_XZ && strcmp(sfx, "xz") == 0)
- ) {
- setup_unzip_on_fd(fd /*, fail_if_not_detected: 1*/);
- }
- }
-
- return fd;
-#endif
-}
-
-void* FAST_FUNC xmalloc_open_zipped_read_close(const char *fname, size_t *maxsz_p)
-{
- int fd;
- char *image;
-
- fd = open_zipped(fname);
- if (fd < 0)
- return NULL;
-
- image = xmalloc_read(fd, maxsz_p);
- if (!image)
- bb_perror_msg("read error from '%s'", fname);
- close(fd);
-
- return image;
-}
diff --git a/libbb/read_printf.c b/libbb/read_printf.c
new file mode 100644
index 0000000..53f528f
--- /dev/null
+++ b/libbb/read_printf.c
@@ -0,0 +1,374 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * Utility routines.
+ *
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
+ *
+ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
+ */
+#include "libbb.h"
+
+#define ZIPPED (ENABLE_FEATURE_SEAMLESS_LZMA \
+ || ENABLE_FEATURE_SEAMLESS_BZ2 \
+ || ENABLE_FEATURE_SEAMLESS_GZ \
+ /* || ENABLE_FEATURE_SEAMLESS_Z */ \
+)
+
+#if ZIPPED
+# include "unarchive.h"
+#endif
+
+
+/* Suppose that you are a shell. You start child processes.
+ * They work and eventually exit. You want to get user input.
+ * You read stdin. But what happens if last child switched
+ * its stdin into O_NONBLOCK mode?
+ *
+ * *** SURPRISE! It will affect the parent too! ***
+ * *** BIG SURPRISE! It stays even after child exits! ***
+ *
+ * This is a design bug in UNIX API.
+ * fcntl(0, F_SETFL, fcntl(0, F_GETFL) | O_NONBLOCK);
+ * will set nonblocking mode not only on _your_ stdin, but
+ * also on stdin of your parent, etc.
+ *
+ * In general,
+ * fd2 = dup(fd1);
+ * fcntl(fd2, F_SETFL, fcntl(fd2, F_GETFL) | O_NONBLOCK);
+ * sets both fd1 and fd2 to O_NONBLOCK. This includes cases
+ * where duping is done implicitly by fork() etc.
+ *
+ * We need
+ * fcntl(fd2, F_SETFD, fcntl(fd2, F_GETFD) | O_NONBLOCK);
+ * (note SETFD, not SETFL!) but such thing doesn't exist.
+ *
+ * Alternatively, we need nonblocking_read(fd, ...) which doesn't
+ * require O_NONBLOCK dance at all. Actually, it exists:
+ * n = recv(fd, buf, len, MSG_DONTWAIT);
+ * "MSG_DONTWAIT:
+ * Enables non-blocking operation; if the operation
+ * would block, EAGAIN is returned."
+ * but recv() works only for sockets!
+ *
+ * So far I don't see any good solution, I can only propose
+ * that affected readers should be careful and use this routine,
+ * which detects EAGAIN and uses poll() to wait on the fd.
+ * Thankfully, poll() doesn't care about O_NONBLOCK flag.
+ */
+ssize_t FAST_FUNC nonblock_safe_read(int fd, void *buf, size_t count)
+{
+ struct pollfd pfd[1];
+ ssize_t n;
+
+ while (1) {
+ n = safe_read(fd, buf, count);
+ if (n >= 0 || errno != EAGAIN)
+ return n;
+ /* fd is in O_NONBLOCK mode. Wait using poll and repeat */
+ pfd[0].fd = fd;
+ pfd[0].events = POLLIN;
+ safe_poll(pfd, 1, -1); /* note: this pulls in printf */
+ }
+}
+
+// Reads one line a-la fgets (but doesn't save terminating '\n').
+// Reads byte-by-byte. Useful when it is important to not read ahead.
+// Bytes are appended to pfx (which must be malloced, or NULL).
+char* FAST_FUNC xmalloc_reads(int fd, char *buf, size_t *maxsz_p)
+{
+ char *p;
+ size_t sz = buf ? strlen(buf) : 0;
+ size_t maxsz = maxsz_p ? *maxsz_p : (INT_MAX - 4095);
+
+ goto jump_in;
+ while (sz < maxsz) {
+ if ((size_t)(p - buf) == sz) {
+ jump_in:
+ buf = xrealloc(buf, sz + 128);
+ p = buf + sz;
+ sz += 128;
+ }
+ /* nonblock_safe_read() because we are used by e.g. shells */
+ if (nonblock_safe_read(fd, p, 1) != 1) { /* EOF/error */
+ if (p == buf) { /* we read nothing */
+ free(buf);
+ return NULL;
+ }
+ break;
+ }
+ if (*p == '\n')
+ break;
+ p++;
+ }
+ *p = '\0';
+ if (maxsz_p)
+ *maxsz_p = p - buf;
+ p++;
+ return xrealloc(buf, p - buf);
+}
+
+// Read (potentially big) files in one go. File size is estimated
+// by stat. Extra '\0' byte is appended.
+void* FAST_FUNC xmalloc_read(int fd, size_t *maxsz_p)
+{
+ char *buf;
+ size_t size, rd_size, total;
+ size_t to_read;
+ struct stat st;
+
+ to_read = maxsz_p ? *maxsz_p : (INT_MAX - 4095); /* max to read */
+
+ /* Estimate file size */
+ st.st_size = 0; /* in case fstat fails, assume 0 */
+ fstat(fd, &st);
+ /* /proc/N/stat files report st_size 0 */
+ /* In order to make such files readable, we add small const */
+ size = (st.st_size | 0x3ff) + 1;
+
+ total = 0;
+ buf = NULL;
+ while (1) {
+ if (to_read < size)
+ size = to_read;
+ buf = xrealloc(buf, total + size + 1);
+ rd_size = full_read(fd, buf + total, size);
+ if ((ssize_t)rd_size == (ssize_t)(-1)) { /* error */
+ free(buf);
+ return NULL;
+ }
+ total += rd_size;
+ if (rd_size < size) /* EOF */
+ break;
+ if (to_read <= rd_size)
+ break;
+ to_read -= rd_size;
+ /* grow by 1/8, but in [1k..64k] bounds */
+ size = ((total / 8) | 0x3ff) + 1;
+ if (size > 64*1024)
+ size = 64*1024;
+ }
+ buf = xrealloc(buf, total + 1);
+ buf[total] = '\0';
+
+ if (maxsz_p)
+ *maxsz_p = total;
+ return buf;
+}
+
+#ifdef USING_LSEEK_TO_GET_SIZE
+/* Alternatively, file size can be obtained by lseek to the end.
+ * The code is slightly bigger. Retained in case fstat approach
+ * will not work for some weird cases (/proc, block devices, etc).
+ * (NB: lseek also can fail to work for some weird files) */
+
+// Read (potentially big) files in one go. File size is estimated by
+// lseek to end.
+void* FAST_FUNC xmalloc_open_read_close(const char *filename, size_t *maxsz_p)
+{
+ char *buf;
+ size_t size;
+ int fd;
+ off_t len;
+
+ fd = open(filename, O_RDONLY);
+ if (fd < 0)
+ return NULL;
+
+ /* /proc/N/stat files report len 0 here */
+ /* In order to make such files readable, we add small const */
+ size = 0x3ff; /* read only 1k on unseekable files */
+ len = lseek(fd, 0, SEEK_END) | 0x3ff; /* + up to 1k */
+ if (len != (off_t)-1) {
+ xlseek(fd, 0, SEEK_SET);
+ size = maxsz_p ? *maxsz_p : (INT_MAX - 4095);
+ if (len < size)
+ size = len;
+ }
+
+ buf = xmalloc(size + 1);
+ size = read_close(fd, buf, size);
+ if ((ssize_t)size < 0) {
+ free(buf);
+ return NULL;
+ }
+ buf = xrealloc(buf, size + 1);
+ buf[size] = '\0';
+
+ if (maxsz_p)
+ *maxsz_p = size;
+ return buf;
+}
+#endif
+
+// Read (potentially big) files in one go. File size is estimated
+// by stat.
+void* FAST_FUNC xmalloc_open_read_close(const char *filename, size_t *maxsz_p)
+{
+ char *buf;
+ int fd;
+
+ fd = open(filename, O_RDONLY);
+ if (fd < 0)
+ return NULL;
+
+ buf = xmalloc_read(fd, maxsz_p);
+ close(fd);
+ return buf;
+}
+
+/* Die with an error message if we can't read the entire buffer. */
+void FAST_FUNC xread(int fd, void *buf, size_t count)
+{
+ if (count) {
+ ssize_t size = full_read(fd, buf, count);
+ if ((size_t)size != count)
+ bb_error_msg_and_die("short read");
+ }
+}
+
+/* Die with an error message if we can't read one character. */
+unsigned char FAST_FUNC xread_char(int fd)
+{
+ char tmp;
+ xread(fd, &tmp, 1);
+ return tmp;
+}
+
+void* FAST_FUNC xmalloc_xopen_read_close(const char *filename, size_t *maxsz_p)
+{
+ void *buf = xmalloc_open_read_close(filename, maxsz_p);
+ if (!buf)
+ bb_perror_msg_and_die("can't read '%s'", filename);
+ return buf;
+}
+
+/* Used by e.g. rpm which gives us a fd without filename,
+ * thus we can't guess the format from filename's extension.
+ */
+#if ZIPPED
+void FAST_FUNC setup_unzip_on_fd(int fd /*, int fail_if_not_detected*/)
+{
+ const int fail_if_not_detected = 1;
+ union {
+ uint8_t b[4];
+ uint16_t b16[2];
+ uint32_t b32[1];
+ } magic;
+ int offset = -2;
+# if BB_MMU
+ IF_DESKTOP(long long) int FAST_FUNC (*xformer)(int src_fd, int dst_fd);
+ enum { xformer_prog = 0 };
+# else
+ enum { xformer = 0 };
+ const char *xformer_prog;
+# endif
+
+ /* .gz and .bz2 both have 2-byte signature, and their
+ * unpack_XXX_stream wants this header skipped. */
+ xread(fd, magic.b16, sizeof(magic.b16));
+ if (ENABLE_FEATURE_SEAMLESS_GZ
+ && magic.b16[0] == GZIP_MAGIC
+ ) {
+# if BB_MMU
+ xformer = unpack_gz_stream;
+# else
+ xformer_prog = "gunzip";
+# endif
+ goto found_magic;
+ }
+ if (ENABLE_FEATURE_SEAMLESS_BZ2
+ && magic.b16[0] == BZIP2_MAGIC
+ ) {
+# if BB_MMU
+ xformer = unpack_bz2_stream;
+# else
+ xformer_prog = "bunzip2";
+# endif
+ goto found_magic;
+ }
+ if (ENABLE_FEATURE_SEAMLESS_XZ
+ && magic.b16[0] == XZ_MAGIC1
+ ) {
+ /* .xz signature: 0xfd, '7', 'z', 'X', 'Z', 0x00 */
+ /* More info at: http://tukaani.org/xz/xz-file-format.txt */
+ offset = -6;
+ xread(fd, magic.b32, sizeof(magic.b32));
+ if (magic.b32[0] == XZ_MAGIC2) {
+# if BB_MMU
+ xformer = unpack_xz_stream;
+ /* unpack_xz_stream wants fd at position 0 */
+ xlseek(fd, offset, SEEK_CUR);
+# else
+ xformer_prog = "unxz";
+# endif
+ goto found_magic;
+ }
+ }
+
+ /* No known magic seen */
+ if (fail_if_not_detected)
+ bb_error_msg_and_die("no gzip"
+ IF_FEATURE_SEAMLESS_BZ2("/bzip2")
+ IF_FEATURE_SEAMLESS_XZ("/xz")
+ " magic");
+ xlseek(fd, offset, SEEK_CUR);
+ return;
+
+ found_magic:
+# if !BB_MMU
+ /* NOMMU version of open_transformer execs
+ * an external unzipper that wants
+ * file position at the start of the file */
+ xlseek(fd, offset, SEEK_CUR);
+# endif
+ open_transformer(fd, xformer, xformer_prog);
+}
+#endif /* ZIPPED */
+
+int FAST_FUNC open_zipped(const char *fname)
+{
+#if !ZIPPED
+ return open(fname, O_RDONLY);
+#else
+ char *sfx;
+ int fd;
+
+ fd = open(fname, O_RDONLY);
+ if (fd < 0)
+ return fd;
+
+ sfx = strrchr(fname, '.');
+ if (sfx) {
+ sfx++;
+ if (ENABLE_FEATURE_SEAMLESS_LZMA && strcmp(sfx, "lzma") == 0)
+ /* .lzma has no header/signature, just trust it */
+ open_transformer(fd, unpack_lzma_stream, "unlzma");
+ else
+ if ((ENABLE_FEATURE_SEAMLESS_GZ && strcmp(sfx, "gz") == 0)
+ || (ENABLE_FEATURE_SEAMLESS_BZ2 && strcmp(sfx, "bz2") == 0)
+ || (ENABLE_FEATURE_SEAMLESS_XZ && strcmp(sfx, "xz") == 0)
+ ) {
+ setup_unzip_on_fd(fd /*, fail_if_not_detected: 1*/);
+ }
+ }
+
+ return fd;
+#endif
+}
+
+void* FAST_FUNC xmalloc_open_zipped_read_close(const char *fname, size_t *maxsz_p)
+{
+ int fd;
+ char *image;
+
+ fd = open_zipped(fname);
+ if (fd < 0)
+ return NULL;
+
+ image = xmalloc_read(fd, maxsz_p);
+ if (!image)
+ bb_perror_msg("read error from '%s'", fname);
+ close(fd);
+
+ return image;
+}
diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c
index d93dd2a..6200fc6 100644
--- a/libbb/xfuncs.c
+++ b/libbb/xfuncs.c
@@ -199,15 +199,9 @@ off_t FAST_FUNC fdlength(int fd)
}
#endif
-char* FAST_FUNC xmalloc_ttyname(int fd)
+int FAST_FUNC bb_putchar_stderr(char ch)
{
- char *buf = xzalloc(128);
- int r = ttyname_r(fd, buf, 127);
- if (r) {
- free(buf);
- buf = NULL;
- }
- return buf;
+ return write(STDERR_FILENO, &ch, 1);
}
static int wh_helper(int value, int def_val, const char *env_name, int *err)
@@ -250,66 +244,3 @@ int FAST_FUNC tcsetattr_stdin_TCSANOW(const struct termios *tp)
{
return tcsetattr(STDIN_FILENO, TCSANOW, tp);
}
-
-void FAST_FUNC generate_uuid(uint8_t *buf)
-{
- /* http://www.ietf.org/rfc/rfc4122.txt
- * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | time_low |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | time_mid | time_hi_and_version |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * |clk_seq_and_variant | node (0-1) |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | node (2-5) |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * IOW, uuid has this layout:
- * uint32_t time_low (big endian)
- * uint16_t time_mid (big endian)
- * uint16_t time_hi_and_version (big endian)
- * version is a 4-bit field:
- * 1 Time-based
- * 2 DCE Security, with embedded POSIX UIDs
- * 3 Name-based (MD5)
- * 4 Randomly generated
- * 5 Name-based (SHA-1)
- * uint16_t clk_seq_and_variant (big endian)
- * variant is a 3-bit field:
- * 0xx Reserved, NCS backward compatibility
- * 10x The variant specified in rfc4122
- * 110 Reserved, Microsoft backward compatibility
- * 111 Reserved for future definition
- * uint8_t node[6]
- *
- * For version 4, these bits are set/cleared:
- * time_hi_and_version & 0x0fff | 0x4000
- * clk_seq_and_variant & 0x3fff | 0x8000
- */
- pid_t pid;
- int i;
-
- i = open("/dev/urandom", O_RDONLY);
- if (i >= 0) {
- read(i, buf, 16);
- close(i);
- }
- /* Paranoia. /dev/urandom may be missing.
- * rand() is guaranteed to generate at least [0, 2^15) range,
- * but lowest bits in some libc are not so "random". */
- srand(monotonic_us());
- pid = getpid();
- while (1) {
- for (i = 0; i < 16; i++)
- buf[i] ^= rand() >> 5;
- if (pid == 0)
- break;
- srand(pid);
- pid = 0;
- }
-
- /* version = 4 */
- buf[4 + 2 ] = (buf[4 + 2 ] & 0x0f) | 0x40;
- /* variant = 10x */
- buf[4 + 2 + 2] = (buf[4 + 2 + 2] & 0x3f) | 0x80;
-}
diff --git a/libbb/xfuncs_printf.c b/libbb/xfuncs_printf.c
index 7207ec5..03aeaaa 100644
--- a/libbb/xfuncs_printf.c
+++ b/libbb/xfuncs_printf.c
@@ -510,3 +510,77 @@ int FAST_FUNC bb_xioctl(int fd, unsigned request, void *argp)
return ret;
}
#endif
+
+char* FAST_FUNC xmalloc_ttyname(int fd)
+{
+ char *buf = xzalloc(128);
+ int r = ttyname_r(fd, buf, 127);
+ if (r) {
+ free(buf);
+ buf = NULL;
+ }
+ return buf;
+}
+
+void FAST_FUNC generate_uuid(uint8_t *buf)
+{
+ /* http://www.ietf.org/rfc/rfc4122.txt
+ * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | time_low |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | time_mid | time_hi_and_version |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * |clk_seq_and_variant | node (0-1) |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | node (2-5) |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * IOW, uuid has this layout:
+ * uint32_t time_low (big endian)
+ * uint16_t time_mid (big endian)
+ * uint16_t time_hi_and_version (big endian)
+ * version is a 4-bit field:
+ * 1 Time-based
+ * 2 DCE Security, with embedded POSIX UIDs
+ * 3 Name-based (MD5)
+ * 4 Randomly generated
+ * 5 Name-based (SHA-1)
+ * uint16_t clk_seq_and_variant (big endian)
+ * variant is a 3-bit field:
+ * 0xx Reserved, NCS backward compatibility
+ * 10x The variant specified in rfc4122
+ * 110 Reserved, Microsoft backward compatibility
+ * 111 Reserved for future definition
+ * uint8_t node[6]
+ *
+ * For version 4, these bits are set/cleared:
+ * time_hi_and_version & 0x0fff | 0x4000
+ * clk_seq_and_variant & 0x3fff | 0x8000
+ */
+ pid_t pid;
+ int i;
+
+ i = open("/dev/urandom", O_RDONLY);
+ if (i >= 0) {
+ read(i, buf, 16);
+ close(i);
+ }
+ /* Paranoia. /dev/urandom may be missing.
+ * rand() is guaranteed to generate at least [0, 2^15) range,
+ * but lowest bits in some libc are not so "random". */
+ srand(monotonic_us()); /* pulls in printf */
+ pid = getpid();
+ while (1) {
+ for (i = 0; i < 16; i++)
+ buf[i] ^= rand() >> 5;
+ if (pid == 0)
+ break;
+ srand(pid);
+ pid = 0;
+ }
+
+ /* version = 4 */
+ buf[4 + 2 ] = (buf[4 + 2 ] & 0x0f) | 0x40;
+ /* variant = 10x */
+ buf[4 + 2 + 2] = (buf[4 + 2 + 2] & 0x3f) | 0x80;
+}
diff --git a/miscutils/crond.c b/miscutils/crond.c
index e3714df..f511592 100644
--- a/miscutils/crond.c
+++ b/miscutils/crond.c
@@ -420,7 +420,7 @@ static void ParseField(char *user, char *ary, int modvalue, int off,
int i;
for (i = 0; i < modvalue; ++i)
fprintf(stderr, "%d", (unsigned char)ary[i]);
- fputc('\n', stderr);
+ bb_putchar_stderr('\n');
}
}
diff --git a/networking/tftp.c b/networking/tftp.c
index d76f7ae..ab4e259 100644
--- a/networking/tftp.c
+++ b/networking/tftp.c
@@ -119,7 +119,7 @@ static void progress_meter(int flag)
if (flag == 0) {
/* last call to progress_meter */
alarm(0);
- fputc('\n', stderr);
+ bb_putchar_stderr('\n');
} else {
if (flag == -1) { /* first call to progress_meter */
signal_SA_RESTART_empty_mask(SIGALRM, progress_meter);
diff --git a/networking/wget.c b/networking/wget.c
index 97f4a8f..f55b68a 100644
--- a/networking/wget.c
+++ b/networking/wget.c
@@ -55,7 +55,7 @@ static void progress_meter(int flag)
if (flag == 0) {
/* last call to progress_meter */
alarm(0);
- fputc('\n', stderr);
+ bb_putchar_stderr('\n');
G.transferred = 0;
} else {
if (flag == -1) { /* first call to progress_meter */