| 102 | /* The main program */ |
| 103 | |
| 104 | int main(int argc, char *argv[]) |
| 105 | { |
| 106 | int i,error; |
| 107 | char word_end_chars[256],*pos; |
| 108 | POINTER_ARRAY from,to; |
| 109 | REPLACE *replace; |
| 110 | MY_INIT(argv[0]); |
| 111 | |
| 112 | if (static_get_options(&argc,&argv)) |
| 113 | exit(1); |
| 114 | if (get_replace_strings(&argc,&argv,&from,&to)) |
| 115 | exit(1); |
| 116 | |
| 117 | for (i=1,pos=word_end_chars ; i < 256 ; i++) |
| 118 | if (my_isspace(&my_charset_latin1,i)) |
| 119 | *pos++= (char) i; |
| 120 | *pos=0; |
| 121 | if (!(replace=init_replace((char**) from.typelib.type_names, |
| 122 | (char**) to.typelib.type_names, |
| 123 | (uint) from.typelib.count,word_end_chars))) |
| 124 | exit(1); |
| 125 | free_pointer_array(&from); |
| 126 | free_pointer_array(&to); |
| 127 | if (initialize_buffer()) |
| 128 | return 1; |
| 129 | |
| 130 | error=0; |
| 131 | if (argc == 0) |
| 132 | error=convert_pipe(replace,stdin,stdout); |
| 133 | else |
| 134 | { |
| 135 | while (argc--) |
| 136 | { |
| 137 | error=convert_file(replace,*(argv++)); |
| 138 | } |
| 139 | } |
| 140 | free_buffer(); |
| 141 | my_end(verbose ? MY_CHECK_ERROR | MY_GIVE_INFO : MY_CHECK_ERROR); |
| 142 | exit(error ? 2 : 0); |
| 143 | return 0; /* No compiler warning */ |
| 144 | } /* main */ |
| 145 | |
| 146 | |
| 147 | /* reads options */ |
nothing calls this directly
no test coverage detected