File indexing completed on 2024-04-28 11:21:08
0001 /* 0002 * gethopt; options processing with both single-character and whole-work 0003 * options both introduced with - 0004 */ 0005 0006 #ifndef __GETHOPT_D 0007 #define __GETHOPT_D 0008 0009 #include <stdio.h> 0010 #include <string.h> 0011 0012 0013 struct h_opt { 0014 int option; 0015 char *optword; 0016 char optchar; 0017 char *opthasarg; 0018 char *optdesc; 0019 } ; 0020 0021 #define HOPTERR ((struct h_opt*)-1) 0022 0023 struct h_context { 0024 char **argv; 0025 int argc; 0026 int optchar; 0027 int optind; 0028 char *optarg; 0029 char optopt; 0030 int opterr:1; 0031 int optend:1; 0032 } ; 0033 0034 extern char *hoptarg(struct h_context *); 0035 extern int hoptind(struct h_context *); 0036 extern char hoptopt(struct h_context *); 0037 extern void hoptset(struct h_context *, int, char **); 0038 extern int hopterr(struct h_context *, int); 0039 extern struct h_opt *gethopt(struct h_context *, struct h_opt*, int); 0040 0041 extern void hoptusage(char *, struct h_opt*, int, char *); 0042 0043 #endif/*__GETHOPT_D*/