Mercurial > emacs
comparison lib-src/etags.c @ 57013:c2ab1ac6a36b
[LONG_OPTIONS]: make it TRUE (ifdef) or FALSE for ease of use.
author | Francesco Potortì <pot@gnu.org> |
---|---|
date | Wed, 08 Sep 2004 16:30:31 +0000 |
parents | 1c425ce93ce9 |
children | cdba91059d7d cce1c0ee76ee |
comparison
equal
deleted
inserted
replaced
57012:28b649226666 | 57013:c2ab1ac6a36b |
---|---|
33 * | 33 * |
34 * Francesco Potort́ <pot@gnu.org> has maintained and improved it since 1993. | 34 * Francesco Potort́ <pot@gnu.org> has maintained and improved it since 1993. |
35 * | 35 * |
36 */ | 36 */ |
37 | 37 |
38 char pot_etags_version[] = "@(#) pot revision number is 16.56"; | 38 char pot_etags_version[] = "@(#) pot revision number is 16.58"; |
39 | 39 |
40 #define TRUE 1 | 40 #define TRUE 1 |
41 #define FALSE 0 | 41 #define FALSE 0 |
42 | 42 |
43 #ifdef DEBUG | 43 #ifdef DEBUG |
74 | 74 |
75 #ifndef _GNU_SOURCE | 75 #ifndef _GNU_SOURCE |
76 # define _GNU_SOURCE 1 /* enables some compiler checks on GNU */ | 76 # define _GNU_SOURCE 1 /* enables some compiler checks on GNU */ |
77 #endif | 77 #endif |
78 | 78 |
79 #ifdef LONG_OPTIONS | |
80 # undef LONG_OPTIONS | |
81 # define LONG_OPTIONS TRUE | |
82 #else | |
83 # define LONG_OPTIONS FALSE | |
84 #endif | |
85 | |
79 /* WIN32_NATIVE is for Xemacs. | 86 /* WIN32_NATIVE is for Xemacs. |
80 MSDOS, WINDOWSNT, DOS_NT are for Emacs. */ | 87 MSDOS, WINDOWSNT, DOS_NT are for Emacs. */ |
81 #ifdef WIN32_NATIVE | 88 #ifdef WIN32_NATIVE |
82 # undef MSDOS | 89 # undef MSDOS |
83 # undef WINDOWSNT | 90 # undef WINDOWSNT |
145 | 152 |
146 #if !defined (S_ISREG) && defined (S_IFREG) | 153 #if !defined (S_ISREG) && defined (S_IFREG) |
147 # define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) | 154 # define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) |
148 #endif | 155 #endif |
149 | 156 |
150 #ifdef LONG_OPTIONS | 157 #if LONG_OPTIONS |
151 # include <getopt.h> | 158 # include <getopt.h> |
152 #else | 159 #else |
153 # define getopt_long(argc,argv,optstr,lopts,lind) getopt (argc, argv, optstr) | 160 # define getopt_long(argc,argv,optstr,lopts,lind) getopt (argc, argv, optstr) |
154 extern char *optarg; | 161 extern char *optarg; |
155 extern int optind, opterr; | 162 extern int optind, opterr; |
463 static bool need_filebuf; /* some regexes are multi-line */ | 470 static bool need_filebuf; /* some regexes are multi-line */ |
464 #else | 471 #else |
465 # define need_filebuf FALSE | 472 # define need_filebuf FALSE |
466 #endif /* ETAGS_REGEXPS */ | 473 #endif /* ETAGS_REGEXPS */ |
467 | 474 |
468 #ifdef LONG_OPTIONS | 475 #if LONG_OPTIONS |
469 static struct option longopts[] = | 476 static struct option longopts[] = |
470 { | 477 { |
471 { "packages-only", no_argument, &packages_only, TRUE }, | 478 { "packages-only", no_argument, &packages_only, TRUE }, |
472 { "c++", no_argument, NULL, 'C' }, | 479 { "c++", no_argument, NULL, 'C' }, |
473 { "declarations", no_argument, &declarations, TRUE }, | 480 { "declarations", no_argument, &declarations, TRUE }, |
843 exit (EXIT_SUCCESS); | 850 exit (EXIT_SUCCESS); |
844 | 851 |
845 printf ("Usage: %s [options] [[regex-option ...] file-name] ...\n\ | 852 printf ("Usage: %s [options] [[regex-option ...] file-name] ...\n\ |
846 \n\ | 853 \n\ |
847 These are the options accepted by %s.\n", progname, progname); | 854 These are the options accepted by %s.\n", progname, progname); |
848 #ifdef LONG_OPTIONS | 855 if (LONG_OPTIONS) |
849 puts ("You may use unambiguous abbreviations for the long option names."); | 856 puts ("You may use unambiguous abbreviations for the long option names."); |
850 #else | 857 else |
851 puts ("Long option names do not work with this executable, as it is not\n\ | 858 puts ("Long option names do not work with this executable, as it is not\n\ |
852 linked with GNU getopt."); | 859 linked with GNU getopt."); |
853 #endif /* LONG_OPTIONS */ | |
854 puts (" A - as file name means read names from stdin (one per line).\n\ | 860 puts (" A - as file name means read names from stdin (one per line).\n\ |
855 Absolute names are stored in the output file as they are.\n\ | 861 Absolute names are stored in the output file as they are.\n\ |
856 Relative ones are stored relative to the output file's directory.\n"); | 862 Relative ones are stored relative to the output file's directory.\n"); |
857 | 863 |
858 if (!CTAGS) | 864 if (!CTAGS) |
1156 | 1162 |
1157 optstring = "-"; | 1163 optstring = "-"; |
1158 #ifdef ETAGS_REGEXPS | 1164 #ifdef ETAGS_REGEXPS |
1159 optstring = "-r:Rc:"; | 1165 optstring = "-r:Rc:"; |
1160 #endif /* ETAGS_REGEXPS */ | 1166 #endif /* ETAGS_REGEXPS */ |
1161 #ifndef LONG_OPTIONS | 1167 if (LONG_OPTIONS) |
1162 optstring = optstring + 1; | 1168 optstring += 1; |
1163 #endif /* LONG_OPTIONS */ | |
1164 optstring = concat (optstring, | 1169 optstring = concat (optstring, |
1165 "Cf:Il:o:SVhH", | 1170 "Cf:Il:o:SVhH", |
1166 (CTAGS) ? "BxdtTuvw" : "aDi:"); | 1171 (CTAGS) ? "BxdtTuvw" : "aDi:"); |
1167 | 1172 |
1168 while ((opt = getopt_long (argc, argv, optstring, longopts, 0)) != EOF) | 1173 while ((opt = getopt_long (argc, argv, optstring, longopts, 0)) != EOF) |
6473 } | 6478 } |
6474 | 6479 |
6475 static void | 6480 static void |
6476 suggest_asking_for_help () | 6481 suggest_asking_for_help () |
6477 { | 6482 { |
6478 | 6483 fprintf (stderr, "\tTry `%s %s' for a complete list of options.\n", |
6479 #ifdef LONG_OPTIONS | 6484 progname, LONG_OPTIONS ? "--help" : "-h"); |
6480 fprintf (stderr, "\tTry `%s %s' for a complete list of options.\n", | |
6481 progname, "--help"); | |
6482 #else | |
6483 fprintf (stderr, "\tTry `%s %s' for a complete list of options.\n", | |
6484 progname, "-h"); | |
6485 #endif | |
6486 exit (EXIT_FAILURE); | 6485 exit (EXIT_FAILURE); |
6487 } | 6486 } |
6488 | 6487 |
6489 /* Print error message. `s1' is printf control string, `s2' is arg for it. */ | 6488 /* Print error message. `s1' is printf control string, `s2' is arg for it. */ |
6490 static void | 6489 static void |