Introduction
Introduction Statistics Contact Development Disclaimer Help
tfile: Don't stop at first non-printable character - spoon - dwm status utility…
git clone git://src.adamsgaard.dk/spoon
Log
Files
Refs
LICENSE
---
commit a905d4c153b89f46425d071486c46f77b8ab53db
parent 182f011235b50784ab28e948e36a0c126e1c9985
Author: sin <[email protected]>
Date: Tue, 30 May 2017 09:35:44 +0100
file: Don't stop at first non-printable character
This makes utf-8 encoded text work properly.
Diffstat:
M file.c | 6 ------
1 file changed, 0 insertions(+), 6 deletions(-)
---
diff --git a/file.c b/file.c
t@@ -1,4 +1,3 @@
-#include <ctype.h>
#include <err.h>
#include <fcntl.h>
#include <unistd.h>
t@@ -27,7 +26,6 @@ fileread(void *arg, char *buf, size_t len)
char *path = arg;
ssize_t n;
int fd;
- int i;
fd = open(path, O_RDONLY);
if (fd == -1) {
t@@ -40,9 +38,5 @@ fileread(void *arg, char *buf, size_t len)
return -1;
else
buf[n - 1] = '\0';
- /* stop at the first non-printable character */
- for (i = 0; i < len; i++)
- if (!isprint((unsigned char)buf[i]))
- buf[i] = '\0';
return 0;
}
You are viewing proxied material from mx1.adamsgaard.dk. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.