| 1 |
/* This file is part of GNU Dico. -*- c -*- |
| 2 |
Copyright (C) 2012-2024 Sergey Poznyakoff |
| 3 |
|
| 4 |
GNU Dico 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 Dico 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 Dico. If not, see <http://www.gnu.org/licenses/>. */ |
| 16 |
|
| 17 |
OPTIONS_BEGIN("idxgcide", |
| 18 |
[<standalone indexer for GCIDE dictionaries>], |
| 19 |
[<DICTDIR [IDXDIR]>], |
| 20 |
[<gnu>], |
| 21 |
[<copyright_year=2012-2024>], |
| 22 |
[<copyright_holder=Free Software Foundation, Inc.>]) |
| 23 |
|
| 24 |
OPTION(debug, d,[LETTERS], |
| 25 |
[<debug mode>]) |
| 26 |
BEGIN |
| 27 |
debug_letters = optarg ? optarg : letters; |
| 28 |
END |
| 29 |
|
| 30 |
OPTION(dry-run, n,, |
| 31 |
[<dry run: do nothing, but print everything>]) |
| 32 |
BEGIN |
| 33 |
dry_run_option = 1; |
| 34 |
verbose_option++; |
| 35 |
END |
| 36 |
|
| 37 |
OPTION(verbose, v,, |
| 38 |
[<increase verbosity>]) |
| 39 |
BEGIN |
| 40 |
verbose_option++; |
| 41 |
END |
| 42 |
|
| 43 |
OPTION(page-size,p,NUMBER, |
| 44 |
[<set index page size>]) |
| 45 |
BEGIN |
| 46 |
char *p; |
| 47 |
idx_header.ihdr_pagesize = strtoul(optarg, &p, 10); |
| 48 |
switch (*p) { |
| 49 |
case 0: |
| 50 |
break; |
| 51 |
case 'g': |
| 52 |
case 'G': |
| 53 |
idx_header.ihdr_pagesize <<= 10; |
| 54 |
case 'm': |
| 55 |
case 'M': |
| 56 |
idx_header.ihdr_pagesize <<= 10; |
| 57 |
case 'k': |
| 58 |
case 'K': |
| 59 |
idx_header.ihdr_pagesize <<= 10; |
| 60 |
break; |
| 61 |
default: |
| 62 |
dico_log(L_ERR, 0, _("not a valid size: %s"), optarg); |
| 63 |
exit(EX_USAGE); |
| 64 |
} |
| 65 |
END |
| 66 |
|
| 67 |
OPTION(file-descriptor, #, DESCR, |
| 68 |
[<modify file at the supplied descriptor>]) |
| 69 |
BEGIN |
| 70 |
inherit_fd = atoi(optarg); |
| 71 |
if (inherit_fd <= 0) { |
| 72 |
dico_log(L_ERR, 0, _("bad file descriptor: %s"), optarg); |
| 73 |
exit(EX_USAGE); |
| 74 |
} |
| 75 |
END |
| 76 |
|
| 77 |
OPTIONS_END |
| 78 |
|
| 79 |
void |
| 80 |
get_options(int argc, char *argv[], int *index) |
| 81 |
{ |
| 82 |
GETOPT(argc, argv, *index, exit(EX_USAGE)) |
| 83 |
} |