nnn

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 55137600e0b88dc36644ef8fee43482c80ca9f63
parent be6988d1c849895e850a67f0f7f5ad176415c513
Author: Arun Prakash Jana <engineerarun@gmail.com>
Date:   Mon,  6 May 2024 19:05:46 +0530

Fix #1877: use dprintf() instead of write()

Diffstat:
Msrc/nnn.c | 14+++++---------
1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/src/nnn.c b/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");