1 /* Getopt for GNU.
2 Copyright (C) 1987, 88, 89, 90, 91, 1992, 1999 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify it
5 under the terms of the GNU General Public License as published by the
6 Free Software Foundation; either version 2, or (at your option) any
7 later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
17
18 #ifdef HAVE_CONFIG_H
19 #include "config.h"
20 #endif /* Def: HAVE_CONFIG_H */
21
22 #include "getopt.h"
23
24 int
getopt_long(int argc,char * const * argv,const char * options,const struct option * long_options,int * opt_index)25 getopt_long (int argc, char *const *argv, const char *options,
26 const struct option *long_options, int *opt_index)
27 {
28 return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
29 }
30
31 /* Like getopt_long, but '-' as well as '--' can indicate a long option.
32 If an option that starts with '-' (not '--') doesn't match a long option,
33 but does match a short option, it is parsed as a short option
34 instead. */
35
36 int
getopt_long_only(int argc,char * const * argv,const char * options,const struct option * long_options,int * opt_index)37 getopt_long_only (int argc, char *const *argv, const char *options,
38 const struct option *long_options, int *opt_index)
39 {
40 return _getopt_internal (argc, argv, options, long_options, opt_index, 1);
41 }
42
43