chiark / gitweb /
227d10885e092b5cd327476486adbea01c4ce000
[chiark-utils.git] / cprogs / myopt.h
1 /*
2  * myopt.h - declarations for my very own option parsing
3  *
4  * Copyright (C) 1994,1995,1998 Ian Jackson <ian@chiark.greenend.org.uk>
5  *
6  * This is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation; either version 2,
9  * or (at your option) any later version.
10  *
11  * This is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public
17  * License along with this file; if not, write to the Free Software
18  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19  */
20
21 #ifndef MYOPT_H
22 #define MYOPT_H
23
24 typedef void (*voidfnp)(void);
25
26 struct cmdinfo {
27   const char *olong;
28   char oshort;
29   int takesvalue; /* 0 = normal   1 = standard value   2 = option string cont */
30   int *iassignto;
31   const char **sassignto;
32   void (*call)(const struct cmdinfo*, const char *value);
33   int arg;
34   void *parg;
35   voidfnp farg;
36 };
37
38 void myopt(const char *const **argvp, const struct cmdinfo *cmdinfos);
39
40 void badusage(const char *fmt, ...);
41
42 #endif /* MYOPT_H */