1816
|
1 // prog-args.cc -*- C++ -*- |
|
2 /* |
|
3 |
|
4 Copyright (C) 1996 John W. Eaton |
|
5 |
|
6 This file is part of Octave. |
|
7 |
|
8 Octave is free software; you can redistribute it and/or modify it |
|
9 under the terms of the GNU General Public License as published by the |
|
10 Free Software Foundation; either version 2, or (at your option) any |
|
11 later version. |
|
12 |
|
13 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
16 for more details. |
|
17 |
|
18 You should have received a copy of the GNU General Public License |
|
19 along with Octave; see the file COPYING. If not, write to the Free |
|
20 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
21 |
|
22 */ |
|
23 |
|
24 #ifdef HAVE_CONFIG_H |
|
25 #include <config.h> |
|
26 #endif |
|
27 |
|
28 #include "getopt.h" |
|
29 |
|
30 #include "prog-args.h" |
|
31 |
|
32 int |
|
33 prog_args::getopt (void) |
|
34 { |
|
35 if (long_opts) |
|
36 return ::getopt_long (xargc, xargv, short_opts, |
|
37 (struct option *) long_opts, 0); |
|
38 else |
|
39 return ::getopt (xargc, xargv, short_opts); |
|
40 } |
|
41 |
|
42 const char * |
|
43 prog_args::optarg (void) |
|
44 { |
|
45 return ::optarg; |
|
46 } |
|
47 |
|
48 int |
|
49 prog_args::optind (void) |
|
50 { |
|
51 return ::optind; |
|
52 } |
|
53 |
|
54 // This is intended to communicate to getopt that it is supposed to |
|
55 // start over on the next call, but it may not be portable. See the |
|
56 // comments in getopt.c for more information. |
|
57 |
|
58 void |
|
59 prog_args::init (void) |
|
60 { |
|
61 ::optind = 0; |
|
62 } |
|
63 |
|
64 /* |
|
65 ;;; Local Variables: *** |
|
66 ;;; mode: C++ *** |
|
67 ;;; page-delimiter: "^/\\*" *** |
|
68 ;;; End: *** |
|
69 */ |