mirror of
https://github.com/jarun/nnn.git
synced 2024-11-17 08:32:36 +00:00
Fix #1877: use dprintf() instead of write()
This commit is contained in:
parent
be6988d1c8
commit
55137600e0
14
src/nnn.c
14
src/nnn.c
|
@ -5197,25 +5197,21 @@ static void show_help(const char *path)
|
|||
get_output(prog, NULL, NULL, fd, FALSE);
|
||||
|
||||
bool hex = true;
|
||||
const char space = ' ';
|
||||
const char *end = helpstr + (sizeof helpstr - 1);
|
||||
const char *end = helpstr + sizeof(helpstr) - 1;
|
||||
|
||||
for (const char *s = helpstr; s < end; ++s) {
|
||||
if (hex) {
|
||||
for (int k = 0, n = xchartohex(*s); k < n; ++k)
|
||||
if (write(fd, &space, 1) != 1)
|
||||
break;
|
||||
dprintf(fd, " ");
|
||||
} else if (*s == '%') {
|
||||
int n = ((s[1] - '0') * 10) + (s[2] - '0');
|
||||
for (int k = 0; k < n; ++k)
|
||||
if (write(fd, &space, 1) != 1)
|
||||
break;
|
||||
dprintf(fd, " ");
|
||||
s += 2;
|
||||
} else {
|
||||
if (write(fd, s, 1) != 1)
|
||||
break;
|
||||
dprintf(fd, "%c", *s);
|
||||
}
|
||||
hex = *s == '\n';
|
||||
hex = (*s == '\n');
|
||||
}
|
||||
|
||||
dprintf(fd, "\nLOCATIONS\n");
|
||||
|
|
Loading…
Reference in a new issue