Changeset 1636 for zzuf


Ignore:
Timestamp:
Jan 9, 2007, 5:14:31 PM (13 years ago)
Author:
Sam Hocevar
Message:
  • Change debug's %c so that it automatically escapes binary characters.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • zzuf/trunk/src/debug.c

    r1578 r1636  
    8282        {
    8383            char i = (char)(unsigned char)va_arg(args, int);
    84             write(fd, &i, 1);
     84            if(i >= 0x20 && i < 0x7f)
     85                write(fd, &i, 1);
     86            else
     87            {
     88                write(fd, "\\x", 2);
     89                write(fd, hex2char + ((i & 0xf0) >> 4), 1);
     90                write(fd, hex2char + (i & 0x0f), 1);
     91            }
    8592        }
    8693        else if(*f == 'i')
Note: See TracChangeset for help on using the changeset viewer.