diff options
| author | Parvatha Elangovan <p.elangovan@intopix.com> | 2007-02-27 08:54:56 +0000 |
|---|---|---|
| committer | Parvatha Elangovan <p.elangovan@intopix.com> | 2007-02-27 08:54:56 +0000 |
| commit | 313c772f4ae330a5a1fc43ddf9b98c7d89914c6b (patch) | |
| tree | 3d5343562c6442ce04b87a8a0e1995d1093684f0 /codec/compat | |
| parent | 0781b7d441e303e89d9ef5f03b54a66536369923 (diff) | |
Added the dirent.h file used for opening and reading Directory holding image files. Used in image_to_j2k.c and j2k_to_image.c.
Diffstat (limited to 'codec/compat')
| -rw-r--r-- | codec/compat/getopt.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/codec/compat/getopt.c b/codec/compat/getopt.c index 426095b5..29404b60 100644 --- a/codec/compat/getopt.c +++ b/codec/compat/getopt.c @@ -108,10 +108,11 @@ int getopt(int nargc, char *const *nargv, const char *ostr) { return (-1); if (!*place) ++optind; - if (opterr && *ostr != ':') - (void) fprintf(stderr, + if (opterr && *ostr != ':') { + fprintf(stderr, "%s: illegal option -- %c\n", __progname, optopt); - return (BADCH); + return (BADCH); + } } if (*++oli != ':') { /* don't need argument */ optarg = NULL; @@ -124,11 +125,12 @@ int getopt(int nargc, char *const *nargv, const char *ostr) { place = EMSG; if (*ostr == ':') return (BADARG); - if (opterr) - (void) fprintf(stderr, + if (opterr) { + fprintf(stderr, "%s: option requires an argument -- %c\n", __progname, optopt); - return (BADCH); + return (BADCH); + } } else /* white space */ optarg = nargv[optind]; place = EMSG; @@ -171,17 +173,19 @@ again: if(optarg){ if (strchr(optarg,'-')){ /* No argument */ if (*optstring==':') return ':'; - if (opterr) - (void) fprintf(stderr,"%s: option requires an argument %c\n",arg, optopt); - return (BADCH); + if (opterr) { + fprintf(stderr,"%s: option requires an argument %c\n",arg, optopt); + return (BADCH); + } ++optind; } } if (!optarg && o->has_arg==1) { /* no argument there */ if (*optstring==':') return ':'; - if (opterr) - (void) fprintf(stderr,"%s: option requires an argument %c\n",arg, optopt); - return (BADCH); + if (opterr) { + fprintf(stderr,"%s: option requires an argument %c\n",arg, optopt); + return (BADCH); + } ++optind; } ++optind; @@ -242,4 +246,5 @@ found: ++optind; return '?'; }// end of long option + return (BADCH); } |
