This could be useful in cases when some binary data should not be
interpreted as an ASCII string, but rather as an array of byte values.
* defs.h (QUOTE_FORCE_HEX): New macro constant.
* util.c (quote_string): Enable use_hex when QUOTE_FORCE_HEX is set
in user_style parameter.
#define QUOTE_0_TERMINATED 0x01
#define QUOTE_OMIT_LEADING_TRAILING_QUOTES 0x02
#define QUOTE_OMIT_TRAILING_0 0x08
+#define QUOTE_FORCE_HEX 0x10
extern int string_quote(const char *, char *, unsigned int, unsigned int);
extern int print_quoted_string(const char *, unsigned int, unsigned int);
eol = 0x100; /* this can never match a char */
usehex = 0;
- if (xflag > 1)
+ if ((xflag > 1) || (style & QUOTE_FORCE_HEX)) {
usehex = 1;
- else if (xflag) {
+ } else if (xflag) {
/* Check for presence of symbol which require
to hex-quote the whole string. */
for (i = 0; i < size; ++i) {