diff options
| author | Parvatha Elangovan <p.elangovan@intopix.com> | 2007-03-29 14:15:14 +0000 |
|---|---|---|
| committer | Parvatha Elangovan <p.elangovan@intopix.com> | 2007-03-29 14:15:14 +0000 |
| commit | 9ba672366e5dfc2151544b0ef9c51f1a81ae3194 (patch) | |
| tree | 0614dbc5f550e3c2865d0232b8539e5666bf0cb5 /codec/compat | |
| parent | a1fe5809a4760ed2aa64951c596156f48fca393e (diff) | |
Enable accepting file names with `-´ symbol .Modification getopt.c
Rsiz profile name generation to be STD_RSIZ for profiles which are not DCI compliant.Modification in image_to_j2k.c
Renamed convert_progression_order to j2k_convert_progression_order. Modification j2k.c
Calculation of number of tile part in each tile in j2k_calculate_tp. Modification j2k.c
j2k_setup_encoder to set bit rate limitation for digital cinema compliance with quality option. Modification in j2k.c
Equation to check multiple tile precincts. Modification pi.c
array size generation of pi->include in pi_initialise_encode().Modification in pi.c
Modification in pi_create_encode for tile part generation.Modification in pi.c
In tcd_rateallocate a variable stable_threshold which holds the valid threshold value. This is used to avoid error in case of a wrong threshold value in the last iteration. Modification in tcd.c.
Diffstat (limited to 'codec/compat')
| -rw-r--r-- | codec/compat/getopt.c | 52 | ||||
| -rw-r--r-- | codec/compat/getopt.h | 2 |
2 files changed, 29 insertions, 25 deletions
diff --git a/codec/compat/getopt.c b/codec/compat/getopt.c index 6bb31c86..3ecbde15 100644 --- a/codec/compat/getopt.c +++ b/codec/compat/getopt.c @@ -125,7 +125,7 @@ int getopt(int nargc, char *const *nargv, const char *ostr) { int getopt_long(int argc, char * const argv[], const char *optstring, -struct option *longopts, int *longindex, int totlen) { +struct option *longopts, int totlen) { static int lastidx,lastofs; char *tmp; int i,len; @@ -147,24 +147,28 @@ again: if(strlen(arg)>1){ for (i=0;i<totlen;i=i+len,o++) { if (!strcmp(o->name,arg)) { /* match */ - if (longindex) *longindex=o-longopts; - if (o->has_arg>0) { - optarg=argv[optind+1]; - if(optarg){ - if (strchr(optarg,'-')){ /* Has read next input parameter: No arg for current parameter */ - if (opterr) { - fprintf(stderr,"%s: option requires an argument\n",arg); - return (BADCH); - } - } - } - if (!optarg && o->has_arg==1) { /* no argument there */ + if (o->has_arg == 0) { + if (!(argv[optind+1][0]=='-')){ + fprintf(stderr,"%s: option does not require an argument. Ignoring %s\n",arg,argv[optind+1]); + ++optind; + } + }else{ + optarg=argv[optind+1]; + if(optarg){ + if (optarg[0] == '-'){ /* Has read next input parameter: No arg for current parameter */ if (opterr) { - fprintf(stderr,"%s: option requires an argument %c\n",arg, optopt); + fprintf(stderr,"%s: option requires an argument\n",arg); return (BADCH); } } - ++optind; + } + if (!optarg && o->has_arg==1) { /* no argument there */ + if (opterr) { + fprintf(stderr,"%s: option requires an argument \n",arg); + return (BADCH); + } + } + ++optind; } ++optind; if (o->flag) @@ -195,7 +199,7 @@ again: } optarg=argv[optind+1]; if(optarg){ - if (strchr(optarg,'-')){ /* Has read next input parameter: No arg for current parameter */ + if (optarg[0] == '-'){ /* Has read next input parameter: No arg for current parameter */ if (opterr) { fprintf(stderr,"%s: option requires an argument\n",arg); return (BADCH); @@ -210,16 +214,16 @@ again: } ++optind; }else {/*Argument not expected*/ - ++lastofs; - return optopt; + ++lastofs; + return optopt; } found: - ++optind; - return optopt; + ++optind; + return optopt; } else { /* not found */ - fprintf(stderr,"Invalid option %s\n",arg); - ++optind; - return (BADCH); + fprintf(stderr,"Invalid option %s\n",arg); + ++optind; + return (BADCH); }//end of not found }// end of single character @@ -227,4 +231,4 @@ found: fprintf(stderr,"Invalid option %s\n"); ++optind; return (BADCH);; - }//end function +}//end function diff --git a/codec/compat/getopt.h b/codec/compat/getopt.h index 4492e850..3477e069 100644 --- a/codec/compat/getopt.h +++ b/codec/compat/getopt.h @@ -23,7 +23,7 @@ extern char *optarg; extern int getopt(int nargc, char *const *nargv, const char *ostr); extern int getopt_long(int argc, char * const argv[], const char *optstring, - const struct option *longopts, int *longindex,int totlen); + const struct option *longopts, int totlen); #endif /* _GETOPT_H_ */ |
