ash: support platforms that don't have '%m' printf specifier
The '%m' conversion specifier prints an error message based on the current value of 'errno'. It is available in the GNU C library, Cygwin (since 2012), uClibc and musl. It is not available in various BSDs, BSD-derived systems (MacOS, Android) or Microsoft Windows. Use a symbol defined in platform.h to control how error messages can be formatted to display the 'errno' message. On platforms that support it use '%m'; on other platforms use '%s' and strerror(). On platforms that have '%m' there is essentially no change in the size of the binary. Otherwise: function old new delta redirect 1287 1310 +23 xtcsetpgrp 27 44 +17 dup2_or_raise 34 51 +17 setinputfile 267 275 +8 .rodata 163379 163371 -8 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 4/1 up/down: 65/-8) Total: 57 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
619d9b5e68
commit
be366e5afa
2 changed files with 21 additions and 5 deletions
|
@ -406,6 +406,7 @@ typedef unsigned smalluint;
|
|||
#define HAVE_MNTENT_H 1
|
||||
#define HAVE_NET_ETHERNET_H 1
|
||||
#define HAVE_SYS_STATFS_H 1
|
||||
#define HAVE_PRINTF_PERCENTM 1
|
||||
|
||||
#if defined(__UCLIBC__)
|
||||
# if UCLIBC_VERSION < KERNEL_VERSION(0, 9, 32)
|
||||
|
@ -461,6 +462,7 @@ typedef unsigned smalluint;
|
|||
# undef HAVE_DPRINTF
|
||||
# undef HAVE_UNLOCKED_STDIO
|
||||
# undef HAVE_UNLOCKED_LINE_OPS
|
||||
# undef HAVE_PRINTF_PERCENTM
|
||||
#endif
|
||||
|
||||
#if defined(__dietlibc__)
|
||||
|
@ -483,6 +485,7 @@ typedef unsigned smalluint;
|
|||
# undef HAVE_STRVERSCMP
|
||||
# undef HAVE_XTABS
|
||||
# undef HAVE_UNLOCKED_LINE_OPS
|
||||
# undef HAVE_PRINTF_PERCENTM
|
||||
# include <osreldate.h>
|
||||
# if __FreeBSD_version < 1000029
|
||||
# undef HAVE_STRCHRNUL /* FreeBSD added strchrnul() between 1000028 and 1000029 */
|
||||
|
@ -517,6 +520,7 @@ typedef unsigned smalluint;
|
|||
# undef HAVE_STRVERSCMP
|
||||
# undef HAVE_UNLOCKED_LINE_OPS
|
||||
# undef HAVE_NET_ETHERNET_H
|
||||
# undef HAVE_PRINTF_PERCENTM
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue