| Commit message (Collapse) | Author | Age |
|
|
|
|
|
|
|
| |
This patch adds the format string characters a, A and F to the
supported set of the built-in printf command. They're already
supported by the underlying printf function.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On 12/03/2012 05:59 PM, Harald van Dijk wrote:
> On 12/03/2012 08:42 AM, Roy wrote:
>> MSYS libc does not support %j[dXx] format, only %ll[dXx] is supported.
>>
>> diff --git a/src/bltin/printf.c b/src/bltin/printf.c
>> index 893295c..12ce660 100644
>> --- a/src/bltin/printf.c
>> +++ b/src/bltin/printf.c
>> @@ -319,11 +319,12 @@ mklong(const char *str, const char *ch)
>> char *copy;
>> size_t len;
>>
>> - len = ch - str + 3;
>> + len = ch - str + 4;
>> STARTSTACKSTR(copy);
>> copy = makestrspace(len, copy);
>> - memcpy(copy, str, len - 3);
>> - copy[len - 3] = 'j';
>> + memcpy(copy, str, len - 4);
>> + copy[len - 4] = 'l';
>> + copy[len - 3] = 'l';
>> copy[len - 2] = *ch;
>> copy[len - 1] = '\0';
>> return (copy);
>
> The calling code uses the result to print intmax_t and uintmax_t values.
> Printing intmax_t values with %lld is wrong, this will only work if
> intmax_t is really a typedef for long long (which may be true on your
> system, but is not required by the standard).
>
> The other patch that Jonathan linked to should work just fine.
Here's a slightly tweaked version of that patch. Regardless of whether
PRIdMAX is defined as "jd" or as "lld", the use of memcpy here, first
copying "jd"/"lld" and the null byte, and only changing the 'd' after
that, surprisingly results in slightly shorter object code than the
original byte-by-byte approach, even though memcpy is fully inlined.
Perhaps that could be a reason for applying this, even if the original
reason for it, making the code work on not-quite-conforming systems,
isn't good enough to get it in dash.
Tested with normal glibc, and with glibc hacked to not provide PRIdMAX.
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
|
|
|
|
| |
The patch to make outc into an inline function created an unnecessary
promotion in echocmd due to its use of char vs. the int used by outc.
This patch changes echocmd to use int instead.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On Thu, Nov 03, 2005 at 07:16:53PM +0100, Mike Hommey wrote:
> Here is a simple test case:
>
> #!/bin/dash
> echo test\\ test
> echo '\c'
> echo test\\ test
>
> it outputs:
> test\ test
> test\
>
> This is due to mis-usage of a global variable. See attached patch for a
> fix.
Instead of setting rval when \c is detected, this is now set in the
return value of conv_escape_str. This prevents the spillage reported
in http://bugs.debian.org/337294.
|
|
|
|
|
| |
Instead of calling conv_escape_str when we detect a backslash we will call it
unconditionally. This helps get rid of some unnecessary code in echocmd.
|
|
|
|
|
| |
The support for standalone/csh printf only serves to complicate
maintainence.
|
|
|
|
|
|
|
|
|
|
|
| |
This change updates the BSD licence to the three-clause version since
NetBSD has already done so. This makes dash GPL-compatible.
It also adds Christos Zoulas (NetBSD ash maintainer) to the COPYING file.
I've added "copyright by Herbert Xu" to most files.
Finally all CVS IDs and inclusion of sys/cdefs.h have been removed.
The latter is needed for support of klibc.
|
|
|