File: cmdline.opt

package info (click to toggle)
dico 2.9-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 16,908 kB
  • sloc: ansic: 85,886; sh: 50,207; lex: 2,624; yacc: 1,437; tcl: 1,434; python: 1,281; makefile: 1,266; perl: 881; lisp: 489; awk: 157; pascal: 125; cpp: 44; fortran: 25; asm: 19; sed: 16; xml: 8
file content (224 lines) | stat: -rw-r--r-- 4,941 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
/* This file is part of GNU Dico. -*- c -*-
   Copyright (C) 1998-2019 Sergey Poznyakoff

   GNU Dico is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 3, or (at your option)
   any later version.

   GNU Dico is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with GNU Dico.  If not, see <http://www.gnu.org/licenses/>. */

#include <dico-priv.h>
#include <getopt.h>
#include <sysexits.h>

OPTIONS_BEGIN("dico",
              [<GNU dictionary client program>],
	      [<[URL-or-WORD]>],
	      [<gnu>],
	      [<gnupackage>],
	      [<copyright_year=2005-2017>],
	      [<copyright_holder=Free Software Foundation, Inc.>])

GROUP([<Server selection>])
	      
OPTION(host,,SERVER,
       [<connect to this server>])
BEGIN
  xdico_assign_string(&dico_url.host, optarg);
END

OPTION(port,p,SERVICE,
       [<specify port to connect to>])
BEGIN
  xdico_assign_string(&dico_url.port, optarg);
END

OPTION(database,d,NAME,
       [<select a database to search>])
BEGIN
  xdico_assign_string(&dico_url.req.database, optarg);  
END

OPTION(source,,ADDR,
       [<set a source address for TCP connections>])
BEGIN
  source_addr = optarg;
END

GROUP([<Operation modes>])

OPTION(match,m,,
       [<match instead of define>])
BEGIN
  mode = mode_match;   
END

OPTION(strategy,s,NAME,
       [<select a strategy for matching; implies --match>])
BEGIN
  xdico_assign_string(&dico_url.req.strategy, optarg);
  mode = mode_match;
END

OPTION(levdist,,N,
       [<set maximum Levenshtein distance>])
ALIAS(levenshtein-distance)
BEGIN
  char *p;
  levenshtein_threshold = strtoul(optarg, &p, 10);
  if (*p)
      dico_die(1, L_ERR, 0, _("%s: invalid number"), optarg);
END

OPTION(dbs,D,,
       [<show available databases>])
BEGIN
  mode = mode_dbs;  
END

OPTION(strategies,S,,
       [<show available search strategies>])
BEGIN
  mode = mode_strats;
END

OPTION(serverhelp,H,,
       [<show server help>])
BEGIN
  mode = mode_help;
END

OPTION(info,i,DBNAME,
       [<show information about database DBNAME>])
BEGIN
  mode = mode_info;
  dico_url.req.database = optarg;
END

OPTION(serverinfo,I,,
       [<show information about the server>])
BEGIN
  mode = mode_server;
END

OPTION(quiet, q,,
       [<do not print the normal dico welcome>])
BEGIN
  quiet_option = 1;
END

GROUP([<Authentication>])

OPTION(noauth,a,,
       [<disable authentication>])
BEGIN
  noauth_option = 1;
END

OPTION(sasl,,,
       [<enable SASL authentication (default)>])
BEGIN
  sasl_enable(1);
END

OPTION(nosasl,,,
       [<disable SASL authentication>])
BEGIN
  sasl_enable(0);
END

OPTION(user,u,NAME,
       [<set user name for authentication>])
BEGIN
  default_cred.user = optarg;
END

OPTION(key, k, STRING,
       [<set shared secret for authentication>])
ALIAS(password)       
BEGIN
  default_cred.pass = optarg;
END

OPTION(autologin,, NAME,
       [<set the name of autologin file to use>])
BEGIN
  autologin_file = optarg;
END  

OPTION(client,c, STRING,
       [<additional text for client command>])
BEGIN
  client = optarg;
END

GROUP([<Debugging>])
OPTION(transcript,t,,
       [<enable session transcript>])
BEGIN
  transcript = 1;
END

OPTION(verbose,v,,
       [<increase debugging verbosity level>])
BEGIN
  debug_level++;
END

OPTION(time-stamp,,,
       [<include time stamp in the debugging output>])
BEGIN
  int n = 1;
  dico_stream_ioctl(debug_stream, DICO_DBG_CTL_SET_TS, &n);
END  

OPTION(source-info,,,
       [<include source line information in the debugging output>])
BEGIN
  debug_source_info = 1;
END  

OPTIONS_END

void
get_options (int argc, char *argv[], int *index)
{
    GETOPT(argc, argv, *index)
}

static char gplv3_text[] = "\
   GNU Dico is free software; you can redistribute it and/or modify\n\
   it under the terms of the GNU General Public License as published by\n\
   the Free Software Foundation; either version 3, or (at your option)\n\
   any later version.\n\
\n\
   GNU Dico is distributed in the hope that it will be useful,\n\
   but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n\
   GNU General Public License for more details.\n\
\n\
   You should have received a copy of the GNU General Public License\n\
   along with GNU Dico.  If not, see <http://www.gnu.org/licenses/>.\n";

void
ds_warranty(int argc, char **argv)
{
    grecs_print_version_only(&proginfo, stdout);
    putchar('\n');
    printf("%s", gplv3_text);
}

void
shell_banner()
{
    grecs_print_version(&proginfo, stdout);
    printf("%s\n\n", _("Type ? for help summary"));
}