summaryrefslogtreecommitdiffstats
path: root/utils/segment/spseg.cpp
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2011-04-28 15:04:46 +0800
committerPeng Wu <alexepico@gmail.com>2011-04-28 15:04:46 +0800
commit80d2b005249b772e7cd7fdf763e217576d401823 (patch)
tree1b1611cef942e5b98b88c1448ad53d9df7ba5e85 /utils/segment/spseg.cpp
parentb7909ecd1b39843c99b44118a8e0fe269da7f098 (diff)
downloadlibpinyin-80d2b005249b772e7cd7fdf763e217576d401823.tar.gz
libpinyin-80d2b005249b772e7cd7fdf763e217576d401823.tar.xz
libpinyin-80d2b005249b772e7cd7fdf763e217576d401823.zip
use errno
Diffstat (limited to 'utils/segment/spseg.cpp')
-rw-r--r--utils/segment/spseg.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/utils/segment/spseg.cpp b/utils/segment/spseg.cpp
index 910770a..6a54288 100644
--- a/utils/segment/spseg.cpp
+++ b/utils/segment/spseg.cpp
@@ -129,7 +129,6 @@ bool backtrace(GArray * steps, glong phrase_len, GArray * strings){
void print_help(){
printf("Usage: spseg [--generate-extra-enter]\n");
- exit(1);
}
int main(int argc, char * argv[]){
@@ -141,8 +140,12 @@ int main(int argc, char * argv[]){
while ( i < argc ){
if ( strcmp ("--help", argv[i]) == 0) {
print_help();
- }else if (strcmp("--generate-extra-enter", argv[i]) == 0) {
+ exit(0);
+ } else if (strcmp("--generate-extra-enter", argv[i]) == 0) {
gen_extra_enter = true;
+ } else {
+ print_help();
+ exit(EINVAL);
}
++i;
}
@@ -152,7 +155,7 @@ int main(int argc, char * argv[]){
FILE * gb_file = fopen("../../data/gb_char.table", "r");
if ( gb_file == NULL ){
fprintf(stderr, "can't open gb_char.table!\n");
- exit(1);
+ exit(ENOENT);
}
g_phrases->load_text(gb_file);
fclose(gb_file);
@@ -160,7 +163,7 @@ int main(int argc, char * argv[]){
FILE * gbk_file = fopen("../../data/gbk_char.table", "r");
if ( gbk_file == NULL ){
fprintf(stderr, "can't open gbk_char.table!\n");
- exit(1);
+ exit(ENOENT);
}
g_phrases->load_text(gbk_file);
fclose(gbk_file);