commit 3a3c1b606327f75284e91ce448d08da435de7701
parent 852ef6975c82ef50deb217699239ec08283030d6
Author: Claudio Alessi <smoppy@gmail.com>
Date: Sat, 16 Apr 2016 14:28:05 +0200
Let isprint() checks for us.
Diffstat:
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/myadm.c b/myadm.c
@@ -15,7 +15,7 @@
#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
-
+#include <ctype.h>
#include <mysql.h>
#include <stfl.h>
#include <langinfo.h>
@@ -432,9 +432,7 @@ ui_showfields(Field *fds, int *lens) {
break;
}
for(j = 0; j < fld->len && j < lens[i] && linesz; ++j)
- if(fld->name[j] != '\r'
- && fld->name[j] != '\n'
- && fld->name[j] != '\t') {
+ if(isprint(fld->name[j])) {
line[li++] = fld->name[j];
--linesz;
}
@@ -601,9 +599,7 @@ ui_putitem(Item *item, int *lens) {
break;
}
for(j = 0; j < item->lens[i] && j < lens[i] && linesz; ++j)
- if(item->cols[i][j] != '\r'
- && item->cols[i][j] != '\n'
- && item->cols[i][j] != '\t') {
+ if(isprint(item->cols[i][j])) {
line[li++] = item->cols[i][j];
--linesz;
}