hysteria

ii wrapper script
git clone git://git.2f30.org/hysteria.git
Log | Files | Refs | README | LICENSE

commit 150655967d5830ae24dd0b6340cf5e4dff19f065
parent 49c0d11a9521b5ede0b83817168ae3007dbc3a8f
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Mon Nov 24 23:40:45 +0100

regexec: stricter check (==0)

Diffstat:
hysteria-highlight.c | 16++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/hysteria-highlight.c b/hysteria-highlight.c @@ -108,7 +108,7 @@ main(int argc, char *argv[]) p = buffer; /* convert unix timestamp to localtime */ - if((ret = regexec(&unixtimestamp, p, 1, &match, 0)) != REG_NOMATCH) { + if((ret = regexec(&unixtimestamp, p, 1, &match, 0)) == 0) { errno = 0; t = (time_t)strtol(p, NULL, 10); if(errno != 0) @@ -118,13 +118,13 @@ main(int argc, char *argv[]) (strftime(timebuf, sizeof(timebuf), timeformat, &tm) > 0)) fputs(timebuf, stdout); p += match.rm_eo - match.rm_so; - } else if((ret = regexec(&timestamp, p, 1, &match, 0)) != REG_NOMATCH) { + } else if((ret = regexec(&timestamp, p, 1, &match, 0)) == 0) { /* skip date part (YYY-mm-dd) of timestamp */ p += match.rm_eo - match.rm_so; } /* highlight / color server messages */ - if((ret = regexec(&server, p, 1, &match, 0)) != REG_NOMATCH) { + if((ret = regexec(&server, p, 1, &match, 0)) == 0) { fputs(servercolor, stdout); fputs(p, stdout); fputs(reset, stdout); @@ -133,18 +133,18 @@ main(int argc, char *argv[]) } /* ignore on match */ - if((ret = regexec(&ignore, p, 1, &match, 0)) != REG_NOMATCH) + if((ret = regexec(&ignore, p, 1, &match, 0)) == 0) continue; /* align nicknames */ - if((ret = regexec(&nickalign, p, 2, matches, 0)) != REG_NOMATCH) + if((ret = regexec(&nickalign, p, 2, matches, 0)) == 0) { fwrite(p, 1, matches[1].rm_so, stdout); putchar('@'); p += matches[1].rm_so; len = matches[1].rm_eo - matches[1].rm_so; /* own nick ?: color nickname part white */ - if((ret = regexec(&nick, p, 1, &match, 0)) != REG_NOMATCH && + if((ret = regexec(&nick, p, 1, &match, 0)) == 0 && match.rm_so == 0 && match.rm_eo == len) { fputs(nickcolor, stdout); @@ -161,7 +161,7 @@ main(int argc, char *argv[]) while(hasmatch) { hasmatch = 0; /* highlight word */ - if((ret = regexec(&word, p, 1, &match, 0)) != REG_NOMATCH) { + if((ret = regexec(&word, p, 1, &match, 0)) == 0) { fwrite(p, 1, match.rm_so, stdout); fputs(wordcolor, stdout); p += match.rm_so; @@ -173,7 +173,7 @@ main(int argc, char *argv[]) hasmatch = 1; } /* highlight url */ - if((ret = regexec(&url, p, 1, &match, 0)) != REG_NOMATCH) { + if((ret = regexec(&url, p, 1, &match, 0)) == 0) { fwrite(p, 1, match.rm_so, stdout); fputs(urlcolor, stdout); p += match.rm_so;