From 449c547e78c9b79ffc1e0c180940b6f117e435a7 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Mon, 15 May 2023 18:03:30 +0200 Subject: Removed calls to ctype.h --- sdep.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'sdep.c') diff --git a/sdep.c b/sdep.c index 8516678..eae0b3d 100644 --- a/sdep.c +++ b/sdep.c @@ -1,6 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include #include #include #include @@ -54,6 +53,7 @@ static int compare_event(const void *, const void *); static Options default_op(void); static int events_in_range(EventList *, Options, Event *); static char *format_line(Event, Options, char *); +static int is_space(char); static void read_input(Options, EventList *); static Options read_op(int, char *[]); static char *strtrim(char *); @@ -156,6 +156,12 @@ format_line(Event ev, Options op, char *out) return out; } +static int +is_space(char c) +{ + return c == ' ' || c == '\t'; +} + static void read_input(Options op, EventList *evlist) { @@ -221,8 +227,8 @@ strtrim(char *t) { char *s; - for (s = &t[strlen(t)-1]; s != t && isspace(*s); *s = '\0', s--); - for (; *t != '\0' && isspace(*t); t++); + for (s = &t[strlen(t)-1]; s != t && is_space(*s); *s = '\0', s--); + for (; *t != '\0' && is_space(*t); t++); return t; } -- cgit v1.3