..fwiw..
Ian Norton wrote in
<[email protected]>:
|Fixes #16018 by preventing the output of terminal/formatting codes \
|to stdout when listing archive content
|See https://bugs.busybox.net/show_bug.cgi?id=16018
|
|If stdout is a TTY unsafe chars are replaced with '?':
...
|diff --git a/include/libbb.h b/include/libbb.h
...
| #define isprint_asciionly(a) ((unsigned)((a) - 0x20) <= 0x7e - 0x20)
|
|+/* Print msg to a file-descriptor, replacing any terminal control \
|bytes with '?' if fd is a TTY */
|+static ALWAYS_INLINE void bb_safe_dump_str(FILE* fd, const char* msg) {
|+ int fdno = fileno(fd);
|+ if (isatty(fdno)) {
I first wrote
Seeing diff hunk context i myself would then do (maybe, likely)
char c;
while((c = *msg++) != '\0')
fputc((isprint_asciionly(c) ? c : '?'), fd);
|+ } else {
|+ fprintf(fd, "%s", msg);
|+ }
|+}
But then i did a grep and found unicode_conv_to_printable().
How about simply using this??
--steffen
|
|Der Kragenbaer, The moon bear,
|der holt sich munter he cheerfully and one by one
|einen nach dem anderen runter wa.ks himself off
|(By Robert Gernhardt)
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox