File: cmdline.c

package info (click to toggle)
dico 2.2-8
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 16,492 kB
  • ctags: 10,331
  • sloc: ansic: 42,330; sh: 40,809; python: 5,400; lex: 2,022; tcl: 1,434; makefile: 1,112; yacc: 672; lisp: 461; awk: 300; perl: 175; php: 59; cpp: 44; fortran: 25; asm: 19; sed: 16; xml: 8
file content (1902 lines) | stat: -rw-r--r-- 28,554 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
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
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
#line 832 "../grecs/build-aux/getopt.m4"
/* -*- buffer-read-only: t -*- vi: set ro:
   THIS FILE IS GENERATED AUTOMATICALLY.  PLEASE DO NOT EDIT.
*/
#line 1 "cmdline.opt"
/* This file is part of GNU Dico. -*- c -*-
   Copyright (C) 1998-2000, 2008, 2010, 2012 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>

#line 21 "cmdline.opt"

#line 21
void print_help(void);
#line 21
void print_usage(void);
#line 193 "cmdline.opt"

#line 193
#include <grecs.h>
#line 193
/* Option codes */
#line 193
enum {
#line 193
	_OPTION_INIT=255,
#line 193
	#line 31 "cmdline.opt"

#line 31
	OPTION_HOST,
#line 51 "cmdline.opt"

#line 51
	OPTION_SOURCE,
#line 75 "cmdline.opt"

#line 75
	OPTION_LEVDIST,
#line 77 "cmdline.opt"

#line 77
	OPTION_LEVENSHTEIN_DISTANCE,
#line 130 "cmdline.opt"

#line 130
	OPTION_SASL,
#line 136 "cmdline.opt"

#line 136
	OPTION_NOSASL,
#line 150 "cmdline.opt"

#line 150
	OPTION_PASSWORD,
#line 155 "cmdline.opt"

#line 155
	OPTION_AUTOLOGIN,
#line 180 "cmdline.opt"

#line 180
	OPTION_TIME_STAMP,
#line 187 "cmdline.opt"

#line 187
	OPTION_SOURCE_INFO,
#line 193 "cmdline.opt"

#line 193
	OPTION_USAGE,

#line 193 "cmdline.opt"
	MAX_OPTION
#line 193
};
#line 193
#ifdef HAVE_GETOPT_LONG
#line 193
static struct option long_options[] = {
#line 193
	#line 31 "cmdline.opt"

#line 31
	{ "host", required_argument, 0, OPTION_HOST },
#line 37 "cmdline.opt"

#line 37
	{ "port", required_argument, 0, 'p' },
#line 45 "cmdline.opt"

#line 45
	{ "database", required_argument, 0, 'd' },
#line 51 "cmdline.opt"

#line 51
	{ "source", required_argument, 0, OPTION_SOURCE },
#line 62 "cmdline.opt"

#line 62
	{ "match", no_argument, 0, 'm' },
#line 68 "cmdline.opt"

#line 68
	{ "strategy", required_argument, 0, 's' },
#line 75 "cmdline.opt"

#line 75
	{ "levdist", required_argument, 0, OPTION_LEVDIST },
#line 77 "cmdline.opt"

#line 77
	{ "levenshtein-distance", required_argument, 0, OPTION_LEVENSHTEIN_DISTANCE },
#line 85 "cmdline.opt"

#line 85
	{ "dbs", no_argument, 0, 'D' },
#line 91 "cmdline.opt"

#line 91
	{ "strategies", no_argument, 0, 'S' },
#line 97 "cmdline.opt"

#line 97
	{ "serverhelp", no_argument, 0, 'H' },
#line 103 "cmdline.opt"

#line 103
	{ "info", required_argument, 0, 'i' },
#line 110 "cmdline.opt"

#line 110
	{ "serverinfo", no_argument, 0, 'I' },
#line 116 "cmdline.opt"

#line 116
	{ "quiet", no_argument, 0, 'q' },
#line 124 "cmdline.opt"

#line 124
	{ "noauth", no_argument, 0, 'a' },
#line 130 "cmdline.opt"

#line 130
	{ "sasl", no_argument, 0, OPTION_SASL },
#line 136 "cmdline.opt"

#line 136
	{ "nosasl", no_argument, 0, OPTION_NOSASL },
#line 142 "cmdline.opt"

#line 142
	{ "user", required_argument, 0, 'u' },
#line 148 "cmdline.opt"

#line 148
	{ "key", required_argument, 0, 'k' },
#line 150 "cmdline.opt"

#line 150
	{ "password", required_argument, 0, OPTION_PASSWORD },
#line 155 "cmdline.opt"

#line 155
	{ "autologin", required_argument, 0, OPTION_AUTOLOGIN },
#line 161 "cmdline.opt"

#line 161
	{ "client", required_argument, 0, 'c' },
#line 168 "cmdline.opt"

#line 168
	{ "transcript", no_argument, 0, 't' },
#line 174 "cmdline.opt"

#line 174
	{ "verbose", no_argument, 0, 'v' },
#line 180 "cmdline.opt"

#line 180
	{ "time-stamp", no_argument, 0, OPTION_TIME_STAMP },
#line 187 "cmdline.opt"

#line 187
	{ "source-info", no_argument, 0, OPTION_SOURCE_INFO },
#line 193 "cmdline.opt"

#line 193
	{ "help", no_argument, 0, 'h' },
#line 193 "cmdline.opt"

#line 193
	{ "usage", no_argument, 0, OPTION_USAGE },
#line 193 "cmdline.opt"

#line 193
	{ "version", no_argument, 0, 'V' },

#line 193 "cmdline.opt"
	{0, 0, 0, 0}
#line 193
};
#line 193
#endif
#line 193
static struct opthelp {
#line 193
	const char *opt;
#line 193
	const char *arg;
#line 193
	int is_optional;
#line 193
	const char *descr;
#line 193
} opthelp[] = {
#line 193
	#line 29 "cmdline.opt"

#line 29
	{ NULL, NULL, 0, N_("Server selection") },
#line 33 "cmdline.opt"

#line 33
	{
#line 33
#ifdef HAVE_GETOPT_LONG
#line 33
	  "--host",
#line 33
#else
#line 33
	  "",
#line 33
#endif
#line 33
				   N_("SERVER"), 0, N_("Connect to this server.") },
#line 39 "cmdline.opt"

#line 39
	{
#line 39
#ifdef HAVE_GETOPT_LONG
#line 39
	  "-p, --port",
#line 39
#else
#line 39
	  "-p",
#line 39
#endif
#line 39
				   N_("SERVICE"), 0, N_("Specify port to connect to.") },
#line 47 "cmdline.opt"

#line 47
	{
#line 47
#ifdef HAVE_GETOPT_LONG
#line 47
	  "-d, --database",
#line 47
#else
#line 47
	  "-d",
#line 47
#endif
#line 47
				   N_("NAME"), 0, N_("Select a database to search.") },
#line 53 "cmdline.opt"

#line 53
	{
#line 53
#ifdef HAVE_GETOPT_LONG
#line 53
	  "--source",
#line 53
#else
#line 53
	  "",
#line 53
#endif
#line 53
				   N_("ADDR"), 0, N_("Set a source address for TCP connections.") },
#line 60 "cmdline.opt"

#line 60
	{ NULL, NULL, 0, N_("Operation modes") },
#line 64 "cmdline.opt"

#line 64
	{
#line 64
#ifdef HAVE_GETOPT_LONG
#line 64
	  "-m, --match",
#line 64
#else
#line 64
	  "-m",
#line 64
#endif
#line 64
				   NULL, 0, N_("Match instead of define.") },
#line 70 "cmdline.opt"

#line 70
	{
#line 70
#ifdef HAVE_GETOPT_LONG
#line 70
	  "-s, --strategy",
#line 70
#else
#line 70
	  "-s",
#line 70
#endif
#line 70
				   N_("NAME"), 0, N_("Select a strategy for matching.  Implies --match.") },
#line 78 "cmdline.opt"

#line 78
	{
#line 78
#ifdef HAVE_GETOPT_LONG
#line 78
	  "--levdist, --levenshtein-distance",
#line 78
#else
#line 78
	  "",
#line 78
#endif
#line 78
				   N_("N"), 0, N_("Set maximum Levenshtein distance to N.") },
#line 87 "cmdline.opt"

#line 87
	{
#line 87
#ifdef HAVE_GETOPT_LONG
#line 87
	  "-D, --dbs",
#line 87
#else
#line 87
	  "-D",
#line 87
#endif
#line 87
				   NULL, 0, N_("Show available databases.") },
#line 93 "cmdline.opt"

#line 93
	{
#line 93
#ifdef HAVE_GETOPT_LONG
#line 93
	  "-S, --strategies",
#line 93
#else
#line 93
	  "-S",
#line 93
#endif
#line 93
				   NULL, 0, N_("Show available search strategies.") },
#line 99 "cmdline.opt"

#line 99
	{
#line 99
#ifdef HAVE_GETOPT_LONG
#line 99
	  "-H, --serverhelp",
#line 99
#else
#line 99
	  "-H",
#line 99
#endif
#line 99
				   NULL, 0, N_("show server help.") },
#line 105 "cmdline.opt"

#line 105
	{
#line 105
#ifdef HAVE_GETOPT_LONG
#line 105
	  "-i, --info",
#line 105
#else
#line 105
	  "-i",
#line 105
#endif
#line 105
				   N_("DBNAME"), 0, N_("Show information about database DBNAME.") },
#line 112 "cmdline.opt"

#line 112
	{
#line 112
#ifdef HAVE_GETOPT_LONG
#line 112
	  "-I, --serverinfo",
#line 112
#else
#line 112
	  "-I",
#line 112
#endif
#line 112
				   NULL, 0, N_("Show information about the server.") },
#line 118 "cmdline.opt"

#line 118
	{
#line 118
#ifdef HAVE_GETOPT_LONG
#line 118
	  "-q, --quiet",
#line 118
#else
#line 118
	  "-q",
#line 118
#endif
#line 118
				   NULL, 0, N_("Do not print the normal dico welcome.") },
#line 122 "cmdline.opt"

#line 122
	{ NULL, NULL, 0, N_("Authentication") },
#line 126 "cmdline.opt"

#line 126
	{
#line 126
#ifdef HAVE_GETOPT_LONG
#line 126
	  "-a, --noauth",
#line 126
#else
#line 126
	  "-a",
#line 126
#endif
#line 126
				   NULL, 0, N_("Disable authentication.") },
#line 132 "cmdline.opt"

#line 132
	{
#line 132
#ifdef HAVE_GETOPT_LONG
#line 132
	  "--sasl",
#line 132
#else
#line 132
	  "",
#line 132
#endif
#line 132
				   NULL, 0, N_("Enable SASL authentication (default).") },
#line 138 "cmdline.opt"

#line 138
	{
#line 138
#ifdef HAVE_GETOPT_LONG
#line 138
	  "--nosasl",
#line 138
#else
#line 138
	  "",
#line 138
#endif
#line 138
				   NULL, 0, N_("Disable SASL authentication.") },
#line 144 "cmdline.opt"

#line 144
	{
#line 144
#ifdef HAVE_GETOPT_LONG
#line 144
	  "-u, --user",
#line 144
#else
#line 144
	  "-u",
#line 144
#endif
#line 144
				   N_("NAME"), 0, N_("Set user name for authentication.") },
#line 151 "cmdline.opt"

#line 151
	{
#line 151
#ifdef HAVE_GETOPT_LONG
#line 151
	  "-k, --key, --password",
#line 151
#else
#line 151
	  "-k",
#line 151
#endif
#line 151
				   N_("STRING"), 0, N_("Set shared secret for authentication.") },
#line 157 "cmdline.opt"

#line 157
	{
#line 157
#ifdef HAVE_GETOPT_LONG
#line 157
	  "--autologin",
#line 157
#else
#line 157
	  "",
#line 157
#endif
#line 157
				   N_("NAME"), 0, N_("Set the name of autologin file to use.") },
#line 163 "cmdline.opt"

#line 163
	{
#line 163
#ifdef HAVE_GETOPT_LONG
#line 163
	  "-c, --client",
#line 163
#else
#line 163
	  "-c",
#line 163
#endif
#line 163
				   N_("STRING"), 0, N_("Additional text for client command.") },
#line 167 "cmdline.opt"

#line 167
	{ NULL, NULL, 0, N_("Debugging") },
#line 170 "cmdline.opt"

#line 170
	{
#line 170
#ifdef HAVE_GETOPT_LONG
#line 170
	  "-t, --transcript",
#line 170
#else
#line 170
	  "-t",
#line 170
#endif
#line 170
				   NULL, 0, N_("Enable session transcript.") },
#line 176 "cmdline.opt"

#line 176
	{
#line 176
#ifdef HAVE_GETOPT_LONG
#line 176
	  "-v, --verbose",
#line 176
#else
#line 176
	  "-v",
#line 176
#endif
#line 176
				   NULL, 0, N_("Increase debugging verbosity level.") },
#line 182 "cmdline.opt"

#line 182
	{
#line 182
#ifdef HAVE_GETOPT_LONG
#line 182
	  "--time-stamp",
#line 182
#else
#line 182
	  "",
#line 182
#endif
#line 182
				   NULL, 0, N_("Include time stamp in the debugging output.") },
#line 189 "cmdline.opt"

#line 189
	{
#line 189
#ifdef HAVE_GETOPT_LONG
#line 189
	  "--source-info",
#line 189
#else
#line 189
	  "",
#line 189
#endif
#line 189
				   NULL, 0, N_("Include source line information in the debugging output.") },
#line 193 "cmdline.opt"

#line 193
	{ NULL, NULL, 0, N_("Other options") },
#line 193 "cmdline.opt"

#line 193
	{
#line 193
#ifdef HAVE_GETOPT_LONG
#line 193
	  "-h, --help",
#line 193
#else
#line 193
	  "-h",
#line 193
#endif
#line 193
				   NULL, 0, N_("Give this help list") },
#line 193 "cmdline.opt"

#line 193
	{
#line 193
#ifdef HAVE_GETOPT_LONG
#line 193
	  "--usage",
#line 193
#else
#line 193
	  "",
#line 193
#endif
#line 193
				   NULL, 0, N_("Give a short usage message") },
#line 193 "cmdline.opt"

#line 193
	{
#line 193
#ifdef HAVE_GETOPT_LONG
#line 193
	  "-V, --version",
#line 193
#else
#line 193
	  "-V",
#line 193
#endif
#line 193
				   NULL, 0, N_("Print program version") },

#line 193 "cmdline.opt"
};
#line 21 "cmdline.opt"

#line 21
const char *program_version = "dico" " (" PACKAGE_NAME ") " PACKAGE_VERSION;
#line 21
static char doc[] = N_("GNU dictionary client program");
#line 21
static char args_doc[] = N_("[URL-or-WORD]");
#line 21
const char *program_bug_address = "<" PACKAGE_BUGREPORT ">";
#line 21
struct grecs_node *cmdline_tree;
#line 21

#line 21
#define DESCRCOLUMN 30
#line 21
#define RMARGIN 79
#line 21
#define GROUPCOLUMN 2
#line 21
#define USAGECOLUMN 13
#line 21

#line 21
static void
#line 21
indent (size_t start, size_t col)
#line 21
{
#line 21
  for (; start < col; start++)
#line 21
    putchar (' ');
#line 21
}
#line 21

#line 21
static void
#line 21
print_option_descr (const char *descr, size_t lmargin, size_t rmargin)
#line 21
{
#line 21
  while (*descr)
#line 21
    {
#line 21
      size_t s = 0;
#line 21
      size_t i;
#line 21
      size_t width = rmargin - lmargin;
#line 21

#line 21
      for (i = 0; ; i++)
#line 21
	{
#line 21
	  if (descr[i] == 0 || descr[i] == ' ' || descr[i] == '\t')
#line 21
	    {
#line 21
	      if (i > width)
#line 21
		break;
#line 21
	      s = i;
#line 21
	      if (descr[i] == 0)
#line 21
		break;
#line 21
	    }
#line 21
	}
#line 21
      printf ("%*.*s\n", s, s, descr);
#line 21
      descr += s;
#line 21
      if (*descr)
#line 21
	{
#line 21
	  indent (0, lmargin);
#line 21
	  descr++;
#line 21
	}
#line 21
    }
#line 21
}
#line 21

#line 21
#define NOPTHELP (sizeof (opthelp) / sizeof (opthelp[0]))
#line 21

#line 21
static int
#line 21
optcmp (const void *a, const void *b)
#line 21
{
#line 21
  struct opthelp const *ap = (struct opthelp const *)a;
#line 21
  struct opthelp const *bp = (struct opthelp const *)b;
#line 21
  const char *opta, *optb;
#line 21
  size_t alen, blen;
#line 21

#line 21
  for (opta = ap->opt; *opta == '-'; opta++)
#line 21
    ;
#line 21
  alen = strcspn (opta, ",");
#line 21
  
#line 21
  for (optb = bp->opt; *optb == '-'; optb++)
#line 21
    ;
#line 21
  blen = strcspn (optb, ",");
#line 21

#line 21
  if (alen > blen)
#line 21
    blen = alen;
#line 21
  
#line 21
  return strncmp (opta, optb, blen);
#line 21
}
#line 21

#line 21
static void
#line 21
sort_options (int start, int count)
#line 21
{
#line 21
  qsort (opthelp + start, count, sizeof (opthelp[0]), optcmp);
#line 21
}
#line 21

#line 21
static int
#line 21
sort_group (int start)
#line 21
{
#line 21
  int i;
#line 21
  
#line 21
  for (i = start; i < NOPTHELP && opthelp[i].opt; i++)
#line 21
    ;
#line 21
  sort_options (start, i - start);
#line 21
  return i + 1;
#line 21
}
#line 21

#line 21
static void
#line 21
sort_opthelp (void)
#line 21
{
#line 21
  int start;
#line 21

#line 21
  for (start = 0; start < NOPTHELP; )
#line 21
    {
#line 21
      if (!opthelp[start].opt)
#line 21
	start = sort_group (start + 1);
#line 21
      else 
#line 21
	start = sort_group (start);
#line 21
    }
#line 21
}
#line 21

#line 21
void (*print_help_hook) (FILE *stream);
#line 21

#line 21
void
#line 21
print_help (void)
#line 21
{
#line 21
  unsigned i;
#line 21
  int argsused = 0;
#line 21

#line 21
  printf ("%s %s [%s]... %s\n", _("Usage:"), "dico", _("OPTION"),
#line 21
	  args_doc[0] ? gettext (args_doc) : args_doc);
#line 21
  if (doc[0])
#line 21
    print_option_descr(gettext (doc), 0, RMARGIN);
#line 21
  putchar ('\n');
#line 21

#line 21
  sort_opthelp ();
#line 21
  for (i = 0; i < NOPTHELP; i++)
#line 21
    {
#line 21
      unsigned n;
#line 21
      if (opthelp[i].opt)
#line 21
	{
#line 21
	  n = printf ("  %s", opthelp[i].opt);
#line 21
	  if (opthelp[i].arg)
#line 21
	    {
#line 21
	      char *cb, *ce;
#line 21
	      argsused = 1;
#line 21
	      if (strlen (opthelp[i].opt) == 2)
#line 21
		{
#line 21
		  if (!opthelp[i].is_optional)
#line 21
		    {
#line 21
		      putchar (' ');
#line 21
		      n++;
#line 21
		    }
#line 21
		}
#line 21
	      else
#line 21
		{
#line 21
		  putchar ('=');
#line 21
		  n++;
#line 21
		}
#line 21
	      if (opthelp[i].is_optional)
#line 21
		{
#line 21
		  cb = "[";
#line 21
		  ce = "]";
#line 21
		}
#line 21
	      else
#line 21
		cb = ce = "";
#line 21
	      n += printf ("%s%s%s", cb, gettext (opthelp[i].arg), ce);
#line 21
	    }
#line 21
	  if (n >= DESCRCOLUMN)
#line 21
	    {
#line 21
	      putchar ('\n');
#line 21
	      n = 0;
#line 21
	    }
#line 21
	  indent (n, DESCRCOLUMN);
#line 21
	  print_option_descr (gettext (opthelp[i].descr), DESCRCOLUMN, RMARGIN);
#line 21
	}
#line 21
      else
#line 21
	{
#line 21
	  if (i)
#line 21
	    putchar ('\n');
#line 21
	  indent (0, GROUPCOLUMN);
#line 21
	  print_option_descr (gettext (opthelp[i].descr),
#line 21
			      GROUPCOLUMN, RMARGIN);
#line 21
	  putchar ('\n');
#line 21
	}
#line 21
    }
#line 21

#line 21
  putchar ('\n');
#line 21
  if (argsused)
#line 21
    {
#line 21
      print_option_descr (_("Mandatory or optional arguments to long options are also mandatory or optional for any corresponding short options."), 0, RMARGIN);
#line 21
      putchar ('\n');
#line 21
    }
#line 21
 
#line 21
  if (print_help_hook)
#line 21
    print_help_hook (stdout);
#line 21
    
#line 21
 /* TRANSLATORS: The placeholder indicates the bug-reporting address
    for this package.  Please add _another line_ saying
    "Report translation bugs to <...>\n" with the address for translation
    bugs (typically your translation team's web or email address).  */
#line 21
  printf (_("Report bugs to %s.\n"), program_bug_address);
#line 21
  
#line 21
#ifdef PACKAGE_URL
#line 21
  printf (_("%s home page: <%s>\n"), PACKAGE_NAME, PACKAGE_URL);
#line 21
#else
#line 21
  printf (_("%s home page: <http://www.gnu.org/software/%s/>\n"),
#line 21
	  PACKAGE_NAME, PACKAGE);
#line 21
#endif
#line 21
  fputs (_("General help using GNU software: <http://www.gnu.org/gethelp/>\n"),
#line 21
	 stdout);
#line 21
}
#line 21

#line 21
static int
#line 21
cmpidx_short (const void *a, const void *b)
#line 21
{
#line 21
  unsigned const *ai = (unsigned const *)a;
#line 21
  unsigned const *bi = (unsigned const *)b;
#line 21

#line 21
  return opthelp[*ai].opt[1] - opthelp[*bi].opt[1];
#line 21
}
#line 21
  
#line 21
#ifdef HAVE_GETOPT_LONG
#line 21
static int
#line 21
cmpidx_long (const void *a, const void *b)
#line 21
{
#line 21
  unsigned const *ai = (unsigned const *)a;
#line 21
  unsigned const *bi = (unsigned const *)b;
#line 21
  struct opthelp const *ap = opthelp + *ai;
#line 21
  struct opthelp const *bp = opthelp + *bi;
#line 21
  char const *opta, *optb;
#line 21
  size_t lena, lenb;
#line 21

#line 21
  if (ap->opt[1] == '-')
#line 21
    opta = ap->opt;
#line 21
  else
#line 21
    opta = ap->opt + 4;
#line 21
  lena = strcspn (opta, ",");
#line 21
  
#line 21
  if (bp->opt[1] == '-')
#line 21
    optb = bp->opt;
#line 21
  else
#line 21
    optb = bp->opt + 4;
#line 21
  lenb = strcspn (optb, ",");
#line 21
  return strncmp (opta, optb, lena > lenb ? lenb : lena);
#line 21
}
#line 21
#endif
#line 21

#line 21
void
#line 21
print_usage (void)
#line 21
{
#line 21
  unsigned i;
#line 21
  unsigned n;
#line 21
  char buf[RMARGIN+1];
#line 21
  unsigned *idxbuf;
#line 21
  unsigned nidx;
#line 21
  
#line 21
#define FLUSH                        do                                   {                              	  buf[n] = 0;              	  printf ("%s\n", buf);    	  n = USAGECOLUMN;         	  memset (buf, ' ', n);        }                                while (0)
#line 21
#define ADDC(c)   do { if (n == RMARGIN) FLUSH; buf[n++] = c; } while (0)
#line 21

#line 21
  idxbuf = calloc (NOPTHELP, sizeof (idxbuf[0]));
#line 21
  if (!idxbuf)
#line 21
    {
#line 21
      fprintf (stderr, "not enough memory");
#line 21
      abort ();
#line 21
    }
#line 21

#line 21
  n = snprintf (buf, sizeof buf, "%s %s ", _("Usage:"), "dico");
#line 21

#line 21
  /* Print a list of short options without arguments. */
#line 21
  for (i = nidx = 0; i < NOPTHELP; i++)
#line 21
      if (opthelp[i].opt && opthelp[i].descr && opthelp[i].opt[1] != '-'
#line 21
	  && opthelp[i].arg == NULL)
#line 21
	idxbuf[nidx++] = i;
#line 21

#line 21
  if (nidx)
#line 21
    {
#line 21
      qsort (idxbuf, nidx, sizeof (idxbuf[0]), cmpidx_short);
#line 21

#line 21
      ADDC ('[');
#line 21
      ADDC ('-');
#line 21
      for (i = 0; i < nidx; i++)
#line 21
	{
#line 21
	  ADDC (opthelp[idxbuf[i]].opt[1]);
#line 21
	}
#line 21
      ADDC (']');
#line 21
    }
#line 21

#line 21
  /* Print a list of short options with arguments. */
#line 21
  for (i = nidx = 0; i < NOPTHELP; i++)
#line 21
    {
#line 21
      if (opthelp[i].opt && opthelp[i].descr && opthelp[i].opt[1] != '-'
#line 21
	  && opthelp[i].arg)
#line 21
	idxbuf[nidx++] = i;
#line 21
    }
#line 21

#line 21
  if (nidx)
#line 21
    {
#line 21
      qsort (idxbuf, nidx, sizeof (idxbuf[0]), cmpidx_short);
#line 21
    
#line 21
      for (i = 0; i < nidx; i++)
#line 21
	{
#line 21
	  struct opthelp *opt = opthelp + idxbuf[i];
#line 21
	  size_t len = 5 + strlen (opt->arg)
#line 21
	                 + (opt->is_optional ? 2 : 1);
#line 21
      
#line 21
	  if (n + len > RMARGIN) FLUSH;
#line 21
	  buf[n++] = ' ';
#line 21
	  buf[n++] = '[';
#line 21
	  buf[n++] = '-';
#line 21
	  buf[n++] = opt->opt[1];
#line 21
	  if (opt->is_optional)
#line 21
	    {
#line 21
	      buf[n++] = '[';
#line 21
	      strcpy (&buf[n], opt->arg);
#line 21
	      n += strlen (opt->arg);
#line 21
	      buf[n++] = ']';
#line 21
	    }
#line 21
	  else
#line 21
	    {
#line 21
	      buf[n++] = ' ';
#line 21
	      strcpy (&buf[n], opt->arg);
#line 21
	      n += strlen (opt->arg);
#line 21
	    }
#line 21
	  buf[n++] = ']';
#line 21
	}
#line 21
    }
#line 21
  
#line 21
#ifdef HAVE_GETOPT_LONG
#line 21
  /* Print a list of long options */
#line 21
  for (i = nidx = 0; i < NOPTHELP; i++)
#line 21
    {
#line 21
      if (opthelp[i].opt && opthelp[i].descr
#line 21
	  &&  (opthelp[i].opt[1] == '-' || opthelp[i].opt[2] == ','))
#line 21
	idxbuf[nidx++] = i;
#line 21
    }
#line 21

#line 21
  if (nidx)
#line 21
    {
#line 21
      qsort (idxbuf, nidx, sizeof (idxbuf[0]), cmpidx_long);
#line 21
	
#line 21
      for (i = 0; i < nidx; i++)
#line 21
	{
#line 21
	  struct opthelp *opt = opthelp + idxbuf[i];
#line 21
	  size_t len;
#line 21
	  const char *longopt;
#line 21
	  
#line 21
	  if (opt->opt[1] == '-')
#line 21
	    longopt = opt->opt;
#line 21
	  else if (opt->opt[2] == ',')
#line 21
	    longopt = opt->opt + 4;
#line 21
	  else
#line 21
	    continue;
#line 21

#line 21
	  len = 3 + strlen (longopt)
#line 21
	          + (opt->arg ? 1 + strlen (opt->arg)
#line 21
		  + (opt->is_optional ? 2 : 0) : 0);
#line 21
	  if (n + len > RMARGIN) FLUSH;
#line 21
	  buf[n++] = ' ';
#line 21
	  buf[n++] = '[';
#line 21
	  strcpy (&buf[n], longopt);
#line 21
	  n += strlen (longopt);
#line 21
	  if (opt->arg)
#line 21
	    {
#line 21
	      buf[n++] = '=';
#line 21
	      if (opt->is_optional)
#line 21
		{
#line 21
		  buf[n++] = '[';
#line 21
		  strcpy (&buf[n], opt->arg);
#line 21
		  n += strlen (opt->arg);
#line 21
		  buf[n++] = ']';
#line 21
		}
#line 21
	      else
#line 21
		{
#line 21
		  strcpy (&buf[n], opt->arg);
#line 21
		  n += strlen (opt->arg);
#line 21
		}
#line 21
	    }
#line 21
	  buf[n++] = ']';
#line 21
	}
#line 21
    }
#line 21
#endif
#line 21
  FLUSH;
#line 21
  free (idxbuf);
#line 21
}
#line 21

#line 21
const char version_etc_copyright[] =
#line 21
  /* Do *not* mark this string for translation.  First %s is a copyright
     symbol suitable for this locale, and second %s are the copyright
     years.  */
#line 21
  "Copyright %s %s %s";
#line 21

#line 21
void
#line 21
print_version_only(const char *program_version, FILE *stream)
#line 21
{
#line 21
  fprintf (stream, "%s\n", program_version);
#line 21
  /* TRANSLATORS: Translate "(C)" to the copyright symbol
     (C-in-a-circle), if this symbol is available in the user's
     locale.  Otherwise, do not translate "(C)"; leave it as-is.  */
#line 21
  fprintf (stream, version_etc_copyright, _("(C)"),
#line 21
	   "2005-2012",
#line 21
	   "Free Software Foundation, Inc.");
#line 21
  fputc ('\n', stream);
#line 21
}
#line 21

#line 21

#line 21

#line 21
void (*print_version_hook)(FILE *stream);
#line 21

#line 21
void
#line 21
print_version(const char *program_version, FILE *stream)
#line 21
{
#line 21
  
#line 21
  print_version_only(program_version, stream);
#line 21

#line 21
  fputs (_("License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law.\n\n"),
#line 21
	 stream);
#line 21
  if (print_version_hook)
#line 21
    print_version_hook (stream);
#line 21
		
#line 21
}
#line 21

#line 193 "cmdline.opt"

#line 193


void
get_options (int argc, char *argv[], int *index)
{
    
#line 198
 {
#line 198
  int c;
#line 198

#line 198
#ifdef HAVE_GETOPT_LONG
#line 198
  while ((c = getopt_long(argc, argv, "p:d:ms:DSHi:Iqau:k:c:tvhV",
#line 198
			  long_options, NULL)) != EOF)
#line 198
#else
#line 198
  while ((c = getopt(argc, argv, "p:d:ms:DSHi:Iqau:k:c:tvhV")) != EOF)
#line 198
#endif
#line 198
    {
#line 198
      switch (c)
#line 198
	{
#line 198
	default:
#line 198
	   	   exit(EX_USAGE);
#line 198
	#line 33 "cmdline.opt"
	 case OPTION_HOST:
#line 33
	  {
#line 33

  xdico_assign_string(&dico_url.host, optarg);

#line 35
	     break;
#line 35
	  }
#line 39 "cmdline.opt"
	 case 'p':
#line 39
	  {
#line 39

  dico_url.port = str2port(optarg);
  if (dico_url.port == -1)
      dico_die(1, L_ERR, 0, _("Invalid port"));  

#line 43
	     break;
#line 43
	  }
#line 47 "cmdline.opt"
	 case 'd':
#line 47
	  {
#line 47

  xdico_assign_string(&dico_url.req.database, optarg);  

#line 49
	     break;
#line 49
	  }
#line 53 "cmdline.opt"
	 case OPTION_SOURCE:
#line 53
	  {
#line 53

  source_addr = optarg;
  if (source_addr == 0)
    dico_die(1, 0, L_ERR, _("%s: Invalid IP or unknown host name"),
             optarg);

#line 58
	     break;
#line 58
	  }
#line 64 "cmdline.opt"
	 case 'm':
#line 64
	  {
#line 64

  mode = mode_match;   

#line 66
	     break;
#line 66
	  }
#line 70 "cmdline.opt"
	 case 's':
#line 70
	  {
#line 70

  xdico_assign_string(&dico_url.req.strategy, optarg);
  mode = mode_match;

#line 73
	     break;
#line 73
	  }
#line 78 "cmdline.opt"
	 case OPTION_LEVDIST: case OPTION_LEVENSHTEIN_DISTANCE:
#line 78
	  {
#line 78

  char *p;
  levenshtein_threshold = strtoul(optarg, &p, 10);
  if (*p)
      dico_die(1, L_ERR, 0, _("%s: invalid number"), optarg);

#line 83
	     break;
#line 83
	  }
#line 87 "cmdline.opt"
	 case 'D':
#line 87
	  {
#line 87

  mode = mode_dbs;  

#line 89
	     break;
#line 89
	  }
#line 93 "cmdline.opt"
	 case 'S':
#line 93
	  {
#line 93

  mode = mode_strats;

#line 95
	     break;
#line 95
	  }
#line 99 "cmdline.opt"
	 case 'H':
#line 99
	  {
#line 99

  mode = mode_help;

#line 101
	     break;
#line 101
	  }
#line 105 "cmdline.opt"
	 case 'i':
#line 105
	  {
#line 105

  mode = mode_info;
  dico_url.req.database = optarg;

#line 108
	     break;
#line 108
	  }
#line 112 "cmdline.opt"
	 case 'I':
#line 112
	  {
#line 112

  mode = mode_server;

#line 114
	     break;
#line 114
	  }
#line 118 "cmdline.opt"
	 case 'q':
#line 118
	  {
#line 118

  quiet_option = 1;

#line 120
	     break;
#line 120
	  }
#line 126 "cmdline.opt"
	 case 'a':
#line 126
	  {
#line 126

  noauth_option = 1;

#line 128
	     break;
#line 128
	  }
#line 132 "cmdline.opt"
	 case OPTION_SASL:
#line 132
	  {
#line 132

  sasl_enable(1);

#line 134
	     break;
#line 134
	  }
#line 138 "cmdline.opt"
	 case OPTION_NOSASL:
#line 138
	  {
#line 138

  sasl_enable(0);

#line 140
	     break;
#line 140
	  }
#line 144 "cmdline.opt"
	 case 'u':
#line 144
	  {
#line 144

  default_cred.user = optarg;

#line 146
	     break;
#line 146
	  }
#line 151 "cmdline.opt"
	 case 'k': case OPTION_PASSWORD:
#line 151
	  {
#line 151

  default_cred.pass = optarg;

#line 153
	     break;
#line 153
	  }
#line 157 "cmdline.opt"
	 case OPTION_AUTOLOGIN:
#line 157
	  {
#line 157

  autologin_file = optarg;

#line 159
	     break;
#line 159
	  }
#line 163 "cmdline.opt"
	 case 'c':
#line 163
	  {
#line 163

  client = optarg;

#line 165
	     break;
#line 165
	  }
#line 170 "cmdline.opt"
	 case 't':
#line 170
	  {
#line 170

  transcript = 1;

#line 172
	     break;
#line 172
	  }
#line 176 "cmdline.opt"
	 case 'v':
#line 176
	  {
#line 176

  debug_level++;

#line 178
	     break;
#line 178
	  }
#line 182 "cmdline.opt"
	 case OPTION_TIME_STAMP:
#line 182
	  {
#line 182

  int n = 1;
  dico_stream_ioctl(debug_stream, DICO_DBG_CTL_SET_TS, &n);

#line 185
	     break;
#line 185
	  }
#line 189 "cmdline.opt"
	 case OPTION_SOURCE_INFO:
#line 189
	  {
#line 189

  debug_source_info = 1;

#line 191
	     break;
#line 191
	  }
#line 193 "cmdline.opt"
	 case 'h':
#line 193
	  {
#line 193

#line 193
		print_help ();
#line 193
		exit (0);
#line 193
	 
#line 193
	     break;
#line 193
	  }
#line 193 "cmdline.opt"
	 case OPTION_USAGE:
#line 193
	  {
#line 193

#line 193
		print_usage ();
#line 193
		exit (0);
#line 193
	 
#line 193
	     break;
#line 193
	  }
#line 193 "cmdline.opt"
	 case 'V':
#line 193
	  {
#line 193

#line 193
		/* Give version */
#line 193
		print_version(program_version, stdout);
#line 193
		exit (0);
#line 193
	 
#line 193
	     break;
#line 193
	  }

#line 198 "cmdline.opt"
	}
#line 198
    }
#line 198
  *index = optind;
#line 198
  if (cmdline_tree)
#line 198
    {
#line 198
      struct grecs_node *rn = grecs_node_create(grecs_node_root, NULL);
#line 198
      rn->down = cmdline_tree;
#line 198
      cmdline_tree = rn;
#line 198
    }
#line 198
 }
#line 198

}