Re: [PATCH] \e in "echo" and "printf" builtins

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 28/06/14 19:33, Paul Gilmartin wrote:
> On 2014-06-28, at 10:52, Harald van Dijk wrote:
>> No comment on whether dash itself should accept \e, but you already
>> found a compiler that doesn't support it at all, and many of the ones
>> that do support it also (optionally) issue a warning for it. Should the
>> C code perhaps be using \033 instead of \e?
>>
> And here I put on my EBCDIC hat (crown of thorns) and say, "Be careful
> using numeric code points; they're not portable."

The way GCC does this is to hard-code the values for ASCII, and to
hard-code the values for EBCDIC, both hidden behind preprocessor macros.
Taking that approach in dash would look something like

#if defined(ASCII)
#define ESCAPE '\033'
#elif defined(EBCDIC)
#define ESCAPE '\047'
#else
#error Unknown character set
#endif

and then use ESCAPE.

ASCII and EBCDIC would be detected (or specified) by the configure script.

But dash does have an assumption of ASCII already, which is why I didn't
think it would hurt to add one more. At the very least, it uses
hard-coded \033s in src/hetio.c, so that part of the code already cannot
be used on EBCDIC systems.

Cheers,
Harald van Dijk
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux