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 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409
|
#line 559 "../../grecs/build-aux/getopt.m4"
/* -*- buffer-read-only: t -*- vi: set ro:
THIS FILE IS GENERATED AUTOMATICALLY. PLEASE DO NOT EDIT.
*/
#line 1 "idxgcide-cli.opt"
/* This file is part of GNU Dico. -*- c -*-
Copyright (C) 2012-2021 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/>. */
#line 67 "idxgcide-cli.opt"
#ifdef HAVE_CONFIG_H
#line 67
# include <config.h>
#line 67
#endif
#line 67
#ifdef HAVE_GETOPT_H
#line 67
# include <getopt.h>
#line 67
#endif
#line 67
#include <unistd.h>
#line 67
#include <stdlib.h>
#line 67
#include <grecs.h>
#line 67
#include <grecs/opt.h>
#line 67
#ifndef EX_USAGE
#line 67
# define EX_USAGE 64
#line 67
#endif
#line 67
/* Option codes */
#line 67
enum {
#line 67
_OPTION_INIT=255,
#line 67 "idxgcide-cli.opt"
OPTION_USAGE,
#line 67 "idxgcide-cli.opt"
MAX_OPTION
#line 67
};
#line 67
#ifdef HAVE_GETOPT_LONG
#line 67
static struct option long_options[] = {
#line 24 "idxgcide-cli.opt"
{ "debug", no_argument, 0, 'd' },
#line 30 "idxgcide-cli.opt"
{ "dry-run", no_argument, 0, 'n' },
#line 37 "idxgcide-cli.opt"
{ "verbose", no_argument, 0, 'v' },
#line 43 "idxgcide-cli.opt"
{ "page-size", required_argument, 0, 'p' },
#line 67 "idxgcide-cli.opt"
{ "help", no_argument, 0, 'h' },
#line 67 "idxgcide-cli.opt"
{ "usage", no_argument, 0, OPTION_USAGE },
#line 67 "idxgcide-cli.opt"
{ "version", no_argument, 0, 'V' },
#line 67 "idxgcide-cli.opt"
{0, 0, 0, 0}
#line 67
};
#line 67
#endif
#line 67
#line 67
static struct grecs_opthelp opthelp[] = {
#line 26 "idxgcide-cli.opt"
{
#line 26
#ifdef HAVE_GETOPT_LONG
#line 26
"-d, --debug",
#line 26
#else
#line 26
"-d",
#line 26
#endif
#line 26
NULL, 0, N_("debug mode") },
#line 32 "idxgcide-cli.opt"
{
#line 32
#ifdef HAVE_GETOPT_LONG
#line 32
"-n, --dry-run",
#line 32
#else
#line 32
"-n",
#line 32
#endif
#line 32
NULL, 0, N_("dry run: do nothing, but print everything") },
#line 39 "idxgcide-cli.opt"
{
#line 39
#ifdef HAVE_GETOPT_LONG
#line 39
"-v, --verbose",
#line 39
#else
#line 39
"-v",
#line 39
#endif
#line 39
NULL, 0, N_("increase verbosity") },
#line 45 "idxgcide-cli.opt"
{
#line 45
#ifdef HAVE_GETOPT_LONG
#line 45
"-p, --page-size",
#line 45
#else
#line 45
"-p",
#line 45
#endif
#line 45
N_("NUMBER"), 0, N_("set index page size") },
#line 67 "idxgcide-cli.opt"
{ NULL, NULL, 0, N_("Other options") },
#line 67 "idxgcide-cli.opt"
{
#line 67
#ifdef HAVE_GETOPT_LONG
#line 67
"-h, --help",
#line 67
#else
#line 67
"-h",
#line 67
#endif
#line 67
NULL, 0, N_("Give this help list") },
#line 67 "idxgcide-cli.opt"
{
#line 67
#ifdef HAVE_GETOPT_LONG
#line 67
"--usage",
#line 67
#else
#line 67
"",
#line 67
#endif
#line 67
NULL, 0, N_("Give a short usage message") },
#line 67 "idxgcide-cli.opt"
{
#line 67
#ifdef HAVE_GETOPT_LONG
#line 67
"-V, --version",
#line 67
#else
#line 67
"-V",
#line 67
#endif
#line 67
NULL, 0, N_("Print program version") },
#line 67 "idxgcide-cli.opt"
};
#line 17 "idxgcide-cli.opt"
#line 17
#line 17
#ifndef PACKAGE_URL
#line 17
# define PACKAGE_URL NULL
#line 17
#endif
#line 17
static struct grecs_proginfo proginfo = {
#line 17
"idxgcide", /* progname */
#line 17
NULL, /* subcommands */
#line 17
N_("standalone indexer for GCIDE dictionaries"), /* docstring */
#line 17
N_("DICTDIR [IDXDIR]"), /* args_doc */
#line 17
opthelp, /* opthelp */
#line 17
sizeof(opthelp)/sizeof(opthelp[0]), /* optcount */
#line 17
NULL, /* print_help_hook */
#line 17
NULL, /* print_version_hook */
#line 17
PACKAGE_NAME, /* package */
#line 17
PACKAGE_VERSION, /* version */
#line 17
NULL, /* license */
#line 17
"2012-2017",/* copyright_year */
#line 17
"Free Software Foundation, Inc.", /* copyright_holder */
#line 17
NULL, /* *authors */
#line 17
"<" PACKAGE_BUGREPORT ">", /* bug_address */
#line 17
PACKAGE_URL, /* url */
#line 17
NULL /* epilogue */
#line 17
};
#line 17
#line 67 "idxgcide-cli.opt"
#line 67
void
get_options(int argc, char *argv[], int *index)
{
#line 72
{
#line 72
int c;
#line 72
#line 72
optind = 0;
#line 72
#ifdef HAVE_GETOPT_LONG
#line 72
while ((c = getopt_long(argc, argv, "dnvp:hV",
#line 72
long_options, NULL)) != EOF)
#line 72
#else
#line 72
while ((c = getopt(argc, argv, "dnvp:hV")) != EOF)
#line 72
#endif
#line 72
{
#line 72
switch (c)
#line 72
{
#line 72
default:
#line 72
exit(EX_USAGE); exit(EX_USAGE);
#line 72
#line 26 "idxgcide-cli.opt"
case 'd':
#line 26
{
#line 26
yy_flex_debug = 1;
#line 28
break;
#line 28
}
#line 32 "idxgcide-cli.opt"
case 'n':
#line 32
{
#line 32
dry_run_option = 1;
verbose_option++;
#line 35
break;
#line 35
}
#line 39 "idxgcide-cli.opt"
case 'v':
#line 39
{
#line 39
verbose_option++;
#line 41
break;
#line 41
}
#line 45 "idxgcide-cli.opt"
case 'p':
#line 45
{
#line 45
char *p;
idx_header.ihdr_pagesize = strtoul(optarg, &p, 10);
switch (*p) {
case 0:
break;
case 'g':
case 'G':
idx_header.ihdr_pagesize <<= 10;
case 'm':
case 'M':
idx_header.ihdr_pagesize <<= 10;
case 'k':
case 'K':
idx_header.ihdr_pagesize <<= 10;
break;
default:
dico_log(L_ERR, 0, _("not a valid size: %s"), optarg);
exit(EX_USAGE);
}
#line 65
break;
#line 65
}
#line 67 "idxgcide-cli.opt"
case 'h':
#line 67
{
#line 67
#line 67
grecs_print_help(&proginfo);
#line 67
exit(0);
#line 67
#line 67
break;
#line 67
}
#line 67 "idxgcide-cli.opt"
case OPTION_USAGE:
#line 67
{
#line 67
#line 67
grecs_print_usage(&proginfo);
#line 67
exit(0);
#line 67
#line 67
break;
#line 67
}
#line 67 "idxgcide-cli.opt"
case 'V':
#line 67
{
#line 67
#line 67
/* Give version */
#line 67
grecs_print_version(&proginfo, stdout);
#line 67
exit(0);
#line 67
#line 67
break;
#line 67
}
#line 72 "idxgcide-cli.opt"
}
#line 72
}
#line 72
*index = optind;
#line 72
}
#line 72
}
|