1/* This file is part of GNU Pies. -*- c -*-
2   Copyright (C) 2008-2020 Sergey Poznyakoff
3
4   GNU Pies is free software; you can redistribute it and/or modify
5   it under the terms of the GNU General Public License as published by
6   the Free Software Foundation; either version 3, or (at your option)
7   any later version.
8
9   GNU Pies 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 GNU Pies.  If not, see <http://www.gnu.org/licenses/>. */
16
17OPTIONS_BEGIN("piesctl",
18              [<GNU pies control program>],
19	      [<COMMAND [ARG...]>],
20	      [<gnu>],
21              [<copyright_year=2008-2020>],
22              [<copyright_holder=Sergey Poznyakoff>])
23
24OPTION(instance,i,NAME,
25       [<connect to instance NAME>])
26BEGIN
27  instance = optarg;
28END
29
30OPTION(config-file,c,FILE,
31       [<use FILE instead of the default configuration>])
32BEGIN
33  config_file = optarg;
34END
35
36OPTION(config-help,,,
37       [<show configuration file summary>])
38BEGIN
39  config_help ();
40  exit (0);
41END
42
43OPTION(,E,,
44       [<preprocess configuration files and exit>])
45BEGIN
46  preprocess_only = 1;
47END
48
49OPTION(verbose,v,,
50       [<verbose diagnostics>])
51BEGIN
52  ++verbose;
53END
54
55OPTION(dump,d,,
56       [<dump obtained responses verbatim>])
57BEGIN
58  ++dump;
59END
60
61OPTION(url,u,URL,
62       [<connect to this socket>])
63BEGIN
64  if (pies_url_create (&client.url, optarg))
65    {
66      grecs_error (NULL, 0, _("%s: cannot create URL: %s"),
67		   optarg, strerror (errno));
68      exit (EX_USAGE);
69    }
70END
71
72OPTION(no-netrc,N,,
73       [<don't read ~/.netrc file>])
74BEGIN
75  no_netrc_option = 1;
76END
77
78GROUP(Preprocessor)
79
80OPTION(include-directory,I,DIR,
81       [<add include directory>])
82BEGIN
83  grecs_preproc_add_include_dir (optarg);
84END
85
86OPTION(define,D,[<NAME[=VALUE]>],
87       [<define a preprocessor symbol NAME as having VALUE or empty>])
88BEGIN
89  pp_add_option ("-D", optarg);
90END
91
92OPTION(undefine,U,NAME,
93       [<undefine a preprocessor symbol NAME>])
94BEGIN
95  pp_add_option ("-U", optarg);
96END
97
98OPTIONS_END
99
100void
101parse_options(int argc, char *argv[], int *index)
102{
103  GETOPT(argc, argv, *index)
104  setenv ("PIES_INSTANCE", instance, 1);
105}
106
107
108
109