diff options
author | Amadeusz Sławiński <amade@asmblr.net> | 2013-06-16 17:37:06 +0200 |
---|---|---|
committer | Amadeusz Sławiński <amade@asmblr.net> | 2015-06-25 17:52:12 +0200 |
commit | 0926ac685247ca0a1bd06247b868ec1d73ae52a6 (patch) | |
tree | 0f4d85cab3943e1dcd8632280267342639c4a106 /src/mark.c | |
parent | 05eb95bec0118818518365fb04ac316f4037a1c9 (diff) | |
download | screen-0926ac685247ca0a1bd06247b868ec1d73ae52a6.tar.gz |
use system stuff, use bool
Diffstat (limited to 'src/mark.c')
-rw-r--r-- | src/mark.c | 21 |
1 files changed, 10 insertions, 11 deletions
@@ -28,6 +28,7 @@ #include <sys/types.h> #include <ctype.h> +#include <stdbool.h> #include "config.h" #include "screen.h" @@ -53,7 +54,7 @@ static void nextword(int *, int *, int, int); static int linestart(int); static int lineend(int); static int rem(int, int, int, int, int, char *, int); -static int eq(int, int); +static bool eq(int, int); static int MarkScrollDownDisplay(int); static int MarkScrollUpDisplay(int); @@ -87,9 +88,7 @@ static struct markdata *markdata; */ static int is_letter(int c) { - if ((c >= 'a' && c <= 'z') || - (c >= 'A' && c <= 'Z') || - (c >= '0' && c <= '9') || + if (isalnum(c) || c == '_' || c == '.' || c == '@' || c == ':' || c == '%' || c == '!' || c == '-' || c == '+') /* thus we can catch email-addresses as a word :-) */ return 1; @@ -359,15 +358,15 @@ static int rem(int x1, int y1, int x2, int y2, int redisplay, char *pt, int yend * as same. Used for GetHistory() */ -static int eq(int a, int b) +static bool eq(int a, int b) { if (a == b) - return 1; + return true; if (a == 0 || b == 0) - return 1; - if (a <= '9' && a >= '0' && b <= '9' && b >= '0') - return 1; - return 0; + return true; + if (isdigit(a) && isdigit(b)) + return true; + return false; } /**********************************************************************/ @@ -489,7 +488,7 @@ static void MarkProcess(char **inbufp, int *inlenp) } od = mark_key_tab[(int)ch]; rep_cnt = markdata->rep_cnt; - if (od >= '0' && od <= '9' && !markdata->f_cmd.flag) { + if (isdigit(od) && !markdata->f_cmd.flag) { if (rep_cnt < 1001 && (od != '0' || rep_cnt != 0)) { markdata->rep_cnt = 10 * rep_cnt + od - '0'; continue; |