diff options
-rw-r--r-- | ABOUT-NLS | 111 | ||||
-rw-r--r-- | ChangeLog | 39 | ||||
-rw-r--r-- | Makefile.am | 9 | ||||
-rw-r--r-- | Makefile.in | 46 | ||||
-rw-r--r-- | NEWS | 72 | ||||
-rw-r--r-- | THANKS | 13 | ||||
-rw-r--r-- | TODO | 31 | ||||
-rw-r--r-- | acconfig.h | 12 | ||||
-rw-r--r-- | aclocal.m4 | 208 | ||||
-rw-r--r-- | config.h.in | 57 | ||||
-rwxr-xr-x | configure | 659 | ||||
-rw-r--r-- | configure.in | 44 | ||||
-rw-r--r-- | doc/Makefile.am | 2 | ||||
-rw-r--r-- | doc/Makefile.in | 8 | ||||
-rw-r--r-- | doc/id-utils.info | 1890 | ||||
-rw-r--r-- | doc/id-utils.texi | 1921 | ||||
-rw-r--r-- | doc/version.texi | 6 | ||||
-rw-r--r-- | lib/Makefile.am | 32 | ||||
-rw-r--r-- | lib/Makefile.in | 193 | ||||
-rw-r--r-- | lib/basename.c | 42 | ||||
-rw-r--r-- | lib/dirname.c | 9 | ||||
-rw-r--r-- | lib/error.c | 6 | ||||
-rw-r--r-- | lib/obstack.c | 48 | ||||
-rw-r--r-- | lib/obstack.h | 97 | ||||
-rw-r--r-- | lib/strndup.c | 10 | ||||
-rw-r--r-- | lib/xmalloc.h | 38 | ||||
-rw-r--r-- | po/Makefile.in.in | 70 | ||||
-rw-r--r-- | po/POTFILES.in | 18 | ||||
-rw-r--r-- | po/de.po | 758 | ||||
-rw-r--r-- | po/fr.po | 802 | ||||
-rw-r--r-- | src/Makefile.am | 7 | ||||
-rw-r--r-- | src/Makefile.in | 75 | ||||
-rw-r--r-- | src/aid | 4 | ||||
-rw-r--r-- | src/defid | 4 | ||||
-rw-r--r-- | src/eid | 4 | ||||
-rw-r--r-- | src/fid.c | 110 | ||||
-rw-r--r-- | src/gid | 4 | ||||
-rw-r--r-- | src/lid.c | 922 | ||||
-rw-r--r-- | src/mkid.c | 213 |
39 files changed, 4698 insertions, 3896 deletions
@@ -2,9 +2,9 @@ Notes on the GNU Translation Project ************************************ GNU is going international! The GNU Translation Project is a way to -get maintainers, translators and users all together, so GNU will -gradually become able to speak many native languages. A few packages -already provide native language translation for their messages. +get maintainers, translators, and users all together, so that GNU will +gradually become able to speak many languages. A few packages already +provide translations for their messages. If you found this `ABOUT-NLS' file inside a GNU distribution, you may assume that the distributed package does use GNU `gettext' @@ -28,7 +28,7 @@ One advise in advance If you want to exploit the full power of internationalization, you should configure it using - ./configure --with-gnu-gettext + ./configure --with-included-gettext to force usage of internationalizing routines provided within this package, despite the existence of internationalizing capabilities in @@ -58,7 +58,7 @@ the GNU `gettext' package is *not* required. Installers may use special options at configuration time for changing the default behaviour. The commands: - ./configure --with-gnu-gettext + ./configure --with-included-gettext ./configure --with-catgets ./configure --disable-nls @@ -75,7 +75,7 @@ should use the more recent version of the GNU `gettext' library. I.e. if the file `intl/VERSION' shows that the library which comes with this package is more recent, you should use - ./configure --with-gnu-gettext + ./configure --with-included-gettext to prevent auto-detection. @@ -90,7 +90,7 @@ want to use the `catgets' functions use to enable the test for `catgets' (this causes no harm if `catgets' is not available on your system). If you really select this option we would like to hear about the reasons because we cannot think of any -good one outself. +good one ourself. Internationalized packages have usually many `po/LL.po' files, where LL gives an ISO 639 two-letter code identifying the language. Unless @@ -127,59 +127,96 @@ leaving `LANG' to `sv'. Translating Teams ================= - The GNU `gettext' tool set contains *everything* maintainers need -for internationalizing their packages for messages. It also contains -quite useful tools for helping translators at localizing messages to -their native language, once a package has already been -internationalized. - - To achieve the GNU Translation Project, we need many interested + For the GNU Translation Project to be a success, we need interested people who like their own language and write it well, and who are also able to synergize with other translators speaking the same language. -Each translating team has its own mailing list, courtesy of Linux -International. You may reach your translating team at the address +Each translation team has its own mailing list, courtesy of Linux +International. You may reach your translation team at the address `LL@li.org', replacing LL by the two-letter ISO 639 code for your -language. Language codes are *not* the same as country codes given in -ISO 3166. The following translating teams exist, as of April 1996: +language. Language codes are *not* the same as the country codes given +in ISO 3166. The following translation teams exist, as of May 1996: - Chinese `zh', Czech `cs', Danish `da', Dutch `nl', English `en', - Esperanto `eo', Finnish `fi', French `fr', Irish `ga', German - `de', Greek `el', Italian `it', Japanese `ja', Indonesian `in', + Arabic `ar', Chinese `zh', Czech `cs', Danish `da', Dutch `nl', + English `en', Esperanto `eo', Finnish `fi', French `fr', German + `de', Greek `el', Hebrew `he', Hungarian `hu', Irish `ga', Italian + `it', Indonesian `id', Japanese `ja', Korean `ko', Latin `la', Norwegian `no', Persian `fa', Polish `pl', Portuguese `pt', - Russian `ru', Spanish `es', Swedish `sv', Telugu `te' and Turkish - `tr'. + Russian `ru', Slovenian `sl', Spanish `es', Swedish `sv', Telugu + `te', Turkish `tr' and Ukrainian `uk'. -For example, you may reach the Chinese translating team by writing to +For example, you may reach the Chinese translation team by writing to `zh@li.org'. If you'd like to volunteer to *work* at translating messages, you should become a member of the translating team for your own language. The subscribing address is *not* the same as the list itself, it has -`-request' appended. For example, Swedish people can send a message to -`sv-request@li.org', having this message body: +`-request' appended. For example, speakers of Swedish can send a +message to `sv-request@li.org', having this message body: subscribe - Keep in mind that team members should be interested in *working* at -translations, or at solving translational difficulties, rather than -merely lurking around. If your team does not exist yet and you want to -start one, please write to `gnu-translation@gnu.ai.mit.edu'; you will -then reach the GNU coordinator for all translator teams. + Keep in mind that team members are expected to participate +*actively* in translations, or at solving translational difficulties, +rather than merely lurking around. If your team does not exist yet and +you want to start one, or if you are unsure about what to do or how to +get started, please write to `gnu-translation@gnu.ai.mit.edu' to reach +the GNU coordinator for all translator teams. The English team is special. It works at improving and uniformizing the terminology used in GNU. Proven linguistic skill are praised more than programming skill, here. For the time being, please avoid -subscribing to the English team unless explicitely invited to do so. +subscribing to the English team unless explicitly invited to do so. Available Packages ================== Languages are not equally supported in all GNU packages. The following matrix shows the current state of GNU internationalization, -as of April 1996. Listed are: internationalized packages, and languages -for which work is in progress, or about to start. - - - If April 1996 seems to be old, you may fetch a more recent copy of +as of May 1996. The matrix shows, in regard of each package, for which +languages PO files have been submitted to translation coordination. + + cs de en es fi fr ja ko nl no pl pt sl sv + .-------------------------------------------. + bash | [] | 1 + bison | [] | 1 + clisp | [] [] [] | 3 + cpio | [] | 1 + diffutils | [] [] [] | 3 + enscript | [] [] [] [] | 4 + fileutils | [] [] [] [] | 4 + findutils | [] [] | 2 + flex | [] | 1 + gcal | [] | 1 + gettext | [] [] [] [] [] [] [] [] | 9 + glibc | [] [] [] | 3 + grep | [] [] [] [] [] [] | 6 + hello | [] [] [] [] [] [] | 6 + m4 | [] [] [] [] | 4 + make | | 0 + mkid | [] [] | 2 + music | [] | 1 + ptx | [] [] [] | 3 + recode | [] [] [] [] [] | 5 + sh-utils | [] [] | 2 + sharutils | [] [] [] [] | 4 + tar | [] [] [] [] [] [] [] | 7 + textutils | [] [] [] [] | 4 + wdiff | [] [] [] [] | 4 + `-------------------------------------------' + cs de en es fi fr ja ko nl no pl pt sl sv + 1 17 1 3 1 22 1 6 3 3 4 3 6 10 81 + + Some counters in the preceding matrix are higher than the number of +visible blocks let us expect. This is because a few extra PO files are +used for implementing regional variants of languages, or language +dialects. + + For a PO file in the matrix above to be effective, the package to +which it applies should also have been internationalized and +distributed as such by its maintainer. There might be an observable +lag between the mere existence a PO file and its wide availability in a +GNU distribution. + + If May 1996 seems to be old, you may fetch a more recent copy of this `ABOUT-NLS' file on most GNU archive sites. @@ -1,3 +1,42 @@ +Sun Jun 30 13:06:18 1996 Greg McGary <gkm@g2> + + * src/lid.c (get_query_func): remove unreachable return stmt. + + * libidu/hash.h (HASH_VACANT): cast item to (void *) for + comparison. + + * libidu/walker.c (append_strings_to_vector): check length of + vector_0, not vector. + + * libidu/scanners.c (get_token_c, get_token_asm, get_token_text): + cast return type of obstack_finish. + + * src/lid.c (radix, delimiter_style, pattern_style, key_style, + result_style, key_style, result_style) libidu/idfile.h + (separator_style): remove trailing comma from enum list. + + * src/xtokid.c: removed include of string.h. + + * src/lid.c (savetty, restoretty, linetty, chartty): define stub + versions if no UNIXy tty control is available. + +Wed Jun 12 22:15:12 1996 Greg McGary <gkm@g2> + + * src/lid.c, src/mkid.c, src/fnid.c (main): change default + argv variables from char* to char[] + +Mon Jun 10 15:29:19 1996 Greg McGary <gkm@g2> + + * src/mkid.c (main): -v implies -s; handle the case where there's + nothing to do. + * libidu/walker.c (get_lang_args): test lang_args_default before + dereference. + +Sun Jun 9 23:46:53 1996 Greg McGary <gkm@g2> + + * lid.c (get_radix, otoi, dtoi, xtoi): Test *str before passing it + to strchr--fixes query_number bug. + Sat Feb 25 16:23:49 1995 Greg McGary <gkm@magilla.cichlid.com> * Version 3.0.8 released. diff --git a/Makefile.am b/Makefile.am index 4b23432..0f9b4a5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,10 +1,5 @@ ## Process this file with automake to produce Makefile.in -SUBDIRS = lib intl src doc po +SUBDIRS = lib libidu intl src lisp po doc testsuite -TESTS = idtest - -EXTRA_DIST = idtest @README_ALPHA@ - -idtest-real: all - $(SHELL) $(top_srcdir)/idtest $(top_srcdir) $(top_builddir) +EXTRA_DIST = @README_ALPHA@ diff --git a/Makefile.in b/Makefile.in index 8cdf6a4..df4b41a 100644 --- a/Makefile.in +++ b/Makefile.in @@ -38,11 +38,9 @@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ transform = @program_transform_name@ -SUBDIRS = lib intl src doc po +SUBDIRS = lib libidu intl src lisp po doc testsuite -TESTS = idtest - -EXTRA_DIST = idtest @README_ALPHA@ +EXTRA_DIST = @README_ALPHA@ ACLOCAL = aclocal.m4 ACCONFIG = acconfig.h CONFIG_HEADER_IN = config.h.in @@ -161,6 +159,10 @@ dist: distdir $(TAR) chozf $(distdir).tar.gz $(distdir) rm -rf $(distdir) distdir: $(DEP_DISTFILES) + @if sed 15q $(srcdir)/NEWS | grep -e "$(VERSION)" > /dev/null; then :; else \ + echo "NEWS not updated; not releasing" 1>&2; \ + exit 1; \ + fi rm -rf $(distdir) mkdir $(distdir) chmod 777 $(distdir) @@ -177,32 +179,11 @@ distdir: $(DEP_DISTFILES) (cd $$subdir && $(MAKE) distdir=../$(distdir)/$$subdir distdir) \ || exit 1; \ done -check-TESTS: $(TESTS) - @failed=0; all=0; \ - srcdir=$(srcdir); export srcdir; \ - for tst in $(TESTS); do \ - all=`expr $$all + 1`; \ - if test -f $$tst; then dir=.; \ - else dir="$(srcdir)"; fi; \ - if $$dir/$$tst; then \ - echo "PASS: $$tst"; \ - else \ - failed=`expr $$failed + 1`; \ - echo "FAIL: $$tst"; \ - fi; \ - done; \ - if test "$$failed" -eq 0; then \ - echo "========================"; \ - echo "All $$all tests passed"; \ - echo "========================"; \ - else \ - echo "$$failed of $$all tests failed"; \ - fi info: info-recursive dvi: dvi-recursive -check: check-recursive check-TESTS +check: check-recursive installcheck: installcheck-recursive @@ -267,15 +248,12 @@ uninstalldirs-recursive all-recursive check-recursive \ installcheck-recursive info-recursive dvi-recursive \ mostlyclean-recursive distclean-recursive clean-recursive \ maintainer-clean-recursive tags tags-recursive mostlyclean-tags \ -distclean-tags clean-tags maintainer-clean-tags distdir check-TESTS \ -info dvi check installcheck all-recursive-hack all-am install-exec \ -install-data install uninstall all installdirs mostlyclean-generic \ -distclean-generic clean-generic maintainer-clean-generic clean \ -mostlyclean distclean maintainer-clean - +distclean-tags clean-tags maintainer-clean-tags distdir info dvi check \ +installcheck all-recursive-hack all-am install-exec install-data \ +install uninstall all installdirs mostlyclean-generic distclean-generic \ +clean-generic maintainer-clean-generic clean mostlyclean distclean \ +maintainer-clean -idtest-real: all - $(SHELL) $(top_srcdir)/idtest $(top_srcdir) $(top_builddir) .SUFFIXES: # Tell versions [3.59,3.63) of GNU make to not export all variables. @@ -1,6 +1,69 @@ id-utils NEWS - User visible changes. -Version 3.0.9 - May 1996, by Greg McGary +Version 3.1 - July 17, 1996, by Greg McGary + +* A few more portability bugs are fixed + +Version 3.0m - July 9, 1996, by Greg McGary + +* NLS is now initialized properly + +* Assorted portability problems are fixed + +* A few bugs (one serious) are fixed + +Version 3.0l - skipped `l' (ell) is too easy to confuse with `1' (one) + +Version 3.0k - June 5, 1996, by Greg McGary + +* `lid's command line has been revised and expanded. Control over output + formats is expanded. Pattern searching options are now complete and + orthogonal: word/substring, literal/regexp, case (in)sensitivity. + +* The texinfo manual, id-utils.texi, is now up-to-date. + +* `mkid' and `xtokid' support the new `--prune' option. + +* `mkid' and `xtokid' now implement the `--include' and `--exclude 'options. + +* `lid -R grep' (a.k.a. `gid') no longer prepends a space to each line-- + now its output is exactly like grep's. + +* `fid' separates tokens with spaces if output is to a termianal, and + otherwise with newlines. + +* If lid is in `brace' mode by default, it uses brace notation when + outputting to a terminal and separates file names with spaces otherwise. + If printing the token or pattern key is disabled, then file names are + separated with newlines. + +* All programs now accept directory names for the `-f, --file=' args. + When a directory is given, the file name "ID" is assumed. + +* gid.el is renamed id-utils.el and is installed in emacs's site-lisp/ + +* Source files and directories are reorganized + +* Misc. bugs are fixed + +Version 3.0j - May 31, 1996, by Greg McGary + +* Pre-test versions are now designated with a lower-case letter to shorten + the top-level directory name to 14 chars. + +* `idx' has been renamed `xtokid'. + +* The old `pid' program has been reborn as `fnid'. + +* Some bugs & build problems are fixed. + +* Some missing prototypes are added to header files. + +* gcc -Wall (plus a bunch of other other warnings) is happier. + +* A number of idtest problems are fixed. + +Version 3.0.9 - May 30, 1996, by Greg McGary * The package name has been changed from `mkid' to `id-utils', and is now officially a part of GNU. @@ -9,8 +72,9 @@ Version 3.0.9 - May 1996, by Greg McGary Each command now processes --help and --version long arguments. * The texinfo manual is out-of-date. Please use the `--help' option for - correct information about command-line arguments. I'll work on updating - it tonight. + correct information about command-line arguments. + +* Message catalogs for French and German exist, but are out-of-date. * `mkid' and `idx' use a file-tree walker. Give them one or more directory names on the command-line, and they'll recursively descend looking for @@ -22,7 +86,7 @@ Version 3.0.9 - May 1996, by Greg McGary * gid, aid and eid are now shell-script wrappers that call `lid' with the apropriate argument. -* A new environment `IDPATH' contains a colon-separated list of ID ID file +* A new environment `IDPATH' contains a colon-separated list of ID file names for use by `fid' and `lid'. It is only partially implemented at this time only the first ID file is actually handled, the rest are ignored. @@ -4,9 +4,9 @@ All programs were written by Greg McGary. Tom Horsley maintained the programs for a time and released mkid2 to comp.sources.unix. The texinfo manual was originally written by Tom Horsley. -Special thanks go to Francois Pinard worked tirelessly to refine +Special thanks go to François Pinard worked tirelessly to refine mkid's autoconfiscation, ensure mkid's conformance to GNU standards, -and generally pick all the nits that were fit to pick. ;-) +and generally pick all the nits that were fit to pick. 8^) Many people further contributed to mkid by reporting problems, suggesting improvements, or submitting patches. Here is a list of @@ -17,7 +17,7 @@ Help keep this list complete and accurate. Tom Horsley <Tom.Horsley@mail.hcsc.com> Wolfgang Rupprecht <wolfgang@wsrcc.com> Marty Leisner <leisner@sdsp.mc.xerox.com> -Francois Pinard <pinard@iro.umontreal.ca> +François Pinard <pinard@iro.umontreal.ca> Hal Peterson <hrp@ironwood.cray.com> Jay Lawlor <jlawlor@ptdcs2.intel.com> Paul Lew <lew@omocha.tay.dec.com> @@ -27,6 +27,11 @@ Rodney Brown <rdb@mel.cocam.oz.au> Richard Stallman <rms@gnu.ai.mit.edu> Dave Wiggins <dpw@x.org> Thomas Neumann <tom@smart.ruhr.de> -Jim Meyering <meyering@comco.com> +Jim Meyering <meyering@na-net.ornl.gov> Kazushi (Jam)Marukawa <kazusi-m@is.aist-nara.ac.jp> Tom Tromey <tromey@cygnus.com> +Kaveh R. Ghazi <ghazi@caip.rutgers.edu> +Youki Kadobayashi <youki-k@is.aist-nara.ac.jp> +Monty Solomon <monty@roscom.com> +Ulrich Drepper <drepper@ipd.info.uni-karlsruhe.de> +Nelson H. F. Beebe <beebe@math.utah.edu> @@ -1,31 +1,13 @@ -`mkid' TODO - Future directions +id-utils TODO - Future directions * Portability - - Fix filenames.c to handle non-UNIX file names properly - (notably DOS & OS/2). + - Fix file name handling for non-UNIX file systems + (notably DOS, Windoze & OS/2). - Fix assumption that (sizeof (int) == sizeof (long)) -* all query interfaces - - add environment variable for setting default ID file name. - * lid - - use "long long" (if the compiler supports it) integer comparisons - in find_number(). - - generalize the command-line interface for different behaviors. - User passes a command-format string for operating on the results - of a query: - %p = pattern, %f = crunched file list, %F = uncrunched file list - filename list options: - {,} -vs- expanded; space -vs- newline separator - pattern list options: - tokens -vs- regexp - Recommend the following aliases to emulate old behavior: - alias lid="findid --format='echo %p %f'" - alias eid="findid --format='vi +/\\<%p\\>/ %F'" # for vi users - alias gid="findid --format='egrep \\<%p\\> %F'" - alias aid="findid --format='fgrep -i %p %F'" - alias pid="findid --format='echo %p %f' -f" - alias fid="findid --format='echo %t ' -f" + - use "long long" (if available) integer comparisons + in query_number (). * mkid & lid - store & retrieve floating point literals @@ -33,6 +15,7 @@ you can index and search archived source without having to unpack it. * mkid + - relax static limit on maximum number of files (currently 32768) - (Optinally?) store tokenized contents of comments. - Store attributes with symbols: type, func, variable struct-tag enum-tag, keyword, etc. Store caller/callee relationships between @@ -40,6 +23,8 @@ is needed to support a cscope interface. - Add times(2) results to statistics output. - treat \ specially for TeX files and do likewise with @ for Texinfo. + - report dangling symlinks as such, rather than just saying "can't stat" + - Reinstate "-" on command-line, meaning read stdin for newline-separated args. * gscope - add a cscope work-alike query interface @@ -13,24 +13,24 @@ /* Define as 1 if you have catgets and don't want to use GNU gettext. */ #undef HAVE_CATGETS -/* Define if the sbrk system call is declared in unistd.h. */ -#undef HAVE_DECL_SBRK - -/* Define if the sys_errlist array is declared in errno.h, error.h or stdio.h. */ -#undef HAVE_DECL_SYS_ERRLIST - /* Define as 1 if you have gettext and don't want to use GNU gettext. */ #undef HAVE_GETTEXT /* Define if your locale.h file contains LC_MESSAGES. */ #undef HAVE_LC_MESSAGES +/* Define if your sys/types.h file defines the type ptrdiff_t. */ +#undef HAVE_PTRDIFF_T + /* Define to 1 if you have the stpcpy function. */ #undef HAVE_STPCPY /* Define if you have the <sys/ioctl.h> header file. */ #undef HAVE_SYS_IOCTL_H +/* Define to the name of the installed language map file. */ +#undef LANGUAGE_MAP_FILE + /* Define to the name of the distribution. */ #undef PACKAGE @@ -20,28 +20,16 @@ AC_DEFUN(jm_MAINTAINER_MODE, ] ) -AC_DEFUN(gm_DECL_SBRK, -[AC_CACHE_CHECK(for sbrk declaration in unistd.h, ac_cv_decl_sbrk, -[AC_EGREP_HEADER(sbrk, unistd.h, - ac_cv_decl_sbrk=yes, ac_cv_decl_sbrk=no)]) -if test $ac_cv_decl_sbrk = yes; then - AC_DEFINE(HAVE_DECL_SBRK) -fi -]) - -AC_DEFUN(gm_DECL_SYS_ERRLIST, -[AC_CACHE_CHECK(for sys_errlist declaration, ac_cv_decl_sys_errlist, -[ac_cv_decl_sys_errlist=no - AC_EGREP_HEADER(sys_errlist, errno.h, ac_cv_decl_sys_errlist=yes) - AC_EGREP_HEADER(sys_errlist, stdio.h, ac_cv_decl_sys_errlist=yes) - AC_EGREP_HEADER(sys_errlist, error.h, ac_cv_decl_sys_errlist=yes) - ]) -if test $ac_cv_decl_sys_errlist = yes; then - AC_DEFINE(HAVE_DECL_SYS_ERRLIST) -fi +AC_DEFUN(md_TYPE_PTRDIFF_T, + [AC_CACHE_CHECK([for ptrdiff_t], ac_cv_type_ptrdiff_t, + [AC_TRY_COMPILE([#include <stddef.h> +#include <sys/types.h>], [ptrdiff_t p], + ac_cv_type_ptrdiff_t=yes, ac_cv_type_ptrdiff_t=no)]) + if test $ac_cv_type_ptrdiff_t = yes; then + AC_DEFINE(HAVE_PTRDIFF_T) + fi ]) - ## --------------------------------------------------------- ## ## Use A*_PROG_INSTALL, supplementing it with INSTALL_SCRIPT ## ## substitution. ## @@ -110,7 +98,10 @@ do [#if !defined(__STDC__) || __STDC__ != 1 choke me #endif -], [int test (int i, double x); +], [/* DYNIX/ptx V4.1.3 can't compile sys/stat.h with -Xc -D__EXTENSIONS__. */ +#include <sys/types.h> +#include <sys/stat.h> +int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);};], [ac_cv_prog_cc_stdc="$ac_arg"; break]) @@ -178,19 +169,67 @@ AC_DEFUN(ud_PATH_LISPDIR, AC_SUBST(LISPDIR) AC_SUBST(ELCFILES)]) +dnl AC_REPLACE_GNU_GETOPT +AC_DEFUN(AC_REPLACE_GNU_GETOPT, +[AC_CHECK_FUNC(getopt_long, , [LIBOBJS="$LIBOBJS getopt1.o getopt.o"]) +AC_SUBST(LIBOBJS)dnl +]) + +dnl AC_REPLACE_OBSTACK +AC_DEFUN(AC_REPLACE_OBSTACK, +[AC_CACHE_CHECK([for obstacks], gt_cv_func_obstack, +[AC_TRY_LINK([#include "obstack.h"], +[struct obstack *mem;obstack_free(mem,NULL)], + gt_cv_func_obstack=yes, gt_cv_func_obstack=no)]) +if test $gt_cv_func_obstack = no; then + LIBOBJS="$LIBOBJS obstack.o" +fi +AC_SUBST(LIBOBJS)dnl +]) + dnl --------------------------------------------------------- ## -dnl The following definitions all have to go into the ## -dnl aclocal.m4 files of the packages to be internationalized. ## -dnl Last updated for gettext-0.10.11. ## +dnl The following definitions and this message have to go ## +dnl into the aclocal.m4 files of the packages to be ## +dnl internationalized. ## +dnl Last updated for gettext-0.10.20. ## dnl --------------------------------------------------------- ## -AC_DEFUN(md_PATH_PROG, - [AC_PATH_PROG($1,$2,$3)dnl - if echo $$1 | grep openwin > /dev/null; then - echo "WARNING: Do not use OpenWin's $2. (Better remove it.)" >&AC_FD_MSG - ac_cv_path_$1=$2 - $1=$2 - fi +dnl ud_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, +dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) +AC_DEFUN(ud_PATH_PROG_WITH_TEST, +[# Extract the first word of "$2", so it can be a program name with args. +set dummy $2; ac_word=[$]2 +AC_MSG_CHECKING([for $ac_word]) +AC_CACHE_VAL(ac_cv_path_$1, +[case "[$]$1" in + /*) + ac_cv_path_$1="[$]$1" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in ifelse([$5], , $PATH, [$5]); do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if [$3]; then + ac_cv_path_$1="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" +dnl If no 4th arg is given, leave the cache variable unset, +dnl so AC_PATH_PROGS will keep looking. +ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" +])dnl + ;; +esac])dnl +$1="$ac_cv_path_$1" +if test -n "[$]$1"; then + AC_MSG_RESULT([$]$1) +else + AC_MSG_RESULT(no) +fi +AC_SUBST($1)dnl ]) dnl Check NLS options @@ -214,12 +253,14 @@ AC_DEFUN(ud_WITH_NLS, AC_MSG_RESULT($USE_NLS) AC_SUBST(USE_NLS) + USE_INCLUDED_LIBINTL=no + dnl If we use NLS figure out what method if test "$USE_NLS" = "yes"; then AC_DEFINE(ENABLE_NLS) AC_MSG_CHECKING([for explicitly using GNU gettext]) - AC_ARG_WITH(gnu-gettext, - [ --with-gnu-gettext use the GNU gettext library], + AC_ARG_WITH(included-gettext, + [ --with-included-gettext use the GNU gettext library included here], nls_cv_force_use_gnu_gettext=$withval, nls_cv_force_use_gnu_gettext=no) AC_MSG_RESULT($nls_cv_force_use_gnu_gettext) @@ -235,17 +276,23 @@ AC_DEFUN(ud_WITH_NLS, CATOBJEXT=NONE AC_CHECK_HEADER(libintl.h, - [AC_CHECK_LIB(intl, main) + [AC_CHECK_LIB(intl, bindtextdomain) AC_CHECK_FUNC(gettext, [AC_DEFINE(HAVE_GETTEXT) - md_PATH_PROG(MSGFMT, msgfmt, no)dnl + ud_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl if test "$MSGFMT" != "no"; then AC_CHECK_FUNCS(dcgettext) - md_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) - md_PATH_PROG(XGETTEXT, xgettext, :) - CATOBJEXT=.mo + AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) + ud_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) + AC_TRY_LINK(, [extern int _nl_msg_cat_cntr; + return _nl_msg_cat_cntr], + [CATOBJEXT=.gmo + DATADIRNAME=share], + [CATOBJEXT=.mo + DATADIRNAME=lib]) INSTOBJEXT=.mo - DATADIRNAME=lib fi])]) if test "$CATOBJEXT" = "NONE"; then @@ -263,14 +310,19 @@ AC_DEFUN(ud_WITH_NLS, INTLOBJS="\$(CATOBJS)" AC_PATH_PROG(GENCAT, gencat, no)dnl if test "$GENCAT" != "no"; then - AC_PATH_PROGS(GMSGFMT, [gmsgfmt msgfmt], msgfmt) - md_PATH_PROG(XGETTEXT, xgettext, :) + AC_PATH_PROG(GMSGFMT, gmsgfmt, no) + if test "$GMSGFMT" = "no"; then + ud_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no) + fi + ud_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) + USE_INCLUDED_LIBINTL=yes CATOBJEXT=.cat INSTOBJEXT=.cat DATADIRNAME=lib INTLDEPS="../intl/libintl.a" INTLLIBS=$INTLDEPS - INTLSUB=intl LIBS=`echo $LIBS | sed -e 's/-lintl//'` nls_cv_header_intl=intl/libintl.h nls_cv_header_libgt=intl/libgettext.h @@ -288,16 +340,18 @@ AC_DEFUN(ud_WITH_NLS, if test "$nls_cv_use_gnu_gettext" = "yes"; then dnl Mark actions used to generate GNU NLS library. INTLOBJS="\$(GETTOBJS)" - md_PATH_PROG(MSGFMT, msgfmt, msgfmt) - md_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) - md_PATH_PROG(XGETTEXT, xgettext, :) + ud_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt) + AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) + ud_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) AC_SUBST(MSGFMT) + USE_INCLUDED_LIBINTL=yes CATOBJEXT=.gmo INSTOBJEXT=.mo DATADIRNAME=share - INTLDEPS="../intl/libintl.a" - INTLLIBS=$INTLDEPS - INTLSUB=intl + INTLDEPS="../intl/libintl.a" + INTLLIBS=$INTLDEPS LIBS=`echo $LIBS | sed -e 's/-lintl//'` nls_cv_header_intl=intl/libintl.h nls_cv_header_libgt=intl/libgettext.h @@ -324,6 +378,13 @@ AC_DEFUN(ud_WITH_NLS, nls_cv_header_libgt=intl/libgettext.h fi + # If this is used in GNU gettext we have to set USE_NLS to `yes' + # because some of the sources are only built for this goal. + if test "$PACKAGE" = gettext; then + USE_NLS=yes + USE_INCLUDED_LIBINTL=yes + fi + dnl These rules are solely for the distribution goal. While doing this dnl we only have to keep exactly one list of the available catalogs dnl in configure.in. @@ -333,6 +394,7 @@ AC_DEFUN(ud_WITH_NLS, done dnl Make all variables we use known to autoconf. + AC_SUBST(USE_INCLUDED_LIBINTL) AC_SUBST(CATALOGS) AC_SUBST(CATOBJEXT) AC_SUBST(DATADIRNAME) @@ -341,7 +403,6 @@ AC_DEFUN(ud_WITH_NLS, AC_SUBST(INTLDEPS) AC_SUBST(INTLLIBS) AC_SUBST(INTLOBJS) - AC_SUBST(INTLSUB) AC_SUBST(POFILES) AC_SUBST(POSUB) ]) @@ -359,8 +420,10 @@ AC_DEFUN(ud_GNU_GETTEXT, AC_REQUIRE([AC_FUNC_ALLOCA])dnl AC_REQUIRE([AC_FUNC_MMAP])dnl - AC_CHECK_HEADERS([limits.h locale.h nl_types.h malloc.h string.h unistd.h values.h]) - AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp]) + AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \ +unistd.h values.h]) + AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \ +__argz_count __argz_stringify __argz_next]) if test "${ac_cv_func_stpcpy+set}" != "set"; then AC_CHECK_FUNCS(stpcpy) @@ -408,6 +471,31 @@ AC_DEFUN(ud_GNU_GETTEXT, sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \ $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed + dnl In the intl/Makefile.in we have a special dependency which makes + dnl only sense for gettext. We comment this out for non-gettext + dnl packages. + if test "$PACKAGE" = "gettext"; then + GT_NO="#NO#" + GT_YES= + else + GT_NO= + GT_YES="#YES#" + fi + AC_SUBST(GT_NO) + AC_SUBST(GT_YES) + + dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly + dnl find the mkinstalldirs script in another subdir but ($top_srcdir). + dnl Try to locate is. + MKINSTALLDIRS= + if test $ac_aux_dir; then + MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" + fi + if test -z $MKINSTALLDIRS; then + MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" + fi + AC_SUBST(MKINSTALLDIRS) + dnl Generate list of files to be processed by xgettext which will dnl be included in po/Makefile. test -d po || mkdir po @@ -423,21 +511,3 @@ AC_DEFUN(ud_GNU_GETTEXT, sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \ < $srcdir/po/POTFILES.in > po/POTFILES ]) - -dnl AC_REPLACE_GNU_GETOPT -AC_DEFUN(AC_REPLACE_GNU_GETOPT, -[AC_CHECK_FUNC(getopt_long, , [LIBOBJS="$LIBOBJS getopt1.o getopt.o"]) -AC_SUBST(LIBOBJS)dnl -]) - -dnl AC_REPLACE_OBSTACK -AC_DEFUN(AC_REPLACE_OBSTACK, -[AC_CACHE_CHECK([for obstacks], gt_cv_func_obstack, -[AC_TRY_LINK([#include "obstack.h"], -[struct obstack *mem;obstack_free(mem,NULL)], - gt_cv_func_obstack=yes, gt_cv_func_obstack=no)]) -if test $gt_cv_func_obstack = no; then - LIBOBJS="$LIBOBJS obstack.o" -fi -AC_SUBST(LIBOBJS)dnl -]) diff --git a/config.h.in b/config.h.in index 6936d5e..384f96f 100644 --- a/config.h.in +++ b/config.h.in @@ -30,12 +30,18 @@ /* Define if you have <alloca.h> and it should be used (not on Ultrix). */ #undef HAVE_ALLOCA_H +/* Define if you don't have vprintf but do have _doprnt. */ +#undef HAVE_DOPRNT + /* Define if you have a working `mmap' system call. */ #undef HAVE_MMAP /* Define if you have <sys/wait.h> that is POSIX.1 compatible. */ #undef HAVE_SYS_WAIT_H +/* Define if you have the vprintf function. */ +#undef HAVE_VPRINTF + /* Define as __inline if that's what the C compiler calls it. */ #undef inline @@ -79,21 +85,21 @@ /* Define as 1 if you have catgets and don't want to use GNU gettext. */ #undef HAVE_CATGETS -/* Define if the sbrk system call is declared in unistd.h. */ -#undef HAVE_DECL_SBRK - -/* Define if the sys_errlist array is declared in errno.h, error.h or stdio.h. */ -#undef HAVE_DECL_SYS_ERRLIST - /* Define as 1 if you have gettext and don't want to use GNU gettext. */ #undef HAVE_GETTEXT /* Define if your locale.h file contains LC_MESSAGES. */ #undef HAVE_LC_MESSAGES +/* Define if your sys/types.h file defines the type ptrdiff_t. */ +#undef HAVE_PTRDIFF_T + /* Define to 1 if you have the stpcpy function. */ #undef HAVE_STPCPY +/* Define to the name of the installed language map file. */ +#undef LANGUAGE_MAP_FILE + /* Define to the name of the distribution. */ #undef PACKAGE @@ -117,6 +123,21 @@ # endif #endif +/* Define if you have the __argz_count function. */ +#undef HAVE___ARGZ_COUNT + +/* Define if you have the __argz_next function. */ +#undef HAVE___ARGZ_NEXT + +/* Define if you have the __argz_stringify function. */ +#undef HAVE___ARGZ_STRINGIFY + +/* Define if you have the bcopy function. */ +#undef HAVE_BCOPY + +/* Define if you have the bzero function. */ +#undef HAVE_BZERO + /* Define if you have the dcgettext function. */ #undef HAVE_DCGETTEXT @@ -129,9 +150,15 @@ /* Define if you have the getwd function. */ #undef HAVE_GETWD +/* Define if you have the isascii function. */ +#undef HAVE_ISASCII + /* Define if you have the link function. */ #undef HAVE_LINK +/* Define if you have the memcpy function. */ +#undef HAVE_MEMCPY + /* Define if you have the munmap function. */ #undef HAVE_MUNMAP @@ -153,12 +180,21 @@ /* Define if you have the strchr function. */ #undef HAVE_STRCHR +/* Define if you have the strerror function. */ +#undef HAVE_STRERROR + /* Define if you have the valloc function. */ #undef HAVE_VALLOC +/* Define if you have the <argz.h> header file. */ +#undef HAVE_ARGZ_H + /* Define if you have the <dirent.h> header file. */ #undef HAVE_DIRENT_H +/* Define if you have the <fcntl.h> header file. */ +#undef HAVE_FCNTL_H + /* Define if you have the <limits.h> header file. */ #undef HAVE_LIMITS_H @@ -168,6 +204,9 @@ /* Define if you have the <malloc.h> header file. */ #undef HAVE_MALLOC_H +/* Define if you have the <memory.h> header file. */ +#undef HAVE_MEMORY_H + /* Define if you have the <ndir.h> header file. */ #undef HAVE_NDIR_H @@ -180,6 +219,9 @@ /* Define if you have the <sgtty.h> header file. */ #undef HAVE_SGTTY_H +/* Define if you have the <stddef.h> header file. */ +#undef HAVE_STDDEF_H + /* Define if you have the <stdlib.h> header file. */ #undef HAVE_STDLIB_H @@ -198,6 +240,9 @@ /* Define if you have the <sys/param.h> header file. */ #undef HAVE_SYS_PARAM_H +/* Define if you have the <sys/stat.h> header file. */ +#undef HAVE_SYS_STAT_H + /* Define if you have the <sys/types.h> header file. */ #undef HAVE_SYS_TYPES_H @@ -19,7 +19,7 @@ ac_help="$ac_help ac_help="$ac_help --disable-nls do not use Native Language Support" ac_help="$ac_help - --with-gnu-gettext use the GNU gettext library" + --with-included-gettext use the GNU gettext library included here" ac_help="$ac_help --with-catgets use catgets functions if available" @@ -550,7 +550,7 @@ test "$program_transform_name" = "" && program_transform_name="s,x,x," ############################################################################## PACKAGE=id-utils -VERSION=3.0.9 +VERSION=3.1 PACKAGE_VERSION="$PACKAGE-$VERSION" cat >> confdefs.h <<EOF #define PACKAGE "$PACKAGE" @@ -593,8 +593,8 @@ fi ALL_LINGUAS="de fr" case $VERSION in -*.*.*) README_ALPHA=README-alpha;; -*) README_ALPHA=;; +*[a-z]) README_ALPHA=README-alpha;; +*) README_ALPHA=;; esac @@ -1419,7 +1419,7 @@ EOF fi -for ac_hdr in limits.h sys/types.h sys/param.h stdlib.h unistd.h string.h +for ac_hdr in sys/types.h sys/param.h sys/stat.h sys/ioctl.h do ac_safe=`echo "$ac_hdr" | tr './\055' '___'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 @@ -1456,7 +1456,7 @@ else fi done -for ac_hdr in malloc.h sys/ioctl.h termios.h termio.h sgtty.h regex.h +for ac_hdr in limits.h stddef.h stdlib.h unistd.h string.h fcntl.h do ac_safe=`echo "$ac_hdr" | tr './\055' '___'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 @@ -1493,6 +1493,43 @@ else fi done +for ac_hdr in malloc.h termios.h termio.h sgtty.h regex.h memory.h +do +ac_safe=`echo "$ac_hdr" | tr './\055' '___'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1505 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1510: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | tr 'abcdefghijklmnopqrstuvwxyz./\055' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ___'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + ############################################################################## ################ Check for typedefs, structs, and compiler params ############ @@ -1503,7 +1540,7 @@ if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1507 "configure" +#line 1544 "configure" #include "confdefs.h" int main() { return 0; } @@ -1553,7 +1590,7 @@ ccp = (char const *const *) p; ; return 0; } EOF -if { (eval echo configure:1557: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1594: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -1588,7 +1625,7 @@ for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__ do CFLAGS="$ac_save_CFLAGS $ac_arg" cat > conftest.$ac_ext <<EOF -#line 1592 "configure" +#line 1629 "configure" #include "confdefs.h" #if !defined(__STDC__) || __STDC__ != 1 choke me @@ -1596,12 +1633,15 @@ choke me int main() { return 0; } int t() { +/* DYNIX/ptx V4.1.3 can't compile sys/stat.h with -Xc -D__EXTENSIONS__. */ +#include <sys/types.h> +#include <sys/stat.h> int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; ; return 0; } EOF -if { (eval echo configure:1605: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1645: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_prog_cc_stdc="$ac_arg"; break fi @@ -1637,7 +1677,7 @@ if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1641 "configure" +#line 1681 "configure" #include "confdefs.h" #include <sys/types.h> #include <signal.h> @@ -1655,7 +1695,7 @@ int t() { int i; ; return 0; } EOF -if { (eval echo configure:1659: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1699: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -1677,7 +1717,7 @@ if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1681 "configure" +#line 1721 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -1708,7 +1748,7 @@ if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1712 "configure" +#line 1752 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -1734,12 +1774,45 @@ EOF fi +echo $ac_n "checking for ptrdiff_t""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_type_ptrdiff_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1783 "configure" +#include "confdefs.h" +#include <stddef.h> +#include <sys/types.h> +int main() { return 0; } +int t() { +ptrdiff_t p +; return 0; } +EOF +if { (eval echo configure:1792: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_type_ptrdiff_t=yes +else + rm -rf conftest* + ac_cv_type_ptrdiff_t=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_type_ptrdiff_t" 1>&6 + if test $ac_cv_type_ptrdiff_t = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_PTRDIFF_T 1 +EOF + + fi + ############################################################################## ################ Set default compilation flags ############################### ############################################################################## -: ${CFLAGS=-g} +: ${CFLAGS="-O -g"} : ${LDFLAGS=-g} @@ -1755,7 +1828,7 @@ if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1759 "configure" +#line 1832 "configure" #include "confdefs.h" #include <alloca.h> int main() { return 0; } @@ -1763,7 +1836,7 @@ int t() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:1767: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:1840: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* ac_cv_header_alloca_h=yes else @@ -1787,7 +1860,7 @@ if eval "test \"`echo '$''{'ac_cv_func_alloca'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1791 "configure" +#line 1864 "configure" #include "confdefs.h" #ifdef __GNUC__ @@ -1811,7 +1884,7 @@ int t() { char *p = (char *) alloca(1); ; return 0; } EOF -if { (eval echo configure:1815: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:1888: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* ac_cv_func_alloca=yes else @@ -1846,7 +1919,7 @@ if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1850 "configure" +#line 1923 "configure" #include "confdefs.h" #if defined(CRAY) && ! defined(CRAY2) webecray @@ -1875,7 +1948,7 @@ if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1879 "configure" +#line 1952 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -1899,7 +1972,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:1903: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:1976: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1931,7 +2004,7 @@ else ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <<EOF -#line 1935 "configure" +#line 2008 "configure" #include "confdefs.h" find_stack_direction () { @@ -1950,7 +2023,7 @@ main () exit (find_stack_direction() < 0); } EOF -{ (eval echo configure:1954: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } +{ (eval echo configure:2027: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } if test -s conftest && (./conftest; exit) 2>/dev/null; then ac_cv_c_stack_direction=1 else @@ -1967,118 +2040,136 @@ EOF fi -echo $ac_n "checking for sbrk declaration in unistd.h""... $ac_c" 1>&6 -if eval "test \"`echo '$''{'ac_cv_decl_sbrk'+set}'`\" = set"; then +echo $ac_n "checking which of rx or regex is wanted""... $ac_c" 1>&6 +# Check whether --with-regex or --without-regex was given. +if test "${with_regex+set}" = set; then + withval="$with_regex" + if test "$withval" = yes; then + ac_with_regex=1 + echo "$ac_t""regex" 1>&6 + cat >> confdefs.h <<\EOF +#define WITH_REGEX 1 +EOF + + REGEXOBJ=regex.o +fi +fi + +if test -z "$ac_with_regex"; then + echo "$ac_t""rx" 1>&6 + echo $ac_n "checking for re_rx_search""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_func_re_rx_search'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1976 "configure" +#line 2066 "configure" #include "confdefs.h" -#include <unistd.h> +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char re_rx_search(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char re_rx_search(); + +int main() { return 0; } +int t() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_re_rx_search) || defined (__stub___re_rx_search) +choke me +#else +re_rx_search(); +#endif + +; return 0; } EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "sbrk" >/dev/null 2>&1; then +if { (eval echo configure:2090: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* - ac_cv_decl_sbrk=yes + eval "ac_cv_func_re_rx_search=yes" else rm -rf conftest* - ac_cv_decl_sbrk=no + eval "ac_cv_func_re_rx_search=no" fi rm -f conftest* fi - -echo "$ac_t""$ac_cv_decl_sbrk" 1>&6 -if test $ac_cv_decl_sbrk = yes; then - cat >> confdefs.h <<\EOF -#define HAVE_DECL_SBRK 1 -EOF +if eval "test \"`echo '$ac_cv_func_'re_rx_search`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +REGEXOBJ=rx.o +fi fi -echo $ac_n "checking for sys_errlist declaration""... $ac_c" 1>&6 -if eval "test \"`echo '$''{'ac_cv_decl_sys_errlist'+set}'`\" = set"; then +echo $ac_n "checking for vprintf""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - ac_cv_decl_sys_errlist=no cat > conftest.$ac_ext <<EOF -#line 2006 "configure" +#line 2115 "configure" #include "confdefs.h" -#include <errno.h> -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "sys_errlist" >/dev/null 2>&1; then - rm -rf conftest* - ac_cv_decl_sys_errlist=yes -fi -rm -f conftest* +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char vprintf(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char vprintf(); - cat > conftest.$ac_ext <<EOF -#line 2018 "configure" -#include "confdefs.h" -#include <stdio.h> -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "sys_errlist" >/dev/null 2>&1; then - rm -rf conftest* - ac_cv_decl_sys_errlist=yes -fi -rm -f conftest* +int main() { return 0; } +int t() { - cat > conftest.$ac_ext <<EOF -#line 2030 "configure" -#include "confdefs.h" -#include <error.h> +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_vprintf) || defined (__stub___vprintf) +choke me +#else +vprintf(); +#endif + +; return 0; } EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "sys_errlist" >/dev/null 2>&1; then +if { (eval echo configure:2139: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + rm -rf conftest* + eval "ac_cv_func_vprintf=yes" +else rm -rf conftest* - ac_cv_decl_sys_errlist=yes + eval "ac_cv_func_vprintf=no" fi rm -f conftest* - fi - -echo "$ac_t""$ac_cv_decl_sys_errlist" 1>&6 -if test $ac_cv_decl_sys_errlist = yes; then - cat >> confdefs.h <<\EOF -#define HAVE_DECL_SYS_ERRLIST 1 -EOF - -fi - -echo $ac_n "checking which of rx or regex is wanted""... $ac_c" 1>&6 -# Check whether --with-regex or --without-regex was given. -if test "${with_regex+set}" = set; then - withval="$with_regex" - if test "$withval" = yes; then - ac_with_regex=1 - echo "$ac_t""regex" 1>&6 +if eval "test \"`echo '$ac_cv_func_'vprintf`\" = yes"; then + echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF -#define WITH_REGEX 1 +#define HAVE_VPRINTF 1 EOF - REGEXOBJ=regex.o -fi +else + echo "$ac_t""no" 1>&6 fi -if test -z "$ac_with_regex"; then - echo "$ac_t""rx" 1>&6 - echo $ac_n "checking for re_rx_search""... $ac_c" 1>&6 -if eval "test \"`echo '$''{'ac_cv_func_re_rx_search'+set}'`\" = set"; then +if test "$ac_cv_func_vprintf" != yes; then +echo $ac_n "checking for _doprnt""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2074 "configure" +#line 2165 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char re_rx_search(); below. */ + which can conflict with char _doprnt(); below. */ #include <assert.h> /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ -char re_rx_search(); +char _doprnt(); int main() { return 0; } int t() { @@ -2086,42 +2177,44 @@ int t() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ -#if defined (__stub_re_rx_search) || defined (__stub___re_rx_search) +#if defined (__stub__doprnt) || defined (__stub____doprnt) choke me #else -re_rx_search(); +_doprnt(); #endif ; return 0; } EOF -if { (eval echo configure:2098: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:2189: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* - eval "ac_cv_func_re_rx_search=yes" + eval "ac_cv_func__doprnt=yes" else rm -rf conftest* - eval "ac_cv_func_re_rx_search=no" + eval "ac_cv_func__doprnt=no" fi rm -f conftest* fi -if eval "test \"`echo '$ac_cv_func_'re_rx_search`\" = yes"; then +if eval "test \"`echo '$ac_cv_func_'_doprnt`\" = yes"; then echo "$ac_t""yes" 1>&6 - : + cat >> confdefs.h <<\EOF +#define HAVE_DOPRNT 1 +EOF + else echo "$ac_t""no" 1>&6 -REGEXOBJ=rx.o fi fi -for ac_func in getwd getcwd link +for ac_func in getwd getcwd link strerror isascii bcopy bzero memcpy do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2125 "configure" +#line 2218 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -2145,7 +2238,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:2149: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:2242: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2167,14 +2260,14 @@ else fi done -for ac_func in strcasecmp strdup strndup strtok fnmatch +for ac_func in strdup strndup strspn strcspn strpbrk strstr strtok do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2178 "configure" +#line 2271 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -2198,7 +2291,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:2202: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:2295: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2218,14 +2311,14 @@ fi done -for ac_func in basename dirname error memcpy memset +for ac_func in basename dirname fnmatch error memcpy memset do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2229 "configure" +#line 2322 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -2249,7 +2342,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:2253: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:2346: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2274,7 +2367,7 @@ if eval "test \"`echo '$''{'ac_cv_func_getopt_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2278 "configure" +#line 2371 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char getopt_long(); below. */ @@ -2298,7 +2391,7 @@ getopt_long(); ; return 0; } EOF -if { (eval echo configure:2302: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:2395: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* eval "ac_cv_func_getopt_long=yes" else @@ -2322,7 +2415,7 @@ if eval "test \"`echo '$''{'gt_cv_func_obstack'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2326 "configure" +#line 2419 "configure" #include "confdefs.h" #include "obstack.h" int main() { return 0; } @@ -2330,7 +2423,7 @@ int t() { struct obstack *mem;obstack_free(mem,NULL) ; return 0; } EOF -if { (eval echo configure:2334: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:2427: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* gt_cv_func_obstack=yes else @@ -2358,7 +2451,7 @@ else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat > conftest.$ac_ext <<EOF -#line 2362 "configure" +#line 2455 "configure" #include "confdefs.h" int main() { return 0; } @@ -2366,7 +2459,7 @@ int t() { } $ac_kw foo() { ; return 0; } EOF -if { (eval echo configure:2370: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2463: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline=$ac_kw; break fi @@ -2396,7 +2489,7 @@ if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2400 "configure" +#line 2493 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -2420,7 +2513,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:2424: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:2517: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2450,7 +2543,7 @@ else ac_cv_func_mmap=no else cat > conftest.$ac_ext <<EOF -#line 2454 "configure" +#line 2547 "configure" #include "confdefs.h" /* Thanks to Mike Haertel and Jim Avera for this test. */ @@ -2519,7 +2612,7 @@ main() } EOF -{ (eval echo configure:2523: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } +{ (eval echo configure:2616: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } if test -s conftest && (./conftest; exit) 2>/dev/null; then ac_cv_func_mmap=yes else @@ -2538,7 +2631,8 @@ EOF fi - for ac_hdr in limits.h locale.h nl_types.h malloc.h string.h unistd.h values.h + for ac_hdr in argz.h limits.h locale.h nl_types.h malloc.h string.h \ +unistd.h values.h do ac_safe=`echo "$ac_hdr" | tr './\055' '___'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 @@ -2546,12 +2640,12 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2550 "configure" +#line 2644 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2555: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2649: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -2575,14 +2669,15 @@ else fi done - for ac_func in getcwd munmap putenv setenv setlocale strchr strcasecmp + for ac_func in getcwd munmap putenv setenv setlocale strchr strcasecmp \ +__argz_count __argz_stringify __argz_next do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2586 "configure" +#line 2681 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -2606,7 +2701,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:2610: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:2705: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2637,7 +2732,7 @@ if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2641 "configure" +#line 2736 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -2661,7 +2756,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:2665: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:2760: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2697,7 +2792,7 @@ if eval "test \"`echo '$''{'ud_cv_val_LC_MESSAGES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2701 "configure" +#line 2796 "configure" #include "confdefs.h" #include <locale.h> int main() { return 0; } @@ -2705,7 +2800,7 @@ int t() { return LC_MESSAGES ; return 0; } EOF -if { (eval echo configure:2709: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:2804: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* ud_cv_val_LC_MESSAGES=yes else @@ -2736,15 +2831,17 @@ fi echo "$ac_t""$USE_NLS" 1>&6 + USE_INCLUDED_LIBINTL=no + if test "$USE_NLS" = "yes"; then cat >> confdefs.h <<\EOF #define ENABLE_NLS 1 EOF echo $ac_n "checking for explicitly using GNU gettext""... $ac_c" 1>&6 - # Check whether --with-gnu-gettext or --without-gnu-gettext was given. -if test "${with_gnu_gettext+set}" = set; then - withval="$with_gnu_gettext" + # Check whether --with-included-gettext or --without-included-gettext was given. +if test "${with_included_gettext+set}" = set; then + withval="$with_included_gettext" nls_cv_force_use_gnu_gettext=$withval else nls_cv_force_use_gnu_gettext=no @@ -2764,12 +2861,12 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2768 "configure" +#line 2865 "configure" #include "confdefs.h" #include <libintl.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2773: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2870: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -2784,22 +2881,26 @@ fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for -lintl""... $ac_c" 1>&6 -ac_lib_var=`echo intl'_'main | tr './+\055' '__p_'` +ac_lib_var=`echo intl'_'bindtextdomain | tr './+\055' '__p_'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lintl $LIBS" cat > conftest.$ac_ext <<EOF -#line 2795 "configure" +#line 2892 "configure" #include "confdefs.h" +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char bindtextdomain(); int main() { return 0; } int t() { -main() +bindtextdomain() ; return 0; } EOF -if { (eval echo configure:2803: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:2904: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2828,7 +2929,7 @@ if eval "test \"`echo '$''{'ac_cv_func_gettext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2832 "configure" +#line 2933 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char gettext(); below. */ @@ -2852,7 +2953,7 @@ gettext(); ; return 0; } EOF -if { (eval echo configure:2856: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:2957: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* eval "ac_cv_func_gettext=yes" else @@ -2883,8 +2984,10 @@ else for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_path_MSGFMT="$ac_dir/$ac_word" - break + if test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"; then + ac_cv_path_MSGFMT="$ac_dir/$ac_word" + break + fi fi done IFS="$ac_save_ifs" @@ -2898,11 +3001,6 @@ if test -n "$MSGFMT"; then else echo "$ac_t""no" 1>&6 fi - if echo $MSGFMT | grep openwin > /dev/null; then - echo "WARNING: Do not use OpenWin's msgfmt. (Better remove it.)" >&6 - ac_cv_path_MSGFMT=msgfmt - MSGFMT=msgfmt - fi if test "$MSGFMT" != "no"; then for ac_func in dcgettext do @@ -2911,7 +3009,7 @@ if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2915 "configure" +#line 3013 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -2935,7 +3033,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:2939: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:3037: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2987,11 +3085,6 @@ if test -n "$GMSGFMT"; then else echo "$ac_t""no" 1>&6 fi - if echo $GMSGFMT | grep openwin > /dev/null; then - echo "WARNING: Do not use OpenWin's gmsgfmt. (Better remove it.)" >&6 - ac_cv_path_GMSGFMT=gmsgfmt - GMSGFMT=gmsgfmt - fi # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 @@ -3008,8 +3101,10 @@ else for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_path_XGETTEXT="$ac_dir/$ac_word" - break + if test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"; then + ac_cv_path_XGETTEXT="$ac_dir/$ac_word" + break + fi fi done IFS="$ac_save_ifs" @@ -3023,15 +3118,29 @@ if test -n "$XGETTEXT"; then else echo "$ac_t""no" 1>&6 fi - if echo $XGETTEXT | grep openwin > /dev/null; then - echo "WARNING: Do not use OpenWin's xgettext. (Better remove it.)" >&6 - ac_cv_path_XGETTEXT=xgettext - XGETTEXT=xgettext - fi - CATOBJEXT=.mo + cat > conftest.$ac_ext <<EOF +#line 3124 "configure" +#include "confdefs.h" + +int main() { return 0; } +int t() { +extern int _nl_msg_cat_cntr; + return _nl_msg_cat_cntr +; return 0; } +EOF +if { (eval echo configure:3133: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + rm -rf conftest* + CATOBJEXT=.gmo + DATADIRNAME=share +else + rm -rf conftest* + CATOBJEXT=.mo + DATADIRNAME=lib +fi +rm -f conftest* + INSTOBJEXT=.mo - DATADIRNAME=lib fi else echo "$ac_t""no" 1>&6 @@ -3063,7 +3172,7 @@ else ac_save_LIBS="$LIBS" LIBS="-li $LIBS" cat > conftest.$ac_ext <<EOF -#line 3067 "configure" +#line 3176 "configure" #include "confdefs.h" int main() { return 0; } @@ -3071,7 +3180,7 @@ int t() { main() ; return 0; } EOF -if { (eval echo configure:3075: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:3184: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3100,7 +3209,7 @@ if eval "test \"`echo '$''{'ac_cv_func_catgets'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3104 "configure" +#line 3213 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char catgets(); below. */ @@ -3124,7 +3233,7 @@ catgets(); ; return 0; } EOF -if { (eval echo configure:3128: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:3237: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* eval "ac_cv_func_catgets=yes" else @@ -3172,10 +3281,8 @@ else echo "$ac_t""no" 1>&6 fi if test "$GENCAT" != "no"; then - for ac_prog in gmsgfmt msgfmt -do -# Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 + # Extract the first word of "gmsgfmt", so it can be a program name with args. +set dummy gmsgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3194,6 +3301,7 @@ else fi done IFS="$ac_save_ifs" + test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="no" ;; esac fi @@ -3204,10 +3312,41 @@ else echo "$ac_t""no" 1>&6 fi -test -n "$GMSGFMT" && break -done -test -n "$GMSGFMT" || GMSGFMT="msgfmt" + if test "$GMSGFMT" = "no"; then + # Extract the first word of "msgfmt", so it can be a program name with args. +set dummy msgfmt; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$GMSGFMT" in + /*) + ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"; then + ac_cv_path_GMSGFMT="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="no" + ;; +esac +fi +GMSGFMT="$ac_cv_path_GMSGFMT" +if test -n "$GMSGFMT"; then + echo "$ac_t""$GMSGFMT" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + fi # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 @@ -3223,8 +3362,10 @@ else for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_path_XGETTEXT="$ac_dir/$ac_word" - break + if test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"; then + ac_cv_path_XGETTEXT="$ac_dir/$ac_word" + break + fi fi done IFS="$ac_save_ifs" @@ -3238,18 +3379,13 @@ if test -n "$XGETTEXT"; then else echo "$ac_t""no" 1>&6 fi - if echo $XGETTEXT | grep openwin > /dev/null; then - echo "WARNING: Do not use OpenWin's xgettext. (Better remove it.)" >&6 - ac_cv_path_XGETTEXT=xgettext - XGETTEXT=xgettext - fi + USE_INCLUDED_LIBINTL=yes CATOBJEXT=.cat INSTOBJEXT=.cat DATADIRNAME=lib INTLDEPS="../intl/libintl.a" INTLLIBS=$INTLDEPS - INTLSUB=intl LIBS=`echo $LIBS | sed -e 's/-lintl//'` nls_cv_header_intl=intl/libintl.h nls_cv_header_libgt=intl/libgettext.h @@ -3283,8 +3419,10 @@ else for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_path_MSGFMT="$ac_dir/$ac_word" - break + if test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"; then + ac_cv_path_MSGFMT="$ac_dir/$ac_word" + break + fi fi done IFS="$ac_save_ifs" @@ -3298,11 +3436,6 @@ if test -n "$MSGFMT"; then else echo "$ac_t""no" 1>&6 fi - if echo $MSGFMT | grep openwin > /dev/null; then - echo "WARNING: Do not use OpenWin's msgfmt. (Better remove it.)" >&6 - ac_cv_path_MSGFMT=msgfmt - MSGFMT=msgfmt - fi # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 @@ -3334,11 +3467,6 @@ if test -n "$GMSGFMT"; then else echo "$ac_t""no" 1>&6 fi - if echo $GMSGFMT | grep openwin > /dev/null; then - echo "WARNING: Do not use OpenWin's gmsgfmt. (Better remove it.)" >&6 - ac_cv_path_GMSGFMT=gmsgfmt - GMSGFMT=gmsgfmt - fi # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 @@ -3355,8 +3483,10 @@ else for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_path_XGETTEXT="$ac_dir/$ac_word" - break + if test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"; then + ac_cv_path_XGETTEXT="$ac_dir/$ac_word" + break + fi fi done IFS="$ac_save_ifs" @@ -3370,19 +3500,14 @@ if test -n "$XGETTEXT"; then else echo "$ac_t""no" 1>&6 fi - if echo $XGETTEXT | grep openwin > /dev/null; then - echo "WARNING: Do not use OpenWin's xgettext. (Better remove it.)" >&6 - ac_cv_path_XGETTEXT=xgettext - XGETTEXT=xgettext - fi + USE_INCLUDED_LIBINTL=yes CATOBJEXT=.gmo INSTOBJEXT=.mo DATADIRNAME=share - INTLDEPS="../intl/libintl.a" - INTLLIBS=$INTLDEPS - INTLSUB=intl + INTLDEPS="../intl/libintl.a" + INTLLIBS=$INTLDEPS LIBS=`echo $LIBS | sed -e 's/-lintl//'` nls_cv_header_intl=intl/libintl.h nls_cv_header_libgt=intl/libgettext.h @@ -3405,6 +3530,13 @@ fi nls_cv_header_libgt=intl/libgettext.h fi + # If this is used in GNU gettext we have to set USE_NLS to `yes' + # because some of the sources are only built for this goal. + if test "$PACKAGE" = gettext; then + USE_NLS=yes + USE_INCLUDED_LIBINTL=yes + fi + for lang in $ALL_LINGUAS; do GMOFILES="$GMOFILES $lang.gmo" POFILES="$POFILES $lang.po" @@ -3451,12 +3583,12 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3455 "configure" +#line 3587 "configure" #include "confdefs.h" #include <linux/version.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3460: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3592: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -3482,6 +3614,25 @@ fi sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \ $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed + if test "$PACKAGE" = "gettext"; then + GT_NO="#NO#" + GT_YES= + else + GT_NO= + GT_YES="#YES#" + fi + + + + MKINSTALLDIRS= + if test $ac_aux_dir; then + MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" + fi + if test -z $MKINSTALLDIRS; then + MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" + fi + + test -d po || mkdir po if test "x$srcdir" != "x."; then if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then @@ -3498,6 +3649,83 @@ fi ############################################################################## +################ Find a home for language map ################################ +############################################################################## + +if test "x$prefix" != xNONE; then + datadir=$prefix/share +else + datadir=$ac_default_prefix/share +fi +LANGUAGE_MAP_FILE=$datadir/id-lang.map +cat >> confdefs.h <<EOF +#define LANGUAGE_MAP_FILE "$LANGUAGE_MAP_FILE" +EOF + + + +############################################################################## +################ Find a home for Emacs Lisp code ############################# +############################################################################## + +# Extract the first word of "emacs", so it can be a program name with args. +set dummy emacs; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_path_EMACS'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$EMACS" in + /*) + ac_cv_path_EMACS="$EMACS" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_EMACS="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_EMACS" && ac_cv_path_EMACS="no" + ;; +esac +fi +EMACS="$ac_cv_path_EMACS" +if test -n "$EMACS"; then + echo "$ac_t""$EMACS" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + if test $EMACS != "no"; then + echo $ac_n "checking where .elc files should go""... $ac_c" 1>&6 + LISPDIR="\$(datadir)/emacs/site-lisp" + if test "x$prefix" = "xNONE"; then + if test -d $ac_default_prefix/share/emacs/site-lisp; then + LISPDIR="\$(prefix)/share/emacs/site-lisp" + else + if test -d $ac_default_prefix/lib/emacs/site-lisp; then + LISPDIR="\$(prefix)/lib/emacs/site-lisp" + fi + fi + else + if test -d $prefix/share/emacs/site-lisp; then + LISPDIR="\$(prefix)/share/emacs/site-lisp" + else + if test -d $prefix/lib/emacs/site-lisp; then + LISPDIR="\$(prefix)/lib/emacs/site-lisp" + fi + fi + fi + echo "$ac_t""$LISPDIR" 1>&6 + ELCFILES="\$(ELCFILES)" + fi + + + +############################################################################## ################ Generate the configure script ############################### ############################################################################## @@ -3588,7 +3816,7 @@ done ac_given_srcdir=$srcdir ac_given_INSTALL="$INSTALL" -trap 'rm -fr `echo "Makefile doc/Makefile lib/Makefile src/Makefile intl/Makefile po/Makefile.in config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +trap 'rm -fr `echo "Makefile doc/Makefile lib/Makefile libidu/Makefile src/Makefile lisp/Makefile intl/Makefile po/Makefile.in testsuite/Makefile config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 EOF cat >> $CONFIG_STATUS <<EOF @@ -3641,6 +3869,7 @@ s%@MSGFMT@%$MSGFMT%g s%@GMSGFMT@%$GMSGFMT%g s%@XGETTEXT@%$XGETTEXT%g s%@GENCAT@%$GENCAT%g +s%@USE_INCLUDED_LIBINTL@%$USE_INCLUDED_LIBINTL%g s%@CATALOGS@%$CATALOGS%g s%@CATOBJEXT@%$CATOBJEXT%g s%@DATADIRNAME@%$DATADIRNAME%g @@ -3649,15 +3878,21 @@ s%@INSTOBJEXT@%$INSTOBJEXT%g s%@INTLDEPS@%$INTLDEPS%g s%@INTLLIBS@%$INTLLIBS%g s%@INTLOBJS@%$INTLOBJS%g -s%@INTLSUB@%$INTLSUB%g s%@POFILES@%$POFILES%g s%@POSUB@%$POSUB%g +s%@GT_NO@%$GT_NO%g +s%@GT_YES@%$GT_YES%g +s%@MKINSTALLDIRS@%$MKINSTALLDIRS%g +s%@LANGUAGE_MAP_FILE@%$LANGUAGE_MAP_FILE%g +s%@EMACS@%$EMACS%g +s%@LISPDIR@%$LISPDIR%g +s%@ELCFILES@%$ELCFILES%g CEOF EOF cat >> $CONFIG_STATUS <<EOF -CONFIG_FILES=\${CONFIG_FILES-"Makefile doc/Makefile lib/Makefile src/Makefile intl/Makefile po/Makefile.in"} +CONFIG_FILES=\${CONFIG_FILES-"Makefile doc/Makefile lib/Makefile libidu/Makefile src/Makefile lisp/Makefile intl/Makefile po/Makefile.in testsuite/Makefile"} EOF cat >> $CONFIG_STATUS <<\EOF for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then diff --git a/configure.in b/configure.in index 19c8f63..8b48065 100644 --- a/configure.in +++ b/configure.in @@ -19,7 +19,7 @@ AC_ARG_PROGRAM ############################################################################## PACKAGE=id-utils -VERSION=3.0.9 +VERSION=3.1 PACKAGE_VERSION="$PACKAGE-$VERSION" AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE") AC_DEFINE_UNQUOTED(VERSION, "$VERSION") @@ -38,8 +38,8 @@ ALL_LINGUAS="de fr" changequote(,)dnl case $VERSION in -*.*.*) README_ALPHA=README-alpha;; -*) README_ALPHA=;; +*[a-z]) README_ALPHA=README-alpha;; +*) README_ALPHA=;; esac changequote([, ])dnl AC_SUBST(README_ALPHA) @@ -73,8 +73,9 @@ AC_HEADER_DIRENT AC_HEADER_STDC AC_HEADER_STAT AC_HEADER_SYS_WAIT -AC_CHECK_HEADERS(limits.h sys/types.h sys/param.h stdlib.h unistd.h string.h) -AC_CHECK_HEADERS(malloc.h sys/ioctl.h termios.h termio.h sgtty.h regex.h) +AC_CHECK_HEADERS(sys/types.h sys/param.h sys/stat.h sys/ioctl.h) +AC_CHECK_HEADERS(limits.h stddef.h stdlib.h unistd.h string.h fcntl.h) +AC_CHECK_HEADERS(malloc.h termios.h termio.h sgtty.h regex.h memory.h) ############################################################################## ################ Check for typedefs, structs, and compiler params ############ @@ -85,12 +86,13 @@ fp_C_PROTOTYPES AC_TYPE_SIGNAL AC_TYPE_OFF_T AC_TYPE_SIZE_T +md_TYPE_PTRDIFF_T ############################################################################## ################ Set default compilation flags ############################### ############################################################################## -: ${CFLAGS=-g} +: ${CFLAGS="-O -g"} : ${LDFLAGS=-g} AC_SUBST(CFLAGS) AC_SUBST(LDFLAGS) @@ -100,12 +102,11 @@ AC_SUBST(LDFLAGS) ############################################################################## AC_FUNC_ALLOCA -gm_DECL_SBRK -gm_DECL_SYS_ERRLIST ud_WITH_REGEX -AC_CHECK_FUNCS(getwd getcwd link) -AC_REPLACE_FUNCS(strcasecmp strdup strndup strtok fnmatch) -AC_REPLACE_FUNCS(basename dirname error memcpy memset) +AC_FUNC_VPRINTF +AC_CHECK_FUNCS(getwd getcwd link strerror isascii bcopy bzero memcpy) +AC_REPLACE_FUNCS(strdup strndup strspn strcspn strpbrk strstr strtok) +AC_REPLACE_FUNCS(basename dirname fnmatch error memcpy memset) AC_REPLACE_GNU_GETOPT AC_REPLACE_OBSTACK @@ -117,10 +118,29 @@ ud_GNU_GETTEXT AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl) ############################################################################## +################ Find a home for language map ################################ +############################################################################## + +if test "x$prefix" != xNONE; then + datadir=$prefix/share +else + datadir=$ac_default_prefix/share +fi +LANGUAGE_MAP_FILE=$datadir/id-lang.map +AC_DEFINE_UNQUOTED(LANGUAGE_MAP_FILE, "$LANGUAGE_MAP_FILE") +AC_SUBST(LANGUAGE_MAP_FILE) + +############################################################################## +################ Find a home for Emacs Lisp code ############################# +############################################################################## + +ud_PATH_LISPDIR + +############################################################################## ################ Generate the configure script ############################### ############################################################################## -AC_OUTPUT([Makefile doc/Makefile lib/Makefile src/Makefile intl/Makefile po/Makefile.in], +AC_OUTPUT([Makefile doc/Makefile lib/Makefile libidu/Makefile src/Makefile lisp/Makefile intl/Makefile po/Makefile.in testsuite/Makefile], [sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile; \ test -z "$CONFIG_HEADERS" || echo timestamp >stamp-h]) diff --git a/doc/Makefile.am b/doc/Makefile.am index b7d1100..48aed71 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -1,3 +1,5 @@ ## Process this file with automake to produce Makefile.in info_TEXINFOS = id-utils.texi + +EXTRA_DIST = texinfo.tex diff --git a/doc/Makefile.in b/doc/Makefile.in index 650fddf..5877513 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -39,12 +39,14 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ transform = @program_transform_name@ info_TEXINFOS = id-utils.texi + +EXTRA_DIST = texinfo.tex mkinstalldirs = $(top_srcdir)/mkinstalldirs CONFIG_HEADER = ../config.h MAKEINFO = makeinfo TEXI2DVI = texi2dvi -INFOS = id-utils.info* +INFOS = id-utils.info id-utils.info-[0-9] id-utils.info-[0-9][0-9] INFO_DEPS = id-utils.info DVIS = id-utils.dvi TEXINFOS = id-utils.texi @@ -106,8 +108,8 @@ id-utils.info: id-utils.texi version.texi install-info: $(INFO_DEPS) $(mkinstalldirs) $(infodir) for file in $(INFO_DEPS); do \ - for ifile in `cd $(srcdir) && echo $$file*`; do \ - $(INSTALL_DATA) $(srcdir)/$$ifile $(infodir)/$$ifile; \ + for ifile in `cd $(srcdir) && echo $$file $$file-[0-9] $$file-[0-9][0-9]`; do \ + test -f $$ifile && $(INSTALL_DATA) $(srcdir)/$$ifile $(infodir)/$$ifile || true; \ done; \ done diff --git a/doc/id-utils.info b/doc/id-utils.info index dcc76e8..abbc871 100644 --- a/doc/id-utils.info +++ b/doc/id-utils.info @@ -2,20 +2,17 @@ This is Info file ../../doc/id-utils.info, produced by Makeinfo-1.63 from the input file ../../doc/id-utils.texi. START-INFO-DIR-ENTRY -* ID database: (id). Identifier database utilities. -* aid: (id)aid invocation. Matching strings. -* eid: (id)eid invocation. Invoking an editor on matches. -* fid: (id)fid invocation. Listing a file's identifiers. -* gid: (id)gid invocation. Listing all matching lines. -* idx: (id)idx invocation. Testing mkid scanners. -* lid: (id)lid invocation. Matching patterns. -* mkid: (id)mkid invocation. Creating an ID database. -* pid: (id)pid invocation. Looking up filenames. +* ID database: (id-utils). Identifier database utilities. +* mkid: (id-utils)mkid invocation. Creating an ID database. +* lid: (id-utils)lid invocation. Matching words and patterns. +* fid: (id-utils)fid invocation. Listing a file's tokens. +* fnid: (id-utils)fnid invocation. Looking up file names. +* xtokid: (id-utils)xtokid invocation. Testing mkid scanners. END-INFO-DIR-ENTRY - This file documents the `mkid' identifier database utilities. + This file documents the `id-utils' database utilities. - Copyright (C) 1991, 1995 Tom Horsley. + Copyright (C) 1996 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are @@ -34,773 +31,738 @@ translation. File: id-utils.info, Node: Top, Next: Introduction, Up: (dir) -ID database utilities -********************* +ID utilities +************ - This manual documents version 3.0.9 of the ID database utilities. + This manual documents version 3.1 of the ID utilities. * Menu: -* Introduction:: Overview of the tools, and authors. +* Introduction:: Overview of the tools with tutorial. +* Quick start:: Quick start procedure. +* Common options:: Common command-line options. * mkid invocation:: Creating an ID database. -* Common query arguments:: Common lookup options and search patterns. -* gid invocation:: Listing all matching lines. -* Looking up identifiers:: lid, aid, eid, and fid. -* pid invocation:: Looking up filenames. +* lid invocation:: Querying an ID database by token. +* fid invocation:: Listing a file's tokens. +* fnid invocation:: Looking up file names. +* xtokid invocation:: Testing language scanners. +* Past and Future:: History and future directions. * Index:: General index. -File: id-utils.info, Node: Introduction, Next: mkid invocation, Prev: Top, Up: Top +File: id-utils.info, Node: Introduction, Next: Quick start, Prev: Top, Up: Top Introduction ************ - An "ID database" is a binary file containing a list of filenames, a -list of identifiers, and a matrix indicating which identifiers appear in -which files. With this database and some tools to manipulate it -(described in this manual), a host of tasks become simpler and faster. -For example, you can list all files containing a particular `#include' -throughout a huge source hierarchy, search for all the memos containing -references to a project, or automatically invoke an editor on all files -containing references to some function. Anyone with a large software -project to maintain, or a large set of text files to organize, can -benefit from an ID database. + An "ID database" is a binary file containing a list of file names, a +list of tokens, and a sparse matrix indicating which tokens appear in +which files. - Although the ID utilities are most commonly used with identifiers, -numeric constants are also stored in the database, and can be searched -for in the same way (independent of radix, if desired). + With this database and some tools to query it (described in this +manual), many text-searching tasks become simpler and faster. For +example, you can list all files that reference a particular `#include' +file throughout a huge source hierarchy, search for all the memos +containing references to a project, or automatically invoke an editor +on all files containing references to some function or variable. +Anyone with a large software project to maintain, or a large set of text +files to organize, can benefit from the ID utilities. - There are a number of programs in the ID family: + Although the name `ID' is short for `identifier', the ID utilities +handle more than just identifiers; they also treat other kinds of +tokens, most notably numeric constants, and the contents of certain +character strings. Thus, this manual will use the word "token" as a +term that is inclusive of identifiers, numbers and strings. -`mkid' - scans files for identifiers and numeric constants and builds the ID - database file. + There are several programs in the ID utilities family: -`gid' - lists all lines that match given patterns. +`mkid' + scans files for tokens and builds the ID database file. `lid' - lists the filenames containing identifiers that match given - patterns. + queries the ID database for tokens, then reports matching file + names or matching lines. -`aid' - lists the filenames containing identifiers that contain given - strings, independent of case. +`fid' + lists all tokens recorded in the database for given files, or + tokens common to two files. -`eid' - invokes an editor on each file containing identifiers that match - given patterns. +`fnid' + matches the file names in the database, rather than the tokens. -`fid' - lists all identifiers recorded in the database for given files, or - identifiers common to two files. +`xtokid' + extracts raw tokens--helps with testing of new `mkid' scanners. -`pid' - matches the filenames in the database, rather than the identifiers. + In addition, the ID utilities have historically provided several +query programs which are specializations of `lid': + +`gid' + (alias for `lid -R grep') lists all lines containing the requested + pattern. -`idx' - helps with testing of new `mkid' scanners. +`eid' + (alias for `lid -R edit') invokes an editor on all files + containing the requested pattern, and if possible, initiates a + text search for that pattern. + +`aid' + (alias for `lid -ils') treats the requested pattern as a + case-insensitive literal substring. - Please report bugs to `gkm@magilla.cichlid.com'. Remember to + Please report bugs to `bug-gnu-utils@gnu.ai.mit.edu'. Remember to include the version number, machine architecture, input files, and any other information needed to reproduce the bug: your input, what you expected, what you got, and why it is wrong. Diffs are welcome, but please include a description of the problem as well, since this is sometimes difficult to infer. *Note Bugs: (gcc)Bugs. -* Menu: - -* Past and future:: How the ID tools came about, and where they're going. - - -File: id-utils.info, Node: Past and future, Up: Introduction - -Past and future -=============== - - Greg McGary conceived of the ideas behind mkid when he began hacking -the Unix kernel in 1984. He needed a navigation tool to help him find -his way around the expansive, unfamiliar landscape. The first -`mkid'-like tools were shell scripts, and produced an ASCII database -that looks much like the output of `lid' with no arguments. It took -over an hour on a VAX 11/750 to build a database for a 4.1BSD-ish -kernel. Lookups were done with the system utility `look', modified to -handle very long lines. - - In 1986, Greg rewrote `mkid', `lid', `fid' and `idx' in C to improve -performance. Database-build times were shortened by an order of -magnitude. The `mkid' tools were first posted to `comp.sources.unix' -in September 1987. - - Over the next few years, several versions diverged from the original -source. Tom Horsley at Harris Computer Systems Division stepped forward -to take over maintenance and integrated some of the fixes from divergent -versions. A first release of `mkid' version 2 was posted to -`alt.sources' near the end of 1990. At that time, Tom wrote this -Texinfo manual with the encouragement the net community. (Tom -especially thanks Doug Scofield and Bill Leonard whom he dragooned into -helping poorfraed and edit--they found several problems in the initial -version.) Karl Berry revamped the manual for Texinfo style, indexing, -and organization in 1995. - - In January 1995, Greg McGary reemerged as the primary maintaner and -launched development of `mkid' version 3, whose primary new feature is -an efficient algorithm for building databases that is linear in both -time and space over the size of the input text. (The old algorithm was -quadratic in space and therefore choked on very large source trees.) -The code is released under the GNU Public License, and might become a -part of the GNU system. `mkid' 3 is an interim release, since several -significant enhancements are still in the works: an optional coupling -with GNU `grep', so that `grep' can use an ID database for hints; a -`cscope' work-alike query interface; incremental update of the ID -database; and an automatic file-tree walker so you need not explicitly -supply every filename argument to the `mkid' program. - - -File: id-utils.info, Node: mkid invocation, Next: Common query arguments, Prev: Introduction, Up: Top - -`mkid': Creating ID databases -***************************** - - The `mkid' program builds an ID database. To do this, it must scan -each file you tell it to include in the database. This takes some time, -but once the work is done the query programs run very rapidly. (You can -run `mkid' as a `cron' job to regularly update your databases.) - - The `mkid' program knows how to extract identifiers from various -types of files. For example, it can recognize and skip over comments -and string constants in a C program. - - Identifiers are not the only thing included in the database. Numbers -are also recognized and included in the database indexed by their binary -value. This feature allows you to find uses of constants without regard -to the radix used to specify them, since the same number can frequently -be written in many different ways (for instance, `47', `0x2f', `057' in -C). - - All the places in this document which mention identifiers should -really mention both identifiers and numbers, but that gets fairly -clumsy after a while, so you just need to keep in mind that numbers are -included in the database as well as identifiers. - - The ID files that `mkid' creates are architecture- and -byte-order-independent; you can share them at will across systems. - -* Menu: - -* mkid options:: Command-line options to mkid. -* Scanners:: Built-in and defining your own. -* mkid examples:: Examples of mkid usage. - -File: id-utils.info, Node: mkid options, Next: Scanners, Up: mkid invocation +File: id-utils.info, Node: Quick start, Next: Common options, Prev: Introduction, Up: Top -`mkid' options -============== - - By default, `mkid' scans the files you specify and writes the -database to a file named `ID' in the current directory. - - mkid [-v] [-SSCANARG] [-aARGFILE] [-] [-fIDFILE] FILES... +Quick Start Procedure +********************* - The program accepts the following options. + Unpack the distribution. -`-v' - Verbose. `mkid' tells you as it scans each file and indicates - which scanner it is using. It also summarizes some statistics - about the database at the end. + Type `./configure' -`-SSCANARG' - Specify options regarding `mkid''s scanners. *Note Scanner option - formats::. + Type `make' -`-aARGFILE' - Read additional command line arguments from ARGFILE. This is - typically used to specify lists of filenames longer than will fit - on a command line; some systems have severe limitations on the - total length of a command line. + Type `make install' as a user with the appropriate privileges + (e.g., `bin' or perhaps even `root'). -`-' - Read additional command line arguments from standard input. + Type `cd /usr/include; mkid' to build an ID database covering all + of the system header files. -`-fIDFILE' - Write the database to the file IDFILE, instead of `ID'. The - database stores filenames relative to the directory containing the - database, so if you move the database to a different directory - after creating it, you may have trouble finding files. + Type `lid FILE', then `gid strtok', then `aid stdout'. - The remaining arguments FILES are the files to be scanned and -included in the database. If no files are given at all (either on -command line or via `-a' or `-'), `mkid' does nothing. + You have just built, installed and used the most common commands of +the GNU ID utilities. If you ever need help remembering which system +header files contain a particular declaration, or reference a +particular symbol, you'll want to keep the ID file you built in +`/usr/include' for later use. If your working directory is elsewhere +at the time, simply provide the `-f /usr/include' option to `lid' +(*note Reading options::.). -File: id-utils.info, Node: Scanners, Next: mkid examples, Prev: mkid options, Up: mkid invocation +File: id-utils.info, Node: Common options, Next: mkid invocation, Prev: Quick start, Up: Top -Scanners -======== +Common command-line options +*************************** - To determine which identifiers to extract from a file and store in -the database, `mkid' calls a "scanner"; we say a scanner "recognizes" a -particular language. Scanners for several languages are built-in to -`mkid'; you can add your own scanners as well, as explained in the -sections below. - - `mkid' determines which scanner to use for a particular file by -looking at the suffix of the filename. This "suffix" is everything -after and including the last `.' in a filename; for example, the suffix -of `foo.c' is `.c'. `mkid' has a built-in list of bindings from some -suffixes to corresponding scanners; for example, `.c' files are (not -surprisingly) scanned by the predefined C language scanner. - - If `mkid' cannot determine what scanner to use for a particular -file, either because the file has no suffix (e.g., `foo') or because -`mkid' has no binding for the file's suffix (e.g., `foo.bar'), it uses -the scanner bound to the `.default' suffix. By default, this is the -plain text scanner (*note Plain text scanner::.), but you can change -this with the `-S' option, as explained below. + Certain options, and regular expression syntax, are shared by various +groupings of the ID utilities. We describe these in the sections below, +rather than repeating them for each program. * Menu: -* Scanner option formats:: Overview of the -S option. -* Predefined scanners:: The C, plain text, and assembler scanners. -* Defining new scanners:: Either in source code or at runtime with -S. -* idx invocation:: Testing mkid scanners. +* Universal options:: Options common to all programs. +* Extraction options:: Options for programs that extract tokens from source files. +* Walker options:: Options for programs that walk file and directory trees. +* Reading options:: Options for programs that read ID databases. +* Writing options:: Options for programs that write ID databases. +* File listing options:: Options for programs that list file names. -File: id-utils.info, Node: Scanner option formats, Next: Predefined scanners, Up: Scanners - -Scanner option formats ----------------------- - - With the `-S' option, you can change which language scanner to use -for which files, give language-specific options, and get some limited -online help about scanner options. - - Here are the different forms of the `-S' option: +File: id-utils.info, Node: Universal options, Next: Extraction options, Up: Common options -`-S.SUFFIX=SCANNER' - Use SCANNER for a file with the given `.SUFFIX'. For example, - `-S.yacc=c' tells `mkid' to use the `c' language scanner for all - files ending in `.yacc'. +Options Common to All Programs +============================== -`-S.SUFFIX=?' - Display which scanner is used for the given `.SUFFIX'. +`--help' + Print a usage message listing all available options, then exit + successfully. -`-S?=SCANNER' - Display which suffixes SCANNER is used for. - -`-S?=?' - Display the scanner binding for every known suffix. - -`-SSCANNER+ARG' -`-SSCANNER-ARG' - Each scanner accepts certain scanner-dependent arguments. These - options all have one of these forms. *Note Predefined scanners::. - -`-SSCANNER?' - Display the scanner-specific options accepted by SCANNER. - -`-SNEW-SCANNER/OLD-SCANNER/FILTER-COMMAND' - Define NEW-SCANNER in terms of OLD-SCANNER and FILTER-COMMAND. - *Note Defining scanners with options::. +`--version' + Print the version number, then exit successfully. -File: id-utils.info, Node: Predefined scanners, Next: Defining new scanners, Prev: Scanner option formats, Up: Scanners +File: id-utils.info, Node: Reading options, Next: Writing options, Prev: Walker options, Up: Common options -Predefined scanners -------------------- +Options for Programs that Read ID Databases +=========================================== - `mkid' has built-in scanners for several types of languages; you can -get the list by running `mkid -S?=?'. The supported languages are -documented below(1). +`-f FILENAME' +`--file=FILENAME' + FILENAME is the ID database to read when processing queries. At + present, only a single `--file' option is processed, but in future + releases, more than one ID database may be named on the command + line. -* Menu: +`$IDPATH' + `IDPATH' is an environment variable that contains a + colon-separated list of ID database names. If this variable is + present, and no `--file' options are presented on the command + line, the ID databases named in `IDPATH' are implied.(1) -* C scanner:: For the C programming language. -* Plain text scanner:: For documents or other non-source code. -* Assembler scanner:: For assembly language. + If no ID databases are specified either on the command line or via +the `IDPATH' environment variable, then the ID utilities search for a +file named `ID' in the current working directory, and then in +successive parent directories. ---------- Footnotes ---------- - (1) This is not strictly true: `vhil' is a supported language, but -it is an obsolete and arcane dialect of C and should be ignored. + (1) At present, this feature is fully implemented, since only the +first of a list of ID database names is processed. -File: id-utils.info, Node: C scanner, Next: Plain text scanner, Up: Predefined scanners - -C scanner -......... +File: id-utils.info, Node: Writing options, Next: File listing options, Prev: Reading options, Up: Common options - The C scanner is the most commonly used. Files with the usual `.c' -and `.h' suffixes, and the `.y' (yacc) and `.l' (lex) suffixes, are -processed with this scanner (by default). +Options for Programs that Write ID Databases +============================================ - Scanner-specific options: +`-o FILENAME' +`--output=FILENAME' + The `--output' option names the file in which to write a new ID + database. If no `--output' (or `--file') option is present, an + output file named `ID' is implied. -`-Sc-sCHARACTER' - Allow the specified CHARACTER in identifiers. For example, if you - use `$' in identifiers, you'll want to use `-Sc-s$'. - -`-Sc+u' - Strip leading underscores from identifiers. You might to do this in - peculiar circumstances, such as trying to parse the output from - `nm' or some other system utility. - -`-Sc-u' - Don't strip leading underscores from identifiers; this is the - default. +`-f FILENAME' +`--file=FILENAME' + This is a synonym for `--output' -File: id-utils.info, Node: Plain text scanner, Next: Assembler scanner, Prev: C scanner, Up: Predefined scanners - -Plain text scanner -.................. - - The plain text scanner is intended for scanning most non-source-code -files. This is typically the scanner used when adding custom scanners -via `-S' (*note Defining scanners with options::.). +File: id-utils.info, Node: Walker options, Next: Reading options, Prev: Extraction options, Up: Common options - Scanner-specific options: +Options for Programs that Walk File and Directory Trees. +======================================================== -`-Stext+aCHARACTER' - Include CHARACTER in identifiers. By default, letters (a-z and - A-Z) and underscore are included. + The programs `mkid' and `xtokid' accept the names of files and +directories on the command line. Files are scanned if there is a +scanner available and enabled for the file's source language. +Directories are recursively descended, searching for files whose names +match the rules listed in the *language map* file (*note Language +map::.). -`-Stext-aCHARACTER' - Exclude CHARACTER from identifiers. + The following option controls the file tree walker: -`-Stext+sCHARACTER' - Squeeze CHARACTER from identifiers, i.e., do not terminate an - identifier when CHARACTER is seen. By default, the characters - `'', `-', and `.' are squeezed out of identifiers. For example, - the input `fred's' leads to the identifier `freds'. - -`-Stext-sCHARACTER' - Do not squeeze CHARACTER. +`-p NAMES' +`--prune=NAMES' + One or more file or directory names may appear in NAMES. The file + tree walker will stop short at these files and directories and + their contents will not be scanned. -File: id-utils.info, Node: Assembler scanner, Prev: Plain text scanner, Up: Predefined scanners - -Assembler scanner -................. - - Since assembly languages come in several flavors, this scanner has a -number of options: +File: id-utils.info, Node: File listing options, Prev: Writing options, Up: Common options -`-Sasm-cCHARACTER' - Define CHARACTER as starting a comment that extends to the end of - the input line; no default. In many assemblers this is `;' or `#'. +Options for Programs that List File Names +========================================= -`-Sasm+u' -`-Sasm-u' - Strip (`+u') or do not strip (`-u') leading underscores from - identifiers. The default is to strip them. + The programs `lid' and `fnid' can print lists of file names as the +result of queries. The following option controls how these lists are +formatted: -`-Sasm+aCHARACTER' - Allow CHARACTER in identifiers. +`-S STYLE' +`--separator=STYLE' + STYLE may be one of `braces', `space' or `newline'. -`-Sasm-aCHARACTER' - Allow CHARACTER in identifiers, but if an identifier contains - CHARACTER, ignore it. This is useful to ignore temporary labels, - which can be generated in great profusion; these often contain `.' - or `@'. + The STYLE of `braces' means that file names with common directory + prefix and common suffix are printed using the shell's brace + notation in order to compress the output. For example, + `../src/foo.c ../src/bar.c' can be printed in brace notation as + `../src/{foo,bar}.c'. -`-Sasm+p' -`-Sasm-p' - Recognize (`+p') or do not recognize (`-p') C preprocessor - directives in assembler source. The default is to recognize them. + The STYLEs of `space' and `newline' mean that file names are + separated spaces or by newlines, respectively. -`-Sasm+C' -`-Sasm-C' - Skip over (`+C') or do not skip over (`-C') C style comments in - assembler source. The default is to skip them. + If the list of files is being printed on a terminal, brace + notation is the default. If not, file names are separated by + spaces if the KEY is included in the output, and by newlines the + KEY STYLE is `none' (*note lid invocation::.). -File: id-utils.info, Node: Defining new scanners, Next: idx invocation, Prev: Predefined scanners, Up: Scanners - -Defining new scanners ---------------------- - - You can add new scanners to `mkid' in two ways: modify the source -code and recompile, or at runtime via the `-S' option. Each has their -advantages and disadvantages, as explained below. +File: id-utils.info, Node: Extraction options, Next: Walker options, Prev: Universal options, Up: Common options + +Options for Programs that Scan Source Files +=========================================== + + `mkid' and `xtokid' walk file trees, select source files by name, +and extract tokens from source files. They accept the following +options: + +`-m MAPFILE' +`--lang-map=MAPFILE' + MAPFILE contains rules for determining the source languages from + file names. *Note Language map:: + +`-i LANGUAGES' +`--include=LANGUAGES' + The `--include' option names LANGUAGES whose source files should + be scanned and incorporated into the ID database. By default, all + languages known to the ID utilities are enabled. + +`-x LANGUAGES' +`--exclude=LANGUAGES' + The `--exclude' option names LANGUAGES whose source files should + NOT be scanned. The default list of excluded languages is empty. + Note that only one of `--include' or `--exclude' may be specified + on the command line for a single run. + +`-l LANGUAGE:OPTIONS' +`--lang-option=LANGUAGE:OPTIONS' + Language-specific scanners also accept options. LANGUAGE denotes + the desired scanner, and OPTION are the command-line options that + should be passed through to it. For example, to pass the -X + -COKE-BOTTLE options to the scanner for the language SWIZZLE, pass + this: -L SWIZZLE:"-X -COKE-BOTTLE", or this: + -LANG-OPTION=SWIZZLE:"-X -COKE-BOTTLE", or this: -L SWIZZLE-X -L + SWIZZLE:-COKE-BOTTLE. Use the `--help' option to see the + command-line option summary for + + To determine which tokens to extract from a file and store in the +database, `mkid' calls a "scanner"; we say a scanner "recognizes" a +particular language. Scanners for several languages are built-in to +`mkid'; you can add your own scanners as well, as explained in *Note +Defining scanners::. - If you create a new scanner that would be of use to others, please -consider sending it back to the maintainer, `gkm@magilla.cichlid.com', -for inclusion in future releases of `mkid'. + The ID utilities determine which scanner to use for a particular +file by consulting the language-map file. Scanners for several are +already built-in to the ID utilities. You can see which languages have +built-in scanners, and examine their language-specific options by +invoking `mkid --help' or `xtokid --help'. * Menu: -* Defining scanners in source code:: -* Defining scanners with options:: +* Language map:: Mapping file names to source languages. +* C/C++ scanner:: For the C and C++ programming language. +* Assembler scanner:: For assembly language. +* Text scanner:: For documents or other non-source code. +* Defining scanners:: Defining new scanners in the source code. -File: id-utils.info, Node: Defining scanners in source code, Next: Defining scanners with options, Up: Defining new scanners - -Defining scanners in source code -................................ - - To add a new scanner in source code, you should add a new section to -the file `scanners.c'. Copy one of the existing scanners (most likely -either C or plain text), and modify as necessary. Also add the new -scanner to the `languages_0' and `suffixes_0' tables near the beginning -of the file. - - This is not a terribly difficult programming task, but it requires -recompiling and installing the new version of `mkid', which may be -inconvenient. - - This method leads to scanners which operate much more quickly than -ones that depend on external programmers. It is also likely the -easiest way to define scanners for new programming languages. +File: id-utils.info, Node: Language map, Next: C/C++ scanner, Up: Extraction options + +Mapping file names to source languages +-------------------------------------- + + The file `id-lang.map', installed by default in +`$(prefix)/share/id-lang.map', contains rules for mapping file names to +source languages. Each rule comprises three parts: a shell GLOB +pattern, a language name, and language-specific scanner options. + + The special pattern `**' denotes the default source language. This +is the language that's assigned to file names that don't match any other +pattern. + + The special pattern `***' should be followed by a file name. The +named file should contain more language-map rules and is included at +this point. + + The order in which rules are presented in a language-map file is +significant. This order influences the order in which files are +displayed as the result of queries. For example, the distributed +language-map file places all rules for C .H files ahead of .C files, so +that in general, declarations will precede definitions in query output. +The same thing is done for C++ and its many different source file name +extensions. + + Here is a pared-down version of the `id-lang.map' file distributed +with the ID utilities: + + + # Default language + ** IGNORE # Although this is listed first, + # the default language pattern is + # logically matched last. + + # Backup files + *~ IGNORE + *.bak IGNORE + *.bk[0-9] IGNORE + + # SCCS files + [sp].* IGNORE + + # list header files before code files + *.h C + *.h.in C + *.H C++ + *.hh C++ + *.hpp C++ + *.hxx C++ + + # list C `meta' files next + *.l C + *.lex C + *.y C + *.yacc C + + # list C code files after header files + *.c C + *.C C++ + *.cc C++ + *.cpp C++ + *.cxx C++ + + # list assembly language after C + *.[sS] asm --comment=; + *.asm asm --comment=; + + # [nt]roff + *.[0-9] roff + *.ms roff + *.me roff + *.mm roff + + # TeX and friends + *.tex TeX + *.ltx TeX + *.texi texinfo + *.texinfo texinfo -File: id-utils.info, Node: Defining scanners with options, Prev: Defining scanners in source code, Up: Defining new scanners - -Defining scanners with options -.............................. - - You can use the `-S' option on the command line to define a new -language scanner: - - -SNEW-SCANNER/EXISTING-SCANNER/FILTER - -Here, NEW-SCANNER is the name of the new scanner being defined, -EXISTING-SCANNER is the name of an existing scanner, and FILTER is a -shell command or pipeline. +File: id-utils.info, Node: C/C++ scanner, Next: Assembler scanner, Prev: Language map, Up: Extraction options - The new scanner works by passing the input file to FILTER, and then -arranging for the result to be passed through EXISTING-SCANNER. -Typically, EXISTING-SCANNER is `text'. - - Somewhere within FILTER, the string`%s' should occur. This `%s' is -replaced by the name of the source file being scanned. - - For example, `mkid' has no built-in scanner for Texinfo files (like -this one). In indexing a Texinfo file, you most likely would want to -ignore the Texinfo @-commands. Here's one way to specify a new scanner -to do this: - - -S/texinfo/text/sed s,@[a-z]*,,g %s - - This defines a new language scanner (`texinfo') defined in terms of -a `sed' command to strip out Texinfo directives (an `@' character -followed by letters). Once the directives are stripped, the remaining -text is run through the plain text scanner. +C/C++ Language Scanner +---------------------- - This is a minimal example; to do a complete job, you would need to -completely delete some lines, such as those beginning with `@end' or -@node. + The C scanner is the most commonly used. Files that match the glob +pattern `*.h', `*.c', as well as `yacc' files that match `*.y' or +`*.yacc', and `lex' files that match `*.l' or `*.lex', are processed +with this scanner. + + Scanner-specific options (Note, these options are presented WITHOUT +the required `-l' or `--lang-option=' prefix): + +`-k CHARACTER-CLASS' +`--keep=CHARACTER-CLASS' + Consider the characters in CHARACTER-CLASS as valid constituents of + identifier names. For example, if you are indexing C code that + contains `$' in some of its identifiers, you can include these by + using `--lang-option=C:--keep=$', or `-l C:"-k $"' (if you don't + like to type so much). + +`-i CHARACTER-CLASS' +`--ignore=CHARACTER-CLASS' + x mkiConsider the characters in CHARACTER-CLASS as valid + constituents of identifier names, but discard all tokens + containing these characters. For example, if some C code has + identifiers containing `$', but you don't want these cluttering up + your ID database, use `--lang-option=C:--ignore=$', or the terser + equivalent `-l C:"-i $"'. + +`-u' +`--strip-underscore' + Strip one leading underscore from C identifiers encapsulated as + character strings. This option is useful if you are indexing C + code that contains symbol-table name strings for systems that + prepend an underscore to external symbols. By default, the + leading underscore is retained. -File: id-utils.info, Node: idx invocation, Prev: Defining new scanners, Up: Scanners - -`idx': Testing `mkid' scanners ------------------------------- - - `idx' prints the identifiers found in the files you specify to -standard output. This is useful in debugging new `mkid' scanners (*note -Scanners::.). Synopsis: +File: id-utils.info, Node: Assembler scanner, Next: Text scanner, Prev: C/C++ scanner, Up: Extraction options + +Assembly Language Scanner +------------------------- + + Assembly languages use a variety of commenting conventions, and +allow a variety of special characters to *dirty up* local symbols, +preventing name space conflicts with symbols defined by higher-level +languages. Also, some compilation systems prepend an underscore to +external symbols. The options listed below are designed to address +these differences. + +`-c CHARACTER-CLASS' +`--comment=CHARACTER-CLASS' + The characters in CHARACTER-CLASS are considered left delimiters + for comments that extend until the end of the current line. + +`-k CHARACTER-CLASS' +`--keep=CHARACTER-CLASS' + Consider the characters of CHARACTER-CLASS as valid constituents of + identifier names. For example, if you are indexing assembly code + that prepends `.' to assembler directives, and prepends `%' to + register names, you can keep these characters in the tokens by + specifying `--lang-option=asm:--keep=.%', or `-l asm:"-k .%"'. + +`-i CHARACTER-CLASS' +`--ignore=CHARACTER-CLASS' + Consider the characters of CHARACTER-CLASS as valid consituents of + identifier names, but discard all tokens containing these + characters. For example, if you don't want to clutter your ID + database with assembler directives that begin with a leading `.' + or with assembler labels that contain `@', use + `--lang-option=asm:--ignore=.@', or `-l asm:"-i .@"'. + +`-u' +`--strip-underscore' + Strip one leading underscore from identifiers. This option is + useful if your compilation system prepends an underscore to + external symbols. By stripping the underscore, you can + canonicalize such names and bring them into conformance the way + they are expressed in the C language. By default, the leading + underscore is retained. - idx [-SSCANARG] FILES... - - `idx' accepts the same `-S' options as `mkid'. *Note Scanner option -formats::. - - The name "idx" stands for "ID eXtract". The name may change in -future releases, since this is such an infrequently used program. +`-n' +`--no-cpp' + Do not recognize C preprocessor directives. By default, such + lines are handled in the same way as they are by the C language + scanner. -File: id-utils.info, Node: mkid examples, Prev: Scanners, Up: mkid invocation - -`mkid' examples -=============== - - The simplest example of `mkid' is something like: - - mkid *.[chy] - - This will build an ID database indexing identifiers and numbers in -the all the `.c', `.h', and `.y' files in the current directory. -Because `mkid' already knows how to scan files with those suffixes, no -additional options are needed. +File: id-utils.info, Node: Text scanner, Next: Defining scanners, Prev: Assembler scanner, Up: Extraction options - Here's a more complex example. Suppose you want to build a database -indexing the contents of all the `man' pages, and furthur suppose that -your system is using `gzip' (*note Top: (gzip)Top.) to store compressed -`cat' versions of the `man' pages in the directory `/usr/catman'. The -`gzip' program creates files with a `.gz' suffix, so you must tell -`mkid' how to scan `.gz' files. Here are the commands to do the job: +Text Scanner +------------ - cd /usr/catman - find . -name \*.gz -print | mkid '-Sman/text/gzip <%s' -S.gz=man - + The plain text scanner is intended for human-language documents, or +as the scanner of last resort for files that have no scanner that is +more specific. It is customizable to the extent that character classes +can be designated as token constituents or as token delimiters. The +default token constituents are the alpha-numerics; all other characters +are considered token delimiters. -Explanation: +`-i CHARACTER-CLASS' +`--include=CHARACTER-CLASS' + Include characters belonging to CHARACTER-CLASS in tokens. - 1. We first `cd' to `/usr/catman' so the ID database will store the - correct relative filenames. +`-x CHARACTER-CLASS' +`--exclude=CHARACTER-CLASS' + Exclude characters belonging to CHARACTER-CLASS from tokens, i.e., + treat them as token delimiters. - 2. The `find' command prints the names of all `.gz' files under the - current directory. *Note find invocation: (sh-utils)find - invocation. - - 3. This list is piped to `mkid'; the `-' option (at the end of the - line) tells `mkid' to read arguments (in this case, as is typical, - the list of filenames) from standard input. *Note mkid options::. + +File: id-utils.info, Node: Defining scanners, Prev: Text scanner, Up: Extraction options - 4. The `-Sman/text/gzip ...' defines a new language `man' in terms of - the `gzip' program and `mkid''s existing text scanner. *Note - Defining scanners with options::. +Defining New Scanners in the Source Code +---------------------------------------- - 5. The `-S.gz=man' tells `mkid' to treat all `.gz' files as this new - language `man'. *Note Scanner option formats::. + To add a new scanner in source code, you should add a new section to +the file `scanners.c'. It might be easiest to clone one of the +existing scanners and modify it as necessary. For the hypothetical +language FOO, you must define the functions `get_token_foo', +`parse_args_foo', `help_me_foo', as well as the tables +`long_options_foo' and `args_foo'. If your scanner is modelled after +one of the existing scanners, you'll also need a character-attribute +table `ctype_foo'. + This is not a terribly difficult programming task, but it requires +recompiling and installing the new version of `mkid' and `xtokid'. You +should use `xtokid' to test the operation of the new scanner. - As a further complication, `cat' pages typically contain underlining -and backspace sequences, which will confuse `mkid'. To handle this, -the `gzip' command becomes a pipeline, like this: + Once these functions and tables are ready, add function prototypes +and an entry to to the `languages_0' table near the beginning of the +file. - mkid '-Sman/text/gzip <%s | col -b' -S.gz=man - + Be warned that the existing scanners are built for speed, not +elegance or readability. You might wish to create a new scanner that's +easier to read and understand if you don't feel that speed is so +important. -File: id-utils.info, Node: Common query arguments, Next: gid invocation, Prev: mkid invocation, Up: Top - -Common query arguments -********************** - - Certain options, and regular expression syntax, are shared by the ID -query tools. So we describe those things in the sections below, instead -of repeating the description for each tool. +File: id-utils.info, Node: mkid invocation, Next: lid invocation, Prev: Common options, Up: Top + +`mkid': Creating an ID Database +******************************* + + `mkid' builds an ID database. It accepts the names of files and/or +directories on the command line, selects files that have an enabled +scanner, then extracts and stores tokens from those files. The +resulting ID database is architecture- and byte-order-independent so it +can be shared among all systems. + + The primary virtues of `mkid' are speed and high capacity. The size +of the source trees it can index is limited only by available system +memory. `mkid''s indexing algorithm is very space-efficient and +exhibits excellent locality-of-reference, and so is capable of +operating with a working-set size that is only half the size of its +virtual address space. A typical UNIX-like operating system with 16 +megabytes of system memory should be able to build an ID database +covering approximately 12,000-14,000 source files totalling +approximately 50-100 Megabytes. A 66 Mhz 486 computer can build such a +large ID database in approximately 10-15 minutes. + + In a future release, `mkid' will be able to incrementally update an +ID database much faster than it can build one from scratch. Until this +feature becomes available, it might be a good idea to schedule a `cron' +job to regularly update large ID databases during off-hours. + + `mkid' writes the ID file, therefore it accepts the `--output' (and +`--file') options as described in *Note Writing options::. `mkid' +extracts tokens from source files, therefore it accepts the +`--lang-map', `--include', `--exclude', and `--lang-option' options, as +well as the language-specific scanner options, all of which are +described in *Note Extraction options::. `mkid' walks file trees, +therefore it handles file and directory names on its command line and +the `--prune' option as described in *Note Walker options::. + + In addition, `mkid' accepts the following command-line options: + +`-s' +`--statistics' + `mkid' reports statistics about resource usage at the end of its + run. -* Menu: - -* Query options:: -f -r -c -ew -kg -n -doxa -m -F -u. -* Patterns:: Regular expression syntax for searches. -* Examples: Query examples. Some common uses. +`-v' +`--verbose' + `mkid' reports statistics about each file as it is scanned, and + about the resource usage of its indexing algorithm at regular + intervals. -File: id-utils.info, Node: Query options, Next: Patterns, Up: Common query arguments - -Query options -============= - - The ID query tools (*not* `mkid') share certain command line -options. Not all of these options are recognized by all programs, but -if an option is used by more than one program, it is described below. -The description of each program gives the options that program uses. - -`-fIDFILE' - Read the database from IDFILE, in the current directory or in any - directory above the current directory. The default database name - is `ID'. Searching parent directories lets you have a single ID - database at the root of a large source tree and then use the query - tools from anywhere within that tree. - -`-rDIRECTORY' - Find files relative to DIRECTORY, instead of the directory in - which the ID database was found. This is useful if the ID - database was moved after its creation. - -`-c' - Equivalent to `-r`pwd`', i.e., find files relative to the current - directory, instead of the directory in which the ID database was - found. - -`-e' -`-w' - `-e' forces pattern arguments to be treated as regular expressions, - and `-w' forces pattern arguments to be treated as constant - strings. By default, the query tools guess whether a pattern is - regular expressions or constant strings by looking for special - characters. *Note Patterns::. - -`-k' -`-g' - `-k' suppresses use of shell brace notation in the output. By - default, the query tools that generate lists of filenames attempt - to compress the lists using the usual shell brace notation, e.g., - `{foo,bar}.c' to mean `foo.c' and `bar.c'. (This is useful if you - use `ksh' or the original (not GNU) `sh' and want to feed the list - of names to another command, since those shells do not support - this brace notation; the name of the `-k' option comes from the - `k' in `ksh'). - - `-g' turns on use of brace notation; this is only needed if the - query tools were compiled with `-k' as the default behavior. +File: id-utils.info, Node: lid invocation, Next: fid invocation, Prev: mkid invocation, Up: Top + +`lid': Querying an ID Database by Token +*************************************** + + The `lid' program accepts PATTERNS on the command line which it +matches against the tokens stored in an ID database. The +interpretation of a PATTERN is determined by the makeup of the PATTERN +string itself, or can be overridden by command-line options. If a +PATTERN contains regular expression meta-characters, it is used to +perform a regular-expression substring search. If no such +meta-characters are present, PATTERN is used to perform a literal word +search. (By default, all searches are sensitive to alphabetic case.) +If no PATTERN is supplied on the command line, `lid' lists every entry +in the ID database. + + `lid' reads the ID database, therefore it accepts the `--file' +option, and consults the `IDPATH' environment variable, as described in +*Note Reading options::. `lid' lists file names, therefore it accepts +the `--separator' option, as described in *Note File listing options::. + + In addition, `lid' accepts the following command-line options: + +`-i' +`--ignore-case' + Ignoring differences in alphabetic case between the PATTERN and + the tokens in the ID database. + +`-l' +`--literal' + Match PATTERN as a literal string. Use this option if PATTERN + contains regular-expression meta-characters, but you don't wish to + perform a regular-expression search. + +`-r' +`--regexp' + Match PATTERN as an *extended* regular expression(1). Use this + option if no regular-expression expression meta-characters are + present in PATTERN, but you wish to force a regular-expression + search (note: in this case, a *literal substring* search might be + faster). -`-n' - Suppress the matching identifier before each list of filenames - that the query tools output by default. This is useful if you want - a list of just the names to feed to another command. +`-w' +`--word' + Match PATTERN using a word-delimited (non substring) search. This + is the default for literal searches. + +`-s' +`--substring' + Match PATTERN using a substring (non word-delimited) search. This + is the default for regular expression searches. + +`-k STYLE' +`--key=STYLE' + STYLE can be one of `token', `pattern' or `none'. This option + controls how the subject of the query is presented. This is best + illustrated by example: + + $ lid --key=token '^dest.' + destaddr libsys/memcpy.c + destination libsys/regex.c + destlst libsys/rx.c + destpos libsys/rx.c + destset libsys/rx.h libsys/rx.c + + $ lid --key=pattern '^dest.' + ^dest. libsys/rx.h libsys/{memcpy,regex,rx}.c + + $ lid --key=none '^dest.' + libsys/rx.h libsys/{memcpy,regex,rx}.c + + When `--key' is either `token' or `pattern', the first column of + output is a TOKEN or PATTERN, respectively. When `--key' is + `none', neither of these is printed, and the file name list begins + immediately. The default is `token'. + +`-R STYLE' +`--result=STYLE' + STYLE can be one of `filenames', `grep', `edit' or `none'. This + option controls how the value associated with the query's KEY + presented. When STYLE is `filenames', a list of file names is + printed (this is the default). When STYLE is `grep', the lines + that match PATTERN are printed in the same format as `egrep -n'. + When STYLE is `edit', the file names are passed to an editor, and + if possible PATTERN is passed as an initial search string (*note + eid invocation::.). When STYLE is `none', the file names are not + processed in any way. This can be useful if you wish to see what + tokens match a PATTERN, but don't care about where they reside. `-d' `-o' `-x' -`-a' These options may be used in any combination to specify the radix of numeric matches. `-d' allows matching on decimal numbers, `-o' - on octal numbers, and `-x' on hexadecimal numbers. The `-a' - option is equivalent to specifying all three; this is the default. - Any combination of these options may be used. - -`-m' - Merge multiple lines of output into a single line. If your query - matches more than one identifier, the default is to generate a - separate line of output for each matching identifier. - -`-F-' -`-FN' -`-F-M' -`-FN-M' - Show identifiers matching at least N and at most M times. `-F-' - is equivalent to `-F1', i.e., find identifiers that appear only - once in the database. (This is useful to locate identifiers that - are defined but never used, or used once and never defined.) - -`-uNUMBER' - List identifiers that conflict in the first NUMBER characters. - This could be in useful porting programs to brain-dead computers - that refuse to support long identifiers, but your best long term - option is to set such computers on fire. + on octal numbers, and `-x' on hexadecimal numbers. Any + combination of these options may be used. The default is to match + all three radixes. + +`-F RANGE' +`--frequency=RANGE' + Match tokens whose occurrence count falls in RANGE. RANGE may be + expressed as a single number N, or as a range N`..'M. Either + limit of the range may be omitted (e.g., `..'M, or N..`..'). If + the lower limit N is omitted, it defaults to `1'. If the upper + limit is omitted, it defaults in the present implementation to + `65535', the maximum value of an unsigned 16-bit integer. + + Particularly useful queries are `lid -F1', which helps locate + identifiers that are defined but never used, or are used but never + defined. Similarly, `lid -F2' can help find functions that possess + a prototype declaration and a definition, but are never called. + +`-a NUMBER' +`--ambiguous=NUMBER' + List identifiers (not numbers) that are ambiguous for the first + NUMBER characters. This feature might be in useful when porting + programs to ancient pea-brained compilers that don't support long + identifier names. However, the best long-term option is to set + such systems on fire. - -File: id-utils.info, Node: Patterns, Next: Query examples, Prev: Query options, Up: Common query arguments - -Patterns -======== - - "Patterns", also called "regular expressions", allow you to match -many different identifiers in a single query. - - The same regular expression syntax is recognized by all the query -tools that handle regular expressions. The exact syntax depends on how -the ID tools were compiled, but the following constructs should always -be supported: - -`.' - Match any single character. - -`[CHARS]' - Match any of the characters specified within the brackets. You can - match any characters *except* the ones in brackets by typing `^' - as the first character. A range of characters can be specified - using `-'. For example, `[abc]' and `[a-c]' both match `a', `b', - or `c', and `[^abc]' matches anything *except* `a', `b', or `c'. - -`*' - Match the previous construct zero or more times. - -`^' -`$' - `^' (`$') at the beginning (end) of a pattern anchors the match to - the first (last) character of the identifier. - - The query programs use either the `regex'/`regcmp' or -`re_comp'/`re_exec' functions, depending on which are available in the -library on your system. These do not always support the exact same -regular expression syntax, so consult your local `man' pages to find -out. - - -File: id-utils.info, Node: Query examples, Prev: Patterns, Up: Common query arguments - -Query examples -============== - - Here are some examples of the options described in the previous -sections. - - To restrict searches to exact matches, use `^...$'. For example: - - prompt$ gid '^FILE$' - ansi2knr.c:144: { FILE *in, *out; - ansi2knr.c:315: FILE *out; - fid.c:38: FILE *id_FILE; - filenames.c:576: FILE * - ... - - To show identifiers not unique in the first 16 characters: - - prompt$ lid -u16 - RE_CONTEXT_INDEP_ANCHORS regex.c - RE_CONTEXT_INDEP_OPS regex.c - RE_SYNTAX_POSIX_BASIC regex.c - RE_SYNTAX_POSIX_EXTENDED regex.c - ... - - Numbers are searched for numerically rather than textually. For -example: - - prompt$ lid 0xff - 0377 {lid,regex}.c - 0xff {bitops,fid,lid,mkid}.c - 255 regex.c - - On the other hand, you can restrict a numeric search to a particular -radix if you want: +* Menu: - laurie$ lid -x 0xff - 0xff {bitops,fid,lid,mkid}.c +* lid aliases:: Aliases for specialized lid queries +* Emacs gid interface:: GNU Emacs query interface +* eid invocation:: Invoking an editor on query results - Filenames in the output are always adjusted to be correct for the -correct working directory. For example: + ---------- Footnotes ---------- - prompt$ lid bdevsw - bdevsw sys/conf.h cf/conf.c io/bio.c os/{fio,main,prf,sys3}.c - prompt$ cd io - prompt$ lid bdevsw - bdevsw ../sys/conf.h ../cf/conf.c bio.c ../os/{fio,main,prf,sys3}.c + (1) Extended regular expressions are the same as those accepted by +`egrep'. -File: id-utils.info, Node: gid invocation, Next: Looking up identifiers, Prev: Common query arguments, Up: Top - -`gid': Listing matching lines -***************************** - - Synopsis: - - gid [-fFILE] [-uN] [-rDIR] [-doxasc] [PATTERN...] - - `gid' finds the identifiers in the database that match the specified -PATTERNs, then searches for all occurrences of those identifiers, in -only the files containing matches. In a large source tree, this saves -an enormous amount of time (compared to searching every source file). - - With no PATTERN arguments, `gid' prints every line of every source -file. +File: id-utils.info, Node: lid aliases, Next: Emacs gid interface, Up: lid invocation - The name "gid" stands for "grep for identifiers", `grep' being the -standard utility to search regular files. +Aliases for Specialized `lid' Queries +===================================== - *Note Common query arguments::, for a description of the command-line -options and PATTERN arguments. + Historically, the ID utilities have provided several query interfaces +which are specializations of `lid' (*note lid invocation::.). - `gid' uses the standard GNU output format for identifying source -lines: - - FILENAME:LINENUM: TEXT - - Here is an example: - - prompt$ gid FILE - ansi2knr.c:144: { FILE *in, *out; - ansi2knr.c:315: FILE *out; - fid.c:38: FILE *id_FILE; - ... +`gid' + (alias for `lid -R grep') lists all lines containing the requested + pattern. -* Menu: +`eid' + (alias for `lid -R edit') invokes an editor on all files + containing the requested pattern, and optionally initiates a text + search for that pattern. -* GNU Emacs gid interface:: Using next-error with gid. +`aid' + (alias for `lid -ils') treats the requested pattern as a + case-insensitive literal substring. -File: id-utils.info, Node: GNU Emacs gid interface, Up: gid invocation +File: id-utils.info, Node: Emacs gid interface, Next: eid invocation, Prev: lid aliases, Up: lid invocation -GNU Emacs `gid' interface +GNU Emacs query interface ========================= - The `mkid' source distribution comes with a file `gid.el', which -defines a GNU Emacs interface to `gid'. To install it, put `gid.el' -somewhere that Emacs will find it (i.e., in your `load-path') and put + The `id-utils' source distribution comes with a file `id-utils.el', +which defines a GNU Emacs interface to `gid'. To install it, put +`id-utils.el' somewhere that Emacs will find it (i.e., in your +`load-path') and put (autoload 'gid "gid" nil t) @@ -817,108 +779,23 @@ the places the identifier is found (*note Compilation: (emacs)Compilation.). -File: id-utils.info, Node: Looking up identifiers, Next: pid invocation, Prev: gid invocation, Up: Top - -Looking up identifiers -********************** - - These commands look up identifiers in the ID database and operate on -the files containing matches. - -* Menu: - -* lid invocation:: Matching patterns. -* aid invocation:: Matching strings. -* eid invocation:: Invoking an editor on matches. -* fid invocation:: Listing a file's identifiers. - - -File: id-utils.info, Node: lid invocation, Next: aid invocation, Up: Looking up identifiers - -`lid': Matching patterns -======================== - - Synopsis: - - lid [-fFILE] [-uN] [-rDIR] [-mewdoxaskgnc] PATTERN... - - `lid' searches the database for identifiers matching the given -PATTERN arguments and prints the names of the files that match each -PATTERN. With no PATTERNs, `lid' lists every entry in the database. - - The name "lid" stands for "lookup identifier". - - *Note Common query arguments::, for a description of the command-line -options and PATTERN arguments. +File: id-utils.info, Node: eid invocation, Prev: Emacs gid interface, Up: lid invocation - By default, each line of output consists of an identifier and all the -files containing that identifier. +`eid': Invoking an Editor on Query Results +========================================== - Here is an example showing a search for a single identifier (omitting -some output to keep lines short): - - prompt$ lid FILE - FILE extern.h {fid,gets0,getsFF,idx,init,lid,mkid,...}.c - - This example shows a regular expression search: - - prompt$ lid 'FILE$' - AF_FILE mkid.c - AF_IDFILE mkid.c - FILE extern.h {fid,gets0,getsFF,idx,init,lid,mkid,...}.c - IDFILE id.h {fid,lid,mkid}.c - IdFILE {fid,lid}.c - ... - -As you can see, when a regular expression is used, it is possible to -get more than one line of output. To merge multiple lines into one, -use `-m': - - prompt$ lid -m ^get - ^get extern.h {bitsvec,fid,gets0,getsFF,getscan,idx,lid,...}.c - - -File: id-utils.info, Node: aid invocation, Next: eid invocation, Prev: lid invocation, Up: Looking up identifiers - -`aid': Matching strings -======================= - - Synopsis: - - aid [-fFILE] [-uN] [-rDIR] [-mewdoxaskgnc] STRING... - - `aid' searches the database for identifiers containing the given -STRING arguments. The search is case-insensitive. - - The name "aid" stands for "apropos identifier", `apropros' being a -command that does a similar search of the `whatis' database of `man' -descriptions. - - For example, `aid get' matches the identifiers `fgets', `GETLINE', -and `getchar'. - - The default output format is the same as `lid'; see the previous -section. - - *Note Common query arguments::, for a description of the command-line -options and PATTERN arguments. - - -File: id-utils.info, Node: eid invocation, Next: fid invocation, Prev: aid invocation, Up: Looking up identifiers - -`eid': Invoking an editor on matches -==================================== - - Synopsis: - - eid [-fFILE] [-uN] [-rDIR] [-doxasc] [PATTERN]... - - `eid' runs the usual search (*note lid invocation::.) on the given -arguments, shows you the output, and then asks: + `lid -R edit' is an editing interface for the ID utilities that is +most commonly used with `vi'. Emacs users should use the interface +defined in `id-utils.el' (*note Emacs gid interface::.). The ID +utilities include an alias called `eid', and for the sake of brevity, +we'll use this alias for the remainder of this section. `eid' performs +a `lid'-style, then asks if you wish to edit the files. If your query +yields more than one line of output, you will be prompted after each +line. This is the prompt you'll see: Edit? [y1-9^S/nq] -You can respond with: +You may respond with: `y' Edit all files listed. @@ -926,46 +803,17 @@ You can respond with: `1...9' Edit all files starting at the N + 1'st file. -`/STRING or `CTRL-S'STRING' - Edit all files whose name contains STRING. +`/STRING or `CTRL-S'REGEXP' + Search into the file list, and begin editing with the first file + name that matches the regular expression REGEXP. `n' - Go on to the next PATTERN, i.e., edit no files for this one. + Don't edit any files. If another line of query output is pending, + advance to that line, for which another `Edit?' prompt will appear. `q' - Quit `eid'. - - `eid' invokes an editor once per PATTERN; all the specified files -are given to the editor for you to edit simultaneously. - - `eid' invokes the editor defined by the `EDITOR' environment -variable. If the editor can accept an initial search argument on the -command line, `eid' moves automatically to the location of the match, -via the environment variables below. - - *Note Common query arguments::, for a description of the command-line -options and PATTERN arguments. - - Here are the environment variables relevant to `eid': - -`EDITOR' - The name of the editor program to invoke. - -`EIDARG' - The argument to pass to the editor to search for the matching - identifier. For `vi', this should be `+/%s/''. - -`EIDLDEL' - A regular expression to force a match at the beginning of a word - ("left delimiter). `eid' inserts this in front of the matching - identifier when composing the search argument. For `vi', this - should be `\<'. - -`EIDRDEL' - The end-of-word regular expression. For `vi', this should be `\>'. - - For Emacs users, the interface in `gid.el' is probably preferable to -`eid'. *Note GNU Emacs gid interface::. + Quit--don't edit any files, and don't process any more lines of + query output. Here is an example: @@ -977,270 +825,352 @@ options and PATTERN arguments. This will start editing at `getopt'.c. - -File: id-utils.info, Node: fid invocation, Prev: eid invocation, Up: Looking up identifiers - -`fid': Listing a file's identifiers -=================================== + `eid' invokes the editor defined by the environment variable +`VISUAL'. If `VISUAL' is undefined, it uses the environment variable +`EDITOR' instead. If `EDITOR' is undefined, it defaults to `vi'. It +is possible for `eid' to pass the editor an initial search pattern so +that your cursor will immediately alight on the token of interest. +This feature is controlled by the following environment variables: - `fid' lists the identifiers found in a given file. Synopsis: - - fid [-fDBFILE] FILE1 [FILE2] - -`-fDBFILE' - Read the database from DBFILE instead of `ID'. - -`FILE1' - List all the identifiers contained in FILE1. +`EIDARG' + A printf(3) format string for the editor argument to search for the + matching token. For `vi', this should be `+/%s/'. -`FILE2' - With a second file argument, list only the identifiers both files - have in common. +`EIDLDEL' + The regular-expression meta-character(s) for delimiting the + beginning of a word (the ``eid' Left DELimiter'). `eid' inserts + this in front of the matching token when a word-search is desired. + For `vi', this should be `\<'. - The output is simply one identifier (or number) per line. +`EIDRDEL' + The regular-expression meta-character(s) for delimiting the end of + a word (the ``eid' Right DELimiter'). `eid' inserts this in end + of the matching token when a word-search is desired. For `vi', + this should be `\>'. -File: id-utils.info, Node: pid invocation, Next: Index, Prev: Looking up identifiers, Up: Top +File: id-utils.info, Node: fid invocation, Next: fnid invocation, Prev: lid invocation, Up: Top -`pid': Looking up filenames -*************************** +`fid': Listing a file's tokens +****************************** - `pid' matches the filenames stored in the ID database, rather than -the identifiers. Synopsis: + `fid' prints the tokens found in a given file. If two file names +are passed on the command line, `fid' prints the tokens that are common +to both files (i.e., the *set intersection* of the two token sets). - pid [-fDBFILE] [-rDIR] [-ebkgnc] WILDCARD... + `lid' reads the ID database, therefore it accepts the `--file' +option, and consults the `IDPATH' environment variable, as described in +*Note Reading options::. - By default, the WILDCARD patterns are treated as shell globbing -patterns, rather than the regular expressions the other utilities -accept. See the section below for details. + If the standard output is attached to a terminal, the printed tokens +are separated by spaces. Otherwise, the tokens are printed one per +line. - Besides the standard options given in the synopsis (*note Query -options::.), `pid' accepts the following: + +File: id-utils.info, Node: fnid invocation, Next: xtokid invocation, Prev: fid invocation, Up: Top + +`fnid': Looking up filenames +**************************** -`-e' - Do the usual regular expression matching (*note Patterns::.), - instead of shell wildcard matching. + `fnid' queries the list of file names stored in the ID database. It +accepts shell *wildcard* patterns on the command line. If no pattern +is supplied, `*' is implied. `fnid' prints the file names that match +the given patterns. -`-b' - Match the basenames of the files in the database. For example, - `pid -b foo' will match the stored filename `dir/foo', but not - `foo/file'. + `fnid' prints file names, and as such accepts the `--separator' +option as described in *Note File listing options::. For example, the command: - pid \*.c + fnid \*.c lists all the `.c' files in the database. (The `\' here protects the `*' from being expanded by the shell.) -* Menu: + +File: id-utils.info, Node: xtokid invocation, Next: Past and Future, Prev: fnid invocation, Up: Top + +`xtokid': Testing Language Scanners +*********************************** + + `xtokid' accepts the names of files and/or directories on the +command line, then extracts and prints a stream of tokens from those +files for which it has a valid, enabled scanner. This is useful +primarily for debugging new `mkid' scanners (*note Defining +scanners::.). + + `xtokid' extracts tokens from source files, therefore it accepts the +`--lang-map', `--include', `--exclude', and `--lang-option' options, as +well as the language-specific scanner options, all of which are +described in *Note Extraction options::. `xtokid' walks file trees, +therefore it handles file and directory names on its command line and +the `--prune' option as described in *Note Walker options::. -* Wildcard patterns:: Shell-style globbing patterns. + The name `xtokid' indicates that it is the "eXtract TOKens ID +utility". -File: id-utils.info, Node: Wildcard patterns, Up: pid invocation +File: id-utils.info, Node: Past and Future, Next: Index, Prev: xtokid invocation, Up: Top -Wildcard patterns -================= +Past and Future +*************** - `pid' does simplified shell wildcard matching (unless the `-e' -option is specified), rather than the regular expression matching done -by the other utilities. Here is a description of wildcard matching, -also called "globbing": + Greg McGary conceived of the ideas behind the ID utilities when he +began working on the Unix kernel in 1984. He needed a navigation tool +to help him find his way around the expansive, unfamiliar landscape. +The first `id-utils'-like tools were shell scripts, and produced an +ASCII database that looks much like the output of `lid ".*"'. It took +over an hour on a VAX 11/750 to build a database for a 4.1BSD derived +kernel. The first version of `lid' used the UNIX system utility +`look', modified to handle very long lines. - * `*' matches zero or more characters. + In 1986, Greg rewrote the shell scripts in C to improve performance. +Build times for the ID file were shortened by an order of magnitude. +The ID utilities were first posted to `comp.sources.unix' in September +1987 under the name `id'. + + Over the next few years, several versions diverged from the original +source. Tom Horsley at Harris Computer Systems Division stepped forward +to take over maintenance and integrated some of the fixes from divergent +versions. A first release of the renamed `mkid' version 2 was posted +to `alt.sources' near the end of 1990. At that time, Tom wrote a +Texinfo manual with the encouragement the net community. (Tom +especially thanks Doug Scofield and Bill Leonard whom he dragooned into +helping poorfraed and edit--they found several problems in the initial +version.) Karl Berry revamped the manual for Texinfo style, indexing, +and organization in 1995. + + In January 1995, Greg McGary reemerged as the primary maintainer and +launched development of `mkid' version 3, whose primary new feature is +an efficient algorithm for building databases that is linear in both +time and space over the size of the input text. (The old algorithm was +quadratic in space so it was incapable of handling very large source +trees.) For the first time, the code was released under the GNU Public +License. - * `?' matches any single character. + In June 1996, the package was renamed again to `id-utils' and was +released for the first time under FSF copyright as part of the GNU +system. All programs had their command-line arguments completely +revised. The `mkid' and `xtokid' programs also gained a file-tree +walker, so that directory names can be passed on the command line +instead of the names of every individual file. Greg reorganized and +rewrote most of the Texinfo manual to reflect these changes. - * `\' forces the next character to be taken literally. + Future releases of `id-utils' might include: - * `[CHARS]' matches any single character listed in CHARS. + an optional coupling with GNU `grep', so that `grep' can use an ID + database for hints - * `[!CHARS]' matches any character *not* listed in CHARS. + a `cscope' work-alike query interface - Most shells treat `/' and leading `.' characters specially. `pid' -does not do this. It simply matches the filename in the database -against the wildcard pattern. + incremental update of the ID database. -File: id-utils.info, Node: Index, Prev: pid invocation, Up: Top +File: id-utils.info, Node: Index, Prev: Past and Future, Up: Top Index ***** * Menu: -* $ in identifiers: C scanner. -* * in globbing: Wildcard patterns. -* *scratch* Emacs buffer: GNU Emacs gid interface. -* -: mkid options. -* -a: Query options. -* -aARGFILE: mkid options. -* -b: pid invocation. -* -c: Query options. -* -d: Query options. -* -e <1>: pid invocation. -* -e: Query options. -* -F: Query options. -* -fIDFILE: Query options. -* -g: Query options. -* -k: Query options. -* -m: Query options. -* -n: Query options. -* -o: Query options. -* -rDIRECTORY: Query options. -* -S scanner option: Scanner option formats. -* -S.: Scanner option formats. -* -S?: Scanner option formats. -* -SSCANARG: mkid options. -* -Sasm+a: Assembler scanner. -* -Sasm+C: Assembler scanner. -* -Sasm+p: Assembler scanner. -* -Sasm+u: Assembler scanner. -* -Sasm-c: Assembler scanner. -* -Sc+u: C scanner. -* -Sc-s: C scanner. -* -Sc-u: C scanner. -* -Stext+a: Plain text scanner. -* -Stext+s: Plain text scanner. -* -Stext-a: Plain text scanner. -* -u: Query options. -* -v: mkid options. -* -w: Query options. -* -x: Query options. -* .[chly] files, scanning: C scanner. -* .default scanner: Scanners. -* ? in globbing: Wildcard patterns. -* [!...] in globbing: Wildcard patterns. -* [...] in globbing: Wildcard patterns. -* \ in globbing: Wildcard patterns. -* aid: aid invocation. +* *compilation* Emacs buffer: Emacs gid interface. +* -ambiguous: lid invocation. +* -comment: Assembler scanner. +* -exclude <1>: Text scanner. +* -exclude: Extraction options. +* -file <1>: Writing options. +* -file: Reading options. +* -frequency: lid invocation. +* -help: Universal options. +* -ignore <1>: Assembler scanner. +* -ignore: C/C++ scanner. +* -ignore-case: lid invocation. +* -include <1>: Text scanner. +* -include: Extraction options. +* -keep <1>: Assembler scanner. +* -keep: C/C++ scanner. +* -lang-map: Extraction options. +* -lang-option: Extraction options. +* -lang-option=asm:-comment: Assembler scanner. +* -lang-option=asm:-ignore: Assembler scanner. +* -lang-option=asm:-keep: Assembler scanner. +* -lang-option=asm:-no-cpp: Assembler scanner. +* -lang-option=asm:-strip-underscore: Assembler scanner. +* -lang-option=asm:-c: Assembler scanner. +* -lang-option=asm:-i: Assembler scanner. +* -lang-option=asm:-k: Assembler scanner. +* -lang-option=asm:-n: Assembler scanner. +* -lang-option=asm:-u: Assembler scanner. +* -lang-option=C:-ignore: C/C++ scanner. +* -lang-option=C:-keep: C/C++ scanner. +* -lang-option=C:-strip-underscore: C/C++ scanner. +* -lang-option=C:-i: C/C++ scanner. +* -lang-option=C:-k: C/C++ scanner. +* -lang-option=C:-u: C/C++ scanner. +* -lang-option=text:-exclude: Text scanner. +* -lang-option=text:-include: Text scanner. +* -lang-option=text:-i: Text scanner. +* -lang-option=text:-x: Text scanner. +* -literal: lid invocation. +* -no-cpp: Assembler scanner. +* -output: Writing options. +* -prune: Walker options. +* -regexp: lid invocation. +* -result: lid invocation. +* -separator: File listing options. +* -statistics: mkid invocation. +* -strip-underscore <1>: Assembler scanner. +* -strip-underscore: C/C++ scanner. +* -substring: lid invocation. +* -verbose: mkid invocation. +* -version: Universal options. +* -word: lid invocation. +* -a: lid invocation. +* -c: Assembler scanner. +* -d: lid invocation. +* -F: lid invocation. +* -f <1>: Writing options. +* -f: Reading options. +* -i <1>: lid invocation. +* -i <1>: Text scanner. +* -i <1>: Assembler scanner. +* -i <1>: C/C++ scanner. +* -i: Extraction options. +* -k <1>: lid invocation. +* -k <1>: Assembler scanner. +* -k: C/C++ scanner. +* -l <1>: lid invocation. +* -l: Extraction options. +* -l asm:-comment: Assembler scanner. +* -l asm:-ignore: Assembler scanner. +* -l asm:-keep: Assembler scanner. +* -l asm:-no-cpp: Assembler scanner. +* -l asm:-strip-underscore: Assembler scanner. +* -l asm:-c: Assembler scanner. +* -l asm:-i: Assembler scanner. +* -l asm:-k: Assembler scanner. +* -l asm:-n: Assembler scanner. +* -l asm:-u: Assembler scanner. +* -l C:-ignore: C/C++ scanner. +* -l C:-keep: C/C++ scanner. +* -l C:-strip-underscore: C/C++ scanner. +* -l C:-i: C/C++ scanner. +* -l C:-k: C/C++ scanner. +* -l C:-u: C/C++ scanner. +* -l text:-exclude: Text scanner. +* -l text:-include: Text scanner. +* -l text:-i: Text scanner. +* -l text:-x: Text scanner. +* -m: Extraction options. +* -n: Assembler scanner. +* -o <1>: lid invocation. +* -o: Writing options. +* -p: Walker options. +* -r: lid invocation. +* -s <1>: lid invocation. +* -s: mkid invocation. +* -S: File listing options. +* -u <1>: Assembler scanner. +* -u: C/C++ scanner. +* -v: mkid invocation. +* -w: lid invocation. +* -x <1>: lid invocation. +* -x <1>: Text scanner. +* -x: Extraction options. +* mkid progress: mkid invocation. +* alphabetic case, ignoring differences in: lid invocation. +* ambiguous identifier names, finding: lid invocation. * architecture-independence: mkid invocation. * assembler scanner: Assembler scanner. -* basename match: pid invocation. +* assembly language scanner: Assembler scanner. * beginning-of-word editor argument: eid invocation. -* Berry, Karl: Past and future. -* brace notation in filename lists: Query options. +* Berry, Karl: Past and Future. * bugs, reporting: Introduction. -* C scanner, predefined: C scanner. -* case-insensitive searching: aid invocation. -* comments in assembler: Assembler scanner. -* common query arguments: Common query arguments. -* common query options: Query options. -* compressed files, building ID from: mkid examples. -* conflicting identifiers, finding: Query options. -* constant strings, forcing evaluation as: Query options. +* C scanner, predefined: C/C++ scanner. +* common command-line options: Common options. * creating databases: mkid invocation. * cron: mkid invocation. -* cscope: Past and future. -* database name, specifying: Query options. +* cscope: Past and Future. * databases, creating: mkid invocation. -* EDITOR: eid invocation. * eid: eid invocation. * EIDARG: eid invocation. * EIDLDEL: eid invocation. * EIDRDEL: eid invocation. -* Emacs interface to gid: GNU Emacs gid interface. +* Emacs interface to gid: Emacs gid interface. * end-of-word editor argument: eid invocation. -* examples of mkid: mkid examples. -* examples, queries: Query examples. +* exclude languages: Extraction options. * fid: fid invocation. -* filenames, matching: pid invocation. -* future: Past and future. -* gid Emacs function: GNU Emacs gid interface. -* gid.el interface to Emacs: GNU Emacs gid interface. -* globbing patterns: Wildcard patterns. -* grep: Past and future. -* history: Past and future. -* Horsley, Tom: Past and future. +* file name separator: File listing options. +* file tree pruning: Walker options. +* filenames, matching: fnid invocation. +* fnid: fnid invocation. +* future: Past and Future. +* gid Emacs function: Emacs gid interface. +* grep: Past and Future. +* help, online: Universal options. +* history: Past and Future. +* Horsley, Tom: Past and Future. +* ID database file name <1>: Writing options. +* ID database file name: Reading options. * ID database, definition of: Introduction. * ID file format: mkid invocation. -* identifiers in a file: fid invocation. +* id-utils.el interface to Emacs: Emacs gid interface. +* ignoring differences in alphabetic case: lid invocation. +* include languages: Extraction options. * introduction: Introduction. -* languages_0: Defining scanners in source code. +* language map file: Extraction options. +* language-specific option: Extraction options. +* languages_0: Defining scanners. * left delimiter editor argument: eid invocation. -* Leonard, Bill: Past and future. -* lid: lid invocation. -* load-path: GNU Emacs gid interface. -* look and mkid 1: Past and future. -* man pages, compressed: mkid examples. -* matching filenames: pid invocation. -* McGary, Greg: Past and future. -* mkid: mkid invocation. -* mkid options: mkid options. -* multiple lines, merging: Query options. -* numbers, in databases: mkid invocation. -* numeric matches, specifying radix of: Query options. -* numeric searches: Query examples. -* options for mkid: mkid options. +* Leonard, Bill: Past and Future. +* load-path: Emacs gid interface. +* look and mkid 1: Past and Future. +* matching filenames: fnid invocation. +* McGary, Greg: Past and Future. +* numeric matches, specifying radix of: lid invocation. * overview: Introduction. -* parent directories, searched for ID: Query options. -* patterns: Patterns. -* pid: pid invocation. -* plain text scanner: Plain text scanner. -* predefined scanners: Predefined scanners. -* query examples: Query examples. -* query options, common: Query options. -* radix of numeric matches, specifying: Query options. -* regular expression syntax: Patterns. -* regular expressions, forcing evaluation as: Query options. +* radix of numeric matches, specifying: lid invocation. * right delimiter editor argument: eid invocation. -* scanner options: Scanner option formats. -* scanners: Scanners. -* scanners, adding new: Defining new scanners. -* scanners, defining in source code: Defining scanners in source code. -* scanners, defining with options: Defining scanners with options. -* scanners, predefined: Predefined scanners. -* scanners.c: Defining scanners in source code. -* Scofield, Doug: Past and future. -* search for identifier, initial: eid invocation. +* scanners: Extraction options. +* scanners, defining in source code: Defining scanners. +* scanners.c: Defining scanners. +* Scofield, Doug: Past and Future. +* search for token, initial: eid invocation. * sharing ID files: mkid invocation. -* shell brace notation in filename lists: Query options. -* shell wildcard patterns: Wildcard patterns. -* single matches, showing: Query options. -* squeezing characters from identifiers: Plain text scanner. -* statistics: mkid options. -* string searching: aid invocation. -* strings, forcing evaluation as: Query options. -* suffixes of filenames: Scanners. -* suffixes_0: Defining scanners in source code. -* suppressing matching identifier: Query options. -* Texinfo, scanning example of: Defining scanners with options. -* whatis: aid invocation. -* wildcard wildcard patterns: Wildcard patterns. +* single matches, showing: lid invocation. +* statistics: mkid invocation. +* text scanner: Text scanner. +* tokens common to two files: fid invocation. +* tokens in a file: fid invocation. +* version number, finding: Universal options. Tag Table: -Node: Top1540 -Node: Introduction2150 -Node: Past and future4367 -Node: mkid invocation6671 -Node: mkid options8241 -Node: Scanners9659 -Node: Scanner option formats11154 -Node: Predefined scanners12330 -Node: C scanner13033 -Node: Plain text scanner13788 -Node: Assembler scanner14699 -Node: Defining new scanners15828 -Node: Defining scanners in source code16451 -Node: Defining scanners with options17296 -Node: idx invocation18750 -Node: mkid examples19316 -Node: Common query arguments21295 -Node: Query options21843 -Node: Patterns25238 -Node: Query examples26578 -Node: gid invocation27965 -Node: GNU Emacs gid interface29132 -Node: Looking up identifiers29996 -Node: lid invocation30492 -Node: aid invocation31926 -Node: eid invocation32712 -Node: fid invocation34854 -Node: pid invocation35412 -Node: Wildcard patterns36510 -Node: Index37280 +Node: Top1298 +Node: Introduction2051 +Node: Quick start4580 +Node: Common options5505 +Node: Universal options6303 +Node: Reading options6628 +Node: Writing options7745 +Node: Walker options8241 +Node: File listing options9080 +Node: Extraction options10171 +Node: Language map12721 +Node: C/C++ scanner14927 +Node: Assembler scanner16542 +Node: Text scanner18638 +Node: Defining scanners19446 +Node: mkid invocation20668 +Node: lid invocation22949 +Node: lid aliases28334 +Node: Emacs gid interface29012 +Node: eid invocation29929 +Node: fid invocation32513 +Node: fnid invocation33200 +Node: xtokid invocation33875 +Node: Past and Future34814 +Node: Index37506 End Tag Table diff --git a/doc/id-utils.texi b/doc/id-utils.texi index 9cc7dd4..bda4734 100644 --- a/doc/id-utils.texi +++ b/doc/id-utils.texi @@ -6,7 +6,7 @@ @include version.texi -@c Define new indices for filenames, commands and options. +@c Define new indices for file names, commands and options. @defcodeindex fl @defcodeindex cm @defcodeindex op @@ -22,23 +22,20 @@ @ifinfo @format START-INFO-DIR-ENTRY -* ID database: (id). Identifier database utilities. -* aid: (id)aid invocation. Matching strings. -* eid: (id)eid invocation. Invoking an editor on matches. -* fid: (id)fid invocation. Listing a file's identifiers. -* gid: (id)gid invocation. Listing all matching lines. -* idx: (id)idx invocation. Testing mkid scanners. -* lid: (id)lid invocation. Matching patterns. -* mkid: (id)mkid invocation. Creating an ID database. -* pid: (id)pid invocation. Looking up filenames. +* ID database: (id-utils). Identifier database utilities. +* mkid: (id-utils)mkid invocation. Creating an ID database. +* lid: (id-utils)lid invocation. Matching words and patterns. +* fid: (id-utils)fid invocation. Listing a file's tokens. +* fnid: (id-utils)fnid invocation. Looking up file names. +* xtokid: (id-utils)xtokid invocation. Testing mkid scanners. END-INFO-DIR-ENTRY @end format @end ifinfo @ifinfo -This file documents the @code{mkid} identifier database utilities. +This file documents the @file{id-utils} database utilities. -Copyright (C) 1991, 1995 Tom Horsley. +Copyright (C) 1996 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice @@ -63,970 +60,955 @@ except that this permission notice may be stated in a translation. @titlepage @title ID database utilities -@subtitle Programs for simple, fast, high-capacity cross-referencing +@subtitle Programs for simple, fast, high-capacity cross-referencing @subtitle for version @value{VERSION} -@author Tom Horsley @author Greg McGary - -@page -@vskip 0pt plus 1filll -Copyright @copyright{} 1991, 1995 Tom Horsley. - -Permission is granted to make and distribute verbatim copies of -this manual provided the copyright notice and this permission notice -are preserved on all copies. - -Permission is granted to copy and distribute modified versions of this -manual under the conditions for verbatim copying, provided that the entire -resulting derived work is distributed under the terms of a permission -notice identical to this one. - -Permission is granted to copy and distribute translations of this manual -into another language, under the above conditions for modified versions, -except that this permission notice may be stated in a translation. +@author Tom Horsley @end titlepage - @ifinfo +@c ************* gkm ********************************************************* @node Top -@top ID database utilities +@top ID utilities -This manual documents version @value{VERSION} of the ID database -utilities. +This manual documents version @value{VERSION} of the ID utilities. @menu -* Introduction:: Overview of the tools, and authors. +* Introduction:: Overview of the tools with tutorial. +* Quick start:: Quick start procedure. +* Common options:: Common command-line options. * mkid invocation:: Creating an ID database. -* Common query arguments:: Common lookup options and search patterns. -* gid invocation:: Listing all matching lines. -* Looking up identifiers:: lid, aid, eid, and fid. -* pid invocation:: Looking up filenames. +* lid invocation:: Querying an ID database by token. +* fid invocation:: Listing a file's tokens. +* fnid invocation:: Looking up file names. +* xtokid invocation:: Testing language scanners. +* Past and Future:: History and future directions. * Index:: General index. @end menu @end ifinfo - +@c ************* gkm ********************************************************* @node Introduction @chapter Introduction @cindex overview @cindex introduction - @cindex ID database, definition of -An @dfn{ID database} is a binary file containing a list of filenames, a -list of identifiers, and a matrix indicating which identifiers appear in -which files. With this database and some tools to manipulate it -(described in this manual), a host of tasks become simpler and faster. -For example, you can list all files containing a particular -@code{#include} throughout a huge source hierarchy, search for all the -memos containing references to a project, or automatically invoke an -editor on all files containing references to some function. Anyone with -a large software project to maintain, or a large set of text files to -organize, can benefit from an ID database. -Although the ID utilities are most commonly used with identifiers, -numeric constants are also stored in the database, and can be searched -for in the same way (independent of radix, if desired). +An @dfn{ID database} is a binary file containing a list of file names, a +list of tokens, and a sparse matrix indicating which tokens +appear in which files. -There are a number of programs in the ID family: +With this database and some tools to query it (described in this +manual), many text-searching tasks become simpler and faster. For +example, you can list all files that reference a particular +@code{#include} file throughout a huge source hierarchy, search for all +the memos containing references to a project, or automatically invoke an +editor on all files containing references to some function or variable. +Anyone with a large software project to maintain, or a large set of text +files to organize, can benefit from the ID utilities. -@table @code +Although the name `ID' is short for `identifier', the ID utilities +handle more than just identifiers; they also treat other kinds of +tokens, most notably numeric constants, and the contents of certain +character strings. Thus, this manual will use the word @dfn{token} as a +term that is inclusive of identifiers, numbers and strings. -@item mkid -scans files for identifiers and numeric constants and builds the ID -database file. +There are several programs in the ID utilities family: -@item gid -lists all lines that match given patterns. +@table @file + +@item mkid +scans files for tokens and builds the ID database file. @item lid -lists the filenames containing identifiers that match given patterns. +queries the ID database for tokens, then reports matching file names or +matching lines. -@item aid -lists the filenames containing identifiers that contain given strings, -independent of case. +@item fid +lists all tokens recorded in the database for given files, or +tokens common to two files. -@item eid -invokes an editor on each file containing identifiers that match given -patterns. +@item fnid +matches the file names in the database, rather than the tokens. -@item fid -lists all identifiers recorded in the database for given files, or -identifiers common to two files. +@item xtokid +extracts raw tokens---helps with testing of new @file{mkid} scanners. + +@end table + +In addition, the ID utilities have historically provided several query +programs which are specializations of @file{lid}: + +@table @file + +@item gid +(alias for @samp{lid -R grep}) +lists all lines containing the requested pattern. -@item pid -matches the filenames in the database, rather than the identifiers. +@item eid +(alias for @samp{lid -R edit}) +invokes an editor on all files containing the requested pattern, and +if possible, initiates a text search for that pattern. -@item idx -helps with testing of new @code{mkid} scanners. +@item aid +(alias for @samp{lid -ils}) treats the requested pattern +as a case-insensitive literal substring. @end table @cindex bugs, reporting -Please report bugs to @samp{gkm@@magilla.cichlid.com}. Remember to +Please report bugs to @samp{bug-gnu-utils@@gnu.ai.mit.edu}. Remember to include the version number, machine architecture, input files, and any other information needed to reproduce the bug: your input, what you expected, what you got, and why it is wrong. Diffs are welcome, but please include a description of the problem as well, since this is sometimes difficult to infer. @xref{Bugs, , , gcc, GNU CC}. -@menu -* Past and future:: How the ID tools came about, and where they're going. -@end menu +@c ************* gkm ********************************************************* +@node Quick start +@chapter Quick Start Procedure +@table @bullet -@node Past and future -@section Past and future +Unpack the distribution. -@cindex history +Type @file{./configure} -@pindex look @r{and @code{mkid} 1} -@cindex McGary, Greg -Greg McGary conceived of the ideas behind mkid when he began hacking the -Unix kernel in 1984. He needed a navigation tool to help him find his -way around the expansive, unfamiliar landscape. The first @code{mkid}-like -tools were shell scripts, and produced an ASCII database that looks much -like the output of @code{lid} with no arguments. It took over an hour -on a VAX 11/750 to build a database for a 4.1BSD-ish kernel. Lookups -were done with the system utility @code{look}, modified to handle very -long lines. - -In 1986, Greg rewrote @code{mkid}, @code{lid}, @code{fid} and @code{idx} -in C to improve performance. Database-build times were shortened by an -order of magnitude. The @code{mkid} tools were first posted to -@samp{comp.sources.unix} in September 1987. +Type @samp{make} -@cindex Horsley, Tom -@cindex Scofield, Doug -@cindex Leonard, Bill -@cindex Berry, Karl -Over the next few years, several versions diverged from the original -source. Tom Horsley at Harris Computer Systems Division stepped forward -to take over maintenance and integrated some of the fixes from divergent -versions. A first release of -@code{mkid} @w{version 2} was posted to @file{alt.sources} near the end -of 1990. At that time, Tom wrote this Texinfo manual with the -encouragement the net community. (Tom especially thanks Doug Scofield -and Bill Leonard whom he dragooned into helping poorfraed and -edit---they found several problems in the initial version.) Karl Berry -revamped the manual for Texinfo style, indexing, and organization in -1995. +Type @samp{make install} as a user with the appropriate privileges +(e.g., @samp{bin} or perhaps even @samp{root}). -@pindex cscope -@pindex grep -@cindex future -In January 1995, Greg McGary reemerged as the primary maintaner and -launched development of @code{mkid} version 3, whose primary new feature -is an efficient algorithm for building databases that is linear in both -time and space over the size of the input text. (The old algorithm was -quadratic in space and therefore choked on very large source trees.) -The code is released under the GNU Public License, and might become a -part of the GNU system. @code{mkid} 3 is an interim release, since -several significant enhancements are still in the works: an optional -coupling with GNU @code{grep}, so that @code{grep} can use an ID -database for hints; a @code{cscope} work-alike query interface; -incremental update of the ID database; and an automatic file-tree walker -so you need not explicitly supply every filename argument to the -@code{mkid} program. +Type @samp{cd /usr/include; mkid} to build an ID database covering +all of the system header files. +Type @samp{lid FILE}, then @samp{gid strtok}, then @samp{aid stdout}. -@node mkid invocation -@chapter @code{mkid}: Creating ID databases +@end table -@pindex mkid -@cindex creating databases -@cindex databases, creating +You have just built, installed and used the most common commands of the +GNU ID utilities. If you ever need help remembering which system header +files contain a particular declaration, or reference a particular symbol, +you'll want to keep the ID file you built in @file{/usr/include} for +later use. If your working directory is elsewhere at the time, simply +provide the @samp{-f /usr/include} option to @file{lid} (@pxref{Reading +options}). -@pindex cron -The @code{mkid} program builds an ID database. To do this, it must scan -each file you tell it to include in the database. This takes some time, -but once the work is done the query programs run very rapidly. (You can -run @code{mkid} as a @code{cron} job to regularly update your -databases.) - -The @code{mkid} program knows how to extract identifiers from various -types of files. For example, it can recognize and skip over comments -and string constants in a C program. - -@cindex numbers, in databases -Identifiers are not the only thing included in the database. Numbers -are also recognized and included in the database indexed by their binary -value. This feature allows you to find uses of constants without regard -to the radix used to specify them, since the same number can frequently -be written in many different ways (for instance, @samp{47}, @samp{0x2f}, -@samp{057} in C). - -All the places in this document which mention identifiers should really -mention both identifiers and numbers, but that gets fairly clumsy after -a while, so you just need to keep in mind that numbers are included in -the database as well as identifiers. +@c ************* gkm ********************************************************* +@node Common options +@chapter Common command-line options -@cindex ID file format -@cindex architecture-independence -@cindex sharing ID files -The ID files that @code{mkid} creates are architecture- and -byte-order-independent; you can share them at will across systems. +@cindex common command-line options + +Certain options, and regular expression syntax, are shared by various +groupings of the ID utilities. We describe these in the sections below, +rather than repeating them for each program. @menu -* mkid options:: Command-line options to mkid. -* Scanners:: Built-in and defining your own. -* mkid examples:: Examples of mkid usage. +* Universal options:: Options common to all programs. +* Extraction options:: Options for programs that extract tokens from source files. +* Walker options:: Options for programs that walk file and directory trees. +* Reading options:: Options for programs that read ID databases. +* Writing options:: Options for programs that write ID databases. +* File listing options:: Options for programs that list file names. @end menu - -@node mkid options -@section @code{mkid} options - -@cindex options for @code{mkid} -@pindex mkid @r{options} - -By default, @code{mkid} scans the files you specify and writes the -database to a file named @file{ID} in the current directory. - -@example -mkid [-v] [-S@var{scanarg}] [-a@var{argfile}] [-] [-f@var{idfile}] @c -@var{files}@dots{} -@end example - -The program accepts the following options. +@c ************* gkm ********************************************************* +@node Universal options +@section Options Common to All Programs @table @samp -@item -v -@opindex -v -@cindex statistics -Verbose. @code{mkid} tells you as it scans each file and indicates -which scanner it is using. It also summarizes some statistics about the -database at the end. - -@item -S@var{scanarg} -@opindex -S@var{scanarg} -Specify options regarding @code{mkid}'s scanners. @xref{Scanner option -formats}. - -@item -a@var{argfile} -@opindex -a@var{argfile} -Read additional command line arguments from @var{argfile}. This is -typically used to specify lists of filenames longer than will fit on a -command line; some systems have severe limitations on the total length -of a command line. - -@item - -@opindex - -Read additional command line arguments from standard input. - -@item -f@var{idfile} -Write the database to the file @var{idfile}, instead of @file{ID}. The -database stores filenames relative to the directory containing the -database, so if you move the database to a different directory after -creating it, you may have trouble finding files. - -@c @item -u -@c @opindex -u -@c The @code{-u} option updates an existing database by rescanning any -@c files that have changed since the database was written. Unfortunately -@c you cannot incrementally add new files to a database. -@c Greg is reimplementing this ... - -@end table +@item --help +@opindex --help +@cindex help, online +Print a usage message listing all available options, then exit successfully. -The remaining arguments @var{files} are the files to be scanned and -included in the database. If no files are given at all (either on -command line or via @samp{-a} or @samp{-}), @code{mkid} does nothing. +@item --version +@opindex --version +@cindex version number, finding +Print the version number, then exit successfully. +@end table -@node Scanners -@section Scanners +@c ************* gkm ********************************************************* +@node Reading options +@section Options for Programs that Read ID Databases -@cindex scanners +@table @samp -To determine which identifiers to extract from a file and store in the -database, @code{mkid} calls a @dfn{scanner}; we say a scanner -@dfn{recognizes} a particular language. Scanners for several languages -are built-in to @code{mkid}; you can add your own scanners as well, as -explained in the sections below. - -@cindex suffixes of filenames -@code{mkid} determines which scanner to use for a particular file by -looking at the suffix of the filename. This @dfn{suffix} is everything -after and including the last @samp{.} in a filename; for example, the -suffix of @file{foo.c} is @file{.c}. @code{mkid} has a built-in list of -bindings from some suffixes to corresponding scanners; for example, -@file{.c} files are (not surprisingly) scanned by the predefined C -language scanner. - -@findex .default @r{scanner} -If @code{mkid} cannot determine what scanner to use for a particular -file, either because the file has no suffix (e.g., @file{foo}) or -because @code{mkid} has no binding for the file's suffix (e.g., -@file{foo.bar}), it uses the scanner bound to the @samp{.default} -suffix. By default, this is the plain text scanner (@pxref{Plain text -scanner}), but you can change this with the @samp{-S} option, as -explained below. +@item -f @var{filename} +@itemx --file=@var{filename} +@opindex -f +@opindex --file +@cindex ID database file name -@menu -* Scanner option formats:: Overview of the -S option. -* Predefined scanners:: The C, plain text, and assembler scanners. -* Defining new scanners:: Either in source code or at runtime with -S. -* idx invocation:: Testing mkid scanners. -@end menu +@var{Filename} is the ID database to read when processing queries. At +present, only a single @samp{--file} option is processed, but in future +releases, more than one ID database may be named on the command line. +@item $IDPATH +@cindex ID database file name -@node Scanner option formats -@subsection Scanner option formats +@samp{IDPATH} is an environment variable that contains a +colon-separated list of ID database names. If this variable is present, +and no @samp{--file} options are presented on the command line, the ID +databases named in @samp{IDPATH} are implied.@footnote{At present, this +feature is fully implemented, since only the first of a list of ID +database names is processed.} -@cindex scanner options -@opindex -S @r{scanner option} +@end table -With the @samp{-S} option, you can change which language scanner to use -for which files, give language-specific options, and get some limited -online help about scanner options. +If no ID databases are specified either on the command line or via the +@samp{IDPATH} environment variable, then the ID utilities search for a +file named @file{ID} in the current working directory, and then in +successive parent directories. -Here are the different forms of the @samp{-S} option: +@c ************* gkm ********************************************************* +@node Writing options +@section Options for Programs that Write ID Databases @table @samp -@item -S.@var{suffix}=@var{scanner} -@opindex -S. -Use @var{scanner} for a file with the given @samp{.@var{suffix}}. For -example, @samp{-S.yacc=c} tells @code{mkid} to use the @samp{c} language -scanner for all files ending in @samp{.yacc}. - -@item -S.@var{suffix}=? -Display which scanner is used for the given @samp{.@var{suffix}}. - -@item -S?=@var{scanner} -@opindex -S? -Display which suffixes @var{scanner} is used for. - -@item -S?=? -Display the scanner binding for every known suffix. +@item -o @var{filename} +@itemx --output=@var{filename} +@opindex -o +@opindex --output +@cindex ID database file name -@item -S@var{scanner}+@var{arg} -@itemx -S@var{scanner}-@var{arg} -Each scanner accepts certain scanner-dependent arguments. These options -all have one of these forms. @xref{Predefined scanners}. +The @samp{--output} option names the file in which to write a new ID +database. If no @samp{--output} (or @samp{--file}) option is present, +an output file named @file{ID} is implied. -@item -S@var{scanner}? -Display the scanner-specific options accepted by @var{scanner}. +@item -f @var{filename} +@itemx --file=@var{filename} +@opindex -f +@opindex --file +@cindex ID database file name -@item -S@var{new-scanner}/@var{old-scanner}/@var{filter-command} -Define @var{new-scanner} in terms of @var{old-scanner} and -@var{filter-command}. @xref{Defining scanners with options}. +This is a synonym for @samp{--output} @end table +@c ************* gkm ********************************************************* +@node Walker options +@section Options for Programs that Walk File and Directory Trees. -@node Predefined scanners -@subsection Predefined scanners +The programs @file{mkid} and @file{xtokid} accept the names of files and +directories on the command line. Files are scanned if there is a +scanner available and enabled for the file's source language. +Directories are recursively descended, searching for files whose names +match the rules listed in the @emph{language map} file (@pxref{Language +map}). -@cindex predefined scanners -@cindex scanners, predefined +The following option controls the file tree walker: -@code{mkid} has built-in scanners for several types of languages; you -can get the list by running @code{mkid -S?=?}. -The supported languages are documented -below@footnote{This is not strictly true: @samp{vhil} is a supported -language, but it is an obsolete and arcane dialect of C and should be -ignored.}. - -@menu -* C scanner:: For the C programming language. -* Plain text scanner:: For documents or other non-source code. -* Assembler scanner:: For assembly language. -@end menu +@table @samp +@item -p @var{names} +@itemx --prune=@var{names} +@opindex -p +@opindex --prune +@cindex file tree pruning -@node C scanner -@subsubsection C scanner +One or more file or directory names may appear in @var{names}. The file +tree walker will stop short at these files and directories and their +contents will not be scanned. -@cindex C scanner, predefined -@flindex .[chly] @r{files, scanning} +@end table -The C scanner is the most commonly used. Files with the usual @file{.c} -and @file{.h} suffixes, and the @file{.y} (yacc) and @file{.l} (lex) -suffixes, are processed with this scanner (by default). +@c ************* gkm ********************************************************* +@node File listing options +@section Options for Programs that List File Names -Scanner-specific options: +The programs @file{lid} and @file{fnid} can print lists of file names as +the result of queries. The following option controls how these lists +are formatted: @table @samp -@item -Sc-s@var{character} -@kindex $ @r{in identifiers} -@opindex -Sc-s -Allow the specified @var{character} in identifiers. For example, if you -use @samp{$} in identifiers, you'll want to use @samp{-Sc-s$}. - -@item -Sc+u -@opindex -Sc+u -Strip leading underscores from identifiers. You might to do this in -peculiar circumstances, such as trying to parse the output from -@code{nm} or some other system utility. +@item -S @var{style} +@itemx --separator=@var{style} +@opindex -S +@opindex --separator +@cindex file name separator -@item -Sc-u -@opindex -Sc-u -Don't strip leading underscores from identifiers; this is the default. - -@end table +@var{Style} may be one of @samp{braces}, @samp{space} or @samp{newline}. +The @var{style} of @samp{braces} means that file names with common +directory prefix and common suffix are printed using the shell's brace +notation in order to compress the output. For example, +@file{../src/foo.c ../src/bar.c} can be printed in brace notation as +@file{../src/@{foo,bar@}.c}. -@node Plain text scanner -@subsubsection Plain text scanner +The @var{style}s of @samp{space} and @samp{newline} mean that file names +are separated spaces or by newlines, respectively. -@cindex plain text scanner +If the list of files is being printed on a terminal, brace notation is +the default. If not, file names are separated by spaces if the +@var{key} is included in the output, and by newlines the @var{key style} +is @samp{none} (@pxref{lid invocation}). -The plain text scanner is intended for scanning most non-source-code -files. This is typically the scanner used when adding custom scanners -via @samp{-S} (@pxref{Defining scanners with options}). +@end table -@c @code{mkid} predefines a troff scanner in terms of the plain text -@c scanner and -@c the @code{deroff} utility. -@c A compressed man page -@c scanner runs @code{pcat} piped into @code{col -b}, and a @TeX{} scanner -@c runs @code{detex}. +@c ************* gkm ********************************************************* +@node Extraction options +@section Options for Programs that Scan Source Files -Scanner-specific options: +@file{mkid} and @file{xtokid} walk file trees, select source files by +name, and extract tokens from source files. They accept the following +options: @table @samp -@item -Stext+a@var{character} -@opindex -Stext+a -Include @var{character} in identifiers. By default, letters (a--z and -A--Z) and underscore are included. - -@item -Stext-a@var{character} -@opindex -Stext-a -Exclude @var{character} from identifiers. +@item -m @var{mapfile} +@itemx --lang-map=@var{mapfile} +@opindex -m +@opindex --lang-map +@cindex language map file -@item -Stext+s@var{character} -@opindex -Stext+s -@cindex squeezing characters from identifiers -Squeeze @var{character} from identifiers, i.e., do not terminate an -identifier when @var{character} is seen. By default, the characters -@samp{'}, @samp{-}, and @samp{.} are squeezed out of identifiers. For -example, the input @samp{fred's} leads to the identifier @samp{freds}. +@var{mapfile} contains rules for determining the source languages from +file names. @xref{Language map} -@item -Stext-s@var{character} -Do not squeeze @var{character}. +@item -i @var{languages} +@itemx --include=@var{languages} +@opindex -i +@opindex --include +@cindex include languages -@end table +The @samp{--include} option names @var{languages} whose source files +should be scanned and incorporated into the ID database. By default, +all languages known to the ID utilities are enabled. +@item -x @var{languages} +@itemx --exclude=@var{languages} +@opindex -x +@opindex --exclude +@cindex exclude languages + +The @samp{--exclude} option names @var{languages} whose source files +should @var{not} be scanned. The default list of excluded languages is +empty. Note that only one of @samp{--include} or @samp{--exclude} may +be specified on the command line for a single run. + +@item -l @var{language}:@var{options} +@itemx --lang-option=@var{language}:@var{options} +@opindex -l +@opindex --lang-option +@cindex language-specific option + +Language-specific scanners also accept options. @var{Language} denotes +the desired scanner, and @var{option} are the command-line options that +should be passed through to it. For example, to pass the @var{-x +--coke-bottle} options to the scanner for the language @var{swizzle}, +pass this: @var{-l swizzle:"-x --coke-bottle"}, or this: +@var{-lang-option=swizzle:"-x --coke-bottle"}, or this: @var{-l +swizzle-x -l swizzle:--coke-bottle}. Use the @samp{--help} option to +see the command-line option summary for -@node Assembler scanner -@subsubsection Assembler scanner +@end table -@cindex assembler scanner +@cindex scanners -Since assembly languages come in several flavors, this scanner has a -number of options: +To determine which tokens to extract from a file and store in the +database, @file{mkid} calls a @dfn{scanner}; we say a scanner +@dfn{recognizes} a particular language. Scanners for several languages +are built-in to @file{mkid}; you can add your own scanners as well, as +explained in @ref{Defining scanners}. -@table @samp +The ID utilities determine which scanner to use for a particular file by +consulting the language-map file. Scanners for several are already +built-in to the ID utilities. You can see which languages have built-in +scanners, and examine their language-specific options by invoking +@samp{mkid --help} or @samp{xtokid --help}. -@item -Sasm-c@var{character} -@opindex -Sasm-c -@cindex comments in assembler -Define @var{character} as starting a comment that extends to the end of -the input line; no default. In many assemblers this is @samp{;} or -@samp{#}. - -@item -Sasm+u -@itemx -Sasm-u -@opindex -Sasm+u -Strip (@samp{+u}) or do not strip (@samp{-u}) leading underscores from -identifiers. The default is to strip them. - -@item -Sasm+a@var{character} -@opindex -Sasm+a -Allow @var{character} in identifiers. - -@item -Sasm-a@var{character} -Allow @var{character} in identifiers, but if an identifier contains -@var{character}, ignore it. This is useful to ignore temporary labels, -which can be generated in great profusion; these often contain @samp{.} -or @samp{@@}. - -@item -Sasm+p -@itemx -Sasm-p -@opindex -Sasm+p -Recognize (@samp{+p}) or do not recognize (@samp{-p}) C preprocessor -directives in assembler source. The default is to recognize them. - -@item -Sasm+C -@itemx -Sasm-C -@opindex -Sasm+C -Skip over (@samp{+C}) or do not skip over (@samp{-C}) C style comments -in assembler source. The default is to skip them. +@menu +* Language map:: Mapping file names to source languages. +* C/C++ scanner:: For the C and C++ programming language. +* Assembler scanner:: For assembly language. +* Text scanner:: For documents or other non-source code. +* Defining scanners:: Defining new scanners in the source code. +@end menu -@end table +@c ************* gkm ********************************************************* +@node Language map +@subsection Mapping file names to source languages +The file @file{id-lang.map}, installed by default in +@file{$(prefix)/share/id-lang.map}, contains rules for mapping file +names to source languages. Each rule comprises three parts: a shell +@var{glob} pattern, a language name, and language-specific scanner +options. -@node Defining new scanners -@subsection Defining new scanners +The special pattern @samp{**} denotes the default source language. This is +the language that's assigned to file names that don't match any other +pattern. -@cindex scanners, adding new +The special pattern @samp{***} should be followed by a file name. The +named file should contain more language-map rules and is included at +this point. -You can add new scanners to @code{mkid} in two ways: modify the source -code and recompile, or at runtime via the @samp{-S} option. Each has -their advantages and disadvantages, as explained below. +The order in which rules are presented in a language-map file is +significant. This order influences the order in which files are +displayed as the result of queries. For example, the distributed +language-map file places all rules for C @var{.h} files ahead of +@var{.c} files, so that in general, declarations will precede +definitions in query output. The same thing is done for C++ and its +many different source file name extensions. -If you create a new scanner that would be of use to others, please -consider sending it back to the maintainer, -@samp{gkm@@magilla.cichlid.com}, for inclusion in future releases of -@code{mkid}. +Here is a pared-down version of the @file{id-lang.map} file distributed +with the ID utilities: -@menu -* Defining scanners in source code:: -* Defining scanners with options:: -@end menu +@example +# Default language +** IGNORE # Although this is listed first, + # the default language pattern is + # logically matched last. + +# Backup files +*~ IGNORE +*.bak IGNORE +*.bk[0-9] IGNORE + +# SCCS files +[sp].* IGNORE + +# list header files before code files +*.h C +*.h.in C +*.H C++ +*.hh C++ +*.hpp C++ +*.hxx C++ + +# list C `meta' files next +*.l C +*.lex C +*.y C +*.yacc C + +# list C code files after header files +*.c C +*.C C++ +*.cc C++ +*.cpp C++ +*.cxx C++ + +# list assembly language after C +*.[sS] asm --comment=; +*.asm asm --comment=; + +# [nt]roff +*.[0-9] roff +*.ms roff +*.me roff +*.mm roff + +# TeX and friends +*.tex TeX +*.ltx TeX +*.texi texinfo +*.texinfo texinfo -@node Defining scanners in source code -@subsubsection Defining scanners in source code +@end example -@flindex scanners.c -@cindex scanners, defining in source code +@c ************* gkm ********************************************************* +@node C/C++ scanner +@subsection C/C++ Language Scanner -@vindex languages_0 -@vindex suffixes_0 -To add a new scanner in source code, you should add a new section to the -file @file{scanners.c}. Copy one of the existing scanners (most likely -either C or plain text), and modify as necessary. Also add the new -scanner to the @code{languages_0} and @code{suffixes_0} tables near the -beginning of the file. +@cindex C scanner, predefined -This is not a terribly difficult programming task, but it requires -recompiling and installing the new version of @code{mkid}, which may be -inconvenient. +The C scanner is the most commonly used. Files that match the glob +pattern @file{*.h}, @file{*.c}, as well as @file{yacc} files that match +@file{*.y} or @file{*.yacc}, and @file{lex} files that match @file{*.l} +or @file{*.lex}, are processed with this scanner. -This method leads to scanners which operate much more quickly than ones -that depend on external programmers. It is also likely the easiest way -to define scanners for new programming languages. +Scanner-specific options (Note, these options are presented +@var{without} the required @samp{-l} or @samp{--lang-option=} prefix): +@table @samp -@node Defining scanners with options -@subsubsection Defining scanners with options +@item -k @var{character-class} +@itemx --keep=@var{character-class} +@opindex -k +@opindex --keep +@opindex -l C:-k +@opindex -l C:--keep +@opindex --lang-option=C:-k +@opindex --lang-option=C:--keep + +Consider the characters in @var{character-class} as valid constituents of +identifier names. For example, if you are indexing C code that contains +@samp{$} in some of its identifiers, you can include these by using +@samp{--lang-option=C:--keep=$}, or @samp{-l C:"-k $"} (if you don't like +to type so much). + +@item -i @var{character-class} +@itemx --ignore=@var{character-class} +@opindex -i +@opindex --ignore +@opindex -l C:-i +@opindex -l C:--ignore +@opindex --lang-option=C:-i +@opindex --lang-option=C:--ignore + + x mkiConsider the characters in @var{character-class} as valid constituents of +identifier names, but discard all tokens containing these characters. +For example, if some C code has identifiers containing @samp{$}, but you +don't want these cluttering up your ID database, use +@samp{--lang-option=C:--ignore=$}, or the terser equivalent @samp{-l +C:"-i $"}. + +@item -u +@itemx --strip-underscore +@opindex -u +@opindex --strip-underscore +@opindex -l C:-u +@opindex -l C:--strip-underscore +@opindex --lang-option=C:-u +@opindex --lang-option=C:--strip-underscore + +Strip one leading underscore from C identifiers encapsulated as +character strings. This option is useful if you are indexing C code +that contains symbol-table name strings for systems that prepend an +underscore to external symbols. By default, the leading underscore is +retained. -@cindex scanners, defining with options +@end table -You can use the @samp{-S} option on the command line to define a new -language scanner: +@c ************* gkm ********************************************************* +@node Assembler scanner +@subsection Assembly Language Scanner -@example --S@var{new-scanner}/@var{existing-scanner}/@var{filter} -@end example +@cindex assembler scanner +@cindex assembly language scanner -@noindent -Here, @var{new-scanner} is the name of the new scanner being defined, -@var{existing-scanner} is the name of an existing scanner, and -@var{filter} is a shell command or pipeline. +Assembly languages use a variety of commenting conventions, and allow a +variety of special characters to @emph{dirty up} local symbols, +preventing name space conflicts with symbols defined by higher-level +languages. Also, some compilation systems prepend an underscore to +external symbols. The options listed below are designed to address +these differences. -The new scanner works by passing the input file to @var{filter}, and -then arranging for the result to be passed through -@var{existing-scanner}. Typically, @var{existing-scanner} is @samp{text}. +@table @samp -Somewhere within @var{filter}, the string@samp{%s} should occur. This -@samp{%s} is replaced by the name of the source file being scanned. +@item -c @var{character-class} +@itemx --comment=@var{character-class} +@opindex -c +@opindex --comment +@opindex -l asm:-c +@opindex -l asm:--comment +@opindex --lang-option=asm:-c +@opindex --lang-option=asm:--comment -@cindex Texinfo, scanning example of -For example, @code{mkid} has no built-in scanner for Texinfo files (like -this one). In indexing a Texinfo file, you most likely would want -to ignore the Texinfo @@-commands. Here's one way to specify a new -scanner to do this: +The characters in @var{character-class} are considered left delimiters +for comments that extend until the end of the current line. -@example --S/texinfo/text/sed s,@@[a-z]*,,g %s -@end example +@item -k @var{character-class} +@itemx --keep=@var{character-class} +@opindex -k +@opindex --keep +@opindex -l asm:-k +@opindex -l asm:--keep +@opindex --lang-option=asm:-k +@opindex --lang-option=asm:--keep + +Consider the characters of @var{character-class} as valid constituents of +identifier names. For example, if you are indexing assembly code that +prepends @samp{.} to assembler directives, and prepends @samp{%} to +register names, you can keep these characters in the tokens by specifying +@samp{--lang-option=asm:--keep=.%}, or @samp{-l asm:"-k .%"}. + +@item -i @var{character-class} +@itemx --ignore=@var{character-class} +@opindex -i +@opindex --ignore +@opindex -l asm:-i +@opindex -l asm:--ignore +@opindex --lang-option=asm:-i +@opindex --lang-option=asm:--ignore + +Consider the characters of @var{character-class} as valid consituents of +identifier names, but discard all tokens containing these characters. +For example, if you don't want to clutter your ID database with +assembler directives that begin with a leading @samp{.} or with +assembler labels that contain @samp{@@}, use +@samp{--lang-option=asm:--ignore=.@@}, or @samp{-l asm:"-i .@@"}. + +@item -u +@itemx --strip-underscore +@opindex -u +@opindex --strip-underscore +@opindex -l asm:-u +@opindex -l asm:--strip-underscore +@opindex --lang-option=asm:-u +@opindex --lang-option=asm:--strip-underscore + +Strip one leading underscore from identifiers. This option is useful if +your compilation system prepends an underscore to external symbols. By +stripping the underscore, you can canonicalize such names and bring them +into conformance the way they are expressed in the C language. By +default, the leading underscore is retained. -This defines a new language scanner (@samp{texinfo}) defined in terms of -a @code{sed} command to strip out Texinfo directives (an @samp{@@} -character followed by letters). Once the directives are stripped, the -remaining text is run through the plain text scanner. +@item -n +@itemx --no-cpp +@opindex -n +@opindex --no-cpp +@opindex -l asm:-n +@opindex -l asm:--no-cpp +@opindex --lang-option=asm:-n +@opindex --lang-option=asm:--no-cpp -This is a minimal example; to do a complete job, you would need to -completely delete some lines, such as those beginning with @code{@@end} -or @@node. +Do not recognize C preprocessor directives. By default, such lines are +handled in the same way as they are by the C language scanner. +@end table -@node idx invocation -@subsection @code{idx}: Testing @code{mkid} scanners +@c ************* gkm ********************************************************* +@node Text scanner +@subsection Text Scanner -@code{idx} prints the identifiers found in the files you specify to -standard output. This is useful in debugging new @code{mkid} scanners -(@pxref{Scanners}). Synopsis: +@cindex text scanner -@example -idx [-S@var{scanarg}] @var{files}@dots{} -@end example +The plain text scanner is intended for human-language documents, or as the +scanner of last resort for files that have no scanner that is more +specific. It is customizable to the extent that character classes can +be designated as token constituents or as token delimiters. The default +token constituents are the alpha-numerics; all other characters are +considered token delimiters. -@code{idx} accepts the same @samp{-S} options as @code{mkid}. -@xref{Scanner option formats}. +@table @samp -The name ``idx'' stands for ``ID eXtract''. The name may change in -future releases, since this is such an infrequently used program. +@item -i @var{character-class} +@itemx --include=@var{character-class} +@opindex -i +@opindex --include +@opindex -l text:-i +@opindex -l text:--include +@opindex --lang-option=text:-i +@opindex --lang-option=text:--include +Include characters belonging to @var{character-class} in tokens. -@node mkid examples -@section @code{mkid} examples +@item -x @var{character-class} +@itemx --exclude=@var{character-class} +@opindex -x +@opindex --exclude +@opindex -l text:-x +@opindex -l text:--exclude +@opindex --lang-option=text:-x +@opindex --lang-option=text:--exclude -@cindex examples of @code{mkid} +Exclude characters belonging to @var{character-class} from tokens, i.e., treat +them as token delimiters. -The simplest example of @code{mkid} is something like: +@end table -@example -mkid *.[chy] -@end example +@c ************* gkm ********************************************************* +@node Defining scanners +@subsection Defining New Scanners in the Source Code -This will build an ID database indexing identifiers and numbers in the -all the @file{.c}, @file{.h}, and @file{.y} files in the current -directory. Because @code{mkid} already knows how to scan files with -those suffixes, no additional options are needed. - -@cindex man pages, compressed -@cindex compressed files, building ID from -Here's a more complex example. Suppose you want to build a database -indexing the contents of all the @code{man} pages, and furthur suppose -that your system is using @code{gzip} (@pxref{Top, , , gzip, Gzip}) to -store compressed @code{cat} versions of the @code{man} pages in the -directory @file{/usr/catman}. The @code{gzip} program creates files -with a @code{.gz} suffix, so you must tell @code{mkid} how to scan -@file{.gz} files. Here are the commands to do the job: +@flindex scanners.c +@cindex scanners, defining in source code -@example -cd /usr/catman -find . -name \*.gz -print | mkid '-Sman/text/gzip <%s' -S.gz=man - -@end example +@vindex languages_0 -@noindent Explanation: +To add a new scanner in source code, you should add a new section to the +file @file{scanners.c}. It might be easiest to clone one of the +existing scanners and modify it as necessary. For the hypothetical +language @var{foo}, you must define the functions @code{get_token_foo}, +@code{parse_args_foo}, @code{help_me_foo}, as well as the tables +@code{long_options_foo} and @code{args_foo}. If your scanner is +modelled after one of the existing scanners, you'll also need a +character-attribute table @code{ctype_foo}. -@enumerate +This is not a terribly difficult programming task, but it requires +recompiling and installing the new version of @file{mkid} and @file{xtokid}. +You should use @file{xtokid} to test the operation of the new scanner. -@item -We first @code{cd} to @file{/usr/catman} so the ID database -will store the correct relative filenames. +Once these functions and tables are ready, add function prototypes and +an entry to to the @code{languages_0} table near the beginning of the +file. -@item -The @code{find} command prints the names of all @file{.gz} files under -the current directory. @xref{find invocation, , , sh-utils, GNU shell -utilities}. +Be warned that the existing scanners are built for speed, not elegance +or readability. You might wish to create a new scanner that's easier to +read and understand if you don't feel that speed is so important. -@item -This list is piped to @code{mkid}; the @code{-} option (at the end of -the line) tells @code{mkid} to read arguments (in this case, as is -typical, the list of filenames) from standard input. @xref{mkid options}. +@c ************* gkm ********************************************************* +@node mkid invocation +@chapter @samp{mkid}: Creating an ID Database +@cindex creating databases +@cindex databases, creating +@cindex ID file format +@cindex architecture-independence +@cindex sharing ID files -@item -The @samp{-Sman/text/gzip @dots{}} defines a new language @samp{man} in -terms of the @code{gzip} program and @code{mkid}'s existing text -scanner. @xref{Defining scanners with options}. +@file{mkid} builds an ID database. It accepts the names of files and/or +directories on the command line, selects files that have an enabled +scanner, then extracts and stores tokens from those files. The +resulting ID database is architecture- and byte-order-independent so it +can be shared among all systems. + +The primary virtues of @file{mkid} are speed and high capacity. The +size of the source trees it can index is limited only by available +system memory. @file{mkid}'s indexing algorithm is very space-efficient +and exhibits excellent locality-of-reference, and so is capable of +operating with a working-set size that is only half the size of its +virtual address space. A typical @sc{UNIX}-like operating system with +16 megabytes of system memory should be able to build an ID database +covering approximately 12,000-14,000 source files totalling +approximately 50--100 Megabytes. A 66 Mhz 486 computer can build such +a large ID database in approximately 10-15 minutes. -@item -The @samp{-S.gz=man} tells @code{mkid} to treat all @file{.gz} files as -this new language @code{man}. @xref{Scanner option formats}. +@pindex cron +In a future release, @file{mkid} will be able to incrementally update an +ID database much faster than it can build one from scratch. Until this +feature becomes available, it might be a good idea to schedule a +@file{cron} job to regularly update large ID databases during off-hours. + +@file{mkid} writes the ID file, therefore it accepts the @samp{--output} +(and @samp{--file}) options as described in @ref{Writing options}. +@file{mkid} extracts tokens from source files, therefore it accepts the +@samp{--lang-map}, @samp{--include}, @samp{--exclude}, and +@samp{--lang-option} options, as well as the language-specific scanner +options, all of which are described in @ref{Extraction options}. +@file{mkid} walks file trees, therefore it handles file and directory +names on its command line and the @samp{--prune} option as described in +@ref{Walker options}. + +In addition, @file{mkid} accepts the following command-line options: -@end enumerate +@table @samp -As a further complication, @code{cat} pages typically contain -underlining and backspace sequences, which will confuse @code{mkid}. To -handle this, the @code{gzip} command becomes a pipeline, like this: +@item -s +@itemx --statistics +@opindex -s +@opindex --statistics +@cindex statistics -@example -mkid '-Sman/text/gzip <%s | col -b' -S.gz=man - -@end example +@file{mkid} reports statistics about resource usage at the end of its +run. +@item -v +@itemx --verbose +@opindex -v +@opindex --verbose +@cindex @file{mkid} progress -@node Common query arguments -@chapter Common query arguments +@file{mkid} reports statistics about each file as it is scanned, and +about the resource usage of its indexing algorithm at regular intervals. -@cindex common query arguments +@end table -Certain options, and regular expression syntax, are shared by the ID -query tools. So we describe those things in the sections below, instead -of repeating the description for each tool. +@c ************* gkm ********************************************************* +@node lid invocation +@chapter @code{lid}: Querying an ID Database by Token + +The @file{lid} program accepts @var{patterns} on the command line which +it matches against the tokens stored in an ID database. The +interpretation of a @var{pattern} is determined by the makeup of the +@var{pattern} string itself, or can be overridden by command-line +options. If a @var{pattern} contains regular expression meta-characters, +it is used to perform a regular-expression substring search. If no such +meta-characters are present, @var{pattern} is used to perform a literal +word search. (By default, all searches are sensitive to alphabetic +case.) If no @var{pattern} is supplied on the command line, @file{lid} +lists every entry in the ID database. + +@file{lid} reads the ID database, therefore it accepts the @samp{--file} +option, and consults the @samp{IDPATH} environment variable, as +described in @ref{Reading options}. @file{lid} lists file names, +therefore it accepts the @samp{--separator} option, as described in +@ref{File listing options}. + +In addition, @code{lid} accepts the following command-line options: -@menu -* Query options:: -f -r -c -ew -kg -n -doxa -m -F -u. -* Patterns:: Regular expression syntax for searches. -* Examples: Query examples. Some common uses. -@end menu +@table @samp +@item -i +@itemx --ignore-case +@opindex -i +@opindex --ignore-case +@cindex alphabetic case, ignoring differences in +@cindex ignoring differences in alphabetic case + +Ignoring differences in alphabetic case between the @var{pattern} and +the tokens in the ID database. + +@item -l +@itemx --literal +@opindex -l +@opindex --literal + +Match @var{pattern} as a literal string. Use this option if +@var{pattern} contains regular-expression meta-characters, but you don't +wish to perform a regular-expression search. + +@item -r +@itemx --regexp +@opindex -r +@opindex --regexp + +Match @var{pattern} as an @emph{extended} regular expression@footnote{Extended +regular expressions are the same as those accepted by @file{egrep}.}. +Use this option if no regular-expression expression meta-characters are +present in @var{pattern}, but you wish to force a regular-expression +search (note: in this case, a @emph{literal substring} search might be +faster). + +@item -w +@itemx --word +@opindex -w +@opindex --word -@node Query options -@section Query options +Match @var{pattern} using a word-delimited (non substring) search. This is the default +for literal searches. -@cindex query options, common -@cindex common query options +@item -s +@itemx --substring +@opindex -s +@opindex --substring -The ID query tools (@emph{not} @code{mkid}) share certain command line -options. Not all of these options are recognized by all programs, but -if an option is used by more than one program, it is described below. -The description of each program gives the options that program uses. +Match @var{pattern} using a substring (non word-delimited) search. This +is the default for regular expression searches. -@table @samp +@item -k @var{style} +@itemx --key=@var{style} +@opindex -k +@opindex --substring -@item -f@var{idfile} -@opindex -f@var{idfile} -@cindex database name, specifying -@cindex parent directories, searched for ID -Read the database from @var{idfile}, in the current directory or in any -directory above the current directory. The default database name is -@file{ID}. Searching parent directories lets you have a single ID -database at the root of a large source tree and then use the query tools -from anywhere within that tree. - -@item -r@var{directory} -@opindex -r@var{directory} -Find files relative to @var{directory}, instead of the directory in -which the ID database was found. This is useful if the ID database was -moved after its creation. - -@item -c -@opindex -c -Equivalent to @code{-r`pwd`}, i.e., find files relative to the current -directory, instead of the directory in which the ID database was found. +@var{Style} can be one of @samp{token}, @samp{pattern} or @samp{none}. +This option controls how the subject of the query is presented. This is +best illustrated by example: -@item -e -@itemx -w -@opindex -e -@opindex -w -@cindex regular expressions, forcing evaluation as -@cindex strings, forcing evaluation as -@cindex constant strings, forcing evaluation as -@samp{-e} forces pattern arguments to be treated as regular expressions, -and @samp{-w} forces pattern arguments to be treated as constant -strings. By default, the query tools guess whether a pattern is regular -expressions or constant strings by looking for special characters. -@xref{Patterns}. - -@item -k -@itemx -g -@opindex -k -@opindex -g -@cindex brace notation in filename lists -@cindex shell brace notation in filename lists -@samp{-k} suppresses use of shell brace notation in the output. By -default, the query tools that generate lists of filenames attempt to -compress the lists using the usual shell brace notation, e.g., -@file{@{foo,bar@}.c} to mean @file{foo.c} and @file{bar.c}. (This is -useful if you use @code{ksh} or the original (not GNU) @code{sh} and -want to feed the list of names to another command, since those shells do -not support this brace notation; the name of the @code{-k} option comes -from the @code{k} in @code{ksh}). - -@samp{-g} turns on use of brace notation; this is only needed if the -query tools were compiled with @samp{-k} as the default behavior. +@example +$ lid --key=token '^dest.' +destaddr libsys/memcpy.c +destination libsys/regex.c +destlst libsys/rx.c +destpos libsys/rx.c +destset libsys/rx.h libsys/rx.c + +$ lid --key=pattern '^dest.' +^dest. libsys/rx.h libsys/@{memcpy,regex,rx@}.c + +$ lid --key=none '^dest.' +libsys/rx.h libsys/@{memcpy,regex,rx@}.c +@end example -@item -n -@opindex -n -@cindex suppressing matching identifier -Suppress the matching identifier before each list of filenames that the -query tools output by default. This is useful if you want a list of just -the names to feed to another command. +When @samp{--key} is either @samp{token} or @samp{pattern}, the first +column of output is a @var{token} or @var{pattern}, respectively. When +@samp{--key} is @samp{none}, neither of these is printed, and the file +name list begins immediately. The default is @samp{token}. + +@item -R @var{style} +@itemx --result=@var{style} +@opindex -R +@opindex --result + +@var{Style} can be one of @samp{filenames}, @samp{grep}, @samp{edit} or +@samp{none}. This option controls how the value associated with the +query's @var{key} presented. When @var{style} is @samp{filenames}, a +list of file names is printed (this is the default). When @var{style} +is @samp{grep}, the lines that match @var{pattern} are printed in the +same format as @samp{egrep -n}. When @var{style} is @samp{edit}, the +file names are passed to an editor, and if possible @var{pattern} is +passed as an initial search string (@pxref{eid invocation}). When +@var{style} is @samp{none}, the file names are not processed in any way. +This can be useful if you wish to see what tokens match a @var{pattern}, +but don't care about where they reside. @item -d @itemx -o @itemx -x -@itemx -a @opindex -d @opindex -o @opindex -x -@opindex -a @cindex radix of numeric matches, specifying @cindex numeric matches, specifying radix of + These options may be used in any combination to specify the radix of numeric matches. @samp{-d} allows matching on decimal numbers, -@samp{-o} on octal numbers, and @samp{-x} on hexadecimal numbers. The -@code{-a} option is equivalent to specifying all three; this is the -default. Any combination of these options may be used. +@samp{-o} on octal numbers, and @samp{-x} on hexadecimal numbers. Any +combination of these options may be used. The default is to match all +three radixes. -@item -m -@opindex -m -@cindex multiple lines, merging -Merge multiple lines of output into a single line. If your query -matches more than one identifier, the default is to generate a separate -line of output for each matching identifier. - -@itemx -F- -@itemx -F@var{n} -@itemx -F-@var{m} -@itemx -F@var{n}-@var{m} +@item -F @var{range} +@itemx --frequency=@var{range} @opindex -F +@opindex --frequency @cindex single matches, showing -Show identifiers matching at least @var{n} and at most @var{m} times. -@samp{-F-} is equivalent to @samp{-F1}, i.e., find identifiers that -appear only once in the database. (This is useful to locate identifiers -that are defined but never used, or used once and never defined.) - -@item -u@var{number} -@opindex -u -@cindex conflicting identifiers, finding -List identifiers that conflict in the first @var{number} characters. -This could be in useful porting programs to brain-dead computers that -refuse to support long identifiers, but your best long term option is to -set such computers on fire. - -@end table - -@node Patterns -@section Patterns - -@cindex patterns -@cindex regular expression syntax - -@dfn{Patterns}, also called @dfn{regular expressions}, allow you to -match many different identifiers in a single query. - -The same regular expression syntax is recognized by all the query tools -that handle regular expressions. The exact syntax depends on how the ID -tools were compiled, but the following constructs should always be -supported: - -@table @samp - -@item . -Match any single character. - -@item [@var{chars}] -Match any of the characters specified within the brackets. You can -match any characters @emph{except} the ones in brackets by typing -@samp{^} as the first character. A range of characters can be specified -using @samp{-}. For example, @samp{[abc]} and @samp{[a-c]} both match -@samp{a}, @samp{b}, or @samp{c}, and @samp{[^abc]} matches anything -@emph{except} @samp{a}, @samp{b}, or @samp{c}. - -@item * -Match the previous construct zero or more times. +Match tokens whose occurrence count falls in @var{range}. @var{Range} +may be expressed as a single number @var{n}, or as a range +@var{n@code{..}m}. Either limit of the range may be omitted (e.g., +@var{@code{..}m}, or @var{n..@code{..}}). If the lower limit @var{n} is +omitted, it defaults to @code{1}. If the upper limit is omitted, it +defaults in the present implementation to @code{65535}, the maximum +value of an unsigned 16-bit integer. + +Particularly useful queries are @samp{lid -F1}, which helps locate +identifiers that are defined but never used, or are used but never +defined. Similarly, @code{lid -F2} can help find functions that possess +a prototype declaration and a definition, but are never called. + +@item -a @var{number} +@itemx --ambiguous=@var{number} +@opindex -a +@opindex --ambiguous +@cindex ambiguous identifier names, finding -@item ^ -@itemx $ -@samp{^} (@samp{$}) at the beginning (end) of a pattern anchors the -match to the first (last) character of the identifier. +List identifiers (not numbers) that are ambiguous for the first +@var{number} characters. This feature might be in useful when porting +programs to ancient pea-brained compilers that don't support long +identifier names. However, the best long-term option is to set such +systems on fire. @end table -The query programs use either the @code{regex}/@code{regcmp} or -@code{re_comp}/@code{re_exec} functions, depending on which are -available in the library on your system. These do not always support -the exact same regular expression syntax, so consult your local -@code{man} pages to find out. - - -@node Query examples -@section Query examples - -@cindex examples, queries -@cindex query examples -Here are some examples of the options described in the previous -sections. - -To restrict searches to exact matches, use @samp{^@dots{}$}. For example: - -@example -prompt$ gid '^FILE$' -ansi2knr.c:144: @{ FILE *in, *out; -ansi2knr.c:315: FILE *out; -fid.c:38: FILE *id_FILE; -filenames.c:576: FILE * -@dots{} -@end example - -To show identifiers not unique in the first 16 characters: - -@example -prompt$ lid -u16 -RE_CONTEXT_INDEP_ANCHORS regex.c -RE_CONTEXT_INDEP_OPS regex.c -RE_SYNTAX_POSIX_BASIC regex.c -RE_SYNTAX_POSIX_EXTENDED regex.c -@dots{} -@end example - -@cindex numeric searches -Numbers are searched for numerically rather than textually. For example: - -@example -prompt$ lid 0xff -0377 @{lid,regex@}.c -0xff @{bitops,fid,lid,mkid@}.c -255 regex.c -@end example - -On the other hand, you can restrict a numeric search to a particular -radix if you want: - -@example -laurie$ lid -x 0xff -0xff @{bitops,fid,lid,mkid@}.c -@end example - -Filenames in the output are always adjusted to be correct for the -correct working directory. For example: - -@example -prompt$ lid bdevsw -bdevsw sys/conf.h cf/conf.c io/bio.c os/@{fio,main,prf,sys3@}.c -prompt$ cd io -prompt$ lid bdevsw -bdevsw ../sys/conf.h ../cf/conf.c bio.c ../os/@{fio,main,prf,sys3@}.c -@end example - - -@node gid invocation -@chapter @code{gid}: Listing matching lines - -Synopsis: - -@example -gid [-f@var{file}] [-u@var{n}] [-r@var{dir}] [-doxasc] [@var{pattern}@dots{}] -@end example - -@code{gid} finds the identifiers in the database that match the -specified @var{pattern}s, then searches for all occurrences of those -identifiers, in only the files containing matches. In a large source -tree, this saves an enormous amount of time (compared to searching every -source file). - -With no @var{pattern} arguments, @code{gid} prints every line of every -source file. - -The name ``gid'' stands for ``grep for identifiers'', @code{grep} being -the standard utility to search regular files. +@menu +* lid aliases:: Aliases for specialized lid queries +* Emacs gid interface:: GNU Emacs query interface +* eid invocation:: Invoking an editor on query results +@end menu -@xref{Common query arguments}, for a description of the command-line -options and @var{pattern} arguments. +@c ************* gkm ********************************************************* +@node lid aliases +@section Aliases for Specialized @file{lid} Queries -@code{gid} uses the standard GNU output format for identifying source lines: +Historically, the ID utilities have provided several query interfaces +which are specializations of @code{lid} (@pxref{lid invocation}). -@example -@var{filename}:@var{linenum}: @var{text} -@end example +@table @file -Here is an example: +@item gid +(alias for @samp{lid -R grep}) +lists all lines containing the requested pattern. -@example -prompt$ gid FILE -ansi2knr.c:144: @{ FILE *in, *out; -ansi2knr.c:315: FILE *out; -fid.c:38: FILE *id_FILE; -@dots{} -@end example +@item eid +(alias for @samp{lid -R edit}) +invokes an editor on all files containing the requested pattern, and +optionally initiates a text search for that pattern. -@menu -* GNU Emacs gid interface:: Using next-error with gid. -@end menu +@item aid +(alias for @samp{lid -ils}) treats the requested pattern +as a case-insensitive literal substring. +@end table -@node GNU Emacs gid interface -@section GNU Emacs @code{gid} interface +@c *************************************************************************** +@node Emacs gid interface +@section GNU Emacs query interface @cindex Emacs interface to @code{gid} -@flindex gid.el @r{interface to Emacs} +@flindex id-utils.el @r{interface to Emacs} @vindex load-path -The @code{mkid} source distribution comes with a file @file{gid.el}, +The @code{id-utils} source distribution comes with a file @file{id-utils.el}, which defines a GNU Emacs interface to @code{gid}. To install it, put -@file{gid.el} somewhere that Emacs will find it (i.e., in your +@file{id-utils.el} somewhere that Emacs will find it (i.e., in your @code{load-path}) and put @example @@ -1041,334 +1023,241 @@ The @code{gid} function prompts you with the word around point. If you want to search for something else, simply delete the line and type the pattern of interest. -@flindex *scratch* @r{Emacs buffer} +@flindex *compilation* @r{Emacs buffer} The function then runs the @code{gid} program in a @samp{*compilation*} buffer, so the normal @code{next-error} function can be used to visit all the places the identifier is found (@pxref{Compilation,,, emacs, The GNU Emacs Manual}). - -@node Looking up identifiers -@chapter Looking up identifiers - -These commands look up identifiers in the ID database and operate on the -files containing matches. - -@menu -* lid invocation:: Matching patterns. -* aid invocation:: Matching strings. -* eid invocation:: Invoking an editor on matches. -* fid invocation:: Listing a file's identifiers. -@end menu - - -@node lid invocation -@section @code{lid}: Matching patterns - -@pindex lid - -Synopsis: - -@example -lid [-f@var{file}] [-u@var{n}] [-r@var{dir}] [-mewdoxaskgnc] @c -@var{pattern}@dots{} -@end example - -@code{lid} searches the database for identifiers matching the given -@var{pattern} arguments and prints the names of the files that match -each @var{pattern}. With no @var{pattern}s, @code{lid} lists every -entry in the database. - -The name ``lid'' stands for ``lookup identifier''. - -@xref{Common query arguments}, for a description of the command-line -options and @var{pattern} arguments. - -By default, each line of output consists of an identifier and all the -files containing that identifier. - -Here is an example showing a search for a single identifier (omitting -some output to keep lines short): - -@example -prompt$ lid FILE -FILE extern.h @{fid,gets0,getsFF,idx,init,lid,mkid,@dots{}@}.c -@end example - -This example shows a regular expression search: - -@example -prompt$ lid 'FILE$' -AF_FILE mkid.c -AF_IDFILE mkid.c -FILE extern.h @{fid,gets0,getsFF,idx,init,lid,mkid,@dots{}@}.c -IDFILE id.h @{fid,lid,mkid@}.c -IdFILE @{fid,lid@}.c -@dots{} -@end example - -@noindent As you can see, when a regular expression is used, it is -possible to get more than one line of output. To merge multiple lines -into one, use @samp{-m}: - -@example -prompt$ lid -m ^get -^get extern.h @{bitsvec,fid,gets0,getsFF,getscan,idx,lid,@dots{}@}.c -@end example - - -@node aid invocation -@section @code{aid}: Matching strings - -@pindex aid - -Synopsis: - -@example -aid [-f@var{file}] [-u@var{n}] [-r@var{dir}] [-mewdoxaskgnc] @c -@var{string}@dots{} -@end example - -@cindex case-insensitive searching -@cindex string searching -@code{aid} searches the database for identifiers containing the given -@var{string} arguments. The search is case-insensitive. - -@flindex whatis -The name ``aid'' stands for ``apropos identifier'', @code{apropros} -being a command that does a similar search of the @code{whatis} database -of @code{man} descriptions. - -For example, @samp{aid get} matches the identifiers @code{fgets}, -@code{GETLINE}, and @code{getchar}. - -The default output format is the same as @code{lid}; see the previous -section. - -@xref{Common query arguments}, for a description of the command-line -options and @var{pattern} arguments. - - +@c ************* gkm ********************************************************* @node eid invocation -@section @code{eid}: Invoking an editor on matches +@section @code{eid}: Invoking an Editor on Query Results @pindex eid -Synopsis: - -@example -eid [-f@var{file}] [-u@var{n}] [-r@var{dir}] [-doxasc] [@var{pattern}]@dots{} -@end example - -@code{eid} runs the usual search (@pxref{lid invocation}) on the given -arguments, shows you the output, and then asks: +@samp{lid -R edit} is an editing interface for the ID utilities that is +most commonly used with @file{vi}. Emacs users should use the interface +defined in @code{id-utils.el} (@pxref{Emacs gid interface}). The ID +utilities include an alias called @file{eid}, and for the sake of +brevity, we'll use this alias for the remainder of this section. +@file{eid} performs a @file{lid}-style, then asks if you wish to edit +the files. If your query yields more than one line of output, you will +be prompted after each line. This is the prompt you'll see: @example -Edit? [y1-9^S/nq] +Edit? [y1-9^S/nq] @end example @noindent -You can respond with: +You may respond with: @table @samp + @item y Edit all files listed. @item 1@dots{}9 Edit all files starting at the @math{@var{n} + 1}'st file. -@item /@var{string} @r{or} @kbd{CTRL-S}@var{string} -Edit all files whose name contains @var{string}. +@item /@var{string} @r{or} @kbd{CTRL-S}@var{regexp} +Search into the file list, and begin editing with the first file name +that matches the regular expression @var{regexp}. @item n -Go on to the next @var{pattern}, i.e., edit no files for this one. +Don't edit any files. If another line of query output is pending, +advance to that line, for which another @samp{Edit?} prompt will appear. @item q -Quit @code{eid}. +Quit---don't edit any files, and don't process any more lines of query +output. @end table -@code{eid} invokes an editor once per @var{pattern}; all the specified -files are given to the editor for you to edit simultaneously. +Here is an example: -@code{eid} invokes the editor defined by the @samp{EDITOR} environment -variable. If the editor can accept an initial search argument on the -command line, @code{eid} moves automatically to the location of the -match, via the environment variables below. +@example +prompt$ eid FILE \^print +FILE @{ansi2knr,fid,filenames,idfile,idx,lid,misc,@dots{}@}.c +Edit? [y1-9^S/nq] n +^print @{ansi2knr,fid,getopt,getopt1,lid,mkid,regex,scanners@}.c +Edit? [y1-9^S/nq] 2 +@end example -@xref{Common query arguments}, for a description of the command-line -options and @var{pattern} arguments. +@noindent This will start editing at @file{getopt}.c. -Here are the environment variables relevant to @code{eid}: +@code{eid} invokes the editor defined by the environment variable +@samp{VISUAL}. If @samp{VISUAL} is undefined, it uses the environment +variable @samp{EDITOR} instead. If @samp{EDITOR} is undefined, it +defaults to @file{vi}. It is possible for @file{eid} to pass the editor +an initial search pattern so that your cursor will immediately alight on +the token of interest. This feature is controlled by the following +environment variables: @table @samp -@item EDITOR -@vindex EDITOR -The name of the editor program to invoke. - @item EIDARG @vindex EIDARG -@cindex search for identifier, initial -The argument to pass to the editor to search for the matching -identifier. For @code{vi}, this should be @samp{+/%s/'}. +@cindex search for token, initial +A printf(3) format string for the editor argument to search for the +matching token. For @code{vi}, this should be @samp{+/%s/}. @item EIDLDEL @vindex EIDLDEL @cindex left delimiter editor argument @cindex beginning-of-word editor argument -A regular expression to force a match at the beginning of a word (``left -delimiter). @code{eid} inserts this in front of the matching identifier -when composing the search argument. For @code{vi}, this should be -@samp{\<}. +The regular-expression meta-character(s) for delimiting the beginning of +a word (the `@file{eid} Left DELimiter'). @code{eid} inserts this in +front of the matching token when a word-search is desired. For +@file{vi}, this should be @samp{\<}. @item EIDRDEL @vindex EIDRDEL @cindex right delimiter editor argument @cindex end-of-word editor argument -The end-of-word regular expression. For @code{vi}, this should be -@samp{\>}. +The regular-expression meta-character(s) for delimiting the end of +a word (the `@file{eid} Right DELimiter'). @code{eid} inserts this in +end of the matching token when a word-search is desired. For +@file{vi}, this should be @samp{\>}. @end table -For Emacs users, the interface in @code{gid.el} is probably preferable -to @code{eid}. @xref{GNU Emacs gid interface}. - - -Here is an example: - -@example -prompt$ eid FILE \^print -FILE @{ansi2knr,fid,filenames,idfile,idx,lid,misc,@dots{}@}.c -Edit? [y1-9^S/nq] n -^print @{ansi2knr,fid,getopt,getopt1,lid,mkid,regex,scanners@}.c -Edit? [y1-9^S/nq] 2 -@end example - -@noindent This will start editing at @file{getopt}.c. - - +@c ************* gkm ********************************************************* @node fid invocation -@section @code{fid}: Listing a file's identifiers +@chapter @code{fid}: Listing a file's tokens @pindex fid -@cindex identifiers in a file - -@code{fid} lists the identifiers found in a given file. Synopsis: - -@example -fid [-f@var{dbfile}] @var{file1} [@var{file2}] -@end example - -@table @samp - -@item -f@var{dbfile} -Read the database from @var{dbfile} instead of @file{ID}. - -@item @var{file1} -List all the identifiers contained in @var{file1}. +@cindex tokens in a file +@cindex tokens common to two files -@item @var{file2} -With a second file argument, list only the identifiers both files have -in common. +@file{fid} prints the tokens found in a given file. If two file names +are passed on the command line, @file{fid} prints the tokens that are +common to both files (i.e., the @emph{set intersection} of the two token +sets). -@end table - -The output is simply one identifier (or number) per line. +@file{lid} reads the ID database, therefore it accepts the @samp{--file} +option, and consults the @samp{IDPATH} environment variable, as +described in @ref{Reading options}. +If the standard output is attached to a terminal, the printed tokens are +separated by spaces. Otherwise, the tokens are printed one per line. -@node pid invocation -@chapter @code{pid}: Looking up filenames +@c ************* gkm ********************************************************* +@node fnid invocation +@chapter @code{fnid}: Looking up filenames -@pindex pid +@pindex fnid @cindex filenames, matching @cindex matching filenames -@code{pid} matches the filenames stored in the ID database, rather than -the identifiers. Synopsis: +@code{fnid} queries the list of file names stored in the ID database. +It accepts shell @emph{wildcard} patterns on the command line. If no +pattern is supplied, @file{*} is implied. @file{fnid} prints the +file names that match the given patterns. -@example -pid [-f@var{dbfile}] [-r@var{dir}] [-ebkgnc] @var{wildcard}@dots{} -@end example - -By default, the @var{wildcard} patterns are treated as shell globbing -patterns, rather than the regular expressions the other utilities -accept. See the section below for details. - -Besides the standard options given in the synopsis (@pxref{Query -options}), @code{pid} accepts the following: - -@table @samp - -@item -e -@opindex -e -Do the usual regular expression matching (@pxref{Patterns}), instead -of shell wildcard matching. - -@item -b -@opindex -b -@cindex basename match -Match the basenames of the files in the database. For example, -@samp{pid -b foo} will match the stored filename @file{dir/foo}, but not -@file{foo/file}. - -@end table +@code{fnid} prints file names, and as such accepts the +@samp{--separator} option as described in @ref{File listing options}. For example, the command: @example -pid \*.c +fnid \*.c @end example @noindent lists all the @file{.c} files in the database. (The @samp{\} here protects the @samp{*} from being expanded by the shell.) -@menu -* Wildcard patterns:: Shell-style globbing patterns. -@end menu +@c ************* gkm ********************************************************* +@node xtokid invocation +@chapter @file{xtokid}: Testing Language Scanners +@file{xtokid} accepts the names of files and/or directories on the +command line, then extracts and prints a stream of tokens from those +files for which it has a valid, enabled scanner. This is useful +primarily for debugging new @file{mkid} scanners (@pxref{Defining +scanners}). -@node Wildcard patterns -@section Wildcard patterns +@file{xtokid} extracts tokens from source files, therefore it accepts +the @samp{--lang-map}, @samp{--include}, @samp{--exclude}, and +@samp{--lang-option} options, as well as the language-specific scanner +options, all of which are described in @ref{Extraction options}. +@file{xtokid} walks file trees, therefore it handles file and directory +names on its command line and the @samp{--prune} option as described in +@ref{Walker options}. -@cindex globbing patterns -@cindex shell wildcard patterns -@cindex wildcard wildcard patterns +The name @samp{xtokid} indicates that it is the ``eXtract TOKens ID +utility''. -@code{pid} does simplified shell wildcard matching (unless the @samp{-e} -option is specified), rather than the regular expression matching done -by the other utilities. Here is a description of wildcard matching, -also called @dfn{globbing}: +@c ************* gkm ********************************************************* +@node Past and Future +@chapter Past and Future -@itemize @bullet +@cindex history -@item -@kindex * @r{in globbing} -@samp{*} matches zero or more characters. +@pindex look @r{and @file{mkid} 1} +@cindex McGary, Greg +Greg McGary conceived of the ideas behind the ID utilities when he +began working on the Unix kernel in 1984. He needed a navigation tool +to help him find his way around the expansive, unfamiliar landscape. +The first @code{id-utils}-like tools were shell scripts, and produced an +ASCII database that looks much like the output of @samp{lid ".*"}. It +took over an hour on a @sc{vax 11/750} to build a database for a +@sc{4.1bsd} derived kernel. The first version of @file{lid} used the +@sc{unix} system utility @code{look}, modified to handle very long +lines. + +In 1986, Greg rewrote the shell scripts in C to improve performance. +Build times for the ID file were shortened by an order of magnitude. +The ID utilities were first posted to @samp{comp.sources.unix} in +September 1987 under the name @code{id}. -@item -@kindex ? @r{in globbing} -@samp{?} matches any single character. +@cindex Horsley, Tom +@cindex Scofield, Doug +@cindex Leonard, Bill +@cindex Berry, Karl +Over the next few years, several versions diverged from the original +source. Tom Horsley at Harris Computer Systems Division stepped forward +to take over maintenance and integrated some of the fixes from divergent +versions. A first release of the renamed @file{mkid} @w{version 2} was +posted to @file{alt.sources} near the end of 1990. At that time, Tom +wrote a Texinfo manual with the encouragement the net community. +(Tom especially thanks Doug Scofield and Bill Leonard whom he dragooned +into helping poorfraed and edit---they found several problems in the +initial version.) Karl Berry revamped the manual for Texinfo style, +indexing, and organization in 1995. + +In January 1995, Greg McGary reemerged as the primary maintainer and +launched development of @file{mkid} version 3, whose primary new feature +is an efficient algorithm for building databases that is linear in both +time and space over the size of the input text. (The old algorithm was +quadratic in space so it was incapable of handling very large source +trees.) For the first time, the code was released under the GNU Public +License. + +In June 1996, the package was renamed again to @code{id-utils} and was +released for the first time under FSF copyright as part of the GNU +system. All programs had their command-line arguments completely +revised. The @file{mkid} and @file{xtokid} programs also gained a +file-tree walker, so that directory names can be passed on the command +line instead of the names of every individual file. Greg reorganized +and rewrote most of the Texinfo manual to reflect these changes. -@item -@kindex \ @r{in globbing} -@samp{\} forces the next character to be taken literally. +@pindex cscope +@pindex grep +@cindex future +Future releases of @code{id-utils} might include: -@item -@kindex [@dots{}] @r{in globbing} -@samp{[@var{chars}]} matches any single character listed in @var{chars}. +@table @bullet -@item -@kindex [!@dots{}] @r{in globbing} -@samp{[!@var{chars}]} matches any character @emph{not} listed in @var{chars}. +an optional coupling with GNU @code{grep}, so that @code{grep} can use +an ID database for hints -@end itemize +a @code{cscope} work-alike query interface -Most shells treat @samp{/} and leading @samp{.} characters -specially. @code{pid} does not do this. It simply matches the filename -in the database against the wildcard pattern. +incremental update of the ID database. +@end table +@c *************************************************************************** @node Index @unnumbered Index diff --git a/doc/version.texi b/doc/version.texi index 4893f0a..2ec9dd9 100644 --- a/doc/version.texi +++ b/doc/version.texi @@ -1,3 +1,3 @@ -@set UPDATED 16 March 1996 -@set EDITION 3.0.9 -@set VERSION 3.0.9 +@set UPDATED 4 July 1996 +@set EDITION 3.1 +@set VERSION 3.1 diff --git a/lib/Makefile.am b/lib/Makefile.am index 520f05e..4d67679 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1,28 +1,22 @@ ## Process this file with automake to create Makefile.in -AUTOMAKE_OPTIONS = ansi2knr +noinst_LIBRARIES = sys -noinst_LIBRARIES = idu +EXTRA_DIST = alloca.c basename.c dirname.c error.c fnmatch.c getopt.c \ + getopt1.c memcpy.c memset.c obstack.c regex.c rx.c \ + strcasecmp.c strcspn.c strdup.c strndup.c strpbrk.c strspn.c \ + strstr.c strtok.c -EXTRA_DIST = alloca.c error.c getopt.c getopt1.c regex.c rx.c \ - strcasecmp.c strdup.c strndup.c strtok.c \ - obstack.c basename.c dirname.c fnmatch.c \ - ansi2knr.1 ansi2knr.c +sys_SOURCES = xgetcwd.c xmalloc.c -idu_SOURCES = misc.c scanners.c idfile.c filenames.c bitops.c token.c \ - idwalk.c hash.c dynvec.c xmalloc.c xgetcwd.c - -idudir = $(prefix)/share -idu_DATA = language.map - -noinst_HEADERS = alloc.h bitops.h error.h filenames.h getopt.h idarg.h \ - idfile.h misc.h regex.h rx.h scanners.h strxtra.h \ - token.h system.h hash.h obstack.h pathmax.h dynvec.h \ - xmalloc.h fnmatch.h ansidecl.h +noinst_HEADERS = ansidecl.h error.h fnmatch.h getopt.h obstack.h \ + pathmax.h regex.h rx.h xalloca.h xdirent.h xfnmatch.h \ + xmalloc.h xobstack.h xstddef.h xstdlib.h xstring.h xsysstat.h \ + xunistd.h + INCLUDES = -I. -I$(srcdir) \ - -I../lib -I$(top_srcdir)/lib \ -I../intl -I$(top_srcdir)/intl \ -I.. -I$(top_srcdir) -DEFS = -DLOCALEDIR=\"$(localedir)\" -DLANGUAGE_MAP=\"$(idudir)/language.map\" @DEFS@ -idu_LIBADD = @REGEXOBJ@ @LIBOBJS@ @ALLOCA@ +DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@ +sys_LIBADD = @REGEXOBJ@ @LIBOBJS@ @ALLOCA@ diff --git a/lib/Makefile.in b/lib/Makefile.in index ef55b85..2e51ac8 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -38,37 +38,30 @@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ transform = @program_transform_name@ -AUTOMAKE_OPTIONS = ansi2knr +noinst_LIBRARIES = sys -noinst_LIBRARIES = idu +EXTRA_DIST = alloca.c basename.c dirname.c error.c fnmatch.c getopt.c \ + getopt1.c memcpy.c memset.c obstack.c regex.c rx.c \ + strcasecmp.c strcspn.c strdup.c strndup.c strpbrk.c strspn.c \ + strstr.c strtok.c -EXTRA_DIST = alloca.c error.c getopt.c getopt1.c regex.c rx.c \ - strcasecmp.c strdup.c strndup.c strtok.c \ - obstack.c basename.c dirname.c fnmatch.c \ - ansi2knr.1 ansi2knr.c +sys_SOURCES = xgetcwd.c xmalloc.c -idu_SOURCES = misc.c scanners.c idfile.c filenames.c bitops.c token.c \ - idwalk.c hash.c dynvec.c xmalloc.c xgetcwd.c - -idudir = $(prefix)/share -idu_DATA = language.map - -noinst_HEADERS = alloc.h bitops.h error.h filenames.h getopt.h idarg.h \ - idfile.h misc.h regex.h rx.h scanners.h strxtra.h \ - token.h system.h hash.h obstack.h pathmax.h dynvec.h \ - xmalloc.h fnmatch.h ansidecl.h +noinst_HEADERS = ansidecl.h error.h fnmatch.h getopt.h obstack.h \ + pathmax.h regex.h rx.h xalloca.h xdirent.h xfnmatch.h \ + xmalloc.h xobstack.h xstddef.h xstdlib.h xstring.h xsysstat.h \ + xunistd.h INCLUDES = -I. -I$(srcdir) \ - -I../lib -I$(top_srcdir)/lib \ -I../intl -I$(top_srcdir)/intl \ -I.. -I$(top_srcdir) -DEFS = -DLOCALEDIR=\"$(localedir)\" -DLANGUAGE_MAP=\"$(idudir)/language.map\" @DEFS@ -idu_LIBADD = @REGEXOBJ@ @LIBOBJS@ @ALLOCA@ +DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@ +sys_LIBADD = @REGEXOBJ@ @LIBOBJS@ @ALLOCA@ mkinstalldirs = $(top_srcdir)/mkinstalldirs CONFIG_HEADER = ../config.h LIBRARIES = $(noinst_LIBRARIES) -noinst_LIBFILES = libidu.a +noinst_LIBFILES = libsys.a CC = @CC@ LEX = @LEX@ @@ -80,17 +73,11 @@ LIBS = @LIBS@ COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) LINK = $(CC) $(LDFLAGS) -o $@ - -ANSI2KNR = @ANSI2KNR@ -o = .@U@o -idu_OBJECTS = misc$o scanners$o idfile$o filenames$o bitops$o token$o \ -idwalk$o hash$o dynvec$o xmalloc$o xgetcwd$o -EXTRA_idu_SOURCES = -LIBFILES = libidu.a +sys_OBJECTS = xgetcwd.o xmalloc.o +EXTRA_sys_SOURCES = +LIBFILES = libsys.a AR = ar RANLIB = @RANLIB@ -DATA = $(idu_DATA) - HEADERS = $(noinst_HEADERS) DIST_COMMON = Makefile.am Makefile.in @@ -105,8 +92,8 @@ DEP_DISTFILES = $(DIST_COMMON) $(SOURCES) $(BUILT_SOURCES) $(HEADERS) \ $(TEXINFOS) $(INFO_DEPS) $(MANS) $(EXTRA_DIST) $(DATA) TAR = tar -SOURCES = $(idu_SOURCES) -OBJECTS = $(idu_OBJECTS) +SOURCES = $(sys_SOURCES) +OBJECTS = $(sys_OBJECTS) default: all @@ -138,57 +125,12 @@ distclean-compile: rm -f *.tab.c maintainer-clean-compile: +$(sys_OBJECTS): ../config.h -.c._c: - $(ANSI2KNR) $< > $*.tmp && mv $*.tmp $@ - -._c._o: - @echo $(COMPILE) $< - @rm -f _$*.c - @ln $< _$*.c && $(COMPILE) _$*.c && mv _$*.o $@ && rm _$*.c - -.c._o: - $(ANSI2KNR) $< > $*.tmp && mv $*.tmp $*._c - @echo $(COMPILE) $*._c - @rm -f _$*.c - @ln $*._c _$*.c && $(COMPILE) _$*.c && mv _$*.o $@ && rm _$*.c - -ansi2knr: ansi2knr.o - $(LINK) ansi2knr.o $(LIBS) - -$(OBJECTS): $(ANSI2KNR) -ansi2knr.o: $(CONFIG_HEADER) - -mostlyclean-kr: - rm -f *._o *._c _*.c _*.o - -clean-kr: - -distclean-kr: - rm -f ansi2knr - -maintainer-clean-kr: -$(idu_OBJECTS): ../config.h - -libidu.a: $(idu_OBJECTS) $(idu_LIBADD) - rm -f libidu.a - $(AR) cru libidu.a $(idu_OBJECTS) $(idu_LIBADD) - $(RANLIB) libidu.a - -install-iduDATA: $(idu_DATA) - $(mkinstalldirs) $(idudir) - list="$(idu_DATA)"; for p in $$list; do \ - if test -f $(srcdir)/$$p; then \ - $(INSTALL_DATA) $(srcdir)/$$p $(idudir)/$$p; \ - else if test -f $$p; then \ - $(INSTALL_DATA) $$p $(idudir)/$$p; \ - fi; fi; \ - done - -uninstall-iduDATA: - list="$(idu_DATA)"; for p in $$list; do \ - rm -f $(idudir)/$$p; \ - done +libsys.a: $(sys_OBJECTS) $(sys_LIBADD) + rm -f libsys.a + $(AR) cru libsys.a $(sys_OBJECTS) $(sys_LIBADD) + $(RANLIB) libsys.a ID: $(HEADERS) $(SOURCES) here=`pwd` && cd $(srcdir) && mkid -f$$here/ID $(SOURCES) $(HEADERS) @@ -215,41 +157,24 @@ distdir: $(DEP_DISTFILES) || ln $(srcdir)/$$file $(distdir)/$$file 2> /dev/null \ || cp -p $(srcdir)/$$file $(distdir)/$$file; \ done -alloca.o: alloca.c -basename.o: basename.c -bitops.o: bitops.c bitops.h -dirname.o: dirname.c strxtra.h -dynvec.o: dynvec.c dynvec.h alloc.h -error.o: error.c -filenames$o: filenames.c system.h \ - strxtra.h filenames.h misc.h \ - error.h -fnmatch.o: fnmatch.c -getopt.o: getopt.c -getopt1.o: getopt1.c getopt.h -hash.o: hash.c hash.h alloc.h \ - error.h -idfile.o: idfile.c alloc.h idfile.h \ - hash.h strxtra.h error.h -idwalk$o: idwalk.c system.h idfile.h \ - hash.h error.h alloc.h \ - dynvec.h strxtra.h scanners.h \ - pathmax.h -memcpy.o: memcpy.c -memset.o: memset.c -misc.o: misc.c system.h strxtra.h \ - misc.h -scanners$o: scanners.c system.h error.h \ - strxtra.h token.h alloc.h \ - scanners.h -strcasecmp.o: strcasecmp.c -strdup.o: strdup.c -strerror.o: strerror.c -strndup$o: strndup.c -strtok.o: strtok.c -token.o: token.c token.h -xgetcwd.o: xgetcwd.c pathmax.h -xmalloc.o: xmalloc.c error.h +alloca.o: ../lib/alloca.c +basename.o: ../lib/basename.c ../lib/xstring.h +dirname.o: ../lib/dirname.c ../lib/xstring.h +error.o: ../lib/error.c +fnmatch.o: ../lib/fnmatch.c +getopt.o: ../lib/getopt.c +getopt1.o: ../lib/getopt1.c ../lib/getopt.h +memcpy.o: ../lib/memcpy.c +memset.o: ../lib/memset.c +strcspn.o: ../lib/strcspn.c +strdup.o: ../lib/strdup.c +strndup.o: ../lib/strndup.c ../lib/xstring.h ../lib/xmalloc.h +strpbrk.o: ../lib/strpbrk.c +strspn.o: ../lib/strspn.c +strstr.o: ../lib/strstr.c +strtok.o: ../lib/strtok.c +xgetcwd.o: ../lib/xgetcwd.c ../lib/pathmax.h +xmalloc.o: ../lib/xmalloc.c ../lib/error.h info: @@ -261,19 +186,18 @@ installcheck: install-exec: -install-data: install-iduDATA +install-data: install: install-exec install-data all @: -uninstall: uninstall-iduDATA +uninstall: -all: $(LIBFILES) $(DATA) $(HEADERS) Makefile +all: $(LIBFILES) $(HEADERS) Makefile install-strip: $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install installdirs: - $(mkinstalldirs) $(idudir) mostlyclean-generic: @@ -290,35 +214,32 @@ maintainer-clean-generic: test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) mostlyclean: mostlyclean-noinstLIBRARIES mostlyclean-compile \ - mostlyclean-kr mostlyclean-tags mostlyclean-generic + mostlyclean-tags mostlyclean-generic -clean: clean-noinstLIBRARIES clean-compile clean-kr clean-tags \ - clean-generic mostlyclean +clean: clean-noinstLIBRARIES clean-compile clean-tags clean-generic \ + mostlyclean -distclean: distclean-noinstLIBRARIES distclean-compile distclean-kr \ - distclean-tags distclean-generic clean +distclean: distclean-noinstLIBRARIES distclean-compile distclean-tags \ + distclean-generic clean rm -f config.status maintainer-clean: maintainer-clean-noinstLIBRARIES \ - maintainer-clean-compile maintainer-clean-kr \ - maintainer-clean-tags maintainer-clean-generic \ - distclean + maintainer-clean-compile maintainer-clean-tags \ + maintainer-clean-generic distclean @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." .PHONY: default mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \ clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \ mostlyclean-compile distclean-compile clean-compile \ -maintainer-clean-compile mostlyclean-kr distclean-kr clean-kr \ -maintainer-clean-kr uninstall-iduDATA install-iduDATA tags \ -mostlyclean-tags distclean-tags clean-tags maintainer-clean-tags \ -distdir info dvi check installcheck install-exec install-data install \ -uninstall all installdirs mostlyclean-generic distclean-generic \ -clean-generic maintainer-clean-generic clean mostlyclean distclean \ -maintainer-clean +maintainer-clean-compile tags mostlyclean-tags distclean-tags \ +clean-tags maintainer-clean-tags distdir info dvi check installcheck \ +install-exec install-data install uninstall all installdirs \ +mostlyclean-generic distclean-generic clean-generic \ +maintainer-clean-generic clean mostlyclean distclean maintainer-clean .SUFFIXES: -.SUFFIXES: .c .o ._c ._o +.SUFFIXES: .c .o # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/lib/basename.c b/lib/basename.c index e474866..22d3edd 100644 --- a/lib/basename.c +++ b/lib/basename.c @@ -1,32 +1,34 @@ /* basename.c -- return the last element in a path - Copyright (C) 1994 Free Software Foundation, Inc. - This file is part of the Linux C Library. - -The Linux C Library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. - -The Linux C Library 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 -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ + Copyright (C) 1996 Free Software Foundation, Inc. + + This program 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 2, or (at your option) + any later version. + + This program 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 this program; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif #include <ansidecl.h> -#include <string.h> +#include "xstring.h" /* Return NAME with any leading path stripped off. */ -CONST char * +char * DEFUN(basename, (name), CONST char *name) { char *base; base = strrchr (name, '/'); - return base ? base + 1 : name; + return base ? base + 1 : (char *) name; } diff --git a/lib/dirname.c b/lib/dirname.c index 09f82aa..17439e8 100644 --- a/lib/dirname.c +++ b/lib/dirname.c @@ -16,14 +16,15 @@ License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <ansidecl.h> -#include <string.h> +#ifdef HAVE_CONFIG_H #include <config.h> -#include "strxtra.h" +#endif +#include <ansidecl.h> +#include "xstring.h" /* Return NAME with any leading path stripped off. */ -CONST char * +char * DEFUN(dirname, (name), CONST char *name) { char *base; diff --git a/lib/error.c b/lib/error.c index 797b697..42e2c6c 100644 --- a/lib/error.c +++ b/lib/error.c @@ -17,11 +17,14 @@ /* Written by David MacKenzie <djm@gnu.ai.mit.edu>. */ +#define sys_errlist sidestep_sys_errlist_declaration + #ifdef HAVE_CONFIG_H #include <config.h> #endif #include <stdio.h> +#include <errno.h> #if HAVE_VPRINTF || HAVE_DOPRNT || _LIBC # if __STDC__ @@ -68,9 +71,8 @@ static char * private_strerror (errnum) int errnum; { -#if !HAVE_DECL_SYS_ERRLIST +#undef sys_errlist extern char *sys_errlist[]; -#endif extern int sys_nerr; if (errnum > 0 && errnum <= sys_nerr) diff --git a/lib/obstack.c b/lib/obstack.c index f0df0d7..a5ffe9f 100644 --- a/lib/obstack.c +++ b/lib/obstack.c @@ -1,5 +1,5 @@ /* obstack.c - subroutines used implicitly by object stack macros - Copyright (C) 1988, 89, 90, 91, 92, 93, 94 Free Software Foundation, Inc. + Copyright (C) 1988,89,90,91,92,93,94,96 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,29 +17,33 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "obstack.h" -/* This is just to get __GNU_LIBRARY__ defined. */ -#include <stdio.h> +/* NOTE BEFORE MODIFYING THIS FILE: This version number must be + incremented whenever callers compiled using an old obstack.h can no + longer properly call the functions in this obstack.c. */ +#define OBSTACK_INTERFACE_VERSION 1 /* Comment out all this code if we are using the GNU C Library, and are not - actually compiling the library itself. This code is part of the GNU C - Library, but also included in many other GNU distributions. Compiling + actually compiling the library itself, and the installed library + supports the same library interface we do. This code is part of the GNU + C Library, but also included in many other GNU distributions. Compiling and linking in this code is a waste when using the GNU C library (especially if it is a shared library). Rather than having every GNU - program understand `configure --with-gnu-libc' and omit the object files, - it is simpler to just do this in the source for each such file. */ + program understand `configure --with-gnu-libc' and omit the object + files, it is simpler to just do this in the source for each such file. */ + +#include <stdio.h> /* Random thing to get __GNU_LIBRARY__. */ +#if !defined (_LIBC) && defined (__GNU_LIBRARY__) && __GNU_LIBRARY__ > 1 +#include <gnu-versions.h> +#if _GNU_OBSTACK_INTERFACE_VERSION == OBSTACK_INTERFACE_VERSION +#define ELIDE_CODE +#endif +#endif + -/* CYGNUS LOCAL. No, don't comment the code out. We will be using - ../include/obstack.h, which was changed relatively recently in a - way that is not binary compatible. Until we feel confident that - nobody is using the old obstack.c code, force the use of this code. - This issue will arise anytime a change is made which is not binary - compatible. -#if defined (_LIBC) || !defined (__GNU_LIBRARY__) -*/ -#if 1 +#ifndef ELIDE_CODE -#if __STDC__ +#if defined (__STDC__) && __STDC__ #define POINTER void * #else #define POINTER char * @@ -77,14 +81,14 @@ struct obstack *_obstack; #define CALL_CHUNKFUN(h, size) \ (((h) -> use_extra_arg) \ ? (*(h)->chunkfun) ((h)->extra_arg, (size)) \ - : (*(h)->chunkfun) ((size))) + : (*(struct _obstack_chunk *(*) ()) (h)->chunkfun) ((size))) #define CALL_FREEFUN(h, old_chunk) \ do { \ if ((h) -> use_extra_arg) \ (*(h)->freefun) ((h)->extra_arg, (old_chunk)); \ else \ - (*(h)->freefun) ((old_chunk)); \ + (*(void (*) ()) (h)->freefun) ((old_chunk)); \ } while (0) @@ -275,7 +279,7 @@ _obstack_newchunk (h, length) This is here for debugging. If you use it in a program, you are probably losing. */ -#if __STDC__ +#if defined (__STDC__) && __STDC__ /* Suppress -Wmissing-prototypes warning. We don't want to declare this in obstack.h because it is just for debugging. */ int _obstack_allocated_p (struct obstack *h, POINTER obj); @@ -382,7 +386,7 @@ obstack_free (h, obj) /* Now define the functional versions of the obstack macros. Define them to simply use the corresponding macros to do the job. */ -#if __STDC__ +#if defined (__STDC__) && __STDC__ /* These function definitions do not work with non-ANSI preprocessors; they won't pass through the macro names in parentheses. */ @@ -490,4 +494,4 @@ POINTER (obstack_copy0) (obstack, pointer, length) #endif /* 0 */ -#endif /* _LIBC or not __GNU_LIBRARY__. */ +#endif /* !ELIDE_CODE */ diff --git a/lib/obstack.h b/lib/obstack.h index 40793ca..886d59d 100644 --- a/lib/obstack.h +++ b/lib/obstack.h @@ -1,5 +1,5 @@ /* obstack.h - object stack macros - Copyright (C) 1988, 89, 90, 91, 92, 93, 94 Free Software Foundation, Inc. + Copyright (C) 1988,89,90,91,92,93,94,96 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -107,6 +107,30 @@ Summary: because on word-addressable machines a simple cast to int may ignore the byte-within-word field of the pointer. */ +#if HAVE_CONFIG_H +# include <config.h> +#endif + +#if HAVE_STRING_H || STDC_HEADERS +#include <string.h> + +#ifndef bcmp +#define bcmp(s1, s2, n) memcmp ((s1), (s2), (n)) +#endif + +#ifndef bcopy +#define bcopy(s, d, n) memcpy ((d), (s), (n)) +#endif + +#ifndef bzero +#define bzero(s, n) memset ((s), 0, (n)) +#endif + +#else /* HAVE_STRING_H || STDC_HEADERS */ +#include <strings.h> +#endif /* not (HAVE_STRING_H || STDC_HEADERS) */ + + #ifndef __PTR_TO_INT #define __PTR_TO_INT(P) ((P) - (char *)0) #endif @@ -119,7 +143,7 @@ Summary: but in traditional C it is usually long. If we are in ANSI C and don't already have ptrdiff_t get it. */ -#if __STDC__ && ! defined (offsetof) +#if defined (__STDC__) && __STDC__ && ! defined (offsetof) #if defined (__GNUC__) && defined (IN_GCC) /* On Next machine, the system's stddef.h screws up if included after we have defined just ptrdiff_t, so include all of stddef.h. @@ -138,7 +162,7 @@ Summary: # define ptrdiff_t off_t #endif -#if __STDC__ +#if defined (__STDC__) && __STDC__ #define PTR_INT_TYPE ptrdiff_t #else #define PTR_INT_TYPE long @@ -160,9 +184,18 @@ struct obstack /* control current object in current chunk */ char *chunk_limit; /* address of char after current chunk */ PTR_INT_TYPE temp; /* Temporary for some macros. */ int alignment_mask; /* Mask of alignment for each object. */ +#if defined (__STDC__) && __STDC__ + /* These prototypes vary based on `use_extra_arg', and we use + casts to the prototypeless function type in all assignments, + but having prototypes here quiets -Wstrict-prototypes. */ + struct _obstack_chunk *(*chunkfun) (void *, long); + void (*freefun) (void *, struct _obstack_chunk *); + void *extra_arg; /* first arg for chunk alloc/dealloc funcs */ +#else struct _obstack_chunk *(*chunkfun) (); /* User's fcn to allocate a chunk. */ void (*freefun) (); /* User's function to free a chunk. */ char *extra_arg; /* first arg for chunk alloc/dealloc funcs */ +#endif unsigned use_extra_arg:1; /* chunk alloc/dealloc funcs take extra arg */ unsigned maybe_empty_object:1;/* There is a possibility that the current chunk contains a zero-length object. This @@ -173,13 +206,14 @@ struct obstack /* control current object in current chunk */ /* Declare the external functions we use; they are in obstack.c. */ -#if __STDC__ +#if defined (__STDC__) && __STDC__ extern void _obstack_newchunk (struct obstack *, int); extern void _obstack_free (struct obstack *, void *); extern int _obstack_begin (struct obstack *, int, int, - void *(*) (), void (*) ()); + void *(*) (long), void (*) (void *)); extern int _obstack_begin_1 (struct obstack *, int, int, - void *(*) (), void (*) (), void *); + void *(*) (void *, long), + void (*) (void *, void *), void *); #else extern void _obstack_newchunk (); extern void _obstack_free (); @@ -187,7 +221,7 @@ extern int _obstack_begin (); extern int _obstack_begin_1 (); #endif -#if __STDC__ +#if defined (__STDC__) && __STDC__ /* Do the function-declarations after the structs but before defining the macros. */ @@ -248,6 +282,34 @@ int obstack_chunk_size (struct obstack *obstack); #define obstack_alignment_mask(h) ((h)->alignment_mask) +/* To prevent prototype warnings provide complete argument list in + standard C version. */ +#if defined (__STDC__) && __STDC__ + +#define obstack_init(h) \ + _obstack_begin ((h), 0, 0, \ + (void *(*) (long)) obstack_chunk_alloc, (void (*) (void *)) obstack_chunk_free) + +#define obstack_begin(h, size) \ + _obstack_begin ((h), (size), 0, \ + (void *(*) (long)) obstack_chunk_alloc, (void (*) (void *)) obstack_chunk_free) + +#define obstack_specify_allocation(h, size, alignment, chunkfun, freefun) \ + _obstack_begin ((h), (size), (alignment), \ + (void *(*) (long)) (chunkfun), (void (*) (void *)) (freefun)) + +#define obstack_specify_allocation_with_arg(h, size, alignment, chunkfun, freefun, arg) \ + _obstack_begin_1 ((h), (size), (alignment), \ + (void *(*) (long)) (chunkfun), (void (*) (void *)) (freefun), (arg)) + +#define obstack_chunkfun(h, newchunkfun) \ + ((h) -> chunkfun = (struct _obstack_chunk *(*)(long)) (newchunkfun)) + +#define obstack_freefun(h, newfreefun) \ + ((h) -> freefun = (void (*)(void *)) (newfreefun)) + +#else + #define obstack_init(h) \ _obstack_begin ((h), 0, 0, \ (void *(*) ()) obstack_chunk_alloc, (void (*) ()) obstack_chunk_free) @@ -270,12 +332,17 @@ int obstack_chunk_size (struct obstack *obstack); #define obstack_freefun(h, newfreefun) \ ((h) -> freefun = (void (*)()) (newfreefun)) +#endif + #define obstack_1grow_fast(h,achar) (*((h)->next_free)++ = achar) #define obstack_blank_fast(h,n) ((h)->next_free += (n)) -#if defined (__GNUC__) && __STDC__ -#if __GNUC__ < 2 +#if defined (__GNUC__) && defined (__STDC__) && __STDC__ +/* NextStep 2.0 cc is really gcc 1.93 but it defines __GNUC__ = 2 and + does not implement __extension__. But that compiler doesn't define + __GNUC_MINOR__. */ +#if __GNUC__ < 2 || (__NeXT__ && !__GNUC_MINOR__) #define __extension__ #endif @@ -303,7 +370,7 @@ __extension__ \ _obstack_newchunk (__o, __len); \ if (!__o->alloc_failed) \ { \ - bcopy (where, __o->next_free, __len); \ + bcopy ((char *) (where), __o->next_free, __len); \ __o->next_free += __len; \ } \ (void) 0; }) @@ -316,7 +383,7 @@ __extension__ \ _obstack_newchunk (__o, __len + 1); \ if (!__o->alloc_failed) \ { \ - bcopy (where, __o->next_free, __len); \ + bcopy ((char *) (where), __o->next_free, __len); \ __o->next_free += __len; \ *(__o->next_free)++ = 0; \ } \ @@ -334,7 +401,7 @@ __extension__ \ /* These assume that the obstack alignment is good enough for pointers or ints, and that the data added so far to the current object shares that much alignment. */ - + #define obstack_ptr_grow(OBSTACK,datum) \ __extension__ \ ({ struct obstack *__o = (OBSTACK); \ @@ -434,7 +501,7 @@ __extension__ \ (((h)->next_free + (h)->temp > (h)->chunk_limit) \ ? (_obstack_newchunk ((h), (h)->temp), 0) : 0), \ ((h)->alloc_failed ? 0 : \ - (bcopy (where, (h)->next_free, (h)->temp), \ + (bcopy ((char *) (where), (h)->next_free, (h)->temp), \ (h)->next_free += (h)->temp))) #define obstack_grow0(h,where,length) \ @@ -442,7 +509,7 @@ __extension__ \ (((h)->next_free + (h)->temp + 1 > (h)->chunk_limit) \ ? (_obstack_newchunk ((h), (h)->temp + 1), 0) : 0), \ ((h)->alloc_failed ? 0 : \ - (bcopy (where, (h)->next_free, (h)->temp), \ + (bcopy ((char *) (where), (h)->next_free, (h)->temp), \ (h)->next_free += (h)->temp, \ *((h)->next_free)++ = 0))) @@ -498,7 +565,7 @@ __extension__ \ (h)->object_base = (h)->next_free, \ __INT_TO_PTR ((h)->temp))) -#if __STDC__ +#if defined (__STDC__) && __STDC__ #define obstack_free(h,obj) \ ( (h)->temp = (char *)(obj) - (char *) (h)->chunk, \ (((h)->temp > 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\ diff --git a/lib/strndup.c b/lib/strndup.c index 556215d..1694d73 100644 --- a/lib/strndup.c +++ b/lib/strndup.c @@ -15,22 +15,22 @@ License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include <config.h> #include <ansidecl.h> -#include <stddef.h> -#include <stdlib.h> -#include <string.h> +#include "xstring.h" +#include "xmalloc.h" /* Duplicate S, returning an identical malloc'd string. */ char * -DEFUN(strndup, (s, n), CONST char *s AND size_t n) +DEFUN(strndup, (s, n), const char *s AND size_t n) { char *new = malloc(n + 1); if (new == NULL) return NULL; - memcpy (new, (PTR) s, n); + memcpy (new, s, n); new[n] = '\0'; return new; diff --git a/lib/xmalloc.h b/lib/xmalloc.h index 622b31b..8273276 100644 --- a/lib/xmalloc.h +++ b/lib/xmalloc.h @@ -1,12 +1,46 @@ +/* xmalloc.h -- malloc declarations wrapper + Copyright (C) 1996 Free Software Foundation, Inc. + + This program 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 2, or (at your option) + any later version. + + This program 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 this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + #ifndef _xmalloc_h_ #define _xmalloc_h_ 1 #include <sys/types.h> -#ifdef HAVE_CONFIG_H -#include <config.h> +#if HAVE_CONFIG_H +# include <config.h> +#endif +#if defined STDC_HEADERS || defined _LIBC || defined HAVE_STDLIB_H +# include <stdlib.h> #endif +#if HAVE_MALLOC_H +# include <malloc.h> +#else +void free (); +#endif + void *xmalloc __P((size_t n)); void *xrealloc __P((void *p, size_t n)); +#include "xstring.h" + +#define CALLOC(t, n) ((t *) calloc (sizeof (t), (n))) +#define MALLOC(t, n) ((t *) xmalloc (sizeof (t) * (n))) +#define REALLOC(o, t, n) ((t *) xrealloc ((o), sizeof (t) * (n))) +#define CLONE(o, t, n) ((t *) memcpy (MALLOC (t, (n)), (o), sizeof (t) * (n))) + #endif /* _xmalloc_h_ */ diff --git a/po/Makefile.in.in b/po/Makefile.in.in index fd45152..8ab5ee8 100644 --- a/po/Makefile.in.in +++ b/po/Makefile.in.in @@ -30,11 +30,12 @@ exec_prefix = @exec_prefix@ datadir = $(prefix)/@DATADIRNAME@ localedir = $(datadir)/locale gnulocaledir = $(prefix)/share/locale -gettextsrcdir = $(prefix)/share/gettext +gettextsrcdir = $(prefix)/share/gettext/po subdir = po INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ +MKINSTALLDIRS = @MKINSTALLDIRS@ CC = @CC@ GENCAT = @GENCAT@ @@ -87,14 +88,15 @@ INSTOBJEXT = @INSTOBJEXT@ all: all-@USE_NLS@ -all-yes all-gettext: cat-id-tbl.c @MAINT@$(CATALOGS) $(GMOFILES) +all-yes: cat-id-tbl.c $(CATALOGS) all-no: $(PACKAGE).pot: $(POTFILES) $(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \ --add-comments --keyword=_ --keyword=N_ \ --files-from=$(srcdir)/POTFILES.in - if cmp -s $(PACKAGE).po $(srcdir)/$(PACKAGE).pot; then \ + if [ ! -s $(PACKAGE).po ] \ + || cmp -s $(PACKAGE).po $(srcdir)/$(PACKAGE).pot; then \ rm -f $(PACKAGE).po; \ else \ rm -f $(srcdir)/$(PACKAGE).pot \ @@ -103,24 +105,30 @@ $(PACKAGE).pot: $(POTFILES) cat-id-tbl.c: stamp-cat-id stamp-cat-id: $(PACKAGE).pot - rm -f cat-id-tbl.tmp.c + rm -f cat-id-tbl.tmp sed -f ../intl/po2tbl.sed $(srcdir)/$(PACKAGE).pot \ - | sed -e "s/@PACKAGE NAME@/$(PACKAGE)/" > cat-id-tbl.tmp.c - if cmp -s cat-id-tbl.tmp.c $(srcdir)/cat-id-tbl.c; then \ - rm cat-id-tbl.tmp.c; \ + | sed -e "s/@PACKAGE NAME@/$(PACKAGE)/" > cat-id-tbl.tmp + if cmp -s cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; then \ + rm cat-id-tbl.tmp; \ else \ echo cat-id-tbl.c changed; \ rm -f $(srcdir)/cat-id-tbl.c; \ - mv cat-id-tbl.tmp.c $(srcdir)/cat-id-tbl.c; \ + mv cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; \ fi cd $(srcdir) && rm -f stamp-cat-id && echo timestamp > stamp-cat-id install: install-exec install-data install-exec: -install-data: all - $(top_srcdir)/mkinstalldirs $(datadir) - catalogs='$(CATALOGS)'; \ +install-data: install-data-@USE_NLS@ +install-data-no: all +install-data-yes: all + if test -r $(MKINSTALLDIRS); then \ + $(MKINSTALLDIRS) $(datadir); \ + else \ + $(top_srcdir)/mkinstalldirs $(datadir); \ + fi + @catalogs='$(CATALOGS)'; \ for cat in $$catalogs; do \ case "$$cat" in \ *.gmo) destdir=$(gnulocaledir);; \ @@ -128,28 +136,47 @@ install-data: all esac; \ lang=`echo $$cat | sed 's/$(CATOBJEXT)$$//'`; \ dir=$$destdir/$$lang/LC_MESSAGES; \ - $(top_srcdir)/mkinstalldirs $$dir; \ + if test -r $(MKINSTALLDIRS); then \ + $(MKINSTALLDIRS) $$dir; \ + else \ + $(top_srcdir)/mkinstalldirs $$dir; \ + fi; \ if test -r $$cat; then \ $(INSTALL_DATA) $$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \ + echo "installing $$cat as $$dir/$(PACKAGE)$(INSTOBJEXT)"; \ else \ $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \ + echo "installing $(srcdir)/$$cat as" \ + "$$dir/$(PACKAGE)$(INSTOBJEXT)"; \ fi; \ if test -r $$cat.m; then \ $(INSTALL_DATA) $$cat.m $$dir/$(PACKAGE)$(INSTOBJEXT).m; \ + echo "installing $$cat.m as $$dir/$(PACKAGE)$(INSTOBJEXT).m"; \ else \ if test -r $(srcdir)/$$cat.m ; then \ $(INSTALL_DATA) $(srcdir)/$$cat.m \ $$dir/$(PACKAGE)$(INSTOBJEXT).m; \ + echo "installing $(srcdir)/$$cat as" \ + "$$dir/$(PACKAGE)$(INSTOBJEXT).m"; \ + else \ + true; \ fi; \ fi; \ done + if test "$(PACKAGE)" = "gettext"; then \ + if test -r $(MKINSTALLDIRS); then \ + $(MKINSTALLDIRS) $(gettextsrcdir); \ + else \ + $(top_srcdir)/mkinstalldirs $(gettextsrcdir); \ + fi; \ + cd $(srcdir) && \ + $(INSTALL_DATA) Makefile.in.in $(gettextsrcdir)/Makefile.in.in; \ + else \ + : ; \ + fi -# This installation goal is only used in GNU gettext. Packages which -# only use the library should use install instead. -install-src: install - $(top_srcdir)/mkinstalldirs $(gettextsrcdir) - cd $(srcdir) && \ - $(INSTALL_DATA) Makefile.in.in $(gettextsrcdir)/po-Makefile.in.in +# Define this as empty until I found a useful application. +installcheck: uninstall: catalogs='$(CATALOGS)'; \ @@ -166,10 +193,10 @@ check: all cat-id-tbl.o: ../intl/libgettext.h -TAGS ID: +dvi info tags TAGS ID: mostlyclean: - rm -f core core.* *.pox $(PACKAGE).po *.old.po cat-id-tbl.tmp.c + rm -f core core.* *.pox $(PACKAGE).po *.old.po cat-id-tbl.tmp rm -fr *.o clean: mostlyclean @@ -181,9 +208,8 @@ maintainer-clean: distclean @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." -.PHONY: distdir distdir = ../$(PACKAGE)-$(VERSION)/$(subdir) -distdir dist-gettext: update-po $(DISTFILES) +dist distdir: update-po $(DISTFILES) for file in $(DISTFILES); do \ ln $(srcdir)/$$file $(distdir) 2> /dev/null \ || cp -p $(srcdir)/$$file $(distdir); \ diff --git a/po/POTFILES.in b/po/POTFILES.in index ece02b8..f69ccfc 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,9 +1,13 @@ +libidu/hash.c +libidu/idfile.c +libidu/idread.c +libidu/idwrite.c +libidu/scanners.c +libidu/walker.c +libidu/xnls.h +lib/getopt.c src/fid.c -src/mkid.c +src/fnid.c src/lid.c -src/idx.c -lib/filenames.c -lib/getopt.c -lib/idfile.c -lib/misc.c -lib/scanners.c +src/mkid.c +src/xtokid.c @@ -5,486 +5,604 @@ msgid "" msgstr "" "Project-Id-Version: GNU mkid 3.0.8\n" +"POT-Creation-Date: 1996-07-17 17:58-0400\n" "PO-Revision-Date: 1996-03-23 22:34 MET\n" -"POT-Creation-Date: 1996-05-30 17:22-0400\n" "Last-Translator: Karl Eichwalder <ke@ke.Central.DE>\n" "Language-Team: German <de@li.org>\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=ISO-8859-1\n" "Content-Transfer-Encoding: 8-bit\n" -#: src/fid.c:75 src/idx.c:43 src/lid.c:203 src/mkid.c:125 -#, possible-c-format -msgid "Try `%s --help' for more information.\n" +#: libidu/hash.c:52 +#, c-format +msgid "can't allocate %ld bytes for hash table: memory exhausted" msgstr "" -#: src/fid.c:83 -#, possible-c-format -msgid "Usage: %s [OPTION] FILENAME [FILENAME2]\n" -msgstr "" +#: libidu/hash.c:247 +#, fuzzy +msgid "Load=%ld/%ld=%.0f%%, " +msgstr "\"Load\"=%ld/%ld=%.2f, " -#: src/fid.c:86 -msgid "" -"List identifiers that occur in FILENAME, or if FILENAME2 is\n" -"also given list the identifiers that occur in both files.\n" -"\n" -" -f, --file=FILE file name of ID database\n" +#: libidu/hash.c:249 +#, c-format +msgid "Rehash=%d, " +msgstr "\"Rehash\"=%d, " + +#: libidu/hash.c:250 +msgid "Collisions=%ld/%ld=%.0f%%" msgstr "" -#: src/fid.c:135 src/lid.c:344 -msgid "can't locate `ID'" +#: libidu/idfile.c:106 +msgid "can't determine the io_size of a string!" msgstr "" -#: src/fid.c:152 -msgid "no file name arguments" +#: libidu/idread.c:45 src/mkid.c:386 src/xtokid.c:213 +#, c-format +msgid "can't open `%s'" msgstr "" -#: src/fid.c:157 -msgid "too many file name arguments" +#: libidu/idread.c:64 +#, c-format +msgid "`%s' is not an ID file! (bad magic #)" msgstr "" -#: src/fid.c:221 -#, possible-c-format -msgid "`%s' is ambiguous" +#: libidu/idread.c:66 +#, c-format +msgid "`%s' is version %d, but I only grok version %d" msgstr "" -#: src/fid.c:227 -#, fuzzy, possible-c-format -msgid "`%s' not found" -msgstr "%s: nicht gefunden\n" +#: libidu/idread.c:186 +#, fuzzy, c-format +msgid "unsupported size in io_read (): %d" +msgstr "Nicht unterstützte Größe (`size') in \"io_read ()\": %d" -#: src/idx.c:59 src/mkid.c:148 -#, possible-c-format -msgid "Usage: %s [OPTION]... [FILE]...\n" +#: libidu/idread.c:194 libidu/idwrite.c:167 +#, c-format +msgid "unknown I/O type: %d" msgstr "" -#: src/mkid.c:152 -msgid "" -"Build an identifier database.\n" -" -o, --output=OUTFILE file name of ID database output\n" -" -f, --file=OUTFILE synonym for --output\n" -" -i, --include=LANGS include languages in LANGS (default: \"C C++ asm\")\n" -" -x, --exclude=LANGS exclude languages in LANGS\n" -" -l, --lang-arg=LANG:ARG pass ARG as a default for LANG (see below)\n" -" -m, --lang-map=MAPFILE use MAPFILE to map file names onto source language\n" -" -v, --verbose report progress and as files are scanned\n" -" -s, --statistics report statistics at end of run\n" -"\n" -" --help display this help and exit\n" -" --version output version information and exit\n" -"\n" -"FILE may be a file name, or a directory name to recursively search.\n" -"The `--include' and `--exclude' options are mutually-exclusive.\n" -"\n" -"The following arguments apply to the language-specific scanners:\n" -msgstr "" +#: libidu/idwrite.c:156 +#, fuzzy, c-format +msgid "unsupported size in io_write (): %d" +msgstr "Nicht unterstützte Größe (`size') in \"io_write ()\": %d" -#: src/mkid.c:284 -#, possible-c-format -msgid "can't create `%s' in `%s'" -msgstr "" +#: libidu/scanners.c:93 +#, fuzzy, c-format +msgid "unrecognized language: `%s'" +msgstr "Kein Scanner für die Sprache '%s'" -#: src/mkid.c:288 -#, possible-c-format -msgid "can't modify `%s'" +#: libidu/scanners.c:139 +msgid "can't allocate language args obstack: memory exhausted" msgstr "" -#: src/mkid.c:335 -#, possible-c-format -msgid "can't stat `%s'" +#: libidu/scanners.c:193 libidu/scanners.c:262 +msgid "can't allocate language args: memory exhausted" msgstr "" -#: src/mkid.c:400 -#, fuzzy, possible-c-format -msgid " new = %d/%d" -msgstr ", new=%d/%d" - -#: src/mkid.c:409 -#, possible-c-format -msgid "Name=%ld, " -msgstr "Name=%ld, " - -#: src/mkid.c:410 -#, possible-c-format -msgid "Number=%ld, " -msgstr "Zahl=%ld, " - -#: src/mkid.c:411 -#, possible-c-format -msgid "String=%ld, " -msgstr "Zeichenkette=%ld, " - -# ist das gemeint? ### -#: src/mkid.c:412 -#, possible-c-format -msgid "Literal=%ld, " -msgstr "Zeichen=%ld, " - -#: src/mkid.c:413 -#, possible-c-format -msgid "Comment=%ld\n" -msgstr "Kommentar=%ld\n" - -#: src/mkid.c:415 -#, possible-c-format -msgid "Files=%d, " -msgstr "Dateien=%d, " +#: libidu/scanners.c:201 +#, c-format +msgid "language name expected following `%s' in file `%s'" +msgstr "" -#: src/mkid.c:416 -#, possible-c-format -msgid "Tokens=%ld, " -msgstr "Tokens=%ld, " +#: libidu/scanners.c:256 +#, fuzzy, c-format +msgid "can't open language map file `%s'" +msgstr "Kein Scanner für die Sprache '%s'" -#: src/mkid.c:417 -#, possible-c-format -msgid "Bytes=%ld Kb, " -msgstr "Bytes=%ld Kb, " +#: libidu/scanners.c:258 +#, c-format +msgid "can't get size of map file `%s'" +msgstr "" -#: src/mkid.c:418 -#, fuzzy, possible-c-format -msgid "Heap=%ld+%ld Kb, " -msgstr "\"Heap\"=%ld Kb, " +#: libidu/scanners.c:268 +#, fuzzy, c-format +msgid "can't read language map file `%s'" +msgstr "Kein Scanner für die Sprache '%s'" -#: src/mkid.c:420 -#, possible-c-format -msgid "Output=%ld (%ld tok, %ld hit)\n" -msgstr "Ausgabe=%ld (%ld tok, %ld hit)\n" +#: libidu/scanners.c:271 +#, c-format +msgid "can't read entire language map file `%s'" +msgstr "" -# Frequenz übersetzen? ke -#: src/mkid.c:423 -#, fuzzy, possible-c-format -msgid ", Freq=%ld/%ld=%.2f\n" -msgstr "\"Freq\"=%ld/%ld=%.2f\n" +#: libidu/scanners.c:412 +msgid "" +"C language:\n" +" -k,--keep=CHARS Allow CHARS in single-token strings, keep the " +"result\n" +" -i,--ignore=CHARS Allow CHARS in single-token strings, toss the " +"result\n" +" -u,--strip-underscore Strip a leading underscore from single-token " +"strings\n" +msgstr "" -#: src/mkid.c:446 -msgid "Sorting tokens...\n" -msgstr "Sortiere \"Token\"...\n" +#: libidu/scanners.c:681 libidu/scanners.c:986 libidu/scanners.c:1190 +#, c-format +msgid "junk: `%c'" +msgstr "\"junk\": '%c'" -#: src/mkid.c:452 -#, possible-c-format -msgid "Writing `%s'...\n" -msgstr "Schreibe '%s'...\n" +#: libidu/scanners.c:683 libidu/scanners.c:988 libidu/scanners.c:1192 +#, c-format +msgid "junk: `\\%03o'" +msgstr "\"junk\": '\\%03o'" -#: src/mkid.c:455 -#, possible-c-format -msgid "can't create `%s'" +#: libidu/scanners.c:787 +msgid "" +"Assembly language:\n" +" -c,--comment=CHARS Any of CHARS starts a comment until end-of-line\n" +" -k,--keep=CHARS Allow CHARS in tokens, and keep the result\n" +" -i,--ignore=CHARS Allow CHARS in tokens, and toss the result\n" +" -u,--strip-underscore Strip a leading underscore from tokens\n" +" -n,--no-cpp Don't handle C pre-processor directives\n" msgstr "" -#: src/mkid.c:601 -#, fuzzy -msgid "level %d: %ld/%ld = %.0f%%\n" -msgstr "level %d: %ld == %ld\n" +#: libidu/scanners.c:1092 +msgid "" +"Text language:\n" +" -i,--include=CHAR-CLASS Treat characters of CHAR-CLASS as token " +"constituents\n" +" -x,--exclude=CHAR-CLASS Treat characters of CHAR-CLASS as token " +"delimiters\n" +msgstr "" -#: src/lid.c:211 -#, possible-c-format -msgid "Usage: %s [OPTION]... PATTERN...\n" +#: libidu/walker.c:103 +#, c-format +msgid "can't read directory `%s' (`.' from `%s')" msgstr "" -#: src/lid.c:214 -msgid "" -"Query ID database and report results.\n" -"By default, output consists of multiple lines, each line containing the\n" -"matched identifier followed by the list of file names in which it occurs.\n" -"\n" -" -f, --file=FILE file name of ID database\n" -" -G, --grep show every line where the matched identifier occurs\n" -" -E, --edit edit every file where the matched identifier occurs\n" -" -m, --merge output a multi-line regexp match as a single line\n" -" -n, --no-id print file names only - omit the identifier\n" -" -b, --braces toggle shell brace-notation for output file names\n" -"\n" -"If PATTERN contains regular expression metacharacters, it is interpreted\n" -"as a regular expression. Otherwise, PATTERN is interpreted as a literal\n" -"word.\n" -"\n" -" -e, --regexp match PATTERN as a regular expression substring\n" -" -w, --word match PATTERN as a word\n" -" -i, --ignore-case match PATTERN case insinsitively\n" -" -A, --apropos match PATTERN as a case-insensitive substring\n" -"\n" -" -F, --frequency=FREQ find identifiers that occur FREQ times, where FREQ\n" -" is a range expressed as `N..M'. N omitted defaults\n" -" to 1, M omitted defaults to MAX_USHRT.\n" -" -a, --ambiguous=LEN find identifiers whose names are ambiguous for LEN chars\n" -"\n" -" -x, --hex only find numbers expressed as hexadecimal\n" -" -d, --decimal only find numbers expressed as decimal\n" -" -o, --octal only find numbers expressed as octal\n" -"\n" -" --help display this help and exit\n" -" --version output version information and exit\n" +#: libidu/walker.c:170 +#, c-format +msgid "notice: `%s' was a %s, but is now a %s!" msgstr "" -#: src/lid.c:398 -#, fuzzy, possible-c-format -msgid "All identifiers are non-ambiguous within the first %d characters\n" -msgstr "Alle Bezeichner (id's) sind verschieden hinsichtlich der ersten %d Zeichen\n" +#: libidu/walker.c:171 libidu/walker.c:172 +msgid "file" +msgstr "" -#: src/lid.c:404 -#, possible-c-format -msgid "%s: not found\n" -msgstr "%s: nicht gefunden\n" +#: libidu/walker.c:171 libidu/walker.c:172 +msgid "directory" +msgstr "" -# Muss hier auf `_j_ ... / nq' umgestellt werden???? -#. FIXME: i18n -#: src/lid.c:571 -msgid "Edit? [y1-9^S/nq] " -msgstr "Editieren? [y1-9^S/nq] " +#: libidu/walker.c:291 +#, c-format +msgid "warning: `%s' and `%s' are the same file, but yield different scans!" +msgstr "" -#: src/lid.c:642 -msgid "can't fork" +#: libidu/walker.c:385 +#, c-format +msgid "notice: scan parameters changed for `%s'" msgstr "" -#: src/lid.c:664 -#, possible-c-format -msgid "can't exec `%s'" +#: libidu/walker.c:580 +#, fuzzy +msgid "can't get working directory" +msgstr "%s: Name des aktuellen Verzeichnisses nicht zu erreichen." + +#: libidu/walker.c:637 +#, c-format +msgid "can't chdir to `%s'" msgstr "" -#: src/lid.c:785 -msgid "can't match regular-expression: memory exhausted" +#: libidu/walker.c:642 +#, c-format +msgid "can't chdir to `%s' from `%s'" msgstr "" -#: src/idx.c:63 -msgid "" -"Print all tokens found in a source file.\n" -" -m, --lang-map=FILE use FILE to file names onto source language\n" -" --help display this help and exit\n" -" --version output version information and exit\n" -"\n" -"The following arguments apply to the language-specific scanners:\n" +#: libidu/walker.c:696 +#, c-format +msgid "can't lstat `%s' from `%s'" msgstr "" -#: lib/filenames.c:367 lib/idfile.c:46 -#, possible-c-format -msgid "can't open `%s'" +#: libidu/walker.c:704 +#, c-format +msgid "can't stat `%s' from `%s'" msgstr "" #: lib/getopt.c:527 -#, possible-c-format +#, c-format msgid "%s: option `%s' is ambiguous\n" msgstr "" #: lib/getopt.c:550 -#, possible-c-format +#, c-format msgid "%s: option `--%s' doesn't allow an argument\n" msgstr "" #: lib/getopt.c:555 -#, possible-c-format +#, c-format msgid "%s: option `%c%s' doesn't allow an argument\n" msgstr "" #: lib/getopt.c:570 -#, possible-c-format +#, c-format msgid "%s: option `%s' requires an argument\n" msgstr "" #. --option #: lib/getopt.c:598 -#, possible-c-format +#, c-format msgid "%s: unrecognized option `--%s'\n" msgstr "" #. +option or -option #: lib/getopt.c:602 -#, possible-c-format +#, c-format msgid "%s: unrecognized option `%c%s'\n" msgstr "" #. 1003.2 specifies the format of this message. #: lib/getopt.c:627 -#, possible-c-format +#, c-format msgid "%s: illegal option -- %c\n" msgstr "" #: lib/getopt.c:630 -#, possible-c-format +#, c-format msgid "%s: invalid option -- %c\n" msgstr "" #: lib/getopt.c:666 -#, possible-c-format +#, c-format msgid "%s: option requires an argument -- %c\n" msgstr "" -#: lib/idfile.c:65 -#, possible-c-format -msgid "`%s' is not an ID file! (bad magic #)" +#: src/fid.c:70 src/fnid.c:49 src/lid.c:237 src/mkid.c:120 src/xtokid.c:42 +#, c-format +msgid "Try `%s --help' for more information.\n" msgstr "" -#: lib/idfile.c:67 -#, possible-c-format -msgid "`%s' is version %d, but I only grok version %d" +#: src/fid.c:78 +#, c-format +msgid "Usage: %s [OPTION] FILENAME [FILENAME2]\n" msgstr "" -#: lib/idfile.c:97 -msgid "can't determine the io_size of a string!" +#: src/fid.c:81 +msgid "" +"List identifiers that occur in FILENAME, or if FILENAME2 is\n" +"also given list the identifiers that occur in both files.\n" +"\n" +" -f, --file=FILE file name of ID database\n" +" --help display this help and exit\n" +" --version output version information and exit\n" msgstr "" -#: lib/idfile.c:146 lib/idfile.c:185 -#, fuzzy, possible-c-format -msgid "unsupported size in io_write (): %d\n" -msgstr "Nicht unterstützte Größe (`size') in \"io_write ()\": %d\n" +#: src/fid.c:141 +msgid "no file name arguments" +msgstr "" -#: lib/idfile.c:155 lib/idfile.c:195 -#, possible-c-format -msgid "unknown I/O type: %d" +#: src/fid.c:146 +msgid "too many file name arguments" +msgstr "" + +#: src/fid.c:153 src/fnid.c:147 src/lid.c:410 +msgid "can't locate `ID'" msgstr "" -#: lib/scanners.c:89 -#, fuzzy, possible-c-format -msgid "unrecognized language: `%s'\n" -msgstr "Kein Scanner für die Sprache '%s'\n" +#: src/fid.c:235 +#, c-format +msgid "`%s' is ambiguous" +msgstr "" -#: lib/scanners.c:130 -msgid "can't allocate language args obstack: memory exhausted" +#: src/fid.c:241 +#, fuzzy, c-format +msgid "`%s' not found" +msgstr "%s: nicht gefunden" + +#: src/fnid.c:66 +#, c-format +msgid "Usage: %s [OPTION]... [PATTERN]...\n" msgstr "" -#: lib/scanners.c:184 lib/scanners.c:252 -msgid "can't allocate language args: memory exhausted" +#: src/fnid.c:70 +msgid "" +"Print constituent file names that match PATTERN,\n" +"using shell-style wildcards.\n" +" -f, --file=FILE file name of ID database\n" +" -S, --separator=STYLE STYLE is one of `braces', `space' or `newline'\n" +" --help display this help and exit\n" +" --version output version information and exit\n" msgstr "" -#: lib/scanners.c:191 -#, possible-c-format -msgid "language name expected following `%s' in file `%s'" +#: src/lid.c:245 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN...\n" msgstr "" -#: lib/scanners.c:246 -#, fuzzy, possible-c-format -msgid "can't open language map file `%s'" -msgstr "Kein Scanner für die Sprache '%s'\n" +#: src/lid.c:249 +#, c-format +msgid "" +"Query ID database and report results.\n" +"By default, output consists of multiple lines, each line containing the\n" +"matched identifier followed by the list of file names in which it occurs.\n" +"\n" +" -f, --file=FILE file name of ID database\n" +"\n" +" -i, --ignore-case match PATTERN case insensitively\n" +" -l, --literal match PATTERN as a literal string\n" +" -r, --regexp match PATTERN as a regular expression\n" +" -w, --word match PATTERN as a delimited word\n" +" -s, --substring match PATTERN as a substring\n" +" Note: If PATTERN contains extended regular expression meta-\n" +" characters, it is interpreted as a regular expression " +"substring.\n" +" Otherwise, PATTERN is interpreted as a literal word.\n" +"\n" +" -k, --key=STYLE STYLE is one of `token', `pattern' or `none'\n" +" -R, --result=STYLE STYLE is one of `filenames', `grep', `edit' or " +"`none'\n" +" -S, --separator=STYLE STYLE is one of `braces', `space' or `newline' and\n" +" only applies to file names when " +"`--result=filenames'\n" +" The above STYLE options control how query results are " +"presented.\n" +" Defaults are --key=token --result=filenames --separator=%s\n" +"\n" +" -F, --frequency=FREQ find tokens that occur FREQ times, where FREQ\n" +" is a range expressed as `N..M'. If N is omitted, " +"it\n" +" defaults to 1, if M is omitted it defaults to " +"MAX_USHRT\n" +" -a, --ambiguous=LEN find tokens whose names are ambiguous for LEN chars\n" +"\n" +" -x, --hex only find numbers expressed as hexadecimal\n" +" -d, --decimal only find numbers expressed as decimal\n" +" -o, --octal only find numbers expressed as octal\n" +" By default, searches match numbers of any radix.\n" +"\n" +" --help display this help and exit\n" +" --version output version information and exit\n" +msgstr "" -#: lib/scanners.c:248 -#, possible-c-format -msgid "can't get size of map file `%s'" +#: src/lid.c:285 +msgid "braces" msgstr "" -#: lib/scanners.c:258 -#, fuzzy, possible-c-format -msgid "can't read language map file `%s'" -msgstr "Kein Scanner für die Sprache '%s'\n" +#: src/lid.c:285 +msgid "space" +msgstr "" -#: lib/scanners.c:261 -#, possible-c-format -msgid "can't read entire language map file `%s'" +#: src/lid.c:351 +msgid "notice: use of `-e' is deprecated, use `-r' instead" msgstr "" -#: lib/scanners.c:402 -msgid "" -"C language:\n" -" -k,--keep=CHARS Allow CHARS in single-token strings, keep the result\n" -" -i,--ignore=CHARS Allow CHARS in single-token strings, toss the result\n" -" -u,--strip-underscore Strip a leading underscore from single-token strings\n" +#: src/lid.c:431 +#, fuzzy, c-format +msgid "All identifiers are non-ambiguous within the first %d characters\n" msgstr "" +"Alle Bezeichner (id's) sind verschieden hinsichtlich der ersten %d Zeichen\n" -#: lib/scanners.c:671 lib/scanners.c:975 lib/scanners.c:1179 -#, possible-c-format -msgid "junk: `%c'" -msgstr "\"junk\": '%c'" +#: src/lid.c:466 +#, c-format +msgid "invalid `--key' style: `%s'" +msgstr "" -#: lib/scanners.c:673 lib/scanners.c:977 lib/scanners.c:1181 -#, possible-c-format -msgid "junk: `\\%03o'" -msgstr "\"junk\": '\\%03o'" +#: src/lid.c:478 +#, c-format +msgid "invalid `--result' style: `%s'" +msgstr "" + +# Muss hier auf `_j_ ... / nq' umgestellt werden???? +#. FIXME: i18n of responses +#: src/lid.c:634 +#, fuzzy +msgid "edit? [y1-9^S/nq] " +msgstr "Editieren? [y1-9^S/nq] " + +#: src/lid.c:703 +msgid "can't fork" +msgstr "" -#: lib/scanners.c:777 +#: src/lid.c:721 +#, c-format +msgid "can't exec `%s'" +msgstr "" + +#: src/lid.c:851 +msgid "can't match regular-expression: memory exhausted" +msgstr "" + +#: src/mkid.c:145 src/xtokid.c:63 +#, c-format +msgid "Usage: %s [OPTION]... [FILE]...\n" +msgstr "" + +#: src/mkid.c:149 msgid "" -"Assembly language:\n" -" -c,--comment=CHARS Any of CHARS starts a comment until end-of-line\n" -" -k,--keep=CHARS Allow CHARS in tokens, and keep the result\n" -" -i,--ignore=CHARS Allow CHARS in tokens, and toss the result\n" -" -u,--strip-underscore Strip a leading underscore from tokens\n" -" -n,--no-cpp Don't handle C pre-processor directives\n" +"Build an identifier database.\n" +" -o, --output=OUTFILE file name of ID database output\n" +" -f, --file=OUTFILE synonym for --output\n" +" -i, --include=LANGS include languages in LANGS (default: \"C C++ " +"asm\")\n" +" -x, --exclude=LANGS exclude languages in LANGS\n" +" -l, --lang-option=L:OPT pass OPT as a default for language L (see below)\n" +" -m, --lang-map=MAPFILE use MAPFILE to map file names onto source " +"language\n" +" -d, --default-lang=LANG make LANG the default source language\n" +" -p, --prune=NAMES exclude the named files and/or directories\n" +" -v, --verbose report per file statistics\n" +" -s, --statistics report statistics at end of run\n" +"\n" +" --help display this help and exit\n" +" --version output version information and exit\n" +"\n" +"FILE may be a file name, or a directory name to recursively search.\n" +"If no FILE is given, the current directory is searched by default.\n" +"Note that the `--include' and `--exclude' options are mutually-exclusive.\n" +"\n" +"The following arguments apply to the language-specific scanners:\n" +msgstr "" + +#: src/mkid.c:311 +#, c-format +msgid "can't create `%s' in `%s'" +msgstr "" + +#: src/mkid.c:315 +#, c-format +msgid "can't modify `%s'" msgstr "" -#: lib/scanners.c:1081 +#: src/mkid.c:368 +#, c-format +msgid "can't stat `%s'" +msgstr "" + +#: src/mkid.c:435 +#, fuzzy, c-format +msgid " new = %d/%d" +msgstr ", new=%d/%d" + +#: src/mkid.c:444 +#, c-format +msgid "Name=%ld, " +msgstr "Name=%ld, " + +#: src/mkid.c:445 +#, c-format +msgid "Number=%ld, " +msgstr "Zahl=%ld, " + +#: src/mkid.c:446 +#, c-format +msgid "String=%ld, " +msgstr "Zeichenkette=%ld, " + +# ist das gemeint? ### +#: src/mkid.c:447 +#, c-format +msgid "Literal=%ld, " +msgstr "Zeichen=%ld, " + +#: src/mkid.c:448 +#, c-format +msgid "Comment=%ld\n" +msgstr "Kommentar=%ld\n" + +#: src/mkid.c:450 +#, c-format +msgid "Files=%d, " +msgstr "Dateien=%d, " + +#: src/mkid.c:451 +#, c-format +msgid "Tokens=%ld, " +msgstr "Tokens=%ld, " + +#: src/mkid.c:452 +#, c-format +msgid "Bytes=%ld Kb, " +msgstr "Bytes=%ld Kb, " + +#: src/mkid.c:453 +#, fuzzy, c-format +msgid "Heap=%ld+%ld Kb, " +msgstr "\"Heap\"=%ld Kb, " + +#: src/mkid.c:455 +#, c-format +msgid "Output=%ld (%ld tok, %ld hit)\n" +msgstr "Ausgabe=%ld (%ld tok, %ld hit)\n" + +# Frequenz übersetzen? ke +#: src/mkid.c:458 +#, fuzzy, c-format +msgid ", Freq=%ld/%ld=%.2f\n" +msgstr "\"Freq\"=%ld/%ld=%.2f\n" + +#: src/mkid.c:481 +msgid "Sorting tokens...\n" +msgstr "Sortiere \"Token\"...\n" + +#: src/mkid.c:487 +#, c-format +msgid "Writing `%s'...\n" +msgstr "Schreibe '%s'...\n" + +#: src/mkid.c:490 +#, c-format +msgid "can't create `%s'" +msgstr "" + +#: src/mkid.c:636 +#, fuzzy +msgid "level %d: %ld/%ld = %.0f%%\n" +msgstr "level %d: %ld == %ld\n" + +#: src/xtokid.c:67 msgid "" -"Text language:\n" -" -i,--include=CHAR-CLASS Include characters from CHAR-CLASS in tokens\n" -" -x,--exclude=CHAR-CLASS Exclude characters from CHAR-CLASS from tokens\n" +"Print all tokens found in a source file.\n" +" -i, --include=LANGS include languages in LANGS (default: \"C C++ " +"asm\")\n" +" -x, --exclude=LANGS exclude languages in LANGS\n" +" -l, --lang-option=L:OPT pass OPT as a default for language L (see below)\n" +" -m, --lang-map=MAPFILE use MAPFILE to map file names onto source " +"language\n" +" -d, --default-lang=LANG make LANG the default source language\n" +" -p, --prune=NAMES exclude the named files and/or directories\n" +" --help display this help and exit\n" +" --version output version information and exit\n" +"\n" +"The following arguments apply to the language-specific scanners:\n" msgstr "" -#, possible-c-format +#~ msgid "%s: not found\n" +#~ msgstr "%s: nicht gefunden\n" + #~ msgid "Bogus frequencies: %u > %u\n" #~ msgstr "Überflüssiges Vorkommen: %u > %u\n" -#, possible-c-format #~ msgid "Usage: %s [-f<file>] file1 file2\n" #~ msgstr "Syntax: %s [-f<DATEI>] DATEI_1 DATEI_2\n" -#, possible-c-format #~ msgid "%s: Cannot fork (%s)\n" #~ msgstr "%s: Kann nicht \"fork'en\" (%s)\n" -#, possible-c-format #~ msgid "Usage: %s [-u] [+/-a<ccc>] [-c<ccc>] files\n" #~ msgstr "Syntax: %s [-u] [+/-a<CCC>] [-c<CCC>] DATEIEN\n" -#, possible-c-format #~ msgid "%s: Syntax Error: %s (%s)\n" #~ msgstr "%s: Syntaxfehler: %s (%s)\n" -#, possible-c-format #~ msgid "%s: cannot determine current directory\n" #~ msgstr "%s: aktuelles Verzeichnis nicht bestimmbar\n" -#, possible-c-format #~ msgid " uniq=%d/%d" #~ msgstr " uniq=%d/%d" -#, fuzzy, possible-c-format +#, fuzzy #~ msgid "Scan Heap=%ld Kb, " #~ msgstr "\"Heap\"=%ld Kb, " -#, possible-c-format #~ msgid "level %d: %ld < %ld/2\n" #~ msgstr "level %d: %ld < %ld/2\n" -#, possible-c-format #~ msgid "level %d: %ld > %ld*2\n" #~ msgstr "level %d: %ld > %ld*2\n" -#, possible-c-format #~ msgid "level %d: %ld < %ld\n" #~ msgstr "level %d: %ld < %ld\n" -#, possible-c-format #~ msgid "level %d: %ld > %ld\n" #~ msgstr "level %d: %ld > %ld\n" #, fuzzy -#~ msgid "can't get working directory name." -#~ msgstr "%s: Name des aktuellen Verzeichnisses nicht zu erreichen.\n" - -#, fuzzy #~ msgid "nothing to do..." #~ msgstr "Nichts zu tun...\n" -#, possible-c-format #~ msgid "%s: No language assigned to suffix: `%s'\n" #~ msgstr "%s: Keine Sprache zugeordnet dem Suffix: '%s'\n" -#, possible-c-format -#~ msgid "Load=%ld/%ld=%.2f, " -#~ msgstr "\"Load\"=%ld/%ld=%.2f, " - -#, possible-c-format -#~ msgid "Rehash=%d, " -#~ msgstr "\"Rehash\"=%d, " - -#, possible-c-format #~ msgid "Probes=%ld/%ld=%.2f, " #~ msgstr "\"Probes\"=%ld/%ld=%.2f, " -#, possible-c-format #~ msgid "%s: Use -u, -f<file>, or cmd-line for file args!\n" -#~ msgstr "%s: '-u', '-f<DATEI>' oder Befehlszeile für die Datei-Parameter nehmen!\n" +#~ msgstr "" +#~ "%s: '-u', '-f<DATEI>' oder Befehlszeile für die Datei-Parameter nehmen!\n" -#, possible-c-format #~ msgid "%s: Use only one of: -u, -f<file>, or cmd-line for file args!\n" -#~ msgstr "%s: Nur eins nehmen: '-u', '-f<DATEI>' oder Befehlszeile für die Datei-Parameter!\n" +#~ msgstr "" +#~ "%s: Nur eins nehmen: '-u', '-f<DATEI>' oder Befehlszeile für die " +#~ "Datei-Parameter!\n" -#, possible-c-format #~ msgid "" #~ "\n" #~ "\tRehashing... (doubling size to %ld)\n" @@ -492,49 +610,41 @@ msgstr "" #~ "\n" #~ " \"Rehashing\"... (verdoppele Größe auf %ld)\n" -#, fuzzy, possible-c-format +#, fuzzy #~ msgid "duplicate hash entry `%s'" #~ msgstr "%s: Doppelter \"Hash\"-Eintrag!\n" -#, possible-c-format #~ msgid "%s: Not an id file: `%s'\n" #~ msgstr "%s: Keine \"id\"-Datei: '%s'\n" -#, possible-c-format #~ msgid "%s: ID version mismatch (want: %d, got: %d)\n" #~ msgstr "%s: ID-Version passt nicht (brauche: %d, habe: %d)\n" -#, possible-c-format #~ msgid "No scanner assigned to suffix `%s'\n" #~ msgstr "Kein Scanner dem Suffix '%s' zugeordnet\n" -#, possible-c-format #~ msgid "%s: Language undefined: %s\n" #~ msgstr "%s: Sprache nicht definiert: %s\n" -#, possible-c-format #~ msgid "%s: Note: `%s=%s' overrides `%s=%s'\n" #~ msgstr "%s: Achtung: '%s=%s' überschreibt '%s=%s'\n" -#, possible-c-format #~ msgid "%s: language %s not defined.\n" #~ msgstr "%s: Sprache %s nicht definiert.\n" -#, possible-c-format #~ msgid "%s: Note: `%s/%s' overrides `%s/%s'\n" #~ msgstr "%s: Achtung: '%s/%s' überschreibt '%s/%s'\n" -#, possible-c-format -#~ msgid "Usage: %s [-S<suffix>=<lang>] [+S(+|-)<arg>] [-S<lang>(+|-)<arg>] [-S<lang>/<lang>/<filter>]\n" +#~ msgid "" +#~ "Usage: %s [-S<suffix>=<lang>] [+S(+|-)<arg>] [-S<lang>(+|-)<arg>] " +#~ "[-S<lang>/<lang>/<filter>]\n" #~ msgstr "" #~ "Syntax: %s [-S<SUFFIX>=<LANG>] [+S(+|-)<ARG>]\n" #~ " [-S<LANG>(+|-)<ARG>] [-S<LANG>/<LANG>/<FILTER>]\n" -#, possible-c-format #~ msgid "junk: `\\%3o'" #~ msgstr "\"junk\": `\\%3o'" -#, possible-c-format #~ msgid "Usage: %s does not accept %s scanner arguments\n" #~ msgstr "Syntax: %s kann keine %s Scanner-Parameter verwenden\n" @@ -550,11 +660,11 @@ msgstr "" #~ "\n" #~ " (+|-)u Den führenden '_' von den \"ids\" in den Zeichenketten\n" #~ " (entfernen | nicht entfernen).\n" -#~ " (+|-)s<CC> <CC> in den \"ids\" der Zeichenketten erlauben und solche \"ids\"\n" +#~ " (+|-)s<CC> <CC> in den \"ids\" der Zeichenketten erlauben und solche " +#~ "\"ids\"\n" #~ " (auswerten [`keep'] | übergehen).\n" #~ " -v \"vhil\"-Kommentare übergehen." -#, possible-c-format #~ msgid "Usage: %s -S%s([-c<cc>] [-u] [(+|-)a<cc>] [(+|-)p] [(+|-)C])\n" #~ msgstr "Syntax: %s -S%s([-c<CC>] [-u] [(+|-)a<CC>] [(+|-)p] [(+|-)C])\n" @@ -572,11 +682,11 @@ msgstr "" #~ "\n" #~ " -c<CC> <CC> beginnt/en einen Kommentar bis zum Zeilenende.\n" #~ " (+|-)u Führenden '_' von den \"ids\" (entfernen | nicht entfernen).\n" -#~ " (+|-)a<cc> <CC> in den \"ids\" der Zeichenketten erlauben und solche \"ids\".\n" +#~ " (+|-)a<cc> <CC> in den \"ids\" der Zeichenketten erlauben und solche " +#~ "\"ids\".\n" #~ " (+|-)p C-Preprozessor-Anweisungen (bearbeiten | nicht bearbeiten).\n" #~ " (+|-)C C-Kommentare `/* */' (bearbeiten | nicht bearbeiten)." -#, possible-c-format #~ msgid "Usage: %s -S%s([(+|-)a<cc>] [(+|-)s<cc>]\n" #~ msgstr "Syntax: %s -S%s([(+|-)a<cc>] [(+|-)s<cc>]\n" @@ -595,9 +705,9 @@ msgstr "" #~ msgid "open" #~ msgstr "öffne" -#, possible-c-format #~ msgid "" -#~ "Usage: %s [-v] [-f<idfile>] [(+|-)l[<lang>]] [(+|-)S<scanarg>] [-a<argfile>] [-] [-u] [files...]\n" +#~ "Usage: %s [-v] [-f<idfile>] [(+|-)l[<lang>]] [(+|-)S<scanarg>] [-a<argfile>] " +#~ "[-] [-u] [files...]\n" #~ "\t-v\t Verbose: print reports of progress\n" #~ "\t-a<file> Open file for arguments\n" #~ "\t-\t Read newline-separated args from stdin\n" @@ -628,7 +738,6 @@ msgstr "" #~ msgid "modify" #~ msgstr "verändere" -#, possible-c-format #~ msgid "%s: No scanner for language: `%s'\n" #~ msgstr "%s: Kein Scanner für die Sprache: '%s'\n" @@ -638,18 +747,16 @@ msgstr "" #~ msgid "malloc failure! \n" #~ msgstr "Speicher-Zuordnungsfehler (`malloc failure')! \n" -#, fuzzy, possible-c-format +#, fuzzy #~ msgid "Usage: %s [-f<file>] [-u<n>] [-r<dir>] [-mewdoxasknc] patterns...\n" #~ msgstr "Syntax: %s [-f<DATEI>[-u<N>] [-r<VERZ>] [-mewdoxasknc] MASKE...\n" -#, possible-c-format #~ msgid "%s: please use only one of -c or -r\n" #~ msgstr "%s: Nur eine von beiden Optionen nehmen: '-c' oder '-r'\n" #~ msgid "exec" #~ msgstr "führe aus" -#, possible-c-format #~ msgid "%s: Cannot %s `%s' (%s)\n" #~ msgstr "%s: %s '%s' (%s) nicht möglich\n" @@ -674,7 +781,8 @@ msgstr "" #~ msgstr "" #~ "Syntax: iid [-a] [-c] [-H]\n" #~ "\n" -#~ " -a Die \"aid\" als Standardabfrage-Befehl nehmen (nicht die \"lid\").\n" +#~ " -a Die \"aid\" als Standardabfrage-Befehl nehmen (nicht die " +#~ "\"lid\").\n" #~ " -c BEFEHL Nur die Abfrage BEFEHL ausführen und beenden.\n" #~ " -H Nur diese Hilfe anzeigen.\n" #~ "\n" @@ -1,482 +1,614 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Free Software Foundation, Inc. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy msgid "" msgstr "" -"Date: 1996-02-16 13:46:03-0500\n" -"From: =?ISO-8859-1?Q?Fran=E7ois_Pinard?= <pinard@icule>\n" -"Content-Type: text/plain; charset=\n" -"Xgettext-Options: -dmkid -k_\n" -"Files: alloca.c ansi2knr.c bitops.c fid.c filenames.c getopt.c getopt1.c idfile.c idx.c iid.c iid.y lid.c misc.c mkid.c regex.c scanners.c strcasecmp.c " -"strerror.c token.c\n" -"POT-Creation-Date: 1996-05-30 17:22-0400\n" +"Project-Id-Version: PACKAGE VERSION\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI +ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: ENCODING\n" -#: src/fid.c:75 src/idx.c:43 src/lid.c:203 src/mkid.c:125 -#, possible-c-format -msgid "Try `%s --help' for more information.\n" -msgstr "" - -#: src/fid.c:83 -#, possible-c-format -msgid "Usage: %s [OPTION] FILENAME [FILENAME2]\n" -msgstr "" +#~ msgid "" +#~ msgstr "" +#~ "POT-Creation-Date: 1996-07-17 17:50-0400\n" +#~ "Content-Type: text/plain; charset=\n" +#~ "Date: 1996-02-16 13:46:03-0500\n" +#~ "From: =?ISO-8859-1?Q?Fran=E7ois_Pinard?= <pinard@icule>\n" +#~ "Xgettext-Options: -dmkid -k_\n" +#~ "Files: alloca.c ansi2knr.c bitops.c fid.c filenames.c getopt.c getopt1.c " +#~ "idfile.c idx.c iid.c iid.y lid.c misc.c mkid.c regex.c scanners.c " +#~ "strcasecmp.c strerror.c token.c\n" -#: src/fid.c:86 -msgid "" -"List identifiers that occur in FILENAME, or if FILENAME2 is\n" -"also given list the identifiers that occur in both files.\n" -"\n" -" -f, --file=FILE file name of ID database\n" +#: libidu/hash.c:52 +#, c-format +msgid "can't allocate %ld bytes for hash table: memory exhausted" msgstr "" -#: src/fid.c:135 src/lid.c:344 -msgid "can't locate `ID'" -msgstr "" +#: libidu/hash.c:247 +#, fuzzy +msgid "Load=%ld/%ld=%.0f%%, " +msgstr "Charge=%ld/%ld=%.2f, " -#: src/fid.c:152 -msgid "no file name arguments" -msgstr "" +#: libidu/hash.c:249 +#, c-format +msgid "Rehash=%d, " +msgstr "Rehacher=%d, " -#: src/fid.c:157 -msgid "too many file name arguments" +#: libidu/hash.c:250 +#, fuzzy +msgid "Collisions=%ld/%ld=%.0f%%" msgstr "" -#: src/fid.c:221 -#, possible-c-format -msgid "`%s' is ambiguous" +#: libidu/idfile.c:106 +msgid "can't determine the io_size of a string!" msgstr "" -#: src/fid.c:227 -#, fuzzy, possible-c-format -msgid "`%s' not found" -msgstr "%s pas trouvé\n" - -#: src/idx.c:59 src/mkid.c:148 -#, possible-c-format -msgid "Usage: %s [OPTION]... [FILE]...\n" +#: libidu/idread.c:45 src/mkid.c:386 src/xtokid.c:213 +#, c-format +msgid "can't open `%s'" msgstr "" -#: src/mkid.c:152 -msgid "" -"Build an identifier database.\n" -" -o, --output=OUTFILE file name of ID database output\n" -" -f, --file=OUTFILE synonym for --output\n" -" -i, --include=LANGS include languages in LANGS (default: \"C C++ asm\")\n" -" -x, --exclude=LANGS exclude languages in LANGS\n" -" -l, --lang-arg=LANG:ARG pass ARG as a default for LANG (see below)\n" -" -m, --lang-map=MAPFILE use MAPFILE to map file names onto source language\n" -" -v, --verbose report progress and as files are scanned\n" -" -s, --statistics report statistics at end of run\n" -"\n" -" --help display this help and exit\n" -" --version output version information and exit\n" -"\n" -"FILE may be a file name, or a directory name to recursively search.\n" -"The `--include' and `--exclude' options are mutually-exclusive.\n" -"\n" -"The following arguments apply to the language-specific scanners:\n" +#: libidu/idread.c:64 +#, c-format +msgid "`%s' is not an ID file! (bad magic #)" msgstr "" -#: src/mkid.c:284 -#, possible-c-format -msgid "can't create `%s' in `%s'" +#: libidu/idread.c:66 +#, c-format +msgid "`%s' is version %d, but I only grok version %d" msgstr "" -#: src/mkid.c:288 -#, possible-c-format -msgid "can't modify `%s'" -msgstr "" +#: libidu/idread.c:186 +#, fuzzy, c-format +msgid "unsupported size in io_read (): %d" +msgstr "Paramètre taille passé à io_read () non suporté: %d" -#: src/mkid.c:335 -#, possible-c-format -msgid "can't stat `%s'" +#: libidu/idread.c:194 libidu/idwrite.c:168 +#, c-format +msgid "unknown I/O type: %d" msgstr "" -#: src/mkid.c:400 -#, fuzzy, possible-c-format -msgid " new = %d/%d" -msgstr ", nouveau=%d/%d" +#: libidu/idwrite.c:156 +#, fuzzy, c-format +msgid "unsupported size in io_write (): %d" +msgstr "Paramètre taille passé à io_write () non suporté: %d" -#: src/mkid.c:409 -#, possible-c-format -msgid "Name=%ld, " -msgstr "Nom=%ld, " +#: libidu/scanners.c:93 +#, fuzzy, c-format +msgid "unrecognized language: `%s'" +msgstr "Pas d'analyseur lexical pour le langag `%s'" -#: src/mkid.c:410 -#, possible-c-format -msgid "Number=%ld, " -msgstr "Numéro=%ld, " - -#: src/mkid.c:411 -#, possible-c-format -msgid "String=%ld, " -msgstr "Chaîne=%ld, " - -#: src/mkid.c:412 -#, possible-c-format -msgid "Literal=%ld, " -msgstr "Litéral=%ld, " +#: libidu/scanners.c:139 +msgid "can't allocate language args obstack: memory exhausted" +msgstr "" -#: src/mkid.c:413 -#, possible-c-format -msgid "Comment=%ld\n" -msgstr "Commentaire=%ld\n" +#: libidu/scanners.c:193 libidu/scanners.c:262 +msgid "can't allocate language args: memory exhausted" +msgstr "" -#: src/mkid.c:415 -#, possible-c-format -msgid "Files=%d, " -msgstr "Fichiers=%d, " +#: libidu/scanners.c:201 +#, c-format +msgid "language name expected following `%s' in file `%s'" +msgstr "" -#: src/mkid.c:416 -#, possible-c-format -msgid "Tokens=%ld, " -msgstr "Unités lexicales=%ld, " +#: libidu/scanners.c:256 +#, fuzzy, c-format +msgid "can't open language map file `%s'" +msgstr "Pas d'analyseur lexical pour le langag `%s'" -#: src/mkid.c:417 -#, possible-c-format -msgid "Bytes=%ld Kb, " -msgstr "Octets=%ld Kb, " +#: libidu/scanners.c:258 +#, c-format +msgid "can't get size of map file `%s'" +msgstr "" -#: src/mkid.c:418 -#, fuzzy, possible-c-format -msgid "Heap=%ld+%ld Kb, " -msgstr "tas=%ld Kb, " +#: libidu/scanners.c:268 +#, fuzzy, c-format +msgid "can't read language map file `%s'" +msgstr "Pas d'analyseur lexical pour le langag `%s'" -#: src/mkid.c:420 -#, possible-c-format -msgid "Output=%ld (%ld tok, %ld hit)\n" -msgstr "Sortie=%ld (%ld unités lexicales, %ld Touches)\n" +#: libidu/scanners.c:271 +#, c-format +msgid "can't read entire language map file `%s'" +msgstr "" -#: src/mkid.c:423 -#, fuzzy, possible-c-format -msgid ", Freq=%ld/%ld=%.2f\n" -msgstr "Freq=%ld/%ld=%.2f\n" +#: libidu/scanners.c:412 +msgid "" +"C language:\n" +" -k,--keep=CHARS Allow CHARS in single-token strings, keep the " +"result\n" +" -i,--ignore=CHARS Allow CHARS in single-token strings, toss the " +"result\n" +" -u,--strip-underscore Strip a leading underscore from single-token " +"strings\n" +msgstr "" -#: src/mkid.c:446 -msgid "Sorting tokens...\n" -msgstr "Tri unités lexicales...\n" +#: libidu/scanners.c:681 libidu/scanners.c:986 libidu/scanners.c:1190 +#, c-format +msgid "junk: `%c'" +msgstr "déchet: `%c'" -#: src/mkid.c:452 -#, possible-c-format -msgid "Writing `%s'...\n" -msgstr "Écriture `%s'...\n" +#: libidu/scanners.c:683 libidu/scanners.c:988 libidu/scanners.c:1192 +#, c-format +msgid "junk: `\\%03o'" +msgstr "déchet: `\\%03o'" -#: src/mkid.c:455 -#, possible-c-format -msgid "can't create `%s'" +#: libidu/scanners.c:787 +msgid "" +"Assembly language:\n" +" -c,--comment=CHARS Any of CHARS starts a comment until end-of-line\n" +" -k,--keep=CHARS Allow CHARS in tokens, and keep the result\n" +" -i,--ignore=CHARS Allow CHARS in tokens, and toss the result\n" +" -u,--strip-underscore Strip a leading underscore from tokens\n" +" -n,--no-cpp Don't handle C pre-processor directives\n" msgstr "" -#: src/mkid.c:601 -#, fuzzy -msgid "level %d: %ld/%ld = %.0f%%\n" -msgstr "niveau %d: %ld == %ld\n" +#: libidu/scanners.c:1092 +msgid "" +"Text language:\n" +" -i,--include=CHAR-CLASS Treat characters of CHAR-CLASS as token " +"constituents\n" +" -x,--exclude=CHAR-CLASS Treat characters of CHAR-CLASS as token " +"delimiters\n" +msgstr "" -#: src/lid.c:211 -#, possible-c-format -msgid "Usage: %s [OPTION]... PATTERN...\n" +#: libidu/walker.c:103 +#, c-format +msgid "can't read directory `%s' (`.' from `%s')" msgstr "" -#: src/lid.c:214 -msgid "" -"Query ID database and report results.\n" -"By default, output consists of multiple lines, each line containing the\n" -"matched identifier followed by the list of file names in which it occurs.\n" -"\n" -" -f, --file=FILE file name of ID database\n" -" -G, --grep show every line where the matched identifier occurs\n" -" -E, --edit edit every file where the matched identifier occurs\n" -" -m, --merge output a multi-line regexp match as a single line\n" -" -n, --no-id print file names only - omit the identifier\n" -" -b, --braces toggle shell brace-notation for output file names\n" -"\n" -"If PATTERN contains regular expression metacharacters, it is interpreted\n" -"as a regular expression. Otherwise, PATTERN is interpreted as a literal\n" -"word.\n" -"\n" -" -e, --regexp match PATTERN as a regular expression substring\n" -" -w, --word match PATTERN as a word\n" -" -i, --ignore-case match PATTERN case insinsitively\n" -" -A, --apropos match PATTERN as a case-insensitive substring\n" -"\n" -" -F, --frequency=FREQ find identifiers that occur FREQ times, where FREQ\n" -" is a range expressed as `N..M'. N omitted defaults\n" -" to 1, M omitted defaults to MAX_USHRT.\n" -" -a, --ambiguous=LEN find identifiers whose names are ambiguous for LEN chars\n" -"\n" -" -x, --hex only find numbers expressed as hexadecimal\n" -" -d, --decimal only find numbers expressed as decimal\n" -" -o, --octal only find numbers expressed as octal\n" -"\n" -" --help display this help and exit\n" -" --version output version information and exit\n" +#: libidu/walker.c:170 +#, c-format +msgid "notice: `%s' was a %s, but is now a %s!" msgstr "" -#: src/lid.c:398 -#, fuzzy, possible-c-format -msgid "All identifiers are non-ambiguous within the first %d characters\n" -msgstr "Tous les identificateurs sont unique dans les premiers %d caractères\n" +#: libidu/walker.c:171 libidu/walker.c:172 +msgid "file" +msgstr "" -#: src/lid.c:404 -#, possible-c-format -msgid "%s: not found\n" -msgstr "%s pas trouvé\n" +#: libidu/walker.c:171 libidu/walker.c:172 +msgid "directory" +msgstr "" -#. FIXME: i18n -#: src/lid.c:571 -msgid "Edit? [y1-9^S/nq] " -msgstr "Éditer? [y1-9^S/nq] " +#: libidu/walker.c:291 +#, c-format +msgid "warning: `%s' and `%s' are the same file, but yield different scans!" +msgstr "" -#: src/lid.c:642 -msgid "can't fork" +#: libidu/walker.c:385 +#, c-format +msgid "notice: scan parameters changed for `%s'" msgstr "" -#: src/lid.c:664 -#, possible-c-format -msgid "can't exec `%s'" +#: libidu/walker.c:580 +#, fuzzy +msgid "can't get working directory" +msgstr "%s: Impossible d'obtenir le répertoire courant." + +#: libidu/walker.c:637 +#, c-format +msgid "can't chdir to `%s'" msgstr "" -#: src/lid.c:785 -msgid "can't match regular-expression: memory exhausted" +#: libidu/walker.c:642 +#, c-format +msgid "can't chdir to `%s' from `%s'" msgstr "" -#: src/idx.c:63 -msgid "" -"Print all tokens found in a source file.\n" -" -m, --lang-map=FILE use FILE to file names onto source language\n" -" --help display this help and exit\n" -" --version output version information and exit\n" -"\n" -"The following arguments apply to the language-specific scanners:\n" +#: libidu/walker.c:696 +#, c-format +msgid "can't lstat `%s' from `%s'" msgstr "" -#: lib/filenames.c:367 lib/idfile.c:46 -#, possible-c-format -msgid "can't open `%s'" +#: libidu/walker.c:704 +#, c-format +msgid "can't stat `%s' from `%s'" msgstr "" #: lib/getopt.c:527 -#, possible-c-format +#, c-format msgid "%s: option `%s' is ambiguous\n" msgstr "" #: lib/getopt.c:550 -#, possible-c-format +#, c-format msgid "%s: option `--%s' doesn't allow an argument\n" msgstr "" #: lib/getopt.c:555 -#, possible-c-format +#, c-format msgid "%s: option `%c%s' doesn't allow an argument\n" msgstr "" #: lib/getopt.c:570 -#, possible-c-format +#, c-format msgid "%s: option `%s' requires an argument\n" msgstr "" #. --option #: lib/getopt.c:598 -#, possible-c-format +#, c-format msgid "%s: unrecognized option `--%s'\n" msgstr "" #. +option or -option #: lib/getopt.c:602 -#, possible-c-format +#, c-format msgid "%s: unrecognized option `%c%s'\n" msgstr "" #. 1003.2 specifies the format of this message. #: lib/getopt.c:627 -#, possible-c-format +#, c-format msgid "%s: illegal option -- %c\n" msgstr "" #: lib/getopt.c:630 -#, possible-c-format +#, c-format msgid "%s: invalid option -- %c\n" msgstr "" #: lib/getopt.c:666 -#, possible-c-format +#, c-format msgid "%s: option requires an argument -- %c\n" msgstr "" -#: lib/idfile.c:65 -#, possible-c-format -msgid "`%s' is not an ID file! (bad magic #)" +#: src/fid.c:70 src/fnid.c:49 src/lid.c:237 src/mkid.c:120 src/xtokid.c:42 +#, c-format +msgid "Try `%s --help' for more information.\n" msgstr "" -#: lib/idfile.c:67 -#, possible-c-format -msgid "`%s' is version %d, but I only grok version %d" +#: src/fid.c:78 +#, c-format +msgid "Usage: %s [OPTION] FILENAME [FILENAME2]\n" msgstr "" -#: lib/idfile.c:97 -msgid "can't determine the io_size of a string!" +#: src/fid.c:81 +msgid "" +"List identifiers that occur in FILENAME, or if FILENAME2 is\n" +"also given list the identifiers that occur in both files.\n" +"\n" +" -f, --file=FILE file name of ID database\n" +" --help display this help and exit\n" +" --version output version information and exit\n" msgstr "" -#: lib/idfile.c:146 lib/idfile.c:185 -#, fuzzy, possible-c-format -msgid "unsupported size in io_write (): %d\n" -msgstr "Paramètre taille passé à io_write () non suporté: %d\n" +#: src/fid.c:141 +msgid "no file name arguments" +msgstr "" -#: lib/idfile.c:155 lib/idfile.c:195 -#, possible-c-format -msgid "unknown I/O type: %d" +#: src/fid.c:146 +msgid "too many file name arguments" msgstr "" -#: lib/scanners.c:89 -#, fuzzy, possible-c-format -msgid "unrecognized language: `%s'\n" -msgstr "Pas d'analyseur lexical pour le langag `%s'\n" +#: src/fid.c:153 src/fnid.c:147 src/lid.c:410 +msgid "can't locate `ID'" +msgstr "" -#: lib/scanners.c:130 -msgid "can't allocate language args obstack: memory exhausted" +#: src/fid.c:235 +#, c-format +msgid "`%s' is ambiguous" msgstr "" -#: lib/scanners.c:184 lib/scanners.c:252 -msgid "can't allocate language args: memory exhausted" +#: src/fid.c:241 +#, fuzzy, c-format +msgid "`%s' not found" +msgstr "%s pas trouvé" + +#: src/fnid.c:66 +#, c-format +msgid "Usage: %s [OPTION]... [PATTERN]...\n" msgstr "" -#: lib/scanners.c:191 -#, possible-c-format -msgid "language name expected following `%s' in file `%s'" +#: src/fnid.c:70 +msgid "" +"Print constituent file names that match PATTERN,\n" +"using shell-style wildcards.\n" +" -f, --file=FILE file name of ID database\n" +" -S, --separator=STYLE STYLE is one of `braces', `space' or `newline'\n" +" --help display this help and exit\n" +" --version output version information and exit\n" msgstr "" -#: lib/scanners.c:246 -#, fuzzy, possible-c-format -msgid "can't open language map file `%s'" -msgstr "Pas d'analyseur lexical pour le langag `%s'\n" +#: src/lid.c:245 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN...\n" +msgstr "" -#: lib/scanners.c:248 -#, possible-c-format -msgid "can't get size of map file `%s'" +#: src/lid.c:249 +#, c-format +msgid "" +"Query ID database and report results.\n" +"By default, output consists of multiple lines, each line containing the\n" +"matched identifier followed by the list of file names in which it occurs.\n" +"\n" +" -f, --file=FILE file name of ID database\n" +"\n" +" -i, --ignore-case match PATTERN case insensitively\n" +" -l, --literal match PATTERN as a literal string\n" +" -r, --regexp match PATTERN as a regular expression\n" +" -w, --word match PATTERN as a delimited word\n" +" -s, --substring match PATTERN as a substring\n" +" Note: If PATTERN contains extended regular expression meta-\n" +" characters, it is interpreted as a regular expression " +"substring.\n" +" Otherwise, PATTERN is interpreted as a literal word.\n" +"\n" +" -k, --key=STYLE STYLE is one of `token', `pattern' or `none'\n" +" -R, --result=STYLE STYLE is one of `filenames', `grep', `edit' or " +"`none'\n" +" -S, --separator=STYLE STYLE is one of `braces', `space' or `newline' and\n" +" only applies to file names when " +"`--result=filenames'\n" +" The above STYLE options control how query results are " +"presented.\n" +" Defaults are --key=token --result=filenames --separator=%s\n" +"\n" +" -F, --frequency=FREQ find tokens that occur FREQ times, where FREQ\n" +" is a range expressed as `N..M'. If N is omitted, " +"it\n" +" defaults to 1, if M is omitted it defaults to " +"MAX_USHRT\n" +" -a, --ambiguous=LEN find tokens whose names are ambiguous for LEN chars\n" +"\n" +" -x, --hex only find numbers expressed as hexadecimal\n" +" -d, --decimal only find numbers expressed as decimal\n" +" -o, --octal only find numbers expressed as octal\n" +" By default, searches match numbers of any radix.\n" +"\n" +" --help display this help and exit\n" +" --version output version information and exit\n" msgstr "" -#: lib/scanners.c:258 -#, fuzzy, possible-c-format -msgid "can't read language map file `%s'" -msgstr "Pas d'analyseur lexical pour le langag `%s'\n" +#: src/lid.c:285 +msgid "braces" +msgstr "" -#: lib/scanners.c:261 -#, possible-c-format -msgid "can't read entire language map file `%s'" +#: src/lid.c:285 +msgid "space" msgstr "" -#: lib/scanners.c:402 -msgid "" -"C language:\n" -" -k,--keep=CHARS Allow CHARS in single-token strings, keep the result\n" -" -i,--ignore=CHARS Allow CHARS in single-token strings, toss the result\n" -" -u,--strip-underscore Strip a leading underscore from single-token strings\n" +#: src/lid.c:351 +msgid "notice: use of `-e' is deprecated, use `-r' instead" msgstr "" -#: lib/scanners.c:671 lib/scanners.c:975 lib/scanners.c:1179 -#, possible-c-format -msgid "junk: `%c'" -msgstr "déchet: `%c'" +#: src/lid.c:431 +#, fuzzy, c-format +msgid "All identifiers are non-ambiguous within the first %d characters\n" +msgstr "Tous les identificateurs sont unique dans les premiers %d caractères\n" -#: lib/scanners.c:673 lib/scanners.c:977 lib/scanners.c:1181 -#, possible-c-format -msgid "junk: `\\%03o'" -msgstr "déchet: `\\%03o'" +#: src/lid.c:466 +#, c-format +msgid "invalid `--key' style: `%s'" +msgstr "" + +#: src/lid.c:478 +#, c-format +msgid "invalid `--result' style: `%s'" +msgstr "" + +#. FIXME: i18n of responses +#: src/lid.c:634 +#, fuzzy +msgid "edit? [y1-9^S/nq] " +msgstr "Éditer? [y1-9^S/nq] " + +#: src/lid.c:703 +msgid "can't fork" +msgstr "" -#: lib/scanners.c:777 +#: src/lid.c:721 +#, c-format +msgid "can't exec `%s'" +msgstr "" + +#: src/lid.c:851 +msgid "can't match regular-expression: memory exhausted" +msgstr "" + +#: src/mkid.c:145 src/xtokid.c:63 +#, c-format +msgid "Usage: %s [OPTION]... [FILE]...\n" +msgstr "" + +#: src/mkid.c:149 msgid "" -"Assembly language:\n" -" -c,--comment=CHARS Any of CHARS starts a comment until end-of-line\n" -" -k,--keep=CHARS Allow CHARS in tokens, and keep the result\n" -" -i,--ignore=CHARS Allow CHARS in tokens, and toss the result\n" -" -u,--strip-underscore Strip a leading underscore from tokens\n" -" -n,--no-cpp Don't handle C pre-processor directives\n" +"Build an identifier database.\n" +" -o, --output=OUTFILE file name of ID database output\n" +" -f, --file=OUTFILE synonym for --output\n" +" -i, --include=LANGS include languages in LANGS (default: \"C C++ " +"asm\")\n" +" -x, --exclude=LANGS exclude languages in LANGS\n" +" -l, --lang-option=L:OPT pass OPT as a default for language L (see below)\n" +" -m, --lang-map=MAPFILE use MAPFILE to map file names onto source " +"language\n" +" -d, --default-lang=LANG make LANG the default source language\n" +" -p, --prune=NAMES exclude the named files and/or directories\n" +" -v, --verbose report per file statistics\n" +" -s, --statistics report statistics at end of run\n" +"\n" +" --help display this help and exit\n" +" --version output version information and exit\n" +"\n" +"FILE may be a file name, or a directory name to recursively search.\n" +"If no FILE is given, the current directory is searched by default.\n" +"Note that the `--include' and `--exclude' options are mutually-exclusive.\n" +"\n" +"The following arguments apply to the language-specific scanners:\n" +msgstr "" + +#: src/mkid.c:311 +#, c-format +msgid "can't create `%s' in `%s'" +msgstr "" + +#: src/mkid.c:315 +#, c-format +msgid "can't modify `%s'" msgstr "" -#: lib/scanners.c:1081 +#: src/mkid.c:368 +#, c-format +msgid "can't stat `%s'" +msgstr "" + +#: src/mkid.c:435 +#, fuzzy, c-format +msgid " new = %d/%d" +msgstr ", nouveau=%d/%d" + +#: src/mkid.c:444 +#, c-format +msgid "Name=%ld, " +msgstr "Nom=%ld, " + +#: src/mkid.c:445 +#, c-format +msgid "Number=%ld, " +msgstr "Numéro=%ld, " + +#: src/mkid.c:446 +#, c-format +msgid "String=%ld, " +msgstr "Chaîne=%ld, " + +#: src/mkid.c:447 +#, c-format +msgid "Literal=%ld, " +msgstr "Litéral=%ld, " + +#: src/mkid.c:448 +#, c-format +msgid "Comment=%ld\n" +msgstr "Commentaire=%ld\n" + +#: src/mkid.c:450 +#, c-format +msgid "Files=%d, " +msgstr "Fichiers=%d, " + +#: src/mkid.c:451 +#, c-format +msgid "Tokens=%ld, " +msgstr "Unités lexicales=%ld, " + +#: src/mkid.c:452 +#, c-format +msgid "Bytes=%ld Kb, " +msgstr "Octets=%ld Kb, " + +#: src/mkid.c:453 +#, fuzzy, c-format +msgid "Heap=%ld+%ld Kb, " +msgstr "tas=%ld Kb, " + +#: src/mkid.c:455 +#, c-format +msgid "Output=%ld (%ld tok, %ld hit)\n" +msgstr "Sortie=%ld (%ld unités lexicales, %ld Touches)\n" + +#: src/mkid.c:458 +#, fuzzy, c-format +msgid ", Freq=%ld/%ld=%.2f\n" +msgstr "Freq=%ld/%ld=%.2f\n" + +#: src/mkid.c:481 +msgid "Sorting tokens...\n" +msgstr "Tri unités lexicales...\n" + +#: src/mkid.c:487 +#, c-format +msgid "Writing `%s'...\n" +msgstr "Écriture `%s'...\n" + +#: src/mkid.c:490 +#, c-format +msgid "can't create `%s'" +msgstr "" + +#: src/mkid.c:636 +#, fuzzy +msgid "level %d: %ld/%ld = %.0f%%\n" +msgstr "niveau %d: %ld == %ld\n" + +#: src/xtokid.c:67 msgid "" -"Text language:\n" -" -i,--include=CHAR-CLASS Include characters from CHAR-CLASS in tokens\n" -" -x,--exclude=CHAR-CLASS Exclude characters from CHAR-CLASS from tokens\n" +"Print all tokens found in a source file.\n" +" -i, --include=LANGS include languages in LANGS (default: \"C C++ " +"asm\")\n" +" -x, --exclude=LANGS exclude languages in LANGS\n" +" -l, --lang-option=L:OPT pass OPT as a default for language L (see below)\n" +" -m, --lang-map=MAPFILE use MAPFILE to map file names onto source " +"language\n" +" -d, --default-lang=LANG make LANG the default source language\n" +" -p, --prune=NAMES exclude the named files and/or directories\n" +" --help display this help and exit\n" +" --version output version information and exit\n" +"\n" +"The following arguments apply to the language-specific scanners:\n" msgstr "" -#, possible-c-format +#~ msgid "%s: not found\n" +#~ msgstr "%s pas trouvé\n" + #~ msgid "Bogus frequencies: %u > %u\n" #~ msgstr "Fréquences de bogus: %u > %u\n" -#, possible-c-format #~ msgid "Usage: %s [-f<file>] file1 file2\n" #~ msgstr "Usage: %s [-f<fichier>] fichier1 fichier2\n" -#, possible-c-format #~ msgid "%s: Cannot fork (%s)\n" #~ msgstr "%s: Impossible de dupliquer le processus (%s)\n" -#, possible-c-format #~ msgid "Usage: %s [-u] [+/-a<ccc>] [-c<ccc>] files\n" #~ msgstr "Usage: %s [-u] [+/-a<ccc>] [-c<ccc>] fichiers\n" -#, possible-c-format #~ msgid "%s: Syntax Error: %s (%s)\n" #~ msgstr "%s: Erreur de syntaxe: %s (%s)\n" -#, possible-c-format #~ msgid "%s: cannot determine current directory\n" #~ msgstr "%s: impossible de déterminer le répertoire courant\n" -#, possible-c-format #~ msgid " uniq=%d/%d" #~ msgstr " unique=%d/%d" -#, fuzzy, possible-c-format +#, fuzzy #~ msgid "Scan Heap=%ld Kb, " #~ msgstr "tas=%ld Kb, " -#, possible-c-format #~ msgid "level %d: %ld < %ld/2\n" #~ msgstr "niveau %d: %ld < %ld/2\n" -#, possible-c-format #~ msgid "level %d: %ld > %ld*2\n" #~ msgstr "niveau %d: %ld > %ld*2\n" -#, possible-c-format #~ msgid "level %d: %ld < %ld\n" #~ msgstr "niveau %d: %ld < %ld\n" -#, possible-c-format #~ msgid "level %d: %ld > %ld\n" #~ msgstr "niveau %d: %ld > %ld\n" #, fuzzy -#~ msgid "can't get working directory name." -#~ msgstr "%s: Impossible d'obtenir le répertoire courant.\n" - -#, fuzzy #~ msgid "nothing to do..." #~ msgstr "Rien à faire...\n" -#, possible-c-format #~ msgid "%s: No language assigned to suffix: `%s'\n" #~ msgstr "%s: Pas de langage correspondant à ce suffixe: `%s'\n" -#, possible-c-format -#~ msgid "Load=%ld/%ld=%.2f, " -#~ msgstr "Charge=%ld/%ld=%.2f, " - -#, possible-c-format -#~ msgid "Rehash=%d, " -#~ msgstr "Rehacher=%d, " - -#, possible-c-format #~ msgid "Probes=%ld/%ld=%.2f, " #~ msgstr "Probants=%ld/%ld=%.2f, " -#, possible-c-format #~ msgid "%s: Use -u, -f<file>, or cmd-line for file args!\n" #~ msgstr "%s: Utilisez -u, -f<fichier>, ou ligne-cde pour fichier params!\n" -#, possible-c-format #~ msgid "%s: Use only one of: -u, -f<file>, or cmd-line for file args!\n" -#~ msgstr "%s: Utilisez soit: -u, -f<fichier>, soit: ligne-cde pour fichier params!\n" +#~ msgstr "" +#~ "%s: Utilisez soit: -u, -f<fichier>, soit: ligne-cde pour fichier params!\n" -#, possible-c-format #~ msgid "" #~ "\n" #~ "\tRehashing... (doubling size to %ld)\n" @@ -484,47 +616,41 @@ msgstr "" #~ "\n" #~ "\tRehachage... (Taille doublée à%ld)\n" -#, fuzzy, possible-c-format +#, fuzzy #~ msgid "duplicate hash entry `%s'" #~ msgstr "%s: Entrée de hachage dupliquée! \n" -#, possible-c-format #~ msgid "%s: Not an id file: `%s'\n" #~ msgstr "%s: N'est pas un fichier id: `%s'\n" -#, possible-c-format #~ msgid "%s: ID version mismatch (want: %d, got: %d)\n" #~ msgstr "%s: La version ID ne correspond pas (attend: %d, trouve: %d)\n" -#, possible-c-format #~ msgid "No scanner assigned to suffix `%s'\n" #~ msgstr "Pas d'analyseur lexical correspondant au suffixe `%s'\n" -#, possible-c-format #~ msgid "%s: Language undefined: %s\n" #~ msgstr "%s: Langage indéfini: %s\n" -#, possible-c-format #~ msgid "%s: Note: `%s=%s' overrides `%s=%s'\n" #~ msgstr "%s: Avertissement: `%s=%s' dépassements `%s=%s'\n" -#, possible-c-format #~ msgid "%s: language %s not defined.\n" #~ msgstr "%s: langage %s non défini.\n" -#, possible-c-format #~ msgid "%s: Note: `%s/%s' overrides `%s/%s'\n" #~ msgstr "%s: Avertissement: `%s/%s' dépassements `%s/%s'\n" -#, possible-c-format -#~ msgid "Usage: %s [-S<suffix>=<lang>] [+S(+|-)<arg>] [-S<lang>(+|-)<arg>] [-S<lang>/<lang>/<filter>]\n" -#~ msgstr "Usage: %s [-S<suffixe>=<lang>] [+S(+|-)<param>] [-S<lang>(+|-)<param>] [-S<lang>/<lang>/<filtre>]\n" +#~ msgid "" +#~ "Usage: %s [-S<suffix>=<lang>] [+S(+|-)<arg>] [-S<lang>(+|-)<arg>] " +#~ "[-S<lang>/<lang>/<filter>]\n" +#~ msgstr "" +#~ "Usage: %s [-S<suffixe>=<lang>] [+S(+|-)<param>] [-S<lang>(+|-)<param>] " +#~ "[-S<lang>/<lang>/<filtre>]\n" -#, possible-c-format #~ msgid "junk: `\\%3o'" #~ msgstr "déchet: `\\%3o'" -#, possible-c-format #~ msgid "Usage: %s does not accept %s scanner arguments\n" #~ msgstr "Usage: %s n'accèpte pas les paramètres de l'analyseur lexical %s\n" @@ -535,13 +661,15 @@ msgstr "" #~ " (+|-)u . . . . (Do|Don't) strip a leading `_' from ids in strings.\n" #~ " (+|-)s<cc> . . Allow <cc> in string ids, and (keep|ignore) those ids." #~ msgstr "" -#~ "Les paramètre de l'analyseur lexical C prennent la forme -Sc<param>, où <param>\n" +#~ "Les paramètre de l'analyseur lexical C prennent la forme -Sc<param>, où " +#~ "<param>\n" #~ "est l'un des suivants: (<cc> représente un ou plusieurs caractères)\n" -#~ " (+|-)u . . . . (Oui|Non) élimine les `_' au début d'un ids dans les chaînes.\n" -#~ " (+|-)s<cc> . . Autorise <cc> dans les chaînes ids, et (garde|ignore) ces ids.\n" +#~ " (+|-)u . . . . (Oui|Non) élimine les `_' au début d'un ids dans les " +#~ "chaînes.\n" +#~ " (+|-)s<cc> . . Autorise <cc> dans les chaînes ids, et (garde|ignore) ces " +#~ "ids.\n" #~ " -v . . . . . . Saute les commentaires inutiles." -#, possible-c-format #~ msgid "Usage: %s -S%s([-c<cc>] [-u] [(+|-)a<cc>] [(+|-)p] [(+|-)C])\n" #~ msgstr "Usage: %s -S%s([-c<cc>] [-u] [(+|-)a<cc>] [(+|-)p] [(+|-)C])\n" @@ -554,15 +682,16 @@ msgstr "" #~ " (+|-)p . . . . (Do|Don't) handle C-preprocessor directives.\n" #~ " (+|-)C . . . . (Do|Don't) handle C-style comments. (/* */)" #~ msgstr "" -#~ "Les paramètres de l'analyseur lexical Assembleur prennent la forme -Sasm<param>, où\n" +#~ "Les paramètres de l'analyseur lexical Assembleur prennent la forme " +#~ "-Sasm<param>, où\n" #~ "<param> est l'un des suivants: (<cc> représente un ou plusieurs caractères)\n" #~ " -c<cc> . . . . <cc> marque un commentaire jusqu'à la fin de la ligne.\n" #~ " (+|-)u . . . . (Oui|Non) élimine les `_' au dèbut de l'ids.\n" #~ " (+|-)a<cc> . . Autorise <cc> dans l'ids, et (garde|ignore) ces ids.\n" -#~ " (+|-)p . . . . (Oui|Non) prend en compte les directives du preprocesseur C.\n" +#~ " (+|-)p . . . . (Oui|Non) prend en compte les directives du preprocesseur " +#~ "C.\n" #~ " (+|-)C . . . . (Oui|Non) Autorise les commentaires en style C. (/* */)" -#, possible-c-format #~ msgid "Usage: %s -S%s([(+|-)a<cc>] [(+|-)s<cc>]\n" #~ msgstr "Usage: %s -S%s([(+|-)a<cc>] [(+|-)s<cc>]\n" @@ -572,7 +701,8 @@ msgstr "" #~ " (+|-)a<cc> . . Include (or exculde) <cc> in ids.\n" #~ " (+|-)s<cc> . . Squeeze (or don't squeeze) <cc> out of ids." #~ msgstr "" -#~ "Les paramètres de l'analyseur lexical texte prennent la forme -Stext<param>, où\n" +#~ "Les paramètres de l'analyseur lexical texte prennent la forme -Stext<param>, " +#~ "où\n" #~ "<param> est l'un des suivants: (<cc> représente un ou plusieurs caractères)\n" #~ " (+|-)a<cc> . . Inclure (ou non) <cc> dans l'ids.\n" #~ " (+|-)s<cc> . . Réduire (ou non) <cc> de l'ids." @@ -580,9 +710,9 @@ msgstr "" #~ msgid "open" #~ msgstr "ouvert" -#, possible-c-format #~ msgid "" -#~ "Usage: %s [-v] [-f<idfile>] [(+|-)l[<lang>]] [(+|-)S<scanarg>] [-a<argfile>] [-] [-u] [files...]\n" +#~ "Usage: %s [-v] [-f<idfile>] [(+|-)l[<lang>]] [(+|-)S<scanarg>] [-a<argfile>] " +#~ "[-] [-u] [files...]\n" #~ "\t-v\t Verbose: print reports of progress\n" #~ "\t-a<file> Open file for arguments\n" #~ "\t-\t Read newline-separated args from stdin\n" @@ -594,7 +724,8 @@ msgstr "" #~ "\n" #~ "Version %s; Made %s %s\n" #~ msgstr "" -#~ "Usage: %s [-v] [-f<idfichier>] [(+|-)l[<lang>]] [(+|-)S<chainerech>] [-a<fichparam>] [-] [-u] [fichiers...]\n" +#~ "Usage: %s [-v] [-f<idfichier>] [(+|-)l[<lang>]] [(+|-)S<chainerech>] " +#~ "[-a<fichparam>] [-] [-u] [fichiers...]\n" #~ "\t-v\t Bavard: donne des indications sur le déroulement\n" #~ "\t-a<fichier> Ouvre <fichier> pour lecture paramètres\n" #~ "\t-\t Lecture params séparés par un retour-chariot sur l'entrée standard\n" @@ -609,7 +740,6 @@ msgstr "" #~ msgid "modify" #~ msgstr "modifier" -#, possible-c-format #~ msgid "%s: No scanner for language: `%s'\n" #~ msgstr "%s: Pas d'analyseur lexical pour ce langage: `%s'\n" @@ -619,18 +749,17 @@ msgstr "" #~ msgid "malloc failure! \n" #~ msgstr "Échec malloc! \n" -#, fuzzy, possible-c-format +#, fuzzy #~ msgid "Usage: %s [-f<file>] [-u<n>] [-r<dir>] [-mewdoxasknc] patterns...\n" -#~ msgstr "Usage: %s [-f<fichier>] [-u<n>] [-r<repertoire>] [-mewdoxasknc] séquence...\n" +#~ msgstr "" +#~ "Usage: %s [-f<fichier>] [-u<n>] [-r<repertoire>] [-mewdoxasknc] séquence...\n" -#, possible-c-format #~ msgid "%s: please use only one of -c or -r\n" #~ msgstr "%s: utilisez soit -c soit -r\n" #~ msgid "exec" #~ msgstr "exéc" -#, possible-c-format #~ msgid "%s: Cannot %s `%s' (%s)\n" #~ msgstr "%s: Impossible %s `%s' (%s)\n" @@ -684,7 +813,9 @@ msgstr "" #~ msgstr "Pas assez de mémoire pour l'ensemble dans InitIid" #~ msgid "No memory for symbol table entry in InstallFile" -#~ msgstr "Pas assez de mémoire pour une entrée de la table des symboles dans InstallFile" +#~ msgstr "" +#~ "Pas assez de mémoire pour une entrée de la table des symboles dans " +#~ "InstallFile" #~ msgid "No memory for TheFiles in InstallFile" #~ msgstr "Pas assez de mémoire pour TheFiles dans InstallFile" @@ -708,7 +839,8 @@ msgstr "" #~ msgstr "Pas assez de mémoire pour l'ensemble dans SetIntersect" #~ msgid "No memory for set description in SetIntersect" -#~ msgstr "Pas assez de mémoire pour le descripteur d'ensemble dans SetIntersect" +#~ msgstr "" +#~ "Pas assez de mémoire pour le descripteur d'ensemble dans SetIntersect" #~ msgid "No memory for set in SetUnion" #~ msgstr "Pas assez de mémoire pour l'ensemble dans SetUnion" diff --git a/src/Makefile.am b/src/Makefile.am index 3d1b163..21ccc73 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -2,18 +2,19 @@ AUTOMAKE_OPTIONS = ansi2knr -bin_PROGRAMS = mkid lid fid idx -bin_SCRIPTS = eid aid gid pid defid +bin_PROGRAMS = mkid lid fid fnid xtokid +bin_SCRIPTS = eid aid gid defid EXTRA_DIST = ansi2knr.1 ansi2knr.c $(bin_SCRIPTS) localedir = $(datadir)/locale INCLUDES = -I. -I$(srcdir) \ + -I../libidu -I$(top_srcdir)/libidu \ -I../lib -I$(top_srcdir)/lib \ -I../intl -I$(top_srcdir)/intl \ -I.. -I$(top_srcdir) DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@ -LDADD = @INTLLIBS@ ../lib/libidu.a +LDADD = @INTLLIBS@ ../libidu/libidu.a ../lib/libsys.a $(PROGRAMS): $(LDADD) diff --git a/src/Makefile.in b/src/Makefile.in index 8ea0b5c..cda6580 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -40,19 +40,20 @@ transform = @program_transform_name@ AUTOMAKE_OPTIONS = ansi2knr -bin_PROGRAMS = mkid lid fid idx -bin_SCRIPTS = eid aid gid pid defid +bin_PROGRAMS = mkid lid fid fnid xtokid +bin_SCRIPTS = eid aid gid defid EXTRA_DIST = ansi2knr.1 ansi2knr.c $(bin_SCRIPTS) localedir = $(datadir)/locale INCLUDES = -I. -I$(srcdir) \ + -I../libidu -I$(top_srcdir)/libidu \ -I../lib -I$(top_srcdir)/lib \ -I../intl -I$(top_srcdir)/intl \ -I.. -I$(top_srcdir) DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@ -LDADD = @INTLLIBS@ ../lib/libidu.a +LDADD = @INTLLIBS@ ../libidu/libidu.a ../lib/libsys.a mkinstalldirs = $(top_srcdir)/mkinstalldirs CONFIG_HEADER = ../config.h PROGRAMS = $(bin_PROGRAMS) @@ -83,10 +84,14 @@ fid_SOURCES = fid.c fid_OBJECTS = fid$o EXTRA_fid_SOURCES = fid_LDADD = $(LDADD) -idx_SOURCES = idx.c -idx_OBJECTS = idx$o -EXTRA_idx_SOURCES = -idx_LDADD = $(LDADD) +fnid_SOURCES = fnid.c +fnid_OBJECTS = fnid$o +EXTRA_fnid_SOURCES = +fnid_LDADD = $(LDADD) +xtokid_SOURCES = xtokid.c +xtokid_OBJECTS = xtokid$o +EXTRA_xtokid_SOURCES = +xtokid_LDADD = $(LDADD) SCRIPTS = $(bin_SCRIPTS) DIST_COMMON = Makefile.am Makefile.in @@ -101,8 +106,8 @@ DEP_DISTFILES = $(DIST_COMMON) $(SOURCES) $(BUILT_SOURCES) $(HEADERS) \ $(TEXINFOS) $(INFO_DEPS) $(MANS) $(EXTRA_DIST) $(DATA) TAR = tar -SOURCES = mkid.c lid.c fid.c idx.c -OBJECTS = mkid$o lid$o fid$o idx$o +SOURCES = mkid.c lid.c fid.c fnid.c xtokid.c +OBJECTS = mkid$o lid$o fid$o fnid$o xtokid$o default: all @@ -189,10 +194,14 @@ $(fid_OBJECTS): ../config.h fid: $(fid_OBJECTS) $(fid_DEPENDENCIES) $(LINK) $(fid_OBJECTS) $(fid_LDADD) $(LIBS) -$(idx_OBJECTS): ../config.h +$(fnid_OBJECTS): ../config.h -idx: $(idx_OBJECTS) $(idx_DEPENDENCIES) - $(LINK) $(idx_OBJECTS) $(idx_LDADD) $(LIBS) +fnid: $(fnid_OBJECTS) $(fnid_DEPENDENCIES) + $(LINK) $(fnid_OBJECTS) $(fnid_LDADD) $(LIBS) +$(xtokid_OBJECTS): ../config.h + +xtokid: $(xtokid_OBJECTS) $(xtokid_DEPENDENCIES) + $(LINK) $(xtokid_OBJECTS) $(xtokid_LDADD) $(LIBS) install-binSCRIPTS: $(bin_SCRIPTS) $(mkinstalldirs) $(bindir) @@ -235,22 +244,32 @@ distdir: $(DEP_DISTFILES) || ln $(srcdir)/$$file $(distdir)/$$file 2> /dev/null \ || cp -p $(srcdir)/$$file $(distdir)/$$file; \ done -fid$o: fid.c system.h idfile.h \ - hash.h bitops.h filenames.h \ - misc.h strxtra.h alloc.h \ - token.h error.h pathmax.h -idx$o: idx.c alloc.h system.h \ - misc.h filenames.h scanners.h \ - idfile.h hash.h pathmax.h -lid$o: lid.c system.h alloc.h \ - idfile.h hash.h token.h \ - bitops.h strxtra.h misc.h \ - filenames.h error.h pathmax.h -mkid$o: mkid.c system.h pathmax.h \ - strxtra.h alloc.h idfile.h \ - hash.h token.h bitops.h \ - misc.h filenames.h scanners.h \ - error.h +fid$o: ../src/fid.c ../lib/xstring.h ../lib/xunistd.h \ + ../libidu/xnls.h ../libidu/idfile.h ../lib/xobstack.h \ + ../lib/xmalloc.h ../libidu/hash.h ../libidu/dynvec.h \ + ../libidu/tokflags.h ../lib/error.h ../lib/pathmax.h \ + ../lib/xalloca.h +fnid$o: ../src/fnid.c ../lib/xfnmatch.h ../lib/xstring.h \ + ../lib/xmalloc.h ../libidu/xnls.h ../libidu/idfile.h \ + ../lib/xobstack.h ../libidu/hash.h ../libidu/dynvec.h \ + ../libidu/tokflags.h ../lib/pathmax.h ../lib/error.h \ + ../lib/xalloca.h +lid$o: ../src/lid.c ../lib/xstdlib.h ../lib/xstring.h \ + ../lib/xunistd.h ../libidu/xnls.h ../lib/xmalloc.h \ + ../libidu/idfile.h ../lib/xobstack.h ../libidu/hash.h \ + ../libidu/dynvec.h ../libidu/tokflags.h ../lib/error.h \ + ../lib/pathmax.h ../lib/xalloca.h +mkid$o: ../src/mkid.c ../lib/xstdlib.h ../lib/xsysstat.h \ + ../lib/xstddef.h ../lib/xunistd.h ../libidu/xnls.h \ + ../lib/pathmax.h ../lib/xstring.h ../libidu/idfile.h \ + ../lib/xobstack.h ../lib/xmalloc.h ../libidu/hash.h \ + ../libidu/dynvec.h ../libidu/tokflags.h ../libidu/scanners.h \ + ../lib/error.h ../lib/xalloca.h +xtokid$o: ../src/xtokid.c ../libidu/xnls.h \ + ../libidu/scanners.h ../lib/xobstack.h ../lib/xmalloc.h \ + ../lib/xstring.h ../libidu/idfile.h ../libidu/hash.h \ + ../libidu/dynvec.h ../libidu/tokflags.h ../lib/pathmax.h \ + ../lib/error.h info: @@ -1,3 +1,3 @@ -#!/bin/sh +#! /bin/sh -lid -E "$@" +exec lid -ils "$@" @@ -1,6 +1,6 @@ -#!/bin/sh +#! /bin/sh for sym do - gid $sym |egrep '(}[ ]*|:[ ]*#[ ]*define[ ]+)'$sym'|'typedef\>.*[ ]+'$sym + gid $sym |egrep '(}[ ]*|:[ ]*#[ ]*define[ ]+)'$sym'|typedef\>.*[ ]+'$sym done @@ -1,3 +1,3 @@ -#!/bin/sh +#! /bin/sh -lid -E "$@" +exec lid -R edit "$@" @@ -1,5 +1,6 @@ /* fid.c -- list all tokens in the given file(s) Copyright (C) 1986, 1995, 1996 Free Software Foundation, Inc. + Written by Greg McGary <gkm@gnu.ai.mit.edu> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,27 +16,23 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include <config.h> #include <stdio.h> -#include <string.h> -#include <ctype.h> #include <getopt.h> - -#include <config.h> -#include "system.h" +#include "xstring.h" +#include "xunistd.h" +#include "xnls.h" #include "idfile.h" -#include "bitops.h" -#include "filenames.h" -#include "misc.h" -#include "strxtra.h" -#include "alloc.h" -#include "token.h" #include "error.h" #include "pathmax.h" +#include "xmalloc.h" +#include "xalloca.h" int get_file_index __P((char *file_name)); int is_hit __P((unsigned char const *hits, int file_number)); int is_hit_1 __P((unsigned char const **hits, int level, int file_number)); void skip_hits __P((unsigned char const **hits, int level)); +void usage __P((void)); struct idhead idh; int tree8_levels; @@ -54,8 +51,6 @@ static int show_version; /* The file name of the ID database. */ -char const *id_file_name; - struct file_link *cw_dlink; struct file_link **members_0; unsigned int bits_vec_size; @@ -81,13 +76,15 @@ static void help_me (void) { printf (_("\ -Usage: %s [OPTION] FILENAME [FILENAME2]\n"), - program_name); +Usage: %s [OPTION] FILENAME [FILENAME2]\n\ +"), program_name); printf (_("\ List identifiers that occur in FILENAME, or if FILENAME2 is\n\ also given list the identifiers that occur in both files.\n\ \n\ - -f, --file=FILE file name of ID database\n\ + -f, --file=FILE file name of ID database\n\ + --help display this help and exit\n\ + --version output version information and exit\n\ ")); exit (0); } @@ -95,11 +92,19 @@ also given list the identifiers that occur in both files.\n\ int main (int argc, char **argv) { - int optc; int index_1 = -1; int index_2 = -1; program_name = argv[0]; + idh.idh_file_name = 0; + + /* Set locale according to user's wishes. */ + setlocale (LC_ALL, ""); + + /* Tell program which translations to use and where to find. */ + bindtextdomain (PACKAGE, LOCALEDIR); + textdomain (PACKAGE); + for (;;) { int optc = getopt_long (argc, argv, "f:", @@ -112,7 +117,7 @@ main (int argc, char **argv) break; case 'f': - id_file_name = optarg; + idh.idh_file_name = optarg; break; default: @@ -129,22 +134,6 @@ main (int argc, char **argv) if (show_help) help_me (); - /* Look for the ID database up the tree */ - id_file_name = look_up (id_file_name); - if (id_file_name == 0) - error (1, errno, _("can't locate `ID'")); - - init_idh_obstacks (&idh); - init_idh_tables (&idh); - - cw_dlink = get_current_dir_link (); - - /* Determine absolute name of the directory name to which database - constituent files are relative. */ - members_0 = read_id_file (id_file_name, &idh); - bits_vec_size = (idh.idh_files + 7) / 4; /* more than enough */ - tree8_levels = tree8_count_levels (idh.idh_files); - argc -= optind; argv += optind; if (argc < 1) @@ -158,6 +147,22 @@ main (int argc, char **argv) usage (); } + /* Look for the ID database up the tree */ + idh.idh_file_name = locate_id_file_name (idh.idh_file_name); + if (idh.idh_file_name == 0) + error (1, errno, _("can't locate `ID'")); + + init_idh_obstacks (&idh); + init_idh_tables (&idh); + + cw_dlink = get_current_dir_link (); + + /* Determine absolute name of the directory name to which database + constituent files are relative. */ + members_0 = read_id_file (idh.idh_file_name, &idh); + bits_vec_size = (idh.idh_files + 7) / 4; /* more than enough */ + tree8_levels = tree8_count_levels (idh.idh_files); + index_1 = get_file_index ((argc--, *argv++)); if (argc) index_2 = get_file_index ((argc--, *argv++)); @@ -168,16 +173,25 @@ main (int argc, char **argv) hits_buf = xmalloc (idh.idh_buf_size); fseek (idh.idh_FILE, idh.idh_tokens_offset, SEEK_SET); { + int count = 0; int i; + int separator = (isatty (STDOUT_FILENO) ? ' ' : '\n'); + for (i = 0; i < idh.idh_tokens; i++) { unsigned char const *hits; - + gets_past_00 (hits_buf, idh.idh_FILE); - hits = tok_hits_addr (hits_buf); + hits = token_hits_addr (hits_buf); if (is_hit (hits, index_1) && (index_2 < 0 || is_hit (hits, index_2))) - printf ("%s\n", tok_string (hits_buf)); + { + fputs (token_string (hits_buf), stdout); + putchar (separator); + count++; + } } + if (count && separator == ' ') + putchar ('\n'); } return 0; @@ -191,11 +205,11 @@ get_file_index (char *file_name) struct file_link *fn_flink = 0; int has_slash = (strchr (file_name, '/') != 0); int file_name_length = strlen (file_name); - int index = -1; + int idx = -1; if (strstr (file_name, "./")) fn_flink = parse_file_name (file_name, cw_dlink); - + for (members = members_0; members < end; members++) { struct file_link *flink = *members; @@ -206,26 +220,26 @@ get_file_index (char *file_name) } else if (has_slash) { - char buf[PATH_MAX]; + char *file_name = ALLOCA (char, PATH_MAX); int member_length; - maybe_relative_path (buf, flink, cw_dlink); - member_length = strlen (buf); + maybe_relative_file_name (file_name, flink, cw_dlink); + member_length = strlen (file_name); if (file_name_length > member_length - || !strequ (&buf[member_length - file_name_length], file_name)) + || !strequ (&file_name[member_length - file_name_length], file_name)) continue; } else if (!strequ (flink->fl_name, file_name)) continue; - if (index >= 0) + if (idx >= 0) { error (0, 0, _("`%s' is ambiguous"), file_name); - return; + return -1; } - index = members - members_0; + idx = members - members_0; } - if (index < 0) + if (idx < 0) error (0, 0, _("`%s' not found"), file_name); - return index; + return idx; } int @@ -1,3 +1,3 @@ -#!/bin/sh +#! /bin/sh -lid -E "$@" +exec lid -R grep "$@" @@ -1,5 +1,6 @@ /* lid.c -- primary query interface for mkid database Copyright (C) 1986, 1995, 1996 Free Software Foundation, Inc. + Written by Greg McGary <gkm@gnu.ai.mit.edu> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,95 +16,131 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include <stdlib.h> -#include <unistd.h> +#include <config.h> #include <stdio.h> -#include <string.h> #include <ctype.h> +#include "xstdlib.h" #include <signal.h> #include <errno.h> #include <sys/types.h> #include <sys/wait.h> #include <assert.h> -#include <limits.h> +#include <getopt.h> +#include "xstring.h" +#include "xunistd.h" +#include "xnls.h" +#include "xmalloc.h" +#include "idfile.h" +#include "xstring.h" +#include "error.h" +#include "pathmax.h" +#include "xalloca.h" +#if HAVE_LIMITS_H +# include <limits.h> +#endif #if WITH_REGEX # include <regex.h> #else # include <rx.h> #endif -#include <config.h> -#include <getopt.h> -#include "system.h" -#include "alloc.h" -#include "idfile.h" -#include "token.h" -#include "bitops.h" -#include "strxtra.h" -#include "misc.h" -#include "filenames.h" -#include "error.h" -#include "pathmax.h" - typedef void (*report_func_t) __P((char const *name, struct file_link **flinkv)); typedef int (*query_func_t) __P((char const *arg, report_func_t)); -unsigned char *tree8_to_bits __P((unsigned char *bits_vec, unsigned char const *hits_tree8)); -void tree8_to_bits_1 __P((unsigned char **bits_vec, unsigned char const **hits_tree8, int level)); -struct file_link **tree8_to_flinkv __P((unsigned char const *hits_tree8)); -struct file_link **bits_to_flinkv __P((unsigned char const *bits_vec)); +enum delimiter_style +{ + ds_bogus, + ds_contextual, + ds_word, + ds_substring +}; + +enum pattern_style +{ + ps_bogus, + ps_contextual, + ps_literal, + ps_regexp +}; + +enum key_style +{ + ks_bogus, + ks_none, + ks_token, + ks_pattern +}; + +enum result_style +{ + rs_bogus, + rs_none, + rs_filenames, + rs_grep, + rs_edit +}; + +enum radix +{ + radix_oct = 1, + radix_dec = 2, + radix_hex = 4, + radix_all = radix_dec | radix_oct | radix_hex +}; void usage __P((void)); static void help_me __P((void)); -int common_prefix_suffix __P((struct file_link const *flink_1, struct file_link const *flink_2)); -int member_file_index_qsort_compare __P((void const *x, void const *y)); -void look_id __P((char const *name, struct file_link **flinkv)); -void grep_id __P((char const *name, struct file_link **flinkv)); -void edit_id __P((char const *name, struct file_link **flinkv)); +void lower_caseify __P((char *str)); +enum key_style parse_key_style __P((char const *arg)); +enum result_style parse_result_style __P((char const *arg)); +query_func_t get_query_func __P((char *pattern)); +report_func_t get_report_func __P((void)); +void report_filenames __P((char const *name, struct file_link **flinkv)); +void report_grep __P((char const *name, struct file_link **flinkv)); +void report_edit __P((char const *name, struct file_link **flinkv)); +void report_nothing __P((char const *name, struct file_link **flinkv)); int vector_cardinality __P((void *vector)); -int skip_to_argv __P((struct file_link **flinkv)); -int query_plain __P((char const *arg, report_func_t report_function)); -int query_anchor __P((char const *arg, report_func_t report_function)); -int query_regexp __P((char const *arg, report_func_t report_function)); -int query_number __P((char const *arg, report_func_t report_function)); -int query_non_unique __P((unsigned int, report_func_t report_function)); -int query_apropos __P((char const *arg, report_func_t report_function)); +int search_flinkv __P((struct file_link **flinkv)); +int query_literal_word __P((char const *pattern, report_func_t report_func)); +int query_literal_prefix __P((char const *pattern, report_func_t report_func)); +int query_regexp __P((char const *pattern_0, report_func_t report_func)); +char const *maybe_add_word_delimiters __P((char const *pattern_0)); +int query_number __P((char const *pattern, report_func_t report_func)); +int query_ambiguous_prefix __P((unsigned int, report_func_t report_func)); +int query_literal_substring __P((char const *pattern, report_func_t report_func)); void parse_frequency_arg __P((char const *arg)); -int frequency_wanted __P((char const *tok)); -char const *strcpos __P((char const *s1, char const *s2)); -char const *file_regexp __P((char const *name0, char const *left_delimit, char const *right_delimit)); -off_t query_token __P((char const *token)); +int desired_frequency __P((char const *tok)); +char *strcasestr __P((char const *s1, char const *s2)); +char const *file_regexp __P((char const *name_0, char const *left_delimit, char const *right_delimit)); +off_t query_binary_search __P((char const *token)); int is_regexp __P((char *name)); +int has_left_delimiter __P((char const *pattern)); +int has_right_delimiter __P((char const *pattern)); int file_name_wildcard __P((char const *re, char const *fn)); -int word_match __P((char const *name0, char const *line)); -int get_radix __P((char const *name)); -int stoi __P((char const *name)); -int otoi __P((char const *name)); -int dtoi __P((char const *name)); -int xtoi __P((char const *name)); +int word_match __P((char const *name_0, char const *line)); +int get_radix __P((char const *str)); +int is_number __P((char const *str)); +int stoi __P((char const *str)); +int otoi __P((char const *str)); +int dtoi __P((char const *str)); +int xtoi __P((char const *str)); +unsigned char *tree8_to_bits __P((unsigned char *bits_vec, unsigned char const *hits_tree8)); +void tree8_to_bits_1 __P((unsigned char **bits_vec, unsigned char const **hits_tree8, int level)); +struct file_link **tree8_to_flinkv __P((unsigned char const *hits_tree8)); +struct file_link **bits_to_flinkv __P((unsigned char const *bits_vec)); + +#if HAVE_TERMIOS_H || HAVE_TERMIO_H || HAVE_SGTTY_H void savetty __P((void)); void restoretty __P((void)); void linetty __P((void)); void chartty __P((void)); - -enum radix { - radix_oct = 1, - radix_dec = 2, - radix_hex = 4, - radix_all = radix_dec | radix_oct | radix_hex -}; +#endif #define TOLOWER(c) (isupper (c) ? tolower (c) : (c)) #define IS_ALNUM(c) (isalnum (c) || (c) == '_') -#ifndef BRACE_NOTATION_DEFAULT -#define BRACE_NOTATION_DEFAULT 1 -#endif - /* Sorry about all the globals, but it's really cleaner this way. */ -int merging; -int file_name_regexp = 0; char anchor_dir[BUFSIZ]; int tree8_levels; unsigned int bits_vec_size; @@ -128,44 +165,42 @@ static int show_version; int radix_flag = radix_all; -/* If nonzero, don't print the name of the matched identifier. */ +/* If nonzero, ignore differences in alphabetic case while matching. */ + +int ignore_case_flag = 0; -int no_id_flag = 0; +/* How will patterns will be delimited? */ -/* If nonzero, merge multiple look_id regexp output lines into a - single line. */ +enum delimiter_style delimiter_style = ds_contextual; -int merge_flag = 0; +/* How will patterns be interpreted? */ -/* If nonzero, ignore differences in alphabetic case while matching. */ +enum pattern_style pattern_style = ps_contextual; -int ignore_case_flag = 0; +/* How will keys be presented? */ + +enum key_style key_style = ks_token; + +/* How will query results be presented? */ + +enum result_style result_style = rs_filenames; -/* If nonzero, print file names in abbreviated fashion using the - shell's brace notation. */ +/* How shall we separate file names when result_style == rs_filenames? */ -int brace_notation_flag = BRACE_NOTATION_DEFAULT; +enum separator_style separator_style = ss_contextual; /* If non-zero, list identifiers that are are non-unique within this number of leading characters. */ unsigned int ambiguous_prefix_length = 0; -/* The file name of the ID database. */ - -char const *id_file_name; - /* The style of report. */ -report_func_t report_function = look_id; +report_func_t report_function; /* The style of query. */ -query_func_t query_func; - -/* The style of query explicitly set by user from the command-line. */ - -query_func_t forced_query_func; +query_func_t query_function; /* Lower and upper bounds on occurrence frequency. */ @@ -180,18 +215,17 @@ static struct option const long_options[] = { "file", required_argument, 0, 'f' }, { "frequency", required_argument, 0, 'F' }, { "ambiguous", required_argument, 0, 'a' }, - { "grep", no_argument, 0, 'G' }, - { "apropos", no_argument, 0, 'A' }, - { "edit", no_argument, 0, 'E' }, - { "regexp", no_argument, 0, 'e' }, - { "braces", no_argument, 0, 'b' }, - { "merge", no_argument, 0, 'm' }, + { "key", required_argument, 0, 'k' }, + { "result", required_argument, 0, 'R' }, + { "separator", required_argument, 0, 'S' }, { "ignore-case", no_argument, 0, 'i' }, + { "literal", no_argument, 0, 'l' }, + { "regexp", no_argument, 0, 'r' }, { "word", no_argument, 0, 'w' }, + { "substring", no_argument, 0, 's' }, { "hex", no_argument, 0, 'x' }, { "decimal", no_argument, 0, 'd' }, { "octal", no_argument, 0, 'o' }, - { "no-id", no_argument, 0, 'n' }, { "help", no_argument, &show_help, 1 }, { "version", no_argument, &show_version, 1 }, { 0 } @@ -209,41 +243,46 @@ static void help_me (void) { printf (_("\ -Usage: %s [OPTION]... PATTERN...\n"), - program_name); +Usage: %s [OPTION]... PATTERN...\n\ +"), program_name); + printf (_("\ Query ID database and report results.\n\ By default, output consists of multiple lines, each line containing the\n\ matched identifier followed by the list of file names in which it occurs.\n\ \n\ - -f, --file=FILE file name of ID database\n\ - -G, --grep show every line where the matched identifier occurs\n\ - -E, --edit edit every file where the matched identifier occurs\n\ - -m, --merge output a multi-line regexp match as a single line\n\ - -n, --no-id print file names only - omit the identifier\n\ - -b, --braces toggle shell brace-notation for output file names\n\ + -f, --file=FILE file name of ID database\n\ \n\ -If PATTERN contains regular expression metacharacters, it is interpreted\n\ -as a regular expression. Otherwise, PATTERN is interpreted as a literal\n\ -word.\n\ + -i, --ignore-case match PATTERN case insensitively\n\ + -l, --literal match PATTERN as a literal string\n\ + -r, --regexp match PATTERN as a regular expression\n\ + -w, --word match PATTERN as a delimited word\n\ + -s, --substring match PATTERN as a substring\n\ + Note: If PATTERN contains extended regular expression meta-\n\ + characters, it is interpreted as a regular expression substring.\n\ + Otherwise, PATTERN is interpreted as a literal word.\n\ \n\ - -e, --regexp match PATTERN as a regular expression substring\n\ - -w, --word match PATTERN as a word\n\ - -i, --ignore-case match PATTERN case insinsitively\n\ - -A, --apropos match PATTERN as a case-insensitive substring\n\ + -k, --key=STYLE STYLE is one of `token', `pattern' or `none'\n\ + -R, --result=STYLE STYLE is one of `filenames', `grep', `edit' or `none'\n\ + -S, --separator=STYLE STYLE is one of `braces', `space' or `newline' and\n\ + only applies to file names when `--result=filenames'\n\ + The above STYLE options control how query results are presented.\n\ + Defaults are --key=token --result=filenames --separator=%s\n\ \n\ - -F, --frequency=FREQ find identifiers that occur FREQ times, where FREQ\n\ - is a range expressed as `N..M'. N omitted defaults\n\ - to 1, M omitted defaults to MAX_USHRT.\n\ - -a, --ambiguous=LEN find identifiers whose names are ambiguous for LEN chars\n\ + -F, --frequency=FREQ find tokens that occur FREQ times, where FREQ\n\ + is a range expressed as `N..M'. If N is omitted, it\n\ + defaults to 1, if M is omitted it defaults to MAX_USHRT\n\ + -a, --ambiguous=LEN find tokens whose names are ambiguous for LEN chars\n\ \n\ - -x, --hex only find numbers expressed as hexadecimal\n\ - -d, --decimal only find numbers expressed as decimal\n\ - -o, --octal only find numbers expressed as octal\n\ + -x, --hex only find numbers expressed as hexadecimal\n\ + -d, --decimal only find numbers expressed as decimal\n\ + -o, --octal only find numbers expressed as octal\n\ + By default, searches match numbers of any radix.\n\ \n\ - --help display this help and exit\n\ - --version output version information and exit\n\ -")); + --help display this help and exit\n\ + --version output version information and exit\n\ +"), + (separator_style == ss_braces ? _("braces") : _("space"))); exit (0); } @@ -251,9 +290,18 @@ int main (int argc, char **argv) { program_name = argv[0]; + idh.idh_file_name = 0; + + /* Set locale according to user's wishes. */ + setlocale (LC_ALL, ""); + + /* Tell program which translations to use and where to find. */ + bindtextdomain (PACKAGE, LOCALEDIR); + textdomain (PACKAGE); + for (;;) { - int optc = getopt_long (argc, argv, "f:F:a:GAEebmiwxdon", + int optc = getopt_long (argc, argv, "f:F:a:k:R:S:ilrwsxdo", long_options, (int *) 0); if (optc < 0) break; @@ -263,7 +311,7 @@ main (int argc, char **argv) break; case 'f': - id_file_name = optarg; + idh.idh_file_name = optarg; break; case 'F': @@ -274,38 +322,41 @@ main (int argc, char **argv) ambiguous_prefix_length = stoi (optarg); break; - case 'G': - report_function = grep_id; + case 'k': + key_style = parse_key_style (optarg); break; - case 'A': - forced_query_func = query_apropos; - report_function = look_id; + case 'R': + result_style = parse_result_style (optarg); break; - - case 'E': - report_function = edit_id; + + case 'S': + separator_style = parse_separator_style (optarg); break; - case 'e': - forced_query_func = query_regexp; - file_name_regexp = 1; + case 'i': + ignore_case_flag = REG_ICASE; break; - case 'b': - brace_notation_flag = !brace_notation_flag; + case 'l': + pattern_style = ps_literal; break; - case 'm': - merge_flag = 1; + case 'r': + pattern_style = ps_regexp; break; - case 'i': - ignore_case_flag = REG_ICASE; + case 'e': + pattern_style = ps_regexp; + error (0, 0, _("notice: use of `-e' is deprecated, use `-r' instead")); break; case 'w': - forced_query_func = query_plain; + delimiter_style = ds_word; + break; + + case 's': + delimiter_style = ds_substring; break; case 'x': @@ -320,10 +371,6 @@ main (int argc, char **argv) radix_flag |= radix_oct; break; - case 'n': - no_id_flag = 1; - break; - default: usage (); } @@ -338,11 +385,30 @@ main (int argc, char **argv) if (show_help) help_me (); + if (separator_style == ss_contextual) + { + if (isatty (STDOUT_FILENO)) + separator_style = DEFAULT_SEPARATOR_STYLE; + else if (key_style == ks_none) + separator_style = ss_newline; + else + separator_style = ss_space; + } + + argc -= optind; + argv += optind; + if (argc == 0) + { + static char *dot = (char *) "."; + argc = 1; + argv = ˙ + } + /* Look for the ID database up the tree */ - id_file_name = look_up (id_file_name); - if (id_file_name == 0) + idh.idh_file_name = locate_id_file_name (idh.idh_file_name); + if (idh.idh_file_name == 0) error (1, errno, _("can't locate `ID'")); - + init_idh_obstacks (&idh); init_idh_tables (&idh); @@ -350,138 +416,131 @@ main (int argc, char **argv) /* Determine absolute name of the directory name to which database constituent files are relative. */ - members_0 = read_id_file (id_file_name, &idh); + members_0 = read_id_file (idh.idh_file_name, &idh); bits_vec_size = (idh.idh_files + 7) / 4; /* more than enough */ tree8_levels = tree8_count_levels (idh.idh_files); - argc -= optind; - argv += optind; - if (argc == 0) + hits_buf_1 = MALLOC (char, idh.idh_buf_size); + hits_buf_2 = MALLOC (char, idh.idh_buf_size); + bits_vec = MALLOC (unsigned char, bits_vec_size); + + report_function = get_report_func (); + if (ambiguous_prefix_length) { - argc++; - *(char const **)--argv = ".*"; + if (!query_ambiguous_prefix (ambiguous_prefix_length, report_function)) + fprintf (stderr, _("All identifiers are non-ambiguous within the first %d characters\n"), + ambiguous_prefix_length); } - - while (argc) + else { - long val = -1; - char *arg = (argc--, *argv++); - - if (forced_query_func) - query_func = forced_query_func; - else if (get_radix (arg) && (val = stoi (arg)) >= 0) - query_func = query_number; - else if (is_regexp (arg)) - query_func = query_regexp; - else if (arg[0] == '^') - query_func = query_anchor; - else - query_func = query_plain; - - if ((report_function == look_id && !merge_flag) - || (query_func == query_number - && val > 7 - && radix_flag != radix_dec - && radix_flag != radix_oct - && radix_flag != radix_hex)) - merging = 0; - else - merging = 1; - - hits_buf_1 = xmalloc (idh.idh_buf_size); - hits_buf_2 = xmalloc (idh.idh_buf_size); - bits_vec = MALLOC (unsigned char, bits_vec_size); - - if (ambiguous_prefix_length) - { - if (!query_non_unique (ambiguous_prefix_length, report_function)) - fprintf (stderr, _("All identifiers are non-ambiguous within the first %d characters\n"), - ambiguous_prefix_length); - exit (0); - } - else if (!(*query_func) (arg, report_function)) + while (argc) { - fprintf (stderr, _("%s: not found\n"), arg); - continue; + char *pattern = (argc--, *argv++); + if (ignore_case_flag) + lower_caseify (pattern); + query_function = get_query_func (pattern); + (*query_function) (pattern, report_function); } } + fclose (idh.idh_FILE); exit (0); } -/* common_prefix_suffix returns non-zero if two file names have a - fully common directory prefix and a common suffix (i.e., they're - eligible for coalescing with brace notation. */ +void +lower_caseify (char *str) +{ + while (*str) + { + *str = TOLOWER (*str); + str++; + } +} -int -common_prefix_suffix (struct file_link const *flink_1, struct file_link const *flink_2) +enum key_style +parse_key_style (char const *arg) { - return (flink_1->fl_parent == flink_2->fl_parent - && strequ (suff_name (flink_1->fl_name), suff_name (flink_2->fl_name))); + MAYBE_RETURN_PREFIX_MATCH (arg, "none", ks_none); + MAYBE_RETURN_PREFIX_MATCH (arg, "token", ks_token); + MAYBE_RETURN_PREFIX_MATCH (arg, "pattern", ks_pattern); + error (0, 0, _("invalid `--key' style: `%s'"), arg); + usage (); + return ks_bogus; } -void -look_id (char const *name, struct file_link **flinkv) +enum result_style +parse_result_style (char const *arg) { - struct file_link const *arg; - struct file_link const *dlink; - int brace_is_open = 0; + MAYBE_RETURN_PREFIX_MATCH (arg, "none", rs_none); + MAYBE_RETURN_PREFIX_MATCH (arg, "filenames", rs_filenames); + MAYBE_RETURN_PREFIX_MATCH (arg, "grep", rs_grep); + MAYBE_RETURN_PREFIX_MATCH (arg, "edit", rs_edit); + error (0, 0, _("invalid `--result' style: `%s'"), arg); + usage (); + return rs_bogus; +} - if (!no_id_flag) - printf ("%-14s ", name); - while (*flinkv) +query_func_t +get_query_func (char *pattern) +{ + switch (pattern_style) { - arg = *flinkv++; - if (*flinkv && brace_notation_flag - && common_prefix_suffix (arg, *flinkv)) - { - if (brace_is_open) - printf (",%s", root_name (arg->fl_name)); - else - { - dlink = arg->fl_parent; - if (dlink && dlink != cw_dlink) - { - char buf[PATH_MAX]; - maybe_relative_path (buf, dlink, cw_dlink); - fputs (buf, stdout); - putchar ('/'); - } - printf ("{%s", root_name (arg->fl_name)); - } - brace_is_open = 1; - } + case ps_regexp: + return query_regexp; + + case ps_literal: + if (delimiter_style == ds_substring) + return query_literal_substring; else - { - if (brace_is_open) - printf (",%s}%s", root_name (arg->fl_name), suff_name (arg->fl_name)); - else - { - char buf[PATH_MAX]; - maybe_relative_path (buf, arg, cw_dlink); - fputs (buf, stdout); - } - brace_is_open = 0; - if (*flinkv) - putchar (' '); - } + return query_literal_word; + + default: + if (is_regexp (pattern)) + return query_regexp; + else if (has_left_delimiter (pattern)) + return query_literal_prefix; + else if (delimiter_style == ds_substring) + return query_literal_substring; + else if (is_number (pattern)) + return query_number; + else if (delimiter_style == ds_word) + return query_literal_word; + else + return query_literal_word; } - putchar ('\n'); } -/* FIXME: use regcomp regexec */ +report_func_t +get_report_func (void) +{ + switch (result_style) + { + case rs_filenames: return report_filenames; + case rs_grep: return report_grep; + case rs_edit: return report_edit; + default: return report_nothing; + } +} + +void +report_filenames (char const *name, struct file_link **flinkv) +{ + if (name && key_style != ks_none) + printf ("%-14s ", name); + print_filenames (flinkv, separator_style); +} void -grep_id (char const *name, struct file_link **flinkv) +report_grep (char const *name, struct file_link **flinkv) { char line[BUFSIZ]; char const *pattern = 0; regex_t compiled; int line_number; - if (merging) + if (key_style == ks_pattern) { - pattern = file_regexp (name, "[^a-zA-Z0-9_À-ÿ]_*", "[^a-zA-Z0-9_À-ÿ]"); + pattern = file_regexp (name, "[^a-zA-Z0-9_\300-\377]_*", "[^a-zA-Z0-9_\300-\377]"); if (pattern) { int regcomp_errno = regcomp (&compiled, pattern, @@ -498,10 +557,10 @@ grep_id (char const *name, struct file_link **flinkv) line[0] = ' '; /* sentry */ while (*flinkv) { + char *file_name = ALLOCA (char, PATH_MAX); FILE *gid_FILE; - char file_name[PATH_MAX]; - maybe_relative_path (file_name, *flinkv++, cw_dlink); + maybe_relative_file_name (file_name, *flinkv++, cw_dlink); gid_FILE = fopen (file_name, "r"); if (gid_FILE == 0) error (0, errno, "can't open `%s'", file_name); @@ -520,20 +579,20 @@ grep_id (char const *name, struct file_link **flinkv) } else if (!word_match (name, line)) continue; - printf ("%s:%d: %s", file_name, line_number, &line[1]); + printf ("%s:%d:%s", file_name, line_number, &line[1]); } fclose (gid_FILE); } } void -edit_id (char const *name, struct file_link **flinkv) +report_edit (char const *name, struct file_link **flinkv) { static char const *editor; static char const *eid_arg; static char const *eid_right_del; static char const *eid_left_del; - char re_buffer[BUFSIZ]; + char regexp_buf[BUFSIZ]; char ed_arg_buffer[BUFSIZ]; char const *pattern; int c; @@ -541,9 +600,13 @@ edit_id (char const *name, struct file_link **flinkv) if (editor == 0) { - editor = getenv ("EDITOR"); + editor = getenv ("VISUAL"); if (editor == 0) - editor = "vi"; + { + editor = getenv ("EDITOR"); + if (editor == 0) + editor = "vi"; + } } if (eid_arg == 0) @@ -563,55 +626,53 @@ edit_id (char const *name, struct file_link **flinkv) eid_right_del = (using_vi ? "\\>" : ""); } - look_id (name, flinkv); + report_filenames (name, flinkv); savetty (); for (;;) { - /* FIXME: i18n */ - printf (_("Edit? [y1-9^S/nq] ")); + /* FIXME: i18n of responses */ + printf (_("edit? [y1-9^S/nq] ")); fflush (stdout); chartty (); c = (getchar () & 0177); restoretty (); switch (TOLOWER (c)) { - case '/': - case ('s' & 037): + case '/': case ('s' & 037): putchar ('/'); - skip = skip_to_flinkv (flinkv); + skip = search_flinkv (flinkv); if (skip < 0) continue; flinkv += skip; goto editit; - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': + + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': putchar (c); skip = c - '0'; break; + case 'y': putchar (c); skip = 0; break; + case '\n': case '\r': putchar ('y'); skip = 0; break; + case 'q': putchar (c); putchar ('\n'); exit (0); + case 'n': putchar (c); putchar ('\n'); return; + default: putchar (c); putchar ('\n'); @@ -626,14 +687,14 @@ edit_id (char const *name, struct file_link **flinkv) } editit: - if (merging) + if (key_style == ks_pattern) pattern = file_regexp (name, eid_left_del, eid_right_del); else pattern = 0; if (pattern == 0) { - pattern = re_buffer; - sprintf (re_buffer, "%s%s%s", eid_left_del, name, eid_right_del); + pattern = regexp_buf; + sprintf (regexp_buf, "%s%s%s", eid_left_del, name, eid_right_del); } switch (fork ()) @@ -647,11 +708,7 @@ editit: char **argv_0 = MALLOC (char *, 3 + vector_cardinality (flinkv)); char **argv = argv_0 + 2; while (*flinkv) - { - char buf[PATH_MAX]; - maybe_relative_path (buf, *flinkv++, cw_dlink); - *argv++ = strdup (buf); - } + *argv++ = maybe_relative_file_name (0, *flinkv++, cw_dlink); *argv = 0; argv = argv_0 + 1; if (eid_arg) @@ -659,7 +716,7 @@ editit: sprintf (ed_arg_buffer, eid_arg, pattern); *--argv = ed_arg_buffer; } - *(char const **)argv = editor; + *(char const **) argv = editor; execvp (editor, argv); error (0, errno, _("can't exec `%s'"), editor); } @@ -679,10 +736,17 @@ editit: } } +void +report_nothing (char const *name, struct file_link **flinkv) +{ + if (key_style != ks_none) + puts (name); +} + int vector_cardinality (void *vector) { - void **v = (void **)vector; + void **v = (void **) vector; int count = 0; while (*v++) @@ -691,7 +755,7 @@ vector_cardinality (void *vector) } int -skip_to_flinkv (struct file_link **flinkv) +search_flinkv (struct file_link **flinkv) { char pattern[BUFSIZ]; unsigned int count; @@ -701,66 +765,68 @@ skip_to_flinkv (struct file_link **flinkv) for (count = 0; *flinkv; count++, flinkv++) { - char buf[PATH_MAX]; - maybe_relative_path (buf, *flinkv, cw_dlink); - if (strcpos (buf, pattern)) + char *file_name = ALLOCA (char, PATH_MAX); + maybe_relative_file_name (file_name, *flinkv, cw_dlink); + if (strcasestr (file_name, pattern)) return count; } return -1; } int -query_plain (char const *arg, report_func_t report_function) +query_literal_word (char const *arg, report_func_t report_func) { - if (query_token (arg) == 0) + if (query_binary_search (arg) == 0) return 0; gets_past_00 (hits_buf_1, idh.idh_FILE); assert (*hits_buf_1); - if (!frequency_wanted (hits_buf_1)) + if (!desired_frequency (hits_buf_1)) return 0; - (*report_function) (hits_buf_1, tree8_to_flinkv (tok_hits_addr (hits_buf_1))); + (*report_func) (hits_buf_1, tree8_to_flinkv (token_hits_addr (hits_buf_1))); return 1; } int -query_anchor (char const *arg, report_func_t report_function) +query_literal_prefix (char const *arg, report_func_t report_func) { int count; unsigned int length; - if (query_token (++arg) == 0) + if (query_binary_search (++arg) == 0) return 0; length = strlen (arg); count = 0; - if (merging) + if (key_style != ks_token) memset (bits_vec, 0, bits_vec_size); while (gets_past_00 (hits_buf_1, idh.idh_FILE) > 0) { assert (*hits_buf_1); - if (!frequency_wanted (hits_buf_1)) + if (!desired_frequency (hits_buf_1)) continue; if (!strnequ (arg, hits_buf_1, length)) break; - if (merging) - tree8_to_bits (bits_vec, tok_hits_addr (hits_buf_1)); + if (key_style == ks_token) + (*report_func) (hits_buf_1, tree8_to_flinkv (token_hits_addr (hits_buf_1))); else - (*report_function) (hits_buf_1, tree8_to_flinkv (tok_hits_addr (hits_buf_1))); + tree8_to_bits (bits_vec, token_hits_addr (hits_buf_1)); count++; } - if (merging && count) - (*report_function) (--arg, bits_to_flinkv (bits_vec)); + if (key_style != ks_token && count) + (*report_func) (--arg, bits_to_flinkv (bits_vec)); return count; } int -query_regexp (char const *pattern, report_func_t report_function) +query_regexp (char const *pattern_0, report_func_t report_func) { int count; regex_t compiled; int regcomp_errno; + char const *pattern = pattern_0; + pattern = maybe_add_word_delimiters (pattern); regcomp_errno = regcomp (&compiled, pattern, ignore_case_flag | REG_EXTENDED); if (regcomp_errno) @@ -772,33 +838,66 @@ query_regexp (char const *pattern, report_func_t report_function) fseek (idh.idh_FILE, idh.idh_tokens_offset, SEEK_SET); count = 0; - if (merging) + if (key_style != ks_token) memset (bits_vec, 0, bits_vec_size); while (gets_past_00 (hits_buf_1, idh.idh_FILE) > 0) { int regexec_errno; assert (*hits_buf_1); - if (!frequency_wanted (hits_buf_1)) + if (!desired_frequency (hits_buf_1)) continue; regexec_errno = regexec (&compiled, hits_buf_1, 0, 0, 0); if (regexec_errno == REG_ESPACE) error (0, 0, _("can't match regular-expression: memory exhausted")); else if (regexec_errno) continue; - if (merging) - tree8_to_bits (bits_vec, tok_hits_addr (hits_buf_1)); + if (key_style == ks_token) + (*report_func) (hits_buf_1, tree8_to_flinkv (token_hits_addr (hits_buf_1))); else - (*report_function) (hits_buf_1, tree8_to_flinkv (tok_hits_addr (hits_buf_1))); + tree8_to_bits (bits_vec, token_hits_addr (hits_buf_1)); count++; } - if (merging && count) - (*report_function) (pattern, bits_to_flinkv (bits_vec)); + if (key_style != ks_token && count) + (*report_func) (pattern, bits_to_flinkv (bits_vec)); + + if (pattern != pattern_0) + free ((char *) pattern); return count; } +char const * +maybe_add_word_delimiters (char const *pattern_0) +{ + if (delimiter_style != ds_word) + return pattern_0; + else + { + int length = strlen (pattern_0); + int has_left = has_left_delimiter (pattern_0); + int has_right = has_right_delimiter (&pattern_0[length]); + if (has_left && has_right) + return pattern_0; + else + { + char *pattern = MALLOC (char, length + 4); + if (has_left) + strcpy (pattern, pattern_0); + else + { + length += 2; + strcpy (pattern, "\\<"); + strcpy (pattern + 2, pattern_0); + } + if (!has_right) + strcpy (pattern + length, "\\>"); + return pattern; + } + } +} + int -query_number (char const *arg, report_func_t report_function) +query_number (char const *arg, report_func_t report_func) { int count; int radix; @@ -809,7 +908,7 @@ query_number (char const *arg, report_func_t report_function) fseek (idh.idh_FILE, idh.idh_tokens_offset, SEEK_SET); count = 0; - if (merging) + if (key_style != ks_token) memset (bits_vec, 0, bits_vec_size); while (gets_past_00 (hits_buf_1, idh.idh_FILE) > 0) { @@ -827,14 +926,14 @@ query_number (char const *arg, report_func_t report_function) if (!((radix_flag ? radix_flag : radix) & get_radix (hits_buf_1)) || stoi (hits_buf_1) != val) continue; - if (merging) - tree8_to_bits (bits_vec, tok_hits_addr (hits_buf_1)); + if (key_style == ks_token) + (*report_func) (hits_buf_1, tree8_to_flinkv (token_hits_addr (hits_buf_1))); else - (*report_function) (hits_buf_1, tree8_to_flinkv (tok_hits_addr (hits_buf_1))); + tree8_to_bits (bits_vec, token_hits_addr (hits_buf_1)); count++; } - if (merging && count) - (*report_function) (arg, bits_to_flinkv (bits_vec)); + if (key_style != ks_token && count) + (*report_func) (arg, bits_to_flinkv (bits_vec)); return count; } @@ -843,7 +942,7 @@ query_number (char const *arg, report_func_t report_function) characters. */ int -query_non_unique (unsigned int limit, report_func_t report_function) +query_ambiguous_prefix (unsigned int limit, report_func_t report_func) { char *old = hits_buf_1; char *new = hits_buf_2; @@ -861,68 +960,70 @@ query_non_unique (unsigned int limit, report_func_t report_function) while (gets_past_00 (old, idh.idh_FILE) > 0) { char *tmp; - if (!(tok_flags (old) & TOK_NAME)) + if (!(token_flags (old) & TOK_NAME)) continue; tmp = old; old = new; new = tmp; if (!strnequ (new, old, limit)) { - if (consecutive && merging) + if (consecutive && key_style != ks_token) { strncpy (&name[1], old, limit); - (*report_function) (name, bits_to_flinkv (bits_vec)); + (*report_func) (name, bits_to_flinkv (bits_vec)); } consecutive = 0; continue; } if (!consecutive++) { - if (merging) - tree8_to_bits (bits_vec, tok_hits_addr (old)); + if (key_style != ks_token) + tree8_to_bits (bits_vec, token_hits_addr (old)); else - (*report_function) (old, tree8_to_flinkv (tok_hits_addr (old))); + (*report_func) (old, tree8_to_flinkv (token_hits_addr (old))); count++; } - if (merging) - tree8_to_bits (bits_vec, tok_hits_addr (new)); + if (key_style == ks_token) + (*report_func) (new, tree8_to_flinkv (token_hits_addr (new))); else - (*report_function) (new, tree8_to_flinkv (tok_hits_addr (new))); + tree8_to_bits (bits_vec, token_hits_addr (new)); count++; } - if (consecutive && merging) + if (consecutive && key_style != ks_token) { strncpy (&name[1], new, limit); - (*report_function) (name, bits_to_flinkv (bits_vec)); + (*report_func) (name, bits_to_flinkv (bits_vec)); } return count; } int -query_apropos (char const *arg, report_func_t report_function) +query_literal_substring (char const *arg, report_func_t report_func) { int count; + char *(*strstr_func) __P((char const *, char const *)); fseek (idh.idh_FILE, idh.idh_tokens_offset, SEEK_SET); count = 0; - if (merging) + if (key_style != ks_token) memset (bits_vec, 0, bits_vec_size); + strstr_func = (ignore_case_flag ? strcasestr : strstr); while (gets_past_00 (hits_buf_1, idh.idh_FILE) > 0) { assert (*hits_buf_1); - if (!frequency_wanted (hits_buf_1)) + if (!desired_frequency (hits_buf_1)) continue; - if (strcpos (hits_buf_1, arg) == 0) + if ((*strstr_func) (hits_buf_1, arg) == 0) continue; - if (merging) - tree8_to_bits (bits_vec, tok_hits_addr (hits_buf_1)); + if (key_style == ks_token) + (*report_func) (hits_buf_1, tree8_to_flinkv (token_hits_addr (hits_buf_1))); else - (*report_function) (hits_buf_1, tree8_to_flinkv (tok_hits_addr (hits_buf_1))); + tree8_to_bits (bits_vec, token_hits_addr (hits_buf_1)); count++; } - if (merging && count) - (*report_function) (arg, bits_to_flinkv (bits_vec)); + if (key_style != ks_token && count) + (*report_func) (arg, bits_to_flinkv (bits_vec)); return count; } @@ -955,17 +1056,17 @@ parse_frequency_arg (char const *arg) } int -frequency_wanted (char const *tok) +desired_frequency (char const *tok) { - unsigned int count = tok_count (tok); + unsigned int count = token_count (tok); return (frequency_low <= count && count <= frequency_high); } /* if string `s2' occurs in `s1', return a pointer to the first match. Ignore differences in alphabetic case. */ -char const * -strcpos (char const *s1, char const *s2) +char * +strcasestr (char const *s1, char const *s2) { char const *s1p; char const *s2p; @@ -974,7 +1075,7 @@ strcpos (char const *s1, char const *s2) for (s1last = &s1[strlen (s1) - strlen (s2)]; s1 <= s1last; s1++) for (s1p = s1, s2p = s2; TOLOWER (*s1p) == TOLOWER (*s2p); s1p++) if (*++s2p == '\0') - return s1; + return (char *) s1; return 0; } @@ -983,12 +1084,12 @@ strcpos (char const *s1, char const *s2) in files. */ char const * -file_regexp (char const *name0, char const *left_delimit, char const *right_delimit) +file_regexp (char const *name_0, char const *left_delimit, char const *right_delimit) { static char pat_buf[BUFSIZ]; - char *name = (char *) name0; + char *name = (char *) name_0; - if (query_func == query_number && merging) + if (query_function == query_number && key_style == ks_pattern) { sprintf (pat_buf, "%s0*[Xx]*0*%d[Ll]*%s", left_delimit, stoi (name), right_delimit); return pat_buf; @@ -998,7 +1099,7 @@ file_regexp (char const *name0, char const *left_delimit, char const *right_deli return 0; if (name[0] == '^') - name0++; + name_0++; else left_delimit = ""; while (*++name) @@ -1008,12 +1109,12 @@ file_regexp (char const *name0, char const *left_delimit, char const *right_deli else right_delimit = ""; - sprintf (pat_buf, "%s%s%s", left_delimit, name0, right_delimit); + sprintf (pat_buf, "%s%s%s", left_delimit, name_0, right_delimit); return pat_buf; } off_t -query_token (char const *token_0) +query_binary_search (char const *token_0) { off_t offset = 0; off_t start = idh.idh_tokens_offset - 2; @@ -1043,7 +1144,7 @@ query_token (char const *token_0) token++; incr++; } - if (c && !*token && query_func == query_anchor) + if (c && !*token && query_function == query_literal_prefix) anchor_offset = offset; order = *token - c; @@ -1075,6 +1176,8 @@ is_regexp (char *name) if (*name == '^') name++; + else if (strnequ (name, "\\<", 2)) + name += 2; while (*name) { if (*name == '\\') @@ -1083,7 +1186,7 @@ is_regexp (char *name) return 1; name++, backslash++; } - else if (strchr ("[]{}().*+^$", *name)) + else if (strchr ("[]().*+^$", *name)) return 1; name++; } @@ -1097,6 +1200,18 @@ is_regexp (char *name) return 0; } +int +has_left_delimiter (char const *pattern) +{ + return (*pattern == '^' || strnequ (pattern, "\\<", 2)); +} + +int +has_right_delimiter (char const *pattern) +{ + return (pattern[-1] == '$' || strequ (pattern - 2, "\\>")); +} + /* file_name_wildcard implements a simple pattern matcher that emulates the shell wild card capability. @@ -1160,7 +1275,7 @@ file_name_wildcard (char const *pattern, char const *fn) if (revset) for (i = 1; i < 256; ++i) set[i] = !set[i]; - if (!set[(int)*fn++]) + if (!set[(int) *fn++]) return 0; } else @@ -1177,9 +1292,9 @@ file_name_wildcard (char const *pattern, char const *fn) /* Does `name' occur in `line' delimited by non-alphanumerics?? */ int -word_match (char const *name0, char const *line) +word_match (char const *name_0, char const *line) { - char const *name = name0; + char const *name = name_0; for (;;) { @@ -1202,7 +1317,7 @@ word_match (char const *name0, char const *line) /* is this the end of `name', is there a word delimiter ?? */ if (*name == '\0' && !IS_ALNUM (*line)) return 1; - name = name0; + name = name_0; } } @@ -1212,34 +1327,48 @@ word_match (char const *name0, char const *line) 0, so return all possibilities. */ int -get_radix (char const *name) +get_radix (char const *str) { - if (!isdigit (*name)) + if (!isdigit (*str)) return 0; - if (*name != '0') + if (*str != '0') return radix_dec; - name++; - if (*name == 'x' || *name == 'X') + str++; + if (*str == 'x' || *str == 'X') return radix_hex; - while (*name && *name == '0') - name++; - return (*name ? radix_oct : (radix_oct | radix_dec)); + while (*str && *str == '0') + str++; + return (*str ? radix_oct : (radix_oct | radix_dec)); +} + +int +is_number (char const *str) +{ + if (str[0] == '0' && (str[1] == 'x' || str[1] == 'X')) + { + str += 2; + str += strspn (str, "0123456789aAbBcCdDeEfF"); + } + else + str += strspn (str, "0123456789"); + str += strspn (str, "uUlL"); + return (*str == '\0'); } /* Convert an ascii string number to an integer. Determine the radix before converting. */ int -stoi (char const *name) +stoi (char const *str) { - switch (get_radix (name)) + switch (get_radix (str)) { case radix_dec: - return (dtoi (name)); + return (dtoi (str)); case radix_oct: - return (otoi (&name[1])); + return (otoi (&str[1])); case radix_hex: - return (xtoi (&name[2])); + return (xtoi (&str[2])); case radix_dec | radix_oct: return 0; default: @@ -1250,57 +1379,57 @@ stoi (char const *name) /* Convert an ascii octal number to an integer. */ int -otoi (char const *name) +otoi (char const *str) { int n = 0; - while (*name >= '0' && *name <= '7') + while (*str >= '0' && *str <= '7') { n *= 010; - n += *name++ - '0'; + n += *str++ - '0'; } - if (*name == 'l' || *name == 'L') - name++; - return (*name ? -1 : n); + while (*str && strchr ("uUlL", *str)) + str++; + return (*str ? -1 : n); } /* Convert an ascii decimal number to an integer. */ int -dtoi (char const *name) +dtoi (char const *str) { int n = 0; - while (isdigit (*name)) + while (isdigit (*str)) { n *= 10; - n += *name++ - '0'; + n += *str++ - '0'; } - if (*name == 'l' || *name == 'L') - name++; - return (*name ? -1 : n); + while (*str && strchr ("uUlL", *str)) + str++; + return (*str ? -1 : n); } /* Convert an ascii hex number to an integer. */ int -xtoi (char const *name) +xtoi (char const *str) { int n = 0; - while (isxdigit (*name)) + while (isxdigit (*str)) { n *= 0x10; - if (isdigit (*name)) - n += *name++ - '0'; - else if (islower (*name)) - n += 0xa + *name++ - 'a'; + if (isdigit (*str)) + n += *str++ - '0'; + else if (islower (*str)) + n += 0xa + *str++ - 'a'; else - n += 0xA + *name++ - 'A'; + n += 0xA + *str++ - 'A'; } - if (*name == 'l' || *name == 'L') - name++; - return (*name ? -1 : n); + while (*str && strchr ("uUlL", *str)) + str++; + return (*str ? -1 : n); } unsigned char * @@ -1419,22 +1548,10 @@ struct sgttyb savemode; #define SET_TTY_MODES(modes) stty (0, (modes)) # endif -void -savetty (void) -{ -# ifdef TIOCGETP - ioctl(0, TIOCGETP, &savemode); -# else - gtty(0, &savemode); -# endif - charmode = linemode = savemode; - - charmode.sg_flags &= ~ECHO; - charmode.sg_flags |= RAW; +# else /* not HAVE_SGTTY_H */ - linemode.sg_flags |= ECHO; - linemode.sg_flags &= ~RAW; -} +#define GET_TTY_MODES(modes) +#define SET_TTY_MODES(modes) # endif /* not HAVE_SGTTY_H */ # endif /* not HAVE_TERMIO_H */ @@ -1457,9 +1574,36 @@ savetty (void) linemode.c_cc[VEOL] = 0377; } -#endif +#else /* not (HAVE_TERMIOS_H || HAVE_TERMIO_H) */ -#if HAVE_TERMIOS_H || HAVE_TERMIO_H || HAVE_SGTTY_H +# if HAVE_SGTTY_H + +void +savetty (void) +{ +# ifdef TIOCGETP + ioctl(0, TIOCGETP, &savemode); +# else + gtty(0, &savemode); +# endif + charmode = linemode = savemode; + + charmode.sg_flags &= ~ECHO; + charmode.sg_flags |= RAW; + + linemode.sg_flags |= ECHO; + linemode.sg_flags &= ~RAW; +} + +# else /* not HAVE_SGTTY_H */ + +void +savetty (void) +{ +} + +# endif /* not HAVE_SGTTY_H */ +#endif /* not (HAVE_TERMIOS_H || HAVE_TERMIO_H) */ void restoretty (void) @@ -1478,5 +1622,3 @@ chartty (void) { SET_TTY_MODES (&charmode); } - -#endif @@ -1,5 +1,6 @@ /* mkid.c -- build an identifer database Copyright (C) 1986, 1995, 1996 Free Software Foundation, Inc. + Written by Greg McGary <gkm@gnu.ai.mit.edu> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,32 +16,27 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include <sys/types.h> -#include <sys/stat.h> -#include <stdlib.h> -#include <stddef.h> -#include <unistd.h> -#include <limits.h> +#include <config.h> +#include "xstdlib.h" #include <assert.h> #include <stdio.h> -#include <string.h> -#include <ctype.h> #include <errno.h> #include <getopt.h> - -#include <config.h> -#include "system.h" +#include "xsysstat.h" +#include "xstddef.h" +#include "xunistd.h" +#include "xnls.h" #include "pathmax.h" -#include "strxtra.h" -#include "alloc.h" +#include "xstring.h" #include "idfile.h" -#include "token.h" -#include "bitops.h" -#include "misc.h" -#include "filenames.h" +#include "xmalloc.h" #include "hash.h" #include "scanners.h" #include "error.h" +#include "xalloca.h" +#if HAVE_LIMITS_H +# include <limits.h> +#endif struct summary { @@ -112,12 +108,11 @@ struct summary *summary_leaf; char const *program_name; -char *include_languages = 0; -char *exclude_languages = 0; char *lang_map_file_name = 0; int show_version = 0; int show_help = 0; struct idhead idh; +struct file_link *cw_dlink; void usage (void) @@ -132,9 +127,11 @@ static struct option const long_options[] = { "file", required_argument, 0, 'f' }, { "output", required_argument, 0, 'o' }, { "include", required_argument, 0, 'i' }, - { "exclude", required_argument, 0, 'r' }, - { "lang-arg", required_argument, 0, 'l' }, + { "exclude", required_argument, 0, 'x' }, + { "lang-option", required_argument, 0, 'l' }, { "lang-map", required_argument, 0, 'm' }, + { "default-lang", required_argument, 0, 'd' }, + { "prune", required_argument, 0, 'p' }, { "verbose", no_argument, 0, 'v' }, { "statistics", no_argument, 0, 's' }, { "help", no_argument, &show_help, 1 }, @@ -146,8 +143,8 @@ static void help_me (void) { printf (_("\ -Usage: %s [OPTION]... [FILE]...\n"), - program_name); +Usage: %s [OPTION]... [FILE]...\n\ +"), program_name); printf (_("\ Build an identifier database.\n\ @@ -155,16 +152,19 @@ Build an identifier database.\n\ -f, --file=OUTFILE synonym for --output\n\ -i, --include=LANGS include languages in LANGS (default: \"C C++ asm\")\n\ -x, --exclude=LANGS exclude languages in LANGS\n\ - -l, --lang-arg=LANG:ARG pass ARG as a default for LANG (see below)\n\ + -l, --lang-option=L:OPT pass OPT as a default for language L (see below)\n\ -m, --lang-map=MAPFILE use MAPFILE to map file names onto source language\n\ - -v, --verbose report progress and as files are scanned\n\ + -d, --default-lang=LANG make LANG the default source language\n\ + -p, --prune=NAMES exclude the named files and/or directories\n\ + -v, --verbose report per file statistics\n\ -s, --statistics report statistics at end of run\n\ \n\ --help display this help and exit\n\ --version output version information and exit\n\ \n\ FILE may be a file name, or a directory name to recursively search.\n\ -The `--include' and `--exclude' options are mutually-exclusive.\n\ +If no FILE is given, the current directory is searched by default.\n\ +Note that the `--include' and `--exclude' options are mutually-exclusive.\n\ \n\ The following arguments apply to the language-specific scanners:\n\ ")); @@ -172,9 +172,6 @@ The following arguments apply to the language-specific scanners:\n\ exit (0); } -#if !HAVE_DECL_SBRK -extern void *sbrk (); -#endif char const *heap_initial; char const *heap_after_walk; char const *heap_after_scan; @@ -183,10 +180,19 @@ int main (int argc, char **argv) { program_name = argv[0]; - idh.idh_file_name = ID_FILE_NAME; + heap_initial = (char const *) sbrk (0); + idh.idh_file_name = DEFAULT_ID_FILE_NAME; + + /* Set locale according to user's wishes. */ + setlocale (LC_ALL, ""); + + /* Tell program which translations to use and where to find. */ + bindtextdomain (PACKAGE, LOCALEDIR); + textdomain (PACKAGE); + for (;;) { - int optc = getopt_long (argc, argv, "o:f:i:x:l:m:uvs", + int optc = getopt_long (argc, argv, "o:f:i:x:l:m:d:p:vs", long_options, (int *) 0); if (optc < 0) break; @@ -201,23 +207,34 @@ main (int argc, char **argv) break; case 'i': - include_languages = optarg; + include_languages (optarg); break; case 'x': - exclude_languages = optarg; + exclude_languages (optarg); break; case 'l': language_save_arg (optarg); break; - + case 'm': lang_map_file_name = optarg; break; + case 'd': + set_default_language (optarg); + break; + + case 'p': + if (cw_dlink == 0) + cw_dlink = init_walker (&idh); + prune_file_names (optarg, cw_dlink); + break; + case 'v': verbose_flag = 1; + statistics_flag = 1; break; case 's': @@ -237,38 +254,46 @@ main (int argc, char **argv) if (show_help) help_me (); - + argc -= optind; argv += optind; - language_getopt (); + if (argc == 0) + { + static char *dot = (char *) "."; + argc = 1; + argv = ˙ + } + language_getopt (); assert_writeable (idh.idh_file_name); + if (cw_dlink == 0) + cw_dlink = init_walker (&idh); + parse_language_map (lang_map_file_name); - if (argc == 0) + while (argc--) { - argc++; - *(char const **)--argv = "."; + struct file_link *flink = parse_file_name (*argv++, cw_dlink); + if (flink) + walk_flink (flink, 0); } - heap_initial = (char const *) sbrk (0); - init_idh_obstacks (&idh); - init_idh_tables (&idh); - parse_language_map (lang_map_file_name); - - { - struct file_link *cwd_link = get_current_dir_link (); - while (argc--) - walk_flink (parse_file_name (*argv++, cwd_link), 0); - mark_member_file_links (&idh); - heap_after_walk = (char const *) sbrk (0); - scan_files (&idh); - heap_after_scan = sbrk (0); - free_summary_tokens (); - free (token_table.ht_vec); - chdir_to_link (cwd_link); - write_id_file (&idh); - } - if (statistics_flag) - report_statistics (); + heap_after_walk = (char const *) sbrk (0); + + mark_member_file_links (&idh); + if (idh.idh_member_file_table.ht_fill) + { + scan_files (&idh); + heap_after_scan = sbrk (0); + + free_summary_tokens (); + free (token_table.ht_vec); + chdir_to_link (cw_dlink); + write_id_file (&idh); + + if (statistics_flag) + report_statistics (); + } + else + error (0, 0, "nothing to do"); exit (0); } @@ -280,6 +305,8 @@ assert_writeable (char const *file_name) if (errno == ENOENT) { char const *dir_name = dirname (file_name); + if (!dir_name || !*dir_name) + dir_name = "."; if (access (dir_name, 06) < 0) error (1, errno, _("can't create `%s' in `%s'"), basename (file_name), dir_name); @@ -296,7 +323,7 @@ scan_files (struct idhead *idhp) = (struct member_file **) hash_dump (&idhp->idh_member_file_table, 0, member_file_qsort_compare); struct member_file **end = &members_0[idhp->idh_member_file_table.ht_fill]; - struct member_file **members; + struct member_file **members = members_0; hash_init (&token_table, idhp->idh_member_file_table.ht_fill * 64, token_hash_1, token_hash_2, token_hash_cmp); @@ -304,8 +331,17 @@ scan_files (struct idhead *idhp) init_summary (); obstack_init (&tokens_obstack); - for (members = members_0; members < end; members++) - scan_member_file (*members); + for (;;) + { + struct member_file *member = *members++; + scan_member_file (member); + if (members == end) + break; + if (current_hits_signature[0] & 0x80) + summarize (); + bump_current_hits_signature (); + } + free (members_0); } @@ -318,48 +354,44 @@ scan_member_file (struct member_file const *member) struct file_link *flink = member->mf_link; struct stat st; FILE *source_FILE; - size_t bytes; chdir_to_link (flink->fl_parent); - source_FILE = open_source_FILE (flink->fl_name); + source_FILE = fopen (flink->fl_name, "r"); if (source_FILE) { - char buf[PATH_MAX]; - if (verbose_flag) + if (statistics_flag) { - printf ("%d: %s: %s", member->mf_index, lang->lg_name, - absolute_path (buf, flink)); - fflush (stdout); + if (fstat (fileno (source_FILE), &st) < 0) + { + char *file_name = ALLOCA (char, PATH_MAX); + maybe_relative_file_name (file_name, flink, cw_dlink); + error (0, errno, _("can't stat `%s'"), file_name); + } + else + input_chars += st.st_size; } - if (fstat (fileno (source_FILE), &st) < 0) - error (0, errno, _("can't stat `%s'"), absolute_path (buf, flink)); - else + if (verbose_flag) { - bytes = st.st_size; - input_chars += bytes; + char *file_name = ALLOCA (char, PATH_MAX); + maybe_relative_file_name (file_name, flink, cw_dlink); + printf ("%d: %s: %s", member->mf_index, lang->lg_name, file_name); + fflush (stdout); } scan_member_file_1 (get_token, lang_args->la_args_digested, source_FILE); if (verbose_flag) putchar ('\n'); - close_source_FILE (source_FILE); + fclose (source_FILE); } - if (current_hits_signature[0] & 0x80) - summarize (); -#if 0 - if (member->mf_index < file_name_count) -#endif - bump_current_hits_signature (); + else + error (0, errno, _("can't open `%s'"), flink->fl_name); } void scan_member_file_1 (get_token_func_t get_token, void const *args, FILE *source_FILE) { - struct stat st; struct token **slot; struct token *token; int flags; - int bytes = 0; - int total_tokens = 0; int new_tokens = 0; int distinct_tokens = 0; @@ -369,16 +401,18 @@ scan_member_file_1 (get_token_func_t get_token, void const *args, FILE *source_F obstack_free (&tokens_obstack, token); continue; } - total_tokens++; slot = (struct token **) hash_find_slot (&token_table, token); if (HASH_VACANT (*slot)) { + token->tok_flags = flags; token->tok_count = 1; memset (token->tok_hits, 0, sizeof (token->tok_hits)); - token->tok_flags = flags; sign_token (token); - distinct_tokens++; - new_tokens++; + if (verbose_flag) + { + distinct_tokens++; + new_tokens++; + } hash_insert_at (&token_table, token, slot); } else @@ -391,7 +425,8 @@ scan_member_file_1 (get_token_func_t get_token, void const *args, FILE *source_F if (!(token->tok_hits[0] & current_hits_signature[0])) { sign_token (token); - distinct_tokens++; + if (verbose_flag) + distinct_tokens++; } } } |