aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-06-06 21:53:09 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2010-06-06 21:53:09 +0200
commit19ced5c4253bc154aa499a72b6343e01245c92c0 (patch)
treec1c148612896e748749ce882ed25ad5ffd74418c
parent5f3303712ef483d270097cae4ba0a559b1056121 (diff)
downloadbusybox-w32-19ced5c4253bc154aa499a72b6343e01245c92c0.tar.gz
busybox-w32-19ced5c4253bc154aa499a72b6343e01245c92c0.tar.bz2
busybox-w32-19ced5c4253bc154aa499a72b6343e01245c92c0.zip
pipe_progress: make it independent of printf machinery
function old new delta bb_putchar_stderr - 24 +24 ParseField 494 471 -23 progress_meter 212 188 -24 xargs_main 888 842 -46 pipe_progress_main 151 105 -46 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 0/4 up/down: 24/-139) Total: -115 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-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 000000000..f787e7a14
--- /dev/null
+++ b/TEST_config_noprintf
@@ -0,0 +1,929 @@
1#
2# Automatically generated make config: don't edit
3# Busybox version: 1.17.0.git
4# Sun Jun 6 21:38:58 2010
5#
6CONFIG_HAVE_DOT_CONFIG=y
7
8#
9# Busybox Settings
10#
11
12#
13# General Configuration
14#
15CONFIG_DESKTOP=y
16CONFIG_EXTRA_COMPAT=y
17CONFIG_INCLUDE_SUSv2=y
18# CONFIG_USE_PORTABLE_CODE is not set
19CONFIG_FEATURE_BUFFERS_USE_MALLOC=y
20# CONFIG_FEATURE_BUFFERS_GO_ON_STACK is not set
21# CONFIG_FEATURE_BUFFERS_GO_IN_BSS is not set
22CONFIG_SHOW_USAGE=y
23CONFIG_FEATURE_VERBOSE_USAGE=y
24# CONFIG_FEATURE_COMPRESS_USAGE is not set
25# CONFIG_FEATURE_INSTALLER is not set
26# CONFIG_LOCALE_SUPPORT is not set
27CONFIG_UNICODE_SUPPORT=y
28# CONFIG_UNICODE_USING_LOCALE is not set
29CONFIG_FEATURE_CHECK_UNICODE_IN_ENV=y
30CONFIG_SUBST_WCHAR=63
31CONFIG_LAST_SUPPORTED_WCHAR=65535
32CONFIG_UNICODE_COMBINING_WCHARS=y
33CONFIG_UNICODE_WIDE_WCHARS=y
34CONFIG_UNICODE_BIDI_SUPPORT=y
35# CONFIG_UNICODE_NEUTRAL_TABLE is not set
36CONFIG_UNICODE_PRESERVE_BROKEN=y
37CONFIG_LONG_OPTS=y
38CONFIG_FEATURE_DEVPTS=y
39# CONFIG_FEATURE_CLEAN_UP is not set
40CONFIG_FEATURE_UTMP=y
41CONFIG_FEATURE_WTMP=y
42CONFIG_FEATURE_PIDFILE=y
43# CONFIG_FEATURE_SUID is not set
44# CONFIG_FEATURE_SUID_CONFIG is not set
45# CONFIG_FEATURE_SUID_CONFIG_QUIET is not set
46# CONFIG_SELINUX is not set
47# CONFIG_FEATURE_PREFER_APPLETS is not set
48CONFIG_BUSYBOX_EXEC_PATH="/proc/self/exe"
49# CONFIG_FEATURE_SYSLOG is not set
50# CONFIG_FEATURE_HAVE_RPC is not set
51
52#
53# Build Options
54#
55CONFIG_STATIC=y
56# CONFIG_PIE is not set
57# CONFIG_NOMMU is not set
58# CONFIG_BUILD_LIBBUSYBOX is not set
59# CONFIG_FEATURE_INDIVIDUAL is not set
60# CONFIG_FEATURE_SHARED_BUSYBOX is not set
61CONFIG_LFS=y
62CONFIG_CROSS_COMPILER_PREFIX="i486-linux-uclibc-"
63CONFIG_EXTRA_CFLAGS=""
64
65#
66# Debugging Options
67#
68# CONFIG_DEBUG is not set
69# CONFIG_DEBUG_PESSIMIZE is not set
70CONFIG_WERROR=y
71CONFIG_NO_DEBUG_LIB=y
72# CONFIG_DMALLOC is not set
73# CONFIG_EFENCE is not set
74
75#
76# Installation Options
77#
78# CONFIG_INSTALL_NO_USR is not set
79CONFIG_INSTALL_APPLET_SYMLINKS=y
80# CONFIG_INSTALL_APPLET_HARDLINKS is not set
81# CONFIG_INSTALL_APPLET_SCRIPT_WRAPPERS is not set
82# CONFIG_INSTALL_APPLET_DONT is not set
83# CONFIG_INSTALL_SH_APPLET_SYMLINK is not set
84# CONFIG_INSTALL_SH_APPLET_HARDLINK is not set
85# CONFIG_INSTALL_SH_APPLET_SCRIPT_WRAPPER is not set
86CONFIG_PREFIX="./_install"
87
88#
89# Busybox Library Tuning
90#
91CONFIG_PASSWORD_MINLEN=6
92CONFIG_MD5_SIZE_VS_SPEED=2
93CONFIG_FEATURE_FAST_TOP=y
94# CONFIG_FEATURE_ETC_NETWORKS is not set
95CONFIG_FEATURE_EDITING=y
96CONFIG_FEATURE_EDITING_MAX_LEN=1024
97CONFIG_FEATURE_EDITING_VI=y
98CONFIG_FEATURE_EDITING_HISTORY=15
99# CONFIG_FEATURE_EDITING_SAVEHISTORY is not set
100CONFIG_FEATURE_TAB_COMPLETION=y
101CONFIG_FEATURE_USERNAME_COMPLETION=y
102CONFIG_FEATURE_EDITING_FANCY_PROMPT=y
103CONFIG_FEATURE_EDITING_ASK_TERMINAL=y
104CONFIG_FEATURE_NON_POSIX_CP=y
105# CONFIG_FEATURE_VERBOSE_CP_MESSAGE is not set
106CONFIG_FEATURE_COPYBUF_KB=64
107CONFIG_MONOTONIC_SYSCALL=y
108# CONFIG_IOCTL_HEX2STR_ERROR is not set
109CONFIG_FEATURE_HWIB=y
110
111#
112# Applets
113#
114
115#
116# Archival Utilities
117#
118CONFIG_FEATURE_SEAMLESS_XZ=y
119CONFIG_FEATURE_SEAMLESS_LZMA=y
120CONFIG_FEATURE_SEAMLESS_BZ2=y
121CONFIG_FEATURE_SEAMLESS_GZ=y
122CONFIG_FEATURE_SEAMLESS_Z=y
123# CONFIG_AR is not set
124# CONFIG_FEATURE_AR_LONG_FILENAMES is not set
125# CONFIG_FEATURE_AR_CREATE is not set
126# CONFIG_BUNZIP2 is not set
127# CONFIG_BZIP2 is not set
128# CONFIG_CPIO is not set
129# CONFIG_FEATURE_CPIO_O is not set
130# CONFIG_FEATURE_CPIO_P is not set
131# CONFIG_DPKG is not set
132# CONFIG_DPKG_DEB is not set
133# CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY is not set
134# CONFIG_GUNZIP is not set
135# CONFIG_GZIP is not set
136# CONFIG_FEATURE_GZIP_LONG_OPTIONS is not set
137# CONFIG_LZOP is not set
138# CONFIG_LZOP_COMPR_HIGH is not set
139# CONFIG_RPM2CPIO is not set
140# CONFIG_RPM is not set
141# CONFIG_TAR is not set
142# CONFIG_FEATURE_TAR_CREATE is not set
143# CONFIG_FEATURE_TAR_AUTODETECT is not set
144# CONFIG_FEATURE_TAR_FROM is not set
145# CONFIG_FEATURE_TAR_OLDGNU_COMPATIBILITY is not set
146# CONFIG_FEATURE_TAR_OLDSUN_COMPATIBILITY is not set
147# CONFIG_FEATURE_TAR_GNU_EXTENSIONS is not set
148# CONFIG_FEATURE_TAR_LONG_OPTIONS is not set
149# CONFIG_FEATURE_TAR_UNAME_GNAME is not set
150# CONFIG_FEATURE_TAR_NOPRESERVE_TIME is not set
151# CONFIG_FEATURE_TAR_SELINUX is not set
152# CONFIG_UNCOMPRESS is not set
153# CONFIG_UNLZMA is not set
154# CONFIG_FEATURE_LZMA_FAST is not set
155# CONFIG_LZMA is not set
156# CONFIG_UNXZ is not set
157# CONFIG_XZ is not set
158# CONFIG_UNZIP is not set
159
160#
161# Coreutils
162#
163CONFIG_BASENAME=y
164# CONFIG_CAT is not set
165# CONFIG_DATE is not set
166# CONFIG_FEATURE_DATE_ISOFMT is not set
167# CONFIG_FEATURE_DATE_NANO is not set
168# CONFIG_FEATURE_DATE_COMPAT is not set
169# CONFIG_TEST is not set
170# CONFIG_FEATURE_TEST_64 is not set
171# CONFIG_TR is not set
172# CONFIG_FEATURE_TR_CLASSES is not set
173# CONFIG_FEATURE_TR_EQUIV is not set
174# CONFIG_CAL is not set
175# CONFIG_CATV is not set
176# CONFIG_CHGRP is not set
177# CONFIG_CHMOD is not set
178# CONFIG_CHOWN is not set
179# CONFIG_FEATURE_CHOWN_LONG_OPTIONS is not set
180# CONFIG_CHROOT is not set
181# CONFIG_CKSUM is not set
182# CONFIG_COMM is not set
183# CONFIG_CP is not set
184# CONFIG_FEATURE_CP_LONG_OPTIONS is not set
185# CONFIG_CUT is not set
186# CONFIG_DD is not set
187# CONFIG_FEATURE_DD_SIGNAL_HANDLING is not set
188# CONFIG_FEATURE_DD_THIRD_STATUS_LINE is not set
189# CONFIG_FEATURE_DD_IBS_OBS is not set
190# CONFIG_DF is not set
191# CONFIG_FEATURE_DF_FANCY is not set
192# CONFIG_DIRNAME is not set
193# CONFIG_DOS2UNIX is not set
194# CONFIG_UNIX2DOS is not set
195# CONFIG_DU is not set
196# CONFIG_FEATURE_DU_DEFAULT_BLOCKSIZE_1K is not set
197# CONFIG_ECHO is not set
198# CONFIG_FEATURE_FANCY_ECHO is not set
199# CONFIG_ENV is not set
200# CONFIG_FEATURE_ENV_LONG_OPTIONS is not set
201# CONFIG_EXPAND is not set
202# CONFIG_FEATURE_EXPAND_LONG_OPTIONS is not set
203# CONFIG_EXPR is not set
204# CONFIG_EXPR_MATH_SUPPORT_64 is not set
205CONFIG_FALSE=y
206# CONFIG_FOLD is not set
207# CONFIG_FSYNC is not set
208# CONFIG_HEAD is not set
209# CONFIG_FEATURE_FANCY_HEAD is not set
210# CONFIG_HOSTID is not set
211# CONFIG_ID is not set
212# CONFIG_INSTALL is not set
213# CONFIG_FEATURE_INSTALL_LONG_OPTIONS is not set
214# CONFIG_LENGTH is not set
215# CONFIG_LN is not set
216# CONFIG_LOGNAME is not set
217# CONFIG_LS is not set
218# CONFIG_FEATURE_LS_FILETYPES is not set
219# CONFIG_FEATURE_LS_FOLLOWLINKS is not set
220# CONFIG_FEATURE_LS_RECURSIVE is not set
221# CONFIG_FEATURE_LS_SORTFILES is not set
222# CONFIG_FEATURE_LS_TIMESTAMPS is not set
223# CONFIG_FEATURE_LS_USERNAME is not set
224# CONFIG_FEATURE_LS_COLOR is not set
225# CONFIG_FEATURE_LS_COLOR_IS_DEFAULT is not set
226# CONFIG_MD5SUM is not set
227# CONFIG_MKDIR is not set
228# CONFIG_FEATURE_MKDIR_LONG_OPTIONS is not set
229# CONFIG_MKFIFO is not set
230# CONFIG_MKNOD is not set
231# CONFIG_MV is not set
232# CONFIG_FEATURE_MV_LONG_OPTIONS is not set
233# CONFIG_NICE is not set
234# CONFIG_NOHUP is not set
235# CONFIG_OD is not set
236# CONFIG_PRINTENV is not set
237# CONFIG_PRINTF is not set
238# CONFIG_PWD is not set
239# CONFIG_READLINK is not set
240# CONFIG_FEATURE_READLINK_FOLLOW is not set
241# CONFIG_REALPATH is not set
242# CONFIG_RM is not set
243# CONFIG_RMDIR is not set
244# CONFIG_FEATURE_RMDIR_LONG_OPTIONS is not set
245# CONFIG_SEQ is not set
246# CONFIG_SHA1SUM is not set
247# CONFIG_SHA256SUM is not set
248# CONFIG_SHA512SUM is not set
249# CONFIG_SLEEP is not set
250# CONFIG_FEATURE_FANCY_SLEEP is not set
251# CONFIG_FEATURE_FLOAT_SLEEP is not set
252# CONFIG_SORT is not set
253# CONFIG_FEATURE_SORT_BIG is not set
254# CONFIG_SPLIT is not set
255# CONFIG_FEATURE_SPLIT_FANCY is not set
256# CONFIG_STAT is not set
257# CONFIG_FEATURE_STAT_FORMAT is not set
258# CONFIG_STTY is not set
259# CONFIG_SUM is not set
260# CONFIG_SYNC is not set
261# CONFIG_TAC is not set
262# CONFIG_TAIL is not set
263# CONFIG_FEATURE_FANCY_TAIL is not set
264# CONFIG_TEE is not set
265# CONFIG_FEATURE_TEE_USE_BLOCK_IO is not set
266# CONFIG_TOUCH is not set
267CONFIG_TRUE=y
268# CONFIG_TTY is not set
269# CONFIG_UNAME is not set
270# CONFIG_UNEXPAND is not set
271# CONFIG_FEATURE_UNEXPAND_LONG_OPTIONS is not set
272# CONFIG_UNIQ is not set
273# CONFIG_USLEEP is not set
274# CONFIG_UUDECODE is not set
275# CONFIG_UUENCODE is not set
276# CONFIG_WC is not set
277# CONFIG_FEATURE_WC_LARGE is not set
278# CONFIG_WHO is not set
279# CONFIG_WHOAMI is not set
280# CONFIG_YES is not set
281# CONFIG_FEATURE_PRESERVE_HARDLINKS is not set
282# CONFIG_FEATURE_AUTOWIDTH is not set
283# CONFIG_FEATURE_HUMAN_READABLE is not set
284# CONFIG_FEATURE_MD5_SHA1_SUM_CHECK is not set
285
286#
287# Console Utilities
288#
289# CONFIG_CHVT is not set
290# CONFIG_FGCONSOLE is not set
291# CONFIG_CLEAR is not set
292# CONFIG_DEALLOCVT is not set
293# CONFIG_DUMPKMAP is not set
294# CONFIG_KBD_MODE is not set
295# CONFIG_LOADFONT is not set
296# CONFIG_LOADKMAP is not set
297# CONFIG_OPENVT is not set
298# CONFIG_RESET is not set
299# CONFIG_RESIZE is not set
300# CONFIG_FEATURE_RESIZE_PRINT is not set
301# CONFIG_SETCONSOLE is not set
302# CONFIG_FEATURE_SETCONSOLE_LONG_OPTIONS is not set
303# CONFIG_SETFONT is not set
304# CONFIG_FEATURE_SETFONT_TEXTUAL_MAP is not set
305CONFIG_DEFAULT_SETFONT_DIR=""
306# CONFIG_SETKEYCODES is not set
307# CONFIG_SETLOGCONS is not set
308# CONFIG_SHOWKEY is not set
309# CONFIG_FEATURE_LOADFONT_PSF2 is not set
310# CONFIG_FEATURE_LOADFONT_RAW is not set
311
312#
313# Debian Utilities
314#
315# CONFIG_MKTEMP is not set
316CONFIG_PIPE_PROGRESS=y
317# CONFIG_RUN_PARTS is not set
318# CONFIG_FEATURE_RUN_PARTS_LONG_OPTIONS is not set
319# CONFIG_FEATURE_RUN_PARTS_FANCY is not set
320# CONFIG_START_STOP_DAEMON is not set
321# CONFIG_FEATURE_START_STOP_DAEMON_FANCY is not set
322# CONFIG_FEATURE_START_STOP_DAEMON_LONG_OPTIONS is not set
323# CONFIG_WHICH is not set
324
325#
326# Editors
327#
328# CONFIG_AWK is not set
329# CONFIG_FEATURE_AWK_LIBM is not set
330# CONFIG_CMP is not set
331# CONFIG_DIFF is not set
332# CONFIG_FEATURE_DIFF_LONG_OPTIONS is not set
333# CONFIG_FEATURE_DIFF_DIR is not set
334# CONFIG_ED is not set
335# CONFIG_PATCH is not set
336# CONFIG_SED is not set
337# CONFIG_VI is not set
338CONFIG_FEATURE_VI_MAX_LEN=0
339# CONFIG_FEATURE_VI_8BIT is not set
340# CONFIG_FEATURE_VI_COLON is not set
341# CONFIG_FEATURE_VI_YANKMARK is not set
342# CONFIG_FEATURE_VI_SEARCH is not set
343# CONFIG_FEATURE_VI_USE_SIGNALS is not set
344# CONFIG_FEATURE_VI_DOT_CMD is not set
345# CONFIG_FEATURE_VI_READONLY is not set
346# CONFIG_FEATURE_VI_SETOPTS is not set
347# CONFIG_FEATURE_VI_SET is not set
348# CONFIG_FEATURE_VI_WIN_RESIZE is not set
349# CONFIG_FEATURE_VI_ASK_TERMINAL is not set
350# CONFIG_FEATURE_VI_OPTIMIZE_CURSOR is not set
351# CONFIG_FEATURE_ALLOW_EXEC is not set
352
353#
354# Finding Utilities
355#
356# CONFIG_FIND is not set
357# CONFIG_FEATURE_FIND_PRINT0 is not set
358# CONFIG_FEATURE_FIND_MTIME is not set
359# CONFIG_FEATURE_FIND_MMIN is not set
360# CONFIG_FEATURE_FIND_PERM is not set
361# CONFIG_FEATURE_FIND_TYPE is not set
362# CONFIG_FEATURE_FIND_XDEV is not set
363# CONFIG_FEATURE_FIND_MAXDEPTH is not set
364# CONFIG_FEATURE_FIND_NEWER is not set
365# CONFIG_FEATURE_FIND_INUM is not set
366# CONFIG_FEATURE_FIND_EXEC is not set
367# CONFIG_FEATURE_FIND_USER is not set
368# CONFIG_FEATURE_FIND_GROUP is not set
369# CONFIG_FEATURE_FIND_NOT is not set
370# CONFIG_FEATURE_FIND_DEPTH is not set
371# CONFIG_FEATURE_FIND_PAREN is not set
372# CONFIG_FEATURE_FIND_SIZE is not set
373# CONFIG_FEATURE_FIND_PRUNE is not set
374# CONFIG_FEATURE_FIND_DELETE is not set
375# CONFIG_FEATURE_FIND_PATH is not set
376# CONFIG_FEATURE_FIND_REGEX is not set
377# CONFIG_FEATURE_FIND_CONTEXT is not set
378# CONFIG_FEATURE_FIND_LINKS is not set
379# CONFIG_GREP is not set
380# CONFIG_FEATURE_GREP_EGREP_ALIAS is not set
381# CONFIG_FEATURE_GREP_FGREP_ALIAS is not set
382# CONFIG_FEATURE_GREP_CONTEXT is not set
383# CONFIG_XARGS is not set
384# CONFIG_FEATURE_XARGS_SUPPORT_CONFIRMATION is not set
385# CONFIG_FEATURE_XARGS_SUPPORT_QUOTES is not set
386# CONFIG_FEATURE_XARGS_SUPPORT_TERMOPT is not set
387# CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM is not set
388
389#
390# Init Utilities
391#
392# CONFIG_INIT is not set
393# CONFIG_FEATURE_USE_INITTAB is not set
394# CONFIG_FEATURE_KILL_REMOVED is not set
395CONFIG_FEATURE_KILL_DELAY=0
396# CONFIG_FEATURE_INIT_SCTTY is not set
397# CONFIG_FEATURE_INIT_SYSLOG is not set
398# CONFIG_FEATURE_EXTRA_QUIET is not set
399# CONFIG_FEATURE_INIT_COREDUMPS is not set
400# CONFIG_FEATURE_INITRD is not set
401# CONFIG_HALT is not set
402# CONFIG_FEATURE_CALL_TELINIT is not set
403CONFIG_TELINIT_PATH=""
404# CONFIG_MESG is not set
405# CONFIG_BOOTCHARTD is not set
406
407#
408# Login/Password Management Utilities
409#
410# CONFIG_FEATURE_SHADOWPASSWDS is not set
411# CONFIG_USE_BB_PWD_GRP is not set
412# CONFIG_USE_BB_SHADOW is not set
413# CONFIG_USE_BB_CRYPT is not set
414# CONFIG_USE_BB_CRYPT_SHA is not set
415# CONFIG_ADDGROUP is not set
416# CONFIG_FEATURE_ADDGROUP_LONG_OPTIONS is not set
417# CONFIG_FEATURE_ADDUSER_TO_GROUP is not set
418# CONFIG_DELGROUP is not set
419# CONFIG_FEATURE_DEL_USER_FROM_GROUP is not set
420# CONFIG_FEATURE_CHECK_NAMES is not set
421# CONFIG_ADDUSER is not set
422# CONFIG_FEATURE_ADDUSER_LONG_OPTIONS is not set
423CONFIG_FIRST_SYSTEM_ID=0
424CONFIG_LAST_SYSTEM_ID=0
425# CONFIG_DELUSER is not set
426# CONFIG_GETTY is not set
427# CONFIG_LOGIN is not set
428# CONFIG_PAM is not set
429# CONFIG_LOGIN_SCRIPTS is not set
430# CONFIG_FEATURE_NOLOGIN is not set
431# CONFIG_FEATURE_SECURETTY is not set
432# CONFIG_PASSWD is not set
433# CONFIG_FEATURE_PASSWD_WEAK_CHECK is not set
434# CONFIG_CRYPTPW is not set
435# CONFIG_CHPASSWD is not set
436# CONFIG_SU is not set
437# CONFIG_FEATURE_SU_SYSLOG is not set
438# CONFIG_FEATURE_SU_CHECKS_SHELLS is not set
439# CONFIG_SULOGIN is not set
440# CONFIG_VLOCK is not set
441
442#
443# Linux Ext2 FS Progs
444#
445# CONFIG_CHATTR is not set
446# CONFIG_FSCK is not set
447# CONFIG_LSATTR is not set
448# CONFIG_TUNE2FS is not set
449
450#
451# Linux Module Utilities
452#
453# CONFIG_MODINFO is not set
454# CONFIG_MODPROBE_SMALL is not set
455# CONFIG_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE is not set
456# CONFIG_FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED is not set
457# CONFIG_INSMOD is not set
458# CONFIG_RMMOD is not set
459# CONFIG_LSMOD is not set
460# CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT is not set
461# CONFIG_MODPROBE is not set
462# CONFIG_FEATURE_MODPROBE_BLACKLIST is not set
463# CONFIG_DEPMOD is not set
464
465#
466# Options common to multiple modutils
467#
468# CONFIG_FEATURE_2_4_MODULES is not set
469# CONFIG_FEATURE_INSMOD_TRY_MMAP is not set
470# CONFIG_FEATURE_INSMOD_VERSION_CHECKING is not set
471# CONFIG_FEATURE_INSMOD_KSYMOOPS_SYMBOLS is not set
472# CONFIG_FEATURE_INSMOD_LOADINKMEM is not set
473# CONFIG_FEATURE_INSMOD_LOAD_MAP is not set
474# CONFIG_FEATURE_INSMOD_LOAD_MAP_FULL is not set
475# CONFIG_FEATURE_CHECK_TAINTED_MODULE is not set
476# CONFIG_FEATURE_MODUTILS_ALIAS is not set
477# CONFIG_FEATURE_MODUTILS_SYMBOLS is not set
478CONFIG_DEFAULT_MODULES_DIR=""
479CONFIG_DEFAULT_DEPMOD_FILE=""
480
481#
482# Linux System Utilities
483#
484# CONFIG_ACPID is not set
485# CONFIG_FEATURE_ACPID_COMPAT is not set
486# CONFIG_BLKID is not set
487# CONFIG_DMESG is not set
488# CONFIG_FEATURE_DMESG_PRETTY is not set
489# CONFIG_FBSET is not set
490# CONFIG_FEATURE_FBSET_FANCY is not set
491# CONFIG_FEATURE_FBSET_READMODE is not set
492# CONFIG_FDFLUSH is not set
493# CONFIG_FDFORMAT is not set
494# CONFIG_FDISK is not set
495CONFIG_FDISK_SUPPORT_LARGE_DISKS=y
496# CONFIG_FEATURE_FDISK_WRITABLE is not set
497# CONFIG_FEATURE_AIX_LABEL is not set
498# CONFIG_FEATURE_SGI_LABEL is not set
499# CONFIG_FEATURE_SUN_LABEL is not set
500# CONFIG_FEATURE_OSF_LABEL is not set
501# CONFIG_FEATURE_FDISK_ADVANCED is not set
502# CONFIG_FINDFS is not set
503# CONFIG_FLOCK is not set
504# CONFIG_FREERAMDISK is not set
505# CONFIG_FSCK_MINIX is not set
506# CONFIG_MKFS_EXT2 is not set
507# CONFIG_MKFS_MINIX is not set
508# CONFIG_FEATURE_MINIX2 is not set
509# CONFIG_MKFS_REISER is not set
510# CONFIG_MKFS_VFAT is not set
511# CONFIG_GETOPT is not set
512# CONFIG_FEATURE_GETOPT_LONG is not set
513# CONFIG_HEXDUMP is not set
514# CONFIG_FEATURE_HEXDUMP_REVERSE is not set
515# CONFIG_HD is not set
516# CONFIG_HWCLOCK is not set
517# CONFIG_FEATURE_HWCLOCK_LONG_OPTIONS is not set
518# CONFIG_FEATURE_HWCLOCK_ADJTIME_FHS is not set
519# CONFIG_IPCRM is not set
520# CONFIG_IPCS is not set
521# CONFIG_LOSETUP is not set
522# CONFIG_LSPCI is not set
523# CONFIG_LSUSB is not set
524# CONFIG_MDEV is not set
525# CONFIG_FEATURE_MDEV_CONF is not set
526# CONFIG_FEATURE_MDEV_RENAME is not set
527# CONFIG_FEATURE_MDEV_RENAME_REGEXP is not set
528# CONFIG_FEATURE_MDEV_EXEC is not set
529# CONFIG_FEATURE_MDEV_LOAD_FIRMWARE is not set
530# CONFIG_MKSWAP is not set
531# CONFIG_FEATURE_MKSWAP_UUID is not set
532# CONFIG_MORE is not set
533# CONFIG_FEATURE_USE_TERMIOS is not set
534CONFIG_VOLUMEID=y
535# CONFIG_FEATURE_VOLUMEID_EXT is not set
536# CONFIG_FEATURE_VOLUMEID_BTRFS is not set
537# CONFIG_FEATURE_VOLUMEID_REISERFS is not set
538# CONFIG_FEATURE_VOLUMEID_FAT is not set
539# CONFIG_FEATURE_VOLUMEID_HFS is not set
540# CONFIG_FEATURE_VOLUMEID_JFS is not set
541# CONFIG_FEATURE_VOLUMEID_XFS is not set
542# CONFIG_FEATURE_VOLUMEID_NTFS is not set
543# CONFIG_FEATURE_VOLUMEID_ISO9660 is not set
544# CONFIG_FEATURE_VOLUMEID_UDF is not set
545# CONFIG_FEATURE_VOLUMEID_LUKS is not set
546# CONFIG_FEATURE_VOLUMEID_LINUXSWAP is not set
547# CONFIG_FEATURE_VOLUMEID_CRAMFS is not set
548# CONFIG_FEATURE_VOLUMEID_ROMFS is not set
549# CONFIG_FEATURE_VOLUMEID_SYSV is not set
550# CONFIG_FEATURE_VOLUMEID_OCFS2 is not set
551# CONFIG_FEATURE_VOLUMEID_LINUXRAID is not set
552# CONFIG_MOUNT is not set
553# CONFIG_FEATURE_MOUNT_FAKE is not set
554# CONFIG_FEATURE_MOUNT_VERBOSE is not set
555# CONFIG_FEATURE_MOUNT_HELPERS is not set
556# CONFIG_FEATURE_MOUNT_LABEL is not set
557# CONFIG_FEATURE_MOUNT_NFS is not set
558# CONFIG_FEATURE_MOUNT_CIFS is not set
559# CONFIG_FEATURE_MOUNT_FLAGS is not set
560# CONFIG_FEATURE_MOUNT_FSTAB is not set
561# CONFIG_PIVOT_ROOT is not set
562# CONFIG_RDATE is not set
563# CONFIG_RDEV is not set
564# CONFIG_READPROFILE is not set
565# CONFIG_RTCWAKE is not set
566# CONFIG_SCRIPT is not set
567# CONFIG_SCRIPTREPLAY is not set
568# CONFIG_SETARCH is not set
569# CONFIG_SWAPONOFF is not set
570# CONFIG_FEATURE_SWAPON_PRI is not set
571# CONFIG_SWITCH_ROOT is not set
572# CONFIG_UMOUNT is not set
573# CONFIG_FEATURE_UMOUNT_ALL is not set
574# CONFIG_FEATURE_MOUNT_LOOP is not set
575# CONFIG_FEATURE_MOUNT_LOOP_CREATE is not set
576# CONFIG_FEATURE_MTAB_SUPPORT is not set
577
578#
579# Miscellaneous Utilities
580#
581# CONFIG_ADJTIMEX is not set
582# CONFIG_BBCONFIG is not set
583# CONFIG_BEEP is not set
584CONFIG_FEATURE_BEEP_FREQ=0
585CONFIG_FEATURE_BEEP_LENGTH_MS=0
586# CONFIG_CHAT is not set
587# CONFIG_FEATURE_CHAT_NOFAIL is not set
588# CONFIG_FEATURE_CHAT_TTY_HIFI is not set
589# CONFIG_FEATURE_CHAT_IMPLICIT_CR is not set
590# CONFIG_FEATURE_CHAT_SWALLOW_OPTS is not set
591# CONFIG_FEATURE_CHAT_SEND_ESCAPES is not set
592# CONFIG_FEATURE_CHAT_VAR_ABORT_LEN is not set
593# CONFIG_FEATURE_CHAT_CLR_ABORT is not set
594# CONFIG_CHRT is not set
595# CONFIG_CROND is not set
596# CONFIG_FEATURE_CROND_D is not set
597# CONFIG_FEATURE_CROND_CALL_SENDMAIL is not set
598CONFIG_FEATURE_CROND_DIR=""
599# CONFIG_CRONTAB is not set
600# CONFIG_DC is not set
601# CONFIG_FEATURE_DC_LIBM is not set
602# CONFIG_DEVFSD is not set
603# CONFIG_DEVFSD_MODLOAD is not set
604# CONFIG_DEVFSD_FG_NP is not set
605# CONFIG_DEVFSD_VERBOSE is not set
606# CONFIG_FEATURE_DEVFS is not set
607# CONFIG_DEVMEM is not set
608# CONFIG_EJECT is not set
609# CONFIG_FEATURE_EJECT_SCSI is not set
610# CONFIG_FBSPLASH is not set
611# CONFIG_FLASHCP is not set
612# CONFIG_FLASH_LOCK is not set
613# CONFIG_FLASH_UNLOCK is not set
614# CONFIG_FLASH_ERASEALL is not set
615# CONFIG_IONICE is not set
616# CONFIG_INOTIFYD is not set
617# CONFIG_LAST is not set
618# CONFIG_FEATURE_LAST_SMALL is not set
619# CONFIG_FEATURE_LAST_FANCY is not set
620# CONFIG_LESS is not set
621CONFIG_FEATURE_LESS_MAXLINES=0
622# CONFIG_FEATURE_LESS_BRACKETS is not set
623# CONFIG_FEATURE_LESS_FLAGS is not set
624# CONFIG_FEATURE_LESS_MARKS is not set
625# CONFIG_FEATURE_LESS_REGEXP is not set
626# CONFIG_FEATURE_LESS_WINCH is not set
627# CONFIG_FEATURE_LESS_DASHCMD is not set
628# CONFIG_FEATURE_LESS_LINENUMS is not set
629# CONFIG_HDPARM is not set
630# CONFIG_FEATURE_HDPARM_GET_IDENTITY is not set
631# CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF is not set
632# CONFIG_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF is not set
633# CONFIG_FEATURE_HDPARM_HDIO_DRIVE_RESET is not set
634# CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF is not set
635# CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA is not set
636# CONFIG_MAKEDEVS is not set
637# CONFIG_FEATURE_MAKEDEVS_LEAF is not set
638# CONFIG_FEATURE_MAKEDEVS_TABLE is not set
639# CONFIG_MAN is not set
640# CONFIG_MICROCOM is not set
641# CONFIG_MOUNTPOINT is not set
642# CONFIG_MT is not set
643# CONFIG_RAIDAUTORUN is not set
644# CONFIG_READAHEAD is not set
645# CONFIG_RFKILL is not set
646# CONFIG_RUNLEVEL is not set
647# CONFIG_RX is not set
648# CONFIG_SETSID is not set
649# CONFIG_STRINGS is not set
650# CONFIG_TASKSET is not set
651# CONFIG_FEATURE_TASKSET_FANCY is not set
652# CONFIG_TIME is not set
653# CONFIG_TIMEOUT is not set
654# CONFIG_TTYSIZE is not set
655# CONFIG_VOLNAME is not set
656# CONFIG_WALL is not set
657# CONFIG_WATCHDOG is not set
658
659#
660# Networking Utilities
661#
662# CONFIG_FEATURE_IPV6 is not set
663# CONFIG_FEATURE_UNIX_LOCAL is not set
664# CONFIG_FEATURE_PREFER_IPV4_ADDRESS is not set
665# CONFIG_VERBOSE_RESOLUTION_ERRORS is not set
666# CONFIG_ARP is not set
667# CONFIG_ARPING is not set
668# CONFIG_BRCTL is not set
669# CONFIG_FEATURE_BRCTL_FANCY is not set
670# CONFIG_FEATURE_BRCTL_SHOW is not set
671# CONFIG_DNSD is not set
672# CONFIG_ETHER_WAKE is not set
673# CONFIG_FAKEIDENTD is not set
674# CONFIG_FTPD is not set
675# CONFIG_FEATURE_FTP_WRITE is not set
676# CONFIG_FEATURE_FTPD_ACCEPT_BROKEN_LIST is not set
677# CONFIG_FTPGET is not set
678# CONFIG_FTPPUT is not set
679# CONFIG_FEATURE_FTPGETPUT_LONG_OPTIONS is not set
680# CONFIG_HOSTNAME is not set
681# CONFIG_HTTPD is not set
682# CONFIG_FEATURE_HTTPD_RANGES is not set
683# CONFIG_FEATURE_HTTPD_USE_SENDFILE is not set
684# CONFIG_FEATURE_HTTPD_SETUID is not set
685# CONFIG_FEATURE_HTTPD_BASIC_AUTH is not set
686# CONFIG_FEATURE_HTTPD_AUTH_MD5 is not set
687# CONFIG_FEATURE_HTTPD_CGI is not set
688# CONFIG_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR is not set
689# CONFIG_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV is not set
690# CONFIG_FEATURE_HTTPD_ENCODE_URL_STR is not set
691# CONFIG_FEATURE_HTTPD_ERROR_PAGES is not set
692# CONFIG_FEATURE_HTTPD_PROXY is not set
693# CONFIG_IFCONFIG is not set
694# CONFIG_FEATURE_IFCONFIG_STATUS is not set
695# CONFIG_FEATURE_IFCONFIG_SLIP is not set
696# CONFIG_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ is not set
697# CONFIG_FEATURE_IFCONFIG_HW is not set
698# CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS is not set
699# CONFIG_IFENSLAVE is not set
700# CONFIG_IFPLUGD is not set
701# CONFIG_IFUPDOWN is not set
702CONFIG_IFUPDOWN_IFSTATE_PATH=""
703# CONFIG_FEATURE_IFUPDOWN_IP is not set
704# CONFIG_FEATURE_IFUPDOWN_IP_BUILTIN is not set
705# CONFIG_FEATURE_IFUPDOWN_IFCONFIG_BUILTIN is not set
706# CONFIG_FEATURE_IFUPDOWN_IPV4 is not set
707# CONFIG_FEATURE_IFUPDOWN_IPV6 is not set
708# CONFIG_FEATURE_IFUPDOWN_MAPPING is not set
709# CONFIG_FEATURE_IFUPDOWN_EXTERNAL_DHCP is not set
710# CONFIG_INETD is not set
711# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_ECHO is not set
712# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DISCARD is not set
713# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_TIME is not set
714# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DAYTIME is not set
715# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_CHARGEN is not set
716# CONFIG_FEATURE_INETD_RPC is not set
717# CONFIG_IP is not set
718# CONFIG_FEATURE_IP_ADDRESS is not set
719# CONFIG_FEATURE_IP_LINK is not set
720# CONFIG_FEATURE_IP_ROUTE is not set
721# CONFIG_FEATURE_IP_TUNNEL is not set
722# CONFIG_FEATURE_IP_RULE is not set
723# CONFIG_FEATURE_IP_SHORT_FORMS is not set
724# CONFIG_FEATURE_IP_RARE_PROTOCOLS is not set
725# CONFIG_IPADDR is not set
726# CONFIG_IPLINK is not set
727# CONFIG_IPROUTE is not set
728# CONFIG_IPTUNNEL is not set
729# CONFIG_IPRULE is not set
730# CONFIG_IPCALC is not set
731# CONFIG_FEATURE_IPCALC_FANCY is not set
732# CONFIG_FEATURE_IPCALC_LONG_OPTIONS is not set
733# CONFIG_NAMEIF is not set
734# CONFIG_FEATURE_NAMEIF_EXTENDED is not set
735# CONFIG_NC is not set
736# CONFIG_NC_SERVER is not set
737# CONFIG_NC_EXTRA is not set
738# CONFIG_NETSTAT is not set
739# CONFIG_FEATURE_NETSTAT_WIDE is not set
740# CONFIG_FEATURE_NETSTAT_PRG is not set
741# CONFIG_NSLOOKUP is not set
742# CONFIG_NTPD is not set
743# CONFIG_FEATURE_NTPD_SERVER is not set
744# CONFIG_PING is not set
745# CONFIG_PING6 is not set
746# CONFIG_FEATURE_FANCY_PING is not set
747# CONFIG_PSCAN is not set
748# CONFIG_ROUTE is not set
749# CONFIG_SLATTACH is not set
750# CONFIG_TCPSVD is not set
751# CONFIG_TELNET is not set
752# CONFIG_FEATURE_TELNET_TTYPE is not set
753# CONFIG_FEATURE_TELNET_AUTOLOGIN is not set
754# CONFIG_TELNETD is not set
755# CONFIG_FEATURE_TELNETD_STANDALONE is not set
756# CONFIG_FEATURE_TELNETD_INETD_WAIT is not set
757# CONFIG_TFTP is not set
758# CONFIG_TFTPD is not set
759# CONFIG_FEATURE_TFTP_GET is not set
760# CONFIG_FEATURE_TFTP_PUT is not set
761# CONFIG_FEATURE_TFTP_BLOCKSIZE is not set
762# CONFIG_FEATURE_TFTP_PROGRESS_BAR is not set
763# CONFIG_TFTP_DEBUG is not set
764# CONFIG_TRACEROUTE is not set
765# CONFIG_TRACEROUTE6 is not set
766# CONFIG_FEATURE_TRACEROUTE_VERBOSE is not set
767# CONFIG_FEATURE_TRACEROUTE_SOURCE_ROUTE is not set
768# CONFIG_FEATURE_TRACEROUTE_USE_ICMP is not set
769# CONFIG_TUNCTL is not set
770# CONFIG_FEATURE_TUNCTL_UG is not set
771# CONFIG_UDHCPD is not set
772# CONFIG_DHCPRELAY is not set
773# CONFIG_DUMPLEASES is not set
774# CONFIG_FEATURE_UDHCPD_WRITE_LEASES_EARLY is not set
775CONFIG_DHCPD_LEASES_FILE=""
776# CONFIG_UDHCPC is not set
777# CONFIG_FEATURE_UDHCPC_ARPING is not set
778# CONFIG_FEATURE_UDHCP_PORT is not set
779CONFIG_UDHCP_DEBUG=0
780# CONFIG_FEATURE_UDHCP_RFC3397 is not set
781CONFIG_UDHCPC_DEFAULT_SCRIPT=""
782CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS=0
783CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS=""
784# CONFIG_UDPSVD is not set
785# CONFIG_VCONFIG is not set
786# CONFIG_WGET is not set
787# CONFIG_FEATURE_WGET_STATUSBAR is not set
788# CONFIG_FEATURE_WGET_AUTHENTICATION is not set
789# CONFIG_FEATURE_WGET_LONG_OPTIONS is not set
790# CONFIG_ZCIP is not set
791
792#
793# Print Utilities
794#
795# CONFIG_LPD is not set
796# CONFIG_LPR is not set
797# CONFIG_LPQ is not set
798
799#
800# Mail Utilities
801#
802# CONFIG_MAKEMIME is not set
803CONFIG_FEATURE_MIME_CHARSET=""
804# CONFIG_POPMAILDIR is not set
805# CONFIG_FEATURE_POPMAILDIR_DELIVERY is not set
806# CONFIG_REFORMIME is not set
807# CONFIG_FEATURE_REFORMIME_COMPAT is not set
808# CONFIG_SENDMAIL is not set
809
810#
811# Process Utilities
812#
813# CONFIG_FREE is not set
814# CONFIG_FUSER is not set
815# CONFIG_KILL is not set
816# CONFIG_KILLALL is not set
817# CONFIG_KILLALL5 is not set
818# CONFIG_NMETER is not set
819# CONFIG_PGREP is not set
820# CONFIG_PIDOF is not set
821# CONFIG_FEATURE_PIDOF_SINGLE is not set
822# CONFIG_FEATURE_PIDOF_OMIT is not set
823# CONFIG_PKILL is not set
824# CONFIG_PS is not set
825# CONFIG_FEATURE_PS_WIDE is not set
826# CONFIG_FEATURE_PS_TIME is not set
827# CONFIG_FEATURE_PS_ADDITIONAL_COLUMNS is not set
828# CONFIG_FEATURE_PS_UNUSUAL_SYSTEMS is not set
829# CONFIG_RENICE is not set
830# CONFIG_BB_SYSCTL is not set
831# CONFIG_TOP is not set
832# CONFIG_FEATURE_TOP_CPU_USAGE_PERCENTAGE is not set
833# CONFIG_FEATURE_TOP_CPU_GLOBAL_PERCENTS is not set
834# CONFIG_FEATURE_TOP_SMP_CPU is not set
835# CONFIG_FEATURE_TOP_DECIMALS is not set
836# CONFIG_FEATURE_TOP_SMP_PROCESS is not set
837# CONFIG_FEATURE_TOPMEM is not set
838# CONFIG_FEATURE_SHOW_THREADS is not set
839# CONFIG_UPTIME is not set
840# CONFIG_WATCH is not set
841
842#
843# Runit Utilities
844#
845# CONFIG_RUNSV is not set
846# CONFIG_RUNSVDIR is not set
847# CONFIG_FEATURE_RUNSVDIR_LOG is not set
848# CONFIG_SV is not set
849CONFIG_SV_DEFAULT_SERVICE_DIR=""
850# CONFIG_SVLOGD is not set
851# CONFIG_CHPST is not set
852# CONFIG_SETUIDGID is not set
853# CONFIG_ENVUIDGID is not set
854# CONFIG_ENVDIR is not set
855# CONFIG_SOFTLIMIT is not set
856# CONFIG_CHCON is not set
857# CONFIG_FEATURE_CHCON_LONG_OPTIONS is not set
858# CONFIG_GETENFORCE is not set
859# CONFIG_GETSEBOOL is not set
860# CONFIG_LOAD_POLICY is not set
861# CONFIG_MATCHPATHCON is not set
862# CONFIG_RESTORECON is not set
863# CONFIG_RUNCON is not set
864# CONFIG_FEATURE_RUNCON_LONG_OPTIONS is not set
865# CONFIG_SELINUXENABLED is not set
866# CONFIG_SETENFORCE is not set
867# CONFIG_SETFILES is not set
868# CONFIG_FEATURE_SETFILES_CHECK_OPTION is not set
869# CONFIG_SETSEBOOL is not set
870# CONFIG_SESTATUS is not set
871
872#
873# Shells
874#
875# CONFIG_FEATURE_SH_IS_ASH is not set
876# CONFIG_FEATURE_SH_IS_HUSH is not set
877CONFIG_FEATURE_SH_IS_NONE=y
878# CONFIG_FEATURE_BASH_IS_ASH is not set
879# CONFIG_FEATURE_BASH_IS_HUSH is not set
880CONFIG_FEATURE_BASH_IS_NONE=y
881# CONFIG_ASH is not set
882# CONFIG_ASH_BASH_COMPAT is not set
883# CONFIG_ASH_JOB_CONTROL is not set
884# CONFIG_ASH_ALIAS is not set
885# CONFIG_ASH_GETOPTS is not set
886# CONFIG_ASH_BUILTIN_ECHO is not set
887# CONFIG_ASH_BUILTIN_PRINTF is not set
888# CONFIG_ASH_BUILTIN_TEST is not set
889# CONFIG_ASH_CMDCMD is not set
890# CONFIG_ASH_MAIL is not set
891# CONFIG_ASH_OPTIMIZE_FOR_SIZE is not set
892# CONFIG_ASH_RANDOM_SUPPORT is not set
893# CONFIG_ASH_EXPAND_PRMT is not set
894# CONFIG_HUSH is not set
895# CONFIG_HUSH_BASH_COMPAT is not set
896# CONFIG_HUSH_HELP is not set
897# CONFIG_HUSH_INTERACTIVE is not set
898# CONFIG_HUSH_JOB is not set
899# CONFIG_HUSH_TICK is not set
900# CONFIG_HUSH_IF is not set
901# CONFIG_HUSH_LOOPS is not set
902# CONFIG_HUSH_CASE is not set
903# CONFIG_HUSH_FUNCTIONS is not set
904# CONFIG_HUSH_LOCAL is not set
905# CONFIG_HUSH_EXPORT_N is not set
906# CONFIG_HUSH_RANDOM_SUPPORT is not set
907# CONFIG_LASH is not set
908# CONFIG_MSH is not set
909# CONFIG_SH_MATH_SUPPORT is not set
910# CONFIG_SH_MATH_SUPPORT_64 is not set
911# CONFIG_FEATURE_SH_EXTRA_QUIET is not set
912# CONFIG_FEATURE_SH_STANDALONE is not set
913# CONFIG_FEATURE_SH_NOFORK is not set
914# CONFIG_CTTYHACK is not set
915
916#
917# System Logging Utilities
918#
919# CONFIG_SYSLOGD is not set
920# CONFIG_FEATURE_ROTATE_LOGFILE is not set
921# CONFIG_FEATURE_REMOTE_LOG is not set
922# CONFIG_FEATURE_SYSLOGD_DUP is not set
923CONFIG_FEATURE_SYSLOGD_READ_BUFFER_SIZE=0
924# CONFIG_FEATURE_IPC_SYSLOG is not set
925CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE=0
926# CONFIG_LOGREAD is not set
927# CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING is not set
928# CONFIG_KLOGD is not set
929# CONFIG_LOGGER is not set
diff --git a/archival/gzip.c b/archival/gzip.c
index 5cc553a80..620897b90 100644
--- a/archival/gzip.c
+++ b/archival/gzip.c
@@ -676,7 +676,7 @@ static void check_match(IPos start, IPos match, int length)
676 if (verbose > 1) { 676 if (verbose > 1) {
677 bb_error_msg("\\[%d,%d]", start - match, length); 677 bb_error_msg("\\[%d,%d]", start - match, length);
678 do { 678 do {
679 fputc(G1.window[start++], stderr); 679 bb_putchar_stderr(G1.window[start++]);
680 } while (--length != 0); 680 } while (--length != 0);
681 } 681 }
682} 682}
diff --git a/debianutils/pipe_progress.c b/debianutils/pipe_progress.c
index ced5fb307..6adefac99 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)
24 time_t new_time = time(NULL); 24 time_t new_time = time(NULL);
25 if (new_time != t) { 25 if (new_time != t) {
26 t = new_time; 26 t = new_time;
27 fputc('.', stderr); 27 bb_putchar_stderr('.');
28 } 28 }
29 full_write(STDOUT_FILENO, buf, len); 29 full_write(STDOUT_FILENO, buf, len);
30 } 30 }
31 31
32 fputc('\n', stderr); 32 bb_putchar_stderr('\n');
33 33
34 return 0; 34 return 0;
35} 35}
diff --git a/findutils/xargs.c b/findutils/xargs.c
index 7db374c4a..9133b8f6c 100644
--- a/findutils/xargs.c
+++ b/findutils/xargs.c
@@ -529,11 +529,11 @@ int xargs_main(int argc, char **argv)
529 if (opt & (OPT_INTERACTIVE | OPT_VERBOSE)) { 529 if (opt & (OPT_INTERACTIVE | OPT_VERBOSE)) {
530 for (i = 0; args[i]; i++) { 530 for (i = 0; args[i]; i++) {
531 if (i) 531 if (i)
532 fputc(' ', stderr); 532 bb_putchar_stderr(' ');
533 fputs(args[i], stderr); 533 fputs(args[i], stderr);
534 } 534 }
535 if (!(opt & OPT_INTERACTIVE)) 535 if (!(opt & OPT_INTERACTIVE))
536 fputc('\n', stderr); 536 bb_putchar_stderr('\n');
537 } 537 }
538 if (!(opt & OPT_INTERACTIVE) || xargs_ask_confirmation()) { 538 if (!(opt & OPT_INTERACTIVE) || xargs_ask_confirmation()) {
539 child_error = xargs_exec(args); 539 child_error = xargs_exec(args);
diff --git a/include/libbb.h b/include/libbb.h
index 326179b97..3fffa83ed 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -592,6 +592,8 @@ char *strncpy_IFNAMSIZ(char *dst, const char *src) FAST_FUNC;
592/* Guaranteed to NOT be a macro (smallest code). Saves nearly 2k on uclibc. 592/* Guaranteed to NOT be a macro (smallest code). Saves nearly 2k on uclibc.
593 * But potentially slow, don't use in one-billion-times loops */ 593 * But potentially slow, don't use in one-billion-times loops */
594int bb_putchar(int ch) FAST_FUNC; 594int bb_putchar(int ch) FAST_FUNC;
595/* Note: does not use stdio, writes to fd 2 directly */
596int bb_putchar_stderr(char ch) FAST_FUNC;
595char *xasprintf(const char *format, ...) __attribute__ ((format(printf, 1, 2))) FAST_FUNC RETURNS_MALLOC; 597char *xasprintf(const char *format, ...) __attribute__ ((format(printf, 1, 2))) FAST_FUNC RETURNS_MALLOC;
596// gcc-4.1.1 still isn't good enough at optimizing it 598// gcc-4.1.1 still isn't good enough at optimizing it
597// (+200 bytes compared to macro) 599// (+200 bytes compared to macro)
diff --git a/libbb/Kbuild.src b/libbb/Kbuild.src
index 1b11d5d39..68d04b3bd 100644
--- a/libbb/Kbuild.src
+++ b/libbb/Kbuild.src
@@ -81,6 +81,7 @@ lib-y += procps.o
81lib-y += progress.o 81lib-y += progress.o
82lib-y += ptr_to_globals.o 82lib-y += ptr_to_globals.o
83lib-y += read.o 83lib-y += read.o
84lib-y += read_printf.o
84lib-y += read_key.o 85lib-y += read_key.o
85lib-y += recursive_action.o 86lib-y += recursive_action.o
86lib-y += remove_file.o 87lib-y += remove_file.o
diff --git a/libbb/read.c b/libbb/read.c
index b1eb3f24b..1ed7c5f92 100644
--- a/libbb/read.c
+++ b/libbb/read.c
@@ -8,16 +8,6 @@
8 */ 8 */
9#include "libbb.h" 9#include "libbb.h"
10 10
11#define ZIPPED (ENABLE_FEATURE_SEAMLESS_LZMA \
12 || ENABLE_FEATURE_SEAMLESS_BZ2 \
13 || ENABLE_FEATURE_SEAMLESS_GZ \
14 /* || ENABLE_FEATURE_SEAMLESS_Z */ \
15)
16
17#if ZIPPED
18# include "unarchive.h"
19#endif
20
21ssize_t FAST_FUNC safe_read(int fd, void *buf, size_t count) 11ssize_t FAST_FUNC safe_read(int fd, void *buf, size_t count)
22{ 12{
23 ssize_t n; 13 ssize_t n;
@@ -29,58 +19,6 @@ ssize_t FAST_FUNC safe_read(int fd, void *buf, size_t count)
29 return n; 19 return n;
30} 20}
31 21
32/* Suppose that you are a shell. You start child processes.
33 * They work and eventually exit. You want to get user input.
34 * You read stdin. But what happens if last child switched
35 * its stdin into O_NONBLOCK mode?
36 *
37 * *** SURPRISE! It will affect the parent too! ***
38 * *** BIG SURPRISE! It stays even after child exits! ***
39 *
40 * This is a design bug in UNIX API.
41 * fcntl(0, F_SETFL, fcntl(0, F_GETFL) | O_NONBLOCK);
42 * will set nonblocking mode not only on _your_ stdin, but
43 * also on stdin of your parent, etc.
44 *
45 * In general,
46 * fd2 = dup(fd1);
47 * fcntl(fd2, F_SETFL, fcntl(fd2, F_GETFL) | O_NONBLOCK);
48 * sets both fd1 and fd2 to O_NONBLOCK. This includes cases
49 * where duping is done implicitly by fork() etc.
50 *
51 * We need
52 * fcntl(fd2, F_SETFD, fcntl(fd2, F_GETFD) | O_NONBLOCK);
53 * (note SETFD, not SETFL!) but such thing doesn't exist.
54 *
55 * Alternatively, we need nonblocking_read(fd, ...) which doesn't
56 * require O_NONBLOCK dance at all. Actually, it exists:
57 * n = recv(fd, buf, len, MSG_DONTWAIT);
58 * "MSG_DONTWAIT:
59 * Enables non-blocking operation; if the operation
60 * would block, EAGAIN is returned."
61 * but recv() works only for sockets!
62 *
63 * So far I don't see any good solution, I can only propose
64 * that affected readers should be careful and use this routine,
65 * which detects EAGAIN and uses poll() to wait on the fd.
66 * Thankfully, poll() doesn't care about O_NONBLOCK flag.
67 */
68ssize_t FAST_FUNC nonblock_safe_read(int fd, void *buf, size_t count)
69{
70 struct pollfd pfd[1];
71 ssize_t n;
72
73 while (1) {
74 n = safe_read(fd, buf, count);
75 if (n >= 0 || errno != EAGAIN)
76 return n;
77 /* fd is in O_NONBLOCK mode. Wait using poll and repeat */
78 pfd[0].fd = fd;
79 pfd[0].events = POLLIN;
80 safe_poll(pfd, 1, -1);
81 }
82}
83
84/* 22/*
85 * Read all of the supplied buffer from a file. 23 * Read all of the supplied buffer from a file.
86 * This does multiple reads as necessary. 24 * This does multiple reads as necessary.
@@ -115,60 +53,6 @@ ssize_t FAST_FUNC full_read(int fd, void *buf, size_t len)
115 return total; 53 return total;
116} 54}
117 55
118/* Die with an error message if we can't read the entire buffer. */
119void FAST_FUNC xread(int fd, void *buf, size_t count)
120{
121 if (count) {
122 ssize_t size = full_read(fd, buf, count);
123 if ((size_t)size != count)
124 bb_error_msg_and_die("short read");
125 }
126}
127
128/* Die with an error message if we can't read one character. */
129unsigned char FAST_FUNC xread_char(int fd)
130{
131 char tmp;
132 xread(fd, &tmp, 1);
133 return tmp;
134}
135
136// Reads one line a-la fgets (but doesn't save terminating '\n').
137// Reads byte-by-byte. Useful when it is important to not read ahead.
138// Bytes are appended to pfx (which must be malloced, or NULL).
139char* FAST_FUNC xmalloc_reads(int fd, char *buf, size_t *maxsz_p)
140{
141 char *p;
142 size_t sz = buf ? strlen(buf) : 0;
143 size_t maxsz = maxsz_p ? *maxsz_p : (INT_MAX - 4095);
144
145 goto jump_in;
146 while (sz < maxsz) {
147 if ((size_t)(p - buf) == sz) {
148 jump_in:
149 buf = xrealloc(buf, sz + 128);
150 p = buf + sz;
151 sz += 128;
152 }
153 /* nonblock_safe_read() because we are used by e.g. shells */
154 if (nonblock_safe_read(fd, p, 1) != 1) { /* EOF/error */
155 if (p == buf) { /* we read nothing */
156 free(buf);
157 return NULL;
158 }
159 break;
160 }
161 if (*p == '\n')
162 break;
163 p++;
164 }
165 *p = '\0';
166 if (maxsz_p)
167 *maxsz_p = p - buf;
168 p++;
169 return xrealloc(buf, p - buf);
170}
171
172ssize_t FAST_FUNC read_close(int fd, void *buf, size_t size) 56ssize_t FAST_FUNC read_close(int fd, void *buf, size_t size)
173{ 57{
174 /*int e;*/ 58 /*int e;*/
@@ -186,252 +70,3 @@ ssize_t FAST_FUNC open_read_close(const char *filename, void *buf, size_t size)
186 return fd; 70 return fd;
187 return read_close(fd, buf, size); 71 return read_close(fd, buf, size);
188} 72}
189
190
191// Read (potentially big) files in one go. File size is estimated
192// by stat. Extra '\0' byte is appended.
193void* FAST_FUNC xmalloc_read(int fd, size_t *maxsz_p)
194{
195 char *buf;
196 size_t size, rd_size, total;
197 size_t to_read;
198 struct stat st;
199
200 to_read = maxsz_p ? *maxsz_p : (INT_MAX - 4095); /* max to read */
201
202 /* Estimate file size */
203 st.st_size = 0; /* in case fstat fails, assume 0 */
204 fstat(fd, &st);
205 /* /proc/N/stat files report st_size 0 */
206 /* In order to make such files readable, we add small const */
207 size = (st.st_size | 0x3ff) + 1;
208
209 total = 0;
210 buf = NULL;
211 while (1) {
212 if (to_read < size)
213 size = to_read;
214 buf = xrealloc(buf, total + size + 1);
215 rd_size = full_read(fd, buf + total, size);
216 if ((ssize_t)rd_size == (ssize_t)(-1)) { /* error */
217 free(buf);
218 return NULL;
219 }
220 total += rd_size;
221 if (rd_size < size) /* EOF */
222 break;
223 if (to_read <= rd_size)
224 break;
225 to_read -= rd_size;
226 /* grow by 1/8, but in [1k..64k] bounds */
227 size = ((total / 8) | 0x3ff) + 1;
228 if (size > 64*1024)
229 size = 64*1024;
230 }
231 buf = xrealloc(buf, total + 1);
232 buf[total] = '\0';
233
234 if (maxsz_p)
235 *maxsz_p = total;
236 return buf;
237}
238
239#ifdef USING_LSEEK_TO_GET_SIZE
240/* Alternatively, file size can be obtained by lseek to the end.
241 * The code is slightly bigger. Retained in case fstat approach
242 * will not work for some weird cases (/proc, block devices, etc).
243 * (NB: lseek also can fail to work for some weird files) */
244
245// Read (potentially big) files in one go. File size is estimated by
246// lseek to end.
247void* FAST_FUNC xmalloc_open_read_close(const char *filename, size_t *maxsz_p)
248{
249 char *buf;
250 size_t size;
251 int fd;
252 off_t len;
253
254 fd = open(filename, O_RDONLY);
255 if (fd < 0)
256 return NULL;
257
258 /* /proc/N/stat files report len 0 here */
259 /* In order to make such files readable, we add small const */
260 size = 0x3ff; /* read only 1k on unseekable files */
261 len = lseek(fd, 0, SEEK_END) | 0x3ff; /* + up to 1k */
262 if (len != (off_t)-1) {
263 xlseek(fd, 0, SEEK_SET);
264 size = maxsz_p ? *maxsz_p : (INT_MAX - 4095);
265 if (len < size)
266 size = len;
267 }
268
269 buf = xmalloc(size + 1);
270 size = read_close(fd, buf, size);
271 if ((ssize_t)size < 0) {
272 free(buf);
273 return NULL;
274 }
275 buf = xrealloc(buf, size + 1);
276 buf[size] = '\0';
277
278 if (maxsz_p)
279 *maxsz_p = size;
280 return buf;
281}
282#endif
283
284// Read (potentially big) files in one go. File size is estimated
285// by stat.
286void* FAST_FUNC xmalloc_open_read_close(const char *filename, size_t *maxsz_p)
287{
288 char *buf;
289 int fd;
290
291 fd = open(filename, O_RDONLY);
292 if (fd < 0)
293 return NULL;
294
295 buf = xmalloc_read(fd, maxsz_p);
296 close(fd);
297 return buf;
298}
299
300void* FAST_FUNC xmalloc_xopen_read_close(const char *filename, size_t *maxsz_p)
301{
302 void *buf = xmalloc_open_read_close(filename, maxsz_p);
303 if (!buf)
304 bb_perror_msg_and_die("can't read '%s'", filename);
305 return buf;
306}
307
308/* Used by e.g. rpm which gives us a fd without filename,
309 * thus we can't guess the format from filename's extension.
310 */
311#if ZIPPED
312void FAST_FUNC setup_unzip_on_fd(int fd /*, int fail_if_not_detected*/)
313{
314 const int fail_if_not_detected = 1;
315 union {
316 uint8_t b[4];
317 uint16_t b16[2];
318 uint32_t b32[1];
319 } magic;
320 int offset = -2;
321# if BB_MMU
322 IF_DESKTOP(long long) int FAST_FUNC (*xformer)(int src_fd, int dst_fd);
323 enum { xformer_prog = 0 };
324# else
325 enum { xformer = 0 };
326 const char *xformer_prog;
327# endif
328
329 /* .gz and .bz2 both have 2-byte signature, and their
330 * unpack_XXX_stream wants this header skipped. */
331 xread(fd, magic.b16, sizeof(magic.b16));
332 if (ENABLE_FEATURE_SEAMLESS_GZ
333 && magic.b16[0] == GZIP_MAGIC
334 ) {
335# if BB_MMU
336 xformer = unpack_gz_stream;
337# else
338 xformer_prog = "gunzip";
339# endif
340 goto found_magic;
341 }
342 if (ENABLE_FEATURE_SEAMLESS_BZ2
343 && magic.b16[0] == BZIP2_MAGIC
344 ) {
345# if BB_MMU
346 xformer = unpack_bz2_stream;
347# else
348 xformer_prog = "bunzip2";
349# endif
350 goto found_magic;
351 }
352 if (ENABLE_FEATURE_SEAMLESS_XZ
353 && magic.b16[0] == XZ_MAGIC1
354 ) {
355 /* .xz signature: 0xfd, '7', 'z', 'X', 'Z', 0x00 */
356 /* More info at: http://tukaani.org/xz/xz-file-format.txt */
357 offset = -6;
358 xread(fd, magic.b32, sizeof(magic.b32));
359 if (magic.b32[0] == XZ_MAGIC2) {
360# if BB_MMU
361 xformer = unpack_xz_stream;
362 /* unpack_xz_stream wants fd at position 0 */
363 xlseek(fd, offset, SEEK_CUR);
364# else
365 xformer_prog = "unxz";
366# endif
367 goto found_magic;
368 }
369 }
370
371 /* No known magic seen */
372 if (fail_if_not_detected)
373 bb_error_msg_and_die("no gzip"
374 IF_FEATURE_SEAMLESS_BZ2("/bzip2")
375 IF_FEATURE_SEAMLESS_XZ("/xz")
376 " magic");
377 xlseek(fd, offset, SEEK_CUR);
378 return;
379
380 found_magic:
381# if !BB_MMU
382 /* NOMMU version of open_transformer execs
383 * an external unzipper that wants
384 * file position at the start of the file */
385 xlseek(fd, offset, SEEK_CUR);
386# endif
387 open_transformer(fd, xformer, xformer_prog);
388}
389#endif /* ZIPPED */
390
391int FAST_FUNC open_zipped(const char *fname)
392{
393#if !ZIPPED
394 return open(fname, O_RDONLY);
395#else
396 char *sfx;
397 int fd;
398
399 fd = open(fname, O_RDONLY);
400 if (fd < 0)
401 return fd;
402
403 sfx = strrchr(fname, '.');
404 if (sfx) {
405 sfx++;
406 if (ENABLE_FEATURE_SEAMLESS_LZMA && strcmp(sfx, "lzma") == 0)
407 /* .lzma has no header/signature, just trust it */
408 open_transformer(fd, unpack_lzma_stream, "unlzma");
409 else
410 if ((ENABLE_FEATURE_SEAMLESS_GZ && strcmp(sfx, "gz") == 0)
411 || (ENABLE_FEATURE_SEAMLESS_BZ2 && strcmp(sfx, "bz2") == 0)
412 || (ENABLE_FEATURE_SEAMLESS_XZ && strcmp(sfx, "xz") == 0)
413 ) {
414 setup_unzip_on_fd(fd /*, fail_if_not_detected: 1*/);
415 }
416 }
417
418 return fd;
419#endif
420}
421
422void* FAST_FUNC xmalloc_open_zipped_read_close(const char *fname, size_t *maxsz_p)
423{
424 int fd;
425 char *image;
426
427 fd = open_zipped(fname);
428 if (fd < 0)
429 return NULL;
430
431 image = xmalloc_read(fd, maxsz_p);
432 if (!image)
433 bb_perror_msg("read error from '%s'", fname);
434 close(fd);
435
436 return image;
437}
diff --git a/libbb/read_printf.c b/libbb/read_printf.c
new file mode 100644
index 000000000..53f528f5a
--- /dev/null
+++ b/libbb/read_printf.c
@@ -0,0 +1,374 @@
1/* vi: set sw=4 ts=4: */
2/*
3 * Utility routines.
4 *
5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
8 */
9#include "libbb.h"
10
11#define ZIPPED (ENABLE_FEATURE_SEAMLESS_LZMA \
12 || ENABLE_FEATURE_SEAMLESS_BZ2 \
13 || ENABLE_FEATURE_SEAMLESS_GZ \
14 /* || ENABLE_FEATURE_SEAMLESS_Z */ \
15)
16
17#if ZIPPED
18# include "unarchive.h"
19#endif
20
21
22/* Suppose that you are a shell. You start child processes.
23 * They work and eventually exit. You want to get user input.
24 * You read stdin. But what happens if last child switched
25 * its stdin into O_NONBLOCK mode?
26 *
27 * *** SURPRISE! It will affect the parent too! ***
28 * *** BIG SURPRISE! It stays even after child exits! ***
29 *
30 * This is a design bug in UNIX API.
31 * fcntl(0, F_SETFL, fcntl(0, F_GETFL) | O_NONBLOCK);
32 * will set nonblocking mode not only on _your_ stdin, but
33 * also on stdin of your parent, etc.
34 *
35 * In general,
36 * fd2 = dup(fd1);
37 * fcntl(fd2, F_SETFL, fcntl(fd2, F_GETFL) | O_NONBLOCK);
38 * sets both fd1 and fd2 to O_NONBLOCK. This includes cases
39 * where duping is done implicitly by fork() etc.
40 *
41 * We need
42 * fcntl(fd2, F_SETFD, fcntl(fd2, F_GETFD) | O_NONBLOCK);
43 * (note SETFD, not SETFL!) but such thing doesn't exist.
44 *
45 * Alternatively, we need nonblocking_read(fd, ...) which doesn't
46 * require O_NONBLOCK dance at all. Actually, it exists:
47 * n = recv(fd, buf, len, MSG_DONTWAIT);
48 * "MSG_DONTWAIT:
49 * Enables non-blocking operation; if the operation
50 * would block, EAGAIN is returned."
51 * but recv() works only for sockets!
52 *
53 * So far I don't see any good solution, I can only propose
54 * that affected readers should be careful and use this routine,
55 * which detects EAGAIN and uses poll() to wait on the fd.
56 * Thankfully, poll() doesn't care about O_NONBLOCK flag.
57 */
58ssize_t FAST_FUNC nonblock_safe_read(int fd, void *buf, size_t count)
59{
60 struct pollfd pfd[1];
61 ssize_t n;
62
63 while (1) {
64 n = safe_read(fd, buf, count);
65 if (n >= 0 || errno != EAGAIN)
66 return n;
67 /* fd is in O_NONBLOCK mode. Wait using poll and repeat */
68 pfd[0].fd = fd;
69 pfd[0].events = POLLIN;
70 safe_poll(pfd, 1, -1); /* note: this pulls in printf */
71 }
72}
73
74// Reads one line a-la fgets (but doesn't save terminating '\n').
75// Reads byte-by-byte. Useful when it is important to not read ahead.
76// Bytes are appended to pfx (which must be malloced, or NULL).
77char* FAST_FUNC xmalloc_reads(int fd, char *buf, size_t *maxsz_p)
78{
79 char *p;
80 size_t sz = buf ? strlen(buf) : 0;
81 size_t maxsz = maxsz_p ? *maxsz_p : (INT_MAX - 4095);
82
83 goto jump_in;
84 while (sz < maxsz) {
85 if ((size_t)(p - buf) == sz) {
86 jump_in:
87 buf = xrealloc(buf, sz + 128);
88 p = buf + sz;
89 sz += 128;
90 }
91 /* nonblock_safe_read() because we are used by e.g. shells */
92 if (nonblock_safe_read(fd, p, 1) != 1) { /* EOF/error */
93 if (p == buf) { /* we read nothing */
94 free(buf);
95 return NULL;
96 }
97 break;
98 }
99 if (*p == '\n')
100 break;
101 p++;
102 }
103 *p = '\0';
104 if (maxsz_p)
105 *maxsz_p = p - buf;
106 p++;
107 return xrealloc(buf, p - buf);
108}
109
110// Read (potentially big) files in one go. File size is estimated
111// by stat. Extra '\0' byte is appended.
112void* FAST_FUNC xmalloc_read(int fd, size_t *maxsz_p)
113{
114 char *buf;
115 size_t size, rd_size, total;
116 size_t to_read;
117 struct stat st;
118
119 to_read = maxsz_p ? *maxsz_p : (INT_MAX - 4095); /* max to read */
120
121 /* Estimate file size */
122 st.st_size = 0; /* in case fstat fails, assume 0 */
123 fstat(fd, &st);
124 /* /proc/N/stat files report st_size 0 */
125 /* In order to make such files readable, we add small const */
126 size = (st.st_size | 0x3ff) + 1;
127
128 total = 0;
129 buf = NULL;
130 while (1) {
131 if (to_read < size)
132 size = to_read;
133 buf = xrealloc(buf, total + size + 1);
134 rd_size = full_read(fd, buf + total, size);
135 if ((ssize_t)rd_size == (ssize_t)(-1)) { /* error */
136 free(buf);
137 return NULL;
138 }
139 total += rd_size;
140 if (rd_size < size) /* EOF */
141 break;
142 if (to_read <= rd_size)
143 break;
144 to_read -= rd_size;
145 /* grow by 1/8, but in [1k..64k] bounds */
146 size = ((total / 8) | 0x3ff) + 1;
147 if (size > 64*1024)
148 size = 64*1024;
149 }
150 buf = xrealloc(buf, total + 1);
151 buf[total] = '\0';
152
153 if (maxsz_p)
154 *maxsz_p = total;
155 return buf;
156}
157
158#ifdef USING_LSEEK_TO_GET_SIZE
159/* Alternatively, file size can be obtained by lseek to the end.
160 * The code is slightly bigger. Retained in case fstat approach
161 * will not work for some weird cases (/proc, block devices, etc).
162 * (NB: lseek also can fail to work for some weird files) */
163
164// Read (potentially big) files in one go. File size is estimated by
165// lseek to end.
166void* FAST_FUNC xmalloc_open_read_close(const char *filename, size_t *maxsz_p)
167{
168 char *buf;
169 size_t size;
170 int fd;
171 off_t len;
172
173 fd = open(filename, O_RDONLY);
174 if (fd < 0)
175 return NULL;
176
177 /* /proc/N/stat files report len 0 here */
178 /* In order to make such files readable, we add small const */
179 size = 0x3ff; /* read only 1k on unseekable files */
180 len = lseek(fd, 0, SEEK_END) | 0x3ff; /* + up to 1k */
181 if (len != (off_t)-1) {
182 xlseek(fd, 0, SEEK_SET);
183 size = maxsz_p ? *maxsz_p : (INT_MAX - 4095);
184 if (len < size)
185 size = len;
186 }
187
188 buf = xmalloc(size + 1);
189 size = read_close(fd, buf, size);
190 if ((ssize_t)size < 0) {
191 free(buf);
192 return NULL;
193 }
194 buf = xrealloc(buf, size + 1);
195 buf[size] = '\0';
196
197 if (maxsz_p)
198 *maxsz_p = size;
199 return buf;
200}
201#endif
202
203// Read (potentially big) files in one go. File size is estimated
204// by stat.
205void* FAST_FUNC xmalloc_open_read_close(const char *filename, size_t *maxsz_p)
206{
207 char *buf;
208 int fd;
209
210 fd = open(filename, O_RDONLY);
211 if (fd < 0)
212 return NULL;
213
214 buf = xmalloc_read(fd, maxsz_p);
215 close(fd);
216 return buf;
217}
218
219/* Die with an error message if we can't read the entire buffer. */
220void FAST_FUNC xread(int fd, void *buf, size_t count)
221{
222 if (count) {
223 ssize_t size = full_read(fd, buf, count);
224 if ((size_t)size != count)
225 bb_error_msg_and_die("short read");
226 }
227}
228
229/* Die with an error message if we can't read one character. */
230unsigned char FAST_FUNC xread_char(int fd)
231{
232 char tmp;
233 xread(fd, &tmp, 1);
234 return tmp;
235}
236
237void* FAST_FUNC xmalloc_xopen_read_close(const char *filename, size_t *maxsz_p)
238{
239 void *buf = xmalloc_open_read_close(filename, maxsz_p);
240 if (!buf)
241 bb_perror_msg_and_die("can't read '%s'", filename);
242 return buf;
243}
244
245/* Used by e.g. rpm which gives us a fd without filename,
246 * thus we can't guess the format from filename's extension.
247 */
248#if ZIPPED
249void FAST_FUNC setup_unzip_on_fd(int fd /*, int fail_if_not_detected*/)
250{
251 const int fail_if_not_detected = 1;
252 union {
253 uint8_t b[4];
254 uint16_t b16[2];
255 uint32_t b32[1];
256 } magic;
257 int offset = -2;
258# if BB_MMU
259 IF_DESKTOP(long long) int FAST_FUNC (*xformer)(int src_fd, int dst_fd);
260 enum { xformer_prog = 0 };
261# else
262 enum { xformer = 0 };
263 const char *xformer_prog;
264# endif
265
266 /* .gz and .bz2 both have 2-byte signature, and their
267 * unpack_XXX_stream wants this header skipped. */
268 xread(fd, magic.b16, sizeof(magic.b16));
269 if (ENABLE_FEATURE_SEAMLESS_GZ
270 && magic.b16[0] == GZIP_MAGIC
271 ) {
272# if BB_MMU
273 xformer = unpack_gz_stream;
274# else
275 xformer_prog = "gunzip";
276# endif
277 goto found_magic;
278 }
279 if (ENABLE_FEATURE_SEAMLESS_BZ2
280 && magic.b16[0] == BZIP2_MAGIC
281 ) {
282# if BB_MMU
283 xformer = unpack_bz2_stream;
284# else
285 xformer_prog = "bunzip2";
286# endif
287 goto found_magic;
288 }
289 if (ENABLE_FEATURE_SEAMLESS_XZ
290 && magic.b16[0] == XZ_MAGIC1
291 ) {
292 /* .xz signature: 0xfd, '7', 'z', 'X', 'Z', 0x00 */
293 /* More info at: http://tukaani.org/xz/xz-file-format.txt */
294 offset = -6;
295 xread(fd, magic.b32, sizeof(magic.b32));
296 if (magic.b32[0] == XZ_MAGIC2) {
297# if BB_MMU
298 xformer = unpack_xz_stream;
299 /* unpack_xz_stream wants fd at position 0 */
300 xlseek(fd, offset, SEEK_CUR);
301# else
302 xformer_prog = "unxz";
303# endif
304 goto found_magic;
305 }
306 }
307
308 /* No known magic seen */
309 if (fail_if_not_detected)
310 bb_error_msg_and_die("no gzip"
311 IF_FEATURE_SEAMLESS_BZ2("/bzip2")
312 IF_FEATURE_SEAMLESS_XZ("/xz")
313 " magic");
314 xlseek(fd, offset, SEEK_CUR);
315 return;
316
317 found_magic:
318# if !BB_MMU
319 /* NOMMU version of open_transformer execs
320 * an external unzipper that wants
321 * file position at the start of the file */
322 xlseek(fd, offset, SEEK_CUR);
323# endif
324 open_transformer(fd, xformer, xformer_prog);
325}
326#endif /* ZIPPED */
327
328int FAST_FUNC open_zipped(const char *fname)
329{
330#if !ZIPPED
331 return open(fname, O_RDONLY);
332#else
333 char *sfx;
334 int fd;
335
336 fd = open(fname, O_RDONLY);
337 if (fd < 0)
338 return fd;
339
340 sfx = strrchr(fname, '.');
341 if (sfx) {
342 sfx++;
343 if (ENABLE_FEATURE_SEAMLESS_LZMA && strcmp(sfx, "lzma") == 0)
344 /* .lzma has no header/signature, just trust it */
345 open_transformer(fd, unpack_lzma_stream, "unlzma");
346 else
347 if ((ENABLE_FEATURE_SEAMLESS_GZ && strcmp(sfx, "gz") == 0)
348 || (ENABLE_FEATURE_SEAMLESS_BZ2 && strcmp(sfx, "bz2") == 0)
349 || (ENABLE_FEATURE_SEAMLESS_XZ && strcmp(sfx, "xz") == 0)
350 ) {
351 setup_unzip_on_fd(fd /*, fail_if_not_detected: 1*/);
352 }
353 }
354
355 return fd;
356#endif
357}
358
359void* FAST_FUNC xmalloc_open_zipped_read_close(const char *fname, size_t *maxsz_p)
360{
361 int fd;
362 char *image;
363
364 fd = open_zipped(fname);
365 if (fd < 0)
366 return NULL;
367
368 image = xmalloc_read(fd, maxsz_p);
369 if (!image)
370 bb_perror_msg("read error from '%s'", fname);
371 close(fd);
372
373 return image;
374}
diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c
index d93dd2af9..6200fc600 100644
--- a/libbb/xfuncs.c
+++ b/libbb/xfuncs.c
@@ -199,15 +199,9 @@ off_t FAST_FUNC fdlength(int fd)
199} 199}
200#endif 200#endif
201 201
202char* FAST_FUNC xmalloc_ttyname(int fd) 202int FAST_FUNC bb_putchar_stderr(char ch)
203{ 203{
204 char *buf = xzalloc(128); 204 return write(STDERR_FILENO, &ch, 1);
205 int r = ttyname_r(fd, buf, 127);
206 if (r) {
207 free(buf);
208 buf = NULL;
209 }
210 return buf;
211} 205}
212 206
213static int wh_helper(int value, int def_val, const char *env_name, int *err) 207static 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)
250{ 244{
251 return tcsetattr(STDIN_FILENO, TCSANOW, tp); 245 return tcsetattr(STDIN_FILENO, TCSANOW, tp);
252} 246}
253
254void FAST_FUNC generate_uuid(uint8_t *buf)
255{
256 /* http://www.ietf.org/rfc/rfc4122.txt
257 * 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
258 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
259 * | time_low |
260 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
261 * | time_mid | time_hi_and_version |
262 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
263 * |clk_seq_and_variant | node (0-1) |
264 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
265 * | node (2-5) |
266 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
267 * IOW, uuid has this layout:
268 * uint32_t time_low (big endian)
269 * uint16_t time_mid (big endian)
270 * uint16_t time_hi_and_version (big endian)
271 * version is a 4-bit field:
272 * 1 Time-based
273 * 2 DCE Security, with embedded POSIX UIDs
274 * 3 Name-based (MD5)
275 * 4 Randomly generated
276 * 5 Name-based (SHA-1)
277 * uint16_t clk_seq_and_variant (big endian)
278 * variant is a 3-bit field:
279 * 0xx Reserved, NCS backward compatibility
280 * 10x The variant specified in rfc4122
281 * 110 Reserved, Microsoft backward compatibility
282 * 111 Reserved for future definition
283 * uint8_t node[6]
284 *
285 * For version 4, these bits are set/cleared:
286 * time_hi_and_version & 0x0fff | 0x4000
287 * clk_seq_and_variant & 0x3fff | 0x8000
288 */
289 pid_t pid;
290 int i;
291
292 i = open("/dev/urandom", O_RDONLY);
293 if (i >= 0) {
294 read(i, buf, 16);
295 close(i);
296 }
297 /* Paranoia. /dev/urandom may be missing.
298 * rand() is guaranteed to generate at least [0, 2^15) range,
299 * but lowest bits in some libc are not so "random". */
300 srand(monotonic_us());
301 pid = getpid();
302 while (1) {
303 for (i = 0; i < 16; i++)
304 buf[i] ^= rand() >> 5;
305 if (pid == 0)
306 break;
307 srand(pid);
308 pid = 0;
309 }
310
311 /* version = 4 */
312 buf[4 + 2 ] = (buf[4 + 2 ] & 0x0f) | 0x40;
313 /* variant = 10x */
314 buf[4 + 2 + 2] = (buf[4 + 2 + 2] & 0x3f) | 0x80;
315}
diff --git a/libbb/xfuncs_printf.c b/libbb/xfuncs_printf.c
index 7207ec58a..03aeaaa38 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)
510 return ret; 510 return ret;
511} 511}
512#endif 512#endif
513
514char* FAST_FUNC xmalloc_ttyname(int fd)
515{
516 char *buf = xzalloc(128);
517 int r = ttyname_r(fd, buf, 127);
518 if (r) {
519 free(buf);
520 buf = NULL;
521 }
522 return buf;
523}
524
525void FAST_FUNC generate_uuid(uint8_t *buf)
526{
527 /* http://www.ietf.org/rfc/rfc4122.txt
528 * 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
529 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
530 * | time_low |
531 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
532 * | time_mid | time_hi_and_version |
533 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
534 * |clk_seq_and_variant | node (0-1) |
535 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
536 * | node (2-5) |
537 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
538 * IOW, uuid has this layout:
539 * uint32_t time_low (big endian)
540 * uint16_t time_mid (big endian)
541 * uint16_t time_hi_and_version (big endian)
542 * version is a 4-bit field:
543 * 1 Time-based
544 * 2 DCE Security, with embedded POSIX UIDs
545 * 3 Name-based (MD5)
546 * 4 Randomly generated
547 * 5 Name-based (SHA-1)
548 * uint16_t clk_seq_and_variant (big endian)
549 * variant is a 3-bit field:
550 * 0xx Reserved, NCS backward compatibility
551 * 10x The variant specified in rfc4122
552 * 110 Reserved, Microsoft backward compatibility
553 * 111 Reserved for future definition
554 * uint8_t node[6]
555 *
556 * For version 4, these bits are set/cleared:
557 * time_hi_and_version & 0x0fff | 0x4000
558 * clk_seq_and_variant & 0x3fff | 0x8000
559 */
560 pid_t pid;
561 int i;
562
563 i = open("/dev/urandom", O_RDONLY);
564 if (i >= 0) {
565 read(i, buf, 16);
566 close(i);
567 }
568 /* Paranoia. /dev/urandom may be missing.
569 * rand() is guaranteed to generate at least [0, 2^15) range,
570 * but lowest bits in some libc are not so "random". */
571 srand(monotonic_us()); /* pulls in printf */
572 pid = getpid();
573 while (1) {
574 for (i = 0; i < 16; i++)
575 buf[i] ^= rand() >> 5;
576 if (pid == 0)
577 break;
578 srand(pid);
579 pid = 0;
580 }
581
582 /* version = 4 */
583 buf[4 + 2 ] = (buf[4 + 2 ] & 0x0f) | 0x40;
584 /* variant = 10x */
585 buf[4 + 2 + 2] = (buf[4 + 2 + 2] & 0x3f) | 0x80;
586}
diff --git a/miscutils/crond.c b/miscutils/crond.c
index e3714df19..f51159233 100644
--- a/miscutils/crond.c
+++ b/miscutils/crond.c
@@ -420,7 +420,7 @@ static void ParseField(char *user, char *ary, int modvalue, int off,
420 int i; 420 int i;
421 for (i = 0; i < modvalue; ++i) 421 for (i = 0; i < modvalue; ++i)
422 fprintf(stderr, "%d", (unsigned char)ary[i]); 422 fprintf(stderr, "%d", (unsigned char)ary[i]);
423 fputc('\n', stderr); 423 bb_putchar_stderr('\n');
424 } 424 }
425} 425}
426 426
diff --git a/networking/tftp.c b/networking/tftp.c
index d76f7ae5b..ab4e25967 100644
--- a/networking/tftp.c
+++ b/networking/tftp.c
@@ -119,7 +119,7 @@ static void progress_meter(int flag)
119 if (flag == 0) { 119 if (flag == 0) {
120 /* last call to progress_meter */ 120 /* last call to progress_meter */
121 alarm(0); 121 alarm(0);
122 fputc('\n', stderr); 122 bb_putchar_stderr('\n');
123 } else { 123 } else {
124 if (flag == -1) { /* first call to progress_meter */ 124 if (flag == -1) { /* first call to progress_meter */
125 signal_SA_RESTART_empty_mask(SIGALRM, progress_meter); 125 signal_SA_RESTART_empty_mask(SIGALRM, progress_meter);
diff --git a/networking/wget.c b/networking/wget.c
index 97f4a8f6e..f55b68a38 100644
--- a/networking/wget.c
+++ b/networking/wget.c
@@ -55,7 +55,7 @@ static void progress_meter(int flag)
55 if (flag == 0) { 55 if (flag == 0) {
56 /* last call to progress_meter */ 56 /* last call to progress_meter */
57 alarm(0); 57 alarm(0);
58 fputc('\n', stderr); 58 bb_putchar_stderr('\n');
59 G.transferred = 0; 59 G.transferred = 0;
60 } else { 60 } else {
61 if (flag == -1) { /* first call to progress_meter */ 61 if (flag == -1) { /* first call to progress_meter */