Initial import from FreeBSD RELENG_4:
[dragonfly.git] / contrib / groff / src / include / groff-getopt.h
1 // -*- C++ -*-
2 /* Copyright (C) 2000, 2001 Free Software Foundation, Inc.
3      Written by Werner Lemberg (wl@gnu.org)
4
5 This file is part of groff.
6
7 groff is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2, or (at your option) any later
10 version.
11
12 groff is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15 for more details.
16
17 You should have received a copy of the GNU General Public License along
18 with groff; see the file COPYING.  If not, write to the Free Software
19 Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
20
21 /*
22    This file has to be included from within lib.h instead of getopt.h
23    to avoid problems with picky C++ compilers.
24 */
25
26 #ifndef _GROFF_GETOPT_H
27 #define _GROFF_GETOPT_H
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32
33 extern char *optarg;
34 extern int optind;
35 extern int opterr;
36 extern int optopt;
37
38 struct option
39 {
40   const char *name;
41   int has_arg;
42   int *flag;
43   int val;
44 };
45
46 #define no_argument       0
47 #define required_argument 1
48 #define optional_argument 2
49
50 extern int getopt(int,                  // __argc
51                   char *const *,        // __argv
52                   const char *);        // __shortopts
53 extern int getopt_long(int,                     // __argc
54                        char *const *,           // __argv
55                        const char *,            // __shortopts
56                        const struct option *,   // __longopts
57                        int *);                  // __longind
58 extern int getopt_long_only(int,                        // __argc
59                             char *const *,              // __argv
60                             const char *,               // __shortopts
61                             const struct option *,      // __longopts
62                             int *);                     // __longind
63
64 #ifdef __cplusplus
65 }
66 #endif
67
68 #endif /* _GROFF_GETOPT_H */