[trunk] Import getopt modification from 1.5 branch

This commit is contained in:
Mathieu Malaterre 2012-03-02 13:50:29 +00:00
parent 3d9198592b
commit c7540fba94
1 changed files with 6 additions and 6 deletions

View File

@ -65,7 +65,7 @@ void reset_options_reading(void) {
int opj_getopt(int nargc, char *const *nargv, const char *ostr) { int opj_getopt(int nargc, char *const *nargv, const char *ostr) {
# define __progname nargv[0] # define __progname nargv[0]
static char *place = EMSG; /* option letter processing */ static char *place = EMSG; /* option letter processing */
char *oli; /* option letter list index */ char *oli = NULL; /* option letter list index */
if (opj_optreset || !*place) { /* update scanning pointer */ if (opj_optreset || !*place) { /* update scanning pointer */
opj_optreset = 0; opj_optreset = 0;
@ -197,7 +197,7 @@ again:
return o->val; return o->val;
return 0; return 0;
} }
}//(end for)String not found in the list }/*(end for)String not found in the list*/
fprintf(stderr,"Invalid option %s\n",arg); fprintf(stderr,"Invalid option %s\n",arg);
++opj_optind; ++opj_optind;
return (BADCH); return (BADCH);
@ -244,11 +244,11 @@ found:
fprintf(stderr,"Invalid option %s\n",arg); fprintf(stderr,"Invalid option %s\n",arg);
++opj_optind; ++opj_optind;
return (BADCH); return (BADCH);
}//end of not found }/*end of not found*/
}// end of single character }/* end of single character*/
}//end '-' }/*end '-'*/
fprintf(stderr,"Invalid option\n"); fprintf(stderr,"Invalid option\n");
++opj_optind; ++opj_optind;
return (BADCH);; return (BADCH);;
}//end function }/*end function*/