/* possibly open input & output files */
if (argc - optind >= 1) {
- ifp = fopen(argv[optind], "r");
+ ifp = fopen(argv[optind], "rb");
if (!ifp) {
fprintf(stderr, "error: cannot open %s for reading\n", argv[1]);
exit(1);
}
}
if (argc - optind >= 2) {
- ofp = fopen(argv[optind + 1], "w");
+ ofp = fopen(argv[optind + 1], "wb");
if (!ofp) {
fprintf(stderr, "error: cannot open %s for writing\n", argv[2]);
exit(1);
}
/* now read in the encoding description file, if requested */
- if ((unicode_map_file = fopen(path, "r")) == NULL) {
+ if ((unicode_map_file = fopen(path, "rb")) == NULL) {
fprintf(stderr, "**** Cannot access map file '%s' ****\n", path);
exit(1);
}
/* save the command line for the record
* (we don't bother about escaping the shell special characters)
*/
-
+
j = 0;
for(i=1; i<argc; i++) {
j += strlen(argv[i])+1;
switch(oc) {
case 'W':
if(sscanf(optarg, "%d", &warnlevel) < 1 || warnlevel < 0) {
- fprintf(stderr, "**** warning level must be a positive number\n");
+ fprintf(stderr, "**** warning level must be a positive number: %s (%d)\n", optarg, warnlevel);
exit(1);
}
break;
break;
}
}
+
argc-=optind-1; /* the rest of code counts from argv[0] */
argv+=optind-1;
usage();
exit(1);
}
-
/* try to guess the language by the locale used */
if(uni_lang_selected==0 && (lang=getenv("LANG"))!=0 ) {
for(i=0; i < sizeof uni_lang/sizeof(struct uni_language); i++) {
}
}
- if ((null_file = fopen(BITBUCKET, "w")) == NULL) {
+ if ((null_file = fopen(BITBUCKET, "wb")) == NULL) {
fprintf(stderr, "**** Cannot open %s ****\n",
BITBUCKET);
exit(1);
exit(1);
}
ofp = pfa_file;
- ifp = fdopen(p[0], "r");
+ ifp = fdopen(p[0], "rb");
if (ifp == NULL) {
perror("**** Cannot use pipe for reading ****\n");
exit(1);
}
- pfa_file = fdopen(p[1], "w");
+ pfa_file = fdopen(p[1], "wb");
if (pfa_file == NULL) {
perror("**** Cannot use pipe for writing ****\n");
exit(1);