Mercurial > hg > nnchat
comparison nnchat.c @ 401:3f20ac9a9e1d
Using th_isspace() should be enough to detect \r and \n.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 24 May 2012 05:02:27 +0300 |
parents | ec974049ccba |
children | 563a70e8a303 |
comparison
equal
deleted
inserted
replaced
400:ec974049ccba | 401:3f20ac9a9e1d |
---|---|
909 BOOL result; | 909 BOOL result; |
910 | 910 |
911 /* Trim right */ | 911 /* Trim right */ |
912 bufLen--; | 912 bufLen--; |
913 buf[bufLen--] = 0; | 913 buf[bufLen--] = 0; |
914 while (bufLen > 0 && (buf[bufLen] == '\n' || buf[bufLen] == '\r' || th_isspace(buf[bufLen]))) | 914 while (bufLen > 0 && th_isspace(buf[bufLen])) |
915 buf[bufLen--] = 0; | 915 buf[bufLen--] = 0; |
916 | 916 |
917 /* Decode completed usernames */ | 917 /* Decode completed usernames */ |
918 nn_username_decode(buf); | 918 nn_username_decode(buf); |
919 | 919 |
1389 wgetnstr(win, tmpBuf, sizeof(tmpBuf) - 1); | 1389 wgetnstr(win, tmpBuf, sizeof(tmpBuf) - 1); |
1390 noecho(); | 1390 noecho(); |
1391 if (curVis != ERR) | 1391 if (curVis != ERR) |
1392 curs_set(curVis); | 1392 curs_set(curVis); |
1393 | 1393 |
1394 for (pos = strlen(tmpBuf) - 1; pos > 0 && (tmpBuf[pos] == '\n' || tmpBuf[pos] == '\r' || th_isspace(tmpBuf[pos])); pos--) | 1394 for (pos = strlen(tmpBuf) - 1; pos > 0 && th_isspace(tmpBuf[pos]); pos--) |
1395 tmpBuf[pos] = 0; | 1395 tmpBuf[pos] = 0; |
1396 | 1396 |
1397 ptr = str_trim_left(tmpBuf); | 1397 ptr = str_trim_left(tmpBuf); |
1398 | 1398 |
1399 if (allowEmpty || strlen(ptr) > 0) | 1399 if (allowEmpty || strlen(ptr) > 0) |