From 26dee2c240abc4f489f05333c04543c5c97d6cf1 Mon Sep 17 00:00:00 2001 From: Suchang Woo Date: Fri, 18 Dec 2015 13:30:47 +0900 Subject: [PATCH 1/2] Imported Upstream version 2.5.2 --- .cvsignore | 12 + ABOUT-NLS | 986 ++++ AUTHORS | 46 + COPYING | 340 ++ ChangeLog | 3210 ++++++++++++ INSTALL | 234 + Makefile.am | 51 + Makefile.cvs | 50 + Makefile.in | 692 +++ NEWS | 243 + README | 25 + README-alpha | 21 + README.DOS | 76 + THANKS | 74 + TODO | 98 + aclocal.m4 | 824 +++ autogen.sh | 27 + bootstrap/.cvsignore | 2 + bootstrap/Makefile.am | 4 + bootstrap/Makefile.in | 341 ++ bootstrap/Makefile.try | 145 + bootstrap/README | 8 + config.guess | 1506 ++++++ config.hin | 358 ++ config.sub | 1616 ++++++ configure | 13119 +++++++++++++++++++++++++++++++++++++++++++++++ configure.ac | 170 + configure.ac.in | 170 + depcomp | 584 +++ doc/.cvsignore | 7 + doc/Makefile.am | 18 + doc/Makefile.in | 669 +++ doc/egrep.man | 1 + doc/fgrep.man | 1 + doc/grep.1 | 1235 +++++ doc/grep.texi | 2541 +++++++++ doc/mdate-sh | 201 + doc/texinfo.tex | 7482 +++++++++++++++++++++++++++ grep.spec | 76 + install-sh | 507 ++ intl/.cvsignore | 1 + intl/ChangeLog | 2030 ++++++++ intl/Makefile.in | 337 ++ intl/VERSION | 1 + intl/bindtextdom.c | 369 ++ intl/config.charset | 440 ++ intl/dcgettext.c | 58 + intl/dcigettext.c | 1167 +++++ intl/dcngettext.c | 60 + intl/dgettext.c | 59 + intl/dngettext.c | 61 + intl/eval-plural.h | 105 + intl/explodename.c | 192 + intl/finddomain.c | 198 + intl/gettext.c | 64 + intl/gettextP.h | 201 + intl/gmo.h | 100 + intl/hash-string.h | 59 + intl/intl-compat.c | 166 + intl/l10nflist.c | 400 ++ intl/libgnuintl.h | 137 + intl/libintl.glibc | 116 + intl/loadinfo.h | 121 + intl/loadmsgcat.c | 445 ++ intl/localcharset.c | 345 ++ intl/locale.alias | 78 + intl/localealias.c | 419 ++ intl/localename.c | 693 +++ intl/ngettext.c | 68 + intl/os2compat.c | 109 + intl/os2compat.h | 46 + intl/osdep.c | 24 + intl/plural-exp.c | 156 + intl/plural-exp.h | 122 + intl/plural.c | 1322 +++++ intl/plural.y | 409 ++ intl/ref-add.sin | 31 + intl/ref-del.sin | 26 + intl/textdomain.c | 142 + lib/.cvsignore | 3 + lib/Makefile.am | 20 + lib/Makefile.in | 655 +++ lib/alloca.c | 503 ++ lib/atexit.c | 14 + lib/closeout.c | 121 + lib/closeout.h | 17 + lib/error.c | 276 + lib/error.h | 78 + lib/exclude.c | 128 + lib/exclude.h | 35 + lib/fnmatch.c | 230 + lib/fnmatch.h | 69 + lib/getopt.c | 1049 ++++ lib/getopt.h | 169 + lib/getopt1.c | 188 + lib/hard-locale.c | 85 + lib/hard-locale.h | 18 + lib/isdir.c | 42 + lib/malloc.c | 26 + lib/memchr.c | 199 + lib/obstack.c | 598 +++ lib/obstack.h | 593 +++ lib/posix/.cvsignore | 2 + lib/posix/Makefile.am | 4 + lib/posix/Makefile.in | 341 ++ lib/posix/regex.h | 566 ++ lib/quotearg.c | 613 +++ lib/quotearg.h | 110 + lib/realloc.c | 32 + lib/regex.c | 7899 ++++++++++++++++++++++++++++ lib/regex.h | 46 + lib/savedir.c | 187 + lib/savedir.h | 19 + lib/stpcpy.c | 50 + lib/strtol.c | 476 ++ lib/strtoul.c | 22 + lib/strtoull.c | 27 + lib/strtoumax.c | 81 + lib/xalloc.h | 87 + lib/xmalloc.c | 116 + lib/xstrtol.c | 282 + lib/xstrtol.h | 64 + lib/xstrtoumax.c | 31 + m4/.cvsignore | 2 + m4/Makefile.am | 27 + m4/Makefile.in | 365 ++ m4/codeset.m4 | 17 + m4/decl.m4 | 37 + m4/djgpp.m4 | 9 + m4/dosfile.m4 | 21 + m4/envsep.m4 | 20 + m4/error.m4 | 11 + m4/gettext.m4 | 370 ++ m4/glibc.m4 | 33 + m4/glibc21.m4 | 26 + m4/header.m4 | 66 + m4/iconv.m4 | 69 + m4/install.m4 | 13 + m4/inttypes_h.m4 | 22 + m4/isc-posix.m4 | 17 + m4/largefile.m4 | 129 + m4/lcmessage.m4 | 24 + m4/malloc.m4 | 34 + m4/mbstate_t.m4 | 29 + m4/missing.m4 | 30 + m4/progtest.m4 | 51 + m4/realloc.m4 | 34 + m4/regex.m4 | 74 + m4/sanity.m4 | 46 + m4/uintmax_t.m4 | 22 + m4/ulonglong.m4 | 17 + m4/xstrtoumax.m4 | 34 + po/.cvsignore | 6 + po/ChangeLog | 7 + po/Makefile.in.in | 238 + po/POTFILES.in | 13 + po/af.po | 419 ++ po/be.po | 413 ++ po/bg.po | 408 ++ po/ca.po | 415 ++ po/cat-id-tbl.c | 0 po/cs.po | 410 ++ po/da.po | 395 ++ po/de.po | 408 ++ po/el.po | 567 ++ po/eo.po | 399 ++ po/es.po | 474 ++ po/et.po | 399 ++ po/eu.po | 402 ++ po/fi.po | 405 ++ po/fr.po | 578 +++ po/ga.po | 408 ++ po/gl.po | 441 ++ po/he.po | 398 ++ po/hr.po | 401 ++ po/hu.po | 405 ++ po/id.po | 400 ++ po/it.po | 404 ++ po/ja.po | 409 ++ po/ko.po | 462 ++ po/nb.po | 399 ++ po/nl.po | 411 ++ po/no.po | 423 ++ po/pl.po | 412 ++ po/pt.po | 404 ++ po/pt_BR.po | 409 ++ po/ro.po | 401 ++ po/ru.po | 409 ++ po/rw.po | 364 ++ po/sl.po | 449 ++ po/sr.po | 402 ++ po/sv.po | 405 ++ po/tr.po | 401 ++ po/uk.po | 405 ++ po/vi.po | 404 ++ po/zh_TW.po | 399 ++ src/.cvsignore | 5 + src/Makefile.am | 19 + src/Makefile.in | 523 ++ src/ansi2knr.1 | 36 + src/ansi2knr.c | 678 +++ src/dfa.c | 3635 +++++++++++++ src/dfa.h | 433 ++ src/dosbuf.c | 181 + src/egrep.c | 2 + src/esearch.c | 2 + src/fgrep.c | 2 + src/fsearch.c | 2 + src/getpagesize.h | 46 + src/grep.c | 2274 ++++++++ src/grep.h | 72 + src/kwset.c | 778 +++ src/kwset.h | 57 + src/mbsupport.h | 47 + src/search.c | 746 +++ src/system.h | 206 + src/vms_fab.c | 86 + src/vms_fab.h | 33 + tests/.cvsignore | 7 + tests/Makefile.am | 23 + tests/Makefile.in | 439 ++ tests/backref.sh | 38 + tests/bre.awk | 27 + tests/bre.sh | 13 + tests/bre.tests | 62 + tests/empty.sh | 33 + tests/ere.awk | 32 + tests/ere.sh | 13 + tests/ere.tests | 215 + tests/file.sh | 59 + tests/fmbtest.sh | 103 + tests/foad1.sh | 189 + tests/khadafy.lines | 32 + tests/khadafy.regexp | 1 + tests/khadafy.sh | 20 + tests/options.sh | 36 + tests/pcre.sh | 16 + tests/spencer1.awk | 15 + tests/spencer1.sh | 13 + tests/spencer1.tests | 122 + tests/spencer2.sh | 13 + tests/spencer2.tests | 317 ++ tests/status.sh | 66 + tests/tests | 475 ++ tests/warning.sh | 18 + tests/yesno.sh | 115 + vms/.cvsignore | 2 + vms/Makefile.am | 4 + vms/Makefile.in | 341 ++ vms/README | 16 + vms/config_vms.h | 39 + vms/make.com | 71 + 252 files changed, 95896 insertions(+) create mode 100644 .cvsignore create mode 100644 ABOUT-NLS create mode 100644 AUTHORS create mode 100644 COPYING create mode 100644 ChangeLog create mode 100644 INSTALL create mode 100644 Makefile.am create mode 100644 Makefile.cvs create mode 100644 Makefile.in create mode 100644 NEWS create mode 100644 README create mode 100644 README-alpha create mode 100644 README.DOS create mode 100644 THANKS create mode 100644 TODO create mode 100644 aclocal.m4 create mode 100755 autogen.sh create mode 100644 bootstrap/.cvsignore create mode 100644 bootstrap/Makefile.am create mode 100644 bootstrap/Makefile.in create mode 100644 bootstrap/Makefile.try create mode 100644 bootstrap/README create mode 100755 config.guess create mode 100644 config.hin create mode 100755 config.sub create mode 100755 configure create mode 100644 configure.ac create mode 100644 configure.ac.in create mode 100755 depcomp create mode 100644 doc/.cvsignore create mode 100644 doc/Makefile.am create mode 100644 doc/Makefile.in create mode 100644 doc/egrep.man create mode 100644 doc/fgrep.man create mode 100644 doc/grep.1 create mode 100644 doc/grep.texi create mode 100755 doc/mdate-sh create mode 100644 doc/texinfo.tex create mode 100644 grep.spec create mode 100755 install-sh create mode 100644 intl/.cvsignore create mode 100644 intl/ChangeLog create mode 100644 intl/Makefile.in create mode 100644 intl/VERSION create mode 100644 intl/bindtextdom.c create mode 100755 intl/config.charset create mode 100644 intl/dcgettext.c create mode 100644 intl/dcigettext.c create mode 100644 intl/dcngettext.c create mode 100644 intl/dgettext.c create mode 100644 intl/dngettext.c create mode 100644 intl/eval-plural.h create mode 100644 intl/explodename.c create mode 100644 intl/finddomain.c create mode 100644 intl/gettext.c create mode 100644 intl/gettextP.h create mode 100644 intl/gmo.h create mode 100644 intl/hash-string.h create mode 100644 intl/intl-compat.c create mode 100644 intl/l10nflist.c create mode 100644 intl/libgnuintl.h create mode 100644 intl/libintl.glibc create mode 100644 intl/loadinfo.h create mode 100644 intl/loadmsgcat.c create mode 100644 intl/localcharset.c create mode 100644 intl/locale.alias create mode 100644 intl/localealias.c create mode 100644 intl/localename.c create mode 100644 intl/ngettext.c create mode 100644 intl/os2compat.c create mode 100644 intl/os2compat.h create mode 100644 intl/osdep.c create mode 100644 intl/plural-exp.c create mode 100644 intl/plural-exp.h create mode 100644 intl/plural.c create mode 100644 intl/plural.y create mode 100644 intl/ref-add.sin create mode 100644 intl/ref-del.sin create mode 100644 intl/textdomain.c create mode 100644 lib/.cvsignore create mode 100644 lib/Makefile.am create mode 100644 lib/Makefile.in create mode 100644 lib/alloca.c create mode 100644 lib/atexit.c create mode 100644 lib/closeout.c create mode 100644 lib/closeout.h create mode 100644 lib/error.c create mode 100644 lib/error.h create mode 100644 lib/exclude.c create mode 100644 lib/exclude.h create mode 100644 lib/fnmatch.c create mode 100644 lib/fnmatch.h create mode 100644 lib/getopt.c create mode 100644 lib/getopt.h create mode 100644 lib/getopt1.c create mode 100644 lib/hard-locale.c create mode 100644 lib/hard-locale.h create mode 100644 lib/isdir.c create mode 100644 lib/malloc.c create mode 100644 lib/memchr.c create mode 100644 lib/obstack.c create mode 100644 lib/obstack.h create mode 100644 lib/posix/.cvsignore create mode 100644 lib/posix/Makefile.am create mode 100644 lib/posix/Makefile.in create mode 100644 lib/posix/regex.h create mode 100644 lib/quotearg.c create mode 100644 lib/quotearg.h create mode 100644 lib/realloc.c create mode 100644 lib/regex.c create mode 100644 lib/regex.h create mode 100644 lib/savedir.c create mode 100644 lib/savedir.h create mode 100644 lib/stpcpy.c create mode 100644 lib/strtol.c create mode 100644 lib/strtoul.c create mode 100644 lib/strtoull.c create mode 100644 lib/strtoumax.c create mode 100644 lib/xalloc.h create mode 100644 lib/xmalloc.c create mode 100644 lib/xstrtol.c create mode 100644 lib/xstrtol.h create mode 100644 lib/xstrtoumax.c create mode 100644 m4/.cvsignore create mode 100644 m4/Makefile.am create mode 100644 m4/Makefile.in create mode 100644 m4/codeset.m4 create mode 100644 m4/decl.m4 create mode 100644 m4/djgpp.m4 create mode 100644 m4/dosfile.m4 create mode 100644 m4/envsep.m4 create mode 100644 m4/error.m4 create mode 100644 m4/gettext.m4 create mode 100644 m4/glibc.m4 create mode 100644 m4/glibc21.m4 create mode 100644 m4/header.m4 create mode 100644 m4/iconv.m4 create mode 100644 m4/install.m4 create mode 100644 m4/inttypes_h.m4 create mode 100644 m4/isc-posix.m4 create mode 100644 m4/largefile.m4 create mode 100644 m4/lcmessage.m4 create mode 100644 m4/malloc.m4 create mode 100644 m4/mbstate_t.m4 create mode 100644 m4/missing.m4 create mode 100644 m4/progtest.m4 create mode 100644 m4/realloc.m4 create mode 100644 m4/regex.m4 create mode 100644 m4/sanity.m4 create mode 100644 m4/uintmax_t.m4 create mode 100644 m4/ulonglong.m4 create mode 100644 m4/xstrtoumax.m4 create mode 100644 po/.cvsignore create mode 100644 po/ChangeLog create mode 100644 po/Makefile.in.in create mode 100644 po/POTFILES.in create mode 100644 po/af.po create mode 100644 po/be.po create mode 100644 po/bg.po create mode 100644 po/ca.po create mode 100644 po/cat-id-tbl.c create mode 100644 po/cs.po create mode 100644 po/da.po create mode 100644 po/de.po create mode 100644 po/el.po create mode 100644 po/eo.po create mode 100644 po/es.po create mode 100644 po/et.po create mode 100644 po/eu.po create mode 100644 po/fi.po create mode 100644 po/fr.po create mode 100644 po/ga.po create mode 100644 po/gl.po create mode 100644 po/he.po create mode 100644 po/hr.po create mode 100644 po/hu.po create mode 100644 po/id.po create mode 100644 po/it.po create mode 100644 po/ja.po create mode 100644 po/ko.po create mode 100644 po/nb.po create mode 100644 po/nl.po create mode 100644 po/no.po create mode 100644 po/pl.po create mode 100644 po/pt.po create mode 100644 po/pt_BR.po create mode 100644 po/ro.po create mode 100644 po/ru.po create mode 100644 po/rw.po create mode 100644 po/sl.po create mode 100644 po/sr.po create mode 100644 po/sv.po create mode 100644 po/tr.po create mode 100644 po/uk.po create mode 100644 po/vi.po create mode 100644 po/zh_TW.po create mode 100644 src/.cvsignore create mode 100644 src/Makefile.am create mode 100644 src/Makefile.in create mode 100644 src/ansi2knr.1 create mode 100644 src/ansi2knr.c create mode 100644 src/dfa.c create mode 100644 src/dfa.h create mode 100644 src/dosbuf.c create mode 100644 src/egrep.c create mode 100644 src/esearch.c create mode 100644 src/fgrep.c create mode 100644 src/fsearch.c create mode 100644 src/getpagesize.h create mode 100644 src/grep.c create mode 100644 src/grep.h create mode 100644 src/kwset.c create mode 100644 src/kwset.h create mode 100644 src/mbsupport.h create mode 100644 src/search.c create mode 100644 src/system.h create mode 100644 src/vms_fab.c create mode 100644 src/vms_fab.h create mode 100644 tests/.cvsignore create mode 100644 tests/Makefile.am create mode 100644 tests/Makefile.in create mode 100755 tests/backref.sh create mode 100644 tests/bre.awk create mode 100755 tests/bre.sh create mode 100644 tests/bre.tests create mode 100755 tests/empty.sh create mode 100644 tests/ere.awk create mode 100755 tests/ere.sh create mode 100644 tests/ere.tests create mode 100755 tests/file.sh create mode 100755 tests/fmbtest.sh create mode 100755 tests/foad1.sh create mode 100644 tests/khadafy.lines create mode 100644 tests/khadafy.regexp create mode 100755 tests/khadafy.sh create mode 100755 tests/options.sh create mode 100755 tests/pcre.sh create mode 100644 tests/spencer1.awk create mode 100755 tests/spencer1.sh create mode 100644 tests/spencer1.tests create mode 100755 tests/spencer2.sh create mode 100644 tests/spencer2.tests create mode 100755 tests/status.sh create mode 100644 tests/tests create mode 100755 tests/warning.sh create mode 100755 tests/yesno.sh create mode 100644 vms/.cvsignore create mode 100644 vms/Makefile.am create mode 100644 vms/Makefile.in create mode 100644 vms/README create mode 100644 vms/config_vms.h create mode 100644 vms/make.com diff --git a/.cvsignore b/.cvsignore new file mode 100644 index 0000000..3bcb9f6 --- /dev/null +++ b/.cvsignore @@ -0,0 +1,12 @@ +Makefile +Makefile.in +aclocal.m4 +autom4te.cache +configure +config.cache +config.h +config.hin +config.log +config.status +stamp-h +stamp-h1 diff --git a/ABOUT-NLS b/ABOUT-NLS new file mode 100644 index 0000000..ed3565a --- /dev/null +++ b/ABOUT-NLS @@ -0,0 +1,986 @@ +1 Notes on the Free Translation Project +*************************************** + +Free software is going international! The Free Translation Project is +a way to get maintainers of free software, translators, and users all +together, so that free software 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 distribution, you may +assume that the distributed package does use GNU `gettext' internally, +itself available at your nearest GNU archive site. But you do _not_ +need to install GNU `gettext' prior to configuring, installing or using +this package with messages translated. + + Installers will find here some useful hints. These notes also +explain how users should proceed for getting the programs to use the +available translations. They tell how people wanting to contribute and +work on translations can contact the appropriate team. + + When reporting bugs in the `intl/' directory or bugs which may be +related to internationalization, you should tell about the version of +`gettext' which is used. The information can be found in the +`intl/VERSION' file, in internationalized packages. + +1.1 Quick configuration advice +============================== + +If you want to exploit the full power of internationalization, you +should configure it using + + ./configure --with-included-gettext + +to force usage of internationalizing routines provided within this +package, despite the existence of internationalizing capabilities in the +operating system where this package is being installed. So far, only +the `gettext' implementation in the GNU C library version 2 provides as +many features (such as locale alias, message inheritance, automatic +charset conversion or plural form handling) as the implementation here. +It is also not possible to offer this additional functionality on top +of a `catgets' implementation. Future versions of GNU `gettext' will +very likely convey even more functionality. So it might be a good idea +to change to GNU `gettext' as soon as possible. + + So you need _not_ provide this option if you are using GNU libc 2 or +you have installed a recent copy of the GNU gettext package with the +included `libintl'. + +1.2 INSTALL Matters +=================== + +Some packages are "localizable" when properly installed; the programs +they contain can be made to speak your own native language. Most such +packages use GNU `gettext'. Other packages have their own ways to +internationalization, predating GNU `gettext'. + + By default, this package will be installed to allow translation of +messages. It will automatically detect whether the system already +provides the GNU `gettext' functions. If not, the included GNU +`gettext' library will be used. This library is wholly contained +within this package, usually in the `intl/' subdirectory, so prior +installation of the GNU `gettext' package is _not_ required. +Installers may use special options at configuration time for changing +the default behaviour. The commands: + + ./configure --with-included-gettext + ./configure --disable-nls + +will, respectively, bypass any pre-existing `gettext' to use the +internationalizing routines provided within this package, or else, +_totally_ disable translation of messages. + + When you already have GNU `gettext' installed on your system and run +configure without an option for your new package, `configure' will +probably detect the previously built and installed `libintl.a' file and +will decide to use this. This might not be desirable. You 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-included-gettext + +to prevent auto-detection. + + The configuration process will not test for the `catgets' function +and therefore it will not be used. The reason is that even an +emulation of `gettext' on top of `catgets' could not provide all the +extensions of the GNU `gettext' library. + + Internationalized packages usually have many `po/LL.po' files, where +LL gives an ISO 639 two-letter code identifying the language. Unless +translations have been forbidden at `configure' time by using the +`--disable-nls' switch, all available translations are installed +together with the package. However, the environment variable `LINGUAS' +may be set, prior to configuration, to limit the installed set. +`LINGUAS' should then contain a space separated list of two-letter +codes, stating which languages are allowed. + +1.3 Using This Package +====================== + +As a user, if your language has been installed for this package, you +only have to set the `LANG' environment variable to the appropriate +`LL_CC' combination. Here `LL' is an ISO 639 two-letter language code, +and `CC' is an ISO 3166 two-letter country code. For example, let's +suppose that you speak German and live in Germany. At the shell +prompt, merely execute `setenv LANG de_DE' (in `csh'), +`export LANG; LANG=de_DE' (in `sh') or `export LANG=de_DE' (in `bash'). +This can be done from your `.login' or `.profile' file, once and for +all. + + You might think that the country code specification is redundant. +But in fact, some languages have dialects in different countries. For +example, `de_AT' is used for Austria, and `pt_BR' for Brazil. The +country code serves to distinguish the dialects. + + The locale naming convention of `LL_CC', with `LL' denoting the +language and `CC' denoting the country, is the one use on systems based +on GNU libc. On other systems, some variations of this scheme are +used, such as `LL' or `LL_CC.ENCODING'. You can get the list of +locales supported by your system for your country by running the command +`locale -a | grep '^LL''. + + Not all programs have translations for all languages. By default, an +English message is shown in place of a nonexistent translation. If you +understand other languages, you can set up a priority list of languages. +This is done through a different environment variable, called +`LANGUAGE'. GNU `gettext' gives preference to `LANGUAGE' over `LANG' +for the purpose of message handling, but you still need to have `LANG' +set to the primary language; this is required by other parts of the +system libraries. For example, some Swedish users who would rather +read translations in German than English for when Swedish is not +available, set `LANGUAGE' to `sv:de' while leaving `LANG' to `sv_SE'. + + Special advice for Norwegian users: The language code for Norwegian +bokma*l changed from `no' to `nb' recently (in 2003). During the +transition period, while some message catalogs for this language are +installed under `nb' and some older ones under `no', it's recommended +for Norwegian users to set `LANGUAGE' to `nb:no' so that both newer and +older translations are used. + + In the `LANGUAGE' environment variable, but not in the `LANG' +environment variable, `LL_CC' combinations can be abbreviated as `LL' +to denote the language's main dialect. For example, `de' is equivalent +to `de_DE' (German as spoken in Germany), and `pt' to `pt_PT' +(Portuguese as spoken in Portugal) in this context. + +1.4 Translating Teams +===================== + +For the Free 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 translation team has its own mailing list. The up-to-date list of +teams can be found at the Free Translation Project's homepage, +`http://www.iro.umontreal.ca/contrib/po/HTML/', in the "National teams" +area. + + 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, speakers of Swedish can send a +message to `sv-request@li.org', having this message body: + + subscribe + + 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 `translation@iro.umontreal.ca' to reach the +coordinator for all translator teams. + + The English team is special. It works at improving and uniformizing +the terminology in use. Proven linguistic skill are praised more than +programming skill, here. + +1.5 Available Packages +====================== + +Languages are not equally supported in all packages. The following +matrix shows the current state of internationalization, as of April +2005. The matrix shows, in regard of each package, for which languages +PO files have been submitted to translation coordination, with a +translation percentage of at least 50%. + + Ready PO files af am ar az be bg bs ca cs cy da de el en en_GB + +-------------------------------------------------+ + GNUnet | | + a2ps | [] [] [] [] [] | + aegis | () | + ant-phone | () | + anubis | [] | + ap-utils | | + aspell | [] [] [] [] | + bash | [] [] | + batchelor | [] | + bfd | | + bibshelf | [] | + binutils | [] | + bison | [] [] | + bluez-pin | [] [] [] [] | + clisp | [] [] | + console-tools | [] [] | + coreutils | [] [] [] [] | + cpio | | + cpplib | [] [] [] | + darkstat | [] () [] | + dialog | [] [] [] [] [] [] | + diffutils | [] [] [] [] [] | + doodle | [] | + e2fsprogs | [] [] | + enscript | [] [] [] [] | + error | [] [] [] [] | + fetchmail | [] () [] [] [] | + fileutils | [] [] | + findutils | [] [] [] | + flex | [] [] [] | + fslint | [] | + gas | | + gawk | [] [] [] | + gbiff | [] | + gcal | [] | + gcc | [] | + gettext-examples | [] [] [] [] | + gettext-runtime | [] [] [] [] | + gettext-tools | [] [] | + gimp-print | [] [] [] [] | + gip | | + gliv | [] | + glunarclock | | + gmult | [] [] | + gnubiff | () | + gnucash | [] () () [] | + gnucash-glossary | [] () | + gpe-aerial | [] [] | + gpe-beam | [] [] | + gpe-calendar | [] [] | + gpe-clock | [] [] | + gpe-conf | [] [] | + gpe-contacts | | + gpe-edit | [] | + gpe-go | [] | + gpe-login | [] [] | + gpe-ownerinfo | [] [] | + gpe-sketchbook | [] [] | + gpe-su | [] [] | + gpe-taskmanager | [] [] | + gpe-timesheet | [] | + gpe-today | [] [] | + gpe-todo | [] [] | + gphoto2 | [] [] [] [] | + gprof | [] [] | + gpsdrive | () () | + gramadoir | [] [] | + grep | [] [] [] [] [] [] | + gretl | | + gsasl | [] | + gss | | + gst-plugins | [] [] [] [] [] [] | + gstreamer | [] [] [] [] [] | + gtick | [] () | + gtkspell | [] [] [] | + hello | [] [] [] [] | + id-utils | [] [] | + impost | | + indent | [] [] | + iso_3166 | | + iso_3166_1 | [] [] [] [] [] | + iso_3166_2 | | + iso_3166_3 | [] | + iso_4217 | | + iso_639 | | + jpilot | [] | + jtag | | + jwhois | | + kbd | [] [] [] [] | + latrine | () | + ld | [] | + libc | [] [] [] [] [] | + libextractor | | + libgpewidget | [] [] [] | + libgsasl | | + libiconv | [] [] [] [] [] | + libidn | | + lifelines | [] () | + lilypond | [] | + lingoteach | | + lynx | [] [] [] [] | + m4 | [] [] [] [] | + mailutils | [] | + make | [] [] | + man-db | [] () [] [] | + minicom | [] [] | + mysecretdiary | [] [] | + nano | [] () [] | + nano_1_0 | [] () [] [] | + opcodes | [] | + parted | [] [] [] [] | + psmisc | | + ptx | [] [] [] | + pwdutils | | + python | | + radius | [] | + recode | [] [] [] [] [] | + rpm | [] [] | + screem | | + scrollkeeper | [] [] [] [] [] [] [] [] | + sed | [] [] | + sh-utils | [] [] | + shared-mime-info | [] [] | + sharutils | [] [] [] [] [] | + silky | | + skencil | [] () | + sketch | [] () | + solfege | [] | + soundtracker | [] [] | + sp | [] | + stardict | [] | + tar | | + texinfo | [] [] | + textutils | [] [] [] | + tin | () () | + tp-robot | [] | + tuxpaint | [] [] [] [] [] [] [] | + unicode-han-tra... | | + unicode-transla... | | + util-linux | [] [] [] [] | + vorbis-tools | [] [] [] [] | + wastesedge | () | + wdiff | [] [] [] [] | + wget | [] [] [] [] [] [] | + xchat | [] [] [] [] | + xkeyboard-config | | + xpad | | + +-------------------------------------------------+ + af am ar az be bg bs ca cs cy da de el en en_GB + 10 0 0 2 7 4 0 41 43 3 52 90 20 1 15 + + eo es et eu fa fi fr ga gl he hr hu id is it + +-----------------------------------------------+ + GNUnet | | + a2ps | [] [] [] () | + aegis | | + ant-phone | [] | + anubis | [] | + ap-utils | [] | + aspell | [] [] | + bash | [] [] [] [] | + batchelor | [] [] | + bfd | [] | + bibshelf | [] [] [] | + binutils | [] [] | + bison | [] [] [] [] [] [] | + bluez-pin | [] [] [] [] [] [] | + clisp | [] [] | + console-tools | | + coreutils | [] [] [] [] [] | + cpio | [] [] | + cpplib | [] [] | + darkstat | [] () [] [] [] | + dialog | [] [] [] [] [] [] [] [] | + diffutils | [] [] [] [] [] [] [] [] [] [] | + doodle | [] [] | + e2fsprogs | [] [] [] | + enscript | [] [] | + error | [] [] [] [] [] | + fetchmail | [] | + fileutils | [] [] [] [] [] [] | + findutils | [] [] [] [] [] | + flex | [] [] [] | + fslint | [] | + gas | [] [] | + gawk | [] [] [] [] | + gbiff | [] | + gcal | [] [] | + gcc | [] | + gettext-examples | [] [] [] [] | + gettext-runtime | [] [] [] [] [] [] | + gettext-tools | [] [] [] | + gimp-print | [] [] | + gip | [] [] [] | + gliv | () | + glunarclock | [] [] [] | + gmult | [] [] [] | + gnubiff | () () | + gnucash | [] () [] | + gnucash-glossary | [] [] | + gpe-aerial | [] [] | + gpe-beam | [] [] | + gpe-calendar | [] [] [] [] | + gpe-clock | [] [] [] | + gpe-conf | [] | + gpe-contacts | [] | + gpe-edit | [] [] | + gpe-go | [] [] | + gpe-login | [] [] [] | + gpe-ownerinfo | [] [] [] [] [] | + gpe-sketchbook | [] [] | + gpe-su | [] [] [] | + gpe-taskmanager | [] [] [] | + gpe-timesheet | [] [] [] [] | + gpe-today | [] [] [] [] | + gpe-todo | [] [] [] | + gphoto2 | [] [] [] [] [] | + gprof | [] [] [] | + gpsdrive | () () [] () | + gramadoir | [] [] | + grep | [] [] [] [] [] [] [] [] [] [] [] [] | + gretl | [] [] [] | + gsasl | [] [] [] | + gss | [] | + gst-plugins | [] [] [] | + gstreamer | [] | + gtick | [] [] [] [] [] | + gtkspell | [] [] [] [] [] [] | + hello | [] [] [] [] [] [] [] [] [] [] [] [] [] [] | + id-utils | [] [] [] [] | + impost | [] [] | + indent | [] [] [] [] [] [] [] [] [] [] [] | + iso_3166 | [] [] [] | + iso_3166_1 | [] [] [] [] [] [] [] | + iso_3166_2 | [] | + iso_3166_3 | [] | + iso_4217 | [] [] [] | + iso_639 | [] [] [] [] | + jpilot | [] [] | + jtag | [] | + jwhois | [] [] [] [] [] | + kbd | [] [] | + latrine | [] [] [] | + ld | [] [] | + libc | [] [] [] [] [] | + libextractor | | + libgpewidget | [] [] [] [] [] | + libgsasl | [] [] | + libiconv | [] [] [] [] [] [] [] [] [] [] [] | + libidn | [] [] | + lifelines | () | + lilypond | [] | + lingoteach | [] [] [] | + lynx | [] [] [] | + m4 | [] [] [] [] | + mailutils | [] [] | + make | [] [] [] [] [] [] [] | + man-db | () | + minicom | [] [] [] [] | + mysecretdiary | [] [] [] | + nano | [] [] () [] [] | + nano_1_0 | [] [] [] [] [] | + opcodes | [] [] | + parted | [] [] [] [] | + psmisc | [] [] | + ptx | [] [] [] [] [] [] [] [] [] | + pwdutils | | + python | | + radius | [] [] | + recode | [] [] [] [] [] [] [] [] | + rpm | [] | + screem | | + scrollkeeper | [] [] [] | + sed | [] [] [] [] [] | + sh-utils | [] [] [] [] [] [] [] | + shared-mime-info | [] [] [] [] [] [] | + sharutils | [] [] [] [] [] [] [] | + silky | [] | + skencil | [] [] | + sketch | [] [] | + solfege | [] | + soundtracker | [] [] [] | + sp | [] | + stardict | [] | + tar | [] [] [] [] [] | + texinfo | [] [] [] | + textutils | [] [] [] [] [] | + tin | [] () | + tp-robot | [] [] | + tuxpaint | [] [] [] [] [] [] [] [] [] | + unicode-han-tra... | | + unicode-transla... | [] [] | + util-linux | [] [] [] [] [] [] | + vorbis-tools | [] [] | + wastesedge | () | + wdiff | [] [] [] [] [] [] [] [] | + wget | [] [] [] [] [] [] [] [] [] [] | + xchat | [] [] [] [] [] | + xkeyboard-config | | + xpad | [] [] [] | + +-----------------------------------------------+ + eo es et eu fa fi fr ga gl he hr hu id is it + 13 85 21 15 2 35 115 45 17 8 6 40 27 1 45 + + ja ko ku lg lt lv mk mn ms mt nb nl nn no nso + +-----------------------------------------------+ + GNUnet | | + a2ps | () [] [] () | + aegis | () | + ant-phone | [] | + anubis | [] [] [] | + ap-utils | | + aspell | [] [] | + bash | [] | + batchelor | [] | + bfd | | + bibshelf | | + binutils | | + bison | [] [] [] | + bluez-pin | [] | + clisp | [] | + console-tools | | + coreutils | [] [] | + cpio | | + cpplib | | + darkstat | [] [] | + dialog | [] | + diffutils | [] [] [] | + doodle | | + e2fsprogs | | + enscript | [] | + error | [] | + fetchmail | [] [] | + fileutils | [] [] | + findutils | [] | + flex | [] [] | + fslint | [] | + gas | | + gawk | [] [] | + gbiff | [] | + gcal | | + gcc | | + gettext-examples | [] [] | + gettext-runtime | [] [] [] | + gettext-tools | [] [] | + gimp-print | [] [] | + gip | [] | + gliv | [] | + glunarclock | [] [] | + gmult | [] | + gnubiff | | + gnucash | () () [] | + gnucash-glossary | [] | + gpe-aerial | [] | + gpe-beam | [] | + gpe-calendar | [] | + gpe-clock | [] | + gpe-conf | [] | + gpe-contacts | | + gpe-edit | [] | + gpe-go | [] | + gpe-login | [] | + gpe-ownerinfo | [] | + gpe-sketchbook | [] | + gpe-su | [] | + gpe-taskmanager | [] [] | + gpe-timesheet | [] | + gpe-today | [] | + gpe-todo | [] | + gphoto2 | [] [] | + gprof | | + gpsdrive | () () () | + gramadoir | () | + grep | [] [] [] | + gretl | | + gsasl | [] | + gss | | + gst-plugins | [] | + gstreamer | [] | + gtick | [] | + gtkspell | [] [] | + hello | [] [] [] [] [] [] [] [] | + id-utils | [] | + impost | | + indent | [] [] | + iso_3166 | [] | + iso_3166_1 | [] [] | + iso_3166_2 | [] | + iso_3166_3 | [] | + iso_4217 | [] [] [] | + iso_639 | [] [] [] | + jpilot | () () () | + jtag | | + jwhois | [] | + kbd | [] | + latrine | [] | + ld | | + libc | [] [] [] [] [] | + libextractor | | + libgpewidget | [] | + libgsasl | [] | + libiconv | [] | + libidn | | + lifelines | [] | + lilypond | [] | + lingoteach | [] | + lynx | [] [] | + m4 | [] [] | + mailutils | | + make | [] [] [] | + man-db | () | + minicom | [] | + mysecretdiary | [] | + nano | [] [] | + nano_1_0 | [] [] [] | + opcodes | [] | + parted | [] [] | + psmisc | [] [] | + ptx | [] [] [] | + pwdutils | | + python | | + radius | | + recode | [] | + rpm | [] [] | + screem | [] | + scrollkeeper | [] [] [] | + sed | [] [] | + sh-utils | [] [] | + shared-mime-info | [] [] [] [] | + sharutils | [] [] | + silky | [] | + skencil | | + sketch | | + solfege | [] [] | + soundtracker | | + sp | () | + stardict | [] [] | + tar | [] [] | + texinfo | [] [] [] | + textutils | [] [] [] | + tin | | + tp-robot | [] | + tuxpaint | [] [] [] [] [] [] | + unicode-han-tra... | | + unicode-transla... | | + util-linux | [] [] | + vorbis-tools | [] | + wastesedge | [] | + wdiff | [] [] | + wget | [] [] | + xchat | [] [] [] [] | + xkeyboard-config | [] | + xpad | [] | + +-----------------------------------------------+ + ja ko ku lg lt lv mk mn ms mt nb nl nn no nso + 33 11 1 1 1 2 2 3 11 0 15 96 7 5 0 + + or pa pl pt pt_BR rm ro ru rw sk sl sq sr sv ta + +-------------------------------------------------+ + GNUnet | | + a2ps | () [] [] [] [] [] [] | + aegis | () () | + ant-phone | [] | + anubis | [] [] [] | + ap-utils | () | + aspell | [] [] | + bash | [] [] [] | + batchelor | [] | + bfd | | + bibshelf | | + binutils | [] [] | + bison | [] [] [] [] [] | + bluez-pin | [] [] [] [] [] [] [] [] | + clisp | [] | + console-tools | [] | + coreutils | [] [] [] [] | + cpio | [] [] | + cpplib | | + darkstat | [] [] [] [] [] [] | + dialog | [] [] [] [] [] [] [] | + diffutils | [] [] [] [] [] [] | + doodle | [] | + e2fsprogs | [] [] | + enscript | [] [] [] [] | + error | [] [] [] | + fetchmail | [] () [] [] [] | + fileutils | [] [] [] [] [] | + findutils | [] [] [] [] [] [] | + flex | [] [] [] [] [] | + fslint | [] [] [] | + gas | | + gawk | [] [] [] [] | + gbiff | [] | + gcal | [] | + gcc | | + gettext-examples | [] [] [] [] [] [] | + gettext-runtime | [] [] [] [] [] [] [] | + gettext-tools | [] [] [] [] [] [] [] | + gimp-print | [] [] | + gip | [] [] [] | + gliv | [] [] [] | + glunarclock | [] [] [] [] [] [] | + gmult | [] [] [] [] | + gnubiff | () [] | + gnucash | () [] [] [] [] | + gnucash-glossary | [] [] [] | + gpe-aerial | [] [] [] [] [] [] | + gpe-beam | [] [] [] [] [] [] | + gpe-calendar | [] [] [] [] [] [] [] | + gpe-clock | [] [] [] [] [] [] [] | + gpe-conf | [] [] [] [] [] [] | + gpe-contacts | [] [] [] | + gpe-edit | [] [] [] [] [] [] [] | + gpe-go | [] [] [] [] [] | + gpe-login | [] [] [] [] [] [] [] | + gpe-ownerinfo | [] [] [] [] [] [] [] | + gpe-sketchbook | [] [] [] [] [] [] [] | + gpe-su | [] [] [] [] [] [] [] | + gpe-taskmanager | [] [] [] [] [] [] [] | + gpe-timesheet | [] [] [] [] [] [] [] | + gpe-today | [] [] [] [] [] [] [] | + gpe-todo | [] [] [] [] [] [] [] | + gphoto2 | [] [] [] [] | + gprof | [] [] [] | + gpsdrive | [] | + gramadoir | [] | + grep | [] [] [] [] [] [] [] | + gretl | [] | + gsasl | [] [] [] [] [] | + gss | [] [] [] | + gst-plugins | [] [] [] [] | + gstreamer | [] [] [] [] | + gtick | [] [] [] | + gtkspell | [] [] [] [] [] [] | + hello | [] [] [] [] [] [] [] | + id-utils | [] [] [] [] | + impost | | + indent | [] [] [] [] [] [] | + iso_3166 | [] [] [] [] [] | + iso_3166_1 | [] [] [] [] | + iso_3166_2 | | + iso_3166_3 | [] [] [] | + iso_4217 | [] [] | + iso_639 | [] [] [] | + jpilot | | + jtag | [] | + jwhois | [] [] [] () () | + kbd | [] [] [] | + latrine | [] [] | + ld | [] | + libc | [] [] [] [] [] | + libextractor | [] | + libgpewidget | [] [] [] [] [] [] | + libgsasl | [] [] [] | + libiconv | [] [] [] [] [] [] [] [] [] [] | + libidn | [] () | + lifelines | [] [] | + lilypond | [] | + lingoteach | [] | + lynx | [] [] [] | + m4 | [] [] [] [] [] | + mailutils | [] [] [] | + make | [] [] [] [] | + man-db | [] [] | + minicom | [] [] [] [] | + mysecretdiary | [] [] [] [] | + nano | [] [] [] | + nano_1_0 | [] [] [] [] | + opcodes | [] [] | + parted | [] [] [] [] | + psmisc | [] [] | + ptx | [] [] [] [] [] [] | + pwdutils | [] | + python | | + radius | [] [] | + recode | [] [] [] [] [] [] | + rpm | [] [] [] [] | + screem | | + scrollkeeper | [] [] [] [] [] [] [] | + sed | [] [] [] [] [] [] [] [] | + sh-utils | [] [] [] | + shared-mime-info | [] [] [] [] [] | + sharutils | [] [] [] | + silky | [] | + skencil | [] [] [] | + sketch | [] [] [] | + solfege | | + soundtracker | [] [] | + sp | | + stardict | [] [] | + tar | [] [] [] [] | + texinfo | [] [] [] [] | + textutils | [] [] [] | + tin | | + tp-robot | [] | + tuxpaint | [] [] [] [] [] [] [] [] | + unicode-han-tra... | | + unicode-transla... | | + util-linux | [] [] [] | + vorbis-tools | [] [] | + wastesedge | | + wdiff | [] [] [] [] [] [] | + wget | [] [] [] [] [] [] [] [] [] | + xchat | [] [] [] [] [] [] | + xkeyboard-config | | + xpad | | + +-------------------------------------------------+ + or pa pl pt pt_BR rm ro ru rw sk sl sq sr sv ta + 1 0 48 30 58 6 79 71 5 45 13 12 50 86 0 + + tg th tk tr uk ven vi wa xh zh_CN zh_TW zu + +--------------------------------------------+ + GNUnet | | 0 + a2ps | [] [] [] | 19 + aegis | | 0 + ant-phone | [] | 4 + anubis | [] | 9 + ap-utils | () | 1 + aspell | [] [] [] | 13 + bash | | 10 + batchelor | [] [] | 7 + bfd | | 1 + bibshelf | [] | 5 + binutils | [] | 6 + bison | [] | 17 + bluez-pin | [] [] [] [] [] | 24 + clisp | | 7 + console-tools | [] | 4 + coreutils | [] | 16 + cpio | [] [] | 6 + cpplib | [] [] | 7 + darkstat | [] () () | 15 + dialog | [] [] [] | 25 + diffutils | [] [] [] [] | 28 + doodle | [] | 5 + e2fsprogs | [] | 8 + enscript | [] | 12 + error | [] [] [] | 16 + fetchmail | [] | 12 + fileutils | [] [] [] | 18 + findutils | [] [] | 17 + flex | [] [] | 15 + fslint | [] | 7 + gas | [] | 3 + gawk | [] | 14 + gbiff | | 4 + gcal | [] | 5 + gcc | [] | 3 + gettext-examples | [] [] [] [] | 20 + gettext-runtime | [] [] [] [] [] | 25 + gettext-tools | [] [] [] | 17 + gimp-print | [] | 11 + gip | [] | 8 + gliv | [] | 6 + glunarclock | [] [] | 13 + gmult | [] [] [] | 13 + gnubiff | [] | 3 + gnucash | () [] | 10 + gnucash-glossary | [] | 8 + gpe-aerial | [] [] | 13 + gpe-beam | [] [] | 13 + gpe-calendar | [] [] [] [] | 18 + gpe-clock | [] [] [] [] | 17 + gpe-conf | [] [] | 12 + gpe-contacts | [] [] | 6 + gpe-edit | [] [] [] [] | 15 + gpe-go | [] [] | 11 + gpe-login | [] [] [] [] [] | 18 + gpe-ownerinfo | [] [] [] [] | 19 + gpe-sketchbook | [] [] | 14 + gpe-su | [] [] [] | 16 + gpe-taskmanager | [] [] [] | 17 + gpe-timesheet | [] [] [] [] | 17 + gpe-today | [] [] [] [] [] | 19 + gpe-todo | [] [] [] | 16 + gphoto2 | [] [] | 17 + gprof | [] [] | 10 + gpsdrive | | 2 + gramadoir | [] | 6 + grep | [] [] [] [] | 32 + gretl | | 4 + gsasl | [] [] | 12 + gss | [] | 5 + gst-plugins | [] [] | 16 + gstreamer | [] [] [] | 14 + gtick | [] | 11 + gtkspell | [] [] [] | 20 + hello | [] [] [] [] | 37 + id-utils | [] [] | 13 + impost | [] | 3 + indent | [] [] [] | 24 + iso_3166 | [] [] [] | 12 + iso_3166_1 | [] [] | 20 + iso_3166_2 | | 2 + iso_3166_3 | [] [] | 8 + iso_4217 | [] [] | 10 + iso_639 | [] [] | 12 + jpilot | [] [] [] | 6 + jtag | | 2 + jwhois | [] [] [] | 12 + kbd | [] [] | 12 + latrine | [] [] | 8 + ld | [] | 5 + libc | [] [] | 22 + libextractor | | 1 + libgpewidget | [] [] | 17 + libgsasl | [] | 7 + libiconv | [] [] [] [] [] | 32 + libidn | [] [] | 5 + lifelines | | 4 + lilypond | [] | 5 + lingoteach | | 5 + lynx | [] [] | 14 + m4 | [] [] | 17 + mailutils | [] | 7 + make | [] [] | 18 + man-db | | 5 + minicom | | 11 + mysecretdiary | [] [] | 12 + nano | | 11 + nano_1_0 | [] [] | 17 + opcodes | [] | 7 + parted | [] [] [] | 17 + psmisc | [] | 7 + ptx | [] [] | 23 + pwdutils | | 1 + python | | 0 + radius | [] | 6 + recode | [] [] | 22 + rpm | [] [] | 11 + screem | | 1 + scrollkeeper | [] [] | 23 + sed | [] [] | 19 + sh-utils | [] | 15 + shared-mime-info | [] [] | 19 + sharutils | [] [] [] | 20 + silky | | 3 + skencil | | 6 + sketch | | 6 + solfege | | 4 + soundtracker | [] | 8 + sp | [] | 3 + stardict | [] [] [] [] | 10 + tar | [] [] | 13 + texinfo | [] [] | 14 + textutils | [] [] [] | 17 + tin | | 1 + tp-robot | [] [] | 7 + tuxpaint | [] [] [] [] | 34 + unicode-han-tra... | | 0 + unicode-transla... | | 2 + util-linux | [] [] | 17 + vorbis-tools | [] | 10 + wastesedge | | 1 + wdiff | [] [] | 22 + wget | [] [] [] [] | 31 + xchat | [] [] [] | 22 + xkeyboard-config | | 1 + xpad | [] | 5 + +--------------------------------------------+ + 72 teams tg th tk tr uk ven vi wa xh zh_CN zh_TW zu + 147 domains 0 0 1 78 29 0 71 16 0 41 20 0 1711 + + 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 +distribution. + + If April 2005 seems to be old, you may fetch a more recent copy of +this `ABOUT-NLS' file on most GNU archive sites. The most up-to-date +matrix with full percentage details can be found at +`http://www.iro.umontreal.ca/contrib/po/HTML/matrix.html'. + +1.6 Using `gettext' in new packages +=================================== + +If you are writing a freely available program and want to +internationalize it you are welcome to use GNU `gettext' in your +package. Of course you have to respect the GNU Library General Public +License which covers the use of the GNU `gettext' library. This means +in particular that even non-free programs can use `libintl' as a shared +library, whereas only free software can use `libintl' as a static +library or use modified versions of `libintl'. + + Once the sources are changed appropriately and the setup can handle +the use of `gettext' the only thing missing are the translations. The +Free Translation Project is also available for packages which are not +developed inside the GNU project. Therefore the information given above +applies also for every other Free Software Project. Contact +`translation@iro.umontreal.ca' to make the `.pot' files available to +the translation teams. + diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..dd8350b --- /dev/null +++ b/AUTHORS @@ -0,0 +1,46 @@ +Mike Haertel wrote the main program and the dfa and kwset matchers. + +Arthur David Olson contributed the heuristics for finding fixed substrings +at the end of dfa.c. + +Richard Stallman and Karl Berry wrote the regex backtracking matcher. + +Henry Spencer wrote the original test suite from which grep's was derived. + +Scott Anderson invented the Khadafy test. + +David MacKenzie wrote the automatic configuration software use to +produce the configure script. + +Authors of the replacements for standard library routines are identified +in the corresponding source files. + +The idea of using Boyer-Moore type algorithms to quickly filter out +non-matching text before calling the regexp matcher was originally due +to James Woods. He also contributed some code to early versions of +GNU grep. + +Mike Haertel would like to thank Andrew Hume for many fascinating discussions +of string searching issues over the years. Hume & Sunday's excellent +paper on fast string searching (AT&T Bell Laboratories CSTR #156) +describes some of the history of the subject, as well as providing +exhaustive performance analysis of various implementation alternatives. +The inner loop of GNU grep is similar to Hume & Sunday's recommended +"Tuned Boyer Moore" inner loop. + +More work was done on regex.[ch] by Ulrich Drepper and Arnold +Robbins. Regex is now part of GNU C library, see this package +for complete details and credits. + +Arnold Robbins contributed to improve dfa.[ch]. In fact +it came straight from gawk-3.0.3 with small editing and fixes. + +Many folks contributed see THANKS, if I omited someone please +send me email. + +Alain Magloire maintained GNU grep until version 2.5e. + +Bernhard "Bero" Rosenkränzer maintained GNU grep until +version 2.5.1, ie. from Sep 2001 till 2003. + +Stepan Kasal maintains GNU grep since Feb 2004. diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..623b625 --- /dev/null +++ b/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + 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 of the License, 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..bcd9b6e --- /dev/null +++ b/ChangeLog @@ -0,0 +1,3210 @@ +2006-11-25 Bernhard Rosenkraenzer + + * configure.ac.in, grep.spec: Update version number + + * Makefile.cvs: Update to work with current autoconf scripts + + * po/Makefile.in.in: Adjust to work with automake 1.1x + +2006-08-19 Bernhard Rosenkraenzer + + * po/*: Sync with translation project + + * doc/*: Assorted documentation updates, Patch #4610 + + * autogen.sh, configure.in, configure.ac.in: Autogenerate + ALL_LINGUAS variable + + * m4/strerror_r.m4, configure.ac.in: Fix detection of strerror_r + + * lib/error.c: Remove bogus warning + + * lib/savedir.c, lib/savedir.h, src/grep.c, doc/*: + Add --exclude-dir option (patch #5051) + +2005-11-18 Charles Levert + + * tests/foad1.sh: Use ": ${VERBOSE=}" so that the caller can + set it without modifying the script; the usual caller (Makefile) + still leaves it untouched (usually unset, so it's off by default). + Modify "-m1 -A99 '^...$'" tests that failed so that their + expectation now corresponds to the output currently produced + by grep. Those tests used to expect that two selected (or + selectable) lines be output, even with -m1. Nothing was + modified with other similar tests that output _context_ lines + after one selected line has been output with -m1; they used to + and still succeed. Although tests/yesno.sh now provides a more + comprehensive framework for testing -m/-C feature interaction, + it doesn't exercise mixing them with anchors so the whole + relevant tests/foad1.sh test group is kept, notably to check + that grep doesn't crash when it is run. + +2005-11-17 Charles Levert + + On 2005-06-21, many changes were made that affected --color, + --only-matching, and --invert-match. Some of them introduced a + misunderstanding between the concepts of matched/non-matched and + selected/rejected lines. Furthermore, a few bugs with -v sneaked + in stemming from this. This set of changes aims to rectify most + of this situation. Some GREP_COLORS capabilities are also added + as a result of the clarification. (Further issues with -v/-o/-C + feature interaction still remain to be sorted out.) + + * src/grep.c: Rename/add global variables, macros, and capabilities: + SEP_CHAR_MATCH --> SEP_CHAR_SELECTED + SEP_CHAR_CONTEXT --> SEP_CHAR_REJECTED + SEP_STR_CHUNK --> SEP_STR_GROUP + grep_color --> selected_match_color + context_match_color + mlines_color --> selected_line_color + context_color --> context_line_color + "ml" --> "sl" + "mt" --> "mt" = "ms" + "mc" + --> "rv" (reverse "sl"/"cx" when -v) + * src/grep.c (color_cap_mt_fct, color_cap_rv_fct): New functions. + * src/grep.c (print_line_tail): Renamed color argument to line_color. + * src/grep.c (print_line_middle, prline): Revert part of the logic to + a pre-2005-06-21 one so that lines with matches have their matched + parts properly handled again ("m?" colors or --only-matching), + whether or not -v is specified. Whole line colors ("sl", "cx") + follow a selected / rejected(context) logic, as opposed to a + matched / non-matched one (unless "rv"). Matched text colors ("ms", + "mc") always follow a selected / rejected(context) logic, + regardless of "rv", because only matched lines use them anyway. + pr_line_middle() now takes additional line_color and match_color + arguments computed by prline() prior to calling that function. + The old logic was a buggy hybrid matched / rejected(context) one. + * src/grep.c (prpending, prtext, grepfile): Renamed macro invocations. + * src/grep.c (parse_grep_colors): Update top comment. + * src/grep.c (main): GREP_COLOR (singular) now sets both + selected_match_color and context_match_color. + +2005-11-16 Charles Levert + + * src/search.c (Pcompile): Clarify message for the -P option + not being supported so that users don't assume it's a run-time + problem, but know that it's a compile-time configuration choice. + Based on an idea by: Benno Schulenberg . + +2005-11-13 Charles Levert + + * tests/yesno.sh: New file. Test feature interaction + of -C, -v, -o, and -m. This reveals bugs, including some I + introduced on 2005-06-21, but also others. + * tests/Makefile.am (TESTS): Add yesno.sh. + * tests/Makefile.am (CLEANFILES): Add cspatfile and csinput, as + created by fmbtest.sh. Add yesno.txt, as created by yesno.sh. + +2005-11-11 Charles Levert + + * configure.in (ALL_LINGUAS): Add languages that were missing + from this variable (bg, ca, da, nb, tr), but that GNU grep supports + with a po/xx.po file. Reported by Tony Abou-Assaleh . + + * src/search.c (Pcompile): Abort in error if -P and multiple patterns + are specified, with an error message explaining the situation. + Fixing this won't be simple; the '\n' characters separating the + patterns cannot just be replaced by '|' to create an alternation as + back-references are assumed to be local to each individual pattern. + + * src/grep.c (parse_grep_colors, main): Replace all uses of + fprintf(stderr, _("%s: foo\n"), program_name, ...) with + error(0, 0, _("foo"), ...) for uniformization and simplification + of warning messages that will be up for localization. (My bad.) + +2005-11-10 Charles Levert + + The introduction of the --only-matching and --color GNU extensions + to grep added the requirement that each execute() implementation + not only be able to identify matching lines as a whole, but also + individual "exact" matches within a line known to be matching, + from leftmost to rightmost match, when the output from matching + lines is actually produced. The interface and implementations + of execute() were not up to it. This set of changes aims to + rectify that situation. Previously failing tests relative to + left anchors (^ and \<) and -w should now pass. This fixes + , + , + , + and possibly part of other, bigger, pending patches. The problem + was also compounded by the POSIX requirement to support a pattern + list instead of just an individual pattern (for -G and -E as well). + + * tests/foad1.sh: Test for increasing/decreasing-length word + matches, given pattern order, and leftmost/longest match. + * tests/fmbtest.sh: Modify test #6 according to new expectations. + Better document what tests #6 and #7 are actually for. Eliminate + test #5 in favor of bringing tests #6 and #7 within the F G E loop. + * src/grep.h (EXECUTE_ARGS): Change last argument from "int exact" + to "char const *start_ptr". Testing for "start_ptr" being non-NULL + retains the same semantics as testing for "exact" being non-zero. + * src/grep.c (print_line_middle): Call execute() with whole + buffer to work on, but using current position as start_ptr. + * src/grep.c (prpending, grepbuf): Call execute() with NULL + as start_ptr. + * src/search.c (EGexecute, Fexecute, Pexecute): When start_ptr is + non-NULL, return first match from it as an offset relative to buf. + * src/search.c (EGexecute): Consider all patterns if many and, + for an exact match, return the best one (leftmost, then longest). + Don't explore worst solutions, of course (branch and bound). + +2005-11-10 Charles Levert + + * src/grep.c (main): Fix a subtle memory allocation bug introduced + with the mb_icase_keys() function, which can call xrealloc() or + free() on keys, by making sure keys is always dynamically allocated. + +2005-11-09 Charles Levert + + * doc/grep.1, doc/grep.texi: Advise users to test for + "exit_status > 1" instead of "exit_status == 2" in order to + detect errors, for portability with other POSIX-compliant + implementations. + +2005-11-09 Charles Levert + + The following set of changes aims to make "egrep" and "fgrep" + minimal executable programs for legacy applications, instead of + shell scripts. This "fgrep" is much smaller than "grep". + This set of changes appears more daunting than it really is. + + * src/egrep.c, src/fgrep.c, src/esearch.c, src/fsearch.c: New files + that #define either EGREP_PROGRAM or FGREP_PROGRAM and #include + the corresponding generic (i.e., non e or f specific) *.c file. + * src/grepmat.c: Remove whole file. + * src/Makefile.am: Remove no-dependencies from AUTOMAKE_OPTIONS. + Add definitions to make "egrep" and "fgrep" specific standalone + executable programs that only use the source files they need. + Remove rules for "egrep" and "fgrep" shell scripts. + * src/grep.h: #define GREP_PROGRAM if both EGREP_PROGRAM and + FGREP_PROGRAM are #undef. Only declare matchers[] in this case + along with the compile_fp_t and execute_fp_t function pointers + typedefs, otherwise declare prototypes for straight compile() + and execute() functions for the specialized "egrep" and "fgrep" + programs. Remove the extern declaration for matcher. + Define COMPILE_RET, COMPILE_ARGS, EXECUTE_RET, EXECUTE_ARGS, + COMPILE_FCT, and EXECUTE_FCT helper preprocessor macros. + * src/grep.c (short_options, long_options, usage, main): Only + support -G, -E, -F, -P, and -X for GREP_PROGRAM, but not for + EGREP_PROGRAM or FGREP_PROGRAM. Customize usage messages. + * src/grep.c (set_limits): New function with unchanged code, + called from main(), because it shouldn't be in install_matcher() + since it was already matcher-independent. + * src/grep.c (matcher): Add as static, only for GREP_PROGRAM. + * src/grep.c (setmatcher, install_matcher): Only for GREP_PROGRAM. + * src/grep.c (main): Remove any tweaking and dependence on argv[0]. + * src/grep.c (print_line_middle, prpending, grepbuf, main): Call + compile() and execute() directly, not through a function + pointer dereferencing notation, so that it works with both + straight functions (in EGREP_PROGRAM and FGREP_PROGRAM) and + function pointers (in GREP_PROGRAM). + * src/search.c (, "dfa.h", dfa, pattern0, patterns, + pcount, dfaerror, kwset_exact_matches, kwsmusts): Only + include/declare/define if not FGREP_PROGRAM. + * src/search.c: Remove function prototypes for all functions + that are not used before their definition, since this is just + a hassle now with their varying names and conditional definition. + * src/search.c (GEAcompile): Rename from Ecompile(). Add new + syntax_bits argument/variable. Use as compile() for EGREP_PROGRAM. + Put in the needed RE_ICASE fix, albeit commented-out for now. + Make sure to free() modified word/line pattern after use, if any. + * src/search.c (Gcompile): Merge with GEAcompile() then remove. + * src/search.c (Gcompile, Acompile, Ecompile): New small functions + that call GEAcompile(), now that matcher is not an extern variable. + * src/search.c (GEAcompile, Gcompile, Acompile, Ecompile, + Fcompile, Pcompile, EGexecute, Fexecute, Pexecute, matchers): + Only define when needed according to *GREP_PROGRAM, and rename + to just compile() and execute() when appropriate. + * grep/bootstrap/Makefile.try: Similar changes. + +2005-11-08 Charles Levert + + * README.DOS, TODO, grep.spec, doc/grep.1, doc/grep.texi, + src/grep.h, po/da.po, po/nb.po, po/no.po, po/sv.po: + Replace all capitalized "Grep" by a lowercase "grep", except + in citations. Reported by Benno Schulenberg + from the + entry in the Debian bug tracker. + * doc/grep.1, doc/grep.texi: Explain that the "egrep" and "fgrep" + commands are deprecated and provided for historical applications. + Replace some "egrep" uses by "grep -E" to promote the newer usage. + Typeset "zgrep" as a command. Fix some spacing and punctuation bugs. + +2005-11-08 Julian Foad + + * doc/grep.texi: Rewrite a poorly written usage example about + back-references, and tweak another. New text by Benno Schulenberg. + +2005-11-04 Charles Levert + + * src/grep.c (mb_icase_keys): New function to properly lowercase + keys if match_icase. The problem was that some multi-octet + characters can get longer or shorter upon this conversion, so that + it cannot just naively be done in place on the same memory buffer. + * src/grep.c (main): Call mb_icase_keys (and remove in-line code). + + * tests/foad1.sh: Duplicate three "-o -b" tests for the "-F" + mode because it relies on a different code path that deserves + the same kind of testing. + +2005-09-27 Stepan Kasal + + * doc/grep.1: Fix a typo. + +2005-08-24 Charles Levert + + * src/grep.c (print_line_middle): In case of an empty match, + make minimal progress and continue instead of aborting process + of the remainder of the line, in case there's still an upcoming + non-empty match. + * tests/foad1.sh: Add two tests for this. + * doc/grep.texi, doc/grep.1: Document this behavior, since + --only-matching and --color are GNU extensions which are + otherwise unspecified by POSIX or other standards. + +2005-07-26 Charles Levert + + * tests/pcre.sh: New file. Add test 1. + * tests/Makefile.am: Add pcre.sh to TESTS. + +2005-07-07 Charles Levert + + * src/grep.c: Remove all xm capability code. + +2005-07-05 Charles Levert + + * doc/grep.texi: Add missing green color in GREP_COLORS description. + * doc/grep.1: Fix typo and reorganize GREP_COLORS documentation. + + * src/kwset.c (DEPTH_SIZE): New macro to anticipate + architectures/compilers where CHAR_BIT is not 8 (we assume it + won't be less than 4, which would be non-standard and unlikely). + Checked to hold for CHAR_BIT up to 1023 (and maybe more)! + * src/kwset.c (kwsincr): Use DEPTH_SIZE in two array declarations. + + * src/kwset.c (kwsincr): When a second obstack_alloc() call fails, + free what the first one successfully allocated by popping it + off the top of the obstack, before returning in error, just + to keep things clean. + * src/kwset.c (kwsprep): Verify return value of obstack_alloc() + and return a memory exhausted error if so. This function had + a prototype to return such errors, but never did. + +2005-07-04 Charles Levert + + * src/kwset.c: Readability changes. + Replace uses of 0 for pointer values by NULL. + Generalize use of existing U() macro to whole file. + + * src/kwset.c (kwsprep): Use memset() and memcpy() when appropriate. + + * src/kwset.c (kwsprep): Move three variable declarations to + the single {}-block where they are used. + + * src/kwset.c (kwsprep): Optimize search for mind2 value by + starting from the end of the target[] array. + +2005-06-22 Charles Levert + + * grep/autogen.sh, grep/src/Makefile.am, grep/tests/backref.sh, + grep/tests/bre.sh, grep/tests/empty.sh, grep/tests/ere.sh, + grep/tests/file.sh, grep/tests/fmbtest.sh, grep/tests/foad1.sh, + grep/tests/khadafy.sh, grep/tests/options.sh, + grep/tests/spencer1.sh, grep/tests/spencer2.sh, + grep/tests/status.sh, grep/tests/warning.sh: As per autoconf's + "Portable Shell Programming" guidelines, replace all instances + of "#!/bin/sh" by "#! /bin/sh" (notice the space). + +2005-06-21 Charles Levert + + * src/grep.c (nlscan): Make this function more robust by removing + the undocumented assumption that its "lim" argument points + right after a line boundary. This will be used later to fix + --byte-offset's broken behavior. Patch #3769. + + * src/grep.c (main): Add a test to check if -o/--only-matching + and context lines are both specified and if so, set both context + specifications (before and after) to zero then print an explicit + warning to stderr explaining what was done and why (as opposed + to drastically aborting the process in error). Patch #3768. + Other code needs this zero setting to work correctly without + having to repeatedly test for this conflictual condition. + + * tests/foad1.sh: Add tests combining -o, -n/-b/-H, and -i, + since there are separate code paths for -i. Add tests combining + -o, -n/-b/-H, and -3, since any context line specification + should be ignored when combined with -o. + * src/grep.c (print_line_head): New function, culled off the + top content of prline(). Adds a guard against "lastnl" having + already reached "lim", which can happen when if the function + is called more than once per line. + * src/grep.c (prline): Now calls print_line_head(), not only at + the beginning to replace the moved code when -o is not + specified, but also for each match when -o is specified (two + code paths with this). Patch #3770, more or less. This makes + all tests combining -o and -n/-b/-H pass, which they didn't + before. Fixes bug #12727. + + * src/grep.c (SEP_CHAR_MATCH, SEP_CHAR_CONTEXT, SEP_STR_CHUNK): + New macros for ':', '-', and "--". Used throughout the file. + Will be used even more in upcoming updates, so good to have now. + + * src/grep.c: The new GREP_COLORS (plural) framework, only + partially used at this point to make for a simpler initial + patch in CVS. A subset of patch #3644 on Savannah. + * src/grep.c (color_cap_ne_fct, color_cap_xm_fct, print_filename, + print_sep, parse_grep_colors): New functions. + * src/grep.c (prtext, grepfile, main): Existing functions modified + to use the new framework. + * doc/grep.texi, doc/grep.1: Document GREP_COLORS. + + * src/grep.c: The new -T/--initial-tab framework, only + partially used at this point to make for a simpler initial + patch in CVS. A subset of patch #3644 on Savannah. + The option name/calling convention is the same as for GNU diff. + * doc/grep.texi, doc/grep.1: Document -T/--initial-tab. + + * src/grep.c (print_offset): Renamed print_offset_sep() to better + represent its new functionality; new calling convention. + * src/grep.c (print_offset, print_line_head): Use and implement + missing parts of the GREP_COLORS and -T/--initial-tab frameworks. + + * src/grep.c (print_line_middle, print_line_tail): New functions, + unused for now, intended to allow a simplifying rewrite of + prline(). Adding them first will make for cleaner CVS patches. + + * src/grep.c (prline): Simplifying rewrite using + print_line_middle() and print_line_tail(). No longer attempts + to find matches to colorize in context lines, thus avoiding + costly calls to (*execute)(), since we know by then that they + can't contain any by definition. There are no longer four + different code paths whether -o and -i are each specified + or not; they have been unified into one, which should help + avoid bugs similar to previous ones due to not updating all + code paths in a synchronized fashion. The -i code has been + explicitly marked since it doesn't belong there and should + be removed as soon as other -i code elsewhere is fixed. + The remaining GREP_COLORS functionality is implemented. + Savannah patch #3771 and patch #3644, heavily reworked. + + * src/grep.c (color_cap_ne_fct, color_cap_xm_fct, + print_line_middle, print_line_tail): Make these four functions + static. + +2005-06-20 Charles Levert + + * src/grep.c: Extensively document the SGR/EL-to-Right issue. + + * src/grep.c: Explain the context and logic for choosing default + --color screen attributes (SGR parameters). + +2005-06-15 Charles Levert + + * tests/foad1.sh: Since this script is run by /bin/sh, it + must work under posix mode. That means not using assignment + statements right before a function call (LC_ALL=... grep_test, + in this case), because it won't do the expected thing. + +2005-06-14 Charles Levert + + Fix bug #11022 (Line wrapping causes GREP_COLOR background + color to "smear") by outputting a "clear to end of line" + control sequence after each SGR (Select Graphic Rendition) + control sequence (START and END). This also avoid similar + problems with HT (tab) characters. + + * src/grep.c (SGR_START, SGR_END, PR_SGR_FMT, PR_SGR_FMT_IF, + PR_SGR_START, PR_SGR_END, PR_SGR_START_IF, PR_SGR_END_IF): + New macros. + * src/grep.c (prline): Use the new macros. + * tests/fmbtest.sh, tests/foad1.sh: Adjust the regression tests + to expect the new control sequences. + +2005-05-06 Charles Levert + + * TODO: Add a few more projects and derived versions to check out. + +2005-05-05 Charles Levert + + * README-alpha: Document grep-commit mailing list. + * TODO: Add various stuff culled from the mailing list. + +2005-05-02 Charles Levert + + * 78 files: Update FSF's civic address, zip code, + and citizen relocation code. + +2005-04-29 Charles Levert + + * tests/foad1.sh: Add -b and tricky UTF-8 tests. + Display LC_ALL when its value is special. Patch #3962. + + * ABOUT-NLS: Sync with CVS revision 1.9 + of 2005-04-13T11:21:55Z from GNU gettext + on ":pserver:anoncvs@sources.redhat.com:/cvs/gettext", + file "gettext/gettext-runtime/ABOUT-NLS". + +2005-04-29 Julian Foad + + * Makefile.am: Remove reference to long-gone files PATCHES.AC and + PATCHES.AM. Thanks to Tony Abou-Assaleh for this. Patch #3961. + +2005-04-29 Charles Levert + + * src/grep.c: Fix typo in prline()'s --only-matching --ignore-case + code path; this fixes bug #9768 and passes one more test + in tests/foad1.sh. This whole code path should be removed in + the future, when other --ignore-case issues are dealt with. + +2005-04-28 Julian Foad + + * tests/foad1.sh: Remove Bash-specific syntax. + + * src/dfa.c: Fix a DFA bug whereby a bracket "[" was matched by the + pattern "[[:alpha:]]" in UTF-8 locales. Patch #3800, by Tim Waugh. + * tests/foad1.sh: Add a regression test for that. + +2005-04-27 Julian Foad + + Fix a bug reported by Elliott Hughes in patch #1834 whereby "grep -Fw" + would miss matches after a non-word occurrence of the pattern. Fix by + Gordon Lack; tests based on reproduction recipes by Gordon Lack. + + * src/search.c (Fexecute): Fix the "match_words" case. + * tests/foad1.sh: Modify the test framework so that the "PATTERN" + argument is optional. Add a regression test and a test for + a similar case that other proposed patches have got wrong. + + Add more tests, some initially failing. + + * tests/foad1.sh: Add tests for "--color", most initially failing. + * tests/fmbtest.sh: New file of tests for "grep -i" with multi-byte + chars, by Jakub Jelinek, from patch #3808: Red Hat's "tests" patch. + Initially, test #4 fails (in all three modes). + * tests/Makefile.am: Include the new tests file "fmbtest.sh". + +2005-04-12 Julian Foad + + * tests/bre.tests: Enable a regression test for bug #9519. + * src/grep.c: Fix a seg-fault in "-o -i": patch #1939. + * tests/foad1.sh: New tests for "-o", initially all failing. + * tests/Makefile.am: Include the new tests file "foad1.sh". + * tests/spencer2.sh: Be consistent with "spencer1.sh" in the + naming of associated files. + * src/grep.c: Fix off-by-one error in prpending(). + Patch #3840 by Claudio Fontana. + * tests/foad1.sh: Add tests by Pavol Gono for patch #3840. + Some of them still fail, but no longer seg-fault due to that bug. + +2005-04-11 Julian Foad + + * doc/grep.texi, doc/grep.1: Document USG grep -s too. + Based on a patch by Paul Eggert; suggested by Keith Marshall. + * src/dfa.c (lex): Fix bug #9519: "echo do^re | grep do^re" was + failing to find a match. + +2005-03-09 Stepan Kasal + + * src/search.c (EGexecute, Fexecute): Use xmalloc, not malloc. + (EGexecute): Handle the failure in one place, goto there. + +2005-02-26 Stepan Kasal + + * src/grep.c (get_nondigit_option): Don't give up too early. + * src/search.c (Pexecute): Add a comment explaining that this + situation should not happen. + +2005-02-22 Claudio Fontana (tiny change) + + * src/search.c (Pexecute): Consider eof case when delimiting + matching line. Fixes bug #4531. + +2005-02-23 Julian Foad + + * po/ko.po: Fix email address. + * README-alpha: Fix email addresses and clarify the notes. + * tests/backref.sh: Fix trivial typos. + +2005-02-08 Bruno Haible (tiny change) + + * src/kwset.h (kwsincr, kwsprep): Change return type to 'const char *'. + * src/kwset.c (kwsincr, kwsprep): Likewise. + +2005-02-08 Arnold D. Robbins + Stepan Kasal + + * src/mbsupport.h: Don't say the file is part of GAWK. + Make wording in explanatory comment more generic. + +2005-02-07 Stepan Kasal + + * src/grep.c: Document that -X is undocumented. + +2005-01-16 Bruno Haible (tiny change) + Stepan Kasal + + * configure.in: Add tests for iswctype, mbrlen, wcrtomb, wcscoll; + use AC_FUNC_MBRTOWC to check for mbrtowc and mbstate_t; move + AC_MBSTATE_T below it. + * src/grep.c: Include mbsupport.h to define MBS_SUPPORT uniformly. + * src/mbsupport.h: Don't test for HAVE_WCTYPE_T. + +2005-01-13 Arnold D. Robbins + + * src/dfa.c (dfaparse): Use LC_COLLATE whenever it is defined; + ENABLE_NLS has nothing to do with this. + +2005-01-07 Stepan Kasal + + * tests/status.sh: Added two tests--option `-s' should have no + influence on the exit status. + +2004-12-16 Stepan Kasal + + Cosmetic changes, mostly imported from gawk: + + * src/dfa.c (lexstart): Removed unused variable. + (parse_bracket_exp_mb): Don't initialize different pointers in one + assignment + (lex): Don't initialize automatic arrays, it's invalid in pre-C89 + compilers. + Various other typos. + * src/dfa.h, src/grep.c, src/search.c: Typos. + +2004-12-16 Isamu Hasegawa + + From http://oss.software.ibm.com/linux/patches/?patch_id=25 + + * src/search.c: Patch for i18n correctness. + * src/grep.c: Likewise. + * src/dfa.c: Likewise. + * lib/regex.c: Likewise. + +2004-12-15 Julian Foad + + Changes to documentation and help text, mostly from Stepan Kasal. + + * doc/grep.texi: Minor fixes of phrasing. + * doc/grep.1: Likewise. + * src/grep.c: Likewise. + +2004-12-01 Stepan Kasal + + * src/grep.c (usage): Use ``FILE_PATTERN'' for --include and --exclude, + change ``only print'' to ``print only''. + * doc/grep.1: Likewise; state that wildcard matching is used. + Move some options so that they are sorted alphabetically. + * dfa.c, NEWS: Fix typos. + +2004-11-28 Benno Schulenberg (tiny change) + + * src/grep.c (usage): Clean up several details in the usage string. + * doc/grep.1: Fix descriptions of --include and --exclude. + * doc/grep.texi: Likewise. + +2004-11-23 Stepan Kasal + + * src/Makefile.am: The egrep and fgrep script now use their own + path to construct the full pathname of grep. + +2004-11-23 Stepan Kasal + + * src/Makefile.am: Merged the rules for creating the egrep and + fgrep script. + +2004-11-23 Stepan Kasal + + * src/grep.c (usage): Make sure both copies of the ``usage'' + strings match. Add ``(C)'' to the copyright notice. + * src/dfa.c: Changed ``out of memory'' to ``memory exhausted'' to + match messages elsewhere in the source. + +2004-11-22 Stepan Kasal + + * src/search.c: Use mbsupport.h . + * src/dfa.c: Move the inclusion of mbsupport.h lower. + +2004-11-22 Stepan Kasal + + * src/grep.c (main): Use PACKAGE_STRING for --version. + +2004-11-20 Benno Schulenberg (tiny change) + + * src/grep.c (reset): Move the stat check ... + (grepfile): ... here, and also check for a fifo. + +2004-11-20 Stepan Kasal + + This change is based on a suggestion by Elliott Hughes. + + * src/grep.c (usage): Use PACKAGE_BUGREPORT. + * po/*.po: Hacked the current translation again. + +2004-11-20 Stepan Kasal + + * configure.in: Added a copyright notice (using gawk as a template). + (AC_INIT, AM_INIT_AUTOMAKE): Changed to the ``new'' form so that + the PACKAGE_* symbols get defined correctly in config.h. + +2004-11-20 Stepan Kasal + + * ./cvsignore: Amended several .cvsignore files and + removed *.gmo, acinclude.m4 and stamp-h.in from the root one. + * m4/init.m4: Nuked, it was breaking current automake. + * m4/Makefile.m4: Removed init.m4. + * autogen.m4: Drop support for legacy autoconf; tell whether the + auto tools exited successfully or not; fix the permissions of + tests/*.sh--CVS doesn't provide a way to fix it. + +2004-11-19 Stepan Kasal + + * src/dfa.c: Removed old version of gofast patch, from 2003-05-30. + * src/search.c (check_multibyte_string): Likewise. + +2004-11-19 Stepan Kasal + + * src/dfa.c: Added some simple changes from gawk. + * src/mbsupport.h: Imported from gawk. + +2004-11-11 Stepan Kasal + + * tests/spencer1.awk: Use only lines with 3 fields. + * tests/spencer1.tests: Disable #55 for now. + * tests/ere.tests, tests/bre.tests: Add ``TO CORRECT'' to disabled + tests which had empty $4. + * tests/backref.sh: Modify #2 so that current glibc regex can + handle it in finite time. + +2004-11-12 Stepan Kasal + + Change bug-gnu-utils address to bug-grep, on many places; there + is no need to have the word ``grep'' in subject then. + Thanks to Tony Abou-Assaleh and Benno Schulenberg for pointing + out this. + +2004-11-02 Stepan Kasal + + * README-alpha: Remove obsolete instructions about CVS, redirect + the reader to savannah web. + +2004-09-26 Stepan Kasal + + * src/search.c (check_multibyte_string, Gcompile, Ecompile): Replace + malloc with xmalloc. + * src/dfa.c (dfamust): Replace two calls to ``malloc'' by MALLOC. + +2003-07-23 Stepan Kasal + + * src/Makefile.am: Add the egrep and fgrep scripts to CLEANFILES. + +2003-07-23 Stepan Kasal + * tests/backref.sh: Messages fixed. + +2003-07-08 David Kaelbling (tiny change) + * src/dfa.c: remove non-constant initializers from dfa.c + +2003-06-16 Stepan Kasal + * doc/grep.1: two typos ``--line-buffered [...] penalty'' + * doc/grep.texi: a typo + +2003-06-12 Bernhard Rosenkraenzer + * README-alpha: Mention bug tracking system and grep-devel-list + * tests/spencer1.tests: Fix test 55, as noted by Tim Waugh + * src/search.c: Speed up multibyte support (Patch from Tim Waugh) + +2003-06-05 Stepan Kasal + * tests/formatbre.awk, tests/formatere.awk: probably unused, so + I've removed them. + +2003-06-05 Stepan Kasal + * intl/Makefile: remove generated file. + +2003-06-04 Stepan Kasal + * src/dfa.c: typos fixed. + +2003-05-30 Bernhard Rosenkraenzer + * src/dfa.c: Speed up multibyte support (Patch from Tim Waugh) + +2003-01-18 Bernhard Rosenkraenzer + * src/grep.c: Fix -i -o combination (Patch from Tim Waugh) + +2002-03-26 Bernhard Rosenkraenzer + + * 2.5.1 Release. + +2002-03-26 Bernhard Rosenkraenzer + * src/grep.c: Don't fail if we don't have an stdout fd and -q + is used (happens e.g. on calls from hotplug scripts) + * src/grep.c: Don't hang forever if fed with an empty string to + grep for and --color enabled + * src/grep.c: Fix infinite loop on + echo "1 one" | grep -E "[0-9]*" -o + echo "1 one" | grep -E "[0-9]*" --color + * po/*: Sync with translation project + * src/grep.c, src/Makefile.am, configure.in: Add patch from + Paul Eggert to comply with ridiculous + guidelines (don't act differently if invoked as egrep or fgrep) + * configure.in: Bump version number, require a recent autoconf + +2002-03-14 Bernhard Rosenkraenzer + * src/Makefile.am, po/Makefile.in.in: Support DESTDIR properly + * tests/bre.tests: Add fix from + Peter Breitenlohner + +2002-03-13 Bernhard Rosenkraenzer + * configure.in, m4/regex.m4, m4/malloc.m4, m4/realloc.m4: + Don't set LIBOBJS directly, autoconf 2.53 doesn't like it + * intl/*: Sync with gettext 0.11 + * po/*: Sync with translation project + * configure.in, src/Makefile.am: Don't duplicate code - make + egrep and fgrep links to grep and set matcher based on + application name, suggestion from + Guillaume Cottenceau + * src/grep.c: (prline) Add fix for -i --color from + Jim Meyering + * configure.in: Version 2.5; release + +2002-01-23 Bernhard Rosenkraenzer + * configure.in: Version 2.5g + * Makefile.cvs, grep.spec: Add packaging tools + Merge djgpp changes from Andrew Cottrell : + * src/grep.c: Added conditional compilation for DJGPP + * djgpp: remove directory as it is no longer required with DJGPP 2.03 + (or 2.04 when released) + * README.DOS: Moved djgpp/readme to readme.dos + * PATCHES.AC, PATCHES.AM: delete files - redundant + * configure.in, Makefile.am: remove djgpp directory from list + +2002-01-22 Bernhard Rosenkraenzer + * doc/grep.texi, doc/grep.1, NEWS: Document --label + * po/ru.po: Sync with translation project + * po/grep.pot: Sync with source + +2002-01-18 Bernhard Rosenkraenzer + * src/grep.c: Add --label, based on patch from Stepan Koltsov + +2001-11-20 Bernhard Rosenkraenzer + * autogen.sh: Don't hardcode aclocal dir + +2001-11-19 Bernhard Rosenkraenzer + * src/grep.c: Add --only-matching (-o) switch (see NEWS) + * doc/grep.texi, doc/grep.1, NEWS: Document changes + * configure.in, lib/Makefile.am: Don't use internal getopt if + we're on a system that provides a working getopt function + +2001-09-25 Bernhard Rosenkraenzer + * configure.in: Detect pcre correctly even when it's in + non-standard locations, using pcre-config + * src/grep.c: Add --color={always,never,tty} argument (like in ls) + * src/grep.c: Turn off blinking in the default colorization + * src/grep.c: Add --devices (-D) switch (analogous to --directories) + * src/dfa.c: Fix an i18n bug: echo "A" | grep '[A-Z0-9]' wouldn't work + in non-C-Locales on systems using current versions of glibc. + * AUTHORS: Change maintainer, credit Alain for his work until now + * configure.in, m4/decl.m4, m4/dosfile.m4, m4/gettext.m4, + m4/init.m4, m4/install.m4, m4/largefile.m4, m4/lcmessage.m4, + m4/header.m4, m4/isc-posix.m4, m4/missing.m4, m4/progtest.m4, + m4/sanity.m4: + Fix build with autoconf 2.5x, retain 2.1x compatibility for now + * autogen.sh: Add some crude hacks to make it possible to build with + both autoconf 2.5x and 2.1x + * acconfig.h: removed (no longer required) + * Makefile.am: add cvs-clean target + * doc/grep.texi, doc/grep.1, NEWS: Document changes + (--color, --devices, -D) + * src/dfa.c, src/grep.c: Add vim modelines + +2001-08-30 Alain Magloire + + * configure.in: Add gl in ALL_LINGUAS. + +2001-08-30 Kurt D Schwehr + + * doc/grep.1: Warn that grep insert a "--" between groups of matches, + when using the context options. + * doc/grep.texi: Likewised. + +2001-08-25 Heikki Korpela + + * doc/grep.texi: Point out that some Platforms do not support + reading of directories and silently ignore them. + +2001-08-21 Alain Magloire + + * lib/malloc.c: New file: + * lib/realloc.c: New file: + * lib/Makefile.am: Add malloc.c and realloc.c in EXTRA_DIST. + +2001-07-31 Alain Magloire + + * po/*.po: New files from the translation team: + grep-2.5e.de.po grep-2.5e.el.po grep-2.5e.eo.po grep-2.5e.es.po + grep-2.5e.et.po grep-2.5e.fr.po grep-2.5e.gl.po grep-2.5e.it.po + grep-2.5e.pl.po grep-2.5e.sl.po + +2001-07-31 Andreas Schwab + + * src/grep.c: Fix all uses of error to pass a proper format + string. + +2001-07-29 Alain Magloire + + * grep/src/grep.c (usage): Typos corrected. + Patches from Santiago Vila. + +2001-07-29 Alain Magloire + + David Clissold, wrote: + a small bug in the GNU grep 2.4.2, which may have gone unnoticed + because it only causes a failure if building on a system with large + files enabled (e.g. an "off_t" is a "long long" rather than a "long"). + savedir() takes on off_t argument, but in grepdir() the parameter + is cast to an (unsigned). Well, if an off_t is larger than an int, + the value gets truncated. This would not normally have an effect on a + little-endian platform (unless the file is >2GB), but on a big-endian + system it will always fail. The external effect is that + "grep -r foo dir_name" fails with ENOMEM (from malloc() within + savedir()). + + * grep/src/grep.c (grepdir): Remove the (unsigned) cast when calling + savedir(). + Patch from David Clissold. + +2001-07-29 Alain Magloire + + * grep/doc/grep.texi: In Bugs report use {n,m} for consistency. + * grep/doc/grep.1: Likewised. + Noted by Steven Lucy. + +2001-04-27 Isamu Hasegawa + + * dfa.c (mblen_buf) : New variable contains the amount of remain + byte of corresponding multibyte character in the input string. + (SKIP_REMAIN_MB_IF_INITIAL_STATE) : Use mblen_buf. + (match_anychar) : Use mblen_buf. + (match_mb_charset) : Use mblen_buf. + (transit_state_consume_1char) : Use mblen_buf. + (transit_state) : Use inputwcs to get current (multibyte) character. + (dfaexec) : Add initialization of mblen_buf. + +2001-04-27 Isamu Hasegawa + + * dfa.c (addtok) : Set appropriate value to multibyte_prop. + (dfastate) : Add the initialization of the variable. + (dfaexec) : Call transit_state if d->fail may transit by + multibyte characters. + (transit_state_singlebyte) : Clean up unnecessary code. + (transit_state_consume_1char) : Likewise. + (transit_state) : Add checking for word and newline. + +2001-04-19 Isamu Hasegawa + + * search.c (check_multibyte_string) : Check the case when mbclen == 0. + +2001-04-11 Isamu Hasegawa + + * search.c (check_multibyte_string) : Check the head of multibyte + characters, and optimize a bit. + (EGexecute) : Optimize a bit. + (Fexecute) : Fix the index. + +2001-04-02 Alain Magloire + + * lib/regex.c: Update from GNU lib C, with the changes + provided by Paul Eggert. + * lib/posix/regex.h: Likewise. + +2001-02-17 Paul Eggert + + Stop trying to support hosts that have nonstandard declarations for + mbrtowc and/or mbstate_t. It's not worth the portability hassle. + + * lib/quotearg.c (mbrtowc, mbsinit): Remove workaround macros + for hosts that have mbrtowc but not mbstate_t, as we now + insist on proper declarations for both before using mbrtowc. + +2001-03-18 Alain Magloire + + * configure.in: Call AC_MBSTATE_T. + * Makefile.am: Add mbstate_t.m4 + * m4/Makefile.am: Add mbstate_t.m4 + * m4/mbstate_t.m4: New m4 macro. + * lib/strtol.c: Define CHAR_BITS. + Uwe H. Steinfeld, Ruslan Ermilov, Volkert Bochert, noted + that mbstate_t was not define for certain platforms. + +2001-03-18 Paul Eggert + + * src/grep.c (fillbuf): Fix storage allocation performance + bug: buffer was doubling in size in many cases where it didn't + have to. + +2001-03-17 Paul Eggert + + * src/grep.c (fillbuf): Avoid unnecessary division by 2. + Don't check xrealloc return value; it's guaranteed to be nonzero. + (fillbuf, grepdir): Use xalloc_die rather than error; it's shorter. + +2001-03-17 Alain Magloire + + * src/grep.c (context_length_arg): error () passing wrong format. + Spotted by Jim Meyering. + +2001-03-07 Alain Magloire + + * README-alpha: Removed reference to GNU tar, add the location + of the CVSROOT. + +2001-03-06 Alain Magloire + + Only the Regex patterns should be split in an array, patterns[]. + The dfa and KWset compiled patterns should remain global and the + patterns compiled all at once. + + * src/search.c: include "error.h" and "xalloc.h" to get prototyping + of x*alloc() and error(). + (kwsinit): Reverse to previous behaviour and takes no argument. + (kwsmusts): Likewised. + (Gcompile): For the regex pattern, split them and each pattern + is put in different compiled structure patterns[]. The patterns + are given to dfacomp() and kwsmusts() as is. + (Ecompile): Likewised. + (Fcompile): Reverse to the old behaviour of compiling the enire + patterns in one shot. + (EGexecute): If falling to GNU regex for the matching, loop in the + array of compile patterns[] to find a match. + (error): Many error () were call with arguments in the wrong order. + * tests/file.sh: Simple test to check for pattern in files. + + Reaction to bug report fired by Greg Louis + +2001-03-06 Isamu Hasegawa + + In multibyte environments, handle multibyte characters as single + characters in bracket expressions. + + * src/dfa.h (mb_char_classes) : new structure. + (mbcsets): new variable. + (nmbcsets): new variable. + (mbcsets_alloc) : new variable. + * src/dfa.c (prtok) : handle MBCSET. + (fetch_wc): new function to fetch a wide character. + (parse_bracket_exp_mb) : new function to handle multibyte character + in lex(). + (lex): invoke parse_bracket_exp_mb() for multibyte bracket expression. + (atom): handle MBCSET. + (epsclosure): likewise. + (dfaanalyze): likewise. + (dfastate): likewise. + (match_mb_charset): new function to judge whether a bracket match + with a multibyte character. + (check_matching_with_multibyte_ops) : handle MBCSET. + (dfainit): initialize new variables. + (dfafree): free new variables. + +2001-03-04 Alain Magloire + + To get more in sync with other GNU utilities like GNU tar and fetish + all the supporting functions are now under lib. + Thanks to Jim Meyering, Volkert Bochert and Paul Eggert for + the code and the reminders. + + * src/grep.c (fatal): Function removed, using error () from + lib/error.c instead. + (usage): Copyright updated. + (error): Function removed, using error () from lib/error.c instead, + adjust prototypes. + (prog): Global variable rename to program_name, to work with new + lib/error.c. + (xrealloc): Removed using lib/xmalloc.c. + (xmalloc): Removed using lib/xmalloc.c + (main): Register with atexit() to check for error on stdout. + * configure.in: Check for atexit(), call jm_MALLOC, jm_RELLOC and + jm_PREREQ_ERROR. + * tests/bre.awk: Removed the hack to drain the buffer since we + always fclose(stdout) atexit. + * tests/ere.awk: Likewise. + * tests/spencer1.awk: Likewise. + * bootstrap/Makefile.try: Update the Makefile to reflect the changes + in the new hierarchy. + + * README-alpha: New File. + * m4/realloc.m4: New File. + * m4/malloc.m4: New File. + * m4/error.m4: New File. + * m4/Makefile.am: Updated. + * lib: New directory. + * lib/Makefile.am: New file. + * lib/closeout.c: New file. + * lib/closeout.h: New file. + * lib/fnmatch.c: New file. + * lib/fnmatch.h: New file. + * lib/atexit.c: New file. + * lib/error.c: New file. + * lib/error.h: New file. + * lib/quotearg.h: New file. + * lib/quotearg.c: New file. + * lib/xmalloc.c: New file. + * lib/posix: New directory. + * lib/posix/Makefile.am: New file. + * src/getopt.c: Moved to lib. + * src/getopt1.c: Moved to lib. + * src/getopt.h: Moved to lib. + * src/alloca.c: Moved to lib. + * src/exclude.c: Moved to lib. + * src/exclude.h: Moved to lib. + * src/hard-locale.h: Moved to lib. + * src/hard-locale.c: Moved to lib. + * src/isdir.c: Moved to lib. + * src/mechr.c: Moved to lib. + * src/obstack.c: Moved to lib. + * src/obstack.h: Moved to lib. + * src/regex.c: Moved to lib. + * src/regex.h: Moved to lib. + * src/posix: Moved to lib. + * src/posix/regex.h: Moved to lib. + * src/savedir.h: Moved to lib. + * src/savedir.c: Moved to lib. + * src/stpcpy.c: Moved to lib. + * src/strtoul.c: Moved to lib. + * src/strtol.c: Moved to lib. + * src/strtoull.c: Moved to lib. + * src/strtoumax.c: Moved to lib. + * src/xstrtol.c: Moved to lib. + * src/xstrtol.h: Moved to lib. + * src/xstrtoumax.c: Moved to lib. + +2001-03-01 Isamu Hasegawa + + Implement the mechanism to match with multibyte characters, + and use it for `period' in multibyte environments. + + * dfa.h (mbps): new variable. + * dfa.c (prtok): handle ANYCHAR. + (lex): use ANYCHAR for `period' in multibyte environments. + (atom): handle ANYCHAR. + (state_index): initialize mbps in multibyte environments. + (epsclosure): handle ANYCHAR. + (dfaanalyze): handle ANYCHAR. + (dfastate): handle ANYCHAR. + (realloc_trans_if_necessary): new function. + (transit_state_singlebyte): new function. + (match_anychar): new function. + (check_matching_with_multibyte_ops): new function. + (transit_state_consume_1char): new function. + (transit_state): new function. + (dfaexec): invoke transit_state if expression can match with + a multibyte character in multibyte environments. + (dfamust): handle ANYCHAR. + +2001-03-01 Alain Magloire + + * src/exclude.c: New file. + * src/exclude.h: New file. + * src/grep.c (main): Took the GNU tar code to handle + the option --include, --exclude, --exclude-from. + Files are check for a match, with exlude_filename (). + New option --exclude-from. + * src/savedir.c: Call exclude_filename() to check for + file pattern exclusion or inclusion. + * configure.in: --disable-pcre rename to --disable-perl-regexp. + + +2001-02-25 Alain Magloire + + * src/dfa.c: Typo corrected. + Noted by Isamu Hasegawa. + * src/savedir.c: Typos corrected. + +2001-02-22 Alain Magloire + + * src/savedir.c (isdir1): New function, calling isdir with + the correct pathname. + +2001-02-19 Isamu Hasegawa + + Avoid incorrect state transition in multibyte environments. + + * dfa.h (nmultibyte_prop): new variable. + (multibyte_prop): new variable. + * dfa.c (addtok): set inputwcs. + (dfastate): avoid incorrect state transition in multibyte + environments. + (dfaexec): likewise. + (dfainit): init multibyte_prop. + (dfafree): free multibyte_prop. + (inputwcs): new variable. + +2001-02-19 Isamu Hasegawa + + Handle a multibyte character followed by '*', '+', and '{n,m}' + correctly. + + * dfa.c (update_mb_len_index): new function. + Support for multibyte string. + (FETCH): call update_mb_len_index. + (lex): check cur_mb_index not to misunderstand multibyte characters. + (atom): make a tree from a multibyte character. + (dfaparse): initialize new variables. + (mbs): new variable. + (cur_mb_len): new variable. + (cur_mb_index): new variable. + +2001-02-18 Jim Meyering + + * m4/dosfile.m4 (AC_DOSFILE): Move AC_DEFINEs out of AC_CACHE_CHECK. + +2001-02-17 Alain Malgoire + + * doc/grep.texi: Document the new options and the new behaviour + back-references are local. Use excerpt from Karl Berry regex + texinfo. + + * bootstrap/Makefile.try: Added xstrtoumax.o xstrtoul.o hard-local.o + +2001-02-17 Alain Magloire + + From Guglielmo 'bond' Bondioni : + The bug was that using a multi line file that contained REs (one per + line), backreferences in the REs were considered global (to the file) + and not local (to the line). + That is, \1 in line n refers to the first \(.\) in the whole file, + rather than in the line itself. + + From Tapani Tarvainen : + # Re: grep -e '\(a\)\1' -e '\(b\)\1' + That's not the way it should work: multiple -e arguments + should be treated as independent patterns and back references + should not refer to previous ones. + + From Paul Eggert : + GNU grep currently does not issue + diagnostics for the following two cases, both of which are erroneous: + grep -e '[' -e ']' + grep '[ + ]' + POSIX requires a diagnostic in both cases because '[' is not a valid + regular expression. + + To overcome those problems, grep no longer pass the concatenate + patterns to GNU regex but rather compile each patterns separately + and keep the result in an array. + + * src/search.c (patterns): New global variable; a structure array + holding the compiled patterns. + Declare function prototypes to minimize error. + (dfa, kswset, regexbuf, regs): Removed, no longer static globals, but + rather fields in patterns[] structure per motif. + (Fcompile): Alloc an entry in patterns[] to hold the regex. + (Ecompile): Alloc an entry per motif in the patterns[] array. + (Gcompile): Likewise. + (EGexecute): Loop through of array of patterns[] for a match. + +2001-02-17 Alain Magloire + + From Bernd Strieder : + # tail -f logfile | grep important | do_something_urgent + # tail -f logfile | grep important | do_something_taking_very_long + If grep does full buffering in these cases then the urgent operation + does not happen as it should in the first case, and in the second case + time is lost due to waiting for the buffer to be filled. + This is clearly spoken not grep's fault in the first place, but libc's. + There is a heuristic in libc that make a stream line-buffered only if a + terminal is on the other end. This doesn't take care of the cases where + this connection is somehow indirect. + + * src/grep.c (line_buffered): new option variable. + (prline): if line_buffered is set fflush() is call. + (usage): line_buffered new option. + Input from Paul Eggert, doing setvbuf() may not be portable + and breaks grep -z. + +2001-02-16 Alain Magloire + + Patch from Isamu Hasegawa, for multibyte support. + This patch prevent kwset_matcher from following problems. + For example, in SJIS encoding, one character has the codepoint 0x895c. + So the second byte of the character can match with '\' incorrectly. + And in eucJP encoding, there are the characters whose codepoints are + 0xa5b9, 0xa5c8. On the other hand, there is one character whose + codepoint is 0xb9a5. So 0xb9a5 can match with 2nd byte of 0xa5b9 + and 1st byte of 0xa5c8. + + * configure.in: Add check for mbrtowc. + * src/search.c (check_multibyte_string): new function. + Support for multibyte string. + (EGexecute): call check_multibyte_string when kwset is set. + (Fexecute): call to check_multibyte_string. + (MBS_SUPPORT): new macro. + (MB_CUR_MAX): new macro. + +2001-02-16 Alain Magloire + + * djgpp/config.bat: Fix for 4dos.com. + * m4/dosfile.m4 (HAVE_DOS_FILE_CONTENTS): Was not set. + Bugs noted and patched by Juan Manuel Guerrero. + +2001-02-16 Alain Magloire + + A much requested feature, the possibility to select + files when doing recurse : + # find . -name "*.c" | xargs grep main {} + # grep --include=*.c main . + # find . -not -name "*.c" | xargs grep main {} + # grep --exclude=*.c main . + + * src/grep.c (short_options): -R equivalent to -r. + (#ifdef) : Fix some inconsistencies in the use of #ifdefs, prefer + #if defined() wen possible. + (long_options): Add --color, --include and exclude. + (Usage): Description of new options. + (color): Rename color variable to color_option. + Removed 'always|never|auto' arguments, not necessary for grep. + (exclude_pattern): new variable, holder for the file pattern. + (include_pattern): new variable, hoder for the file pattern. + * src/savedir.c: Signature change, take two new argmuments. + * doc/grep.texi: Document, new options. + * doc/grep.man: Document, new options. + +2001-02-09 Alain Magloire + + * src/grep.c (long_options): Added equivalent to -r with -R. + * src/grep.c (usage): added --color and --colour. + Noted with patch from, H.Merijn Brand and Wichert Akkerman. + +2001-02-09 Alain Magloire + + Patch from Ulrich Drepper to provide hilighting. + + * src/grep.c: New option --color. + (color): New static var. + (COLOR_OPTION): new constant. + (grep_color): new static var. + (prline): Now when color is set prline() will call the current matcher + to find the offset of the matching string. + * src/savedir.c: Take advantage of _DIRENT_HAVE_TYPE if supported. + * src/search.c (EGexecute, Fexecute, Pexecute): Take a new argument + when doing exact match for the color hiligting. + +2000-09-01 Brian Youmans + + * doc/grep.texi: Typo fixes. + +2000-08-30 Paul Eggert + + * doc/grep.texi (Usage): Talk about what "grep -r hello *.c" + means. + +2000-08-20 Paul Eggert + + Handle range expressions correctly even when they match + strings with two or more characters. + + * src/dfa.h (CRANGE): New enum value. Comment fix. + + * src/dfa.c: Include if HAVE_SETLOCALE. + Include "hard-locale.h". + (prtok): Print CRANGE. + (hard_LC_COLLATE): New static var. + (lex): Return CRANGE when parsing a character range in a hard locale. + Don't use strcoll; it's no longer needed and wasn't correct anyway. + Use unsigned rather than token to hold unsigned chars. + (addtok): Comment fix. + (atom): Treat a CRANGE as if it were (.\1), approximately. + (dfaparse): Initialize hard_LC_COLLATE. + + * src/Makefile.am (base_sources): Add hard-locale.c, hard-locale.h. + + * src/hard-locale.c, src/hard-locale.h: New files, taken from + textutils. + +2000-08-20 Paul Eggert + + * tests/Makefile.am (TESTS_ENVIRONMENT): Add LC_ALL=C, since + some of the tests assume the C locale. + +2000-08-16 Paul Eggert + + * src/search.c (Gcompile, Ecompile): -x overrides -w, for + consistency with fgrep. Don't assume that sizes fit in 'int'. + Fix comments to match code. + +2000-06-06 Paul Eggert + + * src/grep.c (grepdir): Don't look at st_dev when testing for + Mingw32 bug. + +2000-06-05 Paul Eggert + + Port to Mingw32, based on suggestions from Christian Groessler + . + + * src/isdir.c: New file, taken from fileutils. + + * src/Makefile.am (base_sources): Add isdir.c. + + * src/grep.c (grepfile): Use isdir instead of doing it inline. + (grepdir): Suppress ancestor check if the directory's inode and device + are both zero, as that occurs only on Mingw32 which doesn't support + inode or device. + + * src/system.h (isdir): New decl. + (is_EISDIR): Depend on HAVE_DIR_EACCES_BUG, not D_OK. + Use isdir, not access. + +2000-06-02 Paul Eggert + + Problen noted by Gerald Stoller + + * src/grep.c (main): POSIX.2 says that -q overrides -l, which + in turn overrides the other output options. Fix grep to + behave that way. + +2000-05-27 Paul Eggert + + Simplify and tune the buffer allocation strategy. Do not reserve a + large save area: reserve only enough bytes to hold the residue, plus + page alignment. Put a newline sentinel before the buffer, for speed + when searching backwards for newline. + + * src/grep.c (ubuffer, bufsalloc, PREFERRED_SAVE_FACTOR, page_alloc): + Remove. All uses changed. + (INITIAL_BUFSIZE): New macro. + (reset, fillbuf): Use simpler buffer allocation strategy. + (reset): Check for preposterously large pagesize that would cause + later calculations to overflow. + (fillbuf): Do not resize buffer if there's room at the end for + at least one more page. This greatly increases performance when + reading from non-regular files that contain no newlines. + When growing the buffer, double its size instead of using a + more complicated algorithm. + (prtext, grep): Speed up by relying on the newline sentinel before the + start of the buffer. + (grep): When looking backwards for the last newline in a buffer, + stop when we hit the residue, since it can't contain a newline. + This avoids an O(N**2) algorithm when reading binary data from + a pipe. Use a sentinel to speed up the backward search for newline. + (nlscan): Undo previous change; it wasn't needed and just complicates + and slows down the code a tad. + +2000-05-24 Paul Eggert + + Handle very large input counts better. Bug noted by Jim Meyering. + + * src/grep.c (totalcc, totalnl): Use uintmax_t, not off_t. + (add_count): New function. + (nlscan, prline, grep): Use it to check line and byte count overflows. + (nlscan, grep): Don't keep track of counts when not asked to; this + avoids unnecessary overflow diagnostics. + (print_offset_sep): Now takes args of type uintmax_t and char, + not off_t and int. + +2000-05-16 Paul Eggert + + Problem reported by Bob Proulx , this patch + is base on his finding, with appropiate corrections. + + * src/grep.c (main): Fix bug: -x and -w matched even when no + patterns were specified. + * tests/empty.sh: Test for -x and -w bug in grep 2.4.2. + +2000-04-24 Paul Eggert + + POSIX.2 conformance fixes: grep -q now exits with status zero + if an input line is selected, even if an error also occurs. + grep -s no longer affects exit status. + + * src/grep.c (suppress_errors): Move definition earlier so + that suppressible_error can use it. + (suppressible_error): New function. + (exit_on_match): New var. + (grepbuf): If exit_on_match is nonzero, exit with status zero + immediately. + (grep, grepfile, grepdir): Invoke suppressible_error. + (main): -q sets exit_on_match. + + * doc/grep.1, doc/grep.texi, NEWS: + Document -q's behavior as required by POSIX.2. + + * tests/status.sh: + Test for -q and -s behavior as conforming to POSIX.2. + +2000-04-20 Paul Eggert + + * tests/Makefile.am (TESTS_ENVIRONMENT): + Set GREP_OPTIONS to the empty string. + +2000-04-20 Paul Eggert + + * tests/status.sh: Fix typo: test -b -> test -r. + +2000-04-20 Paul Eggert + + * src/dfa.c (lex): + Do not assume that [c] is equivalent to [c-c]; this isn't true + if LC_COLLATE specifies that some characters are equivalent. + (setbit_case_fold): New function. + (lex): Use it to simplify the code a bit. + +2000-04-17 Paul Eggert + + Do CRLF munging only if HAVE_DOS_FILE_CONTENTS, instead of + having it depend on O_BINARY (which leads to incorrect results + on BeOS, VMS, and MacOS). + + * bootstrap/Makefile.try (DEFS): Add -DHAVE_DOS_FILE_CONTENTS. + * src/system.h (SET_BINARY): Define only if HAVE_DOS_FILE_CONTENTS. + (O_BINARY): Do not define. + + * m4/dosfile.m4: Define HAVE_DOS_FILE_CONTENTS if it appears we're + using DOS. + + * src/grep.c (undossify_input, fillbuf, dosbuf.c, prline, main): + Depend on HAVE_DOS_FILE_CONTENTS, not O_BINARY, when handling CRLF + matters. + (grepfile, main): Depend on SET_BINARY, not O_BINARY, when + handling binary files on hosts that care about text versus binary. + +2000-04-17 Paul Eggert + + * lib/getpagesize.h (getpagesize): Define to B_PAGE_SIZE if + __BEOS__ is defined. Based on a fix by Bruno Haible + . + +2000-04-17 Bruno Haible + + * src/system.h [BeOS]: Ignore O_BINARY. + * src/getpagesize.h [BeOS]: Define getpagesize() as B_PAGE_SIZE. + +2000-04-10 Paul Eggert + + * doc/grep.1, doc/grep.texi, NEWS: -C now requires an operand. + * src/grep.c (short_options, long_options, main, usage): Likewise. + (context_length_arg): Renamed from ck_atoi. Now reports an error + and exits if the number is out of range for a context length. + (get_nondigit_option): New function, which checks for overflow + correctly, and which does not parse nonadjacent strings of digits + into a single number. + (main): Use get_nondigit_option instead of doing the code inline. + With -A, -B, and -C, optarg is now guaranteed to be nonzero. + +2000-04-08 Paul Eggert + + Now that we know that the input is always terminated by a + newline before the matching algorithms see it, clean up the + matching algorithms so that they no longer need to modify the + input by inserting a sentinel newline, and no longer worry + about running off the end of the buffer due to a missing sentinel. + + * src/grep.c (nlscan, prpending, prtext, grepbuf): Do not + worry about running off the end of the input buffer, since + it's now guaranteed to end in the sentinel newline. + * src/search.c (EGexecute, Pexecute): Likewise. + + * src/dfa.c (prtok, dfasyntax, dfaparse, copy, merge, state_index, + epsclosure, dfaexec, dfacomp): + Change many instances of "T *" to "T const *", to catch + any inadvertent programming errors made during this conversion. + * src/dfa.h (dfacomp, dfaexec, dfaparse): Likewise. + * src/grep.c (struct stats.parent, long_options, grepdir, + compile, execute, fillbuf, lastnl, lastout, nlscan, prline, + prpending, prtext, grepbuf, grep, grepfile, grepdir): Likewise. + * src/grep.h (struct matcher.compile, struct matcher.execute): + Likewise. + * src/kwset.c (struct kwset.trans, kwsalloc, kwsincr, treefails, + treedelta, hasevery, treenext, bmexec, cwexec, kwsexec): Likewise. + * src/kwset.h (kwsalloc, kwsincr, kwsexec): Likewise. + * src/search.c (kwsmusts, Gcompile, Ecompile, EGexecute, Pcompile, + Pexecute): Likewise. + + * src/dfa.c (dfaexec): + Use size_t, not char *, to avoid worrisome casts to convert + char const * to char *. + * src/dfa.h (dfaexec): Likewise. + * src/grep.c (execute): Likewise. + * src/grep.h (execute): Likewise. + * src/kwset.c (bmexec, cwexec, kwsexec): Likewise. + * src/kwset.h (struct kwsmatch.offset, kwsalloc, kwsincr, + kwsexec): Likewise. + * src/search.c (EGexecute, Fexecute, Pexecute): Likewise. + + * src/dfa.h (_PTR_T): Depend on defined __STDC__, not __STDC__. + (PARAMS): Depend on PROTOTYPES, not __STDC__. + + * src/dfa.c (dfasyntax): Last arg is unsigned char, not int. + * src/dfa.h (dfasyntax): Likewise. + + * src/dfa.h (struct dfa): Remove member newlines; no longer needed. + * src/dfa.c (build_state, dfaexec, dfafree): Do not worry + about special newline state. + + * src/search.c (matchers): Move definition to end of file, so + that we don't need forward decls. + (lastexact): Remove. + (kwset_exact_matches): New var; subsumes old lastexact var. + All uses changed. + + * src/dfa.c (index): Remove macro. + (REALLOC_IF_NECESSARY): Skip unnecessary test. + (tstbit, setbit, clrbit): Declare arg to be unsigned, to help compiler. + (copyset, zeroset, equal): Use C builtin primitives, to help compiler. + (dfaexec): Do not modify input string. + Remove newline parameter; no longer needed. + (comsubs): Use strchr, not index. + + * src/grep.h (matchers): Use fixed name size, not pointer (as + there's no need for the extra flexibility). All uses changed. + + * src/kwset.h (struct kwsmatch.offset): Renamed from beg, with + change of type to size_t. All uses changed. + + * src/grep.c (reset): No longer need kludge for dfaexec. Simplify. + (reset, grepbuf): Adjust to new interface for 'execute'. + (install_matcher): List is now terminated by null compile, + not null name. + Do not invoke setrlimit if that wouldn't change the limit. + + * src/dfa.c (xcalloc, xmalloc, xrealloc, prtok, tstbit, setbit, + clrbit, copyset, zeroset, notset, equal, charclass_index, + looking_at, lex, addtok, atom, nsubtoks, copytoks, closure, + branch, regexp, copy, insert, merge, delete, state_index, + build_state, build_state_zero, icatalloc, icpyalloc, istrstr, + ifree, freelist, enlist, comsubs, addlists, inboth): + Remove forward decls; no longer needed. + * src/grep.c (ck_atoi, usage, error, setmatcher, + install_matcher, prepend_args, prepend_default_options, + page_alloc, reset, fillbuf, grepbuf, prtext, prpending, prline, + print_offset_sep, nlscan, grep, grepfile): Likewise. + * src/kwset.c (enqueue, treefails, treedelta, hasevery, + treenext, bmexec, cwexec): Likewise. + * src/search.c (Gcompile, Ecompile, EGexecute, Fcompile, Fexecute, + Pcompile, Pexecute, kwsinit): Likewise. + + * src/search.c (Pcompile): Do not assume newly allocated + storage is zeroed. + +2000-04-06 Paul Eggert + + * doc/grep.1, doc/grep.texi, NEWS: Improve the explanation of + locale-dependent behavior of range expressions. Mention + LC_COLLATE, since this affects range expressions. + +2000-03-26 Paul Eggert + + * Makefile.am (ACINCLUDE_INPUTS): Add decl.m4, inttypes_h.m4, + uintmax_t.m4, ulonglong.m4, xstrtoumax.m4. + * m4/Makefile.am (EXTRA_DIST): Likewise. + + * src/Makefile.am (base_sources): + Add xstrtol.c, xstrtol.h, xstrtoumax.c. + (EXTRA_DIST): Add strtol.c. + + * configure.in (jm_AC_TYPE_UINTMAX_T, jm_AC_PREREQ_XSTRTOUMAX, + HAVE_DECL_STRTOUL, HAVE_DECL_STRTOULL): Add. + (AC_REPLACE_FUNCS): Add strtoul. + + * src/grep.c: Include xstrtol.h. + (ck_atio): Use xstrtoumax and do proper overflow checking. + (max_count, outleft): Now off_t, not int. + (main): Likewise. Use xstrtoumax to convert max_count from string. + + * acconfig.h (HAVE_DECL_STRTOUL, HAVE_DECL_STRTOULL): New #undefs. + (HAVE_STPCPY, ENABLE_NLS, HAVE_CATGETS, HAVE_GETTEXT, + HAVE_LC_MESSAGES): Remove. + + * m4/decl.m4, m4/inttypes_h.m4, m4/uintmax_t.m4, m4/ulonglong.m4, + m4/xstrtoumax.m4, src/strtol.c, src/strtoul.c, src/strtoull.c, + src/strtoumax.c, src/xstrtol.c, src/xstrtol.h, src/xstrtoumax.c: + New files, taken unchanged from textutils, fileutils, sh-utils + and/or tar. + +2000-03-23 Paul Eggert + + * src/search.c (Pcompile): Add support for NUL bytes in + Perl regular expressions. + +2000-03-23 Paul Eggert + + * NEWS, doc/grep.1, doc/grep.texi: Change --pcre to --perl-regexp. + * src/grep.c (long_options, usage): Likewise. + + * doc/grep.1, doc/grep.texi: Remove pgrep program. + * src/Makefile.am (bin_PROGRAMS): Likewise. + (pgrep_SOURCES): Remove. + + * src/grep.c (main): Rename matcher from "pgrep" to "perl". + * src/search.c (matchers): Likewise. + + * src/search.c: Do not include stdio.h; no longer needed. + (NILP): Remove. + (sub): No longer static. + (n_pcre): Remove. + (cre): No longer an array. Present only if HAVE_LIBPCRE. + (extra): New variable. + (Pcompile): Use fatal to report errors. + This also removes a possible core dump. + Add checks (marked FIXME) for restrictions in pcre. + Use pcre_maketables for proper localized behavior. + (Pcompile, Pexecute): Use GNU coding style. + The argument is a single pattern, not a list of patterns separated + by newlines; this is for consistency with grep and egrep. + Use pcre_study for speed. + (Pexecute): Abort if we lack pcre. + Abort if pcre_exec reports an impossible error. + Use code similar to the rest of search.c + to narrow down to the line we've found. + +2000-03-21 Alain Magloire + + * configure.in: added AC_CHECK_LIB(pcre, pcre_exec) + * ChangeLog: Typos corrected. + * src/search.c: new MACRO HAVE_LIBPCRE + +2000-03-21 H.Merijn Brand + + * src/Makefile.am(bin_PROGRAMS): added pgrep and new macro + pgrep_SOURCES. + * src/search.c: new functions Pcompile() and Pexecute() + to support PCRE. Update matcher[] array for pgrep. + * src/grep.c: new short and long option --pcre and -P. + usage() updated. + +2000-03-21 Bastiaan Stougie + + Improvement of the -m or --max-count option. Now works for NUM > 1 and + prints trailing context for the last matching line. + + * src/grep.c + (after_last_match): Is a new off_t variable that replaces inputhwm + to retain the correct input offset even after a call to fillbuf. Note + that after_last_match has a different meaning than inputhwm: + it always points to the offset in the input of the first byte after + the last matching line, and is 0 if no matching line has been found + yet. + (grep): Print trailing context after the NUMth match when the -m NUM + option is used. + (grep): Added comment. Should have been commented already. + (grepbuf): Now updates outleft correctly. This fixes the bug that the + -m NUM option did not stop after NUM lines for NUM greater than 1. + (grepbuf, prtext): Now update after_last_match instead of inputhwm. + (fillbuf): No longer updates inputhwm. + (prpending): When outputting trailing context of the max_count-th + matching line, stop at the first matching line. + (grepfile): Seek to after_last_match or eof, depending on the values + of outleft and bufmapped. + (usage): added the -m or --max-count option to the help message. + * doc/grep.texi, doc/grep.1: Document the change of the -m option. + +2000-03-17 Paul Eggert + + Add new -m or --max-count option, based on a suggestion by + Bastiaan Stougie. + + * doc/grep.texi, doc/grep.1: Document it. + * src/grep.c (short_options, long_options, main): Add it. + (inputhwm): New variable. + (fillbuf, prtext, grepbuf): Set it. + (bufmapped): Now a macro (defined to zero) if HAVE_MMAP is not defined. + (max_count, outleft): New variables. + (prtext, grepbuf, grep): Don't output more than outleft lines. + (grepfile): If grepping standard input, seek to the limit of what + we've read before exiting. This fixes a bug with mmapped input, + and is needed for proper -m support. + (main): Exit immediately if -m 0 is specified. + +2000-03-08 Alain Magloire + + * configure.in: version 2.4.2 + +2000-03-07 Paul Eggert + + * Make intl subdirectory match fileutils, tar, etc.; + see intl/ChangeLog for details. + + * src/getpagesize.h: Reformat to match latest fileutils. + + * src/savedir.c (savedir): Work even if directory size is + negative; this can happen with some NFS screwups. + +2000-03-03 Jim Meyering + + * regex.m4: Make sure re_compile_pattern accepts patterns like `{1'. + +2000-03-02 Alain Magloire + + * 2.4.1 Release + +2000-02-25 Paul Eggert + + * configure.in (LIBOBJS): Work around automake 1.4 bug: + regex.c wasn't being passed through ansi2knr on pre-ANSI hosts. + (ac_use_included_regex): Fix typo in warning. + * src/Makefile.am (EXTRA_DIST): Remove regex.c, as the LIBOBJS + workaround means that automake now puts regex.c into DIST_COMMON. + +2000-02-25 Alain Magloire + + * po/*.po: update of the PO files. + +2000-02-22 Eli Zaretskii + + * doc/grep.1: Two small glitches(typos). + +2000-02-18 Eli Zaretskii + + * djgpp/config.site (prefix, INSTALL): Use /dev/env/DJDIR instead + of ${DJDIR}, so that the produced Makefile's work on any DJGPP + installation. + +2000-01-30 Alain Magloire + + * doc/grep.1: corrected typo. + Noted by Ruslan Ermilov. + +2000-01-30 Alain Magloire + + * vms/Makefile.am: added config_vms.h to EXTRA_DIST. + * vms/config_vms.h: New File, contains macros specific to VMS and + avoid namespace collision with operating system supplied C library. + * vms/make.com: Better compiler auto-detection; information for builds + on pre-OpenVMS 7.x systems; general overhaul. + * src/getpagesize.h: Reinstate support for different pagesizes on + VAX and Alpha. Work around problem with DEC C compiler. + * src/vms_fab.c: Cast to some assigments; fixed typo argcp vs. argp. + * src/vms_fab.h: Added new include files to avoid warnings about + undefined function prototypes. + Those patches were provided by Martin P.J. Zinser (zinser@decus.de). + +2000-01-30 Paul Eggert + + * src/grep.c (main): Update copyright notice. + +2000-01-28 Alain Magloire + + * src/grep.c (usage): The example "%s -i 'hello.*world' could + lead to confusion when progname is 'fgrep. + Noted by Akim Demaille. + + * configure.in: Reenable, jm_INCLUDE_REGEX() since we now + track GNU lib C. + * src/Makefile.am: EXTRA_DIST new macros with regex.c regex.h. + Requested By Ulrich Drepper. + +2000-01-25 Paul Eggert + + * src/grep.c (grep): If the final byte of an input file is not + a newline, grep now silently supplies one. + * doc/grep.texi, NEWS: Likewise. + +2000-01-25 Paul Eggert + + * NEWS, doc/grep.1, doc/grep.texi: Add -I option. + * src/grep.c (short_options, usage, main): Likewise. + + * doc/grep.texi: Fix some incorrect references to ASCII. + +2000-01-25 Paul Eggert + + * doc/grep.1: Simplify synopsis; sort options; mention + environment variables; clean up some minor gaffes. + +2000-01-25 Paul Eggert + + * doc/grep.texi: + Fix some errors in description of [:print:] and the like. + +2000-01-23 Paul Eggert + + * src/dfa.c (FETCH, lex): Put brackets around if-body to avoid + GCC warning about ambiguous if-then-else. + +2000-01-23 Paul Eggert + + * src/regex.c (GET_UNSIGNED_NUMBER): Allow only ASCII digits. + * src/dfa.c (ISASCIIDIGIT): New macro. + (lex): Use it instead of ISDIGIT. + +2000-01-23 Paul Eggert + + The bug is that regular expression ranges like [a-z] compare raw + byte codes to the range boundaries, whereas POSIX says that they + should use the current collating sequence instead. For example, + in Solaris 7 with LC_ALL=en_US, the command + echo x | grep '[ -~]' + outputs 'x', but it shouldn't output anything since ' ' and '~' + sort before all letters in that locale. + + * src/regex.c (compile_range): When matching a character + range, use the current collating sequence, as POSIX requires. + * src/dfa.c (lex): Likewise. + +2000-01-20 Alain Magloire + + * tests/Makefile.am (dist-hook): Added new rule to make sure + that the shell scripts have the right permissions. + * src/posix/Makefile.am (EXTRA_DIST): added regex.h in the + distribution. + * THANKS: updated. + +2000-01-18 Alain Magloire + + * Rectification the initial patch to add --binary-file option + was done by Ruslan Ermilov. + +2000-01-17 Paul Eggert + + Sync with sources of fileutils 4.0n, tar 1.13.17, glibc 2.1.3a1. + Convert to ANSI C prototypes (using ansi2knr for backwards + compatibility), as this makes it easier to sync. + + * configure.in (AC_OBJEXT): Spell in a funny way, to work around + a bug in automake 1.4 with ansi2knr. + (LIBOBJS): Add assignment so that .o files in LIBOBJS are also built + via the ANSI2KNR-filtering rules. + (AC_OUTPUT): Add src/posix/Makefile. + * src/Makefile.am (AUTOMAKE_OPTIONS): Add ansi2knr. + (SUBDIRS): New macro. + * src/ansi2knr.1, src/ansi2knr.c, src/posix/Makefile.am: New files. + * src/dfa.c, src/dosbuf.c, src/grep.c, src/kwset.c, src/search.c, + src/vms_fab.c: + Use prototypes for function definitions. + * src/grep.c (main): Use int counter for default context, + fixing an ANSI portability bug uncovered by the above changes. + + * config.guess, config.sub, install-sh, missing, src/alloca.c, + src/getpagesize.h, src/memchr.c, src/savedir.c, src/savedir.h, + src/stpcpy.c: + Upgrade to latest version from fileutils 4.0n. + + * src/getopt.c, src/getopt.h, src/getopt1.c: Upgrade to latest + version from tar 1.13.17. + + * src/obstack.c, src/obstack.h, src/regex.c, src/regex.h: + Upgrade to glibc 2.1.3 alpha 1, with K&R C portability fix. + * src/posix/regex.h: New file, from glibc 2.1.3 alpha 1. + +2000-01-04 Paul Eggert + + Initial patch by Ruslan Ermilov. + + Add --binary-files option. + * NEWS, doc/grep.1, doc/grep.texi: Document it. + * src/grep.c (BINARY_FILES_OPTION): New constant. + (long_options, grep, usage, main): New --binary-files option. + (binary_files): New var. + * src/system.h (TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM, CHAR_MAX): + New macros. + (INT_MAX, UCHAR_MAX): Define in terms of TYPE_MAXIMUM. + +2000-01-04 Paul Eggert + + * savedir.c (savedir): Don't store past the end of an array if + name_size is zero and the directory is empty. + Reported by Dima Barsky . + +1999-12-03 Alain Magloire + + * 2.4 Release. + +1999-11-18 Paul Eggert + + * m4/largefile.m4 (AC_SYS_LARGEFILE_FLAGS): Work around a + problem with the QNX 4.25 shell, which doesn't propagate exit + status of failed commands inside shell assignments. + +1999-11-13 Eli Zaretskii + + * doc/grep.texi: Minor markup and spelling corrections. Use + @noindent where appropriate. + + * PATCHES-{AM,AC}: rename to PATCHES.{AM,AC} + +1999-11-12 Eli Zaretskii + + doc/grep.texi: Minor fixes and typos corrected. + djgpp/README: Updated version. + +1999-11-07 Paul Eggert + + * src/grep.c (usage): Fix misspelling. + +1999-11-07 Paul Eggert + + Don't assume that the C library has re_set_syntax and friends. + * src/Makefile.am (base_sources): Add regex.c, regex.h. + (EXTRA_DIST): Remove regex.c, regex.h. + + * src/grep.c (prtext): Use out_quiet, not not_text, to decide + whether to set pending to zero at the end. + (not_text): Remove static variable, undoing latest change. + (grep): Likewise. + + * doc/grep.texi: Tighten up the text, and fix some minor + spelling and usage errors. Use @enumerate rather than @table + @samp, since it's better for Q&A format. Add cross + references. + +1999-11-01 Alain Magloire + + * src/search.c: Use the more portable [[:alnum:]] + to define a word instead of Ascii dependent [0-9A-Za-z] + * src/grep.c: make not_text global to not display text when + the context switches -A/-B/-C are use on binary files. + * make grep-2.3g available for testing. + * configure.in: drop support for --without-included-regex. + This was generating bogus bug reports, since many GNU/Linux + users have different version of glibc. And glibc maintainers + decided to drop k&r support. + +1999-11-01 Arnold D. Robbins + + * regex.c (init_syntax_once): move below definition of + ISALNUM etc., then use ISALNUM to init the table, so that + the word ops will work if i18n'ed. + (SYNTAX): And subscript with 0xFF for Latin-1 characters. + +1999-10-26 Alain Magloire + + * src/regex.c: Merge changes from GNU lib C. + * Updated the *.po files + +1999-10-26 Paul Eggert + + * src/grep.c (fillbuf): Don't report buffer size overflow if + newalloc == save and maxalloc == save. This can happen + e.g. when reading a large page-aligned file that contains + no newlines. + +1999-10-21 Paul Eggert + + * src/grep.c (usage): Give example. Clarify -F. + Explain exit status more clearly. + +1999-10-12 Paul Eggert + + * doc/grep.texi: Shorten the commentary about egrep and {. + "BSD grep" -> "traditional grep". + * doc/grep.1: Match recent changes to grep.texi. + +1999-10-11 Paul Eggert + + * NEWS, doc/grep.1, doc/grep.texi: New option --mmap. + * src/grep.c (mmap_option): New variable. + (long_options, reset, usage): Add --mmap. + Default is now read, not mmap. + + * doc/grep.1: Document -Z or --null. + +1999-10-11 Paul Eggert + + * doc/grep.texi: Fix texinfo glitches. POSIX -> POSIX.2 where + appropriate. + +1999-10-11 Paul Eggert + + * acconfig.h (ssize_t): New #undef. + + * configure.in (AC_CHECK_TYPE): Add ssize_t. + + * src/grep.c (PREFERRED_SAVE_FACTOR): New macro. + (reset): If the buffer has already been allocated, set bufsalloc to + be bufalloc / PREFERRED_SAVE_FACTOR. This avoids problems when + bufsalloc == bufalloc (possible after reading a large binary file). + (reset): Use PREFERRED_SAVE_FACTOR instead of magic constant. + Do not set bufbeg; nobody uses it. + Always set buflim. + Check for lseek error. + Use SEEK_CUR, not a magic constant. + (fillbuf): Return an error indication, not a count. + All callers changed. + Do not assume ssize_t fits in int. + Use PREFERRED_SAVE_FACTOR instead of magic constant. + Clean up mmap code. + Do not attempt to mmap zero bytes. + Check for lseek error. + Use SEEK_SET, not a magic constant. + Work correctly if read is interrupted. + (grepfile): Work correctly if open or close is interrupted. + + * src/system.h (SEEK_SET, SEEK_CUR): New macros. + +1999-10-02 Alain Magloire + + * src/regex.[ch]: upgrade from GNU lib C source tree. + + * make beta 2.3f available. + +1999-10-02 Paul Eggert + + * NEWS: egrep is now equivalent to `grep -E'. + The lower bound of an interval is not optional. + You can specify a matcher multiple types without error. + -u and -U are now allowed on non-DOS hosts, and have no effect. + * doc/grep.texi: Likewise. + * doc/grep.1: Likewise. + Fix some troff bugs that prevented `groff' from rendering the page. + + * src/egrepmat.c, src/fgrepmat.c, src/grepmat.c (default_matcher): + Remove. + (matcher): Add. + * src/grep.h (default_matcher): Remove. + (matcher): Now exported from ?grepmat.c, not grep.c. + + * src/dfa.c (lex): If { would start an invalid interval specification, + treat it as a normal character. + Remove (broken) support for {,M} meaning {0,M}. + Diagnose bogus intervals like {1,0}. + (closure): maxrep is now -1 to indicate no limit, not zero; + zero is a valid value for maxrep, meaning an upper bound of zero. + + * src/grep.c (short_options): New constant. + (long_options, main): -u and -U are now supported on Unix, + with no effect. + (matcher): Removed; now defined by ?grepmat.c. + (install_matcher): Renamed from setmatcher. + (setmatcher): New function. + (usage): Report new, more uniform option scheme. + (main): Do not initialize matcher; ?grepmat.c now does this. + Rely on setmatcher to catch matcher conflicts. + Default matcher is "grep". + + * src/search.c (matchers): + Remove "posix-egrep" matcher; no longer needed. + (Ecompile): Likewise. + The egrep matcher now has POSIX behavior. + + * tests/bre.tests: grep '\{' is no longer an error. + Fix test for interval too large, and enable it. + * tests/ere.tests: grep -E {1 is no longer an error + Likewise for a{1, a{1a, a{1a}, a{1,x}. + +1999-09-22 Paul Eggert + + * largefile.m4 (AC_SYS_LARGEFILE_FLAGS): Work around GCC + 2.95.1 bug with HP-UX 10.20. + +1999-09-12 Paul Eggert + + * src/grep.c (fillbuf): Fix typo: we sometimes reported + arithmetic overflow even when there wasn't any. + +1999-09-12 Paul Eggert + + * configure.in (AC_CHECK_FUNCS): Add memmove. + + * src/system.h (S_ISREG): New macro. + (memmove): Define if ! defined HAVE_MEMMOVE && ! defined memmove, + not if !defined STDC_HEADERS. This is needed for SunOS 4.1.4, + which defines STDC_HEADERS but lacks memmove. + + * src/grep.c (bufoffset): Needed even if !defined HAVE_MMAP. + (reset): Always fstat the file, since we always need its size if it is + regular. + Similarly, get the buffer offset of every regular file. + Set bufmapped to 0 if the file's initial offset is not a multiple + of the page size. + (fillbuf): Calculate an upper bound on how much memory we should + allocate only for regular files, since we don't know the sizes of + other files. + Don't bother to check whether the file offset is a multiple of the page + size, since we now do that just once in `reset'. + When an mmapped area would fall past the end of the file, trim it to + just before instead of giving up immediately and doing a `read'; + that avoids a worst-case behavior that could read half an mmapped file. + Fix bug when computing offsets on hosts that don't have mmap. + +1999-08-27 Paul Eggert + + * src/system.h (memmove): New macro. + + * src/grep.c (page_alloc): Reallocate the old buffer instead + of having both old and new buffers active simultaneously. + Remove valloc debugging variant, which no longer applies. + + (fillbuf): Rejigger the buffer allocation mechanism. The old + mechanism could allocate more than 10*N bytes for an N-byte + file, which was excessive. Check for arithmetic overflow a + bit more carefully. + +1999-08-25 Paul Eggert + + * src/grep.c (grepdir): + Don't assume that st_ino and st_dev must be integers; + POSIX.1 allows them to be floating-point (!). + + * src/vms_fab.h (arr_ptr): `:' -> `;' to fix typo. + +1999-08-18 Alain Magloire + + * 2.3e snapshot. + +1999-08-18 Alain Magloire + + * src/search.c: On a CRAY J90 system running UNICOS 8.0. + Compilation of ./src/search.c failed because the declaration of + the variable "regex": + static struct re_pattern_buffer regex; + conflicted with a previous declaration search.c #includes "system.h", + which #includes , which declares : + extern char *regex __((char *_Re, char *_Subject, ...)); + The declaration in search.c is local to that one source file. + I just changed its name to something less likely to conflict. + (I called it "regexbuf", but you could pick any name you want.) + Excerpt email from Dean Kopesky. + +1999-08-16 Paul Eggert + + Upgrade large-file support to the version used in tar and + textutils. + + * Makefile.am (ACLOCAL_AMFLAGS): Define to be empty. + (M4DIR, ACINCLUDE_INPUTS): New macros. + ($(srcdir)/acinclude.m4): New rule. + + * configure.in (AC_CANONICAL_HOST, AM_C_PROTOTYPES): Add. + (AC_SYS_LARGEFILE): Renamed from AC_LFS, for compatibility + with what should appear in the next autoconf release. + + * m4/largefile.m4: Renamed from m4/lfs.m4. + + * src/ansi2knr.1, src/ansi2knr.c, config.guess, config.sub: + New files. config.guess and config.sub ar needed by the new + AC_SYS_LARGEFILE. ansi2knr is needed by AM_C_PROTOTYPES, + which in turn is needed by the new AC_SYS_LARGEFILE. + +1999-08-16 Alain Magloire + + * 2.3d snapshot on ftp server. + +1999-07-26 Paul Eggert + +Several GNU tools have options to process arbitrary file names, even +file names that contain newline characters. These include `find +-print0', `perl -0', `sort -z', and `xargs -0'. It'd be handy if GNU +grep also processed such file names. Here's a proposed patch to do +this, relative to grep 2.3c. This patch introduces two options, one +for the data, and one for the file names. (Sometimes one wants +null-terminated file names in the output, and sometimes one wants to +process lists of null-terminated strings, and these are orthogonal +axes.) + + * NEWS, doc/grep.texi: New -z or --null-data and -Z or --null options. + * src/grep.c (long_options, usage, main): Likewise. + + * src/dfa.h (dfasyntax): New eol parameter. + * src/dfa.c (eolbyte): New var. + (dfasyntax): Set it from new parameter. + (lex, dfastat, build_state, dfaexec): Use it instead of '\n'. + + * src/grep.h (eolbyte): New decl. + * src/grep.c (eolbyte): New var. + (nlscan, prpending, prtext, grepbuf, grep): Use it instead of '\n'. + (filename_mask): New var. + (prline, grepfile): Output NUL separator if filename_mask is zero. + (grep): Look for '\200' as the hallmark of a binary file, not '\0', + if -z or --null-data is specified, since it implies that '\0' is + expected as text. + + * src/search.c (Gcompile, Ecompile): Pass eolbyte to dfasyntax. + (EGexecute, Fexecute): Use eolbyte instead of '\n'. + +1999-06-15 Alain Magloire + + * src/grep.c, doc/grep{1,texi} : + --revert-match should be --invert-match. + Correction proposed by Karl Berry. + +1999-06-12 Alain Magloire + + * doc/grep.{1,texi}: add description for --with-filename. + Noted missing by UEBAYASHI Masao. + +1999-03-17 Paul Eggert + + * NEWS: Add GREP_OPTIONS. + + * doc/grep.texi: Document GREP_OPTIONS, and the other + environment variables. Fix doc for [:blank:], [:cntrl:], [:punct:]. + + * src/grep.c (prepend_args, prepend_default_options): New functions. + (main): Use them to implement GREP_OPTIONS. + * src/system.h (getenv): New decl. + +1999-03-16 Volker Borchert + + * configure.in: Use case case ... esac for checking Visual C++. + When ${CC} contains options it was not recognize. + +1999-03-07 Paul Eggert + + * src/grep.c (usage): Don't report -E, -F, and -G unless we're grep. + (main): Don't match options -E, -F, and -G unless we're grep. + Remove after-the-fact check for options -E, -F, and -G, since + they're no longer needed. + +1999-03-05 Eli Zaretskii + + * src/grep.c (main): Print the name of the default matcher instead + of just "grep". + +1999-02-06 Alain Magloire + + * tests/*.awk : Linux users are seeing "Broken Pipe" on make check. + The problem is that grep does not drain its stdin, thus the previous + process in the pipeline receives a SIGPIPE. Other shells are silent + about this. There is actually no failure, since the broken pipe is + expected. You can work around it by changing the pipeline, so that + the input is drained, like this: + status=`echo 'check' | { ${GREP} -E -e pattern >/dev/null 2>&1; + echo $?; cat >/dev/null; }`; if test $status -ne $errnu then ... fi + Excerpt email from Andreas Schwab. + +1999-02-23 Alain Magloire + + * src/grep.c : Restrict the use of -E, -F, -G + to only grep driver, Posix behaviour. {f,e}grep + the matcher is already set. This change may brake + scripts, warn in NEWS. + + * doc/grep.{1,texi} : -C takes arguments, upgrade manual. + + * beta 2.3a + +1999-02-23 Alain Magloire + + * configure.in : Change the configure VC test from + 'test x$ac_cv_prog_CC = xcl;' to 'test x"$ac_cv_prog_CC" = xcl;' + Email from Joshua R. Poulson. + +1999-02-23 Paul Eggert + + Fix porting bug reported by Amakawa Shuhei for SunOS 4.1.4-JL. + The btowc.c shipped with grep 2.3 is incorrect for Solaris + 2.5.1 and earlier, as it assumes UTF8, which these OSes do not + support. Solaris 7 supports btowc, so there's no need to ship + a substitute for it. The only questionable case is Solaris + 2.6, which lacks btowc but does support UTF8. However, 2.6 + supports UTF8 but only as a demonstration (for an English + locale!); Japanese Solaris 2.6 users typically use EUC, or + sometimes shift-JIS, but they cannot use UTF8 since Japanese + UTF8 is not supported. Hence there's no point to having grep + substitute a btowc that uses UTF8, as it is either redundant, + or it will almost invariably have incorrect behavior. + + * configure.in (AC_CHECK_HEADERS): Don't set USE_WCHAR. + (AC_CHECK_FUNCS): Add btowc, wctype. + (AC_REPLACE_FUNCS): Don't replace btowc; our replacement is + invariably doing the wrong thing anyway, at least on SunOS/Solaris. + Don't bother to check for wctype in -lw, as we don't support + wide characters on Solaris 2.5.1 or earlier anyway. + + * bootstrap/Makefile.try (OBJS): Remove btowc.$(OBJEXT). + + * src/btowc.c: Removed; no longer needed. + +1999-02-19 Paul Eggert + + * NEWS: Fix typo when talking about the old behavior of + silently skipping directories; it was grep 2.1, not grep 2.2. + +1999-02-15 Alain Magloire + + * bootstrap/Makefile.try : add DJGPP DEFS. + Done by Elie Zaretsckii. + +1999-02-14 Alain Magloire + + * m4/gettext.m4 : Guard [] with changequote. + From Elie Zaretskii. + + * djgpp/config.bat : Makefile.in.in --> Makefile.in-in + From Elie Zaretskii. + + * src/dosbuf: k&r function parameter. + + * release of 2.3. + +1999-02-10 Alain Magloire + + * bootstrap/{Makefile{try,am},REAMDE} : skeleton + provided for system lacking the tools to autoconfigure. + + * src/{e,f,}grepmat.c: added guard [HAVE_CONFIG_H] + +1999-02-10 Alain Magloire + + * PATCHES-AC, PATCHES-AM: updated. + + * m4/regex.m4 : updated. + +1999-02-05 Eli Zaretskii + + * m4/gettext.m4 : Support DOS-style D:/foo/bar absolute file + names. + + * aclocal.m4 (DJGPP) : Use $DJ_GPP instead, since changing the + latter prevents GCC from finding headers and libraries. + + * djgpp/config.bat: Make building from another directory work + + * djgpp/config.sed: Remove redundant command wich edited path + separator: now done by configure. + + * src/grep.c [O_BINARY]: Add prototype for undossify_input. + + * doc/grep.texi (Introduction): Typo fixed. + +1999-02-03 Alain Magloire + + * grep-2.2f beta release. + +1999-02-02 Alain Magloire + + * m4/{djgpp,envsep,glibc,regex,dosfile,isc-posix}.m4 : + New files to aid configuration and unload configure.in. + * m4/Makefile.am : updated. + * src/btowc.c : protect for wchar.h + +1999-01-28 Alain Magloire + + * intl/Makefile.in: Replace .o with .${ac_objext} where necessary. + Work around a limitation of Visual C++ on Cygwin32. + * acconfig.h configure.in: Define `alloca' as `_alloca' when CC=cl. + This little hack was suggested by Ian Roxborough . + Patch forwarded by Ben Elliston. + +1999-01-28 Alain Magloire + + * PATCHES-AM: New file. A small patch for automake-1.4, use $(sep) + as the path separator base on @SEP@. + * PATCHES-AC configure.in : updated for autoconf-13. + +1999-01-27 Volker Borchert + + * grep.c: fgrep -NUM not working correctly. + add the argument number to digit_args_val. + +1999-01-22 Paul Eggert + + Prevent grep -r from recursing infinitely through directory loops via + symbolic links. + + * grep.c (struct stats): New type. + (stats_base): New var. + (bufstat): Remove; subsumed by stats->stat. + (reset, fillbuf, grep, grepdir, grepfile): Pass struct stats * arg, + for directory loop checking; use this instead of the bufstat global. + All callers changed. + (grepfile): Stat the file before invoking grepdir. + (grepdir): Assume that the argument has already been statted. + No longer a need for a directory size argument, since it + can be gotten from the struct stats * argument. + Check for directory loops. + Create linked list of directories currently being visited, + to detect loops. + +1998-12-29 Kaveh R. Ghazi + + intl/localealias.c: When building grep-2.2e using cc on Irix4, + I needed the following patch to intl/localealias.c. + (Its the same patch used by fileutils-4.0.) The patch resolves + conflicts between char* and unsigned char* in the i18n code. + +1998-12-10 Alain Magloire + + * src/grep.c : Typo in contex -->context + Noted by Vladimir Michl. + +1998-12-01 Alain Magloire + + * doc/Makefile.am djgpp/Makefile.am m4/Makefile.am vms/Makefile.am: + New files. + + * m4/progtest.m4: proctect '[]' from m4. + Noted by Eli Z. + + * PATCHES-AC: New file, add the patch for autoconf in the dist. + + * acconfig.h: (HAVE_DOS_FILENAME) + + * TODO: updated. + + * src/search.c: remove obsolete 'gegrep,ggrep,gnugrep' + matchers. grep no longer depend on argv[0]. + + * grep-2.2e beta to test DJGPP port. + +1998-11-28 Paul Eggert + + Various portability enhancements: + - Don't assume that O_BINARY implies DOS. Use separate + macros D_OK (for DOS-like directory access) and + HAVE_DOS_FILE_NAMES (for DOS-like file names). + - Don't assume that off_t fits into long; it doesn't on Solaris 2.6. + - Have is_EISDIR set errno properly on hosts with screwed-up EISDIR. + - Treat ':' specially in DOS file names only if it's the end of a + drive specifier. + - Protect against errno < 0. + + * src/grep.c (is_EISDIR): Move defn to system.h. + (print_offset_sep): New function. + (fillbuf): Remove redundant test of O_BINARY. + (totalcc, totalnl): Now of type off_t. + (prline): Use print_offset_sep to print file offsets. + (grepfile): Don't set e to EISDIR; that's is_EISDIR's responsibility + on machines that don't work properly with EISDIR. + (grepdir): Don't assume ':' means slash on all DOS filenames; + it means it only in the file prefix. + + * src/system.h (strerror): Check for negative error numbers. + (is_EISDIR): Depend on D_OK, not O_BINARY. + (SET_BINARY): Depend on HAVE_SETMODE, not __DJGPP__. + (IS_SLASH, FILESYSTEM_PREFIX_LEN): Depend on HAVE_DOS_FILE_NAMES, + not O_BINARY. + (CHAR_BIT): New macro. + + * src/dosbuf.c (struct dos_map): + pos and add members are now of type off_t. + (dos_stripped_crs): Now of type off_t. + (dossified_pos): Now accepts arg and returns value of type off_t. + + * configure.in (AC_CHECK_FUNCS): Add setmode. + (HAVE_DOS_FILENAMES): New macro + +1998-11-27 Eli Zaretskii + + * djgpp/config.sed: New file, a Sed script to edit configure + script before running it on DOS/Windows. + * djgpp/config.bat: Updated to handle po2tbl.sed.in and + po/Makefile.in.in on DOS filesystems, and to run config.sed. + +1998-11-24 Jim Meyering + + * src/grep.c : Typo s/infalid/invalid/ + Also noted by Stanislav Brabec. + +1998-11-24 Eli Zaretskii + + * doc/grep.texi: I found and corrected several typos. + I believe the GNU standards require the section that describes the + options to the programs to be called ``Invoking'' or ``Invoking + ''. This is so users and programs can easily find + that node in any Info file. So I changed the name of the + `Options' chapter to `Invoking', and corrected the + cross-references accordingly. + I added some markup to things like file names and options. + I added some additional index entries where that seemed useful. + I also corrected some index entries, such as "@cindex [:alnum:]", + which used a colon in them (the colons confuse Info readers). + +1998-11-24 Alain Magloire + + * grep/doc/grep.texi : -h is not use for help. + Nit spotted by Jim Meyering. + +1998-11-23 Alain Magloire + + * doc: New directory, grep.1, {e,f}grep.man move here + * doc/grep.texi: New info manual + * doc/version.texi: New + * doc/Makefile.am: New + * tests/{ere,bre}.*: New files. The spencer2 test is split + in two ere/bre. + * config.hin: New, config.h.in rename to config.hin for OS + with limited file system aka DOS. + + * grep-2.2d release for beta. + +1998-11-18 Alain Magloire + + * src/regex.[ch] : Updated from GLibc, previous patches were + integrate by Ulrich Drepper and some added ones. + +1998-11-16 Paul Eggert + + * grep.h (__attribute__): New macro, if not GCC. + (fatal): Add __attribute__((noreturn)). + * grep.c (usage): Add __attribute__((noreturn)). + +1998-11-16 Paul Eggert + + Remove memory leak with valloced buffers, by invoking malloc instead. + + * configure.in (AC_CHECK_FUNCS), src/system.h (valloc): Remove. + * src/grep.c (page_alloc): New function. + (ubuffer, pagesize): New vars. + (ALIGN_TO): New macro. + (reset): Initialize new vars. Check for overflow in buffer size calc. + Use page_alloc instead of valloc. + (fillbuf): Likewise. Use memcpy to copy saved area. + +1998-11-15 Paul Eggert + + * dfa.c (dfacomp), search.c (EGexecute): Don't assume char is unsigned. + +1998-11-14 Paul Eggert + + * src/grep.c (grepdir): Fix bug: memory freed twice. + + * src/search.c (Gcompile, Ecompile): Don't invoke dfainit, + since dfacomp does it for us, and if we also do it then we + leak memory. + +1998-11-13 Eli Zaretskii + + * djgpp/config.bat: Rewrite to run the configure script via Bash. + * djgpp/config.site, djgpp/getconf: New files. + * djgpp/config.h, djgpp/*.mak, djgpp/po2tbl.sed: Remove. + * djgpp/README: Update instructions. + + * Makefile.am (EXTRA_DIST): Update the list of DJGPP files. + + * src/system.h (IS_SLASH): New macro. + (is_EISDIR): Define it here for DOS and Windows. + + * src/grep.c (main) [O_BINARY]: Set stdout to binary mode, so the + EOL formats of the input and output files match, unless stdout is + the console device. + (is_EISDIR): Don't define if already defined. Accept a second + argument, the file name; all callers changed. + (grepdir): Don't free `file', inside the loop. Use IS_SLASH to + check whether `dir' needs a slash. + (grepfile): If file is a directory, set e to EISDIR. + +1998-11-10 Alain Magloire + + * src/vms_fab.{c,h}: New file for VMS wildcard expansion + Written by Phillip C. Brisco. + + * vms/make.com : add line to compile vms_fab.c and + {e,f,}grepmat.c with link for each grep/fgrep/egrep. + Base on patch send by Phillib C. Brisco. + +1998-11-09 Alain Magloire + + * grep-2.2c on alpha for testing. + +1998-11-09 Paul Eggert + + * src/grep.1: Fix `Last Change' of output by generating the date + from the RCS Id. + + * src/grep.c (is_EISDIR): New macro. + (grep): If -s, suppress errors from trying to read directories. + (grepfile): Use is_EISDIR to simplify code. + (grepdir): If -s, suppress errors from trying to read directories. + + * src/grep.1: Fix -q -r -s problems; describe BSD grep better. + + * src/grep.c (main): Update copyright. + + Specify default matcher with default_matcher extern var, not + DEFAULT_MATCHER macro. This is more straightforward and means + we need to compile grep.c just once. + + * src/egrepmat.c, src/fgrepmat.c, src/grepmat.c: New files. + + * src/Makefile.am (base_sources): New macro. + (egrep_SOURCES, fgrep_SOURCES, grep_SOURCES): Now consist of + $(base_sources) plus the single tailoring file. + (grep_LDADD, egrep_LDADD, fgrep_LDADD): Remove. + (EXTRA_DIST): Remove grep.c, regex.c. + (fgrep.o, egrep.o): Remove. + + * src/grep.h (matcher): Now char const *. + (default_matcher): New decl. + + * src/grep.c (matcher): Now char const *. + (setmatcher): Now accepts char const *. + (main): Default the matcher from default_matcher (linked externally) + rather than DEFAULT_MATCHER (a macro). + +1998-11-08 Alain Magloire + + * src/grep.1: `prep.ai.mit.edu' should be replaced with `gnu.org'. + Nit from Paul Eggert. + +1998-11-06 Alain Magloire + + * src/grep.c: The Matcher is not set to argv[0] but + explicitly by a #define MATCHER at compile time default is "grep". + + * aclocal/: NEW dir. provides our own *.m4 + + * configure.in: Move Paul's Large Files to AC_LFS.(aclocal/lfs.m4) + Taken from Jim Meyering fileutils. + +1998-11-05 Alain Magloire + + * src/grep.1: update the man pages according to the + changes make by Miles. + + * po/*.po: updated. + + * first beta release for 2.3 (2.2a). + +1998-11-04 Miles Bader + + * src/grep.c (main): Rationalize interaction of -C/-NUM/-A/-B + options, and allow -C to have an optional argument. -NUM can + now be mixed with -C, and -A, -B always take precedence over + -C/-NUM, regardless of order. + (long_options): Let -C/--context take an optional argument. + +1998-11-03 Alain Magloire + + * src/dfa.c: HP-UX define clrbit/setbit as macros in + #undef if defined. + Fixed by Andreas Ley and Philippe Defert. + + * src/grep.1 : mention that -s follows POSIX.2 behavior. + Noted by Paul Eggert and others. + + * tests/khadafy.sh: a typo in failure(s). + Spotted By Sotiris Vassilopoulos. + +1998-11-01 Paul Eggert + + * src/system.h (IN_CTYPE_DOMAIN): New macro. + (ISALPHA, ISUPPER, ISLOWER, ISDIGIT, ISXDIGIT, ISSPACE, + ISPUNCT, ISALNUM, ISPRINT, ISGRAPH, ISCNTRL): Use + IN_CTYPE_DOMAIN instead of isascii. + +1998-08-18 Paul Eggert + + Add support for new -r or --recursive (or -d recurse or + --directories=recurse) option. + + * src/Makefile.am (grep_SOURCES): Add savedir.c, savedir.h, stpcpy.c. + + * src/grep.1: Describe new options. + + * src/grep.c: Include "savedir.h". + (long_options): Add -r or --recursive. + (RECURSE_DIRECTORIES): New enum value. + (IS_DIRECTORY_ERRNO): Remove. + (reset, grep): Add file name arg. + (grepdir, grepfile): New functions. + (initial_bufoffset): New var. + (reset): Initialize it. + (fillbuf): Use it. + (count_matches, list_files, no_filenames, suppress_errors): New static + vars; formerly were local to `main'. + (grep): Recurse through directories if the user asks for this. + (usage, main): Add new options. + (main): Change some local vars to be static, as described above. + Move most of the guts into grepfile function. + so that it can be recursed through. + + * configure.in (AC_HEADER_DIRENT, AC_FUNC_CLOSEDIR_VOID): Add. + (AC_REPLACE_FUNCS): Add stpcpy. + + * src/savedir.c, src/savedir.h, src/stpcpy.c: New files; + taken from fileutils 3.16u. + +1998-08-11 Paul Eggert + + * src/system.h (initialize_main): New macro. + * src/grep.c (main): Invoke initialize_main first thing. + +1998-04-29 Paul Eggert + + * NEWS, src/grep.1: Describe new -a and -d options. + + * src/grep.c (long_options, usage, main): + New options -d or --directories and -a or --text. + (directories, always_text): New variables. + (IS_DIRECTORY_ERRNO): New macro. + (reset): Now returns value specifying whether to skip this file. + Stat the file if either mmap or directory-skipping is possible. + Skip the file if it's a directory and we're skipping directories. + (grep): Skip the file if `reset' tells us to. + (main): If open fails because the file is a directory, and if we're + skipping directories, don't report an error. + Remove special case for DOS and Windows. + + * src/dosbuf.c (guess_type): Use the same method for guessing whether a + file is binary as grep.c's grep does. + There's no longer any need to declare `bp' to be unsigned. + +1998-04-26 Alain Magloire + + * grep-2.2 release. + + * src/dfa.c: Wrong revision was pulled out + for beta 2.1.1d. + * src/search.c: Wrong revision was pulled out + for beta 2.1.1d. + + * src/grep.c: ck_atoi () added instead of atoi (). + Suggestion from Jim Meyering. + ck_atoi () pulled from diffutils-2.7, maintained by Paul Eggert. + + * AUTHORS: Rephrase of some sentences. + * README: Rewording. + Noted and patched by Joel N. Weber II. + +1998-04-17 Kaveh R. Ghazi + + * src/dfa.h: Don't define `const', trust autoconf to handle it. + +1998-04-16 Alain Magloire + + * tests/{status,empty}.sh: wrong return status. + + * src/grep.c: Remove the REGEX part in usage (), it was + consider overkill by most. + +1998-04-14 Eli Zaretskii + + * djgpp/config.bat: Support file names with multiple dots on all + platforms. + + * djgpp/README: Add instructions about file names illegal on + MS-DOS. + +1998-04-13 Alain Magloire + + * src/dfa.c: by "popular" demand reverse + back to '_' not word-constituent. + + * grep-2.1.1c available for testing. + +1998-04-13 Karl Heuer + + * src/grep.c: (a) The directory check is done too early: + logically, if the argument is "-", then it refers to standard + input, regardless of whether there's something in the file + system answering to "-". + (b) The sh command "grep -l root /etc/passwd /etc/group 0<&-" + prints "(standard input)" instead of "/etc/passwd", because it + mistakenly believes that a named file will never be opened on fd + 0. The string "(standard input)" should be based on the file + having been originally specified as "-", rather than making + assumptions about the fd. + (c) the code that calls close(fd) is being done outside of the + test for a bad fd. Thus, if the open failed, this code will + attempt to close(-1). It should be done inside the "fd != -1" + branch. + This patch addresses all three of these problems. + +1998-04-13 Alain Magloire + + * configure.in: remove the deprecated AC_ISC_POSIX macro. + Spotted by Karl Heuer. + +1998-04-03 Eli Zaretskii + + * djgpp/main.mak, djgpp/src.mak, djgpp/tests.mak: Updated from the + relevant Makefile.in files. + + * djgpp/config.bat: Create files in intl directory like the + configure script does. + +1998-03-28 Eli Zaretskii + + * djgpp/main.mak, djgpp/src.mak, djgpp/tests.mak: Updated to track + changes in respective Makefile.in files. + + * src/dosbuf.c (guess_type): Avoid running off the end of the + buffer. Spotted by Paul Eggert. + +1998-03-27 Alain Magloire + + * grep-2.1.1b.tar.gz available. + + * src/regex.c: CLASS_CHAR_MAX set to 256 instead of 6 + when WCTYPE and WCHAR are not defined. When class names + where bigger then 6, it will not detect an error. + example '[[:alphabet:]]'. + + * Updated the copyright of the files with emacs. + With emacs Jim :). + +1998-03-26 Jim Meyering + + * src/dfa.c (IS_WORD_CONSTITUENT): Define. + (lex): Use IS_WORD_CONSTITUENT, not ISALNUM. + Don't special-case '_'. + (dfastate): Use IS_WORD_CONSTITUENT, not ISALNUM. + (dfaexec): Likewise. + +1998-03-25 Alain Magloire + + * tests/warning.sh: typos and replace the echos with + a simple cat. + Noted By Jim Meyering. + + * src/regex.c: #undef ISASCII and ISPRINT before defining + them(On Solaris it was define). + Pattern 'a[[:]:]]b' is an invalid char class and the error + from regex was 1(REG_NOMATCH) instead of 2 (REG_ECTYPE). + Fix with help from Ulrich Drepper. + + * src/grep.c (usage): Ulrich wrote: "A single printf should + not have more than 900 bytes. For translation reasons the + text shouldn't be split in too many pieces since this is + tiresome and also does not help to generate a consistent picture." + Noted by Ulrich Drepper. + * src/grep.c (usage): Dig out and old patch from + Franc,ois to explain the regex in usage(). + Ideas from Franc,ois Pinard. + +1998-03-23 Alain Magloire + + * testing: grep-2.1.1a for testing. + + * configure.in: Solaris needs '-lw' if we use wchar/wctype + functions. + * src/btowc.c: New file from GNU libc. Solaris 2.5 don't + have it define. + * configure.in : check for btowc (). + + * regex.c: Include before , to work around + a Solaris 2.5 bug. + Patch provided by Paul Eggert. + + * tests/status.sh: new file to check return status code. + * tests/empty.sh: new file to check for empty pattern. + * tests/warning.sh: new file to tell where to report errors. + + * configure.in: If available, prefer support for large files + unless the user specified one of the CPPFLAGS, LDFLAGS, or LIBS + variables. + Done by Paul Eggert. + + * src/grep.c (usage): change prep.ai.mit.edu for gnu.org. + +1998-03-18 Alain Magloire + + * src/grep.c (usage): Formating the --help message a bit off. + Noted by William Bader. + + * src/grep.c (main): When checking conflicting matcher for option -E the + matcher was to "egrep" instead of "posix-egrep". + Reported by kwzh@gnu.org. + + * src/grep.c: Typos and rewording the --help message. + Reported by Karl Heuer. + + * src/grep.1: The man page wording : + A regular expression matching a single character may be + followed by one of several repetition operators: + is unclear since 'x(yz)*z' is a valid regex. + Remove the "matching a single character". + Suggested by Harald Hanche-Olsen. + + * src/grep.c (main): `-f /dev/null' now specifies no patterns + and therfore matches nothing. + Reported by Jorge Stolfi. + Patched by Paul Eggert. + +1998-03-10 Alain Magloire + + * Ice storm 98(el nino). Lost grep repository disk, + and my $HOME directory, etc .. + Trying to get the emails/patch from dejanews.com + and start from grep-2.1. + sigh .... + +1997-11-01 Alain Magloire + + * src/grep.c: For the long options, the problems are: + --file appears in the option table as 'no_argument' + instead of 'required_argument'. + --files-with-matches is missing from the option table. + The help lists '--fixed-strings' as the long option for -F, + the table has '--fixed-regexp'. + --regexp appears in the option table as 'no_argument' + instead of 'required_argument'. + --with-filename is missing from the option table. + Reported by Grant McDorman and Krishna Sethuraman. + +1997-10-19 Alain Magloire + + * src/grep.c: the option "with-filename was not in the arg table. + Corrected by Jim Hand. + + * GNU gettext library from gettext-0.10.32. + + * src/grep.c: reverse back to greping directories, + One could skip the error message by defining + SKIP_DIR_ERROR. There is no clear way of doing + things, I hope to setle this on the next majore release + Thanks Paul Eggert, Eli Zaretskii and gnits for the + exchange. + + * tests/status.sh: add this check to make sure + That the return status code is ok. + +1997-10-10 Andreas Schwab + + * src/grep.1: Fix formatting. + + * configure.in: Check for wctype.h, wchar.h, libintl.h and + isascii, which are needed for regex.c. + +1997-10-01 Paul Eggert + + * src/grep.c (fillbuf): Don't warn about mmap failures. + +1997-09-7 Alain Magloire + + * src/grep.c: added code for -H --with-filename. + + * djgpp/*: patch wrongly apply + duplication of text in djgpp/{README,config.h}. + Filter djgpp/config.bat with unix2dos. + + * djgpp/make.mak: beautify + From Eli Zaretskii. + + * grep-2.1 release. + +1997-09-01 Alain Magloire + + * grep-2.0f out for testing. + + * update to GNU gettext library from gettext-0.10.31 + + * grep.c : have a nicer format for --version. + Noted by Ulrich Drepper. + + * obstack.[ch]: updated from GNU C library + * configure.in: look for stdlib.h [HAVE_STDLIB_H] + Comments from Ulrich Drepper. + +1997-08-25 Philippe De Muyter + + * src/dfa.c (sys/types.h): File included unconditionnaly. + +1997-08-16 Eli Zaretskii + + * grep.c (long_options) [O_BINARY]: Add DOS-specific options. + (fillbuf) [O_BINARY]: For DOS-style text files, strip CR + characters at end of line. + (prline) [O_BINARY]: Report correct byte offsets, even though CR + characters were stripped when reading the file. + (usage) [O_BINARY]: Add DOS-specific options. + (setmatcher) [HAVE_SETRLIMIT]: Set re_max_failures so that the + matcher won't ever overflow the stack. + (main) [__MSDOS__, _WIN32]: Handle backslashes and drive letters + in argv[0], remove the .exe suffix, and downcase the prgram name. + [O_BINARY]: Pass additional DOS-specific options to getopt_long + and handle them. Call stat before attempting to open the file, in + case it is a directory (DOS will fail the open call for + directories). Switch the input descriptor to binary mode, unless + it is a terminal device. + + * system.h [O_BINARY]: Define macros to switch a handle to binary + mode, so binary files could be grep'ed on MS-DOS and MS-Windows. + [HAVE_SETLOCALE]: Test for HAVE_SETLOCALE instead of + HAVE_LC_MESSAGES, to prevent compilation error in grep.c on + systems which don't define HAVE_LC_MESSAGES, but have setlocale. + + * dosbuf.c: New file, functions specific for MS-DOS/MS-Windows. + (guess_type, undossify_input, dossified_pos): New functions. + + * djgpp/config.h, djgpp/config.bat, djgpp/main.mak, djgpp/src.mak, + djgpp/po.mak, djgpp/intl.mak, djgpp/tests.mak, djgpp/po2tbl.sed: + New files, for building Grep with DJGPP tools for MS-DOS and + MS-Windows. + + * grep.1: Document DOS-specific switches. + +1997-08-08 Alain Magloire + + * grep-2.0e: available for testing + + * grep.c: change LC_MESSAGE to LC_ALL for (LC_CTYPE). + Suggested by Jochen Hein. + + * ABOUT-NLS: updated. + * grep.c: --version: more verbosity (COPYRIGHT). + * grep.c: --help: PATTERN, FILE instead of , . + * INSTALL.grep: not necessary removed. + * configure.in: --disable-regex rename --without-include-regex. + * THANKS: format: first row name, second email. + * ChangeLog: format ISO 8601. + Reported by Franc,ois Pinard. + + * grep.c: move dcl of struct stat st into "else" where it's used. + Reported by Jim Meyering. + + * grep.c: totalnl should be %u in printf. + Reported by Michael Aichlmay + Corrected with guidance from Ulrich Drepper + +1997-07-24 Alain Magloire + + * Makefile.am: corrected an error when installing {f,e}grep.1. + From Kaveh R. Ghazi . + From Ulrich Drepper . + + * Many files: use PARAMS instead of __STDC__ for prototypes. + From Jim Meyering . + Patch provided by Kaveh R. Ghazi . + + * dfa.[ch]: uses the one in gawk-3.0.3 with the patch from + Arnold (see Changelog: July 12 1997) + + * grep.1: a note to say -l, -L, -q stop on first match. + Noted by Andrew Beattie . + + * grep.c: refuse to scan if the file is a directory. + This was causing problems on SUNs. If the directory contains + a file that could match the pattern, garbage was display. + + * tests directory: added new set of tests from Henry Spencer + regex package. Change the way the tests were done to be more + conformant to automake. + + * configure.in: added --disable-regex for folks with their own fuctions. + + * grep-20d : available for testing + +1997-07-18 Alain Magloire + + * grep-2.0c: available for testing + +1997-07-17 Alain Magloire + + * src/grep.c: Cause grep to fail if `fclose (stdout)' fails. + From Jim Meyering . + + * grep.c:usage() more consistency in the --help. + + * egrep, fgrep were links This is in violation of GNU standards: + "Please don't make the behavior of a utility depend on the name used + to invoke it. It is useful sometimes to make a link to a utility with + a different name, and that should not change what it does." + For now egrep and fgrep will be copies of grep. A better scheme + should be found later. + After discussion with Tom Tromey . + + * fgrep.man and egrep.man included: They are stubs that call grep.1. + * Makefile.am: modified to install {f,e,}grep[,.1]. + + * speed hack for -l, -L: bail out on first match. + From Scott Weikart . + + * *.[ch]: provided prototypes for strict argument checking + With the help of Stewart Levin . + +1997-07-16 Alain Magloire + + * configure.in: typo in the creation of po/Makefile + Noted by Volker Borchert bt@teknon.de. + + * grep-2.0b: make it available for testing. + +1997-07-15 Alain Magloire + + * src/grep.c usage(): cut the --help in smaller printf()'s + Noted by Ulrich Drepper . + +1997-07-14 Alain Magloire + + * grep-2.0a: make an alpha available for testing. + +1997-07-12 Alain Magloire + + * run gettextize: added the po directory filled with *.po files. + + * check.sh, scriptgen.awk: fix grep paths. + + * change the directory strucure: grep is now in src to comply with + gettext.m4. + + * grep.c version.c [VERSION]: got rid of version.c, + it is now define via config.h. + + * dfa.c: patch to speed up initialization. + Arnold Robbins (arnold@gnu.ai.mit.edu). + +1997-07-09 Alain Magloire + + * *.c [HAVE_CONFIG_H]: Macro defined. + + * support for I18N in Makefile.am and configure.in. + + * update all the string to use gettext(I18N). + Help from Franc,ois Pinard previous patch . + +1997-07-04 Alain Magloire + + * obstack.[ch]: updated from glibc. + Work of Ulrich Drepper . + + * regex.[ch]: updated from glibc. + Work of Ulrich Drepper . + + * grep.c: for option -e not counting '\n' for new keys. + From Mark Waite . + + * grep.c: for option -f allocating the right count. + From Andreas Schwab . + Mike Heartel (mike@cs.uoregon.edu). + + * kwset.c (bmexec): Cast tp[-2] to unsigned char before comparing. + From Jim Meyering . + + * grep.1: various typos. + From Keith Bostic . + Mike Heartel (mike@cs.uoregon.edu). + +1997-06-17 Alain Magloire + + * grep.c: support for long options. + patch done by Franc,ois Pinard . + + * add getopt1.c in Makefile.am. + Noted by Franc,ois Pinard + + * replace getopt.[ch] and add getopt1.c. + + * kwset.c: undef malloc before define it. + Franc,ois Pinard . + +1997-06-07 Alain Magloire + + * grep.c: format incorrect in + fprintf("%s: warning: %s: %s...", filename, strerror(errno)). + Mike Heartel (mike@cs.uoregon.edu). + +1996-11-19 David J MacKenzie + + * make.com: Set the logical SYS. From rdb@cocamrd.oz.au (Rodney Brown). + + * grep.c (S_ISREG): Define if not defined already, for e.g. + SunOS 4.0.3. + + * dfa.c (test_bit, set_bit, clear_bit): Renamed from tstbit, + setbit, clrbit to avoid conflict with HP-UX sys/param.h macros. + + * memchr.c: New file, from GNU libc. + * grep.c (memchr): Remove definition. + * configure.in: Use AC_REPLACE_FUNCS for memchr. + + * configure.in: Remove unused checks for memalign and unsigned char. + * grep.c: HAVE_WORKING_MMAP -> HAVE_MMAP. + + * system.h: New file. + * dfa.c, kwset.c, grep.c, search.c: Use it instead of duplicating + portability boilerplate. + + * grep.c: Include sys/types.h once, instead of three times + conditionally. + * dfa.c, kwset.c, search.c: Include sys/types.h unconditionally, + to always try to get size_t (needed on some old SysV's). + + * dfa.c: Define strchr in terms of index, not the other way around. + * search.c: Use memcpy instead of bcopy. + +1996-11-15 David J MacKenzie + + * Many files: Update FSF address. + Update configuration to use autoconf v2 and automake. + +1993-05-22 Mike Haertel + + * Version 2.0 released. diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..5458714 --- /dev/null +++ b/INSTALL @@ -0,0 +1,234 @@ +Installation Instructions +************************* + +Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, +2006 Free Software Foundation, Inc. + +This file is free documentation; the Free Software Foundation gives +unlimited permission to copy, distribute and modify it. + +Basic Installation +================== + +Briefly, the shell commands `./configure; make; make install' should +configure, build, and install this package. The following +more-detailed instructions are generic; see the `README' file for +instructions specific to this package. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, and a +file `config.log' containing compiler output (useful mainly for +debugging `configure'). + + It can also use an optional file (typically called `config.cache' +and enabled with `--cache-file=config.cache' or simply `-C') that saves +the results of its tests to speed up reconfiguring. Caching is +disabled by default to prevent problems with accidental use of stale +cache files. + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If you are using the cache, and at +some point `config.cache' contains results you don't want to keep, you +may remove or edit it. + + The file `configure.ac' (or `configure.in') is used to create +`configure' by a program called `autoconf'. You need `configure.ac' if +you want to change it or regenerate `configure' using a newer version +of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. + + Running `configure' might take a while. While running, it prints + some messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + +Compilers and Options +===================== + +Some systems require unusual options for compilation or linking that the +`configure' script does not know about. Run `./configure --help' for +details on some of the pertinent environment variables. + + You can give `configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here +is an example: + + ./configure CC=c99 CFLAGS=-g LIBS=-lposix + + *Note Defining Variables::, for more details. + +Compiling For Multiple Architectures +==================================== + +You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you can use GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + With a non-GNU `make', it is safer to compile the package for one +architecture at a time in the source code directory. After you have +installed the package for one architecture, use `make distclean' before +reconfiguring for another architecture. + +Installation Names +================== + +By default, `make install' installs the package's commands under +`/usr/local/bin', include files under `/usr/local/include', etc. You +can specify an installation prefix other than `/usr/local' by giving +`configure' the option `--prefix=PREFIX'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +pass the option `--exec-prefix=PREFIX' to `configure', the package uses +PREFIX as the prefix for installing programs and libraries. +Documentation and other data files still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=DIR' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + +Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + +There may be some features `configure' cannot figure out automatically, +but needs to determine by the type of machine the package will run on. +Usually, assuming the package is built to be run on the _same_ +architectures, `configure' can figure that out, but if it prints a +message saying it cannot guess the machine type, give it the +`--build=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name which has the form: + + CPU-COMPANY-SYSTEM + +where SYSTEM can have one of these forms: + + OS KERNEL-OS + + See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the machine type. + + If you are _building_ compiler tools for cross-compiling, you should +use the option `--target=TYPE' to select the type of system they will +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the +"host" platform (i.e., that on which the generated programs will +eventually be run) with `--host=TYPE'. + +Sharing Defaults +================ + +If you want to set default values for `configure' scripts to share, you +can create a site shell script called `config.site' that gives default +values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Defining Variables +================== + +Variables not defined in a site shell script can be set in the +environment passed to `configure'. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the `configure' command line, using `VAR=value'. For example: + + ./configure CC=/usr/local2/bin/gcc + +causes the specified `gcc' to be used as the C compiler (unless it is +overridden in the site shell script). + +Unfortunately, this technique does not work for `CONFIG_SHELL' due to +an Autoconf bug. Until the bug is fixed you can use this workaround: + + CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash + +`configure' Invocation +====================== + +`configure' recognizes the following options to control how it operates. + +`--help' +`-h' + Print a summary of the options to `configure', and exit. + +`--version' +`-V' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally `config.cache'. FILE defaults to `/dev/null' to + disable caching. + +`--config-cache' +`-C' + Alias for `--cache-file=config.cache'. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`configure' also accepts some other, not widely useful, options. Run +`configure --help' for more details. + diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..1da554c --- /dev/null +++ b/Makefile.am @@ -0,0 +1,51 @@ +## Process this file with automake to create Makefile.in +AUTOMAKE_OPTIONS = no-dependencies + +SUBDIRS = intl po lib doc src tests m4 vms bootstrap + +EXTRA_DIST = TODO README README-alpha + +# We should be able to just define `ACLOCAL_AMFLAGS = --acdir=m4', +# but this runs afoul of a bug in automake 1. +# The following hack works around this bug by creating acinclude.m4 manually. +ACLOCAL_AMFLAGS = +M4DIR = $(srcdir)/m4 +ACINCLUDE_INPUTS = $(M4DIR)/decl.m4 $(M4DIR)/djgpp.m4 $(M4DIR)/dosfile.m4 \ + $(M4DIR)/envsep.m4 $(M4DIR)/error.m4 $(M4DIR)/gettext.m4 $(M4DIR)/glibc.m4 \ + $(M4DIR)/header.m4 $(M4DIR)/init.m4 $(M4DIR)/install.m4 \ + $(M4DIR)/inttypes_h.m4 $(M4DIR)/isc-posix.m4 $(M4DIR)/largefile.m4 \ + $(M4DIR)/lcmessage.m4 $(M4DIR)/malloc.m4 $(M4DIR)/mbstate_t.m4 \ + $(M4DIR)/missing.m4 $(M4DIR)/progtest.m4 $(M4DIR)/realloc.m4 \ + $(M4DIR)/regex.m4 $(M4DIR)/sanity.m4 $(M4DIR)/strerror_r.m4 \ + $(M4DIR)/uintmax_t.m4 $(M4DIR)/ulonglong.m4 $(M4DIR)/xstrtoumax.m4 +$(srcdir)/acinclude.m4 : $(ACINCLUDE_INPUTS) + cat $(ACINCLUDE_INPUTS) >$(srcdir)/acinclude.m4 + +# make cvs-clean blatantly stolen from KDE CVS ;) +cvs-clean: + @if test ! -d CVS; then \ + echo "You don't have a toplevel CVS directory."; \ + echo "You most certainly didn't use cvs to get these sources."; \ + echo "But this function depends on cvs's information."; \ + exit 1 ;\ + fi;\ + pwd=`pwd` ;\ + dirs=`find . -type d | grep -v CVS | sed -e "s#^./##"` ;\ + for i in $$dirs; do \ + if test ! -d "$$pwd/$$i/CVS"; then \ + echo "D $$i" ;\ + rm -rf "$$pwd/$$i"; \ + continue; \ + fi ;\ + cd $$pwd/$$i ;\ + for f in * .*; do \ + if test ! -d "$$f"; then \ + if grep "^/$$f/" CVS/Entries > /dev/null; then \ + a="b"; \ + else \ + echo "F $$i/$$f"; \ + rm -f "$$pwd/$$i/$$f"; \ + fi; \ + fi ; \ + done; \ + done diff --git a/Makefile.cvs b/Makefile.cvs new file mode 100644 index 0000000..265bf3a --- /dev/null +++ b/Makefile.cvs @@ -0,0 +1,50 @@ +VERSION = $(shell cat configure.ac.in |grep AC_INIT |sed -e 's/[^,]*, *//;s/,.*//' ) +SRCDIR = $(shell pwd) + +all: autogen.sh configure.ac.in + ./autogen.sh + +grep-$(VERSION).tar: + [ -e configure.ac.in ] || ( echo Must be run from grep source dir ; exit 1 ) + rm -rf /tmp/grep-$(VERSION) && cp -aR $(SRCDIR) /tmp/grep-$(VERSION) && cd /tmp/grep-$(VERSION) && make -f Makefile.cvs cvs-clean && make -f Makefile.cvs && rm -rf autom4te.cache && (find . -type d -name CVS |xargs rm -rf) && cd .. && tar chf $(SRCDIR)/grep-$(VERSION).tar grep-$(VERSION) + +grep-$(VERSION).tar.lz: grep-$(VERSION).tar + lzip -9ef grep-$(VERSION).tar + +grep-$(VERSION).tar.bz2: grep-$(VERSION).tar + bzip2 -9f grep-$(VERSION).tar + +grep-$(VERSION).tar.gz: grep-$(VERSION).tar + gzip -9f grep-$(VERSION).tar + +rpm: grep-$(VERSION).tar.bz2 + rpm -ts --define '_srcrpmdir $(SRCDIR)' grep-$(VERSION).tar.bz2 + +# make cvs-clean blatantly stolen from KDE CVS ;) +cvs-clean: + @if test ! -d CVS; then \ + echo "You don't have a toplevel CVS directory."; \ + echo "You most certainly didn't use cvs to get these sources."; \ + echo "But this function depends on cvs's information."; \ + exit 1 ;\ + fi;\ + pwd=`pwd` ;\ + dirs=`find . -type d | grep -v CVS | sed -e "s#^./##"` ;\ + for i in $$dirs; do \ + if test ! -d "$$pwd/$$i/CVS"; then \ + echo "D $$i" ;\ + rm -rf "$$pwd/$$i"; \ + continue; \ + fi ;\ + cd $$pwd/$$i ;\ + for f in * .*; do \ + if test ! -d "$$f"; then \ + if grep "^/$$f/" CVS/Entries > /dev/null; then \ + a="b"; \ + else \ + echo "F $$i/$$f"; \ + rm -f "$$pwd/$$i/$$f"; \ + fi; \ + fi ; \ + done; \ + done diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 0000000..aba42e7 --- /dev/null +++ b/Makefile.in @@ -0,0 +1,692 @@ +# Makefile.in generated by automake 1.10 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = . +DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/config.hin \ + $(top_srcdir)/configure $(top_srcdir)/intl/Makefile.in \ + ABOUT-NLS AUTHORS COPYING ChangeLog INSTALL NEWS THANKS TODO \ + config.guess config.sub depcomp install-sh +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/codeset.m4 \ + $(top_srcdir)/m4/decl.m4 $(top_srcdir)/m4/djgpp.m4 \ + $(top_srcdir)/m4/dosfile.m4 $(top_srcdir)/m4/envsep.m4 \ + $(top_srcdir)/m4/error.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/header.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/inttypes_h.m4 \ + $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/largefile.m4 \ + $(top_srcdir)/m4/lcmessage.m4 $(top_srcdir)/m4/malloc.m4 \ + $(top_srcdir)/m4/mbstate_t.m4 $(top_srcdir)/m4/missing.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/realloc.m4 \ + $(top_srcdir)/m4/regex.m4 $(top_srcdir)/m4/sanity.m4 \ + $(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/ulonglong.m4 \ + $(top_srcdir)/m4/xstrtoumax.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno config.status.lineno +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = intl/Makefile +depcomp = +am__depfiles_maybe = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + { test ! -d $(distdir) \ + || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -fr $(distdir); }; } +DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2 +GZIP_ENV = --best +distuninstallcheck_listfiles = find . -type f -print +distcleancheck_listfiles = find . -type f -print +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GENCAT = @GENCAT@ +GETCONF = @GETCONF@ +GLIBC21 = @GLIBC21@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLBISON = @INTLBISON@ +INTLLIBS = @INTLLIBS@ +INTLOBJS = @INTLOBJS@ +INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +POFILES = @POFILES@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SEP = @SEP@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +U = @U@ +USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AUTOMAKE_OPTIONS = no-dependencies +SUBDIRS = intl po lib doc src tests m4 vms bootstrap +EXTRA_DIST = TODO README README-alpha + +# We should be able to just define `ACLOCAL_AMFLAGS = --acdir=m4', +# but this runs afoul of a bug in automake 1. +# The following hack works around this bug by creating acinclude.m4 manually. +ACLOCAL_AMFLAGS = +M4DIR = $(srcdir)/m4 +ACINCLUDE_INPUTS = $(M4DIR)/decl.m4 $(M4DIR)/djgpp.m4 $(M4DIR)/dosfile.m4 \ + $(M4DIR)/envsep.m4 $(M4DIR)/error.m4 $(M4DIR)/gettext.m4 $(M4DIR)/glibc.m4 \ + $(M4DIR)/header.m4 $(M4DIR)/init.m4 $(M4DIR)/install.m4 \ + $(M4DIR)/inttypes_h.m4 $(M4DIR)/isc-posix.m4 $(M4DIR)/largefile.m4 \ + $(M4DIR)/lcmessage.m4 $(M4DIR)/malloc.m4 $(M4DIR)/mbstate_t.m4 \ + $(M4DIR)/missing.m4 $(M4DIR)/progtest.m4 $(M4DIR)/realloc.m4 \ + $(M4DIR)/regex.m4 $(M4DIR)/sanity.m4 $(M4DIR)/strerror_r.m4 \ + $(M4DIR)/uintmax_t.m4 $(M4DIR)/ulonglong.m4 $(M4DIR)/xstrtoumax.m4 + +all: config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +.SUFFIXES: +am--refresh: + @: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \ + cd $(srcdir) && $(AUTOMAKE) --gnu \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + echo ' $(SHELL) ./config.status'; \ + $(SHELL) ./config.status;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) + +config.h: stamp-h1 + @if test ! -f $@; then \ + rm -f stamp-h1; \ + $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \ + else :; fi + +stamp-h1: $(srcdir)/config.hin $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status config.h +$(srcdir)/config.hin: $(am__configure_deps) + cd $(top_srcdir) && $(AUTOHEADER) + rm -f stamp-h1 + touch $@ + +distclean-hdr: + -rm -f config.h stamp-h1 +intl/Makefile: $(top_builddir)/config.status $(top_srcdir)/intl/Makefile.in + cd $(top_builddir) && $(SHELL) ./config.status $@ + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) config.hin $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) config.hin $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.hin $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) config.hin $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + $(am__remove_distdir) + test -d $(distdir) || mkdir $(distdir) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + distdir) \ + || exit 1; \ + fi; \ + done + -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r $(distdir) +dist-gzip: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) +dist-bzip2: distdir + tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +dist-tarZ: distdir + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__remove_distdir) + +dist-shar: distdir + shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + $(am__remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__remove_distdir) + +dist dist-all: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + case '$(DIST_ARCHIVES)' in \ + *.tar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ + *.tar.bz2*) \ + bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.Z*) \ + uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ + *.shar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + esac + chmod -R a-w $(distdir); chmod a+w $(distdir) + mkdir $(distdir)/_build + mkdir $(distdir)/_inst + chmod a-w $(distdir) + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && cd $(distdir)/_build \ + && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + --with-included-gettext \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ + distuninstallcheck \ + && chmod -R a-w "$$dc_install_base" \ + && ({ \ + (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ + distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ + } || { rm -rf "$$dc_destdir"; exit 1; }) \ + && rm -rf "$$dc_destdir" \ + && $(MAKE) $(AM_MAKEFLAGS) dist \ + && rm -rf $(DIST_ARCHIVES) \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck + $(am__remove_distdir) + @(echo "$(distdir) archives ready for distribution: "; \ + list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ + sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' +distuninstallcheck: + @cd $(distuninstallcheck_dir) \ + && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ + || { echo "ERROR: files left after uninstall:" ; \ + if test -n "$(DESTDIR)"; then \ + echo " (check DESTDIR support)"; \ + fi ; \ + $(distuninstallcheck_listfiles) ; \ + exit 1; } >&2 +distcleancheck: distclean + @if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left in build directory after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 +check-am: all-am +check: check-recursive +all-am: Makefile config.h +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-hdr distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-exec-am: + +install-html: install-html-recursive + +install-info: install-info-recursive + +install-man: + +install-pdf: install-pdf-recursive + +install-ps: install-ps-recursive + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ + install-strip + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am am--refresh check check-am clean clean-generic \ + ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \ + dist-shar dist-tarZ dist-zip distcheck distclean \ + distclean-generic distclean-hdr distclean-tags distcleancheck \ + distdir distuninstallcheck dvi dvi-am html html-am info \ + info-am install install-am install-data install-data-am \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-html install-html-am install-info install-info-am \ + install-man install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ + pdf-am ps ps-am tags tags-recursive uninstall uninstall-am + +$(srcdir)/acinclude.m4 : $(ACINCLUDE_INPUTS) + cat $(ACINCLUDE_INPUTS) >$(srcdir)/acinclude.m4 + +# make cvs-clean blatantly stolen from KDE CVS ;) +cvs-clean: + @if test ! -d CVS; then \ + echo "You don't have a toplevel CVS directory."; \ + echo "You most certainly didn't use cvs to get these sources."; \ + echo "But this function depends on cvs's information."; \ + exit 1 ;\ + fi;\ + pwd=`pwd` ;\ + dirs=`find . -type d | grep -v CVS | sed -e "s#^./##"` ;\ + for i in $$dirs; do \ + if test ! -d "$$pwd/$$i/CVS"; then \ + echo "D $$i" ;\ + rm -rf "$$pwd/$$i"; \ + continue; \ + fi ;\ + cd $$pwd/$$i ;\ + for f in * .*; do \ + if test ! -d "$$f"; then \ + if grep "^/$$f/" CVS/Entries > /dev/null; then \ + a="b"; \ + else \ + echo "F $$i/$$f"; \ + rm -f "$$pwd/$$i/$$f"; \ + fi; \ + fi ; \ + done; \ + done +# 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. +.NOEXPORT: diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..ec13331 --- /dev/null +++ b/NEWS @@ -0,0 +1,243 @@ +Version 2.5.2 + - The new option --exclude-dir allows to specify a directory pattern that + will be exclided from recursive grep. + - Numerous bug fixes + +Version 2.5.1 + - This is a bugfix release. No new features. + +Version 2.5 + - The new option --label allows to specify a different name for input + from stdin. See the man or info pages for details. + + - The internal lib/getopt* files are no longer used on systems providing + getopt functionality in their libc (e.g. glibc 2.2.x). + If you need the old getopt files, use --with-included-getopt. + + - The new option --only-matching (-o) will print only the part of matching + lines that matches the pattern. This is useful, for example, to extract + IP addresses from log files. + + - i18n bug fixed ([A-Z0-9] wouldn't match A in locales other than C on + systems using recent glibc builds + + - GNU grep can now be built with autoconf 2.52. + + - The new option --devices controls how grep handles device files. Its usage + is analogous to --directories. + + - The new option --line-buffered fflush on everyline. There is a noticeable + slow down when forcing line buffering. + + - Back references are now local to the regex. + grep -e '\(a\)\1' -e '\(b\)\1' + The last backref \1 in the second expression refer to \(b\) + + - The new option --include=PATTERN will search only matching files + when recursing in directories + + - The new option --exclude=PATTERN will skip matching files when + recursing in directories. + + - The new option --color will use the environment variable GREP_COLOR + (default is red) to highlight the matching string. + --color takes an optional argument specifying when to colorize a line: + --color=always, --color=tty, --color=never + + - The following changes are for POSIX.2 conformance: + + . The -q or --quiet or --silent option now causes grep to exit + with zero status when a input line is selected, even if an error + also occurs. + + . The -s or --no-messages option no longer affects the exit status. + + . Bracket regular expressions like [a-z] are now locale-dependent. + For example, many locales sort characters in dictionary order, + and in these locales the regular expression [a-d] is not + equivalent to [abcd]; it might be equivalent to [aBbCcDd], for + example. To obtain the traditional interpretation of bracket + expressions, you can use the C locale by setting the LC_ALL + environment variable to the value "C". + + - The -C or --context option now requires an argument, partly for + consistency, and partly because POSIX.2 recommends against + optional arguments. + + - The new -P or --perl-regexp option tells grep to interpert the pattern as + a Perl regular expression. + + - The new option --max-count=num makes grep stop reading a file after num + matching lines. + New option -m; equivalent to --max-count. + + - Translations for bg, ca, da, nb and tr have been added. + +Version 2.4.2 + + - Added more check in configure to default the grep-${version}/src/regex.c + instead of the one in GNU Lib C. + +Version 2.4.1 + + - If the final byte of an input file is not a newline, grep now silently + supplies one. + + - The new option --binary-files=TYPE makes grep assume that a binary input + file is of type TYPE. + --binary-files='binary' (the default) outputs a 1-line summary of matches. + --binary-files='without-match' assumes binary files do not match. + --binary-files='text' treats binary files as text + (equivalent to the -a or --text option). + + - New option -I; equivalent to --binary-files='without-match'. + +Version 2.4: + + - egrep is now equivalent to `grep -E' as required by POSIX, + removing a longstanding source of confusion and incompatibility. + `grep' is now more forgiving about stray `{'s, for backward + compatibility with traditional egrep. + + - The lower bound of an interval is not optional. + You must use an explicit zero, e.g. `x{0,10}' instead of `x{,10}'. + (The old documentation incorrectly claimed that it was optional.) + + - The --revert-match option has been renamed to --invert-match. + + - The --fixed-regexp option has been renamed to --fixed-string. + + - New option -H or --with-filename. + + - New option --mmap. By default, GNU grep now uses read instead of mmap. + This is faster on some hosts, and is safer on all. + + - The new option -z or --null-data causes `grep' to treat a zero byte + (the ASCII NUL character) as a line terminator in input data, and + to treat newlines as ordinary data. + + - The new option -Z or --null causes `grep' to output a zero byte + instead of the normal separator after a file name. + + - These two options can be used with commands like `find -print0', + `perl -0', `sort -z', and `xargs -0' to process arbitrary file names, + even those that contain newlines. + + - The environment variable GREP_OPTIONS specifies default options; + e.g. GREP_OPTIONS='--directories=skip' reestablishes grep 2.1's + behavior of silently skipping directories. + + - You can specify a matcher multiple times without error, e.g. + `grep -E -E' or `fgrep -F'. It is still an error to specify + conflicting matchers. + + - -u and -U are now allowed on non-DOS hosts, and have no effect. + + - Modifications of the tests scripts to go around the "Broken Pipe" + errors from bash. See Bash FAQ. + + - New option -r or --recursive or --directories=recurse. + (This option was also in grep 2.3, but wasn't announced here.) + + - --without-included-regex disable, was causing bogus reports .i.e + doing more harm then good. + +Version 2.3: + + - When searching a binary file FOO, grep now just reports + `Binary file FOO matches' instead of outputting binary data. + This is typically more useful than the old behavior, + and it is also more consistent with other utilities like `diff'. + A file is considered to be binary if it contains a NUL (i.e. zero) byte. + + The new -a or --text option causes `grep' to assume that all + input is text. (This option has the same meaning as with `diff'.) + Use it if you want binary data in your output. + + - `grep' now searches directories just like ordinary files; it no longer + silently skips directories. This is the traditional behavior of + Unix text utilities (in particular, of traditional `grep'). + Hence `grep PATTERN DIRECTORY' should report + `grep: DIRECTORY: Is a directory' on hosts where the operating system + does not permit programs to read directories directly, and + `grep: DIRECTORY: Binary file matches' (or nothing) otherwise. + + The new -d ACTION or --directories=ACTION option affects directory handling. + `-d skip' causes `grep' to silently skip directories, as in grep 2.1; + `-d read' (the default) causes `grep' to read directories if possible, + as in earlier versions of grep. + + - The MS-DOS and Microsoft Windows ports now behave identically to the + GNU and Unix ports with respect to binary files and directories. + +Version 2.2: + +Bug fix release. + + - Status error number fix. + - Skipping directories removed. + - Many typos fix. + - -f /dev/null fix(not to consider as an empty pattern). + - Checks for wctype/wchar. + - -E was using the wrong matcher fix. + - bug in regex char class fix + - Fixes for DJGPP + +Version 2.1: + +This is a bug fix release(see Changelog) i.e. no new features. + + - More compliance to GNU standard. + - Long options. + - Internationalisation. + - Use automake/autoconf. + - Directory hierarchy change. + - Sigvec with -e on Linux corrected. + - Sigvec with -f on Linux corrected. + - Sigvec with the mmap() corrected. + - Bug in kwset corrected. + - -q, -L and -l stop on first match. + - New and improve regex.[ch] from Ulrich Drepper. + - New and improve dfa.[ch] from Arnold Robbins. + - Prototypes for over zealous C compiler. + - Not scanning a file, if it's a directory + (cause problems on Sun). + - Ported to MS-DOS/MS-Windows with DJGPP tools. + +See Changelog for the full story and proper credits. + +Version 2.0: + +The most important user visible change is that egrep and fgrep have +disappeared as separate programs into the single grep program mandated +by POSIX 1003.2. New options -G, -E, and -F have been added, +selecting grep, egrep, and fgrep behavior respectively. For +compatibility with historical practice, hard links named egrep and +fgrep are also provided. See the manual page for details. + +In addition, the regular expression facilities described in Posix +draft 11.2 are now supported, except for internationalization features +related to locale-dependent collating sequence information. + +There is a new option, -L, which is like -l except it lists +files which don't contain matches. The reason this option was +added is because '-l -v' doesn't do what you expect. + +Performance has been improved; the amount of improvement is platform +dependent, but (for example) grep 2.0 typically runs at least 30% faster +than grep 1.6 on a DECstation using the MIPS compiler. Where possible, +grep now uses mmap() for file input; on a Sun 4 running SunOS 4.1 this +may cut system time by as much as half, for a total reduction in running +time by nearly 50%. On machines that don't use mmap(), the buffering +code has been rewritten to choose more favorable alignments and buffer +sizes for read(). + +Portability has been substantially cleaned up, and an automatic +configure script is now provided. + +The internals have changed in ways too numerous to mention. +People brave enough to reuse the DFA matcher in other programs +will now have their bravery amply "rewarded", for the interface +to that file has been completely changed. Some changes were +necessary to track the evolution of the regex package, and since +I was changing it anyway I decided to do a general cleanup. diff --git a/README b/README new file mode 100644 index 0000000..489e357 --- /dev/null +++ b/README @@ -0,0 +1,25 @@ +This is GNU grep, the "fastest grep in the west" (we hope). All +bugs reported in previous releases have been fixed. Many exciting new +bugs have probably been introduced in this revision. + +GNU grep is provided "as is" with no warranty. The exact terms +under which you may use and (re)distribute this program are detailed +in the GNU General Public License, in the file COPYING. + +GNU grep is based on a fast lazy-state deterministic matcher (about +twice as fast as stock Unix egrep) hybridized with a Boyer-Moore-Gosper +search for a fixed string that eliminates impossible text from being +considered by the full regexp matcher without necessarily having to +look at every character. The result is typically many times faster +than Unix grep or egrep. (Regular expressions containing backreferencing +will run more slowly, however.) + +See the files AUTHORS and THANKS for a list of authors and other contributors. + +See the file INSTALL for compilation and installation instructions. + +See the file NEWS for a description of major changes in this release. + +See the file TODO for ideas on how you could help us improve grep. + +Send bug reports to bug-grep@gnu.org. diff --git a/README-alpha b/README-alpha new file mode 100644 index 0000000..027652e --- /dev/null +++ b/README-alpha @@ -0,0 +1,21 @@ +Newer, ALPHA (i.e., unstable) versions of this code are available in CVS +on Savannah. See for details. +The main project page is at . + +Please submit bug reports to . + +If you are interested in the development of GNU grep, you may want to +subscribe to the development mailing list. To subscribe, send an email +message to with "subscribe" (without the +quotation marks) in the subject header field (or in the body) of the +email, or visit . + +To follow development more closely, there is also the grep-commit mailing +list to which log entries (one per commit) and diff output (one per +modified file) from CVS are automatically sent. To subscribe, send an +email message to with "subscribe" (without +the quotation marks) in the subject header field (or in the body) of +the email, or visit . + +A web page containing information for GNU grep developers is also +available at . diff --git a/README.DOS b/README.DOS new file mode 100644 index 0000000..ca3e0fa --- /dev/null +++ b/README.DOS @@ -0,0 +1,76 @@ +GREP DJGPP README +================= + +To compile the GNU grep package with DJGPP tools, you will need the +following tools (the names of the archives on DJGPP ftp sites where +these tools are available are in parentheses): + + - The basic DJGPP development environment, including the + GCC compiler and the libraries (v2gnu/gccNNNb.zip, + v2gnu/bnuNNNb.zip, v2/djdevNNN.zip). + + - GNU Make revision 3.75 or later (v2gnu/makNNNb.zip). + + - GNU Bash (v2gnu/bshNNNb.zip). + + - GNU Sed (v2gnu/sedNNNb.zip). + + - GNU M4 (v2gnu/m4-NNNb.zip). + + - GNU Fileutils (v2gnu/filNNNb.zip), Textutils + (v2gnu/txtNNNb.zip) and Diffutils (v2gnu/difNNNb.zip). + + - A (previous version of) GNU grep (v2gnu/grepNNb.zip). + +Running the tests ("make check" in the top-level directory) +additionally requires Gawk (v2gnu/gwkNNNb.zip). TAGS and ID targets +require `etags' (from the Emacs distribution) and `mkid' (from +ID-utils, v2gnu/iduNNb.zip), respectively. + +All of these tools are available from the DJGPP archive sites. + +To build grep: + sh autogen.sh + sh configure + make + + +Source distributions on DJGPP sites usually come pre-configured, so +all you need to do in order to build the programs is to say "make". +However, source distributions on GNU ftp sites, like ftp.gnu.org, +need to be configured by running sh configure. You will also need +to run it if you need to configure grep differently than for the +default configuration, for example if you want to install the programs +in a directory other than the bin subdirectory of your DJGPP +installation. + +To test that the package works, say "make check". If you don't have a +file named sh.exe somewhere on your PATH, "make check" will refuse to +run, as it needs a Unix-like shell. + +To install, either copy the executables and man pages to the +appropriate directories, or say "make install". To clean up, say +"make clean" or "make distclean". + +Please note the -u and -U options that specifically target MS-DOS and +MS-Windows environments. They are described in the grep man page in +this distribution. + +National Language Support doesn't work in this port, so don't expect +the programs to talk to you in any language but English. + +Please post any problems in the DOS version to the comp.os.msdos.djgpp +news group first, especially if they have something to do with the +DOS-specific aspects. + +To create the files required for the documentation package +perform the following in the docs directory: + make grep.dvi + make grep.ps + makeinfo --html grep.texi -o grep.html + + +2.5f ported by Andrew Cottrell + +Enjoy, + Eli Zaretskii diff --git a/THANKS b/THANKS new file mode 100644 index 0000000..e05a9db --- /dev/null +++ b/THANKS @@ -0,0 +1,74 @@ +Aharon Robbins +Akim Demaille +Alain Magloire +Andreas Schwab +Andreas Ley +Bastiaan "Darquan" Stougie +Ben Elliston +Bernd Strieder +Bernhard Rosenkraenzer +Bob Proulx +Brian Youmans <3diff@gnu.org> +Bruno Haible +Christian Groessler +David Clissold +David J MacKenzie +David O'Brien +Eli Zaretskii +Florian La Roche +Franc,ois Pinard +Gerald Stoller +Grant McDorman +Greg Louis +Guglielmo 'bond' Bondioni +H. Merijn Brand +Harald Hanche-Olsen +Hans-Bernhard Broeker +Heikki Korpela +Isamu Hasegawa +Jeff Bailey +Jim Hand +Jim Meyering +Jochen Hein +Joel N. Weber II +John Hughes +Jorge Stolfi +Juan Manuel Guerrero +Julian Foad +Karl Berry +Karl Heuer +Kaveh R. Ghazi +Kazuro Furukawa +Keith Bostic +Krishna Sethuraman +Kurt D Schwehr +Mark Waite +Martin P.J. Zinser +Martin Rex +Michael Aichlmayr +Miles Bader +Olaf Kirch +Paul Eggert +Paul Kimoto +Phillip C. Brisco +Philippe Defert +Philippe De Muyter +Philip Hazel +Roland Roberts +Ruslan Ermilov +Santiago Vila +Shannon Hill +Sotiris Vassilopoulos +Stewart Levin +Sydoruk Stepan +Tapani Tarvainen +Tim Waugh +Tom 'moof' Spindler +Tom Tromey +Ulrich Drepper +UEBAYASHI Masao +Uwe H. Steinfeld +Volker Borchert +Wichert Akkerman +William Bader +Wolfgang Schludi diff --git a/TODO b/TODO new file mode 100644 index 0000000..b7857bb --- /dev/null +++ b/TODO @@ -0,0 +1,98 @@ +Get sane performance with UTF-8 locales. + +1) rewrite the configure.in script, perhaps also Makefile.am +2) set up for gnulib-tool --import +3) improve the test infrastructure +4) check in the patches for the sync of dfa.c with GNU awk +5) other small patches which wait for a test case +6) process the Fedora/Red Hat patches +7) some _minimal_ cleanup of the grep(), grepdir(), recursion + (the "main loop") and fix --directories=read + +## + +Write Texinfo documentation for grep. The manual page would be a good +place to start, but Info documents are also supposed to contain a +tutorial and examples. + +Fix the DFA matcher to never use exponential space. (Fortunately, these +cases are rare.) + +Improve the performance of the regex backtracking matcher. This matcher +is agonizingly slow, and is responsible for grep sometimes being slower +than Unix grep when backreferences are used. + +Provide support for the Posix [= =] and [. .] constructs. This is +difficult because it requires locale-dependent details of the character +set and collating sequence, but Posix does not standardize any method +for accessing this information! + +## + +Some test in tests/spencer2.tests should have failed !!! +Need to filter out some bugs in dfa.[ch]/regex.[ch]. + +Threads for grep ? + +GNU grep does 32 bits arithmetic, it needs to move to 64. + +Clean up, to many #ifdef's !! + +Check some new Algorithms for matching, talk to Karl Berry and Nelson. +Sunday's "Quick Search" Algorithm (CACM 33, 8 August 1990 pp. 132-142) +claim that his algo. is faster then Boyer-More ???? +Worth Checking. + +Check . +Take a look at: + -- cgrep (Context grep) seems like nice work; + -- sgrep (Struct grep); + -- agrep (Approximate grep), from glimpse; + -- nr-grep (Nondeterministic reverse grep); + -- ggrep (Grouse grep); + -- grep.py (Python grep); + -- lgrep (from lv, a Powerful Multilingual File Viewer / Grep); + -- freegrep ; + -- ja-grep's mlb2 patch (Japanese grep); + -- pcregrep (from Perl-Compatible Regular Expressions library). +Can we merge ? + +Check FreeBSD's integration of zgrep (-Z) and bzgrep (-J) in one binary. + +POSIX Compliance see p10003.x + +Moving away from GNU regex API for POSIX regex API. + +Better and faster !! + +## + +Check POSIX: + -- Volume "Base Definitions (XBD)", + Chapter "Regular Expressions" + and in particular + Section "Regular Expression General Requirements" + and its paragraph about caseless matching. + +Check the Unicode Standard: + -- Chapter 3 ("Conformance"), + Section 3.13 ("Default Case Operations") + and the toCasefold() case conversion operation; + -- Chapter 4 ("Character Properties"), + Section 4.2 ("Case -- Normative") + and the SpecialCasing.txt and CaseFolding.txt + files from the Unicode Database; + -- Chapter 5 ("Implementation Guidelines"), + Section 5.18 ("Case Mappings"), + Subsection "Caseless Matching". + +Check Unicode Technical Standard #18 ("Unicode Regular Expressions"). +Check Unicode Standard Annex #15 ("Unicode Normalization Forms"). + +## + +Before every release: + -- drop dfa.[ch] into a copy of gawk and run "make check"; + -- send pot file to the Translation Project to get fresh po files; + -- get up-to-date version of ABOUT-NLS; + -- update NEWS. diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 index 0000000..ab2db95 --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,824 @@ +# generated automatically by aclocal 1.10 -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005, 2006 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +m4_if(m4_PACKAGE_VERSION, [2.60],, +[m4_fatal([this file was generated for autoconf 2.60. +You have another version of autoconf. If you want to use that, +you should regenerate the build system entirely.], [63])]) + +# Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_AUTOMAKE_VERSION(VERSION) +# ---------------------------- +# Automake X.Y traces this macro to ensure aclocal.m4 has been +# generated from the m4 files accompanying Automake X.Y. +# (This private macro should not be called outside this file.) +AC_DEFUN([AM_AUTOMAKE_VERSION], +[am__api_version='1.10' +dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to +dnl require some minimum version. Point them to the right macro. +m4_if([$1], [1.10], [], + [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl +]) + +# _AM_AUTOCONF_VERSION(VERSION) +# ----------------------------- +# aclocal traces this macro to find the Autoconf version. +# This is a private macro too. Using m4_define simplifies +# the logic in aclocal, which can simply ignore this definition. +m4_define([_AM_AUTOCONF_VERSION], []) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. +# This function is AC_REQUIREd by AC_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], +[AM_AUTOMAKE_VERSION([1.10])dnl +_AM_AUTOCONF_VERSION(m4_PACKAGE_VERSION)]) + +# AM_AUX_DIR_EXPAND -*- Autoconf -*- + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to +# `$srcdir', `$srcdir/..', or `$srcdir/../..'. +# +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is `.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. +# +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +AC_DEFUN([AM_AUX_DIR_EXPAND], +[dnl Rely on autoconf to set up CDPATH properly. +AC_PREREQ([2.50])dnl +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 8 + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ(2.52)dnl + ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE])dnl +AC_SUBST([$1_FALSE])dnl +_AM_SUBST_NOTMAKE([$1_TRUE])dnl +_AM_SUBST_NOTMAKE([$1_FALSE])dnl +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([[conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]]) +fi])]) + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 9 + +# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + +# _AM_DEPENDENCIES(NAME) +# ---------------------- +# See how the compiler implements dependency checking. +# NAME is "CC", "CXX", "GCJ", or "OBJC". +# We try a few techniques and use that to set a single cache variable. +# +# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was +# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular +# dependency, and given that the user is not expected to run this macro, +# just rely on AC_PROG_CC. +AC_DEFUN([_AM_DEPENDENCIES], +[AC_REQUIRE([AM_SET_DEPDIR])dnl +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl +AC_REQUIRE([AM_MAKE_INCLUDE])dnl +AC_REQUIRE([AM_DEP_TRACK])dnl + +ifelse([$1], CC, [depcc="$CC" am_compiler_list=], + [$1], CXX, [depcc="$CXX" am_compiler_list=], + [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], UPC, [depcc="$UPC" am_compiler_list=], + [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) + +AC_CACHE_CHECK([dependency style of $depcc], + [am_cv_$1_dependencies_compiler_type], +[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_$1_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_$1_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_$1_dependencies_compiler_type=none +fi +]) +AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) +AM_CONDITIONAL([am__fastdep$1], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) +]) + + +# AM_SET_DEPDIR +# ------------- +# Choose a directory name for dependency files. +# This macro is AC_REQUIREd in _AM_DEPENDENCIES +AC_DEFUN([AM_SET_DEPDIR], +[AC_REQUIRE([AM_SET_LEADING_DOT])dnl +AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl +]) + + +# AM_DEP_TRACK +# ------------ +AC_DEFUN([AM_DEP_TRACK], +[AC_ARG_ENABLE(dependency-tracking, +[ --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH])dnl +_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl +]) + +# Generate code to set up dependency tracking. -*- Autoconf -*- + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +#serial 3 + +# _AM_OUTPUT_DEPENDENCY_COMMANDS +# ------------------------------ +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], +[for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # Grep'ing the whole file is not good either: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + if sed 10q "$mf" | grep '^#.*generated by automake' > /dev/null 2>&1; then + dirpart=`AS_DIRNAME("$mf")` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`AS_DIRNAME(["$file"])` + AS_MKDIR_P([$dirpart/$fdir]) + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done +])# _AM_OUTPUT_DEPENDENCY_COMMANDS + + +# AM_OUTPUT_DEPENDENCY_COMMANDS +# ----------------------------- +# This macro should only be invoked once -- use via AC_REQUIRE. +# +# This code is only required when automatic dependency tracking +# is enabled. FIXME. This creates each `.P' file that we will +# need in order to bootstrap the dependency handling code. +AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], +[AC_CONFIG_COMMANDS([depfiles], + [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], + [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) +]) + +# Do all the work for Automake. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005, 2006 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 12 + +# This macro actually does too much. Some checks are only needed if +# your package does certain things. But this isn't really a big deal. + +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) +# AM_INIT_AUTOMAKE([OPTIONS]) +# ----------------------------------------------- +# The call with PACKAGE and VERSION arguments is the old style +# call (pre autoconf-2.50), which is being phased out. PACKAGE +# and VERSION should now be passed to AC_INIT and removed from +# the call to AM_INIT_AUTOMAKE. +# We support both call styles for the transition. After +# the next Automake release, Autoconf can make the AC_INIT +# arguments mandatory, and then we can depend on a new Autoconf +# release and drop the old call support. +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_PREREQ([2.60])dnl +dnl Autoconf wants to disallow AM_ names. We explicitly allow +dnl the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl +AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl +AC_REQUIRE([AC_PROG_INSTALL])dnl +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi +AC_SUBST([CYGPATH_W]) + +# Define the identity of the package. +dnl Distinguish between old-style and new-style calls. +m4_ifval([$2], +[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl + AC_SUBST([PACKAGE], [$1])dnl + AC_SUBST([VERSION], [$2])], +[_AM_SET_OPTIONS([$1])dnl +dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. +m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, + [m4_fatal([AC_INIT should be called with package and version arguments])])dnl + AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl + AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl + +_AM_IF_OPTION([no-define],, +[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) + AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl +AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) +AM_MISSING_PROG(AUTOCONF, autoconf) +AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) +AM_MISSING_PROG(AUTOHEADER, autoheader) +AM_MISSING_PROG(MAKEINFO, makeinfo) +AM_PROG_INSTALL_SH +AM_PROG_INSTALL_STRIP +AC_REQUIRE([AM_PROG_MKDIR_P])dnl +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl +AC_REQUIRE([AM_SET_LEADING_DOT])dnl +_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], + [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], + [_AM_PROG_TAR([v7])])]) +_AM_IF_OPTION([no-dependencies],, +[AC_PROVIDE_IFELSE([AC_PROG_CC], + [_AM_DEPENDENCIES(CC)], + [define([AC_PROG_CC], + defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES(CXX)], + [define([AC_PROG_CXX], + defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJC], + [_AM_DEPENDENCIES(OBJC)], + [define([AC_PROG_OBJC], + defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl +]) +]) + + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. The stamp files are numbered to have different names. + +# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the +# loop where config.status creates the headers, so we can generate +# our stamp files there. +AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], +[# Compute $1's index in $config_headers. +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $1 | $1:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"} +AC_SUBST(install_sh)]) + +# Copyright (C) 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# Check whether the underlying file-system supports filenames +# with a leading dot. For instance MS-DOS doesn't. +AC_DEFUN([AM_SET_LEADING_DOT], +[rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null +AC_SUBST([am__leading_dot])]) + +# Check to see how 'make' treats includes. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 3 + +# AM_MAKE_INCLUDE() +# ----------------- +# Check to see how make treats includes. +AC_DEFUN([AM_MAKE_INCLUDE], +[am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo done +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +AC_MSG_CHECKING([for style of include used by $am_make]) +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi +AC_SUBST([am__include]) +AC_SUBST([am__quote]) +AC_MSG_RESULT([$_am_result]) +rm -f confinc confmf +]) + +# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_MKDIR_P +# --------------- +# Check for `mkdir -p'. +AC_DEFUN([AM_PROG_MKDIR_P], +[AC_PREREQ([2.60])dnl +AC_REQUIRE([AC_PROG_MKDIR_P])dnl +dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, +dnl while keeping a definition of mkdir_p for backward compatibility. +dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. +dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of +dnl Makefile.ins that do not define MKDIR_P, so we do our own +dnl adjustment using top_builddir (which is defined more often than +dnl MKDIR_P). +AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl +case $mkdir_p in + [[\\/$]]* | ?:[[\\/]]*) ;; + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; +esac +]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 3 + +# _AM_MANGLE_OPTION(NAME) +# ----------------------- +AC_DEFUN([_AM_MANGLE_OPTION], +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) + +# _AM_SET_OPTION(NAME) +# ------------------------------ +# Set option NAME. Presently that only means defining a flag for this option. +AC_DEFUN([_AM_SET_OPTION], +[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) + +# _AM_SET_OPTIONS(OPTIONS) +# ---------------------------------- +# OPTIONS is a space-separated list of Automake options. +AC_DEFUN([_AM_SET_OPTIONS], +[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) + +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) +# ------------------------------------------- +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +AC_DEFUN([_AM_IF_OPTION], +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) + +# Copyright (C) 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2005, 2006 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 5 + +AC_DEFUN([AM_C_PROTOTYPES], +[AC_REQUIRE([AC_C_PROTOTYPES]) +if test "$ac_cv_prog_cc_stdc" != no; then + U= ANSI2KNR= +else + U=_ ANSI2KNR=./ansi2knr +fi +# Ensure some checks needed by ansi2knr itself. +AC_REQUIRE([AC_HEADER_STDC]) +AC_CHECK_HEADERS([string.h]) +AC_SUBST([U])dnl +AC_SUBST([ANSI2KNR])dnl +_AM_SUBST_NOTMAKE([ANSI2KNR])dnl +]) + +AU_DEFUN([fp_C_PROTOTYPES], [AM_C_PROTOTYPES]) + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_STRIP +# --------------------- +# One issue with vendor `install' (even GNU) is that you can't +# specify the program used to strip binaries. This is especially +# annoying in cross-compiling environments, where the build's strip +# is unlikely to handle the host's binaries. +# Fortunately install-sh will honor a STRIPPROG variable, so we +# always use install-sh in `make install-strip', and initialize +# STRIPPROG with the value of the STRIP variable (set by the user). +AC_DEFUN([AM_PROG_INSTALL_STRIP], +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be `maybe'. +if test "$cross_compiling" != no; then + AC_CHECK_TOOL([STRIP], [strip], :) +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) + +# Copyright (C) 2006 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_SUBST_NOTMAKE(VARIABLE) +# --------------------------- +# Prevent Automake from outputing VARIABLE = @VARIABLE@ in Makefile.in. +# This macro is traced by Automake. +AC_DEFUN([_AM_SUBST_NOTMAKE]) + +# Check how to create a tarball. -*- Autoconf -*- + +# Copyright (C) 2004, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# _AM_PROG_TAR(FORMAT) +# -------------------- +# Check how to create a tarball in format FORMAT. +# FORMAT should be one of `v7', `ustar', or `pax'. +# +# Substitute a variable $(am__tar) that is a command +# writing to stdout a FORMAT-tarball containing the directory +# $tardir. +# tardir=directory && $(am__tar) > result.tar +# +# Substitute a variable $(am__untar) that extract such +# a tarball read from stdin. +# $(am__untar) < result.tar +AC_DEFUN([_AM_PROG_TAR], +[# Always define AMTAR for backward compatibility. +AM_MISSING_PROG([AMTAR], [tar]) +m4_if([$1], [v7], + [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], + [m4_case([$1], [ustar],, [pax],, + [m4_fatal([Unknown tar format])]) +AC_MSG_CHECKING([how to create a $1 tar archive]) +# Loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' +_am_tools=${am_cv_prog_tar_$1-$_am_tools} +# Do not fold the above two line into one, because Tru64 sh and +# Solaris sh will not grok spaces in the rhs of `-'. +for _am_tool in $_am_tools +do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; + do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break + + # tar/untar a dummy directory, and stop if the command works + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar /dev/null 2>&1 && break + fi +done +rm -rf conftest.dir + +AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) +AC_MSG_RESULT([$am_cv_prog_tar_$1])]) +AC_SUBST([am__tar]) +AC_SUBST([am__untar]) +]) # _AM_PROG_TAR + +m4_include([m4/codeset.m4]) +m4_include([m4/decl.m4]) +m4_include([m4/djgpp.m4]) +m4_include([m4/dosfile.m4]) +m4_include([m4/envsep.m4]) +m4_include([m4/error.m4]) +m4_include([m4/gettext.m4]) +m4_include([m4/glibc21.m4]) +m4_include([m4/header.m4]) +m4_include([m4/iconv.m4]) +m4_include([m4/inttypes_h.m4]) +m4_include([m4/isc-posix.m4]) +m4_include([m4/largefile.m4]) +m4_include([m4/lcmessage.m4]) +m4_include([m4/malloc.m4]) +m4_include([m4/mbstate_t.m4]) +m4_include([m4/missing.m4]) +m4_include([m4/progtest.m4]) +m4_include([m4/realloc.m4]) +m4_include([m4/regex.m4]) +m4_include([m4/sanity.m4]) +m4_include([m4/uintmax_t.m4]) +m4_include([m4/ulonglong.m4]) +m4_include([m4/xstrtoumax.m4]) diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..de32a90 --- /dev/null +++ b/autogen.sh @@ -0,0 +1,27 @@ +#! /bin/sh + +chmod +x tests/*.sh # fix a bug in CVS + +# Generate configure.ac with ALL_LINGUAS matching the languages +# we have... +ALL_LINGUAS="" +for i in po/*.po; do + ALL_LINGUAS="$ALL_LINGUAS `basename $i .po`" +done +# Eliminate leading whitespace +ALL_LINGUAS="`echo $ALL_LINGUAS |cut -b1-`" +sed -e "s,@ALL_LINGUAS@,$ALL_LINGUAS," configure.ac.in >configure.ac + +# Let auto* do its work +if \ +aclocal -I m4 && +autoheader && +automake -a && +autoconf +then + echo "Next, run ./configure && make && make check" +else + echo + echo "An error occured." + exit 1 +fi diff --git a/bootstrap/.cvsignore b/bootstrap/.cvsignore new file mode 100644 index 0000000..282522d --- /dev/null +++ b/bootstrap/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/bootstrap/Makefile.am b/bootstrap/Makefile.am new file mode 100644 index 0000000..a54af3b --- /dev/null +++ b/bootstrap/Makefile.am @@ -0,0 +1,4 @@ +## Process this file with automake to create Makefile.in +AUTOMAKE_OPTIONS = no-dependencies + +EXTRA_DIST = Makefile.try README diff --git a/bootstrap/Makefile.in b/bootstrap/Makefile.in new file mode 100644 index 0000000..0fb8718 --- /dev/null +++ b/bootstrap/Makefile.in @@ -0,0 +1,341 @@ +# Makefile.in generated by automake 1.10 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = bootstrap +DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/codeset.m4 \ + $(top_srcdir)/m4/decl.m4 $(top_srcdir)/m4/djgpp.m4 \ + $(top_srcdir)/m4/dosfile.m4 $(top_srcdir)/m4/envsep.m4 \ + $(top_srcdir)/m4/error.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/header.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/inttypes_h.m4 \ + $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/largefile.m4 \ + $(top_srcdir)/m4/lcmessage.m4 $(top_srcdir)/m4/malloc.m4 \ + $(top_srcdir)/m4/mbstate_t.m4 $(top_srcdir)/m4/missing.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/realloc.m4 \ + $(top_srcdir)/m4/regex.m4 $(top_srcdir)/m4/sanity.m4 \ + $(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/ulonglong.m4 \ + $(top_srcdir)/m4/xstrtoumax.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +depcomp = +am__depfiles_maybe = +SOURCES = +DIST_SOURCES = +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GENCAT = @GENCAT@ +GETCONF = @GETCONF@ +GLIBC21 = @GLIBC21@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLBISON = @INTLBISON@ +INTLLIBS = @INTLLIBS@ +INTLOBJS = @INTLOBJS@ +INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +POFILES = @POFILES@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SEP = @SEP@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +U = @U@ +USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AUTOMAKE_OPTIONS = no-dependencies +EXTRA_DIST = Makefile.try README +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu bootstrap/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu bootstrap/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-exec-am: + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic distclean \ + distclean-generic distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am + +# 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. +.NOEXPORT: diff --git a/bootstrap/Makefile.try b/bootstrap/Makefile.try new file mode 100644 index 0000000..88f2caf --- /dev/null +++ b/bootstrap/Makefile.try @@ -0,0 +1,145 @@ +# + +# Define for DOS/WIN (not including DJGPP): +#OBJEXT = obj +#EXEEXT = .exe +EXEEXT = +OBJEXT = o + +# Source of grep. +grep_OBJS = \ + grep.$(OBJEXT) \ + search.$(OBJEXT) \ + kwset.$(OBJEXT) \ + dfa.$(OBJEXT) +egrep_OBJS = \ + egrep.$(OBJEXT) \ + esearch.$(OBJEXT) \ + kwset.$(OBJEXT) \ + dfa.$(OBJEXT) +fgrep_OBJS = \ + fgrep.$(OBJEXT) \ + fsearch.$(OBJEXT) \ + kwset.$(OBJEXT) + +# Supporting routines. +LIB_OBJS_core = \ + $(libdir)/closeout.$(OBJEXT) \ + $(libdir)/error.$(OBJEXT) \ + $(libdir)/exclude.$(OBJEXT) \ + $(libdir)/hard-locale.$(OBJEXT) \ + $(libdir)/isdir.$(OBJEXT) \ + $(libdir)/quotearg.$(OBJEXT) \ + $(libdir)/regex.$(OBJEXT) \ + $(libdir)/savedir.$(OBJEXT) \ + $(libdir)/strtoumax.$(OBJEXT) \ + $(libdir)/xmalloc.$(OBJEXT) \ + $(libdir)/xstrtol.$(OBJEXT) \ + $(libdir)/xstrtoumax.$(OBJEXT) + +# Comment out functions already supported as needed. +#LIB_OBJ_atexit = $(libdir)/atexit.$(OBJEXT) +#LIB_OBJ_alloca = $(libdir)/alloca.$(OBJEXT) +#LIB_OBJ_fnmatch = $(libdir)/fnmatch.$(OBJEXT) +LIB_OBJ_getopt = $(libdir)/getopt.$(OBJEXT) $(libdir)/getopt1.$(OBJEXT) +#LIB_OBJ_memchr = $(libdir)/memchr.$(OBJEXT) +LIB_OBJ_obstack = $(libdir)/obstack.$(OBJEXT) +#LIB_OBJ_strtoul = $(libdir)/strtoul.$(OBJEXT) +LIB_OBJ_stpcpy = $(libdir)/stpcpy.$(OBJEXT) +LIB_OBJ_strtoull = $(libdir)/strtoull.$(OBJEXT) + +LIB_OBJS = $(LIB_OBJS_core) $(LIB_OBJ_atexit) $(LIB_OBJ_alloca) \ + $(LIB_OBJ_fnmatch) $(LIB_OBJ_getopt) $(LIB_OBJ_memchr) \ + $(LIB_OBJ_obstack) $(LIB_OBJ_strtoul) $(LIB_OBJ_stpcpy) \ + $(LIB_OBJ_strtoull) + +# For Linux +#LIB_OBJS = $(LIB_OBJS_core) + +# For QNX/Neutrino +#LIB_OBJS = $(LIB_OBJS_core) $(LIB_OBJ_getopt) $(LIB_OBJ_obstack) \ +# $(LIB_OBJ_stpcpy) $(LIB_OBJ_strtoull) + +# Where is DIR and opendir/readdir defined. +# or -DHAVE_DIRENT_H +# or -DHAVE_SYS_NDIR_H +# or -DHAVE_SYS_DIR_H +# or -DHAVE_NDIR_H +# +# undef HAVE_STRERROR if lacking strerror() +# undef HAVE_MEMCHR if lacking memchr() +# + +# default dry run +DEFS_core = \ + -DSTDC_HEADERS \ + -DHAVE_MEMCHR \ + -DHAVE_DIRENT_H \ + -DHAVE_STRERROR \ + -Dconst= \ + -Dsize_t=unsigned \ + -Duintmax_t=long + +# SunOS-4.1.x k&r cc +#DEFS_sunos = -DSTDC_HEADERS -DHAVE_MEMCHR -DHAVE_DIRENT_H -Dconst= + +# Solaris +#DEFS_solaris = -DSTDC_HEADERS -DHAVE_MEMCHR -DHAVE_DIRENT_H -DHAVE_STRERROR + +# DOS/WIN (change also OBJEXT/EXEEXT, see above) +# DOS/DJGPP +DEFS_dos = -DSTDC_HEADERS -DHAVE_MEMCHR -DHAVE_STRERROR -DHAVE_DIRENT_H \ + -DHAVE_DOS_FILE_CONTENTS \ + -DHAVE_DOS_FILE_NAMES -DHAVE_UNISTD_H -DHAVE_SETMODE + +# If support ANSI C prototypes +DEFS_ansi_c = -DPROTOTYPES + +# No wchar support +# DEFS_wchar = -DUSE_WIDE_CHAR -DHAVE_WCHAR_H +DEFS_wchar = -Dwchar_t=int -Dmbstate_t=int + +# Is strtol() and strtoul() declarared ? +#DEFS_strtol = -DHAVE_DECL_STRTOULL=0 -DHAVE_DECL_STRTOUL=0 +DEFS_strtol = -DHAVE_DECL_STRTOULL=1 -DHAVE_DECL_STRTOUL=1 + +# Define if malloc(0)/realloc(0) works +#DEFS_alloc = -DHAVE_DONE_WORKING_MALLOC_CHECK=0 \ +# -DHAVE_DONE_WORKING_REALLOC_CHECK=0 +DEFS_alloc = -DHAVE_DONE_WORKING_MALLOC_CHECK=1 \ + -DHAVE_DONE_WORKING_REALLOC_CHECK=1 + +DEFS = $(DEFS_core) $(DEFS_ansi_c) $(DEFS_wchar) $(DEFS_strtol) $(DEFS_alloc) \ + -DHAVE_DECL_STRERROR_R=0 -DHAVE_VPRINTF -DCHAR_BIT=8 + + +#### + +CFLAGS = $(DEFS) -I. -I.. -I$(libdir) -DVERSION=\"bootstrap\" -DPACKAGE=\"grep\" + +libdir = ../lib + +PROGS = grep$(EXEEXT) egrep$(EXEEXT) fgrep$(EXEEXT) + +libgreputils_a = $(libdir)/libgreputils.a + +all : $(libgreputils_a) $(PROGS) + +grep$(EXEEXT) : $(grep_OBJS) $(libgreputils_a) + $(CC) $(grep_OBJS) -o grep $(libgreputils_a) + +egrep$(EXEEXT) : $(egrep_OBJS) $(libgreputils_a) + $(CC) $(egrep_OBJS) -o egrep $(libgreputils_a) + +fgrep$(EXEEXT) : $(fgrep_OBJS) $(libgreputils_a) + $(CC) $(fgrep_OBJS) -o fgrep $(libgreputils_a) + +$(libgreputils_a) : $(LIB_OBJS) + $(AR) $(ARFLAGS) $(libgreputils_a) $(LIB_OBJS) + +clean : + $(RM) grep.$(OBJEXT) egrep.$(OBJEXT) fgrep.$(OBJEXT) + $(RM) search.$(OBJEXT) esearch.$(OBJEXT) fsearch.$(OBJEXT) + $(RM) kwset.$(OBJEXT) dfa.$(OBJEXT) + $(RM) $(PROGS) + $(RM) $(libgreputils_a) $(LIB_OBJS) diff --git a/bootstrap/README b/bootstrap/README new file mode 100644 index 0000000..cd7f402 --- /dev/null +++ b/bootstrap/README @@ -0,0 +1,8 @@ +# + +If your system is lacking the necessary tools to build the configuration, +Makefile.try is provided for bootstraping. Move Makefile.try to +../src/Makefile, edit the Makefile and type make. Good luck ! + +cp Makefile.try ../src/Makefile +make diff --git a/config.guess b/config.guess new file mode 100755 index 0000000..bceb4e6 --- /dev/null +++ b/config.guess @@ -0,0 +1,1506 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, +# Inc. + +timestamp='2006-07-02' + +# This file 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 of the License, 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., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Originally written by Per Bothner . +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit build system type. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +trap 'exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ; set_cc_for_build= ;' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. +if ls /lib/ld-uClibc*.so &>/dev/null; then + LINSUFFIX="-uclibc" +else + LINSUFFIX="-gnu" +fi + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + exit ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit ;; + *:SolidBSD:*:*) + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} + exit ;; + macppc:MirBSD:*:*) + echo powerpc-unknown-mirbsd${UNAME_RELEASE} + exit ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + exit ;; + alpha:OSF1:*:*) + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE="alpha" ;; + "EV4.5 (21064)") + UNAME_MACHINE="alpha" ;; + "LCA4 (21066/21068)") + UNAME_MACHINE="alpha" ;; + "EV5 (21164)") + UNAME_MACHINE="alphaev5" ;; + "EV5.6 (21164A)") + UNAME_MACHINE="alphaev56" ;; + "EV5.6 (21164PC)") + UNAME_MACHINE="alphapca56" ;; + "EV5.7 (21164PC)") + UNAME_MACHINE="alphapca57" ;; + "EV6 (21264)") + UNAME_MACHINE="alphaev6" ;; + "EV6.7 (21264A)") + UNAME_MACHINE="alphaev67" ;; + "EV6.8CB (21264C)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8AL (21264B)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8CX (21264D)") + UNAME_MACHINE="alphaev68" ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE="alphaev69" ;; + "EV7 (21364)") + UNAME_MACHINE="alphaev7" ;; + "EV7.9 (21364A)") + UNAME_MACHINE="alphaev79" ;; + esac + # A Pn.n version is a patched version. + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit ;; + arm:riscos:*:*|arm:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7; exit ;; + esac ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + i86pc:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && + dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`$dummy $dummyarg` && + { echo "$SYSTEM_NAME"; exit; } + echo mips-mips-riscos${UNAME_RELEASE} + exit ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit ;; + *:AIX:*:[45]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if [ ${HP_ARCH} = "hppa2.0w" ] + then + eval $set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + grep __LP64__ >/dev/null + then + HP_ARCH="hppa2.0w" + else + HP_ARCH="hppa64" + fi + fi + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + echo unknown-hitachi-hiuxwe2 + exit ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + *:UNICOS/mp:*:*) + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:FreeBSD:*:*) + case ${UNAME_MACHINE} in + pc98) + echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + amd64) + echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + esac + exit ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit ;; + i*:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit ;; + i*:windows32*:*) + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 + exit ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit ;; + x86:Interix*:[3456]*) + echo i586-pc-interix${UNAME_RELEASE} + exit ;; + EM64T:Interix*:[3456]*) + echo x86_64-unknown-interix${UNAME_RELEASE} + exit ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i586-pc-interix + exit ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + *:GNU:*:*) + # the GNU system + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + exit ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit ;; + arm*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux$LINSUFFIX + exit ;; + avr32*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux$LINSUFFIX + exit ;; + cris:Linux:*:*) + echo cris-axis-linux$LINSUFFIX + exit ;; + crisv32:Linux:*:*) + echo crisv32-axis-linux$LINSUFFIX + exit ;; + frv:Linux:*:*) + echo frv-unknown-linux$LINSUFFIX + exit ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux$LINSUFFIX + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux$LINSUFFIX + exit ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux$LINSUFFIX + exit ;; + mips:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips + #undef mipsel + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mipsel + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips + #else + CPU= + #endif + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^CPU/{ + s: ::g + p + }'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux$LINSUFFIX"; exit; } + ;; + mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips64 + #undef mips64el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mips64el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips64 + #else + CPU= + #endif + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^CPU/{ + s: ::g + p + }'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + or32:Linux:*:*) + echo or32-unknown-linux-gnu + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux$LINSUFFIX + exit ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux$LINSUFFIX + exit ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + if test "$?" = 0 ; then LIBC="-gnulibc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux$LINSUFFIX + exit ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux$LINSUFFIX ;; + PA8*) echo hppa2.0-unknown-linux$LINSUFFIX ;; + *) echo hppa-unknown-linux$LINSUFFIX ;; + esac + exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux$LINSUFFIX + exit ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux$LINSUFFIX + exit ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux$LINSUFFIX + exit ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux$LINSUFFIX + exit ;; + vax:Linux:*:*) + echo ${UNAME_MACHINE}-dec-linux$LINSUFFIX + exit ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux$LINSUFFIX + exit ;; + i*86:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + # Set LC_ALL=C to ensure ld outputs messages in English. + ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ + | sed -ne '/supported targets:/!d + s/[ ][ ]*/ /g + s/.*supported targets: *// + s/ .*// + p'` + case "$ld_supported_targets" in + elf32-i386) + TENTATIVE="${UNAME_MACHINE}-pc-linux$LINSUFFIX" + ;; + a.out-i386-linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit ;; + coff-i386) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit ;; + "") + # Either a pre-BFD a.out linker (linux-gnuoldld) or + # one that does not give us useful --help. + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + exit ;; + esac + # Determine whether the default compiler is a.out or elf + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + #ifdef __ELF__ + # ifdef __GLIBC__ + # if __GLIBC__ >= 2 + LIBC=gnu + # else + LIBC=gnulibc1 + # endif + # else + LIBC=gnulibc1 + # endif + #else + #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) + LIBC=gnu + #else + LIBC=gnuaout + #endif + #endif + #ifdef __dietlibc__ + LIBC=dietlibc + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^LIBC/{ + s: ::g + p + }'`" + if test "$LINSUFFIX" = "-uclibc"; then LIBC=uclibc; fi + test x"${LIBC}" != x && { + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + exit + } + test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo ${UNAME_MACHINE}-stratus-vos + exit ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + case $UNAME_PROCESSOR in + unknown) UNAME_PROCESSOR=powerpc ;; + esac + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit ;; + NSE-?:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit ;; + NSR-?:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + exit ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + exit ;; + i*86:rdos:*:*) + echo ${UNAME_MACHINE}-pc-rdos + exit ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix\n"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + c34*) + echo c34-convex-bsd + exit ;; + c38*) + echo c38-convex-bsd + exit ;; + c4*) + echo c4-convex-bsd + exit ;; + esac +fi + +cat >&2 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/config.hin b/config.hin new file mode 100644 index 0000000..c756502 --- /dev/null +++ b/config.hin @@ -0,0 +1,358 @@ +/* config.hin. Generated from configure.ac by autoheader. */ + +/* Define to 1 if the `closedir' function returns void instead of `int'. */ +#undef CLOSEDIR_VOID + +/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP + systems. This function is required for `alloca.c' support on those systems. + */ +#undef CRAY_STACKSEG_END + +/* Define to 1 if using `alloca.c'. */ +#undef C_ALLOCA + +/* Define to 1 if translation of program messages to the user's native + language is requested. */ +#undef ENABLE_NLS + +/* We are building grep */ +#undef GREP + +/* Define to 1 if you have `alloca', as a function or macro. */ +#undef HAVE_ALLOCA + +/* Define to 1 if you have and it should be used (not on Ultrix). + */ +#undef HAVE_ALLOCA_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_ARGZ_H + +/* Define to 1 if you have the `atexit' function. */ +#undef HAVE_ATEXIT + +/* Define to 1 if you have the `btowc' function. */ +#undef HAVE_BTOWC + +/* Define to 1 if you have the `dcgettext' function. */ +#undef HAVE_DCGETTEXT + +/* Define to 1 if you have the declaration of `strerror_r', and to 0 if you + don't. */ +#undef HAVE_DECL_STRERROR_R + +/* Define if declares strtoul. */ +#undef HAVE_DECL_STRTOUL + +/* Define if declares strtoull. */ +#undef HAVE_DECL_STRTOULL + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#undef HAVE_DIRENT_H + +/* Define if the malloc check has been performed. */ +#undef HAVE_DONE_WORKING_MALLOC_CHECK + +/* Define if the realloc check has been performed. */ +#undef HAVE_DONE_WORKING_REALLOC_CHECK + +/* Define to 1 if you have the `doprnt' function. */ +#undef HAVE_DOPRNT + +/* Define if text file lines end in CRLF. */ +#undef HAVE_DOS_FILE_CONTENTS + +/* Define if your OS uses backslashes as directory separators */ +#undef HAVE_DOS_FILE_NAMES + +/* Define to 1 if you have the `feof_unlocked' function. */ +#undef HAVE_FEOF_UNLOCKED + +/* Define to 1 if you have the `fgets_unlocked' function. */ +#undef HAVE_FGETS_UNLOCKED + +/* Define to 1 if you have the `fnmatch' function. */ +#undef HAVE_FNMATCH + +/* Define to 1 if you have the `getcwd' function. */ +#undef HAVE_GETCWD + +/* Define to 1 if you have the `getegid' function. */ +#undef HAVE_GETEGID + +/* Define to 1 if you have the `geteuid' function. */ +#undef HAVE_GETEUID + +/* Define to 1 if you have the `getgid' function. */ +#undef HAVE_GETGID + +/* Define to 1 if you have the `getpagesize' function. */ +#undef HAVE_GETPAGESIZE + +/* Define if the GNU gettext() function is already present or preinstalled. */ +#undef HAVE_GETTEXT + +/* Define to 1 if you have the `getuid' function. */ +#undef HAVE_GETUID + +/* Define if you have the iconv() function. */ +#undef HAVE_ICONV + +/* Define if exists, doesn't clash with , and + declares uintmax_t. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the `isascii' function. */ +#undef HAVE_ISASCII + +/* Define to 1 if you have the `iswctype' function. */ +#undef HAVE_ISWCTYPE + +/* Define if you have and nl_langinfo(CODESET). */ +#undef HAVE_LANGINFO_CODESET + +/* Define if your file defines LC_MESSAGES. */ +#undef HAVE_LC_MESSAGES + +/* Define to 1 if you have the header file. */ +#undef HAVE_LIBINTL_H + +/* Define to 1 if you have the `pcre' library (-lpcre). */ +#undef HAVE_LIBPCRE + +/* Define to 1 if you have the header file. */ +#undef HAVE_LIMITS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LOCALE_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_MALLOC_H + +/* Define to 1 if you have the `mbrlen' function. */ +#undef HAVE_MBRLEN + +/* Define to 1 if mbrtowc and mbstate_t are properly declared. */ +#undef HAVE_MBRTOWC + +/* Define to 1 if you have the `memchr' function. */ +#undef HAVE_MEMCHR + +/* Define to 1 if you have the `memmove' function. */ +#undef HAVE_MEMMOVE + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the `mempcpy' function. */ +#undef HAVE_MEMPCPY + +/* Define to 1 if you have a working `mmap' system call. */ +#undef HAVE_MMAP + +/* Define to 1 if you have the `munmap' function. */ +#undef HAVE_MUNMAP + +/* Define to 1 if you have the header file, and it defines `DIR'. */ +#undef HAVE_NDIR_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NL_TYPES_H + +/* Define to 1 if you have the `putenv' function. */ +#undef HAVE_PUTENV + +/* Define to 1 if you have the `setenv' function. */ +#undef HAVE_SETENV + +/* Define to 1 if you have the `setlocale' function. */ +#undef HAVE_SETLOCALE + +/* Define to 1 if you have the `setmode' function. */ +#undef HAVE_SETMODE + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDDEF_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the `stpcpy' function. */ +#undef HAVE_STPCPY + +/* Define to 1 if you have the `strcasecmp' function. */ +#undef HAVE_STRCASECMP + +/* Define to 1 if you have the `strchr' function. */ +#undef HAVE_STRCHR + +/* Define to 1 if you have the `strdup' function. */ +#undef HAVE_STRDUP + +/* Define to 1 if you have the `strerror' function. */ +#undef HAVE_STRERROR + +/* Define to 1 if you have the `strerror_r' function. */ +#undef HAVE_STRERROR_R + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the `strtoul' function. */ +#undef HAVE_STRTOUL + +/* Define to 1 if you have the `strtoull' function. */ +#undef HAVE_STRTOULL + +/* Define to 1 if you have the `strtoumax' function. */ +#undef HAVE_STRTOUMAX + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#undef HAVE_SYS_DIR_H + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#undef HAVE_SYS_NDIR_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_PARAM_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the `tsearch' function. */ +#undef HAVE_TSEARCH + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define if you have the unsigned long long type. */ +#undef HAVE_UNSIGNED_LONG_LONG + +/* Define to 1 if you have the `vprintf' function. */ +#undef HAVE_VPRINTF + +/* Define to 1 if you have the header file. */ +#undef HAVE_WCHAR_H + +/* Define to 1 if you have the `wcrtomb' function. */ +#undef HAVE_WCRTOMB + +/* Define to 1 if you have the `wcscoll' function. */ +#undef HAVE_WCSCOLL + +/* Define to 1 if you have the `wctype' function. */ +#undef HAVE_WCTYPE + +/* Define to 1 if you have the header file. */ +#undef HAVE_WCTYPE_H + +/* Define to 1 if you have the `__argz_count' function. */ +#undef HAVE___ARGZ_COUNT + +/* Define to 1 if you have the `__argz_next' function. */ +#undef HAVE___ARGZ_NEXT + +/* Define to 1 if you have the `__argz_stringify' function. */ +#undef HAVE___ARGZ_STRINGIFY + +/* Define as const if the declaration of iconv() needs const. */ +#undef ICONV_CONST + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if the C compiler supports function prototypes. */ +#undef PROTOTYPES + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at runtime. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +#undef STACK_DIRECTION + +/* Define to 1 if the `S_IS*' macros in do not work properly. */ +#undef STAT_MACROS_BROKEN + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define to 1 if strerror_r returns char *. */ +#undef STRERROR_R_CHAR_P + +/* Version number of package */ +#undef VERSION + +/* Number of bits in a file offset, on hosts where this is settable. */ +#undef _FILE_OFFSET_BITS + +/* Define to make fseeko etc. visible, on some hosts. */ +#undef _LARGEFILE_SOURCE + +/* Define for large files, on AIX-style hosts. */ +#undef _LARGE_FILES + +/* Define like PROTOTYPES; this can be used by system headers. */ +#undef __PROTOTYPES + +/* Define if your compiler is broken */ +#undef alloca + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +#undef inline +#endif + +/* Define to rpl_malloc if the replacement function should be used. */ +#undef malloc + +/* Define to a type if does not define. */ +#undef mbstate_t + +/* Define to `long int' if does not define. */ +#undef off_t + +/* Define to rpl_realloc if the replacement function should be used. */ +#undef realloc + +/* Define to `unsigned int' if does not define. */ +#undef size_t + +/* Define to `int' if does not define. */ +#undef ssize_t + +/* Define to unsigned long or unsigned long long if doesn't + define. */ +#undef uintmax_t diff --git a/config.sub b/config.sub new file mode 100755 index 0000000..1b2ad10 --- /dev/null +++ b/config.sub @@ -0,0 +1,1616 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, +# Inc. + +timestamp='2006-09-20' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file 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 of the License, 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., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit ;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ + uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ + storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis | -knuth | -cray) + os= + basic_machine=$1 + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco6) + os=-sco5v6 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ + | bfin \ + | c4x | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ + | maxq | mb | microblaze | mcore \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64vr | mips64vrel \ + | mips64orion | mips64orionel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | mt \ + | msp430 \ + | nios | nios2 \ + | ns16k | ns32k \ + | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | score \ + | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ + | spu | strongarm \ + | tahoe | thumb | tic4x | tic80 | tron \ + | v850 | v850e \ + | we32k \ + | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ + | z8k) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + ms1) + basic_machine=mt-unknown + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* | avr32-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ + | clipper-* | craynv-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ + | m32c-* | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | maxq-* | mcore-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | mt-* \ + | msp430-* \ + | nios-* | nios2-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ + | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tron-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ + | xstormy16-* | xtensa-* \ + | ymp-* \ + | z8k-*) + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + abacus) + basic_machine=abacus-unknown + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amd64) + basic_machine=x86_64-pc + ;; + amd64-*) + basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16c) + basic_machine=cr16c-unknown + os=-elf + ;; + crds | unos) + basic_machine=m68k-crds + ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + ms1-*) + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + openrisc | openrisc-*) + basic_machine=or32-unknown + ;; + os400) + basic_machine=powerpc-ibm + os=-os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pc98) + basic_machine=i386-pc + ;; + pc98-*) + basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2 | pentiumiii | pentium3) + basic_machine=i686-pc + ;; + pentium4) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rdos) + basic_machine=i386-pc + os=-rdos + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sde) + basic_machine=mipsisa32-sde + os=-elf + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tic55x | c55x*) + basic_machine=tic55x-unknown + os=-coff + ;; + tic6x | c6x*) + basic_machine=tic6x-unknown + os=-coff + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + xbox) + basic_machine=i686-pc + os=-mingw32 + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + mmix) + basic_machine=mmix-knuth + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + *-unknown | *-ark) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ + | -openbsd* | -solidbsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku* | -rdos* | -toppers*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto-qnx*) + ;; + -nto*) + os=`echo $os | sed -e 's|nto|nto-qnx|'` + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux-dietlibc) + os=-linux-dietlibc + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -os400*) + os=-os400 + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -syllable*) + os=-syllable + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -tpf*) + os=-tpf + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -aros*) + os=-aros + ;; + -kaos*) + os=-kaos + ;; + -zvmoe) + os=-zvmoe + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + score-*) + os=-elf + ;; + spu-*) + os=-elf + ;; + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + c4x-* | tic4x-*) + os=-coff + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-haiku) + os=-haiku + ;; + *-ibm) + os=-aix + ;; + *-knuth) + os=-mmixware + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -os400*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -tpf*) + vendor=ibm + ;; + -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/configure b/configure new file mode 100755 index 0000000..4b29473 --- /dev/null +++ b/configure @@ -0,0 +1,13119 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.60 for GNU grep 2.5.2. +# +# Report bugs to . +# +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + + +# PATH needs CR +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +as_nl=' +' +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + { (exit 1); exit 1; } +fi + +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# CDPATH. +$as_unset CDPATH + + +if test "x$CONFIG_SHELL" = x; then + if (eval ":") 2>/dev/null; then + as_have_required=yes +else + as_have_required=no +fi + + if test $as_have_required = yes && (eval ": +(as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test \$exitcode = 0) || { (exit 1); exit 1; } + +( + as_lineno_1=\$LINENO + as_lineno_2=\$LINENO + test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && + test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } +") 2> /dev/null; then + : +else + as_candidate_shells= + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /usr/bin/posix$PATH_SEPARATOR/bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + case $as_dir in + /*) + for as_base in sh bash ksh sh5; do + as_candidate_shells="$as_candidate_shells $as_dir/$as_base" + done;; + esac +done +IFS=$as_save_IFS + + + for as_shell in $as_candidate_shells $SHELL; do + # Try only shells that exist, to save several forks. + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { ("$as_shell") 2> /dev/null <<\_ASEOF +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + +: +_ASEOF +}; then + CONFIG_SHELL=$as_shell + as_have_required=yes + if { "$as_shell" 2> /dev/null <<\_ASEOF +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + +: +(as_func_return () { + (exit $1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = "$1" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test $exitcode = 0) || { (exit 1); exit 1; } + +( + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } + +_ASEOF +}; then + break +fi + +fi + + done + + if test "x$CONFIG_SHELL" != x; then + for as_var in BASH_ENV ENV + do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + done + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} +fi + + + if test $as_have_required = no; then + echo This script requires a shell more modern than all the + echo shells that I found on your system. Please install a + echo modern shell, or manually run the script under such a + echo shell if you do have one. + { (exit 1); exit 1; } +fi + + +fi + +fi + + + +(eval "as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test \$exitcode = 0") || { + echo No shell found that supports shell functions. + echo Please tell autoconf@gnu.org about your system, + echo including any error possibly output before this + echo message +} + + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, and appends + # trailing '-' during substitution so that $LINENO is not a special + # case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # scripts with optimization help from Paolo Bonzini. Blame Lee + # E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; +esac + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir +fi +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +# Find out whether ``test -x'' works. Don't use a zero-byte file, as +# systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + as_executable_p="test -x" +else + as_executable_p=: +fi +rm -f conf$$.file + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + + +exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Identity of this package. +PACKAGE_NAME='GNU grep' +PACKAGE_TARNAME='grep' +PACKAGE_VERSION='2.5.2' +PACKAGE_STRING='GNU grep 2.5.2' +PACKAGE_BUGREPORT='bug-grep@gnu.org' + +ac_unique_file="src/grep.c" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_SYS_STAT_H +# include +#endif +#if STDC_HEADERS +# include +# include +#else +# if HAVE_STDLIB_H +# include +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include +# endif +# include +#endif +#if HAVE_STRINGS_H +# include +#endif +#if HAVE_INTTYPES_H +# include +#endif +#if HAVE_STDINT_H +# include +#endif +#if HAVE_UNISTD_H +# include +#endif" + +ac_subst_vars='SHELL +PATH_SEPARATOR +PACKAGE_NAME +PACKAGE_TARNAME +PACKAGE_VERSION +PACKAGE_STRING +PACKAGE_BUGREPORT +exec_prefix +prefix +program_transform_name +bindir +sbindir +libexecdir +datarootdir +datadir +sysconfdir +sharedstatedir +localstatedir +includedir +oldincludedir +docdir +infodir +htmldir +dvidir +pdfdir +psdir +libdir +localedir +mandir +DEFS +ECHO_C +ECHO_N +ECHO_T +LIBS +build_alias +host_alias +target_alias +INSTALL_PROGRAM +INSTALL_SCRIPT +INSTALL_DATA +am__isrc +CYGPATH_W +PACKAGE +VERSION +ACLOCAL +AUTOCONF +AUTOMAKE +AUTOHEADER +MAKEINFO +install_sh +STRIP +INSTALL_STRIP_PROGRAM +mkdir_p +AWK +SET_MAKE +am__leading_dot +AMTAR +am__tar +am__untar +build +build_cpu +build_vendor +build_os +host +host_cpu +host_vendor +host_os +CC +CFLAGS +LDFLAGS +CPPFLAGS +ac_ct_CC +EXEEXT +OBJEXT +DEPDIR +am__include +am__quote +AMDEP_TRUE +AMDEP_FALSE +AMDEPBACKSLASH +CCDEPMODE +am__fastdepCC_TRUE +am__fastdepCC_FALSE +RANLIB +GETCONF +CPP +GREP +EGREP +U +ANSI2KNR +ALLOCA +LIBOBJS +GLIBC21 +LIBICONV +USE_NLS +MSGFMT +GMSGFMT +XGETTEXT +INTLBISON +BUILD_INCLUDED_LIBINTL +USE_INCLUDED_LIBINTL +CATALOGS +CATOBJEXT +GMOFILES +INTLLIBS +INTLOBJS +POFILES +POSUB +DATADIRNAME +INSTOBJEXT +GENCAT +MKINSTALLDIRS +INTL_LIBTOOL_SUFFIX_PREFIX +SEP +LTLIBOBJS' +ac_subst_files='' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +CPPFLAGS +CPP' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval $ac_prev=\$ac_option + ac_prev= + continue + fi + + case $ac_option in + *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *) ac_optarg=yes ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + eval enable_$ac_feature=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + eval enable_$ac_feature=\$ac_optarg ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval with_$ac_package=\$ac_optarg ;; + + -without-* | --without-*) + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/-/_/g'` + eval with_$ac_package=no ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +# Be sure to have absolute directory names. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir +do + eval ac_val=\$$ac_var + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; } +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + { echo "$as_me: error: Working directory cannot be determined" >&2 + { (exit 1); exit 1; }; } +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + { echo "$as_me: error: pwd does not report name of working directory" >&2 + { (exit 1); exit 1; }; } + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$0" || +$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +echo X"$0" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r "$srcdir/$ac_unique_file"; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 + { (exit 1); exit 1; }; } + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures GNU grep 2.5.2 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/grep] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of GNU grep 2.5.2:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --disable-perl-regexp disable perl-regexp + --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors + --disable-largefile omit support for large files + --disable-nls do not use Native Language Support + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib + --with-included-gettext use the GNU gettext library included here + --without-included-regex don't compile regex; this is the default on + systems with version 2 of the GNU C library + (use with caution on other system) + --with-included-getopt Use the included getopt rather than glibc's + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to . +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +GNU grep configure 2.5.2 +generated by GNU Autoconf 2.60 + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by GNU grep $as_me 2.5.2, which was +generated by GNU Autoconf 2.60. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + echo "PATH: $as_dir" +done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 2) + ac_configure_args1="$ac_configure_args1 '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + ac_configure_args="$ac_configure_args '$ac_arg'" + ;; + esac + done +done +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + cat <<\_ASBOX +## ---------------- ## +## Cache variables. ## +## ---------------- ## +_ASBOX + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 +echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + *) $as_unset $ac_var ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + cat <<\_ASBOX +## ----------------- ## +## Output variables. ## +## ----------------- ## +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +## ------------------- ## +## File substitutions. ## +## ------------------- ## +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" + echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer explicitly selected file to automatically selected ones. +if test -n "$CONFIG_SITE"; then + set x "$CONFIG_SITE" +elif test "x$prefix" != xNONE; then + set x "$prefix/share/config.site" "$prefix/etc/config.site" +else + set x "$ac_default_prefix/share/config.site" \ + "$ac_default_prefix/etc/config.site" +fi +shift +for ac_site_file +do + if test -r "$ac_site_file"; then + { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:$LINENO: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } +fi + + + + + + + + + + + + + + + + + + + + + + + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + +cat >>confdefs.h <<\_ACEOF +#define GREP 1 +_ACEOF + + + +am__api_version='1.10' + +ac_aux_dir= +for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do + if test -f "$ac_dir/install-sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f "$ac_dir/install.sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 +echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} + { (exit 1); exit 1; }; } +fi + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; } +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; }; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + done + done + ;; +esac +done +IFS=$as_save_IFS + + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6; } + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +{ echo "$as_me:$LINENO: checking whether build environment is sane" >&5 +echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6; } +# Just in case +sleep 1 +echo timestamp > conftest.file +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&5 +echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&2;} + { (exit 1); exit 1; }; } + fi + + test "$2" = conftest.file + ) +then + # Ok. + : +else + { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! +Check your system clock" >&5 +echo "$as_me: error: newly created file is older than distributed files! +Check your system clock" >&2;} + { (exit 1); exit 1; }; } +fi +{ echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } +test "$program_prefix" != NONE && + program_transform_name="s&^&$program_prefix&;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s&\$&$program_suffix&;$program_transform_name" +# Double any \ or $. echo might interpret backslashes. +# By default was `s,x,x', remove it if useless. +cat <<\_ACEOF >conftest.sed +s/[\\$]/&&/g;s/;s,x,x,$// +_ACEOF +program_transform_name=`echo $program_transform_name | sed -f conftest.sed` +rm -f conftest.sed + +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` + +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + am_backtick='`' + { echo "$as_me:$LINENO: WARNING: ${am_backtick}missing' script is too old or missing" >&5 +echo "$as_me: WARNING: ${am_backtick}missing' script is too old or missing" >&2;} +fi + +{ echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5 +echo $ECHO_N "checking for a thread-safe mkdir -p... $ECHO_C" >&6; } +if test -z "$MKDIR_P"; then + if test "${ac_cv_path_mkdir+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in mkdir gmkdir; do + for ac_exec_ext in '' $ac_executable_extensions; do + { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; } || continue + case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir (GNU coreutils) '* | \ + 'mkdir (coreutils) '* | \ + 'mkdir (fileutils) '4.1*) + ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext + break 3;; + esac + done + done +done +IFS=$as_save_IFS + +fi + + if test "${ac_cv_path_mkdir+set}" = set; then + MKDIR_P="$ac_cv_path_mkdir -p" + else + # As a last resort, use the slow shell script. Don't cache a + # value for MKDIR_P within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + test -d ./--version && rmdir ./--version + MKDIR_P="$ac_install_sh -d" + fi +fi +{ echo "$as_me:$LINENO: result: $MKDIR_P" >&5 +echo "${ECHO_T}$MKDIR_P" >&6; } + +mkdir_p="$MKDIR_P" +case $mkdir_p in + [\\/$]* | ?:[\\/]*) ;; + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; +esac + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_AWK+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AWK="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + { echo "$as_me:$LINENO: result: $AWK" >&5 +echo "${ECHO_T}$AWK" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$AWK" && break +done + +{ echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6; } +set x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + SET_MAKE= +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + +rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null + +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + am__isrc=' -I$(srcdir)' + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 +echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} + { (exit 1); exit 1; }; } + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi + + +# Define the identity of the package. + PACKAGE='grep' + VERSION='2.5.2' + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE "$PACKAGE" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define VERSION "$VERSION" +_ACEOF + +# Some tools Automake needs. + +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} + + +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} + + +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} + + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} + + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + +install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"} + +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { echo "$as_me:$LINENO: result: $STRIP" >&5 +echo "${ECHO_T}$STRIP" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_STRIP="strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 +echo "${ECHO_T}$ac_ct_STRIP" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" + +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +# Always define AMTAR for backward compatibility. + +AMTAR=${AMTAR-"${am_missing_run}tar"} + +am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' + + + + + + + + + ac_config_headers="$ac_config_headers config.h:config.hin" + + +# Check whether --enable-perl-regexp was given. +if test "${enable_perl_regexp+set}" = set; then + enableval=$enable_perl_regexp; case "${enableval}" in + yes) testpcre=yes ;; + no) testpcre=no ;; + *) { { echo "$as_me:$LINENO: error: bad value ${enableval} for --disable-perl-regexp" >&5 +echo "$as_me: error: bad value ${enableval} for --disable-perl-regexp" >&2;} + { (exit 1); exit 1; }; } ;; + esac +else + testpcre=yes +fi + + +# Make sure we can run config.sub. +$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || + { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5 +echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;} + { (exit 1); exit 1; }; } + +{ echo "$as_me:$LINENO: checking build system type" >&5 +echo $ECHO_N "checking build system type... $ECHO_C" >&6; } +if test "${ac_cv_build+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` +test "x$ac_build_alias" = x && + { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 +echo "$as_me: error: cannot guess build type; you must specify one" >&2;} + { (exit 1); exit 1; }; } +ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || + { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5 +echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_build" >&5 +echo "${ECHO_T}$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5 +echo "$as_me: error: invalid value of canonical build" >&2;} + { (exit 1); exit 1; }; };; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac + + +{ echo "$as_me:$LINENO: checking host system type" >&5 +echo $ECHO_N "checking host system type... $ECHO_C" >&6; } +if test "${ac_cv_host+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || + { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5 +echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;} + { (exit 1); exit 1; }; } +fi + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_host" >&5 +echo "${ECHO_T}$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5 +echo "$as_me: error: invalid value of canonical host" >&2;} + { (exit 1); exit 1; }; };; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_AWK+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AWK="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + { echo "$as_me:$LINENO: result: $AWK" >&5 +echo "${ECHO_T}$AWK" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$AWK" && break +done + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO: checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (ac_try="$ac_compiler --version >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler --version >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -v >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -v >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -V >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -V >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 +echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; } +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +# +# List of possible output files, starting from the most likely. +# The algorithm is not robust to junk in `.', hence go to wildcards (a.*) +# only as a last resort. b.out is created by i960 compilers. +ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' +# +# The IRIX 6 linker writes into existing files which may not be +# executable, retaining their permissions. Remove them first so a +# subsequent execution test works. +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { (ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables +See \`config.log' for more details." >&5 +echo "$as_me: error: C compiler cannot create executables +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext +{ echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6; } + +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; } +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +{ echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +rm -f a.out a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; } +{ echo "$as_me:$LINENO: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6; } + +{ echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; } +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +{ echo "$as_me:$LINENO: checking for suffix of object files" >&5 +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; } +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_compiler_gnu=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; } +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; } +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + CFLAGS="" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 +echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } +if test "${ac_cv_prog_cc_c89+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_c89=$ac_arg +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6; } ;; + xno) + { echo "$as_me:$LINENO: result: unsupported" >&5 +echo "${ECHO_T}unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; +esac + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +DEPDIR="${am__leading_dot}deps" + +ac_config_commands="$ac_config_commands depfiles" + + +am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo done +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +{ echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 +echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6; } +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi + + +{ echo "$as_me:$LINENO: result: $_am_result" >&5 +echo "${ECHO_T}$_am_result" >&6; } +rm -f confinc confmf + +# Check whether --enable-dependency-tracking was given. +if test "${enable_dependency_tracking+set}" = set; then + enableval=$enable_dependency_tracking; +fi + +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi + if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + + +depcc="$CC" am_compiler_list= + +{ echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 +echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; } +if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +{ echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 +echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6; } +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; } +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; }; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + done + done + ;; +esac +done +IFS=$as_save_IFS + + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6; } + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { echo "$as_me:$LINENO: result: $RANLIB" >&5 +echo "${ECHO_T}$RANLIB" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + { echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 +echo "${ECHO_T}$ac_ct_RANLIB" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + RANLIB=$ac_ct_RANLIB + fi +else + RANLIB="$ac_cv_prog_RANLIB" +fi + + + + + # Check whether --enable-largefile was given. +if test "${enable_largefile+set}" = set; then + enableval=$enable_largefile; +fi + + if test "$enable_largefile" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}getconf", so it can be a program name with args. +set dummy ${ac_tool_prefix}getconf; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_GETCONF+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$GETCONF"; then + ac_cv_prog_GETCONF="$GETCONF" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_GETCONF="${ac_tool_prefix}getconf" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +GETCONF=$ac_cv_prog_GETCONF +if test -n "$GETCONF"; then + { echo "$as_me:$LINENO: result: $GETCONF" >&5 +echo "${ECHO_T}$GETCONF" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_GETCONF"; then + ac_ct_GETCONF=$GETCONF + # Extract the first word of "getconf", so it can be a program name with args. +set dummy getconf; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_GETCONF+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_GETCONF"; then + ac_cv_prog_ac_ct_GETCONF="$ac_ct_GETCONF" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_GETCONF="getconf" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_GETCONF=$ac_cv_prog_ac_ct_GETCONF +if test -n "$ac_ct_GETCONF"; then + { echo "$as_me:$LINENO: result: $ac_ct_GETCONF" >&5 +echo "${ECHO_T}$ac_ct_GETCONF" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_GETCONF" = x; then + GETCONF="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + GETCONF=$ac_ct_GETCONF + fi +else + GETCONF="$ac_cv_prog_GETCONF" +fi + + { echo "$as_me:$LINENO: checking for CFLAGS value to request large file support" >&5 +echo $ECHO_N "checking for CFLAGS value to request large file support... $ECHO_C" >&6; } +if test "${ac_cv_sys_largefile_CFLAGS+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if ($GETCONF LFS_CFLAGS) >conftest.1 2>conftest.2 && test ! -s conftest.2 + then + ac_cv_sys_largefile_CFLAGS=`cat conftest.1` + else + ac_cv_sys_largefile_CFLAGS=no + case "$host_os" in + # HP-UX 10.20 requires -D__STDC_EXT__ with gcc 2.95.1. + hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*) + if test "$GCC" = yes; then + ac_cv_sys_largefile_CFLAGS=-D__STDC_EXT__ + fi + ;; + # IRIX 6.2 and later require cc -n32. + irix6.[2-9]* | irix6.1[0-9]* | irix[7-9].* | irix[1-9][0-9]*) + if test "$GCC" != yes; then + ac_cv_sys_largefile_CFLAGS=-n32 + fi + esac + if test "$ac_cv_sys_largefile_CFLAGS" != no; then + ac_save_CC="$CC" + CC="$CC $ac_cv_sys_largefile_CFLAGS" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_sys_largefile_CFLAGS=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + CC="$ac_save_CC" + fi + fi + rm -f conftest* +fi +{ echo "$as_me:$LINENO: result: $ac_cv_sys_largefile_CFLAGS" >&5 +echo "${ECHO_T}$ac_cv_sys_largefile_CFLAGS" >&6; } + { echo "$as_me:$LINENO: checking for LDFLAGS value to request large file support" >&5 +echo $ECHO_N "checking for LDFLAGS value to request large file support... $ECHO_C" >&6; } +if test "${ac_cv_sys_largefile_LDFLAGS+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if ($GETCONF LFS_LDFLAGS) >conftest.1 2>conftest.2 && test ! -s conftest.2 + then + ac_cv_sys_largefile_LDFLAGS=`cat conftest.1` + else + ac_cv_sys_largefile_LDFLAGS=no + + fi + rm -f conftest* +fi +{ echo "$as_me:$LINENO: result: $ac_cv_sys_largefile_LDFLAGS" >&5 +echo "${ECHO_T}$ac_cv_sys_largefile_LDFLAGS" >&6; } + { echo "$as_me:$LINENO: checking for LIBS value to request large file support" >&5 +echo $ECHO_N "checking for LIBS value to request large file support... $ECHO_C" >&6; } +if test "${ac_cv_sys_largefile_LIBS+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if ($GETCONF LFS_LIBS) >conftest.1 2>conftest.2 && test ! -s conftest.2 + then + ac_cv_sys_largefile_LIBS=`cat conftest.1` + else + ac_cv_sys_largefile_LIBS=no + + fi + rm -f conftest* +fi +{ echo "$as_me:$LINENO: result: $ac_cv_sys_largefile_LIBS" >&5 +echo "${ECHO_T}$ac_cv_sys_largefile_LIBS" >&6; } + + for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do + case "$ac_flag" in + no) ;; + -D_FILE_OFFSET_BITS=*) ;; + -D_LARGEFILE_SOURCE | -D_LARGEFILE_SOURCE=*) ;; + -D_LARGE_FILES | -D_LARGE_FILES=*) ;; + -D?* | -I?*) + case "$ac_flag" in + no) ;; + ?*) + case "$CPPFLAGS" in + '') CPPFLAGS="$ac_flag" ;; + *) CPPFLAGS=$CPPFLAGS' '"$ac_flag" ;; + esac ;; + esac ;; + *) + case "$ac_flag" in + no) ;; + ?*) + case "$CFLAGS" in + '') CFLAGS="$ac_flag" ;; + *) CFLAGS=$CFLAGS' '"$ac_flag" ;; + esac ;; + esac ;; + esac + done + case "$ac_cv_sys_largefile_LDFLAGS" in + no) ;; + ?*) + case "$LDFLAGS" in + '') LDFLAGS="$ac_cv_sys_largefile_LDFLAGS" ;; + *) LDFLAGS=$LDFLAGS' '"$ac_cv_sys_largefile_LDFLAGS" ;; + esac ;; + esac + case "$ac_cv_sys_largefile_LIBS" in + no) ;; + ?*) + case "$LIBS" in + '') LIBS="$ac_cv_sys_largefile_LIBS" ;; + *) LIBS=$LIBS' '"$ac_cv_sys_largefile_LIBS" ;; + esac ;; + esac + { echo "$as_me:$LINENO: checking for _FILE_OFFSET_BITS" >&5 +echo $ECHO_N "checking for _FILE_OFFSET_BITS... $ECHO_C" >&6; } +if test "${ac_cv_sys_file_offset_bits+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_sys_file_offset_bits=no + case "$host_os" in + # HP-UX 10.20 and later + hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*) + ac_cv_sys_file_offset_bits=64 ;; + esac + for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do + case "$ac_flag" in + -D_FILE_OFFSET_BITS) + ac_cv_sys_file_offset_bits=1 ;; + -D_FILE_OFFSET_BITS=*) + ac_cv_sys_file_offset_bits=`expr " $ac_flag" : '[^=]*=\(.*\)'` ;; + esac + done + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_sys_file_offset_bits" >&5 +echo "${ECHO_T}$ac_cv_sys_file_offset_bits" >&6; } + if test "$ac_cv_sys_file_offset_bits" != no; then + +cat >>confdefs.h <<_ACEOF +#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits +_ACEOF + + fi + { echo "$as_me:$LINENO: checking for _LARGEFILE_SOURCE" >&5 +echo $ECHO_N "checking for _LARGEFILE_SOURCE... $ECHO_C" >&6; } +if test "${ac_cv_sys_largefile_source+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_sys_largefile_source=no + case "$host_os" in + # HP-UX 10.20 and later + hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*) + ac_cv_sys_largefile_source=1 ;; + esac + for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do + case "$ac_flag" in + -D_LARGEFILE_SOURCE) + ac_cv_sys_largefile_source=1 ;; + -D_LARGEFILE_SOURCE=*) + ac_cv_sys_largefile_source=`expr " $ac_flag" : '[^=]*=\(.*\)'` ;; + esac + done + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_sys_largefile_source" >&5 +echo "${ECHO_T}$ac_cv_sys_largefile_source" >&6; } + if test "$ac_cv_sys_largefile_source" != no; then + +cat >>confdefs.h <<_ACEOF +#define _LARGEFILE_SOURCE $ac_cv_sys_largefile_source +_ACEOF + + fi + { echo "$as_me:$LINENO: checking for _LARGE_FILES" >&5 +echo $ECHO_N "checking for _LARGE_FILES... $ECHO_C" >&6; } +if test "${ac_cv_sys_large_files+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_sys_large_files=no + case "$host_os" in + # AIX 4.2 and later + aix4.[2-9]* | aix4.1[0-9]* | aix[5-9].* | aix[1-9][0-9]*) + ac_cv_sys_large_files=1 ;; + esac + for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do + case "$ac_flag" in + -D_LARGE_FILES) + ac_cv_sys_large_files=1 ;; + -D_LARGE_FILES=*) + ac_cv_sys_large_files=`expr " $ac_flag" : '[^=]*=\(.*\)'` ;; + esac + done + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_sys_large_files" >&5 +echo "${ECHO_T}$ac_cv_sys_large_files" >&6; } + if test "$ac_cv_sys_large_files" != no; then + +cat >>confdefs.h <<_ACEOF +#define _LARGE_FILES $ac_cv_sys_large_files +_ACEOF + + fi + fi + +{ echo "$as_me:$LINENO: checking for function prototypes" >&5 +echo $ECHO_N "checking for function prototypes... $ECHO_C" >&6; } +if test "$ac_cv_prog_cc_c89" != no; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +cat >>confdefs.h <<\_ACEOF +#define PROTOTYPES 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define __PROTOTYPES 1 +_ACEOF + +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi + +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi + +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi + +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi + +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 +echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; } +if test "${ac_cv_path_GREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Extract the first word of "grep ggrep" to use in msg output +if test -z "$GREP"; then +set dummy grep ggrep; ac_prog_name=$2 +if test "${ac_cv_path_GREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_path_GREP_found=false +# Loop through the user's path and test for each of PROGNAME-LIST +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_GREP" && $as_executable_p "$ac_path_GREP"; } || continue + # Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + ac_count=`expr $ac_count + 1` + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + + $ac_path_GREP_found && break 3 + done +done + +done +IFS=$as_save_IFS + + +fi + +GREP="$ac_cv_path_GREP" +if test -z "$GREP"; then + { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } +fi + +else + ac_cv_path_GREP=$GREP +fi + + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 +echo "${ECHO_T}$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6; } +if test "${ac_cv_path_EGREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + # Extract the first word of "egrep" to use in msg output +if test -z "$EGREP"; then +set dummy egrep; ac_prog_name=$2 +if test "${ac_cv_path_EGREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_path_EGREP_found=false +# Loop through the user's path and test for each of PROGNAME-LIST +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_EGREP" && $as_executable_p "$ac_path_EGREP"; } || continue + # Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + ac_count=`expr $ac_count + 1` + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + + $ac_path_EGREP_found && break 3 + done +done + +done +IFS=$as_save_IFS + + +fi + +EGREP="$ac_cv_path_EGREP" +if test -z "$EGREP"; then + { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } +fi + +else + ac_cv_path_EGREP=$EGREP +fi + + + fi +fi +{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 +echo "${ECHO_T}$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_header_stdc=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + +fi +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. + + + + + + + + + +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_Header=no" +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + +if test "$ac_cv_prog_cc_stdc" != no; then + U= ANSI2KNR= +else + U=_ ANSI2KNR=./ansi2knr +fi +# Ensure some checks needed by ansi2knr itself. + + +for ac_header in string.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } + +# Is the header present? +{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## ------------------------------- ## +## Report this to bug-grep@gnu.org ## +## ------------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +{ echo "$as_me:$LINENO: checking for size_t" >&5 +echo $ECHO_N "checking for size_t... $ECHO_C" >&6; } +if test "${ac_cv_type_size_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +typedef size_t ac__type_new_; +int +main () +{ +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_size_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_size_t=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 +echo "${ECHO_T}$ac_cv_type_size_t" >&6; } +if test $ac_cv_type_size_t = yes; then + : +else + +cat >>confdefs.h <<_ACEOF +#define size_t unsigned int +_ACEOF + +fi + +{ echo "$as_me:$LINENO: checking for ssize_t" >&5 +echo $ECHO_N "checking for ssize_t... $ECHO_C" >&6; } +if test "${ac_cv_type_ssize_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +typedef ssize_t ac__type_new_; +int +main () +{ +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_ssize_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_ssize_t=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_ssize_t" >&5 +echo "${ECHO_T}$ac_cv_type_ssize_t" >&6; } +if test $ac_cv_type_ssize_t = yes; then + : +else + +cat >>confdefs.h <<_ACEOF +#define ssize_t int +_ACEOF + +fi + +{ echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 +echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6; } +if test "${ac_cv_c_const+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +/* FIXME: Include the comments suggested by Paul. */ +#ifndef __cplusplus + /* Ultrix mips cc rejects this. */ + typedef int charset[2]; + const charset x; + /* SunOS 4.1.1 cc rejects this. */ + char const *const *ccp; + char **p; + /* NEC SVR4.0.2 mips cc rejects this. */ + struct point {int x, y;}; + static struct point const zero = {0,0}; + /* AIX XL C 1.02.0.0 rejects this. + It does not let you subtract one const X* pointer from another in + an arm of an if-expression whose if-part is not a constant + expression */ + const char *g = "string"; + ccp = &g + (g ? g-g : 0); + /* HPUX 7.0 cc rejects these. */ + ++ccp; + p = (char**) ccp; + ccp = (char const *const *) p; + { /* SCO 3.2v4 cc rejects this. */ + char *t; + char const *s = 0 ? (char *) 0 : (char const *) 0; + + *t++ = 0; + if (s) return 0; + } + { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ + int x[] = {25, 17}; + const int *foo = &x[0]; + ++foo; + } + { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ + typedef const int *iptr; + iptr p = 0; + ++p; + } + { /* AIX XL C 1.02.0.0 rejects this saying + "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ + struct s { int j; const int *ap[3]; }; + struct s *b; b->j = 5; + } + { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; + if (!foo) return 0; + } + return !x[0] && !zero.x; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_const=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_c_const=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 +echo "${ECHO_T}$ac_cv_c_const" >&6; } +if test $ac_cv_c_const = no; then + +cat >>confdefs.h <<\_ACEOF +#define const +_ACEOF + +fi + + + { echo "$as_me:$LINENO: checking for inttypes.h" >&5 +echo $ECHO_N "checking for inttypes.h... $ECHO_C" >&6; } +if test "${jm_ac_cv_header_inttypes_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +int +main () +{ +uintmax_t i = (uintmax_t) -1; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + jm_ac_cv_header_inttypes_h=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + jm_ac_cv_header_inttypes_h=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $jm_ac_cv_header_inttypes_h" >&5 +echo "${ECHO_T}$jm_ac_cv_header_inttypes_h" >&6; } + if test $jm_ac_cv_header_inttypes_h = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_INTTYPES_H 1 +_ACEOF + + fi + + + { echo "$as_me:$LINENO: checking for unsigned long long" >&5 +echo $ECHO_N "checking for unsigned long long... $ECHO_C" >&6; } +if test "${ac_cv_type_unsigned_long_long+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +unsigned long long ull = 1; int i = 63; +int +main () +{ +unsigned long long ullmax = (unsigned long long) -1; + return ull << i | ull >> i | ullmax / ull | ullmax % ull; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_unsigned_long_long=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_unsigned_long_long=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_unsigned_long_long" >&5 +echo "${ECHO_T}$ac_cv_type_unsigned_long_long" >&6; } + if test $ac_cv_type_unsigned_long_long = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_UNSIGNED_LONG_LONG 1 +_ACEOF + + fi + + + + if test $jm_ac_cv_header_inttypes_h = no; then + + test $ac_cv_type_unsigned_long_long = yes \ + && ac_type='unsigned long long' \ + || ac_type='unsigned long' + +cat >>confdefs.h <<_ACEOF +#define uintmax_t $ac_type +_ACEOF + + fi + + +{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_header_stdc=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + +fi +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + + + + + + + +for ac_header in string.h stdlib.h sys/param.h memory.h unistd.h libintl.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } + +# Is the header present? +{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## ------------------------------- ## +## Report this to bug-grep@gnu.org ## +## ------------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + +for ac_header in wctype.h wchar.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } + +# Is the header present? +{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## ------------------------------- ## +## Report this to bug-grep@gnu.org ## +## ------------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + + + +ac_header_dirent=no +for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do + as_ac_Header=`echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_hdr that defines DIR" >&5 +echo $ECHO_N "checking for $ac_hdr that defines DIR... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include <$ac_hdr> + +int +main () +{ +if ((DIR *) 0) +return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_Header=no" +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_hdr" | $as_tr_cpp` 1 +_ACEOF + +ac_header_dirent=$ac_hdr; break +fi + +done +# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. +if test $ac_header_dirent = dirent.h; then + { echo "$as_me:$LINENO: checking for library containing opendir" >&5 +echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6; } +if test "${ac_cv_search_opendir+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_func_search_save_LIBS=$LIBS +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char opendir (); +int +main () +{ +return opendir (); + ; + return 0; +} +_ACEOF +for ac_lib in '' dir; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_opendir=$ac_res +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if test "${ac_cv_search_opendir+set}" = set; then + break +fi +done +if test "${ac_cv_search_opendir+set}" = set; then + : +else + ac_cv_search_opendir=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5 +echo "${ECHO_T}$ac_cv_search_opendir" >&6; } +ac_res=$ac_cv_search_opendir +if test "$ac_res" != no; then + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + +else + { echo "$as_me:$LINENO: checking for library containing opendir" >&5 +echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6; } +if test "${ac_cv_search_opendir+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_func_search_save_LIBS=$LIBS +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char opendir (); +int +main () +{ +return opendir (); + ; + return 0; +} +_ACEOF +for ac_lib in '' x; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_opendir=$ac_res +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if test "${ac_cv_search_opendir+set}" = set; then + break +fi +done +if test "${ac_cv_search_opendir+set}" = set; then + : +else + ac_cv_search_opendir=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5 +echo "${ECHO_T}$ac_cv_search_opendir" >&6; } +ac_res=$ac_cv_search_opendir +if test "$ac_res" != no; then + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + +fi + +{ echo "$as_me:$LINENO: checking whether stat file-mode macros are broken" >&5 +echo $ECHO_N "checking whether stat file-mode macros are broken... $ECHO_C" >&6; } +if test "${ac_cv_header_stat_broken+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include + +#if defined S_ISBLK && defined S_IFDIR +# if S_ISBLK (S_IFDIR) +You lose. +# endif +#endif + +#if defined S_ISBLK && defined S_IFCHR +# if S_ISBLK (S_IFCHR) +You lose. +# endif +#endif + +#if defined S_ISLNK && defined S_IFREG +# if S_ISLNK (S_IFREG) +You lose. +# endif +#endif + +#if defined S_ISSOCK && defined S_IFREG +# if S_ISSOCK (S_IFREG) +You lose. +# endif +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "You lose" >/dev/null 2>&1; then + ac_cv_header_stat_broken=yes +else + ac_cv_header_stat_broken=no +fi +rm -f conftest* + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_stat_broken" >&5 +echo "${ECHO_T}$ac_cv_header_stat_broken" >&6; } +if test $ac_cv_header_stat_broken = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STAT_MACROS_BROKEN 1 +_ACEOF + +fi + + +# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works +# for constant arguments. Useless! +{ echo "$as_me:$LINENO: checking for working alloca.h" >&5 +echo $ECHO_N "checking for working alloca.h... $ECHO_C" >&6; } +if test "${ac_cv_working_alloca_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +char *p = (char *) alloca (2 * sizeof (int)); + if (p) return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_working_alloca_h=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_working_alloca_h=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_working_alloca_h" >&5 +echo "${ECHO_T}$ac_cv_working_alloca_h" >&6; } +if test $ac_cv_working_alloca_h = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_ALLOCA_H 1 +_ACEOF + +fi + +{ echo "$as_me:$LINENO: checking for alloca" >&5 +echo $ECHO_N "checking for alloca... $ECHO_C" >&6; } +if test "${ac_cv_func_alloca_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __GNUC__ +# define alloca __builtin_alloca +#else +# ifdef _MSC_VER +# include +# define alloca _alloca +# else +# if HAVE_ALLOCA_H +# include +# else +# ifdef _AIX + #pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +char *alloca (); +# endif +# endif +# endif +# endif +#endif + +int +main () +{ +char *p = (char *) alloca (1); + if (p) return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_alloca_works=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_func_alloca_works=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_func_alloca_works" >&5 +echo "${ECHO_T}$ac_cv_func_alloca_works" >&6; } + +if test $ac_cv_func_alloca_works = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_ALLOCA 1 +_ACEOF + +else + # The SVR3 libPW and SVR4 libucb both contain incompatible functions +# that cause trouble. Some versions do not even contain alloca or +# contain a buggy version. If you still want to use their alloca, +# use ar to extract alloca.o from them instead of compiling alloca.c. + +ALLOCA=\${LIBOBJDIR}alloca.$ac_objext + +cat >>confdefs.h <<\_ACEOF +#define C_ALLOCA 1 +_ACEOF + + +{ echo "$as_me:$LINENO: checking whether \`alloca.c' needs Cray hooks" >&5 +echo $ECHO_N "checking whether \`alloca.c' needs Cray hooks... $ECHO_C" >&6; } +if test "${ac_cv_os_cray+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#if defined CRAY && ! defined CRAY2 +webecray +#else +wenotbecray +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "webecray" >/dev/null 2>&1; then + ac_cv_os_cray=yes +else + ac_cv_os_cray=no +fi +rm -f conftest* + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_os_cray" >&5 +echo "${ECHO_T}$ac_cv_os_cray" >&6; } +if test $ac_cv_os_cray = yes; then + for ac_func in _getb67 GETB67 getb67; do + as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* 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_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then + +cat >>confdefs.h <<_ACEOF +#define CRAY_STACKSEG_END $ac_func +_ACEOF + + break +fi + + done +fi + +{ echo "$as_me:$LINENO: checking stack direction for C alloca" >&5 +echo $ECHO_N "checking stack direction for C alloca... $ECHO_C" >&6; } +if test "${ac_cv_c_stack_direction+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + ac_cv_c_stack_direction=0 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +find_stack_direction () +{ + static char *addr = 0; + auto char dummy; + if (addr == 0) + { + addr = &dummy; + return find_stack_direction (); + } + else + return (&dummy > addr) ? 1 : -1; +} + +int +main () +{ + return find_stack_direction () < 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_stack_direction=1 +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_c_stack_direction=-1 +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_c_stack_direction" >&5 +echo "${ECHO_T}$ac_cv_c_stack_direction" >&6; } + +cat >>confdefs.h <<_ACEOF +#define STACK_DIRECTION $ac_cv_c_stack_direction +_ACEOF + + +fi + +{ echo "$as_me:$LINENO: checking whether closedir returns void" >&5 +echo $ECHO_N "checking whether closedir returns void... $ECHO_C" >&6; } +if test "${ac_cv_func_closedir_void+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + ac_cv_func_closedir_void=yes +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header_dirent> +#ifndef __cplusplus +int closedir (); +#endif + +int +main () +{ +return closedir (opendir (".")) != 0; + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_closedir_void=no +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_func_closedir_void=yes +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_func_closedir_void" >&5 +echo "${ECHO_T}$ac_cv_func_closedir_void" >&6; } +if test $ac_cv_func_closedir_void = yes; then + +cat >>confdefs.h <<\_ACEOF +#define CLOSEDIR_VOID 1 +_ACEOF + +fi + + + +for ac_header in stdlib.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } + +# Is the header present? +{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## ------------------------------- ## +## Report this to bug-grep@gnu.org ## +## ------------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_func in getpagesize +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* 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_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +{ echo "$as_me:$LINENO: checking for working mmap" >&5 +echo $ECHO_N "checking for working mmap... $ECHO_C" >&6; } +if test "${ac_cv_func_mmap_fixed_mapped+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + ac_cv_func_mmap_fixed_mapped=no +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +/* malloc might have been renamed as rpl_malloc. */ +#undef malloc + +/* Thanks to Mike Haertel and Jim Avera for this test. + Here is a matrix of mmap possibilities: + mmap private not fixed + mmap private fixed at somewhere currently unmapped + mmap private fixed at somewhere already mapped + mmap shared not fixed + mmap shared fixed at somewhere currently unmapped + mmap shared fixed at somewhere already mapped + For private mappings, we should verify that changes cannot be read() + back from the file, nor mmap's back from the file at a different + address. (There have been systems where private was not correctly + implemented like the infamous i386 svr4.0, and systems where the + VM page cache was not coherent with the file system buffer cache + like early versions of FreeBSD and possibly contemporary NetBSD.) + For shared mappings, we should conversely verify that changes get + propagated back to all the places they're supposed to be. + + Grep wants private fixed already mapped. + The main things grep needs to know about mmap are: + * does it exist and is it safe to write into the mmap'd area + * how to use it (BSD variants) */ + +#include +#include + +#if !STDC_HEADERS && !HAVE_STDLIB_H +char *malloc (); +#endif + +/* This mess was copied from the GNU getpagesize.h. */ +#if !HAVE_GETPAGESIZE +/* Assume that all systems that can run configure have sys/param.h. */ +# if !HAVE_SYS_PARAM_H +# define HAVE_SYS_PARAM_H 1 +# endif + +# ifdef _SC_PAGESIZE +# define getpagesize() sysconf(_SC_PAGESIZE) +# else /* no _SC_PAGESIZE */ +# if HAVE_SYS_PARAM_H +# include +# ifdef EXEC_PAGESIZE +# define getpagesize() EXEC_PAGESIZE +# else /* no EXEC_PAGESIZE */ +# ifdef NBPG +# define getpagesize() NBPG * CLSIZE +# ifndef CLSIZE +# define CLSIZE 1 +# endif /* no CLSIZE */ +# else /* no NBPG */ +# ifdef NBPC +# define getpagesize() NBPC +# else /* no NBPC */ +# ifdef PAGESIZE +# define getpagesize() PAGESIZE +# endif /* PAGESIZE */ +# endif /* no NBPC */ +# endif /* no NBPG */ +# endif /* no EXEC_PAGESIZE */ +# else /* no HAVE_SYS_PARAM_H */ +# define getpagesize() 8192 /* punt totally */ +# endif /* no HAVE_SYS_PARAM_H */ +# endif /* no _SC_PAGESIZE */ + +#endif /* no HAVE_GETPAGESIZE */ + +int +main () +{ + char *data, *data2, *data3; + int i, pagesize; + int fd; + + pagesize = getpagesize (); + + /* First, make a file with some known garbage in it. */ + data = (char *) malloc (pagesize); + if (!data) + return 1; + for (i = 0; i < pagesize; ++i) + *(data + i) = rand (); + umask (0); + fd = creat ("conftest.mmap", 0600); + if (fd < 0) + return 1; + if (write (fd, data, pagesize) != pagesize) + return 1; + close (fd); + + /* Next, try to mmap the file at a fixed address which already has + something else allocated at it. If we can, also make sure that + we see the same garbage. */ + fd = open ("conftest.mmap", O_RDWR); + if (fd < 0) + return 1; + data2 = (char *) malloc (2 * pagesize); + if (!data2) + return 1; + data2 += (pagesize - ((long int) data2 & (pagesize - 1))) & (pagesize - 1); + if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_FIXED, fd, 0L)) + return 1; + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data2 + i)) + return 1; + + /* Finally, make sure that changes to the mapped area do not + percolate back to the file as seen by read(). (This is a bug on + some variants of i386 svr4.0.) */ + for (i = 0; i < pagesize; ++i) + *(data2 + i) = *(data2 + i) + 1; + data3 = (char *) malloc (pagesize); + if (!data3) + return 1; + if (read (fd, data3, pagesize) != pagesize) + return 1; + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data3 + i)) + return 1; + close (fd); + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_mmap_fixed_mapped=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_func_mmap_fixed_mapped=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_func_mmap_fixed_mapped" >&5 +echo "${ECHO_T}$ac_cv_func_mmap_fixed_mapped" >&6; } +if test $ac_cv_func_mmap_fixed_mapped = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_MMAP 1 +_ACEOF + +fi +rm -f conftest.mmap + + + + + + + + + + + + +for ac_func in btowc isascii iswctype mbrlen memmove setmode strerror wcrtomb wcscoll wctype +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* 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_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +# We can use mbrtowc only if we have mbstate_t. + + { echo "$as_me:$LINENO: checking whether mbrtowc and mbstate_t are properly declared" >&5 +echo $ECHO_N "checking whether mbrtowc and mbstate_t are properly declared... $ECHO_C" >&6; } +if test "${ac_cv_func_mbrtowc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +wchar_t wc; + char const s[] = ""; + size_t n = 1; + mbstate_t state; + return ! (sizeof state && (mbrtowc) (&wc, s, n, &state)); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_mbrtowc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_func_mbrtowc=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_func_mbrtowc" >&5 +echo "${ECHO_T}$ac_cv_func_mbrtowc" >&6; } + if test $ac_cv_func_mbrtowc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_MBRTOWC 1 +_ACEOF + + fi + +# Yet we need a mbstate_t stub in every case. + + +for ac_header in stdlib.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } + +# Is the header present? +{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## ------------------------------- ## +## Report this to bug-grep@gnu.org ## +## ------------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + { echo "$as_me:$LINENO: checking for mbstate_t" >&5 +echo $ECHO_N "checking for mbstate_t... $ECHO_C" >&6; } +if test "${ac_cv_type_mbstate_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#if HAVE_STDLIB_H +# include +#endif +#include +int +main () +{ +mbstate_t x; return sizeof x; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_mbstate_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_mbstate_t=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_mbstate_t" >&5 +echo "${ECHO_T}$ac_cv_type_mbstate_t" >&6; } + if test $ac_cv_type_mbstate_t = no; then + +cat >>confdefs.h <<\_ACEOF +#define mbstate_t int +_ACEOF + + fi + + + + + +for ac_func in memchr stpcpy strtoul atexit fnmatch +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* 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_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +else + case " $LIBOBJS " in + *" $ac_func.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS $ac_func.$ac_objext" + ;; +esac + +fi +done + + + + + + +for ac_header in stdlib.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } + +# Is the header present? +{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## ------------------------------- ## +## Report this to bug-grep@gnu.org ## +## ------------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + { echo "$as_me:$LINENO: checking whether defines strtoumax as a macro" >&5 +echo $ECHO_N "checking whether defines strtoumax as a macro... $ECHO_C" >&6; } +if test "${jm_cv_func_strtoumax_macro+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#ifdef strtoumax + inttypes_h_defines_strtoumax +#endif +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "inttypes_h_defines_strtoumax" >/dev/null 2>&1; then + jm_cv_func_strtoumax_macro=yes +else + jm_cv_func_strtoumax_macro=no +fi +rm -f conftest* + +fi +{ echo "$as_me:$LINENO: result: $jm_cv_func_strtoumax_macro" >&5 +echo "${ECHO_T}$jm_cv_func_strtoumax_macro" >&6; } + + if test "$jm_cv_func_strtoumax_macro" != yes; then + +for ac_func in strtoumax +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* 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_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +else + case " $LIBOBJS " in + *" $ac_func.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS $ac_func.$ac_objext" + ;; +esac + +fi +done + + + fi + + case "$ac_cv_type_unsigned_long_long,$jm_cv_func_strtoumax_macro,$ac_cv_func_strtoumax" in + yes,no,no) + +for ac_func in strtoull +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* 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_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +else + case " $LIBOBJS " in + *" $ac_func.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS $ac_func.$ac_objext" + ;; +esac + +fi +done + + + ;; + esac + + + + + for jm_func in strtoul strtoull + do + + { echo "$as_me:$LINENO: checking whether $jm_func is declared" >&5 +echo $ECHO_N "checking whether $jm_func is declared... $ECHO_C" >&6; } + if { as_var=jm_cv_func_decl_$jm_func; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ + +#ifndef $jm_func +char *(*pfn) = (char *(*)) $jm_func +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "jm_cv_func_decl_$jm_func=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "jm_cv_func_decl_$jm_func=no" +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + + + if eval "test \"`echo '$jm_cv_func_decl_'$jm_func`\" = yes"; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + + jm_tr_func=HAVE_DECL_`echo $jm_func | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ` + +cat >>confdefs.h <<_ACEOF +#define $jm_tr_func 1 +_ACEOF + + else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + fi + done + +test $jm_cv_func_decl_strtoul != yes + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_STRTOUL $? +_ACEOF + +test $jm_cv_func_decl_strtoull != yes + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_STRTOULL $? +_ACEOF + + +case "$ac_cv_prog_CC" in + cl*) +cat >>confdefs.h <<\_ACEOF +#define alloca _alloca +_ACEOF + ;; + *) ;; +esac + +ALL_LINGUAS="af be bg ca cs da de el eo es et eu fi fr ga gl he hr hu id it ja ko nb nl no pl pt_BR pt ro ru rw sl sr sv tr uk vi zh_TW" + + { echo "$as_me:$LINENO: checking for strerror in -lcposix" >&5 +echo $ECHO_N "checking for strerror in -lcposix... $ECHO_C" >&6; } +if test "${ac_cv_lib_cposix_strerror+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lcposix $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char strerror (); +int +main () +{ +return strerror (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_cposix_strerror=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_cposix_strerror=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_cposix_strerror" >&5 +echo "${ECHO_T}$ac_cv_lib_cposix_strerror" >&6; } +if test $ac_cv_lib_cposix_strerror = yes; then + LIBS="$LIBS -lcposix" +fi + + + +{ echo "$as_me:$LINENO: checking for inline" >&5 +echo $ECHO_N "checking for inline... $ECHO_C" >&6; } +if test "${ac_cv_c_inline+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_c_inline=no +for ac_kw in inline __inline__ __inline; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifndef __cplusplus +typedef int foo_t; +static $ac_kw foo_t static_foo () {return 0; } +$ac_kw foo_t foo () {return 0; } +#endif + +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_inline=$ac_kw +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + test "$ac_cv_c_inline" != no && break +done + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5 +echo "${ECHO_T}$ac_cv_c_inline" >&6; } + + +case $ac_cv_c_inline in + inline | yes) ;; + *) + case $ac_cv_c_inline in + no) ac_val=;; + *) ac_val=$ac_cv_c_inline;; + esac + cat >>confdefs.h <<_ACEOF +#ifndef __cplusplus +#define inline $ac_val +#endif +_ACEOF + ;; +esac + +{ echo "$as_me:$LINENO: checking for off_t" >&5 +echo $ECHO_N "checking for off_t... $ECHO_C" >&6; } +if test "${ac_cv_type_off_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +typedef off_t ac__type_new_; +int +main () +{ +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_off_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_off_t=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5 +echo "${ECHO_T}$ac_cv_type_off_t" >&6; } +if test $ac_cv_type_off_t = yes; then + : +else + +cat >>confdefs.h <<_ACEOF +#define off_t long int +_ACEOF + +fi + + + { echo "$as_me:$LINENO: checking whether we are using the GNU C Library 2.1 or newer" >&5 +echo $ECHO_N "checking whether we are using the GNU C Library 2.1 or newer... $ECHO_C" >&6; } +if test "${ac_cv_gnu_library_2_1+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +#ifdef __GNU_LIBRARY__ + #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) + Lucky GNU user + #endif +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Lucky GNU user" >/dev/null 2>&1; then + ac_cv_gnu_library_2_1=yes +else + ac_cv_gnu_library_2_1=no +fi +rm -f conftest* + + + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_gnu_library_2_1" >&5 +echo "${ECHO_T}$ac_cv_gnu_library_2_1" >&6; } + + GLIBC21="$ac_cv_gnu_library_2_1" + + + + + + + + + + + + + +for ac_header in argz.h limits.h locale.h nl_types.h malloc.h stddef.h \ +stdlib.h string.h unistd.h sys/param.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } + +# Is the header present? +{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## ------------------------------- ## +## Report this to bug-grep@gnu.org ## +## ------------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + + + + + + + + + + + + + + + + + + + +for ac_func in feof_unlocked fgets_unlocked getcwd getegid geteuid \ +getgid getuid mempcpy munmap putenv setenv setlocale stpcpy strchr strcasecmp \ +strdup strtoul tsearch __argz_count __argz_stringify __argz_next +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* 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_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + + + + +# Check whether --with-libiconv-prefix was given. +if test "${with_libiconv_prefix+set}" = set; then + withval=$with_libiconv_prefix; + for dir in `echo "$withval" | tr : ' '`; do + if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi + if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi + done + +fi + + + { echo "$as_me:$LINENO: checking for iconv" >&5 +echo $ECHO_N "checking for iconv... $ECHO_C" >&6; } +if test "${am_cv_func_iconv+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + am_cv_func_iconv="no, consider installing GNU libiconv" + am_cv_lib_iconv=no + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +int +main () +{ +iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + am_cv_func_iconv=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test "$am_cv_func_iconv" != yes; then + am_save_LIBS="$LIBS" + LIBS="$LIBS -liconv" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +int +main () +{ +iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + am_cv_lib_iconv=yes + am_cv_func_iconv=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$am_save_LIBS" + fi + +fi +{ echo "$as_me:$LINENO: result: $am_cv_func_iconv" >&5 +echo "${ECHO_T}$am_cv_func_iconv" >&6; } + if test "$am_cv_func_iconv" = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_ICONV 1 +_ACEOF + + { echo "$as_me:$LINENO: checking for iconv declaration" >&5 +echo $ECHO_N "checking for iconv declaration... $ECHO_C" >&6; } + if test "${am_cv_proto_iconv+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +#include +extern +#ifdef __cplusplus +"C" +#endif +#if defined(__STDC__) || defined(__cplusplus) +size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); +#else +size_t iconv(); +#endif + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + am_cv_proto_iconv_arg1="" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + am_cv_proto_iconv_arg1="const" +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);" +fi + + am_cv_proto_iconv=`echo "$am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` + { echo "$as_me:$LINENO: result: ${ac_t:- + }$am_cv_proto_iconv" >&5 +echo "${ECHO_T}${ac_t:- + }$am_cv_proto_iconv" >&6; } + +cat >>confdefs.h <<_ACEOF +#define ICONV_CONST $am_cv_proto_iconv_arg1 +_ACEOF + + fi + LIBICONV= + if test "$am_cv_lib_iconv" = yes; then + LIBICONV="-liconv" + fi + + + + { echo "$as_me:$LINENO: checking for nl_langinfo and CODESET" >&5 +echo $ECHO_N "checking for nl_langinfo and CODESET... $ECHO_C" >&6; } +if test "${am_cv_langinfo_codeset+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +char* cs = nl_langinfo(CODESET); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + am_cv_langinfo_codeset=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + am_cv_langinfo_codeset=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +{ echo "$as_me:$LINENO: result: $am_cv_langinfo_codeset" >&5 +echo "${ECHO_T}$am_cv_langinfo_codeset" >&6; } + if test $am_cv_langinfo_codeset = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_LANGINFO_CODESET 1 +_ACEOF + + fi + + if test $ac_cv_header_locale_h = yes; then + { echo "$as_me:$LINENO: checking for LC_MESSAGES" >&5 +echo $ECHO_N "checking for LC_MESSAGES... $ECHO_C" >&6; } +if test "${am_cv_val_LC_MESSAGES+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +return LC_MESSAGES + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + am_cv_val_LC_MESSAGES=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + am_cv_val_LC_MESSAGES=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $am_cv_val_LC_MESSAGES" >&5 +echo "${ECHO_T}$am_cv_val_LC_MESSAGES" >&6; } + if test $am_cv_val_LC_MESSAGES = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_LC_MESSAGES 1 +_ACEOF + + fi + fi + { echo "$as_me:$LINENO: checking whether NLS is requested" >&5 +echo $ECHO_N "checking whether NLS is requested... $ECHO_C" >&6; } + # Check whether --enable-nls was given. +if test "${enable_nls+set}" = set; then + enableval=$enable_nls; USE_NLS=$enableval +else + USE_NLS=yes +fi + + { echo "$as_me:$LINENO: result: $USE_NLS" >&5 +echo "${ECHO_T}$USE_NLS" >&6; } + + + BUILD_INCLUDED_LIBINTL=no + USE_INCLUDED_LIBINTL=no + INTLLIBS= + + if test "$USE_NLS" = "yes"; then + +cat >>confdefs.h <<\_ACEOF +#define ENABLE_NLS 1 +_ACEOF + + { echo "$as_me:$LINENO: checking whether included gettext is requested" >&5 +echo $ECHO_N "checking whether included gettext is requested... $ECHO_C" >&6; } + +# Check whether --with-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 +fi + + { echo "$as_me:$LINENO: result: $nls_cv_force_use_gnu_gettext" >&5 +echo "${ECHO_T}$nls_cv_force_use_gnu_gettext" >&6; } + + nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" + if test "$nls_cv_force_use_gnu_gettext" != "yes"; then + CATOBJEXT=NONE + + + + + if test "${ac_cv_header_libintl_h+set}" = set; then + { echo "$as_me:$LINENO: checking for libintl.h" >&5 +echo $ECHO_N "checking for libintl.h... $ECHO_C" >&6; } +if test "${ac_cv_header_libintl_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_libintl_h" >&5 +echo "${ECHO_T}$ac_cv_header_libintl_h" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking libintl.h usability" >&5 +echo $ECHO_N "checking libintl.h usability... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } + +# Is the header present? +{ echo "$as_me:$LINENO: checking libintl.h presence" >&5 +echo $ECHO_N "checking libintl.h presence... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: libintl.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: libintl.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: libintl.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: libintl.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: libintl.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: libintl.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: libintl.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: libintl.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: libintl.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: libintl.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: libintl.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: libintl.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: libintl.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: libintl.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: libintl.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: libintl.h: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## ------------------------------- ## +## Report this to bug-grep@gnu.org ## +## ------------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ echo "$as_me:$LINENO: checking for libintl.h" >&5 +echo $ECHO_N "checking for libintl.h... $ECHO_C" >&6; } +if test "${ac_cv_header_libintl_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_libintl_h=$ac_header_preproc +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_libintl_h" >&5 +echo "${ECHO_T}$ac_cv_header_libintl_h" >&6; } + +fi +if test $ac_cv_header_libintl_h = yes; then + { echo "$as_me:$LINENO: checking for GNU gettext in libc" >&5 +echo $ECHO_N "checking for GNU gettext in libc... $ECHO_C" >&6; } +if test "${gt_cv_func_gnugettext1_libc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +extern int _nl_msg_cat_cntr; +int +main () +{ +bindtextdomain ("", ""); +return (int) gettext ("") + _nl_msg_cat_cntr + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gt_cv_func_gnugettext1_libc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gt_cv_func_gnugettext1_libc=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $gt_cv_func_gnugettext1_libc" >&5 +echo "${ECHO_T}$gt_cv_func_gnugettext1_libc" >&6; } + + if test "$gt_cv_func_gnugettext1_libc" != "yes"; then + { echo "$as_me:$LINENO: checking for GNU gettext in libintl" >&5 +echo $ECHO_N "checking for GNU gettext in libintl... $ECHO_C" >&6; } +if test "${gt_cv_func_gnugettext1_libintl+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + gt_save_LIBS="$LIBS" + LIBS="$LIBS -lintl $LIBICONV" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +extern int _nl_msg_cat_cntr; +int +main () +{ +bindtextdomain ("", ""); +return (int) gettext ("") + _nl_msg_cat_cntr + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gt_cv_func_gnugettext1_libintl=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + gt_cv_func_gnugettext1_libintl=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$gt_save_LIBS" +fi +{ echo "$as_me:$LINENO: result: $gt_cv_func_gnugettext1_libintl" >&5 +echo "${ECHO_T}$gt_cv_func_gnugettext1_libintl" >&6; } + fi + + if test "$gt_cv_func_gnugettext1_libc" = "yes" \ + || { test "$gt_cv_func_gnugettext1_libintl" = "yes" \ + && test "$PACKAGE" != gettext; }; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_GETTEXT 1 +_ACEOF + + + if test "$gt_cv_func_gnugettext1_libintl" = "yes"; then + INTLLIBS="-lintl $LIBICONV" + fi + + gt_save_LIBS="$LIBS" + LIBS="$LIBS $INTLLIBS" + +for ac_func in dcgettext +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* 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_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + LIBS="$gt_save_LIBS" + + # Extract the first word of "msgfmt", so it can be a program name with args. +set dummy msgfmt; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_MSGFMT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case "$MSGFMT" in + /*) + ac_cv_path_MSGFMT="$MSGFMT" # 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 $ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1; then + ac_cv_path_MSGFMT="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT=":" + ;; +esac +fi +MSGFMT="$ac_cv_path_MSGFMT" +if test "$MSGFMT" != ":"; then + { echo "$as_me:$LINENO: result: $MSGFMT" >&5 +echo "${ECHO_T}$MSGFMT" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + # Extract the first word of "gmsgfmt", so it can be a program name with args. +set dummy gmsgfmt; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_GMSGFMT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $GMSGFMT in + [\\/]* | ?:[\\/]*) + ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" + ;; +esac +fi +GMSGFMT=$ac_cv_path_GMSGFMT +if test -n "$GMSGFMT"; then + { echo "$as_me:$LINENO: result: $GMSGFMT" >&5 +echo "${ECHO_T}$GMSGFMT" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + + # Extract the first word of "xgettext", so it can be a program name with args. +set dummy xgettext; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_XGETTEXT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case "$XGETTEXT" in + /*) + ac_cv_path_XGETTEXT="$XGETTEXT" # 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 $ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1; then + ac_cv_path_XGETTEXT="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" + ;; +esac +fi +XGETTEXT="$ac_cv_path_XGETTEXT" +if test "$XGETTEXT" != ":"; then + { echo "$as_me:$LINENO: result: $XGETTEXT" >&5 +echo "${ECHO_T}$XGETTEXT" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + CATOBJEXT=.gmo + fi + +fi + + + + if test "$CATOBJEXT" = "NONE"; then + nls_cv_use_gnu_gettext=yes + fi + fi + + if test "$nls_cv_use_gnu_gettext" = "yes"; then + INTLOBJS="\$(GETTOBJS)" + # Extract the first word of "msgfmt", so it can be a program name with args. +set dummy msgfmt; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_MSGFMT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case "$MSGFMT" in + /*) + ac_cv_path_MSGFMT="$MSGFMT" # 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 $ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1; then + ac_cv_path_MSGFMT="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT=":" + ;; +esac +fi +MSGFMT="$ac_cv_path_MSGFMT" +if test "$MSGFMT" != ":"; then + { echo "$as_me:$LINENO: result: $MSGFMT" >&5 +echo "${ECHO_T}$MSGFMT" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + # Extract the first word of "gmsgfmt", so it can be a program name with args. +set dummy gmsgfmt; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_GMSGFMT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $GMSGFMT in + [\\/]* | ?:[\\/]*) + ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" + ;; +esac +fi +GMSGFMT=$ac_cv_path_GMSGFMT +if test -n "$GMSGFMT"; then + { echo "$as_me:$LINENO: result: $GMSGFMT" >&5 +echo "${ECHO_T}$GMSGFMT" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + # Extract the first word of "xgettext", so it can be a program name with args. +set dummy xgettext; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_XGETTEXT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case "$XGETTEXT" in + /*) + ac_cv_path_XGETTEXT="$XGETTEXT" # 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 $ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1; then + ac_cv_path_XGETTEXT="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" + ;; +esac +fi +XGETTEXT="$ac_cv_path_XGETTEXT" +if test "$XGETTEXT" != ":"; then + { echo "$as_me:$LINENO: result: $XGETTEXT" >&5 +echo "${ECHO_T}$XGETTEXT" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + BUILD_INCLUDED_LIBINTL=yes + USE_INCLUDED_LIBINTL=yes + CATOBJEXT=.gmo + INTLLIBS="\$(top_builddir)/intl/libintl.a $LIBICONV" + LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` + fi + + if test "$GMSGFMT" != ":"; then + if $GMSGFMT --statistics /dev/null >/dev/null 2>&1; then + : ; + else + { echo "$as_me:$LINENO: result: found msgfmt program is not GNU msgfmt; ignore it" >&5 +echo "${ECHO_T}found msgfmt program is not GNU msgfmt; ignore it" >&6; } + GMSGFMT=":" + fi + fi + + if test "$XGETTEXT" != ":"; then + if $XGETTEXT --omit-header /dev/null >/dev/null 2>&1; then + : ; + else + { echo "$as_me:$LINENO: result: found xgettext program is not GNU xgettext; ignore it" >&5 +echo "${ECHO_T}found xgettext program is not GNU xgettext; ignore it" >&6; } + XGETTEXT=":" + fi + fi + + POSUB=po + fi + ac_config_commands="$ac_config_commands default-1" + + + + if test "$PACKAGE" = gettext; then + BUILD_INCLUDED_LIBINTL=yes + fi + + for ac_prog in bison +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_INTLBISON+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$INTLBISON"; then + ac_cv_prog_INTLBISON="$INTLBISON" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_INTLBISON="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +INTLBISON=$ac_cv_prog_INTLBISON +if test -n "$INTLBISON"; then + { echo "$as_me:$LINENO: result: $INTLBISON" >&5 +echo "${ECHO_T}$INTLBISON" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$INTLBISON" && break +done + + if test -z "$INTLBISON"; then + ac_verc_fail=yes + else + { echo "$as_me:$LINENO: checking version of bison" >&5 +echo $ECHO_N "checking version of bison... $ECHO_C" >&6; } + ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'` + case $ac_prog_version in + '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; + 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*) + ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; + *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; + esac + { echo "$as_me:$LINENO: result: $ac_prog_version" >&5 +echo "${ECHO_T}$ac_prog_version" >&6; } + fi + if test $ac_verc_fail = yes; then + INTLBISON=: + fi + + for lang in $ALL_LINGUAS; do + GMOFILES="$GMOFILES $lang.gmo" + POFILES="$POFILES $lang.po" + done + + + + + + + + + + + + nls_cv_header_intl= + nls_cv_header_libgt= + + DATADIRNAME=share + + + INSTOBJEXT=.mo + + + GENCAT=gencat + + + + if test "x$CATOBJEXT" != "x"; then + if test "x$ALL_LINGUAS" = "x"; then + LINGUAS= + else + { echo "$as_me:$LINENO: checking for catalogs to be installed" >&5 +echo $ECHO_N "checking for catalogs to be installed... $ECHO_C" >&6; } + NEW_LINGUAS= + for presentlang in $ALL_LINGUAS; do + useit=no + for desiredlang in ${LINGUAS-$ALL_LINGUAS}; do + # Use the presentlang catalog if desiredlang is + # a. equal to presentlang, or + # b. a variant of presentlang (because in this case, + # presentlang can be used as a fallback for messages + # which are not translated in the desiredlang catalog). + case "$desiredlang" in + "$presentlang"*) useit=yes;; + esac + done + if test $useit = yes; then + NEW_LINGUAS="$NEW_LINGUAS $presentlang" + fi + done + LINGUAS=$NEW_LINGUAS + { echo "$as_me:$LINENO: result: $LINGUAS" >&5 +echo "${ECHO_T}$LINGUAS" >&6; } + fi + + if test -n "$LINGUAS"; then + for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done + fi + fi + + MKINSTALLDIRS= + if test -n "$ac_aux_dir"; then + MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" + fi + if test -z "$MKINSTALLDIRS"; then + MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" + fi + + + INTL_LIBTOOL_SUFFIX_PREFIX= + + + + + { echo "$as_me:$LINENO: checking for dos file convention" >&5 +echo $ECHO_N "checking for dos file convention... $ECHO_C" >&6; } +if test "${ac_cv_dosfile+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -d ".\."; then + ac_cv_dosfile=yes + else + ac_cv_dosfile=no + fi + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_dosfile" >&5 +echo "${ECHO_T}$ac_cv_dosfile" >&6; } + + if test $ac_cv_dosfile = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_DOS_FILE_NAMES 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define HAVE_DOS_FILE_CONTENTS 1 +_ACEOF + + fi + + +{ echo "$as_me:$LINENO: checking host system type" >&5 +echo $ECHO_N "checking host system type... $ECHO_C" >&6; } +if test "${ac_cv_host+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || + { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5 +echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;} + { (exit 1); exit 1; }; } +fi + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_host" >&5 +echo "${ECHO_T}$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5 +echo "$as_me: error: invalid value of canonical host" >&2;} + { (exit 1); exit 1; }; };; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + +case $host_os in + *cygwin* ) CYGWIN=yes;; + * ) CYGWIN=no;; +esac + +{ echo "$as_me:$LINENO: checking host system type" >&5 +echo $ECHO_N "checking host system type... $ECHO_C" >&6; } +if test "${ac_cv_host+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || + { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5 +echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;} + { (exit 1); exit 1; }; } +fi + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_host" >&5 +echo "${ECHO_T}$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5 +echo "$as_me: error: invalid value of canonical host" >&2;} + { (exit 1); exit 1; }; };; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + +case $host_os in + *mingw32* ) MINGW32=yes;; + * ) MINGW32=no;; +esac + +{ echo "$as_me:$LINENO: checking for DJGPP environment" >&5 +echo $ECHO_N "checking for DJGPP environment... $ECHO_C" >&6; } +if test "${ac_cv_djgpp+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + return __DJGPP__; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_djgpp=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_djgpp=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f conftest* +fi +{ echo "$as_me:$LINENO: result: $ac_cv_djgpp" >&5 +echo "${ECHO_T}$ac_cv_djgpp" >&6; } +DJ_GPP= +test "$ac_cv_djgpp" = yes && DJ_GPP=yes + + + +{ echo "$as_me:$LINENO: checking for environ variable separator" >&5 +echo $ECHO_N "checking for environ variable separator... $ECHO_C" >&6; } +if test "${ac_cv_sep+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$CYGWIN" = yes || test "$MINGW32" = yes || test "$DJ_GPP" = yes ; then + ac_cv_sep=yes +else + ac_cv_sep=no +fi +fi + +SEP=":" +test x"$ac_cv_sep" = xyes && SEP=";" +{ echo "$as_me:$LINENO: result: ${SEP}" >&5 +echo "${ECHO_T}${SEP}" >&6; } + + + + + + + + + # Assume we'll default to using the included regex.c. + ac_use_included_regex=yes + + # However, if the system regex support is good enough that it passes the + # the following run test, then default to *not* using the included regex.c. + # If cross compiling, assume the test would fail and use the included + # regex.c. The first failing regular expression is from `Spencer ere + # test #75' in grep-2.3. + { echo "$as_me:$LINENO: checking for working re_compile_pattern" >&5 +echo $ECHO_N "checking for working re_compile_pattern... $ECHO_C" >&6; } +if test "${jm_cv_func_working_re_compile_pattern+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + jm_cv_func_working_re_compile_pattern=no +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +#include + int + main () + { + static struct re_pattern_buffer regex; + const char *s; + re_set_syntax (RE_SYNTAX_POSIX_EGREP); + /* Add this third left square bracket, , to balance the + three right ones below. Otherwise autoconf-2.14 chokes. */ + s = re_compile_pattern ("a[[:]:]b\n", 9, ®ex); + /* This should fail with _Invalid character class name_ error. */ + if (!s) + exit (1); + + /* This should succeed, but doesn't for e.g. glibc-2.1.3. */ + s = re_compile_pattern ("{1", 2, ®ex); + + exit (s ? 1 : 0); + } + +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + jm_cv_func_working_re_compile_pattern=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +jm_cv_func_working_re_compile_pattern=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + +fi +{ echo "$as_me:$LINENO: result: $jm_cv_func_working_re_compile_pattern" >&5 +echo "${ECHO_T}$jm_cv_func_working_re_compile_pattern" >&6; } + if test $jm_cv_func_working_re_compile_pattern = yes; then + ac_use_included_regex=no + fi + + test -n "lib/regex.c" || { { echo "$as_me:$LINENO: error: missing argument" >&5 +echo "$as_me: error: missing argument" >&2;} + { (exit 1); exit 1; }; } + + + + +# Check whether --with-included-regex was given. +if test "${with_included_regex+set}" = set; then + withval=$with_included_regex; jm_with_regex=$withval +else + jm_with_regex=$ac_use_included_regex +fi + + if test "$jm_with_regex" = yes; then + case " $LIBOBJS " in + *" regex.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS regex.$ac_objext" + ;; +esac + + fi + + + + +{ echo "$as_me:$LINENO: checking for getopt_long" >&5 +echo $ECHO_N "checking for getopt_long... $ECHO_C" >&6; } +if test "${ac_cv_func_getopt_long+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define getopt_long to an innocuous variant, in case declares getopt_long. + For example, HP-UX 11i declares gettimeofday. */ +#define getopt_long innocuous_getopt_long + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char getopt_long (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef getopt_long + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char getopt_long (); +/* 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_getopt_long || defined __stub___getopt_long +choke me +#endif + +int +main () +{ +return getopt_long (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_getopt_long=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_func_getopt_long=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_func_getopt_long" >&5 +echo "${ECHO_T}$ac_cv_func_getopt_long" >&6; } +if test $ac_cv_func_getopt_long = yes; then + + +# Check whether --with-included-getopt was given. +if test "${with_included_getopt+set}" = set; then + withval=$with_included_getopt; with_getopt=$withval +else + with_getopt=$no +fi + + if test "x$with_getopt" = xyes; then + case " $LIBOBJS " in + *" getopt.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS getopt.$ac_objext" + ;; +esac + + case " $LIBOBJS " in + *" getopt1.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS getopt1.$ac_objext" + ;; +esac + + fi + +else + + case " $LIBOBJS " in + *" getopt.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS getopt.$ac_objext" + ;; +esac + + case " $LIBOBJS " in + *" getopt1.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS getopt1.$ac_objext" + ;; +esac + + +fi + + +if test "$jm_with_regex" = no; then + { echo "$as_me:$LINENO: WARNING: Included lib/regex.c not used" >&5 +echo "$as_me: WARNING: Included lib/regex.c not used" >&2;} +fi + +{ echo "$as_me:$LINENO: checking whether strerror_r is declared" >&5 +echo $ECHO_N "checking whether strerror_r is declared... $ECHO_C" >&6; } +if test "${ac_cv_have_decl_strerror_r+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef strerror_r + char *p = (char *) strerror_r; + return !p; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_strerror_r=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_have_decl_strerror_r=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_strerror_r" >&5 +echo "${ECHO_T}$ac_cv_have_decl_strerror_r" >&6; } +if test $ac_cv_have_decl_strerror_r = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_STRERROR_R 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_STRERROR_R 0 +_ACEOF + + +fi + + + +for ac_func in strerror_r +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* 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_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +{ echo "$as_me:$LINENO: checking whether strerror_r returns char *" >&5 +echo $ECHO_N "checking whether strerror_r returns char *... $ECHO_C" >&6; } +if test "${ac_cv_func_strerror_r_char_p+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + ac_cv_func_strerror_r_char_p=no + if test $ac_cv_have_decl_strerror_r = yes; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ + + char buf[100]; + char x = *strerror_r (0, buf, sizeof buf); + char *p = strerror_r (0, buf, sizeof buf); + return !p || x; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_strerror_r_char_p=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + else + # strerror_r is not declared. Choose between + # systems that have relatively inaccessible declarations for the + # function. BeOS and DEC UNIX 4.0 fall in this category, but the + # former has a strerror_r that returns char*, while the latter + # has a strerror_r that returns `int'. + # This test should segfault on the DEC system. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + extern char *strerror_r (); +int +main () +{ +char buf[100]; + char x = *strerror_r (0, buf, sizeof buf); + return ! isalpha (x); + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_strerror_r_char_p=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + + fi + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_func_strerror_r_char_p" >&5 +echo "${ECHO_T}$ac_cv_func_strerror_r_char_p" >&6; } +if test $ac_cv_func_strerror_r_char_p = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STRERROR_R_CHAR_P 1 +_ACEOF + +fi + + + + + + +for ac_func in strerror strerror_r vprintf doprnt +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* 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_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + { echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_header_stdc=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + +fi +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + + + + + +cat >>confdefs.h <<_ACEOF +#define HAVE_DONE_WORKING_MALLOC_CHECK 1 +_ACEOF + + + { echo "$as_me:$LINENO: checking for working malloc" >&5 +echo $ECHO_N "checking for working malloc... $ECHO_C" >&6; } +if test "${jm_cv_func_working_malloc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + jm_cv_func_working_malloc=no +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + char *malloc (); + int + main () + { + exit (malloc (0) ? 0 : 1); + } + +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + jm_cv_func_working_malloc=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +jm_cv_func_working_malloc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + + +fi +{ echo "$as_me:$LINENO: result: $jm_cv_func_working_malloc" >&5 +echo "${ECHO_T}$jm_cv_func_working_malloc" >&6; } + if test $jm_cv_func_working_malloc = no; then + case " $LIBOBJS " in + *" malloc.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS malloc.$ac_objext" + ;; +esac + + +cat >>confdefs.h <<_ACEOF +#define malloc rpl_malloc +_ACEOF + + fi + + + +cat >>confdefs.h <<_ACEOF +#define HAVE_DONE_WORKING_REALLOC_CHECK 1 +_ACEOF + + + { echo "$as_me:$LINENO: checking for working realloc" >&5 +echo $ECHO_N "checking for working realloc... $ECHO_C" >&6; } +if test "${jm_cv_func_working_realloc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + jm_cv_func_working_realloc=no +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + char *realloc (); + int + main () + { + exit (realloc (0, 0) ? 0 : 1); + } + +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + jm_cv_func_working_realloc=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +jm_cv_func_working_realloc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + + +fi +{ echo "$as_me:$LINENO: result: $jm_cv_func_working_realloc" >&5 +echo "${ECHO_T}$jm_cv_func_working_realloc" >&6; } + if test $jm_cv_func_working_realloc = no; then + case " $LIBOBJS " in + *" realloc.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS realloc.$ac_objext" + ;; +esac + + +cat >>confdefs.h <<_ACEOF +#define realloc rpl_realloc +_ACEOF + + fi + + +# support for pcre +if test x"$testpcre" = x"yes"; then + if pcre-config --cflags >/dev/null 2>&1; then + CFLAGS="$CFLAGS `pcre-config --cflags`" + LIBS="$LIBS `pcre-config --libs`" + fi + +{ echo "$as_me:$LINENO: checking for pcre_exec in -lpcre" >&5 +echo $ECHO_N "checking for pcre_exec in -lpcre... $ECHO_C" >&6; } +if test "${ac_cv_lib_pcre_pcre_exec+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpcre $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char pcre_exec (); +int +main () +{ +return pcre_exec (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_pcre_pcre_exec=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_pcre_pcre_exec=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_pcre_pcre_exec" >&5 +echo "${ECHO_T}$ac_cv_lib_pcre_pcre_exec" >&6; } +if test $ac_cv_lib_pcre_pcre_exec = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBPCRE 1 +_ACEOF + + LIBS="-lpcre $LIBS" + +fi + +fi + +ac_config_files="$ac_config_files Makefile lib/Makefile lib/posix/Makefile src/Makefile tests/Makefile po/Makefile.in intl/Makefile doc/Makefile m4/Makefile vms/Makefile bootstrap/Makefile" + +ac_config_commands="$ac_config_commands default" + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 +echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + *) $as_unset $ac_var ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + test "x$cache_file" != "x/dev/null" && + { echo "$as_me:$LINENO: updating cache $cache_file" >&5 +echo "$as_me: updating cache $cache_file" >&6;} + cat confcache >$cache_file + else + { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 +echo "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false +SHELL=\${CONFIG_SHELL-$SHELL} +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + + +# PATH needs CR +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +as_nl=' +' +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + { (exit 1); exit 1; } +fi + +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# CDPATH. +$as_unset CDPATH + + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, and appends + # trailing '-' during substitution so that $LINENO is not a special + # case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # scripts with optimization help from Paolo Bonzini. Blame Lee + # E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; +esac + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir +fi +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +# Find out whether ``test -x'' works. Don't use a zero-byte file, as +# systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + as_executable_p="test -x" +else + as_executable_p=: +fi +rm -f conf$$.file + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 + +# Save the log message, to keep $[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by GNU grep $as_me 2.5.2, which was +generated by GNU Autoconf 2.60. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +# Files that config.status was made for. +config_files="$ac_config_files" +config_headers="$ac_config_headers" +config_commands="$ac_config_commands" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to ." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +GNU grep config.status 2.5.2 +configured by $0, generated by GNU Autoconf 2.60, + with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" + +Copyright (C) 2006 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +MKDIR_P='$MKDIR_P' +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + echo "$ac_cs_version"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + { echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) { echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +if \$ac_cs_recheck; then + echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 + CONFIG_SHELL=$SHELL + export CONFIG_SHELL + exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +# +# INIT-COMMANDS +# +AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" + + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h:config.hin" ;; + "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "default-1") CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "lib/Makefile") CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;; + "lib/posix/Makefile") CONFIG_FILES="$CONFIG_FILES lib/posix/Makefile" ;; + "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; + "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; + "po/Makefile.in") CONFIG_FILES="$CONFIG_FILES po/Makefile.in" ;; + "intl/Makefile") CONFIG_FILES="$CONFIG_FILES intl/Makefile" ;; + "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; + "m4/Makefile") CONFIG_FILES="$CONFIG_FILES m4/Makefile" ;; + "vms/Makefile") CONFIG_FILES="$CONFIG_FILES vms/Makefile" ;; + "bootstrap/Makefile") CONFIG_FILES="$CONFIG_FILES bootstrap/Makefile" ;; + "default") CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;; + + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= + trap 'exit_status=$? + { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status +' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || +{ + echo "$me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +# +# Set up the sed scripts for CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "$CONFIG_FILES"; then + +_ACEOF + + + +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + cat >conf$$subs.sed <<_ACEOF +SHELL!$SHELL$ac_delim +PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim +PACKAGE_NAME!$PACKAGE_NAME$ac_delim +PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim +PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim +PACKAGE_STRING!$PACKAGE_STRING$ac_delim +PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim +exec_prefix!$exec_prefix$ac_delim +prefix!$prefix$ac_delim +program_transform_name!$program_transform_name$ac_delim +bindir!$bindir$ac_delim +sbindir!$sbindir$ac_delim +libexecdir!$libexecdir$ac_delim +datarootdir!$datarootdir$ac_delim +datadir!$datadir$ac_delim +sysconfdir!$sysconfdir$ac_delim +sharedstatedir!$sharedstatedir$ac_delim +localstatedir!$localstatedir$ac_delim +includedir!$includedir$ac_delim +oldincludedir!$oldincludedir$ac_delim +docdir!$docdir$ac_delim +infodir!$infodir$ac_delim +htmldir!$htmldir$ac_delim +dvidir!$dvidir$ac_delim +pdfdir!$pdfdir$ac_delim +psdir!$psdir$ac_delim +libdir!$libdir$ac_delim +localedir!$localedir$ac_delim +mandir!$mandir$ac_delim +DEFS!$DEFS$ac_delim +ECHO_C!$ECHO_C$ac_delim +ECHO_N!$ECHO_N$ac_delim +ECHO_T!$ECHO_T$ac_delim +LIBS!$LIBS$ac_delim +build_alias!$build_alias$ac_delim +host_alias!$host_alias$ac_delim +target_alias!$target_alias$ac_delim +INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim +INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim +INSTALL_DATA!$INSTALL_DATA$ac_delim +am__isrc!$am__isrc$ac_delim +CYGPATH_W!$CYGPATH_W$ac_delim +PACKAGE!$PACKAGE$ac_delim +VERSION!$VERSION$ac_delim +ACLOCAL!$ACLOCAL$ac_delim +AUTOCONF!$AUTOCONF$ac_delim +AUTOMAKE!$AUTOMAKE$ac_delim +AUTOHEADER!$AUTOHEADER$ac_delim +MAKEINFO!$MAKEINFO$ac_delim +install_sh!$install_sh$ac_delim +STRIP!$STRIP$ac_delim +INSTALL_STRIP_PROGRAM!$INSTALL_STRIP_PROGRAM$ac_delim +mkdir_p!$mkdir_p$ac_delim +AWK!$AWK$ac_delim +SET_MAKE!$SET_MAKE$ac_delim +am__leading_dot!$am__leading_dot$ac_delim +AMTAR!$AMTAR$ac_delim +am__tar!$am__tar$ac_delim +am__untar!$am__untar$ac_delim +build!$build$ac_delim +build_cpu!$build_cpu$ac_delim +build_vendor!$build_vendor$ac_delim +build_os!$build_os$ac_delim +host!$host$ac_delim +host_cpu!$host_cpu$ac_delim +host_vendor!$host_vendor$ac_delim +host_os!$host_os$ac_delim +CC!$CC$ac_delim +CFLAGS!$CFLAGS$ac_delim +LDFLAGS!$LDFLAGS$ac_delim +CPPFLAGS!$CPPFLAGS$ac_delim +ac_ct_CC!$ac_ct_CC$ac_delim +EXEEXT!$EXEEXT$ac_delim +OBJEXT!$OBJEXT$ac_delim +DEPDIR!$DEPDIR$ac_delim +am__include!$am__include$ac_delim +am__quote!$am__quote$ac_delim +AMDEP_TRUE!$AMDEP_TRUE$ac_delim +AMDEP_FALSE!$AMDEP_FALSE$ac_delim +AMDEPBACKSLASH!$AMDEPBACKSLASH$ac_delim +CCDEPMODE!$CCDEPMODE$ac_delim +am__fastdepCC_TRUE!$am__fastdepCC_TRUE$ac_delim +am__fastdepCC_FALSE!$am__fastdepCC_FALSE$ac_delim +RANLIB!$RANLIB$ac_delim +GETCONF!$GETCONF$ac_delim +CPP!$CPP$ac_delim +GREP!$GREP$ac_delim +EGREP!$EGREP$ac_delim +U!$U$ac_delim +ANSI2KNR!$ANSI2KNR$ac_delim +ALLOCA!$ALLOCA$ac_delim +LIBOBJS!$LIBOBJS$ac_delim +GLIBC21!$GLIBC21$ac_delim +LIBICONV!$LIBICONV$ac_delim +USE_NLS!$USE_NLS$ac_delim +MSGFMT!$MSGFMT$ac_delim +GMSGFMT!$GMSGFMT$ac_delim +_ACEOF + + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then + break + elif $ac_last_try; then + { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` +if test -n "$ac_eof"; then + ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` + ac_eof=`expr $ac_eof + 1` +fi + +cat >>$CONFIG_STATUS <<_ACEOF +cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +_ACEOF +sed ' +s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g +s/^/s,@/; s/!/@,|#_!!_#|/ +:n +t n +s/'"$ac_delim"'$/,g/; t +s/$/\\/; p +N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n +' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF +CEOF$ac_eof +_ACEOF + + +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + cat >conf$$subs.sed <<_ACEOF +XGETTEXT!$XGETTEXT$ac_delim +INTLBISON!$INTLBISON$ac_delim +BUILD_INCLUDED_LIBINTL!$BUILD_INCLUDED_LIBINTL$ac_delim +USE_INCLUDED_LIBINTL!$USE_INCLUDED_LIBINTL$ac_delim +CATALOGS!$CATALOGS$ac_delim +CATOBJEXT!$CATOBJEXT$ac_delim +GMOFILES!$GMOFILES$ac_delim +INTLLIBS!$INTLLIBS$ac_delim +INTLOBJS!$INTLOBJS$ac_delim +POFILES!$POFILES$ac_delim +POSUB!$POSUB$ac_delim +DATADIRNAME!$DATADIRNAME$ac_delim +INSTOBJEXT!$INSTOBJEXT$ac_delim +GENCAT!$GENCAT$ac_delim +MKINSTALLDIRS!$MKINSTALLDIRS$ac_delim +INTL_LIBTOOL_SUFFIX_PREFIX!$INTL_LIBTOOL_SUFFIX_PREFIX$ac_delim +SEP!$SEP$ac_delim +LTLIBOBJS!$LTLIBOBJS$ac_delim +_ACEOF + + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 18; then + break + elif $ac_last_try; then + { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` +if test -n "$ac_eof"; then + ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` + ac_eof=`expr $ac_eof + 1` +fi + +cat >>$CONFIG_STATUS <<_ACEOF +cat >"\$tmp/subs-2.sed" <<\CEOF$ac_eof +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end +_ACEOF +sed ' +s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g +s/^/s,@/; s/!/@,|#_!!_#|/ +:n +t n +s/'"$ac_delim"'$/,g/; t +s/$/\\/; p +N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n +' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF +:end +s/|#_!!_#|//g +CEOF$ac_eof +_ACEOF + + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/ +s/:*\${srcdir}:*/:/ +s/:*@srcdir@:*/:/ +s/^\([^=]*=[ ]*\):*/\1/ +s/:*$// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF +fi # test -n "$CONFIG_FILES" + + +for ac_tag in :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 +echo "$as_me: error: Invalid tag $ac_tag." >&2;} + { (exit 1); exit 1; }; };; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 +echo "$as_me: error: cannot find input file: $ac_f" >&2;} + { (exit 1); exit 1; }; };; + esac + ac_file_inputs="$ac_file_inputs $ac_f" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input="Generated from "`IFS=: + echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + fi + + case $ac_tag in + *:-:* | *:-) cat >"$tmp/stdin";; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + { as_dir="$ac_dir" + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 +echo "$as_me: error: cannot create directory $as_dir" >&2;} + { (exit 1); exit 1; }; }; } + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac + ac_MKDIR_P=$MKDIR_P + case $MKDIR_P in + [\\/$]* | ?:[\\/]* ) ;; + */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; + esac +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= + +case `sed -n '/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p +' $ac_file_inputs` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF + sed "$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s&@configure_input@&$configure_input&;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +s&@MKDIR_P@&$ac_MKDIR_P&;t t +$ac_datarootdir_hack +" $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" >$tmp/out + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&5 +echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&2;} + + rm -f "$tmp/stdin" + case $ac_file in + -) cat "$tmp/out"; rm -f "$tmp/out";; + *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; + esac + ;; + :H) + # + # CONFIG_HEADER + # +_ACEOF + +# Transform confdefs.h into a sed script `conftest.defines', that +# substitutes the proper values into config.h.in to produce config.h. +rm -f conftest.defines conftest.tail +# First, append a space to every undef/define line, to ease matching. +echo 's/$/ /' >conftest.defines +# Then, protect against being on the right side of a sed subst, or in +# an unquoted here document, in config.status. If some macros were +# called several times there might be several #defines for the same +# symbol, which is useless. But do not sort them, since the last +# AC_DEFINE must be honored. +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +# These sed commands are passed to sed as "A NAME B PARAMS C VALUE D", where +# NAME is the cpp macro being defined, VALUE is the value it is being given. +# PARAMS is the parameter list in the macro definition--in most cases, it's +# just an empty string. +ac_dA='s,^\\([ #]*\\)[^ ]*\\([ ]*' +ac_dB='\\)[ (].*,\\1define\\2' +ac_dC=' ' +ac_dD=' ,' + +uniq confdefs.h | + sed -n ' + t rset + :rset + s/^[ ]*#[ ]*define[ ][ ]*// + t ok + d + :ok + s/[\\&,]/\\&/g + s/^\('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/ '"$ac_dA"'\1'"$ac_dB"'\2'"${ac_dC}"'\3'"$ac_dD"'/p + s/^\('"$ac_word_re"'\)[ ]*\(.*\)/'"$ac_dA"'\1'"$ac_dB$ac_dC"'\2'"$ac_dD"'/p + ' >>conftest.defines + +# Remove the space that was appended to ease matching. +# Then replace #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +# (The regexp can be short, since the line contains either #define or #undef.) +echo 's/ $// +s,^[ #]*u.*,/* & */,' >>conftest.defines + +# Break up conftest.defines: +ac_max_sed_lines=50 + +# First sed command is: sed -f defines.sed $ac_file_inputs >"$tmp/out1" +# Second one is: sed -f defines.sed "$tmp/out1" >"$tmp/out2" +# Third one will be: sed -f defines.sed "$tmp/out2" >"$tmp/out1" +# et cetera. +ac_in='$ac_file_inputs' +ac_out='"$tmp/out1"' +ac_nxt='"$tmp/out2"' + +while : +do + # Write a here document: + cat >>$CONFIG_STATUS <<_ACEOF + # First, check the format of the line: + cat >"\$tmp/defines.sed" <<\\CEOF +/^[ ]*#[ ]*undef[ ][ ]*$ac_word_re[ ]*\$/b def +/^[ ]*#[ ]*define[ ][ ]*$ac_word_re[( ]/b def +b +:def +_ACEOF + sed ${ac_max_sed_lines}q conftest.defines >>$CONFIG_STATUS + echo 'CEOF + sed -f "$tmp/defines.sed"' "$ac_in >$ac_out" >>$CONFIG_STATUS + ac_in=$ac_out; ac_out=$ac_nxt; ac_nxt=$ac_in + sed 1,${ac_max_sed_lines}d conftest.defines >conftest.tail + grep . conftest.tail >/dev/null || break + rm -f conftest.defines + mv conftest.tail conftest.defines +done +rm -f conftest.defines conftest.tail + +echo "ac_result=$ac_in" >>$CONFIG_STATUS +cat >>$CONFIG_STATUS <<\_ACEOF + if test x"$ac_file" != x-; then + echo "/* $configure_input */" >"$tmp/config.h" + cat "$ac_result" >>"$tmp/config.h" + if diff $ac_file "$tmp/config.h" >/dev/null 2>&1; then + { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 +echo "$as_me: $ac_file is unchanged" >&6;} + else + rm -f $ac_file + mv "$tmp/config.h" $ac_file + fi + else + echo "/* $configure_input */" + cat "$ac_result" + fi + rm -f "$tmp/out12" +# Compute $ac_file's index in $config_headers. +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $ac_file | $ac_file:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $ac_file" >`$as_dirname -- $ac_file || +$as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X$ac_file : 'X\(//\)[^/]' \| \ + X$ac_file : 'X\(//\)$' \| \ + X$ac_file : 'X\(/\)' \| . 2>/dev/null || +echo X$ac_file | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'`/stamp-h$_am_stamp_count + ;; + + :C) { echo "$as_me:$LINENO: executing $ac_file commands" >&5 +echo "$as_me: executing $ac_file commands" >&6;} + ;; + esac + + + case $ac_file$ac_mode in + "config.h":H) # update the timestamp +echo timestamp >"./stamp-h1" + ;; + "depfiles":C) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # Grep'ing the whole file is not good either: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + if sed 10q "$mf" | grep '^#.*generated by automake' > /dev/null 2>&1; then + dirpart=`$as_dirname -- "$mf" || +$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$mf" : 'X\(//\)[^/]' \| \ + X"$mf" : 'X\(//\)$' \| \ + X"$mf" : 'X\(/\)' \| . 2>/dev/null || +echo X"$mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`$as_dirname -- "$file" || +$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$file" : 'X\(//\)[^/]' \| \ + X"$file" : 'X\(//\)$' \| \ + X"$file" : 'X\(/\)' \| . 2>/dev/null || +echo X"$file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + { as_dir=$dirpart/$fdir + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 +echo "$as_me: error: cannot create directory $as_dir" >&2;} + { (exit 1); exit 1; }; }; } + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done + ;; + "default-1":C) for ac_file in $CONFIG_FILES; do + # Support "outfile[:infile[:infile...]]" + case "$ac_file" in + *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + esac + # PO directories have a Makefile.in generated from Makefile.in.in. + case "$ac_file" in */Makefile.in) + # Adjust a relative srcdir. + ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` + ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" + ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` + # In autoconf-2.13 it is called $ac_given_srcdir. + # In autoconf-2.50 it is called $srcdir. + test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" + case "$ac_given_srcdir" in + .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; + /*) top_srcdir="$ac_given_srcdir" ;; + *) top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then + rm -f "$ac_dir/POTFILES" + test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" + sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," -e "\$s/\(.*\) \\\\/\1/" < "$ac_given_srcdir/$ac_dir/POTFILES.in" > "$ac_dir/POTFILES" + test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" + sed -e "/POTFILES =/r $ac_dir/POTFILES" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" + fi + ;; + esac + done ;; + "default":C) sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile; echo timestamp > stamp-h ;; + + esac +done # for ac_tag + + +{ (exit 0); exit 0; } +_ACEOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi + diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..73b6bff --- /dev/null +++ b/configure.ac @@ -0,0 +1,170 @@ +dnl +dnl autoconf input file for ``GNU grep'' +dnl +dnl Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +dnl 2005, 2006 the Free Software Foundation, Inc. +dnl +dnl This file is part of GNU grep. +dnl +dnl GNU grep is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2 of the License, or +dnl (at your option) any later version. +dnl +dnl GNU grep is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License along +dnl with this program; if not, write to the Free Software Foundation, Inc., +dnl 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA +dnl +dnl Authors: +dnl Alain Magloire +dnl Bernhard Rosenkraenzer +dnl Stepan Kasal +dnl + +AC_INIT(GNU grep, 2.5.2, bug-grep@gnu.org, grep) +AC_CONFIG_SRCDIR(src/grep.c) +AC_DEFINE(GREP, 1, [We are building grep]) +AC_PREREQ(2.53) + +dnl Automake stuff. +AM_INIT_AUTOMAKE(dist-bzip2) +AM_CONFIG_HEADER(config.h:config.hin) + +dnl Check for arguments +AC_ARG_ENABLE(perl-regexp, + [ --disable-perl-regexp disable perl-regexp], + [case "${enableval}" in + yes) testpcre=yes ;; + no) testpcre=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for --disable-perl-regexp) ;; + esac],[testpcre=yes]) + +dnl Checks for programs. +AC_CANONICAL_HOST +AC_PROG_AWK +AC_PROG_CC +AC_PROG_INSTALL +AC_PROG_RANLIB + +dnl Checks for typedefs, structures, and compiler characteristics. +AC_SYS_LARGEFILE +AM_C_PROTOTYPES +AC_TYPE_SIZE_T +AC_CHECK_TYPE(ssize_t, int) +AC_C_CONST +jm_AC_TYPE_UINTMAX_T + +dnl Checks for header files. +AC_HEADER_STDC +AC_CHECK_HEADERS(string.h stdlib.h sys/param.h memory.h unistd.h libintl.h) +AC_CHECK_HEADERS(wctype.h wchar.h) +AC_HEADER_DIRENT +AC_HEADER_STAT + +dnl Checks for functions. +AC_FUNC_ALLOCA +AC_FUNC_CLOSEDIR_VOID +AC_FUNC_MMAP + +dnl getpagesize is checked for by AC_FUNC_MMAP. +AC_CHECK_FUNCS(btowc isascii iswctype mbrlen memmove setmode strerror wcrtomb wcscoll wctype) +# We can use mbrtowc only if we have mbstate_t. +AC_FUNC_MBRTOWC +# Yet we need a mbstate_t stub in every case. +AC_MBSTATE_T +AC_REPLACE_FUNCS(memchr stpcpy strtoul atexit fnmatch) +jm_AC_PREREQ_XSTRTOUMAX + +dnl Replace this with jm_CHECK_DECLS once autoconf 2.15 is out. +jm_CHECK_DECLARATIONS([#include ], [strtoul strtoull]) +test $jm_cv_func_decl_strtoul != yes +AC_DEFINE_UNQUOTED([HAVE_DECL_STRTOUL], $?, + [Define if declares strtoul.]) +test $jm_cv_func_decl_strtoull != yes +AC_DEFINE_UNQUOTED([HAVE_DECL_STRTOULL], $?, + [Define if declares strtoull.]) + +dnl for VC++ +case "$ac_cv_prog_CC" in + cl*) AC_DEFINE([alloca], _alloca, [Define if your compiler is broken]) ;; + *) ;; +esac + +dnl I18N feature +ALL_LINGUAS="af be bg ca cs da de el eo es et eu fi fr ga gl he hr hu id it ja ko nb nl no pl pt_BR pt ro ru rw sl sr sv tr uk vi zh_TW" +AM_GNU_GETTEXT + +dnl DOS file name convention +dnl sets HAVE_DOS_FILE_NAMES +AC_DOSFILE + +dnl check for the environ separator +dnl sets SEP +AM_SEP + +dnl OS specifics +dnl sets {EXE,OBJ}EXT +AC_EXEEXT +dnl Invoke the (capitalized) ac_objext macro without spelling its name. +dnl This works around a bug in automake 1.4 with ansi2knr. +dnl Automake looks for (capitalized) ac_objext by grepping for it, +dnl so it won't find it in this file. +ifelse(,, [AC][_OBJEXT]) + +dnl some folks ask for this, that's fine by me +dnl hope they know what they're doing ... +dnl if glibc2 regex is not included + +dnl Many GNU/Linux people have different +dnl glibc versions with buggy regex. +jm_INCLUDED_REGEX(lib/regex.c) + +dnl Many people on non-GNU/Linux systems don't have getopt +AC_CHECK_FUNC(getopt_long, + [ + AC_ARG_WITH(included-getopt, + [ --with-included-getopt Use the included getopt rather than glibc's], + with_getopt=$withval, + with_getopt=$no) + if test "x$with_getopt" = xyes; then + AC_LIBOBJ(getopt) + AC_LIBOBJ(getopt1) + fi + ], + [ + AC_LIBOBJ(getopt) + AC_LIBOBJ(getopt1) + ]) + +dnl Some installers want to be informed if we do not use our regex. +dnl For example, if the host platform uses dynamic linking and the installer +dnl knows that the grep may be invoked on other hosts with buggy libraries, +dnl then the installer should configure --with-included-regex. +if test "$jm_with_regex" = no; then + AC_MSG_WARN(Included lib/regex.c not used) +fi + +dnl These are the prerequisite macros for GNU's error.c file. +AC_FUNC_STRERROR_R +jm_PREREQ_ERROR + +dnl Determine whether malloc accepts 0 as its argument. +dnl If it doesn't, arrange to use the replacement function. +jm_FUNC_MALLOC +jm_FUNC_REALLOC + +# support for pcre +if test x"$testpcre" = x"yes"; then + if pcre-config --cflags >/dev/null 2>&1; then + CFLAGS="$CFLAGS `pcre-config --cflags`" + LIBS="$LIBS `pcre-config --libs`" + fi + AC_CHECK_LIB(pcre, pcre_exec) +fi + +AC_OUTPUT(Makefile lib/Makefile lib/posix/Makefile src/Makefile tests/Makefile po/Makefile.in intl/Makefile doc/Makefile m4/Makefile vms/Makefile bootstrap/Makefile, [sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile; echo timestamp > stamp-h]) diff --git a/configure.ac.in b/configure.ac.in new file mode 100644 index 0000000..6400fef --- /dev/null +++ b/configure.ac.in @@ -0,0 +1,170 @@ +dnl +dnl autoconf input file for ``GNU grep'' +dnl +dnl Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +dnl 2005, 2006 the Free Software Foundation, Inc. +dnl +dnl This file is part of GNU grep. +dnl +dnl GNU grep is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2 of the License, or +dnl (at your option) any later version. +dnl +dnl GNU grep is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License along +dnl with this program; if not, write to the Free Software Foundation, Inc., +dnl 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA +dnl +dnl Authors: +dnl Alain Magloire +dnl Bernhard Rosenkraenzer +dnl Stepan Kasal +dnl + +AC_INIT(GNU grep, 2.5.2, bug-grep@gnu.org, grep) +AC_CONFIG_SRCDIR(src/grep.c) +AC_DEFINE(GREP, 1, [We are building grep]) +AC_PREREQ(2.53) + +dnl Automake stuff. +AM_INIT_AUTOMAKE(dist-bzip2) +AM_CONFIG_HEADER(config.h:config.hin) + +dnl Check for arguments +AC_ARG_ENABLE(perl-regexp, + [ --disable-perl-regexp disable perl-regexp], + [case "${enableval}" in + yes) testpcre=yes ;; + no) testpcre=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for --disable-perl-regexp) ;; + esac],[testpcre=yes]) + +dnl Checks for programs. +AC_CANONICAL_HOST +AC_PROG_AWK +AC_PROG_CC +AC_PROG_INSTALL +AC_PROG_RANLIB + +dnl Checks for typedefs, structures, and compiler characteristics. +AC_SYS_LARGEFILE +AM_C_PROTOTYPES +AC_TYPE_SIZE_T +AC_CHECK_TYPE(ssize_t, int) +AC_C_CONST +jm_AC_TYPE_UINTMAX_T + +dnl Checks for header files. +AC_HEADER_STDC +AC_CHECK_HEADERS(string.h stdlib.h sys/param.h memory.h unistd.h libintl.h) +AC_CHECK_HEADERS(wctype.h wchar.h) +AC_HEADER_DIRENT +AC_HEADER_STAT + +dnl Checks for functions. +AC_FUNC_ALLOCA +AC_FUNC_CLOSEDIR_VOID +AC_FUNC_MMAP + +dnl getpagesize is checked for by AC_FUNC_MMAP. +AC_CHECK_FUNCS(btowc isascii iswctype mbrlen memmove setmode strerror wcrtomb wcscoll wctype) +# We can use mbrtowc only if we have mbstate_t. +AC_FUNC_MBRTOWC +# Yet we need a mbstate_t stub in every case. +AC_MBSTATE_T +AC_REPLACE_FUNCS(memchr stpcpy strtoul atexit fnmatch) +jm_AC_PREREQ_XSTRTOUMAX + +dnl Replace this with jm_CHECK_DECLS once autoconf 2.15 is out. +jm_CHECK_DECLARATIONS([#include ], [strtoul strtoull]) +test $jm_cv_func_decl_strtoul != yes +AC_DEFINE_UNQUOTED([HAVE_DECL_STRTOUL], $?, + [Define if declares strtoul.]) +test $jm_cv_func_decl_strtoull != yes +AC_DEFINE_UNQUOTED([HAVE_DECL_STRTOULL], $?, + [Define if declares strtoull.]) + +dnl for VC++ +case "$ac_cv_prog_CC" in + cl*) AC_DEFINE([alloca], _alloca, [Define if your compiler is broken]) ;; + *) ;; +esac + +dnl I18N feature +ALL_LINGUAS="@ALL_LINGUAS@" +AM_GNU_GETTEXT + +dnl DOS file name convention +dnl sets HAVE_DOS_FILE_NAMES +AC_DOSFILE + +dnl check for the environ separator +dnl sets SEP +AM_SEP + +dnl OS specifics +dnl sets {EXE,OBJ}EXT +AC_EXEEXT +dnl Invoke the (capitalized) ac_objext macro without spelling its name. +dnl This works around a bug in automake 1.4 with ansi2knr. +dnl Automake looks for (capitalized) ac_objext by grepping for it, +dnl so it won't find it in this file. +ifelse(,, [AC][_OBJEXT]) + +dnl some folks ask for this, that's fine by me +dnl hope they know what they're doing ... +dnl if glibc2 regex is not included + +dnl Many GNU/Linux people have different +dnl glibc versions with buggy regex. +jm_INCLUDED_REGEX(lib/regex.c) + +dnl Many people on non-GNU/Linux systems don't have getopt +AC_CHECK_FUNC(getopt_long, + [ + AC_ARG_WITH(included-getopt, + [ --with-included-getopt Use the included getopt rather than glibc's], + with_getopt=$withval, + with_getopt=$no) + if test "x$with_getopt" = xyes; then + AC_LIBOBJ(getopt) + AC_LIBOBJ(getopt1) + fi + ], + [ + AC_LIBOBJ(getopt) + AC_LIBOBJ(getopt1) + ]) + +dnl Some installers want to be informed if we do not use our regex. +dnl For example, if the host platform uses dynamic linking and the installer +dnl knows that the grep may be invoked on other hosts with buggy libraries, +dnl then the installer should configure --with-included-regex. +if test "$jm_with_regex" = no; then + AC_MSG_WARN(Included lib/regex.c not used) +fi + +dnl These are the prerequisite macros for GNU's error.c file. +AC_FUNC_STRERROR_R +jm_PREREQ_ERROR + +dnl Determine whether malloc accepts 0 as its argument. +dnl If it doesn't, arrange to use the replacement function. +jm_FUNC_MALLOC +jm_FUNC_REALLOC + +# support for pcre +if test x"$testpcre" = x"yes"; then + if pcre-config --cflags >/dev/null 2>&1; then + CFLAGS="$CFLAGS `pcre-config --cflags`" + LIBS="$LIBS `pcre-config --libs`" + fi + AC_CHECK_LIB(pcre, pcre_exec) +fi + +AC_OUTPUT(Makefile lib/Makefile lib/posix/Makefile src/Makefile tests/Makefile po/Makefile.in intl/Makefile doc/Makefile m4/Makefile vms/Makefile bootstrap/Makefile, [sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile; echo timestamp > stamp-h]) diff --git a/depcomp b/depcomp new file mode 100755 index 0000000..ca5ea4e --- /dev/null +++ b/depcomp @@ -0,0 +1,584 @@ +#! /bin/sh +# depcomp - compile a program generating dependencies as side-effects + +scriptversion=2006-10-15.18 + +# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006 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., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Alexandre Oliva . + +case $1 in + '') + echo "$0: No command. Try \`$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: depcomp [--help] [--version] PROGRAM [ARGS] + +Run PROGRAMS ARGS to compile a file, generating dependencies +as side-effects. + +Environment variables: + depmode Dependency tracking mode. + source Source file read by `PROGRAMS ARGS'. + object Object file output by `PROGRAMS ARGS'. + DEPDIR directory where to store dependencies. + depfile Dependency file to output. + tmpdepfile Temporary file to use when outputing dependencies. + libtool Whether libtool is used (yes/no). + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "depcomp $scriptversion" + exit $? + ;; +esac + +if test -z "$depmode" || test -z "$source" || test -z "$object"; then + echo "depcomp: Variables source, object and depmode must be set" 1>&2 + exit 1 +fi + +# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. +depfile=${depfile-`echo "$object" | + sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} +tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} + +rm -f "$tmpdepfile" + +# Some modes work just like other modes, but use different flags. We +# parameterize here, but still list the modes in the big case below, +# to make depend.m4 easier to write. Note that we *cannot* use a case +# here, because this file can only contain one case statement. +if test "$depmode" = hp; then + # HP compiler uses -M and no extra arg. + gccflag=-M + depmode=gcc +fi + +if test "$depmode" = dashXmstdout; then + # This is just like dashmstdout with a different argument. + dashmflag=-xM + depmode=dashmstdout +fi + +case "$depmode" in +gcc3) +## gcc 3 implements dependency tracking that does exactly what +## we want. Yay! Note: for some reason libtool 1.4 doesn't like +## it if -MD -MP comes after the -MF stuff. Hmm. +## Unfortunately, FreeBSD c89 acceptance of flags depends upon +## the command line argument order; so add the flags where they +## appear in depend2.am. Note that the slowdown incurred here +## affects only configure: in makefiles, %FASTDEP% shortcuts this. + for arg + do + case $arg in + -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; + *) set fnord "$@" "$arg" ;; + esac + shift # fnord + shift # $arg + done + "$@" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + mv "$tmpdepfile" "$depfile" + ;; + +gcc) +## There are various ways to get dependency output from gcc. Here's +## why we pick this rather obscure method: +## - Don't want to use -MD because we'd like the dependencies to end +## up in a subdir. Having to rename by hand is ugly. +## (We might end up doing this anyway to support other compilers.) +## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like +## -MM, not -M (despite what the docs say). +## - Using -M directly means running the compiler twice (even worse +## than renaming). + if test -z "$gccflag"; then + gccflag=-MD, + fi + "$@" -Wp,"$gccflag$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz +## The second -e expression handles DOS-style file names with drive letters. + sed -e 's/^[^:]*: / /' \ + -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" +## This next piece of magic avoids the `deleted header file' problem. +## The problem is that when a header file which appears in a .P file +## is deleted, the dependency causes make to die (because there is +## typically no way to rebuild the header). We avoid this by adding +## dummy dependencies for each header file. Too bad gcc doesn't do +## this for us directly. + tr ' ' ' +' < "$tmpdepfile" | +## Some versions of gcc put a space before the `:'. On the theory +## that the space means something, we add a space to the output as +## well. +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +sgi) + if test "$libtool" = yes; then + "$@" "-Wp,-MDupdate,$tmpdepfile" + else + "$@" -MDupdate "$tmpdepfile" + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + + if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files + echo "$object : \\" > "$depfile" + + # Clip off the initial element (the dependent). Don't try to be + # clever and replace this with sed code, as IRIX sed won't handle + # lines with more than a fixed number of characters (4096 in + # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; + # the IRIX cc adds comments like `#:fec' to the end of the + # dependency line. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ + tr ' +' ' ' >> $depfile + echo >> $depfile + + # The second pass generates a dummy entry for each header file. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> $depfile + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +aix) + # The C for AIX Compiler uses -M and outputs the dependencies + # in a .u file. In older versions, this file always lives in the + # current directory. Also, the AIX compiler puts `$object:' at the + # start of each line; $object doesn't have directory information. + # Version 6 uses the directory in both cases. + stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` + tmpdepfile="$stripped.u" + if test "$libtool" = yes; then + "$@" -Wc,-M + else + "$@" -M + fi + stat=$? + + if test -f "$tmpdepfile"; then : + else + stripped=`echo "$stripped" | sed 's,^.*/,,'` + tmpdepfile="$stripped.u" + fi + + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + + if test -f "$tmpdepfile"; then + outname="$stripped.o" + # Each line is of the form `foo.o: dependent.h'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" + sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +icc) + # Intel's C compiler understands `-MD -MF file'. However on + # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c + # ICC 7.0 will fill foo.d with something like + # foo.o: sub/foo.c + # foo.o: sub/foo.h + # which is wrong. We want: + # sub/foo.o: sub/foo.c + # sub/foo.o: sub/foo.h + # sub/foo.c: + # sub/foo.h: + # ICC 7.1 will output + # foo.o: sub/foo.c sub/foo.h + # and will wrap long lines using \ : + # foo.o: sub/foo.c ... \ + # sub/foo.h ... \ + # ... + + "$@" -MD -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + # Each line is of the form `foo.o: dependent.h', + # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process this invocation + # correctly. Breaking it into two sed invocations is a workaround. + sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | + sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp2) + # The "hp" stanza above does not work with aCC (C++) and HP's ia64 + # compilers, which have integrated preprocessors. The correct option + # to use with these is +Maked; it writes dependencies to a file named + # 'foo.d', which lands next to the object file, wherever that + # happens to be. + # Much of this is similar to the tru64 case; see comments there. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + if test "$libtool" = yes; then + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir.libs/$base.d + "$@" -Wc,+Maked + else + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir$base.d + "$@" +Maked + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" + # Add `dependent.h:' lines. + sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" "$tmpdepfile2" + ;; + +tru64) + # The Tru64 compiler uses -MD to generate dependencies as a side + # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put + # dependencies in `foo.d' instead, so we check for that too. + # Subdirectories are respected. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + + if test "$libtool" = yes; then + # With Tru64 cc, shared objects can also be used to make a + # static library. This mechanism is used in libtool 1.4 series to + # handle both shared and static libraries in a single compilation. + # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. + # + # With libtool 1.5 this exception was removed, and libtool now + # generates 2 separate objects for the 2 libraries. These two + # compilations output dependencies in $dir.libs/$base.o.d and + # in $dir$base.o.d. We have to check for both files, because + # one of the two compilations can be disabled. We should prefer + # $dir$base.o.d over $dir.libs/$base.o.d because the latter is + # automatically cleaned when .libs/ is deleted, while ignoring + # the former would cause a distcleancheck panic. + tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 + tmpdepfile2=$dir$base.o.d # libtool 1.5 + tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 + tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 + "$@" -Wc,-MD + else + tmpdepfile1=$dir$base.o.d + tmpdepfile2=$dir$base.d + tmpdepfile3=$dir$base.d + tmpdepfile4=$dir$base.d + "$@" -MD + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a tab and a space in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +#nosideeffect) + # This comment above is used by automake to tell side-effect + # dependency tracking mechanisms from slower ones. + +dashmstdout) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + test -z "$dashmflag" && dashmflag=-M + # Require at least two characters before searching for `:' + # in the target name. This is to cope with DOS-style filenames: + # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. + "$@" $dashmflag | + sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + tr ' ' ' +' < "$tmpdepfile" | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +dashXmstdout) + # This case only exists to satisfy depend.m4. It is never actually + # run, as this mode is specially recognized in the preamble. + exit 1 + ;; + +makedepend) + "$@" || exit $? + # Remove any Libtool call + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + # X makedepend + shift + cleared=no + for arg in "$@"; do + case $cleared in + no) + set ""; shift + cleared=yes ;; + esac + case "$arg" in + -D*|-I*) + set fnord "$@" "$arg"; shift ;; + # Strip any option that makedepend may not understand. Remove + # the object too, otherwise makedepend will parse it as a source file. + -*|$object) + ;; + *) + set fnord "$@" "$arg"; shift ;; + esac + done + obj_suffix="`echo $object | sed 's/^.*\././'`" + touch "$tmpdepfile" + ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + sed '1,2d' "$tmpdepfile" | tr ' ' ' +' | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" "$tmpdepfile".bak + ;; + +cpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + "$@" -E | + sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ + -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | + sed '$ s: \\$::' > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + cat < "$tmpdepfile" >> "$depfile" + sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvisualcpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o, + # because we must use -o when running libtool. + "$@" || exit $? + IFS=" " + for arg + do + case "$arg" in + "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") + set fnord "$@" + shift + shift + ;; + *) + set fnord "$@" "$arg" + shift + shift + ;; + esac + done + "$@" -E | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" + echo " " >> "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +none) + exec "$@" + ;; + +*) + echo "Unknown depmode $depmode" 1>&2 + exit 1 + ;; +esac + +exit 0 + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/doc/.cvsignore b/doc/.cvsignore new file mode 100644 index 0000000..99a9b4d --- /dev/null +++ b/doc/.cvsignore @@ -0,0 +1,7 @@ +Makefile +Makefile.in +egrep.1 +fgrep.1 +grep.info +stamp-vti +version.texi diff --git a/doc/Makefile.am b/doc/Makefile.am new file mode 100644 index 0000000..b93d96c --- /dev/null +++ b/doc/Makefile.am @@ -0,0 +1,18 @@ +## Process this file with automake to create Makefile.in +AUTOMAKE_OPTIONS=no-dependencies + +info_TEXINFOS = grep.texi + +man_MANS = grep.1 fgrep.1 egrep.1 + +EXTRA_DIST = grep.1 egrep.man fgrep.man + +CLEANFILES = egrep.1 fgrep.1 + +fgrep.1: fgrep.man + inst=`echo "grep" | sed '$(transform)'`.1; \ +sed -e "s%@grep@%$$inst%g" $(srcdir)/fgrep.man > $@ + +egrep.1: egrep.man + inst=`echo "grep" | sed '$(transform)'`.1; \ +sed -e "s%@grep@%$$inst%g" $(srcdir)/egrep.man > $@ diff --git a/doc/Makefile.in b/doc/Makefile.in new file mode 100644 index 0000000..69cd724 --- /dev/null +++ b/doc/Makefile.in @@ -0,0 +1,669 @@ +# Makefile.in generated by automake 1.10 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = doc +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/stamp-vti $(srcdir)/version.texi mdate-sh \ + texinfo.tex +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/codeset.m4 \ + $(top_srcdir)/m4/decl.m4 $(top_srcdir)/m4/djgpp.m4 \ + $(top_srcdir)/m4/dosfile.m4 $(top_srcdir)/m4/envsep.m4 \ + $(top_srcdir)/m4/error.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/header.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/inttypes_h.m4 \ + $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/largefile.m4 \ + $(top_srcdir)/m4/lcmessage.m4 $(top_srcdir)/m4/malloc.m4 \ + $(top_srcdir)/m4/mbstate_t.m4 $(top_srcdir)/m4/missing.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/realloc.m4 \ + $(top_srcdir)/m4/regex.m4 $(top_srcdir)/m4/sanity.m4 \ + $(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/ulonglong.m4 \ + $(top_srcdir)/m4/xstrtoumax.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +depcomp = +am__depfiles_maybe = +SOURCES = +DIST_SOURCES = +INFO_DEPS = $(srcdir)/grep.info +am__TEXINFO_TEX_DIR = $(srcdir) +DVIS = grep.dvi +PDFS = grep.pdf +PSS = grep.ps +HTMLS = grep.html +TEXINFOS = grep.texi +TEXI2DVI = texi2dvi +TEXI2PDF = $(TEXI2DVI) --pdf --batch +MAKEINFOHTML = $(MAKEINFO) --html +AM_MAKEINFOHTMLFLAGS = $(AM_MAKEINFOFLAGS) +DVIPS = dvips +am__installdirs = "$(DESTDIR)$(infodir)" "$(DESTDIR)$(man1dir)" +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +man1dir = $(mandir)/man1 +NROFF = nroff +MANS = $(man_MANS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GENCAT = @GENCAT@ +GETCONF = @GETCONF@ +GLIBC21 = @GLIBC21@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLBISON = @INTLBISON@ +INTLLIBS = @INTLLIBS@ +INTLOBJS = @INTLOBJS@ +INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +POFILES = @POFILES@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SEP = @SEP@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +U = @U@ +USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AUTOMAKE_OPTIONS = no-dependencies +info_TEXINFOS = grep.texi +man_MANS = grep.1 fgrep.1 egrep.1 +EXTRA_DIST = grep.1 egrep.man fgrep.man +CLEANFILES = egrep.1 fgrep.1 +all: all-am + +.SUFFIXES: +.SUFFIXES: .dvi .html .info .pdf .ps .texi +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu doc/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +.texi.info: + restore=: && backupdir="$(am__leading_dot)am$$$$" && \ + am__cwd=`pwd` && cd $(srcdir) && \ + rm -rf $$backupdir && mkdir $$backupdir && \ + if ($(MAKEINFO) --version) >/dev/null 2>&1; then \ + for f in $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9] $(@:.info=).i[0-9][0-9]; do \ + if test -f $$f; then mv $$f $$backupdir; restore=mv; else :; fi; \ + done; \ + else :; fi && \ + cd "$$am__cwd"; \ + if $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \ + -o $@ $<; \ + then \ + rc=0; \ + cd $(srcdir); \ + else \ + rc=$$?; \ + cd $(srcdir) && \ + $$restore $$backupdir/* `echo "./$@" | sed 's|[^/]*$$||'`; \ + fi; \ + rm -rf $$backupdir; exit $$rc + +.texi.dvi: + TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ + MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \ + $(TEXI2DVI) $< + +.texi.pdf: + TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ + MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \ + $(TEXI2PDF) $< + +.texi.html: + rm -rf $(@:.html=.htp) + if $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \ + -o $(@:.html=.htp) $<; \ + then \ + rm -rf $@; \ + if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \ + mv $(@:.html=) $@; else mv $(@:.html=.htp) $@; fi; \ + else \ + if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \ + rm -rf $(@:.html=); else rm -Rf $(@:.html=.htp) $@; fi; \ + exit 1; \ + fi +$(srcdir)/grep.info: grep.texi $(srcdir)/version.texi +grep.dvi: grep.texi $(srcdir)/version.texi +grep.pdf: grep.texi $(srcdir)/version.texi +grep.html: grep.texi $(srcdir)/version.texi +$(srcdir)/version.texi: $(srcdir)/stamp-vti +$(srcdir)/stamp-vti: grep.texi $(top_srcdir)/configure + @(dir=.; test -f ./grep.texi || dir=$(srcdir); \ + set `$(SHELL) $(srcdir)/mdate-sh $$dir/grep.texi`; \ + echo "@set UPDATED $$1 $$2 $$3"; \ + echo "@set UPDATED-MONTH $$2 $$3"; \ + echo "@set EDITION $(VERSION)"; \ + echo "@set VERSION $(VERSION)") > vti.tmp + @cmp -s vti.tmp $(srcdir)/version.texi \ + || (echo "Updating $(srcdir)/version.texi"; \ + cp vti.tmp $(srcdir)/version.texi) + -@rm -f vti.tmp + @cp $(srcdir)/version.texi $@ + +mostlyclean-vti: + -rm -f vti.tmp + +maintainer-clean-vti: + -rm -f $(srcdir)/stamp-vti $(srcdir)/version.texi +.dvi.ps: + TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ + $(DVIPS) -o $@ $< + +uninstall-dvi-am: + @$(NORMAL_UNINSTALL) + @list='$(DVIS)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(dvidir)/$$f'"; \ + rm -f "$(DESTDIR)$(dvidir)/$$f"; \ + done + +uninstall-html-am: + @$(NORMAL_UNINSTALL) + @list='$(HTMLS)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -rf '$(DESTDIR)$(htmldir)/$$f'"; \ + rm -rf "$(DESTDIR)$(htmldir)/$$f"; \ + done + +uninstall-info-am: + @$(PRE_UNINSTALL) + @if test -d '$(DESTDIR)$(infodir)' && \ + (install-info --version && \ + install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \ + list='$(INFO_DEPS)'; \ + for file in $$list; do \ + relfile=`echo "$$file" | sed 's|^.*/||'`; \ + echo " install-info --info-dir='$(DESTDIR)$(infodir)' --remove '$(DESTDIR)$(infodir)/$$relfile'"; \ + install-info --info-dir="$(DESTDIR)$(infodir)" --remove "$(DESTDIR)$(infodir)/$$relfile"; \ + done; \ + else :; fi + @$(NORMAL_UNINSTALL) + @list='$(INFO_DEPS)'; \ + for file in $$list; do \ + relfile=`echo "$$file" | sed 's|^.*/||'`; \ + relfile_i=`echo "$$relfile" | sed 's|\.info$$||;s|$$|.i|'`; \ + (if test -d "$(DESTDIR)$(infodir)" && cd "$(DESTDIR)$(infodir)"; then \ + echo " cd '$(DESTDIR)$(infodir)' && rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]"; \ + rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]; \ + else :; fi); \ + done + +uninstall-pdf-am: + @$(NORMAL_UNINSTALL) + @list='$(PDFS)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(pdfdir)/$$f'"; \ + rm -f "$(DESTDIR)$(pdfdir)/$$f"; \ + done + +uninstall-ps-am: + @$(NORMAL_UNINSTALL) + @list='$(PSS)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(psdir)/$$f'"; \ + rm -f "$(DESTDIR)$(psdir)/$$f"; \ + done + +dist-info: $(INFO_DEPS) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + list='$(INFO_DEPS)'; \ + for base in $$list; do \ + case $$base in \ + $(srcdir)/*) base=`echo "$$base" | sed "s|^$$srcdirstrip/||"`;; \ + esac; \ + if test -f $$base; then d=.; else d=$(srcdir); fi; \ + base_i=`echo "$$base" | sed 's|\.info$$||;s|$$|.i|'`; \ + for file in $$d/$$base $$d/$$base-[0-9] $$d/$$base-[0-9][0-9] $$d/$$base_i[0-9] $$d/$$base_i[0-9][0-9]; do \ + if test -f $$file; then \ + relfile=`expr "$$file" : "$$d/\(.*\)"`; \ + test -f $(distdir)/$$relfile || \ + cp -p $$file $(distdir)/$$relfile; \ + else :; fi; \ + done; \ + done + +mostlyclean-aminfo: + -rm -rf grep.aux grep.cp grep.cps grep.fn grep.fns grep.ky grep.log grep.op \ + grep.pg grep.tmp grep.toc grep.tp grep.vr grep.dvi grep.pdf \ + grep.ps grep.html + +maintainer-clean-aminfo: + @list='$(INFO_DEPS)'; for i in $$list; do \ + i_i=`echo "$$i" | sed 's|\.info$$||;s|$$|.i|'`; \ + echo " rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]"; \ + rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]; \ + done +install-man1: $(man1_MANS) $(man_MANS) + @$(NORMAL_INSTALL) + test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)" + @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ + l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ + for i in $$l2; do \ + case "$$i" in \ + *.1*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ + else file=$$i; fi; \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + case "$$ext" in \ + 1*) ;; \ + *) ext='1' ;; \ + esac; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed -e 's/^.*\///'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \ + done +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ + l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ + for i in $$l2; do \ + case "$$i" in \ + *.1*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + case "$$ext" in \ + 1*) ;; \ + *) ext='1' ;; \ + esac; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed -e 's/^.*\///'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \ + rm -f "$(DESTDIR)$(man1dir)/$$inst"; \ + done +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" distdir="$(distdir)" \ + dist-info +check-am: all-am +check: check-am +all-am: Makefile $(INFO_DEPS) $(MANS) +installdirs: + for dir in "$(DESTDIR)$(infodir)" "$(DESTDIR)$(man1dir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: $(DVIS) + +html: html-am + +html-am: $(HTMLS) + +info: info-am + +info-am: $(INFO_DEPS) + +install-data-am: install-info-am install-man + +install-dvi: install-dvi-am + +install-dvi-am: $(DVIS) + @$(NORMAL_INSTALL) + test -z "$(dvidir)" || $(MKDIR_P) "$(DESTDIR)$(dvidir)" + @list='$(DVIS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(dvidir)/$$f'"; \ + $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(dvidir)/$$f"; \ + done +install-exec-am: + +install-html: install-html-am + +install-html-am: $(HTMLS) + @$(NORMAL_INSTALL) + test -z "$(htmldir)" || $(MKDIR_P) "$(DESTDIR)$(htmldir)" + @list='$(HTMLS)'; for p in $$list; do \ + if test -f "$$p" || test -d "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + if test -d "$$d$$p"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)/$$f'"; \ + $(MKDIR_P) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \ + echo " $(INSTALL_DATA) '$$d$$p'/* '$(DESTDIR)$(htmldir)/$$f'"; \ + $(INSTALL_DATA) "$$d$$p"/* "$(DESTDIR)$(htmldir)/$$f"; \ + else \ + echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(htmldir)/$$f'"; \ + $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(htmldir)/$$f"; \ + fi; \ + done +install-info: install-info-am + +install-info-am: $(INFO_DEPS) + @$(NORMAL_INSTALL) + test -z "$(infodir)" || $(MKDIR_P) "$(DESTDIR)$(infodir)" + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + list='$(INFO_DEPS)'; \ + for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + esac; \ + if test -f $$file; then d=.; else d=$(srcdir); fi; \ + file_i=`echo "$$file" | sed 's|\.info$$||;s|$$|.i|'`; \ + for ifile in $$d/$$file $$d/$$file-[0-9] $$d/$$file-[0-9][0-9] \ + $$d/$$file_i[0-9] $$d/$$file_i[0-9][0-9] ; do \ + if test -f $$ifile; then \ + relfile=`echo "$$ifile" | sed 's|^.*/||'`; \ + echo " $(INSTALL_DATA) '$$ifile' '$(DESTDIR)$(infodir)/$$relfile'"; \ + $(INSTALL_DATA) "$$ifile" "$(DESTDIR)$(infodir)/$$relfile"; \ + else : ; fi; \ + done; \ + done + @$(POST_INSTALL) + @if (install-info --version && \ + install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \ + list='$(INFO_DEPS)'; \ + for file in $$list; do \ + relfile=`echo "$$file" | sed 's|^.*/||'`; \ + echo " install-info --info-dir='$(DESTDIR)$(infodir)' '$(DESTDIR)$(infodir)/$$relfile'";\ + install-info --info-dir="$(DESTDIR)$(infodir)" "$(DESTDIR)$(infodir)/$$relfile" || :;\ + done; \ + else : ; fi +install-man: install-man1 + +install-pdf: install-pdf-am + +install-pdf-am: $(PDFS) + @$(NORMAL_INSTALL) + test -z "$(pdfdir)" || $(MKDIR_P) "$(DESTDIR)$(pdfdir)" + @list='$(PDFS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(pdfdir)/$$f'"; \ + $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(pdfdir)/$$f"; \ + done +install-ps: install-ps-am + +install-ps-am: $(PSS) + @$(NORMAL_INSTALL) + test -z "$(psdir)" || $(MKDIR_P) "$(DESTDIR)$(psdir)" + @list='$(PSS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(psdir)/$$f'"; \ + $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(psdir)/$$f"; \ + done +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-aminfo \ + maintainer-clean-generic maintainer-clean-vti + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-aminfo mostlyclean-generic mostlyclean-vti + +pdf: pdf-am + +pdf-am: $(PDFS) + +ps: ps-am + +ps-am: $(PSS) + +uninstall-am: uninstall-dvi-am uninstall-html-am uninstall-info-am \ + uninstall-man uninstall-pdf-am uninstall-ps-am + +uninstall-man: uninstall-man1 + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic dist-info \ + distclean distclean-generic distdir dvi dvi-am html html-am \ + info info-am install install-am install-data install-data-am \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-html install-html-am install-info install-info-am \ + install-man install-man1 install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-aminfo \ + maintainer-clean-generic maintainer-clean-vti mostlyclean \ + mostlyclean-aminfo mostlyclean-generic mostlyclean-vti pdf \ + pdf-am ps ps-am uninstall uninstall-am uninstall-dvi-am \ + uninstall-html-am uninstall-info-am uninstall-man \ + uninstall-man1 uninstall-pdf-am uninstall-ps-am + + +fgrep.1: fgrep.man + inst=`echo "grep" | sed '$(transform)'`.1; \ +sed -e "s%@grep@%$$inst%g" $(srcdir)/fgrep.man > $@ + +egrep.1: egrep.man + inst=`echo "grep" | sed '$(transform)'`.1; \ +sed -e "s%@grep@%$$inst%g" $(srcdir)/egrep.man > $@ +# 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. +.NOEXPORT: diff --git a/doc/egrep.man b/doc/egrep.man new file mode 100644 index 0000000..877a8a8 --- /dev/null +++ b/doc/egrep.man @@ -0,0 +1 @@ +.so man1/@grep@ diff --git a/doc/fgrep.man b/doc/fgrep.man new file mode 100644 index 0000000..877a8a8 --- /dev/null +++ b/doc/fgrep.man @@ -0,0 +1 @@ +.so man1/@grep@ diff --git a/doc/grep.1 b/doc/grep.1 new file mode 100644 index 0000000..ee544ec --- /dev/null +++ b/doc/grep.1 @@ -0,0 +1,1235 @@ +.\" GNU grep man page +.if !\n(.g \{\ +. if !\w|\*(lq| \{\ +. ds lq `` +. if \w'\(lq' .ds lq "\(lq +. \} +. if !\w|\*(rq| \{\ +. ds rq '' +. if \w'\(rq' .ds rq "\(rq +. \} +.\} +.ie t .ds Tx \s-1T\v'.4n'\h'-.1667'E\v'-.4n'\h'-.125'X\s0 +. el .ds Tx TeX +.de Id +. ds Yr \\$4 +. substring Yr 0 3 +. ds Mn \\$4 +. substring Mn 5 6 +. ds Dy \\$4 +. substring Dy 8 9 +. \" ISO 8601 date, complete format, extended representation +. ds Dt \\*(Yr-\\*(Mn-\\*(Dy +.. +.Id $Id: grep.1,v 1.38 2006/08/18 22:00:31 bero Exp $ +.TH GREP 1 \*(Dt "GNU grep 2.5.1-cvs" "User Commands" +.hy 0 +. +.SH NAME +grep, egrep, fgrep \- print lines matching a pattern +. +.SH SYNOPSIS +.B grep +.RI [ OPTIONS ] +.I PATTERN +.RI [ FILE .\|.\|.] +.br +.B grep +.RI [ OPTIONS ] +.RB [ \-e +.I PATTERN +| +.B \-f +.IR FILE ] +.RI [ FILE .\|.\|.] +. +.SH DESCRIPTION +.B grep +searches the named input +.IR FILE s +(or standard input if no files are named, +or if a single hyphen-minus +.RB ( \- ) +is given as file name) +for lines containing a match to the given +.IR PATTERN . +By default, +.B grep +prints the matching lines. +.PP +In addition, two variant programs +.B egrep +and +.B fgrep +are available. +.B egrep +is the same as +.BR "grep\ \-E" . +.B fgrep +is the same as +.BR "grep\ \-F" . +Direct invocation as either +.B egrep +or +.B fgrep +is deprecated, +but is provided to allow historical applications +that rely on them to run unmodified. +. +.SH OPTIONS +.SS "Generic Program Information" +.TP +.B \-\^\-help +Print a usage message briefly summarizing these command-line options +and the bug-reporting address, then exit. +.TP +.BR \-V ", " \-\^\-version +Print the version number of +.B grep +to the standard output stream. +This version number should +be included in all bug reports (see below). +.SS "Matcher Selection" +.TP +.BR \-E ", " \-\^\-extended\-regexp +Interpret +.I PATTERN +as an extended regular expression (ERE, see below). +.RB ( \-E +is specified by \s-1POSIX\s0.) +.TP +.BR \-F ", " \-\^\-fixed\-strings +Interpret +.I PATTERN +as a list of fixed strings, separated by newlines, +any of which is to be matched. +.RB ( \-F +is specified by \s-1POSIX\s0.) +.TP +.BR \-G ", " \-\^\-basic\-regexp +Interpret +.I PATTERN +as a basic regular expression (BRE, see below). +This is the default. +.TP +.BR \-P ", " \-\^\-perl\-regexp +Interpret +.I PATTERN +as a Perl regular expression. +This is highly experimental and +.B "grep \-P" +may warn of unimplemented features. +.SS "Matching Control" +.TP +.BI \-e " PATTERN" "\fR,\fP \-\^\-regexp=" PATTERN +Use +.I PATTERN +as the pattern. +This is useful to protect patterns beginning with hyphen-minus +.RB ( \- ). +.RB ( \-e +is specified by \s-1POSIX\s0.) +.TP +.BI \-f " FILE" "\fR,\fP \-\^\-file=" FILE +Obtain patterns from +.IR FILE , +one per line. +The empty file contains zero patterns, and therefore matches nothing. +.RB ( \-f +is specified by \s-1POSIX\s0.) +.TP +.BR \-i ", " \-\^\-ignore\-case +Ignore case distinctions in both the +.I PATTERN +and the input files. +.RB ( \-i +is specified by \s-1POSIX\s0.) +.TP +.BR \-v ", " \-\^\-invert\-match +Invert the sense of matching, to select non-matching lines. +.RB ( \-v +is specified by \s-1POSIX\s0.) +.TP +.BR \-w ", " \-\^\-word\-regexp +Select only those lines containing matches that form whole words. +The test is that the matching substring must either be at the +beginning of the line, or preceded by a non-word constituent +character. +Similarly, it must be either at the end of the line +or followed by a non-word constituent character. +Word-constituent characters are letters, digits, and the underscore. +.TP +.BR \-x ", " \-\^\-line\-regexp +Select only those matches that exactly match the whole line. +.RB ( \-x +is specified by \s-1POSIX\s0.) +.TP +.B \-y +Obsolete synonym for +.BR \-i . +.SS "General Output Control" +.TP +.BR \-c ", " \-\^\-count +Suppress normal output; instead print a count of +matching lines for each input file. +With the +.BR \-v ", " \-\^\-invert\-match +option (see below), count non-matching lines. +.RB ( \-c +is specified by \s-1POSIX\s0.) +.TP +.BR \-\^\-color [ =\fIWHEN\fP "], " \-\^\-colour [ =\fIWHEN\fP ] +Surround the matched (non-empty) strings, matching lines, context lines, +file names, line numbers, byte offsets, and separators (for fields and +groups of context lines) with escape sequences to display them in color +on the terminal. +The colors are defined by the environment variable +.BR GREP_COLORS . +The deprecated environment variable +.B GREP_COLOR +is still supported, but its setting does not have priority. +.I WHEN +is +.BR never ", " always ", or " auto . +.TP +.BR \-L ", " \-\^\-files\-without\-match +Suppress normal output; instead print the name +of each input file from which no output would +normally have been printed. +The scanning will stop on the first match. +.TP +.BR \-l ", " \-\^\-files\-with\-matches +Suppress normal output; instead print +the name of each input file from which output +would normally have been printed. +The scanning will stop on the first match. +.RB ( \-l +is specified by \s-1POSIX\s0.) +.TP +.BI \-m " NUM" "\fR,\fP \-\^\-max\-count=" NUM +Stop reading a file after +.I NUM +matching lines. +If the input is standard input from a regular file, +and +.I NUM +matching lines are output, +.B grep +ensures that the standard input is positioned to just after the last +matching line before exiting, regardless of the presence of trailing +context lines. +This enables a calling process to resume a search. +When +.B grep +stops after +.I NUM +matching lines, it outputs any trailing context lines. +When the +.B \-c +or +.B \-\^\-count +option is also used, +.B grep +does not output a count greater than +.IR NUM . +When the +.B \-v +or +.B \-\^\-invert\-match +option is also used, +.B grep +stops after outputting +.I NUM +non-matching lines. +.TP +.BR \-o ", " \-\^\-only\-matching +Print only the matched (non-empty) parts of a matching line, +with each such part on a separate output line. +.TP +.BR \-q ", " \-\^\-quiet ", " \-\^\-silent +Quiet; do not write anything to standard output. +Exit immediately with zero status if any match is found, +even if an error was detected. +Also see the +.B \-s +or +.B \-\^\-no\-messages +option. +.RB ( \-q +is specified by \s-1POSIX\s0.) +.TP +.BR \-s ", " \-\^\-no\-messages +Suppress error messages about nonexistent or unreadable files. +Portability note: unlike \s-1GNU\s0 +.BR grep , +7th Edition Unix +.B grep +did not conform to \s-1POSIX\s0, because it lacked +.B \-q +and its +.B \-s +option behaved like \s-1GNU\s0 +.BR grep 's +.B \-q +option. +\s-1USG\s0-style +.B grep +also lacked +.B \-q +but its +.B \-s +option behaved like \s-1GNU\s0 +.BR grep . +Portable shell scripts +should avoid both +.B \-q +and +.B \-s +and should redirect standard and error output to +.B /dev/null +instead. +.RB ( \-s +is specified by \s-1POSIX\s0.) +.SS "Output Line Prefix Control" +.TP +.BR \-b ", " \-\^\-byte\-offset +Print the 0-based byte offset within the input file +before each line of output. +If +.B \-o +.RB ( \-\^\-only\-matching ) +is specified, +print the offset of the matching part itself. +.TP +.BR \-H ", " \-\^\-with\-filename +Print the file name for each match. +This is the default when there is more than one file to search. +.TP +.BR \-h ", " \-\^\-no\-filename +Suppress the prefixing of file names on output. +This is the default when there is only one file +(or only standard input) to search. +.TP +.BI \-\^\-label= LABEL +Display input actually coming from standard input as input coming from file +.I LABEL. +This is especially useful for tools like +.BR zgrep , +e.g., +.B "gzip -cd foo.gz | grep --label=foo something" +.TP +.BR \-n ", " \-\^\-line\-number +Prefix each line of output with the 1-based line number +within its input file. +.RB ( \-n +is specified by \s-1POSIX\s0.) +.TP +.BR \-T ", " \-\^\-initial\-tab +Make sure that the first character of actual line content lies on a +tab stop, so that the alignment of tabs looks normal. +This is useful with options that prefix their output to the actual content: +.BR \-H , \-n , +and +.BR \-b . +In order to improve the probability that lines +from a single file will all start at the same column, +this also causes the line number and byte offset (if present) +to be printed in a minimum size field width. +.TP +.BR \-u ", " \-\^\-unix\-byte\-offsets +Report Unix-style byte offsets. +This switch causes +.B grep +to report byte offsets as if the file were a Unix-style text file, +i.e., with CR characters stripped off. +This will produce results identical to running +.B grep +on a Unix machine. +This option has no effect unless +.B \-b +option is also used; +it has no effect on platforms other than \s-1MS-DOS\s0 and \s-1MS\s0-Windows. +.TP +.BR \-Z ", " \-\^\-null +Output a zero byte (the \s-1ASCII\s0 +.B NUL +character) instead of the character that normally follows a file name. +For example, +.B "grep \-lZ" +outputs a zero byte after each file name instead of the usual newline. +This option makes the output unambiguous, even in the presence of file +names containing unusual characters like newlines. +This option can be used with commands like +.BR "find \-print0" , +.BR "perl \-0" , +.BR "sort \-z" , +and +.B "xargs \-0" +to process arbitrary file names, +even those that contain newline characters. +.SS "Context Line Control" +.TP +.BI \-A " NUM" "\fR,\fP \-\^\-after\-context=" NUM +Print +.I NUM +lines of trailing context after matching lines. +Places a line containing a group separator +.RB ( \-\^\- ) +between contiguous groups of matches. +With the +.B \-o +or +.B \-\^\-only\-matching +option, this has no effect and a warning is given. +.TP +.BI \-B " NUM" "\fR,\fP \-\^\-before\-context=" NUM +Print +.I NUM +lines of leading context before matching lines. +Places a line containing a group separator +.RB ( \-\^\- ) +between contiguous groups of matches. +With the +.B \-o +or +.B \-\^\-only\-matching +option, this has no effect and a warning is given. +.TP +.BI \-C " NUM" "\fR,\fP \-" NUM "\fR,\fP \-\^\-context=" NUM +Print +.I NUM +lines of output context. +Places a line containing a group separator +.RB ( \-\^\- ) +between contiguous groups of matches. +With the +.B \-o +or +.B \-\^\-only\-matching +option, this has no effect and a warning is given. +.SS "File and Directory Selection" +.TP +.BR \-a ", " \-\^\-text +Process a binary file as if it were text; this is equivalent to the +.B \-\^\-binary\-files=text +option. +.TP +.BI \-\^\-binary\-files= TYPE +If the first few bytes of a file indicate that the file contains binary +data, assume that the file is of type +.IR TYPE . +By default, +.I TYPE +is +.BR binary , +and +.B grep +normally outputs either +a one-line message saying that a binary file matches, or no message if +there is no match. +If +.I TYPE +is +.BR without-match , +.B grep +assumes that a binary file does not match; this is equivalent to the +.B \-I +option. +If +.I TYPE +is +.BR text , +.B grep +processes a binary file as if it were text; this is equivalent to the +.B \-a +option. +.I Warning: +.B "grep \-\^\-binary\-files=text" +might output binary garbage, +which can have nasty side effects if the output is a terminal and if the +terminal driver interprets some of it as commands. +.TP +.BI \-D " ACTION" "\fR,\fP \-\^\-devices=" ACTION +If an input file is a device, FIFO or socket, use +.I ACTION +to process it. +By default, +.I ACTION +is +.BR read , +which means that devices are read just as if they were ordinary files. +If +.I ACTION +is +.BR skip , +devices are silently skipped. +.TP +.BI \-d " ACTION" "\fR,\fP \-\^\-directories=" ACTION +If an input file is a directory, use +.I ACTION +to process it. +By default, +.I ACTION +is +.BR read , +which means that directories are read just as if they were ordinary files. +If +.I ACTION +is +.BR skip , +directories are silently skipped. +If +.I ACTION +is +.BR recurse , +.B grep +reads all files under each directory, recursively; +this is equivalent to the +.B \-r +option. +.TP +.BI \-\^\-exclude= GLOB +Skip files whose base name matches +.I GLOB +(using wildcard matching). +A file-name glob can use +.BR * , +.BR ? , +and +.BR [ ... ] +as wildcards, and +.B \e +to quote a wildcard or backslash character literally. +.TP +.BI \-\^\-exclude-from= FILE +Skip files whose base name matches any of the file-name globs read from +.I FILE +(using wildcard matching as described under +.BR \-\^\-exclude ). +.TP +.BI \-\^\-exclude-dir= DIR +Exclude directories matching the pattern +.I DIR +from recursive searches. +.TP +.BR \-I +Process a binary file as if it did not contain matching data; this is +equivalent to the +.B \-\^\-binary\-files=without-match +option. +.TP +.BI \-\^\-include= GLOB +Search only files whose base name matches +.I GLOB +(using wildcard matching as described under +.BR \-\^\-exclude ). +.TP +.BR \-R ", " \-r ", " \-\^\-recursive +Read all files under each directory, recursively; +this is equivalent to the +.B "\-d recurse" +option. +.SS "Other Options" +.TP +.BR \-\^\-line\-buffered +Use line buffering on output. +This can cause a performance penalty. +.TP +.B \-\^\-mmap +If possible, use the +.BR mmap (2) +system call to read input, instead of +the default +.BR read (2) +system call. +In some situations, +.B \-\^\-mmap +yields better performance. +However, +.B \-\^\-mmap +can cause undefined behavior (including core dumps) +if an input file shrinks while +.B grep +is operating, or if an I/O error occurs. +.TP +.BR \-U ", " \-\^\-binary +Treat the file(s) as binary. +By default, under \s-1MS-DOS\s0 and \s-1MS\s0-Windows, +.BR grep +guesses the file type by looking at the contents of the first 32KB +read from the file. +If +.BR grep +decides the file is a text file, it strips the CR characters from the +original file contents (to make regular expressions with +.B ^ +and +.B $ +work correctly). +Specifying +.B \-U +overrules this guesswork, causing all files to be read and passed to the +matching mechanism verbatim; if the file is a text file with CR/LF +pairs at the end of each line, this will cause some regular +expressions to fail. +This option has no effect on platforms +other than \s-1MS-DOS\s0 and \s-1MS\s0-Windows. +.TP +.BR \-z ", " \-\^\-null\-data +Treat the input as a set of lines, +each terminated by a zero byte (the \s-1ASCII\s0 +.B NUL +character) instead of a newline. +Like the +.B -Z +or +.B \-\^\-null +option, this option can be used with commands like +.B sort -z +to process arbitrary file names. +. +.SH "REGULAR EXPRESSIONS" +A regular expression is a pattern that describes a set of strings. +Regular expressions are constructed analogously to arithmetic +expressions, by using various operators to combine smaller expressions. +.PP +.B grep +understands two different versions of regular expression syntax: +\*(lqbasic\*(rq and \*(lqextended.\*(rq In +.RB "\s-1GNU\s0\ " grep , +there is no difference in available functionality using either syntax. +In other implementations, basic regular expressions are less powerful. +The following description applies to extended regular expressions; +differences for basic regular expressions are summarized afterwards. +.PP +The fundamental building blocks are the regular expressions +that match a single character. +Most characters, including all letters and digits, +are regular expressions that match themselves. +Any meta-character with special meaning +may be quoted by preceding it with a backslash. +.PP +The period +.B .\& +matches any single character. +.SS "Character Classes and Bracket Expressions" +A +.I "bracket expression" +is a list of characters enclosed by +.B [ +and +.BR ] . +It matches any single +character in that list; if the first character of the list +is the caret +.B ^ +then it matches any character +.I not +in the list. +For example, the regular expression +.B [0123456789] +matches any single digit. +.PP +Within a bracket expression, a +.I "range expression" +consists of two characters separated by a hyphen. +It matches any single character that sorts between the two characters, +inclusive, using the locale's collating sequence and character set. +For example, in the default C locale, +.B [a\-d] +is equivalent to +.BR [abcd] . +Many locales sort characters in dictionary order, and in these locales +.B [a\-d] +is typically not equivalent to +.BR [abcd] ; +it might be equivalent to +.BR [aBbCcDd] , +for example. +To obtain the traditional interpretation of bracket expressions, +you can use the C locale by setting the +.B LC_ALL +environment variable to the value +.BR C . +.PP +Finally, certain named classes of characters are predefined within +bracket expressions, as follows. +Their names are self explanatory, and they are +.BR [:alnum:] , +.BR [:alpha:] , +.BR [:cntrl:] , +.BR [:digit:] , +.BR [:graph:] , +.BR [:lower:] , +.BR [:print:] , +.BR [:punct:] , +.BR [:space:] , +.BR [:upper:] , +and +.BR [:xdigit:]. +For example, +.B [[:alnum:]] +means +.BR [0\-9A\-Za\-z] , +except the latter form depends upon the C locale and the +\s-1ASCII\s0 character encoding, whereas the former is independent +of locale and character set. +(Note that the brackets in these class names are part of the symbolic +names, and must be included in addition to the brackets delimiting +the bracket expression.) +Most meta-characters lose their special meaning inside bracket expressions. +To include a literal +.B ] +place it first in the list. +Similarly, to include a literal +.B ^ +place it anywhere but first. +Finally, to include a literal +.B \- +place it last. +.SS Anchoring +The caret +.B ^ +and the dollar sign +.B $ +are meta-characters that respectively match the empty string at the +beginning and end of a line. +.SS "The Backslash Character and Special Expressions" +The symbols +.B \e< +and +.B \e> +respectively match the empty string at the beginning and end of a word. +The symbol +.B \eb +matches the empty string at the edge of a word, +and +.B \eB +matches the empty string provided it's +.I not +at the edge of a word. +The symbol +.B \ew +is a synonym for +.B [[:alnum:]] +and +.B \eW +is a synonym for +.BR [^[:alnum:]] . +.SS Repetition +A regular expression may be followed by one of several repetition operators: +.PD 0 +.TP +.B ? +The preceding item is optional and matched at most once. +.TP +.B * +The preceding item will be matched zero or more times. +.TP +.B + +The preceding item will be matched one or more times. +.TP +.BI { n } +The preceding item is matched exactly +.I n +times. +.TP +.BI { n ,} +The preceding item is matched +.I n +or more times. +.TP +.BI {, m } +The preceding item is matched at most +.I m +times. +.TP +.BI { n , m } +The preceding item is matched at least +.I n +times, but not more than +.I m +times. +.PD +.SS Concatenation +Two regular expressions may be concatenated; the resulting +regular expression matches any string formed by concatenating +two substrings that respectively match the concatenated +expressions. +.SS Alternation +Two regular expressions may be joined by the infix operator +.BR | ; +the resulting regular expression matches any string matching +either alternate expression. +.SS Precedence +Repetition takes precedence over concatenation, which in turn +takes precedence over alternation. +A whole expression may be enclosed in parentheses +to override these precedence rules and form a subexpression. +.SS "Back References and Subexpressions" +The back-reference +.BI \e n\c +\&, where +.I n +is a single digit, matches the substring +previously matched by the +.IR n th +parenthesized subexpression of the regular expression. +.SS "Basic vs Extended Regular Expressions" +In basic regular expressions the meta-characters +.BR ? , +.BR + , +.BR { , +.BR | , +.BR ( , +and +.BR ) +lose their special meaning; instead use the backslashed +versions +.BR \e? , +.BR \e+ , +.BR \e{ , +.BR \e| , +.BR \e( , +and +.BR \e) . +.PP +Traditional +.B egrep +did not support the +.B { +meta-character, and some +.B egrep +implementations support +.B \e{ +instead, so portable scripts should avoid +.B { +in +.B "grep\ \-E" +patterns and should use +.B [{] +to match a literal +.BR { . +.PP +\s-1GNU\s0 +.B "grep\ \-E" +attempts to support traditional usage by assuming that +.B { +is not special if it would be the start of an invalid interval +specification. +For example, the command +.B "grep\ \-E\ '{1'" +searches for the two-character string +.B {1 +instead of reporting a syntax error in the regular expression. +\s-1POSIX.2\s0 allows this behavior as an extension, but portable scripts +should avoid it. +. +.SH "ENVIRONMENT VARIABLES" +The behavior of +.B grep +is affected by the following environment variables. +.PP +The locale for category +.BI LC_ foo +is specified by examining the three environment variables +.BR LC_ALL , +.BR LC_\fIfoo\fP , +.BR LANG , +in that order. +The first of these variables that is set specifies the locale. +For example, if +.B LC_ALL +is not set, but +.B LC_MESSAGES +is set to +.BR pt_BR , +then the Brazilian Portuguese locale is used for the +.B LC_MESSAGES +category. +The C locale is used if none of these environment variables are set, +if the locale catalog is not installed, or if +.B grep +was not compiled with national language support (\s-1NLS\s0). +.TP +.B GREP_OPTIONS +This variable specifies default options +to be placed in front of any explicit options. +For example, if +.B GREP_OPTIONS +is +.BR "'\-\^\-binary-files=without-match \-\^\-directories=skip'" , +.B grep +behaves as if the two options +.B \-\^\-binary\-files=without-match +and +.B \-\^\-directories=skip +had been specified before any explicit options. +Option specifications are separated by whitespace. +A backslash escapes the next character, +so it can be used to specify an option containing whitespace or a backslash. +.TP +.B GREP_COLOR +This variable specifies the color used to highlight matched (non-empty) text. +It is deprecated in favor of +.BR GREP_COLORS , +but still supported. +The +.BR mt , +.BR ms , +and +.B mc +capabilities of +.B GREP_COLORS +have priority over it. +It can only specify the color used to highlight +the matching non-empty text in any matching line +(a selected line when the +.B -v +command-line option is omitted, +or a context line when +.B -v +is specified). +The default is +.BR 01;31 , +which means a bold red foreground text on the terminal's default background. +.TP +.B GREP_COLORS +Specifies the colors and other attributes +used to highlight various parts of the output. +Its value is a colon-separated list of capabilities +that defaults to +.B ms=01;31:mc=01;31:sl=:cx=:fn=35:ln=32:bn=32:se=36 +with the +.B rv +and +.B ne +boolean capabilities omitted (i.e., false). +Supported capabilities are as follows. +.RS +.TP +.B sl= +SGR substring for whole selected lines +(i.e., +matching lines when the +.B \-v +command-line option is omitted, +or non-matching lines when +.B \-v +is specified). +If however the boolean +.B rv +capability +and the +.B \-v +command-line option are both specified, +it applies to context matching lines instead. +The default is empty (i.e., the terminal's default color pair). +.TP +.B cx= +SGR substring for whole context lines +(i.e., +non-matching lines when the +.B \-v +command-line option is omitted, +or matching lines when +.B \-v +is specified). +If however the boolean +.B rv +capability +and the +.B \-v +command-line option are both specified, +it applies to selected non-matching lines instead. +The default is empty (i.e., the terminal's default color pair). +.TP +.B rv +Boolean value that reverses (swaps) the meanings of +the +.B sl= +and +.B cx= +capabilities +when the +.B \-v +command-line option is specified. +The default is false (i.e., the capability is omitted). +.TP +.B mt=01;31 +SGR substring for matching non-empty text in any matching line +(i.e., +a selected line when the +.B \-v +command-line option is omitted, +or a context line when +.B \-v +is specified). +Setting this is equivalent to setting both +.B ms= +and +.B mc= +at once to the same value. +The default is a bold red text foreground over the current line background. +.TP +.B ms=01;31 +SGR substring for matching non-empty text in a selected line. +(This is only used when the +.B \-v +command-line option is omitted.) +The effect of the +.B sl= +(or +.B cx= +if +.BR rv ) +capability remains active when this kicks in. +The default is a bold red text foreground over the current line background. +.TP +.B mc=01;31 +SGR substring for matching non-empty text in a context line. +(This is only used when the +.B \-v +command-line option is specified.) +The effect of the +.B cx= +(or +.B sl= +if +.BR rv ) +capability remains active when this kicks in. +The default is a bold red text foreground over the current line background. +.TP +.B fn=35 +SGR substring for file names prefixing any content line. +The default is a magenta text foreground over the terminal's default background. +.TP +.B ln=32 +SGR substring for line numbers prefixing any content line. +The default is a green text foreground over the terminal's default background. +.TP +.B bn=32 +SGR substring for byte offsets prefixing any content line. +The default is a green text foreground over the terminal's default background. +.TP +.B se=36 +SGR substring for separators that are inserted +between selected line fields +.RB ( : ), +between context line fields, +.RB ( \- ), +and between groups of adjacent lines when nonzero context is specified +.RB ( \-\^\- ). +The default is a cyan text foreground over the terminal's default background. +.TP +.B ne +Boolean value that prevents clearing to the end of line +using Erase in Line (EL) to Right +.RB ( \\\\\\33[K ) +each time a colorized item ends. +This is needed on terminals on which EL is not supported. +It is otherwise useful on terminals +for which the +.B back_color_erase +.RB ( bce ) +boolean terminfo capability does not apply, +when the chosen highlight colors do not affect the background, +or when EL is too slow or causes too much flicker. +The default is false (i.e., the capability is omitted). +.PP +Note that boolean capabilities have no +.BR = ... +part. +They are omitted (i.e., false) by default and become true when specified. +.PP +See the Select Graphic Rendition (SGR) section +in the documentation of the text terminal that is used +for permitted values and their meaning as character attributes. +These substring values are integers in decimal representation +and can be concatenated with semicolons. +.B grep +takes care of assembling the result +into a complete SGR sequence +.RB ( \\\\\\33[ ... m ). +Common values to concatenate include +.B 1 +for bold, +.B 4 +for underline, +.B 5 +for blink, +.B 7 +for inverse, +.B 39 +for default foreground color, +.B 30 +to +.B 37 +for foreground colors, +.B 90 +to +.B 97 +for 16-color mode foreground colors, +.B 38;5;0 +to +.B 38;5;255 +for 88-color and 256-color modes foreground colors, +.B 49 +for default background color, +.B 40 +to +.B 47 +for background colors, +.B 100 +to +.B 107 +for 16-color mode background colors, and +.B 48;5;0 +to +.B 48;5;255 +for 88-color and 256-color modes background colors. +.RE +.TP +\fBLC_ALL\fP, \fBLC_COLLATE\fP, \fBLANG\fP +These variables specify the locale for the +.B LC_COLLATE +category, +which determines the collating sequence +used to interpret range expressions like +.BR [a\-z] . +.TP +\fBLC_ALL\fP, \fBLC_CTYPE\fP, \fBLANG\fP +These variables specify the locale for the +.B LC_CTYPE +category, +which determines the type of characters, +e.g., which characters are whitespace. +.TP +\fBLC_ALL\fP, \fBLC_MESSAGES\fP, \fBLANG\fP +These variables specify the locale for the +.B LC_MESSAGES +category, +which determines the language that +.B grep +uses for messages. +The default C locale uses American English messages. +.TP +.B POSIXLY_CORRECT +If set, +.B grep +behaves as \s-1POSIX.2\s0 requires; otherwise, +.B grep +behaves more like other \s-1GNU\s0 programs. +\s-1POSIX.2\s0 requires that options that follow file names must be +treated as file names; by default, such options are permuted to the +front of the operand list and are treated as options. +Also, \s-1POSIX.2\s0 requires that unrecognized options be diagnosed as +\*(lqillegal\*(rq, but since they are not really against the law the default +is to diagnose them as \*(lqinvalid\*(rq. +.B POSIXLY_CORRECT +also disables \fB_\fP\fIN\fP\fB_GNU_nonoption_argv_flags_\fP, +described below. +.TP +\fB_\fP\fIN\fP\fB_GNU_nonoption_argv_flags_\fP +(Here +.I N +is +.BR grep 's +numeric process ID.) If the +.IR i th +character of this environment variable's value is +.BR 1 , +do not consider the +.IR i th +operand of +.B grep +to be an option, even if it appears to be one. +A shell can put this variable in the environment for each command it runs, +specifying which operands are the results of file name wildcard +expansion and therefore should not be treated as options. +This behavior is available only with the \s-1GNU\s0 C library, and only +when +.B POSIXLY_CORRECT +is not set. +. +.SH "EXIT STATUS" +Normally, the exit status is 0 if selected lines are found and 1 otherwise. +But the exit status is 2 if an error occurred, unless the +.B \-q +or +.B \-\^\-quiet +or +.B \-\^\-silent +option is used and a selected line is found. +Note, however, that \s-1POSIX\s0 only mandates, for programs such as +.BR grep , +.BR cmp , +and +.BR diff , +that the exit status in case of error be greater than 1; +it is therefore advisable, for the sake of portability, +to use logic that tests for this general condition +instead of strict equality with\ 2. +. +.SH COPYRIGHT +Copyright \(co +1998, 1999, 2000, 2002, 2005 +Free Software Foundation, Inc. +.PP +This is free software; +see the source for copying conditions. +There is NO warranty; +not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +. +.SH BUGS +.SS "Reporting Bugs" +Email bug reports to +.RB < bug\-grep@gnu.org >, +a mailing list whose web page is +.RB < http://lists.gnu.org/mailman/listinfo/bug\-grep >. +.BR grep 's +Savannah bug tracker is located at +.RB < http://savannah.gnu.org/bugs/?group=grep >. +.SS "Known Bugs" +Large repetition counts in the +.BI { n , m } +construct may cause +.B grep +to use lots of memory. +In addition, +certain other obscure regular expressions require exponential time +and space, and may cause +.B grep +to run out of memory. +.PP +Back-references are very slow, and may require exponential time. +. +.SH "SEE ALSO" +.SS "Regular Manual Pages" +awk(1), cmp(1), diff(1), find(1), gzip(1), +perl(1), sed(1), sort(1), xargs(1), zgrep(1), +mmap(2), read(2), +pcre(3), pcrepattern(3), +terminfo(5), +glob(7), regex(7). +.SS "\s-1POSIX\s0 Programmer's Manual Page" +grep(1p). +.SS "\*(Txinfo Documentation" +The full documentation for +.B grep +is maintained as a \*(Txinfo manual. +If the +.B info +and +.B grep +programs are properly installed at your site, the command +.IP +.B info grep +.PP +should give you access to the complete manual. +. +.SH NOTES +\s-1GNU\s0's not Unix, but Unix is a beast; +its plural form is Unixen. +.\" Work around problems with some troff -man implementations. +.br diff --git a/doc/grep.texi b/doc/grep.texi new file mode 100644 index 0000000..13dbfb7 --- /dev/null +++ b/doc/grep.texi @@ -0,0 +1,2541 @@ +\input texinfo @c -*-texinfo-*- +@c %**start of header +@setfilename grep.info +@settitle grep, print lines matching a pattern +@c %**end of header + +@c This file has the new style title page commands. +@c Run `makeinfo' rather than `texinfo-format-buffer'. + +@c smallbook + +@c tex +@c \overfullrule=0pt +@c end tex + +@include version.texi + +@c Combine indices. +@syncodeindex ky cp +@syncodeindex pg cp +@syncodeindex tp cp + +@defcodeindex op +@syncodeindex op fn +@syncodeindex vr fn + +@ifinfo +@direntry +* grep: (grep). print lines matching a pattern. +@end direntry +This file documents @command{grep}, a pattern matching engine. + + +Published by the Free Software Foundation, +51 Franklin Street -- Fifth Floor +Boston, MA 02110--1301, USA + +@c man begin COPYRIGHT +Copyright @copyright{} 1999, 2000, 2001, 2002, 2005 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 preserved on all copies. + +@ignore +Permission is granted to process this file through TeX and print the +results, provided the printed document carries a copying permission +notice identical to this one except for the removal of this paragraph +(this paragraph not being relevant to the printed manual). + +@end ignore +Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU Free Documentation License, Version 1.1 or +any later version published by the Free Software Foundation; with the +Invariant Sections being ``GNU General Public License'' and ``GNU Free +Documentation License'', with no Front-Cover Texts, and with no +Back-Cover Texts. A copy of the license is included in the section +entitled ``GNU Free Documentation License'' (@pxref{Copying}). +@c man end +@end ifinfo + +@setchapternewpage off + +@titlepage +@title @command{grep}, print lines matching a pattern +@subtitle version @value{VERSION}, @value{UPDATED} +@author Alain Magloire et al. + +@page +@vskip 0pt plus 1filll +Copyright @copyright{} 1999, 2000, 2001, 2002, 2005 Free Software Foundation, Inc. + +@sp 2 +Published by the Free Software Foundation, @* +51 Franklin Street -- Fifth Floor, @* +Boston, MA 02110--1301, USA + +Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU Free Documentation License, Version 1.1 or +any later version published by the Free Software Foundation; with the +Invariant Sections being ``GNU General Public License'' and ``GNU Free +Documentation License'', with no Front-Cover Texts, and with no +Back-Cover Texts. A copy of the license is included in the section +entitled ``GNU Free Documentation License''. +@end titlepage + + +@ifnottex +@node Top +@top grep + +@command{grep} searches for lines matching a pattern. + +This document was produced +for version @value{VERSION} +of @sc{gnu} @command{grep}. +@end ifnottex + +@menu +* Introduction:: Introduction. +* Invoking:: Invoking @command{grep}; description of options. +* Exit Status:: Exit status returned by @command{grep}. +* grep Programs:: @command{grep} programs. +* Regular Expressions:: Regular Expressions. +* Usage:: Examples. +* Reporting Bugs:: Reporting Bugs. +* Copying:: License terms. +* Concept Index:: Topics covered in this manual. +* Index:: Options, environment variables, and constructs. +@end menu + + +@node Introduction, Invoking, Top, Top +@chapter Introduction + +@cindex Searching for a pattern. + +@command{grep} searches the input files +for lines containing a match to a given pattern list. +When it finds a match in a line, +it copies the line to standard output (by default), +or produces whatever other sort of output you have requested with options. + +Though @command{grep} expects to do the matching on text, +it has no limits on input line length other than available memory, +and it can match arbitrary characters within a line. +If the final byte of an input file is not a newline, +@command{grep} silently supplies one. +Since newline is also a separator for the list of patterns, +there is no way to match newline characters in a text. + +@node Invoking +@chapter Invoking @command{grep} + +The general synopsis of the @command{grep} command line is + +@example +grep @var{options} @var{pattern} @var{input_file_names} +@end example + +@noindent +There can be zero or more @var{options}. +@var{pattern} will only be seen as such +(and not as an @var{input_file_name}) +if it wasn't already specified within @var{options} +(by using the @samp{-e@ @var{pattern}} +or @samp{-f@ @var{file}} options). +There can be zero or more @var{input_file_names}. + +@menu +* Command-line Options:: Short and long names, grouped by category. +* Environment Variables:: POSIX, GNU generic, and GNU grep specific. +@end menu + +@node Command-line Options +@section Command-line Options + +@command{grep} comes with a rich set of options: +some from @sc{posix.2} and some being @sc{gnu} extensions. +Long option names are always a @sc{gnu} extension, +even for options that are from @sc{posix} specifications. +Options that are specified by @sc{posix}, +under their short names, +are explicitly marked as such +to facilitate @sc{posix}-portable programming. +A few option names are provided +for compatibility with older or more exotic implementations. + +@menu +* Generic Program Information:: +* Matching Control:: +* General Output Control:: +* Output Line Prefix Control:: +* Context Line Control:: +* File and Directory Selection:: +* Other Options:: +@end menu + +Several additional options control +which variant of the @command{grep} matching engine is used. +@xref{grep Programs}. + +@node Generic Program Information +@subsection Generic Program Information + +@table @samp + +@item --help +@opindex --help +@cindex Usage summary, printing +Print a usage message briefly summarizing the command-line options +and the bug-reporting address, then exit. + +@item -V +@itemx --version +@opindex -V +@opindex --version +@cindex Version, printing +Print the version number of @command{grep} to the standard output stream. +This version number should be included in all bug reports. + +@end table + +@node Matching Control +@subsection Matching Control + +@table @samp + +@item -e @var{pattern} +@itemx --regexp=@var{pattern} +@opindex -e +@opindex --regexp=@var{pattern} +@cindex pattern list +Use @var{pattern} as the pattern; +useful to protect patterns beginning with a @samp{-}. +(@samp{-e} is specified by @sc{posix}.) + +@item -f @var{file} +@itemx --file=@var{file} +@opindex -f +@opindex --file +@cindex pattern from file +Obtain patterns from @var{file}, one per line. +The empty file contains zero patterns, and therefore matches nothing. +(@samp{-f} is specified by @sc{posix}.) + +@item -i +@itemx -y +@itemx --ignore-case +@opindex -i +@opindex -y +@opindex --ignore-case +@cindex case insensitive search +Ignore case distinctions in both the pattern and the input files. +@samp{-y} is an obsolete synonym that is provided for compatibility. +(@samp{-i} is specified by @sc{posix}.) + +@item -v +@itemx --invert-match +@opindex -v +@opindex --invert-match +@cindex invert matching +@cindex print non-matching lines +Invert the sense of matching, to select non-matching lines. +(@samp{-v} is specified by @sc{posix}.) + +@item -w +@itemx --word-regexp +@opindex -w +@opindex --word-regexp +@cindex matching whole words +Select only those lines containing matches that form whole words. +The test is that the matching substring must either +be at the beginning of the line, +or preceded by a non-word constituent character. +Similarly, +it must be either at the end of the line +or followed by a non-word constituent character. +Word-constituent characters are letters, digits, and the underscore. + +@item -x +@itemx --line-regexp +@opindex -x +@opindex --line-regexp +@cindex match the whole line +Select only those matches that exactly match the whole line. +(@samp{-x} is specified by @sc{posix}.) + +@end table + +@node General Output Control +@subsection General Output Control + +@table @samp + +@item -c +@itemx --count +@opindex -c +@opindex --count +@cindex counting lines +Suppress normal output; +instead print a count of matching lines for each input file. +With the @samp{-v}, @samp{--invert-match} option, +count non-matching lines. +(@samp{-c} is specified by @sc{posix}.) + +@item --color[=@var{WHEN}] +@itemx --colour[=@var{WHEN}] +@opindex --color +@opindex --colour +@cindex highlight, color, colour +Surround the matched (non-empty) strings, matching lines, context lines, +file names, line numbers, byte offsets, and separators (for fields and +groups of context lines) with escape sequences to display them in color +on the terminal. +The colors are defined by the environment variable @var{GREP_COLORS} +and default to @samp{ms=01;31:mc=01;31:sl=:cx=:fn=35:ln=32:bn=32:se=36} +for bold red matched text, magenta file names, green line numbers, +green byte offsets, cyan separators, and default terminal colors otherwise. +The deprecated environment variable @var{GREP_COLOR} is still supported, +but its setting does not have priority; +it defaults to `01;31' (bold red) +which only covers the color for matched text. +@var{WHEN} is @samp{never}, @samp{always}, or @samp{auto}. + +@item -L +@itemx --files-without-match +@opindex -L +@opindex --files-without-match +@cindex files which don't match +Suppress normal output; +instead print the name of each input file from which +no output would normally have been printed. +The scanning of every file will stop on the first match. + +@item -l +@itemx --files-with-matches +@opindex -l +@opindex --files-with-matches +@cindex names of matching files +Suppress normal output; +instead print the name of each input file from which +output would normally have been printed. +The scanning of every file will stop on the first match. +(@samp{-l} is specified by @sc{posix}.) + +@item -m @var{num} +@itemx --max-count=@var{num} +@opindex -m +@opindex --max-count +@cindex max-count +Stop reading a file after @var{num} matching lines. +If the input is standard input from a regular file, +and @var{num} matching lines are output, +@command{grep} ensures that the standard input is positioned +just after the last matching line before exiting, +regardless of the presence of trailing context lines. +This enables a calling process to resume a search. +For example, the following shell script makes use of it: + +@example +while grep -m 1 PATTERN +do + echo xxxx +done < FILE +@end example + +But the following probably will not work because a pipe is not a regular +file: + +@example +# This probably will not work. +cat FILE | +while grep -m 1 PATTERN +do + echo xxxx +done +@end example + +When @command{grep} stops after @var{num} matching lines, +it outputs any trailing context lines. +Since context does not include matching lines, +@command{grep} will stop when it encounters another matching line. +When the @samp{-c} or @samp{--count} option is also used, +@command{grep} does not output a count greater than @var{num}. +When the @samp{-v} or @samp{--invert-match} option is also used, +@command{grep} stops after outputting @var{num} non-matching lines. + +@item -o +@itemx --only-matching +@opindex -o +@opindex --only-matching +@cindex only matching +Print only the matched (non-empty) parts of matching lines, +with each such part on a separate output line. + +@item -q +@itemx --quiet +@itemx --silent +@opindex -q +@opindex --quiet +@opindex --silent +@cindex quiet, silent +Quiet; do not write anything to standard output. +Exit immediately with zero status if any match is found, +even if an error was detected. +Also see the @samp{-s} or @samp{--no-messages} option. +(@samp{-q} is specified by @sc{posix}.) + +@item -s +@itemx --no-messages +@opindex -s +@opindex --no-messages +@cindex suppress error messages +Suppress error messages about nonexistent or unreadable files. +Portability note: +unlike @sc{gnu} @command{grep}, +7th Edition Unix @command{grep} did not conform to @sc{posix}, +because it lacked @samp{-q} +and its @samp{-s} option behaved like +@sc{gnu} @command{grep}'s @samp{-q} option. +@sc{usg}-style @command{grep} also lacked @samp{-q} +but its @samp{-s} option behaved like @sc{gnu} @command{grep}'s. +Portable shell scripts should avoid both +@samp{-q} and @samp{-s} and should redirect +standard and error output to @file{/dev/null} instead. +(@samp{-s} is specified by @sc{posix}.) + +@end table + +@node Output Line Prefix Control +@subsection Output Line Prefix Control + +When several prefix fields are to be output, +the order is always file name, line number, and byte offset, +regardless of the order in which these options were specified. + +@table @samp + +@item -b +@itemx --byte-offset +@opindex -b +@opindex --byte-offset +@cindex byte offset +Print the 0-based byte offset within the input file +before each line of output. +If @samp{-o} (@samp{--only-matching}) is specified, +print the offset of the matching part itself. +When @command{grep} runs on @sc{ms-dos} or @sc{ms}-Windows, +the printed byte offsets depend on whether +the @samp{-u} (@samp{--unix-byte-offsets}) option is used; +see below. + +@item -H +@itemx --with-filename +@opindex -H +@opindex --with-filename +@cindex with filename prefix +Print the file name for each match. +This is the default when there is more than one file to search. + +@item -h +@itemx --no-filename +@opindex -h +@opindex --no-filename +@cindex no filename prefix +Suppress the prefixing of file names on output. +This is the default when there is only one file +(or only standard input) to search. + +@item --label=@var{LABEL} +@opindex --label +@cindex changing name of standard input +Display input actually coming from standard input +as input coming from file @var{LABEL}. +This is especially useful for tools like @command{zgrep}; +e.g.: + +@example +gzip -cd foo.gz | grep --label=foo something +@end example + +@item -n +@itemx --line-number +@opindex -n +@opindex --line-number +@cindex line numbering +Prefix each line of output with the 1-based line number within its input file. +(@samp{-n} is specified by @sc{posix}.) + +@item -T +@itemx --initial-tab +@opindex -T +@opindex --initial-tab +@cindex tab-aligned content lines +Make sure that the first character of actual line content lies on a tab stop, +so that the alignment of tabs looks normal. +This is useful with options that prefix their output to the actual content: +@samp{-H}, @samp{-n}, and @samp{-b}. +In order to improve the probability that lines +from a single file will all start at the same column, +this also causes the line number and byte offset (if present) +to be printed in a minimum-size field width. + +@item -u +@itemx --unix-byte-offsets +@opindex -u +@opindex --unix-byte-offsets +@cindex @sc{ms-dos}/@sc{ms}-Windows byte offsets +@cindex byte offsets, on @sc{ms-dos}/@sc{ms}-Windows +Report Unix-style byte offsets. +This option causes @command{grep} to report byte offsets +as if the file were a Unix-style text file, +i.e., the byte offsets ignore the @code{CR} characters that were stripped. +This will produce results identical +to running @command{grep} on a Unix machine. +This option has no effect unless the @samp{-b} option is also used; +it has no effect on platforms other than @sc{ms-dos} and @sc{ms}-Windows. + +@item -Z +@itemx --null +@opindex -Z +@opindex --null +@cindex zero-terminated file names +Output a zero byte (the @sc{ascii} @code{NUL} character) +instead of the character that normally follows a file name. +For example, +@samp{grep -lZ} outputs a zero byte after each file name +instead of the usual newline. +This option makes the output unambiguous, +even in the presence of file names containing unusual characters like newlines. +This option can be used with commands like +@samp{find -print0}, @samp{perl -0}, @samp{sort -z}, and @samp{xargs -0} +to process arbitrary file names, +even those that contain newline characters. + +@end table + +@node Context Line Control +@subsection Context Line Control + +Regardless of how these options are set, +@command{grep} will never print any given line more than once. +If the @samp{-o} or @samp{--only-matching} option is specified, +these options have no effect and a warning is given upon their use. + +@table @samp + +@item -A @var{num} +@itemx --after-context=@var{num} +@opindex -A +@opindex --after-context +@cindex after context +@cindex context lines, after match +Print @var{num} lines of trailing context after matching lines. + +@item -B @var{num} +@itemx --before-context=@var{num} +@opindex -B +@opindex --before-context +@cindex before context +@cindex context lines, before match +Print @var{num} lines of leading context before matching lines. + +@item -C @var{num} +@itemx -@var{num} +@itemx --context=@var{num} +@opindex -C +@opindex --context +@opindex -@var{num} +@cindex context +Print @var{num} lines of leading and trailing output context. + +@end table + +Matching lines normally use @samp{:} as a separator +between prefix fields and actual line content. +Context (i.e., non-matching) lines use @samp{-} instead. +When no context is specified, +matching lines are simply output one right after another. +When nonzero context is specified, +lines that are adjacent in the input form a group +and are output one right after another, +but disjoint groups of lines are separated by a @samp{--} +without any prefix and on a line of its own. +Each group may contain several matching lines +when they are close enough to each other +that two otherwise adjacent but divided groups connect +and can just merge into a single contiguous one. + +@node File and Directory Selection +@subsection File and Directory Selection + +@table @samp + +@item -a +@itemx --text +@opindex -a +@opindex --text +@cindex suppress binary data +@cindex binary files +Process a binary file as if it were text; +this is equivalent to the @samp{--binary-files=text} option. + +@itemx --binary-files=@var{type} +@opindex --binary-files +@cindex binary files +If the first few bytes of a file indicate that the file contains binary data, +assume that the file is of type @var{type}. +By default, @var{type} is @samp{binary}, +and @command{grep} normally outputs either +a one-line message saying that a binary file matches, +or no message if there is no match. +If @var{type} is @samp{without-match}, +@command{grep} assumes that a binary file does not match; +this is equivalent to the @samp{-I} option. +If @var{type} is @samp{text}, +@command{grep} processes a binary file as if it were text; +this is equivalent to the @samp{-a} option. +@emph{Warning:} @samp{--binary-files=text} might output binary garbage, +which can have nasty side effects +if the output is a terminal and +if the terminal driver interprets some of it as commands. + +@item -D @var{action} +@itemx --devices=@var{action} +@opindex -D +@opindex --devices +@cindex device search +If an input file is a device, FIFO, or socket, use @var{action} to process it. +By default, @var{action} is @samp{read}, +which means that devices are read just as if they were ordinary files. +If @var{action} is @samp{skip}, +devices, FIFOs, and sockets are silently skipped. + +@item -d @var{action} +@itemx --directories=@var{action} +@opindex -d +@opindex --directories +@cindex directory search +If an input file is a directory, use @var{action} to process it. +By default, @var{action} is @samp{read}, +which means that directories are read just as if they were ordinary files +(some operating systems and file systems disallow this, +and will cause @command{grep} +to print error messages for every directory or silently skip them). +If @var{action} is @samp{skip}, directories are silently skipped. +If @var{action} is @samp{recurse}, +@command{grep} reads all files under each directory, recursively; +this is equivalent to the @samp{-r} option. + +@item --exclude=@var{glob} +@opindex --exclude +@cindex exclude files +@cindex searching directory trees +Skip files whose base name matches @var{glob} +(using wildcard matching). +A file-name glob can use +@samp{*}, @samp{?}, and @samp{[}...@samp{]} as wildcards, +and @code{\} to quote a wildcard or backslash character literally. + +@item --exclude-from=@var{file} +@opindex --exclude-from +@cindex exclude files +@cindex searching directory trees +Skip files whose base name matches any of the file-name globs +read from @var{file} (using wildcard matching as described +under @samp{--exclude}). + +@item --exclude-dir=@var{dir} +@opindex --exclude-dir +@cindex exclude directories +Exclude directories matching the pattern @var{dir} from recursive +directory searches. + +@item -I +Process a binary file as if it did not contain matching data; +this is equivalent to the @samp{--binary-files=without-match} option. + +@item --include=@var{glob} +@opindex --include +@cindex include files +@cindex searching directory trees +Search only files whose base name matches @var{glob} +(using wildcard matching as described under @samp{--exclude}). + +@item -r +@itemx -R +@itemx --recursive +@opindex -r +@opindex --recursive +@cindex recursive search +@cindex searching directory trees +For each directory mentioned on the command line, +read and process all files in that directory, recursively. +This is the same as the @samp{--directories=recurse} option. + +@end table + +@node Other Options +@subsection Other Options + +@table @samp + +@item --line-buffered +@opindex --line-buffered +@cindex line buffering +Use line buffering on output. +This can cause a performance penalty. + +@item --mmap +@opindex --mmap +@cindex memory mapped input +If possible, use the @code{mmap} system call to read input, +instead of the default @code{read} system call. +In some situations, @samp{--mmap} yields better performance. +However, @samp{--mmap} can cause undefined behavior (including core dumps) +if an input file shrinks while @command{grep} is operating, +or if an I/O error occurs. + +@item -U +@itemx --binary +@opindex -U +@opindex --binary +@cindex @sc{ms-dos}/@sc{ms}-Windows binary files +@cindex binary files, @sc{ms-dos}/@sc{ms}-Windows +Treat the file(s) as binary. +By default, under @sc{ms-dos} and @sc{ms}-Windows, +@command{grep} guesses the file type +by looking at the contents of the first 32kB read from the file. +If @command{grep} decides the file is a text file, +it strips the @code{CR} characters from the original file contents +(to make regular expressions with @code{^} and @code{$} work correctly). +Specifying @samp{-U} overrules this guesswork, +causing all files to be read and passed to the matching mechanism verbatim; +if the file is a text file with @code{CR/LF} pairs at the end of each line, +this will cause some regular expressions to fail. +This option has no effect +on platforms other than @sc{ms-dos} and @sc{ms}-Windows. + +@item -z +@itemx --null-data +@opindex -z +@opindex --null-data +@cindex zero-terminated lines +Treat the input as a set of lines, each terminated by a zero byte (the +@sc{ascii} @code{NUL} character) instead of a newline. +Like the @samp{-Z} or @samp{--null} option, +this option can be used with commands like +@samp{sort -z} to process arbitrary file names. + +@end table + +@node Environment Variables +@section Environment Variables + +The behavior of @command{grep} is affected +by the following environment variables. + +The locale for category @w{@code{LC_@var{foo}}} +is specified by examining the three environment variables +@env{LC_ALL}, @w{@env{LC_@var{foo}}}, and @env{LANG}, +in that order. +The first of these variables that is set specifies the locale. +For example, if @env{LC_ALL} is not set, +but @env{LC_MESSAGES} is set to @samp{pt_BR}, +then the Brazilian Portuguese locale is used +for the @code{LC_MESSAGES} category. +The @samp{C} locale is used if none of these environment variables are set, +if the locale catalog is not installed, +or if @command{grep} was not compiled +with national language support (@sc{nls}). + +@cindex environment variables + +@table @env + +@item GREP_OPTIONS +@vindex GREP_OPTIONS @r{environment variable} +@cindex default options environment variable +This variable specifies default options to be placed in front of any +explicit options. +For example, if @code{GREP_OPTIONS} is +@samp{--binary-files=without-match --directories=skip}, @command{grep} +behaves as if the two options @samp{--binary-files=without-match} and +@samp{--directories=skip} had been specified before +any explicit options. +Option specifications are separated by +whitespace. +A backslash escapes the next character, so it can be used to +specify an option containing whitespace or a backslash. + +@item GREP_COLOR +@vindex GREP_COLOR @r{environment variable} +@cindex highlight markers +This variable specifies the color used to highlight matched (non-empty) text. +It is deprecated in favor of @code{GREP_COLORS}, but still supported. +The @samp{mt}, @samp{ms}, and @samp{mc} capabilities of @code{GREP_COLORS} +have priority over it. +It can only specify the color used to highlight +the matching non-empty text in any matching line +(a selected line when the @samp{-v} command-line option is omitted, +or a context line when @samp{-v} is specified). +The default is @samp{01;31}, +which means a bold red foreground text on the terminal's default background. + +@item GREP_COLORS +@vindex GREP_COLORS @r{environment variable} +@cindex highlight markers +This variable specifies the colors and other attributes +used to highlight various parts of the output. +Its value is a colon-separated list of capabilities +that defaults to @samp{ms=01;31:mc=01;31:sl=:cx=:fn=35:ln=32:bn=32:se=36} +with the @samp{rv} and @samp{ne} boolean capabilities omitted (i.e., false). +Supported capabilities are as follows. + +@table @code +@item sl= +@vindex sl GREP_COLORS @r{capability} +SGR substring for whole selected lines +(i.e., +matching lines when the @samp{-v} command-line option is omitted, +or non-matching lines when @samp{-v} is specified). +If however the boolean @samp{rv} capability +and the @samp{-v} command-line option are both specified, +it applies to context matching lines instead. +The default is empty (i.e., the terminal's default color pair). + +@item cx= +@vindex cx GREP_COLORS @r{capability} +SGR substring for whole context lines +(i.e., +non-matching lines when the @samp{-v} command-line option is omitted, +or matching lines when @samp{-v} is specified). +If however the boolean @samp{rv} capability +and the @samp{-v} command-line option are both specified, +it applies to selected non-matching lines instead. +The default is empty (i.e., the terminal's default color pair). + +@item rv +@vindex rv GREP_COLORS @r{capability} +Boolean value that reverses (swaps) the meanings of +the @samp{sl=} and @samp{cx=} capabilities +when the @samp{-v} command-line option is specified. +The default is false (i.e., the capability is omitted). + +@item mt=01;31 +@vindex mt GREP_COLORS @r{capability} +SGR substring for matching non-empty text in any matching line +(i.e., +a selected line when the @samp{-v} command-line option is omitted, +or a context line when @samp{-v} is specified). +Setting this is equivalent to setting both @samp{ms=} and @samp{mc=} +at once to the same value. +The default is a bold red text foreground over the current line background. + +@item ms=01;31 +@vindex ms GREP_COLORS @r{capability} +SGR substring for matching non-empty text in a selected line. +(This is only used when the @samp{-v} command-line option is omitted.) +The effect of the @samp{sl=} (or @samp{cx=} if @samp{rv}) capability +remains active when this kicks in. +The default is a bold red text foreground over the current line background. + +@item mc=01;31 +@vindex mc GREP_COLORS @r{capability} +SGR substring for matching non-empty text in a context line. +(This is only used when the @samp{-v} command-line option is specified.) +The effect of the @samp{cx=} (or @samp{sl=} if @samp{rv}) capability +remains active when this kicks in. +The default is a bold red text foreground over the current line background. + +@item fn=35 +@vindex fn GREP_COLORS @r{capability} +SGR substring for file names prefixing any content line. +The default is a magenta text foreground over the terminal's default background. + +@item ln=32 +@vindex ln GREP_COLORS @r{capability} +SGR substring for line numbers prefixing any content line. +The default is a green text foreground over the terminal's default background. + +@item bn=32 +@vindex bn GREP_COLORS @r{capability} +SGR substring for byte offsets prefixing any content line. +The default is a green text foreground over the terminal's default background. + +@item se=36 +@vindex fn GREP_COLORS @r{capability} +SGR substring for separators that are inserted +between selected line fields (@samp{:}), +between context line fields (@samp{-}), +and between groups of adjacent lines +when nonzero context is specified (@samp{--}). +The default is a cyan text foreground over the terminal's default background. + +@item ne +@vindex ne GREP_COLORS @r{capability} +Boolean value that prevents clearing to the end of line +using Erase in Line (EL) to Right (@samp{\33[K}) +each time a colorized item ends. +This is needed on terminals on which EL is not supported. +It is otherwise useful on terminals +for which the @code{back_color_erase} +(@code{bce}) boolean terminfo capability does not apply, +when the chosen highlight colors do not affect the background, +or when EL is too slow or causes too much flicker. +The default is false (i.e., the capability is omitted). +@end table + +Note that boolean capabilities have no @samp{=}... part. +They are omitted (i.e., false) by default and become true when specified. + +See the Select Graphic Rendition (SGR) section +in the documentation of your text terminal +for permitted values and their meaning as character attributes. +These substring values are integers in decimal representation +and can be concatenated with semicolons. +@command{grep} takes care of assembling the result +into a complete SGR sequence (@samp{\33[}...@samp{m}). +Common values to concatenate include +@samp{1} for bold, +@samp{4} for underline, +@samp{5} for blink, +@samp{7} for inverse, +@samp{39} for default foreground color, +@samp{30} to @samp{37} for foreground colors, +@samp{90} to @samp{97} for 16-color mode foreground colors, +@samp{38;5;0} to @samp{38;5;255} +for 88-color and 256-color modes foreground colors, +@samp{49} for default background color, +@samp{40} to @samp{47} for background colors, +@samp{100} to @samp{107} for 16-color mode background colors, +and @samp{48;5;0} to @samp{48;5;255} +for 88-color and 256-color modes background colors. + +@item LC_ALL +@itemx LC_COLLATE +@itemx LANG +@vindex LC_ALL @r{environment variable} +@vindex LC_COLLATE @r{environment variable} +@vindex LANG @r{environment variable} +@cindex character type +@cindex national language support +@cindex NLS +These variables specify the locale for the @code{LC_COLLATE} category, +which determines the collating sequence +used to interpret range expressions like @samp{[a-z]}. + +@item LC_ALL +@itemx LC_CTYPE +@itemx LANG +@vindex LC_ALL @r{environment variable} +@vindex LC_CTYPE @r{environment variable} +@vindex LANG @r{environment variable} +@cindex character type +@cindex national language support +@cindex NLS +These variables specify the locale for the @code{LC_CTYPE} category, +which determines the type of characters, +e.g., which characters are whitespace. + +@item LC_ALL +@itemx LC_MESSAGES +@itemx LANG +@vindex LC_ALL @r{environment variable} +@vindex LC_MESSAGES @r{environment variable} +@vindex LANG @r{environment variable} +@cindex language of messages +@cindex message language +@cindex national language support +@cindex NLS +@cindex translation of message language +These variables specify the locale for the @code{LC_MESSAGES} category, +which determines the language that @command{grep} uses for messages. +The default @samp{C} locale uses American English messages. + +@item POSIXLY_CORRECT +@vindex POSIXLY_CORRECT @r{environment variable} +If set, @command{grep} behaves as @sc{posix.2} requires; otherwise, +@command{grep} behaves more like other @sc{gnu} programs. +@sc{posix.2} +requires that options that +follow file names must be treated as file names; +by default, +such options are permuted to the front of the operand list +and are treated as options. +Also, +@sc{posix.2} requires that unrecognized options be diagnosed as ``illegal'', +but since they are not really against the law the default +is to diagnose them as ``invalid''. +@code{POSIXLY_CORRECT} also disables @code{_@var{N}_GNU_nonoption_argv_flags_}, +described below. + +@item _@var{N}_GNU_nonoption_argv_flags_ +@vindex _@var{N}_GNU_nonoption_argv_flags_ @r{environment variable} +(Here @code{@var{N}} is @command{grep}'s numeric process ID.) +If the @var{i}th character of this environment variable's value is @samp{1}, +do not consider the @var{i}th operand of @command{grep} to be an option, +even if it appears to be one. +A shell can put this variable in the environment for each command it runs, +specifying which operands are the results of file name wildcard expansion +and therefore should not be treated as options. +This behavior is available only with the @sc{gnu} C library, +and only when @code{POSIXLY_CORRECT} is not set. + +@end table + +@node Exit Status +@chapter Exit Status + +Normally, the exit status is 0 if selected lines are found and 1 otherwise. +But the exit status is 2 if an error occurred, unless the @option{-q} or +@option{--quiet} or @option{--silent} option is used and a selected line +is found. +Note, however, that @sc{posix} only mandates, +for programs such as @command{grep}, @command{cmp}, and @command{diff}, +that the exit status in case of error be greater than 1; +it is therefore advisable, for the sake of portability, +to use logic that tests for this general condition +instead of strict equality with@ 2. + +@node grep Programs +@chapter @command{grep} programs + +@command{grep} searches the named input files +(or standard input if no files are named, +or the file name @file{-} is given) +for lines containing a match to the given pattern. +By default, @command{grep} prints the matching lines. +There are four major variants of @command{grep}, +controlled by the following options. + +@table @samp + +@item -G +@itemx --basic-regexp +@opindex -G +@opindex --basic-regexp +@cindex matching basic regular expressions +Interpret the pattern as a basic regular expression (BRE). +This is the default. + +@item -E +@itemx --extended-regexp +@opindex -E +@opindex --extended-regexp +@cindex matching extended regular expressions +Interpret the pattern as an extended regular expression (ERE). +(@samp{-E} is specified by @sc{posix}.) + +@item -F +@itemx --fixed-strings +@opindex -F +@opindex --fixed-strings +@cindex matching fixed strings +Interpret the pattern as a list of fixed strings, separated +by newlines, any of which is to be matched. +(@samp{-F} is specified by @sc{posix}.) + +@item -P +@itemx --perl-regexp +@opindex -P +@opindex --perl-regexp +@cindex matching Perl regular expressions +Interpret the pattern as a Perl regular expression. +This is highly experimental and +@samp{grep@ -P} may warn of unimplemented features. + +@end table + +In addition, +two variant programs @command{egrep} and @command{fgrep} are available. +@command{egrep} is the same as @samp{grep@ -E}. +@command{fgrep} is the same as @samp{grep@ -F}. +Direct invocation as either +@command{egrep} or @command{fgrep} is deprecated, +but is provided to allow historical applications +that rely on them to run unmodified. + +@node Regular Expressions +@chapter Regular Expressions +@cindex regular expressions + +A @dfn{regular expression} is a pattern that describes a set of strings. +Regular expressions are constructed analogously to arithmetic expressions, +by using various operators to combine smaller expressions. +@command{grep} understands +two different versions of regular expression syntax: +``basic''(BRE) and ``extended''(ERE). +In @sc{gnu} @command{grep}, +there is no difference in available functionality using either syntax. +In other implementations, basic regular expressions are less powerful. +The following description applies to extended regular expressions; +differences for basic regular expressions are summarized afterwards. + +@menu +* Fundamental Structure:: +* Character Classes and Bracket Expressions:: +* The Backslash Character and Special Expressions:: +* Anchoring:: +* Back-references and Subexpressions:: +* Basic vs Extended:: +@end menu + +@node Fundamental Structure +@section Fundamental Structure + +The fundamental building blocks are the regular expressions that match +a single character. +Most characters, including all letters and digits, +are regular expressions that match themselves. +Any meta-character +with special meaning may be quoted by preceding it with a backslash. + +A regular expression may be followed by one of several +repetition operators: + +@table @samp + +@item . +@opindex . +@cindex dot +@cindex period +The period @samp{.} matches any single character. + +@item ? +@opindex ? +@cindex question mark +@cindex match expression at most once +The preceding item is optional and will be matched at most once. + +@item * +@opindex * +@cindex asterisk +@cindex match expression zero or more times +The preceding item will be matched zero or more times. + +@item + +@opindex + +@cindex plus sign +@cindex match expression one or more times +The preceding item will be matched one or more times. + +@item @{@var{n}@} +@opindex @{@var{n}@} +@cindex braces, one argument +@cindex match expression @var{n} times +The preceding item is matched exactly @var{n} times. + +@item @{@var{n},@} +@opindex @{@var{n},@} +@cindex braces, second argument omitted +@cindex match expression @var{n} or more times +The preceding item is matched @var{n} or more times. + +@item @{,@var{m}@} +@opindex @{,@var{m}@} +@cindex braces, first argument omitted +@cindex match expression at most @var{m} times +The preceding item is matched at most @var{m} times. + +@item @{@var{n},@var{m}@} +@opindex @{@var{n},@var{m}@} +@cindex braces, two arguments +@cindex match expression from @var{n} to @var{m} times +The preceding item is matched at least @var{n} times, but not more than +@var{m} times. + +@end table + +Two regular expressions may be concatenated; +the resulting regular expression +matches any string formed by concatenating two substrings +that respectively match the concatenated expressions. + +Two regular expressions may be joined by the infix operator @samp{|}; +the resulting regular expression +matches any string matching either alternalte expression. + +Repetition takes precedence over concatenation, +which in turn takes precedence over alternation. +A whole expression may be enclosed in parentheses +to override these precedence rules and form a subexpression. + +@node Character Classes and Bracket Expressions +@section Character Classes and Bracket Expressions + +@cindex bracket expression +@cindex character class +A @dfn{bracket expression} is a list of characters enclosed by @samp{[} and +@samp{]}. +It matches any single character in that list; +if the first character of the list is the caret @samp{^}, +then it matches any character @strong{not} in the list. +For example, the regular expression +@samp{[0123456789]} matches any single digit. + +@cindex range expression +Within a bracket expression, a @dfn{range expression} consists of two +characters separated by a hyphen. +It matches any single character that +sorts between the two characters, inclusive, using the locale's +collating sequence and character set. +For example, in the default C +locale, @samp{[a-d]} is equivalent to @samp{[abcd]}. +Many locales sort +characters in dictionary order, and in these locales @samp{[a-d]} is +typically not equivalent to @samp{[abcd]}; +it might be equivalent to @samp{[aBbCcDd]}, for example. +To obtain the traditional interpretation +of bracket expressions, you can use the @samp{C} locale by setting the +@env{LC_ALL} environment variable to the value @samp{C}. + +Finally, certain named classes of characters are predefined within +bracket expressions, as follows. +Their interpretation depends on the @code{LC_CTYPE} locale; +the interpretation below is that of the @samp{C} locale, +which is the default if no @code{LC_CTYPE} locale is specified. + +@cindex classes of characters +@cindex character classes +@table @samp + +@item [:alnum:] +@opindex alnum @r{character class} +@cindex alphanumeric characters +Alphanumeric characters: +@samp{[:alpha:]} and @samp{[:digit:]}. + +@item [:alpha:] +@opindex alpha @r{character class} +@cindex alphabetic characters +Alphabetic characters: +@samp{[:lower:]} and @samp{[:upper:]}. + +@item [:blank:] +@opindex blank @r{character class} +@cindex blank characters +Blank characters: +space and tab. + +@item [:cntrl:] +@opindex cntrl @r{character class} +@cindex control characters +Control characters. +In @sc{ascii}, these characters have octal codes 000 +through 037, and 177 (@code{DEL}). +In other character sets, these are +the equivalent characters, if any. + +@item [:digit:] +@opindex digit @r{character class} +@cindex digit characters +@cindex numeric characters +Digits: @code{0 1 2 3 4 5 6 7 8 9}. + +@item [:graph:] +@opindex graph @r{character class} +@cindex graphic characters +Graphical characters: +@samp{[:alnum:]} and @samp{[:punct:]}. + +@item [:lower:] +@opindex lower @r{character class} +@cindex lower-case letters +Lower-case letters: +@code{a b c d e f g h i j k l m n o p q r s t u v w x y z}. + +@item [:print:] +@opindex print @r{character class} +@cindex printable characters +Printable characters: +@samp{[:alnum:]}, @samp{[:punct:]}, and space. + +@item [:punct:] +@opindex punct @r{character class} +@cindex punctuation characters +Punctuation characters: +@code{!@: " # $ % & ' ( ) * + , - .@: / : ; < = > ?@: @@ [ \ ] ^ _ ` @{ | @} ~}. + +@item [:space:] +@opindex space @r{character class} +@cindex space characters +@cindex whitespace characters +Space characters: +tab, newline, vertical tab, form feed, carriage return, and space. + +@item [:upper:] +@opindex upper @r{character class} +@cindex upper-case letters +Upper-case letters: +@code{A B C D E F G H I J K L M N O P Q R S T U V W X Y Z}. + +@item [:xdigit:] +@opindex xdigit @r{character class} +@cindex xdigit class +@cindex hexadecimal digits +Hexadecimal digits: +@code{0 1 2 3 4 5 6 7 8 9 A B C D E F a b c d e f}. + +@end table +For example, @samp{[[:alnum:]]} means @samp{[0-9A-Za-z]}, except the latter +depends upon the @samp{C} locale and the @sc{ascii} character +encoding, whereas the former is independent of locale and character set. +(Note that the brackets in these class names are +part of the symbolic names, and must be included in addition to +the brackets delimiting the bracket expression.) + +Most meta-characters lose their special meaning inside bracket expressions. + +@table @samp +@item ] +ends the bracket expression if it's not the first list item. +So, if you want to make the @samp{]} character a list item, +you must put it first. + +@item [. +represents the open collating symbol. + +@item .] +represents the close collating symbol. + +@item [= +represents the open equivalence class. + +@item =] +represents the close equivalence class. + +@item [: +represents the open character class symbol, and should be followed by a valid character class name. + +@item :] +represents the close character class symbol. + +@item - +represents the range if it's not first or last in a list or the ending point +of a range. + +@item ^ +represents the characters not in the list. +If you want to make the @samp{^} +character a list item, place it anywhere but first. + +@end table + +@node The Backslash Character and Special Expressions +@section The Backslash Character and Special Expressions +@cindex backslash + +The @samp{\} character, +when followed by certain ordinary characters, +takes a special meaning: + +@table @samp + +@item @samp{\b} +Match the empty string at the edge of a word. + +@item @samp{\B} +Match the empty string provided it's not at the edge of a word. + +@item @samp{\<} +Match the empty string at the beginning of word. + +@item @samp{\>} +Match the empty string at the end of word. + +@item @samp{\w} +Match word constituent, it is a synonym for @samp{[[:alnum:]]}. + +@item @samp{\W} +Match non-word constituent, it is a synonym for @samp{[^[:alnum:]]}. + +@end table + +For example, @samp{\brat\b} matches the separate word @samp{rat}, +@samp{\Brat\B} matches @samp{crate} but not @samp{furry rat}. + +@node Anchoring +@section Anchoring +@cindex anchoring + +The caret @samp{^} and the dollar sign @samp{$} are meta-characters that +respectively match the empty string at the beginning and end of a line. + +@node Back-references and Subexpressions +@section Back-references and Subexpressions +@cindex subexpression +@cindex back-reference + +The back-reference @samp{\@var{n}}, where @var{n} is a single digit, matches +the substring previously matched by the @var{n}th parenthesized subexpression +of the regular expression. +For example, @samp{(a)\1} matches @samp{aa}. +When used with alternation, if the group does not participate in the match then +the back-reference makes the whole match fail. +For example, @samp{a(.)|b\1} +will not match @samp{ba}. +When multiple regular expressions are given with +@samp{-e} or from a file (@samp{-f file}), +back-references are local to each expression. + +@node Basic vs Extended +@section Basic vs Extended Regular Expressions +@cindex basic regular expressions + +In basic regular expressions the meta-characters @samp{?}, @samp{+}, +@samp{@{}, @samp{|}, @samp{(}, and @samp{)} lose their special meaning; +instead use the backslashed versions @samp{\?}, @samp{\+}, @samp{\@{}, +@samp{\|}, @samp{\(}, and @samp{\)}. + +@cindex interval specifications +Traditional @command{egrep} did not support the @samp{@{} meta-character, +and some @command{egrep} implementations support @samp{\@{} instead, so +portable scripts should avoid @samp{@{} in @samp{grep@ -E} patterns and +should use @samp{[@{]} to match a literal @samp{@{}. + +@sc{gnu} @command{grep@ -E} attempts to support traditional usage by +assuming that @samp{@{} is not special if it would be the start of an +invalid interval specification. +For example, the command +@samp{grep@ -E@ '@{1'} searches for the two-character string @samp{@{1} +instead of reporting a syntax error in the regular expression. +@sc{posix.2} allows this behavior as an extension, but portable scripts +should avoid it. + +@node Usage +@chapter Usage + +@cindex Usage, examples +Here is an example command that invokes @sc{gnu} @command{grep}: + +@example +grep -i 'hello.*world' menu.h main.c +@end example + +@noindent +This lists all lines in the files @file{menu.h} and @file{main.c} that +contain the string @samp{hello} followed by the string @samp{world}; +this is because @samp{.*} matches zero or more characters within a line. +@xref{Regular Expressions}. +The @samp{-i} option causes @command{grep} +to ignore case, causing it to match the line @samp{Hello, world!}, which +it would not otherwise match. +@xref{Invoking}, for more details about +how to invoke @command{grep}. + +@cindex Using @command{grep}, Q&A +@cindex FAQ about @command{grep} usage +Here are some common questions and answers about @command{grep} usage. + +@enumerate + +@item +How can I list just the names of matching files? + +@example +grep -l 'main' *.c +@end example + +@noindent +lists the names of all C files in the current directory whose contents +mention @samp{main}. + +@item +How do I search directories recursively? + +@example +grep -r 'hello' /home/gigi +@end example + +@noindent +searches for @samp{hello} in all files +under the @file{/home/gigi} directory. +For more control over which files are searched, +use @command{find}, @command{grep}, and @command{xargs}. +For example, the following command searches only C files: + +@example +find /home/gigi -name '*.c' -print0 | xargs -0r grep -H 'hello' +@end example + +This differs from the command: + +@example +grep -rH 'hello' *.c +@end example + +which merely looks for @samp{hello} in all files in the current +directory whose names end in @samp{.c}. +Here the @option{-r} is +probably unnecessary, as recursion occurs only in the unlikely event +that one of @samp{.c} files is a directory. +The @samp{find ...} command line above is more similar to the command: + +@example +grep -rH --include='*.c' 'hello' /home/gigi +@end example + +@item +What if a pattern has a leading @samp{-}? + +@example +grep -e '--cut here--' * +@end example + +@noindent +searches for all lines matching @samp{--cut here--}. +Without @samp{-e}, +@command{grep} would attempt to parse @samp{--cut here--} as a list of +options. + +@item +Suppose I want to search for a whole word, not a part of a word? + +@example +grep -w 'hello' * +@end example + +@noindent +searches only for instances of @samp{hello} that are entire words; +it does not match @samp{Othello}. +For more control, use @samp{\<} and +@samp{\>} to match the start and end of words. +For example: + +@example +grep 'hello\>' * +@end example + +@noindent +searches only for words ending in @samp{hello}, so it matches the word +@samp{Othello}. + +@item +How do I output context around the matching lines? + +@example +grep -C 2 'hello' * +@end example + +@noindent +prints two lines of context around each matching line. + +@item +How do I force @command{grep} to print the name of the file? + +Append @file{/dev/null}: + +@example +grep 'eli' /etc/passwd /dev/null +@end example + +gets you: + +@example +/etc/passwd:eli:x:2098:1000:Eli Smith:/home/eli:/bin/bash +@end example + +Alternatively, use @samp{-H}, which is a @sc{gnu} extension: + +@example +grep -H 'eli' /etc/passwd +@end example + +@item +Why do people use strange regular expressions on @command{ps} output? + +@example +ps -ef | grep '[c]ron' +@end example + +If the pattern had been written without the square brackets, it would +have matched not only the @command{ps} output line for @command{cron}, +but also the @command{ps} output line for @command{grep}. +Note that on some platforms, +@command{ps} limits the output to the width of the screen; +@command{grep} does not have any limit on the length of a line +except the available memory. + +@item +Why does @command{grep} report ``Binary file matches''? + +If @command{grep} listed all matching ``lines'' from a binary file, it +would probably generate output that is not useful, and it might even +muck up your display. +So @sc{gnu} @command{grep} suppresses output from +files that appear to be binary files. +To force @sc{gnu} @command{grep} +to output lines even from files that appear to be binary, use the +@samp{-a} or @samp{--binary-files=text} option. +To eliminate the +``Binary file matches'' messages, use the @samp{-I} or +@samp{--binary-files=without-match} option. + +@item +Why doesn't @samp{grep -lv} print non-matching file names? + +@samp{grep -lv} lists the names of all files containing one or more +lines that do not match. +To list the names of all files that contain no +matching lines, use the @samp{-L} or @samp{--files-without-match} +option. + +@item +I can do @sc{or} with @samp{|}, but what about @sc{and}? + +@example +grep 'paul' /etc/motd | grep 'franc,ois' +@end example + +@noindent +finds all lines that contain both @samp{paul} and @samp{franc,ois}. + +@item +How can I search in both standard input and in files? + +Use the special file name @samp{-}: + +@example +cat /etc/passwd | grep 'alain' - /etc/motd +@end example + +@item +@cindex palindromes +How to express palindromes in a regular expression? + +It can be done by using back-references; +for example, +a palindrome of 4 characters can be written with a BRE: + +@example +grep -w -e '\(.\)\(.\).\2\1' file +@end example + +It matches the word "radar" or "civic". + +Guglielmo Bondioni proposed a single RE +that finds all palindromes up to 19 characters long +using @w{9 subexpressions} and @w{9 back-references}: + +@smallexample +grep -E -e '^(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?).?\9\8\7\6\5\4\3\2\1$' file +@end smallexample + +Note this is done by using @sc{gnu} ERE extensions; +it might not be portable to other implementations of @command{grep}. + +@item +Why is this back-reference failing? + +@example +echo 'ba' | grep -E '(a)\1|b\1' +@end example + +This gives no output, because the first alternate @samp{(a)\1} does not match, +as there is no @samp{aa} in the input, so the @samp{\1} in the second alternate +has nothing to refer back to, meaning it will never match anything. +(The second alternate in this example can only match +if the first alternate has matched -- making the second one superfluous.) + +@item +What do @command{grep}, @command{fgrep}, and @command{egrep} stand for? + +The name @command{grep} comes from the way line editing was done on Unix. +For example, +@command{ed} uses the following syntax +to print a list of matching lines on the screen: + +@example +global/regular expression/print +g/re/p +@end example + +@command{fgrep} stands for Fixed @command{grep}; +@command{egrep} stands for Extended @command{grep}. + +@end enumerate + +@node Reporting Bugs, Copying, Usage, Top +@chapter Reporting bugs + +@cindex Bugs, reporting +Email bug reports to @email{bug-grep@@gnu.org}, +a mailing list whose web page is +@url{http://lists.gnu.org/mailman/listinfo/bug-grep}. +The Savannah bug tracker for @command{grep} is located at +@url{http://savannah.gnu.org/bugs/?group=grep}. + +@section Known Bugs +@cindex Bugs, known + +Large repetition counts in the @samp{@{n,m@}} construct may cause +@command{grep} to use lots of memory. +In addition, certain other +obscure regular expressions require exponential time and +space, and may cause @command{grep} to run out of memory. + +Back-references are very slow, and may require exponential time. + +@node Copying, GNU General Public License, Reporting Bugs, Top +@chapter Copying +@cindex Copying +GNU grep is licensed under the GNU GPL, which makes it @dfn{free +software}. + +Please note that ``free'' in ``free software'' refers to liberty, not +price. As some GNU project advocates like to point out, think of ``free +speech'' rather than ``free beer''. The exact and legally binding +distribution terms are spelled out below; in short, you have the right +(freedom) to run and change grep and distribute it to other people, and +even---if you want---charge money for doing either. The important +restriction is that you have to grant your recipients the same rights +and impose the same restrictions. + +This method of licensing software is also known as @dfn{open source} +because, among other things, it makes sure that all recipients will +receive the source code along with the program, and be able to improve +it. The GNU project prefers the term ``free software'' for reasons +outlined at +@url{http://www.gnu.org/philosophy/free-software-for-freedom.html}. + +The exact license terms are defined by this paragraph and the GNU +General Public License it refers to: + +@quotation +GNU grep 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 of the License, or (at your +option) any later version. + +GNU grep 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. + +A copy of the GNU General Public License is included as part of this +manual; if you did not receive it, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +@end quotation + +In addition to this, this manual is free in the same sense: + +@quotation +Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU Free Documentation License, Version 1.1 or +any later version published by the Free Software Foundation; with the +Invariant Sections being ``GNU General Public License'' and ``GNU Free +Documentation License'', with no Front-Cover Texts, and with no +Back-Cover Texts. A copy of the license is included in the section +entitled ``GNU Free Documentation License''. +@end quotation + +@c #### Maybe we should wrap these licenses in ifinfo? Stallman says +@c that the GFDL needs to be present in the manual, and to me it would +@c suck to include the license for the manual and not the license for +@c the program. + +The full texts of the GNU General Public License and of the GNU Free +Documentation License are available below. + +@menu +* GNU General Public License:: GNU GPL +* GNU Free Documentation License:: GNU FDL +@end menu + +@node GNU General Public License, GNU Free Documentation License, Copying, Copying +@section GNU General Public License +@center Version 2, June 1991 +@cindex GPL, GNU General Public License + +@display +Copyright @copyright{} 1989, 1991 Free Software Foundation, Inc. +675 Mass Ave, Cambridge, MA 02139, USA + +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. +@end display + +@unnumberedsubsec Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software---to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + +@iftex +@unnumberedsubsec TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION +@end iftex +@ifinfo +@center TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION +@end ifinfo + +@enumerate +@item +This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The ``Program'', below, +refers to any such program or work, and a ``work based on the Program'' +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term ``modification''.) Each licensee is addressed as ``you''. + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + +@item +You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + +@item +You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + +@enumerate a +@item +You must cause the modified files to carry prominent notices +stating that you changed the files and the date of any change. + +@item +You must cause any work that you distribute or publish, that in +whole or in part contains or is derived from the Program or any +part thereof, to be licensed as a whole at no charge to all third +parties under the terms of this License. + +@item +If the modified program normally reads commands interactively +when run, you must cause it, when started running for such +interactive use in the most ordinary way, to print or display an +announcement including an appropriate copyright notice and a +notice that there is no warranty (or else, saying that you provide +a warranty) and that users may redistribute the program under +these conditions, and telling the user how to view a copy of this +License. (Exception: if the Program itself is interactive but +does not normally print such an announcement, your work based on +the Program is not required to print an announcement.) +@end enumerate + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + +@item +You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + +@enumerate a +@item +Accompany it with the complete corresponding machine-readable +source code, which must be distributed under the terms of Sections +1 and 2 above on a medium customarily used for software interchange; or, + +@item +Accompany it with a written offer, valid for at least three +years, to give any third party, for a charge no more than your +cost of physically performing source distribution, a complete +machine-readable copy of the corresponding source code, to be +distributed under the terms of Sections 1 and 2 above on a medium +customarily used for software interchange; or, + +@item +Accompany it with the information you received as to the offer +to distribute corresponding source code. (This alternative is +allowed only for noncommercial distribution and only if you +received the program in object code or executable form with such +an offer, in accord with Subsection b above.) +@end enumerate + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + +@item +You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + +@item +You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + +@item +Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + +@item +If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + +@item +If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + +@item +The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and ``any +later version'', you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + +@item +If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + +@iftex +@heading NO WARRANTY +@end iftex +@ifinfo +@center NO WARRANTY +@end ifinfo +@cindex no warranty + +@item +BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM ``AS IS'' WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + +@item +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. +@end enumerate + +@iftex +@heading END OF TERMS AND CONDITIONS +@end iftex +@ifinfo +@center END OF TERMS AND CONDITIONS +@end ifinfo + +@page +@unnumberedsubsec How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the ``copyright'' line and a pointer to where the full notice is found. + +@smallexample +@var{one line to give the program's name and an idea of what it does.} +Copyright (C) 19@var{yy} @var{name of author} + +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 +of the License, 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., 675 Mass Ave, Cambridge, MA 02139, USA. +@end smallexample + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + +@smallexample +Gnomovision version 69, Copyright (C) 19@var{yy} @var{name of author} +Gnomovision comes with ABSOLUTELY NO WARRANTY; for details +type `show w'. This is free software, and you are welcome +to redistribute it under certain conditions; type `show c' +for details. +@end smallexample + +The hypothetical commands @samp{show w} and @samp{show c} should show +the appropriate parts of the General Public License. Of course, the +commands you use may be called something other than @samp{show w} and +@samp{show c}; they could even be mouse-clicks or menu items---whatever +suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a ``copyright disclaimer'' for the program, if +necessary. Here is a sample; alter the names: + +@smallexample +@group +Yoyodyne, Inc., hereby disclaims all copyright +interest in the program `Gnomovision' +(which makes passes at compilers) written +by James Hacker. + +@var{signature of Ty Coon}, 1 April 1989 +Ty Coon, President of Vice +@end group +@end smallexample + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. + +@node GNU Free Documentation License, Concept Index, GNU General Public License, Copying +@section GNU Free Documentation License +@center Version 1.1, March 2000 +@cindex FDL, GNU Free Documentation License + +@display +Copyright (C) 2000 Free Software Foundation, Inc. +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. +@end display +@sp 1 +@enumerate 0 +@item +PREAMBLE + +The purpose of this License is to make a manual, textbook, or other +written document ``free'' in the sense of freedom: to assure everyone +the effective freedom to copy and redistribute it, with or without +modifying it, either commercially or noncommercially. Secondarily, +this License preserves for the author and publisher a way to get +credit for their work, while not being considered responsible for +modifications made by others. + +This License is a kind of ``copyleft'', which means that derivative +works of the document must themselves be free in the same sense. It +complements the GNU General Public License, which is a copyleft +license designed for free software. + +We have designed this License in order to use it for manuals for free +software, because free software needs free documentation: a free +program should come with manuals providing the same freedoms that the +software does. But this License is not limited to software manuals; +it can be used for any textual work, regardless of subject matter or +whether it is published as a printed book. We recommend this License +principally for works whose purpose is instruction or reference. + +@sp 1 +@item +APPLICABILITY AND DEFINITIONS + +This License applies to any manual or other work that contains a +notice placed by the copyright holder saying it can be distributed +under the terms of this License. The ``Document'', below, refers to any +such manual or work. Any member of the public is a licensee, and is +addressed as ``you''. + +A ``Modified Version'' of the Document means any work containing the +Document or a portion of it, either copied verbatim, or with +modifications and/or translated into another language. + +A ``Secondary Section'' is a named appendix or a front-matter section of +the Document that deals exclusively with the relationship of the +publishers or authors of the Document to the Document's overall subject +(or to related matters) and contains nothing that could fall directly +within that overall subject. (For example, if the Document is in part a +textbook of mathematics, a Secondary Section may not explain any +mathematics.) The relationship could be a matter of historical +connection with the subject or with related matters, or of legal, +commercial, philosophical, ethical or political position regarding +them. + +The ``Invariant Sections'' are certain Secondary Sections whose titles +are designated, as being those of Invariant Sections, in the notice +that says that the Document is released under this License. + +The ``Cover Texts'' are certain short passages of text that are listed, +as Front-Cover Texts or Back-Cover Texts, in the notice that says that +the Document is released under this License. + +A ``Transparent'' copy of the Document means a machine-readable copy, +represented in a format whose specification is available to the +general public, whose contents can be viewed and edited directly and +straightforwardly with generic text editors or (for images composed of +pixels) generic paint programs or (for drawings) some widely available +drawing editor, and that is suitable for input to text formatters or +for automatic translation to a variety of formats suitable for input +to text formatters. A copy made in an otherwise Transparent file +format whose markup has been designed to thwart or discourage +subsequent modification by readers is not Transparent. A copy that is +not ``Transparent'' is called ``Opaque''. + +Examples of suitable formats for Transparent copies include plain +ASCII without markup, Texinfo input format, LaTeX input format, SGML +or XML using a publicly available DTD, and standard-conforming simple +HTML designed for human modification. Opaque formats include +PostScript, PDF, proprietary formats that can be read and edited only +by proprietary word processors, SGML or XML for which the DTD and/or +processing tools are not generally available, and the +machine-generated HTML produced by some word processors for output +purposes only. + +The ``Title Page'' means, for a printed book, the title page itself, +plus such following pages as are needed to hold, legibly, the material +this License requires to appear in the title page. For works in +formats which do not have any title page as such, ``Title Page'' means +the text near the most prominent appearance of the work's title, +preceding the beginning of the body of the text. +@sp 1 +@item +VERBATIM COPYING + +You may copy and distribute the Document in any medium, either +commercially or noncommercially, provided that this License, the +copyright notices, and the license notice saying this License applies +to the Document are reproduced in all copies, and that you add no other +conditions whatsoever to those of this License. You may not use +technical measures to obstruct or control the reading or further +copying of the copies you make or distribute. However, you may accept +compensation in exchange for copies. If you distribute a large enough +number of copies you must also follow the conditions in section 3. + +You may also lend copies, under the same conditions stated above, and +you may publicly display copies. +@sp 1 +@item +COPYING IN QUANTITY + +If you publish printed copies of the Document numbering more than 100, +and the Document's license notice requires Cover Texts, you must enclose +the copies in covers that carry, clearly and legibly, all these Cover +Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on +the back cover. Both covers must also clearly and legibly identify +you as the publisher of these copies. The front cover must present +the full title with all words of the title equally prominent and +visible. You may add other material on the covers in addition. +Copying with changes limited to the covers, as long as they preserve +the title of the Document and satisfy these conditions, can be treated +as verbatim copying in other respects. + +If the required texts for either cover are too voluminous to fit +legibly, you should put the first ones listed (as many as fit +reasonably) on the actual cover, and continue the rest onto adjacent +pages. + +If you publish or distribute Opaque copies of the Document numbering +more than 100, you must either include a machine-readable Transparent +copy along with each Opaque copy, or state in or with each Opaque copy +a publicly-accessible computer-network location containing a complete +Transparent copy of the Document, free of added material, which the +general network-using public has access to download anonymously at no +charge using public-standard network protocols. If you use the latter +option, you must take reasonably prudent steps, when you begin +distribution of Opaque copies in quantity, to ensure that this +Transparent copy will remain thus accessible at the stated location +until at least one year after the last time you distribute an Opaque +copy (directly or through your agents or retailers) of that edition to +the public. + +It is requested, but not required, that you contact the authors of the +Document well before redistributing any large number of copies, to give +them a chance to provide you with an updated version of the Document. +@sp 1 +@item +MODIFICATIONS + +You may copy and distribute a Modified Version of the Document under +the conditions of sections 2 and 3 above, provided that you release +the Modified Version under precisely this License, with the Modified +Version filling the role of the Document, thus licensing distribution +and modification of the Modified Version to whoever possesses a copy +of it. In addition, you must do these things in the Modified Version: + +A. Use in the Title Page (and on the covers, if any) a title distinct + from that of the Document, and from those of previous versions + (which should, if there were any, be listed in the History section + of the Document). You may use the same title as a previous version + if the original publisher of that version gives permission.@* +B. List on the Title Page, as authors, one or more persons or entities + responsible for authorship of the modifications in the Modified + Version, together with at least five of the principal authors of the + Document (all of its principal authors, if it has less than five).@* +C. State on the Title page the name of the publisher of the + Modified Version, as the publisher.@* +D. Preserve all the copyright notices of the Document.@* +E. Add an appropriate copyright notice for your modifications + adjacent to the other copyright notices.@* +F. Include, immediately after the copyright notices, a license notice + giving the public permission to use the Modified Version under the + terms of this License, in the form shown in the Addendum below.@* +G. Preserve in that license notice the full lists of Invariant Sections + and required Cover Texts given in the Document's license notice.@* +H. Include an unaltered copy of this License.@* +I. Preserve the section entitled ``History'', and its title, and add to + it an item stating at least the title, year, new authors, and + publisher of the Modified Version as given on the Title Page. If + there is no section entitled ``History'' in the Document, create one + stating the title, year, authors, and publisher of the Document as + given on its Title Page, then add an item describing the Modified + Version as stated in the previous sentence.@* +J. Preserve the network location, if any, given in the Document for + public access to a Transparent copy of the Document, and likewise + the network locations given in the Document for previous versions + it was based on. These may be placed in the ``History'' section. + You may omit a network location for a work that was published at + least four years before the Document itself, or if the original + publisher of the version it refers to gives permission.@* +K. In any section entitled ``Acknowledgements'' or ``Dedications'', + preserve the section's title, and preserve in the section all the + substance and tone of each of the contributor acknowledgements + and/or dedications given therein.@* +L. Preserve all the Invariant Sections of the Document, + unaltered in their text and in their titles. Section numbers + or the equivalent are not considered part of the section titles.@* +M. Delete any section entitled ``Endorsements''. Such a section + may not be included in the Modified Version.@* +N. Do not retitle any existing section as ``Endorsements'' + or to conflict in title with any Invariant Section.@* +@sp 1 +If the Modified Version includes new front-matter sections or +appendices that qualify as Secondary Sections and contain no material +copied from the Document, you may at your option designate some or all +of these sections as invariant. To do this, add their titles to the +list of Invariant Sections in the Modified Version's license notice. +These titles must be distinct from any other section titles. + +You may add a section entitled ``Endorsements'', provided it contains +nothing but endorsements of your Modified Version by various +parties--for example, statements of peer review or that the text has +been approved by an organization as the authoritative definition of a +standard. + +You may add a passage of up to five words as a Front-Cover Text, and a +passage of up to 25 words as a Back-Cover Text, to the end of the list +of Cover Texts in the Modified Version. Only one passage of +Front-Cover Text and one of Back-Cover Text may be added by (or +through arrangements made by) any one entity. If the Document already +includes a cover text for the same cover, previously added by you or +by arrangement made by the same entity you are acting on behalf of, +you may not add another; but you may replace the old one, on explicit +permission from the previous publisher that added the old one. + +The author(s) and publisher(s) of the Document do not by this License +give permission to use their names for publicity for or to assert or +imply endorsement of any Modified Version. +@sp 1 +@item +COMBINING DOCUMENTS + +You may combine the Document with other documents released under this +License, under the terms defined in section 4 above for modified +versions, provided that you include in the combination all of the +Invariant Sections of all of the original documents, unmodified, and +list them all as Invariant Sections of your combined work in its +license notice. + +The combined work need only contain one copy of this License, and +multiple identical Invariant Sections may be replaced with a single +copy. If there are multiple Invariant Sections with the same name but +different contents, make the title of each such section unique by +adding at the end of it, in parentheses, the name of the original +author or publisher of that section if known, or else a unique number. +Make the same adjustment to the section titles in the list of +Invariant Sections in the license notice of the combined work. + +In the combination, you must combine any sections entitled ``History'' +in the various original documents, forming one section entitled +``History''; likewise combine any sections entitled ``Acknowledgements'', +and any sections entitled ``Dedications''. You must delete all sections +entitled ``Endorsements.'' +@sp 1 +@item +COLLECTIONS OF DOCUMENTS + +You may make a collection consisting of the Document and other documents +released under this License, and replace the individual copies of this +License in the various documents with a single copy that is included in +the collection, provided that you follow the rules of this License for +verbatim copying of each of the documents in all other respects. + +You may extract a single document from such a collection, and distribute +it individually under this License, provided you insert a copy of this +License into the extracted document, and follow this License in all +other respects regarding verbatim copying of that document. +@sp 1 +@item +AGGREGATION WITH INDEPENDENT WORKS + +A compilation of the Document or its derivatives with other separate +and independent documents or works, in or on a volume of a storage or +distribution medium, does not as a whole count as a Modified Version +of the Document, provided no compilation copyright is claimed for the +compilation. Such a compilation is called an ``aggregate'', and this +License does not apply to the other self-contained works thus compiled +with the Document, on account of their being thus compiled, if they +are not themselves derivative works of the Document. + +If the Cover Text requirement of section 3 is applicable to these +copies of the Document, then if the Document is less than one quarter +of the entire aggregate, the Document's Cover Texts may be placed on +covers that surround only the Document within the aggregate. +Otherwise they must appear on covers around the whole aggregate. +@sp 1 +@item +TRANSLATION + +Translation is considered a kind of modification, so you may +distribute translations of the Document under the terms of section 4. +Replacing Invariant Sections with translations requires special +permission from their copyright holders, but you may include +translations of some or all Invariant Sections in addition to the +original versions of these Invariant Sections. You may include a +translation of this License provided that you also include the +original English version of this License. In case of a disagreement +between the translation and the original English version of this +License, the original English version will prevail. +@sp 1 +@item +TERMINATION + +You may not copy, modify, sublicense, or distribute the Document except +as expressly provided for under this License. Any other attempt to +copy, modify, sublicense or distribute the Document is void, and will +automatically terminate your rights under this License. However, +parties who have received copies, or rights, from you under this +License will not have their licenses terminated so long as such +parties remain in full compliance. +@sp 1 +@item +FUTURE REVISIONS OF THIS LICENSE + +The Free Software Foundation may publish new, revised versions +of the GNU Free Documentation License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. See +http://www.gnu.org/copyleft/. + +Each version of the License is given a distinguishing version number. +If the Document specifies that a particular numbered version of this +License ``or any later version'' applies to it, you have the option of +following the terms and conditions either of that specified version or +of any later version that has been published (not as a draft) by the +Free Software Foundation. If the Document does not specify a version +number of this License, you may choose any version ever published (not +as a draft) by the Free Software Foundation. + +@end enumerate + +@unnumberedsubsec ADDENDUM: How to use this License for your documents + +To use this License in a document you have written, include a copy of +the License in the document and put the following copyright and +license notices just after the title page: + +@smallexample +@group + + Copyright (C) @var{year} @var{your name}. + Permission is granted to copy, distribute and/or modify this document + under the terms of the GNU Free Documentation License, Version 1.1 + or any later version published by the Free Software Foundation; + with the Invariant Sections being @var{list their titles}, with the + Front-Cover Texts being @var{list}, and with the Back-Cover Texts being @var{list}. + A copy of the license is included in the section entitled ``GNU + Free Documentation License''. +@end group +@end smallexample +If you have no Invariant Sections, write ``with no Invariant Sections'' +instead of saying which ones are invariant. If you have no +Front-Cover Texts, write ``no Front-Cover Texts'' instead of +``Front-Cover Texts being @var{list}''; likewise for Back-Cover Texts. + +If your document contains nontrivial examples of program code, we +recommend releasing these examples in parallel under your choice of +free software license, such as the GNU General Public License, +to permit their use in free software. + +@page +@node Concept Index, Index, GNU Free Documentation License, Top +@unnumbered Concept Index + +This is a general index of all issues discussed in this manual, +with the exception of all specific @command{grep} +command-line options, +environment variables, +color capabilities, +and regular expression constructs, +which are covered in their own index. + +@printindex cp + +@page +@node Index,, Concept Index, Top +@unnumbered Index + +This is an lexicographical list of all @command{grep} +command-line options, +environment variables, +color capabilities, +and regular expression constructs. + +@printindex fn + +@contents +@bye diff --git a/doc/mdate-sh b/doc/mdate-sh new file mode 100755 index 0000000..cd916c0 --- /dev/null +++ b/doc/mdate-sh @@ -0,0 +1,201 @@ +#!/bin/sh +# Get modification time of a file or directory and pretty-print it. + +scriptversion=2005-06-29.22 + +# Copyright (C) 1995, 1996, 1997, 2003, 2004, 2005 Free Software +# Foundation, Inc. +# written by Ulrich Drepper , June 1995 +# +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + +case $1 in + '') + echo "$0: No file. Try \`$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: mdate-sh [--help] [--version] FILE + +Pretty-print the modification time of FILE. + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "mdate-sh $scriptversion" + exit $? + ;; +esac + +# Prevent date giving response in another language. +LANG=C +export LANG +LC_ALL=C +export LC_ALL +LC_TIME=C +export LC_TIME + +# GNU ls changes its time format in response to the TIME_STYLE +# variable. Since we cannot assume `unset' works, revert this +# variable to its documented default. +if test "${TIME_STYLE+set}" = set; then + TIME_STYLE=posix-long-iso + export TIME_STYLE +fi + +save_arg1=$1 + +# Find out how to get the extended ls output of a file or directory. +if ls -L /dev/null 1>/dev/null 2>&1; then + ls_command='ls -L -l -d' +else + ls_command='ls -l -d' +fi + +# A `ls -l' line looks as follows on OS/2. +# drwxrwx--- 0 Aug 11 2001 foo +# This differs from Unix, which adds ownership information. +# drwxrwx--- 2 root root 4096 Aug 11 2001 foo +# +# To find the date, we split the line on spaces and iterate on words +# until we find a month. This cannot work with files whose owner is a +# user named `Jan', or `Feb', etc. However, it's unlikely that `/' +# will be owned by a user whose name is a month. So we first look at +# the extended ls output of the root directory to decide how many +# words should be skipped to get the date. + +# On HPUX /bin/sh, "set" interprets "-rw-r--r--" as options, so the "x" below. +set x`ls -l -d /` + +# Find which argument is the month. +month= +command= +until test $month +do + shift + # Add another shift to the command. + command="$command shift;" + case $1 in + Jan) month=January; nummonth=1;; + Feb) month=February; nummonth=2;; + Mar) month=March; nummonth=3;; + Apr) month=April; nummonth=4;; + May) month=May; nummonth=5;; + Jun) month=June; nummonth=6;; + Jul) month=July; nummonth=7;; + Aug) month=August; nummonth=8;; + Sep) month=September; nummonth=9;; + Oct) month=October; nummonth=10;; + Nov) month=November; nummonth=11;; + Dec) month=December; nummonth=12;; + esac +done + +# Get the extended ls output of the file or directory. +set dummy x`eval "$ls_command \"\$save_arg1\""` + +# Remove all preceding arguments +eval $command + +# Because of the dummy argument above, month is in $2. +# +# On a POSIX system, we should have +# +# $# = 5 +# $1 = file size +# $2 = month +# $3 = day +# $4 = year or time +# $5 = filename +# +# On Darwin 7.7.0 and 7.6.0, we have +# +# $# = 4 +# $1 = day +# $2 = month +# $3 = year or time +# $4 = filename + +# Get the month. +case $2 in + Jan) month=January; nummonth=1;; + Feb) month=February; nummonth=2;; + Mar) month=March; nummonth=3;; + Apr) month=April; nummonth=4;; + May) month=May; nummonth=5;; + Jun) month=June; nummonth=6;; + Jul) month=July; nummonth=7;; + Aug) month=August; nummonth=8;; + Sep) month=September; nummonth=9;; + Oct) month=October; nummonth=10;; + Nov) month=November; nummonth=11;; + Dec) month=December; nummonth=12;; +esac + +case $3 in + ???*) day=$1;; + *) day=$3; shift;; +esac + +# Here we have to deal with the problem that the ls output gives either +# the time of day or the year. +case $3 in + *:*) set `date`; eval year=\$$# + case $2 in + Jan) nummonthtod=1;; + Feb) nummonthtod=2;; + Mar) nummonthtod=3;; + Apr) nummonthtod=4;; + May) nummonthtod=5;; + Jun) nummonthtod=6;; + Jul) nummonthtod=7;; + Aug) nummonthtod=8;; + Sep) nummonthtod=9;; + Oct) nummonthtod=10;; + Nov) nummonthtod=11;; + Dec) nummonthtod=12;; + esac + # For the first six month of the year the time notation can also + # be used for files modified in the last year. + if (expr $nummonth \> $nummonthtod) > /dev/null; + then + year=`expr $year - 1` + fi;; + *) year=$3;; +esac + +# The result. +echo $day $month $year + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/doc/texinfo.tex b/doc/texinfo.tex new file mode 100644 index 0000000..8083622 --- /dev/null +++ b/doc/texinfo.tex @@ -0,0 +1,7482 @@ +% texinfo.tex -- TeX macros to handle Texinfo files. +% +% Load plain if necessary, i.e., if running under initex. +\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi +% +\def\texinfoversion{2006-10-04.17} +% +% Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, +% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free +% Software Foundation, Inc. +% +% This texinfo.tex file 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 texinfo.tex file 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 texinfo.tex file; see the file COPYING. If not, write +% to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +% Boston, MA 02110-1301, USA. +% +% As a special exception, when this file is read by TeX when processing +% a Texinfo source document, you may use the result without +% restriction. (This has been our intent since Texinfo was invented.) +% +% Please try the latest version of texinfo.tex before submitting bug +% reports; you can get the latest version from: +% http://www.gnu.org/software/texinfo/ (the Texinfo home page), or +% ftp://tug.org/tex/texinfo.tex +% (and all CTAN mirrors, see http://www.ctan.org). +% The texinfo.tex in any given distribution could well be out +% of date, so if that's what you're using, please check. +% +% Send bug reports to bug-texinfo@gnu.org. Please include including a +% complete document in each bug report with which we can reproduce the +% problem. Patches are, of course, greatly appreciated. +% +% To process a Texinfo manual with TeX, it's most reliable to use the +% texi2dvi shell script that comes with the distribution. For a simple +% manual foo.texi, however, you can get away with this: +% tex foo.texi +% texindex foo.?? +% tex foo.texi +% tex foo.texi +% dvips foo.dvi -o # or whatever; this makes foo.ps. +% The extra TeX runs get the cross-reference information correct. +% Sometimes one run after texindex suffices, and sometimes you need more +% than two; texi2dvi does it as many times as necessary. +% +% It is possible to adapt texinfo.tex for other languages, to some +% extent. You can get the existing language-specific files from the +% full Texinfo distribution. +% +% The GNU Texinfo home page is http://www.gnu.org/software/texinfo. + + +\message{Loading texinfo [version \texinfoversion]:} + +% If in a .fmt file, print the version number +% and turn on active characters that we couldn't do earlier because +% they might have appeared in the input file name. +\everyjob{\message{[Texinfo version \texinfoversion]}% + \catcode`+=\active \catcode`\_=\active} + +\message{Basics,} +\chardef\other=12 + +% We never want plain's \outer definition of \+ in Texinfo. +% For @tex, we can use \tabalign. +\let\+ = \relax + +% Save some plain tex macros whose names we will redefine. +\let\ptexb=\b +\let\ptexbullet=\bullet +\let\ptexc=\c +\let\ptexcomma=\, +\let\ptexdot=\. +\let\ptexdots=\dots +\let\ptexend=\end +\let\ptexequiv=\equiv +\let\ptexexclam=\! +\let\ptexfootnote=\footnote +\let\ptexgtr=> +\let\ptexhat=^ +\let\ptexi=\i +\let\ptexindent=\indent +\let\ptexinsert=\insert +\let\ptexlbrace=\{ +\let\ptexless=< +\let\ptexnewwrite\newwrite +\let\ptexnoindent=\noindent +\let\ptexplus=+ +\let\ptexrbrace=\} +\let\ptexslash=\/ +\let\ptexstar=\* +\let\ptext=\t + +% If this character appears in an error message or help string, it +% starts a new line in the output. +\newlinechar = `^^J + +% Use TeX 3.0's \inputlineno to get the line number, for better error +% messages, but if we're using an old version of TeX, don't do anything. +% +\ifx\inputlineno\thisisundefined + \let\linenumber = \empty % Pre-3.0. +\else + \def\linenumber{l.\the\inputlineno:\space} +\fi + +% Set up fixed words for English if not already set. +\ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi +\ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi +\ifx\putwordfile\undefined \gdef\putwordfile{file}\fi +\ifx\putwordin\undefined \gdef\putwordin{in}\fi +\ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi +\ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi +\ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi +\ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi +\ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi +\ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi +\ifx\putwordof\undefined \gdef\putwordof{of}\fi +\ifx\putwordon\undefined \gdef\putwordon{on}\fi +\ifx\putwordpage\undefined \gdef\putwordpage{page}\fi +\ifx\putwordsection\undefined \gdef\putwordsection{section}\fi +\ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi +\ifx\putwordsee\undefined \gdef\putwordsee{see}\fi +\ifx\putwordSee\undefined \gdef\putwordSee{See}\fi +\ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi +\ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi +% +\ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi +\ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi +\ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi +\ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi +\ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi +\ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi +\ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi +\ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi +\ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi +\ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi +\ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi +\ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi +% +\ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi +\ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi +\ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi +\ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi +\ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi + +% Since the category of space is not known, we have to be careful. +\chardef\spacecat = 10 +\def\spaceisspace{\catcode`\ =\spacecat} + +% sometimes characters are active, so we need control sequences. +\chardef\colonChar = `\: +\chardef\commaChar = `\, +\chardef\dashChar = `\- +\chardef\dotChar = `\. +\chardef\exclamChar= `\! +\chardef\lquoteChar= `\` +\chardef\questChar = `\? +\chardef\rquoteChar= `\' +\chardef\semiChar = `\; +\chardef\underChar = `\_ + +% Ignore a token. +% +\def\gobble#1{} + +% The following is used inside several \edef's. +\def\makecsname#1{\expandafter\noexpand\csname#1\endcsname} + +% Hyphenation fixes. +\hyphenation{ + Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script + ap-pen-dix bit-map bit-maps + data-base data-bases eshell fall-ing half-way long-est man-u-script + man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm + par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces + spell-ing spell-ings + stand-alone strong-est time-stamp time-stamps which-ever white-space + wide-spread wrap-around +} + +% Margin to add to right of even pages, to left of odd pages. +\newdimen\bindingoffset +\newdimen\normaloffset +\newdimen\pagewidth \newdimen\pageheight + +% For a final copy, take out the rectangles +% that mark overfull boxes (in case you have decided +% that the text looks ok even though it passes the margin). +% +\def\finalout{\overfullrule=0pt} + +% @| inserts a changebar to the left of the current line. It should +% surround any changed text. This approach does *not* work if the +% change spans more than two lines of output. To handle that, we would +% have adopt a much more difficult approach (putting marks into the main +% vertical list for the beginning and end of each change). +% +\def\|{% + % \vadjust can only be used in horizontal mode. + \leavevmode + % + % Append this vertical mode material after the current line in the output. + \vadjust{% + % We want to insert a rule with the height and depth of the current + % leading; that is exactly what \strutbox is supposed to record. + \vskip-\baselineskip + % + % \vadjust-items are inserted at the left edge of the type. So + % the \llap here moves out into the left-hand margin. + \llap{% + % + % For a thicker or thinner bar, change the `1pt'. + \vrule height\baselineskip width1pt + % + % This is the space between the bar and the text. + \hskip 12pt + }% + }% +} + +% Sometimes it is convenient to have everything in the transcript file +% and nothing on the terminal. We don't just call \tracingall here, +% since that produces some useless output on the terminal. We also make +% some effort to order the tracing commands to reduce output in the log +% file; cf. trace.sty in LaTeX. +% +\def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}% +\def\loggingall{% + \tracingstats2 + \tracingpages1 + \tracinglostchars2 % 2 gives us more in etex + \tracingparagraphs1 + \tracingoutput1 + \tracingmacros2 + \tracingrestores1 + \showboxbreadth\maxdimen \showboxdepth\maxdimen + \ifx\eTeXversion\undefined\else % etex gives us more logging + \tracingscantokens1 + \tracingifs1 + \tracinggroups1 + \tracingnesting2 + \tracingassigns1 + \fi + \tracingcommands3 % 3 gives us more in etex + \errorcontextlines16 +}% + +% add check for \lastpenalty to plain's definitions. If the last thing +% we did was a \nobreak, we don't want to insert more space. +% +\def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount + \removelastskip\penalty-50\smallskip\fi\fi} +\def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount + \removelastskip\penalty-100\medskip\fi\fi} +\def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount + \removelastskip\penalty-200\bigskip\fi\fi} + +% For @cropmarks command. +% Do @cropmarks to get crop marks. +% +\newif\ifcropmarks +\let\cropmarks = \cropmarkstrue +% +% Dimensions to add cropmarks at corners. +% Added by P. A. MacKay, 12 Nov. 1986 +% +\newdimen\outerhsize \newdimen\outervsize % set by the paper size routines +\newdimen\cornerlong \cornerlong=1pc +\newdimen\cornerthick \cornerthick=.3pt +\newdimen\topandbottommargin \topandbottommargin=.75in + +% Main output routine. +\chardef\PAGE = 255 +\output = {\onepageout{\pagecontents\PAGE}} + +\newbox\headlinebox +\newbox\footlinebox + +% \onepageout takes a vbox as an argument. Note that \pagecontents +% does insertions, but you have to call it yourself. +\def\onepageout#1{% + \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi + % + \ifodd\pageno \advance\hoffset by \bindingoffset + \else \advance\hoffset by -\bindingoffset\fi + % + % Do this outside of the \shipout so @code etc. will be expanded in + % the headline as they should be, not taken literally (outputting ''code). + \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}% + \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}% + % + {% + % Have to do this stuff outside the \shipout because we want it to + % take effect in \write's, yet the group defined by the \vbox ends + % before the \shipout runs. + % + \indexdummies % don't expand commands in the output. + \normalturnoffactive % \ in index entries must not stay \, e.g., if + % the page break happens to be in the middle of an example. + % We don't want .vr (or whatever) entries like this: + % \entry{{\tt \indexbackslash }acronym}{32}{\code {\acronym}} + % "\acronym" won't work when it's read back in; + % it needs to be + % {\code {{\tt \backslashcurfont }acronym} + \shipout\vbox{% + % Do this early so pdf references go to the beginning of the page. + \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi + % + \ifcropmarks \vbox to \outervsize\bgroup + \hsize = \outerhsize + \vskip-\topandbottommargin + \vtop to0pt{% + \line{\ewtop\hfil\ewtop}% + \nointerlineskip + \line{% + \vbox{\moveleft\cornerthick\nstop}% + \hfill + \vbox{\moveright\cornerthick\nstop}% + }% + \vss}% + \vskip\topandbottommargin + \line\bgroup + \hfil % center the page within the outer (page) hsize. + \ifodd\pageno\hskip\bindingoffset\fi + \vbox\bgroup + \fi + % + \unvbox\headlinebox + \pagebody{#1}% + \ifdim\ht\footlinebox > 0pt + % Only leave this space if the footline is nonempty. + % (We lessened \vsize for it in \oddfootingyyy.) + % The \baselineskip=24pt in plain's \makefootline has no effect. + \vskip 24pt + \unvbox\footlinebox + \fi + % + \ifcropmarks + \egroup % end of \vbox\bgroup + \hfil\egroup % end of (centering) \line\bgroup + \vskip\topandbottommargin plus1fill minus1fill + \boxmaxdepth = \cornerthick + \vbox to0pt{\vss + \line{% + \vbox{\moveleft\cornerthick\nsbot}% + \hfill + \vbox{\moveright\cornerthick\nsbot}% + }% + \nointerlineskip + \line{\ewbot\hfil\ewbot}% + }% + \egroup % \vbox from first cropmarks clause + \fi + }% end of \shipout\vbox + }% end of group with \indexdummies + \advancepageno + \ifnum\outputpenalty>-20000 \else\dosupereject\fi +} + +\newinsert\margin \dimen\margin=\maxdimen + +\def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}} +{\catcode`\@ =11 +\gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi +% marginal hacks, juha@viisa.uucp (Juha Takala) +\ifvoid\margin\else % marginal info is present + \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi +\dimen@=\dp#1 \unvbox#1 +\ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi +\ifr@ggedbottom \kern-\dimen@ \vfil \fi} +} + +% Here are the rules for the cropmarks. Note that they are +% offset so that the space between them is truly \outerhsize or \outervsize +% (P. A. MacKay, 12 November, 1986) +% +\def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong} +\def\nstop{\vbox + {\hrule height\cornerthick depth\cornerlong width\cornerthick}} +\def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong} +\def\nsbot{\vbox + {\hrule height\cornerlong depth\cornerthick width\cornerthick}} + +% Parse an argument, then pass it to #1. The argument is the rest of +% the input line (except we remove a trailing comment). #1 should be a +% macro which expects an ordinary undelimited TeX argument. +% +\def\parsearg{\parseargusing{}} +\def\parseargusing#1#2{% + \def\argtorun{#2}% + \begingroup + \obeylines + \spaceisspace + #1% + \parseargline\empty% Insert the \empty token, see \finishparsearg below. +} + +{\obeylines % + \gdef\parseargline#1^^M{% + \endgroup % End of the group started in \parsearg. + \argremovecomment #1\comment\ArgTerm% + }% +} + +% First remove any @comment, then any @c comment. +\def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm} +\def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm} + +% Each occurence of `\^^M' or `\^^M' is replaced by a single space. +% +% \argremovec might leave us with trailing space, e.g., +% @end itemize @c foo +% This space token undergoes the same procedure and is eventually removed +% by \finishparsearg. +% +\def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M} +\def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M} +\def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{% + \def\temp{#3}% + \ifx\temp\empty + % Do not use \next, perhaps the caller of \parsearg uses it; reuse \temp: + \let\temp\finishparsearg + \else + \let\temp\argcheckspaces + \fi + % Put the space token in: + \temp#1 #3\ArgTerm +} + +% If a _delimited_ argument is enclosed in braces, they get stripped; so +% to get _exactly_ the rest of the line, we had to prevent such situation. +% We prepended an \empty token at the very beginning and we expand it now, +% just before passing the control to \argtorun. +% (Similarily, we have to think about #3 of \argcheckspacesY above: it is +% either the null string, or it ends with \^^M---thus there is no danger +% that a pair of braces would be stripped. +% +% But first, we have to remove the trailing space token. +% +\def\finishparsearg#1 \ArgTerm{\expandafter\argtorun\expandafter{#1}} + +% \parseargdef\foo{...} +% is roughly equivalent to +% \def\foo{\parsearg\Xfoo} +% \def\Xfoo#1{...} +% +% Actually, I use \csname\string\foo\endcsname, ie. \\foo, as it is my +% favourite TeX trick. --kasal, 16nov03 + +\def\parseargdef#1{% + \expandafter \doparseargdef \csname\string#1\endcsname #1% +} +\def\doparseargdef#1#2{% + \def#2{\parsearg#1}% + \def#1##1% +} + +% Several utility definitions with active space: +{ + \obeyspaces + \gdef\obeyedspace{ } + + % Make each space character in the input produce a normal interword + % space in the output. Don't allow a line break at this space, as this + % is used only in environments like @example, where each line of input + % should produce a line of output anyway. + % + \gdef\sepspaces{\obeyspaces\let =\tie} + + % If an index command is used in an @example environment, any spaces + % therein should become regular spaces in the raw index file, not the + % expansion of \tie (\leavevmode \penalty \@M \ ). + \gdef\unsepspaces{\let =\space} +} + + +\def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next} + +% Define the framework for environments in texinfo.tex. It's used like this: +% +% \envdef\foo{...} +% \def\Efoo{...} +% +% It's the responsibility of \envdef to insert \begingroup before the +% actual body; @end closes the group after calling \Efoo. \envdef also +% defines \thisenv, so the current environment is known; @end checks +% whether the environment name matches. The \checkenv macro can also be +% used to check whether the current environment is the one expected. +% +% Non-false conditionals (@iftex, @ifset) don't fit into this, so they +% are not treated as enviroments; they don't open a group. (The +% implementation of @end takes care not to call \endgroup in this +% special case.) + + +% At runtime, environments start with this: +\def\startenvironment#1{\begingroup\def\thisenv{#1}} +% initialize +\let\thisenv\empty + +% ... but they get defined via ``\envdef\foo{...}'': +\long\def\envdef#1#2{\def#1{\startenvironment#1#2}} +\def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}} + +% Check whether we're in the right environment: +\def\checkenv#1{% + \def\temp{#1}% + \ifx\thisenv\temp + \else + \badenverr + \fi +} + +% Evironment mismatch, #1 expected: +\def\badenverr{% + \errhelp = \EMsimple + \errmessage{This command can appear only \inenvironment\temp, + not \inenvironment\thisenv}% +} +\def\inenvironment#1{% + \ifx#1\empty + out of any environment% + \else + in environment \expandafter\string#1% + \fi +} + +% @end foo executes the definition of \Efoo. +% But first, it executes a specialized version of \checkenv +% +\parseargdef\end{% + \if 1\csname iscond.#1\endcsname + \else + % The general wording of \badenverr may not be ideal, but... --kasal, 06nov03 + \expandafter\checkenv\csname#1\endcsname + \csname E#1\endcsname + \endgroup + \fi +} + +\newhelp\EMsimple{Press RETURN to continue.} + + +%% Simple single-character @ commands + +% @@ prints an @ +% Kludge this until the fonts are right (grr). +\def\@{{\tt\char64}} + +% This is turned off because it was never documented +% and you can use @w{...} around a quote to suppress ligatures. +%% Define @` and @' to be the same as ` and ' +%% but suppressing ligatures. +%\def\`{{`}} +%\def\'{{'}} + +% Used to generate quoted braces. +\def\mylbrace {{\tt\char123}} +\def\myrbrace {{\tt\char125}} +\let\{=\mylbrace +\let\}=\myrbrace +\begingroup + % Definitions to produce \{ and \} commands for indices, + % and @{ and @} for the aux/toc files. + \catcode`\{ = \other \catcode`\} = \other + \catcode`\[ = 1 \catcode`\] = 2 + \catcode`\! = 0 \catcode`\\ = \other + !gdef!lbracecmd[\{]% + !gdef!rbracecmd[\}]% + !gdef!lbraceatcmd[@{]% + !gdef!rbraceatcmd[@}]% +!endgroup + +% @comma{} to avoid , parsing problems. +\let\comma = , + +% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent +% Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H. +\let\, = \c +\let\dotaccent = \. +\def\ringaccent#1{{\accent23 #1}} +\let\tieaccent = \t +\let\ubaraccent = \b +\let\udotaccent = \d + +% Other special characters: @questiondown @exclamdown @ordf @ordm +% Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss. +\def\questiondown{?`} +\def\exclamdown{!`} +\def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}} +\def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}} + +% Dotless i and dotless j, used for accents. +\def\imacro{i} +\def\jmacro{j} +\def\dotless#1{% + \def\temp{#1}% + \ifx\temp\imacro \ptexi + \else\ifx\temp\jmacro \j + \else \errmessage{@dotless can be used only with i or j}% + \fi\fi +} + +% The \TeX{} logo, as in plain, but resetting the spacing so that a +% period following counts as ending a sentence. (Idea found in latex.) +% +\edef\TeX{\TeX \spacefactor=1000 } + +% @LaTeX{} logo. Not quite the same results as the definition in +% latex.ltx, since we use a different font for the raised A; it's most +% convenient for us to use an explicitly smaller font, rather than using +% the \scriptstyle font (since we don't reset \scriptstyle and +% \scriptscriptstyle). +% +\def\LaTeX{% + L\kern-.36em + {\setbox0=\hbox{T}% + \vbox to \ht0{\hbox{\selectfonts\lllsize A}\vss}}% + \kern-.15em + \TeX +} + +% Be sure we're in horizontal mode when doing a tie, since we make space +% equivalent to this in @example-like environments. Otherwise, a space +% at the beginning of a line will start with \penalty -- and +% since \penalty is valid in vertical mode, we'd end up putting the +% penalty on the vertical list instead of in the new paragraph. +{\catcode`@ = 11 + % Avoid using \@M directly, because that causes trouble + % if the definition is written into an index file. + \global\let\tiepenalty = \@M + \gdef\tie{\leavevmode\penalty\tiepenalty\ } +} + +% @: forces normal size whitespace following. +\def\:{\spacefactor=1000 } + +% @* forces a line break. +\def\*{\hfil\break\hbox{}\ignorespaces} + +% @/ allows a line break. +\let\/=\allowbreak + +% @. is an end-of-sentence period. +\def\.{.\spacefactor=\endofsentencespacefactor\space} + +% @! is an end-of-sentence bang. +\def\!{!\spacefactor=\endofsentencespacefactor\space} + +% @? is an end-of-sentence query. +\def\?{?\spacefactor=\endofsentencespacefactor\space} + +% @frenchspacing on|off says whether to put extra space after punctuation. +% +\def\onword{on} +\def\offword{off} +% +\parseargdef\frenchspacing{% + \def\temp{#1}% + \ifx\temp\onword \plainfrenchspacing + \else\ifx\temp\offword \plainnonfrenchspacing + \else + \errhelp = \EMsimple + \errmessage{Unknown @frenchspacing option `\temp', must be on/off}% + \fi\fi +} + +% @w prevents a word break. Without the \leavevmode, @w at the +% beginning of a paragraph, when TeX is still in vertical mode, would +% produce a whole line of output instead of starting the paragraph. +\def\w#1{\leavevmode\hbox{#1}} + +% @group ... @end group forces ... to be all on one page, by enclosing +% it in a TeX vbox. We use \vtop instead of \vbox to construct the box +% to keep its height that of a normal line. According to the rules for +% \topskip (p.114 of the TeXbook), the glue inserted is +% max (\topskip - \ht (first item), 0). If that height is large, +% therefore, no glue is inserted, and the space between the headline and +% the text is small, which looks bad. +% +% Another complication is that the group might be very large. This can +% cause the glue on the previous page to be unduly stretched, because it +% does not have much material. In this case, it's better to add an +% explicit \vfill so that the extra space is at the bottom. The +% threshold for doing this is if the group is more than \vfilllimit +% percent of a page (\vfilllimit can be changed inside of @tex). +% +\newbox\groupbox +\def\vfilllimit{0.7} +% +\envdef\group{% + \ifnum\catcode`\^^M=\active \else + \errhelp = \groupinvalidhelp + \errmessage{@group invalid in context where filling is enabled}% + \fi + \startsavinginserts + % + \setbox\groupbox = \vtop\bgroup + % Do @comment since we are called inside an environment such as + % @example, where each end-of-line in the input causes an + % end-of-line in the output. We don't want the end-of-line after + % the `@group' to put extra space in the output. Since @group + % should appear on a line by itself (according to the Texinfo + % manual), we don't worry about eating any user text. + \comment +} +% +% The \vtop produces a box with normal height and large depth; thus, TeX puts +% \baselineskip glue before it, and (when the next line of text is done) +% \lineskip glue after it. Thus, space below is not quite equal to space +% above. But it's pretty close. +\def\Egroup{% + % To get correct interline space between the last line of the group + % and the first line afterwards, we have to propagate \prevdepth. + \endgraf % Not \par, as it may have been set to \lisppar. + \global\dimen1 = \prevdepth + \egroup % End the \vtop. + % \dimen0 is the vertical size of the group's box. + \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox + % \dimen2 is how much space is left on the page (more or less). + \dimen2 = \pageheight \advance\dimen2 by -\pagetotal + % if the group doesn't fit on the current page, and it's a big big + % group, force a page break. + \ifdim \dimen0 > \dimen2 + \ifdim \pagetotal < \vfilllimit\pageheight + \page + \fi + \fi + \box\groupbox + \prevdepth = \dimen1 + \checkinserts +} +% +% TeX puts in an \escapechar (i.e., `@') at the beginning of the help +% message, so this ends up printing `@group can only ...'. +% +\newhelp\groupinvalidhelp{% +group can only be used in environments such as @example,^^J% +where each line of input produces a line of output.} + +% @need space-in-mils +% forces a page break if there is not space-in-mils remaining. + +\newdimen\mil \mil=0.001in + +% Old definition--didn't work. +%\parseargdef\need{\par % +%% This method tries to make TeX break the page naturally +%% if the depth of the box does not fit. +%{\baselineskip=0pt% +%\vtop to #1\mil{\vfil}\kern -#1\mil\nobreak +%\prevdepth=-1000pt +%}} + +\parseargdef\need{% + % Ensure vertical mode, so we don't make a big box in the middle of a + % paragraph. + \par + % + % If the @need value is less than one line space, it's useless. + \dimen0 = #1\mil + \dimen2 = \ht\strutbox + \advance\dimen2 by \dp\strutbox + \ifdim\dimen0 > \dimen2 + % + % Do a \strut just to make the height of this box be normal, so the + % normal leading is inserted relative to the preceding line. + % And a page break here is fine. + \vtop to #1\mil{\strut\vfil}% + % + % TeX does not even consider page breaks if a penalty added to the + % main vertical list is 10000 or more. But in order to see if the + % empty box we just added fits on the page, we must make it consider + % page breaks. On the other hand, we don't want to actually break the + % page after the empty box. So we use a penalty of 9999. + % + % There is an extremely small chance that TeX will actually break the + % page at this \penalty, if there are no other feasible breakpoints in + % sight. (If the user is using lots of big @group commands, which + % almost-but-not-quite fill up a page, TeX will have a hard time doing + % good page breaking, for example.) However, I could not construct an + % example where a page broke at this \penalty; if it happens in a real + % document, then we can reconsider our strategy. + \penalty9999 + % + % Back up by the size of the box, whether we did a page break or not. + \kern -#1\mil + % + % Do not allow a page break right after this kern. + \nobreak + \fi +} + +% @br forces paragraph break (and is undocumented). + +\let\br = \par + +% @page forces the start of a new page. +% +\def\page{\par\vfill\supereject} + +% @exdent text.... +% outputs text on separate line in roman font, starting at standard page margin + +% This records the amount of indent in the innermost environment. +% That's how much \exdent should take out. +\newskip\exdentamount + +% This defn is used inside fill environments such as @defun. +\parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break} + +% This defn is used inside nofill environments such as @example. +\parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount + \leftline{\hskip\leftskip{\rm#1}}}} + +% @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current +% paragraph. For more general purposes, use the \margin insertion +% class. WHICH is `l' or `r'. +% +\newskip\inmarginspacing \inmarginspacing=1cm +\def\strutdepth{\dp\strutbox} +% +\def\doinmargin#1#2{\strut\vadjust{% + \nobreak + \kern-\strutdepth + \vtop to \strutdepth{% + \baselineskip=\strutdepth + \vss + % if you have multiple lines of stuff to put here, you'll need to + % make the vbox yourself of the appropriate size. + \ifx#1l% + \llap{\ignorespaces #2\hskip\inmarginspacing}% + \else + \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}% + \fi + \null + }% +}} +\def\inleftmargin{\doinmargin l} +\def\inrightmargin{\doinmargin r} +% +% @inmargin{TEXT [, RIGHT-TEXT]} +% (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right; +% else use TEXT for both). +% +\def\inmargin#1{\parseinmargin #1,,\finish} +\def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing. + \setbox0 = \hbox{\ignorespaces #2}% + \ifdim\wd0 > 0pt + \def\lefttext{#1}% have both texts + \def\righttext{#2}% + \else + \def\lefttext{#1}% have only one text + \def\righttext{#1}% + \fi + % + \ifodd\pageno + \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin + \else + \def\temp{\inleftmargin\lefttext}% + \fi + \temp +} + +% @include file insert text of that file as input. +% +\def\include{\parseargusing\filenamecatcodes\includezzz} +\def\includezzz#1{% + \pushthisfilestack + \def\thisfile{#1}% + {% + \makevalueexpandable + \def\temp{\input #1 }% + \expandafter + }\temp + \popthisfilestack +} +\def\filenamecatcodes{% + \catcode`\\=\other + \catcode`~=\other + \catcode`^=\other + \catcode`_=\other + \catcode`|=\other + \catcode`<=\other + \catcode`>=\other + \catcode`+=\other + \catcode`-=\other +} + +\def\pushthisfilestack{% + \expandafter\pushthisfilestackX\popthisfilestack\StackTerm +} +\def\pushthisfilestackX{% + \expandafter\pushthisfilestackY\thisfile\StackTerm +} +\def\pushthisfilestackY #1\StackTerm #2\StackTerm {% + \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}% +} + +\def\popthisfilestack{\errthisfilestackempty} +\def\errthisfilestackempty{\errmessage{Internal error: + the stack of filenames is empty.}} + +\def\thisfile{} + +% @center line +% outputs that line, centered. +% +\parseargdef\center{% + \ifhmode + \let\next\centerH + \else + \let\next\centerV + \fi + \next{\hfil \ignorespaces#1\unskip \hfil}% +} +\def\centerH#1{% + {% + \hfil\break + \advance\hsize by -\leftskip + \advance\hsize by -\rightskip + \line{#1}% + \break + }% +} +\def\centerV#1{\line{\kern\leftskip #1\kern\rightskip}} + +% @sp n outputs n lines of vertical space + +\parseargdef\sp{\vskip #1\baselineskip} + +% @comment ...line which is ignored... +% @c is the same as @comment +% @ignore ... @end ignore is another way to write a comment + +\def\comment{\begingroup \catcode`\^^M=\other% +\catcode`\@=\other \catcode`\{=\other \catcode`\}=\other% +\commentxxx} +{\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}} + +\let\c=\comment + +% @paragraphindent NCHARS +% We'll use ems for NCHARS, close enough. +% NCHARS can also be the word `asis' or `none'. +% We cannot feasibly implement @paragraphindent asis, though. +% +\def\asisword{asis} % no translation, these are keywords +\def\noneword{none} +% +\parseargdef\paragraphindent{% + \def\temp{#1}% + \ifx\temp\asisword + \else + \ifx\temp\noneword + \defaultparindent = 0pt + \else + \defaultparindent = #1em + \fi + \fi + \parindent = \defaultparindent +} + +% @exampleindent NCHARS +% We'll use ems for NCHARS like @paragraphindent. +% It seems @exampleindent asis isn't necessary, but +% I preserve it to make it similar to @paragraphindent. +\parseargdef\exampleindent{% + \def\temp{#1}% + \ifx\temp\asisword + \else + \ifx\temp\noneword + \lispnarrowing = 0pt + \else + \lispnarrowing = #1em + \fi + \fi +} + +% @firstparagraphindent WORD +% If WORD is `none', then suppress indentation of the first paragraph +% after a section heading. If WORD is `insert', then do indent at such +% paragraphs. +% +% The paragraph indentation is suppressed or not by calling +% \suppressfirstparagraphindent, which the sectioning commands do. +% We switch the definition of this back and forth according to WORD. +% By default, we suppress indentation. +% +\def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent} +\def\insertword{insert} +% +\parseargdef\firstparagraphindent{% + \def\temp{#1}% + \ifx\temp\noneword + \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent + \else\ifx\temp\insertword + \let\suppressfirstparagraphindent = \relax + \else + \errhelp = \EMsimple + \errmessage{Unknown @firstparagraphindent option `\temp'}% + \fi\fi +} + +% Here is how we actually suppress indentation. Redefine \everypar to +% \kern backwards by \parindent, and then reset itself to empty. +% +% We also make \indent itself not actually do anything until the next +% paragraph. +% +\gdef\dosuppressfirstparagraphindent{% + \gdef\indent{% + \restorefirstparagraphindent + \indent + }% + \gdef\noindent{% + \restorefirstparagraphindent + \noindent + }% + \global\everypar = {% + \kern -\parindent + \restorefirstparagraphindent + }% +} + +\gdef\restorefirstparagraphindent{% + \global \let \indent = \ptexindent + \global \let \noindent = \ptexnoindent + \global \everypar = {}% +} + + +% @asis just yields its argument. Used with @table, for example. +% +\def\asis#1{#1} + +% @math outputs its argument in math mode. +% +% One complication: _ usually means subscripts, but it could also mean +% an actual _ character, as in @math{@var{some_variable} + 1}. So make +% _ active, and distinguish by seeing if the current family is \slfam, +% which is what @var uses. +{ + \catcode`\_ = \active + \gdef\mathunderscore{% + \catcode`\_=\active + \def_{\ifnum\fam=\slfam \_\else\sb\fi}% + } +} +% Another complication: we want \\ (and @\) to output a \ character. +% FYI, plain.tex uses \\ as a temporary control sequence (why?), but +% this is not advertised and we don't care. Texinfo does not +% otherwise define @\. +% +% The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\. +\def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi} +% +\def\math{% + \tex + \mathunderscore + \let\\ = \mathbackslash + \mathactive + $\finishmath +} +\def\finishmath#1{#1$\endgroup} % Close the group opened by \tex. + +% Some active characters (such as <) are spaced differently in math. +% We have to reset their definitions in case the @math was an argument +% to a command which sets the catcodes (such as @item or @section). +% +{ + \catcode`^ = \active + \catcode`< = \active + \catcode`> = \active + \catcode`+ = \active + \gdef\mathactive{% + \let^ = \ptexhat + \let< = \ptexless + \let> = \ptexgtr + \let+ = \ptexplus + } +} + +% @bullet and @minus need the same treatment as @math, just above. +\def\bullet{$\ptexbullet$} +\def\minus{$-$} + +% @dots{} outputs an ellipsis using the current font. +% We do .5em per period so that it has the same spacing in the cm +% typewriter fonts as three actual period characters; on the other hand, +% in other typewriter fonts three periods are wider than 1.5em. So do +% whichever is larger. +% +\def\dots{% + \leavevmode + \setbox0=\hbox{...}% get width of three periods + \ifdim\wd0 > 1.5em + \dimen0 = \wd0 + \else + \dimen0 = 1.5em + \fi + \hbox to \dimen0{% + \hskip 0pt plus.25fil + .\hskip 0pt plus1fil + .\hskip 0pt plus1fil + .\hskip 0pt plus.5fil + }% +} + +% @enddots{} is an end-of-sentence ellipsis. +% +\def\enddots{% + \dots + \spacefactor=\endofsentencespacefactor +} + +% @comma{} is so commas can be inserted into text without messing up +% Texinfo's parsing. +% +\let\comma = , + +% @refill is a no-op. +\let\refill=\relax + +% If working on a large document in chapters, it is convenient to +% be able to disable indexing, cross-referencing, and contents, for test runs. +% This is done with @novalidate (before @setfilename). +% +\newif\iflinks \linkstrue % by default we want the aux files. +\let\novalidate = \linksfalse + +% @setfilename is done at the beginning of every texinfo file. +% So open here the files we need to have open while reading the input. +% This makes it possible to make a .fmt file for texinfo. +\def\setfilename{% + \fixbackslash % Turn off hack to swallow `\input texinfo'. + \iflinks + \tryauxfile + % Open the new aux file. TeX will close it automatically at exit. + \immediate\openout\auxfile=\jobname.aux + \fi % \openindices needs to do some work in any case. + \openindices + \let\setfilename=\comment % Ignore extra @setfilename cmds. + % + % If texinfo.cnf is present on the system, read it. + % Useful for site-wide @afourpaper, etc. + \openin 1 texinfo.cnf + \ifeof 1 \else \input texinfo.cnf \fi + \closein 1 + % + \comment % Ignore the actual filename. +} + +% Called from \setfilename. +% +\def\openindices{% + \newindex{cp}% + \newcodeindex{fn}% + \newcodeindex{vr}% + \newcodeindex{tp}% + \newcodeindex{ky}% + \newcodeindex{pg}% +} + +% @bye. +\outer\def\bye{\pagealignmacro\tracingstats=1\ptexend} + + +\message{pdf,} +% adobe `portable' document format +\newcount\tempnum +\newcount\lnkcount +\newtoks\filename +\newcount\filenamelength +\newcount\pgn +\newtoks\toksA +\newtoks\toksB +\newtoks\toksC +\newtoks\toksD +\newbox\boxA +\newcount\countA +\newif\ifpdf +\newif\ifpdfmakepagedest + +% when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1 +% can be set). So we test for \relax and 0 as well as \undefined, +% borrowed from ifpdf.sty. +\ifx\pdfoutput\undefined +\else + \ifx\pdfoutput\relax + \else + \ifcase\pdfoutput + \else + \pdftrue + \fi + \fi +\fi + +% PDF uses PostScript string constants for the names of xref targets, +% for display in the outlines, and in other places. Thus, we have to +% double any backslashes. Otherwise, a name like "\node" will be +% interpreted as a newline (\n), followed by o, d, e. Not good. +% http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html +% (and related messages, the final outcome is that it is up to the TeX +% user to double the backslashes and otherwise make the string valid, so +% that's what we do). + +% double active backslashes. +% +{\catcode`\@=0 \catcode`\\=\active + @gdef@activebackslashdouble{% + @catcode`@\=@active + @let\=@doublebackslash} +} + +% To handle parens, we must adopt a different approach, since parens are +% not active characters. hyperref.dtx (which has the same problem as +% us) handles it with this amazing macro to replace tokens. I've +% tinkered with it a little for texinfo, but it's definitely from there. +% +% #1 is the tokens to replace. +% #2 is the replacement. +% #3 is the control sequence with the string. +% +\def\HyPsdSubst#1#2#3{% + \def\HyPsdReplace##1#1##2\END{% + ##1% + \ifx\\##2\\% + \else + #2% + \HyReturnAfterFi{% + \HyPsdReplace##2\END + }% + \fi + }% + \xdef#3{\expandafter\HyPsdReplace#3#1\END}% +} +\long\def\HyReturnAfterFi#1\fi{\fi#1} + +% #1 is a control sequence in which to do the replacements. +\def\backslashparens#1{% + \xdef#1{#1}% redefine it as its expansion; the definition is simply + % \lastnode when called from \setref -> \pdfmkdest. + \HyPsdSubst{(}{\realbackslash(}{#1}% + \HyPsdSubst{)}{\realbackslash)}{#1}% +} + +\ifpdf + \input pdfcolor + \pdfcatalog{/PageMode /UseOutlines}% + % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto). + \def\dopdfimage#1#2#3{% + \def\imagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}% + \def\imageheight{#3}\setbox2 = \hbox{\ignorespaces #3}% + % without \immediate, pdftex seg faults when the same image is + % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.) + \ifnum\pdftexversion < 14 + \immediate\pdfimage + \else + \immediate\pdfximage + \fi + \ifdim \wd0 >0pt width \imagewidth \fi + \ifdim \wd2 >0pt height \imageheight \fi + \ifnum\pdftexversion<13 + #1.pdf% + \else + {#1.pdf}% + \fi + \ifnum\pdftexversion < 14 \else + \pdfrefximage \pdflastximage + \fi} + \def\pdfmkdest#1{{% + % We have to set dummies so commands such as @code, and characters + % such as \, aren't expanded when present in a section title. + \atdummies + \activebackslashdouble + \def\pdfdestname{#1}% + \backslashparens\pdfdestname + \pdfdest name{\pdfdestname} xyz% + }}% + % + % used to mark target names; must be expandable. + \def\pdfmkpgn#1{#1}% + % + \let\linkcolor = \Blue % was Cyan, but that seems light? + \def\endlink{\Black\pdfendlink} + % Adding outlines to PDF; macros for calculating structure of outlines + % come from Petr Olsak + \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0% + \else \csname#1\endcsname \fi} + \def\advancenumber#1{\tempnum=\expnumber{#1}\relax + \advance\tempnum by 1 + \expandafter\xdef\csname#1\endcsname{\the\tempnum}} + % + % #1 is the section text, which is what will be displayed in the + % outline by the pdf viewer. #2 is the pdf expression for the number + % of subentries (or empty, for subsubsections). #3 is the node text, + % which might be empty if this toc entry had no corresponding node. + % #4 is the page number + % + \def\dopdfoutline#1#2#3#4{% + % Generate a link to the node text if that exists; else, use the + % page number. We could generate a destination for the section + % text in the case where a section has no node, but it doesn't + % seem worth the trouble, since most documents are normally structured. + \def\pdfoutlinedest{#3}% + \ifx\pdfoutlinedest\empty + \def\pdfoutlinedest{#4}% + \else + % Doubled backslashes in the name. + {\activebackslashdouble \xdef\pdfoutlinedest{#3}% + \backslashparens\pdfoutlinedest}% + \fi + % + % Also double the backslashes in the display string. + {\activebackslashdouble \xdef\pdfoutlinetext{#1}% + \backslashparens\pdfoutlinetext}% + % + \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{\pdfoutlinetext}% + } + % + \def\pdfmakeoutlines{% + \begingroup + % Thanh's hack / proper braces in bookmarks + \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace + \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace + % + % Read toc silently, to get counts of subentries for \pdfoutline. + \def\numchapentry##1##2##3##4{% + \def\thischapnum{##2}% + \def\thissecnum{0}% + \def\thissubsecnum{0}% + }% + \def\numsecentry##1##2##3##4{% + \advancenumber{chap\thischapnum}% + \def\thissecnum{##2}% + \def\thissubsecnum{0}% + }% + \def\numsubsecentry##1##2##3##4{% + \advancenumber{sec\thissecnum}% + \def\thissubsecnum{##2}% + }% + \def\numsubsubsecentry##1##2##3##4{% + \advancenumber{subsec\thissubsecnum}% + }% + \def\thischapnum{0}% + \def\thissecnum{0}% + \def\thissubsecnum{0}% + % + % use \def rather than \let here because we redefine \chapentry et + % al. a second time, below. + \def\appentry{\numchapentry}% + \def\appsecentry{\numsecentry}% + \def\appsubsecentry{\numsubsecentry}% + \def\appsubsubsecentry{\numsubsubsecentry}% + \def\unnchapentry{\numchapentry}% + \def\unnsecentry{\numsecentry}% + \def\unnsubsecentry{\numsubsecentry}% + \def\unnsubsubsecentry{\numsubsubsecentry}% + \readdatafile{toc}% + % + % Read toc second time, this time actually producing the outlines. + % The `-' means take the \expnumber as the absolute number of + % subentries, which we calculated on our first read of the .toc above. + % + % We use the node names as the destinations. + \def\numchapentry##1##2##3##4{% + \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}% + \def\numsecentry##1##2##3##4{% + \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}% + \def\numsubsecentry##1##2##3##4{% + \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}% + \def\numsubsubsecentry##1##2##3##4{% count is always zero + \dopdfoutline{##1}{}{##3}{##4}}% + % + % PDF outlines are displayed using system fonts, instead of + % document fonts. Therefore we cannot use special characters, + % since the encoding is unknown. For example, the eogonek from + % Latin 2 (0xea) gets translated to a | character. Info from + % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100. + % + % xx to do this right, we have to translate 8-bit characters to + % their "best" equivalent, based on the @documentencoding. Right + % now, I guess we'll just let the pdf reader have its way. + \indexnofonts + \setupdatafile + \catcode`\\=\active \otherbackslash + \input \jobname.toc + \endgroup + } + % + \def\skipspaces#1{\def\PP{#1}\def\D{|}% + \ifx\PP\D\let\nextsp\relax + \else\let\nextsp\skipspaces + \ifx\p\space\else\addtokens{\filename}{\PP}% + \advance\filenamelength by 1 + \fi + \fi + \nextsp} + \def\getfilename#1{\filenamelength=0\expandafter\skipspaces#1|\relax} + \ifnum\pdftexversion < 14 + \let \startlink \pdfannotlink + \else + \let \startlink \pdfstartlink + \fi + % make a live url in pdf output. + \def\pdfurl#1{% + \begingroup + % it seems we really need yet another set of dummies; have not + % tried to figure out what each command should do in the context + % of @url. for now, just make @/ a no-op, that's the only one + % people have actually reported a problem with. + % + \normalturnoffactive + \def\@{@}% + \let\/=\empty + \makevalueexpandable + \leavevmode\Red + \startlink attr{/Border [0 0 0]}% + user{/Subtype /Link /A << /S /URI /URI (#1) >>}% + \endgroup} + \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}} + \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} + \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks} + \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}} + \def\maketoks{% + \expandafter\poptoks\the\toksA|ENDTOKS|\relax + \ifx\first0\adn0 + \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3 + \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6 + \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9 + \else + \ifnum0=\countA\else\makelink\fi + \ifx\first.\let\next=\done\else + \let\next=\maketoks + \addtokens{\toksB}{\the\toksD} + \ifx\first,\addtokens{\toksB}{\space}\fi + \fi + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi + \next} + \def\makelink{\addtokens{\toksB}% + {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0} + \def\pdflink#1{% + \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}} + \linkcolor #1\endlink} + \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} +\else + \let\pdfmkdest = \gobble + \let\pdfurl = \gobble + \let\endlink = \relax + \let\linkcolor = \relax + \let\pdfmakeoutlines = \relax +\fi % \ifx\pdfoutput + + +\message{fonts,} + +% Change the current font style to #1, remembering it in \curfontstyle. +% For now, we do not accumulate font styles: @b{@i{foo}} prints foo in +% italics, not bold italics. +% +\def\setfontstyle#1{% + \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd. + \csname ten#1\endcsname % change the current font +} + +% Select #1 fonts with the current style. +% +\def\selectfonts#1{\csname #1fonts\endcsname \csname\curfontstyle\endcsname} + +\def\rm{\fam=0 \setfontstyle{rm}} +\def\it{\fam=\itfam \setfontstyle{it}} +\def\sl{\fam=\slfam \setfontstyle{sl}} +\def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf} +\def\tt{\fam=\ttfam \setfontstyle{tt}} + +% Texinfo sort of supports the sans serif font style, which plain TeX does not. +% So we set up a \sf. +\newfam\sffam +\def\sf{\fam=\sffam \setfontstyle{sf}} +\let\li = \sf % Sometimes we call it \li, not \sf. + +% We don't need math for this font style. +\def\ttsl{\setfontstyle{ttsl}} + + +% Default leading. +\newdimen\textleading \textleading = 13.2pt + +% Set the baselineskip to #1, and the lineskip and strut size +% correspondingly. There is no deep meaning behind these magic numbers +% used as factors; they just match (closely enough) what Knuth defined. +% +\def\lineskipfactor{.08333} +\def\strutheightpercent{.70833} +\def\strutdepthpercent {.29167} +% +\def\setleading#1{% + \normalbaselineskip = #1\relax + \normallineskip = \lineskipfactor\normalbaselineskip + \normalbaselines + \setbox\strutbox =\hbox{% + \vrule width0pt height\strutheightpercent\baselineskip + depth \strutdepthpercent \baselineskip + }% +} + + +% Set the font macro #1 to the font named #2, adding on the +% specified font prefix (normally `cm'). +% #3 is the font's design size, #4 is a scale factor +\def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4} + + +% Use cm as the default font prefix. +% To specify the font prefix, you must define \fontprefix +% before you read in texinfo.tex. +\ifx\fontprefix\undefined +\def\fontprefix{cm} +\fi +% Support font families that don't use the same naming scheme as CM. +\def\rmshape{r} +\def\rmbshape{bx} %where the normal face is bold +\def\bfshape{b} +\def\bxshape{bx} +\def\ttshape{tt} +\def\ttbshape{tt} +\def\ttslshape{sltt} +\def\itshape{ti} +\def\itbshape{bxti} +\def\slshape{sl} +\def\slbshape{bxsl} +\def\sfshape{ss} +\def\sfbshape{ss} +\def\scshape{csc} +\def\scbshape{csc} + +% Definitions for a main text size of 11pt. This is the default in +% Texinfo. +% +\def\definetextfontsizexi{ +% Text fonts (11.2pt, magstep1). +\def\textnominalsize{11pt} +\edef\mainmagstep{\magstephalf} +\setfont\textrm\rmshape{10}{\mainmagstep} +\setfont\texttt\ttshape{10}{\mainmagstep} +\setfont\textbf\bfshape{10}{\mainmagstep} +\setfont\textit\itshape{10}{\mainmagstep} +\setfont\textsl\slshape{10}{\mainmagstep} +\setfont\textsf\sfshape{10}{\mainmagstep} +\setfont\textsc\scshape{10}{\mainmagstep} +\setfont\textttsl\ttslshape{10}{\mainmagstep} +\font\texti=cmmi10 scaled \mainmagstep +\font\textsy=cmsy10 scaled \mainmagstep + +% A few fonts for @defun names and args. +\setfont\defbf\bfshape{10}{\magstep1} +\setfont\deftt\ttshape{10}{\magstep1} +\setfont\defttsl\ttslshape{10}{\magstep1} +\def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf} + +% Fonts for indices, footnotes, small examples (9pt). +\def\smallnominalsize{9pt} +\setfont\smallrm\rmshape{9}{1000} +\setfont\smalltt\ttshape{9}{1000} +\setfont\smallbf\bfshape{10}{900} +\setfont\smallit\itshape{9}{1000} +\setfont\smallsl\slshape{9}{1000} +\setfont\smallsf\sfshape{9}{1000} +\setfont\smallsc\scshape{10}{900} +\setfont\smallttsl\ttslshape{10}{900} +\font\smalli=cmmi9 +\font\smallsy=cmsy9 + +% Fonts for small examples (8pt). +\def\smallernominalsize{8pt} +\setfont\smallerrm\rmshape{8}{1000} +\setfont\smallertt\ttshape{8}{1000} +\setfont\smallerbf\bfshape{10}{800} +\setfont\smallerit\itshape{8}{1000} +\setfont\smallersl\slshape{8}{1000} +\setfont\smallersf\sfshape{8}{1000} +\setfont\smallersc\scshape{10}{800} +\setfont\smallerttsl\ttslshape{10}{800} +\font\smalleri=cmmi8 +\font\smallersy=cmsy8 + +% Fonts for title page (20.4pt): +\def\titlenominalsize{20pt} +\setfont\titlerm\rmbshape{12}{\magstep3} +\setfont\titleit\itbshape{10}{\magstep4} +\setfont\titlesl\slbshape{10}{\magstep4} +\setfont\titlett\ttbshape{12}{\magstep3} +\setfont\titlettsl\ttslshape{10}{\magstep4} +\setfont\titlesf\sfbshape{17}{\magstep1} +\let\titlebf=\titlerm +\setfont\titlesc\scbshape{10}{\magstep4} +\font\titlei=cmmi12 scaled \magstep3 +\font\titlesy=cmsy10 scaled \magstep4 +\def\authorrm{\secrm} +\def\authortt{\sectt} + +% Chapter (and unnumbered) fonts (17.28pt). +\def\chapnominalsize{17pt} +\setfont\chaprm\rmbshape{12}{\magstep2} +\setfont\chapit\itbshape{10}{\magstep3} +\setfont\chapsl\slbshape{10}{\magstep3} +\setfont\chaptt\ttbshape{12}{\magstep2} +\setfont\chapttsl\ttslshape{10}{\magstep3} +\setfont\chapsf\sfbshape{17}{1000} +\let\chapbf=\chaprm +\setfont\chapsc\scbshape{10}{\magstep3} +\font\chapi=cmmi12 scaled \magstep2 +\font\chapsy=cmsy10 scaled \magstep3 + +% Section fonts (14.4pt). +\def\secnominalsize{14pt} +\setfont\secrm\rmbshape{12}{\magstep1} +\setfont\secit\itbshape{10}{\magstep2} +\setfont\secsl\slbshape{10}{\magstep2} +\setfont\sectt\ttbshape{12}{\magstep1} +\setfont\secttsl\ttslshape{10}{\magstep2} +\setfont\secsf\sfbshape{12}{\magstep1} +\let\secbf\secrm +\setfont\secsc\scbshape{10}{\magstep2} +\font\seci=cmmi12 scaled \magstep1 +\font\secsy=cmsy10 scaled \magstep2 + +% Subsection fonts (13.15pt). +\def\ssecnominalsize{13pt} +\setfont\ssecrm\rmbshape{12}{\magstephalf} +\setfont\ssecit\itbshape{10}{1315} +\setfont\ssecsl\slbshape{10}{1315} +\setfont\ssectt\ttbshape{12}{\magstephalf} +\setfont\ssecttsl\ttslshape{10}{1315} +\setfont\ssecsf\sfbshape{12}{\magstephalf} +\let\ssecbf\ssecrm +\setfont\ssecsc\scbshape{10}{1315} +\font\sseci=cmmi12 scaled \magstephalf +\font\ssecsy=cmsy10 scaled 1315 + +% Reduced fonts for @acro in text (10pt). +\def\reducednominalsize{10pt} +\setfont\reducedrm\rmshape{10}{1000} +\setfont\reducedtt\ttshape{10}{1000} +\setfont\reducedbf\bfshape{10}{1000} +\setfont\reducedit\itshape{10}{1000} +\setfont\reducedsl\slshape{10}{1000} +\setfont\reducedsf\sfshape{10}{1000} +\setfont\reducedsc\scshape{10}{1000} +\setfont\reducedttsl\ttslshape{10}{1000} +\font\reducedi=cmmi10 +\font\reducedsy=cmsy10 + +% reset the current fonts +\textfonts +\rm +} % end of 11pt text font size definitions + + +% Definitions to make the main text be 10pt Computer Modern, with +% section, chapter, etc., sizes following suit. This is for the GNU +% Press printing of the Emacs 22 manual. Maybe other manuals in the +% future. Used with @smallbook, which sets the leading to 12pt. +% +\def\definetextfontsizex{% +% Text fonts (10pt). +\def\textnominalsize{10pt} +\edef\mainmagstep{1000} +\setfont\textrm\rmshape{10}{\mainmagstep} +\setfont\texttt\ttshape{10}{\mainmagstep} +\setfont\textbf\bfshape{10}{\mainmagstep} +\setfont\textit\itshape{10}{\mainmagstep} +\setfont\textsl\slshape{10}{\mainmagstep} +\setfont\textsf\sfshape{10}{\mainmagstep} +\setfont\textsc\scshape{10}{\mainmagstep} +\setfont\textttsl\ttslshape{10}{\mainmagstep} +\font\texti=cmmi10 scaled \mainmagstep +\font\textsy=cmsy10 scaled \mainmagstep + +% A few fonts for @defun names and args. +\setfont\defbf\bfshape{10}{\magstephalf} +\setfont\deftt\ttshape{10}{\magstephalf} +\setfont\defttsl\ttslshape{10}{\magstephalf} +\def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf} + +% Fonts for indices, footnotes, small examples (9pt). +\def\smallnominalsize{9pt} +\setfont\smallrm\rmshape{9}{1000} +\setfont\smalltt\ttshape{9}{1000} +\setfont\smallbf\bfshape{10}{900} +\setfont\smallit\itshape{9}{1000} +\setfont\smallsl\slshape{9}{1000} +\setfont\smallsf\sfshape{9}{1000} +\setfont\smallsc\scshape{10}{900} +\setfont\smallttsl\ttslshape{10}{900} +\font\smalli=cmmi9 +\font\smallsy=cmsy9 + +% Fonts for small examples (8pt). +\def\smallernominalsize{8pt} +\setfont\smallerrm\rmshape{8}{1000} +\setfont\smallertt\ttshape{8}{1000} +\setfont\smallerbf\bfshape{10}{800} +\setfont\smallerit\itshape{8}{1000} +\setfont\smallersl\slshape{8}{1000} +\setfont\smallersf\sfshape{8}{1000} +\setfont\smallersc\scshape{10}{800} +\setfont\smallerttsl\ttslshape{10}{800} +\font\smalleri=cmmi8 +\font\smallersy=cmsy8 + +% Fonts for title page (20.4pt): +\def\titlenominalsize{20pt} +\setfont\titlerm\rmbshape{12}{\magstep3} +\setfont\titleit\itbshape{10}{\magstep4} +\setfont\titlesl\slbshape{10}{\magstep4} +\setfont\titlett\ttbshape{12}{\magstep3} +\setfont\titlettsl\ttslshape{10}{\magstep4} +\setfont\titlesf\sfbshape{17}{\magstep1} +\let\titlebf=\titlerm +\setfont\titlesc\scbshape{10}{\magstep4} +\font\titlei=cmmi12 scaled \magstep3 +\font\titlesy=cmsy10 scaled \magstep4 +\def\authorrm{\secrm} +\def\authortt{\sectt} + +% Chapter fonts (14.4pt). +\def\chapnominalsize{14pt} +\setfont\chaprm\rmbshape{12}{\magstep1} +\setfont\chapit\itbshape{10}{\magstep2} +\setfont\chapsl\slbshape{10}{\magstep2} +\setfont\chaptt\ttbshape{12}{\magstep1} +\setfont\chapttsl\ttslshape{10}{\magstep2} +\setfont\chapsf\sfbshape{12}{\magstep1} +\let\chapbf\chaprm +\setfont\chapsc\scbshape{10}{\magstep2} +\font\chapi=cmmi12 scaled \magstep1 +\font\chapsy=cmsy10 scaled \magstep2 + +% Section fonts (12pt). +\def\secnominalsize{12pt} +\setfont\secrm\rmbshape{12}{1000} +\setfont\secit\itbshape{10}{\magstep1} +\setfont\secsl\slbshape{10}{\magstep1} +\setfont\sectt\ttbshape{12}{1000} +\setfont\secttsl\ttslshape{10}{\magstep1} +\setfont\secsf\sfbshape{12}{1000} +\let\secbf\secrm +\setfont\secsc\scbshape{10}{\magstep1} +\font\seci=cmmi12 +\font\secsy=cmsy10 scaled \magstep1 + +% Subsection fonts (10pt). +\def\ssecnominalsize{10pt} +\setfont\ssecrm\rmbshape{10}{1000} +\setfont\ssecit\itbshape{10}{1000} +\setfont\ssecsl\slbshape{10}{1000} +\setfont\ssectt\ttbshape{10}{1000} +\setfont\ssecttsl\ttslshape{10}{1000} +\setfont\ssecsf\sfbshape{10}{1000} +\let\ssecbf\ssecrm +\setfont\ssecsc\scbshape{10}{1000} +\font\sseci=cmmi10 +\font\ssecsy=cmsy10 + +% Reduced fonts for @acro in text (9pt). +\def\reducednominalsize{9pt} +\setfont\reducedrm\rmshape{9}{1000} +\setfont\reducedtt\ttshape{9}{1000} +\setfont\reducedbf\bfshape{10}{900} +\setfont\reducedit\itshape{9}{1000} +\setfont\reducedsl\slshape{9}{1000} +\setfont\reducedsf\sfshape{9}{1000} +\setfont\reducedsc\scshape{10}{900} +\setfont\reducedttsl\ttslshape{10}{900} +\font\reducedi=cmmi9 +\font\reducedsy=cmsy9 + +% reduce space between paragraphs +\divide\parskip by 2 + +% reset the current fonts +\textfonts +\rm +} % end of 10pt text font size definitions + + +% We provide the user-level command +% @fonttextsize 10 +% (or 11) to redefine the text font size. pt is assumed. +% +\def\xword{10} +\def\xiword{11} +% +\parseargdef\fonttextsize{% + \def\textsizearg{#1}% + \wlog{doing @fonttextsize \textsizearg}% + % + % Set \globaldefs so that documents can use this inside @tex, since + % makeinfo 4.8 does not support it, but we need it nonetheless. + % + \begingroup \globaldefs=1 + \ifx\textsizearg\xword \definetextfontsizex + \else \ifx\textsizearg\xiword \definetextfontsizexi + \else + \errhelp=\EMsimple + \errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'} + \fi\fi + \endgroup +} + + +% In order for the font changes to affect most math symbols and letters, +% we have to define the \textfont of the standard families. Since +% texinfo doesn't allow for producing subscripts and superscripts except +% in the main text, we don't bother to reset \scriptfont and +% \scriptscriptfont (which would also require loading a lot more fonts). +% +\def\resetmathfonts{% + \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy + \textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf + \textfont\ttfam=\tentt \textfont\sffam=\tensf +} + +% The font-changing commands redefine the meanings of \tenSTYLE, instead +% of just \STYLE. We do this because \STYLE needs to also set the +% current \fam for math mode. Our \STYLE (e.g., \rm) commands hardwire +% \tenSTYLE to set the current font. +% +% Each font-changing command also sets the names \lsize (one size lower) +% and \lllsize (three sizes lower). These relative commands are used in +% the LaTeX logo and acronyms. +% +% This all needs generalizing, badly. +% +\def\textfonts{% + \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl + \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc + \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy + \let\tenttsl=\textttsl + \def\curfontsize{text}% + \def\lsize{reduced}\def\lllsize{smaller}% + \resetmathfonts \setleading{\textleading}} +\def\titlefonts{% + \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl + \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc + \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy + \let\tenttsl=\titlettsl + \def\curfontsize{title}% + \def\lsize{chap}\def\lllsize{subsec}% + \resetmathfonts \setleading{25pt}} +\def\titlefont#1{{\titlefonts\rm #1}} +\def\chapfonts{% + \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl + \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc + \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy + \let\tenttsl=\chapttsl + \def\curfontsize{chap}% + \def\lsize{sec}\def\lllsize{text}% + \resetmathfonts \setleading{19pt}} +\def\secfonts{% + \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl + \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc + \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy + \let\tenttsl=\secttsl + \def\curfontsize{sec}% + \def\lsize{subsec}\def\lllsize{reduced}% + \resetmathfonts \setleading{16pt}} +\def\subsecfonts{% + \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl + \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc + \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy + \let\tenttsl=\ssecttsl + \def\curfontsize{ssec}% + \def\lsize{text}\def\lllsize{small}% + \resetmathfonts \setleading{15pt}} +\let\subsubsecfonts = \subsecfonts +\def\reducedfonts{% + \let\tenrm=\reducedrm \let\tenit=\reducedit \let\tensl=\reducedsl + \let\tenbf=\reducedbf \let\tentt=\reducedtt \let\reducedcaps=\reducedsc + \let\tensf=\reducedsf \let\teni=\reducedi \let\tensy=\reducedsy + \let\tenttsl=\reducedttsl + \def\curfontsize{reduced}% + \def\lsize{small}\def\lllsize{smaller}% + \resetmathfonts \setleading{10.5pt}} +\def\smallfonts{% + \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl + \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc + \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy + \let\tenttsl=\smallttsl + \def\curfontsize{small}% + \def\lsize{smaller}\def\lllsize{smaller}% + \resetmathfonts \setleading{10.5pt}} +\def\smallerfonts{% + \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl + \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc + \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy + \let\tenttsl=\smallerttsl + \def\curfontsize{smaller}% + \def\lsize{smaller}\def\lllsize{smaller}% + \resetmathfonts \setleading{9.5pt}} + +% Set the fonts to use with the @small... environments. +\let\smallexamplefonts = \smallfonts + +% About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample +% can fit this many characters: +% 8.5x11=86 smallbook=72 a4=90 a5=69 +% If we use \scriptfonts (8pt), then we can fit this many characters: +% 8.5x11=90+ smallbook=80 a4=90+ a5=77 +% For me, subjectively, the few extra characters that fit aren't worth +% the additional smallness of 8pt. So I'm making the default 9pt. +% +% By the way, for comparison, here's what fits with @example (10pt): +% 8.5x11=71 smallbook=60 a4=75 a5=58 +% +% I wish the USA used A4 paper. +% --karl, 24jan03. + + +% Set up the default fonts, so we can use them for creating boxes. +% +\definetextfontsizexi + +% Define these so they can be easily changed for other fonts. +\def\angleleft{$\langle$} +\def\angleright{$\rangle$} + +% Count depth in font-changes, for error checks +\newcount\fontdepth \fontdepth=0 + +% Fonts for short table of contents. +\setfont\shortcontrm\rmshape{12}{1000} +\setfont\shortcontbf\bfshape{10}{\magstep1} % no cmb12 +\setfont\shortcontsl\slshape{12}{1000} +\setfont\shortconttt\ttshape{12}{1000} + +%% Add scribe-like font environments, plus @l for inline lisp (usually sans +%% serif) and @ii for TeX italic + +% \smartitalic{ARG} outputs arg in italics, followed by an italic correction +% unless the following character is such as not to need one. +\def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else + \ptexslash\fi\fi\fi} +\def\smartslanted#1{{\ifusingtt\ttsl\sl #1}\futurelet\next\smartitalicx} +\def\smartitalic#1{{\ifusingtt\ttsl\it #1}\futurelet\next\smartitalicx} + +% like \smartslanted except unconditionally uses \ttsl. +% @var is set to this for defun arguments. +\def\ttslanted#1{{\ttsl #1}\futurelet\next\smartitalicx} + +% like \smartslanted except unconditionally use \sl. We never want +% ttsl for book titles, do we? +\def\cite#1{{\sl #1}\futurelet\next\smartitalicx} + +\let\i=\smartitalic +\let\slanted=\smartslanted +\let\var=\smartslanted +\let\dfn=\smartslanted +\let\emph=\smartitalic + +% @b, explicit bold. +\def\b#1{{\bf #1}} +\let\strong=\b + +% @sansserif, explicit sans. +\def\sansserif#1{{\sf #1}} + +% We can't just use \exhyphenpenalty, because that only has effect at +% the end of a paragraph. Restore normal hyphenation at the end of the +% group within which \nohyphenation is presumably called. +% +\def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation} +\def\restorehyphenation{\hyphenchar\font = `- } + +% Set sfcode to normal for the chars that usually have another value. +% Can't use plain's \frenchspacing because it uses the `\x notation, and +% sometimes \x has an active definition that messes things up. +% +\catcode`@=11 + \def\plainfrenchspacing{% + \sfcode\dotChar =\@m \sfcode\questChar=\@m \sfcode\exclamChar=\@m + \sfcode\colonChar=\@m \sfcode\semiChar =\@m \sfcode\commaChar =\@m + \def\endofsentencespacefactor{1000}% for @. and friends + } + \def\plainnonfrenchspacing{% + \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000 + \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250 + \def\endofsentencespacefactor{3000}% for @. and friends + } +\catcode`@=\other +\def\endofsentencespacefactor{3000}% default + +\def\t#1{% + {\tt \rawbackslash \plainfrenchspacing #1}% + \null +} +\def\samp#1{`\tclose{#1}'\null} +\setfont\keyrm\rmshape{8}{1000} +\font\keysy=cmsy9 +\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{% + \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{% + \vbox{\hrule\kern-0.4pt + \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}% + \kern-0.4pt\hrule}% + \kern-.06em\raise0.4pt\hbox{\angleright}}}} +% The old definition, with no lozenge: +%\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null} +\def\ctrl #1{{\tt \rawbackslash \hat}#1} + +% @file, @option are the same as @samp. +\let\file=\samp +\let\option=\samp + +% @code is a modification of @t, +% which makes spaces the same size as normal in the surrounding text. +\def\tclose#1{% + {% + % Change normal interword space to be same as for the current font. + \spaceskip = \fontdimen2\font + % + % Switch to typewriter. + \tt + % + % But `\ ' produces the large typewriter interword space. + \def\ {{\spaceskip = 0pt{} }}% + % + % Turn off hyphenation. + \nohyphenation + % + \rawbackslash + \plainfrenchspacing + #1% + }% + \null +} + +% We *must* turn on hyphenation at `-' and `_' in @code. +% Otherwise, it is too hard to avoid overfull hboxes +% in the Emacs manual, the Library manual, etc. + +% Unfortunately, TeX uses one parameter (\hyphenchar) to control +% both hyphenation at - and hyphenation within words. +% We must therefore turn them both off (\tclose does that) +% and arrange explicitly to hyphenate at a dash. +% -- rms. +{ + \catcode`\-=\active \catcode`\_=\active + \catcode`\'=\active \catcode`\`=\active + % + \global\def\code{\begingroup + \catcode\rquoteChar=\active \catcode\lquoteChar=\active + \let'\codequoteright \let`\codequoteleft + % + \catcode\dashChar=\active \catcode\underChar=\active + \ifallowcodebreaks + \let-\codedash + \let_\codeunder + \else + \let-\realdash + \let_\realunder + \fi + \codex + } +} + +\def\realdash{-} +\def\codedash{-\discretionary{}{}{}} +\def\codeunder{% + % this is all so @math{@code{var_name}+1} can work. In math mode, _ + % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.) + % will therefore expand the active definition of _, which is us + % (inside @code that is), therefore an endless loop. + \ifusingtt{\ifmmode + \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_. + \else\normalunderscore \fi + \discretionary{}{}{}}% + {\_}% +} +\def\codex #1{\tclose{#1}\endgroup} + +% An additional complication: the above will allow breaks after, e.g., +% each of the four underscores in __typeof__. This is undesirable in +% some manuals, especially if they don't have long identifiers in +% general. @allowcodebreaks provides a way to control this. +% +\newif\ifallowcodebreaks \allowcodebreakstrue + +\def\keywordtrue{true} +\def\keywordfalse{false} + +\parseargdef\allowcodebreaks{% + \def\txiarg{#1}% + \ifx\txiarg\keywordtrue + \allowcodebreakstrue + \else\ifx\txiarg\keywordfalse + \allowcodebreaksfalse + \else + \errhelp = \EMsimple + \errmessage{Unknown @allowcodebreaks option `\txiarg'}% + \fi\fi +} + +% @kbd is like @code, except that if the argument is just one @key command, +% then @kbd has no effect. + +% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always), +% `example' (@kbd uses ttsl only inside of @example and friends), +% or `code' (@kbd uses normal tty font always). +\parseargdef\kbdinputstyle{% + \def\txiarg{#1}% + \ifx\txiarg\worddistinct + \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}% + \else\ifx\txiarg\wordexample + \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}% + \else\ifx\txiarg\wordcode + \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}% + \else + \errhelp = \EMsimple + \errmessage{Unknown @kbdinputstyle option `\txiarg'}% + \fi\fi\fi +} +\def\worddistinct{distinct} +\def\wordexample{example} +\def\wordcode{code} + +% Default is `distinct.' +\kbdinputstyle distinct + +\def\xkey{\key} +\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}% +\ifx\one\xkey\ifx\threex\three \key{#2}% +\else{\tclose{\kbdfont\look}}\fi +\else{\tclose{\kbdfont\look}}\fi} + +% For @indicateurl, @env, @command quotes seem unnecessary, so use \code. +\let\indicateurl=\code +\let\env=\code +\let\command=\code + +% @uref (abbreviation for `urlref') takes an optional (comma-separated) +% second argument specifying the text to display and an optional third +% arg as text to display instead of (rather than in addition to) the url +% itself. First (mandatory) arg is the url. Perhaps eventually put in +% a hypertex \special here. +% +\def\uref#1{\douref #1,,,\finish} +\def\douref#1,#2,#3,#4\finish{\begingroup + \unsepspaces + \pdfurl{#1}% + \setbox0 = \hbox{\ignorespaces #3}% + \ifdim\wd0 > 0pt + \unhbox0 % third arg given, show only that + \else + \setbox0 = \hbox{\ignorespaces #2}% + \ifdim\wd0 > 0pt + \ifpdf + \unhbox0 % PDF: 2nd arg given, show only it + \else + \unhbox0\ (\code{#1})% DVI: 2nd arg given, show both it and url + \fi + \else + \code{#1}% only url given, so show it + \fi + \fi + \endlink +\endgroup} + +% @url synonym for @uref, since that's how everyone uses it. +% +\let\url=\uref + +% rms does not like angle brackets --karl, 17may97. +% So now @email is just like @uref, unless we are pdf. +% +%\def\email#1{\angleleft{\tt #1}\angleright} +\ifpdf + \def\email#1{\doemail#1,,\finish} + \def\doemail#1,#2,#3\finish{\begingroup + \unsepspaces + \pdfurl{mailto:#1}% + \setbox0 = \hbox{\ignorespaces #2}% + \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi + \endlink + \endgroup} +\else + \let\email=\uref +\fi + +% Check if we are currently using a typewriter font. Since all the +% Computer Modern typewriter fonts have zero interword stretch (and +% shrink), and it is reasonable to expect all typewriter fonts to have +% this property, we can check that font parameter. +% +\def\ifmonospace{\ifdim\fontdimen3\font=0pt } + +% Typeset a dimension, e.g., `in' or `pt'. The only reason for the +% argument is to make the input look right: @dmn{pt} instead of @dmn{}pt. +% +\def\dmn#1{\thinspace #1} + +\def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par} + +% @l was never documented to mean ``switch to the Lisp font'', +% and it is not used as such in any manual I can find. We need it for +% Polish suppressed-l. --karl, 22sep96. +%\def\l#1{{\li #1}\null} + +% Explicit font changes: @r, @sc, undocumented @ii. +\def\r#1{{\rm #1}} % roman font +\def\sc#1{{\smallcaps#1}} % smallcaps font +\def\ii#1{{\it #1}} % italic font + +% @acronym for "FBI", "NATO", and the like. +% We print this one point size smaller, since it's intended for +% all-uppercase. +% +\def\acronym#1{\doacronym #1,,\finish} +\def\doacronym#1,#2,#3\finish{% + {\selectfonts\lsize #1}% + \def\temp{#2}% + \ifx\temp\empty \else + \space ({\unsepspaces \ignorespaces \temp \unskip})% + \fi +} + +% @abbr for "Comput. J." and the like. +% No font change, but don't do end-of-sentence spacing. +% +\def\abbr#1{\doabbr #1,,\finish} +\def\doabbr#1,#2,#3\finish{% + {\plainfrenchspacing #1}% + \def\temp{#2}% + \ifx\temp\empty \else + \space ({\unsepspaces \ignorespaces \temp \unskip})% + \fi +} + +% @pounds{} is a sterling sign, which Knuth put in the CM italic font. +% +\def\pounds{{\it\$}} + +% @euro{} comes from a separate font, depending on the current style. +% We use the free feym* fonts from the eurosym package by Henrik +% Theiling, which support regular, slanted, bold and bold slanted (and +% "outlined" (blackboard board, sort of) versions, which we don't need). +% It is available from http://www.ctan.org/tex-archive/fonts/eurosym. +% +% Although only regular is the truly official Euro symbol, we ignore +% that. The Euro is designed to be slightly taller than the regular +% font height. +% +% feymr - regular +% feymo - slanted +% feybr - bold +% feybo - bold slanted +% +% There is no good (free) typewriter version, to my knowledge. +% A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide. +% Hmm. +% +% Also doesn't work in math. Do we need to do math with euro symbols? +% Hope not. +% +% +\def\euro{{\eurofont e}} +\def\eurofont{% + % We set the font at each command, rather than predefining it in + % \textfonts and the other font-switching commands, so that + % installations which never need the symbol don't have to have the + % font installed. + % + % There is only one designed size (nominal 10pt), so we always scale + % that to the current nominal size. + % + % By the way, simply using "at 1em" works for cmr10 and the like, but + % does not work for cmbx10 and other extended/shrunken fonts. + % + \def\eurosize{\csname\curfontsize nominalsize\endcsname}% + % + \ifx\curfontstyle\bfstylename + % bold: + \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize + \else + % regular: + \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize + \fi + \thiseurofont +} + +% @registeredsymbol - R in a circle. The font for the R should really +% be smaller yet, but lllsize is the best we can do for now. +% Adapted from the plain.tex definition of \copyright. +% +\def\registeredsymbol{% + $^{{\ooalign{\hfil\raise.07ex\hbox{\selectfonts\lllsize R}% + \hfil\crcr\Orb}}% + }$% +} + +% @textdegree - the normal degrees sign. +% +\def\textdegree{$^\circ$} + +% Laurent Siebenmann reports \Orb undefined with: +% Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38 +% so we'll define it if necessary. +% +\ifx\Orb\undefined +\def\Orb{\mathhexbox20D} +\fi + + +\message{page headings,} + +\newskip\titlepagetopglue \titlepagetopglue = 1.5in +\newskip\titlepagebottomglue \titlepagebottomglue = 2pc + +% First the title page. Must do @settitle before @titlepage. +\newif\ifseenauthor +\newif\iffinishedtitlepage + +% Do an implicit @contents or @shortcontents after @end titlepage if the +% user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage. +% +\newif\ifsetcontentsaftertitlepage + \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue +\newif\ifsetshortcontentsaftertitlepage + \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue + +\parseargdef\shorttitlepage{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}% + \endgroup\page\hbox{}\page} + +\envdef\titlepage{% + % Open one extra group, as we want to close it in the middle of \Etitlepage. + \begingroup + \parindent=0pt \textfonts + % Leave some space at the very top of the page. + \vglue\titlepagetopglue + % No rule at page bottom unless we print one at the top with @title. + \finishedtitlepagetrue + % + % Most title ``pages'' are actually two pages long, with space + % at the top of the second. We don't want the ragged left on the second. + \let\oldpage = \page + \def\page{% + \iffinishedtitlepage\else + \finishtitlepage + \fi + \let\page = \oldpage + \page + \null + }% +} + +\def\Etitlepage{% + \iffinishedtitlepage\else + \finishtitlepage + \fi + % It is important to do the page break before ending the group, + % because the headline and footline are only empty inside the group. + % If we use the new definition of \page, we always get a blank page + % after the title page, which we certainly don't want. + \oldpage + \endgroup + % + % Need this before the \...aftertitlepage checks so that if they are + % in effect the toc pages will come out with page numbers. + \HEADINGSon + % + % If they want short, they certainly want long too. + \ifsetshortcontentsaftertitlepage + \shortcontents + \contents + \global\let\shortcontents = \relax + \global\let\contents = \relax + \fi + % + \ifsetcontentsaftertitlepage + \contents + \global\let\contents = \relax + \global\let\shortcontents = \relax + \fi +} + +\def\finishtitlepage{% + \vskip4pt \hrule height 2pt width \hsize + \vskip\titlepagebottomglue + \finishedtitlepagetrue +} + +%%% Macros to be used within @titlepage: + +\let\subtitlerm=\tenrm +\def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines} + +\def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines + \let\tt=\authortt} + +\parseargdef\title{% + \checkenv\titlepage + \leftline{\titlefonts\rm #1} + % print a rule at the page bottom also. + \finishedtitlepagefalse + \vskip4pt \hrule height 4pt width \hsize \vskip4pt +} + +\parseargdef\subtitle{% + \checkenv\titlepage + {\subtitlefont \rightline{#1}}% +} + +% @author should come last, but may come many times. +% It can also be used inside @quotation. +% +\parseargdef\author{% + \def\temp{\quotation}% + \ifx\thisenv\temp + \def\quotationauthor{#1}% printed in \Equotation. + \else + \checkenv\titlepage + \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi + {\authorfont \leftline{#1}}% + \fi +} + + +%%% Set up page headings and footings. + +\let\thispage=\folio + +\newtoks\evenheadline % headline on even pages +\newtoks\oddheadline % headline on odd pages +\newtoks\evenfootline % footline on even pages +\newtoks\oddfootline % footline on odd pages + +% Now make TeX use those variables +\headline={{\textfonts\rm \ifodd\pageno \the\oddheadline + \else \the\evenheadline \fi}} +\footline={{\textfonts\rm \ifodd\pageno \the\oddfootline + \else \the\evenfootline \fi}\HEADINGShook} +\let\HEADINGShook=\relax + +% Commands to set those variables. +% For example, this is what @headings on does +% @evenheading @thistitle|@thispage|@thischapter +% @oddheading @thischapter|@thispage|@thistitle +% @evenfooting @thisfile|| +% @oddfooting ||@thisfile + + +\def\evenheading{\parsearg\evenheadingxxx} +\def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish} +\def\evenheadingyyy #1\|#2\|#3\|#4\finish{% +\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} + +\def\oddheading{\parsearg\oddheadingxxx} +\def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish} +\def\oddheadingyyy #1\|#2\|#3\|#4\finish{% +\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} + +\parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}% + +\def\evenfooting{\parsearg\evenfootingxxx} +\def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish} +\def\evenfootingyyy #1\|#2\|#3\|#4\finish{% +\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} + +\def\oddfooting{\parsearg\oddfootingxxx} +\def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish} +\def\oddfootingyyy #1\|#2\|#3\|#4\finish{% + \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}% + % + % Leave some space for the footline. Hopefully ok to assume + % @evenfooting will not be used by itself. + \global\advance\pageheight by -12pt + \global\advance\vsize by -12pt +} + +\parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}} + + +% @headings double turns headings on for double-sided printing. +% @headings single turns headings on for single-sided printing. +% @headings off turns them off. +% @headings on same as @headings double, retained for compatibility. +% @headings after turns on double-sided headings after this page. +% @headings doubleafter turns on double-sided headings after this page. +% @headings singleafter turns on single-sided headings after this page. +% By default, they are off at the start of a document, +% and turned `on' after @end titlepage. + +\def\headings #1 {\csname HEADINGS#1\endcsname} + +\def\HEADINGSoff{% +\global\evenheadline={\hfil} \global\evenfootline={\hfil} +\global\oddheadline={\hfil} \global\oddfootline={\hfil}} +\HEADINGSoff +% When we turn headings on, set the page number to 1. +% For double-sided printing, put current file name in lower left corner, +% chapter name on inside top of right hand pages, document +% title on inside top of left hand pages, and page numbers on outside top +% edge of all pages. +\def\HEADINGSdouble{% +\global\pageno=1 +\global\evenfootline={\hfil} +\global\oddfootline={\hfil} +\global\evenheadline={\line{\folio\hfil\thistitle}} +\global\oddheadline={\line{\thischapter\hfil\folio}} +\global\let\contentsalignmacro = \chapoddpage +} +\let\contentsalignmacro = \chappager + +% For single-sided printing, chapter title goes across top left of page, +% page number on top right. +\def\HEADINGSsingle{% +\global\pageno=1 +\global\evenfootline={\hfil} +\global\oddfootline={\hfil} +\global\evenheadline={\line{\thischapter\hfil\folio}} +\global\oddheadline={\line{\thischapter\hfil\folio}} +\global\let\contentsalignmacro = \chappager +} +\def\HEADINGSon{\HEADINGSdouble} + +\def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex} +\let\HEADINGSdoubleafter=\HEADINGSafter +\def\HEADINGSdoublex{% +\global\evenfootline={\hfil} +\global\oddfootline={\hfil} +\global\evenheadline={\line{\folio\hfil\thistitle}} +\global\oddheadline={\line{\thischapter\hfil\folio}} +\global\let\contentsalignmacro = \chapoddpage +} + +\def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex} +\def\HEADINGSsinglex{% +\global\evenfootline={\hfil} +\global\oddfootline={\hfil} +\global\evenheadline={\line{\thischapter\hfil\folio}} +\global\oddheadline={\line{\thischapter\hfil\folio}} +\global\let\contentsalignmacro = \chappager +} + +% Subroutines used in generating headings +% This produces Day Month Year style of output. +% Only define if not already defined, in case a txi-??.tex file has set +% up a different format (e.g., txi-cs.tex does this). +\ifx\today\undefined +\def\today{% + \number\day\space + \ifcase\month + \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr + \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug + \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec + \fi + \space\number\year} +\fi + +% @settitle line... specifies the title of the document, for headings. +% It generates no output of its own. +\def\thistitle{\putwordNoTitle} +\def\settitle{\parsearg{\gdef\thistitle}} + + +\message{tables,} +% Tables -- @table, @ftable, @vtable, @item(x). + +% default indentation of table text +\newdimen\tableindent \tableindent=.8in +% default indentation of @itemize and @enumerate text +\newdimen\itemindent \itemindent=.3in +% margin between end of table item and start of table text. +\newdimen\itemmargin \itemmargin=.1in + +% used internally for \itemindent minus \itemmargin +\newdimen\itemmax + +% Note @table, @ftable, and @vtable define @item, @itemx, etc., with +% these defs. +% They also define \itemindex +% to index the item name in whatever manner is desired (perhaps none). + +\newif\ifitemxneedsnegativevskip + +\def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi} + +\def\internalBitem{\smallbreak \parsearg\itemzzz} +\def\internalBitemx{\itemxpar \parsearg\itemzzz} + +\def\itemzzz #1{\begingroup % + \advance\hsize by -\rightskip + \advance\hsize by -\tableindent + \setbox0=\hbox{\itemindicate{#1}}% + \itemindex{#1}% + \nobreak % This prevents a break before @itemx. + % + % If the item text does not fit in the space we have, put it on a line + % by itself, and do not allow a page break either before or after that + % line. We do not start a paragraph here because then if the next + % command is, e.g., @kindex, the whatsit would get put into the + % horizontal list on a line by itself, resulting in extra blank space. + \ifdim \wd0>\itemmax + % + % Make this a paragraph so we get the \parskip glue and wrapping, + % but leave it ragged-right. + \begingroup + \advance\leftskip by-\tableindent + \advance\hsize by\tableindent + \advance\rightskip by0pt plus1fil + \leavevmode\unhbox0\par + \endgroup + % + % We're going to be starting a paragraph, but we don't want the + % \parskip glue -- logically it's part of the @item we just started. + \nobreak \vskip-\parskip + % + % Stop a page break at the \parskip glue coming up. However, if + % what follows is an environment such as @example, there will be no + % \parskip glue; then the negative vskip we just inserted would + % cause the example and the item to crash together. So we use this + % bizarre value of 10001 as a signal to \aboveenvbreak to insert + % \parskip glue after all. Section titles are handled this way also. + % + \penalty 10001 + \endgroup + \itemxneedsnegativevskipfalse + \else + % The item text fits into the space. Start a paragraph, so that the + % following text (if any) will end up on the same line. + \noindent + % Do this with kerns and \unhbox so that if there is a footnote in + % the item text, it can migrate to the main vertical list and + % eventually be printed. + \nobreak\kern-\tableindent + \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0 + \unhbox0 + \nobreak\kern\dimen0 + \endgroup + \itemxneedsnegativevskiptrue + \fi +} + +\def\item{\errmessage{@item while not in a list environment}} +\def\itemx{\errmessage{@itemx while not in a list environment}} + +% @table, @ftable, @vtable. +\envdef\table{% + \let\itemindex\gobble + \tablecheck{table}% +} +\envdef\ftable{% + \def\itemindex ##1{\doind {fn}{\code{##1}}}% + \tablecheck{ftable}% +} +\envdef\vtable{% + \def\itemindex ##1{\doind {vr}{\code{##1}}}% + \tablecheck{vtable}% +} +\def\tablecheck#1{% + \ifnum \the\catcode`\^^M=\active + \endgroup + \errmessage{This command won't work in this context; perhaps the problem is + that we are \inenvironment\thisenv}% + \def\next{\doignore{#1}}% + \else + \let\next\tablex + \fi + \next +} +\def\tablex#1{% + \def\itemindicate{#1}% + \parsearg\tabley +} +\def\tabley#1{% + {% + \makevalueexpandable + \edef\temp{\noexpand\tablez #1\space\space\space}% + \expandafter + }\temp \endtablez +} +\def\tablez #1 #2 #3 #4\endtablez{% + \aboveenvbreak + \ifnum 0#1>0 \advance \leftskip by #1\mil \fi + \ifnum 0#2>0 \tableindent=#2\mil \fi + \ifnum 0#3>0 \advance \rightskip by #3\mil \fi + \itemmax=\tableindent + \advance \itemmax by -\itemmargin + \advance \leftskip by \tableindent + \exdentamount=\tableindent + \parindent = 0pt + \parskip = \smallskipamount + \ifdim \parskip=0pt \parskip=2pt \fi + \let\item = \internalBitem + \let\itemx = \internalBitemx +} +\def\Etable{\endgraf\afterenvbreak} +\let\Eftable\Etable +\let\Evtable\Etable +\let\Eitemize\Etable +\let\Eenumerate\Etable + +% This is the counter used by @enumerate, which is really @itemize + +\newcount \itemno + +\envdef\itemize{\parsearg\doitemize} + +\def\doitemize#1{% + \aboveenvbreak + \itemmax=\itemindent + \advance\itemmax by -\itemmargin + \advance\leftskip by \itemindent + \exdentamount=\itemindent + \parindent=0pt + \parskip=\smallskipamount + \ifdim\parskip=0pt \parskip=2pt \fi + \def\itemcontents{#1}% + % @itemize with no arg is equivalent to @itemize @bullet. + \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi + \let\item=\itemizeitem +} + +% Definition of @item while inside @itemize and @enumerate. +% +\def\itemizeitem{% + \advance\itemno by 1 % for enumerations + {\let\par=\endgraf \smallbreak}% reasonable place to break + {% + % If the document has an @itemize directly after a section title, a + % \nobreak will be last on the list, and \sectionheading will have + % done a \vskip-\parskip. In that case, we don't want to zero + % parskip, or the item text will crash with the heading. On the + % other hand, when there is normal text preceding the item (as there + % usually is), we do want to zero parskip, or there would be too much + % space. In that case, we won't have a \nobreak before. At least + % that's the theory. + \ifnum\lastpenalty<10000 \parskip=0in \fi + \noindent + \hbox to 0pt{\hss \itemcontents \kern\itemmargin}% + \vadjust{\penalty 1200}}% not good to break after first line of item. + \flushcr +} + +% \splitoff TOKENS\endmark defines \first to be the first token in +% TOKENS, and \rest to be the remainder. +% +\def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}% + +% Allow an optional argument of an uppercase letter, lowercase letter, +% or number, to specify the first label in the enumerated list. No +% argument is the same as `1'. +% +\envparseargdef\enumerate{\enumeratey #1 \endenumeratey} +\def\enumeratey #1 #2\endenumeratey{% + % If we were given no argument, pretend we were given `1'. + \def\thearg{#1}% + \ifx\thearg\empty \def\thearg{1}\fi + % + % Detect if the argument is a single token. If so, it might be a + % letter. Otherwise, the only valid thing it can be is a number. + % (We will always have one token, because of the test we just made. + % This is a good thing, since \splitoff doesn't work given nothing at + % all -- the first parameter is undelimited.) + \expandafter\splitoff\thearg\endmark + \ifx\rest\empty + % Only one token in the argument. It could still be anything. + % A ``lowercase letter'' is one whose \lccode is nonzero. + % An ``uppercase letter'' is one whose \lccode is both nonzero, and + % not equal to itself. + % Otherwise, we assume it's a number. + % + % We need the \relax at the end of the \ifnum lines to stop TeX from + % continuing to look for a . + % + \ifnum\lccode\expandafter`\thearg=0\relax + \numericenumerate % a number (we hope) + \else + % It's a letter. + \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax + \lowercaseenumerate % lowercase letter + \else + \uppercaseenumerate % uppercase letter + \fi + \fi + \else + % Multiple tokens in the argument. We hope it's a number. + \numericenumerate + \fi +} + +% An @enumerate whose labels are integers. The starting integer is +% given in \thearg. +% +\def\numericenumerate{% + \itemno = \thearg + \startenumeration{\the\itemno}% +} + +% The starting (lowercase) letter is in \thearg. +\def\lowercaseenumerate{% + \itemno = \expandafter`\thearg + \startenumeration{% + % Be sure we're not beyond the end of the alphabet. + \ifnum\itemno=0 + \errmessage{No more lowercase letters in @enumerate; get a bigger + alphabet}% + \fi + \char\lccode\itemno + }% +} + +% The starting (uppercase) letter is in \thearg. +\def\uppercaseenumerate{% + \itemno = \expandafter`\thearg + \startenumeration{% + % Be sure we're not beyond the end of the alphabet. + \ifnum\itemno=0 + \errmessage{No more uppercase letters in @enumerate; get a bigger + alphabet} + \fi + \char\uccode\itemno + }% +} + +% Call \doitemize, adding a period to the first argument and supplying the +% common last two arguments. Also subtract one from the initial value in +% \itemno, since @item increments \itemno. +% +\def\startenumeration#1{% + \advance\itemno by -1 + \doitemize{#1.}\flushcr +} + +% @alphaenumerate and @capsenumerate are abbreviations for giving an arg +% to @enumerate. +% +\def\alphaenumerate{\enumerate{a}} +\def\capsenumerate{\enumerate{A}} +\def\Ealphaenumerate{\Eenumerate} +\def\Ecapsenumerate{\Eenumerate} + + +% @multitable macros +% Amy Hendrickson, 8/18/94, 3/6/96 +% +% @multitable ... @end multitable will make as many columns as desired. +% Contents of each column will wrap at width given in preamble. Width +% can be specified either with sample text given in a template line, +% or in percent of \hsize, the current width of text on page. + +% Table can continue over pages but will only break between lines. + +% To make preamble: +% +% Either define widths of columns in terms of percent of \hsize: +% @multitable @columnfractions .25 .3 .45 +% @item ... +% +% Numbers following @columnfractions are the percent of the total +% current hsize to be used for each column. You may use as many +% columns as desired. + + +% Or use a template: +% @multitable {Column 1 template} {Column 2 template} {Column 3 template} +% @item ... +% using the widest term desired in each column. + +% Each new table line starts with @item, each subsequent new column +% starts with @tab. Empty columns may be produced by supplying @tab's +% with nothing between them for as many times as empty columns are needed, +% ie, @tab@tab@tab will produce two empty columns. + +% @item, @tab do not need to be on their own lines, but it will not hurt +% if they are. + +% Sample multitable: + +% @multitable {Column 1 template} {Column 2 template} {Column 3 template} +% @item first col stuff @tab second col stuff @tab third col +% @item +% first col stuff +% @tab +% second col stuff +% @tab +% third col +% @item first col stuff @tab second col stuff +% @tab Many paragraphs of text may be used in any column. +% +% They will wrap at the width determined by the template. +% @item@tab@tab This will be in third column. +% @end multitable + +% Default dimensions may be reset by user. +% @multitableparskip is vertical space between paragraphs in table. +% @multitableparindent is paragraph indent in table. +% @multitablecolmargin is horizontal space to be left between columns. +% @multitablelinespace is space to leave between table items, baseline +% to baseline. +% 0pt means it depends on current normal line spacing. +% +\newskip\multitableparskip +\newskip\multitableparindent +\newdimen\multitablecolspace +\newskip\multitablelinespace +\multitableparskip=0pt +\multitableparindent=6pt +\multitablecolspace=12pt +\multitablelinespace=0pt + +% Macros used to set up halign preamble: +% +\let\endsetuptable\relax +\def\xendsetuptable{\endsetuptable} +\let\columnfractions\relax +\def\xcolumnfractions{\columnfractions} +\newif\ifsetpercent + +% #1 is the @columnfraction, usually a decimal number like .5, but might +% be just 1. We just use it, whatever it is. +% +\def\pickupwholefraction#1 {% + \global\advance\colcount by 1 + \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}% + \setuptable +} + +\newcount\colcount +\def\setuptable#1{% + \def\firstarg{#1}% + \ifx\firstarg\xendsetuptable + \let\go = \relax + \else + \ifx\firstarg\xcolumnfractions + \global\setpercenttrue + \else + \ifsetpercent + \let\go\pickupwholefraction + \else + \global\advance\colcount by 1 + \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a + % separator; typically that is always in the input, anyway. + \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}% + \fi + \fi + \ifx\go\pickupwholefraction + % Put the argument back for the \pickupwholefraction call, so + % we'll always have a period there to be parsed. + \def\go{\pickupwholefraction#1}% + \else + \let\go = \setuptable + \fi% + \fi + \go +} + +% multitable-only commands. +% +% @headitem starts a heading row, which we typeset in bold. +% Assignments have to be global since we are inside the implicit group +% of an alignment entry. Note that \everycr resets \everytab. +\def\headitem{\checkenv\multitable \crcr \global\everytab={\bf}\the\everytab}% +% +% A \tab used to include \hskip1sp. But then the space in a template +% line is not enough. That is bad. So let's go back to just `&' until +% we encounter the problem it was intended to solve again. +% --karl, nathan@acm.org, 20apr99. +\def\tab{\checkenv\multitable &\the\everytab}% + +% @multitable ... @end multitable definitions: +% +\newtoks\everytab % insert after every tab. +% +\envdef\multitable{% + \vskip\parskip + \startsavinginserts + % + % @item within a multitable starts a normal row. + % We use \def instead of \let so that if one of the multitable entries + % contains an @itemize, we don't choke on the \item (seen as \crcr aka + % \endtemplate) expanding \doitemize. + \def\item{\crcr}% + % + \tolerance=9500 + \hbadness=9500 + \setmultitablespacing + \parskip=\multitableparskip + \parindent=\multitableparindent + \overfullrule=0pt + \global\colcount=0 + % + \everycr = {% + \noalign{% + \global\everytab={}% + \global\colcount=0 % Reset the column counter. + % Check for saved footnotes, etc. + \checkinserts + % Keeps underfull box messages off when table breaks over pages. + %\filbreak + % Maybe so, but it also creates really weird page breaks when the + % table breaks over pages. Wouldn't \vfil be better? Wait until the + % problem manifests itself, so it can be fixed for real --karl. + }% + }% + % + \parsearg\domultitable +} +\def\domultitable#1{% + % To parse everything between @multitable and @item: + \setuptable#1 \endsetuptable + % + % This preamble sets up a generic column definition, which will + % be used as many times as user calls for columns. + % \vtop will set a single line and will also let text wrap and + % continue for many paragraphs if desired. + \halign\bgroup &% + \global\advance\colcount by 1 + \multistrut + \vtop{% + % Use the current \colcount to find the correct column width: + \hsize=\expandafter\csname col\the\colcount\endcsname + % + % In order to keep entries from bumping into each other + % we will add a \leftskip of \multitablecolspace to all columns after + % the first one. + % + % If a template has been used, we will add \multitablecolspace + % to the width of each template entry. + % + % If the user has set preamble in terms of percent of \hsize we will + % use that dimension as the width of the column, and the \leftskip + % will keep entries from bumping into each other. Table will start at + % left margin and final column will justify at right margin. + % + % Make sure we don't inherit \rightskip from the outer environment. + \rightskip=0pt + \ifnum\colcount=1 + % The first column will be indented with the surrounding text. + \advance\hsize by\leftskip + \else + \ifsetpercent \else + % If user has not set preamble in terms of percent of \hsize + % we will advance \hsize by \multitablecolspace. + \advance\hsize by \multitablecolspace + \fi + % In either case we will make \leftskip=\multitablecolspace: + \leftskip=\multitablecolspace + \fi + % Ignoring space at the beginning and end avoids an occasional spurious + % blank line, when TeX decides to break the line at the space before the + % box from the multistrut, so the strut ends up on a line by itself. + % For example: + % @multitable @columnfractions .11 .89 + % @item @code{#} + % @tab Legal holiday which is valid in major parts of the whole country. + % Is automatically provided with highlighting sequences respectively + % marking characters. + \noindent\ignorespaces##\unskip\multistrut + }\cr +} +\def\Emultitable{% + \crcr + \egroup % end the \halign + \global\setpercentfalse +} + +\def\setmultitablespacing{% + \def\multistrut{\strut}% just use the standard line spacing + % + % Compute \multitablelinespace (if not defined by user) for use in + % \multitableparskip calculation. We used define \multistrut based on + % this, but (ironically) that caused the spacing to be off. + % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100. +\ifdim\multitablelinespace=0pt +\setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip +\global\advance\multitablelinespace by-\ht0 +\fi +%% Test to see if parskip is larger than space between lines of +%% table. If not, do nothing. +%% If so, set to same dimension as multitablelinespace. +\ifdim\multitableparskip>\multitablelinespace +\global\multitableparskip=\multitablelinespace +\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller + %% than skip between lines in the table. +\fi% +\ifdim\multitableparskip=0pt +\global\multitableparskip=\multitablelinespace +\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller + %% than skip between lines in the table. +\fi} + + +\message{conditionals,} + +% @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext, +% @ifnotxml always succeed. They currently do nothing; we don't +% attempt to check whether the conditionals are properly nested. But we +% have to remember that they are conditionals, so that @end doesn't +% attempt to close an environment group. +% +\def\makecond#1{% + \expandafter\let\csname #1\endcsname = \relax + \expandafter\let\csname iscond.#1\endcsname = 1 +} +\makecond{iftex} +\makecond{ifnotdocbook} +\makecond{ifnothtml} +\makecond{ifnotinfo} +\makecond{ifnotplaintext} +\makecond{ifnotxml} + +% Ignore @ignore, @ifhtml, @ifinfo, and the like. +% +\def\direntry{\doignore{direntry}} +\def\documentdescription{\doignore{documentdescription}} +\def\docbook{\doignore{docbook}} +\def\html{\doignore{html}} +\def\ifdocbook{\doignore{ifdocbook}} +\def\ifhtml{\doignore{ifhtml}} +\def\ifinfo{\doignore{ifinfo}} +\def\ifnottex{\doignore{ifnottex}} +\def\ifplaintext{\doignore{ifplaintext}} +\def\ifxml{\doignore{ifxml}} +\def\ignore{\doignore{ignore}} +\def\menu{\doignore{menu}} +\def\xml{\doignore{xml}} + +% Ignore text until a line `@end #1', keeping track of nested conditionals. +% +% A count to remember the depth of nesting. +\newcount\doignorecount + +\def\doignore#1{\begingroup + % Scan in ``verbatim'' mode: + \obeylines + \catcode`\@ = \other + \catcode`\{ = \other + \catcode`\} = \other + % + % Make sure that spaces turn into tokens that match what \doignoretext wants. + \spaceisspace + % + % Count number of #1's that we've seen. + \doignorecount = 0 + % + % Swallow text until we reach the matching `@end #1'. + \dodoignore{#1}% +} + +{ \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source. + \obeylines % + % + \gdef\dodoignore#1{% + % #1 contains the command name as a string, e.g., `ifinfo'. + % + % Define a command to find the next `@end #1'. + \long\def\doignoretext##1^^M@end #1{% + \doignoretextyyy##1^^M@#1\_STOP_}% + % + % And this command to find another #1 command, at the beginning of a + % line. (Otherwise, we would consider a line `@c @ifset', for + % example, to count as an @ifset for nesting.) + \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}% + % + % And now expand that command. + \doignoretext ^^M% + }% +} + +\def\doignoreyyy#1{% + \def\temp{#1}% + \ifx\temp\empty % Nothing found. + \let\next\doignoretextzzz + \else % Found a nested condition, ... + \advance\doignorecount by 1 + \let\next\doignoretextyyy % ..., look for another. + % If we're here, #1 ends with ^^M\ifinfo (for example). + \fi + \next #1% the token \_STOP_ is present just after this macro. +} + +% We have to swallow the remaining "\_STOP_". +% +\def\doignoretextzzz#1{% + \ifnum\doignorecount = 0 % We have just found the outermost @end. + \let\next\enddoignore + \else % Still inside a nested condition. + \advance\doignorecount by -1 + \let\next\doignoretext % Look for the next @end. + \fi + \next +} + +% Finish off ignored text. +{ \obeylines% + % Ignore anything after the last `@end #1'; this matters in verbatim + % environments, where otherwise the newline after an ignored conditional + % would result in a blank line in the output. + \gdef\enddoignore#1^^M{\endgroup\ignorespaces}% +} + + +% @set VAR sets the variable VAR to an empty value. +% @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE. +% +% Since we want to separate VAR from REST-OF-LINE (which might be +% empty), we can't just use \parsearg; we have to insert a space of our +% own to delimit the rest of the line, and then take it out again if we +% didn't need it. +% We rely on the fact that \parsearg sets \catcode`\ =10. +% +\parseargdef\set{\setyyy#1 \endsetyyy} +\def\setyyy#1 #2\endsetyyy{% + {% + \makevalueexpandable + \def\temp{#2}% + \edef\next{\gdef\makecsname{SET#1}}% + \ifx\temp\empty + \next{}% + \else + \setzzz#2\endsetzzz + \fi + }% +} +% Remove the trailing space \setxxx inserted. +\def\setzzz#1 \endsetzzz{\next{#1}} + +% @clear VAR clears (i.e., unsets) the variable VAR. +% +\parseargdef\clear{% + {% + \makevalueexpandable + \global\expandafter\let\csname SET#1\endcsname=\relax + }% +} + +% @value{foo} gets the text saved in variable foo. +\def\value{\begingroup\makevalueexpandable\valuexxx} +\def\valuexxx#1{\expandablevalue{#1}\endgroup} +{ + \catcode`\- = \active \catcode`\_ = \active + % + \gdef\makevalueexpandable{% + \let\value = \expandablevalue + % We don't want these characters active, ... + \catcode`\-=\other \catcode`\_=\other + % ..., but we might end up with active ones in the argument if + % we're called from @code, as @code{@value{foo-bar_}}, though. + % So \let them to their normal equivalents. + \let-\realdash \let_\normalunderscore + } +} + +% We have this subroutine so that we can handle at least some @value's +% properly in indexes (we call \makevalueexpandable in \indexdummies). +% The command has to be fully expandable (if the variable is set), since +% the result winds up in the index file. This means that if the +% variable's value contains other Texinfo commands, it's almost certain +% it will fail (although perhaps we could fix that with sufficient work +% to do a one-level expansion on the result, instead of complete). +% +\def\expandablevalue#1{% + \expandafter\ifx\csname SET#1\endcsname\relax + {[No value for ``#1'']}% + \message{Variable `#1', used in @value, is not set.}% + \else + \csname SET#1\endcsname + \fi +} + +% @ifset VAR ... @end ifset reads the `...' iff VAR has been defined +% with @set. +% +% To get special treatment of `@end ifset,' call \makeond and the redefine. +% +\makecond{ifset} +\def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}} +\def\doifset#1#2{% + {% + \makevalueexpandable + \let\next=\empty + \expandafter\ifx\csname SET#2\endcsname\relax + #1% If not set, redefine \next. + \fi + \expandafter + }\next +} +\def\ifsetfail{\doignore{ifset}} + +% @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been +% defined with @set, or has been undefined with @clear. +% +% The `\else' inside the `\doifset' parameter is a trick to reuse the +% above code: if the variable is not set, do nothing, if it is set, +% then redefine \next to \ifclearfail. +% +\makecond{ifclear} +\def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}} +\def\ifclearfail{\doignore{ifclear}} + +% @dircategory CATEGORY -- specify a category of the dir file +% which this file should belong to. Ignore this in TeX. +\let\dircategory=\comment + +% @defininfoenclose. +\let\definfoenclose=\comment + + +\message{indexing,} +% Index generation facilities + +% Define \newwrite to be identical to plain tex's \newwrite +% except not \outer, so it can be used within macros and \if's. +\edef\newwrite{\makecsname{ptexnewwrite}} + +% \newindex {foo} defines an index named foo. +% It automatically defines \fooindex such that +% \fooindex ...rest of line... puts an entry in the index foo. +% It also defines \fooindfile to be the number of the output channel for +% the file that accumulates this index. The file's extension is foo. +% The name of an index should be no more than 2 characters long +% for the sake of vms. +% +\def\newindex#1{% + \iflinks + \expandafter\newwrite \csname#1indfile\endcsname + \openout \csname#1indfile\endcsname \jobname.#1 % Open the file + \fi + \expandafter\xdef\csname#1index\endcsname{% % Define @#1index + \noexpand\doindex{#1}} +} + +% @defindex foo == \newindex{foo} +% +\def\defindex{\parsearg\newindex} + +% Define @defcodeindex, like @defindex except put all entries in @code. +% +\def\defcodeindex{\parsearg\newcodeindex} +% +\def\newcodeindex#1{% + \iflinks + \expandafter\newwrite \csname#1indfile\endcsname + \openout \csname#1indfile\endcsname \jobname.#1 + \fi + \expandafter\xdef\csname#1index\endcsname{% + \noexpand\docodeindex{#1}}% +} + + +% @synindex foo bar makes index foo feed into index bar. +% Do this instead of @defindex foo if you don't want it as a separate index. +% +% @syncodeindex foo bar similar, but put all entries made for index foo +% inside @code. +% +\def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}} +\def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}} + +% #1 is \doindex or \docodeindex, #2 the index getting redefined (foo), +% #3 the target index (bar). +\def\dosynindex#1#2#3{% + % Only do \closeout if we haven't already done it, else we'll end up + % closing the target index. + \expandafter \ifx\csname donesynindex#2\endcsname \undefined + % The \closeout helps reduce unnecessary open files; the limit on the + % Acorn RISC OS is a mere 16 files. + \expandafter\closeout\csname#2indfile\endcsname + \expandafter\let\csname\donesynindex#2\endcsname = 1 + \fi + % redefine \fooindfile: + \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname + \expandafter\let\csname#2indfile\endcsname=\temp + % redefine \fooindex: + \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}% +} + +% Define \doindex, the driver for all \fooindex macros. +% Argument #1 is generated by the calling \fooindex macro, +% and it is "foo", the name of the index. + +% \doindex just uses \parsearg; it calls \doind for the actual work. +% This is because \doind is more useful to call from other macros. + +% There is also \dosubind {index}{topic}{subtopic} +% which makes an entry in a two-level index such as the operation index. + +\def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer} +\def\singleindexer #1{\doind{\indexname}{#1}} + +% like the previous two, but they put @code around the argument. +\def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer} +\def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}} + +% Take care of Texinfo commands that can appear in an index entry. +% Since there are some commands we want to expand, and others we don't, +% we have to laboriously prevent expansion for those that we don't. +% +\def\indexdummies{% + \escapechar = `\\ % use backslash in output files. + \def\@{@}% change to @@ when we switch to @ as escape char in index files. + \def\ {\realbackslash\space }% + % + % Need these in case \tex is in effect and \{ is a \delimiter again. + % But can't use \lbracecmd and \rbracecmd because texindex assumes + % braces and backslashes are used only as delimiters. + \let\{ = \mylbrace + \let\} = \myrbrace + % + % I don't entirely understand this, but when an index entry is + % generated from a macro call, the \endinput which \scanmacro inserts + % causes processing to be prematurely terminated. This is, + % apparently, because \indexsorttmp is fully expanded, and \endinput + % is an expandable command. The redefinition below makes \endinput + % disappear altogether for that purpose -- although logging shows that + % processing continues to some further point. On the other hand, it + % seems \endinput does not hurt in the printed index arg, since that + % is still getting written without apparent harm. + % + % Sample source (mac-idx3.tex, reported by Graham Percival to + % help-texinfo, 22may06): + % @macro funindex {WORD} + % @findex xyz + % @end macro + % ... + % @funindex commtest + % + % The above is not enough to reproduce the bug, but it gives the flavor. + % + % Sample whatsit resulting: + % .@write3{\entry{xyz}{@folio }{@code {xyz@endinput }}} + % + % So: + \let\endinput = \empty + % + % Do the redefinitions. + \commondummies +} + +% For the aux and toc files, @ is the escape character. So we want to +% redefine everything using @ as the escape character (instead of +% \realbackslash, still used for index files). When everything uses @, +% this will be simpler. +% +\def\atdummies{% + \def\@{@@}% + \def\ {@ }% + \let\{ = \lbraceatcmd + \let\} = \rbraceatcmd + % + % Do the redefinitions. + \commondummies + \otherbackslash +} + +% Called from \indexdummies and \atdummies. +% +\def\commondummies{% + % + % \definedummyword defines \#1 as \string\#1\space, thus effectively + % preventing its expansion. This is used only for control% words, + % not control letters, because the \space would be incorrect for + % control characters, but is needed to separate the control word + % from whatever follows. + % + % For control letters, we have \definedummyletter, which omits the + % space. + % + % These can be used both for control words that take an argument and + % those that do not. If it is followed by {arg} in the input, then + % that will dutifully get written to the index (or wherever). + % + \def\definedummyword ##1{\def##1{\string##1\space}}% + \def\definedummyletter##1{\def##1{\string##1}}% + \let\definedummyaccent\definedummyletter + % + \commondummiesnofonts + % + \definedummyletter\_% + % + % Non-English letters. + \definedummyword\AA + \definedummyword\AE + \definedummyword\L + \definedummyword\OE + \definedummyword\O + \definedummyword\aa + \definedummyword\ae + \definedummyword\l + \definedummyword\oe + \definedummyword\o + \definedummyword\ss + \definedummyword\exclamdown + \definedummyword\questiondown + \definedummyword\ordf + \definedummyword\ordm + % + % Although these internal commands shouldn't show up, sometimes they do. + \definedummyword\bf + \definedummyword\gtr + \definedummyword\hat + \definedummyword\less + \definedummyword\sf + \definedummyword\sl + \definedummyword\tclose + \definedummyword\tt + % + \definedummyword\LaTeX + \definedummyword\TeX + % + % Assorted special characters. + \definedummyword\bullet + \definedummyword\comma + \definedummyword\copyright + \definedummyword\registeredsymbol + \definedummyword\dots + \definedummyword\enddots + \definedummyword\equiv + \definedummyword\error + \definedummyword\euro + \definedummyword\expansion + \definedummyword\minus + \definedummyword\pounds + \definedummyword\point + \definedummyword\print + \definedummyword\result + \definedummyword\textdegree + % + % We want to disable all macros so that they are not expanded by \write. + \macrolist + % + \normalturnoffactive + % + % Handle some cases of @value -- where it does not contain any + % (non-fully-expandable) commands. + \makevalueexpandable +} + +% \commondummiesnofonts: common to \commondummies and \indexnofonts. +% +\def\commondummiesnofonts{% + % Control letters and accents. + \definedummyletter\!% + \definedummyaccent\"% + \definedummyaccent\'% + \definedummyletter\*% + \definedummyaccent\,% + \definedummyletter\.% + \definedummyletter\/% + \definedummyletter\:% + \definedummyaccent\=% + \definedummyletter\?% + \definedummyaccent\^% + \definedummyaccent\`% + \definedummyaccent\~% + \definedummyword\u + \definedummyword\v + \definedummyword\H + \definedummyword\dotaccent + \definedummyword\ringaccent + \definedummyword\tieaccent + \definedummyword\ubaraccent + \definedummyword\udotaccent + \definedummyword\dotless + % + % Texinfo font commands. + \definedummyword\b + \definedummyword\i + \definedummyword\r + \definedummyword\sc + \definedummyword\t + % + % Commands that take arguments. + \definedummyword\acronym + \definedummyword\cite + \definedummyword\code + \definedummyword\command + \definedummyword\dfn + \definedummyword\emph + \definedummyword\env + \definedummyword\file + \definedummyword\kbd + \definedummyword\key + \definedummyword\math + \definedummyword\option + \definedummyword\pxref + \definedummyword\ref + \definedummyword\samp + \definedummyword\strong + \definedummyword\tie + \definedummyword\uref + \definedummyword\url + \definedummyword\var + \definedummyword\verb + \definedummyword\w + \definedummyword\xref +} + +% \indexnofonts is used when outputting the strings to sort the index +% by, and when constructing control sequence names. It eliminates all +% control sequences and just writes whatever the best ASCII sort string +% would be for a given command (usually its argument). +% +\def\indexnofonts{% + % Accent commands should become @asis. + \def\definedummyaccent##1{\let##1\asis}% + % We can just ignore other control letters. + \def\definedummyletter##1{\let##1\empty}% + % Hopefully, all control words can become @asis. + \let\definedummyword\definedummyaccent + % + \commondummiesnofonts + % + % Don't no-op \tt, since it isn't a user-level command + % and is used in the definitions of the active chars like <, >, |, etc. + % Likewise with the other plain tex font commands. + %\let\tt=\asis + % + \def\ { }% + \def\@{@}% + % how to handle braces? + \def\_{\normalunderscore}% + % + % Non-English letters. + \def\AA{AA}% + \def\AE{AE}% + \def\L{L}% + \def\OE{OE}% + \def\O{O}% + \def\aa{aa}% + \def\ae{ae}% + \def\l{l}% + \def\oe{oe}% + \def\o{o}% + \def\ss{ss}% + \def\exclamdown{!}% + \def\questiondown{?}% + \def\ordf{a}% + \def\ordm{o}% + % + \def\LaTeX{LaTeX}% + \def\TeX{TeX}% + % + % Assorted special characters. + % (The following {} will end up in the sort string, but that's ok.) + \def\bullet{bullet}% + \def\comma{,}% + \def\copyright{copyright}% + \def\registeredsymbol{R}% + \def\dots{...}% + \def\enddots{...}% + \def\equiv{==}% + \def\error{error}% + \def\euro{euro}% + \def\expansion{==>}% + \def\minus{-}% + \def\pounds{pounds}% + \def\point{.}% + \def\print{-|}% + \def\result{=>}% + \def\textdegree{degrees}% + % + % We need to get rid of all macros, leaving only the arguments (if present). + % Of course this is not nearly correct, but it is the best we can do for now. + % makeinfo does not expand macros in the argument to @deffn, which ends up + % writing an index entry, and texindex isn't prepared for an index sort entry + % that starts with \. + % + % Since macro invocations are followed by braces, we can just redefine them + % to take a single TeX argument. The case of a macro invocation that + % goes to end-of-line is not handled. + % + \macrolist +} + +\let\indexbackslash=0 %overridden during \printindex. +\let\SETmarginindex=\relax % put index entries in margin (undocumented)? + +% Most index entries go through here, but \dosubind is the general case. +% #1 is the index name, #2 is the entry text. +\def\doind#1#2{\dosubind{#1}{#2}{}} + +% Workhorse for all \fooindexes. +% #1 is name of index, #2 is stuff to put there, #3 is subentry -- +% empty if called from \doind, as we usually are (the main exception +% is with most defuns, which call us directly). +% +\def\dosubind#1#2#3{% + \iflinks + {% + % Store the main index entry text (including the third arg). + \toks0 = {#2}% + % If third arg is present, precede it with a space. + \def\thirdarg{#3}% + \ifx\thirdarg\empty \else + \toks0 = \expandafter{\the\toks0 \space #3}% + \fi + % + \edef\writeto{\csname#1indfile\endcsname}% + % + \ifvmode + \dosubindsanitize + \else + \dosubindwrite + \fi + }% + \fi +} + +% Write the entry in \toks0 to the index file: +% +\def\dosubindwrite{% + % Put the index entry in the margin if desired. + \ifx\SETmarginindex\relax\else + \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}% + \fi + % + % Remember, we are within a group. + \indexdummies % Must do this here, since \bf, etc expand at this stage + \def\backslashcurfont{\indexbackslash}% \indexbackslash isn't defined now + % so it will be output as is; and it will print as backslash. + % + % Process the index entry with all font commands turned off, to + % get the string to sort by. + {\indexnofonts + \edef\temp{\the\toks0}% need full expansion + \xdef\indexsorttmp{\temp}% + }% + % + % Set up the complete index entry, with both the sort key and + % the original text, including any font commands. We write + % three arguments to \entry to the .?? file (four in the + % subentry case), texindex reduces to two when writing the .??s + % sorted result. + \edef\temp{% + \write\writeto{% + \string\entry{\indexsorttmp}{\noexpand\folio}{\the\toks0}}% + }% + \temp +} + +% Take care of unwanted page breaks: +% +% If a skip is the last thing on the list now, preserve it +% by backing up by \lastskip, doing the \write, then inserting +% the skip again. Otherwise, the whatsit generated by the +% \write will make \lastskip zero. The result is that sequences +% like this: +% @end defun +% @tindex whatever +% @defun ... +% will have extra space inserted, because the \medbreak in the +% start of the @defun won't see the skip inserted by the @end of +% the previous defun. +% +% But don't do any of this if we're not in vertical mode. We +% don't want to do a \vskip and prematurely end a paragraph. +% +% Avoid page breaks due to these extra skips, too. +% +% But wait, there is a catch there: +% We'll have to check whether \lastskip is zero skip. \ifdim is not +% sufficient for this purpose, as it ignores stretch and shrink parts +% of the skip. The only way seems to be to check the textual +% representation of the skip. +% +% The following is almost like \def\zeroskipmacro{0.0pt} except that +% the ``p'' and ``t'' characters have catcode \other, not 11 (letter). +% +\edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname} +% +% ..., ready, GO: +% +\def\dosubindsanitize{% + % \lastskip and \lastpenalty cannot both be nonzero simultaneously. + \skip0 = \lastskip + \edef\lastskipmacro{\the\lastskip}% + \count255 = \lastpenalty + % + % If \lastskip is nonzero, that means the last item was a + % skip. And since a skip is discardable, that means this + % -\skip0 glue we're inserting is preceded by a + % non-discardable item, therefore it is not a potential + % breakpoint, therefore no \nobreak needed. + \ifx\lastskipmacro\zeroskipmacro + \else + \vskip-\skip0 + \fi + % + \dosubindwrite + % + \ifx\lastskipmacro\zeroskipmacro + % If \lastskip was zero, perhaps the last item was a penalty, and + % perhaps it was >=10000, e.g., a \nobreak. In that case, we want + % to re-insert the same penalty (values >10000 are used for various + % signals); since we just inserted a non-discardable item, any + % following glue (such as a \parskip) would be a breakpoint. For example: + % + % @deffn deffn-whatever + % @vindex index-whatever + % Description. + % would allow a break between the index-whatever whatsit + % and the "Description." paragraph. + \ifnum\count255>9999 \penalty\count255 \fi + \else + % On the other hand, if we had a nonzero \lastskip, + % this make-up glue would be preceded by a non-discardable item + % (the whatsit from the \write), so we must insert a \nobreak. + \nobreak\vskip\skip0 + \fi +} + +% The index entry written in the file actually looks like +% \entry {sortstring}{page}{topic} +% or +% \entry {sortstring}{page}{topic}{subtopic} +% The texindex program reads in these files and writes files +% containing these kinds of lines: +% \initial {c} +% before the first topic whose initial is c +% \entry {topic}{pagelist} +% for a topic that is used without subtopics +% \primary {topic} +% for the beginning of a topic that is used with subtopics +% \secondary {subtopic}{pagelist} +% for each subtopic. + +% Define the user-accessible indexing commands +% @findex, @vindex, @kindex, @cindex. + +\def\findex {\fnindex} +\def\kindex {\kyindex} +\def\cindex {\cpindex} +\def\vindex {\vrindex} +\def\tindex {\tpindex} +\def\pindex {\pgindex} + +\def\cindexsub {\begingroup\obeylines\cindexsub} +{\obeylines % +\gdef\cindexsub "#1" #2^^M{\endgroup % +\dosubind{cp}{#2}{#1}}} + +% Define the macros used in formatting output of the sorted index material. + +% @printindex causes a particular index (the ??s file) to get printed. +% It does not print any chapter heading (usually an @unnumbered). +% +\parseargdef\printindex{\begingroup + \dobreak \chapheadingskip{10000}% + % + \smallfonts \rm + \tolerance = 9500 + \everypar = {}% don't want the \kern\-parindent from indentation suppression. + % + % See if the index file exists and is nonempty. + % Change catcode of @ here so that if the index file contains + % \initial {@} + % as its first line, TeX doesn't complain about mismatched braces + % (because it thinks @} is a control sequence). + \catcode`\@ = 11 + \openin 1 \jobname.#1s + \ifeof 1 + % \enddoublecolumns gets confused if there is no text in the index, + % and it loses the chapter title and the aux file entries for the + % index. The easiest way to prevent this problem is to make sure + % there is some text. + \putwordIndexNonexistent + \else + % + % If the index file exists but is empty, then \openin leaves \ifeof + % false. We have to make TeX try to read something from the file, so + % it can discover if there is anything in it. + \read 1 to \temp + \ifeof 1 + \putwordIndexIsEmpty + \else + % Index files are almost Texinfo source, but we use \ as the escape + % character. It would be better to use @, but that's too big a change + % to make right now. + \def\indexbackslash{\backslashcurfont}% + \catcode`\\ = 0 + \escapechar = `\\ + \begindoublecolumns + \input \jobname.#1s + \enddoublecolumns + \fi + \fi + \closein 1 +\endgroup} + +% These macros are used by the sorted index file itself. +% Change them to control the appearance of the index. + +\def\initial#1{{% + % Some minor font changes for the special characters. + \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt + % + % Remove any glue we may have, we'll be inserting our own. + \removelastskip + % + % We like breaks before the index initials, so insert a bonus. + \nobreak + \vskip 0pt plus 3\baselineskip + \penalty 0 + \vskip 0pt plus -3\baselineskip + % + % Typeset the initial. Making this add up to a whole number of + % baselineskips increases the chance of the dots lining up from column + % to column. It still won't often be perfect, because of the stretch + % we need before each entry, but it's better. + % + % No shrink because it confuses \balancecolumns. + \vskip 1.67\baselineskip plus .5\baselineskip + \leftline{\secbf #1}% + % Do our best not to break after the initial. + \nobreak + \vskip .33\baselineskip plus .1\baselineskip +}} + +% \entry typesets a paragraph consisting of the text (#1), dot leaders, and +% then page number (#2) flushed to the right margin. It is used for index +% and table of contents entries. The paragraph is indented by \leftskip. +% +% A straightforward implementation would start like this: +% \def\entry#1#2{... +% But this frozes the catcodes in the argument, and can cause problems to +% @code, which sets - active. This problem was fixed by a kludge--- +% ``-'' was active throughout whole index, but this isn't really right. +% +% The right solution is to prevent \entry from swallowing the whole text. +% --kasal, 21nov03 +\def\entry{% + \begingroup + % + % Start a new paragraph if necessary, so our assignments below can't + % affect previous text. + \par + % + % Do not fill out the last line with white space. + \parfillskip = 0in + % + % No extra space above this paragraph. + \parskip = 0in + % + % Do not prefer a separate line ending with a hyphen to fewer lines. + \finalhyphendemerits = 0 + % + % \hangindent is only relevant when the entry text and page number + % don't both fit on one line. In that case, bob suggests starting the + % dots pretty far over on the line. Unfortunately, a large + % indentation looks wrong when the entry text itself is broken across + % lines. So we use a small indentation and put up with long leaders. + % + % \hangafter is reset to 1 (which is the value we want) at the start + % of each paragraph, so we need not do anything with that. + \hangindent = 2em + % + % When the entry text needs to be broken, just fill out the first line + % with blank space. + \rightskip = 0pt plus1fil + % + % A bit of stretch before each entry for the benefit of balancing + % columns. + \vskip 0pt plus1pt + % + % Swallow the left brace of the text (first parameter): + \afterassignment\doentry + \let\temp = +} +\def\doentry{% + \bgroup % Instead of the swallowed brace. + \noindent + \aftergroup\finishentry + % And now comes the text of the entry. +} +\def\finishentry#1{% + % #1 is the page number. + % + % The following is kludged to not output a line of dots in the index if + % there are no page numbers. The next person who breaks this will be + % cursed by a Unix daemon. + \def\tempa{{\rm }}% + \def\tempb{#1}% + \edef\tempc{\tempa}% + \edef\tempd{\tempb}% + \ifx\tempc\tempd + \ % + \else + % + % If we must, put the page number on a line of its own, and fill out + % this line with blank space. (The \hfil is overwhelmed with the + % fill leaders glue in \indexdotfill if the page number does fit.) + \hfil\penalty50 + \null\nobreak\indexdotfill % Have leaders before the page number. + % + % The `\ ' here is removed by the implicit \unskip that TeX does as + % part of (the primitive) \par. Without it, a spurious underfull + % \hbox ensues. + \ifpdf + \pdfgettoks#1.% + \ \the\toksA + \else + \ #1% + \fi + \fi + \par + \endgroup +} + +% Like plain.tex's \dotfill, except uses up at least 1 em. +\def\indexdotfill{\cleaders + \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1fill} + +\def\primary #1{\line{#1\hfil}} + +\newskip\secondaryindent \secondaryindent=0.5cm +\def\secondary#1#2{{% + \parfillskip=0in + \parskip=0in + \hangindent=1in + \hangafter=1 + \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill + \ifpdf + \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph. + \else + #2 + \fi + \par +}} + +% Define two-column mode, which we use to typeset indexes. +% Adapted from the TeXbook, page 416, which is to say, +% the manmac.tex format used to print the TeXbook itself. +\catcode`\@=11 + +\newbox\partialpage +\newdimen\doublecolumnhsize + +\def\begindoublecolumns{\begingroup % ended by \enddoublecolumns + % Grab any single-column material above us. + \output = {% + % + % Here is a possibility not foreseen in manmac: if we accumulate a + % whole lot of material, we might end up calling this \output + % routine twice in a row (see the doublecol-lose test, which is + % essentially a couple of indexes with @setchapternewpage off). In + % that case we just ship out what is in \partialpage with the normal + % output routine. Generally, \partialpage will be empty when this + % runs and this will be a no-op. See the indexspread.tex test case. + \ifvoid\partialpage \else + \onepageout{\pagecontents\partialpage}% + \fi + % + \global\setbox\partialpage = \vbox{% + % Unvbox the main output page. + \unvbox\PAGE + \kern-\topskip \kern\baselineskip + }% + }% + \eject % run that output routine to set \partialpage + % + % Use the double-column output routine for subsequent pages. + \output = {\doublecolumnout}% + % + % Change the page size parameters. We could do this once outside this + % routine, in each of @smallbook, @afourpaper, and the default 8.5x11 + % format, but then we repeat the same computation. Repeating a couple + % of assignments once per index is clearly meaningless for the + % execution time, so we may as well do it in one place. + % + % First we halve the line length, less a little for the gutter between + % the columns. We compute the gutter based on the line length, so it + % changes automatically with the paper format. The magic constant + % below is chosen so that the gutter has the same value (well, +-<1pt) + % as it did when we hard-coded it. + % + % We put the result in a separate register, \doublecolumhsize, so we + % can restore it in \pagesofar, after \hsize itself has (potentially) + % been clobbered. + % + \doublecolumnhsize = \hsize + \advance\doublecolumnhsize by -.04154\hsize + \divide\doublecolumnhsize by 2 + \hsize = \doublecolumnhsize + % + % Double the \vsize as well. (We don't need a separate register here, + % since nobody clobbers \vsize.) + \vsize = 2\vsize +} + +% The double-column output routine for all double-column pages except +% the last. +% +\def\doublecolumnout{% + \splittopskip=\topskip \splitmaxdepth=\maxdepth + % Get the available space for the double columns -- the normal + % (undoubled) page height minus any material left over from the + % previous page. + \dimen@ = \vsize + \divide\dimen@ by 2 + \advance\dimen@ by -\ht\partialpage + % + % box0 will be the left-hand column, box2 the right. + \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@ + \onepageout\pagesofar + \unvbox255 + \penalty\outputpenalty +} +% +% Re-output the contents of the output page -- any previous material, +% followed by the two boxes we just split, in box0 and box2. +\def\pagesofar{% + \unvbox\partialpage + % + \hsize = \doublecolumnhsize + \wd0=\hsize \wd2=\hsize + \hbox to\pagewidth{\box0\hfil\box2}% +} +% +% All done with double columns. +\def\enddoublecolumns{% + \output = {% + % Split the last of the double-column material. Leave it on the + % current page, no automatic page break. + \balancecolumns + % + % If we end up splitting too much material for the current page, + % though, there will be another page break right after this \output + % invocation ends. Having called \balancecolumns once, we do not + % want to call it again. Therefore, reset \output to its normal + % definition right away. (We hope \balancecolumns will never be + % called on to balance too much material, but if it is, this makes + % the output somewhat more palatable.) + \global\output = {\onepageout{\pagecontents\PAGE}}% + }% + \eject + \endgroup % started in \begindoublecolumns + % + % \pagegoal was set to the doubled \vsize above, since we restarted + % the current page. We're now back to normal single-column + % typesetting, so reset \pagegoal to the normal \vsize (after the + % \endgroup where \vsize got restored). + \pagegoal = \vsize +} +% +% Called at the end of the double column material. +\def\balancecolumns{% + \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120. + \dimen@ = \ht0 + \advance\dimen@ by \topskip + \advance\dimen@ by-\baselineskip + \divide\dimen@ by 2 % target to split to + %debug\message{final 2-column material height=\the\ht0, target=\the\dimen@.}% + \splittopskip = \topskip + % Loop until we get a decent breakpoint. + {% + \vbadness = 10000 + \loop + \global\setbox3 = \copy0 + \global\setbox1 = \vsplit3 to \dimen@ + \ifdim\ht3>\dimen@ + \global\advance\dimen@ by 1pt + \repeat + }% + %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}% + \setbox0=\vbox to\dimen@{\unvbox1}% + \setbox2=\vbox to\dimen@{\unvbox3}% + % + \pagesofar +} +\catcode`\@ = \other + + +\message{sectioning,} +% Chapters, sections, etc. + +% \unnumberedno is an oxymoron, of course. But we count the unnumbered +% sections so that we can refer to them unambiguously in the pdf +% outlines by their "section number". We avoid collisions with chapter +% numbers by starting them at 10000. (If a document ever has 10000 +% chapters, we're in trouble anyway, I'm sure.) +\newcount\unnumberedno \unnumberedno = 10000 +\newcount\chapno +\newcount\secno \secno=0 +\newcount\subsecno \subsecno=0 +\newcount\subsubsecno \subsubsecno=0 + +% This counter is funny since it counts through charcodes of letters A, B, ... +\newcount\appendixno \appendixno = `\@ +% +% \def\appendixletter{\char\the\appendixno} +% We do the following ugly conditional instead of the above simple +% construct for the sake of pdftex, which needs the actual +% letter in the expansion, not just typeset. +% +\def\appendixletter{% + \ifnum\appendixno=`A A% + \else\ifnum\appendixno=`B B% + \else\ifnum\appendixno=`C C% + \else\ifnum\appendixno=`D D% + \else\ifnum\appendixno=`E E% + \else\ifnum\appendixno=`F F% + \else\ifnum\appendixno=`G G% + \else\ifnum\appendixno=`H H% + \else\ifnum\appendixno=`I I% + \else\ifnum\appendixno=`J J% + \else\ifnum\appendixno=`K K% + \else\ifnum\appendixno=`L L% + \else\ifnum\appendixno=`M M% + \else\ifnum\appendixno=`N N% + \else\ifnum\appendixno=`O O% + \else\ifnum\appendixno=`P P% + \else\ifnum\appendixno=`Q Q% + \else\ifnum\appendixno=`R R% + \else\ifnum\appendixno=`S S% + \else\ifnum\appendixno=`T T% + \else\ifnum\appendixno=`U U% + \else\ifnum\appendixno=`V V% + \else\ifnum\appendixno=`W W% + \else\ifnum\appendixno=`X X% + \else\ifnum\appendixno=`Y Y% + \else\ifnum\appendixno=`Z Z% + % The \the is necessary, despite appearances, because \appendixletter is + % expanded while writing the .toc file. \char\appendixno is not + % expandable, thus it is written literally, thus all appendixes come out + % with the same letter (or @) in the toc without it. + \else\char\the\appendixno + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} + +% Each @chapter defines this as the name of the chapter. +% page headings and footings can use it. @section does likewise. +% However, they are not reliable, because we don't use marks. +\def\thischapter{} +\def\thissection{} + +\newcount\absseclevel % used to calculate proper heading level +\newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count + +% @raisesections: treat @section as chapter, @subsection as section, etc. +\def\raisesections{\global\advance\secbase by -1} +\let\up=\raisesections % original BFox name + +% @lowersections: treat @chapter as section, @section as subsection, etc. +\def\lowersections{\global\advance\secbase by 1} +\let\down=\lowersections % original BFox name + +% we only have subsub. +\chardef\maxseclevel = 3 +% +% A numbered section within an unnumbered changes to unnumbered too. +% To achive this, remember the "biggest" unnum. sec. we are currently in: +\chardef\unmlevel = \maxseclevel +% +% Trace whether the current chapter is an appendix or not: +% \chapheadtype is "N" or "A", unnumbered chapters are ignored. +\def\chapheadtype{N} + +% Choose a heading macro +% #1 is heading type +% #2 is heading level +% #3 is text for heading +\def\genhead#1#2#3{% + % Compute the abs. sec. level: + \absseclevel=#2 + \advance\absseclevel by \secbase + % Make sure \absseclevel doesn't fall outside the range: + \ifnum \absseclevel < 0 + \absseclevel = 0 + \else + \ifnum \absseclevel > 3 + \absseclevel = 3 + \fi + \fi + % The heading type: + \def\headtype{#1}% + \if \headtype U% + \ifnum \absseclevel < \unmlevel + \chardef\unmlevel = \absseclevel + \fi + \else + % Check for appendix sections: + \ifnum \absseclevel = 0 + \edef\chapheadtype{\headtype}% + \else + \if \headtype A\if \chapheadtype N% + \errmessage{@appendix... within a non-appendix chapter}% + \fi\fi + \fi + % Check for numbered within unnumbered: + \ifnum \absseclevel > \unmlevel + \def\headtype{U}% + \else + \chardef\unmlevel = 3 + \fi + \fi + % Now print the heading: + \if \headtype U% + \ifcase\absseclevel + \unnumberedzzz{#3}% + \or \unnumberedseczzz{#3}% + \or \unnumberedsubseczzz{#3}% + \or \unnumberedsubsubseczzz{#3}% + \fi + \else + \if \headtype A% + \ifcase\absseclevel + \appendixzzz{#3}% + \or \appendixsectionzzz{#3}% + \or \appendixsubseczzz{#3}% + \or \appendixsubsubseczzz{#3}% + \fi + \else + \ifcase\absseclevel + \chapterzzz{#3}% + \or \seczzz{#3}% + \or \numberedsubseczzz{#3}% + \or \numberedsubsubseczzz{#3}% + \fi + \fi + \fi + \suppressfirstparagraphindent +} + +% an interface: +\def\numhead{\genhead N} +\def\apphead{\genhead A} +\def\unnmhead{\genhead U} + +% @chapter, @appendix, @unnumbered. Increment top-level counter, reset +% all lower-level sectioning counters to zero. +% +% Also set \chaplevelprefix, which we prepend to @float sequence numbers +% (e.g., figures), q.v. By default (before any chapter), that is empty. +\let\chaplevelprefix = \empty +% +\outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz +\def\chapterzzz#1{% + % section resetting is \global in case the chapter is in a group, such + % as an @include file. + \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 + \global\advance\chapno by 1 + % + % Used for \float. + \gdef\chaplevelprefix{\the\chapno.}% + \resetallfloatnos + % + \message{\putwordChapter\space \the\chapno}% + % + % Write the actual heading. + \chapmacro{#1}{Ynumbered}{\the\chapno}% + % + % So @section and the like are numbered underneath this chapter. + \global\let\section = \numberedsec + \global\let\subsection = \numberedsubsec + \global\let\subsubsection = \numberedsubsubsec +} + +\outer\parseargdef\appendix{\apphead0{#1}} % normally apphead0 calls appendixzzz +\def\appendixzzz#1{% + \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 + \global\advance\appendixno by 1 + \gdef\chaplevelprefix{\appendixletter.}% + \resetallfloatnos + % + \def\appendixnum{\putwordAppendix\space \appendixletter}% + \message{\appendixnum}% + % + \chapmacro{#1}{Yappendix}{\appendixletter}% + % + \global\let\section = \appendixsec + \global\let\subsection = \appendixsubsec + \global\let\subsubsection = \appendixsubsubsec +} + +\outer\parseargdef\unnumbered{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz +\def\unnumberedzzz#1{% + \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 + \global\advance\unnumberedno by 1 + % + % Since an unnumbered has no number, no prefix for figures. + \global\let\chaplevelprefix = \empty + \resetallfloatnos + % + % This used to be simply \message{#1}, but TeX fully expands the + % argument to \message. Therefore, if #1 contained @-commands, TeX + % expanded them. For example, in `@unnumbered The @cite{Book}', TeX + % expanded @cite (which turns out to cause errors because \cite is meant + % to be executed, not expanded). + % + % Anyway, we don't want the fully-expanded definition of @cite to appear + % as a result of the \message, we just want `@cite' itself. We use + % \the to achieve this: TeX expands \the only once, + % simply yielding the contents of . (We also do this for + % the toc entries.) + \toks0 = {#1}% + \message{(\the\toks0)}% + % + \chapmacro{#1}{Ynothing}{\the\unnumberedno}% + % + \global\let\section = \unnumberedsec + \global\let\subsection = \unnumberedsubsec + \global\let\subsubsection = \unnumberedsubsubsec +} + +% @centerchap is like @unnumbered, but the heading is centered. +\outer\parseargdef\centerchap{% + % Well, we could do the following in a group, but that would break + % an assumption that \chapmacro is called at the outermost level. + % Thus we are safer this way: --kasal, 24feb04 + \let\centerparametersmaybe = \centerparameters + \unnmhead0{#1}% + \let\centerparametersmaybe = \relax +} + +% @top is like @unnumbered. +\let\top\unnumbered + +% Sections. +\outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz +\def\seczzz#1{% + \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 + \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}% +} + +\outer\parseargdef\appendixsection{\apphead1{#1}} % normally calls appendixsectionzzz +\def\appendixsectionzzz#1{% + \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 + \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}% +} +\let\appendixsec\appendixsection + +\outer\parseargdef\unnumberedsec{\unnmhead1{#1}} % normally calls unnumberedseczzz +\def\unnumberedseczzz#1{% + \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 + \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}% +} + +% Subsections. +\outer\parseargdef\numberedsubsec{\numhead2{#1}} % normally calls numberedsubseczzz +\def\numberedsubseczzz#1{% + \global\subsubsecno=0 \global\advance\subsecno by 1 + \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}% +} + +\outer\parseargdef\appendixsubsec{\apphead2{#1}} % normally calls appendixsubseczzz +\def\appendixsubseczzz#1{% + \global\subsubsecno=0 \global\advance\subsecno by 1 + \sectionheading{#1}{subsec}{Yappendix}% + {\appendixletter.\the\secno.\the\subsecno}% +} + +\outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}} %normally calls unnumberedsubseczzz +\def\unnumberedsubseczzz#1{% + \global\subsubsecno=0 \global\advance\subsecno by 1 + \sectionheading{#1}{subsec}{Ynothing}% + {\the\unnumberedno.\the\secno.\the\subsecno}% +} + +% Subsubsections. +\outer\parseargdef\numberedsubsubsec{\numhead3{#1}} % normally numberedsubsubseczzz +\def\numberedsubsubseczzz#1{% + \global\advance\subsubsecno by 1 + \sectionheading{#1}{subsubsec}{Ynumbered}% + {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}% +} + +\outer\parseargdef\appendixsubsubsec{\apphead3{#1}} % normally appendixsubsubseczzz +\def\appendixsubsubseczzz#1{% + \global\advance\subsubsecno by 1 + \sectionheading{#1}{subsubsec}{Yappendix}% + {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}% +} + +\outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}} %normally unnumberedsubsubseczzz +\def\unnumberedsubsubseczzz#1{% + \global\advance\subsubsecno by 1 + \sectionheading{#1}{subsubsec}{Ynothing}% + {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}% +} + +% These macros control what the section commands do, according +% to what kind of chapter we are in (ordinary, appendix, or unnumbered). +% Define them by default for a numbered chapter. +\let\section = \numberedsec +\let\subsection = \numberedsubsec +\let\subsubsection = \numberedsubsubsec + +% Define @majorheading, @heading and @subheading + +% NOTE on use of \vbox for chapter headings, section headings, and such: +% 1) We use \vbox rather than the earlier \line to permit +% overlong headings to fold. +% 2) \hyphenpenalty is set to 10000 because hyphenation in a +% heading is obnoxious; this forbids it. +% 3) Likewise, headings look best if no \parindent is used, and +% if justification is not attempted. Hence \raggedright. + + +\def\majorheading{% + {\advance\chapheadingskip by 10pt \chapbreak }% + \parsearg\chapheadingzzz +} + +\def\chapheading{\chapbreak \parsearg\chapheadingzzz} +\def\chapheadingzzz#1{% + {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 + \parindent=0pt\raggedright + \rm #1\hfill}}% + \bigskip \par\penalty 200\relax + \suppressfirstparagraphindent +} + +% @heading, @subheading, @subsubheading. +\parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{} + \suppressfirstparagraphindent} +\parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{} + \suppressfirstparagraphindent} +\parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{} + \suppressfirstparagraphindent} + +% These macros generate a chapter, section, etc. heading only +% (including whitespace, linebreaking, etc. around it), +% given all the information in convenient, parsed form. + +%%% Args are the skip and penalty (usually negative) +\def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi} + +%%% Define plain chapter starts, and page on/off switching for it +% Parameter controlling skip before chapter headings (if needed) + +\newskip\chapheadingskip + +\def\chapbreak{\dobreak \chapheadingskip {-4000}} +\def\chappager{\par\vfill\supereject} +\def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi} + +\def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname} + +\def\CHAPPAGoff{% +\global\let\contentsalignmacro = \chappager +\global\let\pchapsepmacro=\chapbreak +\global\let\pagealignmacro=\chappager} + +\def\CHAPPAGon{% +\global\let\contentsalignmacro = \chappager +\global\let\pchapsepmacro=\chappager +\global\let\pagealignmacro=\chappager +\global\def\HEADINGSon{\HEADINGSsingle}} + +\def\CHAPPAGodd{% +\global\let\contentsalignmacro = \chapoddpage +\global\let\pchapsepmacro=\chapoddpage +\global\let\pagealignmacro=\chapoddpage +\global\def\HEADINGSon{\HEADINGSdouble}} + +\CHAPPAGon + +% Chapter opening. +% +% #1 is the text, #2 is the section type (Ynumbered, Ynothing, +% Yappendix, Yomitfromtoc), #3 the chapter number. +% +% To test against our argument. +\def\Ynothingkeyword{Ynothing} +\def\Yomitfromtockeyword{Yomitfromtoc} +\def\Yappendixkeyword{Yappendix} +% +\def\chapmacro#1#2#3{% + \pchapsepmacro + {% + \chapfonts \rm + % + % Have to define \thissection before calling \donoderef, because the + % xref code eventually uses it. On the other hand, it has to be called + % after \pchapsepmacro, or the headline will change too soon. + \gdef\thissection{#1}% + \gdef\thischaptername{#1}% + % + % Only insert the separating space if we have a chapter/appendix + % number, and don't print the unnumbered ``number''. + \def\temptype{#2}% + \ifx\temptype\Ynothingkeyword + \setbox0 = \hbox{}% + \def\toctype{unnchap}% + \gdef\thischapternum{}% + \gdef\thischapter{#1}% + \else\ifx\temptype\Yomitfromtockeyword + \setbox0 = \hbox{}% contents like unnumbered, but no toc entry + \def\toctype{omit}% + \gdef\thischapternum{}% + \gdef\thischapter{}% + \else\ifx\temptype\Yappendixkeyword + \setbox0 = \hbox{\putwordAppendix{} #3\enspace}% + \def\toctype{app}% + \xdef\thischapternum{\appendixletter}% + % We don't substitute the actual chapter name into \thischapter + % because we don't want its macros evaluated now. And we don't + % use \thissection because that changes with each section. + % + \xdef\thischapter{\putwordAppendix{} \appendixletter: + \noexpand\thischaptername}% + \else + \setbox0 = \hbox{#3\enspace}% + \def\toctype{numchap}% + \xdef\thischapternum{\the\chapno}% + \xdef\thischapter{\putwordChapter{} \the\chapno: + \noexpand\thischaptername}% + \fi\fi\fi + % + % Write the toc entry for this chapter. Must come before the + % \donoderef, because we include the current node name in the toc + % entry, and \donoderef resets it to empty. + \writetocentry{\toctype}{#1}{#3}% + % + % For pdftex, we have to write out the node definition (aka, make + % the pdfdest) after any page break, but before the actual text has + % been typeset. If the destination for the pdf outline is after the + % text, then jumping from the outline may wind up with the text not + % being visible, for instance under high magnification. + \donoderef{#2}% + % + % Typeset the actual heading. + \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright + \hangindent=\wd0 \centerparametersmaybe + \unhbox0 #1\par}% + }% + \nobreak\bigskip % no page break after a chapter title + \nobreak +} + +% @centerchap -- centered and unnumbered. +\let\centerparametersmaybe = \relax +\def\centerparameters{% + \advance\rightskip by 3\rightskip + \leftskip = \rightskip + \parfillskip = 0pt +} + + +% I don't think this chapter style is supported any more, so I'm not +% updating it with the new noderef stuff. We'll see. --karl, 11aug03. +% +\def\setchapterstyle #1 {\csname CHAPF#1\endcsname} +% +\def\unnchfopen #1{% +\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 + \parindent=0pt\raggedright + \rm #1\hfill}}\bigskip \par\nobreak +} +\def\chfopen #1#2{\chapoddpage {\chapfonts +\vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}% +\par\penalty 5000 % +} +\def\centerchfopen #1{% +\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 + \parindent=0pt + \hfill {\rm #1}\hfill}}\bigskip \par\nobreak +} +\def\CHAPFopen{% + \global\let\chapmacro=\chfopen + \global\let\centerchapmacro=\centerchfopen} + + +% Section titles. These macros combine the section number parts and +% call the generic \sectionheading to do the printing. +% +\newskip\secheadingskip +\def\secheadingbreak{\dobreak \secheadingskip{-1000}} + +% Subsection titles. +\newskip\subsecheadingskip +\def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}} + +% Subsubsection titles. +\def\subsubsecheadingskip{\subsecheadingskip} +\def\subsubsecheadingbreak{\subsecheadingbreak} + + +% Print any size, any type, section title. +% +% #1 is the text, #2 is the section level (sec/subsec/subsubsec), #3 is +% the section type for xrefs (Ynumbered, Ynothing, Yappendix), #4 is the +% section number. +% +\def\sectionheading#1#2#3#4{% + {% + % Switch to the right set of fonts. + \csname #2fonts\endcsname \rm + % + % Insert space above the heading. + \csname #2headingbreak\endcsname + % + % Only insert the space after the number if we have a section number. + \def\sectionlevel{#2}% + \def\temptype{#3}% + % + \ifx\temptype\Ynothingkeyword + \setbox0 = \hbox{}% + \def\toctype{unn}% + \gdef\thissection{#1}% + \else\ifx\temptype\Yomitfromtockeyword + % for @headings -- no section number, don't include in toc, + % and don't redefine \thissection. + \setbox0 = \hbox{}% + \def\toctype{omit}% + \let\sectionlevel=\empty + \else\ifx\temptype\Yappendixkeyword + \setbox0 = \hbox{#4\enspace}% + \def\toctype{app}% + \gdef\thissection{#1}% + \else + \setbox0 = \hbox{#4\enspace}% + \def\toctype{num}% + \gdef\thissection{#1}% + \fi\fi\fi + % + % Write the toc entry (before \donoderef). See comments in \chapmacro. + \writetocentry{\toctype\sectionlevel}{#1}{#4}% + % + % Write the node reference (= pdf destination for pdftex). + % Again, see comments in \chapmacro. + \donoderef{#3}% + % + % Interline glue will be inserted when the vbox is completed. + % That glue will be a valid breakpoint for the page, since it'll be + % preceded by a whatsit (usually from the \donoderef, or from the + % \writetocentry if there was no node). We don't want to allow that + % break, since then the whatsits could end up on page n while the + % section is on page n+1, thus toc/etc. are wrong. Debian bug 276000. + \nobreak + % + % Output the actual section heading. + \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright + \hangindent=\wd0 % zero if no section number + \unhbox0 #1}% + }% + % Add extra space after the heading -- half of whatever came above it. + % Don't allow stretch, though. + \kern .5 \csname #2headingskip\endcsname + % + % Do not let the kern be a potential breakpoint, as it would be if it + % was followed by glue. + \nobreak + % + % We'll almost certainly start a paragraph next, so don't let that + % glue accumulate. (Not a breakpoint because it's preceded by a + % discardable item.) + \vskip-\parskip + % + % This is purely so the last item on the list is a known \penalty > + % 10000. This is so \startdefun can avoid allowing breakpoints after + % section headings. Otherwise, it would insert a valid breakpoint between: + % + % @section sec-whatever + % @deffn def-whatever + \penalty 10001 +} + + +\message{toc,} +% Table of contents. +\newwrite\tocfile + +% Write an entry to the toc file, opening it if necessary. +% Called from @chapter, etc. +% +% Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno} +% We append the current node name (if any) and page number as additional +% arguments for the \{chap,sec,...}entry macros which will eventually +% read this. The node name is used in the pdf outlines as the +% destination to jump to. +% +% We open the .toc file for writing here instead of at @setfilename (or +% any other fixed time) so that @contents can be anywhere in the document. +% But if #1 is `omit', then we don't do anything. This is used for the +% table of contents chapter openings themselves. +% +\newif\iftocfileopened +\def\omitkeyword{omit}% +% +\def\writetocentry#1#2#3{% + \edef\writetoctype{#1}% + \ifx\writetoctype\omitkeyword \else + \iftocfileopened\else + \immediate\openout\tocfile = \jobname.toc + \global\tocfileopenedtrue + \fi + % + \iflinks + {\atdummies + \edef\temp{% + \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}% + \temp + }% + \fi + \fi + % + % Tell \shipout to create a pdf destination on each page, if we're + % writing pdf. These are used in the table of contents. We can't + % just write one on every page because the title pages are numbered + % 1 and 2 (the page numbers aren't printed), and so are the first + % two pages of the document. Thus, we'd have two destinations named + % `1', and two named `2'. + \ifpdf \global\pdfmakepagedesttrue \fi +} + + +% These characters do not print properly in the Computer Modern roman +% fonts, so we must take special care. This is more or less redundant +% with the Texinfo input format setup at the end of this file. +% +\def\activecatcodes{% + \catcode`\"=\active + \catcode`\$=\active + \catcode`\<=\active + \catcode`\>=\active + \catcode`\\=\active + \catcode`\^=\active + \catcode`\_=\active + \catcode`\|=\active + \catcode`\~=\active +} + + +% Read the toc file, which is essentially Texinfo input. +\def\readtocfile{% + \setupdatafile + \activecatcodes + \input \jobname.toc +} + +\newskip\contentsrightmargin \contentsrightmargin=1in +\newcount\savepageno +\newcount\lastnegativepageno \lastnegativepageno = -1 + +% Prepare to read what we've written to \tocfile. +% +\def\startcontents#1{% + % If @setchapternewpage on, and @headings double, the contents should + % start on an odd page, unlike chapters. Thus, we maintain + % \contentsalignmacro in parallel with \pagealignmacro. + % From: Torbjorn Granlund + \contentsalignmacro + \immediate\closeout\tocfile + % + % Don't need to put `Contents' or `Short Contents' in the headline. + % It is abundantly clear what they are. + \def\thischapter{}% + \chapmacro{#1}{Yomitfromtoc}{}% + % + \savepageno = \pageno + \begingroup % Set up to handle contents files properly. + \raggedbottom % Worry more about breakpoints than the bottom. + \advance\hsize by -\contentsrightmargin % Don't use the full line length. + % + % Roman numerals for page numbers. + \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi +} + + +% Normal (long) toc. +\def\contents{% + \startcontents{\putwordTOC}% + \openin 1 \jobname.toc + \ifeof 1 \else + \readtocfile + \fi + \vfill \eject + \contentsalignmacro % in case @setchapternewpage odd is in effect + \ifeof 1 \else + \pdfmakeoutlines + \fi + \closein 1 + \endgroup + \lastnegativepageno = \pageno + \global\pageno = \savepageno +} + +% And just the chapters. +\def\summarycontents{% + \startcontents{\putwordShortTOC}% + % + \let\numchapentry = \shortchapentry + \let\appentry = \shortchapentry + \let\unnchapentry = \shortunnchapentry + % We want a true roman here for the page numbers. + \secfonts + \let\rm=\shortcontrm \let\bf=\shortcontbf + \let\sl=\shortcontsl \let\tt=\shortconttt + \rm + \hyphenpenalty = 10000 + \advance\baselineskip by 1pt % Open it up a little. + \def\numsecentry##1##2##3##4{} + \let\appsecentry = \numsecentry + \let\unnsecentry = \numsecentry + \let\numsubsecentry = \numsecentry + \let\appsubsecentry = \numsecentry + \let\unnsubsecentry = \numsecentry + \let\numsubsubsecentry = \numsecentry + \let\appsubsubsecentry = \numsecentry + \let\unnsubsubsecentry = \numsecentry + \openin 1 \jobname.toc + \ifeof 1 \else + \readtocfile + \fi + \closein 1 + \vfill \eject + \contentsalignmacro % in case @setchapternewpage odd is in effect + \endgroup + \lastnegativepageno = \pageno + \global\pageno = \savepageno +} +\let\shortcontents = \summarycontents + +% Typeset the label for a chapter or appendix for the short contents. +% The arg is, e.g., `A' for an appendix, or `3' for a chapter. +% +\def\shortchaplabel#1{% + % This space should be enough, since a single number is .5em, and the + % widest letter (M) is 1em, at least in the Computer Modern fonts. + % But use \hss just in case. + % (This space doesn't include the extra space that gets added after + % the label; that gets put in by \shortchapentry above.) + % + % We'd like to right-justify chapter numbers, but that looks strange + % with appendix letters. And right-justifying numbers and + % left-justifying letters looks strange when there is less than 10 + % chapters. Have to read the whole toc once to know how many chapters + % there are before deciding ... + \hbox to 1em{#1\hss}% +} + +% These macros generate individual entries in the table of contents. +% The first argument is the chapter or section name. +% The last argument is the page number. +% The arguments in between are the chapter number, section number, ... + +% Chapters, in the main contents. +\def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}} +% +% Chapters, in the short toc. +% See comments in \dochapentry re vbox and related settings. +\def\shortchapentry#1#2#3#4{% + \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}% +} + +% Appendices, in the main contents. +% Need the word Appendix, and a fixed-size box. +% +\def\appendixbox#1{% + % We use M since it's probably the widest letter. + \setbox0 = \hbox{\putwordAppendix{} M}% + \hbox to \wd0{\putwordAppendix{} #1\hss}} +% +\def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\labelspace#1}{#4}} + +% Unnumbered chapters. +\def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}} +\def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}} + +% Sections. +\def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}} +\let\appsecentry=\numsecentry +\def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}} + +% Subsections. +\def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}} +\let\appsubsecentry=\numsubsecentry +\def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}} + +% And subsubsections. +\def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}} +\let\appsubsubsecentry=\numsubsubsecentry +\def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}} + +% This parameter controls the indentation of the various levels. +% Same as \defaultparindent. +\newdimen\tocindent \tocindent = 15pt + +% Now for the actual typesetting. In all these, #1 is the text and #2 is the +% page number. +% +% If the toc has to be broken over pages, we want it to be at chapters +% if at all possible; hence the \penalty. +\def\dochapentry#1#2{% + \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip + \begingroup + \chapentryfonts + \tocentry{#1}{\dopageno\bgroup#2\egroup}% + \endgroup + \nobreak\vskip .25\baselineskip plus.1\baselineskip +} + +\def\dosecentry#1#2{\begingroup + \secentryfonts \leftskip=\tocindent + \tocentry{#1}{\dopageno\bgroup#2\egroup}% +\endgroup} + +\def\dosubsecentry#1#2{\begingroup + \subsecentryfonts \leftskip=2\tocindent + \tocentry{#1}{\dopageno\bgroup#2\egroup}% +\endgroup} + +\def\dosubsubsecentry#1#2{\begingroup + \subsubsecentryfonts \leftskip=3\tocindent + \tocentry{#1}{\dopageno\bgroup#2\egroup}% +\endgroup} + +% We use the same \entry macro as for the index entries. +\let\tocentry = \entry + +% Space between chapter (or whatever) number and the title. +\def\labelspace{\hskip1em \relax} + +\def\dopageno#1{{\rm #1}} +\def\doshortpageno#1{{\rm #1}} + +\def\chapentryfonts{\secfonts \rm} +\def\secentryfonts{\textfonts} +\def\subsecentryfonts{\textfonts} +\def\subsubsecentryfonts{\textfonts} + + +\message{environments,} +% @foo ... @end foo. + +% @point{}, @result{}, @expansion{}, @print{}, @equiv{}. +% +% Since these characters are used in examples, it should be an even number of +% \tt widths. Each \tt character is 1en, so two makes it 1em. +% +\def\point{$\star$} +\def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}} +\def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}} +\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}} +\def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}} + +% The @error{} command. +% Adapted from the TeXbook's \boxit. +% +\newbox\errorbox +% +{\tentt \global\dimen0 = 3em}% Width of the box. +\dimen2 = .55pt % Thickness of rules +% The text. (`r' is open on the right, `e' somewhat less so on the left.) +\setbox0 = \hbox{\kern-.75pt \reducedsf error\kern-1.5pt} +% +\setbox\errorbox=\hbox to \dimen0{\hfil + \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right. + \advance\hsize by -2\dimen2 % Rules. + \vbox{% + \hrule height\dimen2 + \hbox{\vrule width\dimen2 \kern3pt % Space to left of text. + \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below. + \kern3pt\vrule width\dimen2}% Space to right. + \hrule height\dimen2} + \hfil} +% +\def\error{\leavevmode\lower.7ex\copy\errorbox} + +% @tex ... @end tex escapes into raw Tex temporarily. +% One exception: @ is still an escape character, so that @end tex works. +% But \@ or @@ will get a plain tex @ character. + +\envdef\tex{% + \catcode `\\=0 \catcode `\{=1 \catcode `\}=2 + \catcode `\$=3 \catcode `\&=4 \catcode `\#=6 + \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie + \catcode `\%=14 + \catcode `\+=\other + \catcode `\"=\other + \catcode `\|=\other + \catcode `\<=\other + \catcode `\>=\other + \escapechar=`\\ + % + \let\b=\ptexb + \let\bullet=\ptexbullet + \let\c=\ptexc + \let\,=\ptexcomma + \let\.=\ptexdot + \let\dots=\ptexdots + \let\equiv=\ptexequiv + \let\!=\ptexexclam + \let\i=\ptexi + \let\indent=\ptexindent + \let\noindent=\ptexnoindent + \let\{=\ptexlbrace + \let\+=\tabalign + \let\}=\ptexrbrace + \let\/=\ptexslash + \let\*=\ptexstar + \let\t=\ptext + \let\frenchspacing=\plainfrenchspacing + % + \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}% + \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}% + \def\@{@}% +} +% There is no need to define \Etex. + +% Define @lisp ... @end lisp. +% @lisp environment forms a group so it can rebind things, +% including the definition of @end lisp (which normally is erroneous). + +% Amount to narrow the margins by for @lisp. +\newskip\lispnarrowing \lispnarrowing=0.4in + +% This is the definition that ^^M gets inside @lisp, @example, and other +% such environments. \null is better than a space, since it doesn't +% have any width. +\def\lisppar{\null\endgraf} + +% This space is always present above and below environments. +\newskip\envskipamount \envskipamount = 0pt + +% Make spacing and below environment symmetrical. We use \parskip here +% to help in doing that, since in @example-like environments \parskip +% is reset to zero; thus the \afterenvbreak inserts no space -- but the +% start of the next paragraph will insert \parskip. +% +\def\aboveenvbreak{{% + % =10000 instead of <10000 because of a special case in \itemzzz and + % \sectionheading, q.v. + \ifnum \lastpenalty=10000 \else + \advance\envskipamount by \parskip + \endgraf + \ifdim\lastskip<\envskipamount + \removelastskip + % it's not a good place to break if the last penalty was \nobreak + % or better ... + \ifnum\lastpenalty<10000 \penalty-50 \fi + \vskip\envskipamount + \fi + \fi +}} + +\let\afterenvbreak = \aboveenvbreak + +% \nonarrowing is a flag. If "set", @lisp etc don't narrow margins; it will +% also clear it, so that its embedded environments do the narrowing again. +\let\nonarrowing=\relax + +% @cartouche ... @end cartouche: draw rectangle w/rounded corners around +% environment contents. +\font\circle=lcircle10 +\newdimen\circthick +\newdimen\cartouter\newdimen\cartinner +\newskip\normbskip\newskip\normpskip\newskip\normlskip +\circthick=\fontdimen8\circle +% +\def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth +\def\ctr{{\hskip 6pt\circle\char'010}} +\def\cbl{{\circle\char'012\hskip -6pt}} +\def\cbr{{\hskip 6pt\circle\char'011}} +\def\carttop{\hbox to \cartouter{\hskip\lskip + \ctl\leaders\hrule height\circthick\hfil\ctr + \hskip\rskip}} +\def\cartbot{\hbox to \cartouter{\hskip\lskip + \cbl\leaders\hrule height\circthick\hfil\cbr + \hskip\rskip}} +% +\newskip\lskip\newskip\rskip + +\envdef\cartouche{% + \ifhmode\par\fi % can't be in the midst of a paragraph. + \startsavinginserts + \lskip=\leftskip \rskip=\rightskip + \leftskip=0pt\rightskip=0pt % we want these *outside*. + \cartinner=\hsize \advance\cartinner by-\lskip + \advance\cartinner by-\rskip + \cartouter=\hsize + \advance\cartouter by 18.4pt % allow for 3pt kerns on either + % side, and for 6pt waste from + % each corner char, and rule thickness + \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip + % Flag to tell @lisp, etc., not to narrow margin. + \let\nonarrowing = t% + \vbox\bgroup + \baselineskip=0pt\parskip=0pt\lineskip=0pt + \carttop + \hbox\bgroup + \hskip\lskip + \vrule\kern3pt + \vbox\bgroup + \kern3pt + \hsize=\cartinner + \baselineskip=\normbskip + \lineskip=\normlskip + \parskip=\normpskip + \vskip -\parskip + \comment % For explanation, see the end of \def\group. +} +\def\Ecartouche{% + \ifhmode\par\fi + \kern3pt + \egroup + \kern3pt\vrule + \hskip\rskip + \egroup + \cartbot + \egroup + \checkinserts +} + + +% This macro is called at the beginning of all the @example variants, +% inside a group. +\def\nonfillstart{% + \aboveenvbreak + \hfuzz = 12pt % Don't be fussy + \sepspaces % Make spaces be word-separators rather than space tokens. + \let\par = \lisppar % don't ignore blank lines + \obeylines % each line of input is a line of output + \parskip = 0pt + \parindent = 0pt + \emergencystretch = 0pt % don't try to avoid overfull boxes + \ifx\nonarrowing\relax + \advance \leftskip by \lispnarrowing + \exdentamount=\lispnarrowing + \else + \let\nonarrowing = \relax + \fi + \let\exdent=\nofillexdent +} + +% If you want all examples etc. small: @set dispenvsize small. +% If you want even small examples the full size: @set dispenvsize nosmall. +% This affects the following displayed environments: +% @example, @display, @format, @lisp +% +\def\smallword{small} +\def\nosmallword{nosmall} +\let\SETdispenvsize\relax +\def\setnormaldispenv{% + \ifx\SETdispenvsize\smallword + \smallexamplefonts \rm + \fi +} +\def\setsmalldispenv{% + \ifx\SETdispenvsize\nosmallword + \else + \smallexamplefonts \rm + \fi +} + +% We often define two environments, @foo and @smallfoo. +% Let's do it by one command: +\def\makedispenv #1#2{ + \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2} + \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2} + \expandafter\let\csname E#1\endcsname \afterenvbreak + \expandafter\let\csname Esmall#1\endcsname \afterenvbreak +} + +% Define two synonyms: +\def\maketwodispenvs #1#2#3{ + \makedispenv{#1}{#3} + \makedispenv{#2}{#3} +} + +% @lisp: indented, narrowed, typewriter font; @example: same as @lisp. +% +% @smallexample and @smalllisp: use smaller fonts. +% Originally contributed by Pavel@xerox. +% +\maketwodispenvs {lisp}{example}{% + \nonfillstart + \tt\quoteexpand + \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special. + \gobble % eat return +} +% @display/@smalldisplay: same as @lisp except keep current font. +% +\makedispenv {display}{% + \nonfillstart + \gobble +} + +% @format/@smallformat: same as @display except don't narrow margins. +% +\makedispenv{format}{% + \let\nonarrowing = t% + \nonfillstart + \gobble +} + +% @flushleft: same as @format, but doesn't obey \SETdispenvsize. +\envdef\flushleft{% + \let\nonarrowing = t% + \nonfillstart + \gobble +} +\let\Eflushleft = \afterenvbreak + +% @flushright. +% +\envdef\flushright{% + \let\nonarrowing = t% + \nonfillstart + \advance\leftskip by 0pt plus 1fill + \gobble +} +\let\Eflushright = \afterenvbreak + + +% @quotation does normal linebreaking (hence we can't use \nonfillstart) +% and narrows the margins. We keep \parskip nonzero in general, since +% we're doing normal filling. So, when using \aboveenvbreak and +% \afterenvbreak, temporarily make \parskip 0. +% +\envdef\quotation{% + {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip + \parindent=0pt + % + % @cartouche defines \nonarrowing to inhibit narrowing at next level down. + \ifx\nonarrowing\relax + \advance\leftskip by \lispnarrowing + \advance\rightskip by \lispnarrowing + \exdentamount = \lispnarrowing + \else + \let\nonarrowing = \relax + \fi + \parsearg\quotationlabel +} + +% We have retained a nonzero parskip for the environment, since we're +% doing normal filling. +% +\def\Equotation{% + \par + \ifx\quotationauthor\undefined\else + % indent a bit. + \leftline{\kern 2\leftskip \sl ---\quotationauthor}% + \fi + {\parskip=0pt \afterenvbreak}% +} + +% If we're given an argument, typeset it in bold with a colon after. +\def\quotationlabel#1{% + \def\temp{#1}% + \ifx\temp\empty \else + {\bf #1: }% + \fi +} + + +% LaTeX-like @verbatim...@end verbatim and @verb{...} +% If we want to allow any as delimiter, +% we need the curly braces so that makeinfo sees the @verb command, eg: +% `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org +% +% [Knuth]: Donald Ervin Knuth, 1996. The TeXbook. +% +% [Knuth] p.344; only we need to do the other characters Texinfo sets +% active too. Otherwise, they get lost as the first character on a +% verbatim line. +\def\dospecials{% + \do\ \do\\\do\{\do\}\do\$\do\&% + \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~% + \do\<\do\>\do\|\do\@\do+\do\"% +} +% +% [Knuth] p. 380 +\def\uncatcodespecials{% + \def\do##1{\catcode`##1=\other}\dospecials} +% +% [Knuth] pp. 380,381,391 +% Disable Spanish ligatures ?` and !` of \tt font +\begingroup + \catcode`\`=\active\gdef`{\relax\lq} +\endgroup +% +% Setup for the @verb command. +% +% Eight spaces for a tab +\begingroup + \catcode`\^^I=\active + \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }} +\endgroup +% +\def\setupverb{% + \tt % easiest (and conventionally used) font for verbatim + \def\par{\leavevmode\endgraf}% + \catcode`\`=\active + \tabeightspaces + % Respect line breaks, + % print special symbols as themselves, and + % make each space count + % must do in this order: + \obeylines \uncatcodespecials \sepspaces +} + +% Setup for the @verbatim environment +% +% Real tab expansion +\newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount +% +\def\starttabbox{\setbox0=\hbox\bgroup} + +% Allow an option to not replace quotes with a regular directed right +% quote/apostrophe (char 0x27), but instead use the undirected quote +% from cmtt (char 0x0d). The undirected quote is ugly, so don't make it +% the default, but it works for pasting with more pdf viewers (at least +% evince), the lilypond developers report. xpdf does work with the +% regular 0x27. +% +\def\codequoteright{% + \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax + '% + \else + \char'15 + \fi +} +% +% and a similar option for the left quote char vs. a grave accent. +% Modern fonts display ASCII 0x60 as a grave accent, so some people like +% the code environments to do likewise. +% +\def\codequoteleft{% + \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax + `% + \else + \char'22 + \fi +} +% +\begingroup + \catcode`\^^I=\active + \gdef\tabexpand{% + \catcode`\^^I=\active + \def^^I{\leavevmode\egroup + \dimen0=\wd0 % the width so far, or since the previous tab + \divide\dimen0 by\tabw + \multiply\dimen0 by\tabw % compute previous multiple of \tabw + \advance\dimen0 by\tabw % advance to next multiple of \tabw + \wd0=\dimen0 \box0 \starttabbox + }% + } + \catcode`\'=\active + \gdef\rquoteexpand{\catcode\rquoteChar=\active \def'{\codequoteright}}% + % + \catcode`\`=\active + \gdef\lquoteexpand{\catcode\lquoteChar=\active \def`{\codequoteleft}}% + % + \gdef\quoteexpand{\rquoteexpand \lquoteexpand}% +\endgroup + +% start the verbatim environment. +\def\setupverbatim{% + \let\nonarrowing = t% + \nonfillstart + % Easiest (and conventionally used) font for verbatim + \tt + \def\par{\leavevmode\egroup\box0\endgraf}% + \catcode`\`=\active + \tabexpand + \quoteexpand + % Respect line breaks, + % print special symbols as themselves, and + % make each space count + % must do in this order: + \obeylines \uncatcodespecials \sepspaces + \everypar{\starttabbox}% +} + +% Do the @verb magic: verbatim text is quoted by unique +% delimiter characters. Before first delimiter expect a +% right brace, after last delimiter expect closing brace: +% +% \def\doverb'{'#1'}'{#1} +% +% [Knuth] p. 382; only eat outer {} +\begingroup + \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other + \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next] +\endgroup +% +\def\verb{\begingroup\setupverb\doverb} +% +% +% Do the @verbatim magic: define the macro \doverbatim so that +% the (first) argument ends when '@end verbatim' is reached, ie: +% +% \def\doverbatim#1@end verbatim{#1} +% +% For Texinfo it's a lot easier than for LaTeX, +% because texinfo's \verbatim doesn't stop at '\end{verbatim}': +% we need not redefine '\', '{' and '}'. +% +% Inspired by LaTeX's verbatim command set [latex.ltx] +% +\begingroup + \catcode`\ =\active + \obeylines % + % ignore everything up to the first ^^M, that's the newline at the end + % of the @verbatim input line itself. Otherwise we get an extra blank + % line in the output. + \xdef\doverbatim#1^^M#2@end verbatim{#2\noexpand\end\gobble verbatim}% + % We really want {...\end verbatim} in the body of the macro, but + % without the active space; thus we have to use \xdef and \gobble. +\endgroup +% +\envdef\verbatim{% + \setupverbatim\doverbatim +} +\let\Everbatim = \afterenvbreak + + +% @verbatiminclude FILE - insert text of file in verbatim environment. +% +\def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude} +% +\def\doverbatiminclude#1{% + {% + \makevalueexpandable + \setupverbatim + \input #1 + \afterenvbreak + }% +} + +% @copying ... @end copying. +% Save the text away for @insertcopying later. +% +% We save the uninterpreted tokens, rather than creating a box. +% Saving the text in a box would be much easier, but then all the +% typesetting commands (@smallbook, font changes, etc.) have to be done +% beforehand -- and a) we want @copying to be done first in the source +% file; b) letting users define the frontmatter in as flexible order as +% possible is very desirable. +% +\def\copying{\checkenv{}\begingroup\scanargctxt\docopying} +\def\docopying#1@end copying{\endgroup\def\copyingtext{#1}} +% +\def\insertcopying{% + \begingroup + \parindent = 0pt % paragraph indentation looks wrong on title page + \scanexp\copyingtext + \endgroup +} + +\message{defuns,} +% @defun etc. + +\newskip\defbodyindent \defbodyindent=.4in +\newskip\defargsindent \defargsindent=50pt +\newskip\deflastargmargin \deflastargmargin=18pt + +% Start the processing of @deffn: +\def\startdefun{% + \ifnum\lastpenalty<10000 + \medbreak + \else + % If there are two @def commands in a row, we'll have a \nobreak, + % which is there to keep the function description together with its + % header. But if there's nothing but headers, we need to allow a + % break somewhere. Check specifically for penalty 10002, inserted + % by \defargscommonending, instead of 10000, since the sectioning + % commands also insert a nobreak penalty, and we don't want to allow + % a break between a section heading and a defun. + % + \ifnum\lastpenalty=10002 \penalty2000 \fi + % + % Similarly, after a section heading, do not allow a break. + % But do insert the glue. + \medskip % preceded by discardable penalty, so not a breakpoint + \fi + % + \parindent=0in + \advance\leftskip by \defbodyindent + \exdentamount=\defbodyindent +} + +\def\dodefunx#1{% + % First, check whether we are in the right environment: + \checkenv#1% + % + % As above, allow line break if we have multiple x headers in a row. + % It's not a great place, though. + \ifnum\lastpenalty=10002 \penalty3000 \fi + % + % And now, it's time to reuse the body of the original defun: + \expandafter\gobbledefun#1% +} +\def\gobbledefun#1\startdefun{} + +% \printdefunline \deffnheader{text} +% +\def\printdefunline#1#2{% + \begingroup + % call \deffnheader: + #1#2 \endheader + % common ending: + \interlinepenalty = 10000 + \advance\rightskip by 0pt plus 1fil + \endgraf + \nobreak\vskip -\parskip + \penalty 10002 % signal to \startdefun and \dodefunx + % Some of the @defun-type tags do not enable magic parentheses, + % rendering the following check redundant. But we don't optimize. + \checkparencounts + \endgroup +} + +\def\Edefun{\endgraf\medbreak} + +% \makedefun{deffn} creates \deffn, \deffnx and \Edeffn; +% the only thing remainnig is to define \deffnheader. +% +\def\makedefun#1{% + \expandafter\let\csname E#1\endcsname = \Edefun + \edef\temp{\noexpand\domakedefun + \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}% + \temp +} + +% \domakedefun \deffn \deffnx \deffnheader +% +% Define \deffn and \deffnx, without parameters. +% \deffnheader has to be defined explicitly. +% +\def\domakedefun#1#2#3{% + \envdef#1{% + \startdefun + \parseargusing\activeparens{\printdefunline#3}% + }% + \def#2{\dodefunx#1}% + \def#3% +} + +%%% Untyped functions: + +% @deffn category name args +\makedefun{deffn}{\deffngeneral{}} + +% @deffn category class name args +\makedefun{defop}#1 {\defopon{#1\ \putwordon}} + +% \defopon {category on}class name args +\def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } + +% \deffngeneral {subind}category name args +% +\def\deffngeneral#1#2 #3 #4\endheader{% + % Remember that \dosubind{fn}{foo}{} is equivalent to \doind{fn}{foo}. + \dosubind{fn}{\code{#3}}{#1}% + \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}% +} + +%%% Typed functions: + +% @deftypefn category type name args +\makedefun{deftypefn}{\deftypefngeneral{}} + +% @deftypeop category class type name args +\makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}} + +% \deftypeopon {category on}class type name args +\def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } + +% \deftypefngeneral {subind}category type name args +% +\def\deftypefngeneral#1#2 #3 #4 #5\endheader{% + \dosubind{fn}{\code{#4}}{#1}% + \defname{#2}{#3}{#4}\defunargs{#5\unskip}% +} + +%%% Typed variables: + +% @deftypevr category type var args +\makedefun{deftypevr}{\deftypecvgeneral{}} + +% @deftypecv category class type var args +\makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}} + +% \deftypecvof {category of}class type var args +\def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} } + +% \deftypecvgeneral {subind}category type var args +% +\def\deftypecvgeneral#1#2 #3 #4 #5\endheader{% + \dosubind{vr}{\code{#4}}{#1}% + \defname{#2}{#3}{#4}\defunargs{#5\unskip}% +} + +%%% Untyped variables: + +% @defvr category var args +\makedefun{defvr}#1 {\deftypevrheader{#1} {} } + +% @defcv category class var args +\makedefun{defcv}#1 {\defcvof{#1\ \putwordof}} + +% \defcvof {category of}class var args +\def\defcvof#1#2 {\deftypecvof{#1}#2 {} } + +%%% Type: +% @deftp category name args +\makedefun{deftp}#1 #2 #3\endheader{% + \doind{tp}{\code{#2}}% + \defname{#1}{}{#2}\defunargs{#3\unskip}% +} + +% Remaining @defun-like shortcuts: +\makedefun{defun}{\deffnheader{\putwordDeffunc} } +\makedefun{defmac}{\deffnheader{\putwordDefmac} } +\makedefun{defspec}{\deffnheader{\putwordDefspec} } +\makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} } +\makedefun{defvar}{\defvrheader{\putwordDefvar} } +\makedefun{defopt}{\defvrheader{\putwordDefopt} } +\makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} } +\makedefun{defmethod}{\defopon\putwordMethodon} +\makedefun{deftypemethod}{\deftypeopon\putwordMethodon} +\makedefun{defivar}{\defcvof\putwordInstanceVariableof} +\makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof} + +% \defname, which formats the name of the @def (not the args). +% #1 is the category, such as "Function". +% #2 is the return type, if any. +% #3 is the function name. +% +% We are followed by (but not passed) the arguments, if any. +% +\def\defname#1#2#3{% + % Get the values of \leftskip and \rightskip as they were outside the @def... + \advance\leftskip by -\defbodyindent + % + % How we'll format the type name. Putting it in brackets helps + % distinguish it from the body text that may end up on the next line + % just below it. + \def\temp{#1}% + \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi} + % + % Figure out line sizes for the paragraph shape. + % The first line needs space for \box0; but if \rightskip is nonzero, + % we need only space for the part of \box0 which exceeds it: + \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip + % The continuations: + \dimen2=\hsize \advance\dimen2 by -\defargsindent + % (plain.tex says that \dimen1 should be used only as global.) + \parshape 2 0in \dimen0 \defargsindent \dimen2 + % + % Put the type name to the right margin. + \noindent + \hbox to 0pt{% + \hfil\box0 \kern-\hsize + % \hsize has to be shortened this way: + \kern\leftskip + % Intentionally do not respect \rightskip, since we need the space. + }% + % + % Allow all lines to be underfull without complaint: + \tolerance=10000 \hbadness=10000 + \exdentamount=\defbodyindent + {% + % defun fonts. We use typewriter by default (used to be bold) because: + % . we're printing identifiers, they should be in tt in principle. + % . in languages with many accents, such as Czech or French, it's + % common to leave accents off identifiers. The result looks ok in + % tt, but exceedingly strange in rm. + % . we don't want -- and --- to be treated as ligatures. + % . this still does not fix the ?` and !` ligatures, but so far no + % one has made identifiers using them :). + \df \tt + \def\temp{#2}% return value type + \ifx\temp\empty\else \tclose{\temp} \fi + #3% output function name + }% + {\rm\enskip}% hskip 0.5 em of \tenrm + % + \boldbrax + % arguments will be output next, if any. +} + +% Print arguments in slanted roman (not ttsl), inconsistently with using +% tt for the name. This is because literal text is sometimes needed in +% the argument list (groff manual), and ttsl and tt are not very +% distinguishable. Prevent hyphenation at `-' chars. +% +\def\defunargs#1{% + % use sl by default (not ttsl), + % tt for the names. + \df \sl \hyphenchar\font=0 + % + % On the other hand, if an argument has two dashes (for instance), we + % want a way to get ttsl. Let's try @var for that. + \let\var=\ttslanted + #1% + \sl\hyphenchar\font=45 +} + +% We want ()&[] to print specially on the defun line. +% +\def\activeparens{% + \catcode`\(=\active \catcode`\)=\active + \catcode`\[=\active \catcode`\]=\active + \catcode`\&=\active +} + +% Make control sequences which act like normal parenthesis chars. +\let\lparen = ( \let\rparen = ) + +% Be sure that we always have a definition for `(', etc. For example, +% if the fn name has parens in it, \boldbrax will not be in effect yet, +% so TeX would otherwise complain about undefined control sequence. +{ + \activeparens + \global\let(=\lparen \global\let)=\rparen + \global\let[=\lbrack \global\let]=\rbrack + \global\let& = \& + + \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb} + \gdef\magicamp{\let&=\amprm} +} + +\newcount\parencount + +% If we encounter &foo, then turn on ()-hacking afterwards +\newif\ifampseen +\def\amprm#1 {\ampseentrue{\bf\ }} + +\def\parenfont{% + \ifampseen + % At the first level, print parens in roman, + % otherwise use the default font. + \ifnum \parencount=1 \rm \fi + \else + % The \sf parens (in \boldbrax) actually are a little bolder than + % the contained text. This is especially needed for [ and ] . + \sf + \fi +} +\def\infirstlevel#1{% + \ifampseen + \ifnum\parencount=1 + #1% + \fi + \fi +} +\def\bfafterword#1 {#1 \bf} + +\def\opnr{% + \global\advance\parencount by 1 + {\parenfont(}% + \infirstlevel \bfafterword +} +\def\clnr{% + {\parenfont)}% + \infirstlevel \sl + \global\advance\parencount by -1 +} + +\newcount\brackcount +\def\lbrb{% + \global\advance\brackcount by 1 + {\bf[}% +} +\def\rbrb{% + {\bf]}% + \global\advance\brackcount by -1 +} + +\def\checkparencounts{% + \ifnum\parencount=0 \else \badparencount \fi + \ifnum\brackcount=0 \else \badbrackcount \fi +} +\def\badparencount{% + \errmessage{Unbalanced parentheses in @def}% + \global\parencount=0 +} +\def\badbrackcount{% + \errmessage{Unbalanced square braces in @def}% + \global\brackcount=0 +} + + +\message{macros,} +% @macro. + +% To do this right we need a feature of e-TeX, \scantokens, +% which we arrange to emulate with a temporary file in ordinary TeX. +\ifx\eTeXversion\undefined + \newwrite\macscribble + \def\scantokens#1{% + \toks0={#1}% + \immediate\openout\macscribble=\jobname.tmp + \immediate\write\macscribble{\the\toks0}% + \immediate\closeout\macscribble + \input \jobname.tmp + } +\fi + +\def\scanmacro#1{% + \begingroup + \newlinechar`\^^M + \let\xeatspaces\eatspaces + % Undo catcode changes of \startcontents and \doprintindex + % When called from @insertcopying or (short)caption, we need active + % backslash to get it printed correctly. Previously, we had + % \catcode`\\=\other instead. We'll see whether a problem appears + % with macro expansion. --kasal, 19aug04 + \catcode`\@=0 \catcode`\\=\active \escapechar=`\@ + % ... and \example + \spaceisspace + % + % Append \endinput to make sure that TeX does not see the ending newline. + % I've verified that it is necessary both for e-TeX and for ordinary TeX + % --kasal, 29nov03 + \scantokens{#1\endinput}% + \endgroup +} + +\def\scanexp#1{% + \edef\temp{\noexpand\scanmacro{#1}}% + \temp +} + +\newcount\paramno % Count of parameters +\newtoks\macname % Macro name +\newif\ifrecursive % Is it recursive? + +% List of all defined macros in the form +% \definedummyword\macro1\definedummyword\macro2... +% Currently is also contains all @aliases; the list can be split +% if there is a need. +\def\macrolist{} + +% Add the macro to \macrolist +\def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname} +\def\addtomacrolistxxx#1{% + \toks0 = \expandafter{\macrolist\definedummyword#1}% + \xdef\macrolist{\the\toks0}% +} + +% Utility routines. +% This does \let #1 = #2, with \csnames; that is, +% \let \csname#1\endcsname = \csname#2\endcsname +% (except of course we have to play expansion games). +% +\def\cslet#1#2{% + \expandafter\let + \csname#1\expandafter\endcsname + \csname#2\endcsname +} + +% Trim leading and trailing spaces off a string. +% Concepts from aro-bend problem 15 (see CTAN). +{\catcode`\@=11 +\gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }} +\gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@} +\gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @} +\def\unbrace#1{#1} +\unbrace{\gdef\trim@@@ #1 } #2@{#1} +} + +% Trim a single trailing ^^M off a string. +{\catcode`\^^M=\other \catcode`\Q=3% +\gdef\eatcr #1{\eatcra #1Q^^MQ}% +\gdef\eatcra#1^^MQ{\eatcrb#1Q}% +\gdef\eatcrb#1Q#2Q{#1}% +} + +% Macro bodies are absorbed as an argument in a context where +% all characters are catcode 10, 11 or 12, except \ which is active +% (as in normal texinfo). It is necessary to change the definition of \. + +% It's necessary to have hard CRs when the macro is executed. This is +% done by making ^^M (\endlinechar) catcode 12 when reading the macro +% body, and then making it the \newlinechar in \scanmacro. + +\def\scanctxt{% + \catcode`\"=\other + \catcode`\+=\other + \catcode`\<=\other + \catcode`\>=\other + \catcode`\@=\other + \catcode`\^=\other + \catcode`\_=\other + \catcode`\|=\other + \catcode`\~=\other +} + +\def\scanargctxt{% + \scanctxt + \catcode`\\=\other + \catcode`\^^M=\other +} + +\def\macrobodyctxt{% + \scanctxt + \catcode`\{=\other + \catcode`\}=\other + \catcode`\^^M=\other + \usembodybackslash +} + +\def\macroargctxt{% + \scanctxt + \catcode`\\=\other +} + +% \mbodybackslash is the definition of \ in @macro bodies. +% It maps \foo\ => \csname macarg.foo\endcsname => #N +% where N is the macro parameter number. +% We define \csname macarg.\endcsname to be \realbackslash, so +% \\ in macro replacement text gets you a backslash. + +{\catcode`@=0 @catcode`@\=@active + @gdef@usembodybackslash{@let\=@mbodybackslash} + @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname} +} +\expandafter\def\csname macarg.\endcsname{\realbackslash} + +\def\macro{\recursivefalse\parsearg\macroxxx} +\def\rmacro{\recursivetrue\parsearg\macroxxx} + +\def\macroxxx#1{% + \getargs{#1}% now \macname is the macname and \argl the arglist + \ifx\argl\empty % no arguments + \paramno=0% + \else + \expandafter\parsemargdef \argl;% + \fi + \if1\csname ismacro.\the\macname\endcsname + \message{Warning: redefining \the\macname}% + \else + \expandafter\ifx\csname \the\macname\endcsname \relax + \else \errmessage{Macro name \the\macname\space already defined}\fi + \global\cslet{macsave.\the\macname}{\the\macname}% + \global\expandafter\let\csname ismacro.\the\macname\endcsname=1% + \addtomacrolist{\the\macname}% + \fi + \begingroup \macrobodyctxt + \ifrecursive \expandafter\parsermacbody + \else \expandafter\parsemacbody + \fi} + +\parseargdef\unmacro{% + \if1\csname ismacro.#1\endcsname + \global\cslet{#1}{macsave.#1}% + \global\expandafter\let \csname ismacro.#1\endcsname=0% + % Remove the macro name from \macrolist: + \begingroup + \expandafter\let\csname#1\endcsname \relax + \let\definedummyword\unmacrodo + \xdef\macrolist{\macrolist}% + \endgroup + \else + \errmessage{Macro #1 not defined}% + \fi +} + +% Called by \do from \dounmacro on each macro. The idea is to omit any +% macro definitions that have been changed to \relax. +% +\def\unmacrodo#1{% + \ifx #1\relax + % remove this + \else + \noexpand\definedummyword \noexpand#1% + \fi +} + +% This makes use of the obscure feature that if the last token of a +% is #, then the preceding argument is delimited by +% an opening brace, and that opening brace is not consumed. +\def\getargs#1{\getargsxxx#1{}} +\def\getargsxxx#1#{\getmacname #1 \relax\getmacargs} +\def\getmacname #1 #2\relax{\macname={#1}} +\def\getmacargs#1{\def\argl{#1}} + +% Parse the optional {params} list. Set up \paramno and \paramlist +% so \defmacro knows what to do. Define \macarg.blah for each blah +% in the params list, to be ##N where N is the position in that list. +% That gets used by \mbodybackslash (above). + +% We need to get `macro parameter char #' into several definitions. +% The technique used is stolen from LaTeX: let \hash be something +% unexpandable, insert that wherever you need a #, and then redefine +% it to # just before using the token list produced. +% +% The same technique is used to protect \eatspaces till just before +% the macro is used. + +\def\parsemargdef#1;{\paramno=0\def\paramlist{}% + \let\hash\relax\let\xeatspaces\relax\parsemargdefxxx#1,;,} +\def\parsemargdefxxx#1,{% + \if#1;\let\next=\relax + \else \let\next=\parsemargdefxxx + \advance\paramno by 1% + \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname + {\xeatspaces{\hash\the\paramno}}% + \edef\paramlist{\paramlist\hash\the\paramno,}% + \fi\next} + +% These two commands read recursive and nonrecursive macro bodies. +% (They're different since rec and nonrec macros end differently.) + +\long\def\parsemacbody#1@end macro% +{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% +\long\def\parsermacbody#1@end rmacro% +{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% + +% This defines the macro itself. There are six cases: recursive and +% nonrecursive macros of zero, one, and many arguments. +% Much magic with \expandafter here. +% \xdef is used so that macro definitions will survive the file +% they're defined in; @include reads the file inside a group. +\def\defmacro{% + \let\hash=##% convert placeholders to macro parameter chars + \ifrecursive + \ifcase\paramno + % 0 + \expandafter\xdef\csname\the\macname\endcsname{% + \noexpand\scanmacro{\temp}}% + \or % 1 + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup\noexpand\macroargctxt + \noexpand\braceorline + \expandafter\noexpand\csname\the\macname xxx\endcsname}% + \expandafter\xdef\csname\the\macname xxx\endcsname##1{% + \egroup\noexpand\scanmacro{\temp}}% + \else % many + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup\noexpand\macroargctxt + \noexpand\csname\the\macname xx\endcsname}% + \expandafter\xdef\csname\the\macname xx\endcsname##1{% + \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% + \expandafter\expandafter + \expandafter\xdef + \expandafter\expandafter + \csname\the\macname xxx\endcsname + \paramlist{\egroup\noexpand\scanmacro{\temp}}% + \fi + \else + \ifcase\paramno + % 0 + \expandafter\xdef\csname\the\macname\endcsname{% + \noexpand\norecurse{\the\macname}% + \noexpand\scanmacro{\temp}\egroup}% + \or % 1 + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup\noexpand\macroargctxt + \noexpand\braceorline + \expandafter\noexpand\csname\the\macname xxx\endcsname}% + \expandafter\xdef\csname\the\macname xxx\endcsname##1{% + \egroup + \noexpand\norecurse{\the\macname}% + \noexpand\scanmacro{\temp}\egroup}% + \else % many + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup\noexpand\macroargctxt + \expandafter\noexpand\csname\the\macname xx\endcsname}% + \expandafter\xdef\csname\the\macname xx\endcsname##1{% + \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% + \expandafter\expandafter + \expandafter\xdef + \expandafter\expandafter + \csname\the\macname xxx\endcsname + \paramlist{% + \egroup + \noexpand\norecurse{\the\macname}% + \noexpand\scanmacro{\temp}\egroup}% + \fi + \fi} + +\def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}} + +% \braceorline decides whether the next nonwhitespace character is a +% {. If so it reads up to the closing }, if not, it reads the whole +% line. Whatever was read is then fed to the next control sequence +% as an argument (by \parsebrace or \parsearg) +\def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx} +\def\braceorlinexxx{% + \ifx\nchar\bgroup\else + \expandafter\parsearg + \fi \macnamexxx} + + +% @alias. +% We need some trickery to remove the optional spaces around the equal +% sign. Just make them active and then expand them all to nothing. +\def\alias{\parseargusing\obeyspaces\aliasxxx} +\def\aliasxxx #1{\aliasyyy#1\relax} +\def\aliasyyy #1=#2\relax{% + {% + \expandafter\let\obeyedspace=\empty + \addtomacrolist{#1}% + \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}% + }% + \next +} + + +\message{cross references,} + +\newwrite\auxfile + +\newif\ifhavexrefs % True if xref values are known. +\newif\ifwarnedxrefs % True if we warned once that they aren't known. + +% @inforef is relatively simple. +\def\inforef #1{\inforefzzz #1,,,,**} +\def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}}, + node \samp{\ignorespaces#1{}}} + +% @node's only job in TeX is to define \lastnode, which is used in +% cross-references. The @node line might or might not have commas, and +% might or might not have spaces before the first comma, like: +% @node foo , bar , ... +% We don't want such trailing spaces in the node name. +% +\parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse} +% +% also remove a trailing comma, in case of something like this: +% @node Help-Cross, , , Cross-refs +\def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse} +\def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}} + +\let\nwnode=\node +\let\lastnode=\empty + +% Write a cross-reference definition for the current node. #1 is the +% type (Ynumbered, Yappendix, Ynothing). +% +\def\donoderef#1{% + \ifx\lastnode\empty\else + \setref{\lastnode}{#1}% + \global\let\lastnode=\empty + \fi +} + +% @anchor{NAME} -- define xref target at arbitrary point. +% +\newcount\savesfregister +% +\def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi} +\def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi} +\def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces} + +% \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an +% anchor), which consists of three parts: +% 1) NAME-title - the current sectioning name taken from \thissection, +% or the anchor name. +% 2) NAME-snt - section number and type, passed as the SNT arg, or +% empty for anchors. +% 3) NAME-pg - the page number. +% +% This is called from \donoderef, \anchor, and \dofloat. In the case of +% floats, there is an additional part, which is not written here: +% 4) NAME-lof - the text as it should appear in a @listoffloats. +% +\def\setref#1#2{% + \pdfmkdest{#1}% + \iflinks + {% + \atdummies % preserve commands, but don't expand them + \edef\writexrdef##1##2{% + \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef + ##1}{##2}}% these are parameters of \writexrdef + }% + \toks0 = \expandafter{\thissection}% + \immediate \writexrdef{title}{\the\toks0 }% + \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc. + \writexrdef{pg}{\folio}% will be written later, during \shipout + }% + \fi +} + +% @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is +% the node name, #2 the name of the Info cross-reference, #3 the printed +% node name, #4 the name of the Info file, #5 the name of the printed +% manual. All but the node name can be omitted. +% +\def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]} +\def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]} +\def\ref#1{\xrefX[#1,,,,,,,]} +\def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup + \unsepspaces + \def\printedmanual{\ignorespaces #5}% + \def\printedrefname{\ignorespaces #3}% + \setbox1=\hbox{\printedmanual\unskip}% + \setbox0=\hbox{\printedrefname\unskip}% + \ifdim \wd0 = 0pt + % No printed node name was explicitly given. + \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax + % Use the node name inside the square brackets. + \def\printedrefname{\ignorespaces #1}% + \else + % Use the actual chapter/section title appear inside + % the square brackets. Use the real section title if we have it. + \ifdim \wd1 > 0pt + % It is in another manual, so we don't have it. + \def\printedrefname{\ignorespaces #1}% + \else + \ifhavexrefs + % We know the real title if we have the xref values. + \def\printedrefname{\refx{#1-title}{}}% + \else + % Otherwise just copy the Info node name. + \def\printedrefname{\ignorespaces #1}% + \fi% + \fi + \fi + \fi + % + % Make link in pdf output. + \ifpdf + \leavevmode + \getfilename{#4}% + {\turnoffactive + % See comments at \activebackslashdouble. + {\activebackslashdouble \xdef\pdfxrefdest{#1}% + \backslashparens\pdfxrefdest}% + % + \ifnum\filenamelength>0 + \startlink attr{/Border [0 0 0]}% + goto file{\the\filename.pdf} name{\pdfxrefdest}% + \else + \startlink attr{/Border [0 0 0]}% + goto name{\pdfmkpgn{\pdfxrefdest}}% + \fi + }% + \linkcolor + \fi + % + % Float references are printed completely differently: "Figure 1.2" + % instead of "[somenode], p.3". We distinguish them by the + % LABEL-title being set to a magic string. + {% + % Have to otherify everything special to allow the \csname to + % include an _ in the xref name, etc. + \indexnofonts + \turnoffactive + \expandafter\global\expandafter\let\expandafter\Xthisreftitle + \csname XR#1-title\endcsname + }% + \iffloat\Xthisreftitle + % If the user specified the print name (third arg) to the ref, + % print it instead of our usual "Figure 1.2". + \ifdim\wd0 = 0pt + \refx{#1-snt}{}% + \else + \printedrefname + \fi + % + % if the user also gave the printed manual name (fifth arg), append + % "in MANUALNAME". + \ifdim \wd1 > 0pt + \space \putwordin{} \cite{\printedmanual}% + \fi + \else + % node/anchor (non-float) references. + % + % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not + % insert empty discretionaries after hyphens, which means that it will + % not find a line break at a hyphen in a node names. Since some manuals + % are best written with fairly long node names, containing hyphens, this + % is a loss. Therefore, we give the text of the node name again, so it + % is as if TeX is seeing it for the first time. + \ifdim \wd1 > 0pt + \putwordsection{} ``\printedrefname'' \putwordin{} \cite{\printedmanual}% + \else + % _ (for example) has to be the character _ for the purposes of the + % control sequence corresponding to the node, but it has to expand + % into the usual \leavevmode...\vrule stuff for purposes of + % printing. So we \turnoffactive for the \refx-snt, back on for the + % printing, back off for the \refx-pg. + {\turnoffactive + % Only output a following space if the -snt ref is nonempty; for + % @unnumbered and @anchor, it won't be. + \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}% + \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi + }% + % output the `[mynode]' via a macro so it can be overridden. + \xrefprintnodename\printedrefname + % + % But we always want a comma and a space: + ,\space + % + % output the `page 3'. + \turnoffactive \putwordpage\tie\refx{#1-pg}{}% + \fi + \fi + \endlink +\endgroup} + +% This macro is called from \xrefX for the `[nodename]' part of xref +% output. It's a separate macro only so it can be changed more easily, +% since square brackets don't work well in some documents. Particularly +% one that Bob is working on :). +% +\def\xrefprintnodename#1{[#1]} + +% Things referred to by \setref. +% +\def\Ynothing{} +\def\Yomitfromtoc{} +\def\Ynumbered{% + \ifnum\secno=0 + \putwordChapter@tie \the\chapno + \else \ifnum\subsecno=0 + \putwordSection@tie \the\chapno.\the\secno + \else \ifnum\subsubsecno=0 + \putwordSection@tie \the\chapno.\the\secno.\the\subsecno + \else + \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno + \fi\fi\fi +} +\def\Yappendix{% + \ifnum\secno=0 + \putwordAppendix@tie @char\the\appendixno{}% + \else \ifnum\subsecno=0 + \putwordSection@tie @char\the\appendixno.\the\secno + \else \ifnum\subsubsecno=0 + \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno + \else + \putwordSection@tie + @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno + \fi\fi\fi +} + +% Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME. +% If its value is nonempty, SUFFIX is output afterward. +% +\def\refx#1#2{% + {% + \indexnofonts + \otherbackslash + \expandafter\global\expandafter\let\expandafter\thisrefX + \csname XR#1\endcsname + }% + \ifx\thisrefX\relax + % If not defined, say something at least. + \angleleft un\-de\-fined\angleright + \iflinks + \ifhavexrefs + \message{\linenumber Undefined cross reference `#1'.}% + \else + \ifwarnedxrefs\else + \global\warnedxrefstrue + \message{Cross reference values unknown; you must run TeX again.}% + \fi + \fi + \fi + \else + % It's defined, so just use it. + \thisrefX + \fi + #2% Output the suffix in any case. +} + +% This is the macro invoked by entries in the aux file. Usually it's +% just a \def (we prepend XR to the control sequence name to avoid +% collisions). But if this is a float type, we have more work to do. +% +\def\xrdef#1#2{% + \expandafter\gdef\csname XR#1\endcsname{#2}% remember this xref value. + % + % Was that xref control sequence that we just defined for a float? + \expandafter\iffloat\csname XR#1\endcsname + % it was a float, and we have the (safe) float type in \iffloattype. + \expandafter\let\expandafter\floatlist + \csname floatlist\iffloattype\endcsname + % + % Is this the first time we've seen this float type? + \expandafter\ifx\floatlist\relax + \toks0 = {\do}% yes, so just \do + \else + % had it before, so preserve previous elements in list. + \toks0 = \expandafter{\floatlist\do}% + \fi + % + % Remember this xref in the control sequence \floatlistFLOATTYPE, + % for later use in \listoffloats. + \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0{#1}}% + \fi +} + +% Read the last existing aux file, if any. No error if none exists. +% +\def\tryauxfile{% + \openin 1 \jobname.aux + \ifeof 1 \else + \readdatafile{aux}% + \global\havexrefstrue + \fi + \closein 1 +} + +\def\setupdatafile{% + \catcode`\^^@=\other + \catcode`\^^A=\other + \catcode`\^^B=\other + \catcode`\^^C=\other + \catcode`\^^D=\other + \catcode`\^^E=\other + \catcode`\^^F=\other + \catcode`\^^G=\other + \catcode`\^^H=\other + \catcode`\^^K=\other + \catcode`\^^L=\other + \catcode`\^^N=\other + \catcode`\^^P=\other + \catcode`\^^Q=\other + \catcode`\^^R=\other + \catcode`\^^S=\other + \catcode`\^^T=\other + \catcode`\^^U=\other + \catcode`\^^V=\other + \catcode`\^^W=\other + \catcode`\^^X=\other + \catcode`\^^Z=\other + \catcode`\^^[=\other + \catcode`\^^\=\other + \catcode`\^^]=\other + \catcode`\^^^=\other + \catcode`\^^_=\other + % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc. + % in xref tags, i.e., node names. But since ^^e4 notation isn't + % supported in the main text, it doesn't seem desirable. Furthermore, + % that is not enough: for node names that actually contain a ^ + % character, we would end up writing a line like this: 'xrdef {'hat + % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first + % argument, and \hat is not an expandable control sequence. It could + % all be worked out, but why? Either we support ^^ or we don't. + % + % The other change necessary for this was to define \auxhat: + % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter + % and then to call \auxhat in \setq. + % + \catcode`\^=\other + % + % Special characters. Should be turned off anyway, but... + \catcode`\~=\other + \catcode`\[=\other + \catcode`\]=\other + \catcode`\"=\other + \catcode`\_=\other + \catcode`\|=\other + \catcode`\<=\other + \catcode`\>=\other + \catcode`\$=\other + \catcode`\#=\other + \catcode`\&=\other + \catcode`\%=\other + \catcode`+=\other % avoid \+ for paranoia even though we've turned it off + % + % This is to support \ in node names and titles, since the \ + % characters end up in a \csname. It's easier than + % leaving it active and making its active definition an actual \ + % character. What I don't understand is why it works in the *value* + % of the xrdef. Seems like it should be a catcode12 \, and that + % should not typeset properly. But it works, so I'm moving on for + % now. --karl, 15jan04. + \catcode`\\=\other + % + % Make the characters 128-255 be printing characters. + {% + \count1=128 + \def\loop{% + \catcode\count1=\other + \advance\count1 by 1 + \ifnum \count1<256 \loop \fi + }% + }% + % + % @ is our escape character in .aux files, and we need braces. + \catcode`\{=1 + \catcode`\}=2 + \catcode`\@=0 +} + +\def\readdatafile#1{% +\begingroup + \setupdatafile + \input\jobname.#1 +\endgroup} + +\message{insertions,} +% including footnotes. + +\newcount \footnoteno + +% The trailing space in the following definition for supereject is +% vital for proper filling; pages come out unaligned when you do a +% pagealignmacro call if that space before the closing brace is +% removed. (Generally, numeric constants should always be followed by a +% space to prevent strange expansion errors.) +\def\supereject{\par\penalty -20000\footnoteno =0 } + +% @footnotestyle is meaningful for info output only. +\let\footnotestyle=\comment + +{\catcode `\@=11 +% +% Auto-number footnotes. Otherwise like plain. +\gdef\footnote{% + \let\indent=\ptexindent + \let\noindent=\ptexnoindent + \global\advance\footnoteno by \@ne + \edef\thisfootno{$^{\the\footnoteno}$}% + % + % In case the footnote comes at the end of a sentence, preserve the + % extra spacing after we do the footnote number. + \let\@sf\empty + \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi + % + % Remove inadvertent blank space before typesetting the footnote number. + \unskip + \thisfootno\@sf + \dofootnote +}% + +% Don't bother with the trickery in plain.tex to not require the +% footnote text as a parameter. Our footnotes don't need to be so general. +% +% Oh yes, they do; otherwise, @ifset (and anything else that uses +% \parseargline) fails inside footnotes because the tokens are fixed when +% the footnote is read. --karl, 16nov96. +% +\gdef\dofootnote{% + \insert\footins\bgroup + % We want to typeset this text as a normal paragraph, even if the + % footnote reference occurs in (for example) a display environment. + % So reset some parameters. + \hsize=\pagewidth + \interlinepenalty\interfootnotelinepenalty + \splittopskip\ht\strutbox % top baseline for broken footnotes + \splitmaxdepth\dp\strutbox + \floatingpenalty\@MM + \leftskip\z@skip + \rightskip\z@skip + \spaceskip\z@skip + \xspaceskip\z@skip + \parindent\defaultparindent + % + \smallfonts \rm + % + % Because we use hanging indentation in footnotes, a @noindent appears + % to exdent this text, so make it be a no-op. makeinfo does not use + % hanging indentation so @noindent can still be needed within footnote + % text after an @example or the like (not that this is good style). + \let\noindent = \relax + % + % Hang the footnote text off the number. Use \everypar in case the + % footnote extends for more than one paragraph. + \everypar = {\hang}% + \textindent{\thisfootno}% + % + % Don't crash into the line above the footnote text. Since this + % expands into a box, it must come within the paragraph, lest it + % provide a place where TeX can split the footnote. + \footstrut + \futurelet\next\fo@t +} +}%end \catcode `\@=11 + +% In case a @footnote appears in a vbox, save the footnote text and create +% the real \insert just after the vbox finished. Otherwise, the insertion +% would be lost. +% Similarily, if a @footnote appears inside an alignment, save the footnote +% text to a box and make the \insert when a row of the table is finished. +% And the same can be done for other insert classes. --kasal, 16nov03. + +% Replace the \insert primitive by a cheating macro. +% Deeper inside, just make sure that the saved insertions are not spilled +% out prematurely. +% +\def\startsavinginserts{% + \ifx \insert\ptexinsert + \let\insert\saveinsert + \else + \let\checkinserts\relax + \fi +} + +% This \insert replacement works for both \insert\footins{foo} and +% \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}. +% +\def\saveinsert#1{% + \edef\next{\noexpand\savetobox \makeSAVEname#1}% + \afterassignment\next + % swallow the left brace + \let\temp = +} +\def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}} +\def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1} + +\def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi} + +\def\placesaveins#1{% + \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname + {\box#1}% +} + +% eat @SAVE -- beware, all of them have catcode \other: +{ + \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials % ;-) + \gdef\gobblesave @SAVE{} +} + +% initialization: +\def\newsaveins #1{% + \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}% + \next +} +\def\newsaveinsX #1{% + \csname newbox\endcsname #1% + \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts + \checksaveins #1}% +} + +% initialize: +\let\checkinserts\empty +\newsaveins\footins +\newsaveins\margin + + +% @image. We use the macros from epsf.tex to support this. +% If epsf.tex is not installed and @image is used, we complain. +% +% Check for and read epsf.tex up front. If we read it only at @image +% time, we might be inside a group, and then its definitions would get +% undone and the next image would fail. +\openin 1 = epsf.tex +\ifeof 1 \else + % Do not bother showing banner with epsf.tex v2.7k (available in + % doc/epsf.tex and on ctan). + \def\epsfannounce{\toks0 = }% + \input epsf.tex +\fi +\closein 1 +% +% We will only complain once about lack of epsf.tex. +\newif\ifwarnednoepsf +\newhelp\noepsfhelp{epsf.tex must be installed for images to + work. It is also included in the Texinfo distribution, or you can get + it from ftp://tug.org/tex/epsf.tex.} +% +\def\image#1{% + \ifx\epsfbox\undefined + \ifwarnednoepsf \else + \errhelp = \noepsfhelp + \errmessage{epsf.tex not found, images will be ignored}% + \global\warnednoepsftrue + \fi + \else + \imagexxx #1,,,,,\finish + \fi +} +% +% Arguments to @image: +% #1 is (mandatory) image filename; we tack on .eps extension. +% #2 is (optional) width, #3 is (optional) height. +% #4 is (ignored optional) html alt text. +% #5 is (ignored optional) extension. +% #6 is just the usual extra ignored arg for parsing this stuff. +\newif\ifimagevmode +\def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup + \catcode`\^^M = 5 % in case we're inside an example + \normalturnoffactive % allow _ et al. in names + % If the image is by itself, center it. + \ifvmode + \imagevmodetrue + \nobreak\bigskip + % Usually we'll have text after the image which will insert + % \parskip glue, so insert it here too to equalize the space + % above and below. + \nobreak\vskip\parskip + \nobreak + \line\bgroup + \fi + % + % Output the image. + \ifpdf + \dopdfimage{#1}{#2}{#3}% + \else + % \epsfbox itself resets \epsf?size at each figure. + \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi + \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi + \epsfbox{#1.eps}% + \fi + % + \ifimagevmode \egroup \bigbreak \fi % space after the image +\endgroup} + + +% @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables, +% etc. We don't actually implement floating yet, we always include the +% float "here". But it seemed the best name for the future. +% +\envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish} + +% There may be a space before second and/or third parameter; delete it. +\def\eatcommaspace#1, {#1,} + +% #1 is the optional FLOATTYPE, the text label for this float, typically +% "Figure", "Table", "Example", etc. Can't contain commas. If omitted, +% this float will not be numbered and cannot be referred to. +% +% #2 is the optional xref label. Also must be present for the float to +% be referable. +% +% #3 is the optional positioning argument; for now, it is ignored. It +% will somehow specify the positions allowed to float to (here, top, bottom). +% +% We keep a separate counter for each FLOATTYPE, which we reset at each +% chapter-level command. +\let\resetallfloatnos=\empty +% +\def\dofloat#1,#2,#3,#4\finish{% + \let\thiscaption=\empty + \let\thisshortcaption=\empty + % + % don't lose footnotes inside @float. + % + % BEWARE: when the floats start float, we have to issue warning whenever an + % insert appears inside a float which could possibly float. --kasal, 26may04 + % + \startsavinginserts + % + % We can't be used inside a paragraph. + \par + % + \vtop\bgroup + \def\floattype{#1}% + \def\floatlabel{#2}% + \def\floatloc{#3}% we do nothing with this yet. + % + \ifx\floattype\empty + \let\safefloattype=\empty + \else + {% + % the floattype might have accents or other special characters, + % but we need to use it in a control sequence name. + \indexnofonts + \turnoffactive + \xdef\safefloattype{\floattype}% + }% + \fi + % + % If label is given but no type, we handle that as the empty type. + \ifx\floatlabel\empty \else + % We want each FLOATTYPE to be numbered separately (Figure 1, + % Table 1, Figure 2, ...). (And if no label, no number.) + % + \expandafter\getfloatno\csname\safefloattype floatno\endcsname + \global\advance\floatno by 1 + % + {% + % This magic value for \thissection is output by \setref as the + % XREFLABEL-title value. \xrefX uses it to distinguish float + % labels (which have a completely different output format) from + % node and anchor labels. And \xrdef uses it to construct the + % lists of floats. + % + \edef\thissection{\floatmagic=\safefloattype}% + \setref{\floatlabel}{Yfloat}% + }% + \fi + % + % start with \parskip glue, I guess. + \vskip\parskip + % + % Don't suppress indentation if a float happens to start a section. + \restorefirstparagraphindent +} + +% we have these possibilities: +% @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap +% @float Foo,lbl & no caption: Foo 1.1 +% @float Foo & @caption{Cap}: Foo: Cap +% @float Foo & no caption: Foo +% @float ,lbl & Caption{Cap}: 1.1: Cap +% @float ,lbl & no caption: 1.1 +% @float & @caption{Cap}: Cap +% @float & no caption: +% +\def\Efloat{% + \let\floatident = \empty + % + % In all cases, if we have a float type, it comes first. + \ifx\floattype\empty \else \def\floatident{\floattype}\fi + % + % If we have an xref label, the number comes next. + \ifx\floatlabel\empty \else + \ifx\floattype\empty \else % if also had float type, need tie first. + \appendtomacro\floatident{\tie}% + \fi + % the number. + \appendtomacro\floatident{\chaplevelprefix\the\floatno}% + \fi + % + % Start the printed caption with what we've constructed in + % \floatident, but keep it separate; we need \floatident again. + \let\captionline = \floatident + % + \ifx\thiscaption\empty \else + \ifx\floatident\empty \else + \appendtomacro\captionline{: }% had ident, so need a colon between + \fi + % + % caption text. + \appendtomacro\captionline{\scanexp\thiscaption}% + \fi + % + % If we have anything to print, print it, with space before. + % Eventually this needs to become an \insert. + \ifx\captionline\empty \else + \vskip.5\parskip + \captionline + % + % Space below caption. + \vskip\parskip + \fi + % + % If have an xref label, write the list of floats info. Do this + % after the caption, to avoid chance of it being a breakpoint. + \ifx\floatlabel\empty \else + % Write the text that goes in the lof to the aux file as + % \floatlabel-lof. Besides \floatident, we include the short + % caption if specified, else the full caption if specified, else nothing. + {% + \atdummies + % + % since we read the caption text in the macro world, where ^^M + % is turned into a normal character, we have to scan it back, so + % we don't write the literal three characters "^^M" into the aux file. + \scanexp{% + \xdef\noexpand\gtemp{% + \ifx\thisshortcaption\empty + \thiscaption + \else + \thisshortcaption + \fi + }% + }% + \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident + \ifx\gtemp\empty \else : \gtemp \fi}}% + }% + \fi + \egroup % end of \vtop + % + % place the captured inserts + % + % BEWARE: when the floats start floating, we have to issue warning + % whenever an insert appears inside a float which could possibly + % float. --kasal, 26may04 + % + \checkinserts +} + +% Append the tokens #2 to the definition of macro #1, not expanding either. +% +\def\appendtomacro#1#2{% + \expandafter\def\expandafter#1\expandafter{#1#2}% +} + +% @caption, @shortcaption +% +\def\caption{\docaption\thiscaption} +\def\shortcaption{\docaption\thisshortcaption} +\def\docaption{\checkenv\float \bgroup\scanargctxt\defcaption} +\def\defcaption#1#2{\egroup \def#1{#2}} + +% The parameter is the control sequence identifying the counter we are +% going to use. Create it if it doesn't exist and assign it to \floatno. +\def\getfloatno#1{% + \ifx#1\relax + % Haven't seen this figure type before. + \csname newcount\endcsname #1% + % + % Remember to reset this floatno at the next chap. + \expandafter\gdef\expandafter\resetallfloatnos + \expandafter{\resetallfloatnos #1=0 }% + \fi + \let\floatno#1% +} + +% \setref calls this to get the XREFLABEL-snt value. We want an @xref +% to the FLOATLABEL to expand to "Figure 3.1". We call \setref when we +% first read the @float command. +% +\def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}% + +% Magic string used for the XREFLABEL-title value, so \xrefX can +% distinguish floats from other xref types. +\def\floatmagic{!!float!!} + +% #1 is the control sequence we are passed; we expand into a conditional +% which is true if #1 represents a float ref. That is, the magic +% \thissection value which we \setref above. +% +\def\iffloat#1{\expandafter\doiffloat#1==\finish} +% +% #1 is (maybe) the \floatmagic string. If so, #2 will be the +% (safe) float type for this float. We set \iffloattype to #2. +% +\def\doiffloat#1=#2=#3\finish{% + \def\temp{#1}% + \def\iffloattype{#2}% + \ifx\temp\floatmagic +} + +% @listoffloats FLOATTYPE - print a list of floats like a table of contents. +% +\parseargdef\listoffloats{% + \def\floattype{#1}% floattype + {% + % the floattype might have accents or other special characters, + % but we need to use it in a control sequence name. + \indexnofonts + \turnoffactive + \xdef\safefloattype{\floattype}% + }% + % + % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE. + \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax + \ifhavexrefs + % if the user said @listoffloats foo but never @float foo. + \message{\linenumber No `\safefloattype' floats to list.}% + \fi + \else + \begingroup + \leftskip=\tocindent % indent these entries like a toc + \let\do=\listoffloatsdo + \csname floatlist\safefloattype\endcsname + \endgroup + \fi +} + +% This is called on each entry in a list of floats. We're passed the +% xref label, in the form LABEL-title, which is how we save it in the +% aux file. We strip off the -title and look up \XRLABEL-lof, which +% has the text we're supposed to typeset here. +% +% Figures without xref labels will not be included in the list (since +% they won't appear in the aux file). +% +\def\listoffloatsdo#1{\listoffloatsdoentry#1\finish} +\def\listoffloatsdoentry#1-title\finish{{% + % Can't fully expand XR#1-lof because it can contain anything. Just + % pass the control sequence. On the other hand, XR#1-pg is just the + % page number, and we want to fully expand that so we can get a link + % in pdf output. + \toksA = \expandafter{\csname XR#1-lof\endcsname}% + % + % use the same \entry macro we use to generate the TOC and index. + \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}% + \writeentry +}} + +\message{localization,} +% and i18n. + +% @documentlanguage is usually given very early, just after +% @setfilename. If done too late, it may not override everything +% properly. Single argument is the language abbreviation. +% It would be nice if we could set up a hyphenation file here. +% +\parseargdef\documentlanguage{% + \tex % read txi-??.tex file in plain TeX. + % Read the file if it exists. + \openin 1 txi-#1.tex + \ifeof 1 + \errhelp = \nolanghelp + \errmessage{Cannot read language file txi-#1.tex}% + \else + \input txi-#1.tex + \fi + \closein 1 + \endgroup +} +\newhelp\nolanghelp{The given language definition file cannot be found or +is empty. Maybe you need to install it? In the current directory +should work if nowhere else does.} + + +% @documentencoding should change something in TeX eventually, most +% likely, but for now just recognize it. +\let\documentencoding = \comment + + +% Page size parameters. +% +\newdimen\defaultparindent \defaultparindent = 15pt + +\chapheadingskip = 15pt plus 4pt minus 2pt +\secheadingskip = 12pt plus 3pt minus 2pt +\subsecheadingskip = 9pt plus 2pt minus 2pt + +% Prevent underfull vbox error messages. +\vbadness = 10000 + +% Don't be so finicky about underfull hboxes, either. +\hbadness = 2000 + +% Following George Bush, just get rid of widows and orphans. +\widowpenalty=10000 +\clubpenalty=10000 + +% Use TeX 3.0's \emergencystretch to help line breaking, but if we're +% using an old version of TeX, don't do anything. We want the amount of +% stretch added to depend on the line length, hence the dependence on +% \hsize. We call this whenever the paper size is set. +% +\def\setemergencystretch{% + \ifx\emergencystretch\thisisundefined + % Allow us to assign to \emergencystretch anyway. + \def\emergencystretch{\dimen0}% + \else + \emergencystretch = .15\hsize + \fi +} + +% Parameters in order: 1) textheight; 2) textwidth; +% 3) voffset; 4) hoffset; 5) binding offset; 6) topskip; +% 7) physical page height; 8) physical page width. +% +% We also call \setleading{\textleading}, so the caller should define +% \textleading. The caller should also set \parskip. +% +\def\internalpagesizes#1#2#3#4#5#6#7#8{% + \voffset = #3\relax + \topskip = #6\relax + \splittopskip = \topskip + % + \vsize = #1\relax + \advance\vsize by \topskip + \outervsize = \vsize + \advance\outervsize by 2\topandbottommargin + \pageheight = \vsize + % + \hsize = #2\relax + \outerhsize = \hsize + \advance\outerhsize by 0.5in + \pagewidth = \hsize + % + \normaloffset = #4\relax + \bindingoffset = #5\relax + % + \ifpdf + \pdfpageheight #7\relax + \pdfpagewidth #8\relax + \fi + % + \setleading{\textleading} + % + \parindent = \defaultparindent + \setemergencystretch +} + +% @letterpaper (the default). +\def\letterpaper{{\globaldefs = 1 + \parskip = 3pt plus 2pt minus 1pt + \textleading = 13.2pt + % + % If page is nothing but text, make it come out even. + \internalpagesizes{46\baselineskip}{6in}% + {\voffset}{.25in}% + {\bindingoffset}{36pt}% + {11in}{8.5in}% +}} + +% Use @smallbook to reset parameters for 7x9.25 trim size. +\def\smallbook{{\globaldefs = 1 + \parskip = 2pt plus 1pt + \textleading = 12pt + % + \internalpagesizes{7.5in}{5in}% + {\voffset}{.25in}% + {\bindingoffset}{16pt}% + {9.25in}{7in}% + % + \lispnarrowing = 0.3in + \tolerance = 700 + \hfuzz = 1pt + \contentsrightmargin = 0pt + \defbodyindent = .5cm +}} + +% Use @smallerbook to reset parameters for 6x9 trim size. +% (Just testing, parameters still in flux.) +\def\smallerbook{{\globaldefs = 1 + \parskip = 1.5pt plus 1pt + \textleading = 12pt + % + \internalpagesizes{7.4in}{4.8in}% + {-.2in}{-.4in}% + {0pt}{14pt}% + {9in}{6in}% + % + \lispnarrowing = 0.25in + \tolerance = 700 + \hfuzz = 1pt + \contentsrightmargin = 0pt + \defbodyindent = .4cm +}} + +% Use @afourpaper to print on European A4 paper. +\def\afourpaper{{\globaldefs = 1 + \parskip = 3pt plus 2pt minus 1pt + \textleading = 13.2pt + % + % Double-side printing via postscript on Laserjet 4050 + % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm. + % To change the settings for a different printer or situation, adjust + % \normaloffset until the front-side and back-side texts align. Then + % do the same for \bindingoffset. You can set these for testing in + % your texinfo source file like this: + % @tex + % \global\normaloffset = -6mm + % \global\bindingoffset = 10mm + % @end tex + \internalpagesizes{51\baselineskip}{160mm} + {\voffset}{\hoffset}% + {\bindingoffset}{44pt}% + {297mm}{210mm}% + % + \tolerance = 700 + \hfuzz = 1pt + \contentsrightmargin = 0pt + \defbodyindent = 5mm +}} + +% Use @afivepaper to print on European A5 paper. +% From romildo@urano.iceb.ufop.br, 2 July 2000. +% He also recommends making @example and @lisp be small. +\def\afivepaper{{\globaldefs = 1 + \parskip = 2pt plus 1pt minus 0.1pt + \textleading = 12.5pt + % + \internalpagesizes{160mm}{120mm}% + {\voffset}{\hoffset}% + {\bindingoffset}{8pt}% + {210mm}{148mm}% + % + \lispnarrowing = 0.2in + \tolerance = 800 + \hfuzz = 1.2pt + \contentsrightmargin = 0pt + \defbodyindent = 2mm + \tableindent = 12mm +}} + +% A specific text layout, 24x15cm overall, intended for A4 paper. +\def\afourlatex{{\globaldefs = 1 + \afourpaper + \internalpagesizes{237mm}{150mm}% + {\voffset}{4.6mm}% + {\bindingoffset}{7mm}% + {297mm}{210mm}% + % + % Must explicitly reset to 0 because we call \afourpaper. + \globaldefs = 0 +}} + +% Use @afourwide to print on A4 paper in landscape format. +\def\afourwide{{\globaldefs = 1 + \afourpaper + \internalpagesizes{241mm}{165mm}% + {\voffset}{-2.95mm}% + {\bindingoffset}{7mm}% + {297mm}{210mm}% + \globaldefs = 0 +}} + +% @pagesizes TEXTHEIGHT[,TEXTWIDTH] +% Perhaps we should allow setting the margins, \topskip, \parskip, +% and/or leading, also. Or perhaps we should compute them somehow. +% +\parseargdef\pagesizes{\pagesizesyyy #1,,\finish} +\def\pagesizesyyy#1,#2,#3\finish{{% + \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi + \globaldefs = 1 + % + \parskip = 3pt plus 2pt minus 1pt + \setleading{\textleading}% + % + \dimen0 = #1 + \advance\dimen0 by \voffset + % + \dimen2 = \hsize + \advance\dimen2 by \normaloffset + % + \internalpagesizes{#1}{\hsize}% + {\voffset}{\normaloffset}% + {\bindingoffset}{44pt}% + {\dimen0}{\dimen2}% +}} + +% Set default to letter. +% +\letterpaper + + +\message{and turning on texinfo input format.} + +% Define macros to output various characters with catcode for normal text. +\catcode`\"=\other +\catcode`\~=\other +\catcode`\^=\other +\catcode`\_=\other +\catcode`\|=\other +\catcode`\<=\other +\catcode`\>=\other +\catcode`\+=\other +\catcode`\$=\other +\def\normaldoublequote{"} +\def\normaltilde{~} +\def\normalcaret{^} +\def\normalunderscore{_} +\def\normalverticalbar{|} +\def\normalless{<} +\def\normalgreater{>} +\def\normalplus{+} +\def\normaldollar{$}%$ font-lock fix + +% This macro is used to make a character print one way in \tt +% (where it can probably be output as-is), and another way in other fonts, +% where something hairier probably needs to be done. +% +% #1 is what to print if we are indeed using \tt; #2 is what to print +% otherwise. Since all the Computer Modern typewriter fonts have zero +% interword stretch (and shrink), and it is reasonable to expect all +% typewriter fonts to have this, we can check that font parameter. +% +\def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi} + +% Same as above, but check for italic font. Actually this also catches +% non-italic slanted fonts since it is impossible to distinguish them from +% italic fonts. But since this is only used by $ and it uses \sl anyway +% this is not a problem. +\def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi} + +% Turn off all special characters except @ +% (and those which the user can use as if they were ordinary). +% Most of these we simply print from the \tt font, but for some, we can +% use math or other variants that look better in normal text. + +\catcode`\"=\active +\def\activedoublequote{{\tt\char34}} +\let"=\activedoublequote +\catcode`\~=\active +\def~{{\tt\char126}} +\chardef\hat=`\^ +\catcode`\^=\active +\def^{{\tt \hat}} + +\catcode`\_=\active +\def_{\ifusingtt\normalunderscore\_} +\let\realunder=_ +% Subroutine for the previous macro. +\def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em } + +\catcode`\|=\active +\def|{{\tt\char124}} +\chardef \less=`\< +\catcode`\<=\active +\def<{{\tt \less}} +\chardef \gtr=`\> +\catcode`\>=\active +\def>{{\tt \gtr}} +\catcode`\+=\active +\def+{{\tt \char 43}} +\catcode`\$=\active +\def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix + +% If a .fmt file is being used, characters that might appear in a file +% name cannot be active until we have parsed the command line. +% So turn them off again, and have \everyjob (or @setfilename) turn them on. +% \otherifyactive is called near the end of this file. +\def\otherifyactive{\catcode`+=\other \catcode`\_=\other} + +% Used sometimes to turn off (effectively) the active characters even after +% parsing them. +\def\turnoffactive{% + \normalturnoffactive + \otherbackslash +} + +\catcode`\@=0 + +% \backslashcurfont outputs one backslash character in current font, +% as in \char`\\. +\global\chardef\backslashcurfont=`\\ +\global\let\rawbackslashxx=\backslashcurfont % let existing .??s files work + +% \realbackslash is an actual character `\' with catcode other, and +% \doublebackslash is two of them (for the pdf outlines). +{\catcode`\\=\other @gdef@realbackslash{\} @gdef@doublebackslash{\\}} + +% In texinfo, backslash is an active character; it prints the backslash +% in fixed width font. +\catcode`\\=\active +@def@normalbackslash{{@tt@backslashcurfont}} +% On startup, @fixbackslash assigns: +% @let \ = @normalbackslash + +% \rawbackslash defines an active \ to do \backslashcurfont. +% \otherbackslash defines an active \ to be a literal `\' character with +% catcode other. +@gdef@rawbackslash{@let\=@backslashcurfont} +@gdef@otherbackslash{@let\=@realbackslash} + +% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of +% the literal character `\'. +% +@def@normalturnoffactive{% + @let\=@normalbackslash + @let"=@normaldoublequote + @let~=@normaltilde + @let^=@normalcaret + @let_=@normalunderscore + @let|=@normalverticalbar + @let<=@normalless + @let>=@normalgreater + @let+=@normalplus + @let$=@normaldollar %$ font-lock fix + @unsepspaces +} + +% Make _ and + \other characters, temporarily. +% This is canceled by @fixbackslash. +@otherifyactive + +% If a .fmt file is being used, we don't want the `\input texinfo' to show up. +% That is what \eatinput is for; after that, the `\' should revert to printing +% a backslash. +% +@gdef@eatinput input texinfo{@fixbackslash} +@global@let\ = @eatinput + +% On the other hand, perhaps the file did not have a `\input texinfo'. Then +% the first `\' in the file would cause an error. This macro tries to fix +% that, assuming it is called before the first `\' could plausibly occur. +% Also turn back on active characters that might appear in the input +% file name, in case not using a pre-dumped format. +% +@gdef@fixbackslash{% + @ifx\@eatinput @let\ = @normalbackslash @fi + @catcode`+=@active + @catcode`@_=@active +} + +% Say @foo, not \foo, in error messages. +@escapechar = `@@ + +% These look ok in all fonts, so just make them not special. +@catcode`@& = @other +@catcode`@# = @other +@catcode`@% = @other + + +@c Local variables: +@c eval: (add-hook 'write-file-hooks 'time-stamp) +@c page-delimiter: "^\\\\message" +@c time-stamp-start: "def\\\\texinfoversion{" +@c time-stamp-format: "%:y-%02m-%02d.%02H" +@c time-stamp-end: "}" +@c End: + +@c vim:sw=2: + +@ignore + arch-tag: e1b36e32-c96e-4135-a41a-0b2efa2ea115 +@end ignore diff --git a/grep.spec b/grep.spec new file mode 100644 index 0000000..89875c4 --- /dev/null +++ b/grep.spec @@ -0,0 +1,76 @@ +%define beta %nil +%define rel 1 +Summary: The GNU versions of grep pattern matching utilities. +Name: grep +Version: 2.5.2 +%if "%{beta}" != "" +Release: 0.%{beta}.%{rel}ark +%else +Release: %{rel}ark +%endif +License: GPL +Group: Applications/Text +Source: ftp://ftp.gnu.org/pub/gnu/grep/grep-%{version}%{beta}.tar.lz +Prereq: /sbin/install-info +Buildroot: %{_tmppath}/%{name}-%{version}-root +Requires: pcre +Buildrequires: pcre-devel + +%description +The GNU versions of commonly used grep utilities. Grep searches +through textual input for lines which contain a match to a specified +pattern and then prints the matching lines. GNU's grep utilities +include grep, egrep and fgrep. + +You should install grep on your system, because it is a very useful +utility for searching through text. + +%prep +%setup -q -n %{name}-%{version}%{beta} + +%build +[ ! -e configure ] && ./autogen.sh +%configure --without-included-regex +make %?_smp_mflags + +%install +rm -rf ${RPM_BUILD_ROOT} +#makeinstall LDFLAGS=-s prefix=${RPM_BUILD_ROOT}%{_prefix} exec_prefix=${RPM_BUILD_ROOT} +make install DESTDIR="$RPM_BUILD_ROOT" +%ifos Linux +mkdir -p $RPM_BUILD_ROOT/bin +mv $RPM_BUILD_ROOT%{_bindir}/* $RPM_BUILD_ROOT/bin +rm -rf $RPM_BUILD_ROOT%{_bindir} +%endif + +%find_lang %name + +%clean +rm -rf ${RPM_BUILD_ROOT} + +%post +[ -e %{_infodir}/grep.info.* ] && /sbin/install-info --quiet --info-dir=%{_infodir} %{_infodir}/grep.info.* || : + +%preun +if [ $1 = 0 ]; then + [ -e %{_infodir}/grep.info.* ] && /sbin/install-info --quiet --info-dir=%{_infodir} --delete %{_infodir}/grep.info.* +fi + +%files -f %{name}.lang +%defattr(-,root,root) +%doc ABOUT-NLS AUTHORS THANKS TODO NEWS README ChangeLog + +%ifos Linux +/bin/* +%else +%{_bindir}/* +%endif +%{_infodir}/*.info* +%{_mandir}/*/* + +%changelog +* Sat Nov 25 2006 Bernhard Rosenkraenzer 2.5.2-1ark +- 2.5.2 + +* Mon Nov 29 2004 Bernhard Rosenkraenzer 2.5.1a-1ark +- 2.5.1a diff --git a/install-sh b/install-sh new file mode 100755 index 0000000..4fbbae7 --- /dev/null +++ b/install-sh @@ -0,0 +1,507 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2006-10-14.15 + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. + +nl=' +' +IFS=" "" $nl" + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" +if test -z "$doit"; then + doit_exec=exec +else + doit_exec=$doit +fi + +# Put in absolute file names if you don't have them in your path; +# or use environment vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +posix_glob= +posix_mkdir= + +# Desired mode of installed file. +mode=0755 + +chmodcmd=$chmodprog +chowncmd= +chgrpcmd= +stripcmd= +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src= +dst= +dir_arg= +dstarg= +no_target_directory= + +usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: +-c (ignored) +-d create directories instead of installing files. +-g GROUP $chgrpprog installed files to GROUP. +-m MODE $chmodprog installed files to MODE. +-o USER $chownprog installed files to USER. +-s $stripprog installed files. +-t DIRECTORY install into DIRECTORY. +-T report an error if DSTFILE is a directory. +--help display this help and exit. +--version display version info and exit. + +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG +" + +while test $# -ne 0; do + case $1 in + -c) shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + --help) echo "$usage"; exit $?;; + + -m) mode=$2 + shift + shift + case $mode in + *' '* | *' '* | *' +'* | *'*'* | *'?'* | *'['*) + echo "$0: invalid mode: $mode" >&2 + exit 1;; + esac + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -s) stripcmd=$stripprog + shift + continue;; + + -t) dstarg=$2 + shift + shift + continue;; + + -T) no_target_directory=true + shift + continue;; + + --version) echo "$0 $scriptversion"; exit $?;; + + --) shift + break;; + + -*) echo "$0: invalid option: $1" >&2 + exit 1;; + + *) break;; + esac +done + +if test $# -ne 0 && test -z "$dir_arg$dstarg"; then + # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dstarg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dstarg" + shift # fnord + fi + shift # arg + dstarg=$arg + done +fi + +if test $# -eq 0; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call `install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +if test -z "$dir_arg"; then + trap '(exit $?); exit' 1 2 13 15 + + # Set umask so as not to create temps with too-generous modes. + # However, 'strip' requires both read and write access to temps. + case $mode in + # Optimize common cases. + *644) cp_umask=133;; + *755) cp_umask=22;; + + *[0-7]) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw='% 200' + fi + cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; + *) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw=,u+rw + fi + cp_umask=$mode$u_plus_rw;; + esac +fi + +for src +do + # Protect names starting with `-'. + case $src in + -*) src=./$src ;; + esac + + if test -n "$dir_arg"; then + dst=$src + dstdir=$dst + test -d "$dstdir" + dstdir_status=$? + else + + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dstarg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + + dst=$dstarg + # Protect names starting with `-'. + case $dst in + -*) dst=./$dst ;; + esac + + # If destination is a directory, append the input filename; won't work + # if double slashes aren't ignored. + if test -d "$dst"; then + if test -n "$no_target_directory"; then + echo "$0: $dstarg: Is a directory" >&2 + exit 1 + fi + dstdir=$dst + dst=$dstdir/`basename "$src"` + dstdir_status=0 + else + # Prefer dirname, but fall back on a substitute if dirname fails. + dstdir=` + (dirname "$dst") 2>/dev/null || + expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$dst" : 'X\(//\)[^/]' \| \ + X"$dst" : 'X\(//\)$' \| \ + X"$dst" : 'X\(/\)' \| . 2>/dev/null || + echo X"$dst" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q' + ` + + test -d "$dstdir" + dstdir_status=$? + fi + fi + + obsolete_mkdir_used=false + + if test $dstdir_status != 0; then + case $posix_mkdir in + '') + # Create intermediate dirs using mode 755 as modified by the umask. + # This is like FreeBSD 'install' as of 1997-10-28. + umask=`umask` + case $stripcmd.$umask in + # Optimize common cases. + *[2367][2367]) mkdir_umask=$umask;; + .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; + + *[0-7]) + mkdir_umask=`expr $umask + 22 \ + - $umask % 100 % 40 + $umask % 20 \ + - $umask % 10 % 4 + $umask % 2 + `;; + *) mkdir_umask=$umask,go-w;; + esac + + # With -d, create the new directory with the user-specified mode. + # Otherwise, rely on $mkdir_umask. + if test -n "$dir_arg"; then + mkdir_mode=-m$mode + else + mkdir_mode= + fi + + posix_mkdir=false + case $umask in + *[123567][0-7][0-7]) + # POSIX mkdir -p sets u+wx bits regardless of umask, which + # is incompatible with FreeBSD 'install' when (umask & 300) != 0. + ;; + *) + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 + + if (umask $mkdir_umask && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writeable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + ls_ld_tmpdir=`ls -ld "$tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/d" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null + fi + trap '' 0;; + esac;; + esac + + if + $posix_mkdir && ( + umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" + ) + then : + else + + # The umask is ridiculous, or mkdir does not conform to POSIX, + # or it failed possibly due to a race condition. Create the + # directory the slow way, step by step, checking for races as we go. + + case $dstdir in + /*) prefix=/ ;; + -*) prefix=./ ;; + *) prefix= ;; + esac + + case $posix_glob in + '') + if (set -f) 2>/dev/null; then + posix_glob=true + else + posix_glob=false + fi ;; + esac + + oIFS=$IFS + IFS=/ + $posix_glob && set -f + set fnord $dstdir + shift + $posix_glob && set +f + IFS=$oIFS + + prefixes= + + for d + do + test -z "$d" && continue + + prefix=$prefix$d + if test -d "$prefix"; then + prefixes= + else + if $posix_mkdir; then + (umask=$mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break + # Don't fail if two instances are running concurrently. + test -d "$prefix" || exit 1 + else + case $prefix in + *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; + *) qprefix=$prefix;; + esac + prefixes="$prefixes '$qprefix'" + fi + fi + prefix=$prefix/ + done + + if test -n "$prefixes"; then + # Don't fail if two instances are running concurrently. + (umask $mkdir_umask && + eval "\$doit_exec \$mkdirprog $prefixes") || + test -d "$dstdir" || exit 1 + obsolete_mkdir_used=true + fi + fi + fi + + if test -n "$dir_arg"; then + { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && + { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || + test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 + else + + # Make a couple of temp file names in the proper directory. + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + + # Copy the file name to the temp name. + (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && + + # and set any options; do chmod last to preserve setuid bits. + # + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ + && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ + && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ + && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && + + # Now rename the file to the real destination. + { $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null \ + || { + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + if test -f "$dst"; then + $doit $rmcmd -f "$dst" 2>/dev/null \ + || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null \ + && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }; }\ + || { + echo "$0: cannot unlink or rename $dst" >&2 + (exit 1); exit 1 + } + else + : + fi + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dst" + } + } || exit 1 + + trap '' 0 + fi +done + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/intl/.cvsignore b/intl/.cvsignore new file mode 100644 index 0000000..f3c7a7c --- /dev/null +++ b/intl/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/intl/ChangeLog b/intl/ChangeLog new file mode 100644 index 0000000..46c011b --- /dev/null +++ b/intl/ChangeLog @@ -0,0 +1,2030 @@ +2002-01-31 Bruno Haible + + * gettext-0.11 released. + +2002-01-31 Bruno Haible + + * eval-plural.h: Renamed from plural-eval.c. + * dcigettext.c: Include eval-plural.h instead of plural-eval.c. + * Makefile.in (COMHDRS): Remove plural-eval.c, add eval-plural.h. + (DISTFILES.obsolete): Add plural-eval.c. + +2002-01-24 Bruno Haible + + * Makefile.in (libintl.la): Use @LTLIBICONV@ instead of @LIBICONV@. + +2002-01-10 Andrew Zabolotny + Bruno Haible + + * dcigettext.c (_nl_default_dirname): On OS/2, declare, not define. + * localcharset.c: Rework OS/2 support. + * config.charset: Add OS/2 support. + * os2compat.c: Renamed from os2.c. + (_nl_default_dirname): Define here. + * os2compat.h: Moved here from ../os2/. + * osdep.c: Update. + * Makefile.in (COMHDRS): Add os2compat.h. + (COMSRCS): Add os2compat.c, remove os2.c. + +2002-01-05 Bruno Haible + + * Makefile.in (libintl.la): Add -lc. Needed on AIX. + +2002-01-02 Bruno Haible + + * loadmsgcat.c (_nl_init_domain_conv): Convert extern declaration to + K&R syntax. + +2002-01-02 Bruno Haible + + * plural.y: Fix %expect count. + +2001-12-23 Bruno Haible + + * os2.c (os2_initialize): Use LOCALEDIR_MAX macro. + +2001-12-21 Bruno Haible + + * localcharset.c (ISSLASH): Provide definition for DOS-like systems. + +2001-12-21 Bruno Haible + + * libgettext.h: Moved to ../lib/gettext.h. + * Makefile.in (HEADERS): Remove libgettext.h. + (DISTFILES.obsolete): Add libgettext.h. + +2001-12-21 Bruno Haible + + * gmo.h: Renamed from gettext.h. + * gettext.h: Remove file. + * gettextP.h: Update accordingly. + * loadmsgcat.c: Likewise. + * Makefile.in (COMHDRS): Add gmo.h, remove gettext.h. + (DISTFILES.obsolete): Add gettext.h. + Update dependencies. + +2001-12-18 Bruno Haible + + * Makefile.in (LTV_CURRENT, LTV_REVISION, LTV_AGE): Bump to 2:0:0. + Used to force an soname of at least libintl.so.2 on Solaris, which + already has a different libintl.so.1 in /usr/lib. + +2001-12-15 Andrew Zabolotny + Bruno Haible + + * osdep.c: New file. + * os2.c: New file. + * dcigettext.c (DCIGETTEXT): Add backward compatibility support for + OS/2. + * localcharset.c: Add OS/2 support. + * localealias.c (_nl_expand_alias): Initialize locale_alias_path once, + but not statically. + * Makefile.in (COMSRCS): Add osdep.c, os2.c. + (OBJECTS): Add osdep.$lo. + +2001-12-12 Bruno Haible + + * libgettext.h [!ENABLE_NLS]: Cast all function results to + 'const char *'. + Reported by Alexandre Duret-Lutz . + +2001-12-03 Bruno Haible + + * Makefile.in (install-exec): Don't create an empty libdir. + (installdirs): Update accordingly. + +2001-11-30 Bruno Haible + + * plural-exp.h (plural_eval): Add back declaration. + * Makefile.in (OBJECTS): Remove plural-eval.$lo. + (COMSRCS): Remove plural-eval.c. + (COMHDRS): Add plural-eval.c. + (plural-eval.$lo): Remove dependency. + (dcigettext.$lo): Depend on plural-eval.c. + +2001-11-29 Bruno Haible + + * gettextP.h (_nl_locale_name): Don't declare inside glibc. + * localename.c (_nl_locale_name): Remove _LIBC conditional. + +2001-11-27 Ulrich Drepper + + * dcigettext.c (guess_category_value): Inside glibc, use setlocale + directly, not _nl_locale_name. + +2001-11-27 Ulrich Drepper + + * loadmsgcat.c (_nl_init_domain_conv): Modify #if expression. + +2001-11-27 Ulrich Drepper + + * plural-eval.c (plural_eval): Rename back from PLURAL_EVAL. + * plural-exp.h (PLURAL_EVAL): Remove declaration. + * dcigettext.c Include plural-eval.c. + (plural_lookup): Call plural_eval instead of PLURAL_EVAL. + +2001-11-22 Bruno Haible + + * plural-exp.h (GERMANIC_PLURAL): New declaration. + * plural-exp.c (GERMANIC_PLURAL): Renamed from germanic_plural. + * loadmsgcat.c (_nl_unload_domain): Update. + +2001-07-17 Ulrich Drepper + + * localealias.c (read_alias_file): Disable implicit locking + for the stream. Use _unlocked functions for glibc. + +2001-11-11 Bruno Haible + + * Makefile.in (dist): Avoid using hard links, because the automake-1.5 + generated toplevel 'distdir' target chmods all the distributed files. + +2001-11-10 Bruno Haible + + * libgnuintl.h (_INTL_PARAMS): Renamed from PARAMS, to avoid polluting + the user's namespace. + Also test for __GNUC__, __SUNPRO_C and __PROTOTYPES because on + 64-bit Solaris, we need prototypes although __STDC__ is often defined + to 0. __GNUC__ covers GCC, __SUNPRO_C covers Sun cc, regardless of + compilation flags. __PROTOTYPES covers other compilers when compiling + programs using autoconf's AC_C_PROTOTYPES. + * gettextP.h (PARAMS): Also test for __SUNPRO_C, because 64-bit Solaris + cc needs prototypes although it defines __STDC__ to 0 by default. + Also test for __cplusplus and __PROTOTYPES, just for consistency with + libgnuintl.h. + * hash-string.h (PARAMS): Likewise. + * loadinfo.h (PARAMS): Likewise. + * plural-exp.h (PARAMS): Likewise. + +2001-10-31 Bruno Haible + + * plural.y: Include , needed for NULL with SunOS 4 cc. + +2001-10-31 Bruno Haible + + * COPYING.LIB-2.0: Renamed from COPYING.LIB-2. + * Makefile.in (DISTFILES.gettext, install-data, uninstall): Update. + (DISTFILES.obsolete): Add COPYING.LIB-2. + +2001-10-09 Bruno Haible + + * localcharset.c (getc): Define as getc_unlocked if available. + +2001-09-27 Bruno Haible + + * Makefile.in (install-strip, installdirs): New rules. + +2001-09-24 Bruno Haible + + * localename.c: New file, integrating a function from + Tor Lillqvist . + * gettextP.h: New declaration. + * dcigettext.c (guess_category_value): Call _nl_locale_name. + * Makefile.in (COMSRCS): Add localename.c. + (OBJECTS): Add localename.$lo. + +2001-09-22 Bruno Haible + + * plural-eval.c: New file, extracted from dcigettext.c. + * plural-exp.h (PLURAL_EVAL): New declaration. + * dcigettext.c (plural_eval): Remove function, moved to plural-eval.c. + (plural_lookup): Call PLURAL_EVAL instead of plural_eval. + * Makefile.in (COMSRCS): Add plural-eval.c. + (OBJECTS): Add plural-eval.$lo. + +2001-09-22 Bruno Haible + + * plural-exp.c (EXTRACT_PLURAL_EXPRESSION): Reject numbers that don't + start with a digit; nplurals must be positive. + +2001-10-20 Bruno Haible + + Assume strchr() exists. (Without it, explodename.c wouldn't link + anyway.) + * dcigettext.c (strchr): Remove fallback definition; it conflicts with + the variable 'index' in plural_lookup. + * l10nflist.c (strchr): Likewise. + * localealias.c (strchr): Likewise. + +2001-09-24 Bruno Haible + + * loadmsgcat.c (_nl_init_domain_conv): Also enable transliteration + when building on a glibc system but outside glibc. + +2001-09-02 Bruno Haible + + * plural-exp.h: New file, extracted from gettextP.h. + * plural-exp.c: New file, extracted from loadmsgcat.c. + * gettextP.h (struct expression, struct parse_args, + __gettext_free_exp, __gettextparse): Move to plural-exp.h. + * loadmsgcat.c: Include plural-exp.h. + (PLURAL_PARSE): Move macro to plural-exp.h. + (plvar, plone, germanic_plural, INIT_GERMANIC_PLURAL): Move to + plural-exp.c. + (_nl_load_domain): Move plural handling code to plural-exp.c. Call + EXTRACT_PLURAL_EXPRESSION. + * dcigettext.c: Include plural-exp.h. + * plural.y: Include plural-exp.h, not gettextP.h. + (FREE_EXPRESSION): Move macro to plural-exp.h. + * Makefile.in (DEFS): Define IN_LIBINTL. + (COMHDRS): Add plural-exp.h. + (COMSRCS): Add plural-exp.c. + (OBJECTS): Add plural-exp.$lo. + Update dependencies. + +2001-07-28 Bruno Haible + + * l10nflist.c (_nl_normalize_codeset): Cast isalnum, isalpha, isdigit, + tolower argument to 'unsigned char'. + * loadmsgcat.c (_nl_load_domain): Cast isspace argument to + 'unsigned char'. + * localealias.c (read_alias_file): Cast isspace argument to + 'unsigned char'. + +2001-07-23 Bruno Haible + + * gettext.h: Assume exists. + +2001-09-13 Bruno Haible + + * gettext-0.10.40 released. + +2001-07-11 Ulrich Drepper + + * locale.alias: Use he language code for hebrew, not iw. + +2001-09-13 Bruno Haible + + * *.h, *.c, *.y, Makefile.in: Change copyright notice from GPL to LGPL. + This is a reaction to a blackmail from the GNOME project which + threatened to distribute an LGPLed clone of libintl. + * COPYING.LIB-2, COPYING.LIB-2.1: New files. + * Makefile.in (DISTFILES.gettext): Add them. + (install-data): Install them. + (uninstall): Uninstall them. + +2001-07-24 Bruno Haible + + * gettext-0.10.39 released. + +2001-06-24 Bruno Haible + + * config.charset: Change canonical name of BIG5HKSCS to BIG5-HKSCS. + Change canonical name of SJIS to SHIFT_JIS. + +2001-06-12 Bruno Haible + + * dcigettext.c (DCIGETTEXT): Release the lock before returning. + +2001-04-30 Bruno Haible + + Silence "gcc -Wall -Wwrite-strings" warnings. + * localcharset.c (charset_aliases): Change type to 'const char *'. + (get_charset_aliases): Change type of 'cp' to 'const char *'. + +2001-05-23 Bruno Haible + + * gettext-0.10.38 released. + +2001-05-22 Bruno Haible + + * Makefile.in (install-data): Install plural.c as well. + (uninstall): Uninstall plural.c as well. + +2001-05-18 Bruno Haible + + * Makefile.in (dist): Don't assume $(srcdir) = ".". Distribute + file in either current directory or $(srcdir), whichever exists. + +2001-05-11 Bruno Haible + + * Makefile.in (install-exec): Don't install charset.alias on glibc 2.1 + systems. + +2001-04-30 Bruno Haible + + * dcigettext.c (getuid, getgid, geteuid, getegid): Provide default + definitions. Needed for mingw32. + +2001-04-19 Bruno Haible + + * gettext-0.10.37 released. + +2001-04-19 Bruno Haible + + * Makefile.in (LTV_CURRENT, LTV_REVISION, LTV_AGE): Bump to 1:1:0. + +2001-04-19 Bruno Haible + + * loadmsgcat.c (_nl_init_domain_conv): Don't append //TRANSLIT when + the libiconv version is smaller than 1.5. + +2001-04-09 Bruno Haible + + * loadmsgcat.c: Don't use GNU C extensions if __APPLE_CC__ is defined. + Apple's MacOS X compiler has not all the features that the regular + GCC with the same version number has. + +2001-04-07 Bruno Haible + + * gettextP.h (struct loaded_domain): Add codeset_cntr field. + (struct binding): Add codeset_cntr field. + (_nl_load_domain): Add domainbinding argument. + (_nl_init_domain_conv, _nl_free_domain_conv): New declarations. + (_nl_find_msg): New declaration, moved here from loadinfo.h. + * loadinfo.h (struct loaded_l10nfile): Remove domainbinding field. + (_nl_make_l10nflist): Remove domainbinding argument. + (_nl_find_msg): Move declaration to gettextP.h. + * bindtextdom.c (set_binding_values): Initialize ->codeset_cntr to 0. + Increment it when ->codeset is changed. + * dcigettext.c (DCIGETTEXT): Pass binding to _nl_find_msg. + (_nl_find_msg): Add domainbinding argument. Reinitialize the converter + if domainbinding->codeset_cntr has been incremented. + * finddomain.c (_nl_find_domain): Don't pass domainbinding to + _nl_make_l10nflist(). Pass it to _nl_load_domain() instead. + * l10nflist.c (_nl_make_l10nflist): Remove domainbinding argument. + * loadmsgcat.c (_nl_init_domain_conv): New function, extracted from + _nl_load_domain. Append //TRANSLIT also when using libiconv. + (_nl_free_domain_conv): New function, extracted from _nl_unload_domain. + (_nl_load_domain): Add domainbinding argument. Call + _nl_init_domain_conv. + (_nl_unload_domain): Call _nl_free_domain_conv. + +2001-04-09 Bruno Haible + + * dcigettext.c (HAVE_LOCALE_NULL): Don't define if __GNU_LIBRARY__ < 2 + (Linux libc5). + +2001-04-04 Bruno Haible + + * dcigettext.c (HAVE_LOCALE_NULL): Define also if __GNU_LIBRARY__. + +2001-04-04 Bruno Haible + + * Makefile.in (libdir, includedir, datadir): Use the autoconf + determined value, in order to respect the configure arguments. + (gettextsrcdir): Use $(datadir), not @datadir@. + +2001-03-29 Bruno Haible + + * gettext-0.10.36 released. + +2001-03-25 Bruno Haible + + * Makefile.in (install-data): Set execution bits on installed + config.charset. + +2001-03-23 Bruno Haible + + * Makefile.in (YACC): Use @INTLBISON@ instead of bison. + +2001-03-21 Bruno Haible + + * dcigettext.c (_nl_state_lock): Mark as #ifdef _LIBC. AIX 3 xlc + chokes on empty macro arguments. + * plural.y: Add #pragma for alloca on AIX 3. + +2001-03-20 Bruno Haible + + * Makefile.in (DISTFILES.generated): New variable. + (DISTFILES.gettext): Remove plural.c. + (dist): Use DISTFILES.generated. + (YACC): Use "bison -y" instead of @YACC@. + Needed for "make dist" to work in normal packages. + +2001-03-20 Bruno Haible + + * Makefile.in (dist): Don't depend on $(DISTFILES). Instead, generate + the files to be distributed through a recursive 'make' call. + +2001-03-17 Bruno Haible + + * gettextP.h (struct expression): Add operators lnot, less_than, + greater_than, less_or_equal, greater_or_equal. Replace args2/args3 + union by a 'nargs' counter and an 'args[]' array. + * plural.y: Don't include stdarg.h. + (new_exp): New function. + (new_exp_0, new_exp_2, new_exp_3): Rewritten to call new_exp. + (new_exp_1): New function. + ('?' ':'): Make right-associative. + (EQUOP2): New token, replaces '=' and '!'. + (CMPOP2): New token. + (ADDOP2): New token, replaces '+' and '-'. + (MULOP2): New token, replaces '*', '/' and '%'. + ('!'): New token. + (exp): Add rules for CMPOP2 and '!'. Don't call YYABORT. + (start): Call YYABORT here. + (FREE_EXPRESSION): Update. + (yylex): Don't skip "\\n". Recognize comparison and '!' operators. + Update for new token symbols. + * loadmsgcat.c (plvar, plone, germanic_plural, init_germanic_plural): + Update. + * dcigettext.c (_nl_find_msg): Optimize for space. + (plural_eval): Recognize comparison and '!' operators. Optimize for + space. + + * dcigettext.c (transcmp): New declaration. + +2001-03-10 Bruno Haible + + * Makefile.in (libintl.la): Pass -liconv and flag -no-undefined. + Needed on platforms like BeOS. + + * Makefile.in (all-no-yes): Depend on libgnuintl.$la, not libintl.$la. + (libgnuintl.a, libgnuintl.la): New targets. Needed for linking + ../tests/tstgettext on systems which have gettext() in libintl.so. + + * localcharset.c (locale_charset): Allow wildcard syntax. Resolve + alias also if codeset is empty. + * config.charset (BeOS): Use wildcard syntax. + + * loadmsgcat.c (_nl_load_domain): locale_charset() doesn't return NULL + any more. + +2001-03-09 Bruno Haible + + * config.charset: Update from libiconv-1.6. + * localcharset.c: Likewise. + +2001-02-25 Ulrich Drepper + + * locale.alias: Don't use nb_NO but define aliases for it. + +2001-01-26 Ulrich Drepper + + * loadmsgcat.c: Include for _LIBC. + +2001-03-09 Bruno Haible + + * dcigettext.c (transmem_block_t): Change to unsigned char, to avoid + compiler warning. + (_nl_find_msg): Add casts to avoid compiler warnings. + +2001-03-09 Bruno Haible + + * Makefile.in (DISTFILES.common): Remove ChangeLog. + (DISTFILES.obsolete): New variable. + (install-data): Install ChangeLog.inst as ChangeLog. Remove the files + listed in DISTFILES.obsolete. + (uninstall): Simplify. + (distclean): Remove ChangeLog.inst. + (dist): Mention ChangeLog explicitly. + +2001-03-04 Bruno Haible + + * dcigettext.c (ISSLASH, HAS_DEVICE, IS_ABSOLUTE_PATH, + IS_PATH_WITH_DIR): New macros. + (DCIGETTEXT): Use IS_ABSOLUTE_PATH and IS_PATH_WITH_DIR. Increment + path_max proportionally. + * loadinfo.h (PATH_SEPARATOR): New macro. + * l10nflist.c (_nl_make_l10nflist): Use PATH_SEPARATOR instead of ':'. + * localealias.c (_nl_expand_alias): Likewise. + * libgnuintl.h (gettext) [DJGPP]: Define as a macro as well. + +2001-03-06 Bruno Haible + + * libgnuintl.h (LC_MESSAGES): Don't define on Solaris. + +2001-02-24 Bruno Haible + + * dcigettext.c: Update comment about HAVE_LOCALE_NULL. + +2001-02-05 Bruno Haible + + * libgnuintl.h (LC_MESSAGES): Provide a default value. + +2001-01-30 Bruno Haible + + * config.charset: Update for FreeBSD 4.2. + +2001-01-21 Bruno Haible + + Use libtool. + * Makefile.in (l): Use INTL_LIBTOOL_SUFFIX_PREFIX instead of l. + (all-no): When USE_INCLUDED_LIBINTL is 'no' but BUILD_INCLUDED_LIBINTL + is 'yes', still build libintl.$la because the testsuite needs it. + (libintl.la): Add $(CPPFLAGS) $(CFLAGS) $(XCFLAGS). Linking via $(CC) + must use all $(CFLAGS). + (install-exec): Use libtool to install libintl.$la. + (uninstall): Use libtool to uninstall libintl.$la. + (mostlyclean): Remove *.la and the .libs subdir. + * intl-compat.c: Reorder. Add comment. + +2001-01-20 Bruno Haible + + * loadmsgcat.c (O_BINARY): Define on platforms that don't have it. + (_nl_load_domain): Open the catalog file in binary mode. + +2001-01-24 Bruno Haible + + * gettextP.h (SWAP): Remove declaration, to work around a compilation + failure on alphaev5-cray-unicosmk2.0.5.X. + +2001-01-15 Bruno Haible + + * dcigettext.c (_nl_find_msg): Cast the second iconv() arg, to avoid + a warning. + +2001-01-07 Bruno Haible + + * gettextP.h (__gettextdebug): Remove declaration. + (gettext_free_exp__, gettextparse__): New non-libc declarations. + * plural.y [!_LIBC]: Define gettextparse__, gettext_free_exp__, not + __gettextparse, __gettext_free_exp. + * loadmsgcat.c [!_LIBC]: Use gettextparse__, not __gettextparse. + +2001-01-07 Bruno Haible + + * libgnuintl.h: Renamed from intlh.inst.in. + Remove comment about __builtin_constant_p. + (gettext): Use NULL. + * libgettext.h: Completely rewritten. Now a conditional wrapper around + . Keep the handling of ENABLE_NLS and gettext_noop, remove + everything else. + * gettextP.h: Include gettext.h, for nls_uint32. + (gettext__, dgettext__, dcgettext__, textdomain__, bindtextdomain__, + bind_textdomain_codeset__): New declarations, from old libgettext.h. + * gettext.h: Don't include . + * Makefile.in (HEADERS): Add libgnuintl.h. + (DISTFILES.gettext): Remove intlh.inst.in. + (all-yes): Depend on libintl.h instead of intlh.inst. + (libintl.h): New target. Create as a copy of libgnuintl.h. + (intlh.inst): Remove target. + (install-exec): Update. + ($(OBJECTS): Depend on libgnuintl.h, not libgettext.h. + (mostlyclean): Remove libintl.h instead of intlh.inst. + (dist-libc): Remove target. + * bindtextdom.c: Include libgnuintl.h instead of libgettext.h. Don't + include gettext.h. + * dcgettext.c: Likewise. + * dcigettext.c: Likewise. + * dcngettext.c: Likewise. + * dngettext.c: Likewise. + * finddomain.c: Likewise. + * ngettext.c: Likewise. + * textdomain.c: Likewise. + * dgettext.c: Include libgnuintl.h instead of libgettext.h. Include + gettextP.h. + * gettext.c: Likewise. + * intl-compat.c: Likewise. + * localealias.c: Don't include gettext.h. + * plural.y: Likewise. + +2001-01-07 Bruno Haible + + Assume , , , exist. + * intlh.inst.in: Likewise. + * libgettext.h: Likewise. + * gettextP.h: Likewise. + * bindtextdom.c: Likewise. + * dcigettext.c: Likewise. + * dgettext.c: Likewise. + * dngettext.c: Likewise. + * explodename.c: Likewise. + * finddomain.c: Likewise. + * gettext.c: Likewise. + * l10nflist.c: Likewise. + * loadmsgcat.c: Likewise. + * localealias.c: Likewise. + * ngettext.c: Likewise. + * textdomain.c: Likewise. + +2001-01-06 Bruno Haible + + Remove catgets fallback code. + - It does not handle message clash prevention through domains and + dgettext(). + - It does not handle message catalog inheritance and the LANGUAGE + environment variable. + - It does not handle locale aliases. + - It does not handle automatic charset conversion. + - It does not handle plural form handling and ngettext(). + - It uses a slow string to integer conversion. + - It is sensitive against installation problems. + * cat-compat.c: Remove file. + * po2msg.sin, po2tbl.sin: Remove files. + * Makefile.in (datadir): Assume DATADIRNAME = share. + (SOURCES): Remove cat-compat.c. + (DISTFILES.common): Remove po2msg.sin, po2tbl.sin. + (distclean): No need to remove po2msg.sed, po2tbl.sed. + (../po/cat-id-tbl.$lo): Remove rule. + * libgettext.h (_msg_ent): Remove. + (_msg_tbl, _msg_tbl_length): Remove declarations. + (gettext, dgettext, ngettext, dngettext): Don't depend on + !HAVE_CATGETS. + +2001-01-04 Ulrich Drepper + + * plural.y (yylex): Minimal improvement in number scanner. + +2001-01-02 Ulrich Drepper + + * dcigettext.c (guess_category_value): Rewrite so that LANGUAGE value + is ignored if the selected locale is the C locale. + +2000-11-20 Ulrich Drepper + + * dcigettext.c (transcmp): Make s1 and s2 const. + * loadmsgcat.c (_nl_load_domain): Rearrange domain initialization to + avoid warning. + +2000-11-09 Ulrich Drepper + + * locale.alias: Add thai. + Patch by Chanop Silpa-Anan . + +2001-01-05 Bruno Haible + + * Makefile.in (INCLUDES): Remove reference to $(top_srcdir)/lib. + (.SUFFIXES): Put .c before .y, so that Solaris "make" uses the .c.o + rule, not the builtin .y.o rule. + (.y.c): Use $< instead of $^. $^ is not supported by SUSV2 "make" + specification. Remove $*.h explicitly: we don't need plural.h. + * gettextP.h: Include . + (__gettext_free_exp, __gettextparse): Convert prototype to K&R C + syntax. + * bindtextdom.c (offsetof): Provide fallback for platforms that lack + it, like SunOS4. + (set_binding_values): Convert prototype to K&R C syntax. + * cat-compat.c: Include stdlib.h, string.h whenever possible. + * dcigettext.c: Ignore the value of C_ALLOCA, because libintl.a + must not depend on external .o files. + (offsetof): Provide fallback for platforms that lack it, like SunOS4. + (transcmp): Convert to K&R C syntax. + * explodename.c Include stdlib.h whenever possible. + (_nl_find_language): Convert to K&R C syntax. + * finddomain.c: Include stdlib.h whenever possible. + * l10nflist.c Include stdlib.h whenever possible. + (_nl_normalize_codeset): Use tolower, not _tolower. + * loadmsgcat.c: Include stdlib.h whenever possible. + Include headers needed for alloca(). + (freea): New macro. + (_nl_load_domain): Add fallback code for platforms lacking strtoul, + like SunOS4. Add fallback code for platforms lacking alloca. + * localealias.c: Include stdlib.h whenever possible. + (ADD_BLOCK, FREE_BLOCK): Remove macros. + (freea): New macro. + (read_alias_file): Simplify fallback code for platforms lacking alloca. + * plural.y (new_exp_0, new_exp_2, new_exp_3): New functions. + (new_exp): Remove function. + (__gettext_free_exp, yylex, yyerror): Convert to K&R C syntax. + * textdomain.c: Include stdlib.h whenever possible. + * gettext.c: Likewise. + * ngettext.c: Likewise. + * localcharset.c (volatile): Define to empty if not using ANSI C. + +2001-01-01 Bruno Haible + + * Makefile.in (mostlyclean): Remove intlh.inst, charset.alias, + ref-add.sed, ref-del.sed. + (distclean): In the gettext package, remove VERSION. + +2001-01-01 Bruno Haible + + Finish implementation of plural form handling. + * dcigettext.c (known_translation_t): Rename 'domain' field to + 'domainname'. Remove 'plindex' field. Add 'domain' and + 'translation_length' fields. + (transcmp): Don't compare 'plindex' fields. + (plural_lookup): New function. + (DCIGETTEXT): Change cache handing in the plural case. Don't call + plural_eval before the translation and its catalog file have been + found. Remove plindex from cache key. Add 'translation_length' and + 'domain' to cache result. + (_nl_find_msg): Remove index argument, return length of translation + to the caller instead. Weaken comparison of string lengths, to account + for plural entries. Call iconv() on the entire result string, not + only on the portion needed so far. + * loadinfo.h (_nl_find_msg): Remove index argument, add lengthp + argument. + * loadmsgcat.c (_nl_load_domain): Adapt to _nl_find_msg change. + + * intl-compat.c (dcngettext, dngettext, ngettext): New functions. + * libgettext.h (ngettext__, dngettext__, dcngettext__): New + declarations. + (ngettext, dngettext): Add missing macro argument. + + * intlh.inst.in (ngettext, dngettext): Add missing macro argument. + +2000-12-31 Bruno Haible + + * gettextP.h (ZERO): New macro. + (struct binding): Always use ZERO. + * bindtextdom.c (set_binding_values): Use offsetof, not sizeof. + Include whenever possible. + * dcigettext.c (ZERO): Remove macro. + (struct transmem_list): Use ZERO. + (DCIGETTEXT): Use offsetof, not sizeof. + Include whenever possible. + + * config.charset: Update from libiconv-1.5.1. + * localcharset.c: Likewise. + +2000-12-30 Bruno Haible + + * locale.alias: New file, moved here from ../misc/locale.alias. Add + "Packages using this file" line. + * Makefile.in (DISTFILES.common): Add locale.alias. + (install-exec, uninstall): Install/deinstall locale.alias. + +2000-10-30 Ulrich Drepper + + * dcigettext.c (guess_category_value): For libc always use the + setlocale() method. + +2000-10-20 Ulrich Drepper + + * libintl.glibc (ngettext macro): Add missing parameter. + (dngettext macro): Likewise. + +2000-10-14 Ulrich Drepper + + * localealias.c (read_alias_file): Update string pointers in map[] + if realloc() changed the values. + Patch by Jakub Jelinek . + +2000-08-31 Ulrich Drepper + + * loadmsgcat.c: Use *stat64 instead of *stat internally. + + * dcigettext.c (free_mem): Correct freeing of _nl_domain_bindings + list. + +2000-08-27 Ulrich Drepper + + * dcigettext.c (DCIGETTEXT): Remove _nl_find_language in code to + determine invalid locale name. + +2000-08-20 Ulrich Drepper + + * dcigettext.c: Unify use of function aliases to make more compact + PLT. + + * loadmsgcat.c (_nl_unload_domain): Also free conv_tab element. + Pretty printing. + * plural.y (new_exp): Take number of optional parameters in second + parameter. Test for correct number of parameters and free correctly + in case of failure. Adjust all callers. + (yylex): Fix handling of '\0'. Allow ';' as terminator character. + +2000-07-14 Bruno Haible + + * dcigettext.c (dcigettext): Call plural_eval on all platforms, not + only those having tsearch. + +2000-06-30 Ulrich Drepper + + * dcigettext.c (_nl_find_msg): Correct reallocation of buffers in + case the translation is too large. Remember allocated memory blocks + in a list. + (free_mem): Free memory for translations. + +2000-06-16 Ulrich Drepper + + * loadmsgcat.c (_nl_load_domain): Call norm_add_slashes with new + parameter to always enable transliteration. + +1998-10-20 Paul Eggert + + * po2tbl.sin: Escape trigraphs. + +2000-10-12 Bruno Haible + + * finddomain.c: Remove unneeded includes. + +2000-10-12 Bruno Haible + + * localealias.c (memcpy): Return first argument, just like the real + memcpy function does. + * bindtextdom.c (memcpy): Likewise. + * finddomain.c (memcpy): Likewise. + * l10nflist.c (memcpy): Likewise. + * textdomain.c (memcpy): Likewise. + From Paul Eggert . + +2000-09-29 Bruno Haible + + * libintl.glibc: Update from current glibc version. + +2000-09-18 Bruno Haible + + * dcigettext.c: Outside libc, use local variable names that don't + clash with those in libc. + * bindtextdom.c: Likewise. + * textdomain.c: Likewise. + +2000-07-31 Bruno Haible + + * plural.y: Include config.h. Needed to define 'inline' away for C + compilers that don't support it. + (yylex): Don't use gcc specific case range syntax. + * loadmsgcat.y (INIT_GERMANIC_PLURAL): New macro, for old compilers. + +2000-07-28 Bruno Haible + + Simplification: In all cases where $(gnulocaledir) is used, it is + identical to $(localedir). + * Makefile.in (DEFS): Remove setting for GNULOCALEDIR. + * dcigettext.c (_nl_default_dirname): Initialize with LOCALEDIR. + +2000-07-28 Bruno Haible + + * xopen-msg.sed: Renamed to ... + * po2msg.sin: ... here. + * linux-msg.sed: Remove file. + * Makefile.in (DISTFILES.common): Update. + +2000-07-28 Bruno Haible + + * po2tbl.sed.in: Renamed to ... + * po2tbl.sin: ... here. + * Makefile.in (DISTFILES.common): Update. + +2000-07-28 Bruno Haible + + * Makefile.in (uninstall): Synchronize with the install target. + Really remove charset.alias when its reference count drops to 0. + +2000-07-28 Bruno Haible + + * Makefile.in (mkinstalldirs): New macro. Needed when configured with + --srcdir=; then ac_aux_dir will be a relative + pathname rooted at the top builddir, and @MKINSTALLDIRS@ likewise. + (install-exec, install-data): Use it. + +2000-07-26 Bruno Haible + + * Makefile.in (install-exec, install-data): Use $(SHELL) for calling + $(MKINSTALLDIRS), don't rely on its execution permissions. + + * Makefile.in (LTV_CURRENT, LTV_REVISION, LTV_AGE): New variables. + (libintl.la): Use them. + + * Makefile.in (install-exec, install-data, uninstall): Provide DESTDIR + support, as recommended by GNU standards. Fix misapplied 2000-06-16 + patch. + +2000-06-16 Bruno Haible + + * Makefile.in (COMSRCS): Add localcharset.c. + (OBJECTS): Add localcharset.$lo. + (DISTFILES.common): Add config.charset, ref-{add,del}.sin. + (DEFS): Add -DLIBDIR. + (all-yes): Add charset.alias, ref-{add,del}.sed. + (.SUFFIXES): Add .sin and .sed. + (.sin.sed, charset.alias): New rules. + (install-exec, uninstall): Install/deinstall charset.alias. + * localcharset.c: New file, from fileutils-4.0u. + * config.charset: New file, from fileutils-4.0u. + * red-add.sin, ref-del.sin: New files, from fileutils-4.0u. + + * intlh.inst.in (bind_textdomain_codeset): New declaration. + * libgettext.h (bind_textdomain_codeset, bind_textdomain_codeset__): + New declarations. + (bind_textdomain_codeset) [!ENABLE_NLS]: New macro. + * cat-compat.c (bind_textdomain_codeset): New function. + * intl-compat.c (bind_textdomain_codeset): New function. + + * libgettext.h (ngettext, dngettext, dcngettext): New + declarations. + (dcgettext): Remove macro definition. + (textdomain, bindtextdomain) [!ENABLE_NLS]: Parenthesize argument. + * intlh.inst.in (ngettext, dngettext, dcngettext): New + declarations. + (dcgettext): Remove macro definition. + + * *.h, *.c, *.y: Change copyright notice from LGPL to GPL. + +2000-05-21 Ulrich Drepper + + * dcigettext.c: Fix typo in comment. + +2000-05-08 Andreas Jaeger + + * bindtextdom.c (set_binding_values): Add prototype. + +2000-05-05 Bruno Haible + + * dcigettext.c (alignof): New macro. + (_nl_find_msg): Use it instead of __alignof__. Pass correct output + buffer length to __gconv/iconv. If malloc (freemem_size) fails, set + freemem_size to 0. + +2000-05-05 Bruno Haible + + * dcigettext.c (dcigettext): Fix interpretation of tsearch + return value. + +2000-05-06 Ulrich Drepper + + * dcigettext.c (DCIGETTEXT): Always define local variable `index'. + (mempcpy): Correct typo in parameter list. + + * hash-string.h: Don't include . + + * *.c, *.h, *.y: Update from glibc version. + +1998-04-29 Paul Eggert + + * Makefile.in (aliaspath): Don't put `.' at the end. + +1998-06-01 Ulrich Drepper + + * localealias.c (read_alias_file): Undo last change. + * l10nflist.c (_nl_normalize_codeset): Likewise. + * loadinfo.h: Likewise. + +1998-05-23 Ulrich Drepper + + * dcgettext.c: Don't use any alloca hack when C_ALLOCA is defined. + +1998-05-01 08:47 Ulrich Drepper + + * gettext-0.10.35 released. + +1998-04-29 Ulrich Drepper + + * intl/localealias.c (read_alias_file): Use unsigned char for + local variables. Remove unused variable tp. + * intl/l10nflist.c (_nl_normalize_codeset): Use unsigned char * + for type of codeset. For loosing Solaris systems. + * intl/loadinfo.h: Adapt prototype of _nl_normalize_codeset. + * intl/bindtextdom.c (BINDTEXTDOMAIN): Don't define local variable + len if not needed. + Patches by Jim Meyering. + +1998-04-28 Ulrich Drepper + + * loadmsgcat.c (_nl_load_domain): Don't assign the element use_mmap if + mmap is not supported. + + * hash-string.h: Don't include . + +1998-04-27 Ulrich Drepper + + * textdomain.c: Use strdup is available. + + * localealias.c: Define HAVE_MEMPCPY so that we can use this + function. Define and use semapahores to protect modfication of + global objects when compiling for glibc. Add code to allow + freeing alias table. + + * l10nflist.c: Don't assume stpcpy not being a macro. + + * gettextP.h: Define internal_function macri if not already done. + Use glibc byte-swap macros instead of defining SWAP when compiled + for glibc. + (struct loaded_domain): Add elements to allow unloading. + + * Makefile.in (distclean): Don't remove libintl.h here. + + * bindtextdomain.c: Carry over changes from glibc. Use strdup if + available. + + * dcgettext.c: Don't assume stpcpy not being a macro. Mark internal + functions. Add memory freeing code for glibc. + + * dgettext.c: Update copyright. + + * explodename.c: Include stdlib.h and string.h only if they exist. + Use strings.h eventually. + + * finddomain.c: Mark internal functions. Use strdup if available. + Add memory freeing code for glibc. + +1997-10-10 20:00 Ulrich Drepper + + * libgettext.h: Fix dummy textdomain and bindtextdomain macros. + They should return reasonable values. + Reported by Tom Tromey . + +1997-09-16 03:33 Ulrich Drepper + + * libgettext.h: Define PARAMS also to `args' if __cplusplus is defined. + * intlh.inst.in: Likewise. + Reported by Jean-Marc Lasgouttes . + + * libintl.glibc: Update from current glibc version. + +1997-09-06 02:10 Ulrich Drepper + + * intlh.inst.in: Reformat copyright. + +1997-08-19 15:22 Ulrich Drepper + + * dcgettext.c (DCGETTEXT): Remove wrong comment. + +1997-08-16 00:13 Ulrich Drepper + + * Makefile.in (install-data): Don't change directory to install. + +1997-08-01 14:30 Ulrich Drepper + + * cat-compat.c: Fix copyright. + + * localealias.c: Don't define strchr unless !HAVE_STRCHR. + + * loadmsgcat.c: Update copyright. Fix typos. + + * l10nflist.c: Don't define strchr unless !HAVE_STRCHR. + (_nl_make_l10nflist): Handle sponsor and revision correctly. + + * gettext.c: Update copyright. + * gettext.h: Likewise. + * hash-string.h: Likewise. + + * finddomain.c: Remoave dead code. Define strchr only if + !HAVE_STRCHR. + + * explodename.c: Include . + + * explodename.c: Reformat copyright text. + (_nl_explode_name): Fix typo. + + * dcgettext.c: Define and use __set_errno. + (guess_category_value): Don't use setlocale if HAVE_LC_MESSAGES is + not defined. + + * bindtextdom.c: Pretty printing. + +1997-05-01 02:25 Ulrich Drepper + + * dcgettext.c (guess_category_value): Don't depend on + HAVE_LC_MESSAGES. We don't need the macro here. + Patch by Bruno Haible . + + * cat-compat.c (textdomain): DoN't refer to HAVE_SETLOCALE_NULL + macro. Instead use HAVE_LOCALE_NULL and define it when using + glibc, as in dcgettext.c. + Patch by Bruno Haible . + + * Makefile.in (CPPFLAGS): New variable. Reported by François + Pinard. + +Mon Mar 10 06:51:17 1997 Ulrich Drepper + + * Makefile.in: Implement handling of libtool. + + * gettextP.h: Change data structures for use of generic lowlevel + i18n file handling. + +Wed Dec 4 20:21:18 1996 Ulrich Drepper + + * textdomain.c: Put parentheses around arguments of memcpy macro + definition. + * localealias.c: Likewise. + * l10nflist.c: Likewise. + * finddomain.c: Likewise. + * bindtextdom.c: Likewise. + Reported by Thomas Esken. + +Mon Nov 25 22:57:51 1996 Ulrich Drepper + + * textdomain.c: Move definition of `memcpy` macro to right + position. + +Fri Nov 22 04:01:58 1996 Ulrich Drepper + + * finddomain.c [!HAVE_STRING_H && !_LIBC]: Define memcpy using + bcopy if not already defined. Reported by Thomas Esken. + * bindtextdom.c: Likewise. + * l10nflist.c: Likewise. + * localealias.c: Likewise. + * textdomain.c: Likewise. + +Tue Oct 29 11:10:27 1996 Ulrich Drepper + + * Makefile.in (libdir): Change to use exec_prefix instead of + prefix. Reported by Knut-HÃ¥vardAksnes . + +Sat Aug 31 03:07:09 1996 Ulrich Drepper + + * l10nflist.c (_nl_normalize_codeset): We convert to lower case, + so don't prepend uppercase `ISO' for only numeric arg. + +Fri Jul 19 00:15:46 1996 Ulrich Drepper + + * l10nflist.c: Move inclusion of argz.h, ctype.h, stdlib.h after + definition of _GNU_SOURCE. Patch by Roland McGrath. + + * Makefile.in (uninstall): Fix another bug with `for' loop and + empty arguments. Patch by Jim Meyering. Correct name os + uninstalled files: no intl- prefix anymore. + + * Makefile.in (install-data): Again work around shells which + cannot handle mpty for list. Reported by Jim Meyering. + +Sat Jul 13 18:11:35 1996 Ulrich Drepper + + * Makefile.in (install): Split goal. Now depend on install-exec + and install-data. + (install-exec, install-data): New goals. Created from former + install goal. + Reported by Karl Berry. + +Sat Jun 22 04:58:14 1996 Ulrich Drepper + + * Makefile.in (MKINSTALLDIRS): New variable. Path to + mkinstalldirs script. + (install): use MKINSTALLDIRS variable or if the script is not present + try to find it in the $top_scrdir). + +Wed Jun 19 02:56:56 1996 Ulrich Drepper + + * l10nflist.c: Linux libc *partly* includes the argz_* functions. + Grr. Work around by renaming the static version and use macros + for renaming. + +Tue Jun 18 20:11:17 1996 Ulrich Drepper + + * l10nflist.c: Correct presence test macros of __argz_* functions. + + * l10nflist.c: Include based on test of it instead when + __argz_* functions are available. + Reported by Andreas Schwab. + +Thu Jun 13 15:17:44 1996 Ulrich Drepper + + * explodename.c, l10nflist.c: Define NULL for dumb systems. + +Tue Jun 11 17:05:13 1996 Ulrich Drepper + + * intlh.inst.in, libgettext.h (dcgettext): Rename local variable + result to __result to prevent name clash. + + * l10nflist.c, localealias.c, dcgettext.c: Define _GNU_SOURCE to + get prototype for stpcpy and strcasecmp. + + * intlh.inst.in, libgettext.h: Move declaration of + `_nl_msg_cat_cntr' outside __extension__ block to prevent warning + from gcc's -Wnested-extern option. + +Fri Jun 7 01:58:00 1996 Ulrich Drepper + + * Makefile.in (install): Remove comment. + +Thu Jun 6 17:28:17 1996 Ulrich Drepper + + * Makefile.in (install): Work around for another Buglix stupidity. + Always use an `else' close for `if's. Reported by Nelson Beebe. + + * Makefile.in (intlh.inst): Correct typo in phony rule. + Reported by Nelson Beebe. + +Thu Jun 6 01:49:52 1996 Ulrich Drepper + + * dcgettext.c (read_alias_file): Rename variable alloca_list to + block_list as the macro calls assume. + Patch by Eric Backus. + + * localealias.c [!HAVE_ALLOCA]: Define alloca as macro using + malloc. + (read_alias_file): Rename varriabe alloca_list to block_list as the + macro calls assume. + Patch by Eric Backus. + + * l10nflist.c: Correct conditional for inclusion. + Reported by Roland McGrath. + + * Makefile.in (all): Depend on all-@USE_INCLUDED_LIBINTL@, not + all-@USE_NLS@. + + * Makefile.in (install): intlh.inst comes from local dir, not + $(srcdir). + + * Makefile.in (intlh.inst): Special handling of this goal. If + used in gettext, this is really a rul to construct this file. If + used in any other package it is defined as a .PHONY rule with + empty body. + + * finddomain.c: Extract locale file information handling into + l10nfile.c. Rename local stpcpy__ function to stpcpy. + + * dcgettext.c (stpcpy): Add local definition. + + * l10nflist.c: Solve some portability problems. Patches partly by + Thomas Esken. Add local definition of stpcpy. + +Tue Jun 4 02:47:49 1996 Ulrich Drepper + + * intlh.inst.in: Don't depend including on + HAVE_LOCALE_H. Instead configure must rewrite this fiile + depending on the result of the configure run. + + * Makefile.in (install): libintl.inst is now called intlh.inst. + Add rules for updating intlh.inst from intlh.inst.in. + + * libintl.inst: Renamed to intlh.inst.in. + + * localealias.c, dcgettext.c [__GNUC__]: Define HAVE_ALLOCA to 1 + because gcc has __buitlin_alloca. + Reported by Roland McGrath. + +Mon Jun 3 00:32:16 1996 Ulrich Drepper + + * Makefile.in (installcheck): New goal to fulfill needs of + automake's distcheck. + + * Makefile.in (install): Reorder commands so that VERSION is + found. + + * Makefile.in (gettextsrcdir): Now use subdirectory intl/ in + @datadir@/gettext. + (COMSRCS): Add l10nfile.c. + (OBJECTS): Add l10nfile.o. + (DISTFILES): Rename to DISTFILE.normal. Remove $(DISTFILES.common). + (DISTFILE.gettext): Remove $(DISTFILES.common). + (all-gettext): Remove goal. + (install): If $(PACKAGE) = gettext install, otherwose do nothing. No + package but gettext itself should install libintl.h + headers. + (dist): Extend goal to work for gettext, too. + (dist-gettext): Remove goal. + + * dcgettext.c [!HAVE_ALLOCA]: Define macro alloca by using malloc. + +Sun Jun 2 17:33:06 1996 Ulrich Drepper + + * loadmsgcat.c (_nl_load_domain): Parameter is now comes from + find_l10nfile. + +Sat Jun 1 02:23:03 1996 Ulrich Drepper + + * l10nflist.c (__argz_next): Add definition. + + * dcgettext.c [!HAVE_ALLOCA]: Add code for handling missing alloca + code. Use new l10nfile handling. + + * localealias.c [!HAVE_ALLOCA]: Add code for handling missing + alloca code. + + * l10nflist.c: Initial revision. + +Tue Apr 2 18:51:18 1996 Ulrich Drepper + + * Makefile.in (all-gettext): New goal. Same as all-yes. + +Thu Mar 28 23:01:22 1996 Karl Eichwalder + + * Makefile.in (gettextsrcdir): Define using @datadir@. + +Tue Mar 26 12:39:14 1996 Ulrich Drepper + + * finddomain.c: Include . Reported by Roland McGrath. + +Sat Mar 23 02:00:35 1996 Ulrich Drepper + + * finddomain.c (stpcpy): Rename to stpcpy__ to prevent clashing + with external declaration. + +Sat Mar 2 00:47:09 1996 Ulrich Drepper + + * Makefile.in (all-no): Rename from all_no. + +Sat Feb 17 00:25:59 1996 Ulrich Drepper + + * gettextP.h [loaded_domain]: Array `successor' must now contain up + to 63 elements (because of codeset name normalization). + + * finddomain.c: Implement codeset name normalization. + +Thu Feb 15 04:39:09 1996 Ulrich Drepper + + * Makefile.in (all): Define to `all-@USE_NLS@'. + (all-yes, all_no): New goals. `all-no' is noop, `all-yes' + is former all. + +Mon Jan 15 21:46:01 1996 Howard Gayle + + * localealias.c (alias_compare): Increment string pointers in loop + of strcasecmp replacement. + +Fri Dec 29 21:16:34 1995 Ulrich Drepper + + * Makefile.in (install-src): Who commented this goal out ? :-) + +Fri Dec 29 15:08:16 1995 Ulrich Drepper + + * dcgettext.c (DCGETTEXT): Save `errno'. Failing system calls + should not effect it because a missing catalog is no error. + Reported by Harald Knig . + +Tue Dec 19 22:09:13 1995 Ulrich Drepper + + * Makefile.in (Makefile): Explicitly use $(SHELL) for running + shell scripts. + +Fri Dec 15 17:34:59 1995 Andreas Schwab + + * Makefile.in (install-src): Only install library and header when + we use the own implementation. Don't do it when using the + system's gettext or catgets functions. + + * dcgettext.c (find_msg): Must not swap domain->hash_size here. + +Sat Dec 9 16:24:37 1995 Ulrich Drepper + + * localealias.c, libintl.inst, libgettext.h, hash-string.h, + gettextP.h, finddomain.c, dcgettext.c, cat-compat.c: + Use PARAMS instead of __P. Suggested by Roland McGrath. + +Tue Dec 5 11:39:14 1995 Larry Schwimmer + + * libgettext.h: Use `#if !defined (_LIBINTL_H)' instead of `#if + !_LIBINTL_H' because Solaris defines _LIBINTL_H as empty. + +Mon Dec 4 15:42:07 1995 Ulrich Drepper + + * Makefile.in (install-src): + Install libintl.inst instead of libintl.h.install. + +Sat Dec 2 22:51:38 1995 Marcus Daniels + + * cat-compat.c (textdomain): + Reverse order in which files are tried you load. First + try local file, when this failed absolute path. + +Wed Nov 29 02:03:53 1995 Nelson H. F. Beebe + + * cat-compat.c (bindtextdomain): Add missing { }. + +Sun Nov 26 18:21:41 1995 Ulrich Drepper + + * libintl.inst: Add missing __P definition. Reported by Nelson Beebe. + + * Makefile.in: + Add dummy `all' and `dvi' goals. Reported by Tom Tromey. + +Sat Nov 25 16:12:01 1995 François Pinard + + * hash-string.h: Capitalize arguments of macros. + +Sat Nov 25 12:01:36 1995 Ulrich Drepper + + * Makefile.in (DISTFILES): Prevent files names longer than 13 + characters. libintl.h.glibc->libintl.glibc, + libintl.h.install->libintl.inst. Reported by Joshua R. Poulson. + +Sat Nov 25 11:31:12 1995 Eric Backus + + * dcgettext.c: Fix bug in preprocessor conditionals. + +Sat Nov 25 02:35:27 1995 Nelson H. F. Beebe + + * libgettext.h: Solaris cc does not understand + #if !SYMBOL1 && !SYMBOL2. Sad but true. + +Thu Nov 23 16:22:14 1995 Ulrich Drepper + + * hash-string.h (hash_string): + Fix for machine with >32 bit `unsigned long's. + + * dcgettext.c (DCGETTEXT): + Fix horrible bug in loop for alternative translation. + +Thu Nov 23 01:45:29 1995 Ulrich Drepper + + * po2tbl.sed.in, linux-msg.sed, xopen-msg.sed: + Some further simplifications in message number generation. + +Mon Nov 20 21:08:43 1995 Ulrich Drepper + + * libintl.h.glibc: Use __const instead of const in prototypes. + + * Makefile.in (install-src): + Install libintl.h.install instead of libintl.h. This + is a stripped-down version. Suggested by Peter Miller. + + * libintl.h.install, libintl.h.glibc: Initial revision. + + * localealias.c (_nl_expand_alias, read_alias_file): + Protect prototypes in type casts by __P. + +Tue Nov 14 16:43:58 1995 Ulrich Drepper + + * hash-string.h: Correct prototype for hash_string. + +Sun Nov 12 12:42:30 1995 Ulrich Drepper + + * hash-string.h (hash_string): Add prototype. + + * gettextP.h: Fix copyright. + (SWAP): Add prototype. + +Wed Nov 8 22:56:33 1995 Ulrich Drepper + + * localealias.c (read_alias_file): Forgot sizeof. + Avoid calling *printf function. This introduces a big overhead. + Patch by Roland McGrath. + +Tue Nov 7 14:21:08 1995 Ulrich Drepper + + * finddomain.c, cat-compat.c: Wrong indentation in #if for stpcpy. + + * finddomain.c (stpcpy): + Define substitution function local. The macro was to flaky. + + * cat-compat.c: Fix typo. + + * xopen-msg.sed, linux-msg.sed: + While bringing message number to right place only accept digits. + + * linux-msg.sed, xopen-msg.sed: Now that the counter does not have + leading 0s we don't need to remove them. Reported by Marcus + Daniels. + + * Makefile.in (../po/cat-id-tbl.o): Use $(top_srdir) in + dependency. Reported by Marcus Daniels. + + * cat-compat.c: (stpcpy) [!_LIBC && !HAVE_STPCPY]: Define replacement. + Generally cleanup using #if instead of #ifndef. + + * Makefile.in: Correct typos in comment. By François Pinard. + +Mon Nov 6 00:27:02 1995 Ulrich Drepper + + * Makefile.in (install-src): Don't install libintl.h and libintl.a + if we use an available gettext implementation. + +Sun Nov 5 22:02:08 1995 Ulrich Drepper + + * libgettext.h: Fix typo: HAVE_CATGETTS -> HAVE_CATGETS. Reported + by François Pinard. + + * libgettext.h: Use #if instead of #ifdef/#ifndef. + + * finddomain.c: + Comments describing what has to be done should start with FIXME. + +Sun Nov 5 19:38:01 1995 Ulrich Drepper + + * Makefile.in (DISTFILES): Split. Use DISTFILES with normal meaning. + DISTFILES.common names the files common to both dist goals. + DISTFILES.gettext are the files only distributed in GNU gettext. + +Sun Nov 5 17:32:54 1995 Ulrich Drepper + + * dcgettext.c (DCGETTEXT): Correct searching in derived locales. + This was necessary since a change in _nl_find_msg several weeks + ago. I really don't know this is still not fixed. + +Sun Nov 5 12:43:12 1995 Ulrich Drepper + + * loadmsgcat.c (_nl_load_domain): Test for FILENAME == NULL. This + might mark a special condition. + + * finddomain.c (make_entry_rec): Don't make illegal entry as decided. + + * Makefile.in (dist): Suppress error message when ln failed. + Get files from $(srcdir) explicitly. + + * libgettext.h (gettext_const): Rename to gettext_noop. + +Fri Nov 3 07:36:50 1995 Ulrich Drepper + + * finddomain.c (make_entry_rec): + Protect against wrong locale names by testing mask. + + * libgettext.h (gettext_const): Add macro definition. + Capitalize macro arguments. + +Thu Nov 2 23:15:51 1995 Ulrich Drepper + + * finddomain.c (_nl_find_domain): + Test for pointer != NULL before accessing value. + Reported by Tom Tromey. + + * gettext.c (NULL): + Define as (void*)0 instad of 0. Reported by François Pinard. + +Mon Oct 30 21:28:52 1995 Ulrich Drepper + + * po2tbl.sed.in: Serious typo bug fixed by Jim Meyering. + +Sat Oct 28 23:20:47 1995 Ulrich Drepper + + * libgettext.h: Disable dcgettext optimization for Solaris 2.3. + + * localealias.c (alias_compare): + Peter Miller reported that tolower in some systems is + even dumber than I thought. Protect call by `isupper'. + +Fri Oct 27 22:22:51 1995 Ulrich Drepper + + * Makefile.in (libdir, includedir): New variables. + (install-src): Install libintl.a and libintl.h in correct dirs. + +Fri Oct 27 22:07:29 1995 Ulrich Drepper + + * Makefile.in (SOURCES): Fix typo: intrl.compat.c -> intl-compat.c. + + * po2tbl.sed.in: Patch for buggy SEDs by Christian von Roques. + + * localealias.c: + Fix typo and superflous test. Reported by Christian von Roques. + +Fri Oct 6 11:52:05 1995 Ulrich Drepper + + * finddomain.c (_nl_find_domain): + Correct some remainder from the pre-CEN syntax. Now + we don't have a constant number of successors anymore. + +Wed Sep 27 21:41:13 1995 Ulrich Drepper + + * Makefile.in (DISTFILES): Add libintl.h.glibc. + + * Makefile.in (dist-libc): Add goal for packing sources for glibc. + (COMSRCS, COMHDRS): Splitted to separate sources shared with glibc. + + * loadmsgcat.c: Forget to continue #if line. + + * localealias.c: + [_LIBC]: Rename strcasecmp to __strcasecmp to keep ANSI C name + space clean. + + * dcgettext.c, finddomain.c: Better comment to last change. + + * loadmsgcat.c: + [_LIBC]: Rename fstat, open, close, read, mmap, and munmap to + __fstat, __open, __close, __read, __mmap, and __munmap resp + to keep ANSI C name space clean. + + * finddomain.c: + [_LIBC]: Rename stpcpy to __stpcpy to keep ANSI C name space clean. + + * dcgettext.c: + [_LIBC]: Rename getced and stpcpy to __getcwd and __stpcpy resp to + keep ANSI C name space clean. + + * libgettext.h: + Include sys/types.h for those old SysV systems out there. + Reported by Francesco Potorti`. + + * loadmsgcat.c (use_mmap): Define if compiled for glibc. + + * bindtextdom.c: Include all those standard headers + unconditionally if _LIBC is defined. + + * finddomain.c: Fix 2 times defiend -> defined. + + * textdomain.c: Include libintl.h instead of libgettext.h when + compiling for glibc. Include all those standard headers + unconditionally if _LIBC is defined. + + * localealias.c, loadmsgcat.c: Prepare to be compiled in glibc. + + * gettext.c: + Include libintl.h instead of libgettext.h when compiling for glibc. + Get NULL from stddef.h if we compile for glibc. + + * finddomain.c: Include libintl.h instead of libgettext.h when + compiling for glibc. Include all those standard headers + unconditionally if _LIBC is defined. + + * dcgettext.c: Include all those standard headers unconditionally + if _LIBC is defined. + + * dgettext.c: If compiled in glibc include libintl.h instead of + libgettext.h. + (locale.h): Don't rely on HAVE_LOCALE_H when compiling for glibc. + + * dcgettext.c: If compiled in glibc include libintl.h instead of + libgettext.h. + (getcwd): Don't rely on HAVE_GETCWD when compiling for glibc. + + * bindtextdom.c: + If compiled in glibc include libintl.h instead of libgettext.h. + +Mon Sep 25 22:23:06 1995 Ulrich Drepper + + * localealias.c (_nl_expand_alias): Don't call bsearch if NMAP <= 0. + Reported by Marcus Daniels. + + * cat-compat.c (bindtextdomain): + String used in putenv must not be recycled. + Reported by Marcus Daniels. + + * libgettext.h (__USE_GNU_GETTEXT): + Additional symbol to signal that we use GNU gettext + library. + + * cat-compat.c (bindtextdomain): + Fix bug with the strange stpcpy replacement. + Reported by Nelson Beebe. + +Sat Sep 23 08:23:51 1995 Ulrich Drepper + + * cat-compat.c: Include for stpcpy prototype. + + * localealias.c (read_alias_file): + While expand strdup code temporary variable `cp' hided + higher level variable with same name. Rename to `tp'. + + * textdomain.c (textdomain): + Avoid warning by using temporary variable in strdup code. + + * finddomain.c (_nl_find_domain): Remove unused variable `application'. + +Thu Sep 21 15:51:44 1995 Ulrich Drepper + + * localealias.c (alias_compare): + Use strcasecmp() only if available. Else use + implementation in place. + + * intl-compat.c: + Wrapper functions now call *__ functions instead of __*. + + * libgettext.h: Declare prototypes for *__ functions instead for __*. + + * cat-compat.c, loadmsgcat.c: + Don't use xmalloc, xstrdup, and stpcpy. These functions are not part + of the standard libc and so prevent libintl.a from being used + standalone. + + * bindtextdom.c: + Don't use xmalloc, xstrdup, and stpcpy. These functions are not part + of the standard libc and so prevent libintl.a from being used + standalone. + Rename to bindtextdomain__ if not used in GNU C Library. + + * dgettext.c: + Rename function to dgettext__ if not used in GNU C Library. + + * gettext.c: + Don't use xmalloc, xstrdup, and stpcpy. These functions are not part + of the standard libc and so prevent libintl.a from being used + standalone. + Functions now called gettext__ if not used in GNU C Library. + + * dcgettext.c, localealias.c, textdomain.c, finddomain.c: + Don't use xmalloc, xstrdup, and stpcpy. These functions are not part + of the standard libc and so prevent libintl.a from being used + standalone. + +Sun Sep 17 23:14:49 1995 Ulrich Drepper + + * finddomain.c: Correct some bugs in handling of CEN standard + locale definitions. + +Thu Sep 7 01:49:28 1995 Ulrich Drepper + + * finddomain.c: Implement CEN syntax. + + * gettextP.h (loaded_domain): Extend number of successors to 31. + +Sat Aug 19 19:25:29 1995 Ulrich Drepper + + * Makefile.in (aliaspath): Remove path to X11 locale dir. + + * Makefile.in: Make install-src depend on install. This helps + gettext to install the sources and other packages can use the + install goal. + +Sat Aug 19 15:19:33 1995 Ulrich Drepper + + * Makefile.in (uninstall): Remove stuff installed by install-src. + +Tue Aug 15 13:13:53 1995 Ulrich Drepper + + * VERSION.in: Initial revision. + + * Makefile.in (DISTFILES): + Add VERSION file. This is not necessary for gettext, but + for other packages using this library. + +Tue Aug 15 06:16:44 1995 Ulrich Drepper + + * gettextP.h (_nl_find_domain): + New prototype after changing search strategy. + + * finddomain.c (_nl_find_domain): + We now try only to find a specified catalog. Fall back to other + catalogs listed in the locale list is now done in __dcgettext. + + * dcgettext.c (__dcgettext): + Now we provide message fall back even to different languages. + I.e. if a message is not available in one language all the other + in the locale list a tried. Formerly fall back was only possible + within one language. Implemented by moving one loop from + _nl_find_domain to here. + +Mon Aug 14 23:45:50 1995 Ulrich Drepper + + * Makefile.in (gettextsrcdir): + Directory where source of GNU gettext library are made + available. + (INSTALL, INSTALL_DATA): Programs used for installing sources. + (gettext-src): New. Rule to install GNU gettext sources for use in + gettextize shell script. + +Sun Aug 13 14:40:48 1995 Ulrich Drepper + + * loadmsgcat.c (_nl_load_domain): + Use mmap for loading only when munmap function is + also available. + + * Makefile.in (install): Depend on `all' goal. + +Wed Aug 9 11:04:33 1995 Ulrich Drepper + + * localealias.c (read_alias_file): + Do not overwrite '\n' when terminating alias value string. + + * localealias.c (read_alias_file): + Handle long lines. Ignore the rest not fitting in + the buffer after the initial `fgets' call. + +Wed Aug 9 00:54:29 1995 Ulrich Drepper + + * gettextP.h (_nl_load_domain): + Add prototype, replacing prototype for _nl_load_msg_cat. + + * finddomain.c (_nl_find_domain): + Remove unneeded variable filename and filename_len. + (expand_alias): Remove prototype because functions does not + exist anymore. + + * localealias.c (read_alias_file): + Change type of fname_len parameter to int. + (xmalloc): Add prototype. + + * loadmsgcat.c: Better prototypes for xmalloc. + +Tue Aug 8 22:30:39 1995 Ulrich Drepper + + * finddomain.c (_nl_find_domain): + Allow alias name to be constructed from the four components. + + * Makefile.in (aliaspath): New variable. Set to preliminary value. + (SOURCES): Add localealias.c. + (OBJECTS): Add localealias.o. + + * gettextP.h: Add prototype for _nl_expand_alias. + + * finddomain.c: Aliasing handled in intl/localealias.c. + + * localealias.c: Aliasing for locale names. + + * bindtextdom.c: Better prototypes for xmalloc and xstrdup. + +Mon Aug 7 23:47:42 1995 Ulrich Drepper + + * Makefile.in (DISTFILES): gettext.perl is now found in misc/. + + * cat-compat.c (bindtextdomain): + Correct implementation. dirname parameter was not used. + Reported by Marcus Daniels. + + * gettextP.h (loaded_domain): + New fields `successor' and `decided' for oo, lazy + message handling implementation. + + * dcgettext.c: + Adopt for oo, lazy message handliing. + Now we can inherit translations from less specific locales. + (find_msg): New function. + + * loadmsgcat.c, finddomain.c: + Complete rewrite. Implement oo, lazy message handling :-). + We now have an additional environment variable `LANGUAGE' with + a higher priority than LC_ALL for the LC_MESSAGE locale. + Here we can set a colon separated list of specifications each + of the form `language[_territory[.codeset]][@modifier]'. + +Sat Aug 5 09:55:42 1995 Ulrich Drepper + + * finddomain.c (unistd.h): + Include to get _PC_PATH_MAX defined on system having it. + +Fri Aug 4 22:42:00 1995 Ulrich Drepper + + * finddomain.c (stpcpy): Include prototype. + + * Makefile.in (dist): Remove `copying instead' message. + +Wed Aug 2 18:52:03 1995 Ulrich Drepper + + * Makefile.in (ID, TAGS): Do not use $^. + +Tue Aug 1 20:07:11 1995 Ulrich Drepper + + * Makefile.in (TAGS, ID): Use $^ as command argument. + (TAGS): Give etags -o option t write to current directory, + not $(srcdir). + (ID): Use $(srcdir) instead os $(top_srcdir)/src. + (distclean): Remove ID. + +Sun Jul 30 11:51:46 1995 Ulrich Drepper + + * Makefile.in (gnulocaledir): + New variable, always using share/ for data directory. + (DEFS): Add GNULOCALEDIR, used in finddomain.c. + + * finddomain.c (_nl_default_dirname): + Set to GNULOCALEDIR, because it always has to point + to the directory where GNU gettext Library writes it to. + + * intl-compat.c (textdomain, bindtextdomain): + Undefine macros before function definition. + +Sat Jul 22 01:10:02 1995 Ulrich Drepper + + * libgettext.h (_LIBINTL_H): + Protect definition in case where this file is included as + libgettext.h on Solaris machines. Add comment about this. + +Wed Jul 19 02:36:42 1995 Ulrich Drepper + + * intl-compat.c (textdomain): Correct typo. + +Wed Jul 19 01:51:35 1995 Ulrich Drepper + + * dcgettext.c (dcgettext): Function now called __dcgettext. + + * dgettext.c (dgettext): Now called __dgettext and calls + __dcgettext. + + * gettext.c (gettext): + Function now called __gettext and calls __dgettext. + + * textdomain.c (textdomain): Function now called __textdomain. + + * bindtextdom.c (bindtextdomain): Function now called + __bindtextdomain. + + * intl-compat.c: Initial revision. + + * Makefile.in (SOURCES): Add intl-compat.c. + (OBJECTS): We always compile the GNU gettext library functions. + OBJECTS contains all objects but cat-compat.o, ../po/cat-if-tbl.o, + and intl-compat.o. + (GETTOBJS): Contains now only intl-compat.o. + + * libgettext.h: + Re-include protection matches dualistic character of libgettext.h. + For all functions in GNU gettext library define __ counter part. + + * finddomain.c (strchr): Define as index if not found in C library. + (_nl_find_domain): For relative paths paste / in between. + +Tue Jul 18 16:37:45 1995 Ulrich Drepper + + * loadmsgcat.c, finddomain.c: Add inclusion of sys/types.h. + + * xopen-msg.sed: Fix bug with `msgstr ""' lines. + A little bit better comments. + +Tue Jul 18 01:18:27 1995 Ulrich Drepper + + * Makefile.in: + po-mode.el, makelinks, combine-sh are now found in ../misc. + + * po-mode.el, makelinks, combine-sh, elisp-comp: + Moved to ../misc/. + + * libgettext.h, gettextP.h, gettext.h: Uniform test for __STDC__. + +Sun Jul 16 22:33:02 1995 Ulrich Drepper + + * Makefile.in (INSTALL, INSTALL_DATA): New variables. + (install-data, uninstall): Install/uninstall .elc file. + + * po-mode.el (Installation comment): + Add .pox as possible extension of .po files. + +Sun Jul 16 13:23:27 1995 Ulrich Drepper + + * elisp-comp: Complete new version by François: This does not + fail when not compiling in the source directory. + +Sun Jul 16 00:12:17 1995 Ulrich Drepper + + * Makefile.in (../po/cat-id-tbl.o): + Use $(MAKE) instead of make for recursive make. + + * Makefile.in (.el.elc): Use $(SHELL) instead of /bin/sh. + (install-exec): Add missing dummy goal. + (install-data, uninstall): @ in multi-line shell command at + beginning, not in front of echo. Reported by Eric Backus. + +Sat Jul 15 00:21:28 1995 Ulrich Drepper + + * Makefile.in (DISTFILES): + Rename libgettext.perl to gettext.perl to fit in 14 chars + file systems. + + * gettext.perl: + Rename to gettext.perl to fit in 14 chars file systems. + +Thu Jul 13 23:17:20 1995 Ulrich Drepper + + * cat-compat.c: If !STDC_HEADERS try to include malloc.h. + +Thu Jul 13 20:55:02 1995 Ulrich Drepper + + * po2tbl.sed.in: Pretty printing. + + * linux-msg.sed, xopen-msg.sed: + Correct bugs with handling substitute flags in branches. + + * hash-string.h (hash_string): + Old K&R compilers don't under stand `unsigned char'. + + * gettext.h (nls_uint32): + Some old K&R compilers (eg HP) don't understand `unsigned int'. + + * cat-compat.c (msg_to_cat_id): De-ANSI-fy prototypes. + +Thu Jul 13 01:34:33 1995 Ulrich Drepper + + * Makefile.in (ELCFILES): New variable. + (DISTFILES): Add elisp-comp. + Add implicit rule for .el -> .elc compilation. + (install-data): install $ELCFILES + (clean): renamed po-to-tbl and po-to-msg to po2tbl and po2msg resp. + + * elisp-comp: Initial revision + +Wed Jul 12 16:14:52 1995 Ulrich Drepper + + * Makefile.in: + cat-id-tbl.c is now found in po/. This enables us to use an identical + intl/ directory in all packages. + + * dcgettext.c (dcgettext): hashing does not work for table size <= 2. + + * textdomain.c: fix typo (#if def -> #if defined) + +Tue Jul 11 18:44:43 1995 Ulrich Drepper + + * Makefile.in (stamp-cat-id): use top_srcdir to address source files + (DISTFILES,distclean): move tupdate.perl to src/ + + * po-to-tbl.sed.in: + add additional jump to clear change flag to recognize multiline strings + +Tue Jul 11 01:32:50 1995 Ulrich Drepper + + * textdomain.c: Protect inclusion of stdlib.h and string.h. + + * loadmsgcat.c: Protect inclusion of stdlib.h. + + * libgettext.h: Protect inclusion of locale.h. + Allow use in C++ programs. + Define NULL is not happened already. + + * Makefile.in (DISTFILES): ship po-to-tbl.sed.in instead of + po-to-tbl.sed. + (distclean): remove po-to-tbl.sed and tupdate.perl. + + * tupdate.perl.in: Substitute Perl path even in exec line. + Don't include entries without translation from old .po file. + +Tue Jul 4 00:41:51 1995 Ulrich Drepper + + * tupdate.perl.in: use "Updated: " in msgid "". + + * cat-compat.c: Fix typo (LOCALDIR -> LOCALEDIR). + Define getenv if !__STDC__. + + * bindtextdom.c: Protect stdlib.h and string.h inclusion. + Define free if !__STDC__. + + * finddomain.c: Change DEF_MSG_DOM_DIR to LOCALEDIR. + Define free if !__STDC__. + + * cat-compat.c: Change DEF_MSG_DOM_DIR to LOCALEDIR. + +Mon Jul 3 23:56:30 1995 Ulrich Drepper + + * Makefile.in: Use LOCALEDIR instead of DEF_MSG_DOM_DIR. + Remove unneeded $(srcdir) from Makefile.in dependency. + + * makelinks: Add copyright and short description. + + * po-mode.el: Last version for 0.7. + + * tupdate.perl.in: Fix die message. + + * dcgettext.c: Protect include of string.h. + + * gettext.c: Protect include of stdlib.h and further tries to get NULL. + + * finddomain.c: Some corrections in includes. + + * Makefile.in (INCLUDES): Prune list correct path to Makefile.in. + + * po-to-tbl.sed: Adopt for new .po file format. + + * linux-msg.sed, xopen-msg.sed: Adopt for new .po file format. + +Sun Jul 2 23:55:03 1995 Ulrich Drepper + + * tupdate.perl.in: Complete rewrite for new .po file format. + +Sun Jul 2 02:06:50 1995 Ulrich Drepper + + * First official release. This directory contains all the code + needed to internationalize own packages. It provides functions + which allow to use the X/Open catgets function with an interface + like the Uniforum gettext function. For system which does not + have neither of those a complete implementation is provided. diff --git a/intl/Makefile.in b/intl/Makefile.in new file mode 100644 index 0000000..5b47cf9 --- /dev/null +++ b/intl/Makefile.in @@ -0,0 +1,337 @@ +# Makefile for directory with message catalog handling in GNU NLS Utilities. +# Copyright (C) 1995-1998, 2000-2002 Free Software Foundation, Inc. +# +# This program 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, 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, +# USA. + +PACKAGE = @PACKAGE@ +VERSION = @VERSION@ + +SHELL = /bin/sh + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +top_builddir = .. +VPATH = @srcdir@ + +prefix = @prefix@ +exec_prefix = @exec_prefix@ +transform = @program_transform_name@ +libdir = @libdir@ +includedir = @includedir@ +datadir = @datadir@ +localedir = $(datadir)/locale +gettextsrcdir = $(datadir)/gettext/intl +aliaspath = $(localedir) +subdir = intl + +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +mkinstalldirs = $(SHELL) `case "$(MKINSTALLDIRS)" in /*) echo "$(MKINSTALLDIRS)" ;; *) echo "$(top_builddir)/$(MKINSTALLDIRS)" ;; esac` + +l = @INTL_LIBTOOL_SUFFIX_PREFIX@ + +AR = ar +CC = @CC@ +LIBTOOL = @LIBTOOL@ +RANLIB = @RANLIB@ +YACC = @INTLBISON@ -y -d +YFLAGS = --name-prefix=__gettext + +DEFS = -DLOCALEDIR=\"$(localedir)\" -DLOCALE_ALIAS_PATH=\"$(aliaspath)\" \ +-DLIBDIR=\"$(libdir)\" -DIN_LIBINTL @DEFS@ +CPPFLAGS = @CPPFLAGS@ +CFLAGS = @CFLAGS@ +LDFLAGS = @LDFLAGS@ + +COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS) + +HEADERS = $(COMHDRS) libgnuintl.h loadinfo.h +COMHDRS = gmo.h gettextP.h hash-string.h plural-exp.h eval-plural.h os2compat.h +SOURCES = $(COMSRCS) intl-compat.c +COMSRCS = bindtextdom.c dcgettext.c dgettext.c gettext.c \ +finddomain.c loadmsgcat.c localealias.c textdomain.c l10nflist.c \ +explodename.c dcigettext.c dcngettext.c dngettext.c ngettext.c plural.y \ +plural-exp.c localcharset.c localename.c osdep.c os2compat.c +OBJECTS = @INTLOBJS@ bindtextdom.$lo dcgettext.$lo dgettext.$lo gettext.$lo \ +finddomain.$lo loadmsgcat.$lo localealias.$lo textdomain.$lo l10nflist.$lo \ +explodename.$lo dcigettext.$lo dcngettext.$lo dngettext.$lo ngettext.$lo \ +plural.$lo plural-exp.$lo localcharset.$lo localename.$lo osdep.$lo +GETTOBJS = intl-compat.$lo +DISTFILES.common = Makefile.in \ +config.charset locale.alias ref-add.sin ref-del.sin $(HEADERS) $(SOURCES) +DISTFILES.generated = plural.c +DISTFILES.normal = VERSION +DISTFILES.gettext = COPYING.LIB-2.0 COPYING.LIB-2.1 libintl.glibc +DISTFILES.obsolete = xopen-msg.sed linux-msg.sed po2tbl.sed.in cat-compat.c \ +COPYING.LIB-2 gettext.h libgettext.h plural-eval.c + +# Libtool's library version information for libintl. +# Before making a gettext release, the gettext maintainer must change this +# according to the libtool documentation, section "Library interface versions". +# Maintainers of other packages that include the intl directory must *not* +# change these values. +LTV_CURRENT=2 +LTV_REVISION=0 +LTV_AGE=0 + +.SUFFIXES: +.SUFFIXES: .c .y .o .lo .sin .sed +.c.o: + $(COMPILE) $< +.c.lo: + $(LIBTOOL) --mode=compile $(COMPILE) $< + +.y.c: + $(YACC) $(YFLAGS) --output $@ $< + rm -f $*.h + +.sin.sed: + sed -e '/^#/d' -e 's/@''PACKAGE''@/@PACKAGE@/g' $< > t-$@ + mv t-$@ $@ + +INCLUDES = -I.. -I. -I$(top_srcdir)/intl + +all: all-@USE_INCLUDED_LIBINTL@ +all-yes: libintl.$la libintl.h charset.alias ref-add.sed ref-del.sed +all-no: all-no-@BUILD_INCLUDED_LIBINTL@ +all-no-yes: libgnuintl.$la +all-no-no: + +libintl.a libgnuintl.a: $(OBJECTS) + rm -f $@ + $(AR) cru $@ $(OBJECTS) + $(RANLIB) $@ + +libintl.la libgnuintl.la: $(OBJECTS) + $(LIBTOOL) --mode=link \ + $(CC) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS) $(LDFLAGS) -o $@ \ + $(OBJECTS) @LTLIBICONV@ -lc \ + -version-info $(LTV_CURRENT):$(LTV_REVISION):$(LTV_AGE) \ + -rpath $(libdir) \ + -no-undefined + +libintl.h: libgnuintl.h + cp $(srcdir)/libgnuintl.h libintl.h + +charset.alias: config.charset + $(SHELL) $(srcdir)/config.charset '@host@' > t-$@ + mv t-$@ $@ + +check: all + +# This installation goal is only used in GNU gettext. Packages which +# only use the library should use install instead. + +# We must not install the libintl.h/libintl.a files if we are on a +# system which has the GNU gettext() function in its C library or in a +# separate library. +# If you want to use the one which comes with this version of the +# package, you have to use `configure --with-included-gettext'. +install: install-exec install-data +install-exec: all + if test "$(PACKAGE)" = "gettext" \ + && test '@INTLOBJS@' = '$(GETTOBJS)'; then \ + $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir); \ + $(INSTALL_DATA) libintl.h $(DESTDIR)$(includedir)/libintl.h; \ + $(LIBTOOL) --mode=install \ + $(INSTALL_DATA) libintl.$la $(DESTDIR)$(libdir)/libintl.$la; \ + else \ + : ; \ + fi + if test '@USE_INCLUDED_LIBINTL@' = yes; then \ + test @GLIBC21@ != no || $(mkinstalldirs) $(DESTDIR)$(libdir); \ + temp=$(DESTDIR)$(libdir)/t-charset.alias; \ + dest=$(DESTDIR)$(libdir)/charset.alias; \ + if test -f $(DESTDIR)$(libdir)/charset.alias; then \ + orig=$(DESTDIR)$(libdir)/charset.alias; \ + sed -f ref-add.sed $$orig > $$temp; \ + $(INSTALL_DATA) $$temp $$dest; \ + rm -f $$temp; \ + else \ + if test @GLIBC21@ = no; then \ + orig=charset.alias; \ + sed -f ref-add.sed $$orig > $$temp; \ + $(INSTALL_DATA) $$temp $$dest; \ + rm -f $$temp; \ + fi; \ + fi; \ + $(mkinstalldirs) $(DESTDIR)$(localedir); \ + test -f $(DESTDIR)$(localedir)/locale.alias \ + && orig=$(DESTDIR)$(localedir)/locale.alias \ + || orig=$(srcdir)/locale.alias; \ + temp=$(DESTDIR)$(localedir)/t-locale.alias; \ + dest=$(DESTDIR)$(localedir)/locale.alias; \ + sed -f ref-add.sed $$orig > $$temp; \ + $(INSTALL_DATA) $$temp $$dest; \ + rm -f $$temp; \ + else \ + : ; \ + fi +install-data: all + if test "$(PACKAGE)" = "gettext"; then \ + $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \ + $(INSTALL_DATA) VERSION $(DESTDIR)$(gettextsrcdir)/VERSION; \ + $(INSTALL_DATA) ChangeLog.inst $(DESTDIR)$(gettextsrcdir)/ChangeLog; \ + dists="COPYING.LIB-2.0 COPYING.LIB-2.1 $(DISTFILES.common)"; \ + for file in $$dists; do \ + $(INSTALL_DATA) $(srcdir)/$$file \ + $(DESTDIR)$(gettextsrcdir)/$$file; \ + done; \ + chmod a+x $(DESTDIR)$(gettextsrcdir)/config.charset; \ + dists="$(DISTFILES.generated)"; \ + for file in $$dists; do \ + if test -f $$file; then dir=.; else dir=$(srcdir); fi; \ + $(INSTALL_DATA) $$dir/$$file \ + $(DESTDIR)$(gettextsrcdir)/$$file; \ + done; \ + dists="$(DISTFILES.obsolete)"; \ + for file in $$dists; do \ + rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \ + done; \ + else \ + : ; \ + fi + +install-strip: install + +installdirs: + if test "$(PACKAGE)" = "gettext" \ + && test '@INTLOBJS@' = '$(GETTOBJS)'; then \ + $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir); \ + else \ + : ; \ + fi + if test '@USE_INCLUDED_LIBINTL@' = yes; then \ + test @GLIBC21@ != no || $(mkinstalldirs) $(DESTDIR)$(libdir); \ + $(mkinstalldirs) $(DESTDIR)$(localedir); \ + else \ + : ; \ + fi + if test "$(PACKAGE)" = "gettext"; then \ + $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \ + else \ + : ; \ + fi + +# Define this as empty until I found a useful application. +installcheck: + +uninstall: + if test "$(PACKAGE)" = "gettext" \ + && test '@INTLOBJS@' = '$(GETTOBJS)'; then \ + rm -f $(DESTDIR)$(includedir)/libintl.h; \ + $(LIBTOOL) --mode=uninstall \ + rm -f $(DESTDIR)$(libdir)/libintl.$la; \ + else \ + : ; \ + fi + if test '@USE_INCLUDED_LIBINTL@' = yes; then \ + if test -f $(DESTDIR)$(libdir)/charset.alias; then \ + temp=$(DESTDIR)$(libdir)/t-charset.alias; \ + dest=$(DESTDIR)$(libdir)/charset.alias; \ + sed -f ref-del.sed $$dest > $$temp; \ + if grep '^# Packages using this file: $$' $$temp > /dev/null; then \ + rm -f $$dest; \ + else \ + $(INSTALL_DATA) $$temp $$dest; \ + fi; \ + rm -f $$temp; \ + fi; \ + if test -f $(DESTDIR)$(localedir)/locale.alias; then \ + temp=$(DESTDIR)$(localedir)/t-locale.alias; \ + dest=$(DESTDIR)$(localedir)/locale.alias; \ + sed -f ref-del.sed $$dest > $$temp; \ + if grep '^# Packages using this file: $$' $$temp > /dev/null; then \ + rm -f $$dest; \ + else \ + $(INSTALL_DATA) $$temp $$dest; \ + fi; \ + rm -f $$temp; \ + fi; \ + else \ + : ; \ + fi + if test "$(PACKAGE)" = "gettext"; then \ + for file in VERSION ChangeLog COPYING.LIB-2.0 COPYING.LIB-2.1 $(DISTFILES.common) $(DISTFILES.generated); do \ + rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \ + done; \ + else \ + : ; \ + fi + +info dvi: + +$(OBJECTS): ../config.h libgnuintl.h +bindtextdom.$lo dcgettext.$lo dcigettext.$lo dcngettext.$lo dgettext.$lo dngettext.$lo finddomain.$lo gettext.$lo intl-compat.$lo loadmsgcat.$lo localealias.$lo ngettext.$lo textdomain.$lo: gettextP.h gmo.h loadinfo.h +dcigettext.$lo: hash-string.h +explodename.$lo l10nflist.$lo: loadinfo.h +dcigettext.$lo loadmsgcat.$lo plural.$lo plural-exp.$lo: plural-exp.h +dcigettext.$lo: eval-plural.h + +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) + here=`pwd`; cd $(srcdir) && etags -o $$here/TAGS $(HEADERS) $(SOURCES) + +id: ID + +ID: $(HEADERS) $(SOURCES) + here=`pwd`; cd $(srcdir) && mkid -f$$here/ID $(HEADERS) $(SOURCES) + + +mostlyclean: + rm -f *.a *.la *.o *.lo core core.* + rm -f libintl.h charset.alias ref-add.sed ref-del.sed + rm -f -r .libs _libs + +clean: mostlyclean + +distclean: clean + rm -f Makefile ID TAGS + if test "$(PACKAGE)" = gettext; then \ + rm -f ChangeLog.inst $(DISTFILES.normal); \ + else \ + : ; \ + fi + +maintainer-clean: distclean + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + + +# GNU gettext needs not contain the file `VERSION' but contains some +# other files which should not be distributed in other packages. +distdir = ../$(PACKAGE)-$(VERSION)/$(subdir) +dist distdir: Makefile + if test "$(PACKAGE)" = gettext; then \ + additional="$(DISTFILES.gettext)"; \ + else \ + additional="$(DISTFILES.normal)"; \ + fi; \ + $(MAKE) $(DISTFILES.common) $(DISTFILES.generated) $$additional; \ + for file in ChangeLog $(DISTFILES.common) $(DISTFILES.generated) $$additional; do \ + if test -f $$file; then dir=.; else dir=$(srcdir); fi; \ + cp -p $$dir/$$file $(distdir); \ + done + +Makefile: Makefile.in ../config.status + cd .. \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +# Tell versions [3.59,3.63) of GNU make not to export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/intl/VERSION b/intl/VERSION new file mode 100644 index 0000000..ee66b06 --- /dev/null +++ b/intl/VERSION @@ -0,0 +1 @@ +GNU gettext library from gettext-0.10.35 diff --git a/intl/bindtextdom.c b/intl/bindtextdom.c new file mode 100644 index 0000000..89b62aa --- /dev/null +++ b/intl/bindtextdom.c @@ -0,0 +1,369 @@ +/* Implementation of the bindtextdomain(3) function + Copyright (C) 1995-1998, 2000, 2001 Free Software Foundation, Inc. + + This program 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, 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, + USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include + +#ifdef _LIBC +# include +#else +# include "libgnuintl.h" +#endif +#include "gettextP.h" + +#ifdef _LIBC +/* We have to handle multi-threaded applications. */ +# include +#else +/* Provide dummy implementation if this is outside glibc. */ +# define __libc_rwlock_define(CLASS, NAME) +# define __libc_rwlock_wrlock(NAME) +# define __libc_rwlock_unlock(NAME) +#endif + +/* The internal variables in the standalone libintl.a must have different + names than the internal variables in GNU libc, otherwise programs + using libintl.a cannot be linked statically. */ +#if !defined _LIBC +# define _nl_default_dirname _nl_default_dirname__ +# define _nl_domain_bindings _nl_domain_bindings__ +#endif + +/* Some compilers, like SunOS4 cc, don't have offsetof in . */ +#ifndef offsetof +# define offsetof(type,ident) ((size_t)&(((type*)0)->ident)) +#endif + +/* @@ end of prolog @@ */ + +/* Contains the default location of the message catalogs. */ +extern const char _nl_default_dirname[]; + +/* List with bindings of specific domains. */ +extern struct binding *_nl_domain_bindings; + +/* Lock variable to protect the global data in the gettext implementation. */ +__libc_rwlock_define (extern, _nl_state_lock) + + +/* Names for the libintl functions are a problem. They must not clash + with existing names and they should follow ANSI C. But this source + code is also used in GNU C Library where the names have a __ + prefix. So we have to make a difference here. */ +#ifdef _LIBC +# define BINDTEXTDOMAIN __bindtextdomain +# define BIND_TEXTDOMAIN_CODESET __bind_textdomain_codeset +# ifndef strdup +# define strdup(str) __strdup (str) +# endif +#else +# define BINDTEXTDOMAIN bindtextdomain__ +# define BIND_TEXTDOMAIN_CODESET bind_textdomain_codeset__ +#endif + +/* Prototypes for local functions. */ +static void set_binding_values PARAMS ((const char *domainname, + const char **dirnamep, + const char **codesetp)); + +/* Specifies the directory name *DIRNAMEP and the output codeset *CODESETP + to be used for the DOMAINNAME message catalog. + If *DIRNAMEP or *CODESETP is NULL, the corresponding attribute is not + modified, only the current value is returned. + If DIRNAMEP or CODESETP is NULL, the corresponding attribute is neither + modified nor returned. */ +static void +set_binding_values (domainname, dirnamep, codesetp) + const char *domainname; + const char **dirnamep; + const char **codesetp; +{ + struct binding *binding; + int modified; + + /* Some sanity checks. */ + if (domainname == NULL || domainname[0] == '\0') + { + if (dirnamep) + *dirnamep = NULL; + if (codesetp) + *codesetp = NULL; + return; + } + + __libc_rwlock_wrlock (_nl_state_lock); + + modified = 0; + + for (binding = _nl_domain_bindings; binding != NULL; binding = binding->next) + { + int compare = strcmp (domainname, binding->domainname); + if (compare == 0) + /* We found it! */ + break; + if (compare < 0) + { + /* It is not in the list. */ + binding = NULL; + break; + } + } + + if (binding != NULL) + { + if (dirnamep) + { + const char *dirname = *dirnamep; + + if (dirname == NULL) + /* The current binding has be to returned. */ + *dirnamep = binding->dirname; + else + { + /* The domain is already bound. If the new value and the old + one are equal we simply do nothing. Otherwise replace the + old binding. */ + char *result = binding->dirname; + if (strcmp (dirname, result) != 0) + { + if (strcmp (dirname, _nl_default_dirname) == 0) + result = (char *) _nl_default_dirname; + else + { +#if defined _LIBC || defined HAVE_STRDUP + result = strdup (dirname); +#else + size_t len = strlen (dirname) + 1; + result = (char *) malloc (len); + if (__builtin_expect (result != NULL, 1)) + memcpy (result, dirname, len); +#endif + } + + if (__builtin_expect (result != NULL, 1)) + { + if (binding->dirname != _nl_default_dirname) + free (binding->dirname); + + binding->dirname = result; + modified = 1; + } + } + *dirnamep = result; + } + } + + if (codesetp) + { + const char *codeset = *codesetp; + + if (codeset == NULL) + /* The current binding has be to returned. */ + *codesetp = binding->codeset; + else + { + /* The domain is already bound. If the new value and the old + one are equal we simply do nothing. Otherwise replace the + old binding. */ + char *result = binding->codeset; + if (result == NULL || strcmp (codeset, result) != 0) + { +#if defined _LIBC || defined HAVE_STRDUP + result = strdup (codeset); +#else + size_t len = strlen (codeset) + 1; + result = (char *) malloc (len); + if (__builtin_expect (result != NULL, 1)) + memcpy (result, codeset, len); +#endif + + if (__builtin_expect (result != NULL, 1)) + { + if (binding->codeset != NULL) + free (binding->codeset); + + binding->codeset = result; + binding->codeset_cntr++; + modified = 1; + } + } + *codesetp = result; + } + } + } + else if ((dirnamep == NULL || *dirnamep == NULL) + && (codesetp == NULL || *codesetp == NULL)) + { + /* Simply return the default values. */ + if (dirnamep) + *dirnamep = _nl_default_dirname; + if (codesetp) + *codesetp = NULL; + } + else + { + /* We have to create a new binding. */ + size_t len = strlen (domainname) + 1; + struct binding *new_binding = + (struct binding *) malloc (offsetof (struct binding, domainname) + len); + + if (__builtin_expect (new_binding == NULL, 0)) + goto failed; + + memcpy (new_binding->domainname, domainname, len); + + if (dirnamep) + { + const char *dirname = *dirnamep; + + if (dirname == NULL) + /* The default value. */ + dirname = _nl_default_dirname; + else + { + if (strcmp (dirname, _nl_default_dirname) == 0) + dirname = _nl_default_dirname; + else + { + char *result; +#if defined _LIBC || defined HAVE_STRDUP + result = strdup (dirname); + if (__builtin_expect (result == NULL, 0)) + goto failed_dirname; +#else + size_t len = strlen (dirname) + 1; + result = (char *) malloc (len); + if (__builtin_expect (result == NULL, 0)) + goto failed_dirname; + memcpy (result, dirname, len); +#endif + dirname = result; + } + } + *dirnamep = dirname; + new_binding->dirname = (char *) dirname; + } + else + /* The default value. */ + new_binding->dirname = (char *) _nl_default_dirname; + + new_binding->codeset_cntr = 0; + + if (codesetp) + { + const char *codeset = *codesetp; + + if (codeset != NULL) + { + char *result; + +#if defined _LIBC || defined HAVE_STRDUP + result = strdup (codeset); + if (__builtin_expect (result == NULL, 0)) + goto failed_codeset; +#else + size_t len = strlen (codeset) + 1; + result = (char *) malloc (len); + if (__builtin_expect (result == NULL, 0)) + goto failed_codeset; + memcpy (result, codeset, len); +#endif + codeset = result; + new_binding->codeset_cntr++; + } + *codesetp = codeset; + new_binding->codeset = (char *) codeset; + } + else + new_binding->codeset = NULL; + + /* Now enqueue it. */ + if (_nl_domain_bindings == NULL + || strcmp (domainname, _nl_domain_bindings->domainname) < 0) + { + new_binding->next = _nl_domain_bindings; + _nl_domain_bindings = new_binding; + } + else + { + binding = _nl_domain_bindings; + while (binding->next != NULL + && strcmp (domainname, binding->next->domainname) > 0) + binding = binding->next; + + new_binding->next = binding->next; + binding->next = new_binding; + } + + modified = 1; + + /* Here we deal with memory allocation failures. */ + if (0) + { + failed_codeset: + if (new_binding->dirname != _nl_default_dirname) + free (new_binding->dirname); + failed_dirname: + free (new_binding); + failed: + if (dirnamep) + *dirnamep = NULL; + if (codesetp) + *codesetp = NULL; + } + } + + /* If we modified any binding, we flush the caches. */ + if (modified) + ++_nl_msg_cat_cntr; + + __libc_rwlock_unlock (_nl_state_lock); +} + +/* Specify that the DOMAINNAME message catalog will be found + in DIRNAME rather than in the system locale data base. */ +char * +BINDTEXTDOMAIN (domainname, dirname) + const char *domainname; + const char *dirname; +{ + set_binding_values (domainname, &dirname, NULL); + return (char *) dirname; +} + +/* Specify the character encoding in which the messages from the + DOMAINNAME message catalog will be returned. */ +char * +BIND_TEXTDOMAIN_CODESET (domainname, codeset) + const char *domainname; + const char *codeset; +{ + set_binding_values (domainname, NULL, &codeset); + return (char *) codeset; +} + +#ifdef _LIBC +/* Aliases for function names in GNU C Library. */ +weak_alias (__bindtextdomain, bindtextdomain); +weak_alias (__bind_textdomain_codeset, bind_textdomain_codeset); +#endif diff --git a/intl/config.charset b/intl/config.charset new file mode 100755 index 0000000..631c573 --- /dev/null +++ b/intl/config.charset @@ -0,0 +1,440 @@ +#! /bin/sh +# Output a system dependent table of character encoding aliases. +# +# Copyright (C) 2000-2002 Free Software Foundation, Inc. +# +# This program 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, 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, +# USA. +# +# The table consists of lines of the form +# ALIAS CANONICAL +# +# ALIAS is the (system dependent) result of "nl_langinfo (CODESET)". +# ALIAS is compared in a case sensitive way. +# +# CANONICAL is the GNU canonical name for this character encoding. +# It must be an encoding supported by libiconv. Support by GNU libc is +# also desirable. CANONICAL is case insensitive. Usually an upper case +# MIME charset name is preferred. +# The current list of GNU canonical charset names is as follows. +# +# name used by which systems a MIME name? +# ASCII, ANSI_X3.4-1968 glibc solaris freebsd +# ISO-8859-1 glibc aix hpux irix osf solaris freebsd yes +# ISO-8859-2 glibc aix hpux irix osf solaris freebsd yes +# ISO-8859-3 glibc yes +# ISO-8859-4 osf solaris freebsd yes +# ISO-8859-5 glibc aix hpux irix osf solaris freebsd yes +# ISO-8859-6 glibc aix hpux solaris yes +# ISO-8859-7 glibc aix hpux irix osf solaris yes +# ISO-8859-8 glibc aix hpux osf solaris yes +# ISO-8859-9 glibc aix hpux irix osf solaris yes +# ISO-8859-13 glibc +# ISO-8859-15 glibc aix osf solaris freebsd +# KOI8-R glibc solaris freebsd yes +# KOI8-U glibc freebsd yes +# CP437 dos +# CP775 dos +# CP850 aix osf dos +# CP852 dos +# CP855 dos +# CP856 aix +# CP857 dos +# CP861 dos +# CP862 dos +# CP864 dos +# CP865 dos +# CP866 freebsd dos +# CP869 dos +# CP874 win32 dos +# CP922 aix +# CP932 aix win32 dos +# CP943 aix +# CP949 osf win32 dos +# CP950 win32 dos +# CP1046 aix +# CP1124 aix +# CP1129 aix +# CP1250 win32 +# CP1251 glibc win32 +# CP1252 aix win32 +# CP1253 win32 +# CP1254 win32 +# CP1255 win32 +# CP1256 win32 +# CP1257 win32 +# GB2312 glibc aix hpux irix solaris freebsd yes +# EUC-JP glibc aix hpux irix osf solaris freebsd yes +# EUC-KR glibc aix hpux irix osf solaris freebsd yes +# EUC-TW glibc aix hpux irix osf solaris +# BIG5 glibc aix hpux osf solaris freebsd yes +# BIG5-HKSCS glibc +# GBK aix osf win32 dos +# GB18030 glibc +# SHIFT_JIS hpux osf solaris freebsd yes +# JOHAB glibc win32 +# TIS-620 glibc aix hpux osf solaris +# VISCII glibc yes +# HP-ROMAN8 hpux +# HP-ARABIC8 hpux +# HP-GREEK8 hpux +# HP-HEBREW8 hpux +# HP-TURKISH8 hpux +# HP-KANA8 hpux +# DEC-KANJI osf +# DEC-HANYU osf +# UTF-8 glibc aix hpux osf solaris yes +# +# Note: Names which are not marked as being a MIME name should not be used in +# Internet protocols for information interchange (mail, news, etc.). +# +# Note: ASCII and ANSI_X3.4-1968 are synonymous canonical names. Applications +# must understand both names and treat them as equivalent. +# +# The first argument passed to this file is the canonical host specification, +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM + +host="$1" +os=`echo "$host" | sed -e 's/^[^-]*-[^-]*-\(.*\)$/\1/'` +echo "# This file contains a table of character encoding aliases," +echo "# suitable for operating system '${os}'." +echo "# It was automatically generated from config.charset." +# List of references, updated during installation: +echo "# Packages using this file: " +case "$os" in + linux* | *-gnu*) + # With glibc-2.1 or newer, we don't need any canonicalization, + # because glibc has iconv and both glibc and libiconv support all + # GNU canonical names directly. Therefore, the Makefile does not + # need to install the alias file at all. + # The following applies only to glibc-2.0.x and older libcs. + echo "ISO_646.IRV:1983 ASCII" + ;; + aix*) + echo "ISO8859-1 ISO-8859-1" + echo "ISO8859-2 ISO-8859-2" + echo "ISO8859-5 ISO-8859-5" + echo "ISO8859-6 ISO-8859-6" + echo "ISO8859-7 ISO-8859-7" + echo "ISO8859-8 ISO-8859-8" + echo "ISO8859-9 ISO-8859-9" + echo "ISO8859-15 ISO-8859-15" + echo "IBM-850 CP850" + echo "IBM-856 CP856" + echo "IBM-921 ISO-8859-13" + echo "IBM-922 CP922" + echo "IBM-932 CP932" + echo "IBM-943 CP943" + echo "IBM-1046 CP1046" + echo "IBM-1124 CP1124" + echo "IBM-1129 CP1129" + echo "IBM-1252 CP1252" + echo "IBM-eucCN GB2312" + echo "IBM-eucJP EUC-JP" + echo "IBM-eucKR EUC-KR" + echo "IBM-eucTW EUC-TW" + echo "big5 BIG5" + echo "GBK GBK" + echo "TIS-620 TIS-620" + echo "UTF-8 UTF-8" + ;; + hpux*) + echo "iso88591 ISO-8859-1" + echo "iso88592 ISO-8859-2" + echo "iso88595 ISO-8859-5" + echo "iso88596 ISO-8859-6" + echo "iso88597 ISO-8859-7" + echo "iso88598 ISO-8859-8" + echo "iso88599 ISO-8859-9" + echo "iso885915 ISO-8859-15" + echo "roman8 HP-ROMAN8" + echo "arabic8 HP-ARABIC8" + echo "greek8 HP-GREEK8" + echo "hebrew8 HP-HEBREW8" + echo "turkish8 HP-TURKISH8" + echo "kana8 HP-KANA8" + echo "tis620 TIS-620" + echo "big5 BIG5" + echo "eucJP EUC-JP" + echo "eucKR EUC-KR" + echo "eucTW EUC-TW" + echo "hp15CN GB2312" + #echo "ccdc ?" # what is this? + echo "SJIS SHIFT_JIS" + echo "utf8 UTF-8" + ;; + irix*) + echo "ISO8859-1 ISO-8859-1" + echo "ISO8859-2 ISO-8859-2" + echo "ISO8859-5 ISO-8859-5" + echo "ISO8859-7 ISO-8859-7" + echo "ISO8859-9 ISO-8859-9" + echo "eucCN GB2312" + echo "eucJP EUC-JP" + echo "eucKR EUC-KR" + echo "eucTW EUC-TW" + ;; + osf*) + echo "ISO8859-1 ISO-8859-1" + echo "ISO8859-2 ISO-8859-2" + echo "ISO8859-4 ISO-8859-4" + echo "ISO8859-5 ISO-8859-5" + echo "ISO8859-7 ISO-8859-7" + echo "ISO8859-8 ISO-8859-8" + echo "ISO8859-9 ISO-8859-9" + echo "ISO8859-15 ISO-8859-15" + echo "cp850 CP850" + echo "big5 BIG5" + echo "dechanyu DEC-HANYU" + echo "dechanzi GB2312" + echo "deckanji DEC-KANJI" + echo "deckorean EUC-KR" + echo "eucJP EUC-JP" + echo "eucKR EUC-KR" + echo "eucTW EUC-TW" + echo "GBK GBK" + echo "KSC5601 CP949" + echo "sdeckanji EUC-JP" + echo "SJIS SHIFT_JIS" + echo "TACTIS TIS-620" + echo "UTF-8 UTF-8" + ;; + solaris*) + echo "646 ASCII" + echo "ISO8859-1 ISO-8859-1" + echo "ISO8859-2 ISO-8859-2" + echo "ISO8859-4 ISO-8859-4" + echo "ISO8859-5 ISO-8859-5" + echo "ISO8859-6 ISO-8859-6" + echo "ISO8859-7 ISO-8859-7" + echo "ISO8859-8 ISO-8859-8" + echo "ISO8859-9 ISO-8859-9" + echo "ISO8859-15 ISO-8859-15" + echo "koi8-r KOI8-R" + echo "BIG5 BIG5" + echo "gb2312 GB2312" + echo "cns11643 EUC-TW" + echo "5601 EUC-KR" + echo "eucJP EUC-JP" + echo "PCK SHIFT_JIS" + echo "TIS620.2533 TIS-620" + #echo "sun_eu_greek ?" # what is this? + echo "UTF-8 UTF-8" + ;; + freebsd* | os2*) + # FreeBSD 4.2 doesn't have nl_langinfo(CODESET); therefore + # localcharset.c falls back to using the full locale name + # from the environment variables. + # Likewise for OS/2. OS/2 has XFree86 just like FreeBSD. Just + # reuse FreeBSD's locale data for OS/2. + echo "C ASCII" + echo "US-ASCII ASCII" + for l in la_LN lt_LN; do + echo "$l.ASCII ASCII" + done + for l in da_DK de_AT de_CH de_DE en_AU en_CA en_GB en_US es_ES \ + fi_FI fr_BE fr_CA fr_CH fr_FR is_IS it_CH it_IT la_LN \ + lt_LN nl_BE nl_NL no_NO pt_PT sv_SE; do + echo "$l.ISO_8859-1 ISO-8859-1" + echo "$l.DIS_8859-15 ISO-8859-15" + done + for l in cs_CZ hr_HR hu_HU la_LN lt_LN pl_PL sl_SI; do + echo "$l.ISO_8859-2 ISO-8859-2" + done + for l in la_LN lt_LT; do + echo "$l.ISO_8859-4 ISO-8859-4" + done + for l in ru_RU ru_SU; do + echo "$l.KOI8-R KOI8-R" + echo "$l.ISO_8859-5 ISO-8859-5" + echo "$l.CP866 CP866" + done + echo "uk_UA.KOI8-U KOI8-U" + echo "zh_TW.BIG5 BIG5" + echo "zh_TW.Big5 BIG5" + echo "zh_CN.EUC GB2312" + echo "ja_JP.EUC EUC-JP" + echo "ja_JP.SJIS SHIFT_JIS" + echo "ja_JP.Shift_JIS SHIFT_JIS" + echo "ko_KR.EUC EUC-KR" + ;; + beos*) + # BeOS has a single locale, and it has UTF-8 encoding. + echo "* UTF-8" + ;; + msdosdjgpp*) + # DJGPP 2.03 doesn't have nl_langinfo(CODESET); therefore + # localcharset.c falls back to using the full locale name + # from the environment variables. + echo "#" + echo "# The encodings given here may not all be correct." + echo "# If you find that the encoding given for your language and" + echo "# country is not the one your DOS machine actually uses, just" + echo "# correct it in this file, and send a mail to" + echo "# Juan Manuel Guerrero " + echo "# and Bruno Haible ." + echo "#" + echo "C ASCII" + # ISO-8859-1 languages + echo "ca CP850" + echo "ca_ES CP850" + echo "da CP865" # not CP850 ?? + echo "da_DK CP865" # not CP850 ?? + echo "de CP850" + echo "de_AT CP850" + echo "de_CH CP850" + echo "de_DE CP850" + echo "en CP850" + echo "en_AU CP850" # not CP437 ?? + echo "en_CA CP850" + echo "en_GB CP850" + echo "en_NZ CP437" + echo "en_US CP437" + echo "en_ZA CP850" # not CP437 ?? + echo "es CP850" + echo "es_AR CP850" + echo "es_BO CP850" + echo "es_CL CP850" + echo "es_CO CP850" + echo "es_CR CP850" + echo "es_CU CP850" + echo "es_DO CP850" + echo "es_EC CP850" + echo "es_ES CP850" + echo "es_GT CP850" + echo "es_HN CP850" + echo "es_MX CP850" + echo "es_NI CP850" + echo "es_PA CP850" + echo "es_PY CP850" + echo "es_PE CP850" + echo "es_SV CP850" + echo "es_UY CP850" + echo "es_VE CP850" + echo "et CP850" + echo "et_EE CP850" + echo "eu CP850" + echo "eu_ES CP850" + echo "fi CP850" + echo "fi_FI CP850" + echo "fr CP850" + echo "fr_BE CP850" + echo "fr_CA CP850" + echo "fr_CH CP850" + echo "fr_FR CP850" + echo "ga CP850" + echo "ga_IE CP850" + echo "gd CP850" + echo "gd_GB CP850" + echo "gl CP850" + echo "gl_ES CP850" + echo "id CP850" # not CP437 ?? + echo "id_ID CP850" # not CP437 ?? + echo "is CP861" # not CP850 ?? + echo "is_IS CP861" # not CP850 ?? + echo "it CP850" + echo "it_CH CP850" + echo "it_IT CP850" + echo "lt CP775" + echo "lt_LT CP775" + echo "lv CP775" + echo "lv_LV CP775" + echo "nb CP865" # not CP850 ?? + echo "nb_NO CP865" # not CP850 ?? + echo "nl CP850" + echo "nl_BE CP850" + echo "nl_NL CP850" + echo "nn CP865" # not CP850 ?? + echo "nn_NO CP865" # not CP850 ?? + echo "no CP865" # not CP850 ?? + echo "no_NO CP865" # not CP850 ?? + echo "pt CP850" + echo "pt_BR CP850" + echo "pt_PT CP850" + echo "sv CP850" + echo "sv_SE CP850" + # ISO-8859-2 languages + echo "cs CP852" + echo "cs_CZ CP852" + echo "hr CP852" + echo "hr_HR CP852" + echo "hu CP852" + echo "hu_HU CP852" + echo "pl CP852" + echo "pl_PL CP852" + echo "ro CP852" + echo "ro_RO CP852" + echo "sk CP852" + echo "sk_SK CP852" + echo "sl CP852" + echo "sl_SI CP852" + echo "sq CP852" + echo "sq_AL CP852" + echo "sr CP852" # CP852 or CP866 or CP855 ?? + echo "sr_YU CP852" # CP852 or CP866 or CP855 ?? + # ISO-8859-3 languages + echo "mt CP850" + echo "mt_MT CP850" + # ISO-8859-5 languages + echo "be CP866" + echo "be_BE CP866" + echo "bg CP866" # not CP855 ?? + echo "bg_BG CP866" # not CP855 ?? + echo "mk CP866" # not CP855 ?? + echo "mk_MK CP866" # not CP855 ?? + echo "ru KOI8-R" # not CP866 ?? + echo "ru_RU KOI8-R" # not CP866 ?? + # ISO-8859-6 languages + echo "ar CP864" + echo "ar_AE CP864" + echo "ar_DZ CP864" + echo "ar_EG CP864" + echo "ar_IQ CP864" + echo "ar_IR CP864" + echo "ar_JO CP864" + echo "ar_KW CP864" + echo "ar_MA CP864" + echo "ar_OM CP864" + echo "ar_QA CP864" + echo "ar_SA CP864" + echo "ar_SY CP864" + # ISO-8859-7 languages + echo "el CP869" + echo "el_GR CP869" + # ISO-8859-8 languages + echo "he CP862" + echo "he_IL CP862" + # ISO-8859-9 languages + echo "tr CP857" + echo "tr_TR CP857" + # Japanese + echo "ja CP932" + echo "ja_JP CP932" + # Chinese + echo "zh_CN GBK" + echo "zh_TW CP950" # not CP938 ?? + # Korean + echo "kr CP949" # not CP934 ?? + echo "kr_KR CP949" # not CP934 ?? + # Thai + echo "th CP874" + echo "th_TH CP874" + # Other + echo "eo CP850" + echo "eo_EO CP850" + ;; +esac diff --git a/intl/dcgettext.c b/intl/dcgettext.c new file mode 100644 index 0000000..6927c17 --- /dev/null +++ b/intl/dcgettext.c @@ -0,0 +1,58 @@ +/* Implementation of the dcgettext(3) function. + Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc. + + This program 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, 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, + USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "gettextP.h" +#ifdef _LIBC +# include +#else +# include "libgnuintl.h" +#endif + +/* @@ end of prolog @@ */ + +/* Names for the libintl functions are a problem. They must not clash + with existing names and they should follow ANSI C. But this source + code is also used in GNU C Library where the names have a __ + prefix. So we have to make a difference here. */ +#ifdef _LIBC +# define DCGETTEXT __dcgettext +# define DCIGETTEXT __dcigettext +#else +# define DCGETTEXT dcgettext__ +# define DCIGETTEXT dcigettext__ +#endif + +/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY + locale. */ +char * +DCGETTEXT (domainname, msgid, category) + const char *domainname; + const char *msgid; + int category; +{ + return DCIGETTEXT (domainname, msgid, NULL, 0, 0, category); +} + +#ifdef _LIBC +/* Alias for function name in GNU C Library. */ +weak_alias (__dcgettext, dcgettext); +#endif diff --git a/intl/dcigettext.c b/intl/dcigettext.c new file mode 100644 index 0000000..b5bc7e3 --- /dev/null +++ b/intl/dcigettext.c @@ -0,0 +1,1167 @@ +/* Implementation of the internal dcigettext function. + Copyright (C) 1995-1999, 2000-2002 Free Software Foundation, Inc. + + This program 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, 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, + USA. */ + +/* Tell glibc's to provide a prototype for mempcpy(). + This must come before because may include + , and once has been included, it's too late. */ +#ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#ifdef __GNUC__ +# define alloca __builtin_alloca +# define HAVE_ALLOCA 1 +#else +# if defined HAVE_ALLOCA_H || defined _LIBC +# include +# else +# ifdef _AIX + #pragma alloca +# else +# ifndef alloca +char *alloca (); +# endif +# endif +# endif +#endif + +#include +#ifndef errno +extern int errno; +#endif +#ifndef __set_errno +# define __set_errno(val) errno = (val) +#endif + +#include +#include +#include + +#if defined HAVE_UNISTD_H || defined _LIBC +# include +#endif + +#include + +#if defined HAVE_SYS_PARAM_H || defined _LIBC +# include +#endif + +#include "gettextP.h" +#include "plural-exp.h" +#ifdef _LIBC +# include +#else +# include "libgnuintl.h" +#endif +#include "hash-string.h" + +/* Thread safetyness. */ +#ifdef _LIBC +# include +#else +/* Provide dummy implementation if this is outside glibc. */ +# define __libc_lock_define_initialized(CLASS, NAME) +# define __libc_lock_lock(NAME) +# define __libc_lock_unlock(NAME) +# define __libc_rwlock_define_initialized(CLASS, NAME) +# define __libc_rwlock_rdlock(NAME) +# define __libc_rwlock_unlock(NAME) +#endif + +/* Alignment of types. */ +#if defined __GNUC__ && __GNUC__ >= 2 +# define alignof(TYPE) __alignof__ (TYPE) +#else +# define alignof(TYPE) \ + ((int) &((struct { char dummy1; TYPE dummy2; } *) 0)->dummy2) +#endif + +/* The internal variables in the standalone libintl.a must have different + names than the internal variables in GNU libc, otherwise programs + using libintl.a cannot be linked statically. */ +#if !defined _LIBC +# define _nl_default_default_domain _nl_default_default_domain__ +# define _nl_current_default_domain _nl_current_default_domain__ +# define _nl_default_dirname _nl_default_dirname__ +# define _nl_domain_bindings _nl_domain_bindings__ +#endif + +/* Some compilers, like SunOS4 cc, don't have offsetof in . */ +#ifndef offsetof +# define offsetof(type,ident) ((size_t)&(((type*)0)->ident)) +#endif + +/* @@ end of prolog @@ */ + +#ifdef _LIBC +/* Rename the non ANSI C functions. This is required by the standard + because some ANSI C functions will require linking with this object + file and the name space must not be polluted. */ +# define getcwd __getcwd +# ifndef stpcpy +# define stpcpy __stpcpy +# endif +# define tfind __tfind +#else +# if !defined HAVE_GETCWD +char *getwd (); +# define getcwd(buf, max) getwd (buf) +# else +char *getcwd (); +# endif +# ifndef HAVE_STPCPY +static char *stpcpy PARAMS ((char *dest, const char *src)); +# endif +# ifndef HAVE_MEMPCPY +static void *mempcpy PARAMS ((void *dest, const void *src, size_t n)); +# endif +#endif + +/* Amount to increase buffer size by in each try. */ +#define PATH_INCR 32 + +/* The following is from pathmax.h. */ +/* Non-POSIX BSD systems might have gcc's limits.h, which doesn't define + PATH_MAX but might cause redefinition warnings when sys/param.h is + later included (as on MORE/BSD 4.3). */ +#if defined _POSIX_VERSION || (defined HAVE_LIMITS_H && !defined __GNUC__) +# include +#endif + +#ifndef _POSIX_PATH_MAX +# define _POSIX_PATH_MAX 255 +#endif + +#if !defined PATH_MAX && defined _PC_PATH_MAX +# define PATH_MAX (pathconf ("/", _PC_PATH_MAX) < 1 ? 1024 : pathconf ("/", _PC_PATH_MAX)) +#endif + +/* Don't include sys/param.h if it already has been. */ +#if defined HAVE_SYS_PARAM_H && !defined PATH_MAX && !defined MAXPATHLEN +# include +#endif + +#if !defined PATH_MAX && defined MAXPATHLEN +# define PATH_MAX MAXPATHLEN +#endif + +#ifndef PATH_MAX +# define PATH_MAX _POSIX_PATH_MAX +#endif + +/* Pathname support. + ISSLASH(C) tests whether C is a directory separator character. + IS_ABSOLUTE_PATH(P) tests whether P is an absolute path. If it is not, + it may be concatenated to a directory pathname. + IS_PATH_WITH_DIR(P) tests whether P contains a directory specification. + */ +#if defined _WIN32 || defined __WIN32__ || defined __EMX__ || defined __DJGPP__ + /* Win32, OS/2, DOS */ +# define ISSLASH(C) ((C) == '/' || (C) == '\\') +# define HAS_DEVICE(P) \ + ((((P)[0] >= 'A' && (P)[0] <= 'Z') || ((P)[0] >= 'a' && (P)[0] <= 'z')) \ + && (P)[1] == ':') +# define IS_ABSOLUTE_PATH(P) (ISSLASH ((P)[0]) || HAS_DEVICE (P)) +# define IS_PATH_WITH_DIR(P) \ + (strchr (P, '/') != NULL || strchr (P, '\\') != NULL || HAS_DEVICE (P)) +#else + /* Unix */ +# define ISSLASH(C) ((C) == '/') +# define IS_ABSOLUTE_PATH(P) ISSLASH ((P)[0]) +# define IS_PATH_WITH_DIR(P) (strchr (P, '/') != NULL) +#endif + +/* This is the type used for the search tree where known translations + are stored. */ +struct known_translation_t +{ + /* Domain in which to search. */ + char *domainname; + + /* The category. */ + int category; + + /* State of the catalog counter at the point the string was found. */ + int counter; + + /* Catalog where the string was found. */ + struct loaded_l10nfile *domain; + + /* And finally the translation. */ + const char *translation; + size_t translation_length; + + /* Pointer to the string in question. */ + char msgid[ZERO]; +}; + +/* Root of the search tree with known translations. We can use this + only if the system provides the `tsearch' function family. */ +#if defined HAVE_TSEARCH || defined _LIBC +# include + +static void *root; + +# ifdef _LIBC +# define tsearch __tsearch +# endif + +/* Function to compare two entries in the table of known translations. */ +static int transcmp PARAMS ((const void *p1, const void *p2)); +static int +transcmp (p1, p2) + const void *p1; + const void *p2; +{ + const struct known_translation_t *s1; + const struct known_translation_t *s2; + int result; + + s1 = (const struct known_translation_t *) p1; + s2 = (const struct known_translation_t *) p2; + + result = strcmp (s1->msgid, s2->msgid); + if (result == 0) + { + result = strcmp (s1->domainname, s2->domainname); + if (result == 0) + /* We compare the category last (though this is the cheapest + operation) since it is hopefully always the same (namely + LC_MESSAGES). */ + result = s1->category - s2->category; + } + + return result; +} +#endif + +/* Name of the default domain used for gettext(3) prior any call to + textdomain(3). The default value for this is "messages". */ +const char _nl_default_default_domain[] = "messages"; + +/* Value used as the default domain for gettext(3). */ +const char *_nl_current_default_domain = _nl_default_default_domain; + +/* Contains the default location of the message catalogs. */ +#if defined __EMX__ +extern const char _nl_default_dirname[]; +#else +const char _nl_default_dirname[] = LOCALEDIR; +#endif + +/* List with bindings of specific domains created by bindtextdomain() + calls. */ +struct binding *_nl_domain_bindings; + +/* Prototypes for local functions. */ +static char *plural_lookup PARAMS ((struct loaded_l10nfile *domain, + unsigned long int n, + const char *translation, + size_t translation_len)) + internal_function; +static const char *category_to_name PARAMS ((int category)) internal_function; +static const char *guess_category_value PARAMS ((int category, + const char *categoryname)) + internal_function; + + +/* For those loosing systems which don't have `alloca' we have to add + some additional code emulating it. */ +#ifdef HAVE_ALLOCA +/* Nothing has to be done. */ +# define ADD_BLOCK(list, address) /* nothing */ +# define FREE_BLOCKS(list) /* nothing */ +#else +struct block_list +{ + void *address; + struct block_list *next; +}; +# define ADD_BLOCK(list, addr) \ + do { \ + struct block_list *newp = (struct block_list *) malloc (sizeof (*newp)); \ + /* If we cannot get a free block we cannot add the new element to \ + the list. */ \ + if (newp != NULL) { \ + newp->address = (addr); \ + newp->next = (list); \ + (list) = newp; \ + } \ + } while (0) +# define FREE_BLOCKS(list) \ + do { \ + while (list != NULL) { \ + struct block_list *old = list; \ + list = list->next; \ + free (old); \ + } \ + } while (0) +# undef alloca +# define alloca(size) (malloc (size)) +#endif /* have alloca */ + + +#ifdef _LIBC +/* List of blocks allocated for translations. */ +typedef struct transmem_list +{ + struct transmem_list *next; + char data[ZERO]; +} transmem_block_t; +static struct transmem_list *transmem_list; +#else +typedef unsigned char transmem_block_t; +#endif + + +/* Names for the libintl functions are a problem. They must not clash + with existing names and they should follow ANSI C. But this source + code is also used in GNU C Library where the names have a __ + prefix. So we have to make a difference here. */ +#ifdef _LIBC +# define DCIGETTEXT __dcigettext +#else +# define DCIGETTEXT dcigettext__ +#endif + +/* Lock variable to protect the global data in the gettext implementation. */ +#ifdef _LIBC +__libc_rwlock_define_initialized (, _nl_state_lock) +#endif + +/* Checking whether the binaries runs SUID must be done and glibc provides + easier methods therefore we make a difference here. */ +#ifdef _LIBC +# define ENABLE_SECURE __libc_enable_secure +# define DETERMINE_SECURE +#else +# ifndef HAVE_GETUID +# define getuid() 0 +# endif +# ifndef HAVE_GETGID +# define getgid() 0 +# endif +# ifndef HAVE_GETEUID +# define geteuid() getuid() +# endif +# ifndef HAVE_GETEGID +# define getegid() getgid() +# endif +static int enable_secure; +# define ENABLE_SECURE (enable_secure == 1) +# define DETERMINE_SECURE \ + if (enable_secure == 0) \ + { \ + if (getuid () != geteuid () || getgid () != getegid ()) \ + enable_secure = 1; \ + else \ + enable_secure = -1; \ + } +#endif + +/* Get the function to evaluate the plural expression. */ +#include "eval-plural.h" + +/* Look up MSGID in the DOMAINNAME message catalog for the current + CATEGORY locale and, if PLURAL is nonzero, search over string + depending on the plural form determined by N. */ +char * +DCIGETTEXT (domainname, msgid1, msgid2, plural, n, category) + const char *domainname; + const char *msgid1; + const char *msgid2; + int plural; + unsigned long int n; + int category; +{ +#ifndef HAVE_ALLOCA + struct block_list *block_list = NULL; +#endif + struct loaded_l10nfile *domain; + struct binding *binding; + const char *categoryname; + const char *categoryvalue; + char *dirname, *xdomainname; + char *single_locale; + char *retval; + size_t retlen; + int saved_errno; +#if defined HAVE_TSEARCH || defined _LIBC + struct known_translation_t *search; + struct known_translation_t **foundp = NULL; + size_t msgid_len; +#endif + size_t domainname_len; + + /* If no real MSGID is given return NULL. */ + if (msgid1 == NULL) + return NULL; + + __libc_rwlock_rdlock (_nl_state_lock); + + /* If DOMAINNAME is NULL, we are interested in the default domain. If + CATEGORY is not LC_MESSAGES this might not make much sense but the + definition left this undefined. */ + if (domainname == NULL) + domainname = _nl_current_default_domain; + + /* OS/2 specific: backward compatibility with older libintl versions */ +#ifdef LC_MESSAGES_COMPAT + if (category == LC_MESSAGES_COMPAT) + category = LC_MESSAGES; +#endif + +#if defined HAVE_TSEARCH || defined _LIBC + msgid_len = strlen (msgid1) + 1; + + /* Try to find the translation among those which we found at + some time. */ + search = (struct known_translation_t *) + alloca (offsetof (struct known_translation_t, msgid) + msgid_len); + memcpy (search->msgid, msgid1, msgid_len); + search->domainname = (char *) domainname; + search->category = category; + + foundp = (struct known_translation_t **) tfind (search, &root, transcmp); + if (foundp != NULL && (*foundp)->counter == _nl_msg_cat_cntr) + { + /* Now deal with plural. */ + if (plural) + retval = plural_lookup ((*foundp)->domain, n, (*foundp)->translation, + (*foundp)->translation_length); + else + retval = (char *) (*foundp)->translation; + + __libc_rwlock_unlock (_nl_state_lock); + return retval; + } +#endif + + /* Preserve the `errno' value. */ + saved_errno = errno; + + /* See whether this is a SUID binary or not. */ + DETERMINE_SECURE; + + /* First find matching binding. */ + for (binding = _nl_domain_bindings; binding != NULL; binding = binding->next) + { + int compare = strcmp (domainname, binding->domainname); + if (compare == 0) + /* We found it! */ + break; + if (compare < 0) + { + /* It is not in the list. */ + binding = NULL; + break; + } + } + + if (binding == NULL) + dirname = (char *) _nl_default_dirname; + else if (IS_ABSOLUTE_PATH (binding->dirname)) + dirname = binding->dirname; + else + { + /* We have a relative path. Make it absolute now. */ + size_t dirname_len = strlen (binding->dirname) + 1; + size_t path_max; + char *ret; + + path_max = (unsigned int) PATH_MAX; + path_max += 2; /* The getcwd docs say to do this. */ + + for (;;) + { + dirname = (char *) alloca (path_max + dirname_len); + ADD_BLOCK (block_list, dirname); + + __set_errno (0); + ret = getcwd (dirname, path_max); + if (ret != NULL || errno != ERANGE) + break; + + path_max += path_max / 2; + path_max += PATH_INCR; + } + + if (ret == NULL) + { + /* We cannot get the current working directory. Don't signal an + error but simply return the default string. */ + FREE_BLOCKS (block_list); + __libc_rwlock_unlock (_nl_state_lock); + __set_errno (saved_errno); + return (plural == 0 + ? (char *) msgid1 + /* Use the Germanic plural rule. */ + : n == 1 ? (char *) msgid1 : (char *) msgid2); + } + + stpcpy (stpcpy (strchr (dirname, '\0'), "/"), binding->dirname); + } + + /* Now determine the symbolic name of CATEGORY and its value. */ + categoryname = category_to_name (category); + categoryvalue = guess_category_value (category, categoryname); + + domainname_len = strlen (domainname); + xdomainname = (char *) alloca (strlen (categoryname) + + domainname_len + 5); + ADD_BLOCK (block_list, xdomainname); + + stpcpy (mempcpy (stpcpy (stpcpy (xdomainname, categoryname), "/"), + domainname, domainname_len), + ".mo"); + + /* Creating working area. */ + single_locale = (char *) alloca (strlen (categoryvalue) + 1); + ADD_BLOCK (block_list, single_locale); + + + /* Search for the given string. This is a loop because we perhaps + got an ordered list of languages to consider for the translation. */ + while (1) + { + /* Make CATEGORYVALUE point to the next element of the list. */ + while (categoryvalue[0] != '\0' && categoryvalue[0] == ':') + ++categoryvalue; + if (categoryvalue[0] == '\0') + { + /* The whole contents of CATEGORYVALUE has been searched but + no valid entry has been found. We solve this situation + by implicitly appending a "C" entry, i.e. no translation + will take place. */ + single_locale[0] = 'C'; + single_locale[1] = '\0'; + } + else + { + char *cp = single_locale; + while (categoryvalue[0] != '\0' && categoryvalue[0] != ':') + *cp++ = *categoryvalue++; + *cp = '\0'; + + /* When this is a SUID binary we must not allow accessing files + outside the dedicated directories. */ + if (ENABLE_SECURE && IS_PATH_WITH_DIR (single_locale)) + /* Ingore this entry. */ + continue; + } + + /* If the current locale value is C (or POSIX) we don't load a + domain. Return the MSGID. */ + if (strcmp (single_locale, "C") == 0 + || strcmp (single_locale, "POSIX") == 0) + { + FREE_BLOCKS (block_list); + __libc_rwlock_unlock (_nl_state_lock); + __set_errno (saved_errno); + return (plural == 0 + ? (char *) msgid1 + /* Use the Germanic plural rule. */ + : n == 1 ? (char *) msgid1 : (char *) msgid2); + } + + + /* Find structure describing the message catalog matching the + DOMAINNAME and CATEGORY. */ + domain = _nl_find_domain (dirname, single_locale, xdomainname, binding); + + if (domain != NULL) + { + retval = _nl_find_msg (domain, binding, msgid1, &retlen); + + if (retval == NULL) + { + int cnt; + + for (cnt = 0; domain->successor[cnt] != NULL; ++cnt) + { + retval = _nl_find_msg (domain->successor[cnt], binding, + msgid1, &retlen); + + if (retval != NULL) + { + domain = domain->successor[cnt]; + break; + } + } + } + + if (retval != NULL) + { + /* Found the translation of MSGID1 in domain DOMAIN: + starting at RETVAL, RETLEN bytes. */ + FREE_BLOCKS (block_list); + __set_errno (saved_errno); +#if defined HAVE_TSEARCH || defined _LIBC + if (foundp == NULL) + { + /* Create a new entry and add it to the search tree. */ + struct known_translation_t *newp; + + newp = (struct known_translation_t *) + malloc (offsetof (struct known_translation_t, msgid) + + msgid_len + domainname_len + 1); + if (newp != NULL) + { + newp->domainname = + mempcpy (newp->msgid, msgid1, msgid_len); + memcpy (newp->domainname, domainname, domainname_len + 1); + newp->category = category; + newp->counter = _nl_msg_cat_cntr; + newp->domain = domain; + newp->translation = retval; + newp->translation_length = retlen; + + /* Insert the entry in the search tree. */ + foundp = (struct known_translation_t **) + tsearch (newp, &root, transcmp); + if (foundp == NULL + || __builtin_expect (*foundp != newp, 0)) + /* The insert failed. */ + free (newp); + } + } + else + { + /* We can update the existing entry. */ + (*foundp)->counter = _nl_msg_cat_cntr; + (*foundp)->domain = domain; + (*foundp)->translation = retval; + (*foundp)->translation_length = retlen; + } +#endif + /* Now deal with plural. */ + if (plural) + retval = plural_lookup (domain, n, retval, retlen); + + __libc_rwlock_unlock (_nl_state_lock); + return retval; + } + } + } + /* NOTREACHED */ +} + + +char * +internal_function +_nl_find_msg (domain_file, domainbinding, msgid, lengthp) + struct loaded_l10nfile *domain_file; + struct binding *domainbinding; + const char *msgid; + size_t *lengthp; +{ + struct loaded_domain *domain; + size_t act; + char *result; + size_t resultlen; + + if (domain_file->decided == 0) + _nl_load_domain (domain_file, domainbinding); + + if (domain_file->data == NULL) + return NULL; + + domain = (struct loaded_domain *) domain_file->data; + + /* Locate the MSGID and its translation. */ + if (domain->hash_size > 2 && domain->hash_tab != NULL) + { + /* Use the hashing table. */ + nls_uint32 len = strlen (msgid); + nls_uint32 hash_val = hash_string (msgid); + nls_uint32 idx = hash_val % domain->hash_size; + nls_uint32 incr = 1 + (hash_val % (domain->hash_size - 2)); + + while (1) + { + nls_uint32 nstr = W (domain->must_swap, domain->hash_tab[idx]); + + if (nstr == 0) + /* Hash table entry is empty. */ + return NULL; + + /* Compare msgid with the original string at index nstr-1. + We compare the lengths with >=, not ==, because plural entries + are represented by strings with an embedded NUL. */ + if (W (domain->must_swap, domain->orig_tab[nstr - 1].length) >= len + && (strcmp (msgid, + domain->data + W (domain->must_swap, + domain->orig_tab[nstr - 1].offset)) + == 0)) + { + act = nstr - 1; + goto found; + } + + if (idx >= domain->hash_size - incr) + idx -= domain->hash_size - incr; + else + idx += incr; + } + /* NOTREACHED */ + } + else + { + /* Try the default method: binary search in the sorted array of + messages. */ + size_t top, bottom; + + bottom = 0; + top = domain->nstrings; + while (bottom < top) + { + int cmp_val; + + act = (bottom + top) / 2; + cmp_val = strcmp (msgid, (domain->data + + W (domain->must_swap, + domain->orig_tab[act].offset))); + if (cmp_val < 0) + top = act; + else if (cmp_val > 0) + bottom = act + 1; + else + goto found; + } + /* No translation was found. */ + return NULL; + } + + found: + /* The translation was found at index ACT. If we have to convert the + string to use a different character set, this is the time. */ + result = ((char *) domain->data + + W (domain->must_swap, domain->trans_tab[act].offset)); + resultlen = W (domain->must_swap, domain->trans_tab[act].length) + 1; + +#if defined _LIBC || HAVE_ICONV + if (domain->codeset_cntr + != (domainbinding != NULL ? domainbinding->codeset_cntr : 0)) + { + /* The domain's codeset has changed through bind_textdomain_codeset() + since the message catalog was initialized or last accessed. We + have to reinitialize the converter. */ + _nl_free_domain_conv (domain); + _nl_init_domain_conv (domain_file, domain, domainbinding); + } + + if ( +# ifdef _LIBC + domain->conv != (__gconv_t) -1 +# else +# if HAVE_ICONV + domain->conv != (iconv_t) -1 +# endif +# endif + ) + { + /* We are supposed to do a conversion. First allocate an + appropriate table with the same structure as the table + of translations in the file, where we can put the pointers + to the converted strings in. + There is a slight complication with plural entries. They + are represented by consecutive NUL terminated strings. We + handle this case by converting RESULTLEN bytes, including + NULs. */ + + if (domain->conv_tab == NULL + && ((domain->conv_tab = (char **) calloc (domain->nstrings, + sizeof (char *))) + == NULL)) + /* Mark that we didn't succeed allocating a table. */ + domain->conv_tab = (char **) -1; + + if (__builtin_expect (domain->conv_tab == (char **) -1, 0)) + /* Nothing we can do, no more memory. */ + goto converted; + + if (domain->conv_tab[act] == NULL) + { + /* We haven't used this string so far, so it is not + translated yet. Do this now. */ + /* We use a bit more efficient memory handling. + We allocate always larger blocks which get used over + time. This is faster than many small allocations. */ + __libc_lock_define_initialized (static, lock) +# define INITIAL_BLOCK_SIZE 4080 + static unsigned char *freemem; + static size_t freemem_size; + + const unsigned char *inbuf; + unsigned char *outbuf; + int malloc_count; +# ifndef _LIBC + transmem_block_t *transmem_list = NULL; +# endif + + __libc_lock_lock (lock); + + inbuf = (const unsigned char *) result; + outbuf = freemem + sizeof (size_t); + + malloc_count = 0; + while (1) + { + transmem_block_t *newmem; +# ifdef _LIBC + size_t non_reversible; + int res; + + if (freemem_size < sizeof (size_t)) + goto resize_freemem; + + res = __gconv (domain->conv, + &inbuf, inbuf + resultlen, + &outbuf, + outbuf + freemem_size - sizeof (size_t), + &non_reversible); + + if (res == __GCONV_OK || res == __GCONV_EMPTY_INPUT) + break; + + if (res != __GCONV_FULL_OUTPUT) + { + __libc_lock_unlock (lock); + goto converted; + } + + inbuf = result; +# else +# if HAVE_ICONV + const char *inptr = (const char *) inbuf; + size_t inleft = resultlen; + char *outptr = (char *) outbuf; + size_t outleft; + + if (freemem_size < sizeof (size_t)) + goto resize_freemem; + + outleft = freemem_size - sizeof (size_t); + if (iconv (domain->conv, + (ICONV_CONST char **) &inptr, &inleft, + &outptr, &outleft) + != (size_t) (-1)) + { + outbuf = (unsigned char *) outptr; + break; + } + if (errno != E2BIG) + { + __libc_lock_unlock (lock); + goto converted; + } +# endif +# endif + + resize_freemem: + /* We must allocate a new buffer or resize the old one. */ + if (malloc_count > 0) + { + ++malloc_count; + freemem_size = malloc_count * INITIAL_BLOCK_SIZE; + newmem = (transmem_block_t *) realloc (transmem_list, + freemem_size); +# ifdef _LIBC + if (newmem != NULL) + transmem_list = transmem_list->next; + else + { + struct transmem_list *old = transmem_list; + + transmem_list = transmem_list->next; + free (old); + } +# endif + } + else + { + malloc_count = 1; + freemem_size = INITIAL_BLOCK_SIZE; + newmem = (transmem_block_t *) malloc (freemem_size); + } + if (__builtin_expect (newmem == NULL, 0)) + { + freemem = NULL; + freemem_size = 0; + __libc_lock_unlock (lock); + goto converted; + } + +# ifdef _LIBC + /* Add the block to the list of blocks we have to free + at some point. */ + newmem->next = transmem_list; + transmem_list = newmem; + + freemem = newmem->data; + freemem_size -= offsetof (struct transmem_list, data); +# else + transmem_list = newmem; + freemem = newmem; +# endif + + outbuf = freemem + sizeof (size_t); + } + + /* We have now in our buffer a converted string. Put this + into the table of conversions. */ + *(size_t *) freemem = outbuf - freemem - sizeof (size_t); + domain->conv_tab[act] = (char *) freemem; + /* Shrink freemem, but keep it aligned. */ + freemem_size -= outbuf - freemem; + freemem = outbuf; + freemem += freemem_size & (alignof (size_t) - 1); + freemem_size = freemem_size & ~ (alignof (size_t) - 1); + + __libc_lock_unlock (lock); + } + + /* Now domain->conv_tab[act] contains the translation of all + the plural variants. */ + result = domain->conv_tab[act] + sizeof (size_t); + resultlen = *(size_t *) domain->conv_tab[act]; + } + + converted: + /* The result string is converted. */ + +#endif /* _LIBC || HAVE_ICONV */ + + *lengthp = resultlen; + return result; +} + + +/* Look up a plural variant. */ +static char * +internal_function +plural_lookup (domain, n, translation, translation_len) + struct loaded_l10nfile *domain; + unsigned long int n; + const char *translation; + size_t translation_len; +{ + struct loaded_domain *domaindata = (struct loaded_domain *) domain->data; + unsigned long int index; + const char *p; + + index = plural_eval (domaindata->plural, n); + if (index >= domaindata->nplurals) + /* This should never happen. It means the plural expression and the + given maximum value do not match. */ + index = 0; + + /* Skip INDEX strings at TRANSLATION. */ + p = translation; + while (index-- > 0) + { +#ifdef _LIBC + p = __rawmemchr (p, '\0'); +#else + p = strchr (p, '\0'); +#endif + /* And skip over the NUL byte. */ + p++; + + if (p >= translation + translation_len) + /* This should never happen. It means the plural expression + evaluated to a value larger than the number of variants + available for MSGID1. */ + return (char *) translation; + } + return (char *) p; +} + + +/* Return string representation of locale CATEGORY. */ +static const char * +internal_function +category_to_name (category) + int category; +{ + const char *retval; + + switch (category) + { +#ifdef LC_COLLATE + case LC_COLLATE: + retval = "LC_COLLATE"; + break; +#endif +#ifdef LC_CTYPE + case LC_CTYPE: + retval = "LC_CTYPE"; + break; +#endif +#ifdef LC_MONETARY + case LC_MONETARY: + retval = "LC_MONETARY"; + break; +#endif +#ifdef LC_NUMERIC + case LC_NUMERIC: + retval = "LC_NUMERIC"; + break; +#endif +#ifdef LC_TIME + case LC_TIME: + retval = "LC_TIME"; + break; +#endif +#ifdef LC_MESSAGES + case LC_MESSAGES: + retval = "LC_MESSAGES"; + break; +#endif +#ifdef LC_RESPONSE + case LC_RESPONSE: + retval = "LC_RESPONSE"; + break; +#endif +#ifdef LC_ALL + case LC_ALL: + /* This might not make sense but is perhaps better than any other + value. */ + retval = "LC_ALL"; + break; +#endif + default: + /* If you have a better idea for a default value let me know. */ + retval = "LC_XXX"; + } + + return retval; +} + +/* Guess value of current locale from value of the environment variables. */ +static const char * +internal_function +guess_category_value (category, categoryname) + int category; + const char *categoryname; +{ + const char *language; + const char *retval; + + /* The highest priority value is the `LANGUAGE' environment + variable. But we don't use the value if the currently selected + locale is the C locale. This is a GNU extension. */ + language = getenv ("LANGUAGE"); + if (language != NULL && language[0] == '\0') + language = NULL; + + /* We have to proceed with the POSIX methods of looking to `LC_ALL', + `LC_xxx', and `LANG'. On some systems this can be done by the + `setlocale' function itself. */ +#ifdef _LIBC + retval = setlocale (category, NULL); +#else + retval = _nl_locale_name (category, categoryname); +#endif + + /* Ignore LANGUAGE if the locale is set to "C" because + 1. "C" locale usually uses the ASCII encoding, and most international + messages use non-ASCII characters. These characters get displayed + as question marks (if using glibc's iconv()) or as invalid 8-bit + characters (because other iconv()s refuse to convert most non-ASCII + characters to ASCII). In any case, the output is ugly. + 2. The precise output of some programs in the "C" locale is specified + by POSIX and should not depend on environment variables like + "LANGUAGE". We allow such programs to use gettext(). */ + return language != NULL && strcmp (retval, "C") != 0 ? language : retval; +} + +/* @@ begin of epilog @@ */ + +/* We don't want libintl.a to depend on any other library. So we + avoid the non-standard function stpcpy. In GNU C Library this + function is available, though. Also allow the symbol HAVE_STPCPY + to be defined. */ +#if !_LIBC && !HAVE_STPCPY +static char * +stpcpy (dest, src) + char *dest; + const char *src; +{ + while ((*dest++ = *src++) != '\0') + /* Do nothing. */ ; + return dest - 1; +} +#endif + +#if !_LIBC && !HAVE_MEMPCPY +static void * +mempcpy (dest, src, n) + void *dest; + const void *src; + size_t n; +{ + return (void *) ((char *) memcpy (dest, src, n) + n); +} +#endif + + +#ifdef _LIBC +/* If we want to free all resources we have to do some work at + program's end. */ +static void __attribute__ ((unused)) +free_mem (void) +{ + void *old; + + while (_nl_domain_bindings != NULL) + { + struct binding *oldp = _nl_domain_bindings; + _nl_domain_bindings = _nl_domain_bindings->next; + if (oldp->dirname != _nl_default_dirname) + /* Yes, this is a pointer comparison. */ + free (oldp->dirname); + free (oldp->codeset); + free (oldp); + } + + if (_nl_current_default_domain != _nl_default_default_domain) + /* Yes, again a pointer comparison. */ + free ((char *) _nl_current_default_domain); + + /* Remove the search tree with the known translations. */ + __tdestroy (root, free); + root = NULL; + + while (transmem_list != NULL) + { + old = transmem_list; + transmem_list = transmem_list->next; + free (old); + } +} + +text_set_element (__libc_subfreeres, free_mem); +#endif diff --git a/intl/dcngettext.c b/intl/dcngettext.c new file mode 100644 index 0000000..2e9d379 --- /dev/null +++ b/intl/dcngettext.c @@ -0,0 +1,60 @@ +/* Implementation of the dcngettext(3) function. + Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc. + + This program 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, 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, + USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "gettextP.h" +#ifdef _LIBC +# include +#else +# include "libgnuintl.h" +#endif + +/* @@ end of prolog @@ */ + +/* Names for the libintl functions are a problem. They must not clash + with existing names and they should follow ANSI C. But this source + code is also used in GNU C Library where the names have a __ + prefix. So we have to make a difference here. */ +#ifdef _LIBC +# define DCNGETTEXT __dcngettext +# define DCIGETTEXT __dcigettext +#else +# define DCNGETTEXT dcngettext__ +# define DCIGETTEXT dcigettext__ +#endif + +/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY + locale. */ +char * +DCNGETTEXT (domainname, msgid1, msgid2, n, category) + const char *domainname; + const char *msgid1; + const char *msgid2; + unsigned long int n; + int category; +{ + return DCIGETTEXT (domainname, msgid1, msgid2, 1, n, category); +} + +#ifdef _LIBC +/* Alias for function name in GNU C Library. */ +weak_alias (__dcngettext, dcngettext); +#endif diff --git a/intl/dgettext.c b/intl/dgettext.c new file mode 100644 index 0000000..2004025 --- /dev/null +++ b/intl/dgettext.c @@ -0,0 +1,59 @@ +/* Implementation of the dgettext(3) function. + Copyright (C) 1995-1997, 2000, 2001 Free Software Foundation, Inc. + + This program 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, 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, + USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#include "gettextP.h" +#ifdef _LIBC +# include +#else +# include "libgnuintl.h" +#endif + +/* @@ end of prolog @@ */ + +/* Names for the libintl functions are a problem. They must not clash + with existing names and they should follow ANSI C. But this source + code is also used in GNU C Library where the names have a __ + prefix. So we have to make a difference here. */ +#ifdef _LIBC +# define DGETTEXT __dgettext +# define DCGETTEXT __dcgettext +#else +# define DGETTEXT dgettext__ +# define DCGETTEXT dcgettext__ +#endif + +/* Look up MSGID in the DOMAINNAME message catalog of the current + LC_MESSAGES locale. */ +char * +DGETTEXT (domainname, msgid) + const char *domainname; + const char *msgid; +{ + return DCGETTEXT (domainname, msgid, LC_MESSAGES); +} + +#ifdef _LIBC +/* Alias for function name in GNU C Library. */ +weak_alias (__dgettext, dgettext); +#endif diff --git a/intl/dngettext.c b/intl/dngettext.c new file mode 100644 index 0000000..7d25b11 --- /dev/null +++ b/intl/dngettext.c @@ -0,0 +1,61 @@ +/* Implementation of the dngettext(3) function. + Copyright (C) 1995-1997, 2000, 2001 Free Software Foundation, Inc. + + This program 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, 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, + USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#include "gettextP.h" +#ifdef _LIBC +# include +#else +# include "libgnuintl.h" +#endif + +/* @@ end of prolog @@ */ + +/* Names for the libintl functions are a problem. They must not clash + with existing names and they should follow ANSI C. But this source + code is also used in GNU C Library where the names have a __ + prefix. So we have to make a difference here. */ +#ifdef _LIBC +# define DNGETTEXT __dngettext +# define DCNGETTEXT __dcngettext +#else +# define DNGETTEXT dngettext__ +# define DCNGETTEXT dcngettext__ +#endif + +/* Look up MSGID in the DOMAINNAME message catalog of the current + LC_MESSAGES locale and skip message according to the plural form. */ +char * +DNGETTEXT (domainname, msgid1, msgid2, n) + const char *domainname; + const char *msgid1; + const char *msgid2; + unsigned long int n; +{ + return DCNGETTEXT (domainname, msgid1, msgid2, n, LC_MESSAGES); +} + +#ifdef _LIBC +/* Alias for function name in GNU C Library. */ +weak_alias (__dngettext, dngettext); +#endif diff --git a/intl/eval-plural.h b/intl/eval-plural.h new file mode 100644 index 0000000..3d5fe8e --- /dev/null +++ b/intl/eval-plural.h @@ -0,0 +1,105 @@ +/* Plural expression evaluation. + Copyright (C) 2000, 2001 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifndef STATIC +#define STATIC static +#endif + +/* Evaluate the plural expression and return an index value. */ +STATIC unsigned long int plural_eval PARAMS ((struct expression *pexp, + unsigned long int n)) + internal_function; + +STATIC +unsigned long int +internal_function +plural_eval (pexp, n) + struct expression *pexp; + unsigned long int n; +{ + switch (pexp->nargs) + { + case 0: + switch (pexp->operation) + { + case var: + return n; + case num: + return pexp->val.num; + default: + break; + } + /* NOTREACHED */ + break; + case 1: + { + /* pexp->operation must be lnot. */ + unsigned long int arg = plural_eval (pexp->val.args[0], n); + return ! arg; + } + case 2: + { + unsigned long int leftarg = plural_eval (pexp->val.args[0], n); + if (pexp->operation == lor) + return leftarg || plural_eval (pexp->val.args[1], n); + else if (pexp->operation == land) + return leftarg && plural_eval (pexp->val.args[1], n); + else + { + unsigned long int rightarg = plural_eval (pexp->val.args[1], n); + + switch (pexp->operation) + { + case mult: + return leftarg * rightarg; + case divide: + return leftarg / rightarg; + case module: + return leftarg % rightarg; + case plus: + return leftarg + rightarg; + case minus: + return leftarg - rightarg; + case less_than: + return leftarg < rightarg; + case greater_than: + return leftarg > rightarg; + case less_or_equal: + return leftarg <= rightarg; + case greater_or_equal: + return leftarg >= rightarg; + case equal: + return leftarg == rightarg; + case not_equal: + return leftarg != rightarg; + default: + break; + } + } + /* NOTREACHED */ + break; + } + case 3: + { + /* pexp->operation must be qmop. */ + unsigned long int boolarg = plural_eval (pexp->val.args[0], n); + return plural_eval (pexp->val.args[boolarg ? 1 : 2], n); + } + } + /* NOTREACHED */ + return 0; +} diff --git a/intl/explodename.c b/intl/explodename.c new file mode 100644 index 0000000..c577c54 --- /dev/null +++ b/intl/explodename.c @@ -0,0 +1,192 @@ +/* Copyright (C) 1995-1998, 2000, 2001 Free Software Foundation, Inc. + Contributed by Ulrich Drepper , 1995. + + This program 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, 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, + USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include + +#include "loadinfo.h" + +/* On some strange systems still no definition of NULL is found. Sigh! */ +#ifndef NULL +# if defined __STDC__ && __STDC__ +# define NULL ((void *) 0) +# else +# define NULL 0 +# endif +#endif + +/* @@ end of prolog @@ */ + +char * +_nl_find_language (name) + const char *name; +{ + while (name[0] != '\0' && name[0] != '_' && name[0] != '@' + && name[0] != '+' && name[0] != ',') + ++name; + + return (char *) name; +} + + +int +_nl_explode_name (name, language, modifier, territory, codeset, + normalized_codeset, special, sponsor, revision) + char *name; + const char **language; + const char **modifier; + const char **territory; + const char **codeset; + const char **normalized_codeset; + const char **special; + const char **sponsor; + const char **revision; +{ + enum { undecided, xpg, cen } syntax; + char *cp; + int mask; + + *modifier = NULL; + *territory = NULL; + *codeset = NULL; + *normalized_codeset = NULL; + *special = NULL; + *sponsor = NULL; + *revision = NULL; + + /* Now we determine the single parts of the locale name. First + look for the language. Termination symbols are `_' and `@' if + we use XPG4 style, and `_', `+', and `,' if we use CEN syntax. */ + mask = 0; + syntax = undecided; + *language = cp = name; + cp = _nl_find_language (*language); + + if (*language == cp) + /* This does not make sense: language has to be specified. Use + this entry as it is without exploding. Perhaps it is an alias. */ + cp = strchr (*language, '\0'); + else if (cp[0] == '_') + { + /* Next is the territory. */ + cp[0] = '\0'; + *territory = ++cp; + + while (cp[0] != '\0' && cp[0] != '.' && cp[0] != '@' + && cp[0] != '+' && cp[0] != ',' && cp[0] != '_') + ++cp; + + mask |= TERRITORY; + + if (cp[0] == '.') + { + /* Next is the codeset. */ + syntax = xpg; + cp[0] = '\0'; + *codeset = ++cp; + + while (cp[0] != '\0' && cp[0] != '@') + ++cp; + + mask |= XPG_CODESET; + + if (*codeset != cp && (*codeset)[0] != '\0') + { + *normalized_codeset = _nl_normalize_codeset (*codeset, + cp - *codeset); + if (strcmp (*codeset, *normalized_codeset) == 0) + free ((char *) *normalized_codeset); + else + mask |= XPG_NORM_CODESET; + } + } + } + + if (cp[0] == '@' || (syntax != xpg && cp[0] == '+')) + { + /* Next is the modifier. */ + syntax = cp[0] == '@' ? xpg : cen; + cp[0] = '\0'; + *modifier = ++cp; + + while (syntax == cen && cp[0] != '\0' && cp[0] != '+' + && cp[0] != ',' && cp[0] != '_') + ++cp; + + mask |= XPG_MODIFIER | CEN_AUDIENCE; + } + + if (syntax != xpg && (cp[0] == '+' || cp[0] == ',' || cp[0] == '_')) + { + syntax = cen; + + if (cp[0] == '+') + { + /* Next is special application (CEN syntax). */ + cp[0] = '\0'; + *special = ++cp; + + while (cp[0] != '\0' && cp[0] != ',' && cp[0] != '_') + ++cp; + + mask |= CEN_SPECIAL; + } + + if (cp[0] == ',') + { + /* Next is sponsor (CEN syntax). */ + cp[0] = '\0'; + *sponsor = ++cp; + + while (cp[0] != '\0' && cp[0] != '_') + ++cp; + + mask |= CEN_SPONSOR; + } + + if (cp[0] == '_') + { + /* Next is revision (CEN syntax). */ + cp[0] = '\0'; + *revision = ++cp; + + mask |= CEN_REVISION; + } + } + + /* For CEN syntax values it might be important to have the + separator character in the file name, not for XPG syntax. */ + if (syntax == xpg) + { + if (*territory != NULL && (*territory)[0] == '\0') + mask &= ~TERRITORY; + + if (*codeset != NULL && (*codeset)[0] == '\0') + mask &= ~XPG_CODESET; + + if (*modifier != NULL && (*modifier)[0] == '\0') + mask &= ~XPG_MODIFIER; + } + + return mask; +} diff --git a/intl/finddomain.c b/intl/finddomain.c new file mode 100644 index 0000000..ca49659 --- /dev/null +++ b/intl/finddomain.c @@ -0,0 +1,198 @@ +/* Handle list of needed message catalogs + Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc. + Written by Ulrich Drepper , 1995. + + This program 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, 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, + USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include + +#if defined HAVE_UNISTD_H || defined _LIBC +# include +#endif + +#include "gettextP.h" +#ifdef _LIBC +# include +#else +# include "libgnuintl.h" +#endif + +/* @@ end of prolog @@ */ +/* List of already loaded domains. */ +static struct loaded_l10nfile *_nl_loaded_domains; + + +/* Return a data structure describing the message catalog described by + the DOMAINNAME and CATEGORY parameters with respect to the currently + established bindings. */ +struct loaded_l10nfile * +internal_function +_nl_find_domain (dirname, locale, domainname, domainbinding) + const char *dirname; + char *locale; + const char *domainname; + struct binding *domainbinding; +{ + struct loaded_l10nfile *retval; + const char *language; + const char *modifier; + const char *territory; + const char *codeset; + const char *normalized_codeset; + const char *special; + const char *sponsor; + const char *revision; + const char *alias_value; + int mask; + + /* LOCALE can consist of up to four recognized parts for the XPG syntax: + + language[_territory[.codeset]][@modifier] + + and six parts for the CEN syntax: + + language[_territory][+audience][+special][,[sponsor][_revision]] + + Beside the first part all of them are allowed to be missing. If + the full specified locale is not found, the less specific one are + looked for. The various parts will be stripped off according to + the following order: + (1) revision + (2) sponsor + (3) special + (4) codeset + (5) normalized codeset + (6) territory + (7) audience/modifier + */ + + /* If we have already tested for this locale entry there has to + be one data set in the list of loaded domains. */ + retval = _nl_make_l10nflist (&_nl_loaded_domains, dirname, + strlen (dirname) + 1, 0, locale, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, domainname, 0); + if (retval != NULL) + { + /* We know something about this locale. */ + int cnt; + + if (retval->decided == 0) + _nl_load_domain (retval, domainbinding); + + if (retval->data != NULL) + return retval; + + for (cnt = 0; retval->successor[cnt] != NULL; ++cnt) + { + if (retval->successor[cnt]->decided == 0) + _nl_load_domain (retval->successor[cnt], domainbinding); + + if (retval->successor[cnt]->data != NULL) + break; + } + return cnt >= 0 ? retval : NULL; + /* NOTREACHED */ + } + + /* See whether the locale value is an alias. If yes its value + *overwrites* the alias name. No test for the original value is + done. */ + alias_value = _nl_expand_alias (locale); + if (alias_value != NULL) + { +#if defined _LIBC || defined HAVE_STRDUP + locale = strdup (alias_value); + if (locale == NULL) + return NULL; +#else + size_t len = strlen (alias_value) + 1; + locale = (char *) malloc (len); + if (locale == NULL) + return NULL; + + memcpy (locale, alias_value, len); +#endif + } + + /* Now we determine the single parts of the locale name. First + look for the language. Termination symbols are `_' and `@' if + we use XPG4 style, and `_', `+', and `,' if we use CEN syntax. */ + mask = _nl_explode_name (locale, &language, &modifier, &territory, + &codeset, &normalized_codeset, &special, + &sponsor, &revision); + + /* Create all possible locale entries which might be interested in + generalization. */ + retval = _nl_make_l10nflist (&_nl_loaded_domains, dirname, + strlen (dirname) + 1, mask, language, territory, + codeset, normalized_codeset, modifier, special, + sponsor, revision, domainname, 1); + if (retval == NULL) + /* This means we are out of core. */ + return NULL; + + if (retval->decided == 0) + _nl_load_domain (retval, domainbinding); + if (retval->data == NULL) + { + int cnt; + for (cnt = 0; retval->successor[cnt] != NULL; ++cnt) + { + if (retval->successor[cnt]->decided == 0) + _nl_load_domain (retval->successor[cnt], domainbinding); + if (retval->successor[cnt]->data != NULL) + break; + } + } + + /* The room for an alias was dynamically allocated. Free it now. */ + if (alias_value != NULL) + free (locale); + + /* The space for normalized_codeset is dynamically allocated. Free it. */ + if (mask & XPG_NORM_CODESET) + free ((void *) normalized_codeset); + + return retval; +} + + +#ifdef _LIBC +static void __attribute__ ((unused)) +free_mem (void) +{ + struct loaded_l10nfile *runp = _nl_loaded_domains; + + while (runp != NULL) + { + struct loaded_l10nfile *here = runp; + if (runp->data != NULL) + _nl_unload_domain ((struct loaded_domain *) runp->data); + runp = runp->next; + free ((char *) here->filename); + free (here); + } +} + +text_set_element (__libc_subfreeres, free_mem); +#endif diff --git a/intl/gettext.c b/intl/gettext.c new file mode 100644 index 0000000..1cedc74 --- /dev/null +++ b/intl/gettext.c @@ -0,0 +1,64 @@ +/* Implementation of gettext(3) function. + Copyright (C) 1995, 1997, 2000, 2001 Free Software Foundation, Inc. + + This program 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, 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, + USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#ifdef _LIBC +# define __need_NULL +# include +#else +# include /* Just for NULL. */ +#endif + +#include "gettextP.h" +#ifdef _LIBC +# include +#else +# include "libgnuintl.h" +#endif + +/* @@ end of prolog @@ */ + +/* Names for the libintl functions are a problem. They must not clash + with existing names and they should follow ANSI C. But this source + code is also used in GNU C Library where the names have a __ + prefix. So we have to make a difference here. */ +#ifdef _LIBC +# define GETTEXT __gettext +# define DCGETTEXT __dcgettext +#else +# define GETTEXT gettext__ +# define DCGETTEXT dcgettext__ +#endif + +/* Look up MSGID in the current default message catalog for the current + LC_MESSAGES locale. If not found, returns MSGID itself (the default + text). */ +char * +GETTEXT (msgid) + const char *msgid; +{ + return DCGETTEXT (NULL, msgid, LC_MESSAGES); +} + +#ifdef _LIBC +/* Alias for function name in GNU C Library. */ +weak_alias (__gettext, gettext); +#endif diff --git a/intl/gettextP.h b/intl/gettextP.h new file mode 100644 index 0000000..332a09d --- /dev/null +++ b/intl/gettextP.h @@ -0,0 +1,201 @@ +/* Header describing internals of libintl library. + Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc. + Written by Ulrich Drepper , 1995. + + This program 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, 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, + USA. */ + +#ifndef _GETTEXTP_H +#define _GETTEXTP_H + +#include /* Get size_t. */ + +#ifdef _LIBC +# include "../iconv/gconv_int.h" +#else +# if HAVE_ICONV +# include +# endif +#endif + +#include "loadinfo.h" + +#include "gmo.h" /* Get nls_uint32. */ + +/* @@ end of prolog @@ */ + +#ifndef PARAMS +# if __STDC__ || defined __GNUC__ || defined __SUNPRO_C || defined __cplusplus || __PROTOTYPES +# define PARAMS(args) args +# else +# define PARAMS(args) () +# endif +#endif + +#ifndef internal_function +# define internal_function +#endif + +/* Tell the compiler when a conditional or integer expression is + almost always true or almost always false. */ +#ifndef HAVE_BUILTIN_EXPECT +# define __builtin_expect(expr, val) (expr) +#endif + +#ifndef W +# define W(flag, data) ((flag) ? SWAP (data) : (data)) +#endif + + +#ifdef _LIBC +# include +# define SWAP(i) bswap_32 (i) +#else +static inline nls_uint32 +SWAP (i) + nls_uint32 i; +{ + return (i << 24) | ((i & 0xff00) << 8) | ((i >> 8) & 0xff00) | (i >> 24); +} +#endif + + +/* The representation of an opened message catalog. */ +struct loaded_domain +{ + const char *data; + int use_mmap; + size_t mmap_size; + int must_swap; + nls_uint32 nstrings; + struct string_desc *orig_tab; + struct string_desc *trans_tab; + nls_uint32 hash_size; + nls_uint32 *hash_tab; + int codeset_cntr; +#ifdef _LIBC + __gconv_t conv; +#else +# if HAVE_ICONV + iconv_t conv; +# endif +#endif + char **conv_tab; + + struct expression *plural; + unsigned long int nplurals; +}; + +/* We want to allocate a string at the end of the struct. But ISO C + doesn't allow zero sized arrays. */ +#ifdef __GNUC__ +# define ZERO 0 +#else +# define ZERO 1 +#endif + +/* A set of settings bound to a message domain. Used to store settings + from bindtextdomain() and bind_textdomain_codeset(). */ +struct binding +{ + struct binding *next; + char *dirname; + int codeset_cntr; /* Incremented each time codeset changes. */ + char *codeset; + char domainname[ZERO]; +}; + +/* A counter which is incremented each time some previous translations + become invalid. + This variable is part of the external ABI of the GNU libintl. */ +extern int _nl_msg_cat_cntr; + +#ifndef _LIBC +const char *_nl_locale_name PARAMS ((int category, const char *categoryname)); +#endif + +struct loaded_l10nfile *_nl_find_domain PARAMS ((const char *__dirname, + char *__locale, + const char *__domainname, + struct binding *__domainbinding)) + internal_function; +void _nl_load_domain PARAMS ((struct loaded_l10nfile *__domain, + struct binding *__domainbinding)) + internal_function; +void _nl_unload_domain PARAMS ((struct loaded_domain *__domain)) + internal_function; +const char *_nl_init_domain_conv PARAMS ((struct loaded_l10nfile *__domain_file, + struct loaded_domain *__domain, + struct binding *__domainbinding)) + internal_function; +void _nl_free_domain_conv PARAMS ((struct loaded_domain *__domain)) + internal_function; + +char *_nl_find_msg PARAMS ((struct loaded_l10nfile *domain_file, + struct binding *domainbinding, + const char *msgid, size_t *lengthp)) + internal_function; + +#ifdef _LIBC +extern char *__gettext PARAMS ((const char *__msgid)); +extern char *__dgettext PARAMS ((const char *__domainname, + const char *__msgid)); +extern char *__dcgettext PARAMS ((const char *__domainname, + const char *__msgid, int __category)); +extern char *__ngettext PARAMS ((const char *__msgid1, const char *__msgid2, + unsigned long int __n)); +extern char *__dngettext PARAMS ((const char *__domainname, + const char *__msgid1, const char *__msgid2, + unsigned long int n)); +extern char *__dcngettext PARAMS ((const char *__domainname, + const char *__msgid1, const char *__msgid2, + unsigned long int __n, int __category)); +extern char *__dcigettext PARAMS ((const char *__domainname, + const char *__msgid1, const char *__msgid2, + int __plural, unsigned long int __n, + int __category)); +extern char *__textdomain PARAMS ((const char *__domainname)); +extern char *__bindtextdomain PARAMS ((const char *__domainname, + const char *__dirname)); +extern char *__bind_textdomain_codeset PARAMS ((const char *__domainname, + const char *__codeset)); +#else +extern char *gettext__ PARAMS ((const char *__msgid)); +extern char *dgettext__ PARAMS ((const char *__domainname, + const char *__msgid)); +extern char *dcgettext__ PARAMS ((const char *__domainname, + const char *__msgid, int __category)); +extern char *ngettext__ PARAMS ((const char *__msgid1, const char *__msgid2, + unsigned long int __n)); +extern char *dngettext__ PARAMS ((const char *__domainname, + const char *__msgid1, const char *__msgid2, + unsigned long int __n)); +extern char *dcngettext__ PARAMS ((const char *__domainname, + const char *__msgid1, const char *__msgid2, + unsigned long int __n, int __category)); +extern char *dcigettext__ PARAMS ((const char *__domainname, + const char *__msgid1, const char *__msgid2, + int __plural, unsigned long int __n, + int __category)); +extern char *textdomain__ PARAMS ((const char *__domainname)); +extern char *bindtextdomain__ PARAMS ((const char *__domainname, + const char *__dirname)); +extern char *bind_textdomain_codeset__ PARAMS ((const char *__domainname, + const char *__codeset)); +#endif + +/* @@ begin of epilog @@ */ + +#endif /* gettextP.h */ diff --git a/intl/gmo.h b/intl/gmo.h new file mode 100644 index 0000000..8c677e4 --- /dev/null +++ b/intl/gmo.h @@ -0,0 +1,100 @@ +/* Description of GNU message catalog format: general file layout. + Copyright (C) 1995, 1997, 2000, 2001 Free Software Foundation, Inc. + + This program 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, 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, + USA. */ + +#ifndef _GETTEXT_H +#define _GETTEXT_H 1 + +#include + +/* @@ end of prolog @@ */ + +/* The magic number of the GNU message catalog format. */ +#define _MAGIC 0x950412de +#define _MAGIC_SWAPPED 0xde120495 + +/* Revision number of the currently used .mo (binary) file format. */ +#define MO_REVISION_NUMBER 0 + +/* The following contortions are an attempt to use the C preprocessor + to determine an unsigned integral type that is 32 bits wide. An + alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but + as of version autoconf-2.13, the AC_CHECK_SIZEOF macro doesn't work + when cross-compiling. */ + +#if __STDC__ +# define UINT_MAX_32_BITS 4294967295U +#else +# define UINT_MAX_32_BITS 0xFFFFFFFF +#endif + +/* If UINT_MAX isn't defined, assume it's a 32-bit type. + This should be valid for all systems GNU cares about because + that doesn't include 16-bit systems, and only modern systems + (that certainly have ) have 64+-bit integral types. */ + +#ifndef UINT_MAX +# define UINT_MAX UINT_MAX_32_BITS +#endif + +#if UINT_MAX == UINT_MAX_32_BITS +typedef unsigned nls_uint32; +#else +# if USHRT_MAX == UINT_MAX_32_BITS +typedef unsigned short nls_uint32; +# else +# if ULONG_MAX == UINT_MAX_32_BITS +typedef unsigned long nls_uint32; +# else + /* The following line is intended to throw an error. Using #error is + not portable enough. */ + "Cannot determine unsigned 32-bit data type." +# endif +# endif +#endif + + +/* Header for binary .mo file format. */ +struct mo_file_header +{ + /* The magic number. */ + nls_uint32 magic; + /* The revision number of the file format. */ + nls_uint32 revision; + /* The number of strings pairs. */ + nls_uint32 nstrings; + /* Offset of table with start offsets of original strings. */ + nls_uint32 orig_tab_offset; + /* Offset of table with start offsets of translation strings. */ + nls_uint32 trans_tab_offset; + /* Size of hashing table. */ + nls_uint32 hash_tab_size; + /* Offset of first hashing entry. */ + nls_uint32 hash_tab_offset; +}; + +struct string_desc +{ + /* Length of addressed string. */ + nls_uint32 length; + /* Offset of string in file. */ + nls_uint32 offset; +}; + +/* @@ begin of epilog @@ */ + +#endif /* gettext.h */ diff --git a/intl/hash-string.h b/intl/hash-string.h new file mode 100644 index 0000000..6eab80f --- /dev/null +++ b/intl/hash-string.h @@ -0,0 +1,59 @@ +/* Description of GNU message catalog format: string hashing function. + Copyright (C) 1995, 1997, 1998, 2000, 2001 Free Software Foundation, Inc. + + This program 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, 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, + USA. */ + +/* @@ end of prolog @@ */ + +#ifndef PARAMS +# if __STDC__ || defined __GNUC__ || defined __SUNPRO_C || defined __cplusplus || __PROTOTYPES +# define PARAMS(Args) Args +# else +# define PARAMS(Args) () +# endif +#endif + +/* We assume to have `unsigned long int' value with at least 32 bits. */ +#define HASHWORDBITS 32 + + +/* Defines the so called `hashpjw' function by P.J. Weinberger + [see Aho/Sethi/Ullman, COMPILERS: Principles, Techniques and Tools, + 1986, 1987 Bell Telephone Laboratories, Inc.] */ +static unsigned long int hash_string PARAMS ((const char *__str_param)); + +static inline unsigned long int +hash_string (str_param) + const char *str_param; +{ + unsigned long int hval, g; + const char *str = str_param; + + /* Compute the hash value for the given string. */ + hval = 0; + while (*str != '\0') + { + hval <<= 4; + hval += (unsigned long int) *str++; + g = hval & ((unsigned long int) 0xf << (HASHWORDBITS - 4)); + if (g != 0) + { + hval ^= g >> (HASHWORDBITS - 8); + hval ^= g; + } + } + return hval; +} diff --git a/intl/intl-compat.c b/intl/intl-compat.c new file mode 100644 index 0000000..708a20b --- /dev/null +++ b/intl/intl-compat.c @@ -0,0 +1,166 @@ +/* intl-compat.c - Stub functions to call gettext functions from GNU gettext + Library. + Copyright (C) 1995, 2000, 2001 Software Foundation, Inc. + + This program 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, 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, + USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "libgnuintl.h" +#include "gettextP.h" + +/* @@ end of prolog @@ */ + +/* This file redirects the gettext functions (without prefix or suffix) to + those defined in the included GNU gettext library (with "__" suffix). + It is compiled into libintl when the included GNU gettext library is + configured --with-included-gettext. + + This redirection works also in the case that the system C library or + the system libintl library contain gettext/textdomain/... functions. + If it didn't, we would need to add preprocessor level redirections to + libgnuintl.h of the following form: + +# define gettext gettext__ +# define dgettext dgettext__ +# define dcgettext dcgettext__ +# define ngettext ngettext__ +# define dngettext dngettext__ +# define dcngettext dcngettext__ +# define textdomain textdomain__ +# define bindtextdomain bindtextdomain__ +# define bind_textdomain_codeset bind_textdomain_codeset__ + + How does this redirection work? There are two cases. + A. When libintl.a is linked into an executable, it works because + functions defined in the executable always override functions in + the shared libraries. + B. When libintl.so is used, it works because + 1. those systems defining gettext/textdomain/... in the C library + (namely, Solaris 2.4 and newer, and GNU libc 2.0 and newer) are + ELF systems and define these symbols as weak, thus explicitly + letting other shared libraries override it. + 2. those systems defining gettext/textdomain/... in a standalone + libintl.so library (namely, Solaris 2.3 and newer) have this + shared library in /usr/lib, and the linker will search /usr/lib + *after* the directory where the GNU gettext library is installed. + + A third case, namely when libintl.a is linked into a shared library + whose name is not libintl.so, is not supported. In this case, on + Solaris, when -lintl precedes the linker option for the shared library + containing GNU gettext, the system's gettext would indeed override + the GNU gettext. Anyone doing this kind of stuff must be clever enough + to 1. compile libintl.a with -fPIC, 2. remove -lintl from his linker + command line. */ + + +#undef gettext +#undef dgettext +#undef dcgettext +#undef ngettext +#undef dngettext +#undef dcngettext +#undef textdomain +#undef bindtextdomain +#undef bind_textdomain_codeset + + +char * +gettext (msgid) + const char *msgid; +{ + return gettext__ (msgid); +} + + +char * +dgettext (domainname, msgid) + const char *domainname; + const char *msgid; +{ + return dgettext__ (domainname, msgid); +} + + +char * +dcgettext (domainname, msgid, category) + const char *domainname; + const char *msgid; + int category; +{ + return dcgettext__ (domainname, msgid, category); +} + + +char * +ngettext (msgid1, msgid2, n) + const char *msgid1; + const char *msgid2; + unsigned long int n; +{ + return ngettext__ (msgid1, msgid2, n); +} + + +char * +dngettext (domainname, msgid1, msgid2, n) + const char *domainname; + const char *msgid1; + const char *msgid2; + unsigned long int n; +{ + return dngettext__ (domainname, msgid1, msgid2, n); +} + + +char * +dcngettext (domainname, msgid1, msgid2, n, category) + const char *domainname; + const char *msgid1; + const char *msgid2; + unsigned long int n; + int category; +{ + return dcngettext__ (domainname, msgid1, msgid2, n, category); +} + + +char * +textdomain (domainname) + const char *domainname; +{ + return textdomain__ (domainname); +} + + +char * +bindtextdomain (domainname, dirname) + const char *domainname; + const char *dirname; +{ + return bindtextdomain__ (domainname, dirname); +} + + +char * +bind_textdomain_codeset (domainname, codeset) + const char *domainname; + const char *codeset; +{ + return bind_textdomain_codeset__ (domainname, codeset); +} diff --git a/intl/l10nflist.c b/intl/l10nflist.c new file mode 100644 index 0000000..c21554a --- /dev/null +++ b/intl/l10nflist.c @@ -0,0 +1,400 @@ +/* Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc. + Contributed by Ulrich Drepper , 1995. + + This program 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, 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, + USA. */ + +/* Tell glibc's to provide a prototype for stpcpy(). + This must come before because may include + , and once has been included, it's too late. */ +#ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#if defined _LIBC || defined HAVE_ARGZ_H +# include +#endif +#include +#include +#include + +#include "loadinfo.h" + +/* On some strange systems still no definition of NULL is found. Sigh! */ +#ifndef NULL +# if defined __STDC__ && __STDC__ +# define NULL ((void *) 0) +# else +# define NULL 0 +# endif +#endif + +/* @@ end of prolog @@ */ + +#ifdef _LIBC +/* Rename the non ANSI C functions. This is required by the standard + because some ANSI C functions will require linking with this object + file and the name space must not be polluted. */ +# ifndef stpcpy +# define stpcpy(dest, src) __stpcpy(dest, src) +# endif +#else +# ifndef HAVE_STPCPY +static char *stpcpy PARAMS ((char *dest, const char *src)); +# endif +#endif + +/* Define function which are usually not available. */ + +#if !defined _LIBC && !defined HAVE___ARGZ_COUNT +/* Returns the number of strings in ARGZ. */ +static size_t argz_count__ PARAMS ((const char *argz, size_t len)); + +static size_t +argz_count__ (argz, len) + const char *argz; + size_t len; +{ + size_t count = 0; + while (len > 0) + { + size_t part_len = strlen (argz); + argz += part_len + 1; + len -= part_len + 1; + count++; + } + return count; +} +# undef __argz_count +# define __argz_count(argz, len) argz_count__ (argz, len) +#endif /* !_LIBC && !HAVE___ARGZ_COUNT */ + +#if !defined _LIBC && !defined HAVE___ARGZ_STRINGIFY +/* Make '\0' separated arg vector ARGZ printable by converting all the '\0's + except the last into the character SEP. */ +static void argz_stringify__ PARAMS ((char *argz, size_t len, int sep)); + +static void +argz_stringify__ (argz, len, sep) + char *argz; + size_t len; + int sep; +{ + while (len > 0) + { + size_t part_len = strlen (argz); + argz += part_len; + len -= part_len + 1; + if (len > 0) + *argz++ = sep; + } +} +# undef __argz_stringify +# define __argz_stringify(argz, len, sep) argz_stringify__ (argz, len, sep) +#endif /* !_LIBC && !HAVE___ARGZ_STRINGIFY */ + +#if !defined _LIBC && !defined HAVE___ARGZ_NEXT +static char *argz_next__ PARAMS ((char *argz, size_t argz_len, + const char *entry)); + +static char * +argz_next__ (argz, argz_len, entry) + char *argz; + size_t argz_len; + const char *entry; +{ + if (entry) + { + if (entry < argz + argz_len) + entry = strchr (entry, '\0') + 1; + + return entry >= argz + argz_len ? NULL : (char *) entry; + } + else + if (argz_len > 0) + return argz; + else + return 0; +} +# undef __argz_next +# define __argz_next(argz, len, entry) argz_next__ (argz, len, entry) +#endif /* !_LIBC && !HAVE___ARGZ_NEXT */ + + +/* Return number of bits set in X. */ +static int pop PARAMS ((int x)); + +static inline int +pop (x) + int x; +{ + /* We assume that no more than 16 bits are used. */ + x = ((x & ~0x5555) >> 1) + (x & 0x5555); + x = ((x & ~0x3333) >> 2) + (x & 0x3333); + x = ((x >> 4) + x) & 0x0f0f; + x = ((x >> 8) + x) & 0xff; + + return x; +} + + +struct loaded_l10nfile * +_nl_make_l10nflist (l10nfile_list, dirlist, dirlist_len, mask, language, + territory, codeset, normalized_codeset, modifier, special, + sponsor, revision, filename, do_allocate) + struct loaded_l10nfile **l10nfile_list; + const char *dirlist; + size_t dirlist_len; + int mask; + const char *language; + const char *territory; + const char *codeset; + const char *normalized_codeset; + const char *modifier; + const char *special; + const char *sponsor; + const char *revision; + const char *filename; + int do_allocate; +{ + char *abs_filename; + struct loaded_l10nfile *last = NULL; + struct loaded_l10nfile *retval; + char *cp; + size_t entries; + int cnt; + + /* Allocate room for the full file name. */ + abs_filename = (char *) malloc (dirlist_len + + strlen (language) + + ((mask & TERRITORY) != 0 + ? strlen (territory) + 1 : 0) + + ((mask & XPG_CODESET) != 0 + ? strlen (codeset) + 1 : 0) + + ((mask & XPG_NORM_CODESET) != 0 + ? strlen (normalized_codeset) + 1 : 0) + + (((mask & XPG_MODIFIER) != 0 + || (mask & CEN_AUDIENCE) != 0) + ? strlen (modifier) + 1 : 0) + + ((mask & CEN_SPECIAL) != 0 + ? strlen (special) + 1 : 0) + + (((mask & CEN_SPONSOR) != 0 + || (mask & CEN_REVISION) != 0) + ? (1 + ((mask & CEN_SPONSOR) != 0 + ? strlen (sponsor) + 1 : 0) + + ((mask & CEN_REVISION) != 0 + ? strlen (revision) + 1 : 0)) : 0) + + 1 + strlen (filename) + 1); + + if (abs_filename == NULL) + return NULL; + + retval = NULL; + last = NULL; + + /* Construct file name. */ + memcpy (abs_filename, dirlist, dirlist_len); + __argz_stringify (abs_filename, dirlist_len, PATH_SEPARATOR); + cp = abs_filename + (dirlist_len - 1); + *cp++ = '/'; + cp = stpcpy (cp, language); + + if ((mask & TERRITORY) != 0) + { + *cp++ = '_'; + cp = stpcpy (cp, territory); + } + if ((mask & XPG_CODESET) != 0) + { + *cp++ = '.'; + cp = stpcpy (cp, codeset); + } + if ((mask & XPG_NORM_CODESET) != 0) + { + *cp++ = '.'; + cp = stpcpy (cp, normalized_codeset); + } + if ((mask & (XPG_MODIFIER | CEN_AUDIENCE)) != 0) + { + /* This component can be part of both syntaces but has different + leading characters. For CEN we use `+', else `@'. */ + *cp++ = (mask & CEN_AUDIENCE) != 0 ? '+' : '@'; + cp = stpcpy (cp, modifier); + } + if ((mask & CEN_SPECIAL) != 0) + { + *cp++ = '+'; + cp = stpcpy (cp, special); + } + if ((mask & (CEN_SPONSOR | CEN_REVISION)) != 0) + { + *cp++ = ','; + if ((mask & CEN_SPONSOR) != 0) + cp = stpcpy (cp, sponsor); + if ((mask & CEN_REVISION) != 0) + { + *cp++ = '_'; + cp = stpcpy (cp, revision); + } + } + + *cp++ = '/'; + stpcpy (cp, filename); + + /* Look in list of already loaded domains whether it is already + available. */ + last = NULL; + for (retval = *l10nfile_list; retval != NULL; retval = retval->next) + if (retval->filename != NULL) + { + int compare = strcmp (retval->filename, abs_filename); + if (compare == 0) + /* We found it! */ + break; + if (compare < 0) + { + /* It's not in the list. */ + retval = NULL; + break; + } + + last = retval; + } + + if (retval != NULL || do_allocate == 0) + { + free (abs_filename); + return retval; + } + + retval = (struct loaded_l10nfile *) + malloc (sizeof (*retval) + (__argz_count (dirlist, dirlist_len) + * (1 << pop (mask)) + * sizeof (struct loaded_l10nfile *))); + if (retval == NULL) + return NULL; + + retval->filename = abs_filename; + retval->decided = (__argz_count (dirlist, dirlist_len) != 1 + || ((mask & XPG_CODESET) != 0 + && (mask & XPG_NORM_CODESET) != 0)); + retval->data = NULL; + + if (last == NULL) + { + retval->next = *l10nfile_list; + *l10nfile_list = retval; + } + else + { + retval->next = last->next; + last->next = retval; + } + + entries = 0; + /* If the DIRLIST is a real list the RETVAL entry corresponds not to + a real file. So we have to use the DIRLIST separation mechanism + of the inner loop. */ + cnt = __argz_count (dirlist, dirlist_len) == 1 ? mask - 1 : mask; + for (; cnt >= 0; --cnt) + if ((cnt & ~mask) == 0 + && ((cnt & CEN_SPECIFIC) == 0 || (cnt & XPG_SPECIFIC) == 0) + && ((cnt & XPG_CODESET) == 0 || (cnt & XPG_NORM_CODESET) == 0)) + { + /* Iterate over all elements of the DIRLIST. */ + char *dir = NULL; + + while ((dir = __argz_next ((char *) dirlist, dirlist_len, dir)) + != NULL) + retval->successor[entries++] + = _nl_make_l10nflist (l10nfile_list, dir, strlen (dir) + 1, cnt, + language, territory, codeset, + normalized_codeset, modifier, special, + sponsor, revision, filename, 1); + } + retval->successor[entries] = NULL; + + return retval; +} + +/* Normalize codeset name. There is no standard for the codeset + names. Normalization allows the user to use any of the common + names. The return value is dynamically allocated and has to be + freed by the caller. */ +const char * +_nl_normalize_codeset (codeset, name_len) + const char *codeset; + size_t name_len; +{ + int len = 0; + int only_digit = 1; + char *retval; + char *wp; + size_t cnt; + + for (cnt = 0; cnt < name_len; ++cnt) + if (isalnum ((unsigned char) codeset[cnt])) + { + ++len; + + if (isalpha ((unsigned char) codeset[cnt])) + only_digit = 0; + } + + retval = (char *) malloc ((only_digit ? 3 : 0) + len + 1); + + if (retval != NULL) + { + if (only_digit) + wp = stpcpy (retval, "iso"); + else + wp = retval; + + for (cnt = 0; cnt < name_len; ++cnt) + if (isalpha ((unsigned char) codeset[cnt])) + *wp++ = tolower ((unsigned char) codeset[cnt]); + else if (isdigit ((unsigned char) codeset[cnt])) + *wp++ = codeset[cnt]; + + *wp = '\0'; + } + + return (const char *) retval; +} + + +/* @@ begin of epilog @@ */ + +/* We don't want libintl.a to depend on any other library. So we + avoid the non-standard function stpcpy. In GNU C Library this + function is available, though. Also allow the symbol HAVE_STPCPY + to be defined. */ +#if !_LIBC && !HAVE_STPCPY +static char * +stpcpy (dest, src) + char *dest; + const char *src; +{ + while ((*dest++ = *src++) != '\0') + /* Do nothing. */ ; + return dest - 1; +} +#endif diff --git a/intl/libgnuintl.h b/intl/libgnuintl.h new file mode 100644 index 0000000..6ec0011 --- /dev/null +++ b/intl/libgnuintl.h @@ -0,0 +1,137 @@ +/* Message catalogs for internationalization. + Copyright (C) 1995-1997, 2000, 2001 Free Software Foundation, Inc. + + This program 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, 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, + USA. */ + +#ifndef _LIBINTL_H +#define _LIBINTL_H 1 + +#include + +/* The LC_MESSAGES locale category is the category used by the functions + gettext() and dgettext(). It is specified in POSIX, but not in ANSI C. + On systems that don't define it, use an arbitrary value instead. + On Solaris, defines __LOCALE_H then includes (i.e. + this file!) and then only defines LC_MESSAGES. To avoid a redefinition + warning, don't define LC_MESSAGES in this case. */ +#if !defined LC_MESSAGES && !defined __LOCALE_H +# define LC_MESSAGES 1729 +#endif + +/* We define an additional symbol to signal that we use the GNU + implementation of gettext. */ +#define __USE_GNU_GETTEXT 1 + +/* Resolve a platform specific conflict on DJGPP. GNU gettext takes + precedence over _conio_gettext. */ +#ifdef __DJGPP__ +# undef gettext +# define gettext gettext +#endif + +/* Use _INTL_PARAMS, not PARAMS, in order to avoid clashes with identifiers + used by programs. Similarly, test __PROTOTYPES, not PROTOTYPES. */ +#ifndef _INTL_PARAMS +# if __STDC__ || defined __GNUC__ || defined __SUNPRO_C || defined __cplusplus || __PROTOTYPES +# define _INTL_PARAMS(args) args +# else +# define _INTL_PARAMS(args) () +# endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* Look up MSGID in the current default message catalog for the current + LC_MESSAGES locale. If not found, returns MSGID itself (the default + text). */ +extern char *gettext _INTL_PARAMS ((const char *__msgid)); + +/* Look up MSGID in the DOMAINNAME message catalog for the current + LC_MESSAGES locale. */ +extern char *dgettext _INTL_PARAMS ((const char *__domainname, + const char *__msgid)); + +/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY + locale. */ +extern char *dcgettext _INTL_PARAMS ((const char *__domainname, + const char *__msgid, + int __category)); + + +/* Similar to `gettext' but select the plural form corresponding to the + number N. */ +extern char *ngettext _INTL_PARAMS ((const char *__msgid1, + const char *__msgid2, + unsigned long int __n)); + +/* Similar to `dgettext' but select the plural form corresponding to the + number N. */ +extern char *dngettext _INTL_PARAMS ((const char *__domainname, + const char *__msgid1, + const char *__msgid2, + unsigned long int __n)); + +/* Similar to `dcgettext' but select the plural form corresponding to the + number N. */ +extern char *dcngettext _INTL_PARAMS ((const char *__domainname, + const char *__msgid1, + const char *__msgid2, + unsigned long int __n, + int __category)); + + +/* Set the current default message catalog to DOMAINNAME. + If DOMAINNAME is null, return the current default. + If DOMAINNAME is "", reset to the default of "messages". */ +extern char *textdomain _INTL_PARAMS ((const char *__domainname)); + +/* Specify that the DOMAINNAME message catalog will be found + in DIRNAME rather than in the system locale data base. */ +extern char *bindtextdomain _INTL_PARAMS ((const char *__domainname, + const char *__dirname)); + +/* Specify the character encoding in which the messages from the + DOMAINNAME message catalog will be returned. */ +extern char *bind_textdomain_codeset _INTL_PARAMS ((const char *__domainname, + const char *__codeset)); + + +/* Optimized version of the functions above. */ +#if defined __OPTIMIZED +/* These are macros, but could also be inline functions. */ + +# define gettext(msgid) \ + dgettext (NULL, msgid) + +# define dgettext(domainname, msgid) \ + dcgettext (domainname, msgid, LC_MESSAGES) + +# define ngettext(msgid1, msgid2, n) \ + dngettext (NULL, msgid1, msgid2, n) + +# define dngettext(domainname, msgid1, msgid2, n) \ + dcngettext (domainname, msgid1, msgid2, n, LC_MESSAGES) + +#endif /* Optimizing. */ + + +#ifdef __cplusplus +} +#endif + +#endif /* libintl.h */ diff --git a/intl/libintl.glibc b/intl/libintl.glibc new file mode 100644 index 0000000..5527d2f --- /dev/null +++ b/intl/libintl.glibc @@ -0,0 +1,116 @@ +/* Message catalogs for internationalization. + Copyright (C) 1995-1999, 2000 Free Software Foundation, Inc. + This file is derived from the file libgettext.h in the GNU gettext package. + + The GNU 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 GNU 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., + 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifndef _LIBINTL_H +#define _LIBINTL_H 1 + +#include + +/* We define an additional symbol to signal that we use the GNU + implementation of gettext. */ +#define __USE_GNU_GETTEXT 1 + +__BEGIN_DECLS + +/* Look up MSGID in the current default message catalog for the current + LC_MESSAGES locale. If not found, returns MSGID itself (the default + text). */ +extern char *gettext (__const char *__msgid) __THROW; + +/* Look up MSGID in the DOMAINNAME message catalog for the current + LC_MESSAGES locale. */ +extern char *dgettext (__const char *__domainname, __const char *__msgid) + __THROW; +extern char *__dgettext (__const char *__domainname, __const char *__msgid) + __THROW __attribute_format_arg__ (2); + +/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY + locale. */ +extern char *dcgettext (__const char *__domainname, + __const char *__msgid, int __category) __THROW; +extern char *__dcgettext (__const char *__domainname, + __const char *__msgid, int __category) + __THROW __attribute_format_arg__ (2); + + +/* Similar to `gettext' but select the plural form corresponding to the + number N. */ +extern char *ngettext (__const char *__msgid1, __const char *__msgid2, + unsigned long int __n) + __THROW __attribute_format_arg__ (1); + +/* Similar to `dgettext' but select the plural form corresponding to the + number N. */ +extern char *dngettext (__const char *__domainname, __const char *__msgid1, + __const char *__msgid2, unsigned long int __n) + __THROW __attribute_format_arg__ (2); + +/* Similar to `dcgettext' but select the plural form corresponding to the + number N. */ +extern char *dcngettext (__const char *__domainname, __const char *__msgid1, + __const char *__msgid2, unsigned long int __n, + int __category) + __THROW __attribute_format_arg__ (2); + + +/* Set the current default message catalog to DOMAINNAME. + If DOMAINNAME is null, return the current default. + If DOMAINNAME is "", reset to the default of "messages". */ +extern char *textdomain (__const char *__domainname) __THROW; + +/* Specify that the DOMAINNAME message catalog will be found + in DIRNAME rather than in the system locale data base. */ +extern char *bindtextdomain (__const char *__domainname, + __const char *__dirname) __THROW; + +/* Specify the character encoding in which the messages from the + DOMAINNAME message catalog will be returned. */ +extern char *bind_textdomain_codeset (__const char *__domainname, + __const char *__codeset) __THROW; + + +/* Optimized version of the function above. */ +#if defined __OPTIMIZE__ + +/* We need NULL for `gettext'. */ +# define __need_NULL +# include + +/* We need LC_MESSAGES for `dgettext'. */ +# include + +/* These must be macros. Inlined functions are useless because the + `__builtin_constant_p' predicate in dcgettext would always return + false. */ + +# define gettext(msgid) dgettext (NULL, msgid) + +# define dgettext(domainname, msgid) \ + dcgettext (domainname, msgid, LC_MESSAGES) + +# define ngettext(msgid1, msgid2, n) dngettext (NULL, msgid1, msgid2, n) + +# define dngettext(domainname, msgid1, msgid2, n) \ + dcngettext (domainname, msgid1, msgid2, n, LC_MESSAGES) + +#endif /* Optimizing. */ + +__END_DECLS + +#endif /* libintl.h */ diff --git a/intl/loadinfo.h b/intl/loadinfo.h new file mode 100644 index 0000000..f2a643b --- /dev/null +++ b/intl/loadinfo.h @@ -0,0 +1,121 @@ +/* Copyright (C) 1996-1999, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + This program 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, 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, + USA. */ + +#ifndef _LOADINFO_H +#define _LOADINFO_H 1 + +/* Declarations of locale dependent catalog lookup functions. + Implemented in + + localealias.c Possibly replace a locale name by another. + explodename.c Split a locale name into its various fields. + l10nflist.c Generate a list of filenames of possible message catalogs. + finddomain.c Find and open the relevant message catalogs. + + The main function _nl_find_domain() in finddomain.c is declared + in gettextP.h. + */ + +#ifndef PARAMS +# if __STDC__ || defined __GNUC__ || defined __SUNPRO_C || defined __cplusplus || __PROTOTYPES +# define PARAMS(args) args +# else +# define PARAMS(args) () +# endif +#endif + +#ifndef internal_function +# define internal_function +#endif + +/* Tell the compiler when a conditional or integer expression is + almost always true or almost always false. */ +#ifndef HAVE_BUILTIN_EXPECT +# define __builtin_expect(expr, val) (expr) +#endif + +/* Separator in PATH like lists of pathnames. */ +#if defined _WIN32 || defined __WIN32__ || defined __EMX__ || defined __DJGPP__ + /* Win32, OS/2, DOS */ +# define PATH_SEPARATOR ';' +#else + /* Unix */ +# define PATH_SEPARATOR ':' +#endif + +/* Encoding of locale name parts. */ +#define CEN_REVISION 1 +#define CEN_SPONSOR 2 +#define CEN_SPECIAL 4 +#define XPG_NORM_CODESET 8 +#define XPG_CODESET 16 +#define TERRITORY 32 +#define CEN_AUDIENCE 64 +#define XPG_MODIFIER 128 + +#define CEN_SPECIFIC (CEN_REVISION|CEN_SPONSOR|CEN_SPECIAL|CEN_AUDIENCE) +#define XPG_SPECIFIC (XPG_CODESET|XPG_NORM_CODESET|XPG_MODIFIER) + + +struct loaded_l10nfile +{ + const char *filename; + int decided; + + const void *data; + + struct loaded_l10nfile *next; + struct loaded_l10nfile *successor[1]; +}; + + +/* Normalize codeset name. There is no standard for the codeset + names. Normalization allows the user to use any of the common + names. The return value is dynamically allocated and has to be + freed by the caller. */ +extern const char *_nl_normalize_codeset PARAMS ((const char *codeset, + size_t name_len)); + +extern struct loaded_l10nfile * +_nl_make_l10nflist PARAMS ((struct loaded_l10nfile **l10nfile_list, + const char *dirlist, size_t dirlist_len, int mask, + const char *language, const char *territory, + const char *codeset, + const char *normalized_codeset, + const char *modifier, const char *special, + const char *sponsor, const char *revision, + const char *filename, int do_allocate)); + + +extern const char *_nl_expand_alias PARAMS ((const char *name)); + +/* normalized_codeset is dynamically allocated and has to be freed by + the caller. */ +extern int _nl_explode_name PARAMS ((char *name, const char **language, + const char **modifier, + const char **territory, + const char **codeset, + const char **normalized_codeset, + const char **special, + const char **sponsor, + const char **revision)); + +extern char *_nl_find_language PARAMS ((const char *name)); + +#endif /* loadinfo.h */ diff --git a/intl/loadmsgcat.c b/intl/loadmsgcat.c new file mode 100644 index 0000000..02abd12 --- /dev/null +++ b/intl/loadmsgcat.c @@ -0,0 +1,445 @@ +/* Load needed message catalogs. + Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc. + + This program 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, 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, + USA. */ + +/* Tell glibc's to provide a prototype for mempcpy(). + This must come before because may include + , and once has been included, it's too late. */ +#ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include + +#ifdef __GNUC__ +# define alloca __builtin_alloca +# define HAVE_ALLOCA 1 +#else +# if defined HAVE_ALLOCA_H || defined _LIBC +# include +# else +# ifdef _AIX + #pragma alloca +# else +# ifndef alloca +char *alloca (); +# endif +# endif +# endif +#endif + +#include +#include + +#if defined HAVE_UNISTD_H || defined _LIBC +# include +#endif + +#ifdef _LIBC +# include +# include +#endif + +#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \ + || (defined _LIBC && defined _POSIX_MAPPED_FILES) +# include +# undef HAVE_MMAP +# define HAVE_MMAP 1 +#else +# undef HAVE_MMAP +#endif + +#include "gmo.h" +#include "gettextP.h" +#include "plural-exp.h" + +#ifdef _LIBC +# include "../locale/localeinfo.h" +#endif + +/* @@ end of prolog @@ */ + +#ifdef _LIBC +/* Rename the non ISO C functions. This is required by the standard + because some ISO C functions will require linking with this object + file and the name space must not be polluted. */ +# define open __open +# define close __close +# define read __read +# define mmap __mmap +# define munmap __munmap +#endif + +/* For those losing systems which don't have `alloca' we have to add + some additional code emulating it. */ +#ifdef HAVE_ALLOCA +# define freea(p) /* nothing */ +#else +# define alloca(n) malloc (n) +# define freea(p) free (p) +#endif + +/* For systems that distinguish between text and binary I/O. + O_BINARY is usually declared in . */ +#if !defined O_BINARY && defined _O_BINARY + /* For MSC-compatible compilers. */ +# define O_BINARY _O_BINARY +# define O_TEXT _O_TEXT +#endif +#ifdef __BEOS__ + /* BeOS 5 has O_BINARY and O_TEXT, but they have no effect. */ +# undef O_BINARY +# undef O_TEXT +#endif +/* On reasonable systems, binary I/O is the default. */ +#ifndef O_BINARY +# define O_BINARY 0 +#endif + +/* We need a sign, whether a new catalog was loaded, which can be associated + with all translations. This is important if the translations are + cached by one of GCC's features. */ +int _nl_msg_cat_cntr; + + +/* Initialize the codeset dependent parts of an opened message catalog. + Return the header entry. */ +const char * +internal_function +_nl_init_domain_conv (domain_file, domain, domainbinding) + struct loaded_l10nfile *domain_file; + struct loaded_domain *domain; + struct binding *domainbinding; +{ + /* Find out about the character set the file is encoded with. + This can be found (in textual form) in the entry "". If this + entry does not exist or if this does not contain the `charset=' + information, we will assume the charset matches the one the + current locale and we don't have to perform any conversion. */ + char *nullentry; + size_t nullentrylen; + + /* Preinitialize fields, to avoid recursion during _nl_find_msg. */ + domain->codeset_cntr = + (domainbinding != NULL ? domainbinding->codeset_cntr : 0); +#ifdef _LIBC + domain->conv = (__gconv_t) -1; +#else +# if HAVE_ICONV + domain->conv = (iconv_t) -1; +# endif +#endif + domain->conv_tab = NULL; + + /* Get the header entry. */ + nullentry = _nl_find_msg (domain_file, domainbinding, "", &nullentrylen); + + if (nullentry != NULL) + { +#if defined _LIBC || HAVE_ICONV + const char *charsetstr; + + charsetstr = strstr (nullentry, "charset="); + if (charsetstr != NULL) + { + size_t len; + char *charset; + const char *outcharset; + + charsetstr += strlen ("charset="); + len = strcspn (charsetstr, " \t\n"); + + charset = (char *) alloca (len + 1); +# if defined _LIBC || HAVE_MEMPCPY + *((char *) mempcpy (charset, charsetstr, len)) = '\0'; +# else + memcpy (charset, charsetstr, len); + charset[len] = '\0'; +# endif + + /* The output charset should normally be determined by the + locale. But sometimes the locale is not used or not correctly + set up, so we provide a possibility for the user to override + this. Moreover, the value specified through + bind_textdomain_codeset overrides both. */ + if (domainbinding != NULL && domainbinding->codeset != NULL) + outcharset = domainbinding->codeset; + else + { + outcharset = getenv ("OUTPUT_CHARSET"); + if (outcharset == NULL || outcharset[0] == '\0') + { +# ifdef _LIBC + outcharset = (*_nl_current[LC_CTYPE])->values[_NL_ITEM_INDEX (CODESET)].string; +# else +# if HAVE_ICONV + extern const char *locale_charset PARAMS ((void)); + outcharset = locale_charset (); +# endif +# endif + } + } + +# ifdef _LIBC + /* We always want to use transliteration. */ + outcharset = norm_add_slashes (outcharset, "TRANSLIT"); + charset = norm_add_slashes (charset, NULL); + if (__gconv_open (outcharset, charset, &domain->conv, + GCONV_AVOID_NOCONV) + != __GCONV_OK) + domain->conv = (__gconv_t) -1; +# else +# if HAVE_ICONV + /* When using GNU libc >= 2.2 or GNU libiconv >= 1.5, + we want to use transliteration. */ +# if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || __GLIBC__ > 2 \ + || _LIBICONV_VERSION >= 0x0105 + len = strlen (outcharset); + { + char *tmp = (char *) alloca (len + 10 + 1); + memcpy (tmp, outcharset, len); + memcpy (tmp + len, "//TRANSLIT", 10 + 1); + outcharset = tmp; + } +# endif + domain->conv = iconv_open (outcharset, charset); +# if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || __GLIBC__ > 2 \ + || _LIBICONV_VERSION >= 0x0105 + freea (outcharset); +# endif +# endif +# endif + + freea (charset); + } +#endif /* _LIBC || HAVE_ICONV */ + } + + return nullentry; +} + +/* Frees the codeset dependent parts of an opened message catalog. */ +void +internal_function +_nl_free_domain_conv (domain) + struct loaded_domain *domain; +{ + if (domain->conv_tab != NULL && domain->conv_tab != (char **) -1) + free (domain->conv_tab); + +#ifdef _LIBC + if (domain->conv != (__gconv_t) -1) + __gconv_close (domain->conv); +#else +# if HAVE_ICONV + if (domain->conv != (iconv_t) -1) + iconv_close (domain->conv); +# endif +#endif +} + +/* Load the message catalogs specified by FILENAME. If it is no valid + message catalog do nothing. */ +void +internal_function +_nl_load_domain (domain_file, domainbinding) + struct loaded_l10nfile *domain_file; + struct binding *domainbinding; +{ + int fd; + size_t size; +#ifdef _LIBC + struct stat64 st; +#else + struct stat st; +#endif + struct mo_file_header *data = (struct mo_file_header *) -1; + int use_mmap = 0; + struct loaded_domain *domain; + const char *nullentry; + + domain_file->decided = 1; + domain_file->data = NULL; + + /* Note that it would be useless to store domainbinding in domain_file + because domainbinding might be == NULL now but != NULL later (after + a call to bind_textdomain_codeset). */ + + /* If the record does not represent a valid locale the FILENAME + might be NULL. This can happen when according to the given + specification the locale file name is different for XPG and CEN + syntax. */ + if (domain_file->filename == NULL) + return; + + /* Try to open the addressed file. */ + fd = open (domain_file->filename, O_RDONLY | O_BINARY); + if (fd == -1) + return; + + /* We must know about the size of the file. */ + if ( +#ifdef _LIBC + __builtin_expect (fstat64 (fd, &st) != 0, 0) +#else + __builtin_expect (fstat (fd, &st) != 0, 0) +#endif + || __builtin_expect ((size = (size_t) st.st_size) != st.st_size, 0) + || __builtin_expect (size < sizeof (struct mo_file_header), 0)) + { + /* Something went wrong. */ + close (fd); + return; + } + +#ifdef HAVE_MMAP + /* Now we are ready to load the file. If mmap() is available we try + this first. If not available or it failed we try to load it. */ + data = (struct mo_file_header *) mmap (NULL, size, PROT_READ, + MAP_PRIVATE, fd, 0); + + if (__builtin_expect (data != (struct mo_file_header *) -1, 1)) + { + /* mmap() call was successful. */ + close (fd); + use_mmap = 1; + } +#endif + + /* If the data is not yet available (i.e. mmap'ed) we try to load + it manually. */ + if (data == (struct mo_file_header *) -1) + { + size_t to_read; + char *read_ptr; + + data = (struct mo_file_header *) malloc (size); + if (data == NULL) + return; + + to_read = size; + read_ptr = (char *) data; + do + { + long int nb = (long int) read (fd, read_ptr, to_read); + if (nb <= 0) + { +#ifdef EINTR + if (nb == -1 && errno == EINTR) + continue; +#endif + close (fd); + return; + } + read_ptr += nb; + to_read -= nb; + } + while (to_read > 0); + + close (fd); + } + + /* Using the magic number we can test whether it really is a message + catalog file. */ + if (__builtin_expect (data->magic != _MAGIC && data->magic != _MAGIC_SWAPPED, + 0)) + { + /* The magic number is wrong: not a message catalog file. */ +#ifdef HAVE_MMAP + if (use_mmap) + munmap ((caddr_t) data, size); + else +#endif + free (data); + return; + } + + domain = (struct loaded_domain *) malloc (sizeof (struct loaded_domain)); + if (domain == NULL) + return; + domain_file->data = domain; + + domain->data = (char *) data; + domain->use_mmap = use_mmap; + domain->mmap_size = size; + domain->must_swap = data->magic != _MAGIC; + + /* Fill in the information about the available tables. */ + switch (W (domain->must_swap, data->revision)) + { + case 0: + domain->nstrings = W (domain->must_swap, data->nstrings); + domain->orig_tab = (struct string_desc *) + ((char *) data + W (domain->must_swap, data->orig_tab_offset)); + domain->trans_tab = (struct string_desc *) + ((char *) data + W (domain->must_swap, data->trans_tab_offset)); + domain->hash_size = W (domain->must_swap, data->hash_tab_size); + domain->hash_tab = (nls_uint32 *) + ((char *) data + W (domain->must_swap, data->hash_tab_offset)); + break; + default: + /* This is an invalid revision. */ +#ifdef HAVE_MMAP + if (use_mmap) + munmap ((caddr_t) data, size); + else +#endif + free (data); + free (domain); + domain_file->data = NULL; + return; + } + + /* Now initialize the character set converter from the character set + the file is encoded with (found in the header entry) to the domain's + specified character set or the locale's character set. */ + nullentry = _nl_init_domain_conv (domain_file, domain, domainbinding); + + /* Also look for a plural specification. */ + EXTRACT_PLURAL_EXPRESSION (nullentry, &domain->plural, &domain->nplurals); +} + + +#ifdef _LIBC +void +internal_function +_nl_unload_domain (domain) + struct loaded_domain *domain; +{ + if (domain->plural != &__gettext_germanic_plural) + __gettext_free_exp (domain->plural); + + _nl_free_domain_conv (domain); + +# ifdef _POSIX_MAPPED_FILES + if (domain->use_mmap) + munmap ((caddr_t) domain->data, domain->mmap_size); + else +# endif /* _POSIX_MAPPED_FILES */ + free ((void *) domain->data); + + free (domain); +} +#endif diff --git a/intl/localcharset.c b/intl/localcharset.c new file mode 100644 index 0000000..6a28ecb --- /dev/null +++ b/intl/localcharset.c @@ -0,0 +1,345 @@ +/* Determine a canonical name for the current locale's character encoding. + + Copyright (C) 2000-2002 Free Software Foundation, Inc. + + This program 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, 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, + USA. */ + +/* Written by Bruno Haible . */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#if HAVE_STDDEF_H +# include +#endif + +#include +#if HAVE_STRING_H +# include +#else +# include +#endif +#if HAVE_STDLIB_H +# include +#endif + +#if defined _WIN32 || defined __WIN32__ +# undef WIN32 /* avoid warning on mingw32 */ +# define WIN32 +#endif + +#if defined __EMX__ +/* Assume EMX program runs on OS/2, even if compiled under DOS. */ +# define OS2 +#endif + +#if !defined WIN32 +# if HAVE_LANGINFO_CODESET +# include +# else +# if HAVE_SETLOCALE +# include +# endif +# endif +#elif defined WIN32 +# define WIN32_LEAN_AND_MEAN +# include +#endif +#if defined OS2 +# define INCL_DOS +# include +#endif + +#if defined _WIN32 || defined __WIN32__ || defined __EMX__ || defined __DJGPP__ + /* Win32, OS/2, DOS */ +# define ISSLASH(C) ((C) == '/' || (C) == '\\') +#endif + +#ifndef DIRECTORY_SEPARATOR +# define DIRECTORY_SEPARATOR '/' +#endif + +#ifndef ISSLASH +# define ISSLASH(C) ((C) == DIRECTORY_SEPARATOR) +#endif + +#ifdef HAVE_GETC_UNLOCKED +# undef getc +# define getc getc_unlocked +#endif + +/* The following static variable is declared 'volatile' to avoid a + possible multithread problem in the function get_charset_aliases. If we + are running in a threaded environment, and if two threads initialize + 'charset_aliases' simultaneously, both will produce the same value, + and everything will be ok if the two assignments to 'charset_aliases' + are atomic. But I don't know what will happen if the two assignments mix. */ +#if __STDC__ != 1 +# define volatile /* empty */ +#endif +/* Pointer to the contents of the charset.alias file, if it has already been + read, else NULL. Its format is: + ALIAS_1 '\0' CANONICAL_1 '\0' ... ALIAS_n '\0' CANONICAL_n '\0' '\0' */ +static const char * volatile charset_aliases; + +/* Return a pointer to the contents of the charset.alias file. */ +static const char * +get_charset_aliases () +{ + const char *cp; + + cp = charset_aliases; + if (cp == NULL) + { +#if !defined WIN32 + FILE *fp; + const char *dir = LIBDIR; + const char *base = "charset.alias"; + char *file_name; + + /* Concatenate dir and base into freshly allocated file_name. */ + { + size_t dir_len = strlen (dir); + size_t base_len = strlen (base); + int add_slash = (dir_len > 0 && !ISSLASH (dir[dir_len - 1])); + file_name = (char *) malloc (dir_len + add_slash + base_len + 1); + if (file_name != NULL) + { + memcpy (file_name, dir, dir_len); + if (add_slash) + file_name[dir_len] = DIRECTORY_SEPARATOR; + memcpy (file_name + dir_len + add_slash, base, base_len + 1); + } + } + + if (file_name == NULL || (fp = fopen (file_name, "r")) == NULL) + /* Out of memory or file not found, treat it as empty. */ + cp = ""; + else + { + /* Parse the file's contents. */ + int c; + char buf1[50+1]; + char buf2[50+1]; + char *res_ptr = NULL; + size_t res_size = 0; + size_t l1, l2; + + for (;;) + { + c = getc (fp); + if (c == EOF) + break; + if (c == '\n' || c == ' ' || c == '\t') + continue; + if (c == '#') + { + /* Skip comment, to end of line. */ + do + c = getc (fp); + while (!(c == EOF || c == '\n')); + if (c == EOF) + break; + continue; + } + ungetc (c, fp); + if (fscanf (fp, "%50s %50s", buf1, buf2) < 2) + break; + l1 = strlen (buf1); + l2 = strlen (buf2); + if (res_size == 0) + { + res_size = l1 + 1 + l2 + 1; + res_ptr = (char *) malloc (res_size + 1); + } + else + { + res_size += l1 + 1 + l2 + 1; + res_ptr = (char *) realloc (res_ptr, res_size + 1); + } + if (res_ptr == NULL) + { + /* Out of memory. */ + res_size = 0; + break; + } + strcpy (res_ptr + res_size - (l2 + 1) - (l1 + 1), buf1); + strcpy (res_ptr + res_size - (l2 + 1), buf2); + } + fclose (fp); + if (res_size == 0) + cp = ""; + else + { + *(res_ptr + res_size) = '\0'; + cp = res_ptr; + } + } + + if (file_name != NULL) + free (file_name); + +#else + + /* To avoid the troubles of installing a separate file in the same + directory as the DLL and of retrieving the DLL's directory at + runtime, simply inline the aliases here. */ + +# if defined WIN32 + cp = "CP936" "\0" "GBK" "\0" + "CP1361" "\0" "JOHAB" "\0"; +# endif +#endif + + charset_aliases = cp; + } + + return cp; +} + +/* Determine the current locale's character encoding, and canonicalize it + into one of the canonical names listed in config.charset. + The result must not be freed; it is statically allocated. + If the canonical name cannot be determined, the result is a non-canonical + name. */ + +#ifdef STATIC +STATIC +#endif +const char * +locale_charset () +{ + const char *codeset; + const char *aliases; + +#if !(defined WIN32 || defined OS2) + +# if HAVE_LANGINFO_CODESET + + /* Most systems support nl_langinfo (CODESET) nowadays. */ + codeset = nl_langinfo (CODESET); + +# else + + /* On old systems which lack it, use setlocale or getenv. */ + const char *locale = NULL; + + /* But most old systems don't have a complete set of locales. Some + (like SunOS 4 or DJGPP) have only the C locale. Therefore we don't + use setlocale here; it would return "C" when it doesn't support the + locale name the user has set. */ +# if HAVE_SETLOCALE && 0 + locale = setlocale (LC_CTYPE, NULL); +# endif + if (locale == NULL || locale[0] == '\0') + { + locale = getenv ("LC_ALL"); + if (locale == NULL || locale[0] == '\0') + { + locale = getenv ("LC_CTYPE"); + if (locale == NULL || locale[0] == '\0') + locale = getenv ("LANG"); + } + } + + /* On some old systems, one used to set locale = "iso8859_1". On others, + you set it to "language_COUNTRY.charset". In any case, we resolve it + through the charset.alias file. */ + codeset = locale; + +# endif + +#elif defined WIN32 + + static char buf[2 + 10 + 1]; + + /* Win32 has a function returning the locale's codepage as a number. */ + sprintf (buf, "CP%u", GetACP ()); + codeset = buf; + +#elif defined OS2 + + const char *locale; + static char buf[2 + 10 + 1]; + ULONG cp[3]; + ULONG cplen; + + /* Allow user to override the codeset, as set in the operating system, + with standard language environment variables. */ + locale = getenv ("LC_ALL"); + if (locale == NULL || locale[0] == '\0') + { + locale = getenv ("LC_CTYPE"); + if (locale == NULL || locale[0] == '\0') + locale = getenv ("LANG"); + } + if (locale != NULL && locale[0] != '\0') + { + /* If the locale name contains an encoding after the dot, return it. */ + const char *dot = strchr (locale, '.'); + + if (dot != NULL) + { + const char *modifier; + + dot++; + /* Look for the possible @... trailer and remove it, if any. */ + modifier = strchr (dot, '@'); + if (modifier == NULL) + return dot; + if (modifier - dot < sizeof (buf)) + { + memcpy (buf, dot, modifier - dot); + buf [modifier - dot] = '\0'; + return buf; + } + } + + /* Resolve through the charset.alias file. */ + codeset = locale; + } + else + { + /* OS/2 has a function returning the locale's codepage as a number. */ + if (DosQueryCp (sizeof (cp), cp, &cplen)) + codeset = ""; + else + { + sprintf (buf, "CP%u", cp[0]); + codeset = buf; + } + } + +#endif + + if (codeset == NULL) + /* The canonical name cannot be determined. */ + codeset = ""; + + /* Resolve alias. */ + for (aliases = get_charset_aliases (); + *aliases != '\0'; + aliases += strlen (aliases) + 1, aliases += strlen (aliases) + 1) + if (strcmp (codeset, aliases) == 0 + || (aliases[0] == '*' && aliases[1] == '\0')) + { + codeset = aliases + strlen (aliases) + 1; + break; + } + + return codeset; +} diff --git a/intl/locale.alias b/intl/locale.alias new file mode 100644 index 0000000..0f15635 --- /dev/null +++ b/intl/locale.alias @@ -0,0 +1,78 @@ +# Locale name alias data base. +# Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc. +# +# This program 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, 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, +# USA. + +# The format of this file is the same as for the corresponding file of +# the X Window System, which normally can be found in +# /usr/lib/X11/locale/locale.alias +# A single line contains two fields: an alias and a substitution value. +# All entries are case independent. + +# Note: This file is far from being complete. If you have a value for +# your own site which you think might be useful for others too, share +# it with the rest of us. Send it using the `glibcbug' script to +# bugs@gnu.org. + +# Packages using this file: + +bokmal no_NO.ISO-8859-1 +bokmål no_NO.ISO-8859-1 +catalan ca_ES.ISO-8859-1 +croatian hr_HR.ISO-8859-2 +czech cs_CZ.ISO-8859-2 +danish da_DK.ISO-8859-1 +dansk da_DK.ISO-8859-1 +deutsch de_DE.ISO-8859-1 +dutch nl_NL.ISO-8859-1 +eesti et_EE.ISO-8859-1 +estonian et_EE.ISO-8859-1 +finnish fi_FI.ISO-8859-1 +français fr_FR.ISO-8859-1 +french fr_FR.ISO-8859-1 +galego gl_ES.ISO-8859-1 +galician gl_ES.ISO-8859-1 +german de_DE.ISO-8859-1 +greek el_GR.ISO-8859-7 +hebrew he_IL.ISO-8859-8 +hrvatski hr_HR.ISO-8859-2 +hungarian hu_HU.ISO-8859-2 +icelandic is_IS.ISO-8859-1 +italian it_IT.ISO-8859-1 +japanese ja_JP.eucJP +japanese.euc ja_JP.eucJP +ja_JP ja_JP.eucJP +ja_JP.ujis ja_JP.eucJP +japanese.sjis ja_JP.SJIS +korean ko_KR.eucKR +korean.euc ko_KR.eucKR +ko_KR ko_KR.eucKR +lithuanian lt_LT.ISO-8859-13 +nb_NO no_NO.ISO-8859-1 +nb_NO.ISO-8859-1 no_NO.ISO-8859-1 +norwegian no_NO.ISO-8859-1 +nynorsk nn_NO.ISO-8859-1 +polish pl_PL.ISO-8859-2 +portuguese pt_PT.ISO-8859-1 +romanian ro_RO.ISO-8859-2 +russian ru_RU.ISO-8859-5 +slovak sk_SK.ISO-8859-2 +slovene sl_SI.ISO-8859-2 +slovenian sl_SI.ISO-8859-2 +spanish es_ES.ISO-8859-1 +swedish sv_SE.ISO-8859-1 +thai th_TH.TIS-620 +turkish tr_TR.ISO-8859-9 diff --git a/intl/localealias.c b/intl/localealias.c new file mode 100644 index 0000000..8d620aa --- /dev/null +++ b/intl/localealias.c @@ -0,0 +1,419 @@ +/* Handle aliases for locale names. + Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc. + + This program 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, 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, + USA. */ + +/* Tell glibc's to provide a prototype for mempcpy(). + This must come before because may include + , and once has been included, it's too late. */ +#ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#if defined _LIBC || defined HAVE___FSETLOCKING +# include +#endif +#include + +#ifdef __GNUC__ +# define alloca __builtin_alloca +# define HAVE_ALLOCA 1 +#else +# if defined HAVE_ALLOCA_H || defined _LIBC +# include +# else +# ifdef _AIX + #pragma alloca +# else +# ifndef alloca +char *alloca (); +# endif +# endif +# endif +#endif + +#include +#include + +#include "gettextP.h" + +/* @@ end of prolog @@ */ + +#ifdef _LIBC +/* Rename the non ANSI C functions. This is required by the standard + because some ANSI C functions will require linking with this object + file and the name space must not be polluted. */ +# define strcasecmp __strcasecmp + +# ifndef mempcpy +# define mempcpy __mempcpy +# endif +# define HAVE_MEMPCPY 1 +# define HAVE___FSETLOCKING 1 + +/* We need locking here since we can be called from different places. */ +# include + +__libc_lock_define_initialized (static, lock); +#endif + +#ifndef internal_function +# define internal_function +#endif + +/* Some optimizations for glibc. */ +#ifdef _LIBC +# define FEOF(fp) feof_unlocked (fp) +# define FGETS(buf, n, fp) fgets_unlocked (buf, n, fp) +#else +# define FEOF(fp) feof (fp) +# define FGETS(buf, n, fp) fgets (buf, n, fp) +#endif + +/* For those losing systems which don't have `alloca' we have to add + some additional code emulating it. */ +#ifdef HAVE_ALLOCA +# define freea(p) /* nothing */ +#else +# define alloca(n) malloc (n) +# define freea(p) free (p) +#endif + +#if defined _LIBC_REENTRANT || defined HAVE_FGETS_UNLOCKED +# undef fgets +# define fgets(buf, len, s) fgets_unlocked (buf, len, s) +#endif +#if defined _LIBC_REENTRANT || defined HAVE_FEOF_UNLOCKED +# undef feof +# define feof(s) feof_unlocked (s) +#endif + + +struct alias_map +{ + const char *alias; + const char *value; +}; + + +static char *string_space; +static size_t string_space_act; +static size_t string_space_max; +static struct alias_map *map; +static size_t nmap; +static size_t maxmap; + + +/* Prototypes for local functions. */ +static size_t read_alias_file PARAMS ((const char *fname, int fname_len)) + internal_function; +static int extend_alias_table PARAMS ((void)); +static int alias_compare PARAMS ((const struct alias_map *map1, + const struct alias_map *map2)); + + +const char * +_nl_expand_alias (name) + const char *name; +{ + static const char *locale_alias_path; + struct alias_map *retval; + const char *result = NULL; + size_t added; + +#ifdef _LIBC + __libc_lock_lock (lock); +#endif + + if (locale_alias_path == NULL) + locale_alias_path = LOCALE_ALIAS_PATH; + + do + { + struct alias_map item; + + item.alias = name; + + if (nmap > 0) + retval = (struct alias_map *) bsearch (&item, map, nmap, + sizeof (struct alias_map), + (int (*) PARAMS ((const void *, + const void *)) + ) alias_compare); + else + retval = NULL; + + /* We really found an alias. Return the value. */ + if (retval != NULL) + { + result = retval->value; + break; + } + + /* Perhaps we can find another alias file. */ + added = 0; + while (added == 0 && locale_alias_path[0] != '\0') + { + const char *start; + + while (locale_alias_path[0] == PATH_SEPARATOR) + ++locale_alias_path; + start = locale_alias_path; + + while (locale_alias_path[0] != '\0' + && locale_alias_path[0] != PATH_SEPARATOR) + ++locale_alias_path; + + if (start < locale_alias_path) + added = read_alias_file (start, locale_alias_path - start); + } + } + while (added != 0); + +#ifdef _LIBC + __libc_lock_unlock (lock); +#endif + + return result; +} + + +static size_t +internal_function +read_alias_file (fname, fname_len) + const char *fname; + int fname_len; +{ + FILE *fp; + char *full_fname; + size_t added; + static const char aliasfile[] = "/locale.alias"; + + full_fname = (char *) alloca (fname_len + sizeof aliasfile); +#ifdef HAVE_MEMPCPY + mempcpy (mempcpy (full_fname, fname, fname_len), + aliasfile, sizeof aliasfile); +#else + memcpy (full_fname, fname, fname_len); + memcpy (&full_fname[fname_len], aliasfile, sizeof aliasfile); +#endif + + fp = fopen (full_fname, "r"); + freea (full_fname); + if (fp == NULL) + return 0; + +#ifdef HAVE___FSETLOCKING + /* No threads present. */ + __fsetlocking (fp, FSETLOCKING_BYCALLER); +#endif + + added = 0; + while (!FEOF (fp)) + { + /* It is a reasonable approach to use a fix buffer here because + a) we are only interested in the first two fields + b) these fields must be usable as file names and so must not + be that long + */ + char buf[BUFSIZ]; + char *alias; + char *value; + char *cp; + + if (FGETS (buf, sizeof buf, fp) == NULL) + /* EOF reached. */ + break; + + /* Possibly not the whole line fits into the buffer. Ignore + the rest of the line. */ + if (strchr (buf, '\n') == NULL) + { + char altbuf[BUFSIZ]; + do + if (FGETS (altbuf, sizeof altbuf, fp) == NULL) + /* Make sure the inner loop will be left. The outer loop + will exit at the `feof' test. */ + break; + while (strchr (altbuf, '\n') == NULL); + } + + cp = buf; + /* Ignore leading white space. */ + while (isspace ((unsigned char) cp[0])) + ++cp; + + /* A leading '#' signals a comment line. */ + if (cp[0] != '\0' && cp[0] != '#') + { + alias = cp++; + while (cp[0] != '\0' && !isspace ((unsigned char) cp[0])) + ++cp; + /* Terminate alias name. */ + if (cp[0] != '\0') + *cp++ = '\0'; + + /* Now look for the beginning of the value. */ + while (isspace ((unsigned char) cp[0])) + ++cp; + + if (cp[0] != '\0') + { + size_t alias_len; + size_t value_len; + + value = cp++; + while (cp[0] != '\0' && !isspace ((unsigned char) cp[0])) + ++cp; + /* Terminate value. */ + if (cp[0] == '\n') + { + /* This has to be done to make the following test + for the end of line possible. We are looking for + the terminating '\n' which do not overwrite here. */ + *cp++ = '\0'; + *cp = '\n'; + } + else if (cp[0] != '\0') + *cp++ = '\0'; + + if (nmap >= maxmap) + if (__builtin_expect (extend_alias_table (), 0)) + return added; + + alias_len = strlen (alias) + 1; + value_len = strlen (value) + 1; + + if (string_space_act + alias_len + value_len > string_space_max) + { + /* Increase size of memory pool. */ + size_t new_size = (string_space_max + + (alias_len + value_len > 1024 + ? alias_len + value_len : 1024)); + char *new_pool = (char *) realloc (string_space, new_size); + if (new_pool == NULL) + return added; + + if (__builtin_expect (string_space != new_pool, 0)) + { + size_t i; + + for (i = 0; i < nmap; i++) + { + map[i].alias += new_pool - string_space; + map[i].value += new_pool - string_space; + } + } + + string_space = new_pool; + string_space_max = new_size; + } + + map[nmap].alias = memcpy (&string_space[string_space_act], + alias, alias_len); + string_space_act += alias_len; + + map[nmap].value = memcpy (&string_space[string_space_act], + value, value_len); + string_space_act += value_len; + + ++nmap; + ++added; + } + } + } + + /* Should we test for ferror()? I think we have to silently ignore + errors. --drepper */ + fclose (fp); + + if (added > 0) + qsort (map, nmap, sizeof (struct alias_map), + (int (*) PARAMS ((const void *, const void *))) alias_compare); + + return added; +} + + +static int +extend_alias_table () +{ + size_t new_size; + struct alias_map *new_map; + + new_size = maxmap == 0 ? 100 : 2 * maxmap; + new_map = (struct alias_map *) realloc (map, (new_size + * sizeof (struct alias_map))); + if (new_map == NULL) + /* Simply don't extend: we don't have any more core. */ + return -1; + + map = new_map; + maxmap = new_size; + return 0; +} + + +#ifdef _LIBC +static void __attribute__ ((unused)) +free_mem (void) +{ + if (string_space != NULL) + free (string_space); + if (map != NULL) + free (map); +} +text_set_element (__libc_subfreeres, free_mem); +#endif + + +static int +alias_compare (map1, map2) + const struct alias_map *map1; + const struct alias_map *map2; +{ +#if defined _LIBC || defined HAVE_STRCASECMP + return strcasecmp (map1->alias, map2->alias); +#else + const unsigned char *p1 = (const unsigned char *) map1->alias; + const unsigned char *p2 = (const unsigned char *) map2->alias; + unsigned char c1, c2; + + if (p1 == p2) + return 0; + + do + { + /* I know this seems to be odd but the tolower() function in + some systems libc cannot handle nonalpha characters. */ + c1 = isupper (*p1) ? tolower (*p1) : *p1; + c2 = isupper (*p2) ? tolower (*p2) : *p2; + if (c1 == '\0') + break; + ++p1; + ++p2; + } + while (c1 == c2); + + return c1 - c2; +#endif +} diff --git a/intl/localename.c b/intl/localename.c new file mode 100644 index 0000000..e491dde --- /dev/null +++ b/intl/localename.c @@ -0,0 +1,693 @@ +/* Determine the current selected locale. + Copyright (C) 1995-1999, 2000, 2001 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Ulrich Drepper , 1995. */ +/* Win32 code written by Tor Lillqvist . */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include + +#if defined _WIN32 || defined __WIN32__ +# undef WIN32 /* avoid warning on mingw32 */ +# define WIN32 +#endif + +#ifdef WIN32 +# define WIN32_LEAN_AND_MEAN +# include +/* Mingw headers don't have latest language and sublanguage codes. */ +# ifndef LANG_AFRIKAANS +# define LANG_AFRIKAANS 0x36 +# endif +# ifndef LANG_ALBANIAN +# define LANG_ALBANIAN 0x1c +# endif +# ifndef LANG_ARABIC +# define LANG_ARABIC 0x01 +# endif +# ifndef LANG_ARMENIAN +# define LANG_ARMENIAN 0x2b +# endif +# ifndef LANG_ASSAMESE +# define LANG_ASSAMESE 0x4d +# endif +# ifndef LANG_AZERI +# define LANG_AZERI 0x2c +# endif +# ifndef LANG_BASQUE +# define LANG_BASQUE 0x2d +# endif +# ifndef LANG_BELARUSIAN +# define LANG_BELARUSIAN 0x23 +# endif +# ifndef LANG_BENGALI +# define LANG_BENGALI 0x45 +# endif +# ifndef LANG_CATALAN +# define LANG_CATALAN 0x03 +# endif +# ifndef LANG_ESTONIAN +# define LANG_ESTONIAN 0x25 +# endif +# ifndef LANG_FAEROESE +# define LANG_FAEROESE 0x38 +# endif +# ifndef LANG_FARSI +# define LANG_FARSI 0x29 +# endif +# ifndef LANG_GEORGIAN +# define LANG_GEORGIAN 0x37 +# endif +# ifndef LANG_GUJARATI +# define LANG_GUJARATI 0x47 +# endif +# ifndef LANG_HEBREW +# define LANG_HEBREW 0x0d +# endif +# ifndef LANG_HINDI +# define LANG_HINDI 0x39 +# endif +# ifndef LANG_INDONESIAN +# define LANG_INDONESIAN 0x21 +# endif +# ifndef LANG_KANNADA +# define LANG_KANNADA 0x4b +# endif +# ifndef LANG_KASHMIRI +# define LANG_KASHMIRI 0x60 +# endif +# ifndef LANG_KAZAK +# define LANG_KAZAK 0x3f +# endif +# ifndef LANG_KONKANI +# define LANG_KONKANI 0x57 +# endif +# ifndef LANG_LATVIAN +# define LANG_LATVIAN 0x26 +# endif +# ifndef LANG_LITHUANIAN +# define LANG_LITHUANIAN 0x27 +# endif +# ifndef LANG_MACEDONIAN +# define LANG_MACEDONIAN 0x2f +# endif +# ifndef LANG_MALAY +# define LANG_MALAY 0x3e +# endif +# ifndef LANG_MALAYALAM +# define LANG_MALAYALAM 0x4c +# endif +# ifndef LANG_MANIPURI +# define LANG_MANIPURI 0x58 +# endif +# ifndef LANG_MARATHI +# define LANG_MARATHI 0x4e +# endif +# ifndef LANG_NEPALI +# define LANG_NEPALI 0x61 +# endif +# ifndef LANG_ORIYA +# define LANG_ORIYA 0x48 +# endif +# ifndef LANG_PUNJABI +# define LANG_PUNJABI 0x46 +# endif +# ifndef LANG_SANSKRIT +# define LANG_SANSKRIT 0x4f +# endif +# ifndef LANG_SERBIAN +# define LANG_SERBIAN 0x1a +# endif +# ifndef LANG_SINDHI +# define LANG_SINDHI 0x59 +# endif +# ifndef LANG_SLOVAK +# define LANG_SLOVAK 0x1b +# endif +# ifndef LANG_SWAHILI +# define LANG_SWAHILI 0x41 +# endif +# ifndef LANG_TAMIL +# define LANG_TAMIL 0x49 +# endif +# ifndef LANG_TATAR +# define LANG_TATAR 0x44 +# endif +# ifndef LANG_TELUGU +# define LANG_TELUGU 0x4a +# endif +# ifndef LANG_THAI +# define LANG_THAI 0x1e +# endif +# ifndef LANG_UKRAINIAN +# define LANG_UKRAINIAN 0x22 +# endif +# ifndef LANG_URDU +# define LANG_URDU 0x20 +# endif +# ifndef LANG_UZBEK +# define LANG_UZBEK 0x43 +# endif +# ifndef LANG_VIETNAMESE +# define LANG_VIETNAMESE 0x2a +# endif +# ifndef SUBLANG_ARABIC_SAUDI_ARABIA +# define SUBLANG_ARABIC_SAUDI_ARABIA 0x01 +# endif +# ifndef SUBLANG_ARABIC_IRAQ +# define SUBLANG_ARABIC_IRAQ 0x02 +# endif +# ifndef SUBLANG_ARABIC_EGYPT +# define SUBLANG_ARABIC_EGYPT 0x03 +# endif +# ifndef SUBLANG_ARABIC_LIBYA +# define SUBLANG_ARABIC_LIBYA 0x04 +# endif +# ifndef SUBLANG_ARABIC_ALGERIA +# define SUBLANG_ARABIC_ALGERIA 0x05 +# endif +# ifndef SUBLANG_ARABIC_MOROCCO +# define SUBLANG_ARABIC_MOROCCO 0x06 +# endif +# ifndef SUBLANG_ARABIC_TUNISIA +# define SUBLANG_ARABIC_TUNISIA 0x07 +# endif +# ifndef SUBLANG_ARABIC_OMAN +# define SUBLANG_ARABIC_OMAN 0x08 +# endif +# ifndef SUBLANG_ARABIC_YEMEN +# define SUBLANG_ARABIC_YEMEN 0x09 +# endif +# ifndef SUBLANG_ARABIC_SYRIA +# define SUBLANG_ARABIC_SYRIA 0x0a +# endif +# ifndef SUBLANG_ARABIC_JORDAN +# define SUBLANG_ARABIC_JORDAN 0x0b +# endif +# ifndef SUBLANG_ARABIC_LEBANON +# define SUBLANG_ARABIC_LEBANON 0x0c +# endif +# ifndef SUBLANG_ARABIC_KUWAIT +# define SUBLANG_ARABIC_KUWAIT 0x0d +# endif +# ifndef SUBLANG_ARABIC_UAE +# define SUBLANG_ARABIC_UAE 0x0e +# endif +# ifndef SUBLANG_ARABIC_BAHRAIN +# define SUBLANG_ARABIC_BAHRAIN 0x0f +# endif +# ifndef SUBLANG_ARABIC_QATAR +# define SUBLANG_ARABIC_QATAR 0x10 +# endif +# ifndef SUBLANG_AZERI_LATIN +# define SUBLANG_AZERI_LATIN 0x01 +# endif +# ifndef SUBLANG_AZERI_CYRILLIC +# define SUBLANG_AZERI_CYRILLIC 0x02 +# endif +# ifndef SUBLANG_CHINESE_MACAU +# define SUBLANG_CHINESE_MACAU 0x05 +# endif +# ifndef SUBLANG_ENGLISH_SOUTH_AFRICA +# define SUBLANG_ENGLISH_SOUTH_AFRICA 0x07 +# endif +# ifndef SUBLANG_ENGLISH_JAMAICA +# define SUBLANG_ENGLISH_JAMAICA 0x08 +# endif +# ifndef SUBLANG_ENGLISH_CARIBBEAN +# define SUBLANG_ENGLISH_CARIBBEAN 0x09 +# endif +# ifndef SUBLANG_ENGLISH_BELIZE +# define SUBLANG_ENGLISH_BELIZE 0x0a +# endif +# ifndef SUBLANG_ENGLISH_TRINIDAD +# define SUBLANG_ENGLISH_TRINIDAD 0x0b +# endif +# ifndef SUBLANG_ENGLISH_ZIMBABWE +# define SUBLANG_ENGLISH_ZIMBABWE 0x0c +# endif +# ifndef SUBLANG_ENGLISH_PHILIPPINES +# define SUBLANG_ENGLISH_PHILIPPINES 0x0d +# endif +# ifndef SUBLANG_FRENCH_LUXEMBOURG +# define SUBLANG_FRENCH_LUXEMBOURG 0x05 +# endif +# ifndef SUBLANG_FRENCH_MONACO +# define SUBLANG_FRENCH_MONACO 0x06 +# endif +# ifndef SUBLANG_GERMAN_LUXEMBOURG +# define SUBLANG_GERMAN_LUXEMBOURG 0x04 +# endif +# ifndef SUBLANG_GERMAN_LIECHTENSTEIN +# define SUBLANG_GERMAN_LIECHTENSTEIN 0x05 +# endif +# ifndef SUBLANG_KASHMIRI_INDIA +# define SUBLANG_KASHMIRI_INDIA 0x02 +# endif +# ifndef SUBLANG_MALAY_MALAYSIA +# define SUBLANG_MALAY_MALAYSIA 0x01 +# endif +# ifndef SUBLANG_MALAY_BRUNEI_DARUSSALAM +# define SUBLANG_MALAY_BRUNEI_DARUSSALAM 0x02 +# endif +# ifndef SUBLANG_NEPALI_INDIA +# define SUBLANG_NEPALI_INDIA 0x02 +# endif +# ifndef SUBLANG_SERBIAN_LATIN +# define SUBLANG_SERBIAN_LATIN 0x02 +# endif +# ifndef SUBLANG_SERBIAN_CYRILLIC +# define SUBLANG_SERBIAN_CYRILLIC 0x03 +# endif +# ifndef SUBLANG_SPANISH_GUATEMALA +# define SUBLANG_SPANISH_GUATEMALA 0x04 +# endif +# ifndef SUBLANG_SPANISH_COSTA_RICA +# define SUBLANG_SPANISH_COSTA_RICA 0x05 +# endif +# ifndef SUBLANG_SPANISH_PANAMA +# define SUBLANG_SPANISH_PANAMA 0x06 +# endif +# ifndef SUBLANG_SPANISH_DOMINICAN_REPUBLIC +# define SUBLANG_SPANISH_DOMINICAN_REPUBLIC 0x07 +# endif +# ifndef SUBLANG_SPANISH_VENEZUELA +# define SUBLANG_SPANISH_VENEZUELA 0x08 +# endif +# ifndef SUBLANG_SPANISH_COLOMBIA +# define SUBLANG_SPANISH_COLOMBIA 0x09 +# endif +# ifndef SUBLANG_SPANISH_PERU +# define SUBLANG_SPANISH_PERU 0x0a +# endif +# ifndef SUBLANG_SPANISH_ARGENTINA +# define SUBLANG_SPANISH_ARGENTINA 0x0b +# endif +# ifndef SUBLANG_SPANISH_ECUADOR +# define SUBLANG_SPANISH_ECUADOR 0x0c +# endif +# ifndef SUBLANG_SPANISH_CHILE +# define SUBLANG_SPANISH_CHILE 0x0d +# endif +# ifndef SUBLANG_SPANISH_URUGUAY +# define SUBLANG_SPANISH_URUGUAY 0x0e +# endif +# ifndef SUBLANG_SPANISH_PARAGUAY +# define SUBLANG_SPANISH_PARAGUAY 0x0f +# endif +# ifndef SUBLANG_SPANISH_BOLIVIA +# define SUBLANG_SPANISH_BOLIVIA 0x10 +# endif +# ifndef SUBLANG_SPANISH_EL_SALVADOR +# define SUBLANG_SPANISH_EL_SALVADOR 0x11 +# endif +# ifndef SUBLANG_SPANISH_HONDURAS +# define SUBLANG_SPANISH_HONDURAS 0x12 +# endif +# ifndef SUBLANG_SPANISH_NICARAGUA +# define SUBLANG_SPANISH_NICARAGUA 0x13 +# endif +# ifndef SUBLANG_SPANISH_PUERTO_RICO +# define SUBLANG_SPANISH_PUERTO_RICO 0x14 +# endif +# ifndef SUBLANG_SWEDISH_FINLAND +# define SUBLANG_SWEDISH_FINLAND 0x02 +# endif +# ifndef SUBLANG_URDU_PAKISTAN +# define SUBLANG_URDU_PAKISTAN 0x01 +# endif +# ifndef SUBLANG_URDU_INDIA +# define SUBLANG_URDU_INDIA 0x02 +# endif +# ifndef SUBLANG_UZBEK_LATIN +# define SUBLANG_UZBEK_LATIN 0x01 +# endif +# ifndef SUBLANG_UZBEK_CYRILLIC +# define SUBLANG_UZBEK_CYRILLIC 0x02 +# endif +#endif + +/* XPG3 defines the result of 'setlocale (category, NULL)' as: + "Directs 'setlocale()' to query 'category' and return the current + setting of 'local'." + However it does not specify the exact format. Neither do SUSV2 and + ISO C 99. So we can use this feature only on selected systems (e.g. + those using GNU C Library). */ +#if defined _LIBC || (defined __GNU_LIBRARY__ && __GNU_LIBRARY__ >= 2) +# define HAVE_LOCALE_NULL +#endif + +/* Determine the current locale's name, and canonicalize it into XPG syntax + language[_territory[.codeset]][@modifier] + The codeset part in the result is not reliable; the locale_charset() + should be used for codeset information instead. + The result must not be freed; it is statically allocated. */ + +const char * +_nl_locale_name (category, categoryname) + int category; + const char *categoryname; +{ + const char *retval; + +#ifndef WIN32 + + /* Use the POSIX methods of looking to 'LC_ALL', 'LC_xxx', and 'LANG'. + On some systems this can be done by the 'setlocale' function itself. */ +# if defined HAVE_SETLOCALE && defined HAVE_LC_MESSAGES && defined HAVE_LOCALE_NULL + retval = setlocale (category, NULL); +# else + /* Setting of LC_ALL overwrites all other. */ + retval = getenv ("LC_ALL"); + if (retval == NULL || retval[0] == '\0') + { + /* Next comes the name of the desired category. */ + retval = getenv (categoryname); + if (retval == NULL || retval[0] == '\0') + { + /* Last possibility is the LANG environment variable. */ + retval = getenv ("LANG"); + if (retval == NULL || retval[0] == '\0') + /* We use C as the default domain. POSIX says this is + implementation defined. */ + retval = "C"; + } + } +# endif + + return retval; + +#else /* WIN32 */ + + /* Return an XPG style locale name language[_territory][@modifier]. + Don't even bother determining the codeset; it's not useful in this + context, because message catalogs are not specific to a single + codeset. */ + + LCID lcid; + LANGID langid; + int primary, sub; + + /* Let the user override the system settings through environment + variables, as on POSIX systems. */ + retval = getenv ("LC_ALL"); + if (retval != NULL && retval[0] != '\0') + return retval; + retval = getenv (categoryname); + if (retval != NULL && retval[0] != '\0') + return retval; + retval = getenv ("LANG"); + if (retval != NULL && retval[0] != '\0') + return retval; + + /* Use native Win32 API locale ID. */ + lcid = GetThreadLocale (); + + /* Strip off the sorting rules, keep only the language part. */ + langid = LANGIDFROMLCID (lcid); + + /* Split into language and territory part. */ + primary = PRIMARYLANGID (langid); + sub = SUBLANGID (langid); + switch (primary) + { + case LANG_AFRIKAANS: return "af_ZA"; + case LANG_ALBANIAN: return "sq_AL"; + case LANG_ARABIC: + switch (sub) + { + case SUBLANG_ARABIC_SAUDI_ARABIA: return "ar_SA"; + case SUBLANG_ARABIC_IRAQ: return "ar_IQ"; + case SUBLANG_ARABIC_EGYPT: return "ar_EG"; + case SUBLANG_ARABIC_LIBYA: return "ar_LY"; + case SUBLANG_ARABIC_ALGERIA: return "ar_DZ"; + case SUBLANG_ARABIC_MOROCCO: return "ar_MA"; + case SUBLANG_ARABIC_TUNISIA: return "ar_TN"; + case SUBLANG_ARABIC_OMAN: return "ar_OM"; + case SUBLANG_ARABIC_YEMEN: return "ar_YE"; + case SUBLANG_ARABIC_SYRIA: return "ar_SY"; + case SUBLANG_ARABIC_JORDAN: return "ar_JO"; + case SUBLANG_ARABIC_LEBANON: return "ar_LB"; + case SUBLANG_ARABIC_KUWAIT: return "ar_KW"; + case SUBLANG_ARABIC_UAE: return "ar_AE"; + case SUBLANG_ARABIC_BAHRAIN: return "ar_BH"; + case SUBLANG_ARABIC_QATAR: return "ar_QA"; + } + return "ar"; + case LANG_ARMENIAN: return "hy_AM"; + case LANG_ASSAMESE: return "as_IN"; + case LANG_AZERI: + switch (sub) + { + /* FIXME: Adjust this when Azerbaijani locales appear on Unix. */ + case SUBLANG_AZERI_LATIN: return "az_AZ@latin"; + case SUBLANG_AZERI_CYRILLIC: return "az_AZ@cyrillic"; + } + return "az"; + case LANG_BASQUE: + return "eu"; /* Ambiguous: could be "eu_ES" or "eu_FR". */ + case LANG_BELARUSIAN: return "be_BY"; + case LANG_BENGALI: return "bn_IN"; + case LANG_BULGARIAN: return "bg_BG"; + case LANG_CATALAN: return "ca_ES"; + case LANG_CHINESE: + switch (sub) + { + case SUBLANG_CHINESE_TRADITIONAL: return "zh_TW"; + case SUBLANG_CHINESE_SIMPLIFIED: return "zh_CN"; + case SUBLANG_CHINESE_HONGKONG: return "zh_HK"; + case SUBLANG_CHINESE_SINGAPORE: return "zh_SG"; + case SUBLANG_CHINESE_MACAU: return "zh_MO"; + } + return "zh"; + case LANG_CROATIAN: /* LANG_CROATIAN == LANG_SERBIAN + * What used to be called Serbo-Croatian + * should really now be two separate + * languages because of political reasons. + * (Says tml, who knows nothing about Serbian + * or Croatian.) + * (I can feel those flames coming already.) + */ + switch (sub) + { + /* FIXME: How to distinguish Croatian and Latin Serbian locales? */ + case SUBLANG_SERBIAN_LATIN: return "sr_YU"; + case SUBLANG_SERBIAN_CYRILLIC: return "sr_YU@cyrillic"; + default: return "hr_HR"; + } + case LANG_CZECH: return "cs_CZ"; + case LANG_DANISH: return "da_DK"; + case LANG_DUTCH: + switch (sub) + { + case SUBLANG_DUTCH: return "nl_NL"; + case SUBLANG_DUTCH_BELGIAN: return "nl_BE"; + } + return "nl"; + case LANG_ENGLISH: + switch (sub) + { + /* SUBLANG_ENGLISH_US == SUBLANG_DEFAULT. Heh. I thought + * English was the language spoken in England. + * Oh well. + */ + case SUBLANG_ENGLISH_US: return "en_US"; + case SUBLANG_ENGLISH_UK: return "en_GB"; + case SUBLANG_ENGLISH_AUS: return "en_AU"; + case SUBLANG_ENGLISH_CAN: return "en_CA"; + case SUBLANG_ENGLISH_NZ: return "en_NZ"; + case SUBLANG_ENGLISH_EIRE: return "en_IE"; + case SUBLANG_ENGLISH_SOUTH_AFRICA: return "en_ZA"; + case SUBLANG_ENGLISH_JAMAICA: return "en_JM"; + case SUBLANG_ENGLISH_CARIBBEAN: return "en_GD"; /* Grenada? */ + case SUBLANG_ENGLISH_BELIZE: return "en_BZ"; + case SUBLANG_ENGLISH_TRINIDAD: return "en_TT"; + case SUBLANG_ENGLISH_ZIMBABWE: return "en_ZW"; + case SUBLANG_ENGLISH_PHILIPPINES: return "en_PH"; + } + return "en"; + case LANG_ESTONIAN: return "et_EE"; + case LANG_FAEROESE: return "fo_FO"; + case LANG_FARSI: return "fa_IR"; + case LANG_FINNISH: return "fi_FI"; + case LANG_FRENCH: + switch (sub) + { + case SUBLANG_FRENCH: return "fr_FR"; + case SUBLANG_FRENCH_BELGIAN: return "fr_BE"; + case SUBLANG_FRENCH_CANADIAN: return "fr_CA"; + case SUBLANG_FRENCH_SWISS: return "fr_CH"; + case SUBLANG_FRENCH_LUXEMBOURG: return "fr_LU"; + case SUBLANG_FRENCH_MONACO: return "fr_MC"; + } + return "fr"; + case LANG_GEORGIAN: return "ka_GE"; + case LANG_GERMAN: + switch (sub) + { + case SUBLANG_GERMAN: return "de_DE"; + case SUBLANG_GERMAN_SWISS: return "de_CH"; + case SUBLANG_GERMAN_AUSTRIAN: return "de_AT"; + case SUBLANG_GERMAN_LUXEMBOURG: return "de_LU"; + case SUBLANG_GERMAN_LIECHTENSTEIN: return "de_LI"; + } + return "de"; + case LANG_GREEK: return "el_GR"; + case LANG_GUJARATI: return "gu_IN"; + case LANG_HEBREW: return "he_IL"; + case LANG_HINDI: return "hi_IN"; + case LANG_HUNGARIAN: return "hu_HU"; + case LANG_ICELANDIC: return "is_IS"; + case LANG_INDONESIAN: return "id_ID"; + case LANG_ITALIAN: + switch (sub) + { + case SUBLANG_ITALIAN: return "it_IT"; + case SUBLANG_ITALIAN_SWISS: return "it_CH"; + } + return "it"; + case LANG_JAPANESE: return "ja_JP"; + case LANG_KANNADA: return "kn_IN"; + case LANG_KASHMIRI: + switch (sub) + { + case SUBLANG_DEFAULT: return "ks_PK"; + case SUBLANG_KASHMIRI_INDIA: return "ks_IN"; + } + return "ks"; + case LANG_KAZAK: return "kk_KZ"; + case LANG_KONKANI: + /* FIXME: Adjust this when such locales appear on Unix. */ + return "kok_IN"; + case LANG_KOREAN: return "ko_KR"; + case LANG_LATVIAN: return "lv_LV"; + case LANG_LITHUANIAN: return "lt_LT"; + case LANG_MACEDONIAN: return "mk_MK"; + case LANG_MALAY: + switch (sub) + { + case SUBLANG_MALAY_MALAYSIA: return "ms_MY"; + case SUBLANG_MALAY_BRUNEI_DARUSSALAM: return "ms_BN"; + } + return "ms"; + case LANG_MALAYALAM: return "ml_IN"; + case LANG_MANIPURI: + /* FIXME: Adjust this when such locales appear on Unix. */ + return "mni_IN"; + case LANG_MARATHI: return "mr_IN"; + case LANG_NEPALI: + switch (sub) + { + case SUBLANG_DEFAULT: return "ne_NP"; + case SUBLANG_NEPALI_INDIA: return "ne_IN"; + } + return "ne"; + case LANG_NORWEGIAN: + switch (sub) + { + case SUBLANG_NORWEGIAN_BOKMAL: return "no_NO"; + case SUBLANG_NORWEGIAN_NYNORSK: return "nn_NO"; + } + return "no"; + case LANG_ORIYA: return "or_IN"; + case LANG_POLISH: return "pl_PL"; + case LANG_PORTUGUESE: + switch (sub) + { + case SUBLANG_PORTUGUESE: return "pt_PT"; + /* Hmm. SUBLANG_PORTUGUESE_BRAZILIAN == SUBLANG_DEFAULT. + Same phenomenon as SUBLANG_ENGLISH_US == SUBLANG_DEFAULT. */ + case SUBLANG_PORTUGUESE_BRAZILIAN: return "pt_BR"; + } + return "pt"; + case LANG_PUNJABI: return "pa_IN"; + case LANG_ROMANIAN: return "ro_RO"; + case LANG_RUSSIAN: + return "ru"; /* Ambiguous: could be "ru_RU" or "ru_UA". */ + case LANG_SANSKRIT: return "sa_IN"; + case LANG_SINDHI: return "sd"; + case LANG_SLOVAK: return "sk_SK"; + case LANG_SLOVENIAN: return "sl_SI"; + case LANG_SORBIAN: + /* FIXME: Adjust this when such locales appear on Unix. */ + return "wen_DE"; + case LANG_SPANISH: + switch (sub) + { + case SUBLANG_SPANISH: return "es_ES"; + case SUBLANG_SPANISH_MEXICAN: return "es_MX"; + case SUBLANG_SPANISH_MODERN: + return "es_ES@modern"; /* not seen on Unix */ + case SUBLANG_SPANISH_GUATEMALA: return "es_GT"; + case SUBLANG_SPANISH_COSTA_RICA: return "es_CR"; + case SUBLANG_SPANISH_PANAMA: return "es_PA"; + case SUBLANG_SPANISH_DOMINICAN_REPUBLIC: return "es_DO"; + case SUBLANG_SPANISH_VENEZUELA: return "es_VE"; + case SUBLANG_SPANISH_COLOMBIA: return "es_CO"; + case SUBLANG_SPANISH_PERU: return "es_PE"; + case SUBLANG_SPANISH_ARGENTINA: return "es_AR"; + case SUBLANG_SPANISH_ECUADOR: return "es_EC"; + case SUBLANG_SPANISH_CHILE: return "es_CL"; + case SUBLANG_SPANISH_URUGUAY: return "es_UY"; + case SUBLANG_SPANISH_PARAGUAY: return "es_PY"; + case SUBLANG_SPANISH_BOLIVIA: return "es_BO"; + case SUBLANG_SPANISH_EL_SALVADOR: return "es_SV"; + case SUBLANG_SPANISH_HONDURAS: return "es_HN"; + case SUBLANG_SPANISH_NICARAGUA: return "es_NI"; + case SUBLANG_SPANISH_PUERTO_RICO: return "es_PR"; + } + return "es"; + case LANG_SWAHILI: return "sw"; + case LANG_SWEDISH: + switch (sub) + { + case SUBLANG_DEFAULT: return "sv_SE"; + case SUBLANG_SWEDISH_FINLAND: return "sv_FI"; + } + return "sv"; + case LANG_TAMIL: + return "ta"; /* Ambiguous: could be "ta_IN" or "ta_LK" or "ta_SG". */ + case LANG_TATAR: return "tt"; + case LANG_TELUGU: return "te_IN"; + case LANG_THAI: return "th_TH"; + case LANG_TURKISH: return "tr_TR"; + case LANG_UKRAINIAN: return "uk_UA"; + case LANG_URDU: + switch (sub) + { + case SUBLANG_URDU_PAKISTAN: return "ur_PK"; + case SUBLANG_URDU_INDIA: return "ur_IN"; + } + return "ur"; + case LANG_UZBEK: + switch (sub) + { + /* FIXME: Adjust this when Uzbek locales appear on Unix. */ + case SUBLANG_UZBEK_LATIN: return "uz_UZ@latin"; + case SUBLANG_UZBEK_CYRILLIC: return "uz_UZ@cyrillic"; + } + return "uz"; + case LANG_VIETNAMESE: return "vi_VN"; + default: return "C"; + } + +#endif +} diff --git a/intl/ngettext.c b/intl/ngettext.c new file mode 100644 index 0000000..1d76f24 --- /dev/null +++ b/intl/ngettext.c @@ -0,0 +1,68 @@ +/* Implementation of ngettext(3) function. + Copyright (C) 1995, 1997, 2000, 2001 Free Software Foundation, Inc. + + This program 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, 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, + USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#ifdef _LIBC +# define __need_NULL +# include +#else +# include /* Just for NULL. */ +#endif + +#include "gettextP.h" +#ifdef _LIBC +# include +#else +# include "libgnuintl.h" +#endif + +#include + +/* @@ end of prolog @@ */ + +/* Names for the libintl functions are a problem. They must not clash + with existing names and they should follow ANSI C. But this source + code is also used in GNU C Library where the names have a __ + prefix. So we have to make a difference here. */ +#ifdef _LIBC +# define NGETTEXT __ngettext +# define DCNGETTEXT __dcngettext +#else +# define NGETTEXT ngettext__ +# define DCNGETTEXT dcngettext__ +#endif + +/* Look up MSGID in the current default message catalog for the current + LC_MESSAGES locale. If not found, returns MSGID itself (the default + text). */ +char * +NGETTEXT (msgid1, msgid2, n) + const char *msgid1; + const char *msgid2; + unsigned long int n; +{ + return DCNGETTEXT (NULL, msgid1, msgid2, n, LC_MESSAGES); +} + +#ifdef _LIBC +/* Alias for function name in GNU C Library. */ +weak_alias (__ngettext, ngettext); +#endif diff --git a/intl/os2compat.c b/intl/os2compat.c new file mode 100644 index 0000000..1def5ce --- /dev/null +++ b/intl/os2compat.c @@ -0,0 +1,109 @@ +/* OS/2 compatibility functions. + Copyright (C) 2001-2002 Free Software Foundation, Inc. + + This program 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, 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, + USA. */ + +#define OS2_AWARE +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include + +/* A version of getenv() that works from DLLs */ +extern unsigned long DosScanEnv (const unsigned char *pszName, unsigned char **ppszValue); + +char * +_nl_getenv (const char *name) +{ + unsigned char *value; + if (DosScanEnv (name, &value)) + return NULL; + else + return value; +} + +char _nl_default_dirname[] = /* a 260+1 bytes large buffer */ + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0" +#define LOCALEDIR_MAX 260 + +char *_os2_libdir = NULL; +char *_os2_localealiaspath = NULL; +char *_os2_localedir = NULL; + +static __attribute__((constructor)) void +os2_initialize () +{ + char *root = getenv ("UNIXROOT"); + char *gnulocaledir = getenv ("GNULOCALEDIR"); + + _os2_libdir = gnulocaledir; + if (!_os2_libdir) + { + if (root) + { + size_t sl = strlen (root); + _os2_libdir = (char *) malloc (sl + strlen (LIBDIR) + 1); + memcpy (_os2_libdir, root, sl); + memcpy (_os2_libdir + sl, LIBDIR, strlen (LIBDIR) + 1); + } + else + _os2_libdir = LIBDIR; + } + + _os2_localealiaspath = gnulocaledir; + if (!_os2_localealiaspath) + { + if (root) + { + size_t sl = strlen (root); + _os2_localealiaspath = (char *) malloc (sl + strlen (LOCALE_ALIAS_PATH) + 1); + memcpy (_os2_localealiaspath, root, sl); + memcpy (_os2_localealiaspath + sl, LOCALE_ALIAS_PATH, strlen (LOCALE_ALIAS_PATH) + 1); + } + else + _os2_localealiaspath = LOCALE_ALIAS_PATH; + } + + _os2_localedir = gnulocaledir; + if (!_os2_localedir) + { + if (root) + { + size_t sl = strlen (root); + _os2_localedir = (char *) malloc (sl + strlen (LOCALEDIR) + 1); + memcpy (_os2_localedir, root, sl); + memcpy (_os2_localedir + sl, LOCALEDIR, strlen (LOCALEDIR) + 1); + } + else + _os2_localedir = LOCALEDIR; + } + + { + extern const char _nl_default_dirname__[]; + if (strlen (_os2_localedir) <= LOCALEDIR_MAX) + strcpy (_nl_default_dirname__, _os2_localedir); + } +} diff --git a/intl/os2compat.h b/intl/os2compat.h new file mode 100644 index 0000000..32f8c5c --- /dev/null +++ b/intl/os2compat.h @@ -0,0 +1,46 @@ +/* OS/2 compatibility defines. + This file is intended to be included from config.h + Copyright (C) 2001-2002 Free Software Foundation, Inc. + + This program 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, 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, + USA. */ + +/* When included from os2compat.h we need all the original definitions */ +#ifndef OS2_AWARE + +#undef LIBDIR +#define LIBDIR _os2_libdir +extern char *_os2_libdir; + +#undef LOCALEDIR +#define LOCALEDIR _os2_localedir +extern char *_os2_localedir; + +#undef LOCALE_ALIAS_PATH +#define LOCALE_ALIAS_PATH _os2_localealiaspath +extern char *_os2_localealiaspath; + +#endif + +#undef HAVE_STRCASECMP +#define HAVE_STRCASECMP 1 +#define strcasecmp stricmp +#define strncasecmp strnicmp + +/* We have our own getenv() which works even if library is compiled as DLL */ +#define getenv _nl_getenv + +/* Older versions of gettext used -1 as the value of LC_MESSAGES */ +#define LC_MESSAGES_COMPAT (-1) diff --git a/intl/osdep.c b/intl/osdep.c new file mode 100644 index 0000000..83a96a7 --- /dev/null +++ b/intl/osdep.c @@ -0,0 +1,24 @@ +/* OS dependent parts of libintl. + Copyright (C) 2001-2002 Free Software Foundation, Inc. + + This program 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, 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, + USA. */ + +#if defined __EMX__ +# include "os2compat.c" +#else +/* Avoid AIX compiler warning. */ +typedef int dummy; +#endif diff --git a/intl/plural-exp.c b/intl/plural-exp.c new file mode 100644 index 0000000..be96173 --- /dev/null +++ b/intl/plural-exp.c @@ -0,0 +1,156 @@ +/* Expression parsing for plural form selection. + Copyright (C) 2000, 2001 Free Software Foundation, Inc. + Written by Ulrich Drepper , 2000. + + This program 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, 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, + USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include + +#include "plural-exp.h" + +#if (defined __GNUC__ && !defined __APPLE_CC__) \ + || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L) + +/* These structs are the constant expression for the germanic plural + form determination. It represents the expression "n != 1". */ +static const struct expression plvar = +{ + .nargs = 0, + .operation = var, +}; +static const struct expression plone = +{ + .nargs = 0, + .operation = num, + .val = + { + .num = 1 + } +}; +struct expression GERMANIC_PLURAL = +{ + .nargs = 2, + .operation = not_equal, + .val = + { + .args = + { + [0] = (struct expression *) &plvar, + [1] = (struct expression *) &plone + } + } +}; + +# define INIT_GERMANIC_PLURAL() + +#else + +/* For compilers without support for ISO C 99 struct/union initializers: + Initialization at run-time. */ + +static struct expression plvar; +static struct expression plone; +struct expression GERMANIC_PLURAL; + +static void +init_germanic_plural () +{ + if (plone.val.num == 0) + { + plvar.nargs = 0; + plvar.operation = var; + + plone.nargs = 0; + plone.operation = num; + plone.val.num = 1; + + GERMANIC_PLURAL.nargs = 2; + GERMANIC_PLURAL.operation = not_equal; + GERMANIC_PLURAL.val.args[0] = &plvar; + GERMANIC_PLURAL.val.args[1] = &plone; + } +} + +# define INIT_GERMANIC_PLURAL() init_germanic_plural () + +#endif + +void +internal_function +EXTRACT_PLURAL_EXPRESSION (nullentry, pluralp, npluralsp) + const char *nullentry; + struct expression **pluralp; + unsigned long int *npluralsp; +{ + if (nullentry != NULL) + { + const char *plural; + const char *nplurals; + + plural = strstr (nullentry, "plural="); + nplurals = strstr (nullentry, "nplurals="); + if (plural == NULL || nplurals == NULL) + goto no_plural; + else + { + char *endp; + unsigned long int n; + struct parse_args args; + + /* First get the number. */ + nplurals += 9; + while (*nplurals != '\0' && isspace ((unsigned char) *nplurals)) + ++nplurals; + if (!(*nplurals >= '0' && *nplurals <= '9')) + goto no_plural; +#if defined HAVE_STRTOUL || defined _LIBC + n = strtoul (nplurals, &endp, 10); +#else + for (endp = nplurals, n = 0; *endp >= '0' && *endp <= '9'; endp++) + n = n * 10 + (*endp - '0'); +#endif + if (nplurals == endp) + goto no_plural; + *npluralsp = n; + + /* Due to the restrictions bison imposes onto the interface of the + scanner function we have to put the input string and the result + passed up from the parser into the same structure which address + is passed down to the parser. */ + plural += 7; + args.cp = plural; + if (PLURAL_PARSE (&args) != 0) + goto no_plural; + *pluralp = args.res; + } + } + else + { + /* By default we are using the Germanic form: singular form only + for `one', the plural form otherwise. Yes, this is also what + English is using since English is a Germanic language. */ + no_plural: + INIT_GERMANIC_PLURAL (); + *pluralp = &GERMANIC_PLURAL; + *npluralsp = 2; + } +} diff --git a/intl/plural-exp.h b/intl/plural-exp.h new file mode 100644 index 0000000..e7090c4 --- /dev/null +++ b/intl/plural-exp.h @@ -0,0 +1,122 @@ +/* Expression parsing and evaluation for plural form selection. + Copyright (C) 2000, 2001 Free Software Foundation, Inc. + Written by Ulrich Drepper , 2000. + + This program 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, 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, + USA. */ + +#ifndef _PLURAL_EXP_H +#define _PLURAL_EXP_H + +#ifndef PARAMS +# if __STDC__ || defined __GNUC__ || defined __SUNPRO_C || defined __cplusplus || __PROTOTYPES +# define PARAMS(args) args +# else +# define PARAMS(args) () +# endif +#endif + +#ifndef internal_function +# define internal_function +#endif + + +/* This is the representation of the expressions to determine the + plural form. */ +struct expression +{ + int nargs; /* Number of arguments. */ + enum operator + { + /* Without arguments: */ + var, /* The variable "n". */ + num, /* Decimal number. */ + /* Unary operators: */ + lnot, /* Logical NOT. */ + /* Binary operators: */ + mult, /* Multiplication. */ + divide, /* Division. */ + module, /* Modulo operation. */ + plus, /* Addition. */ + minus, /* Subtraction. */ + less_than, /* Comparison. */ + greater_than, /* Comparison. */ + less_or_equal, /* Comparison. */ + greater_or_equal, /* Comparison. */ + equal, /* Comparison for equality. */ + not_equal, /* Comparison for inequality. */ + land, /* Logical AND. */ + lor, /* Logical OR. */ + /* Ternary operators: */ + qmop /* Question mark operator. */ + } operation; + union + { + unsigned long int num; /* Number value for `num'. */ + struct expression *args[3]; /* Up to three arguments. */ + } val; +}; + +/* This is the data structure to pass information to the parser and get + the result in a thread-safe way. */ +struct parse_args +{ + const char *cp; + struct expression *res; +}; + + +/* Names for the libintl functions are a problem. This source code is used + 1. in the GNU C Library library, + 2. in the GNU libintl library, + 3. in the GNU gettext tools. + The function names in each situation must be different, to allow for + binary incompatible changes in 'struct expression'. Furthermore, + 1. in the GNU C Library library, the names have a __ prefix, + 2.+3. in the GNU libintl library and in the GNU gettext tools, the names + must follow ANSI C and not start with __. + So we have to distinguish the three cases. */ +#ifdef _LIBC +# define FREE_EXPRESSION __gettext_free_exp +# define PLURAL_PARSE __gettextparse +# define GERMANIC_PLURAL __gettext_germanic_plural +# define EXTRACT_PLURAL_EXPRESSION __gettext_extract_plural +#elif defined (IN_LIBINTL) +# define FREE_EXPRESSION gettext_free_exp__ +# define PLURAL_PARSE gettextparse__ +# define GERMANIC_PLURAL gettext_germanic_plural__ +# define EXTRACT_PLURAL_EXPRESSION gettext_extract_plural__ +#else +# define FREE_EXPRESSION free_plural_expression +# define PLURAL_PARSE parse_plural_expression +# define GERMANIC_PLURAL germanic_plural +# define EXTRACT_PLURAL_EXPRESSION extract_plural_expression +#endif + +extern void FREE_EXPRESSION PARAMS ((struct expression *exp)) + internal_function; +extern int PLURAL_PARSE PARAMS ((void *arg)); +extern struct expression GERMANIC_PLURAL; +extern void EXTRACT_PLURAL_EXPRESSION PARAMS ((const char *nullentry, + struct expression **pluralp, + unsigned long int *npluralsp)) + internal_function; + +#if !defined (_LIBC) && !defined (IN_LIBINTL) +extern unsigned long int plural_eval PARAMS ((struct expression *pexp, + unsigned long int n)); +#endif + +#endif /* _PLURAL_EXP_H */ diff --git a/intl/plural.c b/intl/plural.c new file mode 100644 index 0000000..58f5f36 --- /dev/null +++ b/intl/plural.c @@ -0,0 +1,1322 @@ + +/* A Bison parser, made from plural.y + by GNU Bison version 1.28 */ + +#define YYBISON 1 /* Identify Bison output. */ + +#define yyparse __gettextparse +#define yylex __gettextlex +#define yyerror __gettexterror +#define yylval __gettextlval +#define yychar __gettextchar +#define yydebug __gettextdebug +#define yynerrs __gettextnerrs +#define EQUOP2 257 +#define CMPOP2 258 +#define ADDOP2 259 +#define MULOP2 260 +#define NUMBER 261 + +#line 1 "plural.y" + +/* Expression parsing for plural form selection. + Copyright (C) 2000, 2001 Free Software Foundation, Inc. + Written by Ulrich Drepper , 2000. + + This program 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, 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, + USA. */ + +/* The bison generated parser uses alloca. AIX 3 forces us to put this + declaration at the beginning of the file. The declaration in bison's + skeleton file comes too late. This must come before + because may include arbitrary system headers. */ +#if defined _AIX && !defined __GNUC__ + #pragma alloca +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include "plural-exp.h" + +/* The main function generated by the parser is called __gettextparse, + but we want it to be called PLURAL_PARSE. */ +#ifndef _LIBC +# define __gettextparse PLURAL_PARSE +#endif + +#define YYLEX_PARAM &((struct parse_args *) arg)->cp +#define YYPARSE_PARAM arg + +#line 49 "plural.y" +typedef union { + unsigned long int num; + enum operator op; + struct expression *exp; +} YYSTYPE; +#line 55 "plural.y" + +/* Prototypes for local functions. */ +static struct expression *new_exp PARAMS ((int nargs, enum operator op, + struct expression * const *args)); +static inline struct expression *new_exp_0 PARAMS ((enum operator op)); +static inline struct expression *new_exp_1 PARAMS ((enum operator op, + struct expression *right)); +static struct expression *new_exp_2 PARAMS ((enum operator op, + struct expression *left, + struct expression *right)); +static inline struct expression *new_exp_3 PARAMS ((enum operator op, + struct expression *bexp, + struct expression *tbranch, + struct expression *fbranch)); +static int yylex PARAMS ((YYSTYPE *lval, const char **pexp)); +static void yyerror PARAMS ((const char *str)); + +/* Allocation of expressions. */ + +static struct expression * +new_exp (nargs, op, args) + int nargs; + enum operator op; + struct expression * const *args; +{ + int i; + struct expression *newp; + + /* If any of the argument could not be malloc'ed, just return NULL. */ + for (i = nargs - 1; i >= 0; i--) + if (args[i] == NULL) + goto fail; + + /* Allocate a new expression. */ + newp = (struct expression *) malloc (sizeof (*newp)); + if (newp != NULL) + { + newp->nargs = nargs; + newp->operation = op; + for (i = nargs - 1; i >= 0; i--) + newp->val.args[i] = args[i]; + return newp; + } + + fail: + for (i = nargs - 1; i >= 0; i--) + FREE_EXPRESSION (args[i]); + + return NULL; +} + +static inline struct expression * +new_exp_0 (op) + enum operator op; +{ + return new_exp (0, op, NULL); +} + +static inline struct expression * +new_exp_1 (op, right) + enum operator op; + struct expression *right; +{ + struct expression *args[1]; + + args[0] = right; + return new_exp (1, op, args); +} + +static struct expression * +new_exp_2 (op, left, right) + enum operator op; + struct expression *left; + struct expression *right; +{ + struct expression *args[2]; + + args[0] = left; + args[1] = right; + return new_exp (2, op, args); +} + +static inline struct expression * +new_exp_3 (op, bexp, tbranch, fbranch) + enum operator op; + struct expression *bexp; + struct expression *tbranch; + struct expression *fbranch; +{ + struct expression *args[3]; + + args[0] = bexp; + args[1] = tbranch; + args[2] = fbranch; + return new_exp (3, op, args); +} + +#include + +#ifndef __cplusplus +#ifndef __STDC__ +#define const +#endif +#endif + + + +#define YYFINAL 27 +#define YYFLAG -32768 +#define YYNTBASE 16 + +#define YYTRANSLATE(x) ((unsigned)(x) <= 261 ? yytranslate[x] : 18) + +static const char yytranslate[] = { 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 10, 2, 2, 2, 2, 5, 2, 14, + 15, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 12, 2, 2, + 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 13, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 1, 6, 7, 8, 9, + 11 +}; + +#if YYDEBUG != 0 +static const short yyprhs[] = { 0, + 0, 2, 8, 12, 16, 20, 24, 28, 32, 35, + 37, 39 +}; + +static const short yyrhs[] = { 17, + 0, 17, 3, 17, 12, 17, 0, 17, 4, 17, + 0, 17, 5, 17, 0, 17, 6, 17, 0, 17, + 7, 17, 0, 17, 8, 17, 0, 17, 9, 17, + 0, 10, 17, 0, 13, 0, 11, 0, 14, 17, + 15, 0 +}; + +#endif + +#if YYDEBUG != 0 +static const short yyrline[] = { 0, + 174, 182, 186, 190, 194, 198, 202, 206, 210, 214, + 218, 223 +}; +#endif + + +#if YYDEBUG != 0 || defined (YYERROR_VERBOSE) + +static const char * const yytname[] = { "$","error","$undefined.","'?'","'|'", +"'&'","EQUOP2","CMPOP2","ADDOP2","MULOP2","'!'","NUMBER","':'","'n'","'('","')'", +"start","exp", NULL +}; +#endif + +static const short yyr1[] = { 0, + 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17 +}; + +static const short yyr2[] = { 0, + 1, 5, 3, 3, 3, 3, 3, 3, 2, 1, + 1, 3 +}; + +static const short yydefact[] = { 0, + 0, 11, 10, 0, 1, 9, 0, 0, 0, 0, + 0, 0, 0, 0, 12, 0, 3, 4, 5, 6, + 7, 8, 0, 2, 0, 0, 0 +}; + +static const short yydefgoto[] = { 25, + 5 +}; + +static const short yypact[] = { -9, + -9,-32768,-32768, -9, 34,-32768, 11, -9, -9, -9, + -9, -9, -9, -9,-32768, 24, 39, 43, 16, 26, + -3,-32768, -9, 34, 21, 53,-32768 +}; + +static const short yypgoto[] = {-32768, + -1 +}; + + +#define YYLAST 53 + + +static const short yytable[] = { 6, + 1, 2, 7, 3, 4, 14, 16, 17, 18, 19, + 20, 21, 22, 8, 9, 10, 11, 12, 13, 14, + 26, 24, 12, 13, 14, 15, 8, 9, 10, 11, + 12, 13, 14, 13, 14, 23, 8, 9, 10, 11, + 12, 13, 14, 10, 11, 12, 13, 14, 11, 12, + 13, 14, 27 +}; + +static const short yycheck[] = { 1, + 10, 11, 4, 13, 14, 9, 8, 9, 10, 11, + 12, 13, 14, 3, 4, 5, 6, 7, 8, 9, + 0, 23, 7, 8, 9, 15, 3, 4, 5, 6, + 7, 8, 9, 8, 9, 12, 3, 4, 5, 6, + 7, 8, 9, 5, 6, 7, 8, 9, 6, 7, + 8, 9, 0 +}; +#define YYPURE 1 + +/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ +#line 3 "/usr/local/share/bison.simple" +/* This file comes from bison-1.28. */ + +/* Skeleton output parser for bison, + Copyright (C) 1984, 1989, 1990 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., 51 Franklin Street - Fifth Floor, + Boston, MA 02110-1301, USA. */ + +/* As a special exception, when this file is copied by Bison into a + Bison output file, you may use that output file without restriction. + This special exception was added by the Free Software Foundation + in version 1.24 of Bison. */ + +/* This is the parser code that is written into each bison parser + when the %semantic_parser declaration is not specified in the grammar. + It was written by Richard Stallman by simplifying the hairy parser + used when %semantic_parser is specified. */ + +#ifndef YYSTACK_USE_ALLOCA +#ifdef alloca +#define YYSTACK_USE_ALLOCA +#else /* alloca not defined */ +#ifdef __GNUC__ +#define YYSTACK_USE_ALLOCA +#define alloca __builtin_alloca +#else /* not GNU C. */ +#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386)) +#define YYSTACK_USE_ALLOCA +#include +#else /* not sparc */ +/* We think this test detects Watcom and Microsoft C. */ +/* This used to test MSDOS, but that is a bad idea + since that symbol is in the user namespace. */ +#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__) +#if 0 /* No need for malloc.h, which pollutes the namespace; + instead, just don't use alloca. */ +#include +#endif +#else /* not MSDOS, or __TURBOC__ */ +#if defined(_AIX) +/* I don't know what this was needed for, but it pollutes the namespace. + So I turned it off. rms, 2 May 1997. */ +/* #include */ + #pragma alloca +#define YYSTACK_USE_ALLOCA +#else /* not MSDOS, or __TURBOC__, or _AIX */ +#if 0 +#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up, + and on HPUX 10. Eventually we can turn this on. */ +#define YYSTACK_USE_ALLOCA +#define alloca __builtin_alloca +#endif /* __hpux */ +#endif +#endif /* not _AIX */ +#endif /* not MSDOS, or __TURBOC__ */ +#endif /* not sparc */ +#endif /* not GNU C */ +#endif /* alloca not defined */ +#endif /* YYSTACK_USE_ALLOCA not defined */ + +#ifdef YYSTACK_USE_ALLOCA +#define YYSTACK_ALLOC alloca +#else +#define YYSTACK_ALLOC malloc +#endif + +/* Note: there must be only one dollar sign in this file. + It is replaced by the list of actions, each action + as one case of the switch. */ + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY -2 +#define YYEOF 0 +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrlab1 +/* Like YYERROR except do call yyerror. + This remains here temporarily to ease the + transition to the new meaning of YYERROR, for GCC. + Once GCC version 2 has supplanted version 1, this can go. */ +#define YYFAIL goto yyerrlab +#define YYRECOVERING() (!!yyerrstatus) +#define YYBACKUP(token, value) \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { yychar = (token), yylval = (value); \ + yychar1 = YYTRANSLATE (yychar); \ + YYPOPSTACK; \ + goto yybackup; \ + } \ + else \ + { yyerror ("syntax error: cannot back up"); YYERROR; } \ +while (0) + +#define YYTERROR 1 +#define YYERRCODE 256 + +#ifndef YYPURE +#define YYLEX yylex() +#endif + +#ifdef YYPURE +#ifdef YYLSP_NEEDED +#ifdef YYLEX_PARAM +#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) +#else +#define YYLEX yylex(&yylval, &yylloc) +#endif +#else /* not YYLSP_NEEDED */ +#ifdef YYLEX_PARAM +#define YYLEX yylex(&yylval, YYLEX_PARAM) +#else +#define YYLEX yylex(&yylval) +#endif +#endif /* not YYLSP_NEEDED */ +#endif + +/* If nonreentrant, generate the variables here */ + +#ifndef YYPURE + +int yychar; /* the lookahead symbol */ +YYSTYPE yylval; /* the semantic value of the */ + /* lookahead symbol */ + +#ifdef YYLSP_NEEDED +YYLTYPE yylloc; /* location data for the lookahead */ + /* symbol */ +#endif + +int yynerrs; /* number of parse errors so far */ +#endif /* not YYPURE */ + +#if YYDEBUG != 0 +int yydebug; /* nonzero means print parse trace */ +/* Since this is uninitialized, it does not stop multiple parsers + from coexisting. */ +#endif + +/* YYINITDEPTH indicates the initial size of the parser's stacks */ + +#ifndef YYINITDEPTH +#define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH is the maximum size the stacks can grow to + (effective only if the built-in stack extension method is used). */ + +#if YYMAXDEPTH == 0 +#undef YYMAXDEPTH +#endif + +#ifndef YYMAXDEPTH +#define YYMAXDEPTH 10000 +#endif + +/* Define __yy_memcpy. Note that the size argument + should be passed with type unsigned int, because that is what the non-GCC + definitions require. With GCC, __builtin_memcpy takes an arg + of type size_t, but it can handle unsigned int. */ + +#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ +#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) +#else /* not GNU C or C++ */ +#ifndef __cplusplus + +/* This is the most reliable way to avoid incompatibilities + in available built-in functions on various systems. */ +static void +__yy_memcpy (to, from, count) + char *to; + char *from; + unsigned int count; +{ + register char *f = from; + register char *t = to; + register int i = count; + + while (i-- > 0) + *t++ = *f++; +} + +#else /* __cplusplus */ + +/* This is the most reliable way to avoid incompatibilities + in available built-in functions on various systems. */ +static void +__yy_memcpy (char *to, char *from, unsigned int count) +{ + register char *t = to; + register char *f = from; + register int i = count; + + while (i-- > 0) + *t++ = *f++; +} + +#endif +#endif + +#line 217 "/usr/local/share/bison.simple" + +/* The user can define YYPARSE_PARAM as the name of an argument to be passed + into yyparse. The argument should have type void *. + It should actually point to an object. + Grammar actions can access the variable by casting it + to the proper pointer type. */ + +#ifdef YYPARSE_PARAM +#ifdef __cplusplus +#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM +#define YYPARSE_PARAM_DECL +#else /* not __cplusplus */ +#define YYPARSE_PARAM_ARG YYPARSE_PARAM +#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; +#endif /* not __cplusplus */ +#else /* not YYPARSE_PARAM */ +#define YYPARSE_PARAM_ARG +#define YYPARSE_PARAM_DECL +#endif /* not YYPARSE_PARAM */ + +/* Prevent warning if -Wstrict-prototypes. */ +#ifdef __GNUC__ +#ifdef YYPARSE_PARAM +int yyparse (void *); +#else +int yyparse (void); +#endif +#endif + +int +yyparse(YYPARSE_PARAM_ARG) + YYPARSE_PARAM_DECL +{ + register int yystate; + register int yyn; + register short *yyssp; + register YYSTYPE *yyvsp; + int yyerrstatus; /* number of tokens to shift before error messages enabled */ + int yychar1 = 0; /* lookahead token as an internal (translated) token number */ + + short yyssa[YYINITDEPTH]; /* the state stack */ + YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ + + short *yyss = yyssa; /* refer to the stacks thru separate pointers */ + YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ + +#ifdef YYLSP_NEEDED + YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ + YYLTYPE *yyls = yylsa; + YYLTYPE *yylsp; + +#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) +#else +#define YYPOPSTACK (yyvsp--, yyssp--) +#endif + + int yystacksize = YYINITDEPTH; + int yyfree_stacks = 0; + +#ifdef YYPURE + int yychar; + YYSTYPE yylval; + int yynerrs; +#ifdef YYLSP_NEEDED + YYLTYPE yylloc; +#endif +#endif + + YYSTYPE yyval; /* the variable used to return */ + /* semantic values from the action */ + /* routines */ + + int yylen; + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Starting parse\n"); +#endif + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + + /* Initialize stack pointers. + Waste one element of value and location stack + so that they stay on the same level as the state stack. + The wasted elements are never initialized. */ + + yyssp = yyss - 1; + yyvsp = yyvs; +#ifdef YYLSP_NEEDED + yylsp = yyls; +#endif + +/* Push a new state, which is found in yystate . */ +/* In all cases, when you get here, the value and location stacks + have just been pushed. so pushing a state here evens the stacks. */ +yynewstate: + + *++yyssp = yystate; + + if (yyssp >= yyss + yystacksize - 1) + { + /* Give user a chance to reallocate the stack */ + /* Use copies of these so that the &'s don't force the real ones into memory. */ + YYSTYPE *yyvs1 = yyvs; + short *yyss1 = yyss; +#ifdef YYLSP_NEEDED + YYLTYPE *yyls1 = yyls; +#endif + + /* Get the current used size of the three stacks, in elements. */ + int size = yyssp - yyss + 1; + +#ifdef yyoverflow + /* Each stack pointer address is followed by the size of + the data in use in that stack, in bytes. */ +#ifdef YYLSP_NEEDED + /* This used to be a conditional around just the two extra args, + but that might be undefined if yyoverflow is a macro. */ + yyoverflow("parser stack overflow", + &yyss1, size * sizeof (*yyssp), + &yyvs1, size * sizeof (*yyvsp), + &yyls1, size * sizeof (*yylsp), + &yystacksize); +#else + yyoverflow("parser stack overflow", + &yyss1, size * sizeof (*yyssp), + &yyvs1, size * sizeof (*yyvsp), + &yystacksize); +#endif + + yyss = yyss1; yyvs = yyvs1; +#ifdef YYLSP_NEEDED + yyls = yyls1; +#endif +#else /* no yyoverflow */ + /* Extend the stack our own way. */ + if (yystacksize >= YYMAXDEPTH) + { + yyerror("parser stack overflow"); + if (yyfree_stacks) + { + free (yyss); + free (yyvs); +#ifdef YYLSP_NEEDED + free (yyls); +#endif + } + return 2; + } + yystacksize *= 2; + if (yystacksize > YYMAXDEPTH) + yystacksize = YYMAXDEPTH; +#ifndef YYSTACK_USE_ALLOCA + yyfree_stacks = 1; +#endif + yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); + __yy_memcpy ((char *)yyss, (char *)yyss1, + size * (unsigned int) sizeof (*yyssp)); + yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); + __yy_memcpy ((char *)yyvs, (char *)yyvs1, + size * (unsigned int) sizeof (*yyvsp)); +#ifdef YYLSP_NEEDED + yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); + __yy_memcpy ((char *)yyls, (char *)yyls1, + size * (unsigned int) sizeof (*yylsp)); +#endif +#endif /* no yyoverflow */ + + yyssp = yyss + size - 1; + yyvsp = yyvs + size - 1; +#ifdef YYLSP_NEEDED + yylsp = yyls + size - 1; +#endif + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Stack size increased to %d\n", yystacksize); +#endif + + if (yyssp >= yyss + yystacksize - 1) + YYABORT; + } + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Entering state %d\n", yystate); +#endif + + goto yybackup; + yybackup: + +/* Do appropriate processing given the current state. */ +/* Read a lookahead token if we need one and don't already have one. */ +/* yyresume: */ + + /* First try to decide what to do without reference to lookahead token. */ + + yyn = yypact[yystate]; + if (yyn == YYFLAG) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* yychar is either YYEMPTY or YYEOF + or a valid token in external form. */ + + if (yychar == YYEMPTY) + { +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Reading a token: "); +#endif + yychar = YYLEX; + } + + /* Convert token to internal form (in yychar1) for indexing tables with */ + + if (yychar <= 0) /* This means end of input. */ + { + yychar1 = 0; + yychar = YYEOF; /* Don't call YYLEX any more */ + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Now at end of input.\n"); +#endif + } + else + { + yychar1 = YYTRANSLATE(yychar); + +#if YYDEBUG != 0 + if (yydebug) + { + fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); + /* Give the individual parser a way to print the precise meaning + of a token, for further debugging info. */ +#ifdef YYPRINT + YYPRINT (stderr, yychar, yylval); +#endif + fprintf (stderr, ")\n"); + } +#endif + } + + yyn += yychar1; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) + goto yydefault; + + yyn = yytable[yyn]; + + /* yyn is what to do for this token type in this state. + Negative => reduce, -yyn is rule number. + Positive => shift, yyn is new state. + New state is final state => don't bother to shift, + just return success. + 0, or most negative number => error. */ + + if (yyn < 0) + { + if (yyn == YYFLAG) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + else if (yyn == 0) + goto yyerrlab; + + if (yyn == YYFINAL) + YYACCEPT; + + /* Shift the lookahead token. */ + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); +#endif + + /* Discard the token being shifted unless it is eof. */ + if (yychar != YYEOF) + yychar = YYEMPTY; + + *++yyvsp = yylval; +#ifdef YYLSP_NEEDED + *++yylsp = yylloc; +#endif + + /* count tokens shifted since error; after three, turn off error status. */ + if (yyerrstatus) yyerrstatus--; + + yystate = yyn; + goto yynewstate; + +/* Do the default action for the current state. */ +yydefault: + + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + +/* Do a reduction. yyn is the number of a rule to reduce with. */ +yyreduce: + yylen = yyr2[yyn]; + if (yylen > 0) + yyval = yyvsp[1-yylen]; /* implement default value of the action */ + +#if YYDEBUG != 0 + if (yydebug) + { + int i; + + fprintf (stderr, "Reducing via rule %d (line %d), ", + yyn, yyrline[yyn]); + + /* Print the symbols being reduced, and their result. */ + for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) + fprintf (stderr, "%s ", yytname[yyrhs[i]]); + fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); + } +#endif + + + switch (yyn) { + +case 1: +#line 175 "plural.y" +{ + if (yyvsp[0].exp == NULL) + YYABORT; + ((struct parse_args *) arg)->res = yyvsp[0].exp; + ; + break;} +case 2: +#line 183 "plural.y" +{ + yyval.exp = new_exp_3 (qmop, yyvsp[-4].exp, yyvsp[-2].exp, yyvsp[0].exp); + ; + break;} +case 3: +#line 187 "plural.y" +{ + yyval.exp = new_exp_2 (lor, yyvsp[-2].exp, yyvsp[0].exp); + ; + break;} +case 4: +#line 191 "plural.y" +{ + yyval.exp = new_exp_2 (land, yyvsp[-2].exp, yyvsp[0].exp); + ; + break;} +case 5: +#line 195 "plural.y" +{ + yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp); + ; + break;} +case 6: +#line 199 "plural.y" +{ + yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp); + ; + break;} +case 7: +#line 203 "plural.y" +{ + yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp); + ; + break;} +case 8: +#line 207 "plural.y" +{ + yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp); + ; + break;} +case 9: +#line 211 "plural.y" +{ + yyval.exp = new_exp_1 (lnot, yyvsp[0].exp); + ; + break;} +case 10: +#line 215 "plural.y" +{ + yyval.exp = new_exp_0 (var); + ; + break;} +case 11: +#line 219 "plural.y" +{ + if ((yyval.exp = new_exp_0 (num)) != NULL) + yyval.exp->val.num = yyvsp[0].num; + ; + break;} +case 12: +#line 224 "plural.y" +{ + yyval.exp = yyvsp[-1].exp; + ; + break;} +} + /* the action file gets copied in in place of this dollarsign */ +#line 543 "/usr/local/share/bison.simple" + + yyvsp -= yylen; + yyssp -= yylen; +#ifdef YYLSP_NEEDED + yylsp -= yylen; +#endif + +#if YYDEBUG != 0 + if (yydebug) + { + short *ssp1 = yyss - 1; + fprintf (stderr, "state stack now"); + while (ssp1 != yyssp) + fprintf (stderr, " %d", *++ssp1); + fprintf (stderr, "\n"); + } +#endif + + *++yyvsp = yyval; + +#ifdef YYLSP_NEEDED + yylsp++; + if (yylen == 0) + { + yylsp->first_line = yylloc.first_line; + yylsp->first_column = yylloc.first_column; + yylsp->last_line = (yylsp-1)->last_line; + yylsp->last_column = (yylsp-1)->last_column; + yylsp->text = 0; + } + else + { + yylsp->last_line = (yylsp+yylen-1)->last_line; + yylsp->last_column = (yylsp+yylen-1)->last_column; + } +#endif + + /* Now "shift" the result of the reduction. + Determine what state that goes to, + based on the state we popped back to + and the rule number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTBASE] + *yyssp; + if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTBASE]; + + goto yynewstate; + +yyerrlab: /* here on detecting error */ + + if (! yyerrstatus) + /* If not already recovering from an error, report this error. */ + { + ++yynerrs; + +#ifdef YYERROR_VERBOSE + yyn = yypact[yystate]; + + if (yyn > YYFLAG && yyn < YYLAST) + { + int size = 0; + char *msg; + int x, count; + + count = 0; + /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ + for (x = (yyn < 0 ? -yyn : 0); + x < (sizeof(yytname) / sizeof(char *)); x++) + if (yycheck[x + yyn] == x) + size += strlen(yytname[x]) + 15, count++; + msg = (char *) malloc(size + 15); + if (msg != 0) + { + strcpy(msg, "parse error"); + + if (count < 5) + { + count = 0; + for (x = (yyn < 0 ? -yyn : 0); + x < (sizeof(yytname) / sizeof(char *)); x++) + if (yycheck[x + yyn] == x) + { + strcat(msg, count == 0 ? ", expecting `" : " or `"); + strcat(msg, yytname[x]); + strcat(msg, "'"); + count++; + } + } + yyerror(msg); + free(msg); + } + else + yyerror ("parse error; also virtual memory exceeded"); + } + else +#endif /* YYERROR_VERBOSE */ + yyerror("parse error"); + } + + goto yyerrlab1; +yyerrlab1: /* here on error raised explicitly by an action */ + + if (yyerrstatus == 3) + { + /* if just tried and failed to reuse lookahead token after an error, discard it. */ + + /* return failure if at end of input */ + if (yychar == YYEOF) + YYABORT; + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); +#endif + + yychar = YYEMPTY; + } + + /* Else will try to reuse lookahead token + after shifting the error token. */ + + yyerrstatus = 3; /* Each real token shifted decrements this */ + + goto yyerrhandle; + +yyerrdefault: /* current state does not do anything special for the error token. */ + +#if 0 + /* This is wrong; only states that explicitly want error tokens + should shift them. */ + yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ + if (yyn) goto yydefault; +#endif + +yyerrpop: /* pop the current state because it cannot handle the error token */ + + if (yyssp == yyss) YYABORT; + yyvsp--; + yystate = *--yyssp; +#ifdef YYLSP_NEEDED + yylsp--; +#endif + +#if YYDEBUG != 0 + if (yydebug) + { + short *ssp1 = yyss - 1; + fprintf (stderr, "Error: state stack now"); + while (ssp1 != yyssp) + fprintf (stderr, " %d", *++ssp1); + fprintf (stderr, "\n"); + } +#endif + +yyerrhandle: + + yyn = yypact[yystate]; + if (yyn == YYFLAG) + goto yyerrdefault; + + yyn += YYTERROR; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) + goto yyerrdefault; + + yyn = yytable[yyn]; + if (yyn < 0) + { + if (yyn == YYFLAG) + goto yyerrpop; + yyn = -yyn; + goto yyreduce; + } + else if (yyn == 0) + goto yyerrpop; + + if (yyn == YYFINAL) + YYACCEPT; + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Shifting error token, "); +#endif + + *++yyvsp = yylval; +#ifdef YYLSP_NEEDED + *++yylsp = yylloc; +#endif + + yystate = yyn; + goto yynewstate; + + yyacceptlab: + /* YYACCEPT comes here. */ + if (yyfree_stacks) + { + free (yyss); + free (yyvs); +#ifdef YYLSP_NEEDED + free (yyls); +#endif + } + return 0; + + yyabortlab: + /* YYABORT comes here. */ + if (yyfree_stacks) + { + free (yyss); + free (yyvs); +#ifdef YYLSP_NEEDED + free (yyls); +#endif + } + return 1; +} +#line 229 "plural.y" + + +void +internal_function +FREE_EXPRESSION (exp) + struct expression *exp; +{ + if (exp == NULL) + return; + + /* Handle the recursive case. */ + switch (exp->nargs) + { + case 3: + FREE_EXPRESSION (exp->val.args[2]); + /* FALLTHROUGH */ + case 2: + FREE_EXPRESSION (exp->val.args[1]); + /* FALLTHROUGH */ + case 1: + FREE_EXPRESSION (exp->val.args[0]); + /* FALLTHROUGH */ + default: + break; + } + + free (exp); +} + + +static int +yylex (lval, pexp) + YYSTYPE *lval; + const char **pexp; +{ + const char *exp = *pexp; + int result; + + while (1) + { + if (exp[0] == '\0') + { + *pexp = exp; + return YYEOF; + } + + if (exp[0] != ' ' && exp[0] != '\t') + break; + + ++exp; + } + + result = *exp++; + switch (result) + { + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + { + unsigned long int n = result - '0'; + while (exp[0] >= '0' && exp[0] <= '9') + { + n *= 10; + n += exp[0] - '0'; + ++exp; + } + lval->num = n; + result = NUMBER; + } + break; + + case '=': + if (exp[0] == '=') + { + ++exp; + lval->op = equal; + result = EQUOP2; + } + else + result = YYERRCODE; + break; + + case '!': + if (exp[0] == '=') + { + ++exp; + lval->op = not_equal; + result = EQUOP2; + } + break; + + case '&': + case '|': + if (exp[0] == result) + ++exp; + else + result = YYERRCODE; + break; + + case '<': + if (exp[0] == '=') + { + ++exp; + lval->op = less_or_equal; + } + else + lval->op = less_than; + result = CMPOP2; + break; + + case '>': + if (exp[0] == '=') + { + ++exp; + lval->op = greater_or_equal; + } + else + lval->op = greater_than; + result = CMPOP2; + break; + + case '*': + lval->op = mult; + result = MULOP2; + break; + + case '/': + lval->op = divide; + result = MULOP2; + break; + + case '%': + lval->op = module; + result = MULOP2; + break; + + case '+': + lval->op = plus; + result = ADDOP2; + break; + + case '-': + lval->op = minus; + result = ADDOP2; + break; + + case 'n': + case '?': + case ':': + case '(': + case ')': + /* Nothing, just return the character. */ + break; + + case ';': + case '\n': + case '\0': + /* Be safe and let the user call this function again. */ + --exp; + result = YYEOF; + break; + + default: + result = YYERRCODE; +#if YYDEBUG != 0 + --exp; +#endif + break; + } + + *pexp = exp; + + return result; +} + + +static void +yyerror (str) + const char *str; +{ + /* Do nothing. We don't print error messages here. */ +} diff --git a/intl/plural.y b/intl/plural.y new file mode 100644 index 0000000..3f75cf3 --- /dev/null +++ b/intl/plural.y @@ -0,0 +1,409 @@ +%{ +/* Expression parsing for plural form selection. + Copyright (C) 2000, 2001 Free Software Foundation, Inc. + Written by Ulrich Drepper , 2000. + + This program 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, 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, + USA. */ + +/* The bison generated parser uses alloca. AIX 3 forces us to put this + declaration at the beginning of the file. The declaration in bison's + skeleton file comes too late. This must come before + because may include arbitrary system headers. */ +#if defined _AIX && !defined __GNUC__ + #pragma alloca +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include "plural-exp.h" + +/* The main function generated by the parser is called __gettextparse, + but we want it to be called PLURAL_PARSE. */ +#ifndef _LIBC +# define __gettextparse PLURAL_PARSE +#endif + +#define YYLEX_PARAM &((struct parse_args *) arg)->cp +#define YYPARSE_PARAM arg +%} +%pure_parser +%expect 7 + +%union { + unsigned long int num; + enum operator op; + struct expression *exp; +} + +%{ +/* Prototypes for local functions. */ +static struct expression *new_exp PARAMS ((int nargs, enum operator op, + struct expression * const *args)); +static inline struct expression *new_exp_0 PARAMS ((enum operator op)); +static inline struct expression *new_exp_1 PARAMS ((enum operator op, + struct expression *right)); +static struct expression *new_exp_2 PARAMS ((enum operator op, + struct expression *left, + struct expression *right)); +static inline struct expression *new_exp_3 PARAMS ((enum operator op, + struct expression *bexp, + struct expression *tbranch, + struct expression *fbranch)); +static int yylex PARAMS ((YYSTYPE *lval, const char **pexp)); +static void yyerror PARAMS ((const char *str)); + +/* Allocation of expressions. */ + +static struct expression * +new_exp (nargs, op, args) + int nargs; + enum operator op; + struct expression * const *args; +{ + int i; + struct expression *newp; + + /* If any of the argument could not be malloc'ed, just return NULL. */ + for (i = nargs - 1; i >= 0; i--) + if (args[i] == NULL) + goto fail; + + /* Allocate a new expression. */ + newp = (struct expression *) malloc (sizeof (*newp)); + if (newp != NULL) + { + newp->nargs = nargs; + newp->operation = op; + for (i = nargs - 1; i >= 0; i--) + newp->val.args[i] = args[i]; + return newp; + } + + fail: + for (i = nargs - 1; i >= 0; i--) + FREE_EXPRESSION (args[i]); + + return NULL; +} + +static inline struct expression * +new_exp_0 (op) + enum operator op; +{ + return new_exp (0, op, NULL); +} + +static inline struct expression * +new_exp_1 (op, right) + enum operator op; + struct expression *right; +{ + struct expression *args[1]; + + args[0] = right; + return new_exp (1, op, args); +} + +static struct expression * +new_exp_2 (op, left, right) + enum operator op; + struct expression *left; + struct expression *right; +{ + struct expression *args[2]; + + args[0] = left; + args[1] = right; + return new_exp (2, op, args); +} + +static inline struct expression * +new_exp_3 (op, bexp, tbranch, fbranch) + enum operator op; + struct expression *bexp; + struct expression *tbranch; + struct expression *fbranch; +{ + struct expression *args[3]; + + args[0] = bexp; + args[1] = tbranch; + args[2] = fbranch; + return new_exp (3, op, args); +} + +%} + +/* This declares that all operators have the same associativity and the + precedence order as in C. See [Harbison, Steele: C, A Reference Manual]. + There is no unary minus and no bitwise operators. + Operators with the same syntactic behaviour have been merged into a single + token, to save space in the array generated by bison. */ +%right '?' /* ? */ +%left '|' /* || */ +%left '&' /* && */ +%left EQUOP2 /* == != */ +%left CMPOP2 /* < > <= >= */ +%left ADDOP2 /* + - */ +%left MULOP2 /* * / % */ +%right '!' /* ! */ + +%token EQUOP2 CMPOP2 ADDOP2 MULOP2 +%token NUMBER +%type exp + +%% + +start: exp + { + if ($1 == NULL) + YYABORT; + ((struct parse_args *) arg)->res = $1; + } + ; + +exp: exp '?' exp ':' exp + { + $$ = new_exp_3 (qmop, $1, $3, $5); + } + | exp '|' exp + { + $$ = new_exp_2 (lor, $1, $3); + } + | exp '&' exp + { + $$ = new_exp_2 (land, $1, $3); + } + | exp EQUOP2 exp + { + $$ = new_exp_2 ($2, $1, $3); + } + | exp CMPOP2 exp + { + $$ = new_exp_2 ($2, $1, $3); + } + | exp ADDOP2 exp + { + $$ = new_exp_2 ($2, $1, $3); + } + | exp MULOP2 exp + { + $$ = new_exp_2 ($2, $1, $3); + } + | '!' exp + { + $$ = new_exp_1 (lnot, $2); + } + | 'n' + { + $$ = new_exp_0 (var); + } + | NUMBER + { + if (($$ = new_exp_0 (num)) != NULL) + $$->val.num = $1; + } + | '(' exp ')' + { + $$ = $2; + } + ; + +%% + +void +internal_function +FREE_EXPRESSION (exp) + struct expression *exp; +{ + if (exp == NULL) + return; + + /* Handle the recursive case. */ + switch (exp->nargs) + { + case 3: + FREE_EXPRESSION (exp->val.args[2]); + /* FALLTHROUGH */ + case 2: + FREE_EXPRESSION (exp->val.args[1]); + /* FALLTHROUGH */ + case 1: + FREE_EXPRESSION (exp->val.args[0]); + /* FALLTHROUGH */ + default: + break; + } + + free (exp); +} + + +static int +yylex (lval, pexp) + YYSTYPE *lval; + const char **pexp; +{ + const char *exp = *pexp; + int result; + + while (1) + { + if (exp[0] == '\0') + { + *pexp = exp; + return YYEOF; + } + + if (exp[0] != ' ' && exp[0] != '\t') + break; + + ++exp; + } + + result = *exp++; + switch (result) + { + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + { + unsigned long int n = result - '0'; + while (exp[0] >= '0' && exp[0] <= '9') + { + n *= 10; + n += exp[0] - '0'; + ++exp; + } + lval->num = n; + result = NUMBER; + } + break; + + case '=': + if (exp[0] == '=') + { + ++exp; + lval->op = equal; + result = EQUOP2; + } + else + result = YYERRCODE; + break; + + case '!': + if (exp[0] == '=') + { + ++exp; + lval->op = not_equal; + result = EQUOP2; + } + break; + + case '&': + case '|': + if (exp[0] == result) + ++exp; + else + result = YYERRCODE; + break; + + case '<': + if (exp[0] == '=') + { + ++exp; + lval->op = less_or_equal; + } + else + lval->op = less_than; + result = CMPOP2; + break; + + case '>': + if (exp[0] == '=') + { + ++exp; + lval->op = greater_or_equal; + } + else + lval->op = greater_than; + result = CMPOP2; + break; + + case '*': + lval->op = mult; + result = MULOP2; + break; + + case '/': + lval->op = divide; + result = MULOP2; + break; + + case '%': + lval->op = module; + result = MULOP2; + break; + + case '+': + lval->op = plus; + result = ADDOP2; + break; + + case '-': + lval->op = minus; + result = ADDOP2; + break; + + case 'n': + case '?': + case ':': + case '(': + case ')': + /* Nothing, just return the character. */ + break; + + case ';': + case '\n': + case '\0': + /* Be safe and let the user call this function again. */ + --exp; + result = YYEOF; + break; + + default: + result = YYERRCODE; +#if YYDEBUG != 0 + --exp; +#endif + break; + } + + *pexp = exp; + + return result; +} + + +static void +yyerror (str) + const char *str; +{ + /* Do nothing. We don't print error messages here. */ +} diff --git a/intl/ref-add.sin b/intl/ref-add.sin new file mode 100644 index 0000000..9830a92 --- /dev/null +++ b/intl/ref-add.sin @@ -0,0 +1,31 @@ +# Add this package to a list of references stored in a text file. +# +# Copyright (C) 2000 Free Software Foundation, Inc. +# +# This program 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, 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, +# USA. +# +# Written by Bruno Haible . +# +/^# Packages using this file: / { + s/# Packages using this file:// + ta + :a + s/ @PACKAGE@ / @PACKAGE@ / + tb + s/ $/ @PACKAGE@ / + :b + s/^/# Packages using this file:/ +} diff --git a/intl/ref-del.sin b/intl/ref-del.sin new file mode 100644 index 0000000..475b4af --- /dev/null +++ b/intl/ref-del.sin @@ -0,0 +1,26 @@ +# Remove this package from a list of references stored in a text file. +# +# Copyright (C) 2000 Free Software Foundation, Inc. +# +# This program 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, 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, +# USA. +# +# Written by Bruno Haible . +# +/^# Packages using this file: / { + s/# Packages using this file:// + s/ @PACKAGE@ / / + s/^/# Packages using this file:/ +} diff --git a/intl/textdomain.c b/intl/textdomain.c new file mode 100644 index 0000000..158a665 --- /dev/null +++ b/intl/textdomain.c @@ -0,0 +1,142 @@ +/* Implementation of the textdomain(3) function. + Copyright (C) 1995-1998, 2000, 2001 Free Software Foundation, Inc. + + This program 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, 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, + USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include + +#ifdef _LIBC +# include +#else +# include "libgnuintl.h" +#endif +#include "gettextP.h" + +#ifdef _LIBC +/* We have to handle multi-threaded applications. */ +# include +#else +/* Provide dummy implementation if this is outside glibc. */ +# define __libc_rwlock_define(CLASS, NAME) +# define __libc_rwlock_wrlock(NAME) +# define __libc_rwlock_unlock(NAME) +#endif + +/* The internal variables in the standalone libintl.a must have different + names than the internal variables in GNU libc, otherwise programs + using libintl.a cannot be linked statically. */ +#if !defined _LIBC +# define _nl_default_default_domain _nl_default_default_domain__ +# define _nl_current_default_domain _nl_current_default_domain__ +#endif + +/* @@ end of prolog @@ */ + +/* Name of the default text domain. */ +extern const char _nl_default_default_domain[]; + +/* Default text domain in which entries for gettext(3) are to be found. */ +extern const char *_nl_current_default_domain; + + +/* Names for the libintl functions are a problem. They must not clash + with existing names and they should follow ANSI C. But this source + code is also used in GNU C Library where the names have a __ + prefix. So we have to make a difference here. */ +#ifdef _LIBC +# define TEXTDOMAIN __textdomain +# ifndef strdup +# define strdup(str) __strdup (str) +# endif +#else +# define TEXTDOMAIN textdomain__ +#endif + +/* Lock variable to protect the global data in the gettext implementation. */ +__libc_rwlock_define (extern, _nl_state_lock) + +/* Set the current default message catalog to DOMAINNAME. + If DOMAINNAME is null, return the current default. + If DOMAINNAME is "", reset to the default of "messages". */ +char * +TEXTDOMAIN (domainname) + const char *domainname; +{ + char *new_domain; + char *old_domain; + + /* A NULL pointer requests the current setting. */ + if (domainname == NULL) + return (char *) _nl_current_default_domain; + + __libc_rwlock_wrlock (_nl_state_lock); + + old_domain = (char *) _nl_current_default_domain; + + /* If domain name is the null string set to default domain "messages". */ + if (domainname[0] == '\0' + || strcmp (domainname, _nl_default_default_domain) == 0) + { + _nl_current_default_domain = _nl_default_default_domain; + new_domain = (char *) _nl_current_default_domain; + } + else if (strcmp (domainname, old_domain) == 0) + /* This can happen and people will use it to signal that some + environment variable changed. */ + new_domain = old_domain; + else + { + /* If the following malloc fails `_nl_current_default_domain' + will be NULL. This value will be returned and so signals we + are out of core. */ +#if defined _LIBC || defined HAVE_STRDUP + new_domain = strdup (domainname); +#else + size_t len = strlen (domainname) + 1; + new_domain = (char *) malloc (len); + if (new_domain != NULL) + memcpy (new_domain, domainname, len); +#endif + + if (new_domain != NULL) + _nl_current_default_domain = new_domain; + } + + /* We use this possibility to signal a change of the loaded catalogs + since this is most likely the case and there is no other easy we + to do it. Do it only when the call was successful. */ + if (new_domain != NULL) + { + ++_nl_msg_cat_cntr; + + if (old_domain != new_domain && old_domain != _nl_default_default_domain) + free (old_domain); + } + + __libc_rwlock_unlock (_nl_state_lock); + + return new_domain; +} + +#ifdef _LIBC +/* Alias for function name in GNU C Library. */ +weak_alias (__textdomain, textdomain); +#endif diff --git a/lib/.cvsignore b/lib/.cvsignore new file mode 100644 index 0000000..e995588 --- /dev/null +++ b/lib/.cvsignore @@ -0,0 +1,3 @@ +.deps +Makefile +Makefile.in diff --git a/lib/Makefile.am b/lib/Makefile.am new file mode 100644 index 0000000..df2c64c --- /dev/null +++ b/lib/Makefile.am @@ -0,0 +1,20 @@ +# +AUTOMAKE_OPTIONS = ../src/ansi2knr + +SUBDIRS = posix + +noinst_LIBRARIES = libgreputils.a + +INCLUDES = -I.. -I$(srcdir) -I../intl +DEFS = -DLIBDIR=\"$(libdir)\" @DEFS@ + +libgreputils_a_SOURCES = \ + closeout.c error.c exclude.c hard-locale.c \ + isdir.c obstack.c quotearg.c savedir.c xmalloc.c xstrtol.c xstrtoumax.c + +libgreputils_a_LIBADD = @LIBOBJS@ @ALLOCA@ +noinst_HEADERS = \ + closeout.h error.h exclude.h fnmatch.h getopt.h \ + hard-locale.h obstack.h quotearg.h regex.h savedir.h xalloc.h xstrtol.h + +EXTRA_DIST = strtol.c malloc.c realloc.c diff --git a/lib/Makefile.in b/lib/Makefile.in new file mode 100644 index 0000000..e528b94 --- /dev/null +++ b/lib/Makefile.in @@ -0,0 +1,655 @@ +# Makefile.in generated by automake 1.10 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +ANSI2KNR = ../src/ansi2knr +subdir = lib +DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in alloca.c atexit.c fnmatch.c getopt.c \ + getopt1.c malloc.c memchr.c realloc.c regex.c stpcpy.c \ + strtoul.c strtoull.c strtoumax.c +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/codeset.m4 \ + $(top_srcdir)/m4/decl.m4 $(top_srcdir)/m4/djgpp.m4 \ + $(top_srcdir)/m4/dosfile.m4 $(top_srcdir)/m4/envsep.m4 \ + $(top_srcdir)/m4/error.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/header.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/inttypes_h.m4 \ + $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/largefile.m4 \ + $(top_srcdir)/m4/lcmessage.m4 $(top_srcdir)/m4/malloc.m4 \ + $(top_srcdir)/m4/mbstate_t.m4 $(top_srcdir)/m4/missing.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/realloc.m4 \ + $(top_srcdir)/m4/regex.m4 $(top_srcdir)/m4/sanity.m4 \ + $(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/ulonglong.m4 \ + $(top_srcdir)/m4/xstrtoumax.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LIBRARIES = $(noinst_LIBRARIES) +AR = ar +ARFLAGS = cru +libgreputils_a_AR = $(AR) $(ARFLAGS) +libgreputils_a_DEPENDENCIES = @LIBOBJS@ @ALLOCA@ +am_libgreputils_a_OBJECTS = closeout$U.$(OBJEXT) error$U.$(OBJEXT) \ + exclude$U.$(OBJEXT) hard-locale$U.$(OBJEXT) isdir$U.$(OBJEXT) \ + obstack$U.$(OBJEXT) quotearg$U.$(OBJEXT) savedir$U.$(OBJEXT) \ + xmalloc$U.$(OBJEXT) xstrtol$U.$(OBJEXT) xstrtoumax$U.$(OBJEXT) +libgreputils_a_OBJECTS = $(am_libgreputils_a_OBJECTS) +DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@ +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libgreputils_a_SOURCES) +DIST_SOURCES = $(libgreputils_a_SOURCES) +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +HEADERS = $(noinst_HEADERS) +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DEFS = -DLIBDIR=\"$(libdir)\" @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GENCAT = @GENCAT@ +GETCONF = @GETCONF@ +GLIBC21 = @GLIBC21@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLBISON = @INTLBISON@ +INTLLIBS = @INTLLIBS@ +INTLOBJS = @INTLOBJS@ +INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +POFILES = @POFILES@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SEP = @SEP@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +U = @U@ +USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ + +# +AUTOMAKE_OPTIONS = ../src/ansi2knr +SUBDIRS = posix +noinst_LIBRARIES = libgreputils.a +INCLUDES = -I.. -I$(srcdir) -I../intl +libgreputils_a_SOURCES = \ + closeout.c error.c exclude.c hard-locale.c \ + isdir.c obstack.c quotearg.c savedir.c xmalloc.c xstrtol.c xstrtoumax.c + +libgreputils_a_LIBADD = @LIBOBJS@ @ALLOCA@ +noinst_HEADERS = \ + closeout.h error.h exclude.h fnmatch.h getopt.h \ + hard-locale.h obstack.h quotearg.h regex.h savedir.h xalloc.h xstrtol.h + +EXTRA_DIST = strtol.c malloc.c realloc.c +all: all-recursive + +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lib/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu lib/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) +libgreputils.a: $(libgreputils_a_OBJECTS) $(libgreputils_a_DEPENDENCIES) + -rm -f libgreputils.a + $(libgreputils_a_AR) libgreputils.a $(libgreputils_a_OBJECTS) $(libgreputils_a_LIBADD) + $(RANLIB) libgreputils.a + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c +../src/ansi2knr: + cd ../src && $(MAKE) $(AM_MAKEFLAGS) ./ansi2knr + +mostlyclean-kr: + -test "$U" = "" || rm -f *_.c + +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/alloca.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/atexit.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/fnmatch.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/getopt.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/getopt1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/malloc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/memchr.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/realloc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/regex.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/stpcpy.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/strtoul.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/strtoull.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/strtoumax.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/closeout$U.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/error$U.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exclude$U.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hard-locale$U.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isdir$U.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/obstack$U.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/quotearg$U.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/savedir$U.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmalloc$U.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xstrtol$U.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xstrtoumax$U.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` +alloca_.c: alloca.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/alloca.c; then echo $(srcdir)/alloca.c; else echo alloca.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +atexit_.c: atexit.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/atexit.c; then echo $(srcdir)/atexit.c; else echo atexit.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +closeout_.c: closeout.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/closeout.c; then echo $(srcdir)/closeout.c; else echo closeout.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +error_.c: error.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/error.c; then echo $(srcdir)/error.c; else echo error.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +exclude_.c: exclude.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/exclude.c; then echo $(srcdir)/exclude.c; else echo exclude.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +fnmatch_.c: fnmatch.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fnmatch.c; then echo $(srcdir)/fnmatch.c; else echo fnmatch.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +getopt_.c: getopt.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/getopt.c; then echo $(srcdir)/getopt.c; else echo getopt.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +getopt1_.c: getopt1.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/getopt1.c; then echo $(srcdir)/getopt1.c; else echo getopt1.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +hard-locale_.c: hard-locale.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/hard-locale.c; then echo $(srcdir)/hard-locale.c; else echo hard-locale.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +isdir_.c: isdir.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/isdir.c; then echo $(srcdir)/isdir.c; else echo isdir.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +malloc_.c: malloc.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/malloc.c; then echo $(srcdir)/malloc.c; else echo malloc.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +memchr_.c: memchr.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/memchr.c; then echo $(srcdir)/memchr.c; else echo memchr.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +obstack_.c: obstack.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/obstack.c; then echo $(srcdir)/obstack.c; else echo obstack.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +quotearg_.c: quotearg.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/quotearg.c; then echo $(srcdir)/quotearg.c; else echo quotearg.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +realloc_.c: realloc.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/realloc.c; then echo $(srcdir)/realloc.c; else echo realloc.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +regex_.c: regex.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/regex.c; then echo $(srcdir)/regex.c; else echo regex.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +savedir_.c: savedir.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/savedir.c; then echo $(srcdir)/savedir.c; else echo savedir.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +stpcpy_.c: stpcpy.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/stpcpy.c; then echo $(srcdir)/stpcpy.c; else echo stpcpy.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +strtoul_.c: strtoul.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/strtoul.c; then echo $(srcdir)/strtoul.c; else echo strtoul.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +strtoull_.c: strtoull.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/strtoull.c; then echo $(srcdir)/strtoull.c; else echo strtoull.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +strtoumax_.c: strtoumax.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/strtoumax.c; then echo $(srcdir)/strtoumax.c; else echo strtoumax.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +xmalloc_.c: xmalloc.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/xmalloc.c; then echo $(srcdir)/xmalloc.c; else echo xmalloc.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +xstrtol_.c: xstrtol.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/xstrtol.c; then echo $(srcdir)/xstrtol.c; else echo xstrtol.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +xstrtoumax_.c: xstrtoumax.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/xstrtoumax.c; then echo $(srcdir)/xstrtoumax.c; else echo xstrtoumax.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +alloca_.$(OBJEXT) atexit_.$(OBJEXT) closeout_.$(OBJEXT) \ +error_.$(OBJEXT) exclude_.$(OBJEXT) fnmatch_.$(OBJEXT) \ +getopt_.$(OBJEXT) getopt1_.$(OBJEXT) hard-locale_.$(OBJEXT) \ +isdir_.$(OBJEXT) malloc_.$(OBJEXT) memchr_.$(OBJEXT) \ +obstack_.$(OBJEXT) quotearg_.$(OBJEXT) realloc_.$(OBJEXT) \ +regex_.$(OBJEXT) savedir_.$(OBJEXT) stpcpy_.$(OBJEXT) \ +strtoul_.$(OBJEXT) strtoull_.$(OBJEXT) strtoumax_.$(OBJEXT) \ +xmalloc_.$(OBJEXT) xstrtol_.$(OBJEXT) xstrtoumax_.$(OBJEXT) : \ +$(ANSI2KNR) + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile $(LIBRARIES) $(HEADERS) +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am + +distclean: distclean-recursive + -rm -rf $(DEPDIR) ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-exec-am: + +install-html: install-html-recursive + +install-info: install-info-recursive + +install-man: + +install-pdf: install-pdf-recursive + +install-ps: install-ps-recursive + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -rf $(DEPDIR) ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ + install-strip + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am check check-am clean clean-generic \ + clean-noinstLIBRARIES ctags ctags-recursive distclean \ + distclean-compile distclean-generic distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs installdirs-am \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-kr pdf \ + pdf-am ps ps-am tags tags-recursive uninstall uninstall-am + +# 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. +.NOEXPORT: diff --git a/lib/alloca.c b/lib/alloca.c new file mode 100644 index 0000000..55a8067 --- /dev/null +++ b/lib/alloca.c @@ -0,0 +1,503 @@ +/* alloca.c -- allocate automatically reclaimed memory + (Mostly) portable public-domain implementation -- D A Gwyn + + This implementation of the PWB library alloca function, + which is used to allocate space off the run-time stack so + that it is automatically reclaimed upon procedure exit, + was inspired by discussions with J. Q. Johnson of Cornell. + J.Otto Tennant contributed the Cray support. + + There are some preprocessor constants that can + be defined when compiling for your specific system, for + improved efficiency; however, the defaults should be okay. + + The general concept of this implementation is to keep + track of all alloca-allocated blocks, and reclaim any + that are found to be deeper in the stack than the current + invocation. This heuristic does not reclaim storage as + soon as it becomes invalid, but it will do so eventually. + + As a special case, alloca(0) reclaims storage without + allocating any. It is a good idea to use alloca(0) in + your main control loop, etc. to force garbage collection. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#if HAVE_STRING_H +# include +#endif +#if HAVE_STDLIB_H +# include +#endif + +#ifdef emacs +# include "blockinput.h" +#endif + +/* If compiling with GCC 2, this file's not needed. */ +#if !defined (__GNUC__) || __GNUC__ < 2 + +/* If someone has defined alloca as a macro, + there must be some other way alloca is supposed to work. */ +# ifndef alloca + +# ifdef emacs +# ifdef static +/* actually, only want this if static is defined as "" + -- this is for usg, in which emacs must undefine static + in order to make unexec workable + */ +# ifndef STACK_DIRECTION +you +lose +-- must know STACK_DIRECTION at compile-time +# endif /* STACK_DIRECTION undefined */ +# endif /* static */ +# endif /* emacs */ + +/* If your stack is a linked list of frames, you have to + provide an "address metric" ADDRESS_FUNCTION macro. */ + +# if defined (CRAY) && defined (CRAY_STACKSEG_END) +long i00afunc (); +# define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg)) +# else +# define ADDRESS_FUNCTION(arg) &(arg) +# endif + +# if __STDC__ +typedef void *pointer; +# else +typedef char *pointer; +# endif + +# ifndef NULL +# define NULL 0 +# endif + +/* Different portions of Emacs need to call different versions of + malloc. The Emacs executable needs alloca to call xmalloc, because + ordinary malloc isn't protected from input signals. On the other + hand, the utilities in lib-src need alloca to call malloc; some of + them are very simple, and don't have an xmalloc routine. + + Non-Emacs programs expect this to call xmalloc. + + Callers below should use malloc. */ + +# ifndef emacs +# define malloc xmalloc +# endif +extern pointer malloc (); + +/* Define STACK_DIRECTION if you know the direction of stack + growth for your system; otherwise it will be automatically + deduced at run-time. + + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ + +# ifndef STACK_DIRECTION +# define STACK_DIRECTION 0 /* Direction unknown. */ +# endif + +# if STACK_DIRECTION != 0 + +# define STACK_DIR STACK_DIRECTION /* Known at compile-time. */ + +# else /* STACK_DIRECTION == 0; need run-time code. */ + +static int stack_dir; /* 1 or -1 once known. */ +# define STACK_DIR stack_dir + +static void +find_stack_direction () +{ + static char *addr = NULL; /* Address of first `dummy', once known. */ + auto char dummy; /* To get stack address. */ + + if (addr == NULL) + { /* Initial entry. */ + addr = ADDRESS_FUNCTION (dummy); + + find_stack_direction (); /* Recurse once. */ + } + else + { + /* Second entry. */ + if (ADDRESS_FUNCTION (dummy) > addr) + stack_dir = 1; /* Stack grew upward. */ + else + stack_dir = -1; /* Stack grew downward. */ + } +} + +# endif /* STACK_DIRECTION == 0 */ + +/* An "alloca header" is used to: + (a) chain together all alloca'ed blocks; + (b) keep track of stack depth. + + It is very important that sizeof(header) agree with malloc + alignment chunk size. The following default should work okay. */ + +# ifndef ALIGN_SIZE +# define ALIGN_SIZE sizeof(double) +# endif + +typedef union hdr +{ + char align[ALIGN_SIZE]; /* To force sizeof(header). */ + struct + { + union hdr *next; /* For chaining headers. */ + char *deep; /* For stack depth measure. */ + } h; +} header; + +static header *last_alloca_header = NULL; /* -> last alloca header. */ + +/* Return a pointer to at least SIZE bytes of storage, + which will be automatically reclaimed upon exit from + the procedure that called alloca. Originally, this space + was supposed to be taken from the current stack frame of the + caller, but that method cannot be made to work for some + implementations of C, for example under Gould's UTX/32. */ + +pointer +alloca (unsigned size) +{ + auto char probe; /* Probes stack depth: */ + register char *depth = ADDRESS_FUNCTION (probe); + +# if STACK_DIRECTION == 0 + if (STACK_DIR == 0) /* Unknown growth direction. */ + find_stack_direction (); +# endif + + /* Reclaim garbage, defined as all alloca'd storage that + was allocated from deeper in the stack than currently. */ + + { + register header *hp; /* Traverses linked list. */ + +# ifdef emacs + BLOCK_INPUT; +# endif + + for (hp = last_alloca_header; hp != NULL;) + if ((STACK_DIR > 0 && hp->h.deep > depth) + || (STACK_DIR < 0 && hp->h.deep < depth)) + { + register header *np = hp->h.next; + + free ((pointer) hp); /* Collect garbage. */ + + hp = np; /* -> next header. */ + } + else + break; /* Rest are not deeper. */ + + last_alloca_header = hp; /* -> last valid storage. */ + +# ifdef emacs + UNBLOCK_INPUT; +# endif + } + + if (size == 0) + return NULL; /* No allocation required. */ + + /* Allocate combined header + user data storage. */ + + { + register pointer new = malloc (sizeof (header) + size); + /* Address of header. */ + + if (new == 0) + abort(); + + ((header *) new)->h.next = last_alloca_header; + ((header *) new)->h.deep = depth; + + last_alloca_header = (header *) new; + + /* User storage begins just after header. */ + + return (pointer) ((char *) new + sizeof (header)); + } +} + +# if defined (CRAY) && defined (CRAY_STACKSEG_END) + +# ifdef DEBUG_I00AFUNC +# include +# endif + +# ifndef CRAY_STACK +# define CRAY_STACK +# ifndef CRAY2 +/* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */ +struct stack_control_header + { + long shgrow:32; /* Number of times stack has grown. */ + long shaseg:32; /* Size of increments to stack. */ + long shhwm:32; /* High water mark of stack. */ + long shsize:32; /* Current size of stack (all segments). */ + }; + +/* The stack segment linkage control information occurs at + the high-address end of a stack segment. (The stack + grows from low addresses to high addresses.) The initial + part of the stack segment linkage control information is + 0200 (octal) words. This provides for register storage + for the routine which overflows the stack. */ + +struct stack_segment_linkage + { + long ss[0200]; /* 0200 overflow words. */ + long sssize:32; /* Number of words in this segment. */ + long ssbase:32; /* Offset to stack base. */ + long:32; + long sspseg:32; /* Offset to linkage control of previous + segment of stack. */ + long:32; + long sstcpt:32; /* Pointer to task common address block. */ + long sscsnm; /* Private control structure number for + microtasking. */ + long ssusr1; /* Reserved for user. */ + long ssusr2; /* Reserved for user. */ + long sstpid; /* Process ID for pid based multi-tasking. */ + long ssgvup; /* Pointer to multitasking thread giveup. */ + long sscray[7]; /* Reserved for Cray Research. */ + long ssa0; + long ssa1; + long ssa2; + long ssa3; + long ssa4; + long ssa5; + long ssa6; + long ssa7; + long sss0; + long sss1; + long sss2; + long sss3; + long sss4; + long sss5; + long sss6; + long sss7; + }; + +# else /* CRAY2 */ +/* The following structure defines the vector of words + returned by the STKSTAT library routine. */ +struct stk_stat + { + long now; /* Current total stack size. */ + long maxc; /* Amount of contiguous space which would + be required to satisfy the maximum + stack demand to date. */ + long high_water; /* Stack high-water mark. */ + long overflows; /* Number of stack overflow ($STKOFEN) calls. */ + long hits; /* Number of internal buffer hits. */ + long extends; /* Number of block extensions. */ + long stko_mallocs; /* Block allocations by $STKOFEN. */ + long underflows; /* Number of stack underflow calls ($STKRETN). */ + long stko_free; /* Number of deallocations by $STKRETN. */ + long stkm_free; /* Number of deallocations by $STKMRET. */ + long segments; /* Current number of stack segments. */ + long maxs; /* Maximum number of stack segments so far. */ + long pad_size; /* Stack pad size. */ + long current_address; /* Current stack segment address. */ + long current_size; /* Current stack segment size. This + number is actually corrupted by STKSTAT to + include the fifteen word trailer area. */ + long initial_address; /* Address of initial segment. */ + long initial_size; /* Size of initial segment. */ + }; + +/* The following structure describes the data structure which trails + any stack segment. I think that the description in 'asdef' is + out of date. I only describe the parts that I am sure about. */ + +struct stk_trailer + { + long this_address; /* Address of this block. */ + long this_size; /* Size of this block (does not include + this trailer). */ + long unknown2; + long unknown3; + long link; /* Address of trailer block of previous + segment. */ + long unknown5; + long unknown6; + long unknown7; + long unknown8; + long unknown9; + long unknown10; + long unknown11; + long unknown12; + long unknown13; + long unknown14; + }; + +# endif /* CRAY2 */ +# endif /* not CRAY_STACK */ + +# ifdef CRAY2 +/* Determine a "stack measure" for an arbitrary ADDRESS. + I doubt that "lint" will like this much. */ + +static long +i00afunc (long *address) +{ + struct stk_stat status; + struct stk_trailer *trailer; + long *block, size; + long result = 0; + + /* We want to iterate through all of the segments. The first + step is to get the stack status structure. We could do this + more quickly and more directly, perhaps, by referencing the + $LM00 common block, but I know that this works. */ + + STKSTAT (&status); + + /* Set up the iteration. */ + + trailer = (struct stk_trailer *) (status.current_address + + status.current_size + - 15); + + /* There must be at least one stack segment. Therefore it is + a fatal error if "trailer" is null. */ + + if (trailer == 0) + abort (); + + /* Discard segments that do not contain our argument address. */ + + while (trailer != 0) + { + block = (long *) trailer->this_address; + size = trailer->this_size; + if (block == 0 || size == 0) + abort (); + trailer = (struct stk_trailer *) trailer->link; + if ((block <= address) && (address < (block + size))) + break; + } + + /* Set the result to the offset in this segment and add the sizes + of all predecessor segments. */ + + result = address - block; + + if (trailer == 0) + { + return result; + } + + do + { + if (trailer->this_size <= 0) + abort (); + result += trailer->this_size; + trailer = (struct stk_trailer *) trailer->link; + } + while (trailer != 0); + + /* We are done. Note that if you present a bogus address (one + not in any segment), you will get a different number back, formed + from subtracting the address of the first block. This is probably + not what you want. */ + + return (result); +} + +# else /* not CRAY2 */ +/* Stack address function for a CRAY-1, CRAY X-MP, or CRAY Y-MP. + Determine the number of the cell within the stack, + given the address of the cell. The purpose of this + routine is to linearize, in some sense, stack addresses + for alloca. */ + +static long +i00afunc (long address) +{ + long stkl = 0; + + long size, pseg, this_segment, stack; + long result = 0; + + struct stack_segment_linkage *ssptr; + + /* Register B67 contains the address of the end of the + current stack segment. If you (as a subprogram) store + your registers on the stack and find that you are past + the contents of B67, you have overflowed the segment. + + B67 also points to the stack segment linkage control + area, which is what we are really interested in. */ + + stkl = CRAY_STACKSEG_END (); + ssptr = (struct stack_segment_linkage *) stkl; + + /* If one subtracts 'size' from the end of the segment, + one has the address of the first word of the segment. + + If this is not the first segment, 'pseg' will be + nonzero. */ + + pseg = ssptr->sspseg; + size = ssptr->sssize; + + this_segment = stkl - size; + + /* It is possible that calling this routine itself caused + a stack overflow. Discard stack segments which do not + contain the target address. */ + + while (!(this_segment <= address && address <= stkl)) + { +# ifdef DEBUG_I00AFUNC + fprintf (stderr, "%011o %011o %011o\n", this_segment, address, stkl); +# endif + if (pseg == 0) + break; + stkl = stkl - pseg; + ssptr = (struct stack_segment_linkage *) stkl; + size = ssptr->sssize; + pseg = ssptr->sspseg; + this_segment = stkl - size; + } + + result = address - this_segment; + + /* If you subtract pseg from the current end of the stack, + you get the address of the previous stack segment's end. + This seems a little convoluted to me, but I'll bet you save + a cycle somewhere. */ + + while (pseg != 0) + { +# ifdef DEBUG_I00AFUNC + fprintf (stderr, "%011o %011o\n", pseg, size); +# endif + stkl = stkl - pseg; + ssptr = (struct stack_segment_linkage *) stkl; + size = ssptr->sssize; + pseg = ssptr->sspseg; + result += size; + } + return (result); +} + +# endif /* not CRAY2 */ +# endif /* CRAY */ + +# endif /* no alloca */ +#endif /* not GCC version 2 */ diff --git a/lib/atexit.c b/lib/atexit.c new file mode 100644 index 0000000..85e992f --- /dev/null +++ b/lib/atexit.c @@ -0,0 +1,14 @@ +/* Wrapper to implement ANSI C's atexit using SunOS's on_exit. */ +/* This function is in the public domain. --Mike Stump. */ + +#include "config.h" + +int +atexit(f) + void (*f)(); +{ + /* If the system doesn't provide a definition for atexit, use on_exit + if the system provides that. */ + on_exit (f, 0); + return 0; +} diff --git a/lib/closeout.c b/lib/closeout.c new file mode 100644 index 0000000..c4b6098 --- /dev/null +++ b/lib/closeout.c @@ -0,0 +1,121 @@ +/* closeout.c - close standard output + Copyright (C) 1998, 1999, 2000, 2001 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +#if HAVE_CONFIG_H +# include +#endif + +#if ENABLE_NLS +# include +# define _(Text) gettext (Text) +#else +# define _(Text) Text +#endif + +#if HAVE_STDLIB_H +# include +#endif +#ifndef EXIT_FAILURE +# define EXIT_FAILURE 1 +#endif + +#include + +#include +#ifndef errno +extern int errno; +#endif + +#include "closeout.h" +#include "error.h" +#include "quotearg.h" +#if 0 +#include "__fpending.h" +#endif + +static int default_exit_status = EXIT_FAILURE; +static const char *file_name; + +/* Set the value to be used for the exit status when close_stdout is called. + This is useful when it is not convenient to call close_stdout_status, + e.g., when close_stdout is called via atexit. */ +void +close_stdout_set_status (int status) +{ + default_exit_status = status; +} + +/* Set the file name to be reported in the event an error is detected + by close_stdout_status. */ +void +close_stdout_set_file_name (const char *file) +{ + file_name = file; +} + +/* Close standard output, exiting with status STATUS on failure. + If a program writes *anything* to stdout, that program should `fflush' + stdout and make sure that it succeeds before exiting. Otherwise, + suppose that you go to the extreme of checking the return status + of every function that does an explicit write to stdout. The last + printf can succeed in writing to the internal stream buffer, and yet + the fclose(stdout) could still fail (due e.g., to a disk full error) + when it tries to write out that buffered data. Thus, you would be + left with an incomplete output file and the offending program would + exit successfully. + + FIXME: note the fflush suggested above is implicit in the fclose + we actually do below. Consider doing only the fflush and/or using + setvbuf to inhibit buffering. + + Besides, it's wasteful to check the return value from every call + that writes to stdout -- just let the internal stream state record + the failure. That's what the ferror test is checking below. + + It's important to detect such failures and exit nonzero because many + tools (most notably `make' and other build-management systems) depend + on being able to detect failure in other tools via their exit status. */ + +void +close_stdout_status (int status) +{ + int e = ferror (stdout) ? 0 : -1; + +#if 0 + if (__fpending (stdout) == 0) + return; +#endif + + if (fclose (stdout) != 0) + e = errno; + + if (0 < e) + { + char const *write_error = _("write error"); + if (file_name) + error (status, e, "%s: %s", quotearg_colon (file_name), write_error); + else + error (status, e, "%s", write_error); + } +} + +/* Close standard output, exiting with status EXIT_FAILURE on failure. */ +void +close_stdout (void) +{ + close_stdout_status (default_exit_status); +} diff --git a/lib/closeout.h b/lib/closeout.h new file mode 100644 index 0000000..80f24e4 --- /dev/null +++ b/lib/closeout.h @@ -0,0 +1,17 @@ +#ifndef CLOSEOUT_H +# define CLOSEOUT_H 1 + +# ifndef PARAMS +# if defined PROTOTYPES || (defined __STDC__ && __STDC__) +# define PARAMS(Args) Args +# else +# define PARAMS(Args) () +# endif +# endif + +void close_stdout_set_status PARAMS ((int status)); +void close_stdout_set_file_name PARAMS ((const char *file)); +void close_stdout PARAMS ((void)); +void close_stdout_status PARAMS ((int status)); + +#endif diff --git a/lib/error.c b/lib/error.c new file mode 100644 index 0000000..ec94fda --- /dev/null +++ b/lib/error.c @@ -0,0 +1,276 @@ +/* Error handler for noninteractive utilities + Copyright (C) 1990-1998, 2000 Free Software Foundation, Inc. + + This file is part of the GNU C Library. Its master source is NOT part of + the C library, however. The master source lives in /gd/gnu/lib. + + The GNU 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 GNU 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., + 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by David MacKenzie . */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#if HAVE_LIBINTL_H +# include +#endif + +#if HAVE_VPRINTF || HAVE_DOPRNT || _LIBC +# if __STDC__ +# include +# define VA_START(args, lastarg) va_start(args, lastarg) +# else +# include +# define VA_START(args, lastarg) va_start(args) +# endif +#else +# define va_alist a1, a2, a3, a4, a5, a6, a7, a8 +# define va_dcl char *a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8; +#endif + +#if STDC_HEADERS || _LIBC +# include +# include +#else +void exit (); +#endif + +#include "error.h" + +#ifndef HAVE_DECL_STRERROR_R +"this configure-time declaration test was not run" +#endif +#if !HAVE_DECL_STRERROR_R +char *strerror_r (); +#endif + +#ifndef _ +# define _(String) String +#endif + +/* If NULL, error will flush stdout, then print on stderr the program + name, a colon and a space. Otherwise, error will call this + function without parameters instead. */ +void (*error_print_progname) ( +#if __STDC__ - 0 + void +#endif + ); + +/* This variable is incremented each time `error' is called. */ +unsigned int error_message_count; + +#ifdef _LIBC +/* In the GNU C library, there is a predefined variable for this. */ + +# define program_name program_invocation_name +# include + +/* In GNU libc we want do not want to use the common name `error' directly. + Instead make it a weak alias. */ +# define error __error +# define error_at_line __error_at_line + +# ifdef USE_IN_LIBIO +# include +# define fflush(s) _IO_fflush (s) +# endif + +#else /* not _LIBC */ + +/* The calling program should define program_name and set it to the + name of the executing program. */ +extern char *program_name; + +# ifdef HAVE_STRERROR_R +# define __strerror_r strerror_r +# else +# if HAVE_STRERROR +# ifndef strerror /* On some systems, strerror is a macro */ +char *strerror (); +# endif +# else +static char * +private_strerror (errnum) + int errnum; +{ + extern char *sys_errlist[]; + extern int sys_nerr; + + if (errnum > 0 && errnum <= sys_nerr) + return _(sys_errlist[errnum]); + return _("Unknown system error"); +} +# define strerror private_strerror +# endif /* HAVE_STRERROR */ +# endif /* HAVE_STRERROR_R */ +#endif /* not _LIBC */ + +/* Print the program name and error message MESSAGE, which is a printf-style + format string with optional args. + If ERRNUM is nonzero, print its corresponding system error message. + Exit with status STATUS if it is nonzero. */ +/* VARARGS */ + +void +#if defined VA_START && __STDC__ +error (int status, int errnum, const char *message, ...) +#else +error (status, errnum, message, va_alist) + int status; + int errnum; + char *message; + va_dcl +#endif +{ +#ifdef VA_START + va_list args; +#endif + + if (error_print_progname) + (*error_print_progname) (); + else + { + fflush (stdout); + fprintf (stderr, "%s: ", program_name); + } + +#ifdef VA_START + VA_START (args, message); +# if HAVE_VPRINTF || _LIBC + vfprintf (stderr, message, args); +# else + _doprnt (message, args, stderr); +# endif + va_end (args); +#else + fprintf (stderr, message, a1, a2, a3, a4, a5, a6, a7, a8); +#endif + + ++error_message_count; + if (errnum) + { +#if defined HAVE_STRERROR_R || _LIBC + char errbuf[1024]; +# if defined STRERROR_R_CHAR_P || _LIBC + fprintf (stderr, ": %s", __strerror_r (errnum, errbuf, sizeof errbuf)); +# else + /* Don't use __strerror_r's return value because on some systems + (at least DEC UNIX 4.0[A-D]) strerror_r returns `int'. */ + __strerror_r (errnum, errbuf, sizeof errbuf); + fprintf (stderr, ": %s", errbuf); +# endif +#else + fprintf (stderr, ": %s", strerror (errnum)); +#endif + } + putc ('\n', stderr); + fflush (stderr); + if (status) + exit (status); +} + +/* Sometimes we want to have at most one error per line. This + variable controls whether this mode is selected or not. */ +int error_one_per_line; + +void +#if defined VA_START && __STDC__ +error_at_line (int status, int errnum, const char *file_name, + unsigned int line_number, const char *message, ...) +#else +error_at_line (status, errnum, file_name, line_number, message, va_alist) + int status; + int errnum; + const char *file_name; + unsigned int line_number; + char *message; + va_dcl +#endif +{ +#ifdef VA_START + va_list args; +#endif + + if (error_one_per_line) + { + static const char *old_file_name; + static unsigned int old_line_number; + + if (old_line_number == line_number && + (file_name == old_file_name || !strcmp (old_file_name, file_name))) + /* Simply return and print nothing. */ + return; + + old_file_name = file_name; + old_line_number = line_number; + } + + if (error_print_progname) + (*error_print_progname) (); + else + { + fflush (stdout); + fprintf (stderr, "%s:", program_name); + } + + if (file_name != NULL) + fprintf (stderr, "%s:%d: ", file_name, line_number); + +#ifdef VA_START + VA_START (args, message); +# if HAVE_VPRINTF || _LIBC + vfprintf (stderr, message, args); +# else + _doprnt (message, args, stderr); +# endif + va_end (args); +#else + fprintf (stderr, message, a1, a2, a3, a4, a5, a6, a7, a8); +#endif + + ++error_message_count; + if (errnum) + { +#if defined HAVE_STRERROR_R || _LIBC + char errbuf[1024]; +# if HAVE_WORKING_STRERROR_R || _LIBC + fprintf (stderr, ": %s", __strerror_r (errnum, errbuf, sizeof errbuf)); +# else + /* Don't use __strerror_r's return value because on some systems + (at least DEC UNIX 4.0[A-D]) strerror_r returns `int'. */ + __strerror_r (errnum, errbuf, sizeof errbuf); + fprintf (stderr, ": %s", errbuf); +# endif +#else + fprintf (stderr, ": %s", strerror (errnum)); +#endif + } + putc ('\n', stderr); + fflush (stderr); + if (status) + exit (status); +} + +#ifdef _LIBC +/* Make the weak alias. */ +# undef error +# undef error_at_line +weak_alias (__error, error) +weak_alias (__error_at_line, error_at_line) +#endif diff --git a/lib/error.h b/lib/error.h new file mode 100644 index 0000000..4241972 --- /dev/null +++ b/lib/error.h @@ -0,0 +1,78 @@ +/* Declaration for error-reporting function + Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. + + + NOTE: The canonical source of this file is maintained with the GNU C Library. + Bugs can be reported to bug-glibc@prep.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 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, + USA. */ + +#ifndef _ERROR_H +#define _ERROR_H 1 + +#ifndef __attribute__ +/* This feature is available in gcc versions 2.5 and later. */ +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__ +# define __attribute__(Spec) /* empty */ +# endif +/* The __-protected variants of `format' and `printf' attributes + are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */ +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) +# define __format__ format +# define __printf__ printf +# endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined (__STDC__) && __STDC__ + +/* Print a message with `fprintf (stderr, FORMAT, ...)'; + if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM). + If STATUS is nonzero, terminate the program with `exit (STATUS)'. */ + +extern void error (int status, int errnum, const char *format, ...) + __attribute__ ((__format__ (__printf__, 3, 4))); + +extern void error_at_line (int status, int errnum, const char *fname, + unsigned int lineno, const char *format, ...) + __attribute__ ((__format__ (__printf__, 5, 6))); + +/* If NULL, error will flush stdout, then print on stderr the program + name, a colon and a space. Otherwise, error will call this + function without parameters instead. */ +extern void (*error_print_progname) (void); + +#else +void error (); +void error_at_line (); +extern void (*error_print_progname) (); +#endif + +/* This variable is incremented each time `error' is called. */ +extern unsigned int error_message_count; + +/* Sometimes we want to have at most one error per line. This + variable controls whether this mode is selected or not. */ +extern int error_one_per_line; + +#ifdef __cplusplus +} +#endif + +#endif /* error.h */ diff --git a/lib/exclude.c b/lib/exclude.c new file mode 100644 index 0000000..d7ed681 --- /dev/null +++ b/lib/exclude.c @@ -0,0 +1,128 @@ +/* exclude.c -- exclude file names + Copyright 1992, 1993, 1994, 1997, 1999, 2000 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, + 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Paul Eggert */ + +#if HAVE_CONFIG_H +# include +#endif + +#include +#ifndef errno +extern int errno; +#endif +#include +#include +#include +#include + +void *xmalloc PARAMS ((size_t)); +void *xrealloc PARAMS ((void *, size_t)); + +/* Keep track of excluded file name patterns. */ + +struct exclude + { + char const **exclude; + int exclude_alloc; + int exclude_count; + }; + +struct exclude * +new_exclude (void) +{ + struct exclude *ex = (struct exclude *) xmalloc (sizeof (struct exclude)); + ex->exclude_count = 0; + ex->exclude_alloc = 64; + ex->exclude = (char const **) xmalloc (ex->exclude_alloc * sizeof (char *)); + return ex; +} + +int +excluded_filename (struct exclude const *ex, char const *f, int options) +{ + char const * const *exclude = ex->exclude; + int exclude_count = ex->exclude_count; + int i; + + for (i = 0; i < exclude_count; i++) + if (fnmatch (exclude[i], f, options) == 0) + return 1; + + return 0; +} + +void +add_exclude (struct exclude *ex, char const *pattern) +{ + if (ex->exclude_alloc <= ex->exclude_count) + ex->exclude = (char const **) xrealloc (ex->exclude, + ((ex->exclude_alloc *= 2) + * sizeof (char *))); + + ex->exclude[ex->exclude_count++] = pattern; +} + +int +add_exclude_file (void (*add_func) PARAMS ((struct exclude *, char const *)), + struct exclude *ex, char const *filename, char line_end) +{ + int use_stdin = filename[0] == '-' && !filename[1]; + FILE *in; + char *buf; + char *p; + char const *pattern; + char const *lim; + size_t buf_alloc = 1024; + size_t buf_count = 0; + int c; + int e = 0; + + if (use_stdin) + in = stdin; + else if (! (in = fopen (filename, "r"))) + return -1; + + buf = xmalloc (buf_alloc); + + while ((c = getc (in)) != EOF) + { + buf[buf_count++] = c; + if (buf_count == buf_alloc) + buf = xrealloc (buf, buf_alloc *= 2); + } + + buf = xrealloc (buf, buf_count + 1); + + if (ferror (in)) + e = errno; + + if (!use_stdin && fclose (in) != 0) + e = errno; + + for (pattern = p = buf, lim = buf + buf_count; p <= lim; p++) + if (p < lim ? *p == line_end : buf < p && p[-1]) + { + *p = '\0'; + (*add_func) (ex, pattern); + pattern = p + 1; + } + + errno = e; + return e ? -1 : 0; +} diff --git a/lib/exclude.h b/lib/exclude.h new file mode 100644 index 0000000..18b38b5 --- /dev/null +++ b/lib/exclude.h @@ -0,0 +1,35 @@ +/* exclude.h -- declarations for excluding file names + Copyright 1992, 1993, 1994, 1997, 1999 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, + 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Paul Eggert */ + +#ifndef PARAMS +# if defined PROTOTYPES || (defined __STDC__ && __STDC__) +# define PARAMS(Args) Args +# else +# define PARAMS(Args) () +# endif +#endif + +struct exclude; + +struct exclude *new_exclude PARAMS ((void)); +void add_exclude PARAMS ((struct exclude *, char const *)); +int add_exclude_file PARAMS ((void (*) (struct exclude *, char const *), + struct exclude *, char const *, char)); +int excluded_filename PARAMS ((struct exclude const *, char const *, int)); diff --git a/lib/fnmatch.c b/lib/fnmatch.c new file mode 100644 index 0000000..fc2f5e4 --- /dev/null +++ b/lib/fnmatch.c @@ -0,0 +1,230 @@ +/* Copyright 1991, 1992, 1993, 1996, 1997, 2000 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +#if HAVE_CONFIG_H +# include +#endif + +/* Enable GNU extensions in fnmatch.h. */ +#ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +#endif + +#include +#include +#include + +#if defined STDC_HEADERS || !defined isascii +# define IN_CTYPE_DOMAIN(c) 1 +#else +# define IN_CTYPE_DOMAIN(c) isascii (c) +#endif + +#define ISUPPER(c) (IN_CTYPE_DOMAIN (c) && isupper (c)) + + +#ifndef errno +extern int errno; +#endif + +/* Match STRING against the filename pattern PATTERN, returning zero if + it matches, nonzero if not. */ +int +fnmatch (const char *pattern, const char *string, int flags) +{ + register const char *p = pattern, *n = string; + register char c; + +/* Note that this evaluates C many times. */ +#define FOLD(c) ((flags & FNM_CASEFOLD) && ISUPPER ((unsigned char) (c)) \ + ? tolower ((unsigned char) (c)) \ + : (c)) + + while ((c = *p++) != '\0') + { + c = FOLD (c); + + switch (c) + { + case '?': + if (*n == '\0') + return FNM_NOMATCH; + else if ((flags & FNM_FILE_NAME) && *n == '/') + return FNM_NOMATCH; + else if ((flags & FNM_PERIOD) && *n == '.' && + (n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/'))) + return FNM_NOMATCH; + break; + + case '\\': + if (!(flags & FNM_NOESCAPE)) + { + c = *p++; + if (c == '\0') + /* Trailing \ loses. */ + return FNM_NOMATCH; + c = FOLD (c); + } + if (FOLD (*n) != c) + return FNM_NOMATCH; + break; + + case '*': + if ((flags & FNM_PERIOD) && *n == '.' && + (n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/'))) + return FNM_NOMATCH; + + for (c = *p++; c == '?' || c == '*'; c = *p++) + { + if (c == '?') + { + /* A ? needs to match one character. */ + if (*n == '\0' || (*n == '/' && (flags & FNM_FILE_NAME))) + /* There isn't another character; no match. */ + return FNM_NOMATCH; + else + /* One character of the string is consumed in matching + this ? wildcard, so *??? won't match if there are + less than three characters. */ + ++n; + } + } + + if (c == '\0') + { + if ((flags & (FNM_FILE_NAME | FNM_LEADING_DIR)) == FNM_FILE_NAME) + for (; *n != '\0'; n++) + if (*n == '/') + return FNM_NOMATCH; + return 0; + } + + { + char c1 = (!(flags & FNM_NOESCAPE) && c == '\\') ? *p : c; + c1 = FOLD (c1); + for (--p; *n != '\0'; ++n) + if ((c == '[' || FOLD (*n) == c1) && + fnmatch (p, n, flags & ~FNM_PERIOD) == 0) + return 0; + else if (*n == '/' && (flags & FNM_FILE_NAME)) + break; + return FNM_NOMATCH; + } + + case '[': + { + /* Nonzero if the sense of the character class is inverted. */ + register int not; + + if (*n == '\0') + return FNM_NOMATCH; + + if ((flags & FNM_PERIOD) && *n == '.' && + (n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/'))) + return FNM_NOMATCH; + + not = (*p == '!' || *p == '^'); + if (not) + ++p; + + c = *p++; + for (;;) + { + register char cstart = c, cend = c; + + if (!(flags & FNM_NOESCAPE) && c == '\\') + { + if (*p == '\0') + return FNM_NOMATCH; + cstart = cend = *p++; + } + + cstart = cend = FOLD (cstart); + + if (c == '\0') + /* [ (unterminated) loses. */ + return FNM_NOMATCH; + + c = *p++; + c = FOLD (c); + + if ((flags & FNM_FILE_NAME) && c == '/') + /* [/] can never match. */ + return FNM_NOMATCH; + + if (c == '-' && *p != ']') + { + cend = *p++; + if (!(flags & FNM_NOESCAPE) && cend == '\\') + cend = *p++; + if (cend == '\0') + return FNM_NOMATCH; + cend = FOLD (cend); + + c = *p++; + } + + if (FOLD (*n) >= cstart && FOLD (*n) <= cend) + goto matched; + + if (c == ']') + break; + } + if (!not) + return FNM_NOMATCH; + break; + + matched:; + /* Skip the rest of the [...] that already matched. */ + while (c != ']') + { + if (c == '\0') + /* [... (unterminated) loses. */ + return FNM_NOMATCH; + + c = *p++; + if (!(flags & FNM_NOESCAPE) && c == '\\') + { + if (*p == '\0') + return FNM_NOMATCH; + /* XXX 1003.2d11 is unclear if this is right. */ + ++p; + } + } + if (not) + return FNM_NOMATCH; + } + break; + + default: + if (c != FOLD (*n)) + return FNM_NOMATCH; + } + + ++n; + } + + if (*n == '\0') + return 0; + + if ((flags & FNM_LEADING_DIR) && *n == '/') + /* The FNM_LEADING_DIR flag says that "foo*" matches "foobar/frobozz". */ + return 0; + + return FNM_NOMATCH; + +#undef FOLD +} diff --git a/lib/fnmatch.h b/lib/fnmatch.h new file mode 100644 index 0000000..c858606 --- /dev/null +++ b/lib/fnmatch.h @@ -0,0 +1,69 @@ +/* Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc. + +NOTE: The canonical source of this file is maintained with the GNU C Library. +Bugs can be reported to bug-glibc@prep.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 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifndef _FNMATCH_H + +#define _FNMATCH_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined (__cplusplus) || (defined (__STDC__) && __STDC__) +#undef __P +#define __P(protos) protos +#else /* Not C++ or ANSI C. */ +#undef __P +#define __P(protos) () +/* We can get away without defining `const' here only because in this file + it is used only inside the prototype for `fnmatch', which is elided in + non-ANSI C where `const' is problematical. */ +#endif /* C++ or ANSI C. */ + + +/* We #undef these before defining them because some losing systems + (HP-UX A.08.07 for example) define these in . */ +#undef FNM_PATHNAME +#undef FNM_NOESCAPE +#undef FNM_PERIOD + +/* Bits set in the FLAGS argument to `fnmatch'. */ +#define FNM_PATHNAME (1 << 0) /* No wildcard can ever match `/'. */ +#define FNM_NOESCAPE (1 << 1) /* Backslashes don't quote special chars. */ +#define FNM_PERIOD (1 << 2) /* Leading `.' is matched only explicitly. */ + +#if !defined (_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 2 || defined (_GNU_SOURCE) +#define FNM_FILE_NAME FNM_PATHNAME /* Preferred GNU name. */ +#define FNM_LEADING_DIR (1 << 3) /* Ignore `/...' after a match. */ +#define FNM_CASEFOLD (1 << 4) /* Compare without regard to case. */ +#endif + +/* Value returned by `fnmatch' if STRING does not match PATTERN. */ +#define FNM_NOMATCH 1 + +/* Match STRING against the filename pattern PATTERN, + returning zero if it matches, FNM_NOMATCH if not. */ +extern int fnmatch __P ((const char *__pattern, const char *__string, + int __flags)); + +#ifdef __cplusplus +} +#endif + +#endif /* fnmatch.h */ diff --git a/lib/getopt.c b/lib/getopt.c new file mode 100644 index 0000000..c24b782 --- /dev/null +++ b/lib/getopt.c @@ -0,0 +1,1049 @@ +/* Getopt for GNU. + NOTE: The canonical source of this file is maintained with the GNU + C Library. Bugs can be reported to bug-glibc@gnu.org. + + Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 + 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* This tells Alpha OSF/1 not to define a getopt prototype in . + Ditto for AIX 3.2 and . */ +#ifndef _NO_PROTO +# define _NO_PROTO +#endif + +#ifdef HAVE_CONFIG_H +# include +#else +# if !defined __STDC__ || !__STDC__ +/* This is a separate conditional since some stdc systems + reject `defined (const)'. */ +# ifndef const +# define const +# endif +# endif +#endif + +#include + +/* 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 + 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. */ + +#define GETOPT_INTERFACE_VERSION 2 +#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 +# include +# if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION +# define ELIDE_CODE +# endif +#endif + +#ifndef ELIDE_CODE + + +/* This needs to come after some library #include + to get __GNU_LIBRARY__ defined. */ +#ifdef __GNU_LIBRARY__ +/* Don't include stdlib.h for non-GNU C libraries because some of them + contain conflicting prototypes for getopt. */ +# include +# include +#endif /* GNU C library. */ + +#ifdef VMS +# include +# if HAVE_STRING_H - 0 +# include +# endif +#endif + +#ifndef _ +/* This is for other GNU distributions with internationalized messages. + When compiling libc, the _ macro is predefined. */ +# ifdef HAVE_LIBINTL_H +# include +# define _(msgid) gettext (msgid) +# else +# define _(msgid) (msgid) +# endif +#endif + +/* This version of `getopt' appears to the caller like standard Unix `getopt' + but it behaves differently for the user, since it allows the user + to intersperse the options with the other arguments. + + As `getopt' works, it permutes the elements of ARGV so that, + when it is done, all the options precede everything else. Thus + all application programs are extended to handle flexible argument order. + + Setting the environment variable POSIXLY_CORRECT disables permutation. + Then the behavior is completely standard. + + GNU application programs can use a third alternative mode in which + they can distinguish the relative order of options and other arguments. */ + +#include "getopt.h" + +/* For communication from `getopt' to the caller. + When `getopt' finds an option that takes an argument, + the argument value is returned here. + Also, when `ordering' is RETURN_IN_ORDER, + each non-option ARGV-element is returned here. */ + +char *optarg; + +/* Index in ARGV of the next element to be scanned. + This is used for communication to and from the caller + and for communication between successive calls to `getopt'. + + On entry to `getopt', zero means this is the first call; initialize. + + When `getopt' returns -1, this is the index of the first of the + non-option elements that the caller should itself scan. + + Otherwise, `optind' communicates from one call to the next + how much of ARGV has been scanned so far. */ + +/* 1003.2 says this must be 1 before any call. */ +int optind = 1; + +/* Formerly, initialization of getopt depended on optind==0, which + causes problems with re-calling getopt as programs generally don't + know that. */ + +int __getopt_initialized; + +/* The next char to be scanned in the option-element + in which the last option character we returned was found. + This allows us to pick up the scan where we left off. + + If this is zero, or a null string, it means resume the scan + by advancing to the next ARGV-element. */ + +static char *nextchar; + +/* Callers store zero here to inhibit the error message + for unrecognized options. */ + +int opterr = 1; + +/* Set to an option character which was unrecognized. + This must be initialized on some systems to avoid linking in the + system's own getopt implementation. */ + +int optopt = '?'; + +/* Describe how to deal with options that follow non-option ARGV-elements. + + If the caller did not specify anything, + the default is REQUIRE_ORDER if the environment variable + POSIXLY_CORRECT is defined, PERMUTE otherwise. + + REQUIRE_ORDER means don't recognize them as options; + stop option processing when the first non-option is seen. + This is what Unix does. + This mode of operation is selected by either setting the environment + variable POSIXLY_CORRECT, or using `+' as the first character + of the list of option characters. + + PERMUTE is the default. We permute the contents of ARGV as we scan, + so that eventually all the non-options are at the end. This allows options + to be given in any order, even with programs that were not written to + expect this. + + RETURN_IN_ORDER is an option available to programs that were written + to expect options and other ARGV-elements in any order and that care about + the ordering of the two. We describe each non-option ARGV-element + as if it were the argument of an option with character code 1. + Using `-' as the first character of the list of option characters + selects this mode of operation. + + The special argument `--' forces an end of option-scanning regardless + of the value of `ordering'. In the case of RETURN_IN_ORDER, only + `--' can cause `getopt' to return -1 with `optind' != ARGC. */ + +static enum +{ + REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER +} ordering; + +/* Value of POSIXLY_CORRECT environment variable. */ +static char *posixly_correct; + +#ifdef __GNU_LIBRARY__ +/* We want to avoid inclusion of string.h with non-GNU libraries + because there are many ways it can cause trouble. + On some systems, it contains special magic macros that don't work + in GCC. */ +# include +# define my_index strchr +#else + +# if HAVE_STRING_H +# include +# else +# include +# endif + +/* Avoid depending on library functions or files + whose names are inconsistent. */ + +#ifndef getenv +extern char *getenv (); +#endif + +static char * +my_index (str, chr) + const char *str; + int chr; +{ + while (*str) + { + if (*str == chr) + return (char *) str; + str++; + } + return 0; +} + +/* If using GCC, we can safely declare strlen this way. + If not using GCC, it is ok not to declare it. */ +#ifdef __GNUC__ +/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h. + That was relevant to code that was here before. */ +# if (!defined __STDC__ || !__STDC__) && !defined strlen +/* gcc with -traditional declares the built-in strlen to return int, + and has done so at least since version 2.4.5. -- rms. */ +extern int strlen (const char *); +# endif /* not __STDC__ */ +#endif /* __GNUC__ */ + +#endif /* not __GNU_LIBRARY__ */ + +/* Handle permutation of arguments. */ + +/* Describe the part of ARGV that contains non-options that have + been skipped. `first_nonopt' is the index in ARGV of the first of them; + `last_nonopt' is the index after the last of them. */ + +static int first_nonopt; +static int last_nonopt; + +#ifdef _LIBC +/* Bash 2.0 gives us an environment variable containing flags + indicating ARGV elements that should not be considered arguments. */ + +/* Defined in getopt_init.c */ +extern char *__getopt_nonoption_flags; + +static int nonoption_flags_max_len; +static int nonoption_flags_len; + +static int original_argc; +static char *const *original_argv; + +/* Make sure the environment variable bash 2.0 puts in the environment + is valid for the getopt call we must make sure that the ARGV passed + to getopt is that one passed to the process. */ +static void +__attribute__ ((unused)) +store_args_and_env (int argc, char *const *argv) +{ + /* XXX This is no good solution. We should rather copy the args so + that we can compare them later. But we must not use malloc(3). */ + original_argc = argc; + original_argv = argv; +} +# ifdef text_set_element +text_set_element (__libc_subinit, store_args_and_env); +# endif /* text_set_element */ + +# define SWAP_FLAGS(ch1, ch2) \ + if (nonoption_flags_len > 0) \ + { \ + char __tmp = __getopt_nonoption_flags[ch1]; \ + __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \ + __getopt_nonoption_flags[ch2] = __tmp; \ + } +#else /* !_LIBC */ +# define SWAP_FLAGS(ch1, ch2) +#endif /* _LIBC */ + +/* Exchange two adjacent subsequences of ARGV. + One subsequence is elements [first_nonopt,last_nonopt) + which contains all the non-options that have been skipped so far. + The other is elements [last_nonopt,optind), which contains all + the options processed since those non-options were skipped. + + `first_nonopt' and `last_nonopt' are relocated so that they describe + the new indices of the non-options in ARGV after they are moved. */ + +#if defined __STDC__ && __STDC__ +static void exchange (char **); +#endif + +static void +exchange (argv) + char **argv; +{ + int bottom = first_nonopt; + int middle = last_nonopt; + int top = optind; + char *tem; + + /* Exchange the shorter segment with the far end of the longer segment. + That puts the shorter segment into the right place. + It leaves the longer segment in the right place overall, + but it consists of two parts that need to be swapped next. */ + +#ifdef _LIBC + /* First make sure the handling of the `__getopt_nonoption_flags' + string can work normally. Our top argument must be in the range + of the string. */ + if (nonoption_flags_len > 0 && top >= nonoption_flags_max_len) + { + /* We must extend the array. The user plays games with us and + presents new arguments. */ + char *new_str = malloc (top + 1); + if (new_str == NULL) + nonoption_flags_len = nonoption_flags_max_len = 0; + else + { + memset (__mempcpy (new_str, __getopt_nonoption_flags, + nonoption_flags_max_len), + '\0', top + 1 - nonoption_flags_max_len); + nonoption_flags_max_len = top + 1; + __getopt_nonoption_flags = new_str; + } + } +#endif + + while (top > middle && middle > bottom) + { + if (top - middle > middle - bottom) + { + /* Bottom segment is the short one. */ + int len = middle - bottom; + register int i; + + /* Swap it with the top part of the top segment. */ + for (i = 0; i < len; i++) + { + tem = argv[bottom + i]; + argv[bottom + i] = argv[top - (middle - bottom) + i]; + argv[top - (middle - bottom) + i] = tem; + SWAP_FLAGS (bottom + i, top - (middle - bottom) + i); + } + /* Exclude the moved bottom segment from further swapping. */ + top -= len; + } + else + { + /* Top segment is the short one. */ + int len = top - middle; + register int i; + + /* Swap it with the bottom part of the bottom segment. */ + for (i = 0; i < len; i++) + { + tem = argv[bottom + i]; + argv[bottom + i] = argv[middle + i]; + argv[middle + i] = tem; + SWAP_FLAGS (bottom + i, middle + i); + } + /* Exclude the moved top segment from further swapping. */ + bottom += len; + } + } + + /* Update records for the slots the non-options now occupy. */ + + first_nonopt += (optind - last_nonopt); + last_nonopt = optind; +} + +/* Initialize the internal data when the first call is made. */ + +#if defined __STDC__ && __STDC__ +static const char *_getopt_initialize (int, char *const *, const char *); +#endif +static const char * +_getopt_initialize (argc, argv, optstring) + int argc; + char *const *argv; + const char *optstring; +{ + /* Start processing options with ARGV-element 1 (since ARGV-element 0 + is the program name); the sequence of previously skipped + non-option ARGV-elements is empty. */ + + first_nonopt = last_nonopt = optind; + + nextchar = NULL; + + posixly_correct = getenv ("POSIXLY_CORRECT"); + + /* Determine how to handle the ordering of options and nonoptions. */ + + if (optstring[0] == '-') + { + ordering = RETURN_IN_ORDER; + ++optstring; + } + else if (optstring[0] == '+') + { + ordering = REQUIRE_ORDER; + ++optstring; + } + else if (posixly_correct != NULL) + ordering = REQUIRE_ORDER; + else + ordering = PERMUTE; + +#ifdef _LIBC + if (posixly_correct == NULL + && argc == original_argc && argv == original_argv) + { + if (nonoption_flags_max_len == 0) + { + if (__getopt_nonoption_flags == NULL + || __getopt_nonoption_flags[0] == '\0') + nonoption_flags_max_len = -1; + else + { + const char *orig_str = __getopt_nonoption_flags; + int len = nonoption_flags_max_len = strlen (orig_str); + if (nonoption_flags_max_len < argc) + nonoption_flags_max_len = argc; + __getopt_nonoption_flags = + (char *) malloc (nonoption_flags_max_len); + if (__getopt_nonoption_flags == NULL) + nonoption_flags_max_len = -1; + else + memset (__mempcpy (__getopt_nonoption_flags, orig_str, len), + '\0', nonoption_flags_max_len - len); + } + } + nonoption_flags_len = nonoption_flags_max_len; + } + else + nonoption_flags_len = 0; +#endif + + return optstring; +} + +/* Scan elements of ARGV (whose length is ARGC) for option characters + given in OPTSTRING. + + If an element of ARGV starts with '-', and is not exactly "-" or "--", + then it is an option element. The characters of this element + (aside from the initial '-') are option characters. If `getopt' + is called repeatedly, it returns successively each of the option characters + from each of the option elements. + + If `getopt' finds another option character, it returns that character, + updating `optind' and `nextchar' so that the next call to `getopt' can + resume the scan with the following option character or ARGV-element. + + If there are no more option characters, `getopt' returns -1. + Then `optind' is the index in ARGV of the first ARGV-element + that is not an option. (The ARGV-elements have been permuted + so that those that are not options now come last.) + + OPTSTRING is a string containing the legitimate option characters. + If an option character is seen that is not listed in OPTSTRING, + return '?' after printing an error message. If you set `opterr' to + zero, the error message is suppressed but we still return '?'. + + If a char in OPTSTRING is followed by a colon, that means it wants an arg, + so the following text in the same ARGV-element, or the text of the following + ARGV-element, is returned in `optarg'. Two colons mean an option that + wants an optional arg; if there is text in the current ARGV-element, + it is returned in `optarg', otherwise `optarg' is set to zero. + + If OPTSTRING starts with `-' or `+', it requests different methods of + handling the non-option ARGV-elements. + See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. + + Long-named options begin with `--' instead of `-'. + Their names may be abbreviated as long as the abbreviation is unique + or is an exact match for some defined option. If they have an + argument, it follows the option name in the same ARGV-element, separated + from the option name by a `=', or else the in next ARGV-element. + When `getopt' finds a long-named option, it returns 0 if that option's + `flag' field is nonzero, the value of the option's `val' field + if the `flag' field is zero. + + The elements of ARGV aren't really const, because we permute them. + But we pretend they're const in the prototype to be compatible + with other systems. + + LONGOPTS is a vector of `struct option' terminated by an + element containing a name which is zero. + + LONGIND returns the index in LONGOPT of the long-named option found. + It is only valid when a long-named option has been found by the most + recent call. + + If LONG_ONLY is nonzero, '-' as well as '--' can introduce + long-named options. */ + +int +_getopt_internal (argc, argv, optstring, longopts, longind, long_only) + int argc; + char *const *argv; + const char *optstring; + const struct option *longopts; + int *longind; + int long_only; +{ + optarg = NULL; + + if (optind == 0 || !__getopt_initialized) + { + if (optind == 0) + optind = 1; /* Don't scan ARGV[0], the program name. */ + optstring = _getopt_initialize (argc, argv, optstring); + __getopt_initialized = 1; + } + + /* Test whether ARGV[optind] points to a non-option argument. + Either it does not have option syntax, or there is an environment flag + from the shell indicating it is not an option. The later information + is only used when the used in the GNU libc. */ +#ifdef _LIBC +# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \ + || (optind < nonoption_flags_len \ + && __getopt_nonoption_flags[optind] == '1')) +#else +# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0') +#endif + + if (nextchar == NULL || *nextchar == '\0') + { + /* Advance to the next ARGV-element. */ + + /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been + moved back by the user (who may also have changed the arguments). */ + if (last_nonopt > optind) + last_nonopt = optind; + if (first_nonopt > optind) + first_nonopt = optind; + + if (ordering == PERMUTE) + { + /* If we have just processed some options following some non-options, + exchange them so that the options come first. */ + + if (first_nonopt != last_nonopt && last_nonopt != optind) + exchange ((char **) argv); + else if (last_nonopt != optind) + first_nonopt = optind; + + /* Skip any additional non-options + and extend the range of non-options previously skipped. */ + + while (optind < argc && NONOPTION_P) + optind++; + last_nonopt = optind; + } + + /* The special ARGV-element `--' means premature end of options. + Skip it like a null option, + then exchange with previous non-options as if it were an option, + then skip everything else like a non-option. */ + + if (optind != argc && !strcmp (argv[optind], "--")) + { + optind++; + + if (first_nonopt != last_nonopt && last_nonopt != optind) + exchange ((char **) argv); + else if (first_nonopt == last_nonopt) + first_nonopt = optind; + last_nonopt = argc; + + optind = argc; + } + + /* If we have done all the ARGV-elements, stop the scan + and back over any non-options that we skipped and permuted. */ + + if (optind == argc) + { + /* Set the next-arg-index to point at the non-options + that we previously skipped, so the caller will digest them. */ + if (first_nonopt != last_nonopt) + optind = first_nonopt; + return -1; + } + + /* If we have come to a non-option and did not permute it, + either stop the scan or describe it to the caller and pass it by. */ + + if (NONOPTION_P) + { + if (ordering == REQUIRE_ORDER) + return -1; + optarg = argv[optind++]; + return 1; + } + + /* We have found another option-ARGV-element. + Skip the initial punctuation. */ + + nextchar = (argv[optind] + 1 + + (longopts != NULL && argv[optind][1] == '-')); + } + + /* Decode the current option-ARGV-element. */ + + /* Check whether the ARGV-element is a long option. + + If long_only and the ARGV-element has the form "-f", where f is + a valid short option, don't consider it an abbreviated form of + a long option that starts with f. Otherwise there would be no + way to give the -f short option. + + On the other hand, if there's a long option "fubar" and + the ARGV-element is "-fu", do consider that an abbreviation of + the long option, just like "--fu", and not "-f" with arg "u". + + This distinction seems to be the most useful approach. */ + + if (longopts != NULL + && (argv[optind][1] == '-' + || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1]))))) + { + char *nameend; + const struct option *p; + const struct option *pfound = NULL; + int exact = 0; + int ambig = 0; + int indfound = -1; + int option_index; + + for (nameend = nextchar; *nameend && *nameend != '='; nameend++) + /* Do nothing. */ ; + + /* Test all long options for either exact match + or abbreviated matches. */ + for (p = longopts, option_index = 0; p->name; p++, option_index++) + if (!strncmp (p->name, nextchar, nameend - nextchar)) + { + if ((unsigned int) (nameend - nextchar) + == (unsigned int) strlen (p->name)) + { + /* Exact match found. */ + pfound = p; + indfound = option_index; + exact = 1; + break; + } + else if (pfound == NULL) + { + /* First nonexact match found. */ + pfound = p; + indfound = option_index; + } + else + /* Second or later nonexact match found. */ + ambig = 1; + } + + if (ambig && !exact) + { + if (opterr) + fprintf (stderr, _("%s: option `%s' is ambiguous\n"), + argv[0], argv[optind]); + nextchar += strlen (nextchar); + optind++; + optopt = 0; + return '?'; + } + + if (pfound != NULL) + { + option_index = indfound; + optind++; + if (*nameend) + { + /* Don't test has_arg with >, because some C compilers don't + allow it to be used on enums. */ + if (pfound->has_arg) + optarg = nameend + 1; + else + { + if (opterr) + { + if (argv[optind - 1][1] == '-') + /* --option */ + fprintf (stderr, + _("%s: option `--%s' doesn't allow an argument\n"), + argv[0], pfound->name); + else + /* +option or -option */ + fprintf (stderr, + _("%s: option `%c%s' doesn't allow an argument\n"), + argv[0], argv[optind - 1][0], pfound->name); + } + + nextchar += strlen (nextchar); + + optopt = pfound->val; + return '?'; + } + } + else if (pfound->has_arg == 1) + { + if (optind < argc) + optarg = argv[optind++]; + else + { + if (opterr) + fprintf (stderr, + _("%s: option `%s' requires an argument\n"), + argv[0], argv[optind - 1]); + nextchar += strlen (nextchar); + optopt = pfound->val; + return optstring[0] == ':' ? ':' : '?'; + } + } + nextchar += strlen (nextchar); + if (longind != NULL) + *longind = option_index; + if (pfound->flag) + { + *(pfound->flag) = pfound->val; + return 0; + } + return pfound->val; + } + + /* Can't find it as a long option. If this is not getopt_long_only, + or the option starts with '--' or is not a valid short + option, then it's an error. + Otherwise interpret it as a short option. */ + if (!long_only || argv[optind][1] == '-' + || my_index (optstring, *nextchar) == NULL) + { + if (opterr) + { + if (argv[optind][1] == '-') + /* --option */ + fprintf (stderr, _("%s: unrecognized option `--%s'\n"), + argv[0], nextchar); + else + /* +option or -option */ + fprintf (stderr, _("%s: unrecognized option `%c%s'\n"), + argv[0], argv[optind][0], nextchar); + } + nextchar = (char *) ""; + optind++; + optopt = 0; + return '?'; + } + } + + /* Look at and handle the next short option-character. */ + + { + char c = *nextchar++; + char *temp = my_index (optstring, c); + + /* Increment `optind' when we start to process its last character. */ + if (*nextchar == '\0') + ++optind; + + if (temp == NULL || c == ':') + { + if (opterr) + { + if (posixly_correct) + /* 1003.2 specifies the format of this message. */ + fprintf (stderr, _("%s: illegal option -- %c\n"), + argv[0], c); + else + fprintf (stderr, _("%s: invalid option -- %c\n"), + argv[0], c); + } + optopt = c; + return '?'; + } + /* Convenience. Treat POSIX -W foo same as long option --foo */ + if (temp[0] == 'W' && temp[1] == ';') + { + char *nameend; + const struct option *p; + const struct option *pfound = NULL; + int exact = 0; + int ambig = 0; + int indfound = 0; + int option_index; + + /* This is an option that requires an argument. */ + if (*nextchar != '\0') + { + optarg = nextchar; + /* If we end this ARGV-element by taking the rest as an arg, + we must advance to the next element now. */ + optind++; + } + else if (optind == argc) + { + if (opterr) + { + /* 1003.2 specifies the format of this message. */ + fprintf (stderr, _("%s: option requires an argument -- %c\n"), + argv[0], c); + } + optopt = c; + if (optstring[0] == ':') + c = ':'; + else + c = '?'; + return c; + } + else + /* We already incremented `optind' once; + increment it again when taking next ARGV-elt as argument. */ + optarg = argv[optind++]; + + /* optarg is now the argument, see if it's in the + table of longopts. */ + + for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++) + /* Do nothing. */ ; + + /* Test all long options for either exact match + or abbreviated matches. */ + for (p = longopts, option_index = 0; p->name; p++, option_index++) + if (!strncmp (p->name, nextchar, nameend - nextchar)) + { + if ((unsigned int) (nameend - nextchar) == strlen (p->name)) + { + /* Exact match found. */ + pfound = p; + indfound = option_index; + exact = 1; + break; + } + else if (pfound == NULL) + { + /* First nonexact match found. */ + pfound = p; + indfound = option_index; + } + else + /* Second or later nonexact match found. */ + ambig = 1; + } + if (ambig && !exact) + { + if (opterr) + fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"), + argv[0], argv[optind]); + nextchar += strlen (nextchar); + optind++; + return '?'; + } + if (pfound != NULL) + { + option_index = indfound; + if (*nameend) + { + /* Don't test has_arg with >, because some C compilers don't + allow it to be used on enums. */ + if (pfound->has_arg) + optarg = nameend + 1; + else + { + if (opterr) + fprintf (stderr, _("\ +%s: option `-W %s' doesn't allow an argument\n"), + argv[0], pfound->name); + + nextchar += strlen (nextchar); + return '?'; + } + } + else if (pfound->has_arg == 1) + { + if (optind < argc) + optarg = argv[optind++]; + else + { + if (opterr) + fprintf (stderr, + _("%s: option `%s' requires an argument\n"), + argv[0], argv[optind - 1]); + nextchar += strlen (nextchar); + return optstring[0] == ':' ? ':' : '?'; + } + } + nextchar += strlen (nextchar); + if (longind != NULL) + *longind = option_index; + if (pfound->flag) + { + *(pfound->flag) = pfound->val; + return 0; + } + return pfound->val; + } + nextchar = NULL; + return 'W'; /* Let the application handle it. */ + } + if (temp[1] == ':') + { + if (temp[2] == ':') + { + /* This is an option that accepts an argument optionally. */ + if (*nextchar != '\0') + { + optarg = nextchar; + optind++; + } + else + optarg = NULL; + nextchar = NULL; + } + else + { + /* This is an option that requires an argument. */ + if (*nextchar != '\0') + { + optarg = nextchar; + /* If we end this ARGV-element by taking the rest as an arg, + we must advance to the next element now. */ + optind++; + } + else if (optind == argc) + { + if (opterr) + { + /* 1003.2 specifies the format of this message. */ + fprintf (stderr, + _("%s: option requires an argument -- %c\n"), + argv[0], c); + } + optopt = c; + if (optstring[0] == ':') + c = ':'; + else + c = '?'; + } + else + /* We already incremented `optind' once; + increment it again when taking next ARGV-elt as argument. */ + optarg = argv[optind++]; + nextchar = NULL; + } + } + return c; + } +} + +int +getopt (argc, argv, optstring) + int argc; + char *const *argv; + const char *optstring; +{ + return _getopt_internal (argc, argv, optstring, + (const struct option *) 0, + (int *) 0, + 0); +} + +#endif /* Not ELIDE_CODE. */ + +#ifdef TEST + +/* Compile with -DTEST to make an executable for use in testing + the above definition of `getopt'. */ + +int +main (argc, argv) + int argc; + char **argv; +{ + int c; + int digit_optind = 0; + + while (1) + { + int this_option_optind = optind ? optind : 1; + + c = getopt (argc, argv, "abc:d:0123456789"); + if (c == -1) + break; + + switch (c) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + if (digit_optind != 0 && digit_optind != this_option_optind) + printf ("digits occur in two different argv-elements.\n"); + digit_optind = this_option_optind; + printf ("option %c\n", c); + break; + + case 'a': + printf ("option a\n"); + break; + + case 'b': + printf ("option b\n"); + break; + + case 'c': + printf ("option c with value `%s'\n", optarg); + break; + + case '?': + break; + + default: + printf ("?? getopt returned character code 0%o ??\n", c); + } + } + + if (optind < argc) + { + printf ("non-option ARGV-elements: "); + while (optind < argc) + printf ("%s ", argv[optind++]); + printf ("\n"); + } + + exit (0); +} + +#endif /* TEST */ diff --git a/lib/getopt.h b/lib/getopt.h new file mode 100644 index 0000000..890a23a --- /dev/null +++ b/lib/getopt.h @@ -0,0 +1,169 @@ +/* Declarations for getopt. + Copyright (C) 1989,90,91,92,93,94,96,97,98 Free Software Foundation, Inc. + NOTE: The canonical source of this file is maintained with the GNU C Library. + Bugs can be reported to bug-glibc@gnu.org. + 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, + USA. */ + +#ifndef _GETOPT_H + +#ifndef __need_getopt +# define _GETOPT_H 1 +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* For communication from `getopt' to the caller. + When `getopt' finds an option that takes an argument, + the argument value is returned here. + Also, when `ordering' is RETURN_IN_ORDER, + each non-option ARGV-element is returned here. */ + +extern char *optarg; + +/* Index in ARGV of the next element to be scanned. + This is used for communication to and from the caller + and for communication between successive calls to `getopt'. + + On entry to `getopt', zero means this is the first call; initialize. + + When `getopt' returns -1, this is the index of the first of the + non-option elements that the caller should itself scan. + + Otherwise, `optind' communicates from one call to the next + how much of ARGV has been scanned so far. */ + +extern int optind; + +/* Callers store zero here to inhibit the error message `getopt' prints + for unrecognized options. */ + +extern int opterr; + +/* Set to an option character which was unrecognized. */ + +extern int optopt; + +#ifndef __need_getopt +/* Describe the long-named options requested by the application. + The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector + of `struct option' terminated by an element containing a name which is + zero. + + The field `has_arg' is: + no_argument (or 0) if the option does not take an argument, + required_argument (or 1) if the option requires an argument, + optional_argument (or 2) if the option takes an optional argument. + + If the field `flag' is not NULL, it points to a variable that is set + to the value given in the field `val' when the option is found, but + left unchanged if the option is not found. + + To have a long-named option do something other than set an `int' to + a compiled-in constant, such as set a value from `optarg', set the + option's `flag' field to zero and its `val' field to a nonzero + value (the equivalent single-letter option character, if there is + one). For long options that have a zero `flag' field, `getopt' + returns the contents of the `val' field. */ + +struct option +{ +# if defined __STDC__ && __STDC__ + const char *name; +# else + char *name; +# endif + /* has_arg can't be an enum because some compilers complain about + type mismatches in all the code that assumes it is an int. */ + int has_arg; + int *flag; + int val; +}; + +/* Names for the values of the `has_arg' field of `struct option'. */ + +# define no_argument 0 +# define required_argument 1 +# define optional_argument 2 +#endif /* need getopt */ + + +/* Get definitions and prototypes for functions to process the + arguments in ARGV (ARGC of them, minus the program name) for + options given in OPTS. + + Return the option character from OPTS just read. Return -1 when + there are no more options. For unrecognized options, or options + missing arguments, `optopt' is set to the option letter, and '?' is + returned. + + The OPTS string is a list of characters which are recognized option + letters, optionally followed by colons, specifying that that letter + takes an argument, to be placed in `optarg'. + + If a letter in OPTS is followed by two colons, its argument is + optional. This behavior is specific to the GNU `getopt'. + + The argument `--' causes premature termination of argument + scanning, explicitly telling `getopt' that there are no more + options. + + If OPTS begins with `--', then non-option arguments are treated as + arguments to the option '\0'. This behavior is specific to the GNU + `getopt'. */ + +#if (defined __STDC__ && __STDC__) || defined PROTOTYPES +# ifdef __GNU_LIBRARY__ +/* Many other libraries have conflicting prototypes for getopt, with + differences in the consts, in stdlib.h. To avoid compilation + errors, only prototype getopt for the GNU C library. */ +extern int getopt (int __argc, char *const *__argv, const char *__shortopts); +# else /* not __GNU_LIBRARY__ */ +extern int getopt (); +# endif /* __GNU_LIBRARY__ */ + +# ifndef __need_getopt +extern int getopt_long (int __argc, char *const *__argv, const char *__shortopts, + const struct option *__longopts, int *__longind); +extern int getopt_long_only (int __argc, char *const *__argv, + const char *__shortopts, + const struct option *__longopts, int *__longind); + +/* Internal only. Users should not call this directly. */ +extern int _getopt_internal (int __argc, char *const *__argv, + const char *__shortopts, + const struct option *__longopts, int *__longind, + int __long_only); +# endif +#else /* not ((defined __STDC__ && __STDC__) || defined PROTOTYPES) */ +extern int getopt (); +# ifndef __need_getopt +extern int getopt_long (); +extern int getopt_long_only (); + +extern int _getopt_internal (); +# endif +#endif /* (defined __STDC__ && __STDC__) || defined PROTOTYPES */ + +#ifdef __cplusplus +} +#endif + +/* Make sure we later can get all the definitions and declarations. */ +#undef __need_getopt + +#endif /* getopt.h */ diff --git a/lib/getopt1.c b/lib/getopt1.c new file mode 100644 index 0000000..643be17 --- /dev/null +++ b/lib/getopt1.c @@ -0,0 +1,188 @@ +/* getopt_long and getopt_long_only entry points for GNU getopt. + Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98 + Free Software Foundation, Inc. + NOTE: The canonical source of this file is maintained with the GNU C Library. + Bugs can be reported to bug-glibc@gnu.org. + + 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifdef HAVE_CONFIG_H +#include +#else +#if !defined __STDC__ || !__STDC__ +/* This is a separate conditional since some stdc systems + reject `defined (const)'. */ +#ifndef const +#define const +#endif +#endif +#endif + +#include "getopt.h" + +#include + +/* 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 + 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. */ + +#define GETOPT_INTERFACE_VERSION 2 +#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 +#include +#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION +#define ELIDE_CODE +#endif +#endif + +#ifndef ELIDE_CODE + + +/* This needs to come after some library #include + to get __GNU_LIBRARY__ defined. */ +#ifdef __GNU_LIBRARY__ +#include +#endif + +#ifndef NULL +#define NULL 0 +#endif + +int +getopt_long (argc, argv, options, long_options, opt_index) + int argc; + char *const *argv; + const char *options; + const struct option *long_options; + int *opt_index; +{ + return _getopt_internal (argc, argv, options, long_options, opt_index, 0); +} + +/* Like getopt_long, but '-' as well as '--' can indicate a long option. + If an option that starts with '-' (not '--') doesn't match a long option, + but does match a short option, it is parsed as a short option + instead. */ + +int +getopt_long_only (argc, argv, options, long_options, opt_index) + int argc; + char *const *argv; + const char *options; + const struct option *long_options; + int *opt_index; +{ + return _getopt_internal (argc, argv, options, long_options, opt_index, 1); +} + + +#endif /* Not ELIDE_CODE. */ + +#ifdef TEST + +#include + +int +main (argc, argv) + int argc; + char **argv; +{ + int c; + int digit_optind = 0; + + while (1) + { + int this_option_optind = optind ? optind : 1; + int option_index = 0; + static struct option long_options[] = + { + {"add", 1, 0, 0}, + {"append", 0, 0, 0}, + {"delete", 1, 0, 0}, + {"verbose", 0, 0, 0}, + {"create", 0, 0, 0}, + {"file", 1, 0, 0}, + {0, 0, 0, 0} + }; + + c = getopt_long (argc, argv, "abc:d:0123456789", + long_options, &option_index); + if (c == -1) + break; + + switch (c) + { + case 0: + printf ("option %s", long_options[option_index].name); + if (optarg) + printf (" with arg %s", optarg); + printf ("\n"); + break; + + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + if (digit_optind != 0 && digit_optind != this_option_optind) + printf ("digits occur in two different argv-elements.\n"); + digit_optind = this_option_optind; + printf ("option %c\n", c); + break; + + case 'a': + printf ("option a\n"); + break; + + case 'b': + printf ("option b\n"); + break; + + case 'c': + printf ("option c with value `%s'\n", optarg); + break; + + case 'd': + printf ("option d with value `%s'\n", optarg); + break; + + case '?': + break; + + default: + printf ("?? getopt returned character code 0%o ??\n", c); + } + } + + if (optind < argc) + { + printf ("non-option ARGV-elements: "); + while (optind < argc) + printf ("%s ", argv[optind++]); + printf ("\n"); + } + + exit (0); +} + +#endif /* TEST */ diff --git a/lib/hard-locale.c b/lib/hard-locale.c new file mode 100644 index 0000000..2c14771 --- /dev/null +++ b/lib/hard-locale.c @@ -0,0 +1,85 @@ +/* hard-locale.c -- Determine whether a locale is hard. + Copyright 1997, 1998, 1999 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +#if HAVE_CONFIG_H +# include +#endif + +#ifndef __GNUC__ +# ifdef HAVE_ALLOCA_H +# include +# else +# ifdef _AIX + # pragma alloca +# else +# ifdef _WIN32 +# include +# include +# else +# ifndef alloca +char *alloca (); +# endif +# endif +# endif +# endif +#endif + +#if HAVE_LOCALE_H +# include +#endif + +#if HAVE_STRING_H +# include +#endif + +/* Return nonzero if the current CATEGORY locale is hard, i.e. if you + can't get away with assuming traditional C or POSIX behavior. */ +int +hard_locale (int category) +{ +#if ! (defined ENABLE_NLS && HAVE_SETLOCALE) + return 0; +#else + + int hard = 1; + char const *p = setlocale (category, 0); + + if (p) + { +# if defined __GLIBC__ && __GLIBC__ >= 2 + if (strcmp (p, "C") == 0 || strcmp (p, "POSIX") == 0) + hard = 0; +# else + char *locale = alloca (strlen (p) + 1); + strcpy (locale, p); + + /* Temporarily set the locale to the "C" and "POSIX" locales to + find their names, so that we can determine whether one or the + other is the caller's locale. */ + if (((p = setlocale (category, "C")) && strcmp (p, locale) == 0) + || ((p = setlocale (category, "POSIX")) && strcmp (p, locale) == 0)) + hard = 0; + + /* Restore the caller's locale. */ + setlocale (category, locale); +# endif + } + + return hard; + +#endif +} diff --git a/lib/hard-locale.h b/lib/hard-locale.h new file mode 100644 index 0000000..5b054d9 --- /dev/null +++ b/lib/hard-locale.h @@ -0,0 +1,18 @@ +#ifndef HARD_LOCALE_H_ +# define HARD_LOCALE_H_ 1 + +# if HAVE_CONFIG_H +# include +# endif + +# ifndef PARAMS +# if defined PROTOTYPES || (defined __STDC__ && __STDC__) +# define PARAMS(Args) Args +# else +# define PARAMS(Args) () +# endif +# endif + +int hard_locale PARAMS ((int)); + +#endif /* HARD_LOCALE_H_ */ diff --git a/lib/isdir.c b/lib/isdir.c new file mode 100644 index 0000000..e1b4304 --- /dev/null +++ b/lib/isdir.c @@ -0,0 +1,42 @@ +/* isdir.c -- determine whether a directory exists + Copyright (C) 1990, 1998 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +#if HAVE_CONFIG_H +# include +#endif + +#include +#include + +#if STAT_MACROS_BROKEN +# undef S_ISDIR +#endif + +#if !defined S_ISDIR && defined S_IFDIR +# define S_ISDIR(Mode) (((Mode) & S_IFMT) == S_IFDIR) +#endif + +/* If PATH is an existing directory or symbolic link to a directory, + return nonzero, else 0. */ + +int +isdir (const char *path) +{ + struct stat stats; + + return stat (path, &stats) == 0 && S_ISDIR (stats.st_mode); +} diff --git a/lib/malloc.c b/lib/malloc.c new file mode 100644 index 0000000..7231713 --- /dev/null +++ b/lib/malloc.c @@ -0,0 +1,26 @@ +/* rpl_malloc.c -- a replacement for malloc that don't accept 0 size + Copyright (C) 2001 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include + +void * +rpl_malloc(size_t size) +{ + if (!size) + size++; + return malloc(size); +} diff --git a/lib/memchr.c b/lib/memchr.c new file mode 100644 index 0000000..513e99d --- /dev/null +++ b/lib/memchr.c @@ -0,0 +1,199 @@ +/* Copyright (C) 1991, 1993, 1997, 1999 Free Software Foundation, Inc. + Based on strlen implementation by Torbjorn Granlund (tege@sics.se), + with help from Dan Sahlin (dan@sics.se) and + commentary by Jim Blandy (jimb@ai.mit.edu); + adaptation to memchr suggested by Dick Karpinski (dick@cca.ucsf.edu), + and implemented by Roland McGrath (roland@ai.mit.edu). + +NOTE: The canonical source of this file is maintained with the GNU C Library. +Bugs can be reported to bug-glibc@prep.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 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, +USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#undef __ptr_t +#if defined (__cplusplus) || (defined (__STDC__) && __STDC__) +# define __ptr_t void * +#else /* Not C++ or ANSI C. */ +# define __ptr_t char * +#endif /* C++ or ANSI C. */ + +#if defined (_LIBC) +# include +#endif + +#if defined (HAVE_LIMITS_H) || defined (_LIBC) +# include +#endif + +#define LONG_MAX_32_BITS 2147483647 + +#ifndef LONG_MAX +# define LONG_MAX LONG_MAX_32_BITS +#endif + +#include + + +/* Search no more than N bytes of S for C. */ + +__ptr_t +memchr (s, c, n) + const __ptr_t s; + int c; + size_t n; +{ + const unsigned char *char_ptr; + const unsigned long int *longword_ptr; + unsigned long int longword, magic_bits, charmask; + + c = (unsigned char) c; + + /* Handle the first few characters by reading one character at a time. + Do this until CHAR_PTR is aligned on a longword boundary. */ + for (char_ptr = (const unsigned char *) s; + n > 0 && ((unsigned long int) char_ptr + & (sizeof (longword) - 1)) != 0; + --n, ++char_ptr) + if (*char_ptr == c) + return (__ptr_t) char_ptr; + + /* All these elucidatory comments refer to 4-byte longwords, + but the theory applies equally well to 8-byte longwords. */ + + longword_ptr = (unsigned long int *) char_ptr; + + /* Bits 31, 24, 16, and 8 of this number are zero. Call these bits + the "holes." Note that there is a hole just to the left of + each byte, with an extra at the end: + + bits: 01111110 11111110 11111110 11111111 + bytes: AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD + + The 1-bits make sure that carries propagate to the next 0-bit. + The 0-bits provide holes for carries to fall into. */ + + if (sizeof (longword) != 4 && sizeof (longword) != 8) + abort (); + +#if LONG_MAX <= LONG_MAX_32_BITS + magic_bits = 0x7efefeff; +#else + magic_bits = ((unsigned long int) 0x7efefefe << 32) | 0xfefefeff; +#endif + + /* Set up a longword, each of whose bytes is C. */ + charmask = c | (c << 8); + charmask |= charmask << 16; +#if LONG_MAX > LONG_MAX_32_BITS + charmask |= charmask << 32; +#endif + + /* Instead of the traditional loop which tests each character, + we will test a longword at a time. The tricky part is testing + if *any of the four* bytes in the longword in question are zero. */ + while (n >= sizeof (longword)) + { + /* We tentatively exit the loop if adding MAGIC_BITS to + LONGWORD fails to change any of the hole bits of LONGWORD. + + 1) Is this safe? Will it catch all the zero bytes? + Suppose there is a byte with all zeros. Any carry bits + propagating from its left will fall into the hole at its + least significant bit and stop. Since there will be no + carry from its most significant bit, the LSB of the + byte to the left will be unchanged, and the zero will be + detected. + + 2) Is this worthwhile? Will it ignore everything except + zero bytes? Suppose every byte of LONGWORD has a bit set + somewhere. There will be a carry into bit 8. If bit 8 + is set, this will carry into bit 16. If bit 8 is clear, + one of bits 9-15 must be set, so there will be a carry + into bit 16. Similarly, there will be a carry into bit + 24. If one of bits 24-30 is set, there will be a carry + into bit 31, so all of the hole bits will be changed. + + The one misfire occurs when bits 24-30 are clear and bit + 31 is set; in this case, the hole at bit 31 is not + changed. If we had access to the processor carry flag, + we could close this loophole by putting the fourth hole + at bit 32! + + So it ignores everything except 128's, when they're aligned + properly. + + 3) But wait! Aren't we looking for C, not zero? + Good point. So what we do is XOR LONGWORD with a longword, + each of whose bytes is C. This turns each byte that is C + into a zero. */ + + longword = *longword_ptr++ ^ charmask; + + /* Add MAGIC_BITS to LONGWORD. */ + if ((((longword + magic_bits) + + /* Set those bits that were unchanged by the addition. */ + ^ ~longword) + + /* Look at only the hole bits. If any of the hole bits + are unchanged, most likely one of the bytes was a + zero. */ + & ~magic_bits) != 0) + { + /* Which of the bytes was C? If none of them were, it was + a misfire; continue the search. */ + + const unsigned char *cp = (const unsigned char *) (longword_ptr - 1); + + if (cp[0] == c) + return (__ptr_t) cp; + if (cp[1] == c) + return (__ptr_t) &cp[1]; + if (cp[2] == c) + return (__ptr_t) &cp[2]; + if (cp[3] == c) + return (__ptr_t) &cp[3]; +#if LONG_MAX > 2147483647 + if (cp[4] == c) + return (__ptr_t) &cp[4]; + if (cp[5] == c) + return (__ptr_t) &cp[5]; + if (cp[6] == c) + return (__ptr_t) &cp[6]; + if (cp[7] == c) + return (__ptr_t) &cp[7]; +#endif + } + + n -= sizeof (longword); + } + + char_ptr = (const unsigned char *) longword_ptr; + + while (n-- > 0) + { + if (*char_ptr == c) + return (__ptr_t) char_ptr; + else + ++char_ptr; + } + + return 0; +} diff --git a/lib/obstack.c b/lib/obstack.c new file mode 100644 index 0000000..3f924d5 --- /dev/null +++ b/lib/obstack.c @@ -0,0 +1,598 @@ +/* obstack.c - subroutines used implicitly by object stack macros + Copyright (C) 1988-1994,96,97,98,99 Free Software Foundation, Inc. + + This file is part of the GNU C Library. Its master source is NOT part of + the C library, however. The master source lives in /gd/gnu/lib. + + The GNU 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 GNU 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., + 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "obstack.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, 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. */ + +#include /* Random thing to get __GNU_LIBRARY__. */ +#if !defined (_LIBC) && defined (__GNU_LIBRARY__) && __GNU_LIBRARY__ > 1 +#include +#if _GNU_OBSTACK_INTERFACE_VERSION == OBSTACK_INTERFACE_VERSION +#define ELIDE_CODE +#endif +#endif + + +#ifndef ELIDE_CODE + + +#if defined (__STDC__) && __STDC__ +#define POINTER void * +#else +#define POINTER char * +#endif + +/* Determine default alignment. */ +struct fooalign {char x; double d;}; +#define DEFAULT_ALIGNMENT \ + ((PTR_INT_TYPE) ((char *) &((struct fooalign *) 0)->d - (char *) 0)) +/* If malloc were really smart, it would round addresses to DEFAULT_ALIGNMENT. + But in fact it might be less smart and round addresses to as much as + DEFAULT_ROUNDING. So we prepare for it to do that. */ +union fooround {long x; double d;}; +#define DEFAULT_ROUNDING (sizeof (union fooround)) + +/* When we copy a long block of data, this is the unit to do it with. + On some machines, copying successive ints does not work; + in such a case, redefine COPYING_UNIT to `long' (if that works) + or `char' as a last resort. */ +#ifndef COPYING_UNIT +#define COPYING_UNIT int +#endif + + +/* The functions allocating more room by calling `obstack_chunk_alloc' + jump to the handler pointed to by `obstack_alloc_failed_handler'. + This can be set to a user defined function which should either + abort gracefully or use longjump - but shouldn't return. This + variable by default points to the internal function + `print_and_abort'. */ +#if defined (__STDC__) && __STDC__ +static void print_and_abort (void); +void (*obstack_alloc_failed_handler) (void) = print_and_abort; +#else +static void print_and_abort (); +void (*obstack_alloc_failed_handler) () = print_and_abort; +#endif + +/* Exit value used when `print_and_abort' is used. */ +#if defined __GNU_LIBRARY__ || defined HAVE_STDLIB_H +#include +#endif +#ifndef EXIT_FAILURE +#define EXIT_FAILURE 1 +#endif +int obstack_exit_failure = EXIT_FAILURE; + +/* The non-GNU-C macros copy the obstack into this global variable + to avoid multiple evaluation. */ + +struct obstack *_obstack; + +/* Define a macro that either calls functions with the traditional malloc/free + calling interface, or calls functions with the mmalloc/mfree interface + (that adds an extra first argument), based on the state of use_extra_arg. + For free, do not use ?:, since some compilers, like the MIPS compilers, + do not allow (expr) ? void : void. */ + +#if defined (__STDC__) && __STDC__ +#define CALL_CHUNKFUN(h, size) \ + (((h) -> use_extra_arg) \ + ? (*(h)->chunkfun) ((h)->extra_arg, (size)) \ + : (*(struct _obstack_chunk *(*) (long)) (h)->chunkfun) ((size))) + +#define CALL_FREEFUN(h, old_chunk) \ + do { \ + if ((h) -> use_extra_arg) \ + (*(h)->freefun) ((h)->extra_arg, (old_chunk)); \ + else \ + (*(void (*) (void *)) (h)->freefun) ((old_chunk)); \ + } while (0) +#else +#define CALL_CHUNKFUN(h, size) \ + (((h) -> use_extra_arg) \ + ? (*(h)->chunkfun) ((h)->extra_arg, (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 \ + (*(void (*) ()) (h)->freefun) ((old_chunk)); \ + } while (0) +#endif + + +/* Initialize an obstack H for use. Specify chunk size SIZE (0 means default). + Objects start on multiples of ALIGNMENT (0 means use default). + CHUNKFUN is the function to use to allocate chunks, + and FREEFUN the function to free them. + + Return nonzero if successful, calls obstack_alloc_failed_handler if + allocation fails. */ + +int +_obstack_begin (h, size, alignment, chunkfun, freefun) + struct obstack *h; + int size; + int alignment; +#if defined (__STDC__) && __STDC__ + POINTER (*chunkfun) (long); + void (*freefun) (void *); +#else + POINTER (*chunkfun) (); + void (*freefun) (); +#endif +{ + register struct _obstack_chunk *chunk; /* points to new chunk */ + + if (alignment == 0) + alignment = (int) DEFAULT_ALIGNMENT; + if (size == 0) + /* Default size is what GNU malloc can fit in a 4096-byte block. */ + { + /* 12 is sizeof (mhead) and 4 is EXTRA from GNU malloc. + Use the values for range checking, because if range checking is off, + the extra bytes won't be missed terribly, but if range checking is on + and we used a larger request, a whole extra 4096 bytes would be + allocated. + + These number are irrelevant to the new GNU malloc. I suspect it is + less sensitive to the size of the request. */ + int extra = ((((12 + DEFAULT_ROUNDING - 1) & ~(DEFAULT_ROUNDING - 1)) + + 4 + DEFAULT_ROUNDING - 1) + & ~(DEFAULT_ROUNDING - 1)); + size = 4096 - extra; + } + +#if defined (__STDC__) && __STDC__ + h->chunkfun = (struct _obstack_chunk * (*)(void *, long)) chunkfun; + h->freefun = (void (*) (void *, struct _obstack_chunk *)) freefun; +#else + h->chunkfun = (struct _obstack_chunk * (*)()) chunkfun; + h->freefun = freefun; +#endif + h->chunk_size = size; + h->alignment_mask = alignment - 1; + h->use_extra_arg = 0; + + chunk = h->chunk = CALL_CHUNKFUN (h, h -> chunk_size); + if (!chunk) + (*obstack_alloc_failed_handler) (); + h->next_free = h->object_base = chunk->contents; + h->chunk_limit = chunk->limit + = (char *) chunk + h->chunk_size; + chunk->prev = 0; + /* The initial chunk now contains no empty object. */ + h->maybe_empty_object = 0; + h->alloc_failed = 0; + return 1; +} + +int +_obstack_begin_1 (h, size, alignment, chunkfun, freefun, arg) + struct obstack *h; + int size; + int alignment; +#if defined (__STDC__) && __STDC__ + POINTER (*chunkfun) (POINTER, long); + void (*freefun) (POINTER, POINTER); +#else + POINTER (*chunkfun) (); + void (*freefun) (); +#endif + POINTER arg; +{ + register struct _obstack_chunk *chunk; /* points to new chunk */ + + if (alignment == 0) + alignment = (int) DEFAULT_ALIGNMENT; + if (size == 0) + /* Default size is what GNU malloc can fit in a 4096-byte block. */ + { + /* 12 is sizeof (mhead) and 4 is EXTRA from GNU malloc. + Use the values for range checking, because if range checking is off, + the extra bytes won't be missed terribly, but if range checking is on + and we used a larger request, a whole extra 4096 bytes would be + allocated. + + These number are irrelevant to the new GNU malloc. I suspect it is + less sensitive to the size of the request. */ + int extra = ((((12 + DEFAULT_ROUNDING - 1) & ~(DEFAULT_ROUNDING - 1)) + + 4 + DEFAULT_ROUNDING - 1) + & ~(DEFAULT_ROUNDING - 1)); + size = 4096 - extra; + } + +#if defined(__STDC__) && __STDC__ + h->chunkfun = (struct _obstack_chunk * (*)(void *,long)) chunkfun; + h->freefun = (void (*) (void *, struct _obstack_chunk *)) freefun; +#else + h->chunkfun = (struct _obstack_chunk * (*)()) chunkfun; + h->freefun = freefun; +#endif + h->chunk_size = size; + h->alignment_mask = alignment - 1; + h->extra_arg = arg; + h->use_extra_arg = 1; + + chunk = h->chunk = CALL_CHUNKFUN (h, h -> chunk_size); + if (!chunk) + (*obstack_alloc_failed_handler) (); + h->next_free = h->object_base = chunk->contents; + h->chunk_limit = chunk->limit + = (char *) chunk + h->chunk_size; + chunk->prev = 0; + /* The initial chunk now contains no empty object. */ + h->maybe_empty_object = 0; + h->alloc_failed = 0; + return 1; +} + +/* Allocate a new current chunk for the obstack *H + on the assumption that LENGTH bytes need to be added + to the current object, or a new object of length LENGTH allocated. + Copies any partial object from the end of the old chunk + to the beginning of the new one. */ + +void +_obstack_newchunk (h, length) + struct obstack *h; + int length; +{ + register struct _obstack_chunk *old_chunk = h->chunk; + register struct _obstack_chunk *new_chunk; + register long new_size; + register long obj_size = h->next_free - h->object_base; + register long i; + long already; + + /* Compute size for new chunk. */ + new_size = (obj_size + length) + (obj_size >> 3) + 100; + if (new_size < h->chunk_size) + new_size = h->chunk_size; + + /* Allocate and initialize the new chunk. */ + new_chunk = CALL_CHUNKFUN (h, new_size); + if (!new_chunk) + (*obstack_alloc_failed_handler) (); + h->chunk = new_chunk; + new_chunk->prev = old_chunk; + new_chunk->limit = h->chunk_limit = (char *) new_chunk + new_size; + + /* Move the existing object to the new chunk. + Word at a time is fast and is safe if the object + is sufficiently aligned. */ + if (h->alignment_mask + 1 >= DEFAULT_ALIGNMENT) + { + for (i = obj_size / sizeof (COPYING_UNIT) - 1; + i >= 0; i--) + ((COPYING_UNIT *)new_chunk->contents)[i] + = ((COPYING_UNIT *)h->object_base)[i]; + /* We used to copy the odd few remaining bytes as one extra COPYING_UNIT, + but that can cross a page boundary on a machine + which does not do strict alignment for COPYING_UNITS. */ + already = obj_size / sizeof (COPYING_UNIT) * sizeof (COPYING_UNIT); + } + else + already = 0; + /* Copy remaining bytes one by one. */ + for (i = already; i < obj_size; i++) + new_chunk->contents[i] = h->object_base[i]; + + /* If the object just copied was the only data in OLD_CHUNK, + free that chunk and remove it from the chain. + But not if that chunk might contain an empty object. */ + if (h->object_base == old_chunk->contents && ! h->maybe_empty_object) + { + new_chunk->prev = old_chunk->prev; + CALL_FREEFUN (h, old_chunk); + } + + h->object_base = new_chunk->contents; + h->next_free = h->object_base + obj_size; + /* The new chunk certainly contains no empty object yet. */ + h->maybe_empty_object = 0; +} + +/* Return nonzero if object OBJ has been allocated from obstack H. + This is here for debugging. + If you use it in a program, you are probably losing. */ + +#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); +#endif + +int +_obstack_allocated_p (h, obj) + struct obstack *h; + POINTER obj; +{ + register struct _obstack_chunk *lp; /* below addr of any objects in this chunk */ + register struct _obstack_chunk *plp; /* point to previous chunk if any */ + + lp = (h)->chunk; + /* We use >= rather than > since the object cannot be exactly at + the beginning of the chunk but might be an empty object exactly + at the end of an adjacent chunk. */ + while (lp != 0 && ((POINTER) lp >= obj || (POINTER) (lp)->limit < obj)) + { + plp = lp->prev; + lp = plp; + } + return lp != 0; +} + +/* Free objects in obstack H, including OBJ and everything allocate + more recently than OBJ. If OBJ is zero, free everything in H. */ + +#undef obstack_free + +/* This function has two names with identical definitions. + This is the first one, called from non-ANSI code. */ + +void +_obstack_free (h, obj) + struct obstack *h; + POINTER obj; +{ + register struct _obstack_chunk *lp; /* below addr of any objects in this chunk */ + register struct _obstack_chunk *plp; /* point to previous chunk if any */ + + lp = h->chunk; + /* We use >= because there cannot be an object at the beginning of a chunk. + But there can be an empty object at that address + at the end of another chunk. */ + while (lp != 0 && ((POINTER) lp >= obj || (POINTER) (lp)->limit < obj)) + { + plp = lp->prev; + CALL_FREEFUN (h, lp); + lp = plp; + /* If we switch chunks, we can't tell whether the new current + chunk contains an empty object, so assume that it may. */ + h->maybe_empty_object = 1; + } + if (lp) + { + h->object_base = h->next_free = (char *) (obj); + h->chunk_limit = lp->limit; + h->chunk = lp; + } + else if (obj != 0) + /* obj is not in any of the chunks! */ + abort (); +} + +/* This function is used from ANSI code. */ + +void +obstack_free (h, obj) + struct obstack *h; + POINTER obj; +{ + register struct _obstack_chunk *lp; /* below addr of any objects in this chunk */ + register struct _obstack_chunk *plp; /* point to previous chunk if any */ + + lp = h->chunk; + /* We use >= because there cannot be an object at the beginning of a chunk. + But there can be an empty object at that address + at the end of another chunk. */ + while (lp != 0 && ((POINTER) lp >= obj || (POINTER) (lp)->limit < obj)) + { + plp = lp->prev; + CALL_FREEFUN (h, lp); + lp = plp; + /* If we switch chunks, we can't tell whether the new current + chunk contains an empty object, so assume that it may. */ + h->maybe_empty_object = 1; + } + if (lp) + { + h->object_base = h->next_free = (char *) (obj); + h->chunk_limit = lp->limit; + h->chunk = lp; + } + else if (obj != 0) + /* obj is not in any of the chunks! */ + abort (); +} + +int +_obstack_memory_used (h) + struct obstack *h; +{ + register struct _obstack_chunk* lp; + register int nbytes = 0; + + for (lp = h->chunk; lp != 0; lp = lp->prev) + { + nbytes += lp->limit - (char *) lp; + } + return nbytes; +} + +/* Define the error handler. */ +#ifndef _ +# ifdef HAVE_LIBINTL_H +# include +# ifndef _ +# define _(Str) gettext (Str) +# endif +# else +# define _(Str) (Str) +# endif +#endif +#if defined _LIBC && defined USE_IN_LIBIO +# include +# define fputs(s, f) _IO_fputs (s, f) +#endif + +static void +print_and_abort () +{ + fputs (_("memory exhausted"), stderr); + fputc ('\n', stderr); + exit (obstack_exit_failure); +} + +#if 0 +/* These are now turned off because the applications do not use it + and it uses bcopy via obstack_grow, which causes trouble on sysV. */ + +/* Now define the functional versions of the obstack macros. + Define them to simply use the corresponding macros to do the job. */ + +#if defined (__STDC__) && __STDC__ +/* These function definitions do not work with non-ANSI preprocessors; + they won't pass through the macro names in parentheses. */ + +/* The function names appear in parentheses in order to prevent + the macro-definitions of the names from being expanded there. */ + +POINTER (obstack_base) (obstack) + struct obstack *obstack; +{ + return obstack_base (obstack); +} + +POINTER (obstack_next_free) (obstack) + struct obstack *obstack; +{ + return obstack_next_free (obstack); +} + +int (obstack_object_size) (obstack) + struct obstack *obstack; +{ + return obstack_object_size (obstack); +} + +int (obstack_room) (obstack) + struct obstack *obstack; +{ + return obstack_room (obstack); +} + +int (obstack_make_room) (obstack, length) + struct obstack *obstack; + int length; +{ + return obstack_make_room (obstack, length); +} + +void (obstack_grow) (obstack, pointer, length) + struct obstack *obstack; + POINTER pointer; + int length; +{ + obstack_grow (obstack, pointer, length); +} + +void (obstack_grow0) (obstack, pointer, length) + struct obstack *obstack; + POINTER pointer; + int length; +{ + obstack_grow0 (obstack, pointer, length); +} + +void (obstack_1grow) (obstack, character) + struct obstack *obstack; + int character; +{ + obstack_1grow (obstack, character); +} + +void (obstack_blank) (obstack, length) + struct obstack *obstack; + int length; +{ + obstack_blank (obstack, length); +} + +void (obstack_1grow_fast) (obstack, character) + struct obstack *obstack; + int character; +{ + obstack_1grow_fast (obstack, character); +} + +void (obstack_blank_fast) (obstack, length) + struct obstack *obstack; + int length; +{ + obstack_blank_fast (obstack, length); +} + +POINTER (obstack_finish) (obstack) + struct obstack *obstack; +{ + return obstack_finish (obstack); +} + +POINTER (obstack_alloc) (obstack, length) + struct obstack *obstack; + int length; +{ + return obstack_alloc (obstack, length); +} + +POINTER (obstack_copy) (obstack, pointer, length) + struct obstack *obstack; + POINTER pointer; + int length; +{ + return obstack_copy (obstack, pointer, length); +} + +POINTER (obstack_copy0) (obstack, pointer, length) + struct obstack *obstack; + POINTER pointer; + int length; +{ + return obstack_copy0 (obstack, pointer, length); +} + +#endif /* __STDC__ */ + +#endif /* 0 */ + +#endif /* !ELIDE_CODE */ diff --git a/lib/obstack.h b/lib/obstack.h new file mode 100644 index 0000000..e65ad1a --- /dev/null +++ b/lib/obstack.h @@ -0,0 +1,593 @@ +/* obstack.h - object stack macros + Copyright (C) 1988,89,90,91,92,93,94,96,97,98,99 Free Software Foundation, Inc. + + This file is part of the GNU C Library. Its master source is NOT part of + the C library, however. The master source lives in /gd/gnu/lib. + + The GNU 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 GNU 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., + 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Summary: + +All the apparent functions defined here are macros. The idea +is that you would use these pre-tested macros to solve a +very specific set of problems, and they would run fast. +Caution: no side-effects in arguments please!! They may be +evaluated MANY times!! + +These macros operate a stack of objects. Each object starts life +small, and may grow to maturity. (Consider building a word syllable +by syllable.) An object can move while it is growing. Once it has +been "finished" it never changes address again. So the "top of the +stack" is typically an immature growing object, while the rest of the +stack is of mature, fixed size and fixed address objects. + +These routines grab large chunks of memory, using a function you +supply, called `obstack_chunk_alloc'. On occasion, they free chunks, +by calling `obstack_chunk_free'. You must define them and declare +them before using any obstack macros. + +Each independent stack is represented by a `struct obstack'. +Each of the obstack macros expects a pointer to such a structure +as the first argument. + +One motivation for this package is the problem of growing char strings +in symbol tables. Unless you are "fascist pig with a read-only mind" +--Gosper's immortal quote from HAKMEM item 154, out of context--you +would not like to put any arbitrary upper limit on the length of your +symbols. + +In practice this often means you will build many short symbols and a +few long symbols. At the time you are reading a symbol you don't know +how long it is. One traditional method is to read a symbol into a +buffer, realloc()ating the buffer every time you try to read a symbol +that is longer than the buffer. This is beaut, but you still will +want to copy the symbol from the buffer to a more permanent +symbol-table entry say about half the time. + +With obstacks, you can work differently. Use one obstack for all symbol +names. As you read a symbol, grow the name in the obstack gradually. +When the name is complete, finalize it. Then, if the symbol exists already, +free the newly read name. + +The way we do this is to take a large chunk, allocating memory from +low addresses. When you want to build a symbol in the chunk you just +add chars above the current "high water mark" in the chunk. When you +have finished adding chars, because you got to the end of the symbol, +you know how long the chars are, and you can create a new object. +Mostly the chars will not burst over the highest address of the chunk, +because you would typically expect a chunk to be (say) 100 times as +long as an average object. + +In case that isn't clear, when we have enough chars to make up +the object, THEY ARE ALREADY CONTIGUOUS IN THE CHUNK (guaranteed) +so we just point to it where it lies. No moving of chars is +needed and this is the second win: potentially long strings need +never be explicitly shuffled. Once an object is formed, it does not +change its address during its lifetime. + +When the chars burst over a chunk boundary, we allocate a larger +chunk, and then copy the partly formed object from the end of the old +chunk to the beginning of the new larger chunk. We then carry on +accreting characters to the end of the object as we normally would. + +A special macro is provided to add a single char at a time to a +growing object. This allows the use of register variables, which +break the ordinary 'growth' macro. + +Summary: + We allocate large chunks. + We carve out one object at a time from the current chunk. + Once carved, an object never moves. + We are free to append data of any size to the currently + growing object. + Exactly one object is growing in an obstack at any one time. + You can run one obstack per control block. + You may have as many control blocks as you dare. + Because of the way we do it, you can `unwind' an obstack + back to a previous state. (You may remove objects much + as you would with a stack.) +*/ + + +/* Don't do the contents of this file more than once. */ + +#ifndef _OBSTACK_H +#define _OBSTACK_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +/* We use subtraction of (char *) 0 instead of casting to int + because on word-addressable machines a simple cast to int + may ignore the byte-within-word field of the pointer. */ + +#ifndef __PTR_TO_INT +# define __PTR_TO_INT(P) ((P) - (char *) 0) +#endif + +#ifndef __INT_TO_PTR +# define __INT_TO_PTR(P) ((P) + (char *) 0) +#endif + +/* We need the type of the resulting object. If __PTRDIFF_TYPE__ is + defined, as with GNU C, use that; that way we don't pollute the + namespace with 's symbols. Otherwise, if is + available, include it and use ptrdiff_t. In traditional C, long is + the best that we can do. */ + +#ifdef __PTRDIFF_TYPE__ +# define PTR_INT_TYPE __PTRDIFF_TYPE__ +#else +# ifdef HAVE_STDDEF_H +# include +# define PTR_INT_TYPE ptrdiff_t +# else +# define PTR_INT_TYPE long +# endif +#endif + +#if defined _LIBC || defined HAVE_STRING_H +# include +# define _obstack_memcpy(To, From, N) memcpy ((To), (From), (N)) +#else +# ifdef memcpy +# define _obstack_memcpy(To, From, N) memcpy ((To), (From), (N)) +# else +# define _obstack_memcpy(To, From, N) bcopy ((From), (To), (N)) +# endif +#endif + +struct _obstack_chunk /* Lives at front of each chunk. */ +{ + char *limit; /* 1 past end of this chunk */ + struct _obstack_chunk *prev; /* address of prior chunk or NULL */ + char contents[4]; /* objects begin here */ +}; + +struct obstack /* control current object in current chunk */ +{ + long chunk_size; /* preferred size to allocate chunks in */ + struct _obstack_chunk *chunk; /* address of current struct obstack_chunk */ + char *object_base; /* address of object we are building */ + char *next_free; /* where to add next char to current object */ + 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 + prevents freeing the chunk if we allocate + a bigger chunk to replace it. */ + unsigned alloc_failed:1; /* No longer used, as we now call the failed + handler on error, but retained for binary + compatibility. */ +}; + +/* Declare the external functions we use; they are in obstack.c. */ + +#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 *(*) (long), void (*) (void *)); +extern int _obstack_begin_1 (struct obstack *, int, int, + void *(*) (void *, long), + void (*) (void *, void *), void *); +extern int _obstack_memory_used (struct obstack *); +#else +extern void _obstack_newchunk (); +extern void _obstack_free (); +extern int _obstack_begin (); +extern int _obstack_begin_1 (); +extern int _obstack_memory_used (); +#endif + +#if defined __STDC__ && __STDC__ + +/* Do the function-declarations after the structs + but before defining the macros. */ + +void obstack_init (struct obstack *obstack); + +void * obstack_alloc (struct obstack *obstack, int size); + +void * obstack_copy (struct obstack *obstack, void *address, int size); +void * obstack_copy0 (struct obstack *obstack, void *address, int size); + +void obstack_free (struct obstack *obstack, void *block); + +void obstack_blank (struct obstack *obstack, int size); + +void obstack_grow (struct obstack *obstack, void *data, int size); +void obstack_grow0 (struct obstack *obstack, void *data, int size); + +void obstack_1grow (struct obstack *obstack, int data_char); +void obstack_ptr_grow (struct obstack *obstack, void *data); +void obstack_int_grow (struct obstack *obstack, int data); + +void * obstack_finish (struct obstack *obstack); + +int obstack_object_size (struct obstack *obstack); + +int obstack_room (struct obstack *obstack); +void obstack_make_room (struct obstack *obstack, int size); +void obstack_1grow_fast (struct obstack *obstack, int data_char); +void obstack_ptr_grow_fast (struct obstack *obstack, void *data); +void obstack_int_grow_fast (struct obstack *obstack, int data); +void obstack_blank_fast (struct obstack *obstack, int size); + +void * obstack_base (struct obstack *obstack); +void * obstack_next_free (struct obstack *obstack); +int obstack_alignment_mask (struct obstack *obstack); +int obstack_chunk_size (struct obstack *obstack); +int obstack_memory_used (struct obstack *obstack); + +#endif /* __STDC__ */ + +/* Non-ANSI C cannot really support alternative functions for these macros, + so we do not declare them. */ + +/* Error handler called when `obstack_chunk_alloc' failed to allocate + more memory. This can be set to a user defined function which + should either abort gracefully or use longjump - but shouldn't + return. The default action is to print a message and abort. */ +#if defined __STDC__ && __STDC__ +extern void (*obstack_alloc_failed_handler) (void); +#else +extern void (*obstack_alloc_failed_handler) (); +#endif + +/* Exit value used when `print_and_abort' is used. */ +extern int obstack_exit_failure; + +/* Pointer to beginning of object being allocated or to be allocated next. + Note that this might not be the final address of the object + because a new chunk might be needed to hold the final size. */ + +#define obstack_base(h) ((h)->object_base) + +/* Size for allocating ordinary chunks. */ + +#define obstack_chunk_size(h) ((h)->chunk_size) + +/* Pointer to next byte not yet allocated in current chunk. */ + +#define obstack_next_free(h) ((h)->next_free) + +/* Mask specifying low bits that should be clear in address of an object. */ + +#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 *(*) (void *, long)) (chunkfun), \ + (void (*) (void *, void *)) (freefun), (arg)) + +# define obstack_chunkfun(h, newchunkfun) \ + ((h) -> chunkfun = (struct _obstack_chunk *(*)(void *, long)) (newchunkfun)) + +# define obstack_freefun(h, newfreefun) \ + ((h) -> freefun = (void (*)(void *, struct _obstack_chunk *)) (newfreefun)) + +#else + +# define obstack_init(h) \ + _obstack_begin ((h), 0, 0, \ + (void *(*) ()) obstack_chunk_alloc, (void (*) ()) obstack_chunk_free) + +# define obstack_begin(h, size) \ + _obstack_begin ((h), (size), 0, \ + (void *(*) ()) obstack_chunk_alloc, (void (*) ()) obstack_chunk_free) + +# define obstack_specify_allocation(h, size, alignment, chunkfun, freefun) \ + _obstack_begin ((h), (size), (alignment), \ + (void *(*) ()) (chunkfun), (void (*) ()) (freefun)) + +# define obstack_specify_allocation_with_arg(h, size, alignment, chunkfun, freefun, arg) \ + _obstack_begin_1 ((h), (size), (alignment), \ + (void *(*) ()) (chunkfun), (void (*) ()) (freefun), (arg)) + +# define obstack_chunkfun(h, newchunkfun) \ + ((h) -> chunkfun = (struct _obstack_chunk *(*)()) (newchunkfun)) + +# 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)) + +#define obstack_memory_used(h) _obstack_memory_used (h) + +#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 + +/* For GNU C, if not -traditional, + we can define these macros to compute all args only once + without using a global variable. + Also, we can avoid using the `temp' slot, to make faster code. */ + +# define obstack_object_size(OBSTACK) \ + __extension__ \ + ({ struct obstack *__o = (OBSTACK); \ + (unsigned) (__o->next_free - __o->object_base); }) + +# define obstack_room(OBSTACK) \ + __extension__ \ + ({ struct obstack *__o = (OBSTACK); \ + (unsigned) (__o->chunk_limit - __o->next_free); }) + +# define obstack_make_room(OBSTACK,length) \ +__extension__ \ +({ struct obstack *__o = (OBSTACK); \ + int __len = (length); \ + if (__o->chunk_limit - __o->next_free < __len) \ + _obstack_newchunk (__o, __len); \ + (void) 0; }) + +# define obstack_empty_p(OBSTACK) \ + __extension__ \ + ({ struct obstack *__o = (OBSTACK); \ + (__o->chunk->prev == 0 && __o->next_free - __o->chunk->contents == 0); }) + +# define obstack_grow(OBSTACK,where,length) \ +__extension__ \ +({ struct obstack *__o = (OBSTACK); \ + int __len = (length); \ + if (__o->next_free + __len > __o->chunk_limit) \ + _obstack_newchunk (__o, __len); \ + _obstack_memcpy (__o->next_free, (char *) (where), __len); \ + __o->next_free += __len; \ + (void) 0; }) + +# define obstack_grow0(OBSTACK,where,length) \ +__extension__ \ +({ struct obstack *__o = (OBSTACK); \ + int __len = (length); \ + if (__o->next_free + __len + 1 > __o->chunk_limit) \ + _obstack_newchunk (__o, __len + 1); \ + _obstack_memcpy (__o->next_free, (char *) (where), __len); \ + __o->next_free += __len; \ + *(__o->next_free)++ = 0; \ + (void) 0; }) + +# define obstack_1grow(OBSTACK,datum) \ +__extension__ \ +({ struct obstack *__o = (OBSTACK); \ + if (__o->next_free + 1 > __o->chunk_limit) \ + _obstack_newchunk (__o, 1); \ + *(__o->next_free)++ = (datum); \ + (void) 0; }) + +/* 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); \ + if (__o->next_free + sizeof (void *) > __o->chunk_limit) \ + _obstack_newchunk (__o, sizeof (void *)); \ + *((void **)__o->next_free)++ = ((void *)datum); \ + (void) 0; }) + +# define obstack_int_grow(OBSTACK,datum) \ +__extension__ \ +({ struct obstack *__o = (OBSTACK); \ + if (__o->next_free + sizeof (int) > __o->chunk_limit) \ + _obstack_newchunk (__o, sizeof (int)); \ + *((int *)__o->next_free)++ = ((int)datum); \ + (void) 0; }) + +# define obstack_ptr_grow_fast(h,aptr) (*((void **) (h)->next_free)++ = (void *)aptr) +# define obstack_int_grow_fast(h,aint) (*((int *) (h)->next_free)++ = (int) aint) + +# define obstack_blank(OBSTACK,length) \ +__extension__ \ +({ struct obstack *__o = (OBSTACK); \ + int __len = (length); \ + if (__o->chunk_limit - __o->next_free < __len) \ + _obstack_newchunk (__o, __len); \ + __o->next_free += __len; \ + (void) 0; }) + +# define obstack_alloc(OBSTACK,length) \ +__extension__ \ +({ struct obstack *__h = (OBSTACK); \ + obstack_blank (__h, (length)); \ + obstack_finish (__h); }) + +# define obstack_copy(OBSTACK,where,length) \ +__extension__ \ +({ struct obstack *__h = (OBSTACK); \ + obstack_grow (__h, (where), (length)); \ + obstack_finish (__h); }) + +# define obstack_copy0(OBSTACK,where,length) \ +__extension__ \ +({ struct obstack *__h = (OBSTACK); \ + obstack_grow0 (__h, (where), (length)); \ + obstack_finish (__h); }) + +/* The local variable is named __o1 to avoid a name conflict + when obstack_blank is called. */ +# define obstack_finish(OBSTACK) \ +__extension__ \ +({ struct obstack *__o1 = (OBSTACK); \ + void *value; \ + value = (void *) __o1->object_base; \ + if (__o1->next_free == value) \ + __o1->maybe_empty_object = 1; \ + __o1->next_free \ + = __INT_TO_PTR ((__PTR_TO_INT (__o1->next_free)+__o1->alignment_mask)\ + & ~ (__o1->alignment_mask)); \ + if (__o1->next_free - (char *)__o1->chunk \ + > __o1->chunk_limit - (char *)__o1->chunk) \ + __o1->next_free = __o1->chunk_limit; \ + __o1->object_base = __o1->next_free; \ + value; }) + +# define obstack_free(OBSTACK, OBJ) \ +__extension__ \ +({ struct obstack *__o = (OBSTACK); \ + void *__obj = (OBJ); \ + if (__obj > (void *)__o->chunk && __obj < (void *)__o->chunk_limit) \ + __o->next_free = __o->object_base = (char *)__obj; \ + else (obstack_free) (__o, __obj); }) + +#else /* not __GNUC__ or not __STDC__ */ + +# define obstack_object_size(h) \ + (unsigned) ((h)->next_free - (h)->object_base) + +# define obstack_room(h) \ + (unsigned) ((h)->chunk_limit - (h)->next_free) + +# define obstack_empty_p(h) \ + ((h)->chunk->prev == 0 && (h)->next_free - (h)->chunk->contents == 0) + +/* Note that the call to _obstack_newchunk is enclosed in (..., 0) + so that we can avoid having void expressions + in the arms of the conditional expression. + Casting the third operand to void was tried before, + but some compilers won't accept it. */ + +# define obstack_make_room(h,length) \ +( (h)->temp = (length), \ + (((h)->next_free + (h)->temp > (h)->chunk_limit) \ + ? (_obstack_newchunk ((h), (h)->temp), 0) : 0)) + +# define obstack_grow(h,where,length) \ +( (h)->temp = (length), \ + (((h)->next_free + (h)->temp > (h)->chunk_limit) \ + ? (_obstack_newchunk ((h), (h)->temp), 0) : 0), \ + _obstack_memcpy ((h)->next_free, (char *) (where), (h)->temp), \ + (h)->next_free += (h)->temp) + +# define obstack_grow0(h,where,length) \ +( (h)->temp = (length), \ + (((h)->next_free + (h)->temp + 1 > (h)->chunk_limit) \ + ? (_obstack_newchunk ((h), (h)->temp + 1), 0) : 0), \ + _obstack_memcpy ((h)->next_free, (char *) (where), (h)->temp), \ + (h)->next_free += (h)->temp, \ + *((h)->next_free)++ = 0) + +# define obstack_1grow(h,datum) \ +( (((h)->next_free + 1 > (h)->chunk_limit) \ + ? (_obstack_newchunk ((h), 1), 0) : 0), \ + (*((h)->next_free)++ = (datum))) + +# define obstack_ptr_grow(h,datum) \ +( (((h)->next_free + sizeof (char *) > (h)->chunk_limit) \ + ? (_obstack_newchunk ((h), sizeof (char *)), 0) : 0), \ + (*((char **) (((h)->next_free+=sizeof(char *))-sizeof(char *))) = ((char *) datum))) + +# define obstack_int_grow(h,datum) \ +( (((h)->next_free + sizeof (int) > (h)->chunk_limit) \ + ? (_obstack_newchunk ((h), sizeof (int)), 0) : 0), \ + (*((int *) (((h)->next_free+=sizeof(int))-sizeof(int))) = ((int) datum))) + +# define obstack_ptr_grow_fast(h,aptr) (*((char **) (h)->next_free)++ = (char *) aptr) +# define obstack_int_grow_fast(h,aint) (*((int *) (h)->next_free)++ = (int) aint) + +# define obstack_blank(h,length) \ +( (h)->temp = (length), \ + (((h)->chunk_limit - (h)->next_free < (h)->temp) \ + ? (_obstack_newchunk ((h), (h)->temp), 0) : 0), \ + ((h)->next_free += (h)->temp)) + +# define obstack_alloc(h,length) \ + (obstack_blank ((h), (length)), obstack_finish ((h))) + +# define obstack_copy(h,where,length) \ + (obstack_grow ((h), (where), (length)), obstack_finish ((h))) + +# define obstack_copy0(h,where,length) \ + (obstack_grow0 ((h), (where), (length)), obstack_finish ((h))) + +# define obstack_finish(h) \ +( ((h)->next_free == (h)->object_base \ + ? (((h)->maybe_empty_object = 1), 0) \ + : 0), \ + (h)->temp = __PTR_TO_INT ((h)->object_base), \ + (h)->next_free \ + = __INT_TO_PTR ((__PTR_TO_INT ((h)->next_free)+(h)->alignment_mask) \ + & ~ ((h)->alignment_mask)), \ + (((h)->next_free - (char *) (h)->chunk \ + > (h)->chunk_limit - (char *) (h)->chunk) \ + ? ((h)->next_free = (h)->chunk_limit) : 0), \ + (h)->object_base = (h)->next_free, \ + __INT_TO_PTR ((h)->temp)) + +# 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)\ + ? (int) ((h)->next_free = (h)->object_base \ + = (h)->temp + (char *) (h)->chunk) \ + : (((obstack_free) ((h), (h)->temp + (char *) (h)->chunk), 0), 0))) +# else +# define obstack_free(h,obj) \ +( (h)->temp = (char *) (obj) - (char *) (h)->chunk, \ + (((h)->temp > 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\ + ? (int) ((h)->next_free = (h)->object_base \ + = (h)->temp + (char *) (h)->chunk) \ + : (_obstack_free ((h), (h)->temp + (char *) (h)->chunk), 0))) +# endif + +#endif /* not __GNUC__ or not __STDC__ */ + +#ifdef __cplusplus +} /* C++ */ +#endif + +#endif /* obstack.h */ diff --git a/lib/posix/.cvsignore b/lib/posix/.cvsignore new file mode 100644 index 0000000..282522d --- /dev/null +++ b/lib/posix/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/lib/posix/Makefile.am b/lib/posix/Makefile.am new file mode 100644 index 0000000..610ef22 --- /dev/null +++ b/lib/posix/Makefile.am @@ -0,0 +1,4 @@ +## Process this file with automake to create Makefile.in +AUTOMAKE_OPTIONS=no-dependencies + +EXTRA_DIST = regex.h diff --git a/lib/posix/Makefile.in b/lib/posix/Makefile.in new file mode 100644 index 0000000..cfbfb1f --- /dev/null +++ b/lib/posix/Makefile.in @@ -0,0 +1,341 @@ +# Makefile.in generated by automake 1.10 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = lib/posix +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/codeset.m4 \ + $(top_srcdir)/m4/decl.m4 $(top_srcdir)/m4/djgpp.m4 \ + $(top_srcdir)/m4/dosfile.m4 $(top_srcdir)/m4/envsep.m4 \ + $(top_srcdir)/m4/error.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/header.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/inttypes_h.m4 \ + $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/largefile.m4 \ + $(top_srcdir)/m4/lcmessage.m4 $(top_srcdir)/m4/malloc.m4 \ + $(top_srcdir)/m4/mbstate_t.m4 $(top_srcdir)/m4/missing.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/realloc.m4 \ + $(top_srcdir)/m4/regex.m4 $(top_srcdir)/m4/sanity.m4 \ + $(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/ulonglong.m4 \ + $(top_srcdir)/m4/xstrtoumax.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +depcomp = +am__depfiles_maybe = +SOURCES = +DIST_SOURCES = +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GENCAT = @GENCAT@ +GETCONF = @GETCONF@ +GLIBC21 = @GLIBC21@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLBISON = @INTLBISON@ +INTLLIBS = @INTLLIBS@ +INTLOBJS = @INTLOBJS@ +INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +POFILES = @POFILES@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SEP = @SEP@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +U = @U@ +USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AUTOMAKE_OPTIONS = no-dependencies +EXTRA_DIST = regex.h +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lib/posix/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu lib/posix/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-exec-am: + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic distclean \ + distclean-generic distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am + +# 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. +.NOEXPORT: diff --git a/lib/posix/regex.h b/lib/posix/regex.h new file mode 100644 index 0000000..f197c66 --- /dev/null +++ b/lib/posix/regex.h @@ -0,0 +1,566 @@ +/* Definitions for data structures and routines for the regular + expression library, version 0.12. + Copyright (C) 1985,1989-1993,1995-1998, 2000 Free Software Foundation, Inc. + + This file is part of the GNU C Library. Its master source is NOT part of + the C library, however. The master source lives in /gd/gnu/lib. + + The GNU 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 GNU 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., + 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifndef _REGEX_H +#define _REGEX_H 1 + +/* Allow the use in C++ code. */ +#ifdef __cplusplus +extern "C" { +#endif + +/* POSIX says that must be included (by the caller) before + . */ + +#if !defined _POSIX_C_SOURCE && !defined _POSIX_SOURCE && defined VMS +/* VMS doesn't have `size_t' in , even though POSIX says it + should be there. */ +# include +#endif + +/* The following two types have to be signed and unsigned integer type + wide enough to hold a value of a pointer. For most ANSI compilers + ptrdiff_t and size_t should be likely OK. Still size of these two + types is 2 for Microsoft C. Ugh... */ +typedef long int s_reg_t; +typedef unsigned long int active_reg_t; + +/* The following bits are used to determine the regexp syntax we + recognize. The set/not-set meanings are chosen so that Emacs syntax + remains the value 0. The bits are given in alphabetical order, and + the definitions shifted by one from the previous bit; thus, when we + add or remove a bit, only one other definition need change. */ +typedef unsigned long int reg_syntax_t; + +/* If this bit is not set, then \ inside a bracket expression is literal. + If set, then such a \ quotes the following character. */ +#define RE_BACKSLASH_ESCAPE_IN_LISTS ((unsigned long int) 1) + +/* If this bit is not set, then + and ? are operators, and \+ and \? are + literals. + If set, then \+ and \? are operators and + and ? are literals. */ +#define RE_BK_PLUS_QM (RE_BACKSLASH_ESCAPE_IN_LISTS << 1) + +/* If this bit is set, then character classes are supported. They are: + [:alpha:], [:upper:], [:lower:], [:digit:], [:alnum:], [:xdigit:], + [:space:], [:print:], [:punct:], [:graph:], and [:cntrl:]. + If not set, then character classes are not supported. */ +#define RE_CHAR_CLASSES (RE_BK_PLUS_QM << 1) + +/* If this bit is set, then ^ and $ are always anchors (outside bracket + expressions, of course). + If this bit is not set, then it depends: + ^ is an anchor if it is at the beginning of a regular + expression or after an open-group or an alternation operator; + $ is an anchor if it is at the end of a regular expression, or + before a close-group or an alternation operator. + + This bit could be (re)combined with RE_CONTEXT_INDEP_OPS, because + POSIX draft 11.2 says that * etc. in leading positions is undefined. + We already implemented a previous draft which made those constructs + invalid, though, so we haven't changed the code back. */ +#define RE_CONTEXT_INDEP_ANCHORS (RE_CHAR_CLASSES << 1) + +/* If this bit is set, then special characters are always special + regardless of where they are in the pattern. + If this bit is not set, then special characters are special only in + some contexts; otherwise they are ordinary. Specifically, + * + ? and intervals are only special when not after the beginning, + open-group, or alternation operator. */ +#define RE_CONTEXT_INDEP_OPS (RE_CONTEXT_INDEP_ANCHORS << 1) + +/* If this bit is set, then *, +, ?, and { cannot be first in an re or + immediately after an alternation or begin-group operator. */ +#define RE_CONTEXT_INVALID_OPS (RE_CONTEXT_INDEP_OPS << 1) + +/* If this bit is set, then . matches newline. + If not set, then it doesn't. */ +#define RE_DOT_NEWLINE (RE_CONTEXT_INVALID_OPS << 1) + +/* If this bit is set, then . doesn't match NUL. + If not set, then it does. */ +#define RE_DOT_NOT_NULL (RE_DOT_NEWLINE << 1) + +/* If this bit is set, nonmatching lists [^...] do not match newline. + If not set, they do. */ +#define RE_HAT_LISTS_NOT_NEWLINE (RE_DOT_NOT_NULL << 1) + +/* If this bit is set, either \{...\} or {...} defines an + interval, depending on RE_NO_BK_BRACES. + If not set, \{, \}, {, and } are literals. */ +#define RE_INTERVALS (RE_HAT_LISTS_NOT_NEWLINE << 1) + +/* If this bit is set, +, ? and | aren't recognized as operators. + If not set, they are. */ +#define RE_LIMITED_OPS (RE_INTERVALS << 1) + +/* If this bit is set, newline is an alternation operator. + If not set, newline is literal. */ +#define RE_NEWLINE_ALT (RE_LIMITED_OPS << 1) + +/* If this bit is set, then `{...}' defines an interval, and \{ and \} + are literals. + If not set, then `\{...\}' defines an interval. */ +#define RE_NO_BK_BRACES (RE_NEWLINE_ALT << 1) + +/* If this bit is set, (...) defines a group, and \( and \) are literals. + If not set, \(...\) defines a group, and ( and ) are literals. */ +#define RE_NO_BK_PARENS (RE_NO_BK_BRACES << 1) + +/* If this bit is set, then \ matches . + If not set, then \ is a back-reference. */ +#define RE_NO_BK_REFS (RE_NO_BK_PARENS << 1) + +/* If this bit is set, then | is an alternation operator, and \| is literal. + If not set, then \| is an alternation operator, and | is literal. */ +#define RE_NO_BK_VBAR (RE_NO_BK_REFS << 1) + +/* If this bit is set, then an ending range point collating higher + than the starting range point, as in [z-a], is invalid. + If not set, then when ending range point collates higher than the + starting range point, the range is ignored. */ +#define RE_NO_EMPTY_RANGES (RE_NO_BK_VBAR << 1) + +/* If this bit is set, then an unmatched ) is ordinary. + If not set, then an unmatched ) is invalid. */ +#define RE_UNMATCHED_RIGHT_PAREN_ORD (RE_NO_EMPTY_RANGES << 1) + +/* If this bit is set, succeed as soon as we match the whole pattern, + without further backtracking. */ +#define RE_NO_POSIX_BACKTRACKING (RE_UNMATCHED_RIGHT_PAREN_ORD << 1) + +/* If this bit is set, do not process the GNU regex operators. + If not set, then the GNU regex operators are recognized. */ +#define RE_NO_GNU_OPS (RE_NO_POSIX_BACKTRACKING << 1) + +/* If this bit is set, turn on internal regex debugging. + If not set, and debugging was on, turn it off. + This only works if regex.c is compiled -DDEBUG. + We define this bit always, so that all that's needed to turn on + debugging is to recompile regex.c; the calling code can always have + this bit set, and it won't affect anything in the normal case. */ +#define RE_DEBUG (RE_NO_GNU_OPS << 1) + +/* If this bit is set, a syntactically invalid interval is treated as + a string of ordinary characters. For example, the ERE 'a{1' is + treated as 'a\{1'. */ +#define RE_INVALID_INTERVAL_ORD (RE_DEBUG << 1) + +/* This global variable defines the particular regexp syntax to use (for + some interfaces). When a regexp is compiled, the syntax used is + stored in the pattern buffer, so changing this does not affect + already-compiled regexps. */ +extern reg_syntax_t re_syntax_options; + +/* Define combinations of the above bits for the standard possibilities. + (The [[[ comments delimit what gets put into the Texinfo file, so + don't delete them!) */ +/* [[[begin syntaxes]]] */ +#define RE_SYNTAX_EMACS 0 + +#define RE_SYNTAX_AWK \ + (RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DOT_NOT_NULL \ + | RE_NO_BK_PARENS | RE_NO_BK_REFS \ + | RE_NO_BK_VBAR | RE_NO_EMPTY_RANGES \ + | RE_DOT_NEWLINE | RE_CONTEXT_INDEP_ANCHORS \ + | RE_UNMATCHED_RIGHT_PAREN_ORD | RE_NO_GNU_OPS) + +#define RE_SYNTAX_GNU_AWK \ + ((RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DEBUG) \ + & ~(RE_DOT_NOT_NULL | RE_INTERVALS | RE_CONTEXT_INDEP_OPS)) + +#define RE_SYNTAX_POSIX_AWK \ + (RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS \ + | RE_INTERVALS | RE_NO_GNU_OPS) + +#define RE_SYNTAX_GREP \ + (RE_BK_PLUS_QM | RE_CHAR_CLASSES \ + | RE_HAT_LISTS_NOT_NEWLINE | RE_INTERVALS \ + | RE_NEWLINE_ALT) + +#define RE_SYNTAX_EGREP \ + (RE_CHAR_CLASSES | RE_CONTEXT_INDEP_ANCHORS \ + | RE_CONTEXT_INDEP_OPS | RE_HAT_LISTS_NOT_NEWLINE \ + | RE_NEWLINE_ALT | RE_NO_BK_PARENS \ + | RE_NO_BK_VBAR) + +#define RE_SYNTAX_POSIX_EGREP \ + (RE_SYNTAX_EGREP | RE_INTERVALS | RE_NO_BK_BRACES \ + | RE_INVALID_INTERVAL_ORD) + +/* P1003.2/D11.2, section 4.20.7.1, lines 5078ff. */ +#define RE_SYNTAX_ED RE_SYNTAX_POSIX_BASIC + +#define RE_SYNTAX_SED RE_SYNTAX_POSIX_BASIC + +/* Syntax bits common to both basic and extended POSIX regex syntax. */ +#define _RE_SYNTAX_POSIX_COMMON \ + (RE_CHAR_CLASSES | RE_DOT_NEWLINE | RE_DOT_NOT_NULL \ + | RE_INTERVALS | RE_NO_EMPTY_RANGES) + +#define RE_SYNTAX_POSIX_BASIC \ + (_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM) + +/* Differs from ..._POSIX_BASIC only in that RE_BK_PLUS_QM becomes + RE_LIMITED_OPS, i.e., \? \+ \| are not recognized. Actually, this + isn't minimal, since other operators, such as \`, aren't disabled. */ +#define RE_SYNTAX_POSIX_MINIMAL_BASIC \ + (_RE_SYNTAX_POSIX_COMMON | RE_LIMITED_OPS) + +#define RE_SYNTAX_POSIX_EXTENDED \ + (_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \ + | RE_CONTEXT_INDEP_OPS | RE_NO_BK_BRACES \ + | RE_NO_BK_PARENS | RE_NO_BK_VBAR \ + | RE_CONTEXT_INVALID_OPS | RE_UNMATCHED_RIGHT_PAREN_ORD) + +/* Differs from ..._POSIX_EXTENDED in that RE_CONTEXT_INDEP_OPS is + removed and RE_NO_BK_REFS is added. */ +#define RE_SYNTAX_POSIX_MINIMAL_EXTENDED \ + (_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \ + | RE_CONTEXT_INVALID_OPS | RE_NO_BK_BRACES \ + | RE_NO_BK_PARENS | RE_NO_BK_REFS \ + | RE_NO_BK_VBAR | RE_UNMATCHED_RIGHT_PAREN_ORD) +/* [[[end syntaxes]]] */ + +/* Maximum number of duplicates an interval can allow. Some systems + (erroneously) define this in other header files, but we want our + value, so remove any previous define. */ +#ifdef RE_DUP_MAX +# undef RE_DUP_MAX +#endif +/* If sizeof(int) == 2, then ((1 << 15) - 1) overflows. */ +#define RE_DUP_MAX (0x7fff) + + +/* POSIX `cflags' bits (i.e., information for `regcomp'). */ + +/* If this bit is set, then use extended regular expression syntax. + If not set, then use basic regular expression syntax. */ +#define REG_EXTENDED 1 + +/* If this bit is set, then ignore case when matching. + If not set, then case is significant. */ +#define REG_ICASE (REG_EXTENDED << 1) + +/* If this bit is set, then anchors do not match at newline + characters in the string. + If not set, then anchors do match at newlines. */ +#define REG_NEWLINE (REG_ICASE << 1) + +/* If this bit is set, then report only success or fail in regexec. + If not set, then returns differ between not matching and errors. */ +#define REG_NOSUB (REG_NEWLINE << 1) + + +/* POSIX `eflags' bits (i.e., information for regexec). */ + +/* If this bit is set, then the beginning-of-line operator doesn't match + the beginning of the string (presumably because it's not the + beginning of a line). + If not set, then the beginning-of-line operator does match the + beginning of the string. */ +#define REG_NOTBOL 1 + +/* Like REG_NOTBOL, except for the end-of-line. */ +#define REG_NOTEOL (1 << 1) + + +/* If any error codes are removed, changed, or added, update the + `re_error_msg' table in regex.c. */ +typedef enum +{ +#ifdef _XOPEN_SOURCE + REG_ENOSYS = -1, /* This will never happen for this implementation. */ +#endif + + REG_NOERROR = 0, /* Success. */ + REG_NOMATCH, /* Didn't find a match (for regexec). */ + + /* POSIX regcomp return error codes. (In the order listed in the + standard.) */ + REG_BADPAT, /* Invalid pattern. */ + REG_ECOLLATE, /* Not implemented. */ + REG_ECTYPE, /* Invalid character class name. */ + REG_EESCAPE, /* Trailing backslash. */ + REG_ESUBREG, /* Invalid back reference. */ + REG_EBRACK, /* Unmatched left bracket. */ + REG_EPAREN, /* Parenthesis imbalance. */ + REG_EBRACE, /* Unmatched \{. */ + REG_BADBR, /* Invalid contents of \{\}. */ + REG_ERANGE, /* Invalid range end. */ + REG_ESPACE, /* Ran out of memory. */ + REG_BADRPT, /* No preceding re for repetition op. */ + + /* Error codes we've added. */ + REG_EEND, /* Premature end. */ + REG_ESIZE, /* Compiled pattern bigger than 2^16 bytes. */ + REG_ERPAREN /* Unmatched ) or \); not returned from regcomp. */ +} reg_errcode_t; + +/* This data structure represents a compiled pattern. Before calling + the pattern compiler, the fields `buffer', `allocated', `fastmap', + `translate', and `no_sub' can be set. After the pattern has been + compiled, the `re_nsub' field is available. All other fields are + private to the regex routines. */ + +#ifndef RE_TRANSLATE_TYPE +# define RE_TRANSLATE_TYPE char * +#endif + +struct re_pattern_buffer +{ +/* [[[begin pattern_buffer]]] */ + /* Space that holds the compiled pattern. It is declared as + `unsigned char *' because its elements are + sometimes used as array indexes. */ + unsigned char *buffer; + + /* Number of bytes to which `buffer' points. */ + unsigned long int allocated; + + /* Number of bytes actually used in `buffer'. */ + unsigned long int used; + + /* Syntax setting with which the pattern was compiled. */ + reg_syntax_t syntax; + + /* Pointer to a fastmap, if any, otherwise zero. re_search uses + the fastmap, if there is one, to skip over impossible + starting points for matches. */ + char *fastmap; + + /* Either a translate table to apply to all characters before + comparing them, or zero for no translation. The translation + is applied to a pattern when it is compiled and to a string + when it is matched. */ + RE_TRANSLATE_TYPE translate; + + /* Number of subexpressions found by the compiler. */ + size_t re_nsub; + + /* Zero if this pattern cannot match the empty string, one else. + Well, in truth it's used only in `re_search_2', to see + whether or not we should use the fastmap, so we don't set + this absolutely perfectly; see `re_compile_fastmap' (the + `duplicate' case). */ + unsigned can_be_null : 1; + + /* If REGS_UNALLOCATED, allocate space in the `regs' structure + for `max (RE_NREGS, re_nsub + 1)' groups. + If REGS_REALLOCATE, reallocate space if necessary. + If REGS_FIXED, use what's there. */ +#define REGS_UNALLOCATED 0 +#define REGS_REALLOCATE 1 +#define REGS_FIXED 2 + unsigned regs_allocated : 2; + + /* Set to zero when `regex_compile' compiles a pattern; set to one + by `re_compile_fastmap' if it updates the fastmap. */ + unsigned fastmap_accurate : 1; + + /* If set, `re_match_2' does not return information about + subexpressions. */ + unsigned no_sub : 1; + + /* If set, a beginning-of-line anchor doesn't match at the + beginning of the string. */ + unsigned not_bol : 1; + + /* Similarly for an end-of-line anchor. */ + unsigned not_eol : 1; + + /* If true, an anchor at a newline matches. */ + unsigned newline_anchor : 1; + +/* [[[end pattern_buffer]]] */ +}; + +typedef struct re_pattern_buffer regex_t; + +/* Type for byte offsets within the string. POSIX mandates this. */ +typedef int regoff_t; + + +/* This is the structure we store register match data in. See + regex.texinfo for a full description of what registers match. */ +struct re_registers +{ + unsigned num_regs; + regoff_t *start; + regoff_t *end; +}; + + +/* If `regs_allocated' is REGS_UNALLOCATED in the pattern buffer, + `re_match_2' returns information about at least this many registers + the first time a `regs' structure is passed. */ +#ifndef RE_NREGS +# define RE_NREGS 30 +#endif + + +/* POSIX specification for registers. Aside from the different names than + `re_registers', POSIX uses an array of structures, instead of a + structure of arrays. */ +typedef struct +{ + regoff_t rm_so; /* Byte offset from string's start to substring's start. */ + regoff_t rm_eo; /* Byte offset from string's start to substring's end. */ +} regmatch_t; + +/* Declarations for routines. */ + +/* To avoid duplicating every routine declaration -- once with a + prototype (if we are ANSI), and once without (if we aren't) -- we + use the following macro to declare argument types. This + unfortunately clutters up the declarations a bit, but I think it's + worth it. */ + +#if __STDC__ + +# define _RE_ARGS(args) args + +#else /* not __STDC__ */ + +# define _RE_ARGS(args) () + +#endif /* not __STDC__ */ + +/* Sets the current default syntax to SYNTAX, and return the old syntax. + You can also simply assign to the `re_syntax_options' variable. */ +extern reg_syntax_t re_set_syntax _RE_ARGS ((reg_syntax_t syntax)); + +/* Compile the regular expression PATTERN, with length LENGTH + and syntax given by the global `re_syntax_options', into the buffer + BUFFER. Return NULL if successful, and an error string if not. */ +extern const char *re_compile_pattern + _RE_ARGS ((const char *pattern, size_t length, + struct re_pattern_buffer *buffer)); + + +/* Compile a fastmap for the compiled pattern in BUFFER; used to + accelerate searches. Return 0 if successful and -2 if was an + internal error. */ +extern int re_compile_fastmap _RE_ARGS ((struct re_pattern_buffer *buffer)); + + +/* Search in the string STRING (with length LENGTH) for the pattern + compiled into BUFFER. Start searching at position START, for RANGE + characters. Return the starting position of the match, -1 for no + match, or -2 for an internal error. Also return register + information in REGS (if REGS and BUFFER->no_sub are nonzero). */ +extern int re_search + _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string, + int length, int start, int range, struct re_registers *regs)); + + +/* Like `re_search', but search in the concatenation of STRING1 and + STRING2. Also, stop searching at index START + STOP. */ +extern int re_search_2 + _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1, + int length1, const char *string2, int length2, + int start, int range, struct re_registers *regs, int stop)); + + +/* Like `re_search', but return how many characters in STRING the regexp + in BUFFER matched, starting at position START. */ +extern int re_match + _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string, + int length, int start, struct re_registers *regs)); + + +/* Relates to `re_match' as `re_search_2' relates to `re_search'. */ +extern int re_match_2 + _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1, + int length1, const char *string2, int length2, + int start, struct re_registers *regs, int stop)); + + +/* Set REGS to hold NUM_REGS registers, storing them in STARTS and + ENDS. Subsequent matches using BUFFER and REGS will use this memory + for recording register information. STARTS and ENDS must be + allocated with malloc, and must each be at least `NUM_REGS * sizeof + (regoff_t)' bytes long. + + If NUM_REGS == 0, then subsequent matches should allocate their own + register data. + + Unless this function is called, the first search or match using + PATTERN_BUFFER will allocate its own register data, without + freeing the old data. */ +extern void re_set_registers + _RE_ARGS ((struct re_pattern_buffer *buffer, struct re_registers *regs, + unsigned num_regs, regoff_t *starts, regoff_t *ends)); + +#if defined _REGEX_RE_COMP || defined _LIBC +# ifndef _CRAY +/* 4.2 bsd compatibility. */ +extern char *re_comp _RE_ARGS ((const char *)); +extern int re_exec _RE_ARGS ((const char *)); +# endif +#endif + +/* GCC 2.95 and later have "__restrict"; C99 compilers have + "restrict", and "configure" may have defined "restrict". */ +#ifndef __restrict +# if ! (2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__)) +# if defined restrict || 199901L <= __STDC_VERSION__ +# define __restrict restrict +# else +# define __restrict +# endif +# endif +#endif +/* For now unconditionally define __restrict_arr to expand to nothing. + Ideally we would have a test for the compiler which allows defining + it to restrict. */ +#define __restrict_arr + +/* POSIX compatibility. */ +extern int regcomp _RE_ARGS ((regex_t *__restrict __preg, + const char *__restrict __pattern, + int __cflags)); + +extern int regexec _RE_ARGS ((const regex_t *__restrict __preg, + const char *__restrict __string, size_t __nmatch, + regmatch_t __pmatch[__restrict_arr], + int __eflags)); + +extern size_t regerror _RE_ARGS ((int __errcode, const regex_t *__preg, + char *__errbuf, size_t __errbuf_size)); + +extern void regfree _RE_ARGS ((regex_t *__preg)); + + +#ifdef __cplusplus +} +#endif /* C++ */ + +#endif /* regex.h */ + +/* +Local variables: +make-backup-files: t +version-control: t +trim-versions-without-asking: nil +End: +*/ diff --git a/lib/quotearg.c b/lib/quotearg.c new file mode 100644 index 0000000..e71228f --- /dev/null +++ b/lib/quotearg.c @@ -0,0 +1,613 @@ +/* quotearg.c - quote arguments for output + Copyright (C) 1998, 1999, 2000, 2001 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Paul Eggert */ + +#if HAVE_CONFIG_H +# include +#endif + +#if HAVE_STDDEF_H +# include /* For the definition of size_t on windows w/MSVC. */ +#endif +#include +#include +#include + +#include + +#if ENABLE_NLS +# include +# define _(text) gettext (text) +#else +# define _(text) text +#endif +#define N_(text) text + +#if HAVE_LIMITS_H +# include +#endif +#ifndef CHAR_BIT +# define CHAR_BIT 8 +#endif +#ifndef UCHAR_MAX +# define UCHAR_MAX ((unsigned char) -1) +#endif + +#if HAVE_C_BACKSLASH_A +# define ALERT_CHAR '\a' +#else +# define ALERT_CHAR '\7' +#endif + +#if HAVE_STDLIB_H +# include +#endif + +#if HAVE_STRING_H +# include +#endif + +#if HAVE_WCHAR_H +# include +#endif + +#if !HAVE_MBRTOWC +/* Disable multibyte processing entirely. Since MB_CUR_MAX is 1, the + other macros are defined only for documentation and to satisfy C + syntax. */ +# undef MB_CUR_MAX +# define MB_CUR_MAX 1 +# define mbrtowc(pwc, s, n, ps) ((*(pwc) = *(s)) != 0) +# define mbsinit(ps) 1 +# define iswprint(wc) ISPRINT ((unsigned char) (wc)) +#endif + +#ifndef iswprint +# if HAVE_WCTYPE_H +# include +# endif +# if !defined iswprint && !HAVE_ISWPRINT +# define iswprint(wc) 1 +# endif +#endif + +#define INT_BITS (sizeof (int) * CHAR_BIT) + +#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII)) +# define IN_CTYPE_DOMAIN(c) 1 +#else +# define IN_CTYPE_DOMAIN(c) isascii(c) +#endif + +/* Undefine to protect against the definition in wctype.h of solaris2.6. */ +#undef ISPRINT +#define ISPRINT(c) (IN_CTYPE_DOMAIN (c) && isprint (c)) + +struct quoting_options +{ + /* Basic quoting style. */ + enum quoting_style style; + + /* Quote the characters indicated by this bit vector even if the + quoting style would not normally require them to be quoted. */ + int quote_these_too[(UCHAR_MAX / INT_BITS) + 1]; +}; + +/* Names of quoting styles. */ +char const *const quoting_style_args[] = +{ + "literal", + "shell", + "shell-always", + "c", + "escape", + "locale", + "clocale", + 0 +}; + +/* Correspondences to quoting style names. */ +enum quoting_style const quoting_style_vals[] = +{ + literal_quoting_style, + shell_quoting_style, + shell_always_quoting_style, + c_quoting_style, + escape_quoting_style, + locale_quoting_style, + clocale_quoting_style +}; + +/* The default quoting options. */ +static struct quoting_options default_quoting_options; + +/* Allocate a new set of quoting options, with contents initially identical + to O if O is not null, or to the default if O is null. + It is the caller's responsibility to free the result. */ +struct quoting_options * +clone_quoting_options (struct quoting_options *o) +{ + struct quoting_options *p + = (struct quoting_options *) xmalloc (sizeof (struct quoting_options)); + *p = *(o ? o : &default_quoting_options); + return p; +} + +/* Get the value of O's quoting style. If O is null, use the default. */ +enum quoting_style +get_quoting_style (struct quoting_options *o) +{ + return (o ? o : &default_quoting_options)->style; +} + +/* In O (or in the default if O is null), + set the value of the quoting style to S. */ +void +set_quoting_style (struct quoting_options *o, enum quoting_style s) +{ + (o ? o : &default_quoting_options)->style = s; +} + +/* In O (or in the default if O is null), + set the value of the quoting options for character C to I. + Return the old value. Currently, the only values defined for I are + 0 (the default) and 1 (which means to quote the character even if + it would not otherwise be quoted). */ +int +set_char_quoting (struct quoting_options *o, char c, int i) +{ + unsigned char uc = c; + int *p = (o ? o : &default_quoting_options)->quote_these_too + uc / INT_BITS; + int shift = uc % INT_BITS; + int r = (*p >> shift) & 1; + *p ^= ((i & 1) ^ r) << shift; + return r; +} + +/* MSGID approximates a quotation mark. Return its translation if it + has one; otherwise, return either it or "\"", depending on S. */ +static char const * +gettext_quote (char const *msgid, enum quoting_style s) +{ + char const *translation = _(msgid); + if (translation == msgid && s == clocale_quoting_style) + translation = "\""; + return translation; +} + +/* Place into buffer BUFFER (of size BUFFERSIZE) a quoted version of + argument ARG (of size ARGSIZE), using QUOTING_STYLE and the + non-quoting-style part of O to control quoting. + Terminate the output with a null character, and return the written + size of the output, not counting the terminating null. + If BUFFERSIZE is too small to store the output string, return the + value that would have been returned had BUFFERSIZE been large enough. + If ARGSIZE is -1, use the string length of the argument for ARGSIZE. + + This function acts like quotearg_buffer (BUFFER, BUFFERSIZE, ARG, + ARGSIZE, O), except it uses QUOTING_STYLE instead of the quoting + style specified by O, and O may not be null. */ + +static size_t +quotearg_buffer_restyled (char *buffer, size_t buffersize, + char const *arg, size_t argsize, + enum quoting_style quoting_style, + struct quoting_options const *o) +{ + size_t i; + size_t len = 0; + char const *quote_string = 0; + size_t quote_string_len = 0; + int backslash_escapes = 0; + int unibyte_locale = MB_CUR_MAX == 1; + +#define STORE(c) \ + do \ + { \ + if (len < buffersize) \ + buffer[len] = (c); \ + len++; \ + } \ + while (0) + + switch (quoting_style) + { + case c_quoting_style: + STORE ('"'); + backslash_escapes = 1; + quote_string = "\""; + quote_string_len = 1; + break; + + case escape_quoting_style: + backslash_escapes = 1; + break; + + case locale_quoting_style: + case clocale_quoting_style: + { + /* Get translations for open and closing quotation marks. + + The message catalog should translate "`" to a left + quotation mark suitable for the locale, and similarly for + "'". If the catalog has no translation, + locale_quoting_style quotes `like this', and + clocale_quoting_style quotes "like this". + + For example, an American English Unicode locale should + translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and + should translate "'" to U+201D (RIGHT DOUBLE QUOTATION + MARK). A British English Unicode locale should instead + translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and + U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. */ + + char const *left = gettext_quote (N_("`"), quoting_style); + char const *right = gettext_quote (N_("'"), quoting_style); + for (quote_string = left; *quote_string; quote_string++) + STORE (*quote_string); + backslash_escapes = 1; + quote_string = right; + quote_string_len = strlen (quote_string); + } + break; + + case shell_always_quoting_style: + STORE ('\''); + quote_string = "'"; + quote_string_len = 1; + break; + + default: + break; + } + + for (i = 0; ! (argsize == (size_t) -1 ? arg[i] == '\0' : i == argsize); i++) + { + unsigned char c; + unsigned char esc; + + if (backslash_escapes + && quote_string_len + && i + quote_string_len <= argsize + && memcmp (arg + i, quote_string, quote_string_len) == 0) + STORE ('\\'); + + c = arg[i]; + switch (c) + { + case '?': + switch (quoting_style) + { + case shell_quoting_style: + goto use_shell_always_quoting_style; + + case c_quoting_style: + if (i + 2 < argsize && arg[i + 1] == '?') + switch (arg[i + 2]) + { + case '!': case '\'': + case '(': case ')': case '-': case '/': + case '<': case '=': case '>': + /* Escape the second '?' in what would otherwise be + a trigraph. */ + i += 2; + c = arg[i + 2]; + STORE ('?'); + STORE ('\\'); + STORE ('?'); + break; + } + break; + + default: + break; + } + break; + + case ALERT_CHAR: esc = 'a'; goto c_escape; + case '\b': esc = 'b'; goto c_escape; + case '\f': esc = 'f'; goto c_escape; + case '\n': esc = 'n'; goto c_and_shell_escape; + case '\r': esc = 'r'; goto c_and_shell_escape; + case '\t': esc = 't'; goto c_and_shell_escape; + case '\v': esc = 'v'; goto c_escape; + case '\\': esc = c; goto c_and_shell_escape; + + c_and_shell_escape: + if (quoting_style == shell_quoting_style) + goto use_shell_always_quoting_style; + c_escape: + if (backslash_escapes) + { + c = esc; + goto store_escape; + } + break; + + case '#': case '~': + if (i != 0) + break; + /* Fall through. */ + case ' ': + case '!': /* special in bash */ + case '"': case '$': case '&': + case '(': case ')': case '*': case ';': + case '<': case '>': case '[': + case '^': /* special in old /bin/sh, e.g. SunOS 4.1.4 */ + case '`': case '|': + /* A shell special character. In theory, '$' and '`' could + be the first bytes of multibyte characters, which means + we should check them with mbrtowc, but in practice this + doesn't happen so it's not worth worrying about. */ + if (quoting_style == shell_quoting_style) + goto use_shell_always_quoting_style; + break; + + case '\'': + switch (quoting_style) + { + case shell_quoting_style: + goto use_shell_always_quoting_style; + + case shell_always_quoting_style: + STORE ('\''); + STORE ('\\'); + STORE ('\''); + break; + + default: + break; + } + break; + + case '%': case '+': case ',': case '-': case '.': case '/': + case '0': case '1': case '2': case '3': case '4': case '5': + case '6': case '7': case '8': case '9': case ':': case '=': + case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': + case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': + case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': + case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': + case 'Y': case 'Z': case ']': case '_': case 'a': case 'b': + case 'c': case 'd': case 'e': case 'f': case 'g': case 'h': + case 'i': case 'j': case 'k': case 'l': case 'm': case 'n': + case 'o': case 'p': case 'q': case 'r': case 's': case 't': + case 'u': case 'v': case 'w': case 'x': case 'y': case 'z': + case '{': case '}': + /* These characters don't cause problems, no matter what the + quoting style is. They cannot start multibyte sequences. */ + break; + + default: + /* If we have a multibyte sequence, copy it until we reach + its end, find an error, or come back to the initial shift + state. For C-like styles, if the sequence has + unprintable characters, escape the whole sequence, since + we can't easily escape single characters within it. */ + { + /* Length of multibyte sequence found so far. */ + size_t m; + + int printable; + + if (unibyte_locale) + { + m = 1; + printable = ISPRINT (c); + } + else + { + mbstate_t mbstate; + memset (&mbstate, 0, sizeof mbstate); + + m = 0; + printable = 1; + if (argsize == (size_t) -1) + argsize = strlen (arg); + + do + { + wchar_t w; + size_t bytes = mbrtowc (&w, &arg[i + m], + argsize - (i + m), &mbstate); + if (bytes == 0) + break; + else if (bytes == (size_t) -1) + { + printable = 0; + break; + } + else if (bytes == (size_t) -2) + { + printable = 0; + while (i + m < argsize && arg[i + m]) + m++; + break; + } + else + { + if (! iswprint (w)) + printable = 0; + m += bytes; + } + } + while (! mbsinit (&mbstate)); + } + + if (1 < m || (backslash_escapes && ! printable)) + { + /* Output a multibyte sequence, or an escaped + unprintable unibyte character. */ + size_t ilim = i + m; + + for (;;) + { + if (backslash_escapes && ! printable) + { + STORE ('\\'); + STORE ('0' + (c >> 6)); + STORE ('0' + ((c >> 3) & 7)); + c = '0' + (c & 7); + } + if (ilim <= i + 1) + break; + STORE (c); + c = arg[++i]; + } + + goto store_c; + } + } + } + + if (! (backslash_escapes + && o->quote_these_too[c / INT_BITS] & (1 << (c % INT_BITS)))) + goto store_c; + + store_escape: + STORE ('\\'); + + store_c: + STORE (c); + } + + if (quote_string) + for (; *quote_string; quote_string++) + STORE (*quote_string); + + if (len < buffersize) + buffer[len] = '\0'; + return len; + + use_shell_always_quoting_style: + return quotearg_buffer_restyled (buffer, buffersize, arg, argsize, + shell_always_quoting_style, o); +} + +/* Place into buffer BUFFER (of size BUFFERSIZE) a quoted version of + argument ARG (of size ARGSIZE), using O to control quoting. + If O is null, use the default. + Terminate the output with a null character, and return the written + size of the output, not counting the terminating null. + If BUFFERSIZE is too small to store the output string, return the + value that would have been returned had BUFFERSIZE been large enough. + If ARGSIZE is -1, use the string length of the argument for ARGSIZE. */ +size_t +quotearg_buffer (char *buffer, size_t buffersize, + char const *arg, size_t argsize, + struct quoting_options const *o) +{ + struct quoting_options const *p = o ? o : &default_quoting_options; + return quotearg_buffer_restyled (buffer, buffersize, arg, argsize, + p->style, p); +} + +/* Use storage slot N to return a quoted version of the string ARG. + OPTIONS specifies the quoting options. + The returned value points to static storage that can be + reused by the next call to this function with the same value of N. + N must be nonnegative. N is deliberately declared with type "int" + to allow for future extensions (using negative values). */ +static char * +quotearg_n_options (int n, char const *arg, + struct quoting_options const *options) +{ + /* Preallocate a slot 0 buffer, so that the caller can always quote + one small component of a "memory exhausted" message in slot 0. */ + static char slot0[256]; + static unsigned int nslots = 1; + struct slotvec + { + size_t size; + char *val; + }; + static struct slotvec slotvec0 = {sizeof slot0, slot0}; + static struct slotvec *slotvec = &slotvec0; + + if (nslots <= n) + { + int n1 = n + 1; + size_t s = n1 * sizeof (struct slotvec); + if (! (0 < n1 && n1 == s / sizeof (struct slotvec))) + abort (); + if (slotvec == &slotvec0) + { + slotvec = (struct slotvec *) xmalloc (sizeof (struct slotvec)); + *slotvec = slotvec0; + } + slotvec = (struct slotvec *) xrealloc (slotvec, s); + memset (slotvec + nslots, 0, (n1 - nslots) * sizeof (struct slotvec)); + nslots = n; + } + + { + size_t size = slotvec[n].size; + char *val = slotvec[n].val; + size_t qsize = quotearg_buffer (val, size, arg, (size_t) -1, options); + + if (size <= qsize) + { + slotvec[n].size = size = qsize + 1; + slotvec[n].val = val = xrealloc (val == slot0 ? 0 : val, size); + quotearg_buffer (val, size, arg, (size_t) -1, options); + } + + return val; + } +} + +char * +quotearg_n (unsigned int n, char const *arg) +{ + return quotearg_n_options (n, arg, &default_quoting_options); +} + +char * +quotearg (char const *arg) +{ + return quotearg_n (0, arg); +} + +char * +quotearg_n_style (unsigned int n, enum quoting_style s, char const *arg) +{ + struct quoting_options o; + o.style = s; + memset (o.quote_these_too, 0, sizeof o.quote_these_too); + return quotearg_n_options (n, arg, &o); +} + +char * +quotearg_style (enum quoting_style s, char const *arg) +{ + return quotearg_n_style (0, s, arg); +} + +char * +quotearg_char (char const *arg, char ch) +{ + struct quoting_options options; + options = default_quoting_options; + set_char_quoting (&options, ch, 1); + return quotearg_n_options (0, arg, &options); +} + +char * +quotearg_colon (char const *arg) +{ + return quotearg_char (arg, ':'); +} diff --git a/lib/quotearg.h b/lib/quotearg.h new file mode 100644 index 0000000..17096d7 --- /dev/null +++ b/lib/quotearg.h @@ -0,0 +1,110 @@ +/* quotearg.h - quote arguments for output + Copyright (C) 1998, 1999, 2000 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Paul Eggert */ + +/* Basic quoting styles. */ +enum quoting_style + { + literal_quoting_style, /* --quoting-style=literal */ + shell_quoting_style, /* --quoting-style=shell */ + shell_always_quoting_style, /* --quoting-style=shell-always */ + c_quoting_style, /* --quoting-style=c */ + escape_quoting_style, /* --quoting-style=escape */ + locale_quoting_style, /* --quoting-style=locale */ + clocale_quoting_style /* --quoting-style=clocale */ + }; + +/* For now, --quoting-style=literal is the default, but this may change. */ +#ifndef DEFAULT_QUOTING_STYLE +# define DEFAULT_QUOTING_STYLE literal_quoting_style +#endif + +/* Names of quoting styles and their corresponding values. */ +extern char const *const quoting_style_args[]; +extern enum quoting_style const quoting_style_vals[]; + +struct quoting_options; + +#ifndef PARAMS +# if defined PROTOTYPES || defined __STDC__ +# define PARAMS(Args) Args +# else +# define PARAMS(Args) () +# endif +#endif + +/* The functions listed below set and use a hidden variable + that contains the default quoting style options. */ + +/* Allocate a new set of quoting options, with contents initially identical + to O if O is not null, or to the default if O is null. + It is the caller's responsibility to free the result. */ +struct quoting_options *clone_quoting_options + PARAMS ((struct quoting_options *o)); + +/* Get the value of O's quoting style. If O is null, use the default. */ +enum quoting_style get_quoting_style PARAMS ((struct quoting_options *o)); + +/* In O (or in the default if O is null), + set the value of the quoting style to S. */ +void set_quoting_style PARAMS ((struct quoting_options *o, + enum quoting_style s)); + +/* In O (or in the default if O is null), + set the value of the quoting options for character C to I. + Return the old value. Currently, the only values defined for I are + 0 (the default) and 1 (which means to quote the character even if + it would not otherwise be quoted). */ +int set_char_quoting PARAMS ((struct quoting_options *o, char c, int i)); + +/* Place into buffer BUFFER (of size BUFFERSIZE) a quoted version of + argument ARG (of size ARGSIZE), using O to control quoting. + If O is null, use the default. + Terminate the output with a null character, and return the written + size of the output, not counting the terminating null. + If BUFFERSIZE is too small to store the output string, return the + value that would have been returned had BUFFERSIZE been large enough. + If ARGSIZE is -1, use the string length of the argument for ARGSIZE. */ +size_t quotearg_buffer PARAMS ((char *buffer, size_t buffersize, + char const *arg, size_t argsize, + struct quoting_options const *o)); + +/* Use storage slot N to return a quoted version of the string ARG. + Use the default quoting options. + The returned value points to static storage that can be + reused by the next call to this function with the same value of N. + N must be nonnegative. */ +char *quotearg_n PARAMS ((unsigned int n, char const *arg)); + +/* Equivalent to quotearg_n (0, ARG). */ +char *quotearg PARAMS ((char const *arg)); + +/* Use style S and storage slot N to return a quoted version of the string ARG. + This is like quotearg_n (N, ARG), except that it uses S with no other + options to specify the quoting method. */ +char *quotearg_n_style PARAMS ((unsigned int n, enum quoting_style s, + char const *arg)); + +/* Equivalent to quotearg_n_style (0, S, ARG). */ +char *quotearg_style PARAMS ((enum quoting_style s, char const *arg)); + +/* Like quotearg (ARG), except also quote any instances of CH. */ +char *quotearg_char PARAMS ((char const *arg, char ch)); + +/* Equivalent to quotearg_char (ARG, ':'). */ +char *quotearg_colon PARAMS ((char const *arg)); diff --git a/lib/realloc.c b/lib/realloc.c new file mode 100644 index 0000000..535cffe --- /dev/null +++ b/lib/realloc.c @@ -0,0 +1,32 @@ +/* rpl_realloc.c -- a replacement for broken realloc implementations + Copyright (C) 2001 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include + +void * +rpl_realloc(void *ptr, size_t size) +{ + if (!ptr) + return malloc(size); + if (!size) + { + if (ptr) + free(ptr); + return malloc(size); + } + return realloc(ptr, size); +} diff --git a/lib/regex.c b/lib/regex.c new file mode 100644 index 0000000..3803142 --- /dev/null +++ b/lib/regex.c @@ -0,0 +1,7899 @@ +/* Extended regular expression matching and search library, + version 0.12. + (Implements POSIX draft P1003.2/D11.2, except for some of the + internationalization features.) + Copyright (C) 1993-1999, 2000, 2001 Free Software Foundation, Inc. + + The GNU 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 GNU 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., + 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* AIX requires this to be the first thing in the file. */ +#if defined _AIX && !defined REGEX_MALLOC + #pragma alloca +#endif + +#undef _GNU_SOURCE +#define _GNU_SOURCE + +#ifdef HAVE_CONFIG_H +# include +#endif + +#ifndef PARAMS +# if defined __GNUC__ || (defined __STDC__ && __STDC__) +# define PARAMS(args) args +# else +# define PARAMS(args) () +# endif /* GCC. */ +#endif /* Not PARAMS. */ + +#if defined STDC_HEADERS && !defined emacs +# include +#else +/* We need this for `regex.h', and perhaps for the Emacs include files. */ +# include +#endif + +#define WIDE_CHAR_SUPPORT (HAVE_WCTYPE_H && HAVE_WCHAR_H && HAVE_BTOWC) + +/* For platform which support the ISO C amendement 1 functionality we + support user defined character classes. */ +#if defined _LIBC || WIDE_CHAR_SUPPORT +/* Solaris 2.5 has a bug: must be included before . */ +# include +# include +#endif + +/* This is for multi byte string support. */ +#ifdef MBS_SUPPORT +# define CHAR_TYPE wchar_t +# define US_CHAR_TYPE wchar_t/* unsigned character type */ +# define CHAR_T_SIGN (1 << (sizeof(CHAR_TYPE) * 8 - 1)) +# if defined _AIX +# define WCHAR_T_NEED_SIGNEXTEND 1 +# endif /* _AIX */ +# define COMPILED_BUFFER_VAR wc_buffer +# define OFFSET_ADDRESS_SIZE 1 /* the size which STORE_NUMBER macro use */ +# define CHAR_CLASS_SIZE ((__alignof__(wctype_t)+sizeof(wctype_t))/sizeof(CHAR_TYPE)+1) +# define PUT_CHAR(c) \ + do { \ + if (MB_CUR_MAX == 1) \ + putchar (c); \ + else \ + printf ("%C", (wint_t) c); /* Should we use wide stream?? */ \ + } while (0) +# define TRUE 1 +# define FALSE 0 +#else +# define CHAR_TYPE char +# define US_CHAR_TYPE unsigned char /* unsigned character type */ +# define COMPILED_BUFFER_VAR bufp->buffer +# define OFFSET_ADDRESS_SIZE 2 +# define PUT_CHAR(c) putchar (c) +#endif /* MBS_SUPPORT */ + +#ifdef _LIBC +/* We have to keep the namespace clean. */ +# define regfree(preg) __regfree (preg) +# define regexec(pr, st, nm, pm, ef) __regexec (pr, st, nm, pm, ef) +# define regcomp(preg, pattern, cflags) __regcomp (preg, pattern, cflags) +# define regerror(errcode, preg, errbuf, errbuf_size) \ + __regerror(errcode, preg, errbuf, errbuf_size) +# define re_set_registers(bu, re, nu, st, en) \ + __re_set_registers (bu, re, nu, st, en) +# define re_match_2(bufp, string1, size1, string2, size2, pos, regs, stop) \ + __re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) +# define re_match(bufp, string, size, pos, regs) \ + __re_match (bufp, string, size, pos, regs) +# define re_search(bufp, string, size, startpos, range, regs) \ + __re_search (bufp, string, size, startpos, range, regs) +# define re_compile_pattern(pattern, length, bufp) \ + __re_compile_pattern (pattern, length, bufp) +# define re_set_syntax(syntax) __re_set_syntax (syntax) +# define re_search_2(bufp, st1, s1, st2, s2, startpos, range, regs, stop) \ + __re_search_2 (bufp, st1, s1, st2, s2, startpos, range, regs, stop) +# define re_compile_fastmap(bufp) __re_compile_fastmap (bufp) + +# define btowc __btowc + +/* We are also using some library internals. */ +# include +# include +# include +# include +#endif + +/* This is for other GNU distributions with internationalized messages. */ +#if HAVE_LIBINTL_H || defined _LIBC +# include +# ifdef _LIBC +# undef gettext +# define gettext(msgid) __dcgettext ("libc", msgid, LC_MESSAGES) +# endif +#else +# define gettext(msgid) (msgid) +#endif + +#ifndef gettext_noop +/* This define is so xgettext can find the internationalizable + strings. */ +# define gettext_noop(String) String +#endif + +/* The `emacs' switch turns on certain matching commands + that make sense only in Emacs. */ +#ifdef emacs + +# include "lisp.h" +# include "buffer.h" +# include "syntax.h" + +#else /* not emacs */ + +/* If we are not linking with Emacs proper, + we can't use the relocating allocator + even if config.h says that we can. */ +# undef REL_ALLOC + +# if defined STDC_HEADERS || defined _LIBC +# include +# else +char *malloc (); +char *realloc (); +# endif + +/* When used in Emacs's lib-src, we need to get bzero and bcopy somehow. + If nothing else has been done, use the method below. */ +# ifdef INHIBIT_STRING_HEADER +# if !(defined HAVE_BZERO && defined HAVE_BCOPY) +# if !defined bzero && !defined bcopy +# undef INHIBIT_STRING_HEADER +# endif +# endif +# endif + +/* This is the normal way of making sure we have a bcopy and a bzero. + This is used in most programs--a few other programs avoid this + by defining INHIBIT_STRING_HEADER. */ +# ifndef INHIBIT_STRING_HEADER +# if defined HAVE_STRING_H || defined STDC_HEADERS || defined _LIBC +# include +# ifndef bzero +# ifndef _LIBC +# define bzero(s, n) (memset (s, '\0', n), (s)) +# else +# define bzero(s, n) __bzero (s, n) +# endif +# endif +# else +# include +# ifndef memcmp +# define memcmp(s1, s2, n) bcmp (s1, s2, n) +# endif +# ifndef memcpy +# define memcpy(d, s, n) (bcopy (s, d, n), (d)) +# endif +# endif +# endif + +/* Define the syntax stuff for \<, \>, etc. */ + +/* This must be nonzero for the wordchar and notwordchar pattern + commands in re_match_2. */ +# ifndef Sword +# define Sword 1 +# endif + +# ifdef SWITCH_ENUM_BUG +# define SWITCH_ENUM_CAST(x) ((int)(x)) +# else +# define SWITCH_ENUM_CAST(x) (x) +# endif + +#endif /* not emacs */ + +#if defined _LIBC || HAVE_LIMITS_H +# include +#endif + +#ifndef MB_LEN_MAX +# define MB_LEN_MAX 1 +#endif + +/* Get the interface, including the syntax bits. */ +#include + +/* isalpha etc. are used for the character classes. */ +#include + +/* Jim Meyering writes: + + "... Some ctype macros are valid only for character codes that + isascii says are ASCII (SGI's IRIX-4.0.5 is one such system --when + using /bin/cc or gcc but without giving an ansi option). So, all + ctype uses should be through macros like ISPRINT... If + STDC_HEADERS is defined, then autoconf has verified that the ctype + macros don't need to be guarded with references to isascii. ... + Defining isascii to 1 should let any compiler worth its salt + eliminate the && through constant folding." + Solaris defines some of these symbols so we must undefine them first. */ + +#undef ISASCII +#if defined STDC_HEADERS || (!defined isascii && !defined HAVE_ISASCII) +# define ISASCII(c) 1 +#else +# define ISASCII(c) isascii(c) +#endif + +#ifdef isblank +# define ISBLANK(c) (ISASCII (c) && isblank (c)) +#else +# define ISBLANK(c) ((c) == ' ' || (c) == '\t') +#endif +#ifdef isgraph +# define ISGRAPH(c) (ISASCII (c) && isgraph (c)) +#else +# define ISGRAPH(c) (ISASCII (c) && isprint (c) && !isspace (c)) +#endif + +#undef ISPRINT +#define ISPRINT(c) (ISASCII (c) && isprint (c)) +#define ISDIGIT(c) (ISASCII (c) && isdigit (c)) +#define ISALNUM(c) (ISASCII (c) && isalnum (c)) +#define ISALPHA(c) (ISASCII (c) && isalpha (c)) +#define ISCNTRL(c) (ISASCII (c) && iscntrl (c)) +#define ISLOWER(c) (ISASCII (c) && islower (c)) +#define ISPUNCT(c) (ISASCII (c) && ispunct (c)) +#define ISSPACE(c) (ISASCII (c) && isspace (c)) +#define ISUPPER(c) (ISASCII (c) && isupper (c)) +#define ISXDIGIT(c) (ISASCII (c) && isxdigit (c)) + +#ifdef _tolower +# define TOLOWER(c) _tolower(c) +#else +# define TOLOWER(c) tolower(c) +#endif + +#ifndef NULL +# define NULL (void *)0 +#endif + +/* We remove any previous definition of `SIGN_EXTEND_CHAR', + since ours (we hope) works properly with all combinations of + machines, compilers, `char' and `unsigned char' argument types. + (Per Bothner suggested the basic approach.) */ +#undef SIGN_EXTEND_CHAR +#if __STDC__ +# define SIGN_EXTEND_CHAR(c) ((signed char) (c)) +#else /* not __STDC__ */ +/* As in Harbison and Steele. */ +# define SIGN_EXTEND_CHAR(c) ((((unsigned char) (c)) ^ 128) - 128) +#endif + +#ifndef emacs +/* How many characters in the character set. */ +# define CHAR_SET_SIZE 256 + +# ifdef SYNTAX_TABLE + +extern char *re_syntax_table; + +# else /* not SYNTAX_TABLE */ + +static char re_syntax_table[CHAR_SET_SIZE]; + +static void init_syntax_once PARAMS ((void)); + +static void +init_syntax_once () +{ + register int c; + static int done = 0; + + if (done) + return; + bzero (re_syntax_table, sizeof re_syntax_table); + + for (c = 0; c < CHAR_SET_SIZE; ++c) + if (ISALNUM (c)) + re_syntax_table[c] = Sword; + + re_syntax_table['_'] = Sword; + + done = 1; +} + +# endif /* not SYNTAX_TABLE */ + +# define SYNTAX(c) re_syntax_table[(unsigned char) (c)] + +#endif /* emacs */ + +/* Should we use malloc or alloca? If REGEX_MALLOC is not defined, we + use `alloca' instead of `malloc'. This is because using malloc in + re_search* or re_match* could cause memory leaks when C-g is used in + Emacs; also, malloc is slower and causes storage fragmentation. On + the other hand, malloc is more portable, and easier to debug. + + Because we sometimes use alloca, some routines have to be macros, + not functions -- `alloca'-allocated space disappears at the end of the + function it is called in. */ + +#ifdef REGEX_MALLOC + +# define REGEX_ALLOCATE malloc +# define REGEX_REALLOCATE(source, osize, nsize) realloc (source, nsize) +# define REGEX_FREE free + +#else /* not REGEX_MALLOC */ + +/* Emacs already defines alloca, sometimes. */ +# ifndef alloca + +/* Make alloca work the best possible way. */ +# ifdef __GNUC__ +# define alloca __builtin_alloca +# else /* not __GNUC__ */ +# if HAVE_ALLOCA_H +# include +# endif /* HAVE_ALLOCA_H */ +# endif /* not __GNUC__ */ + +# endif /* not alloca */ + +# define REGEX_ALLOCATE alloca + +/* Assumes a `char *destination' variable. */ +# define REGEX_REALLOCATE(source, osize, nsize) \ + (destination = (char *) alloca (nsize), \ + memcpy (destination, source, osize)) + +/* No need to do anything to free, after alloca. */ +# define REGEX_FREE(arg) ((void)0) /* Do nothing! But inhibit gcc warning. */ + +#endif /* not REGEX_MALLOC */ + +/* Define how to allocate the failure stack. */ + +#if defined REL_ALLOC && defined REGEX_MALLOC + +# define REGEX_ALLOCATE_STACK(size) \ + r_alloc (&failure_stack_ptr, (size)) +# define REGEX_REALLOCATE_STACK(source, osize, nsize) \ + r_re_alloc (&failure_stack_ptr, (nsize)) +# define REGEX_FREE_STACK(ptr) \ + r_alloc_free (&failure_stack_ptr) + +#else /* not using relocating allocator */ + +# ifdef REGEX_MALLOC + +# define REGEX_ALLOCATE_STACK malloc +# define REGEX_REALLOCATE_STACK(source, osize, nsize) realloc (source, nsize) +# define REGEX_FREE_STACK free + +# else /* not REGEX_MALLOC */ + +# define REGEX_ALLOCATE_STACK alloca + +# define REGEX_REALLOCATE_STACK(source, osize, nsize) \ + REGEX_REALLOCATE (source, osize, nsize) +/* No need to explicitly free anything. */ +# define REGEX_FREE_STACK(arg) + +# endif /* not REGEX_MALLOC */ +#endif /* not using relocating allocator */ + + +/* True if `size1' is non-NULL and PTR is pointing anywhere inside + `string1' or just past its end. This works if PTR is NULL, which is + a good thing. */ +#define FIRST_STRING_P(ptr) \ + (size1 && string1 <= (ptr) && (ptr) <= string1 + size1) + +/* (Re)Allocate N items of type T using malloc, or fail. */ +#define TALLOC(n, t) ((t *) malloc ((n) * sizeof (t))) +#define RETALLOC(addr, n, t) ((addr) = (t *) realloc (addr, (n) * sizeof (t))) +#define RETALLOC_IF(addr, n, t) \ + if (addr) RETALLOC((addr), (n), t); else (addr) = TALLOC ((n), t) +#define REGEX_TALLOC(n, t) ((t *) REGEX_ALLOCATE ((n) * sizeof (t))) + +#define BYTEWIDTH 8 /* In bits. */ + +#define STREQ(s1, s2) ((strcmp (s1, s2) == 0)) + +#undef MAX +#undef MIN +#define MAX(a, b) ((a) > (b) ? (a) : (b)) +#define MIN(a, b) ((a) < (b) ? (a) : (b)) + +typedef char boolean; +#define false 0 +#define true 1 + +static int re_match_2_internal PARAMS ((struct re_pattern_buffer *bufp, + const char *string1, int size1, + const char *string2, int size2, + int pos, + struct re_registers *regs, + int stop)); + +/* These are the command codes that appear in compiled regular + expressions. Some opcodes are followed by argument bytes. A + command code can specify any interpretation whatsoever for its + arguments. Zero bytes may appear in the compiled regular expression. */ + +typedef enum +{ + no_op = 0, + + /* Succeed right away--no more backtracking. */ + succeed, + + /* Followed by one byte giving n, then by n literal bytes. */ + exactn, + +#ifdef MBS_SUPPORT + /* Same as exactn, but contains binary data. */ + exactn_bin, +#endif + + /* Matches any (more or less) character. */ + anychar, + + /* Matches any one char belonging to specified set. First + following byte is number of bitmap bytes. Then come bytes + for a bitmap saying which chars are in. Bits in each byte + are ordered low-bit-first. A character is in the set if its + bit is 1. A character too large to have a bit in the map is + automatically not in the set. */ + /* ifdef MBS_SUPPORT, following element is length of character + classes, length of collating symbols, length of equivalence + classes, length of character ranges, and length of characters. + Next, character class element, collating symbols elements, + equivalence class elements, range elements, and character + elements follow. + See regex_compile function. */ + charset, + + /* Same parameters as charset, but match any character that is + not one of those specified. */ + charset_not, + + /* Start remembering the text that is matched, for storing in a + register. Followed by one byte with the register number, in + the range 0 to one less than the pattern buffer's re_nsub + field. Then followed by one byte with the number of groups + inner to this one. (This last has to be part of the + start_memory only because we need it in the on_failure_jump + of re_match_2.) */ + start_memory, + + /* Stop remembering the text that is matched and store it in a + memory register. Followed by one byte with the register + number, in the range 0 to one less than `re_nsub' in the + pattern buffer, and one byte with the number of inner groups, + just like `start_memory'. (We need the number of inner + groups here because we don't have any easy way of finding the + corresponding start_memory when we're at a stop_memory.) */ + stop_memory, + + /* Match a duplicate of something remembered. Followed by one + byte containing the register number. */ + duplicate, + + /* Fail unless at beginning of line. */ + begline, + + /* Fail unless at end of line. */ + endline, + + /* Succeeds if at beginning of buffer (if emacs) or at beginning + of string to be matched (if not). */ + begbuf, + + /* Analogously, for end of buffer/string. */ + endbuf, + + /* Followed by two byte relative address to which to jump. */ + jump, + + /* Same as jump, but marks the end of an alternative. */ + jump_past_alt, + + /* Followed by two-byte relative address of place to resume at + in case of failure. */ + /* ifdef MBS_SUPPORT, the size of address is 1. */ + on_failure_jump, + + /* Like on_failure_jump, but pushes a placeholder instead of the + current string position when executed. */ + on_failure_keep_string_jump, + + /* Throw away latest failure point and then jump to following + two-byte relative address. */ + /* ifdef MBS_SUPPORT, the size of address is 1. */ + pop_failure_jump, + + /* Change to pop_failure_jump if know won't have to backtrack to + match; otherwise change to jump. This is used to jump + back to the beginning of a repeat. If what follows this jump + clearly won't match what the repeat does, such that we can be + sure that there is no use backtracking out of repetitions + already matched, then we change it to a pop_failure_jump. + Followed by two-byte address. */ + /* ifdef MBS_SUPPORT, the size of address is 1. */ + maybe_pop_jump, + + /* Jump to following two-byte address, and push a dummy failure + point. This failure point will be thrown away if an attempt + is made to use it for a failure. A `+' construct makes this + before the first repeat. Also used as an intermediary kind + of jump when compiling an alternative. */ + /* ifdef MBS_SUPPORT, the size of address is 1. */ + dummy_failure_jump, + + /* Push a dummy failure point and continue. Used at the end of + alternatives. */ + push_dummy_failure, + + /* Followed by two-byte relative address and two-byte number n. + After matching N times, jump to the address upon failure. */ + /* ifdef MBS_SUPPORT, the size of address is 1. */ + succeed_n, + + /* Followed by two-byte relative address, and two-byte number n. + Jump to the address N times, then fail. */ + /* ifdef MBS_SUPPORT, the size of address is 1. */ + jump_n, + + /* Set the following two-byte relative address to the + subsequent two-byte number. The address *includes* the two + bytes of number. */ + /* ifdef MBS_SUPPORT, the size of address is 1. */ + set_number_at, + + wordchar, /* Matches any word-constituent character. */ + notwordchar, /* Matches any char that is not a word-constituent. */ + + wordbeg, /* Succeeds if at word beginning. */ + wordend, /* Succeeds if at word end. */ + + wordbound, /* Succeeds if at a word boundary. */ + notwordbound /* Succeeds if not at a word boundary. */ + +#ifdef emacs + ,before_dot, /* Succeeds if before point. */ + at_dot, /* Succeeds if at point. */ + after_dot, /* Succeeds if after point. */ + + /* Matches any character whose syntax is specified. Followed by + a byte which contains a syntax code, e.g., Sword. */ + syntaxspec, + + /* Matches any character whose syntax is not that specified. */ + notsyntaxspec +#endif /* emacs */ +} re_opcode_t; + +/* Common operations on the compiled pattern. */ + +/* Store NUMBER in two contiguous bytes starting at DESTINATION. */ +/* ifdef MBS_SUPPORT, we store NUMBER in 1 element. */ + +#ifdef MBS_SUPPORT +# define STORE_NUMBER(destination, number) \ + do { \ + *(destination) = (US_CHAR_TYPE)(number); \ + } while (0) +#else +# define STORE_NUMBER(destination, number) \ + do { \ + (destination)[0] = (number) & 0377; \ + (destination)[1] = (number) >> 8; \ + } while (0) +#endif /* MBS_SUPPORT */ + +/* Same as STORE_NUMBER, except increment DESTINATION to + the byte after where the number is stored. Therefore, DESTINATION + must be an lvalue. */ +/* ifdef MBS_SUPPORT, we store NUMBER in 1 element. */ + +#define STORE_NUMBER_AND_INCR(destination, number) \ + do { \ + STORE_NUMBER (destination, number); \ + (destination) += OFFSET_ADDRESS_SIZE; \ + } while (0) + +/* Put into DESTINATION a number stored in two contiguous bytes starting + at SOURCE. */ +/* ifdef MBS_SUPPORT, we store NUMBER in 1 element. */ + +#ifdef MBS_SUPPORT +# ifdef WCHAR_T_NEED_SIGNEXTEND +# define EXTRACT_NUMBER(destination, source) \ + (destination) = (*(source) ^ CHAR_T_SIGN) - CHAR_T_SIGN; +# else +# define EXTRACT_NUMBER(destination, source) \ + (destination) = *(source) +# endif /* WCHAR_T_NEED_SIGNEXTEND */ +#else +# define EXTRACT_NUMBER(destination, source) \ + do { \ + (destination) = *(source) & 0377; \ + (destination) += SIGN_EXTEND_CHAR (*((source) + 1)) << 8; \ + } while (0) +#endif + +#ifdef DEBUG +static void extract_number _RE_ARGS ((int *dest, US_CHAR_TYPE *source)); +static void +extract_number (dest, source) + int *dest; + US_CHAR_TYPE *source; +{ +#ifdef MBS_SUPPORT +# ifdef WCHAR_T_NEED_SIGNEXTEND + *dest = (*source ^ CHAR_T_SIGN) - CHAR_T_SIGN; +# else + *dest = *source; +# endif /* WCHAR_T_NEED_SIGNEXTEND */ +#else + int temp = SIGN_EXTEND_CHAR (*(source + 1)); + *dest = *source & 0377; + *dest += temp << 8; +#endif +} + +# ifndef EXTRACT_MACROS /* To debug the macros. */ +# undef EXTRACT_NUMBER +# define EXTRACT_NUMBER(dest, src) extract_number (&dest, src) +# endif /* not EXTRACT_MACROS */ + +#endif /* DEBUG */ + +/* Same as EXTRACT_NUMBER, except increment SOURCE to after the number. + SOURCE must be an lvalue. */ + +#define EXTRACT_NUMBER_AND_INCR(destination, source) \ + do { \ + EXTRACT_NUMBER (destination, source); \ + (source) += OFFSET_ADDRESS_SIZE; \ + } while (0) + +#ifdef DEBUG +static void extract_number_and_incr _RE_ARGS ((int *destination, + US_CHAR_TYPE **source)); +static void +extract_number_and_incr (destination, source) + int *destination; + US_CHAR_TYPE **source; +{ + extract_number (destination, *source); + *source += OFFSET_ADDRESS_SIZE; +} + +# ifndef EXTRACT_MACROS +# undef EXTRACT_NUMBER_AND_INCR +# define EXTRACT_NUMBER_AND_INCR(dest, src) \ + extract_number_and_incr (&dest, &src) +# endif /* not EXTRACT_MACROS */ + +#endif /* DEBUG */ + +/* If DEBUG is defined, Regex prints many voluminous messages about what + it is doing (if the variable `debug' is nonzero). If linked with the + main program in `iregex.c', you can enter patterns and strings + interactively. And if linked with the main program in `main.c' and + the other test files, you can run the already-written tests. */ + +#ifdef DEBUG + +/* We use standard I/O for debugging. */ +# include + +/* It is useful to test things that ``must'' be true when debugging. */ +# include + +static int debug; + +# define DEBUG_STATEMENT(e) e +# define DEBUG_PRINT1(x) if (debug) printf (x) +# define DEBUG_PRINT2(x1, x2) if (debug) printf (x1, x2) +# define DEBUG_PRINT3(x1, x2, x3) if (debug) printf (x1, x2, x3) +# define DEBUG_PRINT4(x1, x2, x3, x4) if (debug) printf (x1, x2, x3, x4) +# define DEBUG_PRINT_COMPILED_PATTERN(p, s, e) \ + if (debug) print_partial_compiled_pattern (s, e) +# define DEBUG_PRINT_DOUBLE_STRING(w, s1, sz1, s2, sz2) \ + if (debug) print_double_string (w, s1, sz1, s2, sz2) + + +/* Print the fastmap in human-readable form. */ + +void +print_fastmap (fastmap) + char *fastmap; +{ + unsigned was_a_range = 0; + unsigned i = 0; + + while (i < (1 << BYTEWIDTH)) + { + if (fastmap[i++]) + { + was_a_range = 0; + putchar (i - 1); + while (i < (1 << BYTEWIDTH) && fastmap[i]) + { + was_a_range = 1; + i++; + } + if (was_a_range) + { + printf ("-"); + putchar (i - 1); + } + } + } + putchar ('\n'); +} + + +/* Print a compiled pattern string in human-readable form, starting at + the START pointer into it and ending just before the pointer END. */ + +void +print_partial_compiled_pattern (start, end) + US_CHAR_TYPE *start; + US_CHAR_TYPE *end; +{ + int mcnt, mcnt2; + US_CHAR_TYPE *p1; + US_CHAR_TYPE *p = start; + US_CHAR_TYPE *pend = end; + + if (start == NULL) + { + printf ("(null)\n"); + return; + } + + /* Loop over pattern commands. */ + while (p < pend) + { +#ifdef _LIBC + printf ("%td:\t", p - start); +#else + printf ("%ld:\t", (long int) (p - start)); +#endif + + switch ((re_opcode_t) *p++) + { + case no_op: + printf ("/no_op"); + break; + + case exactn: + mcnt = *p++; + printf ("/exactn/%d", mcnt); + do + { + putchar ('/'); + PUT_CHAR (*p++); + } + while (--mcnt); + break; + +#ifdef MBS_SUPPORT + case exactn_bin: + mcnt = *p++; + printf ("/exactn_bin/%d", mcnt); + do + { + printf("/%lx", (long int) *p++); + } + while (--mcnt); + break; +#endif /* MBS_SUPPORT */ + + case start_memory: + mcnt = *p++; + printf ("/start_memory/%d/%ld", mcnt, (long int) *p++); + break; + + case stop_memory: + mcnt = *p++; + printf ("/stop_memory/%d/%ld", mcnt, (long int) *p++); + break; + + case duplicate: + printf ("/duplicate/%ld", (long int) *p++); + break; + + case anychar: + printf ("/anychar"); + break; + + case charset: + case charset_not: + { +#ifdef MBS_SUPPORT + int i, length; + wchar_t *workp = p; + printf ("/charset [%s", + (re_opcode_t) *(workp - 1) == charset_not ? "^" : ""); + p += 5; + length = *workp++; /* the length of char_classes */ + for (i=0 ; ibuffer; + + print_partial_compiled_pattern (buffer, buffer + + bufp->used / sizeof(US_CHAR_TYPE)); + printf ("%ld bytes used/%ld bytes allocated.\n", + bufp->used, bufp->allocated); + + if (bufp->fastmap_accurate && bufp->fastmap) + { + printf ("fastmap: "); + print_fastmap (bufp->fastmap); + } + +#ifdef _LIBC + printf ("re_nsub: %Zd\t", bufp->re_nsub); +#else + printf ("re_nsub: %ld\t", (long int) bufp->re_nsub); +#endif + printf ("regs_alloc: %d\t", bufp->regs_allocated); + printf ("can_be_null: %d\t", bufp->can_be_null); + printf ("newline_anchor: %d\n", bufp->newline_anchor); + printf ("no_sub: %d\t", bufp->no_sub); + printf ("not_bol: %d\t", bufp->not_bol); + printf ("not_eol: %d\t", bufp->not_eol); + printf ("syntax: %lx\n", bufp->syntax); + /* Perhaps we should print the translate table? */ +} + + +void +print_double_string (where, string1, size1, string2, size2) + const CHAR_TYPE *where; + const CHAR_TYPE *string1; + const CHAR_TYPE *string2; + int size1; + int size2; +{ + int this_char; + + if (where == NULL) + printf ("(null)"); + else + { + if (FIRST_STRING_P (where)) + { + for (this_char = where - string1; this_char < size1; this_char++) + PUT_CHAR (string1[this_char]); + + where = string2; + } + + for (this_char = where - string2; this_char < size2; this_char++) + PUT_CHAR (string2[this_char]); + } +} + +void +printchar (c) + int c; +{ + putc (c, stderr); +} + +#else /* not DEBUG */ + +# undef assert +# define assert(e) + +# define DEBUG_STATEMENT(e) +# define DEBUG_PRINT1(x) +# define DEBUG_PRINT2(x1, x2) +# define DEBUG_PRINT3(x1, x2, x3) +# define DEBUG_PRINT4(x1, x2, x3, x4) +# define DEBUG_PRINT_COMPILED_PATTERN(p, s, e) +# define DEBUG_PRINT_DOUBLE_STRING(w, s1, sz1, s2, sz2) + +#endif /* not DEBUG */ + +#ifdef MBS_SUPPORT +/* This convert a multibyte string to a wide character string. + And write their correspondances to offset_buffer(see below) + and write whether each wchar_t is binary data to is_binary. + This assume invalid multibyte sequences as binary data. + We assume offset_buffer and is_binary is already allocated + enough space. */ + +static size_t convert_mbs_to_wcs (CHAR_TYPE *dest, const unsigned char* src, + size_t len, int *offset_buffer, + char *is_binary); +static size_t +convert_mbs_to_wcs (dest, src, len, offset_buffer, is_binary) + CHAR_TYPE *dest; + const unsigned char* src; + size_t len; /* the length of multibyte string. */ + + /* It hold correspondances between src(char string) and + dest(wchar_t string) for optimization. + e.g. src = "xxxyzz" + dest = {'X', 'Y', 'Z'} + (each "xxx", "y" and "zz" represent one multibyte character + corresponding to 'X', 'Y' and 'Z'.) + offset_buffer = {0, 0+3("xxx"), 0+3+1("y"), 0+3+1+2("zz")} + = {0, 3, 4, 6} + */ + int *offset_buffer; + char *is_binary; +{ + wchar_t *pdest = dest; + const unsigned char *psrc = src; + size_t wc_count = 0; + + if (MB_CUR_MAX == 1) + { /* We don't need conversion. */ + for ( ; wc_count < len ; ++wc_count) + { + *pdest++ = *psrc++; + is_binary[wc_count] = FALSE; + offset_buffer[wc_count] = wc_count; + } + offset_buffer[wc_count] = wc_count; + } + else + { + /* We need conversion. */ + mbstate_t mbs; + int consumed; + size_t mb_remain = len; + size_t mb_count = 0; + + /* Initialize the conversion state. */ + memset (&mbs, 0, sizeof (mbstate_t)); + + offset_buffer[0] = 0; + for( ; mb_remain > 0 ; ++wc_count, ++pdest, mb_remain -= consumed, + psrc += consumed) + { + consumed = mbrtowc (pdest, psrc, mb_remain, &mbs); + + if (consumed <= 0) + /* failed to convert. maybe src contains binary data. + So we consume 1 byte manualy. */ + { + *pdest = *psrc; + consumed = 1; + is_binary[wc_count] = TRUE; + } + else + is_binary[wc_count] = FALSE; + /* In sjis encoding, we use yen sign as escape character in + place of reverse solidus. So we convert 0x5c(yen sign in + sjis) to not 0xa5(yen sign in UCS2) but 0x5c(reverse + solidus in UCS2). */ + if (consumed == 1 && (int) *psrc == 0x5c && (int) *pdest == 0xa5) + *pdest = (wchar_t) *psrc; + + offset_buffer[wc_count + 1] = mb_count += consumed; + } + } + + return wc_count; +} + +#endif /* MBS_SUPPORT */ + +/* Set by `re_set_syntax' to the current regexp syntax to recognize. Can + also be assigned to arbitrarily: each pattern buffer stores its own + syntax, so it can be changed between regex compilations. */ +/* This has no initializer because initialized variables in Emacs + become read-only after dumping. */ +reg_syntax_t re_syntax_options; + + +/* Specify the precise syntax of regexps for compilation. This provides + for compatibility for various utilities which historically have + different, incompatible syntaxes. + + The argument SYNTAX is a bit mask comprised of the various bits + defined in regex.h. We return the old syntax. */ + +reg_syntax_t +re_set_syntax (syntax) + reg_syntax_t syntax; +{ + reg_syntax_t ret = re_syntax_options; + + re_syntax_options = syntax; +#ifdef DEBUG + if (syntax & RE_DEBUG) + debug = 1; + else if (debug) /* was on but now is not */ + debug = 0; +#endif /* DEBUG */ + return ret; +} +#ifdef _LIBC +weak_alias (__re_set_syntax, re_set_syntax) +#endif + +/* This table gives an error message for each of the error codes listed + in regex.h. Obviously the order here has to be same as there. + POSIX doesn't require that we do anything for REG_NOERROR, + but why not be nice? */ + +static const char re_error_msgid[] = + { +#define REG_NOERROR_IDX 0 + gettext_noop ("Success") /* REG_NOERROR */ + "\0" +#define REG_NOMATCH_IDX (REG_NOERROR_IDX + sizeof "Success") + gettext_noop ("No match") /* REG_NOMATCH */ + "\0" +#define REG_BADPAT_IDX (REG_NOMATCH_IDX + sizeof "No match") + gettext_noop ("Invalid regular expression") /* REG_BADPAT */ + "\0" +#define REG_ECOLLATE_IDX (REG_BADPAT_IDX + sizeof "Invalid regular expression") + gettext_noop ("Invalid collation character") /* REG_ECOLLATE */ + "\0" +#define REG_ECTYPE_IDX (REG_ECOLLATE_IDX + sizeof "Invalid collation character") + gettext_noop ("Invalid character class name") /* REG_ECTYPE */ + "\0" +#define REG_EESCAPE_IDX (REG_ECTYPE_IDX + sizeof "Invalid character class name") + gettext_noop ("Trailing backslash") /* REG_EESCAPE */ + "\0" +#define REG_ESUBREG_IDX (REG_EESCAPE_IDX + sizeof "Trailing backslash") + gettext_noop ("Invalid back reference") /* REG_ESUBREG */ + "\0" +#define REG_EBRACK_IDX (REG_ESUBREG_IDX + sizeof "Invalid back reference") + gettext_noop ("Unmatched [ or [^") /* REG_EBRACK */ + "\0" +#define REG_EPAREN_IDX (REG_EBRACK_IDX + sizeof "Unmatched [ or [^") + gettext_noop ("Unmatched ( or \\(") /* REG_EPAREN */ + "\0" +#define REG_EBRACE_IDX (REG_EPAREN_IDX + sizeof "Unmatched ( or \\(") + gettext_noop ("Unmatched \\{") /* REG_EBRACE */ + "\0" +#define REG_BADBR_IDX (REG_EBRACE_IDX + sizeof "Unmatched \\{") + gettext_noop ("Invalid content of \\{\\}") /* REG_BADBR */ + "\0" +#define REG_ERANGE_IDX (REG_BADBR_IDX + sizeof "Invalid content of \\{\\}") + gettext_noop ("Invalid range end") /* REG_ERANGE */ + "\0" +#define REG_ESPACE_IDX (REG_ERANGE_IDX + sizeof "Invalid range end") + gettext_noop ("Memory exhausted") /* REG_ESPACE */ + "\0" +#define REG_BADRPT_IDX (REG_ESPACE_IDX + sizeof "Memory exhausted") + gettext_noop ("Invalid preceding regular expression") /* REG_BADRPT */ + "\0" +#define REG_EEND_IDX (REG_BADRPT_IDX + sizeof "Invalid preceding regular expression") + gettext_noop ("Premature end of regular expression") /* REG_EEND */ + "\0" +#define REG_ESIZE_IDX (REG_EEND_IDX + sizeof "Premature end of regular expression") + gettext_noop ("Regular expression too big") /* REG_ESIZE */ + "\0" +#define REG_ERPAREN_IDX (REG_ESIZE_IDX + sizeof "Regular expression too big") + gettext_noop ("Unmatched ) or \\)") /* REG_ERPAREN */ + }; + +static const size_t re_error_msgid_idx[] = + { + REG_NOERROR_IDX, + REG_NOMATCH_IDX, + REG_BADPAT_IDX, + REG_ECOLLATE_IDX, + REG_ECTYPE_IDX, + REG_EESCAPE_IDX, + REG_ESUBREG_IDX, + REG_EBRACK_IDX, + REG_EPAREN_IDX, + REG_EBRACE_IDX, + REG_BADBR_IDX, + REG_ERANGE_IDX, + REG_ESPACE_IDX, + REG_BADRPT_IDX, + REG_EEND_IDX, + REG_ESIZE_IDX, + REG_ERPAREN_IDX + }; + +/* Avoiding alloca during matching, to placate r_alloc. */ + +/* Define MATCH_MAY_ALLOCATE unless we need to make sure that the + searching and matching functions should not call alloca. On some + systems, alloca is implemented in terms of malloc, and if we're + using the relocating allocator routines, then malloc could cause a + relocation, which might (if the strings being searched are in the + ralloc heap) shift the data out from underneath the regexp + routines. + + Here's another reason to avoid allocation: Emacs + processes input from X in a signal handler; processing X input may + call malloc; if input arrives while a matching routine is calling + malloc, then we're scrod. But Emacs can't just block input while + calling matching routines; then we don't notice interrupts when + they come in. So, Emacs blocks input around all regexp calls + except the matching calls, which it leaves unprotected, in the + faith that they will not malloc. */ + +/* Normally, this is fine. */ +#define MATCH_MAY_ALLOCATE + +/* When using GNU C, we are not REALLY using the C alloca, no matter + what config.h may say. So don't take precautions for it. */ +#ifdef __GNUC__ +# undef C_ALLOCA +#endif + +/* The match routines may not allocate if (1) they would do it with malloc + and (2) it's not safe for them to use malloc. + Note that if REL_ALLOC is defined, matching would not use malloc for the + failure stack, but we would still use it for the register vectors; + so REL_ALLOC should not affect this. */ +#if (defined C_ALLOCA || defined REGEX_MALLOC) && defined emacs +# undef MATCH_MAY_ALLOCATE +#endif + + +/* Failure stack declarations and macros; both re_compile_fastmap and + re_match_2 use a failure stack. These have to be macros because of + REGEX_ALLOCATE_STACK. */ + + +/* Number of failure points for which to initially allocate space + when matching. If this number is exceeded, we allocate more + space, so it is not a hard limit. */ +#ifndef INIT_FAILURE_ALLOC +# define INIT_FAILURE_ALLOC 5 +#endif + +/* Roughly the maximum number of failure points on the stack. Would be + exactly that if always used MAX_FAILURE_ITEMS items each time we failed. + This is a variable only so users of regex can assign to it; we never + change it ourselves. */ + +#ifdef INT_IS_16BIT + +# if defined MATCH_MAY_ALLOCATE +/* 4400 was enough to cause a crash on Alpha OSF/1, + whose default stack limit is 2mb. */ +long int re_max_failures = 4000; +# else +long int re_max_failures = 2000; +# endif + +union fail_stack_elt +{ + US_CHAR_TYPE *pointer; + long int integer; +}; + +typedef union fail_stack_elt fail_stack_elt_t; + +typedef struct +{ + fail_stack_elt_t *stack; + unsigned long int size; + unsigned long int avail; /* Offset of next open position. */ +} fail_stack_type; + +#else /* not INT_IS_16BIT */ + +# if defined MATCH_MAY_ALLOCATE +/* 4400 was enough to cause a crash on Alpha OSF/1, + whose default stack limit is 2mb. */ +int re_max_failures = 4000; +# else +int re_max_failures = 2000; +# endif + +union fail_stack_elt +{ + US_CHAR_TYPE *pointer; + int integer; +}; + +typedef union fail_stack_elt fail_stack_elt_t; + +typedef struct +{ + fail_stack_elt_t *stack; + unsigned size; + unsigned avail; /* Offset of next open position. */ +} fail_stack_type; + +#endif /* INT_IS_16BIT */ + +#define FAIL_STACK_EMPTY() (fail_stack.avail == 0) +#define FAIL_STACK_PTR_EMPTY() (fail_stack_ptr->avail == 0) +#define FAIL_STACK_FULL() (fail_stack.avail == fail_stack.size) + + +/* Define macros to initialize and free the failure stack. + Do `return -2' if the alloc fails. */ + +#ifdef MATCH_MAY_ALLOCATE +# define INIT_FAIL_STACK() \ + do { \ + fail_stack.stack = (fail_stack_elt_t *) \ + REGEX_ALLOCATE_STACK (INIT_FAILURE_ALLOC * sizeof (fail_stack_elt_t)); \ + \ + if (fail_stack.stack == NULL) \ + return -2; \ + \ + fail_stack.size = INIT_FAILURE_ALLOC; \ + fail_stack.avail = 0; \ + } while (0) + +# define RESET_FAIL_STACK() REGEX_FREE_STACK (fail_stack.stack) +#else +# define INIT_FAIL_STACK() \ + do { \ + fail_stack.avail = 0; \ + } while (0) + +# define RESET_FAIL_STACK() +#endif + + +/* Double the size of FAIL_STACK, up to approximately `re_max_failures' items. + + Return 1 if succeeds, and 0 if either ran out of memory + allocating space for it or it was already too large. + + REGEX_REALLOCATE_STACK requires `destination' be declared. */ + +#define DOUBLE_FAIL_STACK(fail_stack) \ + ((fail_stack).size > (unsigned) (re_max_failures * MAX_FAILURE_ITEMS) \ + ? 0 \ + : ((fail_stack).stack = (fail_stack_elt_t *) \ + REGEX_REALLOCATE_STACK ((fail_stack).stack, \ + (fail_stack).size * sizeof (fail_stack_elt_t), \ + ((fail_stack).size << 1) * sizeof (fail_stack_elt_t)), \ + \ + (fail_stack).stack == NULL \ + ? 0 \ + : ((fail_stack).size <<= 1, \ + 1))) + + +/* Push pointer POINTER on FAIL_STACK. + Return 1 if was able to do so and 0 if ran out of memory allocating + space to do so. */ +#define PUSH_PATTERN_OP(POINTER, FAIL_STACK) \ + ((FAIL_STACK_FULL () \ + && !DOUBLE_FAIL_STACK (FAIL_STACK)) \ + ? 0 \ + : ((FAIL_STACK).stack[(FAIL_STACK).avail++].pointer = POINTER, \ + 1)) + +/* Push a pointer value onto the failure stack. + Assumes the variable `fail_stack'. Probably should only + be called from within `PUSH_FAILURE_POINT'. */ +#define PUSH_FAILURE_POINTER(item) \ + fail_stack.stack[fail_stack.avail++].pointer = (US_CHAR_TYPE *) (item) + +/* This pushes an integer-valued item onto the failure stack. + Assumes the variable `fail_stack'. Probably should only + be called from within `PUSH_FAILURE_POINT'. */ +#define PUSH_FAILURE_INT(item) \ + fail_stack.stack[fail_stack.avail++].integer = (item) + +/* Push a fail_stack_elt_t value onto the failure stack. + Assumes the variable `fail_stack'. Probably should only + be called from within `PUSH_FAILURE_POINT'. */ +#define PUSH_FAILURE_ELT(item) \ + fail_stack.stack[fail_stack.avail++] = (item) + +/* These three POP... operations complement the three PUSH... operations. + All assume that `fail_stack' is nonempty. */ +#define POP_FAILURE_POINTER() fail_stack.stack[--fail_stack.avail].pointer +#define POP_FAILURE_INT() fail_stack.stack[--fail_stack.avail].integer +#define POP_FAILURE_ELT() fail_stack.stack[--fail_stack.avail] + +/* Used to omit pushing failure point id's when we're not debugging. */ +#ifdef DEBUG +# define DEBUG_PUSH PUSH_FAILURE_INT +# define DEBUG_POP(item_addr) *(item_addr) = POP_FAILURE_INT () +#else +# define DEBUG_PUSH(item) +# define DEBUG_POP(item_addr) +#endif + + +/* Push the information about the state we will need + if we ever fail back to it. + + Requires variables fail_stack, regstart, regend, reg_info, and + num_regs_pushed be declared. DOUBLE_FAIL_STACK requires `destination' + be declared. + + Does `return FAILURE_CODE' if runs out of memory. */ + +#define PUSH_FAILURE_POINT(pattern_place, string_place, failure_code) \ + do { \ + char *destination; \ + /* Must be int, so when we don't save any registers, the arithmetic \ + of 0 + -1 isn't done as unsigned. */ \ + /* Can't be int, since there is not a shred of a guarantee that int \ + is wide enough to hold a value of something to which pointer can \ + be assigned */ \ + active_reg_t this_reg; \ + \ + DEBUG_STATEMENT (failure_id++); \ + DEBUG_STATEMENT (nfailure_points_pushed++); \ + DEBUG_PRINT2 ("\nPUSH_FAILURE_POINT #%u:\n", failure_id); \ + DEBUG_PRINT2 (" Before push, next avail: %d\n", (fail_stack).avail);\ + DEBUG_PRINT2 (" size: %d\n", (fail_stack).size);\ + \ + DEBUG_PRINT2 (" slots needed: %ld\n", NUM_FAILURE_ITEMS); \ + DEBUG_PRINT2 (" available: %d\n", REMAINING_AVAIL_SLOTS); \ + \ + /* Ensure we have enough space allocated for what we will push. */ \ + while (REMAINING_AVAIL_SLOTS < NUM_FAILURE_ITEMS) \ + { \ + if (!DOUBLE_FAIL_STACK (fail_stack)) \ + return failure_code; \ + \ + DEBUG_PRINT2 ("\n Doubled stack; size now: %d\n", \ + (fail_stack).size); \ + DEBUG_PRINT2 (" slots available: %d\n", REMAINING_AVAIL_SLOTS);\ + } \ + \ + /* Push the info, starting with the registers. */ \ + DEBUG_PRINT1 ("\n"); \ + \ + if (1) \ + for (this_reg = lowest_active_reg; this_reg <= highest_active_reg; \ + this_reg++) \ + { \ + DEBUG_PRINT2 (" Pushing reg: %lu\n", this_reg); \ + DEBUG_STATEMENT (num_regs_pushed++); \ + \ + DEBUG_PRINT2 (" start: %p\n", regstart[this_reg]); \ + PUSH_FAILURE_POINTER (regstart[this_reg]); \ + \ + DEBUG_PRINT2 (" end: %p\n", regend[this_reg]); \ + PUSH_FAILURE_POINTER (regend[this_reg]); \ + \ + DEBUG_PRINT2 (" info: %p\n ", \ + reg_info[this_reg].word.pointer); \ + DEBUG_PRINT2 (" match_null=%d", \ + REG_MATCH_NULL_STRING_P (reg_info[this_reg])); \ + DEBUG_PRINT2 (" active=%d", IS_ACTIVE (reg_info[this_reg])); \ + DEBUG_PRINT2 (" matched_something=%d", \ + MATCHED_SOMETHING (reg_info[this_reg])); \ + DEBUG_PRINT2 (" ever_matched=%d", \ + EVER_MATCHED_SOMETHING (reg_info[this_reg])); \ + DEBUG_PRINT1 ("\n"); \ + PUSH_FAILURE_ELT (reg_info[this_reg].word); \ + } \ + \ + DEBUG_PRINT2 (" Pushing low active reg: %ld\n", lowest_active_reg);\ + PUSH_FAILURE_INT (lowest_active_reg); \ + \ + DEBUG_PRINT2 (" Pushing high active reg: %ld\n", highest_active_reg);\ + PUSH_FAILURE_INT (highest_active_reg); \ + \ + DEBUG_PRINT2 (" Pushing pattern %p:\n", pattern_place); \ + DEBUG_PRINT_COMPILED_PATTERN (bufp, pattern_place, pend); \ + PUSH_FAILURE_POINTER (pattern_place); \ + \ + DEBUG_PRINT2 (" Pushing string %p: `", string_place); \ + DEBUG_PRINT_DOUBLE_STRING (string_place, string1, size1, string2, \ + size2); \ + DEBUG_PRINT1 ("'\n"); \ + PUSH_FAILURE_POINTER (string_place); \ + \ + DEBUG_PRINT2 (" Pushing failure id: %u\n", failure_id); \ + DEBUG_PUSH (failure_id); \ + } while (0) + +/* This is the number of items that are pushed and popped on the stack + for each register. */ +#define NUM_REG_ITEMS 3 + +/* Individual items aside from the registers. */ +#ifdef DEBUG +# define NUM_NONREG_ITEMS 5 /* Includes failure point id. */ +#else +# define NUM_NONREG_ITEMS 4 +#endif + +/* We push at most this many items on the stack. */ +/* We used to use (num_regs - 1), which is the number of registers + this regexp will save; but that was changed to 5 + to avoid stack overflow for a regexp with lots of parens. */ +#define MAX_FAILURE_ITEMS (5 * NUM_REG_ITEMS + NUM_NONREG_ITEMS) + +/* We actually push this many items. */ +#define NUM_FAILURE_ITEMS \ + (((0 \ + ? 0 : highest_active_reg - lowest_active_reg + 1) \ + * NUM_REG_ITEMS) \ + + NUM_NONREG_ITEMS) + +/* How many items can still be added to the stack without overflowing it. */ +#define REMAINING_AVAIL_SLOTS ((fail_stack).size - (fail_stack).avail) + + +/* Pops what PUSH_FAIL_STACK pushes. + + We restore into the parameters, all of which should be lvalues: + STR -- the saved data position. + PAT -- the saved pattern position. + LOW_REG, HIGH_REG -- the highest and lowest active registers. + REGSTART, REGEND -- arrays of string positions. + REG_INFO -- array of information about each subexpression. + + Also assumes the variables `fail_stack' and (if debugging), `bufp', + `pend', `string1', `size1', `string2', and `size2'. */ +#define POP_FAILURE_POINT(str, pat, low_reg, high_reg, regstart, regend, reg_info)\ +{ \ + DEBUG_STATEMENT (unsigned failure_id;) \ + active_reg_t this_reg; \ + const US_CHAR_TYPE *string_temp; \ + \ + assert (!FAIL_STACK_EMPTY ()); \ + \ + /* Remove failure points and point to how many regs pushed. */ \ + DEBUG_PRINT1 ("POP_FAILURE_POINT:\n"); \ + DEBUG_PRINT2 (" Before pop, next avail: %d\n", fail_stack.avail); \ + DEBUG_PRINT2 (" size: %d\n", fail_stack.size); \ + \ + assert (fail_stack.avail >= NUM_NONREG_ITEMS); \ + \ + DEBUG_POP (&failure_id); \ + DEBUG_PRINT2 (" Popping failure id: %u\n", failure_id); \ + \ + /* If the saved string location is NULL, it came from an \ + on_failure_keep_string_jump opcode, and we want to throw away the \ + saved NULL, thus retaining our current position in the string. */ \ + string_temp = POP_FAILURE_POINTER (); \ + if (string_temp != NULL) \ + str = (const CHAR_TYPE *) string_temp; \ + \ + DEBUG_PRINT2 (" Popping string %p: `", str); \ + DEBUG_PRINT_DOUBLE_STRING (str, string1, size1, string2, size2); \ + DEBUG_PRINT1 ("'\n"); \ + \ + pat = (US_CHAR_TYPE *) POP_FAILURE_POINTER (); \ + DEBUG_PRINT2 (" Popping pattern %p:\n", pat); \ + DEBUG_PRINT_COMPILED_PATTERN (bufp, pat, pend); \ + \ + /* Restore register info. */ \ + high_reg = (active_reg_t) POP_FAILURE_INT (); \ + DEBUG_PRINT2 (" Popping high active reg: %ld\n", high_reg); \ + \ + low_reg = (active_reg_t) POP_FAILURE_INT (); \ + DEBUG_PRINT2 (" Popping low active reg: %ld\n", low_reg); \ + \ + if (1) \ + for (this_reg = high_reg; this_reg >= low_reg; this_reg--) \ + { \ + DEBUG_PRINT2 (" Popping reg: %ld\n", this_reg); \ + \ + reg_info[this_reg].word = POP_FAILURE_ELT (); \ + DEBUG_PRINT2 (" info: %p\n", \ + reg_info[this_reg].word.pointer); \ + \ + regend[this_reg] = (const CHAR_TYPE *) POP_FAILURE_POINTER (); \ + DEBUG_PRINT2 (" end: %p\n", regend[this_reg]); \ + \ + regstart[this_reg] = (const CHAR_TYPE *) POP_FAILURE_POINTER ();\ + DEBUG_PRINT2 (" start: %p\n", regstart[this_reg]); \ + } \ + else \ + { \ + for (this_reg = highest_active_reg; this_reg > high_reg; this_reg--) \ + { \ + reg_info[this_reg].word.integer = 0; \ + regend[this_reg] = 0; \ + regstart[this_reg] = 0; \ + } \ + highest_active_reg = high_reg; \ + } \ + \ + set_regs_matched_done = 0; \ + DEBUG_STATEMENT (nfailure_points_popped++); \ +} /* POP_FAILURE_POINT */ + + +/* Structure for per-register (a.k.a. per-group) information. + Other register information, such as the + starting and ending positions (which are addresses), and the list of + inner groups (which is a bits list) are maintained in separate + variables. + + We are making a (strictly speaking) nonportable assumption here: that + the compiler will pack our bit fields into something that fits into + the type of `word', i.e., is something that fits into one item on the + failure stack. */ + + +/* Declarations and macros for re_match_2. */ + +typedef union +{ + fail_stack_elt_t word; + struct + { + /* This field is one if this group can match the empty string, + zero if not. If not yet determined, `MATCH_NULL_UNSET_VALUE'. */ +#define MATCH_NULL_UNSET_VALUE 3 + unsigned match_null_string_p : 2; + unsigned is_active : 1; + unsigned matched_something : 1; + unsigned ever_matched_something : 1; + } bits; +} register_info_type; + +#define REG_MATCH_NULL_STRING_P(R) ((R).bits.match_null_string_p) +#define IS_ACTIVE(R) ((R).bits.is_active) +#define MATCHED_SOMETHING(R) ((R).bits.matched_something) +#define EVER_MATCHED_SOMETHING(R) ((R).bits.ever_matched_something) + + +/* Call this when have matched a real character; it sets `matched' flags + for the subexpressions which we are currently inside. Also records + that those subexprs have matched. */ +#define SET_REGS_MATCHED() \ + do \ + { \ + if (!set_regs_matched_done) \ + { \ + active_reg_t r; \ + set_regs_matched_done = 1; \ + for (r = lowest_active_reg; r <= highest_active_reg; r++) \ + { \ + MATCHED_SOMETHING (reg_info[r]) \ + = EVER_MATCHED_SOMETHING (reg_info[r]) \ + = 1; \ + } \ + } \ + } \ + while (0) + +/* Registers are set to a sentinel when they haven't yet matched. */ +static CHAR_TYPE reg_unset_dummy; +#define REG_UNSET_VALUE (®_unset_dummy) +#define REG_UNSET(e) ((e) == REG_UNSET_VALUE) + +/* Subroutine declarations and macros for regex_compile. */ + +static reg_errcode_t regex_compile _RE_ARGS ((const char *pattern, size_t size, + reg_syntax_t syntax, + struct re_pattern_buffer *bufp)); +static void store_op1 _RE_ARGS ((re_opcode_t op, US_CHAR_TYPE *loc, int arg)); +static void store_op2 _RE_ARGS ((re_opcode_t op, US_CHAR_TYPE *loc, + int arg1, int arg2)); +static void insert_op1 _RE_ARGS ((re_opcode_t op, US_CHAR_TYPE *loc, + int arg, US_CHAR_TYPE *end)); +static void insert_op2 _RE_ARGS ((re_opcode_t op, US_CHAR_TYPE *loc, + int arg1, int arg2, US_CHAR_TYPE *end)); +static boolean at_begline_loc_p _RE_ARGS ((const CHAR_TYPE *pattern, + const CHAR_TYPE *p, + reg_syntax_t syntax)); +static boolean at_endline_loc_p _RE_ARGS ((const CHAR_TYPE *p, + const CHAR_TYPE *pend, + reg_syntax_t syntax)); +#ifdef MBS_SUPPORT +static reg_errcode_t compile_range _RE_ARGS ((CHAR_TYPE range_start, + const CHAR_TYPE **p_ptr, + const CHAR_TYPE *pend, + char *translate, + reg_syntax_t syntax, + US_CHAR_TYPE *b, + CHAR_TYPE *char_set)); +static void insert_space _RE_ARGS ((int num, CHAR_TYPE *loc, CHAR_TYPE *end)); +#else +static reg_errcode_t compile_range _RE_ARGS ((unsigned int range_start, + const CHAR_TYPE **p_ptr, + const CHAR_TYPE *pend, + char *translate, + reg_syntax_t syntax, + US_CHAR_TYPE *b)); +#endif /* MBS_SUPPORT */ + +/* Fetch the next character in the uncompiled pattern---translating it + if necessary. Also cast from a signed character in the constant + string passed to us by the user to an unsigned char that we can use + as an array index (in, e.g., `translate'). */ +/* ifdef MBS_SUPPORT, we translate only if character <= 0xff, + because it is impossible to allocate 4GB array for some encodings + which have 4 byte character_set like UCS4. */ +#ifndef PATFETCH +# ifdef MBS_SUPPORT +# define PATFETCH(c) \ + do {if (p == pend) return REG_EEND; \ + c = (US_CHAR_TYPE) *p++; \ + if (translate && (c <= 0xff)) c = (US_CHAR_TYPE) translate[c]; \ + } while (0) +# else +# define PATFETCH(c) \ + do {if (p == pend) return REG_EEND; \ + c = (unsigned char) *p++; \ + if (translate) c = (unsigned char) translate[c]; \ + } while (0) +# endif /* MBS_SUPPORT */ +#endif + +/* Fetch the next character in the uncompiled pattern, with no + translation. */ +#define PATFETCH_RAW(c) \ + do {if (p == pend) return REG_EEND; \ + c = (US_CHAR_TYPE) *p++; \ + } while (0) + +/* Go backwards one character in the pattern. */ +#define PATUNFETCH p-- + + +/* If `translate' is non-null, return translate[D], else just D. We + cast the subscript to translate because some data is declared as + `char *', to avoid warnings when a string constant is passed. But + when we use a character as a subscript we must make it unsigned. */ +/* ifdef MBS_SUPPORT, we translate only if character <= 0xff, + because it is impossible to allocate 4GB array for some encodings + which have 4 byte character_set like UCS4. */ +#ifndef TRANSLATE +# ifdef MBS_SUPPORT +# define TRANSLATE(d) \ + ((translate && ((US_CHAR_TYPE) (d)) <= 0xff) \ + ? (char) translate[(unsigned char) (d)] : (d)) +#else +# define TRANSLATE(d) \ + (translate ? (char) translate[(unsigned char) (d)] : (d)) +# endif /* MBS_SUPPORT */ +#endif + + +/* Macros for outputting the compiled pattern into `buffer'. */ + +/* If the buffer isn't allocated when it comes in, use this. */ +#define INIT_BUF_SIZE (32 * sizeof(US_CHAR_TYPE)) + +/* Make sure we have at least N more bytes of space in buffer. */ +#ifdef MBS_SUPPORT +# define GET_BUFFER_SPACE(n) \ + while (((unsigned long)b - (unsigned long)COMPILED_BUFFER_VAR \ + + (n)*sizeof(CHAR_TYPE)) > bufp->allocated) \ + EXTEND_BUFFER () +#else +# define GET_BUFFER_SPACE(n) \ + while ((unsigned long) (b - bufp->buffer + (n)) > bufp->allocated) \ + EXTEND_BUFFER () +#endif /* MBS_SUPPORT */ + +/* Make sure we have one more byte of buffer space and then add C to it. */ +#define BUF_PUSH(c) \ + do { \ + GET_BUFFER_SPACE (1); \ + *b++ = (US_CHAR_TYPE) (c); \ + } while (0) + + +/* Ensure we have two more bytes of buffer space and then append C1 and C2. */ +#define BUF_PUSH_2(c1, c2) \ + do { \ + GET_BUFFER_SPACE (2); \ + *b++ = (US_CHAR_TYPE) (c1); \ + *b++ = (US_CHAR_TYPE) (c2); \ + } while (0) + + +/* As with BUF_PUSH_2, except for three bytes. */ +#define BUF_PUSH_3(c1, c2, c3) \ + do { \ + GET_BUFFER_SPACE (3); \ + *b++ = (US_CHAR_TYPE) (c1); \ + *b++ = (US_CHAR_TYPE) (c2); \ + *b++ = (US_CHAR_TYPE) (c3); \ + } while (0) + +/* Store a jump with opcode OP at LOC to location TO. We store a + relative address offset by the three bytes the jump itself occupies. */ +#define STORE_JUMP(op, loc, to) \ + store_op1 (op, loc, (int) ((to) - (loc) - (1 + OFFSET_ADDRESS_SIZE))) + +/* Likewise, for a two-argument jump. */ +#define STORE_JUMP2(op, loc, to, arg) \ + store_op2 (op, loc, (int) ((to) - (loc) - (1 + OFFSET_ADDRESS_SIZE)), arg) + +/* Like `STORE_JUMP', but for inserting. Assume `b' is the buffer end. */ +#define INSERT_JUMP(op, loc, to) \ + insert_op1 (op, loc, (int) ((to) - (loc) - (1 + OFFSET_ADDRESS_SIZE)), b) + +/* Like `STORE_JUMP2', but for inserting. Assume `b' is the buffer end. */ +#define INSERT_JUMP2(op, loc, to, arg) \ + insert_op2 (op, loc, (int) ((to) - (loc) - (1 + OFFSET_ADDRESS_SIZE)),\ + arg, b) + + +/* This is not an arbitrary limit: the arguments which represent offsets + into the pattern are two bytes long. So if 2^16 bytes turns out to + be too small, many things would have to change. */ +/* Any other compiler which, like MSC, has allocation limit below 2^16 + bytes will have to use approach similar to what was done below for + MSC and drop MAX_BUF_SIZE a bit. Otherwise you may end up + reallocating to 0 bytes. Such thing is not going to work too well. + You have been warned!! */ +#if defined _MSC_VER && !defined WIN32 +/* Microsoft C 16-bit versions limit malloc to approx 65512 bytes. + The REALLOC define eliminates a flurry of conversion warnings, + but is not required. */ +# define MAX_BUF_SIZE 65500L +# define REALLOC(p,s) realloc ((p), (size_t) (s)) +#else +# define MAX_BUF_SIZE (1L << 16) +# define REALLOC(p,s) realloc ((p), (s)) +#endif + +/* Extend the buffer by twice its current size via realloc and + reset the pointers that pointed into the old block to point to the + correct places in the new one. If extending the buffer results in it + being larger than MAX_BUF_SIZE, then flag memory exhausted. */ +#if __BOUNDED_POINTERS__ +# define SET_HIGH_BOUND(P) (__ptrhigh (P) = __ptrlow (P) + bufp->allocated) +# define MOVE_BUFFER_POINTER(P) \ + (__ptrlow (P) += incr, SET_HIGH_BOUND (P), __ptrvalue (P) += incr) +# define ELSE_EXTEND_BUFFER_HIGH_BOUND \ + else \ + { \ + SET_HIGH_BOUND (b); \ + SET_HIGH_BOUND (begalt); \ + if (fixup_alt_jump) \ + SET_HIGH_BOUND (fixup_alt_jump); \ + if (laststart) \ + SET_HIGH_BOUND (laststart); \ + if (pending_exact) \ + SET_HIGH_BOUND (pending_exact); \ + } +#else +# define MOVE_BUFFER_POINTER(P) (P) += incr +# define ELSE_EXTEND_BUFFER_HIGH_BOUND +#endif + +#ifdef MBS_SUPPORT +# define EXTEND_BUFFER() \ + do { \ + US_CHAR_TYPE *old_buffer = COMPILED_BUFFER_VAR; \ + int wchar_count; \ + if (bufp->allocated + sizeof(US_CHAR_TYPE) > MAX_BUF_SIZE) \ + return REG_ESIZE; \ + bufp->allocated <<= 1; \ + if (bufp->allocated > MAX_BUF_SIZE) \ + bufp->allocated = MAX_BUF_SIZE; \ + /* How many characters the new buffer can have? */ \ + wchar_count = bufp->allocated / sizeof(US_CHAR_TYPE); \ + if (wchar_count == 0) wchar_count = 1; \ + /* Truncate the buffer to CHAR_TYPE align. */ \ + bufp->allocated = wchar_count * sizeof(US_CHAR_TYPE); \ + RETALLOC (COMPILED_BUFFER_VAR, wchar_count, US_CHAR_TYPE); \ + bufp->buffer = (char*)COMPILED_BUFFER_VAR; \ + if (COMPILED_BUFFER_VAR == NULL) \ + return REG_ESPACE; \ + /* If the buffer moved, move all the pointers into it. */ \ + if (old_buffer != COMPILED_BUFFER_VAR) \ + { \ + int incr = COMPILED_BUFFER_VAR - old_buffer; \ + MOVE_BUFFER_POINTER (b); \ + MOVE_BUFFER_POINTER (begalt); \ + if (fixup_alt_jump) \ + MOVE_BUFFER_POINTER (fixup_alt_jump); \ + if (laststart) \ + MOVE_BUFFER_POINTER (laststart); \ + if (pending_exact) \ + MOVE_BUFFER_POINTER (pending_exact); \ + } \ + ELSE_EXTEND_BUFFER_HIGH_BOUND \ + } while (0) +#else +# define EXTEND_BUFFER() \ + do { \ + US_CHAR_TYPE *old_buffer = COMPILED_BUFFER_VAR; \ + if (bufp->allocated == MAX_BUF_SIZE) \ + return REG_ESIZE; \ + bufp->allocated <<= 1; \ + if (bufp->allocated > MAX_BUF_SIZE) \ + bufp->allocated = MAX_BUF_SIZE; \ + bufp->buffer = (US_CHAR_TYPE *) REALLOC (COMPILED_BUFFER_VAR, \ + bufp->allocated); \ + if (COMPILED_BUFFER_VAR == NULL) \ + return REG_ESPACE; \ + /* If the buffer moved, move all the pointers into it. */ \ + if (old_buffer != COMPILED_BUFFER_VAR) \ + { \ + int incr = COMPILED_BUFFER_VAR - old_buffer; \ + MOVE_BUFFER_POINTER (b); \ + MOVE_BUFFER_POINTER (begalt); \ + if (fixup_alt_jump) \ + MOVE_BUFFER_POINTER (fixup_alt_jump); \ + if (laststart) \ + MOVE_BUFFER_POINTER (laststart); \ + if (pending_exact) \ + MOVE_BUFFER_POINTER (pending_exact); \ + } \ + ELSE_EXTEND_BUFFER_HIGH_BOUND \ + } while (0) +#endif /* MBS_SUPPORT */ + +/* Since we have one byte reserved for the register number argument to + {start,stop}_memory, the maximum number of groups we can report + things about is what fits in that byte. */ +#define MAX_REGNUM 255 + +/* But patterns can have more than `MAX_REGNUM' registers. We just + ignore the excess. */ +typedef unsigned regnum_t; + + +/* Macros for the compile stack. */ + +/* Since offsets can go either forwards or backwards, this type needs to + be able to hold values from -(MAX_BUF_SIZE - 1) to MAX_BUF_SIZE - 1. */ +/* int may be not enough when sizeof(int) == 2. */ +typedef long pattern_offset_t; + +typedef struct +{ + pattern_offset_t begalt_offset; + pattern_offset_t fixup_alt_jump; + pattern_offset_t inner_group_offset; + pattern_offset_t laststart_offset; + regnum_t regnum; +} compile_stack_elt_t; + + +typedef struct +{ + compile_stack_elt_t *stack; + unsigned size; + unsigned avail; /* Offset of next open position. */ +} compile_stack_type; + + +#define INIT_COMPILE_STACK_SIZE 32 + +#define COMPILE_STACK_EMPTY (compile_stack.avail == 0) +#define COMPILE_STACK_FULL (compile_stack.avail == compile_stack.size) + +/* The next available element. */ +#define COMPILE_STACK_TOP (compile_stack.stack[compile_stack.avail]) + + +/* Set the bit for character C in a list. */ +#define SET_LIST_BIT(c) \ + (b[((unsigned char) (c)) / BYTEWIDTH] \ + |= 1 << (((unsigned char) c) % BYTEWIDTH)) + + +/* Get the next unsigned number in the uncompiled pattern. */ +#define GET_UNSIGNED_NUMBER(num) \ + { \ + while (p != pend) \ + { \ + PATFETCH (c); \ + if (! ('0' <= c && c <= '9')) \ + break; \ + if (num <= RE_DUP_MAX) \ + { \ + if (num < 0) \ + num = 0; \ + num = num * 10 + c - '0'; \ + } \ + } \ + } + +#if defined _LIBC || WIDE_CHAR_SUPPORT +/* The GNU C library provides support for user-defined character classes + and the functions from ISO C amendement 1. */ +# ifdef CHARCLASS_NAME_MAX +# define CHAR_CLASS_MAX_LENGTH CHARCLASS_NAME_MAX +# else +/* This shouldn't happen but some implementation might still have this + problem. Use a reasonable default value. */ +# define CHAR_CLASS_MAX_LENGTH 256 +# endif + +# ifdef _LIBC +# define IS_CHAR_CLASS(string) __wctype (string) +# else +# define IS_CHAR_CLASS(string) wctype (string) +# endif +#else +# define CHAR_CLASS_MAX_LENGTH 6 /* Namely, `xdigit'. */ + +# define IS_CHAR_CLASS(string) \ + (STREQ (string, "alpha") || STREQ (string, "upper") \ + || STREQ (string, "lower") || STREQ (string, "digit") \ + || STREQ (string, "alnum") || STREQ (string, "xdigit") \ + || STREQ (string, "space") || STREQ (string, "print") \ + || STREQ (string, "punct") || STREQ (string, "graph") \ + || STREQ (string, "cntrl") || STREQ (string, "blank")) +#endif + +#ifndef MATCH_MAY_ALLOCATE + +/* If we cannot allocate large objects within re_match_2_internal, + we make the fail stack and register vectors global. + The fail stack, we grow to the maximum size when a regexp + is compiled. + The register vectors, we adjust in size each time we + compile a regexp, according to the number of registers it needs. */ + +static fail_stack_type fail_stack; + +/* Size with which the following vectors are currently allocated. + That is so we can make them bigger as needed, + but never make them smaller. */ +static int regs_allocated_size; + +static const char ** regstart, ** regend; +static const char ** old_regstart, ** old_regend; +static const char **best_regstart, **best_regend; +static register_info_type *reg_info; +static const char **reg_dummy; +static register_info_type *reg_info_dummy; + +/* Make the register vectors big enough for NUM_REGS registers, + but don't make them smaller. */ + +static +regex_grow_registers (num_regs) + int num_regs; +{ + if (num_regs > regs_allocated_size) + { + RETALLOC_IF (regstart, num_regs, const char *); + RETALLOC_IF (regend, num_regs, const char *); + RETALLOC_IF (old_regstart, num_regs, const char *); + RETALLOC_IF (old_regend, num_regs, const char *); + RETALLOC_IF (best_regstart, num_regs, const char *); + RETALLOC_IF (best_regend, num_regs, const char *); + RETALLOC_IF (reg_info, num_regs, register_info_type); + RETALLOC_IF (reg_dummy, num_regs, const char *); + RETALLOC_IF (reg_info_dummy, num_regs, register_info_type); + + regs_allocated_size = num_regs; + } +} + +#endif /* not MATCH_MAY_ALLOCATE */ + +static boolean group_in_compile_stack _RE_ARGS ((compile_stack_type + compile_stack, + regnum_t regnum)); + +/* `regex_compile' compiles PATTERN (of length SIZE) according to SYNTAX. + Returns one of error codes defined in `regex.h', or zero for success. + + Assumes the `allocated' (and perhaps `buffer') and `translate' + fields are set in BUFP on entry. + + If it succeeds, results are put in BUFP (if it returns an error, the + contents of BUFP are undefined): + `buffer' is the compiled pattern; + `syntax' is set to SYNTAX; + `used' is set to the length of the compiled pattern; + `fastmap_accurate' is zero; + `re_nsub' is the number of subexpressions in PATTERN; + `not_bol' and `not_eol' are zero; + + The `fastmap' and `newline_anchor' fields are neither + examined nor set. */ + +/* Return, freeing storage we allocated. */ +#ifdef MBS_SUPPORT +# define FREE_STACK_RETURN(value) \ + return (free(pattern), free(mbs_offset), free(is_binary), free (compile_stack.stack), value) +#else +# define FREE_STACK_RETURN(value) \ + return (free (compile_stack.stack), value) +#endif /* MBS_SUPPORT */ + +static reg_errcode_t +#ifdef MBS_SUPPORT +regex_compile (cpattern, csize, syntax, bufp) + const char *cpattern; + size_t csize; +#else +regex_compile (pattern, size, syntax, bufp) + const char *pattern; + size_t size; +#endif /* MBS_SUPPORT */ + reg_syntax_t syntax; + struct re_pattern_buffer *bufp; +{ + /* We fetch characters from PATTERN here. Even though PATTERN is + `char *' (i.e., signed), we declare these variables as unsigned, so + they can be reliably used as array indices. */ + register US_CHAR_TYPE c, c1; + +#ifdef MBS_SUPPORT + /* A temporary space to keep wchar_t pattern and compiled pattern. */ + CHAR_TYPE *pattern, *COMPILED_BUFFER_VAR; + size_t size; + /* offset buffer for optimizatoin. See convert_mbs_to_wc. */ + int *mbs_offset = NULL; + /* It hold whether each wchar_t is binary data or not. */ + char *is_binary = NULL; + /* A flag whether exactn is handling binary data or not. */ + char is_exactn_bin = FALSE; +#endif /* MBS_SUPPORT */ + + /* A random temporary spot in PATTERN. */ + const CHAR_TYPE *p1; + + /* Points to the end of the buffer, where we should append. */ + register US_CHAR_TYPE *b; + + /* Keeps track of unclosed groups. */ + compile_stack_type compile_stack; + + /* Points to the current (ending) position in the pattern. */ +#ifdef MBS_SUPPORT + const CHAR_TYPE *p; + const CHAR_TYPE *pend; +#else + const CHAR_TYPE *p = pattern; + const CHAR_TYPE *pend = pattern + size; +#endif /* MBS_SUPPORT */ + + /* How to translate the characters in the pattern. */ + RE_TRANSLATE_TYPE translate = bufp->translate; + + /* Address of the count-byte of the most recently inserted `exactn' + command. This makes it possible to tell if a new exact-match + character can be added to that command or if the character requires + a new `exactn' command. */ + US_CHAR_TYPE *pending_exact = 0; + + /* Address of start of the most recently finished expression. + This tells, e.g., postfix * where to find the start of its + operand. Reset at the beginning of groups and alternatives. */ + US_CHAR_TYPE *laststart = 0; + + /* Address of beginning of regexp, or inside of last group. */ + US_CHAR_TYPE *begalt; + + /* Address of the place where a forward jump should go to the end of + the containing expression. Each alternative of an `or' -- except the + last -- ends with a forward jump of this sort. */ + US_CHAR_TYPE *fixup_alt_jump = 0; + + /* Counts open-groups as they are encountered. Remembered for the + matching close-group on the compile stack, so the same register + number is put in the stop_memory as the start_memory. */ + regnum_t regnum = 0; + +#ifdef MBS_SUPPORT + /* Initialize the wchar_t PATTERN and offset_buffer. */ + p = pend = pattern = TALLOC(csize + 1, CHAR_TYPE); + p[csize] = L'\0'; /* sentinel */ + mbs_offset = TALLOC(csize + 1, int); + is_binary = TALLOC(csize + 1, char); + if (pattern == NULL || mbs_offset == NULL || is_binary == NULL) + { + if (pattern) free(pattern); + if (mbs_offset) free(mbs_offset); + if (is_binary) free(is_binary); + return REG_ESPACE; + } + size = convert_mbs_to_wcs(pattern, cpattern, csize, mbs_offset, is_binary); + pend = p + size; + if (size < 0) + { + if (pattern) free(pattern); + if (mbs_offset) free(mbs_offset); + if (is_binary) free(is_binary); + return REG_BADPAT; + } +#endif + +#ifdef DEBUG + DEBUG_PRINT1 ("\nCompiling pattern: "); + if (debug) + { + unsigned debug_count; + + for (debug_count = 0; debug_count < size; debug_count++) + PUT_CHAR (pattern[debug_count]); + putchar ('\n'); + } +#endif /* DEBUG */ + + /* Initialize the compile stack. */ + compile_stack.stack = TALLOC (INIT_COMPILE_STACK_SIZE, compile_stack_elt_t); + if (compile_stack.stack == NULL) + { +#ifdef MBS_SUPPORT + if (pattern) free(pattern); + if (mbs_offset) free(mbs_offset); + if (is_binary) free(is_binary); +#endif + return REG_ESPACE; + } + + compile_stack.size = INIT_COMPILE_STACK_SIZE; + compile_stack.avail = 0; + + /* Initialize the pattern buffer. */ + bufp->syntax = syntax; + bufp->fastmap_accurate = 0; + bufp->not_bol = bufp->not_eol = 0; + + /* Set `used' to zero, so that if we return an error, the pattern + printer (for debugging) will think there's no pattern. We reset it + at the end. */ + bufp->used = 0; + + /* Always count groups, whether or not bufp->no_sub is set. */ + bufp->re_nsub = 0; + +#if !defined emacs && !defined SYNTAX_TABLE + /* Initialize the syntax table. */ + init_syntax_once (); +#endif + + if (bufp->allocated == 0) + { + if (bufp->buffer) + { /* If zero allocated, but buffer is non-null, try to realloc + enough space. This loses if buffer's address is bogus, but + that is the user's responsibility. */ +#ifdef MBS_SUPPORT + /* Free bufp->buffer and allocate an array for wchar_t pattern + buffer. */ + free(bufp->buffer); + COMPILED_BUFFER_VAR = TALLOC (INIT_BUF_SIZE/sizeof(US_CHAR_TYPE), + US_CHAR_TYPE); +#else + RETALLOC (COMPILED_BUFFER_VAR, INIT_BUF_SIZE, US_CHAR_TYPE); +#endif /* MBS_SUPPORT */ + } + else + { /* Caller did not allocate a buffer. Do it for them. */ + COMPILED_BUFFER_VAR = TALLOC (INIT_BUF_SIZE / sizeof(US_CHAR_TYPE), + US_CHAR_TYPE); + } + + if (!COMPILED_BUFFER_VAR) FREE_STACK_RETURN (REG_ESPACE); +#ifdef MBS_SUPPORT + bufp->buffer = (char*)COMPILED_BUFFER_VAR; +#endif /* MBS_SUPPORT */ + bufp->allocated = INIT_BUF_SIZE; + } +#ifdef MBS_SUPPORT + else + COMPILED_BUFFER_VAR = (US_CHAR_TYPE*) bufp->buffer; +#endif + + begalt = b = COMPILED_BUFFER_VAR; + + /* Loop through the uncompiled pattern until we're at the end. */ + while (p != pend) + { + PATFETCH (c); + + switch (c) + { + case '^': + { + if ( /* If at start of pattern, it's an operator. */ + p == pattern + 1 + /* If context independent, it's an operator. */ + || syntax & RE_CONTEXT_INDEP_ANCHORS + /* Otherwise, depends on what's come before. */ + || at_begline_loc_p (pattern, p, syntax)) + BUF_PUSH (begline); + else + goto normal_char; + } + break; + + + case '$': + { + if ( /* If at end of pattern, it's an operator. */ + p == pend + /* If context independent, it's an operator. */ + || syntax & RE_CONTEXT_INDEP_ANCHORS + /* Otherwise, depends on what's next. */ + || at_endline_loc_p (p, pend, syntax)) + BUF_PUSH (endline); + else + goto normal_char; + } + break; + + + case '+': + case '?': + if ((syntax & RE_BK_PLUS_QM) + || (syntax & RE_LIMITED_OPS)) + goto normal_char; + handle_plus: + case '*': + /* If there is no previous pattern... */ + if (!laststart) + { + if (syntax & RE_CONTEXT_INVALID_OPS) + FREE_STACK_RETURN (REG_BADRPT); + else if (!(syntax & RE_CONTEXT_INDEP_OPS)) + goto normal_char; + } + + { + /* Are we optimizing this jump? */ + boolean keep_string_p = false; + + /* 1 means zero (many) matches is allowed. */ + char zero_times_ok = 0, many_times_ok = 0; + + /* If there is a sequence of repetition chars, collapse it + down to just one (the right one). We can't combine + interval operators with these because of, e.g., `a{2}*', + which should only match an even number of `a's. */ + + for (;;) + { + zero_times_ok |= c != '+'; + many_times_ok |= c != '?'; + + if (p == pend) + break; + + PATFETCH (c); + + if (c == '*' + || (!(syntax & RE_BK_PLUS_QM) && (c == '+' || c == '?'))) + ; + + else if (syntax & RE_BK_PLUS_QM && c == '\\') + { + if (p == pend) FREE_STACK_RETURN (REG_EESCAPE); + + PATFETCH (c1); + if (!(c1 == '+' || c1 == '?')) + { + PATUNFETCH; + PATUNFETCH; + break; + } + + c = c1; + } + else + { + PATUNFETCH; + break; + } + + /* If we get here, we found another repeat character. */ + } + + /* Star, etc. applied to an empty pattern is equivalent + to an empty pattern. */ + if (!laststart) + break; + + /* Now we know whether or not zero matches is allowed + and also whether or not two or more matches is allowed. */ + if (many_times_ok) + { /* More than one repetition is allowed, so put in at the + end a backward relative jump from `b' to before the next + jump we're going to put in below (which jumps from + laststart to after this jump). + + But if we are at the `*' in the exact sequence `.*\n', + insert an unconditional jump backwards to the ., + instead of the beginning of the loop. This way we only + push a failure point once, instead of every time + through the loop. */ + assert (p - 1 > pattern); + + /* Allocate the space for the jump. */ + GET_BUFFER_SPACE (1 + OFFSET_ADDRESS_SIZE); + + /* We know we are not at the first character of the pattern, + because laststart was nonzero. And we've already + incremented `p', by the way, to be the character after + the `*'. Do we have to do something analogous here + for null bytes, because of RE_DOT_NOT_NULL? */ + if (TRANSLATE (*(p - 2)) == TRANSLATE ('.') + && zero_times_ok + && p < pend && TRANSLATE (*p) == TRANSLATE ('\n') + && !(syntax & RE_DOT_NEWLINE)) + { /* We have .*\n. */ + STORE_JUMP (jump, b, laststart); + keep_string_p = true; + } + else + /* Anything else. */ + STORE_JUMP (maybe_pop_jump, b, laststart - + (1 + OFFSET_ADDRESS_SIZE)); + + /* We've added more stuff to the buffer. */ + b += 1 + OFFSET_ADDRESS_SIZE; + } + + /* On failure, jump from laststart to b + 3, which will be the + end of the buffer after this jump is inserted. */ + /* ifdef MBS_SUPPORT, 'b + 1 + OFFSET_ADDRESS_SIZE' instead of + 'b + 3'. */ + GET_BUFFER_SPACE (1 + OFFSET_ADDRESS_SIZE); + INSERT_JUMP (keep_string_p ? on_failure_keep_string_jump + : on_failure_jump, + laststart, b + 1 + OFFSET_ADDRESS_SIZE); + pending_exact = 0; + b += 1 + OFFSET_ADDRESS_SIZE; + + if (!zero_times_ok) + { + /* At least one repetition is required, so insert a + `dummy_failure_jump' before the initial + `on_failure_jump' instruction of the loop. This + effects a skip over that instruction the first time + we hit that loop. */ + GET_BUFFER_SPACE (1 + OFFSET_ADDRESS_SIZE); + INSERT_JUMP (dummy_failure_jump, laststart, laststart + + 2 + 2 * OFFSET_ADDRESS_SIZE); + b += 1 + OFFSET_ADDRESS_SIZE; + } + } + break; + + + case '.': + laststart = b; + BUF_PUSH (anychar); + break; + + + case '[': + { + boolean had_char_class = false; +#ifdef MBS_SUPPORT + CHAR_TYPE range_start = 0xffffffff; +#else + unsigned int range_start = 0xffffffff; +#endif + if (p == pend) FREE_STACK_RETURN (REG_EBRACK); + +#ifdef MBS_SUPPORT + /* We assume a charset(_not) structure as a wchar_t array. + charset[0] = (re_opcode_t) charset(_not) + charset[1] = l (= length of char_classes) + charset[2] = m (= length of collating_symbols) + charset[3] = n (= length of equivalence_classes) + charset[4] = o (= length of char_ranges) + charset[5] = p (= length of chars) + + charset[6] = char_class (wctype_t) + charset[6+CHAR_CLASS_SIZE] = char_class (wctype_t) + ... + charset[l+5] = char_class (wctype_t) + + charset[l+6] = collating_symbol (wchar_t) + ... + charset[l+m+5] = collating_symbol (wchar_t) + ifdef _LIBC we use the index if + _NL_COLLATE_SYMB_EXTRAMB instead of + wchar_t string. + + charset[l+m+6] = equivalence_classes (wchar_t) + ... + charset[l+m+n+5] = equivalence_classes (wchar_t) + ifdef _LIBC we use the index in + _NL_COLLATE_WEIGHT instead of + wchar_t string. + + charset[l+m+n+6] = range_start + charset[l+m+n+7] = range_end + ... + charset[l+m+n+2o+4] = range_start + charset[l+m+n+2o+5] = range_end + ifdef _LIBC we use the value looked up + in _NL_COLLATE_COLLSEQ instead of + wchar_t character. + + charset[l+m+n+2o+6] = char + ... + charset[l+m+n+2o+p+5] = char + + */ + + /* We need at least 6 spaces: the opcode, the length of + char_classes, the length of collating_symbols, the length of + equivalence_classes, the length of char_ranges, the length of + chars. */ + GET_BUFFER_SPACE (6); + + /* Save b as laststart. And We use laststart as the pointer + to the first element of the charset here. + In other words, laststart[i] indicates charset[i]. */ + laststart = b; + + /* We test `*p == '^' twice, instead of using an if + statement, so we only need one BUF_PUSH. */ + BUF_PUSH (*p == '^' ? charset_not : charset); + if (*p == '^') + p++; + + /* Push the length of char_classes, the length of + collating_symbols, the length of equivalence_classes, the + length of char_ranges and the length of chars. */ + BUF_PUSH_3 (0, 0, 0); + BUF_PUSH_2 (0, 0); + + /* Remember the first position in the bracket expression. */ + p1 = p; + + /* charset_not matches newline according to a syntax bit. */ + if ((re_opcode_t) b[-6] == charset_not + && (syntax & RE_HAT_LISTS_NOT_NEWLINE)) + { + BUF_PUSH('\n'); + laststart[5]++; /* Update the length of characters */ + } + + /* Read in characters and ranges, setting map bits. */ + for (;;) + { + if (p == pend) FREE_STACK_RETURN (REG_EBRACK); + + PATFETCH (c); + + /* \ might escape characters inside [...] and [^...]. */ + if ((syntax & RE_BACKSLASH_ESCAPE_IN_LISTS) && c == '\\') + { + if (p == pend) FREE_STACK_RETURN (REG_EESCAPE); + + PATFETCH (c1); + BUF_PUSH(c1); + laststart[5]++; /* Update the length of chars */ + range_start = c1; + continue; + } + + /* Could be the end of the bracket expression. If it's + not (i.e., when the bracket expression is `[]' so + far), the ']' character bit gets set way below. */ + if (c == ']' && p != p1 + 1) + break; + + /* Look ahead to see if it's a range when the last thing + was a character class. */ + if (had_char_class && c == '-' && *p != ']') + FREE_STACK_RETURN (REG_ERANGE); + + /* Look ahead to see if it's a range when the last thing + was a character: if this is a hyphen not at the + beginning or the end of a list, then it's the range + operator. */ + if (c == '-' + && !(p - 2 >= pattern && p[-2] == '[') + && !(p - 3 >= pattern && p[-3] == '[' && p[-2] == '^') + && *p != ']') + { + reg_errcode_t ret; + /* Allocate the space for range_start and range_end. */ + GET_BUFFER_SPACE (2); + /* Update the pointer to indicate end of buffer. */ + b += 2; + ret = compile_range (range_start, &p, pend, translate, + syntax, b, laststart); + if (ret != REG_NOERROR) FREE_STACK_RETURN (ret); + range_start = 0xffffffff; + } + else if (p[0] == '-' && p[1] != ']') + { /* This handles ranges made up of characters only. */ + reg_errcode_t ret; + + /* Move past the `-'. */ + PATFETCH (c1); + /* Allocate the space for range_start and range_end. */ + GET_BUFFER_SPACE (2); + /* Update the pointer to indicate end of buffer. */ + b += 2; + ret = compile_range (c, &p, pend, translate, syntax, b, + laststart); + if (ret != REG_NOERROR) FREE_STACK_RETURN (ret); + range_start = 0xffffffff; + } + + /* See if we're at the beginning of a possible character + class. */ + else if (syntax & RE_CHAR_CLASSES && c == '[' && *p == ':') + { /* Leave room for the null. */ + char str[CHAR_CLASS_MAX_LENGTH + 1]; + + PATFETCH (c); + c1 = 0; + + /* If pattern is `[[:'. */ + if (p == pend) FREE_STACK_RETURN (REG_EBRACK); + + for (;;) + { + PATFETCH (c); + if ((c == ':' && *p == ']') || p == pend) + break; + if (c1 < CHAR_CLASS_MAX_LENGTH) + str[c1++] = c; + else + /* This is in any case an invalid class name. */ + str[0] = '\0'; + } + str[c1] = '\0'; + + /* If isn't a word bracketed by `[:' and `:]': + undo the ending character, the letters, and leave + the leading `:' and `[' (but store them as character). */ + if (c == ':' && *p == ']') + { + wctype_t wt; + uintptr_t alignedp; + + /* Query the character class as wctype_t. */ + wt = IS_CHAR_CLASS (str); + if (wt == 0) + FREE_STACK_RETURN (REG_ECTYPE); + + /* Throw away the ] at the end of the character + class. */ + PATFETCH (c); + + if (p == pend) FREE_STACK_RETURN (REG_EBRACK); + + /* Allocate the space for character class. */ + GET_BUFFER_SPACE(CHAR_CLASS_SIZE); + /* Update the pointer to indicate end of buffer. */ + b += CHAR_CLASS_SIZE; + /* Move data which follow character classes + not to violate the data. */ + insert_space(CHAR_CLASS_SIZE, + laststart + 6 + laststart[1], + b - 1); + alignedp = ((uintptr_t)(laststart + 6 + laststart[1]) + + __alignof__(wctype_t) - 1) + & ~(uintptr_t)(__alignof__(wctype_t) - 1); + /* Store the character class. */ + *((wctype_t*)alignedp) = wt; + /* Update length of char_classes */ + laststart[1] += CHAR_CLASS_SIZE; + + had_char_class = true; + } + else + { + c1++; + while (c1--) + PATUNFETCH; + BUF_PUSH ('['); + BUF_PUSH (':'); + laststart[5] += 2; /* Update the length of characters */ + range_start = ':'; + had_char_class = false; + } + } + else if (syntax & RE_CHAR_CLASSES && c == '[' && (*p == '=' + || *p == '.')) + { + CHAR_TYPE str[128]; /* Should be large enough. */ + CHAR_TYPE delim = *p; /* '=' or '.' */ +# ifdef _LIBC + uint32_t nrules = + _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES); +# endif + PATFETCH (c); + c1 = 0; + + /* If pattern is `[[=' or '[[.'. */ + if (p == pend) FREE_STACK_RETURN (REG_EBRACK); + + for (;;) + { + PATFETCH (c); + if ((c == delim && *p == ']') || p == pend) + break; + if (c1 < sizeof (str) - 1) + str[c1++] = c; + else + /* This is in any case an invalid class name. */ + str[0] = '\0'; + } + str[c1] = '\0'; + + if (c == delim && *p == ']' && str[0] != '\0') + { + unsigned int i, offset; + /* If we have no collation data we use the default + collation in which each character is in a class + by itself. It also means that ASCII is the + character set and therefore we cannot have character + with more than one byte in the multibyte + representation. */ + + /* If not defined _LIBC, we push the name and + `\0' for the sake of matching performance. */ + int datasize = c1 + 1; + +# ifdef _LIBC + int32_t idx = 0; + if (nrules == 0) +# endif + { + if (c1 != 1) + FREE_STACK_RETURN (REG_ECOLLATE); + } +# ifdef _LIBC + else + { + const int32_t *table; + const int32_t *weights; + const int32_t *extra; + const int32_t *indirect; + wint_t *cp; + + /* This #include defines a local function! */ +# include + + if(delim == '=') + { + /* We push the index for equivalence class. */ + cp = (wint_t*)str; + + table = (const int32_t *) + _NL_CURRENT (LC_COLLATE, + _NL_COLLATE_TABLEWC); + weights = (const int32_t *) + _NL_CURRENT (LC_COLLATE, + _NL_COLLATE_WEIGHTWC); + extra = (const int32_t *) + _NL_CURRENT (LC_COLLATE, + _NL_COLLATE_EXTRAWC); + indirect = (const int32_t *) + _NL_CURRENT (LC_COLLATE, + _NL_COLLATE_INDIRECTWC); + + idx = findidx ((const wint_t**)&cp); + if (idx == 0 || cp < (wint_t*) str + c1) + /* This is no valid character. */ + FREE_STACK_RETURN (REG_ECOLLATE); + + str[0] = (wchar_t)idx; + } + else /* delim == '.' */ + { + /* We push collation sequence value + for collating symbol. */ + int32_t table_size; + const int32_t *symb_table; + const unsigned char *extra; + int32_t idx; + int32_t elem; + int32_t second; + int32_t hash; + char char_str[c1]; + + /* We have to convert the name to a single-byte + string. This is possible since the names + consist of ASCII characters and the internal + representation is UCS4. */ + for (i = 0; i < c1; ++i) + char_str[i] = str[i]; + + table_size = + _NL_CURRENT_WORD (LC_COLLATE, + _NL_COLLATE_SYMB_HASH_SIZEMB); + symb_table = (const int32_t *) + _NL_CURRENT (LC_COLLATE, + _NL_COLLATE_SYMB_TABLEMB); + extra = (const unsigned char *) + _NL_CURRENT (LC_COLLATE, + _NL_COLLATE_SYMB_EXTRAMB); + + /* Locate the character in the hashing table. */ + hash = elem_hash (char_str, c1); + + idx = 0; + elem = hash % table_size; + second = hash % (table_size - 2); + while (symb_table[2 * elem] != 0) + { + /* First compare the hashing value. */ + if (symb_table[2 * elem] == hash + && c1 == extra[symb_table[2 * elem + 1]] + && memcmp (str, + &extra[symb_table[2 * elem + 1] + + 1], c1) == 0) + { + /* Yep, this is the entry. */ + idx = symb_table[2 * elem + 1]; + idx += 1 + extra[idx]; + break; + } + + /* Next entry. */ + elem += second; + } + + if (symb_table[2 * elem] != 0) + { + /* Compute the index of the byte sequence + in the table. */ + idx += 1 + extra[idx]; + /* Adjust for the alignment. */ + idx = (idx + 3) & ~4; + + str[0] = (wchar_t) idx + 4; + } + else if (symb_table[2 * elem] == 0 && c1 == 1) + { + /* No valid character. Match it as a + single byte character. */ + had_char_class = false; + BUF_PUSH(str[0]); + /* Update the length of characters */ + laststart[5]++; + range_start = str[0]; + + /* Throw away the ] at the end of the + collating symbol. */ + PATFETCH (c); + /* exit from the switch block. */ + continue; + } + else + FREE_STACK_RETURN (REG_ECOLLATE); + } + datasize = 1; + } +# endif + /* Throw away the ] at the end of the equivalence + class (or collating symbol). */ + PATFETCH (c); + + /* Allocate the space for the equivalence class + (or collating symbol) (and '\0' if needed). */ + GET_BUFFER_SPACE(datasize); + /* Update the pointer to indicate end of buffer. */ + b += datasize; + + if (delim == '=') + { /* equivalence class */ + /* Calculate the offset of char_ranges, + which is next to equivalence_classes. */ + offset = laststart[1] + laststart[2] + + laststart[3] +6; + /* Insert space. */ + insert_space(datasize, laststart + offset, b - 1); + + /* Write the equivalence_class and \0. */ + for (i = 0 ; i < datasize ; i++) + laststart[offset + i] = str[i]; + + /* Update the length of equivalence_classes. */ + laststart[3] += datasize; + had_char_class = true; + } + else /* delim == '.' */ + { /* collating symbol */ + /* Calculate the offset of the equivalence_classes, + which is next to collating_symbols. */ + offset = laststart[1] + laststart[2] + 6; + /* Insert space and write the collationg_symbol + and \0. */ + insert_space(datasize, laststart + offset, b-1); + for (i = 0 ; i < datasize ; i++) + laststart[offset + i] = str[i]; + + /* In re_match_2_internal if range_start < -1, we + assume -range_start is the offset of the + collating symbol which is specified as + the character of the range start. So we assign + -(laststart[1] + laststart[2] + 6) to + range_start. */ + range_start = -(laststart[1] + laststart[2] + 6); + /* Update the length of collating_symbol. */ + laststart[2] += datasize; + had_char_class = false; + } + } + else + { + c1++; + while (c1--) + PATUNFETCH; + BUF_PUSH ('['); + BUF_PUSH (delim); + laststart[5] += 2; /* Update the length of characters */ + range_start = delim; + had_char_class = false; + } + } + else + { + had_char_class = false; + BUF_PUSH(c); + laststart[5]++; /* Update the length of characters */ + range_start = c; + } + } + +#else /* not MBS_SUPPORT */ + /* Ensure that we have enough space to push a charset: the + opcode, the length count, and the bitset; 34 bytes in all. */ + GET_BUFFER_SPACE (34); + + laststart = b; + + /* We test `*p == '^' twice, instead of using an if + statement, so we only need one BUF_PUSH. */ + BUF_PUSH (*p == '^' ? charset_not : charset); + if (*p == '^') + p++; + + /* Remember the first position in the bracket expression. */ + p1 = p; + + /* Push the number of bytes in the bitmap. */ + BUF_PUSH ((1 << BYTEWIDTH) / BYTEWIDTH); + + /* Clear the whole map. */ + bzero (b, (1 << BYTEWIDTH) / BYTEWIDTH); + + /* charset_not matches newline according to a syntax bit. */ + if ((re_opcode_t) b[-2] == charset_not + && (syntax & RE_HAT_LISTS_NOT_NEWLINE)) + SET_LIST_BIT ('\n'); + + /* Read in characters and ranges, setting map bits. */ + for (;;) + { + if (p == pend) FREE_STACK_RETURN (REG_EBRACK); + + PATFETCH (c); + + /* \ might escape characters inside [...] and [^...]. */ + if ((syntax & RE_BACKSLASH_ESCAPE_IN_LISTS) && c == '\\') + { + if (p == pend) FREE_STACK_RETURN (REG_EESCAPE); + + PATFETCH (c1); + SET_LIST_BIT (c1); + range_start = c1; + continue; + } + + /* Could be the end of the bracket expression. If it's + not (i.e., when the bracket expression is `[]' so + far), the ']' character bit gets set way below. */ + if (c == ']' && p != p1 + 1) + break; + + /* Look ahead to see if it's a range when the last thing + was a character class. */ + if (had_char_class && c == '-' && *p != ']') + FREE_STACK_RETURN (REG_ERANGE); + + /* Look ahead to see if it's a range when the last thing + was a character: if this is a hyphen not at the + beginning or the end of a list, then it's the range + operator. */ + if (c == '-' + && !(p - 2 >= pattern && p[-2] == '[') + && !(p - 3 >= pattern && p[-3] == '[' && p[-2] == '^') + && *p != ']') + { + reg_errcode_t ret + = compile_range (range_start, &p, pend, translate, + syntax, b); + if (ret != REG_NOERROR) FREE_STACK_RETURN (ret); + range_start = 0xffffffff; + } + + else if (p[0] == '-' && p[1] != ']') + { /* This handles ranges made up of characters only. */ + reg_errcode_t ret; + + /* Move past the `-'. */ + PATFETCH (c1); + + ret = compile_range (c, &p, pend, translate, syntax, b); + if (ret != REG_NOERROR) FREE_STACK_RETURN (ret); + range_start = 0xffffffff; + } + + /* See if we're at the beginning of a possible character + class. */ + + else if (syntax & RE_CHAR_CLASSES && c == '[' && *p == ':') + { /* Leave room for the null. */ + char str[CHAR_CLASS_MAX_LENGTH + 1]; + + PATFETCH (c); + c1 = 0; + + /* If pattern is `[[:'. */ + if (p == pend) FREE_STACK_RETURN (REG_EBRACK); + + for (;;) + { + PATFETCH (c); + if ((c == ':' && *p == ']') || p == pend) + break; + if (c1 < CHAR_CLASS_MAX_LENGTH) + str[c1++] = c; + else + /* This is in any case an invalid class name. */ + str[0] = '\0'; + } + str[c1] = '\0'; + + /* If isn't a word bracketed by `[:' and `:]': + undo the ending character, the letters, and leave + the leading `:' and `[' (but set bits for them). */ + if (c == ':' && *p == ']') + { +# if defined _LIBC || WIDE_CHAR_SUPPORT + boolean is_lower = STREQ (str, "lower"); + boolean is_upper = STREQ (str, "upper"); + wctype_t wt; + int ch; + + wt = IS_CHAR_CLASS (str); + if (wt == 0) + FREE_STACK_RETURN (REG_ECTYPE); + + /* Throw away the ] at the end of the character + class. */ + PATFETCH (c); + + if (p == pend) FREE_STACK_RETURN (REG_EBRACK); + + for (ch = 0; ch < 1 << BYTEWIDTH; ++ch) + { +# ifdef _LIBC + if (__iswctype (__btowc (ch), wt)) + SET_LIST_BIT (ch); +# else + if (iswctype (btowc (ch), wt)) + SET_LIST_BIT (ch); +# endif + + if (translate && (is_upper || is_lower) + && (ISUPPER (ch) || ISLOWER (ch))) + SET_LIST_BIT (ch); + } + + had_char_class = true; +# else + int ch; + boolean is_alnum = STREQ (str, "alnum"); + boolean is_alpha = STREQ (str, "alpha"); + boolean is_blank = STREQ (str, "blank"); + boolean is_cntrl = STREQ (str, "cntrl"); + boolean is_digit = STREQ (str, "digit"); + boolean is_graph = STREQ (str, "graph"); + boolean is_lower = STREQ (str, "lower"); + boolean is_print = STREQ (str, "print"); + boolean is_punct = STREQ (str, "punct"); + boolean is_space = STREQ (str, "space"); + boolean is_upper = STREQ (str, "upper"); + boolean is_xdigit = STREQ (str, "xdigit"); + + if (!IS_CHAR_CLASS (str)) + FREE_STACK_RETURN (REG_ECTYPE); + + /* Throw away the ] at the end of the character + class. */ + PATFETCH (c); + + if (p == pend) FREE_STACK_RETURN (REG_EBRACK); + + for (ch = 0; ch < 1 << BYTEWIDTH; ch++) + { + /* This was split into 3 if's to + avoid an arbitrary limit in some compiler. */ + if ( (is_alnum && ISALNUM (ch)) + || (is_alpha && ISALPHA (ch)) + || (is_blank && ISBLANK (ch)) + || (is_cntrl && ISCNTRL (ch))) + SET_LIST_BIT (ch); + if ( (is_digit && ISDIGIT (ch)) + || (is_graph && ISGRAPH (ch)) + || (is_lower && ISLOWER (ch)) + || (is_print && ISPRINT (ch))) + SET_LIST_BIT (ch); + if ( (is_punct && ISPUNCT (ch)) + || (is_space && ISSPACE (ch)) + || (is_upper && ISUPPER (ch)) + || (is_xdigit && ISXDIGIT (ch))) + SET_LIST_BIT (ch); + if ( translate && (is_upper || is_lower) + && (ISUPPER (ch) || ISLOWER (ch))) + SET_LIST_BIT (ch); + } + had_char_class = true; +# endif /* libc || wctype.h */ + } + else + { + c1++; + while (c1--) + PATUNFETCH; + SET_LIST_BIT ('['); + SET_LIST_BIT (':'); + range_start = ':'; + had_char_class = false; + } + } + else if (syntax & RE_CHAR_CLASSES && c == '[' && *p == '=') + { + unsigned char str[MB_LEN_MAX + 1]; +# ifdef _LIBC + uint32_t nrules = + _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES); +# endif + + PATFETCH (c); + c1 = 0; + + /* If pattern is `[[='. */ + if (p == pend) FREE_STACK_RETURN (REG_EBRACK); + + for (;;) + { + PATFETCH (c); + if ((c == '=' && *p == ']') || p == pend) + break; + if (c1 < MB_LEN_MAX) + str[c1++] = c; + else + /* This is in any case an invalid class name. */ + str[0] = '\0'; + } + str[c1] = '\0'; + + if (c == '=' && *p == ']' && str[0] != '\0') + { + /* If we have no collation data we use the default + collation in which each character is in a class + by itself. It also means that ASCII is the + character set and therefore we cannot have character + with more than one byte in the multibyte + representation. */ +# ifdef _LIBC + if (nrules == 0) +# endif + { + if (c1 != 1) + FREE_STACK_RETURN (REG_ECOLLATE); + + /* Throw away the ] at the end of the equivalence + class. */ + PATFETCH (c); + + /* Set the bit for the character. */ + SET_LIST_BIT (str[0]); + } +# ifdef _LIBC + else + { + /* Try to match the byte sequence in `str' against + those known to the collate implementation. + First find out whether the bytes in `str' are + actually from exactly one character. */ + const int32_t *table; + const unsigned char *weights; + const unsigned char *extra; + const int32_t *indirect; + int32_t idx; + const unsigned char *cp = str; + int ch; + + /* This #include defines a local function! */ +# include + + table = (const int32_t *) + _NL_CURRENT (LC_COLLATE, _NL_COLLATE_TABLEMB); + weights = (const unsigned char *) + _NL_CURRENT (LC_COLLATE, _NL_COLLATE_WEIGHTMB); + extra = (const unsigned char *) + _NL_CURRENT (LC_COLLATE, _NL_COLLATE_EXTRAMB); + indirect = (const int32_t *) + _NL_CURRENT (LC_COLLATE, _NL_COLLATE_INDIRECTMB); + + idx = findidx (&cp); + if (idx == 0 || cp < str + c1) + /* This is no valid character. */ + FREE_STACK_RETURN (REG_ECOLLATE); + + /* Throw away the ] at the end of the equivalence + class. */ + PATFETCH (c); + + /* Now we have to go throught the whole table + and find all characters which have the same + first level weight. + + XXX Note that this is not entirely correct. + we would have to match multibyte sequences + but this is not possible with the current + implementation. */ + for (ch = 1; ch < 256; ++ch) + /* XXX This test would have to be changed if we + would allow matching multibyte sequences. */ + if (table[ch] > 0) + { + int32_t idx2 = table[ch]; + size_t len = weights[idx2]; + + /* Test whether the lenghts match. */ + if (weights[idx] == len) + { + /* They do. New compare the bytes of + the weight. */ + size_t cnt = 0; + + while (cnt < len + && (weights[idx + 1 + cnt] + == weights[idx2 + 1 + cnt])) + ++cnt; + + if (cnt == len) + /* They match. Mark the character as + acceptable. */ + SET_LIST_BIT (ch); + } + } + } +# endif + had_char_class = true; + } + else + { + c1++; + while (c1--) + PATUNFETCH; + SET_LIST_BIT ('['); + SET_LIST_BIT ('='); + range_start = '='; + had_char_class = false; + } + } + else if (syntax & RE_CHAR_CLASSES && c == '[' && *p == '.') + { + unsigned char str[128]; /* Should be large enough. */ +# ifdef _LIBC + uint32_t nrules = + _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES); +# endif + + PATFETCH (c); + c1 = 0; + + /* If pattern is `[[.'. */ + if (p == pend) FREE_STACK_RETURN (REG_EBRACK); + + for (;;) + { + PATFETCH (c); + if ((c == '.' && *p == ']') || p == pend) + break; + if (c1 < sizeof (str)) + str[c1++] = c; + else + /* This is in any case an invalid class name. */ + str[0] = '\0'; + } + str[c1] = '\0'; + + if (c == '.' && *p == ']' && str[0] != '\0') + { + /* If we have no collation data we use the default + collation in which each character is the name + for its own class which contains only the one + character. It also means that ASCII is the + character set and therefore we cannot have character + with more than one byte in the multibyte + representation. */ +# ifdef _LIBC + if (nrules == 0) +# endif + { + if (c1 != 1) + FREE_STACK_RETURN (REG_ECOLLATE); + + /* Throw away the ] at the end of the equivalence + class. */ + PATFETCH (c); + + /* Set the bit for the character. */ + SET_LIST_BIT (str[0]); + range_start = ((const unsigned char *) str)[0]; + } +# ifdef _LIBC + else + { + /* Try to match the byte sequence in `str' against + those known to the collate implementation. + First find out whether the bytes in `str' are + actually from exactly one character. */ + int32_t table_size; + const int32_t *symb_table; + const unsigned char *extra; + int32_t idx; + int32_t elem; + int32_t second; + int32_t hash; + + table_size = + _NL_CURRENT_WORD (LC_COLLATE, + _NL_COLLATE_SYMB_HASH_SIZEMB); + symb_table = (const int32_t *) + _NL_CURRENT (LC_COLLATE, + _NL_COLLATE_SYMB_TABLEMB); + extra = (const unsigned char *) + _NL_CURRENT (LC_COLLATE, + _NL_COLLATE_SYMB_EXTRAMB); + + /* Locate the character in the hashing table. */ + hash = elem_hash (str, c1); + + idx = 0; + elem = hash % table_size; + second = hash % (table_size - 2); + while (symb_table[2 * elem] != 0) + { + /* First compare the hashing value. */ + if (symb_table[2 * elem] == hash + && c1 == extra[symb_table[2 * elem + 1]] + && memcmp (str, + &extra[symb_table[2 * elem + 1] + + 1], + c1) == 0) + { + /* Yep, this is the entry. */ + idx = symb_table[2 * elem + 1]; + idx += 1 + extra[idx]; + break; + } + + /* Next entry. */ + elem += second; + } + + if (symb_table[2 * elem] == 0) + /* This is no valid character. */ + FREE_STACK_RETURN (REG_ECOLLATE); + + /* Throw away the ] at the end of the equivalence + class. */ + PATFETCH (c); + + /* Now add the multibyte character(s) we found + to the accept list. + + XXX Note that this is not entirely correct. + we would have to match multibyte sequences + but this is not possible with the current + implementation. Also, we have to match + collating symbols, which expand to more than + one file, as a whole and not allow the + individual bytes. */ + c1 = extra[idx++]; + if (c1 == 1) + range_start = extra[idx]; + while (c1-- > 0) + { + SET_LIST_BIT (extra[idx]); + ++idx; + } + } +# endif + had_char_class = false; + } + else + { + c1++; + while (c1--) + PATUNFETCH; + SET_LIST_BIT ('['); + SET_LIST_BIT ('.'); + range_start = '.'; + had_char_class = false; + } + } + else + { + had_char_class = false; + SET_LIST_BIT (c); + range_start = c; + } + } + + /* Discard any (non)matching list bytes that are all 0 at the + end of the map. Decrease the map-length byte too. */ + while ((int) b[-1] > 0 && b[b[-1] - 1] == 0) + b[-1]--; + b += b[-1]; +#endif /* MBS_SUPPORT */ + } + break; + + + case '(': + if (syntax & RE_NO_BK_PARENS) + goto handle_open; + else + goto normal_char; + + + case ')': + if (syntax & RE_NO_BK_PARENS) + goto handle_close; + else + goto normal_char; + + + case '\n': + if (syntax & RE_NEWLINE_ALT) + goto handle_alt; + else + goto normal_char; + + + case '|': + if (syntax & RE_NO_BK_VBAR) + goto handle_alt; + else + goto normal_char; + + + case '{': + if (syntax & RE_INTERVALS && syntax & RE_NO_BK_BRACES) + goto handle_interval; + else + goto normal_char; + + + case '\\': + if (p == pend) FREE_STACK_RETURN (REG_EESCAPE); + + /* Do not translate the character after the \, so that we can + distinguish, e.g., \B from \b, even if we normally would + translate, e.g., B to b. */ + PATFETCH_RAW (c); + + switch (c) + { + case '(': + if (syntax & RE_NO_BK_PARENS) + goto normal_backslash; + + handle_open: + bufp->re_nsub++; + regnum++; + + if (COMPILE_STACK_FULL) + { + RETALLOC (compile_stack.stack, compile_stack.size << 1, + compile_stack_elt_t); + if (compile_stack.stack == NULL) return REG_ESPACE; + + compile_stack.size <<= 1; + } + + /* These are the values to restore when we hit end of this + group. They are all relative offsets, so that if the + whole pattern moves because of realloc, they will still + be valid. */ + COMPILE_STACK_TOP.begalt_offset = begalt - COMPILED_BUFFER_VAR; + COMPILE_STACK_TOP.fixup_alt_jump + = fixup_alt_jump ? fixup_alt_jump - COMPILED_BUFFER_VAR + 1 : 0; + COMPILE_STACK_TOP.laststart_offset = b - COMPILED_BUFFER_VAR; + COMPILE_STACK_TOP.regnum = regnum; + + /* We will eventually replace the 0 with the number of + groups inner to this one. But do not push a + start_memory for groups beyond the last one we can + represent in the compiled pattern. */ + if (regnum <= MAX_REGNUM) + { + COMPILE_STACK_TOP.inner_group_offset = b + - COMPILED_BUFFER_VAR + 2; + BUF_PUSH_3 (start_memory, regnum, 0); + } + + compile_stack.avail++; + + fixup_alt_jump = 0; + laststart = 0; + begalt = b; + /* If we've reached MAX_REGNUM groups, then this open + won't actually generate any code, so we'll have to + clear pending_exact explicitly. */ + pending_exact = 0; + break; + + + case ')': + if (syntax & RE_NO_BK_PARENS) goto normal_backslash; + + if (COMPILE_STACK_EMPTY) + { + if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD) + goto normal_backslash; + else + FREE_STACK_RETURN (REG_ERPAREN); + } + + handle_close: + if (fixup_alt_jump) + { /* Push a dummy failure point at the end of the + alternative for a possible future + `pop_failure_jump' to pop. See comments at + `push_dummy_failure' in `re_match_2'. */ + BUF_PUSH (push_dummy_failure); + + /* We allocated space for this jump when we assigned + to `fixup_alt_jump', in the `handle_alt' case below. */ + STORE_JUMP (jump_past_alt, fixup_alt_jump, b - 1); + } + + /* See similar code for backslashed left paren above. */ + if (COMPILE_STACK_EMPTY) + { + if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD) + goto normal_char; + else + FREE_STACK_RETURN (REG_ERPAREN); + } + + /* Since we just checked for an empty stack above, this + ``can't happen''. */ + assert (compile_stack.avail != 0); + { + /* We don't just want to restore into `regnum', because + later groups should continue to be numbered higher, + as in `(ab)c(de)' -- the second group is #2. */ + regnum_t this_group_regnum; + + compile_stack.avail--; + begalt = COMPILED_BUFFER_VAR + COMPILE_STACK_TOP.begalt_offset; + fixup_alt_jump + = COMPILE_STACK_TOP.fixup_alt_jump + ? COMPILED_BUFFER_VAR + COMPILE_STACK_TOP.fixup_alt_jump - 1 + : 0; + laststart = COMPILED_BUFFER_VAR + COMPILE_STACK_TOP.laststart_offset; + this_group_regnum = COMPILE_STACK_TOP.regnum; + /* If we've reached MAX_REGNUM groups, then this open + won't actually generate any code, so we'll have to + clear pending_exact explicitly. */ + pending_exact = 0; + + /* We're at the end of the group, so now we know how many + groups were inside this one. */ + if (this_group_regnum <= MAX_REGNUM) + { + US_CHAR_TYPE *inner_group_loc + = COMPILED_BUFFER_VAR + COMPILE_STACK_TOP.inner_group_offset; + + *inner_group_loc = regnum - this_group_regnum; + BUF_PUSH_3 (stop_memory, this_group_regnum, + regnum - this_group_regnum); + } + } + break; + + + case '|': /* `\|'. */ + if (syntax & RE_LIMITED_OPS || syntax & RE_NO_BK_VBAR) + goto normal_backslash; + handle_alt: + if (syntax & RE_LIMITED_OPS) + goto normal_char; + + /* Insert before the previous alternative a jump which + jumps to this alternative if the former fails. */ + GET_BUFFER_SPACE (1 + OFFSET_ADDRESS_SIZE); + INSERT_JUMP (on_failure_jump, begalt, + b + 2 + 2 * OFFSET_ADDRESS_SIZE); + pending_exact = 0; + b += 1 + OFFSET_ADDRESS_SIZE; + + /* The alternative before this one has a jump after it + which gets executed if it gets matched. Adjust that + jump so it will jump to this alternative's analogous + jump (put in below, which in turn will jump to the next + (if any) alternative's such jump, etc.). The last such + jump jumps to the correct final destination. A picture: + _____ _____ + | | | | + | v | v + a | b | c + + If we are at `b', then fixup_alt_jump right now points to a + three-byte space after `a'. We'll put in the jump, set + fixup_alt_jump to right after `b', and leave behind three + bytes which we'll fill in when we get to after `c'. */ + + if (fixup_alt_jump) + STORE_JUMP (jump_past_alt, fixup_alt_jump, b); + + /* Mark and leave space for a jump after this alternative, + to be filled in later either by next alternative or + when know we're at the end of a series of alternatives. */ + fixup_alt_jump = b; + GET_BUFFER_SPACE (1 + OFFSET_ADDRESS_SIZE); + b += 1 + OFFSET_ADDRESS_SIZE; + + laststart = 0; + begalt = b; + break; + + + case '{': + /* If \{ is a literal. */ + if (!(syntax & RE_INTERVALS) + /* If we're at `\{' and it's not the open-interval + operator. */ + || (syntax & RE_NO_BK_BRACES)) + goto normal_backslash; + + handle_interval: + { + /* If got here, then the syntax allows intervals. */ + + /* At least (most) this many matches must be made. */ + int lower_bound = -1, upper_bound = -1; + + /* Place in the uncompiled pattern (i.e., just after + the '{') to go back to if the interval is invalid. */ + const CHAR_TYPE *beg_interval = p; + + if (p == pend) + goto invalid_interval; + + GET_UNSIGNED_NUMBER (lower_bound); + + if (c == ',') + { + GET_UNSIGNED_NUMBER (upper_bound); + if (upper_bound < 0) + upper_bound = RE_DUP_MAX; + } + else + /* Interval such as `{1}' => match exactly once. */ + upper_bound = lower_bound; + + if (! (0 <= lower_bound && lower_bound <= upper_bound)) + goto invalid_interval; + + if (!(syntax & RE_NO_BK_BRACES)) + { + if (c != '\\' || p == pend) + goto invalid_interval; + PATFETCH (c); + } + + if (c != '}') + goto invalid_interval; + + /* If it's invalid to have no preceding re. */ + if (!laststart) + { + if (syntax & RE_CONTEXT_INVALID_OPS + && !(syntax & RE_INVALID_INTERVAL_ORD)) + FREE_STACK_RETURN (REG_BADRPT); + else if (syntax & RE_CONTEXT_INDEP_OPS) + laststart = b; + else + goto unfetch_interval; + } + + /* We just parsed a valid interval. */ + + if (RE_DUP_MAX < upper_bound) + FREE_STACK_RETURN (REG_BADBR); + + /* If the upper bound is zero, don't want to succeed at + all; jump from `laststart' to `b + 3', which will be + the end of the buffer after we insert the jump. */ + /* ifdef MBS_SUPPORT, 'b + 1 + OFFSET_ADDRESS_SIZE' + instead of 'b + 3'. */ + if (upper_bound == 0) + { + GET_BUFFER_SPACE (1 + OFFSET_ADDRESS_SIZE); + INSERT_JUMP (jump, laststart, b + 1 + + OFFSET_ADDRESS_SIZE); + b += 1 + OFFSET_ADDRESS_SIZE; + } + + /* Otherwise, we have a nontrivial interval. When + we're all done, the pattern will look like: + set_number_at + set_number_at + succeed_n + + jump_n + (The upper bound and `jump_n' are omitted if + `upper_bound' is 1, though.) */ + else + { /* If the upper bound is > 1, we need to insert + more at the end of the loop. */ + unsigned nbytes = 2 + 4 * OFFSET_ADDRESS_SIZE + + (upper_bound > 1) * (2 + 4 * OFFSET_ADDRESS_SIZE); + + GET_BUFFER_SPACE (nbytes); + + /* Initialize lower bound of the `succeed_n', even + though it will be set during matching by its + attendant `set_number_at' (inserted next), + because `re_compile_fastmap' needs to know. + Jump to the `jump_n' we might insert below. */ + INSERT_JUMP2 (succeed_n, laststart, + b + 1 + 2 * OFFSET_ADDRESS_SIZE + + (upper_bound > 1) * (1 + 2 * OFFSET_ADDRESS_SIZE) + , lower_bound); + b += 1 + 2 * OFFSET_ADDRESS_SIZE; + + /* Code to initialize the lower bound. Insert + before the `succeed_n'. The `5' is the last two + bytes of this `set_number_at', plus 3 bytes of + the following `succeed_n'. */ + /* ifdef MBS_SUPPORT, The '1+2*OFFSET_ADDRESS_SIZE' + is the 'set_number_at', plus '1+OFFSET_ADDRESS_SIZE' + of the following `succeed_n'. */ + insert_op2 (set_number_at, laststart, 1 + + 2 * OFFSET_ADDRESS_SIZE, lower_bound, b); + b += 1 + 2 * OFFSET_ADDRESS_SIZE; + + if (upper_bound > 1) + { /* More than one repetition is allowed, so + append a backward jump to the `succeed_n' + that starts this interval. + + When we've reached this during matching, + we'll have matched the interval once, so + jump back only `upper_bound - 1' times. */ + STORE_JUMP2 (jump_n, b, laststart + + 2 * OFFSET_ADDRESS_SIZE + 1, + upper_bound - 1); + b += 1 + 2 * OFFSET_ADDRESS_SIZE; + + /* The location we want to set is the second + parameter of the `jump_n'; that is `b-2' as + an absolute address. `laststart' will be + the `set_number_at' we're about to insert; + `laststart+3' the number to set, the source + for the relative address. But we are + inserting into the middle of the pattern -- + so everything is getting moved up by 5. + Conclusion: (b - 2) - (laststart + 3) + 5, + i.e., b - laststart. + + We insert this at the beginning of the loop + so that if we fail during matching, we'll + reinitialize the bounds. */ + insert_op2 (set_number_at, laststart, b - laststart, + upper_bound - 1, b); + b += 1 + 2 * OFFSET_ADDRESS_SIZE; + } + } + pending_exact = 0; + break; + + invalid_interval: + if (!(syntax & RE_INVALID_INTERVAL_ORD)) + FREE_STACK_RETURN (p == pend ? REG_EBRACE : REG_BADBR); + unfetch_interval: + /* Match the characters as literals. */ + p = beg_interval; + c = '{'; + if (syntax & RE_NO_BK_BRACES) + goto normal_char; + else + goto normal_backslash; + } + +#ifdef emacs + /* There is no way to specify the before_dot and after_dot + operators. rms says this is ok. --karl */ + case '=': + BUF_PUSH (at_dot); + break; + + case 's': + laststart = b; + PATFETCH (c); + BUF_PUSH_2 (syntaxspec, syntax_spec_code[c]); + break; + + case 'S': + laststart = b; + PATFETCH (c); + BUF_PUSH_2 (notsyntaxspec, syntax_spec_code[c]); + break; +#endif /* emacs */ + + + case 'w': + if (syntax & RE_NO_GNU_OPS) + goto normal_char; + laststart = b; + BUF_PUSH (wordchar); + break; + + + case 'W': + if (syntax & RE_NO_GNU_OPS) + goto normal_char; + laststart = b; + BUF_PUSH (notwordchar); + break; + + + case '<': + if (syntax & RE_NO_GNU_OPS) + goto normal_char; + BUF_PUSH (wordbeg); + break; + + case '>': + if (syntax & RE_NO_GNU_OPS) + goto normal_char; + BUF_PUSH (wordend); + break; + + case 'b': + if (syntax & RE_NO_GNU_OPS) + goto normal_char; + BUF_PUSH (wordbound); + break; + + case 'B': + if (syntax & RE_NO_GNU_OPS) + goto normal_char; + BUF_PUSH (notwordbound); + break; + + case '`': + if (syntax & RE_NO_GNU_OPS) + goto normal_char; + BUF_PUSH (begbuf); + break; + + case '\'': + if (syntax & RE_NO_GNU_OPS) + goto normal_char; + BUF_PUSH (endbuf); + break; + + case '1': case '2': case '3': case '4': case '5': + case '6': case '7': case '8': case '9': + if (syntax & RE_NO_BK_REFS) + goto normal_char; + + c1 = c - '0'; + + if (c1 > regnum) + FREE_STACK_RETURN (REG_ESUBREG); + + /* Can't back reference to a subexpression if inside of it. */ + if (group_in_compile_stack (compile_stack, (regnum_t) c1)) + goto normal_char; + + laststart = b; + BUF_PUSH_2 (duplicate, c1); + break; + + + case '+': + case '?': + if (syntax & RE_BK_PLUS_QM) + goto handle_plus; + else + goto normal_backslash; + + default: + normal_backslash: + /* You might think it would be useful for \ to mean + not to translate; but if we don't translate it + it will never match anything. */ + c = TRANSLATE (c); + goto normal_char; + } + break; + + + default: + /* Expects the character in `c'. */ + normal_char: + /* If no exactn currently being built. */ + if (!pending_exact +#ifdef MBS_SUPPORT + /* If last exactn handle binary(or character) and + new exactn handle character(or binary). */ + || is_exactn_bin != is_binary[p - 1 - pattern] +#endif /* MBS_SUPPORT */ + + /* If last exactn not at current position. */ + || pending_exact + *pending_exact + 1 != b + + /* We have only one byte following the exactn for the count. */ + || *pending_exact == (1 << BYTEWIDTH) - 1 + + /* If followed by a repetition operator. */ + || *p == '*' || *p == '^' + || ((syntax & RE_BK_PLUS_QM) + ? *p == '\\' && (p[1] == '+' || p[1] == '?') + : (*p == '+' || *p == '?')) + || ((syntax & RE_INTERVALS) + && ((syntax & RE_NO_BK_BRACES) + ? *p == '{' + : (p[0] == '\\' && p[1] == '{')))) + { + /* Start building a new exactn. */ + + laststart = b; + +#ifdef MBS_SUPPORT + /* Is this exactn binary data or character? */ + is_exactn_bin = is_binary[p - 1 - pattern]; + if (is_exactn_bin) + BUF_PUSH_2 (exactn_bin, 0); + else + BUF_PUSH_2 (exactn, 0); +#else + BUF_PUSH_2 (exactn, 0); +#endif /* MBS_SUPPORT */ + pending_exact = b - 1; + } + + BUF_PUSH (c); + (*pending_exact)++; + break; + } /* switch (c) */ + } /* while p != pend */ + + + /* Through the pattern now. */ + + if (fixup_alt_jump) + STORE_JUMP (jump_past_alt, fixup_alt_jump, b); + + if (!COMPILE_STACK_EMPTY) + FREE_STACK_RETURN (REG_EPAREN); + + /* If we don't want backtracking, force success + the first time we reach the end of the compiled pattern. */ + if (syntax & RE_NO_POSIX_BACKTRACKING) + BUF_PUSH (succeed); + +#ifdef MBS_SUPPORT + free (pattern); + free (mbs_offset); + free (is_binary); +#endif + free (compile_stack.stack); + + /* We have succeeded; set the length of the buffer. */ +#ifdef MBS_SUPPORT + bufp->used = (uintptr_t) b - (uintptr_t) COMPILED_BUFFER_VAR; +#else + bufp->used = b - bufp->buffer; +#endif + +#ifdef DEBUG + if (debug) + { + DEBUG_PRINT1 ("\nCompiled pattern: \n"); + print_compiled_pattern (bufp); + } +#endif /* DEBUG */ + +#ifndef MATCH_MAY_ALLOCATE + /* Initialize the failure stack to the largest possible stack. This + isn't necessary unless we're trying to avoid calling alloca in + the search and match routines. */ + { + int num_regs = bufp->re_nsub + 1; + + /* Since DOUBLE_FAIL_STACK refuses to double only if the current size + is strictly greater than re_max_failures, the largest possible stack + is 2 * re_max_failures failure points. */ + if (fail_stack.size < (2 * re_max_failures * MAX_FAILURE_ITEMS)) + { + fail_stack.size = (2 * re_max_failures * MAX_FAILURE_ITEMS); + +# ifdef emacs + if (! fail_stack.stack) + fail_stack.stack + = (fail_stack_elt_t *) xmalloc (fail_stack.size + * sizeof (fail_stack_elt_t)); + else + fail_stack.stack + = (fail_stack_elt_t *) xrealloc (fail_stack.stack, + (fail_stack.size + * sizeof (fail_stack_elt_t))); +# else /* not emacs */ + if (! fail_stack.stack) + fail_stack.stack + = (fail_stack_elt_t *) malloc (fail_stack.size + * sizeof (fail_stack_elt_t)); + else + fail_stack.stack + = (fail_stack_elt_t *) realloc (fail_stack.stack, + (fail_stack.size + * sizeof (fail_stack_elt_t))); +# endif /* not emacs */ + } + + regex_grow_registers (num_regs); + } +#endif /* not MATCH_MAY_ALLOCATE */ + + return REG_NOERROR; +} /* regex_compile */ + +/* Subroutines for `regex_compile'. */ + +/* Store OP at LOC followed by two-byte integer parameter ARG. */ +/* ifdef MBS_SUPPORT, integer parameter is 1 wchar_t. */ + +static void +store_op1 (op, loc, arg) + re_opcode_t op; + US_CHAR_TYPE *loc; + int arg; +{ + *loc = (US_CHAR_TYPE) op; + STORE_NUMBER (loc + 1, arg); +} + + +/* Like `store_op1', but for two two-byte parameters ARG1 and ARG2. */ +/* ifdef MBS_SUPPORT, integer parameter is 1 wchar_t. */ + +static void +store_op2 (op, loc, arg1, arg2) + re_opcode_t op; + US_CHAR_TYPE *loc; + int arg1, arg2; +{ + *loc = (US_CHAR_TYPE) op; + STORE_NUMBER (loc + 1, arg1); + STORE_NUMBER (loc + 1 + OFFSET_ADDRESS_SIZE, arg2); +} + + +/* Copy the bytes from LOC to END to open up three bytes of space at LOC + for OP followed by two-byte integer parameter ARG. */ +/* ifdef MBS_SUPPORT, integer parameter is 1 wchar_t. */ + +static void +insert_op1 (op, loc, arg, end) + re_opcode_t op; + US_CHAR_TYPE *loc; + int arg; + US_CHAR_TYPE *end; +{ + register US_CHAR_TYPE *pfrom = end; + register US_CHAR_TYPE *pto = end + 1 + OFFSET_ADDRESS_SIZE; + + while (pfrom != loc) + *--pto = *--pfrom; + + store_op1 (op, loc, arg); +} + + +/* Like `insert_op1', but for two two-byte parameters ARG1 and ARG2. */ +/* ifdef MBS_SUPPORT, integer parameter is 1 wchar_t. */ + +static void +insert_op2 (op, loc, arg1, arg2, end) + re_opcode_t op; + US_CHAR_TYPE *loc; + int arg1, arg2; + US_CHAR_TYPE *end; +{ + register US_CHAR_TYPE *pfrom = end; + register US_CHAR_TYPE *pto = end + 1 + 2 * OFFSET_ADDRESS_SIZE; + + while (pfrom != loc) + *--pto = *--pfrom; + + store_op2 (op, loc, arg1, arg2); +} + + +/* P points to just after a ^ in PATTERN. Return true if that ^ comes + after an alternative or a begin-subexpression. We assume there is at + least one character before the ^. */ + +static boolean +at_begline_loc_p (pattern, p, syntax) + const CHAR_TYPE *pattern, *p; + reg_syntax_t syntax; +{ + const CHAR_TYPE *prev = p - 2; + boolean prev_prev_backslash = prev > pattern && prev[-1] == '\\'; + + return + /* After a subexpression? */ + (*prev == '(' && (syntax & RE_NO_BK_PARENS || prev_prev_backslash)) + /* After an alternative? */ + || (*prev == '|' && (syntax & RE_NO_BK_VBAR || prev_prev_backslash)); +} + + +/* The dual of at_begline_loc_p. This one is for $. We assume there is + at least one character after the $, i.e., `P < PEND'. */ + +static boolean +at_endline_loc_p (p, pend, syntax) + const CHAR_TYPE *p, *pend; + reg_syntax_t syntax; +{ + const CHAR_TYPE *next = p; + boolean next_backslash = *next == '\\'; + const CHAR_TYPE *next_next = p + 1 < pend ? p + 1 : 0; + + return + /* Before a subexpression? */ + (syntax & RE_NO_BK_PARENS ? *next == ')' + : next_backslash && next_next && *next_next == ')') + /* Before an alternative? */ + || (syntax & RE_NO_BK_VBAR ? *next == '|' + : next_backslash && next_next && *next_next == '|'); +} + + +/* Returns true if REGNUM is in one of COMPILE_STACK's elements and + false if it's not. */ + +static boolean +group_in_compile_stack (compile_stack, regnum) + compile_stack_type compile_stack; + regnum_t regnum; +{ + int this_element; + + for (this_element = compile_stack.avail - 1; + this_element >= 0; + this_element--) + if (compile_stack.stack[this_element].regnum == regnum) + return true; + + return false; +} + +#ifdef MBS_SUPPORT +/* This insert space, which size is "num", into the pattern at "loc". + "end" must point the end of the allocated buffer. */ +static void +insert_space (num, loc, end) + int num; + CHAR_TYPE *loc; + CHAR_TYPE *end; +{ + register CHAR_TYPE *pto = end; + register CHAR_TYPE *pfrom = end - num; + + while (pfrom >= loc) + *pto-- = *pfrom--; +} +#endif /* MBS_SUPPORT */ + +#ifdef MBS_SUPPORT +static reg_errcode_t +compile_range (range_start_char, p_ptr, pend, translate, syntax, b, + char_set) + CHAR_TYPE range_start_char; + const CHAR_TYPE **p_ptr, *pend; + CHAR_TYPE *char_set, *b; + RE_TRANSLATE_TYPE translate; + reg_syntax_t syntax; +{ + const CHAR_TYPE *p = *p_ptr; + CHAR_TYPE range_start, range_end; + reg_errcode_t ret; +# ifdef _LIBC + uint32_t nrules; + uint32_t start_val, end_val; +# endif + if (p == pend) + return REG_ERANGE; + +# ifdef _LIBC + nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES); + if (nrules != 0) + { + const char *collseq = (const char *) _NL_CURRENT(LC_COLLATE, + _NL_COLLATE_COLLSEQWC); + const unsigned char *extra = (const unsigned char *) + _NL_CURRENT (LC_COLLATE, _NL_COLLATE_SYMB_EXTRAMB); + + if (range_start_char < -1) + { + /* range_start is a collating symbol. */ + int32_t *wextra; + /* Retreive the index and get collation sequence value. */ + wextra = (int32_t*)(extra + char_set[-range_start_char]); + start_val = wextra[1 + *wextra]; + } + else + start_val = collseq_table_lookup(collseq, TRANSLATE(range_start_char)); + + end_val = collseq_table_lookup (collseq, TRANSLATE (p[0])); + + /* Report an error if the range is empty and the syntax prohibits + this. */ + ret = ((syntax & RE_NO_EMPTY_RANGES) + && (start_val > end_val))? REG_ERANGE : REG_NOERROR; + + /* Insert space to the end of the char_ranges. */ + insert_space(2, b - char_set[5] - 2, b - 1); + *(b - char_set[5] - 2) = (wchar_t)start_val; + *(b - char_set[5] - 1) = (wchar_t)end_val; + char_set[4]++; /* ranges_index */ + } + else +# endif + { + range_start = (range_start_char >= 0)? TRANSLATE (range_start_char): + range_start_char; + range_end = TRANSLATE (p[0]); + /* Report an error if the range is empty and the syntax prohibits + this. */ + ret = ((syntax & RE_NO_EMPTY_RANGES) + && (range_start > range_end))? REG_ERANGE : REG_NOERROR; + + /* Insert space to the end of the char_ranges. */ + insert_space(2, b - char_set[5] - 2, b - 1); + *(b - char_set[5] - 2) = range_start; + *(b - char_set[5] - 1) = range_end; + char_set[4]++; /* ranges_index */ + } + /* Have to increment the pointer into the pattern string, so the + caller isn't still at the ending character. */ + (*p_ptr)++; + + return ret; +} +#else +/* Read the ending character of a range (in a bracket expression) from the + uncompiled pattern *P_PTR (which ends at PEND). We assume the + starting character is in `P[-2]'. (`P[-1]' is the character `-'.) + Then we set the translation of all bits between the starting and + ending characters (inclusive) in the compiled pattern B. + + Return an error code. + + We use these short variable names so we can use the same macros as + `regex_compile' itself. */ + +static reg_errcode_t +compile_range (range_start_char, p_ptr, pend, translate, syntax, b) + unsigned int range_start_char; + const char **p_ptr, *pend; + RE_TRANSLATE_TYPE translate; + reg_syntax_t syntax; + unsigned char *b; +{ + unsigned this_char; + const char *p = *p_ptr; + reg_errcode_t ret; +# if _LIBC + const unsigned char *collseq; + unsigned int start_colseq; + unsigned int end_colseq; +# else + unsigned end_char; +# endif + + if (p == pend) + return REG_ERANGE; + + /* Have to increment the pointer into the pattern string, so the + caller isn't still at the ending character. */ + (*p_ptr)++; + + /* Report an error if the range is empty and the syntax prohibits this. */ + ret = syntax & RE_NO_EMPTY_RANGES ? REG_ERANGE : REG_NOERROR; + +# if _LIBC + collseq = (const unsigned char *) _NL_CURRENT (LC_COLLATE, + _NL_COLLATE_COLLSEQMB); + + start_colseq = collseq[(unsigned char) TRANSLATE (range_start_char)]; + end_colseq = collseq[(unsigned char) TRANSLATE (p[0])]; + for (this_char = 0; this_char <= (unsigned char) -1; ++this_char) + { + unsigned int this_colseq = collseq[(unsigned char) TRANSLATE (this_char)]; + + if (start_colseq <= this_colseq && this_colseq <= end_colseq) + { + SET_LIST_BIT (TRANSLATE (this_char)); + ret = REG_NOERROR; + } + } +# else + /* Here we see why `this_char' has to be larger than an `unsigned + char' -- we would otherwise go into an infinite loop, since all + characters <= 0xff. */ + range_start_char = TRANSLATE (range_start_char); + /* TRANSLATE(p[0]) is casted to char (not unsigned char) in TRANSLATE, + and some compilers cast it to int implicitly, so following for_loop + may fall to (almost) infinite loop. + e.g. If translate[p[0]] = 0xff, end_char may equals to 0xffffffff. + To avoid this, we cast p[0] to unsigned int and truncate it. */ + end_char = ((unsigned)TRANSLATE(p[0]) & ((1 << BYTEWIDTH) - 1)); + + for (this_char = range_start_char; this_char <= end_char; ++this_char) + { + SET_LIST_BIT (TRANSLATE (this_char)); + ret = REG_NOERROR; + } +# endif + + return ret; +} +#endif /* MBS_SUPPORT */ + +/* re_compile_fastmap computes a ``fastmap'' for the compiled pattern in + BUFP. A fastmap records which of the (1 << BYTEWIDTH) possible + characters can start a string that matches the pattern. This fastmap + is used by re_search to skip quickly over impossible starting points. + + The caller must supply the address of a (1 << BYTEWIDTH)-byte data + area as BUFP->fastmap. + + We set the `fastmap', `fastmap_accurate', and `can_be_null' fields in + the pattern buffer. + + Returns 0 if we succeed, -2 if an internal error. */ + +#ifdef MBS_SUPPORT +/* local function for re_compile_fastmap. + truncate wchar_t character to char. */ +static unsigned char truncate_wchar (CHAR_TYPE c); + +static unsigned char +truncate_wchar (c) + CHAR_TYPE c; +{ + unsigned char buf[MB_LEN_MAX]; + int retval = wctomb(buf, c); + return retval > 0 ? buf[0] : (unsigned char)c; +} +#endif /* MBS_SUPPORT */ + +int +re_compile_fastmap (bufp) + struct re_pattern_buffer *bufp; +{ + int j, k; +#ifdef MATCH_MAY_ALLOCATE + fail_stack_type fail_stack; +#endif +#ifndef REGEX_MALLOC + char *destination; +#endif + + register char *fastmap = bufp->fastmap; + +#ifdef MBS_SUPPORT + /* We need to cast pattern to (wchar_t*), because we casted this compiled + pattern to (char*) in regex_compile. */ + US_CHAR_TYPE *pattern = (US_CHAR_TYPE*)bufp->buffer; + register US_CHAR_TYPE *pend = (US_CHAR_TYPE*) (bufp->buffer + bufp->used); +#else + US_CHAR_TYPE *pattern = bufp->buffer; + register US_CHAR_TYPE *pend = pattern + bufp->used; +#endif /* MBS_SUPPORT */ + US_CHAR_TYPE *p = pattern; + +#ifdef REL_ALLOC + /* This holds the pointer to the failure stack, when + it is allocated relocatably. */ + fail_stack_elt_t *failure_stack_ptr; +#endif + + /* Assume that each path through the pattern can be null until + proven otherwise. We set this false at the bottom of switch + statement, to which we get only if a particular path doesn't + match the empty string. */ + boolean path_can_be_null = true; + + /* We aren't doing a `succeed_n' to begin with. */ + boolean succeed_n_p = false; + + assert (fastmap != NULL && p != NULL); + + INIT_FAIL_STACK (); + bzero (fastmap, 1 << BYTEWIDTH); /* Assume nothing's valid. */ + bufp->fastmap_accurate = 1; /* It will be when we're done. */ + bufp->can_be_null = 0; + + while (1) + { + if (p == pend || *p == succeed) + { + /* We have reached the (effective) end of pattern. */ + if (!FAIL_STACK_EMPTY ()) + { + bufp->can_be_null |= path_can_be_null; + + /* Reset for next path. */ + path_can_be_null = true; + + p = fail_stack.stack[--fail_stack.avail].pointer; + + continue; + } + else + break; + } + + /* We should never be about to go beyond the end of the pattern. */ + assert (p < pend); + + switch (SWITCH_ENUM_CAST ((re_opcode_t) *p++)) + { + + /* I guess the idea here is to simply not bother with a fastmap + if a backreference is used, since it's too hard to figure out + the fastmap for the corresponding group. Setting + `can_be_null' stops `re_search_2' from using the fastmap, so + that is all we do. */ + case duplicate: + bufp->can_be_null = 1; + goto done; + + + /* Following are the cases which match a character. These end + with `break'. */ + +#ifdef MBS_SUPPORT + case exactn: + fastmap[truncate_wchar(p[1])] = 1; + break; + case exactn_bin: + fastmap[p[1]] = 1; + break; +#else + case exactn: + fastmap[p[1]] = 1; + break; +#endif /* MBS_SUPPORT */ + + +#ifdef MBS_SUPPORT + /* It is hard to distinguish fastmap from (multi byte) characters + which depends on current locale. */ + case charset: + case charset_not: + case wordchar: + case notwordchar: + bufp->can_be_null = 1; + goto done; +#else + case charset: + for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--) + if (p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH))) + fastmap[j] = 1; + break; + + + case charset_not: + /* Chars beyond end of map must be allowed. */ + for (j = *p * BYTEWIDTH; j < (1 << BYTEWIDTH); j++) + fastmap[j] = 1; + + for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--) + if (!(p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH)))) + fastmap[j] = 1; + break; + + + case wordchar: + for (j = 0; j < (1 << BYTEWIDTH); j++) + if (SYNTAX (j) == Sword) + fastmap[j] = 1; + break; + + + case notwordchar: + for (j = 0; j < (1 << BYTEWIDTH); j++) + if (SYNTAX (j) != Sword) + fastmap[j] = 1; + break; +#endif + + case anychar: + { + int fastmap_newline = fastmap['\n']; + + /* `.' matches anything ... */ + for (j = 0; j < (1 << BYTEWIDTH); j++) + fastmap[j] = 1; + + /* ... except perhaps newline. */ + if (!(bufp->syntax & RE_DOT_NEWLINE)) + fastmap['\n'] = fastmap_newline; + + /* Return if we have already set `can_be_null'; if we have, + then the fastmap is irrelevant. Something's wrong here. */ + else if (bufp->can_be_null) + goto done; + + /* Otherwise, have to check alternative paths. */ + break; + } + +#ifdef emacs + case syntaxspec: + k = *p++; + for (j = 0; j < (1 << BYTEWIDTH); j++) + if (SYNTAX (j) == (enum syntaxcode) k) + fastmap[j] = 1; + break; + + + case notsyntaxspec: + k = *p++; + for (j = 0; j < (1 << BYTEWIDTH); j++) + if (SYNTAX (j) != (enum syntaxcode) k) + fastmap[j] = 1; + break; + + + /* All cases after this match the empty string. These end with + `continue'. */ + + + case before_dot: + case at_dot: + case after_dot: + continue; +#endif /* emacs */ + + + case no_op: + case begline: + case endline: + case begbuf: + case endbuf: + case wordbound: + case notwordbound: + case wordbeg: + case wordend: + case push_dummy_failure: + continue; + + + case jump_n: + case pop_failure_jump: + case maybe_pop_jump: + case jump: + case jump_past_alt: + case dummy_failure_jump: + EXTRACT_NUMBER_AND_INCR (j, p); + p += j; + if (j > 0) + continue; + + /* Jump backward implies we just went through the body of a + loop and matched nothing. Opcode jumped to should be + `on_failure_jump' or `succeed_n'. Just treat it like an + ordinary jump. For a * loop, it has pushed its failure + point already; if so, discard that as redundant. */ + if ((re_opcode_t) *p != on_failure_jump + && (re_opcode_t) *p != succeed_n) + continue; + + p++; + EXTRACT_NUMBER_AND_INCR (j, p); + p += j; + + /* If what's on the stack is where we are now, pop it. */ + if (!FAIL_STACK_EMPTY () + && fail_stack.stack[fail_stack.avail - 1].pointer == p) + fail_stack.avail--; + + continue; + + + case on_failure_jump: + case on_failure_keep_string_jump: + handle_on_failure_jump: + EXTRACT_NUMBER_AND_INCR (j, p); + + /* For some patterns, e.g., `(a?)?', `p+j' here points to the + end of the pattern. We don't want to push such a point, + since when we restore it above, entering the switch will + increment `p' past the end of the pattern. We don't need + to push such a point since we obviously won't find any more + fastmap entries beyond `pend'. Such a pattern can match + the null string, though. */ + if (p + j < pend) + { + if (!PUSH_PATTERN_OP (p + j, fail_stack)) + { + RESET_FAIL_STACK (); + return -2; + } + } + else + bufp->can_be_null = 1; + + if (succeed_n_p) + { + EXTRACT_NUMBER_AND_INCR (k, p); /* Skip the n. */ + succeed_n_p = false; + } + + continue; + + + case succeed_n: + /* Get to the number of times to succeed. */ + p += OFFSET_ADDRESS_SIZE; + + /* Increment p past the n for when k != 0. */ + EXTRACT_NUMBER_AND_INCR (k, p); + if (k == 0) + { + p -= 2 * OFFSET_ADDRESS_SIZE; + succeed_n_p = true; /* Spaghetti code alert. */ + goto handle_on_failure_jump; + } + continue; + + + case set_number_at: + p += 2 * OFFSET_ADDRESS_SIZE; + continue; + + + case start_memory: + case stop_memory: + p += 2; + continue; + + + default: + abort (); /* We have listed all the cases. */ + } /* switch *p++ */ + + /* Getting here means we have found the possible starting + characters for one path of the pattern -- and that the empty + string does not match. We need not follow this path further. + Instead, look at the next alternative (remembered on the + stack), or quit if no more. The test at the top of the loop + does these things. */ + path_can_be_null = false; + p = pend; + } /* while p */ + + /* Set `can_be_null' for the last path (also the first path, if the + pattern is empty). */ + bufp->can_be_null |= path_can_be_null; + + done: + RESET_FAIL_STACK (); + return 0; +} /* re_compile_fastmap */ +#ifdef _LIBC +weak_alias (__re_compile_fastmap, re_compile_fastmap) +#endif + +/* Set REGS to hold NUM_REGS registers, storing them in STARTS and + ENDS. Subsequent matches using PATTERN_BUFFER and REGS will use + this memory for recording register information. STARTS and ENDS + must be allocated using the malloc library routine, and must each + be at least NUM_REGS * sizeof (regoff_t) bytes long. + + If NUM_REGS == 0, then subsequent matches should allocate their own + register data. + + Unless this function is called, the first search or match using + PATTERN_BUFFER will allocate its own register data, without + freeing the old data. */ + +void +re_set_registers (bufp, regs, num_regs, starts, ends) + struct re_pattern_buffer *bufp; + struct re_registers *regs; + unsigned num_regs; + regoff_t *starts, *ends; +{ + if (num_regs) + { + bufp->regs_allocated = REGS_REALLOCATE; + regs->num_regs = num_regs; + regs->start = starts; + regs->end = ends; + } + else + { + bufp->regs_allocated = REGS_UNALLOCATED; + regs->num_regs = 0; + regs->start = regs->end = (regoff_t *) 0; + } +} +#ifdef _LIBC +weak_alias (__re_set_registers, re_set_registers) +#endif + +/* Searching routines. */ + +/* Like re_search_2, below, but only one string is specified, and + doesn't let you say where to stop matching. */ + +int +re_search (bufp, string, size, startpos, range, regs) + struct re_pattern_buffer *bufp; + const char *string; + int size, startpos, range; + struct re_registers *regs; +{ + return re_search_2 (bufp, NULL, 0, string, size, startpos, range, + regs, size); +} +#ifdef _LIBC +weak_alias (__re_search, re_search) +#endif + + +/* Using the compiled pattern in BUFP->buffer, first tries to match the + virtual concatenation of STRING1 and STRING2, starting first at index + STARTPOS, then at STARTPOS + 1, and so on. + + STRING1 and STRING2 have length SIZE1 and SIZE2, respectively. + + RANGE is how far to scan while trying to match. RANGE = 0 means try + only at STARTPOS; in general, the last start tried is STARTPOS + + RANGE. + + In REGS, return the indices of the virtual concatenation of STRING1 + and STRING2 that matched the entire BUFP->buffer and its contained + subexpressions. + + Do not consider matching one past the index STOP in the virtual + concatenation of STRING1 and STRING2. + + We return either the position in the strings at which the match was + found, -1 if no match, or -2 if error (such as failure + stack overflow). */ + +int +re_search_2 (bufp, string1, size1, string2, size2, startpos, range, regs, stop) + struct re_pattern_buffer *bufp; + const char *string1, *string2; + int size1, size2; + int startpos; + int range; + struct re_registers *regs; + int stop; +{ + int val; + register char *fastmap = bufp->fastmap; + register RE_TRANSLATE_TYPE translate = bufp->translate; + int total_size = size1 + size2; + int endpos = startpos + range; + + /* Check for out-of-range STARTPOS. */ + if (startpos < 0 || startpos > total_size) + return -1; + + /* Fix up RANGE if it might eventually take us outside + the virtual concatenation of STRING1 and STRING2. + Make sure we won't move STARTPOS below 0 or above TOTAL_SIZE. */ + if (endpos < 0) + range = 0 - startpos; + else if (endpos > total_size) + range = total_size - startpos; + + /* If the search isn't to be a backwards one, don't waste time in a + search for a pattern that must be anchored. */ + if (bufp->used > 0 && range > 0 + && ((re_opcode_t) bufp->buffer[0] == begbuf + /* `begline' is like `begbuf' if it cannot match at newlines. */ + || ((re_opcode_t) bufp->buffer[0] == begline + && !bufp->newline_anchor))) + { + if (startpos > 0) + return -1; + else + range = 1; + } + +#ifdef emacs + /* In a forward search for something that starts with \=. + don't keep searching past point. */ + if (bufp->used > 0 && (re_opcode_t) bufp->buffer[0] == at_dot && range > 0) + { + range = PT - startpos; + if (range <= 0) + return -1; + } +#endif /* emacs */ + + /* Update the fastmap now if not correct already. */ + if (fastmap && !bufp->fastmap_accurate) + if (re_compile_fastmap (bufp) == -2) + return -2; + + /* Loop through the string, looking for a place to start matching. */ + for (;;) + { + /* If a fastmap is supplied, skip quickly over characters that + cannot be the start of a match. If the pattern can match the + null string, however, we don't need to skip characters; we want + the first null string. */ + if (fastmap && startpos < total_size && !bufp->can_be_null) + { + if (range > 0) /* Searching forwards. */ + { + register const char *d; + register int lim = 0; + int irange = range; + + if (startpos < size1 && startpos + range >= size1) + lim = range - (size1 - startpos); + + d = (startpos >= size1 ? string2 - size1 : string1) + startpos; + + /* Written out as an if-else to avoid testing `translate' + inside the loop. */ + if (translate) + while (range > lim + && !fastmap[(unsigned char) + translate[(unsigned char) *d++]]) + range--; + else + while (range > lim && !fastmap[(unsigned char) *d++]) + range--; + + startpos += irange - range; + } + else /* Searching backwards. */ + { + register CHAR_TYPE c = (size1 == 0 || startpos >= size1 + ? string2[startpos - size1] + : string1[startpos]); + + if (!fastmap[(unsigned char) TRANSLATE (c)]) + goto advance; + } + } + + /* If can't match the null string, and that's all we have left, fail. */ + if (range >= 0 && startpos == total_size && fastmap + && !bufp->can_be_null) + return -1; + + val = re_match_2_internal (bufp, string1, size1, string2, size2, + startpos, regs, stop); +#ifndef REGEX_MALLOC +# ifdef C_ALLOCA + alloca (0); +# endif +#endif + + if (val >= 0) + return startpos; + + if (val == -2) + return -2; + + advance: + if (!range) + break; + else if (range > 0) + { + range--; + startpos++; + } + else + { + range++; + startpos--; + } + } + return -1; +} /* re_search_2 */ +#ifdef _LIBC +weak_alias (__re_search_2, re_search_2) +#endif + +#ifdef MBS_SUPPORT +/* This converts PTR, a pointer into one of the search wchar_t strings + `string1' and `string2' into an multibyte string offset from the + beginning of that string. We use mbs_offset to optimize. + See convert_mbs_to_wcs. */ +# define POINTER_TO_OFFSET(ptr) \ + (FIRST_STRING_P (ptr) \ + ? ((regoff_t)(mbs_offset1 != NULL? mbs_offset1[(ptr)-string1] : 0)) \ + : ((regoff_t)((mbs_offset2 != NULL? mbs_offset2[(ptr)-string2] : 0) \ + + csize1))) +#else +/* This converts PTR, a pointer into one of the search strings `string1' + and `string2' into an offset from the beginning of that string. */ +# define POINTER_TO_OFFSET(ptr) \ + (FIRST_STRING_P (ptr) \ + ? ((regoff_t) ((ptr) - string1)) \ + : ((regoff_t) ((ptr) - string2 + size1))) +#endif /* MBS_SUPPORT */ + +/* Macros for dealing with the split strings in re_match_2. */ + +#define MATCHING_IN_FIRST_STRING (dend == end_match_1) + +/* Call before fetching a character with *d. This switches over to + string2 if necessary. */ +#define PREFETCH() \ + while (d == dend) \ + { \ + /* End of string2 => fail. */ \ + if (dend == end_match_2) \ + goto fail; \ + /* End of string1 => advance to string2. */ \ + d = string2; \ + dend = end_match_2; \ + } + + +/* Test if at very beginning or at very end of the virtual concatenation + of `string1' and `string2'. If only one string, it's `string2'. */ +#define AT_STRINGS_BEG(d) ((d) == (size1 ? string1 : string2) || !size2) +#define AT_STRINGS_END(d) ((d) == end2) + + +/* Test if D points to a character which is word-constituent. We have + two special cases to check for: if past the end of string1, look at + the first character in string2; and if before the beginning of + string2, look at the last character in string1. */ +#ifdef MBS_SUPPORT +/* Use internationalized API instead of SYNTAX. */ +# define WORDCHAR_P(d) \ + (iswalnum ((wint_t)((d) == end1 ? *string2 \ + : (d) == string2 - 1 ? *(end1 - 1) : *(d))) != 0) +#else +# define WORDCHAR_P(d) \ + (SYNTAX ((d) == end1 ? *string2 \ + : (d) == string2 - 1 ? *(end1 - 1) : *(d)) \ + == Sword) +#endif /* MBS_SUPPORT */ + +/* Disabled due to a compiler bug -- see comment at case wordbound */ +#if 0 +/* Test if the character before D and the one at D differ with respect + to being word-constituent. */ +#define AT_WORD_BOUNDARY(d) \ + (AT_STRINGS_BEG (d) || AT_STRINGS_END (d) \ + || WORDCHAR_P (d - 1) != WORDCHAR_P (d)) +#endif + +/* Free everything we malloc. */ +#ifdef MATCH_MAY_ALLOCATE +# define FREE_VAR(var) if (var) REGEX_FREE (var); var = NULL +# ifdef MBS_SUPPORT +# define FREE_VARIABLES() \ + do { \ + REGEX_FREE_STACK (fail_stack.stack); \ + FREE_VAR (regstart); \ + FREE_VAR (regend); \ + FREE_VAR (old_regstart); \ + FREE_VAR (old_regend); \ + FREE_VAR (best_regstart); \ + FREE_VAR (best_regend); \ + FREE_VAR (reg_info); \ + FREE_VAR (reg_dummy); \ + FREE_VAR (reg_info_dummy); \ + FREE_VAR (string1); \ + FREE_VAR (string2); \ + FREE_VAR (mbs_offset1); \ + FREE_VAR (mbs_offset2); \ + } while (0) +# else /* not MBS_SUPPORT */ +# define FREE_VARIABLES() \ + do { \ + REGEX_FREE_STACK (fail_stack.stack); \ + FREE_VAR (regstart); \ + FREE_VAR (regend); \ + FREE_VAR (old_regstart); \ + FREE_VAR (old_regend); \ + FREE_VAR (best_regstart); \ + FREE_VAR (best_regend); \ + FREE_VAR (reg_info); \ + FREE_VAR (reg_dummy); \ + FREE_VAR (reg_info_dummy); \ + } while (0) +# endif /* MBS_SUPPORT */ +#else +# define FREE_VAR(var) if (var) free (var); var = NULL +# ifdef MBS_SUPPORT +# define FREE_VARIABLES() \ + do { \ + FREE_VAR (string1); \ + FREE_VAR (string2); \ + FREE_VAR (mbs_offset1); \ + FREE_VAR (mbs_offset2); \ + } while (0) +# else +# define FREE_VARIABLES() ((void)0) /* Do nothing! But inhibit gcc warning. */ +# endif /* MBS_SUPPORT */ +#endif /* not MATCH_MAY_ALLOCATE */ + +/* These values must meet several constraints. They must not be valid + register values; since we have a limit of 255 registers (because + we use only one byte in the pattern for the register number), we can + use numbers larger than 255. They must differ by 1, because of + NUM_FAILURE_ITEMS above. And the value for the lowest register must + be larger than the value for the highest register, so we do not try + to actually save any registers when none are active. */ +#define NO_HIGHEST_ACTIVE_REG (1 << BYTEWIDTH) +#define NO_LOWEST_ACTIVE_REG (NO_HIGHEST_ACTIVE_REG + 1) + +/* Matching routines. */ + +#ifndef emacs /* Emacs never uses this. */ +/* re_match is like re_match_2 except it takes only a single string. */ + +int +re_match (bufp, string, size, pos, regs) + struct re_pattern_buffer *bufp; + const char *string; + int size, pos; + struct re_registers *regs; +{ + int result = re_match_2_internal (bufp, NULL, 0, string, size, + pos, regs, size); +# ifndef REGEX_MALLOC +# ifdef C_ALLOCA + alloca (0); +# endif +# endif + return result; +} +# ifdef _LIBC +weak_alias (__re_match, re_match) +# endif +#endif /* not emacs */ + +static boolean group_match_null_string_p _RE_ARGS ((US_CHAR_TYPE **p, + US_CHAR_TYPE *end, + register_info_type *reg_info)); +static boolean alt_match_null_string_p _RE_ARGS ((US_CHAR_TYPE *p, + US_CHAR_TYPE *end, + register_info_type *reg_info)); +static boolean common_op_match_null_string_p _RE_ARGS ((US_CHAR_TYPE **p, + US_CHAR_TYPE *end, + register_info_type *reg_info)); +static int bcmp_translate _RE_ARGS ((const CHAR_TYPE *s1, const CHAR_TYPE *s2, + int len, char *translate)); + +/* re_match_2 matches the compiled pattern in BUFP against the + the (virtual) concatenation of STRING1 and STRING2 (of length SIZE1 + and SIZE2, respectively). We start matching at POS, and stop + matching at STOP. + + If REGS is non-null and the `no_sub' field of BUFP is nonzero, we + store offsets for the substring each group matched in REGS. See the + documentation for exactly how many groups we fill. + + We return -1 if no match, -2 if an internal error (such as the + failure stack overflowing). Otherwise, we return the length of the + matched substring. */ + +int +re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) + struct re_pattern_buffer *bufp; + const char *string1, *string2; + int size1, size2; + int pos; + struct re_registers *regs; + int stop; +{ + int result = re_match_2_internal (bufp, string1, size1, string2, size2, + pos, regs, stop); +#ifndef REGEX_MALLOC +# ifdef C_ALLOCA + alloca (0); +# endif +#endif + return result; +} +#ifdef _LIBC +weak_alias (__re_match_2, re_match_2) +#endif + +#ifdef MBS_SUPPORT + +static int count_mbs_length PARAMS ((int *, int)); + +/* This check the substring (from 0, to length) of the multibyte string, + to which offset_buffer correspond. And count how many wchar_t_characters + the substring occupy. We use offset_buffer to optimization. + See convert_mbs_to_wcs. */ + +static int +count_mbs_length(offset_buffer, length) + int *offset_buffer; + int length; +{ + int wcs_size; + + /* Check whether the size is valid. */ + if (length < 0) + return -1; + + if (offset_buffer == NULL) + return 0; + + for (wcs_size = 0 ; offset_buffer[wcs_size] != -1 ; wcs_size++) + { + if (offset_buffer[wcs_size] == length) + return wcs_size; + if (offset_buffer[wcs_size] > length) + /* It is a fragment of a wide character. */ + return -1; + } + + /* We reached at the sentinel. */ + return -1; +} +#endif /* MBS_SUPPORT */ + +/* This is a separate function so that we can force an alloca cleanup + afterwards. */ +static int +#ifdef MBS_SUPPORT +re_match_2_internal (bufp, cstring1, csize1, cstring2, csize2, pos, regs, stop) + struct re_pattern_buffer *bufp; + const char *cstring1, *cstring2; + int csize1, csize2; +#else +re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) + struct re_pattern_buffer *bufp; + const char *string1, *string2; + int size1, size2; +#endif + int pos; + struct re_registers *regs; + int stop; +{ + /* General temporaries. */ + int mcnt; + US_CHAR_TYPE *p1; +#ifdef MBS_SUPPORT + /* We need wchar_t* buffers correspond to string1, string2. */ + CHAR_TYPE *string1 = NULL, *string2 = NULL; + /* We need the size of wchar_t buffers correspond to csize1, csize2. */ + int size1 = 0, size2 = 0; + /* offset buffer for optimizatoin. See convert_mbs_to_wc. */ + int *mbs_offset1 = NULL, *mbs_offset2 = NULL; + /* They hold whether each wchar_t is binary data or not. */ + char *is_binary = NULL; +#endif /* MBS_SUPPORT */ + + /* Just past the end of the corresponding string. */ + const CHAR_TYPE *end1, *end2; + + /* Pointers into string1 and string2, just past the last characters in + each to consider matching. */ + const CHAR_TYPE *end_match_1, *end_match_2; + + /* Where we are in the data, and the end of the current string. */ + const CHAR_TYPE *d, *dend; + + /* Where we are in the pattern, and the end of the pattern. */ +#ifdef MBS_SUPPORT + US_CHAR_TYPE *pattern, *p; + register US_CHAR_TYPE *pend; +#else + US_CHAR_TYPE *p = bufp->buffer; + register US_CHAR_TYPE *pend = p + bufp->used; +#endif /* MBS_SUPPORT */ + + /* Mark the opcode just after a start_memory, so we can test for an + empty subpattern when we get to the stop_memory. */ + US_CHAR_TYPE *just_past_start_mem = 0; + + /* We use this to map every character in the string. */ + RE_TRANSLATE_TYPE translate = bufp->translate; + + /* Failure point stack. Each place that can handle a failure further + down the line pushes a failure point on this stack. It consists of + restart, regend, and reg_info for all registers corresponding to + the subexpressions we're currently inside, plus the number of such + registers, and, finally, two char *'s. The first char * is where + to resume scanning the pattern; the second one is where to resume + scanning the strings. If the latter is zero, the failure point is + a ``dummy''; if a failure happens and the failure point is a dummy, + it gets discarded and the next next one is tried. */ +#ifdef MATCH_MAY_ALLOCATE /* otherwise, this is global. */ + fail_stack_type fail_stack; +#endif +#ifdef DEBUG + static unsigned failure_id; + unsigned nfailure_points_pushed = 0, nfailure_points_popped = 0; +#endif + +#ifdef REL_ALLOC + /* This holds the pointer to the failure stack, when + it is allocated relocatably. */ + fail_stack_elt_t *failure_stack_ptr; +#endif + + /* We fill all the registers internally, independent of what we + return, for use in backreferences. The number here includes + an element for register zero. */ + size_t num_regs = bufp->re_nsub + 1; + + /* The currently active registers. */ + active_reg_t lowest_active_reg = NO_LOWEST_ACTIVE_REG; + active_reg_t highest_active_reg = NO_HIGHEST_ACTIVE_REG; + + /* Information on the contents of registers. These are pointers into + the input strings; they record just what was matched (on this + attempt) by a subexpression part of the pattern, that is, the + regnum-th regstart pointer points to where in the pattern we began + matching and the regnum-th regend points to right after where we + stopped matching the regnum-th subexpression. (The zeroth register + keeps track of what the whole pattern matches.) */ +#ifdef MATCH_MAY_ALLOCATE /* otherwise, these are global. */ + const CHAR_TYPE **regstart, **regend; +#endif + + /* If a group that's operated upon by a repetition operator fails to + match anything, then the register for its start will need to be + restored because it will have been set to wherever in the string we + are when we last see its open-group operator. Similarly for a + register's end. */ +#ifdef MATCH_MAY_ALLOCATE /* otherwise, these are global. */ + const CHAR_TYPE **old_regstart, **old_regend; +#endif + + /* The is_active field of reg_info helps us keep track of which (possibly + nested) subexpressions we are currently in. The matched_something + field of reg_info[reg_num] helps us tell whether or not we have + matched any of the pattern so far this time through the reg_num-th + subexpression. These two fields get reset each time through any + loop their register is in. */ +#ifdef MATCH_MAY_ALLOCATE /* otherwise, this is global. */ + register_info_type *reg_info; +#endif + + /* The following record the register info as found in the above + variables when we find a match better than any we've seen before. + This happens as we backtrack through the failure points, which in + turn happens only if we have not yet matched the entire string. */ + unsigned best_regs_set = false; +#ifdef MATCH_MAY_ALLOCATE /* otherwise, these are global. */ + const CHAR_TYPE **best_regstart, **best_regend; +#endif + + /* Logically, this is `best_regend[0]'. But we don't want to have to + allocate space for that if we're not allocating space for anything + else (see below). Also, we never need info about register 0 for + any of the other register vectors, and it seems rather a kludge to + treat `best_regend' differently than the rest. So we keep track of + the end of the best match so far in a separate variable. We + initialize this to NULL so that when we backtrack the first time + and need to test it, it's not garbage. */ + const CHAR_TYPE *match_end = NULL; + + /* This helps SET_REGS_MATCHED avoid doing redundant work. */ + int set_regs_matched_done = 0; + + /* Used when we pop values we don't care about. */ +#ifdef MATCH_MAY_ALLOCATE /* otherwise, these are global. */ + const CHAR_TYPE **reg_dummy; + register_info_type *reg_info_dummy; +#endif + +#ifdef DEBUG + /* Counts the total number of registers pushed. */ + unsigned num_regs_pushed = 0; +#endif + + DEBUG_PRINT1 ("\n\nEntering re_match_2.\n"); + + INIT_FAIL_STACK (); + +#ifdef MATCH_MAY_ALLOCATE + /* Do not bother to initialize all the register variables if there are + no groups in the pattern, as it takes a fair amount of time. If + there are groups, we include space for register 0 (the whole + pattern), even though we never use it, since it simplifies the + array indexing. We should fix this. */ + if (bufp->re_nsub) + { + regstart = REGEX_TALLOC (num_regs, const CHAR_TYPE *); + regend = REGEX_TALLOC (num_regs, const CHAR_TYPE *); + old_regstart = REGEX_TALLOC (num_regs, const CHAR_TYPE *); + old_regend = REGEX_TALLOC (num_regs, const CHAR_TYPE *); + best_regstart = REGEX_TALLOC (num_regs, const CHAR_TYPE *); + best_regend = REGEX_TALLOC (num_regs, const CHAR_TYPE *); + reg_info = REGEX_TALLOC (num_regs, register_info_type); + reg_dummy = REGEX_TALLOC (num_regs, const CHAR_TYPE *); + reg_info_dummy = REGEX_TALLOC (num_regs, register_info_type); + + if (!(regstart && regend && old_regstart && old_regend && reg_info + && best_regstart && best_regend && reg_dummy && reg_info_dummy)) + { + FREE_VARIABLES (); + return -2; + } + } + else + { + /* We must initialize all our variables to NULL, so that + `FREE_VARIABLES' doesn't try to free them. */ + regstart = regend = old_regstart = old_regend = best_regstart + = best_regend = reg_dummy = NULL; + reg_info = reg_info_dummy = (register_info_type *) NULL; + } +#endif /* MATCH_MAY_ALLOCATE */ + + /* The starting position is bogus. */ +#ifdef MBS_SUPPORT + if (pos < 0 || pos > csize1 + csize2) +#else + if (pos < 0 || pos > size1 + size2) +#endif + { + FREE_VARIABLES (); + return -1; + } + +#ifdef MBS_SUPPORT + /* Allocate wchar_t array for string1 and string2 and + fill them with converted string. */ + if (csize1 != 0) + { + string1 = REGEX_TALLOC (csize1 + 1, CHAR_TYPE); + mbs_offset1 = REGEX_TALLOC (csize1 + 1, int); + is_binary = REGEX_TALLOC (csize1 + 1, char); + if (!string1 || !mbs_offset1 || !is_binary) + { + FREE_VAR (string1); + FREE_VAR (mbs_offset1); + FREE_VAR (is_binary); + return -2; + } + size1 = convert_mbs_to_wcs(string1, cstring1, csize1, + mbs_offset1, is_binary); + string1[size1] = L'\0'; /* for a sentinel */ + FREE_VAR (is_binary); + } + if (csize2 != 0) + { + string2 = REGEX_TALLOC (csize2 + 1, CHAR_TYPE); + mbs_offset2 = REGEX_TALLOC (csize2 + 1, int); + is_binary = REGEX_TALLOC (csize2 + 1, char); + if (!string2 || !mbs_offset2 || !is_binary) + { + FREE_VAR (string1); + FREE_VAR (mbs_offset1); + FREE_VAR (string2); + FREE_VAR (mbs_offset2); + FREE_VAR (is_binary); + return -2; + } + size2 = convert_mbs_to_wcs(string2, cstring2, csize2, + mbs_offset2, is_binary); + string2[size2] = L'\0'; /* for a sentinel */ + FREE_VAR (is_binary); + } + + /* We need to cast pattern to (wchar_t*), because we casted this compiled + pattern to (char*) in regex_compile. */ + p = pattern = (CHAR_TYPE*)bufp->buffer; + pend = (CHAR_TYPE*)(bufp->buffer + bufp->used); + +#endif /* MBS_SUPPORT */ + + /* Initialize subexpression text positions to -1 to mark ones that no + start_memory/stop_memory has been seen for. Also initialize the + register information struct. */ + for (mcnt = 1; (unsigned) mcnt < num_regs; mcnt++) + { + regstart[mcnt] = regend[mcnt] + = old_regstart[mcnt] = old_regend[mcnt] = REG_UNSET_VALUE; + + REG_MATCH_NULL_STRING_P (reg_info[mcnt]) = MATCH_NULL_UNSET_VALUE; + IS_ACTIVE (reg_info[mcnt]) = 0; + MATCHED_SOMETHING (reg_info[mcnt]) = 0; + EVER_MATCHED_SOMETHING (reg_info[mcnt]) = 0; + } + + /* We move `string1' into `string2' if the latter's empty -- but not if + `string1' is null. */ + if (size2 == 0 && string1 != NULL) + { + string2 = string1; + size2 = size1; + string1 = 0; + size1 = 0; + } + end1 = string1 + size1; + end2 = string2 + size2; + + /* Compute where to stop matching, within the two strings. */ +#ifdef MBS_SUPPORT + if (stop <= csize1) + { + mcnt = count_mbs_length(mbs_offset1, stop); + end_match_1 = string1 + mcnt; + end_match_2 = string2; + } + else + { + end_match_1 = end1; + mcnt = count_mbs_length(mbs_offset2, stop-csize1); + end_match_2 = string2 + mcnt; + } + if (mcnt < 0) + { /* count_mbs_length return error. */ + FREE_VARIABLES (); + return -1; + } +#else + if (stop <= size1) + { + end_match_1 = string1 + stop; + end_match_2 = string2; + } + else + { + end_match_1 = end1; + end_match_2 = string2 + stop - size1; + } +#endif /* MBS_SUPPORT */ + + /* `p' scans through the pattern as `d' scans through the data. + `dend' is the end of the input string that `d' points within. `d' + is advanced into the following input string whenever necessary, but + this happens before fetching; therefore, at the beginning of the + loop, `d' can be pointing at the end of a string, but it cannot + equal `string2'. */ +#ifdef MBS_SUPPORT + if (size1 > 0 && pos <= csize1) + { + mcnt = count_mbs_length(mbs_offset1, pos); + d = string1 + mcnt; + dend = end_match_1; + } + else + { + mcnt = count_mbs_length(mbs_offset2, pos-csize1); + d = string2 + mcnt; + dend = end_match_2; + } + + if (mcnt < 0) + { /* count_mbs_length return error. */ + FREE_VARIABLES (); + return -1; + } +#else + if (size1 > 0 && pos <= size1) + { + d = string1 + pos; + dend = end_match_1; + } + else + { + d = string2 + pos - size1; + dend = end_match_2; + } +#endif /* MBS_SUPPORT */ + + DEBUG_PRINT1 ("The compiled pattern is:\n"); + DEBUG_PRINT_COMPILED_PATTERN (bufp, p, pend); + DEBUG_PRINT1 ("The string to match is: `"); + DEBUG_PRINT_DOUBLE_STRING (d, string1, size1, string2, size2); + DEBUG_PRINT1 ("'\n"); + + /* This loops over pattern commands. It exits by returning from the + function if the match is complete, or it drops through if the match + fails at this starting point in the input data. */ + for (;;) + { +#ifdef _LIBC + DEBUG_PRINT2 ("\n%p: ", p); +#else + DEBUG_PRINT2 ("\n0x%x: ", p); +#endif + + if (p == pend) + { /* End of pattern means we might have succeeded. */ + DEBUG_PRINT1 ("end of pattern ... "); + + /* If we haven't matched the entire string, and we want the + longest match, try backtracking. */ + if (d != end_match_2) + { + /* 1 if this match ends in the same string (string1 or string2) + as the best previous match. */ + boolean same_str_p = (FIRST_STRING_P (match_end) + == MATCHING_IN_FIRST_STRING); + /* 1 if this match is the best seen so far. */ + boolean best_match_p; + + /* AIX compiler got confused when this was combined + with the previous declaration. */ + if (same_str_p) + best_match_p = d > match_end; + else + best_match_p = !MATCHING_IN_FIRST_STRING; + + DEBUG_PRINT1 ("backtracking.\n"); + + if (!FAIL_STACK_EMPTY ()) + { /* More failure points to try. */ + + /* If exceeds best match so far, save it. */ + if (!best_regs_set || best_match_p) + { + best_regs_set = true; + match_end = d; + + DEBUG_PRINT1 ("\nSAVING match as best so far.\n"); + + for (mcnt = 1; (unsigned) mcnt < num_regs; mcnt++) + { + best_regstart[mcnt] = regstart[mcnt]; + best_regend[mcnt] = regend[mcnt]; + } + } + goto fail; + } + + /* If no failure points, don't restore garbage. And if + last match is real best match, don't restore second + best one. */ + else if (best_regs_set && !best_match_p) + { + restore_best_regs: + /* Restore best match. It may happen that `dend == + end_match_1' while the restored d is in string2. + For example, the pattern `x.*y.*z' against the + strings `x-' and `y-z-', if the two strings are + not consecutive in memory. */ + DEBUG_PRINT1 ("Restoring best registers.\n"); + + d = match_end; + dend = ((d >= string1 && d <= end1) + ? end_match_1 : end_match_2); + + for (mcnt = 1; (unsigned) mcnt < num_regs; mcnt++) + { + regstart[mcnt] = best_regstart[mcnt]; + regend[mcnt] = best_regend[mcnt]; + } + } + } /* d != end_match_2 */ + + succeed_label: + DEBUG_PRINT1 ("Accepting match.\n"); + /* If caller wants register contents data back, do it. */ + if (regs && !bufp->no_sub) + { + /* Have the register data arrays been allocated? */ + if (bufp->regs_allocated == REGS_UNALLOCATED) + { /* No. So allocate them with malloc. We need one + extra element beyond `num_regs' for the `-1' marker + GNU code uses. */ + regs->num_regs = MAX (RE_NREGS, num_regs + 1); + regs->start = TALLOC (regs->num_regs, regoff_t); + regs->end = TALLOC (regs->num_regs, regoff_t); + if (regs->start == NULL || regs->end == NULL) + { + FREE_VARIABLES (); + return -2; + } + bufp->regs_allocated = REGS_REALLOCATE; + } + else if (bufp->regs_allocated == REGS_REALLOCATE) + { /* Yes. If we need more elements than were already + allocated, reallocate them. If we need fewer, just + leave it alone. */ + if (regs->num_regs < num_regs + 1) + { + regs->num_regs = num_regs + 1; + RETALLOC (regs->start, regs->num_regs, regoff_t); + RETALLOC (regs->end, regs->num_regs, regoff_t); + if (regs->start == NULL || regs->end == NULL) + { + FREE_VARIABLES (); + return -2; + } + } + } + else + { + /* These braces fend off a "empty body in an else-statement" + warning under GCC when assert expands to nothing. */ + assert (bufp->regs_allocated == REGS_FIXED); + } + + /* Convert the pointer data in `regstart' and `regend' to + indices. Register zero has to be set differently, + since we haven't kept track of any info for it. */ + if (regs->num_regs > 0) + { + regs->start[0] = pos; +#ifdef MBS_SUPPORT + if (MATCHING_IN_FIRST_STRING) + regs->end[0] = mbs_offset1 != NULL ? + mbs_offset1[d-string1] : 0; + else + regs->end[0] = csize1 + (mbs_offset2 != NULL ? + mbs_offset2[d-string2] : 0); +#else + regs->end[0] = (MATCHING_IN_FIRST_STRING + ? ((regoff_t) (d - string1)) + : ((regoff_t) (d - string2 + size1))); +#endif /* MBS_SUPPORT */ + } + + /* Go through the first `min (num_regs, regs->num_regs)' + registers, since that is all we initialized. */ + for (mcnt = 1; (unsigned) mcnt < MIN (num_regs, regs->num_regs); + mcnt++) + { + if (REG_UNSET (regstart[mcnt]) || REG_UNSET (regend[mcnt])) + regs->start[mcnt] = regs->end[mcnt] = -1; + else + { + regs->start[mcnt] + = (regoff_t) POINTER_TO_OFFSET (regstart[mcnt]); + regs->end[mcnt] + = (regoff_t) POINTER_TO_OFFSET (regend[mcnt]); + } + } + + /* If the regs structure we return has more elements than + were in the pattern, set the extra elements to -1. If + we (re)allocated the registers, this is the case, + because we always allocate enough to have at least one + -1 at the end. */ + for (mcnt = num_regs; (unsigned) mcnt < regs->num_regs; mcnt++) + regs->start[mcnt] = regs->end[mcnt] = -1; + } /* regs && !bufp->no_sub */ + + DEBUG_PRINT4 ("%u failure points pushed, %u popped (%u remain).\n", + nfailure_points_pushed, nfailure_points_popped, + nfailure_points_pushed - nfailure_points_popped); + DEBUG_PRINT2 ("%u registers pushed.\n", num_regs_pushed); + +#ifdef MBS_SUPPORT + if (MATCHING_IN_FIRST_STRING) + mcnt = mbs_offset1 != NULL ? mbs_offset1[d-string1] : 0; + else + mcnt = (mbs_offset2 != NULL ? mbs_offset2[d-string2] : 0) + + csize1; + mcnt -= pos; +#else + mcnt = d - pos - (MATCHING_IN_FIRST_STRING + ? string1 + : string2 - size1); +#endif /* MBS_SUPPORT */ + + DEBUG_PRINT2 ("Returning %d from re_match_2.\n", mcnt); + + FREE_VARIABLES (); + return mcnt; + } + + /* Otherwise match next pattern command. */ + switch (SWITCH_ENUM_CAST ((re_opcode_t) *p++)) + { + /* Ignore these. Used to ignore the n of succeed_n's which + currently have n == 0. */ + case no_op: + DEBUG_PRINT1 ("EXECUTING no_op.\n"); + break; + + case succeed: + DEBUG_PRINT1 ("EXECUTING succeed.\n"); + goto succeed_label; + + /* Match the next n pattern characters exactly. The following + byte in the pattern defines n, and the n bytes after that + are the characters to match. */ + case exactn: +#ifdef MBS_SUPPORT + case exactn_bin: +#endif + mcnt = *p++; + DEBUG_PRINT2 ("EXECUTING exactn %d.\n", mcnt); + + /* This is written out as an if-else so we don't waste time + testing `translate' inside the loop. */ + if (translate) + { + do + { + PREFETCH (); +#ifdef MBS_SUPPORT + if (*d <= 0xff) + { + if ((US_CHAR_TYPE) translate[(unsigned char) *d++] + != (US_CHAR_TYPE) *p++) + goto fail; + } + else + { + if (*d++ != (CHAR_TYPE) *p++) + goto fail; + } +#else + if ((US_CHAR_TYPE) translate[(unsigned char) *d++] + != (US_CHAR_TYPE) *p++) + goto fail; +#endif /* MBS_SUPPORT */ + } + while (--mcnt); + } + else + { + do + { + PREFETCH (); + if (*d++ != (CHAR_TYPE) *p++) goto fail; + } + while (--mcnt); + } + SET_REGS_MATCHED (); + break; + + + /* Match any character except possibly a newline or a null. */ + case anychar: + DEBUG_PRINT1 ("EXECUTING anychar.\n"); + + PREFETCH (); + + if ((!(bufp->syntax & RE_DOT_NEWLINE) && TRANSLATE (*d) == '\n') + || (bufp->syntax & RE_DOT_NOT_NULL && TRANSLATE (*d) == '\000')) + goto fail; + + SET_REGS_MATCHED (); + DEBUG_PRINT2 (" Matched `%ld'.\n", (long int) *d); + d++; + break; + + + case charset: + case charset_not: + { + register US_CHAR_TYPE c; +#ifdef MBS_SUPPORT + unsigned int i, char_class_length, coll_symbol_length, + equiv_class_length, ranges_length, chars_length, length; + CHAR_TYPE *workp, *workp2, *charset_top; +#define WORK_BUFFER_SIZE 128 + CHAR_TYPE str_buf[WORK_BUFFER_SIZE]; +# ifdef _LIBC + uint32_t nrules; +# endif /* _LIBC */ +#endif /* MBS_SUPPORT */ + boolean not = (re_opcode_t) *(p - 1) == charset_not; + + DEBUG_PRINT2 ("EXECUTING charset%s.\n", not ? "_not" : ""); + PREFETCH (); + c = TRANSLATE (*d); /* The character to match. */ +#ifdef MBS_SUPPORT +# ifdef _LIBC + nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES); +# endif /* _LIBC */ + charset_top = p - 1; + char_class_length = *p++; + coll_symbol_length = *p++; + equiv_class_length = *p++; + ranges_length = *p++; + chars_length = *p++; + /* p points charset[6], so the address of the next instruction + (charset[l+m+n+2o+k+p']) equals p[l+m+n+2*o+p'], + where l=length of char_classes, m=length of collating_symbol, + n=equivalence_class, o=length of char_range, + p'=length of character. */ + workp = p; + /* Update p to indicate the next instruction. */ + p += char_class_length + coll_symbol_length+ equiv_class_length + + 2*ranges_length + chars_length; + + /* match with char_class? */ + for (i = 0; i < char_class_length ; i += CHAR_CLASS_SIZE) + { + wctype_t wctype; + uintptr_t alignedp = ((uintptr_t)workp + + __alignof__(wctype_t) - 1) + & ~(uintptr_t)(__alignof__(wctype_t) - 1); + wctype = *((wctype_t*)alignedp); + workp += CHAR_CLASS_SIZE; + if (iswctype((wint_t)c, wctype)) + goto char_set_matched; + } + + /* match with collating_symbol? */ +# ifdef _LIBC + if (nrules != 0) + { + const unsigned char *extra = (const unsigned char *) + _NL_CURRENT (LC_COLLATE, _NL_COLLATE_SYMB_EXTRAMB); + + for (workp2 = workp + coll_symbol_length ; workp < workp2 ; + workp++) + { + int32_t *wextra; + wextra = (int32_t*)(extra + *workp++); + for (i = 0; i < *wextra; ++i) + if (TRANSLATE(d[i]) != wextra[1 + i]) + break; + + if (i == *wextra) + { + /* Update d, however d will be incremented at + char_set_matched:, we decrement d here. */ + d += i - 1; + goto char_set_matched; + } + } + } + else /* (nrules == 0) */ +# endif + /* If we can't look up collation data, we use wcscoll + instead. */ + { + for (workp2 = workp + coll_symbol_length ; workp < workp2 ;) + { + const CHAR_TYPE *backup_d = d, *backup_dend = dend; + length = wcslen(workp); + + /* If wcscoll(the collating symbol, whole string) > 0, + any substring of the string never match with the + collating symbol. */ + if (wcscoll(workp, d) > 0) + { + workp += length + 1; + continue; + } + + /* First, we compare the collating symbol with + the first character of the string. + If it don't match, we add the next character to + the compare buffer in turn. */ + for (i = 0 ; i < WORK_BUFFER_SIZE-1 ; i++, d++) + { + int match; + if (d == dend) + { + if (dend == end_match_2) + break; + d = string2; + dend = end_match_2; + } + + /* add next character to the compare buffer. */ + str_buf[i] = TRANSLATE(*d); + str_buf[i+1] = '\0'; + + match = wcscoll(workp, str_buf); + if (match == 0) + goto char_set_matched; + + if (match < 0) + /* (str_buf > workp) indicate (str_buf + X > workp), + because for all X (str_buf + X > str_buf). + So we don't need continue this loop. */ + break; + + /* Otherwise(str_buf < workp), + (str_buf+next_character) may equals (workp). + So we continue this loop. */ + } + /* not matched */ + d = backup_d; + dend = backup_dend; + workp += length + 1; + } + } + /* match with equivalence_class? */ +# ifdef _LIBC + if (nrules != 0) + { + const CHAR_TYPE *backup_d = d, *backup_dend = dend; + /* Try to match the equivalence class against + those known to the collate implementation. */ + const int32_t *table; + const int32_t *weights; + const int32_t *extra; + const int32_t *indirect; + int32_t idx, idx2; + wint_t *cp; + size_t len; + + /* This #include defines a local function! */ +# include + + table = (const int32_t *) + _NL_CURRENT (LC_COLLATE, _NL_COLLATE_TABLEWC); + weights = (const wint_t *) + _NL_CURRENT (LC_COLLATE, _NL_COLLATE_WEIGHTWC); + extra = (const wint_t *) + _NL_CURRENT (LC_COLLATE, _NL_COLLATE_EXTRAWC); + indirect = (const int32_t *) + _NL_CURRENT (LC_COLLATE, _NL_COLLATE_INDIRECTWC); + + /* Write 1 collating element to str_buf, and + get its index. */ + idx2 = 0; + + for (i = 0 ; idx2 == 0 && i < WORK_BUFFER_SIZE - 1; i++) + { + cp = (wint_t*)str_buf; + if (d == dend) + { + if (dend == end_match_2) + break; + d = string2; + dend = end_match_2; + } + str_buf[i] = TRANSLATE(*(d+i)); + str_buf[i+1] = '\0'; /* sentinel */ + idx2 = findidx ((const wint_t**)&cp); + } + + /* Update d, however d will be incremented at + char_set_matched:, we decrement d here. */ + d = backup_d + ((wchar_t*)cp - (wchar_t*)str_buf - 1); + if (d >= dend) + { + if (dend == end_match_2) + d = dend; + else + { + d = string2; + dend = end_match_2; + } + } + + len = weights[idx2]; + + for (workp2 = workp + equiv_class_length ; workp < workp2 ; + workp++) + { + idx = (int32_t)*workp; + /* We already checked idx != 0 in regex_compile. */ + + if (idx2 != 0 && len == weights[idx]) + { + int cnt = 0; + while (cnt < len && (weights[idx + 1 + cnt] + == weights[idx2 + 1 + cnt])) + ++cnt; + + if (cnt == len) + goto char_set_matched; + } + } + /* not matched */ + d = backup_d; + dend = backup_dend; + } + else /* (nrules == 0) */ +# endif + /* If we can't look up collation data, we use wcscoll + instead. */ + { + for (workp2 = workp + equiv_class_length ; workp < workp2 ;) + { + const CHAR_TYPE *backup_d = d, *backup_dend = dend; + length = wcslen(workp); + + /* If wcscoll(the collating symbol, whole string) > 0, + any substring of the string never match with the + collating symbol. */ + if (wcscoll(workp, d) > 0) + { + workp += length + 1; + break; + } + + /* First, we compare the equivalence class with + the first character of the string. + If it don't match, we add the next character to + the compare buffer in turn. */ + for (i = 0 ; i < WORK_BUFFER_SIZE - 1 ; i++, d++) + { + int match; + if (d == dend) + { + if (dend == end_match_2) + break; + d = string2; + dend = end_match_2; + } + + /* add next character to the compare buffer. */ + str_buf[i] = TRANSLATE(*d); + str_buf[i+1] = '\0'; + + match = wcscoll(workp, str_buf); + + if (match == 0) + goto char_set_matched; + + if (match < 0) + /* (str_buf > workp) indicate (str_buf + X > workp), + because for all X (str_buf + X > str_buf). + So we don't need continue this loop. */ + break; + + /* Otherwise(str_buf < workp), + (str_buf+next_character) may equals (workp). + So we continue this loop. */ + } + /* not matched */ + d = backup_d; + dend = backup_dend; + workp += length + 1; + } + } + + /* match with char_range? */ +#ifdef _LIBC + if (nrules != 0) + { + uint32_t collseqval; + const char *collseq = (const char *) + _NL_CURRENT(LC_COLLATE, _NL_COLLATE_COLLSEQWC); + + collseqval = collseq_table_lookup (collseq, c); + + for (; workp < p - chars_length ;) + { + uint32_t start_val, end_val; + + /* We already compute the collation sequence value + of the characters (or collating symbols). */ + start_val = (uint32_t) *workp++; /* range_start */ + end_val = (uint32_t) *workp++; /* range_end */ + + if (start_val <= collseqval && collseqval <= end_val) + goto char_set_matched; + } + } + else +#endif + { + /* We set range_start_char at str_buf[0], range_end_char + at str_buf[4], and compared char at str_buf[2]. */ + str_buf[1] = 0; + str_buf[2] = c; + str_buf[3] = 0; + str_buf[5] = 0; + for (; workp < p - chars_length ;) + { + wchar_t *range_start_char, *range_end_char; + + /* match if (range_start_char <= c <= range_end_char). */ + + /* If range_start(or end) < 0, we assume -range_start(end) + is the offset of the collating symbol which is specified + as the character of the range start(end). */ + + /* range_start */ + if (*workp < 0) + range_start_char = charset_top - (*workp++); + else + { + str_buf[0] = *workp++; + range_start_char = str_buf; + } + + /* range_end */ + if (*workp < 0) + range_end_char = charset_top - (*workp++); + else + { + str_buf[4] = *workp++; + range_end_char = str_buf + 4; + } + + if (wcscoll(range_start_char, str_buf+2) <= 0 && + wcscoll(str_buf+2, range_end_char) <= 0) + + goto char_set_matched; + } + } + + /* match with char? */ + for (; workp < p ; workp++) + if (c == *workp) + goto char_set_matched; + + not = !not; + + char_set_matched: + if (not) goto fail; +#else + /* Cast to `unsigned' instead of `unsigned char' in case the + bit list is a full 32 bytes long. */ + if (c < (unsigned) (*p * BYTEWIDTH) + && p[1 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH))) + not = !not; + + p += 1 + *p; + + if (!not) goto fail; +#undef WORK_BUFFER_SIZE +#endif /* MBS_SUPPORT */ + SET_REGS_MATCHED (); + d++; + break; + } + + + /* The beginning of a group is represented by start_memory. + The arguments are the register number in the next byte, and the + number of groups inner to this one in the next. The text + matched within the group is recorded (in the internal + registers data structure) under the register number. */ + case start_memory: + DEBUG_PRINT3 ("EXECUTING start_memory %ld (%ld):\n", + (long int) *p, (long int) p[1]); + + /* Find out if this group can match the empty string. */ + p1 = p; /* To send to group_match_null_string_p. */ + + if (REG_MATCH_NULL_STRING_P (reg_info[*p]) == MATCH_NULL_UNSET_VALUE) + REG_MATCH_NULL_STRING_P (reg_info[*p]) + = group_match_null_string_p (&p1, pend, reg_info); + + /* Save the position in the string where we were the last time + we were at this open-group operator in case the group is + operated upon by a repetition operator, e.g., with `(a*)*b' + against `ab'; then we want to ignore where we are now in + the string in case this attempt to match fails. */ + old_regstart[*p] = REG_MATCH_NULL_STRING_P (reg_info[*p]) + ? REG_UNSET (regstart[*p]) ? d : regstart[*p] + : regstart[*p]; + DEBUG_PRINT2 (" old_regstart: %d\n", + POINTER_TO_OFFSET (old_regstart[*p])); + + regstart[*p] = d; + DEBUG_PRINT2 (" regstart: %d\n", POINTER_TO_OFFSET (regstart[*p])); + + IS_ACTIVE (reg_info[*p]) = 1; + MATCHED_SOMETHING (reg_info[*p]) = 0; + + /* Clear this whenever we change the register activity status. */ + set_regs_matched_done = 0; + + /* This is the new highest active register. */ + highest_active_reg = *p; + + /* If nothing was active before, this is the new lowest active + register. */ + if (lowest_active_reg == NO_LOWEST_ACTIVE_REG) + lowest_active_reg = *p; + + /* Move past the register number and inner group count. */ + p += 2; + just_past_start_mem = p; + + break; + + + /* The stop_memory opcode represents the end of a group. Its + arguments are the same as start_memory's: the register + number, and the number of inner groups. */ + case stop_memory: + DEBUG_PRINT3 ("EXECUTING stop_memory %ld (%ld):\n", + (long int) *p, (long int) p[1]); + + /* We need to save the string position the last time we were at + this close-group operator in case the group is operated + upon by a repetition operator, e.g., with `((a*)*(b*)*)*' + against `aba'; then we want to ignore where we are now in + the string in case this attempt to match fails. */ + old_regend[*p] = REG_MATCH_NULL_STRING_P (reg_info[*p]) + ? REG_UNSET (regend[*p]) ? d : regend[*p] + : regend[*p]; + DEBUG_PRINT2 (" old_regend: %d\n", + POINTER_TO_OFFSET (old_regend[*p])); + + regend[*p] = d; + DEBUG_PRINT2 (" regend: %d\n", POINTER_TO_OFFSET (regend[*p])); + + /* This register isn't active anymore. */ + IS_ACTIVE (reg_info[*p]) = 0; + + /* Clear this whenever we change the register activity status. */ + set_regs_matched_done = 0; + + /* If this was the only register active, nothing is active + anymore. */ + if (lowest_active_reg == highest_active_reg) + { + lowest_active_reg = NO_LOWEST_ACTIVE_REG; + highest_active_reg = NO_HIGHEST_ACTIVE_REG; + } + else + { /* We must scan for the new highest active register, since + it isn't necessarily one less than now: consider + (a(b)c(d(e)f)g). When group 3 ends, after the f), the + new highest active register is 1. */ + US_CHAR_TYPE r = *p - 1; + while (r > 0 && !IS_ACTIVE (reg_info[r])) + r--; + + /* If we end up at register zero, that means that we saved + the registers as the result of an `on_failure_jump', not + a `start_memory', and we jumped to past the innermost + `stop_memory'. For example, in ((.)*) we save + registers 1 and 2 as a result of the *, but when we pop + back to the second ), we are at the stop_memory 1. + Thus, nothing is active. */ + if (r == 0) + { + lowest_active_reg = NO_LOWEST_ACTIVE_REG; + highest_active_reg = NO_HIGHEST_ACTIVE_REG; + } + else + highest_active_reg = r; + } + + /* If just failed to match something this time around with a + group that's operated on by a repetition operator, try to + force exit from the ``loop'', and restore the register + information for this group that we had before trying this + last match. */ + if ((!MATCHED_SOMETHING (reg_info[*p]) + || just_past_start_mem == p - 1) + && (p + 2) < pend) + { + boolean is_a_jump_n = false; + + p1 = p + 2; + mcnt = 0; + switch ((re_opcode_t) *p1++) + { + case jump_n: + is_a_jump_n = true; + case pop_failure_jump: + case maybe_pop_jump: + case jump: + case dummy_failure_jump: + EXTRACT_NUMBER_AND_INCR (mcnt, p1); + if (is_a_jump_n) + p1 += OFFSET_ADDRESS_SIZE; + break; + + default: + /* do nothing */ ; + } + p1 += mcnt; + + /* If the next operation is a jump backwards in the pattern + to an on_failure_jump right before the start_memory + corresponding to this stop_memory, exit from the loop + by forcing a failure after pushing on the stack the + on_failure_jump's jump in the pattern, and d. */ + if (mcnt < 0 && (re_opcode_t) *p1 == on_failure_jump + && (re_opcode_t) p1[1+OFFSET_ADDRESS_SIZE] == start_memory + && p1[2+OFFSET_ADDRESS_SIZE] == *p) + { + /* If this group ever matched anything, then restore + what its registers were before trying this last + failed match, e.g., with `(a*)*b' against `ab' for + regstart[1], and, e.g., with `((a*)*(b*)*)*' + against `aba' for regend[3]. + + Also restore the registers for inner groups for, + e.g., `((a*)(b*))*' against `aba' (register 3 would + otherwise get trashed). */ + + if (EVER_MATCHED_SOMETHING (reg_info[*p])) + { + unsigned r; + + EVER_MATCHED_SOMETHING (reg_info[*p]) = 0; + + /* Restore this and inner groups' (if any) registers. */ + for (r = *p; r < (unsigned) *p + (unsigned) *(p + 1); + r++) + { + regstart[r] = old_regstart[r]; + + /* xx why this test? */ + if (old_regend[r] >= regstart[r]) + regend[r] = old_regend[r]; + } + } + p1++; + EXTRACT_NUMBER_AND_INCR (mcnt, p1); + PUSH_FAILURE_POINT (p1 + mcnt, d, -2); + + goto fail; + } + } + + /* Move past the register number and the inner group count. */ + p += 2; + break; + + + /* \ has been turned into a `duplicate' command which is + followed by the numeric value of as the register number. */ + case duplicate: + { + register const CHAR_TYPE *d2, *dend2; + int regno = *p++; /* Get which register to match against. */ + DEBUG_PRINT2 ("EXECUTING duplicate %d.\n", regno); + + /* Can't back reference a group which we've never matched. */ + if (REG_UNSET (regstart[regno]) || REG_UNSET (regend[regno])) + goto fail; + + /* Where in input to try to start matching. */ + d2 = regstart[regno]; + + /* Where to stop matching; if both the place to start and + the place to stop matching are in the same string, then + set to the place to stop, otherwise, for now have to use + the end of the first string. */ + + dend2 = ((FIRST_STRING_P (regstart[regno]) + == FIRST_STRING_P (regend[regno])) + ? regend[regno] : end_match_1); + for (;;) + { + /* If necessary, advance to next segment in register + contents. */ + while (d2 == dend2) + { + if (dend2 == end_match_2) break; + if (dend2 == regend[regno]) break; + + /* End of string1 => advance to string2. */ + d2 = string2; + dend2 = regend[regno]; + } + /* At end of register contents => success */ + if (d2 == dend2) break; + + /* If necessary, advance to next segment in data. */ + PREFETCH (); + + /* How many characters left in this segment to match. */ + mcnt = dend - d; + + /* Want how many consecutive characters we can match in + one shot, so, if necessary, adjust the count. */ + if (mcnt > dend2 - d2) + mcnt = dend2 - d2; + + /* Compare that many; failure if mismatch, else move + past them. */ + if (translate + ? bcmp_translate (d, d2, mcnt, translate) + : memcmp (d, d2, mcnt*sizeof(US_CHAR_TYPE))) + goto fail; + d += mcnt, d2 += mcnt; + + /* Do this because we've match some characters. */ + SET_REGS_MATCHED (); + } + } + break; + + + /* begline matches the empty string at the beginning of the string + (unless `not_bol' is set in `bufp'), and, if + `newline_anchor' is set, after newlines. */ + case begline: + DEBUG_PRINT1 ("EXECUTING begline.\n"); + + if (AT_STRINGS_BEG (d)) + { + if (!bufp->not_bol) break; + } + else if (d[-1] == '\n' && bufp->newline_anchor) + { + break; + } + /* In all other cases, we fail. */ + goto fail; + + + /* endline is the dual of begline. */ + case endline: + DEBUG_PRINT1 ("EXECUTING endline.\n"); + + if (AT_STRINGS_END (d)) + { + if (!bufp->not_eol) break; + } + + /* We have to ``prefetch'' the next character. */ + else if ((d == end1 ? *string2 : *d) == '\n' + && bufp->newline_anchor) + { + break; + } + goto fail; + + + /* Match at the very beginning of the data. */ + case begbuf: + DEBUG_PRINT1 ("EXECUTING begbuf.\n"); + if (AT_STRINGS_BEG (d)) + break; + goto fail; + + + /* Match at the very end of the data. */ + case endbuf: + DEBUG_PRINT1 ("EXECUTING endbuf.\n"); + if (AT_STRINGS_END (d)) + break; + goto fail; + + + /* on_failure_keep_string_jump is used to optimize `.*\n'. It + pushes NULL as the value for the string on the stack. Then + `pop_failure_point' will keep the current value for the + string, instead of restoring it. To see why, consider + matching `foo\nbar' against `.*\n'. The .* matches the foo; + then the . fails against the \n. But the next thing we want + to do is match the \n against the \n; if we restored the + string value, we would be back at the foo. + + Because this is used only in specific cases, we don't need to + check all the things that `on_failure_jump' does, to make + sure the right things get saved on the stack. Hence we don't + share its code. The only reason to push anything on the + stack at all is that otherwise we would have to change + `anychar's code to do something besides goto fail in this + case; that seems worse than this. */ + case on_failure_keep_string_jump: + DEBUG_PRINT1 ("EXECUTING on_failure_keep_string_jump"); + + EXTRACT_NUMBER_AND_INCR (mcnt, p); +#ifdef _LIBC + DEBUG_PRINT3 (" %d (to %p):\n", mcnt, p + mcnt); +#else + DEBUG_PRINT3 (" %d (to 0x%x):\n", mcnt, p + mcnt); +#endif + + PUSH_FAILURE_POINT (p + mcnt, NULL, -2); + break; + + + /* Uses of on_failure_jump: + + Each alternative starts with an on_failure_jump that points + to the beginning of the next alternative. Each alternative + except the last ends with a jump that in effect jumps past + the rest of the alternatives. (They really jump to the + ending jump of the following alternative, because tensioning + these jumps is a hassle.) + + Repeats start with an on_failure_jump that points past both + the repetition text and either the following jump or + pop_failure_jump back to this on_failure_jump. */ + case on_failure_jump: + on_failure: + DEBUG_PRINT1 ("EXECUTING on_failure_jump"); + + EXTRACT_NUMBER_AND_INCR (mcnt, p); +#ifdef _LIBC + DEBUG_PRINT3 (" %d (to %p)", mcnt, p + mcnt); +#else + DEBUG_PRINT3 (" %d (to 0x%x)", mcnt, p + mcnt); +#endif + + /* If this on_failure_jump comes right before a group (i.e., + the original * applied to a group), save the information + for that group and all inner ones, so that if we fail back + to this point, the group's information will be correct. + For example, in \(a*\)*\1, we need the preceding group, + and in \(zz\(a*\)b*\)\2, we need the inner group. */ + + /* We can't use `p' to check ahead because we push + a failure point to `p + mcnt' after we do this. */ + p1 = p; + + /* We need to skip no_op's before we look for the + start_memory in case this on_failure_jump is happening as + the result of a completed succeed_n, as in \(a\)\{1,3\}b\1 + against aba. */ + while (p1 < pend && (re_opcode_t) *p1 == no_op) + p1++; + + if (p1 < pend && (re_opcode_t) *p1 == start_memory) + { + /* We have a new highest active register now. This will + get reset at the start_memory we are about to get to, + but we will have saved all the registers relevant to + this repetition op, as described above. */ + highest_active_reg = *(p1 + 1) + *(p1 + 2); + if (lowest_active_reg == NO_LOWEST_ACTIVE_REG) + lowest_active_reg = *(p1 + 1); + } + + DEBUG_PRINT1 (":\n"); + PUSH_FAILURE_POINT (p + mcnt, d, -2); + break; + + + /* A smart repeat ends with `maybe_pop_jump'. + We change it to either `pop_failure_jump' or `jump'. */ + case maybe_pop_jump: + EXTRACT_NUMBER_AND_INCR (mcnt, p); + DEBUG_PRINT2 ("EXECUTING maybe_pop_jump %d.\n", mcnt); + { + register US_CHAR_TYPE *p2 = p; + + /* Compare the beginning of the repeat with what in the + pattern follows its end. If we can establish that there + is nothing that they would both match, i.e., that we + would have to backtrack because of (as in, e.g., `a*a') + then we can change to pop_failure_jump, because we'll + never have to backtrack. + + This is not true in the case of alternatives: in + `(a|ab)*' we do need to backtrack to the `ab' alternative + (e.g., if the string was `ab'). But instead of trying to + detect that here, the alternative has put on a dummy + failure point which is what we will end up popping. */ + + /* Skip over open/close-group commands. + If what follows this loop is a ...+ construct, + look at what begins its body, since we will have to + match at least one of that. */ + while (1) + { + if (p2 + 2 < pend + && ((re_opcode_t) *p2 == stop_memory + || (re_opcode_t) *p2 == start_memory)) + p2 += 3; + else if (p2 + 2 + 2 * OFFSET_ADDRESS_SIZE < pend + && (re_opcode_t) *p2 == dummy_failure_jump) + p2 += 2 + 2 * OFFSET_ADDRESS_SIZE; + else + break; + } + + p1 = p + mcnt; + /* p1[0] ... p1[2] are the `on_failure_jump' corresponding + to the `maybe_finalize_jump' of this case. Examine what + follows. */ + + /* If we're at the end of the pattern, we can change. */ + if (p2 == pend) + { + /* Consider what happens when matching ":\(.*\)" + against ":/". I don't really understand this code + yet. */ + p[-(1+OFFSET_ADDRESS_SIZE)] = (US_CHAR_TYPE) + pop_failure_jump; + DEBUG_PRINT1 + (" End of pattern: change to `pop_failure_jump'.\n"); + } + + else if ((re_opcode_t) *p2 == exactn +#ifdef MBS_SUPPORT + || (re_opcode_t) *p2 == exactn_bin +#endif + || (bufp->newline_anchor && (re_opcode_t) *p2 == endline)) + { + register US_CHAR_TYPE c + = *p2 == (US_CHAR_TYPE) endline ? '\n' : p2[2]; + + if (((re_opcode_t) p1[1+OFFSET_ADDRESS_SIZE] == exactn +#ifdef MBS_SUPPORT + || (re_opcode_t) p1[1+OFFSET_ADDRESS_SIZE] == exactn_bin +#endif + ) && p1[3+OFFSET_ADDRESS_SIZE] != c) + { + p[-(1+OFFSET_ADDRESS_SIZE)] = (US_CHAR_TYPE) + pop_failure_jump; +#ifdef MBS_SUPPORT + if (MB_CUR_MAX != 1) + DEBUG_PRINT3 (" %C != %C => pop_failure_jump.\n", + (wint_t) c, + (wint_t) p1[3+OFFSET_ADDRESS_SIZE]); + else +#endif + DEBUG_PRINT3 (" %c != %c => pop_failure_jump.\n", + (char) c, + (char) p1[3+OFFSET_ADDRESS_SIZE]); + } + +#ifndef MBS_SUPPORT + else if ((re_opcode_t) p1[3] == charset + || (re_opcode_t) p1[3] == charset_not) + { + int not = (re_opcode_t) p1[3] == charset_not; + + if (c < (unsigned) (p1[4] * BYTEWIDTH) + && p1[5 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH))) + not = !not; + + /* `not' is equal to 1 if c would match, which means + that we can't change to pop_failure_jump. */ + if (!not) + { + p[-3] = (unsigned char) pop_failure_jump; + DEBUG_PRINT1 (" No match => pop_failure_jump.\n"); + } + } +#endif /* not MBS_SUPPORT */ + } +#ifndef MBS_SUPPORT + else if ((re_opcode_t) *p2 == charset) + { + /* We win if the first character of the loop is not part + of the charset. */ + if ((re_opcode_t) p1[3] == exactn + && ! ((int) p2[1] * BYTEWIDTH > (int) p1[5] + && (p2[2 + p1[5] / BYTEWIDTH] + & (1 << (p1[5] % BYTEWIDTH))))) + { + p[-3] = (unsigned char) pop_failure_jump; + DEBUG_PRINT1 (" No match => pop_failure_jump.\n"); + } + + else if ((re_opcode_t) p1[3] == charset_not) + { + int idx; + /* We win if the charset_not inside the loop + lists every character listed in the charset after. */ + for (idx = 0; idx < (int) p2[1]; idx++) + if (! (p2[2 + idx] == 0 + || (idx < (int) p1[4] + && ((p2[2 + idx] & ~ p1[5 + idx]) == 0)))) + break; + + if (idx == p2[1]) + { + p[-3] = (unsigned char) pop_failure_jump; + DEBUG_PRINT1 (" No match => pop_failure_jump.\n"); + } + } + else if ((re_opcode_t) p1[3] == charset) + { + int idx; + /* We win if the charset inside the loop + has no overlap with the one after the loop. */ + for (idx = 0; + idx < (int) p2[1] && idx < (int) p1[4]; + idx++) + if ((p2[2 + idx] & p1[5 + idx]) != 0) + break; + + if (idx == p2[1] || idx == p1[4]) + { + p[-3] = (unsigned char) pop_failure_jump; + DEBUG_PRINT1 (" No match => pop_failure_jump.\n"); + } + } + } +#endif /* not MBS_SUPPORT */ + } + p -= OFFSET_ADDRESS_SIZE; /* Point at relative address again. */ + if ((re_opcode_t) p[-1] != pop_failure_jump) + { + p[-1] = (US_CHAR_TYPE) jump; + DEBUG_PRINT1 (" Match => jump.\n"); + goto unconditional_jump; + } + /* Note fall through. */ + + + /* The end of a simple repeat has a pop_failure_jump back to + its matching on_failure_jump, where the latter will push a + failure point. The pop_failure_jump takes off failure + points put on by this pop_failure_jump's matching + on_failure_jump; we got through the pattern to here from the + matching on_failure_jump, so didn't fail. */ + case pop_failure_jump: + { + /* We need to pass separate storage for the lowest and + highest registers, even though we don't care about the + actual values. Otherwise, we will restore only one + register from the stack, since lowest will == highest in + `pop_failure_point'. */ + active_reg_t dummy_low_reg, dummy_high_reg; + US_CHAR_TYPE *pdummy = NULL; + const CHAR_TYPE *sdummy = NULL; + + DEBUG_PRINT1 ("EXECUTING pop_failure_jump.\n"); + POP_FAILURE_POINT (sdummy, pdummy, + dummy_low_reg, dummy_high_reg, + reg_dummy, reg_dummy, reg_info_dummy); + } + /* Note fall through. */ + + unconditional_jump: +#ifdef _LIBC + DEBUG_PRINT2 ("\n%p: ", p); +#else + DEBUG_PRINT2 ("\n0x%x: ", p); +#endif + /* Note fall through. */ + + /* Unconditionally jump (without popping any failure points). */ + case jump: + EXTRACT_NUMBER_AND_INCR (mcnt, p); /* Get the amount to jump. */ + DEBUG_PRINT2 ("EXECUTING jump %d ", mcnt); + p += mcnt; /* Do the jump. */ +#ifdef _LIBC + DEBUG_PRINT2 ("(to %p).\n", p); +#else + DEBUG_PRINT2 ("(to 0x%x).\n", p); +#endif + break; + + + /* We need this opcode so we can detect where alternatives end + in `group_match_null_string_p' et al. */ + case jump_past_alt: + DEBUG_PRINT1 ("EXECUTING jump_past_alt.\n"); + goto unconditional_jump; + + + /* Normally, the on_failure_jump pushes a failure point, which + then gets popped at pop_failure_jump. We will end up at + pop_failure_jump, also, and with a pattern of, say, `a+', we + are skipping over the on_failure_jump, so we have to push + something meaningless for pop_failure_jump to pop. */ + case dummy_failure_jump: + DEBUG_PRINT1 ("EXECUTING dummy_failure_jump.\n"); + /* It doesn't matter what we push for the string here. What + the code at `fail' tests is the value for the pattern. */ + PUSH_FAILURE_POINT (NULL, NULL, -2); + goto unconditional_jump; + + + /* At the end of an alternative, we need to push a dummy failure + point in case we are followed by a `pop_failure_jump', because + we don't want the failure point for the alternative to be + popped. For example, matching `(a|ab)*' against `aab' + requires that we match the `ab' alternative. */ + case push_dummy_failure: + DEBUG_PRINT1 ("EXECUTING push_dummy_failure.\n"); + /* See comments just above at `dummy_failure_jump' about the + two zeroes. */ + PUSH_FAILURE_POINT (NULL, NULL, -2); + break; + + /* Have to succeed matching what follows at least n times. + After that, handle like `on_failure_jump'. */ + case succeed_n: + EXTRACT_NUMBER (mcnt, p + OFFSET_ADDRESS_SIZE); + DEBUG_PRINT2 ("EXECUTING succeed_n %d.\n", mcnt); + + assert (mcnt >= 0); + /* Originally, this is how many times we HAVE to succeed. */ + if (mcnt > 0) + { + mcnt--; + p += OFFSET_ADDRESS_SIZE; + STORE_NUMBER_AND_INCR (p, mcnt); +#ifdef _LIBC + DEBUG_PRINT3 (" Setting %p to %d.\n", p - OFFSET_ADDRESS_SIZE + , mcnt); +#else + DEBUG_PRINT3 (" Setting 0x%x to %d.\n", p - OFFSET_ADDRESS_SIZE + , mcnt); +#endif + } + else if (mcnt == 0) + { +#ifdef _LIBC + DEBUG_PRINT2 (" Setting two bytes from %p to no_op.\n", + p + OFFSET_ADDRESS_SIZE); +#else + DEBUG_PRINT2 (" Setting two bytes from 0x%x to no_op.\n", + p + OFFSET_ADDRESS_SIZE); +#endif /* _LIBC */ + +#ifdef MBS_SUPPORT + p[1] = (US_CHAR_TYPE) no_op; +#else + p[2] = (US_CHAR_TYPE) no_op; + p[3] = (US_CHAR_TYPE) no_op; +#endif /* MBS_SUPPORT */ + goto on_failure; + } + break; + + case jump_n: + EXTRACT_NUMBER (mcnt, p + OFFSET_ADDRESS_SIZE); + DEBUG_PRINT2 ("EXECUTING jump_n %d.\n", mcnt); + + /* Originally, this is how many times we CAN jump. */ + if (mcnt) + { + mcnt--; + STORE_NUMBER (p + OFFSET_ADDRESS_SIZE, mcnt); + +#ifdef _LIBC + DEBUG_PRINT3 (" Setting %p to %d.\n", p + OFFSET_ADDRESS_SIZE, + mcnt); +#else + DEBUG_PRINT3 (" Setting 0x%x to %d.\n", p + OFFSET_ADDRESS_SIZE, + mcnt); +#endif /* _LIBC */ + goto unconditional_jump; + } + /* If don't have to jump any more, skip over the rest of command. */ + else + p += 2 * OFFSET_ADDRESS_SIZE; + break; + + case set_number_at: + { + DEBUG_PRINT1 ("EXECUTING set_number_at.\n"); + + EXTRACT_NUMBER_AND_INCR (mcnt, p); + p1 = p + mcnt; + EXTRACT_NUMBER_AND_INCR (mcnt, p); +#ifdef _LIBC + DEBUG_PRINT3 (" Setting %p to %d.\n", p1, mcnt); +#else + DEBUG_PRINT3 (" Setting 0x%x to %d.\n", p1, mcnt); +#endif + STORE_NUMBER (p1, mcnt); + break; + } + +#if 0 + /* The DEC Alpha C compiler 3.x generates incorrect code for the + test WORDCHAR_P (d - 1) != WORDCHAR_P (d) in the expansion of + AT_WORD_BOUNDARY, so this code is disabled. Expanding the + macro and introducing temporary variables works around the bug. */ + + case wordbound: + DEBUG_PRINT1 ("EXECUTING wordbound.\n"); + if (AT_WORD_BOUNDARY (d)) + break; + goto fail; + + case notwordbound: + DEBUG_PRINT1 ("EXECUTING notwordbound.\n"); + if (AT_WORD_BOUNDARY (d)) + goto fail; + break; +#else + case wordbound: + { + boolean prevchar, thischar; + + DEBUG_PRINT1 ("EXECUTING wordbound.\n"); + if (AT_STRINGS_BEG (d) || AT_STRINGS_END (d)) + break; + + prevchar = WORDCHAR_P (d - 1); + thischar = WORDCHAR_P (d); + if (prevchar != thischar) + break; + goto fail; + } + + case notwordbound: + { + boolean prevchar, thischar; + + DEBUG_PRINT1 ("EXECUTING notwordbound.\n"); + if (AT_STRINGS_BEG (d) || AT_STRINGS_END (d)) + goto fail; + + prevchar = WORDCHAR_P (d - 1); + thischar = WORDCHAR_P (d); + if (prevchar != thischar) + goto fail; + break; + } +#endif + + case wordbeg: + DEBUG_PRINT1 ("EXECUTING wordbeg.\n"); + if (WORDCHAR_P (d) && (AT_STRINGS_BEG (d) || !WORDCHAR_P (d - 1))) + break; + goto fail; + + case wordend: + DEBUG_PRINT1 ("EXECUTING wordend.\n"); + if (!AT_STRINGS_BEG (d) && WORDCHAR_P (d - 1) + && (!WORDCHAR_P (d) || AT_STRINGS_END (d))) + break; + goto fail; + +#ifdef emacs + case before_dot: + DEBUG_PRINT1 ("EXECUTING before_dot.\n"); + if (PTR_CHAR_POS ((unsigned char *) d) >= point) + goto fail; + break; + + case at_dot: + DEBUG_PRINT1 ("EXECUTING at_dot.\n"); + if (PTR_CHAR_POS ((unsigned char *) d) != point) + goto fail; + break; + + case after_dot: + DEBUG_PRINT1 ("EXECUTING after_dot.\n"); + if (PTR_CHAR_POS ((unsigned char *) d) <= point) + goto fail; + break; + + case syntaxspec: + DEBUG_PRINT2 ("EXECUTING syntaxspec %d.\n", mcnt); + mcnt = *p++; + goto matchsyntax; + + case wordchar: + DEBUG_PRINT1 ("EXECUTING Emacs wordchar.\n"); + mcnt = (int) Sword; + matchsyntax: + PREFETCH (); + /* Can't use *d++ here; SYNTAX may be an unsafe macro. */ + d++; + if (SYNTAX (d[-1]) != (enum syntaxcode) mcnt) + goto fail; + SET_REGS_MATCHED (); + break; + + case notsyntaxspec: + DEBUG_PRINT2 ("EXECUTING notsyntaxspec %d.\n", mcnt); + mcnt = *p++; + goto matchnotsyntax; + + case notwordchar: + DEBUG_PRINT1 ("EXECUTING Emacs notwordchar.\n"); + mcnt = (int) Sword; + matchnotsyntax: + PREFETCH (); + /* Can't use *d++ here; SYNTAX may be an unsafe macro. */ + d++; + if (SYNTAX (d[-1]) == (enum syntaxcode) mcnt) + goto fail; + SET_REGS_MATCHED (); + break; + +#else /* not emacs */ + case wordchar: + DEBUG_PRINT1 ("EXECUTING non-Emacs wordchar.\n"); + PREFETCH (); + if (!WORDCHAR_P (d)) + goto fail; + SET_REGS_MATCHED (); + d++; + break; + + case notwordchar: + DEBUG_PRINT1 ("EXECUTING non-Emacs notwordchar.\n"); + PREFETCH (); + if (WORDCHAR_P (d)) + goto fail; + SET_REGS_MATCHED (); + d++; + break; +#endif /* not emacs */ + + default: + abort (); + } + continue; /* Successfully executed one pattern command; keep going. */ + + + /* We goto here if a matching operation fails. */ + fail: + if (!FAIL_STACK_EMPTY ()) + { /* A restart point is known. Restore to that state. */ + DEBUG_PRINT1 ("\nFAIL:\n"); + POP_FAILURE_POINT (d, p, + lowest_active_reg, highest_active_reg, + regstart, regend, reg_info); + + /* If this failure point is a dummy, try the next one. */ + if (!p) + goto fail; + + /* If we failed to the end of the pattern, don't examine *p. */ + assert (p <= pend); + if (p < pend) + { + boolean is_a_jump_n = false; + + /* If failed to a backwards jump that's part of a repetition + loop, need to pop this failure point and use the next one. */ + switch ((re_opcode_t) *p) + { + case jump_n: + is_a_jump_n = true; + case maybe_pop_jump: + case pop_failure_jump: + case jump: + p1 = p + 1; + EXTRACT_NUMBER_AND_INCR (mcnt, p1); + p1 += mcnt; + + if ((is_a_jump_n && (re_opcode_t) *p1 == succeed_n) + || (!is_a_jump_n + && (re_opcode_t) *p1 == on_failure_jump)) + goto fail; + break; + default: + /* do nothing */ ; + } + } + + if (d >= string1 && d <= end1) + dend = end_match_1; + } + else + break; /* Matching at this starting point really fails. */ + } /* for (;;) */ + + if (best_regs_set) + goto restore_best_regs; + + FREE_VARIABLES (); + + return -1; /* Failure to match. */ +} /* re_match_2 */ + +/* Subroutine definitions for re_match_2. */ + + +/* We are passed P pointing to a register number after a start_memory. + + Return true if the pattern up to the corresponding stop_memory can + match the empty string, and false otherwise. + + If we find the matching stop_memory, sets P to point to one past its number. + Otherwise, sets P to an undefined byte less than or equal to END. + + We don't handle duplicates properly (yet). */ + +static boolean +group_match_null_string_p (p, end, reg_info) + US_CHAR_TYPE **p, *end; + register_info_type *reg_info; +{ + int mcnt; + /* Point to after the args to the start_memory. */ + US_CHAR_TYPE *p1 = *p + 2; + + while (p1 < end) + { + /* Skip over opcodes that can match nothing, and return true or + false, as appropriate, when we get to one that can't, or to the + matching stop_memory. */ + + switch ((re_opcode_t) *p1) + { + /* Could be either a loop or a series of alternatives. */ + case on_failure_jump: + p1++; + EXTRACT_NUMBER_AND_INCR (mcnt, p1); + + /* If the next operation is not a jump backwards in the + pattern. */ + + if (mcnt >= 0) + { + /* Go through the on_failure_jumps of the alternatives, + seeing if any of the alternatives cannot match nothing. + The last alternative starts with only a jump, + whereas the rest start with on_failure_jump and end + with a jump, e.g., here is the pattern for `a|b|c': + + /on_failure_jump/0/6/exactn/1/a/jump_past_alt/0/6 + /on_failure_jump/0/6/exactn/1/b/jump_past_alt/0/3 + /exactn/1/c + + So, we have to first go through the first (n-1) + alternatives and then deal with the last one separately. */ + + + /* Deal with the first (n-1) alternatives, which start + with an on_failure_jump (see above) that jumps to right + past a jump_past_alt. */ + + while ((re_opcode_t) p1[mcnt-(1+OFFSET_ADDRESS_SIZE)] == + jump_past_alt) + { + /* `mcnt' holds how many bytes long the alternative + is, including the ending `jump_past_alt' and + its number. */ + + if (!alt_match_null_string_p (p1, p1 + mcnt - + (1 + OFFSET_ADDRESS_SIZE), + reg_info)) + return false; + + /* Move to right after this alternative, including the + jump_past_alt. */ + p1 += mcnt; + + /* Break if it's the beginning of an n-th alternative + that doesn't begin with an on_failure_jump. */ + if ((re_opcode_t) *p1 != on_failure_jump) + break; + + /* Still have to check that it's not an n-th + alternative that starts with an on_failure_jump. */ + p1++; + EXTRACT_NUMBER_AND_INCR (mcnt, p1); + if ((re_opcode_t) p1[mcnt-(1+OFFSET_ADDRESS_SIZE)] != + jump_past_alt) + { + /* Get to the beginning of the n-th alternative. */ + p1 -= 1 + OFFSET_ADDRESS_SIZE; + break; + } + } + + /* Deal with the last alternative: go back and get number + of the `jump_past_alt' just before it. `mcnt' contains + the length of the alternative. */ + EXTRACT_NUMBER (mcnt, p1 - OFFSET_ADDRESS_SIZE); + + if (!alt_match_null_string_p (p1, p1 + mcnt, reg_info)) + return false; + + p1 += mcnt; /* Get past the n-th alternative. */ + } /* if mcnt > 0 */ + break; + + + case stop_memory: + assert (p1[1] == **p); + *p = p1 + 2; + return true; + + + default: + if (!common_op_match_null_string_p (&p1, end, reg_info)) + return false; + } + } /* while p1 < end */ + + return false; +} /* group_match_null_string_p */ + + +/* Similar to group_match_null_string_p, but doesn't deal with alternatives: + It expects P to be the first byte of a single alternative and END one + byte past the last. The alternative can contain groups. */ + +static boolean +alt_match_null_string_p (p, end, reg_info) + US_CHAR_TYPE *p, *end; + register_info_type *reg_info; +{ + int mcnt; + US_CHAR_TYPE *p1 = p; + + while (p1 < end) + { + /* Skip over opcodes that can match nothing, and break when we get + to one that can't. */ + + switch ((re_opcode_t) *p1) + { + /* It's a loop. */ + case on_failure_jump: + p1++; + EXTRACT_NUMBER_AND_INCR (mcnt, p1); + p1 += mcnt; + break; + + default: + if (!common_op_match_null_string_p (&p1, end, reg_info)) + return false; + } + } /* while p1 < end */ + + return true; +} /* alt_match_null_string_p */ + + +/* Deals with the ops common to group_match_null_string_p and + alt_match_null_string_p. + + Sets P to one after the op and its arguments, if any. */ + +static boolean +common_op_match_null_string_p (p, end, reg_info) + US_CHAR_TYPE **p, *end; + register_info_type *reg_info; +{ + int mcnt; + boolean ret; + int reg_no; + US_CHAR_TYPE *p1 = *p; + + switch ((re_opcode_t) *p1++) + { + case no_op: + case begline: + case endline: + case begbuf: + case endbuf: + case wordbeg: + case wordend: + case wordbound: + case notwordbound: +#ifdef emacs + case before_dot: + case at_dot: + case after_dot: +#endif + break; + + case start_memory: + reg_no = *p1; + assert (reg_no > 0 && reg_no <= MAX_REGNUM); + ret = group_match_null_string_p (&p1, end, reg_info); + + /* Have to set this here in case we're checking a group which + contains a group and a back reference to it. */ + + if (REG_MATCH_NULL_STRING_P (reg_info[reg_no]) == MATCH_NULL_UNSET_VALUE) + REG_MATCH_NULL_STRING_P (reg_info[reg_no]) = ret; + + if (!ret) + return false; + break; + + /* If this is an optimized succeed_n for zero times, make the jump. */ + case jump: + EXTRACT_NUMBER_AND_INCR (mcnt, p1); + if (mcnt >= 0) + p1 += mcnt; + else + return false; + break; + + case succeed_n: + /* Get to the number of times to succeed. */ + p1 += OFFSET_ADDRESS_SIZE; + EXTRACT_NUMBER_AND_INCR (mcnt, p1); + + if (mcnt == 0) + { + p1 -= 2 * OFFSET_ADDRESS_SIZE; + EXTRACT_NUMBER_AND_INCR (mcnt, p1); + p1 += mcnt; + } + else + return false; + break; + + case duplicate: + if (!REG_MATCH_NULL_STRING_P (reg_info[*p1])) + return false; + break; + + case set_number_at: + p1 += 2 * OFFSET_ADDRESS_SIZE; + + default: + /* All other opcodes mean we cannot match the empty string. */ + return false; + } + + *p = p1; + return true; +} /* common_op_match_null_string_p */ + + +/* Return zero if TRANSLATE[S1] and TRANSLATE[S2] are identical for LEN + bytes; nonzero otherwise. */ + +static int +bcmp_translate (s1, s2, len, translate) + const CHAR_TYPE *s1, *s2; + register int len; + RE_TRANSLATE_TYPE translate; +{ + register const US_CHAR_TYPE *p1 = (const US_CHAR_TYPE *) s1; + register const US_CHAR_TYPE *p2 = (const US_CHAR_TYPE *) s2; + while (len) + { +#ifdef MBS_SUPPORT + if (((*p1<=0xff)?translate[*p1++]:*p1++) + != ((*p2<=0xff)?translate[*p2++]:*p2++)) + return 1; +#else + if (translate[*p1++] != translate[*p2++]) return 1; +#endif /* MBS_SUPPORT */ + len--; + } + return 0; +} + +/* Entry points for GNU code. */ + +/* re_compile_pattern is the GNU regular expression compiler: it + compiles PATTERN (of length SIZE) and puts the result in BUFP. + Returns 0 if the pattern was valid, otherwise an error string. + + Assumes the `allocated' (and perhaps `buffer') and `translate' fields + are set in BUFP on entry. + + We call regex_compile to do the actual compilation. */ + +const char * +re_compile_pattern (pattern, length, bufp) + const char *pattern; + size_t length; + struct re_pattern_buffer *bufp; +{ + reg_errcode_t ret; + + /* GNU code is written to assume at least RE_NREGS registers will be set + (and at least one extra will be -1). */ + bufp->regs_allocated = REGS_UNALLOCATED; + + /* And GNU code determines whether or not to get register information + by passing null for the REGS argument to re_match, etc., not by + setting no_sub. */ + bufp->no_sub = 0; + + /* Match anchors at newline. */ + bufp->newline_anchor = 1; + + ret = regex_compile (pattern, length, re_syntax_options, bufp); + + if (!ret) + return NULL; + return gettext (re_error_msgid + re_error_msgid_idx[(int) ret]); +} +#ifdef _LIBC +weak_alias (__re_compile_pattern, re_compile_pattern) +#endif + +/* Entry points compatible with 4.2 BSD regex library. We don't define + them unless specifically requested. */ + +#if defined _REGEX_RE_COMP || defined _LIBC + +/* BSD has one and only one pattern buffer. */ +static struct re_pattern_buffer re_comp_buf; + +char * +#ifdef _LIBC +/* Make these definitions weak in libc, so POSIX programs can redefine + these names if they don't use our functions, and still use + regcomp/regexec below without link errors. */ +weak_function +#endif +re_comp (s) + const char *s; +{ + reg_errcode_t ret; + + if (!s) + { + if (!re_comp_buf.buffer) + return gettext ("No previous regular expression"); + return 0; + } + + if (!re_comp_buf.buffer) + { + re_comp_buf.buffer = (unsigned char *) malloc (200); + if (re_comp_buf.buffer == NULL) + return (char *) gettext (re_error_msgid + + re_error_msgid_idx[(int) REG_ESPACE]); + re_comp_buf.allocated = 200; + + re_comp_buf.fastmap = (char *) malloc (1 << BYTEWIDTH); + if (re_comp_buf.fastmap == NULL) + return (char *) gettext (re_error_msgid + + re_error_msgid_idx[(int) REG_ESPACE]); + } + + /* Since `re_exec' always passes NULL for the `regs' argument, we + don't need to initialize the pattern buffer fields which affect it. */ + + /* Match anchors at newlines. */ + re_comp_buf.newline_anchor = 1; + + ret = regex_compile (s, strlen (s), re_syntax_options, &re_comp_buf); + + if (!ret) + return NULL; + + /* Yes, we're discarding `const' here if !HAVE_LIBINTL. */ + return (char *) gettext (re_error_msgid + re_error_msgid_idx[(int) ret]); +} + + +int +#ifdef _LIBC +weak_function +#endif +re_exec (s) + const char *s; +{ + const int len = strlen (s); + return + 0 <= re_search (&re_comp_buf, s, len, 0, len, (struct re_registers *) 0); +} + +#endif /* _REGEX_RE_COMP */ + +/* POSIX.2 functions. Don't define these for Emacs. */ + +#ifndef emacs + +/* regcomp takes a regular expression as a string and compiles it. + + PREG is a regex_t *. We do not expect any fields to be initialized, + since POSIX says we shouldn't. Thus, we set + + `buffer' to the compiled pattern; + `used' to the length of the compiled pattern; + `syntax' to RE_SYNTAX_POSIX_EXTENDED if the + REG_EXTENDED bit in CFLAGS is set; otherwise, to + RE_SYNTAX_POSIX_BASIC; + `newline_anchor' to REG_NEWLINE being set in CFLAGS; + `fastmap' to an allocated space for the fastmap; + `fastmap_accurate' to zero; + `re_nsub' to the number of subexpressions in PATTERN. + + PATTERN is the address of the pattern string. + + CFLAGS is a series of bits which affect compilation. + + If REG_EXTENDED is set, we use POSIX extended syntax; otherwise, we + use POSIX basic syntax. + + If REG_NEWLINE is set, then . and [^...] don't match newline. + Also, regexec will try a match beginning after every newline. + + If REG_ICASE is set, then we considers upper- and lowercase + versions of letters to be equivalent when matching. + + If REG_NOSUB is set, then when PREG is passed to regexec, that + routine will report only success or failure, and nothing about the + registers. + + It returns 0 if it succeeds, nonzero if it doesn't. (See regex.h for + the return codes and their meanings.) */ + +int +regcomp (preg, pattern, cflags) + regex_t *preg; + const char *pattern; + int cflags; +{ + reg_errcode_t ret; + reg_syntax_t syntax + = (cflags & REG_EXTENDED) ? + RE_SYNTAX_POSIX_EXTENDED : RE_SYNTAX_POSIX_BASIC; + + /* regex_compile will allocate the space for the compiled pattern. */ + preg->buffer = 0; + preg->allocated = 0; + preg->used = 0; + + /* Try to allocate space for the fastmap. */ + preg->fastmap = (char *) malloc (1 << BYTEWIDTH); + + if (cflags & REG_ICASE) + { + unsigned i; + + preg->translate + = (RE_TRANSLATE_TYPE) malloc (CHAR_SET_SIZE + * sizeof (*(RE_TRANSLATE_TYPE)0)); + if (preg->translate == NULL) + return (int) REG_ESPACE; + + /* Map uppercase characters to corresponding lowercase ones. */ + for (i = 0; i < CHAR_SET_SIZE; i++) + preg->translate[i] = ISUPPER (i) ? TOLOWER (i) : i; + } + else + preg->translate = NULL; + + /* If REG_NEWLINE is set, newlines are treated differently. */ + if (cflags & REG_NEWLINE) + { /* REG_NEWLINE implies neither . nor [^...] match newline. */ + syntax &= ~RE_DOT_NEWLINE; + syntax |= RE_HAT_LISTS_NOT_NEWLINE; + /* It also changes the matching behavior. */ + preg->newline_anchor = 1; + } + else + preg->newline_anchor = 0; + + preg->no_sub = !!(cflags & REG_NOSUB); + + /* POSIX says a null character in the pattern terminates it, so we + can use strlen here in compiling the pattern. */ + ret = regex_compile (pattern, strlen (pattern), syntax, preg); + + /* POSIX doesn't distinguish between an unmatched open-group and an + unmatched close-group: both are REG_EPAREN. */ + if (ret == REG_ERPAREN) ret = REG_EPAREN; + + if (ret == REG_NOERROR && preg->fastmap) + { + /* Compute the fastmap now, since regexec cannot modify the pattern + buffer. */ + if (re_compile_fastmap (preg) == -2) + { + /* Some error occurred while computing the fastmap, just forget + about it. */ + free (preg->fastmap); + preg->fastmap = NULL; + } + } + + return (int) ret; +} +#ifdef _LIBC +weak_alias (__regcomp, regcomp) +#endif + + +/* regexec searches for a given pattern, specified by PREG, in the + string STRING. + + If NMATCH is zero or REG_NOSUB was set in the cflags argument to + `regcomp', we ignore PMATCH. Otherwise, we assume PMATCH has at + least NMATCH elements, and we set them to the offsets of the + corresponding matched substrings. + + EFLAGS specifies `execution flags' which affect matching: if + REG_NOTBOL is set, then ^ does not match at the beginning of the + string; if REG_NOTEOL is set, then $ does not match at the end. + + We return 0 if we find a match and REG_NOMATCH if not. */ + +int +regexec (preg, string, nmatch, pmatch, eflags) + const regex_t *preg; + const char *string; + size_t nmatch; + regmatch_t pmatch[]; + int eflags; +{ + int ret; + struct re_registers regs; + regex_t private_preg; + int len = strlen (string); + boolean want_reg_info = !preg->no_sub && nmatch > 0; + + private_preg = *preg; + + private_preg.not_bol = !!(eflags & REG_NOTBOL); + private_preg.not_eol = !!(eflags & REG_NOTEOL); + + /* The user has told us exactly how many registers to return + information about, via `nmatch'. We have to pass that on to the + matching routines. */ + private_preg.regs_allocated = REGS_FIXED; + + if (want_reg_info) + { + regs.num_regs = nmatch; + regs.start = TALLOC (nmatch * 2, regoff_t); + if (regs.start == NULL) + return (int) REG_NOMATCH; + regs.end = regs.start + nmatch; + } + + /* Perform the searching operation. */ + ret = re_search (&private_preg, string, len, + /* start: */ 0, /* range: */ len, + want_reg_info ? ®s : (struct re_registers *) 0); + + /* Copy the register information to the POSIX structure. */ + if (want_reg_info) + { + if (ret >= 0) + { + unsigned r; + + for (r = 0; r < nmatch; r++) + { + pmatch[r].rm_so = regs.start[r]; + pmatch[r].rm_eo = regs.end[r]; + } + } + + /* If we needed the temporary register info, free the space now. */ + free (regs.start); + } + + /* We want zero return to mean success, unlike `re_search'. */ + return ret >= 0 ? (int) REG_NOERROR : (int) REG_NOMATCH; +} +#ifdef _LIBC +weak_alias (__regexec, regexec) +#endif + + +/* Returns a message corresponding to an error code, ERRCODE, returned + from either regcomp or regexec. We don't use PREG here. */ + +size_t +regerror (errcode, preg, errbuf, errbuf_size) + int errcode; + const regex_t *preg; + char *errbuf; + size_t errbuf_size; +{ + const char *msg; + size_t msg_size; + + if (errcode < 0 + || errcode >= (int) (sizeof (re_error_msgid_idx) + / sizeof (re_error_msgid_idx[0]))) + /* Only error codes returned by the rest of the code should be passed + to this routine. If we are given anything else, or if other regex + code generates an invalid error code, then the program has a bug. + Dump core so we can fix it. */ + abort (); + + msg = gettext (re_error_msgid + re_error_msgid_idx[errcode]); + + msg_size = strlen (msg) + 1; /* Includes the null. */ + + if (errbuf_size != 0) + { + if (msg_size > errbuf_size) + { +#if defined HAVE_MEMPCPY || defined _LIBC + *((char *) __mempcpy (errbuf, msg, errbuf_size - 1)) = '\0'; +#else + memcpy (errbuf, msg, errbuf_size - 1); + errbuf[errbuf_size - 1] = 0; +#endif + } + else + memcpy (errbuf, msg, msg_size); + } + + return msg_size; +} +#ifdef _LIBC +weak_alias (__regerror, regerror) +#endif + + +/* Free dynamically allocated space used by PREG. */ + +void +regfree (preg) + regex_t *preg; +{ + if (preg->buffer != NULL) + free (preg->buffer); + preg->buffer = NULL; + + preg->allocated = 0; + preg->used = 0; + + if (preg->fastmap != NULL) + free (preg->fastmap); + preg->fastmap = NULL; + preg->fastmap_accurate = 0; + + if (preg->translate != NULL) + free (preg->translate); + preg->translate = NULL; +} +#ifdef _LIBC +weak_alias (__regfree, regfree) +#endif + +#endif /* not emacs */ diff --git a/lib/regex.h b/lib/regex.h new file mode 100644 index 0000000..81789be --- /dev/null +++ b/lib/regex.h @@ -0,0 +1,46 @@ +#ifndef _REGEX_H +#include + +/* Document internal interfaces. */ +extern reg_syntax_t __re_set_syntax _RE_ARGS ((reg_syntax_t syntax)); + +extern const char *__re_compile_pattern + _RE_ARGS ((const char *pattern, size_t length, + struct re_pattern_buffer *buffer)); + +extern int __re_compile_fastmap _RE_ARGS ((struct re_pattern_buffer *buffer)); + +extern int __re_search + _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string, + int length, int start, int range, struct re_registers *regs)); + +extern int __re_search_2 + _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1, + int length1, const char *string2, int length2, + int start, int range, struct re_registers *regs, int stop)); + +extern int __re_match + _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string, + int length, int start, struct re_registers *regs)); + +extern int __re_match_2 + _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1, + int length1, const char *string2, int length2, + int start, struct re_registers *regs, int stop)); + +extern void __re_set_registers + _RE_ARGS ((struct re_pattern_buffer *buffer, struct re_registers *regs, + unsigned num_regs, regoff_t *starts, regoff_t *ends)); + +extern int __regcomp _RE_ARGS ((regex_t *__preg, const char *__pattern, + int __cflags)); + +extern int __regexec _RE_ARGS ((const regex_t *__preg, + const char *__string, size_t __nmatch, + regmatch_t __pmatch[], int __eflags)); + +extern size_t __regerror _RE_ARGS ((int __errcode, const regex_t *__preg, + char *__errbuf, size_t __errbuf_size)); + +extern void __regfree _RE_ARGS ((regex_t *__preg)); +#endif diff --git a/lib/savedir.c b/lib/savedir.c new file mode 100644 index 0000000..974787e --- /dev/null +++ b/lib/savedir.c @@ -0,0 +1,187 @@ +/* savedir.c -- save the list of files in a directory in a string + Copyright (C) 1990, 1997, 1998, 1999, 2000, 2001 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by David MacKenzie . */ + +#if HAVE_CONFIG_H +# include +#endif + +#include + +#if HAVE_UNISTD_H +# include +#endif + +#if HAVE_DIRENT_H +# include +# define NAMLEN(dirent) strlen((dirent)->d_name) +#else +# define dirent direct +# define NAMLEN(dirent) (dirent)->d_namlen +# if HAVE_SYS_NDIR_H +# include +# endif +# if HAVE_SYS_DIR_H +# include +# endif +# if HAVE_NDIR_H +# include +# endif +#endif + +#ifdef CLOSEDIR_VOID +/* Fake a return value. */ +# define CLOSEDIR(d) (closedir (d), 0) +#else +# define CLOSEDIR(d) closedir (d) +#endif + +#ifdef STDC_HEADERS +# include +# include +#else +char *malloc (); +char *realloc (); +#endif +#ifndef NULL +# define NULL 0 +#endif + +#ifndef stpcpy +char *stpcpy (); +#endif + +#include +#include "savedir.h" + +char *path; +size_t pathlen; + +static int +isdir1 (const char *dir, const char *file) +{ + int status; + int slash; + size_t dirlen = strlen (dir); + size_t filelen = strlen (file); + if ((dirlen + filelen + 2) > pathlen) + { + path = calloc (dirlen + 1 + filelen + 1, sizeof (*path)); + pathlen = dirlen + filelen + 2; + } + strcpy (path, dir); + slash = (path[dirlen] != '/'); + path[dirlen] = '/'; + strcpy (path + dirlen + slash , file); + status = isdir (path); + return status; +} + +/* Return a freshly allocated string containing the filenames + in directory DIR, separated by '\0' characters; + the end is marked by two '\0' characters in a row. + NAME_SIZE is the number of bytes to initially allocate + for the string; it will be enlarged as needed. + Return NULL if DIR cannot be opened or if out of memory. */ +char * +savedir (const char *dir, off_t name_size, struct exclude *included_patterns, + struct exclude *excluded_patterns, struct exclude *excluded_directory_patterns ) +{ + DIR *dirp; + struct dirent *dp; + char *name_space; + char *namep; + + dirp = opendir (dir); + if (dirp == NULL) + return NULL; + + /* Be sure name_size is at least `1' so there's room for + the final NUL byte. */ + if (name_size <= 0) + name_size = 1; + + name_space = (char *) malloc (name_size); + if (name_space == NULL) + { + closedir (dirp); + return NULL; + } + namep = name_space; + + while ((dp = readdir (dirp)) != NULL) + { + /* Skip "." and ".." (some NFS filesystems' directories lack them). */ + if (dp->d_name[0] != '.' + || (dp->d_name[1] != '\0' + && (dp->d_name[1] != '.' || dp->d_name[2] != '\0'))) + { + off_t size_needed = (namep - name_space) + NAMLEN (dp) + 2; + + if ((included_patterns || excluded_patterns) + && !isdir1 (dir, dp->d_name)) + { + if (included_patterns + && !excluded_filename (included_patterns, dp->d_name, 0)) + continue; + if (excluded_patterns + && excluded_filename (excluded_patterns, dp->d_name, 0)) + continue; + } + + if ( excluded_directory_patterns + && isdir1 (dir, dp->d_name) ) + { + if (excluded_directory_patterns + && excluded_filename (excluded_directory_patterns, dp->d_name, 0)) + continue; + } + + if (size_needed > name_size) + { + char *new_name_space; + + while (size_needed > name_size) + name_size += 1024; + + new_name_space = realloc (name_space, name_size); + if (new_name_space == NULL) + { + closedir (dirp); + return NULL; + } + namep += new_name_space - name_space; + name_space = new_name_space; + } + namep = stpcpy (namep, dp->d_name) + 1; + } + } + *namep = '\0'; + if (CLOSEDIR (dirp)) + { + free (name_space); + return NULL; + } + if (path) + { + free (path); + path = NULL; + pathlen = 0; + } + return name_space; +} diff --git a/lib/savedir.h b/lib/savedir.h new file mode 100644 index 0000000..a5f6e44 --- /dev/null +++ b/lib/savedir.h @@ -0,0 +1,19 @@ +#if !defined SAVEDIR_H_ +# define SAVEDIR_H_ + +#include "exclude.h" + +# ifndef PARAMS +# if defined PROTOTYPES || (defined __STDC__ && __STDC__) +# define PARAMS(Args) Args +# else +# define PARAMS(Args) () +# endif +# endif + +extern char * +savedir PARAMS ((const char *dir, off_t name_size, + struct exclude *, struct exclude *, + struct exclude *)); + +#endif diff --git a/lib/stpcpy.c b/lib/stpcpy.c new file mode 100644 index 0000000..c6139df --- /dev/null +++ b/lib/stpcpy.c @@ -0,0 +1,50 @@ +/* stpcpy.c -- copy a string and return pointer to end of new string + Copyright (C) 1992, 1995, 1997, 1998 Free Software Foundation, Inc. + + NOTE: The canonical source of this file is maintained with the GNU C Library. + Bugs can be reported to bug-glibc@prep.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 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, + USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#undef __stpcpy +#undef stpcpy + +#ifndef weak_alias +# define __stpcpy stpcpy +#endif + +/* Copy SRC to DEST, returning the address of the terminating '\0' in DEST. */ +char * +__stpcpy (char *dest, const char *src) +{ + register char *d = dest; + register const char *s = src; + + do + *d++ = *s; + while (*s++ != '\0'); + + return d - 1; +} +#ifdef weak_alias +weak_alias (__stpcpy, stpcpy) +#endif diff --git a/lib/strtol.c b/lib/strtol.c new file mode 100644 index 0000000..196903c --- /dev/null +++ b/lib/strtol.c @@ -0,0 +1,476 @@ +/* Convert string representation of a number into an integer value. + Copyright (C) 1991, 92, 94, 95, 96, 97, 98, 99, 01 Free Software Foundation, Inc. + NOTE: The canonical source of this file is maintained with the GNU C + Library. Bugs can be reported to bug-glibc@gnu.org. + + 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +#if HAVE_CONFIG_H +# include +#endif + +#ifdef _LIBC +# define USE_NUMBER_GROUPING +# define STDC_HEADERS +# define HAVE_LIMITS_H +#endif + +#include +#include +#ifndef errno +extern int errno; +#endif +#ifndef __set_errno +# define __set_errno(Val) errno = (Val) +#endif + +#ifdef HAVE_LIMITS_H +# include +#endif + +#ifdef STDC_HEADERS +# include +# include +# include +#else +# ifndef NULL +# define NULL 0 +# endif +#endif + +#ifdef USE_NUMBER_GROUPING +# include "../locale/localeinfo.h" +#endif + +#ifndef CHAR_BIT +# define CHAR_BIT 8 +#endif + +/* Nonzero if we are defining `strtoul' or `strtoull', operating on + unsigned integers. */ +#ifndef UNSIGNED +# define UNSIGNED 0 +# define INT LONG int +#else +# define INT unsigned LONG int +#endif + +/* Determine the name. */ +#ifdef USE_IN_EXTENDED_LOCALE_MODEL +# if UNSIGNED +# ifdef USE_WIDE_CHAR +# ifdef QUAD +# define strtol __wcstoull_l +# else +# define strtol __wcstoul_l +# endif +# else +# ifdef QUAD +# define strtol __strtoull_l +# else +# define strtol __strtoul_l +# endif +# endif +# else +# ifdef USE_WIDE_CHAR +# ifdef QUAD +# define strtol __wcstoll_l +# else +# define strtol __wcstol_l +# endif +# else +# ifdef QUAD +# define strtol __strtoll_l +# else +# define strtol __strtol_l +# endif +# endif +# endif +#else +# if UNSIGNED +# ifdef USE_WIDE_CHAR +# ifdef QUAD +# define strtol wcstoull +# else +# define strtol wcstoul +# endif +# else +# ifdef QUAD +# define strtol strtoull +# else +# define strtol strtoul +# endif +# endif +# else +# ifdef USE_WIDE_CHAR +# ifdef QUAD +# define strtol wcstoll +# else +# define strtol wcstol +# endif +# else +# ifdef QUAD +# define strtol strtoll +# endif +# endif +# endif +#endif + +/* If QUAD is defined, we are defining `strtoll' or `strtoull', + operating on `long long int's. */ +#ifdef QUAD +# define LONG long long +# define STRTOL_LONG_MIN LONG_LONG_MIN +# define STRTOL_LONG_MAX LONG_LONG_MAX +# define STRTOL_ULONG_MAX ULONG_LONG_MAX + +/* The extra casts work around common compiler bugs, + e.g. Cray C 5.0.3.0 when t == time_t. */ +# ifndef TYPE_SIGNED +# define TYPE_SIGNED(t) (! ((t) 0 < (t) -1)) +# endif +# ifndef TYPE_MINIMUM +# define TYPE_MINIMUM(t) ((t) (TYPE_SIGNED (t) \ + ? ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1) \ + : (t) 0)) +# endif +# ifndef TYPE_MAXIMUM +# define TYPE_MAXIMUM(t) ((t) (~ (t) 0 - TYPE_MINIMUM (t))) +# endif + +# ifndef ULONG_LONG_MAX +# define ULONG_LONG_MAX TYPE_MAXIMUM (unsigned long long) +# endif +# ifndef LONG_LONG_MAX +# define LONG_LONG_MAX TYPE_MAXIMUM (long long int) +# endif +# ifndef LONG_LONG_MIN +# define LONG_LONG_MIN TYPE_MINIMUM (long long int) +# endif + +# if __GNUC__ == 2 && __GNUC_MINOR__ < 7 + /* Work around gcc bug with using this constant. */ + static const unsigned long long int maxquad = ULONG_LONG_MAX; +# undef STRTOL_ULONG_MAX +# define STRTOL_ULONG_MAX maxquad +# endif +#else +# define LONG long + +# ifndef ULONG_MAX +# define ULONG_MAX ((unsigned long) ~(unsigned long) 0) +# endif +# ifndef LONG_MAX +# define LONG_MAX ((long int) (ULONG_MAX >> 1)) +# endif +# define STRTOL_LONG_MIN LONG_MIN +# define STRTOL_LONG_MAX LONG_MAX +# define STRTOL_ULONG_MAX ULONG_MAX +#endif + + +/* We use this code also for the extended locale handling where the + function gets as an additional argument the locale which has to be + used. To access the values we have to redefine the _NL_CURRENT + macro. */ +#ifdef USE_IN_EXTENDED_LOCALE_MODEL +# undef _NL_CURRENT +# define _NL_CURRENT(category, item) \ + (current->values[_NL_ITEM_INDEX (item)].string) +# define LOCALE_PARAM , loc +# define LOCALE_PARAM_DECL __locale_t loc; +#else +# define LOCALE_PARAM +# define LOCALE_PARAM_DECL +#endif + +#if defined _LIBC || defined HAVE_WCHAR_H +# include +#endif + +#ifdef USE_WIDE_CHAR +# include +# define L_(Ch) L##Ch +# define UCHAR_TYPE wint_t +# define STRING_TYPE wchar_t +# ifdef USE_IN_EXTENDED_LOCALE_MODEL +# define ISSPACE(Ch) __iswspace_l ((Ch), loc) +# define ISALPHA(Ch) __iswalpha_l ((Ch), loc) +# define TOUPPER(Ch) __towupper_l ((Ch), loc) +# else +# define ISSPACE(Ch) iswspace (Ch) +# define ISALPHA(Ch) iswalpha (Ch) +# define TOUPPER(Ch) towupper (Ch) +# endif +#else +# if defined STDC_HEADERS || (!defined isascii && !defined HAVE_ISASCII) +# define IN_CTYPE_DOMAIN(c) 1 +# else +# define IN_CTYPE_DOMAIN(c) isascii(c) +# endif +# define L_(Ch) Ch +# define UCHAR_TYPE unsigned char +# define STRING_TYPE char +# ifdef USE_IN_EXTENDED_LOCALE_MODEL +# define ISSPACE(Ch) __isspace_l ((Ch), loc) +# define ISALPHA(Ch) __isalpha_l ((Ch), loc) +# define TOUPPER(Ch) __toupper_l ((Ch), loc) +# else +# define ISSPACE(Ch) (IN_CTYPE_DOMAIN (Ch) && isspace (Ch)) +# define ISALPHA(Ch) (IN_CTYPE_DOMAIN (Ch) && isalpha (Ch)) +# define TOUPPER(Ch) (IN_CTYPE_DOMAIN (Ch) ? toupper (Ch) : (Ch)) +# endif +#endif + +/* For compilers which are ansi but don't define __STDC__, like SGI + Irix-4.0.5 cc, also check whether PROTOTYPES is defined. */ +#if defined (__STDC__) || defined (PROTOTYPES) +# define INTERNAL(X) INTERNAL1(X) +# define INTERNAL1(X) __##X##_internal +# define WEAKNAME(X) WEAKNAME1(X) +#else +# define INTERNAL(X) __/**/X/**/_internal +#endif + +#ifdef USE_NUMBER_GROUPING +/* This file defines a function to check for correct grouping. */ +# include "grouping.h" +#endif + + + +/* Convert NPTR to an `unsigned long int' or `long int' in base BASE. + If BASE is 0 the base is determined by the presence of a leading + zero, indicating octal or a leading "0x" or "0X", indicating hexadecimal. + If BASE is < 2 or > 36, it is reset to 10. + If ENDPTR is not NULL, a pointer to the character after the last + one converted is stored in *ENDPTR. */ + +INT +INTERNAL (strtol) (nptr, endptr, base, group LOCALE_PARAM) + const STRING_TYPE *nptr; + STRING_TYPE **endptr; + int base; + int group; + LOCALE_PARAM_DECL +{ + int negative; + register unsigned LONG int cutoff; + register unsigned int cutlim; + register unsigned LONG int i; + register const STRING_TYPE *s; + register UCHAR_TYPE c; + const STRING_TYPE *save, *end; + int overflow; + +#ifdef USE_NUMBER_GROUPING +# ifdef USE_IN_EXTENDED_LOCALE_MODEL + struct locale_data *current = loc->__locales[LC_NUMERIC]; +# endif + /* The thousands character of the current locale. */ + wchar_t thousands = L'\0'; + /* The numeric grouping specification of the current locale, + in the format described in . */ + const char *grouping; + + if (group) + { + grouping = _NL_CURRENT (LC_NUMERIC, GROUPING); + if (*grouping <= 0 || *grouping == CHAR_MAX) + grouping = NULL; + else + { + /* Figure out the thousands separator character. */ +# if defined _LIBC || defined _HAVE_BTOWC + thousands = __btowc (*_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP)); + if (thousands == WEOF) + thousands = L'\0'; +# endif + if (thousands == L'\0') + grouping = NULL; + } + } + else + grouping = NULL; +#endif + + if (base < 0 || base == 1 || base > 36) + { + __set_errno (EINVAL); + return 0; + } + + save = s = nptr; + + /* Skip white space. */ + while (ISSPACE (*s)) + ++s; + if (*s == L_('\0')) + goto noconv; + + /* Check for a sign. */ + if (*s == L_('-')) + { + negative = 1; + ++s; + } + else if (*s == L_('+')) + { + negative = 0; + ++s; + } + else + negative = 0; + + /* Recognize number prefix and if BASE is zero, figure it out ourselves. */ + if (*s == L_('0')) + { + if ((base == 0 || base == 16) && TOUPPER (s[1]) == L_('X')) + { + s += 2; + base = 16; + } + else if (base == 0) + base = 8; + } + else if (base == 0) + base = 10; + + /* Save the pointer so we can check later if anything happened. */ + save = s; + +#ifdef USE_NUMBER_GROUPING + if (group) + { + /* Find the end of the digit string and check its grouping. */ + end = s; + for (c = *end; c != L_('\0'); c = *++end) + if ((wchar_t) c != thousands + && ((wchar_t) c < L_('0') || (wchar_t) c > L_('9')) + && (!ISALPHA (c) || (int) (TOUPPER (c) - L_('A') + 10) >= base)) + break; + if (*s == thousands) + end = s; + else + end = correctly_grouped_prefix (s, end, thousands, grouping); + } + else +#endif + end = NULL; + + cutoff = STRTOL_ULONG_MAX / (unsigned LONG int) base; + cutlim = STRTOL_ULONG_MAX % (unsigned LONG int) base; + + overflow = 0; + i = 0; + for (c = *s; c != L_('\0'); c = *++s) + { + if (s == end) + break; + if (c >= L_('0') && c <= L_('9')) + c -= L_('0'); + else if (ISALPHA (c)) + c = TOUPPER (c) - L_('A') + 10; + else + break; + if ((int) c >= base) + break; + /* Check for overflow. */ + if (i > cutoff || (i == cutoff && c > cutlim)) + overflow = 1; + else + { + i *= (unsigned LONG int) base; + i += c; + } + } + + /* Check if anything actually happened. */ + if (s == save) + goto noconv; + + /* Store in ENDPTR the address of one character + past the last character we converted. */ + if (endptr != NULL) + *endptr = (STRING_TYPE *) s; + +#if !UNSIGNED + /* Check for a value that is within the range of + `unsigned LONG int', but outside the range of `LONG int'. */ + if (overflow == 0 + && i > (negative + ? -((unsigned LONG int) (STRTOL_LONG_MIN + 1)) + 1 + : (unsigned LONG int) STRTOL_LONG_MAX)) + overflow = 1; +#endif + + if (overflow) + { + __set_errno (ERANGE); +#if UNSIGNED + return STRTOL_ULONG_MAX; +#else + return negative ? STRTOL_LONG_MIN : STRTOL_LONG_MAX; +#endif + } + + /* Return the result of the appropriate sign. */ + return negative ? -i : i; + +noconv: + /* We must handle a special case here: the base is 0 or 16 and the + first two characters are '0' and 'x', but the rest are no + hexadecimal digits. This is no error case. We return 0 and + ENDPTR points to the `x`. */ + if (endptr != NULL) + { + if (save - nptr >= 2 && TOUPPER (save[-1]) == L_('X') + && save[-2] == L_('0')) + *endptr = (STRING_TYPE *) &save[-1]; + else + /* There was no number to convert. */ + *endptr = (STRING_TYPE *) nptr; + } + + return 0L; +} + +/* External user entry point. */ + +#if _LIBC - 0 == 0 +# undef PARAMS +# if defined (__STDC__) && __STDC__ +# define PARAMS(Args) Args +# else +# define PARAMS(Args) () +# endif + +/* Prototype. */ +INT strtol PARAMS ((const STRING_TYPE *nptr, STRING_TYPE **endptr, int base)); +#endif + + +INT +#ifdef weak_function +weak_function +#endif +strtol (nptr, endptr, base LOCALE_PARAM) + const STRING_TYPE *nptr; + STRING_TYPE **endptr; + int base; + LOCALE_PARAM_DECL +{ + return INTERNAL (strtol) (nptr, endptr, base, 0 LOCALE_PARAM); +} diff --git a/lib/strtoul.c b/lib/strtoul.c new file mode 100644 index 0000000..45e55e6 --- /dev/null +++ b/lib/strtoul.c @@ -0,0 +1,22 @@ +/* Copyright (C) 1991, 1999 Free Software Foundation, Inc. + +NOTE: The canonical source of this file is maintained with the GNU C Library. +Bugs can be reported to bug-glibc@prep.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 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +#define UNSIGNED 1 + +#include diff --git a/lib/strtoull.c b/lib/strtoull.c new file mode 100644 index 0000000..b848280 --- /dev/null +++ b/lib/strtoull.c @@ -0,0 +1,27 @@ +/* Function to parse an `unsigned long long int' from text. + Copyright (C) 1995, 1996, 1997, 1999 Free Software Foundation, Inc. + NOTE: The canonical source of this file is maintained with the GNU C + Library. Bugs can be reported to bug-glibc@gnu.org. + + 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +#define QUAD 1 + +#include "strtoul.c" + +#ifdef _LIBC +strong_alias (__strtoull_internal, __strtouq_internal) +weak_alias (strtoull, strtouq) +#endif diff --git a/lib/strtoumax.c b/lib/strtoumax.c new file mode 100644 index 0000000..fb3ad11 --- /dev/null +++ b/lib/strtoumax.c @@ -0,0 +1,81 @@ +/* Convert string representation of a number into an uintmax_t value. + Copyright 1999 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Paul Eggert. */ + +#if HAVE_CONFIG_H +# include +#endif + +#if HAVE_INTTYPES_H +# include +#endif + +#if HAVE_STDLIB_H +# include +#endif + +#ifndef PARAMS +# if defined PROTOTYPES || defined __STDC__ +# define PARAMS(Args) Args +# else +# define PARAMS(Args) () +# endif +#endif + +#ifndef HAVE_DECL_STRTOUL +"this configure-time declaration test was not run" +#endif +#if !HAVE_DECL_STRTOUL +unsigned long strtoul PARAMS ((char const *, char **, int)); +#endif + +#ifndef HAVE_DECL_STRTOULL +"this configure-time declaration test was not run" +#endif +#if !HAVE_DECL_STRTOULL && HAVE_UNSIGNED_LONG_LONG +unsigned long long strtoull PARAMS ((char const *, char **, int)); +#endif + +uintmax_t +strtoumax (char const *ptr, char **endptr, int base) +{ +#define USE_IF_EQUIVALENT(function) \ + if (sizeof (uintmax_t) == sizeof function (ptr, endptr, base)) \ + return function (ptr, endptr, base); + +#if HAVE_UNSIGNED_LONG_LONG + USE_IF_EQUIVALENT (strtoull) +#endif + + USE_IF_EQUIVALENT (strtoul) + + abort (); +} + +#ifdef TESTING +# include +int +main () +{ + char *p, *endptr; + printf ("sizeof uintmax_t: %d\n", sizeof (uintmax_t)); + printf ("sizeof strtoull(): %d\n", sizeof strtoull(p, &endptr, 10)); + printf ("sizeof strtoul(): %d\n", sizeof strtoul(p, &endptr, 10)); + exit (0); +} +#endif diff --git a/lib/xalloc.h b/lib/xalloc.h new file mode 100644 index 0000000..4b721da --- /dev/null +++ b/lib/xalloc.h @@ -0,0 +1,87 @@ +/* xalloc.h -- malloc with out-of-memory checking + Copyright (C) 1990-1998, 1999, 2000 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifndef XALLOC_H_ +# define XALLOC_H_ + +# ifndef PARAMS +# if defined PROTOTYPES || (defined __STDC__ && __STDC__) +# define PARAMS(Args) Args +# else +# define PARAMS(Args) () +# endif +# endif + +# ifndef __attribute__ +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) || __STRICT_ANSI__ +# define __attribute__(x) +# endif +# endif + +# ifndef ATTRIBUTE_NORETURN +# define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__)) +# endif + +/* Exit value when the requested amount of memory is not available. + It is initialized to EXIT_FAILURE, but the caller may set it to + some other value. */ +extern int xalloc_exit_failure; + +/* If this pointer is non-zero, run the specified function upon each + allocation failure. It is initialized to zero. */ +extern void (*xalloc_fail_func) PARAMS ((void)); + +/* If XALLOC_FAIL_FUNC is undefined or a function that returns, this + message is output. It is translated via gettext. + Its value is "memory exhausted". */ +extern char const xalloc_msg_memory_exhausted[]; + +/* This function is always triggered when memory is exhausted. It is + in charge of honoring the three previous items. This is the + function to call when one wants the program to die because of a + memory allocation failure. */ +extern void xalloc_die PARAMS ((void)) ATTRIBUTE_NORETURN; + +void *xmalloc PARAMS ((size_t n)); +void *xcalloc PARAMS ((size_t n, size_t s)); +void *xrealloc PARAMS ((void *p, size_t n)); +char *xstrdup PARAMS ((const char *str)); + +# define XMALLOC(Type, N_items) ((Type *) xmalloc (sizeof (Type) * (N_items))) +# define XCALLOC(Type, N_items) ((Type *) xcalloc (sizeof (Type), (N_items))) +# define XREALLOC(Ptr, Type, N_items) \ + ((Type *) xrealloc ((void *) (Ptr), sizeof (Type) * (N_items))) + +/* Declare and alloc memory for VAR of type TYPE. */ +# define NEW(Type, Var) Type *(Var) = XMALLOC (Type, 1) + +/* Free VAR only if non NULL. */ +# define XFREE(Var) \ + do { \ + if (Var) \ + free (Var); \ + } while (0) + +/* Return a pointer to a malloc'ed copy of the array SRC of NUM elements. */ +# define CCLONE(Src, Num) \ + (memcpy (xmalloc (sizeof (*Src) * (Num)), (Src), sizeof (*Src) * (Num))) + +/* Return a malloc'ed copy of SRC. */ +# define CLONE(Src) CCLONE (Src, 1) + + +#endif /* !XALLOC_H_ */ diff --git a/lib/xmalloc.c b/lib/xmalloc.c new file mode 100644 index 0000000..ac38f90 --- /dev/null +++ b/lib/xmalloc.c @@ -0,0 +1,116 @@ +/* xmalloc.c -- malloc with out of memory checking + Copyright (C) 1990-1999, 2000 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +#if HAVE_CONFIG_H +# include +#endif + +#include + +#if STDC_HEADERS +# include +#else +void *calloc (); +void *malloc (); +void *realloc (); +void free (); +#endif + +#if ENABLE_NLS +# include +# define _(Text) gettext (Text) +#else +# define textdomain(Domain) +# define _(Text) Text +#endif +#define N_(Text) Text + +#include "error.h" +#include "xalloc.h" + +#ifndef EXIT_FAILURE +# define EXIT_FAILURE 1 +#endif + +#ifndef HAVE_DONE_WORKING_MALLOC_CHECK +"you must run the autoconf test for a properly working malloc -- see malloc.m4" +#endif + +#ifndef HAVE_DONE_WORKING_REALLOC_CHECK +"you must run the autoconf test for a properly working realloc --see realloc.m4" +#endif + +/* Exit value when the requested amount of memory is not available. + The caller may set it to some other value. */ +int xalloc_exit_failure = EXIT_FAILURE; + +/* If non NULL, call this function when memory is exhausted. */ +void (*xalloc_fail_func) PARAMS ((void)) = 0; + +/* If XALLOC_FAIL_FUNC is NULL, or does return, display this message + before exiting when memory is exhausted. Goes through gettext. */ +char const xalloc_msg_memory_exhausted[] = N_("memory exhausted"); + +void +xalloc_die (void) +{ + if (xalloc_fail_func) + (*xalloc_fail_func) (); + error (xalloc_exit_failure, 0, "%s", _(xalloc_msg_memory_exhausted)); + /* The `noreturn' cannot be given to error, since it may return if + its first argument is 0. To help compilers understand the + xalloc_die does terminate, call exit. */ + exit (EXIT_FAILURE); +} + +/* Allocate N bytes of memory dynamically, with error checking. */ + +void * +xmalloc (size_t n) +{ + void *p; + + p = malloc (n); + if (p == 0) + xalloc_die (); + return p; +} + +/* Change the size of an allocated block of memory P to N bytes, + with error checking. */ + +void * +xrealloc (void *p, size_t n) +{ + p = realloc (p, n); + if (p == 0) + xalloc_die (); + return p; +} + +/* Allocate memory for N elements of S bytes, with error checking. */ + +void * +xcalloc (size_t n, size_t s) +{ + void *p; + + p = calloc (n, s); + if (p == 0) + xalloc_die (); + return p; +} diff --git a/lib/xstrtol.c b/lib/xstrtol.c new file mode 100644 index 0000000..9d4fa2e --- /dev/null +++ b/lib/xstrtol.c @@ -0,0 +1,282 @@ +/* A more useful interface to strtol. + Copyright (C) 1995, 1996, 1998-2000 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Jim Meyering. */ + +#if HAVE_CONFIG_H +# include +#endif + +#ifndef __strtol +# define __strtol strtol +# define __strtol_t long int +# define __xstrtol xstrtol +#endif + +/* Some pre-ANSI implementations (e.g. SunOS 4) + need stderr defined if assertion checking is enabled. */ +#include + +#if STDC_HEADERS +# include +#endif + +#if HAVE_STRING_H +# include +#else +# include +# ifndef strchr +# define strchr index +# endif +#endif + +#include +#include + +#include +#ifndef errno +extern int errno; +#endif + +#if HAVE_LIMITS_H +# include +#endif + +#ifndef CHAR_BIT +# define CHAR_BIT 8 +#endif + +/* The extra casts work around common compiler bugs. */ +#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1)) +/* The outer cast is needed to work around a bug in Cray C 5.0.3.0. + It is necessary at least when t == time_t. */ +#define TYPE_MINIMUM(t) ((t) (TYPE_SIGNED (t) \ + ? ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1) : (t) 0)) +#define TYPE_MAXIMUM(t) (~ (t) 0 - TYPE_MINIMUM (t)) + +#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII)) +# define IN_CTYPE_DOMAIN(c) 1 +#else +# define IN_CTYPE_DOMAIN(c) isascii(c) +#endif + +#define ISSPACE(c) (IN_CTYPE_DOMAIN (c) && isspace (c)) + +#include "xstrtol.h" + +#ifndef strtol +long int strtol (); +#endif + +#ifndef strtoul +unsigned long int strtoul (); +#endif + +#ifndef strtoumax +uintmax_t strtoumax (); +#endif + +static int +bkm_scale (__strtol_t *x, int scale_factor) +{ + __strtol_t product = *x * scale_factor; + if (*x != product / scale_factor) + return 1; + *x = product; + return 0; +} + +static int +bkm_scale_by_power (__strtol_t *x, int base, int power) +{ + while (power--) + if (bkm_scale (x, base)) + return 1; + + return 0; +} + +/* FIXME: comment. */ + +strtol_error +__xstrtol (const char *s, char **ptr, int strtol_base, + __strtol_t *val, const char *valid_suffixes) +{ + char *t_ptr; + char **p; + __strtol_t tmp; + + assert (0 <= strtol_base && strtol_base <= 36); + + p = (ptr ? ptr : &t_ptr); + + if (! TYPE_SIGNED (__strtol_t)) + { + const char *q = s; + while (ISSPACE ((unsigned char) *q)) + ++q; + if (*q == '-') + return LONGINT_INVALID; + } + + errno = 0; + tmp = __strtol (s, p, strtol_base); + if (errno != 0) + return LONGINT_OVERFLOW; + if (*p == s) + return LONGINT_INVALID; + + /* Let valid_suffixes == NULL mean `allow any suffix'. */ + /* FIXME: update all callers except the ones that allow suffixes + after the number, changing last parameter NULL to `""'. */ + if (!valid_suffixes) + { + *val = tmp; + return LONGINT_OK; + } + + if (**p != '\0') + { + int base = 1024; + int suffixes = 1; + int overflow; + + if (!strchr (valid_suffixes, **p)) + { + *val = tmp; + return LONGINT_INVALID_SUFFIX_CHAR; + } + + if (strchr (valid_suffixes, '0')) + { + /* The ``valid suffix'' '0' is a special flag meaning that + an optional second suffix is allowed, which can change + the base, e.g. "100MD" for 100 megabytes decimal. */ + + switch (p[0][1]) + { + case 'B': + suffixes++; + break; + + case 'D': + base = 1000; + suffixes++; + break; + } + } + + switch (**p) + { + case 'b': + overflow = bkm_scale (&tmp, 512); + break; + + case 'B': + overflow = bkm_scale (&tmp, 1024); + break; + + case 'c': + overflow = 0; + break; + + case 'E': /* Exa */ + overflow = bkm_scale_by_power (&tmp, base, 6); + break; + + case 'G': /* Giga */ + overflow = bkm_scale_by_power (&tmp, base, 3); + break; + + case 'k': /* kilo */ + overflow = bkm_scale_by_power (&tmp, base, 1); + break; + + case 'M': /* Mega */ + case 'm': /* 'm' is undocumented; for backward compatibility only */ + overflow = bkm_scale_by_power (&tmp, base, 2); + break; + + case 'P': /* Peta */ + overflow = bkm_scale_by_power (&tmp, base, 5); + break; + + case 'T': /* Tera */ + overflow = bkm_scale_by_power (&tmp, base, 4); + break; + + case 'w': + overflow = bkm_scale (&tmp, 2); + break; + + case 'Y': /* Yotta */ + overflow = bkm_scale_by_power (&tmp, base, 8); + break; + + case 'Z': /* Zetta */ + overflow = bkm_scale_by_power (&tmp, base, 7); + break; + + default: + *val = tmp; + return LONGINT_INVALID_SUFFIX_CHAR; + break; + } + + if (overflow) + return LONGINT_OVERFLOW; + + (*p) += suffixes; + } + + *val = tmp; + return LONGINT_OK; +} + +#ifdef TESTING_XSTRTO + +# include +# include "error.h" + +char *program_name; + +int +main (int argc, char** argv) +{ + strtol_error s_err; + int i; + + program_name = argv[0]; + for (i=1; i%lu (%s)\n", argv[i], val, p); + } + else + { + STRTOL_FATAL_ERROR (argv[i], "arg", s_err); + } + } + exit (0); +} + +#endif /* TESTING_XSTRTO */ diff --git a/lib/xstrtol.h b/lib/xstrtol.h new file mode 100644 index 0000000..7a9a024 --- /dev/null +++ b/lib/xstrtol.h @@ -0,0 +1,64 @@ +#ifndef XSTRTOL_H_ +# define XSTRTOL_H_ 1 + +# if HAVE_INTTYPES_H +# include /* for uintmax_t */ +# endif + +# ifndef PARAMS +# if defined PROTOTYPES || (defined __STDC__ && __STDC__) +# define PARAMS(Args) Args +# else +# define PARAMS(Args) () +# endif +# endif + +# ifndef _STRTOL_ERROR +enum strtol_error + { + LONGINT_OK, LONGINT_INVALID, LONGINT_INVALID_SUFFIX_CHAR, LONGINT_OVERFLOW + }; +typedef enum strtol_error strtol_error; +# endif + +# define _DECLARE_XSTRTOL(name, type) \ + strtol_error \ + name PARAMS ((const char *s, char **ptr, int base, \ + type *val, const char *valid_suffixes)); +_DECLARE_XSTRTOL (xstrtol, long int) +_DECLARE_XSTRTOL (xstrtoul, unsigned long int) +_DECLARE_XSTRTOL (xstrtoumax, uintmax_t) + +# define _STRTOL_ERROR(Exit_code, Str, Argument_type_string, Err) \ + do \ + { \ + switch ((Err)) \ + { \ + case LONGINT_OK: \ + abort (); \ + \ + case LONGINT_INVALID: \ + error ((Exit_code), 0, "invalid %s `%s'", \ + (Argument_type_string), (Str)); \ + break; \ + \ + case LONGINT_INVALID_SUFFIX_CHAR: \ + error ((Exit_code), 0, "invalid character following %s `%s'", \ + (Argument_type_string), (Str)); \ + break; \ + \ + case LONGINT_OVERFLOW: \ + error ((Exit_code), 0, "%s `%s' too large", \ + (Argument_type_string), (Str)); \ + break; \ + } \ + } \ + while (0) + +# define STRTOL_FATAL_ERROR(Str, Argument_type_string, Err) \ + _STRTOL_ERROR (2, Str, Argument_type_string, Err) + +# define STRTOL_FAIL_WARN(Str, Argument_type_string, Err) \ + _STRTOL_ERROR (0, Str, Argument_type_string, Err) + +#endif /* not XSTRTOL_H_ */ diff --git a/lib/xstrtoumax.c b/lib/xstrtoumax.c new file mode 100644 index 0000000..d5e45e7 --- /dev/null +++ b/lib/xstrtoumax.c @@ -0,0 +1,31 @@ +/* xstrtoumax.c -- A more useful interface to strtoumax. + Copyright 1999 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Paul Eggert. */ + +#if HAVE_CONFIG_H +# include +#endif + +#if HAVE_INTTYPES_H +# include +#endif + +#define __strtol strtoumax +#define __strtol_t uintmax_t +#define __xstrtol xstrtoumax +#include "xstrtol.c" diff --git a/m4/.cvsignore b/m4/.cvsignore new file mode 100644 index 0000000..282522d --- /dev/null +++ b/m4/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/m4/Makefile.am b/m4/Makefile.am new file mode 100644 index 0000000..6ac7e49 --- /dev/null +++ b/m4/Makefile.am @@ -0,0 +1,27 @@ +## Process this file with automake to create Makefile.in +AUTOMAKE_OPTIONS = no-dependencies + +EXTRA_DIST = decl.m4 \ + djgpp.m4 \ + dosfile.m4 \ + envsep.m4 \ + error.m4 \ + gettext.m4 \ + glibc.m4 \ + header.m4 \ + install.m4 \ + inttypes_h.m4 \ + isc-posix.m4 \ + largefile.m4 \ + lcmessage.m4 \ + malloc.m4 \ + mbstate_t.m4 \ + missing.m4 \ + progtest.m4 \ + realloc.m4 \ + regex.m4 \ + sanity.m4 \ + strerror_r.m4 \ + uintmax_t.m4 \ + ulonglong.m4 \ + xstrtoumax.m4 diff --git a/m4/Makefile.in b/m4/Makefile.in new file mode 100644 index 0000000..c63a462 --- /dev/null +++ b/m4/Makefile.in @@ -0,0 +1,365 @@ +# Makefile.in generated by automake 1.10 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = m4 +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/codeset.m4 \ + $(top_srcdir)/m4/decl.m4 $(top_srcdir)/m4/djgpp.m4 \ + $(top_srcdir)/m4/dosfile.m4 $(top_srcdir)/m4/envsep.m4 \ + $(top_srcdir)/m4/error.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/header.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/inttypes_h.m4 \ + $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/largefile.m4 \ + $(top_srcdir)/m4/lcmessage.m4 $(top_srcdir)/m4/malloc.m4 \ + $(top_srcdir)/m4/mbstate_t.m4 $(top_srcdir)/m4/missing.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/realloc.m4 \ + $(top_srcdir)/m4/regex.m4 $(top_srcdir)/m4/sanity.m4 \ + $(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/ulonglong.m4 \ + $(top_srcdir)/m4/xstrtoumax.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +depcomp = +am__depfiles_maybe = +SOURCES = +DIST_SOURCES = +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GENCAT = @GENCAT@ +GETCONF = @GETCONF@ +GLIBC21 = @GLIBC21@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLBISON = @INTLBISON@ +INTLLIBS = @INTLLIBS@ +INTLOBJS = @INTLOBJS@ +INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +POFILES = @POFILES@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SEP = @SEP@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +U = @U@ +USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AUTOMAKE_OPTIONS = no-dependencies +EXTRA_DIST = decl.m4 \ + djgpp.m4 \ + dosfile.m4 \ + envsep.m4 \ + error.m4 \ + gettext.m4 \ + glibc.m4 \ + header.m4 \ + install.m4 \ + inttypes_h.m4 \ + isc-posix.m4 \ + largefile.m4 \ + lcmessage.m4 \ + malloc.m4 \ + mbstate_t.m4 \ + missing.m4 \ + progtest.m4 \ + realloc.m4 \ + regex.m4 \ + sanity.m4 \ + strerror_r.m4 \ + uintmax_t.m4 \ + ulonglong.m4 \ + xstrtoumax.m4 + +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu m4/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu m4/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-exec-am: + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic distclean \ + distclean-generic distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am + +# 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. +.NOEXPORT: diff --git a/m4/codeset.m4 b/m4/codeset.m4 new file mode 100644 index 0000000..863c9cf --- /dev/null +++ b/m4/codeset.m4 @@ -0,0 +1,17 @@ +#serial AM1 + +dnl From Bruno Haible. + +AC_DEFUN([AM_LANGINFO_CODESET], +[ + AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset, + [AC_TRY_LINK([#include ], + [char* cs = nl_langinfo(CODESET);], + am_cv_langinfo_codeset=yes, + am_cv_langinfo_codeset=no) + ]) + if test $am_cv_langinfo_codeset = yes; then + AC_DEFINE(HAVE_LANGINFO_CODESET, 1, + [Define if you have and nl_langinfo(CODESET).]) + fi +]) diff --git a/m4/decl.m4 b/m4/decl.m4 new file mode 100644 index 0000000..7d20e38 --- /dev/null +++ b/m4/decl.m4 @@ -0,0 +1,37 @@ +#serial 5 + +AC_DEFUN(jm_CHECK_DECLARATION, +[ + AC_MSG_CHECKING([whether $1 is declared]) + AC_CACHE_VAL(jm_cv_func_decl_$1, + [AC_TRY_COMPILE([$2], + [ +#ifndef $1 +char *(*pfn) = (char *(*)) $1 +#endif + ], + eval "jm_cv_func_decl_$1=yes", + eval "jm_cv_func_decl_$1=no")]) + + if eval "test \"`echo '$jm_cv_func_decl_'$1`\" = yes"; then + AC_MSG_RESULT(yes) + ifelse([$3], , :, [$3]) + else + AC_MSG_RESULT(no) + ifelse([$4], , , [$4 +])dnl + fi +])dnl + +dnl jm_CHECK_DECLARATIONS(INCLUDES, FUNCTION... [, ACTION-IF-DECLARED +dnl [, ACTION-IF-NOT-DECLARED]]) +AC_DEFUN(jm_CHECK_DECLARATIONS, +[ + for jm_func in $2 + do + jm_CHECK_DECLARATION($jm_func, [$1], + [ + jm_tr_func=HAVE_DECL_`echo $jm_func | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ` + AC_DEFINE_UNQUOTED($jm_tr_func, 1, [Define if your system declares $1]) $3], [$4])dnl + done +]) diff --git a/m4/djgpp.m4 b/m4/djgpp.m4 new file mode 100644 index 0000000..607c8e5 --- /dev/null +++ b/m4/djgpp.m4 @@ -0,0 +1,9 @@ +dnl Check for DJGPP. we use DJ_GPP as the variable +dnl EXEEXXT +AC_DEFUN(AC_DJGPP, +[AC_CACHE_CHECK(for DJGPP environment, ac_cv_djgpp, +[AC_TRY_COMPILE(,[ return __DJGPP__;], +ac_cv_djgpp=yes, ac_cv_djgpp=no) +rm -f conftest*]) +DJ_GPP= +test "$ac_cv_djgpp" = yes && DJ_GPP=yes]) diff --git a/m4/dosfile.m4 b/m4/dosfile.m4 new file mode 100644 index 0000000..5616eea --- /dev/null +++ b/m4/dosfile.m4 @@ -0,0 +1,21 @@ +# Check to see if we use dir\file name conventtion +# If so, set macro HAVE_DOS_FILE_NAMES +# Also set the macro HAVE_DOS_FILE_CONTENTS for now, +# since don't know of a good way to independently check this. +dnl AC_DOSFILE() +AC_DEFUN(AC_DOSFILE, +[ + AC_CACHE_CHECK([for dos file convention], ac_cv_dosfile, + [if test -d ".\."; then + ac_cv_dosfile=yes + else + ac_cv_dosfile=no + fi + ]) + + if test $ac_cv_dosfile = yes; then + AC_DEFINE(HAVE_DOS_FILE_NAMES, 1, [Define if your OS uses backslashes as directory separators]) + AC_DEFINE(HAVE_DOS_FILE_CONTENTS, 1, + [Define if text file lines end in CRLF.]) + fi +]) diff --git a/m4/envsep.m4 b/m4/envsep.m4 new file mode 100644 index 0000000..8a3d268 --- /dev/null +++ b/m4/envsep.m4 @@ -0,0 +1,20 @@ +# Check to see the separator for the environment variables +# and set SEP to ";" or default ":" + +dnl AM_SEP() +dnl SEP +AC_DEFUN(AM_SEP, +[AC_REQUIRE([AC_CYGWIN]) +AC_REQUIRE([AC_MINGW32]) +AC_REQUIRE([AC_DJGPP]) +AC_MSG_CHECKING([for environ variable separator]) +AC_CACHE_VAL(ac_cv_sep, +[if test "$CYGWIN" = yes || test "$MINGW32" = yes || test "$DJ_GPP" = yes ; then + ac_cv_sep=yes +else + ac_cv_sep=no +fi]) +SEP=":" +test x"$ac_cv_sep" = xyes && SEP=";" +AC_MSG_RESULT(${SEP}) +AC_SUBST(SEP)]) diff --git a/m4/error.m4 b/m4/error.m4 new file mode 100644 index 0000000..eb0f776 --- /dev/null +++ b/m4/error.m4 @@ -0,0 +1,11 @@ +#serial 1 + +dnl FIXME: put these prerequisite-only *.m4 files in a separate +dnl directory -- otherwise, they'll conflict with existing files. + +dnl These are the prerequisite macros for GNU's error.c file. +AC_DEFUN(jm_PREREQ_ERROR, +[ + AC_CHECK_FUNCS(strerror strerror_r vprintf doprnt) + AC_HEADER_STDC +]) diff --git a/m4/gettext.m4 b/m4/gettext.m4 new file mode 100644 index 0000000..e4d524c --- /dev/null +++ b/m4/gettext.m4 @@ -0,0 +1,370 @@ +# Macro to add for using GNU gettext. +# Ulrich Drepper , 1995. +# +# This file can be copied and used freely without restrictions. It can +# be used in projects which are not available under the GNU General Public +# License or the GNU Library General Public License but which still want +# to provide support for the GNU gettext functionality. +# Please note that the actual code of the GNU gettext library is covered +# by the GNU Library General Public License, and the rest of the GNU +# gettext package package is covered by the GNU General Public License. +# They are *not* in the public domain. + +# serial 10 + +dnl Usage: AM_WITH_NLS([TOOLSYMBOL], [NEEDSYMBOL], [LIBDIR]). +dnl If TOOLSYMBOL is specified and is 'use-libtool', then a libtool library +dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static, +dnl depending on --{enable,disable}-{shared,static} and on the presence of +dnl AM-DISABLE-SHARED). Otherwise, a static library +dnl $(top_builddir)/intl/libintl.a will be created. +dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext +dnl implementations (in libc or libintl) without the ngettext() function +dnl will be ignored. +dnl LIBDIR is used to find the intl libraries. If empty, +dnl the value `$(top_builddir)/intl/' is used. +dnl +dnl The result of the configuration is one of three cases: +dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled +dnl and used. +dnl Catalog format: GNU --> install in $(datadir) +dnl Catalog extension: .mo after installation, .gmo in source tree +dnl 2) GNU gettext has been found in the system's C library. +dnl Catalog format: GNU --> install in $(datadir) +dnl Catalog extension: .mo after installation, .gmo in source tree +dnl 3) No internationalization, always use English msgid. +dnl Catalog format: none +dnl Catalog extension: none +dnl The use of .gmo is historical (it was needed to avoid overwriting the +dnl GNU format catalogs when building on a platform with an X/Open gettext), +dnl but we keep it in order not to force irrelevant filename changes on the +dnl maintainers. +dnl +AC_DEFUN([AM_WITH_NLS], + [AC_MSG_CHECKING([whether NLS is requested]) + dnl Default is enabled NLS + AC_ARG_ENABLE(nls, + [ --disable-nls do not use Native Language Support], + USE_NLS=$enableval, USE_NLS=yes) + AC_MSG_RESULT($USE_NLS) + AC_SUBST(USE_NLS) + + BUILD_INCLUDED_LIBINTL=no + USE_INCLUDED_LIBINTL=no + INTLLIBS= + + dnl If we use NLS figure out what method + if test "$USE_NLS" = "yes"; then + AC_DEFINE(ENABLE_NLS, 1, + [Define to 1 if translation of program messages to the user's native language + is requested.]) + AC_MSG_CHECKING([whether included gettext is requested]) + 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) + + nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" + if test "$nls_cv_force_use_gnu_gettext" != "yes"; then + dnl User does not insist on using GNU NLS library. Figure out what + dnl to use. If GNU gettext is available we use this. Else we have + dnl to fall back to GNU NLS library. + CATOBJEXT=NONE + + dnl Add a version number to the cache macros. + define(gt_cv_func_gnugettext_libc, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libc]) + define(gt_cv_func_gnugettext_libintl, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libintl]) + + AC_CHECK_HEADER(libintl.h, + [AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc, + [AC_TRY_LINK([#include +extern int _nl_msg_cat_cntr;], + [bindtextdomain ("", ""); +return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr], + gt_cv_func_gnugettext_libc=yes, + gt_cv_func_gnugettext_libc=no)]) + + if test "$gt_cv_func_gnugettext_libc" != "yes"; then + AC_CACHE_CHECK([for GNU gettext in libintl], + gt_cv_func_gnugettext_libintl, + [gt_save_LIBS="$LIBS" + LIBS="$LIBS -lintl $LIBICONV" + AC_TRY_LINK([#include +extern int _nl_msg_cat_cntr;], + [bindtextdomain ("", ""); +return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr], + gt_cv_func_gnugettext_libintl=yes, + gt_cv_func_gnugettext_libintl=no) + LIBS="$gt_save_LIBS"]) + fi + + dnl If an already present or preinstalled GNU gettext() is found, + dnl use it. But if this macro is used in GNU gettext, and GNU + dnl gettext is already preinstalled in libintl, we update this + dnl libintl. (Cf. the install rule in intl/Makefile.in.) + if test "$gt_cv_func_gnugettext_libc" = "yes" \ + || { test "$gt_cv_func_gnugettext_libintl" = "yes" \ + && test "$PACKAGE" != gettext; }; then + AC_DEFINE(HAVE_GETTEXT, 1, + [Define if the GNU gettext() function is already present or preinstalled.]) + + if test "$gt_cv_func_gnugettext_libintl" = "yes"; then + dnl If iconv() is in a separate libiconv library, then anyone + dnl linking with libintl{.a,.so} also needs to link with + dnl libiconv. + INTLLIBS="-lintl $LIBICONV" + fi + + gt_save_LIBS="$LIBS" + LIBS="$LIBS $INTLLIBS" + AC_CHECK_FUNCS(dcgettext) + LIBS="$gt_save_LIBS" + + dnl Search for GNU msgfmt in the PATH. + AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, + [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :) + AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) + + dnl Search for GNU xgettext in the PATH. + AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, + [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :) + + CATOBJEXT=.gmo + fi + ]) + + if test "$CATOBJEXT" = "NONE"; then + dnl GNU gettext is not found in the C library. + dnl Fall back on GNU gettext library. + nls_cv_use_gnu_gettext=yes + fi + fi + + if test "$nls_cv_use_gnu_gettext" = "yes"; then + dnl Mark actions used to generate GNU NLS library. + INTLOBJS="\$(GETTOBJS)" + AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, + [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :) + AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) + AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, + [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :) + AC_SUBST(MSGFMT) + BUILD_INCLUDED_LIBINTL=yes + USE_INCLUDED_LIBINTL=yes + CATOBJEXT=.gmo + INTLLIBS="ifelse([$3],[],\$(top_builddir)/intl,[$3])/libintl.ifelse([$1], use-libtool, [l], [])a $LIBICONV" + LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` + fi + + dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. + dnl Test whether we really found GNU msgfmt. + if test "$GMSGFMT" != ":"; then + dnl If it is no GNU msgfmt we define it as : so that the + dnl Makefiles still can work. + if $GMSGFMT --statistics /dev/null >/dev/null 2>&1; then + : ; + else + AC_MSG_RESULT( + [found msgfmt program is not GNU msgfmt; ignore it]) + GMSGFMT=":" + fi + fi + + dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. + dnl Test whether we really found GNU xgettext. + if test "$XGETTEXT" != ":"; then + dnl If it is no GNU xgettext we define it as : so that the + dnl Makefiles still can work. + if $XGETTEXT --omit-header /dev/null >/dev/null 2>&1; then + : ; + else + AC_MSG_RESULT( + [found xgettext program is not GNU xgettext; ignore it]) + XGETTEXT=":" + fi + fi + + dnl We need to process the po/ directory. + POSUB=po + fi + AC_OUTPUT_COMMANDS( + [for ac_file in $CONFIG_FILES; do + # Support "outfile[:infile[:infile...]]" + case "$ac_file" in + *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + esac + # PO directories have a Makefile.in generated from Makefile.in.in. + case "$ac_file" in */Makefile.in) + # Adjust a relative srcdir. + ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` + ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" + ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` + # In autoconf-2.13 it is called $ac_given_srcdir. + # In autoconf-2.50 it is called $srcdir. + test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" + case "$ac_given_srcdir" in + .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; + /*) top_srcdir="$ac_given_srcdir" ;; + *) top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then + rm -f "$ac_dir/POTFILES" + test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" + sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," -e "\$s/\(.*\) \\\\/\1/" < "$ac_given_srcdir/$ac_dir/POTFILES.in" > "$ac_dir/POTFILES" + test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" + sed -e "/POTFILES =/r $ac_dir/POTFILES" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" + fi + ;; + esac + done]) + + + dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL + dnl to 'yes' because some of the testsuite requires it. + if test "$PACKAGE" = gettext; then + BUILD_INCLUDED_LIBINTL=yes + fi + + dnl intl/plural.c is generated from intl/plural.y. It requires bison, + dnl because plural.y uses bison specific features. It requires at least + dnl bison-1.26 because earlier versions generate a plural.c that doesn't + dnl compile. + dnl bison is only needed for the maintainer (who touches plural.y). But in + dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put + dnl the rule in general Makefile. Now, some people carelessly touch the + dnl files or have a broken "make" program, hence the plural.c rule will + dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not + dnl present or too old. + AC_CHECK_PROGS([INTLBISON], [bison]) + if test -z "$INTLBISON"; then + ac_verc_fail=yes + else + dnl Found it, now check the version. + AC_MSG_CHECKING([version of bison]) +changequote(<<,>>)dnl + ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'` + case $ac_prog_version in + '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; + 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*) +changequote([,])dnl + ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; + *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; + esac + AC_MSG_RESULT([$ac_prog_version]) + fi + if test $ac_verc_fail = yes; then + INTLBISON=: + 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. + for lang in $ALL_LINGUAS; do + GMOFILES="$GMOFILES $lang.gmo" + POFILES="$POFILES $lang.po" + done + + dnl Make all variables we use known to autoconf. + AC_SUBST(BUILD_INCLUDED_LIBINTL) + AC_SUBST(USE_INCLUDED_LIBINTL) + AC_SUBST(CATALOGS) + AC_SUBST(CATOBJEXT) + AC_SUBST(GMOFILES) + AC_SUBST(INTLLIBS) + AC_SUBST(INTLOBJS) + AC_SUBST(POFILES) + AC_SUBST(POSUB) + + dnl For backward compatibility. Some configure.ins may be using this. + nls_cv_header_intl= + nls_cv_header_libgt= + + dnl For backward compatibility. Some Makefiles may be using this. + DATADIRNAME=share + AC_SUBST(DATADIRNAME) + + dnl For backward compatibility. Some Makefiles may be using this. + INSTOBJEXT=.mo + AC_SUBST(INSTOBJEXT) + + dnl For backward compatibility. Some Makefiles may be using this. + GENCAT=gencat + AC_SUBST(GENCAT) + ]) + +dnl Usage: Just like AM_WITH_NLS, which see. +AC_DEFUN([AM_GNU_GETTEXT], + [AC_REQUIRE([AC_PROG_MAKE_SET])dnl + AC_REQUIRE([AC_PROG_CC])dnl + AC_REQUIRE([AC_CANONICAL_HOST])dnl + AC_REQUIRE([AC_PROG_RANLIB])dnl + AC_REQUIRE([AC_ISC_POSIX])dnl + AC_REQUIRE([AC_HEADER_STDC])dnl + AC_REQUIRE([AC_C_CONST])dnl + AC_REQUIRE([AC_C_INLINE])dnl + AC_REQUIRE([AC_TYPE_OFF_T])dnl + AC_REQUIRE([AC_TYPE_SIZE_T])dnl + AC_REQUIRE([AC_FUNC_ALLOCA])dnl + AC_REQUIRE([AC_FUNC_MMAP])dnl + AC_REQUIRE([jm_GLIBC21])dnl + + AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \ +stdlib.h string.h unistd.h sys/param.h]) + AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getcwd getegid geteuid \ +getgid getuid mempcpy munmap putenv setenv setlocale stpcpy strchr strcasecmp \ +strdup strtoul tsearch __argz_count __argz_stringify __argz_next]) + + AM_ICONV + AM_LANGINFO_CODESET + AM_LC_MESSAGES + AM_WITH_NLS([$1],[$2],[$3]) + + if test "x$CATOBJEXT" != "x"; then + if test "x$ALL_LINGUAS" = "x"; then + LINGUAS= + else + AC_MSG_CHECKING(for catalogs to be installed) + NEW_LINGUAS= + for presentlang in $ALL_LINGUAS; do + useit=no + for desiredlang in ${LINGUAS-$ALL_LINGUAS}; do + # Use the presentlang catalog if desiredlang is + # a. equal to presentlang, or + # b. a variant of presentlang (because in this case, + # presentlang can be used as a fallback for messages + # which are not translated in the desiredlang catalog). + case "$desiredlang" in + "$presentlang"*) useit=yes;; + esac + done + if test $useit = yes; then + NEW_LINGUAS="$NEW_LINGUAS $presentlang" + fi + done + LINGUAS=$NEW_LINGUAS + AC_MSG_RESULT($LINGUAS) + fi + + dnl Construct list of names of catalog files to be constructed. + if test -n "$LINGUAS"; then + for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done + fi + fi + + 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 -n "$ac_aux_dir"; then + MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" + fi + if test -z "$MKINSTALLDIRS"; then + MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" + fi + AC_SUBST(MKINSTALLDIRS) + + dnl Enable libtool support if the surrounding package wishes it. + INTL_LIBTOOL_SUFFIX_PREFIX=ifelse([$1], use-libtool, [l], []) + AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX) + ]) diff --git a/m4/glibc.m4 b/m4/glibc.m4 new file mode 100644 index 0000000..802b233 --- /dev/null +++ b/m4/glibc.m4 @@ -0,0 +1,33 @@ +dnl From Gordon Matzigkeit. +dnl Test for the GNU C Library. +dnl FIXME: this should migrate into libit. + +AC_DEFUN(AM_GLIBC, + [ + AC_CACHE_CHECK(whether we are using the GNU C Library, + ac_cv_gnu_library, + [AC_EGREP_CPP([Thanks for using GNU], + [ +#include +#ifdef __GNU_LIBRARY__ + Thanks for using GNU +#endif + ], + ac_cv_gnu_library=yes, + ac_cv_gnu_library=no) + ] + ) + AC_CACHE_CHECK(for version 2 of the GNU C Library, + ac_cv_glibc, + [AC_EGREP_CPP([Thanks for using GNU too], + [ +#include +#ifdef __GLIBC__ + Thanks for using GNU too +#endif + ], + ac_cv_glibc=yes, ac_cv_glibc=no) + ] + ) + ] +) diff --git a/m4/glibc21.m4 b/m4/glibc21.m4 new file mode 100644 index 0000000..5b88ef2 --- /dev/null +++ b/m4/glibc21.m4 @@ -0,0 +1,26 @@ +#serial 2 + +# Test for the GNU C Library, version 2.1 or newer. +# From Bruno Haible. + +AC_DEFUN([jm_GLIBC21], + [ + AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer, + ac_cv_gnu_library_2_1, + [AC_EGREP_CPP([Lucky GNU user], + [ +#include +#ifdef __GNU_LIBRARY__ + #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) + Lucky GNU user + #endif +#endif + ], + ac_cv_gnu_library_2_1=yes, + ac_cv_gnu_library_2_1=no) + ] + ) + AC_SUBST(GLIBC21) + GLIBC21="$ac_cv_gnu_library_2_1" + ] +) diff --git a/m4/header.m4 b/m4/header.m4 new file mode 100644 index 0000000..f8e065f --- /dev/null +++ b/m4/header.m4 @@ -0,0 +1,66 @@ +# Like AC_CONFIG_HEADER, but automatically create stamp file. + +# serial 3 + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. We must strip everything past the first ":", +# and everything past the last "/". + +AC_PREREQ([2.12]) + +AC_DEFUN([AM_CONFIG_HEADER], +[ifdef([AC_FOREACH],dnl + [dnl init our file count if it isn't already + m4_ifndef([_AM_Config_Header_Index], m4_define([_AM_Config_Header_Index], [0])) + dnl prepare to store our destination file list for use in config.status + AC_FOREACH([_AM_File], [$1], + [m4_pushdef([_AM_Dest], m4_patsubst(_AM_File, [:.*])) + m4_define([_AM_Config_Header_Index], m4_incr(_AM_Config_Header_Index)) + dnl and add it to the list of files AC keeps track of, along + dnl with our hook + AC_CONFIG_HEADERS(_AM_File, +dnl COMMANDS, [, INIT-CMDS] +[# update the timestamp +echo timestamp >"AS_ESCAPE(_AM_DIRNAME(]_AM_Dest[))/stamp-h]_AM_Config_Header_Index[" +][$2]m4_ifval([$3], [, [$3]]))dnl AC_CONFIG_HEADERS + m4_popdef([_AM_Dest])])],dnl +[AC_CONFIG_HEADER([$1]) + AC_OUTPUT_COMMANDS( + ifelse(patsubst([$1], [[^ ]], []), + [], + [test -z "$CONFIG_HEADERS" || echo timestamp >dnl + patsubst([$1], [^\([^:]*/\)?.*], [\1])stamp-h]),dnl +[am_indx=1 +for am_file in $1; do + case " \$CONFIG_HEADERS " in + *" \$am_file "*) + am_dir=\`echo \$am_file |sed 's%:.*%%;s%[^/]*\$%%'\` + if test -n "\$am_dir"; then + am_tmpdir=\`echo \$am_dir |sed 's%^\(/*\).*\$%\1%'\` + for am_subdir in \`echo \$am_dir |sed 's%/% %'\`; do + am_tmpdir=\$am_tmpdir\$am_subdir/ + if test ! -d \$am_tmpdir; then + mkdir \$am_tmpdir + fi + done + fi + echo timestamp > "\$am_dir"stamp-h\$am_indx + ;; + esac + am_indx=\`expr \$am_indx + 1\` +done]) +])]) # AM_CONFIG_HEADER + +# _AM_DIRNAME(PATH) +# ----------------- +# Like AS_DIRNAME, only do it during macro expansion +AC_DEFUN([_AM_DIRNAME], + [m4_if(m4_regexp([$1], [^.*[^/]//*[^/][^/]*/*$]), -1, + m4_if(m4_regexp([$1], [^//\([^/]\|$\)]), -1, + m4_if(m4_regexp([$1], [^/.*]), -1, + [.], + m4_patsubst([$1], [^\(/\).*], [\1])), + m4_patsubst([$1], [^\(//\)\([^/].*\|$\)], [\1])), + m4_patsubst([$1], [^\(.*[^/]\)//*[^/][^/]*/*$], [\1]))[]dnl +]) # _AM_DIRNAME diff --git a/m4/iconv.m4 b/m4/iconv.m4 new file mode 100644 index 0000000..1723734 --- /dev/null +++ b/m4/iconv.m4 @@ -0,0 +1,69 @@ +#serial AM2 + +dnl From Bruno Haible. + +AC_DEFUN([AM_ICONV], +[ + dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and + dnl those with the standalone portable GNU libiconv installed). + + AC_ARG_WITH([libiconv-prefix], +[ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib], [ + for dir in `echo "$withval" | tr : ' '`; do + if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi + if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi + done + ]) + + AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [ + am_cv_func_iconv="no, consider installing GNU libiconv" + am_cv_lib_iconv=no + AC_TRY_LINK([#include +#include ], + [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], + am_cv_func_iconv=yes) + if test "$am_cv_func_iconv" != yes; then + am_save_LIBS="$LIBS" + LIBS="$LIBS -liconv" + AC_TRY_LINK([#include +#include ], + [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], + am_cv_lib_iconv=yes + am_cv_func_iconv=yes) + LIBS="$am_save_LIBS" + fi + ]) + if test "$am_cv_func_iconv" = yes; then + AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) + AC_MSG_CHECKING([for iconv declaration]) + AC_CACHE_VAL(am_cv_proto_iconv, [ + AC_TRY_COMPILE([ +#include +#include +extern +#ifdef __cplusplus +"C" +#endif +#if defined(__STDC__) || defined(__cplusplus) +size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); +#else +size_t iconv(); +#endif +], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const") + am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"]) + am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` + AC_MSG_RESULT([$]{ac_t:- + }[$]am_cv_proto_iconv) + AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1, + [Define as const if the declaration of iconv() needs const.]) + fi + LIBICONV= + if test "$am_cv_lib_iconv" = yes; then + LIBICONV="-liconv" + fi + AC_SUBST(LIBICONV) +]) diff --git a/m4/install.m4 b/m4/install.m4 new file mode 100644 index 0000000..b0c3fea --- /dev/null +++ b/m4/install.m4 @@ -0,0 +1,13 @@ +## --------------------------------------------------------- ## +## Use AC_PROG_INSTALL, supplementing it with INSTALL_SCRIPT ## +## substitution. ## +## From Franc,ois Pinard ## +## --------------------------------------------------------- ## + +# serial 1 + +AC_DEFUN([AM_PROG_INSTALL], +[AC_REQUIRE([AC_PROG_INSTALL]) +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' +AC_SUBST(INSTALL_SCRIPT)dnl +]) diff --git a/m4/inttypes_h.m4 b/m4/inttypes_h.m4 new file mode 100644 index 0000000..750639d --- /dev/null +++ b/m4/inttypes_h.m4 @@ -0,0 +1,22 @@ +#serial 3 + +dnl From Paul Eggert. + +# Define HAVE_INTTYPES_H if exists, +# doesn't clash with , and declares uintmax_t. + +AC_DEFUN(jm_AC_HEADER_INTTYPES_H, +[ + AC_CACHE_CHECK([for inttypes.h], jm_ac_cv_header_inttypes_h, + [AC_TRY_COMPILE( + [#include +#include ], + [uintmax_t i = (uintmax_t) -1;], + jm_ac_cv_header_inttypes_h=yes, + jm_ac_cv_header_inttypes_h=no)]) + if test $jm_ac_cv_header_inttypes_h = yes; then + AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H, 1, +[Define if exists, doesn't clash with , + and declares uintmax_t. ]) + fi +]) diff --git a/m4/isc-posix.m4 b/m4/isc-posix.m4 new file mode 100644 index 0000000..99c899c --- /dev/null +++ b/m4/isc-posix.m4 @@ -0,0 +1,17 @@ +#serial 1 +# This test replaces the one in autoconf. +# Currently this macro should have the same name as the autoconf macro +# because gettext's gettext.m4 (distributed in the automake package) +# still uses it. Otherwise, the use in gettext.m4 makes autoheader +# give these diagnostics: +# configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX +# configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX + +undefine([AC_ISC_POSIX]) + +AC_DEFUN([AC_ISC_POSIX], + [ + dnl This test replaces the obsolescent AC_ISC_POSIX kludge. + AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"]) + ] +) diff --git a/m4/largefile.m4 b/m4/largefile.m4 new file mode 100644 index 0000000..8501908 --- /dev/null +++ b/m4/largefile.m4 @@ -0,0 +1,129 @@ +#serial 6 + +dnl By default, many hosts won't let programs access large files; +dnl one must use special compiler options to get large-file access to work. +dnl For more details about this brain damage please see: +dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html + +dnl Written by Paul Eggert . + +dnl Internal subroutine of AC_SYS_LARGEFILE. +dnl AC_SYS_LARGEFILE_FLAGS(FLAGSNAME) +AC_DEFUN([AC_SYS_LARGEFILE_FLAGS], + [AC_CACHE_CHECK([for $1 value to request large file support], + ac_cv_sys_largefile_$1, + [if ($GETCONF LFS_$1) >conftest.1 2>conftest.2 && test ! -s conftest.2 + then + ac_cv_sys_largefile_$1=`cat conftest.1` + else + ac_cv_sys_largefile_$1=no + ifelse($1, CFLAGS, + [case "$host_os" in + # HP-UX 10.20 requires -D__STDC_EXT__ with gcc 2.95.1. +changequote(, )dnl + hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*) +changequote([, ])dnl + if test "$GCC" = yes; then + ac_cv_sys_largefile_CFLAGS=-D__STDC_EXT__ + fi + ;; + # IRIX 6.2 and later require cc -n32. +changequote(, )dnl + irix6.[2-9]* | irix6.1[0-9]* | irix[7-9].* | irix[1-9][0-9]*) +changequote([, ])dnl + if test "$GCC" != yes; then + ac_cv_sys_largefile_CFLAGS=-n32 + fi + esac + if test "$ac_cv_sys_largefile_CFLAGS" != no; then + ac_save_CC="$CC" + CC="$CC $ac_cv_sys_largefile_CFLAGS" + AC_TRY_LINK(, , , ac_cv_sys_largefile_CFLAGS=no) + CC="$ac_save_CC" + fi]) + fi + rm -f conftest*])]) + +dnl Internal subroutine of AC_SYS_LARGEFILE. +dnl AC_SYS_LARGEFILE_SPACE_APPEND(VAR, VAL) +AC_DEFUN([AC_SYS_LARGEFILE_SPACE_APPEND], + [case $2 in + no) ;; + ?*) + case "[$]$1" in + '') $1=$2 ;; + *) $1=[$]$1' '$2 ;; + esac ;; + esac]) + +dnl Internal subroutine of AC_SYS_LARGEFILE. +dnl AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, CACHE-VAR, COMMENT, CODE-TO-SET-DEFAULT) +AC_DEFUN([AC_SYS_LARGEFILE_MACRO_VALUE], + [AC_CACHE_CHECK([for $1], $2, + [$2=no +changequote(, )dnl + $4 + for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do + case "$ac_flag" in + -D$1) + $2=1 ;; + -D$1=*) + $2=`expr " $ac_flag" : '[^=]*=\(.*\)'` ;; + esac + done +changequote([, ])dnl + ]) + if test "[$]$2" != no; then + AC_DEFINE_UNQUOTED([$1], [$]$2, [$3]) + fi]) + +AC_DEFUN([AC_SYS_LARGEFILE], + [AC_REQUIRE([AC_CANONICAL_HOST]) + AC_ARG_ENABLE(largefile, + [ --disable-largefile omit support for large files]) + if test "$enable_largefile" != no; then + AC_CHECK_TOOL(GETCONF, getconf) + AC_SYS_LARGEFILE_FLAGS(CFLAGS) + AC_SYS_LARGEFILE_FLAGS(LDFLAGS) + AC_SYS_LARGEFILE_FLAGS(LIBS) + + for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do + case "$ac_flag" in + no) ;; + -D_FILE_OFFSET_BITS=*) ;; + -D_LARGEFILE_SOURCE | -D_LARGEFILE_SOURCE=*) ;; + -D_LARGE_FILES | -D_LARGE_FILES=*) ;; + -D?* | -I?*) + AC_SYS_LARGEFILE_SPACE_APPEND(CPPFLAGS, "$ac_flag") ;; + *) + AC_SYS_LARGEFILE_SPACE_APPEND(CFLAGS, "$ac_flag") ;; + esac + done + AC_SYS_LARGEFILE_SPACE_APPEND(LDFLAGS, "$ac_cv_sys_largefile_LDFLAGS") + AC_SYS_LARGEFILE_SPACE_APPEND(LIBS, "$ac_cv_sys_largefile_LIBS") + AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, + ac_cv_sys_file_offset_bits, + [Number of bits in a file offset, on hosts where this is settable.], + [case "$host_os" in + # HP-UX 10.20 and later + hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*) + ac_cv_sys_file_offset_bits=64 ;; + esac]) + AC_SYS_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE, + ac_cv_sys_largefile_source, + [Define to make fseeko etc. visible, on some hosts.], + [case "$host_os" in + # HP-UX 10.20 and later + hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*) + ac_cv_sys_largefile_source=1 ;; + esac]) + AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, + ac_cv_sys_large_files, + [Define for large files, on AIX-style hosts.], + [case "$host_os" in + # AIX 4.2 and later + aix4.[2-9]* | aix4.1[0-9]* | aix[5-9].* | aix[1-9][0-9]*) + ac_cv_sys_large_files=1 ;; + esac]) + fi + ]) diff --git a/m4/lcmessage.m4 b/m4/lcmessage.m4 new file mode 100644 index 0000000..18d47a9 --- /dev/null +++ b/m4/lcmessage.m4 @@ -0,0 +1,24 @@ +# Check whether LC_MESSAGES is available in . +# Ulrich Drepper , 1995. +# +# This file can be copied and used freely without restrictions. It can +# be used in projects which are not available under the GNU General Public +# License or the GNU Library General Public License but which still want +# to provide support for the GNU gettext functionality. +# Please note that the actual code of the GNU gettext library is covered +# by the GNU Library General Public License, and the rest of the GNU +# gettext package package is covered by the GNU General Public License. +# They are *not* in the public domain. + +# serial 2 + +AC_DEFUN([AM_LC_MESSAGES], + [if test $ac_cv_header_locale_h = yes; then + AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, + [AC_TRY_LINK([#include ], [return LC_MESSAGES], + am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)]) + if test $am_cv_val_LC_MESSAGES = yes; then + AC_DEFINE(HAVE_LC_MESSAGES, 1, + [Define if your file defines LC_MESSAGES.]) + fi + fi]) diff --git a/m4/malloc.m4 b/m4/malloc.m4 new file mode 100644 index 0000000..2f00142 --- /dev/null +++ b/m4/malloc.m4 @@ -0,0 +1,34 @@ +#serial 3 + +dnl From Jim Meyering. +dnl Determine whether malloc accepts 0 as its argument. +dnl If it doesn't, arrange to use the replacement function. +dnl + +AC_DEFUN(jm_FUNC_MALLOC, +[ + dnl xmalloc.c requires that this symbol be defined so it doesn't + dnl mistakenly use a broken malloc -- as it might if this test were omitted. + AC_DEFINE_UNQUOTED(HAVE_DONE_WORKING_MALLOC_CHECK, 1, + [Define if the malloc check has been performed. ]) + + AC_CACHE_CHECK([for working malloc], jm_cv_func_working_malloc, + [AC_TRY_RUN([ + char *malloc (); + int + main () + { + exit (malloc (0) ? 0 : 1); + } + ], + jm_cv_func_working_malloc=yes, + jm_cv_func_working_malloc=no, + dnl When crosscompiling, assume malloc is broken. + jm_cv_func_working_malloc=no) + ]) + if test $jm_cv_func_working_malloc = no; then + AC_LIBOBJ(malloc) + AC_DEFINE_UNQUOTED(malloc, rpl_malloc, + [Define to rpl_malloc if the replacement function should be used.]) + fi +]) diff --git a/m4/mbstate_t.m4 b/m4/mbstate_t.m4 new file mode 100644 index 0000000..a185a7d --- /dev/null +++ b/m4/mbstate_t.m4 @@ -0,0 +1,29 @@ +# serial 8 + +# From Paul Eggert. + +# BeOS 5 has but does not define mbstate_t, +# so you can't declare an object of that type. +# Check for this incompatibility with Standard C. + +# Include stdlib.h first, because otherwise this test would fail on Linux +# (at least glibc-2.1.3) because the "_XOPEN_SOURCE 500" definition elicits +# a syntax error in wchar.h due to the use of undefined __int32_t. + +AC_DEFUN(AC_MBSTATE_T, + [ + AC_CHECK_HEADERS(stdlib.h) + + AC_CACHE_CHECK([for mbstate_t], ac_cv_type_mbstate_t, + [AC_TRY_COMPILE([ +#if HAVE_STDLIB_H +# include +#endif +#include ], + [mbstate_t x; return sizeof x;], + ac_cv_type_mbstate_t=yes, + ac_cv_type_mbstate_t=no)]) + if test $ac_cv_type_mbstate_t = no; then + AC_DEFINE(mbstate_t, int, + [Define to a type if does not define.]) + fi]) diff --git a/m4/missing.m4 b/m4/missing.m4 new file mode 100644 index 0000000..868aa6b --- /dev/null +++ b/m4/missing.m4 @@ -0,0 +1,30 @@ +## --------------------------------------------------------- ## +## Fake the existence of programs that GNU maintainers use. ## +## --------------------------------------------------------- ## + +# serial 2 + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it supports --run. +# If it does, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + am_backtick='`' + AC_MSG_WARN([${am_backtick}missing' script is too old or missing]) +fi +]) diff --git a/m4/progtest.m4 b/m4/progtest.m4 new file mode 100644 index 0000000..35dc3da --- /dev/null +++ b/m4/progtest.m4 @@ -0,0 +1,51 @@ +# Search path for a program which passes the given test. +# Ulrich Drepper , 1996. +# +# This file can be copied and used freely without restrictions. It can +# be used in projects which are not available under the GNU General Public +# License or the GNU Library General Public License but which still want +# to provide support for the GNU gettext functionality. +# Please note that the actual code of the GNU gettext library is covered +# by the GNU Library General Public License, and the rest of the GNU +# gettext package package is covered by the GNU General Public License. +# They are *not* in the public domain. + +# serial 2 + +dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, +dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) +AC_DEFUN([AM_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 ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then + AC_MSG_RESULT([$]$1) +else + AC_MSG_RESULT(no) +fi +AC_SUBST($1)dnl +]) diff --git a/m4/realloc.m4 b/m4/realloc.m4 new file mode 100644 index 0000000..ff25046 --- /dev/null +++ b/m4/realloc.m4 @@ -0,0 +1,34 @@ +#serial 3 + +dnl From Jim Meyering. +dnl Determine whether realloc works when both arguments are 0. +dnl If it doesn't, arrange to use the replacement function. +dnl + +AC_DEFUN(jm_FUNC_REALLOC, +[ + dnl xmalloc.c requires that this symbol be defined so it doesn't + dnl mistakenly use a broken realloc -- as it might if this test were omitted. + AC_DEFINE_UNQUOTED(HAVE_DONE_WORKING_REALLOC_CHECK, 1, + [Define if the realloc check has been performed. ]) + + AC_CACHE_CHECK([for working realloc], jm_cv_func_working_realloc, + [AC_TRY_RUN([ + char *realloc (); + int + main () + { + exit (realloc (0, 0) ? 0 : 1); + } + ], + jm_cv_func_working_realloc=yes, + jm_cv_func_working_realloc=no, + dnl When crosscompiling, assume realloc is broken. + jm_cv_func_working_realloc=no) + ]) + if test $jm_cv_func_working_realloc = no; then + AC_LIBOBJ(realloc) + AC_DEFINE_UNQUOTED(realloc, rpl_realloc, + [Define to rpl_realloc if the replacement function should be used.]) + fi +]) diff --git a/m4/regex.m4 b/m4/regex.m4 new file mode 100644 index 0000000..56df318 --- /dev/null +++ b/m4/regex.m4 @@ -0,0 +1,74 @@ +#serial 5001 + +dnl Initially derived from code in GNU grep. +dnl Mostly written by Jim Meyering. + +dnl Usage: jm_INCLUDED_REGEX([lib/regex.c]) +dnl +AC_DEFUN(jm_INCLUDED_REGEX, + [ + dnl Even packages that don't use regex.c can use this macro. + dnl Of course, for them it doesn't do anything. + + # Assume we'll default to using the included regex.c. + ac_use_included_regex=yes + + # However, if the system regex support is good enough that it passes the + # the following run test, then default to *not* using the included regex.c. + # If cross compiling, assume the test would fail and use the included + # regex.c. The first failing regular expression is from `Spencer ere + # test #75' in grep-2.3. + AC_CACHE_CHECK([for working re_compile_pattern], + jm_cv_func_working_re_compile_pattern, + AC_TRY_RUN( + changequote(<<, >>)dnl + << +#include +#include + int + main () + { + static struct re_pattern_buffer regex; + const char *s; + re_set_syntax (RE_SYNTAX_POSIX_EGREP); + /* Add this third left square bracket, [, to balance the + three right ones below. Otherwise autoconf-2.14 chokes. */ + s = re_compile_pattern ("a[[:]:]]b\n", 9, ®ex); + /* This should fail with _Invalid character class name_ error. */ + if (!s) + exit (1); + + /* This should succeed, but doesn't for e.g. glibc-2.1.3. */ + s = re_compile_pattern ("{1", 2, ®ex); + + exit (s ? 1 : 0); + } + >>, + changequote([, ])dnl + + jm_cv_func_working_re_compile_pattern=yes, + jm_cv_func_working_re_compile_pattern=no, + dnl When crosscompiling, assume it's broken. + jm_cv_func_working_re_compile_pattern=no)) + if test $jm_cv_func_working_re_compile_pattern = yes; then + ac_use_included_regex=no + fi + + test -n "$1" || AC_MSG_ERROR([missing argument]) + syscmd([test -f $1]) + ifelse(sysval, 0, + [ + + AC_ARG_WITH(included-regex, + [ --without-included-regex don't compile regex; this is the default on + systems with version 2 of the GNU C library + (use with caution on other system)], + jm_with_regex=$withval, + jm_with_regex=$ac_use_included_regex) + if test "$jm_with_regex" = yes; then + AC_LIBOBJ(regex) + fi + ], + ) + ] +) diff --git a/m4/sanity.m4 b/m4/sanity.m4 new file mode 100644 index 0000000..4259aec --- /dev/null +++ b/m4/sanity.m4 @@ -0,0 +1,46 @@ +# +# Check to make sure that the build environment is sane. +# + +# serial 3 + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftest.file +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "$[2]" = conftest.file + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +AC_MSG_RESULT(yes)]) diff --git a/m4/uintmax_t.m4 b/m4/uintmax_t.m4 new file mode 100644 index 0000000..222beff --- /dev/null +++ b/m4/uintmax_t.m4 @@ -0,0 +1,22 @@ +#serial 5 + +dnl From Paul Eggert. + +AC_PREREQ(2.13) + +# Define uintmax_t to `unsigned long' or `unsigned long long' +# if does not exist. + +AC_DEFUN(jm_AC_TYPE_UINTMAX_T, +[ + AC_REQUIRE([jm_AC_HEADER_INTTYPES_H]) + if test $jm_ac_cv_header_inttypes_h = no; then + AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG]) + test $ac_cv_type_unsigned_long_long = yes \ + && ac_type='unsigned long long' \ + || ac_type='unsigned long' + AC_DEFINE_UNQUOTED(uintmax_t, $ac_type, +[ Define to unsigned long or unsigned long long + if doesn't define.]) + fi +]) diff --git a/m4/ulonglong.m4 b/m4/ulonglong.m4 new file mode 100644 index 0000000..e2fbb55 --- /dev/null +++ b/m4/ulonglong.m4 @@ -0,0 +1,17 @@ +#serial 2 + +dnl From Paul Eggert. + +AC_DEFUN(jm_AC_TYPE_UNSIGNED_LONG_LONG, +[ + AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long, + [AC_TRY_LINK([unsigned long long ull = 1; int i = 63;], + [unsigned long long ullmax = (unsigned long long) -1; + return ull << i | ull >> i | ullmax / ull | ullmax % ull;], + ac_cv_type_unsigned_long_long=yes, + ac_cv_type_unsigned_long_long=no)]) + if test $ac_cv_type_unsigned_long_long = yes; then + AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1, + [Define if you have the unsigned long long type.]) + fi +]) diff --git a/m4/xstrtoumax.m4 b/m4/xstrtoumax.m4 new file mode 100644 index 0000000..f6e3199 --- /dev/null +++ b/m4/xstrtoumax.m4 @@ -0,0 +1,34 @@ +#serial 2 + +# autoconf tests required for use of xstrtoumax.c + +AC_DEFUN(jm_AC_PREREQ_XSTRTOUMAX, +[ + AC_REQUIRE([jm_AC_HEADER_INTTYPES_H]) + AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG]) + AC_CHECK_HEADERS(stdlib.h) + + AC_CACHE_CHECK([whether defines strtoumax as a macro], + jm_cv_func_strtoumax_macro, + AC_EGREP_CPP([inttypes_h_defines_strtoumax], [#include +#ifdef strtoumax + inttypes_h_defines_strtoumax +#endif], + jm_cv_func_strtoumax_macro=yes, + jm_cv_func_strtoumax_macro=no)) + + if test "$jm_cv_func_strtoumax_macro" != yes; then + AC_REPLACE_FUNCS(strtoumax) + fi + + dnl We don't need (and can't compile) the replacement strtoull + dnl unless the type `unsigned long long' exists. + dnl Also, only the replacement strtoumax invokes strtoull, + dnl so we need the replacement strtoull only if strtoumax does not exist. + case "$ac_cv_type_unsigned_long_long,$jm_cv_func_strtoumax_macro,$ac_cv_func_strtoumax" in + yes,no,no) + AC_REPLACE_FUNCS(strtoull) + ;; + esac + +]) diff --git a/po/.cvsignore b/po/.cvsignore new file mode 100644 index 0000000..5ba9b83 --- /dev/null +++ b/po/.cvsignore @@ -0,0 +1,6 @@ +*.gmo +Makefile.in +Makefile +POTFILES +grep.pot +stamp-cat-id diff --git a/po/ChangeLog b/po/ChangeLog new file mode 100644 index 0000000..0873b63 --- /dev/null +++ b/po/ChangeLog @@ -0,0 +1,7 @@ +1999-02-10 Alain Magloire + + * update from ftp.iro.umontreal. + +--------- + * got a basic set of *.po from Franc,ois Pinard + ftp.iro.umontreal.ca diff --git a/po/Makefile.in.in b/po/Makefile.in.in new file mode 100644 index 0000000..f53d47c --- /dev/null +++ b/po/Makefile.in.in @@ -0,0 +1,238 @@ +# Makefile for program source directory in GNU NLS utilities package. +# Copyright (C) 1995, 1996, 1997 by Ulrich Drepper +# +# This file file be copied and used freely without restrictions. It can +# be used in projects which are not available under the GNU Public License +# but which still want to provide support for the GNU gettext functionality. +# Please note that the actual code is *not* freely available. + +PACKAGE = @PACKAGE@ +VERSION = @VERSION@ + +SHELL = /bin/sh +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ + +prefix = @prefix@ +exec_prefix = @exec_prefix@ +datadir = $(prefix)/@DATADIRNAME@ +localedir = $(datadir)/locale +gnulocaledir = $(prefix)/share/locale +gettextsrcdir = $(prefix)/share/gettext/po +subdir = po + +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +MKINSTALLDIRS = $(top_srcdir)/@MKINSTALLDIRS@ + +CC = @CC@ +GENCAT = @GENCAT@ +GMSGFMT = PATH=../src:$$PATH @GMSGFMT@ +MSGFMT = @MSGFMT@ +XGETTEXT = PATH=../src:$$PATH @XGETTEXT@ +MSGMERGE = PATH=../src:$$PATH msgmerge +MKDIR_P = @MKDIR_P@ +mkdir_p = @mkdir_p@ + +DEFS = @DEFS@ +CFLAGS = @CFLAGS@ +CPPFLAGS = @CPPFLAGS@ + +INCLUDES = -I.. -I$(top_srcdir)/intl + +COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS) + +SOURCES = cat-id-tbl.c +POFILES = @POFILES@ +GMOFILES = @GMOFILES@ +DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(PACKAGE).pot \ +stamp-cat-id $(POFILES) $(GMOFILES) $(SOURCES) + +POTFILES = \ + +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +INSTOBJEXT = @INSTOBJEXT@ + +.SUFFIXES: +.SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat + +.c.o: + $(COMPILE) $< + +.po.pox: + $(MAKE) $(PACKAGE).pot + $(MSGMERGE) $< $(srcdir)/$(PACKAGE).pot -o $*.pox + +.po.mo: + $(MSGFMT) -o $@ $< + +.po.gmo: + file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \ + && rm -f $$file && $(GMSGFMT) -o $$file $< + +.po.cat: + sed -f ../intl/po2msg.sed < $< > $*.msg \ + && rm -f $@ && $(GENCAT) $@ $*.msg + + +all: all-@USE_NLS@ + +all-yes: cat-id-tbl.c $(CATALOGS) +all-no: + +$(srcdir)/$(PACKAGE).pot: $(POTFILES) + $(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \ + --add-comments --keyword=_ --keyword=N_ \ + --files-from=$(srcdir)/POTFILES.in \ + && test ! -f $(PACKAGE).po \ + || ( rm -f $(srcdir)/$(PACKAGE).pot \ + && mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot ) + +$(srcdir)/cat-id-tbl.c: stamp-cat-id; @: +$(srcdir)/stamp-cat-id: $(PACKAGE).pot + rm -f cat-id-tbl.tmp + sed -f ../intl/po2tbl.sed $(srcdir)/$(PACKAGE).pot \ + | 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 $(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: install-data-@USE_NLS@ +install-data-no: all +install-data-yes: all + $(mkdir_p) $(DESTDIR)/$(datadir) + @catalogs='$(CATALOGS)'; \ + for cat in $$catalogs; do \ + cat=`basename $$cat`; \ + case "$$cat" in \ + *.gmo) destdir=$(gnulocaledir);; \ + *) destdir=$(localedir);; \ + esac; \ + lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ + dir=$$destdir/$$lang/LC_MESSAGES; \ + $(mkdir_p) $(DESTDIR)/$$dir; \ + if test -r $$cat; then \ + $(INSTALL_DATA) $$cat $(DESTDIR)/$$dir/$(PACKAGE)$(INSTOBJEXT); \ + echo "installing $$cat as $(DESTDIR)/$$dir/$(PACKAGE)$(INSTOBJEXT)"; \ + else \ + $(INSTALL_DATA) $(srcdir)/$$cat $(DESTDIR)/$$dir/$(PACKAGE)$(INSTOBJEXT); \ + echo "installing $(srcdir)/$$cat as" \ + "$$dir/$(PACKAGE)$(INSTOBJEXT)"; \ + fi; \ + if test -r $$cat.m; then \ + $(INSTALL_DATA) $$cat.m $(DESTDIR)/$$dir/$(PACKAGE)$(INSTOBJEXT).m; \ + echo "installing $$cat.m as $(DESTDIR)/$$dir/$(PACKAGE)$(INSTOBJEXT).m"; \ + else \ + if test -r $(srcdir)/$$cat.m ; then \ + $(INSTALL_DATA) $(srcdir)/$$cat.m \ + $(DESTDIR)/$$dir/$(PACKAGE)$(INSTOBJEXT).m; \ + echo "installing $(srcdir)/$$cat as" \ + "$(DESTDIR)/$$dir/$(PACKAGE)$(INSTOBJEXT).m"; \ + else \ + true; \ + fi; \ + fi; \ + done + if test "$(PACKAGE)" = "gettext"; then \ + $(mkdir_p) $(DESTDIR)/$(gettextsrcdir); \ + $(INSTALL_DATA) $(srcdir)/Makefile.in.in \ + $(DESTDIR)/$(gettextsrcdir)/Makefile.in.in; \ + else \ + : ; \ + fi + +# Define this as empty until I found a useful application. +installcheck: + +uninstall: + catalogs='$(CATALOGS)'; \ + for cat in $$catalogs; do \ + cat=`basename $$cat`; \ + lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ + rm -f $(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \ + rm -f $(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \ + rm -f $(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \ + rm -f $(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \ + done + rm -f $(gettextsrcdir)/po-Makefile.in.in + +check: all + +cat-id-tbl.o: ../intl/libgettext.h + +dvi info tags TAGS ID: + +mostlyclean: + rm -f core core.* *.pox $(PACKAGE).po *.old.po cat-id-tbl.tmp + rm -fr *.o + +clean: mostlyclean + +distclean: clean + rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m + +maintainer-clean: distclean + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + rm -f $(GMOFILES) + +distdir = ../$(PACKAGE)-$(VERSION)/$(subdir) +dist distdir: update-po $(DISTFILES) + dists="$(DISTFILES)"; \ + for file in $$dists; do \ + ln $(srcdir)/$$file $(distdir) 2> /dev/null \ + || cp -p $(srcdir)/$$file $(distdir); \ + done + +update-po: Makefile + $(MAKE) $(PACKAGE).pot + PATH=`pwd`/../src:$$PATH; \ + cd $(srcdir); \ + catalogs='$(CATALOGS)'; \ + for cat in $$catalogs; do \ + cat=`basename $$cat`; \ + lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ + mv $$lang.po $$lang.old.po; \ + echo "$$lang:"; \ + if $(MSGMERGE) $$lang.old.po $(PACKAGE).pot -o $$lang.po; then \ + rm -f $$lang.old.po; \ + else \ + echo "msgmerge for $$cat failed!"; \ + rm -f $$lang.po; \ + mv $$lang.old.po $$lang.po; \ + fi; \ + done + +POTFILES: POTFILES.in + ( if test 'x$(srcdir)' != 'x.'; then \ + posrcprefix='$(top_srcdir)/'; \ + else \ + posrcprefix="../"; \ + fi; \ + rm -f $@-t $@ \ + && (sed -e '/^#/d' -e '/^[ ]*$$/d' \ + -e "s@.*@ $$posrcprefix& \\\\@" < $(srcdir)/$@.in \ + | sed -e '$$s/\\$$//') > $@-t \ + && chmod a-w $@-t \ + && mv $@-t $@ ) + +Makefile: Makefile.in.in ../config.status POTFILES + cd .. \ + && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \ + $(SHELL) ./config.status + +# Tell versions [3.59,3.63) of GNU make not to export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/po/POTFILES.in b/po/POTFILES.in new file mode 100644 index 0000000..8e3bf2c --- /dev/null +++ b/po/POTFILES.in @@ -0,0 +1,13 @@ +# List of files which containing translatable strings. + +src/dfa.c +src/kwset.c +src/grep.c +src/search.c + +# Library files +lib/error.c +lib/getopt.c +lib/getopt1.c +lib/obstack.c +lib/quotearg.c diff --git a/po/af.po b/po/af.po new file mode 100644 index 0000000..29a9206 --- /dev/null +++ b/po/af.po @@ -0,0 +1,419 @@ +# grep +# Copyright (C) 2004 Free Software Foundation, Inc. +# Petri Jooste , 2004. +# +msgid "" +msgstr "" +"Project-Id-Version: grep 2.5g\n" +"POT-Creation-Date: 2002-03-26 16:38+0100\n" +"PO-Revision-Date: 2004-03-03 13:33+0200\n" +"Last-Translator: Petri Jooste \n" +"Language-Team: Afrikaans \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=iso-8859-1\n" +"Content-Transfer-Encoding: 8bit\n" + +#: src/dfa.c:136 src/dfa.c:147 src/dfa.c:158 src/search.c:689 +msgid "Memory exhausted" +msgstr "Geheue uitgeput" + +#: src/dfa.c:489 src/dfa.c:492 src/dfa.c:510 src/dfa.c:521 src/dfa.c:545 +#: src/dfa.c:604 src/dfa.c:609 src/dfa.c:622 src/dfa.c:623 src/dfa.c:1001 +#: src/dfa.c:1004 src/dfa.c:1028 src/dfa.c:1032 src/dfa.c:1033 src/dfa.c:1036 +#: src/dfa.c:1048 src/dfa.c:1049 +msgid "Unbalanced [" +msgstr "Ongebalanseerde [" + +#: src/dfa.c:741 +msgid "Unfinished \\ escape" +msgstr "Onbeëindigde \\-ontsnapstring" + +# Cases: +# {M} - exact count +# {M,} - minimum count, maximum is infinity +# {M,N} - M through N +#. Cases: +#. {M} - exact count +#. {M,} - minimum count, maximum is infinity +#. {M,N} - M through N +#: src/dfa.c:874 src/dfa.c:880 src/dfa.c:890 src/dfa.c:898 src/dfa.c:913 +msgid "unfinished repeat count" +msgstr "onbeëindigde herhaaltelling" + +#: src/dfa.c:887 src/dfa.c:904 src/dfa.c:912 src/dfa.c:916 +msgid "malformed repeat count" +msgstr "wangevormde herhaaltelling" + +#: src/dfa.c:1253 +msgid "Unbalanced (" +msgstr "Ongebalanseerde (" + +#: src/dfa.c:1378 +msgid "No syntax specified" +msgstr "Geen sintaks gespesifiseer" + +#: src/dfa.c:1386 +msgid "Unbalanced )" +msgstr "Ongebalanseerde )" + +#: src/dfa.c:2956 +msgid "out of memory" +msgstr "te min geheue" + +#: src/kwset.c:171 src/kwset.c:177 src/search.c:103 src/search.c:209 +#: src/search.c:293 lib/obstack.c:471 +msgid "memory exhausted" +msgstr "geheue uitgeput" + +#: src/grep.c:205 +msgid "invalid context length argument" +msgstr "ongeldige konteks-lengte-parameter" + +#: src/grep.c:479 +msgid "input is too large to count" +msgstr "toevoer is te veel om te tel" + +#: src/grep.c:605 +msgid "writing output" +msgstr "afvoer word geskryf" + +#: src/grep.c:878 +#, c-format +msgid "Binary file %s matches\n" +msgstr "Binêre lêer %s pas\n" + +#: src/grep.c:892 +msgid "(standard input)" +msgstr "(standaardtoevoer)" + +#: src/grep.c:997 +#, c-format +msgid "warning: %s: %s\n" +msgstr "waarskuwing: %s: %s\n" + +#: src/grep.c:998 +msgid "recursive directory loop" +msgstr "rekursiewe lus van gidsinskrywings" + +#: src/grep.c:1046 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE]...\n" +msgstr "Gebruik so: %s [OPSIE]... PATROON [LÊER]...\n" + +#: src/grep.c:1048 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "Probeer `%s --help' vir meer inligting.\n" + +#: src/grep.c:1053 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE] ...\n" +msgstr "Gebruik so: %s [OPSIE]... PATROON [LÊER] ...\n" + +#: src/grep.c:1054 +#, c-format +msgid "" +"Search for PATTERN in each FILE or standard input.\n" +"Example: %s -i 'hello world' menu.h main.c\n" +"\n" +"Regexp selection and interpretation:\n" +msgstr "" +"Soek vir PATROON in elke LÊER of in standaardtoevoer.\n" +"Voorbeeld: %s -i 'hello world' menu.h main.c\n" +"\n" +"Reëlmatige uitdrukking-seleksie en -interpretasie:\n" + +#: src/grep.c:1059 +msgid "" +" -E, --extended-regexp PATTERN is an extended regular expression\n" +" -F, --fixed-strings PATTERN is a set of newline-separated strings\n" +" -G, --basic-regexp PATTERN is a basic regular expression\n" +" -P, --perl-regexp PATTERN is a Perl regular expression\n" +msgstr "" +" -E, --extended-regexp PATROON is 'n uitgebreide reëlmatige uitdrukking\n" +" -F, --fixed-strings PATROON is 'n reeks stringe geskei met nuwereëlkarakters\n" +" -G, --basic-regexp PATROON is 'n basic regular expression\n" +" -P, --perl-regexp PATROON is 'n Perl regular expression\n" + +#: src/grep.c:1064 +msgid "" +" -e, --regexp=PATTERN use PATTERN as a regular expression\n" +" -f, --file=FILE obtain PATTERN from FILE\n" +" -i, --ignore-case ignore case distinctions\n" +" -w, --word-regexp force PATTERN to match only whole words\n" +" -x, --line-regexp force PATTERN to match only whole lines\n" +" -z, --null-data a data line ends in 0 byte, not newline\n" +msgstr "" +" -e, --regexp=PATROON gebruik PATROON as 'n reëlmatige uitdrukking\n" +" -f, --file=FILE verkry PATROON vanaf LÊER\n" +" -i, --ignore-case ignoreer kasverskille\n" +" -w, --word-regexp dwing PATROON om slegs op hele woorde te pas\n" +" -x, --line-regexp dwing PATROON om slegs op hele reëls te pas\n" +" -z, --null-data elke datareël eindig met 'n 0-greep, nie 'n nuwereëlkarakter nie\n" + +#: src/grep.c:1071 +msgid "" +"\n" +"Miscellaneous:\n" +" -s, --no-messages suppress error messages\n" +" -v, --invert-match select non-matching lines\n" +" -V, --version print version information and exit\n" +" --help display this help and exit\n" +" --mmap use memory-mapped input if possible\n" +msgstr "" +"\n" +"Verskeie:\n" +" -s, --no-messages onderdruk foutboodskappe\n" +" -v, --invert-match soek nie-passende reëls\n" +" -V, --version wys weergaweinligting en stop\n" +" --help wys hierdie hulpboodskap en stop\n" +" --mmap gebruik geheue-gebonde toevoer indien moontlik\n" + +#: src/grep.c:1079 +msgid "" +"\n" +"Output control:\n" +" -m, --max-count=NUM stop after NUM matches\n" +" -b, --byte-offset print the byte offset with output lines\n" +" -n, --line-number print line number with output lines\n" +" --line-buffered flush output on every line\n" +" -H, --with-filename print the filename for each match\n" +" -h, --no-filename suppress the prefixing filename on output\n" +" --label=LABEL print LABEL as filename for standard input\n" +" -o, --only-matching show only the part of a line matching PATTERN\n" +" -q, --quiet, --silent suppress all normal output\n" +" --binary-files=TYPE assume that binary files are TYPE\n" +" TYPE is 'binary', 'text', or 'without-match'\n" +" -a, --text equivalent to --binary-files=text\n" +" -I equivalent to --binary-files=without-match\n" +" -d, --directories=ACTION how to handle directories\n" +" ACTION is 'read', 'recurse', or 'skip'\n" +" -D, --devices=ACTION how to handle devices, FIFOs and sockets\n" +" ACTION is 'read' or 'skip'\n" +" -R, -r, --recursive equivalent to --directories=recurse\n" +" --include=PATTERN files that match PATTERN will be examined\n" +" --exclude=PATTERN files that match PATTERN will be skipped.\n" +" --exclude-from=FILE files that match PATTERN in FILE will be skipped.\n" +" -L, --files-without-match only print FILE names containing no match\n" +" -l, --files-with-matches only print FILE names containing matches\n" +" -c, --count only print a count of matching lines per FILE\n" +" -Z, --null print 0 byte after FILE name\n" +msgstr "" +"\n" +"Afvoerbeheer:\n" +" -m, --max-count=AANTAL stop na AANTAL passings\n" +" -b, --byte-offset wys die greep-uitwyking saam met elke afvoerreël\n" +" -n, --line-number wys die reëlnommer saam met elke afvoerreël\n" +" --line-buffered maak elke keer die lynbuffer leeg\n" +" -H, --with-filename wys die lêernaam vir elke passing\n" +" -h, --no-filename onderdruk die vooraf-lêernaam in die afvoer\n" +" --label=ETIKET wys ETIKET as lêernaam vir standaardtoevoer\n" +" -o, --only-matching wys slegs die deel van 'n reël wat pas op die PATROON\n" +" -q, --quiet, --silent onderdruk alle normale afvoer\n" +" --binary-files=TIPE aanvaar dat binêre lêers van hierdie TIPE is.\n" +" TIPE kan wees: 'binary', 'text', of 'without-match'\n" +" -a, --text dieselfde as --binary-files=text\n" +" -I dieselfde as --binary-files=without-match\n" +" -d, --directories=AKSIE hoe om gidse te hanteer\n" +" AKSIE kan wees: 'read', 'recurse', of 'skip'\n" +" -D, --devices=AKSIE hoe om toestelle te hanteer, FIFOs en sokke\n" +" AKSIE kan wees: 'read' of 'skip'\n" +" -R, -r, --recursive dieselfde as --directories=recurse\n" +" --include=PATROON lêers waarop PATROON pas sal ondersoek word.\n" +" --exclude=PATROON lêers waarop PATROON pas sal sal oorgeslaan word.\n" +" --exclude-from=FILE lêers waarop PATROON in LÊER pas sal oorgeslaan word.\n" +" -L, --files-without-match wys slegs lêername wat geen passing bevat nie\n" +" -l, --files-with-matches wys slegs lêername wat wel passing(s) bevat\n" +" -c, --count wys slegs die aantal reëls in elke LÊER wat passings bevat\n" +" -Z, --null wys die 0-greep na die LÊERnaam\n" + +#: src/grep.c:1107 +msgid "" +"\n" +"Context control:\n" +" -B, --before-context=NUM print NUM lines of leading context\n" +" -A, --after-context=NUM print NUM lines of trailing context\n" +" -C, --context=NUM print NUM lines of output context\n" +" -NUM same as --context=NUM\n" +" --color[=WHEN],\n" +" --colour[=WHEN] use markers to distinguish the matching string\n" +" WHEN may be `always', `never' or `auto'.\n" +" -U, --binary do not strip CR characters at EOL (MSDOS)\n" +" -u, --unix-byte-offsets report offsets as if CRs were not there (MSDOS)\n" +"\n" +"`egrep' means `grep -E'. `fgrep' means `grep -F'.\n" +"With no FILE, or when FILE is -, read standard input. If less than\n" +"two FILEs given, assume -h. Exit status is 0 if match, 1 if no match,\n" +"and 2 if trouble.\n" +msgstr "" +"\n" +"Konteksbeheer:\n" +" -B, --before-context=AANTAL wys AANTAL reëls voorafgaande konteks\n" +" -A, --after-context=AANTAL wys AANTAL reëls daaropvolgende konteks\n" +" -C, --context=AANTAL wys AANTAL reëls afvoerkonteks\n" +" -AANTAL dieselfde as --context=AANTAL\n" +" --color[=WHEN],\n" +" --colour[=WHEN] gebruik merkers om die passende string uit te wys\n" +" WHEN kan wees: `always', `never' of `auto'.\n" +" -U, --binary moenie CR-karakters by reëleindes wegvat nie (MSDOS)\n" +" -u, --unix-byte-offsets wys uitwyking asof die CR nie daar is nie (MSDOS)\n" +"\n" +"`egrep' beteken `grep -E'. `fgrep' beteken `grep -F'.\n" +"Met geen LÊER, of wanneer LÊER 'n - is, lees standaardtoevoer. \n" +"Indien minder as twee LÊERs gegee is, aanvaar -h. Uittreestatus is\n" +" 0 vir passing, 1 vir geen passing, en 2 vir probleemgevalle.\n" + +#: src/grep.c:1124 +#, fuzzy +msgid "" +"\n" +"Report bugs to .\n" +msgstr "" +"\n" +"Rapporteer foute aan .\n" + +#: src/grep.c:1134 +msgid "conflicting matchers specified" +msgstr "teenstrydige passers is gespesifiseer" + +#: src/grep.c:1376 +msgid "unknown devices method" +msgstr "onbekende metode vir toestelle" + +#: src/grep.c:1443 +msgid "unknown directories method" +msgstr "onbekende metode vir gidse" + +#: src/grep.c:1510 +msgid "invalid max count" +msgstr "ongeldige maks-telling" + +#: src/grep.c:1565 +msgid "unknown binary-files type" +msgstr "onbekende binêre-lêertipe" + +#: src/grep.c:1660 +#, c-format +msgid "%s (GNU grep) %s\n" +msgstr "%s (GNU grep) %s\n" + +#: src/grep.c:1662 +msgid "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" +msgstr "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" + +#: src/grep.c:1664 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"Hierdie is vry programmatuur; kyk in die bronkode vir kopieërvoorwaardes. Daar is GEEN\n" +"waarborg nie; selfs nie vir VERKOOPBAARHEID of GESKIKTHEID VIR 'N SPESIFIEKE DOEL nie.\n" + +#: src/search.c:606 +msgid "The -P option is not supported" +msgstr "Die -P opsie word nie ondersteun nie" + +#: src/search.c:619 +msgid "The -P and -z options cannot be combined" +msgstr "Die -P en -z opsies kan nie gekombineer word nie" + +#: lib/error.c:117 +msgid "Unknown system error" +msgstr "Onbekende stelselfout" + +#: lib/getopt.c:675 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: opsie `%s' is dubbelsinnig\n" + +#: lib/getopt.c:700 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: opsie `--%s' laat nie 'n parameter toe nie\n" + +#: lib/getopt.c:705 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: opsie `%c%s' laat nie 'n parameter toe nie\n" + +#: lib/getopt.c:723 lib/getopt.c:896 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: opsie `%s' benodig 'n parameter\n" + +# --option +#. --option +#: lib/getopt.c:752 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: onbekende opsie `--%s'\n" + +# +option or -option +#. +option or -option +#: lib/getopt.c:756 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: onbekende opsie `%c%s'\n" + +# 1003.2 specifies the format of this message. +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:782 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: ongeldige opsie -- %c\n" + +#: lib/getopt.c:785 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: ongeldige opsie -- %c\n" + +# 1003.2 specifies the format of this message. +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:815 lib/getopt.c:945 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: opsie benodig 'n parameter -- %c\n" + +#: lib/getopt.c:862 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: opsie `-W %s' is dubbelsinnig\n" + +#: lib/getopt.c:880 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: opsie `-W %s' laat nie 'n parameter toe nie\n" + +# Get translations for open and closing quotation marks. +# The message catalog should translate "`" to a left +# quotation mark suitable for the locale, and similarly for +# "'". If the catalog has no translation, +# locale_quoting_style quotes `like this', and +# clocale_quoting_style quotes "like this". +# For example, an American English Unicode locale should +# translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +# should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +# MARK). A British English Unicode locale should instead +# translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +# U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#: lib/quotearg.c:259 +msgid "`" +msgstr "'" + +#: lib/quotearg.c:260 +msgid "'" +msgstr "'" diff --git a/po/be.po b/po/be.po new file mode 100644 index 0000000..0b99823 --- /dev/null +++ b/po/be.po @@ -0,0 +1,413 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. +# Ales Nyakhaychyk , 2001-2003. +msgid "" +msgstr "" +"Project-Id-Version: grep 2.5g\n" +"POT-Creation-Date: 2002-03-26 16:38+0100\n" +"PO-Revision-Date: 2003-07-22 17:18+0300\n" +"Last-Translator: Ales Nyakhaychyk \n" +"Language-Team: Belarusian \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: KBabel 0.9.6\n" + +#: src/dfa.c:136 src/dfa.c:147 src/dfa.c:158 src/search.c:689 +msgid "Memory exhausted" +msgstr "Памяць вычарпана" + +#: src/dfa.c:489 src/dfa.c:492 src/dfa.c:510 src/dfa.c:521 src/dfa.c:545 +#: src/dfa.c:604 src/dfa.c:609 src/dfa.c:622 src/dfa.c:623 src/dfa.c:1001 +#: src/dfa.c:1004 src/dfa.c:1028 src/dfa.c:1032 src/dfa.c:1033 src/dfa.c:1036 +#: src/dfa.c:1048 src/dfa.c:1049 +msgid "Unbalanced [" +msgstr "Неўраўнаважаная [" + +#: src/dfa.c:741 +msgid "Unfinished \\ escape" +msgstr "Незавершаная \\ кіруючая пасьлядоўнасьць" + +#. Cases: +#. {M} - exact count +#. {M,} - minimum count, maximum is infinity +#. {M,N} - M through N +#: src/dfa.c:874 src/dfa.c:880 src/dfa.c:890 src/dfa.c:898 src/dfa.c:913 +msgid "unfinished repeat count" +msgstr "незавершаная колькасьць паўтарэньняў" + +#: src/dfa.c:887 src/dfa.c:904 src/dfa.c:912 src/dfa.c:916 +msgid "malformed repeat count" +msgstr "дрэнная колькасьць паўтарэньняў" + +#: src/dfa.c:1253 +msgid "Unbalanced (" +msgstr "Неўраважаная (" + +#: src/dfa.c:1378 +msgid "No syntax specified" +msgstr "Сынтаксіс нявызначаны" + +#: src/dfa.c:1386 +msgid "Unbalanced )" +msgstr "Неўраўнаважаная )" + +#: src/dfa.c:2956 +msgid "out of memory" +msgstr "нехапае памяці" + +#: src/kwset.c:171 src/kwset.c:177 src/search.c:103 src/search.c:209 +#: src/search.c:293 lib/obstack.c:471 +msgid "memory exhausted" +msgstr "памяць вычарпана" + +#: src/grep.c:205 +msgid "invalid context length argument" +msgstr "недапушчальны довад даўжыні кантэксту" + +#: src/grep.c:479 +msgid "input is too large to count" +msgstr "увод занадта вялікі для падліку" + +#: src/grep.c:605 +msgid "writing output" +msgstr "запісваецца вывад" + +#: src/grep.c:878 +#, c-format +msgid "Binary file %s matches\n" +msgstr "Супадзеньні двайковага файла %s\n" + +#: src/grep.c:892 +msgid "(standard input)" +msgstr "(стандартны ўвод)" + +#: src/grep.c:997 +#, c-format +msgid "warning: %s: %s\n" +msgstr "Увага! %s: %s\n" + +#: src/grep.c:998 +msgid "recursive directory loop" +msgstr "тэчкі зацыклены" + +#: src/grep.c:1046 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE]...\n" +msgstr "Выкарыстаньне: %s [ВЫБАР]... УЗОР [ФАЙЛ]...\n" + +#: src/grep.c:1048 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "Паспрабуйце \"%s --help\" для больш падрабязных зьвестак.\n" + +#: src/grep.c:1053 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE] ...\n" +msgstr "Выкарыстаньне: %s [ВЫБАР]... УЗОР [ФАЙЛ] ...\n" + +#: src/grep.c:1054 +#, c-format +msgid "" +"Search for PATTERN in each FILE or standard input.\n" +"Example: %s -i 'hello world' menu.h main.c\n" +"\n" +"Regexp selection and interpretation:\n" +msgstr "" +" Шукае ўзор у файле ці ў стандартным уводзе.\n" +"Напрыклад: %s -i 'hello world' menu.h main.c\n" +"\n" +"Выбар і тлумачэньне выразаў:\n" + +#: src/grep.c:1059 +msgid "" +" -E, --extended-regexp PATTERN is an extended regular expression\n" +" -F, --fixed-strings PATTERN is a set of newline-separated strings\n" +" -G, --basic-regexp PATTERN is a basic regular expression\n" +" -P, --perl-regexp PATTERN is a Perl regular expression\n" +msgstr "" +" -E, --extended-regexp УЗОР - гэта пашыраны сталы выраз.\n" +" -F, --fixed-strings УЗОР - гэта набор радкоў, падзеленых між сабой\n" +" пераходамі на новы радок.\n" +" -G, --basic-regexp УЗОР - гэта асноўны сталы выраз.\n" +" -P, --perl-regexp УЗОР - гэта сталы выраз на Perl.\n" + +#: src/grep.c:1064 +msgid "" +" -e, --regexp=PATTERN use PATTERN as a regular expression\n" +" -f, --file=FILE obtain PATTERN from FILE\n" +" -i, --ignore-case ignore case distinctions\n" +" -w, --word-regexp force PATTERN to match only whole words\n" +" -x, --line-regexp force PATTERN to match only whole lines\n" +" -z, --null-data a data line ends in 0 byte, not newline\n" +msgstr "" +" -e, --regexp=УЗОР Выкарыстоваць УЗОР як сталы выраз.\n" +" -f, --file=ФАЙЛ Атрымліваць узор з файла.\n" +" -i, --ignore-case Не зьвяртаць увагу на розьніцу між вялікімі й\n" +" маленькімі літарамі.\n" +" -w, --word-regexp Прымушае каб узор цалкам адпавядаў слову.\n" +" -x, --line-regexp Прымушае каб узор цалкам адпавядаў радку.\n" +" -z, --null-data Радок даньняў павінен мець канчатак ў выглядзе\n" +" нулявога байта, замест знака новага радка.\n" + +#: src/grep.c:1071 +msgid "" +"\n" +"Miscellaneous:\n" +" -s, --no-messages suppress error messages\n" +" -v, --invert-match select non-matching lines\n" +" -V, --version print version information and exit\n" +" --help display this help and exit\n" +" --mmap use memory-mapped input if possible\n" +msgstr "" +"\n" +"Разнастайныя:\n" +" -s, --no-messages Падаўляць паведамленьні пра памылкі.\n" +" -v, --invert-match Выбіраць нясупаўшыя радкі.\n" +" -V, --version Надрукаваць зьвесткі пра вэрсыю й выйсьці.\n" +" --help Адлюстраваць гэтую даведку й выйсьці.\n" +" --mmap Выкарыстоўваць memory-mapped, калі гэта магчыма.\n" + +#: src/grep.c:1079 +msgid "" +"\n" +"Output control:\n" +" -m, --max-count=NUM stop after NUM matches\n" +" -b, --byte-offset print the byte offset with output lines\n" +" -n, --line-number print line number with output lines\n" +" --line-buffered flush output on every line\n" +" -H, --with-filename print the filename for each match\n" +" -h, --no-filename suppress the prefixing filename on output\n" +" --label=LABEL print LABEL as filename for standard input\n" +" -o, --only-matching show only the part of a line matching PATTERN\n" +" -q, --quiet, --silent suppress all normal output\n" +" --binary-files=TYPE assume that binary files are TYPE\n" +" TYPE is 'binary', 'text', or 'without-match'\n" +" -a, --text equivalent to --binary-files=text\n" +" -I equivalent to --binary-files=without-match\n" +" -d, --directories=ACTION how to handle directories\n" +" ACTION is 'read', 'recurse', or 'skip'\n" +" -D, --devices=ACTION how to handle devices, FIFOs and sockets\n" +" ACTION is 'read' or 'skip'\n" +" -R, -r, --recursive equivalent to --directories=recurse\n" +" --include=PATTERN files that match PATTERN will be examined\n" +" --exclude=PATTERN files that match PATTERN will be skipped.\n" +" --exclude-from=FILE files that match PATTERN in FILE will be skipped.\n" +" -L, --files-without-match only print FILE names containing no match\n" +" -l, --files-with-matches only print FILE names containing matches\n" +" -c, --count only print a count of matching lines per FILE\n" +" -Z, --null print 0 byte after FILE name\n" +msgstr "" +"\n" +"Кіраваньне вывадам:\n" +" -m, --max-count=N Спыніцца пасьля N супадзеньняў.\n" +" -b, --byte-offset Друкаваць адлегласьць байта разам з вывадам радкоў.\n" +" -n, --line-number Друкаваць нумары радкоў побач з радкамі.\n" +" --line-buffered Скідаць вывад на кожным радку.\n" +" -H, --with-filename Друкаваць назву файла на кожнае супадзеньне.\n" +" -h, --no-filename Падаўляць назвы файлаў у вывадзе.\n" +" --label=МЕТКА Друкаваць метку ў якасьці назвы файла для\n" +" стандартнага ўвода.\n" +" -o, --only-matching Паказываць толькі тую частку радка, якая\n" +" супадае з узорам.\n" +" -q, --quiet, --silent Падаўляць увесь звычайны вывад.\n" +" --binary-files=ВІД Задаць від двайковага файла. Наяўныя віды:\n" +" \"binary\" (двайковы), \"text\" (тэкставы) ці\n" +" \"without-match\" (неістотны).\n" +" -a, --text Раўназначна --binary-files=text.\n" +" -I Раўназначна --binary-files=without-match.\n" +" -d, --directories=ДЗЕЯНЬНЕ\n" +" Як апрацоўваць тэчкі; ДЗЕЯНЬНЕ можа быць \"read\"\n" +" (чытаць), \"recurse\" (рэкурсыўна абходзіць) ці\n" +" \"skip\" (абмінаць).\n" +" -D, --devices=ДЗЕЯНЬНЕ Як апрацоўваць прылады, FIFO й гнёзды;\n" +" ДЗЕЯНЬНЕ можа быць \"read\" (чытаць) ці\n" +" \"skip\" (абмінаць).\n" +" -R, -r, --recursive Раўназначна --directories=recurse.\n" +" --include=УЗОР Апрацоўваць файлы, які адпавядаюць узору.\n" +" --exclude=УЗОР Не апрацоўваць файлы, які адпавядаюць узору.\n" +" --exclude-from=ФАЙЛ Абмінаць файлы, якія адпавядаюць узору з файла.\n" +" -L, --files-without-match Друкаваць толькі назвы тых файлаў, што ня\n" +" ўтрымліваюць супадзеньні.\n" +" -l, --files-with-matches Друкаваць толькі назвы тых файлаў, што ўтрымліваюць\n" +" супадзеньні.\n" +" -c, --count Друкаваць толькі колькасьць супаўшых радкоў на файл.\n" +" -Z, --null Друкаваць 0-ы байт пасьля назвы файла.\n" + +#: src/grep.c:1107 +msgid "" +"\n" +"Context control:\n" +" -B, --before-context=NUM print NUM lines of leading context\n" +" -A, --after-context=NUM print NUM lines of trailing context\n" +" -C, --context=NUM print NUM lines of output context\n" +" -NUM same as --context=NUM\n" +" --color[=WHEN],\n" +" --colour[=WHEN] use markers to distinguish the matching string\n" +" WHEN may be `always', `never' or `auto'.\n" +" -U, --binary do not strip CR characters at EOL (MSDOS)\n" +" -u, --unix-byte-offsets report offsets as if CRs were not there (MSDOS)\n" +"\n" +"`egrep' means `grep -E'. `fgrep' means `grep -F'.\n" +"With no FILE, or when FILE is -, read standard input. If less than\n" +"two FILEs given, assume -h. Exit status is 0 if match, 1 if no match,\n" +"and 2 if trouble.\n" +msgstr "" +"\n" +"Кіраваньне падтэкстам:\n" +" -B, --before-context=N Друкаваць N радкоў папярэдняга падтэксту.\n" +" -A, --after-context=N Друкаваць N радкоў наступнага падтэксту.\n" +" -C, --context=N Друкаваць N радкоў падтэксту.\n" +" -N Раўназначна --context=N\n" +" --color[=КАЛІ],\n" +" --colour[=КАЛІ] Выкарыстоўваць пазначальнікі, каб адрозьніваць\n" +" супаўшыя радкі. КАЛІ можа быць: \"always\"\n" +" (заўсёды), \"never\" (ніколі) ці \"auto\".\n" +" -U, --binary Не абразаць знакі CR на прыканцы радка (MSDOS).\n" +" -u, --unix-byte-offsets Паведамляць пра адлегласьці такім чынам, нібыта\n" +" знакі CR адсутнічаюць наагул (MSDOS).\n" +"\n" +"\"egrep\" азначае \"grep -E\". \"fgrep\" азначае \"grep -F\".\n" +"Бяз ФАЙЛа, ці калі замест назвы ФАЙЛа працяжнік -, чытае стандартны ўвод.\n" +"Калі заданы менш чым два файла, працуе як у выпадку выбара -h. Стан выхаду\n" +"роўны 0, калі ё супадзеньні, 1, калі супадзеньняў няма й 2 у выпадку памылкі.\n" + +#: src/grep.c:1124 +#, fuzzy +msgid "" +"\n" +"Report bugs to .\n" +msgstr "" +"\n" +"Паведамляйце пра памылкі на .\n" + +#: src/grep.c:1134 +msgid "conflicting matchers specified" +msgstr "заданы супярэчлівыя супадальнікі" + +#: src/grep.c:1376 +msgid "unknown devices method" +msgstr "невядомы мэтад пралад" + +#: src/grep.c:1443 +msgid "unknown directories method" +msgstr "невядомы мэтад тэчак" + +#: src/grep.c:1510 +msgid "invalid max count" +msgstr "недапушчальны найбольшы лічыльнік" + +#: src/grep.c:1565 +msgid "unknown binary-files type" +msgstr "невядомы від дваічнага файла" + +#: src/grep.c:1660 +#, c-format +msgid "%s (GNU grep) %s\n" +msgstr "%s (GNU grep) %s\n" + +#: src/grep.c:1662 +msgid "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" +msgstr " Аўтарскія правы © 1988, 1992-2001 Free Software Foundation, Inc.\n" + +#: src/grep.c:1664 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +" Гэта вольнае праграмнае забесьпячэньне. Глядзіце зыходны тэкст для\n" +"пагадненьня аб распаўсюджваньні. Не йснуе НІЯКАЕ гарантыі, нават аб\n" +"магчымасьці выкарыстаньня зь якой-небудзь мэтай.\n" + +#: src/search.c:606 +msgid "The -P option is not supported" +msgstr "Выбар -P непадтрымліваецца" + +#: src/search.c:619 +msgid "The -P and -z options cannot be combined" +msgstr "Выбары -P і -z ня могуць ісьці разам" + +#: lib/error.c:117 +msgid "Unknown system error" +msgstr "Невядомая сыстэмная памылка" + +#: lib/getopt.c:675 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: выбар \"%s\" неадназначны\n" + +#: lib/getopt.c:700 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: выбар \"--%s\" не дазваляе довад\n" + +#: lib/getopt.c:705 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: выбар \"%c%s\" не дазваляе довад\n" + +#: lib/getopt.c:723 lib/getopt.c:896 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: выбар \"%s\" патрабуе довад\n" + +#. --option +#: lib/getopt.c:752 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: нераспазнаны выбар \"--%s\"\n" + +#. +option or -option +#: lib/getopt.c:756 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: нераспазнаны выбар \"%c%s\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:782 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: недапушчальны выбар -- %c\n" + +#: lib/getopt.c:785 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: нерэчаісны выбар -- %c\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:815 lib/getopt.c:945 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: выбар патрабуе довад -- %c\n" + +#: lib/getopt.c:862 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: выбар \"-W %s\" неадназначны\n" + +#: lib/getopt.c:880 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: выбар \"-W %s\" не дазваляе довады\n" + +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#: lib/quotearg.c:259 +msgid "`" +msgstr "\"" + +#: lib/quotearg.c:260 +msgid "'" +msgstr "\"" diff --git a/po/bg.po b/po/bg.po new file mode 100644 index 0000000..a31d0e1 --- /dev/null +++ b/po/bg.po @@ -0,0 +1,408 @@ +# GNU grep messages translated in Bulgarian language. +# Copyright (C) 2002 Free Software Foundation, Inc. +# Pavel Mihaylov , 2002. +# +msgid "" +msgstr "" +"Project-Id-Version: GNU grep 2.5g\n" +"POT-Creation-Date: 2002-03-26 16:38+0100\n" +"PO-Revision-Date: 2002-03-09 02:00+0200\n" +"Last-Translator: Pavel Mihaylov \n" +"Language-Team: Bulgarian \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: src/dfa.c:136 src/dfa.c:147 src/dfa.c:158 src/search.c:689 +msgid "Memory exhausted" +msgstr "Паметта е изчерпана" + +#: src/dfa.c:489 src/dfa.c:492 src/dfa.c:510 src/dfa.c:521 src/dfa.c:545 +#: src/dfa.c:604 src/dfa.c:609 src/dfa.c:622 src/dfa.c:623 src/dfa.c:1001 +#: src/dfa.c:1004 src/dfa.c:1028 src/dfa.c:1032 src/dfa.c:1033 src/dfa.c:1036 +#: src/dfa.c:1048 src/dfa.c:1049 +msgid "Unbalanced [" +msgstr "Небалансирана [" + +#: src/dfa.c:741 +msgid "Unfinished \\ escape" +msgstr "Незавършена \\ последователност" + +#. Cases: +#. {M} - exact count +#. {M,} - minimum count, maximum is infinity +#. {M,N} - M through N +#: src/dfa.c:874 src/dfa.c:880 src/dfa.c:890 src/dfa.c:898 src/dfa.c:913 +msgid "unfinished repeat count" +msgstr "незавършен брой повторения" + +#: src/dfa.c:887 src/dfa.c:904 src/dfa.c:912 src/dfa.c:916 +msgid "malformed repeat count" +msgstr "грешно зададен брой повторения" + +#: src/dfa.c:1253 +msgid "Unbalanced (" +msgstr "Небалансирана (" + +#: src/dfa.c:1378 +msgid "No syntax specified" +msgstr "Не е зададен синтаксис" + +#: src/dfa.c:1386 +msgid "Unbalanced )" +msgstr "Небалансирана )" + +#: src/dfa.c:2956 +msgid "out of memory" +msgstr "недостатъчна памет" + +#: src/kwset.c:171 src/kwset.c:177 src/search.c:103 src/search.c:209 +#: src/search.c:293 lib/obstack.c:471 +msgid "memory exhausted" +msgstr "паметта е изчерпана" + +#: src/grep.c:205 +msgid "invalid context length argument" +msgstr "невалиден размер на контекста" + +#: src/grep.c:479 +msgid "input is too large to count" +msgstr "входните данни са прекалено големи за да бъдат преброени" + +#: src/grep.c:605 +msgid "writing output" +msgstr "записване на изходните данни" + +#: src/grep.c:878 +#, c-format +msgid "Binary file %s matches\n" +msgstr "Двоичен файл %s съвпада\n" + +#: src/grep.c:892 +msgid "(standard input)" +msgstr "(стандартен вход)" + +#: src/grep.c:997 +#, c-format +msgid "warning: %s: %s\n" +msgstr "предупреждение: %s: %s\n" + +#: src/grep.c:998 +msgid "recursive directory loop" +msgstr "рекурсивна обработка на директориите" + +#: src/grep.c:1046 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE]...\n" +msgstr "Употреба: %s [ОПЦИЯ]... ТЕКСТ [ФАЙЛ]...\n" + +#: src/grep.c:1048 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "Вижте `%s --help' за повече информация.\n" + +#: src/grep.c:1053 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE] ...\n" +msgstr "Употреба: %s [ОПЦИЯ]... ТЕКСТ [ФАЙЛ]...\n" + +#: src/grep.c:1054 +#, c-format +msgid "" +"Search for PATTERN in each FILE or standard input.\n" +"Example: %s -i 'hello world' menu.h main.c\n" +"\n" +"Regexp selection and interpretation:\n" +msgstr "" +"Търси ТЕКСТ във всеки ФАЙЛ или в стандартия вход.\n" +"Пример: %s -i 'hello world' menu.h main.c\n" +"\n" +"Избор на типа регулярен израз и интерпретация:\n" + +#: src/grep.c:1059 +msgid "" +" -E, --extended-regexp PATTERN is an extended regular expression\n" +" -F, --fixed-strings PATTERN is a set of newline-separated strings\n" +" -G, --basic-regexp PATTERN is a basic regular expression\n" +" -P, --perl-regexp PATTERN is a Perl regular expression\n" +msgstr "" +" -E, --extended-regexp ТЕКСТ е разширен регулярен израз\n" +" -F, --fixed-regexp ТЕКСТ е фиксиран низ, отделен с нови редове\n" +" -G, --basic-regexp ТЕКСТ е прост регулярен израз\n" +" -P, --perl-regexp ТЕКСТ е Perl регулярен израз\n" + +#: src/grep.c:1064 +msgid "" +" -e, --regexp=PATTERN use PATTERN as a regular expression\n" +" -f, --file=FILE obtain PATTERN from FILE\n" +" -i, --ignore-case ignore case distinctions\n" +" -w, --word-regexp force PATTERN to match only whole words\n" +" -x, --line-regexp force PATTERN to match only whole lines\n" +" -z, --null-data a data line ends in 0 byte, not newline\n" +msgstr "" +" -e, --regexp=ТЕКСТ използва ТЕКСТ като регулярен израз\n" +" -f, --file=ФАЙЛ получава ТЕКСТ от ФАЙЛ\n" +" -i, --ignore-case игнорира различието в малки и главни букви\n" +" -w, --word-regexp ТЕКСТ ще съвпада само с цели думи\n" +" -x, --line-regexp ТЕКСТ ще съвпада само с цели редове\n" +" -z, --null-data редовете във ФАЙЛ завършват с 0 (NULL),\n" +" а не със символ за нов ред (LF)\n" + +#: src/grep.c:1071 +msgid "" +"\n" +"Miscellaneous:\n" +" -s, --no-messages suppress error messages\n" +" -v, --invert-match select non-matching lines\n" +" -V, --version print version information and exit\n" +" --help display this help and exit\n" +" --mmap use memory-mapped input if possible\n" +msgstr "" +"\n" +"Разни:\n" +" -s, --no-messages не извежда съобщения за грешки\n" +" -v, --revert-match избира несъвпадащи редове\n" +" -V, --version извежда информация за версията и излиза\n" +" --help показва помощна информация и излиза\n" +" --mmap използва memory-mapped вход ако е възможно\n" + +#: src/grep.c:1079 +msgid "" +"\n" +"Output control:\n" +" -m, --max-count=NUM stop after NUM matches\n" +" -b, --byte-offset print the byte offset with output lines\n" +" -n, --line-number print line number with output lines\n" +" --line-buffered flush output on every line\n" +" -H, --with-filename print the filename for each match\n" +" -h, --no-filename suppress the prefixing filename on output\n" +" --label=LABEL print LABEL as filename for standard input\n" +" -o, --only-matching show only the part of a line matching PATTERN\n" +" -q, --quiet, --silent suppress all normal output\n" +" --binary-files=TYPE assume that binary files are TYPE\n" +" TYPE is 'binary', 'text', or 'without-match'\n" +" -a, --text equivalent to --binary-files=text\n" +" -I equivalent to --binary-files=without-match\n" +" -d, --directories=ACTION how to handle directories\n" +" ACTION is 'read', 'recurse', or 'skip'\n" +" -D, --devices=ACTION how to handle devices, FIFOs and sockets\n" +" ACTION is 'read' or 'skip'\n" +" -R, -r, --recursive equivalent to --directories=recurse\n" +" --include=PATTERN files that match PATTERN will be examined\n" +" --exclude=PATTERN files that match PATTERN will be skipped.\n" +" --exclude-from=FILE files that match PATTERN in FILE will be skipped.\n" +" -L, --files-without-match only print FILE names containing no match\n" +" -l, --files-with-matches only print FILE names containing matches\n" +" -c, --count only print a count of matching lines per FILE\n" +" -Z, --null print 0 byte after FILE name\n" +msgstr "" +"\n" +"Опции контролиращи форматирането на резултата:\n" +" -m, --max-count=БРОЙ спира след БРОЙ резултата\n" +" -b, --byte-offset извежда отместването в байтове за всеки ред\n" +" -n, --line-number извежда номера на реда за всеки ред\n" +" --line-buffered извежда резултата по цял ред наведнъж\n" +" -H, --with-filename извежда името на файла за всяко съвпадение\n" +" -h, --no-filename не извежда името на файла за всяко съвпадение\n" +" --label=ЕТИКЕТ извежда ЕТИКЕТ като име на файл за стандартния вход\n" +" -o, --only-matching извежда само частта от реда, която съвпада с ТЕКСТ\n" +" -q, --quiet, --silent не извежда никакъв резултат при нормална работа\n" +" --binary-files=ТИП задава типа на двоичните файлове\n" +" ТИП може да 'binary' (двоичен), 'text' (текстов),\n" +" или 'without-match' (без съвпадение).\n" +" -a, --text също като --binary-files=text\n" +" -I също като --binary-files=without-match\n" +" -d, --directories=МЕТОД задава метод на действие при директориите\n" +" МЕТОД може да е \"read\" (прочети), \"recurse\"\n" +" (претърси рекурсивно), или \"skip\" (пропусни).\n" +" -D, --devices=МЕТОД как да се обработват специалните файлове,\n" +" FIFO и сокети. МЕТОД може да е \"read\" (чети)\n" +" или \"skip\" (пропусни)\n" +" -R, -r, --recursive също като --directories=recurse.\n" +" --include=ТЕКСТ файлове съвпадащи с ТЕКСТ ще бъдат\n" +" използвани за съвпадане\n" +" --exclude=ТЕКСТ файлове съвпадащи с ТЕКСТ ще бъдат пропуснати.\n" +" --exclude-from=ФАЙЛ файлове съвпадащи с ТЕКСТ във ФАЙЛ\n" +" ще бъдат пропуснати.\n" +" -L, --files-without-match извежда само имена на файлове,\n" +" в които няма съвпадение\n" +" -l, --files-with-matches извежда само имена на файлове,\n" +" в които има съвпадение\n" +" -c, --count извежда само броя на съвпадащите редове\n" +" за всеки файл\n" +" -Z, --null извежда символ NULL след всяко име на файл\n" + +#: src/grep.c:1107 +msgid "" +"\n" +"Context control:\n" +" -B, --before-context=NUM print NUM lines of leading context\n" +" -A, --after-context=NUM print NUM lines of trailing context\n" +" -C, --context=NUM print NUM lines of output context\n" +" -NUM same as --context=NUM\n" +" --color[=WHEN],\n" +" --colour[=WHEN] use markers to distinguish the matching string\n" +" WHEN may be `always', `never' or `auto'.\n" +" -U, --binary do not strip CR characters at EOL (MSDOS)\n" +" -u, --unix-byte-offsets report offsets as if CRs were not there (MSDOS)\n" +"\n" +"`egrep' means `grep -E'. `fgrep' means `grep -F'.\n" +"With no FILE, or when FILE is -, read standard input. If less than\n" +"two FILEs given, assume -h. Exit status is 0 if match, 1 if no match,\n" +"and 2 if trouble.\n" +msgstr "" +"\n" +"Контрол върху контекста:\n" +" -B, --before-context=N извежда N реда от предхождащия контекст\n" +" -A, --after-context=N извежда N реда от следващия контекст\n" +" -C, --context=N извежда N реда от изходния контекст\n" +" -ЧИСЛО също като --context=N\n" +" --color, --colour използва маркери за различаване на съвпадащите низове\n" +" -U, --binary не филтрира CR символи в края на реда (MSDOS)\n" +" -u, --unix-byte-offsets съобщава отместванията все едно, че символите CR\n" +" липсват (MSDOS)\n" +"\n" +"`egrep' означава `grep -E'. `fgrep' означава `grep -F'.\n" +"Без да е зададен ФАЙЛ, или когато ФАЙЛ е - се чете стандартния вход.\n" +"Ако са зададени по-малко от два ФАЙЛа се предполага -h.\n" +"При изход grep връща 0 ако има съвпадение, 1 ако няма и 2 при грешка.\n" + +#: src/grep.c:1124 +#, fuzzy +msgid "" +"\n" +"Report bugs to .\n" +msgstr "" +"\n" +"За програмни грешки съобщавайте на .\n" + +#: src/grep.c:1134 +msgid "conflicting matchers specified" +msgstr "зададените изрази за съвпадение са в конфликт" + +#: src/grep.c:1376 +msgid "unknown devices method" +msgstr "неизвестен метод за обработка на специалните файлове" + +#: src/grep.c:1443 +msgid "unknown directories method" +msgstr "неизвестен метод за обработка на директориите" + +#: src/grep.c:1510 +msgid "invalid max count" +msgstr "невалиден максимален брой" + +#: src/grep.c:1565 +msgid "unknown binary-files type" +msgstr "непознат тип двоичен файл" + +#: src/grep.c:1660 +#, c-format +msgid "%s (GNU grep) %s\n" +msgstr "%s (GNU grep) %s\n" + +#: src/grep.c:1662 +msgid "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" +msgstr "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" + +#: src/grep.c:1664 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"Това е свободно достъпен софтуер, вижте изходните файлове за условията на\n" +"разпространение. Няма НИКАКВА гаранция, дори за ТЪРГОВСКА СТОЙНОСТ или\n" +"ПРИГОДИМОСТ ЗА ДАДЕНА ЦЕЛ.\n" + +#: src/search.c:606 +msgid "The -P option is not supported" +msgstr "Опция -P не се поддържа" + +#: src/search.c:619 +msgid "The -P and -z options cannot be combined" +msgstr "Опциите -P и -z не могат да бъдат комбинирани" + +#: lib/error.c:117 +msgid "Unknown system error" +msgstr "Неизвестна системна грешка" + +#: lib/getopt.c:675 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: опция `%s' не е еднозначна\n" + +#: lib/getopt.c:700 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: опция `--%s' се използва без аргумент\n" + +#: lib/getopt.c:705 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: опция `%c%s' се използва без аргумент\n" + +#: lib/getopt.c:723 lib/getopt.c:896 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: опция `%s' изисква аргумент\n" + +#. --option +#: lib/getopt.c:752 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: непозната опция `--%s'\n" + +#. +option or -option +#: lib/getopt.c:756 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: непозната опция `%c%s'\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:782 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: грешна опция -- %c\n" + +#: lib/getopt.c:785 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: невалидна опция -- %c\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:815 lib/getopt.c:945 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: опция изискваща аргумент -- %c\n" + +#: lib/getopt.c:862 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: опция `-W %s' не е еднозначна\n" + +#: lib/getopt.c:880 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: опция `-W %s' се използва без аргумент\n" + +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#: lib/quotearg.c:259 +msgid "`" +msgstr "\"" + +#: lib/quotearg.c:260 +msgid "'" +msgstr "\"" diff --git a/po/ca.po b/po/ca.po new file mode 100644 index 0000000..68f4225 --- /dev/null +++ b/po/ca.po @@ -0,0 +1,415 @@ +# Traducció missatges de GNU grep al català. +# Copyright (C) 2002 Free Software Foundation, Inc. +# Enric Alberola Rosell , 2002. +msgid "" +msgstr "" +"Project-Id-Version: GNU grep 2.5g\n" +"POT-Creation-Date: 2002-03-26 16:38+0100\n" +"PO-Revision-Date: 2002-03-11 15:46+0100\n" +"Last-Translator: Enric Alberola Rosell \n" +"Language-Team: Catalan \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-1\n" +"Content-Transfer-Encoding: 8-bit\n" + +#: src/dfa.c:136 src/dfa.c:147 src/dfa.c:158 src/search.c:689 +msgid "Memory exhausted" +msgstr "Memòria exhaurida" + +#: src/dfa.c:489 src/dfa.c:492 src/dfa.c:510 src/dfa.c:521 src/dfa.c:545 +#: src/dfa.c:604 src/dfa.c:609 src/dfa.c:622 src/dfa.c:623 src/dfa.c:1001 +#: src/dfa.c:1004 src/dfa.c:1028 src/dfa.c:1032 src/dfa.c:1033 src/dfa.c:1036 +#: src/dfa.c:1048 src/dfa.c:1049 +msgid "Unbalanced [" +msgstr "[ desaparellat" + +#: src/dfa.c:741 +msgid "Unfinished \\ escape" +msgstr "Codi d'escapada \\ inacabat" + +#. Cases: +#. {M} - exact count +#. {M,} - minimum count, maximum is infinity +#. {M,N} - M through N +#: src/dfa.c:874 src/dfa.c:880 src/dfa.c:890 src/dfa.c:898 src/dfa.c:913 +msgid "unfinished repeat count" +msgstr "comptador de repetició inacabat" + +#: src/dfa.c:887 src/dfa.c:904 src/dfa.c:912 src/dfa.c:916 +msgid "malformed repeat count" +msgstr "comptador de repetició defectuós" + +#: src/dfa.c:1253 +msgid "Unbalanced (" +msgstr "( desaparellat" + +#: src/dfa.c:1378 +msgid "No syntax specified" +msgstr "No s'ha especificat cap sintaxi" + +#: src/dfa.c:1386 +msgid "Unbalanced )" +msgstr ") desaparellat" + +#: src/dfa.c:2956 +msgid "out of memory" +msgstr "sense memòria" + +#: src/kwset.c:171 src/kwset.c:177 src/search.c:103 src/search.c:209 +#: src/search.c:293 lib/obstack.c:471 +msgid "memory exhausted" +msgstr "memòria exhaurida" + +#: src/grep.c:205 +msgid "invalid context length argument" +msgstr "longitud del context invàlida" + +#: src/grep.c:479 +msgid "input is too large to count" +msgstr "l'entrada és massa llarga per a comptar" + +#: src/grep.c:605 +msgid "writing output" +msgstr "escrivint eixida" + +#: src/grep.c:878 +#, c-format +msgid "Binary file %s matches\n" +msgstr "Concidència en el fitxer binari %s\n" + +#: src/grep.c:892 +msgid "(standard input)" +msgstr "(entrada estàndard)" + +#: src/grep.c:997 +#, c-format +msgid "warning: %s: %s\n" +msgstr "avís: %s: %s\n" + +#: src/grep.c:998 +msgid "recursive directory loop" +msgstr "bucle de directori recursiu" + +#: src/grep.c:1046 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE]...\n" +msgstr "Ús: %s [OPCIÓ]... PATRÓ [FITXER] ...\n" + +#: src/grep.c:1048 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "Proveu amb \"%s --help\" per a obtenir més informació.\n" + +#: src/grep.c:1053 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE] ...\n" +msgstr "Ús: %s [OPCIÓ]... PATRÓ [FITXER] ...\n" + +#: src/grep.c:1054 +#, c-format +msgid "" +"Search for PATTERN in each FILE or standard input.\n" +"Example: %s -i 'hello world' menu.h main.c\n" +"\n" +"Regexp selection and interpretation:\n" +msgstr "" +"Cerca PATRÓ en cada FITXER o en l'entrada estàndard.\n" +"Exemple: %s -i \"hola món\" menu.h main.c\n" +"\n" +"Selecció i interpretació de l'expressió regular:\n" + +#: src/grep.c:1059 +msgid "" +" -E, --extended-regexp PATTERN is an extended regular expression\n" +" -F, --fixed-strings PATTERN is a set of newline-separated strings\n" +" -G, --basic-regexp PATTERN is a basic regular expression\n" +" -P, --perl-regexp PATTERN is a Perl regular expression\n" +msgstr "" +" -E, --extended-regexp PATRÓ és una expressió regular extesa\n" +" -F, --fixed-strings PATRÓ és un conjunt de cadenes separades per \n" +" caràcters de nova línia\n" +" -G, --basic-regexp PATRÓ és un expressió regular bàsica\n" +" -P, --perl-regexp PATRÓ és un expressió regular de Perl\n" + +#: src/grep.c:1064 +msgid "" +" -e, --regexp=PATTERN use PATTERN as a regular expression\n" +" -f, --file=FILE obtain PATTERN from FILE\n" +" -i, --ignore-case ignore case distinctions\n" +" -w, --word-regexp force PATTERN to match only whole words\n" +" -x, --line-regexp force PATTERN to match only whole lines\n" +" -z, --null-data a data line ends in 0 byte, not newline\n" +msgstr "" +" -e, --regexp=PATRÓ utilitza el PATRÓ com a expressió regular\n" +" -f, --file=FITXER obté el PATRÓ del FITXER\n" +" -i, --ignore-case no té en compte majúscules i minúscules\n" +" -w, --word-regexp força la concordança del PATRÓ amb paraules\n" +" completes\n" +" -x, --line-regexp força la concordança del PATRÓ amb línies\n" +" completes\n" +" -z, --null-data considera que una línia de dades acaba amb el\n" +" byte 0 i no amb el caràcter de nova línia\n" + +#: src/grep.c:1071 +msgid "" +"\n" +"Miscellaneous:\n" +" -s, --no-messages suppress error messages\n" +" -v, --invert-match select non-matching lines\n" +" -V, --version print version information and exit\n" +" --help display this help and exit\n" +" --mmap use memory-mapped input if possible\n" +msgstr "" +"\n" +"Miscel·lanis:\n" +" -s, --no-messages suprimeix els missatges d'error\n" +" -v, --invert-match selecciona les línies que no coincideixen\n" +" -V, --version mostra la informació sobre la versió i acaba\n" +" --help mostra aquesta ajuda i acaba\n" +" --mmap si és possible utilitza com a entrada la\n" +" memòria assignada\n" + +#: src/grep.c:1079 +msgid "" +"\n" +"Output control:\n" +" -m, --max-count=NUM stop after NUM matches\n" +" -b, --byte-offset print the byte offset with output lines\n" +" -n, --line-number print line number with output lines\n" +" --line-buffered flush output on every line\n" +" -H, --with-filename print the filename for each match\n" +" -h, --no-filename suppress the prefixing filename on output\n" +" --label=LABEL print LABEL as filename for standard input\n" +" -o, --only-matching show only the part of a line matching PATTERN\n" +" -q, --quiet, --silent suppress all normal output\n" +" --binary-files=TYPE assume that binary files are TYPE\n" +" TYPE is 'binary', 'text', or 'without-match'\n" +" -a, --text equivalent to --binary-files=text\n" +" -I equivalent to --binary-files=without-match\n" +" -d, --directories=ACTION how to handle directories\n" +" ACTION is 'read', 'recurse', or 'skip'\n" +" -D, --devices=ACTION how to handle devices, FIFOs and sockets\n" +" ACTION is 'read' or 'skip'\n" +" -R, -r, --recursive equivalent to --directories=recurse\n" +" --include=PATTERN files that match PATTERN will be examined\n" +" --exclude=PATTERN files that match PATTERN will be skipped.\n" +" --exclude-from=FILE files that match PATTERN in FILE will be skipped.\n" +" -L, --files-without-match only print FILE names containing no match\n" +" -l, --files-with-matches only print FILE names containing matches\n" +" -c, --count only print a count of matching lines per FILE\n" +" -Z, --null print 0 byte after FILE name\n" +msgstr "" +"\n" +"Control d'eixida:\n" +" -m, --max-count=NOMBRE s'atura després de NOMBRE coincidències\n" +" -b, --byte-offset mostra el desplaçament en bytes en les línies\n" +" d'eixida\n" +" -n, --line-number mostra el número de línia en les línies\n" +" d'eixida\n" +" --line-buffered descarrega el resultat per a cada línia\n" +" -H, --with-filename mostra el nom del fitxer per a cada coincidència\n" +" -h, --no-filename elimina els noms de fitxer en l'eixida\n" +" --label=ETIQUETA mostra ETIQUETA com a nom de fitxer per\n" +" a l'entrada estàndard\n" +" -o, --only-matching mostra només la part de la línia que coincideix\n" +" amb PATRÓ\n" +" -q, --quiet, --silent elimina tota l'eixida normal\n" +" --binary-files=TIPUS indica el TIPUS dels fitxers binaris, que pot \n" +" ser \"binary\", \"text\" o \"without-match\"\n" +" -a, --text equival a --binary-files=text\n" +" -I equival a --binary-files=without-match\n" +" -d, --directories=ACCIÓ indica com tractar els directoris. ACCIÓ pot\n" +" ser \"read\", \"recurse\" o \"skip\"\n" +" -D, --devices=ACCIÓ indica com manegar els dispositius, els FIFO i\n" +" els sockets. ACCIÓ pot ser \"read\" o \"skip\"\n" +" -R, -r, --recursive equival a --directories=recurse\n" +" --include=PATRÓ examina els fitxers que contenen PATRÓ\n" +" --exclude=PATRÓ exclou els fitxers que contenen PATRÓ\n" +" --exclude-from=FITXER exclou els fitxers que tenen coincidències amb\n" +" els patrons del FITXER\n" +" -L, --files-without-match només mostra els fitxers que no tenen\n" +" coincidències\n" +" -l, --files-with-matches només mostra els fitxers que tenen coincidències\n" +" -c, --count només compta les línies que coincideixen\n" +" per fitxer\n" +" -Z, --null imprimeix un byte 0 després del nom del fitxer\n" + +#: src/grep.c:1107 +msgid "" +"\n" +"Context control:\n" +" -B, --before-context=NUM print NUM lines of leading context\n" +" -A, --after-context=NUM print NUM lines of trailing context\n" +" -C, --context=NUM print NUM lines of output context\n" +" -NUM same as --context=NUM\n" +" --color[=WHEN],\n" +" --colour[=WHEN] use markers to distinguish the matching string\n" +" WHEN may be `always', `never' or `auto'.\n" +" -U, --binary do not strip CR characters at EOL (MSDOS)\n" +" -u, --unix-byte-offsets report offsets as if CRs were not there (MSDOS)\n" +"\n" +"`egrep' means `grep -E'. `fgrep' means `grep -F'.\n" +"With no FILE, or when FILE is -, read standard input. If less than\n" +"two FILEs given, assume -h. Exit status is 0 if match, 1 if no match,\n" +"and 2 if trouble.\n" +msgstr "" +"\n" +"Control del context:\n" +" -B, --before-context=NOMBRE mostra NOMBRE línies del context anterior\n" +" -A, --after-context=NOMBRE mostra NOMBRE línies del context posterior\n" +" -C, --context=NOMBRE mostra NOMBRE línies del context\n" +" -NUM el mateix que --context=NUM\n" +" --color[=QUAN],\n" +" --colour[=QUAN] ressalta amb marcadors la cadena que\n" +" coincideix. QUAN pot ser: \"always\",\n" +" \"never\" o \"auto\".\n" +" -U, --binary no elimina els caràcteres de retorn de carro\n" +" finals de línia (MSDOS)\n" +" -u, --unix-byte-offsets compta els desplaçaments como si no hi hagués\n" +" retorns de carro (MSDOS)\n" +"\n" +"\"egrep\" significa \"grep -E\". \"fgrep\" significa \"grep -F\".\n" +"Si no s'especifica cap FITXER, o quan és -, llegeix l'entrada estàndard.\n" +"Si són menys de dos fitxers, assumeix -h. El resultat en acabar és 0 si\n" +"s'han trobat coincidències, 1 si no hi han i 2 en cas d'haver tingut algun\n" +"problema.\n" + +#: src/grep.c:1124 +#, fuzzy +msgid "" +"\n" +"Report bugs to .\n" +msgstr "" +"\n" +"Podeu notificar els errors del programa a .\n" + +#: src/grep.c:1134 +msgid "conflicting matchers specified" +msgstr "s'han especificat expressions conflictives" + +#: src/grep.c:1376 +msgid "unknown devices method" +msgstr "mètode de dispositius desconegut" + +#: src/grep.c:1443 +msgid "unknown directories method" +msgstr "mètode de directoris desconegut" + +#: src/grep.c:1510 +msgid "invalid max count" +msgstr "comptador màxim invàlid" + +#: src/grep.c:1565 +msgid "unknown binary-files type" +msgstr "tipus de fitxer binari desconegut" + +#: src/grep.c:1660 +#, c-format +msgid "%s (GNU grep) %s\n" +msgstr "%s (GNU grep) %s\n" + +#: src/grep.c:1662 +msgid "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" +msgstr "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" + +#: src/grep.c:1664 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"Això és programari lliure; vegeu el codi font per a conéixer les condicions\n" +"de còpia. No hi ha CAP garantia; ni tan sols sobre la COMERCIABILITAT o\n" +"l'ADEQUACIÓ PER A UN PROPÒSIT CONCRET.\n" + +#: src/search.c:606 +msgid "The -P option is not supported" +msgstr "L'opció -P no està suportada" + +#: src/search.c:619 +msgid "The -P and -z options cannot be combined" +msgstr "No es poden combinar les opcions -P i -z" + +#: lib/error.c:117 +msgid "Unknown system error" +msgstr "Error desconegut del sistema" + +#: lib/getopt.c:675 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: l'opció \"%s\" és ambigua\n" + +#: lib/getopt.c:700 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: l'opció \"--%s\" no permet un argument\n" + +#: lib/getopt.c:705 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: l'opció \"%c%s\" no permet un argument\n" + +#: lib/getopt.c:723 lib/getopt.c:896 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: l'opció \"%s\" necessita un argument\n" + +#. --option +#: lib/getopt.c:752 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: opció desconeguda \"--%s\"\n" + +#. +option or -option +#: lib/getopt.c:756 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: opció desconeguda \"%c%s\"\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:782 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: opció il·legal -- %c\n" + +#: lib/getopt.c:785 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: opció invàlida -- %c\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:815 lib/getopt.c:945 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: l'opció necessita un argument -- %c\n" + +#: lib/getopt.c:862 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: l'opció \"-W %s\" és ambigua\n" + +#: lib/getopt.c:880 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: l'opció \"-W %s\" no permet un argument\n" + +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#: lib/quotearg.c:259 +msgid "`" +msgstr "\"" + +#: lib/quotearg.c:260 +msgid "'" +msgstr "\"" diff --git a/po/cat-id-tbl.c b/po/cat-id-tbl.c new file mode 100644 index 0000000..e69de29 diff --git a/po/cs.po b/po/cs.po new file mode 100644 index 0000000..a482fee --- /dev/null +++ b/po/cs.po @@ -0,0 +1,410 @@ +# Czech message catalog for grep. +# Copyright (C) 1998 Free Software Foundation, Inc. +# Vladimir Michl , 1998. +# +# Thanks to: Stanislav Brabec +# Note: 2 messages untranslated, it's OK. +# +msgid "" +msgstr "" +"Project-Id-Version: grep 2.5e\n" +"POT-Creation-Date: 2002-03-26 16:38+0100\n" +"PO-Revision-Date: 2001-08-04 12:01+02:00\n" +"Last-Translator: Vladimir Michl \n" +"Language-Team: Czech \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-2\n" +"Content-Transfer-Encoding: 8bit\n" + +#: src/dfa.c:136 src/dfa.c:147 src/dfa.c:158 src/search.c:689 +msgid "Memory exhausted" +msgstr "Pame» vyèerpána" + +#: src/dfa.c:489 src/dfa.c:492 src/dfa.c:510 src/dfa.c:521 src/dfa.c:545 +#: src/dfa.c:604 src/dfa.c:609 src/dfa.c:622 src/dfa.c:623 src/dfa.c:1001 +#: src/dfa.c:1004 src/dfa.c:1028 src/dfa.c:1032 src/dfa.c:1033 src/dfa.c:1036 +#: src/dfa.c:1048 src/dfa.c:1049 +msgid "Unbalanced [" +msgstr "Lichý poèet [" + +#: src/dfa.c:741 +msgid "Unfinished \\ escape" +msgstr "Za \\ chybí znak" + +#. Cases: +#. {M} - exact count +#. {M,} - minimum count, maximum is infinity +#. {M,N} - M through N +#: src/dfa.c:874 src/dfa.c:880 src/dfa.c:890 src/dfa.c:898 src/dfa.c:913 +msgid "unfinished repeat count" +msgstr "neukonèený zápis poètu opakování" + +#: src/dfa.c:887 src/dfa.c:904 src/dfa.c:912 src/dfa.c:916 +msgid "malformed repeat count" +msgstr "deformovaný zápis poètu opakování" + +#: src/dfa.c:1253 +msgid "Unbalanced (" +msgstr "Lichý poèet (" + +# ? Není zadaná syntaxe +#: src/dfa.c:1378 +msgid "No syntax specified" +msgstr "Syntaxe není urèena" + +#: src/dfa.c:1386 +msgid "Unbalanced )" +msgstr "Lichý poèet )" + +#: src/dfa.c:2956 +msgid "out of memory" +msgstr "nedostatek volné pamìti" + +#: src/kwset.c:171 src/kwset.c:177 src/search.c:103 src/search.c:209 +#: src/search.c:293 lib/obstack.c:471 +msgid "memory exhausted" +msgstr "pamì» vyèerpána" + +#: src/grep.c:205 +msgid "invalid context length argument" +msgstr "neplatný argument délky kontextu" + +#: src/grep.c:479 +msgid "input is too large to count" +msgstr "poèet vstupních øádkù nelze spoèítat (je jich hodnì)" + +#: src/grep.c:605 +msgid "writing output" +msgstr "zapisuje se výstup" + +#: src/grep.c:878 +#, c-format +msgid "Binary file %s matches\n" +msgstr "Binární soubor %s odpovídá\n" + +#: src/grep.c:892 +msgid "(standard input)" +msgstr "(standardní vstup)" + +#: src/grep.c:997 +#, c-format +msgid "warning: %s: %s\n" +msgstr "varování: %s: %s\n" + +#: src/grep.c:998 +msgid "recursive directory loop" +msgstr "smyèka pro rekurzivní prùchod" + +#: src/grep.c:1046 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE]...\n" +msgstr "Pou¾ití: %s [PØEPÍNAÈ]... VZOREK [SOUBOR]...\n" + +#: src/grep.c:1048 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "Více informací získáte pøíkazem `%s --help'.\n" + +#: src/grep.c:1053 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE] ...\n" +msgstr "Pou¾ití: %s [PØEPÍNAÈ]... VZOREK [SOUBOR]...\n" + +#: src/grep.c:1054 +#, c-format +msgid "" +"Search for PATTERN in each FILE or standard input.\n" +"Example: %s -i 'hello world' menu.h main.c\n" +"\n" +"Regexp selection and interpretation:\n" +msgstr "" +" Hledá øádky, jejich¾ nìkteré èásti vyhovují VZORKu. Øádky jsou èteny postupnì\n" +"ze v¹ech zadaných SOUBORù nebo ze standardního vstupu.\n" +"Pøíklad: %s -i 'hello world' menu.h main.c\n" +"\n" +"Výbìr a interpretace regulárního výrazu:\n" + +#: src/grep.c:1059 +msgid "" +" -E, --extended-regexp PATTERN is an extended regular expression\n" +" -F, --fixed-strings PATTERN is a set of newline-separated strings\n" +" -G, --basic-regexp PATTERN is a basic regular expression\n" +" -P, --perl-regexp PATTERN is a Perl regular expression\n" +msgstr "" +" -E, --extended-regexp VZOREK je roz¹íøený regulární výraz\n" +" -F, --fixed-strings VZOREK je mno¾ina øetìzcù, ka¾dý na jednom øádku\n" +" -G, --basic-regexp VZOREK je základní regulární výraz\n" +" -P, --perl-regexp VZOREK je regulární výraz Perlu\n" + +#: src/grep.c:1064 +msgid "" +" -e, --regexp=PATTERN use PATTERN as a regular expression\n" +" -f, --file=FILE obtain PATTERN from FILE\n" +" -i, --ignore-case ignore case distinctions\n" +" -w, --word-regexp force PATTERN to match only whole words\n" +" -x, --line-regexp force PATTERN to match only whole lines\n" +" -z, --null-data a data line ends in 0 byte, not newline\n" +msgstr "" +" -e, --regexp=VZOREK pou¾ije VZOREK jako regulární výraz\n" +" -f, --file=SOUBOR naète VZOREK ze SOUBORu\n" +" -i, --ignore-case ignoruje rozdíl mezi velikostí písmen\n" +" -w, --word-regexp VZOREK bude aplikován pouze na celá slova\n" +" -x, --line-regexp VZOREK bude aplikován pouze na celé øádky\n" +" -z, --null-data øádek konèí nulovým bajtem místo znaku nového øádku\n" + +#: src/grep.c:1071 +msgid "" +"\n" +"Miscellaneous:\n" +" -s, --no-messages suppress error messages\n" +" -v, --invert-match select non-matching lines\n" +" -V, --version print version information and exit\n" +" --help display this help and exit\n" +" --mmap use memory-mapped input if possible\n" +msgstr "" +"\n" +"Rùzné:\n" +" -s, --no-messages potlaèí chybové zprávy\n" +" -v, --invert-match vypí¹e øádky, které VZORKu nevyhovují\n" +" -V, --version vypí¹e oznaèení verze a skonèí\n" +" --help vypí¹e tuto nápovìdu a skonèí\n" +" --mmap kdy¾ to jde, namapuje vstup do pamìti\n" + +#: src/grep.c:1079 +#, fuzzy +msgid "" +"\n" +"Output control:\n" +" -m, --max-count=NUM stop after NUM matches\n" +" -b, --byte-offset print the byte offset with output lines\n" +" -n, --line-number print line number with output lines\n" +" --line-buffered flush output on every line\n" +" -H, --with-filename print the filename for each match\n" +" -h, --no-filename suppress the prefixing filename on output\n" +" --label=LABEL print LABEL as filename for standard input\n" +" -o, --only-matching show only the part of a line matching PATTERN\n" +" -q, --quiet, --silent suppress all normal output\n" +" --binary-files=TYPE assume that binary files are TYPE\n" +" TYPE is 'binary', 'text', or 'without-match'\n" +" -a, --text equivalent to --binary-files=text\n" +" -I equivalent to --binary-files=without-match\n" +" -d, --directories=ACTION how to handle directories\n" +" ACTION is 'read', 'recurse', or 'skip'\n" +" -D, --devices=ACTION how to handle devices, FIFOs and sockets\n" +" ACTION is 'read' or 'skip'\n" +" -R, -r, --recursive equivalent to --directories=recurse\n" +" --include=PATTERN files that match PATTERN will be examined\n" +" --exclude=PATTERN files that match PATTERN will be skipped.\n" +" --exclude-from=FILE files that match PATTERN in FILE will be skipped.\n" +" -L, --files-without-match only print FILE names containing no match\n" +" -l, --files-with-matches only print FILE names containing matches\n" +" -c, --count only print a count of matching lines per FILE\n" +" -Z, --null print 0 byte after FILE name\n" +msgstr "" +"\n" +"Øízení výstupu:\n" +" -m, --max-count=ÈÍSLO skonèí, pokud najde ÈÍSLO výrazù\n" +" -b, --byte-offset s ka¾dým výstupním øádkem vypí¹e jeho pozici\n" +" v souboru\n" +" -n, --line-number s ka¾dým výstupním øádkem vypí¹e jeho èíslo øádku\n" +" --line-buffered vyprázdní výstup po ka¾dém øádku\n" +" -H, --with-filename s ka¾dým výstupním øádkem vypí¹e jméno souboru\n" +" -h, --no-filename potlaèí vypisování jména souboru s výst. øádkem\n" +" -q, --quiet, --silent potlaèí obvyklý výstup\n" +" --binary-files=TYP definuje typ binárních souborù\n" +" TYP mù¾e být: 'binary', 'text' nebo 'without-match'\n" +" -a, --text jako --binary-files=text\n" +" -I jako --binary-files=without-match\n" +" -d, --directories=AKCE jak zpracovávat adresáøe. AKCE mù¾e být:\n" +" `read', `recurse', `skip'\n" +" -R, -r, --recursive jako --directories=recurse\n" +" --include=VZOREK soubory které vyhovují vzorku, budou zpracovány\n" +" --exclude=VZOREK soubory které vyhovují vzorku, budou pøeskoèeny\n" +" --exclude-from=SOUBOR soubory které vyhovují vzorkùm ze SOUBORu, budou\n" +" pøeskoèeny\n" +" -L, --files-without-match vypí¹e pouze jména souborù, ve kterých nebyl\n" +" VZOREK nalezen\n" +" -l, --files-with-matches vypí¹e pouze jména souborù, ve kterých byl VZOREK\n" +" nalezen\n" +" -c, --count vypí¹e pouze poèet vyhovujících øádkù na SOUBOR\n" +" -Z, --null vypí¹e nulový bajt za jménem SOUBORu\n" + +#: src/grep.c:1107 +#, fuzzy +msgid "" +"\n" +"Context control:\n" +" -B, --before-context=NUM print NUM lines of leading context\n" +" -A, --after-context=NUM print NUM lines of trailing context\n" +" -C, --context=NUM print NUM lines of output context\n" +" -NUM same as --context=NUM\n" +" --color[=WHEN],\n" +" --colour[=WHEN] use markers to distinguish the matching string\n" +" WHEN may be `always', `never' or `auto'.\n" +" -U, --binary do not strip CR characters at EOL (MSDOS)\n" +" -u, --unix-byte-offsets report offsets as if CRs were not there (MSDOS)\n" +"\n" +"`egrep' means `grep -E'. `fgrep' means `grep -F'.\n" +"With no FILE, or when FILE is -, read standard input. If less than\n" +"two FILEs given, assume -h. Exit status is 0 if match, 1 if no match,\n" +"and 2 if trouble.\n" +msgstr "" +"\n" +"Øízení kontextu:\n" +" -B, --before-context=POÈET vypí¹e POÈET øádkù pøed vyhovujícím\n" +" -A, --after-context=POÈET vypí¹e POÈET øádkù za vyhovujícím\n" +" -C, --context=[POÈET] vypí¹e POÈET (2) øádkù kontextu (pøed\n" +" i za vyhovujícím). Je potlaèeno pøepínaèi -A a -B\n" +" -POÈET stejné se zadáním --context=NUM\n" +" --color, --colour pou¾ije barev k rozli¹ení vyhovujících øetìzcù\n" +" -U, --binary neodstraòuje znak CR na konci øádku (MSDOS)\n" +" -u, --unix-byte-offsets vypisuje pozici jako by CR nebyly v souboru (MSDOS)\n" +"\n" +" Jestli¾e není zadán ¾ádný z pøepínaèù -[GEF], pak `egrep' pracuje jako\n" +"`grep -E', `fgrep' jako `grep -F' a `grep' jako `grep -G'. Jestli¾e SOUBOR\n" +"není zadán, nebo je -, je èten standardní vstup. Jestli¾e jsou zadány\n" +"ménì ne¾ dva SOUBORy, pak je implicitní parametr -h.\n" +" Návratový kód je 0 pøi nalezení, 1 nevyhovoval-li ¾ádný øádek a 2 pøi\n" +"syntaktické nebo systémové chybì.\n" + +#: src/grep.c:1124 +#, fuzzy +msgid "" +"\n" +"Report bugs to .\n" +msgstr "" +"\n" +" Chyby v programu oznamujte na adrese (pouze\n" +"anglicky), pøipomínky k pøekladu zasílejte na adresu (èesky).\n" + +#: src/grep.c:1134 +msgid "conflicting matchers specified" +msgstr "zadány kolidující vzorky" + +#: src/grep.c:1376 +#, fuzzy +msgid "unknown devices method" +msgstr "neznámá obsluha adresáøù" + +#: src/grep.c:1443 +msgid "unknown directories method" +msgstr "neznámá obsluha adresáøù" + +#: src/grep.c:1510 +msgid "invalid max count" +msgstr "neplatný maximální poèet" + +#: src/grep.c:1565 +msgid "unknown binary-files type" +msgstr "neznámý typ binárního souboru" + +#: src/grep.c:1660 +#, c-format +msgid "%s (GNU grep) %s\n" +msgstr "%s (GNU grep) %s\n" + +#: src/grep.c:1662 +msgid "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" +msgstr "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" + +#: src/grep.c:1664 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +" Toto je volné programové vybavení; podmínky pro kopírování a roz¹iøování\n" +"naleznete ve zdrojových textech. Toto programové vybavení je zcela BEZ ZÁRUKY,\n" +"a to i bez záruky PRODEJNOSTI nebo VHODNOSTI PRO NÌJAKÝ KONKRÉTNÍ ÚÈEL.\n" + +#: src/search.c:606 +msgid "The -P option is not supported" +msgstr "Pøepínaè -P není podporován" + +#: src/search.c:619 +msgid "The -P and -z options cannot be combined" +msgstr "Pøepínaèe -P a -z nemohou být kombinovány" + +#: lib/error.c:117 +msgid "Unknown system error" +msgstr "Neznámá systémová chyba" + +#: lib/getopt.c:675 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: pøepínaè `%s' není jednoznaèný\n" + +#: lib/getopt.c:700 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: pøepínaè `--%s' musí být zadán bez argumentu\n" + +#: lib/getopt.c:705 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: pøepínaè `%c%s' musí být zadán bez argumentu\n" + +#: lib/getopt.c:723 lib/getopt.c:896 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: pøepínaè `%s' vy¾aduje argument\n" + +#. --option +#: lib/getopt.c:752 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: neznámý pøepínaè `--%s'\n" + +#. +option or -option +#: lib/getopt.c:756 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: neznámý pøepínaè `%c%s'\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:782 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: neznámý pøepínaè -- %c\n" + +#: lib/getopt.c:785 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: neznámý pøepínaè -- %c\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:815 lib/getopt.c:945 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: pøepínaè vy¾aduje argument -- %c\n" + +#: lib/getopt.c:862 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: pøepínaè `-W %s' není jednoznaèný\n" + +#: lib/getopt.c:880 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: pøepínaè `-W %s' musí být zadán bez argumentu\n" + +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#: lib/quotearg.c:259 +msgid "`" +msgstr "" + +#: lib/quotearg.c:260 +msgid "'" +msgstr "" diff --git a/po/da.po b/po/da.po new file mode 100644 index 0000000..ebd04dc --- /dev/null +++ b/po/da.po @@ -0,0 +1,395 @@ +# Danish messages for GNU Grep version 2.4f. +# Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. +# Kenneth Christiansen , 1999. +# Keld Simonsen , 2000 +# +msgid "" +msgstr "" +"Project-Id-Version: grep 2.4f.da.po\n" +"POT-Creation-Date: 2002-03-26 16:38+0100\n" +"PO-Revision-Date: 2000-10-14 02:04+02:00\n" +"Last-Translator: Birger Langkjer \n" +"Language-Team: Danish \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-1\n" +"Content-Transfer-Encoding: 8-bit\n" + +#: src/dfa.c:136 src/dfa.c:147 src/dfa.c:158 src/search.c:689 +msgid "Memory exhausted" +msgstr "Hukommelse opbrugt" + +#: src/dfa.c:489 src/dfa.c:492 src/dfa.c:510 src/dfa.c:521 src/dfa.c:545 +#: src/dfa.c:604 src/dfa.c:609 src/dfa.c:622 src/dfa.c:623 src/dfa.c:1001 +#: src/dfa.c:1004 src/dfa.c:1028 src/dfa.c:1032 src/dfa.c:1033 src/dfa.c:1036 +#: src/dfa.c:1048 src/dfa.c:1049 +msgid "Unbalanced [" +msgstr "Ubalanceret [" + +#: src/dfa.c:741 +msgid "Unfinished \\ escape" +msgstr "Ufærdig \\-beskyttelse" + +#. Cases: +#. {M} - exact count +#. {M,} - minimum count, maximum is infinity +#. {M,N} - M through N +#: src/dfa.c:874 src/dfa.c:880 src/dfa.c:890 src/dfa.c:898 src/dfa.c:913 +msgid "unfinished repeat count" +msgstr "ufærdigt gentagelsesantal" + +#: src/dfa.c:887 src/dfa.c:904 src/dfa.c:912 src/dfa.c:916 +msgid "malformed repeat count" +msgstr "ugyldigt gentagelsesantal" + +#: src/dfa.c:1253 +msgid "Unbalanced (" +msgstr "Ubalanceret (" + +#: src/dfa.c:1378 +msgid "No syntax specified" +msgstr "Ingen syntaks angivet" + +#: src/dfa.c:1386 +msgid "Unbalanced )" +msgstr "Ubalanceret )" + +#: src/dfa.c:2956 +msgid "out of memory" +msgstr "ikke nok hukommelse" + +#: src/kwset.c:171 src/kwset.c:177 src/search.c:103 src/search.c:209 +#: src/search.c:293 lib/obstack.c:471 +msgid "memory exhausted" +msgstr "hukommelse opbrugt" + +#: src/grep.c:205 +msgid "invalid context length argument" +msgstr "ugyldigt kontekstlængdeargument" + +#: src/grep.c:479 +msgid "input is too large to count" +msgstr "" + +#: src/grep.c:605 +msgid "writing output" +msgstr "skriver uddata" + +#: src/grep.c:878 +#, c-format +msgid "Binary file %s matches\n" +msgstr "Binær fil %s stemmer\n" + +#: src/grep.c:892 +msgid "(standard input)" +msgstr "(standard inddata)" + +#: src/grep.c:997 +#, fuzzy, c-format +msgid "warning: %s: %s\n" +msgstr "%s: advarsel: %s: %s\n" + +#: src/grep.c:998 +msgid "recursive directory loop" +msgstr "rekursiv katalogsløjfe" + +#: src/grep.c:1046 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE]...\n" +msgstr "Brug: %s [FLAG]... MØNSTER [FIL]...\n" + +#: src/grep.c:1048 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "Prøv '%s --help' for mere information.\n" + +#: src/grep.c:1053 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE] ...\n" +msgstr "Brug: %s [FLAG]... MØNSTER [FIL] ...\n" + +#: src/grep.c:1054 +#, c-format +msgid "" +"Search for PATTERN in each FILE or standard input.\n" +"Example: %s -i 'hello world' menu.h main.c\n" +"\n" +"Regexp selection and interpretation:\n" +msgstr "" +"Søg efter MØNSTER i hver en FIL eller i standard inddata.\n" +"Eksempel: %s -i 'hello verden' menu.h main.c\n" +"\n" +"Regexp tilvalg og betydning:\n" + +#: src/grep.c:1059 +#, fuzzy +msgid "" +" -E, --extended-regexp PATTERN is an extended regular expression\n" +" -F, --fixed-strings PATTERN is a set of newline-separated strings\n" +" -G, --basic-regexp PATTERN is a basic regular expression\n" +" -P, --perl-regexp PATTERN is a Perl regular expression\n" +msgstr "" +" -E, --extended-regexp MØNSTER er et udvidet regulært udtryk\n" +" -F, --fixed-strings MØNSTER er et sæt af nylinje-separerede strenge\n" +" -G, --basic-regexp MØNSTER er et basalt regulært udtryk\n" + +#: src/grep.c:1064 +msgid "" +" -e, --regexp=PATTERN use PATTERN as a regular expression\n" +" -f, --file=FILE obtain PATTERN from FILE\n" +" -i, --ignore-case ignore case distinctions\n" +" -w, --word-regexp force PATTERN to match only whole words\n" +" -x, --line-regexp force PATTERN to match only whole lines\n" +" -z, --null-data a data line ends in 0 byte, not newline\n" +msgstr "" +" -e, --regexp=MØNSTER brug MØNSTER som et regulært udtryk\n" +" -f, --file=FIL tag MØNSTER fra FIL\n" +" -i, --ignore-case ignorér forskelle mellem store og små bogstaver\n" +" -w, --word-regexp få MØNSTER til at passe kun på hele ord\n" +" -x, --line-regexp få MØNSTER til at passe kun på hele linjer\n" +" -z, --null-data en datalinje slutter med en 0 byte, ikke ny linje\n" + +#: src/grep.c:1071 +msgid "" +"\n" +"Miscellaneous:\n" +" -s, --no-messages suppress error messages\n" +" -v, --invert-match select non-matching lines\n" +" -V, --version print version information and exit\n" +" --help display this help and exit\n" +" --mmap use memory-mapped input if possible\n" +msgstr "" +"\n" +"Forskelligt:\n" +" -s, --no-messages undertryk fejlmeddelser\n" +" -v, --invert-match vælg linjer der ikke passer\n" +" -V, --version udskriv versionsinformation og afslut\n" +" --help vis denne hjælpetekst og afslut\n" +" --mmap brug inddata via hukommelse om muligt\n" + +#: src/grep.c:1079 +#, fuzzy +msgid "" +"\n" +"Output control:\n" +" -m, --max-count=NUM stop after NUM matches\n" +" -b, --byte-offset print the byte offset with output lines\n" +" -n, --line-number print line number with output lines\n" +" --line-buffered flush output on every line\n" +" -H, --with-filename print the filename for each match\n" +" -h, --no-filename suppress the prefixing filename on output\n" +" --label=LABEL print LABEL as filename for standard input\n" +" -o, --only-matching show only the part of a line matching PATTERN\n" +" -q, --quiet, --silent suppress all normal output\n" +" --binary-files=TYPE assume that binary files are TYPE\n" +" TYPE is 'binary', 'text', or 'without-match'\n" +" -a, --text equivalent to --binary-files=text\n" +" -I equivalent to --binary-files=without-match\n" +" -d, --directories=ACTION how to handle directories\n" +" ACTION is 'read', 'recurse', or 'skip'\n" +" -D, --devices=ACTION how to handle devices, FIFOs and sockets\n" +" ACTION is 'read' or 'skip'\n" +" -R, -r, --recursive equivalent to --directories=recurse\n" +" --include=PATTERN files that match PATTERN will be examined\n" +" --exclude=PATTERN files that match PATTERN will be skipped.\n" +" --exclude-from=FILE files that match PATTERN in FILE will be skipped.\n" +" -L, --files-without-match only print FILE names containing no match\n" +" -l, --files-with-matches only print FILE names containing matches\n" +" -c, --count only print a count of matching lines per FILE\n" +" -Z, --null print 0 byte after FILE name\n" +msgstr "" +"\n" +"Output control:\n" +" -b, --byte-offset udskriv byte afsættet i uddatalinjer\n" +" -n, --line-number udskriv linjenummer i uddatalinjer\n" +" -H, --with-filename udskriv filnavn for hver træffer\n" +" -h, --no-filename undgå indledende filnavn i uddata\n" +" -q, --quiet, --silent undgå al normal uddata\n" +" --binary-files=TYPE antag at binære filer er TYPE\n" +" TYPE er 'binary', 'text', eller 'without-match'.\n" +" -a, --text det samme som --binary-files=text\n" +" -I det samme som --binary-files=without-match\n" +" -d, --directories=HANDLING hvordan kataloger skal behandles\n" +" HANDLING er 'read', 'recurse', eller 'skip'.\n" +" -r, --recursive det samme som --directories=recurse.\n" +" -L, --files-without-match udskriv kun FIL navne der ikke indeholder træffere match\n" +" -l, --files-with-matches udskriv kun FIL navne der indeholder træffere\n" +" -c, --count udskriv kun antal af linjer med træffere per FIL\n" +" -Z, --null udskriv en 0 byte efter FIL navn\n" + +#: src/grep.c:1107 +#, fuzzy +msgid "" +"\n" +"Context control:\n" +" -B, --before-context=NUM print NUM lines of leading context\n" +" -A, --after-context=NUM print NUM lines of trailing context\n" +" -C, --context=NUM print NUM lines of output context\n" +" -NUM same as --context=NUM\n" +" --color[=WHEN],\n" +" --colour[=WHEN] use markers to distinguish the matching string\n" +" WHEN may be `always', `never' or `auto'.\n" +" -U, --binary do not strip CR characters at EOL (MSDOS)\n" +" -u, --unix-byte-offsets report offsets as if CRs were not there (MSDOS)\n" +"\n" +"`egrep' means `grep -E'. `fgrep' means `grep -F'.\n" +"With no FILE, or when FILE is -, read standard input. If less than\n" +"two FILEs given, assume -h. Exit status is 0 if match, 1 if no match,\n" +"and 2 if trouble.\n" +msgstr "" +"\n" +"Kontekst bestemmelse:\n" +" -B, --before-context=NUM udskriv NUM linjer med foregående tekst\n" +" -A, --after-context=NUM udskriv NUM linjer med efterfølgende tekst\n" +" -C, --context[=NUM] udskriv NUM (forvalgt 2) linjer af omgivende tekst\n" +" medmindre andet angivet med -A eller -B\n" +" -NUM det samme som --context=NUM\n" +" -U, --binary fjern ikke CR tegn ved linieslut (MSDOS)\n" +" -u, --unix-byte-offsets rapportér afsæt som om CR tegn ikke var der (MSDOS)\n" +"\n" +"`egrep' betyder `grep -E'. `fgrep' betyder `grep -F'.\n" +"Uden en FIL, eller hvis FIL er -, læs standard inddata. Hvis mindre end\n" +"to FILer er angivet, antag -h. Afslutningsstatus er 0 ved træffer, 1 ved ingen træffer,\n" +"og 2 ved problemer.\n" + +#: src/grep.c:1124 +#, fuzzy +msgid "" +"\n" +"Report bugs to .\n" +msgstr "" +"\n" +"Rapportér fejl til .\n" + +#: src/grep.c:1134 +msgid "conflicting matchers specified" +msgstr "konfliktende søgeudtryk angivet" + +#: src/grep.c:1376 +#, fuzzy +msgid "unknown devices method" +msgstr "ukendt katalogmetode" + +#: src/grep.c:1443 +msgid "unknown directories method" +msgstr "ukendt katalogmetode" + +#: src/grep.c:1510 +#, fuzzy +msgid "invalid max count" +msgstr "ufærdigt gentagelsesantal" + +#: src/grep.c:1565 +msgid "unknown binary-files type" +msgstr "ukendt binær filtype" + +#: src/grep.c:1660 +#, c-format +msgid "%s (GNU grep) %s\n" +msgstr "%s (GNU grep) %s\n" + +#: src/grep.c:1662 +#, fuzzy +msgid "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" +msgstr "Ophavsret 1988, 1992-1999, 2000 Free Software Foundation, Inc.\n" + +#: src/grep.c:1664 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"Dette er frit programmel, se kildekoden for kopieringsbetingelser. Der\n" +"er INGEN garanti, ikke engang for SALGBARHED eller EGNETHED FOR NOGET \n" +"SPECIELT FORMÅL.\n" + +#: src/search.c:606 +msgid "The -P option is not supported" +msgstr "" + +#: src/search.c:619 +msgid "The -P and -z options cannot be combined" +msgstr "" + +#: lib/error.c:117 +msgid "Unknown system error" +msgstr "" + +#: lib/getopt.c:675 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: flaget '%s' er flertydigt\n" + +#: lib/getopt.c:700 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: flaget '--%s' tillader ikke argumenter\n" + +#: lib/getopt.c:705 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: flaget '%c%s' tillader ikke argumenter\n" + +#: lib/getopt.c:723 lib/getopt.c:896 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: flaget '%s' kræver et argument\n" + +#. --option +#: lib/getopt.c:752 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: ukendt flag '--%s'\n" + +#. +option or -option +#: lib/getopt.c:756 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: ukendt flag '%c%s'\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:782 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: ulovligt flag -- %c\n" + +#: lib/getopt.c:785 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: ugyldigt flag -- %c\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:815 lib/getopt.c:945 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: flaget kræver et argument -- %c\n" + +#: lib/getopt.c:862 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: flaget '-W %s' er flertydigt\n" + +#: lib/getopt.c:880 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: flaget '-W %s' tillader ikke argumenter\n" + +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#: lib/quotearg.c:259 +msgid "`" +msgstr "" + +#: lib/quotearg.c:260 +msgid "'" +msgstr "" diff --git a/po/de.po b/po/de.po new file mode 100644 index 0000000..1e945b6 --- /dev/null +++ b/po/de.po @@ -0,0 +1,408 @@ +# German messages for GNU grep +# Copyright (C) 1997-99, 2000, 2001, 2002 Free Software Foundation, Inc. +# Martin von Löwis , 1997-99, 2000, 2001, 2002 +# +msgid "" +msgstr "" +"Project-Id-Version: GNU grep 2.5\n" +"POT-Creation-Date: 2002-03-26 16:38+0100\n" +"PO-Revision-Date: 2002-03-26 21:16+0100\n" +"Last-Translator: Martin von Löwis \n" +"Language-Team: German \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-1\n" +"Content-Transfer-Encoding: 8-bit\n" + +#: src/dfa.c:136 src/dfa.c:147 src/dfa.c:158 src/search.c:689 +msgid "Memory exhausted" +msgstr "Virtueller Speicher erschöpft." + +# Is this message used only for [ without matching ], +# or for ] without [ as well? +#: src/dfa.c:489 src/dfa.c:492 src/dfa.c:510 src/dfa.c:521 src/dfa.c:545 +#: src/dfa.c:604 src/dfa.c:609 src/dfa.c:622 src/dfa.c:623 src/dfa.c:1001 +#: src/dfa.c:1004 src/dfa.c:1028 src/dfa.c:1032 src/dfa.c:1033 src/dfa.c:1036 +#: src/dfa.c:1048 src/dfa.c:1049 +msgid "Unbalanced [" +msgstr "Öffnende [ ohne schließende." + +#: src/dfa.c:741 +msgid "Unfinished \\ escape" +msgstr "Unbeendete \\-Escape-Sequenz." + +#. Cases: +#. {M} - exact count +#. {M,} - minimum count, maximum is infinity +#. {M,N} - M through N +#: src/dfa.c:874 src/dfa.c:880 src/dfa.c:890 src/dfa.c:898 src/dfa.c:913 +msgid "unfinished repeat count" +msgstr "Unbeendeter Wiederholungszähler." + +#: src/dfa.c:887 src/dfa.c:904 src/dfa.c:912 src/dfa.c:916 +msgid "malformed repeat count" +msgstr "Unförmiger Wiederholungszähler." + +#: src/dfa.c:1253 +msgid "Unbalanced (" +msgstr "Öffnende ( ohne schließende." + +#: src/dfa.c:1378 +msgid "No syntax specified" +msgstr "Keine Syntax angegeben." + +#: src/dfa.c:1386 +msgid "Unbalanced )" +msgstr "Schließende ) ohne öffnende." + +#: src/dfa.c:2956 +msgid "out of memory" +msgstr "Speicher ist alle." + +#: src/kwset.c:171 src/kwset.c:177 src/search.c:103 src/search.c:209 +#: src/search.c:293 lib/obstack.c:471 +msgid "memory exhausted" +msgstr "Virtueller Speicher erschöpft." + +#: src/grep.c:205 +msgid "invalid context length argument" +msgstr "Ungültige Kontextlänge." + +#: src/grep.c:479 +msgid "input is too large to count" +msgstr "Eingabe ist zu groß, um gezählt zu werden." + +#: src/grep.c:605 +msgid "writing output" +msgstr "Politik, " + +#: src/grep.c:878 +#, c-format +msgid "Binary file %s matches\n" +msgstr "Übereinstimmungen in Binärdatei %s.\n" + +#: src/grep.c:892 +msgid "(standard input)" +msgstr "(Standardeingabe)" + +#: src/grep.c:997 +#, c-format +msgid "warning: %s: %s\n" +msgstr "Warnung: %s: %s\n" + +#: src/grep.c:998 +msgid "recursive directory loop" +msgstr "Rekursive Verzeichnisschleife." + +#: src/grep.c:1046 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE]...\n" +msgstr "Aufruf: %s [OPTION]... MUSTER [DATEI]...\n" + +#: src/grep.c:1048 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "»%s --help« gibt Ihnen mehr Informationen.\n" + +#: src/grep.c:1053 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE] ...\n" +msgstr "Aufruf: %s [OPTION]... MUSTER [DATEI] ...\n" + +#: src/grep.c:1054 +#, c-format +msgid "" +"Search for PATTERN in each FILE or standard input.\n" +"Example: %s -i 'hello world' menu.h main.c\n" +"\n" +"Regexp selection and interpretation:\n" +msgstr "" +"Suche nach MUSTER in jeder DATEI oder der Standardeingabe.\n" +"Beispiel: %s -i 'Hallo Welt' menu.h main.c\n" +"\n" +"Auswahl und Interpretation regulärer Ausdrücke:\n" + +#: src/grep.c:1059 +msgid "" +" -E, --extended-regexp PATTERN is an extended regular expression\n" +" -F, --fixed-strings PATTERN is a set of newline-separated strings\n" +" -G, --basic-regexp PATTERN is a basic regular expression\n" +" -P, --perl-regexp PATTERN is a Perl regular expression\n" +msgstr "" +" -E, --extended-regexp MUSTER ist ein erweiterter regulärer Ausdruck.\n" +" -F, --fixed-strings MUSTER ist eine Menge Newline-getrennter \n" +" Zeichenketten.\n" +" -G, --basic-regexp MUSTER ist ein regulärer Standardausdruck.\n" +" -P, --perl-regexp MUSTER ist ein regulärer Ausdruck, \n" +" wie Perl ihn akzeptiert.\n" + +#: src/grep.c:1064 +msgid "" +" -e, --regexp=PATTERN use PATTERN as a regular expression\n" +" -f, --file=FILE obtain PATTERN from FILE\n" +" -i, --ignore-case ignore case distinctions\n" +" -w, --word-regexp force PATTERN to match only whole words\n" +" -x, --line-regexp force PATTERN to match only whole lines\n" +" -z, --null-data a data line ends in 0 byte, not newline\n" +msgstr "" +" -e, --regexp=MUSTER MUSTER als regulären Ausdruck verwenden.\n" +" -f, --file=FILE MUSTER aus DATEI lesen.\n" +" -i, --ignore-case Unterschied zwischen Groß- und Kleinschreibung\n" +" ignorieren.\n" +" -w, --word-regexp MUSTER paßt nur auf ganze Wörter.\n" +" -x, --line-regexp MUSTER paßt nur auf ganze Zeilen.\n" +" -z, --null-data Eine Zeile endet mit Nullbyte, nicht Newline.\n" + +#: src/grep.c:1071 +msgid "" +"\n" +"Miscellaneous:\n" +" -s, --no-messages suppress error messages\n" +" -v, --invert-match select non-matching lines\n" +" -V, --version print version information and exit\n" +" --help display this help and exit\n" +" --mmap use memory-mapped input if possible\n" +msgstr "" +"\n" +"Verschiedenes:\n" +" -s, --no-messages Fehlermeldungen unterdrücken.\n" +" -v, --revert-match Nicht-passende Zeilen anzeigen.\n" +" -V, --version Versionsnummer ausgeben und beenden.\n" +" --help Diese Hilfe ausgeben und beenden.\n" +" --mmap Wenn möglich, Eingabe in den Speicher mappen.\n" + +#: src/grep.c:1079 +msgid "" +"\n" +"Output control:\n" +" -m, --max-count=NUM stop after NUM matches\n" +" -b, --byte-offset print the byte offset with output lines\n" +" -n, --line-number print line number with output lines\n" +" --line-buffered flush output on every line\n" +" -H, --with-filename print the filename for each match\n" +" -h, --no-filename suppress the prefixing filename on output\n" +" --label=LABEL print LABEL as filename for standard input\n" +" -o, --only-matching show only the part of a line matching PATTERN\n" +" -q, --quiet, --silent suppress all normal output\n" +" --binary-files=TYPE assume that binary files are TYPE\n" +" TYPE is 'binary', 'text', or 'without-match'\n" +" -a, --text equivalent to --binary-files=text\n" +" -I equivalent to --binary-files=without-match\n" +" -d, --directories=ACTION how to handle directories\n" +" ACTION is 'read', 'recurse', or 'skip'\n" +" -D, --devices=ACTION how to handle devices, FIFOs and sockets\n" +" ACTION is 'read' or 'skip'\n" +" -R, -r, --recursive equivalent to --directories=recurse\n" +" --include=PATTERN files that match PATTERN will be examined\n" +" --exclude=PATTERN files that match PATTERN will be skipped.\n" +" --exclude-from=FILE files that match PATTERN in FILE will be skipped.\n" +" -L, --files-without-match only print FILE names containing no match\n" +" -l, --files-with-matches only print FILE names containing matches\n" +" -c, --count only print a count of matching lines per FILE\n" +" -Z, --null print 0 byte after FILE name\n" +msgstr "" +"\n" +"Ausgabekontrolle:\n" +" -m, --max-count=ZAHL Nach ZAHL Übereinstimmungen abbrechen.\n" +" -b, --byte-offset Byte-Offset anzeigen.\n" +" -n, --line-number Zeilennummer anzeigen.\n" +" --line-buffered Jede Zeile einzeln (ungepuffert) ausgeben.\n" +" -H, --with-filename Dateinamen bei jeder Übereinstimmung anzeigen.\n" +" -h, --no-filename Dateinamen nicht anzeigen.\n" +" --label=TEXT TEXT als Dateiname für Standardeingabe ausgeben.\n" +" -o, --only-matching Nur den Teil der Zeile anzeigen, die mit MUSTER\n" +" übereinstimmt.\n" +" -q, --quiet, --silent Alle normalen Ausgaben unterdrücken.\n" +" --binary-files=TYP Binärdateien als TYP annehmen. TYP kann \n" +" »binary«, »text« oder »without-match« sein.\n" +" -a, --text Entspricht --binary-files=text.\n" +" -I Entspricht --binary-files=without-match.\n" +" -d, --directories=AKTION Verarbeitung von Verzeichnissen festlegen.\n" +" AKTION ist 'read', 'recurse', oder 'skip'.\n" +" -D, --devices=AKTION Verarbeitung von Gerätedateien, FIFOs und\n" +" Sockets festlegt. AKTION ist »read« oder »write«.\n" +" -R, -r, --recursive Äquivalent zu --directories=recurse.\n" +" --include=MUSTER Dateien untersuchen, die auf MUSTER passen.\n" +" --exclude=MUSTER Dateien überspringen, die auf MUSTER passen.\n" +" --exclude-from=DATEI Dateien überspringen, die auf ein Muster \n" +" in DATEI passen.\n" +" -L, --files-without-match Nur Namen von Dateien ausgeben, die keine\n" +" Übereinstimmung enthalten.\n" +" -l, --files-with-matches Nur Dateinamen mit Übereinstimmungen ausgeben.\n" +" -c, --count Nur Zahl der passenden Zeilen pro Datei ausgeben.\n" +" -Z, --null Null-Byte nach jedem Dateinamen ausgeben.\n" + +#: src/grep.c:1107 +msgid "" +"\n" +"Context control:\n" +" -B, --before-context=NUM print NUM lines of leading context\n" +" -A, --after-context=NUM print NUM lines of trailing context\n" +" -C, --context=NUM print NUM lines of output context\n" +" -NUM same as --context=NUM\n" +" --color[=WHEN],\n" +" --colour[=WHEN] use markers to distinguish the matching string\n" +" WHEN may be `always', `never' or `auto'.\n" +" -U, --binary do not strip CR characters at EOL (MSDOS)\n" +" -u, --unix-byte-offsets report offsets as if CRs were not there (MSDOS)\n" +"\n" +"`egrep' means `grep -E'. `fgrep' means `grep -F'.\n" +"With no FILE, or when FILE is -, read standard input. If less than\n" +"two FILEs given, assume -h. Exit status is 0 if match, 1 if no match,\n" +"and 2 if trouble.\n" +msgstr "" +"\n" +"Kontextkontrolle:\n" +" -B, --before-context=ZAHL ZAHL Zeilen von vorausgehendem Kontext anzeigen.\n" +" -A, --after-context=ZAHL ZAHL Zeilen von folgendem Kontext anzeigen.\n" +" -C, --context=ZAHL ZAHL Zeilen Kontext anzeigen,\n" +" -ZAHL Wie --context=ZAHL.\n" +" --color[=WENN], \n" +" --colour=[WENN] Passende Textfragmente markieren.\n" +" WENN kann »always«, »never« oder »auto« sein.\n" +" -U, --binary CR-Zeichen am Zeilenende belassen (MSDOS).\n" +" -u, --unix-byte-offsets Offsets ausgeben, als fehlten CR-Zeichen (MSDOS).\n" +"\n" +"»egrep« bedeutet »grep -E«. »fgrep« bedeutet »grep -F«.\n" +"Wenn DATEI fehlt oder »-« ist, wird die Standardeingabe gelesen.\n" +"Weniger als zwei DATEIen implizieren -h. Status ist 0 bei \n" +"Übereinstimmungen, 1 ohne, 2 bei Problemen.\n" + +#: src/grep.c:1124 +#, fuzzy +msgid "" +"\n" +"Report bugs to .\n" +msgstr "" +"\n" +"Fehlerberichte bitte an .\n" + +#: src/grep.c:1134 +msgid "conflicting matchers specified" +msgstr "Festgelegte Vergleicher widersprechen einander." + +#: src/grep.c:1376 +msgid "unknown devices method" +msgstr "Unbekannte Methode für Gerätedateien." + +#: src/grep.c:1443 +msgid "unknown directories method" +msgstr "Unbekannte Methode für Verzeichnisse." + +#: src/grep.c:1510 +msgid "invalid max count" +msgstr "Unbeendeter Maximalzähler." + +#: src/grep.c:1565 +msgid "unknown binary-files type" +msgstr "Unbekannter Typ für »--binary-files«." + +#: src/grep.c:1660 +#, c-format +msgid "%s (GNU grep) %s\n" +msgstr "%s (GNU grep) %s\n" + +#: src/grep.c:1662 +msgid "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" +msgstr "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" + +#: src/grep.c:1664 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"Dies ist freie Software; in den Quellen befinden sich die Lizenzbedingungen.\n" +"Es gibt KEINERLEI Garantie; nicht einmal für die TAUGLICHKEIT oder\n" +"VERWENDBARKEIT FÜR EINEN BESTIMMTEN ZWECK.\n" + +#: src/search.c:606 +msgid "The -P option is not supported" +msgstr "Die Option -P ist nicht unterstützt." + +#: src/search.c:619 +msgid "The -P and -z options cannot be combined" +msgstr "Die Optionen -P und -z können nicht kombiniert werden." + +#: lib/error.c:117 +msgid "Unknown system error" +msgstr "Unbekannter Systemfehler." + +#: lib/getopt.c:675 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: Die Option »%s« ist mehrdeutig.\n" + +#: lib/getopt.c:700 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: Die Option »%s« erlaubt keinen Parameter.\n" + +#: lib/getopt.c:705 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: Die Option »%c%s« erlaubt keinen Parameter.\n" + +#: lib/getopt.c:723 lib/getopt.c:896 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: Die Option »%s« verlangt einen Parameter.\n" + +#. --option +#: lib/getopt.c:752 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: Nicht erkannte Option »--%s«\n" + +#. +option or -option +#: lib/getopt.c:756 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: Nicht erkannte Option »%c%s«.\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:782 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: Ungültige Option -- %c.\n" + +#: lib/getopt.c:785 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: Ungültige Option -- %c.\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:815 lib/getopt.c:945 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: Option verlangt einen Parameter -- %c.\n" + +#: lib/getopt.c:862 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: Option »-W %s« ist zweideutig.\n" + +#: lib/getopt.c:880 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: Option »-W %s« erlaubt keinen Parameter.\n" + +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#: lib/quotearg.c:259 +msgid "`" +msgstr "»" + +#: lib/quotearg.c:260 +msgid "'" +msgstr "«" diff --git a/po/el.po b/po/el.po new file mode 100644 index 0000000..7386784 --- /dev/null +++ b/po/el.po @@ -0,0 +1,567 @@ +# Greek messages for GNU grep-2.5g. +# Copyright (C) 1998, 2002 Free Software Foundation, Inc. +# Simos Xenitellis , 1998, 2002. +# +msgid "" +msgstr "" +"Project-Id-Version: GNU grep 2.5g\n" +"POT-Creation-Date: 2002-03-26 16:38+0100\n" +"PO-Revision-Date: 2002-03-11 12:00+0000\n" +"Last-Translator: Simos Xenitellis \n" +"Language-Team: Greek \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-7\n" +"Content-Transfer-Encoding: 8-bit\n" + +# src/dfa.c:147 src/dfa.c:159 src/dfa.c:172 +# src/dfa.c:155 src/dfa.c:167 src/dfa.c:180 src/grep.c:827 +#: src/dfa.c:136 src/dfa.c:147 src/dfa.c:158 src/search.c:689 +msgid "Memory exhausted" +msgstr "Ç ìíÞìç åîáíôëÞèçêå" + +# src/dfa.c:652 src/dfa.c:655 src/dfa.c:682 src/dfa.c:686 src/dfa.c:687 +# src/dfa.c:690 src/dfa.c:703 src/dfa.c:704 +# src/dfa.c:660 src/dfa.c:663 src/dfa.c:690 src/dfa.c:694 src/dfa.c:695 +# src/dfa.c:698 src/dfa.c:711 src/dfa.c:712 +#: src/dfa.c:489 src/dfa.c:492 src/dfa.c:510 src/dfa.c:521 src/dfa.c:545 +#: src/dfa.c:604 src/dfa.c:609 src/dfa.c:622 src/dfa.c:623 src/dfa.c:1001 +#: src/dfa.c:1004 src/dfa.c:1028 src/dfa.c:1032 src/dfa.c:1033 src/dfa.c:1036 +#: src/dfa.c:1048 src/dfa.c:1049 +msgid "Unbalanced [" +msgstr "Ìç éóïññïðçìÝíï [" + +# src/dfa.c:444 +# src/dfa.c:452 +#: src/dfa.c:741 +msgid "Unfinished \\ escape" +msgstr "Ìç ôåñìáôéóìÝíïò ÷áñáêôÞñáò äéáöõãÞò \\" + +# src/dfa.c:556 src/dfa.c:562 src/dfa.c:573 src/dfa.c:584 +# src/dfa.c:564 src/dfa.c:570 src/dfa.c:581 src/dfa.c:592 +#. Cases: +#. {M} - exact count +#. {M,} - minimum count, maximum is infinity +#. {M,N} - M through N +#: src/dfa.c:874 src/dfa.c:880 src/dfa.c:890 src/dfa.c:898 src/dfa.c:913 +msgid "unfinished repeat count" +msgstr "ìç ôåñìáôéóìÝíïò ìåôñçôÞò åðáíÜëçøçò" + +# src/dfa.c:569 src/dfa.c:583 src/dfa.c:587 +# src/dfa.c:577 src/dfa.c:591 src/dfa.c:595 +#: src/dfa.c:887 src/dfa.c:904 src/dfa.c:912 src/dfa.c:916 +msgid "malformed repeat count" +msgstr "êáêïó÷çìáôéóìÝíïò ìåôñçôÞò åðáíÜëçøçò" + +# src/dfa.c:841 +# src/dfa.c:849 +#: src/dfa.c:1253 +msgid "Unbalanced (" +msgstr "Ìç éóïññïðçìÝíï (" + +# src/dfa.c:962 +# src/dfa.c:970 +#: src/dfa.c:1378 +msgid "No syntax specified" +msgstr "Äåí ïñßóôçêå óõíôáêôéêü" + +# src/dfa.c:970 +# src/dfa.c:978 +#: src/dfa.c:1386 +msgid "Unbalanced )" +msgstr "Ìç éóïññïðçìÝíï )" + +# src/dfa.c:1990 +# src/dfa.c:1998 +#: src/dfa.c:2956 +msgid "out of memory" +msgstr "ç ìíÞìç åîáíôëÞèçêå" + +# src/grep.c:144 src/grep.c:161 src/grep.c:222 src/grep.c:263 src/kwset.c:184 +# src/kwset.c:190 +# src/grep.c:164 src/grep.c:181 src/grep.c:283 src/grep.c:338 src/kwset.c:184 +# src/kwset.c:190 +#: src/kwset.c:171 src/kwset.c:177 src/search.c:103 src/search.c:209 +#: src/search.c:293 lib/obstack.c:471 +msgid "memory exhausted" +msgstr "ç ìíÞìç åîáíôëÞèçêå" + +# src/grep.c:785 src/grep.c:792 +# src/grep.c:1060 src/grep.c:1067 src/grep.c:1076 +#: src/grep.c:205 +msgid "invalid context length argument" +msgstr "ìç Ýãêõñï üñéóìá ìÞêïõò ðåñéå÷ïìÝíïõ" + +#: src/grep.c:479 +msgid "input is too large to count" +msgstr "ç åßóïäïò åßíáé ðïëý ìåãÜëç ãéá íá ìåôñçèåß" + +# src/grep.c:392 src/grep.c:1034 +# src/grep.c:487 src/grep.c:1284 +#: src/grep.c:605 +msgid "writing output" +msgstr "åããñáöÞ áðïôåëÝóìáôïò" + +# src/grep.c:715 +#: src/grep.c:878 +#, c-format +msgid "Binary file %s matches\n" +msgstr "Ôï äõáäéêü áñ÷åßï %s ôáéñéÜæåé\n" + +# src/grep.c:964 src/grep.c:1015 +# src/grep.c:730 +#: src/grep.c:892 +msgid "(standard input)" +msgstr "(êáíïíéêÞ åßóïäïò)" + +# src/grep.c:293 +# src/grep.c:366 +#: src/grep.c:997 +#, c-format +msgid "warning: %s: %s\n" +msgstr "ðñïåéäïðïßçóç: %s: %s\n" + +# src/grep.c:844 +#: src/grep.c:998 +msgid "recursive directory loop" +msgstr "áíáäñïìéêÞ áëëçëïäéáäï÷Þ êáôáëüãùí" + +# src/grep.c:597 +# src/grep.c:862 +#: src/grep.c:1046 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE]...\n" +msgstr "×ñÞóç: %s [ÅÐÉËÏÃÇ]... ÕÐÏÄÅÉÃÌÁ [ÁÑ×ÅÉÏ]...\n" + +# src/grep.c:598 +# src/grep.c:863 +#: src/grep.c:1048 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "ÄïêéìÜóôå `%s --help' ãéá ðåñéóóüôåñåò ðëçñïöïñßåò.\n" + +# src/grep.c:602 +# src/grep.c:867 +#: src/grep.c:1053 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE] ...\n" +msgstr "×ñÞóç: %s [ÅÐÉËÏÃÇ]... ÕÐÏÄÅÉÃÌÁ [ÁÑ×ÅÉÏ] ...\n" + +#: src/grep.c:1054 +#, c-format +msgid "" +"Search for PATTERN in each FILE or standard input.\n" +"Example: %s -i 'hello world' menu.h main.c\n" +"\n" +"Regexp selection and interpretation:\n" +msgstr "" +"Åýñåóç ôïõ ÕÐÏÄÅÉÃÌÁôïò óå êÜèå ÁÑ×ÅÉÏ Þ ôçí êáíïíéêÞ åßóïäï.\n" +"ÐáñÜäåéãìá: %s -i 'hello world' menu.h main.c\n" +"\n" +"ÅðéëïãÞ êáíïíéêÞò Ýêöñáóçò êáé åñìçíåßá:\n" + +#: src/grep.c:1059 +msgid "" +" -E, --extended-regexp PATTERN is an extended regular expression\n" +" -F, --fixed-strings PATTERN is a set of newline-separated strings\n" +" -G, --basic-regexp PATTERN is a basic regular expression\n" +" -P, --perl-regexp PATTERN is a Perl regular expression\n" +msgstr "" +" -E, --extended-regexp ÕÐÏÄÅÉÃÌÁ åßíáé ìéá åêôåôáìÝíç êáíïíéêÞ Ýêöñáóç\n" +" -F, --fixed-regexp ÕÐÏÄÅÉÃÌÁ åßíáé óôáôéêü áëöáñéèìçôéêü äéá÷ùñé-\n" +" æüìåíï ìå ÷áñáêôÞñåò áëëáãÞò ãñáììÞò\n" +" -G, --basic-regexp ÕÐÏÄÅÉÃÌÁ åßíáé áðëÞ êáíïíéêÞ Ýêöñáóç\n" +" -P, --perl-regexp ÕÐÏÄÅÉÃÌÁ åßíáé êáíïíéêÞ Ýêöñáóç Perl\n" + +# src/grep.c:603 +# src/grep.c:868 +#: src/grep.c:1064 +msgid "" +" -e, --regexp=PATTERN use PATTERN as a regular expression\n" +" -f, --file=FILE obtain PATTERN from FILE\n" +" -i, --ignore-case ignore case distinctions\n" +" -w, --word-regexp force PATTERN to match only whole words\n" +" -x, --line-regexp force PATTERN to match only whole lines\n" +" -z, --null-data a data line ends in 0 byte, not newline\n" +msgstr "" +" -e, --regexp=ÕÐÏÄÅÉÃÌÁ ÷ñÞóç ÕÐÏÄÅÉÃÌÁôïò ãéá êáíïíéêÞ Ýêöñáóç\n" +" -f, --file=ÁÑ×ÅÉÏ ëÞøç ÕÐÏÄÅÉÃÌÁôïò áðü ôï áñ÷åßï ÁÑ×ÅÉÏ\n" +" -i, --ignore-case áãíüçóå äéáöïñÝò ðåæþí/êåöáëáßùí\n" +" -w, --word-regexp åðéâïëÞ ôïõ ÕÐÏÄÅÉÃÌÁôïò íá ôáéñéÜæåé ìüíï\n" +" ïëüêëçñåò ëÝîåéò\n" +" -x, --line-regexp åðéâïëÞ ôïõ ÕÐÏÄÅÉÃÌÁôïò íá ôáéñéÜæåé ìüíï\n" +" ïëüêëçñåò ãñáììÝò\n" +" -z, --null-data ç ãñáììÞ äåäïìÝíùí ôåñìáôßæåôáé ìå byte 0\n" +" êáé ü÷é ìå ÷áñáêôÞñá áëëáãÞò ãñáììÞò\n" + +# src/grep.c:615 +# src/grep.c:880 +#: src/grep.c:1071 +msgid "" +"\n" +"Miscellaneous:\n" +" -s, --no-messages suppress error messages\n" +" -v, --invert-match select non-matching lines\n" +" -V, --version print version information and exit\n" +" --help display this help and exit\n" +" --mmap use memory-mapped input if possible\n" +msgstr "" +"\n" +"ËïéðÜ:\n" +" -s, --no-messages áðïöõãÞ åìöÜíéóçò ìçíõìÜôùí óöáëìÜôùí\n" +" -v, --revert-match åðéëïãÞ ãñáììþí ðïõ äåí ôáéñéÜæïõí\n" +" -V, --version åìöÜíéóçò ðëçñïöïñéþí Ýêäïóçò êáé Ýîïäïò\n" +" --help åìöÜíéóçò áõôÞò ôçò âïÞèåéáò êáé Ýîïäïò\n" +" --mmap ÷ñÞóç åéóüäïõ áðåéêïíéóìÝíç-óôç-ìíÞìç áí\n" +" õðÜñ÷åé ôÝôïéá äõíáôüôçôá\n" + +# src/grep.c:622 +# src/grep.c:887 +#: src/grep.c:1079 +msgid "" +"\n" +"Output control:\n" +" -m, --max-count=NUM stop after NUM matches\n" +" -b, --byte-offset print the byte offset with output lines\n" +" -n, --line-number print line number with output lines\n" +" --line-buffered flush output on every line\n" +" -H, --with-filename print the filename for each match\n" +" -h, --no-filename suppress the prefixing filename on output\n" +" --label=LABEL print LABEL as filename for standard input\n" +" -o, --only-matching show only the part of a line matching PATTERN\n" +" -q, --quiet, --silent suppress all normal output\n" +" --binary-files=TYPE assume that binary files are TYPE\n" +" TYPE is 'binary', 'text', or 'without-match'\n" +" -a, --text equivalent to --binary-files=text\n" +" -I equivalent to --binary-files=without-match\n" +" -d, --directories=ACTION how to handle directories\n" +" ACTION is 'read', 'recurse', or 'skip'\n" +" -D, --devices=ACTION how to handle devices, FIFOs and sockets\n" +" ACTION is 'read' or 'skip'\n" +" -R, -r, --recursive equivalent to --directories=recurse\n" +" --include=PATTERN files that match PATTERN will be examined\n" +" --exclude=PATTERN files that match PATTERN will be skipped.\n" +" --exclude-from=FILE files that match PATTERN in FILE will be skipped.\n" +" -L, --files-without-match only print FILE names containing no match\n" +" -l, --files-with-matches only print FILE names containing matches\n" +" -c, --count only print a count of matching lines per FILE\n" +" -Z, --null print 0 byte after FILE name\n" +msgstr "" +"\n" +"¸ëåã÷ïò åîüäïõ:\n" +" -m, --max-count=ÁÑÉÈÌÏÓ óôáìÜôçìá ìåôÜ áðü ÁÑÉÈÌÏ ôáéñéÜóìáôá\n" +" -b, --byte-offset åìöÜíéóç ó÷åôéêÞò èÝóçò ôïõ byte ìå ôéò ãñáììÝò\n" +" åîüäïõ\n" +" -n, --line-number åìöÜíéóç áñéèìþí ãñáììÞò ìå ôéò ãñáììÝò åîüäïõ\n" +" -H, --with-filename åìöÜíéóç ïíüìáôïò áñ÷åßïõ ìå êÜèå ôáßñéáóìá\n" +" -h, --no-filename áðïöõãÞ åìöÜíéóçò ôïõ ïíüìáôïò ôïõ áñ÷åßïõ óôçí\n" +" áñ÷Þ ôçò åîüäïõ\n" +" --label=LABEL print LABEL as filename for standard input\n" +" -o, --only-matching show only the part of a line matching PATTERN\n" +" -q, --quiet, --silent áðïöõãÞ åìöÜíéóçò üëçò ôçò êáíïíéêÞò åîüäïõ\n" +" --binary-files=TYPE assume that binary files are TYPE\n" +" TYPE is 'binary', 'text', or 'without-match'\n" +" -a, --text íá ìçí áðïöåõ÷èåß ç Ýîïäïò äõáäéêþí äåäïìÝíùí\n" +" -I equivalent to --binary-files=without-match\n" +" -d, --directories=ÅÍÅÑÃÅÉÁ ôñüðïò ÷ñÞóçò ôùí êáôáëüãùí\n" +" Ç ÅÍÅÑÃÅÉÁ åßíáé 'read', 'recurse' Þ 'skip'.\n" +" (Ãéá áíÜãíùóç, áíáäñïìÞ êáé ðáñÜêáìøç áíôßóôïé÷á).\n" +" -D, --devices=ÅÍÅÑÃÅÉÁ ôñüðïò ÷ñÞóçò ôùí óõóêåõþí, FIFO êáé socket\n" +" Ç ÅÍÅÑÃÅÉÁ åßíáé 'read' Þ 'skip'.\n" +" (Ãéá áíÜãíùóç êáé ðáñÜêáìøç áíôßóôïé÷á).\n" +" -R, -r, --recursive éóïäýíáìï ìå --directories=recurse.\n" +" --include=ÕÐÏÄÅÉÃÌÁ èá åëåã÷èïýí áñ÷åßá ðïõ ôáéñéÜæïõí óôï ÕÐÏÄÅÉÃÌÁ.\n" +" --exclude=ÕÐÏÄÅÉÃÌÁ èá ðáñáêáìöèïýí áñ÷åßá ðïõ ôáéñéÜæïõí óôï ÕÐÏÄÅÉÃÌÁ\n" +" --exclude-from=ÁÑ×ÅÉÏ èá ðáñáêáìöèïýí ôá áñ÷åßá ðïõ ôáéñéÜæïõí óôá\n" +" ÕÐÏÄÅÉÃÌÁôá ðïõ ðåñéÝ÷ïíôáé ìÝóá óôï ÁÑ×ÅÉÏ.\n" +" -L, --files-without-match åìöÜíéóç ìüíï ôá ïíüìáôá ÁÑ×ÅÉÙÍ ðïõ äåí\n" +" ðåñéÝ÷ïõí ôáéñéÜóìáôá\n" +" -l, --files-with-matches åìöÜíéóç ìüíï ôá ïíüìáôá ÁÑ×ÅÉÙÍ ìå ôáéñéÜóìáôá\n" +" -c, --count åìöÜíéóç ìüíï ôïí áñéèìü ôùí ãñáììþí ìå\n" +" ôáéñéÜóìáôá ãéá êÜèå ÁÑ×ÅÉÏ\n" +" -Z, --null åããñáöÞ åíüò ìçäåíéêïý byte ìåôÜ ôï üíïìá ÁÑ×ÅÉÏÕ\n" + +# src/grep.c:633 +# src/grep.c:902 +#: src/grep.c:1107 +msgid "" +"\n" +"Context control:\n" +" -B, --before-context=NUM print NUM lines of leading context\n" +" -A, --after-context=NUM print NUM lines of trailing context\n" +" -C, --context=NUM print NUM lines of output context\n" +" -NUM same as --context=NUM\n" +" --color[=WHEN],\n" +" --colour[=WHEN] use markers to distinguish the matching string\n" +" WHEN may be `always', `never' or `auto'.\n" +" -U, --binary do not strip CR characters at EOL (MSDOS)\n" +" -u, --unix-byte-offsets report offsets as if CRs were not there (MSDOS)\n" +"\n" +"`egrep' means `grep -E'. `fgrep' means `grep -F'.\n" +"With no FILE, or when FILE is -, read standard input. If less than\n" +"two FILEs given, assume -h. Exit status is 0 if match, 1 if no match,\n" +"and 2 if trouble.\n" +msgstr "" +"\n" +"¸ëåã÷ïò âÜóåé ôïõ ðåñéå÷ïìÝíïõ:\n" +" -B, --before-context=ÁÑÉÈÌÏÓ åìöÜíéóç ÁÑÉÈÌÏÓ ãñáììþí ìå áêïëïõèïýìåíï\n" +" ðåñéå÷üìåíï\n" +" -A, --after-context=ÁÑÉÈÌÏÓ åìöÜíéóç ÁÑÉÈÌÏÓ ãñáììþí ìå ðñïðïñåõüìåíï\n" +" ðåñéå÷üìåíï\n" +" -C, --context=ÁÑÉÈÌÏÓ åìöÜíéóç ÁÑÉÈÌÏÓ (åî ïñéóìïý 2) ãñáììþí ìå\n" +" ðåñéå÷üìåíï åîüäïõ\n" +" åêôüò êé áí áíáéñåèåß ìå -A Þ -B\n" +" -NUM ôï ßäéï ìå --context=ÁÑÉÈÌÏÓ\n" +" --color[=WHEN],\n" +" --colour[=WHEN] use markers to distinguish the matching string\n" +" WHEN may be `always', `never' or `auto'.\n" +" -U, --binary íá ìçí áðáëåßöïíôáé ÷áñáêôÞñåò CR óôï EOL (MSDOS)\n" +" -u, --unix-byte-offsets áíáöïñÜ ó÷åôéêþí èÝóåùí óá íá ìçí õðÞñ÷áí\n" +" ÷áñáêôÞñåò CR (MSDOS)\n" +"\n" +"To `egrep' åßíáé éóïäýíáìï ôïõ `grep -E'. Ôï `fgrep' åßíáé éóïäýíáìï ôïõ\n" +"`grep -F'.\n" +"With no FILE, or when FILE is -, read standard input. If less than\n" +"×ùñßá ÁÑ×ÅÉÏ, Þ üôáí ôï ÁÑ×ÅÉÏ åßíáé -, äéáâÜæåôáé ç êáíïíéêÞ åßóïäïò.\n" +"Áí óôá ïñßóìáôá õðÜñ÷ïõí ëéãüôåñá áðü äýï ÁÑ×ÅÉÁ, ôüôå õðïôßèåôáé üôé Ý÷åé\n" +"äïèåß ç åðéëïãÞ -h. Ç êáôÜóôáóç åîüäïõ ôïõ ðñïãñÜììáôïò åßíáé 0 áí âñÝèçêå\n" +"ôï ÕÐÏÄÅÉÃÌÁ, 1 áí äåí âñÝèçêå êáé 2 áí ðñïÝêõøå êÜðïéï ðñüâëçìá.\n" + +# src/grep.c:647 +# src/grep.c:917 +#: src/grep.c:1124 +#, fuzzy +msgid "" +"\n" +"Report bugs to .\n" +msgstr "" +"\n" +"Óôåßëôå áíáöïñÝò óöáëìÜôùí óôï .\n" + +# src/grep.c:829 +# src/grep.c:1112 +#: src/grep.c:1134 +msgid "conflicting matchers specified" +msgstr "ïñßóôçêáí áíôéêñïõüìåíá óôïé÷åßá áíáæÞôçóçò" + +# src/grep.c:1133 +#: src/grep.c:1376 +msgid "unknown devices method" +msgstr "Üãíùóôç ìÝèïäïò óõóêåõþí" + +# src/grep.c:1133 +#: src/grep.c:1443 +msgid "unknown directories method" +msgstr "Üãíùóôç ìÝèïäïò êáôáëüãùí" + +# src/dfa.c:556 src/dfa.c:562 src/dfa.c:573 src/dfa.c:584 +# src/dfa.c:564 src/dfa.c:570 src/dfa.c:581 src/dfa.c:592 +#: src/grep.c:1510 +msgid "invalid max count" +msgstr "ìç Ýãêõñïò ìÝãéóôïò ìåôñçôÞò" + +#: src/grep.c:1565 +msgid "unknown binary-files type" +msgstr "Üãíùóôï åßäïò äõáäéêþí áñ÷åßùí" + +# src/grep.c:915 +# src/grep.c:1219 +#: src/grep.c:1660 +#, c-format +msgid "%s (GNU grep) %s\n" +msgstr "%s (GNU grep) %s\n" + +# src/grep.c:917 +# src/grep.c:1221 +#: src/grep.c:1662 +msgid "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" +msgstr "Äéêáßùìá áíôéãñáöÞò 1988, 1992-1999, 2000, 2001 ºäñõìá Åëåýèåñïõ Ëïãéóìéêïý\n" + +# src/grep.c:919 +# src/grep.c:1223 +#: src/grep.c:1664 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"Áõôü åßíáé åëåýèåñï ëïãéóìéêü, äåßôå ôïí ðçãáßï êþäéêá ãéá ôïõò êáíüíåò\n" +"áíôéãñáöÞò. ÄÅÍ õðÜñ÷åé åããýçóç, ïýôå áêüìá ãéá ×ÑÇÓÉÌÏÔÇÔÁ Þ ÊÁÔÁËËÇËÏÔÇÔÁ\n" +"ÃÉÁ ÅÍÁ ÓÕÃÊÅÊÑÉÌÅÍÏ ÓÊÏÐÏ.\n" + +#: src/search.c:606 +msgid "The -P option is not supported" +msgstr "Ç åðéëïãÞ -P äåí õðïóôçñßæåôáé" + +#: src/search.c:619 +msgid "The -P and -z options cannot be combined" +msgstr "Ïé åðéëïãÝò -P êáé -z äåí ìðïñïýí íá óõíäõáóôïýí" + +#: lib/error.c:117 +msgid "Unknown system error" +msgstr "¶ãíùóôï ëÜèïò óõóôÞìáôïò" + +# src/getopt.c:628 +# src/getopt.c:628 +#: lib/getopt.c:675 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: ç åðéëïãÞ `%s' åßíáé äéöïñïýìåíç\n" + +# src/getopt.c:652 +# src/getopt.c:652 +#: lib/getopt.c:700 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: ç åðéëïãÞ `--%s' äåí åðéôñÝðåé ïñßóìáôá\n" + +# src/getopt.c:657 +# src/getopt.c:657 +#: lib/getopt.c:705 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: ç åðéëïãÞ `%c%s' äåí åðéôñÝðåé ïñßóìáôá\n" + +# src/getopt.c:674 src/getopt.c:847 +# src/getopt.c:674 src/getopt.c:847 +#: lib/getopt.c:723 lib/getopt.c:896 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: ç åðéëïãÞ `%s' áðáéôåß üñéóìá\n" + +# src/getopt.c:703 +# src/getopt.c:703 +#. --option +#: lib/getopt.c:752 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: ìç áíáãíùñßóéìç åðéëïãÞ `--%s'\n" + +# src/getopt.c:707 +# src/getopt.c:707 +#. +option or -option +#: lib/getopt.c:756 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: ìç áíáãíùñßóéìç åðéëïãÞ `%c%s'\n" + +# src/getopt.c:733 +# src/getopt.c:733 +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:782 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: ìç áðïäåêôÞ åðéëïãÞ -- %c\n" + +# src/getopt.c:736 +# src/getopt.c:736 +#: lib/getopt.c:785 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: ìç Ýãêõñç åðéëïãÞ -- %c\n" + +# src/getopt.c:766 src/getopt.c:896 +# src/getopt.c:766 src/getopt.c:896 +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:815 lib/getopt.c:945 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: ç åðéëïãÞ áðáéôåß Ýíá üñéóìá -- %c\n" + +# src/getopt.c:813 +# src/getopt.c:813 +#: lib/getopt.c:862 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: ç åðéëïãÞ `-W %s' åßíáé äéöïñïýìåíç\n" + +# src/getopt.c:831 +# src/getopt.c:831 +#: lib/getopt.c:880 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: ç åðéëïãÞ `-W %s' äåí äÝ÷åôáé ïñßóìáôá\n" + +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#: lib/quotearg.c:259 +msgid "`" +msgstr "`" + +#: lib/quotearg.c:260 +msgid "'" +msgstr "'" + +# src/getopt1.c:132 +# src/getopt1.c:132 +#~ msgid "option %s" +#~ msgstr "åðéëïãÞ %s" + +# src/getopt1.c:134 +# src/getopt1.c:134 +#~ msgid " with arg %s" +#~ msgstr " ìå üñéóìá %s" + +# src/getopt1.c:149 +# src/getopt1.c:149 +#~ msgid "digits occur in two different argv-elements.\n" +#~ msgstr "õðÜñ÷ïõí øçößá óå äýï äéáöïñåôéêÜ argv-óôïé÷åßá.\n" + +# src/getopt1.c:151 +# src/getopt1.c:151 +#~ msgid "option %c\n" +#~ msgstr "åðéëïãÞ %c\n" + +# src/getopt1.c:155 +# src/getopt1.c:155 +#~ msgid "option a\n" +#~ msgstr "åðéëïãÞ á\n" + +# src/getopt1.c:159 +# src/getopt1.c:159 +#~ msgid "option b\n" +#~ msgstr "åðéëïãÞ â\n" + +# src/getopt1.c:163 +# src/getopt1.c:163 +#~ msgid "option c with value `%s'\n" +#~ msgstr "åðéëïãÞ ã ìå ôéìÞ `%s'\n" + +# src/getopt1.c:167 +# src/getopt1.c:167 +#~ msgid "option d with value `%s'\n" +#~ msgstr "åðéëïãÞ ä ìå ôéìÞ `%s'\n" + +# src/getopt1.c:174 +# src/getopt1.c:174 +#~ msgid "?? getopt returned character code 0%o ??\n" +#~ msgstr "?? ç getopt åðÝóôñåøå áëöáâçôéêü êùäéêü 0%o ??\n" + +# src/getopt1.c:180 +# src/getopt1.c:180 +#~ msgid "non-option ARGV-elements: " +#~ msgstr "ARGV-óôïé÷åßá ðïõ äåí åßíáé åðéëïãÝò: " + +# src/grep.c:800 src/grep.c:805 src/grep.c:810 +# src/grep.c:1083 src/grep.c:1088 src/grep.c:1093 +#~ msgid "you may specify only one of -E, -F, or -G" +#~ msgstr "ìðïñåßôå íá ïñßóåôå ìüíï Ýíá áðü ôá-E, -F Þ -G" + +# src/obstack.c:467 +# src/obstack.c:467 +#~ msgid "memory exhausted\n" +#~ msgstr "ç ìíÞìç åîáíôëÞèçêå\n" + +# src/grep.c:1027 src/grep.c:1030 +#~ msgid "(standard input)\n" +#~ msgstr "(êáíïíéêÞ åßóïäïò)\n" diff --git a/po/eo.po b/po/eo.po new file mode 100644 index 0000000..53d7682 --- /dev/null +++ b/po/eo.po @@ -0,0 +1,399 @@ +# La teksto por la mesaĝoj de la "grep" programo. +# Copyright (C) 1998, 1999 Free Software Foundation, Inc. +# D. Dale Gulledge , 1999. +# Edmund GRIMLEY EVANS , 2000-2005. +# +msgid "" +msgstr "" +"Project-Id-Version: GNU grep 2.5.1a\n" +"POT-Creation-Date: 2002-03-26 16:38+0100\n" +"PO-Revision-Date: 2005-03-04 20:04+0000\n" +"Last-Translator: Edmund GRIMLEY EVANS \n" +"Language-Team: Esperanto \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8-bit\n" + +#: src/dfa.c:136 src/dfa.c:147 src/dfa.c:158 src/search.c:689 +msgid "Memory exhausted" +msgstr "Memoro elĉerpita" + +#: src/dfa.c:489 src/dfa.c:492 src/dfa.c:510 src/dfa.c:521 src/dfa.c:545 +#: src/dfa.c:604 src/dfa.c:609 src/dfa.c:622 src/dfa.c:623 src/dfa.c:1001 +#: src/dfa.c:1004 src/dfa.c:1028 src/dfa.c:1032 src/dfa.c:1033 src/dfa.c:1036 +#: src/dfa.c:1048 src/dfa.c:1049 +msgid "Unbalanced [" +msgstr "Senpara [" + +#: src/dfa.c:741 +msgid "Unfinished \\ escape" +msgstr "Nefinita \\-eskapo" + +#. Cases: +#. {M} - exact count +#. {M,} - minimum count, maximum is infinity +#. {M,N} - M through N +#: src/dfa.c:874 src/dfa.c:880 src/dfa.c:890 src/dfa.c:898 src/dfa.c:913 +msgid "unfinished repeat count" +msgstr "nefinita ripetonombro" + +#: src/dfa.c:887 src/dfa.c:904 src/dfa.c:912 src/dfa.c:916 +msgid "malformed repeat count" +msgstr "misformita ripetonombro" + +#: src/dfa.c:1253 +msgid "Unbalanced (" +msgstr "Senpara (" + +#: src/dfa.c:1378 +msgid "No syntax specified" +msgstr "Mankas sintakso" + +#: src/dfa.c:1386 +msgid "Unbalanced )" +msgstr "Senpara )" + +#: src/dfa.c:2956 +msgid "out of memory" +msgstr "memoro elĉerpita" + +#: src/kwset.c:171 src/kwset.c:177 src/search.c:103 src/search.c:209 +#: src/search.c:293 lib/obstack.c:471 +msgid "memory exhausted" +msgstr "memoro elĉerpita" + +#: src/grep.c:205 +msgid "invalid context length argument" +msgstr "nevalida argumento por kunteksto-longo" + +#: src/grep.c:479 +msgid "input is too large to count" +msgstr "enigo estas tro granda por nombrado" + +#: src/grep.c:605 +msgid "writing output" +msgstr "skribas eligon" + +#: src/grep.c:878 +#, c-format +msgid "Binary file %s matches\n" +msgstr "Binara dosiero %s kongruas\n" + +#: src/grep.c:892 +msgid "(standard input)" +msgstr "(normala enigo)" + +#: src/grep.c:997 +#, c-format +msgid "warning: %s: %s\n" +msgstr "averto: %s: %s\n" + +#: src/grep.c:998 +msgid "recursive directory loop" +msgstr "rekursa dosieruja ciklo" + +#: src/grep.c:1046 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE]...\n" +msgstr "Uzado: %s [OPCIO]... ŜABLONO [DOSIERO]...\n" + +#: src/grep.c:1048 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "Provu `%s --help' por pliaj informoj.\n" + +#: src/grep.c:1053 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE] ...\n" +msgstr "Uzado: %s [OPCIO]... ŜABLONO [DOSIERO] ...\n" + +#: src/grep.c:1054 +#, c-format +msgid "" +"Search for PATTERN in each FILE or standard input.\n" +"Example: %s -i 'hello world' menu.h main.c\n" +"\n" +"Regexp selection and interpretation:\n" +msgstr "" +"Serĉi pri ŜABLONO en ĉiu DOSIERO aÅ­ la normala enigo.\n" +"Ekzemplo: %s -i 'saluton mondo' menu.h main.c\n" +"\n" +"Elekto kaj interpreto de regulaj esprimoj:\n" + +#: src/grep.c:1059 +msgid "" +" -E, --extended-regexp PATTERN is an extended regular expression\n" +" -F, --fixed-strings PATTERN is a set of newline-separated strings\n" +" -G, --basic-regexp PATTERN is a basic regular expression\n" +" -P, --perl-regexp PATTERN is a Perl regular expression\n" +msgstr "" +" -E, --extended-regexp ŜABLONO estas etendita regula esprimo\n" +" -F, --fixed-strings ŜABLONO estas aro da ĉenoj apartigitaj de linifinoj\n" +" -G, --basic-regexp ŜABLONO estas simpla regula esprimo\n" +" -P, --perl-regexp ŜABLONO estas regula esprimo de Perl\n" + +#: src/grep.c:1064 +msgid "" +" -e, --regexp=PATTERN use PATTERN as a regular expression\n" +" -f, --file=FILE obtain PATTERN from FILE\n" +" -i, --ignore-case ignore case distinctions\n" +" -w, --word-regexp force PATTERN to match only whole words\n" +" -x, --line-regexp force PATTERN to match only whole lines\n" +" -z, --null-data a data line ends in 0 byte, not newline\n" +msgstr "" +" -e, --regexp=ŜABLONO uzi ŜABLONOn kiel regulan esprimon\n" +" -f, --file=DOSIERO akiri la ŝablonon el DOSIERO\n" +" -i, --ignore-case ignori diferencojn de uskleco\n" +" -w, --word-regexp devigi al ŜABLONO kongrui nur al tutaj vortoj\n" +" -x, --line-regexp devigi al ŜABLONO kongrui nur al tutaj linioj\n" +" -z, --null-data datenlinio finiĝas per bitoko 0, ne per linifino\n" + +#: src/grep.c:1071 +msgid "" +"\n" +"Miscellaneous:\n" +" -s, --no-messages suppress error messages\n" +" -v, --invert-match select non-matching lines\n" +" -V, --version print version information and exit\n" +" --help display this help and exit\n" +" --mmap use memory-mapped input if possible\n" +msgstr "" +"\n" +"Miscellaneous:\\n\"\n" +" -s, --no-messages subpremi eraromesaĝojn\n" +" -v, --invert-match elekti la nekongruajn liniojn\n" +" -V, --version eltajpi versio-informojn kaj fini\n" +" --help montri ĉi tiun helpon kaj fini\n" +" --mmap uzi memoromapon por la enigo, se eble\n" + +#: src/grep.c:1079 +msgid "" +"\n" +"Output control:\n" +" -m, --max-count=NUM stop after NUM matches\n" +" -b, --byte-offset print the byte offset with output lines\n" +" -n, --line-number print line number with output lines\n" +" --line-buffered flush output on every line\n" +" -H, --with-filename print the filename for each match\n" +" -h, --no-filename suppress the prefixing filename on output\n" +" --label=LABEL print LABEL as filename for standard input\n" +" -o, --only-matching show only the part of a line matching PATTERN\n" +" -q, --quiet, --silent suppress all normal output\n" +" --binary-files=TYPE assume that binary files are TYPE\n" +" TYPE is 'binary', 'text', or 'without-match'\n" +" -a, --text equivalent to --binary-files=text\n" +" -I equivalent to --binary-files=without-match\n" +" -d, --directories=ACTION how to handle directories\n" +" ACTION is 'read', 'recurse', or 'skip'\n" +" -D, --devices=ACTION how to handle devices, FIFOs and sockets\n" +" ACTION is 'read' or 'skip'\n" +" -R, -r, --recursive equivalent to --directories=recurse\n" +" --include=PATTERN files that match PATTERN will be examined\n" +" --exclude=PATTERN files that match PATTERN will be skipped.\n" +" --exclude-from=FILE files that match PATTERN in FILE will be skipped.\n" +" -L, --files-without-match only print FILE names containing no match\n" +" -l, --files-with-matches only print FILE names containing matches\n" +" -c, --count only print a count of matching lines per FILE\n" +" -Z, --null print 0 byte after FILE name\n" +msgstr "" +"\n" +"Regado de la eligo:\n" +" -m, --max-count==NOMBRO halti post NOMBRO da trafoj\n" +" -b, --byte-offset presi la bitoknumeron kun eligataj linioj\n" +" -n, --line-number presi la lininumeron kun eligataj linioj\n" +" --line-buffered peli la eligon post ĉiu linio\n" +" -H, --with-filename presi la dosiernomon por ĉiu trafo\n" +" -h, --no-filename subpremi la prefiksan dosiernomon ĉe eligo\n" +" --label=ETIKEDO presi ETIKEDOn kiel dosiernomon en normala eligo\n" +" -q, --quiet, --silent subpremi ĉian normalan eligadon\n" +" --binary-files=SPECO supozi, ke binaraj dosieroj estas de SPECO\n" +" SPECO estas 'binary', 'text', aÅ­ 'without-match'\n" +" -a, --text same kiel --binary-files=text\n" +" -I same kiel --binary-files=without-match\n" +" -d, --directories=AGO kiel trakti dosierujojn; AGO estas 'read' (legi),\n" +" 'recurse' (rekurse), aÅ­ 'skip' (ignori)\n" +" -D, --devices=AGO kiel trakti specialajn dosierojn;\n" +" AGO estas 'read' (legi), aÅ­ 'skip' (ignori)\n" +" -R, -r, --recursive same kiel --directories=recurse.\n" +" --include=ŜABLONO ekzameni dosierojn, kiuj kongruas kun ŜABLONO\n" +" --exclude=ŜABLONO ignori dosierojn, kiuj kongruas kun ŜABLONO\n" +" --exclude-from=DOS ignori dosierojn, kiuj kongruas kun ŝablono en DOS\n" +" -L, --files-without-match presi nur dosiernomojn sen trafo\n" +" -l, --files-with-matches presi nur dosiernomojn kun trafoj\n" +" -c, --count presi nur nombron de kongruaj linioj en ĉiu dosiero\n" +" -Z, --null presi la bitokon 0 post dosiernomo\n" + +#: src/grep.c:1107 +msgid "" +"\n" +"Context control:\n" +" -B, --before-context=NUM print NUM lines of leading context\n" +" -A, --after-context=NUM print NUM lines of trailing context\n" +" -C, --context=NUM print NUM lines of output context\n" +" -NUM same as --context=NUM\n" +" --color[=WHEN],\n" +" --colour[=WHEN] use markers to distinguish the matching string\n" +" WHEN may be `always', `never' or `auto'.\n" +" -U, --binary do not strip CR characters at EOL (MSDOS)\n" +" -u, --unix-byte-offsets report offsets as if CRs were not there (MSDOS)\n" +"\n" +"`egrep' means `grep -E'. `fgrep' means `grep -F'.\n" +"With no FILE, or when FILE is -, read standard input. If less than\n" +"two FILEs given, assume -h. Exit status is 0 if match, 1 if no match,\n" +"and 2 if trouble.\n" +msgstr "" +"\n" +"Regado de la kunteksto:\n" +" -B, --before-context=NOM presi NOM liniojn da antaÅ­a kunteksto\n" +" -A, --after-context=NOM presi NOM liniojn da posta kunteksto\n" +" -C, --context=NOM presi NOM liniojn da kunteksto\n" +" -NOM same kiel --context=NOM\n" +" --color[=KIAM],\n" +" --colour[=KIAM] uzi markilojn por distingi la kongruan ĉenon;\n" +" KIAM povas esti 'always' (ĉiam), 'never' (neniam),\n" +" aÅ­ 'auto' (aÅ­tomate)\n" +" -U, --binary ne forigi \\r-signojn ĉe linifino (MSDOS)\n" +" -u, --unix-byte-offsets doni bitoknumerojn, kvazaÅ­ \\r-signoj mankus (MSDOS)\n" +"\n" +"'egrep' signifas 'grep -E'. 'fgrep' signifas 'grep -F'.\n" +"Kiam DOSIERO mankas, aÅ­ DOSIERO estas -, legi la normalan enigon. Se malpli\n" +"ol du DOSIEROj estas donitaj, supozi -h. Finvaloro estas 0, se estis trafo,\n" +"1, se ne estis, kaj 2 ĉe eraro.\n" + +#: src/grep.c:1124 +msgid "" +"\n" +"Report bugs to .\n" +msgstr "" +"\n" +"Raportu cimojn al .\n" + +#: src/grep.c:1134 +msgid "conflicting matchers specified" +msgstr "malkongruaj kompariloj estas indikitaj" + +#: src/grep.c:1376 +msgid "unknown devices method" +msgstr "nekonata metodo por specialaj dosieroj" + +#: src/grep.c:1443 +msgid "unknown directories method" +msgstr "nekonata dosieruja metodo" + +#: src/grep.c:1510 +msgid "invalid max count" +msgstr "nevalida maksimuma nombro" + +#: src/grep.c:1565 +msgid "unknown binary-files type" +msgstr "nekonata speco de binara dosiero" + +#: src/grep.c:1660 +#, c-format +msgid "%s (GNU grep) %s\n" +msgstr "%s (GNU grep) %s\n" + +#: src/grep.c:1662 +msgid "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" +msgstr "Kopirajto 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" + +#: src/grep.c:1664 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"Ĉi tiu estas libera programo; vidu la fonton por kopikondiĉoj. Estas\n" +"NENIA GARANTIO, eĉ ne pri KOMERCA KVALITO aÅ­ ADEKVATECO POR DIFINITA CELO.\n" + +#: src/search.c:606 +msgid "The -P option is not supported" +msgstr "La opcio -P ne estas disponata" + +#: src/search.c:619 +msgid "The -P and -z options cannot be combined" +msgstr "Ne eblas kombini la opciojn -P kaj -z" + +#: lib/error.c:117 +msgid "Unknown system error" +msgstr "Nekonata sistemeraro" + +#: lib/getopt.c:675 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: opcio `%s' estas plursenca\n" + +#: lib/getopt.c:700 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: opcio `--%s' ne akceptas argumenton\n" + +#: lib/getopt.c:705 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: opcio `%c%s' ne akceptas argumenton\n" + +#: lib/getopt.c:723 lib/getopt.c:896 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: opcio `%s' bezonas argumenton\n" + +#. --option +#: lib/getopt.c:752 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: nekonata opcio `--%s'\n" + +#. +option or -option +#: lib/getopt.c:756 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: nekonata opcio `%c%s'\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:782 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: malpermesata opcio -- %c\n" + +#: lib/getopt.c:785 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: nevalida opcio -- %c\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:815 lib/getopt.c:945 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: opcio bezonas argumenton -- %c\n" + +#: lib/getopt.c:862 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: opcio `-W %s' estas plursenca\n" + +#: lib/getopt.c:880 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: opcio `-W %s' ne akceptas argumenton\n" + +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#: lib/quotearg.c:259 +msgid "`" +msgstr "'" + +#: lib/quotearg.c:260 +msgid "'" +msgstr "'" diff --git a/po/es.po b/po/es.po new file mode 100644 index 0000000..a939a27 --- /dev/null +++ b/po/es.po @@ -0,0 +1,474 @@ +# Mensajes en español para GNU grep. +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +# Enrique Melero Gómez , 1996. +# Santiago Vila Doncel , 1997, 1998, 1999, 2000, 2001, 2002. +# +msgid "" +msgstr "" +"Project-Id-Version: GNU grep 2.5g\n" +"POT-Creation-Date: 2002-03-26 16:38+0100\n" +"PO-Revision-Date: 2002-03-10 13:49+0100\n" +"Last-Translator: Santiago Vila Doncel \n" +"Language-Team: Spanish \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-1\n" +"Content-Transfer-Encoding: 8-bit\n" + +#: src/dfa.c:136 src/dfa.c:147 src/dfa.c:158 src/search.c:689 +msgid "Memory exhausted" +msgstr "Memoria agotada" + +#: src/dfa.c:489 src/dfa.c:492 src/dfa.c:510 src/dfa.c:521 src/dfa.c:545 +#: src/dfa.c:604 src/dfa.c:609 src/dfa.c:622 src/dfa.c:623 src/dfa.c:1001 +#: src/dfa.c:1004 src/dfa.c:1028 src/dfa.c:1032 src/dfa.c:1033 src/dfa.c:1036 +#: src/dfa.c:1048 src/dfa.c:1049 +msgid "Unbalanced [" +msgstr "[ desemparejado" + +#: src/dfa.c:741 +msgid "Unfinished \\ escape" +msgstr "Secuencia de escape \\ sin terminar" + +#. Cases: +#. {M} - exact count +#. {M,} - minimum count, maximum is infinity +#. {M,N} - M through N +#: src/dfa.c:874 src/dfa.c:880 src/dfa.c:890 src/dfa.c:898 src/dfa.c:913 +msgid "unfinished repeat count" +msgstr "contador de repetición sin terminar" + +#: src/dfa.c:887 src/dfa.c:904 src/dfa.c:912 src/dfa.c:916 +msgid "malformed repeat count" +msgstr "contador de repetición erróneo" + +#: src/dfa.c:1253 +msgid "Unbalanced (" +msgstr "( desemparejado" + +#: src/dfa.c:1378 +msgid "No syntax specified" +msgstr "No se ha especificado ninguna sintaxis" + +#: src/dfa.c:1386 +msgid "Unbalanced )" +msgstr ") desemparejado" + +# FIXME. Comunicar al autor que esto es repetición... +#: src/dfa.c:2956 +msgid "out of memory" +msgstr "memoria agotada" + +#: src/kwset.c:171 src/kwset.c:177 src/search.c:103 src/search.c:209 +#: src/search.c:293 lib/obstack.c:471 +msgid "memory exhausted" +msgstr "memoria agotada" + +#: src/grep.c:205 +msgid "invalid context length argument" +msgstr "longitud de contexto inválida" + +#: src/grep.c:479 +msgid "input is too large to count" +msgstr "la entrada es demasiado grande para contar" + +#: src/grep.c:605 +msgid "writing output" +msgstr "escribiendo el resultado" + +#: src/grep.c:878 +#, c-format +msgid "Binary file %s matches\n" +msgstr "Coincidencia en el fichero binario %s\n" + +#: src/grep.c:892 +msgid "(standard input)" +msgstr "(entrada estándar)" + +#: src/grep.c:997 +#, c-format +msgid "warning: %s: %s\n" +msgstr "atención: %s: %s\n" + +#: src/grep.c:998 +msgid "recursive directory loop" +msgstr "bucle de directorio recursivo" + +#: src/grep.c:1046 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE]...\n" +msgstr "Modo de empleo: %s [OPCIÓN]... PATRÓN [FICHERO]...\n" + +#: src/grep.c:1048 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "Pruebe `%s --help' para más información.\n" + +# FIXME: Dice [FILE] ... en vez de [FILE]... ¿Será un error? +#: src/grep.c:1053 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE] ...\n" +msgstr "Modo de empleo: %s [OPCIÓN]... PATRÓN [FICHERO] ...\n" + +#: src/grep.c:1054 +#, c-format +msgid "" +"Search for PATTERN in each FILE or standard input.\n" +"Example: %s -i 'hello world' menu.h main.c\n" +"\n" +"Regexp selection and interpretation:\n" +msgstr "" +"Busca PATRÓN en cada FICHERO o en la entrada estándar.\n" +"Ejemplo: %s -i 'hello world' menu.h main.c\n" +"\n" +"Selección e interpretación de Expreg:\n" + +#: src/grep.c:1059 +msgid "" +" -E, --extended-regexp PATTERN is an extended regular expression\n" +" -F, --fixed-strings PATTERN is a set of newline-separated strings\n" +" -G, --basic-regexp PATTERN is a basic regular expression\n" +" -P, --perl-regexp PATTERN is a Perl regular expression\n" +msgstr "" +" -E, --extended-regexp PATRÓN es una expresión regular extendida\n" +" -F, --fixed-strings PATRÓN es un conjunto de cadenas separadas por\n" +" caracteres de nueva línea\n" +" -G, --basic-regexp PATRÓN es una expresión regular básica\n" +" -P, --perl-regexp PATRÓN es una expresión regular en Perl\n" + +#: src/grep.c:1064 +msgid "" +" -e, --regexp=PATTERN use PATTERN as a regular expression\n" +" -f, --file=FILE obtain PATTERN from FILE\n" +" -i, --ignore-case ignore case distinctions\n" +" -w, --word-regexp force PATTERN to match only whole words\n" +" -x, --line-regexp force PATTERN to match only whole lines\n" +" -z, --null-data a data line ends in 0 byte, not newline\n" +msgstr "" +" -e, --regexp=PATRÓN utiliza PATRÓN como expresión regular\n" +" -f, --file=FICHERO obtiene PATRÓN de FICHERO\n" +" -i, --ignore-case considera iguales mayúsculas y minúsculas\n" +" -w, --word-regexp obliga a que PATRÓN coincida solamente\n" +" con palabras completas\n" +" -x, --line-regexp obliga a que PATRÓN coincida solamente\n" +" con líneas completas\n" +" -z, --null-data una línea de datos termina en un byte 0, no\n" +" en un carácter de nueva línea\n" + +#: src/grep.c:1071 +msgid "" +"\n" +"Miscellaneous:\n" +" -s, --no-messages suppress error messages\n" +" -v, --invert-match select non-matching lines\n" +" -V, --version print version information and exit\n" +" --help display this help and exit\n" +" --mmap use memory-mapped input if possible\n" +msgstr "" +"\n" +"Variadas:\n" +" -s, --no-messages suprime los mensajes de error\n" +" -v, --invert-match selecciona las líneas que no coinciden\n" +" -V, --version muestra la versión y finaliza\n" +" --help muestra esta ayuda y finaliza\n" +" --mmap utiliza entrada asignada en memoria si es posible\n" + +#: src/grep.c:1079 +msgid "" +"\n" +"Output control:\n" +" -m, --max-count=NUM stop after NUM matches\n" +" -b, --byte-offset print the byte offset with output lines\n" +" -n, --line-number print line number with output lines\n" +" --line-buffered flush output on every line\n" +" -H, --with-filename print the filename for each match\n" +" -h, --no-filename suppress the prefixing filename on output\n" +" --label=LABEL print LABEL as filename for standard input\n" +" -o, --only-matching show only the part of a line matching PATTERN\n" +" -q, --quiet, --silent suppress all normal output\n" +" --binary-files=TYPE assume that binary files are TYPE\n" +" TYPE is 'binary', 'text', or 'without-match'\n" +" -a, --text equivalent to --binary-files=text\n" +" -I equivalent to --binary-files=without-match\n" +" -d, --directories=ACTION how to handle directories\n" +" ACTION is 'read', 'recurse', or 'skip'\n" +" -D, --devices=ACTION how to handle devices, FIFOs and sockets\n" +" ACTION is 'read' or 'skip'\n" +" -R, -r, --recursive equivalent to --directories=recurse\n" +" --include=PATTERN files that match PATTERN will be examined\n" +" --exclude=PATTERN files that match PATTERN will be skipped.\n" +" --exclude-from=FILE files that match PATTERN in FILE will be skipped.\n" +" -L, --files-without-match only print FILE names containing no match\n" +" -l, --files-with-matches only print FILE names containing matches\n" +" -c, --count only print a count of matching lines per FILE\n" +" -Z, --null print 0 byte after FILE name\n" +msgstr "" +"\n" +"Control del resultado:\n" +" -m, --max-count=NÚM se detiene después de NÚM coincidencias\n" +" -b, --byte-offset muestra el desplazamiento en bytes junto\n" +" con las líneas de salida\n" +" -n, --line-number muestra el número de línea junto con\n" +" las líneas de salida\n" +" --line-buffered descarga el resultado para cada línea\n" +" -H, --with-filename muestra el nombre del fichero para cada\n" +" coincidencia\n" +" -h, --no-filename suprime los nombres de los ficheros en\n" +" el resultado\n" +" --label=ETIQUETA muestra ETIQUETA como nombre de fichero para la\n" +" entrada estándar\n" +" -o, --only-matching muestra solamente la parte de una línea que\n" +" encaja con PATRÓN\n" +" -q, --quiet, --silent suprime todo el resultado normal\n" +" --binary-files=TIPO supone que los ficheros binarios son TIPO\n" +" TIPO es `binary', `text', o `without-match'\n" +" -a, --text equivalente a --binary-files=text\n" +" -I equivalente a --binary-files=without-match\n" +" -d, --directories=ACCIÓN especifica cómo manejar los directorios\n" +" ACCIÓN es 'read', 'recurse', o 'skip'\n" +" -D, --devices=ACCIÓN especifica cómo manejar dispositivos, FIFOs y\n" +" `sockets', puede ser 'read' o 'skip'\n" +" -R, -r, --recursive equivalente a --directories=recurse\n" +" --include=PATRÓN examina los ficheros que encajan con PATRÓN\n" +" --exclude=PATRÓN se salta los ficheros que encajan con PATRÓN\n" +" --exclude-from=FICHERO se salta los ficheros que encajan con los patrones\n" +" de FICHERO\n" +" -L, --files-without-match muestra solamente los nombres de FICHEROs\n" +" que no contienen ninguna coincidencia\n" +" -l, --files-with-matches muestra solamente los nombres de FICHEROs\n" +" que contienen alguna coincidencia\n" +" -c, --count muestra solamente el total de líneas que coinciden\n" +" por cada FICHERO\n" +" -Z, --null imprime un byte 0 después del nombre del FICHERO\n" + +#: src/grep.c:1107 +msgid "" +"\n" +"Context control:\n" +" -B, --before-context=NUM print NUM lines of leading context\n" +" -A, --after-context=NUM print NUM lines of trailing context\n" +" -C, --context=NUM print NUM lines of output context\n" +" -NUM same as --context=NUM\n" +" --color[=WHEN],\n" +" --colour[=WHEN] use markers to distinguish the matching string\n" +" WHEN may be `always', `never' or `auto'.\n" +" -U, --binary do not strip CR characters at EOL (MSDOS)\n" +" -u, --unix-byte-offsets report offsets as if CRs were not there (MSDOS)\n" +"\n" +"`egrep' means `grep -E'. `fgrep' means `grep -F'.\n" +"With no FILE, or when FILE is -, read standard input. If less than\n" +"two FILEs given, assume -h. Exit status is 0 if match, 1 if no match,\n" +"and 2 if trouble.\n" +msgstr "" +"\n" +"Control del contexto:\n" +" -B, --before-context=NÚM muestra NÚM líneas de contexto anterior\n" +" -A, --after-context=NÚM muestra NÚM líneas de contexto posterior\n" +" -C, --context=NÚM muestra NÚM líneas de contexto\n" +" -NÚM lo mismo que --context=NÚM\n" +" --color[=CUÁNDO],\n" +" --colour[=CUÁNDO] distingue con marcadores la cadena que encaja\n" +" CUÁNDO puede ser `always', `never' o `auto'.\n" +" -U, --binary no elimina los caracteres de retorno de carro\n" +" finales de línea (MSDOS)\n" +" -u, --unix-byte-offsets cuenta los desplazamientos como si no hubiera\n" +" retornos de carro (MSDOS)\n" +"\n" +"`egrep' significa `grep -E'. `fgrep' significa `grep -F'.\n" +"Si no se especifica ningún FICHERO, o cuando es -, lee la entrada estándar.\n" +"Si se dan menos de dos FICHEROs, se supone -h. La salida es 0 si hay\n" +"coincidencias, 1 si no las hay, y 2 en caso de problema\n" + +#: src/grep.c:1124 +#, fuzzy +msgid "" +"\n" +"Report bugs to .\n" +msgstr "" +"\n" +"Comunicar bichos a .\n" + +# viendo los fuentes , hay varias opciones +# que hay sin documentar. O quizá es que getopt() lo he entendido mal +# Son las opciones X ( requiere argumento ) , switchs -c, -b, -L e -y +# grep.c:622 -> +# opt = getopt(argc, argv, "0123456789A:B:CEFGVX:bce:f:hiLlnqsvwxy" +# grep --help -> +# usage: grep [-[[AB] ]] [-[CEFGVchilnqsvwx]] [-[ef]] [] +# La opción -X es a la que corresponde esta línea. +# +# No me gusta nada lo de opción "a buscar". +# Se admiten sugerencias. sv +#: src/grep.c:1134 +msgid "conflicting matchers specified" +msgstr "se han especificado expresiones conflictivas" + +#: src/grep.c:1376 +msgid "unknown devices method" +msgstr "método de dispositivos desconocido" + +# Nota: Se refiere a la opción --directories=ACCIÓN cuando ACCIÓN +# no es `read', `recurse' o `skip'. +#: src/grep.c:1443 +msgid "unknown directories method" +msgstr "método de directorios desconocido" + +#: src/grep.c:1510 +msgid "invalid max count" +msgstr "contador máximo inválido" + +#: src/grep.c:1565 +msgid "unknown binary-files type" +msgstr "tipo binary-files desconocido" + +#: src/grep.c:1660 +#, c-format +msgid "%s (GNU grep) %s\n" +msgstr "%s (GNU grep) %s\n" + +#: src/grep.c:1662 +msgid "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" +msgstr "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" + +#: src/grep.c:1664 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"Esto es software libre; vea el código fuente para las condiciones de copia.\n" +"No hay NINGUNA garantía; ni siquiera de COMERCIABILIDAD o IDONEIDAD PARA UN\n" +"FIN DETERMINADO.\n" + +#: src/search.c:606 +msgid "The -P option is not supported" +msgstr "La opción -P no está admitida" + +#: src/search.c:619 +msgid "The -P and -z options cannot be combined" +msgstr "Las opciones -P y -z no se pueden combinar" + +#: lib/error.c:117 +msgid "Unknown system error" +msgstr "Error del sistema desconocido" + +#: lib/getopt.c:675 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: la opción `%s' es ambigua\n" + +#: lib/getopt.c:700 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: la opción `--%s' no admite ningún argumento\n" + +#: lib/getopt.c:705 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: la opción `%c%s' no admite ningún argumento\n" + +#: lib/getopt.c:723 lib/getopt.c:896 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: la opción `%s' requiere un argumento\n" + +#. --option +#: lib/getopt.c:752 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: opción no reconocida `--%s'\n" + +#. +option or -option +#: lib/getopt.c:756 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: opción no reconocida `%c%s'\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:782 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: opción ilegal -- %c\n" + +#: lib/getopt.c:785 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: opción inválida -- %c\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:815 lib/getopt.c:945 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: la opción requiere un argumento -- %c\n" + +#: lib/getopt.c:862 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: la opción `-W %s' es ambigua\n" + +#: lib/getopt.c:880 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: la opción `-W %s' no admite ningún argumento\n" + +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#: lib/quotearg.c:259 +msgid "`" +msgstr "`" + +#: lib/quotearg.c:260 +msgid "'" +msgstr "'" + +#~ msgid "option %s" +#~ msgstr "opción %s" + +#~ msgid " with arg %s" +#~ msgstr " con argumento %s" + +#~ msgid "digits occur in two different argv-elements.\n" +#~ msgstr "aparecen dígitos en dos elementos de argv diferentes.\n" + +#~ msgid "option %c\n" +#~ msgstr "opción %c\n" + +#~ msgid "option a\n" +#~ msgstr "opción a\n" + +#~ msgid "option b\n" +#~ msgstr "opción b\n" + +#~ msgid "option c with value `%s'\n" +#~ msgstr "la opción c tiene el valor `%s'\n" + +#~ msgid "option d with value `%s'\n" +#~ msgstr "la opción d tiene el valor `%s'\n" + +#~ msgid "?? getopt returned character code 0%o ??\n" +#~ msgstr "?? getopt ha devuelto el carácter código 0%o ??\n" + +#~ msgid "non-option ARGV-elements: " +#~ msgstr "elementos de ARGV que no son opciones: " + +#~ msgid "you may specify only one of -E, -F, or -G" +#~ msgstr "sólo se puede especificar una de las opciones -E, -F, o -G" + +# Prefiero dejarlo en solamente un patrón +# Pero entonces no queda claro que *debe haber uno*, y parece que +# es uno como máximo (siendo el mínimo 0). sv +#~ msgid "There should be one and only one PATTERN, `-e PATTERN' or `-f FILE'.\n" +#~ msgstr "Debe haber un y solamente un PATRÓN, `-e PATRÓN', o `-f FICHERO'.\n" + +#~ msgid "If no -[GEF], then -G is assumed.\n" +#~ msgstr "Si no se especifica ninguna de las opciones -[GEF], se supone -G.\n" diff --git a/po/et.po b/po/et.po new file mode 100644 index 0000000..af0ae56 --- /dev/null +++ b/po/et.po @@ -0,0 +1,399 @@ +# Estonian translations for grep +# Copyright (C) 2000 Free Software Foundation, Inc. +# Toomas Soome , 2005. +# +msgid "" +msgstr "" +"Project-Id-Version: grep 2.5.1a\n" +"POT-Creation-Date: 2002-03-26 16:38+0100\n" +"PO-Revision-Date: 2005-03-04 09:08+0200\n" +"Last-Translator: Toomas Soome \n" +"Language-Team: Estonian \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=iso-8859-15\n" +"Content-Transfer-Encoding: 8-bit\n" + +#: src/dfa.c:136 src/dfa.c:147 src/dfa.c:158 src/search.c:689 +msgid "Memory exhausted" +msgstr "Mälu on otsas" + +#: src/dfa.c:489 src/dfa.c:492 src/dfa.c:510 src/dfa.c:521 src/dfa.c:545 +#: src/dfa.c:604 src/dfa.c:609 src/dfa.c:622 src/dfa.c:623 src/dfa.c:1001 +#: src/dfa.c:1004 src/dfa.c:1028 src/dfa.c:1032 src/dfa.c:1033 src/dfa.c:1036 +#: src/dfa.c:1048 src/dfa.c:1049 +msgid "Unbalanced [" +msgstr "Balanseerimata [" + +#: src/dfa.c:741 +msgid "Unfinished \\ escape" +msgstr "Lõpetamata \\ paojada" + +#. Cases: +#. {M} - exact count +#. {M,} - minimum count, maximum is infinity +#. {M,N} - M through N +#: src/dfa.c:874 src/dfa.c:880 src/dfa.c:890 src/dfa.c:898 src/dfa.c:913 +msgid "unfinished repeat count" +msgstr "lõpetamata korduste arv" + +#: src/dfa.c:887 src/dfa.c:904 src/dfa.c:912 src/dfa.c:916 +msgid "malformed repeat count" +msgstr "vigane korduste arv" + +#: src/dfa.c:1253 +msgid "Unbalanced (" +msgstr "Balanseerimata (" + +#: src/dfa.c:1378 +msgid "No syntax specified" +msgstr "Süntaksit pole määratud" + +#: src/dfa.c:1386 +msgid "Unbalanced )" +msgstr "Balanseerimata )" + +#: src/dfa.c:2956 +msgid "out of memory" +msgstr "mälu on otsas" + +#: src/kwset.c:171 src/kwset.c:177 src/search.c:103 src/search.c:209 +#: src/search.c:293 lib/obstack.c:471 +msgid "memory exhausted" +msgstr "mälu on otsas" + +#: src/grep.c:205 +msgid "invalid context length argument" +msgstr "vigane konteksti pikkuse argument" + +#: src/grep.c:479 +msgid "input is too large to count" +msgstr "sisend on loendamiseks liiga suur" + +#: src/grep.c:605 +msgid "writing output" +msgstr "kirjutan väljundit" + +#: src/grep.c:878 +#, c-format +msgid "Binary file %s matches\n" +msgstr "Kahendfail %s sobib\n" + +#: src/grep.c:892 +msgid "(standard input)" +msgstr "(standardsisend)" + +#: src/grep.c:997 +#, c-format +msgid "warning: %s: %s\n" +msgstr "hoiatus: %s: %s\n" + +#: src/grep.c:998 +msgid "recursive directory loop" +msgstr "rekursiivne kataloogipuu tsükkel" + +#: src/grep.c:1046 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE]...\n" +msgstr "Kasuta: %s [VÕTI]... MUSTER [FAIL] ...\n" + +#: src/grep.c:1048 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "Lisainfo saamiseks proovige võtit `%s --help'.\n" + +#: src/grep.c:1053 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE] ...\n" +msgstr "Kasuta: %s [VÕTI]... MUSTER [FAIL] ...\n" + +#: src/grep.c:1054 +#, c-format +msgid "" +"Search for PATTERN in each FILE or standard input.\n" +"Example: %s -i 'hello world' menu.h main.c\n" +"\n" +"Regexp selection and interpretation:\n" +msgstr "" +"Otsi MUSTRIT igast FAIList või standardsisendist.\n" +"Näiteks: %s -i 'tere kõik' menu.h main.c\n" +"\n" +"Regulaaravaldise valik ja interpreteerimine:\n" + +#: src/grep.c:1059 +msgid "" +" -E, --extended-regexp PATTERN is an extended regular expression\n" +" -F, --fixed-strings PATTERN is a set of newline-separated strings\n" +" -G, --basic-regexp PATTERN is a basic regular expression\n" +" -P, --perl-regexp PATTERN is a Perl regular expression\n" +msgstr "" +" -E, --extended-regexp MUSTER on laiendatud regulaaravaldis\n" +" -F, --fixed-strings MUSTER on hulk reavahetustega eraldatud sõnesid\n" +" -G, --basic-regexp MUSTER on lihtne regulaaravaldis\n" +" -P, --perl-regexp MUSTER on Perl regulaaravaldis\n" + +#: src/grep.c:1064 +msgid "" +" -e, --regexp=PATTERN use PATTERN as a regular expression\n" +" -f, --file=FILE obtain PATTERN from FILE\n" +" -i, --ignore-case ignore case distinctions\n" +" -w, --word-regexp force PATTERN to match only whole words\n" +" -x, --line-regexp force PATTERN to match only whole lines\n" +" -z, --null-data a data line ends in 0 byte, not newline\n" +msgstr "" +" -e, --regexp=MUSTER kasuta regulaaravaldisena\n" +" -f, --file=FAIL loe MUSTER failist FAIL\n" +" -i, --ignore-case ignoreeri suur- ja väiketähtede erinevusi\n" +" -w, --word-regexp kasuta MUSTRIT sõnade leidmiseks\n" +" -x, --line-regexp kasuta MUSTRIT ridade leidmiseks\n" +" -z, --null-data andmerida lõppeb baidil 0, mitte reavahetusel\n" + +#: src/grep.c:1071 +msgid "" +"\n" +"Miscellaneous:\n" +" -s, --no-messages suppress error messages\n" +" -v, --invert-match select non-matching lines\n" +" -V, --version print version information and exit\n" +" --help display this help and exit\n" +" --mmap use memory-mapped input if possible\n" +msgstr "" +"\n" +"Muud:\n" +" -s, --no-messages blokeeri veateated\n" +" -v, --invert-match vali mitte-sobivad read\n" +" -V, --version esita versiooniinfo ja lõpeta töö\n" +" --help esita see abiinfo ja lõpeta töö\n" +" --mmap kasuta kui võimalik sisendi mällu laadimist\n" + +#: src/grep.c:1079 +msgid "" +"\n" +"Output control:\n" +" -m, --max-count=NUM stop after NUM matches\n" +" -b, --byte-offset print the byte offset with output lines\n" +" -n, --line-number print line number with output lines\n" +" --line-buffered flush output on every line\n" +" -H, --with-filename print the filename for each match\n" +" -h, --no-filename suppress the prefixing filename on output\n" +" --label=LABEL print LABEL as filename for standard input\n" +" -o, --only-matching show only the part of a line matching PATTERN\n" +" -q, --quiet, --silent suppress all normal output\n" +" --binary-files=TYPE assume that binary files are TYPE\n" +" TYPE is 'binary', 'text', or 'without-match'\n" +" -a, --text equivalent to --binary-files=text\n" +" -I equivalent to --binary-files=without-match\n" +" -d, --directories=ACTION how to handle directories\n" +" ACTION is 'read', 'recurse', or 'skip'\n" +" -D, --devices=ACTION how to handle devices, FIFOs and sockets\n" +" ACTION is 'read' or 'skip'\n" +" -R, -r, --recursive equivalent to --directories=recurse\n" +" --include=PATTERN files that match PATTERN will be examined\n" +" --exclude=PATTERN files that match PATTERN will be skipped.\n" +" --exclude-from=FILE files that match PATTERN in FILE will be skipped.\n" +" -L, --files-without-match only print FILE names containing no match\n" +" -l, --files-with-matches only print FILE names containing matches\n" +" -c, --count only print a count of matching lines per FILE\n" +" -Z, --null print 0 byte after FILE name\n" +msgstr "" +"\n" +"Väljundi kontroll:\n" +" -m, --max-count=NUM lõpeta peale NUM leidu\n" +" -b, --byte-offset trüki baidi aadress väljundreale\n" +" -n, --line-number trüki rea number väljundreale\n" +" --line-buffered väljasta käik peale iga rida\n" +" -H, --with-filename trüki iga leiu failinimi\n" +" -h, --no-filename keela väljundis prefiks failinimi\n" +" -q, --quiet, --silent keela kogu tavapärane väljund\n" +" --binary-files=TÜÜP eeldab kahendfailide TÜÜPi\n" +" TÜÜP on 'binary', 'text' või 'without-match'\n" +" -a, --text sama, kui --binary-files=text\n" +" -I sama, kui --binary-files=without-match\n" +" -d, --directories=TEGEVUS kuidas käsitleda katalooge\n" +" TEGEVUS on 'read', 'recurse' või 'skip'\n" +" -D, --devices=TEGEVUS kuidas käsitleda seadmeid, FIFO ja pistik faile\n" +" TEGEVUS on 'read' või 'skip'\n" +" -R, -r, --recursive sama, kui --directories=recurse\n" +" --include=MUSTER vaadeldakse mustrile MUSTER vastavaid faile\n" +" --exclude=MUSTER mustrile MUSTER vastavad failid jäetakse vahele\n" +" --exclude-from=FAIL mustrile failist FAIL vastavad failid\n" +" jäetakse vahele\n" +" -L, --files-without-match trüki ainult failinimed, kus mustrit ei leitud\n" +" -l, --files-with-matches trüki ainult failinimed, kus muster leiti\n" +" -c, --count trüki ainult leitud ridade arv faili kaupa\n" +" -Z, --null trüki peale filinime bait 0\n" + +#: src/grep.c:1107 +msgid "" +"\n" +"Context control:\n" +" -B, --before-context=NUM print NUM lines of leading context\n" +" -A, --after-context=NUM print NUM lines of trailing context\n" +" -C, --context=NUM print NUM lines of output context\n" +" -NUM same as --context=NUM\n" +" --color[=WHEN],\n" +" --colour[=WHEN] use markers to distinguish the matching string\n" +" WHEN may be `always', `never' or `auto'.\n" +" -U, --binary do not strip CR characters at EOL (MSDOS)\n" +" -u, --unix-byte-offsets report offsets as if CRs were not there (MSDOS)\n" +"\n" +"`egrep' means `grep -E'. `fgrep' means `grep -F'.\n" +"With no FILE, or when FILE is -, read standard input. If less than\n" +"two FILEs given, assume -h. Exit status is 0 if match, 1 if no match,\n" +"and 2 if trouble.\n" +msgstr "" +"\n" +"Konteksti kontroll:\n" +" -B, --before-context=NUM trüki NUM rida eelnevat konteksti\n" +" -A, --after-context=NUM trüki NUM rida järgnevat konteksti\n" +" -C, --context[=NUM] trüki NUM rida väljund konteksti\n" +" -NUM sama, kui --context=NUM\n" +" --color[=MILLAL],\n" +" --colour[=MILLAL] kasuta otsitava sõne eristamiseks markereid\n" +" MILLAL võib olla `always', `never' või `auto'.\n" +" -U, --binary ära eemalda rea lõpust CR sümboleid (MSDOS)\n" +" -u, --unix-byte-offsets teata aadressid CR sümboleid arvestamata (MSDOS)\n" +"\n" +"`egrep' tähendab `grep -E'. `fgrep' tähendab `grep -F'.\n" +"Kui FAIL pole antud või kui FAIL väärtus on -, loeb standardsisendit. Kui on\n" +"antud vähem kui kaks faili, eeldatakse võtit -h. Kui muster leitakse,\n" +"lõpetab programm töö koodiga 0, kui ei leita, siis koodiga 1 ja\n" +"kui oli mingi muu probleem, siis koodiga 2.\n" + +#: src/grep.c:1124 +msgid "" +"\n" +"Report bugs to .\n" +msgstr "" +"\n" +"Teatage palun vigadest aadressil .\n" + +#: src/grep.c:1134 +msgid "conflicting matchers specified" +msgstr "määrati konfliktsed otsijad" + +#: src/grep.c:1376 +msgid "unknown devices method" +msgstr "tundmatu seadmete meetod" + +#: src/grep.c:1443 +msgid "unknown directories method" +msgstr "tundmatu kataloogide meetod" + +#: src/grep.c:1510 +msgid "invalid max count" +msgstr "vigane maksimum" + +#: src/grep.c:1565 +msgid "unknown binary-files type" +msgstr "tundmatu kahendfailide tüüp" + +#: src/grep.c:1660 +#, c-format +msgid "%s (GNU grep) %s\n" +msgstr "%s (GNU grep) %s\n" + +#: src/grep.c:1662 +msgid "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" +msgstr "Autoriõigus 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" + +#: src/grep.c:1664 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"See on vaba tarkvara; kopeerimistingimused leiate lähtetekstidest. Garantii\n" +"PUUDUB; ka müügiks või mingil eesmärgil kasutamiseks, vastavalt seadustega\n" +"lubatud piiridele.\n" + +#: src/search.c:606 +msgid "The -P option is not supported" +msgstr "Võtit -P ei toetata" + +#: src/search.c:619 +msgid "The -P and -z options cannot be combined" +msgstr "Võtmeid -P ja -z ei saa koos kasutada" + +#: lib/error.c:117 +msgid "Unknown system error" +msgstr "Tundmatu süsteemi viga" + +#: lib/getopt.c:675 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: võti `%s' on segane\n" + +#: lib/getopt.c:700 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: võti `--%s' ei luba argumenti\n" + +#: lib/getopt.c:705 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: võti `%c%s' ei luba argumenti\n" + +#: lib/getopt.c:723 lib/getopt.c:896 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: võti `%s' nõuab argumenti\n" + +#. --option +#: lib/getopt.c:752 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: tundmatu võti `--%s'\n" + +#. +option or -option +#: lib/getopt.c:756 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: tundmatu võti `%c%s'\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:782 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: lubamatu võti -- %c\n" + +#: lib/getopt.c:785 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: vigane võti -- %c\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:815 lib/getopt.c:945 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: võti nõuab argumenti -- %c\n" + +#: lib/getopt.c:862 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: võti `-W %s' on segane\n" + +#: lib/getopt.c:880 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: võti `-W %s' ei luba argumenti\n" + +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#: lib/quotearg.c:259 +msgid "`" +msgstr "`" + +#: lib/quotearg.c:260 +msgid "'" +msgstr "'" diff --git a/po/eu.po b/po/eu.po new file mode 100644 index 0000000..848081a --- /dev/null +++ b/po/eu.po @@ -0,0 +1,402 @@ +# Basque translation of grep. +# Copyright (C) 2004 Free Software Foundation, Inc. +# Mikel Olasagasti , 2004, 2005. +# , fuzzy +# +# +msgid "" +msgstr "" +"Project-Id-Version: grep 2.5.1a\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2002-03-26 16:38+0100\n" +"PO-Revision-Date: 2005-03-03 21:40+0100\n" +"Last-Translator: Mikel Olasagasti \n" +"Language-Team: Basque \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n == 1)\n" + +#: src/dfa.c:136 src/dfa.c:147 src/dfa.c:158 src/search.c:689 +msgid "Memory exhausted" +msgstr "Memoria agortuta" + +#: src/dfa.c:489 src/dfa.c:492 src/dfa.c:510 src/dfa.c:521 src/dfa.c:545 +#: src/dfa.c:604 src/dfa.c:609 src/dfa.c:622 src/dfa.c:623 src/dfa.c:1001 +#: src/dfa.c:1004 src/dfa.c:1028 src/dfa.c:1032 src/dfa.c:1033 src/dfa.c:1036 +#: src/dfa.c:1048 src/dfa.c:1049 +msgid "Unbalanced [" +msgstr "Parekatu gabeko [" + +#: src/dfa.c:741 +msgid "Unfinished \\ escape" +msgstr "Amaitu gabeko \\ eskapea" + +#. Cases: +#. {M} - exact count +#. {M,} - minimum count, maximum is infinity +#. {M,N} - M through N +#: src/dfa.c:874 src/dfa.c:880 src/dfa.c:890 src/dfa.c:898 src/dfa.c:913 +msgid "unfinished repeat count" +msgstr "amaitu gabeko errepikapen zenbatzailea" + +#: src/dfa.c:887 src/dfa.c:904 src/dfa.c:912 src/dfa.c:916 +msgid "malformed repeat count" +msgstr "gaizki eratutako errepikapen zenbatzailea" + +#: src/dfa.c:1253 +msgid "Unbalanced (" +msgstr "Parekatu gabeko (" + +#: src/dfa.c:1378 +msgid "No syntax specified" +msgstr "Ez da sintaxirik zehaztu" + +#: src/dfa.c:1386 +msgid "Unbalanced )" +msgstr "Parekatu gabeko )" + +#: src/dfa.c:2956 +msgid "out of memory" +msgstr "memoriatik kanpo" + +#: src/kwset.c:171 src/kwset.c:177 src/search.c:103 src/search.c:209 +#: src/search.c:293 lib/obstack.c:471 +msgid "memory exhausted" +msgstr "memoria agortuta" + +#: src/grep.c:205 +msgid "invalid context length argument" +msgstr "balio gabeko testuinguru luzeera argumentua" + +#: src/grep.c:479 +msgid "input is too large to count" +msgstr "sarrera luzeegia da kontatzeko" + +#: src/grep.c:605 +msgid "writing output" +msgstr "irteera idazten" + +#: src/grep.c:878 +#, c-format +msgid "Binary file %s matches\n" +msgstr "%s fitxategi binarioa bat dator\n" + +#: src/grep.c:892 +msgid "(standard input)" +msgstr "(sarrera estandarra)" + +#: src/grep.c:997 +#, c-format +msgid "warning: %s: %s\n" +msgstr "abisua: %s: %s\n" + +#: src/grep.c:998 +msgid "recursive directory loop" +msgstr "direktorio bukle errekurtsiboa" + +#: src/grep.c:1046 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE]...\n" +msgstr "Erabilera: %s [AUKERA]... EREDUA [FITXATEGIA]...\n" + +#: src/grep.c:1048 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "Saiatu `%s --help' informazio gehiagorako.\n" + +#: src/grep.c:1053 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE] ...\n" +msgstr "Erabilera: %s [AUKERA]... EREDUA [FITXATEGIA] ...\n" + +#: src/grep.c:1054 +#, c-format +msgid "" +"Search for PATTERN in each FILE or standard input.\n" +"Example: %s -i 'hello world' menu.h main.c\n" +"\n" +"Regexp selection and interpretation:\n" +msgstr "" +"EREDUA bilatzen du FITXATEGI bakoitzean edo sarrera estandarrean.\n" +"Adibidez: %s -i 'kaixo mundu' menu.h main.c\n" +"\n" +"Regexp aukera eta interpretazioa:\n" + +#: src/grep.c:1059 +msgid "" +" -E, --extended-regexp PATTERN is an extended regular expression\n" +" -F, --fixed-strings PATTERN is a set of newline-separated strings\n" +" -G, --basic-regexp PATTERN is a basic regular expression\n" +" -P, --perl-regexp PATTERN is a Perl regular expression\n" +msgstr "" +" -E, --extended-regexp EREDUA espresio erregular zabaldu bat da\n" +" -F, --fixed-strings EREDUA lerro berri batekin banatutako kate multzo bat da\n" +" -G, --basic-regexp EREDUA oinarrizko espresio erregular bat da\n" +" -P, --perl-regexp EREDUA Perl espresio erregular bat da\n" + +#: src/grep.c:1064 +msgid "" +" -e, --regexp=PATTERN use PATTERN as a regular expression\n" +" -f, --file=FILE obtain PATTERN from FILE\n" +" -i, --ignore-case ignore case distinctions\n" +" -w, --word-regexp force PATTERN to match only whole words\n" +" -x, --line-regexp force PATTERN to match only whole lines\n" +" -z, --null-data a data line ends in 0 byte, not newline\n" +msgstr "" +" -e, --regexp=EREDUA erabili EREDUA espresio erregular bezala\n" +" -f, --file=FITXATEGIA lortu EREDUA FITXATEGITIK\n" +" -i, --ignore-case ez ezberdindu letra larri eta xeheak\n" +" -w, --word-regexp behartu EREDUA hitz osoekin bakarrik bat etortzea\n" +" -x, --line-regexp behartu EREDUA lerro osoekin bakarrik bat etortzea\n" +" -z, --null-data datu lerroa 0 byte-arekin amaitzen da, eta ez lerro berriarekin\n" + +#: src/grep.c:1071 +msgid "" +"\n" +"Miscellaneous:\n" +" -s, --no-messages suppress error messages\n" +" -v, --invert-match select non-matching lines\n" +" -V, --version print version information and exit\n" +" --help display this help and exit\n" +" --mmap use memory-mapped input if possible\n" +msgstr "" +"\n" +"Hainbat:\n" +" -s, --no-messages errore mezuak kentzen ditu\n" +" -v, --invert-match bat ez datozen lerroak aukeratzen ditu\n" +" -V, --version bertsioaren informazioa inprimatu eta irten\n" +" --help laguntza hau erakutsi eta irten\n" +" --mmap erabili asignatutako memoria sarrera posible bada\n" + +#: src/grep.c:1079 +msgid "" +"\n" +"Output control:\n" +" -m, --max-count=NUM stop after NUM matches\n" +" -b, --byte-offset print the byte offset with output lines\n" +" -n, --line-number print line number with output lines\n" +" --line-buffered flush output on every line\n" +" -H, --with-filename print the filename for each match\n" +" -h, --no-filename suppress the prefixing filename on output\n" +" --label=LABEL print LABEL as filename for standard input\n" +" -o, --only-matching show only the part of a line matching PATTERN\n" +" -q, --quiet, --silent suppress all normal output\n" +" --binary-files=TYPE assume that binary files are TYPE\n" +" TYPE is 'binary', 'text', or 'without-match'\n" +" -a, --text equivalent to --binary-files=text\n" +" -I equivalent to --binary-files=without-match\n" +" -d, --directories=ACTION how to handle directories\n" +" ACTION is 'read', 'recurse', or 'skip'\n" +" -D, --devices=ACTION how to handle devices, FIFOs and sockets\n" +" ACTION is 'read' or 'skip'\n" +" -R, -r, --recursive equivalent to --directories=recurse\n" +" --include=PATTERN files that match PATTERN will be examined\n" +" --exclude=PATTERN files that match PATTERN will be skipped.\n" +" --exclude-from=FILE files that match PATTERN in FILE will be skipped.\n" +" -L, --files-without-match only print FILE names containing no match\n" +" -l, --files-with-matches only print FILE names containing matches\n" +" -c, --count only print a count of matching lines per FILE\n" +" -Z, --null print 0 byte after FILE name\n" +msgstr "" +"\n" +"Irteera kontrola:\n" +" -m, --max-count=KOPURUA gelditu KOPURUA bilatzean\n" +" -b, --byte-offset inprimatu offset byte-a lerro irteerekin\n" +" -n, --line-number inprimatu lerro zenbakia lerro irteerekin\n" +" --line-buffered irauli irteera lerro bakoitzean\n" +" -H, --with-filename inprimatu fitxategi-izena bat datorren aurkiketa bakoitzean\n" +" -h, --no-filename fitxategi-izena kendu irteeran\n" +" --label=ETIKETA inprimatu ETIKETA fitxategi-izen bezala sarrera estandarrean\n" +" -o, --only-matching erakutsi EREDUAREKIN bat datorren lerroaren zatia bakarrik\n" +" -q, --quiet, --silent kendu irteera normal guztiak\n" +" --binary-files=MOETA fitxategi binarioak MOETA bezala direlakoan hartu\n" +" MOETA 'binary', 'text', edo 'without-match' izan daiteke\n" +" -a, --text --binary-files=text bezala\n" +" -I --binary-files=without-match bezala\n" +" -d, --directories=EKINTZA nola erabili direktorioak\n" +" EKINTZA 'read', 'recurse', edo 'skip' izan daiteke\n" +" -D, --devices=EKINTZA nola erabili gailuak, FIFO eta socketak\n" +" EKINTZA 'read' edo 'skip' izan daiteke\n" +" -R, -r, --recursive --directories=recurse bezala\n" +" --include=EREDUA EREDUAREKIN bat datozen fitxategiak aztertu\n" +" --exclude=EREDUA EREDUAREKIN bat datozen fitxategiak utzi.\n" +" --exclude-from=FITXATEGIA EREDUA betetzen duten fitxategiak FITXATEGIAN utzi.\n" +" -L, --files-without-match inprimatu bateraketarik ez duten FITXATEGIAK bakarrik\n" +" -l, --files-with-matches inprimatu bateraketaren bat duten FITXATEGIAK bakarrik\n" +" -c, --count inprimatu bateraketa kopurua FITXATEGI bakoitzeko bakarrik\n" +" -Z, --null inprimatu 0 byte-a FITXATEGIAREN izenaren ondoren\n" + +#: src/grep.c:1107 +msgid "" +"\n" +"Context control:\n" +" -B, --before-context=NUM print NUM lines of leading context\n" +" -A, --after-context=NUM print NUM lines of trailing context\n" +" -C, --context=NUM print NUM lines of output context\n" +" -NUM same as --context=NUM\n" +" --color[=WHEN],\n" +" --colour[=WHEN] use markers to distinguish the matching string\n" +" WHEN may be `always', `never' or `auto'.\n" +" -U, --binary do not strip CR characters at EOL (MSDOS)\n" +" -u, --unix-byte-offsets report offsets as if CRs were not there (MSDOS)\n" +"\n" +"`egrep' means `grep -E'. `fgrep' means `grep -F'.\n" +"With no FILE, or when FILE is -, read standard input. If less than\n" +"two FILEs given, assume -h. Exit status is 0 if match, 1 if no match,\n" +"and 2 if trouble.\n" +msgstr "" +"\n" +"Kontestu kontrola:\n" +" -B, --before-context=KOPURUA inprimatu kontestuaren aurretiko lerro KOPURUA\n" +" -A, --after-context=KOPURUA inprimatu kontestuaren ondorengo lerro KOPURUA\n" +" -C, --context=KOPURUA inprimatu kontestuaren lerro KOPURUA\n" +" -KOPURUA --context=KOPURUA bezala\n" +" --color[=NOIZ],\n" +" --colour[=NOIZ] erabili markak bat datozen kateak ezberdintzeko\n" +" NOIZ `always', `never' edo `auto' izan daiteke.\n" +" -U, --binary ez kendu CR karaktereak lerro bukaeran (MSDOS)\n" +" -u, --unix-byte-offsets hartu kontutan offsetak CRak bertan egongo ez balira bezala (MSDOS)\n" +"\n" +"`egrep'-ek`grep -E' esan nahi du. `fgrep'-ek `grep -F' esan nahi du.\n" +"Fitxategirik gabe, edo FITXATEGIA - denean, sarrera estandarra irakurtzen da. BI fitxategi\n" +"baina gutxiago ematen badira, -h ulertzen da. Irteera egoera 0 da bat badator, 1 ez badator,\n" +"eta 2 arazorik badago.\n" + +#: src/grep.c:1124 +msgid "" +"\n" +"Report bugs to .\n" +msgstr "" +"\n" +"Programa-erroreen berri emateko idatzi hona .\n" + +#: src/grep.c:1134 +msgid "conflicting matchers specified" +msgstr "espresio konfliktiboak espezifikatu dira" + +#: src/grep.c:1376 +msgid "unknown devices method" +msgstr "gailu metodo ezezaguna" + +#: src/grep.c:1443 +msgid "unknown directories method" +msgstr "direktorio metodo ezezaguna" + +#: src/grep.c:1510 +msgid "invalid max count" +msgstr "baliogabeko gehienezko zenbaketa" + +#: src/grep.c:1565 +msgid "unknown binary-files type" +msgstr "fitxategi-binario moeta ezezaguna" + +#: src/grep.c:1660 +#, c-format +msgid "%s (GNU grep) %s\n" +msgstr "%s (GNU grep) %s\n" + +#: src/grep.c:1662 +msgid "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" +msgstr "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" + +#: src/grep.c:1664 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"Software librea da, ikusi programa-kodea kopiatzeko baldintzentzat. EZ dago inolako bermerik;\n" +"ez KOMERTZIO ez ASMO ZEHATZ BATEN EGOKITASUNERAKO.\n" + +#: src/search.c:606 +msgid "The -P option is not supported" +msgstr "-P aukerak ez du euskarririk" + +#: src/search.c:619 +msgid "The -P and -z options cannot be combined" +msgstr "-P eta -z aukerak ezin dira konbinatu" + +#: lib/error.c:117 +msgid "Unknown system error" +msgstr "Sistemaren errore ezezaguna" + +#: lib/getopt.c:675 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: `%s' aukera anbiguoa da\n" + +#: lib/getopt.c:700 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: `--%s' aukerak ez du argumenturik onartzen\n" + +#: lib/getopt.c:705 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: `%c%s' aukerak ez du argumenturik onartzen\n" + +#: lib/getopt.c:723 lib/getopt.c:896 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: `%s' aukerak argumentu bat behar du\n" + +#. --option +#: lib/getopt.c:752 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: aukera ezezaguna `--%s'\n" + +#. +option or -option +#: lib/getopt.c:756 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: aukera ezezaguna `%c%s'\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:782 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: ezinezko aukera -- %c\n" + +#: lib/getopt.c:785 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: balio gabeko aukera -- %c\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:815 lib/getopt.c:945 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: aukerak argumentu bat behar du -- %c\n" + +#: lib/getopt.c:862 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: `-W %s' aukera ambiguoa da\n" + +#: lib/getopt.c:880 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: `-W %s' aukerak ez du argumenturik onartzen\n" + +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#: lib/quotearg.c:259 +msgid "`" +msgstr "`" + +#: lib/quotearg.c:260 +msgid "'" +msgstr "'" diff --git a/po/fi.po b/po/fi.po new file mode 100644 index 0000000..21fd4a4 --- /dev/null +++ b/po/fi.po @@ -0,0 +1,405 @@ +# Finnish translations for GNU grep. +# Copyright © 2002 Free Software Foundation, Inc. +# Sami J. Laine , 2002 +# +msgid "" +msgstr "" +"Project-Id-Version: grep-2.5g\n" +"POT-Creation-Date: 2002-03-26 16:38+0100\n" +"PO-Revision-Date: 2002-07-19 13:02+0200\n" +"Last-Translator: Sami J. Laine \n" +"Language-Team: Finnish \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-15\n" +"Content-Transfer-Encoding: 8bit\n" + +#: src/dfa.c:136 src/dfa.c:147 src/dfa.c:158 src/search.c:689 +msgid "Memory exhausted" +msgstr "Muisti loppu" + +#: src/dfa.c:489 src/dfa.c:492 src/dfa.c:510 src/dfa.c:521 src/dfa.c:545 +#: src/dfa.c:604 src/dfa.c:609 src/dfa.c:622 src/dfa.c:623 src/dfa.c:1001 +#: src/dfa.c:1004 src/dfa.c:1028 src/dfa.c:1032 src/dfa.c:1033 src/dfa.c:1036 +#: src/dfa.c:1048 src/dfa.c:1049 +msgid "Unbalanced [" +msgstr "Pariton \"[\"" + +#: src/dfa.c:741 +msgid "Unfinished \\ escape" +msgstr "Päättymätön \\-ohjausmerkki" + +#. Cases: +#. {M} - exact count +#. {M,} - minimum count, maximum is infinity +#. {M,N} - M through N +#: src/dfa.c:874 src/dfa.c:880 src/dfa.c:890 src/dfa.c:898 src/dfa.c:913 +msgid "unfinished repeat count" +msgstr "päättymätön toistomäärä" + +#: src/dfa.c:887 src/dfa.c:904 src/dfa.c:912 src/dfa.c:916 +msgid "malformed repeat count" +msgstr "virheellinen toistomäärä" + +#: src/dfa.c:1253 +msgid "Unbalanced (" +msgstr "Pariton \"(\"" + +#: src/dfa.c:1378 +msgid "No syntax specified" +msgstr "Syntaksia ei määritelty" + +#: src/dfa.c:1386 +msgid "Unbalanced )" +msgstr "Pariton \")\"" + +#: src/dfa.c:2956 +msgid "out of memory" +msgstr "muisti loppu" + +#: src/kwset.c:171 src/kwset.c:177 src/search.c:103 src/search.c:209 +#: src/search.c:293 lib/obstack.c:471 +msgid "memory exhausted" +msgstr "muisti loppu" + +#: src/grep.c:205 +msgid "invalid context length argument" +msgstr "virheellinen kontekstin pituusargumentti" + +#: src/grep.c:479 +msgid "input is too large to count" +msgstr "syöttö on liian suuri laskentaan" + +#: src/grep.c:605 +msgid "writing output" +msgstr "kirjoitetaan tulostetta" + +#: src/grep.c:878 +#, c-format +msgid "Binary file %s matches\n" +msgstr "Binäärinen tiedosto %s täsmää hakuun\n" + +#: src/grep.c:892 +msgid "(standard input)" +msgstr "(vakiosyöttö)" + +#: src/grep.c:997 +#, c-format +msgid "warning: %s: %s\n" +msgstr "varoitus: %s: %s\n" + +#: src/grep.c:998 +msgid "recursive directory loop" +msgstr "rekursiivinen hakemistosilmukka" + +#: src/grep.c:1046 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE]...\n" +msgstr "Käyttö: %s [VALITSIN]... HAKUKAAVA [TIEDOSTO]...\n" + +#: src/grep.c:1048 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "Yritä \"%s --help\" saadaksesi lisäohjeita.\n" + +#: src/grep.c:1053 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE] ...\n" +msgstr "Käyttö: %s [VALITSIN]... HAKUKAAVA [TIEDOSTO] ...\n" + +#: src/grep.c:1054 +#, c-format +msgid "" +"Search for PATTERN in each FILE or standard input.\n" +"Example: %s -i 'hello world' menu.h main.c\n" +"\n" +"Regexp selection and interpretation:\n" +msgstr "" +"Etsii HAKUKAAVAa jokaisesta TIEDOSTOsta tai vakiosyötteestä.\n" +"Esimerkki: %s -i 'hei maailma' menu.h main.c\n" +"\n" +"Säännöllisten lausekkeiden valinta ja tulkinta:\n" + +#: src/grep.c:1059 +msgid "" +" -E, --extended-regexp PATTERN is an extended regular expression\n" +" -F, --fixed-strings PATTERN is a set of newline-separated strings\n" +" -G, --basic-regexp PATTERN is a basic regular expression\n" +" -P, --perl-regexp PATTERN is a Perl regular expression\n" +msgstr "" +" -E, --extended-regexp HAKUKAAVA on laajennettu säännöllinen lauseke\n" +" (engl. extended regular expression)\n" +" -F, --fixed-strings HAKUKAAVA on joukko rivinvaihdolla erotettuja\n" +" merkkijonoja\n" +" -G, --basic-regexp HAKUKAAVA on säännöllinen lauseke\n" +" (engl. basic regular expression)\n" +" -P, --perl-regexp HAKUKAAVA on Perlin säännöllinen lauseke\n" +" (engl. Perl regular expression)\n" + +#: src/grep.c:1064 +msgid "" +" -e, --regexp=PATTERN use PATTERN as a regular expression\n" +" -f, --file=FILE obtain PATTERN from FILE\n" +" -i, --ignore-case ignore case distinctions\n" +" -w, --word-regexp force PATTERN to match only whole words\n" +" -x, --line-regexp force PATTERN to match only whole lines\n" +" -z, --null-data a data line ends in 0 byte, not newline\n" +msgstr "" +" -e, --regexp=HAKUKAAVA käytä HAKUKAAVAa säännöllisenä lausekkeena\n" +" -f, --file=TIEDOSTO nouda HAKUKAAVA TIEDOSTOsta\n" +" -i, --ignore-case älä erottele pieniä ja suuria merkkejä\n" +" -w, --word-regexp pakota HAKUKAAVAn täsmäys vain kokonaisiin sanoihin\n" +" -x, --line-regexp pakota HAKUKAAVAn täsmäys vain kokonaisiin riveihin\n" +" -z, --null-data datarivi päättyy 0-tavuun, ei rivinvaihtoon\n" + +#: src/grep.c:1071 +msgid "" +"\n" +"Miscellaneous:\n" +" -s, --no-messages suppress error messages\n" +" -v, --invert-match select non-matching lines\n" +" -V, --version print version information and exit\n" +" --help display this help and exit\n" +" --mmap use memory-mapped input if possible\n" +msgstr "" +"\n" +"Sekalaista:\n" +" -s, --no-messages estä virheilmoitusten tulostaminen\n" +" -v, --invert-match valitse ei-täsmäävät rivit\n" +" -V, --version tulosta versiotiedot ja lopeta suoritus\n" +" --help tulosta tämä ohje ja lopeta suoritus\n" +" --mmap käytä muistiinkartoitettua syötettä, jos\n" +" mahdollista\n" + +#: src/grep.c:1079 +msgid "" +"\n" +"Output control:\n" +" -m, --max-count=NUM stop after NUM matches\n" +" -b, --byte-offset print the byte offset with output lines\n" +" -n, --line-number print line number with output lines\n" +" --line-buffered flush output on every line\n" +" -H, --with-filename print the filename for each match\n" +" -h, --no-filename suppress the prefixing filename on output\n" +" --label=LABEL print LABEL as filename for standard input\n" +" -o, --only-matching show only the part of a line matching PATTERN\n" +" -q, --quiet, --silent suppress all normal output\n" +" --binary-files=TYPE assume that binary files are TYPE\n" +" TYPE is 'binary', 'text', or 'without-match'\n" +" -a, --text equivalent to --binary-files=text\n" +" -I equivalent to --binary-files=without-match\n" +" -d, --directories=ACTION how to handle directories\n" +" ACTION is 'read', 'recurse', or 'skip'\n" +" -D, --devices=ACTION how to handle devices, FIFOs and sockets\n" +" ACTION is 'read' or 'skip'\n" +" -R, -r, --recursive equivalent to --directories=recurse\n" +" --include=PATTERN files that match PATTERN will be examined\n" +" --exclude=PATTERN files that match PATTERN will be skipped.\n" +" --exclude-from=FILE files that match PATTERN in FILE will be skipped.\n" +" -L, --files-without-match only print FILE names containing no match\n" +" -l, --files-with-matches only print FILE names containing matches\n" +" -c, --count only print a count of matching lines per FILE\n" +" -Z, --null print 0 byte after FILE name\n" +msgstr "" +"\n" +"Tulosteen hallinta:\n" +" -m, --max-count=N lopeta kun N täsmäystä on löytynyt\n" +" -b, --byte-offset tulosta tavuosoite tulosteriveille\n" +" -n, --line-number tulosta rivinumero tulosteriveille\n" +" --line-buffered tyhjennä puskuri jokaisella tulosterivillä\n" +" -H, --with-filename tulosta tiedostonimi jokaiselle täsmäykselle\n" +" -h, --no-filename estä tiedostonimen tulostaminen\n" +" --label=LEIMA tulosta LEIMA tiedostonimen sijaan luettaessa\n" +" vakiosyöttettä\n" +" -o, --only-matching näytä vain HAKUKAAVAan täsmäävä osa rivistä\n" +" -q, --quiet, --silent estä kaikki normaalit tulosteet\n" +" --binary-files=TYYPPI oleta binääristen tiedostojen olevan TYYPPIä\n" +" TYYPPI on 'binary', 'text', tai 'without-match'\n" +" -a, --text sama kuin --binary-files=text\n" +" -I sama kuin --binary-files=without-match\n" +" -d, --directories=TOIMI hakemistojen käsittelytapa\n" +" TOIMI on 'read', 'recurse', tai 'skip'\n" +" -D, --devices=TOIMI laitetiedostojen, FIFOjen ja sokettien käsittely\n" +" TOIMI on 'read' tai 'skip'\n" +" -R, -r, --recursive sama kuin --directories=recurse\n" +" --include=HAKUKAAVA HAKUKAAVAan täsmäävät tiedostot tutkitaan\n" +" --exclude=HAKUKAAVA HAKUKAAVAan täsmäävät tiedostot jätetään tutkimatta\n" +" --exclude-from=TIED. HAKUKAAVAan täsmäävät tiedostot, joiden nimet\n" +" luetaan TIED.ostosta, jätetään tutkimatta\n" +" -L, --files-without-match tulosta vain TIEDOSTOt, joista ei löyty täsmäystä\n" +" -l, --files-with-matches tulosta vain TIEDOSTOt, joista löytyy täsmäys\n" +" -c, --count tulosta vain täsmäysten määrä TIEDOSTOlle\n" + +#: src/grep.c:1107 +msgid "" +"\n" +"Context control:\n" +" -B, --before-context=NUM print NUM lines of leading context\n" +" -A, --after-context=NUM print NUM lines of trailing context\n" +" -C, --context=NUM print NUM lines of output context\n" +" -NUM same as --context=NUM\n" +" --color[=WHEN],\n" +" --colour[=WHEN] use markers to distinguish the matching string\n" +" WHEN may be `always', `never' or `auto'.\n" +" -U, --binary do not strip CR characters at EOL (MSDOS)\n" +" -u, --unix-byte-offsets report offsets as if CRs were not there (MSDOS)\n" +"\n" +"`egrep' means `grep -E'. `fgrep' means `grep -F'.\n" +"With no FILE, or when FILE is -, read standard input. If less than\n" +"two FILEs given, assume -h. Exit status is 0 if match, 1 if no match,\n" +"and 2 if trouble.\n" +msgstr "" +"\n" +"Sisällön hallinta:\n" +" -B, --before-context=N tulosta N riviä ennen sisältöä\n" +" -A, --after-context=N tulosta N riviä sisällön jälkeen\n" +" -C, --context=N tulosta N riviä tulostesisältöä\n" +" -NUM sama kuin --context=N\n" +" --color[=KOSKA],\n" +" --colour[=KOSKA] käytä markkereita täsmäävän merkkijonon\n" +" erottamiseen\n" +" KOSKA voi olla `always', `never' tai `auto'.\n" +" -U, --binary älä poista CR-merkkiä rivin lopusta (MSDOS)\n" +" -u, --unix-byte-offsets ilmoita siirtymät kuten CR-merkkejä ei olisi\n" +" lainkaan (MSDOS)\n" +"\n" + +#: src/grep.c:1124 +#, fuzzy +msgid "" +"\n" +"Report bugs to .\n" +msgstr "" +"\n" +"Ilmoita virheistä osoitteeseen .\n" + +#: src/grep.c:1134 +msgid "conflicting matchers specified" +msgstr "määritelty ristiriitaiset haut" + +#: src/grep.c:1376 +msgid "unknown devices method" +msgstr "tuntematon laitemetodi" + +#: src/grep.c:1443 +msgid "unknown directories method" +msgstr "tuntematon hakemistometodi" + +#: src/grep.c:1510 +msgid "invalid max count" +msgstr "virheellinen maksimimäärä" + +#: src/grep.c:1565 +msgid "unknown binary-files type" +msgstr "tuntematon binääritiedoston tyyppi" + +#: src/grep.c:1660 +#, c-format +msgid "%s (GNU grep) %s\n" +msgstr "%s (GNU grep) %s\n" + +#: src/grep.c:1662 +msgid "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" +msgstr "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" + +#: src/grep.c:1664 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"Tämä ohjelma on vapaa ohjelmisto; tarkista jakeluehdot lähdekoodista.\n" +"Tälle ohjelmalle ei anneta minkäänlaista takuuta; ei edes takuuta\n" +"kaupallisesti hyväksyttävästä laadusta tai soveltuvuudesta tiettyyn\n" +"tarkoitukseen.\n" + +#: src/search.c:606 +msgid "The -P option is not supported" +msgstr "Valitsin -P ei ole tuettu" + +#: src/search.c:619 +msgid "The -P and -z options cannot be combined" +msgstr "Valitsimia -P ja -z ei voi käyttää samanaikaisesti" + +#: lib/error.c:117 +msgid "Unknown system error" +msgstr "Tuntematon järjestelmävirhe" + +#: lib/getopt.c:675 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: valitsin \"%s\" on moniselitteinen\n" + +#: lib/getopt.c:700 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: valitsin \"--%s\" ei salli argumenttia\n" + +#: lib/getopt.c:705 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: valitsin \"%c%s\" ei salli argumenttia\n" + +#: lib/getopt.c:723 lib/getopt.c:896 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: valitsin \"%s\" tarvitsee argumentin\n" + +#. --option +#: lib/getopt.c:752 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: tuntematon valitsin \"--%s\"\n" + +#. +option or -option +#: lib/getopt.c:756 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: tuntematon valitsin \"%c%s\"\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:782 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: epäkelpo valitsin -- %c\n" + +#: lib/getopt.c:785 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: virheellinen valitsin -- %c\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:815 lib/getopt.c:945 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: valitsin tarvitsee argumentin -- %c\n" + +#: lib/getopt.c:862 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: valitsin \"-W %s\" on moniselitteinen\n" + +#: lib/getopt.c:880 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: valitsin \"-W -%s\" ei salli argumenttia\n" + +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#: lib/quotearg.c:259 +msgid "`" +msgstr "\"" + +#: lib/quotearg.c:260 +msgid "'" +msgstr "\"" diff --git a/po/fr.po b/po/fr.po new file mode 100644 index 0000000..ebb6707 --- /dev/null +++ b/po/fr.po @@ -0,0 +1,578 @@ +# Messages français pour GNU concernant grep. +# Copyright © 2004 Free Software Foundation, Inc. +# Michel Robitaille , traducteur depuis/since 1996. +# +msgid "" +msgstr "" +"Project-Id-Version: GNU grep 2.5.1a\n" +"POT-Creation-Date: 2002-03-26 16:38+0100\n" +"PO-Revision-Date: 2005-03-06 08:00-0500\n" +"Last-Translator: Michel Robitaille \n" +"Language-Team: French \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-1\n" +"Content-Transfer-Encoding: 8-bit\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#: src/dfa.c:136 src/dfa.c:147 src/dfa.c:158 src/search.c:689 +msgid "Memory exhausted" +msgstr "Mémoire épuisée." + +#: src/dfa.c:489 src/dfa.c:492 src/dfa.c:510 src/dfa.c:521 src/dfa.c:545 +#: src/dfa.c:604 src/dfa.c:609 src/dfa.c:622 src/dfa.c:623 src/dfa.c:1001 +#: src/dfa.c:1004 src/dfa.c:1028 src/dfa.c:1032 src/dfa.c:1033 src/dfa.c:1036 +#: src/dfa.c:1048 src/dfa.c:1049 +msgid "Unbalanced [" +msgstr "[ non pairé" + +#: src/dfa.c:741 +msgid "Unfinished \\ escape" +msgstr "séquence d'échappement \\ non terminée." + +#. Cases: +#. {M} - exact count +#. {M,} - minimum count, maximum is infinity +#. {M,N} - M through N +#: src/dfa.c:874 src/dfa.c:880 src/dfa.c:890 src/dfa.c:898 src/dfa.c:913 +msgid "unfinished repeat count" +msgstr "décompte de répétition non terminé." + +#: src/dfa.c:887 src/dfa.c:904 src/dfa.c:912 src/dfa.c:916 +msgid "malformed repeat count" +msgstr "décompte de répétition mal formé." + +#: src/dfa.c:1253 +msgid "Unbalanced (" +msgstr "( non pairé" + +#: src/dfa.c:1378 +msgid "No syntax specified" +msgstr "Aucune syntaxe spécifié" + +#: src/dfa.c:1386 +msgid "Unbalanced )" +msgstr ") non pairé" + +#: src/dfa.c:2956 +msgid "out of memory" +msgstr "Mémoire épuisée." + +#: src/kwset.c:171 src/kwset.c:177 src/search.c:103 src/search.c:209 +#: src/search.c:293 lib/obstack.c:471 +msgid "memory exhausted" +msgstr "Mémoire épuisée." + +#: src/grep.c:205 +msgid "invalid context length argument" +msgstr "paramètre de contexte de longueur invalide" + +#: src/grep.c:479 +msgid "input is too large to count" +msgstr "ce qui est en entrée est trop grand pour être compté" + +#: src/grep.c:605 +msgid "writing output" +msgstr "Génération du résultat." + +#: src/grep.c:878 +#, c-format +msgid "Binary file %s matches\n" +msgstr "Fichier binaire %s concorde\n" + +#: src/grep.c:892 +msgid "(standard input)" +msgstr "(entrée standard)" + +#: src/grep.c:997 +#, c-format +msgid "warning: %s: %s\n" +msgstr "AVERTISSEMENT: %s: %s\n" + +#: src/grep.c:998 +msgid "recursive directory loop" +msgstr "boucle récursive sur le répertoire" + +#: src/grep.c:1046 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE]...\n" +msgstr "Usage: %s [OPTION]... PATRON [FICHIER]...\n" + +#: src/grep.c:1048 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "Pour en savoir davantage, faites: « %s --help ».\n" + +#: src/grep.c:1053 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE] ...\n" +msgstr "Usage: %s [OPTION]... PATRON [FICHIER] ...\n" + +#: src/grep.c:1054 +#, c-format +msgid "" +"Search for PATTERN in each FILE or standard input.\n" +"Example: %s -i 'hello world' menu.h main.c\n" +"\n" +"Regexp selection and interpretation:\n" +msgstr "" +"Recherche du PATRON dans chaque FICHIER ou sur l'entrée standard.\n" +"Exemple: %s -i 'hello world» menu.h main.c\n" +"\n" +"Sélection et interprétation de l'expression régulière:\n" + +#: src/grep.c:1059 +msgid "" +" -E, --extended-regexp PATTERN is an extended regular expression\n" +" -F, --fixed-strings PATTERN is a set of newline-separated strings\n" +" -G, --basic-regexp PATTERN is a basic regular expression\n" +" -P, --perl-regexp PATTERN is a Perl regular expression\n" +msgstr "" +" -E, --extended-regexp PATRON est une expression regulière étendue\n" +" -F, --fixed-regexp PATRON est une chaîne fixe séparée par des retour de chariot\n" +" -G, --basic-regexp PATRON est une expression régulière de base\n" +" -P, --perl-regexp PATRON est une expression régulière en Perl\n" + +#: src/grep.c:1064 +msgid "" +" -e, --regexp=PATTERN use PATTERN as a regular expression\n" +" -f, --file=FILE obtain PATTERN from FILE\n" +" -i, --ignore-case ignore case distinctions\n" +" -w, --word-regexp force PATTERN to match only whole words\n" +" -x, --line-regexp force PATTERN to match only whole lines\n" +" -z, --null-data a data line ends in 0 byte, not newline\n" +msgstr "" +" -e, --regexp=PATTERN utiliser le PATRON comme expression régulière\n" +" -f, --file=FILE obtenir le PATRON du FICHIER\n" +" -i, --ignore-case ignorer la distrinction de la casse\n" +" -w, --word-regexp forcer l'appariement du PATRON que sur des mots complets\n" +" -x, --line-regexp forcer l'appariement du PATRON que sur des lignes entières\n" +" -z, --null-data terminer la ligne de données par ZÉRO et\n" +" non pas par un retour de chariot\n" + +#: src/grep.c:1071 +msgid "" +"\n" +"Miscellaneous:\n" +" -s, --no-messages suppress error messages\n" +" -v, --invert-match select non-matching lines\n" +" -V, --version print version information and exit\n" +" --help display this help and exit\n" +" --mmap use memory-mapped input if possible\n" +msgstr "" +"\n" +"Divers:\n" +" -s, --no-messages supprimer les messages d'erreur\n" +" -v, --revert-match sélectionner les lignes sans concordances\n" +" -V, --version afficher le nom et la version du logiciel\n" +" --help afficher l'aide et quitter\n" +" --mmap utiliser la table de mémoire à l'entrée si possible\n" + +#: src/grep.c:1079 +msgid "" +"\n" +"Output control:\n" +" -m, --max-count=NUM stop after NUM matches\n" +" -b, --byte-offset print the byte offset with output lines\n" +" -n, --line-number print line number with output lines\n" +" --line-buffered flush output on every line\n" +" -H, --with-filename print the filename for each match\n" +" -h, --no-filename suppress the prefixing filename on output\n" +" --label=LABEL print LABEL as filename for standard input\n" +" -o, --only-matching show only the part of a line matching PATTERN\n" +" -q, --quiet, --silent suppress all normal output\n" +" --binary-files=TYPE assume that binary files are TYPE\n" +" TYPE is 'binary', 'text', or 'without-match'\n" +" -a, --text equivalent to --binary-files=text\n" +" -I equivalent to --binary-files=without-match\n" +" -d, --directories=ACTION how to handle directories\n" +" ACTION is 'read', 'recurse', or 'skip'\n" +" -D, --devices=ACTION how to handle devices, FIFOs and sockets\n" +" ACTION is 'read' or 'skip'\n" +" -R, -r, --recursive equivalent to --directories=recurse\n" +" --include=PATTERN files that match PATTERN will be examined\n" +" --exclude=PATTERN files that match PATTERN will be skipped.\n" +" --exclude-from=FILE files that match PATTERN in FILE will be skipped.\n" +" -L, --files-without-match only print FILE names containing no match\n" +" -l, --files-with-matches only print FILE names containing matches\n" +" -c, --count only print a count of matching lines per FILE\n" +" -Z, --null print 0 byte after FILE name\n" +msgstr "" +"\n" +"Contrôle de sortie:\n" +" -m, --max-count=N arrêter après N concordances\n" +" -b, --byte-offset afficher les adresses relatives des\n" +" lignes traitées\n" +" -n, --line-number afficher les numéros de lignes des\n" +" lignes traitées\n" +" --line-buffered vider la sortie pour chaque ligne\n" +" -H, --with-filename afficher le nom de fichier pour\n" +" chaque concordance\n" +" -h, --no-filename supprimer le préfixe du nom de fichier\n" +" sur la sortie\n" +" --label=ETIQUETTE afficher l'ÉTIQUETTE comme un nom de\n" +" fichier sur l'entrée standard\n" +" -o, --only-matching afficher la partie d'une ligne concordant avec le PATRON\n" +" -q, --quiet, --silent supprimer tout affichage en sortie\n" +" --binary-files=TYPE assumer que les fichiers binaires sont de\n" +" TYPE soit « binary », « text », ou « without-match »,\n" +" -a, --text ne pas supprimer la sortie binaire\n" +" -I équivalent à --binary-files=without-match\n" +" -d, --directories=ACTION traiter les répertoires selon l'ACTION\n" +" « read » (lecture), « recurse » (récursivité),\n" +" ou « skip » (escamotage).\n" +" -R, -r, --recursive équivalent à --directories=recurse\n" +" --include=PATRON fichiers concordant au PATRON seront examinés\n" +" --exclude=PATRON fichiers concordant au PATRON ne seront pas examinés\n" +" --exclude-from=FICHIER fichiers dont le PATRON concorde dans le fichierseront escamotés\n" +" -L, --files-without-match afficher seulement les noms des fichiers\n" +" ne contenant pas de concordance\n" +" -l, --files-with-matches afficher seulement les noms des fichiers\n" +" contenant des concordances\n" +" -c, --count afficher seulement le décompte des lignes\n" +" concordantes par fichier\n" +" -Z, --null afficher l'octet ZÉRO après le nom du fichier\n" + +#: src/grep.c:1107 +msgid "" +"\n" +"Context control:\n" +" -B, --before-context=NUM print NUM lines of leading context\n" +" -A, --after-context=NUM print NUM lines of trailing context\n" +" -C, --context=NUM print NUM lines of output context\n" +" -NUM same as --context=NUM\n" +" --color[=WHEN],\n" +" --colour[=WHEN] use markers to distinguish the matching string\n" +" WHEN may be `always', `never' or `auto'.\n" +" -U, --binary do not strip CR characters at EOL (MSDOS)\n" +" -u, --unix-byte-offsets report offsets as if CRs were not there (MSDOS)\n" +"\n" +"`egrep' means `grep -E'. `fgrep' means `grep -F'.\n" +"With no FILE, or when FILE is -, read standard input. If less than\n" +"two FILEs given, assume -h. Exit status is 0 if match, 1 if no match,\n" +"and 2 if trouble.\n" +msgstr "" +"\n" +"Contrôle du contexte:\n" +" -B, --before-context=N imprimer N lignes du contexte d'en-tête\n" +" -A, --after-context=N imprimer N lignes du contexte finale\n" +" -C, --context[=N] imprimer N lignes (2 par défaut) du contexte\n" +" à moins que -A ou -B ne soit spécifié\n" +" -N identique à --context=N\n" +" --color[=DATE],\n" +" --colour[=DATE] utiliser des marqueurs pour distinguer les\n" +" chaînes concordantes\n" +" -U, --binary ne pas enlever les caractères CR sur \n" +" les fins de lignes (MS-DOS)\n" +" -u, --unix-byte-offsets afficher les adresses relatives comme si\n" +" aucun CR n'était présent (MS-DOS)\n" +"\n" +"« egrep » est équivalent à « grep -E ». « fgrep » est équivalent à « grep -F ».\n" +"Sans FICHIER, ou si - est utilisé comme nom de FICHIER, la lecture\n" +"se fait de l'entrée standard. S'il y a moins de 2 FICHIERS, l'option -h\n" +"est implicite. Termine avec 0 s'il y a concordance avec 1 si aucune.\n" +"Termine avec 2 s'il y a des erreurs de syntaxe ou de système.\n" + +#: src/grep.c:1124 +msgid "" +"\n" +"Report bugs to .\n" +msgstr "" +"\n" +"Rapporter toutes anomalies à .\n" + +#: src/grep.c:1134 +msgid "conflicting matchers specified" +msgstr "opérateurs de concordance spécifiés en conflit" + +#: src/grep.c:1376 +msgid "unknown devices method" +msgstr "méthode inconnue pour les périphérique" + +#: src/grep.c:1443 +msgid "unknown directories method" +msgstr "méthode inconnue des répertoires" + +#: src/grep.c:1510 +msgid "invalid max count" +msgstr "décompte maximal invalide." + +#: src/grep.c:1565 +msgid "unknown binary-files type" +msgstr "type de fichier binaire inconnu" + +# msgid "GNU grep version %s" +# msgstr "«grep» de GNU version %s" +#: src/grep.c:1660 +#, c-format +msgid "%s (GNU grep) %s\n" +msgstr "%s (grep de GNU) %s\n" + +#: src/grep.c:1662 +msgid "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" +msgstr "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" + +#: src/grep.c:1664 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"Ce logiciel est libre; voir les sources pour les conditions de\n" +"reproduction. AUCUNE garantie n'est donnée; tant pour des raisons\n" +"COMMERCIALES que pour RÉPONDRE À UN BESOIN PARTICULIER.\n" + +#: src/search.c:606 +msgid "The -P option is not supported" +msgstr "L'option -P n'est pas supportée." + +#: src/search.c:619 +msgid "The -P and -z options cannot be combined" +msgstr "Les options -P et -z ne peuvent être combinées." + +#: lib/error.c:117 +msgid "Unknown system error" +msgstr "Erreur système inconnue" + +#: lib/getopt.c:675 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: l'option « %s » est ambiguë.\n" + +#: lib/getopt.c:700 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: l'option « --%s » ne permet pas de paramètre.\n" + +#: lib/getopt.c:705 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: l'option « %c%s » ne permet pas de paramètre.\n" + +#: lib/getopt.c:723 lib/getopt.c:896 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: l'option « %s » requiert un paramètre.\n" + +#. --option +#: lib/getopt.c:752 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: l'option « --%s » n'est pas reconnue.\n" + +#. +option or -option +#: lib/getopt.c:756 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: l'option « %c%s » n'est pas reconnue.\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:782 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: l'option -- %c est illégale.\n" + +#: lib/getopt.c:785 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: l'option -- %c est invalide.\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:815 lib/getopt.c:945 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: l'option -- %c requiert un paramètre.\n" + +#: lib/getopt.c:862 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: l'option « -W %s » est ambiguë.\n" + +#: lib/getopt.c:880 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: l'option « -W %s » ne permet pas de paramètre.\n" + +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#: lib/quotearg.c:259 +msgid "`" +msgstr "`" + +#: lib/quotearg.c:260 +msgid "'" +msgstr "'" + +#~ msgid "option %s" +#~ msgstr "option %s" + +#~ msgid " with arg %s" +#~ msgstr " avec le paramètre %s" + +#~ msgid "digits occur in two different argv-elements.\n" +#~ msgstr "Des chiffres apparaissent dans 2 paramètres différents.\n" + +#~ msgid "option %c\n" +#~ msgstr "option %c\n" + +#~ msgid "option a\n" +#~ msgstr "option a\n" + +#~ msgid "option b\n" +#~ msgstr "option b\n" + +#~ msgid "option c with value `%s'\n" +#~ msgstr "option c ayant pour valeur `%s'\n" + +#~ msgid "option d with value `%s'\n" +#~ msgstr "option d ayant pour valeur `%s'\n" + +#~ msgid "?? getopt returned character code 0%o ??\n" +#~ msgstr "?? getopt() a retourné le code de caractère 0%o ??\n" + +#~ msgid "non-option ARGV-elements: " +#~ msgstr "Des élément ARGV qui ne sont pas des options: " + +#~ msgid "memory exhausted\n" +#~ msgstr "Mémoire épuisée.\n" + +#~ msgid "you may specify only one of -E, -F, or -G" +#~ msgstr "Un seul des paramètres suivants peut être spécifié -E, -F ou -G" + +#~ msgid "(standard input)\n" +#~ msgstr "(entrée standard)\n" + +#~ msgid "Regexp selection and interpretation:\n" +#~ msgstr "Sélection de l'EXP_RÉGULIÈRE et interprétation:\n" + +#~ msgid " -E, --extended-regexp PATTERN is an extended regular expression\n" +#~ msgstr " -E, --extended-regexp PATRON est une expression régulière étendue\n" + +#~ msgid " -F, --fixed-strings PATTERN is a fixed string separated by newlines\n" +#~ msgstr "" +#~ " -F, --fixed-strings PATRON est une chaîne de longueur fixe\n" +#~ " séparée par des sauts de ligne\n" + +#~ msgid " -G, --basic-regexp PATTERN is a basic regular expression\n" +#~ msgstr " -G, --basic-regexp PATRON est une expression régulière de base\n" + +#~ msgid " -e, --regexp=PATTERN use PATTERN as a regular expression\n" +#~ msgstr "" +#~ " -e, --regexp=PATRON utiliser le PATRON comme une \n" +#~ " expression régulière\n" + +#~ msgid " -f, --file=FILE obtain PATTERN from FILE\n" +#~ msgstr " -f, --file=FICHIER lire le PATRON à partir du FICHIER\n" + +#~ msgid " -i, --ignore-case ignore case distinctions\n" +#~ msgstr " -i, --ignore-case ignorer la distinction de la casse\n" + +#~ msgid " -w, --word-regexp force PATTERN to match only whole words\n" +#~ msgstr "" +#~ " -w, --word-regexp forcer le PATRON à établir des\n" +#~ " concordances que pour des mots complets\n" + +#~ msgid " -x, --line-regexp force PATTERN to match only whole lines\n" +#~ msgstr "" +#~ " -x, --line-regexp forcer le PATRON à établir des\n" +#~ " concordances que pour des lignes entières\n" + +#~ msgid "Miscellaneous:\n" +#~ msgstr "Divers:\n" + +#~ msgid " -s, --no-messages suppress error messages\n" +#~ msgstr " -s, --no-messages supprimer les messages d'erreur\n" + +#~ msgid " -v, --revert-match select non-matching lines\n" +#~ msgstr " -v, --revert-match sélectionner les lignes sans concordance\n" + +#~ msgid " -V, --version print version information and exit\n" +#~ msgstr " -V, --version afficher le nom et la version du logiciel\n" + +#~ msgid " --help display this help and exit\n" +#~ msgstr " --help afficher l'aide et quitter\n" + +#~ msgid "Output control:\n" +#~ msgstr "Contrôle de sortie:\n" + +#~ msgid " -b, --byte-offset print the byte offset with output lines\n" +#~ msgstr "" +#~ " -b, --byte-offset afficher les adresses relatives avec\n" +#~ " les lignes traitées\n" + +#~ msgid " -n, --line-number print line number with output lines\n" +#~ msgstr "" +#~ " -n, --line-number afficher les numéros de lignes\n" +#~ " avec les lignes traitées\n" + +#~ msgid " -H, --with-filename print the filename for each match\n" +#~ msgstr "" +#~ " -H, --with-filename afficher le nom de fichier pour\n" +#~ " chaque concordance\n" + +#~ msgid " -h, --no-filename suppress the prefixing filename on ouput\n" +#~ msgstr "" +#~ " -h, --no-filename supprimer le préfixe du nom de fichier\n" +#~ " sur la sortie\n" + +#~ msgid " -q, --quiet, --silent suppress all normal output\n" +#~ msgstr " -q, --quiet, --silent supprimer tout affichage en sortie\n" + +#~ msgid " -L, --files-without-match only print FILE names containing no match\n" +#~ msgstr "" +#~ " -L, --files-without-match afficher seulement les noms des fichiers\n" +#~ " ne contenant pas de concordance\n" + +#~ msgid " -l, --files-with-matches only print FILE names containing matches\n" +#~ msgstr "" +#~ " -l, --files-with-matches afficher seulement les noms des fichiers\n" +#~ " contenant des concordances\n" + +#~ msgid " -c, --count only print a count of matching lines per FILE\n" +#~ msgstr "" +#~ " -c, --count afficher seulement le décompte des lignes\n" +#~ " concordantes par fichier\n" + +#~ msgid "Context control:\n" +#~ msgstr "Contrôle du contexte:\n" + +#~ msgid " -B, --before-context=NUM print NUM lines of leading context\n" +#~ msgstr " -B, --before-context=N imprimer N lignes du contexte d'en-tête\n" + +#~ msgid " -A, --after-context=NUM print NUM lines of trailing context\n" +#~ msgstr " -A, --after-context=N imprimer N lignes du contexte finale\n" + +#~ msgid " -NUM same as both -B NUM and -A NUM\n" +#~ msgstr " -NUM identique à -B NUM et -A NUM\n" + +#~ msgid " -C, --context same as -2\n" +#~ msgstr " -C, --context identique à -2\n" + +#~ msgid " -U, --binary do not strip CR characters at EOL\n" +#~ msgstr " -U, --binary ne pas enlever les caractères CR sur les fins de lignes\n" + +#~ msgid " -u, --unix-byte-offsets report offsets as if CRs were not there\n" +#~ msgstr "" +#~ " -u, --unix-byte-offsets afficher les adresses relatives comme si\n" +#~ " aucun CR n'était présent\n" + +#~ msgid "There should be one and only one PATTERN, `-e PATTERN' or `-f FILE'.\n" +#~ msgstr "Il ne devrait y avoir qu'un seul PATRON, -e PATRON ou -f FICHIER.\n" + +#~ msgid "If call as `egrep', this implies -E and `fgrep' for -F.\n" +#~ msgstr "Si appelé via egrep, les options -E et `fgrep' pour -F sont implicites.\n" + +#~ msgid "If no -[GEF], then -G is assumed.\n" +#~ msgstr "" +#~ "Si aucune des options -[GEF] alors -G est implicite.\n" +#~ "Si aucune des options -[GEF] n'est utilisé, l'option -G est implicite.\n" diff --git a/po/ga.po b/po/ga.po new file mode 100644 index 0000000..7668db7 --- /dev/null +++ b/po/ga.po @@ -0,0 +1,408 @@ +# Irish translations for grep. +# Copyright (C) 2003 Free Software Foundation, Inc. +# Kevin Patrick Scannell , 2003. +# +msgid "" +msgstr "" +"Project-Id-Version: grep 2.5.1a\n" +"POT-Creation-Date: 2002-03-26 16:38+0100\n" +"PO-Revision-Date: 2005-03-02 15:48-0500\n" +"Last-Translator: Kevin Patrick Scannell \n" +"Language-Team: Irish \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-1\n" +"Content-Transfer-Encoding: 8bit\n" + +#: src/dfa.c:136 src/dfa.c:147 src/dfa.c:158 src/search.c:689 +msgid "Memory exhausted" +msgstr "Cuimhne ídithe" + +#: src/dfa.c:489 src/dfa.c:492 src/dfa.c:510 src/dfa.c:521 src/dfa.c:545 +#: src/dfa.c:604 src/dfa.c:609 src/dfa.c:622 src/dfa.c:623 src/dfa.c:1001 +#: src/dfa.c:1004 src/dfa.c:1028 src/dfa.c:1032 src/dfa.c:1033 src/dfa.c:1036 +#: src/dfa.c:1048 src/dfa.c:1049 +msgid "Unbalanced [" +msgstr "[ corr" + +# FARF - KPS +#: src/dfa.c:741 +msgid "Unfinished \\ escape" +msgstr "Seicheamh éalúcháin \\ gan chríochnú" + +#. Cases: +#. {M} - exact count +#. {M,} - minimum count, maximum is infinity +#. {M,N} - M through N +#: src/dfa.c:874 src/dfa.c:880 src/dfa.c:890 src/dfa.c:898 src/dfa.c:913 +msgid "unfinished repeat count" +msgstr "Tá líon na hathráite neamhiomlán" + +# more precisely, "the string indicating the repeat count" is malformed -- KPS +#: src/dfa.c:887 src/dfa.c:904 src/dfa.c:912 src/dfa.c:916 +msgid "malformed repeat count" +msgstr "Tá líon na hathráite míchumtha" + +#: src/dfa.c:1253 +msgid "Unbalanced (" +msgstr "( corr" + +#: src/dfa.c:1378 +msgid "No syntax specified" +msgstr "Níor sonraíodh aon chomhréir" + +#: src/dfa.c:1386 +msgid "Unbalanced )" +msgstr ") corr" + +#: src/dfa.c:2956 +msgid "out of memory" +msgstr "cuimhne ídithe" + +#: src/kwset.c:171 src/kwset.c:177 src/search.c:103 src/search.c:209 +#: src/search.c:293 lib/obstack.c:471 +msgid "memory exhausted" +msgstr "cuimhne ídithe" + +#: src/grep.c:205 +msgid "invalid context length argument" +msgstr "Tá an argóint a shonraíonn an méid chomhthéacs neamhbhailí" + +#: src/grep.c:479 +msgid "input is too large to count" +msgstr "Tá an t-ionchur rómhór le háireamh" + +#: src/grep.c:605 +msgid "writing output" +msgstr "ag scríobh an aschuir" + +# using lit. "matching string" throughout for "match" - KPS +#: src/grep.c:878 +#, c-format +msgid "Binary file %s matches\n" +msgstr "Teaghrán comhoiriúnach sa chomhad dhénártha %s\n" + +#: src/grep.c:892 +msgid "(standard input)" +msgstr "(ionchur caighdeánach)" + +#: src/grep.c:997 +#, c-format +msgid "warning: %s: %s\n" +msgstr "rabhadh: %s: %s\n" + +#: src/grep.c:998 +msgid "recursive directory loop" +msgstr "lúb athchúrsach i gcomhadlann" + +#: src/grep.c:1046 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE]...\n" +msgstr "Úsáid: %s [ROGHA]... PATRÚN [COMHAD]...\n" + +#: src/grep.c:1048 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "Bain triail as `%s --help' chun tuilleadh eolais a fháil.\n" + +#: src/grep.c:1053 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE] ...\n" +msgstr "Úsáid: %s [ROGHA]... PATRÚN [COMHAD] ...\n" + +#: src/grep.c:1054 +#, c-format +msgid "" +"Search for PATTERN in each FILE or standard input.\n" +"Example: %s -i 'hello world' menu.h main.c\n" +"\n" +"Regexp selection and interpretation:\n" +msgstr "" +"Déan cuardach ar PATRÚN i ngach COMHAD nó ón ionchur caighdeánach.\n" +"Mar shampla: %s -i 'Dia duit' rogha.h príomh.c\n" +"\n" +"Roghnú agus léirmhíniú sloinn ionadaíochta:\n" + +#: src/grep.c:1059 +msgid "" +" -E, --extended-regexp PATTERN is an extended regular expression\n" +" -F, --fixed-strings PATTERN is a set of newline-separated strings\n" +" -G, --basic-regexp PATTERN is a basic regular expression\n" +" -P, --perl-regexp PATTERN is a Perl regular expression\n" +msgstr "" +" -E, --extended-regexp is slonn ionadaíochta feabhsaithe PATRÚN\n" +" -F, --fixed-strings is teaghráin scartha le línte nua atá i bPATRÚN\n" +" -G, --basic-regexp is slonn ionadaíochta bunúsach PATRÚN\n" +" -P, --perl-regexp is slonn ionadaíochta Perl PATRÚN\n" + +#: src/grep.c:1064 +msgid "" +" -e, --regexp=PATTERN use PATTERN as a regular expression\n" +" -f, --file=FILE obtain PATTERN from FILE\n" +" -i, --ignore-case ignore case distinctions\n" +" -w, --word-regexp force PATTERN to match only whole words\n" +" -x, --line-regexp force PATTERN to match only whole lines\n" +" -z, --null-data a data line ends in 0 byte, not newline\n" +msgstr "" +" -e, --regexp=PATRÚN úsáid PATRÚN mar shlonn ionadaíochta\n" +" -f, --file=COMHAD faigh PATRÚN as COMHAD\n" +" -i, --ignore-case déan neamhaird den chás litreacha\n" +" -w, --word-regexp ná glac mar chomhoiriúnach ach focail iomlána\n" +" -x, --line-regexp ná glac mar chomhoiriúnach ach línte iomlána\n" +" -z, --null-data léiríonn bearta '0' na foircinn línte (vs. \\n)\n" + +# cuimhnemhapáilte is in FARF ! - KPS +#: src/grep.c:1071 +msgid "" +"\n" +"Miscellaneous:\n" +" -s, --no-messages suppress error messages\n" +" -v, --invert-match select non-matching lines\n" +" -V, --version print version information and exit\n" +" --help display this help and exit\n" +" --mmap use memory-mapped input if possible\n" +msgstr "" +"\n" +"Meascra:\n" +" -s, --no-messages ná taispeáin teachtaireachtaí earráidí\n" +" -v, --invert-match taispeáin na línte GAN teaghrán comhoiriúnach\n" +" -V, --version taispeáin eolas faoin leagan agus scoir\n" +" --help taispeáin an chabhair seo agus scoir\n" +" --mmap úsáid ionchur cuimhnemhapáilte más féidir\n" + +# fritháireamh, líne-uimhir in FARF - KPS +#: src/grep.c:1079 +msgid "" +"\n" +"Output control:\n" +" -m, --max-count=NUM stop after NUM matches\n" +" -b, --byte-offset print the byte offset with output lines\n" +" -n, --line-number print line number with output lines\n" +" --line-buffered flush output on every line\n" +" -H, --with-filename print the filename for each match\n" +" -h, --no-filename suppress the prefixing filename on output\n" +" --label=LABEL print LABEL as filename for standard input\n" +" -o, --only-matching show only the part of a line matching PATTERN\n" +" -q, --quiet, --silent suppress all normal output\n" +" --binary-files=TYPE assume that binary files are TYPE\n" +" TYPE is 'binary', 'text', or 'without-match'\n" +" -a, --text equivalent to --binary-files=text\n" +" -I equivalent to --binary-files=without-match\n" +" -d, --directories=ACTION how to handle directories\n" +" ACTION is 'read', 'recurse', or 'skip'\n" +" -D, --devices=ACTION how to handle devices, FIFOs and sockets\n" +" ACTION is 'read' or 'skip'\n" +" -R, -r, --recursive equivalent to --directories=recurse\n" +" --include=PATTERN files that match PATTERN will be examined\n" +" --exclude=PATTERN files that match PATTERN will be skipped.\n" +" --exclude-from=FILE files that match PATTERN in FILE will be skipped.\n" +" -L, --files-without-match only print FILE names containing no match\n" +" -l, --files-with-matches only print FILE names containing matches\n" +" -c, --count only print a count of matching lines per FILE\n" +" -Z, --null print 0 byte after FILE name\n" +msgstr "" +"\n" +"Rialú aschuir:\n" +" -m, --max-count=UIMHIR stop i ndiaidh UIMHIR líne comhoiriúnach\n" +" -b, --byte-offset taispeáin an fritháireamh birt san aschur\n" +" -n, --line-number taispeáin líne-uimhreacha san aschur\n" +" --line-buffered déan sruthlú an aschuir i ndiaidh gach líne\n" +" -H, --with-filename taispeáin ainm comhaid le línte comhoiriúnacha\n" +" -h, --no-filename ná taispeáin ainmneacha comhad\n" +" --label=LIPÉAD tá LIPÉAD ainm comhaid don ionchur caighdeánach\n" +" -o, --only-matching ná taispeáin ach an teaghrán comhoiriúnach\n" +" -q, --quiet, --silent múch an t-aschur gnách\n" +" --binary-files=CINEÁL glac le comhaid dhénártha mar CINEÁL\n" +" CINEÁL = 'binary', 'text', nó 'without-match'\n" +" -a, --text ar comhbhrí le '--binary-files=text'\n" +" -I ar comhbhrí le '--binary-files=without-match\n" +" -d, --directories=MODH modh oibre chun comhadlanna\n" +" MODH = 'read', 'recurse', nó 'skip'\n" +" -D, --devices=MODH modh oibre chun gléasanna, FIFOnna, agus soicéid\n" +" MODH = 'read' nó 'skip'\n" +" -R, -r, --recursive ar comhbhrí le '--directories=recurse'\n" +" --include=PATRÚN déan scrúdú ar chomhaid chomhoiriúnacha\n" +" --exclude=PATRÚN ná déan scrúdú ar chomhaid chomhoiriúnacha\n" +" --exclude-from=COMHAD ná déan scrúdú ar chomhaid atá comhoiriúnach leis\n" +" an phatrún i gCOMHAD\n" +" -L, --files-without-match ná taispeáin ach ainmneacha comhaid GAN\n" +" teaghrán comhoiriúnach\n" +" -l, --files-with-matches ná taispeáin ach ainmneacha comhaid LE\n" +" teaghrán comhoiriúnach\n" +" -c, --count ná taispeáin ach líon na teaghráin chomhoiriúnacha\n" +" atá i ngach comhad\n" +" -Z, --null priontáil beart '0' i ndiaidh an ainm comhaid\n" + +#: src/grep.c:1107 +msgid "" +"\n" +"Context control:\n" +" -B, --before-context=NUM print NUM lines of leading context\n" +" -A, --after-context=NUM print NUM lines of trailing context\n" +" -C, --context=NUM print NUM lines of output context\n" +" -NUM same as --context=NUM\n" +" --color[=WHEN],\n" +" --colour[=WHEN] use markers to distinguish the matching string\n" +" WHEN may be `always', `never' or `auto'.\n" +" -U, --binary do not strip CR characters at EOL (MSDOS)\n" +" -u, --unix-byte-offsets report offsets as if CRs were not there (MSDOS)\n" +"\n" +"`egrep' means `grep -E'. `fgrep' means `grep -F'.\n" +"With no FILE, or when FILE is -, read standard input. If less than\n" +"two FILEs given, assume -h. Exit status is 0 if match, 1 if no match,\n" +"and 2 if trouble.\n" +msgstr "" +"\n" +"Rialú comhthéacs:\n" +" -B, --before-context=UIMH taispeáin UIMH líne de chomhthéacs tosaigh\n" +" -A, --after-context=UIMH taispeáin UIMH líne de chomhthéacs dheiridh\n" +" -C, --context=UIMHIR taispeáin UIMHIR líne de chomhthéacs\n" +" -UIMHIR ar comhbhrí le '--context=UIMHIR\n" +" --color[=CATHAIN],\n" +" --colour[=CATHAIN] aibhsigh na teaghráin chomhoiriúnacha\n" +" CATHAIN = `always', `never' nó `auto'.\n" +" -U, --binary ná scrios carachtair CR ag EOL (MSDOS)\n" +" -u, --unix-byte-offsets déan neamhaird de CR le haghaidh fritháireamh\n" +"\n" +"`egrep' = `grep -E', agus `fgrep' = `grep -F'.\n" +"Mura bhfuil COMHAD ann, nó más '-' é, léigh ón ionchur caighdeánach.\n" +"Má tá níos lú ná dhá chomhad ann, d'úsáidfí '-h'.\n" +"Stádas scortha 0 (fuair PATRÚN áit éigin), 1 (ní bhfuair é), nó 2 (trioblóid).\n" + +#: src/grep.c:1124 +msgid "" +"\n" +"Report bugs to .\n" +msgstr "" +"\n" +"Seol tuairiscí fabhtanna chuig .\n" + +#: src/grep.c:1134 +msgid "conflicting matchers specified" +msgstr "sonraíodh patrúin chontrártha" + +#: src/grep.c:1376 +msgid "unknown devices method" +msgstr "modh anaithnid don ghléasanna" + +#: src/grep.c:1443 +msgid "unknown directories method" +msgstr "modh anaithnid do na comhadlanna" + +#: src/grep.c:1510 +msgid "invalid max count" +msgstr "uasmhéid neamhbhailí" + +#: src/grep.c:1565 +msgid "unknown binary-files type" +msgstr "cineál anaithnid de chomhad dénártha" + +#: src/grep.c:1660 +#, c-format +msgid "%s (GNU grep) %s\n" +msgstr "%s (GNU grep) %s\n" + +#: src/grep.c:1662 +msgid "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" +msgstr "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" + +#: src/grep.c:1664 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"Is saorbhogearra an ríomhchlár seo; féach ar an bhunchód le haghaidh\n" +"coinníollacha cóipeála. Níl baránta ar bith ann; go fiú níl baránta ann\n" +"d'INDÍOLTACHT nó FEILIÚNACHT DO FHEIDHM AR LEITH.\n" + +#: src/search.c:606 +msgid "The -P option is not supported" +msgstr "Níl an rogha '-P' ar fáil" + +#: src/search.c:619 +msgid "The -P and -z options cannot be combined" +msgstr "Tá na roghanna -P agus -z neamh-chomhoiriúnach le chéile" + +#: lib/error.c:117 +msgid "Unknown system error" +msgstr "Earráid chórais anaithnid" + +#: lib/getopt.c:675 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: Tá an rogha `%s' débhríoch\n" + +#: lib/getopt.c:700 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: ní cheadaítear argóint i ndiaidh na rogha `--%s'\n" + +#: lib/getopt.c:705 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: ní cheadaítear argóint i ndiaidh na rogha `%c%s'\n" + +#: lib/getopt.c:723 lib/getopt.c:896 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: ní foláir argóint don rogha `%s'\n" + +#. --option +#: lib/getopt.c:752 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: rogha anaithnid `--%s'\n" + +#. +option or -option +#: lib/getopt.c:756 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: rogha anaithnid `%c%s'\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:782 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: rogha neamhcheadaithe -- %c\n" + +#: lib/getopt.c:785 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: rogha neamhbhailí -- %c\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:815 lib/getopt.c:945 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: ní foláir argóint don rogha -- %c\n" + +#: lib/getopt.c:862 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: Tá an rogha `-W %s' débhríoch\n" + +#: lib/getopt.c:880 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: ní cheadaítear argóint i ndiaidh na rogha `-W %s'\n" + +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#: lib/quotearg.c:259 +msgid "`" +msgstr "`" + +#: lib/quotearg.c:260 +msgid "'" +msgstr "'" diff --git a/po/gl.po b/po/gl.po new file mode 100644 index 0000000..61077d8 --- /dev/null +++ b/po/gl.po @@ -0,0 +1,441 @@ +# Galician Translation of grep +# Copyright (C) 2001 Free Software Foundation, Inc. +# Jacobo Tarrío Barreiro , 2001. +# +msgid "" +msgstr "" +"Project-Id-Version: grep 2.5g\n" +"POT-Creation-Date: 2002-03-26 16:38+0100\n" +"PO-Revision-Date: 2002-03-12 15:58+0100\n" +"Last-Translator: Jacobo Tarrío Barreiro \n" +"Language-Team: Galician \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=iso-8859-1\n" +"Content-Transfer-Encoding: 8bit\n" + +#: src/dfa.c:136 src/dfa.c:147 src/dfa.c:158 src/search.c:689 +msgid "Memory exhausted" +msgstr "Memoria esgotada" + +#: src/dfa.c:489 src/dfa.c:492 src/dfa.c:510 src/dfa.c:521 src/dfa.c:545 +#: src/dfa.c:604 src/dfa.c:609 src/dfa.c:622 src/dfa.c:623 src/dfa.c:1001 +#: src/dfa.c:1004 src/dfa.c:1028 src/dfa.c:1032 src/dfa.c:1033 src/dfa.c:1036 +#: src/dfa.c:1048 src/dfa.c:1049 +msgid "Unbalanced [" +msgstr "[ sen emparellar" + +#: src/dfa.c:741 +msgid "Unfinished \\ escape" +msgstr "Escape \\ sen rematar" + +#. Cases: +#. {M} - exact count +#. {M,} - minimum count, maximum is infinity +#. {M,N} - M through N +#: src/dfa.c:874 src/dfa.c:880 src/dfa.c:890 src/dfa.c:898 src/dfa.c:913 +msgid "unfinished repeat count" +msgstr "conta de repeticións sen rematar" + +#: src/dfa.c:887 src/dfa.c:904 src/dfa.c:912 src/dfa.c:916 +msgid "malformed repeat count" +msgstr "conta de repeticións mal formulada" + +#: src/dfa.c:1253 +msgid "Unbalanced (" +msgstr "( sen emparellar" + +#: src/dfa.c:1378 +msgid "No syntax specified" +msgstr "Sintaxe sen especificar" + +#: src/dfa.c:1386 +msgid "Unbalanced )" +msgstr ") sen emparellar" + +#: src/dfa.c:2956 +msgid "out of memory" +msgstr "memoria esgotada" + +#: src/kwset.c:171 src/kwset.c:177 src/search.c:103 src/search.c:209 +#: src/search.c:293 lib/obstack.c:471 +msgid "memory exhausted" +msgstr "memoria esgotada" + +#: src/grep.c:205 +msgid "invalid context length argument" +msgstr "argumento de lonxitude do contexto non válido" + +#: src/grep.c:479 +msgid "input is too large to count" +msgstr "a entrada é longa de máis para contala" + +#: src/grep.c:605 +msgid "writing output" +msgstr "escribindo na saída" + +#: src/grep.c:878 +#, c-format +msgid "Binary file %s matches\n" +msgstr "Arquivo binario %s aparicións\n" + +#: src/grep.c:892 +msgid "(standard input)" +msgstr "(entrada estándar)" + +#: src/grep.c:997 +#, c-format +msgid "warning: %s: %s\n" +msgstr "aviso: %s: %s\n" + +#: src/grep.c:998 +msgid "recursive directory loop" +msgstr "ciclo de directorios recursivo" + +#: src/grep.c:1046 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE]...\n" +msgstr "Emprego: %s [OPCIÓN]... PATRÓN [FICHEIRO]...\n" + +#: src/grep.c:1048 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "Escriba `%s --help' para máis información.\n" + +#: src/grep.c:1053 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE] ...\n" +msgstr "Emprego: %s [OPCIÓN]... PATRÓN [FICHEIRO] ...\n" + +#: src/grep.c:1054 +#, c-format +msgid "" +"Search for PATTERN in each FILE or standard input.\n" +"Example: %s -i 'hello world' menu.h main.c\n" +"\n" +"Regexp selection and interpretation:\n" +msgstr "" +"Busca o PATRÓN en cada FICHEIRO ou na entrada estándar.\n" +"Exemplo: %s -i 'ola mundo' menu.h main.c\n" +"\n" +"Selección e interpretación de expresións regulares:\n" + +#: src/grep.c:1059 +msgid "" +" -E, --extended-regexp PATTERN is an extended regular expression\n" +" -F, --fixed-strings PATTERN is a set of newline-separated strings\n" +" -G, --basic-regexp PATTERN is a basic regular expression\n" +" -P, --perl-regexp PATTERN is a Perl regular expression\n" +msgstr "" +" -E, --extended-regexp o PATRÓN é unha expresión regular extendida\n" +" -F, --fixed-strings o PATRÓN é un conxunto de cadeas en distintas liñas\n" +" -G, --basic-regexp o PATRÓN é unha expresión regular básica\n" +" -P, --perl-regexp o PATRÓN é unha expresión regular de Perl\n" + +#: src/grep.c:1064 +msgid "" +" -e, --regexp=PATTERN use PATTERN as a regular expression\n" +" -f, --file=FILE obtain PATTERN from FILE\n" +" -i, --ignore-case ignore case distinctions\n" +" -w, --word-regexp force PATTERN to match only whole words\n" +" -x, --line-regexp force PATTERN to match only whole lines\n" +" -z, --null-data a data line ends in 0 byte, not newline\n" +msgstr "" +" -e, --regexp=PATRÓN usa o PATRÓN coma unha expresión regular\n" +" -f, --file=FICHEIRO obtén o PATRÓN no FICHEIRO\n" +" -i, --ignore-case ignora a distinción entre maiúsculas e minúsculas\n" +" -w, --word-regexp obliga ó PATRON a encaixar con palabras completas\n" +" -x, --line-regexp obliga ó PATRON a encaixar con liñas completas\n" +" -z, --null-data as liñas de datos rematan nun bit 0\n" + +#: src/grep.c:1071 +msgid "" +"\n" +"Miscellaneous:\n" +" -s, --no-messages suppress error messages\n" +" -v, --invert-match select non-matching lines\n" +" -V, --version print version information and exit\n" +" --help display this help and exit\n" +" --mmap use memory-mapped input if possible\n" +msgstr "" +"\n" +"Variadas:\n" +" -s, --no-messages suprime as mensaxes de erro\n" +" -v, --invert-match selecciona as liñas que non encaixan\n" +" -V, --version amosa a información da versión e sae\n" +" --help amosa esta axuda e sae\n" +" --mmap emprega entrada mapeada en memoria se se pode\n" + +#: src/grep.c:1079 +msgid "" +"\n" +"Output control:\n" +" -m, --max-count=NUM stop after NUM matches\n" +" -b, --byte-offset print the byte offset with output lines\n" +" -n, --line-number print line number with output lines\n" +" --line-buffered flush output on every line\n" +" -H, --with-filename print the filename for each match\n" +" -h, --no-filename suppress the prefixing filename on output\n" +" --label=LABEL print LABEL as filename for standard input\n" +" -o, --only-matching show only the part of a line matching PATTERN\n" +" -q, --quiet, --silent suppress all normal output\n" +" --binary-files=TYPE assume that binary files are TYPE\n" +" TYPE is 'binary', 'text', or 'without-match'\n" +" -a, --text equivalent to --binary-files=text\n" +" -I equivalent to --binary-files=without-match\n" +" -d, --directories=ACTION how to handle directories\n" +" ACTION is 'read', 'recurse', or 'skip'\n" +" -D, --devices=ACTION how to handle devices, FIFOs and sockets\n" +" ACTION is 'read' or 'skip'\n" +" -R, -r, --recursive equivalent to --directories=recurse\n" +" --include=PATTERN files that match PATTERN will be examined\n" +" --exclude=PATTERN files that match PATTERN will be skipped.\n" +" --exclude-from=FILE files that match PATTERN in FILE will be skipped.\n" +" -L, --files-without-match only print FILE names containing no match\n" +" -l, --files-with-matches only print FILE names containing matches\n" +" -c, --count only print a count of matching lines per FILE\n" +" -Z, --null print 0 byte after FILE name\n" +msgstr "" +"\n" +"Control de saída:\n" +" -m, --max-count=NÚM parar tras NÚM aparicións\n" +" -b, --byte-offset amosa o desprazamento do byte coas liñas de saída\n" +" -n, --line-number amosa o numero de liña coas liñas de saída\n" +" --line-buffered baleira-lo buffer de saída con cada liña\n" +" -H, --with-filename amosa o nome do ficheiro de cada aparición\n" +" -h, --no-filename suprime o prefixo de nome de ficheiro na saída\n" +" --label=ETIQUETA amosa-la ETIQUETA coma o nome da entrada estándar\n" +" -o, --only-matching amosar só a parte da liña que encaixa co PATRÓN\n" +" -q, --quiet, --silent suprime toda a saída normal\n" +" --binary-files=TIPO supoñer que os ficheiros binarios son TIPO\n" +" TIPO é 'binary', 'text' ou 'without-match'\n" +" ('binario', 'texto', ou 'sen aparicións')\n" +" -a, --text equivalente a --binary-files=text\n" +" -I equivalente a --binary-files=without-match\n" +" -d, --directories=ACCION como trata-los directorios\n" +" ACCION é 'read', 'recurse', ou 'skip'.\n" +" ('ler', 'ascender recursivamente', ou 'omitir')\n" +" -D, --devices=ACCIÓN como trata-los dispositivos, FIFOs e sockets\n" +" ACCIÓN é 'read' ou 'skip' ('ler' ou 'omitir')\n" +" -R, -r, --recursive equivalente a --directories=recurse.\n" +" --include=PATRÓN hanse examina-los ficheiros que encaixen no PATRÓN\n" +" --exclude=PATRÓN hanse omiti-los ficheiros que encaixen no PATRÓN\n" +" --exclude-from=FICH hanse omiti-los ficheiros que encaixen nos patróns\n" +" armacenados no FICHeiro\n" +" -L, --files-without-match só amosa os FICHEIROS sen aparicións\n" +" -l, --files-with-matches só amosa os FICHEIROS con aparicións\n" +" -c, --count só amosa o núm. de liñas coincidentes por FICHEIRO\n" +" -Z, --null producir un byte 0 tralo nome do FICHEIRO\n" + +#: src/grep.c:1107 +msgid "" +"\n" +"Context control:\n" +" -B, --before-context=NUM print NUM lines of leading context\n" +" -A, --after-context=NUM print NUM lines of trailing context\n" +" -C, --context=NUM print NUM lines of output context\n" +" -NUM same as --context=NUM\n" +" --color[=WHEN],\n" +" --colour[=WHEN] use markers to distinguish the matching string\n" +" WHEN may be `always', `never' or `auto'.\n" +" -U, --binary do not strip CR characters at EOL (MSDOS)\n" +" -u, --unix-byte-offsets report offsets as if CRs were not there (MSDOS)\n" +"\n" +"`egrep' means `grep -E'. `fgrep' means `grep -F'.\n" +"With no FILE, or when FILE is -, read standard input. If less than\n" +"two FILEs given, assume -h. Exit status is 0 if match, 1 if no match,\n" +"and 2 if trouble.\n" +msgstr "" +"\n" +"Control de contexto:\n" +" -B, --before-context=NUM amosa NUM liñas de contexto previo\n" +" -A, --after-context=NUM amosa NUM liñas de contexto posterior\n" +" -C, --context=NUM amosa NUM liñas de contexto na saída\n" +" -NUM o mesmo que --context=NUM\n" +" --color[=CANDO],\n" +" --colour[=CANDO] empregar marcadores para distingui-la cadea\n" +" coincidente. CANDO pode ser `always', `never' ou\n" +" `auto' (`sempre', `nunca' ou `auto').\n" +" -U, --binary non elimina os caracteres CR na fin de liña (MSDOS)\n" +" -u, --unix-byte-offsets amosa-los desprazamentos coma se os CR non\n" +" estiveran aí (MSDOS)\n" +"\n" +"`egrep' significa `grep -E'. `fgrep' significa `grep -F'.\n" +"Se non se indica un FICHEIRO, ou cando o FICHEIRO é -, lese da entrada\n" +"estándar. Se se dan menos de dous FICHEIROs, suponse -h. O estado de saída é\n" +"0 se hai aparicións, 1 se non hai, e 2 se o que hai son problemas.\n" + +#: src/grep.c:1124 +#, fuzzy +msgid "" +"\n" +"Report bugs to .\n" +msgstr "" +"\n" +"Informe dos erros no programa a .\n" +"Informe dos erros na traducción a .\n" + +#: src/grep.c:1134 +msgid "conflicting matchers specified" +msgstr "especificáronse patróns conflictivos" + +#: src/grep.c:1376 +msgid "unknown devices method" +msgstr "método de dispositivos descoñecido" + +#: src/grep.c:1443 +msgid "unknown directories method" +msgstr "método de directorios descoñecido" + +#: src/grep.c:1510 +msgid "invalid max count" +msgstr "valor máximo non válido" + +#: src/grep.c:1565 +msgid "unknown binary-files type" +msgstr "tipo de ficheiros binarios descoñecido" + +#: src/grep.c:1660 +#, c-format +msgid "%s (GNU grep) %s\n" +msgstr "%s (GNU grep) %s\n" + +#: src/grep.c:1662 +msgid "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" +msgstr "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" + +#: src/grep.c:1664 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"Isto é software libre; vexa o código funte polas condicións de copia. NON HAI\n" +"garantía; nin sequera de COMERCIABILIDADE ou APTITUDE PARA UN FIN PARTICULAR.\n" + +#: src/search.c:606 +msgid "The -P option is not supported" +msgstr "A opción -P non está soportada" + +#: src/search.c:619 +msgid "The -P and -z options cannot be combined" +msgstr "As opcións -P e -z non se poden combinar" + +#: lib/error.c:117 +msgid "Unknown system error" +msgstr "Erro do sistema descoñecido" + +#: lib/getopt.c:675 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: a opción `%s' é ambigua\n" + +#: lib/getopt.c:700 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: a opción `--%s' non admite un argumento\n" + +#: lib/getopt.c:705 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: a opción `%c%s' non admite un argumento\n" + +#: lib/getopt.c:723 lib/getopt.c:896 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: a opción `%s' precisa dun argumento\n" + +#. --option +#: lib/getopt.c:752 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: opción non recoñecida `--%s'\n" + +#. +option or -option +#: lib/getopt.c:756 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: opción non recoñecida `%c%s'\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:782 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: opción non permitida -- %c\n" + +#: lib/getopt.c:785 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: opción non válida -- %c\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:815 lib/getopt.c:945 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: a opción precisa dun argumento --%c\n" + +#: lib/getopt.c:862 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: a opción `-W %s' é ambigua\n" + +#: lib/getopt.c:880 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: a opción `-W %s' non admite un argumento\n" + +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#: lib/quotearg.c:259 +msgid "`" +msgstr "\"" + +#: lib/quotearg.c:260 +msgid "'" +msgstr "\"" + +#~ msgid "option %s" +#~ msgstr "opción %s" + +#~ msgid " with arg %s" +#~ msgstr " con arg %s" + +#~ msgid "digits occur in two different argv-elements.\n" +#~ msgstr "dixitos aparecen en dous argv-elementos diferentes.\n" + +#~ msgid "option %c\n" +#~ msgstr "opción %c\n" + +#~ msgid "option a\n" +#~ msgstr "opción a\n" + +#~ msgid "option b\n" +#~ msgstr "opción b\n" + +#~ msgid "option c with value `%s'\n" +#~ msgstr "opción c con valor `%s'\n" + +#~ msgid "option d with value `%s'\n" +#~ msgstr "opción d con valor `%s'\n" + +#~ msgid "?? getopt returned character code 0%o ??\n" +#~ msgstr "?? getopt devolveu o código de caracter 0%o ??\n" + +#~ msgid "non-option ARGV-elements: " +#~ msgstr "ARGV-elementos no-opción: " + +#~ msgid "you may specify only one of -E, -F, or -G" +#~ msgstr "Debes especificar só un de -E, -F, ou -G" + +#~ msgid "memory exhausted\n" +#~ msgstr "memoria esgotada\n" diff --git a/po/he.po b/po/he.po new file mode 100644 index 0000000..1de0d5b --- /dev/null +++ b/po/he.po @@ -0,0 +1,398 @@ +# Hebrew messages for GNU Grep +# Copyright (C) 2002, 2005 Free Software Foundation, Inc. +# Eli Zaretskii , 2005. +# +msgid "" +msgstr "" +"Project-Id-Version: grep 2.5.1a\n" +"POT-Creation-Date: 2002-03-26 16:38+0100\n" +"PO-Revision-Date: 2005-03-04 14:55+0200\n" +"Last-Translator: Eli Zaretskii \n" +"Language-Team: Hebrew \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: src/dfa.c:136 src/dfa.c:147 src/dfa.c:158 src/search.c:689 +msgid "Memory exhausted" +msgstr "ïåøëæä øîâð" + +#: src/dfa.c:489 src/dfa.c:492 src/dfa.c:510 src/dfa.c:521 src/dfa.c:545 +#: src/dfa.c:604 src/dfa.c:609 src/dfa.c:622 src/dfa.c:623 src/dfa.c:1001 +#: src/dfa.c:1004 src/dfa.c:1028 src/dfa.c:1032 src/dfa.c:1033 src/dfa.c:1036 +#: src/dfa.c:1048 src/dfa.c:1049 +msgid "Unbalanced [" +msgstr "âåæ-ïá åì ïéàù [" + +#: src/dfa.c:741 +msgid "Unfinished \\ escape" +msgstr "äøåîâ-éúìá \\ äø÷á úøãñ" + +#. Cases: +#. {M} - exact count +#. {M,} - minimum count, maximum is infinity +#. {M,N} - M through N +#: src/dfa.c:874 src/dfa.c:880 src/dfa.c:890 src/dfa.c:898 src/dfa.c:913 +msgid "unfinished repeat count" +msgstr "äøåîâ-éúìá úåðùéä äðåî úøãâä" + +#: src/dfa.c:887 src/dfa.c:904 src/dfa.c:912 src/dfa.c:916 +msgid "malformed repeat count" +msgstr "úåðùéä äðåî úøãâäá éåâù øéáçú" + +#: src/dfa.c:1253 +msgid "Unbalanced (" +msgstr "âåæ-ïá åì ïéàù (" + +#: src/dfa.c:1378 +msgid "No syntax specified" +msgstr "øéáçú úøãâä ïéà" + +#: src/dfa.c:1386 +msgid "Unbalanced )" +msgstr "âåæ-ïá åì ïéàù )" + +#: src/dfa.c:2956 +msgid "out of memory" +msgstr "ïåøëæä øîâð" + +#: src/kwset.c:171 src/kwset.c:177 src/search.c:103 src/search.c:209 +#: src/search.c:293 lib/obstack.c:471 +msgid "memory exhausted" +msgstr "ïåøëæä øîâð" + +#: src/grep.c:205 +msgid "invalid context length argument" +msgstr "øù÷ää èñ÷è êøåà ìù äéåâù äøãâä" + +#: src/grep.c:479 +msgid "input is too large to count" +msgstr "øåôñì éãëî ìåãâ èì÷" + +#: src/grep.c:605 +msgid "writing output" +msgstr "(èìô úáéúë úòá äì÷ú)" + +#: src/grep.c:878 +#, c-format +msgid "Binary file %s matches\n" +msgstr "äîéàúî úæåøçî ìéëî %s éøàðéá õáå÷\n" + +#: src/grep.c:892 +msgid "(standard input)" +msgstr "(éð÷ú èì÷ õåøò)" + +#: src/grep.c:997 +#, c-format +msgid "warning: %s: %s\n" +msgstr "%s %s :äøäæà\n" + +#: src/grep.c:998 +msgid "recursive directory loop" +msgstr "äé÷éúá äéñøå÷ø úàìåì" + +#: src/grep.c:1046 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE]...\n" +msgstr "%s [íéðééôàî]... PATTERN [õáå÷] :ùåîéùä ïôåà\n" + +#: src/grep.c:1048 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr ".øúåé áø òãéî úâöäì `%s --help' äñð\n" + +#: src/grep.c:1053 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE] ...\n" +msgstr "%s [íéðééôàî]... PATTERN [õáå÷] :ùåîéùä ïôåà\n" + +#: src/grep.c:1054 +#, c-format +msgid "" +"Search for PATTERN in each FILE or standard input.\n" +"Example: %s -i 'hello world' menu.h main.c\n" +"\n" +"Regexp selection and interpretation:\n" +msgstr "" +" .éð÷ú èì÷á åà ,åðéåöù íéöá÷äî ãçà ìëá úéðáúì úåîàúä ùôç\n" +" %s -i 'hello world' menu.h main.c :àîâåã\n" +"\n" +" :íééøìåâøä íééèéáä âååéñå äøéçá\n" + +#: src/grep.c:1059 +msgid "" +" -E, --extended-regexp PATTERN is an extended regular expression\n" +" -F, --fixed-strings PATTERN is a set of newline-separated strings\n" +" -G, --basic-regexp PATTERN is a basic regular expression\n" +" -P, --perl-regexp PATTERN is a Perl regular expression\n" +msgstr "" +" áçøåî éøìåâø éåèéá àåä PATTERN -E, --extended-regexp\n" +" newline é\"ò úåãøôåîä úåæåøçîî áëøåî PATTERN -F, --fixed-strings\n" +" éñéñá éøìåâø éåèéá àåä PATTERN -E, --extended-regexp\n" +" Perl ïåðâñá éøìåâø éåèéá àåä PATTERN -P, --perl-regexp\n" + +#: src/grep.c:1064 +msgid "" +" -e, --regexp=PATTERN use PATTERN as a regular expression\n" +" -f, --file=FILE obtain PATTERN from FILE\n" +" -i, --ignore-case ignore case distinctions\n" +" -w, --word-regexp force PATTERN to match only whole words\n" +" -x, --line-regexp force PATTERN to match only whole lines\n" +" -z, --null-data a data line ends in 0 byte, not newline\n" +msgstr "" +" PATTERN-á äðéä éøìåâø éåèéá úéðáú -e, --regexp=PATTERN\n" +" FILE õáå÷ êåúî PATTERN úéðáúä úà àø÷ -f, --file=FILE\n" +" úåðè÷å úåìåãâ úåéúåà ïéá íéìãáäî íìòúä -i, --ignore-case\n" +" úåîìù íéìîì ÷øå êà íéàúäì PATTERN ìò -w, --word-regexp\n" +" úåîìù úåøåùì ÷øå êà íéàúäì PATTERN ìò -x, --line-regexp\n" +" newline-á àì ,0-úéáá úîééúñî èì÷ úøåù -z, --null-data\n" + +#: src/grep.c:1071 +msgid "" +"\n" +"Miscellaneous:\n" +" -s, --no-messages suppress error messages\n" +" -v, --invert-match select non-matching lines\n" +" -V, --version print version information and exit\n" +" --help display this help and exit\n" +" --mmap use memory-mapped input if possible\n" +msgstr "" +"\n" +" :íéôñåð íéðééôàî\n" +" äì÷ú úåàãåä âéöú ìà -s, --no-messages\n" +" PATTERN-ì úåîéàúî ïðéàù úåøåù âöä -v, --invert-match\n" +" àöå úéðëåúä úñøéâ ìò òãéî âöä -V, --version\n" +" úéðëúäî àöå äæ äøæò êñî âöä --help\n" +" ïåøëæì úåøéùé èì÷ éöá÷ éåôéîá ùîúùä ,øùôà íà --mmap\n" + +#: src/grep.c:1079 +msgid "" +"\n" +"Output control:\n" +" -m, --max-count=NUM stop after NUM matches\n" +" -b, --byte-offset print the byte offset with output lines\n" +" -n, --line-number print line number with output lines\n" +" --line-buffered flush output on every line\n" +" -H, --with-filename print the filename for each match\n" +" -h, --no-filename suppress the prefixing filename on output\n" +" --label=LABEL print LABEL as filename for standard input\n" +" -o, --only-matching show only the part of a line matching PATTERN\n" +" -q, --quiet, --silent suppress all normal output\n" +" --binary-files=TYPE assume that binary files are TYPE\n" +" TYPE is 'binary', 'text', or 'without-match'\n" +" -a, --text equivalent to --binary-files=text\n" +" -I equivalent to --binary-files=without-match\n" +" -d, --directories=ACTION how to handle directories\n" +" ACTION is 'read', 'recurse', or 'skip'\n" +" -D, --devices=ACTION how to handle devices, FIFOs and sockets\n" +" ACTION is 'read' or 'skip'\n" +" -R, -r, --recursive equivalent to --directories=recurse\n" +" --include=PATTERN files that match PATTERN will be examined\n" +" --exclude=PATTERN files that match PATTERN will be skipped.\n" +" --exclude-from=FILE files that match PATTERN in FILE will be skipped.\n" +" -L, --files-without-match only print FILE names containing no match\n" +" -l, --files-with-matches only print FILE names containing matches\n" +" -c, --count only print a count of matching lines per FILE\n" +" -Z, --null print 0 byte after FILE name\n" +msgstr "" +"\n" +" :èìô ìò äèéìù\n" +" úåîéàúî úåøåù NUM úâöä éøçà ÷ñôä -m, --max-count=NUM\n" +" èìô úøåù ìë ìù íéúáá èñéä âöä -b, --byte-offset\n" +" èìô úåøåù íò äøåù øôñî âöä -n, --line-number\n" +" äøåù ìë øåáò èìô õöåç ï÷åø --line-buffered\n" +" äîàúä ìë äàöîð åá õáå÷ íù âöä -H, --with-filename\n" +" èìôá íéöá÷ úåîù âéöú ìà -h, --no-filename\n" +" õáå÷ä íùë LABEL âöä ,éð÷ú èì÷ õåøòî èì÷ øåáò --label=LABEL\n" +" úéðáúä úà íàåúä äøåùä ÷ìç úà ÷ø âöä -o, --only-matching\n" +" íéìéâøä èìôä éâåñ ìë úà ìèá -q, --quiet, --silent\n" +" íééøàðéá íéöá÷ ãáòì ãöéë --binary-files=HOW\n" +"'without-match' ,'text' ,'binary' úåéäì ìåëé HOW\n" +" --binary-files=text-ì êøò-äååù -a, --text\n" +" --binary-files=without-match-ì êøò-äååù -I\n" +" úåé÷éú ãáòì ãöéë -d, --directories=HOW\n" +" 'skip' åà ,'recurse' ,'read' úåéäì ìåëé HOW\n" +" íéð÷úä ãáòì ãöéë -D, --devices=HOW\n" +" 'skip' åà 'read' úåéäì ìåëé HOW\n" +" --directories=recurse-ì êøò-äååù -R, -r, --recursive\n" +" PATTERN íéîàåú íäéúåîùù íéöá÷á ùôç --include=PATTERN\n" +" PATTERN íéîàåú íäéúåîùù íéöá÷ ìò âìã --exclude=PATTERN\n" +" PATTERN íéîàåúù FILE-î íéöá÷ ìò âìã --exclude-from=FILE\n" +" úçà äîàúä óà äúéä àì íäáù íéöá÷ úåîù âöä -L, --files-without-match\n" +" úåîàúä åéä íäá íéöá÷ä úåîù úà ÷ø âöä -l, --files-with-matches\n" +" õáå÷ ìëá úåîàåúä úåøåùä øôñî úà ÷ø âöä -c, --count\n" +" 0 úéáá õáå÷ íù ìë íééñ -Z, --null\n" + +#: src/grep.c:1107 +msgid "" +"\n" +"Context control:\n" +" -B, --before-context=NUM print NUM lines of leading context\n" +" -A, --after-context=NUM print NUM lines of trailing context\n" +" -C, --context=NUM print NUM lines of output context\n" +" -NUM same as --context=NUM\n" +" --color[=WHEN],\n" +" --colour[=WHEN] use markers to distinguish the matching string\n" +" WHEN may be `always', `never' or `auto'.\n" +" -U, --binary do not strip CR characters at EOL (MSDOS)\n" +" -u, --unix-byte-offsets report offsets as if CRs were not there (MSDOS)\n" +"\n" +"`egrep' means `grep -E'. `fgrep' means `grep -F'.\n" +"With no FILE, or when FILE is -, read standard input. If less than\n" +"two FILEs given, assume -h. Exit status is 0 if match, 1 if no match,\n" +"and 2 if trouble.\n" +msgstr "" +"\n" +" :øù÷ä ìò äèéìù\n" +" úîàåúä äøåùä éðôì øù÷ä ìù úåøåù NUM âöä -B, --before-context=NUM\n" +" úîàåúä äøåùä éøçà øù÷ä ìù úåøåù NUM âöä -A, --after-context=NUM\n" +" úîàåúä äøåùä éøçàå éðôì øù÷ä ìù úåøåù NUM âöä -C, --context=NUM\n" +" --context=NUM-ì êøò-äååù -NUM\n" +" --color[=WHEN],\n" +" úîàåúä úæåøçîä úèìáäì òáö éðîéñ âöä --colour[=WHEN]\n" +" `auto' åà ,`never' ,`always' úåéäì ìåëé WHEN\n" +" (MSDOS) äøåù óåñá CR éåú ÷ìñú ìà -U, --binary\n" +" (MSDOS) íéîéé÷ åéä àì CR éåú åìéàë íéèñéä çååã -u, --unix-byte-offsets\n" +"\n" +" .`grep -F' åùåøô `fgrep' .`grep -E' åùåøô `egrep'\n" +" .éð÷ú èì÷ õåøòî àøå÷ ,- àåä õáå÷ä íù íà åà ,èì÷ õáå÷ ïåéö àìì\n" +" .-h òîúùî ,íéöá÷ éðùî úåçô íéðåúð íà\n" +" .úåì÷ú ìù äø÷îá 2 ,åàöîð àì íà 1 ,úåîàúä åàöîð íà 0 åðéä äàéöé ãå÷\n" + +#: src/grep.c:1124 +msgid "" +"\n" +"Report bugs to .\n" +msgstr "" +"\n" +". úáåúëì äì÷ú éçååéã çåìùì àð\n" + +#: src/grep.c:1134 +msgid "conflicting matchers specified" +msgstr "äîàúää éâåñ ìù íéøúåñ íéðåéö" + +#: src/grep.c:1376 +msgid "unknown devices method" +msgstr "íéð÷úäá ìåôéèì úøëåî-éúìá úèéù" + +#: src/grep.c:1443 +msgid "unknown directories method" +msgstr "úåé÷éúá ìåôéèì úøëåî-éúìá úèéù" + +#: src/grep.c:1510 +msgid "invalid max count" +msgstr "éåâù éáøéî øôñî" + +#: src/grep.c:1565 +msgid "unknown binary-files type" +msgstr "íééøàðéá íéöá÷á ìåôéèì úøëåî-éúìá úèéù" + +#: src/grep.c:1660 +#, c-format +msgid "%s (GNU grep) %s\n" +msgstr "%s (GNU grep) %s\n" + +#: src/grep.c:1662 +msgid "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" +msgstr "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" + +#: src/grep.c:1664 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"áúë ïéà åæ äðëúì .øå÷î éöá÷á ïééò ,ä÷úòä úåéåëæì ;úéùôç äðëú äðéä åæ äðëú\n" +" .úîéåñî úéìëú åæéàì äîàúä åà úåøéçñ íùì òîúùîá-úåéøçà àì åìéôà ;úåéøçà\n" + +#: src/search.c:606 +msgid "The -P option is not supported" +msgstr "-P ïééôàîá äëéîú ïéà" + +#: src/search.c:619 +msgid "The -P and -z options cannot be combined" +msgstr "äæ úà äæ íéøúåñ -z-å -P íéðééôàî" + +#: lib/error.c:117 +msgid "Unknown system error" +msgstr "úøëåî-éúìá úëøòî úì÷ú" + +#: lib/getopt.c:675 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s úéðëú øåáò éòîùî-ãç åðéà `%s' ïééôàî\n" + +#: lib/getopt.c:700 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s úéðëú øåáò èðîåâøà ìá÷î åðéà `--%s' ïééôàî\n" + +#: lib/getopt.c:705 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s úéðëú øåáò èðîåâøà ìá÷î åðéà `%c%s' ïééôàî\n" + +#: lib/getopt.c:723 lib/getopt.c:896 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s úéðëú øåáò èðîåâøà áééçî `%s' ïééôàî\n" + +#. --option +#: lib/getopt.c:752 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s úéðëú øåáò `--%s' øëåî-éúìá ïééôàî\n" + +#. +option or -option +#: lib/getopt.c:756 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s úéðëú øåáò `%c%s' øëåî-éúìá ïééôàî\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:782 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: é÷åç-éúìá ïééôàî -- %c\n" + +#: lib/getopt.c:785 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s úéðëú øåáò éåâù ïééôàî -- %c\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:815 lib/getopt.c:945 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: èðîåâøà áééçî ïééôàî -- %c\n" + +#: lib/getopt.c:862 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s úéðëú øåáò éòîùî-ãç åðéà `-W %s' ïééôàî\n" + +#: lib/getopt.c:880 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s úéðëú øåáò èðîåâøà ìá÷î åðéà `-W %s' ïééôàî\n" + +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#: lib/quotearg.c:259 +msgid "`" +msgstr "`" + +#: lib/quotearg.c:260 +msgid "'" +msgstr "'" diff --git a/po/hr.po b/po/hr.po new file mode 100644 index 0000000..9649b64 --- /dev/null +++ b/po/hr.po @@ -0,0 +1,401 @@ +# The Croatian translation of grep. +# Copyright (C) 1999, 2002 Free Software Foundation, Inc. +# Matej Vela , 1999. +# Hrvoje Niksic , 2002. +msgid "" +msgstr "" +"Project-Id-Version: grep 2.5g\n" +"POT-Creation-Date: 2002-03-26 16:38+0100\n" +"PO-Revision-Date: 2002-04-22 01:30+02:00\n" +"Last-Translator: Hrvoje Niksic \n" +"Language-Team: Croatian \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=iso-8859-2\n" +"Content-Transfer-Encoding: 8bit\n" + +#: src/dfa.c:136 src/dfa.c:147 src/dfa.c:158 src/search.c:689 +msgid "Memory exhausted" +msgstr "Memorija iscrpljena" + +#: src/dfa.c:489 src/dfa.c:492 src/dfa.c:510 src/dfa.c:521 src/dfa.c:545 +#: src/dfa.c:604 src/dfa.c:609 src/dfa.c:622 src/dfa.c:623 src/dfa.c:1001 +#: src/dfa.c:1004 src/dfa.c:1028 src/dfa.c:1032 src/dfa.c:1033 src/dfa.c:1036 +#: src/dfa.c:1048 src/dfa.c:1049 +msgid "Unbalanced [" +msgstr "Nesparena [" + +#: src/dfa.c:741 +msgid "Unfinished \\ escape" +msgstr "Nedovr¹eni \\ escape" + +#. Cases: +#. {M} - exact count +#. {M,} - minimum count, maximum is infinity +#. {M,N} - M through N +#: src/dfa.c:874 src/dfa.c:880 src/dfa.c:890 src/dfa.c:898 src/dfa.c:913 +msgid "unfinished repeat count" +msgstr "nedovr¹en broj ponavljanja" + +#: src/dfa.c:887 src/dfa.c:904 src/dfa.c:912 src/dfa.c:916 +msgid "malformed repeat count" +msgstr "izoblièen broj ponavljanja" + +#: src/dfa.c:1253 +msgid "Unbalanced (" +msgstr "Nesparena (" + +#: src/dfa.c:1378 +msgid "No syntax specified" +msgstr "Nije zadana sintaksa" + +#: src/dfa.c:1386 +msgid "Unbalanced )" +msgstr "Nesparena )" + +#: src/dfa.c:2956 +msgid "out of memory" +msgstr "ponestalo memorije" + +#: src/kwset.c:171 src/kwset.c:177 src/search.c:103 src/search.c:209 +#: src/search.c:293 lib/obstack.c:471 +msgid "memory exhausted" +msgstr "memorija iscrpljena" + +#: src/grep.c:205 +msgid "invalid context length argument" +msgstr "neispravan argument duljine konteksta" + +#: src/grep.c:479 +msgid "input is too large to count" +msgstr "input je prevelik za brojanje" + +#: src/grep.c:605 +msgid "writing output" +msgstr "pi¹em izlaz" + +#: src/grep.c:878 +#, c-format +msgid "Binary file %s matches\n" +msgstr "Binarni spis %s se podudara\n" + +#: src/grep.c:892 +msgid "(standard input)" +msgstr "(standardni ulaz)" + +#: src/grep.c:997 +#, c-format +msgid "warning: %s: %s\n" +msgstr "upozorenje: %s: %s\n" + +#: src/grep.c:998 +msgid "recursive directory loop" +msgstr "petlja u rekurziji direktorijima" + +#: src/grep.c:1046 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE]...\n" +msgstr "Uporaba: %s [OPCIJA]... UZORAK [SPIS]...\n" + +#: src/grep.c:1048 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "Za vi¹e informacija pokrenite `%s --help'.\n" + +#: src/grep.c:1053 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE] ...\n" +msgstr "Kori¹tenje: %s [OPCIJA]... UZORAK [SPIS] ...\n" + +#: src/grep.c:1054 +#, c-format +msgid "" +"Search for PATTERN in each FILE or standard input.\n" +"Example: %s -i 'hello world' menu.h main.c\n" +"\n" +"Regexp selection and interpretation:\n" +msgstr "" +"Tra¾i UZORAK u svakom SPISU ili na standardnom ulazu.\n" +"Primjer: %s -i 'hello world' menu.h main.c\n" +"\n" +"Izbor i interpretacija regularnih izraza:\n" + +#: src/grep.c:1059 +msgid "" +" -E, --extended-regexp PATTERN is an extended regular expression\n" +" -F, --fixed-strings PATTERN is a set of newline-separated strings\n" +" -G, --basic-regexp PATTERN is a basic regular expression\n" +" -P, --perl-regexp PATTERN is a Perl regular expression\n" +msgstr "" +" -E, --extended-regexp UZORAK je pro¹ireni regularni izraz\n" +" -F, --fixed-strings UZORAK je skup newlineom odvojenih nizova\n" +" -G, --basic-regexp UZORAK je osnovni regularni izraz\n" +" -P, --perl-regexp UZORAK je Perlov regularni izraz\n" + +#: src/grep.c:1064 +msgid "" +" -e, --regexp=PATTERN use PATTERN as a regular expression\n" +" -f, --file=FILE obtain PATTERN from FILE\n" +" -i, --ignore-case ignore case distinctions\n" +" -w, --word-regexp force PATTERN to match only whole words\n" +" -x, --line-regexp force PATTERN to match only whole lines\n" +" -z, --null-data a data line ends in 0 byte, not newline\n" +msgstr "" +" -e, --regexp=UZORAK koristi UZORAK kao regularni izraz\n" +" -f, --file=SPIS pribavi UZORAK iz SPISA\n" +" -i, --ignore-case zanemari razlike izmeðu velikih i malih slova\n" +" -w, --word-regexp UZORAK mo¾e odgovarati samo potpunim rijeèima\n" +" -x, --line-regexp UZORAK mo¾e odgovarati samo potpunim redovima\n" +" -z, --null-data red podataka zavr¹ava s bajtom 0, ne s novim redom\n" + +#: src/grep.c:1071 +msgid "" +"\n" +"Miscellaneous:\n" +" -s, --no-messages suppress error messages\n" +" -v, --invert-match select non-matching lines\n" +" -V, --version print version information and exit\n" +" --help display this help and exit\n" +" --mmap use memory-mapped input if possible\n" +msgstr "" +"\n" +"Razno:\n" +" -s, --no-messages izostavi poruke o gre¹kama\n" +" -v, --revert-match odabiri redove koji se ne podudaraju\n" +" -V, --version ispi¹i informacije o verziji i izaði\n" +" --help prika¾i ovu pomoæ i izaði\n" +" --mmap mapiraj ulazne podatke u memoriju ako je moguæe\n" + +#: src/grep.c:1079 +msgid "" +"\n" +"Output control:\n" +" -m, --max-count=NUM stop after NUM matches\n" +" -b, --byte-offset print the byte offset with output lines\n" +" -n, --line-number print line number with output lines\n" +" --line-buffered flush output on every line\n" +" -H, --with-filename print the filename for each match\n" +" -h, --no-filename suppress the prefixing filename on output\n" +" --label=LABEL print LABEL as filename for standard input\n" +" -o, --only-matching show only the part of a line matching PATTERN\n" +" -q, --quiet, --silent suppress all normal output\n" +" --binary-files=TYPE assume that binary files are TYPE\n" +" TYPE is 'binary', 'text', or 'without-match'\n" +" -a, --text equivalent to --binary-files=text\n" +" -I equivalent to --binary-files=without-match\n" +" -d, --directories=ACTION how to handle directories\n" +" ACTION is 'read', 'recurse', or 'skip'\n" +" -D, --devices=ACTION how to handle devices, FIFOs and sockets\n" +" ACTION is 'read' or 'skip'\n" +" -R, -r, --recursive equivalent to --directories=recurse\n" +" --include=PATTERN files that match PATTERN will be examined\n" +" --exclude=PATTERN files that match PATTERN will be skipped.\n" +" --exclude-from=FILE files that match PATTERN in FILE will be skipped.\n" +" -L, --files-without-match only print FILE names containing no match\n" +" -l, --files-with-matches only print FILE names containing matches\n" +" -c, --count only print a count of matching lines per FILE\n" +" -Z, --null print 0 byte after FILE name\n" +msgstr "" +"\n" +"Kontrola izlaza:\n" +" -m, --max-count=BROJ zaustavi se nakon BROJA preklapanja\n" +" -b, --byte-offset ispi¹i bajtovni offset uz brojeve linija\n" +" -n, --line-number ispi¹i brojeve linija uz izlazne linije\n" +" --line-buffered po¹alji izlaz nakon svakog reda\n" +" -H, --with-filename ispi¹i naziv spisa pri svakom poklapanju\n" +" -h, --no-filename ne ispisuj naziv spisa na izlazu\n" +" --label=LABELA ispi¹i LABELU kao naziv spisa za standardni izlaz\n" +" -o, --only-matching prika¾i samo dio retka koji se preklapa s UZORKOM\n" +" -q, --quiet, --silent zatomi sav normalan izlaz\n" +" --binary-files=TIP pretpostavi da su binarni spisi TIPA\n" +" TIP je 'binary', 'text' ili 'without-match'\n" +" -a, --text ekvivalentno --binary-files=text\n" +" -I ekvivalentno --binary-files=without-match\n" +" -d, --directories=RADNJA ¹to èiniti s direktorijima\n" +" RADNJA je 'read' (èitaj), 'recurse' (rekurzivno\n" +" uði) ili 'skip' (preskoèi)\n" +" -D, --devices=RADNJA ¹to èiniti s deviceovima, FIFO-ima i socketima\n" +" RADNJA je 'read' (èitaj) ili 'skip' (preskoèi)\n" +" -R, -r, --recursive ekvivalentno --directories=recurse\n" +" --include=UZORAK obradi spise koji se poklapaju s UZORKOM\n" +" --exclude=UZORAK preskoèi spise koji se poklapaju s UZORKOM\n" +" --exclude-from=SPIS preskoèi spise koji se poklapaju s UZORKOM u SPISU\n" +" -L, --files-without-match ispi¹i samo nazive SPISA koji se nisu poklopili\n" +" -l, --files-with-matches ispi¹i samo nazive SPISA koji sadr¾e podudarnosti\n" +" -c, --count ispi¹i samo broj podudarnih linija po SPISU\n" +" -Z, --null ispi¹i 0-bajt nakon naziva SPISA\n" + +#: src/grep.c:1107 +msgid "" +"\n" +"Context control:\n" +" -B, --before-context=NUM print NUM lines of leading context\n" +" -A, --after-context=NUM print NUM lines of trailing context\n" +" -C, --context=NUM print NUM lines of output context\n" +" -NUM same as --context=NUM\n" +" --color[=WHEN],\n" +" --colour[=WHEN] use markers to distinguish the matching string\n" +" WHEN may be `always', `never' or `auto'.\n" +" -U, --binary do not strip CR characters at EOL (MSDOS)\n" +" -u, --unix-byte-offsets report offsets as if CRs were not there (MSDOS)\n" +"\n" +"`egrep' means `grep -E'. `fgrep' means `grep -F'.\n" +"With no FILE, or when FILE is -, read standard input. If less than\n" +"two FILEs given, assume -h. Exit status is 0 if match, 1 if no match,\n" +"and 2 if trouble.\n" +msgstr "" +"\n" +"Kontrola konteksta:\n" +" -B, --before-context=BROJ ispisuj BROJ redova prethodeæeg konteksta\n" +" -A, --after-context=BROJ ispisuj BROJ redova slijedeæeg konteksta\n" +" -C, --context[=BROJ] ispisuj BROJ redova izlaznog konteksta\n" +" -BROJ isto ¹to i --context=BROJ\n" +" --color[=KADA],\n" +" --colour[=KADA] koristi markere za razlikovanje poklopljenog niza\n" +" KADA mo¾e biti `always' (uvijek), `never' (nikad)\n" +" ili `auto' (automatski).\n" +" -U, --binary ne uklanjaj CR znakove na kraju reda (MSDOS)\n" +" -u, --unix-byte-offsets prikazuj polo¾aje kao da CR-ova nema (MSDOS)\n" +"\n" +"`egrep' znaèi `grep -E'. `fgrep' znaèi `grep -F'.\n" +"Ako SPIS nije zadan, ili ako je SPIS -, èitaj sa standardnog ulaza.\n" +"Ako su zadana manje od dva SPISA, pretpostavi -h. Zavr¹i sa statusom 0 ako\n" +"ima podudaranja, s 1 ako nema, a s 2 ako je bilo problema.\n" + +#: src/grep.c:1124 +#, fuzzy +msgid "" +"\n" +"Report bugs to .\n" +msgstr "" +"\n" +"Bugove prijavljujte na .\n" + +#: src/grep.c:1134 +msgid "conflicting matchers specified" +msgstr "suprotstavljeni izrazi naznaèeni" + +#: src/grep.c:1376 +msgid "unknown devices method" +msgstr "nepoznata metoda za deviceove" + +#: src/grep.c:1443 +msgid "unknown directories method" +msgstr "nepoznata metoda za direktorije" + +#: src/grep.c:1510 +msgid "invalid max count" +msgstr "neispravan maksimalni broj ponavljanja" + +#: src/grep.c:1565 +msgid "unknown binary-files type" +msgstr "nepoznata vrsta binarnih spisa" + +#: src/grep.c:1660 +#, c-format +msgid "%s (GNU grep) %s\n" +msgstr "%s (GNU grep) %s\n" + +#: src/grep.c:1662 +msgid "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" +msgstr "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" + +#: src/grep.c:1664 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"Ovo je slobodan program; za uvjete kopiranja pogledajte izvorni kod. NEMA\n" +"jamstva; èak ni za TRGOVINSKU PRIKLADNOST ili ODGOVARANJE ODREÐENOJ SVRSI.\n" + +#: src/search.c:606 +msgid "The -P option is not supported" +msgstr "Opcija -P nije podr¾ana" + +#: src/search.c:619 +msgid "The -P and -z options cannot be combined" +msgstr "Opcije -P i -z ne idu zajedno" + +#: lib/error.c:117 +msgid "Unknown system error" +msgstr "Nepoznata sistemska gre¹ka" + +#: lib/getopt.c:675 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: opcija `%s' je dvosmislena\n" + +#: lib/getopt.c:700 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: opcija `--%s' ne dopu¹ta argument\n" + +#: lib/getopt.c:705 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: opcija `%c%s' ne dopu¹ta argument\n" + +#: lib/getopt.c:723 lib/getopt.c:896 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: opcija `%s' zahtijeva argument\n" + +#. --option +#: lib/getopt.c:752 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: nepoznata opcija `--%s'\n" + +#. +option or -option +#: lib/getopt.c:756 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: nepoznata opcija `%c%s'\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:782 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: nedopu¹tena opcija -- %c\n" + +#: lib/getopt.c:785 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: neispravna opcija -- %c\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:815 lib/getopt.c:945 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: opcija zahtijeva argument -- %c\n" + +#: lib/getopt.c:862 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: opcija `-W %s' je dvosmislena\n" + +#: lib/getopt.c:880 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: opcija `-W %s' ne dopu¹ta argument\n" + +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#: lib/quotearg.c:259 +msgid "`" +msgstr "`" + +#: lib/quotearg.c:260 +msgid "'" +msgstr "'" diff --git a/po/hu.po b/po/hu.po new file mode 100644 index 0000000..ed6ba1c --- /dev/null +++ b/po/hu.po @@ -0,0 +1,405 @@ +# Hungarian translation of grep. +# Copyright (C) 2002 Free Software Foundation, Inc. +# Emese Kovács , 2002. +# +msgid "" +msgstr "" +"Project-Id-Version: grep 2.5g\n" +"POT-Creation-Date: 2002-03-26 16:38+0100\n" +"PO-Revision-Date: 2002-05-06 09:29+0200\n" +"Last-Translator: Emese Kovács \n" +"Language-Team: Hungarian \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=iso-8859-2\n" +"Content-Transfer-Encoding: 8bit\n" + +#: src/dfa.c:136 src/dfa.c:147 src/dfa.c:158 src/search.c:689 +msgid "Memory exhausted" +msgstr "Elfogyott a memória" + +#: src/dfa.c:489 src/dfa.c:492 src/dfa.c:510 src/dfa.c:521 src/dfa.c:545 +#: src/dfa.c:604 src/dfa.c:609 src/dfa.c:622 src/dfa.c:623 src/dfa.c:1001 +#: src/dfa.c:1004 src/dfa.c:1028 src/dfa.c:1032 src/dfa.c:1033 src/dfa.c:1036 +#: src/dfa.c:1048 src/dfa.c:1049 +msgid "Unbalanced [" +msgstr "Pár nélküli [" + +#: src/dfa.c:741 +msgid "Unfinished \\ escape" +msgstr "Befejezetlen \\ escape" + +#. Cases: +#. {M} - exact count +#. {M,} - minimum count, maximum is infinity +#. {M,N} - M through N +#: src/dfa.c:874 src/dfa.c:880 src/dfa.c:890 src/dfa.c:898 src/dfa.c:913 +msgid "unfinished repeat count" +msgstr "befejezetlen ismétlési szám" + +#: src/dfa.c:887 src/dfa.c:904 src/dfa.c:912 src/dfa.c:916 +msgid "malformed repeat count" +msgstr "rosszul megadott ismétlési szám" + +#: src/dfa.c:1253 +msgid "Unbalanced (" +msgstr "Pár nélküli (" + +#: src/dfa.c:1378 +msgid "No syntax specified" +msgstr "Nincs szintaxis megadva" + +#: src/dfa.c:1386 +msgid "Unbalanced )" +msgstr "Pár nélküli )" + +#: src/dfa.c:2956 +msgid "out of memory" +msgstr "elfogyott a memória" + +#: src/kwset.c:171 src/kwset.c:177 src/search.c:103 src/search.c:209 +#: src/search.c:293 lib/obstack.c:471 +msgid "memory exhausted" +msgstr "elfogyott a memória" + +#: src/grep.c:205 +msgid "invalid context length argument" +msgstr "érvénytelen szövegkörnyezethossz argumentum" + +#: src/grep.c:479 +msgid "input is too large to count" +msgstr "a bemenet túl nagy a megszámláláshoz" + +#: src/grep.c:605 +msgid "writing output" +msgstr "eredmény kiírása" + +#: src/grep.c:878 +#, c-format +msgid "Binary file %s matches\n" +msgstr "%s bináris fájl illeszkedik\n" + +#: src/grep.c:892 +msgid "(standard input)" +msgstr "(szabványos bemenet)" + +#: src/grep.c:997 +#, c-format +msgid "warning: %s: %s\n" +msgstr "vigyázat: %s: %s\n" + +#: src/grep.c:998 +msgid "recursive directory loop" +msgstr "rekurzív könyvtárhurok" + +#: src/grep.c:1046 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE]...\n" +msgstr "Használat: %s [KAPCSOLÓ]... MINTA [FÁJL]...\n" + +#: src/grep.c:1048 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "Próbáld a `%s --help'-et.\n" + +#: src/grep.c:1053 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE] ...\n" +msgstr "Használat: %s [KAPCSOLÓ]... MINTA [FÁJL]...\n" + +#: src/grep.c:1054 +#, c-format +msgid "" +"Search for PATTERN in each FILE or standard input.\n" +"Example: %s -i 'hello world' menu.h main.c\n" +"\n" +"Regexp selection and interpretation:\n" +msgstr "" +"MINTÁT keresi mindegyik FÁJLBAN vagy a szabványos bemeneten.\n" +"Példa: %s -i 'szia világ' menu.h main.c\n" +"\n" +"Reguláris kifejezés kiválasztása és értelmezése:\n" + +#: src/grep.c:1059 +msgid "" +" -E, --extended-regexp PATTERN is an extended regular expression\n" +" -F, --fixed-strings PATTERN is a set of newline-separated strings\n" +" -G, --basic-regexp PATTERN is a basic regular expression\n" +" -P, --perl-regexp PATTERN is a Perl regular expression\n" +msgstr "" +" -E, --extended-regexp MINTA kiterjesztett reguláris kifejezés (eregexp)\n" +" -F, --fixed-strings MINTA újsorokkal elválasztott karakterláncok halmaza\n" +" -G, --basic-regexp MINTA alapvetõ reguláris kifejezés (basic regexp)\n" +" -P, --perl-regexp MINTA Perl reguláris kifejezés\n" + +#: src/grep.c:1064 +msgid "" +" -e, --regexp=PATTERN use PATTERN as a regular expression\n" +" -f, --file=FILE obtain PATTERN from FILE\n" +" -i, --ignore-case ignore case distinctions\n" +" -w, --word-regexp force PATTERN to match only whole words\n" +" -x, --line-regexp force PATTERN to match only whole lines\n" +" -z, --null-data a data line ends in 0 byte, not newline\n" +msgstr "" +" -e, --regexp=MINTA MINTA használata mint reguláris kifejezés\n" +" -f, --file=FÁJL minta beolvasása FÁJLBÓL\n" +" -i, --ignore-case kis- és nagybetû megegyezik\n" +" -w, --word-regexp MINTA csak egész szóra illeszkedik\n" +" -x, --line-regexp MINTA csak egész sorra illeszkedik\n" +" -z, --null-data az adat sorai 0 bájtra végzõdnek, nem újsorra\n" + +#: src/grep.c:1071 +msgid "" +"\n" +"Miscellaneous:\n" +" -s, --no-messages suppress error messages\n" +" -v, --invert-match select non-matching lines\n" +" -V, --version print version information and exit\n" +" --help display this help and exit\n" +" --mmap use memory-mapped input if possible\n" +msgstr "" +"\n" +"Egyéb:\n" +" -s, --no-messages hibaüzenetek elnémítása\n" +" -v, --invert-match a nem illeszkedõ sorokat válogatja ki\n" +" -V, --version kiírja a program nevét és változatát\n" +" --help emlékeztetõt ír ki\n" +" --mmap memory-mapped bemenet használata, ha lehetséges\n" + +#: src/grep.c:1079 +msgid "" +"\n" +"Output control:\n" +" -m, --max-count=NUM stop after NUM matches\n" +" -b, --byte-offset print the byte offset with output lines\n" +" -n, --line-number print line number with output lines\n" +" --line-buffered flush output on every line\n" +" -H, --with-filename print the filename for each match\n" +" -h, --no-filename suppress the prefixing filename on output\n" +" --label=LABEL print LABEL as filename for standard input\n" +" -o, --only-matching show only the part of a line matching PATTERN\n" +" -q, --quiet, --silent suppress all normal output\n" +" --binary-files=TYPE assume that binary files are TYPE\n" +" TYPE is 'binary', 'text', or 'without-match'\n" +" -a, --text equivalent to --binary-files=text\n" +" -I equivalent to --binary-files=without-match\n" +" -d, --directories=ACTION how to handle directories\n" +" ACTION is 'read', 'recurse', or 'skip'\n" +" -D, --devices=ACTION how to handle devices, FIFOs and sockets\n" +" ACTION is 'read' or 'skip'\n" +" -R, -r, --recursive equivalent to --directories=recurse\n" +" --include=PATTERN files that match PATTERN will be examined\n" +" --exclude=PATTERN files that match PATTERN will be skipped.\n" +" --exclude-from=FILE files that match PATTERN in FILE will be skipped.\n" +" -L, --files-without-match only print FILE names containing no match\n" +" -l, --files-with-matches only print FILE names containing matches\n" +" -c, --count only print a count of matching lines per FILE\n" +" -Z, --null print 0 byte after FILE name\n" +msgstr "" +"\n" +"Kimenet beállítása:\n" +" -m, --max-count=SZÁM leáll SZÁM találat után\n" +" -b, --byte-offset a kimenetben szerepel a sor helye is (bájt offset)\n" +" -n, --line-number a kimenetben szerepel a sor száma is\n" +" --line-buffered kimenet 'flush'-olása minden sor után\n" +" -H, --with-filename minden találathoz ír fájlnevet is\n" +" -h, --no-filename a kimenetbe nem ír ki fájlnév elõtagot\n" +" --label=CÍMKE CÍMKE kiírása fájlnév helyett, szabványos\n" +" bemenetnél\n" +" -o, --only-matching a sornak csak a MINTÁRA illeszkedõ részét mutatja\n" +" -q, --quiet, --silent minden szokványos kiírás elhagyása\n" +" --binary-files=TÍPUS a bináris fájlokat adott TÍPUSÚNAK veszi\n" +" TÍPUS lehet 'binary', 'text' vagy 'without-match'\n" +" -a, --text mint --binary-files=text\n" +" -I mint --binary-files=without-match \n" +" -d, --directories=MÛVELET mit csináljon a könyvtárakkal\n" +" MÛVELET lehet 'read', 'recurse' vagy 'skip'\n" +" -D, --devices=MÛVELET mit csináljon az eszközökkel, fifokkal és \n" +" socketekkel\n" +" MÛVELET lehet 'read' vagy 'skip'\n" +" -R, -r, --recursive mint --directories=recurse\n" +" --include=MINTA csak a MINTÁRA illeszkedõ fájlokat vizsgálja\n" +" --exclude=MINTA a MINTÁRA illeszkedõ fájlokat átugorja\n" +" --exclude-from=FÁJL a FÁJL-ban található mintákra illeszkedõ \n" +" fájlokat átugorja.\n" +" -L, --files-without-match csak azokat a fájlneveket írja, \n" +" ahol nem volt találat\n" +" -L, --files-with-matches csak azokat a fájlneveket írja, ahol volt találat\n" +" -c, --count csak az illeszkedõ sorok számát írja, fájlonként\n" +" -Z, --null 0 bájt írása a fájlnév után\n" + +#: src/grep.c:1107 +msgid "" +"\n" +"Context control:\n" +" -B, --before-context=NUM print NUM lines of leading context\n" +" -A, --after-context=NUM print NUM lines of trailing context\n" +" -C, --context=NUM print NUM lines of output context\n" +" -NUM same as --context=NUM\n" +" --color[=WHEN],\n" +" --colour[=WHEN] use markers to distinguish the matching string\n" +" WHEN may be `always', `never' or `auto'.\n" +" -U, --binary do not strip CR characters at EOL (MSDOS)\n" +" -u, --unix-byte-offsets report offsets as if CRs were not there (MSDOS)\n" +"\n" +"`egrep' means `grep -E'. `fgrep' means `grep -F'.\n" +"With no FILE, or when FILE is -, read standard input. If less than\n" +"two FILEs given, assume -h. Exit status is 0 if match, 1 if no match,\n" +"and 2 if trouble.\n" +msgstr "" +"\n" +"Szövegkörnyezet beállításai:\n" +" -B, --before-context=SZÁM SZÁM sort ír ki a találat elõtti környezetbõl\n" +" -A, --after-context=SZÁM SZÁM sort ír ki a találat utáni környezetbõl\n" +" -C, -- context=SZÁM SZÁM sort ír ki a környezetbõl\n" +" -SZÁM ugyanaz mint a --context=SZÁM\n" +" --color[=EKKOR],\n" +" --colour[=EKKOR] az illeszkedõ karakterláncot beszínezi\n" +" EKKOR lehet 'always', 'never' vagy 'auto'\n" +" -U, --binary nem vágja le a CR karaktereket sor végén (MSDOS)\n" +" -u, --unix-byte-offsets eltolások kiírása, mintha nem lenne CR (MSDOS)\n" +"\n" +"`egrep' jelentése `grep -E'. `fgrep' jelentése `grep -F'.\n" +"Szabványos bemenetrõl olvas, ha FÁJL nincs megadva vagy -. Ha kevesebb mint\n" +"két FÁJL van megadva, -h kapcsolót feltételez. Kilépési érték 0, ha van \n" +"találat, 1, ha nincs és 2, ha gond van.\n" + +#: src/grep.c:1124 +#, fuzzy +msgid "" +"\n" +"Report bugs to .\n" +msgstr "" +"\n" +"A hibákat jelentsd a címen.\n" + +#: src/grep.c:1134 +#, fuzzy +msgid "conflicting matchers specified" +msgstr "conflicting matchers specified" + +#: src/grep.c:1376 +msgid "unknown devices method" +msgstr "ismeretlen eszközmódszer" + +#: src/grep.c:1443 +msgid "unknown directories method" +msgstr "ismeretlen könyvtármódszer" + +#: src/grep.c:1510 +msgid "invalid max count" +msgstr "érvénytelen maximális szám" + +#: src/grep.c:1565 +msgid "unknown binary-files type" +msgstr "ismeretlen bináris fájl típus" + +#: src/grep.c:1660 +#, c-format +msgid "%s (GNU grep) %s\n" +msgstr "%s (GNU grep) %s\n" + +#: src/grep.c:1662 +msgid "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" +msgstr "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" + +#: src/grep.c:1664 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"Ez szabad szoftver; a sokszorosításra vonatkozó feltételeket lásd a forrásban.\n" +"SEMMILYEN garanciát nem vállalunk, még azt sem állítjuk, hogy ez a program \n" +"KERESKEDELMI CÉLOKRA ALKALMAS vagy HASZNÁLHATÓ EGY ADOTT FELADATRA.\n" + +#: src/search.c:606 +msgid "The -P option is not supported" +msgstr "A -P kapcsoló nem támogatott" + +#: src/search.c:619 +msgid "The -P and -z options cannot be combined" +msgstr "A -P és -z kapcsolókat nem lehet egyszerre használni" + +#: lib/error.c:117 +msgid "Unknown system error" +msgstr "Ismeretlen rendszerhiba" + +#: lib/getopt.c:675 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: a `%s' kapcsoló nem egyértelmû\n" + +#: lib/getopt.c:700 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: a `--%s' kapcsoló nem enged meg argumentumot\n" + +#: lib/getopt.c:705 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: a `%c%s' kapcsoló nem enged meg argumentumot\n" + +#: lib/getopt.c:723 lib/getopt.c:896 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: a `%s' kapcsolóhoz argumentum szükséges\n" + +#. --option +#: lib/getopt.c:752 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: a `--%s' kapcsoló ismeretlen\n" + +#. +option or -option +#: lib/getopt.c:756 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: a `%c%s' kapcsoló ismeretlen\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:782 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: illegális kapcsoló -- %c\n" + +#: lib/getopt.c:785 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: érvénytelen kapcsoló -- %c\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:815 lib/getopt.c:945 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: a kapcsolónak szüksége van egy argumentumra -- %c\n" + +#: lib/getopt.c:862 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: a `-W %s' kapcsoló nem egyértelmû\n" + +#: lib/getopt.c:880 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: a `-W %s' kapcsoló nem enged meg argumentumot\n" + +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#: lib/quotearg.c:259 +msgid "`" +msgstr "`" + +#: lib/quotearg.c:260 +msgid "'" +msgstr "'" diff --git a/po/id.po b/po/id.po new file mode 100644 index 0000000..51d13c5 --- /dev/null +++ b/po/id.po @@ -0,0 +1,400 @@ +# grep-2.5g (Indonesian). +# Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +# Tedi Heriyanto , 1999, 2000, 2001, 2002 +# +msgid "" +msgstr "" +"Project-Id-Version: grep 2.5g.id.po\n" +"POT-Creation-Date: 2002-03-26 16:38+0100\n" +"PO-Revision-Date: 2002-03-08 16:34GMT+0700\n" +"Last-Translator: Tedi Heriyanto \n" +"Language-Team: Indonesian \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-1\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: KBabel 0.9.5\n" + +#: src/dfa.c:136 src/dfa.c:147 src/dfa.c:158 src/search.c:689 +msgid "Memory exhausted" +msgstr "Memori habis" + +#: src/dfa.c:489 src/dfa.c:492 src/dfa.c:510 src/dfa.c:521 src/dfa.c:545 +#: src/dfa.c:604 src/dfa.c:609 src/dfa.c:622 src/dfa.c:623 src/dfa.c:1001 +#: src/dfa.c:1004 src/dfa.c:1028 src/dfa.c:1032 src/dfa.c:1033 src/dfa.c:1036 +#: src/dfa.c:1048 src/dfa.c:1049 +msgid "Unbalanced [" +msgstr "[ tidak seimbang" + +#: src/dfa.c:741 +msgid "Unfinished \\ escape" +msgstr "escape \\\\ tidak selesai" + +#. Cases: +#. {M} - exact count +#. {M,} - minimum count, maximum is infinity +#. {M,N} - M through N +#: src/dfa.c:874 src/dfa.c:880 src/dfa.c:890 src/dfa.c:898 src/dfa.c:913 +msgid "unfinished repeat count" +msgstr "perulangan count tidak selesai" + +#: src/dfa.c:887 src/dfa.c:904 src/dfa.c:912 src/dfa.c:916 +msgid "malformed repeat count" +msgstr "perulangan count salah bentuk" + +#: src/dfa.c:1253 +msgid "Unbalanced (" +msgstr "( tidak seimbang" + +#: src/dfa.c:1378 +msgid "No syntax specified" +msgstr "Tidak ada syntax dispesifikasikan" + +#: src/dfa.c:1386 +msgid "Unbalanced )" +msgstr ") tidak seimbang" + +#: src/dfa.c:2956 +msgid "out of memory" +msgstr "memori habis" + +#: src/kwset.c:171 src/kwset.c:177 src/search.c:103 src/search.c:209 +#: src/search.c:293 lib/obstack.c:471 +msgid "memory exhausted" +msgstr "memori habis" + +#: src/grep.c:205 +msgid "invalid context length argument" +msgstr "argumen panjang konteks tidak valid" + +#: src/grep.c:479 +msgid "input is too large to count" +msgstr "input terlalu besar untuk dihitung" + +#: src/grep.c:605 +msgid "writing output" +msgstr "menulis output" + +#: src/grep.c:878 +#, c-format +msgid "Binary file %s matches\n" +msgstr "File biner %s cocok\n" + +#: src/grep.c:892 +msgid "(standard input)" +msgstr "(input standar)" + +#: src/grep.c:997 +#, c-format +msgid "warning: %s: %s\n" +msgstr "peringatan: %s: %s\n" + +#: src/grep.c:998 +msgid "recursive directory loop" +msgstr "perulangan direktori rekursif" + +#: src/grep.c:1046 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE]...\n" +msgstr "Pemakaian: %s [OPSI]... POLA [FILE]...\n" + +#: src/grep.c:1048 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "Coba `%s --help' untuk informasi lebih lanjut.\n" + +#: src/grep.c:1053 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE] ...\n" +msgstr "Pemakaian: %s [OPSI]... POLA [FILE] ...\n" + +#: src/grep.c:1054 +#, c-format +msgid "" +"Search for PATTERN in each FILE or standard input.\n" +"Example: %s -i 'hello world' menu.h main.c\n" +"\n" +"Regexp selection and interpretation:\n" +msgstr "" +"Mencari POLA dalam setiap FILE atau input standar.\n" +"Contoh: %s -i 'hello world' menu.h main.c\n" +"\n" +"Seleksi dan interpretasi regexp:\n" + +#: src/grep.c:1059 +msgid "" +" -E, --extended-regexp PATTERN is an extended regular expression\n" +" -F, --fixed-strings PATTERN is a set of newline-separated strings\n" +" -G, --basic-regexp PATTERN is a basic regular expression\n" +" -P, --perl-regexp PATTERN is a Perl regular expression\n" +msgstr "" +" -E, --extended-regexp POLA adalah ekspresi reguler ekstended\n" +" -F, --fixed-regexp POLA adalah string tetap yang dipisah oleh newline\n" +" -G, --basic-regexp POLA adalah ekspresi reguler dasar\n" +" -P, --perl-regexp POLA adalah sebuah ekspresi reguler Perl\n" + +#: src/grep.c:1064 +msgid "" +" -e, --regexp=PATTERN use PATTERN as a regular expression\n" +" -f, --file=FILE obtain PATTERN from FILE\n" +" -i, --ignore-case ignore case distinctions\n" +" -w, --word-regexp force PATTERN to match only whole words\n" +" -x, --line-regexp force PATTERN to match only whole lines\n" +" -z, --null-data a data line ends in 0 byte, not newline\n" +msgstr "" +" -e, --regexp=POLA gunakan POLA sebagai ekspresi reguler\n" +" -f, --file=FILE dapatkan pola dari FILE\n" +" -i, --ignore-case abaikan perbedaan case\n" +" -w, --word-regexp paksa POLA hanya cocok dengan keseluruhan kata\n" +" -x, --line-regexp paksa POLA hanya cocok dengan keseluruhan baris\n" +" -z, --null-data baris data berakhir dalam 0 byte, bukan newline\n" +"\n" + +#: src/grep.c:1071 +msgid "" +"\n" +"Miscellaneous:\n" +" -s, --no-messages suppress error messages\n" +" -v, --invert-match select non-matching lines\n" +" -V, --version print version information and exit\n" +" --help display this help and exit\n" +" --mmap use memory-mapped input if possible\n" +msgstr "" +"\n" +"Lain-lain:\n" +" -s, --no-messages tiadakan pesan kesalahan\n" +" -v, --invert-match pilih baris-baris yang tidak sesuai\n" +" -V, --version tampilkan informasi versi dan keluar\n" +" --help tampilkan bantuan ini dan keluar\n" +" --mmap gunakan input memory-mapped bila memungkinkan\n" + +#: src/grep.c:1079 +msgid "" +"\n" +"Output control:\n" +" -m, --max-count=NUM stop after NUM matches\n" +" -b, --byte-offset print the byte offset with output lines\n" +" -n, --line-number print line number with output lines\n" +" --line-buffered flush output on every line\n" +" -H, --with-filename print the filename for each match\n" +" -h, --no-filename suppress the prefixing filename on output\n" +" --label=LABEL print LABEL as filename for standard input\n" +" -o, --only-matching show only the part of a line matching PATTERN\n" +" -q, --quiet, --silent suppress all normal output\n" +" --binary-files=TYPE assume that binary files are TYPE\n" +" TYPE is 'binary', 'text', or 'without-match'\n" +" -a, --text equivalent to --binary-files=text\n" +" -I equivalent to --binary-files=without-match\n" +" -d, --directories=ACTION how to handle directories\n" +" ACTION is 'read', 'recurse', or 'skip'\n" +" -D, --devices=ACTION how to handle devices, FIFOs and sockets\n" +" ACTION is 'read' or 'skip'\n" +" -R, -r, --recursive equivalent to --directories=recurse\n" +" --include=PATTERN files that match PATTERN will be examined\n" +" --exclude=PATTERN files that match PATTERN will be skipped.\n" +" --exclude-from=FILE files that match PATTERN in FILE will be skipped.\n" +" -L, --files-without-match only print FILE names containing no match\n" +" -l, --files-with-matches only print FILE names containing matches\n" +" -c, --count only print a count of matching lines per FILE\n" +" -Z, --null print 0 byte after FILE name\n" +msgstr "" +"\n" +"Kendali output:\n" +" -m, --max-count=NUM berhenti setelah cocok sejumlah NUM\n" +" -b, --byte-offset cetak offset byte dengan baris output\n" +" -n, --line-number cetak nomor baris dengan baris output\n" +" --line-buffered flush output setiap baris\n" +" -H, --with-filename cetak namafile untuk setiap kecocokan\n" +" -h, --no-filename tiadakan namafile di output\n" +" --label=LABEL cetak LABEL sebagai nama file input standar\n" +" -q, --quiet, --silent tiadakan seluruh output normal\n" +" --binary-files=TYPE asumsikan bahwa file biner bertipe TYPE\n" +" TYPE adalah 'binary', 'text', atau 'without match'\n" +" -a, --text ekivalen dengan --binary-files=text\n" +" -l ekivalen dengan --binary-files=without-match\n" +" -d, --directories=AKSI bagaimana menangani direktori\n" +" AKSI adalah 'read', 'recurse', atau 'skip'.\n" +" -D, --devices=AKSI bagaimana menangani device, FIFO dan soket\n" +" AKSI adalah 'read' atau 'skip'\n" +" -R, -r, --recursive ekivalen dengan --directories=recurse.\n" +" --include=POLA file yang cocok dengan POLA akan diperiksa\n" +" --exclude=POLA file yang cocok dengan POLA akan dilewati\n" +" --exclude-from=FILE file yang cocok dengan POLA dalam FILE akan dilewati\n" +" -L, --files-without-match hanya mencetak nama FILE yang tidak ada kecocokan\n" +" -l, --files-with-match hanya mencetak nama FILE yang ada kecocokan\n" +" -c, --count hanya mencetak jumlah baris yang cocok per FILE\n" +" -Z, --null mencetak byte 0 setelah nama FILE\n" + +#: src/grep.c:1107 +msgid "" +"\n" +"Context control:\n" +" -B, --before-context=NUM print NUM lines of leading context\n" +" -A, --after-context=NUM print NUM lines of trailing context\n" +" -C, --context=NUM print NUM lines of output context\n" +" -NUM same as --context=NUM\n" +" --color[=WHEN],\n" +" --colour[=WHEN] use markers to distinguish the matching string\n" +" WHEN may be `always', `never' or `auto'.\n" +" -U, --binary do not strip CR characters at EOL (MSDOS)\n" +" -u, --unix-byte-offsets report offsets as if CRs were not there (MSDOS)\n" +"\n" +"`egrep' means `grep -E'. `fgrep' means `grep -F'.\n" +"With no FILE, or when FILE is -, read standard input. If less than\n" +"two FILEs given, assume -h. Exit status is 0 if match, 1 if no match,\n" +"and 2 if trouble.\n" +msgstr "" +"\n" +"Kendali Konteks:\n" +" -B, --before-context=NUM mencetak NUM baris leading context\n" +" -A, --after-context=NUM mencetak NUM baris trailing context\n" +" -C, --context=NUM mencetak NUM baris konteks output \n" +" -NUM sama seperti --context=NUM\n" +" --color[=WHEN],\n" +" --colour[=WHEN] gunakan penanda untuk membedakan string yang cocok\n" +" WHEN dapat berupa 'always', 'never', atau 'auto'\n" +" -U, --binary jangan hapus karakter CR di EOL (MSDOS)\n" +" -u, --unix-byte-offsets laporkan offset seperti bila CR tidak ada (MSDOS)\n" +"\n" +"`egrep' berarti `grep -E'. `fgrep' berarti `grep -F'.\n" +"Dengan tanpa FILE, atau ketika FILE adalah -, baca input standar. Jika diberi \n" +"kurang dari dua file, asumsikan -h. Keluar dengan 0 jika cocok, dengan 1 jika\n" +"tidak. 2 jika terjadi masalah.\n" + +#: src/grep.c:1124 +#, fuzzy +msgid "" +"\n" +"Report bugs to .\n" +msgstr "" +"\n" +"Laporkan kesalahan ke .\n" + +#: src/grep.c:1134 +msgid "conflicting matchers specified" +msgstr "dispesifikasikan matcher yang konflik" + +#: src/grep.c:1376 +msgid "unknown devices method" +msgstr "metode device tidak dikenal" + +#: src/grep.c:1443 +msgid "unknown directories method" +msgstr "metode direktori tidak dikenal" + +#: src/grep.c:1510 +msgid "invalid max count" +msgstr "jumlah max tidak valid" + +#: src/grep.c:1565 +msgid "unknown binary-files type" +msgstr "tipe file biner tidak dikenal" + +#: src/grep.c:1660 +#, c-format +msgid "%s (GNU grep) %s\n" +msgstr "%s (GNU grep) %s\n" + +#: src/grep.c:1662 +msgid "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" +msgstr "Hak Cipta (C) 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" + +#: src/grep.c:1664 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"Ini adalah free software; lihat sumber untuk syarat penyalinan. Tidak ada\n" +"jaminan; sekalipun untuk PENJUALAN atau KESESUAIAN UNTUK TUJUAN TERTENTU.\n" + +#: src/search.c:606 +msgid "The -P option is not supported" +msgstr "Option -P tidak didukung" + +#: src/search.c:619 +msgid "The -P and -z options cannot be combined" +msgstr "Option -P dan -z tidak dapat digabungkan" + +#: lib/error.c:117 +msgid "Unknown system error" +msgstr "Kesalahan sistem tidak dikenal" + +#: lib/getopt.c:675 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: opsi `%s' rancu\n" + +#: lib/getopt.c:700 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: opsi `--%s' tidak mengijinkan argumen\n" + +#: lib/getopt.c:705 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: opsi `%c%s' tidak mengijinkan argumen\n" + +#: lib/getopt.c:723 lib/getopt.c:896 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: opsi `%s' membutuhkan sebuah argumen\n" + +#. --option +#: lib/getopt.c:752 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: opsi tidak dikenal `--%s'\n" + +#. +option or -option +#: lib/getopt.c:756 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: opsi tidak dikenal `%c%s'\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:782 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: opsi ilegal -- %c\n" + +#: lib/getopt.c:785 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: opsi tidak valid -- %c\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:815 lib/getopt.c:945 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: opsi membutuhkan sebuah argumen -- %c\n" + +#: lib/getopt.c:862 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: opsi `-W %s' rancu\n" + +#: lib/getopt.c:880 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: opsi `-W %s' tidak mengijinkan sebuah argumen\n" + +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#: lib/quotearg.c:259 +msgid "`" +msgstr "`" + +#: lib/quotearg.c:260 +msgid "'" +msgstr "'" diff --git a/po/it.po b/po/it.po new file mode 100644 index 0000000..a38d6e6 --- /dev/null +++ b/po/it.po @@ -0,0 +1,404 @@ +# traduzione di grep +# Copyright (C) 1999, 2001 Free Software Foundation, Inc. +# Marco d'Itri , 1999, 2001. +# +msgid "" +msgstr "" +"Project-Id-Version: grep 2.5.1a\n" +"POT-Creation-Date: 2002-03-26 16:38+0100\n" +"PO-Revision-Date: 2005-03-03 17:37+0100\n" +"Last-Translator: Marco d'Itri \n" +"Language-Team: Italian \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-1\n" +"Content-Transfer-Encoding: 8-bit\n" + +#: src/dfa.c:136 src/dfa.c:147 src/dfa.c:158 src/search.c:689 +msgid "Memory exhausted" +msgstr "Memoria esaurita" + +#: src/dfa.c:489 src/dfa.c:492 src/dfa.c:510 src/dfa.c:521 src/dfa.c:545 +#: src/dfa.c:604 src/dfa.c:609 src/dfa.c:622 src/dfa.c:623 src/dfa.c:1001 +#: src/dfa.c:1004 src/dfa.c:1028 src/dfa.c:1032 src/dfa.c:1033 src/dfa.c:1036 +#: src/dfa.c:1048 src/dfa.c:1049 +msgid "Unbalanced [" +msgstr "[ non bilanciata" + +#: src/dfa.c:741 +msgid "Unfinished \\ escape" +msgstr "Escape \\ incompleto" + +#. Cases: +#. {M} - exact count +#. {M,} - minimum count, maximum is infinity +#. {M,N} - M through N +#: src/dfa.c:874 src/dfa.c:880 src/dfa.c:890 src/dfa.c:898 src/dfa.c:913 +msgid "unfinished repeat count" +msgstr "numero di ripetizioni incompleto" + +#: src/dfa.c:887 src/dfa.c:904 src/dfa.c:912 src/dfa.c:916 +msgid "malformed repeat count" +msgstr "numero di ripetizioni malformato" + +#: src/dfa.c:1253 +msgid "Unbalanced (" +msgstr "( non bilanciata" + +#: src/dfa.c:1378 +msgid "No syntax specified" +msgstr "Nessuna sintassi specificata" + +#: src/dfa.c:1386 +msgid "Unbalanced )" +msgstr ") non bilanciata" + +#: src/dfa.c:2956 +msgid "out of memory" +msgstr "memoria esaurita" + +#: src/kwset.c:171 src/kwset.c:177 src/search.c:103 src/search.c:209 +#: src/search.c:293 lib/obstack.c:471 +msgid "memory exhausted" +msgstr "memoria esaurita" + +#: src/grep.c:205 +msgid "invalid context length argument" +msgstr "argomento della lunghezza del contesto non valido" + +#: src/grep.c:479 +msgid "input is too large to count" +msgstr "l'input è troppo grande per essere contato" + +#: src/grep.c:605 +msgid "writing output" +msgstr "scrittura dell'output" + +#: src/grep.c:878 +#, c-format +msgid "Binary file %s matches\n" +msgstr "Il file binario %s corrisponde\n" + +#: src/grep.c:892 +msgid "(standard input)" +msgstr "(standard input)" + +#: src/grep.c:997 +#, c-format +msgid "warning: %s: %s\n" +msgstr "attenzione: %s: %s\n" + +#: src/grep.c:998 +msgid "recursive directory loop" +msgstr "loop ricorsivo di directory" + +#: src/grep.c:1046 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE]...\n" +msgstr "Uso: %s [OPZIONE]... MODELLO [FILE]...\n" + +#: src/grep.c:1048 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "Usare `%s --help' per ulteriori informazioni.\n" + +#: src/grep.c:1053 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE] ...\n" +msgstr "Uso: %s [OPZIONE]... MODELLO [FILE] ...\n" + +#: src/grep.c:1054 +#, c-format +msgid "" +"Search for PATTERN in each FILE or standard input.\n" +"Example: %s -i 'hello world' menu.h main.c\n" +"\n" +"Regexp selection and interpretation:\n" +msgstr "" +"Cerca il MODELLO in ogni FILE o nello standard input.\n" +"Esempio: %s -i 'hello world' menu.h main.c\n" +"\n" +"Selezione ed interpretazione delle regexp:\n" + +#: src/grep.c:1059 +msgid "" +" -E, --extended-regexp PATTERN is an extended regular expression\n" +" -F, --fixed-strings PATTERN is a set of newline-separated strings\n" +" -G, --basic-regexp PATTERN is a basic regular expression\n" +" -P, --perl-regexp PATTERN is a Perl regular expression\n" +msgstr "" +" -E, --extended-regexp il MODELLO è una regular expression estesa\n" +" -F, --fixed-strings il MODELLO è un insieme di stringhe separate da\n" +" newline\n" +" -G, --basic-regexp il MODELLO è una regular expression semplice\n" +" -P, --perl-regexp il MODELLO è una regular expression del perl\n" + +#: src/grep.c:1064 +msgid "" +" -e, --regexp=PATTERN use PATTERN as a regular expression\n" +" -f, --file=FILE obtain PATTERN from FILE\n" +" -i, --ignore-case ignore case distinctions\n" +" -w, --word-regexp force PATTERN to match only whole words\n" +" -x, --line-regexp force PATTERN to match only whole lines\n" +" -z, --null-data a data line ends in 0 byte, not newline\n" +msgstr "" +" -e, --regexp=MODELLO usa MODELLO come espressione regolare\n" +" -f, --file=FILE prende il MODELLO dal FILE\n" +" -i, --ignore-case ignora la distinzione tra maiuscole e minuscole\n" +" -w, --word-regexp forza MODELLO a corrispondere solo a parole intere\n" +" -x, --line-regexp forza MODELLO a corrispondere solo a righe intere\n" +" -z, --null-data una riga di dati termina con \\0 invece che newline\n" + +#: src/grep.c:1071 +msgid "" +"\n" +"Miscellaneous:\n" +" -s, --no-messages suppress error messages\n" +" -v, --invert-match select non-matching lines\n" +" -V, --version print version information and exit\n" +" --help display this help and exit\n" +" --mmap use memory-mapped input if possible\n" +msgstr "" +"\n" +"Varie:\n" +" -s, --no-messages elimina i messaggi di errore\n" +" -v, --invert-match seleziona le righe che non corrispondono\n" +" -V, --version stampa le informazioni sulla versione ed esce\n" +" --help mostra questo aiuto ed esce\n" +" --mmap se possibile mappa in memoria l'input\n" + +#: src/grep.c:1079 +msgid "" +"\n" +"Output control:\n" +" -m, --max-count=NUM stop after NUM matches\n" +" -b, --byte-offset print the byte offset with output lines\n" +" -n, --line-number print line number with output lines\n" +" --line-buffered flush output on every line\n" +" -H, --with-filename print the filename for each match\n" +" -h, --no-filename suppress the prefixing filename on output\n" +" --label=LABEL print LABEL as filename for standard input\n" +" -o, --only-matching show only the part of a line matching PATTERN\n" +" -q, --quiet, --silent suppress all normal output\n" +" --binary-files=TYPE assume that binary files are TYPE\n" +" TYPE is 'binary', 'text', or 'without-match'\n" +" -a, --text equivalent to --binary-files=text\n" +" -I equivalent to --binary-files=without-match\n" +" -d, --directories=ACTION how to handle directories\n" +" ACTION is 'read', 'recurse', or 'skip'\n" +" -D, --devices=ACTION how to handle devices, FIFOs and sockets\n" +" ACTION is 'read' or 'skip'\n" +" -R, -r, --recursive equivalent to --directories=recurse\n" +" --include=PATTERN files that match PATTERN will be examined\n" +" --exclude=PATTERN files that match PATTERN will be skipped.\n" +" --exclude-from=FILE files that match PATTERN in FILE will be skipped.\n" +" -L, --files-without-match only print FILE names containing no match\n" +" -l, --files-with-matches only print FILE names containing matches\n" +" -c, --count only print a count of matching lines per FILE\n" +" -Z, --null print 0 byte after FILE name\n" +msgstr "" +"\n" +"Controllo dell'output:\n" +" -m, --max-count=NUM si ferma dopo NUM corrispondenze\n" +" -b, --byte-offset stampa l'offset del byte con le righe di output\n" +" -n, --line-number stampa il numero della riga con le righe di output\n" +" --line-buffered fa il flush dell'output dopo ogni riga\n" +" -H, --with-filename stampa il nome del file per ogni corrispondenza\n" +" -h, --no-filename elimina il nome del file davanti all'output\n" +" --label=LABEL stampa LABEL al posto del nome del file per stdin\n" +" -o, --only-matching mostra solo la parte della riga corrispondente al\n" +" MODELLO\n" +" -q, --quiet, --silent elimina tutto il normale output\n" +" --binary-files=TIPO suppone che i file binari siano di TIPO 'binary',\n" +" 'text' oppure 'without-match'.\n" +" -a, --text equivalente a --binary-files=text\n" +" -I equivalente a --binary-files=without-match\n" +" -d, --directories=AZIONE come gestire le directory: AZIONE è 'read' (legge),\n" +" 'recurse' (ricorsivo) o 'skip' (salta)\n" +" -D, --devices=AZIONE come gestire device, FIFO e socket: AZIONE è\n" +" 'read' (legge) o 'skip' (salta) \n" +" -r, --recursive equivalente a --directories=recurse\n" +" --include=MODELLO esamina i file corrispondenti al MODELLO\n" +" --exclude=MODELLO salta i file corrispondenti al MODELLO\n" +" --exclude-from=FILE salta i file corrispondenti ai modelli nel FILE\n" +" -L, --files-without-match stampa solo i nomi dei FILE senza occorrenze\n" +" -l, --files-with-matches stampa solo i nomi dei FILE contenenti occorrenze\n" +" -c, --count stampa solo il conto delle righe occorrenti in ogni FILE\n" +" -Z, --null stampa il byte 0 dopo ogni nome di FILE\n" + +#: src/grep.c:1107 +msgid "" +"\n" +"Context control:\n" +" -B, --before-context=NUM print NUM lines of leading context\n" +" -A, --after-context=NUM print NUM lines of trailing context\n" +" -C, --context=NUM print NUM lines of output context\n" +" -NUM same as --context=NUM\n" +" --color[=WHEN],\n" +" --colour[=WHEN] use markers to distinguish the matching string\n" +" WHEN may be `always', `never' or `auto'.\n" +" -U, --binary do not strip CR characters at EOL (MSDOS)\n" +" -u, --unix-byte-offsets report offsets as if CRs were not there (MSDOS)\n" +"\n" +"`egrep' means `grep -E'. `fgrep' means `grep -F'.\n" +"With no FILE, or when FILE is -, read standard input. If less than\n" +"two FILEs given, assume -h. Exit status is 0 if match, 1 if no match,\n" +"and 2 if trouble.\n" +msgstr "" +"\n" +"Controllo del contesto:\n" +" -B, --before-context=NUM stampa NUM righe di contesto precedente\n" +" -A, --after-context=NUM stampa NUM righe di contesto seguente\n" +" -C, --context=NUM stampa NUM righe di contesto dell'output\n" +" -NUM come --context=NUM\n" +" --color[=QUANDO]\n" +" --colour[=QUANDO] usa i colori per distinguere la stringa corrispond.\n" +" QUANDO può essere 'always', 'never' o 'auto'.\n" +" -U, --binary non rimuove i caratteri CR all'EOL (MSDOS)\n" +" -u, --unix-byte-offsets segnala gli offset come se non ci fossero CR (MSDOS)\n" +"\n" +"`egrep' significa `grep -E'. `fgrep' significa `grep -F'.\n" +"Se non c'è un FILE, o il FILE è -, legge lo standard input. Se sono stati\n" +"specificati meno di due file presume -h. Esce con 0 se corrisponde, con 1 se\n" +"non corrisponde o con 2 se ci sono problemi.\n" + +#: src/grep.c:1124 +msgid "" +"\n" +"Report bugs to .\n" +msgstr "" +"\n" +"Segnalare i bug a .\n" + +#: src/grep.c:1134 +msgid "conflicting matchers specified" +msgstr "specificate corrispondenze in conflitto" + +#: src/grep.c:1376 +msgid "unknown devices method" +msgstr "metodo per i dispositivi sconosciuto" + +#: src/grep.c:1443 +msgid "unknown directories method" +msgstr "metodo per le directory sconosciuto" + +#: src/grep.c:1510 +msgid "invalid max count" +msgstr "numero massimo non valido" + +#: src/grep.c:1565 +msgid "unknown binary-files type" +msgstr "tipo di file binario sconosciuto" + +#: src/grep.c:1660 +#, c-format +msgid "%s (GNU grep) %s\n" +msgstr "%s (grep GNU) %s\n" + +#: src/grep.c:1662 +msgid "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" +msgstr "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" + +#: src/grep.c:1664 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +"\n" +"Questo è software libero; si veda il sorgente per le condizioni di copiatura.\n" +"NON c'è garanzia; neppure di COMMERCIABILITÀ o IDONEITÀ AD UN PARTICOLARE\n" +"SCOPO.\n" + +#: src/search.c:606 +msgid "The -P option is not supported" +msgstr "L'opzione -P non è gestita" + +#: src/search.c:619 +msgid "The -P and -z options cannot be combined" +msgstr "Le opzioni -P e -z non possono essere combinate" + +#: lib/error.c:117 +msgid "Unknown system error" +msgstr "Errore di sistema sconosciuto" + +#: lib/getopt.c:675 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: l'opzione `%s' è ambigua\n" + +#: lib/getopt.c:700 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: l'opzione `--%s' non accetta argomenti\n" + +#: lib/getopt.c:705 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: l'opzione `%c%s' non accetta argomenti\n" + +#: lib/getopt.c:723 lib/getopt.c:896 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: l'opzione `%s' richiede un argomento\n" + +#. --option +#: lib/getopt.c:752 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: opzione `--%s' non riconosciuta\n" + +#. +option or -option +#: lib/getopt.c:756 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: opzione `%c%s' non riconosciuta\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:782 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: opzione illegale -- %c\n" + +#: lib/getopt.c:785 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: opzione non valida -- %c\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:815 lib/getopt.c:945 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: l'opzione richiede un argomento -- %c\n" + +#: lib/getopt.c:862 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: l'opzione `-W %s' è ambigua\n" + +#: lib/getopt.c:880 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: l'opzione `-W %s' non accetta argomenti\n" + +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#: lib/quotearg.c:259 +msgid "`" +msgstr "`" + +#: lib/quotearg.c:260 +msgid "'" +msgstr "'" diff --git a/po/ja.po b/po/ja.po new file mode 100644 index 0000000..0369d75 --- /dev/null +++ b/po/ja.po @@ -0,0 +1,409 @@ +# Japanese messages for GNU grep +# Copyright (C) 1996, 1997, 2001, 2002 Free Software Foundation, Inc. +# IIDA Yosiaki , 1999, 2000, 2001, 2002. +# This file is distributed under the same license as the GNU grep package. +# Contributed by +# Yasuyuki Furukawa , 1997 +# and taken over on 1999-09-24 by IIDA. +# Special thanks to +# Daisuke Yamashita , 1999. +# +msgid "" +msgstr "" +"Project-Id-Version: GNU grep 2.5g\n" +"POT-Creation-Date: 2002-03-26 16:38+0100\n" +"PO-Revision-Date: 2002-04-06 11:34+09:00\n" +"Last-Translator: IIDA Yosiaki \n" +"Language-Team: Japanese \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=EUC-JP\n" +"Content-Transfer-Encoding: 8bit\n" +"Comments: This file is part of GNU grep.\n" + +#: src/dfa.c:136 src/dfa.c:147 src/dfa.c:158 src/search.c:689 +msgid "Memory exhausted" +msgstr "¥á¥â¥ê¡¼¤¬Â­¤ê¤Þ¤»¤ó" + +#: src/dfa.c:489 src/dfa.c:492 src/dfa.c:510 src/dfa.c:521 src/dfa.c:545 +#: src/dfa.c:604 src/dfa.c:609 src/dfa.c:622 src/dfa.c:623 src/dfa.c:1001 +#: src/dfa.c:1004 src/dfa.c:1028 src/dfa.c:1032 src/dfa.c:1033 src/dfa.c:1036 +#: src/dfa.c:1048 src/dfa.c:1049 +msgid "Unbalanced [" +msgstr "[ ¤¬Äà¤ê¹ç¤¤¤Þ¤»¤ó" + +#: src/dfa.c:741 +msgid "Unfinished \\ escape" +msgstr "\\ ¥¨¥¹¥±¡¼¥×¤¬½ªÎ»¤·¤Æ¤¤¤Þ¤»¤ó" + +#. Cases: +#. {M} - exact count +#. {M,} - minimum count, maximum is infinity +#. {M,N} - M through N +#: src/dfa.c:874 src/dfa.c:880 src/dfa.c:890 src/dfa.c:898 src/dfa.c:913 +msgid "unfinished repeat count" +msgstr "·«ÊÖ¤·¥«¥¦¥ó¥È¤¬½ªÎ»¤·¤Þ¤»¤ó" + +#: src/dfa.c:887 src/dfa.c:904 src/dfa.c:912 src/dfa.c:916 +msgid "malformed repeat count" +msgstr "·«ÊÖ¤·¥«¥¦¥ó¥È¤¬°Û¾ï¤Ç¤¹" + +#: src/dfa.c:1253 +msgid "Unbalanced (" +msgstr "( ¤¬Äà¤ê¹ç¤¤¤Þ¤»¤ó" + +#: src/dfa.c:1378 +msgid "No syntax specified" +msgstr "¹½Ê¸¤¬ÆÃÄꤵ¤ì¤Æ¤¤¤Þ¤»¤ó" + +#: src/dfa.c:1386 +msgid "Unbalanced )" +msgstr ") ¤¬Äà¤ê¹ç¤¤¤Þ¤»¤ó" + +#: src/dfa.c:2956 +msgid "out of memory" +msgstr "¥á¥â¥ê¡¼¤¬¤Ê¤¯¤Ê¤ê¤Þ¤·¤¿" + +#: src/kwset.c:171 src/kwset.c:177 src/search.c:103 src/search.c:209 +#: src/search.c:293 lib/obstack.c:471 +msgid "memory exhausted" +msgstr "¥á¥â¥ê¡¼¤¬Â­¤ê¤Þ¤»¤ó" + +#: src/grep.c:205 +msgid "invalid context length argument" +msgstr "¹Ô¿ô¤Î»ØÄ꤬´Ö°ã¤Ã¤Æ¤¤¤Þ¤¹" + +#: src/grep.c:479 +msgid "input is too large to count" +msgstr "ÆþÎϤ¬Â礭¤¹¤®¤Æ¿ô¤¨¤é¤ì¤Þ¤»¤ó" + +#: src/grep.c:605 +msgid "writing output" +msgstr "½ÐÎϤνñ¹þ¤ß" + +#: src/grep.c:878 +#, c-format +msgid "Binary file %s matches\n" +msgstr "¥Ð¥¤¥Ê¥ê¡¼¡¦¥Õ¥¡¥¤¥ë%s¤Ï°ìÃפ·¤Þ¤·¤¿\n" + +#: src/grep.c:892 +msgid "(standard input)" +msgstr "(ɸ½àÆþÎÏ)" + +#: src/grep.c:997 +#, c-format +msgid "warning: %s: %s\n" +msgstr "·Ù¹ð: %s: %s\n" + +#: src/grep.c:998 +msgid "recursive directory loop" +msgstr "¥Ç¥£¥ì¥¯¥È¥ê¡¼¤¬ºÆµ¢Åª¥ë¡¼¥×¤ò¤·¤Æ¤¤¤Þ¤¹" + +#: src/grep.c:1046 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE]...\n" +msgstr "»ÈÍÑË¡: %s [¥ª¥×¥·¥ç¥ó]¡Å¡Å ʸ»úÎó¥Ñ¥¿¡¼¥ó [¥Õ¥¡¥¤¥ë]¡Å¡Å\n" + +#: src/grep.c:1048 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "¾Ü¤·¤¯¤Ï`%s --help'¤ò¼Â¹Ô¤·¤Æ¤¯¤À¤µ¤¤¡£\n" + +#: src/grep.c:1053 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE] ...\n" +msgstr "»ÈÍÑË¡: %s [¥ª¥×¥·¥ç¥ó]¡Å¡Å ¥Ñ¥¿¡¼¥ó [¥Õ¥¡¥¤¥ë] ¡Å¡Å\n" + +#: src/grep.c:1054 +#, c-format +msgid "" +"Search for PATTERN in each FILE or standard input.\n" +"Example: %s -i 'hello world' menu.h main.c\n" +"\n" +"Regexp selection and interpretation:\n" +msgstr "" +"¡Ö¥Õ¥¡¥¤¥ë¡×¤â¤·¤¯¤Ïɸ½àÆþÎϤ«¤é¡Ö¥Ñ¥¿¡¼¥ó¡×¤Î¸¡º÷¤ò¹Ô¤Ê¤¦¡£\n" +"Îã: %s -i 'hello world' menu.h main.c\n" +"\n" +"Àµµ¬É½¸½¤ÎÁªÂò¤È²ò¼áÊýË¡:\n" + +#: src/grep.c:1059 +msgid "" +" -E, --extended-regexp PATTERN is an extended regular expression\n" +" -F, --fixed-strings PATTERN is a set of newline-separated strings\n" +" -G, --basic-regexp PATTERN is a basic regular expression\n" +" -P, --perl-regexp PATTERN is a Perl regular expression\n" +msgstr "" +" -E, --extended-regexp ¡Ö¥Ñ¥¿¡¼¥ó¡×¤ò³ÈÄ¥¤µ¤ì¤¿Àµµ¬É½¸½¤È¤¹¤ë\n" +" -F, --fixed-strings ¡Ö¥Ñ¥¿¡¼¥ó¡×¤ò²þ¹Ô¤Ç¶èÀÚ¤é¤ì¤¿¸ÇÄê¤Îʸ»úÎó¤È¤¹¤ë\n" +" -G, --basic-regexp ¡Ö¥Ñ¥¿¡¼¥ó¡×¤ò´ðËÜŪ¤ÊÀµµ¬É½¸½¤È¤¹¤ë\n" +" -P, --perl-regexp ¡Ö¥Ñ¥¿¡¼¥ó¡×¤òPerl¤ÎÀµµ¬É½¸½¤È¤¹¤ë\n" + +#: src/grep.c:1064 +msgid "" +" -e, --regexp=PATTERN use PATTERN as a regular expression\n" +" -f, --file=FILE obtain PATTERN from FILE\n" +" -i, --ignore-case ignore case distinctions\n" +" -w, --word-regexp force PATTERN to match only whole words\n" +" -x, --line-regexp force PATTERN to match only whole lines\n" +" -z, --null-data a data line ends in 0 byte, not newline\n" +msgstr "" +" -e, --regexp=¥Ñ¥¿¡¼¥ó Àµµ¬É½¸½¤Ë»ØÄê¥Ñ¥¿¡¼¥ó¤ò»È¤¦\n" +" -f, --file=¥Õ¥¡¥¤¥ë ¡Ö¥Ñ¥¿¡¼¥ó¡×¤ò»ØÄê¥Õ¥¡¥¤¥ë¤«¤éÆɤà\n" +" -i, --ignore-case Âçʸ»ú/¾®Ê¸»ú¤ò̵»ë¤¹¤ë\n" +" -w, --word-regexp ¡Ö¥Ñ¥¿¡¼¥ó¡×°ìÃפòñ¸ìÁ´ÂÎ(ñ¸ìñ°Ì)¤Ç¹Ô¤Ê¤¦\n" +" -x, --line-regexp ¡Ö¥Ñ¥¿¡¼¥ó¡×°ìÃפò¹ÔÁ´ÂÎ(¹Ôñ°Ì)¤Ç¹Ô¤Ê¤¦\n" +" -z, --null-data ½ÐÎϤò²þ¹Ô¤Ç¤Ê¤¯¡¢¥Ì¥ëÃͤΥХ¤¥È¤Ç¶èÀÚ¤ë\n" + +#: src/grep.c:1071 +msgid "" +"\n" +"Miscellaneous:\n" +" -s, --no-messages suppress error messages\n" +" -v, --invert-match select non-matching lines\n" +" -V, --version print version information and exit\n" +" --help display this help and exit\n" +" --mmap use memory-mapped input if possible\n" +msgstr "" +"\n" +"¤½¤Î¾:\n" +" -s, --no-messages ¥¨¥é¡¼¡¦¥á¥Ã¥»¡¼¥¸¤òÍ޻ߤ¹¤ë\n" +" -v, --invert-match °ìÃפ·¤Ê¤¤¹Ô¤òÂоݤˤ¹¤ë\n" +" -V --version ¥Ð¡¼¥¸¥ç¥ó¾ðÊó¤òɸ½à½ÐÎϤËɽ¼¨¤·¤Æ½ªÎ»¤¹¤ë\n" +" --help »È¤¤Êý¤òɸ½à½ÐÎϤËɽ¼¨¤¹¤ë\n" +" --mmap ¤â¤·²Äǽ¤Ê¤é¡¢ÆþÎϤò¥á¥â¥ê¡¼¡¦¥Þ¥Ã¥×¤¹¤ë\n" + +#: src/grep.c:1079 +msgid "" +"\n" +"Output control:\n" +" -m, --max-count=NUM stop after NUM matches\n" +" -b, --byte-offset print the byte offset with output lines\n" +" -n, --line-number print line number with output lines\n" +" --line-buffered flush output on every line\n" +" -H, --with-filename print the filename for each match\n" +" -h, --no-filename suppress the prefixing filename on output\n" +" --label=LABEL print LABEL as filename for standard input\n" +" -o, --only-matching show only the part of a line matching PATTERN\n" +" -q, --quiet, --silent suppress all normal output\n" +" --binary-files=TYPE assume that binary files are TYPE\n" +" TYPE is 'binary', 'text', or 'without-match'\n" +" -a, --text equivalent to --binary-files=text\n" +" -I equivalent to --binary-files=without-match\n" +" -d, --directories=ACTION how to handle directories\n" +" ACTION is 'read', 'recurse', or 'skip'\n" +" -D, --devices=ACTION how to handle devices, FIFOs and sockets\n" +" ACTION is 'read' or 'skip'\n" +" -R, -r, --recursive equivalent to --directories=recurse\n" +" --include=PATTERN files that match PATTERN will be examined\n" +" --exclude=PATTERN files that match PATTERN will be skipped.\n" +" --exclude-from=FILE files that match PATTERN in FILE will be skipped.\n" +" -L, --files-without-match only print FILE names containing no match\n" +" -l, --files-with-matches only print FILE names containing matches\n" +" -c, --count only print a count of matching lines per FILE\n" +" -Z, --null print 0 byte after FILE name\n" +msgstr "" +"\n" +"½ÐÎÏÀ©¸æ:\n" +" -m, --max-count=²ó¿ô »ØÄꤷ¤¿°ìÃײó¿ô¤Î¸å¡¢½ªÎ»¤¹¤ë\n" +" -b, --byte-offset ½ÐÎϹԤ˥Х¤¥È¡¦¥ª¥Õ¥»¥Ã¥È¤âɽ¼¨¤¹¤ë\n" +" -n, --line-number ½ÐÎϹԤ˹Կô¤âɽ¼¨¤¹¤ë\n" +" --line-buffered ¹Ô¤´¤È¤Ë½ÐÎϤòÁݤ­½Ð¤¹\n" +" -H, --with-filename ³Æ°ìÃפˤ¿¤¤¤·¤Æ¤½¤Î¥Õ¥¡¥¤¥ë̾¤âɽ¼¨¤¹¤ë\n" +" -h, --no-filename Á°¤Î¥Õ¥¡¥¤¥ë̾¤ò½ÐÎϤ«¤éÍ޻ߤ¹¤ë\n" +" --label=¥é¥Ù¥ë ¥é¥Ù¥ë¤ò¥Õ¥¡¥¤¥ë̾¤È¤·¤Æɸ½à½ÐÎϤËɽ¼¨¤¹¤ë\n" +" -o, --only-matching ¥Ñ¥¿¡¼¥ó¤È°ìÃפ¹¤ë¹Ô¤ÎÉôʬ¤À¤±¤ò¼¨¤¹\n" +" -q, --quiet, --silent Ä̾ï¤Î½ÐÎϤò¤¹¤Ù¤ÆÍ޻ߤ¹¤ë\n" +" --binary-files=·¿ ¥Ð¥¤¥Ê¥ê¡¼¡¦¥Õ¥¡¥¤¥ë¤Î·¿¡£¡Öbinary¡×\n" +" ¡Ötext¡×¡Öwithout-match¡×¤ò»ØÄê\n" +" -a, --text --binary-files=text¤ÈƱ¤¸\n" +" -I --binary-files=without-match¤ÈƱ¤¸\n" +" -d, --directories=Áàºî ¥Ç¥£¥ì¥¯¥È¥ê¡¼¤Ø¤ÎÁàºî\n" +" ¡Öread¡×(Æɹþ¤ß)¡¢¡Örecurse¡×(ºÆµ¢)¡¢\n" +" ¡Öskip¡×(¾Êά) ¤Î¤¤¤º¤ì¤«¤ò»ØÄê\n" +" -D, --devices=Áàºî ¥Ç¥Ð¥¤¥¹¡¢FIFO¡¢¥½¥±¥Ã¥È¤Ø¤ÎÁàºî\n" +" ¡Öread¡×¤«¡Öskip¡×¤ò»ØÄê\n" +" -R, -r, --recursive --directories=recurse¤ÈƱ¤¸\n" +" --include=¥Ñ¥¿¡¼¥ó ¥Ñ¥¿¡¼¥ó¤È°ìÃפ¹¤ë¥Õ¥¡¥¤¥ë¤ò¸¡ºº¤¹¤ë\n" +" --exclude=¥Ñ¥¿¡¼¥ó ¥Ñ¥¿¡¼¥ó¤È°ìÃפ¹¤ë¥Õ¥¡¥¤¥ë¤ò¾Êά¤¹¤ë¡£\n" +" --exclude-from=¥Õ¥¡¥¤¥ë »ØÄꤷ¤¿¥Õ¥¡¥¤¥ëÆâ¤Î¥Ñ¥¿¡¼¥ó¤È\n" +" °ìÃפ¹¤ë¥Õ¥¡¥¤¥ë¤ò¾Êά¤¹¤ë¡£\n" +" -L, --files-without-match °ìÃפΤʤ«¤Ã¤¿¥Õ¥¡¥¤¥ë̾¤Î¤ß¤òɽ¼¨¤¹¤ë\n" +" -l, --files-with-matches °ìÃפ·¤¿¥Õ¥¡¥¤¥ë̾¤Î¤ß¤òɽ¼¨¤¹¤ë\n" +" -c, --count ¥Õ¥¡¥¤¥ë¤´¤È¤Ë°ìÃפ·¤¿¹Ô¿ô¤Î¤ß¤òɽ¼¨¤¹¤ë\n" +" -Z, --null ¥Õ¥¡¥¤¥ë̾¤Î¸å¤Ë¡¢¥Ì¥ëÃͤΥХ¤¥È¤òɽ¼¨\n" + +#: src/grep.c:1107 +msgid "" +"\n" +"Context control:\n" +" -B, --before-context=NUM print NUM lines of leading context\n" +" -A, --after-context=NUM print NUM lines of trailing context\n" +" -C, --context=NUM print NUM lines of output context\n" +" -NUM same as --context=NUM\n" +" --color[=WHEN],\n" +" --colour[=WHEN] use markers to distinguish the matching string\n" +" WHEN may be `always', `never' or `auto'.\n" +" -U, --binary do not strip CR characters at EOL (MSDOS)\n" +" -u, --unix-byte-offsets report offsets as if CRs were not there (MSDOS)\n" +"\n" +"`egrep' means `grep -E'. `fgrep' means `grep -F'.\n" +"With no FILE, or when FILE is -, read standard input. If less than\n" +"two FILEs given, assume -h. Exit status is 0 if match, 1 if no match,\n" +"and 2 if trouble.\n" +msgstr "" +"\n" +"Á°¸å´Ø·¸¤ÎÀ©¸æ:\n" +" -B, --before-context=¿ô °ìÃ×Á°¤Î¡Ö¿ô¡×¹Ô¤â½ÐÎϤ¹¤ë\n" +" -A, --after-context=¿ô °ìÃ׸å¤Î¡Ö¿ô¡×¹Ô¤â½ÐÎϤ¹¤ë\n" +" -C, --context=¹Ô¿ô °ìÃ×Á°¸å¤Î»ØÄê¹Ô¿ô¤ÎÆâÍƤâ½ÐÎϤ¹¤ë\n" +" -¹Ô¿ô --context=¹Ô¿ô ¤ÈƱ¤¸\n" +" --color[=¾ì¹ç]\n" +" --colour[=¾ì¹ç] °ìÃפ¹¤ëʸ»úÎó¤òÌÜΩ¤¿¤»¤ë¥Þ¡¼¥«¡¼¤ò»È¤¦\n" +" ¡Ö¾ì¹ç¡×¤Ë¤Ï¡¢¡Öalways¡×¡Önever¡×¡Öauto¡×¤ò»ØÄê¡£\n" +" -U, --binary EOL¤Ç¤ÎCRʸ»ú¤ò¼è¤ê¾Ê¤«¤Ê¤¤(MS-DOS)\n" +" -u, --unix-byte-offsets CRʸ»ú¤¬¤Ê¤¤¤â¤Î¤È¤·¤Æ¥ª¥Õ¥»¥Ã¥È¤ò\n" +" ½ÐÎϤ¹¤ë(MS-DOS)\n" +"\n" +"¡Öegrep¡×¤Ï¡Ögrep -E¡×¤Î¤³¤È¤Ç¤¹¡£¡Öfgrep¡×¤Ï¡Ögrep -F¡×¤Î¤³¤È¤Ç¤¹¡£\n" +"¡Ö¥Õ¥¡¥¤¥ë¡×¤Î»ØÄ꤬¤Ê¤«¤Ã¤¿¤ê¡¢¡Ö¥Õ¥¡¥¤¥ë¡×¤Ë¡Ö-¡×¤ò»ØÄꤷ¤¿¤ê¤¹¤ë¤È¡¢\n" +"ɸ½àÆþÎϤ«¤éÆɤ߹þ¤ß¤Þ¤¹¡£¡Ö¥Õ¥¡¥¤¥ë¡×¤Î¸Ä¿ô¤¬1°Ê²¼¤Î¾ì¹ç¡¢-h¤È²¾Äꤷ¤Þ¤¹¡£\n" +"¤â¤·°ìÃפ¬¤¢¤ë¤È0¤Ç¡¢¤Ê¤¤¤È1¤Ç¡¢¾ã³²¤¬¤¢¤ë¤È2¤Ç¡¢½ªÎ»¤·¤Þ¤¹¡£\n" + +#: src/grep.c:1124 +#, fuzzy +msgid "" +"\n" +"Report bugs to .\n" +msgstr "" +"\n" +"¥Ð¥°¤Ï ¤ØÊó¹ð¤·¤Æ¤¯¤À¤µ¤¤¡£\n" + +#: src/grep.c:1134 +msgid "conflicting matchers specified" +msgstr "»ØÄꤷ¤¿¾È¹ç»Ò¤¬¾×Æͤ·¤Æ¤¤¤Þ¤¹" + +#: src/grep.c:1376 +msgid "unknown devices method" +msgstr "̤ÃΤΥǥХ¤¥¹Áàºî¤Ç¤¹" + +#: src/grep.c:1443 +msgid "unknown directories method" +msgstr "̤ÃΤΥǥ£¥ì¥¯¥È¥ê¡¼Áàºî¤Ç¤¹" + +#: src/grep.c:1510 +msgid "invalid max count" +msgstr "°ìÃײó¿ô¤¬´Ö°ã¤Ã¤Æ¤¤¤Þ¤¹" + +#: src/grep.c:1565 +msgid "unknown binary-files type" +msgstr "̤ÃΤΥХ¤¥Ê¥ê¡¼¡¦¥Õ¥¡¥¤¥ë¤Î·¿¤Ç¤¹" + +#: src/grep.c:1660 +#, c-format +msgid "%s (GNU grep) %s\n" +msgstr "%s (GNU grep) %s\n" + +#: src/grep.c:1662 +msgid "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" +msgstr "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" + +#: src/grep.c:1664 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"¤³¤ì¤Ï¥Õ¥ê¡¼¡¦¥½¥Õ¥È¥¦¥§¥¢¤Ç¤¹¡£Ê£À½¤Ë´Ø¤¹¤ë¾ò·ï¤Ï¥½¡¼¥¹¤ò¤´Í÷¤¯¤À¤µ¤¤¡£\n" +"¤³¤ì¤Ï̵ÊݾڤǤ¹¡£±ÄÍøÌÜŪ¤ä¤¢¤ëÆÃÄê¤ÎÌÜŪ¤Ë¤à¤±¤¿Å¬Àµ¤Î¤â¤Î¤Ç¤â¤¢¤ê¤Þ¤»¤ó¡£\n" + +#: src/search.c:606 +msgid "The -P option is not supported" +msgstr "-P¥ª¥×¥·¥ç¥ó¤Ï¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Þ¤»¤ó" + +#: src/search.c:619 +msgid "The -P and -z options cannot be combined" +msgstr "-P¤È-z¤Î¥ª¥×¥·¥ç¥ó¤ÎÁȹ礻¤Ï¤Ç¤­¤Þ¤»¤ó" + +#: lib/error.c:117 +msgid "Unknown system error" +msgstr "̤ÃΤΥ·¥¹¥Æ¥à¡¦¥¨¥é¡¼¤Ç¤¹" + +#: lib/getopt.c:675 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: ¥ª¥×¥·¥ç¥ó¤Î»ØÄê`%s'¤¬Û£Ëæ¤Ç¤¹\n" + +#: lib/getopt.c:700 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: ¥ª¥×¥·¥ç¥ó`--%s'¤Ï°ú¿ô¤ò¤È¤ê¤Þ¤»¤ó\n" + +#: lib/getopt.c:705 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: ¥ª¥×¥·¥ç¥ó`%c%s'¤Ï°ú¿ô¤ò¤È¤ê¤Þ¤»¤ó\n" + +#: lib/getopt.c:723 lib/getopt.c:896 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: ¥ª¥×¥·¥ç¥ó`-%s'¤Ë¤Ï°ú¿ô¤¬É¬ÍפǤ¹\n" + +#. --option +#: lib/getopt.c:752 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: ¥ª¥×¥·¥ç¥ó`--%s'¤òǧ¼±¤Ç¤­¤Þ¤»¤ó\n" + +#. +option or -option +#: lib/getopt.c:756 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: ¥ª¥×¥·¥ç¥ó`%c%s'¤òǧ¼±¤Ç¤­¤Þ¤»¤ó\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:782 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: ¥ª¥×¥·¥ç¥ó¤¬´Ö°ã¤Ã¤Æ¤¤¤Þ¤¹ -- %c\n" + +#: lib/getopt.c:785 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: ¥ª¥×¥·¥ç¥ó¤¬ÉÔÀµ¤Ç¤¹ -- %c\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:815 lib/getopt.c:945 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: ¥ª¥×¥·¥ç¥ó`-%c'¤Ë¤Ï°ú¿ô¤¬É¬ÍפǤ¹\n" + +#: lib/getopt.c:862 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: ¥ª¥×¥·¥ç¥ó¤Î»ØÄê`-W %s'¤¬Û£Ëæ¤Ç¤¹\n" + +#: lib/getopt.c:880 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: ¥ª¥×¥·¥ç¥ó`-W %s'¤Ï°ú¿ô¤ò¤È¤ê¤Þ¤»¤ó\n" + +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#: lib/quotearg.c:259 +msgid "`" +msgstr "¡È" + +#: lib/quotearg.c:260 +msgid "'" +msgstr "¡É" diff --git a/po/ko.po b/po/ko.po new file mode 100644 index 0000000..d3511a3 --- /dev/null +++ b/po/ko.po @@ -0,0 +1,462 @@ +# Korean messages for GNU grep. +# Copyright (C) 1996, 1997 Free Software Foundation, Inc. +# Bang Jun-Young , 1996-1997. +# +msgid "" +msgstr "" +"Project-Id-Version: GNU grep 2.0f\n" +"POT-Creation-Date: 2002-03-26 16:38+0100\n" +"PO-Revision-Date: 1997-09-03 11:19+0900\n" +"Last-Translator: Bang Jun-Young \n" +"Language-Team: Korean \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=EUC-KR\n" +"Content-Transfer-Encoding: 8-bit\n" + +#: src/dfa.c:136 src/dfa.c:147 src/dfa.c:158 src/search.c:689 +msgid "Memory exhausted" +msgstr "¸Þ¸ð¸®°¡ ¹Ù´Ú³²" + +#: src/dfa.c:489 src/dfa.c:492 src/dfa.c:510 src/dfa.c:521 src/dfa.c:545 +#: src/dfa.c:604 src/dfa.c:609 src/dfa.c:622 src/dfa.c:623 src/dfa.c:1001 +#: src/dfa.c:1004 src/dfa.c:1028 src/dfa.c:1032 src/dfa.c:1033 src/dfa.c:1036 +#: src/dfa.c:1048 src/dfa.c:1049 +msgid "Unbalanced [" +msgstr "¦ÀÌ ¸ÂÁö ¾Ê´Â [" + +#: src/dfa.c:741 +msgid "Unfinished \\ escape" +msgstr "¿Ï°áµÇÁö ¾ÊÀº \\ À̽ºÄÉÀÌÇÁ" + +#. Cases: +#. {M} - exact count +#. {M,} - minimum count, maximum is infinity +#. {M,N} - M through N +#: src/dfa.c:874 src/dfa.c:880 src/dfa.c:890 src/dfa.c:898 src/dfa.c:913 +msgid "unfinished repeat count" +msgstr "¿Ï°áµÇÁö ¾ÊÀº ¹Ýº¹ ȸ¼ö" + +#: src/dfa.c:887 src/dfa.c:904 src/dfa.c:912 src/dfa.c:916 +msgid "malformed repeat count" +msgstr "À߸ø ÁÖ¾îÁø ¹Ýº¹ ȸ¼ö" + +#: src/dfa.c:1253 +msgid "Unbalanced (" +msgstr "¦ÀÌ ¸ÂÁö ¾Ê´Â (" + +#: src/dfa.c:1378 +msgid "No syntax specified" +msgstr "¹®¹ýÀÌ ÁöÁ¤µÇÁö ¾Ê¾ÒÀ½" + +#: src/dfa.c:1386 +msgid "Unbalanced )" +msgstr "¦ÀÌ ¸ÂÁö ¾Ê´Â )" + +#: src/dfa.c:2956 +msgid "out of memory" +msgstr "¸Þ¸ð¸® ºÎÁ·" + +#: src/kwset.c:171 src/kwset.c:177 src/search.c:103 src/search.c:209 +#: src/search.c:293 lib/obstack.c:471 +msgid "memory exhausted" +msgstr "¸Þ¸ð¸®°¡ ¹Ù´Ú³²" + +#: src/grep.c:205 +msgid "invalid context length argument" +msgstr "" + +#: src/grep.c:479 +msgid "input is too large to count" +msgstr "" + +#: src/grep.c:605 +msgid "writing output" +msgstr "Ãâ·ÂÀ» ±â·ÏÇÏ°í ÀÖ½À´Ï´Ù" + +#: src/grep.c:878 +#, c-format +msgid "Binary file %s matches\n" +msgstr "" + +#: src/grep.c:892 +msgid "(standard input)" +msgstr "(Ç¥ÁØ ÀÔ·Â)" + +#: src/grep.c:997 +#, fuzzy, c-format +msgid "warning: %s: %s\n" +msgstr "%s: °æ°í: %s: %s\n" + +#: src/grep.c:998 +msgid "recursive directory loop" +msgstr "" + +#: src/grep.c:1046 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE]...\n" +msgstr "»ç¿ë¹ý: %s [¿É¼Ç]... ÆÐÅÏ [ÆÄÀÏ]...\n" + +#: src/grep.c:1048 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "´õ ¸¹Àº Á¤º¸¸¦ º¸·Á¸é `%s --help' ÇϽʽÿÀ.\n" + +#: src/grep.c:1053 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE] ...\n" +msgstr "»ç¿ë¹ý: %s [¿É¼Ç]... ÆÐÅÏ [ÆÄÀÏ] ...\n" + +#: src/grep.c:1054 +#, c-format +msgid "" +"Search for PATTERN in each FILE or standard input.\n" +"Example: %s -i 'hello world' menu.h main.c\n" +"\n" +"Regexp selection and interpretation:\n" +msgstr "" + +#: src/grep.c:1059 +msgid "" +" -E, --extended-regexp PATTERN is an extended regular expression\n" +" -F, --fixed-strings PATTERN is a set of newline-separated strings\n" +" -G, --basic-regexp PATTERN is a basic regular expression\n" +" -P, --perl-regexp PATTERN is a Perl regular expression\n" +msgstr "" + +#: src/grep.c:1064 +msgid "" +" -e, --regexp=PATTERN use PATTERN as a regular expression\n" +" -f, --file=FILE obtain PATTERN from FILE\n" +" -i, --ignore-case ignore case distinctions\n" +" -w, --word-regexp force PATTERN to match only whole words\n" +" -x, --line-regexp force PATTERN to match only whole lines\n" +" -z, --null-data a data line ends in 0 byte, not newline\n" +msgstr "" + +#: src/grep.c:1071 +msgid "" +"\n" +"Miscellaneous:\n" +" -s, --no-messages suppress error messages\n" +" -v, --invert-match select non-matching lines\n" +" -V, --version print version information and exit\n" +" --help display this help and exit\n" +" --mmap use memory-mapped input if possible\n" +msgstr "" + +#: src/grep.c:1079 +msgid "" +"\n" +"Output control:\n" +" -m, --max-count=NUM stop after NUM matches\n" +" -b, --byte-offset print the byte offset with output lines\n" +" -n, --line-number print line number with output lines\n" +" --line-buffered flush output on every line\n" +" -H, --with-filename print the filename for each match\n" +" -h, --no-filename suppress the prefixing filename on output\n" +" --label=LABEL print LABEL as filename for standard input\n" +" -o, --only-matching show only the part of a line matching PATTERN\n" +" -q, --quiet, --silent suppress all normal output\n" +" --binary-files=TYPE assume that binary files are TYPE\n" +" TYPE is 'binary', 'text', or 'without-match'\n" +" -a, --text equivalent to --binary-files=text\n" +" -I equivalent to --binary-files=without-match\n" +" -d, --directories=ACTION how to handle directories\n" +" ACTION is 'read', 'recurse', or 'skip'\n" +" -D, --devices=ACTION how to handle devices, FIFOs and sockets\n" +" ACTION is 'read' or 'skip'\n" +" -R, -r, --recursive equivalent to --directories=recurse\n" +" --include=PATTERN files that match PATTERN will be examined\n" +" --exclude=PATTERN files that match PATTERN will be skipped.\n" +" --exclude-from=FILE files that match PATTERN in FILE will be skipped.\n" +" -L, --files-without-match only print FILE names containing no match\n" +" -l, --files-with-matches only print FILE names containing matches\n" +" -c, --count only print a count of matching lines per FILE\n" +" -Z, --null print 0 byte after FILE name\n" +msgstr "" + +#: src/grep.c:1107 +msgid "" +"\n" +"Context control:\n" +" -B, --before-context=NUM print NUM lines of leading context\n" +" -A, --after-context=NUM print NUM lines of trailing context\n" +" -C, --context=NUM print NUM lines of output context\n" +" -NUM same as --context=NUM\n" +" --color[=WHEN],\n" +" --colour[=WHEN] use markers to distinguish the matching string\n" +" WHEN may be `always', `never' or `auto'.\n" +" -U, --binary do not strip CR characters at EOL (MSDOS)\n" +" -u, --unix-byte-offsets report offsets as if CRs were not there (MSDOS)\n" +"\n" +"`egrep' means `grep -E'. `fgrep' means `grep -F'.\n" +"With no FILE, or when FILE is -, read standard input. If less than\n" +"two FILEs given, assume -h. Exit status is 0 if match, 1 if no match,\n" +"and 2 if trouble.\n" +msgstr "" + +#: src/grep.c:1124 +#, fuzzy +msgid "" +"\n" +"Report bugs to .\n" +msgstr "¹®Á¦Á¡Àº ·Î º¸°íÇØ ÁֽʽÿÀ.\n" + +#: src/grep.c:1134 +#, fuzzy +msgid "conflicting matchers specified" +msgstr "¦ÀÌ ÀÌ¹Ì ÁöÁ¤µÇ¾úÀ½" + +#: src/grep.c:1376 +msgid "unknown devices method" +msgstr "" + +#: src/grep.c:1443 +msgid "unknown directories method" +msgstr "" + +#: src/grep.c:1510 +#, fuzzy +msgid "invalid max count" +msgstr "¿Ï°áµÇÁö ¾ÊÀº ¹Ýº¹ ȸ¼ö" + +#: src/grep.c:1565 +msgid "unknown binary-files type" +msgstr "" + +#: src/grep.c:1660 +#, fuzzy, c-format +msgid "%s (GNU grep) %s\n" +msgstr "grep (GNU grep) %s\n" + +#: src/grep.c:1662 +#, fuzzy +msgid "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" +msgstr "ÀúÀÛ±Ç (C) 1988, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.\n" + +#: src/grep.c:1664 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"ÀÌ ÇÁ·Î±×·¥Àº °ø°³ ¼ÒÇÁÆ®¿þ¾îÀÔ´Ï´Ù. º¹»ç¿¡ °üÇÑ Á¶°ÇÀº ¼Ò½º¸¦ ÂüÁ¶ÇϽʽÿÀ.\n" +"»óÇ°¼ºÀ̳ª ƯÁ¤ ¸ñÀû¿¡ ´ëÇÑ ÀûÇÕ¼ºÀ» ºñ·ÔÇÏ¿©, ¾î¶°ÇÑ º¸Áõµµ ÇÏÁö ¾Ê½À´Ï´Ù.\n" + +#: src/search.c:606 +msgid "The -P option is not supported" +msgstr "" + +#: src/search.c:619 +msgid "The -P and -z options cannot be combined" +msgstr "" + +#: lib/error.c:117 +msgid "Unknown system error" +msgstr "" + +#: lib/getopt.c:675 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: `%s'´Â ¸ðÈ£ÇÑ ¿É¼ÇÀÔ´Ï´Ù\n" + +#: lib/getopt.c:700 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: `--%s' ¿É¼ÇÀº Àμö¸¦ Çã¿ëÇÏÁö ¾Ê½À´Ï´Ù\n" + +#: lib/getopt.c:705 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: `%c%s' ¿É¼ÇÀº Àμö¸¦ Çã¿ëÇÏÁö ¾Ê½À´Ï´Ù\n" + +#: lib/getopt.c:723 lib/getopt.c:896 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: `%s' ¿É¼ÇÀº Àμö°¡ ÇÊ¿äÇÕ´Ï´Ù\n" + +#. --option +#: lib/getopt.c:752 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: ÀνÄÇÒ ¼ö ¾ø´Â ¿É¼Ç `--%s'\n" + +#. +option or -option +#: lib/getopt.c:756 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: ÀνÄÇÒ ¼ö ¾ø´Â ¿É¼Ç `%c%s'\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:782 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: À߸øµÈ ¿É¼Ç -- %c\n" + +#: lib/getopt.c:785 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: ºÎÀûÀýÇÑ ¿É¼Ç -- %c\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:815 lib/getopt.c:945 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: ÀÌ ¿É¼ÇÀº Àμö°¡ ÇÊ¿äÇÕ´Ï´Ù -- %c\n" + +#: lib/getopt.c:862 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: `-W %s'´Â ¸ðÈ£ÇÑ ¿É¼ÇÀÔ´Ï´Ù\n" + +#: lib/getopt.c:880 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: `-W %s' ¿É¼ÇÀº Àμö¸¦ Çã¿ëÇÏÁö ¾Ê½À´Ï´Ù\n" + +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#: lib/quotearg.c:259 +msgid "`" +msgstr "" + +#: lib/quotearg.c:260 +msgid "'" +msgstr "" + +#~ msgid "option %s" +#~ msgstr "%s ¿É¼Ç" + +#~ msgid " with arg %s" +#~ msgstr " %s Àμö¸¦ °¡Áü" + +#~ msgid "digits occur in two different argv-elements.\n" +#~ msgstr "¼ýÀÚ°¡ ¼­·Î ´Ù¸¥ µÎ ±ºµ¥ÀÇ argv ¿ø¼Ò¿¡¼­ ¹ß°ßµÇ¾ú½À´Ï´Ù.\n" + +#~ msgid "option %c\n" +#~ msgstr "%c ¿É¼Ç\n" + +#~ msgid "option a\n" +#~ msgstr "a ¿É¼Ç\n" + +#~ msgid "option b\n" +#~ msgstr "b ¿É¼Ç\n" + +#~ msgid "option c with value `%s'\n" +#~ msgstr "`%s'¸¦ °ªÀ¸·Î °®´Â c ¿É¼Ç\n" + +#~ msgid "option d with value `%s'\n" +#~ msgstr "`%s'¸¦ °ªÀ¸·Î °®´Â d ¿É¼Ç\n" + +#~ msgid "?? getopt returned character code 0%o ??\n" +#~ msgstr "?? getopt°¡ ¹®ÀÚ ÄÚµå 0%o¸¦ µ¹·ÁÁÖ¾ú½À´Ï´Ù ??\n" + +#~ msgid "non-option ARGV-elements: " +#~ msgstr "ºñ¿É¼Ç ARGV ¿ø¼Ò: " + +#~ msgid "you may specify only one of -E, -F, or -G" +#~ msgstr "-E, -F, -G Áß¿¡¼­ Çϳª¸¸ ÁöÁ¤ÇÒ ¼ö ÀÖ½À´Ï´Ù" + +#~ msgid "memory exhausted\n" +#~ msgstr "¸Þ¸ð¸®°¡ ¹Ù´Ú³²\n" + +#~ msgid "Regexp selection and interpretation:\n" +#~ msgstr "Á¤±Ô½Ä ¼±Åðú Çؼ®:\n" + +#~ msgid " -E, --extended-regexp PATTERN is an extended regular expression\n" +#~ msgstr " -E, --extended-regexp ÆÐÅÏÀº È®Àå Á¤±Ô½ÄÀÌ µË´Ï´Ù\n" + +#~ msgid " -F, --fixed-strings PATTERN is a fixed string separated by newlines\n" +#~ msgstr " -F, --fixed-strings ÆÐÅÏÀº ÁÙ¹Ù²Þ ¹®ÀÚ·Î ºÐ¸®µÈ °íÁ¤ ¹®ÀÚ¿­ÀÌ µË´Ï´Ù\n" + +#~ msgid " -G, --basic-regexp PATTERN is a basic regular expression\n" +#~ msgstr " -G, --basic-regexp ÆÐÅÏÀº ±âº» Á¤±Ô½ÄÀÌ µË´Ï´Ù\n" + +#~ msgid " -e, --regexp=PATTERN use PATTERN as a regular expression\n" +#~ msgstr " -e, --regexp=ÆÐÅÏ ÆÐÅÏÀ» Á¤±Ô½ÄÀ¸·Î »ç¿ëÇÕ´Ï´Ù\n" + +#~ msgid " -f, --file=FILE obtain PATTERN from FILE\n" +#~ msgstr " -f, --file=ÆÄÀÏ ÆÐÅÏÀ» ÆÄÀÏ¿¡¼­ °¡Á®¿É´Ï´Ù\n" + +#~ msgid " -i, --ignore-case ignore case distinctions\n" +#~ msgstr " -i, --ignore-case ´ë¼Ò¹®ÀÚ ±¸º°À» ¹«½ÃÇÕ´Ï´Ù\n" + +#~ msgid " -w, --word-regexp force PATTERN to match only whole words\n" +#~ msgstr " -w, --word-regexp ÆÐÅÏÀ» Àüü ´Ü¾î¿Í ÀÏÄ¡ÇÏ´Â °ÍÀ¸·Î¸¸ Á¦ÇÑÇÕ´Ï´Ù\n" + +#~ msgid " -x, --line-regexp force PATTERN to match only whole lines\n" +#~ msgstr " -x, --line-regexp ÆÐÅÏÀ» Àüü Çà°ú ÀÏÄ¡ÇÏ´Â °ÍÀ¸·Î¸¸ Á¦ÇÑÇÕ´Ï´Ù\n" + +#~ msgid "Miscellaneous:\n" +#~ msgstr "±âŸ:\n" + +#~ msgid " -s, --no-messages suppress error messages\n" +#~ msgstr " -s, --no-messages ¿À·ù ¸Þ½ÃÁö¸¦ Ç¥½ÃÇÏÁö ¾Ê½À´Ï´Ù\n" + +#~ msgid " -v, --revert-match select non-matching lines\n" +#~ msgstr " -v, --revert-match ÀÏÄ¡ÇÏÁö ¾Ê´Â ÇàµéÀ» ¼±ÅÃÇÕ´Ï´Ù\n" + +#~ msgid " -V, --version print version information and exit\n" +#~ msgstr " -V, --version ¹öÀü Á¤º¸¸¦ Ç¥½ÃÇÏ°í Á¾·áÇÕ´Ï´Ù\n" + +#~ msgid " --help display this help and exit\n" +#~ msgstr " --help ÀÌ µµ¿ò¸»À» Ç¥½ÃÇÏ°í Á¾·áÇÕ´Ï´Ù\n" + +#~ msgid "Output control:\n" +#~ msgstr "Ãâ·Â Á¦¾î:\n" + +#~ msgid " -b, --byte-offset print the byte offset with output lines\n" +#~ msgstr " -b, --byte-offset Ãâ·ÂµÇ´Â Çà¿¡ ¹ÙÀÌÆ® ¿ÀÇÁ¼ÂÀ» Ç¥½ÃÇÕ´Ï´Ù\n" + +#~ msgid " -n, --line-number print line number with output lines\n" +#~ msgstr " -n, --line-number Ãâ·ÂµÇ´Â Çà¿¡ Çà¹øÈ£¸¦ Ç¥½ÃÇÕ´Ï´Ù\n" + +#~ msgid " -H, --with-filename print the filename for each match\n" +#~ msgstr " -H, --with-filename °¢°¢ÀÇ ÀÏÄ¡ °á°ú¿¡ ´ëÇØ ÆÄÀϸíÀ» Ç¥½ÃÇÕ´Ï´Ù\n" + +#~ msgid " -q, --quiet, --silent suppress all normal output\n" +#~ msgstr " -q, --quiet, --silent ÀϹÝÀûÀÎ ¸ðµç Ãâ·ÂÀ» Ç¥½ÃÇÏÁö ¾Ê½À´Ï´Ù\n" + +#~ msgid " -L, --files-without-match only print FILE names containing no match\n" +#~ msgstr " -L, --files-without-match ÀÏÄ¡ °á°ú°¡ ¾ø´Â ÆÄÀÏ À̸§¸¸ Ç¥½ÃÇÕ´Ï´Ù\n" + +#~ msgid " -l, --files-with-matches only print FILE names containing matches\n" +#~ msgstr " -l, --files-with-matches ÀÏÄ¡ °á°ú°¡ Æ÷ÇÔµÈ ÆÄÀÏ À̸§¸¸ Ç¥½ÃÇÕ´Ï´Ù\n" + +#~ msgid " -c, --count only print a count of matching lines per FILE\n" +#~ msgstr " -c, --count ÆÄÀÏ´ç ÀÏÄ¡ÇÏ´Â ÇàÀÇ °³¼ö¸¸À» Ç¥½ÃÇÕ´Ï´Ù\n" + +#~ msgid "Context control:\n" +#~ msgstr "¹®¸Æ Á¦¾î:\n" + +#~ msgid " -NUM same as both -B NUM and -A NUM\n" +#~ msgstr " -¼ýÀÚ -B ¼ýÀÚ³ª -A ¼ýÀÚ¿Í °°À½\n" + +#~ msgid " -C, --context same as -2\n" +#~ msgstr " -C, --context -2¿Í °°À½\n" + +#~ msgid " -U, --binary do not strip CR characters at EOL\n" +#~ msgstr " -U, --binary ÇೡÀÇ CR ¹®ÀÚ¸¦ À߶ó³»Áö ¾Ê½À´Ï´Ù\n" + +#~ msgid " -u, --unix-byte-offsets report offsets as if CRs were not there\n" +#~ msgstr " -u, --unix-byte-offsets CRÀ» Á¦¿ÜÇÏ°í ¿ÀÇÁ¼ÂÀ» »êÃâÇÕ´Ï´Ù\n" + +#~ msgid "If call as `egrep', this implies -E and `fgrep' for -F.\n" +#~ msgstr "`egrep'À¸·Î È£ÃâµÇ¸é -E·Î °¡Á¤µÇ°í `fgrep'ÀÏ ¶§¿¡´Â -F°¡ °¡Á¤µË´Ï´Ù.\n" + +#~ msgid "If no -[GEF], then -G is assumed.\n" +#~ msgstr "-[GEF]°¡ ÁÖ¾îÁöÁö ¾ÊÀ¸¸é -G·Î °¡Á¤ÇÕ´Ï´Ù.\n" + +#~ msgid "(standard input)\n" +#~ msgstr "(Ç¥ÁØ ÀÔ·Â)\n" diff --git a/po/nb.po b/po/nb.po new file mode 100644 index 0000000..cc84c09 --- /dev/null +++ b/po/nb.po @@ -0,0 +1,399 @@ +# Norwegian messages for GNU Grep version 2.2. (bokmål dialect) +# Copyright (C) 1996 Free Software Foundation, Inc. +# Eivind Tagseth , 1997, 2004 +# Karl Anders Øygard , 1996. +# +msgid "" +msgstr "" +"Project-Id-Version: GNU grep 2.5g\n" +"POT-Creation-Date: 2002-03-26 16:38+0100\n" +"PO-Revision-Date: 2004-02-13 23:59+0100\n" +"Last-Translator: Eivind Tagseth \n" +"Language-Team: Norwegian Bokmaal \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-1\n" +"Content-Transfer-Encoding: 8-bit\n" + +#: src/dfa.c:136 src/dfa.c:147 src/dfa.c:158 src/search.c:689 +msgid "Memory exhausted" +msgstr "Minnet oppbrukt" + +#: src/dfa.c:489 src/dfa.c:492 src/dfa.c:510 src/dfa.c:521 src/dfa.c:545 +#: src/dfa.c:604 src/dfa.c:609 src/dfa.c:622 src/dfa.c:623 src/dfa.c:1001 +#: src/dfa.c:1004 src/dfa.c:1028 src/dfa.c:1032 src/dfa.c:1033 src/dfa.c:1036 +#: src/dfa.c:1048 src/dfa.c:1049 +msgid "Unbalanced [" +msgstr "Ubalansert [" + +#: src/dfa.c:741 +msgid "Unfinished \\ escape" +msgstr "Uferdig \\-beskyttelse" + +#. Cases: +#. {M} - exact count +#. {M,} - minimum count, maximum is infinity +#. {M,N} - M through N +#: src/dfa.c:874 src/dfa.c:880 src/dfa.c:890 src/dfa.c:898 src/dfa.c:913 +msgid "unfinished repeat count" +msgstr "uferdig gjentagelsesantall" + +#: src/dfa.c:887 src/dfa.c:904 src/dfa.c:912 src/dfa.c:916 +msgid "malformed repeat count" +msgstr "feilaktig gjentagelsesantall" + +#: src/dfa.c:1253 +msgid "Unbalanced (" +msgstr "Ubalansert (" + +#: src/dfa.c:1378 +msgid "No syntax specified" +msgstr "Ingen syntaks spesifisert" + +#: src/dfa.c:1386 +msgid "Unbalanced )" +msgstr "Ubalansert )" + +#: src/dfa.c:2956 +msgid "out of memory" +msgstr "tomt for minne" + +#: src/kwset.c:171 src/kwset.c:177 src/search.c:103 src/search.c:209 +#: src/search.c:293 lib/obstack.c:471 +msgid "memory exhausted" +msgstr "minnet oppbrukt" + +#: src/grep.c:205 +msgid "invalid context length argument" +msgstr "ugyldig kontekstlengde" + +#: src/grep.c:479 +msgid "input is too large to count" +msgstr "for mye inndata til å telle" + +#: src/grep.c:605 +msgid "writing output" +msgstr "skriver utdata" + +#: src/grep.c:878 +#, c-format +msgid "Binary file %s matches\n" +msgstr "Binær fil %s samsvarer\n" + +#: src/grep.c:892 +msgid "(standard input)" +msgstr "(standard inn)" + +#: src/grep.c:997 +#, c-format +msgid "warning: %s: %s\n" +msgstr "advarsel: %s: %s\n" + +#: src/grep.c:998 +msgid "recursive directory loop" +msgstr "rekursiv katalog-løkke" + +#: src/grep.c:1046 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE]...\n" +msgstr "Bruk: %s [FLAGG]... MØNSTER [FIL]...\n" + +#: src/grep.c:1048 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "Prøv «%s --help» for mer informasjon.\n" + +#: src/grep.c:1053 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE] ...\n" +msgstr "Bruk: %s [FLAGG]... MØNSTER [FIL] ...\n" + +#: src/grep.c:1054 +#, c-format +msgid "" +"Search for PATTERN in each FILE or standard input.\n" +"Example: %s -i 'hello world' menu.h main.c\n" +"\n" +"Regexp selection and interpretation:\n" +msgstr "" +"Søk for MØNSTER i hver FIL eller standard innkanal.\n" +"Eksempel: %s -i 'hei verden' meny.h meny.c\n" +"\n" +"Regulært utvalg og fortolkning:\n" + +#: src/grep.c:1059 +msgid "" +" -E, --extended-regexp PATTERN is an extended regular expression\n" +" -F, --fixed-strings PATTERN is a set of newline-separated strings\n" +" -G, --basic-regexp PATTERN is a basic regular expression\n" +" -P, --perl-regexp PATTERN is a Perl regular expression\n" +msgstr "" +" -E, --extended-regexp MØNSTER er et utvidet regulært uttrykk\n" +" -F, --fixed-strings MØNSTER er et sett av linjeskift-separerte strenger\n" +" -G, --basic-regexp MØNSTER er et grunnleggende regulært uttrykk\n" +" -P, --perl-regexp MØNSTER er et regulært uttrykk på Perl-format\n" + +#: src/grep.c:1064 +msgid "" +" -e, --regexp=PATTERN use PATTERN as a regular expression\n" +" -f, --file=FILE obtain PATTERN from FILE\n" +" -i, --ignore-case ignore case distinctions\n" +" -w, --word-regexp force PATTERN to match only whole words\n" +" -x, --line-regexp force PATTERN to match only whole lines\n" +" -z, --null-data a data line ends in 0 byte, not newline\n" +msgstr "" +" -e, --regexp=MØNSTER bruk MØNSTER som et regulært uttrykk\n" +" -f, --file=FIL hent MØNSTER fra FIL\n" +" -i, --ignore-case se bort ifra forskjellen på store og små bokstaver\n" +" -w, --word-regexp MØNSTER må stemme overens med hele ord\n" +" -x, --line-regexp MØNSTER må stemme overens med hele linjer\n" +" -z, --null-data en datalinje slutter med en 0-byte, ikke linjeskift\n" + +#: src/grep.c:1071 +msgid "" +"\n" +"Miscellaneous:\n" +" -s, --no-messages suppress error messages\n" +" -v, --invert-match select non-matching lines\n" +" -V, --version print version information and exit\n" +" --help display this help and exit\n" +" --mmap use memory-mapped input if possible\n" +msgstr "" +"\n" +"Diverse:\n" +" -s, --no-messages undertrykk feilmeldinger\n" +" -v, --revert-match velg linjer som ikke passer\n" +" -V, --version vis versioninformasjon og avslutt\n" +" --help vis denne helpeteksten og avslutt\n" +" --mmap bruk minne-mappet inndata hvis mulig\n" + +#: src/grep.c:1079 +msgid "" +"\n" +"Output control:\n" +" -m, --max-count=NUM stop after NUM matches\n" +" -b, --byte-offset print the byte offset with output lines\n" +" -n, --line-number print line number with output lines\n" +" --line-buffered flush output on every line\n" +" -H, --with-filename print the filename for each match\n" +" -h, --no-filename suppress the prefixing filename on output\n" +" --label=LABEL print LABEL as filename for standard input\n" +" -o, --only-matching show only the part of a line matching PATTERN\n" +" -q, --quiet, --silent suppress all normal output\n" +" --binary-files=TYPE assume that binary files are TYPE\n" +" TYPE is 'binary', 'text', or 'without-match'\n" +" -a, --text equivalent to --binary-files=text\n" +" -I equivalent to --binary-files=without-match\n" +" -d, --directories=ACTION how to handle directories\n" +" ACTION is 'read', 'recurse', or 'skip'\n" +" -D, --devices=ACTION how to handle devices, FIFOs and sockets\n" +" ACTION is 'read' or 'skip'\n" +" -R, -r, --recursive equivalent to --directories=recurse\n" +" --include=PATTERN files that match PATTERN will be examined\n" +" --exclude=PATTERN files that match PATTERN will be skipped.\n" +" --exclude-from=FILE files that match PATTERN in FILE will be skipped.\n" +" -L, --files-without-match only print FILE names containing no match\n" +" -l, --files-with-matches only print FILE names containing matches\n" +" -c, --count only print a count of matching lines per FILE\n" +" -Z, --null print 0 byte after FILE name\n" +msgstr "" +"\n" +"Utskriftskontroll:\n" +" -m, --max-count=ANT stopp etter ANT samsvar\n" +" -b, --byte-offset skriv byte-forskyvning sammen med utskriftslinjer\n" +" -n, --line-number skriv linjenummer sammen med utskriftslinjer\n" +" --line-buffered tøm utskriftsbuffer for hver linje\n" +" -H, --with-filename skriv filnavnet for hvert samsvar\n" +" -h, --no-filename ikke skriv filnavnet for hvert samsvar\n" +" --label=NAVN skriv NAVN som filnavn for standard innkanal\n" +" -o, --only-matching vis bare den delen av en linje som samsvarer med\n" +" MØNSTER.\n" +" -q, --quiet, --silent undertrykk all vanlig utskrift\n" +" --binary-files=TYPE anta at binære filer er TYPE\n" +" TYPE er «binary», «text» eller «without-match»\n" +" -a, --text samme som binary-files=text\n" +" -I samme som --binary-files=without-match\n" +" -d, --directories=HANDLING hvordan håndtere kataloger\n" +" HANDLING er «read» eller «skip»\n" +" -D, --devices=HANDLING hvordan enheter, FIFOer og sockets skal håndteres\n" +" HANDLING er «read» eller «skip»\n" +" -R, -r, --recursive samme som --directories=recurse\n" +" --include=MØNSTER undersøk filer som samsvarer med MØNSTER.\n" +" --exclude=MØNSTER hopp over filer som samsvarer med MØNSTER.\n" +" --exclude-from=FIL hopp over filer som samsvarer med MØNSTER i FIL.\n" +" -L, --files-without-match bare skriv FIL-navn uten samsvar\n" +" -l, --files-with-matches bare skriv FIL-navnene som inneholder samsvar\n" +" -c, --count bare skriv ut antall samsvarende linjer per FIL\n" +" -Z, --null skriv 0-byte etter FIL-navn\n" + +#: src/grep.c:1107 +msgid "" +"\n" +"Context control:\n" +" -B, --before-context=NUM print NUM lines of leading context\n" +" -A, --after-context=NUM print NUM lines of trailing context\n" +" -C, --context=NUM print NUM lines of output context\n" +" -NUM same as --context=NUM\n" +" --color[=WHEN],\n" +" --colour[=WHEN] use markers to distinguish the matching string\n" +" WHEN may be `always', `never' or `auto'.\n" +" -U, --binary do not strip CR characters at EOL (MSDOS)\n" +" -u, --unix-byte-offsets report offsets as if CRs were not there (MSDOS)\n" +"\n" +"`egrep' means `grep -E'. `fgrep' means `grep -F'.\n" +"With no FILE, or when FILE is -, read standard input. If less than\n" +"two FILEs given, assume -h. Exit status is 0 if match, 1 if no match,\n" +"and 2 if trouble.\n" +msgstr "" +"\n" +"Kontekst-kontroll:\n" +" -B, --before-context=ANT skriv ANT linjer med ledende kontekst\n" +" -A, --after-context=ANT skriv ANT linjer med etterfølgende kontekst\n" +" -C, --context=ANT skriv ANT linjer med utskriftskontekst\n" +" -ANT samme som --context=NUM\n" +" --color[=NÅR],\n" +" --colour[=NÅR] bruk markører for å skille mellom samsvarende\n" +" streng. NÅR kan være «alltid», «aldri» eller\n" +" «auto».\n" +" -U, --binary ikke fjern CR-tegn ved EOL (MSDOS)\n" +" -u, --unix-byte-offsets rapporter posisjoner som om CRene ikke var der\n" +" (MSDOS)\n" + +#: src/grep.c:1124 +#, fuzzy +msgid "" +"\n" +"Report bugs to .\n" +msgstr "" +"\n" +"Rapportér feil til .\n" + +#: src/grep.c:1134 +msgid "conflicting matchers specified" +msgstr "motsigende søkeuttrykk spesifisert" + +#: src/grep.c:1376 +msgid "unknown devices method" +msgstr "ukjent enhetmetode" + +#: src/grep.c:1443 +msgid "unknown directories method" +msgstr "ukjent katalogmetode" + +#: src/grep.c:1510 +msgid "invalid max count" +msgstr "ugyldig maksantall" + +#: src/grep.c:1565 +msgid "unknown binary-files type" +msgstr "ukjent binærfiltype" + +#: src/grep.c:1660 +#, c-format +msgid "%s (GNU grep) %s\n" +msgstr "%s (GNU grep) %s\n" + +#: src/grep.c:1662 +msgid "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" +msgstr "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" + +#: src/grep.c:1664 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"Dette er fri programvare, se kildekoden for kopieringsbetingelser. Det\n" +"er INGEN garanti, ikke en gang for SALGBARHET eller EGNETHET FOR NOEN \n" +"SPESIELL OPPGAVE.\n" + +#: src/search.c:606 +msgid "The -P option is not supported" +msgstr "-P-flagget er ikke støttet" + +#: src/search.c:619 +msgid "The -P and -z options cannot be combined" +msgstr "-P-flagget og -z-flagget kan ikke bli brukt sammen" + +#: lib/error.c:117 +msgid "Unknown system error" +msgstr "Ukjent systemfeil" + +#: lib/getopt.c:675 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: flagget «%s» er flertydig\n" + +#: lib/getopt.c:700 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: flagget «--%s» tar ikke argumenter\n" + +#: lib/getopt.c:705 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: flagget «%c%s» tar ikke argumenter\n" + +#: lib/getopt.c:723 lib/getopt.c:896 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: flagget «%s» trenger et argument\n" + +#. --option +#: lib/getopt.c:752 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: ukjent flagg «--%s»\n" + +#. +option or -option +#: lib/getopt.c:756 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: ukjent flagg «%c%s»\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:782 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: ulovlig flagg -- %c\n" + +#: lib/getopt.c:785 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: ugyldig flagg -- %c\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:815 lib/getopt.c:945 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: flagget behøver et argument -- %c\n" + +#: lib/getopt.c:862 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: flagget «-W %s» er flertydig\n" + +#: lib/getopt.c:880 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: flagget «-W %s» tar ikke argumenter\n" + +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#: lib/quotearg.c:259 +msgid "`" +msgstr "«" + +#: lib/quotearg.c:260 +msgid "'" +msgstr "»" diff --git a/po/nl.po b/po/nl.po new file mode 100644 index 0000000..4c35ce9 --- /dev/null +++ b/po/nl.po @@ -0,0 +1,411 @@ +# Translation of grep-2.5.1a to Dutch. +# Copyright (C) 1996, 2000, 2004, 2005 Free Software Foundation, Inc. +# Erick Branderhorst , 1996. +# Ivo Timmermans , 2000. +# Taco Witte , 2004. +# Benno Schulenberg , 2005. +# +msgid "" +msgstr "" +"Project-Id-Version: grep 2.5.1a\n" +"POT-Creation-Date: 2002-03-26 16:38+0100\n" +"PO-Revision-Date: 2005-11-06 19:50+0100\n" +"Last-Translator: Benno Schulenberg \n" +"Language-Team: Dutch \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: src/dfa.c:136 src/dfa.c:147 src/dfa.c:158 src/search.c:689 +msgid "Memory exhausted" +msgstr "Onvoldoende geheugen" + +#: src/dfa.c:489 src/dfa.c:492 src/dfa.c:510 src/dfa.c:521 src/dfa.c:545 +#: src/dfa.c:604 src/dfa.c:609 src/dfa.c:622 src/dfa.c:623 src/dfa.c:1001 +#: src/dfa.c:1004 src/dfa.c:1028 src/dfa.c:1032 src/dfa.c:1033 src/dfa.c:1036 +#: src/dfa.c:1048 src/dfa.c:1049 +msgid "Unbalanced [" +msgstr "Ongepaarde [" + +#: src/dfa.c:741 +msgid "Unfinished \\ escape" +msgstr "Onafgemaakte \\ stuurcode" + +#. Cases: +#. {M} - exact count +#. {M,} - minimum count, maximum is infinity +#. {M,N} - M through N +#: src/dfa.c:874 src/dfa.c:880 src/dfa.c:890 src/dfa.c:898 src/dfa.c:913 +msgid "unfinished repeat count" +msgstr "Onafgemaakt herhalingsaantal" + +#: src/dfa.c:887 src/dfa.c:904 src/dfa.c:912 src/dfa.c:916 +msgid "malformed repeat count" +msgstr "Onjuist herhalingsaantal" + +#: src/dfa.c:1253 +msgid "Unbalanced (" +msgstr "Ongepaarde (" + +#: src/dfa.c:1378 +msgid "No syntax specified" +msgstr "Geen syntax opgegeven" + +#: src/dfa.c:1386 +msgid "Unbalanced )" +msgstr "Ongepaarde )" + +#: src/dfa.c:2956 +msgid "out of memory" +msgstr "Onvoldoende geheugen" + +#: src/kwset.c:171 src/kwset.c:177 src/search.c:103 src/search.c:209 +#: src/search.c:293 lib/obstack.c:471 +msgid "memory exhausted" +msgstr "Onvoldoende geheugen" + +#: src/grep.c:205 +msgid "invalid context length argument" +msgstr "Ongeldig argument voor contextlengte" + +#: src/grep.c:479 +msgid "input is too large to count" +msgstr "Invoer is te groot om te kunnen tellen" + +#: src/grep.c:605 +msgid "writing output" +msgstr "schrijven van uitvoer..." + +#: src/grep.c:878 +#, c-format +msgid "Binary file %s matches\n" +msgstr "Binair bestand %s komt overeen\n" + +#: src/grep.c:892 +msgid "(standard input)" +msgstr "(standaardinvoer)" + +#: src/grep.c:997 +#, c-format +msgid "warning: %s: %s\n" +msgstr "Waarschuwing: %s: %s\n" + +#: src/grep.c:998 +msgid "recursive directory loop" +msgstr "Oneindige lus in de mappen" + +#: src/grep.c:1046 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE]...\n" +msgstr "Gebruik: %s [OPTIE]... PATROON [BESTAND]...\n" + +#: src/grep.c:1048 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "Probeer '%s --help' voor meer informatie.\n" + +#: src/grep.c:1053 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE] ...\n" +msgstr "Gebruik: %s [OPTIE]... PATROON [BESTAND]...\n" + +#: src/grep.c:1054 +#, c-format +msgid "" +"Search for PATTERN in each FILE or standard input.\n" +"Example: %s -i 'hello world' menu.h main.c\n" +"\n" +"Regexp selection and interpretation:\n" +msgstr "" +"Zoek naar PATROON in ieder gegeven BESTAND of in standaardinvoer.\n" +"Voorbeeld: %s -i 'hallo wereld' menu.h main.c\n" +"\n" +"Selectie en interpretatie van reguliere expressies:\n" + +#: src/grep.c:1059 +msgid "" +" -E, --extended-regexp PATTERN is an extended regular expression\n" +" -F, --fixed-strings PATTERN is a set of newline-separated strings\n" +" -G, --basic-regexp PATTERN is a basic regular expression\n" +" -P, --perl-regexp PATTERN is a Perl regular expression\n" +msgstr "" +" -E, --extended-regexp PATROON is een uitgebreide reguliere expressie\n" +" -F, --fixed-strings PATROON is een serie tekenreeksen,\n" +" elke tekenreeks op een aparte regel\n" +" -G, --basic-regexp PATROON is een gewone reguliere expressie\n" +" -P, --perl-regexp PATROON is een reguliere Perl-expressie\n" + +#: src/grep.c:1064 +msgid "" +" -e, --regexp=PATTERN use PATTERN as a regular expression\n" +" -f, --file=FILE obtain PATTERN from FILE\n" +" -i, --ignore-case ignore case distinctions\n" +" -w, --word-regexp force PATTERN to match only whole words\n" +" -x, --line-regexp force PATTERN to match only whole lines\n" +" -z, --null-data a data line ends in 0 byte, not newline\n" +msgstr "" +" -e, --regexp=PATROON gebruik PATROON als reguliere expressie\n" +" -f, --file=BESTAND haal het patroon uit BESTAND\n" +" -i, --ignore-case negeer verschil tussen hoofd- en kleine letters\n" +" -w, --word-regexp het patroon komt alleen overeen met heel woord\n" +" -x, --line-regexp het patroon komt alleen overeen met hele regel\n" +" -z, --null-data regels eindigen op 0 byte, niet op LF-teken\n" + +#: src/grep.c:1071 +msgid "" +"\n" +"Miscellaneous:\n" +" -s, --no-messages suppress error messages\n" +" -v, --invert-match select non-matching lines\n" +" -V, --version print version information and exit\n" +" --help display this help and exit\n" +" --mmap use memory-mapped input if possible\n" +msgstr "" +"\n" +"Diversen:\n" +" -s, --no-messages onderdruk foutmeldingen\n" +" -v, --invert-match selecteer de niet-overeenkomende regels\n" +" -V, --version toon versie-informatie en stop\n" +" --help toon deze hulptekst en stop\n" +" --mmap gebruik indien mogelijk de mmap-leesfunctie\n" + +#: src/grep.c:1079 +msgid "" +"\n" +"Output control:\n" +" -m, --max-count=NUM stop after NUM matches\n" +" -b, --byte-offset print the byte offset with output lines\n" +" -n, --line-number print line number with output lines\n" +" --line-buffered flush output on every line\n" +" -H, --with-filename print the filename for each match\n" +" -h, --no-filename suppress the prefixing filename on output\n" +" --label=LABEL print LABEL as filename for standard input\n" +" -o, --only-matching show only the part of a line matching PATTERN\n" +" -q, --quiet, --silent suppress all normal output\n" +" --binary-files=TYPE assume that binary files are TYPE\n" +" TYPE is 'binary', 'text', or 'without-match'\n" +" -a, --text equivalent to --binary-files=text\n" +" -I equivalent to --binary-files=without-match\n" +" -d, --directories=ACTION how to handle directories\n" +" ACTION is 'read', 'recurse', or 'skip'\n" +" -D, --devices=ACTION how to handle devices, FIFOs and sockets\n" +" ACTION is 'read' or 'skip'\n" +" -R, -r, --recursive equivalent to --directories=recurse\n" +" --include=PATTERN files that match PATTERN will be examined\n" +" --exclude=PATTERN files that match PATTERN will be skipped.\n" +" --exclude-from=FILE files that match PATTERN in FILE will be skipped.\n" +" -L, --files-without-match only print FILE names containing no match\n" +" -l, --files-with-matches only print FILE names containing matches\n" +" -c, --count only print a count of matching lines per FILE\n" +" -Z, --null print 0 byte after FILE name\n" +msgstr "" +"\n" +"Uitvoeropties:\n" +" -m, --max-count=AANTAL stop na AANTAL overeenkomsten\n" +" -b, --byte-offset geef het byteadres bij de uitvoerregels\n" +" -n, --line-number geef het regelnummer bij de uitvoerregels\n" +" --line-buffered produceer uitvoer na elke gevonden regel\n" +" -H, --with-filename geef de bestandsnaam bij iedere overeenkomst\n" +" -h, --no-filename onderdruk het toevoegen van de bestandsnaam\n" +" --label=LABEL geef LABEL als naam van standaardinvoer\n" +" -o, --only-matching geef alleen het overeenkomende regelfragment\n" +" -q, --quiet, --silent onderdruk alle normale uitvoer\n" +" --binary-files=TYPE neem aan dat binaire bestanden van TYPE zijn;\n" +" TYPE is 'binary' (binair), 'text' (als tekst),\n" +" of 'without-match' (alsof geen overeenkomsten)\n" +" -a, --text hetzelfde als --binary-files=text\n" +" -I hetzelfde als --binary-files=without-match\n" +" -d, --directories=ACTIE behandel mappen met ACTIE;\n" +" ACTIE is 'read', 'recurse' of 'skip'\n" +" (ofwel lezen, in-afdalen, of overslaan)\n" +" -D, --devices=ACTIE behandel apparaten, FIFOs en sockets met ACTIE;\n" +" ACTIE is 'read' of 'skip' (lezen of overslaan)\n" +" -R, -r, --recursive hetzelfde als --directories=recurse\n" +" --include=BESTANDSPATROON onderzoek alleen bestanden die aan\n" +" BESTANDSPATROON voldoen\n" +" --exclude=BESTANDSPATROON sla bestanden over die aan BESTANDSPATROON\n" +" voldoen\n" +" --exclude-from=BESTAND sla bestanden over die aan een patroon in\n" +" BESTAND voldoen\n" +" -L, --files-without-match geef alleen bestandsnamen zonder overeenkomst\n" +" -l, --files-with-matches geef alleen bestandsnamen met overeenkomsten\n" +" -c, --count geef alleen het aantal overeenkomsten per bestand\n" +" -Z, --null print een 0 byte na iedere bestandsnaam\n" + +#: src/grep.c:1107 +msgid "" +"\n" +"Context control:\n" +" -B, --before-context=NUM print NUM lines of leading context\n" +" -A, --after-context=NUM print NUM lines of trailing context\n" +" -C, --context=NUM print NUM lines of output context\n" +" -NUM same as --context=NUM\n" +" --color[=WHEN],\n" +" --colour[=WHEN] use markers to distinguish the matching string\n" +" WHEN may be `always', `never' or `auto'.\n" +" -U, --binary do not strip CR characters at EOL (MSDOS)\n" +" -u, --unix-byte-offsets report offsets as if CRs were not there (MSDOS)\n" +"\n" +"`egrep' means `grep -E'. `fgrep' means `grep -F'.\n" +"With no FILE, or when FILE is -, read standard input. If less than\n" +"two FILEs given, assume -h. Exit status is 0 if match, 1 if no match,\n" +"and 2 if trouble.\n" +msgstr "" +"\n" +"Contextbesturing:\n" +" -B, --before-context=AANTAL geef AANTAL regels voorafgaande context\n" +" -A, --after-context=AANTAL geef AANTAL regels nakomende context\n" +" -C, --context=AANTAL geef AANTAL regels context\n" +" -AANTAL hetzelfde als --context=AANTAL\n" +" --color[=WANNEER],\n" +" --colour[=WANNEER] geef overeenkomende tekst gekleurd weer;\n" +" WANNEER is 'always', 'never' of 'auto'\n" +" (ofwel altijd, nooit, of apparaat-afhankelijk)\n" +" -U, --binary haal geen CR-tekens weg bij EOL (MSDOS)\n" +" -u, --unix-byte-offsets geef adressen alsof CRs er niet waren (MSDOS)\n" +"\n" +"Tot slot: 'egrep' betekent 'grep -E'; 'fgrep' betekent 'grep -F'.\n" +"Indien er geen BESTAND gegeven is, of BESTAND is -, dan wordt standaardinvoer\n" +"gelezen. Indien er minder dan twee BESTANDen gegeven zijn, dan wordt -h\n" +"aangenomen. De afsluitwaarde is 0 in geval van overeenkomsten,\n" +"1 indien geen overeenkomsten, en 2 indien er iets mis is.\n" + +#: src/grep.c:1124 +msgid "" +"\n" +"Report bugs to .\n" +msgstr "" +"\n" +"Meld gebreken in het programma aan ;\n" +"meld fouten in de vertaling aan .\n" + +#: src/grep.c:1134 +msgid "conflicting matchers specified" +msgstr "Conflicterende expressiesoorten" + +#: src/grep.c:1376 +msgid "unknown devices method" +msgstr "Onbekende apparaten-actie" + +#: src/grep.c:1443 +msgid "unknown directories method" +msgstr "Onbekende mappen-actie" + +#: src/grep.c:1510 +msgid "invalid max count" +msgstr "Ongeldig maximum aantal" + +#: src/grep.c:1565 +msgid "unknown binary-files type" +msgstr "Onbekend binair bestandstype" + +#: src/grep.c:1660 +#, c-format +msgid "%s (GNU grep) %s\n" +msgstr "%s (GNU grep) %s\n" + +#: src/grep.c:1662 +msgid "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" +msgstr "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" + +#: src/grep.c:1664 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"Dit is vrije programmatuur; zie de broncode voor de kopieervoorwaarden.\n" +"Er is GEEN garantie; zelfs niet voor VERKOOPBAARHEID of GESCHIKTHEID\n" +"VOOR EEN BEPAALD DOEL.\n" + +#: src/search.c:606 +msgid "The -P option is not supported" +msgstr "Ondersteuning voor de optie -P is in deze versie niet opgenomen" + +#: src/search.c:619 +msgid "The -P and -z options cannot be combined" +msgstr "De opties -P en -z gaan niet samen" + +#: lib/error.c:117 +msgid "Unknown system error" +msgstr "Onbekende systeemfout" + +#: lib/getopt.c:675 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: optie '%s' is niet eenduidig\n" + +#: lib/getopt.c:700 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: optie '--%s' staat geen argument toe\n" + +#: lib/getopt.c:705 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: optie '%c%s' staat geen argument toe\n" + +#: lib/getopt.c:723 lib/getopt.c:896 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: optie '%s' vereist een argument\n" + +#. --option +#: lib/getopt.c:752 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: onbekende optie '--%s'\n" + +#. +option or -option +#: lib/getopt.c:756 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: onbekende optie '%c%s'\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:782 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: ongeldige optie -- %c\n" + +#: lib/getopt.c:785 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: ongeldige optie -- %c\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:815 lib/getopt.c:945 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: optie vereist een argument -- %c\n" + +#: lib/getopt.c:862 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: optie '-W %s' is niet eenduidig\n" + +#: lib/getopt.c:880 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: optie '-W %s' staat geen argument toe\n" + +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#: lib/quotearg.c:259 +msgid "`" +msgstr "'" + +#: lib/quotearg.c:260 +msgid "'" +msgstr "'" diff --git a/po/no.po b/po/no.po new file mode 100644 index 0000000..d20630a --- /dev/null +++ b/po/no.po @@ -0,0 +1,423 @@ +# Norwegian messages for GNU Grep version 2.2. (bokmål dialect) +# Copyright (C) 1996 Free Software Foundation, Inc. +# Karl Anders Øygard , 1996. +# +# Eivind Tagseth , 1997 +# +msgid "" +msgstr "" +"Project-Id-Version: GNU grep 2.2\n" +"POT-Creation-Date: 2002-03-26 16:38+0100\n" +"PO-Revision-Date: 1998-08-01 13:45+0200\n" +"Last-Translator: Eivind Tagseth \n" +"Language-Team: Norwegian \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-1\n" +"Content-Transfer-Encoding: 8-bit\n" + +#: src/dfa.c:136 src/dfa.c:147 src/dfa.c:158 src/search.c:689 +msgid "Memory exhausted" +msgstr "Minnet oppbrukt" + +#: src/dfa.c:489 src/dfa.c:492 src/dfa.c:510 src/dfa.c:521 src/dfa.c:545 +#: src/dfa.c:604 src/dfa.c:609 src/dfa.c:622 src/dfa.c:623 src/dfa.c:1001 +#: src/dfa.c:1004 src/dfa.c:1028 src/dfa.c:1032 src/dfa.c:1033 src/dfa.c:1036 +#: src/dfa.c:1048 src/dfa.c:1049 +msgid "Unbalanced [" +msgstr "Ubalansert [" + +#: src/dfa.c:741 +msgid "Unfinished \\ escape" +msgstr "Uferdig \\-beskyttelse" + +#. Cases: +#. {M} - exact count +#. {M,} - minimum count, maximum is infinity +#. {M,N} - M through N +#: src/dfa.c:874 src/dfa.c:880 src/dfa.c:890 src/dfa.c:898 src/dfa.c:913 +msgid "unfinished repeat count" +msgstr "uferdig gjentagelsesantall" + +#: src/dfa.c:887 src/dfa.c:904 src/dfa.c:912 src/dfa.c:916 +msgid "malformed repeat count" +msgstr "feilaktig gjentagelsesantall" + +#: src/dfa.c:1253 +msgid "Unbalanced (" +msgstr "Ubalansert (" + +#: src/dfa.c:1378 +msgid "No syntax specified" +msgstr "Ingen syntaks spesifisert" + +#: src/dfa.c:1386 +msgid "Unbalanced )" +msgstr "Ubalansert )" + +#: src/dfa.c:2956 +msgid "out of memory" +msgstr "tomt for minne" + +#: src/kwset.c:171 src/kwset.c:177 src/search.c:103 src/search.c:209 +#: src/search.c:293 lib/obstack.c:471 +msgid "memory exhausted" +msgstr "minnet oppbrukt" + +#: src/grep.c:205 +msgid "invalid context length argument" +msgstr "ugyldig kontekstlengde" + +#: src/grep.c:479 +msgid "input is too large to count" +msgstr "" + +#: src/grep.c:605 +msgid "writing output" +msgstr "skriver utdata" + +#: src/grep.c:878 +#, c-format +msgid "Binary file %s matches\n" +msgstr "" + +#: src/grep.c:892 +msgid "(standard input)" +msgstr "(standard inn)" + +#: src/grep.c:997 +#, fuzzy, c-format +msgid "warning: %s: %s\n" +msgstr "%s: advarsel: %s: %s\n" + +#: src/grep.c:998 +msgid "recursive directory loop" +msgstr "" + +#: src/grep.c:1046 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE]...\n" +msgstr "Bruk: %s [FLAGG]... MØNSTER [FIL]...\n" + +#: src/grep.c:1048 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "Prøv «%s --help» for mer informasjon.\n" + +#: src/grep.c:1053 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE] ...\n" +msgstr "Bruk: %s [FLAGG]... MØNSTER [FIL] ...\n" + +#: src/grep.c:1054 +#, c-format +msgid "" +"Search for PATTERN in each FILE or standard input.\n" +"Example: %s -i 'hello world' menu.h main.c\n" +"\n" +"Regexp selection and interpretation:\n" +msgstr "" + +#: src/grep.c:1059 +msgid "" +" -E, --extended-regexp PATTERN is an extended regular expression\n" +" -F, --fixed-strings PATTERN is a set of newline-separated strings\n" +" -G, --basic-regexp PATTERN is a basic regular expression\n" +" -P, --perl-regexp PATTERN is a Perl regular expression\n" +msgstr "" + +#: src/grep.c:1064 +#, fuzzy +msgid "" +" -e, --regexp=PATTERN use PATTERN as a regular expression\n" +" -f, --file=FILE obtain PATTERN from FILE\n" +" -i, --ignore-case ignore case distinctions\n" +" -w, --word-regexp force PATTERN to match only whole words\n" +" -x, --line-regexp force PATTERN to match only whole lines\n" +" -z, --null-data a data line ends in 0 byte, not newline\n" +msgstr "" +"Søk etter MØNSTER i hver FIL eller standard inn.\n" +"\n" +"Regexp valg og fortolkning:\n" +" -E, --extended-regexp MØNSTER er et utvidet regulært uttrykk\n" +" -F, --fixed-regexp MØNSTER er en fast streng separert med linjeskift\n" +" -G, --basic-regexp MØNSTER er et grunnleggende regulært uttrykk\n" +" -e, --regexp=MØNSTER bruk MØNSTER som et regulært uttrykk\n" +" -f, --file=FIL hent MØNSTER fra FIL\n" +" -i, --ignore-case se bort ifra forskjellen på store og små bokstaver\n" +" -w, --word-regexp MØNSTER må stemme overens med hele ord\n" +" -x, --line-regexp MØNSTER må stemme overens med hele linjer\n" + +#: src/grep.c:1071 +#, fuzzy +msgid "" +"\n" +"Miscellaneous:\n" +" -s, --no-messages suppress error messages\n" +" -v, --invert-match select non-matching lines\n" +" -V, --version print version information and exit\n" +" --help display this help and exit\n" +" --mmap use memory-mapped input if possible\n" +msgstr "" +"\n" +"Diverse:\n" +" -s, --no-messages undertrykk feilmeldinger\n" +" -v, --revert-match velg linjer som ikke passer\n" +" -V, --version vis versioninformasjon og avslutt\n" +" --help vis denne helpeteksten og avslutt\n" + +#: src/grep.c:1079 +#, fuzzy +msgid "" +"\n" +"Output control:\n" +" -m, --max-count=NUM stop after NUM matches\n" +" -b, --byte-offset print the byte offset with output lines\n" +" -n, --line-number print line number with output lines\n" +" --line-buffered flush output on every line\n" +" -H, --with-filename print the filename for each match\n" +" -h, --no-filename suppress the prefixing filename on output\n" +" --label=LABEL print LABEL as filename for standard input\n" +" -o, --only-matching show only the part of a line matching PATTERN\n" +" -q, --quiet, --silent suppress all normal output\n" +" --binary-files=TYPE assume that binary files are TYPE\n" +" TYPE is 'binary', 'text', or 'without-match'\n" +" -a, --text equivalent to --binary-files=text\n" +" -I equivalent to --binary-files=without-match\n" +" -d, --directories=ACTION how to handle directories\n" +" ACTION is 'read', 'recurse', or 'skip'\n" +" -D, --devices=ACTION how to handle devices, FIFOs and sockets\n" +" ACTION is 'read' or 'skip'\n" +" -R, -r, --recursive equivalent to --directories=recurse\n" +" --include=PATTERN files that match PATTERN will be examined\n" +" --exclude=PATTERN files that match PATTERN will be skipped.\n" +" --exclude-from=FILE files that match PATTERN in FILE will be skipped.\n" +" -L, --files-without-match only print FILE names containing no match\n" +" -l, --files-with-matches only print FILE names containing matches\n" +" -c, --count only print a count of matching lines per FILE\n" +" -Z, --null print 0 byte after FILE name\n" +msgstr "" +"\n" +"Ut-kontroll:\n" +" -b, --byte-offset skriv tegnposisjon med utlinjene\n" +" -n, --line-number skriv linjenummeret med utlinjene\n" +" -H, --with-filename skriv filnavnet for hver treff\n" +" -h, --no-filename ikke skriv filnavnet\n" +" -q, --quiet, --silent undertrykk all vanlig utskrift\n" +" -L, --files-without-match skriv bare ut navnene på FILene som ikke\n" +" inneholder treff\n" +" -l, --files-with-matches skriv bare ut navnene på FILene som inneholder\n" +" treff\n" +" -c, --count skriv bare ut antall linjer som inneholder treff\n" +" per FIL\n" + +#: src/grep.c:1107 +#, fuzzy +msgid "" +"\n" +"Context control:\n" +" -B, --before-context=NUM print NUM lines of leading context\n" +" -A, --after-context=NUM print NUM lines of trailing context\n" +" -C, --context=NUM print NUM lines of output context\n" +" -NUM same as --context=NUM\n" +" --color[=WHEN],\n" +" --colour[=WHEN] use markers to distinguish the matching string\n" +" WHEN may be `always', `never' or `auto'.\n" +" -U, --binary do not strip CR characters at EOL (MSDOS)\n" +" -u, --unix-byte-offsets report offsets as if CRs were not there (MSDOS)\n" +"\n" +"`egrep' means `grep -E'. `fgrep' means `grep -F'.\n" +"With no FILE, or when FILE is -, read standard input. If less than\n" +"two FILEs given, assume -h. Exit status is 0 if match, 1 if no match,\n" +"and 2 if trouble.\n" +msgstr "" +"\n" +"Kontekst-kontroll:\n" +" -B, --before-context=ANT skriv ANT linjer med ledende kontekst\n" +" -A, --after-context=ANT skriv ANT linjer med etterfølgende kontekst\n" +" -ANT samme som både -B ANT og -A ANT\n" +" -C, --context samme som -2\n" +" -U, --binary ikke fjern CR-tegn ved EOL (MSDOS)\n" +" -u, --unix-byte-offsets rapporter posisjoner som om CRene ikke var der\n" +" (MSDOS)\n" + +#: src/grep.c:1124 +#, fuzzy +msgid "" +"\n" +"Report bugs to .\n" +msgstr "" +"\n" +"Rapportér feil til .\n" + +#: src/grep.c:1134 +#, fuzzy +msgid "conflicting matchers specified" +msgstr "søkeuttrykk er allerede spesifisert" + +#: src/grep.c:1376 +msgid "unknown devices method" +msgstr "" + +#: src/grep.c:1443 +msgid "unknown directories method" +msgstr "" + +#: src/grep.c:1510 +#, fuzzy +msgid "invalid max count" +msgstr "uferdig gjentagelsesantall" + +#: src/grep.c:1565 +msgid "unknown binary-files type" +msgstr "" + +#: src/grep.c:1660 +#, fuzzy, c-format +msgid "%s (GNU grep) %s\n" +msgstr "grep (GNU grep) %s\n" + +#: src/grep.c:1662 +#, fuzzy +msgid "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" +msgstr "Copyright (C) 1988, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.\n" + +#: src/grep.c:1664 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"Dette er fri programvare, se kildekoden for kopieringsbetingelser. Det\n" +"er INGEN garanti, ikke en gang for SALGBARHET eller EGNETHET FOR NOEN \n" +"SPESIELL OPPGAVE.\n" + +#: src/search.c:606 +msgid "The -P option is not supported" +msgstr "" + +#: src/search.c:619 +msgid "The -P and -z options cannot be combined" +msgstr "" + +#: lib/error.c:117 +msgid "Unknown system error" +msgstr "" + +#: lib/getopt.c:675 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: flagget «%s» er flertydig\n" + +#: lib/getopt.c:700 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: flagget «--%s» tar ikke argumenter\n" + +#: lib/getopt.c:705 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: flagget «%c%s» tar ikke argumenter\n" + +#: lib/getopt.c:723 lib/getopt.c:896 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: flagget «%s» trenger et argument\n" + +#. --option +#: lib/getopt.c:752 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: ukjent flagg «--%s»\n" + +#. +option or -option +#: lib/getopt.c:756 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: ukjent flagg «%c%s»\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:782 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: ulovlig flagg -- %c\n" + +#: lib/getopt.c:785 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: ugyldig flagg -- %c\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:815 lib/getopt.c:945 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: flagget behøver et argument -- %c\n" + +#: lib/getopt.c:862 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: flagget «-W %s» er flertydig\n" + +#: lib/getopt.c:880 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: flagget «-W %s» tar ikke argumenter\n" + +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#: lib/quotearg.c:259 +msgid "`" +msgstr "" + +#: lib/quotearg.c:260 +msgid "'" +msgstr "" + +#~ msgid "option %s" +#~ msgstr "flagg %s" + +#~ msgid " with arg %s" +#~ msgstr " med arg %s" + +#~ msgid "digits occur in two different argv-elements.\n" +#~ msgstr "tallene forekommer i to forskjellige argv-elementer.\n" + +#~ msgid "option %c\n" +#~ msgstr "flagg %c\n" + +#~ msgid "option a\n" +#~ msgstr "flagg a\n" + +#~ msgid "option b\n" +#~ msgstr "flagg b\n" + +#~ msgid "option c with value `%s'\n" +#~ msgstr "flagg c med verdi «%s»\n" + +#~ msgid "option d with value `%s'\n" +#~ msgstr "flagg d med verdi «%s»\n" + +#~ msgid "?? getopt returned character code 0%o ??\n" +#~ msgstr "?? getopt returnerte tegnverdien 0%o ??\n" + +#~ msgid "non-option ARGV-elements: " +#~ msgstr "ARGV-elementer som ikke er flagg: " + +#~ msgid "you may specify only one of -E, -F, or -G" +#~ msgstr "du kan bare spesifisere en av -E, -F eller -G" + +#~ msgid "memory exhausted\n" +#~ msgstr "minnet oppbrukt\n" + +#~ msgid "(standard input)\n" +#~ msgstr "(standard inn)\n" diff --git a/po/pl.po b/po/pl.po new file mode 100644 index 0000000..62b9eb4 --- /dev/null +++ b/po/pl.po @@ -0,0 +1,412 @@ +# Polish translation of the GNU grep messages +# Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 2005 Free Software Foundation, Inc. +# Rafa³ Maszkowski , 1996-2002, 2005. +# +msgid "" +msgstr "" +"Project-Id-Version: GNU grep 2.5.1a\n" +"POT-Creation-Date: 2002-03-26 16:38+0100\n" +"PO-Revision-Date: 2005-03-03 23:30+0100\n" +"Last-Translator: Rafa³ Maszkowski \n" +"Language-Team: Polish \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-2\n" +"Content-Transfer-Encoding: 8-bit\n" + +#: src/dfa.c:136 src/dfa.c:147 src/dfa.c:158 src/search.c:689 +msgid "Memory exhausted" +msgstr "Pamiêæ wyczerpana" + +#: src/dfa.c:489 src/dfa.c:492 src/dfa.c:510 src/dfa.c:521 src/dfa.c:545 +#: src/dfa.c:604 src/dfa.c:609 src/dfa.c:622 src/dfa.c:623 src/dfa.c:1001 +#: src/dfa.c:1004 src/dfa.c:1028 src/dfa.c:1032 src/dfa.c:1033 src/dfa.c:1036 +#: src/dfa.c:1048 src/dfa.c:1049 +msgid "Unbalanced [" +msgstr "[ nie do pary" + +#: src/dfa.c:741 +msgid "Unfinished \\ escape" +msgstr "Niedokoñczona sekwencja \\" + +#. Cases: +#. {M} - exact count +#. {M,} - minimum count, maximum is infinity +#. {M,N} - M through N +#: src/dfa.c:874 src/dfa.c:880 src/dfa.c:890 src/dfa.c:898 src/dfa.c:913 +msgid "unfinished repeat count" +msgstr "niedokoñczona liczba powtórzeñ" + +#: src/dfa.c:887 src/dfa.c:904 src/dfa.c:912 src/dfa.c:916 +msgid "malformed repeat count" +msgstr "¼le sformatowana liczba powtórzeñ" + +#: src/dfa.c:1253 +msgid "Unbalanced (" +msgstr "( nie do pary" + +#: src/dfa.c:1378 +msgid "No syntax specified" +msgstr "Brak specyfikacji sk³adni" + +#: src/dfa.c:1386 +msgid "Unbalanced )" +msgstr ") nie do pary" + +#: src/dfa.c:2956 +msgid "out of memory" +msgstr "brak pamiêci" + +#: src/kwset.c:171 src/kwset.c:177 src/search.c:103 src/search.c:209 +#: src/search.c:293 lib/obstack.c:471 +msgid "memory exhausted" +msgstr "pamiêæ wyczerpana" + +#: src/grep.c:205 +msgid "invalid context length argument" +msgstr "b³êdny argument d³ugo¶ci kontekstowej" + +#: src/grep.c:479 +msgid "input is too large to count" +msgstr "danych wej¶ciowych jest zbyt du¿o do policzenia" + +#: src/grep.c:605 +msgid "writing output" +msgstr "zapisujê wyniki" + +#: src/grep.c:878 +#, c-format +msgid "Binary file %s matches\n" +msgstr "Plik binarny %s pasuje do wzorca\n" + +#: src/grep.c:892 +msgid "(standard input)" +msgstr "(standardowe wej¶cie)" + +#: src/grep.c:997 +#, c-format +msgid "warning: %s: %s\n" +msgstr "uwaga: %s: %s\n" + +#: src/grep.c:998 +msgid "recursive directory loop" +msgstr "nieskoñczona pêtla przegl±dania katalogów" + +#: src/grep.c:1046 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE]...\n" +msgstr "U¿ycie: %s [OPCJA]... WZORZEC [PLIK] ...\n" + +#: src/grep.c:1048 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "Napisz `%s --help' ¿eby dowiedzieæ siê wiêcej.\n" + +#: src/grep.c:1053 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE] ...\n" +msgstr "U¿ycie: %s [OPCJA]... WZORZEC [PLIK] ...\n" + +#: src/grep.c:1054 +#, c-format +msgid "" +"Search for PATTERN in each FILE or standard input.\n" +"Example: %s -i 'hello world' menu.h main.c\n" +"\n" +"Regexp selection and interpretation:\n" +msgstr "" +"Szukanie WZORCA w ka¿dym pliku lub na standardowym wej¶ciu.\n" +"Przyk³ad: %s -i 'hello world' menu.h main.c\n" +"\n" +"Wybór i interpretacja wyra¿eñ regularnych:\n" + +#: src/grep.c:1059 +msgid "" +" -E, --extended-regexp PATTERN is an extended regular expression\n" +" -F, --fixed-strings PATTERN is a set of newline-separated strings\n" +" -G, --basic-regexp PATTERN is a basic regular expression\n" +" -P, --perl-regexp PATTERN is a Perl regular expression\n" +msgstr "" +" -E, --extended-regexp WZORZEC jest rozszerzonym wyr. regularnym\n" +" -F, --fixed-strings WZORZEC napisy oddzielone przez zn. nowej linii\n" +" -G, --basic-regexp WZORZEC jest podstawowym wyr. regularnym\n" +" -P, --perl-regexp WZORZEC jest wyra¿eniem regularnym perla\n" + +#: src/grep.c:1064 +msgid "" +" -e, --regexp=PATTERN use PATTERN as a regular expression\n" +" -f, --file=FILE obtain PATTERN from FILE\n" +" -i, --ignore-case ignore case distinctions\n" +" -w, --word-regexp force PATTERN to match only whole words\n" +" -x, --line-regexp force PATTERN to match only whole lines\n" +" -z, --null-data a data line ends in 0 byte, not newline\n" +msgstr "" +" -e, --regexp=WZORZEC u¿ycie WZORCA jako wyra¿enia regularnego\n" +" -f, --file=PLIK u¿ycie wzorców z PLIKU\n" +" -i, --ignore-case zignorowanie ro¿nic miêdzy ma³ymi i wlk. lit.\n" +" -w, --word-regexp dopasowanie WZORZEC tylko do pe³nych s³ów\n" +" -x, --line-regexp dopasowanie WZORZEC tylko do ca³ych linii\n" +" -z, --null-data linie s± zakoñczone bajtem 0, nie znakiem\n" +" nowej linii\n" + +#: src/grep.c:1071 +msgid "" +"\n" +"Miscellaneous:\n" +" -s, --no-messages suppress error messages\n" +" -v, --invert-match select non-matching lines\n" +" -V, --version print version information and exit\n" +" --help display this help and exit\n" +" --mmap use memory-mapped input if possible\n" +msgstr "" +"\n" +"Ró¿ne:\n" +" -s, --no-messages bez komunikatów o b³êdach\n" +" -v, --revert-match wybierz linie nie pasuj±ce\n" +" -V, --version wypisz informacjê o wersji i zakoñcz\n" +" --help wy¶wietl tê informacjê i zakoñcz\n" +" --mmap je¿eli mo¿liwe mapuj pliki w pamiêci\n" + +#: src/grep.c:1079 +msgid "" +"\n" +"Output control:\n" +" -m, --max-count=NUM stop after NUM matches\n" +" -b, --byte-offset print the byte offset with output lines\n" +" -n, --line-number print line number with output lines\n" +" --line-buffered flush output on every line\n" +" -H, --with-filename print the filename for each match\n" +" -h, --no-filename suppress the prefixing filename on output\n" +" --label=LABEL print LABEL as filename for standard input\n" +" -o, --only-matching show only the part of a line matching PATTERN\n" +" -q, --quiet, --silent suppress all normal output\n" +" --binary-files=TYPE assume that binary files are TYPE\n" +" TYPE is 'binary', 'text', or 'without-match'\n" +" -a, --text equivalent to --binary-files=text\n" +" -I equivalent to --binary-files=without-match\n" +" -d, --directories=ACTION how to handle directories\n" +" ACTION is 'read', 'recurse', or 'skip'\n" +" -D, --devices=ACTION how to handle devices, FIFOs and sockets\n" +" ACTION is 'read' or 'skip'\n" +" -R, -r, --recursive equivalent to --directories=recurse\n" +" --include=PATTERN files that match PATTERN will be examined\n" +" --exclude=PATTERN files that match PATTERN will be skipped.\n" +" --exclude-from=FILE files that match PATTERN in FILE will be skipped.\n" +" -L, --files-without-match only print FILE names containing no match\n" +" -l, --files-with-matches only print FILE names containing matches\n" +" -c, --count only print a count of matching lines per FILE\n" +" -Z, --null print 0 byte after FILE name\n" +msgstr "" +"\n" +"Sterowanie danymi wyj¶ciowymi:\n" +" -m, --max-count=ILE zatrzymanie po ILE dopasowaniach\n" +" -b, --byte-offset wypisanie pozycji bajtów w wyniku\n" +" -n, --line-number wypisanie numerów linii w wyniku\n" +" --line-buffered opró¿nienie buf. wyj. po ka¿dej linii\n" +" -H, --with-filename wypisanie nazwy pliku dla ka¿dej linii\n" +" -h, --no-filename bez nazwy pliku w liniach wyj¶ciowych\n" +" --label=ETYKIETA w wyniku ETYKIETA zastêpuje nazwe pliku\n" +" -o, --only-matching pokazanie tylko kawa³ka, który pasuje do WZORCA\n" +" -q, --quiet, --silent wy³±czenie wypisywanie wyniku\n" +" --binary-files=TYP za³o¿enie, ¿e pliki binarne s± typu TYP\n" +" TYP to 'binary', 'text' lub 'without-match'.\n" +" -a, --text równowa¿ne --binary-files=text\n" +" -I równowa¿ne --binary-files=without-match\n" +" -d, --directories=DZIA£ANIE jak siê obchodziæ z katalogami,\n" +" DZIA£ANIE to `read' (czytanie), `,recurse'\n" +" (przegl±danie rekurencujne) albo 'skip'\n" +" (pominiêcie).\n" +" -D, --devices=DZIA£ANIE jak odwo³ywaæ siê do urz±dzeñ, FIFO i gniazd,\n" +" DZIA£ANIE to 'read' (czytaj) albo 'skip' (pomiñ)\n" +" -R, -r, --recursive równowa¿ne --directories=recurse .\n" +" --include=WZORZEC przeszukiwane bêd± pliki pasuj±ce do WZORCA\n" +" --exclude=WZORZEC pliki pasuj±ce do WZORCA bêd± pominiête\n" +" --exclude-from=PLIK pominiêcie plików pasuj±cych do WZORCÓW w PLIKU\n" +" -L, --files-without-match wypisanie tylko nazw PLIKÓW bez trafieñ\n" +" -l, --files-with-matches wypisanie tylko nazw PLIKÓW z trafieniami\n" +" -c, --count wypisanie tylko ilo¶ci pasuj±cych linii w PLIKACH\n" +" -Z, --null wypisanie bajtu 0 po ka¿dej nazwie PLIKU\n" + +#: src/grep.c:1107 +msgid "" +"\n" +"Context control:\n" +" -B, --before-context=NUM print NUM lines of leading context\n" +" -A, --after-context=NUM print NUM lines of trailing context\n" +" -C, --context=NUM print NUM lines of output context\n" +" -NUM same as --context=NUM\n" +" --color[=WHEN],\n" +" --colour[=WHEN] use markers to distinguish the matching string\n" +" WHEN may be `always', `never' or `auto'.\n" +" -U, --binary do not strip CR characters at EOL (MSDOS)\n" +" -u, --unix-byte-offsets report offsets as if CRs were not there (MSDOS)\n" +"\n" +"`egrep' means `grep -E'. `fgrep' means `grep -F'.\n" +"With no FILE, or when FILE is -, read standard input. If less than\n" +"two FILEs given, assume -h. Exit status is 0 if match, 1 if no match,\n" +"and 2 if trouble.\n" +msgstr "" +"\n" +"Sterowanie kontekstem:\n" +" -B, --before-context=ILE wypisanie ILE linii kontekstu przed\n" +" -A, --after-context=ILE wypisanie ILE linii kontekstu po\n" +" -C, --context[=ILE] wypisanie ILE (domy¶lnie 2) linii kontekstu\n" +" -ILE to samo co --context=ILE\n" +" --color[=KIEDY],\n" +" --colour[=KIEDY] oznaczanie pasuj±cych znaków,\n" +" KIEDY to `always' (zawsze), `never' (nigdy)\n" +" albo `auto' (automatycznie).\n" +" -U, --binary bez usuwania znaków nowej linii na koñcu\n" +" -u, --unix-byte-offsets podawanie pozycji tak jakby nie by³o CRów (MSDOS)\n" +"\n" +"`egrep' oznacza `grep -E'. `fgrep' oznacza `grep -F'.\n" +"Bez PLIKu albo gdy PLIK to -, czytane jest standardowe wej¶cie. Je¿eli\n" +"podano mniej ni¿ dwa PLIKi, zak³ada -h. Zakoñczenie z kodem 0 je¿eli\n" +"WZORZEC pasuje, z 1, je¿eli nie, z 2, je¿eli s± problemy.\n" + +#: src/grep.c:1124 +msgid "" +"\n" +"Report bugs to .\n" +msgstr "" +"\n" +"Raporty o b³êdach nale¿y wysy³aæ do bug-grep@gnu.org.\n" + +# viendo los fuentes , hay varias opciones +# que hay sin documentar. O quiza es que getopt() lo he entendido mal +# Son las opciones X ( requiere argumento ) , switchs -c, -b, -L e -y +# grep.c:622 -> +# opt = getopt(argc, argv, "0123456789A:B:CEFGVX:bce:f:hiLlnqsvwxy" +# grep --help -> +# usage: grep [-[[AB] ]] [-[CEFGVchilnqsvwx]] [-[ef]] [] +# La opción -X es a la que corresponde esta línea. +#: src/grep.c:1134 +msgid "conflicting matchers specified" +msgstr "podane sprzeczne wzorce" + +#: src/grep.c:1376 +msgid "unknown devices method" +msgstr "nieznany sposób przegl±dania urz±dzeñ" + +#: src/grep.c:1443 +msgid "unknown directories method" +msgstr "nieznany sposób przegl±dania katalogów" + +#: src/grep.c:1510 +msgid "invalid max count" +msgstr "b³êdna maksymalna liczba powtórzeñ" + +#: src/grep.c:1565 +msgid "unknown binary-files type" +msgstr "nieznany typ pliku binarnego" + +#: src/grep.c:1660 +#, c-format +msgid "%s (GNU grep) %s\n" +msgstr "%s (GNU grep) %s\n" + +#: src/grep.c:1662 +msgid "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" +msgstr "Copyright (C) 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" + +#: src/grep.c:1664 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"Oprogramowanie darmowe. Warunki kopiowania zamieszczone s± w kodzie ¼ród³owym.\n" +"Nie podlega ¿adnej gwarancji, nawet gwarancji przydatno¶ci do jakiegokolwiek\n" +"zastosowania lub sprzeda¿y.\n" + +#: src/search.c:606 +msgid "The -P option is not supported" +msgstr "Opcja -P nie jest obs³ugiwana" + +#: src/search.c:619 +msgid "The -P and -z options cannot be combined" +msgstr "Opcje -P i -z nie mog± wystêpowaæ razem" + +#: lib/error.c:117 +msgid "Unknown system error" +msgstr "Nieznany b³±d systemowy" + +#: lib/getopt.c:675 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: opcja `%s' jest niejednoznaczna\n" + +#: lib/getopt.c:700 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: opcja `--%s' nie mo¿e mieæ argumentu\n" + +#: lib/getopt.c:705 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: opcja `%c%s' nie mo¿e mieæ argumentu\n" + +#: lib/getopt.c:723 lib/getopt.c:896 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: opcja `%s' wymaga argumentu\n" + +#. --option +#: lib/getopt.c:752 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: nierozpoznana opcja `--%s'\n" + +#. +option or -option +#: lib/getopt.c:756 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: nierozpoznana opcja `%c%s'\n" + +# should ther be a space between -- and %c? - rzm 970731 +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:782 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: nielegalna opcja -- %c\n" + +#: lib/getopt.c:785 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: b³êdna opcja -- %c\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:815 lib/getopt.c:945 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: opcja wymaga argumentu -- %c\n" + +#: lib/getopt.c:862 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: opcja `-W %s' jest niejednoznaczna\n" + +#: lib/getopt.c:880 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: opcja `-W %s' nie mo¿e mieæ argumentu\n" + +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#: lib/quotearg.c:259 +msgid "`" +msgstr "\"" + +#: lib/quotearg.c:260 +msgid "'" +msgstr "\"" diff --git a/po/pt.po b/po/pt.po new file mode 100644 index 0000000..5107b9c --- /dev/null +++ b/po/pt.po @@ -0,0 +1,404 @@ +# Localization for Portuguese +# Copyright (C) 2003 Free Software Foundation, Inc. +# Rui Malheiro , 2003. +# +msgid "" +msgstr "" +"Project-Id-Version: grep 2.5g\n" +"POT-Creation-Date: 2002-03-26 16:38+0100\n" +"PO-Revision-Date: 2003-04-09 00:07+0100\n" +"Last-Translator: Rui Malheiro \n" +"Language-Team: Portuguese \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: KBabel 0.9.6\n" + +#: src/dfa.c:136 src/dfa.c:147 src/dfa.c:158 src/search.c:689 +msgid "Memory exhausted" +msgstr "Memória esgotada" + +#: src/dfa.c:489 src/dfa.c:492 src/dfa.c:510 src/dfa.c:521 src/dfa.c:545 +#: src/dfa.c:604 src/dfa.c:609 src/dfa.c:622 src/dfa.c:623 src/dfa.c:1001 +#: src/dfa.c:1004 src/dfa.c:1028 src/dfa.c:1032 src/dfa.c:1033 src/dfa.c:1036 +#: src/dfa.c:1048 src/dfa.c:1049 +msgid "Unbalanced [" +msgstr "[ sem correspondência" + +#: src/dfa.c:741 +msgid "Unfinished \\ escape" +msgstr "\\ não terminado" + +#. Cases: +#. {M} - exact count +#. {M,} - minimum count, maximum is infinity +#. {M,N} - M through N +#: src/dfa.c:874 src/dfa.c:880 src/dfa.c:890 src/dfa.c:898 src/dfa.c:913 +msgid "unfinished repeat count" +msgstr "contador de repetição não terminado" + +#: src/dfa.c:887 src/dfa.c:904 src/dfa.c:912 src/dfa.c:916 +msgid "malformed repeat count" +msgstr "contador de repetição mal formado" + +#: src/dfa.c:1253 +msgid "Unbalanced (" +msgstr "( sem correspondência" + +#: src/dfa.c:1378 +msgid "No syntax specified" +msgstr "Sintaxe não especificada" + +#: src/dfa.c:1386 +msgid "Unbalanced )" +msgstr ") sem correspondência" + +#: src/dfa.c:2956 +msgid "out of memory" +msgstr "sem memória" + +#: src/kwset.c:171 src/kwset.c:177 src/search.c:103 src/search.c:209 +#: src/search.c:293 lib/obstack.c:471 +msgid "memory exhausted" +msgstr "memória esgotada" + +#: src/grep.c:205 +msgid "invalid context length argument" +msgstr "número de linhas de contexto inválido" + +#: src/grep.c:479 +msgid "input is too large to count" +msgstr "ficheiro demasiado grande para manter contagem" + +#: src/grep.c:605 +msgid "writing output" +msgstr "a escrever o resultado" + +#: src/grep.c:878 +#, c-format +msgid "Binary file %s matches\n" +msgstr "Padrão encontrado no ficheiro binário %s\n" + +#: src/grep.c:892 +msgid "(standard input)" +msgstr "(standard input)" + +#: src/grep.c:997 +#, c-format +msgid "warning: %s: %s\n" +msgstr "aviso: %s: %s\n" + +#: src/grep.c:998 +msgid "recursive directory loop" +msgstr "directoria em ciclo recursivo" + +#: src/grep.c:1046 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE]...\n" +msgstr "Utilização: %s [OPÇÃO]... PADRÃO [FICHEIRO]...\n" + +#: src/grep.c:1048 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "Experimente `%s --help' para mais informação.\n" + +#: src/grep.c:1053 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE] ...\n" +msgstr "Utilização: %s [OPÇÃO]... PADRÃO [FICHEIRO] ...\n" + +#: src/grep.c:1054 +#, c-format +msgid "" +"Search for PATTERN in each FILE or standard input.\n" +"Example: %s -i 'hello world' menu.h main.c\n" +"\n" +"Regexp selection and interpretation:\n" +msgstr "" +"Procurar por PADRÃO em cada FICHEIRO ou no standard input.\n" +"Exemplo: %s -i 'olá mundo' menu.h main.c\n" +"\n" +"Selecção e interpretação de regexp\n" + +#: src/grep.c:1059 +msgid "" +" -E, --extended-regexp PATTERN is an extended regular expression\n" +" -F, --fixed-strings PATTERN is a set of newline-separated strings\n" +" -G, --basic-regexp PATTERN is a basic regular expression\n" +" -P, --perl-regexp PATTERN is a Perl regular expression\n" +msgstr "" +" -E, --extended-regexp PADRÃO é uma expressão regular extendida\n" +" -F, --fixed-strings PADRÃO é um conjunto de frases separadas por newline\n" +" -G, --basic-regexp PADRÃO é uma expressão regular básica\n" +" -P, --perl-regexp PADRÃO é uma expressão regular de Perl\n" + +#: src/grep.c:1064 +msgid "" +" -e, --regexp=PATTERN use PATTERN as a regular expression\n" +" -f, --file=FILE obtain PATTERN from FILE\n" +" -i, --ignore-case ignore case distinctions\n" +" -w, --word-regexp force PATTERN to match only whole words\n" +" -x, --line-regexp force PATTERN to match only whole lines\n" +" -z, --null-data a data line ends in 0 byte, not newline\n" +msgstr "" +" -e, --regexp=PADRÃO usar PADRÃO como uma expressão regular\n" +" -f, --file=FICHEIRO ler PADRÃO do FICHEIRO\n" +" -i, --ignore-case ignorar diferenças entre maiúsculas e minúsculas\n" +" -w, --word-regexp forçar PADRÃO a igualar apenas a palavras completas\n" +" -x, --line-regexp forçar PADRÃO a igualar apenas a linhas completas\n" +" -z, --null-data uma linha é terminada com o byte 0, não com newline\n" + +#: src/grep.c:1071 +msgid "" +"\n" +"Miscellaneous:\n" +" -s, --no-messages suppress error messages\n" +" -v, --invert-match select non-matching lines\n" +" -V, --version print version information and exit\n" +" --help display this help and exit\n" +" --mmap use memory-mapped input if possible\n" +msgstr "" +"\n" +"Miscellaneous:\\n\"\n" +" -s, --no-messages suprime mensagens de erro\n" +" -v, --invert-match seleciona linhas que não contenham PADRÃO\n" +" -V, --version apresenta informação de versão e termina\n" +" --help apresenta este texto de auxílio e termina\n" +" --mmap utilizar 'memory-mapped input' se possível\n" + +#: src/grep.c:1079 +msgid "" +"\n" +"Output control:\n" +" -m, --max-count=NUM stop after NUM matches\n" +" -b, --byte-offset print the byte offset with output lines\n" +" -n, --line-number print line number with output lines\n" +" --line-buffered flush output on every line\n" +" -H, --with-filename print the filename for each match\n" +" -h, --no-filename suppress the prefixing filename on output\n" +" --label=LABEL print LABEL as filename for standard input\n" +" -o, --only-matching show only the part of a line matching PATTERN\n" +" -q, --quiet, --silent suppress all normal output\n" +" --binary-files=TYPE assume that binary files are TYPE\n" +" TYPE is 'binary', 'text', or 'without-match'\n" +" -a, --text equivalent to --binary-files=text\n" +" -I equivalent to --binary-files=without-match\n" +" -d, --directories=ACTION how to handle directories\n" +" ACTION is 'read', 'recurse', or 'skip'\n" +" -D, --devices=ACTION how to handle devices, FIFOs and sockets\n" +" ACTION is 'read' or 'skip'\n" +" -R, -r, --recursive equivalent to --directories=recurse\n" +" --include=PATTERN files that match PATTERN will be examined\n" +" --exclude=PATTERN files that match PATTERN will be skipped.\n" +" --exclude-from=FILE files that match PATTERN in FILE will be skipped.\n" +" -L, --files-without-match only print FILE names containing no match\n" +" -l, --files-with-matches only print FILE names containing matches\n" +" -c, --count only print a count of matching lines per FILE\n" +" -Z, --null print 0 byte after FILE name\n" +msgstr "" +"\n" +"Controlo de resultados\n" +" -m, --max-count=NUM pára após NUM resultados\n" +" -b, --byte-offset apresenta o 'byte offset' nos resultados\n" +" -n, --line-number apresenta o número de linha nos resultados\n" +" --line-buffered 'flush output' em cada linha\n" +" -H, --with-filename apresenta o nome do ficheiro para cada resultado\n" +" -h, --no-filename não apresenta o nome do ficheiro nos resultados\n" +" --label=NOME utiliza NOME de ficheiro para o «standard input»\n" +" -o, --only-matching apresenta só a parte da linha que satisfaz PADRÃO\n" +" -q, --quiet, --silent suprime toda a apresentação de resultados\n" +" --binary-files=TIPO assume que ficheiros binários são do TIPO\n" +" TIPO pode ser 'binary', 'text', ou 'without-match'\n" +" -a, --text equivalente a --binary-files=text\n" +" -I equivalente a --binary-files=without-match\n" +" -d, --directories=ACÇÃO como lidar com directorias\n" +" ACÇÃO pode ser 'read', 'recurse', ou 'skip'\n" +" -D, --devices=ACÇÃO como lidar com devices, FIFOs e sockets\\n\"\n" +" ACÇÃO pode ser 'read' ou 'skip'\n" +" -R, -r, --recursive equivalente a --directories=recurse\n" +" --include=PADRÃO ficheiros que satisfaçam PADRÃO serão examinados\n" +" --exclude=PADRÃO ficheiros que satisfaçam PADRÃo serão ignorados\n" +" --exclude-from=FICH ficheiros que satisfaçam PADRÃO indicado em FICH\n" +" serão ignorados\n" +" -L, --files-without-match apresenta apenas FICHEIROS que não satisfaçam PADRÃO\n" +" -l, --files-with-matches apresenta apenas FICHEIROS que satisfaçam o PADRÃO\n" +" -c, --count apresenta para cada FICHEIRO um contador com o\n" +" número de linhas que satisfazem PADRÃO\n" +" -Z, --null imprimir o byte 0 após cada nome de FICHEIRO\n" + +#: src/grep.c:1107 +msgid "" +"\n" +"Context control:\n" +" -B, --before-context=NUM print NUM lines of leading context\n" +" -A, --after-context=NUM print NUM lines of trailing context\n" +" -C, --context=NUM print NUM lines of output context\n" +" -NUM same as --context=NUM\n" +" --color[=WHEN],\n" +" --colour[=WHEN] use markers to distinguish the matching string\n" +" WHEN may be `always', `never' or `auto'.\n" +" -U, --binary do not strip CR characters at EOL (MSDOS)\n" +" -u, --unix-byte-offsets report offsets as if CRs were not there (MSDOS)\n" +"\n" +"`egrep' means `grep -E'. `fgrep' means `grep -F'.\n" +"With no FILE, or when FILE is -, read standard input. If less than\n" +"two FILEs given, assume -h. Exit status is 0 if match, 1 if no match,\n" +"and 2 if trouble.\n" +msgstr "" +"\n" +"Controlo de contexto:\n" +" -B, --before-context=NUM apresenta NUM linhas de contexto anteriores a PADRÃO\n" +" -A, --after-context=NUM apresenta NUM linhas de contexto a seguir a PADRÃO\n" +" -C, --context=NUM apresenta NUM linhas de contexto no resultado\n" +" -NUM equivalente a --context=NUM\n" +" --color[=QUANDO],\n" +" --colour[=QUANDO] utiliza marcadores para distinguir as partes que\n" +" satisfazem o PADRÃO\n" +" QUANDO pode ser `always', `never' ou `auto'\n" +" -U, --binary não remover caracteres CR em EOL (MSDOS)\n" +" -u, --unix-byte-offsets reportar «offsets» como se não houvesse CRs (MSDOS)\n" +"\n" +"`egrep' é equivalente a `grep -E'. `fgrep' é equivalente a `grep -F'\n" +"Sem FICHEIRO ou quando FICHEIRO é -, ler o «standard input». Se forem dados\n" +"dois FICHEIROS, assume -h. Devolve 0 se encontrar pelo menos uma occorência\n" +"de PADRÃO, 1 se não encontrar, 2 se tiver algum problema.\n" + +#: src/grep.c:1124 +#, fuzzy +msgid "" +"\n" +"Report bugs to .\n" +msgstr "" +"\n" +"Reporte «bugs» para .\n" + +#: src/grep.c:1134 +msgid "conflicting matchers specified" +msgstr "foram especificados métodos de pesquisa incompatíveis" + +#: src/grep.c:1376 +msgid "unknown devices method" +msgstr "método para acesso a «devices» desconhecido" + +#: src/grep.c:1443 +msgid "unknown directories method" +msgstr "método para acesso a directorias desconhecido" + +#: src/grep.c:1510 +msgid "invalid max count" +msgstr "número máximo inválido" + +#: src/grep.c:1565 +msgid "unknown binary-files type" +msgstr "tipo de ficheiro binário desconhecido" + +#: src/grep.c:1660 +#, c-format +msgid "%s (GNU grep) %s\n" +msgstr "%s (GNU grep) %s\n" + +#: src/grep.c:1662 +msgid "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" +msgstr "Direitos de autor 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" + +#: src/grep.c:1664 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"Este software é software livre; leia o código fonte para saber as condições.\n" +"NÃO existe qualquer garantia; nem mesmo sobre COMERCIALIZAÇÃO ou CONFORMIDADE\n" +"PARA UM DETERMINADO FIM.\n" + +#: src/search.c:606 +msgid "The -P option is not supported" +msgstr "A opção -P não é suportada" + +#: src/search.c:619 +msgid "The -P and -z options cannot be combined" +msgstr "A opção -P e -z não podem ser combinadas" + +#: lib/error.c:117 +msgid "Unknown system error" +msgstr "Erro de sistema indeterminado" + +#: lib/getopt.c:675 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: a opção `%s' é ambígua\n" + +#: lib/getopt.c:700 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: a opção `%s' não aceita um argumento\n" + +#: lib/getopt.c:705 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: a opção `%c%s' não aceita um argumento\n" + +#: lib/getopt.c:723 lib/getopt.c:896 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "\"%s: a opção `%s' exige um argumento\n" + +#. --option +#: lib/getopt.c:752 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: opção `--%s' desconhecida\n" + +#. +option or -option +#: lib/getopt.c:756 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: opção `%c%s' desconhecida\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:782 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: opção ilegal -- %c\n" + +#: lib/getopt.c:785 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: opção inválida -- %c\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:815 lib/getopt.c:945 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: a opção exige um argumento -- %c\n" + +#: lib/getopt.c:862 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: a opção `-W %s' é ambígua\n" + +#: lib/getopt.c:880 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: a opção `-W %s' não aceita um argumento\n" + +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#: lib/quotearg.c:259 +msgid "`" +msgstr "`" + +#: lib/quotearg.c:260 +msgid "'" +msgstr "'" diff --git a/po/pt_BR.po b/po/pt_BR.po new file mode 100644 index 0000000..6056d9f --- /dev/null +++ b/po/pt_BR.po @@ -0,0 +1,409 @@ +# grep: translation to Brazilian Portuguese (pt_BR) +# Copyright (C) 2002 Free Software Foundation, Inc. +# Alexandre Folle de Menezes , 2002. +# based on the previous translation to pt_BR (v2.4f) by +# Rodrigo Stulzer Lopes , 1997. +# based on the translation to Spanish (es) by +# Enrique Melero Gómez , 1996. +# Santiago Vila Doncel , 1997, 1998, 1999, 2000, 2001, 2002. +# +msgid "" +msgstr "" +"Project-Id-Version: grep 2.5g\n" +"POT-Creation-Date: 2002-03-26 16:38+0100\n" +"PO-Revision-Date: 2002-07-23 03:15-0300\n" +"Last-Translator: Rodrigo Stulzer Lopes \n" +"Language-Team: Brazilian Portuguese \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-1\n" +"Content-Transfer-Encoding: 8-bit\n" + +#: src/dfa.c:136 src/dfa.c:147 src/dfa.c:158 src/search.c:689 +msgid "Memory exhausted" +msgstr "Memória esgotada" + +#: src/dfa.c:489 src/dfa.c:492 src/dfa.c:510 src/dfa.c:521 src/dfa.c:545 +#: src/dfa.c:604 src/dfa.c:609 src/dfa.c:622 src/dfa.c:623 src/dfa.c:1001 +#: src/dfa.c:1004 src/dfa.c:1028 src/dfa.c:1032 src/dfa.c:1033 src/dfa.c:1036 +#: src/dfa.c:1048 src/dfa.c:1049 +msgid "Unbalanced [" +msgstr "[ desbalanceado" + +#: src/dfa.c:741 +msgid "Unfinished \\ escape" +msgstr "Escape \\ inacabado" + +#. Cases: +#. {M} - exact count +#. {M,} - minimum count, maximum is infinity +#. {M,N} - M through N +#: src/dfa.c:874 src/dfa.c:880 src/dfa.c:890 src/dfa.c:898 src/dfa.c:913 +msgid "unfinished repeat count" +msgstr "contador de repetição não terminado" + +#: src/dfa.c:887 src/dfa.c:904 src/dfa.c:912 src/dfa.c:916 +msgid "malformed repeat count" +msgstr "contador de repetição mal formulado" + +#: src/dfa.c:1253 +msgid "Unbalanced (" +msgstr "( desbalanceado" + +#: src/dfa.c:1378 +msgid "No syntax specified" +msgstr "Nenhuma sintaxe especificada" + +#: src/dfa.c:1386 +msgid "Unbalanced )" +msgstr ") desbalanceado" + +#: src/dfa.c:2956 +msgid "out of memory" +msgstr "memória esgotada" + +#: src/kwset.c:171 src/kwset.c:177 src/search.c:103 src/search.c:209 +#: src/search.c:293 lib/obstack.c:471 +msgid "memory exhausted" +msgstr "memória esgotada" + +#: src/grep.c:205 +msgid "invalid context length argument" +msgstr "argumento comprimento do contexto inválido" + +#: src/grep.c:479 +msgid "input is too large to count" +msgstr "entrada longa de mais para contar" + +#: src/grep.c:605 +msgid "writing output" +msgstr "escrevendo saída" + +#: src/grep.c:878 +#, c-format +msgid "Binary file %s matches\n" +msgstr "Arquivo binário %s casa com o padrão\n" + +#: src/grep.c:892 +msgid "(standard input)" +msgstr "(entrada padrão)" + +#: src/grep.c:997 +#, c-format +msgid "warning: %s: %s\n" +msgstr "aviso: %s: %s\n" + +#: src/grep.c:998 +msgid "recursive directory loop" +msgstr "loop de diretório recursivo" + +#: src/grep.c:1046 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE]...\n" +msgstr "Uso: %s [OPÇÃO]... PADRÃO [ARQUIVO]...\n" + +#: src/grep.c:1048 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "Tente `%s --help' para mais informações.\n" + +#: src/grep.c:1053 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE] ...\n" +msgstr "Uso: %s [OPÇÃO]... PADRÃO [ARQUIVO]...\n" + +#: src/grep.c:1054 +#, c-format +msgid "" +"Search for PATTERN in each FILE or standard input.\n" +"Example: %s -i 'hello world' menu.h main.c\n" +"\n" +"Regexp selection and interpretation:\n" +msgstr "" +"Procura por PADRÃO em cada ARQUIVO ou entrada padrão.\n" +"Exemplo: %s -i 'hello world' menu.h main.c\n" +"\n" +"Seleção e interpretação de expressão regular:\n" + +#: src/grep.c:1059 +msgid "" +" -E, --extended-regexp PATTERN is an extended regular expression\n" +" -F, --fixed-strings PATTERN is a set of newline-separated strings\n" +" -G, --basic-regexp PATTERN is a basic regular expression\n" +" -P, --perl-regexp PATTERN is a Perl regular expression\n" +msgstr "" +" -E, --extended-regexp PADRÃO é um expressão regular extendida\n" +" -F, --fixed-strings PADRÃO são strings separadas por nova linha\n" +" -G, --basic-regexp PADRÃO é um expressão regular básica\n" +" -P, --perl-regexp PADRÃO é uma expressão regular Perl\n" + +#: src/grep.c:1064 +msgid "" +" -e, --regexp=PATTERN use PATTERN as a regular expression\n" +" -f, --file=FILE obtain PATTERN from FILE\n" +" -i, --ignore-case ignore case distinctions\n" +" -w, --word-regexp force PATTERN to match only whole words\n" +" -x, --line-regexp force PATTERN to match only whole lines\n" +" -z, --null-data a data line ends in 0 byte, not newline\n" +msgstr "" +" -e, --regexp=PADRÃO usar PADRÃO como uma expressão regular\n" +" -f, --file=ARQUIVO obter PADRÃO do ARQUIVO\n" +" -i, --ignore-case ignora maiúsculas/minúsculas\n" +" -w, --word-regexp força PADRÃO a casar apenas palavras inteiras\n" +" -x, --line-regexp força PADRÃO a casar apenas linhas inteiras\n" +" -z, --null-data uma linha de dados acaba com byte 0, não nova linha\n" + +#: src/grep.c:1071 +msgid "" +"\n" +"Miscellaneous:\n" +" -s, --no-messages suppress error messages\n" +" -v, --invert-match select non-matching lines\n" +" -V, --version print version information and exit\n" +" --help display this help and exit\n" +" --mmap use memory-mapped input if possible\n" +msgstr "" +"\n" +"Miscelânea:\n" +" -s, --no-messages suprime mensagens de erro\n" +" -v, --revert-match seleciona somente linhas não casadas\n" +" -V, --version mostra informações sobre versão e sai\n" +" --help exibe esta ajuda e sai\n" +" --mmap usa entrada mapeada em memória se possível\n" + +#: src/grep.c:1079 +msgid "" +"\n" +"Output control:\n" +" -m, --max-count=NUM stop after NUM matches\n" +" -b, --byte-offset print the byte offset with output lines\n" +" -n, --line-number print line number with output lines\n" +" --line-buffered flush output on every line\n" +" -H, --with-filename print the filename for each match\n" +" -h, --no-filename suppress the prefixing filename on output\n" +" --label=LABEL print LABEL as filename for standard input\n" +" -o, --only-matching show only the part of a line matching PATTERN\n" +" -q, --quiet, --silent suppress all normal output\n" +" --binary-files=TYPE assume that binary files are TYPE\n" +" TYPE is 'binary', 'text', or 'without-match'\n" +" -a, --text equivalent to --binary-files=text\n" +" -I equivalent to --binary-files=without-match\n" +" -d, --directories=ACTION how to handle directories\n" +" ACTION is 'read', 'recurse', or 'skip'\n" +" -D, --devices=ACTION how to handle devices, FIFOs and sockets\n" +" ACTION is 'read' or 'skip'\n" +" -R, -r, --recursive equivalent to --directories=recurse\n" +" --include=PATTERN files that match PATTERN will be examined\n" +" --exclude=PATTERN files that match PATTERN will be skipped.\n" +" --exclude-from=FILE files that match PATTERN in FILE will be skipped.\n" +" -L, --files-without-match only print FILE names containing no match\n" +" -l, --files-with-matches only print FILE names containing matches\n" +" -c, --count only print a count of matching lines per FILE\n" +" -Z, --null print 0 byte after FILE name\n" +msgstr "" +"\n" +"Controle de saída:\n" +" -m, --max-count=NÚM parar depois de NUM linhas casadas\n" +" -b, --byte-offset exibe o deslocamento em bytes junto com a saída\n" +" -n, --line-number exibe o número da linha junto com a saída\n" +" --line-buffered esvazia o buffer de saida em cada linha\n" +" -H, --with-filename exibe o nome do arquivo para cada padrão encontrado\n" +" -h, --no-filename inibe o nome de arquivo na saída\n" +" --label=ETIQUETA mostra ETIQUETA como o nome da entrada padrão\n" +" -o, --only-matching mostra apenas da linha que casa com PADRÃO\n" +" -q, --quiet, --silent inibe todas as saídas normais\n" +" --binary-files=TIPO assume que arquivos binários são TIPO\n" +" TIPO é 'binary'. 'text', ou 'without-match'.\n" +" -a, --text equivalente a --binary-files=text\n" +" -I equivalente a --binary-files=without-match\n" +" -d, --directories=AÇÃO como tratar diretórios\n" +" AÇÃO pode ser: 'read' (ler), 'recurse' (recursivo),\n" +" ou 'skip' (não considerar).\n" +" -R, -r, --recursive equivalente a --directories=recurse.\n" +" --include=PATTERN arquivos que casam com PADRÃO serão examinados\n" +" --exclude=PATTERN arquivos que casam com PADRÃO serão ignorados.\n" +" --exclude-from=FILE arquivos que casam com PADRÃO no ARQUIVO\n" +" serão ignorados.\n" +" -L, --files-without-match exibe os nomes somente dos arquivos não casam\n" +" com o padrão\n" +" -l, --files-with-matches exibe os nomes somente dos arquivos casam com\n" +" o padrão\n" +" -c, --count exibe a contagem de linhas que casam com o padrão\n" +" por ARQUIVO\n" +" -Z, --null mostra byte 0 depois do nome do ARQUIVO\n" + +#: src/grep.c:1107 +msgid "" +"\n" +"Context control:\n" +" -B, --before-context=NUM print NUM lines of leading context\n" +" -A, --after-context=NUM print NUM lines of trailing context\n" +" -C, --context=NUM print NUM lines of output context\n" +" -NUM same as --context=NUM\n" +" --color[=WHEN],\n" +" --colour[=WHEN] use markers to distinguish the matching string\n" +" WHEN may be `always', `never' or `auto'.\n" +" -U, --binary do not strip CR characters at EOL (MSDOS)\n" +" -u, --unix-byte-offsets report offsets as if CRs were not there (MSDOS)\n" +"\n" +"`egrep' means `grep -E'. `fgrep' means `grep -F'.\n" +"With no FILE, or when FILE is -, read standard input. If less than\n" +"two FILEs given, assume -h. Exit status is 0 if match, 1 if no match,\n" +"and 2 if trouble.\n" +msgstr "" +"\n" +"Controle de contexto:\n" +" -B, --before-context=NUM mostra NUM linhas de contexto anterior\n" +" -A, --after-context=NUM mostra NUM linhas de contexto posterior\n" +" -C, --context=[NUM] mostra NUM linhas de contexto de saída\n" +" -NUM o mesmo que --context=NUM\n" +" --color[=QUANDO],\n" +" --colour[=QUANDO] usa marcadores para distinguir a string casada\n" +" QUANDO pode ser `always' (sempre), `never' (nunca)\n" +" ou `auto' (automático).\n" +" -U, --binary não elimina caracteres CR em final de linha (MSDOS)\n" +" -u, --unix-byte-offsets reporta deslocamentos como se não existissem CRs (MSDOS)\n" +"\n" +"`egrep' significa `grep -E', `fgrep' significa `grep -F'.\n" +"Se não informado o ARQUIVO, ou se ARQUIVO é -, lê da entrada padrão. Se menos\n" +"que dois ARQUIVOs forem especificados, assume -h. Retorna 0 se encontra o\n" +"padrão, 1 se não encontra, e 2 se houver erros.\n" + +#: src/grep.c:1124 +#, fuzzy +msgid "" +"\n" +"Report bugs to .\n" +msgstr "" +"\n" +"Informe problemas para .\n" + +#: src/grep.c:1134 +msgid "conflicting matchers specified" +msgstr "especificados padrões de procura conflitantes" + +#: src/grep.c:1376 +msgid "unknown devices method" +msgstr "método desconhecido de dispositivos" + +#: src/grep.c:1443 +msgid "unknown directories method" +msgstr "método desconhecido de diretórios" + +#: src/grep.c:1510 +msgid "invalid max count" +msgstr "valor máximo inválido" + +#: src/grep.c:1565 +msgid "unknown binary-files type" +msgstr "tipo de arquivo binário desconhecido" + +#: src/grep.c:1660 +#, c-format +msgid "%s (GNU grep) %s\n" +msgstr "%s (GNU grep) %s\n" + +#: src/grep.c:1662 +msgid "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" +msgstr "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" + +#: src/grep.c:1664 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"Este é um software livre; veja o código fonte para condições de copyright. Não\n" +"existe NENHUMA garantia; nem mesmo a garantia implícita de COMERCIABILIDADE ou\n" +"ADEQUAÇÃO À QUALQUER FINALIDADE PARTICULAR.\n" + +#: src/search.c:606 +msgid "The -P option is not supported" +msgstr "A opção -P não é suportada" + +#: src/search.c:619 +msgid "The -P and -z options cannot be combined" +msgstr "As opções -P e -z não podem ser combinadas" + +#: lib/error.c:117 +msgid "Unknown system error" +msgstr "Erro de sistema desconhecido" + +#: lib/getopt.c:675 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: opção `%s' é ambígua\n" + +#: lib/getopt.c:700 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: opção `--%s' não aceita um argumento\n" + +#: lib/getopt.c:705 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: opção `%c%s' não aceita um argumento\n" + +#: lib/getopt.c:723 lib/getopt.c:896 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: opção `%s' requer um argumento\n" + +#. --option +#: lib/getopt.c:752 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: opção `--%s' não reconhecida\n" + +#. +option or -option +#: lib/getopt.c:756 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: opção `%c%s' não reconhecida\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:782 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: opção ilegal -- %c\n" + +#: lib/getopt.c:785 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: opção inválida -- %c\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:815 lib/getopt.c:945 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: opção requer um argumento -- %c\n" + +#: lib/getopt.c:862 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: opção `-W %s' é ambígua\n" + +#: lib/getopt.c:880 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: opção `-W %s' não aceita um argumento\n" + +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#: lib/quotearg.c:259 +msgid "`" +msgstr "`" + +#: lib/quotearg.c:260 +msgid "'" +msgstr "'" diff --git a/po/ro.po b/po/ro.po new file mode 100644 index 0000000..856a77a --- /dev/null +++ b/po/ro.po @@ -0,0 +1,401 @@ +# Mesajele în limba românã pentru grep. +# Copyright (C) 2003 Free Software Foundation, Inc. +# Eugen Hoanca , 2003. +# +msgid "" +msgstr "" +"Project-Id-Version: grep-2.5g.ro\n" +"POT-Creation-Date: 2002-03-26 16:38+0100\n" +"PO-Revision-Date: 2003-04-19 02:47+0000\n" +"Last-Translator: Eugen Hoanca \n" +"Language-Team: Romanian \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-2\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: KBabel 1.0\n" + +#: src/dfa.c:136 src/dfa.c:147 src/dfa.c:158 src/search.c:689 +msgid "Memory exhausted" +msgstr "Memorie plinã" + +#: src/dfa.c:489 src/dfa.c:492 src/dfa.c:510 src/dfa.c:521 src/dfa.c:545 +#: src/dfa.c:604 src/dfa.c:609 src/dfa.c:622 src/dfa.c:623 src/dfa.c:1001 +#: src/dfa.c:1004 src/dfa.c:1028 src/dfa.c:1032 src/dfa.c:1033 src/dfa.c:1036 +#: src/dfa.c:1048 src/dfa.c:1049 +msgid "Unbalanced [" +msgstr "[ fãrã pereche" + +#: src/dfa.c:741 +msgid "Unfinished \\ escape" +msgstr "\\ escape neterminat" + +#. Cases: +#. {M} - exact count +#. {M,} - minimum count, maximum is infinity +#. {M,N} - M through N +#: src/dfa.c:874 src/dfa.c:880 src/dfa.c:890 src/dfa.c:898 src/dfa.c:913 +msgid "unfinished repeat count" +msgstr "numãrare repetatã neterminatã" + +#: src/dfa.c:887 src/dfa.c:904 src/dfa.c:912 src/dfa.c:916 +msgid "malformed repeat count" +msgstr "numãrare repetatã malformatã" + +#: src/dfa.c:1253 +msgid "Unbalanced (" +msgstr "( fãrã pereche" + +#: src/dfa.c:1378 +msgid "No syntax specified" +msgstr "Nu s-a specificat sintaxa" + +#: src/dfa.c:1386 +msgid "Unbalanced )" +msgstr ") fãra pereche" + +#: src/dfa.c:2956 +msgid "out of memory" +msgstr "memorie plinã" + +#: src/kwset.c:171 src/kwset.c:177 src/search.c:103 src/search.c:209 +#: src/search.c:293 lib/obstack.c:471 +msgid "memory exhausted" +msgstr "memorie plinã" + +#: src/grep.c:205 +msgid "invalid context length argument" +msgstr "parametru lungime context invalid" + +#: src/grep.c:479 +msgid "input is too large to count" +msgstr "intrarea(input) este prea mare pentru numãrare" + +#: src/grep.c:605 +msgid "writing output" +msgstr "scriere output" + +#: src/grep.c:878 +#, c-format +msgid "Binary file %s matches\n" +msgstr "Fiºierul binar %s corespunde\n" + +#: src/grep.c:892 +msgid "(standard input)" +msgstr "(intrare standard)" + +#: src/grep.c:997 +#, c-format +msgid "warning: %s: %s\n" +msgstr "avertisment: %s: %s\n" + +#: src/grep.c:998 +msgid "recursive directory loop" +msgstr "buclã recursivã de directoare" + +#: src/grep.c:1046 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE]...\n" +msgstr "Folosire: %s [OPÞIUNE]... TIPAR [FIªIER]...\n" + +#: src/grep.c:1048 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "Încercaþi `%s --help' pentru mai multe informaþii.\n" + +#: src/grep.c:1053 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE] ...\n" +msgstr "Folosire: %s [OPÞIUNE]... TIPAR [FIªIER]...\n" + +#: src/grep.c:1054 +#, c-format +msgid "" +"Search for PATTERN in each FILE or standard input.\n" +"Example: %s -i 'hello world' menu.h main.c\n" +"\n" +"Regexp selection and interpretation:\n" +msgstr "" +"Cautã dupã TIPAR în fiecare FIºIER sau de la intrare standard.\n" +"Exemplu: %s -i 'hello world' menu.h main.c\n" +"\n" +"Selecþie ºi interpretare regexp:\n" + +#: src/grep.c:1059 +msgid "" +" -E, --extended-regexp PATTERN is an extended regular expression\n" +" -F, --fixed-strings PATTERN is a set of newline-separated strings\n" +" -G, --basic-regexp PATTERN is a basic regular expression\n" +" -P, --perl-regexp PATTERN is a Perl regular expression\n" +msgstr "" +" -E, --extended-regexp TIPAR este o expresie regulatã extinsã\n" +" -F, --fixed-strings TIPAR este un set de ºiruri separate de linie_nouã\n" +" -G, --basic-regexp TIPAR este o expresie exactã primarã\n" +" -P, --perl-regexp TIPAR este o expresie exactã Perl\n" + +#: src/grep.c:1064 +msgid "" +" -e, --regexp=PATTERN use PATTERN as a regular expression\n" +" -f, --file=FILE obtain PATTERN from FILE\n" +" -i, --ignore-case ignore case distinctions\n" +" -w, --word-regexp force PATTERN to match only whole words\n" +" -x, --line-regexp force PATTERN to match only whole lines\n" +" -z, --null-data a data line ends in 0 byte, not newline\n" +msgstr "" +" -e, --regexp=TIPAR foloseºte TIPAR ca expresie regulatã\n" +" -f, --file=FIªIER obþine TIPAR din FIªIER\n" +" -i, --ignore-case ignorã distincþille de caz(case)\n" +" -w, --word-regexp forþeazã TIPAR sa corespundã doar cuvintelor întregi\n" +" -x, --line-regexp forþeazã TIPAR sã corespundã doar liniilor întregi\n" +" -z, --null-data linia de date se terminã în octet 0, nu linie_nouã\n" + +#: src/grep.c:1071 +msgid "" +"\n" +"Miscellaneous:\n" +" -s, --no-messages suppress error messages\n" +" -v, --invert-match select non-matching lines\n" +" -V, --version print version information and exit\n" +" --help display this help and exit\n" +" --mmap use memory-mapped input if possible\n" +msgstr "" +"\n" +"Diverse:\n" +" -s, --no-messages suprimã mesajele de eroare\n" +" -v, --invert-match selecteazã liniile necorespunzãtoare\n" +" -V, --version tipãreºte informaþii versiune ºi terminã\n" +" --help afiºeazã acest ajutor ºi terminã\n" +" --mmap foloseºte intrare memory-mapped dacã e posibil\n" + +#: src/grep.c:1079 +msgid "" +"\n" +"Output control:\n" +" -m, --max-count=NUM stop after NUM matches\n" +" -b, --byte-offset print the byte offset with output lines\n" +" -n, --line-number print line number with output lines\n" +" --line-buffered flush output on every line\n" +" -H, --with-filename print the filename for each match\n" +" -h, --no-filename suppress the prefixing filename on output\n" +" --label=LABEL print LABEL as filename for standard input\n" +" -o, --only-matching show only the part of a line matching PATTERN\n" +" -q, --quiet, --silent suppress all normal output\n" +" --binary-files=TYPE assume that binary files are TYPE\n" +" TYPE is 'binary', 'text', or 'without-match'\n" +" -a, --text equivalent to --binary-files=text\n" +" -I equivalent to --binary-files=without-match\n" +" -d, --directories=ACTION how to handle directories\n" +" ACTION is 'read', 'recurse', or 'skip'\n" +" -D, --devices=ACTION how to handle devices, FIFOs and sockets\n" +" ACTION is 'read' or 'skip'\n" +" -R, -r, --recursive equivalent to --directories=recurse\n" +" --include=PATTERN files that match PATTERN will be examined\n" +" --exclude=PATTERN files that match PATTERN will be skipped.\n" +" --exclude-from=FILE files that match PATTERN in FILE will be skipped.\n" +" -L, --files-without-match only print FILE names containing no match\n" +" -l, --files-with-matches only print FILE names containing matches\n" +" -c, --count only print a count of matching lines per FILE\n" +" -Z, --null print 0 byte after FILE name\n" +msgstr "" +"\n" +"Control ieºire (output)l:\n" +" -m, --max-count=NUM oprire dupã NUM potriviri\n" +" -b, --byte-offset tipãreºte locaþia (byte offset) cu liniile rezultate\n" +" -n, --line-number tipãreºte numãrul liniei cu liniile rezultate\n" +" --line-buffered înnoieºte (flush) outputul la fiecare linie\n" +" -H, --with-filename tipãreºte numele de fiºier care corespund\n" +" -h, --no-filename suprimã prefixarea cu nume de fiºier la output\n" +" --label=ETICHETà tipãreºte ETICHETà ca nume fiºier pentru intrare standard\n" +" -o, --only-matching afiºeazã doar o parte a unei linii corespunzãtoare TIPARului\n" +" -q, --quiet, --silent suprimã tot outputul\n" +" --binary-files=TiP presupune ca fiºierele binare sunt TIP\n" +" unde TIP este 'binary', 'text', sau 'without-match'\n" +" -a, --text echivalent cu --binary-files=text\n" +" -I echivalent cu --binary-files=without-match\n" +" -d, --directories=ACÞIUNE mod de manipulare al directoarelor\n" +" ACÞIUNE este 'read', 'recurse', sau 'skip'\n" +" -D, --devices=ACÞIUNE mod de manipulare device-uri, FIFOuri ºi sockeþi\n" +" ACÞIUNE este 'read' sau 'skip'\n" +" -R, -r, --recursive echivalent cu --directories=recurse\n" +" --include=TIPAR fiºierele potrivite TIPARului vor fi examinate\n" +" --exclude=TIPAR fiºierele potrivite TIPARului vor fi omise.\n" +" --exclude-from=FIªIER fiºierele potrivite TIPARului în FIªIER vor fi omise.\n" +" -L, --files-without-match afiºeazã doar nume FIªIERe care nu corespund\n" +" -l, --files-with-matches afiºeazã doar nume FIªIERe care corespund\n" +" -c, --count afiºeazã doar numãrul de potriviri per FIªIER\n" +" -Z, --null tipãreºte octet 0 dupã nume FIªIER\n" + +#: src/grep.c:1107 +msgid "" +"\n" +"Context control:\n" +" -B, --before-context=NUM print NUM lines of leading context\n" +" -A, --after-context=NUM print NUM lines of trailing context\n" +" -C, --context=NUM print NUM lines of output context\n" +" -NUM same as --context=NUM\n" +" --color[=WHEN],\n" +" --colour[=WHEN] use markers to distinguish the matching string\n" +" WHEN may be `always', `never' or `auto'.\n" +" -U, --binary do not strip CR characters at EOL (MSDOS)\n" +" -u, --unix-byte-offsets report offsets as if CRs were not there (MSDOS)\n" +"\n" +"`egrep' means `grep -E'. `fgrep' means `grep -F'.\n" +"With no FILE, or when FILE is -, read standard input. If less than\n" +"two FILEs given, assume -h. Exit status is 0 if match, 1 if no match,\n" +"and 2 if trouble.\n" +msgstr "" +"\n" +"Control de context:\n" +" -B, --before-context=NUM tipãreºte NUM linii dinainte de context\n" +" -A, --after-context=NUM tipãreºte NUM linii de dupã context\n" +" -C, --context=NUM tipãreºte NUM linii de context\n" +" -NUM la fel ca ºi --context=NUM\n" +" --color[=CÂND],\n" +" --colour[=CÂND] foloseºte marcaje pentru a deosebi ºirurile potrivite\n" +" CÂND poate fi `always', `never' sau `auto'.\n" +" -U, --binary nu renunþa la caractere CR la EOL (MSDOS)\n" +" -u, --unix-byte-offsets declarã offset ca ºi cum CR n-ar fi acolo(MSDOS)\n" +"\n" +"`egrep' înseamnã `grep -E'. `fgrep' înseamnã `grep -F'.\n" +"Fãrã FIªIER, sau când FIªIER este -, se citeºte intrarea standard. Dacã se dau\n" +"mai puþin de 2 FIªIERe, se presupune -h. Starea de ieºire e 0 pentru\n" +"corespunzãtor, 1 pentru necorespunzãtor, ºi 2 pentru probleme.\n" + +#: src/grep.c:1124 +#, fuzzy +msgid "" +"\n" +"Report bugs to .\n" +msgstr "" +"\n" +"Raportaþi buguri la .\n" + +#: src/grep.c:1134 +msgid "conflicting matchers specified" +msgstr "conflicte între cãutãtorii (matchers) specificaþi" + +#: src/grep.c:1376 +msgid "unknown devices method" +msgstr "metodã dispozitive(devices) necunoscutã" + +#: src/grep.c:1443 +msgid "unknown directories method" +msgstr "metodã directoare necunoscutã" + +#: src/grep.c:1510 +msgid "invalid max count" +msgstr "numãrare maximã invalidã" + +#: src/grep.c:1565 +msgid "unknown binary-files type" +msgstr "tip fiºiere-binare necunoscut" + +#: src/grep.c:1660 +#, c-format +msgid "%s (GNU grep) %s\n" +msgstr "%s (GNU grep) %s\n" + +#: src/grep.c:1662 +msgid "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" +msgstr "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" + +#: src/grep.c:1664 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"Acesta este software liber; vedeþi sursele pentru condiþii de copiere. NU\n" +"existã nici o garanþie; nici mãcar pentru VANDABILITATE sau POTRIVIRE\n" +"PENTRU UN SCOP ANUME.\n" + +#: src/search.c:606 +msgid "The -P option is not supported" +msgstr "Opþiunea -P nu este suportatã" + +#: src/search.c:619 +msgid "The -P and -z options cannot be combined" +msgstr "Opþiunile -P ºi -z nu pot fi combinate" + +#: lib/error.c:117 +msgid "Unknown system error" +msgstr "Eroare de sistem necunoscutã" + +#: lib/getopt.c:675 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: opþiunea `%s' este ambiguã\n" + +#: lib/getopt.c:700 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: opþiunea `--%s' nu permite un parametru\n" + +#: lib/getopt.c:705 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: opþiunea `%c%s' nu permite un parametru\n" + +#: lib/getopt.c:723 lib/getopt.c:896 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: opþiunea `%s' necesitã un parametru\n" + +#. --option +#: lib/getopt.c:752 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: opþiune necunoscutã `--%s'\n" + +#. +option or -option +#: lib/getopt.c:756 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: opþiune necunoscutã `%c%s'\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:782 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: opþiune ilegalã -- %c\n" + +#: lib/getopt.c:785 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: opþiune invalidã -- %c\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:815 lib/getopt.c:945 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: opþiunea necesitã un parametru -- %c\n" + +#: lib/getopt.c:862 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: opþiunea `-W %s' este ambiguã\n" + +#: lib/getopt.c:880 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: opþiunea `-W %s' nu permite un parametru\n" + +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#: lib/quotearg.c:259 +msgid "`" +msgstr "`" + +#: lib/quotearg.c:260 +msgid "'" +msgstr "'" diff --git a/po/ru.po b/po/ru.po new file mode 100644 index 0000000..760f745 --- /dev/null +++ b/po/ru.po @@ -0,0 +1,409 @@ +# ìÏËÁÌÉÚÁÃÉÑ ÄÌÑ grep. +# Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. +# Denis Perchine , 1998-2000. +# +msgid "" +msgstr "" +"Project-Id-Version: GNU grep 2.5g\n" +"POT-Creation-Date: 2002-03-26 16:38+0100\n" +"PO-Revision-Date: 2002-03-09 12:18GMT+06\n" +"Last-Translator: Denis Perchine \n" +"Language-Team: Russian \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=KOI8-R\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: KBabel 0.9.5\n" + +#: src/dfa.c:136 src/dfa.c:147 src/dfa.c:158 src/search.c:689 +msgid "Memory exhausted" +msgstr "ðÁÍÑÔØ ÉÓÞÅÒÐÁÎÁ" + +#: src/dfa.c:489 src/dfa.c:492 src/dfa.c:510 src/dfa.c:521 src/dfa.c:545 +#: src/dfa.c:604 src/dfa.c:609 src/dfa.c:622 src/dfa.c:623 src/dfa.c:1001 +#: src/dfa.c:1004 src/dfa.c:1028 src/dfa.c:1032 src/dfa.c:1033 src/dfa.c:1036 +#: src/dfa.c:1048 src/dfa.c:1049 +msgid "Unbalanced [" +msgstr "îÅÓÂÁÌÁÎÓÉÒÏ×ÁÎÎÁÑ [" + +#: src/dfa.c:741 +msgid "Unfinished \\ escape" +msgstr "îÅÚÁ×ÅÒÛÅÎÎÁÑ \\ ÐÏÓÌÅÄÏ×ÁÔÅÌØÎÏÓÔØ" + +#. Cases: +#. {M} - exact count +#. {M,} - minimum count, maximum is infinity +#. {M,N} - M through N +#: src/dfa.c:874 src/dfa.c:880 src/dfa.c:890 src/dfa.c:898 src/dfa.c:913 +msgid "unfinished repeat count" +msgstr "ÎÅÚÁ×ÅÒÛÅÎÎÏÅ ËÏÌÉÞÅÓÔ×Ï ÐÏ×ÔÏÒÅÎÉÊ" + +#: src/dfa.c:887 src/dfa.c:904 src/dfa.c:912 src/dfa.c:916 +msgid "malformed repeat count" +msgstr "ÎÅËÏÒÒÅËÔÎÏ ÕËÁÚÁÎÏ ËÏÌÉÞÅÓÔ×Ï ÐÏ×ÔÏÒÅÎÉÊ" + +#: src/dfa.c:1253 +msgid "Unbalanced (" +msgstr "îÅÓÂÁÌÁÎÓÉÒÏ×ÁÎÎÁÑ (" + +#: src/dfa.c:1378 +msgid "No syntax specified" +msgstr "îÅ ÕËÁÚÁÎÏ ÓÉÎÔÁËÓÉÓÁ" + +#: src/dfa.c:1386 +msgid "Unbalanced )" +msgstr "îÅÓÂÁÌÁÎÓÉÒÏ×ÁÎÎÁÑ )" + +#: src/dfa.c:2956 +msgid "out of memory" +msgstr "ÚÁËÏÎÞÉÌÁÓØ ÐÁÍÑÔØ" + +#: src/kwset.c:171 src/kwset.c:177 src/search.c:103 src/search.c:209 +#: src/search.c:293 lib/obstack.c:471 +msgid "memory exhausted" +msgstr "ÐÁÍÑÔØ ÉÓÞÅÒÐÁÎÁ" + +#: src/grep.c:205 +msgid "invalid context length argument" +msgstr "ÎÅ×ÅÒÎÙÊ ÁÒÇÕÍÅÎÔ ÄÌÉÎÙ ËÏÎÔÅËÓÔÁ" + +#: src/grep.c:479 +msgid "input is too large to count" +msgstr "×ÈÏÄÎÙÅ ÄÁÎÎÙÅ ÓÌÉÛËÏÍ ×ÅÌÉËÉ, ÞÔÏÂÙ ÓÏÓÞÉÔÁÔØ" + +#: src/grep.c:605 +msgid "writing output" +msgstr "ÚÁÐÉÓÙ×ÁÀ ×ÙÈÏÄÎÙÅ ÄÁÎÎÙÅ" + +#: src/grep.c:878 +#, c-format +msgid "Binary file %s matches\n" +msgstr "âÉÎÁÒÎÙÊ ÆÁÊÌ %s ÓÏ×ÐÁÄÁÅÔ\n" + +#: src/grep.c:892 +msgid "(standard input)" +msgstr "(ÓÔÁÎÄÁÒÔÎÙÊ ××ÏÄ)" + +#: src/grep.c:997 +#, c-format +msgid "warning: %s: %s\n" +msgstr "ÐÒÅÄÕÐÒÅÖÄÅÎÉÅ: %s: %s\n" + +#: src/grep.c:998 +msgid "recursive directory loop" +msgstr "ËÁÔÁÌÏÇÉ ÚÁÃÉËÌÅÎÙ" + +#: src/grep.c:1046 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE]...\n" +msgstr "éÓÐÏÌØÚÏ×ÁÎÉÅ: %s [OPTION]... PATTERN [FILE]...\n" + +#: src/grep.c:1048 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "ðÏÐÒÏÂÕÊÔÅ `%s --help' ÄÌÑ ÐÏÌÕÞÅÎÉÑ ÂÏÌÅÅ ÐÏÄÒÏÂÎÏÇÏ ÏÐÉÓÁÎÉÑ.\n" + +#: src/grep.c:1053 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE] ...\n" +msgstr "éÓÐÏÌØÚÏ×ÁÎÉÅ: %s [OPTION]... PATTERN [FILE] ...\n" + +#: src/grep.c:1054 +#, c-format +msgid "" +"Search for PATTERN in each FILE or standard input.\n" +"Example: %s -i 'hello world' menu.h main.c\n" +"\n" +"Regexp selection and interpretation:\n" +msgstr "" +"éÝÅÔ PATTERN × ËÁÖÄÏÍ FILE ÉÌÉ ÓÔÁÎÄÁÒÔÎÏÍ ××ÏÄÅ.\n" +"ðÒÉÍÅÒ: %s -i 'hello world' menu.h main.c\n" +"\n" +"÷ÙÂÏÒ ÔÉÐÁ ÒÅÇÕÌÑÒÎÏÇÏ ×ÙÒÁÖÅÎÉÑ É ÅÇÏ ÉÎÔÅÒÐÒÅÔÁÃÉÑ:\n" + +#: src/grep.c:1059 +msgid "" +" -E, --extended-regexp PATTERN is an extended regular expression\n" +" -F, --fixed-strings PATTERN is a set of newline-separated strings\n" +" -G, --basic-regexp PATTERN is a basic regular expression\n" +" -P, --perl-regexp PATTERN is a Perl regular expression\n" +msgstr "" +" -E, --extended-regexp PATTERN - ÒÁÓÛÉÒÅÎÎÏÅ ÒÅÇÕÌÑÒÎÏÅ ×ÙÒÁÖÅÎÉÅ\n" +" -F, --fixed-regexp PATTERN ÆÉËÓÉÒÏ×ÁÎÎÁÑ ÓÔÒÏÞËÁ, ÒÁÚÄÅÌÅÎÎÁÑ\n" +" ËÏÎÃÁÍÉ ÓÔÒÏË\n" +" -G, --basic-regexp PATTERN ÐÒÏÓÔÏÊ ÒÅÇÕÌÑÒÎÏÅ ×ÙÒÁÖÅÎÉÅ\n" +" -P, --perl-regexp PATTERN ÒÅÇÕÌÑÒÎÏÅ ×ÙÒÁÖÅÎÉÑ ÑÚÙËÁ Perl\n" + +#: src/grep.c:1064 +msgid "" +" -e, --regexp=PATTERN use PATTERN as a regular expression\n" +" -f, --file=FILE obtain PATTERN from FILE\n" +" -i, --ignore-case ignore case distinctions\n" +" -w, --word-regexp force PATTERN to match only whole words\n" +" -x, --line-regexp force PATTERN to match only whole lines\n" +" -z, --null-data a data line ends in 0 byte, not newline\n" +msgstr "" +"éÝÅÔ PATTERN × ËÁÖÄÏÍ FILE'Å ÉÌÉ ÓÔÁÎÄÁÒÔÎÏÍ ××ÏÄÅ.\n" +"\n" +"÷ÙÂÏÒ ÔÉÐÁ ÒÅÇÕÌÑÒÎÏÇÏ ×ÙÒÁÖÅÎÉÑ É ÉÎÔÅÒÐÒÅÔÁÃÉÉ:\n" +" -e, --regexp=PATTERN ÉÓÐÏÌØÚÏ×ÁÔØ PATTERN ËÁË ÒÅÇÕÌÑÒÎÏÅ ×ÙÒÁÖÅÎÉÅ\n" +" -f, --file=FILE ÂÒÁÔØ PATTERN ÉÚ FILE'Á\n" +" -i, --ignore-case ÉÇÎÏÒÉÒÏ×ÁÔØ ÒÁÌÉÞÉÅ ÒÅÇÉÓÔÒÏ×\n" +" -w, --word-regexp PATTERN ÄÏÌÖÅÎ ÐÏÄÈÏÄÉÔØ ËÏ ×ÓÅÍÕ ÓÌÏ×Õ\n" +" -x, --line-regexp PATTERN ÄÏÌÖÅÎ ÐÏÄÈÏÄÉÔØ ËÏ ×ÓÅÊ ÓÔÒÏËÅ\n" +" -z, --null-data ÓÔÒÏÞËÉ ÏËÁÎÞÉ×ÁÀÔÓÑ ÎÁ ÂÁÊÔ 0, Á ÎÅ ÎÁ ËÏÎÅÃ\n" +" ÓÔÒÏËÉ\n" + +#: src/grep.c:1071 +msgid "" +"\n" +"Miscellaneous:\n" +" -s, --no-messages suppress error messages\n" +" -v, --invert-match select non-matching lines\n" +" -V, --version print version information and exit\n" +" --help display this help and exit\n" +" --mmap use memory-mapped input if possible\n" +msgstr "" +"\n" +"òÁÚÎÏÏÏÂÒÁÚÎÙÅ:\n" +" -s, --no-messages ÐÏÄÁ×ÌÑÔØ ÓÏÏÂÝÅÎÉÑ Ï ÏÛÉÂËÁÈ\n" +" -v, --revert-match ×ÙÂÉÒÁÔØ ÎÅ ÐÏÄÈÏÄÑÝÉÅ ÓÔÒÏËÉ\n" +" -V, --version ÎÁÐÅÞÁÔÁÔØ ÉÎÆÏÒÍÁÃÉÀ Ï ×ÅÒÓÉÉ É ×ÙÊÔÉ\n" +" --help ÐÏËÁÚÁÔØ ÐÏÍÏÝØ É ×ÙÊÔÉ\n" +" --mmap ÉÓÐÏÌØÚÏ×ÁÔØ mmap ××ÏÄ ÐÏ ×ÏÚÍÏÖÎÏÓÔÉ\n" + +#: src/grep.c:1079 +msgid "" +"\n" +"Output control:\n" +" -m, --max-count=NUM stop after NUM matches\n" +" -b, --byte-offset print the byte offset with output lines\n" +" -n, --line-number print line number with output lines\n" +" --line-buffered flush output on every line\n" +" -H, --with-filename print the filename for each match\n" +" -h, --no-filename suppress the prefixing filename on output\n" +" --label=LABEL print LABEL as filename for standard input\n" +" -o, --only-matching show only the part of a line matching PATTERN\n" +" -q, --quiet, --silent suppress all normal output\n" +" --binary-files=TYPE assume that binary files are TYPE\n" +" TYPE is 'binary', 'text', or 'without-match'\n" +" -a, --text equivalent to --binary-files=text\n" +" -I equivalent to --binary-files=without-match\n" +" -d, --directories=ACTION how to handle directories\n" +" ACTION is 'read', 'recurse', or 'skip'\n" +" -D, --devices=ACTION how to handle devices, FIFOs and sockets\n" +" ACTION is 'read' or 'skip'\n" +" -R, -r, --recursive equivalent to --directories=recurse\n" +" --include=PATTERN files that match PATTERN will be examined\n" +" --exclude=PATTERN files that match PATTERN will be skipped.\n" +" --exclude-from=FILE files that match PATTERN in FILE will be skipped.\n" +" -L, --files-without-match only print FILE names containing no match\n" +" -l, --files-with-matches only print FILE names containing matches\n" +" -c, --count only print a count of matching lines per FILE\n" +" -Z, --null print 0 byte after FILE name\n" +msgstr "" +"\n" +"õÐÒÁ×ÌÅÎÉÅ ×Ù×ÏÄÏÍ:\n" +" -m, --max-count=NUM ÏÓÔÁÎÏ×ÉÔØÓÑ ÐÏÓÌÅ NUM ÓÏ×ÐÁÄÅÎÉÊ\n" +" -b, --byte-offset ÐÅÞÁÔÁÔØ ×ÍÅÓÔÅ Ó ×ÙÈÏÄÎÙÍÉ ÓÔÒÏÞËÁÍÉ ÓÍÅÝÅÎÉÅ ×\n" +" ÂÁÊÔÁÈ\n" +" -n, --line-number ÐÅÞÁÔÁÔØ ÎÏÍÅÒ ÓÔÒÏËÉ ×ÍÅÓÔÅ Ó ×ÙÈÏÄÎÙÍÉ ÓÔÒÏÞËÁÍÉ\n" +" --line-buffered ÓÂÒÁÓÙ×ÁÔØ ÂÕÆÅÒÁ ËÁÖÄÕÀ ÓÔÒÏÞËÕ\n" +" -H, --with-filename ÐÅÞÁÔÁÔØ ÉÍÑ ÆÁÊÌÁ ÄÌÑ ËÁÖÄÏÇÏ ÓÏ×ÐÁÄÅÎÉÑ\n" +" -h, --no-filename ÐÏÄÁ×ÉÔØ ×Ù×ÏÄ ÉÍÅÎÉ ÆÁÊÌÁ ÎÁ ×ÙÈÏÄÅ\n" +" --label=LABEL ×Ù×ÏÄÉÔØ LABEL ×ÍÅÓÔÏ ÉÍÅÎÉ ÆÁÊÌÁ\n" +" -q, --quiet, --silent ÐÏÄÁ×ÉÔØ ×ÅÓØ ÏÂÙÞÎÙÊ ×Ù×ÏÄ\n" +" --binary-files=TYPE ÓÞÉÔÁÔØ ÞÔÏ ÂÉÎÁÒÎÙÊ ÆÁÊÌ ÔÉÐÁ:\n" +" TYPE - 'binary', 'text', ÉÌÉ 'without-match'.\n" +" -a, --text ÎÅ ÐÏÄÁ×ÌÑÔØ ÂÉÎÁÒÎÙÊ ×Ù×ÏÄ\n" +" -I ÔÏ ÖÅ, ÞÔÏ É --binary-files=without-match\n" +" -d, --directories=ACTION ËÁË ÏÂÒÁÂÁÔÙ×ÁÔØ ËÁÔÁÌÏÇÉ\n" +" ACTION ÍÏÖÅÔ ÂÙÔØ 'read' (ÞÉÔÁÔØ),\n" +" 'recurse' (ÒÅËÕÒÓÉ×ÎÏ), ÉÌÉ 'skip' (ÐÒÏÐÕÓËÁÔØ).\n" +" -D, --devices=ACTION ËÁË ÏÂÒÁÂÁÔÙ×ÁÔØ ÕÓÔÒÏÊÓÔ×Á, ËÁÎÁÌÙ É ÓÅÔÅ×ÙÅ ËÁÎÁÌÙ\n" +" ACTION ÍÏÖÅÔ ÂÙÔØ 'read' ÉÌÉ 'skip'\n" +" -R, -r, --recursive ÁÎÁÌÏÇÉÞÎÏ --directories=recurse.\n" +" --include=PATTERN ÏÂÒÁÂÏÔÁÔØ ÆÁÊÌÙ, ÕÄÏ×ÌÅÔ×ÏÒÑÀÝÉÅ PATTERN\n" +" --exclude=PATTERN ÐÒÏÐÕÓÔÉÔØ ÆÁÊÌÙ, ÕÄÏ×ÌÅÔ×ÏÒÑÀÝÉÅ PATTERN.\n" +" --exclude-from=FILE ÐÒÏÐÕÓÔÉÔØ ÆÁÊÌÙ, ÕÄÏ×ÌÅÔ×ÏÒÑÀÝÉÅPATTERN × FILE.\n" +" -L, --files-without-match ÐÅÞÁÔÁÔØ ÔÏÌØËÏ ÉÍÅÎÁ ÆÁÊÌÏ× ÂÅÚ ÓÏ×ÐÁÄÅÎÉÊ\n" +" -l, --files-with-matches ÐÅÞÁÔÁÔØ ÔÏÌØËÏ ÉÍÅÎÁ ÆÁÊÌÏ× Ó ÓÏ×ÐÁÄÅÎÉÑÍÉ\n" +" -c, --count ÐÅÞÁÔÁÔØ ÔÏÌØËÏ ËÏÌÉÞÅÓÔ×Ï ÓÏ×ÐÁÄÁÀÝÉÈ ÓÔÒÏË ÎÁ ÆÁÊÌ\n" +" -Z, --null ÐÅÞÁÔÁÔØ ÂÁÊÔ 0 ÐÏÓÌÅ ÉÍÅÎÉ ÆÁÊÌÁ\n" + +#: src/grep.c:1107 +msgid "" +"\n" +"Context control:\n" +" -B, --before-context=NUM print NUM lines of leading context\n" +" -A, --after-context=NUM print NUM lines of trailing context\n" +" -C, --context=NUM print NUM lines of output context\n" +" -NUM same as --context=NUM\n" +" --color[=WHEN],\n" +" --colour[=WHEN] use markers to distinguish the matching string\n" +" WHEN may be `always', `never' or `auto'.\n" +" -U, --binary do not strip CR characters at EOL (MSDOS)\n" +" -u, --unix-byte-offsets report offsets as if CRs were not there (MSDOS)\n" +"\n" +"`egrep' means `grep -E'. `fgrep' means `grep -F'.\n" +"With no FILE, or when FILE is -, read standard input. If less than\n" +"two FILEs given, assume -h. Exit status is 0 if match, 1 if no match,\n" +"and 2 if trouble.\n" +msgstr "" +"\n" +"õÐÒÁ×ÌÅÎÉÅ ËÏÎÔÅËÓÔÏÍ:\n" +" -B, --before-context=NUM ÐÅÞÁÔÁÔØ NUM ÓÔÒÏË ÐÒÅÄÛÅÓÔ×ÕÀÝÅÇÏ ËÏÎÔÅËÓÔÁ\n" +" -A, --after-context=NUM ÐÅÞÁÔÁÔØ NUM ÓÔÒÏË ÐÏÓÌÅÄÕÀÝÅÇÏ ËÏÎÔÅËÓÔÁ\n" +" -C, --context[=NUM] ÐÅÞÁÔÁÔØ NUM ÓÔÒÏË ËÏÎÔÅËÓÔÁ,\n" +" ÅÓÌÉ ÎÅ ÐÅÒÅËÒÙ×ÁÅÔÓÑ -A ÉÌÉ -B\n" +" --color[=WHEN],\n" +" --colour[=WHEN] ÉÓÐÏÌØÚÏ×ÁÔØ ÍÁÒËÅÒÙ ÄÌÑ ÒÁÚÌÉÞÉÑ ÓÏ×ÐÁÄÁÀÝÉÈ ÓÔÒÏË\n" +" WHEN ÍÏÖÅÔ ÂÙÔØ `always' (×ÓÅÇÄÁ), `never' (ÎÉËÏÇÄÁ) ÉÌÉ `auto' (Á×ÔÏÍÁÔÉÞÅÓËÉ).\n" +" --color, --colour ÉÓÐÏÌØÚÏ×ÁÔØ ÍÁÒËÅÒÙ ÄÌÑ ÒÁÚÌÉÞÉÑ ÓÏ×ÐÁÄÁÀÝÉÈ ÓÔÒÏË\n" +" -NUM ÔÏ ÖÅ, ÞÔÏ É --context=NUM\n" +" -U, --binary ÎÅ ÕÄÁÌÑÔØ ÓÉ×ÏÌÙ CR × ËÏÎÃÅ ÓÔÒÏËÉ (MSDOS)\n" +" -u, --unix-byte-offsets ×ÙÄÁ×ÁÔØ ÓÍÅÝÅÎÉÅ, ËÁË-ÂÕÄÔÏ ÎÅÔ CR-Ï× (MSDOS)\n" +"\n" +"åÓÌÉ ÎÅ ÕËÁÚÁÎÏ -[GEF], ÔÏÇÄÁ `egrep' ÐÒÅÄÐÏÌÁÇÁÅÔ -E, `fgrep' -F, ÉÎÁÞÅ -G.\n" +"ëÏÇÄÁ ÎÅÔ FILE'Á, ÉÌÉ ËÏÇÄÁ FILE ÜÔÏ -, ÞÉÔÁÅÔ ÓÔÁÎÄÁÒÔÎÙÊ ××ÏÄ. åÓÌÉ ÚÁÄÁÎÏ\n" +"ÍÅÎØÛÅ, ÞÅÍ Ä×Á ÆÁÊÌÁ, ÐÒÅÄÐÏÌÁÇÁÅÔ -h. ÷ÙÈÏÄÉÔ Ó 0 ÅÓÌÉ ÎÁÊÄÅÎÙ ÓÏ×ÐÁÄÅÎÉÑ,\n" +"Ó 1, ÅÓÌÉ ÎÅÔ. ÷ÙÈÏÄÉÔ Ó 2, ÅÓÌÉ ÅÓÔØ ÓÉÎÔÁËÓÉÞÅÓËÉÅ ÉÌÉ ÓÉÓÔÅÍÎÙÅ ÏÛÉÂËÉ.\n" + +#: src/grep.c:1124 +#, fuzzy +msgid "" +"\n" +"Report bugs to .\n" +msgstr "" +"\n" +"ï ÏÛÉÂËÁÈ ÓÏÏÂÝÁÊÔÅ .\n" + +#: src/grep.c:1134 +msgid "conflicting matchers specified" +msgstr "ÚÁÄÁÎÙ ËÏÎÆÌÉËÔÕÀÝÉÅ ÏÂÒÁÚÃÙ" + +#: src/grep.c:1376 +msgid "unknown devices method" +msgstr "ÎÅÉÚ×ÅÓÔÎÙÊ ÍÅÔÏÄ ÄÌÑ ÕÓÔÒÏÊÓÔ×" + +#: src/grep.c:1443 +msgid "unknown directories method" +msgstr "ÎÅÉÚ×ÅÓÔÎÙÊ ÍÅÔÏÄ ÄÌÑ ËÁÔÁÌÏÇÏ×" + +#: src/grep.c:1510 +msgid "invalid max count" +msgstr "ÎÅ×ÅÒÎÏÅ ÍÁËÓÉÍÁÌØÎÏÅ ËÏÌÉÞÅÓÔ×Ï ÓÏ×ÐÁÄÅÎÉÊ" + +#: src/grep.c:1565 +msgid "unknown binary-files type" +msgstr "ÎÅÉÚ×ÅÓÔÎÙÊ ÂÉÎÁÒÎÙÊ ÔÉÐ" + +#: src/grep.c:1660 +#, c-format +msgid "%s (GNU grep) %s\n" +msgstr "%s (GNU grep) %s\n" + +#: src/grep.c:1662 +msgid "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" +msgstr "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" + +#: src/grep.c:1664 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"üÔÏ Ó×ÏÂÏÄÎÏ ÒÁÓÐÒÏÓÔÒÁÎÑÅÍÏÅ ÐÒÏÇÒÁÍÍÎÏÅ ÏÂÅÓÐÅÞÅÎÉÅ; ÓÍÏÔÒÉÔÅ ÉÓÈÏÄÎÙÅ\n" +"ÔÅËÓÔÙ ÄÌÑ ÕÓÌÏ×ÉÊ ËÏÐÉÒÏ×ÁÎÉÑ. îå ÄÁÅÔÓÑ ÎÉËÁËÏÊ ÇÁÒÁÎÔÉÉ, ÄÁÖÅ Ï\n" +"ðïäèïäéíïóôé äìñ ïðòåäåìåîîùè ãåìåê.\n" + +#: src/search.c:606 +msgid "The -P option is not supported" +msgstr "ëÌÀÞ -P ÎÅ ÐÏÄÄÅÒÖÉ×ÁÅÔÓÑ" + +#: src/search.c:619 +msgid "The -P and -z options cannot be combined" +msgstr "ëÌÀÞÉ -P É -z ÎÅ ÓÏ×ÍÅÓÔÉÍÙ" + +#: lib/error.c:117 +msgid "Unknown system error" +msgstr "îÅÉÚ×ÅÓÔÎÁÑ ÓÉÓÔÅÍÎÁÑ ÏÛÉÂËÁ" + +#: lib/getopt.c:675 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: ÏÐÃÉÑ '%s' ÎÅÏÄÎÏÚÎÁÞÎÁ\n" + +#: lib/getopt.c:700 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: ÏÐÃÉÑ `--%s' ÎÅ ÒÁÚÒÅÛÁÅÔ ÁÒÇÕÍÅÎÔÁ\n" + +#: lib/getopt.c:705 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: ÏÐÃÉÑ `%c%s' ÎÅ ÒÁÚÒÅÛÁÅÔ ÁÒÇÕÍÅÎÔÁ\n" + +#: lib/getopt.c:723 lib/getopt.c:896 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: ÏÐÃÉÑ `%s' ÔÒÅÂÕÅÔ ÁÒÇÕÍÅÎÔ\n" + +#. --option +#: lib/getopt.c:752 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: ÎÅÉÚ×ÅÓÔÎÁÑ ÏÐÃÉÑ `--%s'\n" + +#. +option or -option +#: lib/getopt.c:756 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: ÎÅÉÚ×ÅÓÔÎÁÑ ÏÐÃÉÑ `%c%s'\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:782 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: ÎÅ×ÅÒÎÁÑ ÏÐÃÉÑ -- %c\n" + +#: lib/getopt.c:785 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: ÎÅ×ÅÒÎÁÑ ÏÐÃÉÑ -- %c\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:815 lib/getopt.c:945 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: ÏÐÃÉÑ ÔÒÅÂÕÅÔ ÁÒÇÕÍÅÎÔ -- %c\n" + +#: lib/getopt.c:862 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: ÏÐÃÉÑ `-W %s' ÎÅÏÄÎÏÚÎÁÞÎÁ\n" + +#: lib/getopt.c:880 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: ÏÐÃÉÑ `-W %s' ÎÅ ÒÁÚÒÅÛÁÅÔ ÁÒÇÕÍÅÎÔÁ\n" + +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#: lib/quotearg.c:259 +msgid "`" +msgstr "\"" + +#: lib/quotearg.c:260 +msgid "'" +msgstr "\"" diff --git a/po/rw.po b/po/rw.po new file mode 100644 index 0000000..9180b26 --- /dev/null +++ b/po/rw.po @@ -0,0 +1,364 @@ +# Kinyarwanda translations for grep package. +# Copyright (C) 2005 Free Software Foundation, Inc. +# This file is distributed under the same license as the grep package. +# Steve Murphy , 2005. +# Steve performed initial rough translation from compendium built from translations provided by the following translators: +# Philibert Ndandali , 2005. +# Viateur MUGENZI , 2005. +# Noëlla Mupole , 2005. +# Carole Karema , 2005. +# JEAN BAPTISTE NGENDAHAYO , 2005. +# Augustin KIBERWA , 2005. +# Donatien NSENGIYUMVA , 2005. +# Antoine Bigirimana , 2005. +# +msgid "" +msgstr "" +"Project-Id-Version: grep 2.5.1a\n" +"POT-Creation-Date: 2002-03-26 16:38+0100\n" +"PO-Revision-Date: 2005-04-04 10:55-0700\n" +"Last-Translator: Steven Michael Murphy \n" +"Language-Team: Kinyarwanda \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: src/dfa.c:136 src/dfa.c:147 src/dfa.c:158 src/search.c:689 +msgid "Memory exhausted" +msgstr "" + +#: src/dfa.c:489 src/dfa.c:492 src/dfa.c:510 src/dfa.c:521 src/dfa.c:545 +#: src/dfa.c:604 src/dfa.c:609 src/dfa.c:622 src/dfa.c:623 src/dfa.c:1001 +#: src/dfa.c:1004 src/dfa.c:1028 src/dfa.c:1032 src/dfa.c:1033 src/dfa.c:1036 +#: src/dfa.c:1048 src/dfa.c:1049 +msgid "Unbalanced [" +msgstr "" + +#: src/dfa.c:741 +msgid "Unfinished \\ escape" +msgstr "" + +#. Cases: +#. {M} - exact count +#. {M,} - minimum count, maximum is infinity +#. {M,N} - M through N +#: src/dfa.c:874 src/dfa.c:880 src/dfa.c:890 src/dfa.c:898 src/dfa.c:913 +#, fuzzy +msgid "unfinished repeat count" +msgstr "Gusubiramo IBARA" + +#: src/dfa.c:887 src/dfa.c:904 src/dfa.c:912 src/dfa.c:916 +#, fuzzy +msgid "malformed repeat count" +msgstr "Gusubiramo IBARA" + +#: src/dfa.c:1253 +msgid "Unbalanced (" +msgstr "" + +#: src/dfa.c:1378 +msgid "No syntax specified" +msgstr "" + +#: src/dfa.c:1386 +msgid "Unbalanced )" +msgstr "" + +#: src/dfa.c:2956 +msgid "out of memory" +msgstr "Ububiko bwarenzwe" + +#: src/kwset.c:171 src/kwset.c:177 src/search.c:103 src/search.c:209 +#: src/search.c:293 lib/obstack.c:471 +#, fuzzy +msgid "memory exhausted" +msgstr "Ububiko" + +#: src/grep.c:205 +#, fuzzy +msgid "invalid context length argument" +msgstr "Sibyo Imvugiro Uburebure" + +#: src/grep.c:479 +#, fuzzy +msgid "input is too large to count" +msgstr "Iyinjiza ni Binini Kuri IBARA" + +#: src/grep.c:605 +#, fuzzy +msgid "writing output" +msgstr "Ibisohoka" + +#: src/grep.c:878 +#, fuzzy, c-format +msgid "Binary file %s matches\n" +msgstr "IDOSIYE" + +#: src/grep.c:892 +#, fuzzy +msgid "(standard input)" +msgstr "(Bisanzwe Iyinjiza" + +#: src/grep.c:997 +#, fuzzy, c-format +msgid "warning: %s: %s\n" +msgstr "Iburira" + +#: src/grep.c:998 +#, fuzzy +msgid "recursive directory loop" +msgstr "bushyinguro" + +#: src/grep.c:1046 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE]...\n" +msgstr "" + +#: src/grep.c:1048 +#, fuzzy, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "kugirango Birenzeho Ibisobanuro" + +#: src/grep.c:1053 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE] ...\n" +msgstr "" + +#: src/grep.c:1054 +#, fuzzy, c-format +msgid "" +"Search for PATTERN in each FILE or standard input.\n" +"Example: %s -i 'hello world' menu.h main.c\n" +"\n" +"Regexp selection and interpretation:\n" +msgstr "kugirango in Cyangwa Bisanzwe Iyinjiza Urugero i Muraho Ibikubiyemo h Ihitamo Na" + +#: src/grep.c:1059 +#, fuzzy +msgid "" +" -E, --extended-regexp PATTERN is an extended regular expression\n" +" -F, --fixed-strings PATTERN is a set of newline-separated strings\n" +" -G, --basic-regexp PATTERN is a basic regular expression\n" +" -P, --perl-regexp PATTERN is a Perl regular expression\n" +msgstr "-E Byongerewe... ni Byongerewe... Ibisanzwe BIHAMYE Ikurikiranyanyuguti ni a Gushyiraho Bya BASIC ni a BASIC Ibisanzwe Perl ni a Ibisanzwe" + +#: src/grep.c:1064 +#, fuzzy +msgid "" +" -e, --regexp=PATTERN use PATTERN as a regular expression\n" +" -f, --file=FILE obtain PATTERN from FILE\n" +" -i, --ignore-case ignore case distinctions\n" +" -w, --word-regexp force PATTERN to match only whole words\n" +" -x, --line-regexp force PATTERN to match only whole lines\n" +" -z, --null-data a data line ends in 0 byte, not newline\n" +msgstr "-E Gukoresha Nka a Ibisanzwe F IDOSIYE Bivuye i Kwirengagiza Kwirengagiza W ijambo Kuri BIHUYE X Umurongo Kuri BIHUYE Z NTAGIHARI Ibyatanzwe a Ibyatanzwe Umurongo in 0 Bayite OYA" + +#: src/grep.c:1071 +#, fuzzy +msgid "" +"\n" +"Miscellaneous:\n" +" -s, --no-messages suppress error messages\n" +" -v, --invert-match select non-matching lines\n" +" -V, --version print version information and exit\n" +" --help display this help and exit\n" +" --mmap use memory-mapped input if possible\n" +msgstr "S Oya Ubutumwa Ikosa v Gucurika BIHUYE Guhitamo V Verisiyo Gucapa Verisiyo Ibisobanuro Na Ifashayobora Kugaragaza iyi Ifashayobora Na Gukoresha Ububiko Iyinjiza NIBA" + +#: src/grep.c:1079 +#, fuzzy +msgid "" +"\n" +"Output control:\n" +" -m, --max-count=NUM stop after NUM matches\n" +" -b, --byte-offset print the byte offset with output lines\n" +" -n, --line-number print line number with output lines\n" +" --line-buffered flush output on every line\n" +" -H, --with-filename print the filename for each match\n" +" -h, --no-filename suppress the prefixing filename on output\n" +" --label=LABEL print LABEL as filename for standard input\n" +" -o, --only-matching show only the part of a line matching PATTERN\n" +" -q, --quiet, --silent suppress all normal output\n" +" --binary-files=TYPE assume that binary files are TYPE\n" +" TYPE is 'binary', 'text', or 'without-match'\n" +" -a, --text equivalent to --binary-files=text\n" +" -I equivalent to --binary-files=without-match\n" +" -d, --directories=ACTION how to handle directories\n" +" ACTION is 'read', 'recurse', or 'skip'\n" +" -D, --devices=ACTION how to handle devices, FIFOs and sockets\n" +" ACTION is 'read' or 'skip'\n" +" -R, -r, --recursive equivalent to --directories=recurse\n" +" --include=PATTERN files that match PATTERN will be examined\n" +" --exclude=PATTERN files that match PATTERN will be skipped.\n" +" --exclude-from=FILE files that match PATTERN in FILE will be skipped.\n" +" -L, --files-without-match only print FILE names containing no match\n" +" -l, --files-with-matches only print FILE names containing matches\n" +" -c, --count only print a count of matching lines per FILE\n" +" -Z, --null print 0 byte after FILE name\n" +msgstr "Igenzura M KININI IBARA Guhagarara Nyuma B Bayite Nta- boneza Gucapa i Bayite Nta- boneza Na: Ibisohoka N Umurongo Umubare Gucapa Umurongo Umubare Na: Ibisohoka Umurongo Ibisohoka ku buri H Na: Izina ry'idosiye: Gucapa i Izina ry'idosiye: kugirango h Oya Izina ry'idosiye: i Izina ry'idosiye: ku Akarango Gucapa Nka Izina ry'idosiye: kugirango Bisanzwe o Garagaza i Bya a Umurongo Q Byose Bisanzwe Nyabibiri Idosiye Nyabibiri Idosiye ni Cyangwa a Umwandiko Kuri Nyabibiri Idosiye Kuri Nyabibiri Idosiye D ububiko bw'amaderese Kuri ni Cyangwa Kuri Na ni Cyangwa R Kuri ububiko bw'amaderese Gushyiramo Idosiye BIHUYE Idosiye BIHUYE Bivuye Idosiye BIHUYE in Idosiye BIHUYE Gucapa Amazina Oya L Idosiye Na: Gucapa Amazina C IBARA Gucapa a IBARA Bya Imirongo NTAGIHARI Gucapa 0 Bayite Nyuma" + +#: src/grep.c:1107 +#, fuzzy +msgid "" +"\n" +"Context control:\n" +" -B, --before-context=NUM print NUM lines of leading context\n" +" -A, --after-context=NUM print NUM lines of trailing context\n" +" -C, --context=NUM print NUM lines of output context\n" +" -NUM same as --context=NUM\n" +" --color[=WHEN],\n" +" --colour[=WHEN] use markers to distinguish the matching string\n" +" WHEN may be `always', `never' or `auto'.\n" +" -U, --binary do not strip CR characters at EOL (MSDOS)\n" +" -u, --unix-byte-offsets report offsets as if CRs were not there (MSDOS)\n" +"\n" +"`egrep' means `grep -E'. `fgrep' means `grep -F'.\n" +"With no FILE, or when FILE is -, read standard input. If less than\n" +"two FILEs given, assume -h. Exit status is 0 if match, 1 if no match,\n" +"and 2 if trouble.\n" +msgstr "Igenzura Mbere Imvugiro Gucapa Imirongo Bya Nyobora A Nyuma Imvugiro Gucapa Imirongo Bya C Imvugiro Gucapa Imirongo Bya Ibisohoka Nka Imvugiro Ibara Gukoresha Kuri i Gicurasi Cyangwa U Nyabibiri OYA Inyuguti ku u Bayite Icyegeranyo Nka NIBA OYA Oya Cyangwa Ryari: ni Gusoma Bisanzwe Iyinjiza Birutwa h Imimerere ni 0 NIBA BIHUYE 1. NIBA Oya BIHUYE Na 2. NIBA" + +#: src/grep.c:1124 +#, fuzzy +msgid "" +"\n" +"Report bugs to .\n" +msgstr "org." + +#: src/grep.c:1134 +msgid "conflicting matchers specified" +msgstr "" + +#: src/grep.c:1376 +#, fuzzy +msgid "unknown devices method" +msgstr "Kitazwi Uburyo" + +#: src/grep.c:1443 +#, fuzzy +msgid "unknown directories method" +msgstr "Kitazwi ububiko bw'amaderese Uburyo" + +#: src/grep.c:1510 +#, fuzzy +msgid "invalid max count" +msgstr "Sibyo KININI IBARA" + +#: src/grep.c:1565 +#, fuzzy +msgid "unknown binary-files type" +msgstr "Kitazwi Nyabibiri Idosiye Ubwoko" + +#: src/grep.c:1660 +#, c-format +msgid "%s (GNU grep) %s\n" +msgstr "" + +#: src/grep.c:1662 +msgid "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" +msgstr "" + +#: src/grep.c:1664 +#, fuzzy +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "ni Kigenga i Inkomoko kugirango ni OYA ATARIIGIHARWE kugirango Cyangwa A" + +#: src/search.c:606 +#, fuzzy +msgid "The -P option is not supported" +msgstr "Ihitamo ni OYA" + +#: src/search.c:619 +#, fuzzy +msgid "The -P and -z options cannot be combined" +msgstr "Na Z Amahitamo" + +#: lib/error.c:117 +#, fuzzy +msgid "Unknown system error" +msgstr "Sisitemu Ikosa" + +#: lib/getopt.c:675 +#, fuzzy, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s:Ihitamo ni" + +#: lib/getopt.c:700 +#, fuzzy, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s:Ihitamo Kwemerera" + +#: lib/getopt.c:705 +#, fuzzy, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s:Ihitamo Kwemerera" + +#: lib/getopt.c:723 lib/getopt.c:896 +#, fuzzy, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s:Ihitamo" + +#. --option +#: lib/getopt.c:752 +#, fuzzy, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s:Ihitamo" + +#. +option or -option +#: lib/getopt.c:756 +#, fuzzy, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s:Ihitamo" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:782 +#, fuzzy, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s:Ihitamo" + +#: lib/getopt.c:785 +#, fuzzy, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s:Sibyo Ihitamo" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:815 lib/getopt.c:945 +#, fuzzy, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s:Ihitamo" + +#: lib/getopt.c:862 +#, fuzzy, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s:Ihitamo ni" + +#: lib/getopt.c:880 +#, fuzzy, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s:Ihitamo Kwemerera" + +# basctl/source\basicide\basidesh.src:RID_IMGBTN_REMOVEWATCH.text +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#: lib/quotearg.c:259 +#, fuzzy +msgid "`" +msgstr "`" + +#: lib/quotearg.c:260 +msgid "'" +msgstr "'" diff --git a/po/sl.po b/po/sl.po new file mode 100644 index 0000000..31998f4 --- /dev/null +++ b/po/sl.po @@ -0,0 +1,449 @@ +# -*- mode: po; coding: iso-latin-2 -*- Slovenian message catalogue for grep +# Copyright (C) 1996, 1999, 2000 Free Software Foundation, Inc. +# Primo¾ Peterlin , 1996, 1999, 2000. +# +# $Id: sl.po,v 1.31 2006/08/18 21:04:18 bero Exp $ +# +msgid "" +msgstr "" +"Project-Id-Version: GNU grep 2.5g\n" +"POT-Creation-Date: 2002-03-26 16:38+0100\n" +"PO-Revision-Date: 2002-03-11 09:25+0100\n" +"Last-Translator: Primo¾ Peterlin \n" +"Language-Team: Slovenian \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-2\n" +"Content-Transfer-Encoding: 8-bit\n" + +#: src/dfa.c:136 src/dfa.c:147 src/dfa.c:158 src/search.c:689 +msgid "Memory exhausted" +msgstr "Pomnilnik porabljen" + +#: src/dfa.c:489 src/dfa.c:492 src/dfa.c:510 src/dfa.c:521 src/dfa.c:545 +#: src/dfa.c:604 src/dfa.c:609 src/dfa.c:622 src/dfa.c:623 src/dfa.c:1001 +#: src/dfa.c:1004 src/dfa.c:1028 src/dfa.c:1032 src/dfa.c:1033 src/dfa.c:1036 +#: src/dfa.c:1048 src/dfa.c:1049 +msgid "Unbalanced [" +msgstr "Oklepaj [ brez zaklepaja" + +#: src/dfa.c:741 +msgid "Unfinished \\ escape" +msgstr "Nedokonèano ube¾no zaporedje \\" + +#. Cases: +#. {M} - exact count +#. {M,} - minimum count, maximum is infinity +#. {M,N} - M through N +#: src/dfa.c:874 src/dfa.c:880 src/dfa.c:890 src/dfa.c:898 src/dfa.c:913 +msgid "unfinished repeat count" +msgstr "nedokonèano ¹tevilo ponovitev" + +#: src/dfa.c:887 src/dfa.c:904 src/dfa.c:912 src/dfa.c:916 +msgid "malformed repeat count" +msgstr "slabo doloèeno ¹tevilo ponovitev" + +#: src/dfa.c:1253 +msgid "Unbalanced (" +msgstr "Oklepaj ( brez zaklepaja" + +#: src/dfa.c:1378 +msgid "No syntax specified" +msgstr "Skladnja ni podana" + +#: src/dfa.c:1386 +msgid "Unbalanced )" +msgstr "Zaklepaj ) brez oklepaja" + +#: src/dfa.c:2956 +msgid "out of memory" +msgstr "zmanjkalo pomnilnika" + +#: src/kwset.c:171 src/kwset.c:177 src/search.c:103 src/search.c:209 +#: src/search.c:293 lib/obstack.c:471 +msgid "memory exhausted" +msgstr "pomnilnik porabljen" + +#: src/grep.c:205 +msgid "invalid context length argument" +msgstr "velikost konteksta ni veljavna" + +#: src/grep.c:479 +msgid "input is too large to count" +msgstr "vhod je prevelik, da bi ga mogli pre¹teti" + +#: src/grep.c:605 +msgid "writing output" +msgstr "pisanje rezultatov" + +#: src/grep.c:878 +#, c-format +msgid "Binary file %s matches\n" +msgstr "Binarna datoteka %s ustreza\n" + +#: src/grep.c:892 +msgid "(standard input)" +msgstr "(standardni vhod)" + +#: src/grep.c:997 +#, c-format +msgid "warning: %s: %s\n" +msgstr "pozor: %s: %s\n" + +#: src/grep.c:998 +msgid "recursive directory loop" +msgstr "rekurzivna zanka imenikov" + +#: src/grep.c:1046 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE]...\n" +msgstr "Uporaba: %s [IZBIRA]... VZOREC [DATOTEKA]...\n" + +#: src/grep.c:1048 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "Poskusite ,%s --help` za dodatna pojasnila.\n" + +#: src/grep.c:1053 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE] ...\n" +msgstr "Uporaba: %s [IZBIRA]... VZOREC [DATOTEKA] ...\n" + +#: src/grep.c:1054 +#, c-format +msgid "" +"Search for PATTERN in each FILE or standard input.\n" +"Example: %s -i 'hello world' menu.h main.c\n" +"\n" +"Regexp selection and interpretation:\n" +msgstr "" +"V DATOTEKI ali na standardnem vhodu i¹èemo VZOREC.\n" +"Primer: %s -i 'hello.*world' menu.h main.c\n" +"\n" +"Izbira in tolmaèenje regularnih izrazov:\n" + +#: src/grep.c:1059 +msgid "" +" -E, --extended-regexp PATTERN is an extended regular expression\n" +" -F, --fixed-strings PATTERN is a set of newline-separated strings\n" +" -G, --basic-regexp PATTERN is a basic regular expression\n" +" -P, --perl-regexp PATTERN is a Perl regular expression\n" +msgstr "" +" -E, --extended-regexp VZOREC je raz¹irjeni regularni izraz\n" +" -F, --fixed-strings VZOREC je mno¾ica nizov, vsak v svoji vrstici\n" +" -G, --basic-regexp VZOREC je osnovni regularni izraz\n" +" -P, --perl-regexp VZOREC je regularni izraz z raz¹iritvami perla\n" + +#: src/grep.c:1064 +msgid "" +" -e, --regexp=PATTERN use PATTERN as a regular expression\n" +" -f, --file=FILE obtain PATTERN from FILE\n" +" -i, --ignore-case ignore case distinctions\n" +" -w, --word-regexp force PATTERN to match only whole words\n" +" -x, --line-regexp force PATTERN to match only whole lines\n" +" -z, --null-data a data line ends in 0 byte, not newline\n" +msgstr "" +" -e, --regexp=VZOREC uporabimo VZOREC kot regularni izraz\n" +" -f, --file=DATOTEKA VZOREC preberemo s podane DATOTEKE\n" +" -i, --ignore-case ne razlikujemo med velikimi in malimi èrkami\n" +" -w, --word-regexp iskanje uspe¹no le, èe je VZOREC cela beseda\n" +" -x, --line-regexp iskanje uspe¹no le, èe je VZOREC cela vrstica\n" +" -z, --null-data vrstica podatkov je konèana z znakom NUL, ne z\n" +" znakom za skok v novo vrstico\n" + +#: src/grep.c:1071 +msgid "" +"\n" +"Miscellaneous:\n" +" -s, --no-messages suppress error messages\n" +" -v, --invert-match select non-matching lines\n" +" -V, --version print version information and exit\n" +" --help display this help and exit\n" +" --mmap use memory-mapped input if possible\n" +msgstr "" +"\n" +"Razno:\n" +" -s, --no-messages brez sporoèil o napakah\n" +" -v, --invert-match komplement: vrstice, kjer ni VZORCA\n" +" -V, --version verzija programa\n" +" --help ta pomoè\n" +" --mmap èe je mo¾no, uporabi pomnilni¹ko preslikan vhod\n" + +#: src/grep.c:1079 +msgid "" +"\n" +"Output control:\n" +" -m, --max-count=NUM stop after NUM matches\n" +" -b, --byte-offset print the byte offset with output lines\n" +" -n, --line-number print line number with output lines\n" +" --line-buffered flush output on every line\n" +" -H, --with-filename print the filename for each match\n" +" -h, --no-filename suppress the prefixing filename on output\n" +" --label=LABEL print LABEL as filename for standard input\n" +" -o, --only-matching show only the part of a line matching PATTERN\n" +" -q, --quiet, --silent suppress all normal output\n" +" --binary-files=TYPE assume that binary files are TYPE\n" +" TYPE is 'binary', 'text', or 'without-match'\n" +" -a, --text equivalent to --binary-files=text\n" +" -I equivalent to --binary-files=without-match\n" +" -d, --directories=ACTION how to handle directories\n" +" ACTION is 'read', 'recurse', or 'skip'\n" +" -D, --devices=ACTION how to handle devices, FIFOs and sockets\n" +" ACTION is 'read' or 'skip'\n" +" -R, -r, --recursive equivalent to --directories=recurse\n" +" --include=PATTERN files that match PATTERN will be examined\n" +" --exclude=PATTERN files that match PATTERN will be skipped.\n" +" --exclude-from=FILE files that match PATTERN in FILE will be skipped.\n" +" -L, --files-without-match only print FILE names containing no match\n" +" -l, --files-with-matches only print FILE names containing matches\n" +" -c, --count only print a count of matching lines per FILE\n" +" -Z, --null print 0 byte after FILE name\n" +msgstr "" +"\n" +"Nadzor izhoda:\n" +" -m, --max-count=©TEVILO odnehamo, ko je dose¾eno ©TEVILO ujemanj\n" +" -b, --byte-offset z izpisom odmika (v zlogih)\n" +" -n, --line-number z izpisom zaporedne ¹tevilke vrstice\n" +" --line-buffered izhodni medpomnilnik izpraznimo vsako vrstico\n" +" -H, --with-filename z izpisom imena datoteke\n" +" -h, --no-filename brez izpisa imena datoteke\n" +" --label=OZNAKA z navedeno OZNAKO, kadar beremo s standardnega vhoda\n" +" -o, --only-matching izpis samo dela vrstice z VZORCEM\n" +" -q, --quiet, --silent brez vsega obièajnega izpisa\n" +" --binary-type=TIP privzemi izbrani TIP binarne datoteke\n" +" TIP je lahko ,binary`, ,text` ali ,without-match`\n" +" -a, --text isto kot --binary-type=text\n" +" -I isto kot --binary-type=without-match\n" +" -d, --directories=DEJANJE kako obravnavamo imenike\n" +" DEJANJE je lahko ,read`, ,recurse` ali ,skip`\n" +" -D, --devices=DEJANJE kako obravnavamo datoteke naprav\n" +" DEJANJE je lahko ,read` ali ,skip`\n" +" -R, -r, --recursive isto kot --directories=recurse\n" +" --include=VZOREC prei¹èemo le datoteke, ki ustrezajo VZORCU\n" +" --exclude=VZOREC izpustimo datoteke, ki ustrezajo VZORCU\n" +" --exclude-from=DATOTEKA izpustimo datoteke, ki ustrezajo vzorcu v DATOTEKI\n" +" -L, --files-without-match le imena tistih DATOTEK, kjer VZORCA nismo na¹li\n" +" -l, --files-with-matches le imena tistih DATOTEK, kjer smo VZOREC na¹li\n" +" -c, --count le skupno ¹tevilo vrstic v DATOTEKI, v katerih se\n" +" pojavi VZOREC\n" +" -Z, --null izpi¹i znak NUL za imenom DATOTEKE\n" + +#: src/grep.c:1107 +msgid "" +"\n" +"Context control:\n" +" -B, --before-context=NUM print NUM lines of leading context\n" +" -A, --after-context=NUM print NUM lines of trailing context\n" +" -C, --context=NUM print NUM lines of output context\n" +" -NUM same as --context=NUM\n" +" --color[=WHEN],\n" +" --colour[=WHEN] use markers to distinguish the matching string\n" +" WHEN may be `always', `never' or `auto'.\n" +" -U, --binary do not strip CR characters at EOL (MSDOS)\n" +" -u, --unix-byte-offsets report offsets as if CRs were not there (MSDOS)\n" +"\n" +"`egrep' means `grep -E'. `fgrep' means `grep -F'.\n" +"With no FILE, or when FILE is -, read standard input. If less than\n" +"two FILEs given, assume -h. Exit status is 0 if match, 1 if no match,\n" +"and 2 if trouble.\n" +msgstr "" +"\n" +"Nadzor nad kontekstom:\n" +" -B, --before-context=©T ©T vrstic konteksta pred vrstico z VZORCEM\n" +" -A, --after-context=©T ©T vrstic konteksta za vrstico z VZORCEM\n" +" -C, --context[=©T] ©T vrstic konteksta pred in za vrstico z VZORCEM\n" +" -©T isto kot --context=©T\n" +" --color, --colour ujemajoèe nize barvno oznaèimo\n" +" -U, --binary ne pore¾emo znakov CR na koncu vrstic (MS-DOS)\n" +" -u, --unix-byte-offsets v odmikih ne ¹tejemo znakov CR (MS-DOS)\n" +"\n" +"Ukaz ,egrep` pomeni isto kot ,grep -E`, ,fgrep` pa isto kot ,grep -F`.\n" +"Èe DATOTEKA ni podana ali pa je -, beremo s standardnega vhoda. Èe sta podani\n" +"manj kot dve DATOTEKI, privzamemo izbiro -h. Izhodna koda je niè, èe smo VZOREC\n" +"na¹li, ena, èe ga nismo, 2 pa pomeni skladenjsko ali sistemsko napako.\n" + +#: src/grep.c:1124 +#, fuzzy +msgid "" +"\n" +"Report bugs to .\n" +msgstr "" +"\n" +"Morebitne napake v programu sporoèite na .\n" + +# Sporoèilo se pojavi pri nedokumentirani izbiri -X +# grep.c:622 -> +# opt = getopt(argc, argv, "0123456789A:B:CEFGVX:bce:f:hiLlnqsvwxy" +# grep --help -> +# usage: grep [-[[AB] ]] [-[CEFGVchilnqsvwx]] [-[ef]] [] +#: src/grep.c:1134 +msgid "conflicting matchers specified" +msgstr "podana navodila si nasprotujejo" + +#: src/grep.c:1376 +msgid "unknown devices method" +msgstr "neznana metoda datotek naprav" + +#: src/grep.c:1443 +msgid "unknown directories method" +msgstr "neznana metoda imenikov" + +#: src/grep.c:1510 +msgid "invalid max count" +msgstr "neveljavno najveèje ¹tevilo" + +#: src/grep.c:1565 +msgid "unknown binary-files type" +msgstr "neznan tip binarne datoteke" + +#: src/grep.c:1660 +#, c-format +msgid "%s (GNU grep) %s\n" +msgstr "%s (GNU grep) %s\n" + +#: src/grep.c:1662 +msgid "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" +msgstr "Copyright (C) 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" + +#: src/grep.c:1664 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"To je prost program; pogoji, pod katerimi ga lahko uporabljate, razmno¾ujete\n" +"in raz¹irjate so navedeni v izvorni kodi. Za program ni NOBENEGA jamstva,\n" +"niti jamstev USTREZNOSTI ZA PRODAJO ali PRIMERNOSTI ZA UPORABO.\n" + +#: src/search.c:606 +msgid "The -P option is not supported" +msgstr "Izbira -P ni podprta" + +#: src/search.c:619 +msgid "The -P and -z options cannot be combined" +msgstr "Izbiri -P in -z se med seboj izkljuèujeta" + +#: lib/error.c:117 +msgid "Unknown system error" +msgstr "Neznana sistemska napaka" + +#: lib/getopt.c:675 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: izbira ,%s` je dvoumna\n" + +#: lib/getopt.c:700 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: izbira ,--%s` ne dovoljuje argumenta\n" + +#: lib/getopt.c:705 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: izbira ,%c%s` ne dovoljuje argumenta\n" + +#: lib/getopt.c:723 lib/getopt.c:896 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: izbira ,%s` zahteva argument\n" + +#. --option +#: lib/getopt.c:752 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: neprepoznana izbira ,--%s`\n" + +#. +option or -option +#: lib/getopt.c:756 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: neprepoznana izbira ,%c%s`\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:782 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: nedovoljena izbira -- %c\n" + +#: lib/getopt.c:785 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: neveljavna izbira -- %c\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:815 lib/getopt.c:945 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: izbira zahteva argument -- %c\n" + +#: lib/getopt.c:862 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: izbira ,-W %s` je dvoumna\n" + +#: lib/getopt.c:880 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: izbira ,-W %s` ne dovoljuje argumenta\n" + +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#: lib/quotearg.c:259 +msgid "`" +msgstr "," + +#: lib/quotearg.c:260 +msgid "'" +msgstr "`" + +#~ msgid "option %s" +#~ msgstr "izbira %s" + +#~ msgid " with arg %s" +#~ msgstr " z argumentom %s" + +#~ msgid "digits occur in two different argv-elements.\n" +#~ msgstr "¹tevke nastopajo pri dveh elementih ARGV.\n" + +#~ msgid "option %c\n" +#~ msgstr "izbira %c\n" + +#~ msgid "option a\n" +#~ msgstr "izbira a\n" + +#~ msgid "option b\n" +#~ msgstr "izbira b\n" + +#~ msgid "option c with value `%s'\n" +#~ msgstr "izbira c z vrednostjo ,%s`\n" + +#~ msgid "option d with value `%s'\n" +#~ msgstr "izbira d z vrednostjo ,%s`\n" + +#~ msgid "?? getopt returned character code 0%o ??\n" +#~ msgstr "?? funkcija getopt vrnila kodo znaka 0%o ??\n" + +#~ msgid "non-option ARGV-elements: " +#~ msgstr "neizbirni elementi ARGV: " + +#~ msgid "memory exhausted\n" +#~ msgstr "pomnilnik porabljen\n" + +#~ msgid "you may specify only one of -E, -F, or -G" +#~ msgstr "izberete lahko samo eno od izbir: -E, -F ali -G" + +#~ msgid "GNU grep version 2.0" +#~ msgstr "GNU grep verzija 2.0" + +#~ msgid "(standard input)\n" +#~ msgstr "(standardni vhod)\n" diff --git a/po/sr.po b/po/sr.po new file mode 100644 index 0000000..eaef83d --- /dev/null +++ b/po/sr.po @@ -0,0 +1,402 @@ +# Serbian translation of grep +# Copyright (C) 2003 Free Software Foundation, Inc. +# Danilo Segan , 2003. +# +msgid "" +msgstr "" +"Project-Id-Version: grep 2.5g\n" +"POT-Creation-Date: 2002-03-26 16:38+0100\n" +"PO-Revision-Date: 2003-11-29 01:00+0100\n" +"Last-Translator: Danilo Segan \n" +"Language-Team: Serbian \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +# исцрпљена? ;-) +#: src/dfa.c:136 src/dfa.c:147 src/dfa.c:158 src/search.c:689 +msgid "Memory exhausted" +msgstr "Меморија истрошена" + +#: src/dfa.c:489 src/dfa.c:492 src/dfa.c:510 src/dfa.c:521 src/dfa.c:545 +#: src/dfa.c:604 src/dfa.c:609 src/dfa.c:622 src/dfa.c:623 src/dfa.c:1001 +#: src/dfa.c:1004 src/dfa.c:1028 src/dfa.c:1032 src/dfa.c:1033 src/dfa.c:1036 +#: src/dfa.c:1048 src/dfa.c:1049 +msgid "Unbalanced [" +msgstr "Неуравнотежена [" + +#: src/dfa.c:741 +msgid "Unfinished \\ escape" +msgstr "Недовршена \\ наредба" + +#. Cases: +#. {M} - exact count +#. {M,} - minimum count, maximum is infinity +#. {M,N} - M through N +#: src/dfa.c:874 src/dfa.c:880 src/dfa.c:890 src/dfa.c:898 src/dfa.c:913 +msgid "unfinished repeat count" +msgstr "недовршен број понављања" + +#: src/dfa.c:887 src/dfa.c:904 src/dfa.c:912 src/dfa.c:916 +msgid "malformed repeat count" +msgstr "лош облик броја понављања" + +#: src/dfa.c:1253 +msgid "Unbalanced (" +msgstr "Неуравнотежена (" + +#: src/dfa.c:1378 +msgid "No syntax specified" +msgstr "Синтакса није наведена" + +#: src/dfa.c:1386 +msgid "Unbalanced )" +msgstr "Неуравнотежена )" + +#: src/dfa.c:2956 +msgid "out of memory" +msgstr "понестало меморије" + +#: src/kwset.c:171 src/kwset.c:177 src/search.c:103 src/search.c:209 +#: src/search.c:293 lib/obstack.c:471 +msgid "memory exhausted" +msgstr "меморија истрошена" + +#: src/grep.c:205 +msgid "invalid context length argument" +msgstr "неисправан аргумент дужине контекста" + +#: src/grep.c:479 +msgid "input is too large to count" +msgstr "улаз је превелик за пребројавање" + +#: src/grep.c:605 +msgid "writing output" +msgstr "пишем излаз" + +#: src/grep.c:878 +#, c-format +msgid "Binary file %s matches\n" +msgstr "Бинарна датотека %s одговара\n" + +#: src/grep.c:892 +msgid "(standard input)" +msgstr "(стандардни улаз)" + +#: src/grep.c:997 +#, c-format +msgid "warning: %s: %s\n" +msgstr "упозорење: %s: %s\n" + +#: src/grep.c:998 +msgid "recursive directory loop" +msgstr "рекурзивно вртење кроз директоријуме" + +#: src/grep.c:1046 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE]...\n" +msgstr "Употреба: %s [ОПЦИЈА]... ШАБЛОН [ДАТОТЕКА]...\n" + +#: src/grep.c:1048 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "Пробајте „%s --help“ за више података.\n" + +# bug: is this "..."<>" ..." difference neccessary? +#: src/grep.c:1053 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE] ...\n" +msgstr "Употреба: %s [ОПЦИЈА]... ШАБЛОН [ДАТОТЕКА] ...\n" + +#: src/grep.c:1054 +#, c-format +msgid "" +"Search for PATTERN in each FILE or standard input.\n" +"Example: %s -i 'hello world' menu.h main.c\n" +"\n" +"Regexp selection and interpretation:\n" +msgstr "" +"Тражи ШАБЛОН у свакој ДАТОТЕКА или у стандардном улазу.\n" +"Пример: %s -i „здраво свете“ мени.h главно.c\n" +"\n" +"Избор и обрада регуларних израза:\n" + +#: src/grep.c:1059 +msgid "" +" -E, --extended-regexp PATTERN is an extended regular expression\n" +" -F, --fixed-strings PATTERN is a set of newline-separated strings\n" +" -G, --basic-regexp PATTERN is a basic regular expression\n" +" -P, --perl-regexp PATTERN is a Perl regular expression\n" +msgstr "" +" -E, --extended-regexp ШАБЛОН је проширени регуларни израз\n" +" -F, --fixed-strings ШАБЛОН је скуп ниску у посебним редовима\n" +" -G, --basic-regexp ШАБЛОН је основни регуларни израз\n" +" -P, --perl-regexp ШАБЛОН је Перл регуларни израз\n" + +#: src/grep.c:1064 +msgid "" +" -e, --regexp=PATTERN use PATTERN as a regular expression\n" +" -f, --file=FILE obtain PATTERN from FILE\n" +" -i, --ignore-case ignore case distinctions\n" +" -w, --word-regexp force PATTERN to match only whole words\n" +" -x, --line-regexp force PATTERN to match only whole lines\n" +" -z, --null-data a data line ends in 0 byte, not newline\n" +msgstr "" +" -e, --regexp=ШАБЛОН користи ШАБЛОН као регуларни израз\n" +" -f, --file=ДАТОТЕКА преузми ШАБЛОН из ДАТОТЕКА\n" +" -i, --ignore-case занемари разлике у величини слова\n" +" -w, --word-regexp присили ШАБЛОН да одговара једино целим речима\n" +" -x, --line-regexp присили ШАБЛОН да одговара једино целим редовима\n" +" -z, --null-data ред података се завршава 0-бајтом, не новим редом\n" + +#: src/grep.c:1071 +msgid "" +"\n" +"Miscellaneous:\n" +" -s, --no-messages suppress error messages\n" +" -v, --invert-match select non-matching lines\n" +" -V, --version print version information and exit\n" +" --help display this help and exit\n" +" --mmap use memory-mapped input if possible\n" +msgstr "" +"\n" +"Разно:\n" +" -s, --no-messages искључи поруке о грешкама\n" +" -v, --invert-match изабери не-одговарајуће редове\n" +" -V, --version испиши податке о издању и заврши\n" +" --help прикажи ову помоћ и заврши\n" +" --mmap мапирај улаз у меморију ако је могуће\n" + +#: src/grep.c:1079 +msgid "" +"\n" +"Output control:\n" +" -m, --max-count=NUM stop after NUM matches\n" +" -b, --byte-offset print the byte offset with output lines\n" +" -n, --line-number print line number with output lines\n" +" --line-buffered flush output on every line\n" +" -H, --with-filename print the filename for each match\n" +" -h, --no-filename suppress the prefixing filename on output\n" +" --label=LABEL print LABEL as filename for standard input\n" +" -o, --only-matching show only the part of a line matching PATTERN\n" +" -q, --quiet, --silent suppress all normal output\n" +" --binary-files=TYPE assume that binary files are TYPE\n" +" TYPE is 'binary', 'text', or 'without-match'\n" +" -a, --text equivalent to --binary-files=text\n" +" -I equivalent to --binary-files=without-match\n" +" -d, --directories=ACTION how to handle directories\n" +" ACTION is 'read', 'recurse', or 'skip'\n" +" -D, --devices=ACTION how to handle devices, FIFOs and sockets\n" +" ACTION is 'read' or 'skip'\n" +" -R, -r, --recursive equivalent to --directories=recurse\n" +" --include=PATTERN files that match PATTERN will be examined\n" +" --exclude=PATTERN files that match PATTERN will be skipped.\n" +" --exclude-from=FILE files that match PATTERN in FILE will be skipped.\n" +" -L, --files-without-match only print FILE names containing no match\n" +" -l, --files-with-matches only print FILE names containing matches\n" +" -c, --count only print a count of matching lines per FILE\n" +" -Z, --null print 0 byte after FILE name\n" +msgstr "" +"\n" +"Управљање исписом:\n" +" -m, --max-count=БРОЈ стани након БРОЈ поклапања\n" +" -b, --byte-offset испиши бајтно растојање уз излазне редове\n" +" -n, --line-number испиши број реда уз излазне редове\n" +" --line-buffered прочисти излаз после сваког реда\n" +" -H, --with-filename испиши име датотеке за свако поклапање\n" +" -h, --no-filename искључи испис имена датотеке испред излаза\n" +" --label=ОЗНАКА испиши ОЗНАКА као име датотеке за стандардни улаз\n" +" -o, --only-matching покажи само део реда којо одговара ШАБЛОН-у\n" +" -q, --quiet, --silent искључи сав обичан испис\n" +" --binary-files=ВРСТА претпостави да су бинарне датотеке типа ВРСТА\n" +" ВРСТА је „binary“, „text“ или „without-match“\n" +" -a, --text исто као --binary-files=text\n" +" -I исто као --binary-files=without-match\n" +" -d, --directories=АКЦИЈА како да баратам директоријумима\n" +" АКЦИЈА је „read“, „recurse“ или „skip“\n" +" -D, --devices=АКЦИЈА како да барата уређајима, FIFO-има и сокетима\n" +" АКЦИЈА је „read“ или „skip“\n" +" -R, -r, --recursive исто као --directories=recurse\n" +" --include=ШАБЛОН испитују се датотеке које одговарају ШАБЛОН-у\n" +" --exclude=ШАБЛОН прескачу се датотеке које одговарају ШАБЛОН-у.\n" +" --exclude-from=ДАТОТЕКА прескачу се датотеке из ДАТОТЕКА које \n" +" одговарају ШАБЛОН-у\n" +" -L, --files-without-match испиши једино имена датотека које не одговарају\n" +" -l, --files-with-matches испиши само имена датотека које одговарају\n" +" -c, --count испиши само број поклапања редова по датотеци\n" +" -Z, --null испиши 0-бајт након имена датотеке\n" + +#: src/grep.c:1107 +msgid "" +"\n" +"Context control:\n" +" -B, --before-context=NUM print NUM lines of leading context\n" +" -A, --after-context=NUM print NUM lines of trailing context\n" +" -C, --context=NUM print NUM lines of output context\n" +" -NUM same as --context=NUM\n" +" --color[=WHEN],\n" +" --colour[=WHEN] use markers to distinguish the matching string\n" +" WHEN may be `always', `never' or `auto'.\n" +" -U, --binary do not strip CR characters at EOL (MSDOS)\n" +" -u, --unix-byte-offsets report offsets as if CRs were not there (MSDOS)\n" +"\n" +"`egrep' means `grep -E'. `fgrep' means `grep -F'.\n" +"With no FILE, or when FILE is -, read standard input. If less than\n" +"two FILEs given, assume -h. Exit status is 0 if match, 1 if no match,\n" +"and 2 if trouble.\n" +msgstr "" +"\n" +"Управљање контекстом:\n" +" -B, --before-context=БРОЈ испиши БРОЈ редова почетног контекста\n" +" -A, --after-context=БРОЈ испиши БРОЈ редова накнадног контекста\n" +" -C, --context=БРОЈ испиши БРОЈ редова излазног контекста\n" +" -БРОЈ исто као --context=БРОЈ\n" +" --color[=КАДА],\n" +" --colour[=КАДА] користи обележиваче за разликовање нађене ниске\n" +" КАДА може бити „always“, „never“ или „auto“.\n" +" -U, --binary не исецај CR знакове на крају реда (ДОС)\n" +" -u, --unix-byte-offsets пријави бајтне адресе као да нема CR-ова (ДОС)\n" +"\n" +"„egrep“ означава „grep -E“. „fgrep“ означава „grep -F“.\n" +"Без ДАТОТЕКА, или ако је ДАТОТЕКА „-“, читам стандардни улаз. Уколико је\n" +"дато мање од две датотеке, претпостављам -h. Излазно стање је 0 ако се \n" +"поклапа, 1 ако се не поклапа и 2 ако има проблема.\n" + +#: src/grep.c:1124 +#, fuzzy +msgid "" +"\n" +"Report bugs to .\n" +msgstr "" +"\n" +"Пријавите грешке на .\n" + +#: src/grep.c:1134 +msgid "conflicting matchers specified" +msgstr "наведени су сударајући трагачи" + +#: src/grep.c:1376 +msgid "unknown devices method" +msgstr "непознат метод уређаја" + +#: src/grep.c:1443 +msgid "unknown directories method" +msgstr "непознат метод директоријума" + +#: src/grep.c:1510 +msgid "invalid max count" +msgstr "неисправан максимални број" + +#: src/grep.c:1565 +msgid "unknown binary-files type" +msgstr "непозната врста бинарних датотека" + +#: src/grep.c:1660 +#, c-format +msgid "%s (GNU grep) %s\n" +msgstr "%s (ГНУ греп) %s\n" + +#: src/grep.c:1662 +msgid "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" +msgstr "Сва права задржана 1988, 1992-1999, 2000, 2001 Задужбина за слободни софтвер.\n" + +#: src/grep.c:1664 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"Ово је слободан софтвер; погледајте извор за услове умножавања. НЕМА\n" +"гаранције; чак ни за употребљивост или прилагођеност одређеној намени.\n" + +#: src/search.c:606 +msgid "The -P option is not supported" +msgstr "Опција -P није подржана" + +#: src/search.c:619 +msgid "The -P and -z options cannot be combined" +msgstr "Не могу се комбиновати опције -P и -z" + +#: lib/error.c:117 +msgid "Unknown system error" +msgstr "Непозната системска грешка" + +#: lib/getopt.c:675 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: опција „%s“ је неједнозначна\n" + +#: lib/getopt.c:700 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: опција „--%s“ не дозвољава аргумент\n" + +#: lib/getopt.c:705 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: опција „%c%s“ не дозвољава аргумент\n" + +#: lib/getopt.c:723 lib/getopt.c:896 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: опција „%s“ захтева аргумент\n" + +#. --option +#: lib/getopt.c:752 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: непозната опција „--%s“\n" + +#. +option or -option +#: lib/getopt.c:756 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: непозната опција „%c%s“\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:782 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: неисправна опција — %c\n" + +#: lib/getopt.c:785 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: недозвољена опција — %c\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:815 lib/getopt.c:945 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: опција захтева аргумент — %c\n" + +#: lib/getopt.c:862 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: опција „-W %s“ је неједнозначна\n" + +#: lib/getopt.c:880 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: опција „-W %s“ не дозвољава аргумент\n" + +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#: lib/quotearg.c:259 +msgid "`" +msgstr "„" + +#: lib/quotearg.c:260 +msgid "'" +msgstr "“" diff --git a/po/sv.po b/po/sv.po new file mode 100644 index 0000000..f2db3f6 --- /dev/null +++ b/po/sv.po @@ -0,0 +1,405 @@ +# Swedish messages for GNU Grep version 2.5e +# Copyright (C) 2001 Free Software Foundation, Inc. +# Daniel Resare , 1998, 1999, 2000, 2001, 2002 +# Thomas Olsson , 1996. +# +msgid "" +msgstr "" +"Project-Id-Version: GNU grep 2.5.1\n" +"POT-Creation-Date: 2002-03-26 16:38+0100\n" +"PO-Revision-Date: 2002-05-12 18:39+0200\n" +"Last-Translator: Daniel Resare \n" +"Language-Team: Swedish \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=iso-8859-1\n" +"Content-Transfer-Encoding: 8bit\n" + +#: src/dfa.c:136 src/dfa.c:147 src/dfa.c:158 src/search.c:689 +msgid "Memory exhausted" +msgstr "Minnet slut" + +#: src/dfa.c:489 src/dfa.c:492 src/dfa.c:510 src/dfa.c:521 src/dfa.c:545 +#: src/dfa.c:604 src/dfa.c:609 src/dfa.c:622 src/dfa.c:623 src/dfa.c:1001 +#: src/dfa.c:1004 src/dfa.c:1028 src/dfa.c:1032 src/dfa.c:1033 src/dfa.c:1036 +#: src/dfa.c:1048 src/dfa.c:1049 +msgid "Unbalanced [" +msgstr "Obalanserad [" + +#: src/dfa.c:741 +msgid "Unfinished \\ escape" +msgstr "Oavslutad \\-sekvens" + +#. Cases: +#. {M} - exact count +#. {M,} - minimum count, maximum is infinity +#. {M,N} - M through N +#: src/dfa.c:874 src/dfa.c:880 src/dfa.c:890 src/dfa.c:898 src/dfa.c:913 +msgid "unfinished repeat count" +msgstr "oavslutad repetitionsräknare" + +#: src/dfa.c:887 src/dfa.c:904 src/dfa.c:912 src/dfa.c:916 +msgid "malformed repeat count" +msgstr "felformaterad repetionsräknare" + +#: src/dfa.c:1253 +msgid "Unbalanced (" +msgstr "Obalanserad (" + +#: src/dfa.c:1378 +msgid "No syntax specified" +msgstr "Ingen specificerad syntax" + +#: src/dfa.c:1386 +msgid "Unbalanced )" +msgstr "Obalanserad )" + +#: src/dfa.c:2956 +msgid "out of memory" +msgstr "minnet slut" + +#: src/kwset.c:171 src/kwset.c:177 src/search.c:103 src/search.c:209 +#: src/search.c:293 lib/obstack.c:471 +msgid "memory exhausted" +msgstr "minnet slut" + +#: src/grep.c:205 +msgid "invalid context length argument" +msgstr "ogiltigt argument till -A, -B eller -C" + +#: src/grep.c:479 +msgid "input is too large to count" +msgstr "det är för mycket indata för att räkna" + +#: src/grep.c:605 +msgid "writing output" +msgstr "skriver utdata" + +#: src/grep.c:878 +#, c-format +msgid "Binary file %s matches\n" +msgstr "Binär fil %s matchar\n" + +#: src/grep.c:892 +msgid "(standard input)" +msgstr "(standard in)" + +#: src/grep.c:997 +#, c-format +msgid "warning: %s: %s\n" +msgstr "varning: %s: %s\n" + +#: src/grep.c:998 +msgid "recursive directory loop" +msgstr "rekursiv katalogloop" + +#: src/grep.c:1046 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE]...\n" +msgstr "Användning: %s [FLAGGA]... MÖNSTER [FIL]...\n" + +#: src/grep.c:1048 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "Försök med \"%s --help\" för mer information\n" + +#: src/grep.c:1053 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE] ...\n" +msgstr "Användning: %s [FLAGGA]... MÖNSTER [FIL]...\n" + +#: src/grep.c:1054 +#, c-format +msgid "" +"Search for PATTERN in each FILE or standard input.\n" +"Example: %s -i 'hello world' menu.h main.c\n" +"\n" +"Regexp selection and interpretation:\n" +msgstr "" +"Sök efter MÖNSTER i varje FIL eller standard in.\n" +"Exempel: %s -i 'hello world' menu.h main.c\n" +"\n" +"Val och tolkning av reguljära uttryck:\n" + +#: src/grep.c:1059 +msgid "" +" -E, --extended-regexp PATTERN is an extended regular expression\n" +" -F, --fixed-strings PATTERN is a set of newline-separated strings\n" +" -G, --basic-regexp PATTERN is a basic regular expression\n" +" -P, --perl-regexp PATTERN is a Perl regular expression\n" +msgstr "" +" -E, --extended-regexp MÖNSTER är ett utökat reguljärt uttryck\n" +" -F, --fixed-strings MÖNSTER är ett antal strängar separerade med nyrad\n" +" -G, --basic-regexp MÖNSTER är ett enkelt reguljärt uttryck\n" +" -P, --perl-regexp MÖNSTER är ett reguljärt uttryck som i Perl\n" + +#: src/grep.c:1064 +msgid "" +" -e, --regexp=PATTERN use PATTERN as a regular expression\n" +" -f, --file=FILE obtain PATTERN from FILE\n" +" -i, --ignore-case ignore case distinctions\n" +" -w, --word-regexp force PATTERN to match only whole words\n" +" -x, --line-regexp force PATTERN to match only whole lines\n" +" -z, --null-data a data line ends in 0 byte, not newline\n" +msgstr "" +" -e, --regexp=MÖNSTER använd MÖNSTER som ett reguljärt uttryck\n" +" -f, --file=FIL hämta MÖNSTER från FIL\n" +" -i, --ignore-case skilj ej på gemener och versaler\n" +" -w, --word-regexp tvinga MÖNSTER att endast matcha hela ord\n" +" -x, --line-regexp tvinga MÖNSTER att endast matcha hela rader\n" +" -z, --null-data en rad indata begränsas av en nolltecken, inte\n" +" av ett nyrad-tecken\n" + +#: src/grep.c:1071 +msgid "" +"\n" +"Miscellaneous:\n" +" -s, --no-messages suppress error messages\n" +" -v, --invert-match select non-matching lines\n" +" -V, --version print version information and exit\n" +" --help display this help and exit\n" +" --mmap use memory-mapped input if possible\n" +msgstr "" +"\n" +"Diverse:\n" +" -s, --no-messages visa inga felmeddelanden\n" +" -v, --invert-match välj rader utan träffar\n" +" -V, --version visa versionsinformation och avsluta\n" +" --help visa detta hjälpmeddelande och avsluta\n" +" --mmap använd om möjligt minesmappning vid\n" +" läsning av indata.\n" + +#: src/grep.c:1079 +msgid "" +"\n" +"Output control:\n" +" -m, --max-count=NUM stop after NUM matches\n" +" -b, --byte-offset print the byte offset with output lines\n" +" -n, --line-number print line number with output lines\n" +" --line-buffered flush output on every line\n" +" -H, --with-filename print the filename for each match\n" +" -h, --no-filename suppress the prefixing filename on output\n" +" --label=LABEL print LABEL as filename for standard input\n" +" -o, --only-matching show only the part of a line matching PATTERN\n" +" -q, --quiet, --silent suppress all normal output\n" +" --binary-files=TYPE assume that binary files are TYPE\n" +" TYPE is 'binary', 'text', or 'without-match'\n" +" -a, --text equivalent to --binary-files=text\n" +" -I equivalent to --binary-files=without-match\n" +" -d, --directories=ACTION how to handle directories\n" +" ACTION is 'read', 'recurse', or 'skip'\n" +" -D, --devices=ACTION how to handle devices, FIFOs and sockets\n" +" ACTION is 'read' or 'skip'\n" +" -R, -r, --recursive equivalent to --directories=recurse\n" +" --include=PATTERN files that match PATTERN will be examined\n" +" --exclude=PATTERN files that match PATTERN will be skipped.\n" +" --exclude-from=FILE files that match PATTERN in FILE will be skipped.\n" +" -L, --files-without-match only print FILE names containing no match\n" +" -l, --files-with-matches only print FILE names containing matches\n" +" -c, --count only print a count of matching lines per FILE\n" +" -Z, --null print 0 byte after FILE name\n" +msgstr "" +"\n" +"Styrning av utskrift:\n" +" -m, --max-count=ANT skriv bara ut ANT träffar\n" +" -b, --byte-offset skriv position med visade rader\n" +" -n, --line-number skriv radnummer med visade rader\n" +" --line-buffered töm utskriftsbuffer efter varje rad\n" +" -H, --with-filename skriv filnamn vid varje träff\n" +" -h, --no-filename skriv inte filnamn vid varje visad rad\n" +" --label=ETIKETT skriv ETIKETT som filnamn för standard in\n" +" -q, --quiet, --silent undvik all normal utskrift\n" +" --binary-files=TYP antag att binära filer är av TYP\n" +" TYP är \"binary\", \"text\" eller \"without-match\"\n" +" -a, --text motsvarar --binary-files=text\n" +" -I motsvarar --binary-files=without-match\n" +" -d, --directories=ÅTGÄRD hur kataloger skall hanteras\n" +" ÅTGÄRD är \"read\", \"recurse\" eller \"skip\".\n" +" -D, --devices=ÅTGÄRD hur enheter, rör och sockets skall hanteras\n" +" ÅTGÄRD är \"read\" eller \"skip\"\n" +" -R, -r, --recursive motsvarar --directories=recurse\n" +" --include=MÖNSTER filer som matchar MÖNSTER undersöks\n" +" --exclude=MÖNSTER filer som matchar MÖNSTER hoppas över\n" +" --exclude-from=FIL filer som matchar mönster i FIL hoppas över\n" +" -L, --files-without-match skriv bara ut FILnamn utan träffar\n" +" -l, --files-with-matches skriv bara ut FILnamn med träffar\n" +" -c, --count skriv för varje FIL bara ut antal träffade rader\n" +" -Z, --null skriv 0-byte efter FILnamn\n" + +#: src/grep.c:1107 +msgid "" +"\n" +"Context control:\n" +" -B, --before-context=NUM print NUM lines of leading context\n" +" -A, --after-context=NUM print NUM lines of trailing context\n" +" -C, --context=NUM print NUM lines of output context\n" +" -NUM same as --context=NUM\n" +" --color[=WHEN],\n" +" --colour[=WHEN] use markers to distinguish the matching string\n" +" WHEN may be `always', `never' or `auto'.\n" +" -U, --binary do not strip CR characters at EOL (MSDOS)\n" +" -u, --unix-byte-offsets report offsets as if CRs were not there (MSDOS)\n" +"\n" +"`egrep' means `grep -E'. `fgrep' means `grep -F'.\n" +"With no FILE, or when FILE is -, read standard input. If less than\n" +"two FILEs given, assume -h. Exit status is 0 if match, 1 if no match,\n" +"and 2 if trouble.\n" +msgstr "" +"\n" +"Kontroll av sammanhang:\n" +" -B, --before-context=ANTAL skriv ANTAL rader före träffad rad\n" +" -A, --after-context=ANTAL skriv ANTAL rader efter träffad rad\n" +" -C, --context=ANTAL skriv ANTAL rader runt träffad rad\n" +" -ANTAL motsvarar --context=ANTAL\n" +" --color, --colour använd markörer för att särskilja träff\n" +" -U, --binary ta inte bort CR-tecken vid radslut (MSDOS)\n" +" -u, --unix-byte-offsets skriv offset som om CR-tecken inte förekommit\n" +"\n" +"\"egrep\" betyder \"grep -E\". \"fgrep\" betyder \"grep -F\".\n" +"Utan FIL, eller om FIL är -, läser programmet från standard in. Om färre än\n" +"två FILer är angivna, sätts flaggan -h. Programmet returnerar 0 om något\n" +"matchar, 1 om inget matchade och 2 om något fel uppstått.\n" + +#: src/grep.c:1124 +#, fuzzy +msgid "" +"\n" +"Report bugs to .\n" +msgstr "" +"\n" +"Rapportera buggar till .\n" +"Skicka anmärkningar på översättningar till \n" + +#: src/grep.c:1134 +msgid "conflicting matchers specified" +msgstr "motstridiga söksträngar specificerade" + +#: src/grep.c:1376 +msgid "unknown devices method" +msgstr "okänd metod gällande enheter" + +#: src/grep.c:1443 +msgid "unknown directories method" +msgstr "okänd metod gällande kataloger" + +#: src/grep.c:1510 +msgid "invalid max count" +msgstr "ogiltigt värde för antal träffar" + +#: src/grep.c:1565 +msgid "unknown binary-files type" +msgstr "okänd binärfiltyp" + +#: src/grep.c:1660 +#, c-format +msgid "%s (GNU grep) %s\n" +msgstr "%s (GNU grep) %s\n" + +#: src/grep.c:1662 +msgid "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" +msgstr "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" + +#: src/grep.c:1664 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"Detta program är fri programvara, se källkoden för kopieringsvilkor. Det\n" +"finns INGEN garanti, inte ens för SÄLJBARHET eller LÄMPLIGHET FÖR NÅGOT\n" +"SPECIELLT ÄNDAMÅL.\n" + +#: src/search.c:606 +msgid "The -P option is not supported" +msgstr "Flaggan -P stöds inte" + +#: src/search.c:619 +msgid "The -P and -z options cannot be combined" +msgstr "Flaggorna -P och -z kan inte kombineras" + +#: lib/error.c:117 +msgid "Unknown system error" +msgstr "Okänt systemfel" + +#: lib/getopt.c:675 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: flaggan \"%s\" är tvetydig\n" + +#: lib/getopt.c:700 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: flaggan \"%s\" tar inget argument\n" + +#: lib/getopt.c:705 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: flaggan \"%c%s\" tar inget argument\n" + +#: lib/getopt.c:723 lib/getopt.c:896 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: flaggan \"%s\" behöver ett argument\n" + +#. --option +#: lib/getopt.c:752 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: okänd flagga \"--%s\"\n" + +#. +option or -option +#: lib/getopt.c:756 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: okänd flagga \"%c%s\"\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:782 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: otillåten flagga -- %c\n" + +#: lib/getopt.c:785 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: otillåten flagga -- %c\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:815 lib/getopt.c:945 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: flagga behöver ett argument -- %c\n" + +#: lib/getopt.c:862 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: flaggan \"-W %s\" är tvetydig\n" + +#: lib/getopt.c:880 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: flaggan \"-W %s\" tillåter inget argument\n" + +# Då det skulle krävas att spara hela filen i UTF-8 för att kunna göra +# detta rätt, känns det inte värt det. Speciellt eftersom funktionen +# inte används i grep +# +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#: lib/quotearg.c:259 +msgid "`" +msgstr "\"" + +#: lib/quotearg.c:260 +msgid "'" +msgstr "\"" diff --git a/po/tr.po b/po/tr.po new file mode 100644 index 0000000..c9b492a --- /dev/null +++ b/po/tr.po @@ -0,0 +1,401 @@ +# Turkish translations for GNU grep messages. +# Copyright (C) 2005 Free Software Foundation, Inc. +# Nilgün Belma Bugüner , 2001, ..., 2005 +# +msgid "" +msgstr "" +"Project-Id-Version: grep 2.5.1a\n" +"POT-Creation-Date: 2002-03-26 16:38+0100\n" +"PO-Revision-Date: 2005-03-04 16:37+0300\n" +"Last-Translator: Nilgün Belma Bugüner \n" +"Language-Team: Turkish \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: KBabel 1.0\n" + +#: src/dfa.c:136 src/dfa.c:147 src/dfa.c:158 src/search.c:689 +msgid "Memory exhausted" +msgstr "Bellek tükendi" + +#: src/dfa.c:489 src/dfa.c:492 src/dfa.c:510 src/dfa.c:521 src/dfa.c:545 +#: src/dfa.c:604 src/dfa.c:609 src/dfa.c:622 src/dfa.c:623 src/dfa.c:1001 +#: src/dfa.c:1004 src/dfa.c:1028 src/dfa.c:1032 src/dfa.c:1033 src/dfa.c:1036 +#: src/dfa.c:1048 src/dfa.c:1049 +msgid "Unbalanced [" +msgstr "Karşılıksız [" + +#: src/dfa.c:741 +msgid "Unfinished \\ escape" +msgstr "Tamamlanmamış \\ öncelemi" + +#. Cases: +#. {M} - exact count +#. {M,} - minimum count, maximum is infinity +#. {M,N} - M through N +#: src/dfa.c:874 src/dfa.c:880 src/dfa.c:890 src/dfa.c:898 src/dfa.c:913 +msgid "unfinished repeat count" +msgstr "Tamamlanmamış tekrar sayısı" + +#: src/dfa.c:887 src/dfa.c:904 src/dfa.c:912 src/dfa.c:916 +msgid "malformed repeat count" +msgstr "Tekrar sayısı hatalı" + +#: src/dfa.c:1253 +msgid "Unbalanced (" +msgstr "Karşılıksız (" + +#: src/dfa.c:1378 +msgid "No syntax specified" +msgstr "Sözdizimi belirtilmemiş" + +#: src/dfa.c:1386 +msgid "Unbalanced )" +msgstr "Karşılıksız )" + +#: src/dfa.c:2956 +msgid "out of memory" +msgstr "bellek yetersiz" + +#: src/kwset.c:171 src/kwset.c:177 src/search.c:103 src/search.c:209 +#: src/search.c:293 lib/obstack.c:471 +msgid "memory exhausted" +msgstr "bellek tükendi" + +#: src/grep.c:205 +msgid "invalid context length argument" +msgstr "bağlam uzunluk değeri geçersiz" + +#: src/grep.c:479 +msgid "input is too large to count" +msgstr "girdi sayılamayacak kadar büyük" + +#: src/grep.c:605 +msgid "writing output" +msgstr "çıktıyı yazıyor" + +#: src/grep.c:878 +#, c-format +msgid "Binary file %s matches\n" +msgstr "Ä°kilik dosya %s eşleşir\n" + +#: src/grep.c:892 +msgid "(standard input)" +msgstr "(standart girdi)" + +#: src/grep.c:997 +#, c-format +msgid "warning: %s: %s\n" +msgstr "uyarı: %s: %s\n" + +#: src/grep.c:998 +msgid "recursive directory loop" +msgstr "ardışık dizin çevrimi" + +#: src/grep.c:1046 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE]...\n" +msgstr "Kullanımı: %s [SEÇENEK]... MASKE [DOSYA]...\n" + +#: src/grep.c:1048 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "Daha fazla bilgi için `%s --help' yazın.\n" + +#: src/grep.c:1053 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE] ...\n" +msgstr "Kullanımı: %s [SEÇENEK]... KALIP [DOSYA] ...\n" + +#: src/grep.c:1054 +#, c-format +msgid "" +"Search for PATTERN in each FILE or standard input.\n" +"Example: %s -i 'hello world' menu.h main.c\n" +"\n" +"Regexp selection and interpretation:\n" +msgstr "" +"Standart girdi ya da her DOSYA içinde KALIP için arama yapar.\n" +"Örneğin: %s -i 'merhaba dunya' menu.h main.c\n" +"\n" +"Düzenli ifade seçimi ve yorumlanması:\n" + +#: src/grep.c:1059 +msgid "" +" -E, --extended-regexp PATTERN is an extended regular expression\n" +" -F, --fixed-strings PATTERN is a set of newline-separated strings\n" +" -G, --basic-regexp PATTERN is a basic regular expression\n" +" -P, --perl-regexp PATTERN is a Perl regular expression\n" +msgstr "" +" -E, --extended-regexp KALIP bir genişletilmiş düzenli ifadedir\n" +" -F, --fixed-strings KALIP satır satır ayrılmış bir dizgedir\n" +" -G, --basic-regexp KALIP bir temel düzenli ifadedir\n" +" -P, --perl-regexp KALIP bir Perl düzenli ifadesidir\n" + +#: src/grep.c:1064 +msgid "" +" -e, --regexp=PATTERN use PATTERN as a regular expression\n" +" -f, --file=FILE obtain PATTERN from FILE\n" +" -i, --ignore-case ignore case distinctions\n" +" -w, --word-regexp force PATTERN to match only whole words\n" +" -x, --line-regexp force PATTERN to match only whole lines\n" +" -z, --null-data a data line ends in 0 byte, not newline\n" +msgstr "" +" -e, --regexp=KALIP KALIP bir düzenli ifade olarak kullanılır\n" +" -f, --file=DOSYA KALIP DOSYA dan alınır\n" +" -i, --ignore-case harf büyüklüklerini bir ayrım olarak görmez\n" +" -w, --word-regexp KALIP bir deyim olarak ele alınır\n" +" -x, --line-regexp KALIP bir bütün satır olarak ele alınır\n" +" -z, --null-data satır sonu içermeyen 0 baytlık satır\n" + +#: src/grep.c:1071 +msgid "" +"\n" +"Miscellaneous:\n" +" -s, --no-messages suppress error messages\n" +" -v, --invert-match select non-matching lines\n" +" -V, --version print version information and exit\n" +" --help display this help and exit\n" +" --mmap use memory-mapped input if possible\n" +msgstr "" +"\n" +"Çeşitli:\n" +" -s, --no-messages hata iletileri gösterilmez\n" +" -v, --invert-match eşleşmeyen satırlar seçilir\n" +" -V, --version sürümü gösterir ve çıkar\n" +" --help bu iletileri gösterir ve çıkar\n" +" --mmap mümkünse bellek-eşlemli girdi kullanılır\n" + +#: src/grep.c:1079 +msgid "" +"\n" +"Output control:\n" +" -m, --max-count=NUM stop after NUM matches\n" +" -b, --byte-offset print the byte offset with output lines\n" +" -n, --line-number print line number with output lines\n" +" --line-buffered flush output on every line\n" +" -H, --with-filename print the filename for each match\n" +" -h, --no-filename suppress the prefixing filename on output\n" +" --label=LABEL print LABEL as filename for standard input\n" +" -o, --only-matching show only the part of a line matching PATTERN\n" +" -q, --quiet, --silent suppress all normal output\n" +" --binary-files=TYPE assume that binary files are TYPE\n" +" TYPE is 'binary', 'text', or 'without-match'\n" +" -a, --text equivalent to --binary-files=text\n" +" -I equivalent to --binary-files=without-match\n" +" -d, --directories=ACTION how to handle directories\n" +" ACTION is 'read', 'recurse', or 'skip'\n" +" -D, --devices=ACTION how to handle devices, FIFOs and sockets\n" +" ACTION is 'read' or 'skip'\n" +" -R, -r, --recursive equivalent to --directories=recurse\n" +" --include=PATTERN files that match PATTERN will be examined\n" +" --exclude=PATTERN files that match PATTERN will be skipped.\n" +" --exclude-from=FILE files that match PATTERN in FILE will be skipped.\n" +" -L, --files-without-match only print FILE names containing no match\n" +" -l, --files-with-matches only print FILE names containing matches\n" +" -c, --count only print a count of matching lines per FILE\n" +" -Z, --null print 0 byte after FILE name\n" +msgstr "" +"\n" +"Çıktı denetimi:\n" +" -m, --max-count=SAYI SAYI eşleşmeden sonra durur\n" +" -b, --byte-offset çıktı satırlarında bayt adresi de gösterilir\n" +" -n, --line-number çıktı satırlarında satır no.ları da gösterilir\n" +" --line-buffered her satırda tüm çıktı gösterilir\n" +" -H, --with-filename her eşleşmede dosya ismi de gösterilir\n" +" -h, --no-filename dosya ismi gösterilmez\n" +" --label=ETÄ°KET standar girdi dosyası olarak ETÄ°KET gösterirlir\n" +" -o, --only-matching sadece satırın KALIPla eşleşen bölümü gösterilir\n" +" -q, --quiet, --silent çıktı verilmez\n" +" --binary-files=TÜR ikilik dosyalar TÜR türünde varsayılır\n" +" TÜR: 'binary', 'text', ya da 'without-match'\n" +" -a, --text --binary-files=text ile aynı\n" +" -I --binary-files=without-match ile aynı\n" +" -d, --directories=EYLEM dizinlerin ele alınma şekli\n" +" EYLEM: 'read', 'recurse', ya da 'skip'\n" +" -D, --devices=EYLEM aygıtların ele alınma şekli, FIFO ve soketler\n" +" için EYLEM: 'read' ya da 'skip'\n" +" -R, -r, --recursive --directories=recurse ile aynı (ardışık)\n" +" --include=KALIP KALIP ile eşleşen dosyalar gösterilir\n" +" --exclude=KALIP KALIP ile eşleşen dosyalar atlanır\n" +" --exclude-from=DOSYA DOSYA içindeki dosyalardan KALIP ile eşleşenler atlanır.\n" +" -L, --files-without-match sadece eşleşmeyen DOSYA isimleri gösterilir\n" +" -l, --files-with-matches sadece eşleşen DOSYA isimleri gösterilir\n" +" -c, --count her DOSYAdaki eşleşen satır sayısı gösterilir\n" +" -Z, --null DOSYA isminin arkasına null ekler\n" + +#: src/grep.c:1107 +msgid "" +"\n" +"Context control:\n" +" -B, --before-context=NUM print NUM lines of leading context\n" +" -A, --after-context=NUM print NUM lines of trailing context\n" +" -C, --context=NUM print NUM lines of output context\n" +" -NUM same as --context=NUM\n" +" --color[=WHEN],\n" +" --colour[=WHEN] use markers to distinguish the matching string\n" +" WHEN may be `always', `never' or `auto'.\n" +" -U, --binary do not strip CR characters at EOL (MSDOS)\n" +" -u, --unix-byte-offsets report offsets as if CRs were not there (MSDOS)\n" +"\n" +"`egrep' means `grep -E'. `fgrep' means `grep -F'.\n" +"With no FILE, or when FILE is -, read standard input. If less than\n" +"two FILEs given, assume -h. Exit status is 0 if match, 1 if no match,\n" +"and 2 if trouble.\n" +msgstr "" +"\n" +"Bağlamsal denetim:\n" +" -B, --before-context=SAYI bağlamdan önceki SAYI satır gösterilir\n" +" -A, --after-context=SAYI bağlamdan sonraki SAYI satır gösterilir\n" +" -C, --context=SAYI çıktı olarak SAYI satır gösterilir\n" +" -SAYI --context=SAYI ile aynı\n" +" --color[=SÜREÇ],\n" +" --colour[=SÜREÇ] eşleşen dizgeleri ayırt etmede renk kullanılır\n" +" SÜREÇ: daima 'always', hiç 'never', 'auto' -U, --binary satır sonlarındaki satırbaşı (CR) karakterlerini\n" +" kaldırmaz\n" +" -u, --unix-byte-offsets satırbaşı karakterlerine bakmaz\n" +"\n" +"`egrep' ile `grep -E', `fgrep' ile `grep -F' aynı işi yapar.\n" +"DOSYA verilmeksizin ya da yerine - verilirse standart girdi okunur.\n" +"Ä°ki DOSYAdan az verilmişse -h varsayılır.\n" +"Çıkışta durum eşleşme varsa 0, yoksa 1, belirsizlik varsa 2 dir.\n" + +#: src/grep.c:1124 +msgid "" +"\n" +"Report bugs to .\n" +msgstr "" +"\n" +"Yazılım hatalarını adresine,\n" +"çeviri hatalarını adresine bildirin.\n" + +#: src/grep.c:1134 +msgid "conflicting matchers specified" +msgstr "birbiriyle çatışan eşleştiriciler belirtildi" + +#: src/grep.c:1376 +msgid "unknown devices method" +msgstr "bilinmeyen aygıt yöntemi" + +#: src/grep.c:1443 +msgid "unknown directories method" +msgstr "bilinmeyen dizin yöntemi" + +#: src/grep.c:1510 +msgid "invalid max count" +msgstr "en çok miktarı geçersiz" + +#: src/grep.c:1565 +msgid "unknown binary-files type" +msgstr "bilinmeyen ikilik dosya türü" + +#: src/grep.c:1660 +#, c-format +msgid "%s (GNU grep) %s\n" +msgstr "%s (GNU grep) %s\n" + +#: src/grep.c:1662 +msgid "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" +msgstr "Telif Hakkı 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" + +#: src/grep.c:1664 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"Bu serbest yazılımdır; kopyalama koşulları için kaynak koduna bakınız.\n" +"Hiçbir garantisi yoktur; hatta SATILABÄ°LÄ°RLİĞİ veya ŞAHSÄ° KULLANIMINIZA\n" +"UYGUNLUĞU için bile garanti verilmez.\n" + +#: src/search.c:606 +msgid "The -P option is not supported" +msgstr "-P seçeneği desteklenmiyor" + +#: src/search.c:619 +msgid "The -P and -z options cannot be combined" +msgstr "-P ve -z seçenekleri birlikte olamaz" + +#: lib/error.c:117 +msgid "Unknown system error" +msgstr "Bilinmeyen sistem hatası" + +#: lib/getopt.c:675 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: `%s' seçeneği belirsiz\n" + +#: lib/getopt.c:700 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: `--%s' seçeneği argümansız kullanılır\n" + +#: lib/getopt.c:705 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: seçenek `%c%s' argümansız kullanılır\n" + +#: lib/getopt.c:723 lib/getopt.c:896 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: `%s' seçeneği bir argümanla kullanılır\n" + +#. --option +#: lib/getopt.c:752 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: `--%s' seçeneği bilinmiyor\n" + +#. +option or -option +#: lib/getopt.c:756 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: `%c%s' seçeneği bilinmiyor\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:782 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: kuraldışı seçenek -- %c\n" + +#: lib/getopt.c:785 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: geçersiz seçenek -- %c\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:815 lib/getopt.c:945 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: seçenek bir argümanla kullanılır -- %c\n" + +#: lib/getopt.c:862 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: `-W %s' seçeneği belirsiz\n" + +#: lib/getopt.c:880 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: `-W %s' seçeneği argümansız kullanılır\n" + +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#: lib/quotearg.c:259 +msgid "`" +msgstr "`" + +#: lib/quotearg.c:260 +msgid "'" +msgstr "'" diff --git a/po/uk.po b/po/uk.po new file mode 100644 index 0000000..0248e7c --- /dev/null +++ b/po/uk.po @@ -0,0 +1,405 @@ +# grep -- Ukrainian translation. +# Copyright (C) 2003 Free Software Foundation, Inc. +# Volodymyr M. Lisivka , 2001-2002. +# Dmytro O. Redchuk , 2002. +# $Id: uk.po,v 1.1 2006/08/18 21:04:18 bero Exp $ +# +msgid "" +msgstr "" +"Project-Id-Version: grep 2.5g\n" +"POT-Creation-Date: 2002-03-26 16:38+0100\n" +"PO-Revision-Date: 2003-01-25 13:27+0200\n" +"Last-Translator: Volodymyr M. Lisivka \n" +"Language-Team: Ukrainian \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=KOI8-U\n" +"Content-Transfer-Encoding: 8bit\n" + +#: src/dfa.c:136 src/dfa.c:147 src/dfa.c:158 src/search.c:689 +msgid "Memory exhausted" +msgstr "ðÁÍ'ÑÔØ ×ÉÞÅÒÐÁÎÏ" + +#: src/dfa.c:489 src/dfa.c:492 src/dfa.c:510 src/dfa.c:521 src/dfa.c:545 +#: src/dfa.c:604 src/dfa.c:609 src/dfa.c:622 src/dfa.c:623 src/dfa.c:1001 +#: src/dfa.c:1004 src/dfa.c:1028 src/dfa.c:1032 src/dfa.c:1033 src/dfa.c:1036 +#: src/dfa.c:1048 src/dfa.c:1049 +msgid "Unbalanced [" +msgstr "îÅ ÚÂÁÌÁÎÓÏ×ÁÎÏ [" + +#: src/dfa.c:741 +msgid "Unfinished \\ escape" +msgstr "îÅ ÚÁ×ÅÒÛÅÎÏ \\-ÐÏÓ̦ÄÏ×ΦÓÔØ" + +#. Cases: +#. {M} - exact count +#. {M,} - minimum count, maximum is infinity +#. {M,N} - M through N +#: src/dfa.c:874 src/dfa.c:880 src/dfa.c:890 src/dfa.c:898 src/dfa.c:913 +msgid "unfinished repeat count" +msgstr "ÎÅ ÚÁ×ÅÒÛÅÎÏ Ì¦ÞÉÌØÎÉËÁ ÐÏ×ÔÏÒ¦×" + +#: src/dfa.c:887 src/dfa.c:904 src/dfa.c:912 src/dfa.c:916 +msgid "malformed repeat count" +msgstr "ÈÉÂÎÉÊ Ì¦ÞÉÌØÎÉË ÐÏ×ÔÏÒ¦×" + +#: src/dfa.c:1253 +msgid "Unbalanced (" +msgstr "îÅ ÚÂÁÌÁÎÓÏ×ÁÎÏ (" + +#: src/dfa.c:1378 +msgid "No syntax specified" +msgstr "óÉÎÔÁËÓÉÓ ÎÅ ×ËÁÚÁÎÏ" + +#: src/dfa.c:1386 +msgid "Unbalanced )" +msgstr "îÅ ÚÂÁÌÁÎÓÏ×ÁÎÏ )" + +#: src/dfa.c:2956 +msgid "out of memory" +msgstr "ÎÅÄÏÓÔÁÔÎØÏ ÐÁÍ'ÑÔ¦" + +#: src/kwset.c:171 src/kwset.c:177 src/search.c:103 src/search.c:209 +#: src/search.c:293 lib/obstack.c:471 +msgid "memory exhausted" +msgstr "ÐÁÍ'ÑÔØ ×ÉÞÅÒÐÁÎÏ" + +#: src/grep.c:205 +msgid "invalid context length argument" +msgstr "ÎÅÐÒÁ×ÉÌØÎÉÊ ÁÒÇÕÍÅÎÔ ÄÏ×ÖÉÎÉ ËÏÎÔÅËÓÔÕ" + +#: src/grep.c:479 +msgid "input is too large to count" +msgstr "××¦Ä ÚÁÄÏ×ÇÉÊ ÄÌÑ ÏÂÞÉÓÌÅÎÎÑ" + +#: src/grep.c:605 +msgid "writing output" +msgstr "ÚÁÐÉÓÕ×ÁÎÎÑ Õ ×ÉצÄ" + +#: src/grep.c:878 +#, c-format +msgid "Binary file %s matches\n" +msgstr "äצÊËÏ×ÉÊ ÆÁÊÌ %s ͦÓÔÉÔØ Ú¦ÖΦÓÔØ\n" + +#: src/grep.c:892 +msgid "(standard input)" +msgstr "(ÓÔÁÎÄÁÒÔÎÉÊ ×צÄ)" + +#: src/grep.c:997 +#, c-format +msgid "warning: %s: %s\n" +msgstr "Õ×ÁÇÁ: %s: %s\n" + +#: src/grep.c:998 +msgid "recursive directory loop" +msgstr "ÚÁÃÉËÌÅÎÎÑ ÒÅËÕÒÓÉ×ÎÏÇÏ ÐÒÏÈÏÄÕ ËÁÔÁÌÏǦ×" + +#: src/grep.c:1046 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE]...\n" +msgstr "÷ÉËÏÒÉÓÔÁÎÎÑ: %s [ëìàþ]... ûáâìïî [æáêì]...\n" + +#: src/grep.c:1048 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "óÐÒÏÂÕÊÔÅ \"%s --help\" ÄÌÑ ÏÔÒÉÍÁÎÎÑ ÄÏÄÁÔËÏ×ϧ ¦ÎÆÏÒÍÁæ§.\n" + +#: src/grep.c:1053 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE] ...\n" +msgstr "÷ÉËÏÒÉÓÔÁÎÎÑ: %s [ëìàþ]... ûáâìïî [æáêì] ...\n" + +#: src/grep.c:1054 +#, c-format +msgid "" +"Search for PATTERN in each FILE or standard input.\n" +"Example: %s -i 'hello world' menu.h main.c\n" +"\n" +"Regexp selection and interpretation:\n" +msgstr "" +"ðÏÛÕË ûáâìïîÕ Õ ËÏÖÎÏÍÕ æáêì¦ ÞÉ Õ ÓÔÁÎÄÁÒÔÎÏÍÕ ××ÏĦ.\n" +"ðÒÉËÌÁÄ: %s -i 'hello world' menu.h main.c\n" +"\n" +"÷ÉÂ¦Ò ÔÁ ¦ÎÔÅÒÐÒÅÔÁÃ¦Ñ ÒÅÇÕÌÑÒÎÉÈ ×ÉÒÁÚ¦×:\n" + +#: src/grep.c:1059 +msgid "" +" -E, --extended-regexp PATTERN is an extended regular expression\n" +" -F, --fixed-strings PATTERN is a set of newline-separated strings\n" +" -G, --basic-regexp PATTERN is a basic regular expression\n" +" -P, --perl-regexp PATTERN is a Perl regular expression\n" +msgstr "" +" -E, --extended-regexp ûáâìïî ¤ ÒÏÚÛÉÒÅÎÉÍ ÒÅÇÕÌÑÒÎÉÍ ×ÉÒÁÚÏÍ\n" +" -F, --fixed-strings ûáâìïî ¤ ÎÁÂÏÒÏÍ ÒÑÄ˦×, ÒÏÚĦÌÅÎÉÈ \\n\n" +" -G, --basic-regexp ûáâìïî ¤ Ú×ÉÞÁÊÎÉÍ ÒÅÇÕÌÑÒÎÉÍ ×ÉÒÁÚÏÍ\n" +" -P, --perl-regexp ûáâìïî ¤ ÒÅÇÕÌÑÒÎÉÍ ×ÉÒÁÚÏÍ Perl\n" + +#: src/grep.c:1064 +msgid "" +" -e, --regexp=PATTERN use PATTERN as a regular expression\n" +" -f, --file=FILE obtain PATTERN from FILE\n" +" -i, --ignore-case ignore case distinctions\n" +" -w, --word-regexp force PATTERN to match only whole words\n" +" -x, --line-regexp force PATTERN to match only whole lines\n" +" -z, --null-data a data line ends in 0 byte, not newline\n" +msgstr "" +" -e, --regexp=ûáâìïî ×ÉËÏÒÉÓÔÏ×Õ×ÁÔÉ ûáâìïî ÑË ÒÅÇÕÌÑÒÎÉÊ ×ÉÒÁÚ\n" +" -f, --file=æáêì ×ÚÑÔÉ ûáâìïî ¦Ú æáêìÁ\n" +" -i, --ignore-case ¦ÇÎÏÒÕ×ÁÔÉ ÒÅǦÓÔÒ Ì¦ÔÅÒ\n" +" -w, --word-regexp ûáâìïî Ú¦ÇÁÔÉÍÅÔØÓÑ ÌÉÛÅ ¦Ú æÌÉÍ ÓÌÏ×ÏÍ\n" +" -x, --line-regexp ûáâìïî Ú¦ÇÁÔÉÍÅÔØÓÑ ÌÉÛÅ ¦Ú æÌÉÍ ÒÑÄËÏÍ\n" +" -z, --null-data ÒÑÄËÉ ÄÁÎÉÈ ÚÁ˦ÎÞÕÀÔØÓÑ ÂÁÊÔÏÍ \"0\", Á Ί˦ÎÃÅÍ\n" +" ÒÑÄËÁ\n" + +#: src/grep.c:1071 +msgid "" +"\n" +"Miscellaneous:\n" +" -s, --no-messages suppress error messages\n" +" -v, --invert-match select non-matching lines\n" +" -V, --version print version information and exit\n" +" --help display this help and exit\n" +" --mmap use memory-mapped input if possible\n" +msgstr "" +"\n" +"ò¦ÚÎÅ:\n" +" -s, --no-messages ÚÁÍÏ×ÞÕ×ÁÔÉ ÐÏÍÉÌËÉ\n" +" -v, --invert-match ×ÉÂÉÒÁÔÉ ÒÑÄËÉ ÂÅÚ Ú¦ÖÎÏÓÔÅÊ\n" +" -V, --version ×ÉÄÁÔÉ ¦ÎÆÏÒÍÁæÀ ÐÒÏ ×ÅÒÓ¦À ÔÁ ×ÉÊÔÉ\n" +" --help ×ÉÄÁÔÉ ÃÀ ЦÄËÁÚËÕ ÔÁ ×ÉÊÔÉ\n" +" --mmap ×ÉËÏÒÉÓÔÏ×Õ×ÁÔÉ mmap(2) ÄÌÑ ÞÉÔÁÎÎÑ, ÑËÝÏ ÍÏÖÌÉ×Ï\n" + +#: src/grep.c:1079 +msgid "" +"\n" +"Output control:\n" +" -m, --max-count=NUM stop after NUM matches\n" +" -b, --byte-offset print the byte offset with output lines\n" +" -n, --line-number print line number with output lines\n" +" --line-buffered flush output on every line\n" +" -H, --with-filename print the filename for each match\n" +" -h, --no-filename suppress the prefixing filename on output\n" +" --label=LABEL print LABEL as filename for standard input\n" +" -o, --only-matching show only the part of a line matching PATTERN\n" +" -q, --quiet, --silent suppress all normal output\n" +" --binary-files=TYPE assume that binary files are TYPE\n" +" TYPE is 'binary', 'text', or 'without-match'\n" +" -a, --text equivalent to --binary-files=text\n" +" -I equivalent to --binary-files=without-match\n" +" -d, --directories=ACTION how to handle directories\n" +" ACTION is 'read', 'recurse', or 'skip'\n" +" -D, --devices=ACTION how to handle devices, FIFOs and sockets\n" +" ACTION is 'read' or 'skip'\n" +" -R, -r, --recursive equivalent to --directories=recurse\n" +" --include=PATTERN files that match PATTERN will be examined\n" +" --exclude=PATTERN files that match PATTERN will be skipped.\n" +" --exclude-from=FILE files that match PATTERN in FILE will be skipped.\n" +" -L, --files-without-match only print FILE names containing no match\n" +" -l, --files-with-matches only print FILE names containing matches\n" +" -c, --count only print a count of matching lines per FILE\n" +" -Z, --null print 0 byte after FILE name\n" +msgstr "" +"\n" +"ëÅÒÕ×ÁÎÎÑ ×É×ÏÄÏÍ:\n" +" -m, --max-count=þéóìï ÚÕÐÉÎÉÔÉÓÑ Ð¦ÓÌÑ þéóìÁ Ú¦ÖÎÏÓÔÅÊ\n" +" -b, --byte-offset ÄÒÕËÕ×ÁÔÉ ÚͦÝÅÎÑ Õ ÂÁÊÔÁÈ ¦Ú ÒÑÄËÁÍÉ ×É×ÏÄÕ\n" +" -n, --line-number ÄÒÕËÕ×ÁÔÉ ÎÏÍÅÒÉ ÒÑÄË¦× ÒÁÚÏÍ ¦Ú ÒÑÄËÁÍÉ ×É×ÏÄÕ\n" +" --line-buffered ÓÐÏÒÏÖÎÀ×ÁÔÉ ÂÕÆÅÒ ×É×ÏÄÕ ÎÁ ËÏÖÎÏÍÕ ÒÑÄËÕ\n" +" -H, --with-filename ÄÒÕËÕ×ÁÔÉ ¦Í'Ñ ÆÁÊÌÁ ÄÌÑ ËÏÖÎϧ Ú¦ÖÎÏÓÔ¦\n" +" -h, --no-filename ÚÁÍÏ×ÞÕ×ÁÔÉ ¦Í'Ñ ÆÁÊÌÁ ÄÌÑ ËÏÖÎϧ Ú¦ÖÎÏÓÔ¦\n" +" --label=í¶ôëá ÄÒÕËÕ×ÁÔÉ í¶ôëÕ ÑË ¦Í'Ñ ÆÁÊÌÕ ÄÌÑ\n" +" ÓÔÁÎÄÁÒÔÎÏÇÏ ××ÏÄÕ\n" +" -o, --only-matching ÐÏËÁÚÕ×ÁÔÉ ÌÉÛÅ ÞÁÓÔÉÎÕ ÒÑÄËÁ, ÝÏ Í¦ÓÔÉÔØ ûáâìïî\n" +" -q, --quiet, --silent ÚÁÂÏÒÏÎÉÔÉ ×Ó¦ ÎÏÒÍÁÌØΦ ÐÏצÄÏÍÌÅÎÎÑ\n" +" --binary-files=ôéð ××ÁÖÁÔÉ, ÝÏ ÄצÊËÏצ ÆÁÊÌÉ ¤ ×ËÁÚÁÎÏÇÏ ôéðÕ\n" +" ôéð ÍÏÖÅ ÂÕÔÉ \"binary\", \"text\",\n" +" ÞÉ \"without-match\"\n" +" -a, --text ÔÅ Ö ÓÁÍÅ, ÝÏ Ê --binary-files=text\n" +" -I ÔÅ Ö ÓÁÍÅ, ÝÏ Ê --binary-files=without-match\n" +" -d, --directories=ä¶ñ ÑË ÏÐÒÁÃØÏ×Õ×ÁÔÉ ËÁÔÁÌÏÇÉ\n" +" ä¶ñ ÍÏÖÅ ÂÕÔÉ \"read\", \"recurse\", ÞÉ \"skip\"\n" +" -D, --devices=ä¶ñ ÑË ÏÐÒÁÃØÏ×Õ×ÁÔÉ ÐÒÉÓÔÒϧ, ËÁÎÁÌÉ ÔÁ ÇΦÚÄÁ\n" +" ä¶ñ ÍÏÖÅ ÂÕÔÉ \"read\" ÞÉ \"skip\"\n" +" -R, -r, --recursive ÔÅ Ö ÓÁÍÅ, ÝÏ Ê --directories=recurse\n" +" --include=ûáâìïî ÐÅÒÅצÒÑÔÉ ÆÁÊÌÉ, ÝÏ ×¦ÄÐÏצÄÁÀÔØ ûáâìïîÕ\n" +" --exclude=ûáâìïî ÐÒÏÐÕÓËÁÔÉ ÆÁÊÌÉ, ÝÏ ×¦ÄÐÏצÄÁÀÔØ ûáâìïîÕ\n" +" --exclude-from=æáêì ÐÒÏÐÕÓËÁÔÉ ÆÁÊÌÉ, ÝÏ ×¦ÄÐÏצÄÁÀÔØ ûáâìïîÕ Ú æáêìÕ\n" +" -L, --files-without-match ÄÒÕËÕ×ÁÔÉ ÌÉÛÅ ¦ÍÅÎÁ æáêì¦×, ÝÏ ÎÅ ÍÁÀÔØ Ú¦ÖÎÏÓÔÅÊ\n" +" -l, --files-with-matches ÄÒÕËÕ×ÁÔÉ ÌÉÛÅ ¦ÍÅÎÁ æáêì¦×, ÝÏ ÍÁÀÔØ Ú¦ÖÎÏÓÔ¦\n" +" -c, --count ÄÒÕËÕ×ÁÔÉ ÌÉÛŠ˦ÌØ˦ÓÔØ ÒÑÄ˦×\n" +" Ú¦ Ú¦ÖÎÏÓÔÑÍÉ Õ æáêì¦\n" +" -Z, --null ÄÒÕËÕ×ÁÔÉ ÂÁÊÔ \"0\" ЦÓÌÑ ¦ÍÅΦ æáêìÁ\n" + +#: src/grep.c:1107 +msgid "" +"\n" +"Context control:\n" +" -B, --before-context=NUM print NUM lines of leading context\n" +" -A, --after-context=NUM print NUM lines of trailing context\n" +" -C, --context=NUM print NUM lines of output context\n" +" -NUM same as --context=NUM\n" +" --color[=WHEN],\n" +" --colour[=WHEN] use markers to distinguish the matching string\n" +" WHEN may be `always', `never' or `auto'.\n" +" -U, --binary do not strip CR characters at EOL (MSDOS)\n" +" -u, --unix-byte-offsets report offsets as if CRs were not there (MSDOS)\n" +"\n" +"`egrep' means `grep -E'. `fgrep' means `grep -F'.\n" +"With no FILE, or when FILE is -, read standard input. If less than\n" +"two FILEs given, assume -h. Exit status is 0 if match, 1 if no match,\n" +"and 2 if trouble.\n" +msgstr "" +"\n" +"ëÏÎÔÒÏÌØ ×ͦÓÔÕ:\n" +" -B, --before-context=þéóìï ÄÒÕËÕ×ÁÔÉ þéóìï ÒÑÄË¦× ÐÅÒÅÄ Ú¦ÖΦÓÔÀ\n" +" -A, --after-context=þéóìï ÄÒÕËÕ×ÁÔÉ þéóìï ÒÑÄË¦× Ð¦ÓÌÑ Ú¦ÖÎÏÓÔ¦\n" +" -C, --context=þéóìï ÄÒÕËÕ×ÁÔÉ þéóìï ÓÕÓ¦ÄÎ¦È ÒÑÄ˦×\n" +" -þéóìï ÔÅ Ö ÓÁÍÅ, ÝÏ Ê --context=þéóìï\n" +" --color[=äå],\n" +" --colour[=äå] ×ÉËÏÒÉÓÔÏ×Õ×ÁÔÉ ÍÁÒËÅÒÉ ÄÌÑ ×¦ÄÒ¦ÚÎÅÎÎÑ\n" +" ÒÑÄË¦× Ú¦ Ú¦ÖÎÏÓÔÑÍÉ\n" +" äå ÍÏÖÅ ÂÕÔÉ \"always\", \"never\" ÞÉ \"auto\".\n" +" -U, --binary ÎÅ ×ÉÄÁÌÑÔÉ ÓÉÍ×ÏÌÉ CR ÎÁ ˦Îæ ÒÑÄËÁ (MSDOS)\n" +" -u, --unix-byte-offsets ×ËÁÚÕ×ÁÔÉ ÚͦÝÅÎÎÑ, ÎÁÞÅ ÚÁ צÄÓÕÔÎÏÓÔ¦\n" +" ÓÉÍ×ÏÌ¦× CR (MSDOS)\n" +"\n" +"\"egrep\" ÏÚÎÁÞÁ¤ \"grep -E\". \"fgrep\" ÏÚÎÁÞÁ¤ \"grep -F\".\n" +"ñËÝÏ ÎÅ ×ËÁÚÁÎÏ æáêì, ÞÉ æáêìÏÍ ¤ -, ÞÉÔÁÔÉ ÓÔÁÎÄÁÒÔÎÉÊ ×צÄ.\n" +"ñËÝÏ ÍÅÎÛÅ, Î¦Ö Ä×Á æáêìÉ ×ËÁÚÁÎÏ, ××ÁÖÁÔÉ -h. ëÏÄ ÚÁ×ÅÒÛÅÎÎÑ 0 -\n" +"ËÏÌÉ ¤ Ú¦ÖÎÏÓÔ¦, 1 - ËÏÌÉ §È ÎÅÍÁ, ÔÁ 2 - × ÒÁÚ¦ ÚÂÏÀ.\n" + +#: src/grep.c:1124 +#, fuzzy +msgid "" +"\n" +"Report bugs to .\n" +msgstr "" +"\n" +"ðÏצÄÏÍÌÑÊÔÅ ÐÒÏ ÐÏÍÉÌËÉ ÎÁ .\n" + +#: src/grep.c:1134 +msgid "conflicting matchers specified" +msgstr "ÚÁÄÁΦ ÕÍÏ×É Ú¦ÖÎÏÓÔ¦ ËÏÎÆ̦ËÔÕÀÔØ" + +#: src/grep.c:1376 +msgid "unknown devices method" +msgstr "" + +#: src/grep.c:1443 +msgid "unknown directories method" +msgstr "" + +#: src/grep.c:1510 +msgid "invalid max count" +msgstr "ÎÅÐÒÁ×ÉÌØÎÁ ÍÁËÓÉÍÁÌØÎÁ ˦ÌØ˦ÓÔØ" + +#: src/grep.c:1565 +msgid "unknown binary-files type" +msgstr "ÎÅצÄÏÍÉÊ ÔÉÐ ÄצÊËÏ×ÉÈ ÆÁÊ̦×" + +#: src/grep.c:1660 +#, c-format +msgid "%s (GNU grep) %s\n" +msgstr "" + +#: src/grep.c:1662 +msgid "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" +msgstr "" + +#: src/grep.c:1664 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" + +#: src/search.c:606 +msgid "The -P option is not supported" +msgstr "ëÌÀÞ -P ΊЦÄÔÒÉÍÕ¤ÔØÓÑ" + +#: src/search.c:619 +msgid "The -P and -z options cannot be combined" +msgstr "ëÌÀÞ¦ -P ÔÁ -z ÎÅ ÍÏÖÎÁ ÐϤÄÎÕ×ÁÔÉ" + +#: lib/error.c:117 +msgid "Unknown system error" +msgstr "îÅצÄÏÍÁ ÓÉÓÔÅÍÎÁ ÐÏÍÉÌËÁ" + +#: lib/getopt.c:675 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: ËÌÀÞ \"%s\" ÎÅÏÄÎÏÚÎÁÞÎÉÊ\n" + +#: lib/getopt.c:700 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: ËÌÀÞ \"--%s\" ÎÅ ÐÒÉÊÍÁ¤ ÁÒÇÕÍÅÎÔ¦×\n" + +#: lib/getopt.c:705 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: ËÌÀÞ \"%c%s\" ÎÅ ÐÒÉÊÍÁ¤ ÁÒÇÕÍÅÎÔ¦×\n" + +#: lib/getopt.c:723 lib/getopt.c:896 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: ËÌÀÞ \"%s\" ÐÏÔÒÅÂÕ¤ ÁÒÇÕÍÅÎÔ\n" + +#. --option +#: lib/getopt.c:752 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: ÎÅצÄÏÍÉÊ ËÌÀÞ \"--%s\"\n" + +#. +option or -option +#: lib/getopt.c:756 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: ÎÅצÄÏÍÉÊ ËÌÀÞ \"%c%s\"\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:782 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: ÎÅÐÒÁ×ÉÌØÎÉÊ ËÌÀÞ -- %c\n" + +#: lib/getopt.c:785 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: ÎÅÐÒÁ×ÉÌØÎÉÊ ËÌÀÞ -- %c\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:815 lib/getopt.c:945 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: ËÌÀÞ ÐÏÔÒÅÂÕ¤ ÁÒÇÕÍÅÎÔ -- %c\n" + +#: lib/getopt.c:862 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: ËÌÀÞ \"-W %s\" ÎÅÏÄÎÏÚÎÁÞÎÉÊ\n" + +#: lib/getopt.c:880 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: ËÌÀÞ \"-W %s\" ÎÅ ÐÒÉÊÍÁ¤ ÁÒÇÕÍÅÎÔ¦×\n" + +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#: lib/quotearg.c:259 +msgid "`" +msgstr "\"" + +#: lib/quotearg.c:260 +msgid "'" +msgstr "\"" diff --git a/po/vi.po b/po/vi.po new file mode 100644 index 0000000..020daa8 --- /dev/null +++ b/po/vi.po @@ -0,0 +1,404 @@ +# Vietnamese Translation for grep-2.5.1a. +# Copyright (C) 2005 Free Software Foundation, Inc. +# Clytie Siddall , 2005. +# +msgid "" +msgstr "" +"Project-Id-Version: grep 2.5.1a\n" +"Report-Msgid-Bugs-To: bug-grep@gnu.org\n" +"POT-Creation-Date: 2002-03-26 16:38+0100\n" +"PO-Revision-Date: 2005-03-04 14:07+1000\n" +"Last-Translator: Clytie Siddall \n" +"Language-Team: Vietnamese \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: src/dfa.c:136 src/dfa.c:147 src/dfa.c:158 src/search.c:689 +msgid "Memory exhausted" +msgstr "Hết bộ nhó" + +#: src/dfa.c:489 src/dfa.c:492 src/dfa.c:510 src/dfa.c:521 src/dfa.c:545 +#: src/dfa.c:604 src/dfa.c:609 src/dfa.c:622 src/dfa.c:623 src/dfa.c:1001 +#: src/dfa.c:1004 src/dfa.c:1028 src/dfa.c:1032 src/dfa.c:1033 src/dfa.c:1036 +#: src/dfa.c:1048 src/dfa.c:1049 +msgid "Unbalanced [" +msgstr "ChÆ°a cân bằng [" + +#: src/dfa.c:741 +msgid "Unfinished \\ escape" +msgstr "\\ escape chÆ°a xong" + +#. Cases: +#. {M} - exact count +#. {M,} - minimum count, maximum is infinity +#. {M,N} - M through N +#: src/dfa.c:874 src/dfa.c:880 src/dfa.c:890 src/dfa.c:898 src/dfa.c:913 +msgid "unfinished repeat count" +msgstr "việc đếm lần nữa chÆ°a xong" + +#: src/dfa.c:887 src/dfa.c:904 src/dfa.c:912 src/dfa.c:916 +msgid "malformed repeat count" +msgstr "việc đếm lần nữa khuyết tật" + +#: src/dfa.c:1253 +msgid "Unbalanced (" +msgstr "ChÆ°a cân bằng (" + +#: src/dfa.c:1378 +msgid "No syntax specified" +msgstr "ChÆ°a ghi rõ cú pháp nào" + +#: src/dfa.c:1386 +msgid "Unbalanced )" +msgstr "ChÆ°a cân bằng )" + +#: src/dfa.c:2956 +msgid "out of memory" +msgstr "hết bộ nhớ" + +#: src/kwset.c:171 src/kwset.c:177 src/search.c:103 src/search.c:209 +#: src/search.c:293 lib/obstack.c:471 +msgid "memory exhausted" +msgstr "hết bộ nhớ rồi" + +#: src/grep.c:205 +msgid "invalid context length argument" +msgstr "đối số độ dài ngữ cảnh không hợp lệ" + +#: src/grep.c:479 +msgid "input is too large to count" +msgstr "dữ liệu nhập quá lớn để đếm được" + +#: src/grep.c:605 +msgid "writing output" +msgstr "đang ghi dữ liệu xuất" + +#: src/grep.c:878 +#, c-format +msgid "Binary file %s matches\n" +msgstr "Tập tin nhị phân %s khớp với\n" + +#: src/grep.c:892 +msgid "(standard input)" +msgstr "(dữ liệu nhập chuẩn)" + +#: src/grep.c:997 +#, c-format +msgid "warning: %s: %s\n" +msgstr "cảnh báo: %s %s\n" + +#: src/grep.c:998 +msgid "recursive directory loop" +msgstr "vòng lặp thÆ° mục đệ qui" + +#: src/grep.c:1046 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE]...\n" +msgstr "Cách sá»­ dụng: %s [TÙYCHỌN]... MẪU [TẬPTIN]...\n" + +#: src/grep.c:1048 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "Hãy thá»­ lệnh `%s --help' để xem thông tin thêm.\n" + +#: src/grep.c:1053 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE] ...\n" +msgstr "Cách sá»­ dụng: %s [TÙYCHỌN]... MẪU [TẬPTIN]...\n" + +#: src/grep.c:1054 +#, c-format +msgid "" +"Search for PATTERN in each FILE or standard input.\n" +"Example: %s -i 'hello world' menu.h main.c\n" +"\n" +"Regexp selection and interpretation:\n" +msgstr "" +"Tìm kiếm MẪU trong mỗi TẬP TIN hay dữ liệu nhập chuẩn.\n" +"Thí dụ: %s -i 'hello world' menu.h main.c\n" +"\n" +"Cách chọn và giải thích biểu thức chính quy (regex/regexp):\n" + +#: src/grep.c:1059 +msgid "" +" -E, --extended-regexp PATTERN is an extended regular expression\n" +" -F, --fixed-strings PATTERN is a set of newline-separated strings\n" +" -G, --basic-regexp PATTERN is a basic regular expression\n" +" -P, --perl-regexp PATTERN is a Perl regular expression\n" +msgstr "" +" -E, --extended-regexp MẪU là một _biểu thức chính quy mở rộng_\n" +" -F, --fixed-strings MẪU là một bộ _chuỗi_ ngăn cách bằng dòng mới (_cố định_)\n" +" -G, --basic-regexp MẪU là một _biểu thức chính quy cÆ¡ bản_\n" +" -P, --perl-regexp MẪU là một _biểu thức chính quy Perl_\n" + +#: src/grep.c:1064 +msgid "" +" -e, --regexp=PATTERN use PATTERN as a regular expression\n" +" -f, --file=FILE obtain PATTERN from FILE\n" +" -i, --ignore-case ignore case distinctions\n" +" -w, --word-regexp force PATTERN to match only whole words\n" +" -x, --line-regexp force PATTERN to match only whole lines\n" +" -z, --null-data a data line ends in 0 byte, not newline\n" +msgstr "" +" -e, --regexp=MẪU sá»­ dụng MẪU ấy nhÆ° là _biểu thức chính quy_\n" +" -f, --file=TẬP_TIN gọi MẪU từ _TẬP TIN_\n" +" -i, --ignore-case _bỏ qua chữ hoa/thường_\n" +" -w, --word-regexp buộc MẪU khớp với chỉ _từ_ toàn bộ\n" +" -x, --line-regexp buộc MẪU khớp với chỉ _dòng_ toàn bộ\n" +" -z, --null-data dòng _dữ liệu_ kết thúc bằng _0_ byte, không bằng dòng mới\n" + +#: src/grep.c:1071 +msgid "" +"\n" +"Miscellaneous:\n" +" -s, --no-messages suppress error messages\n" +" -v, --invert-match select non-matching lines\n" +" -V, --version print version information and exit\n" +" --help display this help and exit\n" +" --mmap use memory-mapped input if possible\n" +msgstr "" +"\n" +"Lặt vặt:\n" +" -s, --no-messages _không thông báo_ lỗi\n" +" -v, --invert-match chọn dòng không _khớp_ với nhau (_đảo_)\n" +" -V, --version in ra thông tin _phiên bản_ rồi thoát\n" +" --help hiển thị _trợ giúp_ này rồi thoát\n" +" --mmap sá»­ dụng dữ liệu nhập có _bảng bộ nhớ_ nếu có thể\n" + +#: src/grep.c:1079 +msgid "" +"\n" +"Output control:\n" +" -m, --max-count=NUM stop after NUM matches\n" +" -b, --byte-offset print the byte offset with output lines\n" +" -n, --line-number print line number with output lines\n" +" --line-buffered flush output on every line\n" +" -H, --with-filename print the filename for each match\n" +" -h, --no-filename suppress the prefixing filename on output\n" +" --label=LABEL print LABEL as filename for standard input\n" +" -o, --only-matching show only the part of a line matching PATTERN\n" +" -q, --quiet, --silent suppress all normal output\n" +" --binary-files=TYPE assume that binary files are TYPE\n" +" TYPE is 'binary', 'text', or 'without-match'\n" +" -a, --text equivalent to --binary-files=text\n" +" -I equivalent to --binary-files=without-match\n" +" -d, --directories=ACTION how to handle directories\n" +" ACTION is 'read', 'recurse', or 'skip'\n" +" -D, --devices=ACTION how to handle devices, FIFOs and sockets\n" +" ACTION is 'read' or 'skip'\n" +" -R, -r, --recursive equivalent to --directories=recurse\n" +" --include=PATTERN files that match PATTERN will be examined\n" +" --exclude=PATTERN files that match PATTERN will be skipped.\n" +" --exclude-from=FILE files that match PATTERN in FILE will be skipped.\n" +" -L, --files-without-match only print FILE names containing no match\n" +" -l, --files-with-matches only print FILE names containing matches\n" +" -c, --count only print a count of matching lines per FILE\n" +" -Z, --null print 0 byte after FILE name\n" +msgstr "" +"\n" +"Điều khiển dữ liệu xuất:\n" +" -m, --max-count=SỐ ngừng sau đã khớp SỐ lần (_tối đa tổng số_)\n" +" -b, --byte-offset in ra _khoảng chừa trống byte_ với mọi dòng xuất\n" +" -n, --line-number in ra _số dòng_ với mọi dòng xuất\n" +" --line-buffered xóa sạch dữ liệu xuất trên mọi _dòng_ (_đệm_)\n" +" -H, --with-filename in ra _tên_ của mọi _tập tin_ khớp (_có_)\n" +" -h, --no-filename thu hồi _tên tập tin_ tiền tố với dữ liệu xuất (_không_)\n" +" --label=NHÃN in ra NHÃN là tên tập tin cho dữ liệu nhập chuẩn\n" +" -o, --only-matching hiển thị _chỉ_ phần dòng _khớp_ với MẪU\n" +" -q, --quiet, --silent thu hồi tất cả dữ liệu xuất bình thường (_im_)\n" +" --binary-files=LOẠI giả định các _tập tin nhị phân_ có LOẠI ấy\n" +" \t\t\t\t\t\tLOẠI là 'binary' (nhị phân), 'text' (văn bản), \t\t\t\t\t\t\thay 'without-match' (không khớp với gì)\n" +" -a, --text \t\tbằng tùy chọn --binary-files=text\n" +" -I \t\t\tbằng tùy chọn --binary-files=without-match\n" +" -d, --directories=HÀNH_ĐỘNG \tcách xá»­ lý thÆ° mục\n" +" \t\t\t\t\tHÀNH ĐỘNG là 'read' (đọc), 'recurse' (đệ qui), \t\t\t\t\t\t\t\thay 'skip' (bỏ qua)\n" +" -D, --devices=HÀNH_ĐỘNG cách xá»­ lý thiết bị, FIFO (đường ống loại \n" +"\t\t\t\t\t\t\tvào trước nên ra trước) và ổ cắm\n" +" \t\t\t\tHÀNH ĐỘNG là 'read' (đọc) hay 'skip' (bỏ qua)\n" +" -R, -r, --recursive \tbằng tùy chọn --directories=recurse\n" +" --include=MẪU \t\tsẽ khám xét mọi tập tin khớp với MẪU (_bao gồm_)\n" +" --exclude=MẪU \t\tsẽ bỏ qua mọi tập tin khớp với MẪU (_loại trừ_)\n" +" --exclude-from=TẬPTIN sẽ bỏ qua mọi tập tin khớp với MẪU trong TẬP TIN\n" +"\t\t\t\t\t\t\t(_loại trừ ... ra_)\n" +" -L, --files-without-match chỉ in ra tên _TẬP TIN không khớp với gì_\n" +" -l, --files-with-matches chỉ in ra tên _TẬP TIN khớp với gì_\n" +" -c, --count \t\tchỉ in ra một _tổng số_ dòng khớp của mỗi TẬP TIN\n" +" -Z, --null \t\tin ra _0_ byte sau tên TẬP TIN\n" + +#: src/grep.c:1107 +msgid "" +"\n" +"Context control:\n" +" -B, --before-context=NUM print NUM lines of leading context\n" +" -A, --after-context=NUM print NUM lines of trailing context\n" +" -C, --context=NUM print NUM lines of output context\n" +" -NUM same as --context=NUM\n" +" --color[=WHEN],\n" +" --colour[=WHEN] use markers to distinguish the matching string\n" +" WHEN may be `always', `never' or `auto'.\n" +" -U, --binary do not strip CR characters at EOL (MSDOS)\n" +" -u, --unix-byte-offsets report offsets as if CRs were not there (MSDOS)\n" +"\n" +"`egrep' means `grep -E'. `fgrep' means `grep -F'.\n" +"With no FILE, or when FILE is -, read standard input. If less than\n" +"two FILEs given, assume -h. Exit status is 0 if match, 1 if no match,\n" +"and 2 if trouble.\n" +msgstr "" +"\n" +"Điều khiển ngữ cảnh:\n" +" -B, --before-context=SỐ \t\tin ra SỐ dòng của _ngữ cảnh_ đi _trước_\n" +" -A, --after-context=SỐ \t\tin ra SỐ dòng của _ngữ cảnh_ theo _sau_\n" +" -C, --context=SỐ \t\tin ra SỐ dòng của _ngữ cảnh_ xuất\n" +" -SỐ \t\t\tbằng --context=SỐ\n" +" --color[=KHI_NÀO],\t\t(chính tả Mỹ) --colour[=KHI_NÀO] \t(chính tả Anh, Úc)\t\t\t\t\t\t\tsá»­ dụng dấu khác để phân biệt chuỗi khớp\n" +" \t\t\t\t\tKHI NÀO có thể là `always' (luôn luôn),\n" +"\t\t\t\t\t\t\t`never' (không bao giờ) hay `auto' (tá»± động).\n" +" -U, --binary \t\t\tkhông tước ký tá»± về đầu dòng (CR) ở đầu cuối \n" +"\t\t\t\t\t\t\t\tdòng (EOL) (MSDOS)\n" +" -u, --unix-byte-offsets \tthông báo khoảng chừa trống nhÆ° thế ký tá»± về \n" +"\t\t\t\t\t\t\tđầu dòng (CR) không ở đó (MSDOS)\n" +"\n" +"`egrep' có nghÄ©a `grep -E'.\n" +"`fgrep' có nghÄ©a `grep -F'.\n" +"Khi không có TẬP TIN nào, hoặc khi TẬP TIN là -, thì hãy đọc dữ liệu nhập chuẩn. \n" +"Nếu ít hÆ¡n hai TẬP TIN đưa ra, hãy giả định -h.\n" +" Trạng thái thoát là 0 nếu có khớp gì, 1 nếu không khớp gì, và 2 nếu gặp khó nào.\n" + +#: src/grep.c:1124 +msgid "" +"\n" +"Report bugs to .\n" +msgstr "" +"\n" +"Báo cáo lỗi nào cho .\n" + +#: src/grep.c:1134 +msgid "conflicting matchers specified" +msgstr "đã ghi rõ dữ liệu khớp mà xung đột" + +#: src/grep.c:1376 +msgid "unknown devices method" +msgstr "không biết cách thức thiết bị" + +#: src/grep.c:1443 +msgid "unknown directories method" +msgstr "không biết cách thức thÆ° mục" + +#: src/grep.c:1510 +msgid "invalid max count" +msgstr "tối đa tổng số không hợp lệ" + +#: src/grep.c:1565 +msgid "unknown binary-files type" +msgstr "không biết loại tập tin nhị phân" + +#: src/grep.c:1660 +#, c-format +msgid "%s (GNU grep) %s\n" +msgstr "%s (trình grep của GNU) %s\n" + +#: src/grep.c:1662 +msgid "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" +msgstr "Bản quyền năm 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc. (Tổ chức Phần mềm Tá»± do)\n" + +#: src/grep.c:1664 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"Phần mềm này tá»± do; hãy xem mã nguồn để tìm thấy điều kiện sao chép.\n" +"Không bảo đảm gì cả, dù khả năng bán hay khả năng làm việc dứt khoát.\n" + +#: src/search.c:606 +msgid "The -P option is not supported" +msgstr "ChÆ°a hỗ trợ tùy chọn -P" + +#: src/search.c:619 +msgid "The -P and -z options cannot be combined" +msgstr "Không kết hợp được hai tùy chọn -P và -z" + +#: lib/error.c:117 +msgid "Unknown system error" +msgstr "Gặp lỗi hệ thống không biết" + +#: lib/getopt.c:675 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: tùy chọn `%s' là mÆ¡ hồ\n" + +#: lib/getopt.c:700 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: tùy chọn `--%s' không cho phép đối số\n" + +#: lib/getopt.c:705 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: tùy chọn `%c%s' không cho phép đối sô\n" + +#: lib/getopt.c:723 lib/getopt.c:896 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: tùy chọn `%s' cần đến đối số\n" + +#. --option +#: lib/getopt.c:752 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: chÆ°a chấp nhận tùy chọn `--%s'\n" + +#. +option or -option +#: lib/getopt.c:756 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: chÆ°a chấp nhận tùy chọn `%c%s'\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:782 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: không cho phép tùy chọn -- %c\n" + +#: lib/getopt.c:785 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: tùy chọn không hợp lệ -- %c\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:815 lib/getopt.c:945 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: tùy chọn cần đến đối số -- %c\n" + +#: lib/getopt.c:862 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: tùy chọn `-W %s' là mÆ¡ hồ\n" + +#: lib/getopt.c:880 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: tùy chọn `-W %s' không cho phép đối số\n" + +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#: lib/quotearg.c:259 +msgid "`" +msgstr "«" + +#: lib/quotearg.c:260 +msgid "'" +msgstr "»" diff --git a/po/zh_TW.po b/po/zh_TW.po new file mode 100644 index 0000000..bb9b915 --- /dev/null +++ b/po/zh_TW.po @@ -0,0 +1,399 @@ +# Triditional Chinese Translatino of grep +# Copyright (C) 2004 Free Software Foundation, Inc. +# Yuan-Chen Cheng , 2004. +# +msgid "" +msgstr "" +"Project-Id-Version: grep 2.5g\n" +"POT-Creation-Date: 2002-03-26 16:38+0100\n" +"PO-Revision-Date: 2004-12-01 01:01+0800\n" +"Last-Translator: Yuan-Chen Cheng \n" +"Language-Team: Chinese (traditional) \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=big5\n" +"Content-Transfer-Encoding: 8bit\n" + +#: src/dfa.c:136 src/dfa.c:147 src/dfa.c:158 src/search.c:689 +msgid "Memory exhausted" +msgstr "°O¾ÐÅé¥ÎºÉ" + +#: src/dfa.c:489 src/dfa.c:492 src/dfa.c:510 src/dfa.c:521 src/dfa.c:545 +#: src/dfa.c:604 src/dfa.c:609 src/dfa.c:622 src/dfa.c:623 src/dfa.c:1001 +#: src/dfa.c:1004 src/dfa.c:1028 src/dfa.c:1032 src/dfa.c:1033 src/dfa.c:1036 +#: src/dfa.c:1048 src/dfa.c:1049 +msgid "Unbalanced [" +msgstr "¥¼¦¨¹ïªº [" + +#: src/dfa.c:741 +msgid "Unfinished \\ escape" +msgstr "¥¼¥¿½Tµ²§ôªº \\ ¶h¥X" + +#. Cases: +#. {M} - exact count +#. {M,} - minimum count, maximum is infinity +#. {M,N} - M through N +#: src/dfa.c:874 src/dfa.c:880 src/dfa.c:890 src/dfa.c:898 src/dfa.c:913 +msgid "unfinished repeat count" +msgstr "¥¼§¹¦¨ªº­«½Æ­p¦¸" + +#: src/dfa.c:887 src/dfa.c:904 src/dfa.c:912 src/dfa.c:916 +msgid "malformed repeat count" +msgstr "®æ¦¡¿ù»~ªº­«½Æ¦¸¼Æ" + +#: src/dfa.c:1253 +msgid "Unbalanced (" +msgstr "¥¼°t¹ïªº (" + +#: src/dfa.c:1378 +msgid "No syntax specified" +msgstr "¨Ã¥¼«ü©w»yªk" + +#: src/dfa.c:1386 +msgid "Unbalanced )" +msgstr "¥¼°t¹ïªº )" + +#: src/dfa.c:2956 +msgid "out of memory" +msgstr "°O¾ÐÅé¥ÎºÉ" + +#: src/kwset.c:171 src/kwset.c:177 src/search.c:103 src/search.c:209 +#: src/search.c:293 lib/obstack.c:471 +msgid "memory exhausted" +msgstr "°O¾ÐÅé¥ÎºÉ" + +#: src/grep.c:205 +msgid "invalid context length argument" +msgstr "µL®Äªºªø«×¤Þ¼Æ" + +#: src/grep.c:479 +msgid "input is too large to count" +msgstr "¿é¤J¹LªøµLªk­p¼Æ" + +#: src/grep.c:605 +msgid "writing output" +msgstr "¥¿¦b¿é¥X" + +#: src/grep.c:878 +#, c-format +msgid "Binary file %s matches\n" +msgstr "¤G¶i¦ì®æ¦¡ÀÉ®× %s ²Å¦X\n" + +#: src/grep.c:892 +msgid "(standard input)" +msgstr "(¼Ð·Ç¿é¤J)" + +#: src/grep.c:997 +#, c-format +msgid "warning: %s: %s\n" +msgstr "ĵ§i: %s: %s\n" + +#: src/grep.c:998 +msgid "recursive directory loop" +msgstr "»¼°jªº¥Ø¿ýµ²ºc" + +#: src/grep.c:1046 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE]...\n" +msgstr "¥Îªk: %s [¿ï¶µ]... ¼ËªO [ÀÉ®×]...\n" + +#: src/grep.c:1048 +#, c-format +msgid "Try `%s --help' for more information.\n" +msgstr "½Ð¨Ï¥Î `%s --help' ¥H¾\Ū§ó¦hªº¸ê°T.\n" + +#: src/grep.c:1053 +#, c-format +msgid "Usage: %s [OPTION]... PATTERN [FILE] ...\n" +msgstr "¥Îªk: %s [¿ï¶µ]... ¼ËªO [ÀÉ®×]...\n" + +#: src/grep.c:1054 +#, c-format +msgid "" +"Search for PATTERN in each FILE or standard input.\n" +"Example: %s -i 'hello world' menu.h main.c\n" +"\n" +"Regexp selection and interpretation:\n" +msgstr "" +"¦b¦U­ÓÀɮשάO¼Ð·Ç¿é¤J¤¤§ä´M¼ËªO.\n" +"¨Ò¦p: %s -i 'hello world' menu.h main.c\n" +"\n" +"¥¿³W¿ï¶µ¥H¤Î¸ÑĶ:\n" + +#: src/grep.c:1059 +msgid "" +" -E, --extended-regexp PATTERN is an extended regular expression\n" +" -F, --fixed-strings PATTERN is a set of newline-separated strings\n" +" -G, --basic-regexp PATTERN is a basic regular expression\n" +" -P, --perl-regexp PATTERN is a Perl regular expression\n" +msgstr "" +" -E, --extended-regexp PATTERN ¬O¤@­Ó©µ¦ùªº¥¿³Wªí¥Ü¦¡\n" +" -F, --fixed-strings PATTERN ¬O¤@²Õ¥H´«¦æ¤À¹jªº¦r¦ê\n" +" -G, --basic-regexp PATTERN ¬O¤@­Ó°ò¥»ªº¥¿³Wªí¥Ü¦¡\n" +" -P, --perl-regexp PATTERN ¬O¤@­Ó Perl ªº¥¿³Wªí¥Ü¦¡\n" + +#: src/grep.c:1064 +msgid "" +" -e, --regexp=PATTERN use PATTERN as a regular expression\n" +" -f, --file=FILE obtain PATTERN from FILE\n" +" -i, --ignore-case ignore case distinctions\n" +" -w, --word-regexp force PATTERN to match only whole words\n" +" -x, --line-regexp force PATTERN to match only whole lines\n" +" -z, --null-data a data line ends in 0 byte, not newline\n" +msgstr "" +" -e, --regexp=PATTERN ¥H PATTERN ¬°¥¿³Wªí¥Ü¦¡\n" +" -f, --file=FILE ¥H FILE ¤º®e¨ú±o¼ËªO (PATTERN)\n" +" -i, --ignore-case ©¿²¤¤j¤p¼g®t²§\n" +" -w, --word-regexp ¥H¼ËªO(PATTERN)§ä´M®É, ¥u°t¹ï³æ¦r¦Ó«D³æ¦r¤¤¤ù¬q\n" +" -x, --line-regexp ¥H¼ËªO(PATTERN)§ä´M®É, «ü°t¹ï¤@¾ã¦æ¦Ó«D¤ù¬q\n" +" -z, --null-data ¨C¦æ¸ê®Æ¥H 0 ³o­Ó¦ì¤¸µ²§ô, ¦Ó«D´«¦æ²Å¸¹\n" + +#: src/grep.c:1071 +msgid "" +"\n" +"Miscellaneous:\n" +" -s, --no-messages suppress error messages\n" +" -v, --invert-match select non-matching lines\n" +" -V, --version print version information and exit\n" +" --help display this help and exit\n" +" --mmap use memory-mapped input if possible\n" +msgstr "" +"\n" +"¨ä¥L°Ñ¼Æ:\n" +" -s, --no-messages ¤£Åã¥Ü¿ù»~°T®§\n" +" -v, --invert-match ¦C¥X¤£¬Û²Å¸ê®Æ¦æ\n" +" -V, --version ¦L¥Xª©¥»¸ê°T«áµ²§ô\n" +" --help Åã¥Ü¦¹¨Ï¥Î¤èªk«áµ²§ô\n" +" --mmap ¦pªG¤¹³\, ¿é¤JÀɮרϥΰO¾ÐÅé¹ïÀ³ªk\n" + +#: src/grep.c:1079 +msgid "" +"\n" +"Output control:\n" +" -m, --max-count=NUM stop after NUM matches\n" +" -b, --byte-offset print the byte offset with output lines\n" +" -n, --line-number print line number with output lines\n" +" --line-buffered flush output on every line\n" +" -H, --with-filename print the filename for each match\n" +" -h, --no-filename suppress the prefixing filename on output\n" +" --label=LABEL print LABEL as filename for standard input\n" +" -o, --only-matching show only the part of a line matching PATTERN\n" +" -q, --quiet, --silent suppress all normal output\n" +" --binary-files=TYPE assume that binary files are TYPE\n" +" TYPE is 'binary', 'text', or 'without-match'\n" +" -a, --text equivalent to --binary-files=text\n" +" -I equivalent to --binary-files=without-match\n" +" -d, --directories=ACTION how to handle directories\n" +" ACTION is 'read', 'recurse', or 'skip'\n" +" -D, --devices=ACTION how to handle devices, FIFOs and sockets\n" +" ACTION is 'read' or 'skip'\n" +" -R, -r, --recursive equivalent to --directories=recurse\n" +" --include=PATTERN files that match PATTERN will be examined\n" +" --exclude=PATTERN files that match PATTERN will be skipped.\n" +" --exclude-from=FILE files that match PATTERN in FILE will be skipped.\n" +" -L, --files-without-match only print FILE names containing no match\n" +" -l, --files-with-matches only print FILE names containing matches\n" +" -c, --count only print a count of matching lines per FILE\n" +" -Z, --null print 0 byte after FILE name\n" +msgstr "" +"\n" +"¿é¥X±±¨î:\n" +" -m, --max-count=NUM ¦bÅã¥Ü NUM ­Óµ²ªG«á°±¤î\n" +" -b, --byte-offset ¥uÅã¥Ü¦X¥G±ø¥ó¸ê®Æ¥H byte ¬°°O¼Æ³æ¦ìªº¦ì¸m\n" +" -n, --line-number ¥uÅã¥Ü¦X¥G±ø¥óªº¦æ¦C½s¸¹\n" +" --line-buffered ¨C¤@¦æ¿é¥X«á³£¥ß§YÅã¥Ü\n" +" -H, --with-filename ¨C¦æµ²ªG³£¦L¥XÀɮצWºÙ\n" +" -h, --no-filename ¿é¥X®É¤£Åã¥Ü«e¸mªºÀɮצWºÙ\n" +" --label=LABEL ¹ï©ó¼Ð·Ç¿é¤J, ¦bÅã¥ÜÀɦW³BÅã¥Ü LABEL\n" +" -o, --only-matching ¥uÅã¥Ü¤@¦æ¸ê®Æ¤¤»P¼ËªO±ø¥ó¬Û²Åªº³¡¤À\n" +" -q, --quiet, --silent Ãö³¬©Ò¦³¤@¯ë¿é¥Xªº\n" +" --binary-files=TYPE ³]©w¤G¶i¦ìÀɮ׫¬§O¬° TYPE\n" +" TYPE ¬O 'binary', 'text', ©Î 'without-match' ¤§¤@\n" +" -a, --text µ¥¦P©ó --binary-files=text\n" +" -I µ¥¦P©ó --binary-files=without-match\n" +" -d, --directories=ACTION ³B²z¥Ø¿ýªº¤è¦¡\n" +" ACTION ¬O 'read', 'recurse', ©Î 'skip' ¤§¤@\n" +" -D, --devices=ACTION ³B²z¸Ë¸mÀÉ®×, FIFO ¥H¤Î socket ªº¤è¦¡\n" +" ACTION ¬O 'read' ©Î 'skip'¤§¤@\n" +" -R, -r, --recursive µ¥¦P©ó --directories=recurse\n" +" --include=PATTERN ÀɦW»P PATTERN ¬Û²Åªº±N·|³QÀËÅç\n" +" --exclude=PATTERN ÀɦW»P PATTERN ¬Û²Åªº±N·|³Q²¤¹L\n" +" --exclude-from=FILE ÀɦW»P FILE Àɮפ¤ªº PATTERN ¬Û²Åªº±N·|³Q²¤¹L\n" +" -L, --files-without-match ¥u¦C¥X§ä¤£¨ì¬Û²ÅªºÀɮצWºÙ\n" +" -l, --files-with-matches ¥u¦C¥X¦³µo²{»P¼ËªO¬Û²ÅªºÀÉ®×\n" +" -c, --count ¥u°w¹ï¨CªºÀɮצC¥X¸ÓÀɮ׬۲ŭӼÆ\n" +" -Z, --null ¦bÀɦW¤§«á¿é¥X¤@­Ó­È¬° 0 ªº¦ì¤¸\n" + +#: src/grep.c:1107 +msgid "" +"\n" +"Context control:\n" +" -B, --before-context=NUM print NUM lines of leading context\n" +" -A, --after-context=NUM print NUM lines of trailing context\n" +" -C, --context=NUM print NUM lines of output context\n" +" -NUM same as --context=NUM\n" +" --color[=WHEN],\n" +" --colour[=WHEN] use markers to distinguish the matching string\n" +" WHEN may be `always', `never' or `auto'.\n" +" -U, --binary do not strip CR characters at EOL (MSDOS)\n" +" -u, --unix-byte-offsets report offsets as if CRs were not there (MSDOS)\n" +"\n" +"`egrep' means `grep -E'. `fgrep' means `grep -F'.\n" +"With no FILE, or when FILE is -, read standard input. If less than\n" +"two FILEs given, assume -h. Exit status is 0 if match, 1 if no match,\n" +"and 2 if trouble.\n" +msgstr "" +"\n" +"¤W¤U¤åª¬ºA±±¨î:\n" +" -B, --before-context=NUM ¦L¥X¬Û²Å¤å¦r¦æ«e­±ªº NUM ¦æ¤å¦r\n" +" -A, --after-context=NUM ¦L¥X¬Û²Å¤å¦r¦æ«á­±ªº NUM ¦æ¤å¦r\n" +" -C, --context=NUM ¦L¥X¬Û²Å¤å¦r¦æ«e«áªº NUM ¦æ¤å¦r\n" +" -NUM »P --context=NUM ¬Û¦P\n" +" --color[=WHEN],\n" +" --colour[=WHEN] ¨Ï¥Î¼Ð°O¨Ó¬ðÅã§ä¨ìªº¦r¦ê\n" +" WHEN ¥i¥H¬O `always', `never' ©Î `auto'.\n" +" -U, --binary ¤£­n§R¥h¦b EOL ¤§«áªº CR ¦r¤¸ (MSDOS)\n" +" -u, --unix-byte-offsets ¦b¦^³ø¦ì²¾­È®É, ©¿²¤ CR ¦r¤¸ªº¦ì²¾¼Æ¥Ø (MSDOS)\n" +"\n" +"`egrep' ¥Nªí `grep -E'. `fgrep' ¥Nªí `grep -F'.\n" +"·í¨S¦³´£¨Ñ FILE, ©Î¬O FILE ¬O -, «h±qªí·Ç¿é¤JŪ¨ú¸ê®Æ. ¦pªG©Ò´£¨ÑªºÀÉ®×\n" +"¤Ö©ó¨â®æ, «h³]©w¬° -h °Ñ¼Æ¦³¿é¤J. °²³]¦³§ä¨ì¸ê®Æ, µ{¦¡¦^¶Çª¬ºA¬° 0, §_«h\n" +"¶Ç¦^ 1, ¦pªGµ{¦¡°õ¦æ¤¤¥X²{¿ù»~, «h¶Ç¦^ 2.\n" + +#: src/grep.c:1124 +#, fuzzy +msgid "" +"\n" +"Report bugs to .\n" +msgstr "" +"\n" +"½Ð±Nµo²{ªº¿ù»~¡A¥H¹q¤l¶l¥ó±H¨ì \n" + +#: src/grep.c:1134 +msgid "conflicting matchers specified" +msgstr "«ü©w¤F¤¬¬Û½Ä¬ðªº¼ËªO" + +#: src/grep.c:1376 +msgid "unknown devices method" +msgstr "¥¼ª¾ªº¸Ë¸m¤èªk" + +#: src/grep.c:1443 +msgid "unknown directories method" +msgstr "¥¼ª¾ªº¥Ø¿ý¤èªk" + +#: src/grep.c:1510 +msgid "invalid max count" +msgstr "µL®Äªº³Ì¤j­p¦¸" + +#: src/grep.c:1565 +msgid "unknown binary-files type" +msgstr "¥¼ª¾ªº¤G¶i¦ìÀɮ׫¬ºA" + +#: src/grep.c:1660 +#, c-format +msgid "%s (GNU grep) %s\n" +msgstr "%s (GNU grep) %s\n" + +#: src/grep.c:1662 +msgid "Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.\n" +msgstr "ª©Åv©Ò¦³ 1988, 1992-1999, 2000, 2001 ¦Û¥Ñ³nÅé°òª÷·|.\n" + +#: src/grep.c:1664 +msgid "" +"This is free software; see the source for copying conditions. There is NO\n" +"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" +msgstr "" +"³o­Óµ{¦¡¬O¦Û¥Ñ³nÅé; ½Ð°Ñ¾\¨äª©Åv±ø´Ú. ¦¹³nÅé¨S¦³\n" +"¨S¦³¥ô¦ó«Oµý; ¤]¨S¦³¥ô¦ó«Oµý¥¦¨Ï¥Î©ó¬Y¤@¯S©w¥Øªº.\n" + +#: src/search.c:606 +msgid "The -P option is not supported" +msgstr "¨Ã¤£¤ä´©°Ñ¼Æ -P" + +#: src/search.c:619 +msgid "The -P and -z options cannot be combined" +msgstr "°Ñ¼Æ -P ¥H¤Î °Ñ¼Æ -z ¨Ã¤£¯àµ²¦X¨Ï¥Î" + +#: lib/error.c:117 +msgid "Unknown system error" +msgstr "¥¼ª¾ªº¨t²Î¿ù»~" + +#: lib/getopt.c:675 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: ¿ï¶µ `%s' ¬O¼Ò½kªº\n" + +#: lib/getopt.c:700 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: ¿ï¶µ `--%s' ¤§«á¤£¤¹³\ªþ¥[¥ô¦ó°Ñ¼Æ\n" + +#: lib/getopt.c:705 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: ¿ï¶µ `%c%s' ¤§«á¤£¤¹³\ªþ¥[¥ô¦ó°Ñ¼Æ\n" + +#: lib/getopt.c:723 lib/getopt.c:896 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: ¿ï¶µ `%s' ¤§«á»Ý­n¤@­Ó°Ñ¼Æ\n" + +#. --option +#: lib/getopt.c:752 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: µLªk¿ëÃѪº¿ï¶µ `--%s'\n" + +#. +option or -option +#: lib/getopt.c:756 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: µLªk¿ëÃѪº¿ï¶µ `%c%s'\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:782 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s; ¤£¾A¥Îªº¿ï¶µ -- %c\n" + +#: lib/getopt.c:785 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: µL®Äªº¿ï¶µ -- %c\n" + +#. 1003.2 specifies the format of this message. +#: lib/getopt.c:815 lib/getopt.c:945 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: ¿ï¶µ»Ý­n¤@­Ó°Ñ¼Æ -- %c\n" + +#: lib/getopt.c:862 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: ¿ï¶µ `-W %s' ¬O¼Ò½kªº\n" + +#: lib/getopt.c:880 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: xxxx `-W %s' ¨Ã¤£»Ý­n°Ñ¼Æ\n" + +#. Get translations for open and closing quotation marks. +#. +#. The message catalog should translate "`" to a left +#. quotation mark suitable for the locale, and similarly for +#. "'". If the catalog has no translation, +#. locale_quoting_style quotes `like this', and +#. clocale_quoting_style quotes "like this". +#. +#. For example, an American English Unicode locale should +#. translate "`" to U+201C (LEFT DOUBLE QUOTATION MARK), and +#. should translate "'" to U+201D (RIGHT DOUBLE QUOTATION +#. MARK). A British English Unicode locale should instead +#. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and +#. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. +#: lib/quotearg.c:259 +msgid "`" +msgstr "`" + +#: lib/quotearg.c:260 +msgid "'" +msgstr "'" diff --git a/src/.cvsignore b/src/.cvsignore new file mode 100644 index 0000000..6bb0a52 --- /dev/null +++ b/src/.cvsignore @@ -0,0 +1,5 @@ +Makefile +Makefile.in +egrep +fgrep +grep diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..d68117b --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,19 @@ +## Process this file with automake to create Makefile.in +AUTOMAKE_OPTIONS = ansi2knr + +LN = ln + +bin_PROGRAMS = grep egrep fgrep +grep_SOURCES = grep.c search.c kwset.c dfa.c +egrep_SOURCES = egrep.c esearch.c kwset.c dfa.c +fgrep_SOURCES = fgrep.c fsearch.c kwset.c +noinst_HEADERS = grep.h dfa.h kwset.h getpagesize.h system.h mbsupport.h + +LDADD = @INTLLIBS@ ../lib/libgreputils.a +datadir = $(prefix)/@DATADIRNAME@ +localedir = $(datadir)/locale +INCLUDES = -I../intl -I$(top_srcdir)/lib -DLOCALEDIR=\"$(localedir)\" + +EXTRA_DIST = \ + dosbuf.c \ + vms_fab.c vms_fab.h diff --git a/src/Makefile.in b/src/Makefile.in new file mode 100644 index 0000000..e453ed4 --- /dev/null +++ b/src/Makefile.in @@ -0,0 +1,523 @@ +# Makefile.in generated by automake 1.10 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +ANSI2KNR = @ANSI2KNR@ +bin_PROGRAMS = grep$(EXEEXT) egrep$(EXEEXT) fgrep$(EXEEXT) +subdir = src +DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in ansi2knr.1 ansi2knr.c +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/codeset.m4 \ + $(top_srcdir)/m4/decl.m4 $(top_srcdir)/m4/djgpp.m4 \ + $(top_srcdir)/m4/dosfile.m4 $(top_srcdir)/m4/envsep.m4 \ + $(top_srcdir)/m4/error.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/header.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/inttypes_h.m4 \ + $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/largefile.m4 \ + $(top_srcdir)/m4/lcmessage.m4 $(top_srcdir)/m4/malloc.m4 \ + $(top_srcdir)/m4/mbstate_t.m4 $(top_srcdir)/m4/missing.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/realloc.m4 \ + $(top_srcdir)/m4/regex.m4 $(top_srcdir)/m4/sanity.m4 \ + $(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/ulonglong.m4 \ + $(top_srcdir)/m4/xstrtoumax.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +am__installdirs = "$(DESTDIR)$(bindir)" +binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +PROGRAMS = $(bin_PROGRAMS) +am_egrep_OBJECTS = egrep$U.$(OBJEXT) esearch$U.$(OBJEXT) \ + kwset$U.$(OBJEXT) dfa$U.$(OBJEXT) +egrep_OBJECTS = $(am_egrep_OBJECTS) +egrep_LDADD = $(LDADD) +egrep_DEPENDENCIES = ../lib/libgreputils.a +am_fgrep_OBJECTS = fgrep$U.$(OBJEXT) fsearch$U.$(OBJEXT) \ + kwset$U.$(OBJEXT) +fgrep_OBJECTS = $(am_fgrep_OBJECTS) +fgrep_LDADD = $(LDADD) +fgrep_DEPENDENCIES = ../lib/libgreputils.a +am_grep_OBJECTS = grep$U.$(OBJEXT) search$U.$(OBJEXT) \ + kwset$U.$(OBJEXT) dfa$U.$(OBJEXT) +grep_OBJECTS = $(am_grep_OBJECTS) +grep_LDADD = $(LDADD) +grep_DEPENDENCIES = ../lib/libgreputils.a +DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@ +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(egrep_SOURCES) $(fgrep_SOURCES) $(grep_SOURCES) +DIST_SOURCES = $(egrep_SOURCES) $(fgrep_SOURCES) $(grep_SOURCES) +HEADERS = $(noinst_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GENCAT = @GENCAT@ +GETCONF = @GETCONF@ +GLIBC21 = @GLIBC21@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLBISON = @INTLBISON@ +INTLLIBS = @INTLLIBS@ +INTLOBJS = @INTLOBJS@ +INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +POFILES = @POFILES@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SEP = @SEP@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +U = @U@ +USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = $(prefix)/@DATADIRNAME@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = $(datadir)/locale +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AUTOMAKE_OPTIONS = ansi2knr +LN = ln +grep_SOURCES = grep.c search.c kwset.c dfa.c +egrep_SOURCES = egrep.c esearch.c kwset.c dfa.c +fgrep_SOURCES = fgrep.c fsearch.c kwset.c +noinst_HEADERS = grep.h dfa.h kwset.h getpagesize.h system.h mbsupport.h +LDADD = @INTLLIBS@ ../lib/libgreputils.a +INCLUDES = -I../intl -I$(top_srcdir)/lib -DLOCALEDIR=\"$(localedir)\" +EXTRA_DIST = \ + dosbuf.c \ + vms_fab.c vms_fab.h + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ + $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ + rm -f "$(DESTDIR)$(bindir)/$$f"; \ + done + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) +egrep$(EXEEXT): $(egrep_OBJECTS) $(egrep_DEPENDENCIES) + @rm -f egrep$(EXEEXT) + $(LINK) $(egrep_OBJECTS) $(egrep_LDADD) $(LIBS) +fgrep$(EXEEXT): $(fgrep_OBJECTS) $(fgrep_DEPENDENCIES) + @rm -f fgrep$(EXEEXT) + $(LINK) $(fgrep_OBJECTS) $(fgrep_LDADD) $(LIBS) +grep$(EXEEXT): $(grep_OBJECTS) $(grep_DEPENDENCIES) + @rm -f grep$(EXEEXT) + $(LINK) $(grep_OBJECTS) $(grep_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c +./ansi2knr: ansi2knr.$(OBJEXT) + $(LINK) ansi2knr.$(OBJEXT) $(LIBS) +ansi2knr.$(OBJEXT): $(CONFIG_HEADER) + +clean-krextra: + -rm -f ansi2knr + +mostlyclean-kr: + -test "$U" = "" || rm -f *_.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dfa$U.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/egrep$U.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/esearch$U.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fgrep$U.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fsearch$U.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/grep$U.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kwset$U.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/search$U.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` +dfa_.c: dfa.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/dfa.c; then echo $(srcdir)/dfa.c; else echo dfa.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +egrep_.c: egrep.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/egrep.c; then echo $(srcdir)/egrep.c; else echo egrep.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +esearch_.c: esearch.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/esearch.c; then echo $(srcdir)/esearch.c; else echo esearch.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +fgrep_.c: fgrep.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fgrep.c; then echo $(srcdir)/fgrep.c; else echo fgrep.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +fsearch_.c: fsearch.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fsearch.c; then echo $(srcdir)/fsearch.c; else echo fsearch.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +grep_.c: grep.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/grep.c; then echo $(srcdir)/grep.c; else echo grep.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +kwset_.c: kwset.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/kwset.c; then echo $(srcdir)/kwset.c; else echo kwset.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +search_.c: search.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/search.c; then echo $(srcdir)/search.c; else echo search.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +dfa_.$(OBJEXT) egrep_.$(OBJEXT) esearch_.$(OBJEXT) fgrep_.$(OBJEXT) \ +fsearch_.$(OBJEXT) grep_.$(OBJEXT) kwset_.$(OBJEXT) search_.$(OBJEXT) \ +: $(ANSI2KNR) + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(ANSI2KNR) $(PROGRAMS) $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(bindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic clean-krextra mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-exec-am: install-binPROGRAMS + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic clean-krextra ctags distclean distclean-compile \ + distclean-generic distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-binPROGRAMS \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-kr pdf pdf-am ps ps-am tags \ + uninstall uninstall-am uninstall-binPROGRAMS + +# 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. +.NOEXPORT: diff --git a/src/ansi2knr.1 b/src/ansi2knr.1 new file mode 100644 index 0000000..f9ee5a6 --- /dev/null +++ b/src/ansi2knr.1 @@ -0,0 +1,36 @@ +.TH ANSI2KNR 1 "19 Jan 1996" +.SH NAME +ansi2knr \- convert ANSI C to Kernighan & Ritchie C +.SH SYNOPSIS +.I ansi2knr +[--varargs] input_file [output_file] +.SH DESCRIPTION +If no output_file is supplied, output goes to stdout. +.br +There are no error messages. +.sp +.I ansi2knr +recognizes function definitions by seeing a non-keyword identifier at the left +margin, followed by a left parenthesis, with a right parenthesis as the last +character on the line, and with a left brace as the first token on the +following line (ignoring possible intervening comments). It will recognize a +multi-line header provided that no intervening line ends with a left or right +brace or a semicolon. These algorithms ignore whitespace and comments, except +that the function name must be the first thing on the line. +.sp +The following constructs will confuse it: +.br + - Any other construct that starts at the left margin and follows the +above syntax (such as a macro or function call). +.br + - Some macros that tinker with the syntax of the function header. +.sp +The --varargs switch is obsolete, and is recognized only for +backwards compatibility. The present version of +.I ansi2knr +will always attempt to convert a ... argument to va_alist and va_dcl. +.SH AUTHOR +L. Peter Deutsch wrote the original ansi2knr and +continues to maintain the current version; most of the code in the current +version is his work. ansi2knr also includes contributions by Francois +Pinard and Jim Avera . diff --git a/src/ansi2knr.c b/src/ansi2knr.c new file mode 100644 index 0000000..24b6366 --- /dev/null +++ b/src/ansi2knr.c @@ -0,0 +1,678 @@ +/* Copyright (C) 1989, 1997, 1998, 1999 Aladdin Enterprises. All rights reserved. */ + +/*$Id: ansi2knr.c,v 1.1 2000/01/21 00:54:15 alainm Exp $*/ +/* Convert ANSI C function definitions to K&R ("traditional C") syntax */ + +/* +ansi2knr is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY. No author or distributor accepts responsibility to anyone for the +consequences of using it or for whether it serves any particular purpose or +works at all, unless he says so in writing. Refer to the GNU General Public +License (the "GPL") for full details. + +Everyone is granted permission to copy, modify and redistribute ansi2knr, +but only under the conditions described in the GPL. A copy of this license +is supposed to have been given to you along with ansi2knr so you can know +your rights and responsibilities. It should be in a file named COPYLEFT, +or, if there is no file named COPYLEFT, a file named COPYING. Among other +things, the copyright notice and this notice must be preserved on all +copies. + +We explicitly state here what we believe is already implied by the GPL: if +the ansi2knr program is distributed as a separate set of sources and a +separate executable file which are aggregated on a storage medium together +with another program, this in itself does not bring the other program under +the GPL, nor does the mere fact that such a program or the procedures for +constructing it invoke the ansi2knr executable bring any other part of the +program under the GPL. +*/ + +/* + * Usage: + ansi2knr [--filename FILENAME] [INPUT_FILE [OUTPUT_FILE]] + * --filename provides the file name for the #line directive in the output, + * overriding input_file (if present). + * If no input_file is supplied, input is read from stdin. + * If no output_file is supplied, output goes to stdout. + * There are no error messages. + * + * ansi2knr recognizes function definitions by seeing a non-keyword + * identifier at the left margin, followed by a left parenthesis, + * with a right parenthesis as the last character on the line, + * and with a left brace as the first token on the following line + * (ignoring possible intervening comments), except that a line + * consisting of only + * identifier1(identifier2) + * will not be considered a function definition unless identifier2 is + * the word "void", and a line consisting of + * identifier1(identifier2, <>) + * will not be considered a function definition. + * ansi2knr will recognize a multi-line header provided + * that no intervening line ends with a left or right brace or a semicolon. + * These algorithms ignore whitespace and comments, except that + * the function name must be the first thing on the line. + * The following constructs will confuse it: + * - Any other construct that starts at the left margin and + * follows the above syntax (such as a macro or function call). + * - Some macros that tinker with the syntax of function headers. + */ + +/* + * The original and principal author of ansi2knr is L. Peter Deutsch + * . Other authors are noted in the change history + * that follows (in reverse chronological order): + lpd 1999-04-12 added minor fixes from Pavel Roskin + for clean compilation with + gcc -W -Wall + lpd 1999-03-22 added hack to recognize lines consisting of + identifier1(identifier2, xxx) as *not* being procedures + lpd 1999-02-03 made indentation of preprocessor commands consistent + lpd 1999-01-28 fixed two bugs: a '/' in an argument list caused an + endless loop; quoted strings within an argument list + confused the parser + lpd 1999-01-24 added a check for write errors on the output, + suggested by Jim Meyering + lpd 1998-11-09 added further hack to recognize identifier(void) + as being a procedure + lpd 1998-10-23 added hack to recognize lines consisting of + identifier1(identifier2) as *not* being procedures + lpd 1997-12-08 made input_file optional; only closes input and/or + output file if not stdin or stdout respectively; prints + usage message on stderr rather than stdout; adds + --filename switch (changes suggested by + ) + lpd 1996-01-21 added code to cope with not HAVE_CONFIG_H and with + compilers that don't understand void, as suggested by + Tom Lane + lpd 1996-01-15 changed to require that the first non-comment token + on the line following a function header be a left brace, + to reduce sensitivity to macros, as suggested by Tom Lane + + lpd 1995-06-22 removed #ifndefs whose sole purpose was to define + undefined preprocessor symbols as 0; changed all #ifdefs + for configuration symbols to #ifs + lpd 1995-04-05 changed copyright notice to make it clear that + including ansi2knr in a program does not bring the entire + program under the GPL + lpd 1994-12-18 added conditionals for systems where ctype macros + don't handle 8-bit characters properly, suggested by + Francois Pinard ; + removed --varargs switch (this is now the default) + lpd 1994-10-10 removed CONFIG_BROKETS conditional + lpd 1994-07-16 added some conditionals to help GNU `configure', + suggested by Francois Pinard ; + properly erase prototype args in function parameters, + contributed by Jim Avera ; + correct error in writeblanks (it shouldn't erase EOLs) + lpd 1989-xx-xx original version + */ + +/* Most of the conditionals here are to make ansi2knr work with */ +/* or without the GNU configure machinery. */ + +#if HAVE_CONFIG_H +# include +#endif + +#include +#include + +#if HAVE_CONFIG_H + +/* + For properly autoconfiguring ansi2knr, use AC_CONFIG_HEADER(config.h). + This will define HAVE_CONFIG_H and so, activate the following lines. + */ + +# if STDC_HEADERS || HAVE_STRING_H +# include +# else +# include +# endif + +#else /* not HAVE_CONFIG_H */ + +/* Otherwise do it the hard way */ + +# ifdef BSD +# include +# else +# ifdef VMS + extern int strlen(), strncmp(); +# else +# include +# endif +# endif + +#endif /* not HAVE_CONFIG_H */ + +#if STDC_HEADERS +# include +#else +/* + malloc and free should be declared in stdlib.h, + but if you've got a K&R compiler, they probably aren't. + */ +# ifdef MSDOS +# include +# else +# ifdef VMS + extern char *malloc(); + extern void free(); +# else + extern char *malloc(); + extern int free(); +# endif +# endif + +#endif + +/* Define NULL (for *very* old compilers). */ +#ifndef NULL +# define NULL (0) +#endif + +/* + * The ctype macros don't always handle 8-bit characters correctly. + * Compensate for this here. + */ +#ifdef isascii +# undef HAVE_ISASCII /* just in case */ +# define HAVE_ISASCII 1 +#else +#endif +#if STDC_HEADERS || !HAVE_ISASCII +# define is_ascii(c) 1 +#else +# define is_ascii(c) isascii(c) +#endif + +#define is_space(c) (is_ascii(c) && isspace(c)) +#define is_alpha(c) (is_ascii(c) && isalpha(c)) +#define is_alnum(c) (is_ascii(c) && isalnum(c)) + +/* Scanning macros */ +#define isidchar(ch) (is_alnum(ch) || (ch) == '_') +#define isidfirstchar(ch) (is_alpha(ch) || (ch) == '_') + +/* Forward references */ +char *skipspace(); +char *scanstring(); +int writeblanks(); +int test1(); +int convert1(); + +/* The main program */ +int +main(argc, argv) + int argc; + char *argv[]; +{ FILE *in = stdin; + FILE *out = stdout; + char *filename = 0; + char *program_name = argv[0]; + char *output_name = 0; +#define bufsize 5000 /* arbitrary size */ + char *buf; + char *line; + char *more; + char *usage = + "Usage: ansi2knr [--filename FILENAME] [INPUT_FILE [OUTPUT_FILE]]\n"; + /* + * In previous versions, ansi2knr recognized a --varargs switch. + * If this switch was supplied, ansi2knr would attempt to convert + * a ... argument to va_alist and va_dcl; if this switch was not + * supplied, ansi2knr would simply drop any such arguments. + * Now, ansi2knr always does this conversion, and we only + * check for this switch for backward compatibility. + */ + int convert_varargs = 1; + int output_error; + + while ( argc > 1 && argv[1][0] == '-' ) { + if ( !strcmp(argv[1], "--varargs") ) { + convert_varargs = 1; + argc--; + argv++; + continue; + } + if ( !strcmp(argv[1], "--filename") && argc > 2 ) { + filename = argv[2]; + argc -= 2; + argv += 2; + continue; + } + fprintf(stderr, "%s: Unrecognized switch: %s\n", program_name, + argv[1]); + fprintf(stderr, usage); + exit(1); + } + switch ( argc ) + { + default: + fprintf(stderr, usage); + exit(0); + case 3: + output_name = argv[2]; + out = fopen(output_name, "w"); + if ( out == NULL ) { + fprintf(stderr, "%s: Cannot open output file %s\n", + program_name, output_name); + exit(1); + } + /* falls through */ + case 2: + in = fopen(argv[1], "r"); + if ( in == NULL ) { + fprintf(stderr, "%s: Cannot open input file %s\n", + program_name, argv[1]); + exit(1); + } + if ( filename == 0 ) + filename = argv[1]; + /* falls through */ + case 1: + break; + } + if ( filename ) + fprintf(out, "#line 1 \"%s\"\n", filename); + buf = malloc(bufsize); + if ( buf == NULL ) + { + fprintf(stderr, "Unable to allocate read buffer!\n"); + exit(1); + } + line = buf; + while ( fgets(line, (unsigned)(buf + bufsize - line), in) != NULL ) + { +test: line += strlen(line); + switch ( test1(buf) ) + { + case 2: /* a function header */ + convert1(buf, out, 1, convert_varargs); + break; + case 1: /* a function */ + /* Check for a { at the start of the next line. */ + more = ++line; +f: if ( line >= buf + (bufsize - 1) ) /* overflow check */ + goto wl; + if ( fgets(line, (unsigned)(buf + bufsize - line), in) == NULL ) + goto wl; + switch ( *skipspace(more, 1) ) + { + case '{': + /* Definitely a function header. */ + convert1(buf, out, 0, convert_varargs); + fputs(more, out); + break; + case 0: + /* The next line was blank or a comment: */ + /* keep scanning for a non-comment. */ + line += strlen(line); + goto f; + default: + /* buf isn't a function header, but */ + /* more might be. */ + fputs(buf, out); + strcpy(buf, more); + line = buf; + goto test; + } + break; + case -1: /* maybe the start of a function */ + if ( line != buf + (bufsize - 1) ) /* overflow check */ + continue; + /* falls through */ + default: /* not a function */ +wl: fputs(buf, out); + break; + } + line = buf; + } + if ( line != buf ) + fputs(buf, out); + free(buf); + if ( output_name ) { + output_error = ferror(out); + output_error |= fclose(out); + } else { /* out == stdout */ + fflush(out); + output_error = ferror(out); + } + if ( output_error ) { + fprintf(stderr, "%s: error writing to %s\n", program_name, + (output_name ? output_name : "stdout")); + exit(1); + } + if ( in != stdin ) + fclose(in); + return 0; +} + +/* Skip over whitespace and comments, in either direction. */ +char * +skipspace(p, dir) + register char *p; + register int dir; /* 1 for forward, -1 for backward */ +{ for ( ; ; ) + { while ( is_space(*p) ) + p += dir; + if ( !(*p == '/' && p[dir] == '*') ) + break; + p += dir; p += dir; + while ( !(*p == '*' && p[dir] == '/') ) + { if ( *p == 0 ) + return p; /* multi-line comment?? */ + p += dir; + } + p += dir; p += dir; + } + return p; +} + +/* Scan over a quoted string, in either direction. */ +char * +scanstring(p, dir) + register char *p; + register int dir; +{ + for (p += dir; ; p += dir) + if (*p == '"' && p[-dir] != '\\') + return p + dir; +} + +/* + * Write blanks over part of a string. + * Don't overwrite end-of-line characters. + */ +int +writeblanks(start, end) + char *start; + char *end; +{ char *p; + for ( p = start; p < end; p++ ) + if ( *p != '\r' && *p != '\n' ) + *p = ' '; + return 0; +} + +/* + * Test whether the string in buf is a function definition. + * The string may contain and/or end with a newline. + * Return as follows: + * 0 - definitely not a function definition; + * 1 - definitely a function definition; + * 2 - definitely a function prototype (NOT USED); + * -1 - may be the beginning of a function definition, + * append another line and look again. + * The reason we don't attempt to convert function prototypes is that + * Ghostscript's declaration-generating macros look too much like + * prototypes, and confuse the algorithms. + */ +int +test1(buf) + char *buf; +{ register char *p = buf; + char *bend; + char *endfn; + int contin; + + if ( !isidfirstchar(*p) ) + return 0; /* no name at left margin */ + bend = skipspace(buf + strlen(buf) - 1, -1); + switch ( *bend ) + { + case ';': contin = 0 /*2*/; break; + case ')': contin = 1; break; + case '{': return 0; /* not a function */ + case '}': return 0; /* not a function */ + default: contin = -1; + } + while ( isidchar(*p) ) + p++; + endfn = p; + p = skipspace(p, 1); + if ( *p++ != '(' ) + return 0; /* not a function */ + p = skipspace(p, 1); + if ( *p == ')' ) + return 0; /* no parameters */ + /* Check that the apparent function name isn't a keyword. */ + /* We only need to check for keywords that could be followed */ + /* by a left parenthesis (which, unfortunately, is most of them). */ + { static char *words[] = + { "asm", "auto", "case", "char", "const", "double", + "extern", "float", "for", "if", "int", "long", + "register", "return", "short", "signed", "sizeof", + "static", "switch", "typedef", "unsigned", + "void", "volatile", "while", 0 + }; + char **key = words; + char *kp; + unsigned len = endfn - buf; + + while ( (kp = *key) != 0 ) + { if ( strlen(kp) == len && !strncmp(kp, buf, len) ) + return 0; /* name is a keyword */ + key++; + } + } + { + char *id = p; + int len; + /* + * Check for identifier1(identifier2) and not + * identifier1(void), or identifier1(identifier2, xxxx). + */ + + while ( isidchar(*p) ) + p++; + len = p - id; + p = skipspace(p, 1); + if (*p == ',' || + (*p == ')' && (len != 4 || strncmp(id, "void", 4))) + ) + return 0; /* not a function */ + } + /* + * If the last significant character was a ), we need to count + * parentheses, because it might be part of a formal parameter + * that is a procedure. + */ + if (contin > 0) { + int level = 0; + + for (p = skipspace(buf, 1); *p; p = skipspace(p + 1, 1)) + level += (*p == '(' ? 1 : *p == ')' ? -1 : 0); + if (level > 0) + contin = -1; + } + return contin; +} + +/* Convert a recognized function definition or header to K&R syntax. */ +int +convert1(buf, out, header, convert_varargs) + char *buf; + FILE *out; + int header; /* Boolean */ + int convert_varargs; /* Boolean */ +{ char *endfn; + register char *p; + /* + * The breaks table contains pointers to the beginning and end + * of each argument. + */ + char **breaks; + unsigned num_breaks = 2; /* for testing */ + char **btop; + char **bp; + char **ap; + char *vararg = 0; + + /* Pre-ANSI implementations don't agree on whether strchr */ + /* is called strchr or index, so we open-code it here. */ + for ( endfn = buf; *(endfn++) != '('; ) + ; +top: p = endfn; + breaks = (char **)malloc(sizeof(char *) * num_breaks * 2); + if ( breaks == NULL ) + { /* Couldn't allocate break table, give up */ + fprintf(stderr, "Unable to allocate break table!\n"); + fputs(buf, out); + return -1; + } + btop = breaks + num_breaks * 2 - 2; + bp = breaks; + /* Parse the argument list */ + do + { int level = 0; + char *lp = NULL; + char *rp = NULL; + char *end = NULL; + + if ( bp >= btop ) + { /* Filled up break table. */ + /* Allocate a bigger one and start over. */ + free((char *)breaks); + num_breaks <<= 1; + goto top; + } + *bp++ = p; + /* Find the end of the argument */ + for ( ; end == NULL; p++ ) + { switch(*p) + { + case ',': + if ( !level ) end = p; + break; + case '(': + if ( !level ) lp = p; + level++; + break; + case ')': + if ( --level < 0 ) end = p; + else rp = p; + break; + case '/': + if (p[1] == '*') + p = skipspace(p, 1) - 1; + break; + case '"': + p = scanstring(p, 1) - 1; + break; + default: + ; + } + } + /* Erase any embedded prototype parameters. */ + if ( lp && rp ) + writeblanks(lp + 1, rp); + p--; /* back up over terminator */ + /* Find the name being declared. */ + /* This is complicated because of procedure and */ + /* array modifiers. */ + for ( ; ; ) + { p = skipspace(p - 1, -1); + switch ( *p ) + { + case ']': /* skip array dimension(s) */ + case ')': /* skip procedure args OR name */ + { int level = 1; + while ( level ) + switch ( *--p ) + { + case ']': case ')': + level++; + break; + case '[': case '(': + level--; + break; + case '/': + if (p > buf && p[-1] == '*') + p = skipspace(p, -1) + 1; + break; + case '"': + p = scanstring(p, -1) + 1; + break; + default: ; + } + } + if ( *p == '(' && *skipspace(p + 1, 1) == '*' ) + { /* We found the name being declared */ + while ( !isidfirstchar(*p) ) + p = skipspace(p, 1) + 1; + goto found; + } + break; + default: + goto found; + } + } +found: if ( *p == '.' && p[-1] == '.' && p[-2] == '.' ) + { if ( convert_varargs ) + { *bp++ = "va_alist"; + vararg = p-2; + } + else + { p++; + if ( bp == breaks + 1 ) /* sole argument */ + writeblanks(breaks[0], p); + else + writeblanks(bp[-1] - 1, p); + bp--; + } + } + else + { while ( isidchar(*p) ) p--; + *bp++ = p+1; + } + p = end; + } + while ( *p++ == ',' ); + *bp = p; + /* Make a special check for 'void' arglist */ + if ( bp == breaks+2 ) + { p = skipspace(breaks[0], 1); + if ( !strncmp(p, "void", 4) ) + { p = skipspace(p+4, 1); + if ( p == breaks[2] - 1 ) + { bp = breaks; /* yup, pretend arglist is empty */ + writeblanks(breaks[0], p + 1); + } + } + } + /* Put out the function name and left parenthesis. */ + p = buf; + while ( p != endfn ) putc(*p, out), p++; + /* Put out the declaration. */ + if ( header ) + { fputs(");", out); + for ( p = breaks[0]; *p; p++ ) + if ( *p == '\r' || *p == '\n' ) + putc(*p, out); + } + else + { for ( ap = breaks+1; ap < bp; ap += 2 ) + { p = *ap; + while ( isidchar(*p) ) + putc(*p, out), p++; + if ( ap < bp - 1 ) + fputs(", ", out); + } + fputs(") ", out); + /* Put out the argument declarations */ + for ( ap = breaks+2; ap <= bp; ap += 2 ) + (*ap)[-1] = ';'; + if ( vararg != 0 ) + { *vararg = 0; + fputs(breaks[0], out); /* any prior args */ + fputs("va_dcl", out); /* the final arg */ + fputs(bp[0], out); + } + else + fputs(breaks[0], out); + } + free((char *)breaks); + return 0; +} diff --git a/src/dfa.c b/src/dfa.c new file mode 100644 index 0000000..25f5388 --- /dev/null +++ b/src/dfa.c @@ -0,0 +1,3635 @@ +/* dfa.c - deterministic extended regexp routines for GNU + Copyright 1988, 1998, 2000, 2002, 2004 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., + 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA */ + +/* Written June, 1988 by Mike Haertel + Modified July, 1988 by Arthur David Olson to assist BMG speedups */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include + +#ifndef VMS +#include +#else +#include +#endif +#ifdef STDC_HEADERS +#include +#else +extern char *calloc(), *malloc(), *realloc(); +extern void free(); +#endif + +#if defined(HAVE_STRING_H) || defined(STDC_HEADERS) +#include +#else +#include +#endif + +#if HAVE_SETLOCALE +# include +#endif + + +#ifndef DEBUG /* use the same approach as regex.c */ +#undef assert +#define assert(e) +#endif /* DEBUG */ + +#ifndef isgraph +#define isgraph(C) (isprint(C) && !isspace(C)) +#endif + +#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII)) +#define ISALPHA(C) isalpha(C) +#define ISUPPER(C) isupper(C) +#define ISLOWER(C) islower(C) +#define ISDIGIT(C) isdigit(C) +#define ISXDIGIT(C) isxdigit(C) +#define ISSPACE(C) isspace(C) +#define ISPUNCT(C) ispunct(C) +#define ISALNUM(C) isalnum(C) +#define ISPRINT(C) isprint(C) +#define ISGRAPH(C) isgraph(C) +#define ISCNTRL(C) iscntrl(C) +#else +#define ISALPHA(C) (isascii(C) && isalpha(C)) +#define ISUPPER(C) (isascii(C) && isupper(C)) +#define ISLOWER(C) (isascii(C) && islower(C)) +#define ISDIGIT(C) (isascii(C) && isdigit(C)) +#define ISXDIGIT(C) (isascii(C) && isxdigit(C)) +#define ISSPACE(C) (isascii(C) && isspace(C)) +#define ISPUNCT(C) (isascii(C) && ispunct(C)) +#define ISALNUM(C) (isascii(C) && isalnum(C)) +#define ISPRINT(C) (isascii(C) && isprint(C)) +#define ISGRAPH(C) (isascii(C) && isgraph(C)) +#define ISCNTRL(C) (isascii(C) && iscntrl(C)) +#endif + +/* ISASCIIDIGIT differs from ISDIGIT, as follows: + - Its arg may be any int or unsigned int; it need not be an unsigned char. + - It's guaranteed to evaluate its argument exactly once. + - It's typically faster. + Posix 1003.2-1992 section 2.5.2.1 page 50 lines 1556-1558 says that + only '0' through '9' are digits. Prefer ISASCIIDIGIT to ISDIGIT unless + it's important to use the locale's definition of `digit' even when the + host does not conform to Posix. */ +#define ISASCIIDIGIT(c) ((unsigned) (c) - '0' <= 9) + +/* Don't use gettext if ENABLE_NLS is not defined */ +/* If we (don't) have I18N. */ +/* glibc defines _ */ +#ifdef ENABLE_NLS +# ifndef _ +# ifdef HAVE_LIBINTL_H +# include +# ifndef _ +# define _(Str) gettext (Str) +# endif +# endif +# endif +#endif +#ifndef _ +# define _(Str) (Str) +#endif + +#include "mbsupport.h" /* defines MBS_SUPPORT if appropriate */ +#ifdef MBS_SUPPORT +/* We can handle multibyte strings. */ +# include +# include +#endif + +#include "regex.h" +#include "dfa.h" +#include "hard-locale.h" + +/* HPUX, define those as macros in sys/param.h */ +#ifdef setbit +# undef setbit +#endif +#ifdef clrbit +# undef clrbit +#endif + +static void dfamust PARAMS ((struct dfa *dfa)); + +static ptr_t xcalloc PARAMS ((size_t n, size_t s)); +static ptr_t xmalloc PARAMS ((size_t n)); +static ptr_t xrealloc PARAMS ((ptr_t p, size_t n)); +#ifdef DEBUG +static void prtok PARAMS ((token t)); +#endif +static int tstbit PARAMS ((unsigned b, charclass c)); +static void setbit PARAMS ((unsigned b, charclass c)); +static void clrbit PARAMS ((unsigned b, charclass c)); +static void copyset PARAMS ((charclass src, charclass dst)); +static void zeroset PARAMS ((charclass s)); +static void notset PARAMS ((charclass s)); +static int equal PARAMS ((charclass s1, charclass s2)); +static int charclass_index PARAMS ((charclass s)); +static int looking_at PARAMS ((const char *s)); +static token lex PARAMS ((void)); +static void addtok PARAMS ((token t)); +static void atom PARAMS ((void)); +static int nsubtoks PARAMS ((int tindex)); +static void copytoks PARAMS ((int tindex, int ntokens)); +static void closure PARAMS ((void)); +static void branch PARAMS ((void)); +static void regexp PARAMS ((int toplevel)); +static void copy PARAMS ((position_set const *src, position_set *dst)); +static void insert PARAMS ((position p, position_set *s)); +static void merge PARAMS ((position_set const *s1, position_set const *s2, position_set *m)); +static void delete PARAMS ((position p, position_set *s)); +static int state_index PARAMS ((struct dfa *d, position_set const *s, + int newline, int letter)); +static void build_state PARAMS ((int s, struct dfa *d)); +static void build_state_zero PARAMS ((struct dfa *d)); +static char *icatalloc PARAMS ((char *old, char *new)); +static char *icpyalloc PARAMS ((char *string)); +static char *istrstr PARAMS ((char *lookin, char *lookfor)); +static void ifree PARAMS ((char *cp)); +static void freelist PARAMS ((char **cpp)); +static char **enlist PARAMS ((char **cpp, char *new, size_t len)); +static char **comsubs PARAMS ((char *left, char *right)); +static char **addlists PARAMS ((char **old, char **new)); +static char **inboth PARAMS ((char **left, char **right)); + +static ptr_t +xcalloc (size_t n, size_t s) +{ + ptr_t r = calloc(n, s); + + if (!r) + dfaerror(_("Memory exhausted")); + return r; +} + +static ptr_t +xmalloc (size_t n) +{ + ptr_t r = malloc(n); + + assert(n != 0); + if (!r) + dfaerror(_("Memory exhausted")); + return r; +} + +static ptr_t +xrealloc (ptr_t p, size_t n) +{ + ptr_t r = realloc(p, n); + + assert(n != 0); + if (!r) + dfaerror(_("Memory exhausted")); + return r; +} + +#define CALLOC(p, t, n) ((p) = (t *) xcalloc((size_t)(n), sizeof (t))) +#define MALLOC(p, t, n) ((p) = (t *) xmalloc((n) * sizeof (t))) +#define REALLOC(p, t, n) ((p) = (t *) xrealloc((ptr_t) (p), (n) * sizeof (t))) + +/* Reallocate an array of type t if nalloc is too small for index. */ +#define REALLOC_IF_NECESSARY(p, t, nalloc, index) \ + if ((index) >= (nalloc)) \ + { \ + do \ + (nalloc) *= 2; \ + while ((index) >= (nalloc)); \ + REALLOC(p, t, nalloc); \ + } + +#ifdef DEBUG + +static void +prtok (token t) +{ + char const *s; + + if (t < 0) + fprintf(stderr, "END"); + else if (t < NOTCHAR) + fprintf(stderr, "%c", t); + else + { + switch (t) + { + case EMPTY: s = "EMPTY"; break; + case BACKREF: s = "BACKREF"; break; + case BEGLINE: s = "BEGLINE"; break; + case ENDLINE: s = "ENDLINE"; break; + case BEGWORD: s = "BEGWORD"; break; + case ENDWORD: s = "ENDWORD"; break; + case LIMWORD: s = "LIMWORD"; break; + case NOTLIMWORD: s = "NOTLIMWORD"; break; + case QMARK: s = "QMARK"; break; + case STAR: s = "STAR"; break; + case PLUS: s = "PLUS"; break; + case CAT: s = "CAT"; break; + case OR: s = "OR"; break; + case ORTOP: s = "ORTOP"; break; + case LPAREN: s = "LPAREN"; break; + case RPAREN: s = "RPAREN"; break; + case CRANGE: s = "CRANGE"; break; +#ifdef MBS_SUPPORT + case ANYCHAR: s = "ANYCHAR"; break; + case MBCSET: s = "MBCSET"; break; +#endif /* MBS_SUPPORT */ + default: s = "CSET"; break; + } + fprintf(stderr, "%s", s); + } +} +#endif /* DEBUG */ + +/* Stuff pertaining to charclasses. */ + +static int +tstbit (unsigned b, charclass c) +{ + return c[b / INTBITS] & 1 << b % INTBITS; +} + +static void +setbit (unsigned b, charclass c) +{ + c[b / INTBITS] |= 1 << b % INTBITS; +} + +static void +clrbit (unsigned b, charclass c) +{ + c[b / INTBITS] &= ~(1 << b % INTBITS); +} + +static void +copyset (charclass src, charclass dst) +{ + memcpy (dst, src, sizeof (charclass)); +} + +static void +zeroset (charclass s) +{ + memset (s, 0, sizeof (charclass)); +} + +static void +notset (charclass s) +{ + int i; + + for (i = 0; i < CHARCLASS_INTS; ++i) + s[i] = ~s[i]; +} + +static int +equal (charclass s1, charclass s2) +{ + return memcmp (s1, s2, sizeof (charclass)) == 0; +} + +/* A pointer to the current dfa is kept here during parsing. */ +static struct dfa *dfa; + +/* Find the index of charclass s in dfa->charclasses, or allocate a new charclass. */ +static int +charclass_index (charclass s) +{ + int i; + + for (i = 0; i < dfa->cindex; ++i) + if (equal(s, dfa->charclasses[i])) + return i; + REALLOC_IF_NECESSARY(dfa->charclasses, charclass, dfa->calloc, dfa->cindex); + ++dfa->cindex; + copyset(s, dfa->charclasses[i]); + return i; +} + +/* Syntax bits controlling the behavior of the lexical analyzer. */ +static reg_syntax_t syntax_bits, syntax_bits_set; + +/* Flag for case-folding letters into sets. */ +static int case_fold; + +/* End-of-line byte in data. */ +static unsigned char eolbyte; + +/* Entry point to set syntax options. */ +void +dfasyntax (reg_syntax_t bits, int fold, unsigned char eol) +{ + syntax_bits_set = 1; + syntax_bits = bits; + case_fold = fold; + eolbyte = eol; +} + +/* Like setbit, but if case is folded, set both cases of a letter. */ +static void +setbit_case_fold (unsigned b, charclass c) +{ + setbit (b, c); + if (case_fold) + { + if (ISUPPER (b)) + setbit (tolower (b), c); + else if (ISLOWER (b)) + setbit (toupper (b), c); + } +} + +/* Lexical analyzer. All the dross that deals with the obnoxious + GNU Regex syntax bits is located here. The poor, suffering + reader is referred to the GNU Regex documentation for the + meaning of the @#%!@#%^!@ syntax bits. */ + +static char const *lexptr; /* Pointer to next input character. */ +static int lexleft; /* Number of characters remaining. */ +static token lasttok; /* Previous token returned; initially END. */ +static int laststart; /* True if we're separated from beginning or (, | + only by zero-width characters. */ +static int parens; /* Count of outstanding left parens. */ +static int minrep, maxrep; /* Repeat counts for {m,n}. */ +static int hard_LC_COLLATE; /* Nonzero if LC_COLLATE is hard. */ + +#ifdef MBS_SUPPORT +/* These variables are used only if (MB_CUR_MAX > 1). */ +static mbstate_t mbs; /* Mbstate for mbrlen(). */ +static int cur_mb_len; /* Byte length of the current scanning + multibyte character. */ +static int cur_mb_index; /* Byte index of the current scanning multibyte + character. + + single byte character : cur_mb_index = 0 + multibyte character + 1st byte : cur_mb_index = 1 + 2nd byte : cur_mb_index = 2 + ... + nth byte : cur_mb_index = n */ +static unsigned char *mblen_buf;/* Correspond to the input buffer in dfaexec(). + Each element store the amount of remain + byte of corresponding multibyte character + in the input string. A element's value + is 0 if corresponding character is a + single byte chracter. + e.g. input : 'a', , , + mblen_buf : 0, 3, 2, 1 + */ +static wchar_t *inputwcs; /* Wide character representation of input + string in dfaexec(). + The length of this array is same as + the length of input string(char array). + inputstring[i] is a single-byte char, + or 1st byte of a multibyte char. + And inputwcs[i] is the codepoint. */ +static unsigned char const *buf_begin; /* reference to begin in dfaexec(). */ +static unsigned char const *buf_end; /* reference to end in dfaexec(). */ +#endif /* MBS_SUPPORT */ + +#ifdef MBS_SUPPORT +/* This function update cur_mb_len, and cur_mb_index. + p points current lexptr, len is the remaining buffer length. */ +static void +update_mb_len_index (unsigned char const *p, int len) +{ + /* If last character is a part of a multibyte character, + we update cur_mb_index. */ + if (cur_mb_index) + cur_mb_index = (cur_mb_index >= cur_mb_len)? 0 + : cur_mb_index + 1; + + /* If last character is a single byte character, or the + last portion of a multibyte character, we check whether + next character is a multibyte character or not. */ + if (! cur_mb_index) + { + cur_mb_len = mbrlen(p, len, &mbs); + if (cur_mb_len > 1) + /* It is a multibyte character. + cur_mb_len was already set by mbrlen(). */ + cur_mb_index = 1; + else if (cur_mb_len < 1) + /* Invalid sequence. We treat it as a single byte character. + cur_mb_index is aleady 0. */ + cur_mb_len = 1; + /* Otherwise, cur_mb_len == 1, it is a single byte character. + cur_mb_index is aleady 0. */ + } +} +#endif /* MBS_SUPPORT */ + +#ifdef MBS_SUPPORT +/* Note that characters become unsigned here. */ +# define FETCH(c, eoferr) \ + { \ + if (! lexleft) \ + { \ + if (eoferr != 0) \ + dfaerror (eoferr); \ + else \ + return lasttok = END; \ + } \ + if (MB_CUR_MAX > 1) \ + update_mb_len_index(lexptr, lexleft); \ + (c) = (unsigned char) *lexptr++; \ + --lexleft; \ + } + +/* This function fetch a wide character, and update cur_mb_len, + used only if the current locale is a multibyte environment. */ +static wint_t +fetch_wc (char const *eoferr) +{ + wchar_t wc; + if (! lexleft) + { + if (eoferr != 0) + dfaerror (eoferr); + else + return WEOF; + } + + cur_mb_len = mbrtowc(&wc, lexptr, lexleft, &mbs); + if (cur_mb_len <= 0) + { + cur_mb_len = 1; + wc = *lexptr; + } + lexptr += cur_mb_len; + lexleft -= cur_mb_len; + return wc; +} +#else +/* Note that characters become unsigned here. */ +# define FETCH(c, eoferr) \ + { \ + if (! lexleft) \ + { \ + if (eoferr != 0) \ + dfaerror (eoferr); \ + else \ + return lasttok = END; \ + } \ + (c) = (unsigned char) *lexptr++; \ + --lexleft; \ + } +#endif /* MBS_SUPPORT */ + +#ifdef MBS_SUPPORT +/* Multibyte character handling sub-routine for lex. + This function parse a bracket expression and build a struct + mb_char_classes. */ +static void +parse_bracket_exp_mb () +{ + wint_t wc, wc1, wc2; + + /* Work area to build a mb_char_classes. */ + struct mb_char_classes *work_mbc; + int chars_al, range_sts_al, range_ends_al, ch_classes_al, + equivs_al, coll_elems_al; + + REALLOC_IF_NECESSARY(dfa->mbcsets, struct mb_char_classes, + dfa->mbcsets_alloc, dfa->nmbcsets + 1); + /* dfa->multibyte_prop[] hold the index of dfa->mbcsets. + We will update dfa->multibyte_prop[] in addtok(), because we can't + decide the index in dfa->tokens[]. */ + + /* Initialize work are */ + work_mbc = &(dfa->mbcsets[dfa->nmbcsets++]); + + chars_al = 1; + range_sts_al = range_ends_al = 0; + ch_classes_al = equivs_al = coll_elems_al = 0; + MALLOC(work_mbc->chars, wchar_t, chars_al); + + work_mbc->nchars = work_mbc->nranges = work_mbc->nch_classes = 0; + work_mbc->nequivs = work_mbc->ncoll_elems = 0; + work_mbc->chars = NULL; + work_mbc->ch_classes = NULL; + work_mbc->range_sts = work_mbc->range_ends = NULL; + work_mbc->equivs = work_mbc->coll_elems = NULL; + + wc = fetch_wc(_("Unbalanced [")); + if (wc == L'^') + { + wc = fetch_wc(_("Unbalanced [")); + work_mbc->invert = 1; + } + else + work_mbc->invert = 0; + do + { + wc1 = WEOF; /* mark wc1 is not initialized". */ + + /* Note that if we're looking at some other [:...:] construct, + we just treat it as a bunch of ordinary characters. We can do + this because we assume regex has checked for syntax errors before + dfa is ever called. */ + if (wc == L'[' && (syntax_bits & RE_CHAR_CLASSES)) + { +#define BRACKET_BUFFER_SIZE 128 + char str[BRACKET_BUFFER_SIZE]; + wc1 = wc; + wc = fetch_wc(_("Unbalanced [")); + + /* If pattern contains `[[:', `[[.', or `[[='. */ + if (cur_mb_len == 1 && (wc == L':' || wc == L'.' || wc == L'=')) + { + unsigned char c; + unsigned char delim = (unsigned char)wc; + int len = 0; + for (;;) + { + if (! lexleft) + dfaerror (_("Unbalanced [")); + c = (unsigned char) *lexptr++; + --lexleft; + + if ((c == delim && *lexptr == ']') || lexleft == 0) + break; + if (len < BRACKET_BUFFER_SIZE) + str[len++] = c; + else + /* This is in any case an invalid class name. */ + str[0] = '\0'; + } + str[len] = '\0'; + + if (lexleft == 0) + { + REALLOC_IF_NECESSARY(work_mbc->chars, wchar_t, chars_al, + work_mbc->nchars + 2); + work_mbc->chars[work_mbc->nchars++] = L'['; + work_mbc->chars[work_mbc->nchars++] = delim; + break; + } + + if (--lexleft, *lexptr++ != ']') + dfaerror (_("Unbalanced [")); + if (delim == ':') + /* build character class. */ + { + wctype_t wt; + /* Query the character class as wctype_t. */ + wt = wctype (str); + + if (ch_classes_al == 0) + MALLOC(work_mbc->ch_classes, wctype_t, ++ch_classes_al); + REALLOC_IF_NECESSARY(work_mbc->ch_classes, wctype_t, + ch_classes_al, + work_mbc->nch_classes + 1); + work_mbc->ch_classes[work_mbc->nch_classes++] = wt; + + } + else if (delim == '=' || delim == '.') + { + char *elem; + MALLOC(elem, char, len + 1); + strncpy(elem, str, len + 1); + + if (delim == '=') + /* build equivalent class. */ + { + if (equivs_al == 0) + MALLOC(work_mbc->equivs, char*, ++equivs_al); + REALLOC_IF_NECESSARY(work_mbc->equivs, char*, + equivs_al, + work_mbc->nequivs + 1); + work_mbc->equivs[work_mbc->nequivs++] = elem; + } + + if (delim == '.') + /* build collating element. */ + { + if (coll_elems_al == 0) + MALLOC(work_mbc->coll_elems, char*, ++coll_elems_al); + REALLOC_IF_NECESSARY(work_mbc->coll_elems, char*, + coll_elems_al, + work_mbc->ncoll_elems + 1); + work_mbc->coll_elems[work_mbc->ncoll_elems++] = elem; + } + } + wc1 = wc = WEOF; + } + else + /* We treat '[' as a normal character here. */ + { + wc2 = wc1; wc1 = wc; wc = wc2; /* swap */ + } + } + else + { + if (wc == L'\\' && (syntax_bits & RE_BACKSLASH_ESCAPE_IN_LISTS)) + wc = fetch_wc(("Unbalanced [")); + } + + if (wc1 == WEOF) + wc1 = fetch_wc(_("Unbalanced [")); + + if (wc1 == L'-') + /* build range characters. */ + { + wc2 = fetch_wc(_("Unbalanced [")); + if (wc2 == L']') + { + /* In the case [x-], the - is an ordinary hyphen, + which is left in c1, the lookahead character. */ + lexptr -= cur_mb_len; + lexleft += cur_mb_len; + wc2 = wc; + } + else + { + if (wc2 == L'\\' + && (syntax_bits & RE_BACKSLASH_ESCAPE_IN_LISTS)) + wc2 = fetch_wc(_("Unbalanced [")); + wc1 = fetch_wc(_("Unbalanced [")); + } + + if (range_sts_al == 0) + { + MALLOC(work_mbc->range_sts, wchar_t, ++range_sts_al); + MALLOC(work_mbc->range_ends, wchar_t, ++range_ends_al); + } + REALLOC_IF_NECESSARY(work_mbc->range_sts, wchar_t, + range_sts_al, work_mbc->nranges + 1); + work_mbc->range_sts[work_mbc->nranges] = (wchar_t)wc; + REALLOC_IF_NECESSARY(work_mbc->range_ends, wchar_t, + range_ends_al, work_mbc->nranges + 1); + work_mbc->range_ends[work_mbc->nranges++] = (wchar_t)wc2; + } + else if (wc != WEOF) + /* build normal characters. */ + { + REALLOC_IF_NECESSARY(work_mbc->chars, wchar_t, chars_al, + work_mbc->nchars + 1); + work_mbc->chars[work_mbc->nchars++] = (wchar_t)wc; + } + } + while ((wc = wc1) != L']'); +} +#endif /* MBS_SUPPORT */ + +#ifdef __STDC__ +#define FUNC(F, P) static int F(int c) { return P(c); } +#else +#define FUNC(F, P) static int F(c) int c; { return P(c); } +#endif + +FUNC(is_alpha, ISALPHA) +FUNC(is_upper, ISUPPER) +FUNC(is_lower, ISLOWER) +FUNC(is_digit, ISDIGIT) +FUNC(is_xdigit, ISXDIGIT) +FUNC(is_space, ISSPACE) +FUNC(is_punct, ISPUNCT) +FUNC(is_alnum, ISALNUM) +FUNC(is_print, ISPRINT) +FUNC(is_graph, ISGRAPH) +FUNC(is_cntrl, ISCNTRL) + +static int +is_blank (int c) +{ + return (c == ' ' || c == '\t'); +} + +/* The following list maps the names of the Posix named character classes + to predicate functions that determine whether a given character is in + the class. The leading [ has already been eaten by the lexical analyzer. */ +static struct { + const char *name; + int (*pred) PARAMS ((int)); +} const prednames[] = { + { ":alpha:]", is_alpha }, + { ":upper:]", is_upper }, + { ":lower:]", is_lower }, + { ":digit:]", is_digit }, + { ":xdigit:]", is_xdigit }, + { ":space:]", is_space }, + { ":punct:]", is_punct }, + { ":alnum:]", is_alnum }, + { ":print:]", is_print }, + { ":graph:]", is_graph }, + { ":cntrl:]", is_cntrl }, + { ":blank:]", is_blank }, + { 0 } +}; + +/* Return non-zero if C is a `word-constituent' byte; zero otherwise. */ +#define IS_WORD_CONSTITUENT(C) (ISALNUM(C) || (C) == '_') + +static int +looking_at (char const *s) +{ + size_t len; + + len = strlen(s); + if (lexleft < len) + return 0; + return strncmp(s, lexptr, len) == 0; +} + +static token +lex (void) +{ + unsigned c, c1, c2; + int backslash = 0, invert; + charclass ccl; + int i; + + /* Basic plan: We fetch a character. If it's a backslash, + we set the backslash flag and go through the loop again. + On the plus side, this avoids having a duplicate of the + main switch inside the backslash case. On the minus side, + it means that just about every case begins with + "if (backslash) ...". */ + for (i = 0; i < 2; ++i) + { + FETCH(c, 0); +#ifdef MBS_SUPPORT + if (MB_CUR_MAX > 1 && cur_mb_index) + /* If this is a part of a multi-byte character, we must treat + this byte data as a normal character. + e.g. In case of SJIS encoding, some character contains '\', + but they must not be backslash. */ + goto normal_char; +#endif /* MBS_SUPPORT */ + switch (c) + { + case '\\': + if (backslash) + goto normal_char; + if (lexleft == 0) + dfaerror(_("Unfinished \\ escape")); + backslash = 1; + break; + + case '^': + if (backslash) + goto normal_char; + if (syntax_bits & RE_CONTEXT_INDEP_ANCHORS + || lasttok == END + || lasttok == LPAREN + || lasttok == OR) + return lasttok = BEGLINE; + goto normal_char; + + case '$': + if (backslash) + goto normal_char; + if (syntax_bits & RE_CONTEXT_INDEP_ANCHORS + || lexleft == 0 + || (syntax_bits & RE_NO_BK_PARENS + ? lexleft > 0 && *lexptr == ')' + : lexleft > 1 && lexptr[0] == '\\' && lexptr[1] == ')') + || (syntax_bits & RE_NO_BK_VBAR + ? lexleft > 0 && *lexptr == '|' + : lexleft > 1 && lexptr[0] == '\\' && lexptr[1] == '|') + || ((syntax_bits & RE_NEWLINE_ALT) + && lexleft > 0 && *lexptr == '\n')) + return lasttok = ENDLINE; + goto normal_char; + + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + if (backslash && !(syntax_bits & RE_NO_BK_REFS)) + { + laststart = 0; + return lasttok = BACKREF; + } + goto normal_char; + + case '`': + if (backslash && !(syntax_bits & RE_NO_GNU_OPS)) + return lasttok = BEGLINE; /* FIXME: should be beginning of string */ + goto normal_char; + + case '\'': + if (backslash && !(syntax_bits & RE_NO_GNU_OPS)) + return lasttok = ENDLINE; /* FIXME: should be end of string */ + goto normal_char; + + case '<': + if (backslash && !(syntax_bits & RE_NO_GNU_OPS)) + return lasttok = BEGWORD; + goto normal_char; + + case '>': + if (backslash && !(syntax_bits & RE_NO_GNU_OPS)) + return lasttok = ENDWORD; + goto normal_char; + + case 'b': + if (backslash && !(syntax_bits & RE_NO_GNU_OPS)) + return lasttok = LIMWORD; + goto normal_char; + + case 'B': + if (backslash && !(syntax_bits & RE_NO_GNU_OPS)) + return lasttok = NOTLIMWORD; + goto normal_char; + + case '?': + if (syntax_bits & RE_LIMITED_OPS) + goto normal_char; + if (backslash != ((syntax_bits & RE_BK_PLUS_QM) != 0)) + goto normal_char; + if (!(syntax_bits & RE_CONTEXT_INDEP_OPS) && laststart) + goto normal_char; + return lasttok = QMARK; + + case '*': + if (backslash) + goto normal_char; + if (!(syntax_bits & RE_CONTEXT_INDEP_OPS) && laststart) + goto normal_char; + return lasttok = STAR; + + case '+': + if (syntax_bits & RE_LIMITED_OPS) + goto normal_char; + if (backslash != ((syntax_bits & RE_BK_PLUS_QM) != 0)) + goto normal_char; + if (!(syntax_bits & RE_CONTEXT_INDEP_OPS) && laststart) + goto normal_char; + return lasttok = PLUS; + + case '{': + if (!(syntax_bits & RE_INTERVALS)) + goto normal_char; + if (backslash != ((syntax_bits & RE_NO_BK_BRACES) == 0)) + goto normal_char; + if (!(syntax_bits & RE_CONTEXT_INDEP_OPS) && laststart) + goto normal_char; + + if (syntax_bits & RE_NO_BK_BRACES) + { + /* Scan ahead for a valid interval; if it's not valid, + treat it as a literal '{'. */ + int lo = -1, hi = -1; + char const *p = lexptr; + char const *lim = p + lexleft; + for (; p != lim && ISASCIIDIGIT (*p); p++) + lo = (lo < 0 ? 0 : lo * 10) + *p - '0'; + if (p != lim && *p == ',') + while (++p != lim && ISASCIIDIGIT (*p)) + hi = (hi < 0 ? 0 : hi * 10) + *p - '0'; + else + hi = lo; + if (p == lim || *p != '}' + || lo < 0 || RE_DUP_MAX < hi || (0 <= hi && hi < lo)) + goto normal_char; + } + + minrep = 0; + /* Cases: + {M} - exact count + {M,} - minimum count, maximum is infinity + {M,N} - M through N */ + FETCH(c, _("unfinished repeat count")); + if (ISASCIIDIGIT (c)) + { + minrep = c - '0'; + for (;;) + { + FETCH(c, _("unfinished repeat count")); + if (! ISASCIIDIGIT (c)) + break; + minrep = 10 * minrep + c - '0'; + } + } + else + dfaerror(_("malformed repeat count")); + if (c == ',') + { + FETCH (c, _("unfinished repeat count")); + if (! ISASCIIDIGIT (c)) + maxrep = -1; + else + { + maxrep = c - '0'; + for (;;) + { + FETCH (c, _("unfinished repeat count")); + if (! ISASCIIDIGIT (c)) + break; + maxrep = 10 * maxrep + c - '0'; + } + if (0 <= maxrep && maxrep < minrep) + dfaerror (_("malformed repeat count")); + } + } + else + maxrep = minrep; + if (!(syntax_bits & RE_NO_BK_BRACES)) + { + if (c != '\\') + dfaerror(_("malformed repeat count")); + FETCH(c, _("unfinished repeat count")); + } + if (c != '}') + dfaerror(_("malformed repeat count")); + laststart = 0; + return lasttok = REPMN; + + case '|': + if (syntax_bits & RE_LIMITED_OPS) + goto normal_char; + if (backslash != ((syntax_bits & RE_NO_BK_VBAR) == 0)) + goto normal_char; + laststart = 1; + return lasttok = OR; + + case '\n': + if (syntax_bits & RE_LIMITED_OPS + || backslash + || !(syntax_bits & RE_NEWLINE_ALT)) + goto normal_char; + laststart = 1; + return lasttok = OR; + + case '(': + if (backslash != ((syntax_bits & RE_NO_BK_PARENS) == 0)) + goto normal_char; + ++parens; + laststart = 1; + return lasttok = LPAREN; + + case ')': + if (backslash != ((syntax_bits & RE_NO_BK_PARENS) == 0)) + goto normal_char; + if (parens == 0 && syntax_bits & RE_UNMATCHED_RIGHT_PAREN_ORD) + goto normal_char; + --parens; + laststart = 0; + return lasttok = RPAREN; + + case '.': + if (backslash) + goto normal_char; +#ifdef MBS_SUPPORT + if (MB_CUR_MAX > 1) + { + /* In multibyte environment period must match with a single + character not a byte. So we use ANYCHAR. */ + laststart = 0; + return lasttok = ANYCHAR; + } +#endif /* MBS_SUPPORT */ + zeroset(ccl); + notset(ccl); + if (!(syntax_bits & RE_DOT_NEWLINE)) + clrbit(eolbyte, ccl); + if (syntax_bits & RE_DOT_NOT_NULL) + clrbit('\0', ccl); + laststart = 0; + return lasttok = CSET + charclass_index(ccl); + + case 'w': + case 'W': + if (!backslash || (syntax_bits & RE_NO_GNU_OPS)) + goto normal_char; + zeroset(ccl); + for (c2 = 0; c2 < NOTCHAR; ++c2) + if (IS_WORD_CONSTITUENT(c2)) + setbit(c2, ccl); + if (c == 'W') + notset(ccl); + laststart = 0; + return lasttok = CSET + charclass_index(ccl); + + case '[': + if (backslash) + goto normal_char; + laststart = 0; +#ifdef MBS_SUPPORT + if (MB_CUR_MAX > 1) + { + /* In multibyte environment a bracket expression may contain + multibyte characters, which must be treated as characters + (not bytes). So we parse it by parse_bracket_exp_mb(). */ + parse_bracket_exp_mb(); + return lasttok = MBCSET; + } +#endif + zeroset(ccl); + FETCH(c, _("Unbalanced [")); + if (c == '^') + { + FETCH(c, _("Unbalanced [")); + invert = 1; + } + else + invert = 0; + do + { + /* Nobody ever said this had to be fast. :-) + Note that if we're looking at some other [:...:] + construct, we just treat it as a bunch of ordinary + characters. We can do this because we assume + regex has checked for syntax errors before + dfa is ever called. */ + if (c == '[' && (syntax_bits & RE_CHAR_CLASSES)) + for (c1 = 0; prednames[c1].name; ++c1) + if (looking_at(prednames[c1].name)) + { + int (*pred) PARAMS ((int)) = prednames[c1].pred; + + for (c2 = 0; c2 < NOTCHAR; ++c2) + if ((*pred)(c2)) + setbit_case_fold (c2, ccl); + lexptr += strlen(prednames[c1].name); + lexleft -= strlen(prednames[c1].name); + FETCH(c1, _("Unbalanced [")); + goto skip; + } + if (c == '\\' && (syntax_bits & RE_BACKSLASH_ESCAPE_IN_LISTS)) + FETCH(c, _("Unbalanced [")); + FETCH(c1, _("Unbalanced [")); + if (c1 == '-') + { + FETCH(c2, _("Unbalanced [")); + if (c2 == ']') + { + /* In the case [x-], the - is an ordinary hyphen, + which is left in c1, the lookahead character. */ + --lexptr; + ++lexleft; + } + else + { + if (c2 == '\\' + && (syntax_bits & RE_BACKSLASH_ESCAPE_IN_LISTS)) + FETCH(c2, _("Unbalanced [")); + FETCH(c1, _("Unbalanced [")); + if (!hard_LC_COLLATE) { + for (; c <= c2; c++) + setbit_case_fold (c, ccl); + } else { + /* POSIX locales are painful - leave the decision to libc */ + regex_t re; + char expr[6]; /* = { '[', c, '-', c2, ']', '\0' }; */ + + expr[0] = '['; expr[1] = c; expr[2] = '-'; + expr[3] = c2; expr[4] = ']'; expr[5] = '\0'; + if (regcomp (&re, expr, case_fold ? REG_ICASE : 0) == REG_NOERROR) { + for (c = 0; c < NOTCHAR; ++c) { + regmatch_t mat; + char buf[2]; /* = { c, '\0' }; */ + + buf[0] = c; buf[1] = '\0'; + if (regexec (&re, buf, 1, &mat, 0) == REG_NOERROR + && mat.rm_so == 0 && mat.rm_eo == 1) + setbit_case_fold (c, ccl); + } + regfree (&re); + } + } + continue; + } + } + + setbit_case_fold (c, ccl); + + skip: + ; + } + while ((c = c1) != ']'); + if (invert) + { + notset(ccl); + if (syntax_bits & RE_HAT_LISTS_NOT_NEWLINE) + clrbit(eolbyte, ccl); + } + return lasttok = CSET + charclass_index(ccl); + + default: + normal_char: + laststart = 0; + if (case_fold && ISALPHA(c)) + { + zeroset(ccl); + setbit_case_fold (c, ccl); + return lasttok = CSET + charclass_index(ccl); + } + return lasttok = c; + } + } + + /* The above loop should consume at most a backslash + and some other character. */ + abort(); + return END; /* keeps pedantic compilers happy. */ +} + +/* Recursive descent parser for regular expressions. */ + +static token tok; /* Lookahead token. */ +static int depth; /* Current depth of a hypothetical stack + holding deferred productions. This is + used to determine the depth that will be + required of the real stack later on in + dfaanalyze(). */ + +/* Add the given token to the parse tree, maintaining the depth count and + updating the maximum depth if necessary. */ +static void +addtok (token t) +{ +#ifdef MBS_SUPPORT + if (MB_CUR_MAX > 1) + { + REALLOC_IF_NECESSARY(dfa->multibyte_prop, int, dfa->nmultibyte_prop, + dfa->tindex); + /* Set dfa->multibyte_prop. See struct dfa in dfa.h. */ + if (t == MBCSET) + dfa->multibyte_prop[dfa->tindex] = ((dfa->nmbcsets - 1) << 2) + 3; + else if (t < NOTCHAR) + dfa->multibyte_prop[dfa->tindex] + = (cur_mb_len == 1)? 3 /* single-byte char */ + : (((cur_mb_index == 1)? 1 : 0) /* 1st-byte of multibyte char */ + + ((cur_mb_index == cur_mb_len)? 2 : 0)); /* last-byte */ + else + /* It may be unnecessary, but it is safer to treat other + symbols as single byte characters. */ + dfa->multibyte_prop[dfa->tindex] = 3; + } +#endif + + REALLOC_IF_NECESSARY(dfa->tokens, token, dfa->talloc, dfa->tindex); + dfa->tokens[dfa->tindex++] = t; + + switch (t) + { + case QMARK: + case STAR: + case PLUS: + break; + + case CAT: + case OR: + case ORTOP: + --depth; + break; + + default: + ++dfa->nleaves; + case EMPTY: + ++depth; + break; + } + if (depth > dfa->depth) + dfa->depth = depth; +} + +/* The grammar understood by the parser is as follows. + + regexp: + regexp OR branch + branch + + branch: + branch closure + closure + + closure: + closure QMARK + closure STAR + closure PLUS + closure REPMN + atom + + atom: + + + ANYCHAR + MBCSET + CSET + BACKREF + BEGLINE + ENDLINE + BEGWORD + ENDWORD + LIMWORD + NOTLIMWORD + CRANGE + LPAREN regexp RPAREN + + + The parser builds a parse tree in postfix form in an array of tokens. */ + +static void +atom (void) +{ + if ((tok >= 0 && tok < NOTCHAR) || tok >= CSET || tok == BACKREF + || tok == BEGLINE || tok == ENDLINE || tok == BEGWORD +#ifdef MBS_SUPPORT + || tok == ANYCHAR || tok == MBCSET /* MB_CUR_MAX > 1 */ +#endif /* MBS_SUPPORT */ + || tok == ENDWORD || tok == LIMWORD || tok == NOTLIMWORD) + { + addtok(tok); + tok = lex(); +#ifdef MBS_SUPPORT + /* We treat a multibyte character as a single atom, so that DFA + can treat a multibyte character as a single expression. + + e.g. We construct following tree from "". + + + */ + if (MB_CUR_MAX > 1) + { + while (cur_mb_index > 1 && tok >= 0 && tok < NOTCHAR) + { + addtok(tok); + addtok(CAT); + tok = lex(); + } + } +#endif /* MBS_SUPPORT */ + } + else if (tok == CRANGE) + { + /* A character range like "[a-z]" in a locale other than "C" or + "POSIX". This range might any sequence of one or more + characters. Unfortunately the POSIX locale primitives give + us no practical way to find what character sequences might be + matched. Treat this approximately like "(.\1)" -- i.e. match + one character, and then punt to the full matcher. */ + charclass ccl; + zeroset (ccl); + notset (ccl); + addtok (CSET + charclass_index (ccl)); + addtok (BACKREF); + addtok (CAT); + tok = lex (); + } + else if (tok == LPAREN) + { + tok = lex(); + regexp(0); + if (tok != RPAREN) + dfaerror(_("Unbalanced (")); + tok = lex(); + } + else + addtok(EMPTY); +} + +/* Return the number of tokens in the given subexpression. */ +static int +nsubtoks (int tindex) +{ + int ntoks1; + + switch (dfa->tokens[tindex - 1]) + { + default: + return 1; + case QMARK: + case STAR: + case PLUS: + return 1 + nsubtoks(tindex - 1); + case CAT: + case OR: + case ORTOP: + ntoks1 = nsubtoks(tindex - 1); + return 1 + ntoks1 + nsubtoks(tindex - 1 - ntoks1); + } +} + +/* Copy the given subexpression to the top of the tree. */ +static void +copytoks (int tindex, int ntokens) +{ + int i; + + for (i = 0; i < ntokens; ++i) + addtok(dfa->tokens[tindex + i]); +} + +static void +closure (void) +{ + int tindex, ntokens, i; + + atom(); + while (tok == QMARK || tok == STAR || tok == PLUS || tok == REPMN) + if (tok == REPMN) + { + ntokens = nsubtoks(dfa->tindex); + tindex = dfa->tindex - ntokens; + if (maxrep < 0) + addtok(PLUS); + if (minrep == 0) + addtok(QMARK); + for (i = 1; i < minrep; ++i) + { + copytoks(tindex, ntokens); + addtok(CAT); + } + for (; i < maxrep; ++i) + { + copytoks(tindex, ntokens); + addtok(QMARK); + addtok(CAT); + } + tok = lex(); + } + else + { + addtok(tok); + tok = lex(); + } +} + +static void +branch (void) +{ + closure(); + while (tok != RPAREN && tok != OR && tok >= 0) + { + closure(); + addtok(CAT); + } +} + +static void +regexp (int toplevel) +{ + branch(); + while (tok == OR) + { + tok = lex(); + branch(); + if (toplevel) + addtok(ORTOP); + else + addtok(OR); + } +} + +/* Main entry point for the parser. S is a string to be parsed, len is the + length of the string, so s can include NUL characters. D is a pointer to + the struct dfa to parse into. */ +void +dfaparse (char const *s, size_t len, struct dfa *d) +{ + dfa = d; + lexptr = s; + lexleft = len; + lasttok = END; + laststart = 1; + parens = 0; +#ifdef LC_COLLATE + hard_LC_COLLATE = hard_locale (LC_COLLATE); +#endif +#ifdef MBS_SUPPORT + if (MB_CUR_MAX > 1) + { + cur_mb_index = 0; + cur_mb_len = 0; + memset(&mbs, 0, sizeof(mbstate_t)); + } +#endif /* MBS_SUPPORT */ + + if (! syntax_bits_set) + dfaerror(_("No syntax specified")); + + tok = lex(); + depth = d->depth; + + regexp(1); + + if (tok != END) + dfaerror(_("Unbalanced )")); + + addtok(END - d->nregexps); + addtok(CAT); + + if (d->nregexps) + addtok(ORTOP); + + ++d->nregexps; +} + +/* Some primitives for operating on sets of positions. */ + +/* Copy one set to another; the destination must be large enough. */ +static void +copy (position_set const *src, position_set *dst) +{ + int i; + + for (i = 0; i < src->nelem; ++i) + dst->elems[i] = src->elems[i]; + dst->nelem = src->nelem; +} + +/* Insert a position in a set. Position sets are maintained in sorted + order according to index. If position already exists in the set with + the same index then their constraints are logically or'd together. + S->elems must point to an array large enough to hold the resulting set. */ +static void +insert (position p, position_set *s) +{ + int i; + position t1, t2; + + for (i = 0; i < s->nelem && p.index < s->elems[i].index; ++i) + continue; + if (i < s->nelem && p.index == s->elems[i].index) + s->elems[i].constraint |= p.constraint; + else + { + t1 = p; + ++s->nelem; + while (i < s->nelem) + { + t2 = s->elems[i]; + s->elems[i++] = t1; + t1 = t2; + } + } +} + +/* Merge two sets of positions into a third. The result is exactly as if + the positions of both sets were inserted into an initially empty set. */ +static void +merge (position_set const *s1, position_set const *s2, position_set *m) +{ + int i = 0, j = 0; + + m->nelem = 0; + while (i < s1->nelem && j < s2->nelem) + if (s1->elems[i].index > s2->elems[j].index) + m->elems[m->nelem++] = s1->elems[i++]; + else if (s1->elems[i].index < s2->elems[j].index) + m->elems[m->nelem++] = s2->elems[j++]; + else + { + m->elems[m->nelem] = s1->elems[i++]; + m->elems[m->nelem++].constraint |= s2->elems[j++].constraint; + } + while (i < s1->nelem) + m->elems[m->nelem++] = s1->elems[i++]; + while (j < s2->nelem) + m->elems[m->nelem++] = s2->elems[j++]; +} + +/* Delete a position from a set. */ +static void +delete (position p, position_set *s) +{ + int i; + + for (i = 0; i < s->nelem; ++i) + if (p.index == s->elems[i].index) + break; + if (i < s->nelem) + for (--s->nelem; i < s->nelem; ++i) + s->elems[i] = s->elems[i + 1]; +} + +/* Find the index of the state corresponding to the given position set with + the given preceding context, or create a new state if there is no such + state. Newline and letter tell whether we got here on a newline or + letter, respectively. */ +static int +state_index (struct dfa *d, position_set const *s, int newline, int letter) +{ + int hash = 0; + int constraint; + int i, j; + + newline = newline ? 1 : 0; + letter = letter ? 1 : 0; + + for (i = 0; i < s->nelem; ++i) + hash ^= s->elems[i].index + s->elems[i].constraint; + + /* Try to find a state that exactly matches the proposed one. */ + for (i = 0; i < d->sindex; ++i) + { + if (hash != d->states[i].hash || s->nelem != d->states[i].elems.nelem + || newline != d->states[i].newline || letter != d->states[i].letter) + continue; + for (j = 0; j < s->nelem; ++j) + if (s->elems[j].constraint + != d->states[i].elems.elems[j].constraint + || s->elems[j].index != d->states[i].elems.elems[j].index) + break; + if (j == s->nelem) + return i; + } + + /* We'll have to create a new state. */ + REALLOC_IF_NECESSARY(d->states, dfa_state, d->salloc, d->sindex); + d->states[i].hash = hash; + MALLOC(d->states[i].elems.elems, position, s->nelem); + copy(s, &d->states[i].elems); + d->states[i].newline = newline; + d->states[i].letter = letter; + d->states[i].backref = 0; + d->states[i].constraint = 0; + d->states[i].first_end = 0; +#ifdef MBS_SUPPORT + if (MB_CUR_MAX > 1) + d->states[i].mbps.nelem = 0; +#endif + for (j = 0; j < s->nelem; ++j) + if (d->tokens[s->elems[j].index] < 0) + { + constraint = s->elems[j].constraint; + if (SUCCEEDS_IN_CONTEXT(constraint, newline, 0, letter, 0) + || SUCCEEDS_IN_CONTEXT(constraint, newline, 0, letter, 1) + || SUCCEEDS_IN_CONTEXT(constraint, newline, 1, letter, 0) + || SUCCEEDS_IN_CONTEXT(constraint, newline, 1, letter, 1)) + d->states[i].constraint |= constraint; + if (! d->states[i].first_end) + d->states[i].first_end = d->tokens[s->elems[j].index]; + } + else if (d->tokens[s->elems[j].index] == BACKREF) + { + d->states[i].constraint = NO_CONSTRAINT; + d->states[i].backref = 1; + } + + ++d->sindex; + + return i; +} + +/* Find the epsilon closure of a set of positions. If any position of the set + contains a symbol that matches the empty string in some context, replace + that position with the elements of its follow labeled with an appropriate + constraint. Repeat exhaustively until no funny positions are left. + S->elems must be large enough to hold the result. */ +static void +epsclosure (position_set *s, struct dfa const *d) +{ + int i, j; + int *visited; + position p, old; + + MALLOC(visited, int, d->tindex); + for (i = 0; i < d->tindex; ++i) + visited[i] = 0; + + for (i = 0; i < s->nelem; ++i) + if (d->tokens[s->elems[i].index] >= NOTCHAR + && d->tokens[s->elems[i].index] != BACKREF +#ifdef MBS_SUPPORT + && d->tokens[s->elems[i].index] != ANYCHAR + && d->tokens[s->elems[i].index] != MBCSET +#endif + && d->tokens[s->elems[i].index] < CSET) + { + old = s->elems[i]; + p.constraint = old.constraint; + delete(s->elems[i], s); + if (visited[old.index]) + { + --i; + continue; + } + visited[old.index] = 1; + switch (d->tokens[old.index]) + { + case BEGLINE: + p.constraint &= BEGLINE_CONSTRAINT; + break; + case ENDLINE: + p.constraint &= ENDLINE_CONSTRAINT; + break; + case BEGWORD: + p.constraint &= BEGWORD_CONSTRAINT; + break; + case ENDWORD: + p.constraint &= ENDWORD_CONSTRAINT; + break; + case LIMWORD: + p.constraint &= LIMWORD_CONSTRAINT; + break; + case NOTLIMWORD: + p.constraint &= NOTLIMWORD_CONSTRAINT; + break; + default: + break; + } + for (j = 0; j < d->follows[old.index].nelem; ++j) + { + p.index = d->follows[old.index].elems[j].index; + insert(p, s); + } + /* Force rescan to start at the beginning. */ + i = -1; + } + + free(visited); +} + +/* Perform bottom-up analysis on the parse tree, computing various functions. + Note that at this point, we're pretending constructs like \< are real + characters rather than constraints on what can follow them. + + Nullable: A node is nullable if it is at the root of a regexp that can + match the empty string. + * EMPTY leaves are nullable. + * No other leaf is nullable. + * A QMARK or STAR node is nullable. + * A PLUS node is nullable if its argument is nullable. + * A CAT node is nullable if both its arguments are nullable. + * An OR node is nullable if either argument is nullable. + + Firstpos: The firstpos of a node is the set of positions (nonempty leaves) + that could correspond to the first character of a string matching the + regexp rooted at the given node. + * EMPTY leaves have empty firstpos. + * The firstpos of a nonempty leaf is that leaf itself. + * The firstpos of a QMARK, STAR, or PLUS node is the firstpos of its + argument. + * The firstpos of a CAT node is the firstpos of the left argument, union + the firstpos of the right if the left argument is nullable. + * The firstpos of an OR node is the union of firstpos of each argument. + + Lastpos: The lastpos of a node is the set of positions that could + correspond to the last character of a string matching the regexp at + the given node. + * EMPTY leaves have empty lastpos. + * The lastpos of a nonempty leaf is that leaf itself. + * The lastpos of a QMARK, STAR, or PLUS node is the lastpos of its + argument. + * The lastpos of a CAT node is the lastpos of its right argument, union + the lastpos of the left if the right argument is nullable. + * The lastpos of an OR node is the union of the lastpos of each argument. + + Follow: The follow of a position is the set of positions that could + correspond to the character following a character matching the node in + a string matching the regexp. At this point we consider special symbols + that match the empty string in some context to be just normal characters. + Later, if we find that a special symbol is in a follow set, we will + replace it with the elements of its follow, labeled with an appropriate + constraint. + * Every node in the firstpos of the argument of a STAR or PLUS node is in + the follow of every node in the lastpos. + * Every node in the firstpos of the second argument of a CAT node is in + the follow of every node in the lastpos of the first argument. + + Because of the postfix representation of the parse tree, the depth-first + analysis is conveniently done by a linear scan with the aid of a stack. + Sets are stored as arrays of the elements, obeying a stack-like allocation + scheme; the number of elements in each set deeper in the stack can be + used to determine the address of a particular set's array. */ +void +dfaanalyze (struct dfa *d, int searchflag) +{ + int *nullable; /* Nullable stack. */ + int *nfirstpos; /* Element count stack for firstpos sets. */ + position *firstpos; /* Array where firstpos elements are stored. */ + int *nlastpos; /* Element count stack for lastpos sets. */ + position *lastpos; /* Array where lastpos elements are stored. */ + int *nalloc; /* Sizes of arrays allocated to follow sets. */ + position_set tmp; /* Temporary set for merging sets. */ + position_set merged; /* Result of merging sets. */ + int wants_newline; /* True if some position wants newline info. */ + int *o_nullable; + int *o_nfirst, *o_nlast; + position *o_firstpos, *o_lastpos; + int i, j; + position *pos; + +#ifdef DEBUG + fprintf(stderr, "dfaanalyze:\n"); + for (i = 0; i < d->tindex; ++i) + { + fprintf(stderr, " %d:", i); + prtok(d->tokens[i]); + } + putc('\n', stderr); +#endif + + d->searchflag = searchflag; + + MALLOC(nullable, int, d->depth); + o_nullable = nullable; + MALLOC(nfirstpos, int, d->depth); + o_nfirst = nfirstpos; + MALLOC(firstpos, position, d->nleaves); + o_firstpos = firstpos, firstpos += d->nleaves; + MALLOC(nlastpos, int, d->depth); + o_nlast = nlastpos; + MALLOC(lastpos, position, d->nleaves); + o_lastpos = lastpos, lastpos += d->nleaves; + MALLOC(nalloc, int, d->tindex); + for (i = 0; i < d->tindex; ++i) + nalloc[i] = 0; + MALLOC(merged.elems, position, d->nleaves); + + CALLOC(d->follows, position_set, d->tindex); + + for (i = 0; i < d->tindex; ++i) +#ifdef DEBUG + { /* Nonsyntactic #ifdef goo... */ +#endif + switch (d->tokens[i]) + { + case EMPTY: + /* The empty set is nullable. */ + *nullable++ = 1; + + /* The firstpos and lastpos of the empty leaf are both empty. */ + *nfirstpos++ = *nlastpos++ = 0; + break; + + case STAR: + case PLUS: + /* Every element in the firstpos of the argument is in the follow + of every element in the lastpos. */ + tmp.nelem = nfirstpos[-1]; + tmp.elems = firstpos; + pos = lastpos; + for (j = 0; j < nlastpos[-1]; ++j) + { + merge(&tmp, &d->follows[pos[j].index], &merged); + REALLOC_IF_NECESSARY(d->follows[pos[j].index].elems, position, + nalloc[pos[j].index], merged.nelem - 1); + copy(&merged, &d->follows[pos[j].index]); + } + + case QMARK: + /* A QMARK or STAR node is automatically nullable. */ + if (d->tokens[i] != PLUS) + nullable[-1] = 1; + break; + + case CAT: + /* Every element in the firstpos of the second argument is in the + follow of every element in the lastpos of the first argument. */ + tmp.nelem = nfirstpos[-1]; + tmp.elems = firstpos; + pos = lastpos + nlastpos[-1]; + for (j = 0; j < nlastpos[-2]; ++j) + { + merge(&tmp, &d->follows[pos[j].index], &merged); + REALLOC_IF_NECESSARY(d->follows[pos[j].index].elems, position, + nalloc[pos[j].index], merged.nelem - 1); + copy(&merged, &d->follows[pos[j].index]); + } + + /* The firstpos of a CAT node is the firstpos of the first argument, + union that of the second argument if the first is nullable. */ + if (nullable[-2]) + nfirstpos[-2] += nfirstpos[-1]; + else + firstpos += nfirstpos[-1]; + --nfirstpos; + + /* The lastpos of a CAT node is the lastpos of the second argument, + union that of the first argument if the second is nullable. */ + if (nullable[-1]) + nlastpos[-2] += nlastpos[-1]; + else + { + pos = lastpos + nlastpos[-2]; + for (j = nlastpos[-1] - 1; j >= 0; --j) + pos[j] = lastpos[j]; + lastpos += nlastpos[-2]; + nlastpos[-2] = nlastpos[-1]; + } + --nlastpos; + + /* A CAT node is nullable if both arguments are nullable. */ + nullable[-2] = nullable[-1] && nullable[-2]; + --nullable; + break; + + case OR: + case ORTOP: + /* The firstpos is the union of the firstpos of each argument. */ + nfirstpos[-2] += nfirstpos[-1]; + --nfirstpos; + + /* The lastpos is the union of the lastpos of each argument. */ + nlastpos[-2] += nlastpos[-1]; + --nlastpos; + + /* An OR node is nullable if either argument is nullable. */ + nullable[-2] = nullable[-1] || nullable[-2]; + --nullable; + break; + + default: + /* Anything else is a nonempty position. (Note that special + constructs like \< are treated as nonempty strings here; + an "epsilon closure" effectively makes them nullable later. + Backreferences have to get a real position so we can detect + transitions on them later. But they are nullable. */ + *nullable++ = d->tokens[i] == BACKREF; + + /* This position is in its own firstpos and lastpos. */ + *nfirstpos++ = *nlastpos++ = 1; + --firstpos, --lastpos; + firstpos->index = lastpos->index = i; + firstpos->constraint = lastpos->constraint = NO_CONSTRAINT; + + /* Allocate the follow set for this position. */ + nalloc[i] = 1; + MALLOC(d->follows[i].elems, position, nalloc[i]); + break; + } +#ifdef DEBUG + /* ... balance the above nonsyntactic #ifdef goo... */ + fprintf(stderr, "node %d:", i); + prtok(d->tokens[i]); + putc('\n', stderr); + fprintf(stderr, nullable[-1] ? " nullable: yes\n" : " nullable: no\n"); + fprintf(stderr, " firstpos:"); + for (j = nfirstpos[-1] - 1; j >= 0; --j) + { + fprintf(stderr, " %d:", firstpos[j].index); + prtok(d->tokens[firstpos[j].index]); + } + fprintf(stderr, "\n lastpos:"); + for (j = nlastpos[-1] - 1; j >= 0; --j) + { + fprintf(stderr, " %d:", lastpos[j].index); + prtok(d->tokens[lastpos[j].index]); + } + putc('\n', stderr); + } +#endif + + /* For each follow set that is the follow set of a real position, replace + it with its epsilon closure. */ + for (i = 0; i < d->tindex; ++i) + if (d->tokens[i] < NOTCHAR || d->tokens[i] == BACKREF +#ifdef MBS_SUPPORT + || d->tokens[i] == ANYCHAR + || d->tokens[i] == MBCSET +#endif + || d->tokens[i] >= CSET) + { +#ifdef DEBUG + fprintf(stderr, "follows(%d:", i); + prtok(d->tokens[i]); + fprintf(stderr, "):"); + for (j = d->follows[i].nelem - 1; j >= 0; --j) + { + fprintf(stderr, " %d:", d->follows[i].elems[j].index); + prtok(d->tokens[d->follows[i].elems[j].index]); + } + putc('\n', stderr); +#endif + copy(&d->follows[i], &merged); + epsclosure(&merged, d); + if (d->follows[i].nelem < merged.nelem) + REALLOC(d->follows[i].elems, position, merged.nelem); + copy(&merged, &d->follows[i]); + } + + /* Get the epsilon closure of the firstpos of the regexp. The result will + be the set of positions of state 0. */ + merged.nelem = 0; + for (i = 0; i < nfirstpos[-1]; ++i) + insert(firstpos[i], &merged); + epsclosure(&merged, d); + + /* Check if any of the positions of state 0 will want newline context. */ + wants_newline = 0; + for (i = 0; i < merged.nelem; ++i) + if (PREV_NEWLINE_DEPENDENT(merged.elems[i].constraint)) + wants_newline = 1; + + /* Build the initial state. */ + d->salloc = 1; + d->sindex = 0; + MALLOC(d->states, dfa_state, d->salloc); + state_index(d, &merged, wants_newline, 0); + + free(o_nullable); + free(o_nfirst); + free(o_firstpos); + free(o_nlast); + free(o_lastpos); + free(nalloc); + free(merged.elems); +} + +/* Find, for each character, the transition out of state s of d, and store + it in the appropriate slot of trans. + + We divide the positions of s into groups (positions can appear in more + than one group). Each group is labeled with a set of characters that + every position in the group matches (taking into account, if necessary, + preceding context information of s). For each group, find the union + of the its elements' follows. This set is the set of positions of the + new state. For each character in the group's label, set the transition + on this character to be to a state corresponding to the set's positions, + and its associated backward context information, if necessary. + + If we are building a searching matcher, we include the positions of state + 0 in every state. + + The collection of groups is constructed by building an equivalence-class + partition of the positions of s. + + For each position, find the set of characters C that it matches. Eliminate + any characters from C that fail on grounds of backward context. + + Search through the groups, looking for a group whose label L has nonempty + intersection with C. If L - C is nonempty, create a new group labeled + L - C and having the same positions as the current group, and set L to + the intersection of L and C. Insert the position in this group, set + C = C - L, and resume scanning. + + If after comparing with every group there are characters remaining in C, + create a new group labeled with the characters of C and insert this + position in that group. */ +void +dfastate (int s, struct dfa *d, int trans[]) +{ + position_set grps[NOTCHAR]; /* As many as will ever be needed. */ + charclass labels[NOTCHAR]; /* Labels corresponding to the groups. */ + int ngrps = 0; /* Number of groups actually used. */ + position pos; /* Current position being considered. */ + charclass matches; /* Set of matching characters. */ + int matchesf; /* True if matches is nonempty. */ + charclass intersect; /* Intersection with some label set. */ + int intersectf; /* True if intersect is nonempty. */ + charclass leftovers; /* Stuff in the label that didn't match. */ + int leftoversf; /* True if leftovers is nonempty. */ + static charclass letters; /* Set of characters considered letters. */ + static charclass newline; /* Set of characters that aren't newline. */ + position_set follows; /* Union of the follows of some group. */ + position_set tmp; /* Temporary space for merging sets. */ + int state; /* New state. */ + int wants_newline; /* New state wants to know newline context. */ + int state_newline; /* New state on a newline transition. */ + int wants_letter; /* New state wants to know letter context. */ + int state_letter; /* New state on a letter transition. */ + static int initialized; /* Flag for static initialization. */ +#ifdef MBS_SUPPORT + int next_isnt_1st_byte = 0; /* Flag if we can't add state0. */ +#endif + int i, j, k; + + /* Initialize the set of letters, if necessary. */ + if (! initialized) + { + initialized = 1; + for (i = 0; i < NOTCHAR; ++i) + if (IS_WORD_CONSTITUENT(i)) + setbit(i, letters); + setbit(eolbyte, newline); + } + + zeroset(matches); + + for (i = 0; i < d->states[s].elems.nelem; ++i) + { + pos = d->states[s].elems.elems[i]; + if (d->tokens[pos.index] >= 0 && d->tokens[pos.index] < NOTCHAR) + setbit(d->tokens[pos.index], matches); + else if (d->tokens[pos.index] >= CSET) + copyset(d->charclasses[d->tokens[pos.index] - CSET], matches); +#ifdef MBS_SUPPORT + else if (d->tokens[pos.index] == ANYCHAR + || d->tokens[pos.index] == MBCSET) + /* MB_CUR_MAX > 1 */ + { + /* ANYCHAR and MBCSET must match with a single character, so we + must put it to d->states[s].mbps, which contains the positions + which can match with a single character not a byte. */ + if (d->states[s].mbps.nelem == 0) + { + MALLOC(d->states[s].mbps.elems, position, + d->states[s].elems.nelem); + } + insert(pos, &(d->states[s].mbps)); + continue; + } +#endif /* MBS_SUPPORT */ + else + continue; + + /* Some characters may need to be eliminated from matches because + they fail in the current context. */ + if (pos.constraint != 0xFF) + { + if (! MATCHES_NEWLINE_CONTEXT(pos.constraint, + d->states[s].newline, 1)) + clrbit(eolbyte, matches); + if (! MATCHES_NEWLINE_CONTEXT(pos.constraint, + d->states[s].newline, 0)) + for (j = 0; j < CHARCLASS_INTS; ++j) + matches[j] &= newline[j]; + if (! MATCHES_LETTER_CONTEXT(pos.constraint, + d->states[s].letter, 1)) + for (j = 0; j < CHARCLASS_INTS; ++j) + matches[j] &= ~letters[j]; + if (! MATCHES_LETTER_CONTEXT(pos.constraint, + d->states[s].letter, 0)) + for (j = 0; j < CHARCLASS_INTS; ++j) + matches[j] &= letters[j]; + + /* If there are no characters left, there's no point in going on. */ + for (j = 0; j < CHARCLASS_INTS && !matches[j]; ++j) + continue; + if (j == CHARCLASS_INTS) + continue; + } + + for (j = 0; j < ngrps; ++j) + { + /* If matches contains a single character only, and the current + group's label doesn't contain that character, go on to the + next group. */ + if (d->tokens[pos.index] >= 0 && d->tokens[pos.index] < NOTCHAR + && !tstbit(d->tokens[pos.index], labels[j])) + continue; + + /* Check if this group's label has a nonempty intersection with + matches. */ + intersectf = 0; + for (k = 0; k < CHARCLASS_INTS; ++k) + (intersect[k] = matches[k] & labels[j][k]) ? (intersectf = 1) : 0; + if (! intersectf) + continue; + + /* It does; now find the set differences both ways. */ + leftoversf = matchesf = 0; + for (k = 0; k < CHARCLASS_INTS; ++k) + { + /* Even an optimizing compiler can't know this for sure. */ + int match = matches[k], label = labels[j][k]; + + (leftovers[k] = ~match & label) ? (leftoversf = 1) : 0; + (matches[k] = match & ~label) ? (matchesf = 1) : 0; + } + + /* If there were leftovers, create a new group labeled with them. */ + if (leftoversf) + { + copyset(leftovers, labels[ngrps]); + copyset(intersect, labels[j]); + MALLOC(grps[ngrps].elems, position, d->nleaves); + copy(&grps[j], &grps[ngrps]); + ++ngrps; + } + + /* Put the position in the current group. Note that there is no + reason to call insert() here. */ + grps[j].elems[grps[j].nelem++] = pos; + + /* If every character matching the current position has been + accounted for, we're done. */ + if (! matchesf) + break; + } + + /* If we've passed the last group, and there are still characters + unaccounted for, then we'll have to create a new group. */ + if (j == ngrps) + { + copyset(matches, labels[ngrps]); + zeroset(matches); + MALLOC(grps[ngrps].elems, position, d->nleaves); + grps[ngrps].nelem = 1; + grps[ngrps].elems[0] = pos; + ++ngrps; + } + } + + MALLOC(follows.elems, position, d->nleaves); + MALLOC(tmp.elems, position, d->nleaves); + + /* If we are a searching matcher, the default transition is to a state + containing the positions of state 0, otherwise the default transition + is to fail miserably. */ + if (d->searchflag) + { + wants_newline = 0; + wants_letter = 0; + for (i = 0; i < d->states[0].elems.nelem; ++i) + { + if (PREV_NEWLINE_DEPENDENT(d->states[0].elems.elems[i].constraint)) + wants_newline = 1; + if (PREV_LETTER_DEPENDENT(d->states[0].elems.elems[i].constraint)) + wants_letter = 1; + } + copy(&d->states[0].elems, &follows); + state = state_index(d, &follows, 0, 0); + if (wants_newline) + state_newline = state_index(d, &follows, 1, 0); + else + state_newline = state; + if (wants_letter) + state_letter = state_index(d, &follows, 0, 1); + else + state_letter = state; + for (i = 0; i < NOTCHAR; ++i) + trans[i] = (IS_WORD_CONSTITUENT(i)) ? state_letter : state; + trans[eolbyte] = state_newline; + } + else + for (i = 0; i < NOTCHAR; ++i) + trans[i] = -1; + + for (i = 0; i < ngrps; ++i) + { + follows.nelem = 0; + + /* Find the union of the follows of the positions of the group. + This is a hideously inefficient loop. Fix it someday. */ + for (j = 0; j < grps[i].nelem; ++j) + for (k = 0; k < d->follows[grps[i].elems[j].index].nelem; ++k) + insert(d->follows[grps[i].elems[j].index].elems[k], &follows); + +#ifdef MBS_SUPPORT + if (MB_CUR_MAX > 1) + { + /* If a token in follows.elems is not 1st byte of a multibyte + character, or the states of follows must accept the bytes + which are not 1st byte of the multibyte character. + Then, if a state of follows encounter a byte, it must not be + a 1st byte of a multibyte character nor single byte character. + We cansel to add state[0].follows to next state, because + state[0] must accept 1st-byte + + For example, we assume is a certain single byte + character, is a certain multibyte character, and the + codepoint of equals the 2nd byte of the codepoint of + . + When state[0] accepts , state[i] transit to state[i+1] + by accepting accepts 1st byte of , and state[i+1] + accepts 2nd byte of , if state[i+1] encounter the + codepoint of , it must not be but 2nd byte of + , so we can not add state[0]. */ + + next_isnt_1st_byte = 0; + for (j = 0; j < follows.nelem; ++j) + { + if (!(d->multibyte_prop[follows.elems[j].index] & 1)) + { + next_isnt_1st_byte = 1; + break; + } + } + } +#endif + + /* If we are building a searching matcher, throw in the positions + of state 0 as well. */ +#ifdef MBS_SUPPORT + if (d->searchflag && (MB_CUR_MAX == 1 || !next_isnt_1st_byte)) +#else + if (d->searchflag) +#endif + for (j = 0; j < d->states[0].elems.nelem; ++j) + insert(d->states[0].elems.elems[j], &follows); + + /* Find out if the new state will want any context information. */ + wants_newline = 0; + if (tstbit(eolbyte, labels[i])) + for (j = 0; j < follows.nelem; ++j) + if (PREV_NEWLINE_DEPENDENT(follows.elems[j].constraint)) + wants_newline = 1; + + wants_letter = 0; + for (j = 0; j < CHARCLASS_INTS; ++j) + if (labels[i][j] & letters[j]) + break; + if (j < CHARCLASS_INTS) + for (j = 0; j < follows.nelem; ++j) + if (PREV_LETTER_DEPENDENT(follows.elems[j].constraint)) + wants_letter = 1; + + /* Find the state(s) corresponding to the union of the follows. */ + state = state_index(d, &follows, 0, 0); + if (wants_newline) + state_newline = state_index(d, &follows, 1, 0); + else + state_newline = state; + if (wants_letter) + state_letter = state_index(d, &follows, 0, 1); + else + state_letter = state; + + /* Set the transitions for each character in the current label. */ + for (j = 0; j < CHARCLASS_INTS; ++j) + for (k = 0; k < INTBITS; ++k) + if (labels[i][j] & 1 << k) + { + int c = j * INTBITS + k; + + if (c == eolbyte) + trans[c] = state_newline; + else if (IS_WORD_CONSTITUENT(c)) + trans[c] = state_letter; + else if (c < NOTCHAR) + trans[c] = state; + } + } + + for (i = 0; i < ngrps; ++i) + free(grps[i].elems); + free(follows.elems); + free(tmp.elems); +} + +/* Some routines for manipulating a compiled dfa's transition tables. + Each state may or may not have a transition table; if it does, and it + is a non-accepting state, then d->trans[state] points to its table. + If it is an accepting state then d->fails[state] points to its table. + If it has no table at all, then d->trans[state] is NULL. + TODO: Improve this comment, get rid of the unnecessary redundancy. */ + +static void +build_state (int s, struct dfa *d) +{ + int *trans; /* The new transition table. */ + int i; + + /* Set an upper limit on the number of transition tables that will ever + exist at once. 1024 is arbitrary. The idea is that the frequently + used transition tables will be quickly rebuilt, whereas the ones that + were only needed once or twice will be cleared away. */ + if (d->trcount >= 1024) + { + for (i = 0; i < d->tralloc; ++i) + if (d->trans[i]) + { + free((ptr_t) d->trans[i]); + d->trans[i] = NULL; + } + else if (d->fails[i]) + { + free((ptr_t) d->fails[i]); + d->fails[i] = NULL; + } + d->trcount = 0; + } + + ++d->trcount; + + /* Set up the success bits for this state. */ + d->success[s] = 0; + if (ACCEPTS_IN_CONTEXT(d->states[s].newline, 1, d->states[s].letter, 0, + s, *d)) + d->success[s] |= 4; + if (ACCEPTS_IN_CONTEXT(d->states[s].newline, 0, d->states[s].letter, 1, + s, *d)) + d->success[s] |= 2; + if (ACCEPTS_IN_CONTEXT(d->states[s].newline, 0, d->states[s].letter, 0, + s, *d)) + d->success[s] |= 1; + + MALLOC(trans, int, NOTCHAR); + dfastate(s, d, trans); + + /* Now go through the new transition table, and make sure that the trans + and fail arrays are allocated large enough to hold a pointer for the + largest state mentioned in the table. */ + for (i = 0; i < NOTCHAR; ++i) + if (trans[i] >= d->tralloc) + { + int oldalloc = d->tralloc; + + while (trans[i] >= d->tralloc) + d->tralloc *= 2; + REALLOC(d->realtrans, int *, d->tralloc + 1); + d->trans = d->realtrans + 1; + REALLOC(d->fails, int *, d->tralloc); + REALLOC(d->success, int, d->tralloc); + while (oldalloc < d->tralloc) + { + d->trans[oldalloc] = NULL; + d->fails[oldalloc++] = NULL; + } + } + + /* Newline is a sentinel. */ + trans[eolbyte] = -1; + + if (ACCEPTING(s, *d)) + d->fails[s] = trans; + else + d->trans[s] = trans; +} + +static void +build_state_zero (struct dfa *d) +{ + d->tralloc = 1; + d->trcount = 0; + CALLOC(d->realtrans, int *, d->tralloc + 1); + d->trans = d->realtrans + 1; + CALLOC(d->fails, int *, d->tralloc); + MALLOC(d->success, int, d->tralloc); + build_state(0, d); +} + +#ifdef MBS_SUPPORT +/* Multibyte character handling sub-routines for dfaexec. */ + +/* Initial state may encounter the byte which is not a single byte character + nor 1st byte of a multibyte character. But it is incorrect for initial + state to accept such a byte. + For example, in sjis encoding the regular expression like "\\" accepts + the codepoint 0x5c, but should not accept the 2nd byte of the codepoint + 0x815c. Then Initial state must skip the bytes which are not a single byte + character nor 1st byte of a multibyte character. */ +#define SKIP_REMAINS_MB_IF_INITIAL_STATE(s, p) \ + if (s == 0) \ + { \ + while (inputwcs[p - buf_begin] == 0 \ + && mblen_buf[p - buf_begin] > 0 \ + && p < buf_end) \ + ++p; \ + if (p >= end) \ + { \ + free(mblen_buf); \ + free(inputwcs); \ + return (size_t) -1; \ + } \ + } + +static void +realloc_trans_if_necessary(struct dfa *d, int new_state) +{ + /* Make sure that the trans and fail arrays are allocated large enough + to hold a pointer for the new state. */ + if (new_state >= d->tralloc) + { + int oldalloc = d->tralloc; + + while (new_state >= d->tralloc) + d->tralloc *= 2; + REALLOC(d->realtrans, int *, d->tralloc + 1); + d->trans = d->realtrans + 1; + REALLOC(d->fails, int *, d->tralloc); + REALLOC(d->success, int, d->tralloc); + while (oldalloc < d->tralloc) + { + d->trans[oldalloc] = NULL; + d->fails[oldalloc++] = NULL; + } + } +} + +/* Return values of transit_state_singlebyte(), and + transit_state_consume_1char. */ +typedef enum +{ + TRANSIT_STATE_IN_PROGRESS, /* State transition has not finished. */ + TRANSIT_STATE_DONE, /* State transition has finished. */ + TRANSIT_STATE_END_BUFFER /* Reach the end of the buffer. */ +} status_transit_state; + +/* Consume a single byte and transit state from 's' to '*next_state'. + This function is almost same as the state transition routin in dfaexec(). + But state transition is done just once, otherwise matching succeed or + reach the end of the buffer. */ +static status_transit_state +transit_state_singlebyte (struct dfa *d, int s, unsigned char const *p, + int *next_state) +{ + int *t; + int works = s; + + status_transit_state rval = TRANSIT_STATE_IN_PROGRESS; + + while (rval == TRANSIT_STATE_IN_PROGRESS) + { + if ((t = d->trans[works]) != NULL) + { + works = t[*p]; + rval = TRANSIT_STATE_DONE; + if (works < 0) + works = 0; + } + else if (works < 0) + { + if (p == buf_end) + /* At the moment, it must not happen. */ + return TRANSIT_STATE_END_BUFFER; + works = 0; + } + else if (d->fails[works]) + { + works = d->fails[works][*p]; + rval = TRANSIT_STATE_DONE; + } + else + { + build_state(works, d); + } + } + *next_state = works; + return rval; +} + +/* Check whether period can match or not in the current context. If it can, + return the amount of the bytes with which period can match, otherwise + return 0. + `pos' is the position of the period. `index' is the index from the + buf_begin, and it is the current position in the buffer. */ +static int +match_anychar (struct dfa *d, int s, position pos, int index) +{ + int newline = 0; + int letter = 0; + wchar_t wc; + int mbclen; + + wc = inputwcs[index]; + mbclen = (mblen_buf[index] == 0)? 1 : mblen_buf[index]; + + /* Check context. */ + if (wc == (wchar_t)eolbyte) + { + if (!(syntax_bits & RE_DOT_NEWLINE)) + return 0; + newline = 1; + } + else if (wc == (wchar_t)'\0') + { + if (syntax_bits & RE_DOT_NOT_NULL) + return 0; + newline = 1; + } + + if (iswalnum(wc) || wc == L'_') + letter = 1; + + if (!SUCCEEDS_IN_CONTEXT(pos.constraint, d->states[s].newline, + newline, d->states[s].letter, letter)) + return 0; + + return mbclen; +} + +/* Check whether bracket expression can match or not in the current context. + If it can, return the amount of the bytes with which expression can match, + otherwise return 0. + `pos' is the position of the bracket expression. `index' is the index + from the buf_begin, and it is the current position in the buffer. */ +int +match_mb_charset (struct dfa *d, int s, position pos, int index) +{ + int i; + int match; /* Flag which represent that matching succeed. */ + int match_len; /* Length of the character (or collating element) + with which this operator match. */ + int op_len; /* Length of the operator. */ + char buffer[128]; + wchar_t wcbuf[6]; + + /* Pointer to the structure to which we are currently refering. */ + struct mb_char_classes *work_mbc; + + int newline = 0; + int letter = 0; + wchar_t wc; /* Current refering character. */ + + wc = inputwcs[index]; + + /* Check context. */ + if (wc == (wchar_t)eolbyte) + { + if (!(syntax_bits & RE_DOT_NEWLINE)) + return 0; + newline = 1; + } + else if (wc == (wchar_t)'\0') + { + if (syntax_bits & RE_DOT_NOT_NULL) + return 0; + newline = 1; + } + if (iswalnum(wc) || wc == L'_') + letter = 1; + if (!SUCCEEDS_IN_CONTEXT(pos.constraint, d->states[s].newline, + newline, d->states[s].letter, letter)) + return 0; + + /* Assign the current refering operator to work_mbc. */ + work_mbc = &(d->mbcsets[(d->multibyte_prop[pos.index]) >> 2]); + match = !work_mbc->invert; + match_len = (mblen_buf[index] == 0)? 1 : mblen_buf[index]; + + /* match with a character class? */ + for (i = 0; inch_classes; i++) + { + if (iswctype((wint_t)wc, work_mbc->ch_classes[i])) + goto charset_matched; + } + + strncpy(buffer, buf_begin + index, match_len); + buffer[match_len] = '\0'; + + /* match with an equivalent class? */ + for (i = 0; inequivs; i++) + { + op_len = strlen(work_mbc->equivs[i]); + strncpy(buffer, buf_begin + index, op_len); + buffer[op_len] = '\0'; + if (strcoll(work_mbc->equivs[i], buffer) == 0) + { + match_len = op_len; + goto charset_matched; + } + } + + /* match with a collating element? */ + for (i = 0; incoll_elems; i++) + { + op_len = strlen(work_mbc->coll_elems[i]); + strncpy(buffer, buf_begin + index, op_len); + buffer[op_len] = '\0'; + + if (strcoll(work_mbc->coll_elems[i], buffer) == 0) + { + match_len = op_len; + goto charset_matched; + } + } + + wcbuf[0] = wc; + wcbuf[1] = wcbuf[3] = wcbuf[5] = '\0'; + + /* match with a range? */ + for (i = 0; inranges; i++) + { + wcbuf[2] = work_mbc->range_sts[i]; + wcbuf[4] = work_mbc->range_ends[i]; + + if (wcscoll(wcbuf, wcbuf+2) >= 0 && + wcscoll(wcbuf+4, wcbuf) >= 0) + goto charset_matched; + } + + /* match with a character? */ + for (i = 0; inchars; i++) + { + if (wc == work_mbc->chars[i]) + goto charset_matched; + } + + match = !match; + + charset_matched: + return match ? match_len : 0; +} + +/* Check each of `d->states[s].mbps.elem' can match or not. Then return the + array which corresponds to `d->states[s].mbps.elem' and each element of + the array contains the amount of the bytes with which the element can + match. + `index' is the index from the buf_begin, and it is the current position + in the buffer. + Caller MUST free the array which this function return. */ +static int* +check_matching_with_multibyte_ops (struct dfa *d, int s, int index) +{ + int i; + int* rarray; + + MALLOC(rarray, int, d->states[s].mbps.nelem); + for (i = 0; i < d->states[s].mbps.nelem; ++i) + { + position pos = d->states[s].mbps.elems[i]; + switch(d->tokens[pos.index]) + { + case ANYCHAR: + rarray[i] = match_anychar(d, s, pos, index); + break; + case MBCSET: + rarray[i] = match_mb_charset(d, s, pos, index); + break; + default: + break; /* can not happen. */ + } + } + return rarray; +} + +/* Consume a single character and enumerate all of the positions which can + be next position from the state `s'. + `match_lens' is the input. It can be NULL, but it can also be the output + of check_matching_with_multibyte_ops() for optimization. + `mbclen' and `pps' are the output. `mbclen' is the length of the + character consumed, and `pps' is the set this function enumerate. */ +static status_transit_state +transit_state_consume_1char (struct dfa *d, int s, unsigned char const **pp, + int *match_lens, int *mbclen, position_set *pps) +{ + int i, j; + int s1, s2; + int* work_mbls; + status_transit_state rs = TRANSIT_STATE_DONE; + + /* Calculate the length of the (single/multi byte) character + to which p points. */ + *mbclen = (mblen_buf[*pp - buf_begin] == 0)? 1 + : mblen_buf[*pp - buf_begin]; + + /* Calculate the state which can be reached from the state `s' by + consuming `*mbclen' single bytes from the buffer. */ + s1 = s; + for (i = 0; i < *mbclen; i++) + { + s2 = s1; + rs = transit_state_singlebyte(d, s2, (*pp)++, &s1); + } + /* Copy the positions contained by `s1' to the set `pps'. */ + copy(&(d->states[s1].elems), pps); + + /* Check (inputed)match_lens, and initialize if it is NULL. */ + if (match_lens == NULL && d->states[s].mbps.nelem != 0) + work_mbls = check_matching_with_multibyte_ops(d, s, *pp - buf_begin); + else + work_mbls = match_lens; + + /* Add all of the positions which can be reached from `s' by consuming + a single character. */ + for (i = 0; i < d->states[s].mbps.nelem ; i++) + { + if (work_mbls[i] == *mbclen) + for (j = 0; j < d->follows[d->states[s].mbps.elems[i].index].nelem; + j++) + insert(d->follows[d->states[s].mbps.elems[i].index].elems[j], + pps); + } + + if (match_lens == NULL && work_mbls != NULL) + free(work_mbls); + return rs; +} + +/* Transit state from s, then return new state and update the pointer of the + buffer. This function is for some operator which can match with a multi- + byte character or a collating element (which may be multi characters). */ +static int +transit_state (struct dfa *d, int s, unsigned char const **pp) +{ + int s1; + int mbclen; /* The length of current input multibyte character. */ + int maxlen = 0; + int i, j; + int *match_lens = NULL; + int nelem = d->states[s].mbps.nelem; /* Just a alias. */ + position_set follows; + unsigned char const *p1 = *pp; + status_transit_state rs; + wchar_t wc; + + if (nelem > 0) + /* This state has (a) multibyte operator(s). + We check whether each of them can match or not. */ + { + /* Note: caller must free the return value of this function. */ + match_lens = check_matching_with_multibyte_ops(d, s, *pp - buf_begin); + + for (i = 0; i < nelem; i++) + /* Search the operator which match the longest string, + in this state. */ + { + if (match_lens[i] > maxlen) + maxlen = match_lens[i]; + } + } + + if (nelem == 0 || maxlen == 0) + /* This state has no multibyte operator which can match. + We need to check only one single byte character. */ + { + status_transit_state rs; + rs = transit_state_singlebyte(d, s, *pp, &s1); + + /* We must update the pointer if state transition succeeded. */ + if (rs == TRANSIT_STATE_DONE) + ++*pp; + + if (match_lens != NULL) + free(match_lens); + return s1; + } + + /* This state has some operators which can match a multibyte character. */ + follows.nelem = 0; + MALLOC(follows.elems, position, d->nleaves); + + /* `maxlen' may be longer than the length of a character, because it may + not be a character but a (multi character) collating element. + We enumerate all of the positions which `s' can reach by consuming + `maxlen' bytes. */ + rs = transit_state_consume_1char(d, s, pp, match_lens, &mbclen, &follows); + + wc = inputwcs[*pp - mbclen - buf_begin]; + s1 = state_index(d, &follows, wc == L'\n', iswalnum(wc)); + realloc_trans_if_necessary(d, s1); + + while (*pp - p1 < maxlen) + { + follows.nelem = 0; + rs = transit_state_consume_1char(d, s1, pp, NULL, &mbclen, &follows); + + for (i = 0; i < nelem ; i++) + { + if (match_lens[i] == *pp - p1) + for (j = 0; + j < d->follows[d->states[s1].mbps.elems[i].index].nelem; j++) + insert(d->follows[d->states[s1].mbps.elems[i].index].elems[j], + &follows); + } + + wc = inputwcs[*pp - mbclen - buf_begin]; + s1 = state_index(d, &follows, wc == L'\n', iswalnum(wc)); + realloc_trans_if_necessary(d, s1); + } + free(match_lens); + free(follows.elems); + return s1; +} + +#endif /* MBS_SUPPORT */ + +/* Search through a buffer looking for a match to the given struct dfa. + Find the first occurrence of a string matching the regexp in the buffer, + and the shortest possible version thereof. Return the offset of the first + character after the match, or (size_t) -1 if none is found. BEGIN points to + the beginning of the buffer, and SIZE is the size of the buffer. If SIZE + is nonzero, BEGIN[SIZE - 1] must be a newline. BACKREF points to a place + where we're supposed to store a 1 if backreferencing happened and the + match needs to be verified by a backtracking matcher. Otherwise + we store a 0 in *backref. */ +size_t +dfaexec (struct dfa *d, char const *begin, size_t size, int *backref) +{ + register int s; /* Current state. */ + register unsigned char const *p; /* Current input character. */ + register unsigned char const *end; /* One past the last input character. */ + register int **trans, *t; /* Copy of d->trans so it can be optimized + into a register. */ + register unsigned char eol = eolbyte; /* Likewise for eolbyte. */ + static int sbit[NOTCHAR]; /* Table for anding with d->success. */ + static int sbit_init; + + if (! sbit_init) + { + int i; + + sbit_init = 1; + for (i = 0; i < NOTCHAR; ++i) + sbit[i] = (IS_WORD_CONSTITUENT(i)) ? 2 : 1; + sbit[eol] = 4; + } + + if (! d->tralloc) + build_state_zero(d); + + s = 0; + p = (unsigned char const *) begin; + end = p + size; + trans = d->trans; + +#ifdef MBS_SUPPORT + if (MB_CUR_MAX > 1) + { + int remain_bytes, i; + buf_begin = begin; + buf_end = end; + + /* initialize mblen_buf, and inputwcs. */ + MALLOC(mblen_buf, unsigned char, end - (unsigned char const *)begin + 2); + MALLOC(inputwcs, wchar_t, end - (unsigned char const *)begin + 2); + memset(&mbs, 0, sizeof(mbstate_t)); + remain_bytes = 0; + for (i = 0; i < end - (unsigned char const *)begin + 1; i++) + { + if (remain_bytes == 0) + { + remain_bytes + = mbrtowc(inputwcs + i, begin + i, + end - (unsigned char const *)begin - i + 1, &mbs); + if (remain_bytes <= 1) + { + remain_bytes = 0; + inputwcs[i] = (wchar_t)begin[i]; + mblen_buf[i] = 0; + } + else + { + mblen_buf[i] = remain_bytes; + remain_bytes--; + } + } + else + { + mblen_buf[i] = remain_bytes; + inputwcs[i] = 0; + remain_bytes--; + } + } + mblen_buf[i] = 0; + inputwcs[i] = 0; /* sentinel */ + } +#endif /* MBS_SUPPORT */ + + for (;;) + { +#ifdef MBS_SUPPORT + if (MB_CUR_MAX > 1) + while ((t = trans[s])) + { + if (d->states[s].mbps.nelem != 0) + { + /* Can match with a multibyte character (and multi character + collating element). */ + unsigned char const *nextp; + + SKIP_REMAINS_MB_IF_INITIAL_STATE(s, p); + + nextp = p; + s = transit_state(d, s, &nextp); + p = nextp; + + /* Trans table might be updated. */ + trans = d->trans; + } + else + { + SKIP_REMAINS_MB_IF_INITIAL_STATE(s, p); + s = t[*p++]; + } + } + else +#endif /* MBS_SUPPORT */ + while ((t = trans[s])) + s = t[*p++]; + + if (s < 0) + { + if (p == end) + { +#ifdef MBS_SUPPORT + if (MB_CUR_MAX > 1) + { + free(mblen_buf); + free(inputwcs); + } +#endif /* MBS_SUPPORT */ + return (size_t) -1; + } + s = 0; + } + else if ((t = d->fails[s])) + { + if (d->success[s] & sbit[*p]) + { + if (backref) + *backref = (d->states[s].backref != 0); +#ifdef MBS_SUPPORT + if (MB_CUR_MAX > 1) + { + free(mblen_buf); + free(inputwcs); + } +#endif /* MBS_SUPPORT */ + return (char const *) p - begin; + } + +#ifdef MBS_SUPPORT + if (MB_CUR_MAX > 1) + { + SKIP_REMAINS_MB_IF_INITIAL_STATE(s, p); + if (d->states[s].mbps.nelem != 0) + { + /* Can match with a multibyte character (and multi + character collating element). */ + unsigned char const *nextp; + nextp = p; + s = transit_state(d, s, &nextp); + p = nextp; + + /* Trans table might be updated. */ + trans = d->trans; + } + else + s = t[*p++]; + } + else +#endif /* MBS_SUPPORT */ + s = t[*p++]; + } + else + { + build_state(s, d); + trans = d->trans; + } + } +} + +/* Initialize the components of a dfa that the other routines don't + initialize for themselves. */ +void +dfainit (struct dfa *d) +{ + d->calloc = 1; + MALLOC(d->charclasses, charclass, d->calloc); + d->cindex = 0; + + d->talloc = 1; + MALLOC(d->tokens, token, d->talloc); + d->tindex = d->depth = d->nleaves = d->nregexps = 0; +#ifdef MBS_SUPPORT + if (MB_CUR_MAX > 1) + { + d->nmultibyte_prop = 1; + MALLOC(d->multibyte_prop, int, d->nmultibyte_prop); + d->nmbcsets = 0; + d->mbcsets_alloc = 1; + MALLOC(d->mbcsets, struct mb_char_classes, d->mbcsets_alloc); + } +#endif + + d->searchflag = 0; + d->tralloc = 0; + + d->musts = 0; +} + +/* Parse and analyze a single string of the given length. */ +void +dfacomp (char const *s, size_t len, struct dfa *d, int searchflag) +{ + if (case_fold) /* dummy folding in service of dfamust() */ + { + char *lcopy; + int i; + + lcopy = malloc(len); + if (!lcopy) + dfaerror(_("memory exhausted")); + + /* This is a kludge. */ + case_fold = 0; + for (i = 0; i < len; ++i) + if (ISUPPER ((unsigned char) s[i])) + lcopy[i] = tolower ((unsigned char) s[i]); + else + lcopy[i] = s[i]; + + dfainit(d); + dfaparse(lcopy, len, d); + free(lcopy); + dfamust(d); + d->cindex = d->tindex = d->depth = d->nleaves = d->nregexps = 0; + case_fold = 1; + dfaparse(s, len, d); + dfaanalyze(d, searchflag); + } + else + { + dfainit(d); + dfaparse(s, len, d); + dfamust(d); + dfaanalyze(d, searchflag); + } +} + +/* Free the storage held by the components of a dfa. */ +void +dfafree (struct dfa *d) +{ + int i; + struct dfamust *dm, *ndm; + + free((ptr_t) d->charclasses); + free((ptr_t) d->tokens); + +#ifdef MBS_SUPPORT + if (MB_CUR_MAX > 1) + { + free((ptr_t) d->multibyte_prop); + for (i = 0; i < d->nmbcsets; ++i) + { + int j; + struct mb_char_classes *p = &(d->mbcsets[i]); + if (p->chars != NULL) + free(p->chars); + if (p->ch_classes != NULL) + free(p->ch_classes); + if (p->range_sts != NULL) + free(p->range_sts); + if (p->range_ends != NULL) + free(p->range_ends); + + for (j = 0; j < p->nequivs; ++j) + free(p->equivs[j]); + if (p->equivs != NULL) + free(p->equivs); + + for (j = 0; j < p->ncoll_elems; ++j) + free(p->coll_elems[j]); + if (p->coll_elems != NULL) + free(p->coll_elems); + } + free((ptr_t) d->mbcsets); + } +#endif /* MBS_SUPPORT */ + + for (i = 0; i < d->sindex; ++i) + free((ptr_t) d->states[i].elems.elems); + free((ptr_t) d->states); + for (i = 0; i < d->tindex; ++i) + if (d->follows[i].elems) + free((ptr_t) d->follows[i].elems); + free((ptr_t) d->follows); + for (i = 0; i < d->tralloc; ++i) + if (d->trans[i]) + free((ptr_t) d->trans[i]); + else if (d->fails[i]) + free((ptr_t) d->fails[i]); + if (d->realtrans) free((ptr_t) d->realtrans); + if (d->fails) free((ptr_t) d->fails); + if (d->success) free((ptr_t) d->success); + for (dm = d->musts; dm; dm = ndm) + { + ndm = dm->next; + free(dm->must); + free((ptr_t) dm); + } +} + +/* Having found the postfix representation of the regular expression, + try to find a long sequence of characters that must appear in any line + containing the r.e. + Finding a "longest" sequence is beyond the scope here; + we take an easy way out and hope for the best. + (Take "(ab|a)b"--please.) + + We do a bottom-up calculation of sequences of characters that must appear + in matches of r.e.'s represented by trees rooted at the nodes of the postfix + representation: + sequences that must appear at the left of the match ("left") + sequences that must appear at the right of the match ("right") + lists of sequences that must appear somewhere in the match ("in") + sequences that must constitute the match ("is") + + When we get to the root of the tree, we use one of the longest of its + calculated "in" sequences as our answer. The sequence we find is returned in + d->must (where "d" is the single argument passed to "dfamust"); + the length of the sequence is returned in d->mustn. + + The sequences calculated for the various types of node (in pseudo ANSI c) + are shown below. "p" is the operand of unary operators (and the left-hand + operand of binary operators); "q" is the right-hand operand of binary + operators. + + "ZERO" means "a zero-length sequence" below. + + Type left right is in + ---- ---- ----- -- -- + char c # c # c # c # c + + ANYCHAR ZERO ZERO ZERO ZERO + + MBCSET ZERO ZERO ZERO ZERO + + CSET ZERO ZERO ZERO ZERO + + STAR ZERO ZERO ZERO ZERO + + QMARK ZERO ZERO ZERO ZERO + + PLUS p->left p->right ZERO p->in + + CAT (p->is==ZERO)? (q->is==ZERO)? (p->is!=ZERO && p->in plus + p->left : q->right : q->is!=ZERO) ? q->in plus + p->is##q->left p->right##q->is p->is##q->is : p->right##q->left + ZERO + + OR longest common longest common (do p->is and substrings common to + leading trailing q->is have same p->in and q->in + (sub)sequence (sub)sequence length and + of p->left of p->right content) ? + and q->left and q->right p->is : NULL + + If there's anything else we recognize in the tree, all four sequences get set + to zero-length sequences. If there's something we don't recognize in the tree, + we just return a zero-length sequence. + + Break ties in favor of infrequent letters (choosing 'zzz' in preference to + 'aaa')? + + And. . .is it here or someplace that we might ponder "optimizations" such as + egrep 'psi|epsilon' -> egrep 'psi' + egrep 'pepsi|epsilon' -> egrep 'epsi' + (Yes, we now find "epsi" as a "string + that must occur", but we might also + simplify the *entire* r.e. being sought) + grep '[c]' -> grep 'c' + grep '(ab|a)b' -> grep 'ab' + grep 'ab*' -> grep 'a' + grep 'a*b' -> grep 'b' + + There are several issues: + + Is optimization easy (enough)? + + Does optimization actually accomplish anything, + or is the automaton you get from "psi|epsilon" (for example) + the same as the one you get from "psi" (for example)? + + Are optimizable r.e.'s likely to be used in real-life situations + (something like 'ab*' is probably unlikely; something like is + 'psi|epsilon' is likelier)? */ + +static char * +icatalloc (char *old, char *new) +{ + char *result; + size_t oldsize, newsize; + + newsize = (new == NULL) ? 0 : strlen(new); + if (old == NULL) + oldsize = 0; + else if (newsize == 0) + return old; + else oldsize = strlen(old); + if (old == NULL) + result = (char *) malloc(newsize + 1); + else + result = (char *) realloc((void *) old, oldsize + newsize + 1); + if (result != NULL && new != NULL) + (void) strcpy(result + oldsize, new); + return result; +} + +static char * +icpyalloc (char *string) +{ + return icatalloc((char *) NULL, string); +} + +static char * +istrstr (char *lookin, char *lookfor) +{ + char *cp; + size_t len; + + len = strlen(lookfor); + for (cp = lookin; *cp != '\0'; ++cp) + if (strncmp(cp, lookfor, len) == 0) + return cp; + return NULL; +} + +static void +ifree (char *cp) +{ + if (cp != NULL) + free(cp); +} + +static void +freelist (char **cpp) +{ + int i; + + if (cpp == NULL) + return; + for (i = 0; cpp[i] != NULL; ++i) + { + free(cpp[i]); + cpp[i] = NULL; + } +} + +static char ** +enlist (char **cpp, char *new, size_t len) +{ + int i, j; + + if (cpp == NULL) + return NULL; + if ((new = icpyalloc(new)) == NULL) + { + freelist(cpp); + return NULL; + } + new[len] = '\0'; + /* Is there already something in the list that's new (or longer)? */ + for (i = 0; cpp[i] != NULL; ++i) + if (istrstr(cpp[i], new) != NULL) + { + free(new); + return cpp; + } + /* Eliminate any obsoleted strings. */ + j = 0; + while (cpp[j] != NULL) + if (istrstr(new, cpp[j]) == NULL) + ++j; + else + { + free(cpp[j]); + if (--i == j) + break; + cpp[j] = cpp[i]; + cpp[i] = NULL; + } + /* Add the new string. */ + cpp = (char **) realloc((char *) cpp, (i + 2) * sizeof *cpp); + if (cpp == NULL) + return NULL; + cpp[i] = new; + cpp[i + 1] = NULL; + return cpp; +} + +/* Given pointers to two strings, return a pointer to an allocated + list of their distinct common substrings. Return NULL if something + seems wild. */ +static char ** +comsubs (char *left, char *right) +{ + char **cpp; + char *lcp; + char *rcp; + size_t i, len; + + if (left == NULL || right == NULL) + return NULL; + cpp = (char **) malloc(sizeof *cpp); + if (cpp == NULL) + return NULL; + cpp[0] = NULL; + for (lcp = left; *lcp != '\0'; ++lcp) + { + len = 0; + rcp = strchr (right, *lcp); + while (rcp != NULL) + { + for (i = 1; lcp[i] != '\0' && lcp[i] == rcp[i]; ++i) + continue; + if (i > len) + len = i; + rcp = strchr (rcp + 1, *lcp); + } + if (len == 0) + continue; + if ((cpp = enlist(cpp, lcp, len)) == NULL) + break; + } + return cpp; +} + +static char ** +addlists (char **old, char **new) +{ + int i; + + if (old == NULL || new == NULL) + return NULL; + for (i = 0; new[i] != NULL; ++i) + { + old = enlist(old, new[i], strlen(new[i])); + if (old == NULL) + break; + } + return old; +} + +/* Given two lists of substrings, return a new list giving substrings + common to both. */ +static char ** +inboth (char **left, char **right) +{ + char **both; + char **temp; + int lnum, rnum; + + if (left == NULL || right == NULL) + return NULL; + both = (char **) malloc(sizeof *both); + if (both == NULL) + return NULL; + both[0] = NULL; + for (lnum = 0; left[lnum] != NULL; ++lnum) + { + for (rnum = 0; right[rnum] != NULL; ++rnum) + { + temp = comsubs(left[lnum], right[rnum]); + if (temp == NULL) + { + freelist(both); + return NULL; + } + both = addlists(both, temp); + freelist(temp); + free(temp); + if (both == NULL) + return NULL; + } + } + return both; +} + +typedef struct +{ + char **in; + char *left; + char *right; + char *is; +} must; + +static void +resetmust (must *mp) +{ + mp->left[0] = mp->right[0] = mp->is[0] = '\0'; + freelist(mp->in); +} + +static void +dfamust (struct dfa *dfa) +{ + must *musts; + must *mp; + char *result; + int ri; + int i; + int exact; + token t; + static must must0; + struct dfamust *dm; + static char empty_string[] = ""; + + result = empty_string; + exact = 0; + musts = (must *) malloc((dfa->tindex + 1) * sizeof *musts); + if (musts == NULL) + return; + mp = musts; + for (i = 0; i <= dfa->tindex; ++i) + mp[i] = must0; + for (i = 0; i <= dfa->tindex; ++i) + { + mp[i].in = (char **) malloc(sizeof *mp[i].in); + mp[i].left = malloc(2); + mp[i].right = malloc(2); + mp[i].is = malloc(2); + if (mp[i].in == NULL || mp[i].left == NULL || + mp[i].right == NULL || mp[i].is == NULL) + goto done; + mp[i].left[0] = mp[i].right[0] = mp[i].is[0] = '\0'; + mp[i].in[0] = NULL; + } +#ifdef DEBUG + fprintf(stderr, "dfamust:\n"); + for (i = 0; i < dfa->tindex; ++i) + { + fprintf(stderr, " %d:", i); + prtok(dfa->tokens[i]); + } + putc('\n', stderr); +#endif + for (ri = 0; ri < dfa->tindex; ++ri) + { + switch (t = dfa->tokens[ri]) + { + case LPAREN: + case RPAREN: + goto done; /* "cannot happen" */ + case EMPTY: + case BEGLINE: + case ENDLINE: + case BEGWORD: + case ENDWORD: + case LIMWORD: + case NOTLIMWORD: + case BACKREF: + resetmust(mp); + break; + case STAR: + case QMARK: + if (mp <= musts) + goto done; /* "cannot happen" */ + --mp; + resetmust(mp); + break; + case OR: + case ORTOP: + if (mp < &musts[2]) + goto done; /* "cannot happen" */ + { + char **new; + must *lmp; + must *rmp; + int j, ln, rn, n; + + rmp = --mp; + lmp = --mp; + /* Guaranteed to be. Unlikely, but. . . */ + if (strcmp(lmp->is, rmp->is) != 0) + lmp->is[0] = '\0'; + /* Left side--easy */ + i = 0; + while (lmp->left[i] != '\0' && lmp->left[i] == rmp->left[i]) + ++i; + lmp->left[i] = '\0'; + /* Right side */ + ln = strlen(lmp->right); + rn = strlen(rmp->right); + n = ln; + if (n > rn) + n = rn; + for (i = 0; i < n; ++i) + if (lmp->right[ln - i - 1] != rmp->right[rn - i - 1]) + break; + for (j = 0; j < i; ++j) + lmp->right[j] = lmp->right[(ln - i) + j]; + lmp->right[j] = '\0'; + new = inboth(lmp->in, rmp->in); + if (new == NULL) + goto done; + freelist(lmp->in); + free((char *) lmp->in); + lmp->in = new; + } + break; + case PLUS: + if (mp <= musts) + goto done; /* "cannot happen" */ + --mp; + mp->is[0] = '\0'; + break; + case END: + if (mp != &musts[1]) + goto done; /* "cannot happen" */ + for (i = 0; musts[0].in[i] != NULL; ++i) + if (strlen(musts[0].in[i]) > strlen(result)) + result = musts[0].in[i]; + if (strcmp(result, musts[0].is) == 0) + exact = 1; + goto done; + case CAT: + if (mp < &musts[2]) + goto done; /* "cannot happen" */ + { + must *lmp; + must *rmp; + + rmp = --mp; + lmp = --mp; + /* In. Everything in left, plus everything in + right, plus catenation of + left's right and right's left. */ + lmp->in = addlists(lmp->in, rmp->in); + if (lmp->in == NULL) + goto done; + if (lmp->right[0] != '\0' && + rmp->left[0] != '\0') + { + char *tp; + + tp = icpyalloc(lmp->right); + if (tp == NULL) + goto done; + tp = icatalloc(tp, rmp->left); + if (tp == NULL) + goto done; + lmp->in = enlist(lmp->in, tp, + strlen(tp)); + free(tp); + if (lmp->in == NULL) + goto done; + } + /* Left-hand */ + if (lmp->is[0] != '\0') + { + lmp->left = icatalloc(lmp->left, + rmp->left); + if (lmp->left == NULL) + goto done; + } + /* Right-hand */ + if (rmp->is[0] == '\0') + lmp->right[0] = '\0'; + lmp->right = icatalloc(lmp->right, rmp->right); + if (lmp->right == NULL) + goto done; + /* Guaranteed to be */ + if (lmp->is[0] != '\0' && rmp->is[0] != '\0') + { + lmp->is = icatalloc(lmp->is, rmp->is); + if (lmp->is == NULL) + goto done; + } + else + lmp->is[0] = '\0'; + } + break; + default: + if (t < END) + { + /* "cannot happen" */ + goto done; + } + else if (t == '\0') + { + /* not on *my* shift */ + goto done; + } + else if (t >= CSET +#ifdef MBS_SUPPORT + || t == ANYCHAR + || t == MBCSET +#endif /* MBS_SUPPORT */ + ) + { + /* easy enough */ + resetmust(mp); + } + else + { + /* plain character */ + resetmust(mp); + mp->is[0] = mp->left[0] = mp->right[0] = t; + mp->is[1] = mp->left[1] = mp->right[1] = '\0'; + mp->in = enlist(mp->in, mp->is, (size_t)1); + if (mp->in == NULL) + goto done; + } + break; + } +#ifdef DEBUG + fprintf(stderr, " node: %d:", ri); + prtok(dfa->tokens[ri]); + fprintf(stderr, "\n in:"); + for (i = 0; mp->in[i]; ++i) + fprintf(stderr, " \"%s\"", mp->in[i]); + fprintf(stderr, "\n is: \"%s\"\n", mp->is); + fprintf(stderr, " left: \"%s\"\n", mp->left); + fprintf(stderr, " right: \"%s\"\n", mp->right); +#endif + ++mp; + } + done: + if (strlen(result)) + { + MALLOC(dm, struct dfamust, 1); + dm->exact = exact; + MALLOC(dm->must, char, strlen(result) + 1); + strcpy(dm->must, result); + dm->next = dfa->musts; + dfa->musts = dm; + } + mp = musts; + for (i = 0; i <= dfa->tindex; ++i) + { + freelist(mp[i].in); + ifree((char *) mp[i].in); + ifree(mp[i].left); + ifree(mp[i].right); + ifree(mp[i].is); + } + free((char *) mp); +} +/* vim:set shiftwidth=2: */ diff --git a/src/dfa.h b/src/dfa.h new file mode 100644 index 0000000..ee21391 --- /dev/null +++ b/src/dfa.h @@ -0,0 +1,433 @@ +/* dfa.h - declarations for GNU deterministic regexp compiler + Copyright (C) 1988, 1998 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., + 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA */ + +/* Written June, 1988 by Mike Haertel */ + +/* FIXME: + 2. We should not export so much of the DFA internals. + In addition to clobbering modularity, we eat up valuable + name space. */ + +#ifdef __STDC__ +# ifndef _PTR_T +# define _PTR_T + typedef void * ptr_t; +# endif +#else +# ifndef _PTR_T +# define _PTR_T + typedef char * ptr_t; +# endif +#endif + +#ifdef PARAMS +# undef PARAMS +#endif +#if PROTOTYPES +# define PARAMS(x) x +#else +# define PARAMS(x) () +#endif + +/* Number of bits in an unsigned char. */ +#ifndef CHARBITS +#define CHARBITS 8 +#endif + +/* First integer value that is greater than any character code. */ +#define NOTCHAR (1 << CHARBITS) + +/* INTBITS need not be exact, just a lower bound. */ +#ifndef INTBITS +#define INTBITS (CHARBITS * sizeof (int)) +#endif + +/* Number of ints required to hold a bit for every character. */ +#define CHARCLASS_INTS ((NOTCHAR + INTBITS - 1) / INTBITS) + +/* Sets of unsigned characters are stored as bit vectors in arrays of ints. */ +typedef int charclass[CHARCLASS_INTS]; + +/* The regexp is parsed into an array of tokens in postfix form. Some tokens + are operators and others are terminal symbols. Most (but not all) of these + codes are returned by the lexical analyzer. */ + +typedef enum +{ + END = -1, /* END is a terminal symbol that matches the + end of input; any value of END or less in + the parse tree is such a symbol. Accepting + states of the DFA are those that would have + a transition on END. */ + + /* Ordinary character values are terminal symbols that match themselves. */ + + EMPTY = NOTCHAR, /* EMPTY is a terminal symbol that matches + the empty string. */ + + BACKREF, /* BACKREF is generated by \; it + it not completely handled. If the scanner + detects a transition on backref, it returns + a kind of "semi-success" indicating that + the match will have to be verified with + a backtracking matcher. */ + + BEGLINE, /* BEGLINE is a terminal symbol that matches + the empty string if it is at the beginning + of a line. */ + + ENDLINE, /* ENDLINE is a terminal symbol that matches + the empty string if it is at the end of + a line. */ + + BEGWORD, /* BEGWORD is a terminal symbol that matches + the empty string if it is at the beginning + of a word. */ + + ENDWORD, /* ENDWORD is a terminal symbol that matches + the empty string if it is at the end of + a word. */ + + LIMWORD, /* LIMWORD is a terminal symbol that matches + the empty string if it is at the beginning + or the end of a word. */ + + NOTLIMWORD, /* NOTLIMWORD is a terminal symbol that + matches the empty string if it is not at + the beginning or end of a word. */ + + QMARK, /* QMARK is an operator of one argument that + matches zero or one occurences of its + argument. */ + + STAR, /* STAR is an operator of one argument that + matches the Kleene closure (zero or more + occurrences) of its argument. */ + + PLUS, /* PLUS is an operator of one argument that + matches the positive closure (one or more + occurrences) of its argument. */ + + REPMN, /* REPMN is a lexical token corresponding + to the {m,n} construct. REPMN never + appears in the compiled token vector. */ + + CAT, /* CAT is an operator of two arguments that + matches the concatenation of its + arguments. CAT is never returned by the + lexical analyzer. */ + + OR, /* OR is an operator of two arguments that + matches either of its arguments. */ + + ORTOP, /* OR at the toplevel in the parse tree. + This is used for a boyer-moore heuristic. */ + + LPAREN, /* LPAREN never appears in the parse tree, + it is only a lexeme. */ + + RPAREN, /* RPAREN never appears in the parse tree. */ + + CRANGE, /* CRANGE never appears in the parse tree. + It stands for a character range that can + match a string of one or more characters. + For example, [a-z] can match "ch" in + a Spanish locale. */ + +#ifdef MBS_SUPPORT + ANYCHAR, /* ANYCHAR is a terminal symbol that matches + any multibyte (or single byte) characters. + It is used only if MB_CUR_MAX > 1. */ + + MBCSET, /* MBCSET is similar to CSET, but for + multibyte characters. */ +#endif /* MBS_SUPPORT */ + + CSET /* CSET and (and any value greater) is a + terminal symbol that matches any of a + class of characters. */ +} token; + +/* Sets are stored in an array in the compiled dfa; the index of the + array corresponding to a given set token is given by SET_INDEX(t). */ +#define SET_INDEX(t) ((t) - CSET) + +/* Sometimes characters can only be matched depending on the surrounding + context. Such context decisions depend on what the previous character + was, and the value of the current (lookahead) character. Context + dependent constraints are encoded as 8 bit integers. Each bit that + is set indicates that the constraint succeeds in the corresponding + context. + + bit 7 - previous and current are newlines + bit 6 - previous was newline, current isn't + bit 5 - previous wasn't newline, current is + bit 4 - neither previous nor current is a newline + bit 3 - previous and current are word-constituents + bit 2 - previous was word-constituent, current isn't + bit 1 - previous wasn't word-constituent, current is + bit 0 - neither previous nor current is word-constituent + + Word-constituent characters are those that satisfy isalnum(). + + The macro SUCCEEDS_IN_CONTEXT determines whether a a given constraint + succeeds in a particular context. Prevn is true if the previous character + was a newline, currn is true if the lookahead character is a newline. + Prevl and currl similarly depend upon whether the previous and current + characters are word-constituent letters. */ +#define MATCHES_NEWLINE_CONTEXT(constraint, prevn, currn) \ + ((constraint) & 1 << (((prevn) ? 2 : 0) + ((currn) ? 1 : 0) + 4)) +#define MATCHES_LETTER_CONTEXT(constraint, prevl, currl) \ + ((constraint) & 1 << (((prevl) ? 2 : 0) + ((currl) ? 1 : 0))) +#define SUCCEEDS_IN_CONTEXT(constraint, prevn, currn, prevl, currl) \ + (MATCHES_NEWLINE_CONTEXT(constraint, prevn, currn) \ + && MATCHES_LETTER_CONTEXT(constraint, prevl, currl)) + +/* The following macros give information about what a constraint depends on. */ +#define PREV_NEWLINE_DEPENDENT(constraint) \ + (((constraint) & 0xc0) >> 2 != ((constraint) & 0x30)) +#define PREV_LETTER_DEPENDENT(constraint) \ + (((constraint) & 0x0c) >> 2 != ((constraint) & 0x03)) + +/* Tokens that match the empty string subject to some constraint actually + work by applying that constraint to determine what may follow them, + taking into account what has gone before. The following values are + the constraints corresponding to the special tokens previously defined. */ +#define NO_CONSTRAINT 0xff +#define BEGLINE_CONSTRAINT 0xcf +#define ENDLINE_CONSTRAINT 0xaf +#define BEGWORD_CONSTRAINT 0xf2 +#define ENDWORD_CONSTRAINT 0xf4 +#define LIMWORD_CONSTRAINT 0xf6 +#define NOTLIMWORD_CONSTRAINT 0xf9 + +/* States of the recognizer correspond to sets of positions in the parse + tree, together with the constraints under which they may be matched. + So a position is encoded as an index into the parse tree together with + a constraint. */ +typedef struct +{ + unsigned index; /* Index into the parse array. */ + unsigned constraint; /* Constraint for matching this position. */ +} position; + +/* Sets of positions are stored as arrays. */ +typedef struct +{ + position *elems; /* Elements of this position set. */ + int nelem; /* Number of elements in this set. */ +} position_set; + +/* A state of the dfa consists of a set of positions, some flags, + and the token value of the lowest-numbered position of the state that + contains an END token. */ +typedef struct +{ + int hash; /* Hash of the positions of this state. */ + position_set elems; /* Positions this state could match. */ + char newline; /* True if previous state matched newline. */ + char letter; /* True if previous state matched a letter. */ + char backref; /* True if this state matches a \. */ + unsigned char constraint; /* Constraint for this state to accept. */ + int first_end; /* Token value of the first END in elems. */ +#ifdef MBS_SUPPORT + position_set mbps; /* Positions which can match multibyte + characters. e.g. period. + These staff are used only if + MB_CUR_MAX > 1. */ +#endif +} dfa_state; + +/* Element of a list of strings, at least one of which is known to + appear in any R.E. matching the DFA. */ +struct dfamust +{ + int exact; + char *must; + struct dfamust *next; +}; + +#ifdef MBS_SUPPORT +/* A bracket operator. + e.g. [a-c], [[:alpha:]], etc. */ +struct mb_char_classes +{ + int invert; + wchar_t *chars; /* Normal characters. */ + int nchars; + wctype_t *ch_classes; /* Character classes. */ + int nch_classes; + wchar_t *range_sts; /* Range characters (start of the range). */ + wchar_t *range_ends; /* Range characters (end of the range). */ + int nranges; + char **equivs; /* Equivalent classes. */ + int nequivs; + char **coll_elems; + int ncoll_elems; /* Collating elements. */ +}; +#endif + +/* A compiled regular expression. */ +struct dfa +{ + /* Stuff built by the scanner. */ + charclass *charclasses; /* Array of character sets for CSET tokens. */ + int cindex; /* Index for adding new charclasses. */ + int calloc; /* Number of charclasses currently allocated. */ + + /* Stuff built by the parser. */ + token *tokens; /* Postfix parse array. */ + int tindex; /* Index for adding new tokens. */ + int talloc; /* Number of tokens currently allocated. */ + int depth; /* Depth required of an evaluation stack + used for depth-first traversal of the + parse tree. */ + int nleaves; /* Number of leaves on the parse tree. */ + int nregexps; /* Count of parallel regexps being built + with dfaparse(). */ +#ifdef MBS_SUPPORT + /* These stuff are used only if MB_CUR_MAX > 1 or multibyte environments. */ + int nmultibyte_prop; + int *multibyte_prop; + /* The value of multibyte_prop[i] is defined by following rule. + if tokens[i] < NOTCHAR + bit 1 : tokens[i] is a single byte character, or the last-byte of + a multibyte character. + bit 0 : tokens[i] is a single byte character, or the 1st-byte of + a multibyte character. + if tokens[i] = MBCSET + ("the index of mbcsets correspnd to this operator" << 2) + 3 + + e.g. + tokens + = 'single_byte_a', 'multi_byte_A', single_byte_b' + = 'sb_a', 'mb_A(1st byte)', 'mb_A(2nd byte)', 'mb_A(3rd byte)', 'sb_b' + multibyte_prop + = 3 , 1 , 0 , 2 , 3 + */ + + /* Array of the bracket expressoin in the DFA. */ + struct mb_char_classes *mbcsets; + int nmbcsets; + int mbcsets_alloc; +#endif + + /* Stuff owned by the state builder. */ + dfa_state *states; /* States of the dfa. */ + int sindex; /* Index for adding new states. */ + int salloc; /* Number of states currently allocated. */ + + /* Stuff built by the structure analyzer. */ + position_set *follows; /* Array of follow sets, indexed by position + index. The follow of a position is the set + of positions containing characters that + could conceivably follow a character + matching the given position in a string + matching the regexp. Allocated to the + maximum possible position index. */ + int searchflag; /* True if we are supposed to build a searching + as opposed to an exact matcher. A searching + matcher finds the first and shortest string + matching a regexp anywhere in the buffer, + whereas an exact matcher finds the longest + string matching, but anchored to the + beginning of the buffer. */ + + /* Stuff owned by the executor. */ + int tralloc; /* Number of transition tables that have + slots so far. */ + int trcount; /* Number of transition tables that have + actually been built. */ + int **trans; /* Transition tables for states that can + never accept. If the transitions for a + state have not yet been computed, or the + state could possibly accept, its entry in + this table is NULL. */ + int **realtrans; /* Trans always points to realtrans + 1; this + is so trans[-1] can contain NULL. */ + int **fails; /* Transition tables after failing to accept + on a state that potentially could do so. */ + int *success; /* Table of acceptance conditions used in + dfaexec and computed in build_state. */ + struct dfamust *musts; /* List of strings, at least one of which + is known to appear in any r.e. matching + the dfa. */ +}; + +/* Some macros for user access to dfa internals. */ + +/* ACCEPTING returns true if s could possibly be an accepting state of r. */ +#define ACCEPTING(s, r) ((r).states[s].constraint) + +/* ACCEPTS_IN_CONTEXT returns true if the given state accepts in the + specified context. */ +#define ACCEPTS_IN_CONTEXT(prevn, currn, prevl, currl, state, dfa) \ + SUCCEEDS_IN_CONTEXT((dfa).states[state].constraint, \ + prevn, currn, prevl, currl) + +/* FIRST_MATCHING_REGEXP returns the index number of the first of parallel + regexps that a given state could accept. Parallel regexps are numbered + starting at 1. */ +#define FIRST_MATCHING_REGEXP(state, dfa) (-(dfa).states[state].first_end) + +/* Entry points. */ + +/* dfasyntax() takes three arguments; the first sets the syntax bits described + earlier in this file, the second sets the case-folding flag, and the + third specifies the line terminator. */ +extern void dfasyntax PARAMS ((reg_syntax_t, int, unsigned char)); + +/* Compile the given string of the given length into the given struct dfa. + Final argument is a flag specifying whether to build a searching or an + exact matcher. */ +extern void dfacomp PARAMS ((char const *, size_t, struct dfa *, int)); + +/* Execute the given struct dfa on the buffer of characters. The + last byte of the buffer must equal the end-of-line byte. + The final argument points to a flag that will + be set if further examination by a backtracking matcher is needed in + order to verify backreferencing; otherwise the flag will be cleared. + Returns (size_t) -1 if no match is found, or the offset of the first + character after the first & shortest matching string in the buffer. */ +extern size_t dfaexec PARAMS ((struct dfa *, char const *, size_t, int *)); + +/* Free the storage held by the components of a struct dfa. */ +extern void dfafree PARAMS ((struct dfa *)); + +/* Entry points for people who know what they're doing. */ + +/* Initialize the components of a struct dfa. */ +extern void dfainit PARAMS ((struct dfa *)); + +/* Incrementally parse a string of given length into a struct dfa. */ +extern void dfaparse PARAMS ((char const *, size_t, struct dfa *)); + +/* Analyze a parsed regexp; second argument tells whether to build a searching + or an exact matcher. */ +extern void dfaanalyze PARAMS ((struct dfa *, int)); + +/* Compute, for each possible character, the transitions out of a given + state, storing them in an array of integers. */ +extern void dfastate PARAMS ((int, struct dfa *, int [])); + +/* Error handling. */ + +/* dfaerror() is called by the regexp routines whenever an error occurs. It + takes a single argument, a NUL-terminated string describing the error. + The user must supply a dfaerror. */ +extern void dfaerror PARAMS ((const char *)); diff --git a/src/dosbuf.c b/src/dosbuf.c new file mode 100644 index 0000000..1d33adc --- /dev/null +++ b/src/dosbuf.c @@ -0,0 +1,181 @@ +/* Messy DOS-specific code for correctly treating binary, Unix text + and DOS text files. + + This has several aspects: + + * Guessing the file type (unless the user tells us); + * Stripping CR characters from DOS text files (otherwise regex + functions won't work correctly); + * Reporting correct byte count with -b for any kind of file. + +*/ + +typedef enum { + UNKNOWN, DOS_BINARY, DOS_TEXT, UNIX_TEXT +} File_type; + +struct dos_map { + off_t pos; /* position in buffer passed to matcher */ + off_t add; /* how much to add when reporting char position */ +}; + +static int dos_report_unix_offset = 0; + +static File_type dos_file_type = UNKNOWN; +static File_type dos_use_file_type = UNKNOWN; +static off_t dos_stripped_crs = 0; +static struct dos_map *dos_pos_map; +static int dos_pos_map_size = 0; +static int dos_pos_map_used = 0; +static int inp_map_idx = 0, out_map_idx = 1; + +/* Guess DOS file type by looking at its contents. */ +static inline File_type +guess_type (char *buf, register size_t buflen) +{ + int crlf_seen = 0; + register char *bp = buf; + + while (buflen--) + { + /* Treat a file as binary if it has a NUL character. */ + if (!*bp) + return DOS_BINARY; + + /* CR before LF means DOS text file (unless we later see + binary characters). */ + else if (*bp == '\r' && buflen && bp[1] == '\n') + crlf_seen = 1; + + bp++; + } + + return crlf_seen ? DOS_TEXT : UNIX_TEXT; +} + +/* Convert external DOS file representation to internal. + Return the count of characters left in the buffer. + Build table to map character positions when reporting byte counts. */ +static inline int +undossify_input (register char *buf, size_t buflen) +{ + int chars_left = 0; + + if (totalcc == 0) + { + /* New file: forget everything we knew about character + position mapping table and file type. */ + inp_map_idx = 0; + out_map_idx = 1; + dos_pos_map_used = 0; + dos_stripped_crs = 0; + dos_file_type = dos_use_file_type; + } + + /* Guess if this file is binary, unless we already know that. */ + if (dos_file_type == UNKNOWN) + dos_file_type = guess_type(buf, buflen); + + /* If this file is to be treated as DOS Text, strip the CR characters + and maybe build the table for character position mapping on output. */ + if (dos_file_type == DOS_TEXT) + { + char *destp = buf; + + while (buflen--) + { + if (*buf != '\r') + { + *destp++ = *buf++; + chars_left++; + } + else + { + buf++; + if (out_byte && !dos_report_unix_offset) + { + dos_stripped_crs++; + while (buflen && *buf == '\r') + { + dos_stripped_crs++; + buflen--; + buf++; + } + if (inp_map_idx >= dos_pos_map_size - 1) + { + dos_pos_map_size = inp_map_idx ? inp_map_idx * 2 : 1000; + dos_pos_map = + (struct dos_map *)xrealloc((char *)dos_pos_map, + dos_pos_map_size * + sizeof(struct dos_map)); + } + + if (!inp_map_idx) + { + /* Add sentinel entry. */ + dos_pos_map[inp_map_idx].pos = 0; + dos_pos_map[inp_map_idx++].add = 0; + + /* Initialize first real entry. */ + dos_pos_map[inp_map_idx].add = 0; + } + + /* Put the new entry. If the stripped CR characters + precede a Newline (the usual case), pretend that + they were found *after* the Newline. This makes + displayed byte offsets more reasonable in some + cases, and fits better the intuitive notion that + the line ends *before* the CR, not *after* it. */ + inp_map_idx++; + dos_pos_map[inp_map_idx-1].pos = + (*buf == '\n' ? destp + 1 : destp ) - bufbeg + totalcc; + dos_pos_map[inp_map_idx].add = dos_stripped_crs; + dos_pos_map_used = inp_map_idx; + + /* The following will be updated on the next pass. */ + dos_pos_map[inp_map_idx].pos = destp - bufbeg + totalcc + 1; + } + } + } + + return chars_left; + } + + return buflen; +} + +/* Convert internal byte count into external. */ +static inline off_t +dossified_pos (off_t byteno) +{ + off_t pos_lo; + off_t pos_hi; + + if (dos_file_type != DOS_TEXT || dos_report_unix_offset) + return byteno; + + /* Optimization: usually the file will be scanned sequentially. + So in most cases, this byte position will be found in the + table near the previous one, as recorded in `out_map_idx'. */ + pos_lo = dos_pos_map[out_map_idx-1].pos; + pos_hi = dos_pos_map[out_map_idx].pos; + + /* If the initial guess failed, search up or down, as + appropriate, beginning with the previous place. */ + if (byteno >= pos_hi) + { + out_map_idx++; + while (out_map_idx < dos_pos_map_used && + byteno >= dos_pos_map[out_map_idx].pos) + out_map_idx++; + } + + else if (byteno < pos_lo) + { + out_map_idx--; + while (out_map_idx > 1 && byteno < dos_pos_map[out_map_idx-1].pos) + out_map_idx--; + } + + return byteno + dos_pos_map[out_map_idx].add; +} diff --git a/src/egrep.c b/src/egrep.c new file mode 100644 index 0000000..1cabb4d --- /dev/null +++ b/src/egrep.c @@ -0,0 +1,2 @@ +#define EGREP_PROGRAM +#include "grep.c" diff --git a/src/esearch.c b/src/esearch.c new file mode 100644 index 0000000..f605e08 --- /dev/null +++ b/src/esearch.c @@ -0,0 +1,2 @@ +#define EGREP_PROGRAM +#include "search.c" diff --git a/src/fgrep.c b/src/fgrep.c new file mode 100644 index 0000000..4332310 --- /dev/null +++ b/src/fgrep.c @@ -0,0 +1,2 @@ +#define FGREP_PROGRAM +#include "grep.c" diff --git a/src/fsearch.c b/src/fsearch.c new file mode 100644 index 0000000..3bcac9d --- /dev/null +++ b/src/fsearch.c @@ -0,0 +1,2 @@ +#define FGREP_PROGRAM +#include "search.c" diff --git a/src/getpagesize.h b/src/getpagesize.h new file mode 100644 index 0000000..198967b --- /dev/null +++ b/src/getpagesize.h @@ -0,0 +1,46 @@ +/* Emulate getpagesize on systems that lack it. */ + +#ifndef HAVE_GETPAGESIZE + +#if !defined getpagesize && defined __BEOS__ +# include +# define getpagesize() B_PAGE_SIZE +#endif + +#ifdef HAVE_UNISTD_H +# include +#endif + +#if !defined getpagesize && defined _SC_PAGESIZE +# if !(defined VMS && __VMS_VER < 70000000) +# define getpagesize() sysconf (_SC_PAGESIZE) +# endif +#endif + +#if !defined getpagesize && defined VMS +# ifdef __ALPHA +# define getpagesize() 8192 +# else +# define getpagesize() 512 +# endif +#endif + +#ifndef getpagesize +# include +# ifdef EXEC_PAGESIZE +# define getpagesize() EXEC_PAGESIZE +# else +# ifdef NBPG +# ifndef CLSIZE +# define CLSIZE 1 +# endif +# define getpagesize() (NBPG * CLSIZE) +# else +# ifdef NBPC +# define getpagesize() NBPC +# endif +# endif +# endif +#endif + +#endif /* not HAVE_GETPAGESIZE */ diff --git a/src/grep.c b/src/grep.c new file mode 100644 index 0000000..8604361 --- /dev/null +++ b/src/grep.c @@ -0,0 +1,2274 @@ +/* grep.c - main driver file for grep. + Copyright (C) 1992, 1997, 1998, 1999, 2000, 2001, 2002, 2004, + 2005 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., 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ + +/* Written July 1992 by Mike Haertel. */ + +#ifdef HAVE_CONFIG_H +# include +#endif +#include +#include +#if defined(HAVE_MMAP) +# include +#endif +#if defined(HAVE_SETRLIMIT) +# include +# include +#endif +#include "mbsupport.h" +#ifdef MBS_SUPPORT +# include +# include +#endif +#include +#include "system.h" +#include "getopt.h" +#include "getpagesize.h" +#include "grep.h" +#include "savedir.h" +#include "xstrtol.h" +#include "xalloc.h" +#include "error.h" +#include "exclude.h" +#include "closeout.h" + +#undef MAX +#define MAX(A,B) ((A) > (B) ? (A) : (B)) + +#define SEP_CHAR_SELECTED ':' +#define SEP_CHAR_REJECTED '-' +#define SEP_STR_GROUP "--" + +struct stats +{ + struct stats const *parent; + struct stat stat; +}; + +/* base of chain of stat buffers, used to detect directory loops */ +static struct stats stats_base; + +/* if non-zero, display usage information and exit */ +static int show_help; + +/* If non-zero, print the version on standard output and exit. */ +static int show_version; + +/* If nonzero, suppress diagnostics for nonexistent or unreadable files. */ +static int suppress_errors; + +/* If nonzero, use mmap if possible. */ +static int mmap_option; + +/* If nonzero, use color markers. */ +static int color_option; + +/* If nonzero, show only the part of a line matching the expression. */ +static int only_matching; + +/* If nonzero, make sure first content char in a line is on a tab stop. */ +static int align_tabs; + +/* The context and logic for choosing default --color screen attributes + (foreground and background colors, etc.) are the following. + -- There are eight basic colors available, each with its own + nominal luminosity to the human eye and foreground/background + codes (black [0 %, 30/40], blue [11 %, 34/44], red [30 %, 31/41], + magenta [41 %, 35/45], green [59 %, 32/42], cyan [70 %, 36/46], + yellow [89 %, 33/43], and white [100 %, 37/47]). + -- Sometimes, white as a background is actually implemented using + a shade of light gray, so that a foreground white can be visible + on top of it (but most often not). + -- Sometimes, black as a foreground is actually implemented using + a shade of dark gray, so that it can be visible on top of a + background black (but most often not). + -- Sometimes, more colors are available, as extensions. + -- Other attributes can be selected/deselected (bold [1/22], + underline [4/24], standout/inverse [7/27], blink [5/25], and + invisible/hidden [8/28]). They are sometimes implemented by + using colors instead of what their names imply; e.g., bold is + often achieved by using brighter colors. In practice, only bold + is really available to us, underline sometimes being mapped by + the terminal to some strange color choice, and standout best + being left for use by downstream programs such as less(1). + -- We cannot assume that any of the extensions or special features + are available for the purpose of choosing defaults for everyone. + -- The most prevalent default terminal backgrounds are pure black + and pure white, and are not necessarily the same shades of + those as if they were selected explicitly with SGR sequences. + Some terminals use dark or light pictures as default background, + but those are covered over by an explicit selection of background + color with an SGR sequence; their users will appreciate their + background pictures not be covered like this, if possible. + -- Some uses of colors attributes is to make some output items + more understated (e.g., context lines); this cannot be achieved + by changing the background color. + -- For these reasons, the grep color defaults should strive not + to change the background color from its default, unless it's + for a short item that should be highlighted, not understated. + -- The grep foreground color defaults (without an explicitly set + background) should provide enough contrast to be readable on any + terminal with either a black (dark) or white (light) background. + This only leaves red, magenta, green, and cyan (and their bold + counterparts) and possibly bold blue. */ +/* The color strings used for matched text. + The user can overwrite them using the deprecated + environment variable GREP_COLOR or the new GREP_COLORS. */ +static const char *selected_match_color = "01;31"; /* bold red */ +static const char *context_match_color = "01;31"; /* bold red */ + +/* Other colors. Defaults look damn good. */ +static const char *filename_color = "35"; /* magenta */ +static const char *line_num_color = "32"; /* green */ +static const char *byte_num_color = "32"; /* green */ +static const char *sep_color = "36"; /* cyan */ +static const char *selected_line_color = ""; /* default color pair */ +static const char *context_line_color = ""; /* default color pair */ + +/* Select Graphic Rendition (SGR, "\33[...m") strings. */ +/* Also Erase in Line (EL) to Right ("\33[K") by default. */ +/* Why have EL to Right after SGR? + -- The behavior of line-wrapping when at the bottom of the + terminal screen and at the end of the current line is often + such that a new line is introduced, entirely cleared with + the current background color which may be different from the + default one (see the boolean back_color_erase terminfo(5) + capability), thus scrolling the display by one line. + The end of this new line will stay in this background color + even after reverting to the default background color with + "\33[m', unless it is explicitly cleared again with "\33[K" + (which is the behavior the user would instinctively expect + from the whole thing). There may be some unavoidable + background-color flicker at the end of this new line because + of this (when timing with the monitor's redraw is just right). + -- The behavior of HT (tab, "\t") is usually the same as that of + Cursor Forward Tabulation (CHT) with a default parameter + of 1 ("\33[I"), i.e., it performs pure movement to the next + tab stop, without any clearing of either content or screen + attributes (including background color); try + echo -ne 'asdfqwerzxcv\rASDF\tZXCV\n' + in a bash(1) shell to demonstrate this. This is not what the + user would instinctively expect of HT (but is ok for CHT). + The instinctive behavior would include clearing the terminal + cells that are skipped over by HT with blank cells in the + current screen attributes, including background color; + the boolean dest_tabs_magic_smso terminfo(5) capability + indicates this saner behavior for HT, but only some rare + terminals have it (although it also indicates a special + glitch with standout mode in the Teleray terminal for which + it was initially introduced). The remedy is to add "\33K" + after each SGR sequence, be it START (to fix the behavior + of any HT after that before another SGR) or END (to fix the + behavior of an HT in default background color that would + follow a line-wrapping at the bottom of the screen in another + background color, and to complement doing it after START). + Piping grep's output through a pager such as less(1) avoids + any HT problems since the pager performs tab expansion. + + Generic disadvantages of this remedy are: + -- Some very rare terminals might support SGR but not EL (nobody + will use "grep --color" on a terminal that does not support + SGR in the first place). + -- Having these extra control sequences might somewhat complicate + the task of any program trying to parse "grep --color" + output in order to extract structuring information from it. + A specific disadvantage to doing it after SGR START is: + -- Even more possible background color flicker (when timing + with the monitor's redraw is just right), even when not at the + bottom of the screen. + There are no additional disadvantages specific to doing it after + SGR END. + + It would be impractical for GNU grep to become a full-fledged + terminal program linked against ncurses or the like, so it will + not detect terminfo(5) capabilities. */ +static const char *sgr_start = "\33[%sm\33[K"; +#define SGR_START sgr_start +static const char *sgr_end = "\33[m\33[K"; +#define SGR_END sgr_end + +/* SGR utility macros. */ +#define PR_SGR_FMT(fmt, s) do { if (*(s)) printf((fmt), (s)); } while (0) +#define PR_SGR_FMT_IF(fmt, s) \ + do { if (color_option && *(s)) printf((fmt), (s)); } while (0) +#define PR_SGR_START(s) PR_SGR_FMT( SGR_START, (s)) +#define PR_SGR_END(s) PR_SGR_FMT( SGR_END, (s)) +#define PR_SGR_START_IF(s) PR_SGR_FMT_IF(SGR_START, (s)) +#define PR_SGR_END_IF(s) PR_SGR_FMT_IF(SGR_END, (s)) + +struct color_cap + { + const char *name; + const char **var; + const char *(*fct)(void); + }; + +static const char * +color_cap_mt_fct(void) +{ + /* Our caller just set selected_match_color. */ + context_match_color = selected_match_color; + + return NULL; +} + +static const char * +color_cap_rv_fct(void) +{ + /* By this point, it was 1 (or already -1). */ + color_option = -1; /* That's still != 0. */ + + return NULL; +} + +static const char * +color_cap_ne_fct(void) +{ + sgr_start = "\33[%sm"; + sgr_end = "\33[m"; + + return NULL; +} + +/* For GREP_COLORS. */ +static struct color_cap color_dict[] = + { + { "mt", &selected_match_color, color_cap_mt_fct }, /* both ms/mc */ + { "ms", &selected_match_color, NULL }, /* selected matched text */ + { "mc", &context_match_color, NULL }, /* context matched text */ + { "fn", &filename_color, NULL }, /* filename */ + { "ln", &line_num_color, NULL }, /* line number */ + { "bn", &byte_num_color, NULL }, /* byte (sic) offset */ + { "se", &sep_color, NULL }, /* separator */ + { "sl", &selected_line_color, NULL }, /* selected lines */ + { "cx", &context_line_color, NULL }, /* context lines */ + { "rv", NULL, color_cap_rv_fct }, /* -v reverses sl/cx */ + { "ne", NULL, color_cap_ne_fct }, /* no EL on SGR_* */ + { NULL, NULL, NULL } + }; + +static struct exclude *excluded_patterns; +static struct exclude *included_patterns; +static struct exclude *excluded_directory_patterns; +/* Short options. */ +static char const short_options[] = +"0123456789A:B:C:D:HITUVabcd:e:f:hiKLlm:noqRrsuvwxyZz" +#ifdef GREP_PROGRAM +"EFGPX:" +#endif +; + +/* Non-boolean long options that have no corresponding short equivalents. */ +enum +{ + BINARY_FILES_OPTION = CHAR_MAX + 1, + COLOR_OPTION, + INCLUDE_OPTION, + EXCLUDE_OPTION, + EXCLUDE_FROM_OPTION, + LINE_BUFFERED_OPTION, + LABEL_OPTION, + EXCLUDE_DIRECTORY_OPTION +}; + +/* Long options equivalences. */ +static struct option const long_options[] = +{ +#ifdef GREP_PROGRAM + {"basic-regexp", no_argument, NULL, 'G'}, + {"extended-regexp", no_argument, NULL, 'E'}, + {"fixed-regexp", no_argument, NULL, 'F'}, + {"fixed-strings", no_argument, NULL, 'F'}, + {"perl-regexp", no_argument, NULL, 'P'}, +#endif + {"after-context", required_argument, NULL, 'A'}, + {"before-context", required_argument, NULL, 'B'}, + {"binary-files", required_argument, NULL, BINARY_FILES_OPTION}, + {"byte-offset", no_argument, NULL, 'b'}, + {"context", required_argument, NULL, 'C'}, + {"color", optional_argument, NULL, COLOR_OPTION}, + {"colour", optional_argument, NULL, COLOR_OPTION}, + {"count", no_argument, NULL, 'c'}, + {"devices", required_argument, NULL, 'D'}, + {"directories", required_argument, NULL, 'd'}, + {"exclude", required_argument, NULL, EXCLUDE_OPTION}, + {"exclude-from", required_argument, NULL, EXCLUDE_FROM_OPTION}, + {"exclude-dir", required_argument, NULL, EXCLUDE_DIRECTORY_OPTION}, + {"file", required_argument, NULL, 'f'}, + {"files-with-matches", no_argument, NULL, 'l'}, + {"files-without-match", no_argument, NULL, 'L'}, + {"help", no_argument, &show_help, 1}, + {"include", required_argument, NULL, INCLUDE_OPTION}, + {"ignore-case", no_argument, NULL, 'i'}, + {"initial-tab", no_argument, NULL, 'T'}, + {"label", required_argument, NULL, LABEL_OPTION}, + {"line-buffered", no_argument, NULL, LINE_BUFFERED_OPTION}, + {"line-number", no_argument, NULL, 'n'}, + {"line-regexp", no_argument, NULL, 'x'}, + {"max-count", required_argument, NULL, 'm'}, + {"mmap", no_argument, &mmap_option, 1}, + {"no-filename", no_argument, NULL, 'h'}, + {"no-messages", no_argument, NULL, 's'}, + {"null", no_argument, NULL, 'Z'}, + {"null-data", no_argument, NULL, 'z'}, + {"only-matching", no_argument, NULL, 'o'}, + {"quiet", no_argument, NULL, 'q'}, + {"recursive", no_argument, NULL, 'r'}, + {"recursive", no_argument, NULL, 'R'}, + {"regexp", required_argument, NULL, 'e'}, + {"invert-match", no_argument, NULL, 'v'}, + {"silent", no_argument, NULL, 'q'}, + {"text", no_argument, NULL, 'a'}, + {"binary", no_argument, NULL, 'U'}, + {"unix-byte-offsets", no_argument, NULL, 'u'}, + {"version", no_argument, NULL, 'V'}, + {"with-filename", no_argument, NULL, 'H'}, + {"word-regexp", no_argument, NULL, 'w'}, + {0, 0, 0, 0} +}; + +/* Define flags declared in grep.h. */ +int match_icase; +int match_words; +int match_lines; +unsigned char eolbyte; + +/* For error messages. */ +/* The name the program was run with, stripped of any leading path. */ +char *program_name; +static char const *filename; +static int errseen; + +/* How to handle directories. */ +static enum + { + READ_DIRECTORIES, + RECURSE_DIRECTORIES, + SKIP_DIRECTORIES + } directories = READ_DIRECTORIES; + +/* How to handle devices. */ +static enum + { + READ_DEVICES, + SKIP_DEVICES + } devices = READ_DEVICES; + +static int grepdir PARAMS ((char const *, struct stats const *)); +#if defined(HAVE_DOS_FILE_CONTENTS) +static inline int undossify_input PARAMS ((register char *, size_t)); +#endif + +/* Functions we'll use to search. */ +#ifdef GREP_PROGRAM +static compile_fp_t compile; +static execute_fp_t execute; +#endif + +/* Like error, but suppress the diagnostic if requested. */ +static void +suppressible_error (char const *mesg, int errnum) +{ + if (! suppress_errors) + error (0, errnum, "%s", mesg); + errseen = 1; +} + +/* Convert STR to a positive integer, storing the result in *OUT. + STR must be a valid context length argument; report an error if it + isn't. */ +static void +context_length_arg (char const *str, int *out) +{ + uintmax_t value; + if (! (xstrtoumax (str, 0, 10, &value, "") == LONGINT_OK + && 0 <= (*out = value) + && *out == value)) + { + error (2, 0, "%s: %s\n", str, _("invalid context length argument")); + } +} + + +/* Hairy buffering mechanism for grep. The intent is to keep + all reads aligned on a page boundary and multiples of the + page size, unless a read yields a partial page. */ + +static char *buffer; /* Base of buffer. */ +static size_t bufalloc; /* Allocated buffer size, counting slop. */ +#define INITIAL_BUFSIZE 32768 /* Initial buffer size, not counting slop. */ +static int bufdesc; /* File descriptor. */ +static char *bufbeg; /* Beginning of user-visible stuff. */ +static char *buflim; /* Limit of user-visible stuff. */ +static size_t pagesize; /* alignment of memory pages */ +static off_t bufoffset; /* Read offset; defined on regular files. */ +static off_t after_last_match; /* Pointer after last matching line that + would have been output if we were + outputting characters. */ + +#if defined(HAVE_MMAP) +static int bufmapped; /* True if buffer is memory-mapped. */ +static off_t initial_bufoffset; /* Initial value of bufoffset. */ +#else +# define bufmapped 0 +#endif + +/* Return VAL aligned to the next multiple of ALIGNMENT. VAL can be + an integer or a pointer. Both args must be free of side effects. */ +#define ALIGN_TO(val, alignment) \ + ((size_t) (val) % (alignment) == 0 \ + ? (val) \ + : (val) + ((alignment) - (size_t) (val) % (alignment))) + +/* Reset the buffer for a new file, returning zero if we should skip it. + Initialize on the first time through. */ +static int +reset (int fd, char const *file, struct stats *stats) +{ + if (! pagesize) + { + pagesize = getpagesize (); + if (pagesize == 0 || 2 * pagesize + 1 <= pagesize) + abort (); + bufalloc = ALIGN_TO (INITIAL_BUFSIZE, pagesize) + pagesize + 1; + buffer = xmalloc (bufalloc); + } + + bufbeg = buflim = ALIGN_TO (buffer + 1, pagesize); + bufbeg[-1] = eolbyte; + bufdesc = fd; + + if (S_ISREG (stats->stat.st_mode)) + { + if (file) + bufoffset = 0; + else + { + bufoffset = lseek (fd, 0, SEEK_CUR); + if (bufoffset < 0) + { + error (0, errno, "lseek"); + return 0; + } + } +#if defined(HAVE_MMAP) + initial_bufoffset = bufoffset; + bufmapped = mmap_option && bufoffset % pagesize == 0; +#endif + } + else + { +#if defined(HAVE_MMAP) + bufmapped = 0; +#endif + } + return 1; +} + +/* Read new stuff into the buffer, saving the specified + amount of old stuff. When we're done, 'bufbeg' points + to the beginning of the buffer contents, and 'buflim' + points just after the end. Return zero if there's an error. */ +static int +fillbuf (size_t save, struct stats const *stats) +{ + size_t fillsize = 0; + int cc = 1; + char *readbuf; + size_t readsize; + + /* Offset from start of buffer to start of old stuff + that we want to save. */ + size_t saved_offset = buflim - save - buffer; + + if (pagesize <= buffer + bufalloc - buflim) + { + readbuf = buflim; + bufbeg = buflim - save; + } + else + { + size_t minsize = save + pagesize; + size_t newsize; + size_t newalloc; + char *newbuf; + + /* Grow newsize until it is at least as great as minsize. */ + for (newsize = bufalloc - pagesize - 1; newsize < minsize; newsize *= 2) + if (newsize * 2 < newsize || newsize * 2 + pagesize + 1 < newsize * 2) + xalloc_die (); + + /* Try not to allocate more memory than the file size indicates, + as that might cause unnecessary memory exhaustion if the file + is large. However, do not use the original file size as a + heuristic if we've already read past the file end, as most + likely the file is growing. */ + if (S_ISREG (stats->stat.st_mode)) + { + off_t to_be_read = stats->stat.st_size - bufoffset; + off_t maxsize_off = save + to_be_read; + if (0 <= to_be_read && to_be_read <= maxsize_off + && maxsize_off == (size_t) maxsize_off + && minsize <= (size_t) maxsize_off + && (size_t) maxsize_off < newsize) + newsize = maxsize_off; + } + + /* Add enough room so that the buffer is aligned and has room + for byte sentinels fore and aft. */ + newalloc = newsize + pagesize + 1; + + newbuf = bufalloc < newalloc ? xmalloc (bufalloc = newalloc) : buffer; + readbuf = ALIGN_TO (newbuf + 1 + save, pagesize); + bufbeg = readbuf - save; + memmove (bufbeg, buffer + saved_offset, save); + bufbeg[-1] = eolbyte; + if (newbuf != buffer) + { + free (buffer); + buffer = newbuf; + } + } + + readsize = buffer + bufalloc - readbuf; + readsize -= readsize % pagesize; + +#if defined(HAVE_MMAP) + if (bufmapped) + { + size_t mmapsize = readsize; + + /* Don't mmap past the end of the file; some hosts don't allow this. + Use `read' on the last page. */ + if (stats->stat.st_size - bufoffset < mmapsize) + { + mmapsize = stats->stat.st_size - bufoffset; + mmapsize -= mmapsize % pagesize; + } + + if (mmapsize + && (mmap ((caddr_t) readbuf, mmapsize, + PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FIXED, + bufdesc, bufoffset) + != (caddr_t) -1)) + { + /* Do not bother to use madvise with MADV_SEQUENTIAL or + MADV_WILLNEED on the mmapped memory. One might think it + would help, but it slows us down about 30% on SunOS 4.1. */ + fillsize = mmapsize; + } + else + { + /* Stop using mmap on this file. Synchronize the file + offset. Do not warn about mmap failures. On some hosts + (e.g. Solaris 2.5) mmap can fail merely because some + other process has an advisory read lock on the file. + There's no point alarming the user about this misfeature. */ + bufmapped = 0; + if (bufoffset != initial_bufoffset + && lseek (bufdesc, bufoffset, SEEK_SET) < 0) + { + error (0, errno, "lseek"); + cc = 0; + } + } + } +#endif /*HAVE_MMAP*/ + + if (! fillsize) + { + ssize_t bytesread; + while ((bytesread = read (bufdesc, readbuf, readsize)) < 0 + && errno == EINTR) + continue; + if (bytesread < 0) + cc = 0; + else + fillsize = bytesread; + } + + bufoffset += fillsize; +#if defined(HAVE_DOS_FILE_CONTENTS) + if (fillsize) + fillsize = undossify_input (readbuf, fillsize); +#endif + buflim = readbuf + fillsize; + return cc; +} + +/* Flags controlling the style of output. */ +static enum +{ + BINARY_BINARY_FILES, + TEXT_BINARY_FILES, + WITHOUT_MATCH_BINARY_FILES +} binary_files; /* How to handle binary files. */ + +static int filename_mask; /* If zero, output nulls after filenames. */ +static int out_quiet; /* Suppress all normal output. */ +static int out_invert; /* Print nonmatching stuff. */ +static int out_file; /* Print filenames. */ +static int out_line; /* Print line numbers. */ +static int out_byte; /* Print byte offsets. */ +static int out_before; /* Lines of leading context. */ +static int out_after; /* Lines of trailing context. */ +static int count_matches; /* Count matching lines. */ +static int list_files; /* List matching files. */ +static int no_filenames; /* Suppress file names. */ +static off_t max_count; /* Stop after outputting this many + lines from an input file. */ +static int line_buffered; /* If nonzero, use line buffering, i.e. + fflush everyline out. */ +static char *label = NULL; /* Fake filename for stdin */ + + +/* Internal variables to keep track of byte count, context, etc. */ +static uintmax_t totalcc; /* Total character count before bufbeg. */ +static char const *lastnl; /* Pointer after last newline counted. */ +static char const *lastout; /* Pointer after last character output; + NULL if no character has been output + or if it's conceptually before bufbeg. */ +static uintmax_t totalnl; /* Total newline count before lastnl. */ +static off_t outleft; /* Maximum number of lines to be output. */ +static int pending; /* Pending lines of output. + Always kept 0 if out_quiet is true. */ +static int done_on_match; /* Stop scanning file on first match. */ +static int exit_on_match; /* Exit on first match. */ + +#if defined(HAVE_DOS_FILE_CONTENTS) +# include "dosbuf.c" +#endif + +/* Add two numbers that count input bytes or lines, and report an + error if the addition overflows. */ +static uintmax_t +add_count (uintmax_t a, uintmax_t b) +{ + uintmax_t sum = a + b; + if (sum < a) + error (2, 0, _("input is too large to count")); + return sum; +} + +static void +nlscan (char const *lim) +{ + size_t newlines = 0; + char const *beg; + for (beg = lastnl; beg < lim; beg++) + { + beg = memchr (beg, eolbyte, lim - beg); + if (!beg) + break; + newlines++; + } + totalnl = add_count (totalnl, newlines); + lastnl = lim; +} + +/* Print the current filename. */ +static void +print_filename (void) +{ + PR_SGR_START_IF(filename_color); + fputs(filename, stdout); + PR_SGR_END_IF(filename_color); +} + +/* Print a character separator. */ +static void +print_sep (char sep) +{ + PR_SGR_START_IF(sep_color); + fputc(sep, stdout); + PR_SGR_END_IF(sep_color); +} + +/* Print a line number or a byte offset. */ +static void +print_offset (uintmax_t pos, int min_width, const char *color) +{ + /* Do not rely on printf to print pos, since uintmax_t may be longer + than long, and long long is not portable. */ + + char buf[sizeof pos * CHAR_BIT]; + char *p = buf + sizeof buf; + + do + { + *--p = '0' + pos % 10; + --min_width; + } + while ((pos /= 10) != 0); + + /* Do this to maximize the probability of alignment across lines. */ + if (align_tabs) + while (--min_width >= 0) + *--p = ' '; + + PR_SGR_START_IF(color); + fwrite (p, 1, buf + sizeof buf - p, stdout); + PR_SGR_END_IF(color); +} + +/* Print a whole line head (filename, line, byte). */ +static void +print_line_head (char const *beg, char const *lim, int sep) +{ + int pending_sep = 0; + + if (out_file) + { + print_filename(); + if (filename_mask) + pending_sep = 1; + else + fputc(0, stdout); + } + + if (out_line) + { + if (lastnl < lim) + { + nlscan (beg); + totalnl = add_count (totalnl, 1); + lastnl = lim; + } + if (pending_sep) + print_sep(sep); + print_offset (totalnl, 4, line_num_color); + pending_sep = 1; + } + + if (out_byte) + { + uintmax_t pos = add_count (totalcc, beg - bufbeg); +#if defined(HAVE_DOS_FILE_CONTENTS) + pos = dossified_pos (pos); +#endif + if (pending_sep) + print_sep(sep); + print_offset (pos, 6, byte_num_color); + pending_sep = 1; + } + + if (pending_sep) + { + /* This assumes sep is one column wide. + Try doing this any other way with Unicode + (and its combining and wide characters) + filenames and you're wasting your efforts. */ + if (align_tabs) + fputs("\t\b", stdout); + + print_sep(sep); + } +} + +static const char * +print_line_middle (const char *beg, const char *lim, + const char *line_color, const char *match_color) +{ + size_t match_size; + size_t match_offset; + const char *cur = beg; + const char *mid = NULL; + char *buf; /* XXX */ + const char *ibeg; /* XXX */ + + if (match_icase) /* XXX - None of the -i stuff should be here. */ + { + int i = lim - beg; + + ibeg = buf = (char *) xmalloc(i); + /* This can't possibly be correct with UTF-8, + but it's equivalent to what was there so far. */ + while (--i >= 0) + buf[i] = tolower(beg[i]); + } + else + { + buf = NULL; + ibeg = beg; + } + + while ( lim > cur + && ((match_offset = execute(ibeg, lim - beg, &match_size, + ibeg + (cur - beg))) != (size_t) -1)) + { + char const *b = beg + match_offset; + + /* Avoid matching the empty line at the end of the buffer. */ + if (b == lim) + break; + + /* Avoid hanging on grep --color "" foo */ + if (match_size == 0) + { + /* Make minimal progress; there may be further non-empty matches. */ + /* XXX - Could really advance by one whole multi-octet character. */ + match_size = 1; + if (!mid) + mid = cur; + } + else + { + /* This function is called on a matching line only, + but is it selected or rejected/context? */ + if (only_matching) + print_line_head(b, lim, out_invert ? SEP_CHAR_REJECTED + : SEP_CHAR_SELECTED); + else + { + PR_SGR_START(line_color); + if (mid) + { + cur = mid; + mid = NULL; + } + fwrite (cur, sizeof (char), b - cur, stdout); + } + + PR_SGR_START_IF(match_color); + fwrite (b, sizeof (char), match_size, stdout); + PR_SGR_END_IF(match_color); + if (only_matching) + fputs("\n", stdout); + } + cur = b + match_size; + } + + if (buf) + free(buf); /* XXX */ + + if (only_matching) + cur = lim; + else if (mid) + cur = mid; + + return cur; +} + +static const char * +print_line_tail (const char *beg, const char *lim, const char *line_color) +{ + size_t eol_size; + size_t tail_size; + + eol_size = (lim > beg && lim[-1] == eolbyte); + eol_size += (lim - eol_size > beg && lim[-(1 + eol_size)] == '\r'); + tail_size = lim - eol_size - beg; + + if (tail_size > 0) + { + PR_SGR_START(line_color); + fwrite(beg, 1, tail_size, stdout); + beg += tail_size; + PR_SGR_END(line_color); + } + + return beg; +} + +static void +prline (char const *beg, char const *lim, int sep) +{ + int matching; + const char *line_color; + const char *match_color; + + if (!only_matching) + print_line_head(beg, lim, sep); + + matching = (sep == SEP_CHAR_SELECTED) ^ !!out_invert; + + if (color_option) + { + line_color = ( (sep == SEP_CHAR_SELECTED) + ^ (out_invert && (color_option < 0))) + ? selected_line_color : context_line_color; + match_color = (sep == SEP_CHAR_SELECTED) + ? selected_match_color : context_match_color; + } + else + line_color = match_color = NULL; /* Shouldn't be used. */ + + if ( (only_matching && matching) + || (color_option && (*line_color || *match_color))) + { + /* We already know that non-matching lines have no match (to colorize). */ + if (matching && (only_matching || *match_color)) + beg = print_line_middle(beg, lim, line_color, match_color); + + if (!only_matching && *line_color); + beg = print_line_tail(beg, lim, line_color); + } + + if (!only_matching && lim > beg) + fwrite (beg, 1, lim - beg, stdout); + + if (ferror (stdout)) + error (0, errno, _("writing output")); + + lastout = lim; + + if (line_buffered) + fflush (stdout); +} + +/* Print pending lines of trailing context prior to LIM. Trailing context ends + at the next matching line when OUTLEFT is 0. */ +static void +prpending (char const *lim) +{ + if (!lastout) + lastout = bufbeg; + while (pending > 0 && lastout < lim) + { + char const *nl = memchr (lastout, eolbyte, lim - lastout); + size_t match_size; + --pending; + if (outleft + || ((execute(lastout, nl + 1 - lastout, + &match_size, NULL) == (size_t) -1) + == !out_invert)) + prline (lastout, nl + 1, SEP_CHAR_REJECTED); + else + pending = 0; + } +} + +/* Print the lines between BEG and LIM. Deal with context crap. + If NLINESP is non-null, store a count of lines between BEG and LIM. */ +static void +prtext (char const *beg, char const *lim, int *nlinesp) +{ + static int used; /* avoid printing SEP_STR_GROUP before any output */ + char const *bp, *p; + char eol = eolbyte; + int i, n; + + if (!out_quiet && pending > 0) + prpending (beg); + + p = beg; + + if (!out_quiet) + { + /* Deal with leading context crap. */ + + bp = lastout ? lastout : bufbeg; + for (i = 0; i < out_before; ++i) + if (p > bp) + do + --p; + while (p[-1] != eol); + + /* We print the SEP_STR_GROUP separator only if our output is + discontiguous from the last output in the file. */ + if ((out_before || out_after) && used && p != lastout) + { + PR_SGR_START_IF(sep_color); + fputs (SEP_STR_GROUP, stdout); + PR_SGR_END_IF(sep_color); + fputc('\n', stdout); + } + + while (p < beg) + { + char const *nl = memchr (p, eol, beg - p); + nl++; + prline (p, nl, SEP_CHAR_REJECTED); + p = nl; + } + } + + if (nlinesp) + { + /* Caller wants a line count. */ + for (n = 0; p < lim && n < outleft; n++) + { + char const *nl = memchr (p, eol, lim - p); + nl++; + if (!out_quiet) + prline (p, nl, SEP_CHAR_SELECTED); + p = nl; + } + *nlinesp = n; + + /* relying on it that this function is never called when outleft = 0. */ + after_last_match = bufoffset - (buflim - p); + } + else + if (!out_quiet) + prline (beg, lim, SEP_CHAR_SELECTED); + + pending = out_quiet ? 0 : out_after; + used = 1; +} + +/* Scan the specified portion of the buffer, matching lines (or + between matching lines if OUT_INVERT is true). Return a count of + lines printed. */ +static int +grepbuf (char const *beg, char const *lim) +{ + int nlines, n; + register char const *p; + size_t match_offset; + size_t match_size; + + nlines = 0; + p = beg; + while ((match_offset = execute(p, lim - p, &match_size, + NULL)) != (size_t) -1) + { + char const *b = p + match_offset; + char const *endp = b + match_size; + /* Avoid matching the empty line at the end of the buffer. */ + if (b == lim) + break; + if (!out_invert) + { + prtext (b, endp, (int *) 0); + nlines++; + outleft--; + if (!outleft || done_on_match) + { + if (exit_on_match) + exit (0); + after_last_match = bufoffset - (buflim - endp); + return nlines; + } + } + else if (p < b) + { + prtext (p, b, &n); + nlines += n; + outleft -= n; + if (!outleft) + return nlines; + } + p = endp; + } + if (out_invert && p < lim) + { + prtext (p, lim, &n); + nlines += n; + outleft -= n; + } + return nlines; +} + +/* Search a given file. Normally, return a count of lines printed; + but if the file is a directory and we search it recursively, then + return -2 if there was a match, and -1 otherwise. */ +static int +grep (int fd, char const *file, struct stats *stats) +{ + int nlines, i; + int not_text; + size_t residue, save; + char oldc; + char *beg; + char *lim; + char eol = eolbyte; + + if (!reset (fd, file, stats)) + return 0; + + if (file && directories == RECURSE_DIRECTORIES + && S_ISDIR (stats->stat.st_mode)) + { + /* Close fd now, so that we don't open a lot of file descriptors + when we recurse deeply. */ + if (close (fd) != 0) + error (0, errno, "%s", file); + return grepdir (file, stats) - 2; + } + + totalcc = 0; + lastout = 0; + totalnl = 0; + outleft = max_count; + after_last_match = 0; + pending = 0; + + nlines = 0; + residue = 0; + save = 0; + + if (! fillbuf (save, stats)) + { + if (! is_EISDIR (errno, file)) + suppressible_error (filename, errno); + return 0; + } + + not_text = (((binary_files == BINARY_BINARY_FILES && !out_quiet) + || binary_files == WITHOUT_MATCH_BINARY_FILES) + && memchr (bufbeg, eol ? '\0' : '\200', buflim - bufbeg)); + if (not_text && binary_files == WITHOUT_MATCH_BINARY_FILES) + return 0; + done_on_match += not_text; + out_quiet += not_text; + + for (;;) + { + lastnl = bufbeg; + if (lastout) + lastout = bufbeg; + + beg = bufbeg + save; + + /* no more data to scan (eof) except for maybe a residue -> break */ + if (beg == buflim) + break; + + /* Determine new residue (the length of an incomplete line at the end of + the buffer, 0 means there is no incomplete last line). */ + oldc = beg[-1]; + beg[-1] = eol; + for (lim = buflim; lim[-1] != eol; lim--) + continue; + beg[-1] = oldc; + if (lim == beg) + lim = beg - residue; + beg -= residue; + residue = buflim - lim; + + if (beg < lim) + { + if (outleft) + nlines += grepbuf (beg, lim); + if (pending) + prpending (lim); + if((!outleft && !pending) || (nlines && done_on_match && !out_invert)) + goto finish_grep; + } + + /* The last OUT_BEFORE lines at the end of the buffer will be needed as + leading context if there is a matching line at the begin of the + next data. Make beg point to their begin. */ + i = 0; + beg = lim; + while (i < out_before && beg > bufbeg && beg != lastout) + { + ++i; + do + --beg; + while (beg[-1] != eol); + } + + /* detect if leading context is discontinuous from last printed line. */ + if (beg != lastout) + lastout = 0; + + /* Handle some details and read more data to scan. */ + save = residue + lim - beg; + if (out_byte) + totalcc = add_count (totalcc, buflim - bufbeg - save); + if (out_line) + nlscan (beg); + if (! fillbuf (save, stats)) + { + if (! is_EISDIR (errno, file)) + suppressible_error (filename, errno); + goto finish_grep; + } + } + if (residue) + { + *buflim++ = eol; + if (outleft) + nlines += grepbuf (bufbeg + save - residue, buflim); + if (pending) + prpending (buflim); + } + + finish_grep: + done_on_match -= not_text; + out_quiet -= not_text; + if ((not_text & ~out_quiet) && nlines != 0) + printf (_("Binary file %s matches\n"), filename); + return nlines; +} + +static int +grepfile (char const *file, struct stats *stats) +{ + int desc; + int count; + int status; + + if (! file) + { + desc = 0; + filename = label ? label : _("(standard input)"); + } + else + { + if (stat (file, &stats->stat) != 0) + { + suppressible_error (file, errno); + return 1; + } + if (directories == SKIP_DIRECTORIES && S_ISDIR (stats->stat.st_mode)) + return 1; +#ifndef DJGPP + if (devices == SKIP_DEVICES && (S_ISCHR(stats->stat.st_mode) || S_ISBLK(stats->stat.st_mode) || S_ISSOCK(stats->stat.st_mode) || S_ISFIFO(stats->stat.st_mode))) +#else + if (devices == SKIP_DEVICES && (S_ISCHR(stats->stat.st_mode) || S_ISBLK(stats->stat.st_mode))) +#endif + return 1; + while ((desc = open (file, O_RDONLY)) < 0 && errno == EINTR) + continue; + + if (desc < 0) + { + int e = errno; + + if (is_EISDIR (e, file) && directories == RECURSE_DIRECTORIES) + { + if (stat (file, &stats->stat) != 0) + { + error (0, errno, "%s", file); + return 1; + } + + return grepdir (file, stats); + } + + if (!suppress_errors) + { + if (directories == SKIP_DIRECTORIES) + switch (e) + { +#if defined(EISDIR) + case EISDIR: + return 1; +#endif + case EACCES: + /* When skipping directories, don't worry about + directories that can't be opened. */ + if (isdir (file)) + return 1; + break; + } + } + + suppressible_error (file, e); + return 1; + } + + filename = file; + } + +#if defined(SET_BINARY) + /* Set input to binary mode. Pipes are simulated with files + on DOS, so this includes the case of "foo | grep bar". */ + if (!isatty (desc)) + SET_BINARY (desc); +#endif + + count = grep (desc, file, stats); + if (count < 0) + status = count + 2; + else + { + if (count_matches) + { + if (out_file) + { + print_filename(); + if (filename_mask) + print_sep(SEP_CHAR_SELECTED); + else + fputc(0, stdout); + } + printf ("%d\n", count); + } + + status = !count; + if (list_files == 1 - 2 * status) + { + print_filename(); + fputc('\n' & filename_mask, stdout); + } + + if (! file) + { + off_t required_offset = outleft ? bufoffset : after_last_match; + if ((bufmapped || required_offset != bufoffset) + && lseek (desc, required_offset, SEEK_SET) < 0 + && S_ISREG (stats->stat.st_mode)) + error (0, errno, "%s", filename); + } + else + while (close (desc) != 0) + if (errno != EINTR) + { + error (0, errno, "%s", file); + break; + } + } + + return status; +} + +static int +grepdir (char const *dir, struct stats const *stats) +{ + struct stats const *ancestor; + char *name_space; + int status = 1; + if ( excluded_directory_patterns && + excluded_filename (excluded_directory_patterns, dir, 0) ) { + return 1; + } + + + /* Mingw32 does not support st_ino. No known working hosts use zero + for st_ino, so assume that the Mingw32 bug applies if it's zero. */ + if (stats->stat.st_ino) + for (ancestor = stats; (ancestor = ancestor->parent) != 0; ) + if (ancestor->stat.st_ino == stats->stat.st_ino + && ancestor->stat.st_dev == stats->stat.st_dev) + { + if (!suppress_errors) + error (0, 0, _("warning: %s: %s\n"), dir, + _("recursive directory loop")); + return 1; + } + + name_space = savedir (dir, stats->stat.st_size, included_patterns, + excluded_patterns, excluded_directory_patterns); + + if (! name_space) + { + if (errno) + suppressible_error (dir, errno); + else + xalloc_die (); + } + else + { + size_t dirlen = strlen (dir); + int needs_slash = ! (dirlen == FILESYSTEM_PREFIX_LEN (dir) + || IS_SLASH (dir[dirlen - 1])); + char *file = NULL; + char const *namep = name_space; + struct stats child; + child.parent = stats; + out_file += !no_filenames; + while (*namep) + { + size_t namelen = strlen (namep); + file = xrealloc (file, dirlen + 1 + namelen + 1); + strcpy (file, dir); + file[dirlen] = '/'; + strcpy (file + dirlen + needs_slash, namep); + namep += namelen + 1; + status &= grepfile (file, &child); + } + out_file -= !no_filenames; + if (file) + free (file); + free (name_space); + } + + return status; +} + +static void +usage (int status) +{ + if (status != 0) + { + fprintf (stderr, _("Usage: %s [OPTION]... PATTERN [FILE]...\n"), + program_name); + fprintf (stderr, _("Try `%s --help' for more information.\n"), + program_name); + } + else + { + printf (_("Usage: %s [OPTION]... PATTERN [FILE]...\n"), program_name); + printf (_("\ +Search for PATTERN in each FILE or standard input.\n")); +#if defined(EGREP_PROGRAM) + printf (_("\ +PATTERN is an extended regular expression (ERE).\n")); +#elif defined(FGREP_PROGRAM) + printf (_("\ +PATTERN is a set of newline-separated fixed strings.\n")); +#else + printf (_("\ +PATTERN is, by default, a basic regular expression (BRE).\n")); +#endif /* ?GREP_PROGRAM */ + printf (_("\ +Example: %s -i 'hello world' menu.h main.c\n\ +\n\ +Regexp selection and interpretation:\n"), program_name); +#ifdef GREP_PROGRAM + printf (_("\ + -E, --extended-regexp PATTERN is an extended regular expression (ERE)\n\ + -F, --fixed-strings PATTERN is a set of newline-separated fixed strings\n\ + -G, --basic-regexp PATTERN is a basic regular expression (BRE)\n\ + -P, --perl-regexp PATTERN is a Perl regular expression\n")); + /* -X is undocumented on purpose. */ +#endif /* GREP_PROGRAM */ + printf (_("\ + -e, --regexp=PATTERN use PATTERN for matching\n\ + -f, --file=FILE obtain PATTERN from FILE\n\ + -i, --ignore-case ignore case distinctions\n\ + -w, --word-regexp force PATTERN to match only whole words\n\ + -x, --line-regexp force PATTERN to match only whole lines\n\ + -z, --null-data a data line ends in 0 byte, not newline\n")); + printf (_("\ +\n\ +Miscellaneous:\n\ + -s, --no-messages suppress error messages\n\ + -v, --invert-match select non-matching lines\n\ + -V, --version print version information and exit\n\ + --help display this help and exit\n\ + --mmap use memory-mapped input if possible\n")); + printf (_("\ +\n\ +Output control:\n\ + -m, --max-count=NUM stop after NUM matches\n\ + -b, --byte-offset print the byte offset with output lines\n\ + -n, --line-number print line number with output lines\n\ + --line-buffered flush output on every line\n\ + -H, --with-filename print the filename for each match\n\ + -h, --no-filename suppress the prefixing filename on output\n\ + --label=LABEL print LABEL as filename for standard input\n\ + -o, --only-matching show only the part of a line matching PATTERN\n\ + -q, --quiet, --silent suppress all normal output\n\ + --binary-files=TYPE assume that binary files are TYPE;\n\ + TYPE is `binary', `text', or `without-match'\n\ + -a, --text equivalent to --binary-files=text\n\ + -I equivalent to --binary-files=without-match\n\ + -d, --directories=ACTION how to handle directories;\n\ + ACTION is `read', `recurse', or `skip'\n\ + -D, --devices=ACTION how to handle devices, FIFOs and sockets;\n\ + ACTION is `read' or `skip'\n\ + -R, -r, --recursive equivalent to --directories=recurse\n\ + --include=FILE_PATTERN search only files that match FILE_PATTERN\n\ + --exclude=FILE_PATTERN skip files and directories matching FILE_PATTERN\n\ + --exclude-from=FILE skip files matching any file pattern from FILE\n\ + --exclude-dir=PATTERN directories that match PATTERN will be skipped.\n\ + -L, --files-without-match print only names of FILEs containing no match\n\ + -l, --files-with-matches print only names of FILEs containing matches\n\ + -c, --count print only a count of matching lines per FILE\n\ + -T, --initial-tab make tabs line up (if needed)\n\ + -Z, --null print 0 byte after FILE name\n")); + printf (_("\ +\n\ +Context control:\n\ + -B, --before-context=NUM print NUM lines of leading context\n\ + -A, --after-context=NUM print NUM lines of trailing context\n\ + -C, --context=NUM print NUM lines of output context\n\ + -NUM same as --context=NUM\n\ + --color[=WHEN],\n\ + --colour[=WHEN] use markers to highlight the matching strings;\n\ + WHEN is `always', `never', or `auto'\n\ + -U, --binary do not strip CR characters at EOL (MSDOS)\n\ + -u, --unix-byte-offsets report offsets as if CRs were not there (MSDOS)\n\ +\n")); +#if defined(EGREP_PROGRAM) + printf (_("\ +Invocation as `egrep' is deprecated; use `grep -E' instead.\n")); +#elif defined(FGREP_PROGRAM) + printf (_("\ +Invocation as `fgrep' is deprecated; use `grep -F' instead.\n")); +#else + printf (_("\ +`egrep' means `grep -E'. `fgrep' means `grep -F'.\n\ +Direct invocation as either `egrep' or `fgrep' is deprecated.\n")); +#endif /* ?GREP_PROGRAM */ + printf (_("\ +With no FILE, or when FILE is -, read standard input. If less than two FILEs\n\ +are given, assume -h. Exit status is 0 if any line was selected, 1 otherwise;\n\ +if any error occurs and -q was not given, the exit status is 2.\n")); + printf (_("\nReport bugs to <%s>.\n"), PACKAGE_BUGREPORT); + } + exit (status); +} + +#ifdef GREP_PROGRAM +static char const *matcher; + +/* Set the matcher to M, reporting any conflicts. */ +static void +setmatcher (char const *m) +{ + if (matcher && strcmp (matcher, m) != 0) + error (2, 0, _("conflicting matchers specified")); + matcher = m; +} + +/* Go through the matchers vector and look for the specified matcher. + If we find it, install it in compile and execute, and return 1. */ +static int +install_matcher (char const *name) +{ + int i; + + for (i = 0; matchers[i].compile; i++) + if (strcmp (name, matchers[i].name) == 0) + { + compile = matchers[i].compile; + execute = matchers[i].execute; + return 1; + } + return 0; +} +#endif /* GREP_PROGRAM */ + +static void +set_limits(void) +{ +#if defined(HAVE_SETRLIMIT) && defined(RLIMIT_STACK) + struct rlimit rlim; + + /* I think every platform needs to do this, so that regex.c + doesn't oveflow the stack. The default value of + `re_max_failures' is too large for some platforms: it needs + more than 3MB-large stack. + + The test for HAVE_SETRLIMIT should go into `configure'. */ + if (!getrlimit (RLIMIT_STACK, &rlim)) + { + long newlim; + extern long int re_max_failures; /* from regex.c */ + + /* Approximate the amount regex.c needs, plus some more. */ + newlim = re_max_failures * 2 * 20 * sizeof (char *); + if (newlim > rlim.rlim_max) + { + newlim = rlim.rlim_max; + re_max_failures = newlim / (2 * 20 * sizeof (char *)); + } + if (rlim.rlim_cur < newlim) + { + rlim.rlim_cur = newlim; + setrlimit (RLIMIT_STACK, &rlim); + } + } +#endif +} + +/* Find the white-space-separated options specified by OPTIONS, and + using BUF to store copies of these options, set ARGV[0], ARGV[1], + etc. to the option copies. Return the number N of options found. + Do not set ARGV[N] to NULL. If ARGV is NULL, do not store ARGV[0] + etc. Backslash can be used to escape whitespace (and backslashes). */ +static int +prepend_args (char const *options, char *buf, char **argv) +{ + char const *o = options; + char *b = buf; + int n = 0; + + for (;;) + { + while (ISSPACE ((unsigned char) *o)) + o++; + if (!*o) + return n; + if (argv) + argv[n] = b; + n++; + + do + if ((*b++ = *o++) == '\\' && *o) + b[-1] = *o++; + while (*o && ! ISSPACE ((unsigned char) *o)); + + *b++ = '\0'; + } +} + +/* Prepend the whitespace-separated options in OPTIONS to the argument + vector of a main program with argument count *PARGC and argument + vector *PARGV. */ +static void +prepend_default_options (char const *options, int *pargc, char ***pargv) +{ + if (options) + { + char *buf = xmalloc (strlen (options) + 1); + int prepended = prepend_args (options, buf, (char **) NULL); + int argc = *pargc; + char * const *argv = *pargv; + char **pp = (char **) xmalloc ((prepended + argc + 1) * sizeof *pp); + *pargc = prepended + argc; + *pargv = pp; + *pp++ = *argv++; + pp += prepend_args (options, buf, pp); + while ((*pp++ = *argv++)) + continue; + } +} + +/* Get the next non-digit option from ARGC and ARGV. + Return -1 if there are no more options. + Process any digit options that were encountered on the way, + and store the resulting integer into *DEFAULT_CONTEXT. */ +static int +get_nondigit_option (int argc, char *const *argv, int *default_context) +{ + int opt; + char buf[sizeof (uintmax_t) * CHAR_BIT + 4]; + char *p = buf; + + /* Set buf[0] to anything but '0', for the leading-zero test below. */ + buf[0] = '\0'; + + while (opt = getopt_long (argc, argv, short_options, long_options, NULL), + '0' <= opt && opt <= '9') + { + /* Suppress trivial leading zeros, to avoid incorrect + diagnostic on strings like 00000000000. */ + p -= buf[0] == '0'; + + if (p == buf + sizeof buf - 4) + { + /* Too many digits. Append "..." to make context_length_arg + complain about "X...", where X contains the digits seen + so far. */ + strcpy (p, "..."); + p += 3; + break; + } + *p++ = opt; + } + if (p != buf) + { + *p = '\0'; + context_length_arg (buf, default_context); + } + + return opt; +} + +/* Parse GREP_COLORS. The default would look like: + GREP_COLORS='ms=01;31:mc=01;31:sl=:cx=:fn=35:ln=32:bn=32:se=36' + with boolean capabilities (ne and rv) unset (i.e., omitted). + No character escaping is needed or supported. */ +static void +parse_grep_colors (void) +{ + const char *p; + char *q; + char *name; + char *val; + + p = getenv("GREP_COLORS"); /* Plural! */ + if (p == NULL || *p == '\0') + return; + + /* Work off a writable copy. */ + q = xmalloc(strlen(p) + 1); + if (q == NULL) + return; + strcpy(q, p); + + name = q; + val = NULL; + /* From now on, be well-formed or you're gone. */ + for (;;) + if (*q == ':' || *q == '\0') + { + char c = *q; + struct color_cap *cap; + + *q++ = '\0'; /* Terminate name or val. */ + /* Empty name without val (empty cap) + * won't match and will be ignored. */ + for (cap = color_dict; cap->name; cap++) + if (strcmp(cap->name, name) == 0) + break; + /* If name unknown, go on for forward compatibility. */ + if (cap->name) + if (cap->var) + { + if (val) + *(cap->var) = val; + else + error(0, 0, _("In GREP_COLORS=\"%s\", the \"%s\" capacity " + "needs a value (\"=...\"); skipped."), p, name); + } + else if (val) + error(0, 0, _("In GREP_COLORS=\"%s\", the \"%s\" capacity " + "is boolean and cannot take a value (\"=%s\"); " + "skipped."), p, name, val); + if (cap->fct) + { + const char *err_str = cap->fct(); + + if (err_str) + error(0, 0, _("In GREP_COLORS=\"%s\", the \"%s\" capacity %s."), + p, name, err_str); + } + if (c == '\0') + return; + name = q; + val = NULL; + } + else if (*q == '=') + { + if (q == name || val) + goto ill_formed; + *q++ = '\0'; /* Terminate name. */ + val = q; /* Can be the empty string. */ + } + else if (val == NULL) + q++; /* Accumulate name. */ + else if (*q == ';' || (*q >= '0' && *q <= '9')) + q++; /* Accumulate val. Protect the terminal from being sent crap. */ + else + goto ill_formed; + + ill_formed: + error(0, 0, _("Stopped processing of ill-formed GREP_COLORS=\"%s\" " + "at remaining substring \"%s\"."), p, q); +} + +/* mb_icase_keys() is called by main() to convert its "keys" string with + strlen() "len" to lowercase if match_icase is true. Pointers are used + to implement in-out call-by-reference parameters. */ +#ifdef MBS_SUPPORT +static void +mb_icase_keys (char **keys, size_t *len) +{ + wchar_t wc; + mbstate_t sti, stj; /* i for input/old, j for output/new. */ + size_t i, j, li, lj; /* l for total string length (minus '\0'). */ + char *ki, *kj; /* k for keys. */ + int mcm; + + if ((mcm = MB_CUR_MAX) == 1) + return; + + li = *len; + ki = *keys; + /* We use a new buffer because some multi-octet characters change + length through a lower-case conversion. For example: + len(U+0049)=1 --> len(U+0131)=2 under tr_TR.UTF-8 + len(U+0130)=2 --> len(U+0069)=1 under en_US.UTF-8 + len(U+2126)=3 --> len(U+03C9)=2 under en_US.UTF-8 + len(U+212A)=3 --> len(U+006B)=1 under en_US.UTF-8 + len(U+212B)=3 --> len(U+00E5)=2 under en_US.UTF-8 */ + lj = li + mcm; + kj = xmalloc(lj + 1); + + memset(&sti, 0, sizeof(mbstate_t)); + memset(&stj, 0, sizeof(mbstate_t)); + for (i = j = 0; i < li ;) + { + size_t mbclen; + mbclen = mbrtowc(&wc, ki + i, li - i, &sti); + if (lj < j + mcm) + { + lj += mcm; + kj = xrealloc(kj, lj + 1); + } + if (mbclen == (size_t) -1 || mbclen == (size_t) -2 || mbclen == 0) + { + /* An invalid sequence, or a truncated multi-octet character. + We treat it as a single-octet character. */ + kj[j++] = ki[i++]; + } + else + { + /* Doing towupper() before towlower() helps a few hairy cases and is + not too costly since this is the PATTERN and is done only once. */ + wc = towupper((wint_t)wc); + wc = towlower((wint_t)wc); + j += wcrtomb(kj + j, wc, &stj); + i += mbclen; + } + } + kj[j] = '\0'; + + free(ki); + *keys = kj; + *len = j; +} +#endif /* MBS_SUPPORT */ + +int +main (int argc, char **argv) +{ + char *keys; + size_t keycc, oldcc, keyalloc; + int with_filenames; + int opt, cc, status; + int default_context; + FILE *fp; + extern char *optarg; + extern int optind; + + initialize_main (&argc, &argv); + program_name = argv[0]; + + keys = NULL; + keycc = 0; + with_filenames = 0; + eolbyte = '\n'; + filename_mask = ~0; + + max_count = TYPE_MAXIMUM (off_t); + + /* The value -1 means to use DEFAULT_CONTEXT. */ + out_after = out_before = -1; + /* Default before/after context: chaged by -C/-NUM options */ + default_context = 0; + /* Changed by -o option */ + only_matching = 0; + + /* Internationalization. */ +#if defined(HAVE_SETLOCALE) + setlocale (LC_ALL, ""); +#endif +#if defined(ENABLE_NLS) + bindtextdomain (PACKAGE, LOCALEDIR); + textdomain (PACKAGE); +#endif + + atexit (close_stdout); + + prepend_default_options (getenv ("GREP_OPTIONS"), &argc, &argv); + + while ((opt = get_nondigit_option (argc, argv, &default_context)) != -1) + switch (opt) + { + case 'A': + context_length_arg (optarg, &out_after); + break; + + case 'B': + context_length_arg (optarg, &out_before); + break; + + case 'C': + /* Set output match context, but let any explicit leading or + trailing amount specified with -A or -B stand. */ + context_length_arg (optarg, &default_context); + break; + + case 'D': + if (strcmp (optarg, "read") == 0) + devices = READ_DEVICES; + else if (strcmp (optarg, "skip") == 0) + devices = SKIP_DEVICES; + else + error (2, 0, _("unknown devices method")); + break; + +#ifdef GREP_PROGRAM + case 'E': + setmatcher ("egrep"); + break; + + case 'F': + setmatcher ("fgrep"); + break; + + case 'P': + setmatcher ("perl"); + break; + + case 'G': + setmatcher ("grep"); + break; + + case 'X': /* undocumented on purpose */ + setmatcher (optarg); + break; +#endif /* GREP_PROGRAM */ + + case 'H': + with_filenames = 1; + break; + + case 'I': + binary_files = WITHOUT_MATCH_BINARY_FILES; + break; + + case 'T': + align_tabs = 1; + break; + + case 'U': +#if defined(HAVE_DOS_FILE_CONTENTS) + dos_use_file_type = DOS_BINARY; +#endif + break; + + case 'u': +#if defined(HAVE_DOS_FILE_CONTENTS) + dos_report_unix_offset = 1; +#endif + break; + + case 'V': + show_version = 1; + break; + + case 'a': + binary_files = TEXT_BINARY_FILES; + break; + + case 'b': + out_byte = 1; + break; + + case 'c': + count_matches = 1; + break; + + case 'd': + if (strcmp (optarg, "read") == 0) + directories = READ_DIRECTORIES; + else if (strcmp (optarg, "skip") == 0) + directories = SKIP_DIRECTORIES; + else if (strcmp (optarg, "recurse") == 0) + directories = RECURSE_DIRECTORIES; + else + error (2, 0, _("unknown directories method")); + break; + + case 'e': + cc = strlen (optarg); + keys = xrealloc (keys, keycc + cc + 1); + strcpy (&keys[keycc], optarg); + keycc += cc; + keys[keycc++] = '\n'; + break; + + case 'f': + fp = strcmp (optarg, "-") != 0 ? fopen (optarg, "r") : stdin; + if (!fp) + error (2, errno, "%s", optarg); + for (keyalloc = 1; keyalloc <= keycc + 1; keyalloc *= 2) + ; + keys = xrealloc (keys, keyalloc); + oldcc = keycc; + while (!feof (fp) + && (cc = fread (keys + keycc, 1, keyalloc - 1 - keycc, fp)) > 0) + { + keycc += cc; + if (keycc == keyalloc - 1) + keys = xrealloc (keys, keyalloc *= 2); + } + if (fp != stdin) + fclose(fp); + /* Append final newline if file ended in non-newline. */ + if (oldcc != keycc && keys[keycc - 1] != '\n') + keys[keycc++] = '\n'; + break; + + case 'h': + no_filenames = 1; + break; + + case 'i': + case 'y': /* For old-timers . . . */ + match_icase = 1; + break; + + case 'L': + /* Like -l, except list files that don't contain matches. + Inspired by the same option in Hume's gre. */ + list_files = -1; + break; + + case 'l': + list_files = 1; + break; + + case 'm': + { + uintmax_t value; + switch (xstrtoumax (optarg, 0, 10, &value, "")) + { + case LONGINT_OK: + max_count = value; + if (0 <= max_count && max_count == value) + break; + /* Fall through. */ + case LONGINT_OVERFLOW: + max_count = TYPE_MAXIMUM (off_t); + break; + + default: + error (2, 0, _("invalid max count")); + } + } + break; + + case 'n': + out_line = 1; + break; + + case 'o': + only_matching = 1; + break; + + case 'q': + exit_on_match = 1; + close_stdout_set_status(0); + break; + + case 'R': + case 'r': + directories = RECURSE_DIRECTORIES; + break; + + case 's': + suppress_errors = 1; + break; + + case 'v': + out_invert = 1; + break; + + case 'w': + match_words = 1; + break; + + case 'x': + match_lines = 1; + break; + + case 'Z': + filename_mask = 0; + break; + + case 'z': + eolbyte = '\0'; + break; + + case BINARY_FILES_OPTION: + if (strcmp (optarg, "binary") == 0) + binary_files = BINARY_BINARY_FILES; + else if (strcmp (optarg, "text") == 0) + binary_files = TEXT_BINARY_FILES; + else if (strcmp (optarg, "without-match") == 0) + binary_files = WITHOUT_MATCH_BINARY_FILES; + else + error (2, 0, _("unknown binary-files type")); + break; + + case COLOR_OPTION: + if(optarg) { + if(!strcasecmp(optarg, "always") || !strcasecmp(optarg, "yes") || + !strcasecmp(optarg, "force")) + color_option = 1; + else if(!strcasecmp(optarg, "never") || !strcasecmp(optarg, "no") || + !strcasecmp(optarg, "none")) + color_option = 0; + else if(!strcasecmp(optarg, "auto") || !strcasecmp(optarg, "tty") || + !strcasecmp(optarg, "if-tty")) + color_option = 2; + else + show_help = 1; + } else + color_option = 2; + if(color_option == 2) { + if(isatty(STDOUT_FILENO) && getenv("TERM") && + strcmp(getenv("TERM"), "dumb")) + color_option = 1; + else + color_option = 0; + } + break; + + case EXCLUDE_OPTION: + if (!excluded_patterns) + excluded_patterns = new_exclude (); + add_exclude (excluded_patterns, optarg); + break; + case EXCLUDE_FROM_OPTION: + if (!excluded_patterns) + excluded_patterns = new_exclude (); + if (add_exclude_file (add_exclude, excluded_patterns, optarg, '\n') + != 0) + { + error (2, errno, "%s", optarg); + } + break; + + case EXCLUDE_DIRECTORY_OPTION: + if (!excluded_directory_patterns) + excluded_directory_patterns = new_exclude (); + add_exclude (excluded_directory_patterns, optarg); + break; + + case INCLUDE_OPTION: + if (!included_patterns) + included_patterns = new_exclude (); + add_exclude (included_patterns, optarg); + break; + + + + case LINE_BUFFERED_OPTION: + line_buffered = 1; + break; + + case LABEL_OPTION: + label = optarg; + break; + + case 0: + /* long options */ + break; + + default: + usage (2); + break; + + } + + /* POSIX.2 says that -q overrides -l, which in turn overrides the + other output options. */ + if (exit_on_match) + list_files = 0; + if (exit_on_match | list_files) + { + count_matches = 0; + done_on_match = 1; + } + out_quiet = count_matches | done_on_match; + + if (out_after < 0) + out_after = default_context; + if (out_before < 0) + out_before = default_context; + + if (color_option) + { + /* Legacy. */ + char *userval = getenv ("GREP_COLOR"); + if (userval != NULL && *userval != '\0') + selected_match_color = context_match_color = userval; + + /* New GREP_COLORS has priority. */ + parse_grep_colors(); + } + + if (show_version) + { + printf ("%s\n\n", PACKAGE_STRING); + printf (_("\ +Copyright (C) 1988, 1992-2002, 2004, 2005 Free Software Foundation, Inc.\n")); + printf (_("\ +This is free software; see the source for copying conditions. There is NO\n\ +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n")); + printf ("\n"); + exit (0); + } + + if (show_help) + usage (0); + + if (keys) + { + if (keycc == 0) + { + /* No keys were specified (e.g. -f /dev/null). Match nothing. */ + out_invert ^= 1; + match_lines = match_words = 0; + } + else + /* Strip trailing newline. */ + --keycc; + } + else + if (optind < argc) + { + /* A copy must be made in case of an xrealloc() or free() later. */ + keycc = strlen(argv[optind]); + keys = xmalloc(keycc + 1); + strcpy(keys, argv[optind++]); + } + else + usage (2); + +#ifdef GREP_PROGRAM + if (! matcher) + matcher = "grep"; + + if (!install_matcher (matcher) && !install_matcher ("default")) + abort (); +#endif /* GREP_PROGRAM */ + + set_limits(); + +#ifdef MBS_SUPPORT + if (match_icase) + mb_icase_keys (&keys, &keycc); +#endif /* MBS_SUPPORT */ + + compile(keys, keycc); + + if ((argc - optind > 1 && !no_filenames) || with_filenames) + out_file = 1; + +#ifdef SET_BINARY + /* Output is set to binary mode because we shouldn't convert + NL to CR-LF pairs, especially when grepping binary files. */ + if (!isatty (1)) + SET_BINARY (1); +#endif + + if (max_count == 0) + exit (1); + + if (optind < argc) + { + status = 1; + do + { + char *file = argv[optind]; + if ((included_patterns || excluded_patterns) + && !isdir (file)) + { + if (included_patterns && + ! excluded_filename (included_patterns, file, 0)) + continue; + if (excluded_patterns && + excluded_filename (excluded_patterns, file, 0)) + continue; + } + status &= grepfile (strcmp (file, "-") == 0 ? (char *) NULL : file, + &stats_base); + } + while ( ++optind < argc); + } + else + status = grepfile ((char *) NULL, &stats_base); + + /* We register via atexit() to test stdout. */ + exit (errseen ? 2 : status); +} +/* vim:set shiftwidth=2: */ diff --git a/src/grep.h b/src/grep.h new file mode 100644 index 0000000..f8b6f45 --- /dev/null +++ b/src/grep.h @@ -0,0 +1,72 @@ +/* grep.h - interface to grep driver for searching subroutines. + Copyright (C) 1992, 1998, 2001 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., 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ + +#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 6) || __STRICT_ANSI__ +# define __attribute__(x) +#endif + +/* We build specialized legacy "egrep" and "fgrep" programs. + No program adjusts its behavior according to its argv[0]. + No scripts are provided as an alternative. Distributors + are free to do otherwise, but it is their burden to do so. */ +#if !defined(GREP_PROGRAM) && !defined(EGREP_PROGRAM) && !defined(FGREP_PROGRAM) +# define GREP_PROGRAM +#endif + +/* The two functions each matcher provides. */ +#define COMPILE_RET void +#define COMPILE_ARGS \ + (char const *pattern, size_t size) +#define EXECUTE_RET size_t +#define EXECUTE_ARGS \ + (char const *buf, size_t size, size_t *match_size, char const *start_ptr) + /* start_ptr == NULL means the caller is not looking for an exact match. */ + +#ifdef GREP_PROGRAM +/* Function definitions. */ +# define COMPILE_FCT(f) static COMPILE_RET f COMPILE_ARGS +# define EXECUTE_FCT(f) static EXECUTE_RET f EXECUTE_ARGS +/* Function pointer types. */ +typedef COMPILE_RET (*compile_fp_t) PARAMS (COMPILE_ARGS); +typedef EXECUTE_RET (*execute_fp_t) PARAMS (EXECUTE_ARGS); + +/* grep.c expects the matchers vector to be terminated + by an entry with a NULL compile, and to contain at least + an entry named "default". */ +extern struct matcher +{ + char name[8]; + compile_fp_t compile; + execute_fp_t execute; +} const matchers[]; +#else /* !GREP_PROGRAM */ +/* Straight functions for specialized "egrep" and "fgrep" programs. */ +/* Function definitions. */ +# define COMPILE_FCT(f) COMPILE_RET compile COMPILE_ARGS +# define EXECUTE_FCT(f) EXECUTE_RET execute EXECUTE_ARGS +/* Function prototypes. */ +extern COMPILE_RET compile PARAMS (COMPILE_ARGS); +extern EXECUTE_RET execute PARAMS (EXECUTE_ARGS); +#endif /* GREP_PROGRAM */ + +/* The following flags are exported from grep for the matchers + to look at. */ +extern int match_icase; /* -i */ +extern int match_words; /* -w */ +extern int match_lines; /* -x */ +extern unsigned char eolbyte; /* -z */ diff --git a/src/kwset.c b/src/kwset.c new file mode 100644 index 0000000..e66193b --- /dev/null +++ b/src/kwset.c @@ -0,0 +1,778 @@ +/* kwset.c - search for any of a set of keywords. + Copyright 1989, 1998, 2000, 2005 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., 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ + +/* Written August 1989 by Mike Haertel. + The author may be reached (Email) at the address mike@ai.mit.edu, + or (US mail) as Mike Haertel c/o Free Software Foundation. */ + +/* The algorithm implemented by these routines bears a startling resemblence + to one discovered by Beate Commentz-Walter, although it is not identical. + See "A String Matching Algorithm Fast on the Average," Technical Report, + IBM-Germany, Scientific Center Heidelberg, Tiergartenstrasse 15, D-6900 + Heidelberg, Germany. See also Aho, A.V., and M. Corasick, "Efficient + String Matching: An Aid to Bibliographic Search," CACM June 1975, + Vol. 18, No. 6, which describes the failure function used below. */ + +#ifdef HAVE_CONFIG_H +# include +#endif +#include +#include "system.h" +#include "kwset.h" +#include "obstack.h" + +#ifdef GREP +extern char *xmalloc(); +# undef malloc +# define malloc xmalloc +#endif + +#define NCHAR (UCHAR_MAX + 1) +#define obstack_chunk_alloc malloc +#define obstack_chunk_free free + +#define U(c) ((unsigned char) (c)) + +/* Balanced tree of edges and labels leaving a given trie node. */ +struct tree +{ + struct tree *llink; /* Left link; MUST be first field. */ + struct tree *rlink; /* Right link (to larger labels). */ + struct trie *trie; /* Trie node pointed to by this edge. */ + unsigned char label; /* Label on this edge. */ + char balance; /* Difference in depths of subtrees. */ +}; + +/* Node of a trie representing a set of reversed keywords. */ +struct trie +{ + unsigned int accepting; /* Word index of accepted word, or zero. */ + struct tree *links; /* Tree of edges leaving this node. */ + struct trie *parent; /* Parent of this node. */ + struct trie *next; /* List of all trie nodes in level order. */ + struct trie *fail; /* Aho-Corasick failure function. */ + int depth; /* Depth of this node from the root. */ + int shift; /* Shift function for search failures. */ + int maxshift; /* Max shift of self and descendents. */ +}; + +/* Structure returned opaquely to the caller, containing everything. */ +struct kwset +{ + struct obstack obstack; /* Obstack for node allocation. */ + int words; /* Number of words in the trie. */ + struct trie *trie; /* The trie itself. */ + int mind; /* Minimum depth of an accepting node. */ + int maxd; /* Maximum depth of any node. */ + unsigned char delta[NCHAR]; /* Delta table for rapid search. */ + struct trie *next[NCHAR]; /* Table of children of the root. */ + char *target; /* Target string if there's only one. */ + int mind2; /* Used in Boyer-Moore search for one string. */ + char const *trans; /* Character translation table. */ +}; + +/* Allocate and initialize a keyword set object, returning an opaque + pointer to it. Return NULL if memory is not available. */ +kwset_t +kwsalloc (char const *trans) +{ + struct kwset *kwset; + + kwset = (struct kwset *) malloc(sizeof (struct kwset)); + if (!kwset) + return NULL; + + obstack_init(&kwset->obstack); + kwset->words = 0; + kwset->trie + = (struct trie *) obstack_alloc(&kwset->obstack, sizeof (struct trie)); + if (!kwset->trie) + { + kwsfree((kwset_t) kwset); + return NULL; + } + kwset->trie->accepting = 0; + kwset->trie->links = NULL; + kwset->trie->parent = NULL; + kwset->trie->next = NULL; + kwset->trie->fail = NULL; + kwset->trie->depth = 0; + kwset->trie->shift = 0; + kwset->mind = INT_MAX; + kwset->maxd = -1; + kwset->target = NULL; + kwset->trans = trans; + + return (kwset_t) kwset; +} + +/* This upper bound is valid for CHAR_BIT >= 4 and + exact for CHAR_BIT in { 4..11, 13, 15, 17, 19 }. */ +#define DEPTH_SIZE (CHAR_BIT + CHAR_BIT/2) + +/* Add the given string to the contents of the keyword set. Return NULL + for success, an error message otherwise. */ +const char * +kwsincr (kwset_t kws, char const *text, size_t len) +{ + struct kwset *kwset; + register struct trie *trie; + register unsigned char label; + register struct tree *link; + register int depth; + struct tree *links[DEPTH_SIZE]; + enum { L, R } dirs[DEPTH_SIZE]; + struct tree *t, *r, *l, *rl, *lr; + + kwset = (struct kwset *) kws; + trie = kwset->trie; + text += len; + + /* Descend the trie (built of reversed keywords) character-by-character, + installing new nodes when necessary. */ + while (len--) + { + label = kwset->trans ? kwset->trans[U(*--text)] : *--text; + + /* Descend the tree of outgoing links for this trie node, + looking for the current character and keeping track + of the path followed. */ + link = trie->links; + links[0] = (struct tree *) &trie->links; + dirs[0] = L; + depth = 1; + + while (link && label != link->label) + { + links[depth] = link; + if (label < link->label) + dirs[depth++] = L, link = link->llink; + else + dirs[depth++] = R, link = link->rlink; + } + + /* The current character doesn't have an outgoing link at + this trie node, so build a new trie node and install + a link in the current trie node's tree. */ + if (!link) + { + link = (struct tree *) obstack_alloc(&kwset->obstack, + sizeof (struct tree)); + if (!link) + return _("memory exhausted"); + link->llink = NULL; + link->rlink = NULL; + link->trie = (struct trie *) obstack_alloc(&kwset->obstack, + sizeof (struct trie)); + if (!link->trie) + { + obstack_free(&kwset->obstack, link); + return _("memory exhausted"); + } + link->trie->accepting = 0; + link->trie->links = NULL; + link->trie->parent = trie; + link->trie->next = NULL; + link->trie->fail = NULL; + link->trie->depth = trie->depth + 1; + link->trie->shift = 0; + link->label = label; + link->balance = 0; + + /* Install the new tree node in its parent. */ + if (dirs[--depth] == L) + links[depth]->llink = link; + else + links[depth]->rlink = link; + + /* Back up the tree fixing the balance flags. */ + while (depth && !links[depth]->balance) + { + if (dirs[depth] == L) + --links[depth]->balance; + else + ++links[depth]->balance; + --depth; + } + + /* Rebalance the tree by pointer rotations if necessary. */ + if (depth && ((dirs[depth] == L && --links[depth]->balance) + || (dirs[depth] == R && ++links[depth]->balance))) + { + switch (links[depth]->balance) + { + case (char) -2: + switch (dirs[depth + 1]) + { + case L: + r = links[depth], t = r->llink, rl = t->rlink; + t->rlink = r, r->llink = rl; + t->balance = r->balance = 0; + break; + case R: + r = links[depth], l = r->llink, t = l->rlink; + rl = t->rlink, lr = t->llink; + t->llink = l, l->rlink = lr, t->rlink = r, r->llink = rl; + l->balance = t->balance != 1 ? 0 : -1; + r->balance = t->balance != (char) -1 ? 0 : 1; + t->balance = 0; + break; + default: + abort (); + } + break; + case 2: + switch (dirs[depth + 1]) + { + case R: + l = links[depth], t = l->rlink, lr = t->llink; + t->llink = l, l->rlink = lr; + t->balance = l->balance = 0; + break; + case L: + l = links[depth], r = l->rlink, t = r->llink; + lr = t->llink, rl = t->rlink; + t->llink = l, l->rlink = lr, t->rlink = r, r->llink = rl; + l->balance = t->balance != 1 ? 0 : -1; + r->balance = t->balance != (char) -1 ? 0 : 1; + t->balance = 0; + break; + default: + abort (); + } + break; + default: + abort (); + } + + if (dirs[depth - 1] == L) + links[depth - 1]->llink = t; + else + links[depth - 1]->rlink = t; + } + } + + trie = link->trie; + } + + /* Mark the node we finally reached as accepting, encoding the + index number of this word in the keyword set so far. */ + if (!trie->accepting) + trie->accepting = 1 + 2 * kwset->words; + ++kwset->words; + + /* Keep track of the longest and shortest string of the keyword set. */ + if (trie->depth < kwset->mind) + kwset->mind = trie->depth; + if (trie->depth > kwset->maxd) + kwset->maxd = trie->depth; + + return NULL; +} + +/* Enqueue the trie nodes referenced from the given tree in the + given queue. */ +static void +enqueue (struct tree *tree, struct trie **last) +{ + if (!tree) + return; + enqueue(tree->llink, last); + enqueue(tree->rlink, last); + (*last) = (*last)->next = tree->trie; +} + +/* Compute the Aho-Corasick failure function for the trie nodes referenced + from the given tree, given the failure function for their parent as + well as a last resort failure node. */ +static void +treefails (register struct tree const *tree, struct trie const *fail, + struct trie *recourse) +{ + register struct tree *link; + + if (!tree) + return; + + treefails(tree->llink, fail, recourse); + treefails(tree->rlink, fail, recourse); + + /* Find, in the chain of fails going back to the root, the first + node that has a descendent on the current label. */ + while (fail) + { + link = fail->links; + while (link && tree->label != link->label) + if (tree->label < link->label) + link = link->llink; + else + link = link->rlink; + if (link) + { + tree->trie->fail = link->trie; + return; + } + fail = fail->fail; + } + + tree->trie->fail = recourse; +} + +/* Set delta entries for the links of the given tree such that + the preexisting delta value is larger than the current depth. */ +static void +treedelta (register struct tree const *tree, + register unsigned int depth, + unsigned char delta[]) +{ + if (!tree) + return; + treedelta(tree->llink, depth, delta); + treedelta(tree->rlink, depth, delta); + if (depth < delta[tree->label]) + delta[tree->label] = depth; +} + +/* Return true if A has every label in B. */ +static int +hasevery (register struct tree const *a, register struct tree const *b) +{ + if (!b) + return 1; + if (!hasevery(a, b->llink)) + return 0; + if (!hasevery(a, b->rlink)) + return 0; + while (a && b->label != a->label) + if (b->label < a->label) + a = a->llink; + else + a = a->rlink; + return !!a; +} + +/* Compute a vector, indexed by character code, of the trie nodes + referenced from the given tree. */ +static void +treenext (struct tree const *tree, struct trie *next[]) +{ + if (!tree) + return; + treenext(tree->llink, next); + treenext(tree->rlink, next); + next[tree->label] = tree->trie; +} + +/* Compute the shift for each trie node, as well as the delta + table and next cache for the given keyword set. */ +const char * +kwsprep (kwset_t kws) +{ + register struct kwset *kwset; + register int i; + register struct trie *curr; + register char const *trans; + unsigned char delta[NCHAR]; + + kwset = (struct kwset *) kws; + + /* Initial values for the delta table; will be changed later. The + delta entry for a given character is the smallest depth of any + node at which an outgoing edge is labeled by that character. */ + memset(delta, kwset->mind < UCHAR_MAX ? kwset->mind : UCHAR_MAX, NCHAR); + + /* Check if we can use the simple boyer-moore algorithm, instead + of the hairy commentz-walter algorithm. */ + if (kwset->words == 1 && kwset->trans == NULL) + { + char c; + + /* Looking for just one string. Extract it from the trie. */ + kwset->target = obstack_alloc(&kwset->obstack, kwset->mind); + if (!kwset->target) + return _("memory exhausted"); + for (i = kwset->mind - 1, curr = kwset->trie; i >= 0; --i) + { + kwset->target[i] = curr->links->label; + curr = curr->links->trie; + } + /* Build the Boyer Moore delta. Boy that's easy compared to CW. */ + for (i = 0; i < kwset->mind; ++i) + delta[U(kwset->target[i])] = kwset->mind - (i + 1); + /* Find the minimal delta2 shift that we might make after + a backwards match has failed. */ + c = kwset->target[kwset->mind - 1]; + for (i = kwset->mind - 2; i >= 0; --i) + if (kwset->target[i] == c) + break; + kwset->mind2 = kwset->mind - (i + 1); + } + else + { + register struct trie *fail; + struct trie *last, *next[NCHAR]; + + /* Traverse the nodes of the trie in level order, simultaneously + computing the delta table, failure function, and shift function. */ + for (curr = last = kwset->trie; curr; curr = curr->next) + { + /* Enqueue the immediate descendents in the level order queue. */ + enqueue(curr->links, &last); + + curr->shift = kwset->mind; + curr->maxshift = kwset->mind; + + /* Update the delta table for the descendents of this node. */ + treedelta(curr->links, curr->depth, delta); + + /* Compute the failure function for the decendents of this node. */ + treefails(curr->links, curr->fail, kwset->trie); + + /* Update the shifts at each node in the current node's chain + of fails back to the root. */ + for (fail = curr->fail; fail; fail = fail->fail) + { + /* If the current node has some outgoing edge that the fail + doesn't, then the shift at the fail should be no larger + than the difference of their depths. */ + if (!hasevery(fail->links, curr->links)) + if (curr->depth - fail->depth < fail->shift) + fail->shift = curr->depth - fail->depth; + + /* If the current node is accepting then the shift at the + fail and its descendents should be no larger than the + difference of their depths. */ + if (curr->accepting && fail->maxshift > curr->depth - fail->depth) + fail->maxshift = curr->depth - fail->depth; + } + } + + /* Traverse the trie in level order again, fixing up all nodes whose + shift exceeds their inherited maxshift. */ + for (curr = kwset->trie->next; curr; curr = curr->next) + { + if (curr->maxshift > curr->parent->maxshift) + curr->maxshift = curr->parent->maxshift; + if (curr->shift > curr->maxshift) + curr->shift = curr->maxshift; + } + + /* Create a vector, indexed by character code, of the outgoing links + from the root node. */ + for (i = 0; i < NCHAR; ++i) + next[i] = NULL; + treenext(kwset->trie->links, next); + + if ((trans = kwset->trans) != NULL) + for (i = 0; i < NCHAR; ++i) + kwset->next[i] = next[U(trans[i])]; + else + memcpy(kwset->next, next, NCHAR * sizeof(struct trie *)); + } + + /* Fix things up for any translation table. */ + if ((trans = kwset->trans) != NULL) + for (i = 0; i < NCHAR; ++i) + kwset->delta[i] = delta[U(trans[i])]; + else + memcpy(kwset->delta, delta, NCHAR); + + return NULL; +} + +/* Fast boyer-moore search. */ +static size_t +bmexec (kwset_t kws, char const *text, size_t size) +{ + struct kwset const *kwset; + register unsigned char const *d1; + register char const *ep, *sp, *tp; + register int d, gc, i, len, md2; + + kwset = (struct kwset const *) kws; + len = kwset->mind; + + if (len == 0) + return 0; + if (len > size) + return -1; + if (len == 1) + { + tp = memchr (text, kwset->target[0], size); + return tp ? tp - text : -1; + } + + d1 = kwset->delta; + sp = kwset->target + len; + gc = U(sp[-2]); + md2 = kwset->mind2; + tp = text + len; + + /* Significance of 12: 1 (initial offset) + 10 (skip loop) + 1 (md2). */ + if (size > 12 * len) + /* 11 is not a bug, the initial offset happens only once. */ + for (ep = text + size - 11 * len;;) + { + while (tp <= ep) + { + d = d1[U(tp[-1])], tp += d; + d = d1[U(tp[-1])], tp += d; + if (d == 0) + goto found; + d = d1[U(tp[-1])], tp += d; + d = d1[U(tp[-1])], tp += d; + d = d1[U(tp[-1])], tp += d; + if (d == 0) + goto found; + d = d1[U(tp[-1])], tp += d; + d = d1[U(tp[-1])], tp += d; + d = d1[U(tp[-1])], tp += d; + if (d == 0) + goto found; + d = d1[U(tp[-1])], tp += d; + d = d1[U(tp[-1])], tp += d; + } + break; + found: + if (U(tp[-2]) == gc) + { + for (i = 3; i <= len && U(tp[-i]) == U(sp[-i]); ++i) + ; + if (i > len) + return tp - len - text; + } + tp += md2; + } + + /* Now we have only a few characters left to search. We + carefully avoid ever producing an out-of-bounds pointer. */ + ep = text + size; + d = d1[U(tp[-1])]; + while (d <= ep - tp) + { + d = d1[U((tp += d)[-1])]; + if (d != 0) + continue; + if (U(tp[-2]) == gc) + { + for (i = 3; i <= len && U(tp[-i]) == U(sp[-i]); ++i) + ; + if (i > len) + return tp - len - text; + } + d = md2; + } + + return -1; +} + +/* Hairy multiple string search. */ +static size_t +cwexec (kwset_t kws, char const *text, size_t len, struct kwsmatch *kwsmatch) +{ + struct kwset const *kwset; + struct trie * const *next; + struct trie const *trie; + struct trie const *accept; + char const *beg, *lim, *mch, *lmch; + register unsigned char c; + register unsigned char const *delta; + register int d; + register char const *end, *qlim; + register struct tree const *tree; + register char const *trans; + +#ifdef lint + accept = NULL; +#endif + + /* Initialize register copies and look for easy ways out. */ + kwset = (struct kwset *) kws; + if (len < kwset->mind) + return -1; + next = kwset->next; + delta = kwset->delta; + trans = kwset->trans; + lim = text + len; + end = text; + if ((d = kwset->mind) != 0) + mch = NULL; + else + { + mch = text, accept = kwset->trie; + goto match; + } + + if (len >= 4 * kwset->mind) + qlim = lim - 4 * kwset->mind; + else + qlim = NULL; + + while (lim - end >= d) + { + if (qlim && end <= qlim) + { + end += d - 1; + while ((d = delta[c = *end]) && end < qlim) + { + end += d; + end += delta[U(*end)]; + end += delta[U(*end)]; + } + ++end; + } + else + d = delta[c = (end += d)[-1]]; + if (d) + continue; + beg = end - 1; + trie = next[c]; + if (trie->accepting) + { + mch = beg; + accept = trie; + } + d = trie->shift; + while (beg > text) + { + c = trans ? trans[U(*--beg)] : *--beg; + tree = trie->links; + while (tree && c != tree->label) + if (c < tree->label) + tree = tree->llink; + else + tree = tree->rlink; + if (tree) + { + trie = tree->trie; + if (trie->accepting) + { + mch = beg; + accept = trie; + } + } + else + break; + d = trie->shift; + } + if (mch) + goto match; + } + return -1; + + match: + /* Given a known match, find the longest possible match anchored + at or before its starting point. This is nearly a verbatim + copy of the preceding main search loops. */ + if (lim - mch > kwset->maxd) + lim = mch + kwset->maxd; + lmch = 0; + d = 1; + while (lim - end >= d) + { + if ((d = delta[c = (end += d)[-1]]) != 0) + continue; + beg = end - 1; + if (!(trie = next[c])) + { + d = 1; + continue; + } + if (trie->accepting && beg <= mch) + { + lmch = beg; + accept = trie; + } + d = trie->shift; + while (beg > text) + { + c = trans ? trans[U(*--beg)] : *--beg; + tree = trie->links; + while (tree && c != tree->label) + if (c < tree->label) + tree = tree->llink; + else + tree = tree->rlink; + if (tree) + { + trie = tree->trie; + if (trie->accepting && beg <= mch) + { + lmch = beg; + accept = trie; + } + } + else + break; + d = trie->shift; + } + if (lmch) + { + mch = lmch; + goto match; + } + if (!d) + d = 1; + } + + if (kwsmatch) + { + kwsmatch->index = accept->accepting / 2; + kwsmatch->offset[0] = mch - text; + kwsmatch->size[0] = accept->depth; + } + return mch - text; +} + +/* Search through the given text for a match of any member of the + given keyword set. Return a pointer to the first character of + the matching substring, or NULL if no match is found. If FOUNDLEN + is non-NULL store in the referenced location the length of the + matching substring. Similarly, if FOUNDIDX is non-NULL, store + in the referenced location the index number of the particular + keyword matched. */ +size_t +kwsexec (kwset_t kws, char const *text, size_t size, + struct kwsmatch *kwsmatch) +{ + struct kwset const *kwset = (struct kwset *) kws; + if (kwset->words == 1 && kwset->trans == NULL) + { + size_t ret = bmexec (kws, text, size); + if (kwsmatch != NULL && ret != (size_t) -1) + { + kwsmatch->index = 0; + kwsmatch->offset[0] = ret; + kwsmatch->size[0] = kwset->mind; + } + return ret; + } + else + return cwexec(kws, text, size, kwsmatch); +} + +/* Free the components of the given keyword set. */ +void +kwsfree (kwset_t kws) +{ + struct kwset *kwset; + + kwset = (struct kwset *) kws; + obstack_free(&kwset->obstack, NULL); + free(kws); +} diff --git a/src/kwset.h b/src/kwset.h new file mode 100644 index 0000000..10836be --- /dev/null +++ b/src/kwset.h @@ -0,0 +1,57 @@ +/* kwset.h - header declaring the keyword set library. + Copyright (C) 1989, 1998, 2005 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., 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ + +/* Written August 1989 by Mike Haertel. + The author may be reached (Email) at the address mike@ai.mit.edu, + or (US mail) as Mike Haertel c/o Free Software Foundation. */ + +struct kwsmatch +{ + int index; /* Index number of matching keyword. */ + size_t offset[1]; /* Offset of each submatch. */ + size_t size[1]; /* Length of each submatch. */ +}; + +typedef ptr_t kwset_t; + +/* Return an opaque pointer to a newly allocated keyword set, or NULL + if enough memory cannot be obtained. The argument if non-NULL + specifies a table of character translations to be applied to all + pattern and search text. */ +extern kwset_t kwsalloc PARAMS((char const *)); + +/* Incrementally extend the keyword set to include the given string. + Return NULL for success, or an error message. Remember an index + number for each keyword included in the set. */ +extern const char *kwsincr PARAMS((kwset_t, char const *, size_t)); + +/* When the keyword set has been completely built, prepare it for + use. Return NULL for success, or an error message. */ +extern const char *kwsprep PARAMS((kwset_t)); + +/* Search through the given buffer for a member of the keyword set. + Return a pointer to the leftmost longest match found, or NULL if + no match is found. If foundlen is non-NULL, store the length of + the matching substring in the integer it points to. Similarly, + if foundindex is non-NULL, store the index of the particular + keyword found therein. */ +extern size_t kwsexec PARAMS((kwset_t, char const *, size_t, struct kwsmatch *)); + +/* Deallocate the given keyword set and all its associated storage. */ +extern void kwsfree PARAMS((kwset_t)); + diff --git a/src/mbsupport.h b/src/mbsupport.h new file mode 100644 index 0000000..93deb0b --- /dev/null +++ b/src/mbsupport.h @@ -0,0 +1,47 @@ +/* mbsupport.h --- Localize determination of whether we have multibyte stuff. + + Copyright (C) 2004, 2005 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., 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ + + +/* This file is needed so that we test for i18n support in just one place. + This gives us a consistent definition for all uses of MBS_SUPPORT. This + follows the ``Don't Repeat Yourself'' principle from "The Pragmatic + Programmer". + + The tests should be *all* the ones that are needed for an individual + application. */ + +#ifdef HAVE_STDLIB_H +#include +#endif + +#if defined(HAVE_ISWCTYPE) \ + && defined(HAVE_LOCALE_H) \ + && defined(HAVE_MBRLEN) \ + && defined(HAVE_MBRTOWC) \ + && defined(HAVE_WCHAR_H) \ + && defined(HAVE_WCRTOMB) \ + && defined(HAVE_WCSCOLL) \ + && defined(HAVE_WCTYPE) \ + && defined(HAVE_WCTYPE_H) \ + && (defined(HAVE_STDLIB_H) && defined(MB_CUR_MAX)) \ +/* We can handle multibyte strings. */ +# define MBS_SUPPORT 1 +#else +# undef MBS_SUPPORT +#endif diff --git a/src/search.c b/src/search.c new file mode 100644 index 0000000..0f1494b --- /dev/null +++ b/src/search.c @@ -0,0 +1,746 @@ +/* search.c - searching subroutines using dfa, kwset and regex for grep. + Copyright 1992, 1998, 2000 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., 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ + +/* Written August 1992 by Mike Haertel. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#include "mbsupport.h" +#ifdef MBS_SUPPORT +/* We can handle multibyte strings. */ +# include +# include +#endif + +#include "system.h" +#include "grep.h" +#ifndef FGREP_PROGRAM +# include +# include "dfa.h" +#endif +#include "kwset.h" +#include "error.h" +#include "xalloc.h" +#ifdef HAVE_LIBPCRE +# include +#endif + +#define NCHAR (UCHAR_MAX + 1) + +/* For -w, we also consider _ to be word constituent. */ +#define WCHAR(C) (ISALNUM(C) || (C) == '_') + +/* KWset compiled pattern. For Ecompile and Gcompile, we compile + a list of strings, at least one of which is known to occur in + any string matching the regexp. */ +static kwset_t kwset; + +static void +kwsinit (void) +{ + static char trans[NCHAR]; + int i; + + if (match_icase) + for (i = 0; i < NCHAR; ++i) + trans[i] = TOLOWER (i); + + if (!(kwset = kwsalloc (match_icase ? trans : (char *) 0))) + error (2, 0, _("memory exhausted")); +} + +#ifndef FGREP_PROGRAM +/* DFA compiled regexp. */ +static struct dfa dfa; + +/* The Regex compiled patterns. */ +static struct patterns +{ + /* Regex compiled regexp. */ + struct re_pattern_buffer regexbuf; + struct re_registers regs; /* This is here on account of a BRAIN-DEAD + Q@#%!# library interface in regex.c. */ +} patterns0; + +struct patterns *patterns; +size_t pcount; + +void +dfaerror (char const *mesg) +{ + error (2, 0, mesg); +} + +/* Number of compiled fixed strings known to exactly match the regexp. + If kwsexec returns < kwset_exact_matches, then we don't need to + call the regexp matcher at all. */ +static int kwset_exact_matches; + +/* If the DFA turns out to have some set of fixed strings one of + which must occur in the match, then we build a kwset matcher + to find those strings, and thus quickly filter out impossible + matches. */ +static void +kwsmusts (void) +{ + struct dfamust const *dm; + char const *err; + + if (dfa.musts) + { + kwsinit (); + /* First, we compile in the substrings known to be exact + matches. The kwset matcher will return the index + of the matching string that it chooses. */ + for (dm = dfa.musts; dm; dm = dm->next) + { + if (!dm->exact) + continue; + ++kwset_exact_matches; + if ((err = kwsincr (kwset, dm->must, strlen (dm->must))) != 0) + error (2, 0, err); + } + /* Now, we compile the substrings that will require + the use of the regexp matcher. */ + for (dm = dfa.musts; dm; dm = dm->next) + { + if (dm->exact) + continue; + if ((err = kwsincr (kwset, dm->must, strlen (dm->must))) != 0) + error (2, 0, err); + } + if ((err = kwsprep (kwset)) != 0) + error (2, 0, err); + } +} +#endif /* !FGREP_PROGRAM */ + +#ifdef MBS_SUPPORT +/* This function allocate the array which correspond to "buf". + Then this check multibyte string and mark on the positions which + are not single byte character nor the first byte of a multibyte + character. Caller must free the array. */ +static char* +check_multibyte_string(char const *buf, size_t size) +{ + char *mb_properties = xmalloc(size); + mbstate_t cur_state; + wchar_t wc; + int i; + + memset(&cur_state, 0, sizeof(mbstate_t)); + memset(mb_properties, 0, sizeof(char)*size); + + for (i = 0; i < size ;) + { + size_t mbclen; + mbclen = mbrtowc(&wc, buf + i, size - i, &cur_state); + + if (mbclen == (size_t) -1 || mbclen == (size_t) -2 || mbclen == 0) + { + /* An invalid sequence, or a truncated multibyte character. + We treat it as a single byte character. */ + mbclen = 1; + } + else if (match_icase) + { + if (iswupper((wint_t)wc)) + { + wc = towlower((wint_t)wc); + wcrtomb(buf + i, wc, &cur_state); + } + } + mb_properties[i] = mbclen; + i += mbclen; + } + + return mb_properties; +} +#endif /* MBS_SUPPORT */ + +#if defined(GREP_PROGRAM) || defined(EGREP_PROGRAM) +#ifdef EGREP_PROGRAM +COMPILE_FCT(Ecompile) +{ + reg_syntax_t syntax_bits = RE_SYNTAX_POSIX_EGREP; +#else +/* No __VA_ARGS__ in C89. So we have to do it this way. */ +static COMPILE_RET +GEAcompile (char const *pattern, size_t size, reg_syntax_t syntax_bits) +{ +#endif /* EGREP_PROGRAM */ + const char *err; + const char *sep; + size_t total = size; + char const *motif = pattern; + +#if 0 + if (match_icase) + syntax_bits |= RE_ICASE; +#endif + re_set_syntax (syntax_bits); + dfasyntax (syntax_bits, match_icase, eolbyte); + + /* For GNU regex compiler we have to pass the patterns separately to detect + errors like "[\nallo\n]\n". The patterns here are "[", "allo" and "]" + GNU regex should have raise a syntax error. The same for backref, where + the backref should have been local to each pattern. */ + do + { + size_t len; + sep = memchr (motif, '\n', total); + if (sep) + { + len = sep - motif; + sep++; + total -= (len + 1); + } + else + { + len = total; + total = 0; + } + + patterns = realloc (patterns, (pcount + 1) * sizeof (*patterns)); + if (patterns == NULL) + error (2, errno, _("memory exhausted")); + patterns[pcount] = patterns0; + + if ((err = re_compile_pattern (motif, len, + &(patterns[pcount].regexbuf))) != 0) + error (2, 0, err); + pcount++; + + motif = sep; + } while (sep && total != 0); + + /* In the match_words and match_lines cases, we use a different pattern + for the DFA matcher that will quickly throw out cases that won't work. + Then if DFA succeeds we do some hairy stuff using the regex matcher + to decide whether the match should really count. */ + if (match_words || match_lines) + { + static char const line_beg_no_bk[] = "^("; + static char const line_end_no_bk[] = ")$"; + static char const word_beg_no_bk[] = "(^|[^[:alnum:]_])("; + static char const word_end_no_bk[] = ")([^[:alnum:]_]|$)"; +#ifdef EGREP_PROGRAM +# define IF_BK(x, y) (y) + char *n = xmalloc (sizeof word_beg_no_bk - 1 + size + sizeof word_end_no_bk); +#else + static char const line_beg_bk[] = "^\\("; + static char const line_end_bk[] = "\\)$"; + static char const word_beg_bk[] = "\\(^\\|[^[:alnum:]_]\\)\\("; + static char const word_end_bk[] = "\\)\\([^[:alnum:]_]\\|$\\)"; + int bk = !(syntax_bits & RE_NO_BK_PARENS); +# define IF_BK(x, y) ((bk) ? (x) : (y)) + char *n = xmalloc (sizeof word_beg_bk - 1 + size + sizeof word_end_bk); +#endif /* EGREP_PROGRAM */ + + strcpy (n, match_lines ? IF_BK(line_beg_bk, line_beg_no_bk) + : IF_BK(word_beg_bk, word_beg_no_bk)); + total = strlen(n); + memcpy (n + total, pattern, size); + total += size; + strcpy (n + total, match_lines ? IF_BK(line_end_bk, line_end_no_bk) + : IF_BK(word_end_bk, word_end_no_bk)); + total += strlen (n + total); + pattern = motif = n; + size = total; + } + else + motif = NULL; + + dfacomp (pattern, size, &dfa, 1); + kwsmusts (); + + if (motif) + free((char *) motif); +} + +#ifndef EGREP_PROGRAM +COMPILE_FCT(Gcompile) +{ + return GEAcompile (pattern, size, + RE_SYNTAX_GREP | RE_HAT_LISTS_NOT_NEWLINE); +} + +COMPILE_FCT(Acompile) +{ + return GEAcompile (pattern, size, RE_SYNTAX_AWK); +} + +COMPILE_FCT(Ecompile) +{ + return GEAcompile (pattern, size, RE_SYNTAX_POSIX_EGREP); +} +#endif /* !EGREP_PROGRAM */ + +EXECUTE_FCT(EGexecute) +{ + register char const *buflim, *beg, *end, *match, *best_match; + char eol = eolbyte; + int backref, start, len, best_len; + struct kwsmatch kwsm; + size_t i, ret_val; +#ifdef MBS_SUPPORT + char *mb_properties = NULL; + if (MB_CUR_MAX > 1) + { + if (match_icase) + { + char *case_buf = xmalloc(size); + memcpy(case_buf, buf, size); + if (start_ptr) + start_ptr = case_buf + (start_ptr - buf); + buf = case_buf; + } + if (kwset) + mb_properties = check_multibyte_string(buf, size); + } +#endif /* MBS_SUPPORT */ + + buflim = buf + size; + + for (beg = end = buf; end < buflim; beg = end) + { + if (!start_ptr) + { + /* We don't care about an exact match. */ + if (kwset) + { + /* Find a possible match using the KWset matcher. */ + size_t offset = kwsexec (kwset, beg, buflim - beg, &kwsm); + if (offset == (size_t) -1) + goto failure; + beg += offset; + /* Narrow down to the line containing the candidate, and + run it through DFA. */ + end = memchr(beg, eol, buflim - beg); + end++; +#ifdef MBS_SUPPORT + if (MB_CUR_MAX > 1 && mb_properties[beg - buf] == 0) + continue; +#endif + while (beg > buf && beg[-1] != eol) + --beg; + if (kwsm.index < kwset_exact_matches) + goto success; + if (dfaexec (&dfa, beg, end - beg, &backref) == (size_t) -1) + continue; + } + else + { + /* No good fixed strings; start with DFA. */ + size_t offset = dfaexec (&dfa, beg, buflim - beg, &backref); + if (offset == (size_t) -1) + break; + /* Narrow down to the line we've found. */ + beg += offset; + end = memchr (beg, eol, buflim - beg); + end++; + while (beg > buf && beg[-1] != eol) + --beg; + } + /* Successful, no backreferences encountered! */ + if (!backref) + goto success; + } + else + { + /* We are looking for the leftmost (then longest) exact match. + We will go through the outer loop only once. */ + beg = start_ptr; + end = buflim; + } + + /* If we've made it to this point, this means DFA has seen + a probable match, and we need to run it through Regex. */ + best_match = end; + best_len = 0; + for (i = 0; i < pcount; i++) + { + patterns[i].regexbuf.not_eol = 0; + if (0 <= (start = re_search (&(patterns[i].regexbuf), + buf, end - buf - 1, + beg - buf, end - beg - 1, + &(patterns[i].regs)))) + { + len = patterns[i].regs.end[0] - start; + match = buf + start; + if (match > best_match) + continue; + if (start_ptr && !match_words) + goto assess_pattern_match; + if ((!match_lines && !match_words) + || (match_lines && len == end - beg - 1)) + { + match = beg; + len = end - beg; + goto assess_pattern_match; + } + /* If -w, check if the match aligns with word boundaries. + We do this iteratively because: + (a) the line may contain more than one occurence of the + pattern, and + (b) Several alternatives in the pattern might be valid at a + given point, and we may need to consider a shorter one to + find a word boundary. */ + if (match_words) + while (match <= best_match) + { + if ((match == buf || !WCHAR ((unsigned char) match[-1])) + && (len == end - beg - 1 + || !WCHAR ((unsigned char) match[len]))) + goto assess_pattern_match; + if (len > 0) + { + /* Try a shorter length anchored at the same place. */ + --len; + patterns[i].regexbuf.not_eol = 1; + len = re_match (&(patterns[i].regexbuf), + buf, match + len - beg, match - buf, + &(patterns[i].regs)); + } + if (len <= 0) + { + /* Try looking further on. */ + if (match == end - 1) + break; + match++; + patterns[i].regexbuf.not_eol = 0; + start = re_search (&(patterns[i].regexbuf), + buf, end - buf - 1, + match - buf, end - match - 1, + &(patterns[i].regs)); + if (start < 0) + break; + len = patterns[i].regs.end[0] - start; + match = buf + start; + } + } /* while (match <= best_match) */ + continue; + assess_pattern_match: + if (!start_ptr) + { + /* Good enough for a non-exact match. + No need to look at further patterns, if any. */ + beg = match; + goto success_in_len; + } + if (match < best_match || (match == best_match && len > best_len)) + { + /* Best exact match: leftmost, then longest. */ + best_match = match; + best_len = len; + } + } /* if re_search >= 0 */ + } /* for Regex patterns. */ + if (best_match < end) + { + /* We have found an exact match. We were just + waiting for the best one (leftmost then longest). */ + beg = best_match; + len = best_len; + goto success_in_len; + } + } /* for (beg = end ..) */ + + failure: + ret_val = -1; + goto out; + + success: + len = end - beg; + success_in_len: + *match_size = len; + ret_val = beg - buf; + out: +#ifdef MBS_SUPPORT + if (MB_CUR_MAX > 1) + { + if (match_icase) + free((char*)buf); + if (mb_properties) + free(mb_properties); + } +#endif /* MBS_SUPPORT */ + return ret_val; +} +#endif /* defined(GREP_PROGRAM) || defined(EGREP_PROGRAM) */ + +#if defined(GREP_PROGRAM) || defined(FGREP_PROGRAM) +COMPILE_FCT(Fcompile) +{ + char const *beg, *lim, *err; + + kwsinit (); + beg = pattern; + do + { + for (lim = beg; lim < pattern + size && *lim != '\n'; ++lim) + ; + if ((err = kwsincr (kwset, beg, lim - beg)) != 0) + error (2, 0, err); + if (lim < pattern + size) + ++lim; + beg = lim; + } + while (beg < pattern + size); + + if ((err = kwsprep (kwset)) != 0) + error (2, 0, err); +} + +EXECUTE_FCT(Fexecute) +{ + register char const *beg, *try, *end; + register size_t len; + char eol = eolbyte; + struct kwsmatch kwsmatch; + size_t ret_val; +#ifdef MBS_SUPPORT + char *mb_properties = NULL; + if (MB_CUR_MAX > 1) + { + if (match_icase) + { + char *case_buf = xmalloc(size); + memcpy(case_buf, buf, size); + if (start_ptr) + start_ptr = case_buf + (start_ptr - buf); + buf = case_buf; + } + mb_properties = check_multibyte_string(buf, size); + } +#endif /* MBS_SUPPORT */ + + for (beg = start_ptr ? start_ptr : buf; beg <= buf + size; beg++) + { + size_t offset = kwsexec (kwset, beg, buf + size - beg, &kwsmatch); + if (offset == (size_t) -1) + goto failure; +#ifdef MBS_SUPPORT + if (MB_CUR_MAX > 1 && mb_properties[offset+beg-buf] == 0) + continue; /* It is a part of multibyte character. */ +#endif /* MBS_SUPPORT */ + beg += offset; + len = kwsmatch.size[0]; + if (start_ptr && !match_words) + goto success_in_beg_and_len; + if (match_lines) + { + if (beg > buf && beg[-1] != eol) + continue; + if (beg + len < buf + size && beg[len] != eol) + continue; + goto success; + } + else if (match_words) + for (try = beg; len; ) + { + if (try > buf && WCHAR((unsigned char) try[-1])) + break; + if (try + len < buf + size && WCHAR((unsigned char) try[len])) + { + offset = kwsexec (kwset, beg, --len, &kwsmatch); + if (offset == (size_t) -1) + break; + try = beg + offset; + len = kwsmatch.size[0]; + } + else if (!start_ptr) + goto success; + else + goto success_in_beg_and_len; + } /* for (try) */ + else + goto success; + } /* for (beg in buf) */ + + failure: + ret_val = -1; + goto out; + + success: + end = memchr (beg + len, eol, (buf + size) - (beg + len)); + end++; + while (buf < beg && beg[-1] != eol) + --beg; + len = end - beg; + success_in_beg_and_len: + *match_size = len; + ret_val = beg - buf; + out: +#ifdef MBS_SUPPORT + if (MB_CUR_MAX > 1) + { + if (match_icase) + free((char*)buf); + if (mb_properties) + free(mb_properties); + } +#endif /* MBS_SUPPORT */ + return ret_val; +} +#endif /* defined(GREP_PROGRAM) || defined(FGREP_PROGRAM) */ + +#ifdef GREP_PROGRAM +#if HAVE_LIBPCRE +/* Compiled internal form of a Perl regular expression. */ +static pcre *cre; + +/* Additional information about the pattern. */ +static pcre_extra *extra; +#endif + +COMPILE_FCT(Pcompile) +{ +#if !HAVE_LIBPCRE + error (2, 0, "%s", _("Support for the -P option is not compiled into this --disable-perl-regexp binary")); +#else + int e; + char const *ep; + char *re = xmalloc (4 * size + 7); + int flags = PCRE_MULTILINE | (match_icase ? PCRE_CASELESS : 0); + char const *patlim = pattern + size; + char *n = re; + char const *p; + char const *pnul; + + /* FIXME: Remove these restrictions. */ + if (eolbyte != '\n') + error (2, 0, _("The -P and -z options cannot be combined")); + if (memchr(pattern, '\n', size)) + error (2, 0, _("The -P option only supports a single pattern")); + + *n = '\0'; + if (match_lines) + strcpy (n, "^("); + if (match_words) + strcpy (n, "\\b("); + n += strlen (n); + + /* The PCRE interface doesn't allow NUL bytes in the pattern, so + replace each NUL byte in the pattern with the four characters + "\000", removing a preceding backslash if there are an odd + number of backslashes before the NUL. + + FIXME: This method does not work with some multibyte character + encodings, notably Shift-JIS, where a multibyte character can end + in a backslash byte. */ + for (p = pattern; (pnul = memchr (p, '\0', patlim - p)); p = pnul + 1) + { + memcpy (n, p, pnul - p); + n += pnul - p; + for (p = pnul; pattern < p && p[-1] == '\\'; p--) + continue; + n -= (pnul - p) & 1; + strcpy (n, "\\000"); + n += 4; + } + + memcpy (n, p, patlim - p); + n += patlim - p; + *n = '\0'; + if (match_words) + strcpy (n, ")\\b"); + if (match_lines) + strcpy (n, ")$"); + + cre = pcre_compile (re, flags, &ep, &e, pcre_maketables ()); + if (!cre) + error (2, 0, ep); + + extra = pcre_study (cre, 0, &ep); + if (ep) + error (2, 0, ep); + + free (re); +#endif +} + +EXECUTE_FCT(Pexecute) +{ +#if !HAVE_LIBPCRE + abort (); + return -1; +#else + /* This array must have at least two elements; everything after that + is just for performance improvement in pcre_exec. */ + int sub[300]; + + int e = pcre_exec (cre, extra, buf, size, + start_ptr ? (start_ptr - buf) : 0, 0, + sub, sizeof sub / sizeof *sub); + + if (e <= 0) + { + switch (e) + { + case PCRE_ERROR_NOMATCH: + return -1; + + case PCRE_ERROR_NOMEMORY: + error (2, 0, _("Memory exhausted")); + + default: + abort (); + } + } + else + { + /* Narrow down to the line we've found. */ + char const *beg = buf + sub[0]; + char const *end = buf + sub[1]; + char const *buflim = buf + size; + char eol = eolbyte; + if (!start_ptr) + { + /* FIXME: The case when '\n' is not found indicates a bug: + Since grep is line oriented, the match should never contain + a newline, so there _must_ be a newline following. + */ + if (!(end = memchr (end, eol, buflim - end))) + end = buflim; + else + end++; + while (buf < beg && beg[-1] != eol) + --beg; + } + + *match_size = end - beg; + return beg - buf; + } +#endif +} + +struct matcher const matchers[] = { + { "default", Gcompile, EGexecute }, + { "grep", Gcompile, EGexecute }, + { "egrep", Ecompile, EGexecute }, + { "awk", Acompile, EGexecute }, + { "fgrep", Fcompile, Fexecute }, + { "perl", Pcompile, Pexecute }, + { "", 0, 0 }, +}; +#endif /* GREP_PROGRAM */ diff --git a/src/system.h b/src/system.h new file mode 100644 index 0000000..c56e8ba --- /dev/null +++ b/src/system.h @@ -0,0 +1,206 @@ +/* Portability cruft. Include after config.h and sys/types.h. + Copyright 1996, 1998, 1999, 2000 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., 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ + +#undef PARAMS +#if defined (__STDC__) && __STDC__ +# ifndef _PTR_T +# define _PTR_T + typedef void * ptr_t; +# endif +# define PARAMS(x) x +#else +# ifndef _PTR_T +# define _PTR_T + typedef char * ptr_t; +# endif +# define PARAMS(x) () +#endif + +#ifdef HAVE_UNISTD_H +# include +# include +#else +# define O_RDONLY 0 +# define SEEK_SET 0 +# define SEEK_CUR 1 +int open(), read(), close(); +#endif + +#include +#ifndef errno +extern int errno; +#endif + +#ifndef HAVE_STRERROR +extern int sys_nerr; +extern char *sys_errlist[]; +# define strerror(E) (0 <= (E) && (E) < sys_nerr ? _(sys_errlist[E]) : _("Unknown system error")) +#endif + +/* Some operating systems treat text and binary files differently. */ +#ifdef __BEOS__ +# undef O_BINARY /* BeOS 5 has O_BINARY and O_TEXT, but they have no effect. */ +#endif +#ifdef HAVE_DOS_FILE_CONTENTS +# include +# ifdef HAVE_SETMODE +# define SET_BINARY(fd) setmode (fd, O_BINARY) +# else +# define SET_BINARY(fd) _setmode (fd, O_BINARY) +# endif +#endif + +#ifdef HAVE_DOS_FILE_NAMES +# define IS_SLASH(c) ((c) == '/' || (c) == '\\') +# define FILESYSTEM_PREFIX_LEN(f) ((f)[0] && (f)[1] == ':' ? 2 : 0) +#endif + +#ifndef IS_SLASH +# define IS_SLASH(c) ((c) == '/') +#endif + +#ifndef FILESYSTEM_PREFIX_LEN +# define FILESYSTEM_PREFIX_LEN(f) 0 +#endif + +int isdir PARAMS ((char const *)); + +#ifdef HAVE_DIR_EACCES_BUG +# ifdef EISDIR +# define is_EISDIR(e, f) \ + ((e) == EISDIR \ + || ((e) == EACCES && isdir (f) && ((e) = EISDIR, 1))) +# else +# define is_EISDIR(e, f) ((e) == EACCES && isdir (f)) +# endif +#endif + +#ifndef is_EISDIR +# ifdef EISDIR +# define is_EISDIR(e, f) ((e) == EISDIR) +# else +# define is_EISDIR(e, f) 0 +# endif +#endif + +#if STAT_MACROS_BROKEN +# undef S_ISDIR +# undef S_ISREG +#endif +#if !defined(S_ISDIR) && defined(S_IFDIR) +# define S_ISDIR(Mode) (((Mode) & S_IFMT) == S_IFDIR) +#endif +#if !defined(S_ISREG) && defined(S_IFREG) +# define S_ISREG(Mode) (((Mode) & S_IFMT) == S_IFREG) +#endif + +#ifdef STDC_HEADERS +# include +#else +char *getenv (); +ptr_t malloc(), realloc(), calloc(); +void free(); +#endif + +#if __STDC__ +# include +#endif +#ifdef STDC_HEADERS +# include +#endif +#ifndef CHAR_BIT +# define CHAR_BIT 8 +#endif +/* The extra casts work around common compiler bugs. */ +#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1)) +#define TYPE_MINIMUM(t) ((t) (TYPE_SIGNED (t) \ + ? ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1) \ + : (t) 0)) +#define TYPE_MAXIMUM(t) ((t) (~ (t) 0 - TYPE_MINIMUM (t))) +#ifndef CHAR_MAX +# define CHAR_MAX TYPE_MAXIMUM (char) +#endif +#ifndef INT_MAX +# define INT_MAX TYPE_MAXIMUM (int) +#endif +#ifndef UCHAR_MAX +# define UCHAR_MAX TYPE_MAXIMUM (unsigned char) +#endif + +#if !defined(STDC_HEADERS) && defined(HAVE_STRING_H) && defined(HAVE_MEMORY_H) +# include +#endif +#if defined(STDC_HEADERS) || defined(HAVE_STRING_H) +# include +#else +# include +# undef strchr +# define strchr index +# undef strrchr +# define strrchr rindex +# undef memcpy +# define memcpy(d, s, n) bcopy (s, d, n) +#endif +#ifndef HAVE_MEMCHR +ptr_t memchr(); +#endif +#if ! defined HAVE_MEMMOVE && ! defined memmove +# define memmove(d, s, n) bcopy (s, d, n) +#endif + +#include + +#ifndef isgraph +# define isgraph(C) (isprint(C) && !isspace(C)) +#endif + +#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII)) +# define IN_CTYPE_DOMAIN(c) 1 +#else +# define IN_CTYPE_DOMAIN(c) isascii(c) +#endif + +#define ISALPHA(C) (IN_CTYPE_DOMAIN (C) && isalpha (C)) +#define ISUPPER(C) (IN_CTYPE_DOMAIN (C) && isupper (C)) +#define ISLOWER(C) (IN_CTYPE_DOMAIN (C) && islower (C)) +#define ISDIGIT(C) (IN_CTYPE_DOMAIN (C) && isdigit (C)) +#define ISXDIGIT(C) (IN_CTYPE_DOMAIN (C) && isxdigit (C)) +#define ISSPACE(C) (IN_CTYPE_DOMAIN (C) && isspace (C)) +#define ISPUNCT(C) (IN_CTYPE_DOMAIN (C) && ispunct (C)) +#define ISALNUM(C) (IN_CTYPE_DOMAIN (C) && isalnum (C)) +#define ISPRINT(C) (IN_CTYPE_DOMAIN (C) && isprint (C)) +#define ISGRAPH(C) (IN_CTYPE_DOMAIN (C) && isgraph (C)) +#define ISCNTRL(C) (IN_CTYPE_DOMAIN (C) && iscntrl (C)) + +#define TOLOWER(C) (ISUPPER(C) ? tolower(C) : (C)) + +#if ENABLE_NLS +# include +# define _(String) gettext (String) +#else +# define _(String) String +#endif +#define N_(String) String + +#if HAVE_SETLOCALE +# include +#endif + +#ifndef initialize_main +#define initialize_main(argcp, argvp) +#endif diff --git a/src/vms_fab.c b/src/vms_fab.c new file mode 100644 index 0000000..1fdb2c0 --- /dev/null +++ b/src/vms_fab.c @@ -0,0 +1,86 @@ + /* + + + This macro sets up the file access block and name block for VMS. + It also does the initial parsing of the input string (resolving + wildcards, + if any) and finds all files matching the input pattern. + The address of the first matching pattern is returned. + + Written by Phillip C. Brisco 8/98. + */ +#include "vms_fab.h" + +void +vms_fab (int * argp, char **argvp[]) +{ + extern int optind; + int optout; + + fab = cc$rms_fab; + nam = cc$rms_nam; + + optout = 0; + strcpy (fna_buffer, *argvp[optind]); + length_of_fna_buffer = NAM$C_MAXRSS; + + fab.fab$b_bid = FAB$C_BID; + fab.fab$b_bln = FAB$C_BLN; + fab.fab$l_fop = FAB$M_NAM; + fab.fab$l_nam = &nam; + fab.fab$l_fna = (char *)&fna_buffer; + fab.fab$b_fns = length_of_fna_buffer; + + nam.nam$b_bid = NAM$C_BID; + nam.nam$b_bln = NAM$C_BLN; + nam.nam$l_esa = (char *)&expanded_name; + nam.nam$b_ess = NAM$C_MAXRSS; + nam.nam$l_rsa = (char *)&result_name; + nam.nam$b_rss = NAM$C_MAXRSS; + + fab_stat = sys$parse (&fab); + fab_stat = sys$search (&fab); + + if (fab_stat != 65537) + { + fprintf (stderr, "No Matches found.\n"); + exit (0); + } + + /* + While we find matching patterns, continue searching for more. + */ + while (fab_stat == 65537) + { + /* + Allocate memory for the filename + */ + arr_ptr[optout] = alloca (max_file_path_size + 1); + + strcpy (arr_ptr[optout], result_name); + + /* + If we don't tack on a null character at the end of the + filename, + we can get partial data which is still there from the last + sys$search command. + */ + arr_ptr[optout][nam.nam$b_dev + + nam.nam$b_dir + + nam.nam$b_name + + nam.nam$b_type + + nam.nam$b_ver] = '\0'; + + fab_stat = sys$search (&fab); + optout++; + } + + optout--; + + /* Return a pointer to the beginning of memory that has the expanded + filenames. + */ + *argp = optout; + *argvp = arr_ptr; + +} diff --git a/src/vms_fab.h b/src/vms_fab.h new file mode 100644 index 0000000..6bad650 --- /dev/null +++ b/src/vms_fab.h @@ -0,0 +1,33 @@ +/* + This file includes the setup for the file access block for VMS. + Written by Phillip C. Brisco 8/98. + */ + +#include +#include +#include +#include +#include +#include +#include + +#if defined(VMS) && defined(__DECC) /* need function prototype */ +# if (__DECC_VER<50790004) /* have an own one */ +char *alloca(unsigned int); +# else +# define alloca __ALLOCA +# endif +#endif + + +struct FAB fab; +struct NAM nam; + +int length_of_fna_buffer; +int fab_stat; +char expanded_name[NAM$C_MAXRSS]; +char fna_buffer[NAM$C_MAXRSS]; +char result_name[NAM$C_MAXRSS]; +char final_name[NAM$C_MAXRSS]; +int max_file_path_size = NAM$C_MAXRSS; +char *arr_ptr[32767]; diff --git a/tests/.cvsignore b/tests/.cvsignore new file mode 100644 index 0000000..a357fce --- /dev/null +++ b/tests/.cvsignore @@ -0,0 +1,7 @@ +Makefile +Makefile.in +bre.script +ere.script +khadafy.out +patfile +spencer1.script diff --git a/tests/Makefile.am b/tests/Makefile.am new file mode 100644 index 0000000..6ac60e6 --- /dev/null +++ b/tests/Makefile.am @@ -0,0 +1,23 @@ +## Process this file with automake to create Makefile.in + +AWK=@AWK@ + +TESTS = warning.sh khadafy.sh spencer1.sh bre.sh ere.sh pcre.sh \ + status.sh empty.sh options.sh backref.sh file.sh foad1.sh \ + fmbtest.sh yesno.sh +EXTRA_DIST = $(TESTS) \ + khadafy.lines khadafy.regexp \ + spencer1.awk spencer1.tests \ + bre.awk ere.awk bre.tests ere.tests +CLEANFILES = spencer1.script bre.script ere.script khadafy.out patfile \ + cspatfile csinput yesno.txt +TESTS_ENVIRONMENT = \ + AWK=$(AWK) \ + GREP=$(top_builddir)/src/grep \ + GREP_OPTIONS='' \ + LC_ALL=C + +# the *.sh when checkout does not have the right permission +# make sure everyting is ok. +dist-hook: + cd $(distdir); for i in $(TESTS); do chmod +x $$i; done diff --git a/tests/Makefile.in b/tests/Makefile.in new file mode 100644 index 0000000..959e091 --- /dev/null +++ b/tests/Makefile.in @@ -0,0 +1,439 @@ +# Makefile.in generated by automake 1.10 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = tests +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/codeset.m4 \ + $(top_srcdir)/m4/decl.m4 $(top_srcdir)/m4/djgpp.m4 \ + $(top_srcdir)/m4/dosfile.m4 $(top_srcdir)/m4/envsep.m4 \ + $(top_srcdir)/m4/error.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/header.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/inttypes_h.m4 \ + $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/largefile.m4 \ + $(top_srcdir)/m4/lcmessage.m4 $(top_srcdir)/m4/malloc.m4 \ + $(top_srcdir)/m4/mbstate_t.m4 $(top_srcdir)/m4/missing.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/realloc.m4 \ + $(top_srcdir)/m4/regex.m4 $(top_srcdir)/m4/sanity.m4 \ + $(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/ulonglong.m4 \ + $(top_srcdir)/m4/xstrtoumax.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GENCAT = @GENCAT@ +GETCONF = @GETCONF@ +GLIBC21 = @GLIBC21@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLBISON = @INTLBISON@ +INTLLIBS = @INTLLIBS@ +INTLOBJS = @INTLOBJS@ +INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +POFILES = @POFILES@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SEP = @SEP@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +U = @U@ +USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +TESTS = warning.sh khadafy.sh spencer1.sh bre.sh ere.sh pcre.sh \ + status.sh empty.sh options.sh backref.sh file.sh foad1.sh \ + fmbtest.sh yesno.sh + +EXTRA_DIST = $(TESTS) \ + khadafy.lines khadafy.regexp \ + spencer1.awk spencer1.tests \ + bre.awk ere.awk bre.tests ere.tests + +CLEANFILES = spencer1.script bre.script ere.script khadafy.out patfile \ + cspatfile csinput yesno.txt + +TESTS_ENVIRONMENT = \ + AWK=$(AWK) \ + GREP=$(top_builddir)/src/grep \ + GREP_OPTIONS='' \ + LC_ALL=C + +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tests/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu tests/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +check-TESTS: $(TESTS) + @failed=0; all=0; xfail=0; xpass=0; skip=0; ws='[ ]'; \ + srcdir=$(srcdir); export srcdir; \ + list=' $(TESTS) '; \ + if test -n "$$list"; then \ + for tst in $$list; do \ + if test -f ./$$tst; then dir=./; \ + elif test -f $$tst; then dir=; \ + else dir="$(srcdir)/"; fi; \ + if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *$$ws$$tst$$ws*) \ + xpass=`expr $$xpass + 1`; \ + failed=`expr $$failed + 1`; \ + echo "XPASS: $$tst"; \ + ;; \ + *) \ + echo "PASS: $$tst"; \ + ;; \ + esac; \ + elif test $$? -ne 77; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *$$ws$$tst$$ws*) \ + xfail=`expr $$xfail + 1`; \ + echo "XFAIL: $$tst"; \ + ;; \ + *) \ + failed=`expr $$failed + 1`; \ + echo "FAIL: $$tst"; \ + ;; \ + esac; \ + else \ + skip=`expr $$skip + 1`; \ + echo "SKIP: $$tst"; \ + fi; \ + done; \ + if test "$$failed" -eq 0; then \ + if test "$$xfail" -eq 0; then \ + banner="All $$all tests passed"; \ + else \ + banner="All $$all tests behaved as expected ($$xfail expected failures)"; \ + fi; \ + else \ + if test "$$xpass" -eq 0; then \ + banner="$$failed of $$all tests failed"; \ + else \ + banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \ + fi; \ + fi; \ + dashes="$$banner"; \ + skipped=""; \ + if test "$$skip" -ne 0; then \ + skipped="($$skip tests were not run)"; \ + test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$skipped"; \ + fi; \ + report=""; \ + if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ + report="Please report to $(PACKAGE_BUGREPORT)"; \ + test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$report"; \ + fi; \ + dashes=`echo "$$dashes" | sed s/./=/g`; \ + echo "$$dashes"; \ + echo "$$banner"; \ + test -z "$$skipped" || echo "$$skipped"; \ + test -z "$$report" || echo "$$report"; \ + echo "$$dashes"; \ + test "$$failed" -eq 0; \ + else :; fi + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" distdir="$(distdir)" \ + dist-hook +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-exec-am: + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-TESTS check-am clean clean-generic \ + dist-hook distclean distclean-generic distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ + pdf-am ps ps-am uninstall uninstall-am + + +# the *.sh when checkout does not have the right permission +# make sure everyting is ok. +dist-hook: + cd $(distdir); for i in $(TESTS); do chmod +x $$i; done +# 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. +.NOEXPORT: diff --git a/tests/backref.sh b/tests/backref.sh new file mode 100755 index 0000000..d891643 --- /dev/null +++ b/tests/backref.sh @@ -0,0 +1,38 @@ +#! /bin/sh +# Test for backreferences and other things. +# + +: ${srcdir=.} + +failures=0 + +# checking for a palindrome +echo "radar" | ${GREP} -e '\(.\)\(.\).\2\1' > /dev/null 2>&1 +if test $? -ne 0 ; then + echo "Backref: palindrome, test #1 failed" + failures=1 +fi + +# hit hard with the `Bond' tests +# For now, remove the ``?'' in the last parentheses, so that new glibc can do it. --Stepan +echo "civic" | ${GREP} -E -e '^(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.).?\9\8\7\6\5\4\3\2\1$' > /dev/null 2>&1 +if test $? -ne 0 ; then + echo "Options: Bond, test #2 failed" + failures=1 +fi + +# backref are local should be error +echo "123" | ${GREP} -e 'a\(.\)' -e 'b\1' > /dev/null 2>&1 +if test $? -ne 2 ; then + echo "Backref: Backref not local, test #3 failed" + failures=1 +fi + +# Pattern should fail +echo "123" | ${GREP} -e '[' -e ']' > /dev/null 2>&1 +if test $? -ne 2 ; then + echo "Backref: Compiled not local, test #4 failed" + failures=1 +fi + +exit $failures diff --git a/tests/bre.awk b/tests/bre.awk new file mode 100644 index 0000000..16a5814 --- /dev/null +++ b/tests/bre.awk @@ -0,0 +1,27 @@ +BEGIN { + FS="@"; + n = 0; + printf ("# Generated Spencer BRE Test\n"); + printf ("failures=0\n"); +} + +$0 ~ /^#/ { next; } + +NF == 3 { +# printf ("status=`echo '%s' | { ${GREP} -e '%s' > /dev/null 2>&1; echo $?; cat >/dev/null; }`\n",$3, $2); + printf ("status=`echo '%s' | { ${GREP} -e '%s' > /dev/null 2>&1; echo $? ; }`\n",$3, $2); + printf ("if test $status -ne %s ; then\n", $1); + printf ("\techo Spencer bre test \\#%d failed\n", ++n); + printf ("\tfailures=1\n"); + printf ("fi\n"); +} + +NF == 4 { +#don't alarm users +# printf ("echo '%s' | ${GREP} -e '%s' > /dev/null 2>&1\n",$3, $2); +# printf ("if test $? -ne %s ; then\n", $1); +# printf ("\techo Expected non conformance \\#%d ... continuing\n", ++n); +# printf ("fi\n"); +} + +END { printf ("exit $failures\n"); } diff --git a/tests/bre.sh b/tests/bre.sh new file mode 100755 index 0000000..eecdd3e --- /dev/null +++ b/tests/bre.sh @@ -0,0 +1,13 @@ +#! /bin/sh +# Regression test for GNU grep. + +: ${srcdir=.} + +failures=0 + +# . . . and the following by Henry Spencer. + +${AWK-awk} -f $srcdir/bre.awk $srcdir/bre.tests > bre.script + +sh bre.script && exit $failures +exit 1 diff --git a/tests/bre.tests b/tests/bre.tests new file mode 100644 index 0000000..60ff1b5 --- /dev/null +++ b/tests/bre.tests @@ -0,0 +1,62 @@ +0@a\(b\)c@abc +0@a(@a( +2@a\(@EPAREN +2@a\(b@EPAREN +0@a(b@a(b +0@a)@a) +2@a\)@EPAREN +2@\)@EPAREN +0@a\(\)b@ab +0@a^b@a^b +0@a$b@a$b +0@\($\)\(^\)@@TO CORRECT +0@a*\(^b$\)c*@b +0@|@| +0@*@* +0@\(\)@abc +2@\(\{1\}a\)@BADRPT@TO CORRECT +0@^*@* +2@^\{1\}@BADRPT@TO CORRECT +0@{@{ +1@a\(b*\)c\1d@abbcbd +1@a\(b*\)c\1d@abbcbbbd +1@^\(.\)\1@abc +0@a\(\([bc]\)\2\)*d@abbccd +1@a\(\([bc]\)\2\)*d@abbcbd +0@a\(\(b\)*\2\)*d@abbbd +0@\(a\)\1bcd@aabcd +0@\(a\)\1bc*d@aabcd +0@\(a\)\1bc*d@aabd +0@\(a\)\1bc*d@aabcccd +0@\(a\)\1bc*[ce]d@aabcccd@TO CORRECT +0@^\(a\)\1b\(c\)*cd$@aabcccd +0@a\(*\)b@a*b +0@a\(**\)b@ab +2@a\(***\)b@BADRPT@TO CORRECT +0@*a@*a +0@**a@a +2@***a@BADRPT@TO CORRECT +0@a\{1\}b@ab +0@a\{1,\}b@ab +0@a\{1,2\}b@aab +2@a\{1@EBRACE +2@a\{1a@EBRACE +2@a\{1a\}@BADBR +2@a\{,2\}@BADBR +2@a\{,\}@BADBR +2@a\{1,x\}@BADBR +2@a\{1,x@EBRACE +2@a\{32768\}@BADBR +2@a\{1,0\}@BADBR +0@ab\{0,0\}c@abcac +0@ab\{0,1\}c@abcac +0@ab\{0,3\}c@abbcac +0@ab\{1,1\}c@acabc +0@ab\{1,3\}c@acabc +0@ab\{2,2\}c@abcabbc +0@ab\{2,4\}c@abcabbc +2@a\{1\}\{1\}@BADRPT@TO CORRECT +2@a*\{1\}@BADRPT@TO CORRECT +2@a\{1\}*@BADRPT@TO CORRECT +1@a\(b\)?c\1d@acd +0@-\{0,1\}[0-9]*$@-5 diff --git a/tests/empty.sh b/tests/empty.sh new file mode 100755 index 0000000..cae640f --- /dev/null +++ b/tests/empty.sh @@ -0,0 +1,33 @@ +#! /bin/sh +# test that the empty file means no pattern +# and an empty pattern means match all. + +: ${srcdir=.} + +failures=0 + +for options in '-E' '-E -w' '-F -x' '-G -w -x'; do + + # should return 0 found a match + echo "" | ${GREP} $options -e '' > /dev/null 2>&1 + if test $? -ne 0 ; then + echo "Status: Wrong status code, test \#1 failed ($options)" + failures=1 + fi + + # should return 1 found no match + echo "abcd" | ${GREP} $options -f /dev/null > /dev/null 2>&1 + if test $? -ne 1 ; then + echo "Status: Wrong status code, test \#2 failed ($options)" + failures=1 + fi + + # should return 0 found a match + echo "abcd" | ${GREP} $options -f /dev/null -e "abcd" > /dev/null 2>&1 + if test $? -ne 0 ; then + echo "Status: Wrong status code, test \#3 failed ($options)" + failures=1 + fi +done + +exit $failures diff --git a/tests/ere.awk b/tests/ere.awk new file mode 100644 index 0000000..234d219 --- /dev/null +++ b/tests/ere.awk @@ -0,0 +1,32 @@ +BEGIN { + FS="@"; + n = 0; + printf ("# Generated Spencer ERE Test\n"); + printf ("failures=0\n"); +} + +$0 ~ /^#/ { next; } + +NF == 3 { +# printf ("status=`echo '%s' | { ${GREP} -E -e '%s' > /dev/null 2>&1; echo $?; cat >/dev/null; }`\n",$3, $2); + printf ("status=`echo '%s' | { ${GREP} -E -e '%s' > /dev/null 2>&1; echo $?; }`\n",$3, $2); + printf ("if test $status -ne %s ; then\n", $1); + printf ("\techo Spencer ere test \\#%d failed\n", ++n); + printf ("\tfailures=1\n"); + printf ("fi\n"); +} + +NF == 4 { +# don't alarm the user for now +# printf ("echo '%s'|${GREP} -E -e '%s' > /dev/null 2>&1\n",$3, $2); +# printf ("if test $? -ne %s ; then\n", $1); +# printf ("\techo Expected non conformance \\#%d ... continuing\n", ++n); +# printf ("fi\n"); +} + +NF == 5 { +# don't alarm the user for now + next; +} + +END { printf ("exit $failures\n"); } diff --git a/tests/ere.sh b/tests/ere.sh new file mode 100755 index 0000000..5bf1695 --- /dev/null +++ b/tests/ere.sh @@ -0,0 +1,13 @@ +#! /bin/sh +# Regression test for GNU grep. + +: ${srcdir=.} + +failures=0 + +# . . . and the following by Henry Spencer. + +${AWK-awk} -f $srcdir/ere.awk $srcdir/ere.tests > ere.script + +sh ere.script && exit $failures +exit 1 diff --git a/tests/ere.tests b/tests/ere.tests new file mode 100644 index 0000000..08b3dba --- /dev/null +++ b/tests/ere.tests @@ -0,0 +1,215 @@ +0@a@a +0@abc@abc +0@abc|de@abc +0@a|b|c@abc +0@a(b)c@abc +2@a(@EPAREN +0@a\(@a( +2@a(b@EPAREN +0@a)@a)@POSIX BOTCH +0@)@)@POSIX BOTCH +0@a()b@ab +0@^abc$@abc +1@a^b@a^b +1@a$b@a$b +0@^@abc +0@$@abc +0@^$@@TO CORRECT +0@$^@@TO CORRECT +0@^^@@TO CORRECT +0@$$@@TO CORRECT +0@a*(^b$)c*@b +2@|@EMPTY@NO ALTERNATION +2@*@BADRPT@TO CORRECT +2@+@BADRPT@TO CORRECT +2@?@BADRPT@TO CORRECT +1@&C@PASS +0@()@abc +2@a||b@EMPTY@NO ALTERNATION +2@|ab@EMPTY@NO ALTERNATION +2@ab|@EMPTY@NO ALTERNATION +2@(|a)b@EMPTY@NO ALTERNATION +2@(a|)b@EMPTY@NO ALTERNATION +2@(*a)@BADRPT@TO CORRECT +2@(+a)@BADRPT@TO CORRECT +2@(?a)@BADRPT@TO CORRECT +2@({1}a)@BADRPT@TO CORRECT +2@(a|*b)@BADRPT@NO ALTERNATION +2@(a|+b)@BADRPT@NO ALTERNATION +2@(a|?b)@BADRPT@NO ALTERNATION +2@(a|{1}b)@BADRPT@NO ALTERNATION +2@^*@BADRPT@TO CORRECT +2@^+@BADRPT@TO CORRECT +2@^?@BADRPT@TO CORRECT +2@^{1}@BADRPT@TO CORRECT +0@a.c@abc +0@a[bc]d@abd +0@a\*c@a*c +0@a\\b@a\b@TO CORRECT +0@a\\\*b@a\*b@SHELL TROUBLE +0@a\bc@abc@TO CORRECT +2@a\@EESCAPE@SHELL TROUBLE +0@a\\bc@a\bc@TO CORRECT +0@a\[b@a[b +2@a[b@EBRACK +0@a$@a +1@a$@a$ +1@a\$@a@SHELL TROUBLE +0@a\$@a$@SHELL TROUBLE +1@a\\$@a +1@a\\$@a$@SHELL TROUBLE +1@a\\$@a\$@SHELL TROUBLE +0@a\\$@a\@SHEL TROUBLE +0@ab*c@abc +0@ab+c@abc +0@ab?c@abc +0@{@{@TO CORRECT +0@{abc@{abc@TO CORRECT +0@{1@{1 +2@{1}@BADRPT@TO CORRECT +0@a{b@a{b@TO CORRECT +0@a{1}b@ab +0@a{1,}b@ab +0@a{1,2}b@aab +0@a{1@a{1 +1@a{1a@aa +0@a{1a}@a{1a} +0@a{,2}@a{,2} +0@a{,}@a{,} +0@a{1,*}@a{1,,,} +2@a{1,x@EBRACE@TO CORRECT +2@a{300}@BADBR@TO CORRECT +2@a{1,0}@BADBR@TO CORRECT +0@ab{0,0}c@abcac +0@ab{0,1}c@abcac +0@ab{0,3}c@abbcac +0@ab{1,1}c@acabc +0@ab{1,3}c@acabc +0@ab{2,2}c@abcabbc +0@ab{2,4}c@abcabbc +2@a**@BADRPT@TO CORRECT +2@a++@BADRPT@TO CORRECT +2@a??@BADRPT@TO CORRECT +2@a*+@BADRPT@TO CORRECT +2@a*?@BADRPT@TO CORRECT +2@a+*@BADRPT@TO CORRECT +2@a+?@BADRPT@TO CORRECT +2@a?*@BADRPT@TO CORRECT +2@a?+@BADRPT@TO CORRECT +2@a{1}{1}@BADRPT@TO CORRECT +2@a*{1}@BADRPT@TO CORRECT +2@a+{1}@BADRPT@TO CORRECT +2@a?{1}@BADRPT@TO CORRECT +2@a{1}*@BADRPT@TO CORRECT +2@a{1}+@BADRPT@TO CORRECT +2@a{1}?@BADRPT@TO CORRECT +0@a*{b}@a{b}@TO CORRECT +0@a[b]c@abc +0@a[ab]c@abc +0@a[^ab]c@adc +0@a[]b]c@a]c +0@a[[b]c@a[c +0@a[-b]c@a-c +0@a[^]b]c@adc +0@a[^-b]c@adc +0@a[b-]c@a-c +2@a[b@EBRACK +2@a[]@EBRACK +0@a[1-3]c@a2c +2@a[3-1]c@ERANGE@TO CORRECT +2@a[1-3-5]c@ERANGE@TO CORRECT +0@a[[.-.]--]c@a-c@TO CORRECT +2@a[1-@ERANGE +2@a[[.@EBRACK +2@a[[.x@EBRACK +2@a[[.x.@EBRACK +2@a[[.x.]@EBRACK@TO CORRECT +0@a[[.x.]]@ax@TO CORRECT +2@a[[.x,.]]@ECOLLATE@TO CORRECT +0@a[[.one.]]b@a1b@TO CORRECT +2@a[[.notdef.]]b@ECOLLATE@TO CORRECT +0@a[[.].]]b@a]b@TO CORRECT +0@a[[:alpha:]]c@abc +2@a[[:notdef:]]c@ECTYPE +2@a[[:@EBRACK +2@a[[:alpha@EBRACK +2@a[[:alpha:]@EBRACK +2@a[[:alpha,:]@ECTYPE +2@a[[:]:]]b@ECTYPE +2@a[[:-:]]b@ECTYPE +2@a[[:alph:]]@ECTYPE +2@a[[:alphabet:]]@ECTYPE +0@[[:digit:]]+@a019b +0@[[:lower:]]+@AabC +0@[[:upper:]]+@aBCd +0@[[:xdigit:]]+@p0f3Cq +0@a[[=b=]]c@abc@TO CORRECT +2@a[[=@EBRACK +2@a[[=b@EBRACK +2@a[[=b=@EBRACK +2@a[[=b=]@EBRACK@TO CORRECT +2@a[[=b,=]]@ECOLLATE@TO CORRECT +0@a[[=one=]]b@a1b@TO CORRECT +0@a(((b)))c@abc +0@a(b|(c))d@abd +0@a(b*|c)d@abbd +0@a[ab]{20}@aaaaabaaaabaaaabaaaab +0@a[ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab]@aaaaabaaaabaaaabaaaab +0@a[ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab](wee|week)(knights|night)@aaaaabaaaabaaaabaaaabweeknights +0@12345678901234567890123456789@a12345678901234567890123456789b +0@123456789012345678901234567890@a123456789012345678901234567890b +0@1234567890123456789012345678901@a1234567890123456789012345678901b +0@12345678901234567890123456789012@a12345678901234567890123456789012b +0@123456789012345678901234567890123@a123456789012345678901234567890123b +0@1234567890123456789012345678901234567890123456789012345678901234567890@a1234567890123456789012345678901234567890123456789012345678901234567890b +0@[ab][cd][ef][gh][ij][kl][mn]@xacegikmoq +0@[ab][cd][ef][gh][ij][kl][mn][op]@xacegikmoq +0@[ab][cd][ef][gh][ij][kl][mn][op][qr]@xacegikmoqy +0@[ab][cd][ef][gh][ij][kl][mn][op][q]@xacegikmoqy +0@abc@xabcy +0@aBc@Abc@TO CORRECT +0@a[Bc]*d@abBCcd@TO CORRECT +0@0[[:upper:]]1@0a1@TO CORRECT +0@0[[:lower:]]1@0A1@TO CORRECT +1@a[^b]c@abc +1@a[^b]c@aBc@TO CORRECT +0@a[^b]c@adc +0@[a]b[c]@abc +0@[a]b[a]@aba +0@[abc]b[abc]@abc +0@[abc]b[abd]@abd +0@a(b?c)+d@accd +0@(wee|week)(knights|night)@weeknights +0@(we|wee|week|frob)(knights|night|day)@weeknights +0@a[bc]d@xyzaaabcaababdacd +0@a[ab]c@aaabc +0@a*@b +0@/\*.*\*/@/*x*/ +0@/\*.*\*/@/*x*/y/*z*/ +0@/\*([^*]|\*[^/])*\*/@/*x*/ +0@/\*([^*]|\*[^/])*\*/@/*x*/y/*z*/ +0@/\*([^*]|\*[^/])*\*/@/*x**/y/*z*/ +0@/\*([^*]|\*+[^*/])*\*+/@/*x*/ +0@/\*([^*]|\*+[^*/])*\*+/@/*x*/y/*z*/ +0@/\*([^*]|\*+[^*/])*\*+/@/*x**/y/*z*/ +0@/\*([^*]|\*+[^*/])*\*+/@/*x****/y/*z*/ +0@/\*([^*]|\*+[^*/])*\*+/@/*x**x*/y/*z*/ +0@/\*([^*]|\*+[^*/])*\*+/@/*x***x/y/*z*/ +0@aZb@a@TO CORRECT +0@[[:<:]]a@a@TO CORRECT +1@[[:<:]]a@ba@TO CORRECT +0@[[:<:]]a@-a@TO CORRECT +0@a[[:>:]]@a@TO CORRECT +1@a[[:>:]]@ab@TO CORRECT +0@a[[:>:]]@a-@TO CORRECT +0@[[:<:]]a.c[[:>:]]@axcd-dayc-dazce-abc@TO CORRECT +0@[[:<:]]a.c[[:>:]]@axcd-dayc-dazce-abc-q@TO CORRECT +0@[[:<:]]a.c[[:>:]]@axc-dayc-dazce-abc@TO CORRECT +0@[[:<:]]b.c[[:>:]]@a_bxc-byc_d-bzc-q@TO CORRECT +0@[[:<:]].x..[[:>:]]@y_xa_-_xb_y-_xc_-axdc@TO CORRECT +1@[[:<:]]a_b[[:>:]]@x_a_b@TO CORRECT +0@(A[1])|(A[2])|(A[3])|(A[4])|(A[5])|(A[6])|(A[7])|(A[8])|(A[9])|(A[A])@A1 +0@abcdefghijklmnop@abcdefghijklmnop +0@abcdefghijklmnopqrstuv@abcdefghijklmnopqrstuv +0@CC[13]1|a{21}[23][EO][123][Es][12]a{15}aa[34][EW]aaaaaaa[X]a@CC11 +0@a?b@ab diff --git a/tests/file.sh b/tests/file.sh new file mode 100755 index 0000000..c397979 --- /dev/null +++ b/tests/file.sh @@ -0,0 +1,59 @@ +#! /bin/sh +# Test for POSIX.2 options for grep +# +# grep -E -f pattern_file file +# grep -F -f pattern_file file +# grep -G -f pattern_file file +# + +: ${srcdir=.} + +failures=0 + +cat <patfile +radar +MILES +GNU +EOF + +# match +echo "miles" | ${GREP} -i -E -f patfile > /dev/null 2>&1 +if test $? -ne 0 ; then + echo "File_pattern: Wrong status code, test \#1 failed" + failures=1 +fi + +# match +echo "GNU" | ${GREP} -G -f patfile > /dev/null 2>&1 +if test $? -ne 0 ; then + echo "File_pattern: Wrong status code, test \#2 failed" + failures=1 +fi + +# checking for no match +echo "ridar" | ${GREP} -F -f patfile > /dev/null 2>&1 +if test $? -ne 1 ; then + echo "File_pattern: Wrong status code, test \#3 failed" + failures=1 +fi + +cat <patfile + +EOF +# empty pattern : every match +echo "abbcd" | ${GREP} -F -f patfile > /dev/null 2>&1 +if test $? -ne 0 ; then + echo "File_pattern: Wrong status code, test \#4 failed" + failures=1 +fi + +cp /dev/null patfile + +# null pattern : no match +echo "abbcd" | ${GREP} -F -f patfile > /dev/null 2>&1 +if test $? -ne 1 ; then + echo "File_pattern: Wrong status code, test \#5 failed" + failures=1 +fi + +exit $failures diff --git a/tests/fmbtest.sh b/tests/fmbtest.sh new file mode 100755 index 0000000..9b5b4e6 --- /dev/null +++ b/tests/fmbtest.sh @@ -0,0 +1,103 @@ +#! /bin/sh + +: ${srcdir=.} + +# If cs_CZ.UTF-8 locale doesn't work, skip this test silently +LC_ALL=cs_CZ.UTF-8 locale -k LC_CTYPE 2>/dev/null | ${GREP} -q charmap.*UTF-8 \ + || exit 77 + +failures=0 + +cat > csinput < cspatfile </dev/null +grep_test "XwA YwB/ZwC/" "1:wA/5:wB/9:wC/" "w." -o -b +grep_test "XwA YwB/ZwC/" "1:wA/5:wB/9:wC/" "w." -o -b -i +grep_test "XwA YwB/ZwC/" "1:wA/5:wB/9:wC/" "w." -o -b -3 2>/dev/null +grep_test "XwA YwB/ZwC/" "1:w/5:w/9:w/" "w" -F -o -b +grep_test "XwA YwB/ZwC/" "1:w/5:w/9:w/" "w" -F -o -b -i +grep_test "XwA YwB/ZwC/" "1:w/5:w/9:w/" "w" -F -o -b -3 2>/dev/null +grep_test "wA wB/" "(standard input):wA/(standard input):wB/" "w." -o -H +grep_test "wA wB/" "(standard input):wA/(standard input):wB/" "w." -o -H -i +grep_test "wA wB/" "(standard input):wA/(standard input):wB/" "w." -o -H -3 2>/dev/null + +# End of a previous match should not match a "start of ..." expression. +grep_test "word_word/" "word_/" "^word_*" -o +grep_test "wordword/" "word/" "\/dev/null | "${GREP}" -q "charmap.*UTF-8" || exit $failures + +# Test character class erroneously matching a '[' character. +grep_test "[/" "" "[[:alpha:]]" -E + +for mode in F G E; do + # Hint: pipe the output of these tests in + # "| LESS= LESSCHARSET=ascii less". + # LETTER N WITH TILDE is U+00F1 and U+00D1. + # LETTER Y WITH DIAERESIS is U+00FF and U+0178. + grep_test 'añÿb/AÑŸB/' 'ñÿ/ÑŸ/' 'ñÿ' -o -i -$mode + grep_test 'añÿb/AÑŸB/' 'ñÿ/ÑŸ/' 'ÑŸ' -o -i -$mode + grep_test 'añÿb/AÑŸB/' "a${CB}ñÿ${CE}b/A${CB}ÑŸ${CE}B/" 'ñÿ' --color=always -i -$mode + grep_test 'añÿb/AÑŸB/' "a${CB}ñÿ${CE}b/A${CB}ÑŸ${CE}B/" 'ÑŸ' --color=always -i -$mode + + # POSIX (about -i): ... each character in the string is matched + # against the pattern, not only the character, but also its case + # counterpart (if any), shall be matched. + # The following were chosen because of their trickiness due to the + # differing UTF-8 octet length of their counterpart and to the + # non-reflexivity of their mapping. + # Beware of homographs! Look carefully at the actual octets. + + # lc(U+0130 LATIN CAPITAL LETTER I WITH DOT ABOVE) = U+0069 LATIN SMALL LETTER I + grep_test 'aÄ°b/' "a${CB}Ä°${CE}b/" 'i' --color=always -i -$mode + grep_test 'aib/' '' 'Ä°' --color=always -i -$mode + grep_test 'aÄ°b/' '' 'I' --color=always -i -$mode + # uc(U+0131 LATIN SMALL LETTER DOTLESS I) = U+0049 LATIN CAPITAL LETTER I + grep_test 'aıb/' "a${CB}ı${CE}b/" 'I' --color=always -i -$mode + grep_test 'aIb/' '' 'ı' --color=always -i -$mode + grep_test 'aıb/' '' 'i' --color=always -i -$mode + # uc(U+017F LATIN SMALL LETTER LONG S) = U+0053 LATIN CAPITAL LETTER S + grep_test 'aÅ¿b/' "a${CB}Å¿${CE}b/" 'S' --color=always -i -$mode + grep_test 'aSb/' '' 'Å¿' --color=always -i -$mode + grep_test 'aÅ¿b/' '' 's' --color=always -i -$mode + # uc(U+1FBE GREEK PROSGEGRAMMENI) = U+0399 GREEK CAPITAL LETTER IOTA + grep_test 'aá¾¾b/' "a${CB}á¾¾${CE}b/" 'Ι' --color=always -i -$mode + grep_test 'aΙb/' '' 'á¾¾' --color=always -i -$mode + grep_test 'aá¾¾b/' '' 'ι' --color=always -i -$mode + # lc(U+2126 OHM SIGN) = U+03C9 GREEK SMALL LETTER OMEGA + grep_test 'aΩb/' "a${CB}Ω${CE}b/" 'ω' --color=always -i -$mode + grep_test 'aωb/' '' 'Ω' --color=always -i -$mode + grep_test 'aΩb/' '' 'Ω' --color=always -i -$mode + # lc(U+212A KELVIN SIGN) = U+006B LATIN SMALL LETTER K + grep_test 'aKb/' "a${CB}K${CE}b/" 'k' --color=always -i -$mode + grep_test 'akb/' '' 'K' --color=always -i -$mode + grep_test 'aKb/' '' 'K' --color=always -i -$mode + # lc(U+212B ANGSTROM SIGN) = U+00E5 LATIN SMALL LETTER A WITH RING ABOVE + grep_test 'aÅb/' "a${CB}Å${CE}b/" 'Ã¥' --color=always -i -$mode + grep_test 'aÃ¥b/' '' 'Å' --color=always -i -$mode + grep_test 'aÅb/' '' 'Å' --color=always -i -$mode +done + + +# Any tests inserted right here will be performed under an UTF-8 locale. +# Insert them before LC_ALL is set above to avoid this. +# Leave this comment last. + +exit $failures diff --git a/tests/khadafy.lines b/tests/khadafy.lines new file mode 100644 index 0000000..57e21a1 --- /dev/null +++ b/tests/khadafy.lines @@ -0,0 +1,32 @@ +1) Muammar Qaddafi +2) Mo'ammar Gadhafi +3) Muammar Kaddafi +4) Muammar Qadhafi +5) Moammar El Kadhafi +6) Muammar Gadafi +7) Mu'ammar al-Qadafi +8) Moamer El Kazzafi +9) Moamar al-Gaddafi +10) Mu'ammar Al Qathafi +11) Muammar Al Qathafi +12) Mo'ammar el-Gadhafi +13) Moamar El Kadhafi +14) Muammar al-Qadhafi +15) Mu'ammar al-Qadhdhafi +16) Mu'ammar Qadafi +17) Moamar Gaddafi +18) Mu'ammar Qadhdhafi +19) Muammar Khaddafi +20) Muammar al-Khaddafi +21) Mu'amar al-Kadafi +22) Muammar Ghaddafy +23) Muammar Ghadafi +24) Muammar Ghaddafi +25) Muamar Kaddafi +26) Muammar Quathafi +27) Muammar Gheddafi +28) Muamar Al-Kaddafi +29) Moammar Khadafy +30) Moammar Qudhafi +31) Mu'ammar al-Qaddafi +32) Mulazim Awwal Mu'ammar Muhammad Abu Minyar al-Qadhafi diff --git a/tests/khadafy.regexp b/tests/khadafy.regexp new file mode 100644 index 0000000..46fe8dd --- /dev/null +++ b/tests/khadafy.regexp @@ -0,0 +1 @@ +M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy] diff --git a/tests/khadafy.sh b/tests/khadafy.sh new file mode 100755 index 0000000..141b3d8 --- /dev/null +++ b/tests/khadafy.sh @@ -0,0 +1,20 @@ +#! /bin/sh +# Regression test for GNU grep. + +: ${srcdir=.} +: ${GREP=../src/grep} + +failures=0 + +# The Khadafy test is brought to you by Scott Anderson . . . + +${GREP} -E -f $srcdir/khadafy.regexp $srcdir/khadafy.lines > khadafy.out +if cmp $srcdir/khadafy.lines khadafy.out +then + : +else + echo Khadafy test failed -- output left on khadafy.out + failures=1 +fi + +exit $failures diff --git a/tests/options.sh b/tests/options.sh new file mode 100755 index 0000000..3415018 --- /dev/null +++ b/tests/options.sh @@ -0,0 +1,36 @@ +#! /bin/sh +# Test for POSIX.2 options for grep +# +# grep [ -E| -F][ -c| -l| -q ][-insvx] -e pattern_list +# [-f pattern_file] ... [file. ..] +# grep [ -E| -F][ -c| -l| -q ][-insvx][-e pattern_list] +# -f pattern_file ... [file ...] +# grep [ -E| -F][ -c| -l| -q ][-insvx] pattern_list [file...] +# + +: ${srcdir=.} + +failures=0 + +# checking for -E extended regex +echo "abababccccccd" | ${GREP} -E -e 'c{3}' > /dev/null 2>&1 +if test $? -ne 0 ; then + echo "Options: Wrong status code, test \#1 failed" + failures=1 +fi + +# checking for basic regex +echo "abababccccccd" | ${GREP} -G -e 'c\{3\}' > /dev/null 2>&1 +if test $? -ne 0 ; then + echo "Options: Wrong status code, test \#2 failed" + failures=1 +fi + +# checking for fixed string +echo "abababccccccd" | ${GREP} -F -e 'c\{3\}' > /dev/null 2>&1 +if test $? -ne 1 ; then + echo "Options: Wrong status code, test \#3 failed" + failures=1 +fi + +exit $failures diff --git a/tests/pcre.sh b/tests/pcre.sh new file mode 100755 index 0000000..c5c791b --- /dev/null +++ b/tests/pcre.sh @@ -0,0 +1,16 @@ +#! /bin/sh +# Regression test for GNU grep. + +: ${GREP=../src/grep} + +# Test that grep was compiled with HAVE_LIBPCRE. Otherwise, pass. +echo . | ${GREP} -P . >/dev/null 2>&1 || exit 0 + +fs=0 +ft= + +# See CVS revision 1.32 of "src/search.c". +echo | { ${GREP} -P '\s*$'; } > /dev/null 2>&1 || { ft="$ft 1"; fs=1; } + +test "x$ft" != x && echo "Failed PCRE tests:$ft" +exit $fs diff --git a/tests/spencer1.awk b/tests/spencer1.awk new file mode 100644 index 0000000..3202bd3 --- /dev/null +++ b/tests/spencer1.awk @@ -0,0 +1,15 @@ +BEGIN { + FS = "@"; + printf ("failures=0\n"); +} + +$0 !~ /^#/ && NF == 3 { +# printf ("status=`echo '%s'| { ${GREP} -E -e '%s' > /dev/null 2>&1; echo $?; cat >/dev/null; }`\n",$3, $2); + printf ("status=`echo '%s'| { ${GREP} -E -e '%s' >/dev/null 2>&1 ; echo $?; }`\n",$3, $2); + printf ("if test $status -ne %s ; then\n", $1); + printf ("\techo Spencer test \\#%d failed\n", ++n); + printf ("\tfailures=1\n"); + printf ("fi\n"); +} + +END { printf ("exit $failures\n"); } diff --git a/tests/spencer1.sh b/tests/spencer1.sh new file mode 100755 index 0000000..f09b3fa --- /dev/null +++ b/tests/spencer1.sh @@ -0,0 +1,13 @@ +#! /bin/sh +# Regression test for GNU grep. + +: ${srcdir=.} + +failures=0 + +# . . . and the following by Henry Spencer. + +${AWK-awk} -f $srcdir/spencer1.awk $srcdir/spencer1.tests > spencer1.script + +sh spencer1.script && exit $failures +exit 1 diff --git a/tests/spencer1.tests b/tests/spencer1.tests new file mode 100644 index 0000000..e382d42 --- /dev/null +++ b/tests/spencer1.tests @@ -0,0 +1,122 @@ +0@abc@abc +1@abc@xbc +1@abc@axc +1@abc@abx +0@abc@xabcy +0@abc@ababc +0@ab*c@abc +0@ab*bc@abc +0@ab*bc@abbc +0@ab*bc@abbbbc +0@ab+bc@abbc +1@ab+bc@abc +1@ab+bc@abq +0@ab+bc@abbbbc +0@ab?bc@abbc +0@ab?bc@abc +1@ab?bc@abbbbc +0@ab?c@abc +0@^abc$@abc +1@^abc$@abcc +0@^abc@abcc +1@^abc$@aabc +0@abc$@aabc +0@^@abc +0@$@abc +0@a.c@abc +0@a.c@axc +0@a.*c@axyzc +1@a.*c@axyzd +1@a[bc]d@abc +0@a[bc]d@abd +1@a[b-d]e@abd +0@a[b-d]e@ace +0@a[b-d]@aac +0@a[-b]@a- +0@a[b-]@a- +1@a[b-a]@- +2@a[]b@- +2@a[@- +0@a]@a] +0@a[]]b@a]b +0@a[^bc]d@aed +1@a[^bc]d@abd +0@a[^-b]c@adc +1@a[^-b]c@a-c +1@a[^]b]c@a]c +0@a[^]b]c@adc +0@ab|cd@abc +0@ab|cd@abcd +0@()ef@def +0@()*@- +1@*a@- +0@^*@- +0@$*@- +2@(*)b@-@TO CORRECT +1@$b@b +2@a\@- +0@a\(b@a(b +0@a\(*b@ab +0@a\(*b@a((b +1@a\x@a\x +2@abc)@- +2@(abc@- +0@((a))@abc +0@(a)b(c)@abc +0@a+b+c@aabbabc +0@a**@- +0@a*?@- +0@(a*)*@- +0@(a*)+@- +0@(a|)*@- +0@(a*|b)*@- +0@(a+|b)*@ab +0@(a+|b)+@ab +0@(a+|b)?@ab +0@[^ab]*@cde +0@(^)*@- +0@(ab|)*@- +2@)(@- +1@abc@ +1@abc@ +0@a*@ +0@([abc])*d@abbbcd +0@([abc])*bcd@abcd +0@a|b|c|d|e@e +0@(a|b|c|d|e)f@ef +0@((a*|b))*@- +0@abcd*efg@abcdefg +0@ab*@xabyabbbz +0@ab*@xayabbbz +0@(ab|cd)e@abcde +0@[abhgefdc]ij@hij +1@^(ab|cd)e@abcde +0@(abc|)ef@abcdef +0@(a|b)c*d@abcd +0@(ab|ab*)bc@abc +0@a([bc]*)c*@abc +0@a([bc]*)(c*d)@abcd +0@a([bc]+)(c*d)@abcd +0@a([bc]*)(c+d)@abcd +0@a[bcd]*dcdcde@adcdcde +1@a[bcd]+dcdcde@adcdcde +0@(ab|a)b*c@abc +0@((a)(b)c)(d)@abcd +0@[A-Za-z_][A-Za-z0-9_]*@alpha +0@^a(bc+|b[eh])g|.h$@abh +0@(bc+d$|ef*g.|h?i(j|k))@effgz +0@(bc+d$|ef*g.|h?i(j|k))@ij +1@(bc+d$|ef*g.|h?i(j|k))@effg +1@(bc+d$|ef*g.|h?i(j|k))@bcdd +0@(bc+d$|ef*g.|h?i(j|k))@reffgz +1@((((((((((a))))))))))@- +0@(((((((((a)))))))))@a +1@multiple words of text@uh-uh +0@multiple words@multiple words, yeah +0@(.*)c(.*)@abcde +1@\((.*),@(.*)\) +1@[k]@ab +0@abcd@abcd +0@a(bc)d@abcd +0@a[-]?c@ac +0@(....).*\1@beriberi diff --git a/tests/spencer2.sh b/tests/spencer2.sh new file mode 100755 index 0000000..abaa926 --- /dev/null +++ b/tests/spencer2.sh @@ -0,0 +1,13 @@ +#! /bin/sh +# Regression test for GNU grep. + +: ${srcdir=.} + +failures=0 + +# . . . and the following by Henry Spencer. + +${AWK-awk} -f $srcdir/spencer1.awk $srcdir/spencer2.tests > spencer2.script + +sh spencer2.script && exit $failures +exit 1 diff --git a/tests/spencer2.tests b/tests/spencer2.tests new file mode 100644 index 0000000..47b6191 --- /dev/null +++ b/tests/spencer2.tests @@ -0,0 +1,317 @@ +0@a@a +0@abc@abc +0@abc|de@abc +0@a|b|c@abc +0@a(b)c@abc +1@a\(b\)c@abc +2@a(@EPAREN +2@a(@a( +0@a\(@a( +1@a\(@EPAREN +1@a\(b@EPAREN +2@a(b@EPAREN +2@a(b@a(b +2@a)@a) +2@)@) +2@a)@a) +1@a\)@EPAREN +1@\)@EPAREN +0@a()b@ab +1@a\(\)b@ab +0@^abc$@abc +1@a^b@a^b +1@a^b@a^b +1@a$b@a$b +1@a$b@a$b +0@^@abc +0@$@abc +1@^$@"" +1@$^@"" +1@\($\)\(^\)@"" +0@^^@"" +0@$$@"" +1@b$@abNc +1@b$@abNc +1@^b$@aNbNc +1@^b$@aNbNc +1@^$@aNNb +1@^$@abc +1@^$@abcN +1@$^@aNNb +1@\($\)\(^\)@aNNb +0@^^@aNNb +0@$$@aNNb +0@^a@a +0@a$@a +0@^a@aNb +1@^b@aNb +0@a$@bNa +1@b$@bNa +0@a*(^b$)c*@b +1@a*\(^b$\)c*@b +0@|@EMPTY +0@|@| +0@*@BADRPT +0@*@* +0@+@BADRPT +0@?@BADRPT +1@""@EMPTY +0@()@abc +1@\(\)@abc +0@a||b@EMPTY +0@|ab@EMPTY +0@ab|@EMPTY +1@(|a)b@EMPTY +1@(a|)b@EMPTY +1@(*a)@BADRPT +1@(+a)@BADRPT +1@(?a)@BADRPT +1@({1}a)@BADRPT +1@\(\{1\}a\)@BADRPT +1@(a|*b)@BADRPT +1@(a|+b)@BADRPT +1@(a|?b)@BADRPT +1@(a|{1}b)@BADRPT +0@^*@BADRPT +0@^*@* +0@^+@BADRPT +0@^?@BADRPT +0@^{1}@BADRPT +1@^\{1\}@BADRPT +0@a.c@abc +0@a[bc]d@abd +0@a\*c@a*c +1@ac@abc +1@a\bc@ac +1@\{@BADRPT +0@a\[b@a[b +2@a[b@EBRACK +0@a$@a +1@a$@a$ +1@a\$@a +0@a\$@a$ +1@a\$@a +1@a\$@a\$ +2@a\(b\)\2c@ESUBREG +2@a\(b\1\)c@ESUBREG +2@a\(b*\)c\1d@abbcbd +2@a\(b*\)c\1d@abbcbbbd +2@^\(.\)\1@abc +2@a\(\([bc]\)\2\)*d@abbccd +2@a\(\([bc]\)\2\)*d@abbcbd +2@a\(\(b\)*\2\)*d@abbbd +2@\(a\)\1bcd@aabcd +2@\(a\)\1bc*d@aabcd +2@\(a\)\1bc*d@aabd +2@\(a\)\1bc*d@aabcccd +2@\(a\)\1bc*[ce]d@aabcccd +2@^\(a\)\1b\(c\)*cd$@aabcccd +0@ab*c@abc +0@ab+c@abc +0@ab?c@abc +1@a\(*\)b@a*b +1@a\(**\)b@ab +1@a\(***\)b@BADRPT +0@*a@*a +0@**a@a +1@***a@BADRPT +2@{@{ +2@{abc@{abc +2@{1@BADRPT +0@{1}@BADRPT +2@a{b@a{b +0@a{1}b@ab +1@a\{1\}b@ab +0@a{1,}b@ab +1@a\{1,\}b@ab +0@a{1,2}b@aab +1@a\{1,2\}b@aab +2@a{1@EBRACE +1@a\{1@EBRACE +2@a{1a@EBRACE +1@a\{1a@EBRACE +2@a{1a}@BADBR +1@a\{1a\}@BADBR +0@a{,2}@a{,2} +1@a\{,2\}@BADBR +0@a{,}@a{,} +1@a\{,\}@BADBR +2@a{1,x}@BADBR +1@a\{1,x\}@BADBR +2@a{1,x@EBRACE +1@a\{1,x@EBRACE +1@a{300}@BADBR +1@a\{300\}@BADBR +1@a{1,0}@BADBR +1@a\{1,0\}@BADBR +0@ab{0,0}c@abcac +1@ab\{0,0\}c@abcac +0@ab{0,1}c@abcac +1@ab\{0,1\}c@abcac +0@ab{0,3}c@abbcac +1@ab\{0,3\}c@abbcac +0@ab{1,1}c@acabc +1@ab\{1,1\}c@acabc +0@ab{1,3}c@acabc +1@ab\{1,3\}c@acabc +0@ab{2,2}c@abcabbc +1@ab\{2,2\}c@abcabbc +0@ab{2,4}c@abcabbc +1@ab\{2,4\}c@abcabbc +0@a**@BADRPT +1@a++@BADRPT +0@a??@BADRPT +0@a*+@BADRPT +0@a*?@BADRPT +0@a+*@BADRPT +0@a+?@BADRPT +0@a?*@BADRPT +0@a?+@BADRPT +1@a{1}{1}@BADRPT +0@a*{1}@BADRPT +1@a+{1}@BADRPT +0@a?{1}@BADRPT +0@a{1}*@BADRPT +1@a{1}+@BADRPT +0@a{1}?@BADRPT +2@a*{b}@a{b} +1@a\{1\}\{1\}@BADRPT +1@a*\{1\}@BADRPT +1@a\{1\}*@BADRPT +0@a[b]c@abc +0@a[ab]c@abc +0@a[^ab]c@adc +0@a[]b]c@a]c +0@a[[b]c@a[c +0@a[-b]c@a-c +0@a[^]b]c@adc +0@a[^-b]c@adc +0@a[b-]c@a-c +2@a[b@EBRACK +2@a[]@EBRACK +0@a[1-3]c@a2c +1@a[3-1]c@ERANGE +1@a[1-3-5]c@ERANGE +1@a[[.-.]--]c@a-c +2@a[1-@ERANGE +2@a[[.@EBRACK +2@a[[.x@EBRACK +2@a[[.x.@EBRACK +1@a[[.x.]@EBRACK +1@a[[.x.]]@ax +1@a[[.x,.]]@ECOLLATE +1@a[[.one.]]b@a1b +1@a[[.notdef.]]b@ECOLLATE +1@a[[.].]]b@a]b +0@a[[:alpha:]]c@abc +2@a[[:notdef:]]c@ECTYPE +2@a[[:@EBRACK +2@a[[:alpha@EBRACK +2@a[[:alpha:]@EBRACK +2@a[[:alpha,:]@ECTYPE +2@a[[:]:]]b@ECTYPE +2@a[[:-:]]b@ECTYPE +2@a[[:alph:]]@ECTYPE +2@a[[:alphabet:]]@ECTYPE +1@[[:blank:]]+@aSSTb +1@[[:cntrl:]]+@aNTb +0@[[:digit:]]+@a019b +0@[[:graph:]]+@Sa%bS +0@[[:lower:]]+@AabC +0@[[:print:]]+@NaSbN +0@[[:punct:]]+@S%-&T +1@[[:space:]]+@aSNTb +0@[[:upper:]]+@aBCd +0@[[:xdigit:]]+@p0f3Cq +1@a[[=b=]]c@abc +2@a[[=@EBRACK +2@a[[=b@EBRACK +2@a[[=b=@EBRACK +1@a[[=b=]@EBRACK +1@a[[=b,=]]@ECOLLATE +1@a[[=one=]]b@a1b +0@a(((b)))c@abc +0@a(b|(c))d@abd +0@a(b*|c)d@abbd +0@a[ab]{20}@aaaaabaaaabaaaabaaaab +0@a[ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab]@aaaaabaaaabaaaabaaaab +0@a[ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab](wee|week)(knights|night)@aaaaabaaaabaaaabaaaabweeknights +0@12345678901234567890123456789@a12345678901234567890123456789b +0@123456789012345678901234567890@a123456789012345678901234567890b +0@1234567890123456789012345678901@a1234567890123456789012345678901b +0@12345678901234567890123456789012@a12345678901234567890123456789012b +0@123456789012345678901234567890123@a123456789012345678901234567890123b +0@1234567890123456789012345678901234567890123456789012345678901234567890@a1234567890123456789012345678901234567890123456789012345678901234567890b +0@[ab][cd][ef][gh][ij][kl][mn]@xacegikmoq +0@[ab][cd][ef][gh][ij][kl][mn][op]@xacegikmoq +0@[ab][cd][ef][gh][ij][kl][mn][op][qr]@xacegikmoqy +0@[ab][cd][ef][gh][ij][kl][mn][op][q]@xacegikmoqy +0@abc@xabcy +2@a\(b\)?c\1d@acd +1@aBc@Abc +1@a[Bc]*d@abBCcd +1@0[[:upper:]]1@0a1 +1@0[[:lower:]]1@0A1 +1@a[^b]c@abc +0@a[^b]c@aBc +0@a[^b]c@adc +0@[a]b[c]@abc +0@[a]b[a]@aba +0@[abc]b[abc]@abc +0@[abc]b[abd]@abd +0@a(b?c)+d@accd +0@(wee|week)(knights|night)@weeknights +0@(we|wee|week|frob)(knights|night|day)@weeknights +0@a[bc]d@xyzaaabcaababdacd +0@a[ab]c@aaabc +0@abc@abc +0@a*@b +0@/\*.*\*/@/*x*/ +0@/\*.*\*/@/*x*/y/*z*/ +0@/\*([^*]|\*[^/])*\*/@/*x*/ +0@/\*([^*]|\*[^/])*\*/@/*x*/y/*z*/ +0@/\*([^*]|\*[^/])*\*/@/*x**/y/*z*/ +0@/\*([^*]|\*+[^*/])*\*+/@/*x*/ +0@/\*([^*]|\*+[^*/])*\*+/@/*x*/y/*z*/ +0@/\*([^*]|\*+[^*/])*\*+/@/*x**/y/*z*/ +0@/\*([^*]|\*+[^*/])*\*+/@/*x****/y/*z*/ +0@/\*([^*]|\*+[^*/])*\*+/@/*x**x*/y/*z*/ +0@/\*([^*]|\*+[^*/])*\*+/@/*x***x/y/*z*/ +0@[abc]@a(b)c +0@[abc]@a(d)c +0@[abc]@a(bc)d +0@[abc]@a(dc)d +0@.@a()c +0@b.*c@b(bc)c +0@b.*@b(bc)c +0@.*c@b(bc)c +0@abc@abc +0@abc@xabcy +1@abc@xyz +0@a*b@aba*b +0@a*b@ab +1@""@EMPTY +1@aZb@a +1@aZb@a +0@aZb@(aZb) +0@aZ*b@(ab) +0@a.b@(aZb) +0@a.*@(aZb)c +2@[[:<:]]a@a +2@[[:<:]]a@ba +2@[[:<:]]a@-a +2@a[[:>:]]@a +2@a[[:>:]]@ab +2@a[[:>:]]@a- +2@[[:<:]]a.c[[:>:]]@axcd-dayc-dazce-abc +2@[[:<:]]a.c[[:>:]]@axcd-dayc-dazce-abc-q +2@[[:<:]]a.c[[:>:]]@axc-dayc-dazce-abc +2@[[:<:]]b.c[[:>:]]@a_bxc-byc_d-bzc-q +2@[[:<:]].x..[[:>:]]@y_xa_-_xb_y-_xc_-axdc +2@[[:<:]]a_b[[:>:]]@x_a_b +0@(A[1])|(A[2])|(A[3])|(A[4])|(A[5])|(A[6])|(A[7])|(A[8])|(A[9])|(A[A])@A1 +0@abcdefghijklmnop@abcdefghijklmnop +0@abcdefghijklmnopqrstuv@abcdefghijklmnopqrstuv +0@CC[13]1|a{21}[23][EO][123][Es][12]a{15}aa[34][EW]aaaaaaa[X]a@CC11 +0@a?b@ab +1@-\{0,1\}[0-9]*$@-5 diff --git a/tests/status.sh b/tests/status.sh new file mode 100755 index 0000000..b94187b --- /dev/null +++ b/tests/status.sh @@ -0,0 +1,66 @@ +#! /bin/sh +# Test for status code for GNU grep. +# status code +# 0 match found +# 1 no match +# 2 file not found + +: ${srcdir=.} + +failures=0 + +# should return 0 found a match +echo "abcd" | ${GREP} -E -e 'abc' > /dev/null 2>&1 +if test $? -ne 0 ; then + echo "Status: Wrong status code, test \#1 failed" + failures=1 +fi + +# should return 1 found no match +echo "abcd" | ${GREP} -E -e 'zbc' > /dev/null 2>&1 +if test $? -ne 1 ; then + echo "Status: Wrong status code, test \#2 failed" + failures=1 +fi + +# the filename MMMMMMMM.MMM should not exist hopefully +if test -r MMMMMMMM.MMM; then + echo "Please remove MMMMMMMM.MMM to run check" +else + # should return 2 file not found + ${GREP} -E -e 'abc' MMMMMMMM.MMM > /dev/null 2>&1 + if test $? -ne 2 ; then + echo "Status: Wrong status code, test \#3 failed" + failures=1 + fi + + # should return 2 file not found + ${GREP} -E -s -e 'abc' MMMMMMMM.MMM > /dev/null 2>&1 + if test $? -ne 2 ; then + echo "Status: Wrong status code, test \#4 failed" + failures=1 + fi + + # should return 2 file not found + echo "abcd" | ${GREP} -E -s 'abc' - MMMMMMMM.MMM > /dev/null 2>&1 + if test $? -ne 2 ; then + echo "Status: Wrong status code, test \#5 failed" + failures=1 + fi + + # should return 0 found a match + echo "abcd" | ${GREP} -E -q -s 'abc' MMMMMMMM.MMM - > /dev/null 2>&1 + if test $? -ne 0 ; then + echo "Status: Wrong status code, test \#6 failed" + failures=1 + fi + + # should still return 0 found a match + echo "abcd" | ${GREP} -E -q 'abc' MMMMMMMM.MMM - > /dev/null 2>&1 + if test $? -ne 0 ; then + echo "Status: Wrong status code, test \#7 failed" + failures=1 + fi +fi + +exit $failures diff --git a/tests/tests b/tests/tests new file mode 100644 index 0000000..8ed938d --- /dev/null +++ b/tests/tests @@ -0,0 +1,475 @@ +# regular expression test set +# Lines are at least three fields, separated by one or more tabs. "" stands +# for an empty field. First field is an RE. Second field is flags. If +# C flag given, regcomp() is expected to fail, and the third field is the +# error name (minus the leading REG_). +# +# Otherwise it is expected to succeed, and the third field is the string to +# try matching it against. If there is no fourth field, the match is +# expected to fail. If there is a fourth field, it is the substring that +# the RE is expected to match. If there is a fifth field, it is a comma- +# separated list of what the subexpressions should match, with - indicating +# no match for that one. In both the fourth and fifth fields, a (sub)field +# starting with @ indicates that the (sub)expression is expected to match +# a null string followed by the stuff after the @; this provides a way to +# test where null strings match. The character `N' in REs and strings +# is newline, `S' is space, `T' is tab, `Z' is NUL. +# +# The full list of flags: +# - placeholder, does nothing +# b RE is a BRE, not an ERE +# & try it as both an ERE and a BRE +# C regcomp() error expected, third field is error name +# i REG_ICASE +# m ("mundane") REG_NOSPEC +# s REG_NOSUB (not really testable) +# n REG_NEWLINE +# ^ REG_NOTBOL +# $ REG_NOTEOL +# # REG_STARTEND (see below) +# p REG_PEND +# +# For REG_STARTEND, the start/end offsets are those of the substring +# enclosed in (). + +# basics +a & a a +abc & abc abc +abc|de - abc abc +a|b|c - abc a + +# parentheses and perversions thereof +a(b)c - abc abc +a\(b\)c b abc abc +a( C EPAREN +a( b a( a( +a\( - a( a( +a\( bC EPAREN +a\(b bC EPAREN +a(b C EPAREN +a(b b a(b a(b +# gag me with a right parenthesis -- 1003.2 goofed here (my fault, partly) +a) - a) a) +) - ) ) +# end gagging (in a just world, those *should* give EPAREN) +a) b a) a) +a\) bC EPAREN +\) bC EPAREN +a()b - ab ab +a\(\)b b ab ab + +# anchoring and REG_NEWLINE +^abc$ & abc abc +a^b - a^b +a^b b a^b a^b +a$b - a$b +a$b b a$b a$b +^ & abc @abc +$ & abc @ +^$ & "" @ +$^ - "" @ +\($\)\(^\) b "" @ +# stop retching, those are legitimate (although disgusting) +^^ - "" @ +$$ - "" @ +##b$ & abNc +##b$ &n abNc b +##^b$ & aNbNc +##^b$ &n aNbNc b +##^$ &n aNNb @Nb +^$ n abc +##^$ n abcN @ +##$^ n aNNb @Nb +##\($\)\(^\) bn aNNb @Nb +##^^ n^ aNNb @Nb +##$$ n aNNb @NN +^a ^ a +a$ $ a +##^a ^n aNb +##^b ^n aNb b +##a$ $n bNa +##b$ $n bNa b +a*(^b$)c* - b b +a*\(^b$\)c* b b b + +# certain syntax errors and non-errors +| C EMPTY +| b | | +* C BADRPT +* b * * ++ C BADRPT +? C BADRPT +"" &C EMPTY +() - abc @abc +\(\) b abc @abc +a||b C EMPTY +|ab C EMPTY +ab| C EMPTY +(|a)b C EMPTY +(a|)b C EMPTY +(*a) C BADRPT +(+a) C BADRPT +(?a) C BADRPT +({1}a) C BADRPT +\(\{1\}a\) bC BADRPT +(a|*b) C BADRPT +(a|+b) C BADRPT +(a|?b) C BADRPT +(a|{1}b) C BADRPT +^* C BADRPT +^* b * * +^+ C BADRPT +^? C BADRPT +^{1} C BADRPT +^\{1\} bC BADRPT + +# metacharacters, backslashes +a.c & abc abc +a[bc]d & abd abd +a\*c & a*c a*c +a\\b & a\b a\b +a\\\*b & a\*b a\*b +a\bc & abc abc +a\ &C EESCAPE +a\\bc & a\bc a\bc +\{ bC BADRPT +a\[b & a[b a[b +a[b &C EBRACK +# trailing $ is a peculiar special case for the BRE code +a$ & a a +a$ & a$ +a\$ & a +a\$ & a$ a$ +a\\$ & a +a\\$ & a$ +a\\$ & a\$ +a\\$ & a\ a\ + +# back references, ugh +##a\(b\)\2c bC ESUBREG +##a\(b\1\)c bC ESUBREG +a\(b*\)c\1d b abbcbbd abbcbbd bb +a\(b*\)c\1d b abbcbd +a\(b*\)c\1d b abbcbbbd +^\(.\)\1 b abc +a\([bc]\)\1d b abcdabbd abbd b +a\(\([bc]\)\2\)*d b abbccd abbccd +a\(\([bc]\)\2\)*d b abbcbd +# actually, this next one probably ought to fail, but the spec is unclear +a\(\(b\)*\2\)*d b abbbd abbbd +# here is a case that no NFA implementation does right +\(ab*\)[ab]*\1 b ababaaa ababaaa a +# check out normal matching in the presence of back refs +\(a\)\1bcd b aabcd aabcd +\(a\)\1bc*d b aabcd aabcd +\(a\)\1bc*d b aabd aabd +\(a\)\1bc*d b aabcccd aabcccd +\(a\)\1bc*[ce]d b aabcccd aabcccd +^\(a\)\1b\(c\)*cd$ b aabcccd aabcccd + +# ordinary repetitions +ab*c & abc abc +ab+c - abc abc +ab?c - abc abc +a\(*\)b b a*b a*b +a\(**\)b b ab ab +a\(***\)b bC BADRPT +*a b *a *a +**a b a a +***a bC BADRPT + +# the dreaded bounded repetitions +{ & { { +{abc & {abc {abc +{1 C BADRPT +{1} C BADRPT +a{b & a{b a{b +a{1}b - ab ab +a\{1\}b b ab ab +a{1,}b - ab ab +a\{1,\}b b ab ab +a{1,2}b - aab aab +a\{1,2\}b b aab aab +a{1 C EBRACE +a\{1 bC EBRACE +a{1a C EBRACE +a\{1a bC EBRACE +a{1a} C BADBR +a\{1a\} bC BADBR +a{,2} - a{,2} a{,2} +a\{,2\} bC BADBR +a{,} - a{,} a{,} +a\{,\} bC BADBR +a{1,x} C BADBR +a\{1,x\} bC BADBR +a{1,x C EBRACE +a\{1,x bC EBRACE +a{300} C BADBR +a\{300\} bC BADBR +a{1,0} C BADBR +a\{1,0\} bC BADBR +ab{0,0}c - abcac ac +ab\{0,0\}c b abcac ac +ab{0,1}c - abcac abc +ab\{0,1\}c b abcac abc +ab{0,3}c - abbcac abbc +ab\{0,3\}c b abbcac abbc +ab{1,1}c - acabc abc +ab\{1,1\}c b acabc abc +ab{1,3}c - acabc abc +ab\{1,3\}c b acabc abc +ab{2,2}c - abcabbc abbc +ab\{2,2\}c b abcabbc abbc +ab{2,4}c - abcabbc abbc +ab\{2,4\}c b abcabbc abbc +((a{1,10}){1,10}){1,10} - a a a,a + +# multiple repetitions +a** &C BADRPT +a++ C BADRPT +a?? C BADRPT +a*+ C BADRPT +a*? C BADRPT +a+* C BADRPT +a+? C BADRPT +a?* C BADRPT +a?+ C BADRPT +a{1}{1} C BADRPT +a*{1} C BADRPT +a+{1} C BADRPT +a?{1} C BADRPT +a{1}* C BADRPT +a{1}+ C BADRPT +a{1}? C BADRPT +a*{b} - a{b} a{b} +a\{1\}\{1\} bC BADRPT +a*\{1\} bC BADRPT +a\{1\}* bC BADRPT + +# brackets, and numerous perversions thereof +a[b]c & abc abc +a[ab]c & abc abc +a[^ab]c & adc adc +a[]b]c & a]c a]c +a[[b]c & a[c a[c +a[-b]c & a-c a-c +a[^]b]c & adc adc +a[^-b]c & adc adc +a[b-]c & a-c a-c +a[b &C EBRACK +a[] &C EBRACK +a[1-3]c & a2c a2c +a[3-1]c &C ERANGE +a[1-3-5]c &C ERANGE +a[[.-.]--]c & a-c a-c +a[1- &C ERANGE +a[[. &C EBRACK +a[[.x &C EBRACK +a[[.x. &C EBRACK +a[[.x.] &C EBRACK +a[[.x.]] & ax ax +a[[.x,.]] &C ECOLLATE +a[[.one.]]b & a1b a1b +a[[.notdef.]]b &C ECOLLATE +a[[.].]]b & a]b a]b +a[[:alpha:]]c & abc abc +a[[:notdef:]]c &C ECTYPE +a[[: &C EBRACK +a[[:alpha &C EBRACK +a[[:alpha:] &C EBRACK +a[[:alpha,:] &C ECTYPE +a[[:]:]]b &C ECTYPE +a[[:-:]]b &C ECTYPE +a[[:alph:]] &C ECTYPE +a[[:alphabet:]] &C ECTYPE +##[[:alnum:]]+ - -%@a0X- a0X +##[[:alpha:]]+ - -%@aX0- aX +[[:blank:]]+ - aSSTb SST +##[[:cntrl:]]+ - aNTb NT +[[:digit:]]+ - a019b 019 +##[[:graph:]]+ - Sa%bS a%b +[[:lower:]]+ - AabC ab +##[[:print:]]+ - NaSbN aSb +##[[:punct:]]+ - S%-&T %-& +[[:space:]]+ - aSNTb SNT +[[:upper:]]+ - aBCd BC +[[:xdigit:]]+ - p0f3Cq 0f3C +a[[=b=]]c & abc abc +a[[= &C EBRACK +a[[=b &C EBRACK +a[[=b= &C EBRACK +a[[=b=] &C EBRACK +a[[=b,=]] &C ECOLLATE +a[[=one=]]b & a1b a1b + +# complexities +a(((b)))c - abc abc +a(b|(c))d - abd abd +a(b*|c)d - abbd abbd +# just gotta have one DFA-buster, of course +a[ab]{20} - aaaaabaaaabaaaabaaaab aaaaabaaaabaaaabaaaab +# and an inline expansion in case somebody gets tricky +a[ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab] - aaaaabaaaabaaaabaaaab aaaaabaaaabaaaabaaaab +# and in case somebody just slips in an NFA... +a[ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab](wee|week)(knights|night) - aaaaabaaaabaaaabaaaabweeknights aaaaabaaaabaaaabaaaabweeknights +# fish for anomalies as the number of states passes 32 +12345678901234567890123456789 - a12345678901234567890123456789b 12345678901234567890123456789 +123456789012345678901234567890 - a123456789012345678901234567890b 123456789012345678901234567890 +1234567890123456789012345678901 - a1234567890123456789012345678901b 1234567890123456789012345678901 +12345678901234567890123456789012 - a12345678901234567890123456789012b 12345678901234567890123456789012 +123456789012345678901234567890123 - a123456789012345678901234567890123b 123456789012345678901234567890123 +# and one really big one, beyond any plausible word width +1234567890123456789012345678901234567890123456789012345678901234567890 - a1234567890123456789012345678901234567890123456789012345678901234567890b 1234567890123456789012345678901234567890123456789012345678901234567890 +# fish for problems as brackets go past 8 +[ab][cd][ef][gh][ij][kl][mn] - xacegikmoq acegikm +[ab][cd][ef][gh][ij][kl][mn][op] - xacegikmoq acegikmo +[ab][cd][ef][gh][ij][kl][mn][op][qr] - xacegikmoqy acegikmoq +[ab][cd][ef][gh][ij][kl][mn][op][q] - xacegikmoqy acegikmoq + +# subtleties of matching +abc & xabcy abc +a\(b\)?c\1d b acd +aBc i Abc Abc +a[Bc]*d i abBCcd abBCcd +0[[:upper:]]1 &i 0a1 0a1 +0[[:lower:]]1 &i 0A1 0A1 +a[^b]c &i abc +a[^b]c &i aBc +a[^b]c &i adc adc +[a]b[c] - abc abc +[a]b[a] - aba aba +[abc]b[abc] - abc abc +[abc]b[abd] - abd abd +a(b?c)+d - accd accd +(wee|week)(knights|night) - weeknights weeknights +(we|wee|week|frob)(knights|night|day) - weeknights weeknights +a[bc]d - xyzaaabcaababdacd abd +a[ab]c - aaabc abc +abc s abc abc +a* & b @b + +# Let's have some fun -- try to match a C comment. +# first the obvious, which looks okay at first glance... +/\*.*\*/ - /*x*/ /*x*/ +# but... +/\*.*\*/ - /*x*/y/*z*/ /*x*/y/*z*/ +# okay, we must not match */ inside; try to do that... +/\*([^*]|\*[^/])*\*/ - /*x*/ /*x*/ +/\*([^*]|\*[^/])*\*/ - /*x*/y/*z*/ /*x*/ +# but... +/\*([^*]|\*[^/])*\*/ - /*x**/y/*z*/ /*x**/y/*z*/ +# and a still fancier version, which does it right (I think)... +/\*([^*]|\*+[^*/])*\*+/ - /*x*/ /*x*/ +/\*([^*]|\*+[^*/])*\*+/ - /*x*/y/*z*/ /*x*/ +/\*([^*]|\*+[^*/])*\*+/ - /*x**/y/*z*/ /*x**/ +/\*([^*]|\*+[^*/])*\*+/ - /*x****/y/*z*/ /*x****/ +/\*([^*]|\*+[^*/])*\*+/ - /*x**x*/y/*z*/ /*x**x*/ +/\*([^*]|\*+[^*/])*\*+/ - /*x***x/y/*z*/ /*x***x/y/*z*/ + +# subexpressions +a(b)(c)d - abcd abcd b,c +a(((b)))c - abc abc b,b,b +a(b|(c))d - abd abd b,- +a(b*|c|e)d - abbd abbd bb +a(b*|c|e)d - acd acd c +a(b*|c|e)d - ad ad @d +a(b?)c - abc abc b +a(b?)c - ac ac @c +a(b+)c - abc abc b +a(b+)c - abbbc abbbc bbb +a(b*)c - ac ac @c +(a|ab)(bc([de]+)f|cde) - abcdef abcdef a,bcdef,de +# the regression tester only asks for 9 subexpressions +a(b)(c)(d)(e)(f)(g)(h)(i)(j)k - abcdefghijk abcdefghijk b,c,d,e,f,g,h,i,j +a(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)l - abcdefghijkl abcdefghijkl b,c,d,e,f,g,h,i,j,k +a([bc]?)c - abc abc b +a([bc]?)c - ac ac @c +a([bc]+)c - abc abc b +a([bc]+)c - abcc abcc bc +a([bc]+)bc - abcbc abcbc bc +a(bb+|b)b - abb abb b +a(bbb+|bb+|b)b - abb abb b +a(bbb+|bb+|b)b - abbb abbb bb +a(bbb+|bb+|b)bb - abbb abbb b +(.*).* - abcdef abcdef abcdef +##(a*)* - bc @b @b + +# do we get the right subexpression when it is used more than once? +a(b|c)*d - ad ad - +a(b|c)*d - abcd abcd c +a(b|c)+d - abd abd b +a(b|c)+d - abcd abcd c +a(b|c?)+d - ad ad @d +a(b|c?)+d - abcd abcd @d +a(b|c){0,0}d - ad ad - +a(b|c){0,1}d - ad ad - +a(b|c){0,1}d - abd abd b +a(b|c){0,2}d - ad ad - +a(b|c){0,2}d - abcd abcd c +a(b|c){0,}d - ad ad - +a(b|c){0,}d - abcd abcd c +a(b|c){1,1}d - abd abd b +a(b|c){1,1}d - acd acd c +a(b|c){1,2}d - abd abd b +a(b|c){1,2}d - abcd abcd c +a(b|c){1,}d - abd abd b +a(b|c){1,}d - abcd abcd c +a(b|c){2,2}d - acbd acbd b +a(b|c){2,2}d - abcd abcd c +a(b|c){2,4}d - abcd abcd c +a(b|c){2,4}d - abcbd abcbd b +a(b|c){2,4}d - abcbcd abcbcd c +a(b|c){2,}d - abcd abcd c +a(b|c){2,}d - abcbd abcbd b +##a(b+|((c)*))+d - abd abd @d,@d,- +##a(b+|((c)*))+d - abcd abcd @d,@d,- + +# check out the STARTEND option +[abc] &# a(b)c b +[abc] &# a(d)c +[abc] &# a(bc)d b +[abc] &# a(dc)d c +. &# a()c +b.*c &# b(bc)c bc +b.* &# b(bc)c bc +.*c &# b(bc)c bc + +# plain strings, with the NOSPEC flag +abc m abc abc +abc m xabcy abc +abc m xyz +a*b m aba*b a*b +a*b m ab +"" mC EMPTY + +# cases involving NULs +aZb & a a +aZb &p a +#aZb &p# (aZb) aZb +aZ*b &p# (ab) ab +#a.b &# (aZb) aZb +#a.* &# (aZb)c aZb + +# word boundaries (ick) +[[:<:]]a & a a +[[:<:]]a & ba +[[:<:]]a & -a a +a[[:>:]] & a a +a[[:>:]] & ab +a[[:>:]] & a- a +[[:<:]]a.c[[:>:]] & axcd-dayc-dazce-abc abc +[[:<:]]a.c[[:>:]] & axcd-dayc-dazce-abc-q abc +[[:<:]]a.c[[:>:]] & axc-dayc-dazce-abc axc +[[:<:]]b.c[[:>:]] & a_bxc-byc_d-bzc-q bzc +[[:<:]].x..[[:>:]] & y_xa_-_xb_y-_xc_-axdc _xc_ +[[:<:]]a_b[[:>:]] & x_a_b + +# past problems, and suspected problems +(A[1])|(A[2])|(A[3])|(A[4])|(A[5])|(A[6])|(A[7])|(A[8])|(A[9])|(A[A]) - A1 A1 +abcdefghijklmnop i abcdefghijklmnop abcdefghijklmnop +abcdefghijklmnopqrstuv i abcdefghijklmnopqrstuv abcdefghijklmnopqrstuv +(ALAK)|(ALT[AB])|(CC[123]1)|(CM[123]1)|(GAMC)|(LC[23][EO ])|(SEM[1234])|(SL[ES][12])|(SLWW)|(SLF )|(SLDT)|(VWH[12])|(WH[34][EW])|(WP1[ESN]) - CC11 CC11 +CC[13]1|a{21}[23][EO][123][Es][12]a{15}aa[34][EW]aaaaaaa[X]a - CC11 CC11 +Char \([a-z0-9_]*\)\[.* b Char xyz[k Char xyz[k xyz +a?b - ab ab +-\{0,1\}[0-9]*$ b -5 -5 diff --git a/tests/warning.sh b/tests/warning.sh new file mode 100755 index 0000000..5df806b --- /dev/null +++ b/tests/warning.sh @@ -0,0 +1,18 @@ +#! /bin/sh +# +# Tell them not to be alarmed. + +: ${srcdir=.} + +failures=0 + +# +cat <<\EOF + +Please, do not be alarmed if some of the tests failed. +Report them to , +with the line number, the name of the file, +and grep version number 'grep --version'. +Thank You. + +EOF diff --git a/tests/yesno.sh b/tests/yesno.sh new file mode 100755 index 0000000..ac02fe6 --- /dev/null +++ b/tests/yesno.sh @@ -0,0 +1,115 @@ +#! /bin/sh +# Test feature interaction of -C, -v, -o, and -m. +# This set of tests was started by Charles Levert. + +: ${GREP=../src/grep} +: ${VERBOSE=} # empty or "1" +failures=0 + +# Lines, including terminating LF, contain 10 octets. +# The words "yes" and "no" are at zero-based octet offsets of 5, 15, ... +yn='yesno.txt' +cat > "$yn" </dev/null; echo "?$?"; sed 's!^!X!'; } < "$yn" | tr '\n' '/'` + + if test "$output" != "$expect" || test "$VERBOSE" = "1"; then + echo " Test #$t: { $GREP -F -n -b $opts yes; echo \"?\$?\"; sed 's!^!X!'; }" + echo " output: \"$output\"" + fi + if test "$output" != "$expect"; then + echo " expect: \"$expect\"" + echo ' FAIL' + failures=1 + elif test "$VERBOSE" = "1"; then + echo ' PASS' + fi + + t=`expr $t + 1` +done + +exit $failures diff --git a/vms/.cvsignore b/vms/.cvsignore new file mode 100644 index 0000000..282522d --- /dev/null +++ b/vms/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/vms/Makefile.am b/vms/Makefile.am new file mode 100644 index 0000000..27cf86b --- /dev/null +++ b/vms/Makefile.am @@ -0,0 +1,4 @@ +## Process this file with automake to create Makefile.in +AUTOMAKE_OPTIONS = no-dependencies + +EXTRA_DIST = README make.com config_vms.h diff --git a/vms/Makefile.in b/vms/Makefile.in new file mode 100644 index 0000000..bbd718a --- /dev/null +++ b/vms/Makefile.in @@ -0,0 +1,341 @@ +# Makefile.in generated by automake 1.10 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = vms +DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/codeset.m4 \ + $(top_srcdir)/m4/decl.m4 $(top_srcdir)/m4/djgpp.m4 \ + $(top_srcdir)/m4/dosfile.m4 $(top_srcdir)/m4/envsep.m4 \ + $(top_srcdir)/m4/error.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/header.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/inttypes_h.m4 \ + $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/largefile.m4 \ + $(top_srcdir)/m4/lcmessage.m4 $(top_srcdir)/m4/malloc.m4 \ + $(top_srcdir)/m4/mbstate_t.m4 $(top_srcdir)/m4/missing.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/realloc.m4 \ + $(top_srcdir)/m4/regex.m4 $(top_srcdir)/m4/sanity.m4 \ + $(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/ulonglong.m4 \ + $(top_srcdir)/m4/xstrtoumax.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +depcomp = +am__depfiles_maybe = +SOURCES = +DIST_SOURCES = +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GENCAT = @GENCAT@ +GETCONF = @GETCONF@ +GLIBC21 = @GLIBC21@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLBISON = @INTLBISON@ +INTLLIBS = @INTLLIBS@ +INTLOBJS = @INTLOBJS@ +INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +POFILES = @POFILES@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SEP = @SEP@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +U = @U@ +USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AUTOMAKE_OPTIONS = no-dependencies +EXTRA_DIST = README make.com config_vms.h +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu vms/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu vms/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-exec-am: + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic distclean \ + distclean-generic distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am + +# 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. +.NOEXPORT: diff --git a/vms/README b/vms/README new file mode 100644 index 0000000..b477dbb --- /dev/null +++ b/vms/README @@ -0,0 +1,16 @@ +** VMS + +Warning: untested + VMS users should try running the enclosed command file "make.com". + It may be necessary to add : + +#ifdef vms +#include +#endif + +in system.h (see HAVE_STRERROR). + + If you do not have NLS : + +#define ENABLE_NLS 0 +#define HAVE_LIBINTL_H 0 diff --git a/vms/config_vms.h b/vms/config_vms.h new file mode 100644 index 0000000..e97c31a --- /dev/null +++ b/vms/config_vms.h @@ -0,0 +1,39 @@ +/* Configuration file for OpenVMS */ + +#define HAVE_STRING_H 1 + +#define HAVE_MEMCHAR + +#define HAVE_STRERROR + +#define HAVE_STDLIB_H 1 + +#define HAVE_UNISTD_H 1 + +#define STDC_HEADERS + +#define HAVE_DIRENT_H 1 + +#define VERSION "2.4.1" +/* Avoid namespace collision with operating system supplied C library */ + +/* Make sure we have the C-RTL definitions */ +#include +#include + +/* Now override everything with the GNU version */ +#ifdef VMS +# define getopt gnu_getopt +# define optarg gnu_optarg +# define optopt gnu_optopt +# define optind gnu_optind +# define opterr gnu_opterr +#endif + +#if defined(VMS) && defined(__DECC) /* need function prototype */ +#if (__DECC_VER<50790004) /* have an own one */ +char *alloca(unsigned int); +#else +#define alloca __ALLOCA +#endif +#endif diff --git a/vms/make.com b/vms/make.com new file mode 100644 index 0000000..c816966 --- /dev/null +++ b/vms/make.com @@ -0,0 +1,71 @@ +$ ! Set the LOGICAL SYS to SYS$LIBRARY if it isn't defined +$ ! so that #include will search SYS$LIBRARY for the file. +$ IF F$TRNLNM("SYS") .EQS. "" THEN DEFINE SYS SYS$LIBRARY +$ ccopt = "/include=sys$disk:[]" +$ if (f$search("sys$system:decc$compiler.exe").nes."") +$ then +$ if f$getsyi("HW_MODEL").ge.1024 +$ then +$ ccopt = "/prefix=all" + ccopt +$ else +$ ccopt = "/decc/prefix=all" + ccopt +$ endif +$ endif +$ if f$extract(1,3,f$getsyi("Version")) .lts. "7.0" +$ then +$ if f$search("x11vms:xvmsutils.olb").eqs."" +$ then +$ type sys$input +To build grep on OpenVMS versions prior to 7.x you need to install the +xvmsutils to get the close-/open-/readdir functions. The library can be +found at http://www.decus.de:8080/www/vms/sw/xvmsutils.htmlx + +Exiting now +$ exit +$ endif +$ llib = ",x11vms:xvmsutils.olb/lib" +$ else +$ llib = "" +$ endif +$ copy [-.vms]config_vms.h config.h +$ cdefs ="HAVE_CONFIG_H" +$ WRITE SYS$OUTPUT "Compiling ALLOCA..." +$ CC'ccopt' ALLOCA.C /DEFINE=('cdefs') +$ WRITE SYS$OUTPUT "Compiling DFA..." +$ CC'ccopt' DFA.C /DEFINE=('cdefs') +$ WRITE SYS$OUTPUT "Compiling GETOPT..." +$ CC'ccopt' GETOPT.C /DEFINE=('cdefs') +$ WRITE SYS$OUTPUT "Compiling GETOPT1..." +$ CC'ccopt' GETOPT1.C /DEFINE=('cdefs') +$ WRITE SYS$OUTPUT "Compiling GREP..." +$ CC'ccopt' GREP.C /DEFINE=('cdefs',initialize_main="vms_fab") +$ WRITE SYS$OUTPUT "Compiling KWSET..." +$ CC'ccopt' KWSET.C /DEFINE=('cdefs') +$ WRITE SYS$OUTPUT "Compiling OBSTACK..." +$ CC'ccopt' OBSTACK.C /DEFINE=('cdefs') +$ WRITE SYS$OUTPUT "Compiling REGEX..." +$ CC'ccopt' REGEX.C /DEFINE=('cdefs') +$ WRITE SYS$OUTPUT "Compiling SAVEDIR..." +$ CC'ccopt' SAVEDIR.C /DEFINE=('cdefs') +$ WRITE SYS$OUTPUT "Compiling SEARCH..." +$ CC'ccopt' SEARCH.C /DEFINE=('cdefs') +$ WRITE SYS$OUTPUT "Compiling STPCPY..." +$ CC'ccopt' STPCPY.C /DEFINE=('cdefs') +$ WRITE SYS$OUTPUT "Compiling VMS_FAB..." +$ CC'ccopt' VMS_FAB.C /DEFINE=('cdefs') +$ WRITE SYS$OUTPUT "Compiling GREPMAT..." +$ CC'ccopt' GREPMAT.C /DEFINE=('cdefs') +$ WRITE SYS$OUTPUT "Linking GREP..." +$ LINK GREP,ALLOCA,DFA,GETOPT,GETOPT1,KWSET,OBSTACK,REGEX,SEARCH,VMS_FAB,- + SAVEDIR,STPCPY,GREPMAT'llib' +$ WRITE SYS$OUTPUT "Compiling EGREPMAT..." +$ CC'ccopt' EGREPMAT.C /DEFINE=('cdefs') +$ WRITE SYS$OUTPUT "Linking EGREP..." +$ LINK/exe=egrep.exe grep,ALLOCA,DFA,GETOPT,GETOPT1,KWSET,OBSTACK,REGEX,SEARCH,- + VMS_FAB,SAVEDIR,STPCPY,EGREPMAT'llib' +$ WRITE SYS$OUTPUT "Compiling FGREPMAT..." +$ CC'ccopt' FGREPMAT.C /DEFINE=('cdefs') +$ WRITE SYS$OUTPUT "Linking FGREP..." +$ LINK/exe=fgrep.exe GREP,ALLOCA,DFA,GETOPT,GETOPT1,KWSET,OBSTACK,REGEX,SEARCH,- + VMS_FAB,savedir,stpcpy,FGREPMAT'llib' +$ EXIT -- 2.7.4 From 89b6768046f08b7e319b44eae9bb3dab50714da4 Mon Sep 17 00:00:00 2001 From: Hurnjoo Lee Date: Mon, 21 Dec 2015 14:47:30 +0900 Subject: [PATCH 2/2] Add packaging files Change-Id: I2551ed7c2450960748aeda2a0fd3ad14db578d1c Signed-off-by: Hurnjoo Lee --- packaging/grep.changes | 10 ++++++++++ packaging/grep.manifest | 5 +++++ packaging/grep.spec | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+) create mode 100644 packaging/grep.changes create mode 100644 packaging/grep.manifest create mode 100644 packaging/grep.spec diff --git a/packaging/grep.changes b/packaging/grep.changes new file mode 100644 index 0000000..856c7a4 --- /dev/null +++ b/packaging/grep.changes @@ -0,0 +1,10 @@ +* Thu Jan 16 2014 Jacek Bukarewicz upstream/2.16@028b2d9 +- Update to version 2.16, minor packaging fixes +- resetting manifest requested domain to floor + +* Thu Jun 27 2013 Patrick McCarty f1093be +- packaging: provide /bin/grep for compatibility + +* Mon Mar 18 2013 Anas Nashif upstream/2.14@b484a10 +- Fixed package group/license + diff --git a/packaging/grep.manifest b/packaging/grep.manifest new file mode 100644 index 0000000..017d22d --- /dev/null +++ b/packaging/grep.manifest @@ -0,0 +1,5 @@ + + + + + diff --git a/packaging/grep.spec b/packaging/grep.spec new file mode 100644 index 0000000..f1fbc13 --- /dev/null +++ b/packaging/grep.spec @@ -0,0 +1,46 @@ +Name: grep +BuildRequires: automake +BuildRequires: pcre-devel +Url: http://www.gnu.org/software/grep/ +Version: 2.5.2 +Release: 0 +Summary: Print lines matching a pattern +License: GPL-2.0+ +Group: Base/Utilities +Source0: grep-%{version}.tar.xz +Source1001: grep.manifest +Provides: base:/usr/bin/grep +Provides: /bin/grep +BuildRequires: makeinfo +BuildRequires: gettext-tools + +%description +The grep command searches one or more input files for lines +containing a match to a specified pattern. By default, grep prints +the matching lines. + +%prep +%setup -q +cp %{SOURCE1001} . + +%build +%configure --disable-silent-rules --without-included-regex +%{__make} %{?_smp_mflags} + +%check +make check VERBOSE=1 + +%install +%make_install +%find_lang %name + +%docs_package + +%lang_package + + +%files +%manifest %{name}.manifest +%defattr(-,root,root) +%license COPYING +%{_bindir}/* -- 2.7.4