summaryrefslogtreecommitdiffstats
path: root/utils/segment/spseg.cpp
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2010-11-08 16:44:19 +0800
committerPeng Wu <alexepico@gmail.com>2010-11-08 16:44:19 +0800
commitd7b59e84a518e06cfe04f21bba90dddcb4121ba2 (patch)
treeb93c3bfb6831e83ecca872196cfeffa81521ecc0 /utils/segment/spseg.cpp
parent28be2c426cc108903bd2e11dffc59ad8b803ff7f (diff)
downloadlibpinyin-d7b59e84a518e06cfe04f21bba90dddcb4121ba2.tar.gz
libpinyin-d7b59e84a518e06cfe04f21bba90dddcb4121ba2.tar.xz
libpinyin-d7b59e84a518e06cfe04f21bba90dddcb4121ba2.zip
re-factor spseg
Diffstat (limited to 'utils/segment/spseg.cpp')
-rw-r--r--utils/segment/spseg.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/utils/segment/spseg.cpp b/utils/segment/spseg.cpp
index 8c4fd00..910770a 100644
--- a/utils/segment/spseg.cpp
+++ b/utils/segment/spseg.cpp
@@ -171,9 +171,8 @@ int main(int argc, char * argv[]){
char * linebuf = NULL;
size_t size = 0;
- while(getline(&linebuf, &size, stdin)) {
- if ( feof(stdin) )
- break;
+ ssize_t read;
+ while( (read = getline(&linebuf, &size, stdin)) != -1 ){
linebuf[strlen(linebuf) - 1] = '\0';
//check non-ucs2 characters
@@ -197,7 +196,7 @@ int main(int argc, char * argv[]){
g_free(string);
}
- //print extra enter
+ /* print extra enter */
if ( gen_extra_enter )
printf("\n");