| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
#ifndef __GETHOPT_D |
| 7 |
#define __GETHOPT_D |
| 8 |
|
| 9 |
#include <stdio.h> |
| 10 |
#include <string.h> |
| 11 |
|
| 12 |
|
| 13 |
struct h_opt { |
| 14 |
int option; |
| 15 |
char *optword; |
| 16 |
char optchar; |
| 17 |
char *opthasarg; |
| 18 |
char *optdesc; |
| 19 |
} ; |
| 20 |
|
| 21 |
#define HOPTERR ((struct h_opt*)-1) |
| 22 |
|
| 23 |
struct h_context { |
| 24 |
char **argv; |
| 25 |
int argc; |
| 26 |
int optchar; |
| 27 |
int optind; |
| 28 |
char *optarg; |
| 29 |
char optopt; |
| 30 |
int opterr:1; |
| 31 |
int optend:1; |
| 32 |
} ; |
| 33 |
|
| 34 |
extern char *hoptarg(struct h_context *); |
| 35 |
extern int hoptind(struct h_context *); |
| 36 |
extern char hoptopt(struct h_context *); |
| 37 |
extern void hoptset(struct h_context *, int, char **); |
| 38 |
extern int hopterr(struct h_context *, int); |
| 39 |
extern struct h_opt *gethopt(struct h_context *, struct h_opt*, int); |
| 40 |
|
| 41 |
extern void hoptusage(char *, struct h_opt*, int, char *); |
| 42 |
|
| 43 |
#endif |