bbconfig: make it independent from printf functions
function old new delta full_write2_str - 25 +25 full_write1_str - 25 +25 clear_main 21 20 -1 telnet_main 1488 1477 -11 getty_main 1932 1918 -14 full_write22_str 25 - -25 ------------------------------------------------------------------------------ (add/remove: 2/1 grow/shrink: 0/3 up/down: 50/-51) Total: -1 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
121fb9506b
commit
729ecb87bf
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# Automatically generated make config: don't edit
|
# Automatically generated make config: don't edit
|
||||||
# Busybox version: 1.17.0.git
|
# Busybox version: 1.17.0.git
|
||||||
# Sun Jun 6 21:38:58 2010
|
# Mon Jun 7 13:37:55 2010
|
||||||
#
|
#
|
||||||
CONFIG_HAVE_DOT_CONFIG=y
|
CONFIG_HAVE_DOT_CONFIG=y
|
||||||
|
|
||||||
@ -579,7 +579,7 @@ CONFIG_VOLUMEID=y
|
|||||||
# Miscellaneous Utilities
|
# Miscellaneous Utilities
|
||||||
#
|
#
|
||||||
# CONFIG_ADJTIMEX is not set
|
# CONFIG_ADJTIMEX is not set
|
||||||
# CONFIG_BBCONFIG is not set
|
CONFIG_BBCONFIG=y
|
||||||
# CONFIG_BEEP is not set
|
# CONFIG_BEEP is not set
|
||||||
CONFIG_FEATURE_BEEP_FREQ=0
|
CONFIG_FEATURE_BEEP_FREQ=0
|
||||||
CONFIG_FEATURE_BEEP_LENGTH_MS=0
|
CONFIG_FEATURE_BEEP_LENGTH_MS=0
|
||||||
@ -872,12 +872,6 @@ CONFIG_SV_DEFAULT_SERVICE_DIR=""
|
|||||||
#
|
#
|
||||||
# Shells
|
# 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 is not set
|
||||||
# CONFIG_ASH_BASH_COMPAT is not set
|
# CONFIG_ASH_BASH_COMPAT is not set
|
||||||
# CONFIG_ASH_JOB_CONTROL is not set
|
# CONFIG_ASH_JOB_CONTROL is not set
|
||||||
@ -904,6 +898,12 @@ CONFIG_FEATURE_BASH_IS_NONE=y
|
|||||||
# CONFIG_HUSH_LOCAL is not set
|
# CONFIG_HUSH_LOCAL is not set
|
||||||
# CONFIG_HUSH_EXPORT_N is not set
|
# CONFIG_HUSH_EXPORT_N is not set
|
||||||
# CONFIG_HUSH_RANDOM_SUPPORT is not set
|
# CONFIG_HUSH_RANDOM_SUPPORT is not set
|
||||||
|
# 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_LASH is not set
|
# CONFIG_LASH is not set
|
||||||
# CONFIG_MSH is not set
|
# CONFIG_MSH is not set
|
||||||
# CONFIG_SH_MATH_SUPPORT is not set
|
# CONFIG_SH_MATH_SUPPORT is not set
|
||||||
|
@ -5,16 +5,12 @@
|
|||||||
* Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
|
* Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
|
||||||
*
|
*
|
||||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* no options, no getopt */
|
|
||||||
|
|
||||||
#include "libbb.h"
|
#include "libbb.h"
|
||||||
|
|
||||||
int clear_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
int clear_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||||
int clear_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
|
int clear_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
|
||||||
{
|
{
|
||||||
/* home; clear to the end of screen */
|
/* home; clear to the end of screen */
|
||||||
return printf("\033[H""\033[J") != 6;
|
return full_write1_str("\033[H""\033[J") != 6;
|
||||||
}
|
}
|
||||||
|
@ -5,13 +5,8 @@
|
|||||||
* Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
|
* Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
|
||||||
*
|
*
|
||||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* BB_AUDIT SUSv3 compliant */
|
|
||||||
/* http://www.opengroup.org/onlinepubs/007904975/utilities/basename.html */
|
|
||||||
|
|
||||||
|
|
||||||
/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
|
/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
|
||||||
*
|
*
|
||||||
* Changes:
|
* Changes:
|
||||||
@ -20,6 +15,9 @@
|
|||||||
* 3) Save some space by using strcmp(). Calling strncmp() here was silly.
|
* 3) Save some space by using strcmp(). Calling strncmp() here was silly.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* BB_AUDIT SUSv3 compliant */
|
||||||
|
/* http://www.opengroup.org/onlinepubs/007904975/utilities/basename.html */
|
||||||
|
|
||||||
//kbuild:lib-$(CONFIG_BASENAME) += basename.o
|
//kbuild:lib-$(CONFIG_BASENAME) += basename.o
|
||||||
|
|
||||||
//config:config BASENAME
|
//config:config BASENAME
|
||||||
@ -40,7 +38,7 @@ int basename_main(int argc, char **argv)
|
|||||||
size_t m, n;
|
size_t m, n;
|
||||||
char *s;
|
char *s;
|
||||||
|
|
||||||
if (((unsigned int)(argc-2)) >= 2) {
|
if ((unsigned)(argc-2) >= 2) {
|
||||||
bb_show_usage();
|
bb_show_usage();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,7 +48,7 @@ int basename_main(int argc, char **argv)
|
|||||||
m = strlen(s);
|
m = strlen(s);
|
||||||
if (*++argv) {
|
if (*++argv) {
|
||||||
n = strlen(*argv);
|
n = strlen(*argv);
|
||||||
if ((m > n) && ((strcmp)(s+m-n, *argv) == 0)) {
|
if ((m > n) && (strcmp(s+m-n, *argv) == 0)) {
|
||||||
m -= n;
|
m -= n;
|
||||||
/*s[m] = '\0'; - redundant */
|
/*s[m] = '\0'; - redundant */
|
||||||
}
|
}
|
||||||
|
@ -674,6 +674,8 @@ extern ssize_t safe_write(int fd, const void *buf, size_t count) FAST_FUNC;
|
|||||||
extern ssize_t full_write(int fd, const void *buf, size_t count) FAST_FUNC;
|
extern ssize_t full_write(int fd, const void *buf, size_t count) FAST_FUNC;
|
||||||
extern void xwrite(int fd, const void *buf, size_t count) FAST_FUNC;
|
extern void xwrite(int fd, const void *buf, size_t count) FAST_FUNC;
|
||||||
extern void xwrite_str(int fd, const char *str) FAST_FUNC;
|
extern void xwrite_str(int fd, const char *str) FAST_FUNC;
|
||||||
|
extern ssize_t full_write1_str(const char *str) FAST_FUNC;
|
||||||
|
extern ssize_t full_write2_str(const char *str) FAST_FUNC;
|
||||||
extern void xopen_xwrite_close(const char* file, const char *str) FAST_FUNC;
|
extern void xopen_xwrite_close(const char* file, const char *str) FAST_FUNC;
|
||||||
|
|
||||||
/* Close fd, but check for failures (some types of write errors) */
|
/* Close fd, but check for failures (some types of write errors) */
|
||||||
|
@ -98,13 +98,6 @@ static const char *unpack_usage_messages(void)
|
|||||||
#endif /* FEATURE_COMPRESS_USAGE */
|
#endif /* FEATURE_COMPRESS_USAGE */
|
||||||
|
|
||||||
|
|
||||||
static void full_write2_str(const char *str)
|
|
||||||
{
|
|
||||||
// This uses stdio:
|
|
||||||
//xwrite_str(STDERR_FILENO, str);
|
|
||||||
write(STDERR_FILENO, str, strlen(str));
|
|
||||||
}
|
|
||||||
|
|
||||||
void FAST_FUNC bb_show_usage(void)
|
void FAST_FUNC bb_show_usage(void)
|
||||||
{
|
{
|
||||||
if (ENABLE_SHOW_USAGE) {
|
if (ENABLE_SHOW_USAGE) {
|
||||||
|
@ -204,6 +204,16 @@ int FAST_FUNC bb_putchar_stderr(char ch)
|
|||||||
return write(STDERR_FILENO, &ch, 1);
|
return write(STDERR_FILENO, &ch, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ssize_t FAST_FUNC full_write1_str(const char *str)
|
||||||
|
{
|
||||||
|
return full_write(STDOUT_FILENO, str, strlen(str));
|
||||||
|
}
|
||||||
|
|
||||||
|
ssize_t FAST_FUNC full_write2_str(const char *str)
|
||||||
|
{
|
||||||
|
return full_write(STDERR_FILENO, str, strlen(str));
|
||||||
|
}
|
||||||
|
|
||||||
static int wh_helper(int value, int def_val, const char *env_name, int *err)
|
static int wh_helper(int value, int def_val, const char *env_name, int *err)
|
||||||
{
|
{
|
||||||
if (value == 0) {
|
if (value == 0) {
|
||||||
|
@ -673,8 +673,7 @@ int getty_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
/* Write the modem init string and DON'T flush the buffers */
|
/* Write the modem init string and DON'T flush the buffers */
|
||||||
if (options.flags & F_INITSTRING) {
|
if (options.flags & F_INITSTRING) {
|
||||||
debug("writing init string\n");
|
debug("writing init string\n");
|
||||||
/* todo: use xwrite_str? */
|
full_write1_str(options.initstring);
|
||||||
full_write(STDOUT_FILENO, options.initstring, strlen(options.initstring));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Optionally detect the baud rate from the modem status message */
|
/* Optionally detect the baud rate from the modem status message */
|
||||||
|
@ -7,6 +7,6 @@
|
|||||||
int bbconfig_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
int bbconfig_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
|
||||||
int bbconfig_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
|
int bbconfig_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
|
||||||
{
|
{
|
||||||
printf(bbconfig_config);
|
full_write1_str(bbconfig_config);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -418,7 +418,7 @@ static void to_echo(void)
|
|||||||
put_iac2(DONT, TELOPT_ECHO);
|
put_iac2(DONT, TELOPT_ECHO);
|
||||||
|
|
||||||
setConMode();
|
setConMode();
|
||||||
write_str(1, "\r\n"); /* sudden modec */
|
full_write1_str("\r\n"); /* sudden modec */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void to_sga(void)
|
static void to_sga(void)
|
||||||
@ -637,7 +637,7 @@ int telnet_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
{
|
{
|
||||||
len = safe_read(netfd, G.buf, DATABUFSIZE);
|
len = safe_read(netfd, G.buf, DATABUFSIZE);
|
||||||
if (len <= 0) {
|
if (len <= 0) {
|
||||||
write_str(1, "Connection closed by foreign host\r\n");
|
full_write1_str("Connection closed by foreign host\r\n");
|
||||||
doexit(EXIT_FAILURE);
|
doexit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
TRACE(0, ("Read netfd (%d): %d\n", netfd, len));
|
TRACE(0, ("Read netfd (%d): %d\n", netfd, len));
|
||||||
|
@ -42,9 +42,8 @@ echo "\
|
|||||||
*
|
*
|
||||||
* This file is generated automatically by scripts/mkconfigs.
|
* This file is generated automatically by scripts/mkconfigs.
|
||||||
* Do not edit.
|
* Do not edit.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
static const char *const bbconfig_config ="
|
static const char bbconfig_config[] ="
|
||||||
|
|
||||||
sed 's/\"/\\\"/g' $config | grep "^#\? \?CONFIG_" | awk '{print "\"" $0 "\\n\"";}'
|
sed 's/\"/\\\"/g' $config | grep "^#\? \?CONFIG_" | awk '{print "\"" $0 "\\n\"";}'
|
||||||
|
|
||||||
|
@ -7103,7 +7103,7 @@ int hush_main(int argc, char **argv)
|
|||||||
break;
|
break;
|
||||||
#if !BB_MMU
|
#if !BB_MMU
|
||||||
case '<': /* "big heredoc" support */
|
case '<': /* "big heredoc" support */
|
||||||
full_write(STDOUT_FILENO, optarg, strlen(optarg));
|
full_write1_str(optarg);
|
||||||
_exit(0);
|
_exit(0);
|
||||||
case '$': {
|
case '$': {
|
||||||
unsigned long long empty_trap_mask;
|
unsigned long long empty_trap_mask;
|
||||||
|
Loading…
Reference in New Issue
Block a user