diff --git a/ABOUT-NLS b/ABOUT-NLS index 47d5e39f0..2f50c6693 100644 --- a/ABOUT-NLS +++ b/ABOUT-NLS @@ -1,8 +1,8 @@ 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 +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 will gradually become able to speak many languages. A few packages already provide translations for their messages. @@ -25,7 +25,7 @@ related to internationalization, you should tell about the version of Quick configuration advice ========================== - If you want to exploit the full power of internationalization, you +If you want to exploit the full power of internationalization, you should configure it using ./configure --with-included-gettext @@ -48,10 +48,10 @@ included `libintl'. 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'. +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 @@ -98,7 +98,7 @@ codes, stating which languages are allowed. Using This Package ================== - As a user, if your language has been installed for this package, you +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 @@ -131,6 +131,13 @@ 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 @@ -140,7 +147,7 @@ to `de_DE' (German as spoken in Germany), and `pt' to `pt_PT' Translating Teams ================= - For the Free Translation Project to be a success, we need interested +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 @@ -170,423 +177,559 @@ programming skill, here. Available Packages ================== - Languages are not equally supported in all packages. The following -matrix shows the current state of internationalization, as of May 2003. -The matrix shows, in regard of each package, for which languages PO -files have been submitted to translation coordination, with a +Languages are not equally supported in all packages. The following +matrix shows the current state of internationalization, as of January +2004. 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 am az be bg ca cs da de el en en_GB eo es - +-------------------------------------------+ - a2ps | [] [] [] [] | - aegis | () | - anubis | | - ap-utils | | - bash | [] [] [] | - batchelor | | - bfd | [] [] | - binutils | [] [] | - bison | [] [] [] | - bluez-pin | [] [] | - clisp | | - clisp | [] [] [] | - coreutils | [] [] [] [] | - cpio | [] [] [] | - darkstat | () [] | - diffutils | [] [] [] [] [] [] [] | - e2fsprogs | [] [] | - enscript | [] [] [] [] | - error | [] [] [] [] [] | - fetchmail | [] () [] [] [] [] | - fileutils | [] [] [] | - findutils | [] [] [] [] [] [] | - flex | [] [] [] [] | - gas | [] | - gawk | [] [] [] [] | - gcal | [] | - gcc | [] [] | - gettext | [] [] [] [] [] | - gettext-runtime | [] [] [] [] [] | - gettext-tools | [] [] | - gimp-print | [] [] [] [] [] | - gliv | | - glunarclock | [] [] [] | - gnucash | () [] | - gnucash-glossary | [] () [] | - gnupg | [] () [] [] [] [] | - gpe-calendar | [] | - gpe-conf | [] | - gpe-contacts | [] | - gpe-edit | | - gpe-login | [] | - gpe-ownerinfo | [] | - gpe-sketchbook | [] | - gpe-timesheet | | - gpe-today | [] | - gpe-todo | [] | - gphoto2 | [] [] [] [] | - gprof | [] [] | - gpsdrive | () () () | - grep | [] [] [] [] [] | - gretl | [] | - hello | [] [] [] [] [] [] | - id-utils | [] [] | - indent | [] [] [] [] | - jpilot | [] [] [] [] | - jwhois | [] | - kbd | [] [] [] [] [] | - ld | [] [] | - libc | [] [] [] [] [] [] | - libgpewidget | [] | - libiconv | [] [] [] [] [] | - lifelines | [] () | - lilypond | [] | - lingoteach | | - lingoteach_lessons | () () | - lynx | [] [] [] [] | - m4 | [] [] [] [] | - mailutils | [] [] | - make | [] [] [] | - man-db | [] () [] [] () | - mysecretdiary | [] [] [] | - nano | [] () [] [] [] | - nano_1_0 | [] () [] [] [] | - opcodes | [] [] | - parted | [] [] [] [] [] | - ptx | [] [] [] [] [] | - python | | - radius | | - recode | [] [] [] [] [] [] | - screem | | - sed | [] [] [] [] [] | - sh-utils | [] [] [] | - sharutils | [] [] [] [] [] [] | - sketch | [] () [] | - soundtracker | [] [] [] | - sp | [] | - tar | [] [] [] [] | - texinfo | [] [] [] [] | - textutils | [] [] [] [] | - tin | () () | - util-linux | [] [] [] [] [] | - vorbis-tools | [] [] [] | - wastesedge | () | - wdiff | [] [] [] [] | - wget | [] [] [] [] [] [] [] | - xchat | [] [] [] | - xpad | | - +-------------------------------------------+ - am az be bg ca cs da de el en en_GB eo es - 0 1 4 2 31 17 54 60 14 1 4 12 56 + Ready PO files af am ar az be bg bs ca cs da de el en en_GB eo es + +----------------------------------------------------+ + a2ps | [] [] [] [] | + aegis | () | + ant-phone | () | + anubis | | + ap-utils | | + aspell | [] | + bash | [] [] [] [] | + batchelor | | + bfd | [] [] | + binutils | [] [] | + bison | [] [] [] | + bluez-pin | [] [] [] | + clisp | | + clisp | [] [] [] | + console-tools | [] [] | + coreutils | [] [] [] [] | + cpio | [] [] [] | + darkstat | [] () [] | + diffutils | [] [] [] [] [] [] [] | + e2fsprogs | [] [] [] | + enscript | [] [] [] [] | + error | [] [] [] [] [] | + fetchmail | [] () [] [] [] [] | + fileutils | [] [] [] | + findutils | [] [] [] [] [] [] [] | + flex | [] [] [] [] | + fslint | | + gas | [] | + gawk | [] [] [] [] | + gbiff | [] | + gcal | [] | + gcc | [] [] | + gettext | [] [] [] [] [] | + gettext-examples | [] [] [] [] | + gettext-runtime | [] [] [] [] [] | + gettext-tools | [] [] [] | + gimp-print | [] [] [] [] [] | + gliv | | + glunarclock | [] [] | + gnubiff | [] | + gnucash | [] () [] [] | + gnucash-glossary | [] () [] | + gnupg | [] () [] [] [] [] | + 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 | [] | + gtick | [] () | + hello | [] [] [] [] [] [] | + id-utils | [] [] | + indent | [] [] [] [] | + iso_3166 | [] [] [] [] [] [] [] [] [] [] | + iso_3166_1 | [] [] [] [] [] [] | + iso_3166_2 | | + iso_3166_3 | [] | + iso_4217 | [] [] [] [] | + iso_639 | | + jpilot | [] [] [] | + jtag | | + jwhois | [] | + kbd | [] [] [] [] [] | + latrine | () | + ld | [] [] | + libc | [] [] [] [] [] [] | + libgpewidget | [] [] | + libiconv | [] [] [] [] [] | + lifelines | [] () | + lilypond | [] | + lingoteach | | + lingoteach_lessons | () () | + lynx | [] [] [] [] | + m4 | [] [] [] [] | + mailutils | [] [] | + make | [] [] [] | + man-db | [] () [] [] () | + minicom | [] [] [] | + mysecretdiary | [] [] [] | + nano | [] () [] [] [] | + nano_1_0 | [] () [] [] [] | + opcodes | [] | + parted | [] [] [] [] [] | + ptx | [] [] [] [] [] | + python | | + radius | [] | + recode | [] [] [] [] [] [] [] | + rpm | [] [] | + screem | | + scrollkeeper | [] [] [] [] [] [] | + sed | [] [] [] [] [] [] | + sh-utils | [] [] [] | + shared-mime-info | | + sharutils | [] [] [] [] [] [] | + silky | () | + skencil | [] () [] | + sketch | [] () [] | + soundtracker | [] [] [] | + sp | [] | + tar | [] [] [] [] | + texinfo | [] [] [] | + textutils | [] [] [] [] | + tin | () () | + tp-robot | | + tuxpaint | [] [] [] [] [] [] [] | + unicode-han-tra... | | + unicode-transla... | | + util-linux | [] [] [] [] [] | + vorbis-tools | [] [] [] [] | + wastesedge | () | + wdiff | [] [] [] [] | + wget | [] [] [] [] [] [] | + xchat | [] [] [] [] | + xfree86_xkb_xml | [] [] | + xpad | [] | + +----------------------------------------------------+ + af am ar az be bg bs ca cs da de el en en_GB eo es + 4 0 0 1 9 4 1 40 41 60 78 17 1 5 13 68 - et fa fi fr ga gl he hr hu id it ja ko - +----------------------------------------+ - a2ps | [] [] [] () () | - aegis | | - anubis | [] | - ap-utils | [] | - bash | [] [] | - batchelor | [] | - bfd | [] [] | - binutils | [] [] | - bison | [] [] [] [] | - bluez-pin | [] [] [] [] | - clisp | | - clisp | [] | - coreutils | [] [] [] [] | - cpio | [] [] [] [] | - darkstat | () [] [] [] | - diffutils | [] [] [] [] [] [] [] | - e2fsprogs | | - enscript | [] [] | - error | [] [] [] [] | - fetchmail | [] | - fileutils | [] [] [] [] [] | - findutils | [] [] [] [] [] [] [] [] [] [] [] | - flex | [] [] | - gas | [] | - gawk | [] [] | - gcal | [] | - gcc | [] | - gettext | [] [] [] | - gettext-runtime | [] [] [] [] | - gettext-tools | [] | - gimp-print | [] [] | - gliv | () | - glunarclock | [] [] [] [] | - gnucash | [] | - gnucash-glossary | [] | - gnupg | [] [] [] [] [] [] [] | - gpe-calendar | [] | - gpe-conf | | - gpe-contacts | [] | - gpe-edit | [] [] | - gpe-login | [] | - gpe-ownerinfo | [] [] [] | - gpe-sketchbook | [] | - gpe-timesheet | [] [] [] | - gpe-today | [] [] | - gpe-todo | [] [] | - gphoto2 | [] [] [] | - gprof | [] [] | - gpsdrive | () [] () () | - grep | [] [] [] [] [] [] [] [] [] [] [] | - gretl | [] | - hello | [] [] [] [] [] [] [] [] [] [] [] [] [] | - id-utils | [] [] [] | - indent | [] [] [] [] [] [] [] [] | - jpilot | [] () | - jwhois | [] [] [] [] | - kbd | [] | - ld | [] | - libc | [] [] [] [] [] [] | - libgpewidget | [] [] [] | - libiconv | [] [] [] [] [] [] [] [] | - lifelines | () | - lilypond | [] | - lingoteach | [] [] | - lingoteach_lessons | | - lynx | [] [] [] [] | - m4 | [] [] [] [] | - mailutils | | - make | [] [] [] [] [] [] | - man-db | [] () () | - mysecretdiary | [] [] | - nano | [] [] [] [] | - nano_1_0 | [] [] [] [] | - opcodes | [] [] | - parted | [] [] [] | - ptx | [] [] [] [] [] [] [] | - python | | - radius | | - recode | [] [] [] [] [] [] | - screem | | - sed | [] [] [] [] [] [] [] [] | - sh-utils | [] [] [] [] [] [] | - sharutils | [] [] [] [] [] | - sketch | [] | - soundtracker | [] [] [] | - sp | [] () | - tar | [] [] [] [] [] [] [] [] [] | - texinfo | [] [] [] [] | - textutils | [] [] [] [] [] | - tin | [] () | - util-linux | [] [] [] [] () [] | - vorbis-tools | [] | - wastesedge | () | - wdiff | [] [] [] [] [] | - wget | [] [] [] [] [] [] [] [] | - xchat | [] [] [] | - xpad | | - +----------------------------------------+ - et fa fi fr ga gl he hr hu id it ja ko - 20 1 15 73 14 24 8 10 30 31 19 31 9 + et eu fa fi fr ga gl he hr hu id is it ja ko lg + +-------------------------------------------------+ + a2ps | [] [] [] () () | + aegis | | + ant-phone | [] | + anubis | [] | + ap-utils | [] | + aspell | [] [] | + bash | [] [] | + batchelor | [] [] | + bfd | [] | + binutils | [] [] | + bison | [] [] [] [] | + bluez-pin | [] [] [] [] [] | + clisp | | + clisp | [] | + console-tools | | + coreutils | [] [] [] [] [] [] | + cpio | [] [] [] [] | + darkstat | () [] [] [] | + diffutils | [] [] [] [] [] [] [] | + e2fsprogs | | + enscript | [] [] | + error | [] [] [] [] | + fetchmail | [] | + fileutils | [] [] [] [] [] [] | + findutils | [] [] [] [] [] [] [] [] [] [] [] | + flex | [] [] [] | + fslint | [] | + gas | [] | + gawk | [] [] [] | + gbiff | [] | + gcal | [] | + gcc | [] | + gettext | [] [] [] | + gettext-examples | [] [] | + gettext-runtime | [] [] [] [] [] | + gettext-tools | [] [] [] | + gimp-print | [] [] | + gliv | () | + glunarclock | [] [] [] [] | + gnubiff | [] | + gnucash | () [] | + gnucash-glossary | [] | + gnupg | [] [] [] [] [] [] [] | + 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 | [] [] | + gtick | [] [] [] | + hello | [] [] [] [] [] [] [] [] [] [] [] [] [] | + id-utils | [] [] [] [] | + indent | [] [] [] [] [] [] [] [] [] | + iso_3166 | [] [] [] [] [] [] [] | + iso_3166_1 | [] [] [] [] [] | + iso_3166_2 | | + iso_3166_3 | | + iso_4217 | [] [] [] [] [] [] | + iso_639 | | + jpilot | [] () | + jtag | [] | + jwhois | [] [] [] [] | + kbd | [] | + latrine | [] | + ld | [] | + libc | [] [] [] [] [] [] | + libgpewidget | [] [] [] [] | + libiconv | [] [] [] [] [] [] [] [] [] | + lifelines | () | + lilypond | [] | + lingoteach | [] [] | + lingoteach_lessons | | + lynx | [] [] [] [] | + m4 | [] [] [] [] | + mailutils | | + make | [] [] [] [] [] [] | + man-db | () () | + minicom | [] [] [] [] | + mysecretdiary | [] [] | + nano | [] [] [] [] | + nano_1_0 | [] [] [] [] | + opcodes | [] | + parted | [] [] [] | + ptx | [] [] [] [] [] [] [] | + python | | + radius | [] | + recode | [] [] [] [] [] [] | + rpm | [] [] | + screem | | + scrollkeeper | [] | + sed | [] [] [] [] [] [] [] [] [] | + sh-utils | [] [] [] [] [] [] [] | + shared-mime-info | [] [] [] | + sharutils | [] [] [] [] [] | + silky | () [] () () | + skencil | [] | + sketch | [] | + soundtracker | [] [] | + sp | [] () | + tar | [] [] [] [] [] [] [] [] [] | + texinfo | [] [] [] [] | + textutils | [] [] [] [] [] [] | + tin | [] () | + tp-robot | [] | + tuxpaint | [] [] [] [] [] [] [] [] [] | + unicode-han-tra... | | + unicode-transla... | [] [] | + util-linux | [] [] [] [] () [] | + vorbis-tools | [] | + wastesedge | () | + wdiff | [] [] [] [] [] [] | + wget | [] [] [] [] [] [] [] | + xchat | [] [] [] | + xfree86_xkb_xml | [] [] | + xpad | [] [] | + +-------------------------------------------------+ + et eu fa fi fr ga gl he hr hu id is it ja ko lg + 22 2 1 26 106 28 24 8 10 41 33 1 26 33 12 0 - lg lt lv ms nb nl nn no pl pt pt_BR ro - +----------------------------------------+ - a2ps | [] [] () () () [] [] | - aegis | () | - anubis | [] [] | - ap-utils | () | - bash | [] | - batchelor | | - bfd | | - binutils | | - bison | [] [] [] [] | - bluez-pin | [] | - clisp | | - clisp | [] | - coreutils | [] | - cpio | [] [] [] | - darkstat | [] [] [] [] | - diffutils | [] [] [] | - e2fsprogs | | - enscript | [] [] | - error | [] [] | - fetchmail | () () | - fileutils | [] | - findutils | [] [] [] [] | - flex | [] | - gas | | - gawk | [] | - gcal | | - gcc | | - gettext | [] | - gettext-runtime | [] | - gettext-tools | | - gimp-print | [] | - gliv | [] | - glunarclock | [] | - gnucash | | - gnucash-glossary | [] [] | - gnupg | | - gpe-calendar | [] [] | - gpe-conf | [] [] | - gpe-contacts | [] | - gpe-edit | [] [] | - gpe-login | [] [] | - gpe-ownerinfo | [] [] | - gpe-sketchbook | [] [] | - gpe-timesheet | [] [] | - gpe-today | [] [] | - gpe-todo | [] [] | - gphoto2 | | - gprof | [] | - gpsdrive | () () () | - grep | [] [] [] [] | - gretl | | - hello | [] [] [] [] [] [] [] [] [] | - id-utils | [] [] [] | - indent | [] [] [] | - jpilot | () () | - jwhois | [] [] [] | - kbd | | - ld | | - libc | [] [] [] [] | - libgpewidget | [] [] | - libiconv | [] [] | - lifelines | | - lilypond | [] | - lingoteach | | - lingoteach_lessons | | - lynx | [] [] | - m4 | [] [] [] [] | - mailutils | | - make | [] [] | - man-db | [] | - mysecretdiary | [] | - nano | [] [] [] [] | - nano_1_0 | [] [] [] [] | - opcodes | [] [] [] | - parted | [] [] [] | - ptx | [] [] [] [] [] [] [] | - python | | - radius | | - recode | [] [] [] | - screem | | - sed | [] [] | - sh-utils | [] | - sharutils | [] | - sketch | [] | - soundtracker | | - sp | | - tar | [] [] [] [] [] [] | - texinfo | [] | - textutils | [] | - tin | | - util-linux | [] [] | - vorbis-tools | [] [] | - wastesedge | | - wdiff | [] [] [] [] | - wget | [] [] [] | - xchat | [] [] | - xpad | [] | - +----------------------------------------+ - lg lt lv ms nb nl nn no pl pt pt_BR ro - 0 0 2 11 7 26 3 4 18 15 34 34 + lt lv mk mn ms mt nb nl nn no nso pl pt pt_BR ro ru + +-----------------------------------------------------+ + a2ps | [] [] () () [] [] [] | + aegis | () () () | + ant-phone | [] [] | + anubis | [] [] [] [] [] [] | + ap-utils | [] () [] | + aspell | [] | + bash | [] [] [] | + batchelor | [] | + bfd | [] | + binutils | [] | + bison | [] [] [] [] [] | + bluez-pin | [] [] [] | + clisp | | + clisp | [] | + console-tools | [] | + coreutils | [] [] | + cpio | [] [] [] [] [] | + darkstat | [] [] [] [] | + diffutils | [] [] [] [] [] [] | + e2fsprogs | [] | + enscript | [] [] [] [] | + error | [] [] [] | + fetchmail | [] [] () [] | + fileutils | [] [] [] | + findutils | [] [] [] [] [] | + flex | [] [] [] [] | + fslint | [] [] | + gas | | + gawk | [] [] [] | + gbiff | [] [] | + gcal | | + gcc | | + gettext | [] [] [] | + gettext-examples | [] [] [] | + gettext-runtime | [] [] [] [] | + gettext-tools | [] [] | + gimp-print | [] | + gliv | [] [] [] | + glunarclock | [] [] [] [] | + gnubiff | [] | + gnucash | [] [] () [] | + gnucash-glossary | [] [] | + gnupg | [] | + 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 | | + gtick | [] [] [] | + hello | [] [] [] [] [] [] [] [] [] [] | + id-utils | [] [] [] [] | + indent | [] [] [] [] | + iso_3166 | [] [] [] | + iso_3166_1 | [] [] | + iso_3166_2 | | + iso_3166_3 | [] | + iso_4217 | [] [] [] [] [] [] [] [] | + iso_639 | [] | + jpilot | () () | + jtag | | + jwhois | [] [] [] [] () | + kbd | [] [] [] | + latrine | [] | + ld | | + libc | [] [] [] [] | + libgpewidget | [] [] [] | + libiconv | [] [] [] [] [] | + lifelines | | + lilypond | | + lingoteach | | + lingoteach_lessons | | + lynx | [] [] [] | + m4 | [] [] [] [] [] | + mailutils | [] [] [] | + make | [] [] [] [] | + man-db | [] | + minicom | [] [] [] [] | + mysecretdiary | [] [] [] | + nano | [] [] [] [] [] | + nano_1_0 | [] [] [] [] [] [] | + opcodes | [] [] | + parted | [] [] [] [] | + ptx | [] [] [] [] [] [] [] [] | + python | | + radius | [] [] | + recode | [] [] [] [] | + rpm | [] [] [] | + screem | | + scrollkeeper | [] [] [] [] [] | + sed | [] [] [] | + sh-utils | [] [] | + shared-mime-info | [] [] | + sharutils | [] [] | + silky | () | + skencil | [] [] | + sketch | [] [] | + soundtracker | | + sp | | + tar | [] [] [] [] [] [] | + texinfo | [] [] [] [] | + textutils | [] [] | + tin | | + tp-robot | [] | + tuxpaint | [] [] [] [] [] [] [] [] | + unicode-han-tra... | | + unicode-transla... | | + util-linux | [] [] [] | + vorbis-tools | [] [] [] | + wastesedge | | + wdiff | [] [] [] [] [] | + wget | [] [] [] | + xchat | [] [] [] | + xfree86_xkb_xml | [] [] | + xpad | [] [] | + +-----------------------------------------------------+ + lt lv mk mn ms mt nb nl nn no nso pl pt pt_BR ro ru + 1 2 0 3 12 0 10 69 6 7 1 40 26 36 76 63 - ru sk sl sr sv ta tr uk vi wa zh_CN zh_TW - +-------------------------------------------+ - a2ps | [] [] [] [] [] | 16 - aegis | () | 0 - anubis | [] [] | 5 - ap-utils | () | 1 - bash | [] | 7 - batchelor | | 1 - bfd | [] [] [] | 7 - binutils | [] [] [] | 7 - bison | [] [] | 13 - bluez-pin | | 7 - clisp | | 0 - clisp | | 5 - coreutils | [] [] [] [] [] | 14 - cpio | [] [] [] | 13 - darkstat | [] () () | 9 - diffutils | [] [] [] [] | 21 - e2fsprogs | [] | 3 - enscript | [] [] [] | 11 - error | [] [] [] | 14 - fetchmail | [] | 7 - fileutils | [] [] [] [] [] [] | 15 - findutils | [] [] [] [] [] [] | 27 - flex | [] [] [] | 10 - gas | [] | 3 - gawk | [] [] | 9 - gcal | [] [] | 4 - gcc | [] | 4 - gettext | [] [] [] [] [] [] | 15 - gettext-runtime | [] [] [] [] [] [] | 16 - gettext-tools | [] [] | 5 - gimp-print | [] [] | 10 - gliv | | 1 - glunarclock | [] [] [] | 11 - gnucash | [] [] | 4 - gnucash-glossary | [] [] [] | 8 - gnupg | [] [] [] [] | 16 - gpe-calendar | [] | 5 - gpe-conf | | 3 - gpe-contacts | [] | 4 - gpe-edit | [] | 5 - gpe-login | [] | 5 - gpe-ownerinfo | [] | 7 - gpe-sketchbook | [] | 5 - gpe-timesheet | [] | 6 - gpe-today | [] | 6 - gpe-todo | [] | 6 - gphoto2 | [] [] | 9 - gprof | [] [] | 7 - gpsdrive | [] [] | 3 - grep | [] [] [] [] | 24 - gretl | | 2 - hello | [] [] [] [] [] | 33 - id-utils | [] [] [] | 11 - indent | [] [] [] [] | 19 - jpilot | [] [] [] [] [] | 10 - jwhois | () () [] [] | 10 - kbd | [] [] | 8 - ld | [] [] | 5 - libc | [] [] [] [] | 20 - libgpewidget | | 6 - libiconv | [] [] [] [] [] [] | 21 - lifelines | [] | 2 - lilypond | [] | 4 - lingoteach | | 2 - lingoteach_lessons | () | 0 - lynx | [] [] [] [] | 14 - m4 | [] [] [] | 15 - mailutils | | 2 - make | [] [] [] [] | 15 - man-db | [] | 6 - mysecretdiary | [] [] | 8 - nano | [] [] [] | 15 - nano_1_0 | [] [] [] | 15 - opcodes | [] [] | 9 - parted | [] [] | 13 - ptx | [] [] [] | 22 - python | | 0 - radius | | 0 - recode | [] [] [] [] | 19 - screem | [] | 1 - sed | [] [] [] [] [] | 20 - sh-utils | [] [] [] | 13 - sharutils | [] [] [] [] | 16 - sketch | [] | 5 - soundtracker | [] | 7 - sp | [] | 3 - tar | [] [] [] [] [] | 24 - texinfo | [] [] [] [] | 13 - textutils | [] [] [] [] [] | 15 - tin | | 1 - util-linux | [] [] | 14 - vorbis-tools | [] | 7 - wastesedge | | 0 - wdiff | [] [] [] [] | 17 - wget | [] [] [] [] [] [] [] | 25 - xchat | [] [] [] | 11 - xpad | | 1 - +-------------------------------------------+ - 50 teams ru sk sl sr sv ta tr uk vi wa zh_CN zh_TW - 97 domains 32 19 16 0 56 0 48 10 1 1 12 23 913 + sk sl sr sv ta th tr uk ven vi wa xh zh_CN zh_TW zu + +-----------------------------------------------------+ + a2ps | [] [] [] [] | 16 + aegis | | 0 + ant-phone | | 3 + anubis | [] [] | 9 + ap-utils | () | 3 + aspell | | 4 + bash | | 9 + batchelor | | 3 + bfd | [] [] | 6 + binutils | [] [] [] | 8 + bison | [] [] | 14 + bluez-pin | [] [] [] | 14 + clisp | | 0 + clisp | | 5 + console-tools | | 3 + coreutils | [] [] [] [] | 16 + cpio | [] [] | 14 + darkstat | [] [] [] () () | 12 + diffutils | [] [] [] | 23 + e2fsprogs | [] [] | 6 + enscript | [] [] | 12 + error | [] [] [] | 15 + fetchmail | [] [] | 11 + fileutils | [] [] [] [] [] | 17 + findutils | [] [] [] [] [] [] | 29 + flex | [] [] | 13 + fslint | | 3 + gas | [] | 3 + gawk | [] [] | 12 + gbiff | | 4 + gcal | [] [] | 4 + gcc | [] | 4 + gettext | [] [] [] [] [] | 16 + gettext-examples | [] [] [] [] [] | 14 + gettext-runtime | [] [] [] [] [] [] [] [] | 22 + gettext-tools | [] [] [] [] [] [] | 14 + gimp-print | [] [] | 10 + gliv | | 3 + glunarclock | [] [] [] | 13 + gnubiff | | 3 + gnucash | [] [] | 9 + gnucash-glossary | [] [] [] | 8 + gnupg | [] [] [] [] | 17 + gpe-aerial | [] | 7 + gpe-beam | [] | 8 + gpe-calendar | [] [] [] [] | 13 + gpe-clock | [] [] [] | 10 + gpe-conf | [] [] | 9 + gpe-contacts | [] [] [] | 11 + gpe-edit | [] [] [] [] [] | 12 + gpe-go | | 5 + gpe-login | [] [] [] [] [] | 13 + gpe-ownerinfo | [] [] [] [] | 13 + gpe-sketchbook | [] [] | 9 + gpe-su | [] [] [] | 10 + gpe-taskmanager | [] [] [] | 10 + gpe-timesheet | [] [] [] [] | 12 + gpe-today | [] [] [] [] [] | 13 + gpe-todo | [] [] [] [] | 12 + gphoto2 | [] [] [] | 11 + gprof | [] [] | 9 + gpsdrive | [] [] | 3 + gramadoir | [] | 5 + grep | [] [] [] [] | 26 + gretl | | 3 + gtick | | 7 + hello | [] [] [] [] [] | 34 + id-utils | [] [] | 12 + indent | [] [] [] [] | 21 + iso_3166 | [] [] [] [] [] [] [] | 27 + iso_3166_1 | [] [] [] | 16 + iso_3166_2 | | 0 + iso_3166_3 | | 2 + iso_4217 | [] [] [] [] [] [] | 24 + iso_639 | | 1 + jpilot | [] [] [] [] [] | 9 + jtag | [] | 2 + jwhois | () [] [] | 11 + kbd | [] [] | 11 + latrine | | 2 + ld | [] [] | 5 + libc | [] [] [] [] | 20 + libgpewidget | [] [] [] [] | 13 + libiconv | [] [] [] [] [] [] [] [] | 27 + lifelines | [] | 2 + lilypond | [] | 3 + lingoteach | | 2 + lingoteach_lessons | () | 0 + lynx | [] [] [] | 14 + m4 | [] [] | 15 + mailutils | | 5 + make | [] [] [] | 16 + man-db | [] | 5 + minicom | | 11 + mysecretdiary | [] [] | 10 + nano | [] [] [] [] | 17 + nano_1_0 | [] [] [] | 17 + opcodes | [] [] | 6 + parted | [] [] [] | 15 + ptx | [] [] | 22 + python | | 0 + radius | | 4 + recode | [] [] [] | 20 + rpm | [] [] | 9 + screem | [] [] | 2 + scrollkeeper | [] [] [] | 15 + sed | [] [] [] [] [] [] | 24 + sh-utils | [] [] | 14 + shared-mime-info | [] [] | 7 + sharutils | [] [] [] [] | 17 + silky | () | 3 + skencil | [] | 6 + sketch | [] | 6 + soundtracker | [] [] | 7 + sp | [] | 3 + tar | [] [] [] [] [] | 24 + texinfo | [] [] [] | 14 + textutils | [] [] [] [] | 16 + tin | | 1 + tp-robot | | 2 + tuxpaint | [] [] [] [] [] | 29 + unicode-han-tra... | | 0 + unicode-transla... | | 2 + util-linux | [] [] | 15 + vorbis-tools | | 8 + wastesedge | | 0 + wdiff | [] [] [] | 18 + wget | [] [] [] [] [] [] [] [] | 24 + xchat | [] [] [] [] [] | 15 + xfree86_xkb_xml | [] [] [] [] [] | 11 + xpad | | 5 + +-----------------------------------------------------+ + 63 teams sk sl sr sv ta th tr uk ven vi wa xh zh_CN zh_TW zu + 131 domains 47 19 28 83 0 0 59 13 1 1 11 0 22 22 0 1373 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 @@ -599,7 +742,7 @@ 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 May 2003 seems to be old, you may fetch a more recent copy of + If January 2004 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'. @@ -607,7 +750,7 @@ matrix with full percentage details can be found at Using `gettext' in new packages =============================== - If you are writing a freely available program and want to +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 diff --git a/ChangeLog b/ChangeLog index 147752997..c7cf862b2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,785 @@ +Mon Aug 2 12:18:15 2004 Arnold D. Robbins + + * Release 3.1.4: Release tar file made. + +Mon Aug 2 12:17:40 2004 Arnold D. Robbins + + * configure.ac: Fix the hack. Do the sed on `Makefile', + not `Makefile.in'. Sigh. + +Sun Aug 1 14:48:30 2004 Arnold D. Robbins + + * configure.ac: MAJOR HACK: At end, remove version.c from Makefile.in + variable `CONFIG_CLEAN_FILES' so that `make distclean' doesn't + remove version.c. + +Mon Jul 19 17:07:27 2004 Arnold D. Robbins + + * config.guess, config.sub: Updated from Savannah CVS. + +Fri Jul 16 10:59:07 2004 Arnold D. Robbins + + * re.c (make_regexp): Bracket code using `gawk_mb_cur_max' + inside `#ifdef MBS_SUPPORT'. + +Thu Jul 15 12:36:25 2004 Arnold D. Robbins + + * dfa.c (parse_bracket_exp_mb): If doing case folding, + include the other case for regular characters inside [...]. + + * re.c (make_regexp): Smarten up handling of IGNORECASE, + particularly for multibyte character sets. Sigh. + +Wed Jul 14 16:25:23 2004 John Haque + + * eval.c (interpret): For `Node_K_return', use `copynode' + and not `dupnode' for non-PERM, non-TEMP values. + (func_call): Don't add TEMP flag to returned value. + + These two fix a problem uncovered by the July 8 change in + `assoc_lookup'. + +Wed Jul 14 16:14:09 2004 Arnold D. Robbins + + * awkgram.y (node_common): Add check `lexeme >= lexptr_begin', + from valgrind run. + +Wed Jul 14 16:00:51 2004 John Haque + + * io.c (rsrescan): Fix off by one error at end of record. + +Thu Jul 8 16:59:51 2004 Stepan Kasal + + * awkgram.y (output_redir): Make sure not to dereference NULL + pointer. The bug was triggered by the following code: + + gawk 'BEGIN{print "date" |& getline}' + + No test case created, beacuse of the following: + Correct interpretation involves executing "1" or "0" -- as the user + may have defined this, we would have to override this in the test + script. It's not worth the hassle. + +Thu Jul 8 12:59:49 2004 Arnold D. Robbins + + * awk.h (load_casetable): Name changed from `load_ignorecase'. + * eval.c (load_casetable): Name changed from `load_ignorecase'. + Fix all uses. + +Thu Jul 8 12:32:13 2004 John Haque + + * awkgram.y (get_src_buf): Fix off-by-one error to avoid "does not end + in newline" messages. + * array.c (assoc_lookup): Small performance hack: for TEMP subs nodes, + use its string memory for ahname. + * ext.c (get_actual_argument): Minor code cleanup. + * builtin.c (do_lshift, do_rshift, do_and, do_or, do_xor, do_compl): + fixed to issue "non-numeric argument" lint warnings before using + `force_number'. + +Mon Jun 21 16:53:35 2004 Arnold D. Robbins + + More changes from John Haque to rationalize extension functions. + + * awk.h (get_curfunc_arg_count): Name changed from + `get_curfunc_parm_count'. + * eval.c (get_curfunc_arg_count): Ditto, body redone to count actual + args passed at call time. + * ext.c (get_argument): Update range check. + (get_actual_argument): Simplify the code. + +Mon Jun 14 14:01:16 2004 Arnold D. Robbins + + Changes from John Haque and ADR to rationalize extension functions. + + * awk.h (check_special, get_curfunc_parm_count, get_actual_argument): + new function declarations. + (get_scalar_argument, get_array_argument): new macros. + * awkgram.y (check_special): new function. + (yylex): Use `check_special' to search `tokentab'. + (dump_funcs): Always count functions, in order to get dynamic ones. + Removed bogus use of `static' on `tab' variable. + * eval.c (struct fcall): Change type of `count' to `size_t'. + (get_curfunc_parm_count): New function. + (push_args): Set `r->rnode' to NULL for local variable. + * ext.c (make_builtin): Add sanity checking for presence and + name of new function, and that it's not a redefinition. + (get_argument): Check that requested arg is within range of actual + number of parameters. Also clean up logic for Node_var_new, + Node_var_array, Node_array_ref. + (get_actual_argument): New function. + * profile.c (pp_builtin): Better handling of dynamic extension function. + +Sun Jun 13 14:32:22 2004 Arnold D. Robbins + + * io.c (redirect): Conditionalize checking for process recovery + on `#ifdef PIPES_SIMULATED'. Needed for MS-DOS and VMS. + * builtin.c (tmp_integer): Change bracketing of magic test to + `#ifdef HAVE_UINTMAX_T' which is more general and more correct. + +Wed Jun 9 21:36:01 2004 Arnold D. Robbins + + * re.c (make_regexp): Add dfa matching into IGNORECASE handling. + +Tue Jun 8 15:38:56 2004 Arnold D. Robbins + + * awk.h (casetable): Remove `const'. + * eval.c (casetable): Remove `const'. + (load_ignorecase): New function. Loads locale-correct values in + upper 128 bytes. + (set_IGNORECASE): Call `load_ignorecase'. + +Tue Jun 8 14:04:19 2004 Arnold D. Robbins + + * awkgram.y (get_src_buf): Make sure that value from + `optimal_bufsize' is reasonable. Increase it if not. + +Tue Jun 8 13:54:28 2004 John E. Haque + + * awkgram.y (statement:LEX_FOR): Fix bug in loop to `delete a' + optimization. + * io.c (format_tree): Check for out of range values for + positional specifiers. + +Mon Jun 7 17:02:48 2004 Arnold D. Robbins + + * builtin.c (tmp_integer): Bracket the magic test inside + `#ifndef VMS'. + + * awk.h (child_catcher): Remove declaration. + * main.c (main): Remove `signal' calls for SIGCLD, SIGCHLD. + * io.c (child_died, child_signo, child_catcher): Removed. + (get_a_record): Remove code checking for death of child. + (redirect): If `rp' matches and is at EOF and type is input + pipe, and `rp->pid' is not -1, call `wait_any' to reap the + child. This is a heuristic, but it works pretty well. + +Sun Jun 6 18:35:17 2004 Arnold D. Robbins + + * io.c (get_a_record): Restore use of `memmove' instead of + memcpy. Otherwise some tests break on some systems. We think. + (child_died): Don't reset signal handler; breaks on some S5 systems. + (get_a_record): Reset handler if child_died. Still flaky on Solaris. + * configure.ac (version.c): Made from version.in again, for + non-Unix systems. + * Makefile.am (base_sources): Add version.c back. + * version.in: Include config.h for definition of const. + * main.c (version_string): Add back declaration, don't + include "version.i". + (main): Don't install child_catcher on Sun. (HACK) + +Thu Jun 3 14:06:06 2004 Arnold D. Robbins + + * main.c (version_string): Removed declaration, since + version.i is included directly. + * version.in: Removed test for definition of const. + +Tue Jun 1 19:23:53 2004 Stepan Kasal + + * Makefile.am (base_sources): Don't mention version.c, so that + it doesn't get distributed. + * po/POTFILES.in: remove version.c + * configure.ac: Create version.i from version.in. + * main.c: include version.i. + +Tue Jun 1 18:33:32 2004 Arnold D. Robbins + + Fix problem reported by Stephen Marchant + on Thu, 30 Oct 2003 13:11:42 -0500. + + * regex_internal.h (re_realloc): Allow for SunOS pre-Standard C + `realloc' which doesn't accept NULL pointers. + * awk.h (erealloc): Same. + + Unrelated. Change suggested by Peter Sobisch , have + PROCINFO["version"] be the version of gawk: + + * main.c (load_procinfo): Add in version. + + Unrelated: Avoid warning: + + * main.c (main): Cast calls to `bindtextdomain' and `textdomain' to + void. Avoids diagnostic with `configure --disable-nls'. + * dfa.c (check_matching_with_multibyte_ops): Remove unneeded nested + #ifdef, per Scott Deifik (scottd@amgen.com). Also fix some spelling + errors in comments. + +Tue Jun 1 18:26:45 2004 Paul Eggert + + Fix a bug reported by Mike Romaniw + to bug-gnu-utils on 2003-09-27: compl(compl(0xf0f)) returned 0xfff + on hosts with 64-bit uintmax_t and 64-bit IEEE-764 double, due to + rounding errors. + + * doc/gawk.texi (Bitwise Functions): Leading nonzero bits are + removed in order to fit the result into a C 'double' without rounding + error. + * builtin.c: Include if available. + (FLT_RADIX, FLT_MANT_DIG, DBL_MANT_DIG): Define if not already defined. + (AWKSMALL_MANT_DIG, AWKNUM_MANT_DIG, AWKNUM_FRACTION_BITS): New macros. + (tmp_integer): New function. + (do_lshift, do_rshift, do_and, do_or, do_xor, do_compl): Use them. + +Tue Jun 1 17:40:47 2004 Stepan Kasal + + * eval.c (push_args): Set var_value to Nnull_string for + local variables. + +Mon May 31 11:49:20 2004 Stepan Kasal + + * replace.c: #undef DEBUG before including mktime.c, it has + different meaning there. + +Mon May 31 08:25:30 2004 Arnold D. Robbins + + * array.c (get_actual): Add extra error message for `delete f' + inside body of function `f'. + +Mon May 3 09:53:34 2004 Arnold D. Robbins + + * Makefile.in, */Makefile.in: Updated to automake 1.8.4. + * config.guess, config.sub: Same. + * aclocal.m4, depcomp, install-sh: Same. + +Mon May 3 09:24:45 2004 Arnold D. Robbins + + * configure.ac: Look for missing `strtoul'. + * replace.c: Include missing_d/stroul.c if not HAVE_STRTOUL. + * io.c (devopen): Use `strtoul' instead of `strtod' for + extracting fd number from "/dev/fd/N". (Thanks to Jim Meyering.) + * field.c (set_FIELDWIDTHS): Use `strtoul' instead of `strtod' + when parsing FIELDWIDTHS values. (Thanks to Jim Meyering.) + +Mon Apr 19 20:12:57 2004 Arnold D. Robbins + + * Makefile.in, */Makefile.in: Updated to automake 1.8.3. + * config.guess, config.sub: Same. + +2004-03-18 Stepan Kasal + + * eval.c (make_scalar): Comment clarification. + + * array.c (get_actual): Remove the condition ``canfatal'' + before ``cant_happen()''; if the data are consistent, we + simply cannot get there with a non-func Node_param_list, + no matter whether we are called via get_array or not. + + * awkgram.y (variable): Make one longer message, to help translators. + +Tue Mar 9 17:34:10 2004 Arnold D. Robbins + + Adapted `gofast' patch from Redhat Enterprise version of grep + to current dfa.c. + + * dfa.c (buf_offset): New variable. + (SKIP_REMAINS_MB_IF_INITIAL_STATE): Modified to use it, don't + free `mblen_buf', `inputwcs'. + (match_anychar, match_mb_charset, transit_state_consume_1char, + transit_state): Use buf_offset in mblen_buf. + (dfaexec): Realloc things instead of free and malloc. + +Thu Mar 4 16:46:55 2004 Arnold D. Robbins + + * configure.ac (AC_FUNC_MBRTOWC): Added. + (AC_CHECK_FUNCS): Removed `mbrtwoc'. + (REGEX_MALLOC): Removed. Not needed for new regex* routines. + + * re.c (research): Removed comment and check for return of -2 + since that was for old regex using alloca or REGEX_MALLOC. + +Wed Mar 3 17:10:16 2004 Arnold D. Robbins + + * io.c (close_one): Don't close stdout or stderr; can happen if + /dev/stdout or /dev/stderr are used in redirection and all the + open files get used. + +Sun Feb 29 12:17:37 2004 Arnold D. Robbins + + * regcomp.c (build_charclass, build_charclass_op): Change type of + `class_name' parameter to `const char *' from `const unsigned char *' + and adjust callers. + +Thu Feb 26 15:20:22 2004 Arnold D. Robbins + + * awkgram.y (get_src_buf): Rewritten to better manage input and + supplying newlines on command line programs. Fixes problems reading + source files on Cygwin. + + Unrelated fixes from mary1john8@earthlink.net: + + * node.c (format_val): For no malloc case, free s->stptr if necessary. + * io.c (nextfile): Add missing call to `unref(FILENAME_node->var_value)' + for no files case. + (close_redir): Remove file from redirection list even if fp is + stdout or stderr. + +Tue Feb 24 12:11:34 2004 Arnold D. Robbins + + * regex_internal.c (build_wcs_upper_buffer): Enclose `offsets_needed' + label in `#ifdef _LIBC' to silence `unused label' compiler warning. + +Tue Feb 24 11:57:18 2004 Nelson H.F. Beebe + + * regcomp.c (parse_expression): Add cast to (unsigned char *) in calls + to `build_charclass_op'. + * regex_internal.c (build_wcs_buffer): Add cast to char* in call to + `wcrtomb'. + * regex_internal.h (bitset_not, bitset_merge, bitset_not_merge, + bitset_mask, re_string_char_size_a, re_string_wchar_at, + re_string_elem_size_at): Change to use prototypes. + (re_string_char_size_at, re_string_wchar_at, re_string_elem_size_at): + Declare as `internal_function'. + + * Makefile.am: Add rule to make .i files. This assists in debugging. + * awk.h (m_tree_eval): Add casts to NULL. (Some compilers are just + dumb. ADR) + +Mon Feb 23 15:58:39 2004 Arnold D. Robbins + + Clean up occupied process slots of children that have died: + + * awk.h (child_catcher): New function, declare it. + * main.c (main): Catch SIGCHLD/SIGCLD with `child_catcher'. + * io.c (child_died): New static variable. + (child_catcher): New function, sets `child_died', reinstalls self + as signal handler. + (close_rp): New function: isolates actual fp/iop closing logic. + (close_redir): Call `close_rp'. + (get_a_record): Check `child_died' and call `wait_any(0)' if so. + Add descriptive comment. + + Unrelated clean up: + + * eval.c (fcalls): Renamed from `fcall_list'. All uses changed. + (pop_fcall, push_args, dump_fcall_stack): Adjusted to use indexing + on `fcalls' instead of a pointer into it. Avoids hassles if `fcalls' + is realloc-ed during recursive tree_evals. Thanks to BWK. + + * config.guess, config.sub: Updated from Savannah. + +2004-02-19 gettextize + + * configure.ac (AM_GNU_GETTEXT_VERSION): Bump to 0.14.1. + +Wed Feb 18 12:40:09 2004 Arnold D. Robbins + + * awkgram.y (rule): Use `msg' not `warning' for `must have an + an action part' message. `warning' is wrong, since it's a real error. + +Mon Feb 16 12:17:39 2004 Arnold D. Robbins + + * main.c, eval.c, builtin.c: Change test for `#ifdef HAVE_LOCALE_H' + to `#if ENABLE_NLS && defined(HAVE_LOCALE_H)' so that builds with + `configure --disable-nls' will actually work on non-glibc systems. + +Thu Feb 12 02:05:34 2004 Stepan Kasal + + Lots of misc changes from Stepan Kasal integrated. + + * array.c: Various variables and parameters of static functions + changed from int to long, in order to prevent overflow. + + * eval.c (make_scalar): New function; takes care of everything + that has to be done when a node of type Node_var_new or + Node_array_ref changes to a scalar variable. + (tree_eval, get_lhs): Call it. + (tree_eval): From now on, tree_eval(NULL) doesn't work; + it reports an internal error. + * awk.h (m_tree_eval): Likewise for the two macro versions. + * awkgram.y (statement): Make sure the Node_K_return's lnode is + always the return value, never NULL. + + * Makefile.am (install-exec-hook, uninstall-links): Make use of + $(VERSION). + (INCLUDES): Renamed to AM_CPPFLAGS. + (AM_CPPFLAGS): The file libintl.h is generated in the + build subdirectory intl, not in the directory $(srcdir)/intl. + (diffout): New target is an alias for ``make -C test diffout.'' + * awklib/Makefile.am (INCLUDES): Renamed to AM_CPPFLAGS. + + * README_d/README.hpux: Change the whitespace in the appended patch, + so that it applies to the current source. + * posix/gawkmisc.c: Change a tab to a space (needed for the above). + + Make version control more in the style of current autotools: + + * configure.ac: Remove obsolete versions of macros: + AM_INIT_AUTOMAKE doesn't need any parameters. + AC_OUTPUT shouldn't have any parameters either. + Its parameters go to a new macro: AC_CONFIG_FILES. + AC_CONFIG_HEADERS moved near the end of the file. + * configure.ac: Add [version.c:version.in] to AC_CONFIG_FILES + * version.in: Modify for autoconf substitutions. + * version.c: Remove, it's generated at configure time now. + * fixvers, patchlev.h, unsupported/tandem/ptchlvl.h: Nuke and ... + * Makefile.am, main.c: ... forget them. + +Mon Feb 9 12:57:00 2004 Arnold D. Robbins + + * awk.h builtin.c eval.c field.c (HUGE): Changed to `UNLIMITED'. + Avoids possible conflict with constant in svid-mode math.h. Thanks to + Roman.Putanowicz@iecn.u-nancy.fr for pointing out the problem. + +Fri Feb 6 12:09:55 2004 Arnold D. Robbins + + * configure.ac: Check for `wctype', `wcscoll' and `iswctype'. + * mbsupport.h: New file. Merges and centralizes testing for MBS support. + * Makefile.am (base_sources): Add mbsupport.h to list. + * dfa.c, dfa.h, awk.h (MBS_SUPPORT): Include "mbsupport.h" and use the + test there. + * regex_internal (RE_ENABLE_I18N): Same. + + * Makefile.am (CLEANFILES): Added. + +Thu Feb 5 18:05:12 2004 Arnold D. Robbins + + * configure.ac (HAVE_WCTYPE_T): New test code added. + * dfa.h (wctype_t): Define if system doesn't. Needed here too + for other files that include dfa.h. + * dfa.c (wctype_t): Define if system doesn't. + (lex): Manually fill in arrays used for char class range testing + so will work on c89 and older compilers. + (parse_bracket_exp_mb): Split up an assignment to avoid type complaints. + + * main.c (main): When checking for `close_io' failure, only set + `exit_val' to 1 if not already exiting. + + * regcomp.c (regerror): Remove use of mempcpy. Generates too + many compiler warning. + * configure.ac (AC_CHECK_FUNCS): Don't bother checking for it. + +Wed Feb 4 17:34:47 2004 Arnold D. Robbins + + * getopt.h (__THROW): Only define it if C++. The __GNU_PREREQ + macro is a major headache. + +2004-02-02 Paolo Bonzini + + * regexec.c (check_matching): Add P_MATCH_FIRST parameter. + (re_search_internal): Pass new parameter to check_matching. + (check_matching): Unless a parenthesized group is found at the + beginning of the regexp, advance P_MATCH_FIRST until we entered + a state different from the initial state. + +Mon Feb 2 15:52:37 2004 Arnold D. Robbins + + * re.c (research): Change last param to re_search to pass + NULL if `need_start' is false. May give us a marginal speed gain. + +Thu Jan 29 17:04:51 2004 Arnold D. Robbins + + * builtin.c (sub_common): Fix logic for `&' in replacement for + multibyte case. Simplify code a bit. + +Tue Jan 20 10:41:45 2004 Arnold D. Robbins + + * configure.ac: Add check for `memmove'. + * replace.c: Include missing_d/memmove.c if don't have `memmove'. + +Sun Jan 18 12:01:29 2004 Arnold D. Robbins + + * builtin.c (sub_common): Add comment and support for 2001 POSIX + behavior when --posix in effect. The masses have been + clamoring for this one. + +2004-01-16 gettextize + + * configure.ac (AM_GNU_GETTEXT_VERSION): Bump to 0.13.1. + * intl/*: Updated to 0.13.1. + +Fri Jan 16 08:16:38 2004 Arnold D. Robbins + + * getopt.h, getopt.c, getopt1.c: Synced to GLIBC version: + getopt.c: 1.51 + getopt.h: 1.18 + getopt1.c: 1.9 + +Thu Jan 15 15:28:48 2004 Arnold D. Robbins + + Here we go again: + + * regcomp.c, regex.h, regex.c, regex_internal.h, regex_internal.c, + regexec.c: Sync to GLIBC version, but with bug fixes. GLIBC + CVS versions: + + regcomp.c: 1.76 + regexec.c: 1.55 + regex.c: 1.125 + regex.h: 1.30 + regex_internal.c: 1.39 + regex_internal.h: 1.45 + regexec.c: 1.55 + + * acinclude.m4: Removed, not needed for automake 1.8.x. + * configure.ac: Updated to autoconf 2.59. + + Everything else updated to automake 1.8x and autoconf 2.59. + +Wed Jan 14 14:26:36 2004 Arnold D. Robbins + + * dfa.c, dfa.h: Updated manually with most of the changes in + grep 2.5.1. That version lost the ability to match newlines + in the data, so the merge had to be done by hand. Sigh. + +2004-01-12 Paolo Bonzini + + ALLOCA patch from + http://sources.redhat.com/ml/libc-alpha/2004-01/msg00099.html + added. + + * regcomp.c [_LIBC && !RE_ENABLE_I18N]: + Drop code to support this, it is never true. + (build_range_exp) [!_LIBC]: Do not create a range + in MBCSET for a single-byte character set. + (build_range_exp) [_LIBC]: Do not create a range + in MBCSET for a single-byte character set without + collation elements. + (init_dfa): Do not conditionalize on _LIBC, it + just makes the code less clear. + (parse_bracket_exp): Use NON_MATCH variable in + addition to "mbcset->non_match", not as an + alternative. + (build_charclass_op): rename NOT parameter to + NON_MATCH, use it instead of declaring a variable. + (parse_bracket_exp) [!_LIBC]: Pass NULL for MBCSET + if the character set is single-byte. + +Wed Jan 7 15:23:04 2004 Arnold D. Robbins + + * awkgram.y (mk_rexp): Set n->re_cnt to 1. Makes reinstated + dfa code actually take effect! Don't know how I missed this. + + Unrelated: sync regex code to glibc. + + * regcomp.c, regex.h, regex.c, regex_internal.h, regex_internal.c, + regexec.c: Sync to GLIBC version, but with bug fixes. GLIBC + CVS versions: + + regcomp.c: 1.74 + regex.c: 1.124 + regex.h: 1.30 + regex_internal.c: 1.39 + regex_internal.h: 1.43 + regexec.c: 1.55 + + * regcomp.c (peek_token): Temporarily, we hope, disable \s and \S + operators. Too much trouble to document right now. + * dfa.c (lex): Add code for \s and \S but disable it until + next release. + +Wed Dec 24 15:28:57 2003 Arnold D. Robbins + + * eval.c (r_tree_eval): For Node_assign_concat, add + call `free_temp(r)'. Thanks to mary1john8@earthlink.net. + +Mon Dec 1 10:25:52 2003 Arnold D. Robbins + + CONSTVAL not needed if we test PERM instead. Thanks to + mary1john8@earthlink.net. See test/concat3.awk. + + * awk.h [CONSTVAL]: Removed. + * eval.c (flag2str): Removed CONSTVAL from table. + (r_tree_eval): For Node_assign_concat, it's enough to check + if l->flags has PERM clear. + * awkgram.y (yylex): Removed use of CONSTVAL for YSTRING and YNUMBER. + +Mon Nov 3 16:33:26 2003 Arnold D. Robbins + + * awkgram.y (get_src_buf): Replace `memmove' with `memcpy' for + marginal portability gain to older systems. + * io.c (get_a_record): Ditto. + +Sun Nov 2 15:59:27 2003 Arnold D. Robbins + + * awk.h [CONSTVAL]: Renamed from `STRCONST'. + * eval.c (flags2str): Fix in table. + (r_tree_eval): For Node_assign_concat, check for the flag for + both left and right hand sides. Also add a `force_string' call + for the right hand side and the left hand side. + * awkgram.y (yylex): Change flag value for YSTRING and add use + of flag for YNUMBER. + +Wed Oct 29 14:23:29 2003 Arnold D. Robbins + + * awk.h [STRCONST]: New flag value. + * eval.c (flags2str): Add it to table. + (r_tree_eval): For Node_assign_concat, check for the flag so that + we don't clobber string constants given: + s = "" + s = s something + * awkgram.y (yylex): For YSTRING, set STRCONST flag. + +Tue Oct 28 18:00:00 2003 Arnold D. Robbins + + Force SUBSEP to always have a string value. Per bug report + from mary1john8@earthlink.net. + + * awk.h (NODETYPE): New type, Node_SUBSEP. + (set_SUBSEP): Add declaration. + * awkgram.y (isnoeffect, isassignable): Add Node_SUBSPEP case. + * array.c (set_SUBSEP): New function. + * eval.c (nodetypes): Add Node_SUBSEP. + (r_tree_eval, r_get_lhs): Add code for Node_SUBSEP. + * main.c (varinit): Use Node_SUBSEP as type for SUBSEP. + * profile.c (tree_eval, pp_lhs, is_scalar, prec_level): Handle + Node_SUBSEP. + +Tue Oct 7 09:26:33 2003 Arnold D. Robbins + + * awk.h (NODETYPE): New member `Node_assign_concat'. + * awkgram.y (exp): Look for case of `x = x y' and if so, create a + Node_assign_concat. + * eval.c (interpret): Add case for Node_assign_concat. + * profile.c (prec_level): Ditto. + (tree_eval): Ditto. For variables, call new function `vname' to + print name; handles varname field for -v variables, which end up + including the value. + (vname): New function. + +Wed Sep 24 17:32:31 2003 Arnold D. Robbins + + Speed up `avoid_dfa' kludge, at least a little: + + * awk.h (struct Regexp): Add `has_anchor' member. Make it and + `dfa' member shorts; keeps space the same. + * re.c (make_regexp): Set `has_anchor' member correctly. + (avoid_dfa): Test for `has_anchor' member instead of searching + for it each time. + +Sun Sep 21 18:34:32 2003 Arnold D. Robbins + + * builtin.c (state): Only needs to be 256 bytes, initstate() can't + use any more than that. Well whadayaknow. + (do_rand, do_srand): Call `setstate' after calling `initstate'. + +Tue Sep 16 15:44:29 2003 Arnold D. Robbins + + * eval.c (interpret): For Node_K_switch, add kludge_need_start stuff + as used in `match_op'. Sigh. + * re.c (make_regexp): Add `no_dfa' variable, which is true if + GAWK_NO_DFA exists in the environment. This enables run time + testing of things with/without the dfa matcher. + +Mon Sep 15 18:36:38 2003 Arnold D. Robbins + + After much soul searching, reinstated old dfa code. The performance + of the new regex is just disastrous. Sigh. + + * awk.h (re_cnt): Reinstated old definition. + (struct Regexp): Added `dfareg' and `dfa' members. + (make_regexp): New last parameter in function, changed decl. + (avoid_dfa): Added declaration. + * awkgram.y (regexp, mk_rexp): Added use of `re_cnt'. Fixed call + to `make_regexp'. + * Makefile.am: Add dfa.h and dfa.c. + * eval.c (match_op): Complexified: added call to `avoid_dfa' and + `kludge_need_start' variable where used to pass FALSE as last parameter + of research(). + * field.c (set_FS): Fixed call to `make_regexp'. + * io.c (get_a_record, set_RS): Fixed calls to `make_regexp'. + * re.c (make_regexp): Added last paramter (`dfa') to function. + Complexified the code. + (re_update): Fixed call to `make_regexp'. + (research): Complexified the code, added calls to dfa stuff. + (dfaerror): New function. + (re_update): Fixed call to `make_regexp'. + (avoid_dfa): New function. + +Tue Sep 9 15:57:38 2003 Arnold D. Robbins + + * awkgram.y (get_src_buf): Fix calculation of `offset' when shifting + source lines around. In general, improve handling of things when + moving the source code line around. What a mess this code is. + +Mon Sep 8 19:08:55 2003 Arnold D. Robbins + + * eval.c (fmt_ok): Make provision for %F format and printf %'f flag + here too. + +2003-07-23 Christophe Bisiere (tiny change) + + * posix/regex.h (RE_TRANSLATE_TYPE): Define it to "unsigned char," + to avoid problems at hosts with signed char. + * posix/regexec.c (re_search_internal): Don't say + "unsigned RE_TRANSLATE_TYPE." + +Thu Aug 28 11:09:41 2003 Arnold D. Robbins + + * io.c (nextfile): Change use of variable `files' to make it + clearer that it's a boolean flag. + +Tue Aug 26 22:58:15 2003 Arnold D. Robbins + + * io.c (useropen): Add `defined (HAVE_GETGROUPS)' as first test + in `#ifdef'. Brings things in sync with same test in main.c and awk.h. + +Tue Aug 26 22:49:37 2003 Arnold D. Robbins + + * dbug.h: New file. + + * array.c, awkgram.y, builtin.c, eval.c, ext.c, field.c, io.c, + main.c, msg.c, node.c, profile.c, re.c: Converted to use + Fred Fish's `dbug' library. By default compiled out, thus + not affecting speed. + + For the nonce, the `dbug' library itself is not shipped with + gawk, since I expect no-one else but me to be using it. + +Thu Aug 21 23:15:36 2003 Arnold D. Robbins + + * awkgram.y (numfiles): Change extern decl to long, to match what's + in main.c. Keeps things working on 64-bit systems. Thanks to bug + report from Jan Oravec . + +Wed Aug 20 14:53:47 2003 Arnold D. Robbins + + * eval.c (genflags2str): Move test for out-of-space inside test + for is the bit set. + +Mon Aug 11 11:26:51 2003 Arnold D. Robbins + + * regcomp.c (parse_bracket_exp): If `build_charclass' fails, just pass + its value on as the return value. + +Sun Aug 10 16:59:14 2003 Arnold D. Robbins + + * regcomp.c (build_range_exp): Make sure we don't + get WEOF on range characters. + +Tue Aug 5 21:49:32 2003 Arnold D. Robbins + + * array.c (get_actual): In `case Node_param_list' add test for + `&& (symbol->flags & FUNC) == 0' to the if. + +Sun Jul 13 18:28:38 2003 Arnold D. Robbins + + Further bug fix: + + * awkgram.y (variable): Give the new variable an lnode + of Nnull_string if it's not an array, even if it is + a Node_var_new. + +Fri Jul 11 09:32:21 2003 Arnold D. Robbins + + Bug fix: + + * eval.c (r_tree_eval): For Node_array_ref, set + tree->orig_array->var_value to Nnull_string too. + + Unrelated i18n and POSIX change: + + * configure.ac: Add check for local printf supporting %F format. + * awk.h (loc): New variable declaration. + * main.c (loc): Defined. + (main): Call `localeconv' to set loc. + * io.c (format_tree): Add support for printf quote flag, %'d for + decimal formats (not %e, %E), adds thousand separator into value. + +2003-07-10 Paul Eggert + + * io.c (two_way_open): If /bin/sh cannot be executed, exit + with status 126 consistently. + Mon Jul 7 11:01:43 2003 Arnold D. Robbins * Release 3.1.3: Release tar file made. @@ -14,7 +796,7 @@ Mon Jul 7 09:55:49 2003 Arnold D. Robbins d_substr and d_length are NaN, or when 0 < d_length < 1. Be careful when comparing double to SIZE_MAX, as the comparison might return the "wrong" answer when - (double) SIZE_MAX is a number that is not equal to + `(double) SIZE_MAX' is a number that is not equal to SIZE_MAX. (do_gensub): Watch out for HOW values that are out of range or are NaN. @@ -892,7 +1674,7 @@ Fri Nov 1 11:19:01 2002 Arnold D. Robbins * main.c (usage, copyleft, catchsig, nostalgia, version): Mark with ATTRIBUTE_NORETURN. * profile.c (dump_and_exit): Likewise. - + 2002-10-29 Kaveh R. Ghazi * array.c (array_init): Use ISDIGIT, not isdigit. @@ -901,7 +1683,7 @@ Fri Nov 1 11:19:01 2002 Arnold D. Robbins * main.c (lintfunc): Fix !__SDTC__ case. * regex_internal.c (calc_state_hash): Fix inline declaration. * regexec.c (proceed_next_node): Cast assignment to correct type. - + 2002-10-29 Kaveh R. Ghazi * awk.h (exp_node, Func_ptr): Add prototype arguments. @@ -1421,7 +2203,7 @@ Mon Aug 5 10:12:39 2002 Arnold D. Robbins Sun Aug 4 00:37:38 2002 Stepan Kasal - * re.c (make_regexp): don't pass the error message returned by + * re.c (make_regexp): don't pass the error message returned by re_compile_pattern() to gettext(); it's already gettextized. (make_regexp): minor reformat of code. @@ -1812,8 +2594,8 @@ Mon Feb 4 10:38:00 2002 Bruno Haible Sun Feb 3 17:56:20 2002 Bruno Haible - * builtin.c (do_bindtextdomain): Don't free the same variable twice. - * main.c (main): Call setlocale for LC_MESSAGE, to make dcgettext + * builtin.c (do_bindtextdomain): Don't free the same variable twice. + * main.c (main): Call setlocale for LC_MESSAGE, to make dcgettext function work on glibc systems. Wed Jan 23 15:03:36 2002 Andreas Buening @@ -2231,7 +3013,7 @@ Mon Jun 25 19:34:24 2001 Arnold D. Robbins not needed anymore. * profile.c (pp_string_fp): Enable printing of non-ascii characters verbatim if variable set. - + Fix memory corruption on SCO for array vars as params changed globally. * awk.h (BECAMEARRAY): new flag. * array.c (assoc_lookup): set the flag as appropriate. @@ -2476,7 +3258,7 @@ Wed Jan 3 16:41:33 2001 Arnold D. Robbins * array.c (assoc_lookup): Turn off PERM also when saving subscript. * builtin.c (sub_common): Turn off PERM also when making private copy of string. - + Add a minor memory cleanup facility (undocumented): * awk.h (do_tidy_mem, release_all_vars): Add declarations. * main.c (do_tidy_mem): Add declaration. @@ -2909,7 +3691,7 @@ Wed Aug 9 10:51:41 2000 Arnold D. Robbins * awk.h, node.c, profile.c: removed exec_count_init variable; code has been cleaned up to not need different values for profiling/not profiling. - + Thu Jul 5 21:10:59 2000 Arnold D. Robbins * eval.c (casetable): Removed the USE_PURE_ASCII stuff; it diff --git a/FUTURES b/FUTURES index ee1858e7d..00e0e28c1 100644 --- a/FUTURES +++ b/FUTURES @@ -30,10 +30,14 @@ In 3.1 Additional manual features: DONE: Document NLS support - DONE: Use a new or improved dfa and/or regex library. + DONE: Add %'d for putting in commas in formatting. For 3.2 ======= + Enable \s, \S in regexes (regcomp.c and dfa.c) and document them. + + Make POSIX 2001 behavior the default for sub/gsub. + Simplify awk.h. Consider moving var_value info into Node_var itself @@ -43,19 +47,19 @@ For 3.2 Look at ISO C 99 printf features. - Add %'d for putting in commas in formatting? - Consider integrating Fred Fish's DBUG library into gawk. Move the loadable modules interface to libtool. Redo the loadable modules interface from the awk level. - Rework management of array index storage. + Rework management of array index storage. (Partially DONE.) A RECLEN variable for fixed-length record input. PROCINFO["RS"] would be "RS" or "RECLEN" depending upon what's in use. + Use a new or improved dfa and/or regex library. + DBM storage of awk arrays. Try to allow multiple dbm packages. Consider removing use of and/or need for the protos.h file. @@ -67,7 +71,6 @@ For 3.2 For 3.3 ======= - ? Have strftime() pay attention to the value of ENVIRON["TZ"] Add a lint check if the return value of a function is used but diff --git a/Makefile.am b/Makefile.am index d1371a004..2d7e285bb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,7 @@ # # Makefile.am --- automake input file for gawk # -# Copyright (C) 2000-2003 the Free Software Foundation, Inc. +# Copyright (C) 2000-2004 the Free Software Foundation, Inc. # # This file is part of GAWK, the GNU implementation of the # AWK Programming Language. @@ -50,7 +50,6 @@ EXTRA_DIST = \ config.sub \ depcomp \ extension \ - fixvers \ m4 \ missing \ missing_d \ @@ -86,6 +85,8 @@ base_sources = \ awkgram.y \ builtin.c \ custom.h \ + dfa.c \ + dfa.h \ ext.c \ field.c \ gawkmisc.c \ @@ -94,10 +95,10 @@ base_sources = \ getopt1.c \ gettext.h \ io.c \ + mbsupport.h \ main.c \ msg.c \ node.c \ - patchlev.h \ protos.h \ random.c \ random.h \ @@ -124,19 +125,28 @@ DEFPATH="\".$(PATH_SEPARATOR)$(awkdatadir)\"" DEFS= -DDEFPATH=$(DEFPATH) -DHAVE_CONFIG_H -DGAWK -DLOCALEDIR="\"$(datadir)/locale\"" -INCLUDES = -I$(srcdir)/intl +AM_CPPFLAGS = -Iintl + +# Get rid of core files when cleaning +CLEANFILES = core core.* # We want hard links for install-exec-hook, below LN= ln -# First, add a link from gawk to gawk-X.Y.Z -# Same for pgawk -# For systems where gawk is awk, add a link to awk +SUFFIXES = .i +.c.i: + $(COMPILE) -E $< > $@ + +# First, add a link from gawk to gawk-X.Y.Z. +# Same for pgawk. +# +# For GNU systems where gawk is awk, add a link to awk. +# (This is done universally, which may not always be right, but +# there's no easy way to distinguish GNU from non-GNU systems.) install-exec-hook: - (fullname=gawk-`./gawk --version | sed 1q | awk '{print $$3}'` ; \ - cd $(DESTDIR)$(bindir); \ - $(LN) gawk $$fullname 2>/dev/null ; \ - $(LN) pgawk p$$fullname 2>/dev/null ; \ + (cd $(DESTDIR)$(bindir); \ + $(LN) gawk$(EXEEXT) gawk-$(VERSION)$(EXEEXT) 2>/dev/null ; \ + $(LN) pgawk$(EXEEXT) pgawk-$(VERSION)$(EXEEXT) 2>/dev/null ; \ if [ ! -f awk$(EXEEXT) ]; \ then $(LN_S) gawk$(EXEEXT) awk$(EXEEXT); \ fi; exit 0) @@ -145,8 +155,7 @@ install-exec-hook: uninstall-links: (cd $(DESTDIR)$(bindir); \ if [ -f awk$(EXEEXT) ] && cmp awk$(EXEEXT) gawk$(EXEEXT) > /dev/null; then rm -f awk$(EXEEXT); fi ; \ - fullname=gawk-`./gawk --version | sed 1q | ./gawk '{print $$3}'` ; \ - rm -f $$fullname p$$fullname; exit 0) + rm -f gawk-$(VERSION)$(EXEEXT) pgawk-$(VERSION)$(EXEEXT); exit 0) uninstall-recursive: uninstall-links @@ -165,15 +174,9 @@ awkgram.c: awkgram.y if cmp -s y.tab.h $*.h; then rm -f y.tab.h; else mv y.tab.h $*.h; fi; \ else :; fi -# These force version and patchlevel to be up to date based -# on what's in configure.ac. No-one else but me should have -# to use them. So there. -patchlev.h: configure.ac - $(srcdir)/fixvers -p - -version.c: configure.ac version.in - $(srcdir)/fixvers -v - # This is for my development & testing. efence: gawk $(CC) $(LDFLAGS) -o gawk $$(ls *.o | grep -v '_p.o$$') $(LIBS) -lefence + +diffout: + @$(MAKE) -C test $@ diff --git a/Makefile.in b/Makefile.in index a75dfce97..0fbd2168d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.7.5 from Makefile.am. +# Makefile.in generated by automake 1.8.5 from Makefile.am. # @configure_input@ -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 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. @@ -17,7 +17,7 @@ # # Makefile.am --- automake input file for gawk # -# Copyright (C) 2000-2003 the Free Software Foundation, Inc. +# Copyright (C) 2000-2004 the Free Software Foundation, Inc. # # This file is part of GAWK, the GNU implementation of the # AWK Programming Language. @@ -37,6 +37,8 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA # +SOURCES = $(gawk_SOURCES) $(pgawk_SOURCES) + srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ @@ -44,7 +46,6 @@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = . - am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 @@ -59,6 +60,104 @@ NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : host_triplet = @host@ +ANSI2KNR = @ANSI2KNR@ +bin_PROGRAMS = gawk$(EXEEXT) pgawk$(EXEEXT) +DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/configh.in \ + $(srcdir)/version.in $(top_srcdir)/configure \ + $(top_srcdir)/intl/Makefile.in ABOUT-NLS AUTHORS COPYING \ + ChangeLog INSTALL NEWS ansi2knr.1 ansi2knr.c awkgram.c \ + config.guess config.rpath config.sub depcomp install-sh \ + missing mkinstalldirs ylwrap +subdir = . +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/arch.m4 \ + $(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/iconv.m4 \ + $(top_srcdir)/m4/intdiv0.m4 $(top_srcdir)/m4/intmax.m4 \ + $(top_srcdir)/m4/intmax_t.m4 $(top_srcdir)/m4/inttypes-pri.m4 \ + $(top_srcdir)/m4/inttypes.m4 $(top_srcdir)/m4/inttypes_h.m4 \ + $(top_srcdir)/m4/lcmessage.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/longdouble.m4 $(top_srcdir)/m4/longlong.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/printf-posix.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/m4/signed.m4 $(top_srcdir)/m4/size_max.m4 \ + $(top_srcdir)/m4/socket.m4 $(top_srcdir)/m4/stdint_h.m4 \ + $(top_srcdir)/m4/strtod.m4 $(top_srcdir)/m4/uintmax_t.m4 \ + $(top_srcdir)/m4/ulonglong.m4 $(top_srcdir)/m4/wchar_t.m4 \ + $(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/m4/xsize.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 configure.status.lineno +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = intl/Makefile version.c +am__installdirs = "$(DESTDIR)$(bindir)" +binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +PROGRAMS = $(bin_PROGRAMS) +am__objects_1 = array$U.$(OBJEXT) awkgram$U.$(OBJEXT) \ + builtin$U.$(OBJEXT) dfa$U.$(OBJEXT) ext$U.$(OBJEXT) \ + field$U.$(OBJEXT) gawkmisc$U.$(OBJEXT) getopt$U.$(OBJEXT) \ + getopt1$U.$(OBJEXT) io$U.$(OBJEXT) main$U.$(OBJEXT) \ + msg$U.$(OBJEXT) node$U.$(OBJEXT) random$U.$(OBJEXT) \ + re$U.$(OBJEXT) regex$U.$(OBJEXT) replace$U.$(OBJEXT) \ + version$U.$(OBJEXT) +am_gawk_OBJECTS = $(am__objects_1) eval$U.$(OBJEXT) \ + profile$U.$(OBJEXT) +gawk_OBJECTS = $(am_gawk_OBJECTS) +gawk_LDADD = $(LDADD) +gawk_DEPENDENCIES = +am_pgawk_OBJECTS = $(am__objects_1) eval_p$U.$(OBJEXT) \ + profile_p$U.$(OBJEXT) +pgawk_OBJECTS = $(am_pgawk_OBJECTS) +pgawk_LDADD = $(LDADD) +pgawk_DEPENDENCIES = +DEFAULT_INCLUDES = -I. -I$(srcdir) -I. +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/array$U.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/awkgram$U.Po ./$(DEPDIR)/builtin$U.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/dfa$U.Po ./$(DEPDIR)/eval$U.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/eval_p$U.Po ./$(DEPDIR)/ext$U.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/field$U.Po ./$(DEPDIR)/gawkmisc$U.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/getopt$U.Po ./$(DEPDIR)/getopt1$U.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/io$U.Po ./$(DEPDIR)/main$U.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/msg$U.Po ./$(DEPDIR)/node$U.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/profile$U.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/profile_p$U.Po ./$(DEPDIR)/random$U.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/re$U.Po ./$(DEPDIR)/regex$U.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/replace$U.Po ./$(DEPDIR)/version$U.Po +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +YACCCOMPILE = $(YACC) $(YFLAGS) $(AM_YFLAGS) +YLWRAP = $(top_srcdir)/ylwrap +SOURCES = $(gawk_SOURCES) $(pgawk_SOURCES) +DIST_SOURCES = $(gawk_SOURCES) $(pgawk_SOURCES) +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-exec-recursive install-info-recursive \ + install-recursive installcheck-recursive installdirs-recursive \ + pdf-recursive ps-recursive uninstall-info-recursive \ + uninstall-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@ AMDEP_FALSE = @AMDEP_FALSE@ @@ -77,7 +176,6 @@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ - DEFS = -DDEFPATH=$(DEFPATH) -DHAVE_CONFIG_H -DGAWK -DLOCALEDIR="\"$(datadir)/locale\"" DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ @@ -88,6 +186,10 @@ EXEEXT = @EXEEXT@ GENCAT = @GENCAT@ GLIBC21 = @GLIBC21@ GMSGFMT = @GMSGFMT@ +HAVE_ASPRINTF = @HAVE_ASPRINTF@ +HAVE_POSIX_PRINTF = @HAVE_POSIX_PRINTF@ +HAVE_SNPRINTF = @HAVE_SNPRINTF@ +HAVE_WPRINTF = @HAVE_WPRINTF@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -160,6 +262,7 @@ libdir = @libdir@ libexecdir = @libexecdir@/awk localstatedir = @localstatedir@ mandir = @mandir@ +mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ @@ -195,7 +298,6 @@ EXTRA_DIST = \ config.sub \ depcomp \ extension \ - fixvers \ m4 \ missing \ missing_d \ @@ -223,9 +325,6 @@ SUBDIRS = \ test -# what to make and install -bin_PROGRAMS = gawk pgawk - # sources for both gawk and pgawk base_sources = \ array.c \ @@ -233,6 +332,8 @@ base_sources = \ awkgram.y \ builtin.c \ custom.h \ + dfa.c \ + dfa.h \ ext.c \ field.c \ gawkmisc.c \ @@ -241,10 +342,10 @@ base_sources = \ getopt1.c \ gettext.h \ io.c \ + mbsupport.h \ main.c \ msg.c \ node.c \ - patchlev.h \ protos.h \ random.c \ random.h \ @@ -255,7 +356,6 @@ base_sources = \ version.in \ version.c - gawk_SOURCES = $(base_sources) eval.c profile.c pgawk_SOURCES = $(base_sources) eval_p.c profile_p.c @@ -265,92 +365,51 @@ awkdatadir = @datadir@/awk # stuff for compiling gawk/pgawk DEFPATH = "\".$(PATH_SEPARATOR)$(awkdatadir)\"" +AM_CPPFLAGS = -Iintl -INCLUDES = -I$(srcdir)/intl +# Get rid of core files when cleaning +CLEANFILES = core core.* # We want hard links for install-exec-hook, below LN = ln -subdir = . -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = config.h -CONFIG_CLEAN_FILES = intl/Makefile -bin_PROGRAMS = gawk$(EXEEXT) pgawk$(EXEEXT) -PROGRAMS = $(bin_PROGRAMS) - -am__objects_1 = array$U.$(OBJEXT) awkgram$U.$(OBJEXT) \ - builtin$U.$(OBJEXT) ext$U.$(OBJEXT) field$U.$(OBJEXT) \ - gawkmisc$U.$(OBJEXT) getopt$U.$(OBJEXT) getopt1$U.$(OBJEXT) \ - io$U.$(OBJEXT) main$U.$(OBJEXT) msg$U.$(OBJEXT) \ - node$U.$(OBJEXT) random$U.$(OBJEXT) re$U.$(OBJEXT) \ - regex$U.$(OBJEXT) replace$U.$(OBJEXT) version$U.$(OBJEXT) -am_gawk_OBJECTS = $(am__objects_1) eval$U.$(OBJEXT) profile$U.$(OBJEXT) -gawk_OBJECTS = $(am_gawk_OBJECTS) -gawk_LDADD = $(LDADD) -gawk_DEPENDENCIES = -gawk_LDFLAGS = -am_pgawk_OBJECTS = $(am__objects_1) eval_p$U.$(OBJEXT) \ - profile_p$U.$(OBJEXT) -pgawk_OBJECTS = $(am_pgawk_OBJECTS) -pgawk_LDADD = $(LDADD) -pgawk_DEPENDENCIES = -pgawk_LDFLAGS = - -DEFAULT_INCLUDES = -I. -I$(srcdir) -I. -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/array$U.Po ./$(DEPDIR)/awkgram$U.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/builtin$U.Po ./$(DEPDIR)/eval$U.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/eval_p$U.Po ./$(DEPDIR)/ext$U.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/field$U.Po ./$(DEPDIR)/gawkmisc$U.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/getopt$U.Po ./$(DEPDIR)/getopt1$U.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/io$U.Po ./$(DEPDIR)/main$U.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/msg$U.Po ./$(DEPDIR)/node$U.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/profile$U.Po ./$(DEPDIR)/profile_p$U.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/random$U.Po ./$(DEPDIR)/re$U.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/regex$U.Po ./$(DEPDIR)/replace$U.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/version$U.Po -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -YACCCOMPILE = $(YACC) $(YFLAGS) $(AM_YFLAGS) -YLWRAP = $(top_srcdir)/ylwrap -DIST_SOURCES = $(gawk_SOURCES) $(pgawk_SOURCES) - -RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \ - ps-recursive install-info-recursive uninstall-info-recursive \ - all-recursive install-data-recursive install-exec-recursive \ - installdirs-recursive install-recursive uninstall-recursive \ - check-recursive installcheck-recursive -DIST_COMMON = README ABOUT-NLS AUTHORS COPYING ChangeLog INSTALL \ - Makefile.am Makefile.in NEWS acinclude.m4 aclocal.m4 ansi2knr.1 \ - ansi2knr.c awkgram.c config.guess config.rpath config.sub \ - configh.in configure configure.ac depcomp install-sh missing \ - mkinstalldirs ylwrap -DIST_SUBDIRS = $(SUBDIRS) -SOURCES = $(gawk_SOURCES) $(pgawk_SOURCES) - +SUFFIXES = .i all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: -.SUFFIXES: .c .o .obj .y - -am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ - configure.lineno -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) +.SUFFIXES: .i .c .o .obj .y +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 -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe) - -$(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) +.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 -$(srcdir)/configure: $(srcdir)/configure.ac $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) - cd $(srcdir) && $(AUTOCONF) -$(ACLOCAL_M4): configure.ac acinclude.m4 m4/arch.m4 m4/codeset.m4 m4/gettext.m4 m4/glibc21.m4 m4/iconv.m4 m4/intdiv0.m4 m4/intmax_t.m4 m4/inttypes-pri.m4 m4/inttypes.m4 m4/inttypes_h.m4 m4/isc-posix.m4 m4/lcmessage.m4 m4/lib-ld.m4 m4/lib-link.m4 m4/lib-prefix.m4 m4/longlong.m4 m4/nls.m4 m4/po.m4 m4/progtest.m4 m4/socket.m4 m4/stdint_h.m4 m4/strtod.m4 m4/uintmax_t.m4 m4/ulonglong.m4 +$(top_srcdir)/configure: $(am__configure_deps) + cd $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) config.h: stamp-h1 @@ -362,26 +421,27 @@ config.h: stamp-h1 stamp-h1: $(srcdir)/configh.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h - -$(srcdir)/configh.in: $(top_srcdir)/configure.ac $(ACLOCAL_M4) +$(srcdir)/configh.in: $(am__configure_deps) cd $(top_srcdir) && $(AUTOHEADER) - touch $(srcdir)/configh.in + 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 $@ -binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +version.c: $(top_builddir)/config.status $(srcdir)/version.in + cd $(top_builddir) && $(SHELL) ./config.status $@ install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(bindir) + 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; \ + echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ + $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ else :; fi; \ done @@ -389,8 +449,8 @@ 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; \ + echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ + rm -f "$(DESTDIR)$(bindir)/$$f"; \ done clean-binPROGRAMS: @@ -403,12 +463,10 @@ pgawk$(EXEEXT): $(pgawk_OBJECTS) $(pgawk_DEPENDENCIES) $(LINK) $(pgawk_LDFLAGS) $(pgawk_OBJECTS) $(pgawk_LDADD) $(LIBS) mostlyclean-compile: - -rm -f *.$(OBJEXT) core *.core + -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c - -ANSI2KNR = @ANSI2KNR@ ansi2knr: ansi2knr.$(OBJEXT) $(LINK) ansi2knr.$(OBJEXT) $(LIBS) ansi2knr.$(OBJEXT): $(CONFIG_HEADER) @@ -422,6 +480,7 @@ mostlyclean-kr: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/array$U.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/awkgram$U.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/builtin$U.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dfa$U.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eval$U.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eval_p$U.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ext$U.Po@am__quote@ @@ -441,36 +500,29 @@ mostlyclean-kr: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/replace$U.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/version$U.Po@am__quote@ -distclean-depend: - -rm -rf ./$(DEPDIR) - .c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< +@am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` array_.c: array.c $(ANSI2KNR) $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/array.c; then echo $(srcdir)/array.c; else echo array.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ awkgram_.c: awkgram.c $(ANSI2KNR) $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/awkgram.c; then echo $(srcdir)/awkgram.c; else echo awkgram.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ builtin_.c: builtin.c $(ANSI2KNR) $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/builtin.c; then echo $(srcdir)/builtin.c; else echo builtin.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +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 $@ eval_.c: eval.c $(ANSI2KNR) $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/eval.c; then echo $(srcdir)/eval.c; else echo eval.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ eval_p_.c: eval_p.c $(ANSI2KNR) @@ -507,15 +559,15 @@ replace_.c: replace.c $(ANSI2KNR) $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/replace.c; then echo $(srcdir)/replace.c; else echo replace.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ version_.c: version.c $(ANSI2KNR) $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/version.c; then echo $(srcdir)/version.c; else echo version.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ -array_.$(OBJEXT) awkgram_.$(OBJEXT) builtin_.$(OBJEXT) eval_.$(OBJEXT) \ -eval_p_.$(OBJEXT) ext_.$(OBJEXT) field_.$(OBJEXT) gawkmisc_.$(OBJEXT) \ -getopt_.$(OBJEXT) getopt1_.$(OBJEXT) io_.$(OBJEXT) main_.$(OBJEXT) \ -msg_.$(OBJEXT) node_.$(OBJEXT) profile_.$(OBJEXT) profile_p_.$(OBJEXT) \ -random_.$(OBJEXT) re_.$(OBJEXT) regex_.$(OBJEXT) replace_.$(OBJEXT) \ -version_.$(OBJEXT) : $(ANSI2KNR) +array_.$(OBJEXT) awkgram_.$(OBJEXT) builtin_.$(OBJEXT) dfa_.$(OBJEXT) \ +eval_.$(OBJEXT) eval_p_.$(OBJEXT) ext_.$(OBJEXT) field_.$(OBJEXT) \ +gawkmisc_.$(OBJEXT) getopt_.$(OBJEXT) getopt1_.$(OBJEXT) io_.$(OBJEXT) \ +main_.$(OBJEXT) msg_.$(OBJEXT) node_.$(OBJEXT) profile_.$(OBJEXT) \ +profile_p_.$(OBJEXT) random_.$(OBJEXT) re_.$(OBJEXT) regex_.$(OBJEXT) \ +replace_.$(OBJEXT) version_.$(OBJEXT) : $(ANSI2KNR) .y.c: - $(SHELL) $(YLWRAP) `test -f '$<' || echo '$(srcdir)/'`$< y.tab.c $@ y.tab.h $*.h y.output $*.output -- $(YACCCOMPILE) + $(SHELL) $(YLWRAP) $< y.tab.c $@ y.tab.h $*.h y.output $*.output -- $(YACCCOMPILE) uninstall-info-am: # This directory's subdirectories are mostly independent; you can cd @@ -577,14 +629,6 @@ ctags-recursive: test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done -ETAGS = etags -ETAGSFLAGS = - -CTAGS = ctags -CTAGSFLAGS = - -tags: TAGS - ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ @@ -593,19 +637,22 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique +tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) configh.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ - if (etags --etags-include --version) >/dev/null 2>&1; then \ + 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 && \ + test ! -f $$subdir/TAGS || \ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ @@ -615,10 +662,11 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) configh.in $(TAGS_DEPENDENCIES) \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$tags$$unique" \ - || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique - + 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) configh.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) @@ -641,24 +689,11 @@ GTAGS: distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = . -distdir = $(PACKAGE)-$(VERSION) - -am__remove_distdir = \ - { test ! -d $(distdir) \ - || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ - && rm -fr $(distdir); }; } - -GZIP_ENV = --best -distuninstallcheck_listfiles = find . -type f -print -distcleancheck_listfiles = find . -type f -print distdir: $(DISTFILES) $(am__remove_distdir) mkdir $(distdir) - $(mkinstalldirs) $(distdir)/intl $(distdir)/po + $(mkdir_p) $(distdir)/. $(distdir)/intl $(distdir)/m4 $(distdir)/po @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ @@ -670,7 +705,7 @@ distdir: $(DISTFILES) dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ @@ -687,13 +722,13 @@ distdir: $(DISTFILES) done list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ - test -d $(distdir)/$$subdir \ - || mkdir $(distdir)/$$subdir \ + test -d "$(distdir)/$$subdir" \ + || mkdir "$(distdir)/$$subdir" \ || exit 1; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$(top_distdir)" \ - distdir=../$(distdir)/$$subdir \ + top_distdir="../$(top_distdir)" \ + distdir="../$(distdir)/$$subdir" \ distdir) \ || exit 1; \ fi; \ @@ -709,11 +744,23 @@ distdir: $(DISTFILES) dist-gzip: distdir $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) - dist-bzip2: distdir $(AMTAR) chof - $(distdir) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) +dist-tarZ: distdir + $(AMTAR) chof - $(distdir) | 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 $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(AMTAR) chof - $(distdir) | bzip2 -9 -c >$(distdir).tar.bz2 @@ -723,8 +770,18 @@ dist dist-all: distdir # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist - $(am__remove_distdir) - GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - + case '$(DIST_ARCHIVES)' in \ + *.tar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - ;;\ + *.tar.bz2*) \ + bunzip2 -c $(distdir).tar.bz2 | $(AMTAR) xf - ;;\ + *.tar.Z*) \ + uncompress -c $(distdir).tar.Z | $(AMTAR) xf - ;;\ + *.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 @@ -745,19 +802,20 @@ distcheck: dist distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ - (cd ../.. && $(mkinstalldirs) "$$dc_destdir") \ + (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-gzip \ - && rm -f $(distdir).tar.gz \ + && $(MAKE) $(AM_MAKEFLAGS) dist \ + && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck $(am__remove_distdir) - @echo "$(distdir).tar.gz is ready for distribution" | \ - sed 'h;s/./=/g;p;x;p;x' + @(echo "$(distdir) archives ready for distribution: "; \ + list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ + sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}' distuninstallcheck: @cd $(distuninstallcheck_dir) \ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ @@ -782,8 +840,9 @@ check: check-recursive all-am: Makefile $(ANSI2KNR) $(PROGRAMS) config.h installdirs: installdirs-recursive installdirs-am: - $(mkinstalldirs) $(DESTDIR)$(bindir) - + for dir in "$(DESTDIR)$(bindir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive @@ -795,15 +854,16 @@ install-am: all-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - INSTALL_STRIP_FLAG=-s \ + 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: - -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @@ -815,13 +875,17 @@ clean-am: clean-binPROGRAMS clean-generic clean-krextra mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -distclean-am: clean-am distclean-compile distclean-depend \ - distclean-generic distclean-hdr distclean-tags + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-hdr distclean-tags dvi: dvi-recursive dvi-am: +html: html-recursive + info: info-recursive info-am: @@ -840,7 +904,9 @@ installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -rf autom4te.cache + -rm -rf $(top_srcdir)/autom4te.cache + -rm -rf ./$(DEPDIR) + -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive @@ -859,35 +925,36 @@ uninstall-am: uninstall-binPROGRAMS uninstall-info-am uninstall-info: uninstall-info-recursive -.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ - check-local clean clean-binPROGRAMS clean-generic clean-krextra \ - clean-recursive ctags ctags-recursive dist dist-all dist-bzip2 \ - dist-gzip distcheck distclean distclean-compile \ - distclean-depend distclean-generic distclean-hdr \ - distclean-recursive distclean-tags distcleancheck distdir \ - distuninstallcheck dvi dvi-am dvi-recursive info info-am \ - info-recursive install install-am install-binPROGRAMS \ - install-data install-data-am install-data-recursive \ - install-exec install-exec-am install-exec-recursive \ - install-info install-info-am install-info-recursive install-man \ - install-recursive install-strip installcheck installcheck-am \ - installdirs installdirs-am installdirs-recursive \ +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \ + check-am check-local clean clean-binPROGRAMS clean-generic \ + clean-krextra clean-recursive ctags ctags-recursive dist \ + dist-all dist-bzip2 dist-gzip dist-shar dist-tarZ dist-zip \ + distcheck distclean distclean-compile distclean-generic \ + distclean-hdr distclean-recursive distclean-tags \ + distcleancheck distdir distuninstallcheck dvi dvi-am html \ + html-am info info-am install install-am install-binPROGRAMS \ + install-data install-data-am install-exec install-exec-am \ + install-info install-info-am install-man install-strip \ + installcheck installcheck-am installdirs installdirs-am \ maintainer-clean maintainer-clean-generic \ maintainer-clean-recursive mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-kr mostlyclean-recursive pdf \ - pdf-am pdf-recursive ps ps-am ps-recursive tags tags-recursive \ - uninstall uninstall-am uninstall-binPROGRAMS uninstall-info-am \ - uninstall-info-recursive uninstall-recursive + pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \ + uninstall-binPROGRAMS uninstall-info-am +.c.i: + $(COMPILE) -E $< > $@ -# First, add a link from gawk to gawk-X.Y.Z -# Same for pgawk -# For systems where gawk is awk, add a link to awk +# First, add a link from gawk to gawk-X.Y.Z. +# Same for pgawk. +# +# For GNU systems where gawk is awk, add a link to awk. +# (This is done universally, which may not always be right, but +# there's no easy way to distinguish GNU from non-GNU systems.) install-exec-hook: - (fullname=gawk-`./gawk --version | sed 1q | awk '{print $$3}'` ; \ - cd $(DESTDIR)$(bindir); \ - $(LN) gawk $$fullname 2>/dev/null ; \ - $(LN) pgawk p$$fullname 2>/dev/null ; \ + (cd $(DESTDIR)$(bindir); \ + $(LN) gawk$(EXEEXT) gawk-$(VERSION)$(EXEEXT) 2>/dev/null ; \ + $(LN) pgawk$(EXEEXT) pgawk-$(VERSION)$(EXEEXT) 2>/dev/null ; \ if [ ! -f awk$(EXEEXT) ]; \ then $(LN_S) gawk$(EXEEXT) awk$(EXEEXT); \ fi; exit 0) @@ -896,8 +963,7 @@ install-exec-hook: uninstall-links: (cd $(DESTDIR)$(bindir); \ if [ -f awk$(EXEEXT) ] && cmp awk$(EXEEXT) gawk$(EXEEXT) > /dev/null; then rm -f awk$(EXEEXT); fi ; \ - fullname=gawk-`./gawk --version | sed 1q | ./gawk '{print $$3}'` ; \ - rm -f $$fullname p$$fullname; exit 0) + rm -f gawk-$(VERSION)$(EXEEXT) pgawk-$(VERSION)$(EXEEXT); exit 0) uninstall-recursive: uninstall-links @@ -916,18 +982,12 @@ awkgram.c: awkgram.y if cmp -s y.tab.h $*.h; then rm -f y.tab.h; else mv y.tab.h $*.h; fi; \ else :; fi -# These force version and patchlevel to be up to date based -# on what's in configure.ac. No-one else but me should have -# to use them. So there. -patchlev.h: configure.ac - $(srcdir)/fixvers -p - -version.c: configure.ac version.in - $(srcdir)/fixvers -v - # This is for my development & testing. efence: gawk $(CC) $(LDFLAGS) -o gawk $$(ls *.o | grep -v '_p.o$$') $(LIBS) -lefence + +diffout: + @$(MAKE) -C test $@ # 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 index 73812f600..889c8e20d 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,58 @@ +Changes from 3.1.3 to 3.1.4 +--------------------------- + +1. Gawk now supports the POSIX %F format, falling back to %f if the local + system printf doesn't handle it. + +2. Gawk now supports the ' flag in printf. E.g., %'d in a locale with thousands + separators includes the thousands separator in the value, e.g. 12,345. + + This has one problem; the ' flag is next to impossible to use on the + command line, without major quoting games. Oh well, TANSTAAFL. + +3. The dfa code has been reinstated; the performance degradation was + just too awful. Sigh. (For fun, use `export GAWK_NO_DFA=1' to + see the difference.) + +4. The special case `x = x y' is now recognized in the grammar, and gawk + now uses `realloc' to append the new value to the end of the existing + one. This can speed up the common case of appending onto a string. + +5. The dfa code was upgraded with most of the fixes from grep 2.5.1, and + the regex code was upgraded with GLIBC as mid-January 2004. The regex + code is faster than it was, but still not as fast as the dfa code, so + the dfa code stays in. The getopt code was also synced to current GLIBC. + +6. Support code upgraded to Automake 1.8.5, Autoconf 2.59, and gettext 0.14.1. + +7. When --posix is in effect, sub/gsub now follow the 2001 POSIX behavior. + Yippee. This is even documented in the manual. + +8. Gawk will now recover children that have died (input pipelines, two-way + pipes), upon detecting EOF from them, thus avoiding filling + up the process table. Open file descriptors are not recovered + (unfortunately), since that could break awk semantics. See the + ChangeLog and the source code for the details. + +9. Handling of numbers like `0,1' in non-American locales ought to + work correctly now. + +10. IGNORECASE is now locale-aware for characters with values above 128. + The dfa matcher is now used for IGNORECASE matches too. + +11. Dynamic function loading is better. The documentation has been improved + and some new APIs for use by dynamic functions have been added. + +12. Gawk now has a fighting chance of working on older systems, + a la SunOS 4.1.x. + +13. Issues with multibyte support on HP-UX are now resolved. `configure' now + disables such support there, since it's not up to what gawk needs. + +14. There are now even more tests in the test suite. + +15. Various bugs fixed; see ChangeLog for the details. + Changes from 3.1.2 to 3.1.3 --------------------------- diff --git a/README b/README index 36871235a..607fef148 100644 --- a/README +++ b/README @@ -1,6 +1,6 @@ README: -This is GNU Awk 3.1.3. It is upwardly compatible with the Bell Labs +This is GNU Awk 3.1.4. It is upwardly compatible with the Bell Labs research version of awk. It is almost completely compliant with the 1993 POSIX 1003.2 standard for awk. (See the note below about POSIX.) diff --git a/README_d/README.hpux b/README_d/README.hpux index 59f875390..78e6f356e 100644 --- a/README_d/README.hpux +++ b/README_d/README.hpux @@ -1,5 +1,40 @@ -Mon, 27 May 2002 17:55:46 +0800 +Wed Jul 28 16:28:42 IDT 2004 +============================ +As of gawk 3.1.4, configure should correctly handle HP-UX and +I18N issues. -- Arnold +-------------------------------------------------------------- +2003-12-10 15:19:38 EST +Michael Elizabeth Chastain + +I built and tested gawk on hppa-hp-hpux11.11 and ia64-hp-hpux11.23. +All the tests in the test suite passed. + +I built with these compilers: + + gcc 3.3.2 + hp ansi C from /opt/ansic/bin + hp aCC from /opt/aCC/bin + +I ran into these problems: + + NLS does not work; configure with --disable-nls. + -D_XOPEN_SOURCE=500 does not work. + Multibyte support is not available. + +To get multibyte support, the following ugly hack might work: +--- gawk-3.1.3.orig/custom.h 2003-06-09 17:45:53.000000000 +0200 ++++ gawk-3.1.3/custom.h 2003-12-17 15:55:04.000000000 +0100 +@@ -101,4 +101,7 @@ + #undef HAVE_TZSET + #define HAVE_TZSET 1 + #define _TZSET 1 ++/* an ugly hack: */ ++#include ++#define HAVE_MBRTOWC 1 + #endif + ------------------------------- +Mon, 27 May 2002 17:55:46 +0800 The network support "|&" may not work under HP-UX 11. An error message appears similar to this: @@ -23,21 +58,21 @@ might work. Xiang Zhao Stepan Kasal ---- gawk-3.1.2-plain/posix/gawkmisc.c Tue Apr 16 13:58:41 2002 -+++ gawk-3.1.2-hpux/posix/gawkmisc.c Fri May 24 11:46:35 2002 -@@ -77,7 +77,13 @@ - * meant for in the first place. - */ +diff -ur gawk-3.1.3.a0/posix/gawkmisc.c gawk-3.1.3.a1/posix/gawkmisc.c +--- gawk-3.1.3.a0/posix/gawkmisc.c Sun May 25 15:26:19 2003 ++++ gawk-3.1.3.a1/posix/gawkmisc.c Fri Jul 11 08:56:03 2003 +@@ -126,7 +126,13 @@ + * meant for in the first place. + */ #ifdef HAVE_ST_BLKSIZE --#define DEFBLKSIZE (stb->st_blksize > 0 ? stb->st_blksize : BUFSIZ) -+ /* -+ * 100k must be enough for everybody, -+ * bigger number means probably a bug in fstat() -+ */ -+#define MAXBLKSIZE 102400 -+#define DEFBLKSIZE (stb->st_blksize > 0 && stb->st_blksize <= MAXBLKSIZE \ -+ ? stb->st_blksize : BUFSIZ) +-#define DEFBLKSIZE (stb->st_blksize > 0 ? stb->st_blksize : BUFSIZ) ++ /* ++ * 100k must be enough for everybody, ++ * bigger number means probably a bug in fstat() ++ */ ++#define MAXBLKSIZE 102400 ++#define DEFBLKSIZE (stb->st_blksize > 0 && stb->st_blksize <= MAXBLKSIZE \ ++ ? stb->st_blksize : BUFSIZ) #else - #define DEFBLKSIZE BUFSIZ + #define DEFBLKSIZE BUFSIZ #endif - diff --git a/README_d/README.pc b/README_d/README.pc index 5022596bc..37ad6679a 100644 --- a/README_d/README.pc +++ b/README_d/README.pc @@ -112,8 +112,7 @@ along with many OS/2 utilities. The djgpp collection at - http://www.simtel.net/simtelnet/gnu/djgpp - ftp://ftp.simtel.net/simtelnet/pub/gnu/djgpp + ftp://ftp.delorie.com/pub/djgpp/current/v2gnu/ contains a djgpp-compiled (32bit) version of gawk, along with many djgpp-compiled utilities. diff --git a/acinclude.m4 b/acinclude.m4 deleted file mode 100644 index 281e3609b..000000000 --- a/acinclude.m4 +++ /dev/null @@ -1,6 +0,0 @@ -m4_sinclude(arch.m4)dnl -m4_sinclude(gettext.m4)dnl -m4_sinclude(lcmessage.m4)dnl -m4_sinclude(progtest.m4)dnl -m4_sinclude(socket.m4)dnl -m4_sinclude(strtod.m4)dnl diff --git a/aclocal.m4 b/aclocal.m4 index ed9406e07..4bac06817 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,6 +1,6 @@ -# generated automatically by aclocal 1.7.5 -*- Autoconf -*- +# generated automatically by aclocal 1.8.5 -*- Autoconf -*- -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 # Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -11,20 +11,9 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. -m4_sinclude(arch.m4)dnl -m4_sinclude(gettext.m4)dnl -m4_sinclude(lcmessage.m4)dnl -m4_sinclude(progtest.m4)dnl -m4_sinclude(socket.m4)dnl -m4_sinclude(strtod.m4)dnl - -# Do all the work for Automake. -*- Autoconf -*- - -# 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. - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. +# -*- Autoconf -*- +# Copyright (C) 2002, 2003 Free Software Foundation, Inc. +# Generated from amversion.in; do not edit by hand. # 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 @@ -39,111 +28,23 @@ m4_sinclude(strtod.m4)dnl # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 10 - -AC_PREREQ([2.54]) - -# Autoconf 2.50 wants to disallow AM_ names. We explicitly allow -# the ones we care about. -m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl - -# 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_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl - AC_REQUIRE([AC_PROG_INSTALL])dnl -# test to see if srcdir already configured -if test "`cd $srcdir && pwd`" != "`pwd`" && - test -f $srcdir/config.status; then - AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) -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 - 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_MISSING_PROG(AMTAR, tar) -AM_PROG_INSTALL_SH -AM_PROG_INSTALL_STRIP -# 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([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 -]) -]) +# 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. +AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.8"]) -# 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. +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION so it can be traced. +# This function is AC_REQUIREd by AC_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], + [AM_AUTOMAKE_VERSION([1.8.5])]) -# 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]) +# AM_AUX_DIR_EXPAND -# Copyright 2002 Free Software Foundation, Inc. +# Copyright (C) 2001, 2003 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 @@ -158,23 +59,56 @@ echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. -# 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. -AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.7"]) +# 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. -# AM_SET_CURRENT_AUTOMAKE_VERSION -# ------------------------------- -# Call AM_AUTOMAKE_VERSION so it can be traced. -# This function is AC_REQUIREd by AC_INIT_AUTOMAKE. -AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], - [AM_AUTOMAKE_VERSION([1.7.5])]) +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` +]) -# Helper functions for option handling. -*- Autoconf -*- -# Copyright 2001, 2002 Free Software Foundation, Inc. +# Copyright (C) 1996, 1997, 1999, 2000, 2001, 2002, 2003 +# 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 @@ -191,36 +125,24 @@ AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. -# serial 2 - -# _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)]) +# serial 3 -# _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)])]) +# This was merged into AC_PROG_CC in Autoconf. -# _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])]) +AU_DEFUN([AM_PROG_CC_STDC], +[AC_PROG_CC +AC_DIAGNOSE([obsolete], [$0: + your code should no longer depend upon `am_cv_prog_cc_stdc', but upon + `ac_cv_prog_cc_stdc'. Remove this warning and the assignment when + you adjust the code. You can also remove the above call to + AC_PROG_CC if you already called it elsewhere.]) +am_cv_prog_cc_stdc=$ac_cv_prog_cc_stdc +]) +AU_DEFUN([fp_PROG_CC_STDC]) -# -# Check to make sure that the build environment is sane. -# +# AM_CONDITIONAL -*- Autoconf -*- -# Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc. +# Copyright (C) 1997, 2000, 2001, 2003 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 @@ -237,261 +159,34 @@ AC_DEFUN([_AM_IF_OPTION], # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. -# 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 +# serial 6 - test "$[2]" = conftest.file - ) -then - # Ok. - : +# 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]) +AC_SUBST([$1_FALSE]) +if $2; then + $1_TRUE= + $1_FALSE='#' else - AC_MSG_ERROR([newly created file is older than distributed files! -Check your system clock]) + $1_TRUE='#' + $1_FALSE= fi -AC_MSG_RESULT(yes)]) - -# -*- Autoconf -*- +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])]) +# serial 7 -*- Autoconf -*- -# Copyright 1997, 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., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 3 - -# 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= - AC_MSG_WARN([`missing' script is too old or missing]) -fi -]) - -# AM_AUX_DIR_EXPAND - -# Copyright 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., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# 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. - -# Rely on autoconf to set up CDPATH properly. -AC_PREREQ([2.50]) - -AC_DEFUN([AM_AUX_DIR_EXPAND], [ -# expand $ac_aux_dir to an absolute path -am_aux_dir=`cd $ac_aux_dir && pwd` -]) - -# AM_PROG_INSTALL_SH -# ------------------ -# Define $install_sh. - -# Copyright 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., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -AC_DEFUN([AM_PROG_INSTALL_SH], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -install_sh=${install_sh-"$am_aux_dir/install-sh"} -AC_SUBST(install_sh)]) - -# AM_PROG_INSTALL_STRIP - -# Copyright 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., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# 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="\${SHELL} \$(install_sh) -c -s" -AC_SUBST([INSTALL_STRIP_PROGRAM])]) - -# -*- Autoconf -*- -# Copyright (C) 2003 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 1 - -# 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])]) - -# serial 5 -*- Autoconf -*- - -# Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 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 @@ -552,18 +247,34 @@ AC_CACHE_CHECK([dependency style of $depcc], # 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. - echo '#include "conftest.h"' > conftest.c - echo 'int i;' > conftest.h - echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf + : > 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) @@ -581,16 +292,22 @@ AC_CACHE_CHECK([dependency style of $depcc], # 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=conftest.c object=conftest.o \ - depfile=conftest.Po tmpdepfile=conftest.TPo \ - $SHELL ./depcomp $depcc -c -o conftest.o conftest.c \ + 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 conftest.h 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 - # (even with -Werror). So we grep stderr for any message - # that says an option was ignored. - if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else + # 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 @@ -624,8 +341,8 @@ AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE(dependency-tracking, -[ --disable-dependency-tracking Speeds up one-time builds - --enable-dependency-tracking Do not reject slow dependency extractors]) +[ --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='\' @@ -636,7 +353,7 @@ AC_SUBST([AMDEPBACKSLASH]) # Generate code to set up dependency tracking. -*- Autoconf -*- -# Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 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 @@ -675,14 +392,14 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue # Extract the definition of DEP_FILES from the Makefile without # running `make'. - DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue # When using ansi2knr, U may be empty or an underscore; expand it - U=`sed -n -e '/^U = / s///p' < "$mf"` + U=`sed -n 's/^U = //p' < "$mf"` test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" # 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 -e ' + for file in `sed -n ' /^DEP_FILES = .*\\\\$/ { s/^DEP_FILES = // :loop @@ -718,9 +435,13 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) -# Check to see how 'make' treats includes. -*- Autoconf -*- +# Do all the work for Automake. -*- Autoconf -*- -# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. +# 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. + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# 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 @@ -737,53 +458,112 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. -# serial 2 +# serial 11 -# 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 +# 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.58])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 +# test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && + test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi -AC_SUBST([am__include]) -AC_SUBST([am__quote]) -AC_MSG_RESULT([$_am_result]) -rm -f confinc confmf + +# 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 + 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_MISSING_PROG(AMTAR, tar) +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([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 +]) ]) -# AM_CONDITIONAL -*- Autoconf -*- -# Copyright 1997, 2000, 2001 Free Software Foundation, Inc. +# 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]) + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. + +# Copyright (C) 2001, 2003 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 @@ -800,120 +580,13 @@ rm -f confinc confmf # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. -# serial 5 - -AC_PREREQ(2.52) - -# AM_CONDITIONAL(NAME, SHELL-CONDITION) -# ------------------------------------- -# Define a conditional. -AC_DEFUN([AM_CONDITIONAL], -[ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], - [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl -AC_SUBST([$1_TRUE]) -AC_SUBST([$1_FALSE]) -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])]) - -# isc-posix.m4 serial 2 (gettext-0.11.2) -dnl Copyright (C) 1995-2002 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -# This file is not needed with autoconf-2.53 and newer. Remove it in 2005. - -# 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"]) - ] -) - -dnl -dnl arch.m4 --- autoconf input file for gawk -dnl -dnl Copyright (C) 1995, 1996, 1998, 1999, 2000, 2003 the Free Software Foundation, Inc. -dnl -dnl This file is part of GAWK, the GNU implementation of the -dnl AWK Progamming Language. -dnl -dnl GAWK 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 GAWK 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 -dnl along with this program; if not, write to the Free Software -dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA -dnl - -dnl Check for AIX and add _XOPEN_SOURCE_EXTENDED -AC_DEFUN(GAWK_AC_AIX_TWEAK, [ -AC_MSG_CHECKING([for AIX compilation hacks]) -AC_CACHE_VAL(gawk_cv_aix_hack, [ -if test -d /lpp -then - CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED=1 -DGAWK_AIX=1" - gawk_cv_aix_hack=yes -else - gawk_cv_aix_hack=no -fi -])dnl -AC_MSG_RESULT([${gawk_cv_aix_hack}]) -])dnl - -dnl Check for Alpha Linux systems -AC_DEFUN(GAWK_AC_LINUX_ALPHA, [ -AC_MSG_CHECKING([for Linux/Alpha compilation hacks]) -AC_CACHE_VAL(gawk_cv_linux_alpha_hack, [ -if test "Linux" = "`uname`" && test "alpha" = "`uname -m`" -then - # this isn't necessarily always true, - # the vendor's compiler is also often found - if test "$GCC" = yes - then - CFLAGS="$CFLAGS -mieee" - gawk_cv_linux_alpha_hack=yes - else - gawk_cv_linux_alpha_hack=no - fi -else - gawk_cv_linux_alpha_hack=no -fi -])dnl -AC_MSG_RESULT([${gawk_cv_linux_alpha_hack}]) -])dnl - +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +install_sh=${install_sh-"$am_aux_dir/install-sh"} +AC_SUBST(install_sh)]) -# Copyright 1996, 1997, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +# -*- Autoconf -*- +# Copyright (C) 2003 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 @@ -930,98 +603,24 @@ AC_MSG_RESULT([${gawk_cv_linux_alpha_hack}]) # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. -# serial 2 +# serial 1 -# @defmac AC_PROG_CC_STDC -# @maindex PROG_CC_STDC -# @ovindex CC -# If the C compiler in not in ANSI C mode by default, try to add an option -# to output variable @code{CC} to make it so. This macro tries various -# options that select ANSI C on some system or another. It considers the -# compiler to be in ANSI C mode if it handles function prototypes correctly. -# -# If you use this macro, you should check after calling it whether the C -# compiler has been set to accept ANSI C; if not, the shell variable -# @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source -# code in ANSI C, you can make an un-ANSIfied copy of it by using the -# program @code{ansi2knr}, which comes with Ghostscript. -# @end defmac - -AC_DEFUN([AM_PROG_CC_STDC], -[AC_REQUIRE([AC_PROG_CC]) -AC_BEFORE([$0], [AC_C_INLINE]) -AC_BEFORE([$0], [AC_C_CONST]) -dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require -dnl a magic option to avoid problems with ANSI preprocessor commands -dnl like #elif. -dnl FIXME: can't do this because then AC_AIX won't work due to a -dnl circular dependency. -dnl AC_BEFORE([$0], [AC_PROG_CPP]) -AC_MSG_CHECKING([for ${CC-cc} option to accept ANSI C]) -AC_CACHE_VAL(am_cv_prog_cc_stdc, -[am_cv_prog_cc_stdc=no -ac_save_CC="$CC" -# Don't try gcc -ansi; that turns off useful extensions and -# breaks some systems' header files. -# AIX -qlanglvl=ansi -# Ultrix and OSF/1 -std1 -# HP-UX 10.20 and later -Ae -# HP-UX older versions -Aa -D_HPUX_SOURCE -# SVR4 -Xc -D__EXTENSIONS__ -for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - AC_TRY_COMPILE( -[#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; -} -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; -], [ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; -], -[am_cv_prog_cc_stdc="$ac_arg"; break]) -done -CC="$ac_save_CC" -]) -if test -z "$am_cv_prog_cc_stdc"; then - AC_MSG_RESULT([none needed]) +# 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 - AC_MSG_RESULT([$am_cv_prog_cc_stdc]) + am__leading_dot=_ fi -case "x$am_cv_prog_cc_stdc" in - x|xno) ;; - *) CC="$CC $am_cv_prog_cc_stdc" ;; -esac -]) - -AU_DEFUN([fp_PROG_CC_STDC], [AM_PROG_CC_STDC]) +rmdir .tst 2>/dev/null +AC_SUBST([am__leading_dot])]) +# Check to see how 'make' treats includes. -*- Autoconf -*- -# Copyright 1996, 1997, 1998, 2000, 2001, 2002 Free Software Foundation, Inc. +# Copyright (C) 2001, 2002, 2003 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 @@ -1040,2142 +639,372 @@ AU_DEFUN([fp_PROG_CC_STDC], [AM_PROG_CC_STDC]) # serial 2 -AC_DEFUN([AM_C_PROTOTYPES], -[AC_REQUIRE([AM_PROG_CC_STDC]) -AC_REQUIRE([AC_PROG_CPP]) -AC_MSG_CHECKING([for function prototypes]) -if test "$am_cv_prog_cc_stdc" != no; then - AC_MSG_RESULT(yes) - AC_DEFINE(PROTOTYPES,1,[Define if compiler has function prototypes]) - U= ANSI2KNR= -else - AC_MSG_RESULT(no) - U=_ ANSI2KNR=./ansi2knr +# 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 -# Ensure some checks needed by ansi2knr itself. -AC_HEADER_STDC -AC_CHECK_HEADERS(string.h) -AC_SUBST(U)dnl -AC_SUBST(ANSI2KNR)dnl +# 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 ]) -AU_DEFUN([fp_C_PROTOTYPES], [AM_C_PROTOTYPES]) - -# gettext.m4 serial 20 (gettext-0.12) -dnl Copyright (C) 1995-2003 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. -dnl -dnl This file can can be used in projects which are not available under -dnl the GNU General Public License or the GNU Library General Public -dnl License but which still want to provide support for the GNU gettext -dnl functionality. -dnl Please note that the actual code of the GNU gettext library is covered -dnl by the GNU Library General Public License, and the rest of the GNU -dnl gettext package package is covered by the GNU General Public License. -dnl They are *not* in the public domain. - -dnl Authors: -dnl Ulrich Drepper , 1995-2000. -dnl Bruno Haible , 2000-2003. - -dnl Macro to add for using GNU gettext. - -dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]). -dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The -dnl default (if it is not specified or empty) is 'no-libtool'. -dnl INTLSYMBOL should be 'external' for packages with no intl directory, -dnl and 'no-libtool' or 'use-libtool' for packages with an intl directory. -dnl If INTLSYMBOL 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). If INTLSYMBOL is 'no-libtool', 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. If NEEDSYMBOL is specified and is -dnl 'need-formatstring-macros', then GNU gettext implementations that don't -dnl support the ISO C 99 formatstring macros will be ignored. -dnl INTLDIR 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 If INTLSYMBOL is 'external', only cases 2 and 3 can occur. -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_GNU_GETTEXT], -[ - dnl Argument checking. - ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], , - [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT -])])])])]) - ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], , - [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT -])])])]) - define(gt_included_intl, ifelse([$1], [external], [no], [yes])) - define(gt_libtool_suffix_prefix, ifelse([$1], [use-libtool], [l], [])) - - AC_REQUIRE([AM_PO_SUBDIRS])dnl - ifelse(gt_included_intl, yes, [ - AC_REQUIRE([AM_INTL_SUBDIR])dnl - ]) - - dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. - AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) - AC_REQUIRE([AC_LIB_RPATH]) - - dnl Sometimes libintl requires libiconv, so first search for libiconv. - dnl Ideally we would do this search only after the - dnl if test "$USE_NLS" = "yes"; then - dnl if test "$gt_cv_func_gnugettext_libc" != "yes"; then - dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT - dnl the configure script would need to contain the same shell code - dnl again, outside any 'if'. There are two solutions: - dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'. - dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE. - dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not - dnl documented, we avoid it. - ifelse(gt_included_intl, yes, , [ - AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) - ]) - - dnl Set USE_NLS. - AM_NLS - - ifelse(gt_included_intl, yes, [ - BUILD_INCLUDED_LIBINTL=no - USE_INCLUDED_LIBINTL=no - ]) - LIBINTL= - LTLIBINTL= - POSUB= - - dnl If we use NLS figure out what method - if test "$USE_NLS" = "yes"; then - gt_use_preinstalled_gnugettext=no - ifelse(gt_included_intl, yes, [ - 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. - - dnl Add a version number to the cache macros. - define([gt_api_version], ifelse([$2], [need-formatstring-macros], 3, ifelse([$2], [need-ngettext], 2, 1))) - define([gt_cv_func_gnugettext_libc], [gt_cv_func_gnugettext]gt_api_version[_libc]) - define([gt_cv_func_gnugettext_libintl], [gt_cv_func_gnugettext]gt_api_version[_libintl]) - - AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc, - [AC_TRY_LINK([#include -]ifelse([$2], [need-formatstring-macros], -[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION -#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) -#endif -changequote(,)dnl -typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; -changequote([,])dnl -], [])[extern int _nl_msg_cat_cntr; -extern int *_nl_domain_bindings;], - [bindtextdomain ("", ""); -return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings], - gt_cv_func_gnugettext_libc=yes, - gt_cv_func_gnugettext_libc=no)]) - - if test "$gt_cv_func_gnugettext_libc" != "yes"; then - dnl Sometimes libintl requires libiconv, so first search for libiconv. - ifelse(gt_included_intl, yes, , [ - AM_ICONV_LINK - ]) - dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL - dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv]) - dnl because that would add "-liconv" to LIBINTL and LTLIBINTL - dnl even if libiconv doesn't exist. - AC_LIB_LINKFLAGS_BODY([intl]) - AC_CACHE_CHECK([for GNU gettext in libintl], - gt_cv_func_gnugettext_libintl, - [gt_save_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $INCINTL" - gt_save_LIBS="$LIBS" - LIBS="$LIBS $LIBINTL" - dnl Now see whether libintl exists and does not depend on libiconv. - AC_TRY_LINK([#include -]ifelse([$2], [need-formatstring-macros], -[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION -#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) -#endif -changequote(,)dnl -typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; -changequote([,])dnl -], [])[extern int _nl_msg_cat_cntr; -extern -#ifdef __cplusplus -"C" -#endif -const char *_nl_expand_alias ();], - [bindtextdomain ("", ""); -return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)], - gt_cv_func_gnugettext_libintl=yes, - gt_cv_func_gnugettext_libintl=no) - dnl Now see whether libintl exists and depends on libiconv. - if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then - LIBS="$LIBS $LIBICONV" - AC_TRY_LINK([#include -]ifelse([$2], [need-formatstring-macros], -[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION -#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) -#endif -changequote(,)dnl -typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; -changequote([,])dnl -], [])[extern int _nl_msg_cat_cntr; -extern -#ifdef __cplusplus -"C" -#endif -const char *_nl_expand_alias ();], - [bindtextdomain ("", ""); -return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)], - [LIBINTL="$LIBINTL $LIBICONV" - LTLIBINTL="$LTLIBINTL $LTLIBICONV" - gt_cv_func_gnugettext_libintl=yes - ]) - fi - CPPFLAGS="$gt_save_CPPFLAGS" - 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-runtime \ - && test "$PACKAGE" != gettext-tools; }; then - gt_use_preinstalled_gnugettext=yes - else - dnl Reset the values set by searching for libintl. - LIBINTL= - LTLIBINTL= - INCINTL= - fi - - ifelse(gt_included_intl, yes, [ - if test "$gt_use_preinstalled_gnugettext" != "yes"; then - dnl GNU gettext is not found in the C library. - dnl Fall back on included 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. - BUILD_INCLUDED_LIBINTL=yes - USE_INCLUDED_LIBINTL=yes - LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV" - LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV" - LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` - fi - - if test "$gt_use_preinstalled_gnugettext" = "yes" \ - || test "$nls_cv_use_gnu_gettext" = "yes"; then - dnl Mark actions to use GNU gettext tools. - CATOBJEXT=.gmo - fi - ]) - - if test "$gt_use_preinstalled_gnugettext" = "yes" \ - || test "$nls_cv_use_gnu_gettext" = "yes"; then - AC_DEFINE(ENABLE_NLS, 1, - [Define to 1 if translation of program messages to the user's native language - is requested.]) - else - USE_NLS=no - fi - fi - - AC_MSG_CHECKING([whether to use NLS]) - AC_MSG_RESULT([$USE_NLS]) - if test "$USE_NLS" = "yes"; then - AC_MSG_CHECKING([where the gettext function comes from]) - if test "$gt_use_preinstalled_gnugettext" = "yes"; then - if test "$gt_cv_func_gnugettext_libintl" = "yes"; then - gt_source="external libintl" - else - gt_source="libc" - fi - else - gt_source="included intl directory" - fi - AC_MSG_RESULT([$gt_source]) - fi - - if test "$USE_NLS" = "yes"; then - - if test "$gt_use_preinstalled_gnugettext" = "yes"; then - if test "$gt_cv_func_gnugettext_libintl" = "yes"; then - AC_MSG_CHECKING([how to link with libintl]) - AC_MSG_RESULT([$LIBINTL]) - AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL]) - fi +# -*- Autoconf -*- - dnl For backward compatibility. Some packages may be using this. - AC_DEFINE(HAVE_GETTEXT, 1, - [Define if the GNU gettext() function is already present or preinstalled.]) - AC_DEFINE(HAVE_DCGETTEXT, 1, - [Define if the GNU dcgettext() function is already present or preinstalled.]) - fi - dnl We need to process the po/ directory. - POSUB=po - fi +# Copyright (C) 1997, 1999, 2000, 2001, 2003 Free Software Foundation, Inc. - ifelse(gt_included_intl, yes, [ - 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-runtime || test "$PACKAGE" = gettext-tools; then - BUILD_INCLUDED_LIBINTL=yes - fi +# 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. - dnl Make all variables we use known to autoconf. - AC_SUBST(BUILD_INCLUDED_LIBINTL) - AC_SUBST(USE_INCLUDED_LIBINTL) - AC_SUBST(CATOBJEXT) +# 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. - dnl For backward compatibility. Some configure.ins may be using this. - nls_cv_header_intl= - nls_cv_header_libgt= +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. - dnl For backward compatibility. Some Makefiles may be using this. - DATADIRNAME=share - AC_SUBST(DATADIRNAME) +# serial 3 - dnl For backward compatibility. Some Makefiles may be using this. - INSTOBJEXT=.mo - AC_SUBST(INSTOBJEXT) +# 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)]) - dnl For backward compatibility. Some Makefiles may be using this. - GENCAT=gencat - AC_SUBST(GENCAT) - dnl For backward compatibility. Some Makefiles may be using this. - if test "$USE_INCLUDED_LIBINTL" = yes; then - INTLOBJS="\$(GETTOBJS)" - fi - AC_SUBST(INTLOBJS) +# 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= + AC_MSG_WARN([`missing' script is too old or missing]) +fi +]) - dnl Enable libtool support if the surrounding package wishes it. - INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix - AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX) - ]) +# AM_PROG_MKDIR_P +# --------------- +# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise. - dnl For backward compatibility. Some Makefiles may be using this. - INTLLIBS="$LIBINTL" - AC_SUBST(INTLLIBS) +# Copyright (C) 2003, 2004 Free Software Foundation, Inc. - dnl Make all documented variables known to autoconf. - AC_SUBST(LIBINTL) - AC_SUBST(LTLIBINTL) - AC_SUBST(POSUB) -]) +# 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. -dnl Checks for all prerequisites of the intl subdirectory, -dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS, -dnl USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL. -AC_DEFUN([AM_INTL_SUBDIR], -[ - AC_REQUIRE([AC_PROG_INSTALL])dnl - AC_REQUIRE([AM_MKINSTALLDIRS])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_REQUIRE([gt_INTDIV0])dnl - AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])dnl - AC_REQUIRE([gt_HEADER_INTTYPES_H])dnl - AC_REQUIRE([gt_INTTYPES_PRI])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 getc_unlocked getcwd getegid \ -geteuid getgid getuid mempcpy munmap putenv setenv setlocale stpcpy \ -strcasecmp strdup strtoul tsearch __argz_count __argz_stringify __argz_next \ -__fsetlocking]) - - AM_ICONV - AM_LANGINFO_CODESET - if test $ac_cv_header_locale_h = yes; then - AM_LC_MESSAGES - fi +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. - 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 +# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories +# created by `make install' are always world readable, even if the +# installer happens to have an overly restrictive umask (e.g. 077). +# This was a mistake. There are at least two reasons why we must not +# use `-m 0755': +# - it causes special bits like SGID to be ignored, +# - it may be too restrictive (some setups expect 775 directories). +# +# Do not use -m 0755 and let people choose whatever they expect by +# setting umask. +# +# We cannot accept any implementation of `mkdir' that recognizes `-p'. +# Some implementations (such as Solaris 8's) are not thread-safe: if a +# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c' +# concurrently, both version can detect that a/ is missing, but only +# one can create it and the other will error out. Consequently we +# restrict ourselves to GNU make (using the --version option ensures +# this.) +AC_DEFUN([AM_PROG_MKDIR_P], +[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then + # Keeping the `.' argument allows $(mkdir_p) to be used without + # argument. Indeed, we sometimes output rules like + # $(mkdir_p) $(somedir) + # where $(somedir) is conditionally defined. + # (`test -n '$(somedir)' && $(mkdir_p) $(somedir)' is a more + # expensive solution, as it forces Make to start a sub-shell.) + mkdir_p='mkdir -p -- .' +else + # On NextStep and OpenStep, the `mkdir' command does not + # recognize any option. It will interpret all options as + # directories to create, and then abort because `.' already + # exists. + for d in ./-p ./--version; + do + test -d $d && rmdir $d + done + # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. + if test -f "$ac_aux_dir/mkinstalldirs"; then + mkdir_p='$(mkinstalldirs)' 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=: + mkdir_p='$(install_sh) -d' fi -]) - +fi +AC_SUBST([mkdir_p])]) -dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version]) -AC_DEFUN([AM_GNU_GETTEXT_VERSION], []) - -# po.m4 serial 1 (gettext-0.12) -dnl Copyright (C) 1995-2003 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. -dnl -dnl This file can can be used in projects which are not available under -dnl the GNU General Public License or the GNU Library General Public -dnl License but which still want to provide support for the GNU gettext -dnl functionality. -dnl Please note that the actual code of the GNU gettext library is covered -dnl by the GNU Library General Public License, and the rest of the GNU -dnl gettext package package is covered by the GNU General Public License. -dnl They are *not* in the public domain. - -dnl Authors: -dnl Ulrich Drepper , 1995-2000. -dnl Bruno Haible , 2000-2003. - -dnl Checks for all prerequisites of the po subdirectory. -AC_DEFUN([AM_PO_SUBDIRS], -[ - AC_REQUIRE([AC_PROG_MAKE_SET])dnl - AC_REQUIRE([AC_PROG_INSTALL])dnl - AC_REQUIRE([AM_MKINSTALLDIRS])dnl - AC_REQUIRE([AM_NLS])dnl - - dnl Perform the following tests also if --disable-nls has been given, - dnl because they are needed for "make dist" to work. - - dnl Search for GNU msgfmt in the PATH. - dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions. - dnl The second test excludes FreeBSD msgfmt. - AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, - [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 && - (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], - :) - AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) - - dnl Search for GNU xgettext 0.12 or newer in the PATH. - dnl The first test excludes Solaris xgettext and early GNU xgettext versions. - dnl The second test excludes FreeBSD xgettext. - AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, - [$ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 && - (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], - :) - dnl Remove leftover from FreeBSD xgettext call. - rm -f messages.po - - dnl Search for GNU msgmerge 0.11 or newer in the PATH. - AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge, - [$ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1], :) - - 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 && - (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then - : ; - else - GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'` - AC_MSG_RESULT( - [found $GMSGFMT program is not GNU msgfmt; ignore it]) - GMSGFMT=":" - fi - fi +# Helper functions for option handling. -*- Autoconf -*- - 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 --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 && - (if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then - : ; - else - AC_MSG_RESULT( - [found xgettext program is not GNU xgettext; ignore it]) - XGETTEXT=":" - fi - dnl Remove leftover from FreeBSD xgettext call. - rm -f messages.po - fi +# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. - 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" - cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" - POMAKEFILEDEPS="POTFILES.in" - # ALL_LINGUAS, POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES depend - # on $ac_dir but don't depend on user-specified configuration - # parameters. - if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then - # The LINGUAS file contains the set of available languages. - if test -n "$OBSOLETE_ALL_LINGUAS"; then - test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" - fi - ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"` - # Hide the ALL_LINGUAS assigment from automake. - eval 'ALL_LINGUAS''=$ALL_LINGUAS_' - POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" - else - # The set of available languages was given in configure.in. - eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS' - fi - case "$ac_given_srcdir" in - .) srcdirpre= ;; - *) srcdirpre='$(srcdir)/' ;; - esac - POFILES= - GMOFILES= - UPDATEPOFILES= - DUMMYPOFILES= - for lang in $ALL_LINGUAS; do - POFILES="$POFILES $srcdirpre$lang.po" - GMOFILES="$GMOFILES $srcdirpre$lang.gmo" - UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" - DUMMYPOFILES="$DUMMYPOFILES $lang.nop" - done - # CATALOGS depends on both $ac_dir and the user's LINGUAS - # environment variable. - INST_LINGUAS= - if test -n "$ALL_LINGUAS"; then - for presentlang in $ALL_LINGUAS; do - useit=no - if test "%UNSET%" != "$LINGUAS"; then - desiredlanguages="$LINGUAS" - else - desiredlanguages="$ALL_LINGUAS" - fi - for desiredlang in $desiredlanguages; 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 - INST_LINGUAS="$INST_LINGUAS $presentlang" - fi - done - fi - CATALOGS= - if test -n "$INST_LINGUAS"; then - for lang in $INST_LINGUAS; do - CATALOGS="$CATALOGS $lang.gmo" - done - fi - test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" - sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" - for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do - if test -f "$f"; then - case "$f" in - *.orig | *.bak | *~) ;; - *) cat "$f" >> "$ac_dir/Makefile" ;; - esac - fi - done - fi - ;; - esac - done], - [# Capture the value of obsolete ALL_LINGUAS because we need it to compute - # POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES, CATALOGS. But hide it - # from automake. - eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"' - # Capture the value of LINGUAS because we need it to compute CATALOGS. - LINGUAS="${LINGUAS-%UNSET%}" - ]) -]) +# 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. -# nls.m4 serial 1 (gettext-0.12) -dnl Copyright (C) 1995-2003 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. -dnl -dnl This file can can be used in projects which are not available under -dnl the GNU General Public License or the GNU Library General Public -dnl License but which still want to provide support for the GNU gettext -dnl functionality. -dnl Please note that the actual code of the GNU gettext library is covered -dnl by the GNU Library General Public License, and the rest of the GNU -dnl gettext package package is covered by the GNU General Public License. -dnl They are *not* in the public domain. - -dnl Authors: -dnl Ulrich Drepper , 1995-2000. -dnl Bruno Haible , 2000-2003. - -AC_DEFUN([AM_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) -]) +# 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. -AC_DEFUN([AM_MKINSTALLDIRS], -[ - 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 it. - MKINSTALLDIRS= - if test -n "$ac_aux_dir"; then - case "$ac_aux_dir" in - /*) MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" ;; - *) MKINSTALLDIRS="\$(top_builddir)/$ac_aux_dir/mkinstalldirs" ;; - esac - fi - if test -z "$MKINSTALLDIRS"; then - MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" - fi - AC_SUBST(MKINSTALLDIRS) -]) +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. -# progtest.m4 serial 3 (gettext-0.12) -dnl Copyright (C) 1996-2003 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. -dnl -dnl This file can can be used in projects which are not available under -dnl the GNU General Public License or the GNU Library General Public -dnl License but which still want to provide support for the GNU gettext -dnl functionality. -dnl Please note that the actual code of the GNU gettext library is covered -dnl by the GNU Library General Public License, and the rest of the GNU -dnl gettext package package is covered by the GNU General Public License. -dnl They are *not* in the public domain. - -dnl Authors: -dnl Ulrich Drepper , 1996. - -# Search path for a program which passes the given test. - -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], -[ -# Prepare PATH_SEPARATOR. -# 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 +# serial 2 -# Find out how to test for executable files. 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 - ac_executable_p="test -x" -else - ac_executable_p="test -f" -fi -rm -f conf$$.file - -# 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. - ;; - *) - ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in ifelse([$5], , $PATH, [$5]); do - IFS="$ac_save_IFS" - test -z "$ac_dir" && ac_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then - if [$3]; then - ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext" - break 2 - fi - fi - done - 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 -]) +# _AM_MANGLE_OPTION(NAME) +# ----------------------- +AC_DEFUN([_AM_MANGLE_OPTION], +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) -# lib-prefix.m4 serial 2 (gettext-0.12) -dnl Copyright (C) 2001-2003 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -dnl From Bruno Haible. - -dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and -dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't -dnl require excessive bracketing. -ifdef([AC_HELP_STRING], -[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])], -[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])]) - -dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed -dnl to access previously installed libraries. The basic assumption is that -dnl a user will want packages to use other packages he previously installed -dnl with the same --prefix option. -dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate -dnl libraries, but is otherwise very convenient. -AC_DEFUN([AC_LIB_PREFIX], -[ - AC_BEFORE([$0], [AC_LIB_LINKFLAGS]) - AC_REQUIRE([AC_PROG_CC]) - AC_REQUIRE([AC_CANONICAL_HOST]) - AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) - dnl By default, look in $includedir and $libdir. - use_additional=yes - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - ]) - AC_LIB_ARG_WITH([lib-prefix], -[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib - --without-lib-prefix don't search for libraries in includedir and libdir], -[ - if test "X$withval" = "Xno"; then - use_additional=no - else - if test "X$withval" = "X"; then - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - ]) - else - additional_includedir="$withval/include" - additional_libdir="$withval/lib" - fi - fi -]) - if test $use_additional = yes; then - dnl Potentially add $additional_includedir to $CPPFLAGS. - dnl But don't add it - dnl 1. if it's the standard /usr/include, - dnl 2. if it's already present in $CPPFLAGS, - dnl 3. if it's /usr/local/include and we are using GCC on Linux, - dnl 4. if it doesn't exist as a directory. - if test "X$additional_includedir" != "X/usr/include"; then - haveit= - for x in $CPPFLAGS; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-I$additional_includedir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test "X$additional_includedir" = "X/usr/local/include"; then - if test -n "$GCC"; then - case $host_os in - linux*) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - if test -d "$additional_includedir"; then - dnl Really add $additional_includedir to $CPPFLAGS. - CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir" - fi - fi - fi - fi - dnl Potentially add $additional_libdir to $LDFLAGS. - dnl But don't add it - dnl 1. if it's the standard /usr/lib, - dnl 2. if it's already present in $LDFLAGS, - dnl 3. if it's /usr/local/lib and we are using GCC on Linux, - dnl 4. if it doesn't exist as a directory. - if test "X$additional_libdir" != "X/usr/lib"; then - haveit= - for x in $LDFLAGS; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test "X$additional_libdir" = "X/usr/local/lib"; then - if test -n "$GCC"; then - case $host_os in - linux*) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - dnl Really add $additional_libdir to $LDFLAGS. - LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir" - fi - fi - fi - fi - fi -]) +# _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)]) -dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix, -dnl acl_final_exec_prefix, containing the values to which $prefix and -dnl $exec_prefix will expand at the end of the configure script. -AC_DEFUN([AC_LIB_PREPARE_PREFIX], -[ - dnl Unfortunately, prefix and exec_prefix get only finally determined - dnl at the end of configure. - if test "X$prefix" = "XNONE"; then - acl_final_prefix="$ac_default_prefix" - else - acl_final_prefix="$prefix" - fi - if test "X$exec_prefix" = "XNONE"; then - acl_final_exec_prefix='${prefix}' - else - acl_final_exec_prefix="$exec_prefix" - fi - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" - prefix="$acl_save_prefix" -]) +# _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)])]) -dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the -dnl variables prefix and exec_prefix bound to the values they will have -dnl at the end of the configure script. -AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX], -[ - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - $1 - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" -]) +# _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])]) -# lib-link.m4 serial 4 (gettext-0.12) -dnl Copyright (C) 2001-2003 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -dnl From Bruno Haible. - -dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and -dnl the libraries corresponding to explicit and implicit dependencies. -dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and -dnl augments the CPPFLAGS variable. -AC_DEFUN([AC_LIB_LINKFLAGS], -[ - AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) - AC_REQUIRE([AC_LIB_RPATH]) - define([Name],[translit([$1],[./-], [___])]) - define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) - AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [ - AC_LIB_LINKFLAGS_BODY([$1], [$2]) - ac_cv_lib[]Name[]_libs="$LIB[]NAME" - ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME" - ac_cv_lib[]Name[]_cppflags="$INC[]NAME" - ]) - LIB[]NAME="$ac_cv_lib[]Name[]_libs" - LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs" - INC[]NAME="$ac_cv_lib[]Name[]_cppflags" - AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) - AC_SUBST([LIB]NAME) - AC_SUBST([LTLIB]NAME) - dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the - dnl results of this search when this library appears as a dependency. - HAVE_LIB[]NAME=yes - undefine([Name]) - undefine([NAME]) -]) -dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode) -dnl searches for libname and the libraries corresponding to explicit and -dnl implicit dependencies, together with the specified include files and -dnl the ability to compile and link the specified testcode. If found, it -dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and -dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and -dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs -dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty. -AC_DEFUN([AC_LIB_HAVE_LINKFLAGS], -[ - AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) - AC_REQUIRE([AC_LIB_RPATH]) - define([Name],[translit([$1],[./-], [___])]) - define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) - - dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME - dnl accordingly. - AC_LIB_LINKFLAGS_BODY([$1], [$2]) - - dnl Add $INC[]NAME to CPPFLAGS before performing the following checks, - dnl because if the user has installed lib[]Name and not disabled its use - dnl via --without-lib[]Name-prefix, he wants to use it. - ac_save_CPPFLAGS="$CPPFLAGS" - AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) - - AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [ - ac_save_LIBS="$LIBS" - LIBS="$LIBS $LIB[]NAME" - AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no]) - LIBS="$ac_save_LIBS" - ]) - if test "$ac_cv_lib[]Name" = yes; then - HAVE_LIB[]NAME=yes - AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.]) - AC_MSG_CHECKING([how to link with lib[]$1]) - AC_MSG_RESULT([$LIB[]NAME]) - else - HAVE_LIB[]NAME=no - dnl If $LIB[]NAME didn't lead to a usable library, we don't need - dnl $INC[]NAME either. - CPPFLAGS="$ac_save_CPPFLAGS" - LIB[]NAME= - LTLIB[]NAME= - fi - AC_SUBST([HAVE_LIB]NAME) - AC_SUBST([LIB]NAME) - AC_SUBST([LTLIB]NAME) - undefine([Name]) - undefine([NAME]) -]) +# Copyright (C) 1996, 1997, 1998, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. -dnl Determine the platform dependent parameters needed to use rpath: -dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator, -dnl hardcode_direct, hardcode_minus_L. -AC_DEFUN([AC_LIB_RPATH], -[ - AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS - AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld - AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host - AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir - AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [ - CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ - ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh - . ./conftest.sh - rm -f ./conftest.sh - acl_cv_rpath=done - ]) - wl="$acl_cv_wl" - libext="$acl_cv_libext" - shlibext="$acl_cv_shlibext" - hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" - hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" - hardcode_direct="$acl_cv_hardcode_direct" - hardcode_minus_L="$acl_cv_hardcode_minus_L" - dnl Determine whether the user wants rpath handling at all. - AC_ARG_ENABLE(rpath, - [ --disable-rpath do not hardcode runtime library paths], - :, enable_rpath=yes) -]) +# 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. -dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and -dnl the libraries corresponding to explicit and implicit dependencies. -dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. -AC_DEFUN([AC_LIB_LINKFLAGS_BODY], -[ - define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) - dnl By default, look in $includedir and $libdir. - use_additional=yes - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - ]) - AC_LIB_ARG_WITH([lib$1-prefix], -[ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib - --without-lib$1-prefix don't search for lib$1 in includedir and libdir], -[ - if test "X$withval" = "Xno"; then - use_additional=no - else - if test "X$withval" = "X"; then - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - ]) - else - additional_includedir="$withval/include" - additional_libdir="$withval/lib" - fi - fi -]) - dnl Search the library and its dependencies in $additional_libdir and - dnl $LDFLAGS. Using breadth-first-seach. - LIB[]NAME= - LTLIB[]NAME= - INC[]NAME= - rpathdirs= - ltrpathdirs= - names_already_handled= - names_next_round='$1 $2' - while test -n "$names_next_round"; do - names_this_round="$names_next_round" - names_next_round= - for name in $names_this_round; do - already_handled= - for n in $names_already_handled; do - if test "$n" = "$name"; then - already_handled=yes - break - fi - done - if test -z "$already_handled"; then - names_already_handled="$names_already_handled $name" - dnl See if it was already located by an earlier AC_LIB_LINKFLAGS - dnl or AC_LIB_HAVE_LINKFLAGS call. - uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` - eval value=\"\$HAVE_LIB$uppername\" - if test -n "$value"; then - if test "$value" = yes; then - eval value=\"\$LIB$uppername\" - test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value" - eval value=\"\$LTLIB$uppername\" - test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value" - else - dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined - dnl that this library doesn't exist. So just drop it. - : - fi - else - dnl Search the library lib$name in $additional_libdir and $LDFLAGS - dnl and the already constructed $LIBNAME/$LTLIBNAME. - found_dir= - found_la= - found_so= - found_a= - if test $use_additional = yes; then - if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then - found_dir="$additional_libdir" - found_so="$additional_libdir/lib$name.$shlibext" - if test -f "$additional_libdir/lib$name.la"; then - found_la="$additional_libdir/lib$name.la" - fi - else - if test -f "$additional_libdir/lib$name.$libext"; then - found_dir="$additional_libdir" - found_a="$additional_libdir/lib$name.$libext" - if test -f "$additional_libdir/lib$name.la"; then - found_la="$additional_libdir/lib$name.la" - fi - fi - fi - fi - if test "X$found_dir" = "X"; then - for x in $LDFLAGS $LTLIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - case "$x" in - -L*) - dir=`echo "X$x" | sed -e 's/^X-L//'` - if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then - found_dir="$dir" - found_so="$dir/lib$name.$shlibext" - if test -f "$dir/lib$name.la"; then - found_la="$dir/lib$name.la" - fi - else - if test -f "$dir/lib$name.$libext"; then - found_dir="$dir" - found_a="$dir/lib$name.$libext" - if test -f "$dir/lib$name.la"; then - found_la="$dir/lib$name.la" - fi - fi - fi - ;; - esac - if test "X$found_dir" != "X"; then - break - fi - done - fi - if test "X$found_dir" != "X"; then - dnl Found the library. - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name" - if test "X$found_so" != "X"; then - dnl Linking with a shared library. We attempt to hardcode its - dnl directory into the executable's runpath, unless it's the - dnl standard /usr/lib. - if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then - dnl No hardcoding is needed. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - else - dnl Use an explicit option to hardcode DIR into the resulting - dnl binary. - dnl Potentially add DIR to ltrpathdirs. - dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. - haveit= - for x in $ltrpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - ltrpathdirs="$ltrpathdirs $found_dir" - fi - dnl The hardcoding into $LIBNAME is system dependent. - if test "$hardcode_direct" = yes; then - dnl Using DIR/libNAME.so during linking hardcodes DIR into the - dnl resulting binary. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - else - if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then - dnl Use an explicit option to hardcode DIR into the resulting - dnl binary. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - dnl Potentially add DIR to rpathdirs. - dnl The rpathdirs will be appended to $LIBNAME at the end. - haveit= - for x in $rpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - rpathdirs="$rpathdirs $found_dir" - fi - else - dnl Rely on "-L$found_dir". - dnl But don't add it if it's already contained in the LDFLAGS - dnl or the already constructed $LIBNAME - haveit= - for x in $LDFLAGS $LIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir" - fi - if test "$hardcode_minus_L" != no; then - dnl FIXME: Not sure whether we should use - dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" - dnl here. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - else - dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH - dnl here, because this doesn't fit in flags passed to the - dnl compiler. So give up. No hardcoding. This affects only - dnl very old systems. - dnl FIXME: Not sure whether we should use - dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" - dnl here. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" - fi - fi - fi - fi - else - if test "X$found_a" != "X"; then - dnl Linking with a static library. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a" - else - dnl We shouldn't come here, but anyway it's good to have a - dnl fallback. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name" - fi - fi - dnl Assume the include files are nearby. - additional_includedir= - case "$found_dir" in - */lib | */lib/) - basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'` - additional_includedir="$basedir/include" - ;; - esac - if test "X$additional_includedir" != "X"; then - dnl Potentially add $additional_includedir to $INCNAME. - dnl But don't add it - dnl 1. if it's the standard /usr/include, - dnl 2. if it's /usr/local/include and we are using GCC on Linux, - dnl 3. if it's already present in $CPPFLAGS or the already - dnl constructed $INCNAME, - dnl 4. if it doesn't exist as a directory. - if test "X$additional_includedir" != "X/usr/include"; then - haveit= - if test "X$additional_includedir" = "X/usr/local/include"; then - if test -n "$GCC"; then - case $host_os in - linux*) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - for x in $CPPFLAGS $INC[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-I$additional_includedir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_includedir"; then - dnl Really add $additional_includedir to $INCNAME. - INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir" - fi - fi - fi - fi - fi - dnl Look for dependencies. - if test -n "$found_la"; then - dnl Read the .la file. It defines the variables - dnl dlname, library_names, old_library, dependency_libs, current, - dnl age, revision, installed, dlopen, dlpreopen, libdir. - save_libdir="$libdir" - case "$found_la" in - */* | *\\*) . "$found_la" ;; - *) . "./$found_la" ;; - esac - libdir="$save_libdir" - dnl We use only dependency_libs. - for dep in $dependency_libs; do - case "$dep" in - -L*) - additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` - dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME. - dnl But don't add it - dnl 1. if it's the standard /usr/lib, - dnl 2. if it's /usr/local/lib and we are using GCC on Linux, - dnl 3. if it's already present in $LDFLAGS or the already - dnl constructed $LIBNAME, - dnl 4. if it doesn't exist as a directory. - if test "X$additional_libdir" != "X/usr/lib"; then - haveit= - if test "X$additional_libdir" = "X/usr/local/lib"; then - if test -n "$GCC"; then - case $host_os in - linux*) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - haveit= - for x in $LDFLAGS $LIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - dnl Really add $additional_libdir to $LIBNAME. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir" - fi - fi - haveit= - for x in $LDFLAGS $LTLIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - dnl Really add $additional_libdir to $LTLIBNAME. - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir" - fi - fi - fi - fi - ;; - -R*) - dir=`echo "X$dep" | sed -e 's/^X-R//'` - if test "$enable_rpath" != no; then - dnl Potentially add DIR to rpathdirs. - dnl The rpathdirs will be appended to $LIBNAME at the end. - haveit= - for x in $rpathdirs; do - if test "X$x" = "X$dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - rpathdirs="$rpathdirs $dir" - fi - dnl Potentially add DIR to ltrpathdirs. - dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. - haveit= - for x in $ltrpathdirs; do - if test "X$x" = "X$dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - ltrpathdirs="$ltrpathdirs $dir" - fi - fi - ;; - -l*) - dnl Handle this in the next round. - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` - ;; - *.la) - dnl Handle this in the next round. Throw away the .la's - dnl directory; it is already contained in a preceding -L - dnl option. - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` - ;; - *) - dnl Most likely an immediate library name. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep" - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep" - ;; - esac - done - fi - else - dnl Didn't find the library; assume it is in the system directories - dnl known to the linker and runtime loader. (All the system - dnl directories known to the linker should also be known to the - dnl runtime loader, otherwise the system is severely misconfigured.) - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name" - fi - fi - fi - done - done - if test "X$rpathdirs" != "X"; then - if test -n "$hardcode_libdir_separator"; then - dnl Weird platform: only the last -rpath option counts, the user must - dnl pass all path elements in one option. We can arrange that for a - dnl single library, but not when more than one $LIBNAMEs are used. - alldirs= - for found_dir in $rpathdirs; do - alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" - done - dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl. - acl_save_libdir="$libdir" - libdir="$alldirs" - eval flag=\"$hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" - else - dnl The -rpath options are cumulative. - for found_dir in $rpathdirs; do - acl_save_libdir="$libdir" - libdir="$found_dir" - eval flag=\"$hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" - done - fi - fi - if test "X$ltrpathdirs" != "X"; then - dnl When using libtool, the option that works for both libraries and - dnl executables is -R. The -R options are cumulative. - for found_dir in $ltrpathdirs; do - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" - done - fi -]) +# 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. -dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR, -dnl unless already present in VAR. -dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes -dnl contains two or three consecutive elements that belong together. -AC_DEFUN([AC_LIB_APPENDTOVAR], -[ - for element in [$2]; do - haveit= - for x in $[$1]; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X$element"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - [$1]="${[$1]}${[$1]:+ }$element" - fi - done -]) +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. -# lib-ld.m4 serial 2 (gettext-0.12) -dnl Copyright (C) 1996-2003 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -dnl Subroutines of libtool.m4, -dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision -dnl with libtool.m4. - -dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no. -AC_DEFUN([AC_LIB_PROG_LD_GNU], -[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld, -[# I'd rather use --version here, but apparently some GNU ld's only accept -v. -if $LD -v 2>&1 &5; then - acl_cv_prog_gnu_ld=yes -else - acl_cv_prog_gnu_ld=no -fi]) -with_gnu_ld=$acl_cv_prog_gnu_ld -]) +# serial 3 -dnl From libtool-1.4. Sets the variable LD. -AC_DEFUN([AC_LIB_PROG_LD], -[AC_ARG_WITH(gnu-ld, -[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], -test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -# Prepare PATH_SEPARATOR. -# 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 -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - AC_MSG_CHECKING([for ld used by GCC]) - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [[\\/]* | [A-Za-z]:[\\/]*)] - [re_direlt='/[^/][^/]*/\.\./'] - # Canonicalize the path of ld - ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` - while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do - ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - AC_MSG_CHECKING([for GNU ld]) -else - AC_MSG_CHECKING([for non-GNU ld]) -fi -AC_CACHE_VAL(acl_cv_path_LD, -[if test -z "$LD"; then - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - acl_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then - test "$with_gnu_ld" != no && break - else - test "$with_gnu_ld" != yes && break - fi - fi - done - IFS="$ac_save_ifs" -else - acl_cv_path_LD="$LD" # Let the user override the test with a path. -fi]) -LD="$acl_cv_path_LD" -if test -n "$LD"; then - AC_MSG_RESULT($LD) +AC_DEFUN([AM_C_PROTOTYPES], +[AC_REQUIRE([AC_C_PROTOTYPES]) +if test "$ac_cv_prog_cc_stdc" != no; then + U= ANSI2KNR= else - AC_MSG_RESULT(no) + U=_ ANSI2KNR=./ansi2knr fi -test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) -AC_LIB_PROG_LD_GNU -]) - -# iconv.m4 serial AM4 (gettext-0.11.3) -dnl Copyright (C) 2000-2002 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -dnl From Bruno Haible. - -AC_DEFUN([AM_ICONV_LINKFLAGS_BODY], -[ - dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. - AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) - AC_REQUIRE([AC_LIB_RPATH]) - - dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV - dnl accordingly. - AC_LIB_LINKFLAGS_BODY([iconv]) -]) - -AC_DEFUN([AM_ICONV_LINK], -[ - dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and - dnl those with the standalone portable GNU libiconv installed). - - dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV - dnl accordingly. - AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) - - dnl Add $INCICONV to CPPFLAGS before performing the following checks, - dnl because if the user has installed libiconv and not disabled its use - dnl via --without-libiconv-prefix, he wants to use it. The first - dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed. - am_save_CPPFLAGS="$CPPFLAGS" - AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV]) - - 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 $LIBICONV" - 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.]) - fi - if test "$am_cv_lib_iconv" = yes; then - AC_MSG_CHECKING([how to link with libiconv]) - AC_MSG_RESULT([$LIBICONV]) - else - dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV - dnl either. - CPPFLAGS="$am_save_CPPFLAGS" - LIBICONV= - LTLIBICONV= - fi - AC_SUBST(LIBICONV) - AC_SUBST(LTLIBICONV) -]) - -AC_DEFUN([AM_ICONV], -[ - AM_ICONV_LINK - if test "$am_cv_func_iconv" = yes; then - 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 -]) - -# glibc21.m4 serial 2 (fileutils-4.1.3, gettext-0.10.40) -dnl Copyright (C) 2000-2002 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -# 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" - ] -) - -# intdiv0.m4 serial 1 (gettext-0.11.3) -dnl Copyright (C) 2002 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -dnl From Bruno Haible. - -AC_DEFUN([gt_INTDIV0], -[ - AC_REQUIRE([AC_PROG_CC])dnl - AC_REQUIRE([AC_CANONICAL_HOST])dnl - - AC_CACHE_CHECK([whether integer division by zero raises SIGFPE], - gt_cv_int_divbyzero_sigfpe, - [ - AC_TRY_RUN([ -#include -#include - -static void -#ifdef __cplusplus -sigfpe_handler (int sig) -#else -sigfpe_handler (sig) int sig; -#endif -{ - /* Exit with code 0 if SIGFPE, with code 1 if any other signal. */ - exit (sig != SIGFPE); -} - -int x = 1; -int y = 0; -int z; -int nan; - -int main () -{ - signal (SIGFPE, sigfpe_handler); -/* IRIX and AIX (when "xlc -qcheck" is used) yield signal SIGTRAP. */ -#if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP) - signal (SIGTRAP, sigfpe_handler); -#endif -/* Linux/SPARC yields signal SIGILL. */ -#if defined (__sparc__) && defined (__linux__) - signal (SIGILL, sigfpe_handler); -#endif - - z = x / y; - nan = y / y; - exit (1); -} -], gt_cv_int_divbyzero_sigfpe=yes, gt_cv_int_divbyzero_sigfpe=no, - [ - # Guess based on the CPU. - case "$host_cpu" in - alpha* | i[34567]86 | m68k | s390*) - gt_cv_int_divbyzero_sigfpe="guessing yes";; - *) - gt_cv_int_divbyzero_sigfpe="guessing no";; - esac - ]) - ]) - case "$gt_cv_int_divbyzero_sigfpe" in - *yes) value=1;; - *) value=0;; - esac - AC_DEFINE_UNQUOTED(INTDIV0_RAISES_SIGFPE, $value, - [Define if integer division by zero raises signal SIGFPE.]) +# 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 ]) -#serial 6 +AU_DEFUN([fp_C_PROTOTYPES], [AM_C_PROTOTYPES]) -dnl From Paul Eggert. +# +# Check to make sure that the build environment is sane. +# -AC_PREREQ(2.52) +# Copyright (C) 1996, 1997, 2000, 2001, 2003 Free Software Foundation, Inc. -# Define intmax_t to long or long long if doesn't define. +# 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. -AC_DEFUN([jm_AC_TYPE_INTMAX_T], -[ - AC_REQUIRE([jm_AC_TYPE_LONG_LONG]) - AC_CHECK_TYPE(intmax_t, , - [test $ac_cv_type_long_long = yes \ - && ac_type='long long' \ - || ac_type='long' - AC_DEFINE_UNQUOTED(intmax_t, $ac_type, - [Define to widest signed type if doesn't define.])]) -]) +# 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. -# Define uintmax_t to unsigned long or unsigned long long -# if doesn't define. - -AC_DEFUN([jm_AC_TYPE_UINTMAX_T], -[ - AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG]) - AC_CHECK_TYPE(uintmax_t, , - [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 widest unsigned type if doesn't define.])]) -]) +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. -#serial 2 +# serial 3 -dnl From Paul Eggert. - -# Define HAVE_LONG_LONG if 'long long' works. - -AC_DEFUN([jm_AC_TYPE_LONG_LONG], -[ - AC_CACHE_CHECK([for long long], ac_cv_type_long_long, - [AC_TRY_LINK([long long ll = 1; int i = 63;], - [long long llmax = (long long) -1; - return ll << i | ll >> i | llmax / ll | llmax % ll;], - ac_cv_type_long_long=yes, - ac_cv_type_long_long=no)]) - if test $ac_cv_type_long_long = yes; then - AC_DEFINE(HAVE_LONG_LONG, 1, - [Define if you have the long long type.]) - fi -]) +# 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 -# Define HAVE_UNSIGNED_LONG_LONG if 'unsigned long long' works. - -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 -]) + # 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 -# inttypes.m4 serial 1 (gettext-0.11.4) -dnl Copyright (C) 1997-2002 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -dnl From Paul Eggert. - -# Define HAVE_INTTYPES_H if exists and doesn't clash with -# . - -AC_DEFUN([gt_HEADER_INTTYPES_H], -[ - AC_CACHE_CHECK([for inttypes.h], gt_cv_header_inttypes_h, - [ - AC_TRY_COMPILE( - [#include -#include ], - [], gt_cv_header_inttypes_h=yes, gt_cv_header_inttypes_h=no) - ]) - if test $gt_cv_header_inttypes_h = yes; then - AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H, 1, - [Define if exists and doesn't clash with .]) - 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)]) -# inttypes-pri.m4 serial 1 (gettext-0.11.4) -dnl Copyright (C) 1997-2002 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -dnl From Bruno Haible. - -# Define PRI_MACROS_BROKEN if exists and defines the PRI* -# macros to non-string values. This is the case on AIX 4.3.3. - -AC_DEFUN([gt_INTTYPES_PRI], -[ - AC_REQUIRE([gt_HEADER_INTTYPES_H]) - if test $gt_cv_header_inttypes_h = yes; then - AC_CACHE_CHECK([whether the inttypes.h PRIxNN macros are broken], - gt_cv_inttypes_pri_broken, - [ - AC_TRY_COMPILE([#include -#ifdef PRId32 -char *p = PRId32; -#endif -], [], gt_cv_inttypes_pri_broken=no, gt_cv_inttypes_pri_broken=yes) - ]) - fi - if test "$gt_cv_inttypes_pri_broken" = yes; then - AC_DEFINE_UNQUOTED(PRI_MACROS_BROKEN, 1, - [Define if exists and defines unusable PRI* macros.]) - fi -]) +# AM_PROG_INSTALL_STRIP -# codeset.m4 serial AM1 (gettext-0.10.40) -dnl Copyright (C) 2000-2002 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -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 -]) +# Copyright (C) 2001, 2003 Free Software Foundation, Inc. -# lcmessage.m4 serial 3 (gettext-0.11.3) -dnl Copyright (C) 1995-2002 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. -dnl -dnl This file can can be used in projects which are not available under -dnl the GNU General Public License or the GNU Library General Public -dnl License but which still want to provide support for the GNU gettext -dnl functionality. -dnl Please note that the actual code of the GNU gettext library is covered -dnl by the GNU Library General Public License, and the rest of the GNU -dnl gettext package package is covered by the GNU General Public License. -dnl They are *not* in the public domain. - -dnl Authors: -dnl Ulrich Drepper , 1995. - -# Check whether LC_MESSAGES is available in . - -AC_DEFUN([AM_LC_MESSAGES], -[ - 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 -]) +# 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. -dnl -dnl strtod.m4 --- autoconf input file for gawk -dnl -dnl Copyright (C) 2001, 2002 the Free Software Foundation, Inc. -dnl -dnl This file is part of GAWK, the GNU implementation of the -dnl AWK Progamming Language. -dnl -dnl GAWK 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 GAWK 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 -dnl along with this program; if not, write to the Free Software -dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - -dnl Check for strtod with C89 semantics - -AC_DEFUN(GAWK_AC_FUNC_STRTOD_C89, -[ -AC_CHECK_HEADERS(stdlib.h) -AC_CHECK_FUNCS(strtod) -AC_CACHE_CHECK([for strtod with C89 semantics], gawk_ac_cv_func_strtod_c89, -[AC_TRY_RUN( -[/* Test program from Arnold Robbins (arnold@skeeve.com) */ -#if HAVE_STDLIB_H -#include -#else -extern double strtod(); -#endif - -int -main () -{ -#if ! HAVE_STRTOD - exit(1); -#else - double d; - char *str = "0x345a"; - - d = strtod(str, 0); - if (d == 0) - exit (0); - else - exit (1); -#endif -}], -gawk_ac_cv_func_strtod_c89=yes, gawk_ac_cv_func_strtod_c89=no, -gawk_ac_cv_func_strtod_c89=no)]) -if test $gawk_ac_cv_func_strtod_c89 = no; then - AC_DEFINE(STRTOD_NOT_C89, 1, [strtod doesn't have C89 semantics]) -fi -])# GAWK_FUNC_STRTOD_C89 - -dnl -dnl socket.m4 --- autoconf input file for gawk -dnl -dnl Copyright (C) 1995, 1996, 1998, 1999, 2000, 2003 the Free Software Foundation, Inc. -dnl -dnl This file is part of GAWK, the GNU implementation of the -dnl AWK Progamming Language. -dnl -dnl GAWK 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 GAWK 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 -dnl along with this program; if not, write to the Free Software -dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA -dnl - -dnl Find the socket libraries -dnl largely stolen from AC_PATH_XTRA -AC_DEFUN(GAWK_AC_LIB_SOCKETS, [ -gawk_have_sockets=no -# Check for system-dependent location of socket libraries - -SOCKET_LIBS= -if test "$ISC" = yes; then - SOCKET_LIBS="-lnsl_s -linet" -else - # Martyn.Johnson@cl.cam.ac.uk says this is needed for Ultrix, if the X - # libraries were built with DECnet support. And karl@cs.umb.edu says - # the Alpha needs dnet_stub (dnet does not exist). - # - # ADR: Is this needed just for sockets??? -# AC_CHECK_LIB(dnet, dnet_ntoa, [SOCKET_LIBS="$SOCKET_LIBS -ldnet"]) -# if test $ac_cv_lib_dnet_ntoa = no; then -# AC_CHECK_LIB(dnet_stub, dnet_ntoa, -# [SOCKET_LIBS="$SOCKET_LIBS -ldnet_stub"]) -# fi - - # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT, - # to get the SysV transport functions. - # chad@anasazi.com says the Pyramid MIS-ES running DC/OSx (SVR4) - # needs -lnsl. - # The nsl library prevents programs from opening the X display - # on Irix 5.2, according to dickey@clark.net. - AC_CHECK_FUNC(gethostbyname) - if test $ac_cv_func_gethostbyname = no; then - AC_CHECK_LIB(nsl, gethostbyname, SOCKET_LIBS="$SOCKET_LIBS -lnsl") - fi +# 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. - # lieder@skyler.mavd.honeywell.com says without -lsocket, - # socket/setsockopt and other routines are undefined under SCO ODT - # 2.0. But -lsocket is broken on IRIX 5.2 (and is not necessary - # on later versions), says simon@lia.di.epfl.ch: it contains - # gethostby* variants that don't use the nameserver (or something). - # -lsocket must be given before -lnsl if both are needed. - # We assume that if connect needs -lnsl, so does gethostbyname. - AC_CHECK_FUNC(connect) - if test $ac_cv_func_connect = no; then - AC_CHECK_LIB(socket, connect, SOCKET_LIBS="-lsocket $SOCKET_LIBS" - gawk_have_sockets=yes, , - $SOCKET_LIBS) - else - gawk_have_sockets=yes - fi -fi +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. -if test "${gawk_have_sockets}" = "yes" -then - AC_MSG_CHECKING([where to find the socket library calls]) - case "${SOCKET_LIBS}" in - ?*) gawk_lib_loc="${SOCKET_LIBS}" ;; - *) gawk_lib_loc="the standard library" ;; - esac - AC_MSG_RESULT([${gawk_lib_loc}]) - - AC_DEFINE(HAVE_SOCKETS, 1, [we have sockets on this system]) +# 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 -AC_SUBST(SOCKET_LIBS)dnl -])dnl +INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) +m4_include([m4/arch.m4]) +m4_include([m4/codeset.m4]) +m4_include([m4/gettext.m4]) +m4_include([m4/glibc21.m4]) +m4_include([m4/iconv.m4]) +m4_include([m4/intdiv0.m4]) +m4_include([m4/intmax.m4]) +m4_include([m4/intmax_t.m4]) +m4_include([m4/inttypes-pri.m4]) +m4_include([m4/inttypes.m4]) +m4_include([m4/inttypes_h.m4]) +m4_include([m4/lcmessage.m4]) +m4_include([m4/lib-ld.m4]) +m4_include([m4/lib-link.m4]) +m4_include([m4/lib-prefix.m4]) +m4_include([m4/longdouble.m4]) +m4_include([m4/longlong.m4]) +m4_include([m4/nls.m4]) +m4_include([m4/po.m4]) +m4_include([m4/printf-posix.m4]) +m4_include([m4/progtest.m4]) +m4_include([m4/signed.m4]) +m4_include([m4/size_max.m4]) +m4_include([m4/socket.m4]) +m4_include([m4/stdint_h.m4]) +m4_include([m4/strtod.m4]) +m4_include([m4/uintmax_t.m4]) +m4_include([m4/ulonglong.m4]) +m4_include([m4/wchar_t.m4]) +m4_include([m4/wint_t.m4]) +m4_include([m4/xsize.m4]) diff --git a/ansi2knr.c b/ansi2knr.c index 1b32b068a..a042674d5 100644 --- a/ansi2knr.c +++ b/ansi2knr.c @@ -64,7 +64,7 @@ program under the GPL. lpd 2000-04-12 backs out Eggert's changes because of bugs: - concatlits didn't declare the type of its bufend argument; - - concatlits didn't't recognize when it was inside a comment; + - concatlits didn't recognize when it was inside a comment; - scanstring could scan backward past the beginning of the string; when - the check for \ + newline in scanstring was unnecessary. diff --git a/array.c b/array.c index 7a5b1878f..08d80232d 100644 --- a/array.c +++ b/array.c @@ -3,7 +3,7 @@ */ /* - * Copyright (C) 1986, 1988, 1989, 1991-2003 the Free Software Foundation, Inc. + * Copyright (C) 1986, 1988, 1989, 1991-2004 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. @@ -42,7 +42,7 @@ static int AVG_CHAIN_MAX = 2; /* 11/2002: Modern machines are bigger, cut this d #include "awk.h" -static NODE *assoc_find P((NODE *symbol, NODE *subs, int hash1)); +static NODE *assoc_find P((NODE *symbol, NODE *subs, unsigned long hash1)); static void grow_table P((NODE *symbol)); static unsigned long gst_hash_string P((const char *str, size_t len, unsigned long hsize)); @@ -100,19 +100,24 @@ get_actual(NODE *symbol, int canfatal) case Node_array_ref: case Node_param_list: - if (canfatal) + if ((symbol->flags & FUNC) == 0) cant_happen(); /* else fall through */ default: /* notably Node_var but catches also e.g. FS[1] = "x" */ - if (canfatal) - fatal(isparam ? - _("attempt to use scalar parameter `%s' as an array") : - _("attempt to use scalar `%s' as array"), + if (canfatal) { + if ((symbol->flags & FUNC) != 0) + fatal(_("attempt to use function `%s' as an array"), save_symbol->vname); - else + else if (isparam) + fatal(_("attempt to use scalar parameter `%s' as an array"), + save_symbol->vname); + else + fatal(_("attempt to use scalar `%s' as array"), + save_symbol->vname); + } else break; } @@ -302,7 +307,7 @@ concat_exp(register NODE *tree) void assoc_clear(NODE *symbol) { - int i; + long i; NODE *bucket, *next; if (symbol->var_array == NULL) @@ -411,7 +416,7 @@ awk_hash(register const char *s, register size_t len, unsigned long hsize) /* assoc_find --- locate symbol[subs] */ static NODE * /* NULL if not found */ -assoc_find(NODE *symbol, register NODE *subs, int hash1) +assoc_find(NODE *symbol, register NODE *subs, unsigned long hash1) { register NODE *bucket; const char *s1_str; @@ -444,7 +449,7 @@ assoc_find(NODE *symbol, register NODE *subs, int hash1) NODE * in_array(NODE *symbol, NODE *subs) { - register int hash1; + register unsigned long hash1; NODE *ret; symbol = get_array(symbol); @@ -478,7 +483,7 @@ in_array(NODE *symbol, NODE *subs) NODE ** assoc_lookup(NODE *symbol, NODE *subs, int reference) { - register int hash1; + register unsigned long hash1; register NODE *bucket; assert(symbol->type == Node_var_array); @@ -535,13 +540,20 @@ assoc_lookup(NODE *symbol, NODE *subs, int reference) */ bucket->flags |= MALLOC; bucket->ahname_ref = 1; - emalloc(bucket->ahname_str, char *, subs->stlen + 2, "assoc_lookup"); - bucket->ahname_len = subs->stlen; - - memcpy(bucket->ahname_str, subs->stptr, subs->stlen); - bucket->ahname_str[bucket->ahname_len] = '\0'; - free_temp(subs); + /* For TEMP node, reuse the storage directly */ + if ((subs->flags & TEMP) != 0) { + bucket->ahname_str = subs->stptr; + bucket->ahname_len = subs->stlen; + bucket->ahname_str[bucket->ahname_len] = '\0'; + subs->flags &= ~TEMP; /* for good measure */ + freenode(subs); + } else { + emalloc(bucket->ahname_str, char *, subs->stlen + 2, "assoc_lookup"); + bucket->ahname_len = subs->stlen; + memcpy(bucket->ahname_str, subs->stptr, subs->stlen); + bucket->ahname_str[bucket->ahname_len] = '\0'; + } bucket->ahvalue = Nnull_string; bucket->ahnext = symbol->var_array[hash1]; @@ -559,7 +571,7 @@ assoc_lookup(NODE *symbol, NODE *subs, int reference) void do_delete(NODE *sym, NODE *tree) { - register int hash1; + register unsigned long hash1; register NODE *bucket, *last; NODE *subs; register NODE *symbol = get_array(sym); @@ -642,7 +654,7 @@ do_delete(NODE *sym, NODE *tree) void do_delete_loop(NODE *symbol, NODE *tree) { - size_t i; + long i; NODE **lhs; Func_ptr after_assign = NULL; @@ -676,7 +688,7 @@ grow_table(NODE *symbol) NODE **old, **new, *chain, *next; int i, j; unsigned long hash1; - unsigned long oldsize, newsize; + unsigned long oldsize, newsize, k; /* * This is an array of primes. We grow the table by an order of * magnitude each time (not just doubling) so that growing is a @@ -721,11 +733,11 @@ grow_table(NODE *symbol) /* old hash table there, move stuff to new, free old */ old = symbol->var_array; - for (i = 0; i < oldsize; i++) { - if (old[i] == NULL) + for (k = 0; k < oldsize; k++) { + if (old[k] == NULL) continue; - for (chain = old[i]; chain != NULL; chain = next) { + for (chain = old[k]; chain != NULL; chain = next) { next = chain->ahnext; hash1 = hash(chain->ahname_str, chain->ahname_len, newsize); @@ -746,6 +758,16 @@ grow_table(NODE *symbol) symbol->array_size = newsize; } +/* set_SUBSEP --- make sure SUBSEP always has a string value */ + +void +set_SUBSEP(void) +{ + + (void) force_string(SUBSEP_node->var_value); + return; +} + /* pr_node --- print simple node info */ static void @@ -762,7 +784,7 @@ pr_node(NODE *n) NODE * assoc_dump(NODE *symbol) { - int i; + long i; NODE *bucket; if (symbol->var_array == NULL) { @@ -831,7 +853,7 @@ static void dup_table(NODE *symbol, NODE *newsymb) { NODE **old, **new, *chain, *bucket; - int i; + long i; unsigned long cursize; /* find the current hash size */ @@ -929,7 +951,7 @@ merge(NODE *left, NODE *right) /* merge_sort --- recursively sort the left and right sides of a list */ static NODE * -merge_sort(NODE *left, int size) +merge_sort(NODE *left, unsigned long size) { NODE *right, *tmp; int i, half; @@ -966,7 +988,7 @@ assoc_from_list(NODE *symbol, NODE *list) { NODE *next; unsigned long i = 0; - register int hash1; + register unsigned long hash1; char buf[100]; for (; list != NULL; list = next) { @@ -1001,7 +1023,7 @@ typedef enum asort_how { VALUE, INDEX } ASORT_TYPE; static NODE * assoc_sort_inplace(NODE *symbol, ASORT_TYPE how) { - int i, num; + unsigned long i, num; NODE *bucket, *next, *list; if (symbol->var_array == NULL diff --git a/awk.h b/awk.h index 739c11d5b..6ba3c4334 100644 --- a/awk.h +++ b/awk.h @@ -3,7 +3,7 @@ */ /* - * Copyright (C) 1986, 1988, 1989, 1991-2003 the Free Software Foundation, Inc. + * Copyright (C) 1986, 1988, 1989, 1991-2004 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. @@ -73,9 +73,11 @@ extern int errno; #ifdef HAVE_SIGNUM_H #include #endif -#if defined(HAVE_MBRLEN) && defined(HAVE_MBRTOWC) && defined(HAVE_WCHAR_H) && defined(HAVE_WCTYPE_H) + +#include "mbsupport.h" /* defines MBS_SUPPORT */ + +#if defined(MBS_SUPPORT) /* We can handle multibyte strings. */ -#define MBS_SUPPORT #include #include #endif @@ -211,13 +213,16 @@ lose #include "unsupported/atari/redirect.h" #endif -#define RE_TRANSLATE_TYPE const char * #define GNU_REGEX #ifdef GNU_REGEX #include "regex.h" +#include "dfa.h" typedef struct Regexp { struct re_pattern_buffer pat; struct re_registers regs; + struct dfa dfareg; + short dfa; + short has_anchor; /* speed up of avoid_dfa kludge, temporary */ } Regexp; #define RESTART(rp,s) (rp)->regs.start[0] #define REEND(rp,s) (rp)->regs.end[0] @@ -326,6 +331,7 @@ typedef enum nodevals { Node_assign_plus, Node_assign_minus, Node_assign_exp, + Node_assign_concat, /* boolean binaries lnode and rnode are expressions */ Node_and, @@ -431,6 +437,7 @@ typedef enum nodevals { Node_ORS, Node_RS, Node_TEXTDOMAIN, + Node_SUBSEP, Node_final /* sentry value, not legal */ } NODETYPE; @@ -532,6 +539,7 @@ typedef struct exp_node { #define re_flags sub.nodep.reflags #define re_text lnode #define re_exp sub.nodep.x.extra +#define re_cnt sub.nodep.number #define forloop rnode->sub.nodep.r.hd @@ -650,7 +658,7 @@ struct flagtab { #ifndef LONG_MIN #define LONG_MIN ((long)(-LONG_MAX - 1L)) #endif -#define HUGE LONG_MAX +#define UNLIMITED LONG_MAX /* -------------------------- External variables -------------------------- */ /* gawk builtin variables */ @@ -719,13 +727,17 @@ extern GETGROUPS_T *groupset; extern int ngroups; #endif +#ifdef HAVE_LOCALE_H +extern struct lconv loc; +#endif /* HAVE_LOCALE_H */ + extern const char *myname; extern char quote; extern char *defpath; extern char envsep; -extern const char casetable[]; /* for case-independent regexp matching */ +extern char casetable[]; /* for case-independent regexp matching */ /* ------------------------- Pseudo-functions ------------------------- */ @@ -787,9 +799,8 @@ extern const char casetable[]; /* for case-independent regexp matching */ #if __GNUC__ >= 2 #define m_tree_eval(t, iscond) __extension__ \ ({NODE * _t = (t); \ - if (_t == NULL) \ - _t = Nnull_string; \ - else { \ + if (_t == (NODE*)NULL) \ + cant_happen(); \ switch(_t->type) { \ case Node_val: \ if (_t->flags&INTLSTR) \ @@ -805,10 +816,9 @@ extern const char casetable[]; /* for case-independent regexp matching */ _t = r_tree_eval(_t, iscond);\ break; \ } \ - } \ _t;}) #else -#define m_tree_eval(t, iscond) (_t = (t), _t == NULL ? Nnull_string : \ +#define m_tree_eval(t, iscond) (_t = (t), _t == (NODE*)NULL ? (cant_happen(), (NODE*)NULL) : \ (_t->type == Node_param_list ? \ r_tree_eval(_t, iscond) : \ ((_t->type == Node_val && (_t->flags&INTLSTR)) ? \ @@ -834,20 +844,29 @@ extern const char casetable[]; /* for case-independent regexp matching */ #define cant_happen() r_fatal("internal error line %d, file: %s", \ __LINE__, __FILE__) +/* + * For SunOS 4.1.x which is pre-Standard C, `realloc' doesn't + * accept NULL. Sigh. The check must be done for both cases, + * since could be using GCC but with stock C library. Sigh, again. + */ #ifdef HAVE_STRINGIZE #define emalloc(var,ty,x,str) (void)((var=(ty)malloc((MALLOC_ARG_T)(x))) ||\ (fatal(_("%s: %s: can't allocate %ld bytes of memory (%s)"),\ (str), #var, (long) (x), strerror(errno)),0)) -#define erealloc(var,ty,x,str) (void)((var=(ty)realloc((char *)var,\ - (MALLOC_ARG_T)(x))) ||\ +#define erealloc(var,ty,x,str) (void)((var = ((var == NULL) \ + ? (ty)malloc((MALLOC_ARG_T)(x)) \ + : (ty)realloc((char *)var, (MALLOC_ARG_T)(x))) ) \ + ||\ (fatal(_("%s: %s: can't allocate %ld bytes of memory (%s)"),\ (str), #var, (long) (x), strerror(errno)),0)) #else /* HAVE_STRINGIZE */ #define emalloc(var,ty,x,str) (void)((var=(ty)malloc((MALLOC_ARG_T)(x))) ||\ (fatal(_("%s: %s: can't allocate %ld bytes of memory (%s)"),\ (str), "var", (long) (x), strerror(errno)),0)) -#define erealloc(var,ty,x,str) (void)((var=(ty)realloc((char *)var,\ - (MALLOC_ARG_T)(x))) ||\ +#define erealloc(var,ty,x,str) (void)((var = ((var == NULL) \ + ? (ty)malloc((MALLOC_ARG_T)(x)) \ + : (ty)realloc((char *)var, (MALLOC_ARG_T)(x))) ) \ + ||\ (fatal(_("%s: %s: can't allocate %ld bytes of memory (%s)"),\ (str), "var", (long) (x), strerror(errno)),0)) #endif /* HAVE_STRINGIZE */ @@ -905,6 +924,7 @@ extern NODE *in_array P((NODE *symbol, NODE *subs)); extern NODE **assoc_lookup P((NODE *symbol, NODE *subs, int reference)); extern void do_delete P((NODE *symbol, NODE *tree)); extern void do_delete_loop P((NODE *symbol, NODE *tree)); +extern void set_SUBSEP P((void)); extern NODE *assoc_dump P((NODE *symbol)); extern NODE *do_adump P((NODE *tree)); extern NODE *do_asort P((NODE *tree)); @@ -923,6 +943,7 @@ extern void release_all_vars P((void)); extern const char *getfname P((NODE *(*)(NODE *))); extern NODE *stopme P((NODE *tree)); extern void shadow_funcs P((void)); +extern int check_special P((const char *name)); /* builtin.c */ extern double double_to_int P((double d)); extern NODE *do_exp P((NODE *tree)); @@ -988,6 +1009,8 @@ extern const char *flags2str P((int)); extern const char *genflags2str P((int flagval, const struct flagtab *tab)); extern const char *nodetype2str P((NODETYPE type)); extern NODE *assign_val P((NODE **lhs_p, NODE *rhs)); +extern void load_casetable P((void)); +extern size_t get_curfunc_arg_count P((void)); #ifdef PROFILING extern void dump_fcall_stack P((FILE *fp)); #endif @@ -996,6 +1019,9 @@ NODE *do_ext P((NODE *)); #ifdef DYNAMIC void make_builtin P((char *, NODE *(*)(NODE *), int)); NODE *get_argument P((NODE *, int)); +NODE *get_actual_argument P((NODE *, unsigned int, int, int)); +#define get_scalar_argument(t, i, opt) get_actual_argument((t), (i), (opt), FALSE) +#define get_array_argument(t, i, opt) get_actual_argument((t), (i), (opt), TRUE) void set_value P((NODE *)); #endif /* field.c */ @@ -1101,14 +1127,15 @@ extern void freenode P((NODE *it)); extern void unref P((NODE *tmp)); extern int parse_escape P((const char **string_ptr)); /* re.c */ -extern Regexp *make_regexp P((const char *s, size_t len, int ignorecase)); -extern int research P((Regexp *rp, const char *str, int start, +extern Regexp *make_regexp P((const char *s, size_t len, int ignorecase, int dfa)); +extern int research P((Regexp *rp, char *str, int start, size_t len, int need_start)); extern void refree P((Regexp *rp)); extern void reg_error P((const char *s)); extern Regexp *re_update P((NODE *t)); extern void resyntax P((int syntax)); extern void resetup P((void)); +extern int avoid_dfa P((NODE *re, char *str, size_t len)); /* temporary */ extern int reisstring P((const char *text, size_t len, Regexp *re, const char *buf)); extern int remaybelong P((const char *text, size_t len)); diff --git a/awkgram.c b/awkgram.c index 29464ef0d..14e2c296a 100644 --- a/awkgram.c +++ b/awkgram.c @@ -216,7 +216,7 @@ static int var_count; /* total number of global variables */ extern char *source; extern int sourceline; extern struct src *srcfiles; -extern int numfiles; +extern long numfiles; extern int errcount; extern NODE *begin_block; extern NODE *end_block; @@ -507,20 +507,20 @@ static const unsigned short yyrline[] = { 0, 171, 171, 177, 179, 184, 196, 200, 215, 226, 229, 233, 243, 248, 256, 261, 263, 265, 276, 277, - 282, 281, 305, 304, 327, 328, 333, 334, 352, 357, - 358, 362, 364, 366, 368, 370, 372, 374, 416, 420, - 425, 428, 431, 440, 460, 463, 462, 469, 481, 481, - 512, 514, 528, 543, 549, 550, 555, 608, 609, 626, - 631, 633, 638, 640, 645, 647, 649, 654, 655, 663, - 664, 670, 675, 675, 686, 691, 698, 699, 702, 704, - 709, 710, 716, 717, 722, 724, 726, 728, 730, 737, - 738, 744, 745, 750, 752, 758, 760, 762, 764, 769, - 775, 777, 779, 785, 787, 793, 795, 800, 802, 804, - 809, 811, 815, 816, 821, 823, 831, 833, 835, 840, - 842, 844, 846, 848, 850, 852, 854, 860, 865, 867, - 872, 874, 876, 879, 881, 889, 897, 898, 900, 902, - 904, 907, 915, 927, 928, 933, 935, 949, 954, 958, - 962, 965, 967, 971, 975, 978 + 282, 281, 305, 304, 328, 329, 334, 335, 353, 358, + 359, 363, 365, 367, 369, 371, 373, 375, 417, 421, + 426, 429, 432, 441, 461, 464, 463, 473, 485, 485, + 516, 518, 532, 547, 553, 554, 559, 612, 613, 630, + 635, 637, 642, 644, 649, 651, 653, 658, 659, 667, + 668, 674, 679, 679, 691, 696, 703, 704, 707, 709, + 714, 715, 721, 722, 727, 729, 731, 733, 735, 742, + 743, 749, 750, 755, 757, 763, 765, 767, 769, 774, + 793, 795, 797, 803, 805, 811, 813, 818, 820, 822, + 827, 829, 833, 834, 839, 841, 849, 851, 853, 858, + 860, 862, 864, 866, 868, 870, 872, 878, 883, 885, + 890, 892, 894, 897, 899, 907, 915, 916, 918, 920, + 922, 925, 933, 945, 946, 951, 953, 967, 972, 976, + 980, 983, 985, 989, 993, 996 }; #endif @@ -1606,10 +1606,10 @@ yyparse () } else { /* an error */ if (begin_or_end_rule) - warning(_("%s blocks must have an action part"), + msg(_("%s blocks must have an action part"), (parsing_end_rule ? "END" : "BEGIN")); else - warning(_("each rule must have a pattern or an action part")); + msg(_("each rule must have a pattern or an action part")); errcount++; } } @@ -1735,20 +1735,21 @@ yyparse () getnode(n); n->type = Node_regex; n->re_exp = make_string(yyvsp[0].sval, len); - n->re_reg = make_regexp(yyvsp[0].sval, len, FALSE); + n->re_reg = make_regexp(yyvsp[0].sval, len, FALSE, TRUE); n->re_text = NULL; n->re_flags = CONST; + n->re_cnt = 1; yyval.nodeval = n; } break; case 26: -#line 333 "awkgram.y" +#line 334 "awkgram.y" { yyval.nodeval = NULL; } break; case 27: -#line 335 "awkgram.y" +#line 336 "awkgram.y" { if (yyvsp[0].nodeval == NULL) yyval.nodeval = yyvsp[-1].nodeval; @@ -1769,42 +1770,42 @@ yyparse () break; case 28: -#line 353 "awkgram.y" +#line 354 "awkgram.y" { yyval.nodeval = NULL; } break; case 31: -#line 363 "awkgram.y" +#line 364 "awkgram.y" { yyval.nodeval = NULL; } break; case 32: -#line 365 "awkgram.y" +#line 366 "awkgram.y" { yyval.nodeval = yyvsp[-1].nodeval; } break; case 33: -#line 367 "awkgram.y" +#line 368 "awkgram.y" { yyval.nodeval = yyvsp[0].nodeval; } break; case 34: -#line 369 "awkgram.y" +#line 370 "awkgram.y" { yyval.nodeval = node(yyvsp[-6].nodeval, Node_K_switch, yyvsp[-2].nodeval); } break; case 35: -#line 371 "awkgram.y" +#line 372 "awkgram.y" { yyval.nodeval = node(yyvsp[-3].nodeval, Node_K_while, yyvsp[0].nodeval); } break; case 36: -#line 373 "awkgram.y" +#line 374 "awkgram.y" { yyval.nodeval = node(yyvsp[-2].nodeval, Node_K_do, yyvsp[-5].nodeval); } break; case 37: -#line 375 "awkgram.y" +#line 376 "awkgram.y" { /* * Efficiency hack. Recognize the special case of @@ -1819,7 +1820,7 @@ yyparse () * Check that the body is a `delete a[i]' statement, * and that both the loop var and array names match. */ - if (yyvsp[0].nodeval != NULL && yyvsp[0].nodeval->type == Node_K_delete) { + if (yyvsp[0].nodeval != NULL && yyvsp[0].nodeval->type == Node_K_delete && yyvsp[0].nodeval->rnode != NULL) { NODE *arr, *sub; assert(yyvsp[0].nodeval->rnode->type == Node_expression_list); @@ -1849,14 +1850,14 @@ yyparse () break; case 38: -#line 417 "awkgram.y" +#line 418 "awkgram.y" { yyval.nodeval = node(yyvsp[0].nodeval, Node_K_for, (NODE *) make_for_loop(yyvsp[-9].nodeval, yyvsp[-6].nodeval, yyvsp[-3].nodeval)); } break; case 39: -#line 421 "awkgram.y" +#line 422 "awkgram.y" { yyval.nodeval = node(yyvsp[0].nodeval, Node_K_for, (NODE *) make_for_loop(yyvsp[-8].nodeval, (NODE *) NULL, yyvsp[-3].nodeval)); @@ -1864,17 +1865,17 @@ yyparse () break; case 40: -#line 427 "awkgram.y" +#line 428 "awkgram.y" { yyval.nodeval = node((NODE *) NULL, Node_K_break, (NODE *) NULL); } break; case 41: -#line 430 "awkgram.y" +#line 431 "awkgram.y" { yyval.nodeval = node((NODE *) NULL, Node_K_continue, (NODE *) NULL); } break; case 42: -#line 432 "awkgram.y" +#line 433 "awkgram.y" { NODETYPE type; if (begin_or_end_rule) @@ -1886,7 +1887,7 @@ yyparse () break; case 43: -#line 441 "awkgram.y" +#line 442 "awkgram.y" { if (do_traditional) { /* @@ -1909,12 +1910,12 @@ yyparse () break; case 44: -#line 461 "awkgram.y" +#line 462 "awkgram.y" { yyval.nodeval = node(yyvsp[-1].nodeval, Node_K_exit, (NODE *) NULL); } break; case 45: -#line 463 "awkgram.y" +#line 464 "awkgram.y" { if (! can_return) yyerror(_("`return' used outside function context")); @@ -1922,17 +1923,20 @@ yyparse () break; case 46: -#line 468 "awkgram.y" - { yyval.nodeval = node(yyvsp[-1].nodeval, Node_K_return, (NODE *) NULL); } +#line 469 "awkgram.y" + { + yyval.nodeval = node(yyvsp[-1].nodeval == NULL ? Nnull_string : yyvsp[-1].nodeval, + Node_K_return, (NODE *) NULL); + } break; case 48: -#line 481 "awkgram.y" +#line 485 "awkgram.y" { in_print = TRUE; in_parens = 0; } break; case 49: -#line 482 "awkgram.y" +#line 486 "awkgram.y" { /* * Optimization: plain `print' has no expression list, so $3 is null. @@ -1966,12 +1970,12 @@ yyparse () break; case 50: -#line 513 "awkgram.y" +#line 517 "awkgram.y" { yyval.nodeval = node(variable(yyvsp[-3].sval, CAN_FREE, Node_var_array), Node_K_delete, yyvsp[-1].nodeval); } break; case 51: -#line 515 "awkgram.y" +#line 519 "awkgram.y" { if (do_lint) lintwarn(_("`delete array' is a gawk extension")); @@ -1988,7 +1992,7 @@ yyparse () break; case 52: -#line 529 "awkgram.y" +#line 533 "awkgram.y" { /* this is for tawk compatibility. maybe the warnings should always be done. */ if (do_lint) @@ -2006,22 +2010,22 @@ yyparse () break; case 53: -#line 544 "awkgram.y" +#line 548 "awkgram.y" { yyval.nodeval = yyvsp[0].nodeval; } break; case 54: -#line 549 "awkgram.y" +#line 553 "awkgram.y" { yyval.nodeval = NULL; } break; case 55: -#line 551 "awkgram.y" +#line 555 "awkgram.y" { yyval.nodeval = yyvsp[0].nodeval; } break; case 56: -#line 556 "awkgram.y" +#line 560 "awkgram.y" { if (yyvsp[0].nodeval == NULL) { yyval.nodeval = NULL; @@ -2073,12 +2077,12 @@ yyparse () break; case 57: -#line 608 "awkgram.y" +#line 612 "awkgram.y" { yyval.nodeval = NULL; } break; case 58: -#line 610 "awkgram.y" +#line 614 "awkgram.y" { if (yyvsp[0].nodeval == NULL) yyval.nodeval = yyvsp[-1].nodeval; @@ -2098,27 +2102,27 @@ yyparse () break; case 59: -#line 627 "awkgram.y" +#line 631 "awkgram.y" { yyval.nodeval = NULL; } break; case 60: -#line 632 "awkgram.y" +#line 636 "awkgram.y" { yyval.nodeval = node(yyvsp[-3].nodeval, Node_K_case, yyvsp[0].nodeval); } break; case 61: -#line 634 "awkgram.y" +#line 638 "awkgram.y" { yyval.nodeval = node((NODE *) NULL, Node_K_default, yyvsp[0].nodeval); } break; case 62: -#line 639 "awkgram.y" +#line 643 "awkgram.y" { yyval.nodeval = yyvsp[0].nodeval; } break; case 63: -#line 641 "awkgram.y" +#line 645 "awkgram.y" { yyvsp[0].nodeval->numbr = -(force_number(yyvsp[0].nodeval)); yyval.nodeval = yyvsp[0].nodeval; @@ -2126,27 +2130,27 @@ yyparse () break; case 64: -#line 646 "awkgram.y" +#line 650 "awkgram.y" { yyval.nodeval = yyvsp[0].nodeval; } break; case 65: -#line 648 "awkgram.y" +#line 652 "awkgram.y" { yyval.nodeval = yyvsp[0].nodeval; } break; case 66: -#line 650 "awkgram.y" +#line 654 "awkgram.y" { yyval.nodeval = yyvsp[0].nodeval; } break; case 70: -#line 665 "awkgram.y" +#line 669 "awkgram.y" { yyval.nodeval = node(yyvsp[-3].nodeval, Node_expression_list, yyvsp[-1].nodeval); } break; case 71: -#line 670 "awkgram.y" +#line 674 "awkgram.y" { in_print = FALSE; in_parens = 0; @@ -2155,23 +2159,24 @@ yyparse () break; case 72: -#line 675 "awkgram.y" +#line 679 "awkgram.y" { in_print = FALSE; in_parens = 0; } break; case 73: -#line 676 "awkgram.y" +#line 680 "awkgram.y" { yyval.nodeval = node(yyvsp[0].nodeval, yyvsp[-2].nodetypeval, (NODE *) NULL); if (yyvsp[-2].nodetypeval == Node_redirect_twoway && yyvsp[0].nodeval->type == Node_K_getline + && yyvsp[0].nodeval->rnode != NULL && yyvsp[0].nodeval->rnode->type == Node_redirect_twoway) yyerror(_("multistage two-way pipelines don't work")); } break; case 74: -#line 687 "awkgram.y" +#line 692 "awkgram.y" { yyval.nodeval = node(yyvsp[-3].nodeval, Node_K_if, node(yyvsp[0].nodeval, Node_if_branches, (NODE *) NULL)); @@ -2179,83 +2184,83 @@ yyparse () break; case 75: -#line 693 "awkgram.y" +#line 698 "awkgram.y" { yyval.nodeval = node(yyvsp[-6].nodeval, Node_K_if, node(yyvsp[-3].nodeval, Node_if_branches, yyvsp[0].nodeval)); } break; case 80: -#line 709 "awkgram.y" +#line 714 "awkgram.y" { yyval.nodeval = NULL; } break; case 81: -#line 711 "awkgram.y" +#line 716 "awkgram.y" { yyval.nodeval = node(yyvsp[0].nodeval, Node_redirect_input, (NODE *) NULL); } break; case 82: -#line 716 "awkgram.y" +#line 721 "awkgram.y" { yyval.nodeval = NULL; } break; case 83: -#line 718 "awkgram.y" +#line 723 "awkgram.y" { yyval.nodeval = yyvsp[0].nodeval; } break; case 84: -#line 723 "awkgram.y" +#line 728 "awkgram.y" { yyval.nodeval = make_param(yyvsp[0].sval); } break; case 85: -#line 725 "awkgram.y" +#line 730 "awkgram.y" { yyval.nodeval = append_right(yyvsp[-2].nodeval, make_param(yyvsp[0].sval)); yyerrok; } break; case 86: -#line 727 "awkgram.y" +#line 732 "awkgram.y" { yyval.nodeval = NULL; } break; case 87: -#line 729 "awkgram.y" +#line 734 "awkgram.y" { yyval.nodeval = NULL; } break; case 88: -#line 731 "awkgram.y" +#line 736 "awkgram.y" { yyval.nodeval = NULL; } break; case 89: -#line 737 "awkgram.y" +#line 742 "awkgram.y" { yyval.nodeval = NULL; } break; case 90: -#line 739 "awkgram.y" +#line 744 "awkgram.y" { yyval.nodeval = yyvsp[0].nodeval; } break; case 91: -#line 744 "awkgram.y" +#line 749 "awkgram.y" { yyval.nodeval = NULL; } break; case 92: -#line 746 "awkgram.y" +#line 751 "awkgram.y" { yyval.nodeval = yyvsp[0].nodeval; } break; case 93: -#line 751 "awkgram.y" +#line 756 "awkgram.y" { yyval.nodeval = node(yyvsp[0].nodeval, Node_expression_list, (NODE *) NULL); } break; case 94: -#line 753 "awkgram.y" +#line 758 "awkgram.y" { yyval.nodeval = append_right(yyvsp[-2].nodeval, node(yyvsp[0].nodeval, Node_expression_list, (NODE *) NULL)); @@ -2264,46 +2269,59 @@ yyparse () break; case 95: -#line 759 "awkgram.y" +#line 764 "awkgram.y" { yyval.nodeval = NULL; } break; case 96: -#line 761 "awkgram.y" +#line 766 "awkgram.y" { yyval.nodeval = NULL; } break; case 97: -#line 763 "awkgram.y" +#line 768 "awkgram.y" { yyval.nodeval = NULL; } break; case 98: -#line 765 "awkgram.y" +#line 770 "awkgram.y" { yyval.nodeval = NULL; } break; case 99: -#line 770 "awkgram.y" +#line 775 "awkgram.y" { if (do_lint && yyvsp[0].nodeval->type == Node_regex) lintwarn(_("regular expression on right of assignment")); - yyval.nodeval = node(yyvsp[-2].nodeval, yyvsp[-1].nodetypeval, yyvsp[0].nodeval); + /* + * Optimization of `x = x y'. Can save lots of time + * if done a lot. + */ + if (( yyvsp[-2].nodeval->type == Node_var + || yyvsp[-2].nodeval->type == Node_var_new + || yyvsp[-2].nodeval->type == Node_param_list) + && yyvsp[-1].nodetypeval == Node_assign + && yyvsp[0].nodeval->type == Node_concat + && yyvsp[0].nodeval->lnode == yyvsp[-2].nodeval) { + yyvsp[0].nodeval->type = Node_assign_concat; /* Just change the type */ + yyval.nodeval = yyvsp[0].nodeval; /* And use it directly */ + } else + yyval.nodeval = node(yyvsp[-2].nodeval, yyvsp[-1].nodetypeval, yyvsp[0].nodeval); } break; case 100: -#line 776 "awkgram.y" +#line 794 "awkgram.y" { yyval.nodeval = node(yyvsp[-2].nodeval, Node_and, yyvsp[0].nodeval); } break; case 101: -#line 778 "awkgram.y" +#line 796 "awkgram.y" { yyval.nodeval = node(yyvsp[-2].nodeval, Node_or, yyvsp[0].nodeval); } break; case 102: -#line 780 "awkgram.y" +#line 798 "awkgram.y" { if (yyvsp[-2].nodeval->type == Node_regex) warning(_("regular expression on left of `~' or `!~' operator")); @@ -2312,12 +2330,12 @@ yyparse () break; case 103: -#line 786 "awkgram.y" +#line 804 "awkgram.y" { yyval.nodeval = node(variable(yyvsp[0].sval, CAN_FREE, Node_var_array), Node_in_array, yyvsp[-2].nodeval); } break; case 104: -#line 788 "awkgram.y" +#line 806 "awkgram.y" { if (do_lint && yyvsp[0].nodeval->type == Node_regex) lintwarn(_("regular expression on right of comparison")); @@ -2326,52 +2344,52 @@ yyparse () break; case 105: -#line 794 "awkgram.y" +#line 812 "awkgram.y" { yyval.nodeval = node(yyvsp[-4].nodeval, Node_cond_exp, node(yyvsp[-2].nodeval, Node_if_branches, yyvsp[0].nodeval));} break; case 106: -#line 796 "awkgram.y" +#line 814 "awkgram.y" { yyval.nodeval = yyvsp[0].nodeval; } break; case 107: -#line 801 "awkgram.y" +#line 819 "awkgram.y" { yyval.nodetypeval = yyvsp[0].nodetypeval; } break; case 108: -#line 803 "awkgram.y" +#line 821 "awkgram.y" { yyval.nodetypeval = yyvsp[0].nodetypeval; } break; case 109: -#line 805 "awkgram.y" +#line 823 "awkgram.y" { yyval.nodetypeval = Node_assign_quotient; } break; case 110: -#line 810 "awkgram.y" +#line 828 "awkgram.y" { yyval.nodetypeval = yyvsp[0].nodetypeval; } break; case 111: -#line 812 "awkgram.y" +#line 830 "awkgram.y" { yyval.nodetypeval = Node_less; } break; case 113: -#line 817 "awkgram.y" +#line 835 "awkgram.y" { yyval.nodetypeval = Node_greater; } break; case 114: -#line 822 "awkgram.y" +#line 840 "awkgram.y" { yyval.nodeval = yyvsp[0].nodeval; } break; case 115: -#line 824 "awkgram.y" +#line 842 "awkgram.y" { yyval.nodeval = node(node(make_number(0.0), Node_field_spec, @@ -2382,52 +2400,52 @@ yyparse () break; case 116: -#line 832 "awkgram.y" +#line 850 "awkgram.y" { yyval.nodeval = node(variable(yyvsp[0].sval, CAN_FREE, Node_var_array), Node_in_array, yyvsp[-3].nodeval); } break; case 117: -#line 834 "awkgram.y" +#line 852 "awkgram.y" { yyval.nodeval = yyvsp[0].nodeval; } break; case 118: -#line 836 "awkgram.y" +#line 854 "awkgram.y" { yyval.nodeval = node(yyvsp[-1].nodeval, Node_concat, yyvsp[0].nodeval); } break; case 120: -#line 843 "awkgram.y" +#line 861 "awkgram.y" { yyval.nodeval = node(yyvsp[-2].nodeval, Node_exp, yyvsp[0].nodeval); } break; case 121: -#line 845 "awkgram.y" +#line 863 "awkgram.y" { yyval.nodeval = node(yyvsp[-2].nodeval, Node_times, yyvsp[0].nodeval); } break; case 122: -#line 847 "awkgram.y" +#line 865 "awkgram.y" { yyval.nodeval = node(yyvsp[-2].nodeval, Node_quotient, yyvsp[0].nodeval); } break; case 123: -#line 849 "awkgram.y" +#line 867 "awkgram.y" { yyval.nodeval = node(yyvsp[-2].nodeval, Node_mod, yyvsp[0].nodeval); } break; case 124: -#line 851 "awkgram.y" +#line 869 "awkgram.y" { yyval.nodeval = node(yyvsp[-2].nodeval, Node_plus, yyvsp[0].nodeval); } break; case 125: -#line 853 "awkgram.y" +#line 871 "awkgram.y" { yyval.nodeval = node(yyvsp[-2].nodeval, Node_minus, yyvsp[0].nodeval); } break; case 126: -#line 855 "awkgram.y" +#line 873 "awkgram.y" { if (do_lint && parsing_end_rule && yyvsp[0].nodeval == NULL) lintwarn(_("non-redirected `getline' undefined inside END action")); @@ -2436,7 +2454,7 @@ yyparse () break; case 127: -#line 861 "awkgram.y" +#line 879 "awkgram.y" { yyval.nodeval = node(yyvsp[0].nodeval, Node_K_getline, node(yyvsp[-3].nodeval, yyvsp[-2].nodetypeval, (NODE *) NULL)); @@ -2444,37 +2462,37 @@ yyparse () break; case 128: -#line 866 "awkgram.y" +#line 884 "awkgram.y" { yyval.nodeval = node(yyvsp[-1].nodeval, Node_postincrement, (NODE *) NULL); } break; case 129: -#line 868 "awkgram.y" +#line 886 "awkgram.y" { yyval.nodeval = node(yyvsp[-1].nodeval, Node_postdecrement, (NODE *) NULL); } break; case 130: -#line 873 "awkgram.y" +#line 891 "awkgram.y" { yyval.nodeval = node(yyvsp[0].nodeval, Node_not, (NODE *) NULL); } break; case 131: -#line 875 "awkgram.y" +#line 893 "awkgram.y" { yyval.nodeval = yyvsp[-1].nodeval; } break; case 132: -#line 878 "awkgram.y" +#line 896 "awkgram.y" { yyval.nodeval = snode(yyvsp[-1].nodeval, Node_builtin, (int) yyvsp[-3].lval); } break; case 133: -#line 880 "awkgram.y" +#line 898 "awkgram.y" { yyval.nodeval = snode(yyvsp[-1].nodeval, Node_builtin, (int) yyvsp[-3].lval); } break; case 134: -#line 882 "awkgram.y" +#line 900 "awkgram.y" { if (do_lint) lintwarn(_("call of `length' without parentheses is not portable")); @@ -2485,7 +2503,7 @@ yyparse () break; case 135: -#line 890 "awkgram.y" +#line 908 "awkgram.y" { yyval.nodeval = node(yyvsp[-1].nodeval, Node_func_call, make_string(yyvsp[-3].sval, strlen(yyvsp[-3].sval))); yyval.nodeval->funcbody = NULL; @@ -2496,27 +2514,27 @@ yyparse () break; case 137: -#line 899 "awkgram.y" +#line 917 "awkgram.y" { yyval.nodeval = node(yyvsp[0].nodeval, Node_preincrement, (NODE *) NULL); } break; case 138: -#line 901 "awkgram.y" +#line 919 "awkgram.y" { yyval.nodeval = node(yyvsp[0].nodeval, Node_predecrement, (NODE *) NULL); } break; case 139: -#line 903 "awkgram.y" +#line 921 "awkgram.y" { yyval.nodeval = yyvsp[0].nodeval; } break; case 140: -#line 905 "awkgram.y" +#line 923 "awkgram.y" { yyval.nodeval = yyvsp[0].nodeval; } break; case 141: -#line 908 "awkgram.y" +#line 926 "awkgram.y" { if (yyvsp[0].nodeval->type == Node_val && (yyvsp[0].nodeval->flags & (STRCUR|STRING)) == 0) { yyvsp[0].nodeval->numbr = -(force_number(yyvsp[0].nodeval)); @@ -2527,7 +2545,7 @@ yyparse () break; case 142: -#line 916 "awkgram.y" +#line 934 "awkgram.y" { /* * was: $$ = $2 @@ -2538,22 +2556,22 @@ yyparse () break; case 143: -#line 927 "awkgram.y" +#line 945 "awkgram.y" { yyval.nodeval = NULL; } break; case 144: -#line 929 "awkgram.y" +#line 947 "awkgram.y" { yyval.nodeval = yyvsp[0].nodeval; } break; case 145: -#line 934 "awkgram.y" +#line 952 "awkgram.y" { yyval.nodeval = variable(yyvsp[0].sval, CAN_FREE, Node_var_new); } break; case 146: -#line 936 "awkgram.y" +#line 954 "awkgram.y" { NODE *n; @@ -2570,32 +2588,32 @@ yyparse () break; case 147: -#line 950 "awkgram.y" +#line 968 "awkgram.y" { yyval.nodeval = node(yyvsp[0].nodeval, Node_field_spec, (NODE *) NULL); } break; case 149: -#line 958 "awkgram.y" +#line 976 "awkgram.y" { yyerrok; } break; case 150: -#line 962 "awkgram.y" +#line 980 "awkgram.y" { yyerrok; } break; case 153: -#line 971 "awkgram.y" +#line 989 "awkgram.y" { yyerrok; } break; case 154: -#line 975 "awkgram.y" +#line 993 "awkgram.y" { yyerrok; } break; case 155: -#line 978 "awkgram.y" +#line 996 "awkgram.y" { yyerrok; } break; @@ -2603,7 +2621,7 @@ yyparse () } /* Line 991 of yacc.c. */ -#line 2604 "y.tab.c" +#line 2622 "y.tab.c" yyvsp -= yylen; yyssp -= yylen; @@ -2812,7 +2830,7 @@ yyparse () } -#line 981 "awkgram.y" +#line 999 "awkgram.y" struct token { @@ -2993,6 +3011,8 @@ static void * Saving and restoring *bp keeps valgrind happy, * since the guts of glibc uses strlen, even though * we're passing an explict precision. Sigh. + * + * 8/2003: We may not need this anymore. */ save = *bp; *bp = '\0'; @@ -3039,15 +3059,16 @@ get_src_buf() static int samefile = FALSE; static int nextfile = 0; static char *buf = NULL; + static size_t buflen = 0; static int fd; + int n; register char *scan; - static size_t len = 0; - static int did_newline = FALSE; int newfile; struct stat sbuf; - -# define SLOP 128 /* enough space to hold most source lines */ + int readcount = 0; + int l; + char *readloc; again: newfile = FALSE; @@ -3055,66 +3076,60 @@ get_src_buf() return NULL; if (srcfiles[nextfile].stype == CMDLINE) { - if (len == 0) { - len = strlen(srcfiles[nextfile].val); - if (len == 0) { - /* - * Yet Another Special case: - * gawk '' /path/name - * Sigh. - */ - static int warned = FALSE; - - if (do_lint && ! warned) { - warned = TRUE; - lintwarn(_("empty program text on command line")); - } - ++nextfile; - goto again; - } - sourceline = 1; - lexptr = lexptr_begin = srcfiles[nextfile].val; - lexend = lexptr + len; - } else if (! did_newline && *(lexptr-1) != '\n') { + if ((l = strlen(srcfiles[nextfile].val)) == 0) { /* - * The following goop is to ensure that the source - * ends with a newline and that the entire current - * line is available for error messages. + * Yet Another Special case: + * gawk '' /path/name + * Sigh. */ - int offset; + static int warned = FALSE; - did_newline = TRUE; - offset = lexptr - lexeme; - for (scan = lexeme; scan > lexptr_begin; scan--) - if (*scan == '\n') { - scan++; - break; - } - len = lexptr - scan; - emalloc(buf, char *, len+1, "get_src_buf"); - memcpy(buf, scan, len); - thisline = buf; - lexptr = buf + len; - *lexptr = '\n'; - lexeme = lexptr - offset; - lexptr_begin = buf; - lexend = lexptr + 1; + if (do_lint && ! warned) { + warned = TRUE; + lintwarn(_("empty program text on command line")); + } + ++nextfile; + goto again; + } + if (srcfiles[nextfile].val[l-1] == '\n') { + /* has terminating newline, can use it directly */ + sourceline = 1; + lexptr = lexptr_begin = srcfiles[nextfile].val; + /* fall through to pointer adjustment and return, below */ } else { - len = 0; - lexeme = lexptr = lexptr_begin = NULL; + /* copy it into static buffer */ + + /* make sure buffer exists and has room */ + if (buflen == 0) { + emalloc(buf, char *, l+2, "get_src_buf"); + buflen = l + 2; + } else if (l+2 > buflen) { + erealloc(buf, char *, l+2, "get_src_buf"); + buflen = l + 2; + } /* else + buffer has room, just use it */ + + /* copy in data */ + memcpy(buf, srcfiles[nextfile].val, l); + buf[l] = '\n'; + buf[++l] = '\0'; + + /* set vars and return */ + lexptr = lexptr_begin = buf; } - if (lexptr == NULL && ++nextfile <= numfiles) - goto again; + lexend = lexptr + l; + nextfile++; /* for next entry to this routine */ return lexptr; } + if (! samefile) { source = srcfiles[nextfile].val; - if (source == NULL) { + if (source == NULL) { /* read all the source files, all done */ if (buf != NULL) { free(buf); buf = NULL; } - len = 0; + buflen = 0; return lexeme = lexptr = lexptr_begin = NULL; } fd = pathopen(source); @@ -3127,37 +3142,79 @@ get_src_buf() fatal(_("can't open source file `%s' for reading (%s)"), in, strerror(errno)); } - len = optimal_bufsize(fd, & sbuf); + l = optimal_bufsize(fd, & sbuf); + /* + * Make sure that something silly like + * AWKBUFSIZE=8 make check + * works ok. + */ +#define A_DECENT_BUFFER_SIZE 128 + if (l < A_DECENT_BUFFER_SIZE) + l = A_DECENT_BUFFER_SIZE; +#undef A_DECENT_BUFFER_SIZE + newfile = TRUE; - if (buf != NULL) - free(buf); - emalloc(buf, char *, len + SLOP, "get_src_buf"); - lexptr_begin = buf + SLOP; + + /* make sure buffer exists and has room */ + if (buflen == 0) { + emalloc(buf, char *, l+2, "get_src_buf"); + buflen = l + 2; + } else if (l+2 > buflen) { + erealloc(buf, char *, l+2, "get_src_buf"); + buflen = l + 2; + } /* else + buffer has room, just use it */ + + readcount = l; + readloc = lexeme = lexptr = lexptr_begin = buf; samefile = TRUE; sourceline = 1; } else { /* - * Here, we retain the current source line (up to length SLOP) - * in the beginning of the buffer that was overallocated above + * In same file, ran off edge of buffer. + * Shift current line down to front, adjust + * pointers and fill in the rest of the buffer. */ - int offset; - int linelen; - offset = lexptr - lexeme; - for (scan = lexeme; scan > lexptr_begin; scan--) + int lexeme_offset = lexeme - lexptr_begin; + int lexptr_offset = lexptr - lexptr_begin; + int lexend_offset = lexend - lexptr_begin; + + /* find beginning of current line */ + for (scan = lexeme; scan >= lexptr_begin; scan--) { if (*scan == '\n') { scan++; break; } - linelen = lexptr - scan; - if (linelen > SLOP) - linelen = SLOP; - thisline = buf + SLOP - linelen; - memcpy(thisline, scan, linelen); - lexeme = buf + SLOP - offset; - lexptr_begin = thisline; + } + + if (scan <= buf) { + /* have to grow the buffer */ + buflen *= 2; + erealloc(buf, char *, buflen, "get_src_buf"); + } else { + /* shift things down */ + memmove(buf, scan, lexend - scan); + /* + * make offsets relative to start of line, + * not start of buffer. + */ + lexend_offset = lexend - scan; + lexeme_offset = lexeme - scan; + lexptr_offset = lexptr - scan; + } + + /* adjust pointers */ + lexeme = buf + lexeme_offset; + lexptr = buf + lexptr_offset; + lexend = buf + lexend_offset; + lexptr_begin = buf; + readcount = buflen - (lexend - buf); + readloc = lexend; } - n = read(fd, buf + SLOP, len); + + /* add more data to buffer */ + n = read(fd, readloc, readcount); if (n == -1) fatal(_("can't read sourcefile `%s' (%s)"), source, strerror(errno)); @@ -3174,14 +3231,10 @@ get_src_buf() close(fd); samefile = FALSE; nextfile++; - if (lexeme) - *lexeme = '\0'; - len = 0; goto again; } - lexptr = buf + SLOP; lexend = lexptr + n; - return buf; + return lexptr; } /* tokadd --- add a character to the token buffer */ @@ -3358,7 +3411,7 @@ yylex(void) int seen_e = FALSE; /* These are for numbers */ int seen_point = FALSE; int esc_seen; /* for literal strings */ - int low, mid, high; + int mid; static int did_newline = FALSE; char *tokkey; static int lasttok = 0, eof_warned = FALSE; @@ -3937,44 +3990,31 @@ yylex(void) } /* See if it is a special token. */ - low = 0; - high = (sizeof(tokentab) / sizeof(tokentab[0])) - 1; - while (low <= high) { - int i; - - mid = (low + high) / 2; - c = *tokstart - tokentab[mid].operator[0]; - i = c ? c : strcmp(tokstart, tokentab[mid].operator); - if (i < 0) /* token < mid */ - high = mid - 1; - else if (i > 0) /* token > mid */ - low = mid + 1; + if ((mid = check_special(tokstart)) >= 0) { + if (do_lint) { + if (tokentab[mid].flags & GAWKX) + lintwarn(_("`%s' is a gawk extension"), + tokentab[mid].operator); + if (tokentab[mid].flags & RESX) + lintwarn(_("`%s' is a Bell Labs extension"), + tokentab[mid].operator); + if (tokentab[mid].flags & NOT_POSIX) + lintwarn(_("POSIX does not allow `%s'"), + tokentab[mid].operator); + } + if (do_lint_old && (tokentab[mid].flags & NOT_OLD)) + warning(_("`%s' is not supported in old awk"), + tokentab[mid].operator); + if ((do_traditional && (tokentab[mid].flags & GAWKX)) + || (do_posix && (tokentab[mid].flags & NOT_POSIX))) + ; else { - if (do_lint) { - if (tokentab[mid].flags & GAWKX) - lintwarn(_("`%s' is a gawk extension"), - tokentab[mid].operator); - if (tokentab[mid].flags & RESX) - lintwarn(_("`%s' is a Bell Labs extension"), - tokentab[mid].operator); - if (tokentab[mid].flags & NOT_POSIX) - lintwarn(_("POSIX does not allow `%s'"), - tokentab[mid].operator); - } - if (do_lint_old && (tokentab[mid].flags & NOT_OLD)) - warning(_("`%s' is not supported in old awk"), - tokentab[mid].operator); - if ((do_traditional && (tokentab[mid].flags & GAWKX)) - || (do_posix && (tokentab[mid].flags & NOT_POSIX))) - break; if (tokentab[mid].class == LEX_BUILTIN - || tokentab[mid].class == LEX_LENGTH - ) + || tokentab[mid].class == LEX_LENGTH) yylval.lval = mid; else yylval.nodetypeval = tokentab[mid].value; - free(tokkey); return lasttok = tokentab[mid].class; } @@ -4006,8 +4046,8 @@ node_common(NODETYPE op) getnode(r); r->type = op; r->flags = MALLOC; - /* if lookahead is NL, lineno is 1 too high */ - if (lexeme && *lexeme == '\n') + /* if lookahead is a NL, lineno is 1 too high */ + if (lexeme && lexeme >= lexptr_begin && *lexeme == '\n') r->source_line = sourceline - 1; else r->source_line = sourceline; @@ -4458,10 +4498,7 @@ dump_funcs() { int i, j; NODE *p; - static struct finfo *tab = NULL; - - if (func_count == 0) - return; + struct finfo *tab = NULL; /* * Walk through symbol table countng functions. @@ -4476,8 +4513,10 @@ dump_funcs() } } - if (tab == NULL) - emalloc(tab, struct finfo *, j * sizeof(struct finfo), "dump_funcs"); + if (j == 0) + return; + + emalloc(tab, struct finfo *, j * sizeof(struct finfo), "dump_funcs"); /* now walk again, copying info */ for (i = j = 0; i < HASHSIZE; i++) { @@ -4826,9 +4865,9 @@ variable(char *name, int can_free, NODETYPE type) if ((r = lookup(name)) != NULL) { if (r->type == Node_func) - fatal(_("function `%s' called with space between name and `(',\n%s"), - r->vname, - _("or used as a variable or an array")); + fatal(_("function `%s' called with space between name and `(',\nor used as a variable or an array"), + r->vname); + } else { /* not found */ if (! do_traditional && STREQ(name, "PROCINFO")) @@ -4841,10 +4880,10 @@ variable(char *name, int can_free, NODETYPE type) */ NODE *n; - if (type == Node_var) - n = node(Nnull_string, type, (NODE *) NULL); - else + if (type == Node_var_array) n = node((NODE *) NULL, type, (NODE *) NULL); + else + n = node(Nnull_string, type, (NODE *) NULL); return install(name, n); } @@ -4870,6 +4909,7 @@ mk_rexp(NODE *exp) n->re_text = NULL; n->re_reg = NULL; n->re_flags = 0; + n->re_cnt = 1; return n; } @@ -4922,6 +4962,7 @@ isnoeffect(NODETYPE type) case Node_CONVFMT: case Node_BINMODE: case Node_LINT: + case Node_SUBSEP: case Node_TEXTDOMAIN: return TRUE; default: @@ -4952,6 +4993,7 @@ isassignable(register NODE *n) case Node_OFS: case Node_LINT: case Node_BINMODE: + case Node_SUBSEP: case Node_TEXTDOMAIN: case Node_field_spec: case Node_subscript: @@ -4969,7 +5011,7 @@ isassignable(register NODE *n) NODE * stopme(NODE *tree ATTRIBUTE_UNUSED) { - return 0; + return (NODE *) 0; } /* dumpintlstr --- write out an initial .po file entry for the string */ @@ -5051,7 +5093,7 @@ isarray(NODE *n) case Node_var_array: return TRUE; case Node_param_list: - return ((n->flags & FUNC) == 0); + return (n->flags & FUNC) == 0; case Node_array_ref: cant_happen(); break; @@ -5062,4 +5104,30 @@ isarray(NODE *n) return FALSE; } +/* See if name is a special token. */ + +int +check_special(const char *name) +{ + int low, high, mid; + int i; + + low = 0; + high = (sizeof(tokentab) / sizeof(tokentab[0])) - 1; + while (low <= high) { + mid = (low + high) / 2; + i = *name - tokentab[mid].operator[0]; + if (i == 0) + i = strcmp(name, tokentab[mid].operator); + + if (i < 0) /* token < mid */ + high = mid - 1; + else if (i > 0) /* token > mid */ + low = mid + 1; + else + return mid; + } + return -1; +} + diff --git a/awkgram.y b/awkgram.y index 27fa2ad50..a70a36b09 100644 --- a/awkgram.y +++ b/awkgram.y @@ -3,7 +3,7 @@ */ /* - * Copyright (C) 1986, 1988, 1989, 1991-2003 the Free Software Foundation, Inc. + * Copyright (C) 1986, 1988, 1989, 1991-2004 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. @@ -90,7 +90,7 @@ static int var_count; /* total number of global variables */ extern char *source; extern int sourceline; extern struct src *srcfiles; -extern int numfiles; +extern long numfiles; extern int errcount; extern NODE *begin_block; extern NODE *end_block; @@ -205,10 +205,10 @@ rule } else { /* an error */ if (begin_or_end_rule) - warning(_("%s blocks must have an action part"), + msg(_("%s blocks must have an action part"), (parsing_end_rule ? "END" : "BEGIN")); else - warning(_("each rule must have a pattern or an action part")); + msg(_("each rule must have a pattern or an action part")); errcount++; } } @@ -316,9 +316,10 @@ regexp getnode(n); n->type = Node_regex; n->re_exp = make_string($3, len); - n->re_reg = make_regexp($3, len, FALSE); + n->re_reg = make_regexp($3, len, FALSE, TRUE); n->re_text = NULL; n->re_flags = CONST; + n->re_cnt = 1; $$ = n; } ; @@ -386,7 +387,7 @@ statement * Check that the body is a `delete a[i]' statement, * and that both the loop var and array names match. */ - if ($8 != NULL && $8->type == Node_K_delete) { + if ($8 != NULL && $8->type == Node_K_delete && $8->rnode != NULL) { NODE *arr, *sub; assert($8->rnode->type == Node_expression_list); @@ -465,7 +466,10 @@ statement yyerror(_("`return' used outside function context")); } opt_exp statement_term - { $$ = node($3, Node_K_return, (NODE *) NULL); } + { + $$ = node($3 == NULL ? Nnull_string : $3, + Node_K_return, (NODE *) NULL); + } | simple_stmt statement_term ; @@ -677,6 +681,7 @@ output_redir $$ = node($3, $1, (NODE *) NULL); if ($1 == Node_redirect_twoway && $3->type == Node_K_getline + && $3->rnode != NULL && $3->rnode->type == Node_redirect_twoway) yyerror(_("multistage two-way pipelines don't work")); } @@ -770,7 +775,20 @@ exp : variable assign_operator exp %prec ASSIGNOP { if (do_lint && $3->type == Node_regex) lintwarn(_("regular expression on right of assignment")); - $$ = node($1, $2, $3); + /* + * Optimization of `x = x y'. Can save lots of time + * if done a lot. + */ + if (( $1->type == Node_var + || $1->type == Node_var_new + || $1->type == Node_param_list) + && $2 == Node_assign + && $3->type == Node_concat + && $3->lnode == $1) { + $3->type = Node_assign_concat; /* Just change the type */ + $$ = $3; /* And use it directly */ + } else + $$ = node($1, $2, $3); } | exp LEX_AND exp { $$ = node($1, Node_and, $3); } @@ -1158,6 +1176,8 @@ static void * Saving and restoring *bp keeps valgrind happy, * since the guts of glibc uses strlen, even though * we're passing an explict precision. Sigh. + * + * 8/2003: We may not need this anymore. */ save = *bp; *bp = '\0'; @@ -1204,15 +1224,16 @@ get_src_buf() static int samefile = FALSE; static int nextfile = 0; static char *buf = NULL; + static size_t buflen = 0; static int fd; + int n; register char *scan; - static size_t len = 0; - static int did_newline = FALSE; int newfile; struct stat sbuf; - -# define SLOP 128 /* enough space to hold most source lines */ + int readcount = 0; + int l; + char *readloc; again: newfile = FALSE; @@ -1220,66 +1241,60 @@ again: return NULL; if (srcfiles[nextfile].stype == CMDLINE) { - if (len == 0) { - len = strlen(srcfiles[nextfile].val); - if (len == 0) { - /* - * Yet Another Special case: - * gawk '' /path/name - * Sigh. - */ - static int warned = FALSE; - - if (do_lint && ! warned) { - warned = TRUE; - lintwarn(_("empty program text on command line")); - } - ++nextfile; - goto again; - } - sourceline = 1; - lexptr = lexptr_begin = srcfiles[nextfile].val; - lexend = lexptr + len; - } else if (! did_newline && *(lexptr-1) != '\n') { + if ((l = strlen(srcfiles[nextfile].val)) == 0) { /* - * The following goop is to ensure that the source - * ends with a newline and that the entire current - * line is available for error messages. + * Yet Another Special case: + * gawk '' /path/name + * Sigh. */ - int offset; + static int warned = FALSE; - did_newline = TRUE; - offset = lexptr - lexeme; - for (scan = lexeme; scan > lexptr_begin; scan--) - if (*scan == '\n') { - scan++; - break; - } - len = lexptr - scan; - emalloc(buf, char *, len+1, "get_src_buf"); - memcpy(buf, scan, len); - thisline = buf; - lexptr = buf + len; - *lexptr = '\n'; - lexeme = lexptr - offset; - lexptr_begin = buf; - lexend = lexptr + 1; - } else { - len = 0; - lexeme = lexptr = lexptr_begin = NULL; - } - if (lexptr == NULL && ++nextfile <= numfiles) + if (do_lint && ! warned) { + warned = TRUE; + lintwarn(_("empty program text on command line")); + } + ++nextfile; goto again; + } + if (srcfiles[nextfile].val[l-1] == '\n') { + /* has terminating newline, can use it directly */ + sourceline = 1; + lexptr = lexptr_begin = srcfiles[nextfile].val; + /* fall through to pointer adjustment and return, below */ + } else { + /* copy it into static buffer */ + + /* make sure buffer exists and has room */ + if (buflen == 0) { + emalloc(buf, char *, l+2, "get_src_buf"); + buflen = l + 2; + } else if (l+2 > buflen) { + erealloc(buf, char *, l+2, "get_src_buf"); + buflen = l + 2; + } /* else + buffer has room, just use it */ + + /* copy in data */ + memcpy(buf, srcfiles[nextfile].val, l); + buf[l] = '\n'; + buf[++l] = '\0'; + + /* set vars and return */ + lexptr = lexptr_begin = buf; + } + lexend = lexptr + l; + nextfile++; /* for next entry to this routine */ return lexptr; } + if (! samefile) { source = srcfiles[nextfile].val; - if (source == NULL) { + if (source == NULL) { /* read all the source files, all done */ if (buf != NULL) { free(buf); buf = NULL; } - len = 0; + buflen = 0; return lexeme = lexptr = lexptr_begin = NULL; } fd = pathopen(source); @@ -1292,37 +1307,79 @@ again: fatal(_("can't open source file `%s' for reading (%s)"), in, strerror(errno)); } - len = optimal_bufsize(fd, & sbuf); + l = optimal_bufsize(fd, & sbuf); + /* + * Make sure that something silly like + * AWKBUFSIZE=8 make check + * works ok. + */ +#define A_DECENT_BUFFER_SIZE 128 + if (l < A_DECENT_BUFFER_SIZE) + l = A_DECENT_BUFFER_SIZE; +#undef A_DECENT_BUFFER_SIZE + newfile = TRUE; - if (buf != NULL) - free(buf); - emalloc(buf, char *, len + SLOP, "get_src_buf"); - lexptr_begin = buf + SLOP; + + /* make sure buffer exists and has room */ + if (buflen == 0) { + emalloc(buf, char *, l+2, "get_src_buf"); + buflen = l + 2; + } else if (l+2 > buflen) { + erealloc(buf, char *, l+2, "get_src_buf"); + buflen = l + 2; + } /* else + buffer has room, just use it */ + + readcount = l; + readloc = lexeme = lexptr = lexptr_begin = buf; samefile = TRUE; sourceline = 1; } else { /* - * Here, we retain the current source line (up to length SLOP) - * in the beginning of the buffer that was overallocated above + * In same file, ran off edge of buffer. + * Shift current line down to front, adjust + * pointers and fill in the rest of the buffer. */ - int offset; - int linelen; - offset = lexptr - lexeme; - for (scan = lexeme; scan > lexptr_begin; scan--) + int lexeme_offset = lexeme - lexptr_begin; + int lexptr_offset = lexptr - lexptr_begin; + int lexend_offset = lexend - lexptr_begin; + + /* find beginning of current line */ + for (scan = lexeme; scan >= lexptr_begin; scan--) { if (*scan == '\n') { scan++; break; } - linelen = lexptr - scan; - if (linelen > SLOP) - linelen = SLOP; - thisline = buf + SLOP - linelen; - memcpy(thisline, scan, linelen); - lexeme = buf + SLOP - offset; - lexptr_begin = thisline; + } + + if (scan <= buf) { + /* have to grow the buffer */ + buflen *= 2; + erealloc(buf, char *, buflen, "get_src_buf"); + } else { + /* shift things down */ + memmove(buf, scan, lexend - scan); + /* + * make offsets relative to start of line, + * not start of buffer. + */ + lexend_offset = lexend - scan; + lexeme_offset = lexeme - scan; + lexptr_offset = lexptr - scan; + } + + /* adjust pointers */ + lexeme = buf + lexeme_offset; + lexptr = buf + lexptr_offset; + lexend = buf + lexend_offset; + lexptr_begin = buf; + readcount = buflen - (lexend - buf); + readloc = lexend; } - n = read(fd, buf + SLOP, len); + + /* add more data to buffer */ + n = read(fd, readloc, readcount); if (n == -1) fatal(_("can't read sourcefile `%s' (%s)"), source, strerror(errno)); @@ -1339,14 +1396,10 @@ again: close(fd); samefile = FALSE; nextfile++; - if (lexeme) - *lexeme = '\0'; - len = 0; goto again; } - lexptr = buf + SLOP; lexend = lexptr + n; - return buf; + return lexptr; } /* tokadd --- add a character to the token buffer */ @@ -1523,7 +1576,7 @@ yylex(void) int seen_e = FALSE; /* These are for numbers */ int seen_point = FALSE; int esc_seen; /* for literal strings */ - int low, mid, high; + int mid; static int did_newline = FALSE; char *tokkey; static int lasttok = 0, eof_warned = FALSE; @@ -2102,44 +2155,31 @@ retry: } /* See if it is a special token. */ - low = 0; - high = (sizeof(tokentab) / sizeof(tokentab[0])) - 1; - while (low <= high) { - int i; - mid = (low + high) / 2; - c = *tokstart - tokentab[mid].operator[0]; - i = c ? c : strcmp(tokstart, tokentab[mid].operator); - - if (i < 0) /* token < mid */ - high = mid - 1; - else if (i > 0) /* token > mid */ - low = mid + 1; + if ((mid = check_special(tokstart)) >= 0) { + if (do_lint) { + if (tokentab[mid].flags & GAWKX) + lintwarn(_("`%s' is a gawk extension"), + tokentab[mid].operator); + if (tokentab[mid].flags & RESX) + lintwarn(_("`%s' is a Bell Labs extension"), + tokentab[mid].operator); + if (tokentab[mid].flags & NOT_POSIX) + lintwarn(_("POSIX does not allow `%s'"), + tokentab[mid].operator); + } + if (do_lint_old && (tokentab[mid].flags & NOT_OLD)) + warning(_("`%s' is not supported in old awk"), + tokentab[mid].operator); + if ((do_traditional && (tokentab[mid].flags & GAWKX)) + || (do_posix && (tokentab[mid].flags & NOT_POSIX))) + ; else { - if (do_lint) { - if (tokentab[mid].flags & GAWKX) - lintwarn(_("`%s' is a gawk extension"), - tokentab[mid].operator); - if (tokentab[mid].flags & RESX) - lintwarn(_("`%s' is a Bell Labs extension"), - tokentab[mid].operator); - if (tokentab[mid].flags & NOT_POSIX) - lintwarn(_("POSIX does not allow `%s'"), - tokentab[mid].operator); - } - if (do_lint_old && (tokentab[mid].flags & NOT_OLD)) - warning(_("`%s' is not supported in old awk"), - tokentab[mid].operator); - if ((do_traditional && (tokentab[mid].flags & GAWKX)) - || (do_posix && (tokentab[mid].flags & NOT_POSIX))) - break; if (tokentab[mid].class == LEX_BUILTIN - || tokentab[mid].class == LEX_LENGTH - ) + || tokentab[mid].class == LEX_LENGTH) yylval.lval = mid; else yylval.nodetypeval = tokentab[mid].value; - free(tokkey); return lasttok = tokentab[mid].class; } @@ -2171,8 +2211,8 @@ node_common(NODETYPE op) getnode(r); r->type = op; r->flags = MALLOC; - /* if lookahead is NL, lineno is 1 too high */ - if (lexeme && *lexeme == '\n') + /* if lookahead is a NL, lineno is 1 too high */ + if (lexeme && lexeme >= lexptr_begin && *lexeme == '\n') r->source_line = sourceline - 1; else r->source_line = sourceline; @@ -2623,10 +2663,7 @@ dump_funcs() { int i, j; NODE *p; - static struct finfo *tab = NULL; - - if (func_count == 0) - return; + struct finfo *tab = NULL; /* * Walk through symbol table countng functions. @@ -2641,8 +2678,10 @@ dump_funcs() } } - if (tab == NULL) - emalloc(tab, struct finfo *, j * sizeof(struct finfo), "dump_funcs"); + if (j == 0) + return; + + emalloc(tab, struct finfo *, j * sizeof(struct finfo), "dump_funcs"); /* now walk again, copying info */ for (i = j = 0; i < HASHSIZE; i++) { @@ -2991,9 +3030,9 @@ variable(char *name, int can_free, NODETYPE type) if ((r = lookup(name)) != NULL) { if (r->type == Node_func) - fatal(_("function `%s' called with space between name and `(',\n%s"), - r->vname, - _("or used as a variable or an array")); + fatal(_("function `%s' called with space between name and `(',\nor used as a variable or an array"), + r->vname); + } else { /* not found */ if (! do_traditional && STREQ(name, "PROCINFO")) @@ -3006,10 +3045,10 @@ variable(char *name, int can_free, NODETYPE type) */ NODE *n; - if (type == Node_var) - n = node(Nnull_string, type, (NODE *) NULL); - else + if (type == Node_var_array) n = node((NODE *) NULL, type, (NODE *) NULL); + else + n = node(Nnull_string, type, (NODE *) NULL); return install(name, n); } @@ -3035,6 +3074,7 @@ mk_rexp(NODE *exp) n->re_text = NULL; n->re_reg = NULL; n->re_flags = 0; + n->re_cnt = 1; return n; } @@ -3087,6 +3127,7 @@ isnoeffect(NODETYPE type) case Node_CONVFMT: case Node_BINMODE: case Node_LINT: + case Node_SUBSEP: case Node_TEXTDOMAIN: return TRUE; default: @@ -3117,6 +3158,7 @@ isassignable(register NODE *n) case Node_OFS: case Node_LINT: case Node_BINMODE: + case Node_SUBSEP: case Node_TEXTDOMAIN: case Node_field_spec: case Node_subscript: @@ -3134,7 +3176,7 @@ isassignable(register NODE *n) NODE * stopme(NODE *tree ATTRIBUTE_UNUSED) { - return 0; + return (NODE *) 0; } /* dumpintlstr --- write out an initial .po file entry for the string */ @@ -3216,7 +3258,7 @@ isarray(NODE *n) case Node_var_array: return TRUE; case Node_param_list: - return ((n->flags & FUNC) == 0); + return (n->flags & FUNC) == 0; case Node_array_ref: cant_happen(); break; @@ -3226,3 +3268,29 @@ isarray(NODE *n) return FALSE; } + +/* See if name is a special token. */ + +int +check_special(const char *name) +{ + int low, high, mid; + int i; + + low = 0; + high = (sizeof(tokentab) / sizeof(tokentab[0])) - 1; + while (low <= high) { + mid = (low + high) / 2; + i = *name - tokentab[mid].operator[0]; + if (i == 0) + i = strcmp(name, tokentab[mid].operator); + + if (i < 0) /* token < mid */ + high = mid - 1; + else if (i > 0) /* token > mid */ + low = mid + 1; + else + return mid; + } + return -1; +} diff --git a/awklib/ChangeLog b/awklib/ChangeLog index 57eaf7320..ef6057def 100644 --- a/awklib/ChangeLog +++ b/awklib/ChangeLog @@ -1,3 +1,12 @@ +Mon Aug 2 12:18:15 2004 Arnold D. Robbins + + * Release 3.1.4: Release tar file made. + +Thu Mar 18 17:43:59 2004 Arnold D. Robbins + + * Makefile.am (INCLUDES): Renamed to AM_CPPFLAGS. Per + Stepan Kasal. + Mon Jul 7 11:01:43 2003 Arnold D. Robbins * Release 3.1.3: Release tar file made. diff --git a/awklib/Makefile.am b/awklib/Makefile.am index 4662ffc92..ddd85e230 100644 --- a/awklib/Makefile.am +++ b/awklib/Makefile.am @@ -1,7 +1,7 @@ # # awklib/Makefile.am --- automake input file for gawk # -# Copyright (C) 1995-2003 the Free Software Foundation, Inc. +# Copyright (C) 1995-2004 the Free Software Foundation, Inc. # # This file is part of GAWK, the GNU implementation of the # AWK Programming Language. @@ -27,7 +27,7 @@ EXTRA_DIST = ChangeLog extract.awk eg stamp-eg # This is so we get config.h. It'll be in the build directory, # not the source directory. -INCLUDES = -I.. +AM_CPPFLAGS = -I.. datadir = @datadir@/awk libexecdir = @libexecdir@/awk diff --git a/awklib/Makefile.in b/awklib/Makefile.in index 9ae786a96..6dd67b714 100644 --- a/awklib/Makefile.in +++ b/awklib/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.7.5 from Makefile.am. +# Makefile.in generated by automake 1.8.5 from Makefile.am. # @configure_input@ -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 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. @@ -17,7 +17,7 @@ # # awklib/Makefile.am --- automake input file for gawk # -# Copyright (C) 1995-2003 the Free Software Foundation, Inc. +# Copyright (C) 1995-2004 the Free Software Foundation, Inc. # # This file is part of GAWK, the GNU implementation of the # AWK Programming Language. @@ -37,6 +37,9 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA # + +SOURCES = $(nodist_grcat_SOURCES) $(nodist_pwcat_SOURCES) + srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ @@ -44,7 +47,6 @@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. - am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 @@ -59,6 +61,56 @@ NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : host_triplet = @host@ +libexec_PROGRAMS = pwcat$(EXEEXT) grcat$(EXEEXT) +subdir = awklib +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/arch.m4 \ + $(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/iconv.m4 \ + $(top_srcdir)/m4/intdiv0.m4 $(top_srcdir)/m4/intmax.m4 \ + $(top_srcdir)/m4/intmax_t.m4 $(top_srcdir)/m4/inttypes-pri.m4 \ + $(top_srcdir)/m4/inttypes.m4 $(top_srcdir)/m4/inttypes_h.m4 \ + $(top_srcdir)/m4/lcmessage.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/longdouble.m4 $(top_srcdir)/m4/longlong.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/printf-posix.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/m4/signed.m4 $(top_srcdir)/m4/size_max.m4 \ + $(top_srcdir)/m4/socket.m4 $(top_srcdir)/m4/stdint_h.m4 \ + $(top_srcdir)/m4/strtod.m4 $(top_srcdir)/m4/uintmax_t.m4 \ + $(top_srcdir)/m4/ulonglong.m4 $(top_srcdir)/m4/wchar_t.m4 \ + $(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/m4/xsize.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +am__installdirs = "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(bindir)" +libexecPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +PROGRAMS = $(libexec_PROGRAMS) +nodist_grcat_OBJECTS = grcat.$(OBJEXT) +grcat_OBJECTS = $(nodist_grcat_OBJECTS) +grcat_LDADD = $(LDADD) +nodist_pwcat_OBJECTS = pwcat.$(OBJEXT) +pwcat_OBJECTS = $(nodist_pwcat_OBJECTS) +pwcat_LDADD = $(LDADD) +binSCRIPT_INSTALL = $(INSTALL_SCRIPT) +SCRIPTS = $(bin_SCRIPTS) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/grcat.Po ./$(DEPDIR)/pwcat.Po +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(nodist_grcat_SOURCES) $(nodist_pwcat_SOURCES) +DIST_SOURCES = +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMDEP_FALSE = @AMDEP_FALSE@ @@ -87,6 +139,10 @@ EXEEXT = @EXEEXT@ GENCAT = @GENCAT@ GLIBC21 = @GLIBC21@ GMSGFMT = @GMSGFMT@ +HAVE_ASPRINTF = @HAVE_ASPRINTF@ +HAVE_POSIX_PRINTF = @HAVE_POSIX_PRINTF@ +HAVE_SNPRINTF = @HAVE_SNPRINTF@ +HAVE_WPRINTF = @HAVE_WPRINTF@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -143,7 +199,6 @@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ - datadir = @datadir@/awk exec_prefix = @exec_prefix@ host = @host@ @@ -158,6 +213,7 @@ libdir = @libdir@ libexecdir = @libexecdir@/awk localstatedir = @localstatedir@ mandir = @mandir@ +mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ @@ -165,71 +221,58 @@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ - EXTRA_DIST = ChangeLog extract.awk eg stamp-eg # This is so we get config.h. It'll be in the build directory, # not the source directory. -INCLUDES = -I.. - +AM_CPPFLAGS = -I.. bin_SCRIPTS = igawk -libexec_PROGRAMS = pwcat grcat AUXAWK = passwd.awk group.awk nodist_grcat_SOURCES = grcat.c nodist_pwcat_SOURCES = pwcat.c -subdir = awklib -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -libexec_PROGRAMS = pwcat$(EXEEXT) grcat$(EXEEXT) -PROGRAMS = $(libexec_PROGRAMS) - -nodist_grcat_OBJECTS = grcat.$(OBJEXT) -grcat_OBJECTS = $(nodist_grcat_OBJECTS) -grcat_LDADD = $(LDADD) -grcat_DEPENDENCIES = -grcat_LDFLAGS = -nodist_pwcat_OBJECTS = pwcat.$(OBJEXT) -pwcat_OBJECTS = $(nodist_pwcat_OBJECTS) -pwcat_LDADD = $(LDADD) -pwcat_DEPENDENCIES = -pwcat_LDFLAGS = -SCRIPTS = $(bin_SCRIPTS) - - -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/grcat.Po ./$(DEPDIR)/pwcat.Po -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -DIST_SOURCES = -DIST_COMMON = ChangeLog Makefile.am Makefile.in -SOURCES = $(nodist_grcat_SOURCES) $(nodist_pwcat_SOURCES) - all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) +$(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 awklib/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu awklib/Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) -libexecPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +.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-libexecPROGRAMS: $(libexec_PROGRAMS) @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(libexecdir) + test -z "$(libexecdir)" || $(mkdir_p) "$(DESTDIR)$(libexecdir)" @list='$(libexec_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) $(libexecPROGRAMS_INSTALL) $$p $(DESTDIR)$(libexecdir)/$$f"; \ - $(INSTALL_PROGRAM_ENV) $(libexecPROGRAMS_INSTALL) $$p $(DESTDIR)$(libexecdir)/$$f || exit 1; \ + echo " $(INSTALL_PROGRAM_ENV) $(libexecPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(libexecdir)/$$f'"; \ + $(INSTALL_PROGRAM_ENV) $(libexecPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(libexecdir)/$$f" || exit 1; \ else :; fi; \ done @@ -237,22 +280,21 @@ uninstall-libexecPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(libexec_PROGRAMS)'; for p in $$list; do \ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " rm -f $(DESTDIR)$(libexecdir)/$$f"; \ - rm -f $(DESTDIR)$(libexecdir)/$$f; \ + echo " rm -f '$(DESTDIR)$(libexecdir)/$$f'"; \ + rm -f "$(DESTDIR)$(libexecdir)/$$f"; \ done clean-libexecPROGRAMS: -test -z "$(libexec_PROGRAMS)" || rm -f $(libexec_PROGRAMS) -binSCRIPT_INSTALL = $(INSTALL_SCRIPT) install-binSCRIPTS: $(bin_SCRIPTS) @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(bindir) + test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" @list='$(bin_SCRIPTS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ if test -f $$d$$p; then \ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ - echo " $(binSCRIPT_INSTALL) $$d$$p $(DESTDIR)$(bindir)/$$f"; \ - $(binSCRIPT_INSTALL) $$d$$p $(DESTDIR)$(bindir)/$$f; \ + echo " $(binSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(bindir)/$$f'"; \ + $(binSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(bindir)/$$f"; \ else :; fi; \ done @@ -260,12 +302,12 @@ uninstall-binSCRIPTS: @$(NORMAL_UNINSTALL) @list='$(bin_SCRIPTS)'; for p in $$list; do \ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ - echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ - rm -f $(DESTDIR)$(bindir)/$$f; \ + echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ + rm -f "$(DESTDIR)$(bindir)/$$f"; \ done mostlyclean-compile: - -rm -f *.$(OBJEXT) core *.core + -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @@ -273,40 +315,23 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/grcat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pwcat.Po@am__quote@ -distclean-depend: - -rm -rf ./$(DEPDIR) - .c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< +@am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` uninstall-info-am: -ETAGS = etags -ETAGSFLAGS = - -CTAGS = ctags -CTAGSFLAGS = - -tags: TAGS - ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ @@ -315,6 +340,7 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique +tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) @@ -326,10 +352,11 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$tags$$unique" \ - || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique - + 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) @@ -352,10 +379,6 @@ GTAGS: distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = .. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ @@ -369,7 +392,7 @@ distdir: $(DISTFILES) dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ @@ -387,9 +410,10 @@ distdir: $(DISTFILES) check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) $(SCRIPTS) - installdirs: - $(mkinstalldirs) $(DESTDIR)$(libexecdir) $(DESTDIR)$(bindir) + for dir in "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(bindir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done install: install-am install-exec: install-exec-am install-data: install-data-am @@ -401,7 +425,7 @@ install-am: all-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - INSTALL_STRIP_FLAG=-s \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: @@ -409,24 +433,28 @@ mostlyclean-generic: clean-generic: distclean-generic: - -rm -f Makefile $(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 clean-libexecPROGRAMS clean-local mostlyclean-am +clean-am: clean-generic clean-libexecPROGRAMS clean-local \ + mostlyclean-am distclean: distclean-am - -distclean-am: clean-am distclean-compile distclean-depend \ - distclean-generic distclean-tags + -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: @@ -444,7 +472,8 @@ install-man: installcheck-am: maintainer-clean: maintainer-clean-am - + -rm -rf ./$(DEPDIR) + -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am @@ -464,10 +493,10 @@ uninstall-am: uninstall-binSCRIPTS uninstall-info-am \ .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libexecPROGRAMS clean-local ctags distclean \ - distclean-compile distclean-depend distclean-generic \ - distclean-tags distdir dvi dvi-am info info-am install \ - install-am install-binSCRIPTS install-data install-data-am \ - install-exec install-exec-am install-info install-info-am \ + distclean-compile distclean-generic distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-binSCRIPTS install-data install-data-am install-exec \ + install-exec-am install-info install-info-am \ install-libexecPROGRAMS install-man install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ diff --git a/awklib/eg/lib/strtonum.awk b/awklib/eg/lib/strtonum.awk new file mode 100644 index 000000000..a71341fba --- /dev/null +++ b/awklib/eg/lib/strtonum.awk @@ -0,0 +1,56 @@ +# strtonum --- convert string to number + +# +# Arnold Robbins, arnold@skeeve.com, Public Domain +# February, 2004 + +function mystrtonum(str, ret, chars, n, i, k, c) +{ + if (str ~ /^0[0-7]*$/) { + # octal + n = length(str) + ret = 0 + for (i = 1; i <= n; i++) { + c = substr(str, i, 1) + if ((k = index("01234567", c)) > 0) + k-- # adjust for 1-basing in awk + + ret = ret * 8 + k + } + } else if (str ~ /^0[xX][0-9a-fA-f]+/) { + # hexadecimal + str = substr(str, 3) # lop off leading 0x + n = length(str) + ret = 0 + for (i = 1; i <= n; i++) { + c = substr(str, i, 1) + c = tolower(c) + if ((k = index("0123456789", c)) > 0) + k-- # adjust for 1-basing in awk + else if ((k = index("abcdef", c)) > 0) + k += 9 + + ret = ret * 16 + k + } + } else if (str ~ /^[-+]?([0-9]+([.][0-9]*([Ee][0-9]+)?)?|([.][0-9]+([Ee][-+]?[0-9]+)?))$/) { + # decimal number, possibly floating point + ret = str + 0 + } else + ret = "NOT-A-NUMBER" + + return ret +} + +# BEGIN { # gawk test harness +# a[1] = "25" +# a[2] = ".31" +# a[3] = "0123" +# a[4] = "0xdeadBEEF" +# a[5] = "123.45" +# a[6] = "1.e3" +# a[7] = "1.32" +# a[7] = "1.32E2" +# +# for (i = 1; i in a; i++) +# print a[i], strtonum(a[i]), mystrtonum(a[i]) +# } diff --git a/builtin.c b/builtin.c index ebd6e6cf2..5306a5bda 100644 --- a/builtin.c +++ b/builtin.c @@ -3,7 +3,7 @@ */ /* - * Copyright (C) 1986, 1988, 1989, 1991-2003 the Free Software Foundation, Inc. + * Copyright (C) 1986, 1988, 1989, 1991-2004 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. @@ -28,7 +28,6 @@ #if defined(HAVE_FCNTL_H) #include #endif -#undef HUGE #undef CHARBITS #undef INTBITS #if HAVE_INTTYPES_H @@ -75,9 +74,22 @@ extern int output_is_tty; static NODE *sub_common P((NODE *tree, long how_many, int backdigs)); +#ifdef STDC_HEADERS +#include +#endif +/* Assume IEEE-754 arithmetic on pre-C89 hosts. */ +#ifndef FLT_RADIX +#define FLT_RADIX 2 +#endif +#ifndef FLT_MANT_DIG +#define FLT_MANT_DIG 24 +#endif +#ifndef DBL_MANT_DIG +#define DBL_MANT_DIG 53 +#endif + #ifdef _CRAY /* Work around a problem in conversion of doubles to exact integers. */ -#include #define Floor(n) floor((n) * (1.0 + DBL_EPSILON)) #define Ceil(n) ceil((n) * (1.0 + DBL_EPSILON)) @@ -242,6 +254,7 @@ strncasecmpmbs(const char *s1, mbstate_t mbs1, const char *s2, { int i1, i2, mbclen1, mbclen2, gap; wchar_t wc1, wc2; + for (i1 = i2 = 0 ; i1 < n && i2 < n ;i1 += mbclen1, i2 += mbclen2) { mbclen1 = mbrtowc(&wc1, s1 + i1, n - i1, &mbs1); if (mbclen1 == (size_t) -1 || mbclen1 == (size_t) -2 || mbclen1 == 0) { @@ -366,6 +379,10 @@ do_index(NODE *tree) p1 += mbclen; } else { #endif + /* + * Could use tolower(*p1) == tolower(*p2) here. See discussion + * in eval.c as to why not. + */ if (casetable[(unsigned char)*p1] == casetable[(unsigned char)*p2] && (l2 == 1 || strncasecmp(p1, p2, l2) == 0)) { ret = 1 + s1->stlen - l1; @@ -565,6 +582,8 @@ format_tree( char signchar = FALSE; size_t len; int zero_flag = FALSE; + int quote_flag = FALSE; + int ii, jj; static const char sp[] = " "; static const char zero_string[] = "0"; static const char lchbuf[] = "0123456789abcdef"; @@ -765,7 +784,10 @@ format_tree( s1++; n0--; } - + if (val >= num_args) { + toofew = TRUE; + break; + } arg = the_args[val]; } else { parse_next_arg(); @@ -811,6 +833,11 @@ format_tree( case '#': alt = TRUE; goto check_pos; +#if ENABLE_NLS && defined(HAVE_LOCALE_H) + case '\'': + quote_flag = TRUE; + goto check_pos; +#endif case 'l': if (big) break; @@ -920,8 +947,22 @@ format_tree( sgn = FALSE; uval = (uintmax_t) tmpval; } + ii = jj = 0; do { *--cp = (char) ('0' + uval % 10); +#if ENABLE_NLS && defined(HAVE_LOCALE_H) + if (quote_flag && loc.grouping[ii] && ++jj == loc.grouping[ii]) { + *--cp = loc.thousands_sep[0]; /* XXX - assumption it's one char */ + if (loc.grouping[ii+1] == 0) + jj = 0; /* keep using current val in loc.grouping[ii] */ + else if (loc.grouping[ii+1] == CHAR_MAX) + quote_flag = FALSE; + else { + ii++; + jj = 0; + } + } +#endif uval /= 10; } while (uval > 0); @@ -1007,8 +1048,23 @@ format_tree( && ((zero_flag && ! have_prec) || (fw == 0 && have_prec))) fill = zero_string; + + ii = jj = 0; do { *--cp = chbuf[uval % base]; +#if ENABLE_NLS && defined(HAVE_LOCALE_H) + if (base == 10 && quote_flag && loc.grouping[ii] && ++jj == loc.grouping[ii]) { + *--cp = loc.thousands_sep[0]; /* XXX --- assumption it's one char */ + if (loc.grouping[ii+1] == 0) + jj = 0; /* keep using current val in loc.grouping[ii] */ + else if (loc.grouping[ii+1] == CHAR_MAX) + quote_flag = FALSE; + else { + ii++; + jj = 0; + } + } +#endif uval /= base; } while (uval > 0); @@ -1057,6 +1113,11 @@ format_tree( cs1 = 'g'; goto format_float; + case 'F': +#if ! defined(PRINTF_HAS_F_FORMAT) || PRINTF_HAS_F_FORMAT != 1 + cs1 = 'f'; + /* FALL THROUGH */ +#endif case 'g': case 'G': case 'e': @@ -1080,6 +1141,8 @@ format_tree( *cp++ = '#'; if (zero_flag) *cp++ = '0'; + if (quote_flag) + *cp++ = '\''; strcpy(cp, "*.*"); cp += 3; *cp++ = cs1; @@ -1164,7 +1227,7 @@ redirect_to_fp(NODE *tree, struct redirect **rpp) rp = redirect(tree, &errflg); if (rp != NULL) { *rpp = rp; - return rp->fp; + return rp->fp; } return NULL; @@ -1745,7 +1808,7 @@ do_cos(NODE *tree) /* do_rand --- do the rand function */ static int firstrand = TRUE; -static char state[512]; +static char state[256]; /* ARGSUSED */ NODE * @@ -1753,8 +1816,9 @@ do_rand(NODE *tree ATTRIBUTE_UNUSED) { if (firstrand) { (void) initstate((unsigned) 1, state, sizeof state); - srandom(1); + /* don't need to srandom(1), initstate() does it for us. */ firstrand = FALSE; + setstate(state); } /* * Per historical practice and POSIX, return value N is @@ -1777,8 +1841,8 @@ do_srand(NODE *tree) (void) initstate((unsigned) 1, state, sizeof state); /* don't need to srandom(1), we're changing the seed below */ firstrand = FALSE; - } else (void) setstate(state); + } if (tree == NULL) srandom((unsigned int) (save_seed = (long) time((time_t *) 0))); @@ -1944,7 +2008,7 @@ do_match(NODE *tree) * } * if (length(str) == 0) * if (eosflag) - * break; + * break * else * eosflag = TRUE * } @@ -1955,6 +2019,33 @@ do_match(NODE *tree) * } */ +/* + * 1/2004: The gawk sub/gsub behavior dates from 1996, when we proposed it + * for POSIX. The proposal fell through the cracks, and the 2001 POSIX + * standard chose a more simple behavior. + * + * The relevant text is to be found on lines 6394-6407 (pages 166, 167) of the + * 2001 standard: + * + * sub(ere, repl[, in ]) + * Substitute the string repl in place of the first instance of the extended regular + * expression ERE in string in and return the number of substitutions. An ampersand + * ('&') appearing in the string repl shall be replaced by the string from in that + * matches the ERE. An ampersand preceded with a backslash ('\') shall be + * interpreted as the literal ampersand character. An occurrence of two consecutive + * backslashes shall be interpreted as just a single literal backslash character. Any + * other occurrence of a backslash (for example, preceding any other character) shall + * be treated as a literal backslash character. Note that if repl is a string literal (the + * lexical token STRING; see Grammar (on page 170)), the handling of the + * ampersand character occurs after any lexical processing, including any lexical + * backslash escape sequence processing. If in is specified and it is not an lvalue (see + * Expressions in awk (on page 156)), the behavior is undefined. If in is omitted, awk + * shall use the current record ($0) in its place. + * + * Because gawk has had its behavior for 7+ years, that behavior is remaining as + * the default, with the POSIX behavior available for do_posix. Fun, fun, fun. + */ + /* * NB: `howmany' conflicts with a SunOS 4.x macro in . */ @@ -2068,7 +2159,15 @@ sub_common(NODE *tree, long how_many, int backdigs) repllen--; scan++; } - } else { /* (proposed) posix '96 mode */ + } else if (do_posix) { + /* \& --> &, \\ --> \ */ + if (scan[1] == '&' || scan[1] == '\\') { + repllen--; + scan++; + } /* else + leave alone, it goes into the output */ + } else { + /* gawk default behavior since 1996 */ if (strncmp(scan, "\\\\\\&", 4) == 0) { /* \\\& --> \& */ repllen -= 2; @@ -2130,22 +2229,24 @@ sub_common(NODE *tree, long how_many, int backdigs) * making substitutions as we go. */ for (scan = repl; scan < replend; scan++) + if (*scan == '&' #ifdef MBS_SUPPORT - if ((gawk_mb_cur_max == 1 - || (repllen > 0 && mb_indices[scan - repl] == 1)) - && (*scan == '&')) -#else - if (*scan == '&') + /* + * Don't test repllen here. A simple "&" could + * end up with repllen == 0. + */ + && (gawk_mb_cur_max == 1 + || mb_indices[scan - repl] == 1) #endif + ) { for (cp = matchstart; cp < matchend; cp++) *bp++ = *cp; + } else if (*scan == '\\' #ifdef MBS_SUPPORT - else if ((gawk_mb_cur_max == 1 + && (gawk_mb_cur_max == 1 || (repllen > 0 && mb_indices[scan - repl] == 1)) - && (*scan == '\\')) { -#else - else if (*scan == '\\') { #endif + ) { if (backdigs) { /* gensub, behave sanely */ if (ISDIGIT(scan[1])) { int dig = scan[1] - '0'; @@ -2161,7 +2262,13 @@ sub_common(NODE *tree, long how_many, int backdigs) scan++; } else /* \q for any q --> q */ *bp++ = *++scan; - } else { /* posix '96 mode, bleah */ + } else if (do_posix) { + /* \& --> &, \\ --> \ */ + if (scan[1] == '&' || scan[1] == '\\') + scan++; + *bp++ = *scan; + } else { + /* gawk default behavior since 1996 */ if (strncmp(scan, "\\\\\\&", 4) == 0) { /* \\\& --> \& */ *bp++ = '\\'; @@ -2397,6 +2504,58 @@ sgfmt(char *buf, /* return buffer; assumed big enough to hold result */ } #endif /* GFMT_WORKAROUND */ +/* + * The number of base-FLT_RADIX digits in an AWKNUM fraction, assuming + * that AWKNUM is not long double. + */ +#define AWKSMALL_MANT_DIG \ + (sizeof (AWKNUM) == sizeof (double) ? DBL_MANT_DIG : FLT_MANT_DIG) + +/* + * The number of base-FLT_DIGIT digits in an AWKNUM fraction, even if + * AWKNUM is long double. Don't mention 'long double' unless + * LDBL_MANT_DIG is defined, for the sake of ancient compilers that + * lack 'long double'. + */ +#ifdef LDBL_MANT_DIG +#define AWKNUM_MANT_DIG \ + (sizeof (AWKNUM) == sizeof (long double) ? LDBL_MANT_DIG : AWKSMALL_MANT_DIG) +#else +#define AWKNUM_MANT_DIG AWKSMALL_MANT_DIG +#endif + +/* + * The number of bits in an AWKNUM fraction, assuming FLT_RADIX is + * either 2 or 16. IEEE and VAX formats use radix 2, and IBM + * mainframe format uses radix 16; we know of no other radices in + * practical use. + */ +#if FLT_RADIX != 2 && FLT_RADIX != 16 +Please port the following code to your weird host; +#endif +#define AWKNUM_FRACTION_BITS (AWKNUM_MANT_DIG * (FLT_RADIX == 2 ? 1 : 4)) + +/* tmp_integer - Convert an integer to a temporary number node. */ + +static NODE * +tmp_integer(uintmax_t n) +{ +#ifdef HAVE_UINTMAX_T + /* + * If uintmax_t is so wide that AWKNUM cannot represent all its + * values, strip leading nonzero bits of integers that are so large + * that they cannot be represented exactly as AWKNUMs, so that their + * low order bits are represented exactly, without rounding errors. + * This is more desirable in practice, since it means the user sees + * integers that are the same width as the AWKNUM fractions. + */ + if (AWKNUM_FRACTION_BITS < CHAR_BIT * sizeof n) + n &= ((uintmax_t) 1 << AWKNUM_FRACTION_BITS) - 1; +#endif /* HAVE_UINTMAX_T */ + + return tmp_number((AWKNUM) n); +} + /* do_lshift --- perform a << operation */ NODE * @@ -2408,14 +2567,15 @@ do_lshift(NODE *tree) s1 = tree_eval(tree->lnode); s2 = tree_eval(tree->rnode->lnode); - val = force_number(s1); - shift = force_number(s2); - if (do_lint) { if ((s1->flags & (NUMCUR|NUMBER)) == 0) lintwarn(_("lshift: received non-numeric first argument")); if ((s2->flags & (NUMCUR|NUMBER)) == 0) - lintwarn(_("lshift: received non-numeric first argument")); + lintwarn(_("lshift: received non-numeric second argument")); + } + val = force_number(s1); + shift = force_number(s2); + if (do_lint) { if (val < 0 || shift < 0) lintwarn(_("lshift(%lf, %lf): negative values will give strange results"), val, shift); if (double_to_int(val) != val || double_to_int(shift) != shift) @@ -2431,7 +2591,7 @@ do_lshift(NODE *tree) ushift = (uintmax_t) shift; res = uval << ushift; - return tmp_number((AWKNUM) res); + return tmp_integer(res); } /* do_rshift --- perform a >> operation */ @@ -2445,14 +2605,15 @@ do_rshift(NODE *tree) s1 = tree_eval(tree->lnode); s2 = tree_eval(tree->rnode->lnode); - val = force_number(s1); - shift = force_number(s2); - if (do_lint) { if ((s1->flags & (NUMCUR|NUMBER)) == 0) lintwarn(_("rshift: received non-numeric first argument")); if ((s2->flags & (NUMCUR|NUMBER)) == 0) - lintwarn(_("rshift: received non-numeric first argument")); + lintwarn(_("rshift: received non-numeric second argument")); + } + val = force_number(s1); + shift = force_number(s2); + if (do_lint) { if (val < 0 || shift < 0) lintwarn(_("rshift(%lf, %lf): negative values will give strange results"), val, shift); if (double_to_int(val) != val || double_to_int(shift) != shift) @@ -2468,7 +2629,7 @@ do_rshift(NODE *tree) ushift = (uintmax_t) shift; res = uval >> ushift; - return tmp_number((AWKNUM) res); + return tmp_integer(res); } /* do_and --- perform an & operation */ @@ -2482,14 +2643,15 @@ do_and(NODE *tree) s1 = tree_eval(tree->lnode); s2 = tree_eval(tree->rnode->lnode); - left = force_number(s1); - right = force_number(s2); - if (do_lint) { if ((s1->flags & (NUMCUR|NUMBER)) == 0) lintwarn(_("and: received non-numeric first argument")); if ((s2->flags & (NUMCUR|NUMBER)) == 0) - lintwarn(_("and: received non-numeric first argument")); + lintwarn(_("and: received non-numeric second argument")); + } + left = force_number(s1); + right = force_number(s2); + if (do_lint) { if (left < 0 || right < 0) lintwarn(_("and(%lf, %lf): negative values will give strange results"), left, right); if (double_to_int(left) != left || double_to_int(right) != right) @@ -2503,7 +2665,7 @@ do_and(NODE *tree) uright = (uintmax_t) right; res = uleft & uright; - return tmp_number((AWKNUM) res); + return tmp_integer(res); } /* do_or --- perform an | operation */ @@ -2517,14 +2679,15 @@ do_or(NODE *tree) s1 = tree_eval(tree->lnode); s2 = tree_eval(tree->rnode->lnode); - left = force_number(s1); - right = force_number(s2); - if (do_lint) { if ((s1->flags & (NUMCUR|NUMBER)) == 0) lintwarn(_("or: received non-numeric first argument")); if ((s2->flags & (NUMCUR|NUMBER)) == 0) - lintwarn(_("or: received non-numeric first argument")); + lintwarn(_("or: received non-numeric second argument")); + } + left = force_number(s1); + right = force_number(s2); + if (do_lint) { if (left < 0 || right < 0) lintwarn(_("or(%lf, %lf): negative values will give strange results"), left, right); if (double_to_int(left) != left || double_to_int(right) != right) @@ -2538,7 +2701,7 @@ do_or(NODE *tree) uright = (uintmax_t) right; res = uleft | uright; - return tmp_number((AWKNUM) res); + return tmp_integer(res); } /* do_xor --- perform an ^ operation */ @@ -2552,14 +2715,15 @@ do_xor(NODE *tree) s1 = tree_eval(tree->lnode); s2 = tree_eval(tree->rnode->lnode); - left = force_number(s1); - right = force_number(s2); - if (do_lint) { if ((s1->flags & (NUMCUR|NUMBER)) == 0) lintwarn(_("xor: received non-numeric first argument")); if ((s2->flags & (NUMCUR|NUMBER)) == 0) - lintwarn(_("xor: received non-numeric first argument")); + lintwarn(_("xor: received non-numeric second argument")); + } + left = force_number(s1); + right = force_number(s2); + if (do_lint) { if (left < 0 || right < 0) lintwarn(_("xor(%lf, %lf): negative values will give strange results"), left, right); if (double_to_int(left) != left || double_to_int(right) != right) @@ -2573,7 +2737,7 @@ do_xor(NODE *tree) uright = (uintmax_t) right; res = uleft ^ uright; - return tmp_number((AWKNUM) res); + return tmp_integer(res); } /* do_compl --- perform a ~ operation */ @@ -2586,12 +2750,12 @@ do_compl(NODE *tree) uintmax_t uval; tmp = tree_eval(tree->lnode); + if (do_lint && (tmp->flags & (NUMCUR|NUMBER)) == 0) + lintwarn(_("compl: received non-numeric argument")); d = force_number(tmp); free_temp(tmp); if (do_lint) { - if ((tmp->flags & (NUMCUR|NUMBER)) == 0) - lintwarn(_("compl: received non-numeric argument")); if (d < 0) lintwarn(_("compl(%lf): negative value will give strange results"), d); if (double_to_int(d) != d) @@ -2600,7 +2764,7 @@ do_compl(NODE *tree) uval = (uintmax_t) d; uval = ~ uval; - return tmp_number((AWKNUM) uval); + return tmp_integer(uval); } /* do_strtonum --- the strtonum function */ diff --git a/config.guess b/config.guess index 4fc21ecc3..a6d8a945f 100755 --- a/config.guess +++ b/config.guess @@ -1,9 +1,9 @@ #! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. -timestamp='2003-01-30' +timestamp='2004-06-24' # 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 @@ -53,7 +53,7 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO @@ -106,6 +106,7 @@ 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 -q "$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" ; @@ -196,15 +197,24 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit 0 ;; + amd64:OpenBSD:*:*) + echo x86_64-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; amiga:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; arc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; + cats:OpenBSD:*:*) + echo arm-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; hp300:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; + luna88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; mac68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; @@ -235,13 +245,24 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:OpenBSD:*:*) echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} exit 0 ;; - *:MicroBSD:*:*) - echo ${UNAME_MACHINE}-unknown-microbsd${UNAME_RELEASE} + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit 0 ;; + macppc:MirBSD:*:*) + echo powerppc-unknown-mirbsd${UNAME_RELEASE} + exit 0 ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit 0 ;; alpha:OSF1:*:*) - if test $UNAME_RELEASE = "V4.0"; then + case $UNAME_RELEASE in + *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - fi + ;; + *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 @@ -279,11 +300,12 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in "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/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit 0 ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? @@ -306,6 +328,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:OS/390:*:*) echo i370-ibm-openedition exit 0 ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit 0 ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit 0;; @@ -323,6 +348,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit 0 ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit 0 ;; DRS?6000:UNIX_SV:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7 && exit 0 ;; @@ -395,6 +423,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit 0 ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit 0 ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit 0 ;; @@ -730,7 +761,7 @@ EOF echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; *:UNICOS/mp:*:*) - echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` @@ -738,6 +769,11 @@ EOF FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit 0 ;; + 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 0 ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit 0 ;; @@ -748,18 +784,7 @@ EOF echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:FreeBSD:*:*) - # Determine whether the default compiler uses glibc. - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - #if __GLIBC__ >= 2 - LIBC=gnu - #else - LIBC= - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit 0 ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin @@ -770,8 +795,8 @@ EOF i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit 0 ;; - x86:Interix*:3*) - echo i586-pc-interix3 + x86:Interix*:[34]*) + echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' exit 0 ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks @@ -792,17 +817,28 @@ EOF echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; *:GNU:*:*) + # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit 0 ;; + *: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 0 ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit 0 ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; + cris:Linux:*:*) + echo cris-axis-linux-gnu + exit 0 ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; @@ -878,6 +914,9 @@ EOF s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit 0 ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; @@ -935,6 +974,9 @@ EOF LIBC=gnuaout #endif #endif + #ifdef __dietlibc__ + LIBC=dietlibc + #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 @@ -965,6 +1007,9 @@ EOF i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit 0 ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit 0 ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit 0 ;; @@ -1034,9 +1079,9 @@ EOF M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit 0 ;; - M68*:*:R3V[567]*:*) + M68*:*:R3V[5678]*:*) test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; - 3[34]??:*: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) + 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) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` @@ -1151,7 +1196,7 @@ EOF *:QNX:*:4*) echo i386-pc-qnx exit 0 ;; - NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*) + NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit 0 ;; *:NonStop-UX:*:*) @@ -1192,6 +1237,19 @@ EOF *:ITS:*:*) echo pdp10-unknown-its exit 0 ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + exit 0 ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit 0 ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms && exit 0 ;; + I*) echo ia64-dec-vms && exit 0 ;; + V*) echo vax-dec-vms && exit 0 ;; + esac esac #echo '(No uname command or uname output not recognized.)' 1>&2 diff --git a/config.rpath b/config.rpath index fa24bfc2d..4db13e50f 100755 --- a/config.rpath +++ b/config.rpath @@ -143,7 +143,7 @@ if test "$with_gnu_ld" = yes; then ld_shlibs=no ;; beos*) - if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then : else ld_shlibs=no @@ -162,9 +162,9 @@ if test "$with_gnu_ld" = yes; then netbsd*) ;; solaris* | sysv5*) - if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then ld_shlibs=no - elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then : else ld_shlibs=no @@ -174,7 +174,7 @@ if test "$with_gnu_ld" = yes; then hardcode_direct=yes ;; *) - if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then : else ld_shlibs=no diff --git a/config.sub b/config.sub index 5f94062aa..ac6de9869 100755 --- a/config.sub +++ b/config.sub @@ -1,9 +1,9 @@ #! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. -timestamp='2003-02-03' +timestamp='2004-06-24' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -70,7 +70,7 @@ Report bugs and patches to ." version="\ GNU config.sub ($timestamp) -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO @@ -118,7 +118,8 @@ esac # 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* | freebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) + nto-qnx* | linux-gnu* | linux-dietlibc | 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/'` ;; @@ -144,7 +145,7 @@ case $os in -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) + -apple | -axis | -knuth | -cray) os= basic_machine=$1 ;; @@ -228,14 +229,15 @@ case $basic_machine in | 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 \ - | clipper \ + | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ - | ip2k \ - | m32r | m68000 | m68k | m88k | mcore \ + | ip2k | iq2000 \ + | m32r | m32rle | m68000 | m68k | m88k | mcore \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ @@ -247,6 +249,7 @@ case $basic_machine in | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ @@ -259,9 +262,9 @@ case $basic_machine in | pyramid \ | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ - | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ + | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv8 | sparcv9 | sparcv9b \ | strongarm \ - | tahoe | thumb | tic80 | tron \ + | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ | x86 | xscale | xstormy16 | xtensa \ @@ -297,15 +300,15 @@ case $basic_machine in | avr-* \ | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ - | clipper-* | cydra-* \ + | 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-* \ - | m32r-* \ + | ip2k-* | iq2000-* \ + | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ @@ -319,11 +322,13 @@ case $basic_machine in | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ + | mmix-* \ | msp430-* \ - | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ @@ -332,7 +337,7 @@ case $basic_machine in | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ - | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tron-* \ @@ -359,6 +364,9 @@ case $basic_machine in basic_machine=a29k-amd os=-udi ;; + abacus) + basic_machine=abacus-unknown + ;; adobe68k) basic_machine=m68010-adobe os=-scout @@ -373,6 +381,12 @@ case $basic_machine in 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 @@ -432,12 +446,24 @@ case $basic_machine in 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 ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; da30 | da30-*) basic_machine=m68k-da30 ;; @@ -638,10 +664,6 @@ case $basic_machine in mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; - mmix*) - basic_machine=mmix-knuth - os=-mmixware - ;; monitor) basic_machine=m68k-rom68k os=-coff @@ -722,10 +744,6 @@ case $basic_machine in np1) basic_machine=np1-gould ;; - nv1) - basic_machine=nv1-cray - os=-unicosmp - ;; nsr-tandem) basic_machine=nsr-tandem ;; @@ -737,6 +755,10 @@ case $basic_machine in basic_machine=or32-unknown os=-coff ;; + os400) + basic_machine=powerpc-ibm + os=-os400 + ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose @@ -768,18 +790,24 @@ case $basic_machine in pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; - pentiumii | pentium2) + 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-*) + 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 ;; @@ -838,6 +866,10 @@ case $basic_machine in sb1el) basic_machine=mipsisa64sb1el-unknown ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; sequent) basic_machine=i386-sequent ;; @@ -845,6 +877,9 @@ case $basic_machine in basic_machine=sh-hitachi os=-hms ;; + sh64) + basic_machine=sh64-unknown + ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks @@ -919,10 +954,6 @@ case $basic_machine in basic_machine=t90-cray os=-unicos ;; - tic4x | c4x*) - basic_machine=tic4x-unknown - os=-coff - ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff @@ -948,6 +979,10 @@ case $basic_machine in tower | tower-32) basic_machine=m68k-ncr ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; udi29k) basic_machine=a29k-amd os=-udi @@ -1021,6 +1056,9 @@ case $basic_machine in romp) basic_machine=romp-ibm ;; + mmix) + basic_machine=mmix-knuth + ;; rs6000) basic_machine=rs6000-ibm ;; @@ -1043,7 +1081,7 @@ case $basic_machine in sh64) basic_machine=sh64-unknown ;; - sparc | sparcv9 | sparcv9b) + sparc | sparcv8 | sparcv9 | sparcv9b) basic_machine=sparc-sun ;; cydra) @@ -1116,19 +1154,20 @@ case $os in | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ - | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \ + | -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* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -mingw32* | -linux-gnu* | -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* | -microbsd*) + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1152,6 +1191,9 @@ case $os in -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; + -linux-dietlibc) + os=-linux-dietlibc + ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; @@ -1164,6 +1206,9 @@ case $os in -opened*) os=-openedition ;; + -os400*) + os=-os400 + ;; -wince*) os=-wince ;; @@ -1185,6 +1230,9 @@ case $os in -atheos*) os=-atheos ;; + -syllable*) + os=-syllable + ;; -386bsd) os=-bsd ;; @@ -1207,6 +1255,9 @@ case $os in -sinix*) os=-sysv4 ;; + -tpf*) + os=-tpf + ;; -triton*) os=-sysv3 ;; @@ -1274,6 +1325,9 @@ case $basic_machine in arm*-semi) os=-aout ;; + c4x-* | tic4x-*) + os=-coff + ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 @@ -1320,6 +1374,9 @@ case $basic_machine in *-ibm) os=-aix ;; + *-knuth) + os=-mmixware + ;; *-wec) os=-proelf ;; @@ -1452,9 +1509,15 @@ case $basic_machine in -mvs* | -opened*) vendor=ibm ;; + -os400*) + vendor=ibm + ;; -ptx*) vendor=sequent ;; + -tpf*) + vendor=ibm + ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; diff --git a/configh.in b/configh.in index 917559b70..612f79256 100644 --- a/configh.in +++ b/configh.in @@ -38,31 +38,48 @@ /* Define to 1 if you have the header file. */ #undef HAVE_ARGZ_H +/* Define to 1 if you have the `asprintf' function. */ +#undef HAVE_ASPRINTF + /* Define if the GNU dcgettext() function is already present or preinstalled. */ #undef HAVE_DCGETTEXT +/* Define to 1 if you have the declaration of `feof_unlocked', and to 0 if you + don't. */ +#undef HAVE_DECL_FEOF_UNLOCKED + +/* Define to 1 if you have the declaration of `fgets_unlocked', and to 0 if + you don't. */ +#undef HAVE_DECL_FGETS_UNLOCKED + +/* Define to 1 if you have the declaration of `getc_unlocked', and to 0 if you + don't. */ +#undef HAVE_DECL_GETC_UNLOCKED + +/* Define to 1 if you have the declaration of `_snprintf', and to 0 if you + don't. */ +#undef HAVE_DECL__SNPRINTF + +/* Define to 1 if you have the declaration of `_snwprintf', and to 0 if you + don't. */ +#undef HAVE_DECL__SNWPRINTF + /* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ #undef HAVE_DOPRNT /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H -/* 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 `fmod' function. */ #undef HAVE_FMOD +/* Define to 1 if you have the `fwprintf' function. */ +#undef HAVE_FWPRINTF + /* Define to 1 if you have the `getcwd' function. */ #undef HAVE_GETCWD -/* Define to 1 if you have the `getc_unlocked' function. */ -#undef HAVE_GETC_UNLOCKED - /* Define to 1 if you have the `getegid' function. */ #undef HAVE_GETEGID @@ -93,9 +110,19 @@ /* Define if you have the iconv() function. */ #undef HAVE_ICONV +/* Define if you have the 'intmax_t' type in or . */ +#undef HAVE_INTMAX_T + /* Define if exists and doesn't clash with . */ #undef HAVE_INTTYPES_H +/* Define if exists, doesn't clash with , and + declares uintmax_t. */ +#undef HAVE_INTTYPES_H_WITH_UINTMAX + +/* Define to 1 if you have the `iswctype' function. */ +#undef HAVE_ISWCTYPE + /* Define if you have and nl_langinfo(CODESET). */ #undef HAVE_LANGINFO_CODESET @@ -117,7 +144,10 @@ /* Define to 1 if you have the header file. */ #undef HAVE_LOCALE_H -/* Define if you have the long long type. */ +/* Define if you have the 'long double' type. */ +#undef HAVE_LONG_DOUBLE + +/* Define if you have the 'long long' type. */ #undef HAVE_LONG_LONG /* Define to 1 if you have the header file. */ @@ -126,7 +156,7 @@ /* Define to 1 if you have the `mbrlen' function. */ #undef HAVE_MBRLEN -/* Define to 1 if you have the `mbrtowc' function. */ +/* Define to 1 if mbrtowc and mbstate_t are properly declared. */ #undef HAVE_MBRTOWC /* Define to 1 if you have the header file. */ @@ -138,6 +168,9 @@ /* Define to 1 if you have the `memcpy' function. */ #undef HAVE_MEMCPY +/* 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 @@ -168,6 +201,9 @@ /* we have portals on /p on this system */ #undef HAVE_PORTALS +/* Define if your printf() function supports format strings with positions. */ +#undef HAVE_POSIX_PRINTF + /* Define to 1 if you have the `putenv' function. */ #undef HAVE_PUTENV @@ -195,6 +231,10 @@ /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H +/* Define if exists, doesn't clash with , and declares + uintmax_t. */ +#undef HAVE_STDINT_H_WITH_UINTMAX + /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H @@ -285,10 +325,13 @@ /* Define to 1 if you have the `tzset' function. */ #undef HAVE_TZSET +/* Define if you have the 'uintmax_t' type in or . */ +#undef HAVE_UINTMAX_T + /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H -/* Define if you have the unsigned long long type. */ +/* Define if you have the 'unsigned long long' type. */ #undef HAVE_UNSIGNED_LONG_LONG /* Define to 1 if you have the `vprintf' function. */ @@ -297,15 +340,30 @@ /* Define to 1 if you have the header file. */ #undef HAVE_WCHAR_H +/* Define if you have the 'wchar_t' type. */ +#undef HAVE_WCHAR_T + /* 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 `wcslen' function. */ +#undef HAVE_WCSLEN + +/* 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 +/* systems should define this type here */ +#undef HAVE_WCTYPE_T + +/* Define if you have the 'wint_t' type. */ +#undef HAVE_WINT_T + /* Define to 1 if you have the `__argz_count' function. */ #undef HAVE___ARGZ_COUNT @@ -345,27 +403,31 @@ /* Define to the version of this package. */ #undef PACKAGE_VERSION +/* Define to 1 if *printf supports %F format */ +#undef PRINTF_HAS_F_FORMAT + /* Define if exists and defines unusable PRI* macros. */ #undef PRI_MACROS_BROKEN -/* Define if compiler has function prototypes */ +/* Define to 1 if the C compiler supports function prototypes. */ #undef PROTOTYPES -/* use malloc instead of alloca in regex.c */ -#undef REGEX_MALLOC - /* Define as the return type of signal handlers (`int' or `void'). */ #undef RETSIGTYPE +/* Define as the maximum value of type 'size_t', if the system doesn't define + it. */ +#undef SIZE_MAX + /* return type of sprintf */ #undef SPRINTF_RET /* 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 run-time. - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown */ + 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 you have the ANSI C header files. */ @@ -417,15 +479,20 @@ # undef __CHAR_UNSIGNED__ #endif +/* Define like PROTOTYPES; this can be used by system headers. */ +#undef __PROTOTYPES + /* Define to empty if `const' does not conform to ANSI C. */ #undef const /* Define to `int' if doesn't define. */ #undef gid_t -/* Define as `__inline' if that's what the C compiler calls it, or to nothing - if it is not supported. */ +/* 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 widest signed type if doesn't define. */ #undef intmax_t @@ -436,6 +503,13 @@ /* Define to `int' if does not define. */ #undef pid_t +/* Define as the type of the result of subtracting two pointers, if the system + doesn't define it. */ +#undef ptrdiff_t + +/* Define to empty if the C compiler doesn't support this keyword. */ +#undef signed + /* Define to `unsigned' if does not define. */ #undef size_t @@ -445,5 +519,6 @@ /* Define to `int' if doesn't define. */ #undef uid_t -/* Define to widest unsigned type if doesn't define. */ +/* Define to unsigned long or unsigned long long if and + don't define. */ #undef uintmax_t diff --git a/configure b/configure index 9f10d0a50..149836f9d 100755 --- a/configure +++ b/configure @@ -1,11 +1,10 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.57 for GNU Awk 3.1.3. +# Generated by GNU Autoconf 2.59 for GNU Awk 3.1.4. # # Report bugs to . # -# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 -# Free Software Foundation, Inc. +# Copyright (C) 2003 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## @@ -22,9 +21,10 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi +DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. -if (FOO=FOO; unset FOO) >/dev/null 2>&1; then +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false @@ -43,7 +43,7 @@ for as_var in \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do - if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then + 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 @@ -220,16 +220,17 @@ rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else + test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. -as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" +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="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS @@ -268,8 +269,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='GNU Awk' PACKAGE_TARNAME='gawk' -PACKAGE_VERSION='3.1.3' -PACKAGE_STRING='GNU Awk 3.1.3' +PACKAGE_VERSION='3.1.4' +PACKAGE_STRING='GNU Awk 3.1.4' PACKAGE_BUGREPORT='bug-gawk@gnu.org' # Factoring default headers for most tests. @@ -309,7 +310,7 @@ ac_includes_default="\ # 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 datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE am__leading_dot EGREP YACC LN_S 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 CPP RANLIB ac_ct_RANLIB U ANSI2KNR MKINSTALLDIRS USE_NLS MSGFMT GMSGFMT XGETTEXT MSGMERGE build build_cpu build_vendor build_os host host_cpu host_vendor host_os ALLOCA GLIBC21 LIBICONV LTLIBICONV INTLBISON BUILD_INCLUDED_LIBINTL USE_INCLUDED_LIBINTL CATOBJEXT DATADIRNAME INSTOBJEXT GENCAT INTLOBJS INTL_LIBTOOL_SUFFIX_PREFIX INTLLIBS LIBINTL LTLIBINTL POSUB LIBOBJS SOCKET_LIBS LTLIBOBJS' +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 datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot EGREP YACC LN_S 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 CPP RANLIB ac_ct_RANLIB U ANSI2KNR MKINSTALLDIRS USE_NLS MSGFMT GMSGFMT XGETTEXT MSGMERGE build build_cpu build_vendor build_os host host_cpu host_vendor host_os ALLOCA GLIBC21 HAVE_POSIX_PRINTF HAVE_ASPRINTF HAVE_SNPRINTF HAVE_WPRINTF LIBICONV LTLIBICONV INTLBISON BUILD_INCLUDED_LIBINTL USE_INCLUDED_LIBINTL CATOBJEXT DATADIRNAME INSTOBJEXT GENCAT INTLOBJS INTL_LIBTOOL_SUFFIX_PREFIX INTLLIBS LIBINTL LTLIBINTL POSUB LIBOBJS SOCKET_LIBS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -668,7 +669,7 @@ done # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ - localstatedir libdir includedir oldincludedir infodir mandir + localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo $ac_var` case $ac_val in @@ -708,10 +709,10 @@ if test -z "$srcdir"; then # Try the directory containing this script, then its parent. ac_confdir=`(dirname "$0") 2>/dev/null || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$0" : 'X\(//\)[^/]' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } @@ -778,7 +779,7 @@ 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 Awk 3.1.3 to adapt to many kinds of systems. +\`configure' configures GNU Awk 3.1.4 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -803,9 +804,9 @@ _ACEOF cat <<_ACEOF Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] + [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] + [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify @@ -844,7 +845,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of GNU Awk 3.1.3:";; + short | recursive ) echo "Configuration of GNU Awk 3.1.4:";; esac cat <<\_ACEOF @@ -854,8 +855,8 @@ Optional Features: --enable-portals Enable /p as path prefix for portals --disable-lint Disable gawk lint checking --enable-switch Enable switch statements for awk programs - --disable-dependency-tracking Speeds up one-time builds - --enable-dependency-tracking Do not reject slow dependency extractors + --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 --disable-rpath do not hardcode runtime library paths @@ -917,12 +918,45 @@ case $srcdir in ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac -# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be -# absolute. -ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` -ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` -ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` -ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac cd $ac_dir # Check for guested configure; otherwise get Cygnus style configure. @@ -933,7 +967,7 @@ ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` echo $SHELL $ac_srcdir/configure --help=recursive elif test -f $ac_srcdir/configure.ac || - test -f $ac_srcdir/configure.in; then + test -f $ac_srcdir/configure.in; then echo $ac_configure --help else @@ -946,11 +980,10 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -GNU Awk configure 3.1.3 -generated by GNU Autoconf 2.57 +GNU Awk configure 3.1.4 +generated by GNU Autoconf 2.59 -Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 -Free Software Foundation, Inc. +Copyright (C) 2003 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -961,8 +994,8 @@ cat >&5 <<_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 Awk $as_me 3.1.3, which was -generated by GNU Autoconf 2.57. Invocation command line was +It was created by GNU Awk $as_me 3.1.4, which was +generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ @@ -1039,19 +1072,19 @@ do 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. + 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 + 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_sep'$ac_arg'" # Get rid of the leading space. @@ -1085,12 +1118,12 @@ _ASBOX case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ - "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } @@ -1119,7 +1152,7 @@ _ASBOX for ac_var in $ac_subst_files do eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" + echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo fi @@ -1138,7 +1171,7 @@ _ASBOX echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 - rm -f core core.* *.core && + rm -f core *.core && rm -rf conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 @@ -1218,7 +1251,7 @@ fi # value. ac_cache_corrupted=false for ac_var in `(set) 2>&1 | - sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; 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" @@ -1235,13 +1268,13 @@ echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ,);; *) 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:$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:$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:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} - ac_cache_corrupted=: + ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. @@ -1313,9 +1346,7 @@ then fi - ac_config_headers="$ac_config_headers config.h:configh.in" - -am__api_version="1.7" +am__api_version="1.8" ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then @@ -1352,6 +1383,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. # 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 @@ -1368,6 +1400,7 @@ do 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. @@ -1375,20 +1408,20 @@ case $as_dir/ in # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do - if $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 + if $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 ;; @@ -1476,7 +1509,6 @@ _ACEOF program_transform_name=`echo $program_transform_name | sed -f conftest.sed` rm conftest.sed - # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` @@ -1490,6 +1522,31 @@ else echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi +if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then + # Keeping the `.' argument allows $(mkdir_p) to be used without + # argument. Indeed, we sometimes output rules like + # $(mkdir_p) $(somedir) + # where $(somedir) is conditionally defined. + # (`test -n '$(somedir)' && $(mkdir_p) $(somedir)' is a more + # expensive solution, as it forces Make to start a sub-shell.) + mkdir_p='mkdir -p -- .' +else + # On NextStep and OpenStep, the `mkdir' command does not + # recognize any option. It will interpret all options as + # directories to create, and then abort because `.' already + # exists. + for d in ./-p ./--version; + do + test -d $d && rmdir $d + done + # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. + if test -f "$ac_aux_dir/mkinstalldirs"; then + mkdir_p='$(mkinstalldirs)' + else + mkdir_p='$(install_sh) -d' + fi +fi + 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. @@ -1532,7 +1589,7 @@ 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 dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -1568,7 +1625,7 @@ else fi rmdir .tst 2>/dev/null - # test to see if srcdir already configured +# test to see if srcdir already configured if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 @@ -1587,8 +1644,8 @@ fi # Define the identity of the package. - PACKAGE=gawk - VERSION=3.1.3 + PACKAGE='gawk' + VERSION='3.1.4' cat >>confdefs.h <<_ACEOF @@ -2172,7 +2229,6 @@ ac_compiler=`set X $ac_compile; echo $2` (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2192,8 +2248,8 @@ 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" >&5 -echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 +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[^ ]*//'` if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 @@ -2213,23 +2269,23 @@ do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) - ;; + ;; conftest.$ac_ext ) - # This is the source file. - ;; + # This is the source file. + ;; [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; + # We found the default executable, but exeext='' is most + # certainly right. + break;; *.* ) - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - # FIXME: I believe we export ac_cv_exeext for Libtool, - # but it would be cool to find out if it's true. Does anybody - # maintain Libtool? --akim. - export ac_cv_exeext - break;; + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool, + # but it would be cool to find out if it's true. Does anybody + # maintain Libtool? --akim. + export ac_cv_exeext + break;; * ) - break;; + break;; esac done else @@ -2303,8 +2359,8 @@ for ac_file in conftest.exe conftest conftest.*; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - export ac_cv_exeext - break;; + export ac_cv_exeext + break;; * ) break;; esac done @@ -2329,7 +2385,6 @@ if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2380,7 +2435,6 @@ if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2400,11 +2454,21 @@ main () _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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 -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2417,7 +2481,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi @@ -2433,7 +2497,6 @@ if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2450,11 +2513,21 @@ main () _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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 -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2467,7 +2540,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cc_g=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 @@ -2494,7 +2567,6 @@ else ac_cv_prog_cc_stdc=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2522,6 +2594,16 @@ static char *f (char * (*g) (char **, int), char **p, ...) 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 -std1 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 -std1. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; @@ -2548,11 +2630,21 @@ do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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 -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2565,7 +2657,7 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext +rm -f conftest.err conftest.$ac_objext done rm -f conftest.$ac_ext conftest.$ac_objext CC=$ac_save_CC @@ -2593,19 +2685,28 @@ cat >conftest.$ac_ext <<_ACEOF _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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 -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ - ''\ - '#include ' \ + '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ @@ -2613,14 +2714,13 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include $ac_declaration +#include int main () { @@ -2631,11 +2731,21 @@ exit (42); _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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 -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2648,9 +2758,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 continue fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2667,11 +2776,21 @@ exit (42); _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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 -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2683,7 +2802,7 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then @@ -2697,7 +2816,7 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -2787,18 +2906,34 @@ else # 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. - echo '#include "conftest.h"' > conftest.c - echo 'int i;' > conftest.h - echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf + : > 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) @@ -2816,16 +2951,22 @@ else # 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=conftest.c object=conftest.o \ - depfile=conftest.Po tmpdepfile=conftest.TPo \ - $SHELL ./depcomp $depcc -c -o conftest.o conftest.c \ + 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 conftest.h 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 - # (even with -Werror). So we grep stderr for any message - # that says an option was ignored. - if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else + # 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 @@ -2884,7 +3025,6 @@ do # 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 -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2895,7 +3035,7 @@ cat >>conftest.$ac_ext <<_ACEOF #else # include #endif - Syntax error + Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 @@ -2907,6 +3047,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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 @@ -2927,7 +3068,6 @@ rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2945,6 +3085,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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 @@ -2991,7 +3132,6 @@ do # 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 -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3002,7 +3142,7 @@ cat >>conftest.$ac_ext <<_ACEOF #else # include #endif - Syntax error + Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 @@ -3014,6 +3154,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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 @@ -3034,7 +3175,6 @@ rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3052,6 +3192,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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 @@ -3185,6 +3326,7 @@ fi # 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 @@ -3201,6 +3343,7 @@ do 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. @@ -3208,20 +3351,20 @@ case $as_dir/ in # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do - if $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 + if $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 ;; @@ -3254,7 +3397,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 -set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -3290,6 +3433,11 @@ if test -f $srcdir/.developing then # add other debug flags as appropriate, save GAWKDEBUG for emergencies CFLAGS="$CFLAGS -DARRAYDEBUG" + if grep dbug $srcdir/.developing + then + CFLAGS="$CFLAGS -DDBUG" + LIBS="$LIBS dbug/libdbug.a" + fi # turn on compiler warnings if we're doing development if test "$GCC" = yes then @@ -3310,7 +3458,6 @@ fi echo "$as_me:$LINENO: checking for AIX" >&5 echo $ECHO_N "checking for AIX... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3336,16 +3483,14 @@ fi rm -f conftest* - - 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 "$as_me:$LINENO: checking for library containing strerror" >&5 +echo $ECHO_N "checking for library containing strerror... $ECHO_C" >&6 +if test "${ac_cv_search_strerror+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lcposix $LIBS" + ac_func_search_save_LIBS=$LIBS +ac_cv_search_strerror=no cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3369,33 +3514,100 @@ strerror (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&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 -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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 + ac_cv_search_strerror="none required" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_lib_cposix_strerror=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test "$ac_cv_search_strerror" = no; then + for ac_lib in cposix; do + LIBS="-l$ac_lib $ac_func_search_save_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 gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char strerror (); +int +main () +{ +strerror (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_strerror="-l$ac_lib" +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + 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" +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + done fi +LIBS=$ac_func_search_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_search_strerror" >&5 +echo "${ECHO_T}$ac_cv_search_strerror" >&6 +if test "$ac_cv_search_strerror" != no; then + test "$ac_cv_search_strerror" = "none required" || LIBS="$ac_cv_search_strerror $LIBS" - +fi echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 @@ -3403,7 +3615,6 @@ if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3424,11 +3635,21 @@ main () _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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 -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3441,12 +3662,11 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f 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 -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3468,7 +3688,6 @@ 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 -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3493,7 +3712,6 @@ if test $ac_cv_header_stdc = yes; then : else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3505,9 +3723,9 @@ cat >>conftest.$ac_ext <<_ACEOF # 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')) + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif @@ -3518,7 +3736,7 @@ main () int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) + || toupper (i) != TOUPPER (i)) exit(2); exit (0); } @@ -3543,7 +3761,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi @@ -3568,7 +3786,7 @@ fi for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.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 @@ -3577,7 +3795,6 @@ if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3589,11 +3806,21 @@ $ac_includes_default _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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 -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3606,7 +3833,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 @@ -3633,7 +3860,6 @@ else echo "$as_me:$LINENO: checking minix/config.h usability" >&5 echo $ECHO_N "checking minix/config.h usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3644,11 +3870,21 @@ $ac_includes_default _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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 -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3661,7 +3897,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 @@ -3669,7 +3905,6 @@ echo "${ECHO_T}$ac_header_compiler" >&6 echo "$as_me:$LINENO: checking minix/config.h presence" >&5 echo $ECHO_N "checking minix/config.h presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3687,6 +3922,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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 @@ -3706,33 +3942,32 @@ 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 in - yes:no ) +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) { echo "$as_me:$LINENO: WARNING: minix/config.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: minix/config.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: minix/config.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: minix/config.h: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 + { echo "$as_me:$LINENO: WARNING: minix/config.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: minix/config.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes ;; - no:yes ) + no:yes:* ) { echo "$as_me:$LINENO: WARNING: minix/config.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: minix/config.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: minix/config.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: minix/config.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: minix/config.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: minix/config.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: minix/config.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: minix/config.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: minix/config.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: minix/config.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: minix/config.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: minix/config.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: minix/config.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: minix/config.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## +## ------------------------------- ## +## Report this to bug-gawk@gnu.org ## +## ------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 @@ -3792,8 +4027,7 @@ else while :; do # IRIX 6.2 and later do not support large files by default, # so use the C compiler's -n32 option if that helps. - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3818,11 +4052,21 @@ main () _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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 -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3834,15 +4078,25 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext +rm -f conftest.err conftest.$ac_objext CC="$CC -n32" rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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 -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3854,8 +4108,8 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext - break +rm -f conftest.err conftest.$ac_objext + break done CC=$ac_save_CC rm -f conftest.$ac_ext @@ -3875,7 +4129,6 @@ else while :; do ac_cv_sys_file_offset_bits=no cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3900,11 +4153,21 @@ main () _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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 -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3916,9 +4179,8 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3944,11 +4206,21 @@ main () _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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 -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3960,7 +4232,7 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext break done fi @@ -3982,7 +4254,6 @@ else while :; do ac_cv_sys_large_files=no cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -4007,11 +4278,21 @@ main () _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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 -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4023,9 +4304,8 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -4051,11 +4331,21 @@ main () _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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 -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4067,7 +4357,7 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext break done fi @@ -4134,2069 +4424,1918 @@ then CFLAGS="$CFLAGS -D_SYSV3" fi - - - -echo "$as_me:$LINENO: checking for ${CC-cc} option to accept ANSI C" >&5 -echo $ECHO_N "checking for ${CC-cc} option to accept ANSI C... $ECHO_C" >&6 -if test "${am_cv_prog_cc_stdc+set}" = set; then +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 - am_cv_prog_cc_stdc=no -ac_save_CC="$CC" -# Don't try gcc -ansi; that turns off useful extensions and -# breaks some systems' header files. -# AIX -qlanglvl=ansi -# Ultrix and OSF/1 -std1 -# HP-UX 10.20 and later -Ae -# HP-UX older versions -Aa -D_HPUX_SOURCE -# SVR4 -Xc -D__EXTENSIONS__ -for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* 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; -} -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]; + 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 $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 - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - am_cv_prog_cc_stdc="$ac_arg"; break +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: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi fi -rm -f conftest.$ac_objext conftest.$ac_ext +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 $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 -CC="$ac_save_CC" fi - -if test -z "$am_cv_prog_cc_stdc"; then - echo "$as_me:$LINENO: result: none needed" >&5 -echo "${ECHO_T}none needed" >&6 +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: $am_cv_prog_cc_stdc" >&5 -echo "${ECHO_T}$am_cv_prog_cc_stdc" >&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi -case "x$am_cv_prog_cc_stdc" in - x|xno) ;; - *) CC="$CC $am_cv_prog_cc_stdc" ;; -esac - - -echo "$as_me:$LINENO: checking for function prototypes" >&5 -echo $ECHO_N "checking for function prototypes... $ECHO_C" >&6 -if test "$am_cv_prog_cc_stdc" != no; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi -cat >>confdefs.h <<\_ACEOF -#define PROTOTYPES 1 -_ACEOF +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 $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 - U= ANSI2KNR= +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 - U=_ ANSI2KNR=./ansi2knr fi -# Ensure some checks needed by ansi2knr itself. -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 + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # 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_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* 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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_header_stdc=yes + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done -ac_cv_header_stdc=no fi -rm -f 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 -#line $LINENO "configure" -/* 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 - : +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 - ac_cv_header_stdc=no + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi -rm -f conftest* + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" 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 -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include +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 $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 -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then - : +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 - ac_cv_header_stdc=no + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 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 - : +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + 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 - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#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 + 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 $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 -#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)) - exit(2); - exit (0); -} -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : +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: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi -( exit $ac_status ) -ac_cv_header_stdc=no + test -n "$CC" && break + done fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +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 $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 + 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 -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 + test -n "$ac_ct_CC" && break +done + CC=$ac_ct_CC fi +fi -for ac_header in string.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then + +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` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +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 -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&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 -#line $LINENO "configure" + 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> + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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 -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_header_compiler=yes + ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_header_compiler=no +ac_compiler_gnu=no fi -rm -f conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu -# 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 -#line $LINENO "configure" +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 +CFLAGS="-g" +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 + 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> + +int +main () +{ + + ; + return 0; +} _ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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 - ac_header_preproc=no +ac_cv_prog_cc_g=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 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 preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; - 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: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@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 eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +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 - eval "$as_ac_Header=$ac_header_preproc" + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_stdc=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; +} -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +/* 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 -std1 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 -std1. */ +int osf4_cc_array ['\x00' == 0 ? 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 +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 fi - +rm -f conftest.err conftest.$ac_objext done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC +fi - -case `(uname) 2> /dev/null` in -*CYGWIN*) - with_libiconv_prefix=no - with_libintl_prefix=no - ;; -*) - ;; +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; esac - - MKINSTALLDIRS= - if test -n "$ac_aux_dir"; then - case "$ac_aux_dir" in - /*) MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" ;; - *) MKINSTALLDIRS="\$(top_builddir)/$ac_aux_dir/mkinstalldirs" ;; - esac - fi - if test -z "$MKINSTALLDIRS"; then - MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" - 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 or --disable-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 - - - - - - -# Prepare PATH_SEPARATOR. -# 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 - -# Find out how to test for executable files. 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 - ac_executable_p="test -x" +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + '' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +#include +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : else - ac_executable_p="test -f" -fi -rm -f conf$$.file + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -# 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. - ;; - *) - ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$ac_save_IFS" - test -z "$ac_dir" && ac_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then - if $ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 && - (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then - ac_cv_path_MSGFMT="$ac_dir/$ac_word$ac_exec_ext" - break 2 - fi - fi - done - done - IFS="$ac_save_IFS" - test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT=":" - ;; -esac +continue fi -MSGFMT="$ac_cv_path_MSGFMT" -if test "$MSGFMT" != ":"; then - echo "$as_me:$LINENO: result: $MSGFMT" >&5 -echo "${ECHO_T}$MSGFMT" >&6 +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 - # 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 $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 +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done - - test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" - ;; -esac +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h 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 - - + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -# Prepare PATH_SEPARATOR. -# 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 +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +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 -# Find out how to test for executable files. 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 - ac_executable_p="test -x" -else - ac_executable_p="test -f" -fi -rm -f conf$$.file +depcc="$CC" am_compiler_list= -# 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 "$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 - case "$XGETTEXT" in - [\\/]* | ?:[\\/]*) - ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. - ;; - *) - ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$ac_save_IFS" - test -z "$ac_dir" && ac_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then - if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 && - (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then - ac_cv_path_XGETTEXT="$ac_dir/$ac_word$ac_exec_ext" - break 2 - fi - fi - done + 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 - 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 + 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/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 - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + am_cv_CC_dependencies_compiler_type=none fi - rm -f messages.po +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 -# Prepare PATH_SEPARATOR. -# 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 -# Find out how to test for executable files. 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 - ac_executable_p="test -x" +if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' else - ac_executable_p="test -f" + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= fi -rm -f conf$$.file -# Extract the first word of "msgmerge", so it can be a program name with args. -set dummy msgmerge; 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_MSGMERGE+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case "$MSGMERGE" in - [\\/]* | ?:[\\/]*) - ac_cv_path_MSGMERGE="$MSGMERGE" # Let the user override the test with a path. - ;; - *) - ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$ac_save_IFS" - test -z "$ac_dir" && ac_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then - if $ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1; then - ac_cv_path_MSGMERGE="$ac_dir/$ac_word$ac_exec_ext" - break 2 - fi - fi - done - done - IFS="$ac_save_IFS" - test -z "$ac_cv_path_MSGMERGE" && ac_cv_path_MSGMERGE=":" - ;; -esac -fi -MSGMERGE="$ac_cv_path_MSGMERGE" -if test "$MSGMERGE" != ":"; then - echo "$as_me:$LINENO: result: $MSGMERGE" >&5 -echo "${ECHO_T}$MSGMERGE" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - if test "$GMSGFMT" != ":"; then - if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 && - (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then - : ; - else - GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'` - echo "$as_me:$LINENO: result: found $GMSGFMT program is not GNU msgfmt; ignore it" >&5 -echo "${ECHO_T}found $GMSGFMT program is not GNU msgfmt; ignore it" >&6 - GMSGFMT=":" - fi - fi +am_cv_prog_cc_stdc=$ac_cv_prog_cc_stdc - if test "$XGETTEXT" != ":"; then - if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 && - (if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); 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 - rm -f messages.po - 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_stdc" != no; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 - ac_config_commands="$ac_config_commands default-1" +cat >>confdefs.h <<\_ACEOF +#define PROTOTYPES 1 +_ACEOF -# Make sure we can run config.sub. -$ac_config_sub sun4 >/dev/null 2>&1 || - { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 -echo "$as_me: error: cannot run $ac_config_sub" >&2;} - { (exit 1); exit 1; }; } +cat >>confdefs.h <<\_ACEOF +#define __PROTOTYPES 1 +_ACEOF -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_cv_build_alias=$build_alias -test -z "$ac_cv_build_alias" && - ac_cv_build_alias=`$ac_config_guess` -test -z "$ac_cv_build_alias" && - { { 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=`$ac_config_sub $ac_cv_build_alias` || - { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 -echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} - { (exit 1); exit 1; }; } - + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi -echo "$as_me:$LINENO: result: $ac_cv_build" >&5 -echo "${ECHO_T}$ac_cv_build" >&6 -build=$ac_cv_build -build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -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 +if test "$ac_cv_prog_cc_stdc" != no; then + U= ANSI2KNR= else - ac_cv_host_alias=$host_alias -test -z "$ac_cv_host_alias" && - ac_cv_host_alias=$ac_cv_build_alias -ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || - { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 -echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} - { (exit 1); exit 1; }; } - + U=_ ANSI2KNR=./ansi2knr fi -echo "$as_me:$LINENO: result: $ac_cv_host" >&5 -echo "${ECHO_T}$ac_cv_host" >&6 -host=$ac_cv_host -host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +# Ensure some checks needed by ansi2knr itself. -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 +for ac_header in string.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" + # 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. */ - -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; - } - { /* 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; - } -#endif - - ; - return 0; -} +$ac_includes_default +#include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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 -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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 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 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 -#line $LINENO "configure" -/* 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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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; break + 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 conftest.$ac_objext conftest.$ac_ext -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) ;; - no) -cat >>confdefs.h <<\_ACEOF -#define inline -_ACEOF - ;; - *) cat >>confdefs.h <<_ACEOF -#define inline $ac_cv_c_inline -_ACEOF - ;; -esac +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 -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 -#line $LINENO "configure" +# 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. */ -$ac_includes_default -int -main () -{ -if ((off_t *) 0) - return 0; -if (sizeof (off_t)) - return 0; - ; - return 0; -} +#include <$ac_header> _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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); }; }; then - ac_cv_type_off_t=yes + (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_cv_type_off_t=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext + ac_header_preproc=no 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 - : +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-gawk@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 eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -cat >>confdefs.h <<_ACEOF -#define off_t long +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 -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 -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -if ((size_t *) 0) - return 0; -if (sizeof (size_t)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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 +done -ac_cv_type_size_t=no -fi -rm -f 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 -_ACEOF -fi +case `(uname) 2> /dev/null` in +*CYGWIN*) + with_libiconv_prefix=no + with_libintl_prefix=no + ;; +*) + ;; +esac -# 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 -#line $LINENO "configure" -/* 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)); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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 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 + MKINSTALLDIRS= + if test -n "$ac_aux_dir"; then + case "$ac_aux_dir" in + /*) MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" ;; + *) MKINSTALLDIRS="\$(top_builddir)/$ac_aux_dir/mkinstalldirs" ;; + esac + fi + if test -z "$MKINSTALLDIRS"; then + MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" + fi -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 -#line $LINENO "configure" -/* 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); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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 + 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 or --disable-nls was given. +if test "${enable_nls+set}" = set; then + enableval="$enable_nls" + USE_NLS=$enableval else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 + USE_NLS=yes +fi; + echo "$as_me:$LINENO: result: $USE_NLS" >&5 +echo "${ECHO_T}$USE_NLS" >&6 -ac_cv_func_alloca_works=no -fi -rm -f 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=alloca.$ac_objext -cat >>confdefs.h <<\_ACEOF -#define C_ALLOCA 1 -_ACEOF +# Prepare PATH_SEPARATOR. +# 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 +# Find out how to test for executable files. 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 + ac_executable_p="test -x" +else + ac_executable_p="test -f" +fi +rm -f conf$$.file -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 +# 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 - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* 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 + case "$MSGFMT" in + [\\/]* | ?:[\\/]*) + ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. + ;; + *) + ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$ac_save_IFS" + test -z "$ac_dir" && ac_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then + if $ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 && + (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then + ac_cv_path_MSGFMT="$ac_dir/$ac_word$ac_exec_ext" + break 2 + fi + fi + done + 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 - ac_cv_os_cray=no + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 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 eval "test \"\${$as_ac_var+set}\" = set"; then + # 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 - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* 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 -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -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 -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != $ac_func; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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 + 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 $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 -eval "$as_ac_var=no" + test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" + ;; +esac fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +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 -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then -cat >>confdefs.h <<_ACEOF -#define CRAY_STACKSEG_END $ac_func -_ACEOF - break -fi - done +# Prepare PATH_SEPARATOR. +# 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 -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 +# Find out how to test for executable files. 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 + ac_executable_p="test -x" else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -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; -} + ac_executable_p="test -f" +fi +rm -f conf$$.file -int -main () -{ - exit (find_stack_direction () < 0); -} -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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 +# 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 - 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 gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext + case "$XGETTEXT" in + [\\/]* | ?:[\\/]*) + ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. + ;; + *) + ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$ac_save_IFS" + test -z "$ac_dir" && ac_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then + if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 && + (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then + ac_cv_path_XGETTEXT="$ac_dir/$ac_word$ac_exec_ext" + break 2 + fi + fi + done + 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 -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 + rm -f messages.po +# Prepare PATH_SEPARATOR. +# 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 +# Find out how to test for executable files. 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 + ac_executable_p="test -x" +else + ac_executable_p="test -f" +fi +rm -f conf$$.file - -for ac_header in stdlib.h unistd.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then +# Extract the first word of "msgmerge", so it can be a program name with args. +set dummy msgmerge; 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_MSGMERGE+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case "$MSGMERGE" in + [\\/]* | ?:[\\/]*) + ac_cv_path_MSGMERGE="$MSGMERGE" # Let the user override the test with a path. + ;; + *) + ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$ac_save_IFS" + test -z "$ac_dir" && ac_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then + if $ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1; then + ac_cv_path_MSGMERGE="$ac_dir/$ac_word$ac_exec_ext" + break 2 + fi + fi + done + done + IFS="$ac_save_IFS" + test -z "$ac_cv_path_MSGMERGE" && ac_cv_path_MSGMERGE=":" + ;; +esac fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +MSGMERGE="$ac_cv_path_MSGMERGE" +if test "$MSGMERGE" != ":"; then + echo "$as_me:$LINENO: result: $MSGMERGE" >&5 +echo "${ECHO_T}$MSGMERGE" >&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 -#line $LINENO "configure" -/* confdefs.h. */ + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + + if test "$GMSGFMT" != ":"; then + if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 && + (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then + : ; + else + GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'` + echo "$as_me:$LINENO: result: found $GMSGFMT program is not GNU msgfmt; ignore it" >&5 +echo "${ECHO_T}found $GMSGFMT program is not GNU msgfmt; ignore it" >&6 + GMSGFMT=":" + fi + fi + + if test "$XGETTEXT" != ":"; then + if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 && + (if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); 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 + rm -f messages.po + fi + + ac_config_commands="$ac_config_commands default-1" + + +# Make sure we can run config.sub. +$ac_config_sub sun4 >/dev/null 2>&1 || + { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 +echo "$as_me: error: cannot run $ac_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_cv_build_alias=$build_alias +test -z "$ac_cv_build_alias" && + ac_cv_build_alias=`$ac_config_guess` +test -z "$ac_cv_build_alias" && + { { 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=`$ac_config_sub $ac_cv_build_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_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 +build=$ac_cv_build +build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + +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 + ac_cv_host_alias=$host_alias +test -z "$ac_cv_host_alias" && + ac_cv_host_alias=$ac_cv_build_alias +ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_host" >&5 +echo "${ECHO_T}$ac_cv_host" >&6 +host=$ac_cv_host +host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + +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. */ -$ac_includes_default -#include <$ac_header> + +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; + } + { /* 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; + } +#endif + + ; + return 0; +} _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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 -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_header_compiler=yes + ac_cv_c_const=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_header_compiler=no +ac_cv_c_const=no fi -rm -f conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 +rm -f 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 -# 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 -#line $LINENO "configure" +cat >>confdefs.h <<\_ACEOF +#define const +_ACEOF + +fi + + + echo "$as_me:$LINENO: checking for signed" >&5 +echo $ECHO_N "checking for signed... $ECHO_C" >&6 +if test "${bh_cv_c_signed+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 <$ac_header> + +int +main () +{ +signed char x; + ; + return 0; +} _ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + bh_cv_c_signed=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_header_preproc=no +bh_cv_c_signed=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 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 preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; - 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: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@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 eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=$ac_header_preproc" +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +echo "$as_me:$LINENO: result: $bh_cv_c_signed" >&5 +echo "${ECHO_T}$bh_cv_c_signed" >&6 + if test $bh_cv_c_signed = no; then -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +cat >>confdefs.h <<\_ACEOF +#define signed _ACEOF -fi + 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 eval "test \"\${$as_ac_var+set}\" = set"; then +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 -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* 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 -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -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 -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} +#ifndef __cplusplus +typedef int foo_t; +static $ac_kw foo_t static_foo () {return 0; } +$ac_kw foo_t foo () {return 0; } #endif -int -main () -{ -return f != $ac_func; - ; - return 0; -} _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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 -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - eval "$as_ac_var=yes" + ac_cv_c_inline=$ac_kw; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -eval "$as_ac_var=no" fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done fi -done +echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5 +echo "${ECHO_T}$ac_cv_c_inline" >&6 -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 + +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 - if test "$cross_compiling" = yes; then - ac_cv_func_mmap_fixed_mapped=no else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* 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) - exit (1); - for (i = 0; i < pagesize; ++i) - *(data + i) = rand (); - umask (0); - fd = creat ("conftest.mmap", 0600); - if (fd < 0) - exit (1); - if (write (fd, data, pagesize) != pagesize) - exit (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) - exit (1); - data2 = (char *) malloc (2 * pagesize); - if (!data2) - exit (1); - data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1); - if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_FIXED, fd, 0L)) - exit (1); - for (i = 0; i < pagesize; ++i) - if (*(data + i) != *(data2 + i)) - exit (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) - exit (1); - if (read (fd, data3, pagesize) != pagesize) - exit (1); - for (i = 0; i < pagesize; ++i) - if (*(data + i) != *(data3 + i)) - exit (1); - close (fd); - exit (0); +if ((off_t *) 0) + return 0; +if (sizeof (off_t)) + return 0; + ; + return 0; } _ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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='./conftest$ac_exeext' + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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 + ac_cv_type_off_t=yes else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&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 gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +ac_cv_type_off_t=no fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext 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 - - - 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 -#line $LINENO "configure" -/* 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 +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 _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" - - - - echo "$as_me:$LINENO: checking whether integer division by zero raises SIGFPE" >&5 -echo $ECHO_N "checking whether integer division by zero raises SIGFPE... $ECHO_C" >&6 -if test "${gt_cv_int_divbyzero_sigfpe+set}" = set; then +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 - - if test "$cross_compiling" = yes; then - - # Guess based on the CPU. - case "$host_cpu" in - alpha* | i3456786 | m68k | s390*) - gt_cv_int_divbyzero_sigfpe="guessing yes";; - *) - gt_cv_int_divbyzero_sigfpe="guessing no";; - esac - else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - -#include -#include - -static void -#ifdef __cplusplus -sigfpe_handler (int sig) -#else -sigfpe_handler (sig) int sig; -#endif -{ - /* Exit with code 0 if SIGFPE, with code 1 if any other signal. */ - exit (sig != SIGFPE); -} - -int x = 1; -int y = 0; -int z; -int nan; - -int main () +$ac_includes_default +int +main () { - signal (SIGFPE, sigfpe_handler); -/* IRIX and AIX (when "xlc -qcheck" is used) yield signal SIGTRAP. */ -#if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP) - signal (SIGTRAP, sigfpe_handler); -#endif -/* Linux/SPARC yields signal SIGILL. */ -#if defined (__sparc__) && defined (__linux__) - signal (SIGILL, sigfpe_handler); -#endif - - z = x / y; - nan = y / y; - exit (1); +if ((size_t *) 0) + return 0; +if (sizeof (size_t)) + return 0; + ; + return 0; } - _ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - gt_cv_int_divbyzero_sigfpe=yes + ac_cv_type_size_t=yes else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -( exit $ac_status ) -gt_cv_int_divbyzero_sigfpe=no -fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +ac_cv_type_size_t=no fi - +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $gt_cv_int_divbyzero_sigfpe" >&5 -echo "${ECHO_T}$gt_cv_int_divbyzero_sigfpe" >&6 - case "$gt_cv_int_divbyzero_sigfpe" in - *yes) value=1;; - *) value=0;; - esac +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 INTDIV0_RAISES_SIGFPE $value +#define size_t unsigned _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 "$as_me:$LINENO: checking for long long" >&5 +echo $ECHO_N "checking for long long... $ECHO_C" >&6 +if test "${ac_cv_type_long_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* 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; +long long ll = 1LL; int i = 63; int main () { -unsigned long long ullmax = (unsigned long long) -1; - return ull << i | ull >> i | ullmax / ull | ullmax % ull; +long long llmax = (long long) -1; + return ll << i | ll >> i | llmax / ll | llmax % ll; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&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 -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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 + ac_cv_type_long_long=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_type_unsigned_long_long=no +ac_cv_type_long_long=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f 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 +echo "$as_me:$LINENO: result: $ac_cv_type_long_long" >&5 +echo "${ECHO_T}$ac_cv_type_long_long" >&6 + if test $ac_cv_type_long_long = yes; then cat >>confdefs.h <<\_ACEOF -#define HAVE_UNSIGNED_LONG_LONG 1 +#define HAVE_LONG_LONG 1 _ACEOF fi - - echo "$as_me:$LINENO: checking for uintmax_t" >&5 -echo $ECHO_N "checking for uintmax_t... $ECHO_C" >&6 -if test "${ac_cv_type_uintmax_t+set}" = set; then + echo "$as_me:$LINENO: checking for long double" >&5 +echo $ECHO_N "checking for long double... $ECHO_C" >&6 +if test "${gt_cv_c_long_double+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" + if test "$GCC" = yes; then + gt_cv_c_long_double=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 + + /* The Stardent Vistra knows sizeof(long double), but does not support it. */ + long double foo = 0.0; + /* On Ultrix 4.3 cc, long double is 4 and double is 8. */ + int array [2*(sizeof(long double) >= sizeof(double)) - 1]; + int main () { -if ((uintmax_t *) 0) - return 0; -if (sizeof (uintmax_t)) - return 0; + ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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 -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_type_uintmax_t=yes + gt_cv_c_long_double=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_type_uintmax_t=no +gt_cv_c_long_double=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + fi fi -echo "$as_me:$LINENO: result: $ac_cv_type_uintmax_t" >&5 -echo "${ECHO_T}$ac_cv_type_uintmax_t" >&6 -if test $ac_cv_type_uintmax_t = yes; then - : -else - test $ac_cv_type_unsigned_long_long = yes \ - && ac_type='unsigned long long' \ - || ac_type='unsigned long' +echo "$as_me:$LINENO: result: $gt_cv_c_long_double" >&5 +echo "${ECHO_T}$gt_cv_c_long_double" >&6 + if test $gt_cv_c_long_double = yes; then -cat >>confdefs.h <<_ACEOF -#define uintmax_t $ac_type +cat >>confdefs.h <<\_ACEOF +#define HAVE_LONG_DOUBLE 1 _ACEOF -fi - + fi - echo "$as_me:$LINENO: checking for inttypes.h" >&5 -echo $ECHO_N "checking for inttypes.h... $ECHO_C" >&6 -if test "${gt_cv_header_inttypes_h+set}" = set; then + echo "$as_me:$LINENO: checking for wchar_t" >&5 +echo $ECHO_N "checking for wchar_t... $ECHO_C" >&6 +if test "${gt_cv_c_wchar_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" + 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 + wchar_t foo = (wchar_t)'\0'; int main () { @@ -6207,57 +6346,59 @@ main () _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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 -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - gt_cv_header_inttypes_h=yes + gt_cv_c_wchar_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -gt_cv_header_inttypes_h=no +gt_cv_c_wchar_t=no fi -rm -f conftest.$ac_objext conftest.$ac_ext - +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $gt_cv_header_inttypes_h" >&5 -echo "${ECHO_T}$gt_cv_header_inttypes_h" >&6 - if test $gt_cv_header_inttypes_h = yes; then +echo "$as_me:$LINENO: result: $gt_cv_c_wchar_t" >&5 +echo "${ECHO_T}$gt_cv_c_wchar_t" >&6 + if test $gt_cv_c_wchar_t = yes; then -cat >>confdefs.h <<_ACEOF -#define HAVE_INTTYPES_H 1 +cat >>confdefs.h <<\_ACEOF +#define HAVE_WCHAR_T 1 _ACEOF fi - - if test $gt_cv_header_inttypes_h = yes; then - echo "$as_me:$LINENO: checking whether the inttypes.h PRIxNN macros are broken" >&5 -echo $ECHO_N "checking whether the inttypes.h PRIxNN macros are broken... $ECHO_C" >&6 -if test "${gt_cv_inttypes_pri_broken+set}" = set; then + echo "$as_me:$LINENO: checking for wint_t" >&5 +echo $ECHO_N "checking for wint_t... $ECHO_C" >&6 +if test "${gt_cv_c_wint_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include -#ifdef PRId32 -char *p = PRId32; -#endif - +#include + wint_t foo = (wchar_t)'\0'; int main () { @@ -6268,369 +6409,3310 @@ main () _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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 -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - gt_cv_inttypes_pri_broken=no + gt_cv_c_wint_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -gt_cv_inttypes_pri_broken=yes +gt_cv_c_wint_t=no fi -rm -f conftest.$ac_objext conftest.$ac_ext - +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $gt_cv_inttypes_pri_broken" >&5 -echo "${ECHO_T}$gt_cv_inttypes_pri_broken" >&6 - fi - if test "$gt_cv_inttypes_pri_broken" = yes; then +echo "$as_me:$LINENO: result: $gt_cv_c_wint_t" >&5 +echo "${ECHO_T}$gt_cv_c_wint_t" >&6 + if test $gt_cv_c_wint_t = yes; then -cat >>confdefs.h <<_ACEOF -#define PRI_MACROS_BROKEN 1 +cat >>confdefs.h <<\_ACEOF +#define HAVE_WINT_T 1 _ACEOF fi - if test "X$prefix" = "XNONE"; then - acl_final_prefix="$ac_default_prefix" - else - acl_final_prefix="$prefix" - fi - if test "X$exec_prefix" = "XNONE"; then - acl_final_exec_prefix='${prefix}' - else - acl_final_exec_prefix="$exec_prefix" - fi - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" - prefix="$acl_save_prefix" - - -# Check whether --with-gnu-ld or --without-gnu-ld was given. -if test "${with_gnu_ld+set}" = set; then - withval="$with_gnu_ld" - test "$withval" = no || with_gnu_ld=yes -else - with_gnu_ld=no -fi; -# Prepare PATH_SEPARATOR. -# 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 -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - echo "$as_me:$LINENO: checking for ld used by GCC" >&5 -echo $ECHO_N "checking for ld used by GCC... $ECHO_C" >&6 - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [\\/]* | [A-Za-z]:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the path of ld - ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` - while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do - ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - echo "$as_me:$LINENO: checking for GNU ld" >&5 -echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6 -else - echo "$as_me:$LINENO: checking for non-GNU ld" >&5 -echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6 -fi -if test "${acl_cv_path_LD+set}" = set; then + 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 - if test -z "$LD"; then - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - acl_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then - test "$with_gnu_ld" != no && break - else - test "$with_gnu_ld" != yes && break - fi - fi - done - IFS="$ac_save_ifs" + 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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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 - acl_cv_path_LD="$LD" # Let the user override the test with a path. + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +jm_ac_cv_header_inttypes_h=no fi +rm -f 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 -LD="$acl_cv_path_LD" -if test -n "$LD"; then - echo "$as_me:$LINENO: result: $LD" >&5 -echo "${ECHO_T}$LD" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi -test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 -echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} - { (exit 1); exit 1; }; } -echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 -echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6 -if test "${acl_cv_prog_gnu_ld+set}" = set; then +cat >>confdefs.h <<_ACEOF +#define HAVE_INTTYPES_H_WITH_UINTMAX 1 +_ACEOF + + fi + + + echo "$as_me:$LINENO: checking for stdint.h" >&5 +echo $ECHO_N "checking for stdint.h... $ECHO_C" >&6 +if test "${jm_ac_cv_header_stdint_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - # I'd rather use --version here, but apparently some GNU ld's only accept -v. -if $LD -v 2>&1 &5; then - acl_cv_prog_gnu_ld=yes + 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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + jm_ac_cv_header_stdint_h=yes else - acl_cv_prog_gnu_ld=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +jm_ac_cv_header_stdint_h=no fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $acl_cv_prog_gnu_ld" >&5 -echo "${ECHO_T}$acl_cv_prog_gnu_ld" >&6 -with_gnu_ld=$acl_cv_prog_gnu_ld +echo "$as_me:$LINENO: result: $jm_ac_cv_header_stdint_h" >&5 +echo "${ECHO_T}$jm_ac_cv_header_stdint_h" >&6 + if test $jm_ac_cv_header_stdint_h = yes; then +cat >>confdefs.h <<_ACEOF +#define HAVE_STDINT_H_WITH_UINTMAX 1 +_ACEOF + fi - echo "$as_me:$LINENO: checking for shared library run path origin" >&5 -echo $ECHO_N "checking for shared library run path origin... $ECHO_C" >&6 -if test "${acl_cv_rpath+set}" = set; then + + + + echo "$as_me:$LINENO: checking for intmax_t" >&5 +echo $ECHO_N "checking for intmax_t... $ECHO_C" >&6 +if test "${gt_cv_c_intmax_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. */ - CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ - ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh - . ./conftest.sh - rm -f ./conftest.sh - acl_cv_rpath=done +#include +#include +#if HAVE_STDINT_H_WITH_UINTMAX +#include +#endif +#if HAVE_INTTYPES_H_WITH_UINTMAX +#include +#endif -fi -echo "$as_me:$LINENO: result: $acl_cv_rpath" >&5 -echo "${ECHO_T}$acl_cv_rpath" >&6 - wl="$acl_cv_wl" - libext="$acl_cv_libext" - shlibext="$acl_cv_shlibext" - hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" - hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" - hardcode_direct="$acl_cv_hardcode_direct" - hardcode_minus_L="$acl_cv_hardcode_minus_L" - # Check whether --enable-rpath or --disable-rpath was given. -if test "${enable_rpath+set}" = set; then - enableval="$enable_rpath" - : +int +main () +{ +intmax_t x = -1; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gt_cv_c_intmax_t=yes else - enable_rpath=yes -fi; + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +gt_cv_c_intmax_t=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $gt_cv_c_intmax_t" >&5 +echo "${ECHO_T}$gt_cv_c_intmax_t" >&6 + if test $gt_cv_c_intmax_t = yes; then +cat >>confdefs.h <<\_ACEOF +#define HAVE_INTMAX_T 1 +_ACEOF + fi + echo "$as_me:$LINENO: checking whether printf() supports POSIX/XSI format strings" >&5 +echo $ECHO_N "checking whether printf() supports POSIX/XSI format strings... $ECHO_C" >&6 +if test "${gt_cv_func_printf_posix+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else - use_additional=yes + if test "$cross_compiling" = yes; then - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" +#if defined __NetBSD__ || defined _MSC_VER || defined __MINGW32__ || defined __CYGWIN__ + notposix +#endif - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "notposix" >/dev/null 2>&1; then + gt_cv_func_printf_posix="guessing no" +else + gt_cv_func_printf_posix="guessing yes" +fi +rm -f conftest* -# Check whether --with-libiconv-prefix or --without-libiconv-prefix was given. -if test "${with_libiconv_prefix+set}" = set; then - withval="$with_libiconv_prefix" +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ - if test "X$withval" = "Xno"; then - use_additional=no - else - if test "X$withval" = "X"; then +#include +#include +/* The string "%2$d %1$d", with dollar characters protected from the shell's + dollar expansion (possibly an autoconf bug). */ +static char format[] = { '%', '2', '$', 'd', ' ', '%', '1', '$', 'd', '\0' }; +static char buf[100]; +int main () +{ + sprintf (buf, format, 33, 55); + return (strcmp (buf, "55 33") != 0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gt_cv_func_printf_posix=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 - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" +( exit $ac_status ) +gt_cv_func_printf_posix=no +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" +fi +echo "$as_me:$LINENO: result: $gt_cv_func_printf_posix" >&5 +echo "${ECHO_T}$gt_cv_func_printf_posix" >&6 + case $gt_cv_func_printf_posix in + *yes) - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" +cat >>confdefs.h <<\_ACEOF +#define HAVE_POSIX_PRINTF 1 +_ACEOF - else - additional_includedir="$withval/include" - additional_libdir="$withval/lib" - fi - fi + ;; + esac -fi; - LIBICONV= - LTLIBICONV= - INCICONV= - rpathdirs= - ltrpathdirs= - names_already_handled= - names_next_round='iconv ' - while test -n "$names_next_round"; do - names_this_round="$names_next_round" - names_next_round= - for name in $names_this_round; do - already_handled= - for n in $names_already_handled; do - if test "$n" = "$name"; then - already_handled=yes - break - fi - done - if test -z "$already_handled"; then - names_already_handled="$names_already_handled $name" - uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` - eval value=\"\$HAVE_LIB$uppername\" - if test -n "$value"; then - if test "$value" = yes; then - eval value=\"\$LIB$uppername\" - test -z "$value" || LIBICONV="${LIBICONV}${LIBICONV:+ }$value" - eval value=\"\$LTLIB$uppername\" - test -z "$value" || LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$value" - else - : - fi - else - found_dir= - found_la= - found_so= - found_a= - if test $use_additional = yes; then - if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then - found_dir="$additional_libdir" - found_so="$additional_libdir/lib$name.$shlibext" - if test -f "$additional_libdir/lib$name.la"; then - found_la="$additional_libdir/lib$name.la" - fi - else - if test -f "$additional_libdir/lib$name.$libext"; then - found_dir="$additional_libdir" - found_a="$additional_libdir/lib$name.$libext" - if test -f "$additional_libdir/lib$name.la"; then - found_la="$additional_libdir/lib$name.la" - fi - fi - fi - fi - if test "X$found_dir" = "X"; then - for x in $LDFLAGS $LTLIBICONV; do +# 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)); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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 - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" +ac_cv_working_alloca_h=no +fi +rm -f 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 - case "$x" in - -L*) - dir=`echo "X$x" | sed -e 's/^X-L//'` - if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then - found_dir="$dir" - found_so="$dir/lib$name.$shlibext" - if test -f "$dir/lib$name.la"; then - found_la="$dir/lib$name.la" - fi - else - if test -f "$dir/lib$name.$libext"; then - found_dir="$dir" - found_a="$dir/lib$name.$libext" - if test -f "$dir/lib$name.la"; then - found_la="$dir/lib$name.la" - fi - fi - fi - ;; - esac - if test "X$found_dir" != "X"; then - break - fi - done - fi - if test "X$found_dir" != "X"; then - LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$found_dir -l$name" - if test "X$found_so" != "X"; then - if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then - LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" - else - haveit= - for x in $ltrpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - ltrpathdirs="$ltrpathdirs $found_dir" - fi - if test "$hardcode_direct" = yes; then - LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" - else - if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then - LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" - haveit= - for x in $rpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - rpathdirs="$rpathdirs $found_dir" - fi - else - haveit= - for x in $LDFLAGS $LIBICONV; do +cat >>confdefs.h <<\_ACEOF +#define HAVE_ALLOCA_H 1 +_ACEOF - acl_save_prefix="$prefix" +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); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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 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=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 eval "test \"\${$as_ac_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 gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +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 +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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 conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&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. */ +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 () +{ + exit (find_stack_direction () < 0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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 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 + + + +for ac_header in stdlib.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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 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 { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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-gawk@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 eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&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 eval "test \"\${$as_ac_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 gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +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 +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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 conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&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) + exit (1); + for (i = 0; i < pagesize; ++i) + *(data + i) = rand (); + umask (0); + fd = creat ("conftest.mmap", 0600); + if (fd < 0) + exit (1); + if (write (fd, data, pagesize) != pagesize) + exit (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) + exit (1); + data2 = (char *) malloc (2 * pagesize); + if (!data2) + exit (1); + data2 += (pagesize - ((long) data2 & (pagesize - 1))) & (pagesize - 1); + if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_FIXED, fd, 0L)) + exit (1); + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data2 + i)) + exit (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) + exit (1); + if (read (fd, data3, pagesize) != pagesize) + exit (1); + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data3 + i)) + exit (1); + close (fd); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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 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 + + + 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" + + + + + echo "$as_me:$LINENO: checking whether integer division by zero raises SIGFPE" >&5 +echo $ECHO_N "checking whether integer division by zero raises SIGFPE... $ECHO_C" >&6 +if test "${gt_cv_int_divbyzero_sigfpe+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + if test "$cross_compiling" = yes; then + + # Guess based on the CPU. + case "$host_cpu" in + alpha* | i3456786 | m68k | s390*) + gt_cv_int_divbyzero_sigfpe="guessing yes";; + *) + gt_cv_int_divbyzero_sigfpe="guessing no";; + esac + +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 + +static void +#ifdef __cplusplus +sigfpe_handler (int sig) +#else +sigfpe_handler (sig) int sig; +#endif +{ + /* Exit with code 0 if SIGFPE, with code 1 if any other signal. */ + exit (sig != SIGFPE); +} + +int x = 1; +int y = 0; +int z; +int nan; + +int main () +{ + signal (SIGFPE, sigfpe_handler); +/* IRIX and AIX (when "xlc -qcheck" is used) yield signal SIGTRAP. */ +#if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP) + signal (SIGTRAP, sigfpe_handler); +#endif +/* Linux/SPARC yields signal SIGILL. */ +#if defined (__sparc__) && defined (__linux__) + signal (SIGILL, sigfpe_handler); +#endif + + z = x / y; + nan = y / y; + exit (1); +} + +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gt_cv_int_divbyzero_sigfpe=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 ) +gt_cv_int_divbyzero_sigfpe=no +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + +fi +echo "$as_me:$LINENO: result: $gt_cv_int_divbyzero_sigfpe" >&5 +echo "${ECHO_T}$gt_cv_int_divbyzero_sigfpe" >&6 + case "$gt_cv_int_divbyzero_sigfpe" in + *yes) value=1;; + *) value=0;; + esac + +cat >>confdefs.h <<_ACEOF +#define INTDIV0_RAISES_SIGFPE $value +_ACEOF + + + + 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 = 1ULL; 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 { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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 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 && test $jm_ac_cv_header_stdint_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 + + else + +cat >>confdefs.h <<\_ACEOF +#define HAVE_UINTMAX_T 1 +_ACEOF + + fi + + + echo "$as_me:$LINENO: checking for inttypes.h" >&5 +echo $ECHO_N "checking for inttypes.h... $ECHO_C" >&6 +if test "${gt_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 () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gt_cv_header_inttypes_h=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +gt_cv_header_inttypes_h=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:$LINENO: result: $gt_cv_header_inttypes_h" >&5 +echo "${ECHO_T}$gt_cv_header_inttypes_h" >&6 + if test $gt_cv_header_inttypes_h = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_INTTYPES_H 1 +_ACEOF + + fi + + + + if test $gt_cv_header_inttypes_h = yes; then + echo "$as_me:$LINENO: checking whether the inttypes.h PRIxNN macros are broken" >&5 +echo $ECHO_N "checking whether the inttypes.h PRIxNN macros are broken... $ECHO_C" >&6 +if test "${gt_cv_inttypes_pri_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 +#ifdef PRId32 +char *p = PRId32; +#endif + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gt_cv_inttypes_pri_broken=no +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +gt_cv_inttypes_pri_broken=yes +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:$LINENO: result: $gt_cv_inttypes_pri_broken" >&5 +echo "${ECHO_T}$gt_cv_inttypes_pri_broken" >&6 + fi + if test "$gt_cv_inttypes_pri_broken" = yes; then + +cat >>confdefs.h <<_ACEOF +#define PRI_MACROS_BROKEN 1 +_ACEOF + + fi + + + +for ac_header in stdint.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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 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 { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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-gawk@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 eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&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_MAX" >&5 +echo $ECHO_N "checking for SIZE_MAX... $ECHO_C" >&6 + result= + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +#if HAVE_STDINT_H +#include +#endif +#ifdef SIZE_MAX +Found it +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Found it" >/dev/null 2>&1; then + result=yes +fi +rm -f conftest* + + if test -z "$result"; then + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +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 () +{ +static int test_array [1 - 2 * !((~(size_t)0 / 10) >= 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=0 ac_mid=0 + while :; do + 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 () +{ +static int test_array [1 - 2 * !((~(size_t)0 / 10) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo=`expr $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +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 () +{ +static int test_array [1 - 2 * !((~(size_t)0 / 10) < 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=-1 ac_mid=-1 + while :; do + 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 () +{ +static int test_array [1 - 2 * !((~(size_t)0 / 10) >= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_hi=`expr '(' $ac_mid ')' - 1` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo= ac_hi= +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + 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 () +{ +static int test_array [1 - 2 * !((~(size_t)0 / 10) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo=`expr '(' $ac_mid ')' + 1` +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in +?*) res_hi=$ac_lo;; +'') result=? ;; +esac +else + if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run test program while cross compiling +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +long longval () { return ~(size_t)0 / 10; } +unsigned long ulongval () { return ~(size_t)0 / 10; } +#include +#include +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + exit (1); + if ((~(size_t)0 / 10) < 0) + { + long i = longval (); + if (i != (~(size_t)0 / 10)) + exit (1); + fprintf (f, "%ld\n", i); + } + else + { + unsigned long i = ulongval (); + if (i != (~(size_t)0 / 10)) + exit (1); + fprintf (f, "%lu\n", i); + } + exit (ferror (f) || fclose (f) != 0); + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + res_hi=`cat conftest.val` +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 ) +result=? +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +rm -f conftest.val + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +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 () +{ +static int test_array [1 - 2 * !((~(size_t)0 % 10) >= 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=0 ac_mid=0 + while :; do + 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 () +{ +static int test_array [1 - 2 * !((~(size_t)0 % 10) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo=`expr $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +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 () +{ +static int test_array [1 - 2 * !((~(size_t)0 % 10) < 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=-1 ac_mid=-1 + while :; do + 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 () +{ +static int test_array [1 - 2 * !((~(size_t)0 % 10) >= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_hi=`expr '(' $ac_mid ')' - 1` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo= ac_hi= +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + 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 () +{ +static int test_array [1 - 2 * !((~(size_t)0 % 10) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo=`expr '(' $ac_mid ')' + 1` +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in +?*) res_lo=$ac_lo;; +'') result=? ;; +esac +else + if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run test program while cross compiling +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +long longval () { return ~(size_t)0 % 10; } +unsigned long ulongval () { return ~(size_t)0 % 10; } +#include +#include +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + exit (1); + if ((~(size_t)0 % 10) < 0) + { + long i = longval (); + if (i != (~(size_t)0 % 10)) + exit (1); + fprintf (f, "%ld\n", i); + } + else + { + unsigned long i = ulongval (); + if (i != (~(size_t)0 % 10)) + exit (1); + fprintf (f, "%lu\n", i); + } + exit (ferror (f) || fclose (f) != 0); + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + res_lo=`cat conftest.val` +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 ) +result=? +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +rm -f conftest.val + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +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 () +{ +static int test_array [1 - 2 * !((sizeof (size_t) <= sizeof (unsigned int)) >= 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=0 ac_mid=0 + while :; do + 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 () +{ +static int test_array [1 - 2 * !((sizeof (size_t) <= sizeof (unsigned int)) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo=`expr $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +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 () +{ +static int test_array [1 - 2 * !((sizeof (size_t) <= sizeof (unsigned int)) < 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=-1 ac_mid=-1 + while :; do + 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 () +{ +static int test_array [1 - 2 * !((sizeof (size_t) <= sizeof (unsigned int)) >= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_hi=`expr '(' $ac_mid ')' - 1` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo= ac_hi= +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + 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 () +{ +static int test_array [1 - 2 * !((sizeof (size_t) <= sizeof (unsigned int)) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo=`expr '(' $ac_mid ')' + 1` +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in +?*) fits_in_uint=$ac_lo;; +'') result=? ;; +esac +else + if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run test program while cross compiling +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +long longval () { return sizeof (size_t) <= sizeof (unsigned int); } +unsigned long ulongval () { return sizeof (size_t) <= sizeof (unsigned int); } +#include +#include +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + exit (1); + if ((sizeof (size_t) <= sizeof (unsigned int)) < 0) + { + long i = longval (); + if (i != (sizeof (size_t) <= sizeof (unsigned int))) + exit (1); + fprintf (f, "%ld\n", i); + } + else + { + unsigned long i = ulongval (); + if (i != (sizeof (size_t) <= sizeof (unsigned int))) + exit (1); + fprintf (f, "%lu\n", i); + } + exit (ferror (f) || fclose (f) != 0); + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + fits_in_uint=`cat conftest.val` +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 ) +result=? +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +rm -f conftest.val + if test "$fits_in_uint" = 1; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + extern size_t foo; + extern unsigned long foo; + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + fits_in_uint=0 +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + fi + if test -z "$result"; then + if test "$fits_in_uint" = 1; then + result="$res_hi$res_lo"U + else + result="$res_hi$res_lo"UL + fi + else + result='~(size_t)0' + fi + fi + echo "$as_me:$LINENO: result: $result" >&5 +echo "${ECHO_T}$result" >&6 + if test "$result" != yes; then + +cat >>confdefs.h <<_ACEOF +#define SIZE_MAX $result +_ACEOF + + fi + + + + +for ac_header in stdint.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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 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 { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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-gawk@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 eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&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 + + + + if test "X$prefix" = "XNONE"; then + acl_final_prefix="$ac_default_prefix" + else + acl_final_prefix="$prefix" + fi + if test "X$exec_prefix" = "XNONE"; then + acl_final_exec_prefix='${prefix}' + else + acl_final_exec_prefix="$exec_prefix" + fi + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" + prefix="$acl_save_prefix" + + +# Check whether --with-gnu-ld or --without-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then + withval="$with_gnu_ld" + test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi; +# Prepare PATH_SEPARATOR. +# 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 +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + echo "$as_me:$LINENO: checking for ld used by GCC" >&5 +echo $ECHO_N "checking for ld used by GCC... $ECHO_C" >&6 + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | [A-Za-z]:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + echo "$as_me:$LINENO: checking for GNU ld" >&5 +echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6 +else + echo "$as_me:$LINENO: checking for non-GNU ld" >&5 +echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6 +fi +if test "${acl_cv_path_LD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + acl_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in + *GNU* | *'with BFD'*) + test "$with_gnu_ld" != no && break ;; + *) + test "$with_gnu_ld" != yes && break ;; + esac + fi + done + IFS="$ac_save_ifs" +else + acl_cv_path_LD="$LD" # Let the user override the test with a path. +fi +fi + +LD="$acl_cv_path_LD" +if test -n "$LD"; then + echo "$as_me:$LINENO: result: $LD" >&5 +echo "${ECHO_T}$LD" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 +echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} + { (exit 1); exit 1; }; } +echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 +echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6 +if test "${acl_cv_prog_gnu_ld+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # I'd rather use --version here, but apparently some GNU ld's only accept -v. +case `$LD -v 2>&1 &5 +echo "${ECHO_T}$acl_cv_prog_gnu_ld" >&6 +with_gnu_ld=$acl_cv_prog_gnu_ld + + + + echo "$as_me:$LINENO: checking for shared library run path origin" >&5 +echo $ECHO_N "checking for shared library run path origin... $ECHO_C" >&6 +if test "${acl_cv_rpath+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ + ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh + . ./conftest.sh + rm -f ./conftest.sh + acl_cv_rpath=done + +fi +echo "$as_me:$LINENO: result: $acl_cv_rpath" >&5 +echo "${ECHO_T}$acl_cv_rpath" >&6 + wl="$acl_cv_wl" + libext="$acl_cv_libext" + shlibext="$acl_cv_shlibext" + hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" + hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" + hardcode_direct="$acl_cv_hardcode_direct" + hardcode_minus_L="$acl_cv_hardcode_minus_L" + # Check whether --enable-rpath or --disable-rpath was given. +if test "${enable_rpath+set}" = set; then + enableval="$enable_rpath" + : +else + enable_rpath=yes +fi; + + + + + + + + use_additional=yes + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + +# Check whether --with-libiconv-prefix or --without-libiconv-prefix was given. +if test "${with_libiconv_prefix+set}" = set; then + withval="$with_libiconv_prefix" + + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + else + additional_includedir="$withval/include" + additional_libdir="$withval/lib" + fi + fi + +fi; + LIBICONV= + LTLIBICONV= + INCICONV= + rpathdirs= + ltrpathdirs= + names_already_handled= + names_next_round='iconv ' + while test -n "$names_next_round"; do + names_this_round="$names_next_round" + names_next_round= + for name in $names_this_round; do + already_handled= + for n in $names_already_handled; do + if test "$n" = "$name"; then + already_handled=yes + break + fi + done + if test -z "$already_handled"; then + names_already_handled="$names_already_handled $name" + uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` + eval value=\"\$HAVE_LIB$uppername\" + if test -n "$value"; then + if test "$value" = yes; then + eval value=\"\$LIB$uppername\" + test -z "$value" || LIBICONV="${LIBICONV}${LIBICONV:+ }$value" + eval value=\"\$LTLIB$uppername\" + test -z "$value" || LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$value" + else + : + fi + else + found_dir= + found_la= + found_so= + found_a= + if test $use_additional = yes; then + if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then + found_dir="$additional_libdir" + found_so="$additional_libdir/lib$name.$shlibext" + if test -f "$additional_libdir/lib$name.la"; then + found_la="$additional_libdir/lib$name.la" + fi + else + if test -f "$additional_libdir/lib$name.$libext"; then + found_dir="$additional_libdir" + found_a="$additional_libdir/lib$name.$libext" + if test -f "$additional_libdir/lib$name.la"; then + found_la="$additional_libdir/lib$name.la" + fi + fi + fi + fi + if test "X$found_dir" = "X"; then + for x in $LDFLAGS $LTLIBICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + case "$x" in + -L*) + dir=`echo "X$x" | sed -e 's/^X-L//'` + if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then + found_dir="$dir" + found_so="$dir/lib$name.$shlibext" + if test -f "$dir/lib$name.la"; then + found_la="$dir/lib$name.la" + fi + else + if test -f "$dir/lib$name.$libext"; then + found_dir="$dir" + found_a="$dir/lib$name.$libext" + if test -f "$dir/lib$name.la"; then + found_la="$dir/lib$name.la" + fi + fi + fi + ;; + esac + if test "X$found_dir" != "X"; then + break + fi + done + fi + if test "X$found_dir" != "X"; then + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$found_dir -l$name" + if test "X$found_so" != "X"; then + if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + else + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $found_dir" + fi + if test "$hardcode_direct" = yes; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + else + if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $found_dir" + fi + else + haveit= + for x in $LDFLAGS $LIBICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir" + fi + if test "$hardcode_minus_L" != no; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + else + LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" + fi + fi + fi + fi + else + if test "X$found_a" != "X"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_a" + else + LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir -l$name" + fi + fi + additional_includedir= + case "$found_dir" in + */lib | */lib/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'` + additional_includedir="$basedir/include" + ;; + esac + if test "X$additional_includedir" != "X"; then + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + for x in $CPPFLAGS $INCICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + INCICONV="${INCICONV}${INCICONV:+ }-I$additional_includedir" + fi + fi + fi + fi + fi + if test -n "$found_la"; then + save_libdir="$libdir" + case "$found_la" in + */* | *\\*) . "$found_la" ;; + *) . "./$found_la" ;; + esac + libdir="$save_libdir" + for dep in $dependency_libs; do + case "$dep" in + -L*) + additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` + if test "X$additional_libdir" != "X/usr/lib"; then + haveit= + if test "X$additional_libdir" = "X/usr/local/lib"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + haveit= + for x in $LDFLAGS $LIBICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }-L$additional_libdir" + fi + fi + haveit= + for x in $LDFLAGS $LTLIBICONV; do + + acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" @@ -6638,471 +9720,823 @@ fi; exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" - if test "X$x" = "X-L$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir" - fi - if test "$hardcode_minus_L" != no; then - LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" - else - LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" - fi - fi - fi - fi - else - if test "X$found_a" != "X"; then - LIBICONV="${LIBICONV}${LIBICONV:+ }$found_a" - else - LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir -l$name" - fi - fi - additional_includedir= - case "$found_dir" in - */lib | */lib/) - basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'` - additional_includedir="$basedir/include" - ;; - esac - if test "X$additional_includedir" != "X"; then - if test "X$additional_includedir" != "X/usr/include"; then - haveit= - if test "X$additional_includedir" = "X/usr/local/include"; then - if test -n "$GCC"; then - case $host_os in - linux*) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - for x in $CPPFLAGS $INCICONV; do + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$additional_libdir" + fi + fi + fi + fi + ;; + -R*) + dir=`echo "X$dep" | sed -e 's/^X-R//'` + if test "$enable_rpath" != no; then + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $dir" + fi + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $dir" + fi + fi + ;; + -l*) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` + ;; + *.la) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` + ;; + *) + LIBICONV="${LIBICONV}${LIBICONV:+ }$dep" + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$dep" + ;; + esac + done + fi + else + LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-l$name" + fi + fi + fi + done + done + if test "X$rpathdirs" != "X"; then + if test -n "$hardcode_libdir_separator"; then + alldirs= + for found_dir in $rpathdirs; do + alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" + done + acl_save_libdir="$libdir" + libdir="$alldirs" + eval flag=\"$hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" + else + for found_dir in $rpathdirs; do + acl_save_libdir="$libdir" + libdir="$found_dir" + eval flag=\"$hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" + done + fi + fi + if test "X$ltrpathdirs" != "X"; then + for found_dir in $ltrpathdirs; do + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-R$found_dir" + done + fi + + + + + + + + + echo "$as_me:$LINENO: checking for ptrdiff_t" >&5 +echo $ECHO_N "checking for ptrdiff_t... $ECHO_C" >&6 +if test "${ac_cv_type_ptrdiff_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 +int +main () +{ +if ((ptrdiff_t *) 0) + return 0; +if (sizeof (ptrdiff_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_ptrdiff_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_ptrdiff_t=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_ptrdiff_t" >&5 +echo "${ECHO_T}$ac_cv_type_ptrdiff_t" >&6 +if test $ac_cv_type_ptrdiff_t = yes; then + : +else + +cat >>confdefs.h <<\_ACEOF +#define ptrdiff_t long +_ACEOF + + +fi + + + + + + + + + + + +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 eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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 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 { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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-gawk@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 eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&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 asprintf fwprintf getcwd getegid geteuid getgid getuid \ +mempcpy munmap putenv setenv setlocale snprintf stpcpy strcasecmp strdup \ +strtoul tsearch wcslen __argz_count __argz_stringify __argz_next \ +__fsetlocking +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 eval "test \"\${$as_ac_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 gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +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 +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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 conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" +fi +done - if test "X$x" = "X-I$additional_includedir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_includedir"; then - INCICONV="${INCICONV}${INCICONV:+ }-I$additional_includedir" - fi - fi - fi - fi - fi - if test -n "$found_la"; then - save_libdir="$libdir" - case "$found_la" in - */* | *\\*) . "$found_la" ;; - *) . "./$found_la" ;; - esac - libdir="$save_libdir" - for dep in $dependency_libs; do - case "$dep" in - -L*) - additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` - if test "X$additional_libdir" != "X/usr/lib"; then - haveit= - if test "X$additional_libdir" = "X/usr/local/lib"; then - if test -n "$GCC"; then - case $host_os in - linux*) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - haveit= - for x in $LDFLAGS $LIBICONV; do - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - LIBICONV="${LIBICONV}${LIBICONV:+ }-L$additional_libdir" - fi - fi - haveit= - for x in $LDFLAGS $LTLIBICONV; do + echo "$as_me:$LINENO: checking whether _snprintf is declared" >&5 +echo $ECHO_N "checking whether _snprintf is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl__snprintf+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 () +{ - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - eval x=\"$x\" - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" +#ifndef _snprintf + char *p = (char *) _snprintf; +#endif - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$additional_libdir" - fi - fi - fi - fi - ;; - -R*) - dir=`echo "X$dep" | sed -e 's/^X-R//'` - if test "$enable_rpath" != no; then - haveit= - for x in $rpathdirs; do - if test "X$x" = "X$dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - rpathdirs="$rpathdirs $dir" - fi - haveit= - for x in $ltrpathdirs; do - if test "X$x" = "X$dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - ltrpathdirs="$ltrpathdirs $dir" - fi - fi - ;; - -l*) - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` - ;; - *.la) - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` - ;; - *) - LIBICONV="${LIBICONV}${LIBICONV:+ }$dep" - LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$dep" - ;; - esac - done - fi - else - LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" - LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-l$name" - fi - fi - fi - done - done - if test "X$rpathdirs" != "X"; then - if test -n "$hardcode_libdir_separator"; then - alldirs= - for found_dir in $rpathdirs; do - alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" - done - acl_save_libdir="$libdir" - libdir="$alldirs" - eval flag=\"$hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" - else - for found_dir in $rpathdirs; do - acl_save_libdir="$libdir" - libdir="$found_dir" - eval flag=\"$hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" - done - fi - fi - if test "X$ltrpathdirs" != "X"; then - for found_dir in $ltrpathdirs; do - LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-R$found_dir" - done + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl__snprintf=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl__snprintf=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl__snprintf" >&5 +echo "${ECHO_T}$ac_cv_have_decl__snprintf" >&6 + if test $ac_cv_have_decl__snprintf = yes; then + gt_value=1 + else + gt_value=0 fi +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL__SNPRINTF $gt_value +_ACEOF + echo "$as_me:$LINENO: checking whether _snwprintf is declared" >&5 +echo $ECHO_N "checking whether _snwprintf is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl__snwprintf+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 _snwprintf + char *p = (char *) _snwprintf; +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl__snwprintf=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_have_decl__snwprintf=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl__snwprintf" >&5 +echo "${ECHO_T}$ac_cv_have_decl__snwprintf" >&6 + if test $ac_cv_have_decl__snwprintf = yes; then + gt_value=1 + else + gt_value=0 + fi +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL__SNWPRINTF $gt_value +_ACEOF - - -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 eval "test \"\${$as_ac_Header+set}\" = set"; then - echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking whether feof_unlocked is declared" >&5 +echo $ECHO_N "checking whether feof_unlocked is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_feof_unlocked+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&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 -#line $LINENO "configure" + 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> +#include +int +main () +{ + +#ifndef feof_unlocked + char *p = (char *) feof_unlocked; +#endif + + ; + return 0; +} _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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 -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_header_compiler=yes + ac_cv_have_decl_feof_unlocked=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_header_compiler=no +ac_cv_have_decl_feof_unlocked=no fi -rm -f conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_feof_unlocked" >&5 +echo "${ECHO_T}$ac_cv_have_decl_feof_unlocked" >&6 + if test $ac_cv_have_decl_feof_unlocked = yes; then + gt_value=1 + else + gt_value=0 + fi -# 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 -#line $LINENO "configure" +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FEOF_UNLOCKED $gt_value +_ACEOF + + + + echo "$as_me:$LINENO: checking whether fgets_unlocked is declared" >&5 +echo $ECHO_N "checking whether fgets_unlocked is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_fgets_unlocked+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 <$ac_header> +#include +int +main () +{ + +#ifndef fgets_unlocked + char *p = (char *) fgets_unlocked; +#endif + + ; + return 0; +} _ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_fgets_unlocked=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_header_preproc=no +ac_cv_have_decl_fgets_unlocked=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 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 preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; - 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: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@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 eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=$ac_header_preproc" +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +echo "$as_me:$LINENO: result: $ac_cv_have_decl_fgets_unlocked" >&5 +echo "${ECHO_T}$ac_cv_have_decl_fgets_unlocked" >&6 + if test $ac_cv_have_decl_fgets_unlocked = yes; then + gt_value=1 + else + gt_value=0 + fi -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FGETS_UNLOCKED $gt_value _ACEOF -fi - -done - - - - - - - - - - - - - - - - - - - - - -for ac_func in feof_unlocked fgets_unlocked getc_unlocked getcwd getegid \ -geteuid getgid getuid mempcpy munmap putenv setenv setlocale stpcpy \ -strcasecmp strdup strtoul tsearch __argz_count __argz_stringify __argz_next \ -__fsetlocking -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 eval "test \"\${$as_ac_var+set}\" = set"; then + echo "$as_me:$LINENO: checking whether getc_unlocked is declared" >&5 +echo $ECHO_N "checking whether getc_unlocked is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_getc_unlocked+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* 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 -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -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 -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - +#include int main () { -return f != $ac_func; + +#ifndef getc_unlocked + char *p = (char *) getc_unlocked; +#endif + ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - eval "$as_ac_var=yes" + ac_cv_have_decl_getc_unlocked=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -eval "$as_ac_var=no" +ac_cv_have_decl_getc_unlocked=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +echo "$as_me:$LINENO: result: $ac_cv_have_decl_getc_unlocked" >&5 +echo "${ECHO_T}$ac_cv_have_decl_getc_unlocked" >&6 + if test $ac_cv_have_decl_getc_unlocked = yes; then + gt_value=1 + else + gt_value=0 + fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_GETC_UNLOCKED $gt_value _ACEOF -fi -done + + + case $gt_cv_func_printf_posix in + *yes) HAVE_POSIX_PRINTF=1 ;; + *) HAVE_POSIX_PRINTF=0 ;; + esac + + if test "$ac_cv_func_asprintf" = yes; then + HAVE_ASPRINTF=1 + else + HAVE_ASPRINTF=0 + fi + + if test "$ac_cv_func_snprintf" = yes; then + HAVE_SNPRINTF=1 + else + HAVE_SNPRINTF=0 + fi + + if test "$ac_cv_func_wprintf" = yes; then + HAVE_WPRINTF=1 + else + HAVE_WPRINTF=0 + fi @@ -7144,7 +10578,6 @@ else am_cv_func_iconv="no, consider installing GNU libiconv" am_cv_lib_iconv=no cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -7164,11 +10597,21 @@ iconv_t cd = iconv_open("",""); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&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 -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -7180,12 +10623,12 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f 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 $LIBICONV" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -7205,11 +10648,21 @@ iconv_t cd = iconv_open("",""); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&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 -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -7222,7 +10675,8 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS="$am_save_LIBS" fi @@ -7257,7 +10711,6 @@ echo $ECHO_N "checking for iconv declaration... $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -7286,11 +10739,21 @@ main () _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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 -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -7303,7 +10766,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 am_cv_proto_iconv_arg1="const" fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f 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 @@ -7326,7 +10789,6 @@ if test "${am_cv_langinfo_codeset+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -7343,11 +10805,21 @@ char* cs = nl_langinfo(CODESET); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&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 -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -7360,7 +10832,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 am_cv_langinfo_codeset=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $am_cv_langinfo_codeset" >&5 @@ -7381,7 +10854,6 @@ if test "${am_cv_val_LC_MESSAGES+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -7398,11 +10870,21 @@ return LC_MESSAGES _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&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 -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -7415,7 +10897,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 am_cv_val_LC_MESSAGES=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f 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 @@ -7555,7 +11038,6 @@ if test "${gt_cv_func_gnugettext2_libc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -7575,11 +11057,21 @@ return (int) gettext ("") + (int) ngettext ("", "", 0) + _nl_msg_cat_cntr + *_nl _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&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 -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -7592,7 +11084,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 gt_cv_func_gnugettext2_libc=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $gt_cv_func_gnugettext2_libc" >&5 echo "${ECHO_T}$gt_cv_func_gnugettext2_libc" >&6 @@ -7987,7 +11480,6 @@ else gt_save_LIBS="$LIBS" LIBS="$LIBS $LIBINTL" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -8011,11 +11503,21 @@ return (int) gettext ("") + (int) ngettext ("", "", 0) + _nl_msg_cat_cntr + *_nl _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&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 -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8028,11 +11530,11 @@ sed 's/^/| /' conftest.$ac_ext >&5 gt_cv_func_gnugettext2_libintl=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext if test "$gt_cv_func_gnugettext2_libintl" != yes && test -n "$LIBICONV"; then LIBS="$LIBS $LIBICONV" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -8056,11 +11558,21 @@ return (int) gettext ("") + (int) ngettext ("", "", 0) + _nl_msg_cat_cntr + *_nl _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&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 -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8075,7 +11587,8 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi CPPFLAGS="$gt_save_CPPFLAGS" LIBS="$gt_save_LIBS" @@ -8240,7 +11753,6 @@ if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -8261,11 +11773,21 @@ main () _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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 -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8278,12 +11800,11 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f 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 -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -8305,7 +11826,6 @@ 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 -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -8330,7 +11850,6 @@ if test $ac_cv_header_stdc = yes; then : else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -8342,9 +11861,9 @@ cat >>conftest.$ac_ext <<_ACEOF # 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')) + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif @@ -8355,7 +11874,7 @@ main () int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) + || toupper (i) != TOUPPER (i)) exit(2); exit (0); } @@ -8380,7 +11899,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi @@ -8400,7 +11919,6 @@ if test "${ac_cv_header_sys_wait_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -8427,11 +11945,21 @@ main () _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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 -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8444,7 +11972,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_sys_wait_h=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5 echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6 @@ -8462,7 +11990,6 @@ if test "${ac_cv_header_time+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -8483,11 +12010,21 @@ return 0; _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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 -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8500,7 +12037,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_time=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5 echo "${ECHO_T}$ac_cv_header_time" >&6 @@ -8549,7 +12086,6 @@ else echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -8560,11 +12096,21 @@ $ac_includes_default _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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 -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8577,7 +12123,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 @@ -8585,7 +12131,6 @@ echo "${ECHO_T}$ac_header_compiler" >&6 echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -8603,6 +12148,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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 @@ -8622,33 +12168,32 @@ 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 in - yes:no ) +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 preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&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 ) + 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: 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-autoconf@gnu.org. ## -## ------------------------------------ ## +## ------------------------------- ## +## Report this to bug-gawk@gnu.org ## +## ------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 @@ -8659,7 +12204,7 @@ echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - eval "$as_ac_Header=$ac_header_preproc" + eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 @@ -8694,7 +12239,6 @@ else echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -8705,11 +12249,21 @@ $ac_includes_default _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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 -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8722,7 +12276,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 @@ -8730,7 +12284,6 @@ echo "${ECHO_T}$ac_header_compiler" >&6 echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -8748,6 +12301,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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 @@ -8767,33 +12321,32 @@ 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 in - yes:no ) +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 preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&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 ) + 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: 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-autoconf@gnu.org. ## -## ------------------------------------ ## +## ------------------------------- ## +## Report this to bug-gawk@gnu.org ## +## ------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 @@ -8804,7 +12357,7 @@ echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - eval "$as_ac_Header=$ac_header_preproc" + eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 @@ -8837,7 +12390,6 @@ else echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -8848,11 +12400,21 @@ $ac_includes_default _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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 -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8865,7 +12427,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 @@ -8873,7 +12435,6 @@ echo "${ECHO_T}$ac_header_compiler" >&6 echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -8891,6 +12452,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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 @@ -8910,33 +12472,32 @@ 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 in - yes:no ) +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 preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&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 ) + 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: 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-autoconf@gnu.org. ## -## ------------------------------------ ## +## ------------------------------- ## +## Report this to bug-gawk@gnu.org ## +## ------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 @@ -8947,7 +12508,7 @@ echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - eval "$as_ac_Header=$ac_header_preproc" + eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 @@ -8970,7 +12531,6 @@ if test "${ac_cv_type_pid_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -8990,11 +12550,21 @@ if (sizeof (pid_t)) _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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 -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -9007,7 +12577,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_pid_t=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5 echo "${ECHO_T}$ac_cv_type_pid_t" >&6 @@ -9027,7 +12597,6 @@ if test "${ac_cv_type_signal+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -9054,11 +12623,21 @@ int i; _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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 -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -9071,7 +12650,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_signal=int fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5 echo "${ECHO_T}$ac_cv_type_signal" >&6 @@ -9087,7 +12666,6 @@ if test "${ac_cv_type_size_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -9107,11 +12685,21 @@ if (sizeof (size_t)) _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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 -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -9124,7 +12712,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_size_t=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f 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 @@ -9144,7 +12732,6 @@ if test "${ac_cv_type_uid_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -9186,7 +12773,6 @@ else ac_cv_type_getgroups=cross else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -9209,7 +12795,7 @@ main () for (i = 0; i < NGID; i++) gidset[i] = val.gval; n = getgroups (sizeof (gidset) / MAX (sizeof (int), sizeof (gid_t)) - 1, - gidset); + gidset); /* Exit non-zero if getgroups seems to require an array of ints. This happens when gid_t is short but getgroups modifies an array of ints. */ exit ((n > 0 && gidset[n] != val.gval) ? 1 : 0); @@ -9235,11 +12821,10 @@ sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_type_getgroups=int fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi if test $ac_cv_type_getgroups = cross; then cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -9273,13 +12858,12 @@ if test "${ac_cv_type_long_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -long long ll = 1; int i = 63; +long long ll = 1LL; int i = 63; int main () { @@ -9291,11 +12875,21 @@ long long llmax = (long long) -1; _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&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 -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -9308,7 +12902,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_long_long=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_long_long" >&5 echo "${ECHO_T}$ac_cv_type_long_long" >&6 @@ -9327,13 +12922,12 @@ if test "${ac_cv_type_unsigned_long_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* 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; +unsigned long long ull = 1ULL; int i = 63; int main () { @@ -9345,11 +12939,21 @@ unsigned long long ullmax = (unsigned long long) -1; _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&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 -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -9362,7 +12966,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_unsigned_long_long=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f 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 @@ -9382,7 +12987,6 @@ if test "${ac_cv_type_intmax_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -9402,111 +13006,78 @@ if (sizeof (intmax_t)) _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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 -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_type_intmax_t=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_type_intmax_t=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_type_intmax_t" >&5 -echo "${ECHO_T}$ac_cv_type_intmax_t" >&6 -if test $ac_cv_type_intmax_t = yes; then - : -else - test $ac_cv_type_long_long = yes \ - && ac_type='long long' \ - || ac_type='long' - -cat >>confdefs.h <<_ACEOF -#define intmax_t $ac_type -_ACEOF - -fi - - - - - echo "$as_me:$LINENO: checking for uintmax_t" >&5 -echo $ECHO_N "checking for uintmax_t... $ECHO_C" >&6 -if test "${ac_cv_type_uintmax_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -if ((uintmax_t *) 0) - return 0; -if (sizeof (uintmax_t)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_type_uintmax_t=yes + ac_cv_type_intmax_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_type_uintmax_t=no +ac_cv_type_intmax_t=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_type_uintmax_t" >&5 -echo "${ECHO_T}$ac_cv_type_uintmax_t" >&6 -if test $ac_cv_type_uintmax_t = yes; then +echo "$as_me:$LINENO: result: $ac_cv_type_intmax_t" >&5 +echo "${ECHO_T}$ac_cv_type_intmax_t" >&6 +if test $ac_cv_type_intmax_t = yes; then : else - test $ac_cv_type_unsigned_long_long = yes \ - && ac_type='unsigned long long' \ - || ac_type='unsigned long' + test $ac_cv_type_long_long = yes \ + && ac_type='long long' \ + || ac_type='long' cat >>confdefs.h <<_ACEOF -#define uintmax_t $ac_type +#define intmax_t $ac_type _ACEOF fi + + + + if test $jm_ac_cv_header_inttypes_h = no && test $jm_ac_cv_header_stdint_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 + + else + +cat >>confdefs.h <<\_ACEOF +#define HAVE_UINTMAX_T 1 +_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 -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -9526,11 +13097,21 @@ if (sizeof (ssize_t)) _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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 -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -9543,7 +13124,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_ssize_t=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f 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 @@ -9558,7 +13139,6 @@ _ACEOF fi cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -9583,7 +13163,6 @@ fi rm -f conftest* cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -9603,11 +13182,21 @@ main () _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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 -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -9623,13 +13212,59 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +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 () +{ + + wctype_t foo; + foo = 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then cat >>confdefs.h <<\_ACEOF -#define REGEX_MALLOC 1 +#define HAVE_WCTYPE_T 1 _ACEOF +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + for ac_func in vprintf do @@ -9640,21 +13275,28 @@ if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* 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 gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" @@ -9685,11 +13327,21 @@ return f != $ac_func; _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&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 -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -9702,7 +13354,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 @@ -9717,21 +13370,28 @@ if test "${ac_cv_func__doprnt+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +/* Define _doprnt to an innocuous variant, in case declares _doprnt. + For example, HP-UX 11i declares gettimeofday. */ +#define _doprnt innocuous__doprnt + /* System header to define __stub macros and hopefully few prototypes, which can conflict with char _doprnt (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ + #ifdef __STDC__ # include #else # include #endif + +#undef _doprnt + /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" @@ -9762,11 +13422,21 @@ return f != _doprnt; _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&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 -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -9779,7 +13449,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func__doprnt=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func__doprnt" >&5 echo "${ECHO_T}$ac_cv_func__doprnt" >&6 @@ -9813,7 +13484,6 @@ else echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -9824,11 +13494,21 @@ $ac_includes_default _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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 -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -9841,7 +13521,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 @@ -9849,7 +13529,6 @@ echo "${ECHO_T}$ac_header_compiler" >&6 echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -9867,6 +13546,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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 @@ -9886,33 +13566,32 @@ 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 in - yes:no ) +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 preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&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 ) + 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: 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-autoconf@gnu.org. ## -## ------------------------------------ ## +## ------------------------------- ## +## Report this to bug-gawk@gnu.org ## +## ------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 @@ -9923,7 +13602,7 @@ echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - eval "$as_ac_Header=$ac_header_preproc" + eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 @@ -9948,21 +13627,28 @@ if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* 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 gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" @@ -9993,11 +13679,21 @@ return f != $ac_func; _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&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 -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -10010,7 +13706,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 @@ -10031,7 +13728,6 @@ else gawk_ac_cv_func_strtod_c89=no else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -10081,7 +13777,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) gawk_ac_cv_func_strtod_c89=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $gawk_ac_cv_func_strtod_c89" >&5 @@ -10096,7 +13792,8 @@ fi -for ac_header in sys/time.h unistd.h + +for ac_header in stdlib.h sys/time.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then @@ -10112,7 +13809,6 @@ else echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -10123,11 +13819,21 @@ $ac_includes_default _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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 -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -10140,7 +13846,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 @@ -10148,7 +13854,6 @@ echo "${ECHO_T}$ac_header_compiler" >&6 echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -10166,6 +13871,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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 @@ -10185,33 +13891,32 @@ 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 in - yes:no ) +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 preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&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 ) + 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: 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-autoconf@gnu.org. ## -## ------------------------------------ ## +## ------------------------------- ## +## Report this to bug-gawk@gnu.org ## +## ------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 @@ -10222,7 +13927,7 @@ echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - eval "$as_ac_Header=$ac_header_preproc" + eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 @@ -10247,21 +13952,28 @@ if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* 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 gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" @@ -10292,11 +14004,21 @@ return f != $ac_func; _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&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 -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -10309,7 +14031,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 @@ -10330,7 +14053,6 @@ else ac_cv_func_working_mktime=no else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -10348,6 +14070,10 @@ cat >>conftest.$ac_ext <<_ACEOF # endif #endif +#if HAVE_STDLIB_H +# include +#endif + #if HAVE_UNISTD_H # include #endif @@ -10360,10 +14086,11 @@ cat >>conftest.$ac_ext <<_ACEOF #undef putenv static time_t time_t_max; +static time_t time_t_min; /* Values we'll use to set the TZ environment variable. */ -static const char *const tz_strings[] = { - (const char *) 0, "TZ=GMT0", "TZ=JST-9", +static char *tz_strings[] = { + (char *) 0, "TZ=GMT0", "TZ=JST-9", "TZ=EST+3EDT+2,M10.1.0/00:00:00,M2.3.0/00:00:00" }; #define N_STRINGS (sizeof (tz_strings) / sizeof (tz_strings[0])) @@ -10394,15 +14121,21 @@ spring_forward_gap () } static void -mktime_test (now) +mktime_test1 (now) time_t now; { struct tm *lt; if ((lt = localtime (&now)) && mktime (lt) != now) exit (1); - now = time_t_max - now; - if ((lt = localtime (&now)) && mktime (lt) != now) - exit (1); +} + +static void +mktime_test (now) + time_t now; +{ + mktime_test1 (now); + mktime_test1 ((time_t) (time_t_max - now)); + mktime_test1 ((time_t) (time_t_min + now)); } static void @@ -10462,6 +14195,9 @@ main () for (time_t_max = 1; 0 < time_t_max; time_t_max *= 2) continue; time_t_max--; + if ((time_t) -1 < 0) + for (time_t_min = -1; (time_t) (time_t_min * 2) < 0; time_t_min *= 2) + continue; delta = time_t_max / 997; /* a suitable prime number */ for (i = 0; i < N_STRINGS; i++) { @@ -10470,11 +14206,12 @@ main () for (t = 0; t <= time_t_max - delta; t += delta) mktime_test (t); - mktime_test ((time_t) 60 * 60); - mktime_test ((time_t) 60 * 60 * 24); + mktime_test ((time_t) 1); + mktime_test ((time_t) (60 * 60)); + mktime_test ((time_t) (60 * 60 * 24)); for (j = 1; 0 < j; j *= 2) - bigtime_test (j); + bigtime_test (j); bigtime_test (j - 1); } irix_6_4_bug (); @@ -10502,13 +14239,20 @@ sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_func_working_mktime=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $ac_cv_func_working_mktime" >&5 echo "${ECHO_T}$ac_cv_func_working_mktime" >&6 if test $ac_cv_func_working_mktime = no; then - LIBOBJS="$LIBOBJS mktime.$ac_objext" + case $LIBOBJS in + "mktime.$ac_objext" | \ + *" mktime.$ac_objext" | \ + "mktime.$ac_objext "* | \ + *" mktime.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS mktime.$ac_objext" ;; +esac + fi case "$ac_cv_func_working_mktime" in @@ -10529,7 +14273,6 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -10553,11 +14296,21 @@ fmod (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&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 -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -10570,7 +14323,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_m_fmod=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f 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_m_fmod" >&5 @@ -10604,9 +14358,14 @@ fi -for ac_func in fmod getgrent getgroups grantpt mbrlen mbrtowc memcmp \ - memcpy memset setlocale snprintf strchr strerror \ - strftime strncasecmp strtod system tzset wcrtomb wcscoll + + + + +for ac_func in fmod getgrent getgroups grantpt iswctype mbrlen \ + memcmp memcpy memmove memset setlocale snprintf strchr \ + strerror strftime strncasecmp strtod strtoul system tzset \ + wcrtomb wcscoll wcscoll wctype do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 @@ -10615,21 +14374,28 @@ if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* 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 gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" @@ -10660,11 +14426,21 @@ return f != $ac_func; _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&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 -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -10677,7 +14453,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 @@ -10690,6 +14467,69 @@ fi done + 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 () +{ +mbstate_t state; return ! (sizeof state && mbrtowc); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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 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 + + if test "${ac_cv_header_dlfcn_h+set}" = set; then echo "$as_me:$LINENO: checking for dlfcn.h" >&5 echo $ECHO_N "checking for dlfcn.h... $ECHO_C" >&6 @@ -10703,7 +14543,6 @@ else echo "$as_me:$LINENO: checking dlfcn.h usability" >&5 echo $ECHO_N "checking dlfcn.h usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -10714,11 +14553,21 @@ $ac_includes_default _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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 -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -10731,7 +14580,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 @@ -10739,7 +14588,6 @@ echo "${ECHO_T}$ac_header_compiler" >&6 echo "$as_me:$LINENO: checking dlfcn.h presence" >&5 echo $ECHO_N "checking dlfcn.h presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -10757,6 +14605,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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 @@ -10776,33 +14625,32 @@ 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 in - yes:no ) +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) { echo "$as_me:$LINENO: WARNING: dlfcn.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: dlfcn.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 + { echo "$as_me:$LINENO: WARNING: dlfcn.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: dlfcn.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes ;; - no:yes ) + no:yes:* ) { echo "$as_me:$LINENO: WARNING: dlfcn.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: dlfcn.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: dlfcn.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: dlfcn.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: dlfcn.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: dlfcn.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: dlfcn.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: dlfcn.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: dlfcn.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: dlfcn.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: dlfcn.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: dlfcn.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## +## ------------------------------- ## +## Report this to bug-gawk@gnu.org ## +## ------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 @@ -10846,7 +14694,6 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -10870,11 +14717,21 @@ dlopen (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&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 -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -10887,7 +14744,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dl_dlopen=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f 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_dl_dlopen" >&5 @@ -10921,7 +14779,6 @@ if test "${ac_cv_func_getpgrp_void+set}" = set; then else # Use it with a single arg. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -10938,11 +14795,21 @@ getpgrp (0); _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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 -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -10955,7 +14822,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_getpgrp_void=yes fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_getpgrp_void" >&5 @@ -10971,6 +14838,63 @@ fi ;; esac +echo "$as_me:$LINENO: checking for printf %F format" >&5 +echo $ECHO_N "checking for printf %F format... $ECHO_C" >&6 +if test "$cross_compiling" = yes; then + +cat >>confdefs.h <<\_ACEOF +#define PRINTF_HAS_F_FORMAT 0 +_ACEOF + + +else + cat >conftest.$ac_ext <<_ACEOF + +#include + +int main() +{ + char buf[100]; + + sprintf(buf, "%F", 123.45); + + if (strcmp(buf, "123.450000") == 0) + return 0; + else + return 1; +} + +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + +cat >>confdefs.h <<\_ACEOF +#define PRINTF_HAS_F_FORMAT 1 +_ACEOF + + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +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 ) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + gawk_have_sockets=no # Check for system-dependent location of socket libraries @@ -11002,21 +14926,28 @@ if test "${ac_cv_func_gethostbyname+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +/* Define gethostbyname to an innocuous variant, in case declares gethostbyname. + For example, HP-UX 11i declares gettimeofday. */ +#define gethostbyname innocuous_gethostbyname + /* System header to define __stub macros and hopefully few prototypes, which can conflict with char gethostbyname (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ + #ifdef __STDC__ # include #else # include #endif + +#undef gethostbyname + /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" @@ -11047,11 +14978,21 @@ return f != gethostbyname; _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&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 -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -11064,7 +15005,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_gethostbyname=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyname" >&5 echo "${ECHO_T}$ac_cv_func_gethostbyname" >&6 @@ -11078,7 +15020,6 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lnsl $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -11102,11 +15043,21 @@ gethostbyname (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&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 -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -11119,7 +15070,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_nsl_gethostbyname=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f 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_nsl_gethostbyname" >&5 @@ -11143,21 +15095,28 @@ if test "${ac_cv_func_connect+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +/* Define connect to an innocuous variant, in case declares connect. + For example, HP-UX 11i declares gettimeofday. */ +#define connect innocuous_connect + /* System header to define __stub macros and hopefully few prototypes, which can conflict with char connect (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ + #ifdef __STDC__ # include #else # include #endif + +#undef connect + /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" @@ -11188,11 +15147,21 @@ return f != connect; _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&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 -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -11205,7 +15174,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_connect=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_connect" >&5 echo "${ECHO_T}$ac_cv_func_connect" >&6 @@ -11219,7 +15189,6 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $SOCKET_LIBS $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -11243,11 +15212,21 @@ connect (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&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 -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -11260,7 +15239,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_socket_connect=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f 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_socket_connect" >&5 @@ -11301,7 +15281,6 @@ if test "${ac_cv_member_struct_stat_st_blksize+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -11320,11 +15299,21 @@ return 0; _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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 -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -11336,7 +15325,6 @@ else sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -11355,11 +15343,21 @@ return 0; _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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 -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -11372,9 +15370,9 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_member_struct_stat_st_blksize=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_blksize" >&5 echo "${ECHO_T}$ac_cv_member_struct_stat_st_blksize" >&6 @@ -11398,7 +15396,6 @@ if test "${ac_cv_header_time+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -11419,11 +15416,21 @@ return 0; _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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 -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -11436,7 +15443,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_time=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5 echo "${ECHO_T}$ac_cv_header_time" >&6 @@ -11454,7 +15461,6 @@ if test "${ac_cv_struct_tm+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -11473,11 +15479,21 @@ struct tm *tp; tp->tm_sec; _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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 -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -11490,7 +15506,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_struct_tm=sys/time.h fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_struct_tm" >&5 echo "${ECHO_T}$ac_cv_struct_tm" >&6 @@ -11508,7 +15524,6 @@ if test "${ac_cv_member_struct_tm_tm_zone+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -11530,11 +15545,21 @@ return 0; _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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 -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -11546,7 +15571,6 @@ else sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -11568,11 +15592,21 @@ return 0; _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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 -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -11585,9 +15619,9 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_member_struct_tm_tm_zone=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_member_struct_tm_tm_zone" >&5 echo "${ECHO_T}$ac_cv_member_struct_tm_tm_zone" >&6 @@ -11613,7 +15647,6 @@ if test "${ac_cv_var_tzname+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -11634,11 +15667,21 @@ atoi(*tzname); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&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 -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -11651,7 +15694,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_var_tzname=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_var_tzname" >&5 echo "${ECHO_T}$ac_cv_var_tzname" >&6 @@ -11672,7 +15716,6 @@ if test "${ac_cv_c_char_unsigned+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -11691,11 +15734,21 @@ test_array [0] = 0 _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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 -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -11708,7 +15761,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_char_unsigned=yes fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_c_char_unsigned" >&5 echo "${ECHO_T}$ac_cv_c_char_unsigned" >&6 @@ -11725,7 +15778,6 @@ if test "${ac_cv_c_const+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -11788,11 +15840,21 @@ main () _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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 -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -11805,7 +15867,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_const=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f 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 @@ -11825,7 +15887,6 @@ else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -11840,11 +15901,21 @@ $ac_kw foo_t foo () {return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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 -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -11856,23 +15927,27 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext 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) ;; - no) -cat >>confdefs.h <<\_ACEOF -#define inline -_ACEOF - ;; - *) cat >>confdefs.h <<_ACEOF -#define inline $ac_cv_c_inline + *) + 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 preprocessor stringizing operator" >&5 @@ -11881,7 +15956,6 @@ if test "${ac_cv_c_stringize+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -11911,7 +15985,10 @@ _ACEOF fi - ac_config_files="$ac_config_files Makefile awklib/Makefile doc/Makefile intl/Makefile po/Makefile.in test/Makefile" + ac_config_headers="$ac_config_headers config.h:configh.in" + + ac_config_files="$ac_config_files Makefile awklib/Makefile doc/Makefile intl/Makefile po/Makefile.in test/Makefile version.c:version.in" + 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 @@ -11940,13 +16017,13 @@ _ACEOF # `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" + "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 \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | @@ -11976,13 +16053,13 @@ test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # 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[ ]*=/{ + ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/; s/:*\${srcdir}:*/:/; s/:*@srcdir@:*/:/; -s/^\([^=]*=[ ]*\):*/\1/; +s/^\([^=]*=[ ]*\):*/\1/; s/:*$//; -s/^[^=]*=[ ]*$//; +s/^[^=]*=[ ]*$//; }' fi @@ -11993,7 +16070,7 @@ ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_i=`echo "$ac_i" | - sed 's/\$U\././;s/\.o$//;s/\.obj$//'` + sed 's/\$U\././;s/\.o$//;s/\.obj$//'` # 2. Add them. ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' @@ -12017,6 +16094,13 @@ 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 +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 @@ -12051,9 +16135,10 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi +DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. -if (FOO=FOO; unset FOO) >/dev/null 2>&1; then +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false @@ -12072,7 +16157,7 @@ for as_var in \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do - if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then + 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 @@ -12251,16 +16336,17 @@ rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else + test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. -as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" +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="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS @@ -12286,8 +16372,8 @@ _ASBOX } >&5 cat >&5 <<_CSEOF -This file was extended by GNU Awk $as_me 3.1.3, which was -generated by GNU Autoconf 2.57. Invocation command line was +This file was extended by GNU Awk $as_me 3.1.4, which was +generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -12331,9 +16417,9 @@ Usage: $0 [OPTIONS] [FILE]... -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 + instantiate the configuration file FILE --header=FILE[:TEMPLATE] - instantiate the configuration header FILE + instantiate the configuration header FILE Configuration files: $config_files @@ -12349,12 +16435,11 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -GNU Awk config.status 3.1.3 -configured by $0, generated by GNU Autoconf 2.57, +GNU Awk config.status 3.1.4 +configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" -Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 -Free Software Foundation, Inc. +Copyright (C) 2003 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." srcdir=$srcdir @@ -12451,7 +16536,7 @@ cat >>$CONFIG_STATUS <<_ACEOF AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" # Capture the value of obsolete ALL_LINGUAS because we need it to compute - # POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES, CATALOGS. But hide it + # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it # from automake. eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"' # Capture the value of LINGUAS because we need it to compute CATALOGS. @@ -12473,6 +16558,7 @@ do "intl/Makefile" ) CONFIG_FILES="$CONFIG_FILES intl/Makefile" ;; "po/Makefile.in" ) CONFIG_FILES="$CONFIG_FILES po/Makefile.in" ;; "test/Makefile" ) CONFIG_FILES="$CONFIG_FILES test/Makefile" ;; + "version.c" ) CONFIG_FILES="$CONFIG_FILES version.c:version.in" ;; "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "default-1" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;; "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h:configh.in" ;; @@ -12577,6 +16663,7 @@ s,@install_sh@,$install_sh,;t t s,@STRIP@,$STRIP,;t t s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t +s,@mkdir_p@,$mkdir_p,;t t s,@AWK@,$AWK,;t t s,@SET_MAKE@,$SET_MAKE,;t t s,@am__leading_dot@,$am__leading_dot,;t t @@ -12620,6 +16707,10 @@ s,@host_vendor@,$host_vendor,;t t s,@host_os@,$host_os,;t t s,@ALLOCA@,$ALLOCA,;t t s,@GLIBC21@,$GLIBC21,;t t +s,@HAVE_POSIX_PRINTF@,$HAVE_POSIX_PRINTF,;t t +s,@HAVE_ASPRINTF@,$HAVE_ASPRINTF,;t t +s,@HAVE_SNPRINTF@,$HAVE_SNPRINTF,;t t +s,@HAVE_WPRINTF@,$HAVE_WPRINTF,;t t s,@LIBICONV@,$LIBICONV,;t t s,@LTLIBICONV@,$LTLIBICONV,;t t s,@INTLBISON@,$INTLBISON,;t t @@ -12667,9 +16758,9 @@ _ACEOF (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else - ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr $ac_sed_frag + 1` ac_beg=$ac_end @@ -12687,21 +16778,21 @@ for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || + 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; } @@ -12717,10 +16808,10 @@ echo X"$ac_file" | as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || + 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; } @@ -12758,12 +16849,45 @@ case $srcdir in ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac -# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be -# absolute. -ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` -ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` -ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` -ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac case $INSTALL in @@ -12785,7 +16909,7 @@ echo "$as_me: creating $ac_file" >&6;} configure_input="$ac_file. " fi configure_input=$configure_input"Generated from `echo $ac_file_in | - sed 's,.*/,,'` by configure." + sed 's,.*/,,'` by configure." # First look for the input files in the build tree, otherwise in the # src tree. @@ -12794,24 +16918,24 @@ echo "$as_me: creating $ac_file" >&6;} case $f in -) echo $tmp/stdin ;; [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } - echo $f;; + echo "$f";; *) # Relative - if test -f "$f"; then - # Build tree - echo $f - elif test -f "$srcdir/$f"; then - # Source tree - echo $srcdir/$f - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } - fi;; + fi;; esac done` || { (exit 1); exit 1; } _ACEOF @@ -12853,12 +16977,12 @@ cat >>$CONFIG_STATUS <<\_ACEOF # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. -ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' -ac_dB='[ ].*$,\1#\2' +ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='[ ].*$,\1#\2' ac_dC=' ' ac_dD=',;t' # ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". -ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_uB='$,\1#\2define\3' ac_uC=' ' ac_uD=',;t' @@ -12867,11 +16991,11 @@ for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac @@ -12885,28 +17009,29 @@ echo "$as_me: creating $ac_file" >&6;} case $f in -) echo $tmp/stdin ;; [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } - echo $f;; + # Do quote $f, to prevent DOS paths from being IFS'd. + echo "$f";; *) # Relative - if test -f "$f"; then - # Build tree - echo $f - elif test -f "$srcdir/$f"; then - # Source tree - echo $srcdir/$f - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } - fi;; + fi;; esac done` || { (exit 1); exit 1; } # Remove the trailing spaces. - sed 's/[ ]*$//' $ac_file_inputs >$tmp/in + sed 's/[ ]*$//' $ac_file_inputs >$tmp/in _ACEOF @@ -12929,9 +17054,9 @@ s/[\\&,]/\\&/g s,[\\$`],\\&,g t clear : clear -s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp t end -s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp : end _ACEOF # If some macros were called several times there might be several times @@ -12945,13 +17070,13 @@ rm -f confdef2sed.sed # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. cat >>conftest.undefs <<\_ACEOF -s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, +s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, _ACEOF # Break up conftest.defines because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS -echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS +echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS echo ' :' >>$CONFIG_STATUS rm -f conftest.tail @@ -12960,7 +17085,7 @@ do # Write a limited-size here document to $tmp/defines.sed. echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#define' lines. - echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS + echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS @@ -12987,7 +17112,7 @@ do # Write a limited-size here document to $tmp/undefs.sed. echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#undef' - echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS + echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS @@ -13021,10 +17146,10 @@ echo "$as_me: $ac_file is unchanged" >&6;} else ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || + 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; } @@ -13040,10 +17165,10 @@ echo X"$ac_file" | as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || + 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; } @@ -13075,10 +17200,10 @@ for _am_header in $config_headers :; do done echo "timestamp for $ac_file" >`(dirname $ac_file) 2>/dev/null || $as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X$ac_file : 'X\(//\)[^/]' \| \ - X$ac_file : 'X\(//\)$' \| \ - X$ac_file : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || + 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; } @@ -13101,16 +17226,41 @@ for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_dir=`(dirname "$ac_dest") 2>/dev/null || $as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_dest" : 'X\(//\)[^/]' \| \ - X"$ac_dest" : 'X\(//\)$' \| \ - X"$ac_dest" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || + X"$ac_dest" : 'X\(//\)[^/]' \| \ + X"$ac_dest" : 'X\(//\)$' \| \ + X"$ac_dest" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || echo X"$ac_dest" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$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'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + ac_builddir=. if test "$ac_dir" != .; then @@ -13136,12 +17286,45 @@ case $srcdir in ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac -# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be -# absolute. -ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` -ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` -ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` -ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 @@ -13159,10 +17342,10 @@ echo "$as_me: executing $ac_dest commands" >&6;} if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then dirpart=`(dirname "$mf") 2>/dev/null || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$mf" : 'X\(//\)[^/]' \| \ - X"$mf" : 'X\(//\)$' \| \ - X"$mf" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || + X"$mf" : 'X\(//\)[^/]' \| \ + X"$mf" : 'X\(//\)$' \| \ + X"$mf" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } @@ -13175,14 +17358,14 @@ echo X"$mf" | grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue # Extract the definition of DEP_FILES from the Makefile without # running `make'. - DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue # When using ansi2knr, U may be empty or an underscore; expand it - U=`sed -n -e '/^U = / s///p' < "$mf"` + U=`sed -n 's/^U = //p' < "$mf"` test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" # 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 -e ' + for file in `sed -n ' /^DEP_FILES = .*\\\\$/ { s/^DEP_FILES = // :loop @@ -13198,10 +17381,10 @@ echo X"$mf" | test -f "$dirpart/$file" && continue fdir=`(dirname "$file") 2>/dev/null || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$file" : 'X\(//\)[^/]' \| \ - X"$file" : 'X\(//\)$' \| \ - X"$file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || + X"$file" : 'X\(//\)[^/]' \| \ + X"$file" : 'X\(//\)$' \| \ + X"$file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } @@ -13217,10 +17400,10 @@ echo X"$file" | as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || + 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; } @@ -13263,7 +17446,7 @@ done test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" POMAKEFILEDEPS="POTFILES.in" - # ALL_LINGUAS, POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES depend + # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend # on $ac_dir but don't depend on user-specified configuration # parameters. if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then @@ -13279,19 +17462,27 @@ done # The set of available languages was given in configure.in. eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS' fi + # Compute POFILES + # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po) + # Compute UPDATEPOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update) + # Compute DUMMYPOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop) + # Compute GMOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo) case "$ac_given_srcdir" in .) srcdirpre= ;; *) srcdirpre='$(srcdir)/' ;; esac POFILES= - GMOFILES= UPDATEPOFILES= DUMMYPOFILES= + GMOFILES= for lang in $ALL_LINGUAS; do POFILES="$POFILES $srcdirpre$lang.po" - GMOFILES="$GMOFILES $srcdirpre$lang.gmo" UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" DUMMYPOFILES="$DUMMYPOFILES $lang.nop" + GMOFILES="$GMOFILES $srcdirpre$lang.gmo" done # CATALOGS depends on both $ac_dir and the user's LINGUAS # environment variable. @@ -13326,7 +17517,7 @@ done done fi test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" - sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" + sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do if test -f "$f"; then case "$f" in @@ -13372,3 +17563,9 @@ if test "$no_create" != yes; then $ac_cs_success || { (exit 1); exit 1; } fi + +# This is a significant and rather ugly hack. We want to keep +# version.c from being removed upon `make distclean'. +# We put the `$$' on the front for old systems with 14-char filenames. +sed '/CONFIG_CLEAN_FILES/s/version.c//' < Makefile > $$.Makefile +mv $$.Makefile Makefile diff --git a/configure.ac b/configure.ac index 0fc2afb9c..c5ef7e5a3 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ dnl dnl configure.ac --- autoconf input file for gawk dnl -dnl Copyright (C) 1995-2003 the Free Software Foundation, Inc. +dnl Copyright (C) 1995-2004 the Free Software Foundation, Inc. dnl dnl This file is part of GAWK, the GNU implementation of the dnl AWK Programming Language. @@ -23,8 +23,7 @@ dnl dnl Process this file with autoconf to produce a configure script. -dnl *** IMPORTANT ***: Fix version in both AC_INIT and AM_INIT_AUTOMAKE -AC_INIT([GNU Awk], 3.1.3, bug-gawk@gnu.org, gawk) +AC_INIT([GNU Awk], 3.1.4, bug-gawk@gnu.org, gawk) # This is a hack. Different versions of install on different systems # are just too different. Chuck it and use install-sh. @@ -40,9 +39,8 @@ then export INSTALL fi -AC_PREREQ(2.57) -AC_CONFIG_HEADERS([config.h:configh.in], [cat $srcdir/custom.h >> config.h]) -AM_INIT_AUTOMAKE(gawk, 3.1.3) +AC_PREREQ(2.59) +AM_INIT_AUTOMAKE dnl Additional argument stuff AC_ARG_ENABLE(portals, [ --enable-portals Enable /p as path prefix for portals], @@ -93,6 +91,11 @@ if test -f $srcdir/.developing then # add other debug flags as appropriate, save GAWKDEBUG for emergencies CFLAGS="$CFLAGS -DARRAYDEBUG" + if grep dbug $srcdir/.developing + then + CFLAGS="$CFLAGS -DDBUG" + LIBS="$LIBS dbug/libdbug.a" + fi # turn on compiler warnings if we're doing development if test "$GCC" = yes then @@ -136,7 +139,7 @@ esac dnl initialize GNU gettext AM_GNU_GETTEXT([no-libtool], [need-ngettext]) -AM_GNU_GETTEXT_VERSION(0.12.1) +AM_GNU_GETTEXT_VERSION(0.14.1) dnl checks for header files AC_HEADER_STDC @@ -174,9 +177,14 @@ AC_TRY_COMPILE([#include ],[ ], AC_DEFINE(TIME_T_IN_SYS_TYPES_H, 1, [some systems define this type here])) +dnl check for wctype_t in +AC_TRY_COMPILE([#include ],[ + wctype_t foo; + foo = 0; +], + AC_DEFINE(HAVE_WCTYPE_T, 1, [systems should define this type here])) dnl checks for functions -AC_DEFINE(REGEX_MALLOC, 1, [use malloc instead of alloca in regex.c]) AC_FUNC_VPRINTF GAWK_AC_FUNC_STRTOD_C89 AC_FUNC_MKTIME @@ -186,9 +194,12 @@ yes) AC_DEFINE(HAVE_MKTIME, 1, [we have the mktime function]) esac AC_CHECK_LIB(m, fmod) -AC_CHECK_FUNCS(fmod getgrent getgroups grantpt mbrlen mbrtowc memcmp \ - memcpy memset setlocale snprintf strchr strerror \ - strftime strncasecmp strtod system tzset wcrtomb wcscoll) +AC_CHECK_FUNCS(fmod getgrent getgroups grantpt iswctype mbrlen \ + memcmp memcpy memmove memset setlocale snprintf strchr \ + strerror strftime strncasecmp strtod strtoul system tzset \ + wcrtomb wcscoll wcscoll wctype) +dnl this check for both mbrtowc and the mbstate_t type, which is good +AC_FUNC_MBRTOWC dnl check for dynamic linking dnl This is known to be very primitive @@ -221,6 +232,32 @@ case `(uname) 2> /dev/null` in ;; esac +dnl check for printf %F format +AC_MSG_CHECKING([for printf %F format]) +AC_RUN_IFELSE([ +#include + +int main() +{ + char buf[[100]]; + + sprintf(buf, "%F", 123.45); + + if (strcmp(buf, "123.450000") == 0) + return 0; + else + return 1; +} +], +dnl action if true: + AC_DEFINE(PRINTF_HAS_F_FORMAT, 1, [Define to 1 if *printf supports %F format]) + AC_MSG_RESULT([yes]), +dnl action if false: + AC_MSG_RESULT([no]), +dnl action if cross-compiling, assume the worst: + AC_DEFINE(PRINTF_HAS_F_FORMAT, 0, [Define to 1 if *printf supports %F format]) +) + dnl check for sockets GAWK_AC_LIB_SOCKETS @@ -236,9 +273,18 @@ AC_C_CONST AC_C_INLINE AC_C_STRINGIZE -AC_OUTPUT(Makefile \ +AC_CONFIG_HEADERS([config.h:configh.in], [cat $srcdir/custom.h >> config.h]) +AC_CONFIG_FILES(Makefile \ awklib/Makefile \ doc/Makefile \ intl/Makefile \ po/Makefile.in \ - test/Makefile) + test/Makefile \ + [version.c:version.in]) +AC_OUTPUT + +# This is a significant and rather ugly hack. We want to keep +# version.c from being removed upon `make distclean'. +# We put the `$$' on the front for old systems with 14-char filenames. +sed '/CONFIG_CLEAN_FILES/s/version.c//' < Makefile > $$.Makefile +mv $$.Makefile Makefile diff --git a/custom.h b/custom.h index 027f8e361..598b3c6aa 100644 --- a/custom.h +++ b/custom.h @@ -11,7 +11,7 @@ */ /* - * Copyright (C) 1995-2003 the Free Software Foundation, Inc. + * Copyright (C) 1995-2004 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. diff --git a/depcomp b/depcomp index 51606f8c4..25bdb1889 100755 --- a/depcomp +++ b/depcomp @@ -1,7 +1,9 @@ #! /bin/sh - # depcomp - compile a program generating dependencies as side-effects -# Copyright 1999, 2000 Free Software Foundation, Inc. + +scriptversion=2004-04-25.13 + +# Copyright (C) 1999, 2000, 2003, 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 @@ -25,6 +27,36 @@ # 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'. + 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 0 + ;; + -v | --v*) + echo "depcomp $scriptversion" + exit 0 + ;; +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 @@ -172,19 +204,25 @@ sgi) aix) # The C for AIX Compiler uses -M and outputs the dependencies - # in a .u file. 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. - stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'` + # 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" - outname="$stripped.o" 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" @@ -192,6 +230,7 @@ aix) 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:'. @@ -207,11 +246,9 @@ aix) ;; icc) - # Must come before tru64. - - # Intel's C compiler understands `-MD -MF file'. However + # Intel's C compiler understands `-MD -MF file'. However on # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c - # will fill foo.d with something like + # 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: @@ -219,6 +256,12 @@ icc) # 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=$? @@ -228,11 +271,15 @@ icc) exit $stat fi rm -f "$depfile" - # Each line is of the form `foo.o: dependent.h'. + # 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 -e "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" - sed -e "s,^[^:]*: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" + 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" ;; @@ -247,31 +294,37 @@ tru64) base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then + # Dependencies are output in .lo.d with libtool 1.4. + # They are output in .o.d with libtool 1.5. tmpdepfile1="$dir.libs/$base.lo.d" - tmpdepfile2="$dir.libs/$base.d" + tmpdepfile2="$dir.libs/$base.o.d" + tmpdepfile3="$dir.libs/$base.d" "$@" -Wc,-MD else tmpdepfile1="$dir$base.o.d" tmpdepfile2="$dir$base.d" + tmpdepfile3="$dir$base.d" "$@" -MD fi stat=$? if test $stat -eq 0; then : else - rm -f "$tmpdepfile1" "$tmpdepfile2" + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi if test -f "$tmpdepfile1"; then tmpdepfile="$tmpdepfile1" - else + elif test -f "$tmpdepfile2"; then tmpdepfile="$tmpdepfile2" + else + tmpdepfile="$tmpdepfile3" fi if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" - # That's a space and a tab in the []. - sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$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 @@ -284,7 +337,7 @@ tru64) dashmstdout) # Important note: in order to support this mode, a compiler *must* - # always write the proprocessed file to stdout, regardless of -o. + # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. @@ -380,7 +433,7 @@ makedepend) cpp) # Important note: in order to support this mode, a compiler *must* - # always write the proprocessed file to stdout. + # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. @@ -422,7 +475,7 @@ cpp) msvisualcpp) # Important note: in order to support this mode, a compiler *must* - # always write the proprocessed file to stdout, regardless of -o, + # always write the preprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. "$@" || exit $? IFS=" " @@ -462,3 +515,12 @@ none) 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/dfa.c b/dfa.c new file mode 100644 index 000000000..f9ccb25bf --- /dev/null +++ b/dfa.c @@ -0,0 +1,3745 @@ +/* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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 + +#include "mbsupport.h" /* defined MBS_SUPPORT if appropriate */ + +#ifdef MBS_SUPPORT +# include +# 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 +# else +# define _(Str) (Str) +# endif +# endif +#else +# define _(Str) (Str) +#endif + +#include "regex.h" +#include "dfa.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 int hard_locale PARAMS ((int category)); + +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. + + singlebyte 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 + singlebyte 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;/* refference to begin in dfaexec(). */ +static unsigned char const *buf_end; /* refference to end in dfaexec(). */ +static unsigned long buf_offset; /* Go fast. */ +#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 singlebyte character. + cur_mb_index is aleady 0. */ + cur_mb_len = 1; + /* Otherwise, cur_mb_len == 1, it is a singlebyte 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->ch_classes = NULL; + work_mbc->chars = 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; + } + } + 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; + if (case_fold && (iswlower((wint_t) wc) || iswupper((wint_t) wc))) + { + wint_t altcase; + + altcase = wc; /* keeps compiler happy */ + if (iswlower((wint_t) wc)) + altcase = towupper((wint_t) wc); + else if (iswupper((wint_t) wc)) + altcase = towlower((wint_t) wc); + + REALLOC_IF_NECESSARY(work_mbc->chars, wchar_t, chars_al, + work_mbc->nchars + 1); + work_mbc->chars[work_mbc->nchars++] = (wchar_t) altcase; + } + } + } + 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); + +#ifndef GAWK + case 's': + case 'S': + if (!backslash || (syntax_bits & RE_NO_GNU_OPS)) + goto normal_char; + zeroset(ccl); + for (c2 = 0; c2 < NOTCHAR; ++c2) + if (ISSPACE(c2)) + setbit(c2, ccl); + if (c == 'S') + notset(ccl); + laststart = 0; + return lasttok = CSET + charclass_index(ccl); +#endif + + 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 */ + /* char expr[6] = { '[', c, '-', c2, ']', '\0' }; */ + regex_t re; + char expr[6]; + + 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) { + /* char buf[2] = { c, '\0' }; */ + regmatch_t mat; + char buf[2]; + + 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 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; +#if ENABLE_NLS + 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 singlebyte 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 singlebyte + 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); + REALLOC(d->newlines, int, d->tralloc); + while (oldalloc < d->tralloc) + { + d->trans[oldalloc] = NULL; + d->fails[oldalloc++] = NULL; + } + } + + /* Keep the newline transition in a special place so we can use it as + a sentinel. */ + d->newlines[s] = trans[eolbyte]; + 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); + MALLOC(d->newlines, 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 singlebyte 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 singlebyte + 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 + buf_offset] == 0 \ + && mblen_buf[p - buf_begin + buf_offset] > 0 \ + && (unsigned char const *)p < buf_end) \ + ++p; \ + if ((char *)p >= end) \ + { \ + return NULL; \ + } \ + } + +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); + REALLOC(d->newlines, 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 + buf_offset]; + mbclen = (mblen_buf[index + buf_offset] == 0)? 1 : mblen_buf[index + buf_offset]; + + /* 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 reffering. */ + struct mb_char_classes *work_mbc; + + int newline = 0; + int letter = 0; + wchar_t wc; /* Current reffering character. */ + + wc = inputwcs[index + buf_offset]; + + /* 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 reffering operator to work_mbc. */ + work_mbc = &(d->mbcsets[(d->multibyte_prop[pos.index]) >> 2]); + match = !work_mbc->invert; + match_len = (mblen_buf[index + buf_offset] == 0)? 1 : mblen_buf[index + buf_offset]; + + /* 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 + buf_offset] == 0)? 1 + : mblen_buf[*pp - buf_begin + buf_offset]; + + /* 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 singlebyte 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 + buf_offset]; + 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 + buf_offset]; + 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 a pointer to the first + character after the match, or NULL if none is found. Begin points to + the beginning of the buffer, and end points to the first character after + its end. We store a newline in *end to act as a sentinel, so end had + better point somewhere valid. Newline is a flag indicating whether to + allow newlines to be in the matching string. If count is non- + NULL it points to a place we're supposed to increment every time we + see a newline. Finally, if backref is non-NULL it 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. */ +char * +dfaexec (struct dfa *d, char const *begin, char *end, + int newline, int *count, int *backref) +{ + register int s, s1, tmp; /* Current state. */ + register unsigned char const *p; /* Current 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 = s1 = 0; + p = (unsigned char const *) begin; + trans = d->trans; + *end = eol; + +#ifdef MBS_SUPPORT + if (MB_CUR_MAX > 1) + { + int remain_bytes, i; + buf_begin -= buf_offset; + if (buf_begin <= (unsigned char const *)begin && (unsigned char const *) end <= buf_end) { + buf_offset = (unsigned char const *)begin - buf_begin; + buf_begin = begin; + buf_end = end; + goto go_fast; + } + + buf_offset = 0; + buf_begin = begin; + buf_end = end; + + /* initialize mblen_buf, and inputwcs. */ + REALLOC(mblen_buf, unsigned char, end - begin + 2); + REALLOC(inputwcs, wchar_t, end - begin + 2); + memset(&mbs, 0, sizeof(mbstate_t)); + remain_bytes = 0; + for (i = 0; i < end - begin + 1; i++) + { + if (remain_bytes == 0) + { + remain_bytes + = mbrtowc(inputwcs + i, begin + i, end - 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 */ + } +go_fast: +#endif /* MBS_SUPPORT */ + + for (;;) + { +#ifdef MBS_SUPPORT + if (MB_CUR_MAX > 1) + while ((t = trans[s])) + { + if ((char *) p > end) + break; + s1 = 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 = (unsigned char *)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]) != 0) { /* hand-optimized loop */ + s1 = t[*p++]; + if ((t = trans[s1]) == 0) { + tmp = s ; s = s1 ; s1 = tmp ; /* swap */ + break; + } + s = t[*p++]; + } + + if (s >= 0 && p <= (unsigned char *) end && d->fails[s]) + { + if (d->success[s] & sbit[*p]) + { + if (backref) + *backref = (d->states[s].backref != 0); + return (char *) p; + } + + s1 = s; +#ifdef MBS_SUPPORT + if (MB_CUR_MAX > 1) + { + unsigned char const *nextp; + nextp = p; + s = transit_state(d, s, &nextp); + p = (unsigned char *)nextp; + + /* Trans table might be updated. */ + trans = d->trans; + } + else +#endif /* MBS_SUPPORT */ + s = d->fails[s][*p++]; + continue; + } + + /* If the previous character was a newline, count it. */ + if (count && (char *) p <= end && p[-1] == eol) + ++*count; + + /* Check if we've run off the end of the buffer. */ + if ((char *) p > end) + { + return NULL; + } + + if (s >= 0) + { + build_state(s, d); + trans = d->trans; + continue; + } + + if (p[-1] == eol && newline) + { + s = d->newlines[s1]; + continue; + } + + s = 0; + } +} + +/* 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; + d->realtrans = 0; + d->fails = 0; + d->newlines = 0; + d->success = 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(_("out of memory")); + + /* 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->newlines) free((ptr_t) d->newlines); + 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)) + { + dm = (struct dfamust *) malloc(sizeof (struct dfamust)); + dm->exact = exact; + dm->must = malloc(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: */ +/* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + + +/* Return nonzero if the current CATEGORY locale is hard, i.e. if you + can't get away with assuming traditional C or POSIX behavior. */ +static 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 = xmalloc (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); + free(locale); +# endif + } + + return hard; + +#endif +} diff --git a/dfa.h b/dfa.h new file mode 100644 index 000000000..68886fd8b --- /dev/null +++ b/dfa.h @@ -0,0 +1,444 @@ +/* dfa.h - declarations for GNU deterministic regexp compiler + Copyright (C) 1988, 1998, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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 singlebyte) 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 singlebyte character, or the last-byte of + a multibyte character. + bit 0 : tokens[i] is a singlebyte 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. */ + int *newlines; /* Transitions on newlines. The entry for a + newline in any transition table is always + -1 so we can count lines without wasting + too many cycles. The transition for a + newline is stored separately and handled + as a special case. Newline is also used + as a sentinel at the end of the buffer. */ + 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 + first char * points to the beginning, and the second points to the + first character after the end of the buffer, which must be a writable + place so a sentinel end-of-buffer marker can be stored there. The + second-to-last argument is a flag telling whether to allow newlines to + be part of a string matching the regexp. The next-to-last argument, + if non-NULL, points to a place to increment every time we see a + newline. The final argument, if non-NULL, 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 NULL if no match is found, or a pointer to the first + character after the first & shortest matching string in the buffer. */ +extern char *dfaexec PARAMS ((struct dfa *, char const *, char *, int, int *, 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/doc/ChangeLog b/doc/ChangeLog index d81e9e254..5c8e43767 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,43 @@ +Mon Aug 2 12:18:15 2004 Arnold D. Robbins + + * Release 3.1.4: Release tar file made. + +Wed Jul 28 17:03:16 2004 Arnold D. Robbins + + * Makefile.am (TROFF): Add -U flag to invocation. Makes it + possible to format ref card from a build directory that isn't + the source directory. + (distclean): Removed target. Let automake handle it. + +Tue Jun 15 12:21:09 2004 Arnold D. Robbins + + * texinfo.tex: Updated to version 2004-06-14.14. + * gawk.texi (Dynamic Extensions): Text revised to follow + current implementation: new APIs, info on `n->param_cnt' + fixed. + + Also in all index entries where comma does not separate + primary, secondary or tertiary terms, replaced the comma + with @comma{} and removed the corresponding comments. + +Mon May 31 09:11:01 2004 Arnold D. Robbins + + * ad.block, awkcard.in, cardfonts, colors, no.colors: Change + old email address to current one. + +Mon May 3 09:54:46 2004 Arnold D. Robbins + + * texinfo.tex: Updated to version from Automake 1.8.4. + +Mon Mar 22 10:53:13 2004 Arnold D. Robbins + + * texinfo.tex: Updated. + +Tue Jan 6 17:38:40 2004 Arnold D. Robbins + + * texinfo.tex: Updated. + * gawk.texi: All @strong{Note:} changed to `@quotation NOTE'. + Mon Jul 7 11:01:43 2003 Arnold D. Robbins * Release 3.1.3: Release tar file made. diff --git a/doc/Makefile.am b/doc/Makefile.am index 28f58bc36..541066242 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -1,7 +1,7 @@ # # doc/Makefile.am --- automake input file for gawk # -# Copyright (C) 2000, 2001, 2002 the Free Software Foundation, Inc. +# Copyright (C) 2000, 2001, 2002, 2004 the Free Software Foundation, Inc. # # This file is part of GAWK, the GNU implementation of the # AWK Programming Language. @@ -33,9 +33,9 @@ EXTRA_DIST = ChangeLog README.card ad.block setter.outline \ lflashlight.eps rflashlight.eps \ statist.jpg statist.eps -MAKEINFO = @MAKEINFO@ --no-split +MAKEINFO = @MAKEINFO@ --no-split --force -TROFF = groff -t -Tps +TROFF = groff -t -Tps -U SEDME = sed -e "s/^level0 restore/level0 restore flashme 100 72 moveto (Copyright `date '+%m-%d-%y %T'`, FSF, Inc. (all)) show/" \ -e "s/^\/level0 save def/\/level0 save def 30 -48 translate/" @@ -101,5 +101,3 @@ gawkinet.html: gawkinet.texi clean: rm -f *.ps *~ awkcard.nc awkcard.tr *.html - -distclean: clean diff --git a/doc/Makefile.in b/doc/Makefile.in index f6a9c33c0..38f01b1c9 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.7.5 from Makefile.am. +# Makefile.in generated by automake 1.8.5 from Makefile.am. # @configure_input@ -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 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. @@ -17,7 +17,7 @@ # # doc/Makefile.am --- automake input file for gawk # -# Copyright (C) 2000, 2001, 2002 the Free Software Foundation, Inc. +# Copyright (C) 2000, 2001, 2002, 2004 the Free Software Foundation, Inc. # # This file is part of GAWK, the GNU implementation of the # AWK Programming Language. @@ -36,7 +36,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA # - srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ @@ -44,7 +43,6 @@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. - am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 @@ -59,6 +57,51 @@ NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : host_triplet = @host@ +subdir = doc +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog \ + texinfo.tex +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/arch.m4 \ + $(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/iconv.m4 \ + $(top_srcdir)/m4/intdiv0.m4 $(top_srcdir)/m4/intmax.m4 \ + $(top_srcdir)/m4/intmax_t.m4 $(top_srcdir)/m4/inttypes-pri.m4 \ + $(top_srcdir)/m4/inttypes.m4 $(top_srcdir)/m4/inttypes_h.m4 \ + $(top_srcdir)/m4/lcmessage.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/longdouble.m4 $(top_srcdir)/m4/longlong.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/printf-posix.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/m4/signed.m4 $(top_srcdir)/m4/size_max.m4 \ + $(top_srcdir)/m4/socket.m4 $(top_srcdir)/m4/stdint_h.m4 \ + $(top_srcdir)/m4/strtod.m4 $(top_srcdir)/m4/uintmax_t.m4 \ + $(top_srcdir)/m4/ulonglong.m4 $(top_srcdir)/m4/wchar_t.m4 \ + $(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/m4/xsize.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +INFO_DEPS = $(srcdir)/gawk.info $(srcdir)/gawkinet.info +am__TEXINFO_TEX_DIR = $(srcdir) +DVIS = gawk.dvi gawkinet.dvi +PDFS = gawk.pdf gawkinet.pdf +PSS = gawk.ps gawkinet.ps +HTMLS = gawk.html gawkinet.html +TEXINFOS = gawk.texi gawkinet.texi +TEXI2DVI = texi2dvi +TEXI2PDF = $(TEXI2DVI) --pdf --batch +MAKEINFOHTML = $(MAKEINFO) --html +AM_MAKEINFOHTMLFLAGS = $(AM_MAKEINFOFLAGS) +DVIPS = dvips +am__installdirs = "$(DESTDIR)$(infodir)" "$(DESTDIR)$(man1dir)" +man1dir = $(mandir)/man1 +NROFF = nroff +MANS = $(man_MANS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMDEP_FALSE = @AMDEP_FALSE@ @@ -87,6 +130,10 @@ EXEEXT = @EXEEXT@ GENCAT = @GENCAT@ GLIBC21 = @GLIBC21@ GMSGFMT = @GMSGFMT@ +HAVE_ASPRINTF = @HAVE_ASPRINTF@ +HAVE_POSIX_PRINTF = @HAVE_POSIX_PRINTF@ +HAVE_SNPRINTF = @HAVE_SNPRINTF@ +HAVE_WPRINTF = @HAVE_WPRINTF@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -105,8 +152,7 @@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ - -MAKEINFO = @MAKEINFO@ --no-split +MAKEINFO = @MAKEINFO@ --no-split --force MKINSTALLDIRS = @MKINSTALLDIRS@ MSGFMT = @MSGFMT@ MSGMERGE = @MSGMERGE@ @@ -158,6 +204,7 @@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ +mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ @@ -165,23 +212,18 @@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ - info_TEXINFOS = gawk.texi gawkinet.texi - man_MANS = gawk.1 igawk.1 - EXTRA_DIST = ChangeLog README.card ad.block setter.outline \ awkcard.in awkforai.txt texinfo.tex cardfonts \ macros colors no.colors $(man_MANS) \ lflashlight.eps rflashlight.eps \ statist.jpg statist.eps - -TROFF = groff -t -Tps +TROFF = groff -t -Tps -U SEDME = sed -e "s/^level0 restore/level0 restore flashme 100 72 moveto (Copyright `date '+%m-%d-%y %T'`, FSF, Inc. (all)) show/" \ -e "s/^\/level0 save def/\/level0 save def 30 -48 translate/" - CARDSRC = $(srcdir)/macros $(srcdir)/cardfonts $(srcdir)/colors awkcard.tr CARDSRC_N = $(srcdir)/macros $(srcdir)/cardfonts $(srcdir)/no.colors awkcard.tr CARDFILES = $(CARDSRC) ad.block awkcard.in setter.outline @@ -200,68 +242,98 @@ AWKCARD = awkcard.ps # We want hard links for install-data-hook, below LN = ln -subdir = doc -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -DIST_SOURCES = -am__TEXINFO_TEX_DIR = $(srcdir) -INFO_DEPS = gawk.info gawkinet.info -DVIS = gawk.dvi gawkinet.dvi -PDFS = gawk.pdf gawkinet.pdf -PSS = gawk.ps gawkinet.ps -TEXINFOS = gawk.texi gawkinet.texi - -NROFF = nroff -MANS = $(man_MANS) -DIST_COMMON = ChangeLog Makefile.am Makefile.in texinfo.tex all: all-am .SUFFIXES: -.SUFFIXES: .dvi .info .pdf .ps .texi -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) +.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 -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) +.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: - @rm -f $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9] $(@:.info=).i[0-9][0-9] - $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \ - -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + restore=: && \ + backupdir="$(am__leading_dot)am$$$$" && \ + am__cwd=`pwd` && cd $(srcdir) && \ + rm -rf $$backupdir && mkdir $$backupdir && \ + 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; \ + fi; \ + done; \ + 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) `test -f '$<' || echo '$(srcdir)/'`$< + $(TEXI2DVI) $< .texi.pdf: TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \ - $(TEXI2PDF) `test -f '$<' || echo '$(srcdir)/'`$< -gawk.info: gawk.texi + $(TEXI2PDF) $< + +.texi.html: + $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \ + -o $@ $< + if test ! -d $@ && test -d $(@:.html=); then \ + mv $(@:.html=) $@; else :; fi +$(srcdir)/gawk.info: gawk.texi gawk.dvi: gawk.texi gawk.pdf: gawk.texi -gawkinet.info: gawkinet.texi +$(srcdir)/gawkinet.info: gawkinet.texi gawkinet.dvi: gawkinet.texi gawkinet.pdf: gawkinet.texi -TEXI2DVI = texi2dvi - -TEXI2PDF = $(TEXI2DVI) --pdf --batch -DVIPS = dvips .dvi.ps: $(DVIPS) -o $@ $< uninstall-info-am: $(PRE_UNINSTALL) @if (install-info --version && \ - install-info --version | grep -i -v debian) >/dev/null 2>&1; then \ + 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; \ + 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) @@ -269,15 +341,19 @@ uninstall-info-am: for file in $$list; do \ relfile=`echo "$$file" | sed 's|^.*/||'`; \ relfile_i=`echo "$$relfile" | sed 's|\.info$$||;s|$$|.i|'`; \ - (if cd $(DESTDIR)$(infodir); then \ + (if cd "$(DESTDIR)$(infodir)"; then \ echo " 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 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; \ for file in $$d/$$base*; do \ relfile=`expr "$$file" : "$$d/\(.*\)"`; \ @@ -287,13 +363,13 @@ dist-info: $(INFO_DEPS) done mostlyclean-aminfo: - -rm -f gawk.aux gawk.cp gawk.cps gawk.fn gawk.ky gawk.kys gawk.log gawk.pg \ + -rm -rf gawk.aux gawk.cp gawk.cps gawk.fn gawk.ky gawk.kys gawk.log gawk.pg \ gawk.pgs gawk.tmp gawk.toc gawk.tp gawk.tps gawk.vr gawk.dvi \ - gawk.pdf gawk.ps gawkinet.aux gawkinet.cp gawkinet.cps \ - gawkinet.fn gawkinet.ky gawkinet.kys gawkinet.log gawkinet.pg \ - gawkinet.pgs gawkinet.tmp gawkinet.toc gawkinet.tp \ - gawkinet.tps gawkinet.vr gawkinet.dvi gawkinet.pdf \ - gawkinet.ps + gawk.pdf gawk.ps gawk.html gawkinet.aux gawkinet.cp \ + gawkinet.cps gawkinet.fn gawkinet.ky gawkinet.kys \ + gawkinet.log gawkinet.pg gawkinet.pgs gawkinet.tmp \ + gawkinet.toc gawkinet.tp gawkinet.tps gawkinet.vr \ + gawkinet.dvi gawkinet.pdf gawkinet.ps gawkinet.html maintainer-clean-aminfo: @list='$(INFO_DEPS)'; for i in $$list; do \ @@ -301,11 +377,9 @@ maintainer-clean-aminfo: 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 - -man1dir = $(mandir)/man1 install-man1: $(man1_MANS) $(man_MANS) @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(man1dir) + 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 \ @@ -324,8 +398,8 @@ install-man1: $(man1_MANS) $(man_MANS) 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; \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \ done uninstall-man1: @$(NORMAL_UNINSTALL) @@ -345,8 +419,8 @@ uninstall-man1: 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; \ + echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \ + rm -f "$(DESTDIR)$(man1dir)/$$inst"; \ done tags: TAGS TAGS: @@ -354,10 +428,6 @@ TAGS: ctags: CTAGS CTAGS: -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = .. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ @@ -371,7 +441,7 @@ distdir: $(DISTFILES) dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ @@ -392,9 +462,10 @@ distdir: $(DISTFILES) check-am: all-am check: check-am all-am: Makefile $(INFO_DEPS) $(MANS) - installdirs: - $(mkinstalldirs) $(DESTDIR)$(infodir) $(DESTDIR)$(man1dir) + 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 @@ -406,7 +477,7 @@ install-am: all-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - INSTALL_STRIP_FLAG=-s \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: @@ -414,23 +485,23 @@ mostlyclean-generic: clean-generic: distclean-generic: - -rm -f Makefile $(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-am: $(HTMLS) + info: info-am info-am: $(INFO_DEPS) @@ -445,28 +516,32 @@ install-info: install-info-am install-info-am: $(INFO_DEPS) @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(infodir) - @list='$(INFO_DEPS)'; \ + 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; \ + 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 | grep -i -v debian) >/dev/null 2>&1; then \ + 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 || :;\ + 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 @@ -474,7 +549,7 @@ install-man: install-man1 installcheck-am: maintainer-clean: maintainer-clean-am - + -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-aminfo \ maintainer-clean-generic @@ -497,14 +572,15 @@ uninstall-am: uninstall-info-am uninstall-man uninstall-man: uninstall-man1 .PHONY: all all-am check check-am clean clean-generic dist-info \ - distclean distclean-generic distdir dvi dvi-am info info-am \ - install install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ - install-man1 install-strip installcheck installcheck-am \ - installdirs maintainer-clean maintainer-clean-aminfo \ - maintainer-clean-generic mostlyclean mostlyclean-aminfo \ - mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \ - uninstall-info-am uninstall-man uninstall-man1 + distclean distclean-generic distdir dvi dvi-am html html-am \ + info info-am install install-am install-data install-data-am \ + install-exec install-exec-am install-info install-info-am \ + install-man install-man1 install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-aminfo maintainer-clean-generic mostlyclean \ + mostlyclean-aminfo mostlyclean-generic pdf pdf-am ps ps-am \ + uninstall uninstall-am uninstall-info-am uninstall-man \ + uninstall-man1 # Link gawk.1 to pgawk.1 @@ -550,8 +626,6 @@ gawkinet.html: gawkinet.texi clean: rm -f *.ps *~ awkcard.nc awkcard.tr *.html - -distclean: clean # 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/ad.block b/doc/ad.block index f50062e54..7d3b26657 100644 --- a/doc/ad.block +++ b/doc/ad.block @@ -1,4 +1,4 @@ -.\" AWK Reference Card --- Arnold Robbins, arnold@gnu.org +.\" AWK Reference Card --- Arnold Robbins, arnold@skeeve.com .\" This file is the Ad block (included in cover) .\" .\" Copyright (C) 1996, 1998, 2000, 2001, 2003 Free Software Foundation, Inc. diff --git a/doc/awkcard.in b/doc/awkcard.in index 9bbf29c57..fd7e49754 100644 --- a/doc/awkcard.in +++ b/doc/awkcard.in @@ -1,6 +1,6 @@ -.\" AWK Reference Card --- Arnold Robbins, arnold@gnu.org +.\" AWK Reference Card --- Arnold Robbins, arnold@skeeve.com .\" -.\" Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +.\" Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. .\" .\" Permission is granted to make and distribute verbatim copies of .\" this reference card provided the copyright notice and this permission @@ -99,7 +99,7 @@ Brian Kernighan and Michael Brennan who reviewed it. \*(CD .SL .nf -\*(FRCopyright \(co 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +\*(FRCopyright \(co 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. .nf .BT @@ -1894,7 +1894,7 @@ to use the current domain.\*(CB .ES .nf \*(CDHost: \*(FCftp.gnu.org\*(FR -File: \*(FC/gnu/gawk/gawk-3.1.3.tar.gz\fP +File: \*(FC/gnu/gawk/gawk-3.1.4.tar.gz\fP .in +.2i .fi GNU \*(AK (\*(GK). There may be a later version. @@ -1921,7 +1921,8 @@ Michael Brennan's \*(MK. There may be a newer version.\*(CX .\" --- Copying Permissions .ES .fi -\*(CDCopyright \(co 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +\*(CDCopyright \(co 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 +Free Software Foundation, Inc. .sp .5 Permission is granted to make and distribute verbatim copies of this reference card provided the copyright notice and this permission notice diff --git a/doc/cardfonts b/doc/cardfonts index dc44ce1bc..0f528e134 100644 --- a/doc/cardfonts +++ b/doc/cardfonts @@ -1,4 +1,4 @@ -.\" AWK Reference Card --- Arnold Robbins, arnold@gnu.org +.\" AWK Reference Card --- Arnold Robbins, arnold@skeeve.com .\" cardfonts --- this file sets the fonts to use for the reference card .\" .\" Copyright (C) 1996 Free Software Foundation, Inc. diff --git a/doc/colors b/doc/colors index 933d25efe..97dbff769 100644 --- a/doc/colors +++ b/doc/colors @@ -1,4 +1,4 @@ -.\" AWK Reference Card --- Arnold Robbins, arnold@gnu.org +.\" AWK Reference Card --- Arnold Robbins, arnold@skeeve.com .\" This file sets the colors to use. .\" .\" Copyright (C) 1996,97,99 Free Software Foundation, Inc. diff --git a/doc/gawk.1 b/doc/gawk.1 index 8545fd4dd..8250236cb 100644 --- a/doc/gawk.1 +++ b/doc/gawk.1 @@ -14,7 +14,7 @@ . if \w'\(rq' .ds rq "\(rq . \} .\} -.TH GAWK 1 "June 25 2003" "Free Software Foundation" "Utility Commands" +.TH GAWK 1 "July 28 2004" "Free Software Foundation" "Utility Commands" .SH NAME gawk \- pattern scanning and processing language .SH SYNOPSIS @@ -835,6 +835,15 @@ is zero, so all regular expression and string operations are normally case-sensitive. Under Unix, the full ISO 8859-1 Latin-1 character set is used when ignoring case. +As of +.I gawk +3.1.4, the case equivalencies are fully locale-aware, based on +the C +.B +facilities such as +.BR isalpha() , +and +.BR tolupper() . .TP .B LINT Provides dynamic control of the @@ -912,6 +921,12 @@ the parent process ID of the current process. the value of the .IR getuid (2) system call. +.TP +\fBPROCINFO["version"]\fP +The version of +.IR gawk . +This is available from +version 3.1.4 and later. .RE .TP .B RS @@ -1678,7 +1693,6 @@ as follows: \fBdo \fIstatement \fBwhile (\fIcondition\fB)\fR \fBfor (\fIexpr1\fB; \fIexpr2\fB; \fIexpr3\fB) \fIstatement\fR \fBfor (\fIvar \fBin\fI array\fB) \fIstatement\fR -.\" \fBswitch (\fIexpression\fB) { \fBcase [\fIvalue\fB|\fIregex\fB] : \fIstatement \fBdefault: \fIstatement \fB}\fR \fBbreak\fR \fBcontinue\fR \fBdelete \fIarray\^\fB[\^\fIindex\^\fB]\fR @@ -3258,6 +3272,25 @@ This option should only be of interest to the maintainers, and may not even be compiled into .IR gawk . .. +.PP +If +.I gawk +is +.I configured +with the +.B \-\^\-enable\-switch +option to the +.I configure +command, then it accepts an additional control-flow statement: +.RS +.nf +\fBswitch (\fIexpression\fB) { +\fBcase \fIvalue\fB|\fIregex\fB : \fIstatement +\&.\^.\^. +\fR[ \fBdefault: \fIstatement \fR] +\fB}\fR +.fi +.RE .SH ENVIRONMENT VARIABLES The .B AWKPATH @@ -3339,7 +3372,7 @@ and Martin Brown provided the BeOS port. .SH VERSION INFORMATION This man page documents .IR gawk , -version 3.1.3. +version 3.1.4. .SH BUG REPORTS If you find a bug in .IR gawk , @@ -3370,13 +3403,20 @@ While the developers occasionally read this newsgroup, posting bug reports there is an unreliable way to report bugs. Instead, please use the electronic mail addresses given above. +.PP +If you're using a GNU/Linux system or BSD-based system, +you may wish to submit a bug report to the vendor of your distribution. +That's fine, but please send a copy to the official email address as well, +since there's no guarantee that the bug will be forwarded to the +.I gawk +maintainer. .SH ACKNOWLEDGEMENTS Brian Kernighan of Bell Laboratories provided valuable assistance during testing and debugging. We thank him. .SH COPYING PERMISSIONS Copyright \(co 1989, 1991, 1992, 1993, 1994, 1995, 1996, -1997, 1998, 1999, 2001, 2002, 2003 Free Software Foundation, Inc. +1997, 1998, 1999, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. .PP Permission is granted to make and distribute verbatim copies of this manual page provided the copyright notice and this permission diff --git a/doc/gawk.info b/doc/gawk.info index a5ef90b96..e60d00387 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -1,4 +1,4 @@ -This is gawk.info, produced by makeinfo version 4.5 from gawk.texi. +This is gawk.info, produced by makeinfo version 4.6 from gawk.texi. INFO-DIR-SECTION Text creation and manipulation START-INFO-DIR-ENTRY @@ -14,7 +14,7 @@ Copyright (C) 1989, 1991, 1992, 1993, 1996, 1997, 1998, 1999, 2000, This is Edition 3 of `GAWK: Effective AWK Programming: A User's -Guide for GNU Awk', for the 3.1.3 (or later) version of the GNU +Guide for GNU Awk', for the 3.1.4 (or later) version of the GNU implementation of AWK. Permission is granted to copy, distribute and/or modify this document @@ -30,14 +30,14 @@ texts being (a) (see below), and with the Back-Cover Texts being (b) b. "You have freedom to copy and modify this GNU Manual, like GNU software. Copies published by the Free Software Foundation raise funds for GNU development." - +  File: gawk.info, Node: Top, Next: Foreword, Up: (dir) General Introduction ******************** - This file documents `awk', a program that you can use to select +This file documents `awk', a program that you can use to select particular records in a file and perform operations upon them. Copyright (C) 1989, 1991, 1992, 1993, 1996, 1997, 1998, 1999, 2000, @@ -45,7 +45,7 @@ Copyright (C) 1989, 1991, 1992, 1993, 1996, 1997, 1998, 1999, 2000, This is Edition 3 of `GAWK: Effective AWK Programming: A User's -Guide for GNU Awk', for the 3.1.3 (or later) version of the GNU +Guide for GNU Awk', for the 3.1.4 (or later) version of the GNU implementation of AWK. Permission is granted to copy, distribute and/or modify this document @@ -61,7 +61,7 @@ texts being (a) (see below), and with the Back-Cover Texts being (b) b. "You have freedom to copy and modify this GNU Manual, like GNU software. Copies published by the Free Software Foundation raise funds for GNU development." - + * Menu: * Foreword:: Some nice words about this @@ -456,6 +456,7 @@ texts being (a) (see below), and with the Back-Cover Texts being (b) To Nachum, for the added dimension. To Malka, for the new beginning. +  File: gawk.info, Node: Foreword, Next: Preface, Prev: Top, Up: Top @@ -463,8 +464,8 @@ File: gawk.info, Node: Foreword, Next: Preface, Prev: Top, Up: Top Foreword ******** - Arnold Robbins and I are good friends. We were introduced 11 years -ago by circumstances--and our favorite programming language, AWK. The +Arnold Robbins and I are good friends. We were introduced 11 years ago +by circumstances--and our favorite programming language, AWK. The circumstances started a couple of years earlier. I was working at a new job and noticed an unplugged Unix computer sitting in the corner. No one knew how to use it, and neither did I. However, a couple of days @@ -549,7 +550,7 @@ File: gawk.info, Node: Preface, Next: Getting Started, Prev: Foreword, Up: T Preface ******* - Several kinds of tasks occur repeatedly when working with text files. +Several kinds of tasks occur repeatedly when working with text files. You might want to extract certain lines and discard the rest. Or you may need to make changes wherever certain patterns appear, but leave the rest of the file alone. Writing single-use programs for these @@ -558,14 +559,14 @@ inconvenient. Such jobs are often easier with `awk'. The `awk' utility interprets a special-purpose programming language that makes it easy to handle simple data-reformatting jobs. - The GNU implementation of `awk' is called `gawk'; it is fully +The GNU implementation of `awk' is called `gawk'; it is fully compatible with the System V Release 4 version of `awk'. `gawk' is also compatible with the POSIX specification of the `awk' language. This means that all properly written `awk' programs should work with `gawk'. Thus, we usually don't distinguish between `gawk' and other `awk' implementations. - Using `awk' allows you to: +Using `awk' allows you to: * Manage small, personal databases @@ -578,7 +579,7 @@ This means that all properly written `awk' programs should work with * Experiment with algorithms that you can adapt later to other computer languages - In addition, `gawk' provides facilities that make it easy to: +In addition, `gawk' provides facilities that make it easy to: * Extract bits and pieces of data for processing @@ -586,15 +587,15 @@ This means that all properly written `awk' programs should work with * Perform simple network communications - This Info file teaches you about the `awk' language and how you can -use it effectively. You should already be familiar with basic system +This Info file teaches you about the `awk' language and how you can use +it effectively. You should already be familiar with basic system commands, such as `cat' and `ls',(1) as well as basic shell facilities, such as input/output (I/O) redirection and pipes. - Implementations of the `awk' language are available for many -different computing environments. This Info file, while describing the -`awk' language in general, also describes the particular implementation -of `awk' called `gawk' (which stands for "GNU awk"). `gawk' runs on a +Implementations of the `awk' language are available for many different +computing environments. This Info file, while describing the `awk' +language in general, also describes the particular implementation of +`awk' called `gawk' (which stands for "GNU awk"). `gawk' runs on a broad range of Unix systems, ranging from 80386 PC-based computers up through large-scale systems, such as Crays. `gawk' has also been ported to Mac OS X, MS-DOS, Microsoft Windows (all versions) and OS/2 PCs, @@ -613,10 +614,10 @@ Atari and Amiga microcomputers, BeOS, Tandem D20, and VMS. * How To Contribute:: Helping to save the world. * Acknowledgments:: Acknowledgments. - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) These commands are available on POSIX-compliant systems, as well -as on traditional Unix-based systems. If you are using some other +(1) These commands are available on POSIX-compliant systems, as well as +on traditional Unix-based systems. If you are using some other operating system, you still need to be familiar with the ideas of I/O redirection and pipes. @@ -636,7 +637,7 @@ History of `awk' and `gawk' After eight years, add another part `egrep' and two more parts C. Document very well and release. - The name `awk' comes from the initials of its designers: Alfred V. +The name `awk' comes from the initials of its designers: Alfred V. Aho, Peter J. Weinberger and Brian W. Kernighan. The original version of `awk' was written in 1977 at AT&T Bell Laboratories. In 1985, a new version made the programming language more powerful, introducing @@ -649,23 +650,23 @@ and Utilities standard further clarified the language. Both the `gawk' designers and the original Bell Laboratories `awk' designers provided feedback for the POSIX specification. - Paul Rubin wrote the GNU implementation, `gawk', in 1986. Jay -Fenlason completed it, with advice from Richard Stallman. John Woods +Paul Rubin wrote the GNU implementation, `gawk', in 1986. Jay Fenlason +completed it, with advice from Richard Stallman. John Woods contributed parts of the code as well. In 1988 and 1989, David Trueman, with help from me, thoroughly reworked `gawk' for compatibility with the newer `awk'. Circa 1995, I became the primary maintainer. Current development focuses on bug fixes, performance improvements, standards compliance, and occasionally, new features. - In May of 1997, Ju"rgen Kahrs felt the need for network access from +In May of 1997, Ju"rgen Kahrs felt the need for network access from `awk', and with a little help from me, set about adding features to do this for `gawk'. At that time, he also wrote the bulk of `TCP/IP Internetworking with `gawk'' (a separate document, available as part of the `gawk' distribution). His code finally became part of the main `gawk' distribution with `gawk' version 3.1. - *Note Contributors::, for a complete list of those who made -important contributions to `gawk'. +*Note Contributors::, for a complete list of those who made important +contributions to `gawk'.  File: gawk.info, Node: Names, Next: This Manual, Prev: History, Up: Preface @@ -673,18 +674,18 @@ File: gawk.info, Node: Names, Next: This Manual, Prev: History, Up: Preface A Rose by Any Other Name ======================== - The `awk' language has evolved over the years. Full details are +The `awk' language has evolved over the years. Full details are provided in *Note Language History::. The language described in this Info file is often referred to as "new `awk'" (`nawk'). - Because of this, many systems have multiple versions of `awk'. Some +Because of this, many systems have multiple versions of `awk'. Some systems have an `awk' utility that implements the original version of the `awk' language and a `nawk' utility for the new version. Others have an `oawk' version for the "old `awk'" language and plain `awk' for the new one. Still others only have one version, which is usually the new one.(1) - All in all, this makes it difficult for you to know which version of +All in all, this makes it difficult for you to know which version of `awk' you should run when writing your programs. The best advice I can give here is to check your local documentation. Look for `awk', `oawk', and `nawk', as well as for `gawk'. It is likely that you already have @@ -692,14 +693,14 @@ some version of new `awk' on your system, which is what you should use when running your programs. (Of course, if you're reading this Info file, chances are good that you have `gawk'!) - Throughout this Info file, whenever we refer to a language feature -that should be available in any complete implementation of POSIX `awk', -we simply use the term `awk'. When referring to a feature that is +Throughout this Info file, whenever we refer to a language feature that +should be available in any complete implementation of POSIX `awk', we +simply use the term `awk'. When referring to a feature that is specific to the GNU implementation, we use the term `gawk'. - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) Often, these systems use `gawk' for their `awk' implementation! +(1) Often, these systems use `gawk' for their `awk' implementation!  File: gawk.info, Node: This Manual, Next: Conventions, Prev: Names, Up: Preface @@ -707,107 +708,106 @@ File: gawk.info, Node: This Manual, Next: Conventions, Prev: Names, Up: Pref Using This Book =============== - The term `awk' refers to a particular program as well as to the +The term `awk' refers to a particular program as well as to the language you use to tell this program what to do. When we need to be careful, we call the language "the `awk' language," and the program "the `awk' utility." This Info file explains both the `awk' language and how to run the `awk' utility. The term "`awk' program" refers to a program written by you in the `awk' programming language. - Primarily, this Info file explains the features of `awk', as defined -in the POSIX standard. It does so in the context of the `gawk' +Primarily, this Info file explains the features of `awk', as defined in +the POSIX standard. It does so in the context of the `gawk' implementation. While doing so, it also attempts to describe important differences between `gawk' and other `awk' implementations.(1) Finally, any `gawk' features that are not in the POSIX standard for `awk' are noted. - There are subsections labelled as *Advanced Notes* scattered -throughout the Info file. They add a more complete explanation of -points that are relevant, but not likely to be of interest on first -reading. All appear in the index, under the heading "advanced -features." +There are subsections labelled as *Advanced Notes* scattered throughout +the Info file. They add a more complete explanation of points that are +relevant, but not likely to be of interest on first reading. All +appear in the index, under the heading "advanced features." - Most of the time, the examples use complete `awk' programs. In some -of the more advanced sections, only the part of the `awk' program that +Most of the time, the examples use complete `awk' programs. In some of +the more advanced sections, only the part of the `awk' program that illustrates the concept currently being described is shown. - While this Info file is aimed principally at people who have not been +While this Info file is aimed principally at people who have not been exposed to `awk', there is a lot of information here that even the `awk' expert should find useful. In particular, the description of POSIX `awk' and the example programs in *Note Library Functions::, and in *Note Sample Programs::, should be of interest. - *Note Getting Started::, provides the essentials you need to know to +*Note Getting Started::, provides the essentials you need to know to begin using `awk'. - *Note Regexp::, introduces regular expressions in general, and in +*Note Regexp::, introduces regular expressions in general, and in particular the flavors supported by POSIX `awk' and `gawk'. - *Note Reading Files::, describes how `awk' reads your data. It +*Note Reading Files::, describes how `awk' reads your data. It introduces the concepts of records and fields, as well as the `getline' command. I/O redirection is first described here. - *Note Printing::, describes how `awk' programs can produce output -with `print' and `printf'. +*Note Printing::, describes how `awk' programs can produce output with +`print' and `printf'. - *Note Expressions::, describes expressions, which are the basic +*Note Expressions::, describes expressions, which are the basic building blocks for getting most things done in a program. - *Note Patterns and Actions::, describes how to write patterns for +*Note Patterns and Actions::, describes how to write patterns for matching records, actions for doing something when a record is matched, and the built-in variables `awk' and `gawk' use. - *Note Arrays::, covers `awk''s one-and-only data structure: -associative arrays. Deleting array elements and whole arrays is also -described, as well as sorting arrays in `gawk'. +*Note Arrays::, covers `awk''s one-and-only data structure: associative +arrays. Deleting array elements and whole arrays is also described, as +well as sorting arrays in `gawk'. - *Note Functions::, describes the built-in functions `awk' and `gawk' +*Note Functions::, describes the built-in functions `awk' and `gawk' provide, as well as how to define your own functions. - *Note Internationalization::, describes special features in `gawk' -for translating program messages into different languages at runtime. +*Note Internationalization::, describes special features in `gawk' for +translating program messages into different languages at runtime. - *Note Advanced Features::, describes a number of `gawk'-specific +*Note Advanced Features::, describes a number of `gawk'-specific advanced features. Of particular note are the abilities to have two-way communications with another process, perform TCP/IP networking, and profile your `awk' programs. - *Note Invoking Gawk::, describes how to run `gawk', the meaning of -its command-line options, and how it finds `awk' program source files. +*Note Invoking Gawk::, describes how to run `gawk', the meaning of its +command-line options, and how it finds `awk' program source files. - *Note Library Functions::, and *Note Sample Programs::, provide many +*Note Library Functions::, and *Note Sample Programs::, provide many sample `awk' programs. Reading them allows you to see `awk' solving real problems. - *Note Language History::, describes how the `awk' language has -evolved since first release to present. It also describes how `gawk' -has acquired features over time. +*Note Language History::, describes how the `awk' language has evolved +since first release to present. It also describes how `gawk' has +acquired features over time. - *Note Installation::, describes how to get `gawk', how to compile it +*Note Installation::, describes how to get `gawk', how to compile it under Unix, and how to compile and use it on different non-Unix systems. It also describes how to report bugs in `gawk' and where to get three other freely available implementations of `awk'. - *Note Notes::, describes how to disable `gawk''s extensions, as well -as how to contribute new code to `gawk', how to write extension -libraries, and some possible future directions for `gawk' development. +*Note Notes::, describes how to disable `gawk''s extensions, as well as +how to contribute new code to `gawk', how to write extension libraries, +and some possible future directions for `gawk' development. - *Note Basic Concepts::, provides some very cursory background -material for those who are completely unfamiliar with computer -programming. Also centralized there is a discussion of some of the -issues surrounding floating-point numbers. +*Note Basic Concepts::, provides some very cursory background material +for those who are completely unfamiliar with computer programming. +Also centralized there is a discussion of some of the issues +surrounding floating-point numbers. - The *Note Glossary::, defines most, if not all, the significant -terms used throughout the book. If you find terms that you aren't -familiar with, try looking them up here. +The *Note Glossary::, defines most, if not all, the significant terms +used throughout the book. If you find terms that you aren't familiar +with, try looking them up here. - *Note Copying::, and *Note GNU Free Documentation License::, present +*Note Copying::, and *Note GNU Free Documentation License::, present the licenses that cover the `gawk' source code and this Info file, respectively. - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) All such differences appear in the index under the entry +(1) All such differences appear in the index under the entry "differences in `awk' and `gawk'."  @@ -816,15 +816,15 @@ File: gawk.info, Node: Conventions, Next: Manual History, Prev: This Manual, Typographical Conventions ========================= - This Info file is written using Texinfo, the GNU documentation +This Info file is written using Texinfo, the GNU documentation formatting language. A single Texinfo source file is used to produce both the printed and online versions of the documentation. This minor node briefly documents the typographical conventions used in Texinfo. - Examples you would type at the command-line are preceded by the -common shell primary and secondary prompts, `$' and `>'. Output from -the command is preceded by the glyph "-|". This typically represents -the command's standard output. Error messages, and other output on the +Examples you would type at the command-line are preceded by the common +shell primary and secondary prompts, `$' and `>'. Output from the +command is preceded by the glyph "-|". This typically represents the +command's standard output. Error messages, and other output on the command's standard error, are preceded by the glyph "error-->". For example: @@ -833,7 +833,7 @@ example: $ echo hello on stderr 1>&2 error--> hello on stderr - Characters that you type at the keyboard look `like this'. In +Characters that you type at the keyboard look `like this'. In particular, there are special characters called "control characters." These are characters that you type by holding down both the `CONTROL' key and another key, at the same time. For example, a `Ctrl-d' is typed @@ -847,14 +847,14 @@ Dark Corners illuminate, there's always a smaller but darker one. Brian Kernighan - Until the POSIX standard (and `The Gawk Manual'), many features of +Until the POSIX standard (and `The Gawk Manual'), many features of `awk' were either poorly documented or not documented at all. Descriptions of such features (often called "dark corners") are noted in this Info file with "(d.c.)". They also appear in the index under the heading "dark corner." - As noted by the opening quote, though, any coverage of dark corners -is, by definition, something that is incomplete. +As noted by the opening quote, though, any coverage of dark corners is, +by definition, something that is incomplete.  File: gawk.info, Node: Manual History, Next: How To Contribute, Prev: Conventions, Up: Preface @@ -862,30 +862,28 @@ File: gawk.info, Node: Manual History, Next: How To Contribute, Prev: Convent The GNU Project and This Book ============================= - The Free Software Foundation (FSF) is a nonprofit organization -dedicated to the production and distribution of freely distributable -software. It was founded by Richard M. Stallman, the author of the -original Emacs editor. GNU Emacs is the most widely used version of -Emacs today. - - The GNU(1) Project is an ongoing effort on the part of the Free -Software Foundation to create a complete, freely distributable, -POSIX-compliant computing environment. The FSF uses the "GNU General -Public License" (GPL) to ensure that their software's source code is -always available to the end user. A copy of the GPL is included for -your reference (*note Copying::). The GPL applies to the C language -source code for `gawk'. To find out more about the FSF and the GNU -Project online, see the GNU Project's home page (http://www.gnu.org). -This Info file may also be read from their web site -(http://www.gnu.org/manual/gawk/). - - A shell, an editor (Emacs), highly portable optimizing C, C++, and +The Free Software Foundation (FSF) is a nonprofit organization dedicated +to the production and distribution of freely distributable software. +It was founded by Richard M. Stallman, the author of the original Emacs +editor. GNU Emacs is the most widely used version of Emacs today. + +The GNU(1) Project is an ongoing effort on the part of the Free Software +Foundation to create a complete, freely distributable, POSIX-compliant +computing environment. The FSF uses the "GNU General Public License" +(GPL) to ensure that their software's source code is always available +to the end user. A copy of the GPL is included for your reference +(*note Copying::). The GPL applies to the C language source code for +`gawk'. To find out more about the FSF and the GNU Project online, see +the GNU Project's home page (http://www.gnu.org). This Info file may +also be read from their web site (http://www.gnu.org/manual/gawk/). + +A shell, an editor (Emacs), highly portable optimizing C, C++, and Objective-C compilers, a symbolic debugger and dozens of large and small utilities (such as `gawk'), have all been completed and are freely available. The GNU operating system kernel (the HURD), has been released but is still in an early stage of development. - Until the GNU operating system is more fully developed, you should +Until the GNU operating system is more fully developed, you should consider using GNU/Linux, a freely distributable, Unix-like operating system for Intel 80386, DEC Alpha, Sun SPARC, IBM S/390, and other systems.(2) There are many books on GNU/Linux. One that is freely @@ -897,35 +895,35 @@ systems: NetBSD, FreeBSD, and OpenBSD. All are based on the 4.4-Lite Berkeley Software Distribution, and they use recent versions of `gawk' for their versions of `awk'.) - The Info file itself has gone through a number of previous editions. +The Info file itself has gone through a number of previous editions. Paul Rubin wrote the very first draft of `The GAWK Manual'; it was around 40 pages in size. Diane Close and Richard Stallman improved it, yielding a version that was around 90 pages long and barely described the original, "old" version of `awk'. - I started working with that version in the fall of 1988. As work on -it progressed, the FSF published several preliminary versions (numbered +I started working with that version in the fall of 1988. As work on it +progressed, the FSF published several preliminary versions (numbered 0.X). In 1996, Edition 1.0 was released with `gawk' 3.0.0. The FSF published the first two editions under the title `The GNU Awk User's Guide'. - This edition maintains the basic structure of Edition 1.0, but with +This edition maintains the basic structure of Edition 1.0, but with significant additional material, reflecting the host of new features in `gawk' version 3.1. Of particular note is *Note Array Sorting::, as well as *Note Bitwise Functions::, *Note Internationalization::, and also *Note Advanced Features::, and *Note Dynamic Extensions::. - `GAWK: Effective AWK Programming' will undoubtedly continue to -evolve. An electronic version comes with the `gawk' distribution from -the FSF. If you find an error in this Info file, please report it! -*Note Bugs::, for information on submitting problem reports -electronically, or write to me in care of the publisher. +`GAWK: Effective AWK Programming' will undoubtedly continue to evolve. +An electronic version comes with the `gawk' distribution from the FSF. +If you find an error in this Info file, please report it! *Note +Bugs::, for information on submitting problem reports electronically, +or write to me in care of the publisher. - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) GNU stands for "GNU's not Unix." +(1) GNU stands for "GNU's not Unix." - (2) The terminology "GNU/Linux" is explained in the *Note Glossary::. +(2) The terminology "GNU/Linux" is explained in the *Note Glossary::.  File: gawk.info, Node: How To Contribute, Next: Acknowledgments, Prev: Manual History, Up: Preface @@ -933,13 +931,13 @@ File: gawk.info, Node: How To Contribute, Next: Acknowledgments, Prev: Manual How to Contribute ================= - As the maintainer of GNU `awk', I am starting a collection of -publicly available `awk' programs. For more information, see +As the maintainer of GNU `awk', I am starting a collection of publicly +available `awk' programs. For more information, see `ftp://ftp.freefriends.org/arnold/Awkstuff'. If you have written an interesting `awk' program, or have written a `gawk' extension that you would like to share with the rest of the world, please contact me -(). Making things available on the Internet helps keep -the `gawk' distribution down to manageable size. +(). Making things available on the Internet helps +keep the `gawk' distribution down to manageable size.  File: gawk.info, Node: Acknowledgments, Prev: How To Contribute, Up: Preface @@ -947,7 +945,7 @@ File: gawk.info, Node: Acknowledgments, Prev: How To Contribute, Up: Preface Acknowledgments =============== - The initial draft of `The GAWK Manual' had the following +The initial draft of `The GAWK Manual' had the following acknowledgments: Many people need to be thanked for their assistance in producing @@ -959,59 +957,59 @@ acknowledgments: implementation and to this manual, that would otherwise have escaped us. - I would like to acknowledge Richard M. Stallman, for his vision of a +I would like to acknowledge Richard M. Stallman, for his vision of a better world and for his courage in founding the FSF and starting the GNU Project. - The following people (in alphabetical order) provided helpful -comments on various versions of this book, up to and including this -edition. Rick Adams, Nelson H.F. Beebe, Karl Berry, Dr. Michael -Brennan, Rich Burridge, Claire Cloutier, Diane Close, Scott Deifik, -Christopher ("Topher") Eliot, Jeffrey Friedl, Dr. Darrel Hankerson, -Michal Jaegermann, Dr. Richard J. LeBlanc, Michael Lijewski, Pat Rankin, +The following people (in alphabetical order) provided helpful comments +on various versions of this book, up to and including this edition. +Rick Adams, Nelson H.F. Beebe, Karl Berry, Dr. Michael Brennan, Rich +Burridge, Claire Cloutier, Diane Close, Scott Deifik, Christopher +("Topher") Eliot, Jeffrey Friedl, Dr. Darrel Hankerson, Michal +Jaegermann, Dr. Richard J. LeBlanc, Michael Lijewski, Pat Rankin, Miriam Robbins, Mary Sheehan, and Chuck Toporek. - Robert J. Chassell provided much valuable advice on the use of -Texinfo. He also deserves special thanks for convincing me _not_ to -title this Info file `How To Gawk Politely'. Karl Berry helped -significantly with the TeX part of Texinfo. +Robert J. Chassell provided much valuable advice on the use of Texinfo. +He also deserves special thanks for convincing me _not_ to title this +Info file `How To Gawk Politely'. Karl Berry helped significantly with +the TeX part of Texinfo. - I would like to thank Marshall and Elaine Hartholz of Seattle and -Dr. Bert and Rita Schreiber of Detroit for large amounts of quiet -vacation time in their homes, which allowed me to make significant -progress on this Info file and on `gawk' itself. +I would like to thank Marshall and Elaine Hartholz of Seattle and Dr. +Bert and Rita Schreiber of Detroit for large amounts of quiet vacation +time in their homes, which allowed me to make significant progress on +this Info file and on `gawk' itself. - Phil Hughes of SSC contributed in a very important way by loaning me +Phil Hughes of SSC contributed in a very important way by loaning me his laptop GNU/Linux system, not once, but twice, which allowed me to do a lot of work while away from home. - David Trueman deserves special credit; he has done a yeoman job of +David Trueman deserves special credit; he has done a yeoman job of evolving `gawk' so that it performs well and without bugs. Although he is no longer involved with `gawk', working with him on this project was a significant pleasure. - The intrepid members of the GNITS mailing list, and most notably -Ulrich Drepper, provided invaluable help and feedback for the design of -the internationalization features. +The intrepid members of the GNITS mailing list, and most notably Ulrich +Drepper, provided invaluable help and feedback for the design of the +internationalization features. - Nelson Beebe, Martin Brown, Andreas Buening, Scott Deifik, Darrel +Nelson Beebe, Martin Brown, Andreas Buening, Scott Deifik, Darrel Hankerson, Isamu Hasegawa, Michal Jaegermann, Ju"rgen Kahrs, Pat Rankin, Kai Uwe Rommel, and Eli Zaretskii (in alphabetical order) make up the `gawk' "crack portability team." Without their hard work and help, `gawk' would not be nearly the fine program it is today. It has been and continues to be a pleasure working with this team of fine people. - David and I would like to thank Brian Kernighan of Bell Laboratories -for invaluable assistance during the testing and debugging of `gawk', -and for help in clarifying numerous points about the language. We -could not have done nearly as good a job on either `gawk' or its +David and I would like to thank Brian Kernighan of Bell Laboratories for +invaluable assistance during the testing and debugging of `gawk', and +for help in clarifying numerous points about the language. We could +not have done nearly as good a job on either `gawk' or its documentation without his help. - Chuck Toporek, Mary Sheehan, and Claire Coutier of O'Reilly & +Chuck Toporek, Mary Sheehan, and Claire Coutier of O'Reilly & Associates contributed significant editorial help for this Info file for the 3.1 release of `gawk'. - I must thank my wonderful wife, Miriam, for her patience through the +I must thank my wonderful wife, Miriam, for her patience through the many versions of this project, for her proofreading, and for sharing me with the computer. I would like to thank my parents for their love, and for the grace with which they raised and educated me. Finally, I @@ -1028,32 +1026,32 @@ March, 2001  File: gawk.info, Node: Getting Started, Next: Regexp, Prev: Preface, Up: Top -Getting Started with `awk' -************************** +1 Getting Started with `awk' +**************************** - The basic function of `awk' is to search files for lines (or other +The basic function of `awk' is to search files for lines (or other units of text) that contain certain patterns. When a line matches one of the patterns, `awk' performs specified actions on that line. `awk' keeps processing input lines in this way until it reaches the end of the input files. - Programs in `awk' are different from programs in most other -languages, because `awk' programs are "data-driven"; that is, you -describe the data you want to work with and then what to do when you -find it. Most other languages are "procedural"; you have to describe, -in great detail, every step the program is to take. When working with -procedural languages, it is usually much harder to clearly describe the -data your program will process. For this reason, `awk' programs are -often refreshingly easy to read and write. +Programs in `awk' are different from programs in most other languages, +because `awk' programs are "data-driven"; that is, you describe the +data you want to work with and then what to do when you find it. Most +other languages are "procedural"; you have to describe, in great +detail, every step the program is to take. When working with procedural +languages, it is usually much harder to clearly describe the data your +program will process. For this reason, `awk' programs are often +refreshingly easy to read and write. - When you run `awk', you specify an `awk' "program" that tells `awk' +When you run `awk', you specify an `awk' "program" that tells `awk' what to do. The program consists of a series of "rules". (It may also contain "function definitions", an advanced feature that we will ignore for now. *Note User-defined::.) Each rule specifies one pattern to search for and one action to perform upon finding the pattern. - Syntactically, a rule consists of a pattern followed by an action. -The action is enclosed in curly braces to separate it from the pattern. +Syntactically, a rule consists of a pattern followed by an action. The +action is enclosed in curly braces to separate it from the pattern. Newlines usually separate rules. Therefore, an `awk' program looks like this: @@ -1080,21 +1078,21 @@ like this:  File: gawk.info, Node: Running gawk, Next: Sample Data Files, Up: Getting Started -How to Run `awk' Programs -========================= +1.1 How to Run `awk' Programs +============================= - There are several ways to run an `awk' program. If the program is +There are several ways to run an `awk' program. If the program is short, it is easiest to include it in the command that runs `awk', like this: awk 'PROGRAM' INPUT-FILE1 INPUT-FILE2 ... - When the program is long, it is usually more convenient to put it in -a file and run it with a command like this: +When the program is long, it is usually more convenient to put it in a +file and run it with a command like this: awk -f PROGRAM-FILE INPUT-FILE1 INPUT-FILE2 ... - This minor node discusses both mechanisms, along with several +This minor node discusses both mechanisms, along with several variations of each. * Menu: @@ -1113,10 +1111,10 @@ variations of each.  File: gawk.info, Node: One-shot, Next: Read Terminal, Up: Running gawk -One-Shot Throwaway `awk' Programs ---------------------------------- +1.1.1 One-Shot Throwaway `awk' Programs +--------------------------------------- - Once you are familiar with `awk', you will often type in simple +Once you are familiar with `awk', you will often type in simple programs the moment you want to use them. Then you can write the program as the first argument of the `awk' command, like this: @@ -1125,27 +1123,27 @@ program as the first argument of the `awk' command, like this: where PROGRAM consists of a series of PATTERNS and ACTIONS, as described earlier. - This command format instructs the "shell", or command interpreter, -to start `awk' and use the PROGRAM to process records in the input +This command format instructs the "shell", or command interpreter, to +start `awk' and use the PROGRAM to process records in the input file(s). There are single quotes around PROGRAM so the shell won't interpret any `awk' characters as special shell characters. The quotes also cause the shell to treat all of PROGRAM as a single argument for `awk', and allow PROGRAM to be more than one line long. - This format is also useful for running short or medium-sized `awk' +This format is also useful for running short or medium-sized `awk' programs from shell scripts, because it avoids the need for a separate file for the `awk' program. A self-contained shell script is more reliable because there are no other files to misplace. - *Note Very Simple::, presents several short, self-contained programs. +*Note Very Simple::, presents several short, self-contained programs.  File: gawk.info, Node: Read Terminal, Next: Long, Prev: One-shot, Up: Running gawk -Running `awk' Without Input Files ---------------------------------- +1.1.2 Running `awk' Without Input Files +--------------------------------------- - You can also run `awk' without any input files. If you type the +You can also run `awk' without any input files. If you type the following command line: awk 'PROGRAM' @@ -1156,20 +1154,19 @@ end-of-file by typing `Ctrl-d'. (On other operating systems, the end-of-file character may be different. For example, on OS/2 and MS-DOS, it is `Ctrl-z'.) - As an example, the following program prints a friendly piece of -advice (from Douglas Adams's `The Hitchhiker's Guide to the Galaxy'), -to keep you from worrying about the complexities of computer programming +As an example, the following program prints a friendly piece of advice +(from Douglas Adams's `The Hitchhiker's Guide to the Galaxy'), to keep +you from worrying about the complexities of computer programming (`BEGIN' is a feature we haven't discussed yet): $ awk "BEGIN { print \"Don't Panic!\" }" -| Don't Panic! - This program does not read any input. The `\' before each of the -inner double quotes is necessary because of the shell's quoting -rules--in particular because it mixes both single quotes and double -quotes.(1) +This program does not read any input. The `\' before each of the inner +double quotes is necessary because of the shell's quoting rules--in +particular because it mixes both single quotes and double quotes.(1) - This next simple `awk' program emulates the `cat' utility; it copies +This next simple `awk' program emulates the `cat' utility; it copies whatever you type on the keyboard to its standard output (why this works is explained shortly). @@ -1184,26 +1181,26 @@ works is explained shortly). -| What, me worry? Ctrl-d - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) Although we generally recommend the use of single quotes around -the program text, double quotes are needed here in order to put the -single quote into the message. +(1) Although we generally recommend the use of single quotes around the +program text, double quotes are needed here in order to put the single +quote into the message.  File: gawk.info, Node: Long, Next: Executable Scripts, Prev: Read Terminal, Up: Running gawk -Running Long Programs ---------------------- +1.1.3 Running Long Programs +--------------------------- - Sometimes your `awk' programs can be very long. In this case, it is +Sometimes your `awk' programs can be very long. In this case, it is more convenient to put the program into a separate file. In order to tell `awk' to use that file for its program, you type: awk -f SOURCE-FILE INPUT-FILE1 INPUT-FILE2 ... - The `-f' instructs the `awk' utility to get the `awk' program from -the file SOURCE-FILE. Any file name can be used for SOURCE-FILE. For +The `-f' instructs the `awk' utility to get the `awk' program from the +file SOURCE-FILE. Any file name can be used for SOURCE-FILE. For example, you could put the program: BEGIN { print "Don't Panic!" } @@ -1223,24 +1220,23 @@ special characters. Notice that in `advice', the `awk' program did not have single quotes around it. The quotes are only needed for programs that are provided on the `awk' command line. - If you want to identify your `awk' program files clearly as such, -you can add the extension `.awk' to the file name. This doesn't affect -the execution of the `awk' program but it does make "housekeeping" -easier. +If you want to identify your `awk' program files clearly as such, you +can add the extension `.awk' to the file name. This doesn't affect the +execution of the `awk' program but it does make "housekeeping" easier.  File: gawk.info, Node: Executable Scripts, Next: Comments, Prev: Long, Up: Running gawk -Executable `awk' Programs -------------------------- +1.1.4 Executable `awk' Programs +------------------------------- - Once you have learned `awk', you may want to write self-contained -`awk' scripts, using the `#!' script mechanism. You can do this on -many Unix systems(1) as well as on the GNU system. For example, you -could update the file `advice' to look like this: +Once you have learned `awk', you may want to write self-contained `awk' +scripts, using the `#!' script mechanism. You can do this on many Unix +systems(1) as well as on the GNU system. For example, you could update +the file `advice' to look like this: #! /bin/awk -f - + BEGIN { print "Don't Panic!" } After making this file executable (with the `chmod' utility), simply @@ -1255,35 +1251,35 @@ if you had typed `awk -f advice': variable (typically `$PATH'). If not, you may need to type `./advice' at the shell.) - Self-contained `awk' scripts are useful when you want to write a +Self-contained `awk' scripts are useful when you want to write a program that users can invoke without their having to know that the program is written in `awk'. Advanced Notes: Portability Issues with `#!' -------------------------------------------- - Some systems limit the length of the interpreter name to 32 -characters. Often, this can be dealt with by using a symbolic link. +Some systems limit the length of the interpreter name to 32 characters. +Often, this can be dealt with by using a symbolic link. - You should not put more than one argument on the `#!' line after the +You should not put more than one argument on the `#!' line after the path to `awk'. It does not work. The operating system treats the rest of the line as a single argument and passes it to `awk'. Doing this leads to confusing behavior--most likely a usage diagnostic of some sort from `awk'. - Finally, the value of `ARGV[0]' (*note Built-in Variables::) varies +Finally, the value of `ARGV[0]' (*note Built-in Variables::) varies depending upon your operating system. Some systems put `awk' there, some put the full pathname of `awk' (such as `/bin/awk'), and some put the name of your script (`advice'). Don't rely on the value of `ARGV[0]' to provide your script name. - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) The `#!' mechanism works on Linux systems, systems derived from -the 4.4-Lite Berkeley Software Distribution, and most commercial Unix +(1) The `#!' mechanism works on Linux systems, systems derived from the +4.4-Lite Berkeley Software Distribution, and most commercial Unix systems. - (2) The line beginning with `#!' lists the full file name of an +(2) The line beginning with `#!' lists the full file name of an interpreter to run and an optional initial command-line argument to pass to that interpreter. The operating system then runs the interpreter with the given argument and the full argument list of the @@ -1294,64 +1290,63 @@ options to `awk', or data files, or both.  File: gawk.info, Node: Comments, Next: Quoting, Prev: Executable Scripts, Up: Running gawk -Comments in `awk' Programs --------------------------- +1.1.6 Comments in `awk' Programs +-------------------------------- - A "comment" is some text that is included in a program for the sake -of human readers; it is not really an executable part of the program. +A "comment" is some text that is included in a program for the sake of +human readers; it is not really an executable part of the program. Comments can explain what the program does and how it works. Nearly all programming languages have provisions for comments, as programs are typically hard to understand without them. - In the `awk' language, a comment starts with the sharp sign -character (`#') and continues to the end of the line. The `#' does not -have to be the first character on the line. The `awk' language ignores -the rest of a line following a sharp sign. For example, we could have -put the following into `advice': +In the `awk' language, a comment starts with the sharp sign character +(`#') and continues to the end of the line. The `#' does not have to +be the first character on the line. The `awk' language ignores the rest +of a line following a sharp sign. For example, we could have put the +following into `advice': # This program prints a nice friendly message. It helps # keep novice users from being afraid of the computer. BEGIN { print "Don't Panic!" } - You can put comment lines into keyboard-composed throwaway `awk' +You can put comment lines into keyboard-composed throwaway `awk' programs, but this usually isn't very useful; the purpose of a comment is to help you or another person understand the program when reading it at a later time. - *Caution:* As mentioned in *Note One-shot::, you can enclose small -to medium programs in single quotes, in order to keep your shell -scripts self-contained. When doing so, _don't_ put an apostrophe -(i.e., a single quote) into a comment (or anywhere else in your -program). The shell interprets the quote as the closing quote for the -entire program. As a result, usually the shell prints a message about -mismatched quotes, and if `awk' actually runs, it will probably print -strange messages about syntax errors. For example, look at the -following: +*Caution:* As mentioned in *Note One-shot::, you can enclose small to +medium programs in single quotes, in order to keep your shell scripts +self-contained. When doing so, _don't_ put an apostrophe (i.e., a +single quote) into a comment (or anywhere else in your program). The +shell interprets the quote as the closing quote for the entire program. +As a result, usually the shell prints a message about mismatched +quotes, and if `awk' actually runs, it will probably print strange +messages about syntax errors. For example, look at the following: $ awk '{ print "hello" } # let's be cute' > - The shell sees that the first two quotes match, and that a new -quoted object begins at the end of the command line. It therefore -prompts with the secondary prompt, waiting for more input. With Unix -`awk', closing the quoted string produces this result: +The shell sees that the first two quotes match, and that a new quoted +object begins at the end of the command line. It therefore prompts +with the secondary prompt, waiting for more input. With Unix `awk', +closing the quoted string produces this result: $ awk '{ print "hello" } # let's be cute' > ' error--> awk: can't open file be error--> source line number 1 - Putting a backslash before the single quote in `let's' wouldn't help, +Putting a backslash before the single quote in `let's' wouldn't help, since backslashes are not special inside single quotes. The next node describes the shell's quoting rules.  File: gawk.info, Node: Quoting, Prev: Comments, Up: Running gawk -Shell-Quoting Issues --------------------- +1.1.7 Shell-Quoting Issues +-------------------------- - For short to medium length `awk' programs, it is most convenient to +For short to medium length `awk' programs, it is most convenient to enter the program on the `awk' command line. This is best done by enclosing the entire program in single quotes. This is true whether you are entering the program interactively at the shell prompt, or @@ -1359,7 +1354,7 @@ writing it as part of a larger shell script: awk 'PROGRAM TEXT' INPUT-FILE1 INPUT-FILE2 ... - Once you are working with the shell, it is helpful to have a basic +Once you are working with the shell, it is helpful to have a basic knowledge of shell quoting rules. The following rules apply only to POSIX-compliant, Bourne-style shells (such as `bash', the GNU Bourne-Again Shell). If you use `csh', you're on your own. @@ -1412,7 +1407,7 @@ Bourne-Again Shell). If you use `csh', you're on your own. of the program! This results in syntax errors at best, and confusing behavior at worst. - Mixing single and double quotes is difficult. You have to resort to +Mixing single and double quotes is difficult. You have to resort to shell quoting tricks, like this: $ awk 'BEGIN { print "Here is a single quote <'"'"'>" }' @@ -1421,14 +1416,14 @@ shell quoting tricks, like this: This program consists of three concatenated quoted strings. The first and the third are single-quoted, the second is double-quoted. - This can be "simplified" to: +This can be "simplified" to: $ awk 'BEGIN { print "Here is a single quote <'\''>" }' -| Here is a single quote <'> Judge for yourself which of these two is the more readable. - Another option is to use double quotes, escaping the embedded, +Another option is to use double quotes, escaping the embedded, `awk'-level double quotes: $ awk "BEGIN { print \"Here is a single quote <'>\" }" @@ -1437,29 +1432,45 @@ Judge for yourself which of these two is the more readable. This option is also painful, because double quotes, backslashes, and dollar signs are very common in `awk' programs. - If you really need both single and double quotes in your `awk' -program, it is probably best to move it into a separate file, where the -shell won't be part of the picture, and you can say what you mean. +A third option is to use the octal escape sequence equivalents for the +single- and double-quote characters, like so: + + $ awk 'BEGIN { print "Here is a single quote <\47>" }' + -| Here is a single quote <'> + $ awk 'BEGIN { print "Here is a double quote <\42>" }' + -| Here is a double quote <"> + +This works nicely, except that you should comment clearly what the +escapes mean. + +A fourth option is to use command-line variable assignment, like this: + + $ awk -v sq="'" 'BEGIN { print "Here is a single quote <" sq ">" }' + -| Here is a single quote <'> + +If you really need both single and double quotes in your `awk' program, +it is probably best to move it into a separate file, where the shell +won't be part of the picture, and you can say what you mean.  File: gawk.info, Node: Sample Data Files, Next: Very Simple, Prev: Running gawk, Up: Getting Started -Data Files for the Examples -=========================== +1.2 Data Files for the Examples +=============================== - Many of the examples in this Info file take their input from two -sample data files. The first, `BBS-list', represents a list of -computer bulletin board systems together with information about those -systems. The second data file, called `inventory-shipped', contains -information about monthly shipments. In both files, each line is -considered to be one "record". +Many of the examples in this Info file take their input from two sample +data files. The first, `BBS-list', represents a list of computer +bulletin board systems together with information about those systems. +The second data file, called `inventory-shipped', contains information +about monthly shipments. In both files, each line is considered to be +one "record". - In the data file `BBS-list', each record contains the name of a -computer bulletin board, its phone number, the board's baud rate(s), -and a code for the number of hours it is operational. An `A' in the -last column means the board operates 24 hours a day. A `B' in the last -column means the board only operates on evening and weekend hours. A -`C' means the board operates only on weekends: +In the data file `BBS-list', each record contains the name of a computer +bulletin board, its phone number, the board's baud rate(s), and a code +for the number of hours it is operational. An `A' in the last column +means the board operates 24 hours a day. A `B' in the last column +means the board only operates on evening and weekend hours. A `C' +means the board operates only on weekends: aardvark 555-5553 1200/300 B alpo-net 555-3412 2400/1200/300 A @@ -1473,7 +1484,7 @@ column means the board only operates on evening and weekend hours. A sdace 555-3430 2400/1200/300 A sabafoo 555-2127 1200/300 C - The data file `inventory-shipped' represents information about +The data file `inventory-shipped' represents information about shipments during the year. Each record contains the month, the number of green crates shipped, the number of red boxes shipped, the number of orange bags shipped, and the number of blue packages shipped, @@ -1492,13 +1503,13 @@ and the first four months of the current year. Oct 29 54 68 525 Nov 20 87 82 577 Dec 17 35 61 401 - + Jan 21 36 64 620 Feb 26 58 80 652 Mar 24 75 70 495 Apr 21 70 74 514 - If you are reading this in GNU Emacs using Info, you can copy the +If you are reading this in GNU Emacs using Info, you can copy the regions of text showing these sample files into your own test files. This way you can try out the examples shown in the remainder of this document. You do this by using the command `M-x write-region' to copy @@ -1507,17 +1518,17 @@ Miscellaneous File Operations: (emacs)Misc File Ops, for more information). Using this information, create your own `BBS-list' and `inventory-shipped' files and practice what you learn in this Info file. - If you are using the stand-alone version of Info, see *Note Extract +If you are using the stand-alone version of Info, see *Note Extract Program::, for an `awk' program that extracts these data files from `gawk.texi', the Texinfo source file for this Info file.  File: gawk.info, Node: Very Simple, Next: Two Rules, Prev: Sample Data Files, Up: Getting Started -Some Simple Examples -==================== +1.3 Some Simple Examples +======================== - The following command runs a simple `awk' program that searches the +The following command runs a simple `awk' program that searches the input file `BBS-list' for the character string `foo' (a grouping of characters is usually called a "string"; the term "string" is based on similar usage in English, such as "a string of pearls," or "a string of @@ -1529,7 +1540,7 @@ When lines containing `foo' are found, they are printed because `print $0' means print the current line. (Just `print' by itself means the same thing, so we could have written that instead.) - You will notice that slashes (`/') surround the string `foo' in the +You will notice that slashes (`/') surround the string `foo' in the `awk' program. The slashes indicate that `foo' is the pattern to search for. This type of pattern is called a "regular expression", which is covered in more detail later (*note Regexp::). The pattern is @@ -1537,7 +1548,7 @@ allowed to match parts of words. There are single quotes around the `awk' program so that the shell won't interpret any of it as special shell characters. - Here is what this program prints: +Here is what this program prints: $ awk '/foo/ { print $0 }' BBS-list -| fooey 555-1234 2400/1200/300 B @@ -1545,18 +1556,18 @@ shell characters. -| macfoo 555-6480 1200/300 A -| sabafoo 555-2127 1200/300 C - In an `awk' rule, either the pattern or the action can be omitted, -but not both. If the pattern is omitted, then the action is performed -for _every_ input line. If the action is omitted, the default action -is to print all lines that match the pattern. +In an `awk' rule, either the pattern or the action can be omitted, but +not both. If the pattern is omitted, then the action is performed for +_every_ input line. If the action is omitted, the default action is to +print all lines that match the pattern. - Thus, we could leave out the action (the `print' statement and the -curly braces) in the previous example and the result would be the same: -all lines matching the pattern `foo' are printed. By comparison, -omitting the `print' statement but retaining the curly braces makes an -empty action that does nothing (i.e., no lines are printed). +Thus, we could leave out the action (the `print' statement and the curly +braces) in the previous example and the result would be the same: all +lines matching the pattern `foo' are printed. By comparison, omitting +the `print' statement but retaining the curly braces makes an empty +action that does nothing (i.e., no lines are printed). - Many practical `awk' programs are just a line or two. Following is a +Many practical `awk' programs are just a line or two. Following is a collection of useful, short programs to get you started. Some of these programs contain constructs that haven't been covered yet. (The description of the program will give you a good idea of what is going @@ -1630,20 +1641,20 @@ different ways to do the same things shown here:  File: gawk.info, Node: Two Rules, Next: More Complex, Prev: Very Simple, Up: Getting Started -An Example with Two Rules -========================= +1.4 An Example with Two Rules +============================= - The `awk' utility reads the input files one line at a time. For -each line, `awk' tries the patterns of each of the rules. If several +The `awk' utility reads the input files one line at a time. For each +line, `awk' tries the patterns of each of the rules. If several patterns match, then several actions are run in the order in which they appear in the `awk' program. If no patterns match, then no actions are run. - After processing all the rules that match the line (and perhaps -there are none), `awk' reads the next line. (However, *note Next -Statement::, and also *note Nextfile Statement::). This continues -until the program reaches the end of the file. For example, the -following `awk' program contains two rules: +After processing all the rules that match the line (and perhaps there +are none), `awk' reads the next line. (However, *note Next Statement::, +and also *note Nextfile Statement::). This continues until the program +reaches the end of the file. For example, the following `awk' program +contains two rules: /12/ { print $0 } /21/ { print $0 } @@ -1653,11 +1664,11 @@ action. The second rule has the string `21' as the pattern and also has `print $0' as the action. Each rule's action is enclosed in its own pair of braces. - This program prints every line that contains the string `12' _or_ -the string `21'. If a line contains both strings, it is printed twice, +This program prints every line that contains the string `12' _or_ the +string `21'. If a line contains both strings, it is printed twice, once by each rule. - This is what happens if we run this program on our two sample data +This is what happens if we run this program on our two sample data files, `BBS-list' and `inventory-shipped': $ awk '/12/ { print $0 } @@ -1682,11 +1693,11 @@ twice, once for each rule.  File: gawk.info, Node: More Complex, Next: Statements/Lines, Prev: Two Rules, Up: Getting Started -A More Complex Example -====================== +1.5 A More Complex Example +========================== - Now that we've mastered some simple tasks, let's look at what -typical `awk' programs do. This example shows how `awk' can be used to +Now that we've mastered some simple tasks, let's look at what typical +`awk' programs do. This example shows how `awk' can be used to summarize, select, and rearrange the output of another utility. It uses features that haven't been covered yet, so don't worry if you don't understand all the details: @@ -1694,7 +1705,7 @@ understand all the details: ls -l | awk '$6 == "Nov" { sum += $5 } END { print sum }' - This command prints the total number of bytes in all the files in the +This command prints the total number of bytes in all the files in the current directory that were last modified in November (of any year). (1) The `ls -l' part of this example is a system command that gives you a listing of the files in a directory, including each file's size and @@ -1717,7 +1728,7 @@ The sixth, seventh, and eighth fields contain the month, day, and time, respectively, that the file was last modified. Finally, the ninth field contains the name of the file.(2) - The `$6 == "Nov"' in our `awk' program is an expression that tests +The `$6 == "Nov"' in our `awk' program is an expression that tests whether the sixth field of the output from `ls -l' matches the string `Nov'. Each time a line has the string `Nov' for its sixth field, the action `sum += $5' is performed. This adds the fifth field (the file's @@ -1726,20 +1737,20 @@ reading all the input lines, `sum' is the total of the sizes of the files whose lines matched the pattern. (This works because `awk' variables are automatically initialized to zero.) - After the last line of output from `ls' has been processed, the -`END' rule executes and prints the value of `sum'. In this example, -the value of `sum' is 80600. +After the last line of output from `ls' has been processed, the `END' +rule executes and prints the value of `sum'. In this example, the +value of `sum' is 80600. - These more advanced `awk' techniques are covered in later sections +These more advanced `awk' techniques are covered in later sections (*note Action Overview::). Before you can move on to more advanced `awk' programming, you have to know how `awk' interprets your input and displays your output. By manipulating fields and using `print' statements, you can produce some very useful and impressive-looking reports. - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) In the C shell (`csh'), you need to type a semicolon and then a +(1) In the C shell (`csh'), you need to type a semicolon and then a backslash at the end of the first line; see *Note Statements/Lines::, for an explanation. In a POSIX-compliant shell, such as the Bourne shell or `bash', you can type the example as shown. If the command @@ -1747,35 +1758,34 @@ shell or `bash', you can type the example as shown. If the command POSIX-compliant shell. Otherwise, you are probably using the C shell or a shell derived from it. - (2) On some very old systems, you may need to use `ls -lg' to get -this output. +(2) On some very old systems, you may need to use `ls -lg' to get this +output.  File: gawk.info, Node: Statements/Lines, Next: Other Features, Prev: More Complex, Up: Getting Started -`awk' Statements Versus Lines -============================= +1.6 `awk' Statements Versus Lines +================================= - Most often, each line in an `awk' program is a separate statement or +Most often, each line in an `awk' program is a separate statement or separate rule, like this: awk '/12/ { print $0 } /21/ { print $0 }' BBS-list inventory-shipped - However, `gawk' ignores newlines after any of the following symbols -and keywords: +However, `gawk' ignores newlines after any of the following symbols and +keywords: , { ? : || && do else A newline at any other point is considered the end of the statement.(1) - If you would like to split a single statement into two lines at a -point where a newline would terminate it, you can "continue" it by -ending the first line with a backslash character (`\'). The backslash -must be the final character on the line in order to be recognized as a -continuation character. A backslash is allowed anywhere in the -statement, even in the middle of a string or regular expression. For -example: +If you would like to split a single statement into two lines at a point +where a newline would terminate it, you can "continue" it by ending the +first line with a backslash character (`\'). The backslash must be the +final character on the line in order to be recognized as a continuation +character. A backslash is allowed anywhere in the statement, even in +the middle of a string or regular expression. For example: awk '/This regular expression is too long, so continue it\ on the next line/ { print $1 }' @@ -1794,8 +1804,8 @@ constant using backslash continuation. Thus, for maximum portability of your `awk' programs, it is best not to split your lines in the middle of a regular expression or a string. - *Caution:* _Backslash continuation does not work as described with -the C shell._ It works for `awk' programs in files and for one-shot +*Caution:* _Backslash continuation does not work as described with the +C shell._ It works for `awk' programs in files and for one-shot programs, _provided_ you are using a POSIX-compliant shell, such as the Unix Bourne shell or `bash'. But the C shell behaves differently! There, you must use two backslashes in a row, followed by a newline. @@ -1811,8 +1821,8 @@ program must be escaped with a backslash. To illustrate: Here, the `%' and `?' are the C shell's primary and secondary prompts, analogous to the standard shell's `$' and `>'. - Compare the previous example to how it is done with a -POSIX-compliant shell: +Compare the previous example to how it is done with a POSIX-compliant +shell: $ awk 'BEGIN { > print \ @@ -1820,12 +1830,12 @@ POSIX-compliant shell: > }' -| hello, world - `awk' is a line-oriented language. Each rule's action has to begin -on the same line as the pattern. To have the pattern and action on +`awk' is a line-oriented language. Each rule's action has to begin on +the same line as the pattern. To have the pattern and action on separate lines, you _must_ use backslash continuation; there is no other option. - Another thing to keep in mind is that backslash continuation and +Another thing to keep in mind is that backslash continuation and comments do not mix. As soon as `awk' sees the `#' that starts a comment, it ignores _everything_ on the rest of the line. For example: @@ -1840,53 +1850,53 @@ onto the next line. However, the backslash-newline combination is never even noticed because it is "hidden" inside the comment. Thus, the `BEGIN' is noted as a syntax error. - When `awk' statements within one rule are short, you might want to -put more than one of them on a line. This is accomplished by -separating the statements with a semicolon (`;'). This also applies to -the rules themselves. Thus, the program shown at the start of this -minor node could also be written this way: +When `awk' statements within one rule are short, you might want to put +more than one of them on a line. This is accomplished by separating +the statements with a semicolon (`;'). This also applies to the rules +themselves. Thus, the program shown at the start of this minor node +could also be written this way: /12/ { print $0 } ; /21/ { print $0 } -*Note:* The requirement that states that rules on the same line must be -separated with a semicolon was not in the original `awk' language; it -was added for consistency with the treatment of statements within an -action. + NOTE: The requirement that states that rules on the same line must + be separated with a semicolon was not in the original `awk' + language; it was added for consistency with the treatment of + statements within an action. - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) The `?' and `:' referred to here is the three-operand -conditional expression described in *Note Conditional Exp::. Splitting -lines after `?' and `:' is a minor `gawk' extension; if `--posix' is -specified (*note Options::), then this extension is disabled. +(1) The `?' and `:' referred to here is the three-operand conditional +expression described in *Note Conditional Exp::. Splitting lines after +`?' and `:' is a minor `gawk' extension; if `--posix' is specified +(*note Options::), then this extension is disabled.  File: gawk.info, Node: Other Features, Next: When, Prev: Statements/Lines, Up: Getting Started -Other Features of `awk' -======================= +1.7 Other Features of `awk' +=========================== - The `awk' language provides a number of predefined, or "built-in", +The `awk' language provides a number of predefined, or "built-in", variables that your programs can use to get information from `awk'. There are other variables your program can set as well to control how `awk' processes your data. - In addition, `awk' provides a number of built-in functions for doing +In addition, `awk' provides a number of built-in functions for doing common computational and string-related operations. `gawk' provides built-in functions for working with timestamps, performing bit manipulation, and for runtime string translation. - As we develop our presentation of the `awk' language, we introduce -most of the variables and many of the functions. They are defined +As we develop our presentation of the `awk' language, we introduce most +of the variables and many of the functions. They are defined systematically in *Note Built-in Variables::, and *Note Built-in::.  File: gawk.info, Node: When, Prev: Other Features, Up: Getting Started -When to Use `awk' -================= +1.8 When to Use `awk' +===================== - Now that you've seen some of what `awk' can do, you might wonder how +Now that you've seen some of what `awk' can do, you might wonder how `awk' could be useful for you. By using utility programs, advanced patterns, field separators, arithmetic statements, and other selection criteria, you can produce much more complex output. The `awk' language @@ -1894,20 +1904,23 @@ is very useful for producing reports from large amounts of raw data, such as summarizing information from the output of other utility programs like `ls'. (*Note More Complex::.) - Programs written with `awk' are usually much smaller than they would -be in other languages. This makes `awk' programs easy to compose and -use. Often, `awk' programs can be quickly composed at your terminal, -used once, and thrown away. Because `awk' programs are interpreted, you -can avoid the (usually lengthy) compilation part of the typical +Programs written with `awk' are usually much smaller than they would be +in other languages. This makes `awk' programs easy to compose and use. +Often, `awk' programs can be quickly composed at your terminal, used +once, and thrown away. Because `awk' programs are interpreted, you can +avoid the (usually lengthy) compilation part of the typical edit-compile-test-debug cycle of software development. - Complex programs have been written in `awk', including a complete +Complex programs have been written in `awk', including a complete retargetable assembler for eight-bit microprocessors (*note Glossary::, for more information), and a microcode assembler for a special-purpose -Prolog computer. However, `awk''s capabilities are strained by tasks of -such complexity. +Prolog computer. More recently, `gawk' was used for writing a Wiki +clone.(1) While the original `awk''s capabilities were strained by tasks +of such complexity, modern versions are more capable. Even the Bell +Labs version of `awk' has fewer predefined limits, and those that it +has are much larger than they used to be. - If you find yourself writing `awk' scripts of more than, say, a few +If you find yourself writing `awk' scripts of more than, say, a few hundred lines, you might consider using a different programming language. Emacs Lisp is a good choice if you need sophisticated string or pattern matching capabilities. The shell is also good at string and @@ -1918,18 +1931,23 @@ of large programs. Programs in these languages may require more lines of source code than the equivalent `awk' programs, but they are easier to maintain and usually run more efficiently. +---------- Footnotes ---------- + +(1) Yet Another Wiki Clone +(http://www.awk-scripting.de/cgi/wiki.cgi/yawk/). +  File: gawk.info, Node: Regexp, Next: Reading Files, Prev: Getting Started, Up: Top -Regular Expressions -******************* +2 Regular Expressions +********************* - A "regular expression", or "regexp", is a way of describing a set of +A "regular expression", or "regexp", is a way of describing a set of strings. Because regular expressions are such a fundamental part of `awk' programming, their format and use deserve a separate major node. - A regular expression enclosed in slashes (`/') is an `awk' pattern -that matches every input record whose text belongs to that set. The +A regular expression enclosed in slashes (`/') is an `awk' pattern that +matches every input record whose text belongs to that set. The simplest regular expression is a sequence of letters, numbers, or both. Such a regexp matches any string that contains that sequence. Thus, the regexp `foo' matches any string containing `foo'. Therefore, the @@ -1952,10 +1970,10 @@ you specify more complicated classes of strings.  File: gawk.info, Node: Regexp Usage, Next: Escape Sequences, Up: Regexp -How to Use Regular Expressions -============================== +2.1 How to Use Regular Expressions +================================== - A regular expression can be used as a pattern by enclosing it in +A regular expression can be used as a pattern by enclosing it in slashes. Then the regular expression is tested against the entire text of each record. (Normally, it only needs to match some part of the text in order to succeed.) For example, the following prints the @@ -1968,7 +1986,7 @@ it: -| 555-6480 -| 555-2127 - `~' (tilde), `~' operator Regular expressions can also be used in +`~' (tilde), `~' operator Regular expressions can also be used in matching expressions. These expressions allow you to specify the string to match against; it need not be the entire current input record. The two operators `~' and `!~' perform regular expression @@ -1988,16 +2006,16 @@ uppercase letter `J' somewhere in the first field: -| Jul 24 34 67 436 -| Jan 21 36 64 620 - So does this: +So does this: awk '{ if ($1 ~ /J/) print }' inventory-shipped - This next example is true if the expression EXP (taken as a -character string) does _not_ match REGEXP: +This next example is true if the expression EXP (taken as a character +string) does _not_ match REGEXP: EXP !~ /REGEXP/ - The following example matches, or selects, all input records whose +The following example matches, or selects, all input records whose first field _does not_ contain the uppercase letter `J': $ awk '$1 !~ /J/' inventory-shipped @@ -2007,17 +2025,17 @@ first field _does not_ contain the uppercase letter `J': -| May 16 34 29 208 ... - When a regexp is enclosed in slashes, such as `/foo/', we call it a +When a regexp is enclosed in slashes, such as `/foo/', we call it a "regexp constant", much like `5.27' is a numeric constant and `"foo"' is a string constant.  File: gawk.info, Node: Escape Sequences, Next: Regexp Operators, Prev: Regexp Usage, Up: Regexp -Escape Sequences -================ +2.2 Escape Sequences +==================== - Some characters cannot be included literally in string constants +Some characters cannot be included literally in string constants (`"foo"') or regexp constants (`/foo/'). Instead, they should be represented with "escape sequences", which are character sequences beginning with a backslash (`\'). One use of an escape sequence is to @@ -2028,17 +2046,17 @@ double-quote character as a part of the string. For example: $ awk 'BEGIN { print "He said \"hi!\" to her." }' -| He said "hi!" to her. - The backslash character itself is another character that cannot be +The backslash character itself is another character that cannot be included normally; you must write `\\' to put one backslash in the string or regexp. Thus, the string whose contents are the two characters `"' and `\' must be written `"\"\\"'. - Backslash also represents unprintable characters such as TAB or +Backslash also represents unprintable characters such as TAB or newline. While there is nothing to stop you from entering most unprintable characters directly in a string constant or regexp constant, they may look ugly. - The following table lists all the escape sequences used in `awk' and +The following table lists all the escape sequences used in `awk' and what they represent. Unless noted otherwise, all these escape sequences apply to both string constants and regexp constants: @@ -2095,20 +2113,20 @@ apply to both string constants and regexp constants: string, in order to tell `awk' to keep processing the rest of the string. - In `gawk', a number of additional two-character sequences that begin +In `gawk', a number of additional two-character sequences that begin with a backslash have special meaning in regexps. *Note GNU Regexp Operators::. - In a regexp, a backslash before any character that is not in the +In a regexp, a backslash before any character that is not in the previous list and not listed in *Note GNU Regexp Operators::, means that the next character should be taken literally, even if it would normally be a regexp operator. For example, `/a\+b/' matches the three characters `a+b'. - For complete portability, do not use a backslash before any -character not shown in the previous list. +For complete portability, do not use a backslash before any character +not shown in the previous list. - To summarize: +To summarize: * The escape sequences in the table above are always processed first, for both string constants and regexp constants. This happens very @@ -2124,8 +2142,8 @@ character not shown in the previous list. Advanced Notes: Backslash Before Regular Characters --------------------------------------------------- - If you place a backslash in a string constant before something that -is not one of the characters previously listed, POSIX `awk' purposely +If you place a backslash in a string constant before something that is +not one of the characters previously listed, POSIX `awk' purposely leaves what happens as undefined. There are two choices: Strip the backslash out @@ -2143,13 +2161,13 @@ Leave the backslash alone Advanced Notes: Escape Sequences for Metacharacters --------------------------------------------------- - Suppose you use an octal or hexadecimal escape to represent a regexp +Suppose you use an octal or hexadecimal escape to represent a regexp metacharacter. (See *Note Regexp Operators::.) Does `awk' treat the character as a literal character or as a regexp operator? - Historically, such characters were taken literally. (d.c.) -However, the POSIX standard indicates that they should be treated as -real metacharacters, which is what `gawk' does. In compatibility mode +Historically, such characters were taken literally. (d.c.) However, +the POSIX standard indicates that they should be treated as real +metacharacters, which is what `gawk' does. In compatibility mode (*note Options::), `gawk' treats the characters represented by octal and hexadecimal escape sequences literally when used in regexp constants. Thus, `/a\52b/' is equivalent to `/a\*b/'. @@ -2157,19 +2175,19 @@ constants. Thus, `/a\52b/' is equivalent to `/a\*b/'.  File: gawk.info, Node: Regexp Operators, Next: Character Lists, Prev: Escape Sequences, Up: Regexp -Regular Expression Operators -============================ +2.3 Regular Expression Operators +================================ - You can combine regular expressions with special characters, called +You can combine regular expressions with special characters, called "regular expression operators" or "metacharacters", to increase the power and versatility of regular expressions. - The escape sequences described in *Note Escape Sequences::, are -valid inside a regexp. They are introduced by a `\' and are recognized -and converted into corresponding real characters as the very first step -in processing regexps. +The escape sequences described in *Note Escape Sequences::, are valid +inside a regexp. They are introduced by a `\' and are recognized and +converted into corresponding real characters as the very first step in +processing regexps. - Here is a list of metacharacters. All characters that are not escape +Here is a list of metacharacters. All characters that are not escape sequences and that are not listed in the table stand for themselves: `\' @@ -2303,36 +2321,36 @@ sequences and that are not listed in the table stand for themselves: regexp constants are valid and work the way you want them to, using any version of `awk'.(2) - In regular expressions, the `*', `+', and `?' operators, as well as -the braces `{' and `}', have the highest precedence, followed by +In regular expressions, the `*', `+', and `?' operators, as well as the +braces `{' and `}', have the highest precedence, followed by concatenation, and finally by `|'. As in arithmetic, parentheses can change how operators are grouped. - In POSIX `awk' and `gawk', the `*', `+', and `?' operators stand for +In POSIX `awk' and `gawk', the `*', `+', and `?' operators stand for themselves when there is nothing in the regexp that precedes them. For example, `/+/' matches a literal plus sign. However, many other versions of `awk' treat such a usage as a syntax error. - If `gawk' is in compatibility mode (*note Options::), POSIX -character classes and interval expressions are not available in regular +If `gawk' is in compatibility mode (*note Options::), POSIX character +classes and interval expressions are not available in regular expressions. - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) In other literature, you may see a character list referred to as +(1) In other literature, you may see a character list referred to as either a "character set", a "character class", or a "bracket expression". - (2) Use two backslashes if you're using a string constant with a -regexp operator or function. +(2) Use two backslashes if you're using a string constant with a regexp +operator or function.  File: gawk.info, Node: Character Lists, Next: GNU Regexp Operators, Prev: Regexp Operators, Up: Regexp -Using Character Lists -===================== +2.4 Using Character Lists +========================= - Within a character list, a "range expression" consists of two +Within a character list, a "range expression" consists of two characters separated by a hyphen. It matches any single character that sorts between the two characters, using the locale's collating sequence and character set. For example, in the default C locale, `[a-dx-z]' is @@ -2343,47 +2361,63 @@ 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'. - To include one of the characters `\', `]', `-', or `^' in a -character list, put a `\' in front of it. For example: +To include one of the characters `\', `]', `-', or `^' in a character +list, put a `\' in front of it. For example: [d\]] matches either `d' or `]'. - This treatment of `\' in character lists is compatible with other -`awk' implementations and is also mandated by POSIX. The regular -expressions in `awk' are a superset of the POSIX specification for -Extended Regular Expressions (EREs). POSIX EREs are based on the -regular expressions accepted by the traditional `egrep' utility. +This treatment of `\' in character lists is compatible with other `awk' +implementations and is also mandated by POSIX. The regular expressions +in `awk' are a superset of the POSIX specification for Extended Regular +Expressions (EREs). POSIX EREs are based on the regular expressions +accepted by the traditional `egrep' utility. - "Character classes" are a new feature introduced in the POSIX -standard. A character class is a special notation for describing lists -of characters that have a specific attribute, but the actual characters +"Character classes" are a new feature introduced in the POSIX standard. +A character class is a special notation for describing lists of +characters that have a specific attribute, but the actual characters can vary from country to country and/or from character set to character set. For example, the notion of what is an alphabetic character differs between the United States and France. - A character class is only valid in a regexp _inside_ the brackets of -a character list. Character classes consist of `[:', a keyword -denoting the class, and `:]'. Here are the character classes defined -by the POSIX standard. - -`[:alnum:]' Alphanumeric characters. -`[:alpha:]' Alphabetic characters. -`[:blank:]' Space and TAB characters. -`[:cntrl:]' Control characters. -`[:digit:]' Numeric characters. -`[:graph:]' Characters that are both printable and visible. (A space is - printable but not visible, whereas an `a' is both.) -`[:lower:]' Lowercase alphabetic characters. -`[:print:]' Printable characters (characters that are not control - characters). -`[:punct:]' Punctuation characters (characters that are not letters, - digits, control characters, or space characters). -`[:space:]' Space characters (such as space, TAB, and formfeed, to name a - few). -`[:upper:]' Uppercase alphabetic characters. -`[:xdigit:]' Characters that are hexadecimal digits. +A character class is only valid in a regexp _inside_ the brackets of a +character list. Character classes consist of `[:', a keyword denoting +the class, and `:]'. *Note table-char-classes:: lists the character +classes defined by the POSIX standard. + +Class Meaning +-------------------------------------------------------------------------- +`[:alnum:]' Alphanumeric characters. +-------------------------------------------------------------------------- +`[:alpha:]' Alphabetic characters. +-------------------------------------------------------------------------- +`[:blank:]' Space and TAB characters. +-------------------------------------------------------------------------- +`[:cntrl:]' Control characters. +-------------------------------------------------------------------------- +`[:digit:]' Numeric characters. +-------------------------------------------------------------------------- +`[:graph:]' Characters that are both printable and visible. (A space is + printable but not visible, whereas an `a' is both.) +-------------------------------------------------------------------------- +`[:lower:]' Lowercase alphabetic characters. +-------------------------------------------------------------------------- +`[:print:]' Printable characters (characters that are not control + characters). +-------------------------------------------------------------------------- +`[:punct:]' Punctuation characters (characters that are not letters, + digits, control characters, or space characters). +-------------------------------------------------------------------------- +`[:space:]' Space characters (such as space, TAB, and formfeed, to name + a few). +-------------------------------------------------------------------------- +`[:upper:]' Uppercase alphabetic characters. +-------------------------------------------------------------------------- +`[:xdigit:]'Characters that are hexadecimal digits. +-------------------------------------------------------------------------- + +Table 2.1: POSIX Character Classes For example, before the POSIX standard, you had to write `/[A-Za-z0-9]/' to match alphanumeric characters. If your character @@ -2421,10 +2455,10 @@ they do not recognize collating symbols or equivalence classes.  File: gawk.info, Node: GNU Regexp Operators, Next: Case-sensitivity, Prev: Character Lists, Up: Regexp -`gawk'-Specific Regexp Operators -================================ +2.5 `gawk'-Specific Regexp Operators +==================================== - GNU software that deals with regular expressions provides a number of +GNU software that deals with regular expressions provides a number of additional regexp operators. These operators are described in this minor node and are specific to `gawk'; they are not available in other `awk' implementations. Most of the additional operators deal with word @@ -2509,13 +2543,13 @@ No options  File: gawk.info, Node: Case-sensitivity, Next: Leftmost Longest, Prev: GNU Regexp Operators, Up: Regexp -Case Sensitivity in Matching -============================ +2.6 Case Sensitivity in Matching +================================ - Case is normally significant in regular expressions, both when -matching ordinary characters (i.e., not metacharacters) and inside -character sets. Thus, a `w' in a regular expression matches only a -lowercase `w' and not an uppercase `W'. +Case is normally significant in regular expressions, both when matching +ordinary characters (i.e., not metacharacters) and inside character +sets. Thus, a `w' in a regular expression matches only a lowercase `w' +and not an uppercase `W'. The simplest way to do a case-independent match is to use a character list--for example, `[Ww]'. However, this can be cumbersome if you need @@ -2532,50 +2566,53 @@ discussed yet; *note String Functions::). For example: converts the first field to lowercase before matching against it. This works in any POSIX-compliant `awk'. - Another method, specific to `gawk', is to set the variable -`IGNORECASE' to a nonzero value (*note Built-in Variables::). When -`IGNORECASE' is not zero, _all_ regexp and string operations ignore -case. Changing the value of `IGNORECASE' dynamically controls the -case-sensitivity of the program as it runs. Case is significant by -default because `IGNORECASE' (like most variables) is initialized to -zero: +Another method, specific to `gawk', is to set the variable `IGNORECASE' +to a nonzero value (*note Built-in Variables::). When `IGNORECASE' is +not zero, _all_ regexp and string operations ignore case. Changing the +value of `IGNORECASE' dynamically controls the case-sensitivity of the +program as it runs. Case is significant by default because +`IGNORECASE' (like most variables) is initialized to zero: x = "aB" if (x ~ /ab/) ... # this test will fail - + IGNORECASE = 1 if (x ~ /ab/) ... # now it will succeed - In general, you cannot use `IGNORECASE' to make certain rules +In general, you cannot use `IGNORECASE' to make certain rules case-insensitive and other rules case-sensitive, because there is no straightforward way to set `IGNORECASE' just for the pattern of a particular rule.(1) To do this, use either character lists or `tolower'. However, one thing you can do with `IGNORECASE' only is dynamically turn case-sensitivity on or off for all the rules at once. - `IGNORECASE' can be set on the command line or in a `BEGIN' rule -(*note Other Arguments::; also *note Using BEGIN/END::). Setting -`IGNORECASE' from the command line is a way to make a program -case-insensitive without having to edit it. +`IGNORECASE' can be set on the command line or in a `BEGIN' rule (*note +Other Arguments::; also *note Using BEGIN/END::). Setting `IGNORECASE' +from the command line is a way to make a program case-insensitive +without having to edit it. - Prior to `gawk' 3.0, the value of `IGNORECASE' affected regexp +Prior to `gawk' 3.0, the value of `IGNORECASE' affected regexp operations only. It did not affect string comparison with `==', `!=', and so on. Beginning with version 3.0, both regexp and string comparison operations are also affected by `IGNORECASE'. - Beginning with `gawk' 3.0, the equivalences between upper- and +Beginning with `gawk' 3.0, the equivalences between upper- and lowercase characters are based on the ISO-8859-1 (ISO Latin-1) character set. This character set is a superset of the traditional 128 ASCII characters, which also provides a number of characters suitable for use with European languages. - The value of `IGNORECASE' has no effect if `gawk' is in -compatibility mode (*note Options::). Case is always significant in -compatibility mode. +As of `gawk' 3.1.4, the case equivalencies are fully locale-aware. +They are based on the C `' facilities, such as `isalpha()' and +`toupper()'. + +The value of `IGNORECASE' has no effect if `gawk' is in compatibility +mode (*note Options::). Case is always significant in compatibility +mode. - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) Experienced C and C++ programmers will note that it is possible, +(1) Experienced C and C++ programmers will note that it is possible, using something like `IGNORECASE = 1 && /foObAr/ { ... }' and `IGNORECASE = 0 || /foobar/ { ... }'. However, this is somewhat obscure and we don't recommend it. @@ -2583,19 +2620,19 @@ obscure and we don't recommend it.  File: gawk.info, Node: Leftmost Longest, Next: Computed Regexps, Prev: Case-sensitivity, Up: Regexp -How Much Text Matches? -====================== +2.7 How Much Text Matches? +========================== - Consider the following: +Consider the following: echo aaaabcd | awk '{ sub(/a+/, ""); print }' - This example uses the `sub' function (which we haven't discussed yet; +This example uses the `sub' function (which we haven't discussed yet; *note String Functions::) to make a change to the input record. Here, the regexp `/a+/' indicates "one or more `a' characters," and the replacement text is `'. - The input contains four `a' characters. `awk' (and POSIX) regular +The input contains four `a' characters. `awk' (and POSIX) regular expressions always match the leftmost, _longest_ sequence of input characters that can match. Thus, all four `a' characters are replaced with `' in this example: @@ -2603,7 +2640,7 @@ with `' in this example: $ echo aaaabcd | awk '{ sub(/a+/, ""); print }' -| bcd - For simple match/no-match tests, this is not so important. But when +For simple match/no-match tests, this is not so important. But when doing text matching and substitutions with the `match', `sub', `gsub', and `gensub' functions, it is very important. *Note String Functions::, for more information on these functions. Understanding this principle @@ -2613,10 +2650,10 @@ Records::, and also *note Field Separators::).  File: gawk.info, Node: Computed Regexps, Next: Locales, Prev: Leftmost Longest, Up: Regexp -Using Dynamic Regexps -===================== +2.8 Using Dynamic Regexps +========================= - The righthand side of a `~' or `!~' operator need not be a regexp +The righthand side of a `~' or `!~' operator need not be a regexp constant (i.e., a string of characters between slashes). It may be any expression. The expression is evaluated and converted to a string if necessary; the contents of the string are used as the regexp. A regexp @@ -2628,27 +2665,26 @@ that is computed in this way is called a "dynamic regexp": This sets `digits_regexp' to a regexp that describes one or more digits, and tests whether the input record matches this regexp. - When using the `~' and `!~' *Caution:* When using the `~' and `!~' -operators, there is a difference between a regexp constant enclosed in -slashes and a string constant enclosed in double quotes. If you are -going to use a string constant, you have to understand that the string -is, in essence, scanned _twice_: the first time when `awk' reads your -program, and the second time when it goes to match the string on the -lefthand side of the operator with the pattern on the right. This is -true of any string-valued expression (such as `digits_regexp', shown -previously), not just string constants. - - What difference does it make if the string is scanned twice? The -answer has to do with escape sequences, and particularly with -backslashes. To get a backslash into a regular expression inside a -string, you have to type two backslashes. - - For example, `/\*/' is a regexp constant for a literal `*'. Only -one backslash is needed. To do the same thing with a string, you have -to type `"\\*"'. The first backslash escapes the second one so that -the string actually contains the two characters `\' and `*'. - - Given that you can use both regexp and string constants to describe +*Caution:* When using the `~' and `!~' operators, there is a difference +between a regexp constant enclosed in slashes and a string constant +enclosed in double quotes. If you are going to use a string constant, +you have to understand that the string is, in essence, scanned _twice_: +the first time when `awk' reads your program, and the second time when +it goes to match the string on the lefthand side of the operator with +the pattern on the right. This is true of any string-valued expression +(such as `digits_regexp', shown previously), not just string constants. + +What difference does it make if the string is scanned twice? The answer +has to do with escape sequences, and particularly with backslashes. To +get a backslash into a regular expression inside a string, you have to +type two backslashes. + +For example, `/\*/' is a regexp constant for a literal `*'. Only one +backslash is needed. To do the same thing with a string, you have to +type `"\\*"'. The first backslash escapes the second one so that the +string actually contains the two characters `\' and `*'. + +Given that you can use both regexp and string constants to describe regular expressions, which should you use? The answer is "regexp constants," for several reasons: @@ -2669,8 +2705,8 @@ constants," for several reasons: Advanced Notes: Using `\n' in Character Lists of Dynamic Regexps ---------------------------------------------------------------- - Some commercial versions of `awk' do not allow the newline character -to be used inside a character list for a dynamic regexp: +Some commercial versions of `awk' do not allow the newline character to +be used inside a character list for a dynamic regexp: $ awk '$0 ~ "[ \t\n]"' error--> awk: newline in character class [ @@ -2679,29 +2715,29 @@ to be used inside a character list for a dynamic regexp: error--> context is error--> >>> <<< - But a newline in a regexp constant works with no problem: +But a newline in a regexp constant works with no problem: $ awk '$0 ~ /[ \t\n]/' here is a sample line -| here is a sample line Ctrl-d - `gawk' does not have this problem, and it isn't likely to occur -often in practice, but it's worth noting for future reference. +`gawk' does not have this problem, and it isn't likely to occur often +in practice, but it's worth noting for future reference.  File: gawk.info, Node: Locales, Prev: Computed Regexps, Up: Regexp -Where You Are Makes A Difference -================================ +2.9 Where You Are Makes A Difference +==================================== - Modern systems support the notion of "locales": a way to tell the +Modern systems support the notion of "locales": a way to tell the system about the local character set and language. The current locale setting can affect the way regexp matching works, often in surprising ways. In particular, many locales do case-insensitive matching, even when you may have specified characters of only one particular case. - The following example uses the `sub' function, which does text +The following example uses the `sub' function, which does text replacement (*note String Functions::). Here, the intent is to remove trailing uppercase characters: @@ -2719,17 +2755,17 @@ statements: LANG=C LC_ALL=C export LANG LC_ALL - The setting `C' forces `gawk' to behave in the traditional Unix -manner, where case distinctions do matter. You may wish to put these +The setting `C' forces `gawk' to behave in the traditional Unix manner, +where case distinctions do matter. You may wish to put these statements into your shell startup file, e.g., `$HOME/.profile'. - Similar considerations apply to other ranges. For example, `["-/]' -is perfectly valid in ASCII, but is not valid in many Unicode locales, +Similar considerations apply to other ranges. For example, `["-/]' is +perfectly valid in ASCII, but is not valid in many Unicode locales, such as `en_US.UTF-8'. (In general, such ranges should be avoided; either list the characters individually, or use a POSIX character class such as `[[:punct:]]'.) - For the normal case of `RS = "\n"', the locale is largely irrelevant. +For the normal case of `RS = "\n"', the locale is largely irrelevant. For other single byte record separators, using `LC_ALL=C' will give you much better performance when reading records. Otherwise, `gawk' has to make several function calls, _per input character_ to find the record @@ -2738,10 +2774,10 @@ terminator.  File: gawk.info, Node: Reading Files, Next: Printing, Prev: Regexp, Up: Top -Reading Input Files -******************* +3 Reading Input Files +********************* - In the typical `awk' program, all input is read either from the +In the typical `awk' program, all input is read either from the standard input (by default, this is the keyboard, but often it is a pipe from another command) or from files whose names you specify on the `awk' command line. If you specify input files, `awk' reads them in @@ -2749,13 +2785,13 @@ order, processing all the data from one before going on to the next. The name of the current input file can be found in the built-in variable `FILENAME' (*note Built-in Variables::). - The input is read in units called "records", and is processed by the +The input is read in units called "records", and is processed by the rules of your program one record at a time. By default, each record is one line. Each record is automatically split into chunks called "fields". This makes it more convenient for programs to work on the parts of a record. - On rare occasions, you may need to use the `getline' command. The +On rare occasions, you may need to use the `getline' command. The `getline' command is valuable, both because it can do explicit input from any number of files, and because the files used with it do not have to be named on the `awk' command line (*note Getline::). @@ -2775,31 +2811,30 @@ have to be named on the `awk' command line (*note Getline::).  File: gawk.info, Node: Records, Next: Fields, Up: Reading Files -How Input Is Split into Records -=============================== +3.1 How Input Is Split into Records +=================================== - The `awk' utility divides the input for your `awk' program into -records and fields. `awk' keeps track of the number of records that -have been read so far from the current input file. This value is -stored in a built-in variable called `FNR'. It is reset to zero when a -new file is started. Another built-in variable, `NR', is the total -number of input records read so far from all data files. It starts at -zero, but is never automatically reset to zero. +The `awk' utility divides the input for your `awk' program into records +and fields. `awk' keeps track of the number of records that have been +read so far from the current input file. This value is stored in a +built-in variable called `FNR'. It is reset to zero when a new file is +started. Another built-in variable, `NR', is the total number of input +records read so far from all data files. It starts at zero, but is +never automatically reset to zero. - Records are separated by a character called the "record separator". -By default, the record separator is the newline character. This is why +Records are separated by a character called the "record separator". By +default, the record separator is the newline character. This is why records are, by default, single lines. A different character can be used for the record separator by assigning the character to the built-in variable `RS'. - Like any other variable, the value of `RS' can be changed in the -`awk' program with the assignment operator, `=' (*note Assignment -Ops::). The new record-separator character should be enclosed in -quotation marks, which indicate a string constant. Often the right -time to do this is at the beginning of execution, before any input is -processed, so that the very first record is read with the proper -separator. To do this, use the special `BEGIN' pattern (*note -BEGIN/END::). For example: +Like any other variable, the value of `RS' can be changed in the `awk' +program with the assignment operator, `=' (*note Assignment Ops::). +The new record-separator character should be enclosed in quotation +marks, which indicate a string constant. Often the right time to do +this is at the beginning of execution, before any input is processed, +so that the very first record is read with the proper separator. To do +this, use the special `BEGIN' pattern (*note BEGIN/END::). For example: awk 'BEGIN { RS = "/" } { print $0 }' BBS-list @@ -2853,38 +2888,37 @@ record is treated as part of the record for the `core' BBS; the newline separating them in the output is the original newline in the data file, not the one added by `awk' when it printed the record! - Another way to change the record separator is on the command line, +Another way to change the record separator is on the command line, using the variable-assignment feature (*note Other Arguments::): awk '{ print $0 }' RS="/" BBS-list This sets `RS' to `/' before processing `BBS-list'. - Using an unusual character such as `/' for the record separator +Using an unusual character such as `/' for the record separator produces correct behavior in the vast majority of cases. However, the following (extreme) pipeline prints a surprising `1': $ echo | awk 'BEGIN { RS = "a" } ; { print NF }' -| 1 - There is one field, consisting of a newline. The value of the -built-in variable `NF' is the number of fields in the current record. +There is one field, consisting of a newline. The value of the built-in +variable `NF' is the number of fields in the current record. - Reaching the end of an input file terminates the current input -record, even if the last character in the file is not the character in -`RS'. (d.c.) +Reaching the end of an input file terminates the current input record, +even if the last character in the file is not the character in `RS'. +(d.c.) - The empty string `""' (a string without any characters) has a -special meaning as the value of `RS'. It means that records are -separated by one or more blank lines and nothing else. *Note Multiple -Line::, for more details. +The empty string `""' (a string without any characters) has a special +meaning as the value of `RS'. It means that records are separated by +one or more blank lines and nothing else. *Note Multiple Line::, for +more details. - If you change the value of `RS' in the middle of an `awk' run, the -new value is used to delimit subsequent records, but the record -currently being processed, as well as records already processed, are not -affected. +If you change the value of `RS' in the middle of an `awk' run, the new +value is used to delimit subsequent records, but the record currently +being processed, as well as records already processed, are not affected. - After the end of the record has been determined, `gawk' sets the +After the end of the record has been determined, `gawk' sets the variable `RT' to the text in the input that matched `RS'. When using `gawk', the value of `RS' is not limited to a one-character string. It can be any regular expression (*note Regexp::). In general, each record @@ -2896,14 +2930,14 @@ newline in the input), and the following record starts just after the end of this string (at the first character of the following line). The newline, because it matches `RS', is not part of either record. - When `RS' is a single character, `RT' contains the same single +When `RS' is a single character, `RT' contains the same single character. However, when `RS' is a regular expression, `RT' contains the actual input text that matched the regular expression. - The following example illustrates both of these features. It sets -`RS' equal to a regular expression that matches either a newline or a -series of one or more uppercase letters with optional leading and/or -trailing whitespace: +The following example illustrates both of these features. It sets `RS' +equal to a regular expression that matches either a newline or a series +of one or more uppercase letters with optional leading and/or trailing +whitespace: $ echo record 1 AAAA record 2 BBBB record 3 | > gawk 'BEGIN { RS = "\n|( *[[:upper:]]+ *)" } @@ -2918,15 +2952,15 @@ value of `RT' is a newline, and the `print' statement supplies its own terminating newline. *Note Simple Sed::, for a more useful example of `RS' as a regexp and `RT'. - If you set `RS' to a regular expression that allows optional -trailing text, such as `RS = "abc(XYZ)?"' it is possible, due to -implementation constraints, that `gawk' may match the leading part of -the regular expression, but not the trailing part, particularly if the -input text that could match the trailing part is fairly long. `gawk' -attempts to avoid this problem, but currently, there's no guarantee -that this will never happen. +If you set `RS' to a regular expression that allows optional trailing +text, such as `RS = "abc(XYZ)?"' it is possible, due to implementation +constraints, that `gawk' may match the leading part of the regular +expression, but not the trailing part, particularly if the input text +that could match the trailing part is fairly long. `gawk' attempts to +avoid this problem, but currently, there's no guarantee that this will +never happen. - The use of `RS' as a regular expression and the `RT' variable are +The use of `RS' as a regular expression and the `RT' variable are `gawk' extensions; they are not available in compatibility mode (*note Options::). In compatibility mode, only the first character of the value of `RS' is used to determine the end of the record. @@ -2934,55 +2968,55 @@ value of `RS' is used to determine the end of the record. Advanced Notes: `RS = "\0"' Is Not Portable ------------------------------------------- - There are times when you might want to treat an entire data file as a +There are times when you might want to treat an entire data file as a single record. The only way to make this happen is to give `RS' a value that you know doesn't occur in the input file. This is hard to do in a general way, such that a program always works for arbitrary input files. - You might think that for text files, the NUL character, which -consists of a character with all bits equal to zero, is a good value to -use for `RS' in this case: +You might think that for text files, the NUL character, which consists +of a character with all bits equal to zero, is a good value to use for +`RS' in this case: BEGIN { RS = "\0" } # whole file becomes one record? - `gawk' in fact accepts this, and uses the NUL character for the -record separator. However, this usage is _not_ portable to other `awk' +`gawk' in fact accepts this, and uses the NUL character for the record +separator. However, this usage is _not_ portable to other `awk' implementations. - All other `awk' implementations(1) store strings internally as -C-style strings. C strings use the NUL character as the string -terminator. In effect, this means that `RS = "\0"' is the same as `RS -= ""'. (d.c.) +All other `awk' implementations(1) store strings internally as C-style +strings. C strings use the NUL character as the string terminator. In +effect, this means that `RS = "\0"' is the same as `RS = ""'. +(d.c.) - The best way to treat a whole file as a single record is to simply -read the file in, one record at a time, concatenating each record onto -the end of the previous ones. +The best way to treat a whole file as a single record is to simply read +the file in, one record at a time, concatenating each record onto the +end of the previous ones. - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) At least that we know about. +(1) At least that we know about.  File: gawk.info, Node: Fields, Next: Nonconstant Fields, Prev: Records, Up: Reading Files -Examining Fields -================ +3.2 Examining Fields +==================== - When `awk' reads an input record, the record is automatically -"parsed" or separated by the interpreter into chunks called "fields". -By default, fields are separated by "whitespace", like words in a line. +When `awk' reads an input record, the record is automatically "parsed" +or separated by the interpreter into chunks called "fields". By +default, fields are separated by "whitespace", like words in a line. Whitespace in `awk' means any string of one or more spaces, tabs, or newlines;(1) other characters, such as formfeed, vertical tab, etc. that are considered whitespace by other languages, are _not_ considered whitespace by `awk'. - The purpose of fields is to make it more convenient for you to refer -to these pieces of the record. You don't have to use them--you can +The purpose of fields is to make it more convenient for you to refer to +these pieces of the record. You don't have to use them--you can operate on the whole record if you want--but fields are what make simple `awk' programs so powerful. - A dollar-sign (`$') is used to refer to a field in an `awk' program, +A dollar-sign (`$') is used to refer to a field in an `awk' program, followed by the number of the field you want. Thus, `$1' refers to the first field, `$2' to the second, and so on. (Unlike the Unix shells, the field numbers are not limited to single digits. `$127' is the one @@ -2996,17 +3030,17 @@ Here the first field, or `$1', is `This', the second field, or `$2', is Because there is no space between the `e' and the `.', the period is considered part of the seventh field. - `NF' is a built-in variable whose value is the number of fields in -the current record. `awk' automatically updates the value of `NF' each +`NF' is a built-in variable whose value is the number of fields in the +current record. `awk' automatically updates the value of `NF' each time it reads a record. No matter how many fields there are, the last field in a record can be represented by `$NF'. So, `$NF' is the same as `$7', which is `example.'. If you try to reference a field beyond the last one (such as `$8' when the record has only seven fields), you get the empty string. (If used in a numeric operation, you get zero.) - The use of `$0', which looks like a reference to the "zero-th" -field, is a special case: it represents the whole input record when you -are not interested in specific fields. Here are some more examples: +The use of `$0', which looks like a reference to the "zero-th" field, is +a special case: it represents the whole input record when you are not +interested in specific fields. Here are some more examples: $ awk '$1 ~ /foo/ { print $0 }' BBS-list -| fooey 555-1234 2400/1200/300 B @@ -3019,7 +3053,7 @@ field contains the string `foo'. The operator `~' is called a "matching operator" (*note Regexp Usage::); it tests whether a string (here, the field `$1') matches a given regular expression. - By contrast, the following example looks for `foo' in _the entire +By contrast, the following example looks for `foo' in _the entire record_ and prints the first field and the last field for each matching input record: @@ -3029,22 +3063,22 @@ input record: -| macfoo A -| sabafoo C - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) In POSIX `awk', newlines are not considered whitespace for +(1) In POSIX `awk', newlines are not considered whitespace for separating fields.  File: gawk.info, Node: Nonconstant Fields, Next: Changing Fields, Prev: Fields, Up: Reading Files -Nonconstant Field Numbers -========================= +3.3 Nonconstant Field Numbers +============================= - The number of a field does not need to be a constant. Any -expression in the `awk' language can be used after a `$' to refer to a -field. The value of the expression specifies the field number. If the -value is a string, rather than a number, it is converted to a number. -Consider this example: +The number of a field does not need to be a constant. Any expression in +the `awk' language can be used after a `$' to refer to a field. The +value of the expression specifies the field number. If the value is a +string, rather than a number, it is converted to a number. Consider +this example: awk '{ print $NR }' @@ -3057,24 +3091,23 @@ another example of using expressions as field numbers: awk '{ print $(2*2) }' BBS-list - `awk' evaluates the expression `(2*2)' and uses its value as the -number of the field to print. The `*' sign represents multiplication, -so the expression `2*2' evaluates to four. The parentheses are used so -that the multiplication is done before the `$' operation; they are -necessary whenever there is a binary operator in the field-number -expression. This example, then, prints the hours of operation (the -fourth field) for every line of the file `BBS-list'. (All of the `awk' -operators are listed, in order of decreasing precedence, in *Note -Precedence::.) - - If the field number you compute is zero, you get the entire record. +`awk' evaluates the expression `(2*2)' and uses its value as the number +of the field to print. The `*' sign represents multiplication, so the +expression `2*2' evaluates to four. The parentheses are used so that +the multiplication is done before the `$' operation; they are necessary +whenever there is a binary operator in the field-number expression. +This example, then, prints the hours of operation (the fourth field) +for every line of the file `BBS-list'. (All of the `awk' operators are +listed, in order of decreasing precedence, in *Note Precedence::.) + +If the field number you compute is zero, you get the entire record. Thus, `$(2-2)' has the same value as `$0'. Negative field numbers are not allowed; trying to reference one usually terminates the program. (The POSIX standard does not define what happens when you reference a negative field number. `gawk' notices this and terminates your program. Other `awk' implementations may behave differently.) - As mentioned in *Note Fields::, `awk' stores the current record's +As mentioned in *Note Fields::, `awk' stores the current record's number of fields in the built-in variable `NF' (also *note Built-in Variables::). The expression `$NF' is not a special feature--it is the direct consequence of evaluating `NF' and using its value as a field @@ -3083,10 +3116,10 @@ number.  File: gawk.info, Node: Changing Fields, Next: Field Separators, Prev: Nonconstant Fields, Up: Reading Files -Changing the Contents of a Field -================================ +3.4 Changing the Contents of a Field +==================================== - The contents of a field, as seen by `awk', can be changed within an +The contents of a field, as seen by `awk', can be changed within an `awk' program; this changes what `awk' perceives as the current input record. (The actual input is untouched; `awk' _never_ modifies the input file.) Consider the following example and its output: @@ -3105,15 +3138,15 @@ three minus ten: `$3 - 10'. (*Note Arithmetic Ops::.) Then it prints the original and new values for field three. (Someone in the warehouse made a consistent mistake while inventorying the red boxes.) - For this to work, the text in field `$3' must make sense as a -number; the string of characters must be converted to a number for the -computer to do arithmetic on it. The number resulting from the -subtraction is converted back to a string of characters that then -becomes field three. *Note Conversion::. +For this to work, the text in field `$3' must make sense as a number; +the string of characters must be converted to a number for the computer +to do arithmetic on it. The number resulting from the subtraction is +converted back to a string of characters that then becomes field three. +*Note Conversion::. - When the value of a field is changed (as perceived by `awk'), the -text of the input record is recalculated to contain the new field where -the old one was. In other words, `$0' changes to reflect the altered +When the value of a field is changed (as perceived by `awk'), the text +of the input record is recalculated to contain the new field where the +old one was. In other words, `$0' changes to reflect the altered field. Thus, this program prints a copy of the input file, with 10 subtracted from the second field of each line: @@ -3123,8 +3156,8 @@ subtracted from the second field of each line: -| Mar 5 24 34 228 ... - It is also possible to also assign contents to fields that are out -of range. For example: +It is also possible to also assign contents to fields that are out of +range. For example: $ awk '{ $6 = ($5 + $4 + $3 + $2) > print $6 }' inventory-shipped @@ -3138,20 +3171,20 @@ We've just created `$6', whose value is the sum of fields `$2', `$3', `inventory-shipped', `$6' represents the total number of parcels shipped for a particular month. - Creating a new field changes `awk''s internal copy of the current -input record, which is the value of `$0'. Thus, if you do `print $0' -after adding a field, the record printed includes the new field, with -the appropriate number of field separators between it and the previously +Creating a new field changes `awk''s internal copy of the current input +record, which is the value of `$0'. Thus, if you do `print $0' after +adding a field, the record printed includes the new field, with the +appropriate number of field separators between it and the previously existing fields. - This recomputation affects and is affected by `NF' (the number of +This recomputation affects and is affected by `NF' (the number of fields; *note Fields::). For example, the value of `NF' is set to the number of the highest field you create. The exact format of `$0' is also affected by a feature that has not been discussed yet: the "output field separator", `OFS', used to separate the fields (*note Output Separators::). - Note, however, that merely _referencing_ an out-of-range field does +Note, however, that merely _referencing_ an out-of-range field does _not_ change the value of either `$0' or `NF'. Referencing an out-of-range field only produces an empty string. For example: @@ -3165,9 +3198,9 @@ out of range. (*Note If Statement::, for more information about `awk''s `if-else' statements. *Note Typing and Comparison::, for more information about the `!=' operator.) - It is important to note that making an assignment to an existing -field changes the value of `$0' but does not change the value of `NF', -even when you assign the empty string to a field. For example: +It is important to note that making an assignment to an existing field +changes the value of `$0' but does not change the value of `NF', even +when you assign the empty string to a field. For example: $ echo a b c d | awk '{ OFS = ":"; $2 = "" > print $0; print NF }' @@ -3187,7 +3220,7 @@ The intervening field, `$5', is created with an empty value (indicated by the second pair of adjacent colons), and `NF' is updated with the value six. - Decrementing `NF' throws away the values of the fields after the new +Decrementing `NF' throws away the values of the fields after the new value of `NF' and recomputes `$0'. (d.c.) Here is an example: $ echo a b c d e f | awk '{ print "NF =", NF; @@ -3195,10 +3228,10 @@ value of `NF' and recomputes `$0'. (d.c.) Here is an example: -| NF = 6 -| a b c - *Caution:* Some versions of `awk' don't rebuild `$0' when `NF' is +*Caution:* Some versions of `awk' don't rebuild `$0' when `NF' is decremented. Caveat emptor. - Finally, there are times when it is convenient to force `awk' to +Finally, there are times when it is convenient to force `awk' to rebuild the entire record, using the current value of the fields and `OFS'. To do this, use the seemingly innocuous assignment: @@ -3208,17 +3241,17 @@ rebuild the entire record, using the current value of the fields and This forces `awk' rebuild the record. It does help to add a comment, as we've shown here. - There is a flip side to the relationship between `$0' and the -fields. Any assignment to `$0' causes the record to be reparsed into -fields using the _current_ value of `FS'. This also applies to any -built-in function that updates `$0', such as `sub' and `gsub' (*note -String Functions::). +There is a flip side to the relationship between `$0' and the fields. +Any assignment to `$0' causes the record to be reparsed into fields +using the _current_ value of `FS'. This also applies to any built-in +function that updates `$0', such as `sub' and `gsub' (*note String +Functions::).  File: gawk.info, Node: Field Separators, Next: Constant Size, Prev: Changing Fields, Up: Reading Files -Specifying How Fields Are Separated -=================================== +3.5 Specifying How Fields Are Separated +======================================= * Menu: @@ -3227,27 +3260,26 @@ Specifying How Fields Are Separated * Command Line Field Separator:: Setting `FS' from the command-line. * Field Splitting Summary:: Some final points and a summary table. - The "field separator", which is either a single character or a -regular expression, controls the way `awk' splits an input record into -fields. `awk' scans the input record for character sequences that -match the separator; the fields themselves are the text between the -matches. +The "field separator", which is either a single character or a regular +expression, controls the way `awk' splits an input record into fields. +`awk' scans the input record for character sequences that match the +separator; the fields themselves are the text between the matches. - In the examples that follow, we use the bullet symbol (*) to -represent spaces in the output. If the field separator is `oo', then -the following line: +In the examples that follow, we use the bullet symbol (*) to represent +spaces in the output. If the field separator is `oo', then the +following line: moo goo gai pan is split into three fields: `m', `*g', and `*gai*pan'. Note the leading spaces in the values of the second and third fields. - The field separator is represented by the built-in variable `FS'. +The field separator is represented by the built-in variable `FS'. Shell programmers take note: `awk' does _not_ use the name `IFS' that is used by the POSIX-compliant shells (such as the Unix Bourne shell, `sh', or `bash'). - The value of `FS' can be changed in the `awk' program with the +The value of `FS' can be changed in the `awk' program with the assignment operator, `=' (*note Assignment Ops::). Often the right time to do this is at the beginning of execution before any input has been processed, so that the very first record is read with the proper @@ -3263,7 +3295,7 @@ Given the input line: this `awk' program extracts and prints the string `*29*Oak*St.'. - Sometimes the input data contains separator characters that don't +Sometimes the input data contains separator characters that don't separate fields the way you thought they would. For instance, the person's name in the example we just used might have a title or suffix attached, such as: @@ -3277,7 +3309,7 @@ characters carefully to prevent such problems. (If the data is not in a form that is easy to process, perhaps you can massage it first with a separate `awk' program.) - Fields are normally separated by whitespace sequences (spaces, tabs, +Fields are normally separated by whitespace sequences (spaces, tabs, and newlines), not by single spaces. Two spaces in a row do not delimit an empty field. The default value of the field separator `FS' is a string containing a single space, `" "'. If `awk' interpreted @@ -3287,7 +3319,7 @@ The reason this does not happen is that a single space as the value of `FS' is a special case--it is taken to specify the default manner of delimiting fields. - If `FS' is any other single character, such as `","', then each +If `FS' is any other single character, such as `","', then each occurrence of that character separates two fields. Two consecutive occurrences delimit an empty field. If the character occurs at the beginning or the end of the line, that too delimits an empty field. The @@ -3297,10 +3329,10 @@ rules.  File: gawk.info, Node: Regexp Field Splitting, Next: Single Character Fields, Up: Field Separators -Using Regular Expressions to Separate Fields --------------------------------------------- +3.5.1 Using Regular Expressions to Separate Fields +-------------------------------------------------- - The previous node discussed the use of single characters or simple +The previous node discussed the use of single characters or simple strings as the value of `FS'. More generally, the value of `FS' may be a string containing any regular expression. In this case, each match in the record for the regular expression separates fields. For @@ -3313,19 +3345,18 @@ space and a TAB into a field separator. (`\t' is an "escape sequence" that stands for a TAB; *note Escape Sequences::, for the complete list of similar escape sequences.) - For a less trivial example of a regular expression, try using single +For a less trivial example of a regular expression, try using single spaces to separate fields the way single commas are used. `FS' can be set to `"[ ]"' (left bracket, space, right bracket). This regular expression matches a single space and nothing else (*note Regexp::). - There is an important difference between the two cases of `FS = " "' -(a single space) and `FS = "[ \t\n]+"' (a regular expression matching -one or more spaces, tabs, or newlines). For both values of `FS', -fields are separated by "runs" (multiple adjacent occurrences) of -spaces, tabs, and/or newlines. However, when the value of `FS' is -`" "', `awk' first strips leading and trailing whitespace from the -record and then decides where the fields are. For example, the -following pipeline prints `b': +There is an important difference between the two cases of `FS = " "' (a +single space) and `FS = "[ \t\n]+"' (a regular expression matching one +or more spaces, tabs, or newlines). For both values of `FS', fields +are separated by "runs" (multiple adjacent occurrences) of spaces, tabs, +and/or newlines. However, when the value of `FS' is `" "', `awk' first +strips leading and trailing whitespace from the record and then decides +where the fields are. For example, the following pipeline prints `b': $ echo ' a b c d ' | awk '{ print $2 }' -| b @@ -3339,8 +3370,8 @@ letter): In this case, the first field is "null" or empty. - The stripping of leading and trailing whitespace also comes into -play whenever `$0' is recomputed. For instance, study this pipeline: +The stripping of leading and trailing whitespace also comes into play +whenever `$0' is recomputed. For instance, study this pipeline: $ echo ' a b c d' | awk '{ print; $2 = $2; print }' -| a b c d @@ -3356,13 +3387,13 @@ prints the new `$0'.  File: gawk.info, Node: Single Character Fields, Next: Command Line Field Separator, Prev: Regexp Field Splitting, Up: Field Separators -Making Each Character a Separate Field --------------------------------------- +3.5.2 Making Each Character a Separate Field +-------------------------------------------- - There are times when you may want to examine each character of a -record separately. This can be done in `gawk' by simply assigning the -null string (`""') to `FS'. In this case, each individual character in -the record becomes a separate field. For example: +There are times when you may want to examine each character of a record +separately. This can be done in `gawk' by simply assigning the null +string (`""') to `FS'. In this case, each individual character in the +record becomes a separate field. For example: $ echo a b | gawk 'BEGIN { FS = "" } > { @@ -3373,8 +3404,8 @@ the record becomes a separate field. For example: -| Field 2 is -| Field 3 is b - Traditionally, the behavior of `FS' equal to `""' was not defined. -In this case, most versions of Unix `awk' simply treat the entire record +Traditionally, the behavior of `FS' equal to `""' was not defined. In +this case, most versions of Unix `awk' simply treat the entire record as only having one field. (d.c.) In compatibility mode (*note Options::), if `FS' is the null string, then `gawk' also behaves this way. @@ -3382,10 +3413,10 @@ way.  File: gawk.info, Node: Command Line Field Separator, Next: Field Splitting Summary, Prev: Single Character Fields, Up: Field Separators -Setting `FS' from the Command Line ----------------------------------- +3.5.3 Setting `FS' from the Command Line +---------------------------------------- - `FS' can be set on the command line. Use the `-F' option to do so. +`FS' can be set on the command line. Use the `-F' option to do so. For example: awk -F, 'PROGRAM' INPUT-FILES @@ -3397,7 +3428,7 @@ command-line options: the `-F' and `-f' options have nothing to do with each other. You can use both options at the same time to set the `FS' variable _and_ get an `awk' program from a file. - The value used for the argument to `-F' is processed in exactly the +The value used for the argument to `-F' is processed in exactly the same way as assignments to the built-in variable `FS'. Any special characters in the field separator must be escaped appropriately. For example, to use a `\' as the field separator on the command line, you @@ -3411,22 +3442,22 @@ Because `\' is used for quoting in the shell, `awk' sees `-F\\'. Then Sequences::), finally yielding a single `\' to use for the field separator. - As a special case, in compatibility mode (*note Options::), if the +As a special case, in compatibility mode (*note Options::), if the argument to `-F' is `t', then `FS' is set to the TAB character. If you type `-F\t' at the shell, without any quotes, the `\' gets deleted, so `awk' figures that you really want your fields to be separated with tabs and not `t's. Use `-v FS="t"' or `-F"[t]"' on the command line if you really do want to separate your fields with `t's. - For example, let's use an `awk' program file called `baud.awk' that +For example, let's use an `awk' program file called `baud.awk' that contains the pattern `/300/' and the action `print $1': /300/ { print $1 } - Let's also set `FS' to be the `-' character and run the program on -the file `BBS-list'. The following command prints a list of the names -of the bulletin boards that operate at 300 baud and the first three -digits of their phone numbers: +Let's also set `FS' to be the `-' character and run the program on the +file `BBS-list'. The following command prints a list of the names of +the bulletin boards that operate at 300 baud and the first three digits +of their phone numbers: $ awk -F- -f baud.awk BBS-list -| aardvark 555 @@ -3446,12 +3477,12 @@ looked like this: alpo-net 555-3412 2400/1200/300 A - The `-' as part of the system's name was used as the field -separator, instead of the `-' in the phone number that was originally -intended. This demonstrates why you have to be careful in choosing -your field and record separators. +The `-' as part of the system's name was used as the field separator, +instead of the `-' in the phone number that was originally intended. +This demonstrates why you have to be careful in choosing your field and +record separators. - Perhaps the most common use of a single character as the field +Perhaps the most common use of a single character as the field separator occurs when processing the Unix system password file. On many Unix systems, each user has a separate entry in the system password file, one line per user. The information in these lines is separated @@ -3461,19 +3492,19 @@ look like this: arnold:xyzzy:2076:10:Arnold Robbins:/home/arnold:/bin/bash - The following program searches the system password file and prints -the entries for users who have no password: +The following program searches the system password file and prints the +entries for users who have no password: awk -F: '$2 == ""' /etc/passwd  File: gawk.info, Node: Field Splitting Summary, Prev: Command Line Field Separator, Up: Field Separators -Field-Splitting Summary ------------------------ +3.5.4 Field-Splitting Summary +----------------------------- - It is important to remember that when you assign a string constant -as the value of `FS', it undergoes normal `awk' string processing. For +It is important to remember that when you assign a string constant as +the value of `FS', it undergoes normal `awk' string processing. For example, with Unix `awk' and `gawk', the assignment `FS = "\.."' assigns the character string `".."' to `FS' (the backslash is stripped). This creates a regexp meaning "fields are separated by @@ -3481,8 +3512,8 @@ occurrences of any two characters." If instead you want fields to be separated by a literal period followed by any single character, use `FS = "\\.."'. - The following table summarizes how fields are split, based on the -value of `FS' (`==' means "is equal to"): +The following table summarizes how fields are split, based on the value +of `FS' (`==' means "is equal to"): `FS == " "' Fields are separated by runs of whitespace. Leading and trailing @@ -3507,18 +3538,18 @@ value of `FS' (`==' means "is equal to"): Advanced Notes: Changing `FS' Does Not Affect the Fields -------------------------------------------------------- - According to the POSIX standard, `awk' is supposed to behave as if -each record is split into fields at the time it is read. In -particular, this means that if you change the value of `FS' after a -record is read, the value of the fields (i.e., how they were split) -should reflect the old value of `FS', not the new one. +According to the POSIX standard, `awk' is supposed to behave as if each +record is split into fields at the time it is read. In particular, +this means that if you change the value of `FS' after a record is read, +the value of the fields (i.e., how they were split) should reflect the +old value of `FS', not the new one. - However, many implementations of `awk' do not work this way. -Instead, they defer splitting the fields until a field is actually -referenced. The fields are split using the _current_ value of `FS'! -(d.c.) This behavior can be difficult to diagnose. The following -example illustrates the difference between the two methods. (The -`sed'(1) command prints just the first line of `/etc/passwd'.) +However, many implementations of `awk' do not work this way. Instead, +they defer splitting the fields until a field is actually referenced. +The fields are split using the _current_ value of `FS'! (d.c.) This +behavior can be difficult to diagnose. The following example +illustrates the difference between the two methods. (The `sed'(1) +command prints just the first line of `/etc/passwd'.) sed 1q /etc/passwd | awk '{ FS = ":" ; print $1 }' @@ -3534,7 +3565,7 @@ like: Advanced Notes: `FS' and `IGNORECASE' ------------------------------------- - The `IGNORECASE' variable (*note User-modified::) affects field +The `IGNORECASE' variable (*note User-modified::) affects field splitting _only_ when the value of `FS' is a regexp. It has no effect when `FS' is a single character, even if that character is a letter. Thus, in the following code: @@ -3549,42 +3580,41 @@ alphabetic character while ignoring case, use a regexp that will do it for you. E.g., `FS = "[c]"'. In this case, `IGNORECASE' will take effect. - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) The `sed' utility is a "stream editor." Its behavior is also +(1) The `sed' utility is a "stream editor." Its behavior is also defined by the POSIX standard.  File: gawk.info, Node: Constant Size, Next: Multiple Line, Prev: Field Separators, Up: Reading Files -Reading Fixed-Width Data -======================== +3.6 Reading Fixed-Width Data +============================ - (This minor node discusses an advanced feature of `awk'. If you are -a novice `awk' user, you might want to skip it on the first reading.) +(This minor node discusses an advanced feature of `awk'. If you are a +novice `awk' user, you might want to skip it on the first reading.) - `gawk' version 2.13 introduced a facility for dealing with -fixed-width fields with no distinctive field separator. For example, -data of this nature arises in the input for old Fortran programs where -numbers are run together, or in the output of programs that did not -anticipate the use of their output as input for other programs. +`gawk' version 2.13 introduced a facility for dealing with fixed-width +fields with no distinctive field separator. For example, data of this +nature arises in the input for old Fortran programs where numbers are +run together, or in the output of programs that did not anticipate the +use of their output as input for other programs. - An example of the latter is a table where all the columns are lined -up by the use of a variable number of spaces and _empty fields are just +An example of the latter is a table where all the columns are lined up +by the use of a variable number of spaces and _empty fields are just spaces_. Clearly, `awk''s normal field splitting based on `FS' does not work well in this case. Although a portable `awk' program can use a series of `substr' calls on `$0' (*note String Functions::), this is awkward and inefficient for a large number of fields. - The splitting of an input record into fixed-width fields is -specified by assigning a string containing space-separated numbers to -the built-in variable `FIELDWIDTHS'. Each number specifies the width -of the field, _including_ columns between fields. If you want to -ignore the columns between fields, you can specify the width as a -separate field that is subsequently ignored. It is a fatal error to -supply a field width that is not a positive number. The following data -is the output of the Unix `w' utility. It is useful to illustrate the -use of `FIELDWIDTHS': +The splitting of an input record into fixed-width fields is specified by +assigning a string containing space-separated numbers to the built-in +variable `FIELDWIDTHS'. Each number specifies the width of the field, +_including_ columns between fields. If you want to ignore the columns +between fields, you can specify the width as a separate field that is +subsequently ignored. It is a fatal error to supply a field width that +is not a positive number. The following data is the output of the Unix +`w' utility. It is useful to illustrate the use of `FIELDWIDTHS': 10:06pm up 21 days, 14:04, 23 users User tty login idle JCPU PCPU what @@ -3597,12 +3627,12 @@ use of `FIELDWIDTHS': brent ttyp0 26Jun91 4:46 26:46 4:41 bash dave ttyq4 26Jun9115days 46 46 wnewmail - The following program takes the above input, converts the idle time -to number of seconds, and prints out the first two fields and the +The following program takes the above input, converts the idle time to +number of seconds, and prints out the first two fields and the calculated idle time: - *Note:* This program uses a number of `awk' features that haven't -been introduced yet. + NOTE: This program uses a number of `awk' features that haven't + been introduced yet. BEGIN { FIELDWIDTHS = "9 6 10 6 7 7 35" } NR > 2 { @@ -3616,11 +3646,11 @@ been introduced yet. } if (idle ~ /days/) idle *= 24 * 60 * 60 - + print $1, $2, idle } - Running the program on the data produces the following results: +Running the program on the data produces the following results: hzuo ttyV0 0 hzang ttyV3 50 @@ -3631,21 +3661,21 @@ been introduced yet. brent ttyp0 286 dave ttyq4 1296000 - Another (possibly more practical) example of fixed-width input data -is the input from a deck of balloting cards. In some parts of the -United States, voters mark their choices by punching holes in computer -cards. These cards are then processed to count the votes for any -particular candidate or on any particular issue. Because a voter may -choose not to vote on some issue, any column on the card may be empty. -An `awk' program for processing such data could use the `FIELDWIDTHS' -feature to simplify reading the data. (Of course, getting `gawk' to -run on a system with card readers is another story!) - - Assigning a value to `FS' causes `gawk' to use `FS' for field -splitting again. Use `FS = FS' to make this happen, without having to -know the current value of `FS'. In order to tell which kind of field -splitting is in effect, use `PROCINFO["FS"]' (*note Auto-set::). The -value is `"FS"' if regular field splitting is being used, or it is +Another (possibly more practical) example of fixed-width input data is +the input from a deck of balloting cards. In some parts of the United +States, voters mark their choices by punching holes in computer cards. +These cards are then processed to count the votes for any particular +candidate or on any particular issue. Because a voter may choose not to +vote on some issue, any column on the card may be empty. An `awk' +program for processing such data could use the `FIELDWIDTHS' feature to +simplify reading the data. (Of course, getting `gawk' to run on a +system with card readers is another story!) + +Assigning a value to `FS' causes `gawk' to use `FS' for field splitting +again. Use `FS = FS' to make this happen, without having to know the +current value of `FS'. In order to tell which kind of field splitting +is in effect, use `PROCINFO["FS"]' (*note Auto-set::). The value is +`"FS"' if regular field splitting is being used, or it is `"FIELDWIDTHS"' if fixed-width field splitting is being used: if (PROCINFO["FS"] == "FS") @@ -3653,7 +3683,7 @@ value is `"FS"' if regular field splitting is being used, or it is else FIXED-WIDTH FIELD SPLITTING ... - This information is useful when writing a function that needs to +This information is useful when writing a function that needs to temporarily change `FS' or `FIELDWIDTHS', read some records, and then restore the original settings (*note Passwd Functions::, for an example of such a function). @@ -3661,30 +3691,30 @@ of such a function).  File: gawk.info, Node: Multiple Line, Next: Getline, Prev: Constant Size, Up: Reading Files -Multiple-Line Records -===================== +3.7 Multiple-Line Records +========================= - In some databases, a single line cannot conveniently hold all the +In some databases, a single line cannot conveniently hold all the information in one entry. In such cases, you can use multiline records. The first step in doing this is to choose your data format. - One technique is to use an unusual character or string to separate +One technique is to use an unusual character or string to separate records. For example, you could use the formfeed character (written `\f' in `awk', as in C) to separate them, making each record a page of the file. To do this, just set the variable `RS' to `"\f"' (a string containing the formfeed character). Any other character could equally well be used, as long as it won't be part of the data in a record. - Another technique is to have blank lines separate records. By a -special dispensation, an empty string as the value of `RS' indicates -that records are separated by one or more blank lines. When `RS' is set -to the empty string, each record always ends at the first blank line +Another technique is to have blank lines separate records. By a special +dispensation, an empty string as the value of `RS' indicates that +records are separated by one or more blank lines. When `RS' is set to +the empty string, each record always ends at the first blank line encountered. The next record doesn't start until the first nonblank line that follows. No matter how many blank lines appear in a row, they all act as one record separator. (Blank lines must be completely empty; lines that contain only whitespace do not count.) - You can achieve the same effect as `RS = ""' by assigning the string +You can achieve the same effect as `RS = ""' by assigning the string `"\n\n+"' to `RS'. This regexp matches the newline at the end of the record and one or more blank lines after the record. In addition, a regular expression always matches the longest possible sequence when @@ -3693,13 +3723,13 @@ doesn't start until the first nonblank line that follows--no matter how many blank lines appear in a row, they are considered one record separator. - There is an important difference between `RS = ""' and `RS = -"\n\n+"'. In the first case, leading newlines in the input data file -are ignored, and if a file ends without extra blank lines after the -last record, the final newline is removed from the record. In the -second case, this special processing is not done. (d.c.) +There is an important difference between `RS = ""' and `RS = "\n\n+"'. +In the first case, leading newlines in the input data file are ignored, +and if a file ends without extra blank lines after the last record, the +final newline is removed from the record. In the second case, this +special processing is not done. (d.c.) - Now that the input is separated into records, the second step is to +Now that the input is separated into records, the second step is to separate the fields in the record. One way to do this is to divide each of the lines into fields in the normal manner. This happens by default as the result of a special feature. When `RS' is set to the empty @@ -3707,7 +3737,7 @@ string, _and_ `FS' is a set to a single character, the newline character _always_ acts as a field separator. This is in addition to whatever field separations result from `FS'.(1) - The original motivation for this special exception was probably to +The original motivation for this special exception was probably to provide useful behavior in the default case (i.e., `FS' is equal to `" "'). This feature can be a problem if you really don't want the newline character to separate fields, because there is no way to @@ -3718,17 +3748,17 @@ special feature in a different way, by making `FS' into a regexp for that single character. For example, if the field separator is a percent character, instead of `FS = "%"', use `FS = "[%]"'. - Another way to separate fields is to put each field on a separate -line: to do this, just set the variable `FS' to the string `"\n"'. -(This single character seperator matches a single newline.) A -practical example of a data file organized this way might be a mailing -list, where each entry is separated by blank lines. Consider a mailing -list in a file named `addresses', which looks like this: +Another way to separate fields is to put each field on a separate line: +to do this, just set the variable `FS' to the string `"\n"'. (This +single character seperator matches a single newline.) A practical +example of a data file organized this way might be a mailing list, +where each entry is separated by blank lines. Consider a mailing list +in a file named `addresses', which looks like this: Jane Doe 123 Main Street Anywhere, SE 12345-6789 - + John Smith 456 Tree-lined Avenue Smallville, MW 98765-4321 @@ -3737,11 +3767,11 @@ list in a file named `addresses', which looks like this: A simple program to process this file is as follows: # addrs.awk --- simple mailing list program - + # Records are separated by blank lines. # Each line is one field. BEGIN { RS = "" ; FS = "\n" } - + { print "Name is:", $1 print "Address is:", $2 @@ -3749,7 +3779,7 @@ A simple program to process this file is as follows: print "" } - Running the program produces the following output: +Running the program produces the following output: $ awk -f addrs.awk addresses -| Name is: Jane Doe @@ -3762,7 +3792,7 @@ A simple program to process this file is as follows: -| ... - *Note Labels Program::, for a more realistic program that deals with +*Note Labels Program::, for a more realistic program that deals with address lists. The following table summarizes how records are split, based on the value of `RS'. (`==' means "is equal to.") @@ -3787,41 +3817,41 @@ based on the value of `RS'. (`==' means "is equal to.") records. (This is a `gawk' extension; it is not specified by the POSIX standard.) - In all cases, `gawk' sets `RT' to the input text that matched the -value specified by `RS'. +In all cases, `gawk' sets `RT' to the input text that matched the value +specified by `RS'. - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) When `FS' is the null string (`""') or a regexp, this special +(1) When `FS' is the null string (`""') or a regexp, this special feature of `RS' does not apply. It does apply to the default field separator of a single space: `FS = " "'.  File: gawk.info, Node: Getline, Prev: Multiple Line, Up: Reading Files -Explicit Input with `getline' -============================= +3.8 Explicit Input with `getline' +================================= - So far we have been getting our input data from `awk''s main input +So far we have been getting our input data from `awk''s main input stream--either the standard input (usually your terminal, sometimes the output from another program) or from the files specified on the command line. The `awk' language has a special built-in command called `getline' that can be used to read input under your explicit control. - The `getline' command is used in several different ways and should +The `getline' command is used in several different ways and should _not_ be used by beginners. The examples that follow the explanation of the `getline' command include material that has not been covered yet. Therefore, come back and study the `getline' command _after_ you have reviewed the rest of this Info file and have a good knowledge of how `awk' works. - The `getline' command returns one if it finds a record and zero if -it encounters the end of the file. If there is some error in getting a +The `getline' command returns one if it finds a record and zero if it +encounters the end of the file. If there is some error in getting a record, such as a file that cannot be opened, then `getline' returns -1. In this case, `gawk' sets the variable `ERRNO' to a string describing the error that occurred. - In the following examples, COMMAND stands for a string value that +In the following examples, COMMAND stands for a string value that represents a shell command. * Menu: @@ -3843,11 +3873,11 @@ represents a shell command.  File: gawk.info, Node: Plain Getline, Next: Getline/Variable, Up: Getline -Using `getline' with No Arguments ---------------------------------- +3.8.1 Using `getline' with No Arguments +--------------------------------------- - The `getline' command can be used without arguments to read input -from the current input file. All it does in this case is read the next +The `getline' command can be used without arguments to read input from +the current input file. All it does in this case is read the next input record and split it up into fields. This is useful if you've finished processing the current record, but want to do some special processing on the next record _right now_. For example: @@ -3874,29 +3904,30 @@ processing on the next record _right now_. For example: print $0 } - This `awk' program deletes all C-style comments (`/* ... */') from -the input. By replacing the `print $0' with other statements, you -could perform more complicated processing on the decommented input, -such as searching for matches of a regular expression. (This program -has a subtle problem--it does not work if one comment ends and another -begins on the same line.) +This `awk' program deletes all C-style comments (`/* ... */') from the +input. By replacing the `print $0' with other statements, you could +perform more complicated processing on the decommented input, such as +searching for matches of a regular expression. (This program has a +subtle problem--it does not work if one comment ends and another begins +on the same line.) - This form of the `getline' command sets `NF', `NR', `FNR', and the +This form of the `getline' command sets `NF', `NR', `FNR', and the value of `$0'. - *Note:* The new value of `$0' is used to test the patterns of any -subsequent rules. The original value of `$0' that triggered the rule -that executed `getline' is lost. By contrast, the `next' statement -reads a new record but immediately begins processing it normally, -starting with the first rule in the program. *Note Next Statement::. + NOTE: The new value of `$0' is used to test the patterns of any + subsequent rules. The original value of `$0' that triggered the + rule that executed `getline' is lost. By contrast, the `next' + statement reads a new record but immediately begins processing it + normally, starting with the first rule in the program. *Note Next + Statement::.  File: gawk.info, Node: Getline/Variable, Next: Getline/File, Prev: Plain Getline, Up: Getline -Using `getline' into a Variable -------------------------------- +3.8.2 Using `getline' into a Variable +------------------------------------- - You can use `getline VAR' to read the next record from `awk''s input +You can use `getline VAR' to read the next record from `awk''s input into the variable VAR. No other processing is done. For example, suppose the next line is a comment or a special string, and you want to read it without triggering any rules. This form of `getline' allows @@ -3926,20 +3957,20 @@ and produces these results: phore free - The `getline' command used in this way sets only the variables `NR' -and `FNR' (and of course, VAR). The record is not split into fields, -so the values of the fields (including `$0') and the value of `NF' do -not change. +The `getline' command used in this way sets only the variables `NR' and +`FNR' (and of course, VAR). The record is not split into fields, so +the values of the fields (including `$0') and the value of `NF' do not +change.  File: gawk.info, Node: Getline/File, Next: Getline/Variable/File, Prev: Getline/Variable, Up: Getline -Using `getline' from a File ---------------------------- +3.8.3 Using `getline' from a File +--------------------------------- - Use `getline < FILE' to read the next record from FILE. Here FILE -is a string-valued expression that specifies the file name. `< FILE' -is called a "redirection" because it directs input to come from a +Use `getline < FILE' to read the next record from FILE. Here FILE is a +string-valued expression that specifies the file name. `< FILE' is +called a "redirection" because it directs input to come from a different place. For example, the following program reads its input record from the file `secondary.input' when it encounters a first field with a value equal to 10 in the current input file: @@ -3952,29 +3983,29 @@ with a value equal to 10 in the current input file: print } - Because the main input stream is not used, the values of `NR' and -`FNR' are not changed. However, the record it reads is split into -fields in the normal manner, so the values of `$0' and the other fields -are changed, resulting in a new value of `NF'. +Because the main input stream is not used, the values of `NR' and `FNR' +are not changed. However, the record it reads is split into fields in +the normal manner, so the values of `$0' and the other fields are +changed, resulting in a new value of `NF'. - According to POSIX, `getline < EXPRESSION' is ambiguous if -EXPRESSION contains unparenthesized operators other than `$'; for -example, `getline < dir "/" file' is ambiguous because the -concatenation operator is not parenthesized. You should write it as -`getline < (dir "/" file)' if you want your program to be portable to -other `awk' implementations. +According to POSIX, `getline < EXPRESSION' is ambiguous if EXPRESSION +contains unparenthesized operators other than `$'; for example, +`getline < dir "/" file' is ambiguous because the concatenation +operator is not parenthesized. You should write it as `getline < (dir +"/" file)' if you want your program to be portable to other `awk' +implementations.  File: gawk.info, Node: Getline/Variable/File, Next: Getline/Pipe, Prev: Getline/File, Up: Getline -Using `getline' into a Variable from a File -------------------------------------------- +3.8.4 Using `getline' into a Variable from a File +------------------------------------------------- - Use `getline VAR < FILE' to read input from the file FILE, and put -it in the variable VAR. As above, FILE is a string-valued expression -that specifies the file from which to read. +Use `getline VAR < FILE' to read input from the file FILE, and put it +in the variable VAR. As above, FILE is a string-valued expression that +specifies the file from which to read. - In this version of `getline', none of the built-in variables are +In this version of `getline', none of the built-in variables are changed and the record is not split into fields. The only variable changed is VAR. For example, the following program copies all the input files to the output, except for records that say @@ -3990,15 +4021,15 @@ file FILENAME: print } - Note here how the name of the extra input file is not built into the +Note here how the name of the extra input file is not built into the program; it is taken directly from the data, specifically from the second field on the `@include' line. - The `close' function is called to ensure that if two identical +The `close' function is called to ensure that if two identical `@include' lines appear in the input, the entire specified file is included twice. *Note Close Files And Pipes::. - One deficiency of this program is that it does not process nested +One deficiency of this program is that it does not process nested `@include' statements (i.e., `@include' statements in included files) the way a true macro preprocessor would. *Note Igawk Program::, for a program that does handle nested `@include' statements. @@ -4006,10 +4037,10 @@ program that does handle nested `@include' statements.  File: gawk.info, Node: Getline/Pipe, Next: Getline/Variable/Pipe, Prev: Getline/Variable/File, Up: Getline -Using `getline' from a Pipe ---------------------------- +3.8.5 Using `getline' from a Pipe +--------------------------------- - The output of a command can also be piped into `getline', using +The output of a command can also be piped into `getline', using `COMMAND | getline'. In this case, the string COMMAND is run as a shell command and its output is piped into `awk' to be used as input. This form of `getline' reads one record at a time from the pipe. For @@ -4051,24 +4082,24 @@ Notice that this program ran the command `who' and printed the previous result. (If you try this program yourself, you will of course get different results, depending upon who is logged in on your system.) - This variation of `getline' splits the record into fields, sets the +This variation of `getline' splits the record into fields, sets the value of `NF', and recomputes the value of `$0'. The values of `NR' and `FNR' are not changed. - According to POSIX, `EXPRESSION | getline' is ambiguous if -EXPRESSION contains unparenthesized operators other than `$'--for -example, `"echo " "date" | getline' is ambiguous because the -concatenation operator is not parenthesized. You should write it as -`("echo " "date") | getline' if you want your program to be portable to -other `awk' implementations. +According to POSIX, `EXPRESSION | getline' is ambiguous if EXPRESSION +contains unparenthesized operators other than `$'--for example, +`"echo " "date" | getline' is ambiguous because the concatenation +operator is not parenthesized. You should write it as `("echo " +"date") | getline' if you want your program to be portable to other +`awk' implementations.  File: gawk.info, Node: Getline/Variable/Pipe, Next: Getline/Coprocess, Prev: Getline/Pipe, Up: Getline -Using `getline' into a Variable from a Pipe -------------------------------------------- +3.8.6 Using `getline' into a Variable from a Pipe +------------------------------------------------- - When you use `COMMAND | getline VAR', the output of COMMAND is sent +When you use `COMMAND | getline VAR', the output of COMMAND is sent through a pipe to `getline' and into the variable VAR. For example, the following program reads the current date and time into the variable `current_time', using the `date' utility, and then prints it: @@ -4079,10 +4110,10 @@ following program reads the current date and time into the variable print "Report printed on " current_time } - In this version of `getline', none of the built-in variables are +In this version of `getline', none of the built-in variables are changed and the record is not split into fields. - According to POSIX, `EXPRESSION | getline VAR' is ambiguous if +According to POSIX, `EXPRESSION | getline VAR' is ambiguous if EXPRESSION contains unparenthesized operators other than `$'; for example, `"echo " "date" | getline VAR' is ambiguous because the concatenation operator is not parenthesized. You should write it as @@ -4092,14 +4123,14 @@ portable to other `awk' implementations.  File: gawk.info, Node: Getline/Coprocess, Next: Getline/Variable/Coprocess, Prev: Getline/Variable/Pipe, Up: Getline -Using `getline' from a Coprocess --------------------------------- +3.8.7 Using `getline' from a Coprocess +-------------------------------------- - Input into `getline' from a pipe is a one-way operation. The -command that is started with `COMMAND | getline' only sends data _to_ -your `awk' program. +Input into `getline' from a pipe is a one-way operation. The command +that is started with `COMMAND | getline' only sends data _to_ your +`awk' program. - On occasion, you might want to send data to another program for +On occasion, you might want to send data to another program for processing and then read the results back. `gawk' allows you start a "coprocess", with which two-way communications are possible. This is done with the `|&' operator. Typically, you write data to the @@ -4110,41 +4141,41 @@ coprocess first and then read results back, as shown in the following: which sends a query to `db_server' and then reads the results. - The values of `NR' and `FNR' are not changed, because the main input +The values of `NR' and `FNR' are not changed, because the main input stream is not used. However, the record is split into fields in the normal manner, thus changing the values of `$0', of the other fields, and of `NF'. - Coprocesses are an advanced feature. They are discussed here only +Coprocesses are an advanced feature. They are discussed here only because this is the minor node on `getline'. *Note Two-way I/O::, where coprocesses are discussed in more detail.  File: gawk.info, Node: Getline/Variable/Coprocess, Next: Getline Notes, Prev: Getline/Coprocess, Up: Getline -Using `getline' into a Variable from a Coprocess ------------------------------------------------- +3.8.8 Using `getline' into a Variable from a Coprocess +------------------------------------------------------ - When you use `COMMAND |& getline VAR', the output from the coprocess +When you use `COMMAND |& getline VAR', the output from the coprocess COMMAND is sent through a two-way pipe to `getline' and into the variable VAR. - In this version of `getline', none of the built-in variables are +In this version of `getline', none of the built-in variables are changed and the record is not split into fields. The only variable changed is VAR. - Coprocesses are an advanced feature. They are discussed here only +Coprocesses are an advanced feature. They are discussed here only because this is the minor node on `getline'. *Note Two-way I/O::, where coprocesses are discussed in more detail.  File: gawk.info, Node: Getline Notes, Next: Getline Summary, Prev: Getline/Variable/Coprocess, Up: Getline -Points to Remember About `getline' ----------------------------------- +3.8.9 Points to Remember About `getline' +---------------------------------------- - Here are some miscellaneous points about `getline' that you should -bear in mind: +Here are some miscellaneous points about `getline' that you should bear +in mind: * When `getline' changes the value of `$0' and `NF', `awk' does _not_ automatically jump to the start of the program and start @@ -4174,29 +4205,40 @@ bear in mind:  File: gawk.info, Node: Getline Summary, Prev: Getline Notes, Up: Getline -Summary of `getline' Variants ------------------------------ +3.8.10 Summary of `getline' Variants +------------------------------------ - The following table summarizes the eight variants of `getline', -listing which built-in variables are set by each one. +*Note table-getline-variants:: summarizes the eight variants of +`getline', listing which built-in variables are set by each one. + +Variant Effect +-------------------------------------------------------------------------- +`getline' Sets `$0', `NF', `FNR', and `NR' +-------------------------------------------------------------------------- +`getline' VAR Sets VAR, `FNR', and `NR' +-------------------------------------------------------------------------- +`getline <' FILE Sets `$0' and `NF' +-------------------------------------------------------------------------- +`getline VAR < FILE' Sets VAR +-------------------------------------------------------------------------- +COMMAND `| getline' Sets `$0' and `NF' +-------------------------------------------------------------------------- +COMMAND `| getline' VAR Sets VAR +-------------------------------------------------------------------------- +COMMAND `|& getline' Sets `$0' and `NF'. This is a `gawk' extension +-------------------------------------------------------------------------- +COMMAND `|& getline' VAR Sets VAR. This is a `gawk' extension +-------------------------------------------------------------------------- -`getline' Sets `$0', `NF', `FNR', and `NR' -`getline' VAR Sets VAR, `FNR', and `NR' -`getline <' FILE Sets `$0' and `NF' -`getline VAR < FILE' Sets VAR -COMMAND `| getline' Sets `$0' and `NF' -COMMAND `| getline' VAR Sets VAR -COMMAND `|& getline' Sets `$0' and `NF'. This is a `gawk' - extension -COMMAND `|& getline' VAR Sets VAR. This is a `gawk' extension +Table 3.1: getline Variants and What They Set  File: gawk.info, Node: Printing, Next: Expressions, Prev: Reading Files, Up: Top -Printing Output -*************** +4 Printing Output +***************** - One of the most common programming actions is to "print", or output, +One of the most common programming actions is to "print", or output, some or all of the input. Use the `print' statement for simple output, and the `printf' statement for fancier formatting. The `print' statement is not limited when computing _which_ values to print. @@ -4228,10 +4270,10 @@ function.  File: gawk.info, Node: Print, Next: Print Examples, Up: Printing -The `print' Statement -===================== +4.1 The `print' Statement +========================= - The `print' statement is used to produce output with simple, +The `print' statement is used to produce output with simple, standardized formatting. Specify only the strings or numbers to print, in a list separated by commas. They are output, separated by single spaces, followed by a newline. The statement looks like this: @@ -4243,42 +4285,41 @@ parentheses are necessary if any of the item expressions uses the `>' relational operator; otherwise it could be confused with a redirection (*note Redirection::). - The items to print can be constant strings or numbers, fields of the +The items to print can be constant strings or numbers, fields of the current record (such as `$1'), variables, or any `awk' expression. Numeric values are converted to strings and then printed. - The simple statement `print' with no items is equivalent to `print -$0': it prints the entire current record. To print a blank line, use -`print ""', where `""' is the empty string. To print a fixed piece of -text, use a string constant, such as `"Don't Panic"', as one item. If -you forget to use the double-quote characters, your text is taken as an +The simple statement `print' with no items is equivalent to `print $0': +it prints the entire current record. To print a blank line, use `print +""', where `""' is the empty string. To print a fixed piece of text, +use a string constant, such as `"Don't Panic"', as one item. If you +forget to use the double-quote characters, your text is taken as an `awk' expression, and you will probably get an error. Keep in mind that a space is printed between any two items.  File: gawk.info, Node: Print Examples, Next: Output Separators, Prev: Print, Up: Printing -Examples of `print' Statements -============================== +4.2 Examples of `print' Statements +================================== - Each `print' statement makes at least one line of output. However, -it isn't limited to only one line. If an item value is a string that +Each `print' statement makes at least one line of output. However, it +isn't limited to only one line. If an item value is a string that contains a newline, the newline is output along with the rest of the string. A single `print' statement can make any number of lines this way. - The following is an example of printing a string that contains -embedded newlines (the `\n' is an escape sequence, used to represent -the newline character; *note Escape Sequences::): +The following is an example of printing a string that contains embedded +newlines (the `\n' is an escape sequence, used to represent the newline +character; *note Escape Sequences::): $ awk 'BEGIN { print "line one\nline two\nline three" }' -| line one -| line two -| line three - The next example, which is run on the `inventory-shipped' file, -prints the first two fields of each input record, with a space between -them: +The next example, which is run on the `inventory-shipped' file, prints +the first two fields of each input record, with a space between them: $ awk '{ print $1, $2 }' inventory-shipped -| Jan 13 @@ -4286,7 +4327,7 @@ them: -| Mar 15 ... - A common mistake in using the `print' statement is to omit the comma +A common mistake in using the `print' statement is to omit the comma between two items. This often has the effect of making the items run together in the output, with no space. The reason for this is that juxtaposing two string expressions in `awk' means to concatenate them. @@ -4298,7 +4339,7 @@ Here is the same program, without the comma: -| Mar15 ... - To someone unfamiliar with the `inventory-shipped' file, neither +To someone unfamiliar with the `inventory-shipped' file, neither example's output makes much sense. A heading line at the beginning would make it clearer. Let's add some headings to our table of months (`$1') and green crates shipped (`$2'). We do this using the `BEGIN' @@ -4325,38 +4366,39 @@ fields: print "----- ------" } { print $1, " ", $2 }' inventory-shipped - Lining up columns this way can get pretty complicated when there are +Lining up columns this way can get pretty complicated when there are many columns to fix. Counting spaces for two or three columns is simple, but any more than this can take up a lot of time. This is why the `printf' statement was created (*note Printf::); one of its specialties is lining up columns of data. - *Note:* You can continue either a `print' or `printf' statement -simply by putting a newline after any comma (*note Statements/Lines::). + NOTE: You can continue either a `print' or `printf' statement + simply by putting a newline after any comma (*note + Statements/Lines::).  File: gawk.info, Node: Output Separators, Next: OFMT, Prev: Print Examples, Up: Printing -Output Separators -================= +4.3 Output Separators +===================== - As mentioned previously, a `print' statement contains a list of -items separated by commas. In the output, the items are normally -separated by single spaces. However, this doesn't need to be the case; -a single space is only the default. Any string of characters may be -used as the "output field separator" by setting the built-in variable -`OFS'. The initial value of this variable is the string `" "'--that -is, a single space. +As mentioned previously, a `print' statement contains a list of items +separated by commas. In the output, the items are normally separated +by single spaces. However, this doesn't need to be the case; a single +space is only the default. Any string of characters may be used as the +"output field separator" by setting the built-in variable `OFS'. The +initial value of this variable is the string `" "'--that is, a single +space. - The output from an entire `print' statement is called an "output +The output from an entire `print' statement is called an "output record". Each `print' statement outputs one output record, and then outputs a string called the "output record separator" (or `ORS'). The initial value of `ORS' is the string `"\n"'; i.e., a newline character. Thus, each `print' statement normally makes a separate line. - In order to change how output fields and records are separated, -assign new values to the variables `OFS' and `ORS'. The usual place to -do this is in the `BEGIN' rule (*note BEGIN/END::), so that it happens +In order to change how output fields and records are separated, assign +new values to the variables `OFS' and `ORS'. The usual place to do +this is in the `BEGIN' rule (*note BEGIN/END::), so that it happens before any input is processed. It can also be done with assignments on the command line, before the names of the input files, or using the `-v' command-line option (*note Options::). The following example @@ -4372,16 +4414,16 @@ semicolon, with a blank line added after each newline: -| barfly;555-7685 ... - If the value of `ORS' does not contain a newline, the program's -output is run together on a single line. +If the value of `ORS' does not contain a newline, the program's output +is run together on a single line.  File: gawk.info, Node: OFMT, Next: Printf, Prev: Output Separators, Up: Printing -Controlling Numeric Output with `print' -======================================= +4.4 Controlling Numeric Output with `print' +=========================================== - When the `print' statement is used to print numeric values, `awk' +When the `print' statement is used to print numeric values, `awk' internally converts the number to a string of characters and prints that string. `awk' uses the `sprintf' function to do this conversion (*note String Functions::). For now, it suffices to say that the @@ -4390,12 +4432,12 @@ to format numbers (or strings), and that there are a number of different ways in which numbers can be formatted. The different format specifications are discussed more fully in *Note Control Letters::. - The built-in variable `OFMT' contains the default format -specification that `print' uses with `sprintf' when it wants to convert -a number to a string for printing. The default value of `OFMT' is -`"%.6g"'. The way `print' prints numbers can be changed by supplying -different format specifications as the value of `OFMT', as shown in the -following example: +The built-in variable `OFMT' contains the default format specification +that `print' uses with `sprintf' when it wants to convert a number to a +string for printing. The default value of `OFMT' is `"%.6g"'. The way +`print' prints numbers can be changed by supplying different format +specifications as the value of `OFMT', as shown in the following +example: $ awk 'BEGIN { > OFMT = "%.0f" # print numbers as integers (rounds) @@ -4409,17 +4451,16 @@ According to the POSIX standard, `awk''s behavior is undefined if  File: gawk.info, Node: Printf, Next: Redirection, Prev: OFMT, Up: Printing -Using `printf' Statements for Fancier Printing -============================================== +4.5 Using `printf' Statements for Fancier Printing +================================================== - For more precise control over the output format than what is -normally provided by `print', use `printf'. `printf' can be used to -specify the width to use for each item, as well as various formatting -choices for numbers (such as what output base to use, whether to print -an exponent, whether to print a sign, and how many digits to print -after the decimal point). This is done by supplying a string, called -the "format string", that controls how and where to print the other -arguments. +For more precise control over the output format than what is normally +provided by `print', use `printf'. `printf' can be used to specify the +width to use for each item, as well as various formatting choices for +numbers (such as what output base to use, whether to print an exponent, +whether to print a sign, and how many digits to print after the decimal +point). This is done by supplying a string, called the "format +string", that controls how and where to print the other arguments. * Menu: @@ -4431,10 +4472,10 @@ arguments.  File: gawk.info, Node: Basic Printf, Next: Control Letters, Up: Printf -Introduction to the `printf' Statement --------------------------------------- +4.5.1 Introduction to the `printf' Statement +-------------------------------------------- - A simple `printf' statement looks like this: +A simple `printf' statement looks like this: printf FORMAT, ITEM1, ITEM2, ... @@ -4443,19 +4484,19 @@ The parentheses are necessary if any of the item expressions use the `>' relational operator; otherwise, it can be confused with a redirection (*note Redirection::). - The difference between `printf' and `print' is the FORMAT argument. +The difference between `printf' and `print' is the FORMAT argument. This is an expression whose value is taken as a string; it specifies how to output each of the other arguments. It is called the "format string". - The format string is very similar to that in the ISO C library -function `printf'. Most of FORMAT is text to output verbatim. -Scattered among this text are "format specifiers"--one per item. Each -format specifier says to output the next item in the argument list at -that place in the format. +The format string is very similar to that in the ISO C library function +`printf'. Most of FORMAT is text to output verbatim. Scattered among +this text are "format specifiers"--one per item. Each format specifier +says to output the next item in the argument list at that place in the +format. - The `printf' statement does not automatically append a newline to -its output. It outputs only what the format string specifies. So if a +The `printf' statement does not automatically append a newline to its +output. It outputs only what the format string specifies. So if a newline is needed, you must include one in the format string. The output separator variables `OFS' and `ORS' have no effect on `printf' statements. For example: @@ -4472,10 +4513,10 @@ Here, neither the `+' nor the `OUCH' appear when the message is printed.  File: gawk.info, Node: Control Letters, Next: Format Modifiers, Prev: Basic Printf, Up: Printf -Format-Control Letters ----------------------- +4.5.2 Format-Control Letters +---------------------------- - A format specifier starts with the character `%' and ends with a +A format specifier starts with the character `%' and ends with a "format-control letter"--it tells the `printf' statement how to output one item. The format-control letter specifies what _kind_ of value to print. The rest of the format specifier is made up of optional @@ -4511,6 +4552,18 @@ width. Here is a list of the format-control letters: of which follow the decimal point. (The `4.3' represents two modifiers, discussed in the next node.) + On systems supporting IEEE 754 floating point format, values + representing negative infinity are formatted as `-inf' or + `-infinity', and positive infinity as `inf' and `-infinity'. The + special "not a number" value formats as `-nan' or `nan'. + +`%F' + Like `%f' but the infinity and "not a number" values are spelled + using uppercase letters. + + The `%F' format is a POSIX extension to ISO C; not all systems + support. On those that don't, `gawk' uses `%f' instead. + `%g, %G' These print a number in either scientific notation or in floating-point notation, whichever uses fewer characters; if the @@ -4537,20 +4590,20 @@ width. Here is a list of the format-control letters: sequence `%%' outputs one `%'; it does not consume an argument and it ignores any modifiers. - *Note:* When using the integer format-control letters for values -that are outside the range of the widest C integer type, `gawk' -switches to the the `%g' format specifier. If `--lint' is provided on -the command line (*note Options::), `gawk' warns about this. Other -versions of `awk' may print invalid values or do something else -entirely. (d.c.) + NOTE: When using the integer format-control letters for values + that are outside the range of the widest C integer type, `gawk' + switches to the the `%g' format specifier. If `--lint' is provided + on the command line (*note Options::), `gawk' warns about this. + Other versions of `awk' may print invalid values or do something + else entirely. (d.c.)  File: gawk.info, Node: Format Modifiers, Next: Printf Examples, Prev: Control Letters, Up: Printf -Modifiers for `printf' Formats ------------------------------- +4.5.3 Modifiers for `printf' Formats +------------------------------------ - A format specification can also include "modifiers" that can control +A format specification can also include "modifiers" that can control how much of the item's value is printed, as well as how much space it gets. The modifiers come between the `%' and the format-control letter. We will use the bullet symbol "*" in the following examples to represent @@ -4609,6 +4662,28 @@ which they may appear: to non-numeric output formats. (d.c.) This flag only has an effect when the field width is wider than the value to print. +`'' + A single quote or apostrohe character is a POSIX extension to ISO + C. It indicates that the integer part of a floating point value, + or the entire part of an integer decimal value, should have a + thousands-separator character in it. This only works in locales + that support such characters. For example: + + $ cat thousands.awk Show source program + -| BEGIN { printf "%'d\n", 1234567 } + $ LC_ALL=C gawk -f thousands.awk Run it in "C" locale + -| 1234567 + $ LC_ALL=en_US.UTF-8 gawk -f thousands.awk Run in US English UTF locale + -| 1,234,567 + + For more information about locales and internationalization issues, + *FIXME: see xxxx*. + + NOTE: The `'' flag is a nice feature, but its use complicates + things: it now becomes difficult to use it in command-line + programs. For information on appropriate quoting tricks, + *FIXME: see XXXX*. + `WIDTH' This is a number specifying the desired minimum width of a field. Inserting any number between the `%' sign and the format-control @@ -4654,7 +4729,7 @@ which they may appear: prints `foob'. - The C library `printf''s dynamic WIDTH and PREC capability (for +The C library `printf''s dynamic WIDTH and PREC capability (for example, `"%*.*s"') is supported. Instead of supplying explicit WIDTH and/or PREC values in the format string, they are passed in the argument list. For example: @@ -4681,7 +4756,7 @@ string, like so: This is not particularly easy to read but it does work. - C programmers may be used to supplying additional `l', `L', and `h' +C programmers may be used to supplying additional `l', `L', and `h' modifiers in `printf' format strings. These are not valid in `awk'. Most `awk' implementations silently ignore these modifiers. If `--lint' is provided on the command line (*note Options::), `gawk' @@ -4691,10 +4766,10 @@ error.  File: gawk.info, Node: Printf Examples, Prev: Format Modifiers, Up: Printf -Examples Using `printf' ------------------------ +4.5.4 Examples Using `printf' +----------------------------- - The following is a simple example of how to use `printf' to make an +The following is a simple example of how to use `printf' to make an aligned table: awk '{ printf "%-10s %s\n", $1, $2 }' BBS-list @@ -4717,16 +4792,16 @@ an aligned two-column table of names and phone numbers, as shown here: -| sdace 555-3430 -| sabafoo 555-2127 - In this case, the phone numbers had to be printed as strings because +In this case, the phone numbers had to be printed as strings because the numbers are separated by a dash. Printing the phone numbers as numbers would have produced just the first three digits: `555'. This would have been pretty confusing. - It wasn't necessary to specify a width for the phone numbers because +It wasn't necessary to specify a width for the phone numbers because they are last on their lines. They don't need to have spaces after them. - The table could be made to look even nicer by adding headings to the +The table could be made to look even nicer by adding headings to the tops of the columns. This is done using the `BEGIN' pattern (*note BEGIN/END::) so that the headers are only printed once, at the beginning of the `awk' program: @@ -4735,7 +4810,7 @@ beginning of the `awk' program: print "---- ------" } { printf "%-10s %s\n", $1, $2 }' BBS-list - The above example mixed `print' and `printf' statements in the same +The above example mixed `print' and `printf' statements in the same program. Using just `printf' statements can produce the same results: awk 'BEGIN { printf "%-10s %s\n", "Name", "Number" @@ -4746,15 +4821,15 @@ Printing each column heading with the same format specification used for the column elements ensures that the headings are aligned just like the columns. - The fact that the same format specification is used three times can -be emphasized by storing it in a variable, like this: +The fact that the same format specification is used three times can be +emphasized by storing it in a variable, like this: awk 'BEGIN { format = "%-10s %s\n" printf format, "Name", "Number" printf format, "----", "------" } { printf format, $1, $2 }' BBS-list - At this point, it would be a worthwhile exercise to use the `printf' +At this point, it would be a worthwhile exercise to use the `printf' statement to line up the headings and table data for the `inventory-shipped' example that was covered earlier in the minor node on the `print' statement (*note Print::). @@ -4762,18 +4837,18 @@ on the `print' statement (*note Print::).  File: gawk.info, Node: Redirection, Next: Special Files, Prev: Printf, Up: Printing -Redirecting Output of `print' and `printf' -========================================== +4.6 Redirecting Output of `print' and `printf' +============================================== - So far, the output from `print' and `printf' has gone to the standard +So far, the output from `print' and `printf' has gone to the standard output, usually the terminal. Both `print' and `printf' can also send their output to other places. This is called "redirection". - A redirection appears after the `print' or `printf' statement. +A redirection appears after the `print' or `printf' statement. Redirections in `awk' are written just like redirections in shell commands, except that they are written inside the `awk' program. - There are four forms of output redirection: output to a file, output +There are four forms of output redirection: output to a file, output appended to a file, output through a pipe to another command, and output to a coprocess. They are all shown for the `print' statement, but they work identically for `printf': @@ -4868,13 +4943,13 @@ work identically for `printf': This feature is a `gawk' extension, and is not available in POSIX `awk'. *Note Two-way I/O::, for a more complete discussion. - Redirecting output using `>', `>>', `|', or `|&' asks the system to +Redirecting output using `>', `>>', `|', or `|&' asks the system to open a file, pipe, or coprocess only if the particular FILE or COMMAND you specify has not already been written to by your program or if it has been closed since it was last written to. - It is a common error to use `>' redirection for the first `print' to -a file, and then to use `>>' for subsequent output: +It is a common error to use `>' redirection for the first `print' to a +file, and then to use `>>' for subsequent output: # clear the file print "Don't panic" > "guide.txt" @@ -4887,36 +4962,36 @@ This is indeed how redirections must be used from the shell. But in `>' for all the `print' statements, since the output file is only opened once. - Many `awk' implementations limit the number of pipelines that an -`awk' program may have open to just one! In `gawk', there is no such -limit. `gawk' allows a program to open as many pipelines as the -underlying operating system permits. +Many `awk' implementations limit the number of pipelines that an `awk' +program may have open to just one! In `gawk', there is no such limit. +`gawk' allows a program to open as many pipelines as the underlying +operating system permits. Advanced Notes: Piping into `sh' -------------------------------- - A particularly powerful way to use redirection is to build command -lines and pipe them into the shell, `sh'. For example, suppose you -have a list of files brought over from a system where all the file names -are stored in uppercase, and you wish to rename them to have names in -all lowercase. The following program is both simple and efficient: +A particularly powerful way to use redirection is to build command lines +and pipe them into the shell, `sh'. For example, suppose you have a +list of files brought over from a system where all the file names are +stored in uppercase, and you wish to rename them to have names in all +lowercase. The following program is both simple and efficient: { printf("mv %s %s\n", $0, tolower($0)) | "sh" } - + END { close("sh") } - The `tolower' function returns its argument string with all -uppercase characters converted to lowercase (*note String Functions::). -The program builds up a list of command lines, using the `mv' utility -to rename the files. It then sends the list to the shell for execution. +The `tolower' function returns its argument string with all uppercase +characters converted to lowercase (*note String Functions::). The +program builds up a list of command lines, using the `mv' utility to +rename the files. It then sends the list to the shell for execution.  File: gawk.info, Node: Special Files, Next: Close Files And Pipes, Prev: Redirection, Up: Printing -Special File Names in `gawk' -============================ +4.7 Special File Names in `gawk' +================================ - `gawk' provides a number of special file names that it interprets +`gawk' provides a number of special file names that it interprets internally. These file names provide access to standard file descriptors, process-related information, and TCP/IP networking. @@ -4930,10 +5005,10 @@ descriptors, process-related information, and TCP/IP networking.  File: gawk.info, Node: Special FD, Next: Special Process, Up: Special Files -Special Files for Standard Descriptors --------------------------------------- +4.7.1 Special Files for Standard Descriptors +-------------------------------------------- - Running programs conventionally have three input and output streams +Running programs conventionally have three input and output streams already available to them for reading and writing. These are known as the "standard input", "standard output", and "standard error output". These streams are, by default, connected to your terminal, but they are @@ -4942,7 +5017,7 @@ and `|' operators. Standard error is typically used for writing error messages; the reason there are two separate streams, standard output and standard error, is so that they can be redirected separately. - In other implementations of `awk', the only way to write an error +In other implementations of `awk', the only way to write an error message to standard error in an `awk' program is as follows: print "Serious error detected!" | "cat 1>&2" @@ -4961,7 +5036,7 @@ happens, writing to the terminal is not correct. In fact, if `awk' is run from a background job, it may not have a terminal at all. Then opening `/dev/tty' fails. - `gawk' provides special file names for accessing the three standard +`gawk' provides special file names for accessing the three standard streams, as well as any other inherited open files. If the file name matches one of these special names when `gawk' redirects input or output, then it directly uses the stream that the file name stands for. @@ -4983,28 +5058,28 @@ been ported to, not just those that are POSIX-compliant: the shell). Unless special pains are taken in the shell from which `gawk' is invoked, only descriptors 0, 1, and 2 are available. - The file names `/dev/stdin', `/dev/stdout', and `/dev/stderr' are +The file names `/dev/stdin', `/dev/stdout', and `/dev/stderr' are aliases for `/dev/fd/0', `/dev/fd/1', and `/dev/fd/2', respectively. However, they are more self-explanatory. The proper way to write an error message in a `gawk' program is to use `/dev/stderr', like this: print "Serious error detected!" > "/dev/stderr" - Note the use of quotes around the file name. Like any other +Note the use of quotes around the file name. Like any other redirection, the value must be a string. It is a common error to omit the quotes, which leads to confusing results.  File: gawk.info, Node: Special Process, Next: Special Network, Prev: Special FD, Up: Special Files -Special Files for Process-Related Information ---------------------------------------------- +4.7.2 Special Files for Process-Related Information +--------------------------------------------------- - `gawk' also provides special file names that give access to -information about the running `gawk' process. Each of these "files" -provides a single record of information. To read them more than once, -they must first be closed with the `close' function (*note Close Files -And Pipes::). The file names are: +`gawk' also provides special file names that give access to information +about the running `gawk' process. Each of these "files" provides a +single record of information. To read them more than once, they must +first be closed with the `close' function (*note Close Files And +Pipes::). The file names are: `/dev/pid' Reading this file returns the process ID of the current process, @@ -5043,29 +5118,29 @@ And Pipes::). The file names are: returned by the `getgroups' system call. (Multiple groups may not be supported on all systems.) - These special file names may be used on the command line as data -files, as well as for I/O redirections within an `awk' program. They -may not be used as source files with the `-f' option. +These special file names may be used on the command line as data files, +as well as for I/O redirections within an `awk' program. They may not +be used as source files with the `-f' option. - *Note:* The special files that provide process-related information -are now considered obsolete and will disappear entirely in the next -release of `gawk'. `gawk' prints a warning message every time you use -one of these files. To obtain process-related information, use the -`PROCINFO' array. *Note Auto-set::. + NOTE: The special files that provide process-related information + are now considered obsolete and will disappear entirely in the + next release of `gawk'. `gawk' prints a warning message every + time you use one of these files. To obtain process-related + information, use the `PROCINFO' array. *Note Auto-set::.  File: gawk.info, Node: Special Network, Next: Special Caveats, Prev: Special Process, Up: Special Files -Special Files for Network Communications ----------------------------------------- +4.7.3 Special Files for Network Communications +---------------------------------------------- - Starting with version 3.1 of `gawk', `awk' programs can open a -two-way TCP/IP connection, acting as either a client or a server. This -is done using a special file name of the form: +Starting with version 3.1 of `gawk', `awk' programs can open a two-way +TCP/IP connection, acting as either a client or a server. This is done +using a special file name of the form: `/inet/PROTOCOL/LOCAL-PORT/REMOTE-HOST/REMOTE-PORT' - The PROTOCOL is one of `tcp', `udp', or `raw', and the other fields +The PROTOCOL is one of `tcp', `udp', or `raw', and the other fields represent the other essential pieces of information for making a networking connection. These file names are used with the `|&' operator for communicating with a coprocess (*note Two-way I/O::). @@ -5075,10 +5150,10 @@ Full discussion is delayed until *Note TCP/IP Networking::.  File: gawk.info, Node: Special Caveats, Prev: Special Network, Up: Special Files -Special File Name Caveats -------------------------- +4.7.4 Special File Name Caveats +------------------------------- - Here is a list of things to bear in mind when using the special file +Here is a list of things to bear in mind when using the special file names that `gawk' provides: * Recognition of these special file names is disabled if `gawk' is in @@ -5098,9 +5173,9 @@ names that `gawk' provides: any of the files related to file descriptors 0, 1, and 2. Doing so results in unpredictable behavior. - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) Older versions of `gawk' would interpret these names internally +(1) Older versions of `gawk' would interpret these names internally only if the system did not actually have a `/dev/fd' directory or any of the other special files listed earlier. Usually this didn't make a difference, but sometimes it did; thus, it was decided to make `gawk''s @@ -5110,25 +5185,25 @@ special file names itself.  File: gawk.info, Node: Close Files And Pipes, Prev: Special Files, Up: Printing -Closing Input and Output Redirections -===================================== +4.8 Closing Input and Output Redirections +========================================= - If the same file name or the same shell command is used with -`getline' more than once during the execution of an `awk' program -(*note Getline::), the file is opened (or the command is executed) the -first time only. At that time, the first record of input is read from -that file or command. The next time the same file or command is used -with `getline', another record is read from it, and so on. +If the same file name or the same shell command is used with `getline' +more than once during the execution of an `awk' program (*note +Getline::), the file is opened (or the command is executed) the first +time only. At that time, the first record of input is read from that +file or command. The next time the same file or command is used with +`getline', another record is read from it, and so on. - Similarly, when a file or pipe is opened for output, the file name or +Similarly, when a file or pipe is opened for output, the file name or command associated with it is remembered by `awk', and subsequent writes to the same file or command are appended to the previous writes. The file or pipe stays open until `awk' exits. - This implies that special steps are necessary in order to read the -same file again from the beginning, or to rerun a shell command (rather -than reading more output from the same command). The `close' function -makes these things possible: +This implies that special steps are necessary in order to read the same +file again from the beginning, or to rerun a shell command (rather than +reading more output from the same command). The `close' function makes +these things possible: close(FILENAME) @@ -5136,9 +5211,9 @@ or: close(COMMAND) - The argument FILENAME or COMMAND can be any expression. Its value -must _exactly_ match the string that was used to open the file or start -the command (spaces and other "irrelevant" characters included). For +The argument FILENAME or COMMAND can be any expression. Its value must +_exactly_ match the string that was used to open the file or start the +command (spaces and other "irrelevant" characters included). For example, if you open a pipe with this: "sort -r names" | getline foo @@ -5147,13 +5222,13 @@ then you must close it with this: close("sort -r names") - Once this function call is executed, the next `getline' from that -file or command, or the next `print' or `printf' to that file or -command, reopens the file or reruns the command. Because the -expression that you use to close a file or pipeline must exactly match -the expression used to open the file or run the command, it is good -practice to use a variable to store the file name or command. The -previous example becomes the following: +Once this function call is executed, the next `getline' from that file +or command, or the next `print' or `printf' to that file or command, +reopens the file or reruns the command. Because the expression that +you use to close a file or pipeline must exactly match the expression +used to open the file or run the command, it is good practice to use a +variable to store the file name or command. The previous example +becomes the following: sortcom = "sort -r names" sortcom | getline foo @@ -5188,9 +5263,9 @@ programs. Here are some of the reasons for closing an output file: the program closes the pipe after each line of output, then each line makes a separate message. - If you use more files than the system allows you to have open, -`gawk' attempts to multiplex the available open files among your data -files. `gawk''s ability to do this depends upon the facilities of your +If you use more files than the system allows you to have open, `gawk' +attempts to multiplex the available open files among your data files. +`gawk''s ability to do this depends upon the facilities of your operating system, so it may not always work. It is therefore both good practice and good portability advice to always use `close' on your files when you are done with them. In fact, if you are using a lot of @@ -5206,25 +5281,25 @@ consider something like this: # need close(command) here } - This example creates a new pipeline based on data in _each_ record. +This example creates a new pipeline based on data in _each_ record. Without the call to `close' indicated in the comment, `awk' creates child processes to run the commands, until it eventually runs out of file descriptors for more pipelines. - Even though each command has finished (as indicated by the -end-of-file return status from `getline'), the child process is not -terminated;(1) more importantly, the file descriptor for the pipe is -not closed and released until `close' is called or `awk' exits. +Even though each command has finished (as indicated by the end-of-file +return status from `getline'), the child process is not terminated;(1) +more importantly, the file descriptor for the pipe is not closed and +released until `close' is called or `awk' exits. - `close' will silently do nothing if given an argument that does not +`close' will silently do nothing if given an argument that does not represent a file, pipe or coprocess that was opened with a redirection. - Note also that `close(FILENAME)' has no "magic" effects on the -implicit loop that reads through the files named on the command line. -It is, more likely, a close of a file that was never opened, so `awk' -silently does nothing. +Note also that `close(FILENAME)' has no "magic" effects on the implicit +loop that reads through the files named on the command line. It is, +more likely, a close of a file that was never opened, so `awk' silently +does nothing. - When using the `|&' operator to communicate with a coprocess, it is +When using the `|&' operator to communicate with a coprocess, it is occasionally useful to be able to close one end of the two-way pipe without closing the other. This is done by supplying a second argument to `close'. As in any other call to `close', the first argument is the @@ -5237,7 +5312,7 @@ discusses it in more detail and gives an example. Advanced Notes: Using `close''s Return Value -------------------------------------------- - In many versions of Unix `awk', the `close' function is actually a +In many versions of Unix `awk', the `close' function is actually a statement. It is a syntax error to try and use the return value from `close': (d.c.) @@ -5245,45 +5320,43 @@ statement. It is a syntax error to try and use the return value from command | getline info retval = close(command) # syntax error in most Unix awks - `gawk' treats `close' as a function. The return value is -1 if the +`gawk' treats `close' as a function. The return value is -1 if the argument names something that was never opened with a redirection, or if there is a system problem closing the file or process. In these cases, `gawk' sets the built-in variable `ERRNO' to a string describing the problem. - In `gawk', when closing a pipe or coprocess, the return value is the +In `gawk', when closing a pipe or coprocess, the return value is the exit status of the command.(2) Otherwise, it is the return value from the system's `close' or `fclose' C functions when closing input or output files, respectively. This value is zero if the close succeeds, or -1 if it fails. - The POSIX standard is very vague; it says that `close' returns zero -on success and non-zero otherwise. In general, different -implementations vary in what they report when closing pipes; thus the -return value cannot be used portably. (d.c.) +The POSIX standard is very vague; it says that `close' returns zero on +success and non-zero otherwise. In general, different implementations +vary in what they report when closing pipes; thus the return value +cannot be used portably. (d.c.) - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) The technical terminology is rather morbid. The finished child -is called a "zombie," and cleaning up after it is referred to as -"reaping." +(1) The technical terminology is rather morbid. The finished child is +called a "zombie," and cleaning up after it is referred to as "reaping." - (2) This is a full 16-bit value as returned by the `wait' system -call. See the system manual pages for information on how to decode this -value. +(2) This is a full 16-bit value as returned by the `wait' system call. +See the system manual pages for information on how to decode this value.  File: gawk.info, Node: Expressions, Next: Patterns and Actions, Prev: Printing, Up: Top -Expressions -*********** +5 Expressions +************* - Expressions are the basic building blocks of `awk' patterns and +Expressions are the basic building blocks of `awk' patterns and actions. An expression evaluates to a value that you can print, test, or pass to a function. Additionally, an expression can assign a new value to a variable or a field by using an assignment operator. - An expression can serve as a pattern or action statement on its own. +An expression can serve as a pattern or action statement on its own. Most other kinds of statements contain one or more expressions that specify the data on which to operate. As in other languages, expressions in `awk' include variables, array references, constants, @@ -5318,16 +5391,16 @@ operators.  File: gawk.info, Node: Constants, Next: Using Constant Regexps, Up: Expressions -Constant Expressions -==================== +5.1 Constant Expressions +======================== - The simplest type of expression is the "constant", which always has -the same value. There are three types of constants: numeric, string, -and regular expression. +The simplest type of expression is the "constant", which always has the +same value. There are three types of constants: numeric, string, and +regular expression. - Each is used in the appropriate context when you need a data value -that isn't going to change. Numeric constants can have different -forms, but are stored identically internally. +Each is used in the appropriate context when you need a data value that +isn't going to change. Numeric constants can have different forms, but +are stored identically internally. * Menu: @@ -5338,10 +5411,10 @@ forms, but are stored identically internally.  File: gawk.info, Node: Scalar Constants, Next: Nondecimal-numbers, Up: Constants -Numeric and String Constants ----------------------------- +5.1.1 Numeric and String Constants +---------------------------------- - A "numeric constant" stands for a number. This number can be an +A "numeric constant" stands for a number. This number can be an integer, a decimal fraction, or a number in scientific (exponential) notation.(1) Here are some examples of numeric constants that all have the same value: @@ -5350,7 +5423,7 @@ the same value: 1.05e+2 1050e-1 - A string constant consists of a sequence of characters enclosed in +A string constant consists of a sequence of characters enclosed in double-quotation marks. For example: "parrot" @@ -5361,19 +5434,19 @@ eight-bit ASCII characters including ASCII NUL (character code zero). Other `awk' implementations may have difficulty with some character codes. - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) The internal representation of all numbers, including integers, +(1) The internal representation of all numbers, including integers, uses double-precision floating-point numbers. On most modern systems, these are in IEEE 754 standard format.  File: gawk.info, Node: Nondecimal-numbers, Next: Regexp Constants, Prev: Scalar Constants, Up: Constants -Octal and Hexadecimal Numbers ------------------------------ +5.1.2 Octal and Hexadecimal Numbers +----------------------------------- - In `awk', all numbers are in decimal; i.e., base 10. Many other +In `awk', all numbers are in decimal; i.e., base 10. Many other programming languages allow you to specify numbers in other bases, often octal (base 8) and hexadecimal (base 16). In octal, the numbers go 0, 1, 2, 3, 4, 5, 6, 7, 10, 11, 12, etc. Just as `11', in decimal, is 1 @@ -5385,8 +5458,8 @@ usually irrelevant; hexadecimal `a' and `A' have the same value.) Thus, `11', in hexadecimal, is 1 times 16 plus 1, which equals 17 in decimal. - Just by looking at plain `11', you can't tell what base it's in. -So, in C, C++, and other languages derived from C, there is a special +Just by looking at plain `11', you can't tell what base it's in. So, +in C, C++, and other languages derived from C, there is a special notation to help signify the base. Octal numbers start with a leading `0', and hexadecimal numbers start with a leading `0x' or `0X': @@ -5399,17 +5472,17 @@ notation to help signify the base. Octal numbers start with a leading `0x11' Hexadecimal 11, decimal value 17. - This example shows the difference: +This example shows the difference: $ gawk 'BEGIN { printf "%d, %d, %d\n", 011, 11, 0x11 }' -| 9, 11, 17 - Being able to use octal and hexadecimal constants in your programs -is most useful when working with data that cannot be represented +Being able to use octal and hexadecimal constants in your programs is +most useful when working with data that cannot be represented conveniently as characters or as regular numbers, such as binary data of various sorts. - `gawk' allows the use of octal and hexadecimal constants in your +`gawk' allows the use of octal and hexadecimal constants in your program text. However, such numbers in the input data are not treated differently; doing so by default would break old programs. (If you really need to do this, use the `--non-decimal-data' command-line @@ -5420,21 +5493,21 @@ octal or hexadecimal constants when working with the built-in bit manipulation functions; see *Note Bitwise Functions::, for more information. - Unlike some early C implementations, `8' and `9' are not valid in -octal constants; e.g., `gawk' treats `018' as decimal 18: +Unlike some early C implementations, `8' and `9' are not valid in octal +constants; e.g., `gawk' treats `018' as decimal 18: $ gawk 'BEGIN { print "021 is", 021 ; print 018 }' -| 021 is 17 -| 18 - Octal and hexadecimal source code constants are a `gawk' extension. -If `gawk' is in compatibility mode (*note Options::), they are not +Octal and hexadecimal source code constants are a `gawk' extension. If +`gawk' is in compatibility mode (*note Options::), they are not available. Advanced Notes: A Constant's Base Does Not Affect Its Value ----------------------------------------------------------- - Once a numeric constant has been converted internally into a number, +Once a numeric constant has been converted internally into a number, `gawk' no longer remembers what the original form of the constant was; the internal value is always used. This has particular consequences for conversion of numbers to strings: @@ -5445,10 +5518,10 @@ for conversion of numbers to strings:  File: gawk.info, Node: Regexp Constants, Prev: Nondecimal-numbers, Up: Constants -Regular Expression Constants ----------------------------- +5.1.4 Regular Expression Constants +---------------------------------- - A regexp constant is a regular expression description enclosed in +A regexp constant is a regular expression description enclosed in slashes, such as `/^beginning and end$/'. Most regexps used in `awk' programs are constant, but the `~' and `!~' matching operators can also match computed or "dynamic" regexps (which are just ordinary strings or @@ -5457,16 +5530,15 @@ variables that contain a regexp).  File: gawk.info, Node: Using Constant Regexps, Next: Variables, Prev: Constants, Up: Expressions -Using Regular Expression Constants -================================== +5.2 Using Regular Expression Constants +====================================== - When used on the righthand side of the `~' or `!~' operators, a -regexp constant merely stands for the regexp that is to be matched. -However, regexp constants (such as `/foo/') may be used like simple -expressions. When a regexp constant appears by itself, it has the same -meaning as if it appeared in a pattern, i.e., `($0 ~ /foo/)' (d.c.) -*Note Expression Patterns::. This means that the following two code -segments: +When used on the righthand side of the `~' or `!~' operators, a regexp +constant merely stands for the regexp that is to be matched. However, +regexp constants (such as `/foo/') may be used like simple expressions. +When a regexp constant appears by itself, it has the same meaning as if +it appeared in a pattern, i.e., `($0 ~ /foo/)' (d.c.) *Note Expression +Patterns::. This means that the following two code segments: if ($0 ~ /barfly/ || $0 ~ /camelot/) print "found" @@ -5499,7 +5571,7 @@ assigns either zero or one to the variable `matches', depending upon the contents of the current input record. This feature of the language has never been well documented until the POSIX specification. - Constant regular expressions are also used as the first argument for +Constant regular expressions are also used as the first argument for the `gensub', `sub', and `gsub' functions, and as the second argument of the `match' function (*note String Functions::). Modern implementations of `awk', including `gawk', allow the third argument of @@ -5516,7 +5588,7 @@ For example: sub(pat, repl, str) return str } - + { ... text = "hi! hi yourself!" @@ -5524,8 +5596,8 @@ For example: ... } - In this example, the programmer wants to pass a regexp constant to -the user-defined function `mysub', which in turn passes it on to either +In this example, the programmer wants to pass a regexp constant to the +user-defined function `mysub', which in turn passes it on to either `sub' or `gsub'. However, what really happens is that the `pat' parameter is either one or zero, depending upon whether or not `$0' matches `/hi/'. `gawk' issues a warning when it sees a regexp constant @@ -5535,10 +5607,10 @@ value in this way is probably not what was intended.  File: gawk.info, Node: Variables, Next: Conversion, Prev: Using Constant Regexps, Up: Expressions -Variables -========= +5.3 Variables +============= - Variables are ways of storing values at one point in your program for +Variables are ways of storing values at one point in your program for use later in another part of your program. They can be manipulated entirely within the program text, and they can also be assigned values on the `awk' command line. @@ -5553,29 +5625,29 @@ on the `awk' command line.  File: gawk.info, Node: Using Variables, Next: Assignment Options, Up: Variables -Using Variables in a Program ----------------------------- +5.3.1 Using Variables in a Program +---------------------------------- - Variables let you give names to values and refer to them later. +Variables let you give names to values and refer to them later. Variables have already been used in many of the examples. The name of a variable must be a sequence of letters, digits, or underscores, and it may not begin with a digit. Case is significant in variable names; `a' and `A' are distinct variables. - A variable name is a valid expression by itself; it represents the +A variable name is a valid expression by itself; it represents the variable's current value. Variables are given new values with "assignment operators", "increment operators", and "decrement operators". *Note Assignment Ops::. - A few variables have special built-in meanings, such as `FS' (the -field separator), and `NF' (the number of fields in the current input +A few variables have special built-in meanings, such as `FS' (the field +separator), and `NF' (the number of fields in the current input record). *Note Built-in Variables::, for a list of the built-in variables. These built-in variables can be used and assigned just like all other variables, but their values are also used or changed automatically by `awk'. All built-in variables' names are entirely uppercase. - Variables in `awk' can be assigned either numeric or string values. +Variables in `awk' can be assigned either numeric or string values. The kind of value a variable holds can change over the life of a program. By default, variables are initialized to the empty string, which is zero if converted to a number. There is no need to @@ -5585,10 +5657,10 @@ do in C and in most other traditional languages.  File: gawk.info, Node: Assignment Options, Prev: Using Variables, Up: Variables -Assigning Variables on the Command Line ---------------------------------------- +5.3.2 Assigning Variables on the Command Line +--------------------------------------------- - Any `awk' variable can be set by including a "variable assignment" +Any `awk' variable can be set by including a "variable assignment" among the arguments on the command line when `awk' is invoked (*note Other Arguments::). Such an assignment has the following form: @@ -5625,7 +5697,7 @@ second field is printed in lines from `BBS-list': -| 555-3412 ... - Command-line arguments are made available for explicit examination by +Command-line arguments are made available for explicit examination by the `awk' program in the `ARGV' array (*note ARGC and ARGV::). `awk' processes the values of command-line assignments for escape sequences (*note Escape Sequences::). (d.c.) @@ -5633,15 +5705,15 @@ processes the values of command-line assignments for escape sequences  File: gawk.info, Node: Conversion, Next: Arithmetic Ops, Prev: Variables, Up: Expressions -Conversion of Strings and Numbers -================================= +5.4 Conversion of Strings and Numbers +===================================== - Strings are converted to numbers and numbers are converted to -strings, if the context of the `awk' program demands it. For example, -if the value of either `foo' or `bar' in the expression `foo + bar' -happens to be a string, it is converted to a number before the addition -is performed. If numeric values appear in string concatenation, they -are converted to strings. Consider the following: +Strings are converted to numbers and numbers are converted to strings, +if the context of the `awk' program demands it. For example, if the +value of either `foo' or `bar' in the expression `foo + bar' happens to +be a string, it is converted to a number before the addition is +performed. If numeric values appear in string concatenation, they are +converted to strings. Consider the following: two = 2; three = 3 print (two three) + 4 @@ -5651,7 +5723,7 @@ variables `two' and `three' are converted to strings and concatenated together. The resulting string is converted back to the number 23, to which 4 is then added. - If, for some reason, you need to force a number to be converted to a +If, for some reason, you need to force a number to be converted to a string, concatenate the empty string, `""', with that number. To force a string to be converted to a number, add zero to that string. A string is converted to a number by interpreting any numeric prefix of @@ -5659,24 +5731,24 @@ the string as numerals: `"2.5"' converts to 2.5, `"1e3"' converts to 1000, and `"25fix"' has a numeric value of 25. Strings that can't be interpreted as valid numbers convert to zero. - The exact manner in which numbers are converted into strings is +The exact manner in which numbers are converted into strings is controlled by the `awk' built-in variable `CONVFMT' (*note Built-in Variables::). Numbers are converted using the `sprintf' function with `CONVFMT' as the format specifier (*note String Functions::). - `CONVFMT''s default value is `"%.6g"', which prints a value with at +`CONVFMT''s default value is `"%.6g"', which prints a value with at least six significant digits. For some applications, you might want to change it to specify more precision. On most modern machines, 17 digits is enough to capture a floating-point number's value exactly, most of the time.(1) - Strange results can occur if you set `CONVFMT' to a string that -doesn't tell `sprintf' how to format floating-point numbers in a useful -way. For example, if you forget the `%' in the format, `awk' converts -all numbers to the same constant string. As a special case, if a -number is an integer, then the result of converting it to a string is -_always_ an integer, no matter what the value of `CONVFMT' may be. -Given the following code fragment: +Strange results can occur if you set `CONVFMT' to a string that doesn't +tell `sprintf' how to format floating-point numbers in a useful way. +For example, if you forget the `%' in the format, `awk' converts all +numbers to the same constant string. As a special case, if a number is +an integer, then the result of converting it to a string is _always_ an +integer, no matter what the value of `CONVFMT' may be. Given the +following code fragment: CONVFMT = "%2.2f" a = 12 @@ -5684,7 +5756,7 @@ Given the following code fragment: `b' has the value `"12"', not `"12.00"'. (d.c.) - Prior to the POSIX standard, `awk' used the value of `OFMT' for +Prior to the POSIX standard, `awk' used the value of `OFMT' for converting numbers to strings. `OFMT' specifies the output format to use when printing numbers with `print'. `CONVFMT' was introduced in order to separate the semantics of conversion from the semantics of @@ -5696,7 +5768,7 @@ older implementations of `awk'. We recommend that instead of changing your programs, just port `gawk' itself. *Note Print::, for more information on the `print' statement. - Finally, once again, where you are can matter when it comes to +Finally, once again, where you are can matter when it comes to converting between numbers and strings. In *Note Locales::, we mentioned that the local character set and language (the locale) can affect how `gawk' matches characters. The locale also affects numeric @@ -5706,10 +5778,10 @@ use the period character (`.') as the decimal point. However, many (if not most) European and non-English locales use the comma (`,') as the decimal point character. - The POSIX standard says that `awk' always uses the period as the -decimal point when reading the `awk' program source code, and for -command-line variable assignments (*note Other Arguments::). However, -when interpreting input data, for `print' and `printf' output, and for +The POSIX standard says that `awk' always uses the period as the decimal +point when reading the `awk' program source code, and for command-line +variable assignments (*note Other Arguments::). However, when +interpreting input data, for `print' and `printf' output, and for number to string conversion, the local decimal point character is used. As of version 3.1.3, `gawk' fully complies with this aspect of the standard. Here are some examples indicating the difference in behavior, @@ -5729,24 +5801,24 @@ the decimal point separator. In the normal `"C"' locale, `gawk' treats `4,321' as `4', while in the Danish locale, it's treated as the full number, `4.321'. - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) Pathological cases can require up to 752 digits (!), but we -doubt that you need to worry about this. +(1) Pathological cases can require up to 752 digits (!), but we doubt +that you need to worry about this.  File: gawk.info, Node: Arithmetic Ops, Next: Concatenation, Prev: Conversion, Up: Expressions -Arithmetic Operators -==================== +5.5 Arithmetic Operators +======================== - The `awk' language uses the common arithmetic operators when -evaluating expressions. All of these arithmetic operators follow normal +The `awk' language uses the common arithmetic operators when evaluating +expressions. All of these arithmetic operators follow normal precedence rules and work as you would expect them to. - The following example uses a file named `grades', which contains a -list of student names as well as three test scores per student (it's a -small class): +The following example uses a file named `grades', which contains a list +of student names as well as three test scores per student (it's a small +class): Pat 100 97 58 Sandy 84 72 93 @@ -5761,8 +5833,8 @@ scores: -| Sandy 83 -| Chris 84.3333 - The following list provides the arithmetic operators in `awk', in -order from the highest precedence to the lowest: +The following list provides the arithmetic operators in `awk', in order +from the highest precedence to the lowest: `- X' Negation. @@ -5796,57 +5868,58 @@ order from the highest precedence to the lowest: `X - Y' Subtraction. - Unary plus and minus have the same precedence, the multiplication +Unary plus and minus have the same precedence, the multiplication operators all have the same precedence, and addition and subtraction have the same precedence. - When computing the remainder of `X % Y', the quotient is rounded -toward zero to an integer and multiplied by Y. This result is -subtracted from X; this operation is sometimes known as "trunc-mod." -The following relation always holds: +When computing the remainder of `X % Y', the quotient is rounded toward +zero to an integer and multiplied by Y. This result is subtracted from +X; this operation is sometimes known as "trunc-mod." The following +relation always holds: b * int(a / b) + (a % b) == a - One possibly undesirable effect of this definition of remainder is -that `X % Y' is negative if X is negative. Thus: +One possibly undesirable effect of this definition of remainder is that +`X % Y' is negative if X is negative. Thus: -17 % 8 = -1 - In other `awk' implementations, the signedness of the remainder may -be machine-dependent. +In other `awk' implementations, the signedness of the remainder may be +machine-dependent. - *Note:* The POSIX standard only specifies the use of `^' for -exponentiation. For maximum portability, do not use the `**' operator. + NOTE: The POSIX standard only specifies the use of `^' for + exponentiation. For maximum portability, do not use the `**' + operator.  File: gawk.info, Node: Concatenation, Next: Assignment Ops, Prev: Arithmetic Ops, Up: Expressions -String Concatenation -==================== +5.6 String Concatenation +======================== It seemed like a good idea at the time. Brian Kernighan - There is only one string operation: concatenation. It does not have -a specific operator to represent it. Instead, concatenation is -performed by writing expressions next to one another, with no operator. -For example: +There is only one string operation: concatenation. It does not have a +specific operator to represent it. Instead, concatenation is performed +by writing expressions next to one another, with no operator. For +example: $ awk '{ print "Field number one: " $1 }' BBS-list -| Field number one: aardvark -| Field number one: alpo-net ... - Without the space in the string constant after the `:', the line -runs together. For example: +Without the space in the string constant after the `:', the line runs +together. For example: $ awk '{ print "Field number one:" $1 }' BBS-list -| Field number one:aardvark -| Field number one:alpo-net ... - Because string concatenation does not have an explicit operator, it -is often necessary to insure that it happens at the right time by using +Because string concatenation does not have an explicit operator, it is +often necessary to insure that it happens at the right time by using parentheses to enclose the items to concatenate. For example, the following code fragment does not concatenate `file' and `name' as you might expect: @@ -5859,7 +5932,7 @@ It is necessary to use the following: print "something meaningful" > (file name) - Parentheses should be used around concatenation in all but the most +Parentheses should be used around concatenation in all but the most common contexts, such as on the righthand side of `='. Be careful about the kinds of expressions used in string concatenation. In particular, the order of evaluation of expressions used for @@ -5880,43 +5953,42 @@ counter-intuitive. Consider this example: $ awk 'BEGIN { print -12 " " -24 }' -| -12-24 - This "obviously" is concatenating -12, a space, and -24. But where -did the space disappear to? The answer lies in the combination of -operator precedences and `awk''s automatic conversion rules. To get -the desired result, write the program in the following manner: +This "obviously" is concatenating -12, a space, and -24. But where did +the space disappear to? The answer lies in the combination of operator +precedences and `awk''s automatic conversion rules. To get the desired +result, write the program in the following manner: $ awk 'BEGIN { print -12 " " (-24) }' -| -12 -24 - This forces `awk' to treat the `-' on the `-24' as unary. -Otherwise, it's parsed as follows: +This forces `awk' to treat the `-' on the `-24' as unary. Otherwise, +it's parsed as follows: -12 (`" "' - 24) => -12 (0 - 24) => -12 (-24) => -12-24 - As mentioned earlier, when doing concatenation, _parenthesize_. +As mentioned earlier, when doing concatenation, _parenthesize_. Otherwise, you're never quite sure what you'll get.  File: gawk.info, Node: Assignment Ops, Next: Increment Ops, Prev: Concatenation, Up: Expressions -Assignment Expressions -====================== +5.7 Assignment Expressions +========================== - An "assignment" is an expression that stores a (usually different) +An "assignment" is an expression that stores a (usually different) value into a variable. For example, let's assign the value one to the variable `z': z = 1 - After this expression is executed, the variable `z' has the value -one. Whatever old value `z' had before the assignment is forgotten. +After this expression is executed, the variable `z' has the value one. +Whatever old value `z' had before the assignment is forgotten. - Assignments can also store string values. For example, the -following stores the value `"this food is good"' in the variable -`message': +Assignments can also store string values. For example, the following +stores the value `"this food is good"' in the variable `message': thing = "food" predicate = "good" @@ -5931,7 +6003,7 @@ An assignment operator is different; it does produce a value, but even if you ignore it, the assignment still makes itself felt through the alteration of the variable. We call this a "side effect". - The lefthand operand of an assignment need not be a variable (*note +The lefthand operand of an assignment need not be a variable (*note Variables::); it can also be a field (*note Changing Fields::) or an array element (*note Arrays::). These are all called "lvalues", which means they can appear on the lefthand side of an assignment operator. @@ -5939,7 +6011,7 @@ The righthand operand may be any expression; it produces the new value that the assignment stores in the specified variable, field, or array element. (Such values are called "rvalues".) - It is important to note that variables do _not_ have permanent types. +It is important to note that variables do _not_ have permanent types. A variable's type is simply the type of whatever value it happens to hold at the moment. In the following program fragment, the variable `foo' has a numeric value at first, and a string value later on: @@ -5952,20 +6024,21 @@ hold at the moment. In the following program fragment, the variable When the second assignment gives `foo' a string value, the fact that it previously had a numeric value is forgotten. - String values that do not begin with a digit have a numeric value of +String values that do not begin with a digit have a numeric value of zero. After executing the following code, the value of `foo' is five: foo = "a string" foo = foo + 5 -*Note:* Using a variable as a number and then later as a string can be -confusing and is poor programming style. The previous two examples -illustrate how `awk' works, _not_ how you should write your programs! + NOTE: Using a variable as a number and then later as a string can + be confusing and is poor programming style. The previous two + examples illustrate how `awk' works, _not_ how you should write + your programs! - An assignment is an expression, so it has a value--the same value -that is assigned. Thus, `z = 1' is an expression with the value one. -One consequence of this is that you can write multiple assignments -together, such as: +An assignment is an expression, so it has a value--the same value that +is assigned. Thus, `z = 1' is an expression with the value one. One +consequence of this is that you can write multiple assignments together, +such as: x = y = z = 5 @@ -5974,13 +6047,13 @@ and `z'). It does so because the value of `z = 5', which is five, is stored into `y' and then the value of `y = z = 5', which is five, is stored into `x'. - Assignments may be used anywhere an expression is called for. For +Assignments may be used anywhere an expression is called for. For example, it is valid to write `x != (y = 1)' to set `y' to one, and then test whether `x' equals one. But this style tends to make programs hard to read; such nesting of assignments should be avoided, except perhaps in a one-shot program. - Aside from `=', there are several other assignment operators that do +Aside from `=', there are several other assignment operators that do arithmetic with the old value of the variable. For example, the operator `+=' computes a new value by adding the righthand value to the old value of the variable. Thus, the following assignment adds five to @@ -5994,8 +6067,8 @@ This is equivalent to the following: Use whichever makes the meaning of your program clearer. - There are situations where using `+=' (or any assignment operator) -is _not_ the same as simply repeating the lefthand operand in the +There are situations where using `+=' (or any assignment operator) is +_not_ the same as simply repeating the lefthand operand in the righthand expression. For example: # Thanks to Pat Rankin for this example @@ -6003,7 +6076,7 @@ righthand expression. For example: foo[rand()] += 5 for (x in foo) print x, foo[x] - + bar[rand()] = bar[rand()] + 5 for (x in bar) print x, bar[x] @@ -6023,28 +6096,39 @@ Consider this example: The value of `a[3]' could be either two or four. - Here is a table of the arithmetic assignment operators. In each -case, the righthand operand is an expression whose value is converted -to a number. +*Note table-assign-ops:: lists the arithmetic assignment operators. In +each case, the righthand operand is an expression whose value is +converted to a number. + +Operator Effect +-------------------------------------------------------------------------- +LVALUE `+=' INCREMENT Adds INCREMENT to the value of LVALUE. +-------------------------------------------------------------------------- +LVALUE `-=' DECREMENT Subtracts DECREMENT from the value of LVALUE. +-------------------------------------------------------------------------- +LVALUE `*=' Multiplies the value of LVALUE by COEFFICIENT. +COEFFICIENT +-------------------------------------------------------------------------- +LVALUE `/=' DIVISOR Divides the value of LVALUE by DIVISOR. +-------------------------------------------------------------------------- +LVALUE `%=' MODULUS Sets LVALUE to its remainder by MODULUS. +-------------------------------------------------------------------------- +LVALUE `^=' POWER +-------------------------------------------------------------------------- +LVALUE `**=' POWER Raises LVALUE to the power POWER. +-------------------------------------------------------------------------- -LVALUE `+=' INCREMENT Adds INCREMENT to the value of LVALUE. -LVALUE `-=' DECREMENT Subtracts DECREMENT from the value of LVALUE. -LVALUE `*=' Multiplies the value of LVALUE by COEFFICIENT. -COEFFICIENT -LVALUE `/=' DIVISOR Divides the value of LVALUE by DIVISOR. -LVALUE `%=' MODULUS Sets LVALUE to its remainder by MODULUS. -LVALUE `^=' POWER -LVALUE `**=' POWER Raises LVALUE to the power POWER. +Table 5.1: Arithmetic Assignment Operators - *Note:* Only the `^=' operator is specified by POSIX. For maximum -portability, do not use the `**=' operator. + NOTE: Only the `^=' operator is specified by POSIX. For maximum + portability, do not use the `**=' operator. Advanced Notes: Syntactic Ambiguities Between `/=' and Regular Expressions -------------------------------------------------------------------------- - There is a syntactic ambiguity between the `/=' assignment operator -and regexp constants whose first character is an `='. (d.c.) This is -most notable in commercial `awk' versions. For example: +There is a syntactic ambiguity between the `/=' assignment operator and +regexp constants whose first character is an `='. (d.c.) This is most +notable in commercial `awk' versions. For example: $ awk /==/ /dev/null error--> awk: syntax error at source line 1 @@ -6056,21 +6140,21 @@ A workaround is: awk '/[=]=/' /dev/null - `gawk' does not have this problem, nor do the other freely available +`gawk' does not have this problem, nor do the other freely available versions described in *Note Other Versions::.  File: gawk.info, Node: Increment Ops, Next: Truth Values, Prev: Assignment Ops, Up: Expressions -Increment and Decrement Operators -================================= +5.8 Increment and Decrement Operators +===================================== - "Increment" and "decrement operators" increase or decrease the value -of a variable by one. An assignment operator can do the same thing, so +"Increment" and "decrement operators" increase or decrease the value of +a variable by one. An assignment operator can do the same thing, so the increment operators add no power to the `awk' language; however, they are convenient abbreviations for very common operations. - The operator used for adding one is written `++'. It can be used to +The operator used for adding one is written `++'. It can be used to increment a variable either before or after taking its value. To pre-increment a variable `v', write `++v'. This adds one to the value of `v'--that new value is also the value of the expression. (The @@ -6083,18 +6167,18 @@ four, but it changes the value of `foo' to five. In other words, the operator returns the old value of the variable, but with the side effect of incrementing it. - The post-increment `foo++' is nearly the same as writing `(foo += 1) -- 1'. It is not perfectly equivalent because all numbers in `awk' are +The post-increment `foo++' is nearly the same as writing `(foo += 1) - +1'. It is not perfectly equivalent because all numbers in `awk' are floating-point--in floating-point, `foo + 1 - 1' does not necessarily equal `foo'. But the difference is minute as long as you stick to numbers that are fairly small (less than 10e12). - Fields and array elements are incremented just like variables. (Use +Fields and array elements are incremented just like variables. (Use `$(i++)' when you want to do a field reference and a variable increment at the same time. The parentheses are necessary because of the precedence of the field reference operator `$'.) - The decrement operator `--' works just like `++', except that it +The decrement operator `--' works just like `++', except that it subtracts one instead of adding it. As with `++', it can be used before the lvalue to pre-decrement or after it to post-decrement. Following is a summary of increment and decrement expressions: @@ -6135,23 +6219,23 @@ Or something even stranger? b += ++b + b++ print b - In other words, when do the various side effects prescribed by the +In other words, when do the various side effects prescribed by the postfix operators (`b++') take effect? When side effects happen is "implementation defined". In other words, it is up to the particular version of `awk'. The result for the first example may be 12 or 13, and for the second, it may be 22 or 23. - In short, doing things like this is not recommended and definitely -not anything that you can rely upon for portability. You should avoid -such things in your own programs. +In short, doing things like this is not recommended and definitely not +anything that you can rely upon for portability. You should avoid such +things in your own programs.  File: gawk.info, Node: Truth Values, Next: Typing and Comparison, Prev: Increment Ops, Up: Expressions -True and False in `awk' -======================= +5.9 True and False in `awk' +=========================== - Many programming languages have a special representation for the +Many programming languages have a special representation for the concepts of "true" and "false." Such languages usually use the special constants `true' and `false', or perhaps their uppercase equivalents. However, `awk' is different. It borrows a very simple concept of true @@ -6169,29 +6253,29 @@ value' three times: print "A strange truth value" } - There is a surprising consequence of the "nonzero or non-null" rule: +There is a surprising consequence of the "nonzero or non-null" rule: the string constant `"0"' is actually true, because it is non-null. (d.c.)  File: gawk.info, Node: Typing and Comparison, Next: Boolean Ops, Prev: Truth Values, Up: Expressions -Variable Typing and Comparison Expressions -========================================== +5.10 Variable Typing and Comparison Expressions +=============================================== The Guide is definitive. Reality is frequently inaccurate. The Hitchhiker's Guide to the Galaxy - Unlike other programming languages, `awk' variables do not have a -fixed type. Instead, they can be either a number or a string, depending -upon the value that is assigned to them. +Unlike other programming languages, `awk' variables do not have a fixed +type. Instead, they can be either a number or a string, depending upon +the value that is assigned to them. - The 1992 POSIX standard introduced the concept of a "numeric -string", which is simply a string that looks like a number--for -example, `" +2"'. This concept is used for determining the type of a -variable. The type of the variable is important because the types of -two variables determine how they are compared. In `gawk', variable -typing follows these rules: +The 1992 POSIX standard introduced the concept of a "numeric string", +which is simply a string that looks like a number--for example, +`" +2"'. This concept is used for determining the type of a variable. +The type of the variable is important because the types of two variables +determine how they are compared. In `gawk', variable typing follows +these rules: * A numeric constant or the result of a numeric operation has the NUMERIC attribute. @@ -6208,9 +6292,8 @@ typing follows these rules: * Attributes propagate across assignments but are not changed by any use. - The last rule is particularly important. In the following program, -`a' has numeric type, even though it is later used in a string -operation: +The last rule is particularly important. In the following program, `a' +has numeric type, even though it is later used in a string operation: BEGIN { a = 12.345 @@ -6218,63 +6301,60 @@ operation: print b } - When two operands are compared, either string comparison or numeric +When two operands are compared, either string comparison or numeric comparison may be used. This depends upon the attributes of the operands, according to the following symmetric matrix: - +---------------------------------------------- + +--------------------------------------------- | STRING NUMERIC STRNUM - --------+---------------------------------------------- + -------+--------------------------------------------- | STRING | string string string | NUMERIC | string numeric numeric | STRNUM | string numeric numeric - --------+---------------------------------------------- + -------+--------------------------------------------- - The basic idea is that user input that looks numeric--and _only_ -user input--should be treated as numeric, even though it is actually -made of characters and is therefore also a string. Thus, for example, -the string constant `" +3.14"' is a string, even though it looks -numeric, and is _never_ treated as number for comparison purposes. +The basic idea is that user input that looks numeric--and _only_ user +input--should be treated as numeric, even though it is actually made of +characters and is therefore also a string. Thus, for example, the +string constant `" +3.14"' is a string, even though it looks numeric, +and is _never_ treated as number for comparison purposes. - In short, when one operand is a "pure" string, such as a string +In short, when one operand is a "pure" string, such as a string constant, then a string comparison is performed. Otherwise, a numeric comparison is performed.(1) - "Comparison expressions" compare strings or numbers for -relationships such as equality. They are written using "relational -operators", which are a superset of those in C. Here is a table of -them: - -`X < Y' - True if X is less than Y. - -`X <= Y' - True if X is less than or equal to Y. - -`X > Y' - True if X is greater than Y. - -`X >= Y' - True if X is greater than or equal to Y. - -`X == Y' - True if X is equal to Y. - -`X != Y' - True if X is not equal to Y. - -`X ~ Y' - True if the string X matches the regexp denoted by Y. +"Comparison expressions" compare strings or numbers for relationships +such as equality. They are written using "relational operators", which +are a superset of those in C. *Note table-relational-ops:: describes +them. -`X !~ Y' - True if the string X does not match the regexp denoted by Y. +Expression Result +-------------------------------------------------------------------------- +X `<' Y True if X is less than Y. +-------------------------------------------------------------------------- +X `<=' Y True if X is less than or equal to Y. +-------------------------------------------------------------------------- +X `>' Y True if X is greater than Y. +-------------------------------------------------------------------------- +X `>=' Y True if X is greater than or equal to Y. +-------------------------------------------------------------------------- +X `==' Y True if X is equal to Y. +-------------------------------------------------------------------------- +X `!=' Y True if X is not equal to Y. +-------------------------------------------------------------------------- +X `~' Y True if the string X matches the regexp denoted by Y. +-------------------------------------------------------------------------- +X `!~' Y True if the string X does not match the regexp + denoted by Y. +-------------------------------------------------------------------------- +SUBSCRIPT `in' True if the array ARRAY has an element with the +ARRAY subscript SUBSCRIPT. +-------------------------------------------------------------------------- -`SUBSCRIPT in ARRAY' - True if the array ARRAY has an element with the subscript - SUBSCRIPT. +Table 5.2: Relational Operators Comparison expressions have the value one if true and zero if false. When comparing operands of mixed types, numeric operands are converted @@ -6299,7 +6379,7 @@ Unless `b' happens to be zero or the null string, the `if' part of the test always succeeds. Because the operators are so similar, this kind of error is very difficult to spot when scanning the source code. - The following table of expressions illustrates the kind of comparison +The following table of expressions illustrates the kind of comparison `gawk' performs, as well as what the result of the comparison is: `1.5 <= 2.0' @@ -6323,7 +6403,7 @@ of error is very difficult to spot when scanning the source code. `a == b' string comparison (false) - In the next example: +In the next example: $ echo 1e2 3 | awk '{ print ($1 < $2) ? "true" : "false" }' -| false @@ -6346,48 +6426,47 @@ By contrast: has the value one if `x' contains `foo', such as `"Oh, what a fool am I!"'. - The righthand operand of the `~' and `!~' operators may be either a +The righthand operand of the `~' and `!~' operators may be either a regexp constant (`/.../') or an ordinary expression. In the latter case, the value of the expression as a string is used as a dynamic regexp (*note Regexp Usage::; also *note Computed Regexps::). - In modern implementations of `awk', a constant regular expression in +In modern implementations of `awk', a constant regular expression in slashes by itself is also an expression. The regexp `/REGEXP/' is an abbreviation for the following comparison expression: $0 ~ /REGEXP/ - One special place where `/foo/' is _not_ an abbreviation for `$0 ~ +One special place where `/foo/' is _not_ an abbreviation for `$0 ~ /foo/' is when it is the righthand operand of `~' or `!~'. *Note Using Constant Regexps::, where this is discussed in more detail. - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) The POSIX standard is under revision. The revised standard's -rules for typing and comparison are the same as just described for -`gawk'. +(1) The POSIX standard is under revision. The revised standard's rules +for typing and comparison are the same as just described for `gawk'.  File: gawk.info, Node: Boolean Ops, Next: Conditional Exp, Prev: Typing and Comparison, Up: Expressions -Boolean Expressions -=================== +5.11 Boolean Expressions +======================== - A "Boolean expression" is a combination of comparison expressions or +A "Boolean expression" is a combination of comparison expressions or matching expressions, using the Boolean operators "or" (`||'), "and" (`&&'), and "not" (`!'), along with parentheses to control nesting. The truth value of the Boolean expression is computed by combining the truth values of the component expressions. Boolean expressions are also referred to as "logical expressions". The terms are equivalent. - Boolean expressions can be used wherever comparison and matching +Boolean expressions can be used wherever comparison and matching expressions can be used. They can be used in `if', `while', `do', and `for' statements (*note Statements::). They have numeric values (one if true, zero if false) that come into play if the result of the Boolean expression is stored in a variable or used in arithmetic. - In addition, every Boolean expression is also a valid pattern, so -you can use one as a pattern to control the execution of rules. The +In addition, every Boolean expression is also a valid pattern, so you +can use one as a pattern to control the execution of rules. The Boolean operators are: `BOOLEAN1 && BOOLEAN2' @@ -6424,22 +6503,21 @@ Boolean operators are: (The `in' operator is described in *Note Reference to Elements::.) - The `&&' and `||' operators are called "short-circuit" operators +The `&&' and `||' operators are called "short-circuit" operators because of the way they work. Evaluation of the full expression is "short-circuited" if the result can be determined part way through its evaluation. - Statements that use `&&' or `||' can be continued simply by putting -a newline after them. But you cannot put a newline in front of either -of these operators without using backslash continuation (*note +Statements that use `&&' or `||' can be continued simply by putting a +newline after them. But you cannot put a newline in front of either of +these operators without using backslash continuation (*note Statements/Lines::). - The actual value of an expression using the `!' operator is either -one or zero, depending upon the truth value of the expression it is -applied to. The `!' operator is often useful for changing the sense of -a flag variable from false to true and back again. For example, the -following program is one way to print lines in between special -bracketing lines: +The actual value of an expression using the `!' operator is either one +or zero, depending upon the truth value of the expression it is applied +to. The `!' operator is often useful for changing the sense of a flag +variable from false to true and back again. For example, the following +program is one way to print lines in between special bracketing lines: $1 == "START" { interested = ! interested; next } interested == 1 { print } @@ -6452,18 +6530,19 @@ using `!'. The next rule prints lines as long as `interested' is true. When a line is seen whose first field is `END', `interested' is toggled back to false. - *Note:* The `next' statement is discussed in *Note Next Statement::. -`next' tells `awk' to skip the rest of the rules, get the next record, -and start processing the rules over again at the top. The reason it's -there is to avoid printing the bracketing `START' and `END' lines. + NOTE: The `next' statement is discussed in *Note Next Statement::. + `next' tells `awk' to skip the rest of the rules, get the next + record, and start processing the rules over again at the top. The + reason it's there is to avoid printing the bracketing `START' and + `END' lines.  File: gawk.info, Node: Conditional Exp, Next: Function Calls, Prev: Boolean Ops, Up: Expressions -Conditional Expressions -======================= +5.12 Conditional Expressions +============================ - A "conditional expression" is a special kind of expression that has +A "conditional expression" is a special kind of expression that has three operands. It allows you to use one expression's value to select one of two other expressions. The conditional expression is the same as in the C language, as shown here: @@ -6479,7 +6558,7 @@ following expression produces the absolute value of `x': x >= 0 ? x : -x - Each time the conditional expression is computed, only one of +Each time the conditional expression is computed, only one of IF-TRUE-EXP and IF-FALSE-EXP is used; the other is ignored. This is important when the expressions have side effects. For example, this conditional expression examines element `i' of either array `a' or @@ -6491,7 +6570,7 @@ This is guaranteed to increment `i' exactly once, because each time only one of the two increment expressions is executed and the other is not. *Note Arrays::, for more information about arrays. - As a minor `gawk' extension, a statement that uses `?:' can be +As a minor `gawk' extension, a statement that uses `?:' can be continued simply by putting a newline after either character. However, putting a newline in front of either character does not work without using backslash continuation (*note Statements/Lines::). If `--posix' @@ -6500,21 +6579,21 @@ is specified (*note Options::), then this extension is disabled.  File: gawk.info, Node: Function Calls, Next: Precedence, Prev: Conditional Exp, Up: Expressions -Function Calls -============== +5.13 Function Calls +=================== - A "function" is a name for a particular calculation. This enables -you to ask for it by name at any point in the program. For example, -the function `sqrt' computes the square root of a number. +A "function" is a name for a particular calculation. This enables you +to ask for it by name at any point in the program. For example, the +function `sqrt' computes the square root of a number. - A fixed set of functions are "built-in", which means they are -available in every `awk' program. The `sqrt' function is one of these. -*Note Built-in::, for a list of built-in functions and their -descriptions. In addition, you can define functions for use in your -program. *Note User-defined::, for instructions on how to do this. +A fixed set of functions are "built-in", which means they are available +in every `awk' program. The `sqrt' function is one of these. *Note +Built-in::, for a list of built-in functions and their descriptions. +In addition, you can define functions for use in your program. *Note +User-defined::, for instructions on how to do this. - The way to use a function is with a "function call" expression, -which consists of the function name followed immediately by a list of +The way to use a function is with a "function call" expression, which +consists of the function name followed immediately by a list of "arguments" in parentheses. The arguments are expressions that provide the raw materials for the function's calculations. When there is more than one argument, they are separated by commas. If there are no @@ -6525,28 +6604,27 @@ examples show function calls with and without arguments: atan2(y, x) two arguments rand() no arguments - *Caution:* Do not put any space between the function name and the +*Caution:* Do not put any space between the function name and the open-parenthesis! A user-defined function name looks just like the name of a variable--a space would make the expression look like concatenation of a variable with an expression inside parentheses. - With built-in functions, space before the parenthesis is harmless, -but it is best not to get into the habit of using space to avoid -mistakes with user-defined functions. Each function expects a -particular number of arguments. For example, the `sqrt' function must -be called with a single argument, the number of which to take the -square root: +With built-in functions, space before the parenthesis is harmless, but +it is best not to get into the habit of using space to avoid mistakes +with user-defined functions. Each function expects a particular number +of arguments. For example, the `sqrt' function must be called with a +single argument, the number of which to take the square root: sqrt(ARGUMENT) - Some of the built-in functions have one or more optional arguments. -If those arguments are not supplied, the functions use a reasonable +Some of the built-in functions have one or more optional arguments. If +those arguments are not supplied, the functions use a reasonable default value. *Note Built-in::, for full details. If arguments are omitted in calls to user-defined functions, then those arguments are treated as local variables and initialized to the empty string (*note User-defined::). - Like every other expression, the function call has a value, which is +Like every other expression, the function call has a value, which is computed by the function based on the arguments you give it. In this example, the value of `sqrt(ARGUMENT)' is the square root of ARGUMENT. A function can also have side effects, such as assigning values to @@ -6565,15 +6643,15 @@ one number per line, and prints the square root of each one:  File: gawk.info, Node: Precedence, Prev: Function Calls, Up: Expressions -Operator Precedence (How Operators Nest) -======================================== +5.14 Operator Precedence (How Operators Nest) +============================================= - "Operator precedence" determines how operators are grouped when +"Operator precedence" determines how operators are grouped when different operators appear close by in one expression. For example, `*' has higher precedence than `+'; thus, `a + b * c' means to multiply `b' and `c', and then add `a' to the product (i.e., `a + (b * c)'). - The normal precedence of the operators can be overruled by using +The normal precedence of the operators can be overruled by using parentheses. Think of the precedence rules as saying where the parentheses are assumed to be. In fact, it is wise to always use parentheses whenever there is an unusual combination of operators, @@ -6582,20 +6660,20 @@ precedence is in this case. Even experienced programmers occasionally forget the exact rules, which leads to mistakes. Explicit parentheses help prevent any such mistakes. - When operators of equal precedence are used together, the leftmost +When operators of equal precedence are used together, the leftmost operator groups first, except for the assignment, conditional, and exponentiation operators, which group in the opposite order. Thus, `a - b + c' groups as `(a - b) + c' and `a = b = c' groups as `a = (b = c)'. - The precedence of prefix unary operators does not matter as long as -only unary operators are involved, because there is only one way to -interpret them: innermost first. Thus, `$++i' means `$(++i)' and -`++$x' means `++($x)'. However, when another operator follows the -operand, then the precedence of the unary operators can matter. `$x^2' -means `($x)^2', but `-x^2' means `-(x^2)', because `-' has lower -precedence than `^', whereas `$' has higher precedence. This table -presents `awk''s operators, in order of highest to lowest precedence: +The precedence of prefix unary operators does not matter as long as only +unary operators are involved, because there is only one way to interpret +them: innermost first. Thus, `$++i' means `$(++i)' and `++$x' means +`++($x)'. However, when another operator follows the operand, then the +precedence of the unary operators can matter. `$x^2' means `($x)^2', +but `-x^2' means `-(x^2)', because `-' has lower precedence than `^', +whereas `$' has higher precedence. This table presents `awk''s +operators, in order of highest to lowest precedence: `(...)' Grouping. @@ -6657,21 +6735,21 @@ presents `awk''s operators, in order of highest to lowest precedence: `/= %= ^= **=' Assignment. These operators group right to left. - *Note:* The `|&', `**', and `**=' operators are not specified by -POSIX. For maximum portability, do not use them. + NOTE: The `|&', `**', and `**=' operators are not specified by + POSIX. For maximum portability, do not use them.  File: gawk.info, Node: Patterns and Actions, Next: Arrays, Prev: Expressions, Up: Top -Patterns, Actions, and Variables -******************************** +6 Patterns, Actions, and Variables +********************************** - As you have already seen, each `awk' statement consists of a pattern +As you have already seen, each `awk' statement consists of a pattern with an associated action. This major node describes how you build patterns and actions, what kinds of things you can do within actions, and `awk''s built-in variables. - The pattern-action rules and the statements available for use within +The pattern-action rules and the statements available for use within actions form the core of `awk' programming. In a sense, everything covered up to here has been the foundation that programs are built on top of. Now it's time to start building something useful. @@ -6688,8 +6766,8 @@ top of. Now it's time to start building something useful.  File: gawk.info, Node: Pattern Overview, Next: Using Shell Variables, Up: Patterns and Actions -Pattern Elements -================ +6.1 Pattern Elements +==================== * Menu: @@ -6699,7 +6777,7 @@ Pattern Elements * BEGIN/END:: Specifying initialization and cleanup rules. * Empty:: The empty pattern, which matches every record. - Patterns in `awk' control the execution of rules--a rule is executed +Patterns in `awk' control the execution of rules--a rule is executed when its pattern matches the current input record. The following is a summary of the types of `awk' patterns: @@ -6727,11 +6805,11 @@ summary of the types of `awk' patterns:  File: gawk.info, Node: Regexp Patterns, Next: Expression Patterns, Up: Pattern Overview -Regular Expressions as Patterns -------------------------------- +6.1.1 Regular Expressions as Patterns +------------------------------------- - Regular expressions are one of the first kinds of patterns presented -in this book. This kind of pattern is simply a regexp constant in the +Regular expressions are one of the first kinds of patterns presented in +this book. This kind of pattern is simply a regexp constant in the pattern part of a rule. Its meaning is `$0 ~ /PATTERN/'. The pattern matches when the input record matches the regexp. For example: @@ -6741,18 +6819,18 @@ matches when the input record matches the regexp. For example:  File: gawk.info, Node: Expression Patterns, Next: Ranges, Prev: Regexp Patterns, Up: Pattern Overview -Expressions as Patterns ------------------------ +6.1.2 Expressions as Patterns +----------------------------- - Any `awk' expression is valid as an `awk' pattern. The pattern -matches if the expression's value is nonzero (if a number) or non-null -(if a string). The expression is reevaluated each time the rule is -tested against a new input record. If the expression uses fields such -as `$1', the value depends directly on the new input record's text; +Any `awk' expression is valid as an `awk' pattern. The pattern matches +if the expression's value is nonzero (if a number) or non-null (if a +string). The expression is reevaluated each time the rule is tested +against a new input record. If the expression uses fields such as +`$1', the value depends directly on the new input record's text; otherwise, it depends on only what has happened so far in the execution of the `awk' program. - Comparison expressions, using the comparison operators described in +Comparison expressions, using the comparison operators described in *Note Typing and Comparison::, are a very common kind of pattern. Regexp matching and nonmatching are also very common expressions. The left operand of the `~' and `!~' operators is a string. The right @@ -6774,12 +6852,12 @@ which accepts any record with a first field that contains `foo': -| 555-6480 -| 555-2127 - A regexp constant as a pattern is also a special case of an -expression pattern. The expression `/foo/' has the value one if `foo' -appears in the current input record. Thus, as a pattern, `/foo/' -matches any record containing `foo'. +A regexp constant as a pattern is also a special case of an expression +pattern. The expression `/foo/' has the value one if `foo' appears in +the current input record. Thus, as a pattern, `/foo/' matches any +record containing `foo'. - Boolean expressions are also commonly used as patterns. Whether the +Boolean expressions are also commonly used as patterns. Whether the pattern matches an input record depends on whether its subexpressions match. For example, the following command prints all the records in `BBS-list' that contain both `2400' and `foo': @@ -6787,7 +6865,7 @@ match. For example, the following command prints all the records in $ awk '/2400/ && /foo/' BBS-list -| fooey 555-1234 2400/1200/300 B - The following command prints all records in `BBS-list' that contain +The following command prints all records in `BBS-list' that contain _either_ `2400' or `foo' (or both, of course): $ awk '/2400/ || /foo/' BBS-list @@ -6799,7 +6877,7 @@ _either_ `2400' or `foo' (or both, of course): -| sdace 555-3430 2400/1200/300 A -| sabafoo 555-2127 1200/300 C - The following command prints all records in `BBS-list' that do _not_ +The following command prints all records in `BBS-list' that do _not_ contain the string `foo': $ awk '! /foo/' BBS-list @@ -6811,30 +6889,30 @@ contain the string `foo': -| core 555-2912 1200/300 C -| sdace 555-3430 2400/1200/300 A - The subexpressions of a Boolean operator in a pattern can be -constant regular expressions, comparisons, or any other `awk' -expressions. Range patterns are not expressions, so they cannot appear -inside Boolean patterns. Likewise, the special patterns `BEGIN' and -`END', which never match any input record, are not expressions and -cannot appear inside Boolean patterns. +The subexpressions of a Boolean operator in a pattern can be constant +regular expressions, comparisons, or any other `awk' expressions. Range +patterns are not expressions, so they cannot appear inside Boolean +patterns. Likewise, the special patterns `BEGIN' and `END', which +never match any input record, are not expressions and cannot appear +inside Boolean patterns.  File: gawk.info, Node: Ranges, Next: BEGIN/END, Prev: Expression Patterns, Up: Pattern Overview -Specifying Record Ranges with Patterns --------------------------------------- +6.1.3 Specifying Record Ranges with Patterns +-------------------------------------------- - A "range pattern" is made of two patterns separated by a comma, in -the form `BEGPAT, ENDPAT'. It is used to match ranges of consecutive -input records. The first pattern, BEGPAT, controls where the range -begins, while ENDPAT controls where the pattern ends. For example, the +A "range pattern" is made of two patterns separated by a comma, in the +form `BEGPAT, ENDPAT'. It is used to match ranges of consecutive input +records. The first pattern, BEGPAT, controls where the range begins, +while ENDPAT controls where the pattern ends. For example, the following: awk '$1 == "on", $1 == "off"' myfile prints every record in `myfile' between `on'/`off' pairs, inclusive. - A range pattern starts out by matching BEGPAT against every input +A range pattern starts out by matching BEGPAT against every input record. When a record matches BEGPAT, the range pattern is "turned on" and the range pattern matches this record as well. As long as the range pattern stays turned on, it automatically matches every input @@ -6843,12 +6921,12 @@ record; when this succeeds, the range pattern is turned off again for the following record. Then the range pattern goes back to checking BEGPAT against each record. - The record that turns on the range pattern and the one that turns it +The record that turns on the range pattern and the one that turns it off both match the range pattern. If you don't want to operate on these records, you can write `if' statements in the rule's action to distinguish them from the records you are interested in. - It is possible for a pattern to be turned on and off by the same +It is possible for a pattern to be turned on and off by the same record. If the record satisfies both conditions, then the action is executed for just that record. For example, suppose there is text between two identical markers (e.g., the `%' symbol), each on its own @@ -6869,13 +6947,13 @@ a flag: /^%$/ { skip = ! skip; next } skip == 1 { next } # skip lines with `skip' set - In a range pattern, the comma (`,') has the lowest precedence of all +In a range pattern, the comma (`,') has the lowest precedence of all the operators (i.e., it is evaluated last). Thus, the following program attempts to combine a range pattern with another, simpler test: echo Yes | awk '/1/,/2/ || /Yes/' - The intent of this program is `(/1/,/2/) || /Yes/'. However, `awk' +The intent of this program is `(/1/,/2/) || /Yes/'. However, `awk' interprets this as `/1/, (/2/ || /Yes/)'. This cannot be changed or worked around; range patterns do not combine with other patterns: @@ -6888,16 +6966,16 @@ worked around; range patterns do not combine with other patterns:  File: gawk.info, Node: BEGIN/END, Next: Empty, Prev: Ranges, Up: Pattern Overview -The `BEGIN' and `END' Special Patterns --------------------------------------- +6.1.4 The `BEGIN' and `END' Special Patterns +-------------------------------------------- - All the patterns described so far are for matching input records. -The `BEGIN' and `END' special patterns are different. They supply -startup and cleanup actions for `awk' programs. `BEGIN' and `END' -rules must have actions; there is no default action for these rules -because there is no current record when they run. `BEGIN' and `END' -rules are often referred to as "`BEGIN' and `END' blocks" by long-time -`awk' programmers. +All the patterns described so far are for matching input records. The +`BEGIN' and `END' special patterns are different. They supply startup +and cleanup actions for `awk' programs. `BEGIN' and `END' rules must +have actions; there is no default action for these rules because there +is no current record when they run. `BEGIN' and `END' rules are often +referred to as "`BEGIN' and `END' blocks" by long-time `awk' +programmers. * Menu: @@ -6907,11 +6985,11 @@ rules are often referred to as "`BEGIN' and `END' blocks" by long-time  File: gawk.info, Node: Using BEGIN/END, Next: I/O And BEGIN/END, Up: BEGIN/END -Startup and Cleanup Actions -........................... +6.1.4.1 Startup and Cleanup Actions +................................... - A `BEGIN' rule is executed once only, before the first input record -is read. Likewise, an `END' rule is executed once only, after all the +A `BEGIN' rule is executed once only, before the first input record is +read. Likewise, an `END' rule is executed once only, after all the input is read. For example: $ awk ' @@ -6921,7 +6999,7 @@ input is read. For example: -| Analysis of "foo" -| "foo" appears 4 times. - This program finds the number of records in the input file `BBS-list' +This program finds the number of records in the input file `BBS-list' that contain the string `foo'. The `BEGIN' rule prints a title for the report. There is no need to use the `BEGIN' rule to initialize the counter `n' to zero, since `awk' does this automatically (*note @@ -6929,11 +7007,11 @@ Variables::). The second rule increments the variable `n' every time a record containing the pattern `foo' is read. The `END' rule prints the value of `n' at the end of the run. - The special patterns `BEGIN' and `END' cannot be used in ranges or -with Boolean operators (indeed, they cannot be used with any operators). -An `awk' program may have multiple `BEGIN' and/or `END' rules. They -are executed in the order in which they appear: all the `BEGIN' rules -at startup and all the `END' rules at termination. `BEGIN' and `END' +The special patterns `BEGIN' and `END' cannot be used in ranges or with +Boolean operators (indeed, they cannot be used with any operators). An +`awk' program may have multiple `BEGIN' and/or `END' rules. They are +executed in the order in which they appear: all the `BEGIN' rules at +startup and all the `END' rules at termination. `BEGIN' and `END' rules may be intermixed with other rules. This feature was added in the 1987 version of `awk' and is included in the POSIX standard. The original (1978) version of `awk' required the `BEGIN' rule to be placed @@ -6942,7 +7020,7 @@ end, and only allowed one of each. This is no longer required, but it is a good idea to follow this template in terms of program organization and readability. - Multiple `BEGIN' and `END' rules are useful for writing library +Multiple `BEGIN' and `END' rules are useful for writing library functions, because each library file can have its own `BEGIN' and/or `END' rule to do its own initialization and/or cleanup. The order in which library functions are named on the command line controls the @@ -6952,44 +7030,44 @@ the order in which they are executed doesn't matter. *Note Options::, for more information on using library functions. *Note Library Functions::, for a number of useful library functions. - If an `awk' program has only a `BEGIN' rule and no other rules, then +If an `awk' program has only a `BEGIN' rule and no other rules, then the program exits after the `BEGIN' rule is run.(1) However, if an `END' rule exists, then the input is read, even if there are no other rules in the program. This is necessary in case the `END' rule checks the `FNR' and `NR' variables. - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) The original version of `awk' used to keep reading and ignoring +(1) The original version of `awk' used to keep reading and ignoring input until the end of the file was seen.  File: gawk.info, Node: I/O And BEGIN/END, Prev: Using BEGIN/END, Up: BEGIN/END -Input/Output from `BEGIN' and `END' Rules -......................................... +6.1.4.2 Input/Output from `BEGIN' and `END' Rules +................................................. - There are several (sometimes subtle) points to remember when doing -I/O from a `BEGIN' or `END' rule. The first has to do with the value -of `$0' in a `BEGIN' rule. Because `BEGIN' rules are executed before -any input is read, there simply is no input record, and therefore no +There are several (sometimes subtle) points to remember when doing I/O +from a `BEGIN' or `END' rule. The first has to do with the value of +`$0' in a `BEGIN' rule. Because `BEGIN' rules are executed before any +input is read, there simply is no input record, and therefore no fields, when executing `BEGIN' rules. References to `$0' and the fields yield a null string or zero, depending upon the context. One way to give `$0' a real value is to execute a `getline' command without a variable (*note Getline::). Another way is simply to assign a value to `$0'. - The second point is similar to the first but from the other -direction. Traditionally, due largely to implementation issues, `$0' -and `NF' were _undefined_ inside an `END' rule. The POSIX standard -specifies that `NF' is available in an `END' rule. It contains the -number of fields from the last input record. Most probably due to an -oversight, the standard does not say that `$0' is also preserved, -although logically one would think that it should be. In fact, `gawk' -does preserve the value of `$0' for use in `END' rules. Be aware, -however, that Unix `awk', and possibly other implementations, do not. - - The third point follows from the first two. The meaning of `print' +The second point is similar to the first but from the other direction. +Traditionally, due largely to implementation issues, `$0' and `NF' were +_undefined_ inside an `END' rule. The POSIX standard specifies that +`NF' is available in an `END' rule. It contains the number of fields +from the last input record. Most probably due to an oversight, the +standard does not say that `$0' is also preserved, although logically +one would think that it should be. In fact, `gawk' does preserve the +value of `$0' for use in `END' rules. Be aware, however, that Unix +`awk', and possibly other implementations, do not. + +The third point follows from the first two. The meaning of `print' inside a `BEGIN' or `END' rule is the same as always: `print $0'. If `$0' is the null string, then this prints an empty line. Many long time `awk' programmers use an unadorned `print' in `BEGIN' and `END' @@ -6999,7 +7077,7 @@ idea in `END' rules, at least in `gawk'. It is also poor style, since if an empty line is needed in the output, the program should print one explicitly. - Finally, the `next' and `nextfile' statements are not allowed in a +Finally, the `next' and `nextfile' statements are not allowed in a `BEGIN' rule, because the implicit read-a-record-and-match-against-the-rules loop has not started yet. Similarly, those statements are not valid in an `END' rule, since all @@ -7009,10 +7087,10 @@ Nextfile Statement::.)  File: gawk.info, Node: Empty, Prev: BEGIN/END, Up: Pattern Overview -The Empty Pattern ------------------ +6.1.5 The Empty Pattern +----------------------- - An empty (i.e., nonexistent) pattern is considered to match _every_ +An empty (i.e., nonexistent) pattern is considered to match _every_ input record. For example, the program: awk '{ print $1 }' BBS-list @@ -7022,16 +7100,16 @@ prints the first field of every record.  File: gawk.info, Node: Using Shell Variables, Next: Action Overview, Prev: Pattern Overview, Up: Patterns and Actions -Using Shell Variables in Programs -================================= +6.2 Using Shell Variables in Programs +===================================== - `awk' programs are often used as components in larger programs -written in shell. For example, it is very common to use a shell -variable to hold a pattern that the `awk' program searches for. There -are two ways to get the value of the shell variable into the body of -the `awk' program. +`awk' programs are often used as components in larger programs written +in shell. For example, it is very common to use a shell variable to +hold a pattern that the `awk' program searches for. There are two ways +to get the value of the shell variable into the body of the `awk' +program. - The most common method is to use shell quoting to substitute the +The most common method is to use shell quoting to substitute the variable's value into the program inside the script. For example, in the following program: @@ -7045,12 +7123,12 @@ concatenated together to form the program. The first part is double-quoted, which allows substitution of the `pattern' variable inside the quotes. The second part is single-quoted. - Variable substitution via quoting works, but can be potentially -messy. It requires a good understanding of the shell's quoting rules -(*note Quoting::), and it's often difficult to correctly match up the -quotes when reading the program. +Variable substitution via quoting works, but can be potentially messy. +It requires a good understanding of the shell's quoting rules (*note +Quoting::), and it's often difficult to correctly match up the quotes +when reading the program. - A better method is to use `awk''s variable assignment feature (*note +A better method is to use `awk''s variable assignment feature (*note Assignment Options::) to assign the shell variable's value to an `awk' variable's value. Then use dynamic regexps to match the pattern (*note Computed Regexps::). The following shows how to redo the previous @@ -7073,15 +7151,15 @@ at every point in the program.  File: gawk.info, Node: Action Overview, Next: Statements, Prev: Using Shell Variables, Up: Patterns and Actions -Actions -======= +6.3 Actions +=========== - An `awk' program or script consists of a series of rules and -function definitions interspersed. (Functions are described later. -*Note User-defined::.) A rule contains a pattern and an action, either -of which (but not both) may be omitted. The purpose of the "action" is -to tell `awk' what to do once a match for the pattern is found. Thus, -in outline, an `awk' program generally looks like this: +An `awk' program or script consists of a series of rules and function +definitions interspersed. (Functions are described later. *Note +User-defined::.) A rule contains a pattern and an action, either of +which (but not both) may be omitted. The purpose of the "action" is to +tell `awk' what to do once a match for the pattern is found. Thus, in +outline, an `awk' program generally looks like this: [PATTERN] [{ ACTION }] [PATTERN] [{ ACTION }] @@ -7089,8 +7167,8 @@ in outline, an `awk' program generally looks like this: function NAME(ARGS) { ... } ... - An action consists of one or more `awk' "statements", enclosed in -curly braces (`{...}'). Each statement specifies one thing to do. The +An action consists of one or more `awk' "statements", enclosed in curly +braces (`{...}'). Each statement specifies one thing to do. The statements are separated by newlines or semicolons. The curly braces around an action must be used even if the action contains only one statement, or if it contains no statements at all. However, if you @@ -7100,7 +7178,7 @@ action is equivalent to `{ print $0 }': /foo/ { } match `foo', do nothing -- empty action /foo/ match `foo', print the record -- omitted action - The following types of statements are supported in `awk': +The following types of statements are supported in `awk': Expressions Call functions or assign values to variables (*note @@ -7132,14 +7210,14 @@ Deletion statements  File: gawk.info, Node: Statements, Next: Built-in Variables, Prev: Action Overview, Up: Patterns and Actions -Control Statements in Actions -============================= +6.4 Control Statements in Actions +================================= - "Control statements", such as `if', `while', and so on, control the +"Control statements", such as `if', `while', and so on, control the flow of execution in `awk' programs. Most of the control statements in `awk' are patterned on similar statements in C. - All the control statements start with special keywords, such as `if' +All the control statements start with special keywords, such as `if' and `while', to distinguish them from simple expressions. Many control statements contain other statements. For example, the `if' statement contains another statement that may or may not be executed. The @@ -7168,10 +7246,10 @@ with curly braces, separating them with newlines or semicolons.  File: gawk.info, Node: If Statement, Next: While Statement, Up: Statements -The `if'-`else' Statement -------------------------- +6.4.1 The `if'-`else' Statement +------------------------------- - The `if'-`else' statement is `awk''s decision-making statement. It +The `if'-`else' statement is `awk''s decision-making statement. It looks like this: if (CONDITION) THEN-BODY [else ELSE-BODY] @@ -7188,7 +7266,7 @@ following: else print "x is odd" - In this example, if the expression `x % 2 == 0' is true (that is, if +In this example, if the expression `x % 2 == 0' is true (that is, if the value of `x' is evenly divisible by two), then the first `print' statement is executed; otherwise, the second `print' statement is executed. If the `else' keyword appears on the same line as THEN-BODY @@ -7207,10 +7285,10 @@ first thing on its line.  File: gawk.info, Node: While Statement, Next: Do Statement, Prev: If Statement, Up: Statements -The `while' Statement ---------------------- +6.4.2 The `while' Statement +--------------------------- - In programming, a "loop" is a part of a program that can be executed +In programming, a "loop" is a part of a program that can be executed two or more times in succession. The `while' statement is the simplest looping statement in `awk'. It repeatedly executes a statement as long as a condition is true. For example: @@ -7245,19 +7323,19 @@ tests whether `i' is less than or equal to three. This is true when increments the value of `i' and the loop repeats. The loop terminates when `i' reaches four. - A newline is not required between the condition and the body; -however using one makes the program clearer unless the body is a -compound statement or else is very simple. The newline after the -open-brace that begins the compound statement is not required either, -but the program is harder to read without it. +A newline is not required between the condition and the body; however +using one makes the program clearer unless the body is a compound +statement or else is very simple. The newline after the open-brace +that begins the compound statement is not required either, but the +program is harder to read without it.  File: gawk.info, Node: Do Statement, Next: For Statement, Prev: While Statement, Up: Statements -The `do'-`while' Statement --------------------------- +6.4.3 The `do'-`while' Statement +-------------------------------- - The `do' loop is a variation of the `while' looping statement. The +The `do' loop is a variation of the `while' looping statement. The `do' loop executes the BODY once and then repeats the BODY as long as the CONDITION is true. It looks like this: @@ -7265,7 +7343,7 @@ the CONDITION is true. It looks like this: BODY while (CONDITION) - Even if the CONDITION is false at the start, the BODY is executed at +Even if the CONDITION is false at the start, the BODY is executed at least once (and only once, unless executing BODY makes CONDITION true). Contrast this with the corresponding `while' statement: @@ -7290,10 +7368,10 @@ occasionally is there a real use for a `do' statement.  File: gawk.info, Node: For Statement, Next: Switch Statement, Prev: Do Statement, Up: Statements -The `for' Statement -------------------- +6.4.4 The `for' Statement +------------------------- - The `for' statement makes it more convenient to count iterations of a +The `for' statement makes it more convenient to count iterations of a loop. The general form of the `for' statement looks like this: for (INITIALIZATION; CONDITION; INCREMENT) @@ -7302,8 +7380,8 @@ loop. The general form of the `for' statement looks like this: The INITIALIZATION, CONDITION, and INCREMENT parts are arbitrary `awk' expressions, and BODY stands for any `awk' statement. - The `for' statement starts by executing INITIALIZATION. Then, as -long as the CONDITION is true, it repeatedly executes BODY and then +The `for' statement starts by executing INITIALIZATION. Then, as long +as the CONDITION is true, it repeatedly executes BODY and then INCREMENT. Typically, INITIALIZATION sets a variable to either zero or one, INCREMENT adds one to it, and CONDITION compares it against the desired number of iterations. For example: @@ -7315,19 +7393,18 @@ desired number of iterations. For example: This prints the first three fields of each input record, with one field per line. - It isn't possible to set more than one variable in the -INITIALIZATION part without using a multiple assignment statement such -as `x = y = 0'. This makes sense only if all the initial values are -equal. (But it is possible to initialize additional variables by -writing their assignments as separate statements preceding the `for' -loop.) +It isn't possible to set more than one variable in the INITIALIZATION +part without using a multiple assignment statement such as `x = y = 0'. +This makes sense only if all the initial values are equal. (But it is +possible to initialize additional variables by writing their +assignments as separate statements preceding the `for' loop.) - The same is true of the INCREMENT part. Incrementing additional +The same is true of the INCREMENT part. Incrementing additional variables requires separate statements at the end of the loop. The C compound expression, using C's comma operator, is useful in this context but it is not supported in `awk'. - Most often, INCREMENT is an increment expression, as in the previous +Most often, INCREMENT is an increment expression, as in the previous example. But this is not required; it can be any expression whatsoever. For example, the following statement prints all the powers of two between 1 and 100: @@ -7335,14 +7412,14 @@ of two between 1 and 100: for (i = 1; i <= 100; i *= 2) print i - If there is nothing to be done, any of the three expressions in the +If there is nothing to be done, any of the three expressions in the parentheses following the `for' keyword may be omitted. Thus, `for (; x > 0;)' is equivalent to `while (x > 0)'. If the CONDITION is omitted, it is treated as true, effectively yielding an "infinite loop" (i.e., a loop that never terminates). - In most cases, a `for' loop is an abbreviation for a `while' loop, -as shown here: +In most cases, a `for' loop is an abbreviation for a `while' loop, as +shown here: INITIALIZATION while (CONDITION) { @@ -7355,14 +7432,14 @@ Statement::) is used inside the loop. Changing a `for' statement to a `while' statement in this way can change the effect of the `continue' statement inside the loop. - The `awk' language has a `for' statement in addition to a `while' +The `awk' language has a `for' statement in addition to a `while' statement because a `for' loop is often both less work to type and more natural to think of. Counting the number of iterations is very common in loops. It can be easier to think of this counting as part of looping rather than as something to do inside the loop. - There is an alternate version of the `for' loop, for iterating over -all the indices of an array: +There is an alternate version of the `for' loop, for iterating over all +the indices of an array: for (i in array) DO SOMETHING WITH array[i] @@ -7373,20 +7450,27 @@ all the indices of an array:  File: gawk.info, Node: Switch Statement, Next: Break Statement, Prev: For Statement, Up: Statements -The `switch' Statement ----------------------- +6.4.5 The `switch' Statement +---------------------------- - *NOTE:* This node describes an experimental feature added in `gawk' +*NOTE:* This node describes an experimental feature added in `gawk' 3.1.3. It is _not_ enabled by default. To enable it, use the `--enable-switch' option to `configure' when `gawk' is being configured and built. *Note Additional Configuration Options::, for more information. - The `switch' statement allows the evaluation of an expression and -the execution of statements based on a `case' match. Case statements -are checked for a match in the order they are defined. If no suitable -`case' is found, the `default' section is executed, if supplied. The -general form of the `switch' statement looks like this: +The `switch' statement allows the evaluation of an expression and the +execution of statements based on a `case' match. Case statements are +checked for a match in the order they are defined. If no suitable +`case' is found, the `default' section is executed, if supplied. + +Each `case' contains a single constant, be it numeric, string, or +regexp. The `switch' expression is evaluated, and then each `case''s +constant is compared against the result in turn. The type of constant +determines the comparison: numeric or string do the usual comparisons. +A regexp constant does a regular expression match against the string +value of the original expression. The general form of the `switch' +statement looks like this: switch (EXPRESSION) { case VALUE OR REGULAR EXPRESSION: @@ -7395,30 +7479,30 @@ general form of the `switch' statement looks like this: DEFAULT-BODY } - The `switch' statement works as it does in C. Once a match to a given -case is made, case statement bodies are executed until a `break', -`continue', `next', `nextfile' or `exit' is encountered, or the end of -the `switch' statement itself. For example: +Control flow in the `switch' statement works as it does in C. Once a +match to a given case is made, case statement bodies are executed until +a `break', `continue', `next', `nextfile' or `exit' is encountered, or +the end of the `switch' statement itself. For example: switch (NR * 2 + 1) { case 3: case "11": print NR - 1 break - + case /2[[:digit:]]+/: print NR - + default: print NR + 1 - + case -1: print NR * -1 } - Note that if none of the statements specified above halt execution -of a matched `case' statement, execution falls through to the next -`case' until execution halts. In the above example, for any case value +Note that if none of the statements specified above halt execution of a +matched `case' statement, execution falls through to the next `case' +until execution halts. In the above example, for any case value starting with `2' followed by one or more digits, the `print' statement is executed and then falls through into the `default' section, executing its `print' statement. In turn, the -1 case will also be @@ -7427,10 +7511,10 @@ executed since the `default' does not halt execution.  File: gawk.info, Node: Break Statement, Next: Continue Statement, Prev: Switch Statement, Up: Statements -The `break' Statement ---------------------- +6.4.6 The `break' Statement +--------------------------- - The `break' statement jumps out of the innermost `for', `while', or +The `break' statement jumps out of the innermost `for', `while', or `do' loop that encloses it. The following example finds the smallest divisor of any integer, and also identifies prime numbers: @@ -7446,14 +7530,14 @@ divisor of any integer, and also identifies prime numbers: printf "%d is prime\n", num } - When the remainder is zero in the first `if' statement, `awk' +When the remainder is zero in the first `if' statement, `awk' immediately "breaks out" of the containing `for' loop. This means that `awk' proceeds immediately to the statement following the loop and continues processing. (This is very different from the `exit' statement, which stops the entire `awk' program. *Note Exit Statement::.) - Th following program illustrates how the CONDITION of a `for' or +Th following program illustrates how the CONDITION of a `for' or `while' statement could be replaced with a `break' inside an `if': # find smallest divisor of num @@ -7471,7 +7555,7 @@ Statement::.) } } - The `break' statement has no meaning when used outside the body of a +The `break' statement has no meaning when used outside the body of a loop. However, although it was never documented, historical implementations of `awk' treated the `break' statement outside of a loop as if it were a `next' statement (*note Next Statement::). Recent @@ -7484,16 +7568,16 @@ inside the body of a loop. (d.c.)  File: gawk.info, Node: Continue Statement, Next: Next Statement, Prev: Break Statement, Up: Statements -The `continue' Statement ------------------------- +6.4.7 The `continue' Statement +------------------------------ - As with `break', the `continue' statement is used only inside `for', +As with `break', the `continue' statement is used only inside `for', `while', and `do' loops. It skips over the rest of the loop body, causing the next cycle around the loop to begin immediately. Contrast this with `break', which jumps out of the loop altogether. - The `continue' statement in a `for' loop directs `awk' to skip the -rest of the body of the loop and resume execution with the +The `continue' statement in a `for' loop directs `awk' to skip the rest +of the body of the loop and resume execution with the increment-expression of the `for' statement. The following program illustrates this fact: @@ -7524,8 +7608,8 @@ the previous example with the following `while' loop: This program loops forever once `x' reaches 5. - The `continue' statement has no meaning when used outside the body of -a loop. Historical versions of `awk' treated a `continue' statement +The `continue' statement has no meaning when used outside the body of a +loop. Historical versions of `awk' treated a `continue' statement outside a loop the same way they treated a `break' statement outside a loop: as if it were a `next' statement (*note Next Statement::). Recent versions of Unix `awk' no longer work this way, and `gawk' @@ -7537,28 +7621,28 @@ specifies that `continue' should only be used inside the body of a loop.  File: gawk.info, Node: Next Statement, Next: Nextfile Statement, Prev: Continue Statement, Up: Statements -The `next' Statement --------------------- +6.4.8 The `next' Statement +-------------------------- - The `next' statement forces `awk' to immediately stop processing the +The `next' statement forces `awk' to immediately stop processing the current record and go on to the next record. This means that no further rules are executed for the current record, and the rest of the current rule's action isn't executed. - Contrast this with the effect of the `getline' function (*note +Contrast this with the effect of the `getline' function (*note Getline::). That also causes `awk' to read the next record immediately, but it does not alter the flow of control in any way (i.e., the rest of the current action executes with a new input record). - At the highest level, `awk' program execution is a loop that reads -an input record and then tests each rule's pattern against it. If you +At the highest level, `awk' program execution is a loop that reads an +input record and then tests each rule's pattern against it. If you think of this loop as a `for' statement whose body contains the rules, then the `next' statement is analogous to a `continue' statement. It skips to the end of the body of this implicit loop and executes the increment (which reads another record). - For example, suppose an `awk' program works only on records with -four fields, and it shouldn't fail when given bad input. To avoid +For example, suppose an `awk' program works only on records with four +fields, and it shouldn't fail when given bad input. To avoid complicating the rest of the program, write a "weed out" rule near the beginning, in the following manner: @@ -7573,7 +7657,7 @@ see the bad record. The error message is redirected to the standard error output stream, as error messages should be. For more detail see *Note Special Files::. - According to the POSIX standard, the behavior is undefined if the +According to the POSIX standard, the behavior is undefined if the `next' statement is used in a `BEGIN' or `END' rule. `gawk' treats it as a syntax error. Although POSIX permits it, some other `awk' implementations don't allow the `next' statement inside function bodies @@ -7586,19 +7670,19 @@ any `END' rules is executed. *Note BEGIN/END::.  File: gawk.info, Node: Nextfile Statement, Next: Exit Statement, Prev: Next Statement, Up: Statements -Using `gawk''s `nextfile' Statement ------------------------------------ +6.4.9 Using `gawk''s `nextfile' Statement +----------------------------------------- - `gawk' provides the `nextfile' statement, which is similar to the +`gawk' provides the `nextfile' statement, which is similar to the `next' statement. However, instead of abandoning processing of the current record, the `nextfile' statement instructs `gawk' to stop processing the current data file. - The `nextfile' statement is a `gawk' extension. In most other `awk' +The `nextfile' statement is a `gawk' extension. In most other `awk' implementations, or if `gawk' is in compatibility mode (*note Options::), `nextfile' is not special. - Upon execution of the `nextfile' statement, `FILENAME' is updated to +Upon execution of the `nextfile' statement, `FILENAME' is updated to the name of the next data file listed on the command line, `FNR' is reset to one, `ARGIND' is incremented, and processing starts over with the first rule in the program. (`ARGIND' hasn't been introduced yet. @@ -7606,30 +7690,30 @@ the first rule in the program. (`ARGIND' hasn't been introduced yet. end of the input to be reached, then the code in any `END' rules is executed. *Note BEGIN/END::. - The `nextfile' statement is useful when there are many data files to +The `nextfile' statement is useful when there are many data files to process but it isn't necessary to process every record in every file. Normally, in order to move on to the next data file, a program has to continue scanning the unwanted records. The `nextfile' statement accomplishes this much more efficiently. - While one might think that `close(FILENAME)' would accomplish the -same as `nextfile', this isn't true. `close' is reserved for closing -files, pipes, and coprocesses that are opened with redirections. It is -not related to the main processing that `awk' does with the files -listed in `ARGV'. +While one might think that `close(FILENAME)' would accomplish the same +as `nextfile', this isn't true. `close' is reserved for closing files, +pipes, and coprocesses that are opened with redirections. It is not +related to the main processing that `awk' does with the files listed in +`ARGV'. - If it's necessary to use an `awk' version that doesn't support +If it's necessary to use an `awk' version that doesn't support `nextfile', see *Note Nextfile Function::, for a user-defined function that simulates the `nextfile' statement. - The current version of the Bell Laboratories `awk' (*note Other +The current version of the Bell Laboratories `awk' (*note Other Versions::) also supports `nextfile'. However, it doesn't allow the `nextfile' statement inside function bodies (*note User-defined::). `gawk' does; a `nextfile' inside a function body reads the next record and starts processing it with the first rule in the program, just as any other `nextfile' statement. - *Caution:* Versions of `gawk' prior to 3.0 used two words (`next +*Caution:* Versions of `gawk' prior to 3.0 used two words (`next file') for the `nextfile' statement. In version 3.0, this was changed to one word, because the treatment of `file' was inconsistent. When it appeared after `next', `file' was a keyword; otherwise, it was a @@ -7639,40 +7723,40 @@ generates a syntax error.  File: gawk.info, Node: Exit Statement, Prev: Nextfile Statement, Up: Statements -The `exit' Statement --------------------- +6.4.10 The `exit' Statement +--------------------------- - The `exit' statement causes `awk' to immediately stop executing the +The `exit' statement causes `awk' to immediately stop executing the current rule and to stop processing input; any remaining input is ignored. The `exit' statement is written as follows: exit [RETURN CODE] - When an `exit' statement is executed from a `BEGIN' rule, the -program stops processing everything immediately. No input records are -read. However, if an `END' rule is present, as part of executing the -`exit' statement, the `END' rule is executed (*note BEGIN/END::). If -`exit' is used as part of an `END' rule, it causes the program to stop +When an `exit' statement is executed from a `BEGIN' rule, the program +stops processing everything immediately. No input records are read. +However, if an `END' rule is present, as part of executing the `exit' +statement, the `END' rule is executed (*note BEGIN/END::). If `exit' +is used as part of an `END' rule, it causes the program to stop immediately. - An `exit' statement that is not part of a `BEGIN' or `END' rule -stops the execution of any further automatic rules for the current -record, skips reading any remaining input records, and executes the -`END' rule if there is one. +An `exit' statement that is not part of a `BEGIN' or `END' rule stops +the execution of any further automatic rules for the current record, +skips reading any remaining input records, and executes the `END' rule +if there is one. - In such a case, if you don't want the `END' rule to do its job, set -a variable to nonzero before the `exit' statement and check that -variable in the `END' rule. *Note Assert Function::, for an example -that does this. +In such a case, if you don't want the `END' rule to do its job, set a +variable to nonzero before the `exit' statement and check that variable +in the `END' rule. *Note Assert Function::, for an example that does +this. - If an argument is supplied to `exit', its value is used as the exit +If an argument is supplied to `exit', its value is used as the exit status code for the `awk' process. If no argument is supplied, `exit' returns status zero (success). In the case where an argument is supplied to a first `exit' statement, and then `exit' is called a second time from an `END' rule with no argument, `awk' uses the previously supplied exit value. (d.c.) - For example, suppose an error condition occurs that is difficult or +For example, suppose an error condition occurs that is difficult or impossible to handle. Conventionally, programs report this by exiting with a nonzero status. An `awk' program can do this using an `exit' statement with a nonzero argument, as shown in the following example: @@ -7689,20 +7773,19 @@ statement with a nonzero argument, as shown in the following example:  File: gawk.info, Node: Built-in Variables, Prev: Statements, Up: Patterns and Actions -Built-in Variables -================== +6.5 Built-in Variables +====================== - Most `awk' variables are available to use for your own purposes; -they never change unless your program assigns values to them, and they -never affect anything unless your program examines them. However, a -few variables in `awk' have special built-in meanings. `awk' examines -some of these automatically, so that they enable you to tell `awk' how -to do certain things. Others are set automatically by `awk', so that -they carry information from the internal workings of `awk' to your -program. +Most `awk' variables are available to use for your own purposes; they +never change unless your program assigns values to them, and they never +affect anything unless your program examines them. However, a few +variables in `awk' have special built-in meanings. `awk' examines some +of these automatically, so that they enable you to tell `awk' how to do +certain things. Others are set automatically by `awk', so that they +carry information from the internal workings of `awk' to your program. - This minor node documents all the built-in variables of `gawk', most -of which are also documented in the chapters describing their areas of +This minor node documents all the built-in variables of `gawk', most of +which are also documented in the chapters describing their areas of activity. * Menu: @@ -7716,11 +7799,11 @@ activity.  File: gawk.info, Node: User-modified, Next: Auto-set, Up: Built-in Variables -Built-in Variables That Control `awk' -------------------------------------- +6.5.1 Built-in Variables That Control `awk' +------------------------------------------- - The following is an alphabetical list of variables that you can -change to control how `awk' does certain things. The variables that are +The following is an alphabetical list of variables that you can change +to control how `awk' does certain things. The variables that are specific to `gawk' are marked with a pound sign (`#'). `BINMODE #' @@ -7863,17 +7946,17 @@ specific to `gawk' are marked with a pound sign (`#'). implementations, or if `gawk' is in compatibility mode (*note Options::), it is not special. - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) In POSIX `awk', newline does not count as whitespace. +(1) In POSIX `awk', newline does not count as whitespace.  File: gawk.info, Node: Auto-set, Next: ARGC and ARGV, Prev: User-modified, Up: Built-in Variables -Built-in Variables That Convey Information ------------------------------------------- +6.5.2 Built-in Variables That Convey Information +------------------------------------------------ - The following is an alphabetical list of variables that `awk' sets +The following is an alphabetical list of variables that `awk' sets automatically on certain occasions in order to provide information to your program. The variables that are specific to `gawk' are marked with a pound sign (`#'). @@ -7944,6 +8027,13 @@ with a pound sign (`#'). during a read for `getline', or during a `close' operation, then `ERRNO' contains a string describing the error. + `ERRNO' works similarly to the C variable `errno'. In particular + `gawk' _never_ clears it (sets it to zero or `""'). Thus, you + should only expect its value to be meaningful when an I/O + operation returns a failure value, such as `getline' returning -1. + You are, of course, free to clear it yourself before doing an I/O + operation. + This variable is a `gawk' extension. In other `awk' implementations, or if `gawk' is in compatibility mode (*note Options::), it is not special. @@ -8010,6 +8100,10 @@ with a pound sign (`#'). `PROCINFO["uid"]' The value of the `getuid' system call. + `PROCINFO["version"]' + The version of `gawk'. This is available from version 3.1.4 + and later. + On some systems, there may be elements in the array, `"group1"' through `"groupN"' for some N. N is the number of supplementary groups that the process has. Use the `in' operator to test for @@ -8043,11 +8137,11 @@ with a pound sign (`#'). Advanced Notes: Changing `NR' and `FNR' --------------------------------------- - `awk' increments `NR' and `FNR' each time it reads a record, instead -of setting them to the absolute value of the number of records read. -This means that a program can change these variables and their new -values are incremented for each record. (d.c.) This is demonstrated -in the following example: +`awk' increments `NR' and `FNR' each time it reads a record, instead of +setting them to the absolute value of the number of records read. This +means that a program can change these variables and their new values +are incremented for each record. (d.c.) This is demonstrated in the +following example: $ echo '1 > 2 @@ -8063,19 +8157,19 @@ Before `FNR' was added to the `awk' language (*note V7/SVR3.1::), many `awk' programs used this feature to track the number of records in a file by resetting `NR' to zero when `FILENAME' changed. - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) Some early implementations of Unix `awk' initialized `FILENAME' -to `"-"', even if there were data files to be processed. This behavior -was incorrect and should not be relied upon in your programs. +(1) Some early implementations of Unix `awk' initialized `FILENAME' to +`"-"', even if there were data files to be processed. This behavior was +incorrect and should not be relied upon in your programs.  File: gawk.info, Node: ARGC and ARGV, Prev: Auto-set, Up: Built-in Variables -Using `ARGC' and `ARGV' ------------------------ +6.5.4 Using `ARGC' and `ARGV' +----------------------------- - *Note Auto-set::, presented the following program describing the +*Note Auto-set::, presented the following program describing the information contained in `ARGC' and `ARGV': $ awk 'BEGIN { @@ -8108,25 +8202,25 @@ treated as arguments and do show up in the `ARGV' array: -| ARGV[2] = /dev/null -| A=1, B=2 - A program can alter `ARGC' and the elements of `ARGV'. Each time -`awk' reaches the end of an input file, it uses the next element of -`ARGV' as the name of the next input file. By storing a different -string there, a program can change which files are read. Use `"-"' to -represent the standard input. Storing additional elements and -incrementing `ARGC' causes additional files to be read. - - If the value of `ARGC' is decreased, that eliminates input files -from the end of the list. By recording the old value of `ARGC' -elsewhere, a program can treat the eliminated arguments as something -other than file names. - - To eliminate a file from the middle of the list, store the null -string (`""') into `ARGV' in place of the file's name. As a special -feature, `awk' ignores file names that have been replaced with the null -string. Another option is to use the `delete' statement to remove -elements from `ARGV' (*note Delete::). - - All of these actions are typically done in the `BEGIN' rule, before +A program can alter `ARGC' and the elements of `ARGV'. Each time `awk' +reaches the end of an input file, it uses the next element of `ARGV' as +the name of the next input file. By storing a different string there, +a program can change which files are read. Use `"-"' to represent the +standard input. Storing additional elements and incrementing `ARGC' +causes additional files to be read. + +If the value of `ARGC' is decreased, that eliminates input files from +the end of the list. By recording the old value of `ARGC' elsewhere, a +program can treat the eliminated arguments as something other than file +names. + +To eliminate a file from the middle of the list, store the null string +(`""') into `ARGV' in place of the file's name. As a special feature, +`awk' ignores file names that have been replaced with the null string. +Another option is to use the `delete' statement to remove elements from +`ARGV' (*note Delete::). + +All of these actions are typically done in the `BEGIN' rule, before actual processing of the input begins. *Note Split Program::, and see *Note Tee Program::, for examples of each way of removing elements from `ARGV'. The following fragment processes `ARGV' in order to examine, @@ -8148,17 +8242,17 @@ and then remove, command-line options: } } - To actually get the options into the `awk' program, end the `awk' +To actually get the options into the `awk' program, end the `awk' options with `--' and then supply the `awk' program's options, in the following manner: awk -f myprog -- -v -d file1 file2 ... - This is not necessary in `gawk'. Unless `--posix' has been -specified, `gawk' silently puts any unrecognized options into `ARGV' -for the `awk' program to deal with. As soon as it sees an unknown -option, `gawk' stops looking for other options that it might otherwise -recognize. The previous example with `gawk' would be: +This is not necessary in `gawk'. Unless `--posix' has been specified, +`gawk' silently puts any unrecognized options into `ARGV' for the `awk' +program to deal with. As soon as it sees an unknown option, `gawk' +stops looking for other options that it might otherwise recognize. The +previous example with `gawk' would be: gawk -f myprog -d -v file1 file2 ... @@ -8168,21 +8262,21 @@ are passed on to the `awk' program.  File: gawk.info, Node: Arrays, Next: Functions, Prev: Patterns and Actions, Up: Top -Arrays in `awk' -*************** +7 Arrays in `awk' +***************** - An "array" is a table of values called "elements". The elements of -an array are distinguished by their indices. "Indices" may be either +An "array" is a table of values called "elements". The elements of an +array are distinguished by their indices. "Indices" may be either numbers or strings. - This major node describes how arrays work in `awk', how to use array +This major node describes how arrays work in `awk', how to use array elements, how to scan through every element in an array, and how to remove array elements. It also describes how `awk' simulates multidimensional arrays, as well as some of the less obvious points about array usage. The major node finishes with a discussion of `gawk''s facility for sorting an array based on its indices. - `awk' maintains a single set of names that may be used for naming +`awk' maintains a single set of names that may be used for naming variables, arrays, and functions (*note User-defined::). Thus, you cannot have a variable and an array with the same name in the same `awk' program. @@ -8209,23 +8303,22 @@ cannot have a variable and an array with the same name in the same  File: gawk.info, Node: Array Intro, Next: Reference to Elements, Up: Arrays -Introduction to Arrays -====================== +7.1 Introduction to Arrays +========================== - The `awk' language provides one-dimensional arrays for storing -groups of related strings or numbers. Every `awk' array must have a -name. Array names have the same syntax as variable names; any valid -variable name would also be a valid array name. But one name cannot be -used in both ways (as an array and as a variable) in the same `awk' -program. +The `awk' language provides one-dimensional arrays for storing groups +of related strings or numbers. Every `awk' array must have a name. +Array names have the same syntax as variable names; any valid variable +name would also be a valid array name. But one name cannot be used in +both ways (as an array and as a variable) in the same `awk' program. - Arrays in `awk' superficially resemble arrays in other programming +Arrays in `awk' superficially resemble arrays in other programming languages, but there are fundamental differences. In `awk', it isn't necessary to specify the size of an array before starting to use it. Additionally, any number or string in `awk', not just consecutive integers, may be used as an array index. - In most other languages, arrays must be "declared" before use, +In most other languages, arrays must be "declared" before use, including a specification of how many elements or components they contain. In such languages, the declaration causes a contiguous block of memory to be allocated for that many elements. Usually, an index in @@ -8239,7 +8332,7 @@ languages allow arbitrary starting and ending indices--e.g., `15 .. 27'--but the size of the array is still fixed when the array is declared.) - A contiguous array of four elements might look like the following +A contiguous array of four elements might look like the following example, conceptually, if the element values are 8, `"foo"', `""', and 30: @@ -8252,8 +8345,8 @@ Only the values are stored; the indices are implicit from the order of the values. Here, 8 is the value at index zero, because 8 appears in the position with zero elements before it. - Arrays in `awk' are different--they are "associative". This means -that each array is a collection of pairs: an index and its corresponding +Arrays in `awk' are different--they are "associative". This means that +each array is a collection of pairs: an index and its corresponding array element value: Element 3 Value 30 @@ -8263,8 +8356,8 @@ array element value: The pairs are shown in jumbled order because their order is irrelevant. - One advantage of associative arrays is that new pairs can be added -at any time. For example, suppose a tenth element is added to the array +One advantage of associative arrays is that new pairs can be added at +any time. For example, suppose a tenth element is added to the array whose value is `"number ten"'. The result is: Element 10 Value "number ten" @@ -8277,7 +8370,7 @@ Now the array is "sparse", which just means some indices are missing. It has elements 0-3 and 10, but doesn't have elements 4, 5, 6, 7, 8, or 9. - Another consequence of associative arrays is that the indices don't +Another consequence of associative arrays is that the indices don't have to be positive integers. Any number, or even a string, can be an index. For example, the following is an array that translates words from English to French: @@ -8294,22 +8387,22 @@ strings; this is discussed in more detail in *Note Numeric Array Subscripts::. Here, the number `1' isn't double-quoted, since `awk' automatically converts it to a string. - The value of `IGNORECASE' has no effect upon array subscripting. -The identical string value used to store an array element must be used -to retrieve it. When `awk' creates an array (e.g., with the `split' +The value of `IGNORECASE' has no effect upon array subscripting. The +identical string value used to store an array element must be used to +retrieve it. When `awk' creates an array (e.g., with the `split' built-in function), that array's indices are consecutive integers starting at one. (*Note String Functions::.) - `awk''s arrays are efficient--the time to access an element is +`awk''s arrays are efficient--the time to access an element is independent of the number of elements in the array.  File: gawk.info, Node: Reference to Elements, Next: Assigning Elements, Prev: Array Intro, Up: Arrays -Referring to an Array Element -============================= +7.2 Referring to an Array Element +================================= - The principal way to use an array is to refer to one of its elements. +The principal way to use an array is to refer to one of its elements. An array reference is an expression as follows: ARRAY[INDEX] @@ -8317,19 +8410,19 @@ An array reference is an expression as follows: Here, ARRAY is the name of an array. The expression INDEX is the index of the desired element of the array. - The value of the array reference is the current value of that array +The value of the array reference is the current value of that array element. For example, `foo[4.3]' is an expression for the element of array `foo' at index `4.3'. - A reference to an array element that has no recorded value yields a +A reference to an array element that has no recorded value yields a value of `""', the null string. This includes elements that have not been assigned any value as well as elements that have been deleted (*note Delete::). Such a reference automatically creates that array element, with the null string as its value. (In some cases, this is unfortunate, because it might waste memory inside `awk'.) - To determine whether an element exists in an array at a certain -index, use the following expression: +To determine whether an element exists in an array at a certain index, +use the following expression: INDEX in ARRAY @@ -8342,7 +8435,7 @@ whether the array `frequencies' contains the index `2': if (2 in frequencies) print "Subscript 2 is present." - Note that this is _not_ a test of whether the array `frequencies' +Note that this is _not_ a test of whether the array `frequencies' contains an element whose _value_ is two. There is no way to do that except to scan all the elements. Also, this _does not_ create `frequencies[2]', while the following (incorrect) alternative does: @@ -8353,10 +8446,10 @@ except to scan all the elements. Also, this _does not_ create  File: gawk.info, Node: Assigning Elements, Next: Array Example, Prev: Reference to Elements, Up: Arrays -Assigning Array Elements -======================== +7.3 Assigning Array Elements +============================ - Array elements can be assigned values just like `awk' variables: +Array elements can be assigned values just like `awk' variables: ARRAY[SUBSCRIPT] = VALUE @@ -8367,31 +8460,31 @@ VALUE is the value to assign to that element of the array.  File: gawk.info, Node: Array Example, Next: Scanning an Array, Prev: Assigning Elements, Up: Arrays -Basic Array Example -=================== +7.4 Basic Array Example +======================= - The following program takes a list of lines, each beginning with a -line number, and prints them out in order of line number. The line -numbers are not in order when they are first read--instead they are -scrambled. This program sorts the lines by making an array using the -line numbers as subscripts. The program then prints out the lines in -sorted order of their numbers. It is a very simple program and gets -confused upon encountering repeated numbers, gaps, or lines that don't -begin with a number: +The following program takes a list of lines, each beginning with a line +number, and prints them out in order of line number. The line numbers +are not in order when they are first read--instead they are scrambled. +This program sorts the lines by making an array using the line numbers +as subscripts. The program then prints out the lines in sorted order +of their numbers. It is a very simple program and gets confused upon +encountering repeated numbers, gaps, or lines that don't begin with a +number: { if ($1 > max) max = $1 arr[$1] = $0 } - + END { for (x = 1; x <= max; x++) print arr[x] } - The first rule keeps track of the largest line number seen so far; -it also stores each line into the array `arr', at an index that is the +The first rule keeps track of the largest line number seen so far; it +also stores each line into the array `arr', at an index that is the line's number. The second rule runs after all the input has been read, to print out all the lines. When this program is run with the following input: @@ -8410,7 +8503,7 @@ Its output is: 4 . . . And four on the floor 5 I am the Five man - If a line number is repeated, the last line with a given number +If a line number is repeated, the last line with a given number overrides the others. Gaps in the line numbers can be handled with an easy improvement to the program's `END' rule, as follows: @@ -8423,10 +8516,10 @@ easy improvement to the program's `END' rule, as follows:  File: gawk.info, Node: Scanning an Array, Next: Delete, Prev: Array Example, Up: Arrays -Scanning All Elements of an Array -================================= +7.5 Scanning All Elements of an Array +===================================== - In programs that use arrays, it is often necessary to use a loop that +In programs that use arrays, it is often necessary to use a loop that executes once for each element of an array. In other languages, where arrays are contiguous and indices are limited to positive integers, this is easy: all the valid indices can be found by counting from the @@ -8440,21 +8533,21 @@ has a special kind of `for' statement for scanning an array: This loop executes BODY once for each index in ARRAY that the program has previously used, with the variable VAR set to that index. - The following program uses this form of the `for' statement. The -first rule scans the input records and notes which words appear (at -least once) in the input, by storing a one into the array `used' with -the word as index. The second rule scans the elements of `used' to -find all the distinct words that appear in the input. It prints each -word that is more than 10 characters long and also prints the number of -such words. *Note String Functions::, for more information on the -built-in function `length'. +The following program uses this form of the `for' statement. The first +rule scans the input records and notes which words appear (at least +once) in the input, by storing a one into the array `used' with the +word as index. The second rule scans the elements of `used' to find +all the distinct words that appear in the input. It prints each word +that is more than 10 characters long and also prints the number of such +words. *Note String Functions::, for more information on the built-in +function `length'. # Record a 1 for each word that is used at least once { for (i = 1; i <= NF; i++) used[$i] = 1 } - + # Find number of distinct words more than 10 characters long END { for (x in used) @@ -8467,29 +8560,28 @@ built-in function `length'. *Note Word Sorting::, for a more detailed example of this type. - The order in which elements of the array are accessed by this -statement is determined by the internal arrangement of the array -elements within `awk' and cannot be controlled or changed. This can -lead to problems if new elements are added to ARRAY by statements in -the loop body; it is not predictable whether the `for' loop will reach -them. Similarly, changing VAR inside the loop may produce strange -results. It is best to avoid such things. +The order in which elements of the array are accessed by this statement +is determined by the internal arrangement of the array elements within +`awk' and cannot be controlled or changed. This can lead to problems +if new elements are added to ARRAY by statements in the loop body; it +is not predictable whether the `for' loop will reach them. Similarly, +changing VAR inside the loop may produce strange results. It is best +to avoid such things.  File: gawk.info, Node: Delete, Next: Numeric Array Subscripts, Prev: Scanning an Array, Up: Arrays -The `delete' Statement -====================== +7.6 The `delete' Statement +========================== - To remove an individual element of an array, use the `delete' -statement: +To remove an individual element of an array, use the `delete' statement: delete ARRAY[INDEX] - Once an array element has been deleted, any value the element once -had is no longer available. It is as if the element had never been -referred to or had been given a value. The following is an example of -deleting elements in an array: +Once an array element has been deleted, any value the element once had +is no longer available. It is as if the element had never been referred +to or had been given a value. The following is an example of deleting +elements in an array: for (i in frequencies) delete frequencies[i] @@ -8503,62 +8595,62 @@ the presence of that element returns zero (i.e., false): if (4 in foo) print "This will never be printed" - It is important to note that deleting an element is _not_ the same -as assigning it a null value (the empty string, `""'). For example: +It is important to note that deleting an element is _not_ the same as +assigning it a null value (the empty string, `""'). For example: foo[4] = "" if (4 in foo) print "This is printed, even though foo[4] is empty" - It is not an error to delete an element that does not exist. If +It is not an error to delete an element that does not exist. If `--lint' is provided on the command line (*note Options::), `gawk' issues a warning message when an element that is not in the array is deleted. - All the elements of an array may be deleted with a single statement -by leaving off the subscript in the `delete' statement, as follows: +All the elements of an array may be deleted with a single statement by +leaving off the subscript in the `delete' statement, as follows: delete ARRAY - This ability is a `gawk' extension; it is not available in +This ability is a `gawk' extension; it is not available in compatibility mode (*note Options::). - Using this version of the `delete' statement is about three times -more efficient than the equivalent loop that deletes each element one -at a time. +Using this version of the `delete' statement is about three times more +efficient than the equivalent loop that deletes each element one at a +time. - The following statement provides a portable but nonobvious way to -clear out an array:(1) +The following statement provides a portable but nonobvious way to clear +out an array:(1) split("", array) - The `split' function (*note String Functions::) clears out the -target array first. This call asks it to split apart the null string. -Because there is no data to split out, the function simply clears the -array and then returns. +The `split' function (*note String Functions::) clears out the target +array first. This call asks it to split apart the null string. Because +there is no data to split out, the function simply clears the array and +then returns. - *Caution:* Deleting an array does not change its type; you cannot +*Caution:* Deleting an array does not change its type; you cannot delete an array and then use the array's name as a scalar (i.e., a regular variable). For example, the following does not work: a[1] = 3; delete a; a = 3 - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) Thanks to Michael Brennan for pointing this out. +(1) Thanks to Michael Brennan for pointing this out.  File: gawk.info, Node: Numeric Array Subscripts, Next: Uninitialized Subscripts, Prev: Delete, Up: Arrays -Using Numbers to Subscript Arrays -================================= +7.7 Using Numbers to Subscript Arrays +===================================== - An important aspect about arrays to remember is that _array -subscripts are always strings_. When a numeric value is used as a -subscript, it is converted to a string value before being used for -subscripting (*note Conversion::). This means that the value of the -built-in variable `CONVFMT' can affect how your program accesses -elements of an array. For example: +An important aspect about arrays to remember is that _array subscripts +are always strings_. When a numeric value is used as a subscript, it +is converted to a string value before being used for subscripting +(*note Conversion::). This means that the value of the built-in +variable `CONVFMT' can affect how your program accesses elements of an +array. For example: xyz = 12.153 data[xyz] = 1 @@ -8578,7 +8670,7 @@ assigned the value one. The program then changes the value of two significant digits. This test fails, since `"12.15"' is a different string from `"12.153"'. - According to the rules for conversions (*note Conversion::), integer +According to the rules for conversions (*note Conversion::), integer values are always converted to strings as integers, no matter what the value of `CONVFMT' may happen to be. So the usual case of the following works: @@ -8586,25 +8678,25 @@ following works: for (i = 1; i <= maxsub; i++) do something with array[i] - The "integer values always convert to strings as integers" rule has -an additional consequence for array indexing. Octal and hexadecimal +The "integer values always convert to strings as integers" rule has an +additional consequence for array indexing. Octal and hexadecimal constants (*note Nondecimal-numbers::) are converted internally into numbers, and their original form is forgotten. This means, for example, that `array[17]', `array[021]', and `array[0x11]' all refer to the same element! - As with many things in `awk', the majority of the time things work -as one would expect them to. But it is useful to have a precise -knowledge of the actual rules which sometimes can have a subtle effect -on your programs. +As with many things in `awk', the majority of the time things work as +one would expect them to. But it is useful to have a precise knowledge +of the actual rules which sometimes can have a subtle effect on your +programs.  File: gawk.info, Node: Uninitialized Subscripts, Next: Multi-dimensional, Prev: Numeric Array Subscripts, Up: Arrays -Using Uninitialized Variables as Subscripts -=========================================== +7.8 Using Uninitialized Variables as Subscripts +=============================================== - Suppose it's necessary to write a program to print the input data in +Suppose it's necessary to write a program to print the input data in reverse order. A reasonable attempt to do so (with some test data) might look like this: @@ -8618,14 +8710,14 @@ might look like this: -| line 3 -| line 2 - Unfortunately, the very first line of input data did not come out in -the output! +Unfortunately, the very first line of input data did not come out in the +output! - At first glance, this program should have worked. The variable -`lines' is uninitialized, and uninitialized variables have the numeric -value zero. So, `awk' should have printed the value of `l[0]'. +At first glance, this program should have worked. The variable `lines' +is uninitialized, and uninitialized variables have the numeric value +zero. So, `awk' should have printed the value of `l[0]'. - The issue here is that subscripts for `awk' arrays are _always_ +The issue here is that subscripts for `awk' arrays are _always_ strings. Uninitialized variables, when used as strings, have the value `""', not zero. Thus, `line 1' ends up stored in `l[""]'. The following version of the program works correctly: @@ -8636,62 +8728,61 @@ following version of the program works correctly: print l[i] } - Here, the `++' forces `lines' to be numeric, thus making the "old +Here, the `++' forces `lines' to be numeric, thus making the "old value" numeric zero. This is then converted to `"0"' as the array subscript. - Even though it is somewhat unusual, the null string (`""') is a -valid array subscript. (d.c.) `gawk' warns about the use of the null -string as a subscript if `--lint' is provided on the command line -(*note Options::). +Even though it is somewhat unusual, the null string (`""') is a valid +array subscript. (d.c.) `gawk' warns about the use of the null string +as a subscript if `--lint' is provided on the command line (*note +Options::).  File: gawk.info, Node: Multi-dimensional, Next: Multi-scanning, Prev: Uninitialized Subscripts, Up: Arrays -Multidimensional Arrays -======================= +7.9 Multidimensional Arrays +=========================== - A multidimensional array is an array in which an element is -identified by a sequence of indices instead of a single index. For -example, a two-dimensional array requires two indices. The usual way -(in most languages, including `awk') to refer to an element of a -two-dimensional array named `grid' is with `grid[X,Y]'. +A multidimensional array is an array in which an element is identified +by a sequence of indices instead of a single index. For example, a +two-dimensional array requires two indices. The usual way (in most +languages, including `awk') to refer to an element of a two-dimensional +array named `grid' is with `grid[X,Y]'. - Multidimensional arrays are supported in `awk' through concatenation -of indices into one string. `awk' converts the indices into strings +Multidimensional arrays are supported in `awk' through concatenation of +indices into one string. `awk' converts the indices into strings (*note Conversion::) and concatenates them together, with a separator between them. This creates a single string that describes the values of the separate indices. The combined string is used as a single index into an ordinary, one-dimensional array. The separator used is the value of the built-in variable `SUBSEP'. - For example, suppose we evaluate the expression `foo[5,12] = "value"' +For example, suppose we evaluate the expression `foo[5,12] = "value"' when the value of `SUBSEP' is `"@"'. The numbers 5 and 12 are converted to strings and concatenated with an `@' between them, yielding `"5@12"'; thus, the array element `foo["5@12"]' is set to `"value"'. - Once the element's value is stored, `awk' has no record of whether -it was stored with a single index or a sequence of indices. The two +Once the element's value is stored, `awk' has no record of whether it +was stored with a single index or a sequence of indices. The two expressions `foo[5,12]' and `foo[5 SUBSEP 12]' are always equivalent. - The default value of `SUBSEP' is the string `"\034"', which contains -a nonprinting character that is unlikely to appear in an `awk' program -or in most input data. The usefulness of choosing an unlikely -character comes from the fact that index values that contain a string -matching `SUBSEP' can lead to combined strings that are ambiguous. -Suppose that `SUBSEP' is `"@"'; then `foo["a@b", "c"]' and -`foo["a", "b@c"]' are indistinguishable because both are actually -stored as `foo["a@b@c"]'. +The default value of `SUBSEP' is the string `"\034"', which contains a +nonprinting character that is unlikely to appear in an `awk' program or +in most input data. The usefulness of choosing an unlikely character +comes from the fact that index values that contain a string matching +`SUBSEP' can lead to combined strings that are ambiguous. Suppose that +`SUBSEP' is `"@"'; then `foo["a@b", "c"]' and `foo["a", "b@c"]' are +indistinguishable because both are actually stored as `foo["a@b@c"]'. - To test whether a particular index sequence exists in a +To test whether a particular index sequence exists in a multidimensional array, use the same operator (`in') that is used for single dimensional arrays. Write the whole sequence of indices in parentheses, separated by commas, as the left operand: (SUBSCRIPT1, SUBSCRIPT2, ...) in ARRAY - The following example treats its input as a two-dimensional array of +The following example treats its input as a two-dimensional array of fields; it rotates this array 90 degrees clockwise and prints the result. It assumes that all lines have the same number of elements: @@ -8702,7 +8793,7 @@ result. It assumes that all lines have the same number of elements: for (x = 1; x <= NF; x++) vector[x, NR] = $x } - + END { for (x = 1; x <= max_nf; x++) { for (y = max_nr; y >= 1; --y) @@ -8730,15 +8821,15 @@ the program produces the following output:  File: gawk.info, Node: Multi-scanning, Next: Array Sorting, Prev: Multi-dimensional, Up: Arrays -Scanning Multidimensional Arrays -================================ +7.10 Scanning Multidimensional Arrays +===================================== - There is no special `for' statement for scanning a -"multidimensional" array. There cannot be one, because, in truth, there -are no multidimensional arrays or elements--there is only a -multidimensional _way of accessing_ an array. +There is no special `for' statement for scanning a "multidimensional" +array. There cannot be one, because, in truth, there are no +multidimensional arrays or elements--there is only a multidimensional +_way of accessing_ an array. - However, if your program has an array that is always accessed as +However, if your program has an array that is always accessed as multidimensional, you can get the effect of scanning it by combining the scanning `for' statement (*note Scanning an Array::) with the built-in `split' function (*note String Functions::). It works in the @@ -8754,7 +8845,7 @@ in the array, and splits it into the individual indices by breaking it apart where the value of `SUBSEP' appears. The individual indices then become the elements of the array `separate'. - Thus, if a value is previously stored in `array[1, "foo"]'; then an +Thus, if a value is previously stored in `array[1, "foo"]'; then an element with index `"1\034foo"' exists in `array'. (Recall that the default value of `SUBSEP' is the character with code 034.) Sooner or later, the `for' statement finds that index and does an iteration with @@ -8770,12 +8861,12 @@ recovered.  File: gawk.info, Node: Array Sorting, Prev: Multi-scanning, Up: Arrays -Sorting Array Values and Indices with `gawk' -============================================ +7.11 Sorting Array Values and Indices with `gawk' +================================================= - The order in which an array is scanned with a `for (i in array)' -loop is essentially arbitrary. In most `awk' implementations, sorting -an array requires writing a `sort' function. While this can be +The order in which an array is scanned with a `for (i in array)' loop +is essentially arbitrary. In most `awk' implementations, sorting an +array requires writing a `sort' function. While this can be educational for exploring different sorting algorithms, usually that's not the point of the program. `gawk' provides the built-in `asort' and `asorti' functions (*note String Functions::) for sorting arrays. For @@ -8786,13 +8877,13 @@ example: for (i = 1; i <= n; i++) DO SOMETHING WITH data[i] - After the call to `asort', the array `data' is indexed from 1 to -some number N, the total number of elements in `data'. (This count is +After the call to `asort', the array `data' is indexed from 1 to some +number N, the total number of elements in `data'. (This count is `asort''s return value.) `data[1]' <= `data[2]' <= `data[3]', and so on. The comparison of array elements is done using `gawk''s usual comparison rules (*note Typing and Comparison::). - An important side effect of calling `asort' is that _the array's +An important side effect of calling `asort' is that _the array's original indices are irrevocably lost_. As this isn't always desirable, `asort' accepts a second argument: @@ -8801,28 +8892,30 @@ desirable, `asort' accepts a second argument: for (i = 1; i <= n; i++) DO SOMETHING WITH dest[i] - In this case, `gawk' copies the `source' array into the `dest' array +In this case, `gawk' copies the `source' array into the `dest' array and then sorts `dest', destroying its indices. However, the `source' array is not affected. - Often, what's needed is to sort on the values of the _indices_ -instead of the values of the elements. To do that, starting with -`gawk' 3.1.2, use the `asorti' function. The interface is identical to -that of `asort', except that the index values are used for sorting, and -become the values of the result array: +Often, what's needed is to sort on the values of the _indices_ instead +of the values of the elements. To do that, starting with `gawk' 3.1.2, +use the `asorti' function. The interface is identical to that of +`asort', except that the index values are used for sorting, and become +the values of the result array: { source[$0] = some_func($0) } - + END { n = asorti(source, dest) - for (i = 1; i <= n; i++) - DO SOMETHING WITH dest[i] + for (i = 1; i <= n; i++) { + DO SOMETHING WITH dest[i] Work with sorted indices directly + ... + DO SOMETHING WITH source[dest[i]] Access original array via sorted indices + } } - If your version of `gawk' is 3.1.0 or 3.1.1, you don't have -`asorti'. Instead, use a helper array to hold the sorted index values, -and then access the original array's elements. It works in the -following way: +If your version of `gawk' is 3.1.0 or 3.1.1, you don't have `asorti'. +Instead, use a helper array to hold the sorted index values, and then +access the original array's elements. It works in the following way: POPULATE THE ARRAY data # copy indices @@ -8832,22 +8925,24 @@ following way: j++ } n = asort(ind) # index values are now sorted - for (i = 1; i <= n; i++) - DO SOMETHING WITH data[ind[i]] + for (i = 1; i <= n; i++) { + DO SOMETHING WITH ind[i] Work with sorted indices directly + ... + DO SOMETHING WITH data[ind[i]] Access original array via sorted indices + } - Sorting the array by replacing the indices provides maximal -flexibility. To traverse the elements in decreasing order, use a loop -that goes from N down to 1, either over the elements or over the -indices. +Sorting the array by replacing the indices provides maximal flexibility. +To traverse the elements in decreasing order, use a loop that goes from +N down to 1, either over the elements or over the indices. - Copying array indices and elements isn't expensive in terms of -memory. Internally, `gawk' maintains "reference counts" to data. For -example, when `asort' copies the first array to the second one, there -is only one copy of the original array elements' data, even though both -arrays use the values. Similarly, when copying the indices from `data' -to `ind', there is only one copy of the actual index strings. +Copying array indices and elements isn't expensive in terms of memory. +Internally, `gawk' maintains "reference counts" to data. For example, +when `asort' copies the first array to the second one, there is only +one copy of the original array elements' data, even though both arrays +use the values. Similarly, when copying the indices from `data' to +`ind', there is only one copy of the actual index strings. - We said previously that comparisons are done using `gawk''s "usual +We said previously that comparisons are done using `gawk''s "usual comparison rules." Because `IGNORECASE' affects string comparisons, the value of `IGNORECASE' also affects sorting for both `asort' and `asorti'. Caveat Emptor. @@ -8855,15 +8950,15 @@ the value of `IGNORECASE' also affects sorting for both `asort' and  File: gawk.info, Node: Functions, Next: Internationalization, Prev: Arrays, Up: Top -Functions -********* +8 Functions +*********** - This major node describes `awk''s built-in functions, which fall -into three categories: numeric, string, and I/O. `gawk' provides -additional groups of functions to work with values that represent time, -do bit manipulation, and internationalize and localize programs. +This major node describes `awk''s built-in functions, which fall into +three categories: numeric, string, and I/O. `gawk' provides additional +groups of functions to work with values that represent time, do bit +manipulation, and internationalize and localize programs. - Besides the built-in functions, `awk' has provisions for writing new +Besides the built-in functions, `awk' has provisions for writing new functions that the rest of a program can use. The second half of this major node describes these "user-defined" functions. @@ -8875,10 +8970,10 @@ major node describes these "user-defined" functions.  File: gawk.info, Node: Built-in, Next: User-defined, Up: Functions -Built-in Functions -================== +8.1 Built-in Functions +====================== - "Built-in" functions are always available for your `awk' program to +"Built-in" functions are always available for your `awk' program to call. This minor node defines all the built-in functions in `awk'; some of these are mentioned in other sections but are summarized here for your convenience. @@ -8898,29 +8993,29 @@ for your convenience.  File: gawk.info, Node: Calling Built-in, Next: Numeric Functions, Up: Built-in -Calling Built-in Functions --------------------------- +8.1.1 Calling Built-in Functions +-------------------------------- - To call one of `awk''s built-in functions, write the name of the +To call one of `awk''s built-in functions, write the name of the function followed by arguments in parentheses. For example, `atan2(y + z, 1)' is a call to the function `atan2' and has two arguments. - Whitespace is ignored between the built-in function name and the -open parenthesis, and it is good practice to avoid using whitespace -there. User-defined functions do not permit whitespace in this way, and -it is easier to avoid mistakes by following a simple convention that -always works--no whitespace after a function name. +Whitespace is ignored between the built-in function name and the open +parenthesis, and it is good practice to avoid using whitespace there. +User-defined functions do not permit whitespace in this way, and it is +easier to avoid mistakes by following a simple convention that always +works--no whitespace after a function name. - Each built-in function accepts a certain number of arguments. In -some cases, arguments can be omitted. The defaults for omitted -arguments vary from function to function and are described under the -individual functions. In some `awk' implementations, extra arguments -given to built-in functions are ignored. However, in `gawk', it is a -fatal error to give extra arguments to a built-in function. +Each built-in function accepts a certain number of arguments. In some +cases, arguments can be omitted. The defaults for omitted arguments +vary from function to function and are described under the individual +functions. In some `awk' implementations, extra arguments given to +built-in functions are ignored. However, in `gawk', it is a fatal +error to give extra arguments to a built-in function. - When a function is called, expressions that create the function's -actual parameters are evaluated completely before the call is performed. -For example, in the following code fragment: +When a function is called, expressions that create the function's actual +parameters are evaluated completely before the call is performed. For +example, in the following code fragment: i = 4 j = sqrt(i++) @@ -8934,18 +9029,18 @@ are evaluated from left to right or from right to left. For example: i = 5 j = atan2(i++, i *= 2) - If the order of evaluation is left to right, then `i' first becomes -6, and then 12, and `atan2' is called with the two arguments 6 and 12. +If the order of evaluation is left to right, then `i' first becomes 6, +and then 12, and `atan2' is called with the two arguments 6 and 12. But if the order of evaluation is right to left, `i' first becomes 10, then 11, and `atan2' is called with the two arguments 11 and 10.  File: gawk.info, Node: Numeric Functions, Next: String Functions, Prev: Calling Built-in, Up: Built-in -Numeric Functions ------------------ +8.1.2 Numeric Functions +----------------------- - The following list describes all of the built-in functions that work +The following list describes all of the built-in functions that work with numbers. Optional parameters are enclosed in square brackets ([ ]): @@ -9001,7 +9096,7 @@ brackets ([ ]): # Function to roll a simulated die. function roll(n) { return 1 + int(rand() * n) } - + # Roll 3 six-sided dice and # print total number of points. { @@ -9039,15 +9134,15 @@ brackets ([ ]): easy to keep track of the seeds in case you need to consistently reproduce sequences of random numbers. - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) The C version of `rand' is known to produce fairly poor -sequences of random numbers. However, nothing requires that an `awk' +(1) The C version of `rand' is known to produce fairly poor sequences +of random numbers. However, nothing requires that an `awk' implementation use the C `rand' to implement the `awk' version of `rand'. In fact, `gawk' uses the BSD `random' function, which is considerably better than `rand', to produce random numbers. - (2) Computer-generated random numbers really are not truly random. +(2) Computer-generated random numbers really are not truly random. They are technically known as "pseudorandom." This means that while the numbers in a sequence appear to be random, you can in fact generate the same sequence of random numbers over and over again. @@ -9055,11 +9150,11 @@ the same sequence of random numbers over and over again.  File: gawk.info, Node: String Functions, Next: I/O Functions, Prev: Numeric Functions, Up: Built-in -String-Manipulation Functions ------------------------------ +8.1.3 String-Manipulation Functions +----------------------------------- - The functions in this minor node look at or change the text of one -or more strings. Optional parameters are enclosed in square +The functions in this minor node look at or change the text of one or +more strings. Optional parameters are enclosed in square brackets ([ ]). Those functions that are specific to `gawk' are marked with a pound sign (`#'): @@ -9132,12 +9227,13 @@ with a pound sign (`#'): If no argument is supplied, `length' returns the length of `$0'. - *Note:* In older versions of `awk', the `length' function could be - called without any parentheses. Doing so is marked as - "deprecated" in the POSIX standard. This means that while a - program can do this, it is a feature that can eventually be - removed from a future version of the standard. Therefore, for - programs to be maximally portable, always supply the parentheses. + NOTE: In older versions of `awk', the `length' function could + be called without any parentheses. Doing so is marked as + "deprecated" in the POSIX standard. This means that while a + program can do this, it is a feature that can eventually be + removed from a future version of the standard. Therefore, + for programs to be maximally portable, always supply the + parentheses. `match(STRING, REGEXP [, ARRAY])' The `match' function searches STRING for the longest, leftmost @@ -9504,35 +9600,35 @@ with a pound sign (`#'): Nonalphabetic characters are left unchanged. For example, `toupper("MiXeD cAsE 123")' returns `"MIXED CASE 123"'. - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) Unless you use the `--non-decimal-data' option, which isn't +(1) Unless you use the `--non-decimal-data' option, which isn't recommended. *Note Nondecimal Data::, for more information. - (2) Note that this means that the record will first be regenerated +(2) Note that this means that the record will first be regenerated using the value of `OFS' if any fields have been changed, and that the fields will be updated after the substituion, even if the operation is a "no-op" such as `sub(/^/, "")'. - (3) This is different from C and C++, in which the first character -is number zero. +(3) This is different from C and C++, in which the first character is +number zero.  File: gawk.info, Node: Gory Details, Up: String Functions -More About `\' and `&' with `sub', `gsub', and `gensub' -....................................................... +8.1.3.1 More About `\' and `&' with `sub', `gsub', and `gensub' +............................................................... - When using `sub', `gsub', or `gensub', and trying to get literal +When using `sub', `gsub', or `gensub', and trying to get literal backslashes and ampersands into the replacement text, you need to remember that there are several levels of "escape processing" going on. - First, there is the "lexical" level, which is when `awk' reads your +First, there is the "lexical" level, which is when `awk' reads your program and builds an internal copy of it that can be executed. Then there is the runtime level, which is when `awk' actually scans the replacement string to determine what to generate. - At both levels, `awk' looks for a defined set of characters that can +At both levels, `awk' looks for a defined set of characters that can come after a backslash. At the lexical level, it looks for the escape sequences listed in *Note Escape Sequences::. Thus, for every `\' that `awk' processes at the runtime level, type two backslashes at the @@ -9541,16 +9637,16 @@ sequence follows the `\', Unix `awk' and `gawk' both simply remove the initial `\' and put the next character into the string. Thus, for example, `"a\qb"' is treated as `"aqb"'. - At the runtime level, the various functions handle sequences of `\' -and `&' differently. The situation is (sadly) somewhat complex. +At the runtime level, the various functions handle sequences of `\' and +`&' differently. The situation is (sadly) somewhat complex. Historically, the `sub' and `gsub' functions treated the two character sequence `\&' specially; this sequence was replaced in the generated text with a single `&'. Any other `\' within the REPLACEMENT string -that did not precede an `&' was passed through unchanged. To -illustrate with a table: +that did not precede an `&' was passed through unchanged. This is +illustrated in *Note table-sub-escapes::. You type `sub' sees `sub' generates - -------- ---------- --------------- + ------- --------- -------------- `\&' `&' the matched text `\\&' `\&' a literal `&' `\\\&' `\&' a literal `&' @@ -9559,6 +9655,8 @@ illustrate with a table: `\\\\\\&' `\\\&' a literal `\\&' `\\q' `\q' a literal `\q' +Table 8.1: Historical Escape Sequence Processing for sub and gsub + This table shows both the lexical-level processing, where an odd number of backslashes becomes an even number at the runtime level, as well as the runtime processing done by `sub'. (For the sake of simplicity, the @@ -9568,18 +9666,21 @@ backslashes entered at the lexical level.) The problem with the historical approach is that there is no way to get a literal `\' followed by the matched text. - The 1992 POSIX standard attempted to fix this problem. The standard + The 1992 POSIX standard attempted to fix this problem. That standard says that `sub' and `gsub' look for either a `\' or an `&' after the `\'. If either one follows a `\', that character is output literally. -The interpretation of `\' and `&' then becomes: +The interpretation of `\' and `&' then becomes as shown in *Note +table-sub-posix-92::. You type `sub' sees `sub' generates - -------- ---------- --------------- + ------- --------- -------------- `&' `&' the matched text `\\&' `\&' a literal `&' `\\\\&' `\\&' a literal `\', then the matched text `\\\\\\&' `\\\&' a literal `\&' +Table 8.2: 1992 POSIX Rules for sub and gsub Escape Sequence Processing + This appears to solve the problem. Unfortunately, the phrasing of the standard is unusual. It says, in effect, that `\' turns off the special meaning of any following character, but for anything other than `\' and @@ -9592,18 +9693,22 @@ problems: * To make sure that an `awk' program is portable, _every_ character in the REPLACEMENT string must be preceded with a backslash.(1) - The POSIX standard is under revision. Because of the problems just -listed, proposed text for the revised standard reverts to rules that -correspond more closely to the original existing practice. The proposed -rules have special cases that make it possible to produce a `\' -preceding the matched text: + Because of the problems just listed, in 1996, the `gawk' maintainer +submitted proposed text for a revised standard that reverts to rules +that correspond more closely to the original existing practice. The +proposed rules have special cases that make it possible to produce a +`\' preceding the matched text. This is shown in *Note +table-sub-proposed::. You type `sub' sees `sub' generates - -------- ---------- --------------- + ------- --------- -------------- `\\\\\\&' `\\\&' a literal `\&' `\\\\&' `\\&' a literal `\', followed by the matched text `\\&' `\&' a literal `&' `\\q' `\q' a literal `\q' + `\\\\' `\\' `\\' + +Table 8.3: Propsosed rules for sub and backslash In a nutshell, at the runtime level, there are now three special sequences of characters (`\\\&', `\\&' and `\&') whereas historically @@ -9612,20 +9717,46 @@ is not part of one of these three sequences is not special and appears in the output literally. `gawk' 3.0 and 3.1 follow these proposed POSIX rules for `sub' and -`gsub'. Whether these proposed rules will actually become codified -into the standard is unknown at this point. Subsequent `gawk' releases -will track the standard and implement whatever the final version -specifies; this Info file will be updated as well.(2) +`gsub'. The POSIX standard took much longer to be revised than was +expected in 1996. The 2001 standard does not follow the above rules. +Instead, the rules there are somewhat simpler. The results are similar +except for one case. + + The 2001 POSIX rules state that `\&' in the replacement string +produces a literal `&', `\\' produces a literal `\', and `\' followed +by anything else is not special; the `\' is placed straight into the +output. These rules are presented in *Note table-posix-2001-sub::. + + You type `sub' sees `sub' generates + ------- --------- -------------- + `\\\\\\&' `\\\&' a literal `\&' + `\\\\&' `\\&' a literal `\', followed by the matched text + `\\&' `\&' a literal `&' + `\\q' `\q' a literal `\q' + `\\\\' `\\' `\' + +Table 8.4: POSIX 2001 rules for sub + + The only case where the difference is noticeable is the last one: +`\\\\' is seen as `\\' and produces `\' instead of `\\'. + + Starting with version 3.1.4, `gawk' follows the POSIX rules when +`--posix' is specified (*note Options::). Otherwise, it continues to +follow the 1996 proposed rules, since, as of this writing, that has +been its behavior for over seven years. + + NOTE: At the next major release, `gawk' will switch to using the + POSIX 2001 rules by default. The rules for `gensub' are considerably simpler. At the runtime level, whenever `gawk' sees a `\', if the following character is a digit, then the text that matched the corresponding parenthesized subexpression is placed in the generated output. Otherwise, no matter what character follows the `\', it appears in the generated text and -the `\' does not: +the `\' does not, as shown in *Note table-gensub-escapes::. You type `gensub' sees `gensub' generates - -------- ------------- ------------------ + ------- ------------ ----------------- `&' `&' the matched text `\\&' `\&' a literal `&' `\\\\' `\\' a literal `\' @@ -9633,6 +9764,8 @@ the `\' does not: `\\\\\\&' `\\\&' a literal `\&' `\\q' `\q' a literal `q' +Table 8.5: Escape Sequence Processing for gensub + Because of the complexity of the lexical and runtime level processing and the special cases for `sub' and `gsub', we recommend the use of `gawk' and `gensub' when you have to do substitutions. @@ -9640,7 +9773,7 @@ and the special cases for `sub' and `gsub', we recommend the use of Advanced Notes: Matching the Null String ---------------------------------------- - In `awk', the `*' operator can match the null string. This is +In `awk', the `*' operator can match the null string. This is particularly important for the `sub', `gsub', and `gensub' functions. For example: @@ -9649,21 +9782,17 @@ For example: Although this makes a certain amount of sense, it can be surprising. - ---------- Footnotes ---------- - - (1) This consequence was certainly unintended. +---------- Footnotes ---------- - (2) As this Info file was being finalized, we learned that the POSIX -standard will not use these rules. However, it was too late to change -`gawk' for the 3.1 release. `gawk' behaves as described here. +(1) This consequence was certainly unintended.  File: gawk.info, Node: I/O Functions, Next: Time Functions, Prev: String Functions, Up: Built-in -Input/Output Functions ----------------------- +8.1.5 Input/Output Functions +---------------------------- - The following functions relate to input/output (I/O). Optional +The following functions relate to input/output (I/O). Optional parameters are enclosed in square brackets ([ ]): `close(FILENAME [, HOW])' @@ -9752,11 +9881,11 @@ parameters are enclosed in square brackets ([ ]): Advanced Notes: Interactive Versus Noninteractive Buffering ----------------------------------------------------------- - As a side point, buffering issues can be even more confusing, -depending upon whether your program is "interactive", i.e., -communicating with a user sitting at a keyboard.(1) +As a side point, buffering issues can be even more confusing, depending +upon whether your program is "interactive", i.e., communicating with a +user sitting at a keyboard.(1) - Interactive programs generally "line buffer" their output; i.e., they +Interactive programs generally "line buffer" their output; i.e., they write out every line. Noninteractive programs wait until they have a full buffer, which may be many lines of output. Here is an example of the difference: @@ -9784,11 +9913,10 @@ it is all buffered and sent down the pipe to `cat' in one shot. Advanced Notes: Controlling Output Buffering with `system' ---------------------------------------------------------- - The `fflush' function provides explicit control over output -buffering for individual files and pipes. However, its use is not -portable to many other `awk' implementations. An alternative method to -flush output buffers is to call `system' with a null string as its -argument: +The `fflush' function provides explicit control over output buffering +for individual files and pipes. However, its use is not portable to +many other `awk' implementations. An alternative method to flush output +buffers is to call `system' with a null string as its argument: system("") # flush output @@ -9801,7 +9929,7 @@ unnecessary shell. (Other implementations may only flush the buffer associated with the standard output and not necessarily all buffered output.) - If you think about what a programmer expects, it makes sense that +If you think about what a programmer expects, it makes sense that `system' should flush any pending output. The following program: BEGIN { @@ -9822,21 +9950,21 @@ and not: first print second print - If `awk' did not flush its buffers before calling `system', you -would see the latter (undesirable) output. +If `awk' did not flush its buffers before calling `system', you would +see the latter (undesirable) output. - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) A program is interactive if the standard output is connected to -a terminal device. +(1) A program is interactive if the standard output is connected to a +terminal device.  File: gawk.info, Node: Time Functions, Next: Bitwise Functions, Prev: I/O Functions, Up: Built-in -Using `gawk''s Timestamp Functions ----------------------------------- +8.1.8 Using `gawk''s Timestamp Functions +---------------------------------------- - `awk' programs are commonly used to process log files containing +`awk' programs are commonly used to process log files containing timestamp information, indicating when a particular log record was written. Many programs log their timestamp in the form returned by the `time' system call, which is the number of seconds since a particular @@ -9847,7 +9975,7 @@ which is sufficient to represent times through 2038-01-19 03:14:07 UTC. Many systems support a wider range of timestamps, including negative timestamps that represent times before the epoch. - In order to make it easier to process such log files and to produce +In order to make it easier to process such log files and to produce useful reports, `gawk' provides the following functions for working with timestamps. They are `gawk' extensions; they are not specified in the POSIX standard, nor are they in any other known version of `awk'.(2) @@ -9894,26 +10022,26 @@ Optional parameters are enclosed in square brackets ([ ]): that of the `date' utility. (Versions of `gawk' prior to 3.0 require the FORMAT argument.) - The `systime' function allows you to compare a timestamp from a log +The `systime' function allows you to compare a timestamp from a log file with the current time of day. In particular, it is easy to determine how long ago a particular record was logged. It also allows you to produce log records using the "seconds since the epoch" format. - The `mktime' function allows you to convert a textual representation -of a date and time into a timestamp. This makes it easy to do +The `mktime' function allows you to convert a textual representation of +a date and time into a timestamp. This makes it easy to do before/after comparisons of dates and times, particularly when dealing with date and time data coming from an external source, such as a log file. - The `strftime' function allows you to easily turn a timestamp into +The `strftime' function allows you to easily turn a timestamp into human-readable information. It is similar in nature to the `sprintf' function (*note String Functions::), in that it copies nonformat specification characters verbatim to the returned string, while substituting date and time values for format specifications in the FORMAT string. - `strftime' is guaranteed by the 1999 ISO C standard(4) to support -the following date format specifications: +`strftime' is guaranteed by the 1999 ISO C standard(4) to support the +following date format specifications: `%a' The locale's abbreviated weekday name. @@ -10053,10 +10181,10 @@ the following date format specifications: `%%' A literal `%'. - If a conversion specifier is not one of the above, the behavior is +If a conversion specifier is not one of the above, the behavior is undefined.(6) - Informally, a "locale" is the geographic place in which a program is +Informally, a "locale" is the geographic place in which a program is meant to run. For example, a common way to abbreviate the date September 4, 1991 in the United States is "9/4/91." In many countries in Europe, however, it is abbreviated "4.9.91." Thus, the `%x' @@ -10065,7 +10193,7 @@ specification in a `"US"' locale might produce `9/4/91', while in a defines a default `"C"' locale, which is an environment that is typical of what most C programmers are used to. - A public-domain C version of `strftime' is supplied with `gawk' for +A public-domain C version of `strftime' is supplied with `gawk' for systems that are not yet fully standards-compliant. It supports all of the just listed format specifications. If that version is used to compile `gawk' (*note Installation::), then the following additional @@ -10091,12 +10219,12 @@ format specifications are available: `%v' The date in VMS format (e.g., `20-JUN-1991'). - Additionally, the alternate representations are recognized but their +Additionally, the alternate representations are recognized but their normal representations are used. - This example is an `awk' implementation of the POSIX `date' utility. -Normally, the `date' utility prints the current date and time of day -in a well-known format. However, if you provide an argument to it that +This example is an `awk' implementation of the POSIX `date' utility. +Normally, the `date' utility prints the current date and time of day in +a well-known format. However, if you provide an argument to it that begins with a `+', `date' copies nonformat specifier characters to the standard output and interprets the current time according to the format specifiers in the string. For example: @@ -10104,24 +10232,24 @@ specifiers in the string. For example: $ date '+Today is %A, %B %d, %Y.' -| Today is Thursday, September 14, 2000. - Here is the `gawk' version of the `date' utility. It has a shell +Here is the `gawk' version of the `date' utility. It has a shell "wrapper" to handle the `-u' option, which requires that `date' run as if the time zone is set to UTC: #! /bin/sh # # date --- approximate the P1003.2 'date' command - + case $1 in -u) TZ=UTC0 # use UTC export TZ shift ;; esac - + gawk 'BEGIN { format = "%a %b %d %H:%M:%S %Z %Y" exitval = 0 - + if (ARGC > 2) exitval = 1 else if (ARGC == 2) { @@ -10133,26 +10261,26 @@ if the time zone is set to UTC: exit exitval }' "$@" - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) *Note Glossary::, especially the entries "Epoch" and "UTC." +(1) *Note Glossary::, especially the entries "Epoch" and "UTC." - (2) The GNU `date' utility can also do many of the things described +(2) The GNU `date' utility can also do many of the things described here. Its use may be preferable for simple time-related operations in shell scripts. - (3) Occasionally there are minutes in a year with a leap second, -which is why the seconds can go up to 60. +(3) Occasionally there are minutes in a year with a leap second, which +is why the seconds can go up to 60. - (4) As this is a recent standard, not every system's `strftime' +(4) As this is a recent standard, not every system's `strftime' necessarily supports all of the conversions listed here. - (5) If you don't understand any of this, don't worry about it; these +(5) If you don't understand any of this, don't worry about it; these facilities are meant to make it easier to "internationalize" programs. Other internationalization features are described in *Note Internationalization::. - (6) This is because ISO C leaves the behavior of the C version of +(6) This is because ISO C leaves the behavior of the C version of `strftime' undefined and `gawk' uses the system's version of `strftime' if it's there. Typically, the conversion specifier either does not appear in the returned string or appears literally. @@ -10160,26 +10288,28 @@ appear in the returned string or appears literally.  File: gawk.info, Node: Bitwise Functions, Next: I18N Functions, Prev: Time Functions, Up: Built-in -Bit-Manipulation Functions of `gawk' ------------------------------------- +8.1.9 Bit-Manipulation Functions of `gawk' +------------------------------------------ I can explain it for you, but I can't understand it for you. Anonymous - Many languages provide the ability to perform "bitwise" operations -on two integer numbers. In other words, the operation is performed on +Many languages provide the ability to perform "bitwise" operations on +two integer numbers. In other words, the operation is performed on each successive pair of bits in the operands. Three common operations -are bitwise AND, OR, and XOR. The operations are described by the -following table: +are bitwise AND, OR, and XOR. The operations are described in *Note +table-bitwise-ops::. Bit Operator | AND | OR | XOR - |---+---+---+---+---+--- + |--+--+--+--+--+-- Operands | 0 | 1 | 0 | 1 | 0 | 1 - ----------+---+---+---+---+---+--- + ---------+--+--+--+--+--+-- 0 | 0 0 | 0 1 | 0 1 1 | 0 1 | 1 1 | 1 0 +Table 8.6: Bitwise Operations + As you can see, the result of an AND operation is 1 only when _both_ bits are 1. The result of an OR operation is 1 if _either_ bit is 1. The result of an XOR operation is 1 if either bit is 1, but not both. @@ -10206,30 +10336,32 @@ bitwise operations just described. They are: For all of these functions, first the double-precision floating-point value is converted to the widest C unsigned integer -type, then the bitwise operation is performed and then the result is -converted back into a C `double'. (If you don't understand this +type, then the bitwise operation is performed. If the result cannot be +represented exactly as a C `double', leading nonzero bits are removed +one by one until it can be represented exactly. The result is then +converted back into a C `double'. (If you don't understand this paragraph, don't worry about it.) Here is a user-defined function (*note User-defined::) that illustrates the use of these functions: # bits2str --- turn a byte into readable 1's and 0's - + function bits2str(bits, data, mask) { if (bits == 0) return "0" - + mask = 1 for (; bits != 0; bits = rshift(bits, 1)) data = (and(bits, mask) ? "1" : "0") data - + while ((length(data) % 8) != 0) data = "0" data - + return data } - + BEGIN { printf "123 = %s\n", bits2str(123) printf "0123 = %s\n", bits2str(0123) @@ -10252,7 +10384,7 @@ This program produces the following output when run: -| lshift(0x99, 2) = 0x264 = 0000001001100100 -| rshift(0x99, 2) = 0x26 = 00100110 - The `bits2str' function turns a binary number into a string. The +The `bits2str' function turns a binary number into a string. The number `1' represents a binary value where the rightmost bit is set to 1. Using this mask, the function repeatedly checks the rightmost bit. ANDing the mask with the value indicates whether the rightmost bit is 1 @@ -10260,28 +10392,28 @@ or not. If so, a `"1"' is concatenated onto the front of the string. Otherwise, a `"0"' is added. The value is then shifted right by one bit and the loop continues until there are no more 1 bits. - If the initial value is zero it returns a simple `"0"'. Otherwise, -at the end, it pads the value with zeros to represent multiples of -8-bit quantities. This is typical in modern computers. +If the initial value is zero it returns a simple `"0"'. Otherwise, at +the end, it pads the value with zeros to represent multiples of 8-bit +quantities. This is typical in modern computers. - The main code in the `BEGIN' rule shows the difference between the +The main code in the `BEGIN' rule shows the difference between the decimal and octal values for the same numbers (*note Nondecimal-numbers::), and then demonstrates the results of the `compl', `lshift', and `rshift' functions. - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) This example shows that 0's come in on the left side. For -`gawk', this is always true, but in some languages, it's possible to -have the left side fill with 1's. Caveat emptor. +(1) This example shows that 0's come in on the left side. For `gawk', +this is always true, but in some languages, it's possible to have the +left side fill with 1's. Caveat emptor.  File: gawk.info, Node: I18N Functions, Prev: Bitwise Functions, Up: Built-in -Using `gawk''s String-Translation Functions -------------------------------------------- +8.1.10 Using `gawk''s String-Translation Functions +-------------------------------------------------- - `gawk' provides facilities for internationalizing `awk' programs. +`gawk' provides facilities for internationalizing `awk' programs. These include the functions described in the following list. The descriptions here are purposely brief. *Note Internationalization::, for the full story. Optional parameters are enclosed in square @@ -10314,11 +10446,11 @@ brackets ([ ]):  File: gawk.info, Node: User-defined, Prev: Built-in, Up: Functions -User-Defined Functions -====================== +8.2 User-Defined Functions +========================== - Complicated `awk' programs can often be simplified by defining your -own functions. User-defined functions can be called just like built-in +Complicated `awk' programs can often be simplified by defining your own +functions. User-defined functions can be called just like built-in ones (*note Function Calls::), but it is up to you to define them, i.e., to tell `awk' what they should do. @@ -10334,17 +10466,17 @@ i.e., to tell `awk' what they should do.  File: gawk.info, Node: Definition Syntax, Next: Function Example, Up: User-defined -Function Definition Syntax --------------------------- +8.2.1 Function Definition Syntax +-------------------------------- - Definitions of functions can appear anywhere between the rules of an +Definitions of functions can appear anywhere between the rules of an `awk' program. Thus, the general form of an `awk' program is extended to include sequences of rules _and_ user-defined function definitions. There is no need to put the definition of a function before all uses of the function. This is because `awk' reads the entire program before starting to execute any of it. - The definition of a function named NAME looks like this: +The definition of a function named NAME looks like this: function NAME(PARAMETER-LIST) { @@ -10357,58 +10489,58 @@ underscores that doesn't start with a digit. Within a single `awk' program, any particular name can only be used as a variable, array, or function. - PARAMETER-LIST is a list of the function's arguments and local -variable names, separated by commas. When the function is called, the -argument names are used to hold the argument values given in the call. -The local variables are initialized to the empty string. A function -cannot have two parameters with the same name, nor may it have a -parameter with the same name as the function itself. +PARAMETER-LIST is a list of the function's arguments and local variable +names, separated by commas. When the function is called, the argument +names are used to hold the argument values given in the call. The +local variables are initialized to the empty string. A function cannot +have two parameters with the same name, nor may it have a parameter +with the same name as the function itself. - The BODY-OF-FUNCTION consists of `awk' statements. It is the most +The BODY-OF-FUNCTION consists of `awk' statements. It is the most important part of the definition, because it says what the function should actually _do_. The argument names exist to give the body a way to talk about the arguments; local variables exist to give the body places to keep temporary values. - Argument names are not distinguished syntactically from local -variable names. Instead, the number of arguments supplied when the -function is called determines how many argument variables there are. -Thus, if three argument values are given, the first three names in -PARAMETER-LIST are arguments and the rest are local variables. - - It follows that if the number of arguments is not the same in all -calls to the function, some of the names in PARAMETER-LIST may be -arguments on some occasions and local variables on others. Another way -to think of this is that omitted arguments default to the null string. - - Usually when you write a function, you know how many names you -intend to use for arguments and how many you intend to use as local -variables. It is conventional to place some extra space between the -arguments and the local variables, in order to document how your -function is supposed to be used. - - During execution of the function body, the arguments and local -variable values hide, or "shadow", any variables of the same names used -in the rest of the program. The shadowed variables are not accessible -in the function definition, because there is no way to name them while -their names have been taken away for the local variables. All other -variables used in the `awk' program can be referenced or set normally -in the function's body. - - The arguments and local variables last only as long as the function -body is executing. Once the body finishes, you can once again access -the variables that were shadowed while the function was running. - - The function body can contain expressions that call functions. They +Argument names are not distinguished syntactically from local variable +names. Instead, the number of arguments supplied when the function is +called determines how many argument variables there are. Thus, if three +argument values are given, the first three names in PARAMETER-LIST are +arguments and the rest are local variables. + +It follows that if the number of arguments is not the same in all calls +to the function, some of the names in PARAMETER-LIST may be arguments +on some occasions and local variables on others. Another way to think +of this is that omitted arguments default to the null string. + +Usually when you write a function, you know how many names you intend to +use for arguments and how many you intend to use as local variables. +It is conventional to place some extra space between the arguments and +the local variables, in order to document how your function is supposed +to be used. + +During execution of the function body, the arguments and local variable +values hide, or "shadow", any variables of the same names used in the +rest of the program. The shadowed variables are not accessible in the +function definition, because there is no way to name them while their +names have been taken away for the local variables. All other variables +used in the `awk' program can be referenced or set normally in the +function's body. + +The arguments and local variables last only as long as the function body +is executing. Once the body finishes, you can once again access the +variables that were shadowed while the function was running. + +The function body can contain expressions that call functions. They can even call this function, either directly or by way of another function. When this happens, we say the function is "recursive". The act of a function calling itself is called "recursion". - In many `awk' implementations, including `gawk', the keyword -`function' may be abbreviated `func'. However, POSIX only specifies -the use of the keyword `function'. This actually has some practical -implications. If `gawk' is in POSIX-compatibility mode (*note -Options::), then the following statement does _not_ define a function: +In many `awk' implementations, including `gawk', the keyword `function' +may be abbreviated `func'. However, POSIX only specifies the use of +the keyword `function'. This actually has some practical implications. +If `gawk' is in POSIX-compatibility mode (*note Options::), then the +following statement does _not_ define a function: func foo() { a = sqrt($1) ; print a } @@ -10419,16 +10551,16 @@ probably not what is desired. (`awk' accepts this input as syntactically valid, because functions may be used before they are defined in `awk' programs.) - To ensure that your `awk' programs are portable, always use the -keyword `function' when defining a function. +To ensure that your `awk' programs are portable, always use the keyword +`function' when defining a function.  File: gawk.info, Node: Function Example, Next: Function Caveats, Prev: Definition Syntax, Up: User-defined -Function Definition Examples ----------------------------- +8.2.2 Function Definition Examples +---------------------------------- - Here is an example of a user-defined function, called `myprint', that +Here is an example of a user-defined function, called `myprint', that takes a number and prints it in a specific format: function myprint(num) @@ -10453,7 +10585,7 @@ this program, using our function to format the results, prints: 5.6 21.2 - This function deletes all the elements in an array: +This function deletes all the elements in an array: function delarray(a, i) { @@ -10461,15 +10593,15 @@ this program, using our function to format the results, prints: delete a[i] } - When working with arrays, it is often necessary to delete all the +When working with arrays, it is often necessary to delete all the elements in an array and start over with a new list of elements (*note Delete::). Instead of having to repeat this loop everywhere that you need to clear out an array, your program can just call `delarray'. (This guarantees portability. The use of `delete ARRAY' to delete the contents of an entire array is a nonstandard extension.) - The following is an example of a recursive function. It takes a -string as an input parameter and returns the string in backwards order. +The following is an example of a recursive function. It takes a string +as an input parameter and returns the string in backwards order. Recursive functions must always have a test that stops the recursion. In this case, the recursion terminates when the starting position is zero, i.e., when there are no more characters left in the string. @@ -10478,18 +10610,18 @@ zero, i.e., when there are no more characters left in the string. { if (start == 0) return "" - + return (substr(str, start, 1) rev(str, start - 1)) } - If this function is in a file named `rev.awk', it can be tested this +If this function is in a file named `rev.awk', it can be tested this way: $ echo "Don't Panic!" | > gawk --source '{ print rev($0, length($0)) }' -f rev.awk -| !cinaP t'noD - The C `ctime' function takes a timestamp and returns it in a string, +The C `ctime' function takes a timestamp and returns it in a string, formatted in a well-known fashion. The following example uses the built-in `strftime' function (*note Time Functions::) to create an `awk' version of `ctime': @@ -10497,7 +10629,7 @@ built-in `strftime' function (*note Time Functions::) to create an # ctime.awk # # awk version of C ctime(3) function - + function ctime(ts, format) { format = "%a %b %d %H:%M:%S %Z %Y" @@ -10509,30 +10641,30 @@ built-in `strftime' function (*note Time Functions::) to create an  File: gawk.info, Node: Function Caveats, Next: Return Statement, Prev: Function Example, Up: User-defined -Calling User-Defined Functions ------------------------------- +8.2.3 Calling User-Defined Functions +------------------------------------ - "Calling a function" means causing the function to run and do its -job. A function call is an expression and its value is the value -returned by the function. +"Calling a function" means causing the function to run and do its job. +A function call is an expression and its value is the value returned by +the function. - A function call consists of the function name followed by the -arguments in parentheses. `awk' expressions are what you write in the -call for the arguments. Each time the call is executed, these -expressions are evaluated, and the values are the actual arguments. For -example, here is a call to `foo' with three arguments (the first being -a string concatenation): +A function call consists of the function name followed by the arguments +in parentheses. `awk' expressions are what you write in the call for +the arguments. Each time the call is executed, these expressions are +evaluated, and the values are the actual arguments. For example, here +is a call to `foo' with three arguments (the first being a string +concatenation): foo(x y, "lose", 4 * z) - *Caution:* Whitespace characters (spaces and tabs) are not allowed +*Caution:* Whitespace characters (spaces and tabs) are not allowed between the function name and the open-parenthesis of the argument list. If you write whitespace by mistake, `awk' might think that you mean to concatenate a variable with an expression in parentheses. However, it notices that you used a function name and not a variable name, and reports an error. - When a function is called, it is given a _copy_ of the values of its +When a function is called, it is given a _copy_ of the values of its arguments. This is known as "call by value". The caller may use a variable as the expression for the argument, but the called function does not know this--it only knows what value the argument had. For @@ -10561,31 +10693,31 @@ outside of `myfunc', the function body cannot alter this outer value, because it is shadowed during the execution of `myfunc' and cannot be seen or changed from there. - However, when arrays are the parameters to functions, they are _not_ +However, when arrays are the parameters to functions, they are _not_ copied. Instead, the array itself is made available for direct manipulation by the function. This is usually called "call by reference". Changes made to an array parameter inside the body of a function _are_ visible outside that function. - *Note:* Changing an array parameter inside a function can be very -dangerous if you do not watch what you are doing. For example: + NOTE: Changing an array parameter inside a function can be very + dangerous if you do not watch what you are doing. For example: - function changeit(array, ind, nvalue) - { - array[ind] = nvalue - } - - BEGIN { - a[1] = 1; a[2] = 2; a[3] = 3 - changeit(a, 2, "two") - printf "a[1] = %s, a[2] = %s, a[3] = %s\n", - a[1], a[2], a[3] - } + function changeit(array, ind, nvalue) + { + array[ind] = nvalue + } + + BEGIN { + a[1] = 1; a[2] = 2; a[3] = 3 + changeit(a, 2, "two") + printf "a[1] = %s, a[2] = %s, a[3] = %s\n", + a[1], a[2], a[3] + } -prints `a[1] = 1, a[2] = two, a[3] = 3', because `changeit' stores -`"two"' in the second element of `a'. + prints `a[1] = 1, a[2] = two, a[3] = 3', because `changeit' stores + `"two"' in the second element of `a'. - Some `awk' implementations allow you to call a function that has not +Some `awk' implementations allow you to call a function that has not been defined. They only report a problem at runtime when the program actually tries to call the function. For example: @@ -10602,42 +10734,42 @@ Because the `if' statement will never be true, it is not really a problem that `foo' has not been defined. Usually, though, it is a problem if a program calls an undefined function. - If `--lint' is specified (*note Options::), `gawk' reports calls to +If `--lint' is specified (*note Options::), `gawk' reports calls to undefined functions. - Some `awk' implementations generate a runtime error if you use the +Some `awk' implementations generate a runtime error if you use the `next' statement (*note Next Statement::) inside a user-defined function. `gawk' does not have this limitation.  File: gawk.info, Node: Return Statement, Next: Dynamic Typing, Prev: Function Caveats, Up: User-defined -The `return' Statement ----------------------- +8.2.4 The `return' Statement +---------------------------- - The body of a user-defined function can contain a `return' statement. +The body of a user-defined function can contain a `return' statement. This statement returns control to the calling part of the `awk' program. It can also be used to return a value for use in the rest of the `awk' program. It looks like this: return [EXPRESSION] - The EXPRESSION part is optional. If it is omitted, then the returned +The EXPRESSION part is optional. If it is omitted, then the returned value is undefined, and therefore, unpredictable. - A `return' statement with no value expression is assumed at the end -of every function definition. So if control reaches the end of the +A `return' statement with no value expression is assumed at the end of +every function definition. So if control reaches the end of the function body, then the function returns an unpredictable value. `awk' does _not_ warn you if you use the return value of such a function. - Sometimes, you want to write a function for what it does, not for -what it returns. Such a function corresponds to a `void' function in C -or to a `procedure' in Pascal. Thus, it may be appropriate to not -return any value; simply bear in mind that if you use the return value -of such a function, you do so at your own risk. +Sometimes, you want to write a function for what it does, not for what +it returns. Such a function corresponds to a `void' function in C or +to a `procedure' in Pascal. Thus, it may be appropriate to not return +any value; simply bear in mind that if you use the return value of such +a function, you do so at your own risk. - The following is an example of a user-defined function that returns -a value for the largest number among the elements of an array: +The following is an example of a user-defined function that returns a +value for the largest number among the elements of an array: function maxelt(vec, i, ret) { @@ -10656,9 +10788,8 @@ function parameter list indicates that `i' and `ret' are not supposed to be arguments. You should follow this convention when defining functions. - The following program uses the `maxelt' function. It loads an -array, calls `maxelt', and then reports the maximum number in that -array: +The following program uses the `maxelt' function. It loads an array, +calls `maxelt', and then reports the maximum number in that array: function maxelt(vec, i, ret) { @@ -10668,18 +10799,18 @@ array: } return ret } - + # Load all fields of each record into nums. { for(i = 1; i <= NF; i++) nums[NR, i] = $i } - + END { print maxelt(nums) } - Given the following input: +Given the following input: 1 5 23 8 16 44 3 5 2 8 26 @@ -10693,50 +10824,49 @@ the array.  File: gawk.info, Node: Dynamic Typing, Prev: Return Statement, Up: User-defined -Functions and Their Effects on Variable Typing ----------------------------------------------- +8.2.5 Functions and Their Effects on Variable Typing +---------------------------------------------------- - `awk' is a very fluid language. It is possible that `awk' can't -tell if an identifier represents a regular variable or an array until +`awk' is a very fluid language. It is possible that `awk' can't tell +if an identifier represents a regular variable or an array until runtime. Here is an annotated sample program: function foo(a) { a[1] = 1 # parameter is an array } - + BEGIN { b = 1 foo(b) # invalid: fatal type mismatch - + foo(x) # x uninitialized, becomes an array dynamically x = 1 # now not allowed, runtime error } - Usually, such things aren't a big issue, but it's worth being aware -of them. +Usually, such things aren't a big issue, but it's worth being aware of +them.  File: gawk.info, Node: Internationalization, Next: Advanced Features, Prev: Functions, Up: Top -Internationalization with `gawk' -******************************** +9 Internationalization with `gawk' +********************************** - Once upon a time, computer makers wrote software that worked only in +Once upon a time, computer makers wrote software that worked only in English. Eventually, hardware and software vendors noticed that if their systems worked in the native languages of non-English-speaking countries, they were able to sell more systems. As a result, internationalization and localization of programs and software systems became a common practice. - Until recently, the ability to provide internationalization was -largely restricted to programs written in C and C++. This major node -describes the underlying library `gawk' uses for internationalization, -as well as how `gawk' makes internationalization features available at -the `awk' program level. Having internationalization available at the -`awk' level gives software developers additional flexibility--they are -no longer required to write in C when internationalization is a -requirement. +Until recently, the ability to provide internationalization was largely +restricted to programs written in C and C++. This major node describes +the underlying library `gawk' uses for internationalization, as well as +how `gawk' makes internationalization features available at the `awk' +program level. Having internationalization available at the `awk' level +gives software developers additional flexibility--they are no longer +required to write in C when internationalization is a requirement. * Menu: @@ -10750,35 +10880,35 @@ requirement.  File: gawk.info, Node: I18N and L10N, Next: Explaining gettext, Up: Internationalization -Internationalization and Localization -===================================== +9.1 Internationalization and Localization +========================================= - "Internationalization" means writing (or modifying) a program once, -in such a way that it can use multiple languages without requiring -further source-code changes. "Localization" means providing the data -necessary for an internationalized program to work in a particular -language. Most typically, these terms refer to features such as the -language used for printing error messages, the language used to read -responses, and information related to how numerical and monetary values -are printed and read. +"Internationalization" means writing (or modifying) a program once, in +such a way that it can use multiple languages without requiring further +source-code changes. "Localization" means providing the data necessary +for an internationalized program to work in a particular language. +Most typically, these terms refer to features such as the language used +for printing error messages, the language used to read responses, and +information related to how numerical and monetary values are printed +and read.  File: gawk.info, Node: Explaining gettext, Next: Programmer i18n, Prev: I18N and L10N, Up: Internationalization -GNU `gettext' -============= +9.2 GNU `gettext' +================= - The facilities in GNU `gettext' focus on messages; strings printed -by a program, either directly or via formatting with `printf' or +The facilities in GNU `gettext' focus on messages; strings printed by a +program, either directly or via formatting with `printf' or `sprintf'.(1) - When using GNU `gettext', each application has its own "text -domain". This is a unique name, such as `kpilot' or `gawk', that -identifies the application. A complete application may have multiple +When using GNU `gettext', each application has its own "text domain". +This is a unique name, such as `kpilot' or `gawk', that identifies the +application. A complete application may have multiple components--programs written in C or C++, as well as scripts written in `sh' or `awk'. All of the components use the same text domain. - To make the discussion concrete, assume we're writing an application +To make the discussion concrete, assume we're writing an application named `guide'. Internationalization consists of the following steps, in this order: @@ -10822,21 +10952,21 @@ in this order: having to switch the application's default text domain back and forth. - In C (or C++), the string marking and dynamic translation lookup are +In C (or C++), the string marking and dynamic translation lookup are accomplished by wrapping each string in a call to `gettext': printf(gettext("Don't Panic!\n")); - The tools that extract messages from source code pull out all -strings enclosed in calls to `gettext'. +The tools that extract messages from source code pull out all strings +enclosed in calls to `gettext'. - The GNU `gettext' developers, recognizing that typing `gettext' over +The GNU `gettext' developers, recognizing that typing `gettext' over and over again is both painful and ugly to look at, use the macro `_' (an underscore) to make things easier: /* In the standard header file: */ #define _(str) gettext(str) - + /* In the program text: */ printf(_("Don't Panic!\n")); @@ -10881,24 +11011,24 @@ defined locale categories that `gettext' knows about are: `LC_ALL' All of the above. (Not too useful in the context of `gettext'.) - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) For some operating systems, the `gawk' port doesn't support GNU +(1) For some operating systems, the `gawk' port doesn't support GNU `gettext'. This applies most notably to the PC operating systems. As such, these features are not available if you are using one of those operating systems. Sorry. - (2) Americans use a comma every three decimal places and a period -for the decimal point, while many Europeans do exactly the opposite: +(2) Americans use a comma every three decimal places and a period for +the decimal point, while many Europeans do exactly the opposite: `1,234.56' versus `1.234,56'.  File: gawk.info, Node: Programmer i18n, Next: Translator i18n, Prev: Explaining gettext, Up: Internationalization -Internationalizing `awk' Programs -================================= +9.3 Internationalizing `awk' Programs +===================================== - `gawk' provides the following variables and functions for +`gawk' provides the following variables and functions for internationalization: `TEXTDOMAIN' @@ -10947,7 +11077,7 @@ internationalization: the null string (`""'), then `bindtextdomain' returns the current binding for the given DOMAIN. - To use these facilities in your `awk' program, follow the steps +To use these facilities in your `awk' program, follow the steps outlined in *Note Explaining gettext::, like so: 1. Set the variable `TEXTDOMAIN' to the text domain of your program. @@ -10994,21 +11124,21 @@ outlined in *Note Explaining gettext::, like so: } - *Note I18N Example::, for an example program showing the steps to -create and use translations from `awk'. +*Note I18N Example::, for an example program showing the steps to create +and use translations from `awk'.  File: gawk.info, Node: Translator i18n, Next: I18N Example, Prev: Programmer i18n, Up: Internationalization -Translating `awk' Programs -========================== +9.4 Translating `awk' Programs +============================== - Once a program's translatable strings have been marked, they must be +Once a program's translatable strings have been marked, they must be extracted to create the initial `.po' file. As part of translation, it is often helpful to rearrange the order in which arguments to `printf' are output. - `gawk''s `--gen-po' command-line option extracts the messages and is +`gawk''s `--gen-po' command-line option extracts the messages and is discussed next. After that, `printf''s ability to rearrange the order for `printf' arguments at runtime is covered. @@ -11021,17 +11151,17 @@ for `printf' arguments at runtime is covered.  File: gawk.info, Node: String Extraction, Next: Printf Ordering, Up: Translator i18n -Extracting Marked Strings -------------------------- +9.4.1 Extracting Marked Strings +------------------------------- - Once your `awk' program is working, and all the strings have been +Once your `awk' program is working, and all the strings have been marked and you've set (and perhaps bound) the text domain, it is time to produce translations. First, use the `--gen-po' command-line option to create the initial `.po' file: $ gawk --gen-po -f guide.awk > guide.po - When run with `--gen-po', `gawk' does not execute your program. +When run with `--gen-po', `gawk' does not execute your program. Instead, it parses it as usual and prints all marked strings to standard output in the format of a GNU `gettext' Portable Object file. Also included in the output are any constant strings that appear as the @@ -11039,39 +11169,39 @@ first argument to `dcgettext' or as the first and second argument to `dcngettext'.(1) *Note I18N Example::, for the full list of steps to go through to create and test translations for `guide'. - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) Starting with `gettext' version 0.11.5, the `xgettext' utility -that comes with GNU `gettext' can handle `.awk' files. +(1) Starting with `gettext' version 0.11.5, the `xgettext' utility that +comes with GNU `gettext' can handle `.awk' files.  File: gawk.info, Node: Printf Ordering, Next: I18N Portability, Prev: String Extraction, Up: Translator i18n -Rearranging `printf' Arguments ------------------------------- +9.4.2 Rearranging `printf' Arguments +------------------------------------ - Format strings for `printf' and `sprintf' (*note Printf::) present a +Format strings for `printf' and `sprintf' (*note Printf::) present a special problem for translation. Consider the following:(1) printf(_"String `%s' has %d characters\n", string, length(string))) - A possible German translation for this might be: +A possible German translation for this might be: "%d Zeichen lang ist die Zeichenkette `%s'\n" - The problem should be obvious: the order of the format -specifications is different from the original! Even though `gettext' -can return the translated string at runtime, it cannot change the -argument order in the call to `printf'. +The problem should be obvious: the order of the format specifications +is different from the original! Even though `gettext' can return the +translated string at runtime, it cannot change the argument order in +the call to `printf'. - To solve this problem, `printf' format specificiers may have an +To solve this problem, `printf' format specificiers may have an additional optional element, which we call a "positional specifier". For example: "%2$d Zeichen lang ist die Zeichenkette `%1$s'\n" - Here, the positional specifier consists of an integer count, which +Here, the positional specifier consists of an integer count, which indicates which argument to use, and a `$'. Counts are one-based, and the format string itself is _not_ included. Thus, in the following example, `string' is the first argument and `length(string)' is the @@ -11084,10 +11214,10 @@ second: > }' -| 10 characters live in "Dont Panic" - If present, positional specifiers come first in the format +If present, positional specifiers come first in the format specification, before the flags, the field width, and/or the precision. - Positional specifiers can be used with the dynamic field width and +Positional specifiers can be used with the dynamic field width and precision capability: $ gawk 'BEGIN { @@ -11097,38 +11227,39 @@ precision capability: -| hello -| hello -*Note:* When using `*' with a positional specifier, the `*' comes -first, then the integer position, and then the `$'. This is somewhat -counterintutive. + NOTE: When using `*' with a positional specifier, the `*' comes + first, then the integer position, and then the `$'. This is + somewhat counterintutive. - `gawk' does not allow you to mix regular format specifiers and those +`gawk' does not allow you to mix regular format specifiers and those with positional specifiers in the same string: $ gawk 'BEGIN { printf _"%d %3$s\n", 1, 2, "hi" }' error--> gawk: cmd. line:1: fatal: must use `count$' on all formats or none - *Note:* There are some pathological cases that `gawk' may fail to -diagnose. In such cases, the output may not be what you expect. It's -still a bad idea to try mixing them, even if `gawk' doesn't detect it. + NOTE: There are some pathological cases that `gawk' may fail to + diagnose. In such cases, the output may not be what you expect. + It's still a bad idea to try mixing them, even if `gawk' doesn't + detect it. - Although positional specifiers can be used directly in `awk' -programs, their primary purpose is to help in producing correct -translations of format strings into languages different from the one in -which the program is first written. +Although positional specifiers can be used directly in `awk' programs, +their primary purpose is to help in producing correct translations of +format strings into languages different from the one in which the +program is first written. - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) This example is borrowed from the GNU `gettext' manual. +(1) This example is borrowed from the GNU `gettext' manual.  File: gawk.info, Node: I18N Portability, Prev: Printf Ordering, Up: Translator i18n -`awk' Portability Issues ------------------------- +9.4.3 `awk' Portability Issues +------------------------------ - `gawk''s internationalization features were purposely chosen to have -as little impact as possible on the portability of `awk' programs that -use them to other versions of `awk'. Consider this program: +`gawk''s internationalization features were purposely chosen to have as +little impact as possible on the portability of `awk' programs that use +them to other versions of `awk'. Consider this program: BEGIN { TEXTDOMAIN = "guide" @@ -11156,12 +11287,12 @@ actually almost portable, requiring very little change: { return dir } - + function dcgettext(string, domain, category) { return string } - + function dcngettext(string1, string2, number, domain, category) { return (number == 1 ? string1 : string2) @@ -11180,18 +11311,18 @@ actually almost portable, requiring very little change: retrieve the translated string, this should not be a problem in practice. - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) This is good fodder for an "Obfuscated `awk'" contest. +(1) This is good fodder for an "Obfuscated `awk'" contest.  File: gawk.info, Node: I18N Example, Next: Gawk I18N, Prev: Translator i18n, Up: Internationalization -A Simple Internationalization Example -===================================== +9.5 A Simple Internationalization Example +========================================= - Now let's look at a step-by-step example of how to internationalize -and localize a simple `awk' program, using `guide.awk' as our original +Now let's look at a step-by-step example of how to internationalize and +localize a simple `awk' program, using `guide.awk' as our original source: BEGIN { @@ -11211,19 +11342,19 @@ This produces: #: guide.awk:4 msgid "Don't Panic" msgstr "" - + #: guide.awk:5 msgid "The Answer Is" msgstr "" - This original portable object file is saved and reused for each -language into which the application is translated. The `msgid' is the -original string and the `msgstr' is the translation. +This original portable object file is saved and reused for each language +into which the application is translated. The `msgid' is the original +string and the `msgstr' is the translation. - *Note:* Strings not marked with a leading underscore do not appear -in the `guide.po' file. + NOTE: Strings not marked with a leading underscore do not appear + in the `guide.po' file. - Next, the messages must be translated. Here is a translation to a +Next, the messages must be translated. Here is a translation to a hypothetical dialect of English, called "Mellow":(1) $ cp guide.po guide-mellow.po @@ -11234,34 +11365,34 @@ Following are the translations: #: guide.awk:4 msgid "Don't Panic" msgstr "Hey man, relax!" - + #: guide.awk:5 msgid "The Answer Is" msgstr "Like, the scoop is" - The next step is to make the directory to hold the binary message -object file and then to create the `guide.mo' file. The directory -layout shown here is standard for GNU `gettext' on GNU/Linux systems. -Other versions of `gettext' may use a different layout: +The next step is to make the directory to hold the binary message object +file and then to create the `guide.mo' file. The directory layout +shown here is standard for GNU `gettext' on GNU/Linux systems. Other +versions of `gettext' may use a different layout: $ mkdir en_US en_US/LC_MESSAGES - The `msgfmt' utility does the conversion from human-readable `.po' -file to machine-readable `.mo' file. By default, `msgfmt' creates a -file named `messages'. This file must be renamed and placed in the -proper directory so that `gawk' can find it: +The `msgfmt' utility does the conversion from human-readable `.po' file +to machine-readable `.mo' file. By default, `msgfmt' creates a file +named `messages'. This file must be renamed and placed in the proper +directory so that `gawk' can find it: $ msgfmt guide-mellow.po $ mv messages en_US/LC_MESSAGES/guide.mo - Finally, we run the program to test it: +Finally, we run the program to test it: $ gawk -f guide.awk -| Hey man, relax! -| Like, the scoop is 42 -| Pardon me, Zaphod who? - If the three replacement functions for `dcgettext', `dcngettext' and +If the three replacement functions for `dcgettext', `dcngettext' and `bindtextdomain' (*note I18N Portability::) are in a file named `libintl.awk', then we can run `guide.awk' unchanged as follows: @@ -11270,50 +11401,50 @@ proper directory so that `gawk' can find it: -| The Answer Is 42 -| Pardon me, Zaphod who? - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) Perhaps it would be better if it were called "Hippy." Ah, well. +(1) Perhaps it would be better if it were called "Hippy." Ah, well.  File: gawk.info, Node: Gawk I18N, Prev: I18N Example, Up: Internationalization -`gawk' Can Speak Your Language -============================== +9.6 `gawk' Can Speak Your Language +================================== - As of version 3.1, `gawk' itself has been internationalized using -the GNU `gettext' package. (GNU `gettext' is described in complete -detail in *Note Top::.) As of this writing, the latest version of GNU +As of version 3.1, `gawk' itself has been internationalized using the +GNU `gettext' package. (GNU `gettext' is described in complete detail +in *Note Top::.) As of this writing, the latest version of GNU `gettext' is version 0.11.5 (ftp://ftp.gnu.org/gnu/gettext/gettext-0.11.5.tar.gz). - If a translation of `gawk''s messages exists, then `gawk' produces +If a translation of `gawk''s messages exists, then `gawk' produces usage messages, warnings, and fatal errors in the local language. - On systems that do not use version 2 (or later) of the GNU C -library, you should configure `gawk' with the `--with-included-gettext' -option before compiling and installing it. *Note Additional -Configuration Options::, for more information. +On systems that do not use version 2 (or later) of the GNU C library, +you should configure `gawk' with the `--with-included-gettext' option +before compiling and installing it. *Note Additional Configuration +Options::, for more information.  File: gawk.info, Node: Advanced Features, Next: Invoking Gawk, Prev: Internationalization, Up: Top -Advanced Features of `gawk' -*************************** +10 Advanced Features of `gawk' +****************************** Write documentation as if whoever reads it is a violent psychopath who knows where you live. Steve English, as quoted by Peter Langston - This major node discusses advanced features in `gawk'. It's a bit -of a "grab bag" of items that are otherwise unrelated to each other. -First, a command-line option allows `gawk' to recognize nondecimal -numbers in input data, not just in `awk' programs. Next, two-way I/O, -discussed briefly in earlier parts of this Info file, is described in -full detail, along with the basics of TCP/IP networking and BSD portal +This major node discusses advanced features in `gawk'. It's a bit of a +"grab bag" of items that are otherwise unrelated to each other. First, +a command-line option allows `gawk' to recognize nondecimal numbers in +input data, not just in `awk' programs. Next, two-way I/O, discussed +briefly in earlier parts of this Info file, is described in full +detail, along with the basics of TCP/IP networking and BSD portal files. Finally, `gawk' can "profile" an `awk' program, making it possible to tune it for performance. - *Note Dynamic Extensions::, discusses the ability to dynamically add +*Note Dynamic Extensions::, discusses the ability to dynamically add new built-in functions to `gawk'. As this feature is still immature and likely to change, its description is relegated to an appendix. @@ -11328,10 +11459,10 @@ and likely to change, its description is relegated to an appendix.  File: gawk.info, Node: Nondecimal Data, Next: Two-way I/O, Up: Advanced Features -Allowing Nondecimal Input Data -============================== +10.1 Allowing Nondecimal Input Data +=================================== - If you run `gawk' with the `--non-decimal-data' option, you can have +If you run `gawk' with the `--non-decimal-data' option, you can have nondecimal constants in your input data: $ echo 0123 123 0x123 | @@ -11339,8 +11470,8 @@ nondecimal constants in your input data: > $1, $2, $3 }' -| 83, 123, 291 - For this feature to work, write your program so that `gawk' treats -your data as numeric: +For this feature to work, write your program so that `gawk' treats your +data as numeric: $ echo 0123 123 0x123 | gawk '{ print $1, $2, $3 }' -| 0123 123 0x123 @@ -11356,12 +11487,12 @@ zero to a field to force it to be treated as a number. For example: -| 0123 123 0x123 -| 83 123 291 - Because it is common to have decimal data with leading zeros, and +Because it is common to have decimal data with leading zeros, and because using it could lead to surprising results, the default is to leave this facility disabled. If you want it, you must explicitly request it. - *Caution:* _Use of this option is not recommended._ It can break old +*Caution:* _Use of this option is not recommended._ It can break old programs very badly. Instead, use the `strtonum' function to convert your data (*note Nondecimal-numbers::). This makes your programs easier to write and easier to read, and leads to less surprising @@ -11370,27 +11501,27 @@ results.  File: gawk.info, Node: Two-way I/O, Next: TCP/IP Networking, Prev: Nondecimal Data, Up: Advanced Features -Two-Way Communications with Another Process -=========================================== +10.2 Two-Way Communications with Another Process +================================================ From: brennan@whidbey.com (Mike Brennan) Newsgroups: comp.lang.awk Subject: Re: Learn the SECRET to Attract Women Easily Date: 4 Aug 1997 17:34:46 GMT Message-ID: <5s53rm$eca@news.whidbey.com> - + On 3 Aug 1997 13:17:43 GMT, Want More Dates??? wrote: >Learn the SECRET to Attract Women Easily > >The SCENT(tm) Pheromone Sex Attractant For Men to Attract Women - + The scent of awk programmers is a lot more attractive to women than the scent of perl programmers. -- Mike Brennan - It is often useful to be able to send data to a separate program for +It is often useful to be able to send data to a separate program for processing and then read the result. This can always be done with temporary files: @@ -11399,7 +11530,7 @@ temporary files: while (NOT DONE WITH DATA) print DATA | ("subprogram > " tempfile) close("subprogram > " tempfile) - + # read the results, remove tempfile when done while ((getline newdata < tempfile) > 0) PROCESS newdata APPROPRIATELY @@ -11411,11 +11542,11 @@ the program be run in a directory that cannot be shared among users; for example, `/tmp' will not do, as another user might happen to be using a temporary file with the same name. - Starting with version 3.1 of `gawk', it is possible to open a -_two-way_ pipe to another process. The second process is termed a -"coprocess", since it runs in parallel with `gawk'. The two-way -connection is created using the new `|&' operator (borrowed from the -Korn shell, `ksh'):(1) +Starting with version 3.1 of `gawk', it is possible to open a _two-way_ +pipe to another process. The second process is termed a "coprocess", +since it runs in parallel with `gawk'. The two-way connection is +created using the new `|&' operator (borrowed from the Korn shell, +`ksh'):(1) do { print DATA |& "subprogram" @@ -11423,7 +11554,7 @@ Korn shell, `ksh'):(1) } while (DATA LEFT TO PROCESS) close("subprogram") - The first time an I/O operation is executed using the `|&' operator, +The first time an I/O operation is executed using the `|&' operator, `gawk' creates a two-way pipeline to a child process that runs the other program. Output created with `print' or `printf' is written to the program's standard input, and output from the program's standard @@ -11431,7 +11562,7 @@ output can be read by the `gawk' program using `getline'. As is the case with processes started by `|', the subprogram can be any program, or pipeline of programs, that can be started by the shell. - There are some cautionary items to be aware of: +There are some cautionary items to be aware of: * As the code inside `gawk' currently stands, the coprocess's standard error goes to the same place that the parent `gawk''s @@ -11445,49 +11576,49 @@ or pipeline of programs, that can be started by the shell. lead to a situation known as "deadlock", where each process is waiting for the other one to do something. - It is possible to close just one end of the two-way pipe to a +It is possible to close just one end of the two-way pipe to a coprocess, by supplying a second argument to the `close' function of either `"to"' or `"from"' (*note Close Files And Pipes::). These strings tell `gawk' to close the end of the pipe that sends data to the process or the end that reads from it, respectively. - This is particularly necessary in order to use the system `sort' +This is particularly necessary in order to use the system `sort' utility as part of a coprocess; `sort' must read _all_ of its input data before it can produce any output. The `sort' program does not receive an end-of-file indication until `gawk' closes the write end of the pipe. - When you have finished writing data to the `sort' utility, you can +When you have finished writing data to the `sort' utility, you can close the `"to"' end of the pipe, and then start reading sorted data via `getline'. For example: BEGIN { command = "LC_ALL=C sort" n = split("abcdefghijklmnopqrstuvwxyz", a, "") - + for (i = n; i > 0; i--) print a[i] |& command close(command, "to") - + while ((command |& getline line) > 0) print "got", line close(command) } - This program writes the letters of the alphabet in reverse order, one +This program writes the letters of the alphabet in reverse order, one per line, down the two-way pipe to `sort'. It then closes the write end of the pipe, so that `sort' receives an end-of-file indication. This causes `sort' to sort the data and write the sorted data back to the `gawk' program. Once all of the data has been read, `gawk' terminates the coprocess and exits. - As a side note, the assignment `LC_ALL=C' in the `sort' command -ensures traditional Unix (ASCII) sorting from `sort'. +As a side note, the assignment `LC_ALL=C' in the `sort' command ensures +traditional Unix (ASCII) sorting from `sort'. - Beginning with `gawk' 3.1.2, you may use Pseudo-ttys (ptys) for -two-way communication instead of pipes, if your system supports them. -This is done on a per-command basis, by setting a special element in -the `PROCINFO' array (*note Auto-set::), like so: +Beginning with `gawk' 3.1.2, you may use Pseudo-ttys (ptys) for two-way +communication instead of pipes, if your system supports them. This is +done on a per-command basis, by setting a special element in the +`PROCINFO' array (*note Auto-set::), like so: command = "sort -nr" # command, saved in variable for convenience PROCINFO[command, "pty"] = 1 # update PROCINFO @@ -11499,33 +11630,32 @@ loss in performance. If your system does not have ptys, or if all the system's ptys are in use, `gawk' automatically falls back to using regular pipes. - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) This is very different from the same operator in the C shell, -`csh'. +(1) This is very different from the same operator in the C shell, `csh'.  File: gawk.info, Node: TCP/IP Networking, Next: Portal Files, Prev: Two-way I/O, Up: Advanced Features -Using `gawk' for Network Programming -==================================== +10.3 Using `gawk' for Network Programming +========================================= `EMISTERED': A host is a host from coast to coast, and no-one can talk to host that's close, unless the host that isn't close is busy hung or dead. - In addition to being able to open a two-way pipeline to a coprocess -on the same system (*note Two-way I/O::), it is possible to make a -two-way connection to another process on another system across an IP -networking connection. +In addition to being able to open a two-way pipeline to a coprocess on +the same system (*note Two-way I/O::), it is possible to make a two-way +connection to another process on another system across an IP networking +connection. - You can think of this as just a _very long_ two-way pipeline to a +You can think of this as just a _very long_ two-way pipeline to a coprocess. The way `gawk' decides that you want to use TCP/IP networking is by recognizing special file names that begin with `/inet/'. - The full syntax of the special file name is +The full syntax of the special file name is `/inet/PROTOCOL/LOCAL-PORT/REMOTE-HOST/REMOTE-PORT'. The components are: @@ -11554,7 +11684,7 @@ REMOTE-PORT Again, use `0' if you don't care, or else a well-known service name. - Consider the following very simple example: +Consider the following very simple example: BEGIN { Service = "/inet/tcp/0/localhost/daytime" @@ -11563,25 +11693,25 @@ REMOTE-PORT close(Service) } - This program reads the current date and time from the local system's +This program reads the current date and time from the local system's TCP `daytime' server. It then prints the results and closes the connection. - Because this topic is extensive, the use of `gawk' for TCP/IP +Because this topic is extensive, the use of `gawk' for TCP/IP programming is documented separately. *Note Top::, for a much more complete introduction and discussion, as well as extensive examples.  File: gawk.info, Node: Portal Files, Next: Profiling, Prev: TCP/IP Networking, Up: Advanced Features -Using `gawk' with BSD Portals -============================= +10.4 Using `gawk' with BSD Portals +================================== - Similar to the `/inet' special files, if `gawk' is configured with -the `--enable-portals' option (*note Quick Installation::), then `gawk' +Similar to the `/inet' special files, if `gawk' is configured with the +`--enable-portals' option (*note Quick Installation::), then `gawk' treats files whose pathnames begin with `/p' as 4.4 BSD-style portals. - When used with the `|&' operator, `gawk' opens the file for two-way +When used with the `|&' operator, `gawk' opens the file for two-way communications. The operating system's portal mechanism then manages creating the process associated with the portal and the corresponding communications with the portal's process. @@ -11589,28 +11719,27 @@ communications with the portal's process.  File: gawk.info, Node: Profiling, Prev: Portal Files, Up: Advanced Features -Profiling Your `awk' Programs -============================= +10.5 Profiling Your `awk' Programs +================================== - Beginning with version 3.1 of `gawk', you may produce execution -traces of your `awk' programs. This is done with a specially compiled -version of `gawk', called `pgawk' ("profiling `gawk'"). +Beginning with version 3.1 of `gawk', you may produce execution traces +of your `awk' programs. This is done with a specially compiled version +of `gawk', called `pgawk' ("profiling `gawk'"). - `pgawk' is identical in every way to `gawk', except that when it has +`pgawk' is identical in every way to `gawk', except that when it has finished running, it creates a profile of your program in a file named `awkprof.out'. Because it is profiling, it also executes up to 45% slower than `gawk' normally does. - As shown in the following example, the `--profile' option can be -used to change the name of the file where `pgawk' will write the -profile: +As shown in the following example, the `--profile' option can be used +to change the name of the file where `pgawk' will write the profile: $ pgawk --profile=myprog.prof -f myprog.awk data1 data2 In the above example, `pgawk' places the profile in `myprog.prof' instead of in `awkprof.out'. - Regular `gawk' also accepts this option. When called with just +Regular `gawk' also accepts this option. When called with just `--profile', `gawk' "pretty prints" the program into `awkprof.out', without any execution counts. You may supply an option to `--profile' to change the file name. Here is a sample session showing a simple @@ -11618,32 +11747,32 @@ to change the file name. Here is a sample session showing a simple First, the `awk' program: BEGIN { print "First BEGIN rule" } - + END { print "First END rule" } - + /foo/ { print "matched /foo/, gosh" for (i = 1; i <= 3; i++) sing() } - + { if (/foo/) print "if is true" else print "else is true" } - + BEGIN { print "Second BEGIN rule" } - + END { print "Second END rule" } - + function sing( dummy) { print "I gotta be me!" } - Following is the input data: +Following is the input data: foo bar @@ -11651,28 +11780,28 @@ First, the `awk' program: foo junk - Here is the `awkprof.out' that results from running `pgawk' on this +Here is the `awkprof.out' that results from running `pgawk' on this program and data (this example also illustrates that `awk' programmers sometimes have to work late): # gawk profile, created Sun Aug 13 00:00:15 2000 - + # BEGIN block(s) - + BEGIN { 1 print "First BEGIN rule" 1 print "Second BEGIN rule" } - + # Rule(s) - + 5 /foo/ { # 2 2 print "matched /foo/, gosh" 6 for (i = 1; i <= 3; i++) { 6 sing() } } - + 5 { 5 if (/foo/) { # 2 2 print "if is true" @@ -11680,23 +11809,23 @@ sometimes have to work late): 3 print "else is true" } } - + # END block(s) - + END { 1 print "First END rule" 1 print "Second END rule" } - + # Functions, listed alphabetically - + 6 function sing(dummy) { 6 print "I gotta be me!" } - This example illustrates many of the basic rules for profiling -output. The rules are as follows: +This example illustrates many of the basic rules for profiling output. +The rules are as follows: * The program is printed in the order `BEGIN' rule, pattern/action rules, `END' rule and functions, listed alphabetically. Multiple @@ -11748,13 +11877,13 @@ output. The rules are as follows: `END' rules, the pattern/action rules, and the functions. - The profiled version of your program may not look exactly like what -you typed when you wrote it. This is because `pgawk' creates the -profiled version by "pretty printing" its internal representation of -the program. The advantage to this is that `pgawk' can produce a -standard representation. The disadvantage is that all source-code -comments are lost, as are the distinctions among multiple `BEGIN' and -`END' rules. Also, things such as: +The profiled version of your program may not look exactly like what you +typed when you wrote it. This is because `pgawk' creates the profiled +version by "pretty printing" its internal representation of the +program. The advantage to this is that `pgawk' can produce a standard +representation. The disadvantage is that all source-code comments are +lost, as are the distinctions among multiple `BEGIN' and `END' rules. +Also, things such as: /foo/ @@ -11766,7 +11895,7 @@ come out as: which is correct, but possibly surprising. - Besides creating profiles when a program has completed, `pgawk' can +Besides creating profiles when a program has completed, `pgawk' can produce a profile while it is running. This is useful if your `awk' program goes into an infinite loop and you want to see what has been executed. To use this feature, run `pgawk' in the background: @@ -11782,45 +11911,45 @@ The shell prints a job number and process ID number; in this case, As usual, the profiled version of the program is written to `awkprof.out', or to a different file if you use the `--profile' option. - Along with the regular profile, as shown earlier, the profile -includes a trace of any active functions: +Along with the regular profile, as shown earlier, the profile includes +a trace of any active functions: # Function Call Stack: - + # 3. baz # 2. bar # 1. foo # -- main -- - You may send `pgawk' the `USR1' signal as many times as you like. -Each time, the profile and function call trace are appended to the -output profile file. +You may send `pgawk' the `USR1' signal as many times as you like. Each +time, the profile and function call trace are appended to the output +profile file. - If you use the `HUP' signal instead of the `USR1' signal, `pgawk' +If you use the `HUP' signal instead of the `USR1' signal, `pgawk' produces the profile and the function call trace and then exits. - When `pgawk' runs on MS-DOS or MS-Windows, it uses the `INT' and -`QUIT' signals for producing the profile and, in the case of the `INT' -signal, `pgawk' exits. This is because these systems don't support the -`kill' command, so the only signals you can deliver to a program are -those generated by the keyboard. The `INT' signal is generated by the +When `pgawk' runs on MS-DOS or MS-Windows, it uses the `INT' and `QUIT' +signals for producing the profile and, in the case of the `INT' signal, +`pgawk' exits. This is because these systems don't support the `kill' +command, so the only signals you can deliver to a program are those +generated by the keyboard. The `INT' signal is generated by the `Ctrl-' or `Ctrl-' key, while the `QUIT' signal is generated by the `Ctrl-<\>' key.  File: gawk.info, Node: Invoking Gawk, Next: Library Functions, Prev: Advanced Features, Up: Top -Running `awk' and `gawk' -************************ +11 Running `awk' and `gawk' +*************************** - This major node covers how to run awk, both POSIX-standard and +This major node covers how to run awk, both POSIX-standard and `gawk'-specific command-line options, and what `awk' and `gawk' do with non-option arguments. It then proceeds to cover how `gawk' searches for source files, obsolete options and/or features, and known bugs in `gawk'. This major node rounds out the discussion of `awk' as a program and as a language. - While a number of the options and features described here were +While a number of the options and features described here were discussed in passing earlier in the book, this major node provides the full details. @@ -11838,20 +11967,20 @@ full details.  File: gawk.info, Node: Command Line, Next: Options, Up: Invoking Gawk -Invoking `awk' -============== +11.1 Invoking `awk' +=================== - There are two ways to run `awk'--with an explicit program or with -one or more program files. Here are templates for both of them; items +There are two ways to run `awk'--with an explicit program or with one +or more program files. Here are templates for both of them; items enclosed in [...] in these templates are optional: awk [OPTIONS] -f progfile [`--'] FILE ... awk [OPTIONS] [`--'] 'PROGRAM' FILE ... - Besides traditional one-letter POSIX-style options, `gawk' also +Besides traditional one-letter POSIX-style options, `gawk' also supports GNU long options. - It is possible to invoke `awk' with an empty program: +It is possible to invoke `awk' with an empty program: awk '' datafile1 datafile2 @@ -11862,19 +11991,19 @@ line, `gawk' issues a warning that the program is empty.  File: gawk.info, Node: Options, Next: Other Arguments, Prev: Command Line, Up: Invoking Gawk -Command-Line Options -==================== +11.2 Command-Line Options +========================= - Options begin with a dash and consist of a single character. -GNU-style long options consist of two dashes and a keyword. The -keyword can be abbreviated, as long as the abbreviation allows the -option to be uniquely identified. If the option takes an argument, -then the keyword is either immediately followed by an equals sign (`=') -and the argument's value, or the keyword and the argument's value are -separated by whitespace. If a particular option with a value is given -more than once, it is the last value that counts. +Options begin with a dash and consist of a single character. GNU-style +long options consist of two dashes and a keyword. The keyword can be +abbreviated, as long as the abbreviation allows the option to be +uniquely identified. If the option takes an argument, then the keyword +is either immediately followed by an equals sign (`=') and the +argument's value, or the keyword and the argument's value are separated +by whitespace. If a particular option with a value is given more than +once, it is the last value that counts. - Each long option for `gawk' has a corresponding POSIX-style option. +Each long option for `gawk' has a corresponding POSIX-style option. The long and short options are interchangeable in all contexts. The options and their meanings are as follows: @@ -11930,8 +12059,8 @@ options and their meanings are as follows: shell scripts, if you have file names that will be specified by the user that could start with `-'. - The previous list described options mandated by the POSIX standard, -as well as options available in the Bell Laboratories version of `awk'. +The previous list described options mandated by the POSIX standard, as +well as options available in the Bell Laboratories version of `awk'. The following list describes `gawk'-specific options: `-W compat' @@ -12074,40 +12203,40 @@ The following list describes `gawk'-specific options: with respect to whatever the Free Software Foundation is currently distributing. It is also useful for bug reports (*note Bugs::). - As long as program text has been supplied, any other options are +As long as program text has been supplied, any other options are flagged as invalid with a warning message but are otherwise ignored. - In compatibility mode, as a special case, if the value of FS supplied +In compatibility mode, as a special case, if the value of FS supplied to the `-F' option is `t', then `FS' is set to the TAB character (`"\t"'). This is true only for `--traditional' and not for `--posix' (*note Field Separators::). - The `-f' option may be used more than once on the command line. If -it is, `awk' reads its program source from all of the named files, as -if they had been concatenated together into one big file. This is -useful for creating libraries of `awk' functions. These functions can -be written once and then retrieved from a standard place, instead of +The `-f' option may be used more than once on the command line. If it +is, `awk' reads its program source from all of the named files, as if +they had been concatenated together into one big file. This is useful +for creating libraries of `awk' functions. These functions can be +written once and then retrieved from a standard place, instead of having to be included into each individual program. (As mentioned in *Note Definition Syntax::, function names must be unique.) - Library functions can still be used, even if the program is entered -at the terminal, by specifying `-f /dev/tty'. After typing your -program, type `Ctrl-d' (the end-of-file character) to terminate it. -(You may also use `-f -' to read program source from the standard input -but then you will not be able to also use the standard input as a -source of data.) +Library functions can still be used, even if the program is entered at +the terminal, by specifying `-f /dev/tty'. After typing your program, +type `Ctrl-d' (the end-of-file character) to terminate it. (You may +also use `-f -' to read program source from the standard input but then +you will not be able to also use the standard input as a source of +data.) - Because it is clumsy using the standard `awk' mechanisms to mix -source file and command-line `awk' programs, `gawk' provides the -`--source' option. This does not require you to pre-empt the standard -input for your source code; it allows you to easily mix command-line -and library source code (*note AWKPATH Variable::). +Because it is clumsy using the standard `awk' mechanisms to mix source +file and command-line `awk' programs, `gawk' provides the `--source' +option. This does not require you to pre-empt the standard input for +your source code; it allows you to easily mix command-line and library +source code (*note AWKPATH Variable::). - If no `-f' or `--source' option is specified, then `gawk' uses the +If no `-f' or `--source' option is specified, then `gawk' uses the first non-option command-line argument as the text of the program source code. - If the environment variable `POSIXLY_CORRECT' exists, then `gawk' +If the environment variable `POSIXLY_CORRECT' exists, then `gawk' behaves in strict POSIX mode, exactly as if you had supplied the `--posix' command-line option. Many GNU programs look for this environment variable to turn on strict POSIX mode. If `--lint' is @@ -12120,54 +12249,54 @@ you would add these lines to the `.profile' file in your home directory: POSIXLY_CORRECT=true export POSIXLY_CORRECT - For a `csh'-compatible shell,(1) you would add this line to the +For a `csh'-compatible shell,(1) you would add this line to the `.login' file in your home directory: setenv POSIXLY_CORRECT true - Having `POSIXLY_CORRECT' set is not recommended for daily use, but -it is good for testing the portability of your programs to other +Having `POSIXLY_CORRECT' set is not recommended for daily use, but it +is good for testing the portability of your programs to other environments. - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) Not recommended. +(1) Not recommended.  File: gawk.info, Node: Other Arguments, Next: AWKPATH Variable, Prev: Options, Up: Invoking Gawk -Other Command-Line Arguments -============================ +11.3 Other Command-Line Arguments +================================= - Any additional arguments on the command line are normally treated as +Any additional arguments on the command line are normally treated as input files to be processed in the order specified. However, an argument that has the form `VAR=VALUE', assigns the value VALUE to the variable VAR--it does not specify a file at all. (This was discussed earlier in *Note Assignment Options::.) - All these arguments are made available to your `awk' program in the +All these arguments are made available to your `awk' program in the `ARGV' array (*note Built-in Variables::). Command-line options and the program text (if present) are omitted from `ARGV'. All other arguments, including variable assignments, are included. As each element of `ARGV' is processed, `gawk' sets the variable `ARGIND' to the index in `ARGV' of the current element. - The distinction between file name arguments and variable-assignment +The distinction between file name arguments and variable-assignment arguments is made when `awk' is about to open the next input file. At that point in execution, it checks the file name to see whether it is really a variable assignment; if so, `awk' sets the variable instead of reading a file. - Therefore, the variables actually receive the given values after all +Therefore, the variables actually receive the given values after all previously specified files have been read. In particular, the values of variables assigned in this fashion are _not_ available inside a `BEGIN' rule (*note BEGIN/END::), because such rules are run before `awk' begins scanning the argument list. - The variable values given on the command line are processed for -escape sequences (*note Escape Sequences::). (d.c.) +The variable values given on the command line are processed for escape +sequences (*note Escape Sequences::). (d.c.) - In some earlier implementations of `awk', when a variable assignment +In some earlier implementations of `awk', when a variable assignment occurred before any file names, the assignment would happen _before_ the `BEGIN' rule was executed. `awk''s behavior was thus inconsistent; some command-line assignments were available inside the `BEGIN' rule, @@ -12176,7 +12305,7 @@ upon this "feature." When `awk' was changed to be more consistent, the `-v' option was added to accommodate applications that depended upon the old behavior. - The variable assignment feature is most useful for assigning to +The variable assignment feature is most useful for assigning to variables such as `RS', `OFS', and `ORS', which control input and output formats before scanning the data files. It is also useful for controlling state if multiple passes are needed over a data file. For @@ -12185,66 +12314,66 @@ example: awk 'pass == 1 { PASS 1 STUFF } pass == 2 { PASS 2 STUFF }' pass=1 mydata pass=2 mydata - Given the variable assignment feature, the `-F' option for setting -the value of `FS' is not strictly necessary. It remains for historical +Given the variable assignment feature, the `-F' option for setting the +value of `FS' is not strictly necessary. It remains for historical compatibility.  File: gawk.info, Node: AWKPATH Variable, Next: Obsolete, Prev: Other Arguments, Up: Invoking Gawk -The `AWKPATH' Environment Variable -================================== +11.4 The `AWKPATH' Environment Variable +======================================= - The previous minor node described how `awk' program files can be -named on the command-line with the `-f' option. In most `awk' +The previous minor node described how `awk' program files can be named +on the command-line with the `-f' option. In most `awk' implementations, you must supply a precise path name for each program file, unless the file is in the current directory. But in `gawk', if the file name supplied to the `-f' option does not contain a `/', then `gawk' searches a list of directories (called the "search path"), one by one, looking for a file with the specified name. - The search path is a string consisting of directory names separated -by colons. `gawk' gets its search path from the `AWKPATH' environment +The search path is a string consisting of directory names separated by +colons. `gawk' gets its search path from the `AWKPATH' environment variable. If that variable does not exist, `gawk' uses a default path, `.:/usr/local/share/awk'.(1) (Programs written for use by system administrators should use an `AWKPATH' variable that does not include the current directory, `.'.) - The search path feature is particularly useful for building libraries +The search path feature is particularly useful for building libraries of useful `awk' functions. The library files can be placed in a standard directory in the default path and then specified on the command line with a short file name. Otherwise, the full file name would have to be typed for each file. - By using both the `--source' and `-f' options, your command-line -`awk' programs can use facilities in `awk' library files (*note Library +By using both the `--source' and `-f' options, your command-line `awk' +programs can use facilities in `awk' library files (*note Library Functions::). Path searching is not done if `gawk' is in compatibility mode. This is true for both `--traditional' and `--posix'. *Note Options::. - *Note:* If you want files in the current directory to be found, you -must include the current directory in the path, either by including `.' -explicitly in the path or by writing a null entry in the path. (A null -entry is indicated by starting or ending the path with a colon or by -placing two colons next to each other (`::').) If the current -directory is not included in the path, then files cannot be found in -the current directory. This path search mechanism is identical to the -shell's. + NOTE: If you want files in the current directory to be found, you + must include the current directory in the path, either by including + `.' explicitly in the path or by writing a null entry in the path. + (A null entry is indicated by starting or ending the path with a + colon or by placing two colons next to each other (`::').) If the + current directory is not included in the path, then files cannot be + found in the current directory. This path search mechanism is + identical to the shell's. - Starting with version 3.0, if `AWKPATH' is not defined in the +Starting with version 3.0, if `AWKPATH' is not defined in the environment, `gawk' places its default search path into `ENVIRON["AWKPATH"]'. This makes it easy to determine the actual search path that `gawk' will use from within an `awk' program. - While you can change `ENVIRON["AWKPATH"]' within your `awk' program, +While you can change `ENVIRON["AWKPATH"]' within your `awk' program, this has no effect on the running program's behavior. This makes sense: the `AWKPATH' environment variable is used to find the program source files. Once your program is running, all the files have been found, and `gawk' no longer needs to use `AWKPATH'. - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) Your version of `gawk' may use a different directory; it will +(1) Your version of `gawk' may use a different directory; it will depend upon how `gawk' was built and installed. The actual directory is the value of `$(datadir)' generated when `gawk' was configured. You probably don't need to worry about this, though. @@ -12252,42 +12381,41 @@ probably don't need to worry about this, though.  File: gawk.info, Node: Obsolete, Next: Undocumented, Prev: AWKPATH Variable, Up: Invoking Gawk -Obsolete Options and/or Features -================================ +11.5 Obsolete Options and/or Features +===================================== - This minor node describes features and/or command-line options from +This minor node describes features and/or command-line options from previous releases of `gawk' that are either not available in the current version or that are still supported but deprecated (meaning that they will _not_ be in the next release). - For version 3.1 of `gawk', there are no deprecated command-line -options from the previous version of `gawk'. The use of `next file' -(two words) for `nextfile' was deprecated in `gawk' 3.0 but still -worked. Starting with version 3.1, the two-word usage is no longer -accepted. +For version 3.1 of `gawk', there are no deprecated command-line options +from the previous version of `gawk'. The use of `next file' (two +words) for `nextfile' was deprecated in `gawk' 3.0 but still worked. +Starting with version 3.1, the two-word usage is no longer accepted. - The process-related special files described in *Note Special -Process::, work as described, but are now considered deprecated. -`gawk' prints a warning message every time they are used. (Use -`PROCINFO' instead; see *Note Auto-set::.) They will be removed from -the next release of `gawk'. +The process-related special files described in *Note Special Process::, +work as described, but are now considered deprecated. `gawk' prints a +warning message every time they are used. (Use `PROCINFO' instead; see +*Note Auto-set::.) They will be removed from the next release of +`gawk'.  File: gawk.info, Node: Undocumented, Next: Known Bugs, Prev: Obsolete, Up: Invoking Gawk -Undocumented Options and Features -================================= +11.6 Undocumented Options and Features +====================================== Use the Source, Luke! Obi-Wan - This minor node intentionally left blank. +This minor node intentionally left blank.  File: gawk.info, Node: Known Bugs, Prev: Undocumented, Up: Invoking Gawk -Known Bugs in `gawk' -==================== +11.7 Known Bugs in `gawk' +========================= * The `-F' option for changing the value of `FS' (*note Options::) is not necessary given the command-line variable assignment @@ -12301,47 +12429,47 @@ Known Bugs in `gawk'  File: gawk.info, Node: Library Functions, Next: Sample Programs, Prev: Invoking Gawk, Up: Top -A Library of `awk' Functions -**************************** +12 A Library of `awk' Functions +******************************* - *Note User-defined::, describes how to write your own `awk' -functions. Writing functions is important, because it allows you to -encapsulate algorithms and program tasks in a single place. It -simplifies programming, making program development more manageable, and -making programs more readable. +*Note User-defined::, describes how to write your own `awk' functions. +Writing functions is important, because it allows you to encapsulate +algorithms and program tasks in a single place. It simplifies +programming, making program development more manageable, and making +programs more readable. - One valuable way to learn a new programming language is to _read_ +One valuable way to learn a new programming language is to _read_ programs in that language. To that end, this major node and *Note Sample Programs::, provide a good-sized body of code for you to read, and hopefully, to learn from. - This major node presents a library of useful `awk' functions. Many -of the sample programs presented later in this Info file use these +This major node presents a library of useful `awk' functions. Many of +the sample programs presented later in this Info file use these functions. The functions are presented here in a progression from simple to complex. - *Note Extract Program::, presents a program that you can use to -extract the source code for these example library functions and -programs from the Texinfo source for this Info file. (This has already -been done as part of the `gawk' distribution.) +*Note Extract Program::, presents a program that you can use to extract +the source code for these example library functions and programs from +the Texinfo source for this Info file. (This has already been done as +part of the `gawk' distribution.) - If you have written one or more useful, general-purpose `awk' -functions and would like to contribute them to the author's collection -of `awk' programs, see *Note How To Contribute::, for more information. +If you have written one or more useful, general-purpose `awk' functions +and would like to contribute them to the author's collection of `awk' +programs, see *Note How To Contribute::, for more information. - The programs in this major node and in *Note Sample Programs::, -freely use features that are `gawk'-specific. Rewriting these programs -for different implementations of awk is pretty straightforward. +The programs in this major node and in *Note Sample Programs::, freely +use features that are `gawk'-specific. Rewriting these programs for +different implementations of awk is pretty straightforward. - Diagnostic error messages are sent to `/dev/stderr'. Use `| "cat +Diagnostic error messages are sent to `/dev/stderr'. Use `| "cat 1>&2"' instead of `> "/dev/stderr"' if your system does not have a `/dev/stderr', or if you cannot use `gawk'. - A number of programs use `nextfile' (*note Nextfile Statement::) to +A number of programs use `nextfile' (*note Nextfile Statement::) to skip any remaining input in the input file. *Note Nextfile Function::, shows you how to write a function that does the same thing. - Finally, some of the programs choose to ignore upper- and lowercase +Finally, some of the programs choose to ignore upper- and lowercase distinctions in their input. They do so by assigning one to `IGNORECASE'. You can achieve almost the same effect(1) by adding the following rule to the beginning of the program: @@ -12364,42 +12492,42 @@ use only lowercase letters. * Passwd Functions:: Functions for getting user information. * Group Functions:: Functions for getting group information. - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) The effects are not identical. Output of the transformed record +(1) The effects are not identical. Output of the transformed record will be in all lowercase, while `IGNORECASE' preserves the original contents of the input record.  File: gawk.info, Node: Library Names, Next: General Functions, Up: Library Functions -Naming Library Function Global Variables -======================================== +12.1 Naming Library Function Global Variables +============================================= - Due to the way the `awk' language evolved, variables are either +Due to the way the `awk' language evolved, variables are either "global" (usable by the entire program) or "local" (usable just by a specific function). There is no intermediate state analogous to `static' variables in C. - Library functions often need to have global variables that they can -use to preserve state information between calls to the function--for +Library functions often need to have global variables that they can use +to preserve state information between calls to the function--for example, `getopt''s variable `_opti' (*note Getopt Function::). Such variables are called "private", since the only functions that need to use them are the ones in the library. - When writing a library function, you should try to choose names for -your private variables that will not conflict with any variables used by +When writing a library function, you should try to choose names for your +private variables that will not conflict with any variables used by either another library function or a user's main program. For example, a name like `i' or `j' is not a good choice, because user programs often use variable names like these for their own purposes. - The example programs shown in this major node all start the names of +The example programs shown in this major node all start the names of their private variables with an underscore (`_'). Users generally don't use leading underscores in their variable names, so this convention immediately decreases the chances that the variable name will be accidentally shared with the user's program. - In addition, several of the library functions use a prefix that helps +In addition, several of the library functions use a prefix that helps indicate what function or set of functions use the variables--for example, `_pw_byname' in the user database routines (*note Passwd Functions::). This convention is recommended, since it even further @@ -12407,18 +12535,18 @@ decreases the chance of inadvertent conflict among variable names. Note that this convention is used equally well for variable names and for private function names as well.(1) - As a final note on variable naming, if a function makes global -variables available for use by a main program, it is a good convention -to start that variable's name with a capital letter--for example, -`getopt''s `Opterr' and `Optind' variables (*note Getopt Function::). -The leading capital letter indicates that it is global, while the fact -that the variable name is not all capital letters indicates that the -variable is not one of `awk''s built-in variables, such as `FS'. +As a final note on variable naming, if a function makes global variables +available for use by a main program, it is a good convention to start +that variable's name with a capital letter--for example, `getopt''s +`Opterr' and `Optind' variables (*note Getopt Function::). The leading +capital letter indicates that it is global, while the fact that the +variable name is not all capital letters indicates that the variable is +not one of `awk''s built-in variables, such as `FS'. - It is also important that _all_ variables in library functions that -do not need to save state are, in fact, declared local.(2) If this is -not done, the variable could accidentally be used in the user's -program, leading to bugs that are very difficult to track down: +It is also important that _all_ variables in library functions that do +not need to save state are, in fact, declared local.(2) If this is not +done, the variable could accidentally be used in the user's program, +leading to bugs that are very difficult to track down: function lib_func(x, y, l1, l2) { @@ -12427,42 +12555,43 @@ program, leading to bugs that are very difficult to track down: ... # but is not by oversight } - A different convention, common in the Tcl community, is to use a -single associative array to hold the values needed by the library -function(s), or "package." This significantly decreases the number of -actual global names in use. For example, the functions described in -*Note Passwd Functions::, might have used array elements -`PW_data["inited"]', `PW_data["total"]', `PW_data["count"]', and -`PW_data["awklib"]', instead of `_pw_inited', `_pw_awklib', `_pw_total', -and `_pw_count'. +A different convention, common in the Tcl community, is to use a single +associative array to hold the values needed by the library function(s), +or "package." This significantly decreases the number of actual global +names in use. For example, the functions described in *Note Passwd +Functions::, might have used array elements `PW_data["inited"]', +`PW_data["total"]', `PW_data["count"]', and `PW_data["awklib"]', +instead of `_pw_inited', `_pw_awklib', `_pw_total', and `_pw_count'. - The conventions presented in this minor node are exactly that: +The conventions presented in this minor node are exactly that: conventions. You are not required to write your programs this way--we merely recommend that you do so. - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) While all the library routines could have been rewritten to use +(1) While all the library routines could have been rewritten to use this convention, this was not done, in order to show how my own `awk' programming style has evolved and to provide some basis for this discussion. - (2) `gawk''s `--dump-variables' command-line option is useful for +(2) `gawk''s `--dump-variables' command-line option is useful for verifying this.  File: gawk.info, Node: General Functions, Next: Data File Management, Prev: Library Names, Up: Library Functions -General Programming -=================== +12.2 General Programming +======================== - This minor node presents a number of functions that are of general +This minor node presents a number of functions that are of general programming use. * Menu: * Nextfile Function:: Two implementations of a `nextfile' function. +* Strtonum Function:: A replacement for the built-in `strtonum' + function. * Assert Function:: A function for assertions in `awk' programs. * Round Function:: A function for rounding if `sprintf' does @@ -12474,44 +12603,44 @@ programming use. * Gettimeofday Function:: A function to get formatted times.  -File: gawk.info, Node: Nextfile Function, Next: Assert Function, Up: General Functions +File: gawk.info, Node: Nextfile Function, Next: Strtonum Function, Up: General Functions -Implementing `nextfile' as a Function -------------------------------------- +12.2.1 Implementing `nextfile' as a Function +-------------------------------------------- - The `nextfile' statement, presented in *Note Nextfile Statement::, -is a `gawk'-specific extension--it is not available in most other +The `nextfile' statement, presented in *Note Nextfile Statement::, is a +`gawk'-specific extension--it is not available in most other implementations of `awk'. This minor node shows two versions of a `nextfile' function that you can use to simulate `gawk''s `nextfile' statement if you cannot use `gawk'. - A first attempt at writing a `nextfile' function is as follows: +A first attempt at writing a `nextfile' function is as follows: # nextfile --- skip remaining records in current file # this should be read in before the "main" awk program - + function nextfile() { _abandon_ = FILENAME; next } _abandon_ == FILENAME { next } - Because it supplies a rule that must be executed first, this file -should be included before the main program. This rule compares the -current data file's name (which is always in the `FILENAME' variable) to -a private variable named `_abandon_'. If the file name matches, then -the action part of the rule executes a `next' statement to go on to the +Because it supplies a rule that must be executed first, this file should +be included before the main program. This rule compares the current +data file's name (which is always in the `FILENAME' variable) to a +private variable named `_abandon_'. If the file name matches, then the +action part of the rule executes a `next' statement to go on to the next record. (The use of `_' in the variable name is a convention. It is discussed more fully in *Note Library Names::.) - The use of the `next' statement effectively creates a loop that reads +The use of the `next' statement effectively creates a loop that reads all the records from the current data file. The end of the file is eventually reached and a new data file is opened, changing the value of `FILENAME'. Once this happens, the comparison of `_abandon_' to `FILENAME' fails, and execution continues with the first rule of the "real" program. - The `nextfile' function itself simply sets the value of `_abandon_' -and then executes a `next' statement to start the loop. +The `nextfile' function itself simply sets the value of `_abandon_' and +then executes a `next' statement to start the loop. - This initial version has a subtle problem. If the same data file is +This initial version has a subtle problem. If the same data file is listed _twice_ on the commandline, one right after the other or even with just a variable assignment between them, this code skips right through the file a second time, even though it should stop when it gets @@ -12521,9 +12650,9 @@ that remedies this problem is shown here: # nextfile --- skip remaining records in current file # correctly handle successive occurrences of the same file # this should be read in before the "main" awk program - + function nextfile() { _abandon_ = FILENAME; next } - + _abandon_ == FILENAME { if (FNR == 1) _abandon_ = "" @@ -12531,24 +12660,24 @@ that remedies this problem is shown here: next } - The `nextfile' function has not changed. It makes `_abandon_' equal -to the current file name and then executes a `next' statement. The -`next' statement reads the next record and increments `FNR' so that -`FNR' is guaranteed to have a value of at least two. However, if -`nextfile' is called for the last record in the file, then `awk' closes -the current data file and moves on to the next one. Upon doing so, -`FILENAME' is set to the name of the new file and `FNR' is reset to -one. If this next file is the same as the previous one, `_abandon_' is -still equal to `FILENAME'. However, `FNR' is equal to one, telling us -that this is a new occurrence of the file and not the one we were -reading when the `nextfile' function was executed. In that case, -`_abandon_' is reset to the empty string, so that further executions of -this rule fail (until the next time that `nextfile' is called). - - If `FNR' is not one, then we are still in the original data file and +The `nextfile' function has not changed. It makes `_abandon_' equal to +the current file name and then executes a `next' statement. The `next' +statement reads the next record and increments `FNR' so that `FNR' is +guaranteed to have a value of at least two. However, if `nextfile' is +called for the last record in the file, then `awk' closes the current +data file and moves on to the next one. Upon doing so, `FILENAME' is +set to the name of the new file and `FNR' is reset to one. If this +next file is the same as the previous one, `_abandon_' is still equal +to `FILENAME'. However, `FNR' is equal to one, telling us that this is +a new occurrence of the file and not the one we were reading when the +`nextfile' function was executed. In that case, `_abandon_' is reset +to the empty string, so that further executions of this rule fail +(until the next time that `nextfile' is called). + +If `FNR' is not one, then we are still in the original data file and the program executes a `next' statement to skip through it. - An important question to ask at this point is: given that the +An important question to ask at this point is: given that the functionality of `nextfile' can be provided with a library file, why is it built into `gawk'? Adding features for little reason leads to larger, slower programs that are harder to maintain. The answer is @@ -12562,12 +12691,94 @@ saves a lot of time. This is particularly important in `awk', because time doing input and output, instead of performing computations).  -File: gawk.info, Node: Assert Function, Next: Round Function, Prev: Nextfile Function, Up: General Functions +File: gawk.info, Node: Strtonum Function, Next: Assert Function, Prev: Nextfile Function, Up: General Functions + +12.2.2 Converting Strings To Numbers +------------------------------------ + +The `strtonum' function (*note String Functions::) is a `gawk' +extension. The following function provides an implementation for other +versions of `awk': + + # strtonum --- convert string to number + function mystrtonum(str, ret, chars, n, i, k, c) + { + if (str ~ /^0[0-7]*$/) { + # octal + n = length(str) + ret = 0 + for (i = 1; i <= n; i++) { + c = substr(str, i, 1) + if ((k = index("01234567", c)) > 0) + k-- # adjust for 1-basing in awk + + ret = ret * 8 + k + } + } else if (str ~ /^0[xX][0-9a-fA-f]+/) { + # hexadecimal + str = substr(str, 3) # lop off leading 0x + n = length(str) + ret = 0 + for (i = 1; i <= n; i++) { + c = substr(str, i, 1) + c = tolower(c) + if ((k = index("0123456789", c)) > 0) + k-- # adjust for 1-basing in awk + else if ((k = index("abcdef", c)) > 0) + k += 9 + + ret = ret * 16 + k + } + } else if (str ~ /^[-+]?([0-9]+([.][0-9]*([Ee][0-9]+)?)?|([.][0-9]+([Ee][-+]?[0-9]+)?))$/) { + # decimal number, possibly floating point + ret = str + 0 + } else + ret = "NOT-A-NUMBER" + + return ret + } + + # BEGIN { # gawk test harness + # a[1] = "25" + # a[2] = ".31" + # a[3] = "0123" + # a[4] = "0xdeadBEEF" + # a[5] = "123.45" + # a[6] = "1.e3" + # a[7] = "1.32" + # a[7] = "1.32E2" + # + # for (i = 1; i in a; i++) + # print a[i], strtonum(a[i]), mystrtonum(a[i]) + # } + +The function first looks for C-style octal numbers (base 8). If the +input string matches a regular expression describing octal numbers, +then `mystrtonum' loops through each character in the string. It sets +`k' to the index in `"01234567"' of the current octal digit. Since the +return value is one-based, the `k--' adjusts `k' so it can be used in +computing the return value. + +Similar logic applies to the code that checks for and converts a +hexadecimal value, which starts with `0x' or `0X'. The use of +`tolower' simplifies the computation for finding the correct numeric +value for each hexadecimal digit. + +Finally, if the string matches the (rather complicated) regex for a +regular decimal integer or floating-point numer, the computation `ret = +str + 0' lets `awk' convert the value to a number. + +A commented-out test program is included, so that the function can be +tested with `gawk' and the results compared to the built-in `strtonum' +function. + + +File: gawk.info, Node: Assert Function, Next: Round Function, Prev: Strtonum Function, Up: General Functions -Assertions ----------- +12.2.3 Assertions +----------------- - When writing large programs, it is often useful to know that a +When writing large programs, it is often useful to know that a condition or set of conditions is true. Before proceeding with a particular computation, you make a statement about what you believe to be the case. Such a statement is known as an "assertion". The C @@ -12578,18 +12789,18 @@ message describing the condition that should have been true but was not, and then it kills the program. In C, using `assert' looks this: #include - + int myfunc(int a, double b) { assert(a <= 5 && b >= 17.1); ... } - If the assertion fails, the program prints a message similar to this: +If the assertion fails, the program prints a message similar to this: prog.c:5: assertion failed: a <= 5 && b >= 17.1 - The C language makes it possible to turn the condition into a string +The C language makes it possible to turn the condition into a string for use in printing the diagnostic message. This is not possible in `awk', so this `assert' function also requires a string version of the condition that is being tested. Following is the function: @@ -12604,20 +12815,20 @@ condition that is being tested. Following is the function: exit 1 } } - + END { if (_assert_exit) exit 1 } - The `assert' function tests the `condition' parameter. If it is -false, it prints a message to standard error, using the `string' -parameter to describe the failed condition. It then sets the variable +The `assert' function tests the `condition' parameter. If it is false, +it prints a message to standard error, using the `string' parameter to +describe the failed condition. It then sets the variable `_assert_exit' to one and executes the `exit' statement. The `exit' statement jumps to the `END' rule. If the `END' rules finds `_assert_exit' to be true, it exits immediately. - The purpose of the test in the `END' rule is to keep any other `END' +The purpose of the test in the `END' rule is to keep any other `END' rules from running. When an assertion fails, the program should exit immediately. If no assertions fail, then `_assert_exit' is still false when the `END' rule is run normally, and the rest of the program's @@ -12635,42 +12846,42 @@ If the assertion fails, you see a message similar to the following: mydata:1357: assertion failed: a <= 5 && b >= 17.1 - There is a small problem with this version of `assert'. An `END' -rule is automatically added to the program calling `assert'. Normally, -if a program consists of just a `BEGIN' rule, the input files and/or +There is a small problem with this version of `assert'. An `END' rule +is automatically added to the program calling `assert'. Normally, if a +program consists of just a `BEGIN' rule, the input files and/or standard input are not read. However, now that the program has an `END' rule, `awk' attempts to read the input data files or standard input (*note Using BEGIN/END::), most likely causing the program to hang as it waits for input. - There is a simple workaround to this: make sure the `BEGIN' rule -always ends with an `exit' statement. +There is a simple workaround to this: make sure the `BEGIN' rule always +ends with an `exit' statement.  File: gawk.info, Node: Round Function, Next: Cliff Random Function, Prev: Assert Function, Up: General Functions -Rounding Numbers ----------------- +12.2.4 Rounding Numbers +----------------------- - The way `printf' and `sprintf' (*note Printf::) perform rounding -often depends upon the system's C `sprintf' subroutine. On many -machines, `sprintf' rounding is "unbiased," which means it doesn't -always round a trailing `.5' up, contrary to naive expectations. In -unbiased rounding, `.5' rounds to even, rather than always up, so 1.5 -rounds to 2 but 4.5 rounds to 4. This means that if you are using a -format that does rounding (e.g., `"%.0f"'), you should check what your -system does. The following function does traditional rounding; it -might be useful if your awk's `printf' does unbiased rounding: +The way `printf' and `sprintf' (*note Printf::) perform rounding often +depends upon the system's C `sprintf' subroutine. On many machines, +`sprintf' rounding is "unbiased," which means it doesn't always round a +trailing `.5' up, contrary to naive expectations. In unbiased +rounding, `.5' rounds to even, rather than always up, so 1.5 rounds to +2 but 4.5 rounds to 4. This means that if you are using a format that +does rounding (e.g., `"%.0f"'), you should check what your system does. +The following function does traditional rounding; it might be useful +if your awk's `printf' does unbiased rounding: # round.awk --- do normal rounding function round(x, ival, aval, fraction) { ival = int(x) # integer part, int() truncates - + # see if fractional part if (ival == x) # no fraction return x - + if (x < 0) { aval = -x # absolute value ival = int(aval) @@ -12687,24 +12898,24 @@ might be useful if your awk's `printf' does unbiased rounding: return ival } } - + # test harness { print $0, round($0) }  File: gawk.info, Node: Cliff Random Function, Next: Ordinal Functions, Prev: Round Function, Up: General Functions -The Cliff Random Number Generator ---------------------------------- +12.2.5 The Cliff Random Number Generator +---------------------------------------- - The Cliff random number generator(1) is a very simple random number +The Cliff random number generator(1) is a very simple random number generator that "passes the noise sphere test for randomness by showing no structure." It is easily programmed, in less than 10 lines of `awk' code: # cliff_rand.awk --- generate Cliff random numbers BEGIN { _cliff_seed = 0.1 } - + function cliff_rand() { _cliff_seed = (100 * log(_cliff_seed)) % 1 @@ -12713,38 +12924,38 @@ code: return _cliff_seed } - This algorithm requires an initial "seed" of 0.1. Each new value -uses the current seed as input for the calculation. If the built-in -`rand' function (*note Numeric Functions::) isn't random enough, you -might try using this function instead. +This algorithm requires an initial "seed" of 0.1. Each new value uses +the current seed as input for the calculation. If the built-in `rand' +function (*note Numeric Functions::) isn't random enough, you might try +using this function instead. - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) `http://mathworld.wolfram.com/CliffRandomNumberGenerator.hmtl' +(1) `http://mathworld.wolfram.com/CliffRandomNumberGenerator.hmtl'  File: gawk.info, Node: Ordinal Functions, Next: Join Function, Prev: Cliff Random Function, Up: General Functions -Translating Between Characters and Numbers ------------------------------------------- +12.2.6 Translating Between Characters and Numbers +------------------------------------------------- - One commercial implementation of `awk' supplies a built-in function, +One commercial implementation of `awk' supplies a built-in function, `ord', which takes a character and returns the numeric value for that character in the machine's character set. If the string passed to `ord' has more than one character, only the first one is used. - The inverse of this function is `chr' (from the function of the same +The inverse of this function is `chr' (from the function of the same name in Pascal), which takes a number and returns the corresponding character. Both functions are written very nicely in `awk'; there is no real reason to build them into the `awk' interpreter: # ord.awk --- do ord and chr - + # Global identifiers: # _ord_: numerical values indexed by characters # _ord_init: function to initialize _ord_ BEGIN { _ord_init() } - + function _ord_init( low, high, i, t) { low = sprintf("%c", 7) # BEL is ascii 7 @@ -12759,16 +12970,16 @@ no real reason to build them into the `awk' interpreter: low = 0 high = 255 } - + for (i = low; i <= high; i++) { t = sprintf("%c", i) _ord_[t] = i } } - Some explanation of the numbers used by `chr' is worthwhile. The -most prominent character set in use today is ASCII. Although an 8-bit -byte can hold 256 distinct values (from 0 to 255), ASCII only defines +Some explanation of the numbers used by `chr' is worthwhile. The most +prominent character set in use today is ASCII. Although an 8-bit byte +can hold 256 distinct values (from 0 to 255), ASCII only defines characters that use the values from 0 to 127.(1) In the now distant past, at least one minicomputer manufacturer used ASCII, but with mark parity, meaning that the leftmost bit in the byte is always 1. This @@ -12783,13 +12994,13 @@ on some older systems, they are not really worth worrying about: c = substr(str, 1, 1) return _ord_[c] } - + function chr(c) { # force c to be numeric by adding 0 return sprintf("%c", c + 0) } - + #### test code #### # BEGIN \ # { @@ -12801,30 +13012,30 @@ on some older systems, they are not really worth worrying about: # } # } - An obvious improvement to these functions is to move the code for the +An obvious improvement to these functions is to move the code for the `_ord_init' function into the body of the `BEGIN' rule. It was written this way initially for ease of development. There is a "test program" in a `BEGIN' rule, to test the function. It is commented out for production use. - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) ASCII has been extended in many countries to use the values from +(1) ASCII has been extended in many countries to use the values from 128 to 255 for country-specific characters. If your system uses these extensions, you can simplify `_ord_init' to simply loop from 0 to 255.  File: gawk.info, Node: Join Function, Next: Gettimeofday Function, Prev: Ordinal Functions, Up: General Functions -Merging an Array into a String ------------------------------- +12.2.7 Merging an Array into a String +------------------------------------- - When doing string processing, it is often useful to be able to join -all the strings in an array into one long string. The following -function, `join', accomplishes this task. It is used later in several -of the application programs (*note Sample Programs::). +When doing string processing, it is often useful to be able to join all +the strings in an array into one long string. The following function, +`join', accomplishes this task. It is used later in several of the +application programs (*note Sample Programs::). - Good function design is important; this function needs to be general +Good function design is important; this function needs to be general but it should also have a reasonable default behavior. It is called with an array as well as the beginning and ending indices of the elements in the array to be merged. This assumes that the array @@ -12844,39 +13055,38 @@ created with `split' (*note String Functions::): return result } - An optional additional argument is the separator to use when joining -the strings back together. If the caller supplies a nonempty value, -`join' uses it; if it is not supplied, it has a null value. In this -case, `join' uses a single blank as a default separator for the -strings. If the value is equal to `SUBSEP', then `join' joins the -strings with no separator between them. `SUBSEP' serves as a "magic" -value to indicate that there should be no separation between the -component strings.(1) +An optional additional argument is the separator to use when joining the +strings back together. If the caller supplies a nonempty value, `join' +uses it; if it is not supplied, it has a null value. In this case, +`join' uses a single blank as a default separator for the strings. If +the value is equal to `SUBSEP', then `join' joins the strings with no +separator between them. `SUBSEP' serves as a "magic" value to indicate +that there should be no separation between the component strings.(1) - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) It would be nice if `awk' had an assignment operator for +(1) It would be nice if `awk' had an assignment operator for concatenation. The lack of an explicit operator for concatenation makes string operations more difficult than they really need to be.  File: gawk.info, Node: Gettimeofday Function, Prev: Join Function, Up: General Functions -Managing the Time of Day ------------------------- +12.2.8 Managing the Time of Day +------------------------------- - The `systime' and `strftime' functions described in *Note Time +The `systime' and `strftime' functions described in *Note Time Functions::, provide the minimum functionality necessary for dealing with the time of day in human readable form. While `strftime' is extensive, the control formats are not necessarily easy to remember or intuitively obvious when reading a program. - The following function, `gettimeofday', populates a user-supplied -array with preformatted time information. It returns a string with the +The following function, `gettimeofday', populates a user-supplied array +with preformatted time information. It returns a string with the current time formatted in the same way as the `date' utility: # gettimeofday.awk --- get the time of day in a usable format - + # Returns a string in the format of output of date(1) # Populates the array argument time with individual values: # time["second"] -- seconds (0 - 59) @@ -12898,18 +13108,18 @@ current time formatted in the same way as the `date' utility: # time["ampm"] -- AM or PM designation # time["weeknum"] -- week number, Sunday first day # time["altweeknum"] -- week number, Monday first day - + function gettimeofday(time, ret, now, i) { # get time once, avoids unnecessary system calls now = systime() - + # return date(1)-style output ret = strftime("%a %b %d %H:%M:%S %Z %Y", now) - + # clear out target array delete time - + # fill in values, force numeric values to be # numeric by adding 0 time["second"] = strftime("%S", now) + 0 @@ -12931,23 +13141,23 @@ current time formatted in the same way as the `date' utility: time["ampm"] = strftime("%p", now) time["weeknum"] = strftime("%U", now) + 0 time["altweeknum"] = strftime("%W", now) + 0 - + return ret } - The string indices are easier to use and read than the various -formats required by `strftime'. The `alarm' program presented in *Note -Alarm Program::, uses this function. A more general design for the +The string indices are easier to use and read than the various formats +required by `strftime'. The `alarm' program presented in *Note Alarm +Program::, uses this function. A more general design for the `gettimeofday' function would have allowed the user to supply an optional timestamp value to use instead of the current time.  File: gawk.info, Node: Data File Management, Next: Getopt Function, Prev: General Functions, Up: Library Functions -Data File Management -==================== +12.3 Data File Management +========================= - This minor node presents functions that are useful for managing +This minor node presents functions that are useful for managing command-line data files. * Menu: @@ -12961,10 +13171,10 @@ command-line data files.  File: gawk.info, Node: Filetrans Function, Next: Rewind Function, Up: Data File Management -Noting Data File Boundaries ---------------------------- +12.3.1 Noting Data File Boundaries +---------------------------------- - The `BEGIN' and `END' rules are each executed exactly once at the +The `BEGIN' and `END' rules are each executed exactly once at the beginning and end of your `awk' program, respectively (*note BEGIN/END::). We (the `gawk' authors) once had a user who mistakenly thought that the `BEGIN' rule is executed at the beginning of each data @@ -12973,8 +13183,8 @@ informed that this was not the case, the user requested that we add new special patterns to `gawk', named `BEGIN_FILE' and `END_FILE', that would have the desired behavior. He even supplied us the code to do so. - Adding these special patterns to `gawk' wasn't necessary; the job -can be done cleanly in `awk' itself, as illustrated by the following +Adding these special patterns to `gawk' wasn't necessary; the job can +be done cleanly in `awk' itself, as illustrated by the following library program. It arranges to call two user-supplied functions, `beginfile' and `endfile', at the beginning and end of each data file. Besides solving the problem in only nine(!) lines of code, it does so @@ -12987,7 +13197,7 @@ _portably_; this works with any implementation of `awk': # The user must supply functions beginfile() and endfile() # that each take the name of the file being started or # finished, respectively. - + FILENAME != _oldfilename \ { if (_oldfilename != "") @@ -12995,13 +13205,13 @@ _portably_; this works with any implementation of `awk': _oldfilename = FILENAME beginfile(FILENAME) } - + END { endfile(FILENAME) } - This file must be loaded before the user's "main" program, so that -the rule it supplies is executed first. +This file must be loaded before the user's "main" program, so that the +rule it supplies is executed first. - This rule relies on `awk''s `FILENAME' variable that automatically +This rule relies on `awk''s `FILENAME' variable that automatically changes for each new data file. The current file name is saved in a private variable, `_oldfilename'. If `FILENAME' does not equal `_oldfilename', then a new data file is being processed and it is @@ -13013,16 +13223,16 @@ then assigns the current file name to `_oldfilename' and calls `_oldfilename' is initialized to the null string, this rule executes correctly even for the first data file. - The program also supplies an `END' rule to do the final processing -for the last file. Because this `END' rule comes before any `END' rules +The program also supplies an `END' rule to do the final processing for +the last file. Because this `END' rule comes before any `END' rules supplied in the "main" program, `endfile' is called first. Once again the value of multiple `BEGIN' and `END' rules should be clear. - This version has same problem as the first version of `nextfile' -(*note Nextfile Function::). If the same data file occurs twice in a -row on the command line, then `endfile' and `beginfile' are not -executed at the end of the first pass and at the beginning of the -second pass. The following version solves the problem: +This version has same problem as the first version of `nextfile' (*note +Nextfile Function::). If the same data file occurs twice in a row on +the command line, then `endfile' and `beginfile' are not executed at +the end of the first pass and at the beginning of the second pass. The +following version solves the problem: # ftrans.awk --- handle data file transitions # @@ -13033,26 +13243,26 @@ second pass. The following version solves the problem: _filename_ = FILENAME beginfile(FILENAME) } - + END { endfile(_filename_) } - *Note Wc Program::, shows how this library function can be used and -how it simplifies writing the main program. +*Note Wc Program::, shows how this library function can be used and how +it simplifies writing the main program.  File: gawk.info, Node: Rewind Function, Next: File Checking, Prev: Filetrans Function, Up: Data File Management -Rereading the Current File --------------------------- +12.3.2 Rereading the Current File +--------------------------------- - Another request for a new built-in function was for a `rewind' -function that would make it possible to reread the current file. The -requesting user didn't want to have to use `getline' (*note Getline::) -inside a loop. +Another request for a new built-in function was for a `rewind' function +that would make it possible to reread the current file. The requesting +user didn't want to have to use `getline' (*note Getline::) inside a +loop. - However, as long as you are not in the `END' rule, it is quite easy -to arrange to immediately close the current input file and then start -over with it from the top. For lack of a better name, we'll call it +However, as long as you are not in the `END' rule, it is quite easy to +arrange to immediately close the current input file and then start over +with it from the top. For lack of a better name, we'll call it `rewind': # rewind.awk --- rewind the current file and start over @@ -13061,36 +13271,36 @@ over with it from the top. For lack of a better name, we'll call it # shift remaining arguments up for (i = ARGC; i > ARGIND; i--) ARGV[i] = ARGV[i-1] - + # make sure gawk knows to keep going ARGC++ - + # make current file next to get done ARGV[ARGIND+1] = FILENAME - + # do it nextfile } - This code relies on the `ARGIND' variable (*note Auto-set::), which -is specific to `gawk'. If you are not using `gawk', you can use ideas +This code relies on the `ARGIND' variable (*note Auto-set::), which is +specific to `gawk'. If you are not using `gawk', you can use ideas presented in *Note Filetrans Function::, to either update `ARGIND' on your own or modify this code as appropriate. - The `rewind' function also relies on the `nextfile' keyword (*note +The `rewind' function also relies on the `nextfile' keyword (*note Nextfile Statement::). *Note Nextfile Function::, for a function version of `nextfile'.  File: gawk.info, Node: File Checking, Next: Empty Files, Prev: Rewind Function, Up: Data File Management -Checking for Readable Data Files --------------------------------- +12.3.3 Checking for Readable Data Files +--------------------------------------- - Normally, if you give `awk' a data file that isn't readable, it -stops with a fatal error. There are times when you might want to just -ignore such files and keep going. You can do this by prepending the -following program to your `awk' program: +Normally, if you give `awk' a data file that isn't readable, it stops +with a fatal error. There are times when you might want to just ignore +such files and keep going. You can do this by prepending the following +program to your `awk' program: # readable.awk --- library file to skip over unreadable files BEGIN { @@ -13105,17 +13315,17 @@ following program to your `awk' program: } } - In `gawk', the `getline' won't be fatal (unless `--posix' is in -force). Removing the element from `ARGV' with `delete' skips the file -(since it's no longer in the list). +In `gawk', the `getline' won't be fatal (unless `--posix' is in force). +Removing the element from `ARGV' with `delete' skips the file (since +it's no longer in the list).  File: gawk.info, Node: Empty Files, Next: Ignoring Assigns, Prev: File Checking, Up: Data File Management -Checking For Zero-length Files ------------------------------- +12.3.4 Checking For Zero-length Files +------------------------------------- - All known `awk' implementations silently skip over zero-length files. +All known `awk' implementations silently skip over zero-length files. This is a by-product of `awk''s implicit read-a-record-and-match-against-the-rules loop: when `awk' tries to read a record from an empty file, it immediately receives an end of @@ -13123,7 +13333,7 @@ file indication, closes the file, and proceeds on to the next command-line data file, _without_ executing any user-level `awk' program code. - Using `gawk''s `ARGIND' variable (*note Built-in Variables::), it is +Using `gawk''s `ARGIND' variable (*note Built-in Variables::), it is possible to detect when an empty data file has been skipped. Similar to the library file presented in *Note Filetrans Function::, the following library file calls a function named `zerofile' that the user @@ -13132,53 +13342,53 @@ in `ARGV' where it was found: # zerofile.awk --- library file to process empty input files BEGIN { Argind = 0 } - + ARGIND > Argind + 1 { for (Argind++; Argind < ARGIND; Argind++) zerofile(ARGV[Argind], Argind) } - + ARGIND != Argind { Argind = ARGIND } - + END { if (ARGIND > Argind) for (Argind++; Argind <= ARGIND; Argind++) zerofile(ARGV[Argind], Argind) } - The user-level variable `Argind' allows the `awk' program to track -its progress through `ARGV'. Whenever the program detects that -`ARGIND' is greater than `Argind + 1', it means that one or more empty -files were skipped. The action then calls `zerofile' for each such -file, incrementing `Argind' along the way. +The user-level variable `Argind' allows the `awk' program to track its +progress through `ARGV'. Whenever the program detects that `ARGIND' is +greater than `Argind + 1', it means that one or more empty files were +skipped. The action then calls `zerofile' for each such file, +incrementing `Argind' along the way. - The `Argind != ARGIND' rule simply keeps `Argind' up to date in the +The `Argind != ARGIND' rule simply keeps `Argind' up to date in the normal case. - Finally, the `END' rule catches the case of any empty files at the -end of the command-line arguments. Note that the test in the condition -of the `for' loop uses the `<=' operator, not `<'. +Finally, the `END' rule catches the case of any empty files at the end +of the command-line arguments. Note that the test in the condition of +the `for' loop uses the `<=' operator, not `<'. - As an exercise, you might consider whether this same problem can be +As an exercise, you might consider whether this same problem can be solved without relying on `gawk''s `ARGIND' variable. - As a second exercise, revise this code to handle the case where an +As a second exercise, revise this code to handle the case where an intervening value in `ARGV' is a variable assignment.  File: gawk.info, Node: Ignoring Assigns, Prev: Empty Files, Up: Data File Management -Treating Assignments as File Names ----------------------------------- +12.3.5 Treating Assignments as File Names +----------------------------------------- - Occasionally, you might not want `awk' to process command-line -variable assignments (*note Assignment Options::). In particular, if -you have file names that contain an `=' character, `awk' treats the -file name as an assignment, and does not process it. +Occasionally, you might not want `awk' to process command-line variable +assignments (*note Assignment Options::). In particular, if you have +file names that contain an `=' character, `awk' treats the file name as +an assignment, and does not process it. - Some users have suggested an additional command-line option for -`gawk' to disable command-line assignments. However, some simple -programming with a library file does the trick: +Some users have suggested an additional command-line option for `gawk' +to disable command-line assignments. However, some simple programming +with a library file does the trick: # noassign.awk --- library file to avoid the need for a # special option that disables command-line assignments @@ -13188,21 +13398,21 @@ programming with a library file does the trick: if (argv[i] ~ /^[A-Za-z_][A-Za-z_0-9]*=.*/) argv[i] = ("./" argv[i]) } - + BEGIN { if (No_command_assign) disable_assigns(ARGC, ARGV) } - You then run your program this way: +You then run your program this way: awk -v No_command_assign=1 -f noassign.awk -f yourprog.awk * - The function works by looping through the arguments. It prepends -`./' to any argument that matches the form of a variable assignment, -turning that argument into a file name. +The function works by looping through the arguments. It prepends `./' +to any argument that matches the form of a variable assignment, turning +that argument into a file name. - The use of `No_command_assign' allows you to disable command-line +The use of `No_command_assign' allows you to disable command-line assignments at invocation time, by giving the variable a true value. When not set, it is initially zero (i.e., false), so the command-line arguments are left alone. @@ -13210,34 +13420,34 @@ arguments are left alone.  File: gawk.info, Node: Getopt Function, Next: Passwd Functions, Prev: Data File Management, Up: Library Functions -Processing Command-Line Options -=============================== +12.4 Processing Command-Line Options +==================================== - Most utilities on POSIX compatible systems take options, or -"switches," on the command line that can be used to change the way a -program behaves. `awk' is an example of such a program (*note -Options::). Often, options take "arguments"; i.e., data that the -program needs to correctly obey the command-line option. For example, -`awk''s `-F' option requires a string to use as the field separator. -The first occurrence on the command line of either `--' or a string -that does not begin with `-' ends the options. - - Modern Unix systems provide a C function named `getopt' for -processing command-line arguments. The programmer provides a string -describing the one-letter options. If an option requires an argument, -it is followed in the string with a colon. `getopt' is also passed the -count and values of the command-line arguments and is called in a loop. -`getopt' processes the command-line arguments for option letters. Each -time around the loop, it returns a single character representing the -next option letter that it finds, or `?' if it finds an invalid option. +Most utilities on POSIX compatible systems take options, or "switches," +on the command line that can be used to change the way a program +behaves. `awk' is an example of such a program (*note Options::). +Often, options take "arguments"; i.e., data that the program needs to +correctly obey the command-line option. For example, `awk''s `-F' +option requires a string to use as the field separator. The first +occurrence on the command line of either `--' or a string that does not +begin with `-' ends the options. + +Modern Unix systems provide a C function named `getopt' for processing +command-line arguments. The programmer provides a string describing the +one-letter options. If an option requires an argument, it is followed +in the string with a colon. `getopt' is also passed the count and +values of the command-line arguments and is called in a loop. `getopt' +processes the command-line arguments for option letters. Each time +around the loop, it returns a single character representing the next +option letter that it finds, or `?' if it finds an invalid option. When it returns -1, there are no options left on the command line. - When using `getopt', options that do not take arguments can be -grouped together. Furthermore, options that take arguments require -that the argument is present. The argument can immediately follow the -option letter, or it can be a separate command-line argument. +When using `getopt', options that do not take arguments can be grouped +together. Furthermore, options that take arguments require that the +argument is present. The argument can immediately follow the option +letter, or it can be a separate command-line argument. - Given a hypothetical program that takes three command-line options, +Given a hypothetical program that takes three command-line options, `-a', `-b', and `-c', where `-b' requires an argument, all of the following are valid ways of invoking the program: @@ -13245,14 +13455,13 @@ following are valid ways of invoking the program: prog -ac -bfoo -- data1 data2 data3 prog -acbfoo data1 data2 data3 - Notice that when the argument is grouped with its option, the rest of +Notice that when the argument is grouped with its option, the rest of the argument is considered to be the option's argument. In this example, `-acbfoo' indicates that all of the `-a', `-b', and `-c' options were supplied, and that `foo' is the argument to the `-b' option. - `getopt' provides four external variables that the programmer can -use: +`getopt' provides four external variables that the programmer can use: `optind' The index in the argument value array (`argv') where the first @@ -13269,8 +13478,8 @@ use: `optopt' The letter representing the command-line option. - The following C fragment shows how `getopt' might process -command-line arguments for `awk': +The following C fragment shows how `getopt' might process command-line +arguments for `awk': int main(int argc, char *argv[]) @@ -13301,17 +13510,17 @@ command-line arguments for `awk': ... } - As a side point, `gawk' actually uses the GNU `getopt_long' function -to process both normal and GNU-style long options (*note Options::). +As a side point, `gawk' actually uses the GNU `getopt_long' function to +process both normal and GNU-style long options (*note Options::). - The abstraction provided by `getopt' is very useful and is quite -handy in `awk' programs as well. Following is an `awk' version of -`getopt'. This function highlights one of the greatest weaknesses in -`awk', which is that it is very poor at manipulating single characters. -Repeated calls to `substr' are necessary for accessing individual -characters (*note String Functions::).(1) +The abstraction provided by `getopt' is very useful and is quite handy +in `awk' programs as well. Following is an `awk' version of `getopt'. +This function highlights one of the greatest weaknesses in `awk', which +is that it is very poor at manipulating single characters. Repeated +calls to `substr' are necessary for accessing individual characters +(*note String Functions::).(1) - The discussion that follows walks through the code a bit at a time: +The discussion that follows walks through the code a bit at a time: # getopt.awk --- do C library getopt(3) function in awk # External variables: @@ -13319,21 +13528,21 @@ characters (*note String Functions::).(1) # Optarg -- string value of argument to current option # Opterr -- if nonzero, print our own diagnostic # Optopt -- current option letter - + # Returns: # -1 at end of options # ? for unrecognized option # a character representing the current option - + # Private Data: # _opti -- index in multi-flag option, e.g., -abc - The function starts out with a list of the global variables it uses, +The function starts out with a list of the global variables it uses, what the return values are, what they mean, and any global variables that are "private" to this library function. Such documentation is essential for any program, and particularly for library functions. - The `getopt' function first checks that it was indeed called with a +The `getopt' function first checks that it was indeed called with a string of options (the `options' parameter). If `options' has a zero length, `getopt' immediately returns -1: @@ -13341,7 +13550,7 @@ length, `getopt' immediately returns -1: { if (length(options) == 0) # no options given return -1 - + if (argv[Optind] == "--") { # all done Optind++ _opti = 0 @@ -13351,13 +13560,13 @@ length, `getopt' immediately returns -1: return -1 } - The next thing to check for is the end of the options. A `--' ends -the command-line options, as does any command-line argument that does -not begin with a `-'. `Optind' is used to step through the array of +The next thing to check for is the end of the options. A `--' ends the +command-line options, as does any command-line argument that does not +begin with a `-'. `Optind' is used to step through the array of command-line arguments; it retains its value across calls to `getopt', because it is a global variable. - The regular expression that is used, `/^-[^: \t\n\f\r\v\b]/', is +The regular expression that is used, `/^-[^: \t\n\f\r\v\b]/', is perhaps a bit of overkill; it checks for a `-' followed by anything that is not whitespace and not a colon. If the current command-line argument does not match this pattern, it is not an option, and it ends @@ -13380,31 +13589,31 @@ option processing: return "?" } - The `_opti' variable tracks the position in the current command-line +The `_opti' variable tracks the position in the current command-line argument (`argv[Optind]'). If multiple options are grouped together with one `-' (e.g., `-abx'), it is necessary to return them to the user one at a time. - If `_opti' is equal to zero, it is set to two, which is the index in +If `_opti' is equal to zero, it is set to two, which is the index in the string of the next character to look at (we skip the `-', which is at position one). The variable `thisopt' holds the character, obtained with `substr'. It is saved in `Optopt' for the main program to use. - If `thisopt' is not in the `options' string, then it is an invalid +If `thisopt' is not in the `options' string, then it is an invalid option. If `Opterr' is nonzero, `getopt' prints an error message on the standard error that is similar to the message from the C version of `getopt'. - Because the option is invalid, it is necessary to skip it and move -on to the next option character. If `_opti' is greater than or equal -to the length of the current command-line argument, it is necessary to +Because the option is invalid, it is necessary to skip it and move on +to the next option character. If `_opti' is greater than or equal to +the length of the current command-line argument, it is necessary to move on to the next argument, so `Optind' is incremented and `_opti' is reset to zero. Otherwise, `Optind' is left alone and `_opti' is merely incremented. - In any case, because the option is invalid, `getopt' returns `?'. -The main program can examine `Optopt' if it needs to know what the -invalid option letter actually is. Continuing on: +In any case, because the option is invalid, `getopt' returns `?'. The +main program can examine `Optopt' if it needs to know what the invalid +option letter actually is. Continuing on: if (substr(options, i + 1, 1) == ":") { # get option argument @@ -13416,10 +13625,10 @@ invalid option letter actually is. Continuing on: } else Optarg = "" - If the option requires an argument, the option letter is followed by -a colon in the `options' string. If there are remaining characters in -the current command-line argument (`argv[Optind]'), then the rest of -that string is assigned to `Optarg'. Otherwise, the next command-line +If the option requires an argument, the option letter is followed by a +colon in the `options' string. If there are remaining characters in the +current command-line argument (`argv[Optind]'), then the rest of that +string is assigned to `Optarg'. Otherwise, the next command-line argument is used (`-xFOO' versus `-x FOO'). In either case, `_opti' is reset to zero, because there are no more characters left to examine in the current command-line argument. Continuing: @@ -13432,14 +13641,14 @@ the current command-line argument. Continuing: return thisopt } - Finally, if `_opti' is either zero or greater than the length of the +Finally, if `_opti' is either zero or greater than the length of the current command-line argument, it means this element in `argv' is through being processed, so `Optind' is incremented to point to the next element in `argv'. If neither condition is true, then only `_opti' is incremented, so that the next option letter can be processed on the next call to `getopt'. - The `BEGIN' rule initializes both `Opterr' and `Optind' to one. +The `BEGIN' rule initializes both `Opterr' and `Optind' to one. `Opterr' is set to one, since the default behavior is for `getopt' to print a diagnostic message upon seeing an invalid option. `Optind' is set to one, since there's no reason to look at the program name, which @@ -13448,7 +13657,7 @@ is in `ARGV[0]': BEGIN { Opterr = 1 # default is to diagnose Optind = 1 # skip ARGV[0] - + # test program if (_getopt_test) { while ((_go_c = getopt(ARGC, ARGV, "ab:cd")) != -1) @@ -13461,7 +13670,7 @@ is in `ARGV[0]': } } - The rest of the `BEGIN' rule is a simple test program. Here is the +The rest of the `BEGIN' rule is a simple test program. Here is the result of two sample runs of the test program: $ awk -f getopt.awk -v _getopt_test=1 -- -a -cbARG bax -x @@ -13471,7 +13680,7 @@ result of two sample runs of the test program: -| non-option arguments: -| ARGV[3] = -| ARGV[4] = <-x> - + $ awk -f getopt.awk -v _getopt_test=1 -- -a -x -- xyz abc -| c = , optarg = <> error--> x -- invalid option @@ -13480,24 +13689,24 @@ result of two sample runs of the test program: -| ARGV[4] = -| ARGV[5] = - In both runs, the first `--' terminates the arguments to `awk', so -that it does not try to interpret the `-a', etc., as its own options. +In both runs, the first `--' terminates the arguments to `awk', so that +it does not try to interpret the `-a', etc., as its own options. Several of the sample programs presented in *Note Sample Programs::, use `getopt' to process their arguments. - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) This function was written before `gawk' acquired the ability to +(1) This function was written before `gawk' acquired the ability to split strings into single characters using `""' as the separator. We have left it alone, since using `substr' is more portable.  File: gawk.info, Node: Passwd Functions, Next: Group Functions, Prev: Getopt Function, Up: Library Functions -Reading the User Database -========================= +12.5 Reading the User Database +============================== - The `PROCINFO' array (*note Built-in Variables::) provides access to +The `PROCINFO' array (*note Built-in Variables::) provides access to the current user's real and effective user and group ID numbers, and if available, the user's supplementary group set. However, because these are numbers, they do not provide very useful information to the average @@ -13507,16 +13716,16 @@ presents a suite of functions for retrieving information from the user database. *Note Group Functions::, for a similar suite that retrieves information from the group database. - The POSIX standard does not define the file where user information is +The POSIX standard does not define the file where user information is kept. Instead, it provides the `' header file and several C language subroutines for obtaining user information. The primary function is `getpwent', for "get password entry." The "password" comes from the original user database file, `/etc/passwd', which stores user information, along with the encrypted passwords (hence the name). - While an `awk' program could simply read `/etc/passwd' directly, -this file may not contain complete information about the system's set -of users.(1) To be sure you are able to produce a readable and complete +While an `awk' program could simply read `/etc/passwd' directly, this +file may not contain complete information about the system's set of +users.(1) To be sure you are able to produce a readable and complete version of the user database, it is necessary to write a small C program that calls `getpwent'. `getpwent' is defined as returning a pointer to a `struct passwd'. Each time it is called, it returns the @@ -13532,24 +13741,24 @@ that "cats" the password database: */ #include #include - + int main(argc, argv) int argc; char **argv; { struct passwd *p; - + while ((p = getpwent()) != NULL) printf("%s:%s:%ld:%ld:%s:%s:%s\n", p->pw_name, p->pw_passwd, (long) p->pw_uid, (long) p->pw_gid, p->pw_gecos, p->pw_dir, p->pw_shell); - + endpwent(); return 0; } - If you don't understand C, don't worry about it. The output from +If you don't understand C, don't worry about it. The output from `pwcat' is the user database, in the traditional `/etc/passwd' format of colon-separated fields. The fields are: @@ -13565,7 +13774,7 @@ Home directory The user's login (or "home") directory Login shell The program that is run when the user logs in. This is usually a shell, such as `bash'. - A few lines representative of `pwcat''s output are as follows: +A few lines representative of `pwcat''s output are as follows: $ pwcat -| root:3Ov02d5VaUPB6:0:1:Operator:/:/bin/sh @@ -13578,28 +13787,28 @@ Login shell The program that is run when the user logs in. -| andy:abcca2:113:10:Andy Jacobs:/home/andy:/bin/sh ... - With that introduction, following is a group of functions for -getting user information. There are several functions here, -corresponding to the C functions of the same names: +With that introduction, following is a group of functions for getting +user information. There are several functions here, corresponding to +the C functions of the same names: # passwd.awk --- access password file information BEGIN { # tailor this to suit your system _pw_awklib = "/usr/local/libexec/awk/" } - + function _pw_init( oldfs, oldrs, olddol0, pwcat, using_fw) { if (_pw_inited) return - + oldfs = FS oldrs = RS olddol0 = $0 using_fw = (PROCINFO["FS"] == "FIELDWIDTHS") FS = ":" RS = "\n" - + pwcat = _pw_awklib "pwcat" while ((pwcat | getline) > 0) { _pw_byname[$1] = $0 @@ -13616,40 +13825,40 @@ corresponding to the C functions of the same names: $0 = olddol0 } - The `BEGIN' rule sets a private variable to the directory where -`pwcat' is stored. Because it is used to help out an `awk' library -routine, we have chosen to put it in `/usr/local/libexec/awk'; however, -you might want it to be in a different directory on your system. +The `BEGIN' rule sets a private variable to the directory where `pwcat' +is stored. Because it is used to help out an `awk' library routine, we +have chosen to put it in `/usr/local/libexec/awk'; however, you might +want it to be in a different directory on your system. - The function `_pw_init' keeps three copies of the user information -in three associative arrays. The arrays are indexed by username +The function `_pw_init' keeps three copies of the user information in +three associative arrays. The arrays are indexed by username (`_pw_byname'), by user ID number (`_pw_byuid'), and by order of occurrence (`_pw_bycount'). The variable `_pw_inited' is used for efficiency; `_pw_init' needs only to be called once. - Because this function uses `getline' to read information from -`pwcat', it first saves the values of `FS', `RS', and `$0'. It notes -in the variable `using_fw' whether field splitting with `FIELDWIDTHS' -is in effect or not. Doing so is necessary, since these functions -could be called from anywhere within a user's program, and the user may -have his or her own way of splitting records and fields. +Because this function uses `getline' to read information from `pwcat', +it first saves the values of `FS', `RS', and `$0'. It notes in the +variable `using_fw' whether field splitting with `FIELDWIDTHS' is in +effect or not. Doing so is necessary, since these functions could be +called from anywhere within a user's program, and the user may have his +or her own way of splitting records and fields. - The `using_fw' variable checks `PROCINFO["FS"]', which is +The `using_fw' variable checks `PROCINFO["FS"]', which is `"FIELDWIDTHS"' if field splitting is being done with `FIELDWIDTHS'. This makes it possible to restore the correct field-splitting mechanism later. The test can only be true for `gawk'. It is false if using `FS' or on some other `awk' implementation. - The main part of the function uses a loop to read database lines, -split the line into fields, and then store the line into each array as +The main part of the function uses a loop to read database lines, split +the line into fields, and then store the line into each array as necessary. When the loop is done, `_pw_init' cleans up by closing the pipeline, setting `_pw_inited' to one, and restoring `FS' (and `FIELDWIDTHS' if necessary), `RS', and `$0'. The use of `_pw_count' is explained shortly. - The `getpwnam' function takes a username as a string argument. If -that user is in the database, it returns the appropriate line. -Otherwise, it returns the null string: +The `getpwnam' function takes a username as a string argument. If that +user is in the database, it returns the appropriate line. Otherwise, it +returns the null string: function getpwnam(name) { @@ -13659,9 +13868,9 @@ Otherwise, it returns the null string: return "" } - Similarly, the `getpwuid' function takes a user ID number argument. -If that user number is in the database, it returns the appropriate -line. Otherwise, it returns the null string: +Similarly, the `getpwuid' function takes a user ID number argument. If +that user number is in the database, it returns the appropriate line. +Otherwise, it returns the null string: function getpwuid(uid) { @@ -13671,8 +13880,8 @@ line. Otherwise, it returns the null string: return "" } - The `getpwent' function simply steps through the database, one entry -at a time. It uses `_pw_count' to track its current position in the +The `getpwent' function simply steps through the database, one entry at +a time. It uses `_pw_count' to track its current position in the `_pw_bycount' array: function getpwent() @@ -13683,26 +13892,25 @@ at a time. It uses `_pw_count' to track its current position in the return "" } - The `endpwent' function resets `_pw_count' to zero, so that -subsequent calls to `getpwent' start over again: +The `endpwent' function resets `_pw_count' to zero, so that subsequent +calls to `getpwent' start over again: function endpwent() { _pw_count = 0 } - A conscious design decision in this suite was made that each -subroutine calls `_pw_init' to initialize the database arrays. The -overhead of running a separate process to generate the user database, -and the I/O to scan it, are only incurred if the user's main program -actually calls one of these functions. If this library file is loaded -along with a user's program, but none of the routines are ever called, -then there is no extra runtime overhead. (The alternative is move the -body of `_pw_init' into a `BEGIN' rule, which always runs `pwcat'. -This simplifies the code but runs an extra process that may never be -needed.) - - In turn, calling `_pw_init' is not too expensive, because the +A conscious design decision in this suite was made that each subroutine +calls `_pw_init' to initialize the database arrays. The overhead of +running a separate process to generate the user database, and the I/O +to scan it, are only incurred if the user's main program actually calls +one of these functions. If this library file is loaded along with a +user's program, but none of the routines are ever called, then there is +no extra runtime overhead. (The alternative is move the body of +`_pw_init' into a `BEGIN' rule, which always runs `pwcat'. This +simplifies the code but runs an extra process that may never be needed.) + +In turn, calling `_pw_init' is not too expensive, because the `_pw_inited' variable keeps the program from reading the data more than once. If you are worried about squeezing every last cycle out of your `awk' program, the check of `_pw_inited' could be moved out of @@ -13710,29 +13918,29 @@ once. If you are worried about squeezing every last cycle out of your this is not necessary, since most `awk' programs are I/O-bound, and it clutters up the code. - The `id' program in *Note Id Program::, uses these functions. +The `id' program in *Note Id Program::, uses these functions. - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) It is often the case that password information is stored in a +(1) It is often the case that password information is stored in a network database.  File: gawk.info, Node: Group Functions, Prev: Passwd Functions, Up: Library Functions -Reading the Group Database -========================== +12.6 Reading the Group Database +=============================== - Much of the discussion presented in *Note Passwd Functions::, -applies to the group database as well. Although there has traditionally -been a well-known file (`/etc/group') in a well-known format, the POSIX +Much of the discussion presented in *Note Passwd Functions::, applies +to the group database as well. Although there has traditionally been a +well-known file (`/etc/group') in a well-known format, the POSIX standard only provides a set of C library routines (`' and `getgrent') for accessing the information. Even though this file may exist, it likely does not have complete information. Therefore, as with the user database, it is necessary to have a small C program that generates the group database as its output. - `grcat', a C program that "cats" the group database, is as follows: +`grcat', a C program that "cats" the group database, is as follows: /* * grcat.c @@ -13741,7 +13949,7 @@ generates the group database as its output. */ #include #include - + int main(argc, argv) int argc; @@ -13749,7 +13957,7 @@ generates the group database as its output. { struct group *g; int i; - + while ((g = getgrent()) != NULL) { printf("%s:%s:%ld:", g->gr_name, g->gr_passwd, (long) g->gr_gid); @@ -13764,7 +13972,7 @@ generates the group database as its output. return 0; } - Each line in the group database represents one group. The fields are +Each line in the group database represents one group. The fields are separated with colons and represent the following information: Group name The group's name. @@ -13782,7 +13990,7 @@ Group member list A comma-separated list of usernames. These numbers. (Note that `PROCINFO' is a `gawk' extension; *note Built-in Variables::.) - Here is what running `grcat' might produce: +Here is what running `grcat' might produce: $ grcat -| wheel:*:0:arnold @@ -13793,7 +14001,7 @@ Group member list A comma-separated list of usernames. These -| other:*:20: ... - Here are the functions for obtaining information from the group +Here are the functions for obtaining information from the group database. There are several, modeled after the C library functions of the same names: @@ -13803,20 +14011,20 @@ the same names: # Change to suit your system _gr_awklib = "/usr/local/libexec/awk/" } - + function _gr_init( oldfs, oldrs, olddol0, grcat, using_fw, n, a, i) { if (_gr_inited) return - + oldfs = FS oldrs = RS olddol0 = $0 using_fw = (PROCINFO["FS"] == "FIELDWIDTHS") FS = ":" RS = "\n" - + grcat = _gr_awklib "grcat" while ((grcat | getline) > 0) { if ($1 in _gr_byname) @@ -13827,7 +14035,7 @@ the same names: _gr_bygid[$3] = _gr_bygid[$3] "," $4 else _gr_bygid[$3] = $0 - + n = split($4, a, "[ \t]*,[ \t]*") for (i = 1; i <= n; i++) if (a[i] in _gr_groupsbyuser) @@ -13835,7 +14043,7 @@ the same names: _gr_groupsbyuser[a[i]] " " $1 else _gr_groupsbyuser[a[i]] = $1 - + _gr_bycount[++_gr_count] = $0 } close(grcat) @@ -13848,46 +14056,46 @@ the same names: $0 = olddol0 } - The `BEGIN' rule sets a private variable to the directory where -`grcat' is stored. Because it is used to help out an `awk' library -routine, we have chosen to put it in `/usr/local/libexec/awk'. You -might want it to be in a different directory on your system. +The `BEGIN' rule sets a private variable to the directory where `grcat' +is stored. Because it is used to help out an `awk' library routine, we +have chosen to put it in `/usr/local/libexec/awk'. You might want it +to be in a different directory on your system. - These routines follow the same general outline as the user database +These routines follow the same general outline as the user database routines (*note Passwd Functions::). The `_gr_inited' variable is used to ensure that the database is scanned no more than once. The `_gr_init' function first saves `FS', `FIELDWIDTHS', `RS', and `$0', and then sets `FS' and `RS' to the correct values for scanning the group information. - The group information is stored is several associative arrays. The +The group information is stored is several associative arrays. The arrays are indexed by group name (`_gr_byname'), by group ID number (`_gr_bygid'), and by position in the database (`_gr_bycount'). There is an additional array indexed by username (`_gr_groupsbyuser'), which is a space-separated list of groups to which each user belongs. - Unlike the user database, it is possible to have multiple records in -the database for the same group. This is common when a group has a -large number of members. A pair of such entries might look like the +Unlike the user database, it is possible to have multiple records in the +database for the same group. This is common when a group has a large +number of members. A pair of such entries might look like the following: tvpeople:*:101:johnny,jay,arsenio tvpeople:*:101:david,conan,tom,joan - For this reason, `_gr_init' looks to see if a group name or group ID +For this reason, `_gr_init' looks to see if a group name or group ID number is already seen. If it is, then the usernames are simply concatenated onto the previous list of users. (There is actually a subtle problem with the code just presented. Suppose that the first time there were no names. This code adds the names with a leading comma. It also doesn't check that there is a `$4'.) - Finally, `_gr_init' closes the pipeline to `grcat', restores `FS' -(and `FIELDWIDTHS' if necessary), `RS', and `$0', initializes -`_gr_count' to zero (it is used later), and makes `_gr_inited' nonzero. +Finally, `_gr_init' closes the pipeline to `grcat', restores `FS' (and +`FIELDWIDTHS' if necessary), `RS', and `$0', initializes `_gr_count' to +zero (it is used later), and makes `_gr_inited' nonzero. - The `getgrnam' function takes a group name as its argument, and if -that group exists, it is returned. Otherwise, `getgrnam' returns the -null string: +The `getgrnam' function takes a group name as its argument, and if that +group exists, it is returned. Otherwise, `getgrnam' returns the null +string: function getgrnam(group) { @@ -13897,7 +14105,7 @@ null string: return "" } - The `getgrgid' function is similar, it takes a numeric group ID and +The `getgrgid' function is similar, it takes a numeric group ID and looks up the information associated with that group ID: function getgrgid(gid) @@ -13908,7 +14116,7 @@ looks up the information associated with that group ID: return "" } - The `getgruser' function does not have a C counterpart. It takes a +The `getgruser' function does not have a C counterpart. It takes a username and returns the list of groups that have the user as a member: function getgruser(user) @@ -13919,8 +14127,8 @@ username and returns the list of groups that have the user as a member: return "" } - The `getgrent' function steps through the database one entry at a -time. It uses `_gr_count' to track its position in the list: +The `getgrent' function steps through the database one entry at a time. +It uses `_gr_count' to track its position in the list: function getgrent() { @@ -13930,37 +14138,37 @@ time. It uses `_gr_count' to track its position in the list: return "" } - The `endgrent' function resets `_gr_count' to zero so that -`getgrent' can start over again: +The `endgrent' function resets `_gr_count' to zero so that `getgrent' +can start over again: function endgrent() { _gr_count = 0 } - As with the user database routines, each function calls `_gr_init' to +As with the user database routines, each function calls `_gr_init' to initialize the arrays. Doing so only incurs the extra overhead of running `grcat' if these functions are used (as opposed to moving the body of `_gr_init' into a `BEGIN' rule). - Most of the work is in scanning the database and building the various +Most of the work is in scanning the database and building the various associative arrays. The functions that the user calls are themselves very simple, relying on `awk''s associative arrays to do work. - The `id' program in *Note Id Program::, uses these functions. +The `id' program in *Note Id Program::, uses these functions.  File: gawk.info, Node: Sample Programs, Next: Language History, Prev: Library Functions, Up: Top -Practical `awk' Programs -************************ +13 Practical `awk' Programs +*************************** - *Note Library Functions::, presents the idea that reading programs -in a language contributes to learning that language. This major node +*Note Library Functions::, presents the idea that reading programs in a +language contributes to learning that language. This major node continues that theme, presenting a potpourri of `awk' programs for your reading enjoyment. - Many of these programs use the library functions presented in *Note +Many of these programs use the library functions presented in *Note Library Functions::. * Menu: @@ -13972,10 +14180,10 @@ Library Functions::.  File: gawk.info, Node: Running Examples, Next: Clones, Up: Sample Programs -Running the Example Programs -============================ +13.1 Running the Example Programs +================================= - To run a given program, you would typically do something like this: +To run a given program, you would typically do something like this: awk -f PROGRAM -- OPTIONS FILES @@ -13983,33 +14191,32 @@ Here, PROGRAM is the name of the `awk' program (such as `cut.awk'), OPTIONS are any command-line options for the program that start with a `-', and FILES are the actual data files. - If your system supports the `#!' executable interpreter mechanism +If your system supports the `#!' executable interpreter mechanism (*note Executable Scripts::), you can instead run your program directly: cut.awk -c1-8 myfiles > results - If your `awk' is not `gawk', you may instead need to use this: +If your `awk' is not `gawk', you may instead need to use this: cut.awk -- -c1-8 myfiles > results  File: gawk.info, Node: Clones, Next: Miscellaneous Programs, Prev: Running Examples, Up: Sample Programs -Reinventing Wheels for Fun and Profit -===================================== +13.2 Reinventing Wheels for Fun and Profit +========================================== - This minor node presents a number of POSIX utilities that are +This minor node presents a number of POSIX utilities that are implemented in `awk'. Reinventing these programs in `awk' is often enjoyable, because the algorithms can be very clearly expressed, and the code is usually very concise and simple. This is true because `awk' does so much for you. - It should be noted that these programs are not necessarily intended -to replace the installed versions on your system. Instead, their -purpose is to illustrate `awk' language programming for "real world" -tasks. +It should be noted that these programs are not necessarily intended to +replace the installed versions on your system. Instead, their purpose +is to illustrate `awk' language programming for "real world" tasks. - The programs are presented in alphabetical order. +The programs are presented in alphabetical order. * Menu: @@ -14024,22 +14231,22 @@ tasks.  File: gawk.info, Node: Cut Program, Next: Egrep Program, Up: Clones -Cutting out Fields and Columns ------------------------------- +13.2.1 Cutting out Fields and Columns +------------------------------------- - The `cut' utility selects, or "cuts," characters or fields from its +The `cut' utility selects, or "cuts," characters or fields from its standard input and sends them to its standard output. Fields are separated by tabs by default, but you may supply a command-line option to change the field "delimiter" (i.e., the field-separator character). `cut''s definition of fields is less general than `awk''s. - A common use of `cut' might be to pull out just the login name of +A common use of `cut' might be to pull out just the login name of logged-on users from the output of `who'. For example, the following pipeline generates a sorted, unique list of the logged-on users: who | cut -c1-8 | sort | uniq - The options for `cut' are: +The options for `cut' are: `-c LIST' Use LIST as the list of characters to cut out. Items within the @@ -14057,11 +14264,11 @@ pipeline generates a sorted, unique list of the logged-on users: `-s' Suppress printing of lines that do not contain the field delimiter. - The `awk' implementation of `cut' uses the `getopt' library function +The `awk' implementation of `cut' uses the `getopt' library function (*note Getopt Function::) and the `join' library function (*note Join Function::). - The program begins with a comment describing the options, the library +The program begins with a comment describing the options, the library functions needed, and a `usage' function that prints out a usage message and exits. `usage' is called if invalid arguments are supplied: @@ -14074,7 +14281,7 @@ message and exits. `usage' is called if invalid arguments are supplied: # -s Suppress lines without the delimiter # # Requires getopt and join library functions - + function usage( e1, e2) { e1 = "usage: cut [-f list] [-d c] [-s] [files...]" @@ -14087,7 +14294,7 @@ message and exits. `usage' is called if invalid arguments are supplied: The variables `e1' and `e2' are used so that the function fits nicely on the screen. - Next comes a `BEGIN' rule that parses the command-line options. It +Next comes a `BEGIN' rule that parses the command-line options. It sets `FS' to a single TAB character, because that is `cut''s default field separator. The output field separator is also set to be the same as the input field separator. Then `getopt' is used to step through @@ -14123,11 +14330,11 @@ the output field separator is set to the null string: else usage() } - + for (i = 1; i < Optind; i++) ARGV[i] = "" - Special care is taken when the field delimiter is a space. Using a +Special care is taken when the field delimiter is a space. Using a single space (`" "') for the value of `FS' is incorrect--`awk' would separate fields with runs of spaces, tabs, and/or newlines, and we want them to be separated with individual spaces. Also, note that after @@ -14135,30 +14342,30 @@ them to be separated with individual spaces. Also, note that after from 1 to `Optind', so that `awk' does not try to process the command-line options as file names. - After dealing with the command-line options, the program verifies -that the options make sense. Only one or the other of `-c' and `-f' -should be used, and both require a field list. Then the program calls -either `set_fieldlist' or `set_charlist' to pull apart the list of -fields or characters: +After dealing with the command-line options, the program verifies that +the options make sense. Only one or the other of `-c' and `-f' should +be used, and both require a field list. Then the program calls either +`set_fieldlist' or `set_charlist' to pull apart the list of fields or +characters: if (by_fields && by_chars) usage() - + if (by_fields == 0 && by_chars == 0) by_fields = 1 # default - + if (fieldlist == "") { print "cut: needs list for -c or -f" > "/dev/stderr" exit 1 } - + if (by_fields) set_fieldlist() else set_charlist() } - `set_fieldlist' is used to split the field list apart at the commas +`set_fieldlist' is used to split the field list apart at the commas and into an array. Then, for each element of the array, it looks to see if it is actually a range, and if so, splits it apart. The range is verified to make sure the first number is smaller than the second. @@ -14186,12 +14393,12 @@ The program lets `awk' handle the job of doing the field splitting: nfields = j - 1 } - The `set_charlist' function is more complicated than `set_fieldlist'. +The `set_charlist' function is more complicated than `set_fieldlist'. The idea here is to use `gawk''s `FIELDWIDTHS' variable (*note Constant Size::), which describes constant-width input. When using a character list, that is exactly what we have. - Setting up `FIELDWIDTHS' is more complicated than simply listing the +Setting up `FIELDWIDTHS' is more complicated than simply listing the fields that need to be printed. We have to keep track of the fields to print and also the intervening characters that have to be skipped. For example, suppose you wanted characters 1 through 8, 15, and 22 through @@ -14242,13 +14449,13 @@ filler fields: nfields = j - 1 } - Next is the rule that actually processes the data. If the `-s' -option is given, then `suppress' is true. The first `if' statement -makes sure that the input record does have the field separator. If -`cut' is processing fields, `suppress' is true, and the field separator +Next is the rule that actually processes the data. If the `-s' option +is given, then `suppress' is true. The first `if' statement makes sure +that the input record does have the field separator. If `cut' is +processing fields, `suppress' is true, and the field separator character is not in the record, then the record is skipped. - If the record is valid, then `gawk' has split the data into fields, +If the record is valid, then `gawk' has split the data into fields, either using the character in `FS' or using fixed-length fields and `FIELDWIDTHS'. The loop goes through the list of fields that should be printed. The corresponding field is printed if it contains data. If @@ -14258,7 +14465,7 @@ out between the fields: { if (by_fields && suppress && index($0, FS) != 0) next - + for (i = 1; i <= nfields; i++) { if ($flist[i] != "") { printf "%s", $flist[i] @@ -14269,8 +14476,8 @@ out between the fields: print "" } - This version of `cut' relies on `gawk''s `FIELDWIDTHS' variable to -do the character-based cutting. While it is possible in other `awk' +This version of `cut' relies on `gawk''s `FIELDWIDTHS' variable to do +the character-based cutting. While it is possible in other `awk' implementations to use `substr' (*note String Functions::), it is also extremely painful. The `FIELDWIDTHS' variable supplies an elegant solution to the problem of picking the input line apart by characters. @@ -14278,23 +14485,23 @@ solution to the problem of picking the input line apart by characters.  File: gawk.info, Node: Egrep Program, Next: Id Program, Prev: Cut Program, Up: Clones -Searching for Regular Expressions in Files ------------------------------------------- +13.2.2 Searching for Regular Expressions in Files +------------------------------------------------- - The `egrep' utility searches files for patterns. It uses regular +The `egrep' utility searches files for patterns. It uses regular expressions that are almost identical to those available in `awk' (*note Regexp::). It is used in the following manner: egrep [ OPTIONS ] 'PATTERN' FILES ... - The PATTERN is a regular expression. In typical usage, the regular +The PATTERN is a regular expression. In typical usage, the regular expression is quoted to prevent the shell from expanding any of the special characters as file name wildcards. Normally, `egrep' prints the lines that matched. If multiple file names are provided on the command line, each output line is preceded by the name of the file and a colon. - The options to `egrep' are as follows: +The options to `egrep' are as follows: `-c' Print out a count of the lines that matched the pattern, instead @@ -14320,11 +14527,11 @@ a colon. Use PATTERN as the regexp to match. The purpose of the `-e' option is to allow patterns that start with a `-'. - This version uses the `getopt' library function (*note Getopt +This version uses the `getopt' library function (*note Getopt Function::) and the file transition library program (*note Filetrans Function::). - The program begins with a descriptive comment and then a `BEGIN' rule +The program begins with a descriptive comment and then a `BEGIN' rule that processes the command-line arguments with `getopt'. The `-i' (ignore case) option is particularly easy with `gawk'; we just use the `IGNORECASE' built-in variable (*note Built-in Variables::): @@ -14339,7 +14546,7 @@ that processes the command-line arguments with `getopt'. The `-i' # -e argument is pattern # # Requires getopt and file transition library functions - + BEGIN { while ((c = getopt(ARGC, ARGV, "ce:svil")) != -1) { if (c == "c") @@ -14358,7 +14565,7 @@ that processes the command-line arguments with `getopt'. The `-i' usage() } - Next comes the code that handles the `egrep'-specific behavior. If no +Next comes the code that handles the `egrep'-specific behavior. If no pattern is supplied with `-e', the first nonoption on the command line is used. The `awk' command-line arguments up to `ARGV[Optind]' are cleared, so that `awk' won't try to process them as files. If no files @@ -14368,7 +14575,7 @@ the matched lines in the output: if (pattern == "") pattern = ARGV[Optind++] - + for (i = 1; i < Optind; i++) ARGV[i] = "" if (Optind >= ARGC) { @@ -14376,16 +14583,16 @@ the matched lines in the output: ARGC = 2 } else if (ARGC - Optind > 1) do_filenames++ - + # if (IGNORECASE) # pattern = tolower(pattern) } - The last two lines are commented out, since they are not needed in +The last two lines are commented out, since they are not needed in `gawk'. They should be uncommented if you have to use another version of `awk'. - The next set of lines should be uncommented if you are not using +The next set of lines should be uncommented if you are not using `gawk'. This rule translates all the characters in the input line into lowercase if the `-i' option is specified.(1) The rule is commented out since it is not necessary with `gawk': @@ -14395,7 +14602,7 @@ since it is not necessary with `gawk': # $0 = tolower($0) #} - The `beginfile' function is called by the rule in `ftrans.awk' when +The `beginfile' function is called by the rule in `ftrans.awk' when each new file is processed. In this case, it is very simple; all it does is initialize a variable `fcount' to zero. `fcount' tracks how many lines in the current file matched the pattern (naming the @@ -14407,7 +14614,7 @@ parameter, but that we're not interested in its value): fcount = 0 } - The `endfile' function is called after each file has been processed. +The `endfile' function is called after each file has been processed. It affects the output only when the user wants a count of the number of lines that matched. `no_print' is true only if the exit status is desired. `count_only' is true if line counts are desired. `egrep' @@ -14423,20 +14630,20 @@ total number of lines that matched the pattern: print file ":" fcount else print fcount - + total += fcount } - The following rule does most of the work of matching lines. The -variable `matches' is true if the line matched the pattern. If the user -wants lines that did not match, the sense of `matches' is inverted -using the `!' operator. `fcount' is incremented with the value of -`matches', which is either one or zero, depending upon a successful or +The following rule does most of the work of matching lines. The variable +`matches' is true if the line matched the pattern. If the user wants +lines that did not match, the sense of `matches' is inverted using the +`!' operator. `fcount' is incremented with the value of `matches', +which is either one or zero, depending upon a successful or unsuccessful match. If the line does not match, the `next' statement just moves on to the next record. - A number of additional tests are made, but they are only done if we -are not counting lines. First, if the user only wants exit status +A number of additional tests are made, but they are only done if we are +not counting lines. First, if the user only wants exit status (`no_print' is true), then it is enough to know that _one_ line in this file matched, and we can skip on to the next file with `nextfile'. Similarly, if we are only printing file names, we can print the file @@ -14447,21 +14654,21 @@ line is printed, with a leading file name and colon if necessary: matches = ($0 ~ pattern) if (invert) matches = ! matches - + fcount += matches # 1 or 0 - + if (! matches) next - + if (! count_only) { if (no_print) nextfile - + if (filenames_only) { print FILENAME nextfile } - + if (do_filenames) print FILENAME ":" $0 else @@ -14469,7 +14676,7 @@ line is printed, with a leading file name and colon if necessary: } } - The `END' rule takes care of producing the correct exit status. If +The `END' rule takes care of producing the correct exit status. If there are no matches, the exit status is one; otherwise it is zero: END \ @@ -14479,8 +14686,8 @@ there are no matches, the exit status is one; otherwise it is zero: exit 0 } - The `usage' function prints a usage message in case of invalid -options, and then exits: +The `usage' function prints a usage message in case of invalid options, +and then exits: function usage( e) { @@ -14490,28 +14697,28 @@ options, and then exits: exit 1 } - The variable `e' is used so that the function fits nicely on the +The variable `e' is used so that the function fits nicely on the printed page. - Just a note on programming style: you may have noticed that the `END' +Just a note on programming style: you may have noticed that the `END' rule uses backslash continuation, with the open brace on a line by itself. This is so that it more closely resembles the way functions are written. Many of the examples in this major node use this style. You can decide for yourself if you like writing your `BEGIN' and `END' rules this way or not. - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) It also introduces a subtle bug; if a match happens, we output -the translated line, not the original. +(1) It also introduces a subtle bug; if a match happens, we output the +translated line, not the original.  File: gawk.info, Node: Id Program, Next: Split Program, Prev: Egrep Program, Up: Clones -Printing out User Information ------------------------------ +13.2.3 Printing out User Information +------------------------------------ - The `id' utility lists a user's real and effective user ID numbers, +The `id' utility lists a user's real and effective user ID numbers, real and effective group ID numbers, and the user's group set, if any. `id' only prints the effective user ID and group ID if they are different from the real ones. If possible, `id' also supplies the @@ -14520,15 +14727,15 @@ corresponding user and group names. The output might look like this: $ id -| uid=2076(arnold) gid=10(staff) groups=10(staff),4(tty) - This information is part of what is provided by `gawk''s `PROCINFO' +This information is part of what is provided by `gawk''s `PROCINFO' array (*note Built-in Variables::). However, the `id' utility provides a more palatable output than just individual numbers. - Here is a simple version of `id' written in `awk'. It uses the user +Here is a simple version of `id' written in `awk'. It uses the user database library functions (*note Passwd Functions::) and the group database library functions (*note Group Functions::): - The program is fairly straightforward. All the work is done in the +The program is fairly straightforward. All the work is done in the `BEGIN' rule. The user and group ID numbers are obtained from `PROCINFO'. The code is repetitive. The entry in the user database for the real user ID number is split into parts at the `:'. The name is @@ -14541,21 +14748,21 @@ and the group numbers: # output is: # uid=12(foo) euid=34(bar) gid=3(baz) \ # egid=5(blat) groups=9(nine),2(two),1(one) - + BEGIN \ { uid = PROCINFO["uid"] euid = PROCINFO["euid"] gid = PROCINFO["gid"] egid = PROCINFO["egid"] - + printf("uid=%d", uid) pw = getpwuid(uid) if (pw != "") { split(pw, a, ":") printf("(%s)", a[1]) } - + if (euid != uid) { printf(" euid=%d", euid) pw = getpwuid(euid) @@ -14564,14 +14771,14 @@ and the group numbers: printf("(%s)", a[1]) } } - + printf(" gid=%d", gid) pw = getgrgid(gid) if (pw != "") { split(pw, a, ":") printf("(%s)", a[1]) } - + if (egid != gid) { printf(" egid=%d", egid) pw = getgrgid(egid) @@ -14580,7 +14787,7 @@ and the group numbers: printf("(%s)", a[1]) } } - + for (i = 1; ("group" i) in PROCINFO; i++) { if (i == 1) printf(" groups=") @@ -14594,36 +14801,36 @@ and the group numbers: if (("group" (i+1)) in PROCINFO) printf(",") } - + print "" } - The test in the `for' loop is worth noting. Any supplementary -groups in the `PROCINFO' array have the indices `"group1"' through -`"groupN"' for some N, i.e., the total number of supplementary groups. -However, we don't know in advance how many of these groups there are. +The test in the `for' loop is worth noting. Any supplementary groups +in the `PROCINFO' array have the indices `"group1"' through `"groupN"' +for some N, i.e., the total number of supplementary groups. However, +we don't know in advance how many of these groups there are. - This loop works by starting at one, concatenating the value with +This loop works by starting at one, concatenating the value with `"group"', and then using `in' to see if that value is in the array. Eventually, `i' is incremented past the last group in the array and the loop exits. - The loop is also correct if there are _no_ supplementary groups; -then the condition is false the first time it's tested, and the loop -body never executes. +The loop is also correct if there are _no_ supplementary groups; then +the condition is false the first time it's tested, and the loop body +never executes.  File: gawk.info, Node: Split Program, Next: Tee Program, Prev: Id Program, Up: Clones -Splitting a Large File into Pieces ----------------------------------- +13.2.4 Splitting a Large File into Pieces +----------------------------------------- - The `split' program splits large text files into smaller pieces. -Usage is as follows: +The `split' program splits large text files into smaller pieces. Usage +is as follows: split [-COUNT] file [ PREFIX ] - By default, the output files are named `xaa', `xab', and so on. Each +By default, the output files are named `xaa', `xab', and so on. Each file has 1000 lines in it, with the likely exception of the last file. To change the number of lines in each file, supply a number on the command line preceded with a minus; e.g., `-500' for files with 500 @@ -14631,13 +14838,13 @@ lines in them instead of 1000. To change the name of the output files to something like `myfileaa', `myfileab', and so on, supply an additional argument that specifies the file name prefix. - Here is a version of `split' in `awk'. It uses the `ord' and `chr' +Here is a version of `split' in `awk'. It uses the `ord' and `chr' functions presented in *Note Ordinal Functions::. - The program first sets its defaults, and then tests to make sure -there are not too many arguments. It then looks at each argument in -turn. The first argument could be a minus sign followed by a number. -If it is, this happens to look like a negative number, so it is made +The program first sets its defaults, and then tests to make sure there +are not too many arguments. It then looks at each argument in turn. +The first argument could be a minus sign followed by a number. If it +is, this happens to look like a negative number, so it is made positive, and that is the count of lines. The data file name is skipped over and the final argument is used as the prefix for the output file names: @@ -14646,13 +14853,13 @@ output file names: # # Requires ord and chr library functions # usage: split [-num] [file] [outname] - + BEGIN { outfile = "x" # default count = 1000 if (ARGC > 4) usage() - + i = 1 if (ARGV[i] ~ /^-[0-9]+$/) { count = -ARGV[i] @@ -14666,18 +14873,17 @@ output file names: outfile = ARGV[i] ARGV[i] = "" } - + s1 = s2 = "a" out = (outfile s1 s2) } - The next rule does most of the work. `tcount' (temporary count) -tracks how many lines have been printed to the output file so far. If -it is greater than `count', it is time to close the current file and -start a new one. `s1' and `s2' track the current suffixes for the file -name. If they are both `z', the file is just too big. Otherwise, `s1' -moves to the next letter in the alphabet and `s2' starts over again at -`a': +The next rule does most of the work. `tcount' (temporary count) tracks +how many lines have been printed to the output file so far. If it is +greater than `count', it is time to close the current file and start a +new one. `s1' and `s2' track the current suffixes for the file name. If +they are both `z', the file is just too big. Otherwise, `s1' moves to +the next letter in the alphabet and `s2' starts over again at `a': { if (++tcount > count) { @@ -14710,33 +14916,33 @@ The `usage' function simply prints an error message and exits: The variable `e' is used so that the function fits nicely on the screen. - This program is a bit sloppy; it relies on `awk' to automatically -close the last file instead of doing it in an `END' rule. It also -assumes that letters are contiguous in the character set, which isn't -true for EBCDIC systems. +This program is a bit sloppy; it relies on `awk' to automatically close +the last file instead of doing it in an `END' rule. It also assumes +that letters are contiguous in the character set, which isn't true for +EBCDIC systems.  File: gawk.info, Node: Tee Program, Next: Uniq Program, Prev: Split Program, Up: Clones -Duplicating Output into Multiple Files --------------------------------------- +13.2.5 Duplicating Output into Multiple Files +--------------------------------------------- - The `tee' program is known as a "pipe fitting." `tee' copies its +The `tee' program is known as a "pipe fitting." `tee' copies its standard input to its standard output and also duplicates it to the files named on the command line. Its usage is as follows: tee [-a] file ... - The `-a' option tells `tee' to append to the named files, instead of +The `-a' option tells `tee' to append to the named files, instead of truncating them and starting over. - The `BEGIN' rule first makes a copy of all the command-line arguments +The `BEGIN' rule first makes a copy of all the command-line arguments into an array named `copy'. `ARGV[0]' is not copied, since it is not needed. `tee' cannot use `ARGV' directly, since `awk' attempts to process each file name in `ARGV' as input data. - If the first argument is `-a', then the flag variable `append' is -set to true, and both `ARGV[1]' and `copy[1]' are deleted. If `ARGC' is +If the first argument is `-a', then the flag variable `append' is set +to true, and both `ARGV[1]' and `copy[1]' are deleted. If `ARGC' is less than two, then no file names were supplied and `tee' prints a usage message and exits. Finally, `awk' is forced to read the standard input by setting `ARGV[1]' to `"-"' and `ARGC' to two: @@ -14746,7 +14952,7 @@ input by setting `ARGV[1]' to `"-"' and `ARGC' to two: { for (i = 1; i < ARGC; i++) copy[i] = ARGV[i] - + if (ARGV[1] == "-a") { append = 1 delete ARGV[1] @@ -14761,7 +14967,7 @@ input by setting `ARGV[1]' to `"-"' and `ARGC' to two: ARGC = 2 } - The single rule does all the work. Since there is no pattern, it is +The single rule does all the work. Since there is no pattern, it is executed for each line of input. The body of the rule simply prints the line into each file on the command line, and then to the standard output: @@ -14791,7 +14997,7 @@ body, the `if' is only tested once for each input record. If there are N input records and M output files, the first method only executes N `if' statements, while the second executes N`*'M `if' statements. - Finally, the `END' rule cleans up by closing all the output files: +Finally, the `END' rule cleans up by closing all the output files: END \ { @@ -14802,17 +15008,17 @@ N input records and M output files, the first method only executes N  File: gawk.info, Node: Uniq Program, Next: Wc Program, Prev: Tee Program, Up: Clones -Printing Nonduplicated Lines of Text ------------------------------------- +13.2.6 Printing Nonduplicated Lines of Text +------------------------------------------- - The `uniq' utility reads sorted lines of data on its standard input, +The `uniq' utility reads sorted lines of data on its standard input, and by default removes duplicate lines. In other words, it only prints unique lines--hence the name. `uniq' has a number of options. The usage is as follows: uniq [-udc [-N]] [+N] [ INPUT FILE [ OUTPUT FILE ]] - The options for `uniq' are: +The options for `uniq' are: `-d' Pnly print only repeated lines. @@ -14841,14 +15047,14 @@ usage is as follows: The generated output is sent to the named output file, instead of to the standard output. - Normally `uniq' behaves as if both the `-d' and `-u' options are +Normally `uniq' behaves as if both the `-d' and `-u' options are provided. - `uniq' uses the `getopt' library function (*note Getopt Function::) -and the `join' library function (*note Join Function::). +`uniq' uses the `getopt' library function (*note Getopt Function::) and +the `join' library function (*note Join Function::). - The program begins with a `usage' function and then a brief outline -of the options and their meanings in a comment. The `BEGIN' rule deals +The program begins with a `usage' function and then a brief outline of +the options and their meanings in a comment. The `BEGIN' rule deals with the command-line arguments and options. It uses a trick to get `getopt' to handle options of the form `-25', treating such an option as the option letter `2' with an argument of `5'. If indeed two or more @@ -14859,7 +15065,7 @@ then `Optarg' is not needed. In this case, `Optind' must be decremented so that `getopt' processes it next time. This code is admittedly a bit tricky. - If no options are supplied, then the default is taken, to print both +If no options are supplied, then the default is taken, to print both repeated and nonrepeated lines. The output file, if provided, is assigned to `outputfile'. Early on, `outputfile' is initialized to the standard output, `/dev/stdout': @@ -14873,13 +15079,13 @@ standard output, `/dev/stdout': print e > "/dev/stderr" exit 1 } - + # -c count lines. overrides -d and -u # -d only repeated lines # -u only non-repeated lines # -n skip n fields # +n skip n characters, skip fields first - + BEGIN \ { count = 1 @@ -14904,26 +15110,26 @@ standard output, `/dev/stdout': } else usage() } - + if (ARGV[Optind] ~ /^\+[0-9]+$/) { charcount = substr(ARGV[Optind], 2) + 0 Optind++ } - + for (i = 1; i < Optind; i++) ARGV[i] = "" - + if (repeated_only == 0 && non_repeated_only == 0) repeated_only = non_repeated_only = 1 - + if (ARGC - Optind == 2) { outputfile = ARGV[ARGC - 1] ARGV[ARGC - 1] = "" } } - The following function, `are_equal', compares the current line, -`$0', to the previous line, `last'. It handles skipping fields and +The following function, `are_equal', compares the current line, `$0', +to the previous line, `last'. It handles skipping fields and characters. If no field count and no character count are specified, `are_equal' simply returns one or zero depending upon the result of a simple string comparison of `last' and `$0'. Otherwise, things get more @@ -14940,7 +15146,7 @@ and `are_equal' returns the result: { if (fcount == 0 && charcount == 0) return (last == $0) - + if (fcount > 0) { n = split(last, alast) m = split($0, aline) @@ -14954,38 +15160,37 @@ and `are_equal' returns the result: clast = substr(clast, charcount + 1) cline = substr(cline, charcount + 1) } - + return (clast == cline) } - The following two rules are the body of the program. The first one -is executed only for the very first line of data. It sets `last' equal -to `$0', so that subsequent lines of text have something to be compared -to. +The following two rules are the body of the program. The first one is +executed only for the very first line of data. It sets `last' equal to +`$0', so that subsequent lines of text have something to be compared to. - The second rule does the work. The variable `equal' is one or zero, +The second rule does the work. The variable `equal' is one or zero, depending upon the results of `are_equal''s comparison. If `uniq' is counting repeated lines, and the lines are equal, then it increments the `count' variable. Otherwise, it prints the line and resets `count', since the two lines are not equal. - If `uniq' is not counting, and if the lines are equal, `count' is +If `uniq' is not counting, and if the lines are equal, `count' is incremented. Nothing is printed, since the point is to remove duplicates. Otherwise, if `uniq' is counting repeated lines and more than one line is seen, or if `uniq' is counting nonrepeated lines and only one line is seen, then the line is printed, and `count' is reset. - Finally, similar logic is used in the `END' rule to print the final +Finally, similar logic is used in the `END' rule to print the final line of input data: NR == 1 { last = $0 next } - + { equal = are_equal() - + if (do_count) { # overrides -d and -u if (equal) count++ @@ -14996,7 +15201,7 @@ line of input data: } next } - + if (equal) count++ else { @@ -15007,7 +15212,7 @@ line of input data: count = 1 } } - + END { if (do_count) printf("%4d %s\n", count, last) > outputfile @@ -15019,18 +15224,18 @@ line of input data:  File: gawk.info, Node: Wc Program, Prev: Uniq Program, Up: Clones -Counting Things ---------------- +13.2.7 Counting Things +---------------------- - The `wc' (word count) utility counts lines, words, and characters in +The `wc' (word count) utility counts lines, words, and characters in one or more input files. Its usage is as follows: wc [-lwc] [ FILES ... ] - If no files are specified on the command line, `wc' reads its -standard input. If there are multiple files, it also prints total -counts for all the files. The options and their meanings are shown in -the following list: +If no files are specified on the command line, `wc' reads its standard +input. If there are multiple files, it also prints total counts for all +the files. The options and their meanings are shown in the following +list: `-l' Count only lines. @@ -15044,25 +15249,25 @@ the following list: `-c' Count only characters. - Implementing `wc' in `awk' is particularly elegant, since `awk' does -a lot of the work for us; it splits lines into words (i.e., fields) and +Implementing `wc' in `awk' is particularly elegant, since `awk' does a +lot of the work for us; it splits lines into words (i.e., fields) and counts them, it counts lines (i.e., records), and it can easily tell us how long a line is. - This uses the `getopt' library function (*note Getopt Function::) -and the file-transition functions (*note Filetrans Function::). +This uses the `getopt' library function (*note Getopt Function::) and +the file-transition functions (*note Filetrans Function::). - This version has one notable difference from traditional versions of +This version has one notable difference from traditional versions of `wc': it always prints the counts in the order lines, words, and characters. Traditional versions note the order of the `-l', `-w', and `-c' options on the command line, and print the counts in that order. - The `BEGIN' rule does the argument processing. The variable +The `BEGIN' rule does the argument processing. The variable `print_total' is true if more than one file is named on the command line: # wc.awk --- count lines, words, characters - + # Options: # -l only count lines # -w only count words @@ -15071,7 +15276,7 @@ line: # Default is to count lines, words, characters # # Requires getopt and file transition library functions - + BEGIN { # let getopt print a message about # invalid options. we ignore them @@ -15085,16 +15290,16 @@ line: } for (i = 1; i < Optind; i++) ARGV[i] = "" - + # if no options, do all if (! do_lines && ! do_words && ! do_chars) do_lines = do_words = do_chars = 1 - + print_total = (ARGC - i > 2) } - The `beginfile' function is simple; it just resets the counts of -lines, words, and characters to zero, and saves the current file name in +The `beginfile' function is simple; it just resets the counts of lines, +words, and characters to zero, and saves the current file name in `fname': function beginfile(file) @@ -15103,7 +15308,7 @@ lines, words, and characters to zero, and saves the current file name in fname = FILENAME } - The `endfile' function adds the current file's numbers to the running +The `endfile' function adds the current file's numbers to the running totals of lines, words, and characters.(1) It then prints out those numbers for the file that was just read. It relies on `beginfile' to reset the numbers for the following data file: @@ -15122,10 +15327,10 @@ reset the numbers for the following data file: printf "\t%s\n", fname } - There is one rule that is executed for each line. It adds the length -of the record, plus one, to `chars'. Adding one plus the record length -is needed because the newline character separating records (the value -of `RS') is not part of the record itself, and thus not included in its +There is one rule that is executed for each line. It adds the length of +the record, plus one, to `chars'. Adding one plus the record length is +needed because the newline character separating records (the value of +`RS') is not part of the record itself, and thus not included in its length. Next, `lines' is incremented for each line read, and `words' is incremented by the value of `NF', which is the number of "words" on this line: @@ -15137,7 +15342,7 @@ this line: words += NF } - Finally, the `END' rule simply prints the totals for all the files: +Finally, the `END' rule simply prints the totals for all the files: END { if (print_total) { @@ -15151,19 +15356,19 @@ this line: } } - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) `wc' can't just use the value of `FNR' in `endfile'. If you -examine the code in *Note Filetrans Function:: you will see that `FNR' -has already been reset by the time `endfile' is called. +(1) `wc' can't just use the value of `FNR' in `endfile'. If you examine +the code in *Note Filetrans Function::, you will see that `FNR' has +already been reset by the time `endfile' is called.  File: gawk.info, Node: Miscellaneous Programs, Prev: Clones, Up: Sample Programs -A Grab Bag of `awk' Programs -============================ +13.3 A Grab Bag of `awk' Programs +================================= - This minor node is a large "grab bag" of miscellaneous programs. We +This minor node is a large "grab bag" of miscellaneous programs. We hope you find them both interesting and enjoyable. * Menu: @@ -15184,22 +15389,22 @@ hope you find them both interesting and enjoyable.  File: gawk.info, Node: Dupword Program, Next: Alarm Program, Up: Miscellaneous Programs -Finding Duplicated Words in a Document --------------------------------------- +13.3.1 Finding Duplicated Words in a Document +--------------------------------------------- - A common error when writing large amounts of prose is to accidentally +A common error when writing large amounts of prose is to accidentally duplicate words. Typically you will see this in text as something like "the the program does the following..." When the text is online, often the duplicated words occur at the end of one line and the beginning of another, making them very difficult to spot. - This program, `dupword.awk', scans through a file one line at a time +This program, `dupword.awk', scans through a file one line at a time and looks for adjacent occurrences of the same word. It also saves the last word on a line (in the variable `prev') for comparison with the first word on the next line. - The first two statements make sure that the line is all lowercase, -so that, for example, "The" and "the" compare equal to each other. The +The first two statements make sure that the line is all lowercase, so +that, for example, "The" and "the" compare equal to each other. The next statement replaces nonalphanumeric and nonwhitespace characters with spaces, so that punctuation does not affect the comparison either. The characters are replaced with spaces so that formatting controls @@ -15208,7 +15413,7 @@ don't create nonsense words (e.g., the Texinfo `@code{NF}' becomes into fields, yielding just the actual words on the line, and ensuring that there are no empty fields. - If there are no fields left after removing all the punctuation, the +If there are no fields left after removing all the punctuation, the current record is skipped. Otherwise, the program loops through each word, comparing it to the previous one: @@ -15232,22 +15437,22 @@ word, comparing it to the previous one:  File: gawk.info, Node: Alarm Program, Next: Translate Program, Prev: Dupword Program, Up: Miscellaneous Programs -An Alarm Clock Program ----------------------- +13.3.2 An Alarm Clock Program +----------------------------- Nothing cures insomnia like a ringing alarm clock. Arnold Robbins - The following program is a simple "alarm clock" program. You give -it a time of day and an optional message. At the specified time, it -prints the message on the standard output. In addition, you can give it -the number of times to repeat the message as well as a delay between +The following program is a simple "alarm clock" program. You give it a +time of day and an optional message. At the specified time, it prints +the message on the standard output. In addition, you can give it the +number of times to repeat the message as well as a delay between repetitions. - This program uses the `gettimeofday' function from *Note -Gettimeofday Function::. +This program uses the `gettimeofday' function from *Note Gettimeofday +Function::. - All the work is done in the `BEGIN' rule. The first part is argument +All the work is done in the `BEGIN' rule. The first part is argument checking and setting of defaults: the delay, the count, and the message to print. If the user supplied a message without the ASCII BEL character (known as the "alert" character, `"\a"'), then it is added to @@ -15260,13 +15465,13 @@ Here is the program: # # Requires gettimeofday library function # usage: alarm time [ "message" [ count [ delay ] ] ] - + BEGIN \ { # Initial argument sanity checking usage1 = "usage: alarm time ['message' [count [delay]]]" usage2 = sprintf("\t(%s) time ::= hh:mm", ARGV[1]) - + if (ARGC < 2) { print usage1 > "/dev/stderr" print usage2 > "/dev/stderr" @@ -15285,7 +15490,7 @@ Here is the program: print usage2 > "/dev/stderr" exit 1 } - + # set defaults for once we reach the desired time if (delay == 0) delay = 180 # 3 minutes @@ -15296,34 +15501,33 @@ Here is the program: else if (index(message, "\a") == 0) message = "\a" message "\a" - The next minor node of code turns the alarm time into hours and -minutes, converts it (if necessary) to a 24-hour clock, and then turns -that time into a count of the seconds since midnight. Next it turns -the current time into a count of seconds since midnight. The -difference between the two is how long to wait before setting off the -alarm: +The next minor node of code turns the alarm time into hours and minutes, +converts it (if necessary) to a 24-hour clock, and then turns that time +into a count of the seconds since midnight. Next it turns the current +time into a count of seconds since midnight. The difference between +the two is how long to wait before setting off the alarm: # split up alarm time split(ARGV[1], atime, ":") hour = atime[1] + 0 # force numeric minute = atime[2] + 0 # force numeric - + # get current broken down time gettimeofday(now) - + # if time given is 12-hour hours and it's after that # hour, e.g., `alarm 5:30' at 9 a.m. means 5:30 p.m., # then add 12 to real hour if (hour < 12 && now["hour"] > hour) hour += 12 - + # set target time in seconds since midnight target = (hour * 60 * 60) + (minute * 60) - + # get current time in seconds since midnight current = (now["hour"] * 60 * 60) + \ (now["minute"] * 60) + now["second"] - + # how long to sleep for naptime = target - current if (naptime <= 0) { @@ -15331,18 +15535,17 @@ alarm: exit 1 } - Finally, the program uses the `system' function (*note I/O -Functions::) to call the `sleep' utility. The `sleep' utility simply -pauses for the given number of seconds. If the exit status is not zero, -the program assumes that `sleep' was interrupted and exits. If `sleep' -exited with an OK status (zero), then the program prints the message in -a loop, again using `sleep' to delay for however many seconds are -necessary: +Finally, the program uses the `system' function (*note I/O Functions::) +to call the `sleep' utility. The `sleep' utility simply pauses for the +given number of seconds. If the exit status is not zero, the program +assumes that `sleep' was interrupted and exits. If `sleep' exited with +an OK status (zero), then the program prints the message in a loop, +again using `sleep' to delay for however many seconds are necessary: # zzzzzz..... go away if interrupted if (system(sprintf("sleep %d", naptime)) != 0) exit 1 - + # time to notify! command = sprintf("sleep %d", delay) for (i = 1; i <= count; i++) { @@ -15351,37 +15554,37 @@ necessary: if (system(command) != 0) break } - + exit 0 }  File: gawk.info, Node: Translate Program, Next: Labels Program, Prev: Alarm Program, Up: Miscellaneous Programs -Transliterating Characters --------------------------- +13.3.3 Transliterating Characters +--------------------------------- - The system `tr' utility transliterates characters. For example, it -is often used to map uppercase letters into lowercase for further +The system `tr' utility transliterates characters. For example, it is +often used to map uppercase letters into lowercase for further processing: GENERATE DATA | tr 'A-Z' 'a-z' | PROCESS DATA ... - `tr' requires two lists of characters.(1) When processing the -input, the first character in the first list is replaced with the first +`tr' requires two lists of characters.(1) When processing the input, +the first character in the first list is replaced with the first character in the second list, the second character in the first list is replaced with the second character in the second list, and so on. If there are more characters in the "from" list than in the "to" list, the last character of the "to" list is used for the remaining characters in the "from" list. - Some time ago, a user proposed that a transliteration function should +Some time ago, a user proposed that a transliteration function should be added to `gawk'. The following program was written to prove that character transliteration could be done with a user-level function. This program is not as complete as the system `tr' utility but it does most of the job. - The `translate' program demonstrates one of the few weaknesses of +The `translate' program demonstrates one of the few weaknesses of standard `awk': dealing with individual characters is very painful, requiring repeated use of the `substr', `index', and `gsub' built-in functions (*note String Functions::).(2) There are two functions. The @@ -15396,25 +15599,24 @@ first, `stranslate', takes three arguments: `target' The string on which to do the translation. - Associative arrays make the translation part fairly easy. `t_ar' -holds the "to" characters, indexed by the "from" characters. Then a -simple loop goes through `from', one character at a time. For each -character in `from', if the character appears in `target', `gsub' is -used to change it to the corresponding `to' character. +Associative arrays make the translation part fairly easy. `t_ar' holds +the "to" characters, indexed by the "from" characters. Then a simple +loop goes through `from', one character at a time. For each character +in `from', if the character appears in `target', `gsub' is used to +change it to the corresponding `to' character. - The `translate' function simply calls `stranslate' using `$0' as the +The `translate' function simply calls `stranslate' using `$0' as the target. The main program sets two global variables, `FROM' and `TO', from the command line, and then changes `ARGV' so that `awk' reads from the standard input. - Finally, the processing rule simply calls `translate' for each -record: +Finally, the processing rule simply calls `translate' for each record: # translate.awk --- do tr-like stuff # Bugs: does not handle things like: tr A-Z a-z, it has # to be spelled out. However, if `to' is shorter than `from', # the last character in `to' is used for the rest of `from'. - + function stranslate(from, to, target, lf, lt, t_ar, i, c) { lf = length(from) @@ -15431,12 +15633,12 @@ record: } return target } - + function translate(from, to) { return $0 = stranslate(from, to, $0) } - + # main program BEGIN { if (ARGC < 3) { @@ -15448,13 +15650,13 @@ record: ARGC = 2 ARGV[1] = "-" } - + { translate(FROM, TO) print } - While it is possible to do character transliteration in a user-level +While it is possible to do character transliteration in a user-level function, it is not necessarily efficient, and we (the `gawk' authors) started to consider adding a built-in function. However, shortly after writing this program, we learned that the System V Release 4 `awk' had @@ -15463,52 +15665,52 @@ These functions handle the vast majority of the cases where character transliteration is necessary, and so we chose to simply add those functions to `gawk' as well and then leave well enough alone. - An obvious improvement to this program would be to set up the `t_ar' +An obvious improvement to this program would be to set up the `t_ar' array only once, in a `BEGIN' rule. However, this assumes that the "from" and "to" lists will never change throughout the lifetime of the program. - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) On some older System V systems, `tr' may require that the lists -be written as range expressions enclosed in square brackets (`[a-z]') -and quoted, to prevent the shell from attempting a file name expansion. +(1) On some older System V systems, `tr' may require that the lists be +written as range expressions enclosed in square brackets (`[a-z]') and +quoted, to prevent the shell from attempting a file name expansion. This is not a feature. - (2) This program was written before `gawk' acquired the ability to +(2) This program was written before `gawk' acquired the ability to split each character in a string into separate array elements.  File: gawk.info, Node: Labels Program, Next: Word Sorting, Prev: Translate Program, Up: Miscellaneous Programs -Printing Mailing Labels ------------------------ +13.3.4 Printing Mailing Labels +------------------------------ - Here is a "real world"(1) program. This script reads lists of names -and addresses and generates mailing labels. Each page of labels has 20 +Here is a "real world"(1) program. This script reads lists of names and +addresses and generates mailing labels. Each page of labels has 20 labels on it, 2 across and 10 down. The addresses are guaranteed to be no more than 5 lines of data. Each address is separated from the next by a blank line. - The basic idea is to read 20 labels worth of data. Each line of -each label is stored in the `line' array. The single rule takes care -of filling the `line' array and printing the page when 20 labels have -been read. +The basic idea is to read 20 labels worth of data. Each line of each +label is stored in the `line' array. The single rule takes care of +filling the `line' array and printing the page when 20 labels have been +read. - The `BEGIN' rule simply sets `RS' to the empty string, so that `awk' +The `BEGIN' rule simply sets `RS' to the empty string, so that `awk' splits records at blank lines (*note Records::). It sets `MAXLINES' to 100, since 100 is the maximum number of lines on the page (20 * 5 = 100). - Most of the work is done in the `printpage' function. The label -lines are stored sequentially in the `line' array. But they have to -print horizontally; `line[1]' next to `line[6]', `line[2]' next to -`line[7]', and so on. Two loops are used to accomplish this. The -outer loop, controlled by `i', steps through every 10 lines of data; -this is each row of labels. The inner loop, controlled by `j', goes -through the lines within the row. As `j' goes from 0 to 4, `i+j' is -the `j'-th line in the row, and `i+j+5' is the entry next to it. The -output ends up looking something like this: +Most of the work is done in the `printpage' function. The label lines +are stored sequentially in the `line' array. But they have to print +horizontally; `line[1]' next to `line[6]', `line[2]' next to `line[7]', +and so on. Two loops are used to accomplish this. The outer loop, +controlled by `i', steps through every 10 lines of data; this is each +row of labels. The inner loop, controlled by `j', goes through the +lines within the row. As `j' goes from 0 to 4, `i+j' is the `j'-th +line in the row, and `i+j+5' is the entry next to it. The output ends +up looking something like this: line 1 line 6 line 2 line 7 @@ -15517,30 +15719,30 @@ output ends up looking something like this: line 5 line 10 ... - As a final note, an extra blank line is printed at lines 21 and 61, -to keep the output lined up on the labels. This is dependent on the +As a final note, an extra blank line is printed at lines 21 and 61, to +keep the output lined up on the labels. This is dependent on the particular brand of labels in use when the program was written. You will also note that there are 2 blank lines at the top and 2 blank lines at the bottom. - The `END' rule arranges to flush the final page of labels; there may +The `END' rule arranges to flush the final page of labels; there may not have been an even multiple of 20 labels in the data: # labels.awk --- print mailing labels - + # Each label is 5 lines of data that may have blank lines. # The label sheets have 2 blank lines at the top and 2 at # the bottom. - + BEGIN { RS = "" ; MAXLINES = 100 } - + function printpage( i, j) { if (Nlines <= 0) return - + printf "\n\n" # header - + for (i = 1; i <= Nlines; i += 10) { if (i == 21 || i == 61) print "" @@ -15551,13 +15753,13 @@ not have been an even multiple of 20 labels in the data: } print "" } - + printf "\n\n" # footer - + for (i in line) line[i] = "" } - + # main rule { if (Count >= 20) { @@ -15572,24 +15774,24 @@ not have been an even multiple of 20 labels in the data: line[++Nlines] = "" Count++ } - + END \ { printpage() } - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) "Real world" is defined as "a program actually used to get +(1) "Real world" is defined as "a program actually used to get something done."  File: gawk.info, Node: Word Sorting, Next: History Sorting, Prev: Labels Program, Up: Miscellaneous Programs -Generating Word-Usage Counts ----------------------------- +13.3.5 Generating Word-Usage Counts +----------------------------------- - The following `awk' program prints the number of occurrences of each +The following `awk' program prints the number of occurrences of each word in its input. It illustrates the associative nature of `awk' arrays by using strings as subscripts. It also demonstrates the `for INDEX in ARRAY' mechanism. Finally, it shows how `awk' is used in @@ -15602,13 +15804,13 @@ program listing: for (i = 1; i <= NF; i++) freq[$i]++ } - + END { for (word in freq) printf "%s\t%d\n", word, freq[word] } - This program has two rules. The first rule, because it has an empty +This program has two rules. The first rule, because it has an empty pattern, is executed for every input line. It uses `awk''s field-accessing mechanism (*note Fields::) to pick out the individual words from the line, and the built-in variable `NF' (*note Built-in @@ -15616,7 +15818,7 @@ Variables::) to know how many fields are available. For each input word, it increments an element of the array `freq' to reflect that the word has been seen an additional time. - The second rule, because it has the pattern `END', is not executed +The second rule, because it has the pattern `END', is not executed until the input has been exhausted. It prints out the contents of the `freq' table that has been built up inside the first action. This program has several problems that would prevent it from being useful by @@ -15637,14 +15839,14 @@ itself on real text files: likely to be interested in which words occur most frequently or in having an alphabetized table of how frequently each word occurs. - The way to solve these problems is to use some of `awk''s more -advanced features. First, we use `tolower' to remove case -distinctions. Next, we use `gsub' to remove punctuation characters. -Finally, we use the system `sort' utility to process the output of the -`awk' script. Here is the new version of the program: +The way to solve these problems is to use some of `awk''s more advanced +features. First, we use `tolower' to remove case distinctions. Next, +we use `gsub' to remove punctuation characters. Finally, we use the +system `sort' utility to process the output of the `awk' script. Here +is the new version of the program: # wordfreq.awk --- print list of word frequencies - + { $0 = tolower($0) # remove case distinctions # remove punctuation @@ -15652,14 +15854,14 @@ Finally, we use the system `sort' utility to process the output of the for (i = 1; i <= NF; i++) freq[$i]++ } - + END { for (word in freq) printf "%s\t%d\n", word, freq[word] } - Assuming we have saved this program in a file named `wordfreq.awk', -and that the data is in `file1', the following pipeline: +Assuming we have saved this program in a file named `wordfreq.awk', and +that the data is in `file1', the following pipeline: awk -f wordfreq.awk file1 | sort -k 2nr @@ -15667,15 +15869,15 @@ produces a table of the words appearing in `file1' in order of decreasing frequency. The `awk' program suitably massages the data and produces a word frequency table, which is not ordered. - The `awk' script's output is then sorted by the `sort' utility and +The `awk' script's output is then sorted by the `sort' utility and printed on the terminal. The options given to `sort' specify a sort that uses the second field of each input line (skipping one field), that the sort keys should be treated as numeric quantities (otherwise `15' would come before `5'), and that the sorting should be done in descending (reverse) order. - The `sort' could even be done from within the program, by changing -the `END' action to: +The `sort' could even be done from within the program, by changing the +`END' action to: END { sort = "sort -k 2nr" @@ -15684,29 +15886,29 @@ the `END' action to: close(sort) } - This way of sorting must be used on systems that do not have true -pipes at the command-line (or batch-file) level. See the general -operating system documentation for more information on how to use the -`sort' program. +This way of sorting must be used on systems that do not have true pipes +at the command-line (or batch-file) level. See the general operating +system documentation for more information on how to use the `sort' +program.  File: gawk.info, Node: History Sorting, Next: Extract Program, Prev: Word Sorting, Up: Miscellaneous Programs -Removing Duplicates from Unsorted Text --------------------------------------- +13.3.6 Removing Duplicates from Unsorted Text +--------------------------------------------- - The `uniq' program (*note Uniq Program::), removes duplicate lines -from _sorted_ data. +The `uniq' program (*note Uniq Program::), removes duplicate lines from +_sorted_ data. - Suppose, however, you need to remove duplicate lines from a data -file but that you want to preserve the order the lines are in. A good +Suppose, however, you need to remove duplicate lines from a data file +but that you want to preserve the order the lines are in. A good example of this might be a shell history file. The history file keeps a copy of all the commands you have entered, and it is not unusual to repeat a command several times in a row. Occasionally you might want to compact the history by removing duplicate entries. Yet it is desirable to maintain the order of the original commands. - This simple program does the job. It uses two arrays. The `data' +This simple program does the job. It uses two arrays. The `data' array is indexed by the text of each line. For each line, `data[$0]' is incremented. If a particular line has not been seen before, then `data[$0]' is zero. In this case, the text of the line is stored in @@ -15720,40 +15922,39 @@ encountered. The `END' rule simply prints out the lines, in order: if (data[$0]++ == 0) lines[++count] = $0 } - + END { for (i = 1; i <= count; i++) print lines[i] } - This program also provides a foundation for generating other useful +This program also provides a foundation for generating other useful information. For example, using the following `print' statement in the `END' rule indicates how often a particular command is used: print data[lines[i]], lines[i] - This works because `data[$0]' is incremented each time a line is -seen. +This works because `data[$0]' is incremented each time a line is seen.  File: gawk.info, Node: Extract Program, Next: Simple Sed, Prev: History Sorting, Up: Miscellaneous Programs -Extracting Programs from Texinfo Source Files ---------------------------------------------- +13.3.7 Extracting Programs from Texinfo Source Files +---------------------------------------------------- - The nodes *Note Library Functions::, and *Note Sample Programs::, -are the top level nodes for a large number of `awk' programs. If you -want to experiment with these programs, it is tedious to have to type -them in by hand. Here we present a program that can extract parts of a +The nodes *Note Library Functions::, and *Note Sample Programs::, are +the top level nodes for a large number of `awk' programs. If you want +to experiment with these programs, it is tedious to have to type them +in by hand. Here we present a program that can extract parts of a Texinfo input file into separate files. - This Info file is written in Texinfo, the GNU project's document +This Info file is written in Texinfo, the GNU project's document formatting language. A single Texinfo source file can be used to produce both printed and online documentation. The Texinfo language is described fully, starting with *Note Top::. - For our purposes, it is enough to know three things about Texinfo -input files: +For our purposes, it is enough to know three things about Texinfo input +files: * The "at" symbol (`@') is special in Texinfo, much as the backslash (`\') is in C or `awk'. Literal `@' symbols are represented in @@ -15768,7 +15969,7 @@ input files: (Unfortunately, TeX isn't always smart enough to do things exactly right, and we have to give it some help.) - The following program, `extract.awk', reads through a Texinfo source +The following program, `extract.awk', reads through a Texinfo source file and does two things, based on the special comments. Upon seeing `@c system ...', it runs a command, by extracting the command text from the control line and passing it on to the `system' function (*note I/O @@ -15779,25 +15980,25 @@ rules in `extract.awk' match either `@c' or `@comment' by letting the are simply removed. `extract.awk' uses the `join' library function (*note Join Function::). - The example programs in the online Texinfo source for `GAWK: -Effective AWK Programming' (`gawk.texi') have all been bracketed inside -`file' and `endfile' lines. The `gawk' distribution uses a copy of -`extract.awk' to extract the sample programs and install many of them -in a standard directory where `gawk' can find them. The Texinfo file -looks something like this: +The example programs in the online Texinfo source for `GAWK: Effective +AWK Programming' (`gawk.texi') have all been bracketed inside `file' and +`endfile' lines. The `gawk' distribution uses a copy of `extract.awk' +to extract the sample programs and install many of them in a standard +directory where `gawk' can find them. The Texinfo file looks something +like this: ... This program has a @code{BEGIN} rule, that prints a nice message: - + @example @c file examples/messages.awk BEGIN @{ print "Don't panic!" @} @c end file @end example - + It also prints some final advice: - + @example @c file examples/messages.awk END @{ print "Always avoid bored archeologists!" @} @@ -15805,17 +16006,17 @@ looks something like this: @end example ... - `extract.awk' begins by setting `IGNORECASE' to one, so that mixed +`extract.awk' begins by setting `IGNORECASE' to one, so that mixed upper- and lowercase letters in the directives won't matter. - The first rule handles calling `system', checking that a command is +The first rule handles calling `system', checking that a command is given (`NF' is at least three) and also checking that the command exits with a zero exit status, signifying OK: # extract.awk --- extract files and run programs # from texinfo files BEGIN { IGNORECASE = 1 } - + /^@c(omment)?[ \t]+system/ \ { if (NF < 3) { @@ -15836,33 +16037,32 @@ with a zero exit status, signifying OK: The variable `e' is used so that the function fits nicely on the screen. - The second rule handles moving data into files. It verifies that a +The second rule handles moving data into files. It verifies that a file name is given in the directive. If the file named is not the current file, then the current file is closed. Keeping the current file open until a new file is encountered allows the use of the `>' redirection for printing the contents, keeping open file management simple. - The `for' loop does the work. It reads lines using `getline' (*note +The `for' loop does the work. It reads lines using `getline' (*note Getline::). For an unexpected end of file, it calls the `unexpected_eof' function. If the line is an "endfile" line, then it breaks out of the loop. If the line is an `@group' or `@end group' line, then it ignores it and goes on to the next line. Similarly, comments within examples are also ignored. - Most of the work is in the following few lines. If the line has no -`@' symbols, the program can print it directly. Otherwise, each -leading `@' must be stripped off. To remove the `@' symbols, the line -is split into separate elements of the array `a', using the `split' -function (*note String Functions::). The `@' symbol is used as the -separator character. Each element of `a' that is empty indicates two -successive `@' symbols in the original line. For each two empty -elements (`@@' in the original file), we have to add a single `@' -symbol back in. +Most of the work is in the following few lines. If the line has no `@' +symbols, the program can print it directly. Otherwise, each leading +`@' must be stripped off. To remove the `@' symbols, the line is split +into separate elements of the array `a', using the `split' function +(*note String Functions::). The `@' symbol is used as the separator +character. Each element of `a' that is empty indicates two successive +`@' symbols in the original line. For each two empty elements (`@@' in +the original file), we have to add a single `@' symbol back in. - When the processing of the array is finished, `join' is called with -the value of `SUBSEP', to rejoin the pieces back into a single line. -That line is then printed to the output file: +When the processing of the array is finished, `join' is called with the +value of `SUBSEP', to rejoin the pieces back into a single line. That +line is then printed to the output file: /^@c(omment)?[ \t]+file/ \ { @@ -15876,7 +16076,7 @@ That line is then printed to the output file: close(curfile) curfile = $3 } - + for (;;) { if ((getline line) <= 0) unexpected_eof() @@ -15904,15 +16104,15 @@ That line is then printed to the output file: } } - An important thing to note is the use of the `>' redirection. -Output done with `>' only opens the file once; it stays open and -subsequent output is appended to the file (*note Redirection::). This -makes it easy to mix program text and explanatory prose for the same -sample source file (as has been done here!) without any hassle. The -file is only closed when a new data file name is encountered or at the -end of the input file. +An important thing to note is the use of the `>' redirection. Output +done with `>' only opens the file once; it stays open and subsequent +output is appended to the file (*note Redirection::). This makes it +easy to mix program text and explanatory prose for the same sample +source file (as has been done here!) without any hassle. The file is +only closed when a new data file name is encountered or at the end of +the input file. - Finally, the function `unexpected_eof' prints an appropriate error +Finally, the function `unexpected_eof' prints an appropriate error message and then exits. The `END' rule handles the final cleanup, closing the open file: @@ -15921,7 +16121,7 @@ closing the open file: FILENAME, FNR) > "/dev/stderr" exit 1 } - + END { if (curfile) close(curfile) @@ -15930,27 +16130,27 @@ closing the open file:  File: gawk.info, Node: Simple Sed, Next: Igawk Program, Prev: Extract Program, Up: Miscellaneous Programs -A Simple Stream Editor ----------------------- +13.3.8 A Simple Stream Editor +----------------------------- - The `sed' utility is a stream editor, a program that reads a stream -of data, makes changes to it, and passes it on. It is often used to -make global changes to a large file or to a stream of data generated by -a pipeline of commands. While `sed' is a complicated program in its -own right, its most common use is to perform global substitutions in -the middle of a pipeline: +The `sed' utility is a stream editor, a program that reads a stream of +data, makes changes to it, and passes it on. It is often used to make +global changes to a large file or to a stream of data generated by a +pipeline of commands. While `sed' is a complicated program in its own +right, its most common use is to perform global substitutions in the +middle of a pipeline: command1 < orig.data | sed 's/old/new/g' | command2 > result - Here, `s/old/new/g' tells `sed' to look for the regexp `old' on each +Here, `s/old/new/g' tells `sed' to look for the regexp `old' on each input line and globally replace it with the text `new', i.e., all the occurrences on a line. This is similar to `awk''s `gsub' function (*note String Functions::). - The following program, `awksed.awk', accepts at least two -command-line arguments: the pattern to look for and the text to replace -it with. Any additional arguments are treated as data file names to -process. If none are provided, the standard input is used: +The following program, `awksed.awk', accepts at least two command-line +arguments: the pattern to look for and the text to replace it with. Any +additional arguments are treated as data file names to process. If none +are provided, the standard input is used: # awksed.awk --- do s/foo/bar/g using just print # Thanks to Michael Brennan for the idea @@ -15959,19 +16159,19 @@ process. If none are provided, the standard input is used: print "usage: awksed pat repl [files...]" > "/dev/stderr" exit 1 } - + BEGIN { # validate arguments if (ARGC < 3) usage() - + RS = ARGV[1] ORS = ARGV[2] - + # don't use arguments as files ARGV[1] = ARGV[2] = "" } - + # look ma, no hands! { if (RT == "") @@ -15980,53 +16180,53 @@ process. If none are provided, the standard input is used: print } - The program relies on `gawk''s ability to have `RS' be a regexp, as +The program relies on `gawk''s ability to have `RS' be a regexp, as well as on the setting of `RT' to the actual text that terminates the record (*note Records::). - The idea is to have `RS' be the pattern to look for. `gawk' +The idea is to have `RS' be the pattern to look for. `gawk' automatically sets `$0' to the text between matches of the pattern. This is text that we want to keep, unmodified. Then, by setting `ORS' to the replacement text, a simple `print' statement outputs the text we want to keep, followed by the replacement text. - There is one wrinkle to this scheme, which is what to do if the last +There is one wrinkle to this scheme, which is what to do if the last record doesn't end with text that matches `RS'. Using a `print' statement unconditionally prints the replacement text, which is not correct. However, if the file did not end in text that matches `RS', `RT' is set to the null string. In this case, we can print `$0' using `printf' (*note Printf::). - The `BEGIN' rule handles the setup, checking for the right number of +The `BEGIN' rule handles the setup, checking for the right number of arguments and calling `usage' if there is a problem. Then it sets `RS' and `ORS' from the command-line arguments and sets `ARGV[1]' and `ARGV[2]' to the null string, so that they are not treated as file names (*note ARGC and ARGV::). - The `usage' function prints an error message and exits. Finally, -the single rule handles the printing scheme outlined above, using -`print' or `printf' as appropriate, depending upon the value of `RT'. +The `usage' function prints an error message and exits. Finally, the +single rule handles the printing scheme outlined above, using `print' +or `printf' as appropriate, depending upon the value of `RT'.  File: gawk.info, Node: Igawk Program, Prev: Simple Sed, Up: Miscellaneous Programs -An Easy Way to Use Library Functions ------------------------------------- +13.3.9 An Easy Way to Use Library Functions +------------------------------------------- - Using library functions in `awk' can be very beneficial. It -encourages code reuse and the writing of general functions. Programs are -smaller and therefore clearer. However, using library functions is -only easy when writing `awk' programs; it is painful when running them, -requiring multiple `-f' options. If `gawk' is unavailable, then so too -is the `AWKPATH' environment variable and the ability to put `awk' -functions into a library directory (*note Options::). It would be nice -to be able to write programs in the following manner: +Using library functions in `awk' can be very beneficial. It encourages +code reuse and the writing of general functions. Programs are smaller +and therefore clearer. However, using library functions is only easy +when writing `awk' programs; it is painful when running them, requiring +multiple `-f' options. If `gawk' is unavailable, then so too is the +`AWKPATH' environment variable and the ability to put `awk' functions +into a library directory (*note Options::). It would be nice to be +able to write programs in the following manner: # library functions @include getopt.awk @include join.awk ... - + # main program BEGIN { while ((c = getopt(ARGC, ARGV, "a:b:cde")) != -1) @@ -16034,19 +16234,19 @@ to be able to write programs in the following manner: ... } - The following program, `igawk.sh', provides this service. It -simulates `gawk''s searching of the `AWKPATH' variable and also allows -"nested" includes; i.e., a file that is included with `@include' can -contain further `@include' statements. `igawk' makes an effort to only -include files once, so that nested includes don't accidentally include -a library function twice. +The following program, `igawk.sh', provides this service. It simulates +`gawk''s searching of the `AWKPATH' variable and also allows "nested" +includes; i.e., a file that is included with `@include' can contain +further `@include' statements. `igawk' makes an effort to only include +files once, so that nested includes don't accidentally include a +library function twice. - `igawk' should behave just like `gawk' externally. This means it +`igawk' should behave just like `gawk' externally. This means it should accept all of `gawk''s command-line arguments, including the ability to have multiple source files specified via `-f', and the ability to mix command-line and library source files. - The program is written using the POSIX Shell (`sh') command +The program is written using the POSIX Shell (`sh') command language.(1) It works as follows: 1. Loop through the arguments, saving anything that doesn't represent @@ -16072,18 +16272,18 @@ language.(1) It works as follows: command-line arguments that the user supplied (such as the data file names). - This program uses shell variables extensively; for storing command -line arguments, the text of the `awk' program that will expand the -user's program, for the user's original program, and for the expanded -program. Doing so removes some potential problems that might arise -were we to use temporary files instead, at the cost of making the -script somewhat more complicated. +This program uses shell variables extensively; for storing command line +arguments, the text of the `awk' program that will expand the user's +program, for the user's original program, and for the expanded program. +Doing so removes some potential problems that might arise were we to +use temporary files instead, at the cost of making the script somewhat +more complicated. - The initial part of the program turns on shell tracing if the first +The initial part of the program turns on shell tracing if the first argument is `debug'. - The next part loops through all the command-line arguments. There -are several cases of interest: +The next part loops through all the command-line arguments. There are +several cases of interest: `--' This ends the arguments to `igawk'. Anything else should be @@ -16115,7 +16315,7 @@ are several cases of interest: `igawk' prints its version number, runs `gawk --version' to get the `gawk' version information, and then exits. - If none of the `-f', `--file', `-Wfile', `--source', or `-Wsource' +If none of the `-f', `--file', `-Wfile', `--source', or `-Wsource' arguments are supplied, then the first nonoption argument should be the `awk' program. If there are no command-line arguments left, `igawk' prints an error message and exits. Otherwise, the first argument is @@ -16123,7 +16323,7 @@ appended to `program'. In any case, after the arguments have been processed, `program' contains the complete text of the original `awk' program. - The program is as follows: +The program is as follows: #! /bin/sh # igawk --- like gawk but do @include processing @@ -16132,74 +16332,74 @@ program. set -x shift fi - + # A literal newline, so that program text is formmatted correctly n=' ' - + # Initialize variables to empty program= opts= - + while [ $# -ne 0 ] # loop over arguments do case $1 in --) shift; break;; - + -W) shift # The ${x?'message here'} construct prints a # diagnostic if $x is the null string set -- -W"${@?'missing operand'}" continue;; - + -[vF]) opts="$opts $1 '${2?'missing operand'}'" shift;; - + -[vF]*) opts="$opts '$1'" ;; - + -f) program="$program$n@include ${2?'missing operand'}" shift;; - + -f*) f=`expr "$1" : '-f\(.*\)'` program="$program$n@include $f";; - + -[W-]file=*) f=`expr "$1" : '-.file=\(.*\)'` program="$program$n@include $f";; - + -[W-]file) program="$program$n@include ${2?'missing operand'}" shift;; - + -[W-]source=*) t=`expr "$1" : '-.source=\(.*\)'` program="$program$n$t";; - + -[W-]source) program="$program$n${2?'missing operand'}" shift;; - + -[W-]version) echo igawk: version 2.0 1>&2 gawk --version exit 0 ;; - + -[W-]*) opts="$opts '$1'" ;; - + *) break;; esac shift done - + if [ -z "$program" ] then program=${1?'missing program'} shift fi - + # At this point, `program' has the program. - The `awk' program to process `@include' directives is stored in the +The `awk' program to process `@include' directives is stored in the shell variable `expand_prog'. Doing this keeps the shell script readable. The `awk' program reads through the user's program, one line at a time, using `getline' (*note Getline::). The input file names and @@ -16210,8 +16410,8 @@ As each file is finished, the stack is "popped," and the previous input file becomes the current input file again. The process is started by making the original file the first one on the stack. - The `pathto' function does the work of finding the full path to a -file. It simulates `gawk''s behavior when searching the `AWKPATH' +The `pathto' function does the work of finding the full path to a file. +It simulates `gawk''s behavior when searching the `AWKPATH' environment variable (*note AWKPATH Variable::). If a file name has a `/' in it, no path search is done. Otherwise, the file name is concatenated with the name of each directory in the path, and an @@ -16221,12 +16421,12 @@ if a file can be read in `awk' is to go ahead and try to read it with is closed and the file name is returned: expand_prog=' - + function pathto(file, i, t, junk) { if (index(file, "/") != 0) return file - + for (i = 1; i <= ndirs; i++) { t = (pathlist[i] "/" file) if ((getline junk < t) > 0) { @@ -16238,8 +16438,8 @@ is closed and the file name is returned: return "" } - The main program is contained inside one `BEGIN' rule. The first -thing it does is set up the `pathlist' array that `pathto' uses. After +The main program is contained inside one `BEGIN' rule. The first thing +it does is set up the `pathlist' array that `pathto' uses. After splitting the path on `:', null elements are replaced with `"."', which represents the current directory: @@ -16251,26 +16451,26 @@ represents the current directory: pathlist[i] = "." } - The stack is initialized with `ARGV[1]', which will be `/dev/stdin'. +The stack is initialized with `ARGV[1]', which will be `/dev/stdin'. The main loop comes next. Input lines are read in succession. Lines that do not start with `@include' are printed verbatim. If the line does start with `@include', the file name is in `$2'. `pathto' is called to generate the full path. If it cannot, then we print an error message and continue. - The next thing to check is if the file is included already. The +The next thing to check is if the file is included already. The `processed' array is indexed by the full file name of each included file and it tracks this information for us. If the file is seen again, a warning message is printed. Otherwise, the new file name is pushed onto the stack and processing continues. - Finally, when `getline' encounters the end of the input file, the -file is closed and the stack is popped. When `stackptr' is less than -zero, the program is done: +Finally, when `getline' encounters the end of the input file, the file +is closed and the stack is popped. When `stackptr' is less than zero, +the program is done: stackptr = 0 input[stackptr] = ARGV[1] # ARGV[1] is first file - + for (; stackptr >= 0; stackptr--) { while ((getline < input[stackptr]) > 0) { if (tolower($1) != "@include") { @@ -16294,24 +16494,24 @@ zero, the program is done: close(input[stackptr]) } }' # close quote ends `expand_prog' variable - + processed_program=`gawk -- "$expand_prog" /dev/stdin < if you have problems getting started. If you need to access functions or variables which are not @@ -17601,7 +17800,7 @@ exported by `gawk.exe', add them to `gawkw32.def' and rebuild. You should also add `ATTRIBUTE_EXPORTED' to the declaration in `awk.h' of any variables you add to `gawkw32.def'. - Note that extension libraries have the name of the `awk' executable +Note that extension libraries have the name of the `awk' executable embedded in them at link time, so they will work only with `gawk.exe'. In particular, they won't work if you rename `gawk.exe' to `awk.exe' or if you try to use `pgawk.exe'. You can perform profiling by temporarily @@ -17609,28 +17808,28 @@ renaming `pgawk.exe' to `gawk.exe'. You can resolve this problem by changing the program name in the definition of `DYN_MAKEXP' for your compiler. - On Windows32, libraries are sought first in the current directory, -then in the directory containing `gawk.exe', and finally through the -`PATH' environment variable. +On Windows32, libraries are sought first in the current directory, then +in the directory containing `gawk.exe', and finally through the `PATH' +environment variable.  File: gawk.info, Node: PC Using, Next: Cygwin, Prev: PC Dynamic, Up: PC Installation -Using `gawk' on PC Operating Systems -.................................... +B.3.3.4 Using `gawk' on PC Operating Systems +............................................ - With the exception of the Cygwin environment, the `|&' operator and +With the exception of the Cygwin environment, the `|&' operator and TCP/IP networking (*note TCP/IP Networking::) are not supported for MS-DOS or MS-Windows. EMX (OS/2 only) does support at least the `|&' operator. - The OS/2 and MS-DOS versions of `gawk' search for program files as +The OS/2 and MS-DOS versions of `gawk' search for program files as described in *Note AWKPATH Variable::. However, semicolons (rather than colons) separate elements in the `AWKPATH' variable. If `AWKPATH' is not set or is empty, then the default search path for OS/2 (16 bit) and MS-DOS versions is `".;c:/lib/awk;c:/gnu/lib/awk"'. - The search path for OS/2 (32 bit, EMX) is determined by the prefix +The search path for OS/2 (32 bit, EMX) is determined by the prefix directory (most likely `/usr' or `c:/usr') that has been specified as an option of the `configure' script like it is the case for the Unix versions. If `c:/usr' is the prefix directory then the default search @@ -17642,7 +17841,7 @@ specific drive is also searched for program files. E.g., if `UNIXROOT' is set to `e:' the complete default search path is `".;c:/usr/share/awk;e:/usr/share/awk"'. - An `sh'-like shell (as opposed to `command.com' under MS-DOS or +An `sh'-like shell (as opposed to `command.com' under MS-DOS or `cmd.exe' under OS/2) may be useful for `awk' programming. Ian Stewartson has written an excellent shell for MS-DOS and OS/2, Daisuke Aoyama has ported GNU `bash' to MS-DOS using the DJGPP tools, and @@ -17653,7 +17852,7 @@ documentation for handling command lines; in particular, the setting for `gawk' in the shell configuration may need to be changed and the `ignoretype' option may also be of interest. - Under OS/2 and DOS, `gawk' (and many other text programs) silently +Under OS/2 and DOS, `gawk' (and many other text programs) silently translate end-of-line `"\r\n"' to `"\n"' on input and `"\n"' to `"\r\n"' on output. A special `BINMODE' variable allows control over these translations and is interpreted as follows: @@ -17678,18 +17877,18 @@ accomplished by using an appropriate `-v BINMODE=N' option on the command line. `BINMODE' is set at the time a file or pipe is opened and cannot be changed mid-stream. - The name `BINMODE' was chosen to match `mawk' (*note Other -Versions::). Both `mawk' and `gawk' handle `BINMODE' similarly; -however, `mawk' adds a `-W BINMODE=N' option and an environment -variable that can set `BINMODE', `RS', and `ORS'. The files -`binmode[1-3].awk' (under `gnu/lib/awk' in some of the prepared -distributions) have been chosen to match `mawk''s `-W BINMODE=N' -option. These can be changed or discarded; in particular, the setting -of `RS' giving the fewest "surprises" is open to debate. `mawk' uses -`RS = "\r\n"' if binary mode is set on read, which is appropriate for -files with the DOS-style end-of-line. - - To illustrate, the following examples set binary mode on writes for +The name `BINMODE' was chosen to match `mawk' (*note Other Versions::). +Both `mawk' and `gawk' handle `BINMODE' similarly; however, `mawk' adds +a `-W BINMODE=N' option and an environment variable that can set +`BINMODE', `RS', and `ORS'. The files `binmode[1-3].awk' (under +`gnu/lib/awk' in some of the prepared distributions) have been chosen +to match `mawk''s `-W BINMODE=N' option. These can be changed or +discarded; in particular, the setting of `RS' giving the fewest +"surprises" is open to debate. `mawk' uses `RS = "\r\n"' if binary +mode is set on read, which is appropriate for files with the DOS-style +end-of-line. + +To illustrate, the following examples set binary mode on writes for standard output and other files, and set `ORS' as the "usual" DOS-style end-of-line: @@ -17715,39 +17914,39 @@ moved into the `BEGIN' rule.  File: gawk.info, Node: Cygwin, Prev: PC Using, Up: PC Installation -Using `gawk' In The Cygwin Environment -...................................... +B.3.3.5 Using `gawk' In The Cygwin Environment +.............................................. - `gawk' can be used "out of the box" under Windows if you are using -the Cygwin environment.(1) This environment provides an excellent +`gawk' can be used "out of the box" under Windows if you are using the +Cygwin environment.(1) This environment provides an excellent simulation of Unix, using the GNU tools, such as `bash', the GNU Compiler Collection (GCC), GNU Make, and other GNU tools. Compilation and installation for Cygwin is the same as for a Unix system: - tar -xvpzf gawk-3.1.3.tar.gz - cd gawk-3.1.3 + tar -xvpzf gawk-3.1.4.tar.gz + cd gawk-3.1.4 ./configure make - When compared to GNU/Linux on the same system, the `configure' step -on Cygwin takes considerably longer. However, it does finish, and then +When compared to GNU/Linux on the same system, the `configure' step on +Cygwin takes considerably longer. However, it does finish, and then the `make' proceeds as usual. - *Note:* The `|&' operator and TCP/IP networking (*note TCP/IP -Networking::) are fully supported in the Cygwin environment. This is -not true for any other environment for MS-DOS or MS-Windows. + NOTE: The `|&' operator and TCP/IP networking (*note TCP/IP + Networking::) are fully supported in the Cygwin environment. This + is not true for any other environment for MS-DOS or MS-Windows. - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) `http://www.cygwin.com' +(1) `http://www.cygwin.com'  File: gawk.info, Node: VMS Installation, Prev: PC Installation, Up: Non-Unix Installation -How to Compile and Install `gawk' on VMS ----------------------------------------- +B.3.4 How to Compile and Install `gawk' on VMS +---------------------------------------------- - This node describes how to compile and install `gawk' under VMS. +This node describes how to compile and install `gawk' under VMS. * Menu: @@ -17759,10 +17958,10 @@ How to Compile and Install `gawk' on VMS  File: gawk.info, Node: VMS Compilation, Next: VMS Installation Details, Up: VMS Installation -Compiling `gawk' on VMS -....................... +B.3.4.1 Compiling `gawk' on VMS +............................... - To compile `gawk' under VMS, there is a `DCL' command procedure that +To compile `gawk' under VMS, there is a `DCL' command procedure that issues all the necessary `CC' and `LINK' commands. There is also a `Makefile' for use with the `MMS' utility. From the source directory, use either: @@ -17773,7 +17972,7 @@ or: $ MMS/DESCRIPTION=[.VMS]DESCRIP.MMS GAWK - Depending upon which C compiler you are using, follow one of the sets +Depending upon which C compiler you are using, follow one of the sets of instructions in this table: VAX C V3.x @@ -17797,17 +17996,16 @@ DEC C Edit `vmsbuild.com' or `descrip.mms' according to their comments. No changes to `config.h' are needed. - `gawk' has been tested under VAX/VMS 5.5-1 using VAX C V3.2, and GNU -C 1.40 and 2.3. It should work without modifications for VMS V4.6 and -up. +`gawk' has been tested under VAX/VMS 5.5-1 using VAX C V3.2, and GNU C +1.40 and 2.3. It should work without modifications for VMS V4.6 and up.  File: gawk.info, Node: VMS Installation Details, Next: VMS Running, Prev: VMS Compilation, Up: VMS Installation -Installing `gawk' on VMS -........................ +B.3.4.2 Installing `gawk' on VMS +................................ - To install `gawk', all you need is a "foreign" command, which is a +To install `gawk', all you need is a "foreign" command, which is a `DCL' symbol whose value begins with a dollar sign. For example: $ GAWK :== $disk1:[gnubin]GAWK @@ -17818,7 +18016,7 @@ symbol should be placed in the `login.com' of any user who wants to run Alternatively, the symbol may be placed in the system-wide `sylogin.com' procedure, which allows all users to run `gawk'. - Optionally, the help entry can be loaded into a VMS help library: +Optionally, the help entry can be loaded into a VMS help library: $ LIBRARY/HELP SYS$HELP:HELPLIB [.VMS]GAWK.HLP @@ -17831,7 +18029,7 @@ command: provides information about both the `gawk' implementation and the `awk' programming language. - The logical name `AWK_LIBRARY' can designate a default location for +The logical name `AWK_LIBRARY' can designate a default location for `awk' program files. For the `-f' option, if the specified file name has no device or directory path information in it, `gawk' looks in the current directory first, then in the directory specified by the @@ -17844,15 +18042,15 @@ benignly.  File: gawk.info, Node: VMS Running, Next: VMS POSIX, Prev: VMS Installation Details, Up: VMS Installation -Running `gawk' on VMS -..................... +B.3.4.3 Running `gawk' on VMS +............................. - Command-line parsing and quoting conventions are significantly -different on VMS, so examples in this Info file or from other sources -often need minor changes. They _are_ minor though, and all `awk' -programs should run correctly. +Command-line parsing and quoting conventions are significantly different +on VMS, so examples in this Info file or from other sources often need +minor changes. They _are_ minor though, and all `awk' programs should +run correctly. - Here are a couple of trivial tests: +Here are a couple of trivial tests: $ gawk -- "BEGIN {print ""Hello, World!""}" $ gawk -"W" version @@ -17860,8 +18058,8 @@ programs should run correctly. Note that uppercase and mixed-case text must be quoted. - The VMS port of `gawk' includes a `DCL'-style interface in addition -to the original shell-style interface (see the help entry for details). +The VMS port of `gawk' includes a `DCL'-style interface in addition to +the original shell-style interface (see the help entry for details). One side effect of dual command-line parsing is that if there is only a single parameter (as in the quoted string program above), the command becomes ambiguous. To work around this, the normally optional `--' @@ -17869,21 +18067,21 @@ flag is required to force Unix style rather than `DCL' parsing. If any other dash-type options (or multiple parameters such as data files to process) are present, there is no ambiguity and `--' can be omitted. - The default search path, when looking for `awk' program files -specified by the `-f' option, is `"SYS$DISK:[],AWK_LIBRARY:"'. The -logical name `AWKPATH' can be used to override this default. The format -of `AWKPATH' is a comma-separated list of directory specifications. -When defining it, the value should be quoted so that it retains a single +The default search path, when looking for `awk' program files specified +by the `-f' option, is `"SYS$DISK:[],AWK_LIBRARY:"'. The logical name +`AWKPATH' can be used to override this default. The format of +`AWKPATH' is a comma-separated list of directory specifications. When +defining it, the value should be quoted so that it retains a single translation and not a multitranslation `RMS' searchlist.  File: gawk.info, Node: VMS POSIX, Prev: VMS Running, Up: VMS Installation -Building and Using `gawk' on VMS POSIX -...................................... +B.3.4.4 Building and Using `gawk' on VMS POSIX +.............................................. - Ignore the instructions above, although `vms/gawk.hlp' should still -be made available in a help library. The source tree should be unpacked +Ignore the instructions above, although `vms/gawk.hlp' should still be +made available in a help library. The source tree should be unpacked into a container file subsystem rather than into the ordinary VMS filesystem. Make sure that the two scripts, `configure' and `vms/posix-cc.sh', are executable; use `chmod +x' on them if necessary. @@ -17899,21 +18097,20 @@ compiler directly; ignore any warnings from `make' about being unable to redefine `CC'. `configure' takes a very long time to execute, but at least it provides incremental feedback as it runs. - This has been tested with VAX/VMS V6.2, VMS POSIX V2.0, and DEC C -V5.2. +This has been tested with VAX/VMS V6.2, VMS POSIX V2.0, and DEC C V5.2. - Once built, `gawk' works like any other shell utility. Unlike the +Once built, `gawk' works like any other shell utility. Unlike the normal VMS port of `gawk', no special command-line manipulation is needed in the VMS POSIX environment.  File: gawk.info, Node: Unsupported, Next: Bugs, Prev: Non-Unix Installation, Up: Installation -Unsupported Operating System Ports -================================== +B.4 Unsupported Operating System Ports +====================================== - This sections describes systems for which the `gawk' port is no -longer supported. +This sections describes systems for which the `gawk' port is no longer +supported. * Menu: @@ -17923,19 +18120,19 @@ longer supported.  File: gawk.info, Node: Atari Installation, Next: Tandem Installation, Up: Unsupported -Installing `gawk' on the Atari ST ---------------------------------- +B.4.1 Installing `gawk' on the Atari ST +--------------------------------------- - The Atari port is no longer supported. It is included for those who +The Atari port is no longer supported. It is included for those who might want to use it but it is no longer being actively maintained. - There are no substantial differences when installing `gawk' on -various Atari models. Compiled `gawk' executables do not require a -large amount of memory with most `awk' programs, and should run on all +There are no substantial differences when installing `gawk' on various +Atari models. Compiled `gawk' executables do not require a large +amount of memory with most `awk' programs, and should run on all Motorola processor-based models (called further ST, even if that is not exactly right). - In order to use `gawk', you need to have a shell, either text or +In order to use `gawk', you need to have a shell, either text or graphics, that does not map all the characters of a command line to uppercase. Maintaining case distinction in option flags is very important (*note Options::). These days this is the default and it may @@ -17953,36 +18150,36 @@ vital.  File: gawk.info, Node: Atari Compiling, Next: Atari Using, Up: Atari Installation -Compiling `gawk' on the Atari ST -................................ +B.4.1.1 Compiling `gawk' on the Atari ST +........................................ - A proper compilation of `gawk' sources when `sizeof(int)' differs -from `sizeof(void *)' requires an ISO C compiler. An initial port was -done with `gcc'. You may actually prefer executables where `int's are -four bytes wide but the other variant works as well. +A proper compilation of `gawk' sources when `sizeof(int)' differs from +`sizeof(void *)' requires an ISO C compiler. An initial port was done +with `gcc'. You may actually prefer executables where `int's are four +bytes wide but the other variant works as well. - You may need quite a bit of memory when trying to recompile the -`gawk' sources, as some source files (`regex.c' in particular) are quite -big. If you run out of memory compiling such a file, try reducing the +You may need quite a bit of memory when trying to recompile the `gawk' +sources, as some source files (`regex.c' in particular) are quite big. +If you run out of memory compiling such a file, try reducing the optimization level for this particular file, which may help. - With a reasonable shell (`bash' will do), you have a pretty good -chance that the `configure' utility will succeed, and in particular if -you run GNU/Linux, MiNT or a similar operating system. Otherwise -sample versions of `config.h' and `Makefile.st' are given in the -`atari' subdirectory and can be edited and copied to the corresponding -files in the main source directory. Even if `configure' produces -something, it might be advisable to compare its results with the sample -versions and possibly make adjustments. +With a reasonable shell (`bash' will do), you have a pretty good chance +that the `configure' utility will succeed, and in particular if you run +GNU/Linux, MiNT or a similar operating system. Otherwise sample +versions of `config.h' and `Makefile.st' are given in the `atari' +subdirectory and can be edited and copied to the corresponding files in +the main source directory. Even if `configure' produces something, it +might be advisable to compare its results with the sample versions and +possibly make adjustments. - Some `gawk' source code fragments depend on a preprocessor define +Some `gawk' source code fragments depend on a preprocessor define `atarist'. This basically assumes the TOS environment with `gcc'. Modify these sections as appropriate if they are not right for your environment. Also see the remarks about `AWKPATH' and `envsep' in *Note Atari Using::. - As shipped, the sample `config.h' claims that the `system' function -is missing from the libraries, which is not true, and an alternative +As shipped, the sample `config.h' claims that the `system' function is +missing from the libraries, which is not true, and an alternative implementation of this function is provided in `unsupported/atari/system.c'. Depending upon your particular combination of shell and operating system, you might want to change the @@ -17991,13 +18188,13 @@ file to indicate that `system' is available.  File: gawk.info, Node: Atari Using, Prev: Atari Compiling, Up: Atari Installation -Running `gawk' on the Atari ST -.............................. +B.4.1.2 Running `gawk' on the Atari ST +...................................... - An executable version of `gawk' should be placed, as usual, anywhere -in your `PATH' where your shell can find it. +An executable version of `gawk' should be placed, as usual, anywhere in +your `PATH' where your shell can find it. - While executing, the Atari version of `gawk' creates a number of +While executing, the Atari version of `gawk' creates a number of temporary files. When using `gcc' libraries for TOS, `gawk' looks for either of the environment variables, `TEMP' or `TMPDIR', in that order. If either one is found, its value is assumed to be a directory for @@ -18006,21 +18203,20 @@ memory, it is a good idea to put it on a RAM drive. If neither `TEMP' nor `TMPDIR' are found, then `gawk' uses the current directory for its temporary files. - The ST version of `gawk' searches for its program files, as -described in *Note AWKPATH Variable::. The default value for the -`AWKPATH' variable is taken from `DEFPATH' defined in `Makefile'. The -sample `gcc'/TOS `Makefile' for the ST in the distribution sets -`DEFPATH' to `".,c:\lib\awk,c:\gnu\lib\awk"'. The search path can be -modified by explicitly setting `AWKPATH' to whatever you want. Note -that colons cannot be used on the ST to separate elements in the -`AWKPATH' variable, since they have another reserved meaning. Instead, -you must use a comma to separate elements in the path. When -recompiling, the separating character can be modified by initializing -the `envsep' variable in `unsupported/atari/gawkmisc.atr' to another -value. - - Although `awk' allows great flexibility in doing I/O redirections -from within a program, this facility should be used with care on the ST +The ST version of `gawk' searches for its program files, as described in +*Note AWKPATH Variable::. The default value for the `AWKPATH' variable +is taken from `DEFPATH' defined in `Makefile'. The sample `gcc'/TOS +`Makefile' for the ST in the distribution sets `DEFPATH' to +`".,c:\lib\awk,c:\gnu\lib\awk"'. The search path can be modified by +explicitly setting `AWKPATH' to whatever you want. Note that colons +cannot be used on the ST to separate elements in the `AWKPATH' +variable, since they have another reserved meaning. Instead, you must +use a comma to separate elements in the path. When recompiling, the +separating character can be modified by initializing the `envsep' +variable in `unsupported/atari/gawkmisc.atr' to another value. + +Although `awk' allows great flexibility in doing I/O redirections from +within a program, this facility should be used with care on the ST running under TOS. In some circumstances, the OS routines for file-handle pool processing lose track of certain events, causing the computer to crash and requiring a reboot. Often a warm reboot is @@ -18030,7 +18226,7 @@ program using `print' statements explicitly redirected to `/dev/stdout', while other `print' statements use the default standard output, and a calling shell has redirected standard output to a file. - When `gawk' is compiled with the ST version of `gcc' and its usual +When `gawk' is compiled with the ST version of `gcc' and its usual libraries, it accepts both `/' and `\' as path separators. While this is convenient, it should be remembered that this removes one technically valid character (`/') from your file name. It may also @@ -18044,36 +18240,35 @@ Sequences::).  File: gawk.info, Node: Tandem Installation, Prev: Atari Installation, Up: Unsupported -Installing `gawk' on a Tandem ------------------------------ +B.4.2 Installing `gawk' on a Tandem +----------------------------------- - The Tandem port is only minimally supported. The port's contributor -no longer has access to a Tandem system. +The Tandem port is only minimally supported. The port's contributor no +longer has access to a Tandem system. - The Tandem port was done on a Cyclone machine running D20. The port -is pretty clean and all facilities seem to work except for the I/O -piping facilities (*note Getline/Pipe::, *Note Getline/Variable/Pipe::, -and *Note Redirection::), which is just too foreign a concept for -Tandem. +The Tandem port was done on a Cyclone machine running D20. The port is +pretty clean and all facilities seem to work except for the I/O piping +facilities (*note Getline/Pipe::, *Note Getline/Variable/Pipe::, and +*Note Redirection::), which is just too foreign a concept for Tandem. - To build a Tandem executable from source, download all of the files -so that the file names on the Tandem box conform to the restrictions of +To build a Tandem executable from source, download all of the files so +that the file names on the Tandem box conform to the restrictions of D20. For example, `array.c' becomes `ARRAYC', and `awk.h' becomes `AWKH'. The totally Tandem-specific files are in the `tandem' "subvolume" (`unsupported/tandem' in the `gawk' distribution) and should be copied to the main source directory before building `gawk'. - The file `compit' can then be used to compile and bind an executable. +The file `compit' can then be used to compile and bind an executable. Alas, there is no `configure' or `make'. - Usage is the same as for Unix, except that D20 requires all `{' and -`}' characters to be escaped with `~' on the command line (but _not_ in +Usage is the same as for Unix, except that D20 requires all `{' and `}' +characters to be escaped with `~' on the command line (but _not_ in script files). Also, the standard Tandem syntax for `/in filename,out filename/' must be used instead of the usual Unix `<' and `>' for file redirection. (Redirection options on `getline', `print' etc., are supported.) - The `-mr VAL' option (*note Options::) has been "stolen" to enable +The `-mr VAL' option (*note Options::) has been "stolen" to enable Tandem users to process fixed-length records with no "end-of-line" character. That is, `-mr 74' tells `gawk' to read the input file as fixed 74-byte records. @@ -18081,59 +18276,58 @@ fixed 74-byte records.  File: gawk.info, Node: Bugs, Next: Other Versions, Prev: Unsupported, Up: Installation -Reporting Problems and Bugs -=========================== +B.5 Reporting Problems and Bugs +=============================== There is nothing more dangerous than a bored archeologist. The Hitchhiker's Guide to the Galaxy - If you have problems with `gawk' or think that you have found a bug, +If you have problems with `gawk' or think that you have found a bug, please report it to the developers; we cannot promise to do anything but we might well want to fix it. - Before reporting a bug, make sure you have actually found a real bug. +Before reporting a bug, make sure you have actually found a real bug. Carefully reread the documentation and see if it really says you can do what you're trying to do. If it's not clear whether you should be able to do something or not, report that too; it's a bug in the documentation! - Before reporting a bug or trying to fix it yourself, try to isolate -it to the smallest possible `awk' program and input data file that +Before reporting a bug or trying to fix it yourself, try to isolate it +to the smallest possible `awk' program and input data file that reproduces the problem. Then send us the program and data file, some idea of what kind of Unix system you're using, the compiler you used to compile `gawk', and the exact results `gawk' gave you. Also say what you expected to occur; this helps us decide whether the problem is really in the documentation. - Once you have a precise problem, send email to . +Once you have a precise problem, send email to . - Please include the version number of `gawk' you are using. You can -get this information with the command `gawk --version'. Using this -address automatically sends a carbon copy of your mail to me. If -necessary, I can be reached directly at . The bug -reporting address is preferred since the email list is archived at the -GNU Project. _All email should be in English, since that is my native -language._ +Please include the version number of `gawk' you are using. You can get +this information with the command `gawk --version'. Using this address +automatically sends a carbon copy of your mail to me. If necessary, I +can be reached directly at . The bug reporting address +is preferred since the email list is archived at the GNU Project. _All +email should be in English, since that is my native language._ - *Caution:* Do _not_ try to report bugs in `gawk' by posting to the +*Caution:* Do _not_ try to report bugs in `gawk' by posting to the Usenet/Internet newsgroup `comp.lang.awk'. While the `gawk' developers do occasionally read this newsgroup, there is no guarantee that we will see your posting. The steps described above are the official recognized ways for reporting bugs. - Non-bug suggestions are always welcome as well. If you have -questions about things that are unclear in the documentation or are -just obscure features, ask me; I will try to help you out, although I -may not have the time to fix the problem. You can send me electronic -mail at the Internet address noted previously. +Non-bug suggestions are always welcome as well. If you have questions +about things that are unclear in the documentation or are just obscure +features, ask me; I will try to help you out, although I may not have +the time to fix the problem. You can send me electronic mail at the +Internet address noted previously. - If you find bugs in one of the non-Unix ports of `gawk', please send -an electronic mail message to the person who maintains that port. They +If you find bugs in one of the non-Unix ports of `gawk', please send an +electronic mail message to the person who maintains that port. They are named in the following list, as well as in the `README' file in the `gawk' distribution. Information in the `README' file should be considered authoritative if it conflicts with this Info file. - The people maintaining the non-Unix ports of `gawk' are as follows: +The people maintaining the non-Unix ports of `gawk' are as follows: Amiga Fred Fish, . BeOS Martin Brown, . @@ -18145,20 +18339,20 @@ OS/2 The Unix for OS/2 team, Tandem Stephen Davies, . VMS Pat Rankin, . - If your bug is also reproducible under Unix, please send a copy of -your report to the email list as well. +If your bug is also reproducible under Unix, please send a copy of your +report to the email list as well.  File: gawk.info, Node: Other Versions, Prev: Bugs, Up: Installation -Other Freely Available `awk' Implementations -============================================ +B.6 Other Freely Available `awk' Implementations +================================================ It's kind of fun to put comments like this in your awk code. `// Do C++ comments work? answer: yes! of course' Michael Brennan - There are three other freely available `awk' implementations. This +There are three other freely available `awk' implementations. This minor node briefly describes where to get them: Unix `awk' @@ -18245,19 +18439,19 @@ Unix `awk' `http://www.math.utah.edu/pub/pawk/pawk-20020210.tar.gz'. - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) `http://cm.bell-labs.com/who/bwk' +(1) `http://cm.bell-labs.com/who/bwk'  File: gawk.info, Node: Notes, Next: Basic Concepts, Prev: Installation, Up: Top -Implementation Notes -******************** +Appendix C Implementation Notes +******************************* - This appendix contains information mainly of interest to -implementors and maintainers of `gawk'. Everything in it applies -specifically to `gawk' and not to other implementations. +This appendix contains information mainly of interest to implementors +and maintainers of `gawk'. Everything in it applies specifically to +`gawk' and not to other implementations. * Menu: @@ -18271,39 +18465,39 @@ specifically to `gawk' and not to other implementations.  File: gawk.info, Node: Compatibility Mode, Next: Additions, Up: Notes -Downward Compatibility and Debugging -==================================== +C.1 Downward Compatibility and Debugging +======================================== - *Note POSIX/GNU::, for a summary of the GNU extensions to the `awk' +*Note POSIX/GNU::, for a summary of the GNU extensions to the `awk' language and program. All of these features can be turned off by invoking `gawk' with the `--traditional' option or with the `--posix' option. - If `gawk' is compiled for debugging with `-DDEBUG', then there is -one more option available on the command line: +If `gawk' is compiled for debugging with `-DDEBUG', then there is one +more option available on the command line: `-W parsedebug' `--parsedebug' Prints out the parse stack information as the program is being parsed. - This option is intended only for serious `gawk' developers and not -for the casual user. It probably has not even been compiled into your +This option is intended only for serious `gawk' developers and not for +the casual user. It probably has not even been compiled into your version of `gawk', since it slows down execution.  File: gawk.info, Node: Additions, Next: Dynamic Extensions, Prev: Compatibility Mode, Up: Notes -Making Additions to `gawk' -========================== +C.2 Making Additions to `gawk' +============================== - If you find that you want to enhance `gawk' in a significant -fashion, you are perfectly free to do so. That is the point of having -free software; the source code is available and you are free to change -it as you want (*note Copying::). +If you find that you want to enhance `gawk' in a significant fashion, +you are perfectly free to do so. That is the point of having free +software; the source code is available and you are free to change it as +you want (*note Copying::). - This minor node discusses the ways you might want to change `gawk' -as well as any considerations you should bear in mind. +This minor node discusses the ways you might want to change `gawk' as +well as any considerations you should bear in mind. * Menu: @@ -18315,13 +18509,13 @@ as well as any considerations you should bear in mind.  File: gawk.info, Node: Adding Code, Next: New Ports, Up: Additions -Adding New Features -------------------- +C.2.1 Adding New Features +------------------------- - You are free to add any new features you like to `gawk'. However, -if you want your changes to be incorporated into the `gawk' -distribution, there are several steps that you need to take in order to -make it possible for me to include your changes: +You are free to add any new features you like to `gawk'. However, if +you want your changes to be incorporated into the `gawk' distribution, +there are several steps that you need to take in order to make it +possible for me to include your changes: 1. Before building the new feature into `gawk' itself, consider writing it as an extension module (*note Dynamic Extensions::). @@ -18399,8 +18593,9 @@ make it possible for me to include your changes: worth the minor benefit of not having to free the storage. Instead, use `malloc' and `free'. - *Note:* If I have to reformat your code to follow the coding style - used in `gawk', I may not bother to integrate your changes at all. + NOTE: If I have to reformat your code to follow the coding + style used in `gawk', I may not bother to integrate your + changes at all. 5. Be prepared to sign the appropriate paperwork. In order for the FSF to distribute your changes, you must either place those @@ -18439,19 +18634,19 @@ make it possible for me to include your changes: This helps further minimize the amount of work I have to do, making it easier for me to accept patches. - Although this sounds like a lot of work, please remember that while -you may write the new code, I have to maintain it and support it. If it +Although this sounds like a lot of work, please remember that while you +may write the new code, I have to maintain it and support it. If it isn't possible for me to do that with a minimum of extra work, then I probably will not.  File: gawk.info, Node: New Ports, Prev: Adding Code, Up: Additions -Porting `gawk' to a New Operating System ----------------------------------------- +C.2.2 Porting `gawk' to a New Operating System +---------------------------------------------- - If you want to port `gawk' to a new operating system, there are -several steps: +If you want to port `gawk' to a new operating system, there are several +steps: 1. Follow the guidelines in *Note Adding Code::, concerning coding style, submission of diffs, and so on. @@ -18518,33 +18713,33 @@ several steps: actions are easy to do and _many_ people have done so already. If you have questions, please contact me, or . - Following these steps makes it much easier to integrate your changes +Following these steps makes it much easier to integrate your changes into `gawk' and have them coexist happily with other operating systems' code that is already there. - In the code that you supply and maintain, feel free to use a coding +In the code that you supply and maintain, feel free to use a coding style and brace layout that suits your taste.  File: gawk.info, Node: Dynamic Extensions, Next: Future Extensions, Prev: Additions, Up: Notes -Adding New Built-in Functions to `gawk' -======================================= +C.3 Adding New Built-in Functions to `gawk' +=========================================== Danger Will Robinson! Danger!! Warning! Warning! The Robot - Beginning with `gawk' 3.1, it is possible to add new built-in -functions to `gawk' using dynamically loaded libraries. This facility -is available on systems (such as GNU/Linux) that support the `dlopen' -and `dlsym' functions. This minor node describes how to write and use -dynamically loaded extentions for `gawk'. Experience with programming +Beginning with `gawk' 3.1, it is possible to add new built-in functions +to `gawk' using dynamically loaded libraries. This facility is +available on systems (such as GNU/Linux) that support the `dlopen' and +`dlsym' functions. This minor node describes how to write and use +dynamically loaded extensions for `gawk'. Experience with programming in C or C++ is necessary when reading this minor node. - *Caution:* The facilities described in this minor node are very much -subject to change in the next `gawk' release. Be aware that you may -have to re-do everything, perhaps from scratch, upon the next release. +*Caution:* The facilities described in this minor node are very much +subject to change in a future `gawk' release. Be aware that you may +have to re-do everything, perhaps from scratch, at some future time. * Menu: @@ -18554,10 +18749,10 @@ have to re-do everything, perhaps from scratch, upon the next release.  File: gawk.info, Node: Internals, Next: Sample Library, Up: Dynamic Extensions -A Minimal Introduction to `gawk' Internals ------------------------------------------- +C.3.1 A Minimal Introduction to `gawk' Internals +------------------------------------------------ - The truth is that `gawk' was not designed for simple extensibility. +The truth is that `gawk' was not designed for simple extensibility. The facilities for adding functions using shared libraries work, but are something of a "bag on the side." Thus, this tour is brief and simplistic; would-be `gawk' hackers are encouraged to spend some time @@ -18566,7 +18761,7 @@ material presented here. Of particular note are the files `awk.h', `builtin.c', and `eval.c'. Reading `awk.y' in order to see how the parse tree is built would also be of use. - With the disclaimers out of the way, the following types, structure +With the disclaimers out of the way, the following types, structure members, functions, and macros are declared in `awk.h' and are of use when writing extensions. The next minor node shows how they are used: @@ -18588,9 +18783,18 @@ when writing extensions. The next minor node shows how they are used: may end up calling an internal `gawk' function. It also guarantees that the string is zero-terminated. +`size_t get_curfunc_arg_count(void)' + This function returns the actual number of parameters passed to + the current function. Inside the code of an extension this can be + used to determine the maximum index which is safe to use with + `stack_ptr'. If this value is greater than `tree->param_cnt', the + function was called incorrectly from the `awk' program. + + *Caution:* This function is new as of `gawk' 3.1.4. + `n->param_cnt' - The number of parameters actually passed in a function call at - runtime. + Inside an extension function, this is the maximum number of + expected parameters, as set by the `make_builtin' function. `n->stptr' `n->stlen' @@ -18656,7 +18860,7 @@ when writing extensions. The next minor node shows how they are used: should be written in the following manner: /* do_xxx --- do xxx function for gawk */ - + NODE * do_xxx(NODE *tree) { @@ -18668,6 +18872,26 @@ when writing extensions. The next minor node shows how they are used: the `i'-th argument from the function call. The first argument is argument zero. +`NODE *get_actual_argument(NODE *tree, unsigned int i,' +` int optional, int wantarray);' + This function retrieves a particular argument `i'. `wantarray' is + `TRUE' if the argument should be an array, `FALSE' otherwise. If + `optional' is `TRUE', the argument need not have been supplied. + If it wasn't, the return value is `NULL'. It is a fatal error if + `optional' is `TRUE' but the argument was not provided. + + *Caution:* This function is new as of `gawk' 3.1.4. + +`get_scalar_argument(t, i, opt)' + This is a convenience macro that calls `get_actual_argument'. + + *Caution:* This macro is new as of `gawk' 3.1.4. + +`get_array_argument(t, i, opt)' + This is a convenience macro that calls `get_actual_argument'. + + *Caution:* This macro is new as of `gawk' 3.1.4. + `void set_value(NODE *tree)' This function is called from within a C extension function to set the return value from the extension function. This value is what @@ -18679,57 +18903,64 @@ when writing extensions. The next minor node shows how they are used: the value of `gawk''s `ERRNO' variable, based on the current value of the C `errno' variable. It is provided as a convenience. - An argument that is supposed to be an array needs to be handled with +An argument that is supposed to be an array needs to be handled with some extra code, in case the array being passed in is actually from a function parameter. - In versions of `gawk' up to and including 3.1.2, the following +In versions of `gawk' up to and including 3.1.2, the following boilerplate code shows how to do this: NODE *the_arg; - + the_arg = get_argument(tree, 2); /* assume need 3rd arg, 0-based */ - + /* if a parameter, get it off the stack */ if (the_arg->type == Node_param_list) the_arg = stack_ptr[the_arg->param_cnt]; - + /* parameter referenced an array, get it */ if (the_arg->type == Node_array_ref) the_arg = the_arg->orig_array; - + /* check type */ if (the_arg->type != Node_var && the_arg->type != Node_var_array) fatal("newfunc: third argument is not an array"); - + /* force it to be an array, if necessary, clear it */ the_arg->type = Node_var_array; assoc_clear(the_arg); - For versions 3.1.3 and later, the internals changed. In particular, +For versions 3.1.3 and later, the internals changed. In particular, the interface was actually _simplified_ drastically. The following boilerplate code now suffices: NODE *the_arg; - + the_arg = get_argument(tree, 2); /* assume need 3rd arg, 0-based */ - + /* force it to be an array: */ the_arg = get_array(the_arg); - + /* if necessary, clear it: */ assoc_clear(the_arg); - Again, you should spend time studying the `gawk' internals; don't -just blindly copy this code. +As of version 3.1.4, the internals improved again, and became even +simpler: + + NODE *the_arg; + + the_arg = get_array_argument(tree, 2, FALSE); /* assume need 3rd arg, 0-based */ + +Again, you should spend time studying the `gawk' internals; don't just +blindly copy this code.  File: gawk.info, Node: Sample Library, Prev: Internals, Up: Dynamic Extensions -Directory and File Operation Built-ins --------------------------------------- +C.3.2 Directory and File Operation Built-ins +-------------------------------------------- - Two useful functions that are not in `awk' are `chdir' (so that an +Two useful functions that are not in `awk' are `chdir' (so that an `awk' program can change its directory) and `stat' (so that an `awk' program can gather information about a file). This minor node implements these functions for `gawk' in an external extension library. @@ -18743,11 +18974,11 @@ implements these functions for `gawk' in an external extension library.  File: gawk.info, Node: Internal File Description, Next: Internal File Ops, Up: Sample Library -Using `chdir' and `stat' -........................ +C.3.2.1 Using `chdir' and `stat' +................................ - This minor node shows how to use the new functions at the `awk' -level once they've been integrated into the running `gawk' interpreter. +This minor node shows how to use the new functions at the `awk' level +once they've been integrated into the running `gawk' interpreter. Using `chdir' is very straightforward. It takes one argument, the new directory to change to: @@ -18761,11 +18992,11 @@ directory to change to: } ... - The return value is negative if the `chdir' failed, and `ERRNO' -(*note Built-in Variables::) is set to a string indicating the error. +The return value is negative if the `chdir' failed, and `ERRNO' (*note +Built-in Variables::) is set to a string indicating the error. - Using `stat' is a bit more complicated. The C `stat' function fills -in a structure that has a fair amount of information. The right way to +Using `stat' is a bit more complicated. The C `stat' function fills in +a structure that has a fair amount of information. The right way to model this in `awk' is to fill in an associative array with the appropriate information: @@ -18779,7 +19010,7 @@ appropriate information: } printf("size of %s is %d bytes\n", file, fdata["size"]) - The `stat' function always clears the data array, even if the `stat' +The `stat' function always clears the data array, even if the `stat' fails. It fills in the following elements: `"name"' @@ -18843,10 +19074,9 @@ fails. It fills in the following elements: `"symlink"' The file is a symbolic link. - Several additional elements may be present depending upon the -operating system and the type of the file. You can test for them in -your `awk' program by using the `in' operator (*note Reference to -Elements::): +Several additional elements may be present depending upon the operating +system and the type of the file. You can test for them in your `awk' +program by using the `in' operator (*note Reference to Elements::): `"blksize"' The preferred block size for I/O to the file. This field is not @@ -18866,72 +19096,72 @@ Elements::):  File: gawk.info, Node: Internal File Ops, Next: Using Internal File Ops, Prev: Internal File Description, Up: Sample Library -C Code for `chdir' and `stat' -............................. +C.3.2.2 C Code for `chdir' and `stat' +..................................... - Here is the C code for these extensions. They were written for +Here is the C code for these extensions. They were written for GNU/Linux. The code needs some more work for complete portability to other POSIX-compliant systems:(1) #include "awk.h" - + #include - + /* do_chdir --- provide dynamically loaded chdir() builtin for gawk */ - + static NODE * do_chdir(tree) NODE *tree; { NODE *newdir; int ret = -1; - - newdir = get_argument(tree, 0); - The file includes the `"awk.h"' header file for definitions for the + if (do_lint && get_curfunc_arg_count() != 1) + lintwarn("chdir: called with incorrect number of arguments"); + + newdir = get_scalar_argument(tree, 0); + +The file includes the `"awk.h"' header file for definitions for the `gawk' internals. It includes `' for access to the `major' and `minor' macros. - By convention, for an `awk' function `foo', the function that +By convention, for an `awk' function `foo', the function that implements it is called `do_foo'. The function should take a `NODE *' argument, usually called `tree', that represents the argument list to the function. The `newdir' variable represents the new directory to change to, retrieved with `get_argument'. Note that the first argument is numbered zero. - This code actually accomplishes the `chdir'. It first forces the +This code actually accomplishes the `chdir'. It first forces the argument to be a string and passes the string value to the `chdir' system call. If the `chdir' fails, `ERRNO' is updated. The result of `force_string' has to be freed with `free_temp': - if (newdir != NULL) { - (void) force_string(newdir); - ret = chdir(newdir->stptr); - if (ret < 0) - update_ERRNO(); - - free_temp(newdir); - } + (void) force_string(newdir); + ret = chdir(newdir->stptr); + if (ret < 0) + update_ERRNO(); + free_temp(newdir); - Finally, the function returns the return value to the `awk' level, +Finally, the function returns the return value to the `awk' level, using `set_value'. Then it must return a value from the call to the new built-in (this value ignored by the interpreter): /* Set the return value */ set_value(tmp_number((AWKNUM) ret)); - + /* Just to make the interpreter happy */ return tmp_number((AWKNUM) 0); } - The `stat' built-in is more involved. First comes a function that +The `stat' built-in is more involved. First comes a function that turns a numeric mode into a printable representation (e.g., 644 becomes `-rw-r--r--'). This is omitted here for brevity: /* format_mode --- turn a stat mode field into something readable */ - + static char * format_mode(fmode) unsigned long fmode; @@ -18939,11 +19169,11 @@ turns a numeric mode into a printable representation (e.g., 644 becomes ... } - Next comes the actual `do_stat' function itself. First come the +Next comes the actual `do_stat' function itself. First come the variable declarations and argument checking: /* do_stat --- provide a stat() function for gawk */ - + static NODE * do_stat(tree) NODE *tree; @@ -18951,76 +19181,70 @@ variable declarations and argument checking: NODE *file, *array; struct stat sbuf; int ret; - char *msg; NODE **aptr; char *pmode; /* printable mode */ char *type = "unknown"; - - /* check arg count */ - if (tree->param_cnt != 2) - fatal( - "stat: called with %d arguments, should be 2", - tree->param_cnt); - - Then comes the actual work. First, we get the arguments. Then, we + + + if (do_lint && get_curfunc_arg_count() > 2) + lintwarn("stat: called with too many arguments"); + +Then comes the actual work. First, we get the arguments. Then, we always clear the array. To get the file information, we use `lstat', in case the file is a symbolic link. If there's an error, we set `ERRNO' and return: - /* - * directory is first arg, - * array to hold results is second - */ - file = get_argument(tree, 0); - array = get_argument(tree, 1); - + /* directory is first arg, array to hold results is second */ + file = get_scalar_argument(tree, 0, FALSE); + array = get_array_argument(tree, 1, FALSE); + /* empty out the array */ assoc_clear(array); - + /* lstat the file, if error, set ERRNO and return */ (void) force_string(file); ret = lstat(file->stptr, & sbuf); if (ret < 0) { update_ERRNO(); - + set_value(tmp_number((AWKNUM) ret)); - + free_temp(file); return tmp_number((AWKNUM) 0); } - Now comes the tedious part: filling in the array. Only a few of the +Now comes the tedious part: filling in the array. Only a few of the calls are shown here, since they all follow the same pattern: /* fill in the array */ aptr = assoc_lookup(array, tmp_string("name", 4), FALSE); *aptr = dupnode(file); - + aptr = assoc_lookup(array, tmp_string("mode", 4), FALSE); *aptr = make_number((AWKNUM) sbuf.st_mode); - + aptr = assoc_lookup(array, tmp_string("pmode", 5), FALSE); pmode = format_mode(sbuf.st_mode); *aptr = make_string(pmode, strlen(pmode)); - When done, we free the temporary value containing the file name, set +When done, we free the temporary value containing the file name, set the return value, and return: free_temp(file); - + /* Set the return value */ set_value(tmp_number((AWKNUM) ret)); - + /* Just to make the interpreter happy */ return tmp_number((AWKNUM) 0); } - Finally, it's necessary to provide the "glue" that loads the new +Finally, it's necessary to provide the "glue" that loads the new function(s) into `gawk'. By convention, each library has a routine named `dlload' that does the job: /* dlload --- load new builtins in this library */ - + NODE * dlload(tree, dl) NODE *tree; @@ -19031,31 +19255,31 @@ named `dlload' that does the job: return tmp_number((AWKNUM) 0); } - And that's it! As an exercise, consider adding functions to -implement system calls such as `chown', `chmod', and `umask'. +And that's it! As an exercise, consider adding functions to implement +system calls such as `chown', `chmod', and `umask'. - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) This version is edited slightly for presentation. The complete +(1) This version is edited slightly for presentation. The complete version can be found in `extension/filefuncs.c' in the `gawk' distribution.  File: gawk.info, Node: Using Internal File Ops, Prev: Internal File Ops, Up: Sample Library -Integrating the Extensions -.......................... +C.3.2.3 Integrating the Extensions +.................................. - Now that the code is written, it must be possible to add it at -runtime to the running `gawk' interpreter. First, the code must be -compiled. Assuming that the functions are in a file named -`filefuncs.c', and IDIR is the location of the `gawk' include files, -the following steps create a GNU/Linux shared library: +Now that the code is written, it must be possible to add it at runtime +to the running `gawk' interpreter. First, the code must be compiled. +Assuming that the functions are in a file named `filefuncs.c', and IDIR +is the location of the `gawk' include files, the following steps create +a GNU/Linux shared library: $ gcc -shared -DHAVE_CONFIG_H -c -O -g -IIDIR filefuncs.c $ ld -o filefuncs.so -shared filefuncs.o - Once the library exists, it is loaded by calling the `extension' +Once the library exists, it is loaded by calling the `extension' built-in function. This function takes two arguments: the name of the library to load and the name of a function to call when the library is first loaded. This function adds the new functions to `gawk'. It @@ -19065,9 +19289,9 @@ shared library: # file testff.awk BEGIN { extension("./filefuncs.so", "dlload") - + chdir(".") # no-op - + data[1] = 1 # force `data' to be an array print "Info for testff.awk" ret = stat("testff.awk", data) @@ -19078,7 +19302,7 @@ shared library: strftime("%m %d %y %H:%M:%S", data["mtime"]) } - Here are the results of running the program: +Here are the results of running the program: $ gawk -f testff.awk -| Info for testff.awk @@ -19103,8 +19327,8 @@ shared library:  File: gawk.info, Node: Future Extensions, Prev: Dynamic Extensions, Up: Notes -Probable Future Extensions -========================== +C.4 Probable Future Extensions +============================== AWK is a language similar to PERL, only considerably more elegant. Arnold Robbins @@ -19112,12 +19336,12 @@ Probable Future Extensions Hey! Larry Wall - This minor node briefly lists extensions and possible improvements -that indicate the directions we are currently considering for `gawk'. -The file `FUTURES' in the `gawk' distribution lists these extensions as +This minor node briefly lists extensions and possible improvements that +indicate the directions we are currently considering for `gawk'. The +file `FUTURES' in the `gawk' distribution lists these extensions as well. - Following is a list of probable future changes visible at the `awk' +Following is a list of probable future changes visible at the `awk' language level: Loadable module interface @@ -19144,12 +19368,15 @@ Databases Large character sets It would be nice if `gawk' could handle UTF-8 and other character - sets that are larger than eight bits. + sets that are larger than eight bits. (`gawk' currently has + partial multi-byte support, but it needs an expert to really think + out the multi-byte issues and consult with the maintainer on the + appropriate changes.) More `lint' warnings There are more things that could be checked for portability. - Following is a list of probable improvements that will make `gawk''s +Following is a list of probable improvements that will make `gawk''s source code easier to work with: Loadable module mechanics @@ -19175,7 +19402,7 @@ Integrating the DBUG library Integrating Fred Fish's DBUG library would be helpful during development, but it's a lot of work to do. - Following is a list of probable improvements that will make `gawk' +Following is a list of probable improvements that will make `gawk' perform better: Compilation of `awk' programs @@ -19198,24 +19425,24 @@ Compilation of `awk' programs intermediate in speed between running a compiled program and doing what `gawk' does now. - Finally, the programs in the test suite could use documenting in -this Info file. +Finally, the programs in the test suite could use documenting in this +Info file. - *Note Additions::, if you are interested in tackling any of these +*Note Additions::, if you are interested in tackling any of these projects.  File: gawk.info, Node: Basic Concepts, Next: Glossary, Prev: Notes, Up: Top -Basic Programming Concepts -************************** +Appendix D Basic Programming Concepts +************************************* - This major node attempts to define some of the basic concepts and -terms that are used throughout the rest of this Info file. As this -Info file is specifically about `awk', and not about computer -programming in general, the coverage here is by necessity fairly -cursory and simplistic. (If you need more background, there are many -other introductory texts that you should refer to instead.) +This major node attempts to define some of the basic concepts and terms +that are used throughout the rest of this Info file. As this Info file +is specifically about `awk', and not about computer programming in +general, the coverage here is by necessity fairly cursory and +simplistic. (If you need more background, there are many other +introductory texts that you should refer to instead.) * Menu: @@ -19226,23 +19453,23 @@ other introductory texts that you should refer to instead.)  File: gawk.info, Node: Basic High Level, Next: Basic Data Typing, Up: Basic Concepts -What a Program Does -=================== +D.1 What a Program Does +======================= - At the most basic level, the job of a program is to process some -input data and produce results. +At the most basic level, the job of a program is to process some input +data and produce results. _______ +------+ / \ +---------+ | Data | -----> < Program > -----> | Results | +------+ \_______/ +---------+ - The "program" in the figure can be either a compiled program(1) -(such as `ls'), or it may be "interpreted". In the latter case, a +The "program" in the figure can be either a compiled program(1) (such +as `ls'), or it may be "interpreted". In the latter case, a machine-executable program such as `awk' reads your program, and then uses the instructions in your program to process the data. - When you write a program, it usually consists of the following, very +When you write a program, it usually consists of the following, very basic set of steps: ______ @@ -19289,145 +19516,145 @@ Clean Up plastic wrap to keep anyone from tasting it, as well as wash the mixing bowls and utensils. - An "algorithm" is a detailed set of instructions necessary to -accomplish a task, or process data. It is much the same as a recipe -for baking a cake. Programs implement algorithms. Often, it is up to -you to design the algorithm and implement it, simultaneously. +An "algorithm" is a detailed set of instructions necessary to accomplish +a task, or process data. It is much the same as a recipe for baking a +cake. Programs implement algorithms. Often, it is up to you to design +the algorithm and implement it, simultaneously. - The "logical chunks" we talked about previously are called "records", +The "logical chunks" we talked about previously are called "records", similar to the records a company keeps on employees, a school keeps for students, or a doctor keeps for patients. Each record has many component parts, such as first and last names, date of birth, address, and so on. The component parts are referred to as the "fields" of the record. - The act of reading data is termed "input", and that of generating +The act of reading data is termed "input", and that of generating results, not too surprisingly, is termed "output". They are often referred to together as "input/output," and even more often, as "I/O" for short. (You will also see "input" and "output" used as verbs.) - `awk' manages the reading of data for you, as well as the breaking -it up into records and fields. Your program's job is to tell `awk' -what to with the data. You do this by describing "patterns" in the -data to look for, and "actions" to execute when those patterns are -seen. This "data-driven" nature of `awk' programs usually makes them -both easier to write and easier to read. +`awk' manages the reading of data for you, as well as the breaking it +up into records and fields. Your program's job is to tell `awk' what +to with the data. You do this by describing "patterns" in the data to +look for, and "actions" to execute when those patterns are seen. This +"data-driven" nature of `awk' programs usually makes them both easier +to write and easier to read. - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) Compiled programs are typically written in lower-level languages +(1) Compiled programs are typically written in lower-level languages such as C, C++, Fortran, or Ada, and then translated, or "compiled", into a form that the computer can execute directly.  File: gawk.info, Node: Basic Data Typing, Next: Floating Point Issues, Prev: Basic High Level, Up: Basic Concepts -Data Values in a Computer -========================= +D.2 Data Values in a Computer +============================= - In a program, you keep track of information and values in things -called "variables". A variable is just a name for a given value, such -as `first_name', `last_name', `address', and so on. `awk' has several +In a program, you keep track of information and values in things called +"variables". A variable is just a name for a given value, such as +`first_name', `last_name', `address', and so on. `awk' has several predefined variables, and it has special names to refer to the current input record and the fields of the record. You may also group multiple associated values under one name, as an array. - Data, particularly in `awk', consists of either numeric values, such -as 42 or 3.1415927, or string values. String values are essentially +Data, particularly in `awk', consists of either numeric values, such as +42 or 3.1415927, or string values. String values are essentially anything that's not a number, such as a name. Strings are sometimes referred to as "character data", since they store the individual characters that comprise them. Individual variables, as well as numeric and string variables, are referred to as "scalar" values. Groups of values, such as arrays, are not scalars. - Within computers, there are two kinds of numeric values: "integers" -and "floating-point". In school, integer values were referred to as +Within computers, there are two kinds of numeric values: "integers" and +"floating-point". In school, integer values were referred to as "whole" numbers--that is, numbers without any fractional part, such as 1, 42, or -17. The advantage to integer numbers is that they represent values exactly. The disadvantage is that their range is limited. On most modern systems, this range is -2,147,483,648 to 2,147,483,647. - Integer values come in two flavors: "signed" and "unsigned". Signed +Integer values come in two flavors: "signed" and "unsigned". Signed values may be negative or positive, with the range of values just described. Unsigned values are always positive. On most modern systems, the range is from 0 to 4,294,967,295. - Floating-point numbers represent what are called "real" numbers; -i.e., those that do have a fractional part, such as 3.1415927. The -advantage to floating-point numbers is that they can represent a much -larger range of values. The disadvantage is that there are numbers -that they cannot represent exactly. `awk' uses "double-precision" -floating-point numbers, which can hold more digits than -"single-precision" floating-point numbers. Floating-point issues are -discussed more fully in *Note Floating Point Issues::. +Floating-point numbers represent what are called "real" numbers; i.e., +those that do have a fractional part, such as 3.1415927. The advantage +to floating-point numbers is that they can represent a much larger +range of values. The disadvantage is that there are numbers that they +cannot represent exactly. `awk' uses "double-precision" floating-point +numbers, which can hold more digits than "single-precision" +floating-point numbers. Floating-point issues are discussed more fully +in *Note Floating Point Issues::. - At the very lowest level, computers store values as groups of binary +At the very lowest level, computers store values as groups of binary digits, or "bits". Modern computers group bits into groups of eight, called "bytes". Advanced applications sometimes have to manipulate bits directly, and `gawk' provides functions for doing so. - While you are probably used to the idea of a number without a value +While you are probably used to the idea of a number without a value (i.e., zero), it takes a bit more getting used to the idea of zero-length character data. Nevertheless, such a thing exists. It is called the "null string". The null string is character data that has no value. In other words, it is empty. It is written in `awk' programs like this: `""'. - Humans are used to working in decimal; i.e., base 10. In base 10, +Humans are used to working in decimal; i.e., base 10. In base 10, numbers go from 0 to 9, and then "roll over" into the next column. (Remember grade school? 42 is 4 times 10 plus 2.) - There are other number bases though. Computers commonly use base 2 -or "binary", base 8 or "octal", and base 16 or "hexadecimal". In -binary, each column represents two times the value in the column to its -right. Each column may contain either a 0 or a 1. Thus, binary 1010 +There are other number bases though. Computers commonly use base 2 or +"binary", base 8 or "octal", and base 16 or "hexadecimal". In binary, +each column represents two times the value in the column to its right. +Each column may contain either a 0 or a 1. Thus, binary 1010 represents 1 times 8, plus 0 times 4, plus 1 times 2, plus 0 times 1, or decimal 10. Octal and hexadecimal are discussed more in *Note Nondecimal-numbers::. - Programs are written in programming languages. Hundreds, if not +Programs are written in programming languages. Hundreds, if not thousands, of programming languages exist. One of the most popular is the C programming language. The C language had a very strong influence on the design of the `awk' language. - There have been several versions of C. The first is often referred -to as "K&R" C, after the initials of Brian Kernighan and Dennis Ritchie, +There have been several versions of C. The first is often referred to +as "K&R" C, after the initials of Brian Kernighan and Dennis Ritchie, the authors of the first book on C. (Dennis Ritchie created the language, and Brian Kernighan was one of the creators of `awk'.) - In the mid-1980s, an effort began to produce an international -standard for C. This work culminated in 1989, with the production of -the ANSI standard for C. This standard became an ISO standard in 1990. -Where it makes sense, POSIX `awk' is compatible with 1990 ISO C. +In the mid-1980s, an effort began to produce an international standard +for C. This work culminated in 1989, with the production of the ANSI +standard for C. This standard became an ISO standard in 1990. Where +it makes sense, POSIX `awk' is compatible with 1990 ISO C. - In 1999, a revised ISO C standard was approved and released. Future +In 1999, a revised ISO C standard was approved and released. Future versions of `gawk' will be as compatible as possible with this standard.  File: gawk.info, Node: Floating Point Issues, Prev: Basic Data Typing, Up: Basic Concepts -Floating-Point Number Caveats -============================= +D.3 Floating-Point Number Caveats +================================= - As mentioned earlier, floating-point numbers represent what are -called "real" numbers, i.e., those that have a fractional part. `awk' -uses double-precision floating-point numbers to represent all numeric +As mentioned earlier, floating-point numbers represent what are called +"real" numbers, i.e., those that have a fractional part. `awk' uses +double-precision floating-point numbers to represent all numeric values. This minor node describes some of the issues involved in using floating-point numbers. - There is a very nice paper on floating-point arithmetic by David +There is a very nice paper on floating-point arithmetic by David Goldberg, "What Every Computer Scientist Should Know About Floating-point Arithmetic," `ACM Computing Surveys' *23*, 1 (1991-03), 5-48.(1) This is worth reading if you are interested in the details, but it does require a background in computer science. - Internally, `awk' keeps both the numeric value (double-precision +Internally, `awk' keeps both the numeric value (double-precision floating-point) and the string value for a variable. Separately, `awk' keeps track of what type the variable has (*note Typing and Comparison::), which plays a role in how variables are used in comparisons. - It is important to note that the string value for a number may not +It is important to note that the string value for a number may not reflect the full value (all the digits) that the numeric value actually contains. The following program (`values.awk') illustrates this: @@ -19446,26 +19673,26 @@ This program shows the full value of the sum of `$2' and `$3' using `printf', and then prints the string values obtained from both automatic conversion (via `CONVFMT') and from printing (via `OFMT'). - Here is what happens when the program is run: +Here is what happens when the program is run: $ echo 2 3.654321 1.2345678 | awk -f values.awk -| $1 = 4.8888888 -| a = <4.88889> -| $1 = 4.88889 - This makes it clear that the full numeric value is different from -what the default string representations show. +This makes it clear that the full numeric value is different from what +the default string representations show. - `CONVFMT''s default value is `"%.6g"', which yields a value with at +`CONVFMT''s default value is `"%.6g"', which yields a value with at least six significant digits. For some applications, you might want to change it to specify more precision. On most modern machines, most of the time, 17 digits is enough to capture a floating-point number's value exactly.(2) - Unlike numbers in the abstract sense (such as what you studied in -high school or college math), numbers stored in computers are limited -in certain ways. They cannot represent an infinite number of digits, -nor can they always represent things exactly. In particular, +Unlike numbers in the abstract sense (such as what you studied in high +school or college math), numbers stored in computers are limited in +certain ways. They cannot represent an infinite number of digits, nor +can they always represent things exactly. In particular, floating-point numbers cannot always represent values exactly. Here is an example: @@ -19484,14 +19711,14 @@ This shows that some values can be represented exactly, whereas others are only approximated. This is not a "bug" in `awk', but simply an artifact of how computers represent numbers. - Another peculiarity of floating-point numbers on modern systems is -that they often have more than one representation for the number zero! -In particular, it is possible to represent "minus zero" as well as +Another peculiarity of floating-point numbers on modern systems is that +they often have more than one representation for the number zero! In +particular, it is possible to represent "minus zero" as well as regular, or "positive" zero. - This example shows that negative and positive zero are distinct -values when stored internally, but that they are in fact equal to each -other, as well as to "regular" zero: +This example shows that negative and positive zero are distinct values +when stored internally, but that they are in fact equal to each other, +as well as to "regular" zero: $ gawk 'BEGIN { mz = -0 ; pz = 0 > printf "-0 = %g, +0 = %g, (-0 == +0) -> %d\n", mz, pz, mz == pz @@ -19500,16 +19727,16 @@ other, as well as to "regular" zero: -| -0 = -0, +0 = 0, (-0 == +0) -> 1 -| mz == 0 -> 1, pz == 0 -> 1 - It helps to keep this in mind should you process numeric data that +It helps to keep this in mind should you process numeric data that contains negative zero values; the fact that the zero is negative is noted and can affect comparisons. - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) `http://www.validlab.com/goldberg/paper.ps'. +(1) `http://www.validlab.com/goldberg/paper.ps'. - (2) Pathological cases can require up to 752 digits (!), but we -doubt that you need to worry about this. +(2) Pathological cases can require up to 752 digits (!), but we doubt +that you need to worry about this.  File: gawk.info, Node: Glossary, Next: Copying, Prev: Basic Concepts, Up: Top @@ -20118,16 +20345,16 @@ GNU General Public License Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111, 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 +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 @@ -20135,42 +20362,41 @@ 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. +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 +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. +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, +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 +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. +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 +The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION @@ -20408,38 +20634,37 @@ modification follow. How to Apply These Terms to Your New Programs ============================================= - If you develop a new program, and you want it to be of the greatest +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. +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. ONE LINE TO GIVE THE PROGRAM'S NAME AND AN IDEA OF WHAT IT DOES. Copyright (C) YEAR 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., 59 Temple Place, Suite 330, Boston, MA 02111, USA. - Also add information on how to contact you by electronic and paper -mail. +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: +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 @@ -20447,27 +20672,27 @@ this when it starts in an interactive mode: to redistribute it under certain conditions; type `show c' for details. - The hypothetical commands `show w' and `show c' should show the +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: +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. - + SIGNATURE OF TY COON, 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 +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 Lesser General Public License instead of this License. @@ -20480,7 +20705,7 @@ GNU Free Documentation License Version 1.2, November 2002 Copyright (C) 2000,2001,2002 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA - + Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -20874,7 +21099,7 @@ GNU Free Documentation License ADDENDUM: How to use this License for your documents ==================================================== - To use this License in a document you have written, include a copy of +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: @@ -20886,18 +21111,18 @@ notices just after the title page: A copy of the license is included in the section entitled ``GNU Free Documentation License''. - If you have Invariant Sections, Front-Cover Texts and Back-Cover -Texts, replace the "with...Texts." line with this: +If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, +replace the "with...Texts." line with this: with the Invariant Sections being LIST THEIR TITLES, with the Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST. - If you have Invariant Sections without Cover Texts, or some other +If you have Invariant Sections without Cover Texts, or some other combination of the three, merge those two alternatives to suit the situation. - If your document contains nontrivial examples of program code, we +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. @@ -20910,2395 +21135,2892 @@ Index * Menu: -* ! (exclamation point), ! operator: Boolean Ops. -* ! (exclamation point), ! operator <1>: Egrep Program. -* ! (exclamation point), ! operator: Precedence. -* ! (exclamation point), != operator <1>: Precedence. +* ! (exclamation point), ! operator: Boolean Ops. (line 6516) +* ! (exclamation point), ! operator <1>: Egrep Program. (line 14645) +* ! (exclamation point), ! operator: Precedence. (line 6690) +* ! (exclamation point), != operator <1>: Precedence. (line 6703) * ! (exclamation point), != operator: Typing and Comparison. + (line 6334) * ! (exclamation point), !~ operator <1>: Expression Patterns. -* ! (exclamation point), !~ operator <2>: Precedence. + (line 6843) +* ! (exclamation point), !~ operator <2>: Precedence. (line 6719) * ! (exclamation point), !~ operator <3>: Typing and Comparison. -* ! (exclamation point), !~ operator <4>: Regexp Constants. -* ! (exclamation point), !~ operator <5>: Computed Regexps. -* ! (exclamation point), !~ operator <6>: Case-sensitivity. -* ! (exclamation point), !~ operator: Regexp Usage. -* ! operator <1>: Egrep Program. -* ! operator: Ranges. -* " (double quote) <1>: Quoting. -* " (double quote): Read Terminal. -* " (double quote), regexp constants: Computed Regexps. + (line 6334) +* ! (exclamation point), !~ operator <4>: Regexp Constants. (line 5524) +* ! (exclamation point), !~ operator <5>: Computed Regexps. (line 2656) +* ! (exclamation point), !~ operator <6>: Case-sensitivity. (line 2569) +* ! (exclamation point), !~ operator: Regexp Usage. (line 1989) +* ! operator <1>: Egrep Program. (line 14653) +* ! operator: Ranges. (line 6947) +* " (double quote) <1>: Quoting. (line 1376) +* " (double quote): Read Terminal. (line 1165) +* " (double quote), regexp constants: Computed Regexps. (line 2677) * # (number sign), #! (executable scripts): Executable Scripts. + (line 1233) * # (number sign), #! (executable scripts), portability issues with: Executable Scripts. -* # (number sign), commenting: Comments. -* $ (dollar sign): Regexp Operators. -* $ (dollar sign), $ field operator <1>: Precedence. -* $ (dollar sign), $ field operator: Fields. + (line 1233) +* # (number sign), commenting: Comments. (line 1296) +* $ (dollar sign): Regexp Operators. (line 2210) +* $ (dollar sign), $ field operator <1>: Precedence. (line 6681) +* $ (dollar sign), $ field operator: Fields. (line 3019) * $ (dollar sign), incrementing fields and arrays: Increment Ops. -* $ field operator: Fields. -* % (percent sign), % operator: Precedence. -* % (percent sign), %= operator <1>: Precedence. -* % (percent sign), %= operator: Assignment Ops. -* & (ampersand), && operator <1>: Precedence. -* & (ampersand), && operator: Boolean Ops. + (line 6176) +* $ field operator: Fields. (line 3019) +* % (percent sign), % operator: Precedence. (line 6693) +* % (percent sign), %= operator <1>: Precedence. (line 6734) +* % (percent sign), %= operator: Assignment Ops. (line 6103) +* & (ampersand), && operator <1>: Precedence. (line 6725) +* & (ampersand), && operator: Boolean Ops. (line 6506) * & (ampersand), gsub/gensub/sub functions and: Gory Details. -* ' (single quote) <1>: Quoting. -* ' (single quote) <2>: Long. -* ' (single quote): One-shot. -* ' (single quote), vs. apostrophe: Comments. -* ' (single quote), with double quotes: Quoting. -* () (parentheses): Regexp Operators. -* () (parentheses), pgawk program: Profiling. + (line 9622) +* ' (single quote) <1>: Quoting. (line 1370) +* ' (single quote) <2>: Long. (line 1223) +* ' (single quote): One-shot. (line 1126) +* ' (single quote), vs. apostrophe: Comments. (line 1317) +* ' (single quote), with double quotes: Quoting. (line 1392) +* () (parentheses): Regexp Operators. (line 2253) +* () (parentheses), pgawk program: Profiling. (line 11862) * * (asterisk), * operator, as multiplication operator: Precedence. + (line 6693) * * (asterisk), * operator, as regexp operator: Regexp Operators. + (line 2261) * * (asterisk), * operator, null strings, matching: Gory Details. -* * (asterisk), ** operator <1>: Options. -* * (asterisk), ** operator <2>: Precedence. -* * (asterisk), ** operator: Arithmetic Ops. -* * (asterisk), **= operator <1>: Options. -* * (asterisk), **= operator <2>: Precedence. -* * (asterisk), **= operator: Assignment Ops. -* * (asterisk), *= operator <1>: Precedence. -* * (asterisk), *= operator: Assignment Ops. -* + (plus sign): Regexp Operators. -* + (plus sign), + operator: Precedence. -* + (plus sign), ++ operator <1>: Precedence. -* + (plus sign), ++ operator: Increment Ops. -* + (plus sign), += operator <1>: Precedence. -* + (plus sign), += operator: Assignment Ops. + (line 9776) +* * (asterisk), ** operator <1>: Options. (line 12157) +* * (asterisk), ** operator <2>: Precedence. (line 6687) +* * (asterisk), ** operator: Arithmetic Ops. (line 5890) +* * (asterisk), **= operator <1>: Options. (line 12157) +* * (asterisk), **= operator <2>: Precedence. (line 6734) +* * (asterisk), **= operator: Assignment Ops. (line 6103) +* * (asterisk), *= operator <1>: Precedence. (line 6734) +* * (asterisk), *= operator: Assignment Ops. (line 6103) +* + (plus sign): Regexp Operators. (line 2276) +* + (plus sign), + operator: Precedence. (line 6690) +* + (plus sign), ++ operator <1>: Precedence. (line 6684) +* + (plus sign), ++ operator: Increment Ops. (line 6186) +* + (plus sign), += operator <1>: Precedence. (line 6734) +* + (plus sign), += operator: Assignment Ops. (line 6056) * + (plus sign), decrement/increment operators: Increment Ops. -* , (comma), in range patterns: Ranges. -* - (hyphen), - operator: Precedence. + (line 6157) +* , (comma), in range patterns: Ranges. (line 6905) +* - (hyphen), - operator: Precedence. (line 6690) * - (hyphen), -- (decrement/increment) operator: Precedence. -* - (hyphen), -- operator: Increment Ops. -* - (hyphen), -= operator <1>: Precedence. -* - (hyphen), -= operator: Assignment Ops. -* - (hyphen), filenames beginning with: Options. -* - (hyphen), in character lists: Character Lists. -* --assign option: Options. -* --compat option: Options. -* --copyleft option: Options. -* --copyright option: Options. + (line 6684) +* - (hyphen), -- operator: Increment Ops. (line 6194) +* - (hyphen), -= operator <1>: Precedence. (line 6734) +* - (hyphen), -= operator: Assignment Ops. (line 6103) +* - (hyphen), filenames beginning with: Options. (line 12058) +* - (hyphen), in character lists: Character Lists. (line 2364) +* --assign option: Options. (line 12021) +* --compat option: Options. (line 12070) +* --copyleft option: Options. (line 12083) +* --copyright option: Options. (line 12078) * --disable-lint configuration option: Additional Configuration Options. + (line 17446) * --disable-nls configuration option: Additional Configuration Options. -* --dump-variables option <1>: Library Names. -* --dump-variables option: Options. + (line 17461) +* --dump-variables option <1>: Library Names. (line 12546) +* --dump-variables option: Options. (line 12086) * --enable-portals configuration option <1>: Additional Configuration Options. -* --enable-portals configuration option: Portal Files. + (line 17432) +* --enable-portals configuration option: Portal Files. (line 11710) * --enable-switch configuration option: Additional Configuration Options. -* --field-separator option: Options. -* --file option: Options. -* --gen-po option <1>: Options. -* --gen-po option: String Extraction. -* --help option: Options. -* --lint option <1>: Options. -* --lint option: Command Line. -* --lint-old option: Options. -* --non-decimal-data option <1>: Options. -* --non-decimal-data option: Nondecimal Data. + (line 17436) +* --field-separator option: Options. (line 12012) +* --file option: Options. (line 12016) +* --gen-po option <1>: Options. (line 12102) +* --gen-po option: String Extraction. (line 11157) +* --help option: Options. (line 12111) +* --lint option <1>: Options. (line 12116) +* --lint option: Command Line. (line 11987) +* --lint-old option: Options. (line 12128) +* --non-decimal-data option <1>: Options. (line 12133) +* --non-decimal-data option: Nondecimal Data. (line 11465) * --non-decimal-data option, strtonum function and: Nondecimal Data. -* --posix option: Options. -* --posix option, --traditional option and: Options. -* --profile option <1>: Options. -* --profile option: Profiling. -* --re-interval option: Options. -* --source option: Options. -* --traditional option: Options. -* --traditional option, --posix option and: Options. -* --usage option: Options. -* --version option: Options. + (line 11495) +* --posix option: Options. (line 12141) +* --posix option, --traditional option and: Options. (line 12168) +* --profile option <1>: Options. (line 12174) +* --profile option: Profiling. (line 11734) +* --re-interval option: Options. (line 12186) +* --source option: Options. (line 12193) +* --traditional option: Options. (line 12070) +* --traditional option, --posix option and: Options. (line 12168) +* --usage option: Options. (line 12111) +* --version option: Options. (line 12201) * --with-included-gettext configuration option <1>: Additional Configuration Options. -* --with-included-gettext configuration option: Gawk I18N. + (line 17440) +* --with-included-gettext configuration option: Gawk I18N. (line 11423) * --with-included-gettext configuration option, configuring gawk with: Additional Configuration Options. -* -f option: Options. -* -F option <1>: Options. + (line 17440) +* -f option: Options. (line 12016) +* -F option <1>: Options. (line 12012) * -F option: Command Line Field Separator. -* -f option: Long. -* -F option, -Ft sets FS to TAB: Options. -* -f option, on command line: Options. -* -F option, troubleshooting: Known Bugs. -* -mf/-mr options: Options. -* -v option: Options. + (line 3419) +* -f option: Long. (line 1202) +* -F option, -Ft sets FS to TAB: Options. (line 12209) +* -f option, on command line: Options. (line 12214) +* -F option, troubleshooting: Known Bugs. (line 12420) +* -mf/-mr options: Options. (line 12036) +* -v option: Options. (line 12021) * -v option, variables, assigning: Assignment Options. -* -W option: Options. -* . (period): Regexp Operators. + (line 5669) +* -W option: Options. (line 12046) +* . (period): Regexp Operators. (line 2218) * .mo files: Explaining gettext. -* .mo files, converting from .po: I18N Example. -* .mo files, specifying directory of <1>: Programmer i18n. + (line 10934) +* .mo files, converting from .po: I18N Example. (line 11380) +* .mo files, specifying directory of <1>: Programmer i18n. (line 11070) * .mo files, specifying directory of: Explaining gettext. -* .po files <1>: Translator i18n. + (line 10946) +* .po files <1>: Translator i18n. (line 11136) * .po files: Explaining gettext. -* .po files, converting to .mo: I18N Example. -* / (forward slash): Regexp. -* / (forward slash), / operator: Precedence. -* / (forward slash), /= operator <1>: Precedence. -* / (forward slash), /= operator: Assignment Ops. + (line 10931) +* .po files, converting to .mo: I18N Example. (line 11380) +* / (forward slash): Regexp. (line 1949) +* / (forward slash), / operator: Precedence. (line 6693) +* / (forward slash), /= operator <1>: Precedence. (line 6734) +* / (forward slash), /= operator: Assignment Ops. (line 6103) * / (forward slash), /= operator, vs. /=.../ regexp constant: Assignment Ops. + (line 6129) * / (forward slash), patterns and: Expression Patterns. -* /= operator vs. /=.../ regexp constant: Assignment Ops. -* /dev/... special files (gawk): Special FD. -* /inet/ files (gawk): TCP/IP Networking. -* /p files (gawk): Portal Files. -* ; (semicolon): Statements/Lines. -* ; (semicolon), AWKPATH variable and: PC Using. + (line 6843) +* /= operator vs. /=.../ regexp constant: Assignment Ops. (line 6129) +* /dev/... special files (gawk): Special FD. (line 5046) +* /inet/ files (gawk): TCP/IP Networking. (line 11643) +* /p files (gawk): Portal Files. (line 11710) +* ; (semicolon): Statements/Lines. (line 1853) +* ; (semicolon), AWKPATH variable and: PC Using. (line 17826) * ; (semicolon), separating statements in actions <1>: Statements. + (line 7220) * ; (semicolon), separating statements in actions: Action Overview. -* < (left angle bracket), < operator <1>: Precedence. + (line 7170) +* < (left angle bracket), < operator <1>: Precedence. (line 6703) * < (left angle bracket), < operator: Typing and Comparison. -* < (left angle bracket), < operator (I/O): Getline/File. -* < (left angle bracket), <= operator <1>: Precedence. + (line 6334) +* < (left angle bracket), < operator (I/O): Getline/File. (line 3971) +* < (left angle bracket), <= operator <1>: Precedence. (line 6703) * < (left angle bracket), <= operator: Typing and Comparison. -* = (equals sign), = operator: Assignment Ops. -* = (equals sign), == operator <1>: Precedence. + (line 6334) +* = (equals sign), = operator: Assignment Ops. (line 5981) +* = (equals sign), == operator <1>: Precedence. (line 6703) * = (equals sign), == operator: Typing and Comparison. -* > (right angle bracket), > operator <1>: Precedence. + (line 6334) +* > (right angle bracket), > operator <1>: Precedence. (line 6703) * > (right angle bracket), > operator: Typing and Comparison. -* > (right angle bracket), > operator (I/O): Redirection. -* > (right angle bracket), >= operator <1>: Precedence. + (line 6334) +* > (right angle bracket), > operator (I/O): Redirection. (line 4856) +* > (right angle bracket), >= operator <1>: Precedence. (line 6703) * > (right angle bracket), >= operator: Typing and Comparison. + (line 6334) * > (right angle bracket), >> operator (I/O) <1>: Precedence. -* > (right angle bracket), >> operator (I/O): Redirection. + (line 6703) +* > (right angle bracket), >> operator (I/O): Redirection. (line 4884) * ? (question mark) <1>: GNU Regexp Operators. -* ? (question mark): Regexp Operators. -* ? (question mark), ?: operator: Precedence. -* [] (square brackets): Regexp Operators. -* \ (backslash) <1>: Regexp Operators. -* \ (backslash) <2>: Quoting. -* \ (backslash) <3>: Comments. -* \ (backslash): Read Terminal. -* \ (backslash), \" escape sequence: Escape Sequences. + (line 2506) +* ? (question mark): Regexp Operators. (line 2285) +* ? (question mark), ?: operator: Precedence. (line 6731) +* [] (square brackets): Regexp Operators. (line 2230) +* \ (backslash) <1>: Regexp Operators. (line 2193) +* \ (backslash) <2>: Quoting. (line 1370) +* \ (backslash) <3>: Comments. (line 1339) +* \ (backslash): Read Terminal. (line 1165) +* \ (backslash), \" escape sequence: Escape Sequences. (line 2108) * \ (backslash), \' operator (gawk): GNU Regexp Operators. -* \ (backslash), \/ escape sequence: Escape Sequences. + (line 2503) +* \ (backslash), \/ escape sequence: Escape Sequences. (line 2101) * \ (backslash), \< operator (gawk): GNU Regexp Operators. + (line 2477) * \ (backslash), \> operator (gawk): GNU Regexp Operators. + (line 2481) * \ (backslash), \` operator (gawk): GNU Regexp Operators. -* \ (backslash), \a escape sequence: Escape Sequences. -* \ (backslash), \b escape sequence: Escape Sequences. + (line 2501) +* \ (backslash), \a escape sequence: Escape Sequences. (line 2066) +* \ (backslash), \b escape sequence: Escape Sequences. (line 2070) * \ (backslash), \B operator (gawk): GNU Regexp Operators. -* \ (backslash), \f escape sequence: Escape Sequences. -* \ (backslash), \n escape sequence: Escape Sequences. -* \ (backslash), \NNN escape sequence: Escape Sequences. -* \ (backslash), \r escape sequence: Escape Sequences. -* \ (backslash), \t escape sequence: Escape Sequences. -* \ (backslash), \v escape sequence: Escape Sequences. + (line 2490) +* \ (backslash), \f escape sequence: Escape Sequences. (line 2073) +* \ (backslash), \n escape sequence: Escape Sequences. (line 2076) +* \ (backslash), \NNN escape sequence: Escape Sequences. (line 2088) +* \ (backslash), \r escape sequence: Escape Sequences. (line 2079) +* \ (backslash), \t escape sequence: Escape Sequences. (line 2082) +* \ (backslash), \v escape sequence: Escape Sequences. (line 2085) * \ (backslash), \W operator (gawk): GNU Regexp Operators. + (line 2473) * \ (backslash), \w operator (gawk): GNU Regexp Operators. -* \ (backslash), \x escape sequence: Escape Sequences. + (line 2468) +* \ (backslash), \x escape sequence: Escape Sequences. (line 2093) * \ (backslash), \y operator (gawk): GNU Regexp Operators. + (line 2485) * \ (backslash), as field separators: Command Line Field Separator. -* \ (backslash), continuing lines and <1>: Egrep Program. -* \ (backslash), continuing lines and: Statements/Lines. + (line 3440) +* \ (backslash), continuing lines and <1>: Egrep Program. (line 14703) +* \ (backslash), continuing lines and: Statements/Lines. (line 1783) * \ (backslash), continuing lines and, comments and: Statements/Lines. + (line 1838) * \ (backslash), continuing lines and, in csh <1>: Statements/Lines. + (line 1807) * \ (backslash), continuing lines and, in csh: More Complex. + (line 1708) * \ (backslash), gsub/gensub/sub functions and: Gory Details. -* \ (backslash), in character lists: Character Lists. -* \ (backslash), in escape sequences: Escape Sequences. + (line 9622) +* \ (backslash), in character lists: Character Lists. (line 2364) +* \ (backslash), in escape sequences: Escape Sequences. (line 2038) * \ (backslash), in escape sequences, POSIX and: Escape Sequences. -* \ (backslash), regexp constants: Computed Regexps. + (line 2145) +* \ (backslash), regexp constants: Computed Regexps. (line 2677) * ^ (caret) <1>: GNU Regexp Operators. -* ^ (caret): Regexp Operators. -* ^ (caret), ^ operator <1>: Options. -* ^ (caret), ^ operator: Precedence. -* ^ (caret), ^= operator <1>: Options. -* ^ (caret), ^= operator <2>: Precedence. -* ^ (caret), ^= operator: Assignment Ops. -* ^ (caret), in character lists: Character Lists. + (line 2506) +* ^ (caret): Regexp Operators. (line 2197) +* ^ (caret), ^ operator <1>: Options. (line 12157) +* ^ (caret), ^ operator: Precedence. (line 6687) +* ^ (caret), ^= operator <1>: Options. (line 12157) +* ^ (caret), ^= operator <2>: Precedence. (line 6734) +* ^ (caret), ^= operator: Assignment Ops. (line 6103) +* ^ (caret), in character lists: Character Lists. (line 2364) * _ (underscore), _ C macro: Explaining gettext. + (line 10963) * _ (underscore), in names of private variables: Library Names. -* _ (underscore), translatable string: Programmer i18n. -* _gr_init user-defined function: Group Functions. -* _pw_init user-defined function: Passwd Functions. -* accessing fields: Fields. -* account information <1>: Group Functions. -* account information: Passwd Functions. -* actions: Action Overview. -* actions, control statements in: Statements. -* actions, default: Very Simple. -* actions, empty: Very Simple. -* adding, features to gawk: Adding Code. -* adding, fields: Changing Fields. + (line 12530) +* _ (underscore), translatable string: Programmer i18n. (line 11092) +* _gr_init user-defined function: Group Functions. (line 14008) +* _pw_init user-defined function: Passwd Functions. (line 13794) +* accessing fields: Fields. (line 3006) +* account information <1>: Group Functions. (line 13934) +* account information: Passwd Functions. (line 13719) +* actions: Action Overview. (line 7157) +* actions, control statements in: Statements. (line 7216) +* actions, default: Very Simple. (line 1559) +* actions, empty: Very Simple. (line 1564) +* adding, features to gawk: Adding Code. (line 18515) +* adding, fields: Changing Fields. (line 3169) * adding, functions to gawk: Dynamic Extensions. -* advanced features, buffering: I/O Functions. + (line 18733) +* advanced features, buffering: I/O Functions. (line 9884) * advanced features, close function: Close Files And Pipes. + (line 5315) * advanced features, constants, values of: Nondecimal-numbers. -* advanced features, data files as single record: Records. -* advanced features, fixed-width data: Constant Size. -* advanced features, FNR/NR variables: Auto-set. -* advanced features, gawk: Advanced Features. -* advanced features, gawk, BSD portals: Portal Files. + (line 5510) +* advanced features, data files as single record: Records. (line 2971) +* advanced features, fixed-width data: Constant Size. (line 3597) +* advanced features, FNR/NR variables: Auto-set. (line 8140) +* advanced features, gawk: Advanced Features. (line 11434) +* advanced features, gawk, BSD portals: Portal Files. (line 11710) * advanced features, gawk, network programming: TCP/IP Networking. + (line 11643) * advanced features, gawk, nondecimal input data: Nondecimal Data. + (line 11465) * advanced features, gawk, processes, communicating with: Two-way I/O. + (line 11524) * advanced features, network connections, See Also networks, connections: Advanced Features. -* advanced features, null strings, matching: Gory Details. -* advanced features, operators, precedence: Increment Ops. -* advanced features, piping into sh: Redirection. -* advanced features, regexp constants: Assignment Ops. -* Aho, Alfred <1>: Contributors. -* Aho, Alfred: History. -* alarm clock example program: Alarm Program. -* alarm.awk program: Alarm Program. -* algorithms: Basic High Level. -* Alpha (DEC): Manual History. -* amazing awk assembler (aaa): Glossary. -* amazingly workable formatter (awf): Glossary. + (line 11434) +* advanced features, null strings, matching: Gory Details. (line 9776) +* advanced features, operators, precedence: Increment Ops. (line 6207) +* advanced features, piping into sh: Redirection. (line 4973) +* advanced features, regexp constants: Assignment Ops. (line 6129) +* Aho, Alfred <1>: Contributors. (line 17022) +* Aho, Alfred: History. (line 640) +* alarm clock example program: Alarm Program. (line 15446) +* alarm.awk program: Alarm Program. (line 15464) +* algorithms: Basic High Level. (line 19519) +* Alpha (DEC): Manual History. (line 886) +* amazing awk assembler (aaa): Glossary. (line 19753) +* amazingly workable formatter (awf): Glossary. (line 19761) * ambiguity, syntactic: /= operator vs. /=.../ regexp constant: Assignment Ops. + (line 6129) * amiga: Amiga Installation. -* ampersand (&), && operator: Boolean Ops. -* ampersand (&), &&operator: Precedence. + (line 17535) +* ampersand (&), && operator: Boolean Ops. (line 6506) +* ampersand (&), &&operator: Precedence. (line 6725) * ampersand (&), gsub/gensub/sub functions and: Gory Details. -* AND bitwise operation: Bitwise Functions. -* and Boolean-logic operator: Boolean Ops. -* and function (gawk): Bitwise Functions. -* ANSI: Glossary. -* archeologists: Bugs. -* ARGC/ARGV variables <1>: ARGC and ARGV. -* ARGC/ARGV variables: Auto-set. + (line 9622) +* AND bitwise operation: Bitwise Functions. (line 10294) +* and Boolean-logic operator: Boolean Ops. (line 6455) +* and function (gawk): Bitwise Functions. (line 10327) +* ANSI: Glossary. (line 19772) +* archeologists: Bugs. (line 18282) +* ARGC/ARGV variables <1>: ARGC and ARGV. (line 8172) +* ARGC/ARGV variables: Auto-set. (line 7964) * ARGC/ARGV variables, command-line arguments: Other Arguments. + (line 12277) * ARGC/ARGV variables, portability and: Executable Scripts. -* ARGIND variable: Auto-set. -* ARGIND variable, command-line arguments: Other Arguments. -* arguments, command-line <1>: Other Arguments. -* arguments, command-line <2>: ARGC and ARGV. -* arguments, command-line: Auto-set. -* arguments, command-line, invoking awk: Command Line. -* arguments, in function calls: Function Calls. -* arguments, processing: Getopt Function. -* arguments, retrieving: Internals. -* arithmetic operators: Arithmetic Ops. -* arrays: Arrays. -* arrays, as parameters to functions: Function Caveats. -* arrays, associative: Array Intro. -* arrays, associative, clearing: Internals. + (line 1270) +* ARGIND variable: Auto-set. (line 7993) +* ARGIND variable, command-line arguments: Other Arguments. (line 12277) +* arguments, command-line <1>: Other Arguments. (line 12271) +* arguments, command-line <2>: ARGC and ARGV. (line 8172) +* arguments, command-line: Auto-set. (line 7964) +* arguments, command-line, invoking awk: Command Line. (line 11973) +* arguments, in function calls: Function Calls. (line 6595) +* arguments, processing: Getopt Function. (line 13426) +* arguments, retrieving: Internals. (line 18870) +* arithmetic operators: Arithmetic Ops. (line 5815) +* arrays: Arrays. (line 8268) +* arrays, as parameters to functions: Function Caveats. (line 10696) +* arrays, associative: Array Intro. (line 8348) +* arrays, associative, clearing: Internals. (line 18815) * arrays, associative, library functions and: Library Names. -* arrays, deleting entire contents: Delete. + (line 12558) +* arrays, deleting entire contents: Delete. (line 8610) * arrays, elements, assigning: Assigning Elements. -* arrays, elements, deleting: Delete. -* arrays, elements, installing: Internals. -* arrays, elements, order of: Scanning an Array. + (line 8452) +* arrays, elements, deleting: Delete. (line 8577) +* arrays, elements, installing: Internals. (line 18819) +* arrays, elements, order of: Scanning an Array. (line 8563) * arrays, elements, referencing: Reference to Elements. -* arrays, elements, retrieving number of: String Functions. -* arrays, for statement and: Scanning an Array. -* arrays, IGNORECASE variable and: Array Intro. -* arrays, indexing: Array Intro. -* arrays, merging into strings: Join Function. -* arrays, multidimensional: Multi-dimensional. -* arrays, multidimensional, scanning: Multi-scanning. -* arrays, names of: Arrays. -* arrays, scanning: Scanning an Array. -* arrays, sorting: Array Sorting. -* arrays, sorting, IGNORECASE variable and: Array Sorting. -* arrays, sparse: Array Intro. + (line 8405) +* arrays, elements, retrieving number of: String Functions. (line 9168) +* arrays, for statement and: Scanning an Array. (line 8536) +* arrays, IGNORECASE variable and: Array Intro. (line 8390) +* arrays, indexing: Array Intro. (line 8348) +* arrays, merging into strings: Join Function. (line 13033) +* arrays, multidimensional: Multi-dimensional. (line 8746) +* arrays, multidimensional, scanning: Multi-scanning. (line 8832) +* arrays, names of: Arrays. (line 8279) +* arrays, scanning: Scanning an Array. (line 8522) +* arrays, sorting: Array Sorting. (line 8867) +* arrays, sorting, IGNORECASE variable and: Array Sorting. (line 8945) +* arrays, sparse: Array Intro. (line 8369) * arrays, subscripts: Numeric Array Subscripts. + (line 8648) * arrays, subscripts, uninitialized variables as: Uninitialized Subscripts. + (line 8699) * artificial intelligence, gawk and: Distribution contents. -* ASCII: Ordinal Functions. -* asort function (gawk) <1>: String Functions. -* asort function (gawk): Array Sorting. -* asort function (gawk), arrays, sorting: Array Sorting. -* asorti function (gawk): String Functions. -* assert function (C library): Assert Function. -* assert user-defined function: Assert Function. -* assertions: Assert Function. -* assignment operators: Assignment Ops. -* assignment operators, evaluation order: Assignment Ops. -* assignment operators, lvalues/rvalues: Assignment Ops. -* assignments as filenames: Ignoring Assigns. -* assoc_clear internal function: Internals. -* assoc_lookup internal function: Internals. -* associative arrays: Array Intro. + (line 17254) +* ASCII: Ordinal Functions. (line 12980) +* asort function (gawk) <1>: String Functions. (line 9168) +* asort function (gawk): Array Sorting. (line 8867) +* asort function (gawk), arrays, sorting: Array Sorting. (line 8867) +* asorti function (gawk): String Functions. (line 9197) +* assert function (C library): Assert Function. (line 12781) +* assert user-defined function: Assert Function. (line 12803) +* assertions: Assert Function. (line 12781) +* assignment operators: Assignment Ops. (line 5981) +* assignment operators, evaluation order: Assignment Ops. (line 6085) +* assignment operators, lvalues/rvalues: Assignment Ops. (line 6006) +* assignments as filenames: Ignoring Assigns. (line 13384) +* assoc_clear internal function: Internals. (line 18815) +* assoc_lookup internal function: Internals. (line 18819) +* associative arrays: Array Intro. (line 8348) * asterisk (*), * operator, as multiplication operator: Precedence. + (line 6693) * asterisk (*), * operator, as regexp operator: Regexp Operators. + (line 2261) * asterisk (*), * operator, null strings, matching: Gory Details. -* asterisk (*), ** operator <1>: Options. -* asterisk (*), ** operator <2>: Precedence. -* asterisk (*), ** operator: Arithmetic Ops. -* asterisk (*), **= operator <1>: Options. -* asterisk (*), **= operator <2>: Precedence. -* asterisk (*), **= operator: Assignment Ops. -* asterisk (*), *= operator <1>: Precedence. -* asterisk (*), *= operator: Assignment Ops. -* atan2 function: Numeric Functions. + (line 9776) +* asterisk (*), ** operator <1>: Options. (line 12157) +* asterisk (*), ** operator <2>: Precedence. (line 6687) +* asterisk (*), ** operator: Arithmetic Ops. (line 5890) +* asterisk (*), **= operator <1>: Options. (line 12157) +* asterisk (*), **= operator <2>: Precedence. (line 6734) +* asterisk (*), **= operator: Assignment Ops. (line 6103) +* asterisk (*), *= operator <1>: Precedence. (line 6734) +* asterisk (*), *= operator: Assignment Ops. (line 6103) +* atan2 function: Numeric Functions. (line 9074) * atari: Atari Installation. -* awf (amazingly workable formatter) program: Glossary. -* awk language, POSIX version: Assignment Ops. -* awk programs <1>: Two Rules. + (line 18129) +* awf (amazingly workable formatter) program: Glossary. (line 19761) +* awk language, POSIX version: Assignment Ops. (line 6114) +* awk programs <1>: Two Rules. (line 1647) * awk programs <2>: Executable Scripts. -* awk programs: Getting Started. -* awk programs, complex: When. -* awk programs, documenting <1>: Library Names. -* awk programs, documenting: Comments. -* awk programs, examples of: Sample Programs. -* awk programs, execution of: Next Statement. -* awk programs, internationalizing <1>: Programmer i18n. -* awk programs, internationalizing: I18N Functions. -* awk programs, lengthy: Long. -* awk programs, lengthy, assertions: Assert Function. -* awk programs, location of: Options. -* awk programs, one-line examples: Very Simple. -* awk programs, profiling: Profiling. -* awk programs, profiling, enabling: Options. -* awk programs, running <1>: Long. -* awk programs, running: Running gawk. -* awk programs, running, from shell scripts: One-shot. + (line 1233) +* awk programs: Getting Started. (line 1038) +* awk programs, complex: When. (line 1923) +* awk programs, documenting <1>: Library Names. (line 12507) +* awk programs, documenting: Comments. (line 1296) +* awk programs, examples of: Sample Programs. (line 14166) +* awk programs, execution of: Next Statement. (line 7637) +* awk programs, internationalizing <1>: Programmer i18n. (line 11031) +* awk programs, internationalizing: I18N Functions. (line 10416) +* awk programs, lengthy: Long. (line 1196) +* awk programs, lengthy, assertions: Assert Function. (line 12781) +* awk programs, location of: Options. (line 12016) +* awk programs, one-line examples: Very Simple. (line 1570) +* awk programs, profiling: Profiling. (line 11725) +* awk programs, profiling, enabling: Options. (line 12174) +* awk programs, running <1>: Long. (line 1196) +* awk programs, running: Running gawk. (line 1084) +* awk programs, running, from shell scripts: One-shot. (line 1133) * awk programs, running, without input files: Read Terminal. + (line 1157) * awk programs, shell variables in: Using Shell Variables. -* awk, function of: Getting Started. -* awk, gawk and <1>: This Manual. -* awk, gawk and: Preface. -* awk, history of: History. -* awk, implementation issues, pipes: Redirection. -* awk, implementations: Other Versions. -* awk, implementations, limits: Getline Notes. -* awk, invoking: Command Line. -* awk, new vs. old: Names. -* awk, new vs. old, OFMT variable: Conversion. -* awk, POSIX and: Preface. -* awk, POSIX and, See Also POSIX awk: Preface. + (line 7106) +* awk, function of: Getting Started. (line 1032) +* awk, gawk and <1>: This Manual. (line 718) +* awk, gawk and: Preface. (line 569) +* awk, history of: History. (line 640) +* awk, implementation issues, pipes: Redirection. (line 4965) +* awk, implementations: Other Versions. (line 18351) +* awk, implementations, limits: Getline Notes. (line 4185) +* awk, invoking: Command Line. (line 11973) +* awk, new vs. old: Names. (line 677) +* awk, new vs. old, OFMT variable: Conversion. (line 5759) +* awk, POSIX and: Preface. (line 569) +* awk, POSIX and, See Also POSIX awk: Preface. (line 569) * awk, regexp constants and: Typing and Comparison. -* awk, See Also gawk: Preface. -* awk, terms describing: This Manual. -* awk, uses for <1>: When. -* awk, uses for <2>: Getting Started. -* awk, uses for: Preface. -* awk, versions of <1>: V7/SVR3.1. -* awk, versions of: Names. -* awk, versions of, changes between SVR3.1 and SVR4: SVR4. + (line 6434) +* awk, See Also gawk: Preface. (line 582) +* awk, terms describing: This Manual. (line 711) +* awk, uses for <1>: When. (line 1899) +* awk, uses for <2>: Getting Started. (line 1038) +* awk, uses for: Preface. (line 569) +* awk, versions of <1>: V7/SVR3.1. (line 16631) +* awk, versions of: Names. (line 681) +* awk, versions of, changes between SVR3.1 and SVR4: SVR4. (line 16690) * awk, versions of, changes between SVR4 and POSIX awk: POSIX. + (line 16731) * awk, versions of, changes between V7 and SVR3.1: V7/SVR3.1. -* awk, versions of, See Also Bell Laboratories awk: BTL. -* awk.h file (internal): Internals. -* awka compiler for awk: Other Versions. -* AWKNUM internal type: Internals. -* AWKPATH environment variable <1>: PC Using. -* AWKPATH environment variable: AWKPATH Variable. -* awkprof.out file: Profiling. -* awksed.awk program: Simple Sed. -* awkvars.out file: Options. -* backslash (\) <1>: Regexp Operators. -* backslash (\) <2>: Quoting. -* backslash (\) <3>: Comments. -* backslash (\): Read Terminal. -* backslash (\), \" escape sequence: Escape Sequences. + (line 16631) +* awk, versions of, See Also Bell Laboratories awk: BTL. (line 16775) +* awk.h file (internal): Internals. (line 18764) +* awka compiler for awk: Other Versions. (line 18421) +* AWKNUM internal type: Internals. (line 18768) +* AWKPATH environment variable <1>: PC Using. (line 17826) +* AWKPATH environment variable: AWKPATH Variable. (line 12327) +* awkprof.out file: Profiling. (line 11729) +* awksed.awk program: Simple Sed. (line 16155) +* awkvars.out file: Options. (line 12086) +* backslash (\) <1>: Regexp Operators. (line 2193) +* backslash (\) <2>: Quoting. (line 1370) +* backslash (\) <3>: Comments. (line 1339) +* backslash (\): Read Terminal. (line 1165) +* backslash (\), \" escape sequence: Escape Sequences. (line 2108) * backslash (\), \' operator (gawk): GNU Regexp Operators. -* backslash (\), \/ escape sequence: Escape Sequences. + (line 2503) +* backslash (\), \/ escape sequence: Escape Sequences. (line 2101) * backslash (\), \< operator (gawk): GNU Regexp Operators. + (line 2477) * backslash (\), \> operator (gawk): GNU Regexp Operators. + (line 2481) * backslash (\), \` operator (gawk): GNU Regexp Operators. -* backslash (\), \a escape sequence: Escape Sequences. -* backslash (\), \b escape sequence: Escape Sequences. + (line 2501) +* backslash (\), \a escape sequence: Escape Sequences. (line 2066) +* backslash (\), \b escape sequence: Escape Sequences. (line 2070) * backslash (\), \B operator (gawk): GNU Regexp Operators. -* backslash (\), \f escape sequence: Escape Sequences. -* backslash (\), \n escape sequence: Escape Sequences. -* backslash (\), \NNN escape sequence: Escape Sequences. -* backslash (\), \r escape sequence: Escape Sequences. -* backslash (\), \t escape sequence: Escape Sequences. -* backslash (\), \v escape sequence: Escape Sequences. + (line 2490) +* backslash (\), \f escape sequence: Escape Sequences. (line 2073) +* backslash (\), \n escape sequence: Escape Sequences. (line 2076) +* backslash (\), \NNN escape sequence: Escape Sequences. (line 2088) +* backslash (\), \r escape sequence: Escape Sequences. (line 2079) +* backslash (\), \t escape sequence: Escape Sequences. (line 2082) +* backslash (\), \v escape sequence: Escape Sequences. (line 2085) * backslash (\), \W operator (gawk): GNU Regexp Operators. + (line 2473) * backslash (\), \w operator (gawk): GNU Regexp Operators. -* backslash (\), \x escape sequence: Escape Sequences. + (line 2468) +* backslash (\), \x escape sequence: Escape Sequences. (line 2093) * backslash (\), \y operator (gawk): GNU Regexp Operators. + (line 2485) * backslash (\), as field separators: Command Line Field Separator. -* backslash (\), continuing lines and <1>: Egrep Program. -* backslash (\), continuing lines and: Statements/Lines. + (line 3440) +* backslash (\), continuing lines and <1>: Egrep Program. (line 14703) +* backslash (\), continuing lines and: Statements/Lines. (line 1783) * backslash (\), continuing lines and, comments and: Statements/Lines. + (line 1838) * backslash (\), continuing lines and, in csh <1>: Statements/Lines. + (line 1807) * backslash (\), continuing lines and, in csh: More Complex. + (line 1708) * backslash (\), gsub/gensub/sub functions and: Gory Details. -* backslash (\), in character lists: Character Lists. -* backslash (\), in escape sequences: Escape Sequences. + (line 9622) +* backslash (\), in character lists: Character Lists. (line 2364) +* backslash (\), in escape sequences: Escape Sequences. (line 2038) * backslash (\), in escape sequences, POSIX and: Escape Sequences. -* backslash (\), regexp constants: Computed Regexps. -* BBS-list file: Sample Data Files. -* Beebe, Nelson: Acknowledgments. -* Beebe, Nelson H.F.: Other Versions. -* BEGIN pattern <1>: BEGIN/END. -* BEGIN pattern <2>: Field Separators. -* BEGIN pattern: Records. + (line 2145) +* backslash (\), regexp constants: Computed Regexps. (line 2677) +* BBS-list file: Sample Data Files. (line 1461) +* Beebe, Nelson: Acknowledgments. (line 995) +* Beebe, Nelson H.F.: Other Versions. (line 18433) +* BEGIN pattern <1>: BEGIN/END. (line 6972) +* BEGIN pattern <2>: Field Separators. (line 3292) +* BEGIN pattern: Records. (line 2839) * BEGIN pattern, assert user-defined function and: Assert Function. + (line 12857) * BEGIN pattern, Boolean patterns and: Expression Patterns. -* BEGIN pattern, exit statement and: Exit Statement. -* BEGIN pattern, getline and: Getline Notes. -* BEGIN pattern, headings, adding: Print Examples. + (line 6892) +* BEGIN pattern, exit statement and: Exit Statement. (line 7735) +* BEGIN pattern, getline and: Getline Notes. (line 4190) +* BEGIN pattern, headings, adding: Print Examples. (line 4342) * BEGIN pattern, next/nextfile statements and <1>: Next Statement. + (line 7660) * BEGIN pattern, next/nextfile statements and: I/O And BEGIN/END. + (line 7080) * BEGIN pattern, OFS/ORS variables, assigning values to: Output Separators. -* BEGIN pattern, operators and: Using BEGIN/END. -* BEGIN pattern, pgawk program: Profiling. -* BEGIN pattern, print statement and: I/O And BEGIN/END. -* BEGIN pattern, pwcat program: Passwd Functions. -* BEGIN pattern, running awk programs and: Cut Program. -* BEGIN pattern, TEXTDOMAIN variable and: Programmer i18n. + (line 4399) +* BEGIN pattern, operators and: Using BEGIN/END. (line 7002) +* BEGIN pattern, pgawk program: Profiling. (line 11787) +* BEGIN pattern, print statement and: I/O And BEGIN/END. (line 7060) +* BEGIN pattern, pwcat program: Passwd Functions. (line 13828) +* BEGIN pattern, running awk programs and: Cut Program. (line 14297) +* BEGIN pattern, TEXTDOMAIN variable and: Programmer i18n. (line 11083) * beginfile user-defined function: Filetrans Function. -* Bell Laboratories awk extensions: BTL. -* Benzinger, Michael: Contributors. -* BeOS: BeOS Installation. -* Berry, Karl: Acknowledgments. -* binary input/output: User-modified. + (line 13231) +* Bell Laboratories awk extensions: BTL. (line 16775) +* Benzinger, Michael: Contributors. (line 17095) +* BeOS: BeOS Installation. (line 17568) +* Berry, Karl: Acknowledgments. (line 972) +* binary input/output: User-modified. (line 7809) * bindtextdomain function (C library): Explaining gettext. -* bindtextdomain function (gawk) <1>: Programmer i18n. -* bindtextdomain function (gawk): I18N Functions. + (line 10942) +* bindtextdomain function (gawk) <1>: Programmer i18n. (line 11070) +* bindtextdomain function (gawk): I18N Functions. (line 10436) * bindtextdomain function (gawk), portability and: I18N Portability. -* BINMODE variable <1>: PC Using. -* BINMODE variable: User-modified. -* bits2str user-defined function: Bitwise Functions. -* bitwise, complement: Bitwise Functions. -* bitwise, operations: Bitwise Functions. -* bitwise, shift: Bitwise Functions. -* body, in actions: Statements. -* body, in loops: While Statement. -* Boolean expressions: Boolean Ops. + (line 11286) +* BINMODE variable <1>: PC Using. (line 17855) +* BINMODE variable: User-modified. (line 7809) +* bits2str user-defined function: Bitwise Functions. (line 10348) +* bitwise, complement: Bitwise Functions. (line 10313) +* bitwise, operations: Bitwise Functions. (line 10294) +* bitwise, shift: Bitwise Functions. (line 10320) +* body, in actions: Statements. (line 7220) +* body, in loops: While Statement. (line 7299) +* Boolean expressions: Boolean Ops. (line 6455) * Boolean expressions, as patterns: Expression Patterns. -* Boolean operators, See Boolean expressions: Boolean Ops. -* Bourne shell, quoting rules for: Quoting. -* braces ({}), actions and: Action Overview. -* braces ({}), pgawk program: Profiling. -* braces ({}), statements, grouping: Statements. + (line 6860) +* Boolean operators, See Boolean expressions: Boolean Ops. (line 6455) +* Bourne shell, quoting rules for: Quoting. (line 1357) +* braces ({}), actions and: Action Overview. (line 7170) +* braces ({}), pgawk program: Profiling. (line 11858) +* braces ({}), statements, grouping: Statements. (line 7220) * bracket expressions, See character lists: Regexp Operators. -* break statement: Break Statement. -* Brennan, Michael <1>: Other Versions. -* Brennan, Michael <2>: Simple Sed. -* Brennan, Michael <3>: Two-way I/O. -* Brennan, Michael: Delete. -* Broder, Alan J.: Contributors. -* Brown, Martin <1>: Bugs. -* Brown, Martin <2>: Contributors. -* Brown, Martin: Acknowledgments. -* BSD portals: Portal Files. -* BSD-based operating systems: Glossary. -* Buening, Andreas <1>: Contributors. -* Buening, Andreas: Acknowledgments. -* buffering, input/output <1>: Two-way I/O. -* buffering, input/output: I/O Functions. -* buffering, interactive vs. noninteractive: I/O Functions. -* buffers, flushing: I/O Functions. + (line 2230) +* break statement: Break Statement. (line 7517) +* Brennan, Michael <1>: Other Versions. (line 18351) +* Brennan, Michael <2>: Simple Sed. (line 16155) +* Brennan, Michael <3>: Two-way I/O. (line 11507) +* Brennan, Michael: Delete. (line 8622) +* Broder, Alan J.: Contributors. (line 17086) +* Brown, Martin <1>: Bugs. (line 18332) +* Brown, Martin <2>: Contributors. (line 17081) +* Brown, Martin: Acknowledgments. (line 995) +* BSD portals: Portal Files. (line 11710) +* BSD-based operating systems: Glossary. (line 20320) +* Buening, Andreas <1>: Contributors. (line 17090) +* Buening, Andreas: Acknowledgments. (line 995) +* buffering, input/output <1>: Two-way I/O. (line 11572) +* buffering, input/output: I/O Functions. (line 9916) +* buffering, interactive vs. noninteractive: I/O Functions. (line 9884) +* buffers, flushing: I/O Functions. (line 9818) * buffers, operators for: GNU Regexp Operators. -* bug reports, email address, bug-gawk@gnu.org: Bugs. -* bug-gawk@gnu.org bug reporting address: Bugs. -* built-in functions: Functions. -* built-in functions, evaluation order: Calling Built-in. + (line 2495) +* bug reports, email address, bug-gawk@gnu.org: Bugs. (line 18303) +* bug-gawk@gnu.org bug reporting address: Bugs. (line 18303) +* built-in functions: Functions. (line 8956) +* built-in functions, evaluation order: Calling Built-in. (line 9023) * built-in variables: Built-in Variables. -* built-in variables, -v option, setting with: Options. -* built-in variables, conveying information: Auto-set. -* built-in variables, user-modifiable: User-modified. -* call by reference: Function Caveats. -* call by value: Function Caveats. + (line 7779) +* built-in variables, -v option, setting with: Options. (line 12029) +* built-in variables, conveying information: Auto-set. (line 7959) +* built-in variables, user-modifiable: User-modified. (line 7805) +* call by reference: Function Caveats. (line 10696) +* call by value: Function Caveats. (line 10667) * caret (^) <1>: GNU Regexp Operators. -* caret (^): Regexp Operators. -* caret (^), ^ operator <1>: Options. -* caret (^), ^ operator: Precedence. -* caret (^), ^= operator <1>: Options. -* caret (^), ^= operator <2>: Precedence. -* caret (^), ^= operator: Assignment Ops. -* caret (^), in character lists: Character Lists. -* case keyword: Switch Statement. -* case sensitivity, array indices and: Array Intro. -* case sensitivity, converting case: String Functions. -* case sensitivity, example programs: Library Functions. -* case sensitivity, gawk: Case-sensitivity. -* case sensitivity, regexps and <1>: User-modified. -* case sensitivity, regexps and: Case-sensitivity. -* case sensitivity, string comparisons and: User-modified. -* character encodings: Ordinal Functions. -* character lists <1>: Character Lists. -* character lists: Regexp Operators. -* character lists, character classes: Character Lists. -* character lists, collating elements: Character Lists. -* character lists, collating symbols: Character Lists. -* character lists, complemented: Regexp Operators. -* character lists, equivalence classes: Character Lists. -* character lists, non-ASCII: Character Lists. -* character lists, range expressions: Character Lists. -* character sets: Ordinal Functions. -* character sets (machine character encodings): Glossary. + (line 2506) +* caret (^): Regexp Operators. (line 2197) +* caret (^), ^ operator <1>: Options. (line 12157) +* caret (^), ^ operator: Precedence. (line 6687) +* caret (^), ^= operator <1>: Options. (line 12157) +* caret (^), ^= operator <2>: Precedence. (line 6734) +* caret (^), ^= operator: Assignment Ops. (line 6103) +* caret (^), in character lists: Character Lists. (line 2364) +* case keyword: Switch Statement. (line 7456) +* case sensitivity, array indices and: Array Intro. (line 8390) +* case sensitivity, converting case: String Functions. (line 9591) +* case sensitivity, example programs: Library Functions. (line 12472) +* case sensitivity, gawk: Case-sensitivity. (line 2569) +* case sensitivity, regexps and <1>: User-modified. (line 7867) +* case sensitivity, regexps and: Case-sensitivity. (line 2549) +* case sensitivity, string comparisons and: User-modified. (line 7867) +* character encodings: Ordinal Functions. (line 12980) +* character lists <1>: Character Lists. (line 2353) +* character lists: Regexp Operators. (line 2230) +* character lists, character classes: Character Lists. (line 2377) +* character lists, collating elements: Character Lists. (line 2430) +* character lists, collating symbols: Character Lists. (line 2437) +* character lists, complemented: Regexp Operators. (line 2237) +* character lists, equivalence classes: Character Lists. (line 2443) +* character lists, non-ASCII: Character Lists. (line 2430) +* character lists, range expressions: Character Lists. (line 2353) +* character sets: Ordinal Functions. (line 12980) +* character sets (machine character encodings): Glossary. (line 19879) * character sets, See Also character lists: Regexp Operators. -* characters, counting: Wc Program. -* characters, transliterating: Translate Program. -* characters, values of as numbers: Ordinal Functions. -* Chassell, Robert J.: Acknowledgments. -* chdir function, implementing in gawk: Sample Library. -* chem utility: Glossary. -* chr user-defined function: Ordinal Functions. + (line 2230) +* characters, counting: Wc Program. (line 15230) +* characters, transliterating: Translate Program. (line 15567) +* characters, values of as numbers: Ordinal Functions. (line 12942) +* Chassell, Robert J.: Acknowledgments. (line 972) +* chdir function, implementing in gawk: Sample Library. (line 18963) +* chem utility: Glossary. (line 19887) +* chr user-defined function: Ordinal Functions. (line 12952) * Cliff random numbers: Cliff Random Function. + (line 12911) * cliff_rand user-defined function: Cliff Random Function. -* close function <1>: I/O Functions. + (line 12916) +* close function <1>: I/O Functions. (line 9799) * close function <2>: Close Files And Pipes. -* close function <3>: Getline/Pipe. + (line 5203) +* close function <3>: Getline/Pipe. (line 4061) * close function: Getline/Variable/File. + (line 4028) * close function, return values: Close Files And Pipes. -* close function, two-way pipes and: Two-way I/O. -* Close, Diane <1>: Contributors. -* Close, Diane: Manual History. -* collating elements: Character Lists. -* collating symbols: Character Lists. -* columns, aligning: Print Examples. -* columns, cutting: Cut Program. -* comma (,), in range patterns: Ranges. -* command line, arguments <1>: Other Arguments. -* command line, arguments <2>: ARGC and ARGV. -* command line, arguments: Auto-set. -* command line, formats: Running gawk. + (line 5315) +* close function, two-way pipes and: Two-way I/O. (line 11579) +* Close, Diane <1>: Contributors. (line 17031) +* Close, Diane: Manual History. (line 898) +* collating elements: Character Lists. (line 2430) +* collating symbols: Character Lists. (line 2437) +* columns, aligning: Print Examples. (line 4369) +* columns, cutting: Cut Program. (line 14237) +* comma (,), in range patterns: Ranges. (line 6905) +* command line, arguments <1>: Other Arguments. (line 12271) +* command line, arguments <2>: ARGC and ARGV. (line 8172) +* command line, arguments: Auto-set. (line 7964) +* command line, formats: Running gawk. (line 1090) * command line, FS on, setting: Command Line Field Separator. -* command line, invoking awk from: Command Line. -* command line, options <1>: Options. + (line 3419) +* command line, invoking awk from: Command Line. (line 11973) +* command line, options <1>: Options. (line 11997) * command line, options <2>: Command Line Field Separator. -* command line, options: Long. -* command line, options, end of: Options. + (line 3419) +* command line, options: Long. (line 1202) +* command line, options, end of: Options. (line 12053) * command line, variables, assigning on: Assignment Options. -* command-line options, processing: Getopt Function. + (line 5663) +* command-line options, processing: Getopt Function. (line 13426) * command-line options, string extraction: String Extraction. -* commenting: Comments. -* commenting, backslash continuation and: Statements/Lines. -* comp.lang.awk newsgroup: Bugs. + (line 11157) +* commenting: Comments. (line 1296) +* commenting, backslash continuation and: Statements/Lines. (line 1838) +* comp.lang.awk newsgroup: Bugs. (line 18312) * comparison expressions: Typing and Comparison. + (line 6269) * comparison expressions, as patterns: Expression Patterns. + (line 6833) * comparison expressions, string vs. regexp: Typing and Comparison. -* compatibility mode (gawk), extensions: POSIX/GNU. -* compatibility mode (gawk), file names: Special Caveats. + (line 6411) +* compatibility mode (gawk), extensions: POSIX/GNU. (line 16818) +* compatibility mode (gawk), file names: Special Caveats. (line 5159) * compatibility mode (gawk), hexadecimal numbers: Nondecimal-numbers. + (line 5503) * compatibility mode (gawk), octal numbers: Nondecimal-numbers. -* compatibility mode (gawk), specifying: Options. -* compiled programs <1>: Glossary. -* compiled programs: Basic High Level. -* compl function (gawk): Bitwise Functions. -* complement, bitwise: Bitwise Functions. -* compound statements, control statements and: Statements. -* concatenating: Concatenation. -* conditional expressions: Conditional Exp. + (line 5503) +* compatibility mode (gawk), specifying: Options. (line 12070) +* compiled programs <1>: Glossary. (line 19897) +* compiled programs: Basic High Level. (line 19467) +* compl function (gawk): Bitwise Functions. (line 10331) +* complement, bitwise: Bitwise Functions. (line 10313) +* compound statements, control statements and: Statements. (line 7220) +* concatenating: Concatenation. (line 5903) +* conditional expressions: Conditional Exp. (line 6545) * configuration option, --disable-lint: Additional Configuration Options. + (line 17446) * configuration option, --disable-nls: Additional Configuration Options. + (line 17461) * configuration option, --enable-portals: Additional Configuration Options. + (line 17432) * configuration option, --enable-switch: Additional Configuration Options. + (line 17436) * configuration option, --with-included-gettext <1>: Additional Configuration Options. -* configuration option, --with-included-gettext: Gawk I18N. + (line 17440) +* configuration option, --with-included-gettext: Gawk I18N. (line 11423) * configuration options, gawk: Additional Configuration Options. -* constants, nondecimal: Nondecimal Data. -* constants, types of: Constants. + (line 17429) +* constants, nondecimal: Nondecimal Data. (line 11465) +* constants, types of: Constants. (line 5397) * continue statement: Continue Statement. -* control statements: Statements. -* converting, case: String Functions. -* converting, dates to timestamps: Time Functions. + (line 7574) +* control statements: Statements. (line 7216) +* converting, case: String Functions. (line 9591) +* converting, dates to timestamps: Time Functions. (line 10030) * converting, during subscripting: Numeric Array Subscripts. -* converting, numbers: Conversion. -* converting, numbers, to strings: Bitwise Functions. -* converting, strings to numbers: Conversion. -* CONVFMT variable <1>: User-modified. -* CONVFMT variable: Conversion. + (line 8673) +* converting, numbers: Conversion. (line 5711) +* converting, numbers, to strings: Bitwise Functions. (line 10387) +* converting, strings to numbers: Conversion. (line 5711) +* CONVFMT variable <1>: User-modified. (line 7825) +* CONVFMT variable: Conversion. (line 5734) * CONVFMT variable, array subscripts and: Numeric Array Subscripts. -* coprocesses <1>: Two-way I/O. -* coprocesses: Redirection. + (line 8648) +* coprocesses <1>: Two-way I/O. (line 11545) +* coprocesses: Redirection. (line 4936) * coprocesses, closing: Close Files And Pipes. -* coprocesses, getline from: Getline/Coprocess. -* cos function: Numeric Functions. -* counting: Wc Program. -* csh utility: Statements/Lines. -* csh utility, backslash continuation and: More Complex. + (line 5191) +* coprocesses, getline from: Getline/Coprocess. (line 4129) +* cos function: Numeric Functions. (line 9071) +* counting: Wc Program. (line 15230) +* csh utility: Statements/Lines. (line 1807) +* csh utility, backslash continuation and: More Complex. (line 1708) * csh utility, POSIXLY_CORRECT environment variable: Options. -* csh utility, |& operator, comparison with: Two-way I/O. -* ctime user-defined function: Function Example. + (line 12252) +* csh utility, |& operator, comparison with: Two-way I/O. (line 11545) +* ctime user-defined function: Function Example. (line 10629) * currency symbols, localization: Explaining gettext. + (line 10994) * custom.h file: Configuration Philosophy. -* cut utility: Cut Program. -* cut.awk program: Cut Program. -* d.c., See dark corner: Conventions. -* dark corner <1>: Glossary. -* dark corner <2>: Truth Values. -* dark corner <3>: Assignment Ops. -* dark corner <4>: Format Modifiers. -* dark corner: Conventions. + (line 17496) +* cut utility: Cut Program. (line 14237) +* cut.awk program: Cut Program. (line 14275) +* d.c., See dark corner: Conventions. (line 850) +* dark corner <1>: Glossary. (line 19929) +* dark corner <2>: Truth Values. (line 6256) +* dark corner <3>: Assignment Ops. (line 6129) +* dark corner <4>: Format Modifiers. (line 4659) +* dark corner: Conventions. (line 850) * dark corner, array subscripts: Uninitialized Subscripts. -* dark corner, break statement: Break Statement. + (line 8735) +* dark corner, break statement: Break Statement. (line 7558) * dark corner, close function: Close Files And Pipes. + (line 5315) * dark corner, command-line arguments: Assignment Options. + (line 5700) * dark corner, continue statement: Continue Statement. -* dark corner, CONVFMT variable: Conversion. -* dark corner, escape sequences: Other Arguments. + (line 7611) +* dark corner, CONVFMT variable: Conversion. (line 5745) +* dark corner, escape sequences: Other Arguments. (line 12296) * dark corner, escape sequences, for metacharacters: Escape Sequences. -* dark corner, exit statement: Exit Statement. + (line 2168) +* dark corner, exit statement: Exit Statement. (line 7752) * dark corner, field separators: Field Splitting Summary. -* dark corner, FILENAME variable <1>: Auto-set. -* dark corner, FILENAME variable: Getline Notes. -* dark corner, FNR/NR variables: Auto-set. -* dark corner, format-control characters: Control Letters. + (line 3547) +* dark corner, FILENAME variable <1>: Auto-set. (line 8041) +* dark corner, FILENAME variable: Getline Notes. (line 4190) +* dark corner, FNR/NR variables: Auto-set. (line 8140) +* dark corner, format-control characters: Control Letters. (line 4593) * dark corner, FS as null string: Single Character Fields. -* dark corner, input files: Records. -* dark corner, invoking awk: Command Line. -* dark corner, multiline records: Multiple Line. -* dark corner, NF variable, decrementing: Changing Fields. -* dark corner, OFMT variable: OFMT. + (line 3407) +* dark corner, input files: Records. (line 2908) +* dark corner, invoking awk: Command Line. (line 11983) +* dark corner, multiline records: Multiple Line. (line 3726) +* dark corner, NF variable, decrementing: Changing Fields. (line 3223) +* dark corner, OFMT variable: OFMT. (line 4447) * dark corner, regexp constants: Using Constant Regexps. + (line 5536) * dark corner, regexp constants, /= operator and: Assignment Ops. + (line 6129) * dark corner, regexp constants, as arguments to user-defined functions: Using Constant Regexps. -* dark corner, split function: String Functions. -* dark corner, strings, storing: Records. -* data, fixed-width: Constant Size. -* data-driven languages: Basic High Level. -* database, group, reading: Group Functions. -* database, users, reading: Passwd Functions. -* date utility, GNU: Time Functions. -* date utility, POSIX: Time Functions. -* dates, converting to timestamps: Time Functions. + (line 5574) +* dark corner, split function: String Functions. (line 9361) +* dark corner, strings, storing: Records. (line 2987) +* data, fixed-width: Constant Size. (line 3597) +* data-driven languages: Basic High Level. (line 19536) +* database, group, reading: Group Functions. (line 13934) +* database, users, reading: Passwd Functions. (line 13709) +* date utility, GNU: Time Functions. (line 9978) +* date utility, POSIX: Time Functions. (line 10225) +* dates, converting to timestamps: Time Functions. (line 10030) * dates, information related to, localization: Explaining gettext. -* Davies, Stephen <1>: Bugs. -* Davies, Stephen: Contributors. -* dcgettext function (gawk) <1>: Programmer i18n. -* dcgettext function (gawk): I18N Functions. + (line 11006) +* Davies, Stephen <1>: Bugs. (line 18337) +* Davies, Stephen: Contributors. (line 17078) +* dcgettext function (gawk) <1>: Programmer i18n. (line 11044) +* dcgettext function (gawk): I18N Functions. (line 10422) * dcgettext function (gawk), portability and: I18N Portability. -* dcngettext function (gawk) <1>: Programmer i18n. -* dcngettext function (gawk): I18N Functions. + (line 11286) +* dcngettext function (gawk) <1>: Programmer i18n. (line 11060) +* dcngettext function (gawk): I18N Functions. (line 10428) * dcngettext function (gawk), portability and: I18N Portability. -* deadlocks: Two-way I/O. -* debugging gawk: Known Bugs. -* debugging gawk, bug reports: Bugs. -* decrement operators: Increment Ops. -* default keyword: Switch Statement. -* Deifik, Scott <1>: Bugs. -* Deifik, Scott <2>: Contributors. -* Deifik, Scott: Acknowledgments. -* delete statement: Delete. -* deleting elements in arrays: Delete. -* deleting entire arrays: Delete. + (line 11286) +* deadlocks: Two-way I/O. (line 11572) +* debugging gawk: Known Bugs. (line 12420) +* debugging gawk, bug reports: Bugs. (line 18285) +* decrement operators: Increment Ops. (line 6181) +* default keyword: Switch Statement. (line 7456) +* Deifik, Scott <1>: Bugs. (line 18333) +* Deifik, Scott <2>: Contributors. (line 17062) +* Deifik, Scott: Acknowledgments. (line 995) +* delete statement: Delete. (line 8577) +* deleting elements in arrays: Delete. (line 8577) +* deleting entire arrays: Delete. (line 8610) * differences in awk and gawk, ARGC/ARGV variables: ARGC and ARGV. -* differences in awk and gawk, ARGIND variable: Auto-set. + (line 8251) +* differences in awk and gawk, ARGIND variable: Auto-set. (line 7993) * differences in awk and gawk, array elements, deleting: Delete. + (line 8610) * differences in awk and gawk, AWKPATH environment variable: AWKPATH Variable. + (line 12327) * differences in awk and gawk, BEGIN/END patterns: I/O And BEGIN/END. + (line 7060) * differences in awk and gawk, BINMODE variable <1>: PC Using. + (line 17855) * differences in awk and gawk, BINMODE variable: User-modified. + (line 7820) * differences in awk and gawk, close function: Close Files And Pipes. -* differences in awk and gawk, ERRNO variable: Auto-set. -* differences in awk and gawk, error messages: Special FD. + (line 5266) +* differences in awk and gawk, ERRNO variable: Auto-set. (line 8025) +* differences in awk and gawk, error messages: Special FD. (line 5020) * differences in awk and gawk, FIELDWIDTHS variable: User-modified. + (line 7832) * differences in awk and gawk, function arguments (gawk): Calling Built-in. -* differences in awk and gawk, getline command: Getline. + (line 9009) +* differences in awk and gawk, getline command: Getline. (line 3848) * differences in awk and gawk, IGNORECASE variable: User-modified. + (line 7867) * differences in awk and gawk, implementation limitations <1>: Redirection. + (line 4965) * differences in awk and gawk, implementation limitations: Getline Notes. + (line 4185) * differences in awk and gawk, input/output operators <1>: Redirection. + (line 4936) * differences in awk and gawk, input/output operators: Getline/Coprocess. + (line 4129) * differences in awk and gawk, line continuations: Conditional Exp. + (line 6573) * differences in awk and gawk, LINT variable: User-modified. + (line 7882) * differences in awk and gawk, match function: String Functions. + (line 9292) * differences in awk and gawk, next/nextfile statements: Nextfile Statement. + (line 7676) * differences in awk and gawk, print/printf statements: Format Modifiers. -* differences in awk and gawk, PROCINFO array: Auto-set. -* differences in awk and gawk, record separators: Records. + (line 4613) +* differences in awk and gawk, PROCINFO array: Auto-set. (line 8072) +* differences in awk and gawk, record separators: Records. (line 2921) * differences in awk and gawk, regexp constants: Using Constant Regexps. + (line 5574) * differences in awk and gawk, regular expressions: Case-sensitivity. -* differences in awk and gawk, RS/RT variables: Records. -* differences in awk and gawk, RT variable: Auto-set. + (line 2569) +* differences in awk and gawk, RS/RT variables: Records. (line 2963) +* differences in awk and gawk, RT variable: Auto-set. (line 8129) * differences in awk and gawk, single-character fields: Single Character Fields. + (line 3393) * differences in awk and gawk, split function: String Functions. -* differences in awk and gawk, strings: Scalar Constants. -* differences in awk and gawk, strings, storing: Records. + (line 9350) +* differences in awk and gawk, strings: Scalar Constants. (line 5431) +* differences in awk and gawk, strings, storing: Records. (line 2983) * differences in awk and gawk, strtonum function (gawk): String Functions. + (line 9388) * differences in awk and gawk, TEXTDOMAIN variable: User-modified. + (line 7937) * differences in awk and gawk, trunc-mod operation: Arithmetic Ops. -* directories, changing: Sample Library. -* directories, searching <1>: Igawk Program. -* directories, searching: AWKPATH Variable. -* division: Arithmetic Ops. -* do-while statement <1>: Do Statement. -* do-while statement: Regexp Usage. -* documentation, of awk programs: Library Names. -* documentation, online: Manual History. -* documents, searching: Dupword Program. -* dollar sign ($): Regexp Operators. -* dollar sign ($), $ field operator <1>: Precedence. -* dollar sign ($), $ field operator: Fields. + (line 5875) +* directories, changing: Sample Library. (line 18963) +* directories, searching <1>: Igawk Program. (line 16567) +* directories, searching: AWKPATH Variable. (line 12327) +* division: Arithmetic Ops. (line 5853) +* do-while statement <1>: Do Statement. (line 7338) +* do-while statement: Regexp Usage. (line 1989) +* documentation, of awk programs: Library Names. (line 12507) +* documentation, online: Manual History. (line 870) +* documents, searching: Dupword Program. (line 15395) +* dollar sign ($): Regexp Operators. (line 2210) +* dollar sign ($), $ field operator <1>: Precedence. (line 6681) +* dollar sign ($), $ field operator: Fields. (line 3019) * dollar sign ($), incrementing fields and arrays: Increment Ops. -* double quote (") <1>: Quoting. -* double quote ("): Read Terminal. -* double quote ("), regexp constants: Computed Regexps. -* double-precision floating-point: Basic Data Typing. -* Drepper, Ulrich: Acknowledgments. -* dupnode internal function: Internals. -* dupword.awk program: Dupword Program. -* EBCDIC: Ordinal Functions. -* egrep utility <1>: Egrep Program. -* egrep utility: Character Lists. -* egrep.awk program: Egrep Program. + (line 6176) +* double quote (") <1>: Quoting. (line 1376) +* double quote ("): Read Terminal. (line 1165) +* double quote ("), regexp constants: Computed Regexps. (line 2677) +* double-precision floating-point: Basic Data Typing. (line 19582) +* Drepper, Ulrich: Acknowledgments. (line 991) +* dupnode internal function: Internals. (line 18846) +* dupword.awk program: Dupword Program. (line 15420) +* EBCDIC: Ordinal Functions. (line 12980) +* egrep utility <1>: Egrep Program. (line 14491) +* egrep utility: Character Lists. (line 2371) +* egrep.awk program: Egrep Program. (line 14539) * elements in arrays: Reference to Elements. + (line 8405) * elements in arrays, assigning: Assigning Elements. -* elements in arrays, deleting: Delete. -* elements in arrays, order of: Scanning an Array. -* elements in arrays, scanning: Scanning an Array. -* email address for bug reports, bug-gawk@gnu.org: Bugs. -* EMISTERED: TCP/IP Networking. -* empty pattern: Empty. + (line 8452) +* elements in arrays, deleting: Delete. (line 8577) +* elements in arrays, order of: Scanning an Array. (line 8563) +* elements in arrays, scanning: Scanning an Array. (line 8522) +* email address for bug reports, bug-gawk@gnu.org: Bugs. (line 18303) +* EMISTERED: TCP/IP Networking. (line 11643) +* empty pattern: Empty. (line 7093) * empty strings, See null strings: Regexp Field Splitting. -* END pattern: BEGIN/END. + (line 3371) +* END pattern: BEGIN/END. (line 6972) * END pattern, assert user-defined function and: Assert Function. -* END pattern, backslash continuation and: Egrep Program. + (line 12849) +* END pattern, backslash continuation and: Egrep Program. (line 14703) * END pattern, Boolean patterns and: Expression Patterns. -* END pattern, exit statement and: Exit Statement. + (line 6892) +* END pattern, exit statement and: Exit Statement. (line 7735) * END pattern, next/nextfile statements and <1>: Next Statement. + (line 7660) * END pattern, next/nextfile statements and: I/O And BEGIN/END. -* END pattern, operators and: Using BEGIN/END. -* END pattern, pgawk program: Profiling. -* END pattern, print statement and: I/O And BEGIN/END. + (line 7080) +* END pattern, operators and: Using BEGIN/END. (line 7002) +* END pattern, pgawk program: Profiling. (line 11787) +* END pattern, print statement and: I/O And BEGIN/END. (line 7060) * endfile user-defined function: Filetrans Function. -* endgrent function (C library): Group Functions. -* endgrent user-defined function: Group Functions. -* endpwent function (C library): Passwd Functions. -* endpwent user-defined function: Passwd Functions. -* ENVIRON variable: Auto-set. -* environment variables: Auto-set. -* epoch, definition of: Glossary. -* equals sign (=), = operator: Assignment Ops. -* equals sign (=), == operator <1>: Precedence. + (line 13231) +* endgrent function (C library): Group Functions. (line 14141) +* endgrent user-defined function: Group Functions. (line 14144) +* endpwent function (C library): Passwd Functions. (line 13895) +* endpwent user-defined function: Passwd Functions. (line 13898) +* ENVIRON variable: Auto-set. (line 8013) +* environment variables: Auto-set. (line 8013) +* epoch, definition of: Glossary. (line 19971) +* equals sign (=), = operator: Assignment Ops. (line 5981) +* equals sign (=), == operator <1>: Precedence. (line 6703) * equals sign (=), == operator: Typing and Comparison. -* EREs (Extended Regular Expressions): Character Lists. -* ERRNO variable <1>: Internals. -* ERRNO variable <2>: Auto-set. -* ERRNO variable: Getline. -* error handling: Special FD. -* error handling, ERRNO variable and: Auto-set. -* error output: Special FD. + (line 6334) +* EREs (Extended Regular Expressions): Character Lists. (line 2371) +* ERRNO variable <1>: Internals. (line 18901) +* ERRNO variable <2>: Auto-set. (line 8025) +* ERRNO variable: Getline. (line 3848) +* error handling: Special FD. (line 5020) +* error handling, ERRNO variable and: Auto-set. (line 8025) +* error output: Special FD. (line 5011) * escape processing, gsub/gensub/sub functions: Gory Details. -* escape sequences: Escape Sequences. -* escape sequences, unrecognized: Options. -* evaluation order: Increment Ops. -* evaluation order, concatenation: Concatenation. -* evaluation order, functions: Calling Built-in. -* examining fields: Fields. -* exclamation point (!), ! operator <1>: Egrep Program. -* exclamation point (!), ! operator <2>: Precedence. -* exclamation point (!), ! operator: Boolean Ops. -* exclamation point (!), != operator <1>: Precedence. + (line 9622) +* escape sequences: Escape Sequences. (line 2038) +* escape sequences, unrecognized: Options. (line 12145) +* evaluation order: Increment Ops. (line 6207) +* evaluation order, concatenation: Concatenation. (line 5935) +* evaluation order, functions: Calling Built-in. (line 9023) +* examining fields: Fields. (line 3006) +* exclamation point (!), ! operator <1>: Egrep Program. (line 14645) +* exclamation point (!), ! operator <2>: Precedence. (line 6690) +* exclamation point (!), ! operator: Boolean Ops. (line 6516) +* exclamation point (!), != operator <1>: Precedence. (line 6703) * exclamation point (!), != operator: Typing and Comparison. + (line 6334) * exclamation point (!), !~ operator <1>: Expression Patterns. -* exclamation point (!), !~ operator <2>: Precedence. + (line 6843) +* exclamation point (!), !~ operator <2>: Precedence. (line 6719) * exclamation point (!), !~ operator <3>: Typing and Comparison. -* exclamation point (!), !~ operator <4>: Regexp Constants. -* exclamation point (!), !~ operator <5>: Computed Regexps. -* exclamation point (!), !~ operator <6>: Case-sensitivity. -* exclamation point (!), !~ operator: Regexp Usage. -* exit statement: Exit Statement. -* exp function: Numeric Functions. -* expand utility: Very Simple. -* expressions: Expressions. + (line 6334) +* exclamation point (!), !~ operator <4>: Regexp Constants. (line 5524) +* exclamation point (!), !~ operator <5>: Computed Regexps. (line 2656) +* exclamation point (!), !~ operator <6>: Case-sensitivity. (line 2569) +* exclamation point (!), !~ operator: Regexp Usage. (line 1989) +* exit statement: Exit Statement. (line 7729) +* exp function: Numeric Functions. (line 9059) +* expand utility: Very Simple. (line 1594) +* expressions: Expressions. (line 5354) * expressions, as patterns: Expression Patterns. -* expressions, assignment: Assignment Ops. -* expressions, Boolean: Boolean Ops. + (line 6825) +* expressions, assignment: Assignment Ops. (line 5981) +* expressions, Boolean: Boolean Ops. (line 6455) * expressions, comparison: Typing and Comparison. -* expressions, conditional: Conditional Exp. + (line 6269) +* expressions, conditional: Conditional Exp. (line 6545) * expressions, matching, See comparison expressions: Typing and Comparison. -* expressions, selecting: Conditional Exp. -* Extended Regular Expressions (EREs): Character Lists. + (line 6269) +* expressions, selecting: Conditional Exp. (line 6545) +* Extended Regular Expressions (EREs): Character Lists. (line 2371) * extension function (gawk): Using Internal File Ops. -* extensions, Bell Laboratories awk: BTL. -* extensions, in gawk, not in POSIX awk: POSIX/GNU. -* extensions, mawk: Other Versions. -* extract.awk program: Extract Program. + (line 19282) +* extensions, Bell Laboratories awk: BTL. (line 16775) +* extensions, in gawk, not in POSIX awk: POSIX/GNU. (line 16818) +* extensions, mawk: Other Versions. (line 18391) +* extract.awk program: Extract Program. (line 16016) * extraction, of marked strings (internationalization): String Extraction. -* false, logical: Truth Values. + (line 11157) +* false, logical: Truth Values. (line 6238) * FDL (Free Documentation License): GNU Free Documentation License. -* features, adding to gawk: Adding Code. -* features, advanced, See advanced features: Obsolete. -* features, deprecated: Obsolete. -* features, undocumented: Undocumented. -* Fenlason, Jay <1>: Contributors. -* Fenlason, Jay: History. -* fflush function: I/O Functions. -* fflush function, unsupported: Options. + (line 20705) +* features, adding to gawk: Adding Code. (line 18515) +* features, advanced, See advanced features: Obsolete. (line 12387) +* features, deprecated: Obsolete. (line 12387) +* features, undocumented: Undocumented. (line 12409) +* Fenlason, Jay <1>: Contributors. (line 17029) +* Fenlason, Jay: History. (line 653) +* fflush function: I/O Functions. (line 9814) +* fflush function, unsupported: Options. (line 12165) * field numbers: Nonconstant Fields. -* field operator $: Fields. -* field operators, dollar sign as: Fields. -* field separators <1>: User-modified. -* field separators: Field Separators. -* field separators, choice of: Field Separators. + (line 3077) +* field operator $: Fields. (line 3019) +* field operators, dollar sign as: Fields. (line 3019) +* field separators <1>: User-modified. (line 7842) +* field separators: Field Separators. (line 3263) +* field separators, choice of: Field Separators. (line 3298) * field separators, FIELDWIDTHS variable and: User-modified. -* field separators, in multiline records: Multiple Line. + (line 7832) +* field separators, in multiline records: Multiple Line. (line 3732) * field separators, on command line: Command Line Field Separator. + (line 3419) * field separators, POSIX and <1>: Field Splitting Summary. -* field separators, POSIX and: Fields. + (line 3541) +* field separators, POSIX and: Fields. (line 3006) * field separators, regular expressions as <1>: Regexp Field Splitting. + (line 3335) * field separators, regular expressions as: Field Separators. -* field separators, See Also OFS: Changing Fields. -* field separators, spaces as: Cut Program. -* fields <1>: Basic High Level. -* fields <2>: Fields. -* fields: Reading Files. -* fields, adding: Changing Fields. -* fields, changing contents of: Changing Fields. -* fields, cutting: Cut Program. -* fields, examining: Fields. -* fields, number of: Fields. + (line 3298) +* field separators, See Also OFS: Changing Fields. (line 3180) +* field separators, spaces as: Cut Program. (line 14337) +* fields <1>: Basic High Level. (line 19524) +* fields <2>: Fields. (line 3006) +* fields: Reading Files. (line 2788) +* fields, adding: Changing Fields. (line 3169) +* fields, changing contents of: Changing Fields. (line 3122) +* fields, cutting: Cut Program. (line 14237) +* fields, examining: Fields. (line 3006) +* fields, number of: Fields. (line 3033) * fields, numbers: Nonconstant Fields. -* fields, printing: Print Examples. -* fields, separating: Field Separators. + (line 3077) +* fields, printing: Print Examples. (line 4321) +* fields, separating: Field Separators. (line 3263) * fields, single-character: Single Character Fields. -* FIELDWIDTHS variable <1>: User-modified. -* FIELDWIDTHS variable: Constant Size. -* file descriptors: Special FD. -* file names, distinguishing: Auto-set. -* file names, in compatibility mode: Special Caveats. -* file names, standard streams in gawk: Special FD. -* FILENAME variable <1>: Auto-set. -* FILENAME variable: Reading Files. -* FILENAME variable, getline, setting with: Getline Notes. -* filenames, assignments as: Ignoring Assigns. + (line 3393) +* FIELDWIDTHS variable <1>: User-modified. (line 7832) +* FIELDWIDTHS variable: Constant Size. (line 3610) +* file descriptors: Special FD. (line 5011) +* file names, distinguishing: Auto-set. (line 8005) +* file names, in compatibility mode: Special Caveats. (line 5159) +* file names, standard streams in gawk: Special FD. (line 5046) +* FILENAME variable <1>: Auto-set. (line 8041) +* FILENAME variable: Reading Files. (line 2780) +* FILENAME variable, getline, setting with: Getline Notes. (line 4190) +* filenames, assignments as: Ignoring Assigns. (line 13384) * files, .mo: Explaining gettext. -* files, .mo, converting from .po: I18N Example. -* files, .mo, specifying directory of <1>: Programmer i18n. + (line 10934) +* files, .mo, converting from .po: I18N Example. (line 11380) +* files, .mo, specifying directory of <1>: Programmer i18n. (line 11070) * files, .mo, specifying directory of: Explaining gettext. -* files, .po <1>: Translator i18n. + (line 10946) +* files, .po <1>: Translator i18n. (line 11136) * files, .po: Explaining gettext. -* files, .po, converting to .mo: I18N Example. -* files, /dev/... special files: Special FD. -* files, /inet/ (gawk): TCP/IP Networking. -* files, /p (gawk): Portal Files. -* files, as single records: Records. -* files, awk programs in: Long. -* files, awkprof.out: Profiling. -* files, awkvars.out: Options. -* files, closing: I/O Functions. -* files, descriptors, See file descriptors: Special FD. -* files, for process information: Special Process. -* files, group: Group Functions. -* files, information about, retrieving: Sample Library. + (line 10931) +* files, .po, converting to .mo: I18N Example. (line 11380) +* files, /dev/... special files: Special FD. (line 5046) +* files, /inet/ (gawk): TCP/IP Networking. (line 11643) +* files, /p (gawk): Portal Files. (line 11710) +* files, as single records: Records. (line 2992) +* files, awk programs in: Long. (line 1196) +* files, awkprof.out: Profiling. (line 11729) +* files, awkvars.out: Options. (line 12086) +* files, closing: I/O Functions. (line 9799) +* files, descriptors, See file descriptors: Special FD. (line 5011) +* files, for process information: Special Process. (line 5078) +* files, group: Group Functions. (line 13934) +* files, information about, retrieving: Sample Library. (line 18963) * files, initialization and cleanup: Filetrans Function. -* files, input, See input files: Read Terminal. -* files, log, timestamps in: Time Functions. + (line 13177) +* files, input, See input files: Read Terminal. (line 1157) +* files, log, timestamps in: Time Functions. (line 9967) * files, managing: Data File Management. + (line 13160) * files, managing, data file boundaries: Filetrans Function. + (line 13177) * files, message object: Explaining gettext. + (line 10934) * files, message object, converting from portable object files: I18N Example. + (line 11380) * files, message object, specifying directory of <1>: Programmer i18n. + (line 11070) * files, message object, specifying directory of: Explaining gettext. -* files, multiple passes over: Other Arguments. -* files, multiple, duplicating output into: Tee Program. + (line 10946) +* files, multiple passes over: Other Arguments. (line 12314) +* files, multiple, duplicating output into: Tee Program. (line 14930) * files, output, See output files: Close Files And Pipes. -* files, password: Passwd Functions. -* files, portable object <1>: Translator i18n. + (line 5191) +* files, password: Passwd Functions. (line 13719) +* files, portable object <1>: Translator i18n. (line 11136) * files, portable object: Explaining gettext. + (line 10931) * files, portable object, converting to message object files: I18N Example. -* files, portable object, generating: Options. -* files, portal: Portal Files. -* files, processing, ARGIND variable and: Auto-set. -* files, reading: Rewind Function. -* files, reading, multiline records: Multiple Line. -* files, searching for regular expressions: Egrep Program. -* files, skipping: File Checking. -* files, source, search path for: Igawk Program. -* files, splitting: Split Program. + (line 11380) +* files, portable object, generating: Options. (line 12102) +* files, portal: Portal Files. (line 11710) +* files, processing, ARGIND variable and: Auto-set. (line 8000) +* files, reading: Rewind Function. (line 13258) +* files, reading, multiline records: Multiple Line. (line 3697) +* files, searching for regular expressions: Egrep Program. (line 14491) +* files, skipping: File Checking. (line 13300) +* files, source, search path for: Igawk Program. (line 16567) +* files, splitting: Split Program. (line 14828) * files, Texinfo, extracting programs from: Extract Program. -* Fish, Fred <1>: Bugs. -* Fish, Fred: Contributors. -* fixed-width data: Constant Size. -* flag variables <1>: Tee Program. -* flag variables: Boolean Ops. + (line 15945) +* Fish, Fred <1>: Bugs. (line 18332) +* Fish, Fred: Contributors. (line 17060) +* fixed-width data: Constant Size. (line 3597) +* flag variables <1>: Tee Program. (line 14944) +* flag variables: Boolean Ops. (line 6516) * floating-point: Floating Point Issues. -* floating-point, numbers: Basic Data Typing. -* floating-point, numbers, AWKNUM internal type: Internals. -* FNR variable <1>: Auto-set. -* FNR variable: Records. -* FNR variable, changing: Auto-set. -* for statement: For Statement. -* for statement, in arrays: Scanning an Array. -* force_number internal function: Internals. -* force_string internal function: Internals. + (line 19692) +* floating-point, numbers: Basic Data Typing. (line 19570) +* floating-point, numbers, AWKNUM internal type: Internals. (line 18768) +* FNR variable <1>: Auto-set. (line 8051) +* FNR variable: Records. (line 2817) +* FNR variable, changing: Auto-set. (line 8140) +* for statement: For Statement. (line 7374) +* for statement, in arrays: Scanning an Array. (line 8536) +* force_number internal function: Internals. (line 18776) +* force_string internal function: Internals. (line 18781) * format specifiers, mixing regular with positional specifiers: Printf Ordering. -* format specifiers, printf statement: Control Letters. + (line 11234) +* format specifiers, printf statement: Control Letters. (line 4519) * format specifiers, strftime function (gawk): Time Functions. -* format strings: Basic Printf. -* formats, numeric output: OFMT. -* formatting output: Printf. -* forward slash (/): Regexp. -* forward slash (/), / operator: Precedence. -* forward slash (/), /= operator <1>: Precedence. -* forward slash (/), /= operator: Assignment Ops. + (line 10043) +* format strings: Basic Printf. (line 4487) +* formats, numeric output: OFMT. (line 4426) +* formatting output: Printf. (line 4457) +* forward slash (/): Regexp. (line 1949) +* forward slash (/), / operator: Precedence. (line 6693) +* forward slash (/), /= operator <1>: Precedence. (line 6734) +* forward slash (/), /= operator: Assignment Ops. (line 6103) * forward slash (/), /= operator, vs. /=.../ regexp constant: Assignment Ops. + (line 6129) * forward slash (/), patterns and: Expression Patterns. + (line 6843) * Free Documentation License (FDL): GNU Free Documentation License. -* Free Software Foundation (FSF) <1>: Glossary. -* Free Software Foundation (FSF) <2>: Getting. -* Free Software Foundation (FSF): Manual History. -* free_temp internal macro: Internals. -* FreeBSD: Glossary. -* FS variable <1>: User-modified. -* FS variable: Field Separators. -* FS variable, --field-separator option and: Options. + (line 20705) +* Free Software Foundation (FSF) <1>: Glossary. (line 20025) +* Free Software Foundation (FSF) <2>: Getting. (line 17153) +* Free Software Foundation (FSF): Manual History. (line 865) +* free_temp internal macro: Internals. (line 18851) +* FreeBSD: Glossary. (line 20320) +* FS variable <1>: User-modified. (line 7842) +* FS variable: Field Separators. (line 3263) +* FS variable, --field-separator option and: Options. (line 12012) * FS variable, as null string: Single Character Fields. -* FS variable, as TAB character: Options. -* FS variable, changing value of <1>: Known Bugs. -* FS variable, changing value of: Field Separators. -* FS variable, running awk programs and: Cut Program. + (line 3407) +* FS variable, as TAB character: Options. (line 12161) +* FS variable, changing value of <1>: Known Bugs. (line 12420) +* FS variable, changing value of: Field Separators. (line 3282) +* FS variable, running awk programs and: Cut Program. (line 14297) * FS variable, setting from command line: Command Line Field Separator. -* FSF (Free Software Foundation) <1>: Glossary. -* FSF (Free Software Foundation) <2>: Getting. -* FSF (Free Software Foundation): Manual History. -* function calls: Function Calls. -* functions, arrays as parameters to: Function Caveats. -* functions, built-in <1>: Functions. -* functions, built-in: Function Calls. + (line 3419) +* FSF (Free Software Foundation) <1>: Glossary. (line 20025) +* FSF (Free Software Foundation) <2>: Getting. (line 17153) +* FSF (Free Software Foundation): Manual History. (line 865) +* function calls: Function Calls. (line 6585) +* functions, arrays as parameters to: Function Caveats. (line 10696) +* functions, built-in <1>: Functions. (line 8956) +* functions, built-in: Function Calls. (line 6589) * functions, built-in, adding to gawk: Dynamic Extensions. -* functions, built-in, evaluation order: Calling Built-in. -* functions, defining: Definition Syntax. -* functions, library: Library Functions. -* functions, library, assertions: Assert Function. + (line 18733) +* functions, built-in, evaluation order: Calling Built-in. (line 9023) +* functions, defining: Definition Syntax. (line 10472) +* functions, library: Library Functions. (line 12435) +* functions, library, assertions: Assert Function. (line 12781) * functions, library, associative arrays and: Library Names. -* functions, library, C library: Getopt Function. + (line 12558) +* functions, library, C library: Getopt Function. (line 13426) * functions, library, character values as numbers: Ordinal Functions. + (line 12942) * functions, library, Cliff random numbers: Cliff Random Function. + (line 12911) * functions, library, command-line options: Getopt Function. + (line 13426) * functions, library, example program for using: Igawk Program. + (line 16216) * functions, library, group database, reading: Group Functions. + (line 13934) * functions, library, managing data files: Data File Management. + (line 13160) * functions, library, managing time: Gettimeofday Function. + (line 13078) * functions, library, merging arrays into strings: Join Function. + (line 13033) * functions, library, nextfile statement: Nextfile Function. -* functions, library, rounding numbers: Round Function. + (line 12611) +* functions, library, rounding numbers: Round Function. (line 12866) * functions, library, user database, reading: Passwd Functions. -* functions, names of <1>: Definition Syntax. -* functions, names of: Arrays. -* functions, recursive: Definition Syntax. -* functions, return values, setting: Internals. -* functions, string-translation: I18N Functions. -* functions, undefined: Function Caveats. -* functions, user-defined: User-defined. -* functions, user-defined, calling: Function Caveats. -* functions, user-defined, counts: Profiling. -* functions, user-defined, library of: Library Functions. + (line 13709) +* functions, names of <1>: Definition Syntax. (line 10486) +* functions, names of: Arrays. (line 8279) +* functions, recursive: Definition Syntax. (line 10534) +* functions, return values, setting: Internals. (line 18895) +* functions, string-translation: I18N Functions. (line 10416) +* functions, undefined: Function Caveats. (line 10720) +* functions, user-defined: User-defined. (line 10452) +* functions, user-defined, calling: Function Caveats. (line 10647) +* functions, user-defined, counts: Profiling. (line 11853) +* functions, user-defined, library of: Library Functions. (line 12435) * functions, user-defined, next/nextfile statements and <1>: Nextfile Statement. + (line 7709) * functions, user-defined, next/nextfile statements and: Next Statement. -* G-d: Acknowledgments. -* Garfinkle, Scott: Contributors. -* gawk, awk and <1>: This Manual. -* gawk, awk and: Preface. -* gawk, bitwise operations in: Bitwise Functions. -* gawk, break statement in: Break Statement. + (line 7660) +* G-d: Acknowledgments. (line 1012) +* Garfinkle, Scott: Contributors. (line 17047) +* gawk, awk and <1>: This Manual. (line 718) +* gawk, awk and: Preface. (line 569) +* gawk, bitwise operations in: Bitwise Functions. (line 10327) +* gawk, break statement in: Break Statement. (line 7558) * gawk, built-in variables and: Built-in Variables. -* gawk, character classes and: Character Lists. -* gawk, coding style in: Adding Code. + (line 7787) +* gawk, character classes and: Character Lists. (line 2451) +* gawk, coding style in: Adding Code. (line 18541) * gawk, command-line options: GNU Regexp Operators. + (line 2517) * gawk, comparison operators and: Typing and Comparison. + (line 6382) * gawk, configuring: Configuration Philosophy. + (line 17473) * gawk, configuring, options: Additional Configuration Options. + (line 17429) * gawk, continue statement in: Continue Statement. -* gawk, debugging: Known Bugs. + (line 7611) +* gawk, debugging: Known Bugs. (line 12420) * gawk, distribution: Distribution contents. -* gawk, escape sequences: Escape Sequences. -* gawk, extensions, disabling: Options. -* gawk, features, adding: Adding Code. -* gawk, features, advanced: Advanced Features. -* gawk, fflush function in: I/O Functions. -* gawk, field separators and: User-modified. -* gawk, FIELDWIDTHS variable in: User-modified. -* gawk, file names in: Special Files. -* gawk, format-control characters: Control Letters. -* gawk, function arguments and: Calling Built-in. + (line 17213) +* gawk, escape sequences: Escape Sequences. (line 2157) +* gawk, extensions, disabling: Options. (line 12141) +* gawk, features, adding: Adding Code. (line 18515) +* gawk, features, advanced: Advanced Features. (line 11434) +* gawk, fflush function in: I/O Functions. (line 9834) +* gawk, field separators and: User-modified. (line 7862) +* gawk, FIELDWIDTHS variable in: User-modified. (line 7838) +* gawk, file names in: Special Files. (line 4994) +* gawk, format-control characters: Control Letters. (line 4593) +* gawk, function arguments and: Calling Built-in. (line 9009) * gawk, functions, adding: Dynamic Extensions. + (line 18733) * gawk, hexadecimal numbers and: Nondecimal-numbers. -* gawk, IGNORECASE variable in: User-modified. -* gawk, implementation issues: Notes. + (line 5485) +* gawk, IGNORECASE variable in: User-modified. (line 7878) +* gawk, implementation issues: Notes. (line 18452) * gawk, implementation issues, debugging: Compatibility Mode. + (line 18471) * gawk, implementation issues, downward compatibility: Compatibility Mode. -* gawk, implementation issues, limits: Getline Notes. -* gawk, implementation issues, pipes: Redirection. -* gawk, installing: Installation. -* gawk, internals: Internals. + (line 18471) +* gawk, implementation issues, limits: Getline Notes. (line 4185) +* gawk, implementation issues, pipes: Redirection. (line 4965) +* gawk, installing: Installation. (line 17111) +* gawk, internals: Internals. (line 18755) * gawk, internationalization and, See internationalization: Internationalization. -* gawk, interpreter, adding code to <1>: Future Extensions. + (line 10863) +* gawk, interpreter, adding code to <1>: Future Extensions. (line 19421) * gawk, interpreter, adding code to: Using Internal File Ops. -* gawk, interval expressions and: Regexp Operators. -* gawk, line continuation in: Conditional Exp. -* gawk, LINT variable in: User-modified. -* gawk, list of contributors to: Contributors. -* gawk, MS-DOS version of: PC Using. -* gawk, newlines in: Statements/Lines. + (line 19273) +* gawk, interval expressions and: Regexp Operators. (line 2313) +* gawk, line continuation in: Conditional Exp. (line 6573) +* gawk, LINT variable in: User-modified. (line 7891) +* gawk, list of contributors to: Contributors. (line 17016) +* gawk, MS-DOS version of: PC Using. (line 17826) +* gawk, newlines in: Statements/Lines. (line 1776) * gawk, next file statement in: Nextfile Statement. -* gawk, nextfile statement in <1>: Nextfile Function. + (line 7716) +* gawk, nextfile statement in <1>: Nextfile Function. (line 12611) * gawk, nextfile statement in: Nextfile Statement. + (line 7716) * gawk, octal numbers and: Nondecimal-numbers. -* gawk, OS/2 version of: PC Using. + (line 5485) +* gawk, OS/2 version of: PC Using. (line 17826) * gawk, regexp constants and: Using Constant Regexps. + (line 5558) * gawk, regular expressions, case sensitivity: Case-sensitivity. + (line 2569) * gawk, regular expressions, operators: GNU Regexp Operators. -* gawk, regular expressions, precedence: Regexp Operators. -* gawk, See Also awk: Preface. -* gawk, source code, obtaining: Getting. -* gawk, splitting fields and: Constant Size. -* gawk, string-translation functions: I18N Functions. -* gawk, timestamps: Time Functions. -* gawk, uses for: Preface. -* gawk, versions of, information about, printing: Options. + (line 2461) +* gawk, regular expressions, precedence: Regexp Operators. (line 2329) +* gawk, See Also awk: Preface. (line 582) +* gawk, source code, obtaining: Getting. (line 17149) +* gawk, splitting fields and: Constant Size. (line 3674) +* gawk, string-translation functions: I18N Functions. (line 10416) +* gawk, timestamps: Time Functions. (line 9967) +* gawk, uses for: Preface. (line 582) +* gawk, versions of, information about, printing: Options. (line 12201) * gawk, word-boundary operator: GNU Regexp Operators. -* General Public License (GPL): Glossary. -* General Public License, See GPL: Manual History. -* gensub function (gawk) <1>: String Functions. + (line 2510) +* General Public License (GPL): Glossary. (line 20034) +* General Public License, See GPL: Manual History. (line 870) +* gensub function (gawk) <1>: String Functions. (line 9499) * gensub function (gawk): Using Constant Regexps. -* gensub function (gawk), escape processing: Gory Details. -* get_argument internal function: Internals. -* getgrent function (C library): Group Functions. -* getgrent user-defined function: Group Functions. -* getgrgid function (C library): Group Functions. -* getgrgid user-defined function: Group Functions. -* getgrnam function (C library): Group Functions. -* getgrnam user-defined function: Group Functions. -* getgruser function (C library): Group Functions. -* getgruser function, user-defined: Group Functions. -* getline command: Reading Files. + (line 5574) +* gensub function (gawk), escape processing: Gory Details. (line 9622) +* get_actual_argument internal function: Internals. (line 18875) +* get_argument internal function: Internals. (line 18870) +* get_array_argument internal macro: Internals. (line 18890) +* get_curfunc_arg_count internal function: Internals. (line 18786) +* get_scalar_argument internal macro: Internals. (line 18885) +* getgrent function (C library): Group Functions. (line 13934) +* getgrent user-defined function: Group Functions. (line 13934) +* getgrgid function (C library): Group Functions. (line 14108) +* getgrgid user-defined function: Group Functions. (line 14111) +* getgrnam function (C library): Group Functions. (line 14096) +* getgrnam user-defined function: Group Functions. (line 14100) +* getgruser function (C library): Group Functions. (line 14119) +* getgruser function, user-defined: Group Functions. (line 14122) +* getline command: Reading Files. (line 2794) * getline command, _gr_init user-defined function: Group Functions. -* getline command, _pw_init function: Passwd Functions. + (line 14008) +* getline command, _pw_init function: Passwd Functions. (line 13839) * getline command, coprocesses, using from <1>: Close Files And Pipes. + (line 5191) * getline command, coprocesses, using from: Getline/Coprocess. -* getline command, deadlock and: Two-way I/O. -* getline command, explicit input with: Getline. -* getline command, FILENAME variable and: Getline Notes. -* getline command, return values: Getline. -* getline command, variants: Getline Summary. -* getopt function (C library): Getopt Function. -* getopt user-defined function: Getopt Function. -* getpwent function (C library): Passwd Functions. -* getpwent user-defined function: Passwd Functions. -* getpwnam function (C library): Passwd Functions. -* getpwnam user-defined function: Passwd Functions. -* getpwuid function (C library): Passwd Functions. -* getpwuid user-defined function: Passwd Functions. -* getservbyname function (C library): TCP/IP Networking. + (line 4129) +* getline command, deadlock and: Two-way I/O. (line 11572) +* getline command, explicit input with: Getline. (line 3835) +* getline command, FILENAME variable and: Getline Notes. (line 4190) +* getline command, return values: Getline. (line 3848) +* getline command, variants: Getline Summary. (line 4211) +* getopt function (C library): Getopt Function. (line 13435) +* getopt user-defined function: Getopt Function. (line 13525) +* getpwent function (C library): Passwd Functions. (line 13719) +* getpwent user-defined function: Passwd Functions. (line 13719) +* getpwnam function (C library): Passwd Functions. (line 13859) +* getpwnam user-defined function: Passwd Functions. (line 13863) +* getpwuid function (C library): Passwd Functions. (line 13871) +* getpwuid user-defined function: Passwd Functions. (line 13875) +* getservbyname function (C library): TCP/IP Networking. (line 11671) * gettext function (C library): Explaining gettext. + (line 10955) * gettext library: Explaining gettext. + (line 10901) * gettext library, locale categories: Explaining gettext. + (line 10973) * gettimeofday user-defined function: Gettimeofday Function. -* GNITS mailing list: Acknowledgments. -* GNU awk, See gawk: Preface. + (line 13088) +* GNITS mailing list: Acknowledgments. (line 991) +* GNU awk, See gawk: Preface. (line 595) * GNU Free Documentation License: GNU Free Documentation License. -* GNU General Public License: Glossary. -* GNU Lesser General Public License: Glossary. -* GNU long options <1>: Options. -* GNU long options: Command Line. -* GNU long options, printing list of: Options. -* GNU Project <1>: Glossary. -* GNU Project: Manual History. -* GNU/Linux <1>: Glossary. -* GNU/Linux <2>: Atari Compiling. + (line 20705) +* GNU General Public License: Glossary. (line 20034) +* GNU Lesser General Public License: Glossary. (line 20111) +* GNU long options <1>: Options. (line 11997) +* GNU long options: Command Line. (line 11980) +* GNU long options, printing list of: Options. (line 12111) +* GNU Project <1>: Glossary. (line 20043) +* GNU Project: Manual History. (line 870) +* GNU/Linux <1>: Glossary. (line 20320) +* GNU/Linux <2>: Atari Compiling. (line 18166) * GNU/Linux <3>: Additional Configuration Options. -* GNU/Linux <4>: I18N Example. -* GNU/Linux: Manual History. -* GPL (General Public License) <1>: Glossary. -* GPL (General Public License): Manual History. -* GPL (General Public License), printing: Options. -* grcat program: Group Functions. -* Grigera, Juan <1>: Bugs. -* Grigera, Juan: Contributors. -* group database, reading: Group Functions. -* group file: Group Functions. -* groups, information about: Group Functions. -* gsub function <1>: String Functions. + (line 17440) +* GNU/Linux <4>: I18N Example. (line 11373) +* GNU/Linux: Manual History. (line 886) +* GPL (General Public License) <1>: Glossary. (line 20034) +* GPL (General Public License): Manual History. (line 870) +* GPL (General Public License), printing: Options. (line 12078) +* grcat program: Group Functions. (line 13943) +* Grigera, Juan <1>: Bugs. (line 18334) +* Grigera, Juan: Contributors. (line 17064) +* group database, reading: Group Functions. (line 13934) +* group file: Group Functions. (line 13934) +* groups, information about: Group Functions. (line 13934) +* gsub function <1>: String Functions. (line 9483) * gsub function: Using Constant Regexps. -* gsub function, arguments of: String Functions. -* gsub function, escape processing: Gory Details. -* Hankerson, Darrel <1>: Bugs. -* Hankerson, Darrel <2>: Contributors. -* Hankerson, Darrel: Acknowledgments. -* Hartholz, Elaine: Acknowledgments. -* Hartholz, Marshall: Acknowledgments. -* Hasegawa, Isamu <1>: Contributors. -* Hasegawa, Isamu: Acknowledgments. + (line 5574) +* gsub function, arguments of: String Functions. (line 9463) +* gsub function, escape processing: Gory Details. (line 9622) +* Hankerson, Darrel <1>: Bugs. (line 18333) +* Hankerson, Darrel <2>: Contributors. (line 17066) +* Hankerson, Darrel: Acknowledgments. (line 995) +* Hartholz, Elaine: Acknowledgments. (line 977) +* Hartholz, Marshall: Acknowledgments. (line 977) +* Hasegawa, Isamu <1>: Contributors. (line 17092) +* Hasegawa, Isamu: Acknowledgments. (line 995) * hexadecimal numbers: Nondecimal-numbers. -* hexadecimal, values, enabling interpretation of: Options. -* histsort.awk program: History Sorting. -* Hughes, Phil: Acknowledgments. -* HUP signal: Profiling. -* hyphen (-), - operator: Precedence. + (line 5449) +* hexadecimal values, enabling interpretation of: Options. (line 12133) +* histsort.awk program: History Sorting. (line 15919) +* Hughes, Phil: Acknowledgments. (line 982) +* HUP signal: Profiling. (line 11928) +* hyphen (-), - operator: Precedence. (line 6690) * hyphen (-), -- (decrement/increment) operators: Precedence. -* hyphen (-), -- operator: Increment Ops. -* hyphen (-), -= operator <1>: Precedence. -* hyphen (-), -= operator: Assignment Ops. -* hyphen (-), filenames beginning with: Options. -* hyphen (-), in character lists: Character Lists. -* id utility: Id Program. -* id.awk program: Id Program. -* if statement <1>: If Statement. -* if statement: Regexp Usage. -* if statement, actions, changing: Ranges. -* igawk.sh program: Igawk Program. -* IGNORECASE variable <1>: User-modified. -* IGNORECASE variable: Case-sensitivity. -* IGNORECASE variable, array sorting and: Array Sorting. -* IGNORECASE variable, array subscripts and: Array Intro. + (line 6684) +* hyphen (-), -- operator: Increment Ops. (line 6194) +* hyphen (-), -= operator <1>: Precedence. (line 6734) +* hyphen (-), -= operator: Assignment Ops. (line 6103) +* hyphen (-), filenames beginning with: Options. (line 12058) +* hyphen (-), in character lists: Character Lists. (line 2364) +* id utility: Id Program. (line 14721) +* id.awk program: Id Program. (line 14745) +* if statement <1>: If Statement. (line 7252) +* if statement: Regexp Usage. (line 1989) +* if statement, actions, changing: Ranges. (line 6924) +* igawk.sh program: Igawk Program. (line 16328) +* IGNORECASE variable <1>: User-modified. (line 7867) +* IGNORECASE variable: Case-sensitivity. (line 2569) +* IGNORECASE variable, array sorting and: Array Sorting. (line 8945) +* IGNORECASE variable, array subscripts and: Array Intro. (line 8390) * IGNORECASE variable, in example programs: Library Functions. -* implementation issues, gawk: Notes. + (line 12472) +* implementation issues, gawk: Notes. (line 18452) * implementation issues, gawk, debugging: Compatibility Mode. -* implementation issues, gawk, limits <1>: Redirection. -* implementation issues, gawk, limits: Getline Notes. -* in operator <1>: Id Program. -* in operator <2>: For Statement. -* in operator <3>: Precedence. + (line 18471) +* implementation issues, gawk, limits <1>: Redirection. (line 4965) +* implementation issues, gawk, limits: Getline Notes. (line 4185) +* in operator <1>: Id Program. (line 14808) +* in operator <2>: For Statement. (line 7441) +* in operator <3>: Precedence. (line 6722) * in operator: Typing and Comparison. -* in operator, arrays and <1>: Scanning an Array. + (line 6334) +* in operator, arrays and <1>: Scanning an Array. (line 8533) * in operator, arrays and: Reference to Elements. -* increment operators: Increment Ops. -* index function: String Functions. -* indexing arrays: Array Intro. -* initialization, automatic: More Complex. -* input files: Reading Files. + (line 8424) +* increment operators: Increment Ops. (line 6152) +* index function: String Functions. (line 9210) +* indexing arrays: Array Intro. (line 8348) +* initialization, automatic: More Complex. (line 1731) +* input files: Reading Files. (line 2780) * input files, closing: Close Files And Pipes. -* input files, counting elements in: Wc Program. -* input files, examples: Sample Data Files. -* input files, reading: Reading Files. -* input files, running awk without: Read Terminal. -* input files, skipping: Nextfile Function. -* input files, variable assignments and: Other Arguments. -* input pipeline: Getline/Pipe. -* input redirection: Getline/File. -* input, data, nondecimal: Nondecimal Data. -* input, explicit: Getline. -* input, files, See input files: Multiple Line. -* input, multiline records: Multiple Line. -* input, splitting into records: Records. -* input, standard <1>: Special FD. -* input, standard: Read Terminal. -* input/output, binary: User-modified. -* input/output, from BEGIN and END: I/O And BEGIN/END. -* input/output, two-way: Two-way I/O. -* insomnia, cure for: Alarm Program. + (line 5191) +* input files, counting elements in: Wc Program. (line 15230) +* input files, examples: Sample Data Files. (line 1461) +* input files, reading: Reading Files. (line 2780) +* input files, running awk without: Read Terminal. (line 1146) +* input files, skipping: Nextfile Function. (line 12611) +* input files, variable assignments and: Other Arguments. (line 12284) +* input pipeline: Getline/Pipe. (line 4043) +* input redirection: Getline/File. (line 3971) +* input, data, nondecimal: Nondecimal Data. (line 11465) +* input, explicit: Getline. (line 3835) +* input, files, See input files: Multiple Line. (line 3697) +* input, multiline records: Multiple Line. (line 3697) +* input, splitting into records: Records. (line 2817) +* input, standard <1>: Special FD. (line 5011) +* input, standard: Read Terminal. (line 1146) +* input/output, binary: User-modified. (line 7809) +* input/output, from BEGIN and END: I/O And BEGIN/END. (line 7050) +* input/output, two-way: Two-way I/O. (line 11545) +* insomnia, cure for: Alarm Program. (line 15443) * installation, amiga: Amiga Installation. + (line 17535) * installation, atari: Atari Installation. -* installation, beos: BeOS Installation. + (line 18129) +* installation, beos: BeOS Installation. (line 17568) * installation, tandem: Tandem Installation. -* installation, vms: VMS Installation. -* installing gawk: Installation. -* int function: Numeric Functions. -* INT signal (MS-DOS): Profiling. -* integers: Basic Data Typing. -* integers, unsigned: Basic Data Typing. -* interacting with other programs: I/O Functions. -* internationalization <1>: I18N and L10N. -* internationalization: I18N Functions. + (line 18246) +* installation, vms: VMS Installation. (line 17949) +* installing gawk: Installation. (line 17111) +* int function: Numeric Functions. (line 9048) +* INT signal (MS-DOS): Profiling. (line 11931) +* integers: Basic Data Typing. (line 19570) +* integers, unsigned: Basic Data Typing. (line 19577) +* interacting with other programs: I/O Functions. (line 9852) +* internationalization <1>: I18N and L10N. (line 10886) +* internationalization: I18N Functions. (line 10416) * internationalization, localization <1>: Internationalization. -* internationalization, localization: User-modified. + (line 10863) +* internationalization, localization: User-modified. (line 7937) * internationalization, localization, character classes: Character Lists. + (line 2451) * internationalization, localization, gawk and: Internationalization. + (line 10863) * internationalization, localization, locale categories: Explaining gettext. + (line 10973) * internationalization, localization, marked strings: Programmer i18n. + (line 11039) * internationalization, localization, portability and: I18N Portability. + (line 11260) * internationalizing a program: Explaining gettext. -* interpreted programs <1>: Glossary. -* interpreted programs: Basic High Level. -* interval expressions: Regexp Operators. -* inventory-shipped file: Sample Data Files. -* ISO: Glossary. -* ISO 8859-1: Glossary. -* ISO Latin-1: Glossary. -* Jacobs, Andrew: Passwd Functions. -* Jaegermann, Michal <1>: Contributors. -* Jaegermann, Michal: Acknowledgments. -* Jedi knights: Undocumented. -* join user-defined function: Join Function. -* Kahrs, Ju"rgen <1>: Contributors. -* Kahrs, Ju"rgen: Acknowledgments. -* Kenobi, Obi-Wan: Undocumented. -* Kernighan, Brian <1>: Basic Data Typing. -* Kernighan, Brian <2>: Other Versions. -* Kernighan, Brian <3>: Contributors. -* Kernighan, Brian <4>: BTL. -* Kernighan, Brian <5>: Concatenation. -* Kernighan, Brian <6>: Acknowledgments. -* Kernighan, Brian <7>: Conventions. -* Kernighan, Brian: History. -* kill command, dynamic profiling: Profiling. -* Knights, jedi: Undocumented. -* Kwok, Conrad: Contributors. -* labels.awk program: Labels Program. -* languages, data-driven: Basic High Level. + (line 10901) +* interpreted programs <1>: Glossary. (line 20083) +* interpreted programs: Basic High Level. (line 19467) +* interval expressions: Regexp Operators. (line 2290) +* inventory-shipped file: Sample Data Files. (line 1487) +* ISO: Glossary. (line 20094) +* ISO 8859-1: Glossary. (line 19879) +* ISO Latin-1: Glossary. (line 19879) +* Jacobs, Andrew: Passwd Functions. (line 13779) +* Jaegermann, Michal <1>: Contributors. (line 17055) +* Jaegermann, Michal: Acknowledgments. (line 995) +* Jedi knights: Undocumented. (line 12409) +* join user-defined function: Join Function. (line 13045) +* Kahrs, Ju"rgen <1>: Contributors. (line 17074) +* Kahrs, Ju"rgen: Acknowledgments. (line 995) +* Kenobi, Obi-Wan: Undocumented. (line 12409) +* Kernighan, Brian <1>: Basic Data Typing. (line 19620) +* Kernighan, Brian <2>: Other Versions. (line 18358) +* Kernighan, Brian <3>: Contributors. (line 17022) +* Kernighan, Brian <4>: BTL. (line 16775) +* Kernighan, Brian <5>: Concatenation. (line 5900) +* Kernighan, Brian <6>: Acknowledgments. (line 1002) +* Kernighan, Brian <7>: Conventions. (line 846) +* Kernighan, Brian: History. (line 640) +* kill command, dynamic profiling: Profiling. (line 11906) +* Knights, jedi: Undocumented. (line 12409) +* Kwok, Conrad: Contributors. (line 17047) +* labels.awk program: Labels Program. (line 15731) +* languages, data-driven: Basic High Level. (line 19536) * LC_ALL locale category: Explaining gettext. + (line 11011) * LC_COLLATE locale category: Explaining gettext. + (line 10984) * LC_CTYPE locale category: Explaining gettext. + (line 10988) * LC_MESSAGES locale category: Explaining gettext. + (line 10978) * LC_MESSAGES locale category, bindtextdomain function (gawk): Programmer i18n. + (line 11111) * LC_MONETARY locale category: Explaining gettext. + (line 10994) * LC_NUMERIC locale category: Explaining gettext. + (line 10998) * LC_RESPONSE locale category: Explaining gettext. + (line 11002) * LC_TIME locale category: Explaining gettext. -* left angle bracket (<), < operator <1>: Precedence. + (line 11006) +* left angle bracket (<), < operator <1>: Precedence. (line 6703) * left angle bracket (<), < operator: Typing and Comparison. -* left angle bracket (<), < operator (I/O): Getline/File. -* left angle bracket (<), <= operator <1>: Precedence. + (line 6334) +* left angle bracket (<), < operator (I/O): Getline/File. (line 3971) +* left angle bracket (<), <= operator <1>: Precedence. (line 6703) * left angle bracket (<), <= operator: Typing and Comparison. -* left shift, bitwise: Bitwise Functions. -* leftmost longest match: Multiple Line. -* length function: String Functions. -* Lesser General Public License (LGPL): Glossary. -* LGPL (Lesser General Public License): Glossary. -* libraries of awk functions: Library Functions. -* libraries of awk functions, assertions: Assert Function. + (line 6334) +* left shift, bitwise: Bitwise Functions. (line 10320) +* leftmost longest match: Multiple Line. (line 3717) +* length function: String Functions. (line 9221) +* Lesser General Public License (LGPL): Glossary. (line 20111) +* LGPL (Lesser General Public License): Glossary. (line 20111) +* libraries of awk functions: Library Functions. (line 12435) +* libraries of awk functions, assertions: Assert Function. (line 12781) * libraries of awk functions, associative arrays and: Library Names. + (line 12558) * libraries of awk functions, character values as numbers: Ordinal Functions. + (line 12942) * libraries of awk functions, command-line options: Getopt Function. + (line 13426) * libraries of awk functions, example program for using: Igawk Program. + (line 16216) * libraries of awk functions, group database, reading: Group Functions. + (line 13934) * libraries of awk functions, managing, data files: Data File Management. + (line 13160) * libraries of awk functions, managing, time: Gettimeofday Function. + (line 13078) * libraries of awk functions, merging arrays into strings: Join Function. + (line 13033) * libraries of awk functions, nextfile statement: Nextfile Function. + (line 12611) * libraries of awk functions, rounding numbers: Round Function. + (line 12866) * libraries of awk functions, user database, reading: Passwd Functions. -* line breaks: Statements/Lines. -* line continuations: Boolean Ops. -* line continuations, gawk: Conditional Exp. -* line continuations, in print statement: Print Examples. -* line continuations, with C shell: More Complex. -* lines, blank, printing: Print. -* lines, counting: Wc Program. -* lines, duplicate, removing: History Sorting. -* lines, matching ranges of: Ranges. -* lines, skipping between markers: Ranges. -* lint checking: User-modified. -* lint checking, array elements: Delete. + (line 13709) +* line breaks: Statements/Lines. (line 1770) +* line continuations: Boolean Ops. (line 6511) +* line continuations, gawk: Conditional Exp. (line 6573) +* line continuations, in print statement: Print Examples. (line 4375) +* line continuations, with C shell: More Complex. (line 1723) +* lines, blank, printing: Print. (line 4292) +* lines, counting: Wc Program. (line 15230) +* lines, duplicate, removing: History Sorting. (line 15900) +* lines, matching ranges of: Ranges. (line 6905) +* lines, skipping between markers: Ranges. (line 6942) +* lint checking: User-modified. (line 7882) +* lint checking, array elements: Delete. (line 8605) * lint checking, array subscripts: Uninitialized Subscripts. -* lint checking, empty programs: Command Line. -* lint checking, issuing warnings: Options. + (line 8735) +* lint checking, empty programs: Command Line. (line 11983) +* lint checking, issuing warnings: Options. (line 12116) * lint checking, POSIXLY_CORRECT environment variable: Options. -* lint checking, undefined functions: Function Caveats. -* LINT variable: User-modified. -* Linux <1>: Glossary. -* Linux <2>: Atari Compiling. + (line 12239) +* lint checking, undefined functions: Function Caveats. (line 10737) +* LINT variable: User-modified. (line 7882) +* Linux <1>: Glossary. (line 20320) +* Linux <2>: Atari Compiling. (line 18166) * Linux <3>: Additional Configuration Options. -* Linux <4>: I18N Example. -* Linux: Manual History. + (line 17440) +* Linux <4>: I18N Example. (line 11373) +* Linux: Manual History. (line 886) * locale categories: Explaining gettext. -* localization: I18N and L10N. + (line 10973) +* localization: I18N and L10N. (line 10886) * localization, See internationalization, localization: I18N and L10N. -* log files, timestamps in: Time Functions. -* log function: Numeric Functions. -* logical false/true: Truth Values. -* logical operators, See Boolean expressions: Boolean Ops. -* login information: Passwd Functions. -* long options: Command Line. -* loops: While Statement. -* loops, continue statements and: For Statement. -* loops, count for header: Profiling. -* loops, exiting: Break Statement. -* loops, See Also while statement: While Statement. + (line 10886) +* log files, timestamps in: Time Functions. (line 9967) +* log function: Numeric Functions. (line 9064) +* logical false/true: Truth Values. (line 6238) +* logical operators, See Boolean expressions: Boolean Ops. (line 6455) +* login information: Passwd Functions. (line 13719) +* long options: Command Line. (line 11980) +* loops: While Statement. (line 7291) +* loops, continue statements and: For Statement. (line 7430) +* loops, count for header: Profiling. (line 11847) +* loops, exiting: Break Statement. (line 7517) +* loops, See Also while statement: While Statement. (line 7291) * Lost In Space: Dynamic Extensions. -* ls utility: More Complex. -* lshift function (gawk): Bitwise Functions. -* lvalues/rvalues: Assignment Ops. -* mailing labels, printing: Labels Program. -* mailing list, GNITS: Acknowledgments. -* make_builtin internal function: Internals. -* make_number internal function: Internals. -* make_string internal function: Internals. -* mark parity: Ordinal Functions. + (line 18729) +* ls utility: More Complex. (line 1708) +* lshift function (gawk): Bitwise Functions. (line 10333) +* lvalues/rvalues: Assignment Ops. (line 6006) +* mailing labels, printing: Labels Program. (line 15689) +* mailing list, GNITS: Acknowledgments. (line 991) +* make_builtin internal function: Internals. (line 18856) +* make_number internal function: Internals. (line 18831) +* make_string internal function: Internals. (line 18826) +* mark parity: Ordinal Functions. (line 12980) * marked string extraction (internationalization): String Extraction. -* marked strings, extracting: String Extraction. -* Marx, Groucho: Increment Ops. -* match function: String Functions. + (line 11157) +* marked strings, extracting: String Extraction. (line 11157) +* Marx, Groucho: Increment Ops. (line 6207) +* match function: String Functions. (line 9239) * match function, RSTART/RLENGTH variables: String Functions. + (line 9256) * matching, expressions, See comparison expressions: Typing and Comparison. -* matching, leftmost longest: Multiple Line. -* matching, null strings: Gory Details. -* mawk program: Other Versions. -* McPhee, Patrick: Contributors. -* memory, releasing: Internals. -* memory, setting limits: Options. + (line 6269) +* matching, leftmost longest: Multiple Line. (line 3717) +* matching, null strings: Gory Details. (line 9776) +* mawk program: Other Versions. (line 18378) +* McPhee, Patrick: Contributors. (line 17098) +* memory, releasing: Internals. (line 18851) +* memory, setting limits: Options. (line 12036) * message object files: Explaining gettext. + (line 10934) * message object files, converting from portable object files: I18N Example. + (line 11380) * message object files, specifying directory of <1>: Programmer i18n. + (line 11070) * message object files, specifying directory of: Explaining gettext. -* metacharacters, escape sequences for: Escape Sequences. -* mktime function (gawk): Time Functions. -* modifiers, in format specifiers: Format Modifiers. + (line 10946) +* metacharacters, escape sequences for: Escape Sequences. (line 2164) +* mktime function (gawk): Time Functions. (line 9991) +* modifiers, in format specifiers: Format Modifiers. (line 4606) * monetary information, localization: Explaining gettext. -* msgfmt utility: I18N Example. -* names, arrays/variables <1>: Library Names. -* names, arrays/variables: Arrays. -* names, functions <1>: Library Names. -* names, functions: Definition Syntax. -* namespace issues <1>: Library Names. -* namespace issues: Arrays. -* namespace issues, functions: Definition Syntax. -* nawk utility: Names. + (line 10994) +* msgfmt utility: I18N Example. (line 11380) +* names, arrays/variables <1>: Library Names. (line 12507) +* names, arrays/variables: Arrays. (line 8279) +* names, functions <1>: Library Names. (line 12507) +* names, functions: Definition Syntax. (line 10486) +* namespace issues <1>: Library Names. (line 12507) +* namespace issues: Arrays. (line 8279) +* namespace issues, functions: Definition Syntax. (line 10486) +* nawk utility: Names. (line 688) * negative zero: Floating Point Issues. -* NetBSD: Glossary. -* networks, programming: TCP/IP Networking. -* networks, support for: Special Network. -* newlines <1>: Options. -* newlines <2>: Boolean Ops. -* newlines: Statements/Lines. -* newlines, as field separators: Field Separators. -* newlines, as record separators: Records. -* newlines, in dynamic regexps: Computed Regexps. -* newlines, in regexp constants: Computed Regexps. -* newlines, printing: Print Examples. + (line 19714) +* NetBSD: Glossary. (line 20320) +* networks, programming: TCP/IP Networking. (line 11643) +* networks, support for: Special Network. (line 5137) +* newlines <1>: Options. (line 12148) +* newlines <2>: Boolean Ops. (line 6516) +* newlines: Statements/Lines. (line 1770) +* newlines, as field separators: Field Separators. (line 3312) +* newlines, as record separators: Records. (line 2831) +* newlines, in dynamic regexps: Computed Regexps. (line 2708) +* newlines, in regexp constants: Computed Regexps. (line 2718) +* newlines, printing: Print Examples. (line 4312) * newlines, separating statements in actions <1>: Statements. + (line 7220) * newlines, separating statements in actions: Action Overview. -* next file statement: POSIX/GNU. -* next file statement, deprecated: Obsolete. + (line 7170) +* next file statement: POSIX/GNU. (line 16967) +* next file statement, deprecated: Obsolete. (line 12392) * next file statement, in gawk: Nextfile Statement. -* next statement <1>: Next Statement. -* next statement: Boolean Ops. + (line 7716) +* next statement <1>: Next Statement. (line 7627) +* next statement: Boolean Ops. (line 6533) * next statement, BEGIN/END patterns and: I/O And BEGIN/END. + (line 7080) * next statement, user-defined functions and: Next Statement. + (line 7660) * nextfile statement: Nextfile Statement. + (line 7676) * nextfile statement, BEGIN/END patterns and: I/O And BEGIN/END. -* nextfile statement, implementing: Nextfile Function. + (line 7080) +* nextfile statement, implementing: Nextfile Function. (line 12611) * nextfile statement, in gawk: Nextfile Statement. -* nextfile statement, next file statement and: Obsolete. + (line 7716) +* nextfile statement, next file statement and: Obsolete. (line 12392) * nextfile statement, user-defined functions and: Nextfile Statement. -* nextfile user-defined function: Nextfile Function. -* NF variable <1>: Auto-set. -* NF variable: Fields. -* NF variable, decrementing: Changing Fields. -* noassign.awk program: Ignoring Assigns. -* NODE internal type: Internals. -* nodes, duplicating: Internals. -* not Boolean-logic operator: Boolean Ops. -* NR variable <1>: Auto-set. -* NR variable: Records. -* NR variable, changing: Auto-set. -* null strings <1>: Basic Data Typing. -* null strings <2>: Truth Values. + (line 7709) +* nextfile user-defined function: Nextfile Function. (line 12643) +* NF variable <1>: Auto-set. (line 8056) +* NF variable: Fields. (line 3033) +* NF variable, decrementing: Changing Fields. (line 3223) +* noassign.awk program: Ignoring Assigns. (line 13393) +* NODE internal type: Internals. (line 18772) +* nodes, duplicating: Internals. (line 18846) +* not Boolean-logic operator: Boolean Ops. (line 6455) +* NR variable <1>: Auto-set. (line 8067) +* NR variable: Records. (line 2817) +* NR variable, changing: Auto-set. (line 8140) +* null strings <1>: Basic Data Typing. (line 19596) +* null strings <2>: Truth Values. (line 6238) * null strings <3>: Regexp Field Splitting. -* null strings: Records. -* null strings, array elements and: Delete. + (line 3371) +* null strings: Records. (line 2912) +* null strings, array elements and: Delete. (line 8598) * null strings, as array subscripts: Uninitialized Subscripts. -* null strings, converting numbers to strings: Conversion. -* null strings, matching: Gory Details. -* null strings, quoting and: Quoting. + (line 8735) +* null strings, converting numbers to strings: Conversion. (line 5726) +* null strings, matching: Gory Details. (line 9776) +* null strings, quoting and: Quoting. (line 1401) * number sign (#), #! (executable scripts): Executable Scripts. + (line 1233) * number sign (#), #! (executable scripts), portability issues with: Executable Scripts. -* number sign (#), commenting: Comments. -* numbers: Internals. + (line 1233) +* number sign (#), commenting: Comments. (line 1296) +* numbers: Internals. (line 18831) * numbers, as array subscripts: Numeric Array Subscripts. -* numbers, as values of characters: Ordinal Functions. + (line 8648) +* numbers, as values of characters: Ordinal Functions. (line 12942) * numbers, Cliff random: Cliff Random Function. -* numbers, converting: Conversion. -* numbers, converting, to strings <1>: Bitwise Functions. -* numbers, converting, to strings: User-modified. -* numbers, floating-point: Basic Data Typing. -* numbers, floating-point, AWKNUM internal type: Internals. + (line 12911) +* numbers, converting: Conversion. (line 5711) +* numbers, converting, to strings <1>: Bitwise Functions. (line 10387) +* numbers, converting, to strings: User-modified. (line 7825) +* numbers, floating-point: Basic Data Typing. (line 19570) +* numbers, floating-point, AWKNUM internal type: Internals. (line 18768) * numbers, hexadecimal: Nondecimal-numbers. -* numbers, NODE internal type: Internals. + (line 5449) +* numbers, NODE internal type: Internals. (line 18772) * numbers, octal: Nondecimal-numbers. -* numbers, random: Numeric Functions. -* numbers, rounding: Round Function. -* numeric, constants: Scalar Constants. -* numeric, output format: OFMT. + (line 5449) +* numbers, random: Numeric Functions. (line 9107) +* numbers, rounding: Round Function. (line 12866) +* numeric, constants: Scalar Constants. (line 5417) +* numeric, output format: OFMT. (line 4426) * numeric, strings: Typing and Comparison. -* numeric, values: Internals. -* oawk utility: Names. -* obsolete features: Obsolete. + (line 6273) +* numeric, values: Internals. (line 18776) +* oawk utility: Names. (line 688) +* obsolete features: Obsolete. (line 12387) * octal numbers: Nondecimal-numbers. -* octal values, enabling interpretation of: Options. -* OFMT variable <1>: User-modified. -* OFMT variable <2>: Conversion. -* OFMT variable: OFMT. -* OFMT variable, POSIX awk and: OFMT. -* OFS variable <1>: User-modified. -* OFS variable <2>: Output Separators. -* OFS variable: Changing Fields. -* OpenBSD: Glossary. -* operating systems, BSD-based <1>: Portal Files. -* operating systems, BSD-based: Manual History. -* operating systems, PC, gawk on: PC Using. + (line 5449) +* octal values, enabling interpretation of: Options. (line 12133) +* OFMT variable <1>: User-modified. (line 7899) +* OFMT variable <2>: Conversion. (line 5759) +* OFMT variable: OFMT. (line 4435) +* OFMT variable, POSIX awk and: OFMT. (line 4447) +* OFS variable <1>: User-modified. (line 7908) +* OFS variable <2>: Output Separators. (line 4385) +* OFS variable: Changing Fields. (line 3180) +* OpenBSD: Glossary. (line 20320) +* operating systems, BSD-based <1>: Portal Files. (line 11710) +* operating systems, BSD-based: Manual History. (line 886) +* operating systems, PC, gawk on: PC Using. (line 17821) * operating systems, PC, gawk on, installing: PC Installation. -* operating systems, porting gawk to: New Ports. + (line 17600) +* operating systems, porting gawk to: New Ports. (line 18648) * operating systems, See Also GNU/Linux, PC operating systems, Unix: Installation. -* operations, bitwise: Bitwise Functions. -* operators, arithmetic: Arithmetic Ops. -* operators, assignment: Assignment Ops. -* operators, assignment, evaluation order: Assignment Ops. -* operators, Boolean, See Boolean expressions: Boolean Ops. -* operators, decrement/increment: Increment Ops. + (line 17111) +* operations, bitwise: Bitwise Functions. (line 10294) +* operators, arithmetic: Arithmetic Ops. (line 5815) +* operators, assignment: Assignment Ops. (line 5981) +* operators, assignment, evaluation order: Assignment Ops. (line 6085) +* operators, Boolean, See Boolean expressions: Boolean Ops. (line 6455) +* operators, decrement/increment: Increment Ops. (line 6152) * operators, GNU-specific: GNU Regexp Operators. -* operators, input/output <1>: Precedence. -* operators, input/output <2>: Redirection. -* operators, input/output <3>: Getline/Coprocess. -* operators, input/output <4>: Getline/Pipe. -* operators, input/output: Getline/File. -* operators, logical, See Boolean expressions: Boolean Ops. -* operators, precedence <1>: Precedence. -* operators, precedence: Increment Ops. + (line 2461) +* operators, input/output <1>: Precedence. (line 6703) +* operators, input/output <2>: Redirection. (line 4856) +* operators, input/output <3>: Getline/Coprocess. (line 4129) +* operators, input/output <4>: Getline/Pipe. (line 4043) +* operators, input/output: Getline/File. (line 3971) +* operators, logical, See Boolean expressions: Boolean Ops. (line 6455) +* operators, precedence <1>: Precedence. (line 6649) +* operators, precedence: Increment Ops. (line 6207) * operators, relational, See operators, comparison: Typing and Comparison. -* operators, short-circuit: Boolean Ops. -* operators, string: Concatenation. -* operators, string-matching: Regexp Usage. + (line 6269) +* operators, short-circuit: Boolean Ops. (line 6506) +* operators, string: Concatenation. (line 5903) +* operators, string-matching: Regexp Usage. (line 1989) * operators, string-matching, for buffers: GNU Regexp Operators. + (line 2495) * operators, word-boundary (gawk): GNU Regexp Operators. -* options, command-line <1>: Options. + (line 2510) +* options, command-line <1>: Options. (line 11997) * options, command-line <2>: Command Line Field Separator. -* options, command-line: Long. -* options, command-line, end of: Options. -* options, command-line, invoking awk: Command Line. -* options, command-line, processing: Getopt Function. -* options, deprecated: Obsolete. -* options, long <1>: Options. -* options, long: Command Line. -* options, printing list of: Options. -* OR bitwise operation: Bitwise Functions. -* or Boolean-logic operator: Boolean Ops. -* or function (gawk): Bitwise Functions. -* ord user-defined function: Ordinal Functions. -* order of evaluation, concatenation: Concatenation. -* ORS variable <1>: User-modified. -* ORS variable: Output Separators. + (line 3419) +* options, command-line: Long. (line 1202) +* options, command-line, end of: Options. (line 12053) +* options, command-line, invoking awk: Command Line. (line 11973) +* options, command-line, processing: Getopt Function. (line 13426) +* options, deprecated: Obsolete. (line 12387) +* options, long <1>: Options. (line 11997) +* options, long: Command Line. (line 11980) +* options, printing list of: Options. (line 12111) +* OR bitwise operation: Bitwise Functions. (line 10294) +* or Boolean-logic operator: Boolean Ops. (line 6455) +* or function (gawk): Bitwise Functions. (line 10327) +* ord user-defined function: Ordinal Functions. (line 12952) +* order of evaluation, concatenation: Concatenation. (line 5935) +* ORS variable <1>: User-modified. (line 7913) +* ORS variable: Output Separators. (line 4399) * output field separator, See OFS variable: Changing Fields. + (line 3180) * output record separator, See ORS variable: Output Separators. -* output redirection: Redirection. -* output, buffering: I/O Functions. -* output, duplicating into files: Tee Program. + (line 4399) +* output redirection: Redirection. (line 4843) +* output, buffering: I/O Functions. (line 9818) +* output, duplicating into files: Tee Program. (line 14930) * output, files, closing: Close Files And Pipes. -* output, format specifier, OFMT: OFMT. -* output, formatted: Printf. -* output, pipes: Redirection. -* output, printing, See printing: Printing. -* output, records: Output Separators. -* output, standard: Special FD. -* P1003.2 POSIX standard: Glossary. -* param_cnt internal variable: Internals. -* parameters, number of: Internals. -* parentheses (): Regexp Operators. -* parentheses (), pgawk program: Profiling. -* password file: Passwd Functions. + (line 5191) +* output, format specifier, OFMT: OFMT. (line 4435) +* output, formatted: Printf. (line 4457) +* output, pipes: Redirection. (line 4891) +* output, printing, See printing: Printing. (line 4241) +* output, records: Output Separators. (line 4399) +* output, standard: Special FD. (line 5011) +* P1003.2 POSIX standard: Glossary. (line 20164) +* param_cnt internal variable: Internals. (line 18795) +* parameters, number of: Internals. (line 18795) +* parentheses (): Regexp Operators. (line 2253) +* parentheses (), pgawk program: Profiling. (line 11862) +* password file: Passwd Functions. (line 13719) * patterns: Patterns and Actions. + (line 6747) * patterns, comparison expressions as: Expression Patterns. -* patterns, counts: Profiling. -* patterns, default: Very Simple. -* patterns, empty: Empty. -* patterns, expressions as: Regexp Patterns. -* patterns, ranges in: Ranges. + (line 6833) +* patterns, counts: Profiling. (line 11834) +* patterns, default: Very Simple. (line 1559) +* patterns, empty: Empty. (line 7093) +* patterns, expressions as: Regexp Patterns. (line 6811) +* patterns, ranges in: Ranges. (line 6905) * patterns, regexp constants as: Expression Patterns. -* patterns, types of: Pattern Overview. -* pawk profiling Bell Labs awk: Other Versions. -* PC operating systems, gawk on: PC Using. + (line 6855) +* patterns, types of: Pattern Overview. (line 6780) +* pawk profiling Bell Labs awk: Other Versions. (line 18433) +* PC operating systems, gawk on: PC Using. (line 17821) * PC operating systems, gawk on, installing: PC Installation. -* percent sign (%), % operator: Precedence. -* percent sign (%), %= operator <1>: Precedence. -* percent sign (%), %= operator: Assignment Ops. -* period (.): Regexp Operators. -* PERL: Future Extensions. -* Peters, Arno: Contributors. -* Peterson, Hal: Contributors. -* pgawk program: Profiling. -* pgawk program, awkprof.out file: Profiling. -* pgawk program, dynamic profiling: Profiling. + (line 17600) +* percent sign (%), % operator: Precedence. (line 6693) +* percent sign (%), %= operator <1>: Precedence. (line 6734) +* percent sign (%), %= operator: Assignment Ops. (line 6103) +* period (.): Regexp Operators. (line 2218) +* PERL: Future Extensions. (line 19333) +* Peters, Arno: Contributors. (line 17083) +* Peterson, Hal: Contributors. (line 17050) +* pgawk program: Profiling. (line 11725) +* pgawk program, awkprof.out file: Profiling. (line 11729) +* pgawk program, dynamic profiling: Profiling. (line 11898) * pipes, closing: Close Files And Pipes. -* pipes, input: Getline/Pipe. -* pipes, output: Redirection. -* plus sign (+): Regexp Operators. -* plus sign (+), + operator: Precedence. -* plus sign (+), ++ operator <1>: Precedence. -* plus sign (+), ++ operator: Increment Ops. -* plus sign (+), += operator <1>: Precedence. -* plus sign (+), += operator: Assignment Ops. + (line 5191) +* pipes, input: Getline/Pipe. (line 4043) +* pipes, output: Redirection. (line 4891) +* plus sign (+): Regexp Operators. (line 2276) +* plus sign (+), + operator: Precedence. (line 6690) +* plus sign (+), ++ operator <1>: Precedence. (line 6684) +* plus sign (+), ++ operator: Increment Ops. (line 6186) +* plus sign (+), += operator <1>: Precedence. (line 6734) +* plus sign (+), += operator: Assignment Ops. (line 6056) * plus sign (+), decrement/increment operators: Increment Ops. -* portability: Escape Sequences. + (line 6157) +* portability: Escape Sequences. (line 2126) * portability, #! (executable scripts): Executable Scripts. -* portability, ** operator and: Arithmetic Ops. -* portability, **= operator and: Assignment Ops. + (line 1261) +* portability, ** operator and: Arithmetic Ops. (line 5890) +* portability, **= operator and: Assignment Ops. (line 6123) * portability, ARGV variable: Executable Scripts. + (line 1270) * portability, backslash continuation and: Statements/Lines. + (line 1793) * portability, backslash in escape sequences: Escape Sequences. + (line 2145) * portability, close function and: Close Files And Pipes. -* portability, data files as single record: Records. -* portability, deleting array elements: Delete. -* portability, example programs: Library Functions. -* portability, fflush function and: I/O Functions. -* portability, functions, defining: Definition Syntax. -* portability, gawk: New Ports. + (line 5266) +* portability, data files as single record: Records. (line 2971) +* portability, deleting array elements: Delete. (line 8622) +* portability, example programs: Library Functions. (line 12460) +* portability, fflush function and: I/O Functions. (line 9818) +* portability, functions, defining: Definition Syntax. (line 10554) +* portability, gawk: New Ports. (line 18648) * portability, gettext library and: Explaining gettext. -* portability, internationalization and: I18N Portability. -* portability, length function: String Functions. -* portability, new awk vs. old awk: Conversion. + (line 10905) +* portability, internationalization and: I18N Portability. (line 11260) +* portability, length function: String Functions. (line 9230) +* portability, new awk vs. old awk: Conversion. (line 5759) * portability, next statement in user-defined functions: Function Caveats. -* portability, NF variable, decrementing: Changing Fields. -* portability, operators: Increment Ops. -* portability, operators, not in POSIX awk: Precedence. + (line 10740) +* portability, NF variable, decrementing: Changing Fields. (line 3231) +* portability, operators: Increment Ops. (line 6207) +* portability, operators, not in POSIX awk: Precedence. (line 6738) * portability, POSIXLY_CORRECT environment variable: Options. -* portability, substr function: String Functions. -* portable object files <1>: Translator i18n. + (line 12257) +* portability, substr function: String Functions. (line 9581) +* portable object files <1>: Translator i18n. (line 11136) * portable object files: Explaining gettext. + (line 10931) * portable object files, converting to message object files: I18N Example. -* portable object files, generating: Options. -* portal files: Portal Files. -* porting gawk: New Ports. + (line 11380) +* portable object files, generating: Options. (line 12102) +* portal files: Portal Files. (line 11710) +* porting gawk: New Ports. (line 18648) * positional specifiers, printf statement <1>: Printf Ordering. + (line 11183) * positional specifiers, printf statement: Format Modifiers. + (line 4613) * positional specifiers, printf statement, mixing with regular formats: Printf Ordering. + (line 11234) * positive zero: Floating Point Issues. -* POSIX awk <1>: Assignment Ops. -* POSIX awk: This Manual. -* POSIX awk, **= operator and: Assignment Ops. -* POSIX awk, < operator and: Getline/File. -* POSIX awk, arithmetic operators and: Arithmetic Ops. + (line 19714) +* POSIX awk <1>: Assignment Ops. (line 6114) +* POSIX awk: This Manual. (line 718) +* POSIX awk, **= operator and: Assignment Ops. (line 6123) +* POSIX awk, < operator and: Getline/File. (line 3991) +* POSIX awk, arithmetic operators and: Arithmetic Ops. (line 5845) * POSIX awk, backslashes in string constants: Escape Sequences. -* POSIX awk, BEGIN/END patterns: I/O And BEGIN/END. -* POSIX awk, break statement and: Break Statement. -* POSIX awk, changes in awk versions: POSIX. -* POSIX awk, character lists and: Character Lists. + (line 2145) +* POSIX awk, BEGIN/END patterns: I/O And BEGIN/END. (line 7060) +* POSIX awk, break statement and: Break Statement. (line 7558) +* POSIX awk, changes in awk versions: POSIX. (line 16731) +* POSIX awk, character lists and: Character Lists. (line 2371) * POSIX awk, character lists and, character classes: Character Lists. + (line 2377) * POSIX awk, continue statement and: Continue Statement. -* POSIX awk, CONVFMT variable and: User-modified. -* POSIX awk, date utility and: Time Functions. + (line 7611) +* POSIX awk, CONVFMT variable and: User-modified. (line 7825) +* POSIX awk, date utility and: Time Functions. (line 10225) * POSIX awk, field separators and <1>: Field Splitting Summary. -* POSIX awk, field separators and: Fields. -* POSIX awk, FS variable and: User-modified. -* POSIX awk, function keyword in: Definition Syntax. -* POSIX awk, functions and, gsub/sub: Gory Details. -* POSIX awk, functions and, length: String Functions. -* POSIX awk, GNU long options and: Options. -* POSIX awk, interval expressions in: Regexp Operators. -* POSIX awk, next/nextfile statements and: Next Statement. + (line 3541) +* POSIX awk, field separators and: Fields. (line 3006) +* POSIX awk, FS variable and: User-modified. (line 7851) +* POSIX awk, function keyword in: Definition Syntax. (line 10539) +* POSIX awk, functions and, gsub/sub: Gory Details. (line 9669) +* POSIX awk, functions and, length: String Functions. (line 9230) +* POSIX awk, GNU long options and: Options. (line 12006) +* POSIX awk, interval expressions in: Regexp Operators. (line 2309) +* POSIX awk, next/nextfile statements and: Next Statement. (line 7660) * POSIX awk, numeric strings and: Typing and Comparison. -* POSIX awk, OFMT variable and <1>: Conversion. -* POSIX awk, OFMT variable and: OFMT. -* POSIX awk, period (.), using: Regexp Operators. -* POSIX awk, printf format strings and: Format Modifiers. -* POSIX awk, regular expressions and: Regexp Operators. -* POSIX awk, timestamps and: Time Functions. -* POSIX awk, | I/O operator and: Getline/Pipe. -* POSIX mode: Options. -* POSIX, awk and: Preface. -* POSIX, gawk extensions not included in: POSIX/GNU. -* POSIX, programs, implementing in awk: Clones. -* POSIXLY_CORRECT environment variable: Options. -* precedence <1>: Precedence. -* precedence: Increment Ops. -* precedence, regexp operators: Regexp Operators. -* print statement: Printing. + (line 6273) +* POSIX awk, OFMT variable and <1>: Conversion. (line 5759) +* POSIX awk, OFMT variable and: OFMT. (line 4447) +* POSIX awk, period (.), using: Regexp Operators. (line 2225) +* POSIX awk, printf format strings and: Format Modifiers. (line 4759) +* POSIX awk, regular expressions and: Regexp Operators. (line 2329) +* POSIX awk, timestamps and: Time Functions. (line 9967) +* POSIX awk, | I/O operator and: Getline/Pipe. (line 4089) +* POSIX mode: Options. (line 12141) +* POSIX, awk and: Preface. (line 569) +* POSIX, gawk extensions not included in: POSIX/GNU. (line 16818) +* POSIX, programs, implementing in awk: Clones. (line 14209) +* POSIXLY_CORRECT environment variable: Options. (line 12239) +* precedence <1>: Precedence. (line 6649) +* precedence: Increment Ops. (line 6207) +* precedence, regexp operators: Regexp Operators. (line 2324) +* print statement: Printing. (line 4251) * print statement, BEGIN/END patterns and: I/O And BEGIN/END. -* print statement, commas, omitting: Print Examples. -* print statement, I/O operators in: Precedence. -* print statement, line continuations and: Print Examples. -* print statement, OFMT variable and: User-modified. + (line 7060) +* print statement, commas, omitting: Print Examples. (line 4330) +* print statement, I/O operators in: Precedence. (line 6710) +* print statement, line continuations and: Print Examples. (line 4375) +* print statement, OFMT variable and: User-modified. (line 7908) * print statement, See Also redirection, of output: Redirection. -* print statement, sprintf function and: Round Function. -* printf statement <1>: Printf. -* printf statement: Printing. -* printf statement, columns, aligning: Print Examples. + (line 4851) +* print statement, sprintf function and: Round Function. (line 12866) +* printf statement <1>: Printf. (line 4457) +* printf statement: Printing. (line 4251) +* printf statement, columns, aligning: Print Examples. (line 4369) * printf statement, format-control characters: Control Letters. -* printf statement, I/O operators in: Precedence. -* printf statement, modifiers: Format Modifiers. + (line 4519) +* printf statement, I/O operators in: Precedence. (line 6710) +* printf statement, modifiers: Format Modifiers. (line 4606) * printf statement, positional specifiers <1>: Printf Ordering. + (line 11183) * printf statement, positional specifiers: Format Modifiers. + (line 4613) * printf statement, positional specifiers, mixing with regular formats: Printf Ordering. + (line 11234) * printf statement, See Also redirection, of output: Redirection. -* printf statement, sprintf function and: Round Function. -* printf statement, syntax of: Basic Printf. -* printing: Printing. -* printing, list of options: Options. -* printing, mailing labels: Labels Program. -* printing, unduplicated lines of text: Uniq Program. -* printing, user information: Id Program. -* private variables: Library Names. -* process information, files for: Special Process. -* processes, two-way communications with: Two-way I/O. -* processing data: Basic High Level. -* PROCINFO array <1>: Group Functions. -* PROCINFO array <2>: Passwd Functions. -* PROCINFO array <3>: Auto-set. -* PROCINFO array: Special Caveats. -* profiling awk programs: Profiling. -* profiling awk programs, dynamically: Profiling. -* profiling gawk, See pgawk program: Profiling. -* program, definition of: Getting Started. -* programmers, attractiveness of: Two-way I/O. + (line 4851) +* printf statement, sprintf function and: Round Function. (line 12866) +* printf statement, syntax of: Basic Printf. (line 4478) +* printing: Printing. (line 4241) +* printing, list of options: Options. (line 12111) +* printing, mailing labels: Labels Program. (line 15689) +* printing, unduplicated lines of text: Uniq Program. (line 15014) +* printing, user information: Id Program. (line 14721) +* private variables: Library Names. (line 12512) +* process information, files for: Special Process. (line 5078) +* processes, two-way communications with: Two-way I/O. (line 11524) +* processing data: Basic High Level. (line 19459) +* PROCINFO array <1>: Group Functions. (line 13934) +* PROCINFO array <2>: Passwd Functions. (line 13709) +* PROCINFO array <3>: Auto-set. (line 8072) +* PROCINFO array: Special Caveats. (line 5162) +* profiling awk programs: Profiling. (line 11725) +* profiling awk programs, dynamically: Profiling. (line 11898) +* profiling gawk, See pgawk program: Profiling. (line 11725) +* program, definition of: Getting Started. (line 1047) +* programmers, attractiveness of: Two-way I/O. (line 11507) * programming conventions, --non-decimal-data option: Nondecimal Data. -* programming conventions, ARGC/ARGV variables: Auto-set. -* programming conventions, exit statement: Exit Statement. + (line 11495) +* programming conventions, ARGC/ARGV variables: Auto-set. (line 7984) +* programming conventions, exit statement: Exit Statement. (line 7759) * programming conventions, function parameters: Return Statement. + (line 10783) * programming conventions, functions, calling: Calling Built-in. + (line 9003) * programming conventions, functions, writing: Definition Syntax. + (line 10516) * programming conventions, gawk internals: Internal File Ops. + (line 19129) * programming conventions, nextfile statement: Nextfile Function. + (line 12625) * programming conventions, private variable names: Library Names. -* programming language, recipe for: History. + (line 12524) +* programming language, recipe for: History. (line 630) * programming languages, data-driven vs. procedural: Getting Started. -* programming, basic steps: Basic High Level. -* programming, concepts: Basic Concepts. -* pwcat program: Passwd Functions. + (line 1038) +* programming, basic steps: Basic High Level. (line 19472) +* programming, concepts: Basic Concepts. (line 19440) +* pwcat program: Passwd Functions. (line 13726) * question mark (?) <1>: GNU Regexp Operators. -* question mark (?): Regexp Operators. -* question mark (?), ?: operator: Precedence. -* QUIT signal (MS-DOS): Profiling. -* quoting <1>: Comments. -* quoting <2>: Long. -* quoting: Read Terminal. -* quoting, rules for: Quoting. -* quoting, tricks for: Quoting. -* Rakitzis, Byron: History Sorting. -* rand function: Numeric Functions. + (line 2506) +* question mark (?): Regexp Operators. (line 2285) +* question mark (?), ?: operator: Precedence. (line 6731) +* QUIT signal (MS-DOS): Profiling. (line 11931) +* quoting <1>: Comments. (line 1317) +* quoting <2>: Long. (line 1216) +* quoting: Read Terminal. (line 1165) +* quoting, rules for: Quoting. (line 1349) +* quoting, tricks for: Quoting. (line 1410) +* Rakitzis, Byron: History Sorting. (line 15919) +* rand function: Numeric Functions. (line 9077) * random numbers, Cliff: Cliff Random Function. -* random numbers, rand/srand functions: Numeric Functions. -* random numbers, seed of: Numeric Functions. -* range expressions: Character Lists. -* range patterns: Ranges. -* Rankin, Pat <1>: Bugs. -* Rankin, Pat <2>: Contributors. -* Rankin, Pat <3>: Assignment Ops. -* Rankin, Pat: Acknowledgments. -* raw sockets: TCP/IP Networking. -* readable data files, checking: File Checking. -* readable.awk program: File Checking. -* recipe for a programming language: History. -* record separators <1>: User-modified. -* record separators: Records. -* record separators, changing: Records. -* record separators, regular expressions as: Records. -* record separators, with multiline records: Multiple Line. -* records <1>: Basic High Level. -* records: Reading Files. -* records, multiline: Multiple Line. -* records, printing: Print. -* records, splitting input into: Records. -* records, terminating: Records. -* records, treating files as: Records. -* recursive functions: Definition Syntax. -* redirection of input: Getline/File. -* redirection of output: Redirection. -* reference counting, sorting arrays: Array Sorting. + (line 12911) +* random numbers, rand/srand functions: Numeric Functions. (line 9077) +* random numbers, seed of: Numeric Functions. (line 9107) +* range expressions: Character Lists. (line 2353) +* range patterns: Ranges. (line 6905) +* Rankin, Pat <1>: Bugs. (line 18339) +* Rankin, Pat <2>: Contributors. (line 17045) +* Rankin, Pat <3>: Assignment Ops. (line 6074) +* Rankin, Pat: Acknowledgments. (line 995) +* raw sockets: TCP/IP Networking. (line 11667) +* readable data files, checking: File Checking. (line 13300) +* readable.awk program: File Checking. (line 13305) +* recipe for a programming language: History. (line 630) +* record separators <1>: User-modified. (line 7918) +* record separators: Records. (line 2825) +* record separators, changing: Records. (line 2891) +* record separators, regular expressions as: Records. (line 2921) +* record separators, with multiline records: Multiple Line. (line 3701) +* records <1>: Basic High Level. (line 19524) +* records: Reading Files. (line 2788) +* records, multiline: Multiple Line. (line 3697) +* records, printing: Print. (line 4292) +* records, splitting input into: Records. (line 2817) +* records, terminating: Records. (line 2921) +* records, treating files as: Records. (line 2992) +* recursive functions: Definition Syntax. (line 10534) +* redirection of input: Getline/File. (line 3971) +* redirection of output: Redirection. (line 4843) +* reference counting, sorting arrays: Array Sorting. (line 8938) * regexp constants <1>: Typing and Comparison. -* regexp constants <2>: Regexp Constants. -* regexp constants: Regexp Usage. + (line 6434) +* regexp constants <2>: Regexp Constants. (line 5524) +* regexp constants: Regexp Usage. (line 2028) * regexp constants, /=.../, /= operator and: Assignment Ops. + (line 6129) * regexp constants, as patterns: Expression Patterns. + (line 6855) * regexp constants, in gawk: Using Constant Regexps. -* regexp constants, slashes vs. quotes: Computed Regexps. -* regexp constants, vs. string constants: Computed Regexps. -* regexp, See regular expressions: Regexp. -* regular expressions: Regexp. + (line 5558) +* regexp constants, slashes vs. quotes: Computed Regexps. (line 2677) +* regexp constants, vs. string constants: Computed Regexps. (line 2687) +* regexp, See regular expressions: Regexp. (line 1945) +* regular expressions: Regexp. (line 1945) * regular expressions as field separators: Field Separators. -* regular expressions, anchors in: Regexp Operators. + (line 3298) +* regular expressions, anchors in: Regexp Operators. (line 2197) * regular expressions, as field separators: Regexp Field Splitting. -* regular expressions, as patterns <1>: Regexp Patterns. -* regular expressions, as patterns: Regexp Usage. -* regular expressions, as record separators: Records. -* regular expressions, case sensitivity <1>: User-modified. -* regular expressions, case sensitivity: Case-sensitivity. -* regular expressions, computed: Computed Regexps. + (line 3335) +* regular expressions, as patterns <1>: Regexp Patterns. (line 6811) +* regular expressions, as patterns: Regexp Usage. (line 1976) +* regular expressions, as record separators: Records. (line 2921) +* regular expressions, case sensitivity <1>: User-modified. (line 7867) +* regular expressions, case sensitivity: Case-sensitivity. (line 2549) +* regular expressions, computed: Computed Regexps. (line 2656) * regular expressions, constants, See regexp constants: Regexp Usage. -* regular expressions, dynamic: Computed Regexps. + (line 2028) +* regular expressions, dynamic: Computed Regexps. (line 2656) * regular expressions, dynamic, with embedded newlines: Computed Regexps. + (line 2708) * regular expressions, gawk, command-line options: GNU Regexp Operators. -* regular expressions, interval expressions and: Options. + (line 2517) +* regular expressions, interval expressions and: Options. (line 12186) * regular expressions, leftmost longest match: Leftmost Longest. -* regular expressions, operators <1>: Regexp Operators. -* regular expressions, operators: Regexp Usage. + (line 2626) +* regular expressions, operators <1>: Regexp Operators. (line 2181) +* regular expressions, operators: Regexp Usage. (line 1989) * regular expressions, operators, for buffers: GNU Regexp Operators. + (line 2495) * regular expressions, operators, for words: GNU Regexp Operators. + (line 2461) * regular expressions, operators, gawk: GNU Regexp Operators. + (line 2461) * regular expressions, operators, precedence of: Regexp Operators. -* regular expressions, searching for: Egrep Program. + (line 2324) +* regular expressions, searching for: Egrep Program. (line 14491) * relational operators, See comparison operators: Typing and Comparison. + (line 6269) * return statement, user-defined functions: Return Statement. + (line 10750) * return values, close function: Close Files And Pipes. -* rev user-defined function: Function Example. -* rewind user-defined function: Rewind Function. -* right angle bracket (>), > operator <1>: Precedence. + (line 5315) +* rev user-defined function: Function Example. (line 10609) +* rewind user-defined function: Rewind Function. (line 13268) +* right angle bracket (>), > operator <1>: Precedence. (line 6703) * right angle bracket (>), > operator: Typing and Comparison. -* right angle bracket (>), > operator (I/O): Redirection. -* right angle bracket (>), >= operator <1>: Precedence. + (line 6334) +* right angle bracket (>), > operator (I/O): Redirection. (line 4856) +* right angle bracket (>), >= operator <1>: Precedence. (line 6703) * right angle bracket (>), >= operator: Typing and Comparison. + (line 6334) * right angle bracket (>), >> operator (I/O) <1>: Precedence. -* right angle bracket (>), >> operator (I/O): Redirection. -* right shift, bitwise: Bitwise Functions. -* Ritchie, Dennis: Basic Data Typing. -* RLENGTH variable: Auto-set. -* RLENGTH variable, match function and: String Functions. -* Robbins, Arnold <1>: Future Extensions. -* Robbins, Arnold <2>: Bugs. -* Robbins, Arnold <3>: Contributors. -* Robbins, Arnold <4>: Alarm Program. -* Robbins, Arnold <5>: Passwd Functions. -* Robbins, Arnold <6>: Getline/Pipe. + (line 6703) +* right angle bracket (>), >> operator (I/O): Redirection. (line 4884) +* right shift, bitwise: Bitwise Functions. (line 10320) +* Ritchie, Dennis: Basic Data Typing. (line 19620) +* RLENGTH variable: Auto-set. (line 8116) +* RLENGTH variable, match function and: String Functions. (line 9256) +* Robbins, Arnold <1>: Future Extensions. (line 19333) +* Robbins, Arnold <2>: Bugs. (line 18305) +* Robbins, Arnold <3>: Contributors. (line 17101) +* Robbins, Arnold <4>: Alarm Program. (line 15443) +* Robbins, Arnold <5>: Passwd Functions. (line 13779) +* Robbins, Arnold <6>: Getline/Pipe. (line 4073) * Robbins, Arnold: Command Line Field Separator. -* Robbins, Bill: Getline/Pipe. -* Robbins, Harry: Acknowledgments. -* Robbins, Jean: Acknowledgments. -* Robbins, Miriam <1>: Passwd Functions. -* Robbins, Miriam <2>: Getline/Pipe. -* Robbins, Miriam: Acknowledgments. + (line 3493) +* Robbins, Bill: Getline/Pipe. (line 4073) +* Robbins, Harry: Acknowledgments. (line 1012) +* Robbins, Jean: Acknowledgments. (line 1012) +* Robbins, Miriam <1>: Passwd Functions. (line 13779) +* Robbins, Miriam <2>: Getline/Pipe. (line 4073) +* Robbins, Miriam: Acknowledgments. (line 1012) * Robinson, Will: Dynamic Extensions. + (line 18729) * robot, the: Dynamic Extensions. -* Rommel, Kai Uwe <1>: Contributors. -* Rommel, Kai Uwe: Acknowledgments. -* round user-defined function: Round Function. -* rounding: Round Function. -* rounding numbers: Round Function. -* RS variable <1>: User-modified. -* RS variable: Records. -* RS variable, multiline records and: Multiple Line. -* rshift function (gawk): Bitwise Functions. -* RSTART variable: Auto-set. -* RSTART variable, match function and: String Functions. -* RT variable <1>: Auto-set. -* RT variable <2>: Multiple Line. -* RT variable: Records. -* Rubin, Paul <1>: Contributors. -* Rubin, Paul: History. -* rule, definition of: Getting Started. -* rvalues/lvalues: Assignment Ops. -* scalar values: Basic Data Typing. -* Schreiber, Bert: Acknowledgments. -* Schreiber, Rita: Acknowledgments. -* search paths <1>: VMS Running. -* search paths: PC Using. -* search paths, for source files <1>: VMS Running. -* search paths, for source files <2>: Igawk Program. -* search paths, for source files: AWKPATH Variable. -* searching: String Functions. -* searching, files for regular expressions: Egrep Program. -* searching, for words: Dupword Program. -* sed utility <1>: Glossary. -* sed utility <2>: Simple Sed. + (line 18729) +* Rommel, Kai Uwe <1>: Contributors. (line 17052) +* Rommel, Kai Uwe: Acknowledgments. (line 995) +* round user-defined function: Round Function. (line 12876) +* rounding: Round Function. (line 12866) +* rounding numbers: Round Function. (line 12866) +* RS variable <1>: User-modified. (line 7918) +* RS variable: Records. (line 2831) +* RS variable, multiline records and: Multiple Line. (line 3708) +* rshift function (gawk): Bitwise Functions. (line 10334) +* RSTART variable: Auto-set. (line 8122) +* RSTART variable, match function and: String Functions. (line 9256) +* RT variable <1>: Auto-set. (line 8129) +* RT variable <2>: Multiple Line. (line 3820) +* RT variable: Records. (line 2921) +* Rubin, Paul <1>: Contributors. (line 17026) +* Rubin, Paul: History. (line 653) +* rule, definition of: Getting Started. (line 1047) +* rvalues/lvalues: Assignment Ops. (line 6006) +* scalar values: Basic Data Typing. (line 19562) +* Schreiber, Bert: Acknowledgments. (line 977) +* Schreiber, Rita: Acknowledgments. (line 977) +* search paths <1>: VMS Running. (line 18070) +* search paths: PC Using. (line 17826) +* search paths, for source files <1>: VMS Running. (line 18070) +* search paths, for source files <2>: Igawk Program. (line 16567) +* search paths, for source files: AWKPATH Variable. (line 12327) +* searching: String Functions. (line 9210) +* searching, files for regular expressions: Egrep Program. (line 14491) +* searching, for words: Dupword Program. (line 15395) +* sed utility <1>: Glossary. (line 19753) +* sed utility <2>: Simple Sed. (line 16136) * sed utility: Field Splitting Summary. -* semicolon (;): Statements/Lines. -* semicolon (;), AWKPATH variable and: PC Using. + (line 3547) +* semicolon (;): Statements/Lines. (line 1853) +* semicolon (;), AWKPATH variable and: PC Using. (line 17826) * semicolon (;), separating statements in actions <1>: Statements. + (line 7220) * semicolon (;), separating statements in actions: Action Overview. -* separators, field: User-modified. + (line 7170) +* separators, field: User-modified. (line 7842) * separators, field, FIELDWIDTHS variable and: User-modified. -* separators, field, POSIX and: Fields. -* separators, for records: Records. -* separators, for records, regular expressions as: Records. -* separators, for statements in actions: Action Overview. -* separators, record: User-modified. -* separators, subscript: User-modified. -* set_value internal function: Internals. -* shells, piping commands into: Redirection. + (line 7832) +* separators, field, POSIX and: Fields. (line 3006) +* separators, for records: Records. (line 2825) +* separators, for records, regular expressions as: Records. (line 2921) +* separators, for statements in actions: Action Overview. (line 7170) +* separators, record: User-modified. (line 7918) +* separators, subscript: User-modified. (line 7931) +* set_value internal function: Internals. (line 18895) +* shells, piping commands into: Redirection. (line 4973) * shells, quoting: Using Shell Variables. -* shells, quoting, rules for: Quoting. -* shells, scripts: One-shot. + (line 7112) +* shells, quoting, rules for: Quoting. (line 1357) +* shells, scripts: One-shot. (line 1133) * shells, variables: Using Shell Variables. -* shift, bitwise: Bitwise Functions. -* short-circuit operators: Boolean Ops. -* side effects <1>: Increment Ops. -* side effects: Concatenation. + (line 7106) +* shift, bitwise: Bitwise Functions. (line 10320) +* short-circuit operators: Boolean Ops. (line 6506) +* side effects <1>: Increment Ops. (line 6157) +* side effects: Concatenation. (line 5935) * side effects, array indexing: Reference to Elements. -* side effects, asort function: Array Sorting. -* side effects, assignment expressions: Assignment Ops. -* side effects, Boolean operators: Boolean Ops. -* side effects, conditional expressions: Conditional Exp. + (line 8429) +* side effects, asort function: Array Sorting. (line 8886) +* side effects, assignment expressions: Assignment Ops. (line 5997) +* side effects, Boolean operators: Boolean Ops. (line 6479) +* side effects, conditional expressions: Conditional Exp. (line 6561) * side effects, decrement/increment operators: Increment Ops. -* side effects, FILENAME variable: Getline Notes. -* side effects, function calls: Function Calls. -* side effects, statements: Action Overview. -* signals, HUP/SIGHUP: Profiling. -* signals, INT/SIGINT (MS-DOS): Profiling. -* signals, QUIT/SIGQUIT (MS-DOS): Profiling. -* signals, USR1/SIGUSR1: Profiling. -* sin function: Numeric Functions. -* single quote (') <1>: Quoting. -* single quote (') <2>: Long. -* single quote ('): One-shot. -* single quote ('), vs. apostrophe: Comments. -* single quote ('), with double quotes: Quoting. + (line 6157) +* side effects, FILENAME variable: Getline Notes. (line 4190) +* side effects, function calls: Function Calls. (line 6627) +* side effects, statements: Action Overview. (line 7183) +* signals, HUP/SIGHUP: Profiling. (line 11928) +* signals, INT/SIGINT (MS-DOS): Profiling. (line 11931) +* signals, QUIT/SIGQUIT (MS-DOS): Profiling. (line 11931) +* signals, USR1/SIGUSR1: Profiling. (line 11906) +* sin function: Numeric Functions. (line 9068) +* single quote (') <1>: Quoting. (line 1370) +* single quote (') <2>: Long. (line 1223) +* single quote ('): One-shot. (line 1126) +* single quote ('), vs. apostrophe: Comments. (line 1317) +* single quote ('), with double quotes: Quoting. (line 1392) * single-character fields: Single Character Fields. -* single-precision floating-point: Basic Data Typing. -* Skywalker, Luke: Undocumented. -* sleep utility: Alarm Program. -* sockets: TCP/IP Networking. -* sort function, arrays, sorting: Array Sorting. -* sort utility: Word Sorting. -* sort utility, coprocesses and: Two-way I/O. + (line 3393) +* single-precision floating-point: Basic Data Typing. (line 19582) +* Skywalker, Luke: Undocumented. (line 12409) +* sleep utility: Alarm Program. (line 15538) +* sockets: TCP/IP Networking. (line 11667) +* sort function, arrays, sorting: Array Sorting. (line 8867) +* sort utility: Word Sorting. (line 15842) +* sort utility, coprocesses and: Two-way I/O. (line 11585) * sorting characters in different languages: Explaining gettext. -* source code, awka: Other Versions. -* source code, Bell Laboratories awk: Other Versions. -* source code, gawk: Gawk Distribution. -* source code, mawk: Other Versions. -* source code, mixing: Options. -* source files, search path for: Igawk Program. -* sparse arrays: Array Intro. -* Spencer, Henry: Glossary. -* split function: String Functions. -* split function, array elements, deleting: Delete. -* split utility: Split Program. -* split.awk program: Split Program. -* sprintf function <1>: String Functions. -* sprintf function: OFMT. -* sprintf function, OFMT variable and: User-modified. + (line 10984) +* source code, awka: Other Versions. (line 18421) +* source code, Bell Laboratories awk: Other Versions. (line 18358) +* source code, gawk: Gawk Distribution. (line 17134) +* source code, mawk: Other Versions. (line 18378) +* source code, mixing: Options. (line 12193) +* source files, search path for: Igawk Program. (line 16567) +* sparse arrays: Array Intro. (line 8369) +* Spencer, Henry: Glossary. (line 19753) +* split function: String Functions. (line 9327) +* split function, array elements, deleting: Delete. (line 8627) +* split utility: Split Program. (line 14828) +* split.awk program: Split Program. (line 14852) +* sprintf function <1>: String Functions. (line 9380) +* sprintf function: OFMT. (line 4435) +* sprintf function, OFMT variable and: User-modified. (line 7908) * sprintf function, print/printf statements and: Round Function. -* sqrt function: Numeric Functions. -* square brackets ([]): Regexp Operators. -* srand function: Numeric Functions. -* Stallman, Richard <1>: Glossary. -* Stallman, Richard <2>: Contributors. -* Stallman, Richard <3>: Acknowledgments. -* Stallman, Richard: Manual History. -* standard input <1>: Special FD. -* standard input: Read Terminal. -* standard output: Special FD. -* stat function, implementing in gawk: Sample Library. -* statements, compound, control statements and: Statements. -* statements, control, in actions: Statements. -* statements, multiple: Statements/Lines. -* stlen internal variable: Internals. -* stptr internal variable: Internals. -* stream editors <1>: Simple Sed. + (line 12866) +* sqrt function: Numeric Functions. (line 9055) +* square brackets ([]): Regexp Operators. (line 2230) +* srand function: Numeric Functions. (line 9117) +* Stallman, Richard <1>: Glossary. (line 20025) +* Stallman, Richard <2>: Contributors. (line 17034) +* Stallman, Richard <3>: Acknowledgments. (line 960) +* Stallman, Richard: Manual History. (line 865) +* standard input <1>: Special FD. (line 5011) +* standard input: Read Terminal. (line 1146) +* standard output: Special FD. (line 5011) +* stat function, implementing in gawk: Sample Library. (line 18963) +* statements, compound, control statements and: Statements. (line 7220) +* statements, control, in actions: Statements. (line 7216) +* statements, multiple: Statements/Lines. (line 1853) +* stlen internal variable: Internals. (line 18799) +* stptr internal variable: Internals. (line 18799) +* stream editors <1>: Simple Sed. (line 16136) * stream editors: Field Splitting Summary. -* strftime function (gawk): Time Functions. -* string constants: Scalar Constants. -* string constants, vs. regexp constants: Computed Regexps. + (line 3547) +* strftime function (gawk): Time Functions. (line 10014) +* string constants: Scalar Constants. (line 5426) +* string constants, vs. regexp constants: Computed Regexps. (line 2687) * string extraction (internationalization): String Extraction. -* string operators: Concatenation. -* string-matching operators: Regexp Usage. -* strings: Internals. -* strings, converting: Conversion. -* strings, converting, numbers to <1>: Bitwise Functions. -* strings, converting, numbers to: User-modified. -* strings, empty, See null strings: Records. -* strings, extracting: String Extraction. -* strings, for localization: Programmer i18n. -* strings, length of: Scalar Constants. -* strings, merging arrays into: Join Function. -* strings, NODE internal type: Internals. + (line 11157) +* string operators: Concatenation. (line 5903) +* string-matching operators: Regexp Usage. (line 1989) +* strings: Internals. (line 18826) +* strings, converting: Conversion. (line 5711) +* strings, converting, numbers to <1>: Bitwise Functions. (line 10387) +* strings, converting, numbers to: User-modified. (line 7825) +* strings, empty, See null strings: Records. (line 2912) +* strings, extracting: String Extraction. (line 11157) +* strings, for localization: Programmer i18n. (line 11039) +* strings, length of: Scalar Constants. (line 5431) +* strings, merging arrays into: Join Function. (line 13033) +* strings, NODE internal type: Internals. (line 18772) * strings, null: Regexp Field Splitting. + (line 3371) * strings, numeric: Typing and Comparison. -* strings, splitting: String Functions. -* strtonum function (gawk): String Functions. + (line 6273) +* strings, splitting: String Functions. (line 9341) +* strtonum function (gawk): String Functions. (line 9388) * strtonum function (gawk), --non-decimal-data option and: Nondecimal Data. -* sub function <1>: String Functions. + (line 11495) +* sub function <1>: String Functions. (line 9406) * sub function: Using Constant Regexps. -* sub function, arguments of: String Functions. -* sub function, escape processing: Gory Details. -* subscript separators: User-modified. + (line 5574) +* sub function, arguments of: String Functions. (line 9463) +* sub function, escape processing: Gory Details. (line 9622) +* subscript separators: User-modified. (line 7931) * subscripts in arrays, multidimensional: Multi-dimensional. + (line 8746) * subscripts in arrays, multidimensional, scanning: Multi-scanning. + (line 8832) * subscripts in arrays, numbers as: Numeric Array Subscripts. + (line 8648) * subscripts in arrays, uninitialized variables as: Uninitialized Subscripts. -* SUBSEP variable: User-modified. + (line 8699) +* SUBSEP variable: User-modified. (line 7931) * SUBSEP variable, multidimensional arrays: Multi-dimensional. -* substr function: String Functions. -* Sumner, Andrew: Other Versions. -* switch statement: Switch Statement. + (line 8752) +* substr function: String Functions. (line 9550) +* Sumner, Andrew: Other Versions. (line 18421) +* switch statement: Switch Statement. (line 7456) * syntactic ambiguity: /= operator vs. /=.../ regexp constant: Assignment Ops. -* system function: I/O Functions. -* systime function (gawk): Time Functions. + (line 6129) +* system function: I/O Functions. (line 9852) +* systime function (gawk): Time Functions. (line 9985) * tandem: Tandem Installation. -* Tcl: Library Names. -* TCP/IP: TCP/IP Networking. -* TCP/IP, support for: Special Network. -* tee utility: Tee Program. -* tee.awk program: Tee Program. -* terminating records: Records. -* testbits.awk program: Bitwise Functions. -* Texinfo <1>: Adding Code. + (line 18246) +* Tcl: Library Names. (line 12558) +* TCP/IP: TCP/IP Networking. (line 11643) +* TCP/IP, support for: Special Network. (line 5137) +* tee utility: Tee Program. (line 14930) +* tee.awk program: Tee Program. (line 14950) +* terminating records: Records. (line 2921) +* testbits.awk program: Bitwise Functions. (line 10348) +* Texinfo <1>: Adding Code. (line 18608) * Texinfo <2>: Distribution contents. -* Texinfo <3>: Extract Program. -* Texinfo <4>: Dupword Program. -* Texinfo <5>: Library Functions. -* Texinfo <6>: Sample Data Files. -* Texinfo: Conventions. -* Texinfo, chapter beginnings in files: Regexp Operators. + (line 17275) +* Texinfo <3>: Extract Program. (line 15951) +* Texinfo <4>: Dupword Program. (line 15406) +* Texinfo <5>: Library Functions. (line 12451) +* Texinfo <6>: Sample Data Files. (line 1521) +* Texinfo: Conventions. (line 819) +* Texinfo, chapter beginnings in files: Regexp Operators. (line 2197) * Texinfo, extracting programs from source files: Extract Program. -* text, printing: Print. -* text, printing, unduplicated lines of: Uniq Program. + (line 15945) +* text, printing: Print. (line 4292) +* text, printing, unduplicated lines of: Uniq Program. (line 15014) * textdomain function (C library): Explaining gettext. -* TEXTDOMAIN variable <1>: Programmer i18n. -* TEXTDOMAIN variable: User-modified. -* TEXTDOMAIN variable, BEGIN pattern and: Programmer i18n. -* TEXTDOMAIN variable, portability and: I18N Portability. + (line 10922) +* TEXTDOMAIN variable <1>: Programmer i18n. (line 11034) +* TEXTDOMAIN variable: User-modified. (line 7937) +* TEXTDOMAIN variable, BEGIN pattern and: Programmer i18n. (line 11083) +* TEXTDOMAIN variable, portability and: I18N Portability. (line 11274) * tilde (~), ~ operator <1>: Expression Patterns. -* tilde (~), ~ operator <2>: Precedence. + (line 6843) +* tilde (~), ~ operator <2>: Precedence. (line 6719) * tilde (~), ~ operator <3>: Typing and Comparison. -* tilde (~), ~ operator <4>: Regexp Constants. -* tilde (~), ~ operator <5>: Computed Regexps. -* tilde (~), ~ operator <6>: Case-sensitivity. -* tilde (~), ~ operator: Regexp Usage. -* time, alarm clock example program: Alarm Program. + (line 6334) +* tilde (~), ~ operator <4>: Regexp Constants. (line 5524) +* tilde (~), ~ operator <5>: Computed Regexps. (line 2656) +* tilde (~), ~ operator <6>: Case-sensitivity. (line 2569) +* tilde (~), ~ operator: Regexp Usage. (line 1989) +* time, alarm clock example program: Alarm Program. (line 15446) * time, localization and: Explaining gettext. + (line 11006) * time, managing: Gettimeofday Function. -* time, retrieving: Time Functions. -* timestamps: Time Functions. -* timestamps, converting dates to: Time Functions. + (line 13078) +* time, retrieving: Time Functions. (line 9978) +* timestamps: Time Functions. (line 9967) +* timestamps, converting dates to: Time Functions. (line 10030) * timestamps, formatted: Gettimeofday Function. -* tmp_number internal function: Internals. -* tmp_string internal function: Internals. -* tolower function: String Functions. -* toupper function: String Functions. -* tr utility: Translate Program. -* translate.awk program: Translate Program. -* troubleshooting, --non-decimal-data option: Options. -* troubleshooting, -F option: Known Bugs. + (line 13078) +* tmp_number internal function: Internals. (line 18841) +* tmp_string internal function: Internals. (line 18836) +* tolower function: String Functions. (line 9592) +* toupper function: String Functions. (line 9598) +* tr utility: Translate Program. (line 15567) +* translate.awk program: Translate Program. (line 15615) +* troubleshooting, --non-decimal-data option: Options. (line 12136) +* troubleshooting, -F option: Known Bugs. (line 12420) * troubleshooting, == operator: Typing and Comparison. -* troubleshooting, awk uses FS not IFS: Field Separators. + (line 6369) +* troubleshooting, awk uses FS not IFS: Field Separators. (line 3277) * troubleshooting, backslash before nonspecial character: Escape Sequences. -* troubleshooting, division: Arithmetic Ops. + (line 2145) +* troubleshooting, division: Arithmetic Ops. (line 5853) * troubleshooting, fatal errors, field widths, specifying: Constant Size. + (line 3610) * troubleshooting, fatal errors, printf format strings: Format Modifiers. -* troubleshooting, fflush function: I/O Functions. -* troubleshooting, function call syntax: Function Calls. + (line 4759) +* troubleshooting, fflush function: I/O Functions. (line 9840) +* troubleshooting, function call syntax: Function Calls. (line 6607) * troubleshooting, gawk <1>: Compatibility Mode. -* troubleshooting, gawk: Known Bugs. -* troubleshooting, gawk, bug reports: Bugs. + (line 18471) +* troubleshooting, gawk: Known Bugs. (line 12420) +* troubleshooting, gawk, bug reports: Bugs. (line 18285) * troubleshooting, gawk, fatal errors, function arguments: Calling Built-in. -* troubleshooting, getline function: File Checking. -* troubleshooting, gsub/sub functions: String Functions. -* troubleshooting, match function: String Functions. + (line 9009) +* troubleshooting, getline function: File Checking. (line 13318) +* troubleshooting, gsub/sub functions: String Functions. (line 9473) +* troubleshooting, match function: String Functions. (line 9322) * troubleshooting, print statement, omitting commas: Print Examples. -* troubleshooting, printing: Redirection. -* troubleshooting, quotes with file names: Special FD. -* troubleshooting, readable data files: File Checking. + (line 4330) +* troubleshooting, printing: Redirection. (line 4951) +* troubleshooting, quotes with file names: Special FD. (line 5068) +* troubleshooting, readable data files: File Checking. (line 13300) * troubleshooting, regexp constants vs. string constants: Computed Regexps. -* troubleshooting, string concatenation: Concatenation. -* troubleshooting, substr function: String Functions. -* troubleshooting, system function: I/O Functions. + (line 2687) +* troubleshooting, string concatenation: Concatenation. (line 5921) +* troubleshooting, substr function: String Functions. (line 9568) +* troubleshooting, system function: I/O Functions. (line 9876) * troubleshooting, typographical errors, global variables: Options. -* true, logical: Truth Values. -* Trueman, David <1>: Contributors. -* Trueman, David <2>: Acknowledgments. -* Trueman, David: History. -* trunc-mod operation: Arithmetic Ops. -* truth values: Truth Values. -* type conversion: Conversion. -* type internal variable: Internals. -* undefined functions: Function Caveats. + (line 12092) +* true, logical: Truth Values. (line 6238) +* Trueman, David <1>: Contributors. (line 17041) +* Trueman, David <2>: Acknowledgments. (line 986) +* Trueman, David: History. (line 653) +* trunc-mod operation: Arithmetic Ops. (line 5875) +* truth values: Truth Values. (line 6238) +* type conversion: Conversion. (line 5726) +* type internal variable: Internals. (line 18807) +* undefined functions: Function Caveats. (line 10720) * underscore (_), _ C macro: Explaining gettext. + (line 10963) * underscore (_), in names of private variables: Library Names. -* underscore (_), translatable string: Programmer i18n. -* undocumented features: Undocumented. + (line 12530) +* underscore (_), translatable string: Programmer i18n. (line 11092) +* undocumented features: Undocumented. (line 12409) * uninitialized variables, as array subscripts: Uninitialized Subscripts. -* uniq utility: Uniq Program. -* uniq.awk program: Uniq Program. -* Unix: Glossary. + (line 8699) +* uniq utility: Uniq Program. (line 15014) +* uniq.awk program: Uniq Program. (line 15073) +* Unix: Glossary. (line 20320) * Unix awk, backslashes in escape sequences: Escape Sequences. + (line 2157) * Unix awk, close function and: Close Files And Pipes. + (line 5315) * Unix awk, password files, field separators and: Command Line Field Separator. + (line 3485) * Unix, awk scripts and: Executable Scripts. -* unsigned integers: Basic Data Typing. -* update_ERRNO internal function: Internals. -* user database, reading: Passwd Functions. -* user-defined, functions: User-defined. -* user-defined, functions, counts: Profiling. -* user-defined, variables: Variables. -* user-modifiable variables: User-modified. -* users, information about, printing: Id Program. -* users, information about, retrieving: Passwd Functions. -* USR1 signal: Profiling. -* values, numeric: Basic Data Typing. -* values, string: Basic Data Typing. + (line 1233) +* unsigned integers: Basic Data Typing. (line 19577) +* update_ERRNO internal function: Internals. (line 18901) +* user database, reading: Passwd Functions. (line 13709) +* user-defined, functions: User-defined. (line 10452) +* user-defined, functions, counts: Profiling. (line 11853) +* user-defined, variables: Variables. (line 5613) +* user-modifiable variables: User-modified. (line 7805) +* users, information about, printing: Id Program. (line 14721) +* users, information about, retrieving: Passwd Functions. (line 13719) +* USR1 signal: Profiling. (line 11906) +* values, numeric: Basic Data Typing. (line 19562) +* values, string: Basic Data Typing. (line 19562) * variable typing: Typing and Comparison. -* variables <1>: Basic Data Typing. -* variables: Other Features. + (line 6269) +* variables <1>: Basic Data Typing. (line 19555) +* variables: Other Features. (line 1879) * variables, assigning on command line: Assignment Options. + (line 5663) * variables, built-in <1>: Built-in Variables. -* variables, built-in: Using Variables. -* variables, built-in, -v option, setting with: Options. -* variables, built-in, conveying information: Auto-set. -* variables, flag: Boolean Ops. + (line 7779) +* variables, built-in: Using Variables. (line 5642) +* variables, built-in, -v option, setting with: Options. (line 12029) +* variables, built-in, conveying information: Auto-set. (line 7959) +* variables, flag: Boolean Ops. (line 6516) * variables, getline command into, using <1>: Getline/Variable/Coprocess. + (line 4159) * variables, getline command into, using <2>: Getline/Variable/Pipe. + (line 4102) * variables, getline command into, using <3>: Getline/Variable/File. -* variables, getline command into, using: Getline/Variable. -* variables, global, for library functions: Library Names. -* variables, global, printing list of: Options. -* variables, initializing: Using Variables. -* variables, names of: Arrays. -* variables, private: Library Names. -* variables, setting: Options. -* variables, shadowing: Definition Syntax. -* variables, types of: Assignment Ops. + (line 4004) +* variables, getline command into, using: Getline/Variable. (line 3930) +* variables, global, for library functions: Library Names. (line 12512) +* variables, global, printing list of: Options. (line 12086) +* variables, initializing: Using Variables. (line 5642) +* variables, names of: Arrays. (line 8279) +* variables, private: Library Names. (line 12512) +* variables, setting: Options. (line 12021) +* variables, shadowing: Definition Syntax. (line 10522) +* variables, types of: Assignment Ops. (line 6014) * variables, types of, comparison expressions and: Typing and Comparison. + (line 6269) * variables, uninitialized, as array subscripts: Uninitialized Subscripts. -* variables, user-defined: Variables. -* vertical bar (|): Regexp Operators. -* vertical bar (|), | operator (I/O) <1>: Precedence. -* vertical bar (|), | operator (I/O): Getline/Pipe. -* vertical bar (|), |& I/O operator (I/O): Two-way I/O. -* vertical bar (|), |& operator (I/O) <1>: Precedence. -* vertical bar (|), |& operator (I/O): Getline/Coprocess. + (line 8699) +* variables, user-defined: Variables. (line 5613) +* vertical bar (|): Regexp Operators. (line 2243) +* vertical bar (|), | operator (I/O) <1>: Precedence. (line 6703) +* vertical bar (|), | operator (I/O): Getline/Pipe. (line 4043) +* vertical bar (|), |& I/O operator (I/O): Two-way I/O. (line 11545) +* vertical bar (|), |& operator (I/O) <1>: Precedence. (line 6703) +* vertical bar (|), |& operator (I/O): Getline/Coprocess. (line 4129) * vertical bar (|), |& operator (I/O), two-way communications: Portal Files. -* vertical bar (|), || operator <1>: Precedence. -* vertical bar (|), || operator: Boolean Ops. -* vname internal variable: Internals. -* w utility: Constant Size. -* Wall, Larry: Future Extensions. -* warnings, issuing: Options. -* wc utility: Wc Program. -* wc.awk program: Wc Program. -* Weinberger, Peter <1>: Contributors. -* Weinberger, Peter: History. -* while statement <1>: While Statement. -* while statement: Regexp Usage. -* whitespace, as field separators: Field Separators. -* whitespace, functions, calling: Calling Built-in. -* whitespace, newlines as: Options. -* Williams, Kent: Contributors. -* Woods, John: Contributors. + (line 11714) +* vertical bar (|), || operator <1>: Precedence. (line 6728) +* vertical bar (|), || operator: Boolean Ops. (line 6506) +* vname internal variable: Internals. (line 18811) +* w utility: Constant Size. (line 3610) +* Wall, Larry: Future Extensions. (line 19333) +* warnings, issuing: Options. (line 12116) +* wc utility: Wc Program. (line 15230) +* wc.awk program: Wc Program. (line 15269) +* Weinberger, Peter <1>: Contributors. (line 17022) +* Weinberger, Peter: History. (line 640) +* while statement <1>: While Statement. (line 7291) +* while statement: Regexp Usage. (line 1989) +* whitespace, as field separators: Field Separators. (line 3312) +* whitespace, functions, calling: Calling Built-in. (line 9003) +* whitespace, newlines as: Options. (line 12148) +* Williams, Kent: Contributors. (line 17047) +* Woods, John: Contributors. (line 17038) * word boundaries, matching: GNU Regexp Operators. + (line 2485) * word, regexp definition of: GNU Regexp Operators. + (line 2461) * word-boundary operator (gawk): GNU Regexp Operators. -* wordfreq.awk program: Word Sorting. -* words, counting: Wc Program. -* words, duplicate, searching for: Dupword Program. -* words, usage counts, generating: Word Sorting. -* xgettext utility: String Extraction. -* XOR bitwise operation: Bitwise Functions. -* xor function (gawk): Bitwise Functions. -* Zaretskii, Eli: Acknowledgments. + (line 2510) +* wordfreq.awk program: Word Sorting. (line 15848) +* words, counting: Wc Program. (line 15230) +* words, duplicate, searching for: Dupword Program. (line 15395) +* words, usage counts, generating: Word Sorting. (line 15794) +* xgettext utility: String Extraction. (line 11164) +* XOR bitwise operation: Bitwise Functions. (line 10294) +* xor function (gawk): Bitwise Functions. (line 10329) +* Zaretskii, Eli: Acknowledgments. (line 995) * zero, negative vs. positive: Floating Point Issues. -* zerofile.awk program: Empty Files. -* Zoulas, Christos: Contributors. -* {} (braces), actions and: Action Overview. -* {} (braces), pgawk program: Profiling. -* {} (braces), statements, grouping: Statements. -* | (vertical bar): Regexp Operators. -* | (vertical bar), | operator (I/O) <1>: Precedence. -* | (vertical bar), | operator (I/O) <2>: Redirection. -* | (vertical bar), | operator (I/O): Getline/Pipe. -* | (vertical bar), |& operator (I/O) <1>: Two-way I/O. -* | (vertical bar), |& operator (I/O) <2>: Precedence. -* | (vertical bar), |& operator (I/O) <3>: Redirection. -* | (vertical bar), |& operator (I/O): Getline/Coprocess. + (line 19714) +* zerofile.awk program: Empty Files. (line 13343) +* Zoulas, Christos: Contributors. (line 17071) +* {} (braces), actions and: Action Overview. (line 7170) +* {} (braces), pgawk program: Profiling. (line 11858) +* {} (braces), statements, grouping: Statements. (line 7220) +* | (vertical bar): Regexp Operators. (line 2243) +* | (vertical bar), | operator (I/O) <1>: Precedence. (line 6703) +* | (vertical bar), | operator (I/O) <2>: Redirection. (line 4891) +* | (vertical bar), | operator (I/O): Getline/Pipe. (line 4043) +* | (vertical bar), |& operator (I/O) <1>: Two-way I/O. (line 11545) +* | (vertical bar), |& operator (I/O) <2>: Precedence. (line 6703) +* | (vertical bar), |& operator (I/O) <3>: Redirection. (line 4936) +* | (vertical bar), |& operator (I/O): Getline/Coprocess. (line 4129) * | (vertical bar), |& operator (I/O), pipes, closing: Close Files And Pipes. + (line 5302) * | (vertical bar), |& operator (I/O), two-way communications: Portal Files. -* | (vertical bar), || operator <1>: Precedence. -* | (vertical bar), || operator: Boolean Ops. + (line 11714) +* | (vertical bar), || operator <1>: Precedence. (line 6728) +* | (vertical bar), || operator: Boolean Ops. (line 6506) * ~ (tilde), ~ operator <1>: Expression Patterns. -* ~ (tilde), ~ operator <2>: Precedence. + (line 6843) +* ~ (tilde), ~ operator <2>: Precedence. (line 6719) * ~ (tilde), ~ operator <3>: Typing and Comparison. -* ~ (tilde), ~ operator <4>: Regexp Constants. -* ~ (tilde), ~ operator <5>: Computed Regexps. -* ~ (tilde), ~ operator: Case-sensitivity. + (line 6334) +* ~ (tilde), ~ operator <4>: Regexp Constants. (line 5524) +* ~ (tilde), ~ operator <5>: Computed Regexps. (line 2656) +* ~ (tilde), ~ operator: Case-sensitivity. (line 2569)  Tag Table: -Node: Top1322 -Node: Foreword26888 -Node: Preface31212 -Ref: Preface-Footnote-134094 -Node: History34326 -Node: Names36541 -Ref: Names-Footnote-138016 -Node: This Manual38088 -Ref: This Manual-Footnote-142846 -Node: Conventions42946 -Node: Manual History44823 -Ref: Manual History-Footnote-148271 -Ref: Manual History-Footnote-248312 -Node: How To Contribute48386 -Node: Acknowledgments48984 -Node: Getting Started52789 -Node: Running gawk55160 -Node: One-shot56341 -Node: Read Terminal57557 -Ref: Read Terminal-Footnote-159206 -Node: Long59377 -Node: Executable Scripts60744 -Ref: Executable Scripts-Footnote-162640 -Ref: Executable Scripts-Footnote-262791 -Node: Comments63242 -Node: Quoting65601 -Node: Sample Data Files69515 -Node: Very Simple72548 -Node: Two Rules77148 -Node: More Complex79290 -Ref: More Complex-Footnote-182204 -Ref: More Complex-Footnote-282652 -Node: Statements/Lines82735 -Ref: Statements/Lines-Footnote-187094 -Node: Other Features87359 -Node: When88206 -Node: Regexp90173 -Node: Regexp Usage91626 -Node: Escape Sequences93673 -Node: Regexp Operators99413 -Ref: Regexp Operators-Footnote-1106515 -Ref: Regexp Operators-Footnote-2106662 -Node: Character Lists106760 -Node: GNU Regexp Operators111229 -Node: Case-sensitivity114795 -Ref: Case-sensitivity-Footnote-1117813 -Node: Leftmost Longest118048 -Node: Computed Regexps119234 -Node: Locales122641 -Node: Reading Files124668 -Node: Records126424 -Ref: Records-Footnote-1134517 -Node: Fields134554 -Ref: Fields-Footnote-1137578 -Node: Nonconstant Fields137664 -Node: Changing Fields139860 -Node: Field Separators145136 -Node: Regexp Field Splitting148619 -Node: Single Character Fields151075 -Node: Command Line Field Separator152117 -Node: Field Splitting Summary155547 -Ref: Field Splitting Summary-Footnote-1158730 -Node: Constant Size158831 -Node: Multiple Line163306 -Ref: Multiple Line-Footnote-1169011 -Node: Getline169190 -Node: Plain Getline171253 -Node: Getline/Variable173267 -Node: Getline/File174399 -Node: Getline/Variable/File175714 -Node: Getline/Pipe177264 -Node: Getline/Variable/Pipe179317 -Node: Getline/Coprocess180415 -Node: Getline/Variable/Coprocess181646 -Node: Getline Notes182351 -Node: Getline Summary183985 -Node: Printing184692 -Node: Print186320 -Node: Print Examples187641 -Node: Output Separators190421 -Node: OFMT192177 -Node: Printf193527 -Node: Basic Printf194441 -Node: Control Letters195967 -Node: Format Modifiers198654 -Node: Printf Examples203656 -Node: Redirection206364 -Node: Special Files212947 -Node: Special FD213576 -Node: Special Process216593 -Node: Special Network218799 -Node: Special Caveats219632 -Ref: Special Caveats-Footnote-1220821 -Node: Close Files And Pipes221204 -Ref: Close Files And Pipes-Footnote-1228105 -Ref: Close Files And Pipes-Footnote-2228253 -Node: Expressions228401 -Node: Constants230589 -Node: Scalar Constants231265 -Ref: Scalar Constants-Footnote-1232111 -Node: Nondecimal-numbers232293 -Node: Regexp Constants235345 -Node: Using Constant Regexps235809 -Node: Variables238891 -Node: Using Variables239542 -Node: Assignment Options241043 -Node: Conversion242911 -Ref: Conversion-Footnote-1247679 -Node: Arithmetic Ops247788 -Node: Concatenation250285 -Node: Assignment Ops252980 -Node: Increment Ops259186 -Node: Truth Values262674 -Node: Typing and Comparison263719 -Ref: Typing and Comparison-Footnote-1270152 -Node: Boolean Ops270297 -Node: Conditional Exp274291 -Node: Function Calls276021 -Node: Precedence278914 -Node: Patterns and Actions282332 -Node: Pattern Overview283385 -Node: Regexp Patterns284814 -Node: Expression Patterns285348 -Node: Ranges288889 -Node: BEGIN/END291969 -Node: Using BEGIN/END292709 -Ref: Using BEGIN/END-Footnote-1295428 -Node: I/O And BEGIN/END295542 -Node: Empty297796 -Node: Using Shell Variables298095 -Node: Action Overview300371 -Node: Statements302723 -Node: If Statement304574 -Node: While Statement306064 -Node: Do Statement308087 -Node: For Statement309227 -Node: Switch Statement312358 -Node: Break Statement314216 -Node: Continue Statement316264 -Node: Next Statement318159 -Node: Nextfile Statement320430 -Node: Exit Statement323018 -Node: Built-in Variables325078 -Node: User-modified326168 -Ref: User-modified-Footnote-1333402 -Node: Auto-set333464 -Ref: Auto-set-Footnote-1341317 -Node: ARGC and ARGV341522 -Node: Arrays345226 -Node: Array Intro347133 -Node: Reference to Elements351326 -Node: Assigning Elements353188 -Node: Array Example353650 -Node: Scanning an Array355373 -Node: Delete357640 -Ref: Delete-Footnote-1360017 -Node: Numeric Array Subscripts360074 -Node: Uninitialized Subscripts362256 -Node: Multi-dimensional363857 -Node: Multi-scanning366870 -Node: Array Sorting368478 -Node: Functions371826 -Node: Built-in372560 -Node: Calling Built-in373525 -Node: Numeric Functions375483 -Ref: Numeric Functions-Footnote-1379226 -Ref: Numeric Functions-Footnote-2379552 -Node: String Functions379821 -Ref: String Functions-Footnote-1399010 -Ref: String Functions-Footnote-2399139 -Ref: String Functions-Footnote-3399386 -Node: Gory Details399473 -Ref: Gory Details-Footnote-1406035 -Ref: Gory Details-Footnote-2406086 -Node: I/O Functions406293 -Ref: I/O Functions-Footnote-1412864 -Node: Time Functions412955 -Ref: Time Functions-Footnote-1423681 -Ref: Time Functions-Footnote-2423749 -Ref: Time Functions-Footnote-3423907 -Ref: Time Functions-Footnote-4424018 -Ref: Time Functions-Footnote-5424143 -Ref: Time Functions-Footnote-6424370 -Node: Bitwise Functions424632 -Ref: Bitwise Functions-Footnote-1429291 -Node: I18N Functions429475 -Node: User-defined431187 -Node: Definition Syntax431963 -Node: Function Example436313 -Node: Function Caveats438894 -Node: Return Statement442751 -Node: Dynamic Typing445409 -Node: Internationalization446147 -Node: I18N and L10N447565 -Node: Explaining gettext448245 -Ref: Explaining gettext-Footnote-1453152 -Ref: Explaining gettext-Footnote-2453391 -Node: Programmer i18n453560 -Node: Translator i18n457778 -Node: String Extraction458563 -Ref: String Extraction-Footnote-1459504 -Node: Printf Ordering459630 -Ref: Printf Ordering-Footnote-1462373 -Node: I18N Portability462437 -Ref: I18N Portability-Footnote-1464875 -Node: I18N Example464938 -Ref: I18N Example-Footnote-1467550 -Node: Gawk I18N467622 -Node: Advanced Features468444 -Node: Nondecimal Data469837 -Node: Two-way I/O471389 -Ref: Two-way I/O-Footnote-1476885 -Node: TCP/IP Networking476962 -Node: Portal Files479381 -Node: Profiling480018 -Node: Invoking Gawk487644 -Node: Command Line488821 -Node: Options489599 -Ref: Options-Footnote-1500961 -Node: Other Arguments500986 -Node: AWKPATH Variable503660 -Ref: AWKPATH Variable-Footnote-1506394 -Node: Obsolete506654 -Node: Undocumented507647 -Node: Known Bugs507899 -Node: Library Functions508491 -Ref: Library Functions-Footnote-1511470 -Node: Library Names511641 -Ref: Library Names-Footnote-1515107 -Ref: Library Names-Footnote-2515326 -Node: General Functions515412 -Node: Nextfile Function516348 -Node: Assert Function520713 -Node: Round Function524016 -Node: Cliff Random Function525528 -Ref: Cliff Random Function-Footnote-1526511 -Node: Ordinal Functions526582 -Ref: Ordinal Functions-Footnote-1529656 -Node: Join Function529872 -Ref: Join Function-Footnote-1531621 -Node: Gettimeofday Function531821 -Node: Data File Management535543 -Node: Filetrans Function536168 -Node: Rewind Function539598 -Node: File Checking541048 -Node: Empty Files542089 -Node: Ignoring Assigns544318 -Node: Getopt Function545860 -Ref: Getopt Function-Footnote-1556912 -Node: Passwd Functions557113 -Ref: Passwd Functions-Footnote-1565797 -Node: Group Functions565885 -Node: Sample Programs573907 -Node: Running Examples574581 -Node: Clones575302 -Node: Cut Program576427 -Node: Egrep Program586158 -Ref: Egrep Program-Footnote-1593942 -Node: Id Program594052 -Node: Split Program597683 -Node: Tee Program601150 -Node: Uniq Program603821 -Node: Wc Program611238 -Ref: Wc Program-Footnote-1615491 -Node: Miscellaneous Programs615686 -Node: Dupword Program616675 -Node: Alarm Program618695 -Node: Translate Program623271 -Ref: Translate Program-Footnote-1627526 -Ref: Translate Program-Footnote-2627763 -Node: Labels Program627897 -Ref: Labels Program-Footnote-1631222 -Node: Word Sorting631306 -Node: History Sorting635593 -Node: Extract Program637425 -Node: Simple Sed644799 -Node: Igawk Program647863 -Ref: Igawk Program-Footnote-1662668 -Ref: Igawk Program-Footnote-2662869 -Node: Language History663007 -Node: V7/SVR3.1664374 -Node: SVR4666449 -Node: POSIX667883 -Node: BTL669388 -Node: POSIX/GNU670907 -Node: Contributors677998 -Node: Installation681436 -Node: Gawk Distribution682388 -Node: Getting682867 -Node: Extracting684087 -Node: Distribution contents685466 -Node: Unix Installation690677 -Node: Quick Installation691263 -Node: Additional Configuration Options692956 -Node: Configuration Philosophy694905 -Node: Non-Unix Installation697260 -Node: Amiga Installation697842 -Node: BeOS Installation698929 -Node: PC Installation700073 -Node: PC Binary Installation701294 -Node: PC Compiling703124 -Node: PC Dynamic707660 -Node: PC Using710008 -Node: Cygwin714608 -Ref: Cygwin-Footnote-1715583 -Node: VMS Installation715615 -Node: VMS Compilation716134 -Node: VMS Installation Details717698 -Node: VMS Running719315 -Node: VMS POSIX720899 -Node: Unsupported722163 -Node: Atari Installation722561 -Node: Atari Compiling723841 -Node: Atari Using725713 -Node: Tandem Installation728545 -Node: Bugs730216 -Node: Other Versions733501 -Ref: Other Versions-Footnote-1737100 -Node: Notes737142 -Node: Compatibility Mode737815 -Node: Additions738604 -Node: Adding Code739349 -Node: New Ports745372 -Node: Dynamic Extensions749424 -Node: Internals750440 -Node: Sample Library757218 -Node: Internal File Description757868 -Node: Internal File Ops761548 -Ref: Internal File Ops-Footnote-1766964 -Node: Using Internal File Ops767112 -Node: Future Extensions769133 -Node: Basic Concepts773214 -Node: Basic High Level773952 -Ref: Basic High Level-Footnote-1777979 -Node: Basic Data Typing778173 -Node: Floating Point Issues782605 -Ref: Floating Point Issues-Footnote-1786485 -Ref: Floating Point Issues-Footnote-2786538 -Node: Glossary786647 -Node: Copying810256 -Node: GNU Free Documentation License829453 -Node: Index851856 +Node: Top1314 +Node: Foreword26871 +Node: Preface31192 +Ref: Preface-Footnote-134053 +Node: History34282 +Node: Names36485 +Ref: Names-Footnote-137945 +Node: This Manual38014 +Ref: This Manual-Footnote-142699 +Node: Conventions42796 +Node: Manual History44658 +Ref: Manual History-Footnote-148078 +Ref: Manual History-Footnote-248116 +Node: How To Contribute48187 +Node: Acknowledgments48785 +Node: Getting Started52552 +Node: Running gawk54916 +Node: One-shot56096 +Node: Read Terminal57312 +Ref: Read Terminal-Footnote-158958 +Node: Long59126 +Node: Executable Scripts60496 +Ref: Executable Scripts-Footnote-162380 +Ref: Executable Scripts-Footnote-262528 +Node: Comments62976 +Node: Quoting65329 +Node: Sample Data Files69809 +Node: Very Simple72829 +Node: Two Rules77419 +Node: More Complex79557 +Ref: More Complex-Footnote-182461 +Ref: More Complex-Footnote-282906 +Node: Statements/Lines82986 +Ref: Statements/Lines-Footnote-187344 +Node: Other Features87606 +Node: When88452 +Ref: When-Footnote-190678 +Node: Regexp90756 +Node: Regexp Usage92207 +Node: Escape Sequences94244 +Node: Regexp Operators99960 +Ref: Regexp Operators-Footnote-1107049 +Ref: Regexp Operators-Footnote-2107193 +Node: Character Lists107288 +Ref: table-char-classes109232 +Node: GNU Regexp Operators112756 +Node: Case-sensitivity116327 +Ref: Case-sensitivity-Footnote-1119477 +Node: Leftmost Longest119709 +Node: Computed Regexps120891 +Node: Locales124254 +Node: Reading Files126274 +Node: Records128025 +Ref: Records-Footnote-1136064 +Node: Fields136098 +Ref: Fields-Footnote-1139110 +Node: Nonconstant Fields139193 +Node: Changing Fields141385 +Node: Field Separators146631 +Node: Regexp Field Splitting150100 +Node: Single Character Fields152556 +Node: Command Line Field Separator153605 +Node: Field Splitting Summary157022 +Ref: Field Splitting Summary-Footnote-1160200 +Node: Constant Size160298 +Node: Multiple Line164754 +Ref: Multiple Line-Footnote-1170417 +Node: Getline170593 +Node: Plain Getline172652 +Node: Getline/Variable174694 +Node: Getline/File175832 +Node: Getline/Variable/File177150 +Node: Getline/Pipe178697 +Node: Getline/Variable/Pipe180753 +Node: Getline/Coprocess181854 +Node: Getline/Variable/Coprocess183085 +Node: Getline Notes183793 +Node: Getline Summary185436 +Ref: table-getline-variants185720 +Node: Printing186885 +Node: Print188514 +Node: Print Examples189834 +Node: Output Separators192614 +Node: OFMT194366 +Node: Printf195718 +Node: Basic Printf196637 +Node: Control Letters198164 +Node: Format Modifiers201384 +Node: Printf Examples207419 +Node: Redirection210118 +Node: Special Files216680 +Node: Special FD217314 +Node: Special Process220328 +Node: Special Network222560 +Node: Special Caveats223399 +Ref: Special Caveats-Footnote-1224594 +Node: Close Files And Pipes224974 +Ref: Close Files And Pipes-Footnote-1231835 +Ref: Close Files And Pipes-Footnote-2231980 +Node: Expressions232125 +Node: Constants234311 +Node: Scalar Constants234989 +Ref: Scalar Constants-Footnote-1235838 +Node: Nondecimal-numbers236017 +Node: Regexp Constants239059 +Node: Using Constant Regexps239532 +Node: Variables242609 +Node: Using Variables243265 +Node: Assignment Options244766 +Node: Conversion246640 +Ref: Conversion-Footnote-1251389 +Node: Arithmetic Ops251495 +Node: Concatenation253990 +Node: Assignment Ops256674 +Ref: table-assign-ops261623 +Node: Increment Ops263527 +Node: Truth Values267002 +Node: Typing and Comparison268049 +Ref: table-relational-ops271096 +Ref: Typing and Comparison-Footnote-1275337 +Node: Boolean Ops275479 +Node: Conditional Exp279485 +Node: Function Calls281216 +Node: Precedence284099 +Node: Patterns and Actions287520 +Node: Pattern Overview288571 +Node: Regexp Patterns290005 +Node: Expression Patterns290548 +Node: Ranges294080 +Node: BEGIN/END297154 +Node: Using BEGIN/END297904 +Ref: Using BEGIN/END-Footnote-1300622 +Node: I/O And BEGIN/END300733 +Node: Empty302990 +Node: Using Shell Variables303298 +Node: Action Overview305569 +Node: Statements307921 +Node: If Statement309774 +Node: While Statement311270 +Node: Do Statement313299 +Node: For Statement314445 +Node: Switch Statement317561 +Node: Break Statement319802 +Node: Continue Statement321850 +Node: Next Statement323748 +Node: Nextfile Statement326016 +Node: Exit Statement328592 +Node: Built-in Variables330647 +Node: User-modified331739 +Ref: User-modified-Footnote-1338979 +Node: Auto-set339038 +Ref: Auto-set-Footnote-1347375 +Node: ARGC and ARGV347577 +Node: Arrays351271 +Node: Array Intro353173 +Node: Reference to Elements357347 +Node: Assigning Elements359202 +Node: Array Example359669 +Node: Scanning an Array361385 +Node: Delete363646 +Ref: Delete-Footnote-1365998 +Node: Numeric Array Subscripts366052 +Node: Uninitialized Subscripts368230 +Node: Multi-dimensional369821 +Node: Multi-scanning372817 +Node: Array Sorting374426 +Node: Functions378063 +Node: Built-in378795 +Node: Calling Built-in379765 +Node: Numeric Functions381720 +Ref: Numeric Functions-Footnote-1385459 +Ref: Numeric Functions-Footnote-2385782 +Node: String Functions386048 +Ref: String Functions-Footnote-1405281 +Ref: String Functions-Footnote-2405407 +Ref: String Functions-Footnote-3405651 +Node: Gory Details405735 +Ref: table-sub-escapes407361 +Ref: table-sub-posix-92408696 +Ref: table-sub-proposed410035 +Ref: table-posix-2001-sub411388 +Ref: table-gensub-escapes412725 +Ref: Gory Details-Footnote-1413908 +Node: I/O Functions413956 +Ref: I/O Functions-Footnote-1420518 +Node: Time Functions420606 +Ref: Time Functions-Footnote-1431290 +Ref: Time Functions-Footnote-2431355 +Ref: Time Functions-Footnote-3431510 +Ref: Time Functions-Footnote-4431618 +Ref: Time Functions-Footnote-5431740 +Ref: Time Functions-Footnote-6431964 +Node: Bitwise Functions432223 +Ref: table-bitwise-ops432798 +Ref: Bitwise Functions-Footnote-1437020 +Node: I18N Functions437201 +Node: User-defined438924 +Node: Definition Syntax439705 +Node: Function Example444031 +Node: Function Caveats446596 +Node: Return Statement450500 +Node: Dynamic Typing453139 +Node: Internationalization453873 +Node: I18N and L10N455289 +Node: Explaining gettext455973 +Ref: Explaining gettext-Footnote-1460861 +Ref: Explaining gettext-Footnote-2461097 +Node: Programmer i18n461263 +Node: Translator i18n465480 +Node: String Extraction466267 +Ref: String Extraction-Footnote-1467211 +Node: Printf Ordering467334 +Ref: Printf Ordering-Footnote-1470086 +Node: I18N Portability470147 +Ref: I18N Portability-Footnote-1472571 +Node: I18N Example472631 +Ref: I18N Example-Footnote-1475223 +Node: Gawk I18N475292 +Node: Advanced Features476113 +Node: Nondecimal Data477507 +Node: Two-way I/O479057 +Ref: Two-way I/O-Footnote-1484506 +Node: TCP/IP Networking484580 +Node: Portal Files486991 +Node: Profiling487632 +Node: Invoking Gawk495148 +Node: Command Line496325 +Node: Options497104 +Ref: Options-Footnote-1508439 +Node: Other Arguments508461 +Node: AWKPATH Variable511121 +Ref: AWKPATH Variable-Footnote-1513878 +Node: Obsolete514135 +Node: Undocumented515129 +Node: Known Bugs515388 +Node: Library Functions515990 +Ref: Library Functions-Footnote-1518944 +Node: Library Names519112 +Ref: Library Names-Footnote-1522559 +Ref: Library Names-Footnote-2522775 +Node: General Functions522858 +Node: Nextfile Function523917 +Node: Strtonum Function528256 +Node: Assert Function531178 +Node: Round Function534464 +Node: Cliff Random Function535971 +Ref: Cliff Random Function-Footnote-1536954 +Node: Ordinal Functions537022 +Ref: Ordinal Functions-Footnote-1540070 +Node: Join Function540283 +Ref: Join Function-Footnote-1542034 +Node: Gettimeofday Function542231 +Node: Data File Management545928 +Node: Filetrans Function546560 +Node: Rewind Function549968 +Node: File Checking551405 +Node: Empty Files552453 +Node: Ignoring Assigns554660 +Node: Getopt Function556196 +Ref: Getopt Function-Footnote-1567160 +Node: Passwd Functions567358 +Ref: Passwd Functions-Footnote-1575966 +Node: Group Functions576051 +Node: Sample Programs583990 +Node: Running Examples584664 +Node: Clones585386 +Node: Cut Program586512 +Node: Egrep Program596185 +Ref: Egrep Program-Footnote-1603887 +Node: Id Program603994 +Node: Split Program607584 +Node: Tee Program611032 +Node: Uniq Program613694 +Node: Wc Program621032 +Ref: Wc Program-Footnote-1625246 +Node: Miscellaneous Programs625439 +Node: Dupword Program626435 +Node: Alarm Program628457 +Node: Translate Program632982 +Ref: Translate Program-Footnote-1637201 +Ref: Translate Program-Footnote-2637435 +Node: Labels Program637566 +Ref: Labels Program-Footnote-1640839 +Node: Word Sorting640920 +Node: History Sorting645183 +Node: Extract Program647009 +Node: Simple Sed654330 +Node: Igawk Program657364 +Ref: Igawk Program-Footnote-1671993 +Ref: Igawk Program-Footnote-2672191 +Node: Language History672326 +Node: V7/SVR3.1673710 +Node: SVR4675790 +Node: POSIX677229 +Node: BTL678736 +Node: POSIX/GNU680258 +Node: Contributors687406 +Node: Installation690849 +Node: Gawk Distribution691820 +Node: Getting692304 +Node: Extracting693530 +Node: Distribution contents694912 +Node: Unix Installation700132 +Node: Quick Installation700723 +Node: Additional Configuration Options702414 +Node: Configuration Philosophy704372 +Node: Non-Unix Installation706720 +Node: Amiga Installation707307 +Node: BeOS Installation708394 +Node: PC Installation709535 +Node: PC Binary Installation710762 +Node: PC Compiling712593 +Node: PC Dynamic717232 +Node: PC Using719578 +Node: Cygwin724172 +Ref: Cygwin-Footnote-1725164 +Node: VMS Installation725193 +Node: VMS Compilation725721 +Node: VMS Installation Details727292 +Node: VMS Running728916 +Node: VMS POSIX730505 +Node: Unsupported731776 +Node: Atari Installation732179 +Node: Atari Compiling733462 +Node: Atari Using735334 +Node: Tandem Installation738167 +Node: Bugs739832 +Node: Other Versions743095 +Ref: Other Versions-Footnote-1746696 +Node: Notes746735 +Node: Compatibility Mode747427 +Node: Additions748215 +Node: Adding Code748962 +Node: New Ports755009 +Node: Dynamic Extensions759064 +Node: Internals760080 +Node: Sample Library768299 +Node: Internal File Description768958 +Node: Internal File Ops772639 +Ref: Internal File Ops-Footnote-1777929 +Node: Using Internal File Ops778074 +Node: Future Extensions780091 +Node: Basic Concepts784355 +Node: Basic High Level785112 +Ref: Basic High Level-Footnote-1789123 +Node: Basic Data Typing789314 +Node: Floating Point Issues793716 +Ref: Floating Point Issues-Footnote-1797569 +Ref: Floating Point Issues-Footnote-2797619 +Node: Glossary797725 +Node: Copying821334 +Node: GNU Free Documentation License840460 +Node: Index862846  End Tag Table diff --git a/doc/gawk.texi b/doc/gawk.texi index c8fed041a..4ba65e3f0 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -20,9 +20,9 @@ @c applies to and all the info about who's publishing this edition @c These apply across the board. -@set UPDATE-MONTH June, 2003 +@set UPDATE-MONTH June, 2004 @set VERSION 3.1 -@set PATCHLEVEL 3 +@set PATCHLEVEL 4 @set FSF @@ -54,14 +54,14 @@ @set SUBSECTION subsection @set DARKCORNER (d.c.) @end ifhtml -@ifxml +@ifdocbook @set DOCUMENT book @set CHAPTER chapter @set APPENDIX appendix @set SECTION section @set SUBSECTION subsection @set DARKCORNER (d.c.) -@end ifxml +@end ifdocbook @c some special symbols @iftex @@ -1349,7 +1349,7 @@ For more information, see @uref{ftp://ftp.freefriends.org/arnold/Awkstuff}. If you have written an interesting @command{awk} program, or have written a @command{gawk} extension that you would like to -share with the rest of the world, please contact me (@email{arnold@@gnu.org}). +share with the rest of the world, please contact me (@email{arnold@@skeeve.com}). Making things available on the Internet helps keep the @command{gawk} distribution down to manageable size. @@ -1559,8 +1559,7 @@ of the patterns, @command{awk} performs specified actions on that line. the end of the input files. @cindex @command{awk}, uses for -@c comma here is NOT for secondary -@cindex programming languages, data-driven vs. procedural +@cindex programming languages@comma{} data-driven vs. procedural @cindex @command{awk} programs Programs in @command{awk} are different from programs in most other languages, because @command{awk} programs are @dfn{data-driven}; that is, you describe @@ -2097,6 +2096,27 @@ $ awk "BEGIN @{ print \"Here is a single quote <'>\" @}" This option is also painful, because double quotes, backslashes, and dollar signs are very common in @command{awk} programs. +A third option is to use the octal escape sequence equivalents for the +single- and double-quote characters, like so: + +@example +$ awk 'BEGIN @{ print "Here is a single quote <\47>" @}' +@print{} Here is a single quote <'> +$ awk 'BEGIN @{ print "Here is a double quote <\42>" @}' +@print{} Here is a double quote <"> +@end example + +@noindent +This works nicely, except that you should comment clearly what the +escapes mean. + +A fourth option is to use command-line variable assignment, like this: + +@example +$ awk -v sq="'" 'BEGIN @{ print "Here is a single quote <" sq ">" @}' +@print{} Here is a single quote <'> +@end example + If you really need both single and double quotes in your @command{awk} program, it is probably best to move it into a separate file, where the shell won't be part of the picture, and you can say what you mean. @@ -2622,11 +2642,12 @@ could also be written this way: /12/ @{ print $0 @} ; /21/ @{ print $0 @} @end example -@noindent -@strong{Note:} The requirement that states that rules on the same line must be +@quotation NOTE +The requirement that states that rules on the same line must be separated with a semicolon was not in the original @command{awk} language; it was added for consistency with the treatment of statements within an action. +@end quotation @node Other Features @section Other Features of @command{awk} @@ -2670,8 +2691,12 @@ edit-compile-test-debug cycle of software development. Complex programs have been written in @command{awk}, including a complete retargetable assembler for eight-bit microprocessors (@pxref{Glossary}, for more information), and a microcode assembler for a special-purpose Prolog -computer. However, @command{awk}'s capabilities are strained by tasks of -such complexity. +computer. More recently, @command{gawk} was used for writing a Wiki +clone.@footnote{@uref{http://www.awk-scripting.de/cgi/wiki.cgi/yawk/, Yet Another Wiki Clone}.} +While the original @command{awk}'s capabilities were strained by tasks +of such complexity, modern versions are more capable. Even the Bell +Labs version of @command{awk} has fewer predefined limits, and those +that it has are much larger than they used to be. @cindex @command{awk} programs, complex If you find yourself writing @command{awk} scripts of more than, say, a few @@ -3096,8 +3121,7 @@ concatenation, we can make a regular expression such as @samp{U.A}, which matches any three-character sequence that begins with @samp{U} and ends with @samp{A}. -@c comma before using does NOT do tertiary -@cindex POSIX @command{awk}, period (@code{.}), using +@cindex POSIX @command{awk}, period (@code{.})@comma{} using In strict POSIX mode (@pxref{Options}), @samp{.} does not match the @sc{nul} character, which is a character with all bits equal to zero. @@ -3312,56 +3336,14 @@ is an alphabetic character differs between the United States and France. A character class is only valid in a regexp @emph{inside} the brackets of a character list. Character classes consist of @samp{[:}, -a keyword denoting the class, and @samp{:]}. Here are the character -classes defined by the POSIX standard. - -@c the regular table is commented out while trying out the multitable. -@c leave it here in case we need to go back, but make sure the text -@c still corresponds! - -@ignore -@table @code -@item [:alnum:] -Alphanumeric characters. - -@item [:alpha:] -Alphabetic characters. - -@item [:blank:] -Space and TAB characters. - -@item [:cntrl:] -Control characters. - -@item [:digit:] -Numeric characters. - -@item [:graph:] -Characters that are printable and visible. -(A space is printable but not visible, whereas an @samp{a} is both.) - -@item [:lower:] -Lowercase alphabetic characters. - -@item [:print:] -Printable characters (characters that are not control characters). - -@item [:punct:] -Punctuation characters (characters that are not letters, digits, -control characters, or space characters). - -@item [:space:] -Space characters (such as space, TAB, and formfeed, to name a few). - -@item [:upper:] -Uppercase alphabetic characters. - -@item [:xdigit:] -Characters that are hexadecimal digits. -@end table -@end ignore - -@multitable {@code{[:xdigit:]}} {Characters that are both printable and visible. (A space is} +a keyword denoting the class, and @samp{:]}. +@ref{table-char-classes} lists the character classes defined by the +POSIX standard. + +@float Table,table-char-classes +@caption{POSIX Character Classes} +@multitable @columnfractions .15 .85 +@headitem Class @tab Meaning @item @code{[:alnum:]} @tab Alphanumeric characters. @item @code{[:alpha:]} @tab Alphabetic characters. @item @code{[:blank:]} @tab Space and TAB characters. @@ -3377,6 +3359,7 @@ control characters, or space characters). @item @code{[:upper:]} @tab Uppercase alphabetic characters. @item @code{[:xdigit:]} @tab Characters that are hexadecimal digits. @end multitable +@end float For example, before the POSIX standard, you had to write @code{/[A-Za-z0-9]/} to match alphanumeric characters. If your @@ -3483,8 +3466,7 @@ For example, @code{/stow\>/} matches @samp{stow} but not @samp{stowaway}. @c @cindex operators, @code{\y} (@command{gawk}) @cindex backslash (@code{\}), @code{\y} operator (@command{gawk}) @cindex @code{\} (backslash), @code{\y} operator (@command{gawk}) -@c comma before using does NOT do secondary -@cindex word boundaries, matching +@cindex word boundaries@comma{} matching @item \y Matches the empty string at either the beginning or the end of a word (i.e., the word boundar@strong{y}). For example, @samp{\yballs?\y} @@ -3681,6 +3663,10 @@ character set. This character set is a superset of the traditional 128 ASCII characters, which also provides a number of characters suitable for use with European languages. +As of @command{gawk} 3.1.4, the case equivalencies are fully +locale-aware. They are based on the C @code{} facilities, +such as @code{isalpha()} and @code{toupper()}. + The value of @code{IGNORECASE} has no effect if @command{gawk} is in compatibility mode (@pxref{Options}). Case is always significant in compatibility mode. @@ -3755,8 +3741,6 @@ $0 ~ digits_regexp @{ print @} This sets @code{digits_regexp} to a regexp that describes one or more digits, and tests whether the input record matches this regexp. -@c @strong{Caution:} -When using the @samp{~} and @samp{!~} @strong{Caution:} When using the @samp{~} and @samp{!~} operators, there is a difference between a regexp constant enclosed in slashes and a string constant enclosed in double quotes. @@ -4225,8 +4209,7 @@ simple @command{awk} programs so powerful. @cindex field operator @code{$} @cindex @code{$} (dollar sign), @code{$} field operator @cindex dollar sign (@code{$}), @code{$} field operator -@c The comma here does NOT mark a secondary term: -@cindex field operators, dollar sign as +@cindex field operators@comma{} dollar sign as A dollar-sign (@samp{$}) is used to refer to a field in an @command{awk} program, followed by the number of the field you want. Thus, @code{$1} @@ -4495,8 +4478,7 @@ $ echo a b c d e f | awk '@{ print "NF =", NF; @print{} a b c @end example -@c the comma before decrementing does NOT represent a tertiary entry -@cindex portability, @code{NF} variable, decrementing +@cindex portability, @code{NF} variable@comma{} decrementing @strong{Caution:} Some versions of @command{awk} don't rebuild @code{$0} when @code{NF} is decremented. Caveat emptor. @@ -4753,8 +4735,7 @@ behaves this way. @cindex options, command-line @cindex command line, options @cindex field separators, on command line -@c The comma before "setting" does NOT represent a tertiary -@cindex command line, @code{FS} on, setting +@cindex command line, @code{FS} on@comma{} setting @cindex @code{FS} variable, setting from command line @code{FS} can be set on the command line. Use the @option{-F} option to @@ -4844,8 +4825,7 @@ separator, instead of the @samp{-} in the phone number that was originally intended. This demonstrates why you have to be careful in choosing your field and record separators. -@c The comma after "password files" does NOT start a tertiary -@cindex Unix @command{awk}, password files, field separators and +@cindex Unix @command{awk}, password files@comma{} field separators and Perhaps the most common use of a single character as the field separator occurs when processing the Unix system password file. On many Unix systems, each user has a separate entry in the system password @@ -4977,9 +4957,11 @@ will take effect. @section Reading Fixed-Width Data @ifnotinfo -@strong{Note:} This @value{SECTION} discusses an advanced +@quotation NOTE +This @value{SECTION} discusses an advanced feature of @command{gawk}. If you are a novice @command{awk} user, you might want to skip it on the first reading. +@end quotation @end ifnotinfo @ifinfo @@ -5005,8 +4987,7 @@ can use a series of @code{substr} calls on @code{$0} (@pxref{String Functions}), this is awkward and inefficient for a large number of fields. -@c comma before specifying is part of tertiary -@cindex troubleshooting, fatal errors, field widths, specifying +@cindex troubleshooting, fatal errors, field widths@comma{} specifying @cindex @command{w} utility @cindex @code{FIELDWIDTHS} variable The splitting of an input record into fixed-width fields is specified by @@ -5038,9 +5019,10 @@ The following program takes the above input, converts the idle time to number of seconds, and prints out the first two fields and the calculated idle time: -@strong{Note:} +@quotation NOTE This program uses a number of @command{awk} features that haven't been introduced yet. +@end quotation @example BEGIN @{ FIELDWIDTHS = "9 6 10 6 7 7 35" @} @@ -5381,18 +5363,19 @@ write a program that does handle multiple comments on the line. This form of the @code{getline} command sets @code{NF}, @code{NR}, @code{FNR}, and the value of @code{$0}. -@strong{Note:} The new value of @code{$0} is used to test +@quotation NOTE +The new value of @code{$0} is used to test the patterns of any subsequent rules. The original value of @code{$0} that triggered the rule that executed @code{getline} is lost. By contrast, the @code{next} statement reads a new record but immediately begins processing it normally, starting with the first rule in the program. @xref{Next Statement}. +@end quotation @node Getline/Variable @subsection Using @code{getline} into a Variable -@c comma before using is NOT for tertiary -@cindex variables, @code{getline} command into, using +@cindex variables, @code{getline} command into@comma{} using You can use @samp{getline @var{var}} to read the next record from @command{awk}'s input into the variable @var{var}. No other processing is @@ -5482,8 +5465,7 @@ to be portable to other @command{awk} implementations. @node Getline/Variable/File @subsection Using @code{getline} into a Variable from a File -@c comma before using is NOT for tertiary -@cindex variables, @code{getline} command into, using +@cindex variables, @code{getline} command into@comma{} using Use @samp{getline @var{var} < @var{file}} to read input from the file @@ -5611,8 +5593,7 @@ to be portable to other @command{awk} implementations. @node Getline/Variable/Pipe @subsection Using @code{getline} into a Variable from a Pipe -@c comma before using is NOT for tertiary -@cindex variables, @code{getline} command into, using +@cindex variables, @code{getline} command into@comma{} using When you use @samp{@var{command} | getline @var{var}}, the output of @var{command} is sent through a pipe to @@ -5645,8 +5626,7 @@ program to be portable to other @command{awk} implementations. @node Getline/Coprocess @subsection Using @code{getline} from a Coprocess @cindex coprocesses, @code{getline} from -@c comma before using is NOT for tertiary -@cindex @code{getline} command, coprocesses, using from +@cindex @code{getline} command, coprocesses@comma{} using from @cindex @code{|} (vertical bar), @code{|&} operator (I/O) @cindex vertical bar (@code{|}), @code{|&} operator (I/O) @cindex operators, input/output @@ -5686,8 +5666,7 @@ where coprocesses are discussed in more detail. @node Getline/Variable/Coprocess @subsection Using @code{getline} into a Variable from a Coprocess -@c comma before using is NOT for tertiary -@cindex variables, @code{getline} command into, using +@cindex variables, @code{getline} command into@comma{} using When you use @samp{@var{command} |& getline @var{var}}, the output from the coprocess @var{command} is sent through a two-way pipe to @code{getline} @@ -5727,8 +5706,7 @@ You can open as many pipelines (and coprocesses) as the underlying operating system permits. @cindex side effects, @code{FILENAME} variable -@c The comma before "setting with" does NOT represent a tertiary -@cindex @code{FILENAME} variable, @code{getline}, setting with +@cindex @code{FILENAME} variable, @code{getline}@comma{} setting with @cindex dark corner, @code{FILENAME} variable @cindex @code{getline} command, @code{FILENAME} variable and @cindex @code{BEGIN} pattern, @code{getline} and @@ -5758,28 +5736,24 @@ trying to accomplish. @subsection Summary of @code{getline} Variants @cindex @code{getline} command, variants -The following table summarizes the eight variants of @code{getline}, +@ref{table-getline-variants} +summarizes the eight variants of @code{getline}, listing which built-in variables are set by each one. -@multitable {@var{command} @code{|& getline} @var{var}} {1234567890123456789012345678901234567890} +@float Table,table-getline-variants +@caption{getline Variants and What They Set} +@multitable @columnfractions .35 .65 +@headitem Variant @tab Effect @item @code{getline} @tab Sets @code{$0}, @code{NF}, @code{FNR}, and @code{NR} - @item @code{getline} @var{var} @tab Sets @var{var}, @code{FNR}, and @code{NR} - @item @code{getline <} @var{file} @tab Sets @code{$0} and @code{NF} - @item @code{getline @var{var} < @var{file}} @tab Sets @var{var} - @item @var{command} @code{| getline} @tab Sets @code{$0} and @code{NF} - @item @var{command} @code{| getline} @var{var} @tab Sets @var{var} - -@item @var{command} @code{|& getline} @tab Sets @code{$0} and @code{NF}. -This is a @command{gawk} extension - -@item @var{command} @code{|& getline} @var{var} @tab Sets @var{var}. -This is a @command{gawk} extension +@item @var{command} @code{|& getline} @tab Sets @code{$0} and @code{NF}. This is a @command{gawk} extension +@item @var{command} @code{|& getline} @var{var} @tab Sets @var{var}. This is a @command{gawk} extension @end multitable +@end float @c ENDOFRANGE getl @c ENDOFRANGE inex @c ENDOFRANGE infir @@ -5893,8 +5867,7 @@ $ awk '@{ print $1, $2 @}' inventory-shipped @end example @cindex @code{print} statement, commas, omitting -@c comma does NOT start tertiary -@cindex troubleshooting, @code{print} statement, omitting commas +@cindex troubleshooting, @code{print} statement@comma{} omitting commas A common mistake in using the @code{print} statement is to omit the comma between two items. This often has the effect of making the items run together in the output, with no space. The reason for this is that @@ -5909,8 +5882,7 @@ $ awk '@{ print $1 $2 @}' inventory-shipped @dots{} @end example -@c comma does NOT start tertiary -@cindex @code{BEGIN} pattern, headings, adding +@cindex @code{BEGIN} pattern, headings@comma{} adding To someone unfamiliar with the @file{inventory-shipped} file, neither example's output makes much sense. A heading line at the beginning would make it clearer. Let's add some headings to our table of months @@ -5950,8 +5922,7 @@ awk 'BEGIN @{ print "Month Crates" @end group @end example -@c comma does NOT start tertiary -@cindex @code{printf} statement, columns, aligning +@cindex @code{printf} statement, columns@comma{} aligning @cindex columns, aligning Lining up columns this way can get pretty complicated when there are many columns to fix. Counting spaces for two @@ -5962,9 +5933,11 @@ one of its specialties is lining up columns of data. @cindex line continuations, in @code{print} statement @cindex @code{print} statement, line continuations and -@strong{Note:} You can continue either a @code{print} or +@quotation NOTE +You can continue either a @code{print} or @code{printf} statement simply by putting a newline after any comma (@pxref{Statements/Lines}). +@end quotation @c ENDOFRANGE prnts @node Output Separators @@ -6030,8 +6003,7 @@ is run together on a single line. @node OFMT @section Controlling Numeric Output with @code{print} @cindex numeric, output format -@c the comma does NOT start a secondary -@cindex formats, numeric output +@cindex formats@comma{} numeric output When the @code{print} statement is used to print numeric values, @command{awk} internally converts the number to a string of characters and prints that string. @command{awk} uses the @code{sprintf} function @@ -6046,8 +6018,7 @@ more fully in @cindex @code{sprintf} function @cindex @code{OFMT} variable -@c the comma before OFMT does NOT start a tertiary -@cindex output, format specifier, @code{OFMT} +@cindex output, format specifier@comma{} @code{OFMT} The built-in variable @code{OFMT} contains the default format specification that @code{print} uses with @code{sprintf} when it wants to convert a number to a string for printing. @@ -6193,6 +6164,21 @@ which follow the decimal point. (The @samp{4.3} represents two modifiers, discussed in the next @value{SUBSECTION}.) +On systems supporting IEEE 754 floating point format, values +representing negative +infinity are formatted as +@samp{-inf} or @samp{-infinity}, +and positive infinity as +@samp{inf} and @samp{-infinity}. +The special ``not a number'' value formats as @samp{-nan} or @samp{nan}. + +@item %F +Like @code{%f} but the infinity and ``not a number'' values are spelled +using uppercase letters. + +The @code{%F} format is a POSIX extension to ISO C; not all systems +support. On those that don't, @command{gawk} uses @code{%f} instead. + @item %g@r{,} %G These print a number in either scientific notation or in floating-point notation, whichever uses fewer characters; if the result is printed in @@ -6222,7 +6208,7 @@ argument and it ignores any modifiers. @cindex dark corner, format-control characters @cindex @command{gawk}, format-control characters -@strong{Note:} +@quotation NOTE When using the integer format-control letters for values that are outside the range of the widest C integer type, @command{gawk} switches to the the @samp{%g} format specifier. If @option{--lint} is provided on the @@ -6230,14 +6216,14 @@ command line (@pxref{Options}), @command{gawk} warns about this. Other versions of @command{awk} may print invalid values or do something else entirely. @value{DARKCORNER} +@end quotation @node Format Modifiers @subsection Modifiers for @code{printf} Formats @c STARTOFRANGE pfm @cindex @code{printf} statement, modifiers -@c the comma here does NOT start a secondary -@cindex modifiers, in format specifiers +@cindex modifiers@comma{} in format specifiers A format specification can also include @dfn{modifiers} that can control how much of the item's value is printed, as well as how much space it gets. The modifiers come between the @samp{%} and the format-control letter. @@ -6316,6 +6302,32 @@ This applies even to non-numeric output formats. This flag only has an effect when the field width is wider than the value to print. +@item ' +A single quote or apostrohe character is a POSIX extension to ISO C. +It indicates that the integer part of a floating point value, or the +entire part of an integer decimal value, should have a thousands-separator +character in it. This only works in locales that support such characters. +For example: + +@example +$ @kbd{cat thousands.awk} @i{Show source program} +@print{} BEGIN @{ printf "%'d\n", 1234567 @} +$ @kbd{LC_ALL=C gawk -f thousands.awk} @i{Run it in "C" locale} +@print{} 1234567 +$ @kbd{LC_ALL=en_US.UTF-8 gawk -f thousands.awk} @i{Run in US English UTF locale} +@print{} 1,234,567 +@end example + +@noindent +For more information about locales and internationalization issues, +@strong{FIXME: see xxxx}. + +@quotation NOTE +The @samp{'} flag is a nice feature, but its use complicates things: it +now becomes difficult to use it in command-line programs. For information +on appropriate quoting tricks, @strong{FIXME: see XXXX}. +@end quotation + @item @var{width} This is a number specifying the desired minimum width of a field. Inserting any number between the @samp{%} sign and the format-control character forces the @@ -6677,8 +6689,7 @@ use @samp{>} for all the @code{print} statements, since the output file is only opened once. @cindex differences in @command{awk} and @command{gawk}, implementation limitations -@c the comma here does NOT start a secondary -@cindex implementation issues, @command{gawk}, limits +@cindex implementation issues@comma{} @command{gawk}, limits @cindex @command{awk}, implementation issues, pipes @cindex @command{gawk}, implementation issues, pipes @ifnotinfo @@ -6896,7 +6907,7 @@ They may not be used as source files with the @option{-f} option. @c @cindex automatic warnings @c @cindex warnings, automatic -@strong{Note:} +@quotation NOTE The special files that provide process-related information are now considered obsolete and will disappear entirely in the next release of @command{gawk}. @@ -6904,6 +6915,7 @@ in the next release of @command{gawk}. these files. To obtain process-related information, use the @code{PROCINFO} array. @xref{Auto-set}. +@end quotation @node Special Network @subsection Special Files for Network Communications @@ -6985,15 +6997,13 @@ Doing so results in unpredictable behavior. @cindex files, output, See output files @c STARTOFRANGE ifc @cindex input files, closing -@c comma before closing is NOT start of tertiary @c STARTOFRANGE ofc -@cindex output, files, closing +@cindex output, files@comma{} closing @c STARTOFRANGE pc @cindex pipes, closing @c STARTOFRANGE cc @cindex coprocesses, closing -@c comma before using is NOT start of tertiary -@cindex @code{getline} command, coprocesses, using from +@cindex @code{getline} command, coprocesses@comma{} using from If the same @value{FN} or the same shell command is used with @code{getline} more than once during the execution of an @command{awk} program @@ -7138,8 +7148,7 @@ files named on the command line. It is, more likely, a close of a file that was never opened, so @command{awk} silently does nothing. -@c comma is part of tertiary -@cindex @code{|} (vertical bar), @code{|&} operator (I/O), pipes, closing +@cindex @code{|} (vertical bar), @code{|&} operator (I/O), pipes@comma{} closing When using the @samp{|&} operator to communicate with a coprocess, it is occasionally useful to be able to close one end of the two-way pipe without closing the other. @@ -7159,8 +7168,7 @@ which discusses it in more detail and gives an example. @cindex advanced features, @code{close} function @cindex dark corner, @code{close} function @cindex @code{close} function, return values -@c comma does NOT start secondary -@cindex return values, @code{close} function +@cindex return values@comma{} @code{close} function @cindex differences in @command{awk} and @command{gawk}, @code{close} function @cindex Unix @command{awk}, @code{close} function and @@ -7210,8 +7218,7 @@ exit status. @c create values indicating death-by-signal? Sigh. @cindex pipes, closing -@c comma does NOT start tertiary -@cindex POSIX @command{awk}, pipes, closing +@cindex POSIX @command{awk}, pipes@comma{} closing For POSIX-compliant systems, if the exit status is a number above 128, then the program was terminated by a signal. Subtract 128 to get the signal number: @@ -7418,8 +7425,7 @@ they are not available. @c fakenode --- for prepinfo @subheading Advanced Notes: A Constant's Base Does Not Affect Its Value -@c comma before values does NOT start tertiary -@cindex advanced features, constants, values of +@cindex advanced features, constants@comma{} values of Once a numeric constant has been converted internally into a number, @@ -7614,8 +7620,7 @@ which is what you would do in C and in most other traditional languages. @node Assignment Options @subsection Assigning Variables on the Command Line @cindex variables, assigning on command line -@c comma before assigning does NOT start tertiary -@cindex command line, variables, assigning on +@cindex command line, variables@comma{} assigning on Any @command{awk} variable can be set by including a @dfn{variable assignment} among the arguments on the command line when @command{awk} is invoked @@ -7626,8 +7631,7 @@ Such an assignment has the following form: @var{variable}=@var{text} @end example -@c comma before assigning does NOT start tertiary -@cindex @code{-v} option, variables, assigning +@cindex @code{-v} option, variables@comma{} assigning @noindent With it, a variable is set either at the beginning of the @command{awk} run or in between input files. @@ -7914,10 +7918,11 @@ may be machine-dependent. @cindex portability, @code{**} operator and @cindex @code{*} (asterisk), @code{**} operator @cindex asterisk (@code{*}), @code{**} operator -@strong{Note:} +@quotation NOTE The POSIX standard only specifies the use of @samp{^} for exponentiation. For maximum portability, do not use the @samp{**} operator. +@end quotation @node Concatenation @section String Concatenation @@ -8132,11 +8137,12 @@ foo = "a string" foo = foo + 5 @end example -@noindent -@strong{Note:} Using a variable as a number and then later as a string +@quotation NOTE +Using a variable as a number and then later as a string can be confusing and is poor programming style. The previous two examples illustrate how @command{awk} works, @emph{not} how you should write your programs! +@end quotation An assignment is an expression, so it has a value---the same value that is assigned. Thus, @samp{z = 1} is an expression with the value one. @@ -8222,36 +8228,10 @@ a[i += 2] = i + 1 @noindent The value of @code{a[3]} could be either two or four. -Here is a table of the arithmetic assignment operators. In each +@ref{table-assign-ops} lists the arithmetic assignment operators. In each case, the righthand operand is an expression whose value is converted to a number. -@ignore -@table @code -@item @var{lvalue} += @var{increment} -Adds @var{increment} to the value of @var{lvalue}. - -@item @var{lvalue} -= @var{decrement} -Subtracts @var{decrement} from the value of @var{lvalue}. - -@item @var{lvalue} *= @var{coefficient} -Multiplies the value of @var{lvalue} by @var{coefficient}. - -@item @var{lvalue} /= @var{divisor} -Divides the value of @var{lvalue} by @var{divisor}. - -@item @var{lvalue} %= @var{modulus} -Sets @var{lvalue} to its remainder by @var{modulus}. - -@cindex @command{awk} language, POSIX version -@cindex POSIX @command{awk} -@item @var{lvalue} ^= @var{power} -@itemx @var{lvalue} **= @var{power} -Raises @var{lvalue} to the power @var{power}. -(Only the @samp{^=} operator is specified by POSIX.) -@end table -@end ignore - @cindex @code{-} (hyphen), @code{-=} operator @cindex hyphen (@code{-}), @code{-=} operator @cindex @code{*} (asterisk), @code{*=} operator @@ -8264,28 +8244,28 @@ Raises @var{lvalue} to the power @var{power}. @cindex caret (@code{^}), @code{^=} operator @cindex @code{*} (asterisk), @code{**=} operator @cindex asterisk (@code{*}), @code{**=} operator -@multitable {@var{lvalue} *= @var{coefficient}} {Subtracts @var{decrement} from the value of @var{lvalue}.} +@float Table,table-assign-ops +@caption{Arithmetic Assignment Operators} +@multitable @columnfractions .30 .70 +@headitem Operator @tab Effect @item @var{lvalue} @code{+=} @var{increment} @tab Adds @var{increment} to the value of @var{lvalue}. - @item @var{lvalue} @code{-=} @var{decrement} @tab Subtracts @var{decrement} from the value of @var{lvalue}. - @item @var{lvalue} @code{*=} @var{coefficient} @tab Multiplies the value of @var{lvalue} by @var{coefficient}. - @item @var{lvalue} @code{/=} @var{divisor} @tab Divides the value of @var{lvalue} by @var{divisor}. - @item @var{lvalue} @code{%=} @var{modulus} @tab Sets @var{lvalue} to its remainder by @var{modulus}. - @cindex @command{awk} language, POSIX version @cindex POSIX @command{awk} @item @var{lvalue} @code{^=} @var{power} @tab @item @var{lvalue} @code{**=} @var{power} @tab Raises @var{lvalue} to the power @var{power}. @end multitable +@end float @cindex POSIX @command{awk}, @code{**=} operator and @cindex portability, @code{**=} operator and -@strong{Note:} +@quotation NOTE Only the @samp{^=} operator is specified by POSIX. For maximum portability, do not use the @samp{**=} operator. +@end quotation @c fakenode --- for prepinfo @subheading Advanced Notes: Syntactic Ambiguities Between @samp{/=} and Regular Expressions @@ -8407,8 +8387,7 @@ value of @var{lvalue}. @c fakenode --- for prepinfo @subheading Advanced Notes: Operator Evaluation Order -@c comma before precedence does NOT start tertiary -@cindex advanced features, operators, precedence +@cindex advanced features, operators@comma{} precedence @cindex precedence @cindex operators, precedence @cindex portability, operators @@ -8503,8 +8482,7 @@ The Hitchhiker's Guide to the Galaxy @cindex expressions, matching, See comparison expressions @cindex matching, expressions, See comparison expressions @cindex relational operators, See comparison operators -@c comma is part of See -@cindex operators, relational, See operators, comparison +@cindex operators, relational, See operators@comma{} comparison @c STARTOFRANGE varting @cindex variable typing @c STARTOFRANGE vartypc @@ -8640,8 +8618,8 @@ the same as just described for @command{gawk}.} @dfn{Comparison expressions} compare strings or numbers for relationships such as equality. They are written using @dfn{relational -operators}, which are a superset of those in C. Here is a table of -them: +operators}, which are a superset of those in C. +@ref{table-relational-ops} describes them. @cindex @code{<} (left angle bracket), @code{<} operator @cindex left angle bracket (@code{<}), @code{<} operator @@ -8660,34 +8638,21 @@ them: @cindex @code{!} (exclamation point), @code{!~} operator @cindex exclamation point (@code{!}), @code{!~} operator @cindex @code{in} operator -@table @code -@item @var{x} < @var{y} -True if @var{x} is less than @var{y}. - -@item @var{x} <= @var{y} -True if @var{x} is less than or equal to @var{y}. - -@item @var{x} > @var{y} -True if @var{x} is greater than @var{y}. - -@item @var{x} >= @var{y} -True if @var{x} is greater than or equal to @var{y}. - -@item @var{x} == @var{y} -True if @var{x} is equal to @var{y}. - -@item @var{x} != @var{y} -True if @var{x} is not equal to @var{y}. - -@item @var{x} ~ @var{y} -True if the string @var{x} matches the regexp denoted by @var{y}. - -@item @var{x} !~ @var{y} -True if the string @var{x} does not match the regexp denoted by @var{y}. - -@item @var{subscript} in @var{array} -True if the array @var{array} has an element with the subscript @var{subscript}. -@end table +@float Table,table-relational-ops +@caption{Relational Operators} +@multitable @columnfractions .25 .75 +@headitem Expression @tab Result +@item @var{x} @code{<} @var{y} @tab True if @var{x} is less than @var{y}. +@item @var{x} @code{<=} @var{y} @tab True if @var{x} is less than or equal to @var{y}. +@item @var{x} @code{>} @var{y} @tab True if @var{x} is greater than @var{y}. +@item @var{x} @code{>=} @var{y} @tab True if @var{x} is greater than or equal to @var{y}. +@item @var{x} @code{==} @var{y} @tab True if @var{x} is equal to @var{y}. +@item @var{x} @code{!=} @var{y} @tab True if @var{x} is not equal to @var{y}. +@item @var{x} @code{~} @var{y} @tab True if the string @var{x} matches the regexp denoted by @var{y}. +@item @var{x} @code{!~} @var{y} @tab True if the string @var{x} does not match the regexp denoted by @var{y}. +@item @var{subscript} @code{in} @var{array} @tab True if the array @var{array} has an element with the subscript @var{subscript}. +@end multitable +@end float Comparison expressions have the value one if true and zero if false. When comparing operands of mixed types, numeric operands are converted @@ -8940,12 +8905,14 @@ so we'll leave well enough alone. @end ignore @cindex @code{next} statement -@strong{Note:} The @code{next} statement is discussed in +@quotation NOTE +The @code{next} statement is discussed in @ref{Next Statement}. @code{next} tells @command{awk} to skip the rest of the rules, get the next record, and start processing the rules over again at the top. The reason it's there is to avoid printing the bracketing @samp{START} and @samp{END} lines. +@end quotation @c ENDOFRANGE exbo @c ENDOFRANGE boex @@ -9266,9 +9233,10 @@ Assignment. These operators group right to left. @end table @cindex portability, operators, not in POSIX @command{awk} -@strong{Note:} +@quotation NOTE The @samp{|&}, @samp{**}, and @samp{**=} operators are not specified by POSIX. For maximum portability, do not use them. +@end quotation @c ENDOFRANGE prec @c ENDOFRANGE oppr @c ENDOFRANGE exps @@ -9497,8 +9465,7 @@ input record; when this succeeds, the range pattern is turned off again for the following record. Then the range pattern goes back to checking @var{begpat} against each record. -@c last comma does NOT start a tertiary -@cindex @code{if} statement, actions, changing +@cindex @code{if} statement, actions@comma{} changing The record that turns on the range pattern and the one that turns it off both match the range pattern. If you don't want to operate on these records, you can write @code{if} statements in the rule's action @@ -9868,10 +9835,8 @@ For deleting array elements. control the flow of execution in @command{awk} programs. Most of the control statements in @command{awk} are patterned on similar statements in C. -@c the comma here does NOT start a secondary -@cindex compound statements, control statements and -@c the second comma here does NOT start a tertiary -@cindex statements, compound, control statements and +@cindex compound statements@comma{} control statements and +@cindex statements, compound@comma{} control statements and @cindex body, in actions @cindex @code{@{@}} (braces), statements, grouping @cindex braces (@code{@{@}}), statements, grouping @@ -10171,14 +10136,20 @@ for more information on this version of the @code{for} loop. added in @command{gawk} 3.1.3. It is @emph{not} enabled by default. To enable it, use the @option{--enable-switch} option to @command{configure} when @command{gawk} is being configured and built. -@xref{Additional Configuration Options}, -for more information. +@xref{Additional Configuration Options}, for more information. The @code{switch} statement allows the evaluation of an expression and the execution of statements based on a @code{case} match. Case statements are checked for a match in the order they are defined. If no suitable -@code{case} is found, the @code{default} section is executed, if supplied. The -general form of the @code{switch} statement looks like this: +@code{case} is found, the @code{default} section is executed, if supplied. + +Each @code{case} contains a single constant, be it numeric, string, or +regexp. The @code{switch} expression is evaluated, and then each +@code{case}'s constant is compared against the result in turn. The type of constant +determines the comparison: numeric or string do the usual comparisons. +A regexp constant does a regular expression match against the string +value of the original expression. The general form of the @code{switch} +statement looks like this: @example switch (@var{expression}) @{ @@ -10189,7 +10160,8 @@ default: @} @end example -The @code{switch} statement works as it does in C. Once a match to a given +Control flow in +the @code{switch} statement works as it does in C. Once a match to a given case is made, case statement bodies are executed until a @code{break}, @code{continue}, @code{next}, @code{nextfile} or @code{exit} is encountered, or the end of the @code{switch} statement itself. For example: @@ -10877,8 +10849,7 @@ Every time @command{gawk} opens a new @value{DF} for processing, it sets When @command{gawk} is processing the input files, @samp{FILENAME == ARGV[ARGIND]} is always true. -@c comma before ARGIND does NOT mark a tertiary -@cindex files, processing, @code{ARGIND} variable and +@cindex files, processing@comma{} @code{ARGIND} variable and This variable is useful in file processing; it allows you to tell how far along you are in the list of @value{DF}s as well as to distinguish between successive instances of the same @value{FN} on the command line. @@ -10918,6 +10889,14 @@ If a system error occurs during a redirection for @code{getline}, during a read for @code{getline}, or during a @code{close} operation, then @code{ERRNO} contains a string describing the error. +@code{ERRNO} works similarly to the C variable @code{errno}. +In particular @command{gawk} @emph{never} clears it (sets it +to zero or @code{""}). Thus, you should only expect its value +to be meaningful when an I/O operation returns a failure +value, such as @code{getline} returning @minus{}1. +You are, of course, free to clear it yourself before doing an +I/O operation. + This variable is a @command{gawk} extension. In other @command{awk} implementations, or if @command{gawk} is in compatibility mode @@ -11010,6 +10989,10 @@ The parent process ID of the current process. @item PROCINFO["uid"] The value of the @code{getuid} system call. + +@item PROCINFO["version"] +The version of @command{gawk}. This is available from +version 3.1.4 and later. @end table On some systems, there may be elements in the array, @code{"group1"} @@ -11705,8 +11688,7 @@ out an array:@footnote{Thanks to Michael Brennan for pointing this out.} split("", array) @end example -@c comma before deleting does NOT start a tertiary -@cindex @code{split} function, array elements, deleting +@cindex @code{split} function, array elements@comma{} deleting The @code{split} function (@pxref{String Functions}) clears out the target array first. This call asks it to split @@ -11790,8 +11772,7 @@ effect on your programs. @node Uninitialized Subscripts @section Using Uninitialized Variables as Subscripts -@c last comma does NOT start a tertiary -@cindex variables, uninitialized, as array subscripts +@cindex variables, uninitialized@comma{} as array subscripts @cindex uninitialized variables, as array subscripts @cindex subscripts in arrays, uninitialized variables as @cindex arrays, subscripts, uninitialized variables as @@ -11998,8 +11979,7 @@ separate indices is recovered. @cindex arrays, sorting @cindex @code{asort} function (@command{gawk}) -@c last comma does NOT start a tertiary -@cindex @code{asort} function (@command{gawk}), arrays, sorting +@cindex @code{asort} function (@command{gawk}), arrays@comma{} sorting @cindex sort function, arrays, sorting The order in which an array is scanned with a @samp{for (i in array)} loop is essentially arbitrary. @@ -12056,8 +12036,11 @@ become the values of the result array: END @{ n = asorti(source, dest) - for (i = 1; i <= n; i++) - @var{do something with} dest[i] + for (i = 1; i <= n; i++) @{ + @var{do something with} dest[i] @i{Work with sorted indices directly} + @dots{} + @var{do something with} source[dest[i]] @i{Access original array via sorted indices} + @} @} @end example @@ -12075,8 +12058,11 @@ for (i in data) @{ j++ @} n = asort(ind) # index values are now sorted -for (i = 1; i <= n; i++) - @var{do something with} data[ind[i]] +for (i = 1; i <= n; i++) @{ + @var{do something with} ind[i] @i{Work with sorted indices directly} + @dots{} + @var{do something with} data[ind[i]] @i{Access original array via sorted indices} +@} @end example Sorting the array by replacing the indices provides maximal flexibility. @@ -12156,16 +12142,14 @@ by arguments in parentheses. For example, @samp{atan2(y + z, 1)} is a call to the function @code{atan2} and has two arguments. @cindex programming conventions, functions, calling -@c last comma does NOT start a tertiary -@cindex whitespace, functions, calling +@cindex whitespace, functions@comma{} calling Whitespace is ignored between the built-in function name and the open parenthesis, and it is good practice to avoid using whitespace there. User-defined functions do not permit whitespace in this way, and it is easier to avoid mistakes by following a simple convention that always works---no whitespace after a function name. -@c last comma is part of tertiary -@cindex troubleshooting, @command{gawk}, fatal errors, function arguments +@cindex troubleshooting, @command{gawk}, fatal errors@comma{} function arguments @cindex @command{gawk}, function arguments and @cindex differences in @command{awk} and @command{gawk}, function arguments (@command{gawk}) Each built-in function accepts a certain number of arguments. @@ -12435,7 +12419,7 @@ If no argument is supplied, @code{length} returns the length of @code{$0}. @c @cindex historical features @cindex portability, @code{length} function @cindex POSIX @command{awk}, functions and, @code{length} -@strong{Note:} +@quotation NOTE In older versions of @command{awk}, the @code{length} function could be called without any parentheses. Doing so is marked as ``deprecated'' in the @@ -12443,6 +12427,7 @@ POSIX standard. This means that while a program can do this, it is a feature that can eventually be removed from a future version of the standard. Therefore, for programs to be maximally portable, always supply the parentheses. +@end quotation @item match(@var{string}, @var{regexp} @r{[}, @var{array}@r{]}) @cindex @code{match} function @@ -12959,9 +12944,11 @@ Historically, the @code{sub} and @code{gsub} functions treated the two character sequence @samp{\&} specially; this sequence was replaced in the generated text with a single @samp{&}. Any other @samp{\} within the @var{replacement} string that did not precede an @samp{&} was passed -through unchanged. To illustrate with a table: +through unchanged. This is illustrated in @ref{table-sub-escapes}. @c Thank to Karl Berry for help with the TeX stuff. +@float Table,table-sub-escapes +@caption{Historical Escape Sequence Processing for sub and gsub} @tex \vbox{\bigskip % This table has lots of &'s and \'s, so unspecialize them. @@ -12981,7 +12968,20 @@ through unchanged. To illustrate with a table: } @bigskip} @end tex +@ifdocbook +@multitable @columnfractions .20 .20 .60 +@headitem You type @tab @code{sub} sees @tab @code{sub} generates +@item @code{\&} @tab @code{&} @tab the matched text +@item @code{\\&} @tab @code{\&} @tab a literal @samp{&} +@item @code{\\\&} @tab @code{\&} @tab a literal @samp{&} +@item @code{\\\\&} @tab @code{\\&} @tab a literal @samp{\&} +@item @code{\\\\\&} @tab @code{\\&} @tab a literal @samp{\&} +@item @code{\\\\\\&} @tab @code{\\\&} @tab a literal @samp{\\&} +@item @code{\\q} @tab @code{\q} @tab a literal @samp{\q} +@end multitable +@end ifdocbook @ifnottex +@ifnotdocbook @display You type @code{sub} sees @code{sub} generates -------- ---------- --------------- @@ -12993,7 +12993,9 @@ through unchanged. To illustrate with a table: @code{\\\\\\&} @code{\\\&} a literal @samp{\\&} @code{\\q} @code{\q} a literal @samp{\q} @end display +@end ifnotdocbook @end ifnottex +@end float @noindent This table shows both the lexical-level processing, where @@ -13007,11 +13009,14 @@ a literal @samp{\} followed by the matched text. @c @cindex @command{awk} language, POSIX version @cindex POSIX @command{awk}, functions and, @code{gsub}/@code{sub} -The 1992 POSIX standard attempted to fix this problem. The standard +The 1992 POSIX standard attempted to fix this problem. That standard says that @code{sub} and @code{gsub} look for either a @samp{\} or an @samp{&} after the @samp{\}. If either one follows a @samp{\}, that character is -output literally. The interpretation of @samp{\} and @samp{&} then becomes: +output literally. The interpretation of @samp{\} and @samp{&} then becomes +as shown in @ref{table-sub-posix-92}. +@float Table,table-sub-posix-92 +@caption{1992 POSIX Rules for sub and gsub Escape Sequence Processing} @c thanks to Karl Berry for formatting this table @tex \vbox{\bigskip @@ -13029,7 +13034,17 @@ output literally. The interpretation of @samp{\} and @samp{&} then becomes: } @bigskip} @end tex +@ifdocbook +@multitable @columnfractions .20 .20 .60 +@headitem You type @tab @code{sub} sees @tab @code{sub} generates +@item @code{&} @tab @code{&} @tab the matched text +@item @code{\\&} @tab @code{\&} @tab a literal @samp{&} +@item @code{\\\\&} @tab @code{\\&} @tab a literal @samp{\}, then the matched text +@item @code{\\\\\\&} @tab @code{\\\&} @tab a literal @samp{\&} +@end multitable +@end ifdocbook @ifnottex +@ifnotdocbook @display You type @code{sub} sees @code{sub} generates -------- ---------- --------------- @@ -13038,7 +13053,9 @@ output literally. The interpretation of @samp{\} and @samp{&} then becomes: @code{\\\\&} @code{\\&} a literal @samp{\}, then the matched text @code{\\\\\\&} @code{\\\&} a literal @samp{\&} @end display +@end ifnotdocbook @end ifnottex +@end float @noindent This appears to solve the problem. @@ -13059,12 +13076,16 @@ backslash.@footnote{This consequence was certainly unintended.} @c I can say that, 'cause I was involved in making this change @end itemize -The POSIX standard is under revision. -Because of the problems just listed, proposed text for the revised standard +Because of the problems just listed, +in 1996, the @command{gawk} maintainer submitted +proposed text for a revised standard that reverts to rules that correspond more closely to the original existing practice. The proposed rules have special cases that make it possible -to produce a @samp{\} preceding the matched text: +to produce a @samp{\} preceding the matched text. This is shown in +@ref{table-sub-proposed}. +@float Table,table-sub-proposed +@caption{Propsosed rules for sub and backslash} @tex \vbox{\bigskip % This table has lots of &'s and \'s, so unspecialize them. @@ -13078,10 +13099,22 @@ to produce a @samp{\} preceding the matched text: @code{\\\\&}! @code{\\&}!a literal @samp{\}, followed by the matched text@cr @code{\\&}! @code{\&}!a literal @samp{&}@cr @code{\\q}! @code{\q}!a literal @samp{\q}@cr + @code{\\\\}! @code{\\}!@code{\\}@cr } @bigskip} @end tex -@ifinfo +@ifdocbook +@multitable @columnfractions .20 .20 .60 +@headitem You type @tab @code{sub} sees @tab @code{sub} generates +@item @code{\\\\\\&} @tab @code{\\\&} @tab a literal @samp{\&} +@item @code{\\\\&} @tab @code{\\&} @tab a literal @samp{\}, followed by the matched text +@item @code{\\&} @tab @code{\&} @tab a literal @samp{&} +@item @code{\\q} @tab @code{\q} @tab a literal @samp{\q} +@item @code{\\\\} @tab @code{\\} @tab @code{\\} +@end multitable +@end ifdocbook +@ifnottex +@ifnotdocbook @display You type @code{sub} sees @code{sub} generates -------- ---------- --------------- @@ -13089,8 +13122,11 @@ to produce a @samp{\} preceding the matched text: @code{\\\\&} @code{\\&} a literal @samp{\}, followed by the matched text @code{\\&} @code{\&} a literal @samp{&} @code{\\q} @code{\q} a literal @samp{\q} + @code{\\\\} @code{\\} @code{\\} @end display -@end ifinfo +@end ifnotdocbook +@end ifnottex +@end float In a nutshell, at the runtime level, there are now three special sequences of characters (@samp{\\\&}, @samp{\\&} and @samp{\&}) whereas historically @@ -13101,22 +13137,82 @@ in the output literally. @command{gawk} 3.0 and 3.1 follow these proposed POSIX rules for @code{sub} and @code{gsub}. @c As much as we think it's a lousy idea. You win some, you lose some. Sigh. -Whether these proposed rules will actually become codified into the -standard is unknown at this point. Subsequent @command{gawk} releases will -track the standard and implement whatever the final version specifies; -this @value{DOCUMENT} will be updated as -well.@footnote{As this @value{DOCUMENT} was being finalized, -we learned that the POSIX standard will not use these rules. -However, it was too late to change @command{gawk} for the 3.1 release. -@command{gawk} behaves as described here.} +The POSIX standard took much longer to be revised than was expected in 1996. +The 2001 standard does not follow the above rules. Instead, the rules +there are somewhat simpler. The results are similar except for one case. + +The 2001 POSIX rules state that @samp{\&} in the replacement string produces +a literal @samp{&}, @samp{\\} produces a literal @samp{\}, and @samp{\} followed +by anything else is not special; the @samp{\} is placed straight into the output. +These rules are presented in @ref{table-posix-2001-sub}. + +@float Table,table-posix-2001-sub +@caption{POSIX 2001 rules for sub} +@tex +\vbox{\bigskip +% This table has lots of &'s and \'s, so unspecialize them. +\catcode`\& = \other \catcode`\\ = \other +% But then we need character for escape and tab. +@catcode`! = 4 +@halign{@hfil#!@qquad@hfil#!@qquad#@hfil@cr + You type!@code{sub} sees!@code{sub} generates@cr +@hrulefill!@hrulefill!@hrulefill@cr +@code{\\\\\\&}! @code{\\\&}!a literal @samp{\&}@cr +@code{\\\\&}! @code{\\&}!a literal @samp{\}, followed by the matched text@cr + @code{\\&}! @code{\&}!a literal @samp{&}@cr + @code{\\q}! @code{\q}!a literal @samp{\q}@cr + @code{\\\\}! @code{\\}!@code{\}@cr +} +@bigskip} +@end tex +@ifdocbook +@multitable @columnfractions .20 .20 .60 +@headitem You type @tab @code{sub} sees @tab @code{sub} generates +@item @code{\\\\\\&} @tab @code{\\\&} @tab a literal @samp{\&} +@item @code{\\\\&} @tab @code{\\&} @tab a literal @samp{\}, followed by the matched text +@item @code{\\&} @tab @code{\&} @tab a literal @samp{&} +@item @code{\\q} @tab @code{\q} @tab a literal @samp{\q} +@item @code{\\\\} @tab @code{\\} @tab @code{\} +@end multitable +@end ifdocbook +@ifnottex +@ifnotdocbook +@display + You type @code{sub} sees @code{sub} generates + -------- ---------- --------------- +@code{\\\\\\&} @code{\\\&} a literal @samp{\&} + @code{\\\\&} @code{\\&} a literal @samp{\}, followed by the matched text + @code{\\&} @code{\&} a literal @samp{&} + @code{\\q} @code{\q} a literal @samp{\q} + @code{\\\\} @code{\\} @code{\} +@end display +@end ifnotdocbook +@end ifnottex +@end float + +The only case where the difference is noticeable is the last one: @samp{\\\\} +is seen as @samp{\\} and produces @samp{\} instead of @samp{\\}. + +Starting with version 3.1.4, @command{gawk} follows the POSIX rules +when @option{--posix} is specified (@pxref{Options}). Otherwise, +it continues to follow the 1996 proposed rules, since, as of this +writing, that has been its behavior for over seven years. + +@quotation NOTE +At the next major release, @command{gawk} will switch to using +the POSIX 2001 rules by default. +@end quotation The rules for @code{gensub} are considerably simpler. At the runtime level, whenever @command{gawk} sees a @samp{\}, if the following character is a digit, then the text that matched the corresponding parenthesized subexpression is placed in the generated output. Otherwise, no matter what character follows the @samp{\}, it -appears in the generated text and the @samp{\} does not: +appears in the generated text and the @samp{\} does not, +as shown in @ref{table-gensub-escapes}. +@float Table,table-gensub-escapes +@caption{Escape Sequence Processing for gensub} @tex \vbox{\bigskip % This table has lots of &'s and \'s, so unspecialize them. @@ -13135,7 +13231,19 @@ appears in the generated text and the @samp{\} does not: } @bigskip} @end tex +@ifdocbook +@multitable @columnfractions .20 .20 .60 +@headitem You type @tab @code{gensub} sees @tab @code{gensub} generates +@item @code{&} @tab @code{&} @tab the matched text +@item @code{\\&} @tab @code{\&} @tab a literal @samp{&} +@item @code{\\\\} @tab @code{\\} @tab a literal @samp{\} +@item @code{\\\\&} @tab @code{\\&} @tab a literal @samp{\}, then the matched text +@item @code{\\\\\\&} @tab @code{\\\&} @tab a literal @samp{\&} +@item @code{\\q} @tab @code{\q} @tab a literal @samp{q} +@end multitable +@end ifdocbook @ifnottex +@ifnotdocbook @display You type @code{gensub} sees @code{gensub} generates -------- ------------- ------------------ @@ -13146,7 +13254,9 @@ appears in the generated text and the @samp{\} does not: @code{\\\\\\&} @code{\\\&} a literal @samp{\&} @code{\\q} @code{\q} a literal @samp{q} @end display +@end ifnotdocbook @end ifnottex +@end float Because of the complexity of the lexical and runtime level processing and the special cases for @code{sub} and @code{gsub}, @@ -13155,13 +13265,11 @@ to do substitutions. @c fakenode --- for prepinfo @subheading Advanced Notes: Matching the Null String -@c last comma does NOT start tertiary -@cindex advanced features, null strings, matching +@cindex advanced features, null strings@comma{} matching @cindex matching, null strings @cindex null strings, matching -@c last comma in next two is part of tertiary -@cindex @code{*} (asterisk), @code{*} operator, null strings, matching -@cindex asterisk (@code{*}), @code{*} operator, null strings, matching +@cindex @code{*} (asterisk), @code{*} operator, null strings@comma{} matching +@cindex asterisk (@code{*}), @code{*} operator, null strings@comma{} matching In @command{awk}, the @samp{*} operator can match the null string. This is particularly important for the @code{sub}, @code{gsub}, @@ -13396,9 +13504,8 @@ you would see the latter (undesirable) output. @cindex timestamps @c STARTOFRANGE logftst @cindex log files, timestamps in -@c last comma does NOT start tertiary @c STARTOFRANGE filogtst -@cindex files, log, timestamps in +@cindex files, log@comma{} timestamps in @c STARTOFRANGE gawtst @cindex @command{gawk}, timestamps @cindex POSIX @command{awk}, timestamps and @@ -13779,9 +13886,12 @@ Many languages provide the ability to perform @dfn{bitwise} operations on two integer numbers. In other words, the operation is performed on each successive pair of bits in the operands. Three common operations are bitwise AND, OR, and XOR. -The operations are described by the following table: +The operations are described in @ref{table-bitwise-ops}. +@float Table,table-bitwise-ops +@caption{Bitwise Operations} @ifnottex +@ifnotdocbook @display Bit Operator | AND | OR | XOR @@ -13791,6 +13901,7 @@ Operands | 0 | 1 | 0 | 1 | 0 | 1 0 | 0 0 | 0 1 | 0 1 1 | 0 1 | 1 1 | 1 0 @end display +@end ifnotdocbook @end ifnottex @tex \centerline{ @@ -13821,6 +13932,73 @@ Operands | 0 | 1 | 0 | 1 | 0 | 1 }}} @end tex +@docbook + + +Bitwise Operations + + + + + + + + + + + + + + + + + +Bit Operator + + + + +AND +OR +XOR + + + +Operands +0 +1 +0 +1 +0 +1 + + + +0 +0 +0 +0 +1 +0 +1 + + + +1 +0 +1 +1 +1 +1 +0 + + + + +
+@end docbook +@end float + @cindex bitwise, complement @cindex complement, bitwise As you can see, the result of an AND operation is 1 only when @emph{both} @@ -13906,7 +14084,9 @@ Return the value of @var{val}, shifted right by @var{count} bits. For all of these functions, first the double-precision floating-point value is converted to the widest C unsigned integer type, then the bitwise operation is -performed and then the result is converted back into a C @code{double}. (If +performed. If the result cannot be represented exactly as a C @code{double}, +leading nonzero bits are removed one by one until it can be represented +exactly. The result is then converted back into a C @code{double}. (If you don't understand this paragraph, don't worry about it.) Here is a user-defined function @@ -14193,8 +14373,7 @@ syntactically valid, because functions may be used before they are defined in @command{awk} programs.) @c NEXT ED: This won't actually run, since foo() is undefined ... -@c last comma does NOT start tertiary -@cindex portability, functions, defining +@cindex portability, functions@comma{} defining To ensure that your @command{awk} programs are portable, always use the keyword @code{function} when defining a function. @@ -14380,7 +14559,8 @@ by the function. This is usually called @dfn{call by reference}. Changes made to an array parameter inside the body of a function @emph{are} visible outside that function. -@strong{Note:} Changing an array parameter inside a function +@quotation NOTE +Changing an array parameter inside a function can be very dangerous if you do not watch what you are doing. For example: @@ -14401,6 +14581,7 @@ BEGIN @{ @noindent prints @samp{a[1] = 1, a[2] = two, a[3] = 3}, because @code{changeit} stores @code{"two"} in the second element of @code{a}. +@end quotation @cindex undefined functions @cindex functions, undefined @@ -14439,8 +14620,7 @@ inside a user-defined function. @node Return Statement @subsection The @code{return} Statement -@c comma does NOT start a secondary -@cindex @code{return} statement, user-defined functions +@cindex @code{return} statement@comma{} user-defined functions The body of a user-defined function can contain a @code{return} statement. This statement returns control to the calling part of the @command{awk} program. It @@ -14595,8 +14775,7 @@ a requirement. @section Internationalization and Localization @cindex internationalization -@c comma is part of see -@cindex localization, See internationalization, localization +@cindex localization, See internationalization@comma{} localization @cindex localization @dfn{Internationalization} means writing (or modifying) a program once, in such a way that it can use multiple languages without requiring @@ -14780,8 +14959,7 @@ Response information, such as how ``yes'' and ``no'' appear in the local language, and possibly other information as well. @cindex time, localization and -@c last comma does NOT start a tertiary -@cindex dates, information related to, localization +@cindex dates, information related to@comma{} localization @cindex @code{LC_TIME} locale category @item LC_TIME Time- and date-related information, such as 12- or 24-hour clock, month printed @@ -14976,8 +15154,7 @@ is covered. @node String Extraction @subsection Extracting Marked Strings @cindex strings, extracting -@c comma does NOT start secondary -@cindex marked strings, extracting +@cindex marked strings@comma{} extracting @cindex @code{--gen-po} option @cindex command-line options, string extraction @cindex string extraction (internationalization) @@ -15012,8 +15189,7 @@ translations for @command{guide}. @subsection Rearranging @code{printf} Arguments @cindex @code{printf} statement, positional specifiers -@c comma does NOT start secondary -@cindex positional specifiers, @code{printf} statement +@cindex positional specifiers@comma{} @code{printf} statement Format strings for @code{printf} and @code{sprintf} (@pxref{Printf}) present a special problem for translation. @@ -15075,14 +15251,14 @@ $ gawk 'BEGIN @{ @print{} hello @end example -@noindent -@strong{Note:} When using @samp{*} with a positional specifier, the @samp{*} +@quotation NOTE +When using @samp{*} with a positional specifier, the @samp{*} comes first, then the integer position, and then the @samp{$}. This is somewhat counterintutive. +@end quotation @cindex @code{printf} statement, positional specifiers, mixing with regular formats -@c first comma does is part of primary -@cindex positional specifiers, @code{printf} statement, mixing with regular formats +@cindex positional specifiers@comma{} @code{printf} statement, mixing with regular formats @cindex format specifiers, mixing regular with positional specifiers @command{gawk} does not allow you to mix regular format specifiers and those with positional specifiers in the same string: @@ -15092,10 +15268,12 @@ $ gawk 'BEGIN @{ printf _"%d %3$s\n", 1, 2, "hi" @}' @error{} gawk: cmd. line:1: fatal: must use `count$' on all formats or none @end smallexample -@strong{Note:} There are some pathological cases that @command{gawk} may fail to +@quotation NOTE +There are some pathological cases that @command{gawk} may fail to diagnose. In such cases, the output may not be what you expect. It's still a bad idea to try mixing them, even if @command{gawk} doesn't detect it. +@end quotation Although positional specifiers can be used directly in @command{awk} programs, their primary purpose is to help in producing correct translations of @@ -15230,8 +15408,10 @@ This original portable object file is saved and reused for each language into which the application is translated. The @code{msgid} is the original string and the @code{msgstr} is the translation. -@strong{Note:} Strings not marked with a leading underscore do not +@quotation NOTE +Strings not marked with a leading underscore do not appear in the @file{guide.po} file. +@end quotation Next, the messages must be translated. Here is a translation to a hypothetical dialect of English, @@ -15395,8 +15575,7 @@ its description is relegated to an appendix. @section Allowing Nondecimal Input Data @cindex @code{--non-decimal-data} option @cindex advanced features, @command{gawk}, nondecimal input data -@c last comma does NOT start tertiary -@cindex input, data, nondecimal +@cindex input, data@comma{} nondecimal @cindex constants, nondecimal If you run @command{gawk} with the @option{--non-decimal-data} option, @@ -15480,8 +15659,7 @@ Mike Brennan @c brennan@@whidbey.com @end smallexample -@c final comma is part of tertiary -@cindex advanced features, @command{gawk}, processes, communicating with +@cindex advanced features, @command{gawk}, processes@comma{} communicating with @cindex processes, two-way communications with It is often useful to be able to send data to a separate program for @@ -15988,8 +16166,7 @@ $ pgawk -f myprog & [1] 13992 @end example -@c comma does NOT start secondary -@cindex @command{kill} command, dynamic profiling +@cindex @command{kill} command@comma{} dynamic profiling @cindex @code{USR1} signal @cindex signals, @code{USR1}/@code{SIGUSR1} @noindent @@ -16170,10 +16347,8 @@ The @option{-v} option can only set one variable, but it can be used more than once, setting another variable each time, like this: @samp{awk @w{-v foo=1} @w{-v bar=2} @dots{}}. -@c last comma is part of secondary -@cindex built-in variables, @code{-v} option, setting with -@c last comma is part of tertiary -@cindex variables, built-in, @code{-v} option, setting with +@cindex built-in variables, @code{-v} option@comma{} setting with +@cindex variables, built-in, @code{-v} option@comma{} setting with @strong{Caution:} Using @option{-v} to set the values of the built-in variables may lead to surprising results. @command{awk} will reset the values of those variables as it needs to, possibly ignoring any @@ -16260,8 +16435,7 @@ Prints a sorted list of global variables, their types, and final values to @var{file}. If no @var{file} is provided, @command{gawk} prints this list to the file named @file{awkvars.out} in the current directory. -@c last comma is part of secondary -@cindex troubleshooting, typographical errors, global variables +@cindex troubleshooting, typographical errors@comma{} global variables Having a list of all global variables is a good way to look for typographical errors in your programs. You would also use this option if you have a large program with a lot of @@ -16319,9 +16493,8 @@ Warns about constructs that are not available in the original version of @item -W non-decimal-data @itemx --non-decimal-data @cindex @code{--non-decimal-data} option -@cindex hexadecimal, values, enabling interpretation of -@c comma is part of primary -@cindex octal values, enabling interpretation of +@cindex hexadecimal values@comma{} enabling interpretation of +@cindex octal values@comma{} enabling interpretation of Enable automatic interpretation of octal and hexadecimal values in input data (@pxref{Nondecimal Data}). @@ -16334,8 +16507,7 @@ Use with care. @itemx --posix @cindex @code{--posix} option @cindex POSIX mode -@c last comma is part of tertiary -@cindex @command{gawk}, extensions, disabling +@cindex @command{gawk}, extensions@comma{} disabling Operates in strict POSIX mode. This disables all @command{gawk} extensions (just like @option{--traditional}) and adds the following additional restrictions: @@ -16382,8 +16554,7 @@ Specifying @samp{-Ft} on the command-line does not set the value of @code{FS} to be a single TAB character (@pxref{Field Separators}). -@c comma does not start secondary -@cindex @code{fflush} function, unsupported +@cindex @code{fflush} function@comma{} unsupported @item The @code{fflush} built-in function is not supported (@pxref{I/O Functions}). @@ -16437,8 +16608,7 @@ programs (@pxref{AWKPATH Variable}). @item -W version @itemx --version @cindex @code{--version} option -@c last comma is part of tertiary -@cindex @command{gawk}, versions of, information about, printing +@cindex @command{gawk}, versions of, information about@comma{} printing Prints version information for this particular copy of @command{gawk}. This allows you to determine if your copy of @command{gawk} is up to date with respect to whatever the Free Software Foundation is currently @@ -16636,7 +16806,8 @@ Path searching is not done if @command{gawk} is in compatibility mode. This is true for both @option{--traditional} and @option{--posix}. @xref{Options}. -@strong{Note:} If you want files in the current directory to be found, +@quotation NOTE +If you want files in the current directory to be found, you must include the current directory in the path, either by including @file{.} explicitly in the path or by writing a null entry in the path. (A null entry is indicated by starting or ending the path with a @@ -16645,6 +16816,7 @@ current directory is not included in the path, then files cannot be found in the current directory. This path search mechanism is identical to the shell's. @c someday, @cite{The Bourne Again Shell}.... +@end quotation Starting with @value{PVERSION} 3.0, if @env{AWKPATH} is not defined in the environment, @command{gawk} places its default search path into @@ -17016,6 +17188,8 @@ programming use. @menu * Nextfile Function:: Two implementations of a @code{nextfile} function. +* Strtonum Function:: A replacement for the built-in @code{strtonum} + function. * Assert Function:: A function for assertions in @command{awk} programs. * Round Function:: A function for rounding if @code{sprintf} does @@ -17159,6 +17333,101 @@ computations). @c ENDOFRANGE flibnex @c ENDOFRANGE nexim +@node Strtonum Function +@subsection Converting Strings To Numbers + +The @code{strtonum} function (@pxref{String Functions}) +is a @command{gawk} extension. The following function +provides an implementation for other versions of @command{awk}: + +@example +@c file eg/lib/strtonum.awk +# strtonum --- convert string to number +@c endfile +@ignore +@c file eg/lib/strtonum.awk + +# +# Arnold Robbins, arnold@@skeeve.com, Public Domain +# February, 2004 + +@c endfile +@end ignore +@c file eg/lib/strtonum.awk +function mystrtonum(str, ret, chars, n, i, k, c) +@{ + if (str ~ /^0[0-7]*$/) @{ + # octal + n = length(str) + ret = 0 + for (i = 1; i <= n; i++) @{ + c = substr(str, i, 1) + if ((k = index("01234567", c)) > 0) + k-- # adjust for 1-basing in awk + + ret = ret * 8 + k + @} + @} else if (str ~ /^0[xX][0-9a-fA-f]+/) @{ + # hexadecimal + str = substr(str, 3) # lop off leading 0x + n = length(str) + ret = 0 + for (i = 1; i <= n; i++) @{ + c = substr(str, i, 1) + c = tolower(c) + if ((k = index("0123456789", c)) > 0) + k-- # adjust for 1-basing in awk + else if ((k = index("abcdef", c)) > 0) + k += 9 + + ret = ret * 16 + k + @} + @} else if (str ~ /^[-+]?([0-9]+([.][0-9]*([Ee][0-9]+)?)?|([.][0-9]+([Ee][-+]?[0-9]+)?))$/) @{ + # decimal number, possibly floating point + ret = str + 0 + @} else + ret = "NOT-A-NUMBER" + + return ret +@} + +# BEGIN @{ # gawk test harness +# a[1] = "25" +# a[2] = ".31" +# a[3] = "0123" +# a[4] = "0xdeadBEEF" +# a[5] = "123.45" +# a[6] = "1.e3" +# a[7] = "1.32" +# a[7] = "1.32E2" +# +# for (i = 1; i in a; i++) +# print a[i], strtonum(a[i]), mystrtonum(a[i]) +# @} +@c endfile +@end example + +The function first looks for C-style octal numbers (base 8). +If the input string matches a regular expression describing octal +numbers, then @code{mystrtonum} loops through each character in the +string. It sets @code{k} to the index in @code{"01234567"} of the current +octal digit. Since the return value is one-based, the @samp{k--} +adjusts @code{k} so it can be used in computing the return value. + +Similar logic applies to the code that checks for and converts a +hexadecimal value, which starts with @samp{0x} or @samp{0X}. +The use of @code{tolower} simplifies the computation for finding +the correct numeric value for each hexadecimal digit. + +Finally, if the string matches the (rather complicated) regex for a +regular decimal integer or floating-point numer, the computation +@samp{ret = str + 0} lets @command{awk} convert the value to a +number. + +A commented-out test program is included, so that the function can +be tested with @command{gawk} and the results compared to the built-in +@code{strtonum} function. + @node Assert Function @subsection Assertions @@ -17877,8 +18146,7 @@ for a function version of @code{nextfile}. @subsection Checking for Readable @value{DDF}s @cindex troubleshooting, readable @value{DF}s -@c comma is part of primary -@cindex readable @value{DF}s, checking +@cindex readable @value{DF}s@comma{} checking @cindex files, skipping Normally, if you give @command{awk} a @value{DF} that isn't readable, it stops with a fatal error. There are times when you @@ -18444,12 +18712,10 @@ use @code{getopt} to process their arguments. @cindex libraries of @command{awk} functions, user database, reading @c STARTOFRANGE flibudata @cindex functions, library, user database, reading -@c last comma is part of primary @c STARTOFRANGE udatar -@cindex user database, reading -@c last comma is part of secondary +@cindex user database@comma{} reading @c STARTOFRANGE dataur -@cindex database, users, reading +@cindex database, users@comma{} reading @cindex @code{PROCINFO} array The @code{PROCINFO} array (@pxref{Built-in Variables}) @@ -18823,8 +19089,7 @@ uses these functions. @cindex @code{PROCINFO} array @cindex @code{getgrent} function (C library) @cindex @code{getgrent} user-defined function -@c comma is part of primary -@cindex groups, information about +@cindex groups@comma{} information about @cindex account information @cindex group file @cindex files, group @@ -19250,9 +19515,8 @@ cut.awk -- -c1-8 myfiles > results @node Clones @section Reinventing Wheels for Fun and Profit -@c last comma is part of secondary @c STARTOFRANGE posimawk -@cindex POSIX, programs, implementing in @command{awk} +@cindex POSIX, programs@comma{} implementing in @command{awk} This @value{SECTION} presents a number of POSIX utilities that are implemented in @command{awk}. Reinventing these programs in @command{awk} is often enjoyable, @@ -20189,8 +20453,7 @@ which isn't true for EBCDIC systems. @node Tee Program @subsection Duplicating Output into Multiple Files -@c last comma is part of secondary -@cindex files, multiple, duplicating output into +@cindex files, multiple@comma{} duplicating output into @cindex output, duplicating into files @cindex @code{tee} utility The @code{tee} program is known as a ``pipe fitting.'' @code{tee} copies @@ -20310,9 +20573,8 @@ END \ @c STARTOFRANGE prunt @cindex printing, unduplicated lines of text -@c first comma is part of primary @c STARTOFRANGE tpul -@cindex text, printing, unduplicated lines of +@cindex text@comma{} printing, unduplicated lines of @cindex @command{uniq} utility The @command{uniq} utility reads sorted lines of data on its standard input, and by default removes duplicate lines. In other words, it only @@ -20688,7 +20950,7 @@ The @code{endfile} function adds the current file's numbers to the running totals of lines, words, and characters.@footnote{@command{wc} can't just use the value of @code{FNR} in @code{endfile}. If you examine the code in -@ref{Filetrans Function} +@ref{Filetrans Function}, you will see that @code{FNR} has already been reset by the time @code{endfile} is called.} It then prints out those numbers @@ -20784,11 +21046,9 @@ We hope you find them both interesting and enjoyable. @node Dupword Program @subsection Finding Duplicated Words in a Document -@c last comma is part of secondary -@cindex words, duplicate, searching for +@cindex words, duplicate@comma{} searching for @cindex searching, for words -@c first comma is part of primary -@cindex documents, searching +@cindex documents@comma{} searching A common error when writing large amounts of prose is to accidentally duplicate words. Typically you will see this in text as something like ``the the program does the following@dots{}'' When the text is online, often @@ -21164,9 +21424,8 @@ will never change throughout the lifetime of the program. @c STARTOFRANGE prml @cindex printing, mailing labels -@c comma is part of primary @c STARTOFRANGE mlprint -@cindex mailing labels, printing +@cindex mailing labels@comma{} printing Here is a ``real world''@footnote{``Real world'' is defined as ``a program actually used to get something done.''} program. This @@ -21285,9 +21544,8 @@ END \ @node Word Sorting @subsection Generating Word-Usage Counts -@c last comma is part of secondary @c STARTOFRANGE worus -@cindex words, usage counts, generating +@cindex words, usage counts@comma{} generating @c NEXT ED: Rewrite this whole section and example The following @command{awk} program prints the number of occurrences of each word in its input. It illustrates the @@ -21417,9 +21675,8 @@ to use the @command{sort} program. @node History Sorting @subsection Removing Duplicates from Unsorted Text -@c last comma is part of secondary @c STARTOFRANGE lidu -@cindex lines, duplicate, removing +@cindex lines, duplicate@comma{} removing The @command{uniq} program (@pxref{Uniq Program}), removes duplicate lines from @emph{sorted} data. @@ -21489,9 +21746,8 @@ seen. @c STARTOFRANGE texse @cindex Texinfo, extracting programs from source files -@c last comma is part of secondary @c STARTOFRANGE fitex -@cindex files, Texinfo, extracting programs from +@cindex files, Texinfo@comma{} extracting programs from @ifnotinfo Both this chapter and the previous chapter (@ref{Library Functions}) @@ -22327,10 +22583,8 @@ there is no real reason to build @samp{@@include} processing into @command{gawk} itself. @cindex search paths, for source files -@c comma is part of primary -@cindex source files, search path for -@c last comma is part of secondary -@cindex files, source, search path for +@cindex source files@comma{} search path for +@cindex files, source@comma{} search path for @cindex directories, searching As an additional example of this, consider the idea of having two files in a directory in the search path: @@ -23033,6 +23287,10 @@ The @option{--disable-lint} configuration option to disable lint checking at compile time (@pxref{Additional Configuration Options}). +@item +POSIX compliance for @code{sub} and @code{gsub} +(@pxref{Gory Details}). + @end itemize @c XXX ADD MORE STUFF HERE @@ -23258,8 +23516,7 @@ subdirectories. @node Getting @appendixsubsec Getting the @command{gawk} Distribution -@c last comma is part of secondary -@cindex @command{gawk}, source code, obtaining +@cindex @command{gawk}, source code@comma{} obtaining There are three ways to get GNU software: @itemize @bullet @@ -23382,8 +23639,7 @@ are not limits in @command{gawk} itself. A description of one area in which the POSIX standard for @command{awk} is incorrect as well as how @command{gawk} handles the problem. -@c comma is part of primary -@cindex artificial intelligence, @command{gawk} and +@cindex artificial intelligence@comma{} @command{gawk} and @item doc/awkforai.txt A short article describing why @command{gawk} is a good language for AI (Artificial Intelligence) programming. @@ -23591,8 +23847,7 @@ please send in a bug report @node Additional Configuration Options @appendixsubsec Additional Configuration Options @cindex @command{gawk}, configuring, options -@c comma is part of primary -@cindex configuration options, @command{gawk} +@cindex configuration options@comma{} @command{gawk} There are several additional options you may use on the @command{configure} command line when compiling @command{gawk} from scratch, including: @@ -23796,10 +24051,8 @@ If these steps do not work, please send in a bug report @node PC Installation @appendixsubsec Installation on PC Operating Systems -@c first comma is part of primary -@cindex PC operating systems, @command{gawk} on, installing -@c {PC, gawk on} is the secondary term -@cindex operating systems, PC, @command{gawk} on, installing +@cindex PC operating systems@comma{} @command{gawk} on, installing +@cindex operating systems, PC@comma{} @command{gawk} on, installing This @value{SECTION} covers installation and usage of @command{gawk} on x86 machines running DOS, any version of Windows, or OS/2. In this @value{SECTION}, the term ``Windows32'' @@ -23888,6 +24141,8 @@ The @file{Makefile} contains a number of targets for building various MS-DOS, Windows32, and OS/2 versions. A list of targets is printed if the @command{make} command is given without a target. As an example, to build @command{gawk} using the DJGPP tools, enter @samp{make djgpp}. +(The DJGPP tools may be found at +@uref{ftp://ftp.delorie.com/pub/djgpp/current/v2gnu/}.) Using @command{make} to run the standard tests and to install @command{gawk} requires additional Unix-like tools, including @command{sh}, @command{sed}, and @@ -23956,10 +24211,12 @@ $ ./configure --prefix=c:/usr --without-included-gettext $ make @end example -@strong{Note:} Even if the compiled @command{gawk.exe} (@code{a.out}) executable +@quotation NOTE +Even if the compiled @command{gawk.exe} (@code{a.out}) executable contains a DOS header, it does @emph{not} work under DOS. To compile an executable that runs under DOS, @code{"-DPIPES_SIMULATED"} must be added to @env{CPPFLAGS}. But then some nonstandard extensions of @command{gawk} (e.g., @samp{|&}) do not work! +@end quotation After compilation the internal tests can be performed. Enter @samp{make check CMP="diff -a"} at your command prompt. All tests @@ -23968,11 +24225,13 @@ test fails because child processes are not started by @code{fork()}. @samp{make install} works as expected. -@strong{Note:} Most OS/2 ports of GNU @command{make} are not able to handle +@quotation NOTE +Most OS/2 ports of GNU @command{make} are not able to handle the Makefiles of this package. If you encounter any problems with @command{make} try GNU Make 3.79.1 or later versions. You should find the latest version on @uref{http://www.unixos2.org/sw/pub/binary/make/} or on @uref{ftp://hobbes.nmsu.edu/pub/os2/}. +@end quotation @node PC Dynamic @appendixsubsubsec Compiling @command{gawk} For Dynamic Libraries @@ -24181,10 +24440,12 @@ When compared to GNU/Linux on the same system, the @samp{configure} step on Cygwin takes considerably longer. However, it does finish, and then the @samp{make} proceeds as usual. -@strong{Note:} The @samp{|&} operator and TCP/IP networking +@quotation NOTE +The @samp{|&} operator and TCP/IP networking (@pxref{TCP/IP Networking}) are fully supported in the Cygwin environment. This is not true for any other environment for MS-DOS or MS-Windows. +@end quotation @node VMS Installation @appendixsubsec How to Compile and Install @command{gawk} on VMS @@ -24803,7 +25064,7 @@ is under the LGPL. To get @command{awka}, go to @uref{http://awka.sourceforge.net}. You can reach Andrew Sumner at @email{andrew@@zbcom.net}. -@cindex Beebe, Nelson H.F. +@cindex Beebe, Nelson H.F.@: @cindex @command{pawk} profiling Bell Labs @command{awk} @item @command{pawk} Nelson H.F.@: Beebe at the University of Utah has modified @@ -24846,8 +25107,7 @@ maintainers of @command{gawk}. Everything in it applies specifically to @cindex @command{gawk}, implementation issues, downward compatibility @cindex @command{gawk}, implementation issues, debugging @cindex troubleshooting, @command{gawk} -@c first comma is part of primary -@cindex implementation issues, @command{gawk}, debugging +@cindex implementation issues@comma{} @command{gawk}, debugging @xref{POSIX/GNU}, for a summary of the GNU extensions to the @command{awk} language and program. @@ -25002,9 +25262,10 @@ Its use causes more portability trouble than is worth the minor benefit of not h to free the storage. Instead, use @code{malloc} and @code{free}. @end itemize -@strong{Note:} +@quotation NOTE If I have to reformat your code to follow the coding style used in @command{gawk}, I may not bother to integrate your changes at all. +@end quotation @item Be prepared to sign the appropriate paperwork. @@ -25183,14 +25444,14 @@ functions to @command{gawk} using dynamically loaded libraries. This facility is available on systems (such as GNU/Linux) that support the @code{dlopen} and @code{dlsym} functions. This @value{SECTION} describes how to write and use dynamically -loaded extentions for @command{gawk}. +loaded extensions for @command{gawk}. Experience with programming in C or C++ is necessary when reading this @value{SECTION}. @strong{Caution:} The facilities described in this @value{SECTION} -are very much subject to change in the next @command{gawk} release. +are very much subject to change in a future @command{gawk} release. Be aware that you may have to re-do everything, perhaps from scratch, -upon the next release. +at some future time. @menu * Internals:: A brief look at some @command{gawk} internals. @@ -25246,11 +25507,22 @@ This macro guarantees that a @code{NODE}'s string value is current. It may end up calling an internal @command{gawk} function. It also guarantees that the string is zero-terminated. -@c comma is part of primary -@cindex parameters, number of +@cindex @code{get_curfunc_arg_count} internal function +@item size_t get_curfunc_arg_count(void) +This function returns the actual number of parameters passed +to the current function. Inside the code of an extension +this can be used to determine the maximum index which is +safe to use with @code{stack_ptr}. If this value is +greater than @code{tree->param_cnt}, the function was +called incorrectly from the @command{awk} program. + +@strong{Caution:} This function is new as of @command{gawk} 3.1.4. + +@cindex parameters@comma{} number of @cindex @code{param_cnt} internal variable @item n->param_cnt -The number of parameters actually passed in a function call at runtime. +Inside an extension function, this is the maximum number of +expected parameters, as set by the @code{make_builtin} function. @cindex @code{stptr} internal variable @cindex @code{stlen} internal variable @@ -25315,8 +25587,7 @@ Take an @code{AWKNUM} and turn it into a pointer to a @code{NODE} that can be stored appropriately. This is temporary storage; understanding of @command{gawk} memory management is helpful. -@c comma is part of primary -@cindex nodes, duplicating +@cindex nodes@comma{} duplicating @cindex @code{dupnode} internal function @item NODE *dupnode(NODE *n) Duplicate a node. In most cases, this increments an internal @@ -25354,8 +25625,30 @@ This function is called from within a C extension function to get the @code{i}-th argument from the function call. The first argument is argument zero. -@c last comma is part of secondary -@cindex functions, return values, setting +@cindex @code{get_actual_argument} internal function +@item NODE *get_actual_argument(NODE *tree, unsigned int i, +@itemx @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ int@ optional,@ int@ wantarray); +This function retrieves a particular argument @code{i}. @code{wantarray} is @code{TRUE} +if the argument should be an array, @code{FALSE} otherwise. If @code{optional} is +@code{TRUE}, the argument need not have been supplied. If it wasn't, the return +value is @code{NULL}. It is a fatal error if @code{optional} is @code{TRUE} but +the argument was not provided. + +@strong{Caution:} This function is new as of @command{gawk} 3.1.4. + +@cindex @code{get_scalar_argument} internal macro +@item get_scalar_argument(t, i, opt) +This is a convenience macro that calls @code{get_actual_argument}. + +@strong{Caution:} This macro is new as of @command{gawk} 3.1.4. + +@cindex @code{get_array_argument} internal macro +@item get_array_argument(t, i, opt) +This is a convenience macro that calls @code{get_actual_argument}. + +@strong{Caution:} This macro is new as of @command{gawk} 3.1.4. + +@cindex functions, return values@comma{} setting @cindex @code{set_value} internal function @item void set_value(NODE *tree) This function is called from within a C extension function to set @@ -25417,21 +25710,27 @@ the_arg = get_array(the_arg); assoc_clear(the_arg); @end smallexample +As of version 3.1.4, the internals improved again, and became +even simpler: + +@smallexample +NODE *the_arg; + +the_arg = get_array_argument(tree, 2, FALSE); /* assume need 3rd arg, 0-based */ +@end smallexample + Again, you should spend time studying the @command{gawk} internals; don't just blindly copy this code. @c ENDOFRANGE gawint @node Sample Library @appendixsubsec Directory and File Operation Built-ins -@c comma is part of primary @c STARTOFRANGE chdirg -@cindex @code{chdir} function, implementing in @command{gawk} -@c comma is part of primary +@cindex @code{chdir} function@comma{} implementing in @command{gawk} @c STARTOFRANGE statg -@cindex @code{stat} function, implementing in @command{gawk} -@c last comma is part of secondary +@cindex @code{stat} function@comma{} implementing in @command{gawk} @c STARTOFRANGE filre -@cindex files, information about, retrieving +@cindex files, information about@comma{} retrieving @c STARTOFRANGE dirch @cindex directories, changing @@ -25615,7 +25914,10 @@ NODE *tree; NODE *newdir; int ret = -1; - newdir = get_argument(tree, 0); + if (do_lint && get_curfunc_arg_count() != 1) + lintwarn("chdir: called with incorrect number of arguments"); + + newdir = get_scalar_argument(tree, 0); @end example The file includes the @code{"awk.h"} header file for definitions @@ -25638,14 +25940,11 @@ is updated. The result of @code{force_string} has to be freed with @code{free_temp}: @example - if (newdir != NULL) @{ - (void) force_string(newdir); - ret = chdir(newdir->stptr); - if (ret < 0) - update_ERRNO(); - - free_temp(newdir); - @} + (void) force_string(newdir); + ret = chdir(newdir->stptr); + if (ret < 0) + update_ERRNO(); + free_temp(newdir); @end example Finally, the function returns the return value to the @command{awk} level, @@ -25695,16 +25994,13 @@ NODE *tree; NODE *file, *array; struct stat sbuf; int ret; - char *msg; NODE **aptr; char *pmode; /* printable mode */ char *type = "unknown"; - /* check arg count */ - if (tree->param_cnt != 2) - fatal( - "stat: called with %d arguments, should be 2", - tree->param_cnt); + + if (do_lint && get_curfunc_arg_count() > 2) + lintwarn("stat: called with too many arguments"); @end example Then comes the actual work. First, we get the arguments. @@ -25714,12 +26010,9 @@ If there's an error, we set @code{ERRNO} and return: @c comment made multiline for page breaking @example - /* - * directory is first arg, - * array to hold results is second - */ - file = get_argument(tree, 0); - array = get_argument(tree, 1); + /* directory is first arg, array to hold results is second */ + file = get_scalar_argument(tree, 0, FALSE); + array = get_array_argument(tree, 1, FALSE); /* empty out the array */ assoc_clear(array); @@ -25792,8 +26085,7 @@ implement system calls such as @code{chown}, @code{chmod}, and @code{umask}. @node Using Internal File Ops @appendixsubsubsec Integrating the Extensions -@c last comma is part of secondary -@cindex @command{gawk}, interpreter, adding code to +@cindex @command{gawk}, interpreter@comma{} adding code to Now that the code is written, it must be possible to add it at runtime to the running @command{gawk} interpreter. First, the code must be compiled. Assuming that the functions are in @@ -25940,17 +26232,15 @@ The 1999 ISO C standard added a number of additional @code{printf} format specifiers. These should be evaluated for possible inclusion in @command{gawk}. -@ignore -@item A @samp{%'d} flag -Add @samp{%'d} for putting in commas in formatting numeric values. -@end ignore - @item Databases It may be possible to map a GDBM/NDBM/SDBM file into an @command{awk} array. @item Large character sets It would be nice if @command{gawk} could handle UTF-8 and other character sets that are larger than eight bits. +(@command{gawk} currently has partial multi-byte support, but it +needs an expert to really think out the multi-byte issues and consult +with the maintainer on the appropriate changes.) @item More @code{lint} warnings There are more things that could be checked for portability. @@ -26002,8 +26292,7 @@ into a C program which the user would then compile, using the normal C compiler and a special @command{gawk} library to provide all the needed functions (regexps, fields, associative arrays, type coercion, and so on). -@c last comma is part of secondary -@cindex @command{gawk}, interpreter, adding code to +@cindex @command{gawk}, interpreter@comma{} adding code to An easier possibility might be for an intermediate phase of @command{gawk} to convert the parse tree into a linear byte code form like the one used in GNU Emacs Lisp. The recursive evaluator would then be replaced by @@ -26290,8 +26579,7 @@ and even more often, as ``I/O'' for short. (You will also see ``input'' and ``output'' used as verbs.) @cindex data-driven languages -@c comma is part of primary -@cindex languages, data-driven +@cindex languages@comma{} data-driven @command{awk} manages the reading of data for you, as well as the breaking it up into records and fields. Your program's job is to tell @command{awk} what to with the data. You do this by describing @@ -26508,8 +26796,7 @@ represent numbers. @cindex negative zero @cindex positive zero -@c comma is part of primary -@cindex zero, negative vs.@: positive +@cindex zero@comma{} negative vs.@: positive Another peculiarity of floating-point numbers on modern systems is that they often have more than one representation for the number zero! In particular, it is possible to represent ``minus zero'' as well as diff --git a/doc/gawkinet.info b/doc/gawkinet.info index db8f239f5..de6ce30bc 100644 --- a/doc/gawkinet.info +++ b/doc/gawkinet.info @@ -1,4 +1,4 @@ -This is gawkinet.info, produced by makeinfo version 4.5 from +This is gawkinet.info, produced by makeinfo version 4.6 from gawkinet.texi. INFO-DIR-SECTION Network applications @@ -7,10 +7,10 @@ START-INFO-DIR-ENTRY END-INFO-DIR-ENTRY This is Edition 1.1 of `TCP/IP Internetworking With `gawk'', for the -3.1.1 (or later) version of the GNU implementation of AWK. +3.1.4 (or later) version of the GNU implementation of AWK. - Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 2000, 2001, 2002, 2004 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document @@ -26,14 +26,14 @@ texts being (a) (see below), and with the Back-Cover Texts being (b) b. "You have freedom to copy and modify this GNU Manual, like GNU software. Copies published by the Free Software Foundation raise funds for GNU development." - + This file documents the networking features in GNU `awk'. This is Edition 1.1 of `TCP/IP Internetworking With `gawk'', for the -3.1.1 (or later) version of the GNU implementation of AWK. +3.1.4 (or later) version of the GNU implementation of AWK. - Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 2000, 2001, 2002, 2004 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document @@ -49,21 +49,21 @@ texts being (a) (see below), and with the Back-Cover Texts being (b) b. "You have freedom to copy and modify this GNU Manual, like GNU software. Copies published by the Free Software Foundation raise funds for GNU development." - +  File: gawkinet.info, Node: Top, Next: Preface, Prev: (dir), Up: (dir) General Introduction ******************** - This file documents the networking features in GNU Awk (`gawk') -version 3.1 and later. +This file documents the networking features in GNU Awk (`gawk') version +3.1 and later. This is Edition 1.1 of `TCP/IP Internetworking With `gawk'', for the -3.1.1 (or later) version of the GNU implementation of AWK. +3.1.4 (or later) version of the GNU implementation of AWK. - Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 2000, 2001, 2002, 2004 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document @@ -79,7 +79,7 @@ texts being (a) (see below), and with the Back-Cover Texts being (b) b. "You have freedom to copy and modify this GNU Manual, like GNU software. Copies published by the Free Software Foundation raise funds for GNU development." - + * Menu: * Preface:: About this document. @@ -132,7 +132,7 @@ File: gawkinet.info, Node: Preface, Next: Introduction, Prev: Top, Up: Top Preface ******* - In May of 1997, Ju"rgen Kahrs felt the need for network access from +In May of 1997, Ju"rgen Kahrs felt the need for network access from `awk', and, with a little help from me, set about adding features to do this for `gawk'. At that time, he wrote the bulk of this Info file. @@ -164,14 +164,14 @@ March, 2001  File: gawkinet.info, Node: Introduction, Next: Using Networking, Prev: Preface, Up: Top -Networking Concepts -******************* +1 Networking Concepts +********************* - This major node provides a (necessarily) brief intoduction to -computer networking concepts. For many applications of `gawk' to -TCP/IP networking, we hope that this is enough. For more advanced -tasks, you will need deeper background, and it may be necessary to -switch to lower-level programming in C or C++. +This major node provides a (necessarily) brief intoduction to computer +networking concepts. For many applications of `gawk' to TCP/IP +networking, we hope that this is enough. For more advanced tasks, you +will need deeper background, and it may be necessary to switch to +lower-level programming in C or C++. There are two real-life models for the way computers send messages to each other over a network. While the analogies are not perfect, @@ -189,10 +189,10 @@ postal system (best-effort datagrams).  File: gawkinet.info, Node: Stream Communications, Next: Datagram Communications, Prev: Introduction, Up: Introduction -Reliable Byte-streams (Phone Calls) -=================================== +1.1 Reliable Byte-streams (Phone Calls) +======================================= - When you make a phone call, the following steps occur: +When you make a phone call, the following steps occur: 1. You dial a number. @@ -219,11 +219,11 @@ reliably, in sequence.  File: gawkinet.info, Node: Datagram Communications, Next: The TCP/IP Protocols, Prev: Stream Communications, Up: Introduction -Best-effort Datagrams (Mailed Letters) -====================================== +1.2 Best-effort Datagrams (Mailed Letters) +========================================== - Suppose you mail three different documents to your office on the -other side of the country on two different days. Doing so entails the +Suppose you mail three different documents to your office on the other +side of the country on two different days. Doing so entails the following. 1. Each document travels in its own envelope. @@ -264,10 +264,10 @@ own reliability features on top of the basic communications.  File: gawkinet.info, Node: The TCP/IP Protocols, Next: Making Connections, Prev: Datagram Communications, Up: Introduction -The Internet Protocols -====================== +1.3 The Internet Protocols +========================== - The Internet Protocol Suite (usually referred to as just TCP/IP)(1) +The Internet Protocol Suite (usually referred to as just TCP/IP)(1) consists of a number of different protocols at different levels or "layers." For our purposes, three protocols provide the fundamental communications mechanisms. All other defined protocols are referred to @@ -287,8 +287,8 @@ existence and in use.  File: gawkinet.info, Node: Basic Protocols, Next: Ports, Prev: The TCP/IP Protocols, Up: The TCP/IP Protocols -The Basic Internet Protocols ----------------------------- +1.3.1 The Basic Internet Protocols +---------------------------------- IP The Internet Protocol. This protocol is almost never used @@ -313,15 +313,15 @@ TCP All other user-level protocols use either TCP or UDP to do their basic communications. Examples are SMTP (Simple Mail Transfer Protocol), FTP (File Transfer Protocol), and HTTP (HyperText Transfer -Protocol). +Protocol).  File: gawkinet.info, Node: Ports, Prev: Basic Protocols, Up: The TCP/IP Protocols -TCP and UDP Ports ------------------ +1.3.2 TCP and UDP Ports +----------------------- - In the postal system, the address on an envelope indicates a physical +In the postal system, the address on an envelope indicates a physical location, such as a residence or office building. But there may be more than one person at a location; thus you have to further quantify the recipient by putting a person or company name on the envelope. @@ -348,11 +348,11 @@ always available.  File: gawkinet.info, Node: Making Connections, Prev: The TCP/IP Protocols, Up: Introduction -Making TCP/IP Connections (And Some Terminology) -================================================ +1.4 Making TCP/IP Connections (And Some Terminology) +==================================================== - Two terms come up repeatedly when discussing networking: "client" -and "server". For now, we'll discuss these terms at the "connection +Two terms come up repeatedly when discussing networking: "client" and +"server". For now, we'll discuss these terms at the "connection level", when first establishing connections between two processes on different systems over a network. (Once the connection is established, the higher level, or "application level" protocols, such as HTTP or @@ -394,8 +394,8 @@ the following table, where an "X" indicates that the given action blocks. TCP X X -UDP X -RAW X +UDP X +RAW X ---------- Footnotes ---------- @@ -408,10 +408,10 @@ receiving a "there's no data" error return.  File: gawkinet.info, Node: Using Networking, Next: Some Applications and Techniques, Prev: Introduction, Up: Top -Networking With `gawk' -********************** +2 Networking With `gawk' +************************ - The `awk' programming language was originally developed as a +The `awk' programming language was originally developed as a pattern-matching language for writing short programs to perform data manipulation tasks. `awk''s strength is the manipulation of textual data that is stored in files. It was never meant to be used for @@ -456,10 +456,10 @@ untractable (RAW).  File: gawkinet.info, Node: Gawk Special Files, Next: TCP Connecting, Prev: Using Networking, Up: Using Networking -`gawk''s Networking Mechanisms -============================== +2.1 `gawk''s Networking Mechanisms +================================== - The `|&' operator introduced in `gawk' 3.1 for use in communicating +The `|&' operator introduced in `gawk' 3.1 for use in communicating with a "coprocess" is described in *Note Two-way Communications With Another Process: (gawk)Two-way I/O. It shows how to do two-way I/O to a separate process, sending it data with `print' or `printf' and reading @@ -487,10 +487,10 @@ fields, all of which are mandatory: /inet/PROTOCOL/LOCALPORT/HOSTNAME/REMOTEPORT - The `/inet/' field is, of course, constant when accessing the -network. The LOCALPORT and REMOTEPORT fields do not have a meaning -when used with `/inet/raw' because "ports" only apply to TCP and UDP. -So, when using `/inet/raw', the port fields always have to be `0'. +The `/inet/' field is, of course, constant when accessing the network. +The LOCALPORT and REMOTEPORT fields do not have a meaning when used +with `/inet/raw' because "ports" only apply to TCP and UDP. So, when +using `/inet/raw', the port fields always have to be `0'. * Menu: @@ -500,12 +500,12 @@ So, when using `/inet/raw', the port fields always have to be `0'.  File: gawkinet.info, Node: Special File Fields, Next: Comparing Protocols, Prev: Gawk Special Files, Up: Gawk Special Files -The Fields of the Special File Name ------------------------------------ +2.1.1 The Fields of the Special File Name +----------------------------------------- - This node explains the meaning of all the other fields, as well as -the range of values and the defaults. All of the fields are mandatory. -To let the system pick a value, or if the field doesn't apply to the +This node explains the meaning of all the other fields, as well as the +range of values and the defaults. All of the fields are mandatory. To +let the system pick a value, or if the field doesn't apply to the protocol, specify it as `0': PROTOCOL @@ -546,13 +546,13 @@ REMOTEPORT Instead they specify a local port to which clients connect. It is possible to use a name from `/etc/services' here. - Experts in network programming will notice that the usual -client/server asymmetry found at the level of the socket API is not -visible here. This is for the sake of simplicity of the high-level -concept. If this asymmetry is necessary for your application, use -another language. For `gawk', it is more important to enable users to -write a client program with a minimum of code. What happens when first -accessing a network connection is seen in the following pseudocode: +Experts in network programming will notice that the usual client/server +asymmetry found at the level of the socket API is not visible here. +This is for the sake of simplicity of the high-level concept. If this +asymmetry is necessary for your application, use another language. For +`gawk', it is more important to enable users to write a client program +with a minimum of code. What happens when first accessing a network +connection is seen in the following pseudocode: if ((name of remote host given) && (other side accepts connection)) { rendez-vous successful; transmit with getline or print @@ -566,36 +566,56 @@ accessing a network connection is seen in the following pseudocode: ready } - The exact behavior of this algorithm depends on the values of the -fields of the special file name. When in doubt, the following table -gives you the combinations of values and their meaning. If this table -is too complicated, focus on the three lines printed in *bold*. All the -examples in *Note Networking With `gawk': Using Networking, use only the -patterns printed in bold letters. - -PROTOCOL LOCAL HOST REMOTE RESULTING CONNECTION-LEVEL - PORT NAME PORT BEHAVIOR -*tcp* *0* *x* *x* *Dedicated client, fails - if immediately connecting - to a server - on the other side fails* -udp 0 x x Dedicated client -raw 0 x 0 Dedicated client, works - only as `root' -*tcp, udp* *x* *x* *x* *Client, switches to - dedicated server if - necessary* -*tcp, udp* *x* *0* *0* *Dedicated server* -raw 0 0 0 Dedicated server, works - only as `root' -tcp, udp, raw x x 0 Invalid -tcp, udp, raw 0 0 x Invalid -tcp, udp, raw x 0 x Invalid -tcp, udp 0 0 0 Invalid -tcp, udp 0 x 0 Invalid -raw x 0 0 Invalid -raw 0 x x Invalid -raw x x x Invalid +The exact behavior of this algorithm depends on the values of the +fields of the special file name. When in doubt, *Note +table-inet-components:: gives you the combinations of values and their +meaning. If this table is too complicated, focus on the three lines +printed in *bold*. All the examples in *Note Networking With `gawk': +Using Networking, use only the patterns printed in bold letters. + +PROTOCOL LOCAL PORT HOST NAME REMOTE RESULTING CONNECTION-LEVEL + PORT BEHAVIOR +------------------------------------------------------------------------------ +*tcp* *0* *x* *x* *Dedicated client, fails if + immediately connecting to a + server on the + other side fails* +------------------------------------------------------------------------------ +udp 0 x x Dedicated client +------------------------------------------------------------------------------ +raw 0 x 0 Dedicated client, works only + as `root' +------------------------------------------------------------------------------ +*tcp, udp* *x* *x* *x* *Client, switches to + dedicated server if + necessary* +------------------------------------------------------------------------------ +*tcp, udp* *x* *0* *0* *Dedicated server* +------------------------------------------------------------------------------ +raw 0 0 0 Dedicated server, works only + as `root' +------------------------------------------------------------------------------ +tcp, udp, x x 0 Invalid +raw +------------------------------------------------------------------------------ +tcp, udp, 0 0 x Invalid +raw +------------------------------------------------------------------------------ +tcp, udp, x 0 x Invalid +raw +------------------------------------------------------------------------------ +tcp, udp 0 0 0 Invalid +------------------------------------------------------------------------------ +tcp, udp 0 x 0 Invalid +------------------------------------------------------------------------------ +raw x 0 0 Invalid +------------------------------------------------------------------------------ +raw 0 x x Invalid +------------------------------------------------------------------------------ +raw x x x Invalid +------------------------------------------------------------------------------ + +Table 2.1: /inet Special File Components In general, TCP is the preferred mechanism to use. It is the simplest protocol to understand and to use. Use the others only if @@ -604,10 +624,10 @@ circumstances demand low-overhead.  File: gawkinet.info, Node: Comparing Protocols, Prev: Special File Fields, Up: Gawk Special Files -Comparing Protocols -------------------- +2.1.2 Comparing Protocols +------------------------- - This node develops a pair of programs (sender and receiver) that do +This node develops a pair of programs (sender and receiver) that do nothing but send a timestamp from one machine to another. The sender and the receiver are implemented with each of the three protocols available and demonstrate the differences between them. @@ -621,12 +641,12 @@ available and demonstrate the differences between them.  File: gawkinet.info, Node: File /inet/tcp, Next: File /inet/udp, Prev: Comparing Protocols, Up: Comparing Protocols -`/inet/tcp' -........... +2.1.2.1 `/inet/tcp' +................... - Once again, always use TCP. (Use UDP when low overhead is a -necessity, and use RAW for network experimentation.) The first example -is the sender program: +Once again, always use TCP. (Use UDP when low overhead is a necessity, +and use RAW for network experimentation.) The first example is the +sender program: # Server BEGIN { @@ -634,7 +654,7 @@ is the sender program: close("/inet/tcp/8888/0/0") } - The receiver is very simple: +The receiver is very simple: # Client BEGIN { @@ -643,7 +663,7 @@ is the sender program: close("/inet/tcp/0/localhost/8888") } - TCP guarantees that the bytes arrive at the receiving end in exactly +TCP guarantees that the bytes arrive at the receiving end in exactly the same order that they were sent. No byte is lost (except for broken connections), doubled, or out of order. Some overhead is necessary to accomplish this, but this is the price to pay for a reliable service. @@ -653,10 +673,10 @@ started first, and it waits for the receiver to read a line.  File: gawkinet.info, Node: File /inet/udp, Next: File /inet/raw, Prev: File /inet/tcp, Up: Comparing Protocols -`/inet/udp' -........... +2.1.2.2 `/inet/udp' +................... - The server and client programs that use UDP are almost identical to +The server and client programs that use UDP are almost identical to their TCP counterparts; only the PROTOCOL has changed. As before, it does matter which side starts first. The receiving side blocks and waits for the sender. In this case, the receiver/client has to be @@ -668,7 +688,7 @@ started first: close("/inet/udp/8888/0/0") } - The receiver is almost identical to the TCP receiver: +The receiver is almost identical to the TCP receiver: # Client BEGIN { @@ -677,7 +697,7 @@ started first: close("/inet/udp/0/localhost/8888") } - UDP cannot guarantee that the datagrams at the receiving end will +UDP cannot guarantee that the datagrams at the receiving end will arrive in exactly the same order they were sent. Some datagrams could be lost, some doubled, and some out of order. But no overhead is necessary to accomplish this. This unreliable behavior is good enough for tasks @@ -686,17 +706,17 @@ such as data acquisition, logging, and even stateless services like NFS.  File: gawkinet.info, Node: File /inet/raw, Prev: File /inet/udp, Up: Comparing Protocols -`/inet/raw' -........... +2.1.2.3 `/inet/raw' +................... - This is an IP-level protocol. Only `root' is allowed to access this +This is an IP-level protocol. Only `root' is allowed to access this special file. It is meant to be the basis for implementing and experimenting with transport-level protocols.(1) In the most general case, the sender has to supply the encapsulating header bytes in front of the packet and the receiver has to strip the additional bytes from the message. - RAW receivers cannot receive packets sent with TCP or UDP because the +RAW receivers cannot receive packets sent with TCP or UDP because the operating system does not deliver the packets to a RAW receiver. The operating system knows about some of the protocols on top of IP and decides on its own which packet to deliver to which process. (d.c.) @@ -704,7 +724,7 @@ Therefore, the UDP receiver must be used for receiving UDP datagrams sent with the RAW sender. This is a dark corner, not only of `gawk', but also of TCP/IP. - For extended experimentation with protocols, look into the approach +For extended experimentation with protocols, look into the approach implemented in a tool called SPAK. This tool reflects the hierarchical layering of protocols (encapsulation) in the way data streams are piped out of one program into the next one. It shows which protocol is based @@ -713,9 +733,9 @@ ordering of the program calls. Cleverly thought out, SPAK is much better than `gawk''s `/inet' for learning the meaning of each and every bit in the protocol headers. - The next example uses the RAW protocol to emulate the behavior of -UDP. The sender program is the same as above, but with some additional -bytes that fill the places of the UDP fields: +The next example uses the RAW protocol to emulate the behavior of UDP. +The sender program is the same as above, but with some additional bytes +that fill the places of the UDP fields: BEGIN { Message = "Hello world\n" @@ -732,7 +752,7 @@ bytes that fill the places of the UDP fields: close(RawService) } - Since this program tries to emulate the behavior of UDP, it checks if +Since this program tries to emulate the behavior of UDP, it checks if the RAW sender is understood by the UDP receiver but not if the RAW receiver can understand the UDP sender. In a real network, the RAW receiver is hardly of any use because it gets every IP packet that @@ -741,24 +761,24 @@ would be too slow for processing them. Only on a network with little traffic can the IP-level receiver program be tested. Programs for analyzing IP traffic on modem or ISDN channels should be possible. - Port numbers do not have a meaning when using `/inet/raw'. Their -fields have to be `0'. Only TCP and UDP use ports. Receiving data from +Port numbers do not have a meaning when using `/inet/raw'. Their fields +have to be `0'. Only TCP and UDP use ports. Receiving data from `/inet/raw' is difficult, not only because of processing speed but also because data is usually binary and not restricted to ASCII. This implies that line separation with `RS' does not work as usual. - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) This special file is reserved, but not otherwise currently +(1) This special file is reserved, but not otherwise currently implemented.  File: gawkinet.info, Node: TCP Connecting, Next: Troubleshooting, Prev: Gawk Special Files, Up: Using Networking -Establishing a TCP Connection -============================= +2.2 Establishing a TCP Connection +================================= - Let's observe a network connection at work. Type in the following +Let's observe a network connection at work. Type in the following program and watch the output. Within a second, it connects via TCP (`/inet/tcp') to the machine it is running on (`localhost') and asks the service `daytime' on the machine what time it is: @@ -769,7 +789,7 @@ the service `daytime' on the machine what time it is: close("/inet/tcp/0/localhost/daytime") } - Even experienced `awk' users will find the second line strange in two +Even experienced `awk' users will find the second line strange in two respects: * A special file is used as a shell command that pipes its output @@ -782,12 +802,12 @@ respects: language needed (apart from the special files) to introduce network access. - The `|&' operator was introduced in `gawk' 3.1 in order to overcome -the crucial restriction that access to files and pipes in `awk' is -always unidirectional. It was formerly impossible to use both access -modes on the same file or pipe. Instead of changing the whole concept -of file access, the `|&' operator behaves exactly like the usual pipe -operator except for two additions: +The `|&' operator was introduced in `gawk' 3.1 in order to overcome the +crucial restriction that access to files and pipes in `awk' is always +unidirectional. It was formerly impossible to use both access modes on +the same file or pipe. Instead of changing the whole concept of file +access, the `|&' operator behaves exactly like the usual pipe operator +except for two additions: * Normal shell commands connected to their `gawk' program with a `|&' pipe can be accessed bidirectionally. The `|&' turns out to be a @@ -797,7 +817,7 @@ operator except for two additions: are not executed as shell commands. Instead, they can be read and written to, just like a full-duplex network connection. - In the earlier example, the `|&' operator tells `getline' to read a +In the earlier example, the `|&' operator tells `getline' to read a line from the special file `/inet/tcp/0/localhost/daytime'. We could also have printed a line into the special file. But instead we just read a line with the time, printed it, and closed the connection. @@ -808,13 +828,13 @@ the connections.)  File: gawkinet.info, Node: Troubleshooting, Next: Interacting, Prev: TCP Connecting, Up: Using Networking -Troubleshooting Connection Problems -=================================== +2.3 Troubleshooting Connection Problems +======================================= - It may well be that for some reason the program shown in the -previous example does not run on your machine. When looking at possible -reasons for this, you will learn much about typical problems that arise -in network programming. First of all, your implementation of `gawk' may +It may well be that for some reason the program shown in the previous +example does not run on your machine. When looking at possible reasons +for this, you will learn much about typical problems that arise in +network programming. First of all, your implementation of `gawk' may not support network access because it is a pre-3.1 version or you do not have a network interface in your machine. Perhaps your machine uses some other protocol, such as DECnet or Novell's IPX. For the rest @@ -835,7 +855,7 @@ a look at your `/etc/services' file. It could look like this: # Network services, Internet style # # Name Number/Protcol Alternate name # Comments - + echo 7/tcp echo 7/udp discard 9/tcp sink null @@ -859,40 +879,39 @@ a look at your `/etc/services' file. It could look like this: irc 194/udp ... - Here, you find a list of services that traditional Unix machines -usually support. If your GNU/Linux machine does not do so, it may be -that these services are switched off in some startup script. Systems -running some flavor of Microsoft Windows usually do _not_ support these -services. Nevertheless, it _is_ possible to do networking with `gawk' -on Microsoft Windows.(1) The first column of the file gives the name of -the service, and the second column gives a unique number and the -protocol that one can use to connect to this service. The rest of the -line is treated as a comment. You see that some services (`echo') -support TCP as well as UDP. - - ---------- Footnotes ---------- - - (1) Microsoft prefered to ignore the TCP/IP family of protocols -until 1995. Then came the rise of the Netscape browser as a landmark -"killer application." Microsoft added TCP/IP support and their own -browser to Microsoft Windows 95 at the last minute. They even -back-ported their TCP/IP implementation to Microsoft Windows for -Workgroups 3.11, but it was a rather rudimentary and half-hearted -implementation. Nevertheless, the equivalent of `/etc/services' resides -under `C:\WINNT\system32\drivers\etc\services' on Microsoft Windows -2000. +Here, you find a list of services that traditional Unix machines usually +support. If your GNU/Linux machine does not do so, it may be that these +services are switched off in some startup script. Systems running some +flavor of Microsoft Windows usually do _not_ support these services. +Nevertheless, it _is_ possible to do networking with `gawk' on Microsoft +Windows.(1) The first column of the file gives the name of the service, +and the second column gives a unique number and the protocol that one +can use to connect to this service. The rest of the line is treated as +a comment. You see that some services (`echo') support TCP as well as +UDP. + +---------- Footnotes ---------- + +(1) Microsoft prefered to ignore the TCP/IP family of protocols until +1995. Then came the rise of the Netscape browser as a landmark "killer +application." Microsoft added TCP/IP support and their own browser to +Microsoft Windows 95 at the last minute. They even back-ported their +TCP/IP implementation to Microsoft Windows for Workgroups 3.11, but it +was a rather rudimentary and half-hearted implementation. Nevertheless, +the equivalent of `/etc/services' resides under +`C:\WINNT\system32\drivers\etc\services' on Microsoft Windows 2000.  File: gawkinet.info, Node: Interacting, Next: Setting Up, Prev: Troubleshooting, Up: Using Networking -Interacting with a Network Service -================================== +2.4 Interacting with a Network Service +====================================== - The next program makes use of the possibility to really interact -with a network service by printing something into the special file. It -asks the so-called `finger' service if a user of the machine is logged -in. When testing this program, try to change `localhost' to some other -machine name in your local network: +The next program makes use of the possibility to really interact with a +network service by printing something into the special file. It asks the +so-called `finger' service if a user of the machine is logged in. When +testing this program, try to change `localhost' to some other machine +name in your local network: BEGIN { NetService = "/inet/tcp/0/localhost/finger" @@ -902,14 +921,14 @@ machine name in your local network: close(NetService) } - After telling the service on the machine which user to look for, the +After telling the service on the machine which user to look for, the program repeatedly reads lines that come as a reply. When no more lines are coming (because the service has closed the connection), the program also closes the connection. Try replacing `"NAME"' with your login name (or the name of someone else logged in). For a list of all users currently logged in, replace NAME with an empty string (`""'). - The final `close' command could be safely deleted from the above +The final `close' command could be safely deleted from the above script, because the operating system closes any open connection by default when a script reaches the end of execution. In order to avoid portability problems, it is best to always close connections explicitly. @@ -917,18 +936,18 @@ With the Linux kernel, for example, proper closing results in flushing of buffers. Letting the close happen by default may result in discarding buffers. - When looking at `/etc/services' you may have noticed that the -`daytime' service is also available with `udp'. In the earlier example, -change `tcp' to `udp', and change `finger' to `daytime'. After -starting the modified program, you see the expected day and time -message. The program then hangs, because it waits for more lines -coming from the service. However, they never come. This behavior is a -consequence of the differences between TCP and UDP. When using UDP, -neither party is automatically informed about the other closing the -connection. Continuing to experiment this way reveals many other subtle -differences between TCP and UDP. To avoid such trouble, one should -always remember the advice Douglas E. Comer and David Stevens give in -Volume III of their series `Internetworking With TCP' (page 14): +When looking at `/etc/services' you may have noticed that the `daytime' +service is also available with `udp'. In the earlier example, change +`tcp' to `udp', and change `finger' to `daytime'. After starting the +modified program, you see the expected day and time message. The +program then hangs, because it waits for more lines coming from the +service. However, they never come. This behavior is a consequence of the +differences between TCP and UDP. When using UDP, neither party is +automatically informed about the other closing the connection. +Continuing to experiment this way reveals many other subtle differences +between TCP and UDP. To avoid such trouble, one should always remember +the advice Douglas E. Comer and David Stevens give in Volume III of +their series `Internetworking With TCP' (page 14): When designing client-server applications, beginners are strongly advised to use TCP because it provides reliable, @@ -940,42 +959,42 @@ Volume III of their series `Internetworking With TCP' (page 14):  File: gawkinet.info, Node: Setting Up, Next: Email, Prev: Interacting, Up: Using Networking -Setting Up a Service -==================== +2.5 Setting Up a Service +======================== - The preceding programs behaved as clients that connect to a server +The preceding programs behaved as clients that connect to a server somewhere on the Internet and request a particular service. Now we set up such a service to mimic the behavior of the `daytime' service. Such a server does not know in advance who is going to connect to it over the network. Therefore, we cannot insert a name for the host to connect to in our special file name. - Start the following program in one window. Notice that the service -does not have the name `daytime', but the number `8888'. From looking -at `/etc/services', you know that names like `daytime' are just -mnemonics for predetermined 16-bit integers. Only the system -administrator (`root') could enter our new service into `/etc/services' -with an appropriate name. Also notice that the service name has to be -entered into a different field of the special file name because we are -setting up a server, not a client: +Start the following program in one window. Notice that the service does +not have the name `daytime', but the number `8888'. From looking at +`/etc/services', you know that names like `daytime' are just mnemonics +for predetermined 16-bit integers. Only the system administrator +(`root') could enter our new service into `/etc/services' with an +appropriate name. Also notice that the service name has to be entered +into a different field of the special file name because we are setting +up a server, not a client: BEGIN { print strftime() |& "/inet/tcp/8888/0/0" close("/inet/tcp/8888/0/0") } - Now open another window on the same machine. Copy the client -program given as the first example (*note Establishing a TCP -Connection: TCP Connecting.) to a new file and edit it, changing the -name `daytime' to `8888'. Then start the modified client. You should -get a reply like this: +Now open another window on the same machine. Copy the client program +given as the first example (*note Establishing a TCP Connection: TCP +Connecting.) to a new file and edit it, changing the name `daytime' to +`8888'. Then start the modified client. You should get a reply like +this: Sat Sep 27 19:08:16 CEST 1997 Both programs explicitly close the connection. - Now we will intentionally make a mistake to see what happens when -the name `8888' (the so-called port) is already used by another service. +Now we will intentionally make a mistake to see what happens when the +name `8888' (the so-called port) is already used by another service. Start the server program in both windows. The first one works, but the second one complains that it could not open the connection. Each port on a single machine can only be used by one server program at a time. @@ -989,7 +1008,7 @@ running some flavor of Microsoft Windows, there is no restriction that reserves ports 1 to 1024 for a privileged user; hence, you can start an `echo' server there. - Turning this short server program into something really useful is +Turning this short server program into something really useful is simple. Imagine a server that first reads a file name from the client through the network connection, then does something with the file and sends a result back to the client. The server-side processing could be: @@ -1015,15 +1034,15 @@ machine and execute arbitrary commands, anyone would be free to do `rm  File: gawkinet.info, Node: Email, Next: Web page, Prev: Setting Up, Up: Using Networking -Reading Email -============= +2.6 Reading Email +================= - The distribution of email is usually done by dedicated email servers +The distribution of email is usually done by dedicated email servers that communicate with your machine using special protocols. To receive email, we will use the Post Office Protocol (POP). Sending can be done with the much older Simple Mail Transfer Protocol (SMTP). - When you type in the following program, replace the EMAILHOST by the +When you type in the following program, replace the EMAILHOST by the name of your local email server. Ask your administrator if the server has a POP service, and then use its name or number in the program below. Now the program is ready to connect to your email server, but it will @@ -1048,27 +1067,27 @@ the first email the server has in store: close(POPService) } - The record separators `RS' and `ORS' are redefined because the -protocol (POP) requires CR-LF to separate lines. After identifying -yourself to the email service, the command `retr 1' instructs the -service to send the first of all your email messages in line. If the -service replies with something other than `+OK', the program exits; -maybe there is no email. Otherwise, the program first announces that it -intends to finish reading email, and then redefines `RS' in order to -read the entire email as multiline input in one record. From the POP -RFC, we know that the body of the email always ends with a single line -containing a single dot. The program looks for this using `RS = -"\r\n\\.\r\n"'. When it finds this sequence in the mail message, it -quits. You can invoke this program as often as you like; it does not -delete the message it reads, but instead leaves it on the server. +The record separators `RS' and `ORS' are redefined because the protocol +(POP) requires CR-LF to separate lines. After identifying yourself to +the email service, the command `retr 1' instructs the service to send +the first of all your email messages in line. If the service replies +with something other than `+OK', the program exits; maybe there is no +email. Otherwise, the program first announces that it intends to finish +reading email, and then redefines `RS' in order to read the entire +email as multiline input in one record. From the POP RFC, we know that +the body of the email always ends with a single line containing a +single dot. The program looks for this using `RS = "\r\n\\.\r\n"'. +When it finds this sequence in the mail message, it quits. You can +invoke this program as often as you like; it does not delete the +message it reads, but instead leaves it on the server.  File: gawkinet.info, Node: Web page, Next: Primitive Service, Prev: Email, Up: Using Networking -Reading a Web Page -================== +2.7 Reading a Web Page +====================== - Retrieving a web page from a web server is as simple as retrieving +Retrieving a web page from a web server is as simple as retrieving email from an email server. We only have to use a similar, but not identical, protocol and a different port. The name of the protocol is HyperText Transfer Protocol (HTTP) and the port number is usually 80. @@ -1076,12 +1095,12 @@ As in the preceding node, ask your administrator about the name of your local web server or proxy web server and its port number for HTTP requests. - The following program employs a rather crude approach toward -retrieving a web page. It uses the prehistoric syntax of HTTP 0.9, -which almost all web servers still support. The most noticeable thing -about it is that the program directs the request to the local proxy -server whose name you insert in the special file name (which in turn -calls `www.yahoo.com'): +The following program employs a rather crude approach toward retrieving +a web page. It uses the prehistoric syntax of HTTP 0.9, which almost all +web servers still support. The most noticeable thing about it is that +the program directs the request to the local proxy server whose name +you insert in the special file name (which in turn calls +`www.yahoo.com'): BEGIN { RS = ORS = "\r\n" @@ -1092,7 +1111,7 @@ calls `www.yahoo.com'): close(HttpService) } - Again, lines are separated by a redefined `RS' and `ORS'. The `GET' +Again, lines are separated by a redefined `RS' and `ORS'. The `GET' request that we send to the server is the only kind of HTTP request that existed when the web was created in the early 1990s. HTTP calls this `GET' request a "method," which tells the service to transmit a @@ -1102,13 +1121,13 @@ HTTP is 1.1,(1) and knows the additional request methods `OPTIONS', `PUT', `DELETE', and `TRACE'. You can fill in any valid web address, and the program prints the HTML code of that page to your screen. - Notice the similarity between the responses of the POP and HTTP +Notice the similarity between the responses of the POP and HTTP services. First, you get a header that is terminated by an empty line, and then you get the body of the page in HTML. The lines of the headers also have the same form as in POP. There is the name of a parameter, then a colon, and finally the value of that parameter. - Images (`.png' or `.gif' files) can also be retrieved this way, but +Images (`.png' or `.gif' files) can also be retrieved this way, but then you get binary data that should be redirected into a file. Another application is calling a CGI (Common Gateway Interface) script on some server. CGI scripts are used when the contents of a web page are not @@ -1120,21 +1139,21 @@ following: get = "GET http://quote.yahoo.com/q?s=MOT&d=t" print get |& HttpService - You can also request weather reports this way. +You can also request weather reports this way. - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) Version 1.0 of HTTP was defined in RFC 1945. HTTP 1.1 was +(1) Version 1.0 of HTTP was defined in RFC 1945. HTTP 1.1 was initially specified in RFC 2068. In June 1999, RFC 2068 was made obsolete by RFC 2616, an update without any substantial changes.  File: gawkinet.info, Node: Primitive Service, Next: Interacting Service, Prev: Web page, Up: Using Networking -A Primitive Web Service -======================= +2.8 A Primitive Web Service +=========================== - Now we know enough about HTTP to set up a primitive web service that +Now we know enough about HTTP to set up a primitive web service that just says `"Hello, world"' when someone connects to it with a browser. Compared to the situation in the preceding node, our program changes the role. It tries to behave just like the server we have observed. @@ -1143,8 +1162,8 @@ number in the `localport' field of the special file name. The other two fields (HOSTNAME and REMOTEPORT) have to contain a `0' because we do not know in advance which host will connect to our service. - In the early 1990s, all a server had to do was send an HTML document -and close the connection. Here, we adhere to the modern syntax of HTTP. +In the early 1990s, all a server had to do was send an HTML document and +close the connection. Here, we adhere to the modern syntax of HTTP. The steps are as follows: 1. Send a status line telling the web browser that everything is okay. @@ -1179,20 +1198,20 @@ The steps are as follows: close(HttpService) } - Now, on the same machine, start your favorite browser and let it -point to `http://localhost:8080' (the browser needs to know on which -port our server is listening for requests). If this does not work, the -browser probably tries to connect to a proxy server that does not know -your machine. If so, change the browser's configuration so that the -browser does not try to use a proxy to connect to your machine. +Now, on the same machine, start your favorite browser and let it point +to `http://localhost:8080' (the browser needs to know on which port our +server is listening for requests). If this does not work, the browser +probably tries to connect to a proxy server that does not know your +machine. If so, change the browser's configuration so that the browser +does not try to use a proxy to connect to your machine.  File: gawkinet.info, Node: Interacting Service, Next: Simple Server, Prev: Primitive Service, Up: Using Networking -A Web Service with Interaction -============================== +2.9 A Web Service with Interaction +================================== - This node shows how to set up a simple web server. The subnode is a +This node shows how to set up a simple web server. The subnode is a library file that we will use with all the examples in *Note Some Applications and Techniques::. @@ -1200,15 +1219,15 @@ Applications and Techniques::. * CGI Lib:: A simple CGI library. - Setting up a web service that allows user interaction is more -difficult and shows us the limits of network access in `gawk'. In this -node, we develop a main program (a `BEGIN' pattern and its action) -that will become the core of event-driven execution controlled by a -graphical user interface (GUI). Each HTTP event that the user triggers -by some action within the browser is received in this central -procedure. Parameters and menu choices are extracted from this request, -and an appropriate measure is taken according to the user's choice. -For example: +Setting up a web service that allows user interaction is more difficult +and shows us the limits of network access in `gawk'. In this node, we +develop a main program (a `BEGIN' pattern and its action) that will +become the core of event-driven execution controlled by a graphical +user interface (GUI). Each HTTP event that the user triggers by some +action within the browser is received in this central procedure. +Parameters and menu choices are extracted from this request, and an +appropriate measure is taken according to the user's choice. For +example: BEGIN { if (MyHost == "") { @@ -1255,7 +1274,7 @@ For example: } } - This web server presents menu choices in the form of HTML links. +This web server presents menu choices in the form of HTML links. Therefore, it has to tell the browser the name of the host it is residing on. When starting the server, the user may supply the name of the host from the command line with `gawk -v MyHost="Rumpelstilzchen"'. @@ -1264,7 +1283,7 @@ it is running on for later use as a web address in HTML documents. The same applies to the port number. These values are inserted later into the HTML content of the web pages to refer to the home system. - Each server that is built around this core has to initialize some +Each server that is built around this core has to initialize some application-dependent variables (such as the default home page) in a procedure `SetUpServer', which is called immediately before entering the infinite loop of the server. For now, we will write an instance that @@ -1283,14 +1302,13 @@ in human-readable format or in seconds since 1970: TopFooter = "" } - On the first run through the main loop, the default line terminators -are set and the default home page is copied to the actual home page. -Since this is the first run, `GETARG["Method"]' is not initialized yet, -hence the case selection over the method does nothing. Now that the -home page is initialized, the server can start communicating to a -client browser. +On the first run through the main loop, the default line terminators are +set and the default home page is copied to the actual home page. Since +this is the first run, `GETARG["Method"]' is not initialized yet, hence +the case selection over the method does nothing. Now that the home page +is initialized, the server can start communicating to a client browser. - It does so by printing the HTTP header into the network connection +It does so by printing the HTTP header into the network connection (`print ... |& HttpService'). This command blocks execution of the server script until a client connects. If this server script is compared with the primitive one we wrote before, you will notice two @@ -1302,7 +1320,7 @@ the browser retrieves the time of day in the previous example just once, and later it takes the web page from the cache, always displaying the same time of day although time advances each second. - Having supplied the initial home page to the browser with a valid +Having supplied the initial home page to the browser with a valid document stored in the parameter `Prompt', it closes the connection and waits for the next request. When the request comes, a log line is printed that allows us to see which request the server receives. The @@ -1333,8 +1351,8 @@ Simple CGI Library: CGI Lib. For now, we use a simplified version of } } - At first, the function clears all variables used for global storage -of request parameters. The rest of the function serves the purpose of +At first, the function clears all variables used for global storage of +request parameters. The rest of the function serves the purpose of filling the global parameters with the extracted new values. To accomplish this, the name of the requested resource is split into parts and stored for later evaluation. If the request contains a `?', then @@ -1350,7 +1368,7 @@ working with the `POST' and `PUT' methods, reading the header and body becomes inevitable. Header parameters should then be stored in a global array as well as the body. - On each subsequent run through the main loop, one request from a +On each subsequent run through the main loop, one request from a browser is received, evaluated, and answered according to the user's choice. This can be done by letting the value of the HTTP method guide the main loop into execution of the procedure `HandleGET', which @@ -1367,7 +1385,7 @@ names. Notice how simple it is to construct menus of arbitrary depth: } } - The disadvantage of this approach is that our server is slow and can +The disadvantage of this approach is that our server is slow and can handle only one request at a time. Its main advantage, however, is that the server consists of just one `gawk' program. No need for installing an `httpd', and no need for static separate HTML files, CGI scripts, or @@ -1375,29 +1393,29 @@ an `httpd', and no need for static separate HTML files, CGI scripts, or started on the same host that runs your browser. Then let your browser point to `http://localhost:8080'. - It is also possible to include images into the HTML pages. Most +It is also possible to include images into the HTML pages. Most browsers support the not very well-known `.xbm' format, which may contain only monochrome pictures but is an ASCII format. Binary images are possible but not so easy to handle. Another way of including images is to generate them with a tool such as GNUPlot, by calling the tool with the `system' function or through a pipe. - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) As defined in RFC 2068. +(1) As defined in RFC 2068.  File: gawkinet.info, Node: CGI Lib, Prev: Interacting Service, Up: Interacting Service -A Simple CGI Library --------------------- +2.9.1 A Simple CGI Library +-------------------------- HTTP is like being married: you have to be able to handle whatever you're given, while being very careful what you send back. Phil Smith III, `http://www.netfunny.com/rhf/jokes/99/Mar/http.html' - In *Note A Web Service with Interaction: Interacting Service, we saw +In *Note A Web Service with Interaction: Interacting Service, we saw the function `CGI_setup' as part of the web server "core logic" framework. The code presented there handles almost everything necessary for CGI requests. One thing it doesn't do is handle encoded characters @@ -1421,12 +1439,12 @@ is the code: # GETARG --- arguments to CGI GET command # MENU --- menu items (path names) # PARAM --- parameters of form x=y - + # Optional variable MyHost contains host address # Optional variable MyPort contains port number # Needs TopHeader, TopDoc, TopFooter # Sets MyPrefix, HttpService, Status, Reason - + BEGIN { if (MyHost == "") { "uname -n" | getline MyHost @@ -1470,7 +1488,7 @@ is the code: CGI_setup($1, $2, $3) } } - + function CGI_setup( method, uri, version, i) { delete GETARG @@ -1479,7 +1497,7 @@ is the code: GETARG["Method"] = method GETARG["URI"] = uri GETARG["Version"] = version - + i = index(uri, "?") if (i > 0) { # is there a "?" indicating a CGI request? split(substr(uri, 1, i-1), MENU, "[/:]") @@ -1498,32 +1516,32 @@ is the code: MENU[i] = _CGI_decode(MENU[i]) } - This isolates details in a single function, `CGI_setup'. Decoding -of encoded characters is pushed off to a helper function, -`_CGI_decode'. The use of the leading underscore (`_') in the function -name is intended to indicate that it is an "internal" function, -although there is nothing to enforce this: +This isolates details in a single function, `CGI_setup'. Decoding of +encoded characters is pushed off to a helper function, `_CGI_decode'. +The use of the leading underscore (`_') in the function name is +intended to indicate that it is an "internal" function, although there +is nothing to enforce this: function _CGI_decode(str, hexdigs, i, pre, code1, code2, val, result) { hexdigs = "123456789abcdef" - + i = index(str, "%") if (i == 0) # no work to do return str - + do { pre = substr(str, 1, i-1) # part before %xx code1 = substr(str, i+1, 1) # first hex digit code2 = substr(str, i+2, 1) # second hex digit str = substr(str, i+3) # rest of string - + code1 = tolower(code1) code2 = tolower(code2) val = index(hexdigs, code1) * 16 \ + index(hexdigs, code2) - + result = result pre sprintf("%c", val) i = index(str, "%") } while (i != 0) @@ -1532,7 +1550,7 @@ although there is nothing to enforce this: return result } - This works by splitting the string apart around an encoded character. +This works by splitting the string apart around an encoded character. The two digits are converted to lowercase characters and looked up in a string of hex digits. Note that `0' is not in the string on purpose; `index' returns zero when it's not found, automatically giving the @@ -1554,7 +1572,7 @@ above functions: printf "GETARG[\"%s\"] = %s\n", i, GETARG[i] } - And this is the result when we run it: +And this is the result when we run it: $ gawk -f testserv.awk -| MENU["4"] = www.gnu.org @@ -1577,19 +1595,19 @@ above functions:  File: gawkinet.info, Node: Simple Server, Next: Caveats, Prev: Interacting Service, Up: Using Networking -A Simple Web Server -=================== +2.10 A Simple Web Server +======================== - In the preceding node, we built the core logic for event-driven GUIs. +In the preceding node, we built the core logic for event-driven GUIs. In this node, we finally extend the core to a real application. No one would actually write a commercial web server in `gawk', but it is instructive to see that it is feasible in principle. - The application is ELIZA, the famous program by Joseph Weizenbaum -that mimics the behavior of a professional psychotherapist when talking -to you. Weizenbaum would certainly object to this description, but -this is part of the legend around ELIZA. Take the site-independent -core logic and append the following code: +The application is ELIZA, the famous program by Joseph Weizenbaum that +mimics the behavior of a professional psychotherapist when talking to +you. Weizenbaum would certainly object to this description, but this +is part of the legend around ELIZA. Take the site-independent core +logic and append the following code: function SetUpServer() { SetUpEliza() @@ -1613,24 +1631,24 @@ core logic and append the following code: TopFooter = "" } - `SetUpServer' is similar to the previous example, except for calling +`SetUpServer' is similar to the previous example, except for calling another function, `SetUpEliza'. This approach can be used to implement other kinds of servers. The only changes needed to do so are hidden in the functions `SetUpServer' and `HandleGET'. Perhaps it might be necessary to implement other HTTP methods. The `igawk' program that comes with `gawk' may be useful for this process. - When extending this example to a complete application, the first -thing to do is to implement the function `SetUpServer' to initialize -the HTML pages and some variables. These initializations determine the -way your HTML pages look (colors, titles, menu items, etc.). +When extending this example to a complete application, the first thing +to do is to implement the function `SetUpServer' to initialize the HTML +pages and some variables. These initializations determine the way your +HTML pages look (colors, titles, menu items, etc.). - The function `HandleGET' is a nested case selection that decides -which page the user wants to see next. Each nesting level refers to a -menu level of the GUI. Each case implements a certain action of the -menu. On the deepest level of case selection, the handler essentially -knows what the user wants and stores the answer into the variable that -holds the HTML page contents: +The function `HandleGET' is a nested case selection that decides which +page the user wants to see next. Each nesting level refers to a menu +level of the GUI. Each case implements a certain action of the menu. On +the deepest level of case selection, the handler essentially knows what +the user wants and stores the answer into the variable that holds the +HTML page contents: function HandleGET() { # A real HTTP server would treat some parts of the URI as a file name. @@ -1661,7 +1679,7 @@ holds the HTML page contents: } } - Now we are down to the heart of ELIZA, so you can see how it works. +Now we are down to the heart of ELIZA, so you can see how it works. Initially the user does not say anything; then ELIZA resets its money counter and asks the user to tell what comes to mind open heartedly. The subsequent answers are converted to uppercase characters and stored @@ -1714,7 +1732,7 @@ possible answers: return answer } - In the long but simple function `SetUpEliza', you can see tables for +In the long but simple function `SetUpEliza', you can see tables for conjugation, keywords, and answers.(1) The associative array `k' contains indices into the array of answers `r'. To choose an answer, ELIZA just picks an index randomly: @@ -1723,7 +1741,7 @@ ELIZA just picks an index randomly: srand() wold = "-" subjold = " " - + # table for conjugation conj[" ARE " ] = " AM " conj["WERE " ] = "WAS " @@ -1737,7 +1755,7 @@ ELIZA just picks an index randomly: conj[" I AM " ] = " YOU ARE " conj[" YOURE " ] =\ conj[" YOU ARE " ] = " I AM " - + # table of all answers r[1] = "DONT YOU BELIEVE THAT I CAN _" r[2] = "PERHAPS YOU WOULD LIKE TO BE ABLE TO _ ?" @@ -1753,28 +1771,28 @@ ELIZA just picks an index randomly: } - Some interesting remarks and details (including the original source -code of ELIZA) are found on Mark Humphrys' home page. Yahoo! also has -a page with a collection of ELIZA-like programs. Many of them are -written in Java, some of them disclosing the Java source code, and a -few even explain how to modify the Java source code. +Some interesting remarks and details (including the original source code +of ELIZA) are found on Mark Humphrys' home page. Yahoo! also has a +page with a collection of ELIZA-like programs. Many of them are written +in Java, some of them disclosing the Java source code, and a few even +explain how to modify the Java source code. - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) The version shown here is abbreviated. The full version comes -with the `gawk' distribution. +(1) The version shown here is abbreviated. The full version comes with +the `gawk' distribution.  File: gawkinet.info, Node: Caveats, Next: Challenges, Prev: Simple Server, Up: Using Networking -Network Programming Caveats -=========================== +2.11 Network Programming Caveats +================================ - By now it should be clear that debugging a networked application is -more complicated than debugging a single-process single-hosted -application. The behavior of a networked application sometimes looks -noncausal because it is not reproducible in a strong sense. Whether a -network application works or not sometimes depends on the following: +By now it should be clear that debugging a networked application is more +complicated than debugging a single-process single-hosted application. +The behavior of a networked application sometimes looks noncausal +because it is not reproducible in a strong sense. Whether a network +application works or not sometimes depends on the following: * How crowded the underlying network is @@ -1782,25 +1800,24 @@ network application works or not sometimes depends on the following: * The state of the party at the other end - The most difficult problems for a beginner arise from the hidden -states of the underlying network. After closing a TCP connection, it's -often necessary to wait a short while before reopening the connection. -Even more difficult is the establishment of a connection that -previously ended with a "broken pipe." Those connections have to "time -out" for a minute or so before they can reopen. Check this with the -command `netstat -a', which provides a list of still "active" -connections. +The most difficult problems for a beginner arise from the hidden states +of the underlying network. After closing a TCP connection, it's often +necessary to wait a short while before reopening the connection. Even +more difficult is the establishment of a connection that previously +ended with a "broken pipe." Those connections have to "time out" for a +minute or so before they can reopen. Check this with the command +`netstat -a', which provides a list of still "active" connections.  File: gawkinet.info, Node: Challenges, Prev: Caveats, Up: Using Networking -Where To Go From Here -===================== +2.12 Where To Go From Here +========================== - Now, you have learned enough to build your own application. You -could, for example, take part in the Loebner Contest to win $100,000. -The Loebner Prize is the first formal instantiation of a Turing Test. -Hugh Loebner agreed with The Cambridge Center for Behavioral Studies to +Now, you have learned enough to build your own application. You could, +for example, take part in the Loebner Contest to win $100,000. The +Loebner Prize is the first formal instantiation of a Turing Test. Hugh +Loebner agreed with The Cambridge Center for Behavioral Studies to underwrite a contest designed to implement the Turing Test. Dr. Loebner pledged a Grand Prize of $100,000 for the first computer whose responses were indistinguishable from a human's. Each year an annual @@ -1850,16 +1867,16 @@ program of 1997: JUDGE02[10:49:01]I would enjoy all aspects of life no matter what my gender. PROGRAM[10:49:02]Do you think of yourself as being attractive? - This program insists on always speaking about the same story around -Bill Clinton. You see, even a program with a rather narrow mind can -behave so much like a human being that it can win this prize. It is -quite common to let these programs talk to each other via network -connections. But during the competition itself, the program and its -computer have to be present at the place the competition is held. We -all would love to see a `gawk' program win in such an event. Maybe it -is up to you to accomplish this? +This program insists on always speaking about the same story around Bill +Clinton. You see, even a program with a rather narrow mind can behave so +much like a human being that it can win this prize. It is quite common +to let these programs talk to each other via network connections. But +during the competition itself, the program and its computer have to be +present at the place the competition is held. We all would love to see +a `gawk' program win in such an event. Maybe it is up to you to +accomplish this? - Some other ideas for useful networked applications: +Some other ideas for useful networked applications: * Read the file `doc/awkforai.txt' in the `gawk' distribution. It was written by Ronald P. Loui (Associate Professor of Computer Science, at Washington University in St. Louis, @@ -1938,36 +1955,36 @@ is up to you to accomplish this?  File: gawkinet.info, Node: Some Applications and Techniques, Next: Links, Prev: Using Networking, Up: Top -Some Applications and Techniques -******************************** +3 Some Applications and Techniques +********************************** - In this major node, we look at a number of self-contained scripts, -with an emphasis on concise networking. Along the way, we work towards +In this major node, we look at a number of self-contained scripts, with +an emphasis on concise networking. Along the way, we work towards creating building blocks that encapsulate often needed functions of the networking world, show new techniques that broaden the scope of problems that can be solved with `gawk', and explore leading edge technology that may shape the future of networking. - We often refer to the site-independent core of the server that we -built in *Note A Simple Web Server: Simple Server. When building new -and nontrivial servers, we always copy this building block and append -new instances of the two functions `SetUpServer' and `HandleGET'. - - This makes a lot of sense, since this scheme of event-driven -execution provides `gawk' with an interface to the most widely accepted -standard for GUIs: the web browser. Now, `gawk' can rival even Tcl/Tk. - - Tcl and `gawk' have much in common. Both are simple scripting -languages that allow us to quickly solve problems with short programs. -But Tcl has Tk on top of it, and `gawk' had nothing comparable up to -now. While Tcl needs a large and ever-changing library (Tk, which was -bound to the X Window System until recently), `gawk' needs just the -networking interface and some kind of browser on the client's side. -Besides better portability, the most important advantage of this -approach (embracing well-established standards such HTTP and HTML) is -that _we do not need to change the language_. We let others do the work -of fighting over protocols and standards. We can use HTML, JavaScript, -VRML, or whatever else comes along to do our work. +We often refer to the site-independent core of the server that we built +in *Note A Simple Web Server: Simple Server. When building new and +nontrivial servers, we always copy this building block and append new +instances of the two functions `SetUpServer' and `HandleGET'. + +This makes a lot of sense, since this scheme of event-driven execution +provides `gawk' with an interface to the most widely accepted standard +for GUIs: the web browser. Now, `gawk' can rival even Tcl/Tk. + +Tcl and `gawk' have much in common. Both are simple scripting languages +that allow us to quickly solve problems with short programs. But Tcl +has Tk on top of it, and `gawk' had nothing comparable up to now. While +Tcl needs a large and ever-changing library (Tk, which was bound to the +X Window System until recently), `gawk' needs just the networking +interface and some kind of browser on the client's side. Besides better +portability, the most important advantage of this approach (embracing +well-established standards such HTTP and HTML) is that _we do not need +to change the language_. We let others do the work of fighting over +protocols and standards. We can use HTML, JavaScript, VRML, or +whatever else comes along to do our work. * Menu: @@ -1985,14 +2002,14 @@ VRML, or whatever else comes along to do our work.  File: gawkinet.info, Node: PANIC, Next: GETURL, Prev: Some Applications and Techniques, Up: Some Applications and Techniques -PANIC: An Emergency Web Server -============================== +3.1 PANIC: An Emergency Web Server +================================== - At first glance, the `"Hello, world"' example in *Note A Primitive -Web Service: Primitive Service, seems useless. By adding just a few -lines, we can turn it into something useful. +At first glance, the `"Hello, world"' example in *Note A Primitive Web +Service: Primitive Service, seems useless. By adding just a few lines, +we can turn it into something useful. - The PANIC program tells everyone who connects that the local site is +The PANIC program tells everyone who connects that the local site is not working. When a web server breaks down, it makes a difference if customers get a strange "network unreachable" message, or a short message telling them that the server has a problem. In such an @@ -2000,10 +2017,10 @@ emergency, the hard disk and everything on it (including the regular web service) may be unavailable. Rebooting the web server off a diskette makes sense in this setting. - To use the PANIC program as an emergency web server, all you need -are the `gawk' executable and the program below on a diskette. By -default, it connects to port 8080. A different value may be supplied on -the command line: +To use the PANIC program as an emergency web server, all you need are +the `gawk' executable and the program below on a diskette. By default, +it connects to port 8080. A different value may be supplied on the +command line: BEGIN { RS = ORS = "\r\n" @@ -2027,10 +2044,10 @@ the command line:  File: gawkinet.info, Node: GETURL, Next: REMCONF, Prev: PANIC, Up: Some Applications and Techniques -GETURL: Retrieving Web Pages -============================ +3.2 GETURL: Retrieving Web Pages +================================ - GETURL is a versatile building block for shell scripts that need to +GETURL is a versatile building block for shell scripts that need to retrieve files from the Internet. It takes a web address as a command-line parameter and tries to retrieve the contents of this address. The contents are printed to standard output, while the header @@ -2041,14 +2058,14 @@ straightforward to write on top of GETURL. On the Internet, you can find several programs of the same name that do the same job. They are usually much more complex internally and at least 10 times longer. - At first, GETURL checks if it was called with exactly one web -address. Then, it checks if the user chose to use a special proxy -server whose name is handed over in a variable. By default, it is -assumed that the local machine serves as proxy. GETURL uses the `GET' -method by default to access the web page. By handing over the name of a -different method (such as `HEAD'), it is possible to choose a different -behavior. With the `HEAD' method, the user does not receive the body of -the page content, but does receive the header: +At first, GETURL checks if it was called with exactly one web address. +Then, it checks if the user chose to use a special proxy server whose +name is handed over in a variable. By default, it is assumed that the +local machine serves as proxy. GETURL uses the `GET' method by default +to access the web page. By handing over the name of a different method +(such as `HEAD'), it is possible to choose a different behavior. With +the `HEAD' method, the user does not receive the body of the page +content, but does receive the header: BEGIN { if (ARGC != 2) { @@ -2075,7 +2092,7 @@ the page content, but does receive the header: close(HttpService) } - This program can be changed as needed, but be careful with the last +This program can be changed as needed, but be careful with the last lines. Make sure transmission of binary data is not corrupted by additional line breaks. Even as it is now, the byte sequence `"\r\n\r\n"' would disappear if it were contained in binary data. Don't @@ -2084,10 +2101,10 @@ get caught in a trap when trying a quick fix on this one.  File: gawkinet.info, Node: REMCONF, Next: URLCHK, Prev: GETURL, Up: Some Applications and Techniques -REMCONF: Remote Configuration of Embedded Systems -================================================= +3.3 REMCONF: Remote Configuration of Embedded Systems +===================================================== - Today, you often find powerful processors in embedded systems. +Today, you often find powerful processors in embedded systems. Dedicated network routers and controllers for all kinds of machinery are examples of embedded systems. Processors like the Intel 80x86 or the AMD Elan are able to run multitasking operating systems, such as @@ -2106,7 +2123,7 @@ up: * HTTP connections with HTML GUIs - In this node, we look at a solution that uses HTTP connections to +In this node, we look at a solution that uses HTTP connections to control variables of an embedded system that are stored in a file. Since embedded systems have tight limits on resources like memory, it is difficult to employ advanced techniques such as SNMP and HTTP @@ -2134,14 +2151,14 @@ mentioned there, all we have to do is to write two new procedures if (ConfigFile == "") ConfigFile = "config.asc" } - The function `SetUpServer' initializes the top level HTML texts as +The function `SetUpServer' initializes the top level HTML texts as usual. It also initializes the name of the file that contains the configuration parameters and their values. In case the user supplies a name from the command line, that name is used. The file is expected to contain one parameter per line, with the name of the parameter in column one and the value in column two. - The function `HandleGET' reflects the structure of the menu tree as +The function `HandleGET' reflects the structure of the menu tree as usual. The first menu choice tells the user what this is all about. The second choice reads the configuration file line by line and stores the parameters and their values. Notice that the record separator for this @@ -2192,7 +2209,7 @@ a file: } } - We could also view the configuration file as a database. From this +We could also view the configuration file as a database. From this point of view, the previous program acts like a primitive database server. Real SQL database systems also make a service available by providing a TCP port that clients can connect to. But the application @@ -2202,17 +2219,17 @@ time to time. This is also true for the protocol that MiniSQL uses.  File: gawkinet.info, Node: URLCHK, Next: WEBGRAB, Prev: REMCONF, Up: Some Applications and Techniques -URLCHK: Look for Changed Web Pages -================================== +3.4 URLCHK: Look for Changed Web Pages +====================================== - Most people who make heavy use of Internet resources have a large +Most people who make heavy use of Internet resources have a large bookmark file with pointers to interesting web sites. It is impossible to regularly check by hand if any of these sites have changed. A program is needed to automatically look at the headers of web pages and tell which ones have changed. URLCHK does the comparison after using GETURL with the `HEAD' method to retrieve the header. - Like GETURL, this program first checks that it is called with exactly +Like GETURL, this program first checks that it is called with exactly one command-line parameter. URLCHK also takes the same command-line variables `Proxy' and `ProxyPort' as GETURL, because these variables are handed over to GETURL for each URL that gets checked. The one and @@ -2229,8 +2246,8 @@ times. Now, we follow this plan: 4. If the most recent and the new length differ, tell the user - It may seem a bit peculiar to read the URLs from a file together -with their two most recent lengths, but this approach has several +It may seem a bit peculiar to read the URLs from a file together with +their two most recent lengths, but this approach has several advantages. You can call the program again and again with the same file. After running the program, you can regenerate the changed URLs by extracting those lines that differ in their second and third columns: @@ -2264,7 +2281,7 @@ extracting those lines that differ in their second and third columns: close(URLfile) } - Another thing that may look strange is the way GETURL is called. +Another thing that may look strange is the way GETURL is called. Before calling GETURL, we have to check if the proxy variables need to be passed on. If so, we prepare strings that will become part of the command line later. In `GetHeader', we store these strings together @@ -2274,7 +2291,7 @@ to form the command that reads the URL's header over the Internet. GETURL always produces the headers over `/dev/stderr'. That is the reason why we need the redirection operator to have the header piped in. - This program is not perfect because it assumes that changing URLs +This program is not perfect because it assumes that changing URLs results in changed lengths, which is not necessarily true. A more advanced approach is to look at some other header line that holds time information. But, as always when things get a bit more complicated, @@ -2283,13 +2300,13 @@ this is left as an exercise to the reader.  File: gawkinet.info, Node: WEBGRAB, Next: STATIST, Prev: URLCHK, Up: Some Applications and Techniques -WEBGRAB: Extract Links from a Page -================================== +3.5 WEBGRAB: Extract Links from a Page +====================================== - Sometimes it is necessary to extract links from web pages. Browsers -do it, web robots do it, and sometimes even humans do it. Since we -have a tool like GETURL at hand, we can solve this problem with some -help from the Bourne shell: +Sometimes it is necessary to extract links from web pages. Browsers do +it, web robots do it, and sometimes even humans do it. Since we have a +tool like GETURL at hand, we can solve this problem with some help from +the Bourne shell: BEGIN { RS = "http://[#%&\\+\\-\\./0-9\\:;\\?A-Z_a-z\\~]*" } RT != "" { @@ -2298,21 +2315,21 @@ help from the Bourne shell: print command } - Notice that the regular expression for URLs is rather crude. A -precise regular expression is much more complex. But this one works -rather well. One problem is that it is unable to find internal links of -an HTML document. Another problem is that `ftp', `telnet', `news', +Notice that the regular expression for URLs is rather crude. A precise +regular expression is much more complex. But this one works rather +well. One problem is that it is unable to find internal links of an +HTML document. Another problem is that `ftp', `telnet', `news', `mailto', and other kinds of links are missing in the regular expression. However, it is straightforward to add them, if doing so is necessary for other tasks. - This program reads an HTML file and prints all the HTTP links that -it finds. It relies on `gawk''s ability to use regular expressions as +This program reads an HTML file and prints all the HTTP links that it +finds. It relies on `gawk''s ability to use regular expressions as record separators. With `RS' set to a regular expression that matches links, the second action is executed each time a non-empty link is found. We can find the matching link itself in `RT'. - The action could use the `system' function to let another GETURL +The action could use the `system' function to let another GETURL retrieve the page, but here we use a different approach. This simple program prints shell commands that can be piped into `sh' for execution. This way it is possible to first extract the links, wrap @@ -2323,7 +2340,7 @@ retrieve all the pages like this: gawk -f geturl.awk http://www.suse.de | gawk -f webgrab.awk | sh - After this, you will find the contents of all referenced documents in +After this, you will find the contents of all referenced documents in files named `doc*.html' even if they do not contain HTML code. The most annoying thing is that we always have to pass the proxy to GETURL. If you do not like to see the headers of the web pages appear on the @@ -2333,13 +2350,13 @@ such as which web server the companies use. Now, it is clear how the clever marketing people use web robots to determine the market shares of Microsoft and Netscape in the web server market. - Port 80 of any web server is like a small hole in a repellent -firewall. After attaching a browser to port 80, we usually catch a -glimpse of the bright side of the server (its home page). With a tool -like GETURL at hand, we are able to discover some of the more concealed -or even "indecent" services (i.e., lacking conformity to standards of -quality). It can be exciting to see the fancy CGI scripts that lie -there, revealing the inner workings of the server, ready to be called: +Port 80 of any web server is like a small hole in a repellent firewall. +After attaching a browser to port 80, we usually catch a glimpse of the +bright side of the server (its home page). With a tool like GETURL at +hand, we are able to discover some of the more concealed or even +"indecent" services (i.e., lacking conformity to standards of quality). +It can be exciting to see the fancy CGI scripts that lie there, +revealing the inner workings of the server, ready to be called: * With a command such as: @@ -2365,25 +2382,25 @@ there, revealing the inner workings of the server, ready to be called: server's log file--possibly containing customer data--or even the file `/etc/passwd'. (We don't recommend this!) - *Caution:* Although this may sound funny or simply irrelevant, we -are talking about severe security holes. Try to explore your own system +*Caution:* Although this may sound funny or simply irrelevant, we are +talking about severe security holes. Try to explore your own system this way and make sure that none of the above reveals too much information about your system.  File: gawkinet.info, Node: STATIST, Next: MAZE, Prev: WEBGRAB, Up: Some Applications and Techniques -STATIST: Graphing a Statistical Distribution -============================================ +3.6 STATIST: Graphing a Statistical Distribution +================================================ - In the HTTP server examples we've shown thus far, we never present -an image to the browser and its user. Presenting images is one task. +In the HTTP server examples we've shown thus far, we never present an +image to the browser and its user. Presenting images is one task. Generating images that reflect some user input and presenting these dynamically generated images is another. In this node, we use GNUPlot for generating `.png', `.ps', or `.gif' files.(1) - The program we develop takes the statistical parameters of two -samples and computes the t-test statistics. As a result, we get the +The program we develop takes the statistical parameters of two samples +and computes the t-test statistics. As a result, we get the probabilities that the means and the variances of both samples are the same. In order to let the user check plausibility, the program presents an image of the distributions. The statistical computation follows @@ -2394,10 +2411,10 @@ the beta function, we use the `ibeta' function of GNUPlot. As a side effect, we learn how to use GNUPlot as a sophisticated calculator. The comparison of means is done as in `tutest', paragraph 14.2, page 613, and the comparison of variances is done as in `ftest', page 611 in -`Numerical Recipes'. +`Numerical Recipes'. - As usual, we take the site-independent code for servers and append -our own functions `SetUpServer' and `HandleGET': +As usual, we take the site-independent code for servers and append our +own functions `SetUpServer' and `HandleGET': function SetUpServer() { TopHeader = "Statistics with GAWK" @@ -2412,27 +2429,27 @@ our own functions `SetUpServer' and `HandleGET': m1=m2=0; v1=v2=1; n1=n2=10 } - Here, you see the menu structure that the user sees. Later, we will -see how the program structure of the `HandleGET' function reflects the -menu structure. What is missing here is the link for the image we -generate. In an event-driven environment, request, generation, and -delivery of images are separated. - - Notice the way we initialize the `GnuPlot' command string for the -pipe. By default, GNUPlot outputs the generated image via standard -output, as well as the results of `print'(ed) calculations via standard -error. The redirection causes standard error to be mixed into standard -output, enabling us to read results of calculations with `getline'. By +Here, you see the menu structure that the user sees. Later, we will see +how the program structure of the `HandleGET' function reflects the menu +structure. What is missing here is the link for the image we generate. +In an event-driven environment, request, generation, and delivery of +images are separated. + +Notice the way we initialize the `GnuPlot' command string for the pipe. +By default, GNUPlot outputs the generated image via standard output, as +well as the results of `print'(ed) calculations via standard error. +The redirection causes standard error to be mixed into standard output, +enabling us to read results of calculations with `getline'. By initializing the statistical parameters with some meaningful defaults, we make sure the user gets an image the first time he uses the program. - Following is the rather long function `HandleGET', which implements -the contents of this service by reacting to the different kinds of -requests from the browser. Before you start playing with this script, -make sure that your browser supports JavaScript and that it also has -this option switched on. The script uses a short snippet of JavaScript -code for delayed opening of a window with an image. A more detailed -explanation follows: +Following is the rather long function `HandleGET', which implements the +contents of this service by reacting to the different kinds of requests +from the browser. Before you start playing with this script, make sure +that your browser supports JavaScript and that it also has this option +switched on. The script uses a short snippet of JavaScript code for +delayed opening of a window with an image. A more detailed explanation +follows: function HandleGET() { if(MENU[2] == "AboutServer") { @@ -2508,27 +2525,27 @@ explanation follows: } } - As usual, we give a short description of the service in the first -menu choice. The third menu choice shows us that generation and -presentation of an image are two separate actions. While the latter -takes place quite instantly in the third menu choice, the former takes -place in the much longer second choice. Image data passes from the -generating action to the presenting action via the variable `Image' -that contains a complete `.png' image, which is otherwise stored in a -file. If you prefer `.ps' or `.gif' images over the default `.png' -images, you may select these options by uncommenting the appropriate -lines. But remember to do so in two places: when telling GNUPlot which -kind of images to generate, and when transmitting the image at the end -of the program. - - Looking at the end of the program, the way we pass the -`Content-type' to the browser is a bit unusual. It is appended to the -`OK' of the first header line to make sure the type information becomes -part of the header. The other variables that get transmitted across -the network are made empty, because in this case we do not have an HTML -document to transmit, but rather raw image data to contain in the body. - - Most of the work is done in the second menu choice. It starts with a +As usual, we give a short description of the service in the first menu +choice. The third menu choice shows us that generation and presentation +of an image are two separate actions. While the latter takes place +quite instantly in the third menu choice, the former takes place in the +much longer second choice. Image data passes from the generating action +to the presenting action via the variable `Image' that contains a +complete `.png' image, which is otherwise stored in a file. If you +prefer `.ps' or `.gif' images over the default `.png' images, you may +select these options by uncommenting the appropriate lines. But +remember to do so in two places: when telling GNUPlot which kind of +images to generate, and when transmitting the image at the end of the +program. + +Looking at the end of the program, the way we pass the `Content-type' +to the browser is a bit unusual. It is appended to the `OK' of the +first header line to make sure the type information becomes part of the +header. The other variables that get transmitted across the network are +made empty, because in this case we do not have an HTML document to +transmit, but rather raw image data to contain in the body. + +Most of the work is done in the second menu choice. It starts with a strange JavaScript code snippet. When first implementing this server, we used a short `""' here. But then browsers got smarter and tried to improve on speed by requesting the @@ -2542,9 +2559,9 @@ solved this problem by telling the browser to open a separate window for the image, but only after a delay of 1000 milliseconds. By this time, the server should be ready for serving the next request. - But there is one more subtlety in the JavaScript code. Each time -the JavaScript code opens a window for the image, the name of the image -is appended with a timestamp (`systime'). Why this constant change of +But there is one more subtlety in the JavaScript code. Each time the +JavaScript code opens a window for the image, the name of the image is +appended with a timestamp (`systime'). Why this constant change of name for the image? Initially, we always named the image `Image', but then the Netscape browser noticed the name had _not_ changed since the previous request and displayed the previous image (caching behavior). @@ -2554,7 +2571,7 @@ way to circumvent the cache of such overly smart browsers is to change the name of the image with each request. These three lines of JavaScript caused us a lot of trouble. - The rest can be broken down into two phases. At first, we check if +The rest can be broken down into two phases. At first, we check if there are statistical parameters. When the program is first started, there usually are no parameters because it enters the page coming from the top menu. Then, we only have to present the user a form that he @@ -2562,22 +2579,21 @@ can use to change statistical parameters and submit them. Subsequently, the submission of the form causes the execution of the first phase because _now_ there _are_ parameters to handle. - Now that we have parameters, we know there will be an image -available. Therefore we insert the JavaScript code here to initiate -the opening of the image in a separate window. Then, we prepare some -variables that will be passed to GNUPlot for calculation of the -probabilities. Prior to reading the results, we must temporarily change -`RS' because GNUPlot separates lines with newlines. After instructing -GNUPlot to generate a `.png' (or `.ps' or `.gif') image, we initiate -the insertion of some text, explaining the resulting probabilities. The -final `plot' command actually generates the image data. This raw binary -has to be read in carefully without adding, changing, or deleting a -single byte. Hence the unusual initialization of `Image' and completion -with a `while' loop. - - When using this server, it soon becomes clear that it is far from -being perfect. It mixes source code of six scripting languages or -protocols: +Now that we have parameters, we know there will be an image available. +Therefore we insert the JavaScript code here to initiate the opening of +the image in a separate window. Then, we prepare some variables that +will be passed to GNUPlot for calculation of the probabilities. Prior +to reading the results, we must temporarily change `RS' because GNUPlot +separates lines with newlines. After instructing GNUPlot to generate a +`.png' (or `.ps' or `.gif') image, we initiate the insertion of some +text, explaining the resulting probabilities. The final `plot' command +actually generates the image data. This raw binary has to be read in +carefully without adding, changing, or deleting a single byte. Hence +the unusual initialization of `Image' and completion with a `while' +loop. + +When using this server, it soon becomes clear that it is far from being +perfect. It mixes source code of six scripting languages or protocols: * GNU `awk' implements a server for the protocol: @@ -2591,17 +2607,17 @@ protocols: * GNUPlot to generate the image to be opened. - After all this work, the GNUPlot image opens in the JavaScript window +After all this work, the GNUPlot image opens in the JavaScript window where it can be viewed by the user. - It is probably better not to mix up so many different languages. -The result is not very readable. Furthermore, the statistical part of -the server does not take care of invalid input. Among others, using +It is probably better not to mix up so many different languages. The +result is not very readable. Furthermore, the statistical part of the +server does not take care of invalid input. Among others, using negative variances will cause invalid results. - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) Due to licensing problems, the default installation of GNUPlot +(1) Due to licensing problems, the default installation of GNUPlot disables the generation of `.gif' files. If your installed version does not accept `set term gif', just download and install the most recent version of GNUPlot and the GD library @@ -2612,26 +2628,26 @@ using `set term dumb'. (We tried it and it worked.)  File: gawkinet.info, Node: MAZE, Next: MOBAGWHO, Prev: STATIST, Up: Some Applications and Techniques -MAZE: Walking Through a Maze In Virtual Reality -=============================================== +3.7 MAZE: Walking Through a Maze In Virtual Reality +=================================================== In the long run, every program becomes rococo, and then rubble. Alan Perlis - By now, we know how to present arbitrary `Content-type's to a -browser. In this node, our server will present a 3D world to our -browser. The 3D world is described in a scene description language -(VRML, Virtual Reality Modeling Language) that allows us to travel -through a perspective view of a 2D maze with our browser. Browsers with -a VRML plugin enable exploration of this technology. We could do one of -those boring `Hello world' examples here, that are usually presented -when introducing novices to VRML. If you have never written any VRML -code, have a look at the VRML FAQ. Presenting a static VRML scene is a -bit trivial; in order to expose `gawk''s new capabilities, we will -present a dynamically generated VRML scene. The function `SetUpServer' -is very simple because it only sets the default HTML page and -initializes the random number generator. As usual, the surrounding -server lets you browse the maze. +By now, we know how to present arbitrary `Content-type's to a browser. +In this node, our server will present a 3D world to our browser. The +3D world is described in a scene description language (VRML, Virtual +Reality Modeling Language) that allows us to travel through a +perspective view of a 2D maze with our browser. Browsers with a VRML +plugin enable exploration of this technology. We could do one of those +boring `Hello world' examples here, that are usually presented when +introducing novices to VRML. If you have never written any VRML code, +have a look at the VRML FAQ. Presenting a static VRML scene is a bit +trivial; in order to expose `gawk''s new capabilities, we will present +a dynamically generated VRML scene. The function `SetUpServer' is very +simple because it only sets the default HTML page and initializes the +random number generator. As usual, the surrounding server lets you +browse the maze. function SetUpServer() { TopHeader = "Walk through a maze" @@ -2645,8 +2661,8 @@ server lets you browse the maze. srand() } - The function `HandleGET' is a bit longer because it first computes -the maze and afterwards generates the VRML code that is sent across the +The function `HandleGET' is a bit longer because it first computes the +maze and afterwards generates the VRML code that is sent across the network. As shown in the STATIST example (*note STATIST::), we set the type of the content to VRML and then store the VRML representation of the maze as the page content. We assume that the maze is stored in a 2D @@ -2702,24 +2718,24 @@ code for each wall field. } } - Finally, we have a look at `MakeMaze', the function that generates -the `Maze' array. When entered, this function assumes that the array -has been initialized so that each element represents a wall element and -the maze is initially full of wall elements. Only the entrance and the -exit of the maze should have been left free. The parameters of the -function tell us which element must be marked as not being a wall. -After this, we take a look at the four neighbouring elements and -remember which we have already treated. Of all the neighbouring -elements, we take one at random and walk in that direction. Therefore, -the wall element in that direction has to be removed and then, we call -the function recursively for that element. The maze is only completed -if we iterate the above procedure for _all_ neighbouring elements (in -random order) and for our present element by recursively calling the -function for the present element. This last iteration could have been -done in a loop, but it is done much simpler recursively. - - Notice that elements with coordinates that are both odd are assumed -to be on our way through the maze and the generating process cannot +Finally, we have a look at `MakeMaze', the function that generates the +`Maze' array. When entered, this function assumes that the array has +been initialized so that each element represents a wall element and the +maze is initially full of wall elements. Only the entrance and the exit +of the maze should have been left free. The parameters of the function +tell us which element must be marked as not being a wall. After this, +we take a look at the four neighbouring elements and remember which we +have already treated. Of all the neighbouring elements, we take one at +random and walk in that direction. Therefore, the wall element in that +direction has to be removed and then, we call the function recursively +for that element. The maze is only completed if we iterate the above +procedure for _all_ neighbouring elements (in random order) and for our +present element by recursively calling the function for the present +element. This last iteration could have been done in a loop, but it is +done much simpler recursively. + +Notice that elements with coordinates that are both odd are assumed to +be on our way through the maze and the generating process cannot terminate as long as there is such an element not being `delete'd. All other elements are potentially part of the wall. @@ -2744,8 +2760,8 @@ other elements are potentially part of the wall.  File: gawkinet.info, Node: MOBAGWHO, Next: STOXPRED, Prev: MAZE, Up: Some Applications and Techniques -MOBAGWHO: a Simple Mobile Agent -=============================== +3.8 MOBAGWHO: a Simple Mobile Agent +=================================== There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the @@ -2753,8 +2769,8 @@ MOBAGWHO: a Simple Mobile Agent deficiencies. C. A. R. Hoare - A "mobile agent" is a program that can be dispatched from a computer -and transported to a remote server for execution. This is called +A "mobile agent" is a program that can be dispatched from a computer and +transported to a remote server for execution. This is called "migration", which means that a process on another system is started that is independent from its originator. Ideally, it wanders through a network while working for its creator or owner. In places like the UMBC @@ -2765,10 +2781,10 @@ between users and the networking world. For an unbiased view at this technology, see the remarkable paper `Mobile Agents: Are they a good idea?'.(1) - When trying to migrate a process from one system to another, a -server process is needed on the receiving side. Depending on the kind -of server process, several ways of implementation come to mind. How -the process is implemented depends upon the kind of server process: +When trying to migrate a process from one system to another, a server +process is needed on the receiving side. Depending on the kind of +server process, several ways of implementation come to mind. How the +process is implemented depends upon the kind of server process: * HTTP can be used as the protocol for delivery of the migrating process. In this case, we use a common web server as the receiving @@ -2793,12 +2809,12 @@ the process is implemented depends upon the kind of server process: server process with a dedicated protocol specialized for receiving mobile agents. - Our agent example abuses a common web server as a migration tool. -So, it needs a universal CGI script on the receiving side (the web -server). The receiving script is activated with a `POST' request when -placed into a location like `/httpd/cgi-bin/PostAgent.sh'. Make sure -that the server system uses a version of `gawk' that supports network -access (Version 3.1 or later; verify with `gawk --version'). +Our agent example abuses a common web server as a migration tool. So, +it needs a universal CGI script on the receiving side (the web server). +The receiving script is activated with a `POST' request when placed +into a location like `/httpd/cgi-bin/PostAgent.sh'. Make sure that the +server system uses a version of `gawk' that supports network access +(Version 3.1 or later; verify with `gawk --version'). #!/bin/sh MobAg=/tmp/MobileAgent.$$ @@ -2810,7 +2826,7 @@ access (Version 3.1 or later; verify with `gawk --version'). gawk 'BEGIN { print "\r\nAgent started" }' rm $MobAg # delete script file of agent - By making its process id (`$$') part of the unique file name, the +By making its process id (`$$') part of the unique file name, the script avoids conflicts between concurrent instances of the script. First, all lines from standard input (the mobile agent's source code) are copied into this unique file. Then, the agent is started as a @@ -2839,17 +2855,17 @@ Independence way. By reporting `Agent started', it waves "Goodbye" to its origin. The originator may choose to terminate or not. - The originating agent itself is started just like any other -command-line script, and reports the results on standard output. By -letting the name of the original host migrate with the agent, the agent -that migrates to a host far away from its origin can report the result -back home. Having arrived at the end of the journey, the agent -establishes a connection and reports the results. This is the reason -for determining the name of the host with `uname -n' and storing it in -`MyOrigin' for later use. We may also set variables with the `-v' -option from the command line. This interactivity is only of importance -in the context of starting a mobile agent; therefore this `BEGIN' -pattern and its action do not take part in migration: +The originating agent itself is started just like any other command-line +script, and reports the results on standard output. By letting the name +of the original host migrate with the agent, the agent that migrates to +a host far away from its origin can report the result back home. +Having arrived at the end of the journey, the agent establishes a +connection and reports the results. This is the reason for determining +the name of the host with `uname -n' and storing it in `MyOrigin' for +later use. We may also set variables with the `-v' option from the +command line. This interactivity is only of importance in the context +of starting a mobile agent; therefore this `BEGIN' pattern and its +action do not take part in migration: BEGIN { if (ARGC != 2) { @@ -2867,7 +2883,7 @@ pattern and its action do not take part in migration: } } - Since `gawk' cannot manipulate and transmit parts of the program +Since `gawk' cannot manipulate and transmit parts of the program directly, the source code is read and stored in strings. Therefore, the program scans itself for the beginning and the ending of functions. Each line in between is appended to the code string until the end of @@ -2885,7 +2901,7 @@ guarantee that the order of the functions is preserved during migration: { FUNC = "" } #EndOfMySelf - The web server code in *Note A Web Service with Interaction: +The web server code in *Note A Web Service with Interaction: Interacting Service, was first developed as a site-independent core. Likewise, the `gawk'-based mobile agent starts with an agent-independent core, to which can be appended application-dependent @@ -2911,19 +2927,19 @@ needed for the mobile agent: close(HttpService) } - The `migrate' function prepares the aforementioned strings -containing the program code and transmits them to a server. A -consequence of this modular approach is that the `migrate' function -takes some parameters that aren't needed in this application, but that -will be in future ones. Its mandatory parameter `Destination' holds the -name (or IP address) of the server that the agent wants as a host for -its code. The optional parameter `MobCode' may contain some `gawk' code -that is inserted during migration in front of all other code. The -optional parameter `Label' may contain a string that tells the agent -what to do in program execution after arrival at its new home site. One -of the serious obstacles in implementing a framework for mobile agents -is that it does not suffice to migrate the code. It is also necessary -to migrate the state of execution of the agent. In contrast to `Agent +The `migrate' function prepares the aforementioned strings containing +the program code and transmits them to a server. A consequence of this +modular approach is that the `migrate' function takes some parameters +that aren't needed in this application, but that will be in future +ones. Its mandatory parameter `Destination' holds the name (or IP +address) of the server that the agent wants as a host for its code. The +optional parameter `MobCode' may contain some `gawk' code that is +inserted during migration in front of all other code. The optional +parameter `Label' may contain a string that tells the agent what to do +in program execution after arrival at its new home site. One of the +serious obstacles in implementing a framework for mobile agents is that +it does not suffice to migrate the code. It is also necessary to +migrate the state of execution of the agent. In contrast to `Agent Tcl', this program does not try to migrate the complete set of variables. The following conventions are used: @@ -2937,7 +2953,7 @@ variables. The following conventions are used: takes part in migration has to be an element of this array. `migrate' also takes care of this. - Now it's clear what happens to the `Label' parameter of the function +Now it's clear what happens to the `Label' parameter of the function `migrate'. It is copied into `MOBVAR["Label"]' and travels alongside the other data. Since travelling takes place via HTTP, records must be separated with `"\r\n"' in `RS' and `ORS' as usual. The code assembly @@ -2953,7 +2969,7 @@ for migration takes place in three steps: any reply over the network, it is read completely and echoed to standard output to avoid irritating the server. - The application-independent framework is now almost complete. What +The application-independent framework is now almost complete. What follows is the `END' pattern that is executed when the mobile agent has finished reading its own code. First, it checks whether it is already running on a remote host or not. In case initialization has not yet @@ -2968,10 +2984,10 @@ starts `MyJob': MyJob() # so we do our job } - All that's left to extend the framework into a complete application -is to write two application-specific functions: `MyInit' and `MyJob'. -Keep in mind that the former is executed once on the originating host, -while the latter is executed after each migration: +All that's left to extend the framework into a complete application is +to write two application-specific functions: `MyInit' and `MyJob'. Keep +in mind that the former is executed once on the originating host, while +the latter is executed after each migration: function MyInit() { MOBVAR["MyOrigin"] = MyOrigin @@ -2983,7 +2999,7 @@ while the latter is executed after each migration: close("/inet/tcp/8080/0/0") } - As mentioned earlier, this agent takes the name of its origin +As mentioned earlier, this agent takes the name of its origin (`MyOrigin') with it. Then, it takes the name of its first destination and goes there for further work. Notice that this name has the port number of the web server appended to the name of the server, because @@ -3008,10 +3024,10 @@ function runs on the remote host: } } - After migrating, the first thing to do in `MyJob' is to delete the -name of the current host from the list of hosts to visit. Now, it is -time to start the real work by appending the host's name to the result -string, and reading line by line who is logged in on this host. A very +After migrating, the first thing to do in `MyJob' is to delete the name +of the current host from the list of hosts to visit. Now, it is time to +start the real work by appending the host's name to the result string, +and reading line by line who is logged in on this host. A very annoying circumstance is the fact that the elements of `MOBVAR' cannot hold the newline character (`"\n"'). If they did, migration of this string did not work because the string didn't obey the syntax rule for @@ -3022,15 +3038,15 @@ the `SUBSEP's with a newline character in the resulting string, and report it to the originating host, whose name is stored in `MOBVAR["MyOrigin"]'. - ---------- Footnotes ---------- +---------- Footnotes ---------- - (1) `http://www.research.ibm.com/massive/mobag.ps' +(1) `http://www.research.ibm.com/massive/mobag.ps'  File: gawkinet.info, Node: STOXPRED, Next: PROTBASE, Prev: MOBAGWHO, Up: Some Applications and Techniques -STOXPRED: Stock Market Prediction As A Service -============================================== +3.9 STOXPRED: Stock Market Prediction As A Service +================================================== Far out in the uncharted backwaters of the unfashionable end of the Western Spiral arm of the Galaxy lies a small unregarded @@ -3049,7 +3065,7 @@ STOXPRED: Stock Market Prediction As A Service green pieces of paper that were unhappy. Douglas Adams, `The Hitch Hiker's Guide to the Galaxy' - Valuable services on the Internet are usually _not_ implemented as +Valuable services on the Internet are usually _not_ implemented as mobile agents. There are much simpler ways of implementing services. All Unix systems provide, for example, the `cron' service. Unix system users can write a list of tasks to be done each day, each week, twice a @@ -3060,23 +3076,23 @@ For example, to distribute a newsletter on a daily basis this way, use # run at 8 am on weekdays, distribute the newsletter 0 8 * * 1-5 $HOME/bin/daily.job >> $HOME/log/newsletter 2>&1 - The script first looks for interesting information on the Internet, +The script first looks for interesting information on the Internet, assembles it in a nice form and sends the results via email to the customers. - The following is an example of a primitive newsletter on stock -market prediction. It is a report which first tries to predict the -change of each share in the Dow Jones Industrial Index for the -particular day. Then it mentions some especially promising shares as -well as some shares which look remarkably bad on that day. The report -ends with the usual disclaimer which tells every child _not_ to try -this at home and hurt anybody. +The following is an example of a primitive newsletter on stock market +prediction. It is a report which first tries to predict the change of +each share in the Dow Jones Industrial Index for the particular day. +Then it mentions some especially promising shares as well as some +shares which look remarkably bad on that day. The report ends with the +usual disclaimer which tells every child _not_ to try this at home and +hurt anybody. Good morning Uncle Scrooge, - + This is your daily stock market report for Monday, October 16, 2000. Here are the predictions for today: - + AA neutral GE up JNJ down @@ -3093,19 +3109,19 @@ this at home and hurt anybody. XOM down EK down IP down - + The most promising shares for today are these: - + INTC http://biz.yahoo.com/n/i/intc.html - + The stock shares to avoid today are these: - + EK http://biz.yahoo.com/n/e/ek.html IP http://biz.yahoo.com/n/i/ip.html DD http://biz.yahoo.com/n/d/dd.html ... - The script as a whole is rather long. In order to ease the pain of +The script as a whole is rather long. In order to ease the pain of studying other people's source code, we have broken the script up into meaningful parts which are invoked one after the other. The basic structure of the script is as follows: @@ -3119,7 +3135,7 @@ structure of the script is as follows: SendMail() } - The earlier parts store data into variables and arrays which are +The earlier parts store data into variables and arrays which are subsequently used by later parts of the script. The `Init' function first checks if the script is invoked correctly (without any parameters). If not, it informs the user of the correct usage. What @@ -3127,10 +3143,10 @@ follows are preparations for the retrieval of the historical quote data. The names of the 30 stock shares are stored in an array `name' along with the current date in `day', `month', and `year'. - All users who are separated from the Internet by a firewall and have -to direct their Internet accesses to a proxy must supply the name of -the proxy to this script with the `-v Proxy=NAME' option. For most -users, the default proxy and port number should suffice. +All users who are separated from the Internet by a firewall and have to +direct their Internet accesses to a proxy must supply the name of the +proxy to this script with the `-v Proxy=NAME' option. For most users, +the default proxy and port number should suffice. function Init() { if (ARGC != 1) { @@ -3154,7 +3170,7 @@ users, the default proxy and port number should suffice. YahooData = "/inet/tcp/0/" Proxy "/" ProxyPort } - There are two really interesting parts in the script. One is the +There are two really interesting parts in the script. One is the function which reads the historical stock quotes from an Internet server. The other is the one that does the actual prediction. In the following function we see how the quotes are read from the Yahoo @@ -3166,7 +3182,7 @@ server. The data which comes from the server is in CSV format 6-Oct-00,23.8125,24.9375,21.5625,22,10701100 5-Oct-00,24.4375,24.625,23.125,23.50,5810300 - Lines contain values of the same time instant, whereas columns are +Lines contain values of the same time instant, whereas columns are separated by commas and contain the kind of data that is described in the header (first) line. At first, `gawk' is instructed to separate columns by commas (`FS = ","'). In the loop that follows, a connection @@ -3178,7 +3194,7 @@ ending date are chosen to be exactly the same, but one year apart in the past. All the action is initiated within the `printf' command which transmits the request for data to the Yahoo server. - In the inner loop, the server's data is first read and then scanned +In the inner loop, the server's data is first read and then scanned line by line. Only lines which have six columns and the name of a month in the first column contain relevant data. This data is stored in the two-dimensional array `quote'; one dimension being time, the other @@ -3207,9 +3223,9 @@ because we need them later. FS = " " } - Now that we _have_ the data, it can be checked once again to make -sure that no individual stock is missing or invalid, and that all the -stock quotes are aligned correctly. Furthermore, we renumber the time +Now that we _have_ the data, it can be checked once again to make sure +that no individual stock is missing or invalid, and that all the stock +quotes are aligned correctly. Furthermore, we renumber the time instances. The most recent day gets day number 1 and all other days get consecutive numbers. All quotes are rounded toward the nearest whole number in US Dollars. @@ -3230,16 +3246,16 @@ number in US Dollars. delete days } - Now we have arrived at the second really interesting part of the -whole affair. What we present here is a very primitive prediction -algorithm: _If a stock fell yesterday, assume it will also fall today; -if it rose yesterday, assume it will rise today_. (Feel free to -replace this algorithm with a smarter one.) If a stock changed in the -same direction on two consecutive days, this is an indication which -should be highlighted. Two-day advances are stored in `hot' and -two-day declines in `avoid'. +Now we have arrived at the second really interesting part of the whole +affair. What we present here is a very primitive prediction algorithm: +_If a stock fell yesterday, assume it will also fall today; if it rose +yesterday, assume it will rise today_. (Feel free to replace this +algorithm with a smarter one.) If a stock changed in the same direction +on two consecutive days, this is an indication which should be +highlighted. Two-day advances are stored in `hot' and two-day declines +in `avoid'. - The rest of the function is a sanity check. It counts the number of +The rest of the function is a sanity check. It counts the number of correct predictions in relation to the total number of predictions one could have made in the year before. @@ -3276,10 +3292,9 @@ could have made in the year before. } } - At this point the hard work has been done: the array `predict' -contains the predictions for all the ticker symbols. It is up to the -function `Report' to find some nice words to introduce the desired -information. +At this point the hard work has been done: the array `predict' contains +the predictions for all the ticker symbols. It is up to the function +`Report' to find some nice words to introduce the desired information. function Report() { # Generate report @@ -3315,10 +3330,10 @@ information. report = report "you should visit a doctor who can treat your ailment." } - The function `SendMail' goes through the list of customers and opens -a pipe to the `mail' command for each of them. Each one receives an -email message with a proper subject heading and is addressed with his -full name. +The function `SendMail' goes through the list of customers and opens a +pipe to the `mail' command for each of them. Each one receives an email +message with a proper subject heading and is addressed with his full +name. function SendMail() { # send report to customers @@ -3337,7 +3352,7 @@ full name. } } - Be patient when running the script by hand. Retrieving the data for +Be patient when running the script by hand. Retrieving the data for all the ticker symbols and sending the emails may take several minutes to complete, depending upon network traffic and the speed of the available Internet link. The quality of the prediction algorithm is @@ -3348,26 +3363,26 @@ is only for the sake of curiosity, of course. `:-)'  File: gawkinet.info, Node: PROTBASE, Prev: STOXPRED, Up: Some Applications and Techniques -PROTBASE: Searching Through A Protein Database -============================================== +3.10 PROTBASE: Searching Through A Protein Database +=================================================== Hoare's Law of Large Problems: Inside every large problem is a small problem struggling to get out. - Yahoo's database of stock market data is just one among the many -large databases on the Internet. Another one is located at NCBI -(National Center for Biotechnology Information). Established in 1988 as -a national resource for molecular biology information, NCBI creates +Yahoo's database of stock market data is just one among the many large +databases on the Internet. Another one is located at NCBI (National +Center for Biotechnology Information). Established in 1988 as a +national resource for molecular biology information, NCBI creates public databases, conducts research in computational biology, develops software tools for analyzing genome data, and disseminates biomedical information. In this section, we look at one of NCBI's public services, which is called BLAST (Basic Local Alignment Search Tool). - You probably know that the information necessary for reproducing -living cells is encoded in the genetic material of the cells. The -genetic material is a very long chain of four base nucleotides. It is -the order of appearance (the sequence) of nucleotides which contains -the information about the substance to be produced. Scientists in +You probably know that the information necessary for reproducing living +cells is encoded in the genetic material of the cells. The genetic +material is a very long chain of four base nucleotides. It is the order +of appearance (the sequence) of nucleotides which contains the +information about the substance to be produced. Scientists in biotechnology often find a specific fragment, determine the nucleotide sequence, and need to know where the sequence at hand comes from. This is where the large databases enter the game. At NCBI, databases store @@ -3406,14 +3421,14 @@ services: you can send a message consisting of the word "HELP" to the same address, . - Our starting point is the demonstration client mentioned in the -first option. The `README' file that comes along with the client -explains the whole process in a nutshell. In the rest of this section, -we first show what such requests look like. Then we show how to use -`gawk' to implement a client in about 10 lines of code. Finally, we -show how to interpret the result returned from the service. +Our starting point is the demonstration client mentioned in the first +option. The `README' file that comes along with the client explains +the whole process in a nutshell. In the rest of this section, we first +show what such requests look like. Then we show how to use `gawk' to +implement a client in about 10 lines of code. Finally, we show how to +interpret the result returned from the service. - Sequences are expected to be represented in the standard IUB/IUPAC +Sequences are expected to be represented in the standard IUB/IUPAC amino acid and nucleic acid codes, with these exceptions: lower-case letters are accepted and are mapped into upper-case; a single hyphen or dash can be used to represent a gap of indeterminate length; and in @@ -3433,7 +3448,7 @@ residue). The nucleic acid codes supported are: K --> G T (keto) N --> A G C T (any) - gap of indeterminate length - Now you know the alphabet of nucleotide sequences. The last two lines +Now you know the alphabet of nucleotide sequences. The last two lines of the following example query show you such a sequence, which is obviously made up only of elements of the alphabet just described. Store this example query into a file named `protbase.request'. You are @@ -3447,23 +3462,23 @@ now ready to send it to the server with the demonstration client. tgcttggctgaggagccataggacgagagcttcctggtgaagtgtgtttcttgaaatcat caccaccatggacagcaaa - The actual search request begins with the mandatory parameter -`PROGRAM' in the first column followed by the value `blastn' (the name -of the program) for searching nucleic acids. The next line contains -the mandatory search parameter `DATALIB' with the value `month' for the +The actual search request begins with the mandatory parameter `PROGRAM' +in the first column followed by the value `blastn' (the name of the +program) for searching nucleic acids. The next line contains the +mandatory search parameter `DATALIB' with the value `month' for the newest nucleic acid sequences. The third line contains an optional `EXPECT' parameter and the value desired for it. The fourth line contains the mandatory `BEGIN' directive, followed by the query sequence in FASTA/Pearson format. Each line of information must be less than 80 characters in length. - The "month" database contains all new or revised sequences released -in the last 30 days and is useful for searching against new sequences. +The "month" database contains all new or revised sequences released in +the last 30 days and is useful for searching against new sequences. There are five different blast programs, `blastn' being the one that compares a nucleotide query sequence against a nucleotide sequence database. - The last server directive that must appear in every request is the +The last server directive that must appear in every request is the `BEGIN' directive. The query sequence should immediately follow the `BEGIN' directive and must appear in FASTA/Pearson format. A sequence in FASTA/Pearson format begins with a single-line description. The @@ -3472,7 +3487,7 @@ sequence data that follow it by having a greater-than (`>') symbol in the first column. For the purposes of the BLAST server, the text of the description is arbitrary. - If you prefer to use a client written in `gawk', just store the +If you prefer to use a client written in `gawk', just store the following 10 lines of code into a file named `protbase.awk' and use this client instead. Invoke it with `gawk -f protbase.awk protbase.request'. Then wait a minute and watch the result coming in. @@ -3482,7 +3497,7 @@ have extended the client program in *Note Retrieving Web Pages: GETURL, to implement the client request from `protbase.awk' as a special case. { request = request "\n" $0 } - + END { BLASTService = "/inet/tcp/0/www.ncbi.nlm.nih.gov/80" printf "POST /cgi-bin/BLAST/nph-blast_report HTTP/1.0\n" |& BLASTService @@ -3493,23 +3508,23 @@ to implement the client request from `protbase.awk' as a special case. close(BLASTService) } - The demonstration client from NCBI is 214 lines long (written in C) -and it is not immediately obvious what it does. Our client is so short -that it _is_ obvious what it does. First it loops over all lines of the +The demonstration client from NCBI is 214 lines long (written in C) and +it is not immediately obvious what it does. Our client is so short that +it _is_ obvious what it does. First it loops over all lines of the query and stores the whole query into a variable. Then the script establishes an Internet connection to the NCBI server and transmits the query by framing it with a proper HTTP request. Finally it receives and prints the complete result coming from the server. - Now, let us look at the result. It begins with an HTTP header, which -you can ignore. Then there are some comments about the query having been +Now, let us look at the result. It begins with an HTTP header, which you +can ignore. Then there are some comments about the query having been filtered to avoid spuriously high scores. After this, there is a reference to the paper that describes the software being used for searching the data base. After a repitition of the original query's description we find the list of significant alignments: Sequences producing significant alignments: (bits) Value - + gb|AC021182.14|AC021182 Homo sapiens chromosome 7 clone RP11-733... 38 0.20 gb|AC021056.12|AC021056 Homo sapiens chromosome 3 clone RP11-115... 38 0.20 emb|AL160278.10|AL160278 Homo sapiens chromosome 9 clone RP11-57... 38 0.20 @@ -3518,11 +3533,11 @@ description we find the list of significant alignments: emb|AL138812.9|AL138812 Homo sapiens chromosome 11 clone RP1-276... 38 0.20 gb|AC073881.3|AC073881 Homo sapiens chromosome 15 clone CTD-2169... 38 0.20 - This means that the query sequence was found in seven human -chromosomes. But the value 0.20 (20%) means that the probability of an -accidental match is rather high (20%) in all cases and should be taken -into account. You may wonder what the first column means. It is a key -to the specific database in which this occurence was found. The unique +This means that the query sequence was found in seven human chromosomes. +But the value 0.20 (20%) means that the probability of an accidental +match is rather high (20%) in all cases and should be taken into +account. You may wonder what the first column means. It is a key to +the specific database in which this occurence was found. The unique sequence identifiers reported in the search results can be used as sequence retrieval keys via the NCBI server. The syntax of sequence header lines used by the NCBI BLAST server depends on the database from @@ -3542,35 +3557,35 @@ identifiers for the databases from which the sequences were derived. Patents pat|country|number GenInfo Backbone Id bbs|number - For example, an identifier might be `gb|AC021182.14|AC021182', where -the `gb' tag indicates that the identifier refers to a GenBank sequence, +For example, an identifier might be `gb|AC021182.14|AC021182', where the +`gb' tag indicates that the identifier refers to a GenBank sequence, `AC021182.14' is its GenBank ACCESSION, and `AC021182' is the GenBank LOCUS. The identifier contains no spaces, so that a space indicates the end of the identifier. - Let us continue in the result listing. Each of the seven alignments +Let us continue in the result listing. Each of the seven alignments mentioned above is subsequently described in detail. We will have a closer look at the first of them. >gb|AC021182.14|AC021182 Homo sapiens chromosome 7 clone RP11-733N23, WORKING DRAFT SEQUENCE, 4 unordered pieces Length = 176383 - + Score = 38.2 bits (19), Expect = 0.20 Identities = 19/19 (100%) Strand = Plus / Plus - + Query: 35 tggtgaagtgtgtttcttg 53 ||||||||||||||||||| Sbjct: 69786 tggtgaagtgtgtttcttg 69804 - This alignment was located on the human chromosome 7. The fragment -on which part of the query was found had a total length of 176383. Only -19 of the nucleotides matched and the matching sequence ran from -character 35 to 53 in the query sequence and from 69786 to 69804 in the -fragment on chromosome 7. If you are still reading at this point, you -are probably interested in finding out more about Computational Biology -and you might appreciate the following hints. +This alignment was located on the human chromosome 7. The fragment on +which part of the query was found had a total length of 176383. Only 19 +of the nucleotides matched and the matching sequence ran from character +35 to 53 in the query sequence and from 69786 to 69804 in the fragment +on chromosome 7. If you are still reading at this point, you are +probably interested in finding out more about Computational Biology and +you might appreciate the following hints. 1. There is a book called `Introduction to Computational Biology' by Michael S. Waterman, which is worth reading if you are seriously @@ -3594,11 +3609,11 @@ and you might appreciate the following hints.  File: gawkinet.info, Node: Links, Next: GNU Free Documentation License, Prev: Some Applications and Techniques, Up: Top -Related Links -************* +4 Related Links +*************** - This section lists the URLs for various items discussed in this -major node. They are presented in the order in which they appear. +This section lists the URLs for various items discussed in this major +node. They are presented in the order in which they appear. `Internet Programming with Python' `http://www.fsbassociates.com/books/python.htm' @@ -3727,7 +3742,7 @@ GNU Free Documentation License Version 1.2, November 2002 Copyright (C) 2000,2001,2002 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA - + Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -4121,7 +4136,7 @@ GNU Free Documentation License ADDENDUM: How to use this License for your documents ==================================================== - To use this License in a document you have written, include a copy of +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: @@ -4133,18 +4148,18 @@ notices just after the title page: A copy of the license is included in the section entitled ``GNU Free Documentation License''. - If you have Invariant Sections, Front-Cover Texts and Back-Cover -Texts, replace the "with...Texts." line with this: +If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, +replace the "with...Texts." line with this: with the Invariant Sections being LIST THEIR TITLES, with the Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST. - If you have Invariant Sections without Cover Texts, or some other +If you have Invariant Sections without Cover Texts, or some other combination of the three, merge those two alternatives to suit the situation. - If your document contains nontrivial examples of program code, we +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. @@ -4157,231 +4172,256 @@ Index * Menu: -* /inet/ files (gawk): Gawk Special Files. -* /inet/raw special files (gawk): File /inet/raw. -* /inet/tcp special files (gawk): File /inet/tcp. -* /inet/udp special files (gawk): File /inet/udp. -* advanced features, network connections: Troubleshooting. -* agent <1>: MOBAGWHO. -* agent: Challenges. -* AI: Challenges. -* apache <1>: MOBAGWHO. -* apache: WEBGRAB. -* Bioinformatics: PROTBASE. -* BLAST, Basic Local Alignment Search Tool: PROTBASE. -* blocking: Making Connections. -* Boutell, Thomas: STATIST. -* CGI (Common Gateway Interface): MOBAGWHO. +* /inet/ files (gawk): Gawk Special Files. (line 490) +* /inet/raw special files (gawk): File /inet/raw. (line 712) +* /inet/tcp special files (gawk): File /inet/tcp. (line 647) +* /inet/udp special files (gawk): File /inet/udp. (line 679) +* advanced features, network connections: Troubleshooting. (line 834) +* agent <1>: MOBAGWHO. (line 2766) +* agent: Challenges. (line 1887) +* AI: Challenges. (line 1887) +* apache <1>: MOBAGWHO. (line 2802) +* apache: WEBGRAB. (line 2372) +* Bioinformatics: PROTBASE. (line 3590) +* BLAST, Basic Local Alignment Search Tool: PROTBASE. (line 3369) +* blocking: Making Connections. (line 383) +* Boutell, Thomas: STATIST. (line 2396) +* CGI (Common Gateway Interface): MOBAGWHO. (line 2802) * CGI (Common Gateway Interface), dynamic web pages and: Web page. -* CGI (Common Gateway Interface), library: CGI Lib. -* clients: Making Connections. -* Clinton, Bill: Challenges. -* Common Gateway Interface, See CGI: Web page. -* Computational Biology: PROTBASE. -* contest: Challenges. -* cron utility: STOXPRED. -* CSV format: STOXPRED. -* dark corner, RAW protocol: File /inet/raw. -* Dow Jones Industrial Index: STOXPRED. -* ELIZA program: Simple Server. -* email: Email. -* FASTA/Pearson format: PROTBASE. + (line 1130) +* CGI (Common Gateway Interface), library: CGI Lib. (line 1418) +* clients: Making Connections. (line 369) +* Clinton, Bill: Challenges. (line 1870) +* Common Gateway Interface, See CGI: Web page. (line 1130) +* Computational Biology: PROTBASE. (line 3590) +* contest: Challenges. (line 1817) +* cron utility: STOXPRED. (line 3068) +* CSV format: STOXPRED. (line 3173) +* dark corner, RAW protocol: File /inet/raw. (line 719) +* Dow Jones Industrial Index: STOXPRED. (line 3089) +* ELIZA program: Simple Server. (line 1606) +* email: Email. (line 1045) +* FASTA/Pearson format: PROTBASE. (line 3465) * FDL (Free Documentation License): GNU Free Documentation License. -* filenames, for network access: Gawk Special Files. -* files, /inet/ (gawk): Gawk Special Files. -* files, /inet/raw (gawk): File /inet/raw. -* files, /inet/tcp (gawk): File /inet/tcp. -* files, /inet/udp (gawk): File /inet/udp. -* finger utility: Setting Up. + (line 3742) +* filenames, for network access: Gawk Special Files. (line 485) +* files, /inet/ (gawk): Gawk Special Files. (line 490) +* files, /inet/raw (gawk): File /inet/raw. (line 712) +* files, /inet/tcp (gawk): File /inet/tcp. (line 647) +* files, /inet/udp (gawk): File /inet/udp. (line 679) +* finger utility: Setting Up. (line 981) * Free Documentation License (FDL): GNU Free Documentation License. -* FTP (File Transfer Protocol): Basic Protocols. -* gawk, networking: Using Networking. -* gawk, networking, connections <1>: TCP Connecting. + (line 3742) +* FTP (File Transfer Protocol): Basic Protocols. (line 316) +* gawk, networking: Using Networking. (line 414) +* gawk, networking, connections <1>: TCP Connecting. (line 781) * gawk, networking, connections: Special File Fields. -* gawk, networking, filenames: Gawk Special Files. -* gawk, networking, See Also email: Email. -* gawk, networking, service, establishing: Setting Up. -* gawk, networking, troubleshooting: Caveats. + (line 549) +* gawk, networking, filenames: Gawk Special Files. (line 485) +* gawk, networking, See Also email: Email. (line 1040) +* gawk, networking, service, establishing: Setting Up. (line 965) +* gawk, networking, troubleshooting: Caveats. (line 1791) * gawk, web and, See web service: Interacting Service. -* getline command: TCP Connecting. -* GETURL program: GETURL. -* GIF image format <1>: STATIST. -* GIF image format: Web page. + (line 1214) +* getline command: TCP Connecting. (line 786) +* GETURL program: GETURL. (line 2050) +* GIF image format <1>: STATIST. (line 2396) +* GIF image format: Web page. (line 1130) * GNU Free Documentation License: GNU Free Documentation License. -* GNU/Linux <1>: REMCONF. -* GNU/Linux <2>: Interacting. -* GNU/Linux: Troubleshooting. -* GNUPlot utility <1>: STATIST. + (line 3742) +* GNU/Linux <1>: REMCONF. (line 2107) +* GNU/Linux <2>: Interacting. (line 931) +* GNU/Linux: Troubleshooting. (line 882) +* GNUPlot utility <1>: STATIST. (line 2396) * GNUPlot utility: Interacting Service. -* Hoare, C.A.R. <1>: PROTBASE. -* Hoare, C.A.R.: MOBAGWHO. + (line 1396) +* Hoare, C.A.R. <1>: PROTBASE. (line 3369) +* Hoare, C.A.R.: MOBAGWHO. (line 2766) * hostname field: Special File Fields. -* HTML (Hypertext Markup Language): Web page. -* HTTP (Hypertext Transfer Protocol) <1>: Web page. -* HTTP (Hypertext Transfer Protocol): Basic Protocols. + (line 529) +* HTML (Hypertext Markup Language): Web page. (line 1114) +* HTTP (Hypertext Transfer Protocol) <1>: Web page. (line 1090) +* HTTP (Hypertext Transfer Protocol): Basic Protocols. (line 316) * HTTP (Hypertext Transfer Protocol), record separators and: Web page. + (line 1114) * HTTP server, core logic: Interacting Service. -* Humphrys, Mark: Simple Server. -* Hypertext Markup Language (HTML): Web page. -* Hypertext Transfer Protocol, See HTTP: Web page. -* image format: STATIST. + (line 1214) +* Humphrys, Mark: Simple Server. (line 1774) +* Hypertext Markup Language (HTML): Web page. (line 1114) +* Hypertext Transfer Protocol, See HTTP: Web page. (line 1090) +* image format: STATIST. (line 2396) * images, in web pages: Interacting Service. -* images, retrieving over networks: Web page. + (line 1396) +* images, retrieving over networks: Web page. (line 1130) * input/output, two-way, See Also gawk, networking: Gawk Special Files. -* Internet, See networks: Interacting. -* JavaScript: STATIST. -* Linux <1>: REMCONF. -* Linux <2>: Interacting. -* Linux: Troubleshooting. -* Lisp: MOBAGWHO. -* localport field: Gawk Special Files. -* Loebner, Hugh: Challenges. -* Loui, Ronald: Challenges. -* MAZE: MAZE. -* Microsoft Windows: WEBGRAB. -* Microsoft Windows, networking: Troubleshooting. -* Microsoft Windows, networking, ports: Setting Up. -* MiniSQL: REMCONF. -* MOBAGWHO program: MOBAGWHO. + (line 475) +* Internet, See networks: Interacting. (line 952) +* JavaScript: STATIST. (line 2446) +* Linux <1>: REMCONF. (line 2107) +* Linux <2>: Interacting. (line 931) +* Linux: Troubleshooting. (line 882) +* Lisp: MOBAGWHO. (line 2858) +* localport field: Gawk Special Files. (line 490) +* Loebner, Hugh: Challenges. (line 1817) +* Loui, Ronald: Challenges. (line 1887) +* MAZE: MAZE. (line 2634) +* Microsoft Windows: WEBGRAB. (line 2343) +* Microsoft Windows, networking: Troubleshooting. (line 882) +* Microsoft Windows, networking, ports: Setting Up. (line 996) +* MiniSQL: REMCONF. (line 2212) +* MOBAGWHO program: MOBAGWHO. (line 2766) * NCBI, National Center for Biotechnology Information: PROTBASE. -* networks, gawk and: Using Networking. -* networks, gawk and, connections <1>: TCP Connecting. + (line 3369) +* networks, gawk and: Using Networking. (line 414) +* networks, gawk and, connections <1>: TCP Connecting. (line 781) * networks, gawk and, connections: Special File Fields. -* networks, gawk and, filenames: Gawk Special Files. -* networks, gawk and, See Also email: Email. -* networks, gawk and, service, establishing: Setting Up. -* networks, gawk and, troubleshooting: Caveats. -* networks, ports, reserved: Setting Up. + (line 549) +* networks, gawk and, filenames: Gawk Special Files. (line 485) +* networks, gawk and, See Also email: Email. (line 1040) +* networks, gawk and, service, establishing: Setting Up. (line 965) +* networks, gawk and, troubleshooting: Caveats. (line 1791) +* networks, ports, reserved: Setting Up. (line 996) * networks, ports, specifying: Special File Fields. -* networks, See Also web pages: PANIC. -* Numerical Recipes: STATIST. -* ORS variable, HTTP and: Web page. -* ORS variable, POP and: Email. -* PANIC program: PANIC. -* Perl: Using Networking. -* Perl, gawk networking and: Using Networking. -* Perlis, Alan: MAZE. -* pipes, networking and: TCP Connecting. -* PNG image format <1>: STATIST. -* PNG image format: Web page. -* POP (Post Office Protocol): Email. -* Post Office Protocol (POP): Email. -* PostScript: STATIST. -* PROLOG: Challenges. -* PROTBASE: PROTBASE. + (line 518) +* networks, See Also web pages: PANIC. (line 2008) +* Numerical Recipes: STATIST. (line 2414) +* ORS variable, HTTP and: Web page. (line 1114) +* ORS variable, POP and: Email. (line 1070) +* PANIC program: PANIC. (line 2008) +* Perl: Using Networking. (line 422) +* Perl, gawk networking and: Using Networking. (line 432) +* Perlis, Alan: MAZE. (line 2634) +* pipes, networking and: TCP Connecting. (line 805) +* PNG image format <1>: STATIST. (line 2396) +* PNG image format: Web page. (line 1130) +* POP (Post Office Protocol): Email. (line 1040) +* Post Office Protocol (POP): Email. (line 1040) +* PostScript: STATIST. (line 2528) +* PROLOG: Challenges. (line 1887) +* PROTBASE: PROTBASE. (line 3369) * protocol field: Special File Fields. -* PS image format: STATIST. -* Python: Using Networking. -* Python, gawk networking and: Using Networking. -* RAW protocol: File /inet/raw. -* record separators, HTTP and: Web page. -* record separators, POP and: Email. -* REMCONF program: REMCONF. -* remoteport field: Gawk Special Files. -* robot <1>: WEBGRAB. -* robot: Challenges. -* RS variable, HTTP and: Web page. -* RS variable, POP and: Email. -* servers <1>: Setting Up. -* servers: Making Connections. + (line 511) +* PS image format: STATIST. (line 2396) +* Python: Using Networking. (line 422) +* Python, gawk networking and: Using Networking. (line 432) +* RAW protocol: File /inet/raw. (line 712) +* record separators, HTTP and: Web page. (line 1114) +* record separators, POP and: Email. (line 1070) +* REMCONF program: REMCONF. (line 2107) +* remoteport field: Gawk Special Files. (line 490) +* robot <1>: WEBGRAB. (line 2306) +* robot: Challenges. (line 1896) +* RS variable, HTTP and: Web page. (line 1114) +* RS variable, POP and: Email. (line 1070) +* servers <1>: Setting Up. (line 981) +* servers: Making Connections. (line 362) * servers, as hosts: Special File Fields. + (line 529) * servers, HTTP: Interacting Service. -* servers, web: Simple Server. -* Simple Mail Transfer Protocol (SMTP): Email. -* SMTP (Simple Mail Transfer Protocol) <1>: Email. -* SMTP (Simple Mail Transfer Protocol): Basic Protocols. -* SPAK utility: File /inet/raw. -* STATIST program: STATIST. -* STOXPRED program: STOXPRED. -* synchronous communications: Making Connections. -* Tcl/Tk: Using Networking. + (line 1214) +* servers, web: Simple Server. (line 1601) +* Simple Mail Transfer Protocol (SMTP): Email. (line 1040) +* SMTP (Simple Mail Transfer Protocol) <1>: Email. (line 1040) +* SMTP (Simple Mail Transfer Protocol): Basic Protocols. (line 316) +* SPAK utility: File /inet/raw. (line 727) +* STATIST program: STATIST. (line 2396) +* STOXPRED program: STOXPRED. (line 3051) +* synchronous communications: Making Connections. (line 383) +* Tcl/Tk: Using Networking. (line 422) * Tcl/Tk, gawk and <1>: Some Applications and Techniques. -* Tcl/Tk, gawk and: Using Networking. -* TCP (Transmission Control Protocol) <1>: File /inet/tcp. -* TCP (Transmission Control Protocol): Using Networking. + (line 1977) +* Tcl/Tk, gawk and: Using Networking. (line 432) +* TCP (Transmission Control Protocol) <1>: File /inet/tcp. (line 647) +* TCP (Transmission Control Protocol): Using Networking. (line 437) * TCP (Transmission Control Protocol), connection, establishing: TCP Connecting. -* TCP (Transmission Control Protocol), UDP and: Interacting. + (line 781) +* TCP (Transmission Control Protocol), UDP and: Interacting. (line 952) * TCP/IP, protocols, selecting: Special File Fields. -* TCP/IP, sockets and: Gawk Special Files. -* Transmission Control Protocol, See TCP: Using Networking. -* troubleshooting, gawk, networks: Caveats. -* troubleshooting, networks, connections: Troubleshooting. -* troubleshooting, networks, timeouts: Caveats. -* UDP (User Datagram Protocol): File /inet/udp. -* UDP (User Datagram Protocol), TCP and: Interacting. -* Unix, network ports and: Setting Up. -* URLCHK program: URLCHK. -* User Datagram Protocol, See UDP: File /inet/udp. -* vertical bar (|), |& operator (I/O): TCP Connecting. -* VRML: MAZE. + (line 511) +* TCP/IP, sockets and: Gawk Special Files. (line 475) +* Transmission Control Protocol, See TCP: Using Networking. (line 437) +* troubleshooting, gawk, networks: Caveats. (line 1791) +* troubleshooting, networks, connections: Troubleshooting. (line 834) +* troubleshooting, networks, timeouts: Caveats. (line 1803) +* UDP (User Datagram Protocol): File /inet/udp. (line 679) +* UDP (User Datagram Protocol), TCP and: Interacting. (line 952) +* Unix, network ports and: Setting Up. (line 996) +* URLCHK program: URLCHK. (line 2225) +* User Datagram Protocol, See UDP: File /inet/udp. (line 679) +* vertical bar (|), |& operator (I/O): TCP Connecting. (line 800) +* VRML: MAZE. (line 2634) * web browsers, See web service: Interacting Service. -* web pages: Web page. + (line 1214) +* web pages: Web page. (line 1090) * web pages, images in: Interacting Service. -* web pages, retrieving: GETURL. -* web servers: Simple Server. -* web service <1>: PANIC. -* web service: Primitive Service. -* WEBGRAB program: WEBGRAB. -* Weizenbaum, Joseph: Simple Server. + (line 1396) +* web pages, retrieving: GETURL. (line 2050) +* web servers: Simple Server. (line 1601) +* web service <1>: PANIC. (line 2008) +* web service: Primitive Service. (line 1156) +* WEBGRAB program: WEBGRAB. (line 2306) +* Weizenbaum, Joseph: Simple Server. (line 1606) * XBM image format: Interacting Service. -* Yahoo! <1>: STOXPRED. -* Yahoo!: REMCONF. -* | (vertical bar), |& operator (I/O): TCP Connecting. + (line 1396) +* Yahoo! <1>: STOXPRED. (line 3051) +* Yahoo!: REMCONF. (line 2107) +* | (vertical bar), |& operator (I/O): TCP Connecting. (line 800)  Tag Table: -Node: Top2004 -Node: Preface5697 -Node: Introduction7075 -Node: Stream Communications8099 -Node: Datagram Communications9267 -Node: The TCP/IP Protocols10893 -Ref: The TCP/IP Protocols-Footnote-111572 -Node: Basic Protocols11729 -Node: Ports13037 -Node: Making Connections14433 -Ref: Making Connections-Footnote-117009 -Ref: Making Connections-Footnote-217056 -Node: Using Networking17237 -Node: Gawk Special Files19590 -Node: Special File Fields21589 -Node: Comparing Protocols26895 -Node: File /inet/tcp27475 -Node: File /inet/udp28488 -Node: File /inet/raw29596 -Ref: File /inet/raw-Footnote-132616 -Node: TCP Connecting32696 -Node: Troubleshooting35029 -Ref: Troubleshooting-Footnote-138080 -Node: Interacting38623 -Node: Setting Up41348 -Node: Email44837 -Node: Web page47158 -Ref: Web page-Footnote-149958 -Node: Primitive Service50155 -Node: Interacting Service52884 -Ref: Interacting Service-Footnote-162008 -Node: CGI Lib62040 -Node: Simple Server69029 -Ref: Simple Server-Footnote-176762 -Node: Caveats76863 -Node: Challenges78000 -Node: Some Applications and Techniques86659 -Node: PANIC89115 -Node: GETURL90828 -Node: REMCONF93446 -Node: URLCHK98917 -Node: WEBGRAB102747 -Node: STATIST107192 -Ref: STATIST-Footnote-1118893 -Node: MAZE119338 -Node: MOBAGWHO125518 -Ref: MOBAGWHO-Footnote-1139454 -Node: STOXPRED139509 -Node: PROTBASE153784 -Node: Links166875 -Node: GNU Free Documentation License170308 -Node: Index192713 +Node: Top2000 +Node: Preface5688 +Node: Introduction7063 +Node: Stream Communications8088 +Node: Datagram Communications9261 +Node: The TCP/IP Protocols10892 +Ref: The TCP/IP Protocols-Footnote-111576 +Node: Basic Protocols11733 +Node: Ports13055 +Node: Making Connections14460 +Ref: Making Connections-Footnote-117027 +Ref: Making Connections-Footnote-217074 +Node: Using Networking17255 +Node: Gawk Special Files19609 +Node: Special File Fields21609 +Ref: table-inet-components25353 +Node: Comparing Protocols28235 +Node: File /inet/tcp28824 +Node: File /inet/udp29844 +Node: File /inet/raw30959 +Ref: File /inet/raw-Footnote-133974 +Node: TCP Connecting34051 +Node: Troubleshooting36380 +Ref: Troubleshooting-Footnote-139424 +Node: Interacting39964 +Node: Setting Up42684 +Node: Email46166 +Node: Web page48485 +Ref: Web page-Footnote-151272 +Node: Primitive Service51466 +Node: Interacting Service54194 +Ref: Interacting Service-Footnote-163291 +Node: CGI Lib63320 +Node: Simple Server70269 +Ref: Simple Server-Footnote-177975 +Node: Caveats78073 +Node: Challenges79213 +Node: Some Applications and Techniques87874 +Node: PANIC90322 +Node: GETURL92034 +Node: REMCONF94650 +Node: URLCHK100114 +Node: WEBGRAB103937 +Node: STATIST108367 +Ref: STATIST-Footnote-1120029 +Node: MAZE120471 +Node: MOBAGWHO126646 +Ref: MOBAGWHO-Footnote-1140547 +Node: STOXPRED140599 +Node: PROTBASE154809 +Node: Links167844 +Node: GNU Free Documentation License171278 +Node: Index193666  End Tag Table diff --git a/doc/gawkinet.texi b/doc/gawkinet.texi index f75d338b1..27cf60504 100644 --- a/doc/gawkinet.texi +++ b/doc/gawkinet.texi @@ -62,17 +62,17 @@ @set TITLE TCP/IP Internetworking With @command{gawk} @set EDITION 1.1 -@set UPDATE-MONTH April, 2002 +@set UPDATE-MONTH January, 2004 @c gawk versions: @set VERSION 3.1 -@set PATCHLEVEL 1 +@set PATCHLEVEL 4 @copying This is Edition @value{EDITION} of @cite{@value{TITLE}}, for the @value{VERSION}.@value{PATCHLEVEL} (or later) version of the GNU implementation of AWK. @sp 2 -Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. +Copyright (C) 2000, 2001, 2002, 2004 Free Software Foundation, Inc. @sp 2 Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or @@ -706,7 +706,7 @@ if ((name of remote host given) && (other side accepts connection)) @{ @end smallexample The exact behavior of this algorithm depends on the values of the -fields of the special @value{FN}. When in doubt, the following table +fields of the special @value{FN}. When in doubt, @ref{table-inet-components} gives you the combinations of values and their meaning. If this table is too complicated, focus on the three lines printed in @strong{bold}. All the examples in @@ -714,8 +714,10 @@ table is too complicated, focus on the three lines printed in use only the patterns printed in bold letters. -@multitable {12345678901234} {123456} {123456} {1234567} {1234567890123456789012345} -@item @sc{protocol} @tab @sc{local port} @tab @sc{host name} +@float Table,table-inet-components +@caption{/inet Special File Components} +@multitable @columnfractions .15 .15 .15 .15 .40 +@headitem @sc{protocol} @tab @sc{local port} @tab @sc{host name} @tab @sc{remote port} @tab @sc{Resulting connection-level behavior} @item @strong{tcp} @tab @strong{0} @tab @strong{x} @tab @strong{x} @tab @strong{Dedicated client, fails if immediately connecting to a @@ -736,6 +738,7 @@ patterns printed in bold letters. @item raw @tab 0 @tab x @tab x @tab Invalid @item raw @tab x @tab x @tab x @tab Invalid @end multitable +@end float In general, TCP is the preferred mechanism to use. It is the simplest protocol to understand and to use. Use the others only if circumstances diff --git a/doc/no.colors b/doc/no.colors index d5fb03807..b4fa397c5 100644 --- a/doc/no.colors +++ b/doc/no.colors @@ -1,4 +1,4 @@ -.\" AWK Reference Card --- Arnold Robbins, arnold@gnu.org +.\" AWK Reference Card --- Arnold Robbins, arnold@skeeve.com .\" This file is for troff which does not know what to do .\" with literal Poscript and cannot use the macros from 'colors'. .\" diff --git a/doc/texinfo.tex b/doc/texinfo.tex index e9293f3b9..9fd4df16d 100644 --- a/doc/texinfo.tex +++ b/doc/texinfo.tex @@ -3,10 +3,11 @@ % Load plain if necessary, i.e., if running under initex. \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi % -\def\texinfoversion{2003-05-04.08} +\def\texinfoversion{2004-06-14.14} % % Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, -% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 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 @@ -23,21 +24,16 @@ % to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, % Boston, MA 02111-1307, USA. % -% In other words, you are welcome to use, share and improve this program. -% You are forbidden to forbid anyone else to use, share and improve -% what you give them. Help stamp out software-hoarding! +% 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: -% ftp://ftp.gnu.org/gnu/texinfo/texinfo.tex -% (and all GNU mirrors, see http://www.gnu.org/order/ftp.html) +% 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), -% and /home/gd/gnu/doc/texinfo.tex on the GNU machines. -% -% The GNU Texinfo home page is http://www.gnu.org/software/texinfo. -% -% The texinfo.tex in any given Texinfo distribution could well be out +% (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 @@ -59,6 +55,9 @@ % 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]:} @@ -85,10 +84,13 @@ \let\ptexend=\end \let\ptexequiv=\equiv \let\ptexexclam=\! +\let\ptexfootnote=\footnote \let\ptexgtr=> \let\ptexhat=^ \let\ptexi=\i \let\ptexindent=\indent +\let\ptexnoindent=\noindent +\let\ptexinsert=\insert \let\ptexlbrace=\{ \let\ptexless=< \let\ptexplus=+ @@ -101,6 +103,15 @@ % 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 @@ -139,43 +150,81 @@ \ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi \ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi \ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi -\ifx\putwordDeftypevar\undefined\gdef\putwordDeftypevar{Variable}\fi \ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi -\ifx\putwordDeftypefun\undefined\gdef\putwordDeftypefun{Function}\fi % In some macros, we cannot use the `\? notation---the left quote is % in some cases the escape char. \chardef\colonChar = `\: \chardef\commaChar = `\, \chardef\dotChar = `\. -\chardef\equalChar = `\= \chardef\exclamChar= `\! \chardef\questChar = `\? \chardef\semiChar = `\; -\chardef\spaceChar = `\ % \chardef\underChar = `\_ +\chardef\spaceChar = `\ % +\chardef\spacecat = 10 +\def\spaceisspace{\catcode\spaceChar=\spacecat} + % Ignore a token. % \def\gobble#1{} -% True if #1 is the empty string, i.e., called like `\ifempty{}'. -% -\def\ifempty#1{\ifemptyx #1\emptymarkA\emptymarkB}% -\def\ifemptyx#1#2\emptymarkB{\ifx #1\emptymarkA}% +% The following is used inside several \edef's. +\def\makecsname#1{\expandafter\noexpand\csname#1\endcsname} % Hyphenation fixes. -\hyphenation{ap-pen-dix} -\hyphenation{eshell} -\hyphenation{mini-buf-fer mini-buf-fers} -\hyphenation{time-stamp} -\hyphenation{white-space} +\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 @@ -200,7 +249,7 @@ \tracingassigns1 \fi \tracingcommands3 % 3 gives us more in etex - \errorcontextlines\maxdimen + \errorcontextlines16 }% % add check for \lastpenalty to plain's definitions. If the last thing @@ -258,7 +307,7 @@ % the page break happens to be in the middle of an example. \shipout\vbox{% % Do this early so pdf references go to the beginning of the page. - \ifpdfmakepagedest \pdfmkdest{\the\pageno} \fi + \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi % \ifcropmarks \vbox to \outervsize\bgroup \hsize = \outerhsize @@ -339,132 +388,162 @@ % the input line (except we remove a trailing comment). #1 should be a % macro which expects an ordinary undelimited TeX argument. % -\def\parsearg#1{% - \let\next = #1% +\def\parsearg{\parseargusing{}} +\def\parseargusing#1#2{% + \def\next{#2}% \begingroup \obeylines - \futurelet\temp\parseargx -} - -% If the next token is an obeyed space (from an @example environment or -% the like), remove it and recurse. Otherwise, we're done. -\def\parseargx{% - % \obeyedspace is defined far below, after the definition of \sepspaces. - \ifx\obeyedspace\temp - \expandafter\parseargdiscardspace - \else - \expandafter\parseargline - \fi + \spaceisspace + #1% + \parseargline\empty% Insert the \empty token, see \finishparsearg below. } -% Remove a single space (as the delimiter token to the macro call). -{\obeyspaces % - \gdef\parseargdiscardspace {\futurelet\temp\parseargx}} - {\obeylines % \gdef\parseargline#1^^M{% \endgroup % End of the group started in \parsearg. - % - % First remove any @c comment, then any @comment. - % Result of each macro is put in \toks0. - \argremovec #1\c\relax % - \expandafter\argremovecomment \the\toks0 \comment\relax % - % - % Call the caller's macro, saved as \next in \parsearg. - \expandafter\next\expandafter{\the\toks0}% + \argremovecomment #1\comment\ArgTerm% }% } -% Since all \c{,omment} does is throw away the argument, we can let TeX -% do that for us. The \relax here is matched by the \relax in the call -% in \parseargline; it could be more or less anything, its purpose is -% just to delimit the argument to the \c. -\def\argremovec#1\c#2\relax{\toks0 = {#1}} -\def\argremovecomment#1\comment#2\relax{\toks0 = {#1}} +% 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} -% \argremovec{,omment} might leave us with trailing spaces, though; e.g., +% 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 -% will have two active spaces as part of the argument with the -% `itemize'. Here we remove all active spaces from #1, and assign the -% result to \toks0. -% -% This loses if there are any *other* active characters besides spaces -% in the argument -- _ ^ +, for example -- since they get expanded. -% Fortunately, Texinfo does not define any such commands. (If it ever -% does, the catcode of the characters in questionwill have to be changed -% here.) But this means we cannot call \removeactivespaces as part of -% \argremovec{,omment}, since @c uses \parsearg, and thus the argument -% that \parsearg gets might well have any character at all in it. -% -\def\removeactivespaces#1{% - \begingroup - \ignoreactivespaces - \edef\temp{#1}% - \global\toks0 = \expandafter{\temp}% - \endgroup +% 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 + % We cannot use \next here, as it holds the macro to run; + % thus we reuse \temp. + \let\temp\finishparsearg + \else + \let\temp\argcheckspaces + \fi + % Put the space token in: + \temp#1 #3\ArgTerm } -% Change the active space to expand to nothing. +% 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 \next. +% (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. % -\begingroup +% But first, we have to remove the trailing space token. +% +\def\finishparsearg#1 \ArgTerm{\expandafter\next\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\ignoreactivespaces{\obeyspaces\let =\empty} -\endgroup + \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} -%% These are used to keep @begin/@end levels from running away -%% Call \inENV within environments (after a \begingroup) -\newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi} -\def\ENVcheck{% -\ifENV\errmessage{Still within an environment; press RETURN to continue} -\endgroup\fi} % This is not perfect, but it should reduce lossage +% 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.) -% @begin foo is the same as @foo, for now. -\newhelp\EMsimple{Press RETURN to continue.} -\outer\def\begin{\parsearg\beginxxx} +% At runtime, environments start with this: +\def\startenvironment#1{\begingroup\def\thisenv{#1}} +% initialize +\let\thisenv\empty -\def\beginxxx #1{% -\expandafter\ifx\csname #1\endcsname\relax -{\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else -\csname #1\endcsname\fi} +% ... 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}} -% @end foo executes the definition of \Efoo. -% -\def\end{\parsearg\endxxx} -\def\endxxx #1{% - \removeactivespaces{#1}% - \edef\endthing{\the\toks0}% - % - \expandafter\ifx\csname E\endthing\endcsname\relax - \expandafter\ifx\csname \endthing\endcsname\relax - % There's no \foo, i.e., no ``environment'' foo. - \errhelp = \EMsimple - \errmessage{Undefined command `@end \endthing'}% - \else - \unmatchedenderror\endthing - \fi +% Check whether we're in the right environment: +\def\checkenv#1{% + \def\temp{#1}% + \ifx\thisenv\temp \else - % Everything's ok; the right environment has been started. - \csname E\endthing\endcsname + \badenverr \fi } -% There is an environment #1, but it hasn't been started. Give an error. -% -\def\unmatchedenderror#1{% +% Evironment mismatch, #1 expected: +\def\badenverr{% \errhelp = \EMsimple - \errmessage{This `@end #1' doesn't have a matching `@#1'}% + \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 } -% Define the control sequence \E#1 to give an unmatched @end error. +% @end foo executes the definition of \Efoo. +% But first, it executes a specialized version of \checkenv % -\def\defineunmatchedend#1{% - \expandafter\def\csname E#1\endcsname{\unmatchedenderror{#1}}% +\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 @@ -496,6 +575,9 @@ !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 @@ -505,10 +587,12 @@ \let\ubaraccent = \b \let\udotaccent = \d -% Other special characters: @questiondown @exclamdown +% 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} @@ -521,6 +605,25 @@ \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=3000 } + +% @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 @@ -574,59 +677,14 @@ \newbox\groupbox \def\vfilllimit{0.7} % -\def\group{\begingroup - \ifnum\catcode13=\active \else +\envdef\group{% + \ifnum\catcode`\^^M=\active \else \errhelp = \groupinvalidhelp \errmessage{@group invalid in context where filling is enabled}% \fi - % - % The \vtop we start below 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. (See p.82 of - % the TeXbook.) Thus, space below is not quite equal to space - % above. But it's pretty close. - \def\Egroup{% - \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 - \copy\groupbox - \endgroup % End the \group. - }% + \startsavinginserts % \setbox\groupbox = \vtop\bgroup - % We have to put a strut on the last line in case the @group is in - % the midst of an example, rather than completely enclosing it. - % Otherwise, the interline space between the last line of the group - % and the first line afterwards is too small. But we can't put the - % strut in \Egroup, since there it would be on a line by itself. - % Hence this just inserts a strut at the beginning of each line. - \everypar = {\strut}% - % - % Since we have a strut on every line, we don't need any of TeX's - % normal interline spacing. - \offinterlineskip - % - % OK, but now we have to do something about blank - % lines in the input in @example-like environments, which normally - % just turn into \lisppar, which will insert no space now that we've - % turned off the interline space. Simplest is to make them be an - % empty paragraph. - \ifx\par\lisppar - \edef\par{\leavevmode \par}% - % - % Reset ^^M's definition to new definition of \par. - \obeylines - \fi - % % 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 @@ -636,6 +694,32 @@ \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 ...'. % @@ -648,10 +732,8 @@ \newdimen\mil \mil=0.001in -\def\need{\parsearg\needx} - % Old definition--didn't work. -%\def\needx #1{\par % +%\parseargdef\need{\par % %% This method tries to make TeX break the page naturally %% if the depth of the box does not fit. %{\baselineskip=0pt% @@ -659,7 +741,7 @@ %\prevdepth=-1000pt %}} -\def\needx#1{% +\parseargdef\need{% % Ensure vertical mode, so we don't make a big box in the middle of a % paragraph. \par @@ -698,35 +780,10 @@ \fi } -% @br forces paragraph break +% @br forces paragraph break (and is undocumented). \let\br = \par -% @dots{} output an ellipsis using the current font. -% We do .5em per period so that it has the same spacing in a typewriter -% font as three actual period characters. -% -\def\dots{% - \leavevmode - \hbox to 1.5em{% - \hskip 0pt plus 0.25fil minus 0.25fil - .\hss.\hss.% - \hskip 0pt plus 0.5fil minus 0.5fil - }% -} - -% @enddots{} is an end-of-sentence ellipsis. -% -\def\enddots{% - \leavevmode - \hbox to 2em{% - \hskip 0pt plus 0.25fil minus 0.25fil - .\hss.\hss.\hss.% - \hskip 0pt plus 0.5fil minus 0.5fil - }% - \spacefactor=3000 -} - % @page forces the start of a new page. % \def\page{\par\vfill\supereject} @@ -739,13 +796,11 @@ \newskip\exdentamount % This defn is used inside fill environments such as @defun. -\def\exdent{\parsearg\exdentyyy} -\def\exdentyyy #1{{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}} +\parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break} % This defn is used inside nofill environments such as @example. -\def\nofillexdent{\parsearg\nofillexdentyyy} -\def\nofillexdentyyy #1{{\advance \leftskip by -\exdentamount -\leftline{\hskip\leftskip{\rm#1}}}} +\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 @@ -797,8 +852,19 @@ } % @include file insert text of that file as input. -% Allow normal characters that we make active in the argument (a file name). -\def\include{\begingroup +% +\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 @@ -807,33 +873,50 @@ \catcode`<=\other \catcode`>=\other \catcode`+=\other - \parsearg\includezzz} -% Restore active chars for included file. -\def\includezzz#1{\endgroup\begingroup - % Read the included file in a group so nested @include's work. - \def\thisfile{#1}% - \let\value=\expandablevalue - \input\thisfile -\endgroup} + \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. % -\def\center{\parsearg\docenter} -\def\docenter#1{{% - \ifhmode \hfil\break \fi - \advance\hsize by -\leftskip - \advance\hsize by -\rightskip - \line{\hfil \ignorespaces#1\unskip \hfil}% - \ifhmode \break \fi -}} +\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 -\def\sp{\parsearg\spxxx} -\def\spxxx #1{\vskip #1\baselineskip} +\parseargdef\sp{\vskip #1\baselineskip} % @comment ...line which is ignored... % @c is the same as @comment @@ -854,8 +937,7 @@ \def\asisword{asis} % no translation, these are keywords \def\noneword{none} % -\def\paragraphindent{\parsearg\doparagraphindent} -\def\doparagraphindent#1{% +\parseargdef\paragraphindent{% \def\temp{#1}% \ifx\temp\asisword \else @@ -872,8 +954,7 @@ % 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. -\def\exampleindent{\parsearg\doexampleindent} -\def\doexampleindent#1{% +\parseargdef\exampleindent{% \def\temp{#1}% \ifx\temp\asisword \else @@ -887,21 +968,18 @@ % @firstparagraphindent WORD % If WORD is `none', then suppress indentation of the first paragraph -% after a section heading. If WORD is `insert', then do indentat such +% 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. +% \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} -\newdimen\currentparindent -% \def\insertword{insert} % -\def\firstparagraphindent{\parsearg\dofirstparagraphindent} -\def\dofirstparagraphindent#1{% +\parseargdef\firstparagraphindent{% \def\temp{#1}% \ifx\temp\noneword \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent @@ -921,15 +999,24 @@ % \gdef\dosuppressfirstparagraphindent{% \gdef\indent{% - \global\let\indent=\ptexindent - \global\everypar = {}% + \restorefirstparagraphindent + \indent + }% + \gdef\noindent{% + \restorefirstparagraphindent + \noindent }% \global\everypar = {% - \kern-\parindent - \global\let\indent=\ptexindent - \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. @@ -937,23 +1024,18 @@ \def\asis#1{#1} % @math outputs its argument in math mode. -% We don't use $'s directly in the definition of \math because we need -% to set catcodes according to plain TeX first, to allow for subscripts, -% superscripts, special math chars, etc. -% -\let\implicitmath = $%$ font-lock fix % % One complication: _ usually means subscripts, but it could also mean % an actual _ character, as in @math{@var{some_variable} + 1}. So make -% _ within @math be active (mathcode "8000), and distinguish by seeing -% if the current family is \slfam, which is what @var uses. -% -{\catcode\underChar = \active -\gdef\mathunderscore{% - \catcode\underChar=\active - \def_{\ifnum\fam=\slfam \_\else\sb\fi}% -}} -% +% _ active, and distinguish by seeing if the current family is \slfam, +% which is what @var uses. +{ + \catcode\underChar = \active + \gdef\mathunderscore{% + \catcode\underChar=\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 @@ -964,15 +1046,16 @@ % \def\math{% \tex - \mathcode`\_="8000 \mathunderscore + \mathunderscore \let\\ = \mathbackslash \mathactive - \implicitmath\finishmath} -\def\finishmath#1{#1\implicitmath\Etex} + $\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 set the catcodes (such as @item or @section). +% 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 @@ -988,8 +1071,33 @@ } % @bullet and @minus need the same treatment as @math, just above. -\def\bullet{\implicitmath\ptexbullet\implicitmath} -\def\minus{\implicitmath-\implicitmath} +\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 a typewriter +% font as three actual period characters. +% +\def\dots{% + \leavevmode + \hbox to 1.5em{% + \hskip 0pt plus 0.25fil + .\hfil.\hfil.% + \hskip 0pt plus 0.5fil + }% +} + +% @enddots{} is an end-of-sentence ellipsis. +% +\def\enddots{% + \dots + \spacefactor=3000 +} + +% @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 @@ -1005,20 +1113,20 @@ % 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 - \readauxfile + \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 - \fixbackslash % Turn off hack to swallow `\input texinfo'. - \global\let\setfilename=\comment % Ignore extra @setfilename cmds. + \let\setfilename=\comment % Ignore extra @setfilename cmds. % % If texinfo.cnf is present on the system, read it. % Useful for site-wide @afourpaper, etc. - % Just to be on the safe side, close the input stream before the \input. \openin 1 texinfo.cnf - \ifeof1 \let\temp=\relax \else \def\temp{\input texinfo.cnf }\fi - \closein1 - \temp + \ifeof 1 \else \input texinfo.cnf \fi + \closein 1 % \comment % Ignore the actual filename. } @@ -1054,17 +1162,23 @@ \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 - \pdffalse - \let\pdfmkdest = \gobble - \let\pdfurl = \gobble - \let\endlink = \relax - \let\linkcolor = \relax - \let\pdfmakeoutlines = \relax \else - \pdftrue - \pdfoutput = 1 + \ifx\pdfoutput\relax + \else + \ifcase\pdfoutput + \else + \pdftrue + \fi + \fi +\fi +% +\ifpdf \input pdfcolor + \pdfcatalog{/PageMode /UseOutlines}% \def\dopdfimage#1#2#3{% \def\imagewidth{#2}% \def\imageheight{#3}% @@ -1085,7 +1199,13 @@ \ifnum\pdftexversion < 14 \else \pdfrefximage \pdflastximage \fi} - \def\pdfmkdest#1{{\normalturnoffactive \pdfdest name{#1} xyz}} + \def\pdfmkdest#1{{% + % We have to set dummies so commands such as @code in a section title + % aren't expanded. + \atdummies + \normalturnoffactive + \pdfdest name{#1} xyz% + }} \def\pdfmkpgn#1{#1} \let\linkcolor = \Blue % was Cyan, but that seems light? \def\endlink{\Black\pdfendlink} @@ -1094,48 +1214,94 @@ \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0% \else \csname#1\endcsname \fi} \def\advancenumber#1{\tempnum=\expnumber{#1}\relax - \advance\tempnum by1 + \advance\tempnum by 1 \expandafter\xdef\csname#1\endcsname{\the\tempnum}} - \def\pdfmakeoutlines{{% - \openin 1 \jobname.toc - \ifeof 1\else\begingroup - \closein 1 + % + % #1 is the section text. #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 worthwhile, since most documents are normally structured. + \def\pdfoutlinedest{#3}% + \ifx\pdfoutlinedest\empty \def\pdfoutlinedest{#4}\fi + % + \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{#1}% + } + % + \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 % - \def\chapentry ##1##2##3{} - \def\secentry ##1##2##3##4{\advancenumber{chap##2}} - \def\subsecentry ##1##2##3##4##5{\advancenumber{sec##2.##3}} - \def\subsubsecentry ##1##2##3##4##5##6{\advancenumber{subsec##2.##3.##4}} - \let\appendixentry = \chapentry - \let\unnumbchapentry = \chapentry - \let\unnumbsecentry = \secentry - \let\unnumbsubsecentry = \subsecentry - \let\unnumbsubsubsecentry = \subsubsecentry + % Read toc silently, to get counts of subentries for \pdfoutline. + \def\numchapentry##1##2##3##4{% + \def\thischapnum{##2}% + \let\thissecnum\empty + \let\thissubsecnum\empty + }% + \def\numsecentry##1##2##3##4{% + \advancenumber{chap\thischapnum}% + \def\thissecnum{##2}% + \let\thissubsecnum\empty + }% + \def\numsubsecentry##1##2##3##4{% + \advancenumber{sec\thissecnum}% + \def\thissubsecnum{##2}% + }% + \def\numsubsubsecentry##1##2##3##4{% + \advancenumber{subsec\thissubsecnum}% + }% + \let\thischapnum\empty + \let\thissecnum\empty + \let\thissubsecnum\empty + % + % 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}% \input \jobname.toc - \def\chapentry ##1##2##3{% - \pdfoutline goto name{\pdfmkpgn{##3}}count-\expnumber{chap##2}{##1}} - \def\secentry ##1##2##3##4{% - \pdfoutline goto name{\pdfmkpgn{##4}}count-\expnumber{sec##2.##3}{##1}} - \def\subsecentry ##1##2##3##4##5{% - \pdfoutline goto name{\pdfmkpgn{##5}}count-\expnumber{subsec##2.##3.##4}{##1}} - \def\subsubsecentry ##1##2##3##4##5##6{% - \pdfoutline goto name{\pdfmkpgn{##6}}{##1}} - \let\appendixentry = \chapentry - \let\unnumbchapentry = \chapentry - \let\unnumbsecentry = \secentry - \let\unnumbsubsecentry = \subsecentry - \let\unnumbsubsubsecentry = \subsubsecentry % - % Make special characters normal for writing to the pdf file. + % 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 - \let\tt=\relax \turnoffactive \input \jobname.toc - \endgroup\fi - }} + \endgroup + } + % \def\makelinks #1,{% \def\params{#1}\def\E{END}% \ifx\params\E @@ -1166,7 +1332,6 @@ \def\ppn#1{\pgn=#1\gobble} \def\ppnn{\pgn=\first} \def\pdfmklnk#1{\lnkcount=0\makelinks #1,END,} - \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} \def\skipspaces#1{\def\PP{#1}\def\D{|}% \ifx\PP\D\let\nextsp\relax \else\let\nextsp\skipspaces @@ -1184,18 +1349,17 @@ \def\pdfurl#1{% \begingroup \normalturnoffactive\def\@{@}% - \let\value=\expandablevalue + \makevalueexpandable \leavevmode\Red \startlink attr{/Border [0 0 0]}% user{/Subtype /Link /A << /S /URI /URI (#1) >>}% - % #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| + \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 @@ -1215,20 +1379,44 @@ \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}} \linkcolor #1\endlink} \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} -\fi % \ifx\pdfoutput +\else + \let\pdfmkdest = \gobble + \let\pdfurl = \gobble + \let\endlink = \relax + \let\linkcolor = \relax + \let\pdfmakeoutlines = \relax +\fi % \ifx\pdfoutput \message{fonts,} -% Font-change commands. + +% 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\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 analogous to plain's \rm, etc. +% So we set up a \sf. \newfam\sffam -\def\sf{\fam=\sffam \tensf} +\def\sf{\fam=\sffam \setfontstyle{sf}} \let\li = \sf % Sometimes we call it \li, not \sf. -% We don't need math for this one. -\def\ttsl{\tenttsl} +% We don't need math for this font style. +\def\ttsl{\setfontstyle{ttsl}} % Default leading. \newdimen\textleading \textleading = 13.2pt @@ -1279,6 +1467,7 @@ \def\scshape{csc} \def\scbshape{csc} +% Text fonts (11.2pt, magstep1). \newcount\mainmagstep \ifx\bigger\relax % not really supported. @@ -1290,10 +1479,6 @@ \setfont\textrm\rmshape{10}{\mainmagstep} \setfont\texttt\ttshape{10}{\mainmagstep} \fi -% Instead of cmb10, you may want to use cmbx10. -% cmbx10 is a prettier font on its own, but cmb10 -% looks better when embedded in a line with cmr10 -% (in Bob's opinion). \setfont\textbf\bfshape{10}{\mainmagstep} \setfont\textit\itshape{10}{\mainmagstep} \setfont\textsl\slshape{10}{\mainmagstep} @@ -1303,10 +1488,11 @@ \font\texti=cmmi10 scaled \mainmagstep \font\textsy=cmsy10 scaled \mainmagstep -% A few fonts for @defun, etc. -\setfont\defbf\bxshape{10}{\magstep1} %was 1314 +% A few fonts for @defun names and args. +\setfont\defbf\bfshape{10}{\magstep1} \setfont\deftt\ttshape{10}{\magstep1} -\def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf} +\setfont\defttsl\ttslshape{10}{\magstep1} +\def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf} % Fonts for indices, footnotes, small examples (9pt). \setfont\smallrm\rmshape{9}{1000} @@ -1332,7 +1518,7 @@ \font\smalleri=cmmi8 \font\smallersy=cmsy8 -% Fonts for title page: +% Fonts for title page (20.4pt): \setfont\titlerm\rmbshape{12}{\magstep3} \setfont\titleit\itbshape{10}{\magstep4} \setfont\titlesl\slbshape{10}{\magstep4} @@ -1378,11 +1564,21 @@ \setfont\ssecttsl\ttslshape{10}{1315} \setfont\ssecsf\sfbshape{12}{\magstephalf} \let\ssecbf\ssecrm -\setfont\ssecsc\scbshape{10}{\magstep1} +\setfont\ssecsc\scbshape{10}{1315} \font\sseci=cmmi12 scaled \magstephalf \font\ssecsy=cmsy10 scaled 1315 -% The smallcaps and symbol fonts should actually be scaled \magstep1.5, -% but that is not a standard magnification. + +% Reduced fonts for @acro in text (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 % In order for the font changes to affect most math symbols and letters, % we have to define the \textfont of the standard families. Since @@ -1397,50 +1593,72 @@ } % The font-changing commands redefine the meanings of \tenSTYLE, instead -% of just \STYLE. We do this so that font changes will continue to work -% in math mode, where it is the current \fam that is relevant in most -% cases, not the current font. Plain TeX does \def\bf{\fam=\bffam -% \tenbf}, for example. By redefining \tenbf, we obviate the need to -% redefine \bf itself. +% 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 + \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy + \let\tenttsl=\textttsl + \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\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\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 + \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy + \let\tenttsl=\secttsl + \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 + \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy + \let\tenttsl=\ssecttsl + \def\lsize{text}\def\lllsize{small}% \resetmathfonts \setleading{15pt}} -\let\subsubsecfonts = \subsecfonts % Maybe make sssec fonts scaled magstephalf? +\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\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\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\lsize{smaller}\def\lllsize{smaller}% \resetmathfonts \setleading{9.5pt}} % Set the fonts to use with the @small... environments. @@ -1449,7 +1667,7 @@ % 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 \smallerfonts (8pt), then we can fit this many characters: +% 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. @@ -1457,14 +1675,13 @@ % By the way, for comparison, here's what fits with @example (10pt): % 8.5x11=71 smallbook=60 a4=75 a5=58 % -% I wish we used A4 paper on this side of the Atlantic. -% +% I wish the USA used A4 paper. % --karl, 24jan03. % Set up the default fonts, so we can use them for creating boxes. % -\textfonts +\textfonts \rm % Define these so they can be easily changed for other fonts. \def\angleleft{$\langle$} @@ -1475,7 +1692,7 @@ % Fonts for short table of contents. \setfont\shortcontrm\rmshape{12}{1000} -\setfont\shortcontbf\bxshape{12}{1000} +\setfont\shortcontbf\bfshape{10}{\magstep1} % no cmb12 \setfont\shortcontsl\slshape{12}{1000} \setfont\shortconttt\ttshape{12}{1000} @@ -1489,11 +1706,18 @@ \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\var=\smartslanted \let\dfn=\smartslanted \let\emph=\smartitalic -\let\cite=\smartslanted \def\b#1{{\bf #1}} \let\strong=\b @@ -1520,7 +1744,6 @@ {\tt \rawbackslash \frenchspacing #1}% \null } -\let\ttfont=\t \def\samp#1{`\tclose{#1}'\null} \setfont\keyrm\rmshape{8}{1000} \font\keysy=cmsy9 @@ -1561,7 +1784,7 @@ \null } -% We *must* turn on hyphenation at `-' and `_' in \code. +% 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. @@ -1579,10 +1802,6 @@ \catcode`\_=\active \let_\codeunder \codex } - % - % If we end up with any active - characters when handling the index, - % just treat them as a normal -. - \global\def\indexbreaks{\catcode`\-=\active \let-\realdash} } \def\realdash{-} @@ -1606,8 +1825,7 @@ % @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). -\def\kbdinputstyle{\parsearg\kbdinputstylexxx} -\def\kbdinputstylexxx#1{% +\parseargdef\kbdinputstyle{% \def\arg{#1}% \ifx\arg\worddistinct \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}% @@ -1633,8 +1851,8 @@ \else{\tclose{\kbdfont\look}}\fi \else{\tclose{\kbdfont\look}}\fi} -% For @url, @env, @command quotes seem unnecessary, so use \code. -\let\url=\code +% For @indicateurl, @env, @command quotes seem unnecessary, so use \code. +\let\indicateurl=\code \let\env=\code \let\command=\code @@ -1666,6 +1884,10 @@ \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. % @@ -1707,22 +1929,37 @@ \def\sc#1{{\smallcaps#1}} % smallcaps font \def\ii#1{{\it #1}} % italic font -% @acronym downcases the argument and prints in smallcaps. -\def\acronym#1{{\smallcaps \lowercase{#1}}} +\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 +} -% @pounds{} is a sterling sign. +% @pounds{} is a sterling sign, which is in the CM italic font. +% \def\pounds{{\it\$}} -% @registeredsymbol - R in a circle. For now, only works in text size; -% we'd have to redo the font mechanism to change the \scriptstyle and -% \scriptscriptstyle font sizes to make it look right in headings. +% @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{$\scriptstyle\rm R$}\hfil\crcr\Orb}}% + $^{{\ooalign{\hfil\raise.07ex\hbox{\selectfonts\lllsize R}% + \hfil\crcr\Orb}}% }$% } +% 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,} @@ -1741,87 +1978,103 @@ \newif\ifsetshortcontentsaftertitlepage \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue -\def\shorttitlepage{\parsearg\shorttitlepagezzz} -\def\shorttitlepagezzz #1{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}% +\parseargdef\shorttitlepage{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}% \endgroup\page\hbox{}\page} -\def\titlepage{\begingroup \parindent=0pt \textfonts - \let\subtitlerm=\tenrm - \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}% - % - \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines - \let\tt=\authortt}% - % - % Leave some space at the very top of the page. - \vglue\titlepagetopglue - % - % Now you can print the title using @title. - \def\title{\parsearg\titlezzz}% - \def\titlezzz##1{\leftline{\titlefonts\rm ##1} - % print a rule at the page bottom also. - \finishedtitlepagefalse - \vskip4pt \hrule height 4pt width \hsize \vskip4pt}% - % No rule at page bottom unless we print one at the top with @title. - \finishedtitlepagetrue - % - % Now you can put text using @subtitle. - \def\subtitle{\parsearg\subtitlezzz}% - \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}% - % - % @author should come last, but may come many times. - \def\author{\parsearg\authorzzz}% - \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi - {\authorfont \leftline{##1}}}% - % - % 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{% +\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 + \finishtitlepage \fi - \oldpage \let\page = \oldpage - \hbox{}}% -% \def\page{\oldpage \hbox{}} + \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 + \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 + \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 @@ -1831,7 +2084,7 @@ \newtoks\evenfootline % footline on even pages \newtoks\oddfootline % footline on odd pages -% Now make Tex use those variables +% Now make TeX use those variables \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline \else \the\evenheadline \fi}} \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline @@ -1845,32 +2098,27 @@ % @evenfooting @thisfile|| % @oddfooting ||@thisfile -\def\evenheading{\parsearg\evenheadingxxx} -\def\oddheading{\parsearg\oddheadingxxx} -\def\everyheading{\parsearg\everyheadingxxx} - -\def\evenfooting{\parsearg\evenfootingxxx} -\def\oddfooting{\parsearg\oddfootingxxx} -\def\everyfooting{\parsearg\everyfootingxxx} - -{\catcode`\@=0 % -\gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish} -\gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{% +\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}}} -\gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish} -\gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{% +\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}}} -\gdef\everyheadingxxx#1{\oddheadingxxx{#1}\evenheadingxxx{#1}}% +\parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}% -\gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish} -\gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{% +\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}}} -\gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish} -\gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{% +\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 @@ -1879,9 +2127,8 @@ \global\advance\vsize by -\baselineskip } -\gdef\everyfootingxxx#1{\oddfootingxxx{#1}\evenfootingxxx{#1}} -% -}% unbind the catcode of @. +\parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}} + % @headings double turns headings on for double-sided printing. % @headings single turns headings on for single-sided printing. @@ -1895,7 +2142,7 @@ \def\headings #1 {\csname HEADINGS#1\endcsname} -\def\HEADINGSoff{ +\def\HEADINGSoff{% \global\evenheadline={\hfil} \global\evenfootline={\hfil} \global\oddheadline={\hfil} \global\oddfootline={\hfil}} \HEADINGSoff @@ -1904,7 +2151,7 @@ % 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{ +\def\HEADINGSdouble{% \global\pageno=1 \global\evenfootline={\hfil} \global\oddfootline={\hfil} @@ -1916,7 +2163,7 @@ % For single-sided printing, chapter title goes across top left of page, % page number on top right. -\def\HEADINGSsingle{ +\def\HEADINGSsingle{% \global\pageno=1 \global\evenfootline={\hfil} \global\oddfootline={\hfil} @@ -1963,12 +2210,11 @@ % @settitle line... specifies the title of the document, for headings. % It generates no output of its own. \def\thistitle{\putwordNoTitle} -\def\settitle{\parsearg\settitlezzz} -\def\settitlezzz #1{\gdef\thistitle{#1}} +\def\settitle{\parsearg{\gdef\thistitle}} \message{tables,} -% Tables -- @table, @ftable, @vtable, @item(x), @kitem(x), @xitem(x). +% Tables -- @table, @ftable, @vtable, @item(x). % default indentation of table text \newdimen\tableindent \tableindent=.8in @@ -1980,7 +2226,7 @@ % used internally for \itemindent minus \itemmargin \newdimen\itemmax -% Note @table, @vtable, and @vtable define @item, @itemx, etc., with +% 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). @@ -1992,22 +2238,10 @@ \def\internalBitem{\smallbreak \parsearg\itemzzz} \def\internalBitemx{\itemxpar \parsearg\itemzzz} -\def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz} -\def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \itemxpar \parsearg\xitemzzz} - -\def\internalBkitem{\smallbreak \parsearg\kitemzzz} -\def\internalBkitemx{\itemxpar \parsearg\kitemzzz} - -\def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}% - \itemzzz {#1}} - -\def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}% - \itemzzz {#1}} - \def\itemzzz #1{\begingroup % \advance\hsize by -\rightskip \advance\hsize by -\tableindent - \setbox0=\hbox{\itemfont{#1}}% + \setbox0=\hbox{\itemindicate{#1}}% \itemindex{#1}% \nobreak % This prevents a break before @itemx. % @@ -2061,81 +2295,61 @@ \fi } -\def\item{\errmessage{@item while not in a table}} -\def\itemx{\errmessage{@itemx while not in a table}} -\def\kitem{\errmessage{@kitem while not in a table}} -\def\kitemx{\errmessage{@kitemx while not in a table}} -\def\xitem{\errmessage{@xitem while not in a table}} -\def\xitemx{\errmessage{@xitemx while not in a table}} - -% Contains a kludge to get @end[description] to work. -\def\description{\tablez{\dontindex}{1}{}{}{}{}} +\def\item{\errmessage{@item while not in a list environment}} +\def\itemx{\errmessage{@itemx while not in a list environment}} % @table, @ftable, @vtable. -\def\table{\begingroup\inENV\obeylines\obeyspaces\tablex} -{\obeylines\obeyspaces% -\gdef\tablex #1^^M{% -\tabley\dontindex#1 \endtabley}} - -\def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex} -{\obeylines\obeyspaces% -\gdef\ftablex #1^^M{% -\tabley\fnitemindex#1 \endtabley -\def\Eftable{\endgraf\afterenvbreak\endgroup}% -\let\Etable=\relax}} - -\def\vtable{\begingroup\inENV\obeylines\obeyspaces\vtablex} -{\obeylines\obeyspaces% -\gdef\vtablex #1^^M{% -\tabley\vritemindex#1 \endtabley -\def\Evtable{\endgraf\afterenvbreak\endgroup}% -\let\Etable=\relax}} - -\def\dontindex #1{} -\def\fnitemindex #1{\doind {fn}{\code{#1}}}% -\def\vritemindex #1{\doind {vr}{\code{#1}}}% - -{\obeyspaces % -\gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup% -\tablez{#1}{#2}{#3}{#4}{#5}{#6}}} - -\def\tablez #1#2#3#4#5#6{% -\aboveenvbreak % -\begingroup % -\def\Edescription{\Etable}% Necessary kludge. -\let\itemindex=#1% -\ifnum 0#3>0 \advance \leftskip by #3\mil \fi % -\ifnum 0#4>0 \tableindent=#4\mil \fi % -\ifnum 0#5>0 \advance \rightskip by #5\mil \fi % -\def\itemfont{#2}% -\itemmax=\tableindent % -\advance \itemmax by -\itemmargin % -\advance \leftskip by \tableindent % -\exdentamount=\tableindent -\parindent = 0pt -\parskip = \smallskipamount -\ifdim \parskip=0pt \parskip=2pt \fi% -\def\Etable{\endgraf\afterenvbreak\endgroup}% -\let\item = \internalBitem % -\let\itemx = \internalBitemx % -\let\kitem = \internalBkitem % -\let\kitemx = \internalBkitemx % -\let\xitem = \internalBxitem % -\let\xitemx = \internalBxitemx % +\envdef\table{% + \let\itemindex\gobble + \tablex } +\envdef\ftable{% + \def\itemindex ##1{\doind {fn}{\code{##1}}}% + \tablex +} +\envdef\vtable{% + \def\itemindex ##1{\doind {vr}{\code{##1}}}% + \tablex +} +\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 -\def\itemize{\parsearg\itemizezzz} +\envdef\itemize{\parsearg\doitemize} -\def\itemizezzz #1{% - \begingroup % ended by the @end itemize - \itemizey {#1}{\Eitemize} -} - -\def\itemizey#1#2{% +\def\doitemize#1{% \aboveenvbreak \itemmax=\itemindent \advance\itemmax by -\itemmargin @@ -2144,13 +2358,33 @@ \parindent=0pt \parskip=\smallskipamount \ifdim\parskip=0pt \parskip=2pt \fi - \def#2{\endgraf\afterenvbreak\endgroup}% \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. % @@ -2160,11 +2394,8 @@ % or number, to specify the first label in the enumerated list. No % argument is the same as `1'. % -\def\enumerate{\parsearg\enumeratezzz} -\def\enumeratezzz #1{\enumeratey #1 \endenumeratey} +\envparseargdef\enumerate{\enumeratey #1 \endenumeratey} \def\enumeratey #1 #2\endenumeratey{% - \begingroup % ended by the @end enumerate - % % If we were given no argument, pretend we were given `1'. \def\thearg{#1}% \ifx\thearg\empty \def\thearg{1}\fi @@ -2235,13 +2466,13 @@ }% } -% Call itemizey, adding a period to the first argument and supplying the +% 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 - \itemizey{#1.}\Eenumerate\flushcr + \doitemize{#1.}\flushcr } % @alphaenumerate and @capsenumerate are abbreviations for giving an arg @@ -2252,16 +2483,6 @@ \def\Ealphaenumerate{\Eenumerate} \def\Ecapsenumerate{\Eenumerate} -% Definition of @item while inside @itemize. - -\def\itemizeitem{% -\advance\itemno by 1 -{\let\par=\endgraf \smallbreak}% -\ifhmode \errmessage{In hmode at itemizeitem}\fi -{\parskip=0in \hskip 0pt -\hbox to 0pt{\hss \itemcontents\hskip \itemmargin}% -\vadjust{\penalty 1200}}% -\flushcr} % @multitable macros % Amy Hendrickson, 8/18/94, 3/6/96 @@ -2288,24 +2509,14 @@ % @multitable {Column 1 template} {Column 2 template} {Column 3 template} % @item ... % using the widest term desired in each column. -% -% For those who want to use more than one line's worth of words in -% the preamble, break the line within one argument and it -% will parse correctly, i.e., -% -% @multitable {Column 1 template} {Column 2 template} {Column 3 -% template} -% Not: -% @multitable {Column 1 template} {Column 2 template} -% {Column 3 template} % 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, @multitable or @end multitable do not need to be on their -% own lines, but it will not hurt if they are. +% @item, @tab do not need to be on their own lines, but it will not hurt +% if they are. % Sample multitable: @@ -2349,13 +2560,12 @@ \def\xcolumnfractions{\columnfractions} \newif\ifsetpercent -% #1 is the part of the @columnfraction before the decimal point, which -% is presumably either 0 or the empty string (but we don't check, we -% just throw it away). #2 is the decimal part, which we use as the -% percent of \hsize for this column. -\def\pickupwholefraction#1.#2 {% +% #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{.#2\hsize}% + \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}% \setuptable } @@ -2388,18 +2598,30 @@ \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: % -\def\multitable{\parsearg\dotable} -\def\dotable#1{\bgroup +\newtoks\everytab % insert after every tab. +% +\envdef\multitable{% \vskip\parskip - \let\item=\crcrwithfootnotes - % 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. - \let\tab=&% - \let\startfootins=\startsavedfootnote + \startsavinginserts + % + % @item within a multitable starts a normal row. + \let\item\crcr + % \tolerance=9500 \hbadness=9500 \setmultitablespacing @@ -2407,70 +2629,80 @@ \parindent=\multitableparindent \overfullrule=0pt \global\colcount=0 - \def\Emultitable{% - \global\setpercentfalse - \crcrwithfootnotes\crcr - \egroup\egroup + % + \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 % - % \everycr will reset column counter, \colcount, at the end of - % each line. Every column entry will cause \colcount to advance by one. - % The table preamble - % looks at the current \colcount to find the correct column width. - \everycr{\noalign{% - % - % \filbreak%% keeps underfull box messages off when table breaks over pages. - % 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. - \global\colcount=0\relax}}% - % % 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\relax - \multistrut\vtop{\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 + \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{% test to see if user has set \multitablelinespace. @@ -2500,163 +2732,33 @@ %% than skip between lines in the table. \fi} -% In case 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. Otherwise, the insertion is lost, it never migrates to the -% main vertical list. --kasal, 22jan03. -% -\newbox\savedfootnotes -% -% \dotable \let's \startfootins to this, so that \dofootnote will call -% it instead of starting the insertion right away. -\def\startsavedfootnote{% - \global\setbox\savedfootnotes = \vbox\bgroup - \unvbox\savedfootnotes -} -\def\crcrwithfootnotes{% - \crcr - \ifvoid\savedfootnotes \else - \noalign{\insert\footins{\box\savedfootnotes}}% - \fi -} \message{conditionals,} -% Prevent errors for section commands. -% Used in @ignore and in failing conditionals. -\def\ignoresections{% - \let\chapter=\relax - \let\unnumbered=\relax - \let\top=\relax - \let\unnumberedsec=\relax - \let\unnumberedsection=\relax - \let\unnumberedsubsec=\relax - \let\unnumberedsubsection=\relax - \let\unnumberedsubsubsec=\relax - \let\unnumberedsubsubsection=\relax - \let\section=\relax - \let\subsec=\relax - \let\subsubsec=\relax - \let\subsection=\relax - \let\subsubsection=\relax - \let\appendix=\relax - \let\appendixsec=\relax - \let\appendixsection=\relax - \let\appendixsubsec=\relax - \let\appendixsubsection=\relax - \let\appendixsubsubsec=\relax - \let\appendixsubsubsection=\relax - \let\contents=\relax - \let\smallbook=\relax - \let\titlepage=\relax -} - -% Used in nested conditionals, where we have to parse the Texinfo source -% and so want to turn off most commands, in case they are used -% incorrectly. -% -% We use \empty instead of \relax for the @def... commands, so that \end -% doesn't throw an error. For instance: -% @ignore -% @deffn ... -% @end deffn -% @end ignore -% -% The @end deffn is going to get expanded, because we're trying to allow -% nested conditionals. But we don't want to expand the actual @deffn, -% since it might be syntactically correct and intended to be ignored. -% Since \end checks for \relax, using \empty does not cause an error. -% -\def\ignoremorecommands{% - \let\defcodeindex = \relax - \let\defcv = \empty - \let\defcvx = \empty - \let\Edefcv = \empty - \let\deffn = \empty - \let\deffnx = \empty - \let\Edeffn = \empty - \let\defindex = \relax - \let\defivar = \empty - \let\defivarx = \empty - \let\Edefivar = \empty - \let\defmac = \empty - \let\defmacx = \empty - \let\Edefmac = \empty - \let\defmethod = \empty - \let\defmethodx = \empty - \let\Edefmethod = \empty - \let\defop = \empty - \let\defopx = \empty - \let\Edefop = \empty - \let\defopt = \empty - \let\defoptx = \empty - \let\Edefopt = \empty - \let\defspec = \empty - \let\defspecx = \empty - \let\Edefspec = \empty - \let\deftp = \empty - \let\deftpx = \empty - \let\Edeftp = \empty - \let\deftypefn = \empty - \let\deftypefnx = \empty - \let\Edeftypefn = \empty - \let\deftypefun = \empty - \let\deftypefunx = \empty - \let\Edeftypefun = \empty - \let\deftypeivar = \empty - \let\deftypeivarx = \empty - \let\Edeftypeivar = \empty - \let\deftypemethod = \empty - \let\deftypemethodx = \empty - \let\Edeftypemethod = \empty - \let\deftypeop = \empty - \let\deftypeopx = \empty - \let\Edeftypeop = \empty - \let\deftypevar = \empty - \let\deftypevarx = \empty - \let\Edeftypevar = \empty - \let\deftypevr = \empty - \let\deftypevrx = \empty - \let\Edeftypevr = \empty - \let\defun = \empty - \let\defunx = \empty - \let\Edefun = \empty - \let\defvar = \empty - \let\defvarx = \empty - \let\Edefvar = \empty - \let\defvr = \empty - \let\defvrx = \empty - \let\Edefvr = \empty - \let\clear = \relax - \let\down = \relax - \let\evenfooting = \relax - \let\evenheading = \relax - \let\everyfooting = \relax - \let\everyheading = \relax - \let\headings = \relax - \let\include = \relax - \let\item = \relax - \let\lowersections = \relax - \let\oddfooting = \relax - \let\oddheading = \relax - \let\printindex = \relax - \let\pxref = \relax - \let\raisesections = \relax - \let\ref = \relax - \let\set = \relax - \let\setchapternewpage = \relax - \let\setchapterstyle = \relax - \let\settitle = \relax - \let\up = \relax - \let\verbatiminclude = \relax - \let\xref = \relax + +% @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\documentdescriptionword{documentdescription} \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}} @@ -2666,198 +2768,133 @@ \def\menu{\doignore{menu}} \def\xml{\doignore{xml}} -% @dircategory CATEGORY -- specify a category of the dir file -% which this file should belong to. Ignore this in TeX. -\let\dircategory = \comment - -% Ignore text until a line `@end #1'. +% 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 - % Don't complain about control sequences we have declared \outer. - \ignoresections - % - % Define a command to swallow text until we reach `@end #1'. - % This @ is a catcode 12 token (that is the normal catcode of @ in - % this texinfo.tex file). We change the catcode of @ below to match. - \long\def\doignoretext##1@end #1{\enddoignore}% + % Scan in ``verbatim'' mode: + \catcode`\@ = \other + \catcode`\{ = \other + \catcode`\} = \other % % Make sure that spaces turn into tokens that match what \doignoretext wants. - \catcode\spaceChar = 10 - % - % Ignore braces, too, so mismatched braces don't cause trouble. - \catcode`\{ = 9 - \catcode`\} = 9 + \spaceisspace % - % We must not have @c interpreted as a control sequence. - \catcode`\@ = 12 + % Count number of #1's that we've seen. + \doignorecount = 0 % - \def\ignoreword{#1}% - \ifx\ignoreword\documentdescriptionword - % The c kludge breaks documentdescription, since - % `documentdescription' contains a `c'. Means not everything will - % be ignored inside @documentdescription, but oh well... - \else - % Make the letter c a comment character so that the rest of the line - % will be ignored. This way, the document can have (for example) - % @c @end ifinfo - % and the @end ifinfo will be properly ignored. - % (We've just changed @ to catcode 12.) - \catcode`\c = 14 - \fi - % - % And now expand the command defined above. - \doignoretext -} - -% What we do to finish off ignored text. -% -\def\enddoignore{\endgroup\ignorespaces}% - -\newif\ifwarnedobs\warnedobsfalse -\def\obstexwarn{% - \ifwarnedobs\relax\else - % We need to warn folks that they may have trouble with TeX 3.0. - % This uses \immediate\write16 rather than \message to get newlines. - \immediate\write16{} - \immediate\write16{WARNING: for users of Unix TeX 3.0!} - \immediate\write16{This manual trips a bug in TeX version 3.0 (tex hangs).} - \immediate\write16{If you are running another version of TeX, relax.} - \immediate\write16{If you are running Unix TeX 3.0, kill this TeX process.} - \immediate\write16{ Then upgrade your TeX installation if you can.} - \immediate\write16{ (See ftp://ftp.gnu.org/non-gnu/TeX.README.)} - \immediate\write16{If you are stuck with version 3.0, run the} - \immediate\write16{ script ``tex3patch'' from the Texinfo distribution} - \immediate\write16{ to use a workaround.} - \immediate\write16{} - \global\warnedobstrue - \fi + % Swallow text until we reach the matching `@end #1'. + \dodoignore {#1}% } -% **In TeX 3.0, setting text in \nullfont hangs tex. For a -% workaround (which requires the file ``dummy.tfm'' to be installed), -% uncomment the following line: -%%%%%\font\nullfont=dummy\let\obstexwarn=\relax - -% Ignore text, except that we keep track of conditional commands for -% purposes of nesting, up to an `@end #1' command. -% -\def\nestedignore#1{% - \obstexwarn - % We must actually expand the ignored text to look for the @end - % command, so that nested ignore constructs work. Thus, we put the - % text into a \vbox and then do nothing with the result. To minimize - % the chance of memory overflow, we follow the approach outlined on - % page 401 of the TeXbook. +{ \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source. + \obeylines % % - \setbox0 = \vbox\bgroup - % Don't complain about control sequences we have declared \outer. - \ignoresections - % - % Define `@end #1' to end the box, which will in turn undefine the - % @end command again. - \expandafter\def\csname E#1\endcsname{\egroup\ignorespaces}% + \gdef\dodoignore#1{% + % #1 contains the string `ifinfo'. % - % We are going to be parsing Texinfo commands. Most cause no - % trouble when they are used incorrectly, but some commands do - % complicated argument parsing or otherwise get confused, so we - % undefine them. + % Define a command to find the next `@end #1', which must be on a line + % by itself. + \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_}% % - % We can't do anything about stray @-signs, unfortunately; - % they'll produce `undefined control sequence' errors. - \ignoremorecommands - % - % Set the current font to be \nullfont, a TeX primitive, and define - % all the font commands to also use \nullfont. We don't use - % dummy.tfm, as suggested in the TeXbook, because some sites - % might not have that installed. Therefore, math mode will still - % produce output, but that should be an extremely small amount of - % stuff compared to the main input. - % - \nullfont - \let\tenrm=\nullfont \let\tenit=\nullfont \let\tensl=\nullfont - \let\tenbf=\nullfont \let\tentt=\nullfont \let\smallcaps=\nullfont - \let\tensf=\nullfont - % Similarly for index fonts. - \let\smallrm=\nullfont \let\smallit=\nullfont \let\smallsl=\nullfont - \let\smallbf=\nullfont \let\smalltt=\nullfont \let\smallsc=\nullfont - \let\smallsf=\nullfont - % Similarly for smallexample fonts. - \let\smallerrm=\nullfont \let\smallerit=\nullfont \let\smallersl=\nullfont - \let\smallerbf=\nullfont \let\smallertt=\nullfont \let\smallersc=\nullfont - \let\smallersf=\nullfont - % - % Don't complain when characters are missing from the fonts. - \tracinglostchars = 0 - % - % Don't bother to do space factor calculations. - \frenchspacing - % - % Don't report underfull hboxes. - \hbadness = 10000 - % - % Do minimal line-breaking. - \pretolerance = 10000 - % - % Do not execute instructions in @tex. - \def\tex{\doignore{tex}}% - % Do not execute macro definitions. - % `c' is a comment character, so the word `macro' will get cut off. - \def\macro{\doignore{ma}}% + % And now expand that command. + \obeylines % + \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. +\def\enddoignore{\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. Make sure the catcode of space is correct to avoid -% losing inside @example, for instance. +% didn't need it. +% We rely on the fact that \parsearg sets \catcode`\ =10. % -\def\set{\begingroup\catcode` =10 - \catcode`\-=12 \catcode`\_=12 % Allow - and _ in VAR. - \parsearg\setxxx} -\def\setxxx#1{\setyyy#1 \endsetyyy} +\parseargdef\set{\setyyy#1 \endsetyyy} \def\setyyy#1 #2\endsetyyy{% - \def\temp{#2}% - \ifx\temp\empty \global\expandafter\let\csname SET#1\endcsname = \empty - \else \setzzz{#1}#2\endsetzzz % Remove the trailing space \setxxx inserted. - \fi - \endgroup + {% + \makevalueexpandable + \def\temp{#2}% + \edef\next{\gdef\makecsname{SET#1}}% + \ifx\temp\empty + \next{}% + \else + \setzzz#2\endsetzzz + \fi + }% } -% Can't use \xdef to pre-expand #2 and save some time, since \temp or -% \next or other control sequences that we've defined might get us into -% an infinite loop. Consider `@set foo @cite{bar}'. -\def\setzzz#1#2 \endsetzzz{\expandafter\gdef\csname SET#1\endcsname{#2}} +% Remove the trailing space \setxxx inserted. +\def\setzzz#1 \endsetzzz{\next{#1}} % @clear VAR clears (i.e., unsets) the variable VAR. % -\def\clear{\parsearg\clearxxx} -\def\clearxxx#1{\global\expandafter\let\csname SET#1\endcsname=\relax} +\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 \catcode`\_ = \active % - % We might end up with active _ or - characters in the argument if - % we're called from @code, as @code{@value{foo-bar_}}. So \let any - % such active characters to their normal equivalents. - \gdef\value{\begingroup + \gdef\makevalueexpandable{% + \let\value = \expandablevalue + % We don't want these characters active, ... \catcode`\-=\other \catcode`\_=\other - \indexbreaks \let_\normalunderscore - \valuexxx} + % ..., 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 + } } -\def\valuexxx#1{\expandablevalue{#1}\endgroup} % We have this subroutine so that we can handle at least some @value's -% properly in indexes (we \let\value to this in \indexdummies). Ones -% whose names contain - or _ still won't work, but we can't do anything -% about that. 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). +% 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 @@ -2871,55 +2908,36 @@ % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined % with @set. % -\def\ifset{\parsearg\doifset} -\def\doifset#1{% - \expandafter\ifx\csname SET#1\endcsname\relax - \let\next=\ifsetfail - \else - \let\next=\ifsetsucceed - \fi - \next +% 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\ifsetsucceed{\conditionalsucceed{ifset}} -\def\ifsetfail{\nestedignore{ifset}} -\defineunmatchedend{ifset} +\def\ifsetfail{\doignore{ifset}} % @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been % defined with @set, or has been undefined with @clear. % -\def\ifclear{\parsearg\doifclear} -\def\doifclear#1{% - \expandafter\ifx\csname SET#1\endcsname\relax - \let\next=\ifclearsucceed - \else - \let\next=\ifclearfail - \fi - \next -} -\def\ifclearsucceed{\conditionalsucceed{ifclear}} -\def\ifclearfail{\nestedignore{ifclear}} -\defineunmatchedend{ifclear} - -% @iftex, @ifnothtml, @ifnotinfo, @ifnotplaintext always succeed; we -% read the text following, through the first @end iftex (etc.). Make -% `@end iftex' (etc.) valid only after an @iftex. +% 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. % -\def\iftex{\conditionalsucceed{iftex}} -\def\ifnothtml{\conditionalsucceed{ifnothtml}} -\def\ifnotinfo{\conditionalsucceed{ifnotinfo}} -\def\ifnotplaintext{\conditionalsucceed{ifnotplaintext}} -\defineunmatchedend{iftex} -\defineunmatchedend{ifnothtml} -\defineunmatchedend{ifnotinfo} -\defineunmatchedend{ifnotplaintext} +\makecond{ifclear} +\def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}} +\def\ifclearfail{\doignore{ifclear}} -% True conditional. Since \set globally defines its variables, we can -% just start and end a group (to keep the @end definition undefined at -% the outer level). -% -\def\conditionalsucceed#1{\begingroup - \expandafter\def\csname E#1\endcsname{\endgroup}% -} +% @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 @@ -3044,6 +3062,7 @@ \def\definedummyletter##1{% \expandafter\def\csname ##1\endcsname{\realbackslash ##1}% }% + \let\definedummyaccent\definedummyletter % % Do the redefinitions. \commondummies @@ -3066,6 +3085,7 @@ \def\definedummyletter##1{% \expandafter\def\csname ##1\endcsname{@##1}% }% + \let\definedummyaccent\definedummyletter % % Do the redefinitions. \commondummies @@ -3078,26 +3098,11 @@ % \normalturnoffactive % - % Control letters and accents. + \commondummiesnofonts + % \definedummyletter{_}% - \definedummyletter{,}% - \definedummyletter{"}% - \definedummyletter{`}% - \definedummyletter{'}% - \definedummyletter{^}% - \definedummyletter{~}% - \definedummyletter{=}% - \definedummyword{u}% - \definedummyword{v}% - \definedummyword{H}% - \definedummyword{dotaccent}% - \definedummyword{ringaccent}% - \definedummyword{tieaccent}% - \definedummyword{ubaraccent}% - \definedummyword{udotaccent}% - \definedummyword{dotless}% - % - % Other non-English letters. + % + % Non-English letters. \definedummyword{AA}% \definedummyword{AE}% \definedummyword{L}% @@ -3109,6 +3114,10 @@ \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}% @@ -3120,37 +3129,14 @@ \definedummyword{tclose}% \definedummyword{tt}% % - % Texinfo font commands. - \definedummyword{b}% - \definedummyword{i}% - \definedummyword{r}% - \definedummyword{sc}% - \definedummyword{t}% - % + \definedummyword{LaTeX}% \definedummyword{TeX}% - \definedummyword{acronym}% - \definedummyword{cite}% - \definedummyword{code}% - \definedummyword{command}% - \definedummyword{dfn}% - \definedummyword{dots}% - \definedummyword{emph}% - \definedummyword{env}% - \definedummyword{file}% - \definedummyword{kbd}% - \definedummyword{key}% - \definedummyword{math}% - \definedummyword{option}% - \definedummyword{samp}% - \definedummyword{strong}% - \definedummyword{uref}% - \definedummyword{url}% - \definedummyword{var}% - \definedummyword{w}% % % Assorted special characters. \definedummyword{bullet}% + \definedummyword{comma}% \definedummyword{copyright}% + \definedummyword{registeredsymbol}% \definedummyword{dots}% \definedummyword{enddots}% \definedummyword{equiv}% @@ -3162,10 +3148,9 @@ \definedummyword{print}% \definedummyword{result}% % - % Handle some cases of @value -- where the variable name does not - % contain - or _, and the value does not contain any + % Handle some cases of @value -- where it does not contain any % (non-fully-expandable) commands. - \let\value = \expandablevalue + \makevalueexpandable % % Normal spaces, not active ones. \unsepspaces @@ -3174,45 +3159,97 @@ \turnoffmacros } -% 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 \ ). -{\obeyspaces - \gdef\unsepspaces{\obeyspaces\let =\space}} - +% \commondummiesnofonts: common to \commondummies and \indexnofonts. +% +% Better have this without active chars. +{ + \catcode`\~=\other + \gdef\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{samp}% + \definedummyword{strong}% + \definedummyword{tie}% + \definedummyword{uref}% + \definedummyword{url}% + \definedummyword{var}% + \definedummyword{verb}% + \definedummyword{w}% + } +} % \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\indexdummytex{TeX} -\def\indexdummydots{...} -% \def\indexnofonts{% + % Accent commands should become @asis. + \def\definedummyaccent##1{% + \expandafter\let\csname ##1\endcsname\asis + }% + % We can just ignore other control letters. + \def\definedummyletter##1{% + \expandafter\def\csname ##1\endcsname{}% + }% + % 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}% % - \let\,=\asis - \let\"=\asis - \let\`=\asis - \let\'=\asis - \let\^=\asis - \let\~=\asis - \let\==\asis - \let\u=\asis - \let\v=\asis - \let\H=\asis - \let\dotaccent=\asis - \let\ringaccent=\asis - \let\tieaccent=\asis - \let\ubaraccent=\asis - \let\udotaccent=\asis - \let\dotless=\asis - % - % Other non-English letters. + % Non-English letters. \def\AA{AA}% \def\AE{AE}% \def\L{L}% @@ -3226,130 +3263,168 @@ \def\ss{ss}% \def\exclamdown{!}% \def\questiondown{?}% + \def\ordf{a}% + \def\ordm{o}% % - % 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\LaTeX{LaTeX}% + \def\TeX{TeX}% % - % Texinfo font commands. - \let\b=\asis - \let\i=\asis - \let\r=\asis - \let\sc=\asis - \let\t=\asis - % - \let\TeX=\indexdummytex - \let\acronym=\asis - \let\cite=\asis - \let\code=\asis - \let\command=\asis - \let\dfn=\asis - \let\dots=\indexdummydots - \let\emph=\asis - \let\env=\asis - \let\file=\asis - \let\kbd=\asis - \let\key=\asis - \let\math=\asis - \let\option=\asis - \let\samp=\asis - \let\strong=\asis - \let\uref=\asis - \let\url=\asis - \let\var=\asis - \let\w=\asis + % 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\expansion{==>}% + \def\minus{-}% + \def\pounds{pounds}% + \def\point{.}% + \def\print{-|}% + \def\result{=>}% + % + % Don't write macro names. + \emptyusermacros } \let\indexbackslash=0 %overridden during \printindex. \let\SETmarginindex=\relax % put index entries in margin (undocumented)? -% For \ifx comparisons. -\def\emptymacro{\empty} - % Most index entries go through here, but \dosubind is the general case. -% -\def\doind#1#2{\dosubind{#1}{#2}\empty} +% #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 defuns, which call us directly. +% 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 #2}}% + \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}% \fi - {% - \count255=\lastpenalty - {% - \indexdummies % Must do this here, since \bf, etc expand at this stage - \escapechar=`\\ - {% - \let\folio = 0% We will expand all macros now EXCEPT \folio. - \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now - % so it will be output as is; and it will print as backslash. - % - % The main index entry text. - \toks0 = {#2}% - % - % If third arg is present, precede it with space in sort key. - \def\thirdarg{#3}% - \ifx\thirdarg\emptymacro \else - % If the third (subentry) arg is present, add it to the index - % line to write. - \toks0 = \expandafter{\the\toks0 \space #3}% - \fi - % - % 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\csname#1indfile\endcsname{% - \realbackslash entry{\indexsorttmp}{\folio}{\the\toks0}}% - }% - % - % 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. - % - \iflinks - \ifvmode - \skip0 = \lastskip - \ifdim\lastskip = 0pt \else \nobreak\vskip-\skip0 \fi - \fi - % - \temp % do the write - % - \ifvmode \ifdim\skip0 = 0pt \else \nobreak\vskip\skip0 \fi \fi - \fi - }% - }% - \penalty\count255 + % + % Remember, we are within a group. + \indexdummies % Must do this here, since \bf, etc expand at this stage + \escapechar=`\\ + \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 penalty; 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 \nobreak \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 @@ -3387,14 +3462,12 @@ % @printindex causes a particular index (the ??s file) to get printed. % It does not print any chapter heading (usually an @unnumbered). % -\def\printindex{\parsearg\doprintindex} -\def\doprintindex#1{\begingroup +\parseargdef\printindex{\begingroup \dobreak \chapheadingskip{10000}% % \smallfonts \rm \tolerance = 9500 \everypar = {}% don't want the \kern\-parindent from indentation suppression. - \indexbreaks % % See if the index file exists and is nonempty. % Change catcode of @ here so that if the index file contains @@ -3421,7 +3494,7 @@ % 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{\rawbackslashxx}% + \def\indexbackslash{\backslashcurfont}% \catcode`\\ = 0 \escapechar = `\\ \begindoublecolumns @@ -3459,74 +3532,95 @@ \nobreak }} -% This typesets a paragraph consisting of #1, dot leaders, and then #2 -% flush to the right margin. It is used for index and table of contents -% entries. The paragraph is indented by \leftskip. +% \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. % -\def\entry#1#2{\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 - % - % Start a ``paragraph'' for the index entry so the line breaking - % parameters we've set above will have an effect. - \noindent - % - % Insert the text of the index entry. TeX will do line-breaking on it. - #1% - % 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{#2}% - \edef\tempc{\tempa}% - \edef\tempd{\tempb}% - \ifx\tempc\tempd\ \else% +% 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 % - % 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. + % \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. % - % 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#2.\ \the\toksA % The page number ends the paragraph. + % \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 - \ #2% The page number ends the paragraph. + % + % 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 - \fi% - \par -\endgroup} + \par + \endgroup +} % Like \dotfill except takes at least 1 em. \def\indexdotfill{\cleaders @@ -3695,6 +3789,12 @@ \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 @@ -3702,9 +3802,12 @@ % 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 for the sake of pdftex, which needs the actual +% 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% @@ -3742,11 +3845,12 @@ % 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 % @raise/lowersections modify this count +\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} @@ -3756,121 +3860,142 @@ \def\lowersections{\global\advance\secbase by 1} \let\down=\lowersections % original BFox name -% Choose a numbered-heading macro -% #1 is heading level if unmodified by @raisesections or @lowersections -% #2 is text for heading -\def\numhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1 -\ifcase\absseclevel - \chapterzzz{#2} -\or - \seczzz{#2} -\or - \numberedsubseczzz{#2} -\or - \numberedsubsubseczzz{#2} -\else - \ifnum \absseclevel<0 - \chapterzzz{#2} +% 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 - \numberedsubsubseczzz{#2} + \ifnum \absseclevel > 3 + \absseclevel = 3 + \fi \fi -\fi -\suppressfirstparagraphindent -} - -% like \numhead, but chooses appendix heading levels -\def\apphead#1#2{\absseclevel=\secbase\advance\absseclevel by #1 -\ifcase\absseclevel - \appendixzzz{#2} -\or - \appendixsectionzzz{#2} -\or - \appendixsubseczzz{#2} -\or - \appendixsubsubseczzz{#2} -\else - \ifnum \absseclevel<0 - \appendixzzz{#2} + % The heading type: + \def\headtype{#1}% + \if \headtype U% + \ifnum \absseclevel < \unmlevel + \chardef\unmlevel = \absseclevel + \fi \else - \appendixsubsubseczzz{#2} + % 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 -\fi -\suppressfirstparagraphindent -} - -% like \numhead, but chooses numberless heading levels -\def\unnmhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1 -\ifcase\absseclevel - \unnumberedzzz{#2} -\or - \unnumberedseczzz{#2} -\or - \unnumberedsubseczzz{#2} -\or - \unnumberedsubsubseczzz{#2} -\else - \ifnum \absseclevel<0 - \unnumberedzzz{#2} + % Now print the heading: + \if \headtype U% + \ifcase\absseclevel + \unnumberedzzz{#3}% + \or \unnumberedseczzz{#3}% + \or \unnumberedsubseczzz{#3}% + \or \unnumberedsubsubseczzz{#3}% + \fi \else - \unnumberedsubsubseczzz{#2} + \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 -\fi -\suppressfirstparagraphindent -} - -% @chapter, @appendix, @unnumbered. -\def\thischaptername{No Chapter Title} -\outer\def\chapter{\parsearg\chapteryyy} -\def\chapteryyy #1{\numhead0{#1}} % normally numhead0 calls chapterzzz -\def\chapterzzz #1{% - \secno=0 \subsecno=0 \subsubsecno=0 - \global\advance \chapno by 1 \message{\putwordChapter\space \the\chapno}% - \chapmacro {#1}{\the\chapno}% - \gdef\thissection{#1}% - \gdef\thischaptername{#1}% - % We don't substitute the actual chapter name into \thischapter - % because we don't want its macros evaluated now. - \xdef\thischapter{\putwordChapter{} \the\chapno: \noexpand\thischaptername}% - \writetocentry{chap}{#1}{{\the\chapno}} - \donoderef + \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 } -% we use \chapno to avoid indenting back -\def\appendixbox#1{% - \setbox0 = \hbox{\putwordAppendix{} \the\chapno}% - \hbox to \wd0{#1\hss}} - -\outer\def\appendix{\parsearg\appendixyyy} -\def\appendixyyy #1{\apphead0{#1}} % normally apphead0 calls appendixzzz -\def\appendixzzz #1{% - \secno=0 \subsecno=0 \subsubsecno=0 - \global\advance \appendixno by 1 - \message{\putwordAppendix\space \appendixletter}% - \chapmacro {#1}{\appendixbox{\putwordAppendix{} \appendixletter}}% - \gdef\thissection{#1}% - \gdef\thischaptername{#1}% - \xdef\thischapter{\putwordAppendix{} \appendixletter: \noexpand\thischaptername}% - \writetocentry{appendix}{#1}{{\appendixletter}} - \appendixnoderef +\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 } -% @centerchap is like @unnumbered, but the heading is centered. -\outer\def\centerchap{\parsearg\centerchapyyy} -\def\centerchapyyy #1{{\let\unnumbchapmacro=\centerchapmacro \unnumberedyyy{#1}}} - -% @top is like @unnumbered. -\outer\def\top{\parsearg\unnumberedyyy} - -\outer\def\unnumbered{\parsearg\unnumberedyyy} -\def\unnumberedyyy #1{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz -\def\unnumberedzzz #1{% - \secno=0 \subsecno=0 \subsubsecno=0 +\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 @@ -3883,134 +4008,98 @@ % \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)}% + \toks0 = {#1}% + \message{(\the\toks0)}% + % + \chapmacro{#1}{Ynothing}{\the\unnumberedno}% % - \unnumbchapmacro {#1}% - \gdef\thischapter{#1}\gdef\thissection{#1}% - \writetocentry{unnumbchap}{#1}{{\the\chapno}} - \unnumbnoderef \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\def\numberedsec{\parsearg\secyyy} -\def\secyyy #1{\numhead1{#1}} % normally calls seczzz -\def\seczzz #1{% - \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 % - \gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}% - \writetocentry{sec}{#1}{{\the\chapno}{\the\secno}} - \donoderef - \nobreak +\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\def\appendixsection{\parsearg\appendixsecyyy} -\outer\def\appendixsec{\parsearg\appendixsecyyy} -\def\appendixsecyyy #1{\apphead1{#1}} % normally calls appendixsectionzzz -\def\appendixsectionzzz #1{% - \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 % - \gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}% - \writetocentry{sec}{#1}{{\appendixletter}{\the\secno}} - \appendixnoderef - \nobreak +\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\def\unnumberedsec{\parsearg\unnumberedsecyyy} -\def\unnumberedsecyyy #1{\unnmhead1{#1}} % normally calls unnumberedseczzz -\def\unnumberedseczzz #1{% - \plainsecheading {#1}\gdef\thissection{#1}% - \writetocentry{unnumbsec}{#1}{{\the\chapno}{\the\secno}} - \unnumbnoderef - \nobreak +\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\def\numberedsubsec{\parsearg\numberedsubsecyyy} -\def\numberedsubsecyyy #1{\numhead2{#1}} % normally calls numberedsubseczzz -\def\numberedsubseczzz #1{% - \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 % - \subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}% - \writetocentry{subsec}{#1}{{\the\chapno}{\the\secno}{\the\subsecno}} - \donoderef - \nobreak +\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\def\appendixsubsec{\parsearg\appendixsubsecyyy} -\def\appendixsubsecyyy #1{\apphead2{#1}} % normally calls appendixsubseczzz -\def\appendixsubseczzz #1{% - \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 % - \subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}% - \writetocentry{subsec}{#1}{{\appendixletter}{\the\secno}{\the\subsecno}} - \appendixnoderef - \nobreak +\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\def\unnumberedsubsec{\parsearg\unnumberedsubsecyyy} -\def\unnumberedsubsecyyy #1{\unnmhead2{#1}} %normally calls unnumberedsubseczzz -\def\unnumberedsubseczzz #1{% - \plainsubsecheading {#1}\gdef\thissection{#1}% - \writetocentry{unnumbsubsec}{#1}{{\the\chapno}{\the\secno}{\the\subsecno}} - \unnumbnoderef - \nobreak +\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\def\numberedsubsubsec{\parsearg\numberedsubsubsecyyy} -\def\numberedsubsubsecyyy #1{\numhead3{#1}} % normally numberedsubsubseczzz -\def\numberedsubsubseczzz #1{% - \gdef\thissection{#1}\global\advance \subsubsecno by 1 % - \subsubsecheading {#1} - {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}% - \writetocentry{subsubsec}{#1}{{\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}} - \donoderef - \nobreak +\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\def\appendixsubsubsec{\parsearg\appendixsubsubsecyyy} -\def\appendixsubsubsecyyy #1{\apphead3{#1}} % normally appendixsubsubseczzz -\def\appendixsubsubseczzz #1{% - \gdef\thissection{#1}\global\advance \subsubsecno by 1 % - \subsubsecheading {#1} - {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}% - \writetocentry{subsubsec}{#1}{{\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}} - \appendixnoderef - \nobreak +\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\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubsecyyy} -\def\unnumberedsubsubsecyyy #1{\unnmhead3{#1}} %normally unnumberedsubsubseczzz -\def\unnumberedsubsubseczzz #1{% - \plainsubsubsecheading {#1}\gdef\thissection{#1}% - \writetocentry{unnumbsubsubsec}{#1}{{\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}} - \unnumbnoderef - \nobreak +\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 are variants which are not "outer", so they can appear in @ifinfo. -% Actually, they should now be obsolete; ordinary section commands should work. -\def\infotop{\parsearg\unnumberedzzz} -\def\infounnumbered{\parsearg\unnumberedzzz} -\def\infounnumberedsec{\parsearg\unnumberedseczzz} -\def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz} -\def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz} - -\def\infoappendix{\parsearg\appendixzzz} -\def\infoappendixsec{\parsearg\appendixseczzz} -\def\infoappendixsubsec{\parsearg\appendixsubseczzz} -\def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz} - -\def\infochapter{\parsearg\chapterzzz} -\def\infosection{\parsearg\sectionzzz} -\def\infosubsection{\parsearg\subsectionzzz} -\def\infosubsubsection{\parsearg\subsubsectionzzz} - % 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. -\global\let\section = \numberedsec -\global\let\subsection = \numberedsubsec -\global\let\subsubsection = \numberedsubsubsec +\let\section = \numberedsec +\let\subsection = \numberedsubsec +\let\subsubsection = \numberedsubsubsec % Define @majorheading, @heading and @subheading @@ -4023,23 +4112,27 @@ % if justification is not attempted. Hence \raggedright. -\def\majorheading{\parsearg\majorheadingzzz} -\def\majorheadingzzz #1{% +\def\majorheading{% {\advance\chapheadingskip by 10pt \chapbreak }% - {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 - \parindent=0pt\raggedright - \rm #1\hfill}}\bigskip \par\penalty 200} + \parsearg\chapheadingzzz +} -\def\chapheading{\parsearg\chapheadingzzz} -\def\chapheadingzzz #1{\chapbreak % +\def\chapheading{\chapbreak \parsearg\chapheadingzzz} +\def\chapheadingzzz#1{% {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 \parindent=0pt\raggedright - \rm #1\hfill}}\bigskip \par\penalty 200} + \rm #1\hfill}}% + \bigskip \par\penalty 200\relax + \suppressfirstparagraphindent +} % @heading, @subheading, @subsubheading. -\def\heading{\parsearg\plainsecheading} -\def\subheading{\parsearg\plainsubsecheading} -\def\subsubheading{\parsearg\plainsubsubsecheading} +\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), @@ -4048,8 +4141,6 @@ %%% Args are the skip and penalty (usually negative) \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi} -\def\setchapterstyle #1 {\csname CHAPF#1\endcsname} - %%% Define plain chapter starts, and page on/off switching for it % Parameter controlling skip before chapter headings (if needed) @@ -4072,7 +4163,7 @@ \global\let\pagealignmacro=\chappager \global\def\HEADINGSon{\HEADINGSsingle}} -\def\CHAPPAGodd{ +\def\CHAPPAGodd{% \global\let\contentsalignmacro = \chapoddpage \global\let\pchapsepmacro=\chapoddpage \global\let\pagealignmacro=\chapoddpage @@ -4080,115 +4171,192 @@ \CHAPPAGon -\def\CHAPFplain{ -\global\let\chapmacro=\chfplain -\global\let\unnumbchapmacro=\unnchfplain -\global\let\centerchapmacro=\centerchfplain} - -% Plain chapter opening. -% #1 is the text, #2 the chapter number or empty if unnumbered. -\def\chfplain#1#2{% +% 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 - \def\chapnum{#2}% - \setbox0 = \hbox{#2\ifx\chapnum\empty\else\enspace\fi}% + % + % 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}% + \def\thischapter{#1}% + \else\ifx\temptype\Yomitfromtockeyword + \setbox0 = \hbox{}% contents like unnumbered, but no toc entry + \def\toctype{omit}% + \xdef\thischapter{}% + \else\ifx\temptype\Yappendixkeyword + \setbox0 = \hbox{\putwordAppendix{} #3\enspace}% + \def\toctype{app}% + % 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\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 + \hangindent=\wd0 \centerparametersmaybe \unhbox0 #1\par}% }% \nobreak\bigskip % no page break after a chapter title \nobreak } -% Plain opening for unnumbered. -\def\unnchfplain#1{\chfplain{#1}{}} - % @centerchap -- centered and unnumbered. \let\centerparametersmaybe = \relax -\def\centerchfplain#1{{% - \def\centerparametersmaybe{% - \advance\rightskip by 3\rightskip - \leftskip = \rightskip - \parfillskip = 0pt - }% - \chfplain{#1}{}% -}} +\def\centerparameters{% + \advance\rightskip by 3\rightskip + \leftskip = \rightskip + \parfillskip = 0pt +} -\CHAPFplain % The default +% 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} -\def\CHAPFopen{ -\global\let\chapmacro=\chfopen -\global\let\unnumbchapmacro=\unnchfopen -\global\let\centerchapmacro=\centerchfopen} - -% Section titles. +% 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}} -\def\secheading#1#2#3{\sectionheading{sec}{#2.#3}{#1}} -\def\plainsecheading#1{\sectionheading{sec}{}{#1}} +\def\secheadingbreak{\dobreak \secheadingskip{-1000}} % Subsection titles. -\newskip \subsecheadingskip -\def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}} -\def\subsecheading#1#2#3#4{\sectionheading{subsec}{#2.#3.#4}{#1}} -\def\plainsubsecheading#1{\sectionheading{subsec}{}{#1}} +\newskip\subsecheadingskip +\def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}} % Subsubsection titles. -\let\subsubsecheadingskip = \subsecheadingskip -\let\subsubsecheadingbreak = \subsecheadingbreak -\def\subsubsecheading#1#2#3#4#5{\sectionheading{subsubsec}{#2.#3.#4.#5}{#1}} -\def\plainsubsubsecheading#1{\sectionheading{subsubsec}{}{#1}} +\def\subsubsecheadingskip{\subsecheadingskip} +\def\subsubsecheadingbreak{\subsecheadingbreak} -% Print any size section title. +% Print any size, any type, section title. % -% #1 is the section type (sec/subsec/subsubsec), #2 is the section -% number (maybe empty), #3 the text. -\def\sectionheading#1#2#3{% - {% - \expandafter\advance\csname #1headingskip\endcsname by \parskip - \csname #1headingbreak\endcsname - }% +% #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 #1fonts\endcsname \rm + \csname #2fonts\endcsname \rm % - % Only insert the separating space if we have a section number. - \def\secnum{#2}% - \setbox0 = \hbox{#2\ifx\secnum\empty\else\enspace\fi}% + % 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 \chfplain. + \writetocentry{\toctype\sectionlevel}{#1}{#4}% + % + % Write the node reference (= pdf destination for pdftex). + % Again, see comments in \chfplain. + \donoderef{#3}% + % + % Output the actual section heading. \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright - \hangindent = \wd0 % zero if no section number - \unhbox0 #3}% + \hangindent=\wd0 % zero if no section number + \unhbox0 #1}% }% - % Add extra space after the heading -- either a line space or a - % paragraph space, whichever is more. (Some people like to set - % \parskip to large values for some reason.) Don't allow stretch, though. + % 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 - \ifdim\parskip>\normalbaselineskip - \kern\parskip - \else - \kern\normalbaselineskip - \fi + % + % 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 \nobreak is purely so the last item on the list is a \penalty + % of 10000. This is so other code, for instance \parsebodycommon, can + % check for and avoid allowing breakpoints. Otherwise, it would + % insert a valid breakpoint between: + % @section sec-whatever + % @deffn def-whatever \nobreak } @@ -4198,119 +4366,152 @@ \newwrite\tocfile % Write an entry to the toc file, opening it if necessary. -% Called from @chapter, etc. We supply {\folio} at the end of the -% argument, which will end up as the last argument to the \...entry macro. +% 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. % -% Usage: \writetocentry{chap}{The Name of The Game}{{\the\chapno}} % 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{% - \iftocfileopened\else - \immediate\openout\tocfile = \jobname.toc - \global\tocfileopenedtrue - \fi - % - \iflinks - \toks0 = {#2}% - \edef\temp{\write\tocfile{\realbackslash #1entry{\the\toks0}#3{\folio}}}% - \temp + \edef\writetoctype{#1}% + \ifx\writetoctype\omitkeyword \else + \iftocfileopened\else + \immediate\openout\tocfile = \jobname.toc + \global\tocfileopenedtrue + \fi + % + \iflinks + \toks0 = {#2}% + \toks2 = \expandafter{\lastnode}% + \edef\temp{\write\tocfile{\realbackslash #1entry{\the\toks0}{#3}% + {\the\toks2}{\noexpand\folio}}}% + \temp + \fi \fi % - % Tell \shipout to create a page destination if we're doing pdf, which - % will be the target of the links in the table of contents. We can't - % just do it 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 \pdfmakepagedesttrue \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 } \newskip\contentsrightmargin \contentsrightmargin=1in \newcount\savepageno \newcount\lastnegativepageno \lastnegativepageno = -1 -% Finish up the main text and prepare to read what we've written -% to \tocfile. +% 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. - \unnumbchapmacro{#1}\def\thischapter{}% - \savepageno = \pageno - \begingroup % Set up to handle contents files properly. - \catcode`\\=0 \catcode`\{=1 \catcode`\}=2 \catcode`\@=11 - % We can't do this, because then an actual ^ in a section - % title fails, e.g., @chapter ^ -- exponentiation. --karl, 9jul97. - %\catcode`\^=7 % to see ^^e4 as \"a etc. juha@piuha.ydi.vtt.fi - \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 + % 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. + \catcode`\\=0 \catcode`\{=1 \catcode`\}=2 \catcode`\@=11 + % We can't do this, because then an actual ^ in a section + % title fails, e.g., @chapter ^ -- exponentiation. --karl, 9jul97. + %\catcode`\^=7 % to see ^^e4 as \"a etc. juha@piuha.ydi.vtt.fi + \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 - \closein 1 - \input \jobname.toc - \fi - \vfill \eject - \contentsalignmacro % in case @setchapternewpage odd is in effect - \pdfmakeoutlines - \endgroup - \lastnegativepageno = \pageno - \global\pageno = \savepageno + \startcontents{\putwordTOC}% + \openin 1 \jobname.toc + \ifeof 1 \else + \input \jobname.toc + \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\chapentry = \shortchapentry - \let\appendixentry = \shortappendixentry - \let\unnumbchapentry = \shortunnumberedentry - % 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\secentry ##1##2##3##4{} - \def\subsecentry ##1##2##3##4##5{} - \def\subsubsecentry ##1##2##3##4##5##6{} - \let\unnumbsecentry = \secentry - \let\unnumbsubsecentry = \subsecentry - \let\unnumbsubsubsecentry = \subsubsecentry - \openin 1 \jobname.toc - \ifeof 1 \else - \closein 1 - \input \jobname.toc - \fi - \vfill \eject - \contentsalignmacro % in case @setchapternewpage odd is in effect - \endgroup - \lastnegativepageno = \pageno - \global\pageno = \savepageno + \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 + \input \jobname.toc + \fi + \closein 1 + \vfill \eject + \contentsalignmacro % in case @setchapternewpage odd is in effect + \endgroup + \lastnegativepageno = \pageno + \global\pageno = \savepageno } \let\shortcontents = \summarycontents -\ifpdf - \pdfcatalog{/PageMode /UseOutlines}% -\fi +% 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. @@ -4318,58 +4519,46 @@ % The arguments in between are the chapter number, section number, ... % Chapters, in the main contents. -\def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}} +\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{% - \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#3\egroup}% +\def\shortchapentry#1#2#3#4{% + \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}% } % Appendices, in the main contents. -\def\appendixentry#1#2#3{% - \dochapentry{\appendixbox{\putwordAppendix{} #2}\labelspace#1}{#3}} -% -% Appendices, in the short toc. -\let\shortappendixentry = \shortchapentry - -% Typeset the label for a chapter or appendix for the short contents. -% The arg is, e.g., `Appendix A' for an appendix, or `3' for a chapter. -% We could simplify the code here by writing out an \appendixentry -% command in the toc file for appendices, instead of using \chapentry -% for both, but it doesn't seem worth it. +% Need the word Appendix, and a fixed-size box. % -\newdimen\shortappendixwidth +\def\appendixbox#1{% + % We use M since it's probably the widest letter. + \setbox0 = \hbox{\putwordAppendix{} M}% + \hbox to \wd0{\putwordAppendix{} #1\hss}} % -\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.) - \dimen0 = 1em - \hbox to \dimen0{#1\hss}% -} +\def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\labelspace#1}{#4}} % Unnumbered chapters. -\def\unnumbchapentry#1#2#3{\dochapentry{#1}{#3}} -\def\shortunnumberedentry#1#2#3{\tocentry{#1}{\doshortpageno\bgroup#3\egroup}} +\def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}} +\def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}} % Sections. -\def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}} -\def\unnumbsecentry#1#2#3#4{\dosecentry{#1}{#4}} +\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\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}} -\def\unnumbsubsecentry#1#2#3#4#5{\dosubsecentry{#1}{#5}} +\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\subsubsecentry#1#2#3#4#5#6{% - \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}} -\def\unnumbsubsubsecentry#1#2#3#4#5#6{\dosubsubsecentry{#1}{#6}} +\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. -\newdimen\tocindent \tocindent = 3pc +% 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. @@ -4400,17 +4589,8 @@ \tocentry{#1}{\dopageno\bgroup#2\egroup}% \endgroup} -% Final typesetting of a toc entry; we use the same \entry macro as for -% the index entries, but we want to suppress hyphenation here. (We -% can't do that in the \entry macro, since index entries might consist -% of hyphenated-identifiers-that-do-not-fit-on-a-line-and-nothing-else.) -\def\tocentry#1#2{\begingroup - \vskip 0pt plus1pt % allow a little stretch for the sake of nice page breaks - % Do not use \turnoffactive in these arguments. Since the toc is - % typeset in cmr, characters such as _ would come out wrong; we - % have to do the usual translation tricks. - \entry{#1}{#2}% -\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} @@ -4420,8 +4600,8 @@ \def\chapentryfonts{\secfonts \rm} \def\secentryfonts{\textfonts} -\let\subsecentryfonts = \textfonts -\let\subsubsecentryfonts = \textfonts +\def\subsecentryfonts{\textfonts} +\def\subsubsecentryfonts{\textfonts} \message{environments,} @@ -4448,10 +4628,10 @@ % The text. (`r' is open on the right, `e' somewhat less so on the left.) \setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt} % -\global\setbox\errorbox=\hbox to \dimen0{\hfil +\setbox\errorbox=\hbox to \dimen0{\hfil \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right. \advance\hsize by -2\dimen2 % Rules. - \vbox{ + \vbox{% \hrule height\dimen2 \hbox{\vrule width\dimen2 \kern3pt % Space to left of text. \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below. @@ -4465,14 +4645,13 @@ % One exception: @ is still an escape character, so that @end tex works. % But \@ or @@ will get a plain tex @ character. -\def\tex{\begingroup +\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 \catcode `\>=\other @@ -4488,6 +4667,7 @@ \let\!=\ptexexclam \let\i=\ptexi \let\indent=\ptexindent + \let\noindent=\ptexnoindent \let\{=\ptexlbrace \let\+=\tabalign \let\}=\ptexrbrace @@ -4498,10 +4678,11 @@ \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}% \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}% \def\@{@}% -\let\Etex=\endgroup} +} +% There is no need to define \Etex. % Define @lisp ... @end lisp. -% @lisp does a \begingroup so it can rebind things, +% @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. @@ -4512,19 +4693,6 @@ % have any width. \def\lisppar{\null\endgraf} -% 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. -% -{\obeyspaces % -\gdef\sepspaces{\obeyspaces\let =\tie}} - -% Define \obeyedspace to be our active space, whatever it is. This is -% for use in \parsearg. -{\sepspaces% -\global\let\obeyedspace= } - % This space is always present above and below environments. \newskip\envskipamount \envskipamount = 0pt @@ -4542,7 +4710,7 @@ \removelastskip % it's not a good place to break if the last penalty was \nobreak % or better ... - \ifnum\lastpenalty>10000 \else \penalty-50 \fi + \ifnum\lastpenalty<10000 \penalty-50 \fi \vskip\envskipamount \fi \fi @@ -4574,52 +4742,52 @@ % \newskip\lskip\newskip\rskip -\def\cartouche{% -\par % can't be in the midst of a paragraph. -\begingroup - \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=\comment - \vbox\bgroup - \baselineskip=0pt\parskip=0pt\lineskip=0pt - \carttop - \hbox\bgroup - \hskip\lskip - \vrule\kern3pt - \vbox\bgroup - \hsize=\cartinner - \kern3pt - \begingroup - \baselineskip=\normbskip - \lineskip=\normlskip - \parskip=\normpskip - \vskip -\parskip +\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=\comment + \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{% - \endgroup - \kern3pt - \egroup - \kern3pt\vrule - \hskip\rskip - \egroup - \cartbot - \egroup -\endgroup -}} + \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 - \inENV % This group ends at the end of the body \hfuzz = 12pt % Don't be fussy \sepspaces % Make spaces be word-separators rather than space tokens. \let\par = \lisppar % don't ignore blank lines @@ -4632,103 +4800,99 @@ \ifx\nonarrowing\relax \advance \leftskip by \lispnarrowing \exdentamount=\lispnarrowing - \let\exdent=\nofillexdent - \let\nonarrowing=\relax \fi + \let\exdent=\nofillexdent } -% Define the \E... control sequence only if we are inside the particular -% environment, so the error checking in \end will work. -% -% To end an @example-like environment, we first end the paragraph (via -% \afterenvbreak's vertical glue), and then the group. That way we keep -% the zero \parskip that the environments set -- \parskip glue will be -% inserted at the beginning of the next paragraph in the document, after -% the environment. +% 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\nonfillfinish{\afterenvbreak\endgroup} +\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 +} -% @lisp: indented, narrowed, typewriter font. -\def\lisp{\begingroup - \nonfillstart - \let\Elisp = \nonfillfinish - \tt - \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special. - \gobble % eat return +% 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 } -% @example: Same as @lisp. -\def\example{\begingroup \def\Eexample{\nonfillfinish\endgroup}\lisp} +% 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. -\def\smalllisp{\begingroup - \def\Esmalllisp{\nonfillfinish\endgroup}% - \def\Esmallexample{\nonfillfinish\endgroup}% - \smallexamplefonts - \lisp +% +\maketwodispenvs {lisp}{example}{% + \nonfillstart + \tt + \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special. + \gobble % eat return } -\let\smallexample = \smalllisp - -% @display: same as @lisp except keep current font. +% @display/@smalldisplay: same as @lisp except keep current font. % -\def\display{\begingroup +\makedispenv {display}{% \nonfillstart - \let\Edisplay = \nonfillfinish \gobble } -% -% @smalldisplay: @display plus smaller fonts. -% -\def\smalldisplay{\begingroup - \def\Esmalldisplay{\nonfillfinish\endgroup}% - \smallexamplefonts \rm - \display -} -% @format: same as @display except don't narrow margins. +% @format/@smallformat: same as @display except don't narrow margins. % -\def\format{\begingroup - \let\nonarrowing = t +\makedispenv{format}{% + \let\nonarrowing = t% \nonfillstart - \let\Eformat = \nonfillfinish \gobble } -% -% @smallformat: @format plus smaller fonts. -% -\def\smallformat{\begingroup - \def\Esmallformat{\nonfillfinish\endgroup}% - \smallexamplefonts \rm - \format -} -% @flushleft (same as @format). -% -\def\flushleft{\begingroup \def\Eflushleft{\nonfillfinish\endgroup}\format} +% @flushleft: same as @format, but doesn't obey \SETdispenvsize. +\envdef\flushleft{% + \let\nonarrowing = t% + \nonfillstart + \gobble +} +\let\Eflushleft = \afterenvbreak % @flushright. % -\def\flushright{\begingroup - \let\nonarrowing = t +\envdef\flushright{% + \let\nonarrowing = t% \nonfillstart - \let\Eflushright = \nonfillfinish \advance\leftskip by 0pt plus 1fill \gobble } +\let\Eflushright = \afterenvbreak % @quotation does normal linebreaking (hence we can't use \nonfillstart) -% and narrows the margins. +% 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. % -\def\quotation{% - \begingroup\inENV %This group ends at the end of the @quotation body +\envdef\quotation{% {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip \parindent=0pt - % We have retained a nonzero parskip for the environment, since we're - % doing normal filling. So to avoid extra space below the environment... - \def\Equotation{\parskip = 0pt \nonfillfinish}% % % @cartouche defines \nonarrowing to inhibit narrowing at next level down. \ifx\nonarrowing\relax @@ -4737,6 +4901,27 @@ \exdentamount = \lispnarrowing \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 } @@ -4758,7 +4943,7 @@ % % [Knuth] p. 380 \def\uncatcodespecials{% - \def\do##1{\catcode`##1=12}\dospecials} + \def\do##1{\catcode`##1=\other}\dospecials} % % [Knuth] pp. 380,381,391 % Disable Spanish ligatures ?` and !` of \tt font @@ -4806,6 +4991,8 @@ } \endgroup \def\setupverbatim{% + \nonfillstart + \advance\leftskip by -\defbodyindent % Easiest (and conventionally used) font for verbatim \tt \def\par{\leavevmode\egroup\box0\endgraf}% @@ -4827,7 +5014,7 @@ % % [Knuth] p. 382; only eat outer {} \begingroup - \catcode`[=1\catcode`]=2\catcode`\{=12\catcode`\}=12 + \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next] \endgroup % @@ -4844,13 +5031,6 @@ % we need not redefine '\', '{' and '}'. % % Inspired by LaTeX's verbatim command set [latex.ltx] -%% Include LaTeX hack for completeness -- never know -%% \begingroup -%% \catcode`|=0 \catcode`[=1 -%% \catcode`]=2\catcode`\{=12\catcode`\}=12\catcode`\ =\active -%% \catcode`\\=12|gdef|doverbatim#1@end verbatim[ -%% #1|endgroup|def|Everbatim[]|end[verbatim]] -%% |endgroup % \begingroup \catcode`\ =\active @@ -4858,49 +5038,28 @@ % 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. - \gdef\doverbatim#1^^M#2@end verbatim{#2\end{verbatim}}% + \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 % -\def\verbatim{% - \def\Everbatim{\nonfillfinish\endgroup}% - \begingroup - \nonfillstart - \advance\leftskip by -\defbodyindent - \begingroup\setupverbatim\doverbatim +\envdef\verbatim{% + \setupverbatim\doverbatim } +\let\Everbatim = \afterenvbreak + % @verbatiminclude FILE - insert text of file in verbatim environment. % -% Allow normal characters that we make active in the argument (a file name). -\def\verbatiminclude{% - \begingroup - \catcode`\\=\other - \catcode`~=\other - \catcode`^=\other - \catcode`_=\other - \catcode`|=\other - \catcode`<=\other - \catcode`>=\other - \catcode`+=\other - \parsearg\doverbatiminclude -} -\def\setupverbatiminclude{% - \begingroup - \nonfillstart - \advance\leftskip by -\defbodyindent - \begingroup\setupverbatim -} +\def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude} % \def\doverbatiminclude#1{% - % Restore active chars for included file. - \endgroup - \begingroup - \let\value=\expandablevalue - \def\thisfile{#1}% - \expandafter\expandafter\setupverbatiminclude\input\thisfile - \endgroup - \nonfillfinish - \endgroup + {% + \makevalueexpandable + \setupverbatim + \input #1 + \afterenvbreak + }% } % @copying ... @end copying. @@ -4975,580 +5134,335 @@ \message{defuns,} % @defun etc. -% Allow user to change definition object font (\df) internally -\def\setdeffont#1 {\csname DEF#1\endcsname} - \newskip\defbodyindent \defbodyindent=.4in \newskip\defargsindent \defargsindent=50pt \newskip\deflastargmargin \deflastargmargin=18pt -\newcount\parencount - -% 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 = ) - -{\activeparens % Now, smart parens don't turn on until &foo (see \amprm) - -% 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. -\global\let(=\lparen \global\let)=\rparen -\global\let[=\lbrack \global\let]=\rbrack - -\gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 } -\gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb} -% This is used to turn on special parens -% but make & act ordinary (given that it's active). -\gdef\boldbraxnoamp{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb\let&=\ampnr} - -% Definitions of (, ) and & used in args for functions. -% This is the definition of ( outside of all parentheses. -\gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested - \global\advance\parencount by 1 -} -% -% This is the definition of ( when already inside a level of parens. -\gdef\opnested{\char`\(\global\advance\parencount by 1 } -% -\gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0. - % also in that case restore the outer-level definition of (. - \ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi - \global\advance \parencount by -1 } -% If we encounter &foo, then turn on ()-hacking afterwards -\gdef\amprm#1 {{\rm\}\let(=\oprm \let)=\clrm\ } -% -\gdef\normalparens{\boldbrax\let&=\ampnr} -} % End of definition inside \activeparens -%% These parens (in \boldbrax) actually are a little bolder than the -%% contained text. This is especially needed for [ and ] -\def\opnr{{\sf\char`\(}\global\advance\parencount by 1 } -\def\clnr{{\sf\char`\)}\global\advance\parencount by -1 } -\let\ampnr = \& -\def\lbrb{{\bf\char`\[}} -\def\rbrb{{\bf\char`\]}} - -% Active &'s sneak into the index arguments, so make sure it's defined. -{ - \catcode`& = \active - \global\let& = \ampnr -} - -% \defname, which formats the name of the @def (not the args). -% #1 is the function name. -% #2 is the type of definition, such as "Function". -% -\def\defname#1#2{% - % How we'll output 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. - \ifempty{#2}% - \def\defnametype{}% +% Start the processing of @deffn: +\def\startdefun{% + \ifnum\lastpenalty<10000 + \medbreak \else - \def\defnametype{[\rm #2]}% + % 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 for penalty 10002 (inserted by + % \defargscommonending) instead of 10000, since the sectioning + % commands insert a \penalty10000, 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 % - % Get the values of \leftskip and \rightskip as they were outside the @def... - \dimen2=\leftskip - \advance\dimen2 by -\defbodyindent - % - % Figure out values for the paragraph shape. - \setbox0=\hbox{\hskip \deflastargmargin{\defnametype}}% - \dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line - \dimen1=\hsize \advance \dimen1 by -\defargsindent % size for continuations - \parshape 2 0in \dimen0 \defargsindent \dimen1 - % - % Output arg 2 ("Function" or some such) but stuck inside a box of - % width 0 so it does not interfere with linebreaking. - \noindent - % - {% Adjust \hsize to exclude the ambient margins, - % so that \rightline will obey them. - \advance \hsize by -\dimen2 - \dimen3 = 0pt % was -1.25pc - \rlap{\rightline{\defnametype\kern\dimen3}}% - }% - % - % Allow all lines to be underfull without complaint: - \tolerance=10000 \hbadness=10000 - \advance\leftskip by -\defbodyindent - \exdentamount=\defbodyindent - {\df #1}\enskip % output function name - % \defunargs will be called next to output the arguments, if any. -} - -% Common pieces to start any @def... -% #1 is the \E... control sequence to end the definition (which we define). -% #2 is the \...x control sequence (which our caller defines). -% #3 is the control sequence to process the header, such as \defunheader. -% -\def\parsebodycommon#1#2#3{% - \begingroup\inENV - % 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 want to allow a - % break after all. Check for penalty 10002 (inserted by - % \defargscommonending) instead of 10000, since the sectioning - % commands insert a \penalty10000, and we don't want to allow a break - % between a section heading and a defun. - \ifnum\lastpenalty=10002 \penalty0 \fi - \medbreak - % - % Define the \E... end token that this defining construct specifies - % so that it will exit this group. - \def#1{\endgraf\endgroup\medbreak}% - % \parindent=0in \advance\leftskip by \defbodyindent \exdentamount=\defbodyindent } -% Common part of the \...x definitions. -% -\def\defxbodycommon{% - % As with \parsebodycommon above, allow line break if we have multiple - % x headers in a row. It's not a great place, though. - \ifnum\lastpenalty=10000 \penalty1000 \fi +\def\dodefunx#1{% + % First, check whether we are in the right environment: + \checkenv#1% % - \begingroup\obeylines + % 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{} -% Process body of @defun, @deffn, @defmac, etc. +% \printdefunline \deffnheader{text} % -\def\defparsebody#1#2#3{% - \parsebodycommon{#1}{#2}{#3}% - \def#2{\defxbodycommon \activeparens \spacesplit#3}% - \catcode\equalChar=\active - \begingroup\obeylines\activeparens - \spacesplit#3% +\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 } -% #1, #2, #3 are the common arguments (see \parsebodycommon above). -% #4, delimited by the space, is the class name. -% -\def\defmethparsebody#1#2#3#4 {% - \parsebodycommon{#1}{#2}{#3}% - \def#2##1 {\defxbodycommon \activeparens \spacesplit{#3{##1}}}% - \begingroup\obeylines\activeparens - % The \empty here prevents misinterpretation of a construct such as - % @deffn {whatever} {Enharmonic comma} - % See comments at \deftpparsebody, although in our case we don't have - % to remove the \empty afterwards, since it is empty. - \spacesplit{#3{#4}}\empty -} +\def\Edefun{\endgraf\medbreak} -% Used for @deftypemethod and @deftypeivar. -% #1, #2, #3 are the common arguments (see \defparsebody). -% #4, delimited by a space, is the class name. -% #5 is the method's return type. +% \makedefun{deffn} creates \deffn, \deffnx and \Edeffn; +% the only thing remainnig is to define \deffnheader. % -\def\deftypemethparsebody#1#2#3#4 #5 {% - \parsebodycommon{#1}{#2}{#3}% - \def#2##1 ##2 {\defxbodycommon \activeparens \spacesplit{#3{##1}{##2}}}% - \begingroup\obeylines\activeparens - \spacesplit{#3{#4}{#5}}% +\def\makedefun#1{% + \expandafter\let\csname E#1\endcsname = \Edefun + \edef\temp{\noexpand\domakedefun + \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}% + \temp } -% Used for @deftypeop. The change from \deftypemethparsebody is an -% extra argument at the beginning which is the `category', instead of it -% being the hardwired string `Method' or `Instance Variable'. We have -% to account for this both in the \...x definition and in parsing the -% input at hand. Thus also need a control sequence (passed as #5) for -% the \E... definition to assign the category name to. +% \domakedefun \deffn \deffnx \deffnheader % -\def\deftypeopparsebody#1#2#3#4#5 #6 {% - \parsebodycommon{#1}{#2}{#3}% - \def#2##1 ##2 ##3 {\def#4{##1}% - \defxbodycommon \activeparens \spacesplit{#3{##2}{##3}}}% - \begingroup\obeylines\activeparens - \spacesplit{#3{#5}{#6}}% -} - -% For @defop. -\def\defopparsebody #1#2#3#4#5 {% - \parsebodycommon{#1}{#2}{#3}% - \def#2##1 ##2 {\def#4{##1}% - \defxbodycommon \activeparens \spacesplit{#3{##2}}}% - \begingroup\obeylines\activeparens - \spacesplit{#3{#5}}% -} - -% These parsing functions are similar to the preceding ones -% except that they do not make parens into active characters. -% These are used for "variables" since they have no arguments. +% Define \deffn and \deffnx, without parameters. +% \deffnheader has to be defined explicitly. % -\def\defvarparsebody #1#2#3{% - \parsebodycommon{#1}{#2}{#3}% - \def#2{\defxbodycommon \spacesplit#3}% - \catcode\equalChar=\active - \begingroup\obeylines - \spacesplit#3% -} - -% @defopvar. -\def\defopvarparsebody #1#2#3#4#5 {% - \parsebodycommon{#1}{#2}{#3}% - \def#2##1 ##2 {\def#4{##1}% - \defxbodycommon \spacesplit{#3{##2}}}% - \begingroup\obeylines - \spacesplit{#3{#5}}% -} - -\def\defvrparsebody#1#2#3#4 {% - \parsebodycommon{#1}{#2}{#3}% - \def#2##1 {\defxbodycommon \spacesplit{#3{##1}}}% - \begingroup\obeylines - \spacesplit{#3{#4}}% +\def\domakedefun#1#2#3{% + \envdef#1{% + \startdefun + \parseargusing\activeparens{\printdefunline#3}% + }% + \def#2{\dodefunx#1}% + \def#3% } -% This loses on `@deftp {Data Type} {struct termios}' -- it thinks the -% type is just `struct', because we lose the braces in `{struct -% termios}' when \spacesplit reads its undelimited argument. Sigh. -% \let\deftpparsebody=\defvrparsebody -% -% So, to get around this, we put \empty in with the type name. That -% way, TeX won't find exactly `{...}' as an undelimited argument, and -% won't strip off the braces. -% -\def\deftpparsebody #1#2#3#4 {% - \parsebodycommon{#1}{#2}{#3}% - \def#2##1 {\defxbodycommon \spacesplit{#3{##1}}}% - \begingroup\obeylines - \spacesplit{\parsetpheaderline{#3{#4}}}\empty -} - -% Fine, but then we have to eventually remove the \empty *and* the -% braces (if any). That's what this does. -% -\def\removeemptybraces\empty#1\relax{#1} - -% After \spacesplit has done its work, this is called -- #1 is the final -% thing to call, #2 the type name (which starts with \empty), and #3 -% (which might be empty) the arguments. -% -\def\parsetpheaderline#1#2#3{% - #1{\removeemptybraces#2\relax}{#3}% -}% +%%% Untyped functions: -% Split up #2 (the rest of the input line) at the first space token. -% call #1 with two arguments: -% the first is all of #2 before the space token, -% the second is all of #2 after that space token. -% If #2 contains no space token, all of it is passed as the first arg -% and the second is passed as empty. -% -{\obeylines % - \gdef\spacesplit#1#2^^M{\endgroup\spacesplitx{#1}#2 \relax\spacesplitx}% - \long\gdef\spacesplitx#1#2 #3#4\spacesplitx{% - \ifx\relax #3% - #1{#2}{}% - \else % - #1{#2}{#3#4}% - \fi}% -} +% @deffn category name args +\makedefun{deffn}{\deffngeneral{}} -% Define @defun. +% @deffn category class name args +\makedefun{defop}#1 {\defopon{#1\ \putwordon}} -% This is called to end the arguments processing for all the @def... commands. -% -\def\defargscommonending{% - \interlinepenalty = 10000 - \advance\rightskip by 0pt plus 1fil - \endgraf - \nobreak\vskip -\parskip - \penalty 10002 % signal to \parsebodycommon. -} +% \defopon {category on}class name args +\def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } -% This expands the args and terminates the paragraph they comprise. +% \deffngeneral {subind}category name args % -\def\defunargs#1{\functionparens \sl -% Expand, preventing hyphenation at `-' chars. -% Note that groups don't affect changes in \hyphenchar. -% Set the font temporarily and use \font in case \setfont made \tensl a macro. -{\tensl\hyphenchar\font=0}% -#1% -{\tensl\hyphenchar\font=45}% -\ifnum\parencount=0 \else \errmessage{Unbalanced parentheses in @def}\fi% - \defargscommonending +\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}% } -\def\deftypefunargs #1{% -% Expand, preventing hyphenation at `-' chars. -% Note that groups don't affect changes in \hyphenchar. -% Use \boldbraxnoamp, not \functionparens, so that & is not special. -\boldbraxnoamp -\tclose{#1}% avoid \code because of side effects on active chars - \defargscommonending -} +%%% Typed functions: -% Do complete processing of one @defun or @defunx line already parsed. +% @deftypefn category type name args +\makedefun{deftypefn}{\deftypefngeneral{}} -% @deffn Command forward-char nchars +% @deftypeop category class type name args +\makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}} -\def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader} +% \deftypeopon {category on}class type name args +\def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } -\def\deffnheader #1#2#3{\doind {fn}{\code{#2}}% -\begingroup\defname {#2}{#1}\defunargs{#3}\endgroup % -\catcode\equalChar=\other % Turn off change made in \defparsebody -} - -% @defun == @deffn Function - -\def\defun{\defparsebody\Edefun\defunx\defunheader} - -\def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index -\begingroup\defname {#1}{\putwordDeffunc}% -\defunargs {#2}\endgroup % -\catcode\equalChar=\other % Turn off change made in \defparsebody +% \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}% } -% @deftypefun int foobar (int @var{foo}, float @var{bar}) +%%% Typed variables: -\def\deftypefun{\defparsebody\Edeftypefun\deftypefunx\deftypefunheader} +% @deftypevr category type var args +\makedefun{deftypevr}{\deftypecvgeneral{}} -% #1 is the data type. #2 is the name and args. -\def\deftypefunheader #1#2{\deftypefunheaderx{#1}#2 \relax} -% #1 is the data type, #2 the name, #3 the args. -\def\deftypefunheaderx #1#2 #3\relax{% -\doind {fn}{\code{#2}}% Make entry in function index -\begingroup\defname {\defheaderxcond#1\relax$.$#2}{\putwordDeftypefun}% -\deftypefunargs {#3}\endgroup % -\catcode\equalChar=\other % Turn off change made in \defparsebody -} +% @deftypecv category class type var args +\makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}} -% @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar}) +% \deftypecvof {category of}class type var args +\def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} } -\def\deftypefn{\defmethparsebody\Edeftypefn\deftypefnx\deftypefnheader} - -% \defheaderxcond#1\relax$.$ -% puts #1 in @code, followed by a space, but does nothing if #1 is null. -\def\defheaderxcond#1#2$.${\ifx#1\relax\else\code{#1#2} \fi} - -% #1 is the classification. #2 is the data type. #3 is the name and args. -\def\deftypefnheader #1#2#3{\deftypefnheaderx{#1}{#2}#3 \relax} -% #1 is the classification, #2 the data type, #3 the name, #4 the args. -\def\deftypefnheaderx #1#2#3 #4\relax{% -\doind {fn}{\code{#3}}% Make entry in function index -\begingroup -\normalparens % notably, turn off `&' magic, which prevents -% at least some C++ text from working -\defname {\defheaderxcond#2\relax$.$#3}{#1}% -\deftypefunargs {#4}\endgroup % -\catcode\equalChar=\other % Turn off change made in \defparsebody +% \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}% } -% @defmac == @deffn Macro - -\def\defmac{\defparsebody\Edefmac\defmacx\defmacheader} +%%% Untyped variables: -\def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index -\begingroup\defname {#1}{\putwordDefmac}% -\defunargs {#2}\endgroup % -\catcode\equalChar=\other % Turn off change made in \defparsebody -} +% @defvr category var args +\makedefun{defvr}#1 {\deftypevrheader{#1} {} } -% @defspec == @deffn Special Form +% @defcv category class var args +\makedefun{defcv}#1 {\defcvof{#1\ \putwordof}} -\def\defspec{\defparsebody\Edefspec\defspecx\defspecheader} +% \defcvof {category of}class var args +\def\defcvof#1#2 {\deftypecvof{#1}#2 {} } -\def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index -\begingroup\defname {#1}{\putwordDefspec}% -\defunargs {#2}\endgroup % -\catcode\equalChar=\other % Turn off change made in \defparsebody +%%% Type: +% @deftp category name args +\makedefun{deftp}#1 #2 #3\endheader{% + \doind{tp}{\code{#2}}% + \defname{#1}{}{#2}\defunargs{#3\unskip}% } -% @defop CATEGORY CLASS OPERATION ARG... -% -\def\defop #1 {\def\defoptype{#1}% -\defopparsebody\Edefop\defopx\defopheader\defoptype} -% -\def\defopheader#1#2#3{% - \dosubind{fn}{\code{#2}}{\putwordon\ \code{#1}}% function index entry - \begingroup - \defname{#2}{\defoptype\ \putwordon\ #1}% - \defunargs{#3}% - \endgroup -} +% 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} -% @deftypeop CATEGORY CLASS TYPE OPERATION ARG... -% -\def\deftypeop #1 {\def\deftypeopcategory{#1}% - \deftypeopparsebody\Edeftypeop\deftypeopx\deftypeopheader - \deftypeopcategory} -% -% #1 is the class name, #2 the data type, #3 the operation name, #4 the args. -\def\deftypeopheader#1#2#3#4{% - \dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index - \begingroup - \defname{\defheaderxcond#2\relax$.$#3} - {\deftypeopcategory\ \putwordon\ \code{#1}}% - \deftypefunargs{#4}% - \endgroup -} - -% @deftypemethod CLASS TYPE METHOD ARG... -% -\def\deftypemethod{% - \deftypemethparsebody\Edeftypemethod\deftypemethodx\deftypemethodheader} -% -% #1 is the class name, #2 the data type, #3 the method name, #4 the args. -\def\deftypemethodheader#1#2#3#4{% - \dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index - \begingroup - \defname{\defheaderxcond#2\relax$.$#3}{\putwordMethodon\ \code{#1}}% - \deftypefunargs{#4}% - \endgroup -} - -% @deftypeivar CLASS TYPE VARNAME +% \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. % -\def\deftypeivar{% - \deftypemethparsebody\Edeftypeivar\deftypeivarx\deftypeivarheader} +% We are followed by (but not passed) the arguments, if any. % -% #1 is the class name, #2 the data type, #3 the variable name. -\def\deftypeivarheader#1#2#3{% - \dosubind{vr}{\code{#3}}{\putwordof\ \code{#1}}% entry in variable index - \begingroup - \defname{\defheaderxcond#2\relax$.$#3} - {\putwordInstanceVariableof\ \code{#1}}% - \defvarargs{#3}% - \endgroup +\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. } -% @defmethod == @defop Method -% -\def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader} +% 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. % -% #1 is the class name, #2 the method name, #3 the args. -\def\defmethodheader#1#2#3{% - \dosubind{fn}{\code{#2}}{\putwordon\ \code{#1}}% entry in function index - \begingroup - \defname{#2}{\putwordMethodon\ \code{#1}}% - \defunargs{#3}% - \endgroup -} - -% @defcv {Class Option} foo-class foo-flag - -\def\defcv #1 {\def\defcvtype{#1}% -\defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype} - -\def\defcvarheader #1#2#3{% - \dosubind{vr}{\code{#2}}{\putwordof\ \code{#1}}% variable index entry - \begingroup - \defname{#2}{\defcvtype\ \putwordof\ #1}% - \defvarargs{#3}% - \endgroup +\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 } -% @defivar CLASS VARNAME == @defcv {Instance Variable} CLASS VARNAME -% -\def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader} +% We want ()&[] to print specially on the defun line. % -\def\defivarheader#1#2#3{% - \dosubind{vr}{\code{#2}}{\putwordof\ \code{#1}}% entry in var index - \begingroup - \defname{#2}{\putwordInstanceVariableof\ #1}% - \defvarargs{#3}% - \endgroup -} - -% @defvar -% First, define the processing that is wanted for arguments of @defvar. -% This is actually simple: just print them in roman. -% This must expand the args and terminate the paragraph they make up -\def\defvarargs #1{\normalparens #1% - \defargscommonending -} - -% @defvr Counter foo-count - -\def\defvr{\defvrparsebody\Edefvr\defvrx\defvrheader} - -\def\defvrheader #1#2#3{\doind {vr}{\code{#2}}% -\begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup} - -% @defvar == @defvr Variable - -\def\defvar{\defvarparsebody\Edefvar\defvarx\defvarheader} - -\def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index -\begingroup\defname {#1}{\putwordDefvar}% -\defvarargs {#2}\endgroup % -} - -% @defopt == @defvr {User Option} - -\def\defopt{\defvarparsebody\Edefopt\defoptx\defoptheader} - -\def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index -\begingroup\defname {#1}{\putwordDefopt}% -\defvarargs {#2}\endgroup % +\def\activeparens{% + \catcode`\(=\active \catcode`\)=\active + \catcode`\[=\active \catcode`\]=\active + \catcode`\&=\active } -% @deftypevar int foobar - -\def\deftypevar{\defvarparsebody\Edeftypevar\deftypevarx\deftypevarheader} - -% #1 is the data type. #2 is the name, perhaps followed by text that -% is actually part of the data type, which should not be put into the index. -\def\deftypevarheader #1#2{% -\dovarind#2 \relax% Make entry in variables index -\begingroup\defname {\defheaderxcond#1\relax$.$#2}{\putwordDeftypevar}% - \defargscommonending -\endgroup} -\def\dovarind#1 #2\relax{\doind{vr}{\code{#1}}} - -% @deftypevr {Global Flag} int enable - -\def\deftypevr{\defvrparsebody\Edeftypevr\deftypevrx\deftypevrheader} +% Make control sequences which act like normal parenthesis chars. +\let\lparen = ( \let\rparen = ) -\def\deftypevrheader #1#2#3{\dovarind#3 \relax% -\begingroup\defname {\defheaderxcond#2\relax$.$#3}{#1} - \defargscommonending -\endgroup} +% 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& = \& -% Now define @deftp -% Args are printed in bold, a slight difference from @defvar. + \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb} + \gdef\magicamp{\let&=\amprm} +} -\def\deftpargs #1{\bf \defvarargs{#1}} +\newcount\parencount -% @deftp Class window height width ... +% 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\deftp{\deftpparsebody\Edeftp\deftpx\deftpheader} +\def\opnr{% + \global\advance\parencount by 1 + {\parenfont(}% + \infirstlevel \bfafterword +} +\def\clnr{% + {\parenfont)}% + \infirstlevel \sl + \global\advance\parencount by -1 +} -\def\deftpheader #1#2#3{\doind {tp}{\code{#2}}% -\begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup} +\newcount\brackcount +\def\lbrb{% + \global\advance\brackcount by 1 + {\bf[}% +} +\def\rbrb{% + {\bf]}% + \global\advance\brackcount by -1 +} -% These definitions are used if you use @defunx (etc.) -% anywhere other than immediately after a @defun or @defunx. -% -\def\defcvx#1 {\errmessage{@defcvx in invalid context}} -\def\deffnx#1 {\errmessage{@deffnx in invalid context}} -\def\defivarx#1 {\errmessage{@defivarx in invalid context}} -\def\defmacx#1 {\errmessage{@defmacx in invalid context}} -\def\defmethodx#1 {\errmessage{@defmethodx in invalid context}} -\def\defoptx #1 {\errmessage{@defoptx in invalid context}} -\def\defopx#1 {\errmessage{@defopx in invalid context}} -\def\defspecx#1 {\errmessage{@defspecx in invalid context}} -\def\deftpx#1 {\errmessage{@deftpx in invalid context}} -\def\deftypefnx#1 {\errmessage{@deftypefnx in invalid context}} -\def\deftypefunx#1 {\errmessage{@deftypefunx in invalid context}} -\def\deftypeivarx#1 {\errmessage{@deftypeivarx in invalid context}} -\def\deftypemethodx#1 {\errmessage{@deftypemethodx in invalid context}} -\def\deftypeopx#1 {\errmessage{@deftypeopx in invalid context}} -\def\deftypevarx#1 {\errmessage{@deftypevarx in invalid context}} -\def\deftypevrx#1 {\errmessage{@deftypevrx in invalid context}} -\def\defunx#1 {\errmessage{@defunx in invalid context}} -\def\defvarx#1 {\errmessage{@defvarx in invalid context}} -\def\defvrx#1 {\errmessage{@defvrx in invalid context}} +\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,} @@ -5557,28 +5471,33 @@ % 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\scanmacro#1{% - \begingroup \newlinechar`\^^M - % Undo catcode changes of \startcontents and \doprintindex - \catcode`\@=0 \catcode`\\=\other \escapechar=`\@ - % Append \endinput to make sure that TeX does not see the ending newline. - \toks0={#1\endinput}% - \immediate\openout\macscribble=\jobname.tmp - \immediate\write\macscribble{\the\toks0}% - \immediate\closeout\macscribble - \let\xeatspaces\eatspaces - \input \jobname.tmp - \endgroup -} -\else -\def\scanmacro#1{% -\begingroup \newlinechar`\^^M -% Undo catcode changes of \startcontents and \doprintindex -\catcode`\@=0 \catcode`\\=\other \escapechar=`\@ -\let\xeatspaces\eatspaces\scantokens{#1\endinput}\endgroup} + \newwrite\macscribble + \def\scantokens#1{% + \toks0={#1\endinput}% + \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 + \catcode`\@=0 \catcode`\\=\other \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 +} + \newcount\paramno % Count of parameters \newtoks\macname % Macro name \newif\ifrecursive % Is it recursive? @@ -5586,7 +5505,7 @@ % \do\macro1\do\macro2... % Utility routines. -% Thisdoes \let #1 = #2, except with \csnames. +% This does \let #1 = #2, except with \csnames. \def\cslet#1#2{% \expandafter\expandafter \expandafter\let @@ -5683,8 +5602,7 @@ \else \expandafter\parsemacbody \fi} -\def\unmacro{\parsearg\dounmacro} -\def\dounmacro#1{% +\parseargdef\unmacro{% \if1\csname ismacro.#1\endcsname \global\cslet{#1}{macsave.#1}% \global\expandafter\let \csname ismacro.#1\endcsname=0% @@ -5825,25 +5743,41 @@ \expandafter\parsearg \fi \next} -% We mant to disable all macros during \shipout so that they are not +% We want to disable all macros during \shipout so that they are not % expanded by \write. \def\turnoffmacros{\begingroup \def\do##1{\let\noexpand##1=\relax}% \edef\next{\macrolist}\expandafter\endgroup\next} +% For \indexnofonts, 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. +% +\def\emptyusermacros{\begingroup + \def\do##1{\let\noexpand##1=\noexpand\asis}% + \edef\next{\macrolist}\expandafter\endgroup\next} + % @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{\begingroup\obeyspaces\parsearg\aliasxxx} +\def\alias{\parseargusing\obeyspaces\aliasxxx} \def\aliasxxx #1{\aliasyyy#1\relax} -\def\aliasyyy #1=#2\relax{\ignoreactivespaces -\edef\next{\global\let\expandafter\noexpand\csname#1\endcsname=% - \expandafter\noexpand\csname#2\endcsname}% -\expandafter\endgroup\next} +\def\aliasyyy #1=#2\relax{% + {% + \expandafter\let\obeyedspace=\empty + \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}% + }% + \next +} \message{cross references,} -% @xref etc. \newwrite\auxfile @@ -5855,64 +5789,70 @@ \def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}}, node \samp{\ignorespaces#1{}}} -% @node's job is to define \lastnode. -\def\node{\ENVcheck\parsearg\nodezzz} -\def\nodezzz#1{\nodexxx #1,\finishnodeparse} -\def\nodexxx#1,#2\finishnodeparse{\gdef\lastnode{#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=\relax - -% The sectioning commands (@chapter, etc.) call these. -\def\donoderef{% - \ifx\lastnode\relax\else - \expandafter\expandafter\expandafter\setref{\lastnode}% - {Ysectionnumberandtype}% - \global\let\lastnode=\relax - \fi -} -\def\unnumbnoderef{% - \ifx\lastnode\relax\else - \expandafter\expandafter\expandafter\setref{\lastnode}{Ynothing}% - \global\let\lastnode=\relax - \fi -} -\def\appendixnoderef{% - \ifx\lastnode\relax\else - \expandafter\expandafter\expandafter\setref{\lastnode}% - {Yappendixletterandtype}% - \global\let\lastnode=\relax +\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 -\gdef\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi} -\gdef\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi} -\gdef\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces} +% +\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), namely NAME-title (the corresponding @chapter/etc. name), -% NAME-pg (the page number), and NAME-snt (section number and type). -% Called from \foonoderef. -% -% We have to set \indexdummies so commands such as @code in a section -% title aren't expanded. It would be nicer not to expand the titles in -% the first place, but there's so many layers that that is hard to do. -% -% Likewise, use \turnoffactive so that punctuation chars such as underscore -% and backslash work in node names. -% -\def\setref#1#2{{% - \atdummies +% 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}% - % - \turnoffactive - \dosetq{#1-title}{Ytitle}% - \dosetq{#1-pg}{Ypagenumber}% - \dosetq{#1-snt}{#2}% -}} + \iflinks + {% + \atdummies % preserve commands, but don't expand them + \turnoffactive + \otherbackslash + \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 @@ -5925,38 +5865,33 @@ \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup \unsepspaces \def\printedmanual{\ignorespaces #5}% - \def\printednodename{\ignorespaces #3}% - \setbox1=\hbox{\printedmanual}% - \setbox0=\hbox{\printednodename}% + \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\printednodename{\ignorespaces #1}% + \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\printednodename{\ignorespaces #1}% + \def\printedrefname{\ignorespaces #1}% \else \ifhavexrefs % We know the real title if we have the xref values. - \def\printednodename{\refx{#1-title}{}}% + \def\printedrefname{\refx{#1-title}{}}% \else % Otherwise just copy the Info node name. - \def\printednodename{\ignorespaces #1}% + \def\printedrefname{\ignorespaces #1}% \fi% \fi \fi \fi % - % 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. + % Make link in pdf output. \ifpdf \leavevmode \getfilename{#4}% @@ -5966,64 +5901,86 @@ goto file{\the\filename.pdf} name{#1}% \else \startlink attr{/Border [0 0 0]}% - goto name{#1}% + goto name{\pdfmkpgn{#1}}% \fi }% \linkcolor \fi % - \ifdim \wd1 > 0pt - \putwordsection{} ``\printednodename'' \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 \otherbackslash - % 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. - \xrefprintnodename\printednodename + % 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 + \otherbackslash + \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 % - % But we always want a comma and a space: - ,\space + % 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. % - % output the `page 3'. - \turnoffactive \otherbackslash \putwordpage\tie\refx{#1-pg}{}% + % 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 \otherbackslash + % 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 \otherbackslash \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 not square brackets don't work in some documents. Particularly +% since square brackets don't work well in some documents. Particularly % one that Bob is working on :). % \def\xrefprintnodename#1{[#1]} -% \dosetq is called from \setref to do the actual \write (\iflinks). -% -\def\dosetq#1#2{% - {\let\folio=0% - \edef\next{\write\auxfile{\internalsetq{#1}{#2}}}% - \iflinks \next \fi - }% -} - -% \internalsetq{foo}{page} expands into -% CHARACTERS @xrdef{foo}{...expansion of \page...} -\def\internalsetq#1#2{@xrdef{#1}{\csname #2\endcsname}} - -% Things to be expanded by \internalsetq. +% Things referred to by \setref. % -\def\Ypagenumber{\folio} -\def\Ytitle{\thissection} \def\Ynothing{} -\def\Ysectionnumberandtype{% +\def\Yomitfromtoc{} +\def\Ynumbered{% \ifnum\secno=0 \putwordChapter@tie \the\chapno \else \ifnum\subsecno=0 @@ -6034,8 +5991,7 @@ \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno \fi\fi\fi } - -\def\Yappendixletterandtype{% +\def\Yappendix{% \ifnum\secno=0 \putwordAppendix@tie @char\the\appendixno{}% \else \ifnum\subsecno=0 @@ -6048,15 +6004,6 @@ \fi\fi\fi } -% 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{\the\inputlineno:\space} -\fi - % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME. % If its value is nonempty, SUFFIX is output afterward. % @@ -6065,7 +6012,7 @@ \indexnofonts \otherbackslash \expandafter\global\expandafter\let\expandafter\thisrefX - \csname X#1\endcsname + \csname XR#1\endcsname }% \ifx\thisrefX\relax % If not defined, say something at least. @@ -6087,11 +6034,44 @@ #2% Output the suffix in any case. } -% This is the macro invoked by entries in the aux file. +% 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{\expandafter\gdef\csname X#1\endcsname} +\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 + \readauxfile + \global\havexrefstrue + \fi + \closein 1 +} + \def\readauxfile{\begingroup \catcode`\^^@=\other \catcode`\^^A=\other @@ -6150,7 +6130,16 @@ \catcode`\%=\other \catcode`+=\other % avoid \+ for paranoia even though we've turned it off % - % Make the characters 128-255 be printing characters + % 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. {% \count 1=128 \def\loop{% @@ -6160,31 +6149,17 @@ }% }% % - % Turn off \ as an escape so we do not lose on - % entries which were dumped with control sequences in their names. - % For example, @xrdef{$\leq $-fun}{page ...} made by @defun ^^ - % Reference to such entries still does not work the way one would wish, - % but at least they do not bomb out when the aux file is read in. - \catcode`\\=\other - % - % @ is our escape character in .aux files. + % @ is our escape character in .aux files, and we need braces. \catcode`\{=1 \catcode`\}=2 \catcode`\@=0 % - \openin 1 \jobname.aux - \ifeof 1 \else - \closein 1 - \input \jobname.aux - \global\havexrefstrue - \global\warnedobstrue - \fi - % Open the new aux file. TeX will close it automatically at exit. - \openout\auxfile=\jobname.aux + \input \jobname.aux \endgroup} -% Footnotes. +\message{insertions,} +% including footnotes. \newcount \footnoteno @@ -6198,13 +6173,12 @@ % @footnotestyle is meaningful for info output only. \let\footnotestyle=\comment -\let\ptexfootnote=\footnote - {\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}$}% % @@ -6222,17 +6196,12 @@ % 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 fail inside footnotes because the tokens are fixed when +% 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. % -% The start of the footnote looks usually like this: -\gdef\startfootins{\insert\footins\bgroup} -% -% ... but this macro is redefined inside @multitable. -% \gdef\dofootnote{% - \startfootins + \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. @@ -6268,40 +6237,66 @@ } }%end \catcode `\@=11 -% @| 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). +% 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\|{% - % \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 - }% - }% +\def\startsavinginserts{% + \ifx \insert\ptexinsert + \let\insert\saveinsert + \else + \let\checkinserts\relax + \fi } -% 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). +% This \insert replacement works for both \insert\footins{foo} and +% \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}. % -\def\finalout{\overfullrule=0pt} +\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. @@ -6311,12 +6306,12 @@ % undone and the next image would fail. \openin 1 = epsf.tex \ifeof 1 \else - \closein 1 % 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 @@ -6372,6 +6367,252 @@ \endgroup} +% @float FLOATTYPE,LOC ... @end float for displayed figures, tables, etc. +% We don't actually implement floating yet, we just plop the float "here". +% But it seemed the best name for the future. +% +\envparseargdef\float{\dofloat #1,,,\finish} + +% #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. + \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\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 + \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 \turnoffactive \otherbackslash + \immediate\write\auxfile{@xrdef{\floatlabel-lof}{% + \floatident + \ifx\thisshortcaption\empty + \ifx\thiscaption\empty \else : \thiscaption \fi + \else + : \thisshortcaption + \fi + }}% + }% + \fi + % + % Space below caption, if we printed anything. + \ifx\printedsomething\empty \else \vskip\parskip \fi + \egroup % end of \vtop + \checkinserts +} + +% Append the tokens #2 to the definition of macro #1, not expanding either. +% +\newtoks\appendtomacroAtoks +\newtoks\appendtomacroBtoks +\def\appendtomacro#1#2{% + \appendtomacroAtoks = \expandafter{#1}% + \appendtomacroBtoks = {#2}% + \edef#1{\the\appendtomacroAtoks \the\appendtomacroBtoks}% +} + +% @caption, @shortcaption are easy. +% +\long\def\caption#1{\checkenv\float \def\thiscaption{#1}} +\def\shortcaption#1{\checkenv\float \def\thisshortcaption{#1}} + +% 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. @@ -6380,19 +6621,17 @@ % properly. Single argument is the language abbreviation. % It would be nice if we could set up a hyphenation file here. % -\def\documentlanguage{\parsearg\dodocumentlanguage} -\def\dodocumentlanguage#1{% +\parseargdef\documentlanguage{% \tex % read txi-??.tex file in plain TeX. - % Read the file if it exists. - \openin 1 txi-#1.tex - \ifeof1 - \errhelp = \nolanghelp - \errmessage{Cannot read language file txi-#1.tex}% - \let\temp = \relax - \else - \def\temp{\input txi-#1.tex }% - \fi - \temp + % 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 @@ -6575,8 +6814,7 @@ % Perhaps we should allow setting the margins, \topskip, \parskip, % and/or leading, also. Or perhaps we should compute them somehow. % -\def\pagesizes{\parsearg\pagesizesxxx} -\def\pagesizesxxx#1{\pagesizesyyy #1,,\finish} +\parseargdef\pagesizes{\pagesizesyyy #1,,\finish} \def\pagesizesyyy#1,#2,#3\finish{{% \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi \globaldefs = 1 @@ -6623,8 +6861,8 @@ \def\normalplus{+} \def\normaldollar{$}%$ font-lock fix -% This macro is used to make a character print one way in ttfont -% where it can probably just be output, and another way in other fonts, +% 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 @@ -6672,13 +6910,6 @@ \catcode`\$=\active \def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix -% Set up an active definition for =, but don't enable it most of the time. -{\catcode`\==\active -\global\def={{\tt \char 61}}} - -\catcode`+=\active -\catcode`\_=\active - % 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. @@ -6687,15 +6918,16 @@ \catcode`\@=0 -% \rawbackslashxx outputs one backslash character in current font, +% \backslashcurfont outputs one backslash character in current font, % as in \char`\\. -\global\chardef\rawbackslashxx=`\\ +\global\chardef\backslashcurfont=`\\ +\global\let\rawbackslashxx=\backslashcurfont % let existing .??s files work -% \rawbackslash defines an active \ to do \rawbackslashxx. +% \rawbackslash defines an active \ to do \backslashcurfont. % \otherbackslash defines an active \ to be a literal `\' character with % catcode other. {\catcode`\\=\active - @gdef@rawbackslash{@let\=@rawbackslashxx} + @gdef@rawbackslash{@let\=@backslashcurfont} @gdef@otherbackslash{@let\=@realbackslash} } @@ -6703,7 +6935,7 @@ {\catcode`\\=\other @gdef@realbackslash{\}} % \normalbackslash outputs one backslash in fixed width font. -\def\normalbackslash{{\tt\rawbackslashxx}} +\def\normalbackslash{{\tt\backslashcurfont}} \catcode`\\=\active @@ -6720,6 +6952,7 @@ @let>=@normalgreater @let+=@normalplus @let$=@normaldollar %$ font-lock fix + @unsepspaces } % Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of @@ -6759,10 +6992,6 @@ @catcode`@# = @other @catcode`@% = @other -@c Set initial fonts. -@textfonts -@rm - @c Local variables: @c eval: (add-hook 'write-file-hooks 'time-stamp) @@ -6771,3 +7000,9 @@ @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/eval.c b/eval.c index c1047421d..8d4416494 100644 --- a/eval.c +++ b/eval.c @@ -3,7 +3,7 @@ */ /* - * Copyright (C) 1986, 1988, 1989, 1991-2003 the Free Software Foundation, Inc. + * Copyright (C) 1986, 1988, 1989, 1991-2004 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. @@ -29,6 +29,7 @@ extern double pow P((double x, double y)); extern double modf P((double x, double *yp)); extern double fmod P((double x, double y)); +static inline void make_scalar P((NODE *tree)); static int eval_condition P((NODE *tree)); static NODE *op_assign P((NODE *tree)); static NODE *func_call P((NODE *tree)); @@ -90,9 +91,16 @@ extern int exiting, exit_val; * * Do NOT make this array static, it is used in several spots, not * just in this file. + * + * 6/2004: + * This table is also used for IGNORECASE for == and !=, and index(). + * Although with GLIBC, we could use tolower() everywhere and RE_ICASE + * for the regex matcher, precomputing this table once gives us a + * performance improvement. I also think it's better for portability + * to non-GLIBC systems. All the world is not (yet :-) GNU/Linux. */ #if 'a' == 97 /* it's ascii */ -const char casetable[] = { +char casetable[] = { '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007', '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017', '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027', @@ -146,6 +154,33 @@ const char casetable[] = { #undef C +/* load_casetable --- for a non-ASCII locale, redo the table */ + +void +load_casetable(void) +{ +#if defined(LC_CTYPE) + int i; + char *cp; + static int loaded = FALSE; + + if (loaded || do_traditional) + return; + + loaded = TRUE; + cp = setlocale(LC_CTYPE, NULL); + + /* this is not per standard, but it's pretty safe */ + if (cp == NULL || strcmp(cp, "C") == 0 || strcmp(cp, "POSIX") == 0) + return; + + for (i = 0200; i <= 0377; i++) { + if (isalpha(i) && islower(i) && i != toupper(i)) + casetable[i] = toupper(i); + } +#endif +} + /* * This table maps node types to strings for debugging. * KEEP IN SYNC WITH awk.h!!!! @@ -174,6 +209,7 @@ static const char *const nodetypes[] = { "Node_assign_plus", "Node_assign_minus", "Node_assign_exp", + "Node_assign_concat", "Node_and", "Node_or", "Node_equal", @@ -248,6 +284,7 @@ static const char *const nodetypes[] = { "Node_OFS", "Node_ORS", "Node_RS", + "Node_SUBSEP", "Node_TEXTDOMAIN", "Node_final --- this should never appear", NULL @@ -303,15 +340,15 @@ genflags2str(int flagval, const struct flagtab *tab) sp = buffer; space_left = BUFSIZ; for (i = 0; tab[i].name != NULL; i++) { - /* - * note the trick, we want 1 or 0 for whether we need - * the '|' character. - */ - space_needed = (strlen(tab[i].name) + (sp != buffer)); - if (space_left < space_needed) - fatal(_("buffer overflow in genflags2str")); - if ((flagval & tab[i].val) != 0) { + /* + * note the trick, we want 1 or 0 for whether we need + * the '|' character. + */ + space_needed = (strlen(tab[i].name) + (sp != buffer)); + if (space_left < space_needed) + fatal(_("buffer overflow in genflags2str")); + if (sp != buffer) { *sp++ = '|'; space_left--; @@ -326,6 +363,49 @@ genflags2str(int flagval, const struct flagtab *tab) return buffer; } +/* + * make_scalar --- make sure that tree is a scalar. + * + * tree is in a scalar context. If it is a variable, accomplish + * what's needed; otherwise, do nothing. + * + * Notice that nodes of type Node_var_new have undefined value in var_value + * (a.k.a. lnode)---even though awkgram.y:variable() initializes it, + * push_args() doesn't. Thus we have to initialize it. + */ + +static inline void +make_scalar P((NODE *tree)) +{ + switch (tree->type) { + case Node_var_array: + fatal(_("attempt to use array `%s' in a scalar context"), + array_vname(tree)); + + case Node_array_ref: + switch (tree->orig_array->type) { + case Node_var_array: + fatal(_("attempt to use array `%s' in a scalar context"), + array_vname(tree)); + case Node_var_new: + tree->orig_array->type = Node_var; + tree->orig_array->var_value = Nnull_string; + break; + case Node_var: + break; + default: + cant_happen(); + } + /* fall through */ + case Node_var_new: + tree->type = Node_var; + tree->var_value = Nnull_string; + default: + /* shut up GCC */ + break; + } +} + /* * interpret: * Tree is a bunch of rules to run. Returns zero if it hit an exit() @@ -436,16 +516,19 @@ interpret(register NODE *volatile tree) else if (case_stmt->lnode->type == Node_regex) { NODE *t1; Regexp *rp; + /* see comments in match_op() code about this. */ + int kludge_need_start = FALSE; t1 = force_string(switch_value); rp = re_update(case_stmt->lnode); - match_found = (research(rp, t1->stptr, 0, t1->stlen, FALSE) >= 0); + if (avoid_dfa(tree, t1->stptr, t1->stlen)) + kludge_need_start = TRUE; + match_found = (research(rp, t1->stptr, 0, t1->stlen, kludge_need_start) >= 0); if (t1 != switch_value) free_temp(t1); - } else { + } else match_found = (cmp_nodes(switch_value, case_stmt->lnode) == 0); - } } /* If a match was found, execute the statements associated with the case. */ @@ -771,8 +854,12 @@ interpret(register NODE *volatile tree) case Node_K_return: INCREMENT(tree->exec_count); t = tree_eval(tree->lnode); - ret_node = dupnode(t); - free_temp(t); + if ((t->flags & (PERM|TEMP)) != 0) + ret_node = t; + else { + ret_node = copynode(t); /* don't do a dupnode here */ + ret_node->flags |= TEMP; + } longjmp(func_tag, TAG_RETURN); break; @@ -808,8 +895,8 @@ r_tree_eval(register NODE *tree, int iscond) #ifndef TREE_EVAL_MACRO if (tree == NULL) - return Nnull_string; - else if (tree->type == Node_val) { + cant_happen(); + if (tree->type == Node_val) { if (tree->stref <= 0) cant_happen(); return ((tree->flags & INTLSTR) != 0 @@ -842,17 +929,9 @@ r_tree_eval(register NODE *tree, int iscond) tree->vname); } + make_scalar(tree); + switch (tree->type) { - case Node_array_ref: - if (tree->orig_array->type == Node_var_array) - fatal(_("attempt to use array `%s' in a scalar context"), - array_vname(tree)); - tree->orig_array->type = Node_var; - /* fall through */ - case Node_var_new: - tree->type = Node_var; - tree->var_value = Nnull_string; - /* fall through */ case Node_var: if (do_lint && var_uninitialized(tree)) lintwarn(_("reference to uninitialized variable `%s'"), @@ -875,7 +954,7 @@ r_tree_eval(register NODE *tree, int iscond) return (*tree->builtin)(tree->subnode); case Node_K_getline: - return (do_getline(tree)); + return do_getline(tree); case Node_in_array: return tmp_number((AWKNUM) (in_array(tree->lnode, tree->rnode) != NULL)); @@ -899,14 +978,11 @@ r_tree_eval(register NODE *tree, int iscond) case Node_CONVFMT: case Node_BINMODE: case Node_LINT: + case Node_SUBSEP: case Node_TEXTDOMAIN: lhs = get_lhs(tree, (Func_ptr *) NULL, TRUE); return *lhs; - case Node_var_array: - fatal(_("attempt to use array `%s' in a scalar context"), - array_vname(tree)); - case Node_unary_minus: t1 = tree_eval(tree->subnode); x = -force_number(t1); @@ -1024,6 +1100,60 @@ r_tree_eval(register NODE *tree, int iscond) return r; /* assignments */ + case Node_assign_concat: + { + Func_ptr after_assign = NULL; + NODE *l, *r; + + /* + * Note that something lovely like this: + * + * BEGIN { a = "a"; a = a (a = "b"); print a } + * + * is not defined. It could print `ab' or `bb'. + * Gawk 3.1.3 prints `ab', so we do that too, simply + * by evaluating the LHS first. Ugh. + * + * Thanks to mary1john@earthlink.net for pointing + * out this issue. + */ + lhs = get_lhs(tree->lnode, &after_assign, FALSE); + *lhs = force_string(*lhs); + l = *lhs; + r = force_string(tree_eval(tree->rnode)); + + /* + * Don't clobber string constants! + * + * Also check stref; see test/strcat1.awk, + * the test for l->stref == 1 can't be an + * assertion. + * + * Thanks again to mary1john@earthlink.net for pointing + * out this issue. + */ + if (l != r && (l->flags & PERM) == 0 && l->stref == 1) { + size_t nlen = l->stlen + r->stlen + 2; + + erealloc(l->stptr, char *, nlen, "interpret"); + memcpy(l->stptr + l->stlen, r->stptr, r->stlen); + l->stlen += r->stlen; + } else { + char *nval; + size_t nlen = l->stlen + r->stlen + 2; + + emalloc(nval, char *, nlen, "interpret"); + memcpy(nval, l->stptr, l->stlen); + memcpy(nval + l->stlen, r->stptr, r->stlen); + unref(*lhs); + *lhs = make_str_node(nval, l->stlen + r->stlen, ALREADY_MALLOCED); + } + free_temp(r); + + if (after_assign) + (*after_assign)(); + return *lhs; + } case Node_assign: { Func_ptr after_assign = NULL; @@ -1151,7 +1281,7 @@ r_tree_eval(register NODE *tree, int iscond) default: fatal(_("illegal type (%s) in tree_eval"), nodetype2str(tree->type)); } - return 0; + return (NODE *) 0; } /* eval_condition --- is TREE true or false? Returns 0==false, non-zero==true */ @@ -1251,6 +1381,7 @@ cmp_nodes(register NODE *t1, register NODE *t2) (const char *) cp2, mbs, l); } else #endif + /* Could use tolower() here; see discussion above. */ for (ret = 0; l-- > 0 && ret == 0; cp1++, cp2++) ret = casetable[*cp1] - casetable[*cp2]; } else @@ -1449,17 +1580,50 @@ push_forloop(const char *varname, NODE **elems, size_t nelems) nloops_active++; } +/* + * 2/2004: + * N.B. The code that uses fcalls[] *always* uses indexing. + * This avoids severe problems in case fcalls gets realloc()'ed + * during recursive tree_eval()'s or whatever, so that we don't + * have to carefully reassign pointers into the array. The + * minor speed gain from using a pointer was offset too much + * by the hassles to get the code right and commented. + * + * Thanks and a tip of the hatlo to Brian Kernighan. + */ + static struct fcall { const char *fname; /* function name */ - unsigned long count; /* how many args */ + size_t count; /* how many args */ NODE *arglist; /* list thereof */ NODE **prevstack; /* function stack frame of previous function */ NODE **stack; /* function stack frame of current function */ -} *fcall_list = NULL; +} *fcalls = NULL; static long fcall_list_size = 0; static long curfcall = -1; +/* + * get_curfunc_arg_count --- return number actual parameters + * + * This is for use by dynamically loaded C extension functions. + */ +size_t +get_curfunc_arg_count(void) +{ + NODE *argp; + size_t argc; + + assert(curfcall >= 0); + + /* count the # of expressions in argument expression list */ + for (argc = 0, argp = fcalls[curfcall].arglist; + argp != NULL; argp = argp->rnode) + argc++; + + return argc; +} + /* pop_fcall --- pop off a single function call */ static void @@ -1467,15 +1631,13 @@ pop_fcall() { NODE *n, **sp; int count; - struct fcall *f; assert(curfcall >= 0); - f = & fcall_list[curfcall]; - stack_ptr = f->prevstack; + stack_ptr = fcalls[curfcall].prevstack; - sp = f->stack; + sp = fcalls[curfcall].stack; - for (count = f->count; count > 0; count--) { + for (count = fcalls[curfcall].count; count > 0; count--) { n = *sp++; if (n->type == Node_var) /* local variable */ unref(n->var_value); @@ -1483,9 +1645,10 @@ pop_fcall() assoc_clear(n); freenode(n); } - if (f->stack) - free((char *) f->stack); - /* memset(f, '\0', sizeof(struct fcall)); */ + if (fcalls[curfcall].stack) { + free((char *) fcalls[curfcall].stack); + fcalls[curfcall].stack = NULL; + } curfcall--; } @@ -1507,33 +1670,31 @@ push_args(int count, const char *func_name, char **varnames) { - struct fcall *f; NODE *arg, *r, **sp; int i; if (fcall_list_size == 0) { /* first time */ - emalloc(fcall_list, struct fcall *, 10 * sizeof(struct fcall), + emalloc(fcalls, struct fcall *, 10 * sizeof(struct fcall), "push_args"); fcall_list_size = 10; } if (++curfcall >= fcall_list_size) { fcall_list_size *= 2; - erealloc(fcall_list, struct fcall *, + erealloc(fcalls, struct fcall *, fcall_list_size * sizeof(struct fcall), "push_args"); } - f = & fcall_list[curfcall]; if (count > 0) - emalloc(f->stack, NODE **, count*sizeof(NODE *), "push_args"); + emalloc(fcalls[curfcall].stack, NODE **, count*sizeof(NODE *), "push_args"); else - f->stack = NULL; - f->count = count; - f->fname = func_name; /* not used, for debugging, just in case */ - f->arglist = argp; - f->prevstack = oldstack; + fcalls[curfcall].stack = NULL; + fcalls[curfcall].count = count; + fcalls[curfcall].fname = func_name; /* not used, for debugging, just in case */ + fcalls[curfcall].arglist = argp; + fcalls[curfcall].prevstack = oldstack; - sp = f->stack; + sp = fcalls[curfcall].stack; /* for each calling arg. add NODE * on stack */ for (i = 0; i < count; i++) { @@ -1542,16 +1703,16 @@ push_args(int count, if (argp == NULL) { /* local variable */ r->type = Node_var_new; + r->var_value = Nnull_string; r->vname = varnames[i]; + r->rnode = NULL; continue; } arg = argp->lnode; /* call by reference for arrays; see below also */ - if (arg->type == Node_param_list) { - /* we must also reassign f here; see below */ - f = & fcall_list[curfcall]; - arg = f->prevstack[arg->param_cnt]; - } + if (arg->type == Node_param_list) + arg = fcalls[curfcall].prevstack[arg->param_cnt]; + if (arg->type == Node_var_array || arg->type == Node_var_new) { r->type = Node_array_ref; r->orig_array = arg; @@ -1571,15 +1732,6 @@ push_args(int count, argp = argp->rnode; } - /* - * We have to reassign f. Why, you may ask? It is possible that - * other functions were called during the course of tree_eval()-ing - * the arguments to this function. As a result of that, fcall_list - * may have been realloc()'ed, with the result that f is now - * pointing into free()'d space. This was a nasty one to track down. - */ - f = & fcall_list[curfcall]; - if (argp != NULL) { /* Left over calling args. */ warning( @@ -1589,18 +1741,15 @@ push_args(int count, do { arg = argp->lnode; if (arg->type == Node_param_list) - arg = f->prevstack[arg->param_cnt]; + arg = fcalls[curfcall].prevstack[arg->param_cnt]; if (arg->type != Node_var_array && arg->type != Node_array_ref && arg->type != Node_var_new) free_temp(tree_eval(arg)); - - /* reassign f, tree_eval could have moved it */ - f = & fcall_list[curfcall]; } while ((argp = argp->rnode) != NULL); } - stack_ptr = f->stack; + stack_ptr = fcalls[curfcall].stack; } /* func_call --- call a function, call by reference for arrays */ @@ -1679,8 +1828,6 @@ func_call(NODE *tree) RESTORE_BINDING(loop_tag_stack, loop_tag, junk); } - if ((r->flags & PERM) == 0) - r->flags |= TEMP; return r; } @@ -1697,7 +1844,7 @@ dump_fcall_stack(FILE *fp) fprintf(fp, _("\n\t# Function Call Stack:\n\n")); for (i = curfcall; i >= 0; i--) - fprintf(fp, "\t# %3d. %s\n", i+1, fcall_list[i].fname); + fprintf(fp, "\t# %3d. %s\n", i+1, fcalls[i].fname); fprintf(fp, _("\t# -- main --\n")); } #endif /* PROFILING */ @@ -1727,26 +1874,9 @@ r_get_lhs(register NODE *ptr, Func_ptr *assign, int reference) ptr = stack_ptr[ptr->param_cnt]; } - switch (ptr->type) { - case Node_var_array: - fatal(_("attempt to use array `%s' in a scalar context"), - array_vname(ptr)); + make_scalar(ptr); - /* - * The following goop ensures that uninitialized variables - * used as parameters eventually get their type set correctly - * to scalar (i.e., Node_var). - */ - case Node_array_ref: - if (ptr->orig_array->type == Node_var_array) - fatal(_("attempt to use array `%s' in a scalar context"), - array_vname(ptr)); - ptr->orig_array->type = Node_var; - /* fall through */ - case Node_var_new: - ptr->type = Node_var; - ptr->var_value = Nnull_string; - /* fall through */ + switch (ptr->type) { case Node_var: if (do_lint && reference && var_uninitialized(ptr)) lintwarn(_("reference to uninitialized variable `%s'"), @@ -1800,7 +1930,7 @@ r_get_lhs(register NODE *ptr, Func_ptr *assign, int reference) case Node_NF: if (NF == -1 || NF_node->var_value->numbr != NF) { if (NF == -1) - (void) get_field(HUGE-1, assign); /* parse record */ + (void) get_field(UNLIMITED-1, assign); /* parse record */ unref(NF_node->var_value); NF_node->var_value = make_number((AWKNUM) NF); } @@ -1851,6 +1981,12 @@ r_get_lhs(register NODE *ptr, Func_ptr *assign, int reference) *assign = set_OFS; break; + case Node_SUBSEP: + aptr = &(SUBSEP_node->var_value); + if (assign != NULL) + *assign = set_SUBSEP; + break; + case Node_TEXTDOMAIN: aptr = &(TEXTDOMAIN_node->var_value); if (assign != NULL) @@ -1923,6 +2059,7 @@ match_op(register NODE *tree) register Regexp *rp; int i; int match = TRUE; + int kludge_need_start = FALSE; /* FIXME: --- see below */ if (tree->type == Node_nomatch) match = FALSE; @@ -1933,7 +2070,22 @@ match_op(register NODE *tree) tree = tree->rnode; } rp = re_update(tree); - i = research(rp, t1->stptr, 0, t1->stlen, FALSE); + /* + * FIXME: + * + * Any place where research() is called with a last parameter of + * FALSE, we need to use the avoid_dfa test. This appears here and + * in the code for Node_K_switch. + * + * A new or improved dfa that distinguishes beginning/end of + * string from beginning/end of line will allow us to get rid of + * this temporary hack. + * + * The avoid_dfa() function is in re.c; it is not very smart. + */ + if (avoid_dfa(tree, t1->stptr, t1->stlen)) + kludge_need_start = TRUE; + i = research(rp, t1->stptr, 0, t1->stlen, kludge_need_start); i = (i == -1) ^ (match == TRUE); free_temp(t1); return tmp_number((AWKNUM) i); @@ -1950,6 +2102,7 @@ set_IGNORECASE() warned = TRUE; lintwarn(_("`IGNORECASE' is a gawk extension")); } + load_casetable(); if (do_traditional) IGNORECASE = FALSE; else if ((IGNORECASE_node->var_value->flags & (STRING|STRCUR)) != 0) { @@ -2049,10 +2202,20 @@ fmt_ok(NODE *n) { NODE *tmp = force_string(n); const char *p = tmp->stptr; +#if ! defined(PRINTF_HAS_F_FORMAT) || PRINTF_HAS_F_FORMAT != 1 + static const char float_formats[] = "efgEG"; +#else + static const char float_formats[] = "efgEFG"; +#endif +#if ENABLE_NLS && defined(HAVE_LOCALE_H) + static const char flags[] = " +-#'"; +#else + static const char flags[] = " +-#"; +#endif if (*p++ != '%') return 0; - while (*p && strchr(" +-#", *p) != NULL) /* flags */ + while (*p && strchr(flags, *p) != NULL) /* flags */ p++; while (*p && ISDIGIT(*p)) /* width - %*.*g is NOT allowed */ p++; @@ -2062,7 +2225,7 @@ fmt_ok(NODE *n) p++; while (*p && ISDIGIT(*p)) /* precision */ p++; - if (*p == '\0' || strchr("efgEG", *p) == NULL) + if (*p == '\0' || strchr(float_formats, *p) == NULL) return 0; if (*++p != '\0') return 0; diff --git a/ext.c b/ext.c index 33fb54542..018f90adc 100644 --- a/ext.c +++ b/ext.c @@ -7,7 +7,7 @@ */ /* - * Copyright (C) 1995 - 2001, 2003 the Free Software Foundation, Inc. + * Copyright (C) 1995 - 2001, 2003, 2004 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. @@ -94,9 +94,37 @@ make_builtin(char *name, NODE *(*func) P((NODE *)), int count) { NODE *p, *b, *f; char **vnames, *parm_names, *sp; - char buf[200]; + char c, buf[200]; int space_needed, i; + sp = name; + if (sp == NULL || *sp == '\0') + fatal(_("extension: missing function name")); + + while ((c = *sp++) != '\0') + if ((sp == &name[1] && c != '_' && ! ISALPHA(c)) + || (sp > &name[1] && ! is_identchar(c))) + fatal(_("extension: illegal character `%c' in function name `%s'"), c, name); + + f = lookup(name); + if (f != NULL) { + if (f->type == Node_func) { + if (f->rnode->type != Node_builtin) /* user-defined function */ + fatal(_("extension: can't redefine function `%s'"), name); + else { + /* multiple extension() calls etc. */ + if (do_lint) + lintwarn(_("extension: function `%s' already defined"), name); + return; + } + } else { + if (check_special(name) >= 0) + fatal(_("extension: can't use gawk built-in `%s' as function name"), name); + /* variable name etc. */ + fatal(_("extension: function name `%s' previously defined"), name); + } + } + /* count parameters, create artificial list of param names */ space_needed = 0; for (i = 0; i < count; i++) { @@ -142,25 +170,57 @@ NODE * get_argument(NODE *tree, int i) { extern NODE **stack_ptr; + int actual_args; - if (i < 0 || i >= tree->param_cnt) + actual_args = get_curfunc_arg_count(); + if (i < 0 || i >= tree->param_cnt || i >= actual_args) return NULL; tree = stack_ptr[i]; - if (tree->lnode == Nnull_string) - return NULL; - - if (tree->type == Node_array_ref) { + if (tree->type == Node_array_ref) tree = tree->orig_array; - return tree; - } - - if (tree->type == Node_var_array) + if (tree->type == Node_var_new || tree->type == Node_var_array) return tree; return tree->lnode; } +/* get_actual_argument --- get a scalar or array, allowed to be optional */ + +NODE * +get_actual_argument(NODE *tree, unsigned int i, int optional, int want_array) +{ + /* optional : if TRUE and i th argument not present return NULL, else fatal. */ + + NODE *t; + + t = get_argument(tree, i); + + if (t == NULL) { + if (i >= tree->param_cnt) /* must be fatal */ + fatal(_("function `%s' defined to take no more than `%d' argument(s)"), + tree->param, tree->param_cnt); + if (! optional) + fatal(_("function `%s': missing argument #%d"), + tree->param, i + 1); + return NULL; + } + + if (t->type == Node_var_new) + return (want_array ? get_array(t) : tree_eval(t)); + + if (want_array) { + if (t->type != Node_var_array) + fatal(_("function `%s': argument #%d: attempt to use scalar as an array"), + tree->param, i + 1); + } else { + if (t->type != Node_val) + fatal(_("function `%s': argument #%d: attempt to use array as a scalar"), + tree->param, i + 1); + } + return t; +} + /* set_value --- set the return value of a dynamically linked function */ void diff --git a/extension/ChangeLog b/extension/ChangeLog new file mode 100644 index 000000000..60805ec47 --- /dev/null +++ b/extension/ChangeLog @@ -0,0 +1,25 @@ +Mon Aug 2 12:18:15 2004 Arnold D. Robbins + + * Release 3.1.4: Release tar file made. + +Mon Jun 21 17:02:37 2004 Arnold D. Robbins + + More from John Haque. + + * testarg.c, testarg.awk: New files. + * arrayparm.c (do_mkarray): Change call of `get_curfunc_parm_count' + to `get_curfunc_arg_count'. + * filefuncs.c (do_chdir, do_stat): Ditto. + * fork.c (do_fork, do_waitpid): Ditto. + * ordchr.c (do_ord, do_chr): Ditto. + * readfile.c (do_readfile): Ditto. + * steps: Updated. + +Mon Jun 14 14:01:16 2004 Arnold D. Robbins + + ChangeLog started. + + Changes from John Haque and ADR to rationalize extension functions. + + * extension/filefuncs.c: Revised for new functionality. See + corresponding entry in main ChangeLog. diff --git a/extension/arrayparm.c b/extension/arrayparm.c index 6c627d654..d2e18d5b6 100644 --- a/extension/arrayparm.c +++ b/extension/arrayparm.c @@ -6,10 +6,11 @@ * 10/2001 * * Revised 7/2003 + * Revised 6/2004 */ /* - * Copyright (C) 2001, 2003 the Free Software Foundation, Inc. + * Copyright (C) 2001, 2003, 2004 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. @@ -47,7 +48,7 @@ NODE *tree; NODE *var, *sub, *val; NODE **elemval; - if (do_lint && tree->param_cnt > 3) + if (do_lint && get_curfunc_arg_count() > 3) lintwarn("mkarray: called with too many arguments"); var = get_argument(tree, 0); diff --git a/extension/filefuncs.c b/extension/filefuncs.c index 194db28f0..ed86875aa 100644 --- a/extension/filefuncs.c +++ b/extension/filefuncs.c @@ -3,10 +3,11 @@ * to the file system. * * Arnold Robbins, update for 3.1, Mon Nov 23 12:53:39 EST 1998 + * Arnold Robbins and John Haque, update for 3.1.4, applied Mon Jun 14 13:55:30 IDT 2004 */ /* - * Copyright (C) 2001 the Free Software Foundation, Inc. + * Copyright (C) 2001, 2004 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. @@ -39,20 +40,15 @@ NODE *tree; NODE *newdir; int ret = -1; - if (do_lint && tree->param_cnt > 1) - lintwarn("chdir: called with too many arguments"); - - newdir = get_argument(tree, 0); - if (newdir != NULL) { - (void) force_string(newdir); - ret = chdir(newdir->stptr); - if (ret < 0) - update_ERRNO(); - - free_temp(newdir); - } else if (do_lint) - lintwarn("chdir: called with no arguments"); + if (do_lint && get_curfunc_arg_count() != 1) + lintwarn("chdir: called with incorrect number of arguments"); + newdir = get_scalar_argument(tree, 0, FALSE); + (void) force_string(newdir); + ret = chdir(newdir->stptr); + if (ret < 0) + update_ERRNO(); + free_temp(newdir); /* Set the return value */ set_value(tmp_number((AWKNUM) ret)); @@ -179,17 +175,12 @@ NODE *tree; char *pmode; /* printable mode */ char *type = "unknown"; - /* check arg count */ - if (tree->param_cnt != 2) - fatal( - "stat: called with incorrect number of arguments (%d), should be 2", - tree->param_cnt); + if (do_lint && get_curfunc_arg_count() > 2) + lintwarn("stat: called with too many arguments"); /* directory is first arg, array to hold results is second */ - file = get_argument(tree, 0); - array = get_argument(tree, 1); - - array = get_array(array); + file = get_scalar_argument(tree, 0, FALSE); + array = get_array_argument(tree, 1, FALSE); /* empty out the array */ assoc_clear(array); diff --git a/extension/fork.c b/extension/fork.c index 6f0203189..8ba7d0d61 100644 --- a/extension/fork.c +++ b/extension/fork.c @@ -1,9 +1,11 @@ /* * fork.c - Provide fork and waitpid functions for gawk. + * + * Revised 6/2004 */ /* - * Copyright (C) 2001 the Free Software Foundation, Inc. + * Copyright (C) 2001, 2004 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. @@ -34,7 +36,7 @@ NODE *tree; int ret = -1; NODE **aptr; - if (do_lint && tree->param_cnt > 0) + if (do_lint && get_curfunc_arg_count() > 0) lintwarn("fork: called with too many arguments"); ret = fork(); @@ -71,7 +73,7 @@ NODE *tree; pid_t pid; int options = 0; - if (do_lint && tree->param_cnt > 1) + if (do_lint && get_curfunc_arg_count() > 1) lintwarn("waitpid: called with too many arguments"); pidnode = get_argument(tree, 0); diff --git a/extension/ordchr.c b/extension/ordchr.c index 037bfa37e..4849ede89 100644 --- a/extension/ordchr.c +++ b/extension/ordchr.c @@ -4,10 +4,11 @@ * Arnold Robbins * arnold@skeeve.com * 8/2001 + * Revised 6/2004 */ /* - * Copyright (C) 2001 the Free Software Foundation, Inc. + * Copyright (C) 2001, 2004 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. @@ -38,7 +39,7 @@ NODE *tree; NODE *str; int ret = -1; - if (do_lint && tree->param_cnt > 1) + if (do_lint && get_curfunc_arg_count() > 1) lintwarn("ord: called with too many arguments"); str = get_argument(tree, 0); @@ -70,7 +71,7 @@ NODE *tree; str[0] = str[1] = '\0'; - if (do_lint && tree->param_cnt > 1) + if (do_lint && get_curfunc_arg_count() > 1) lintwarn("chr: called with too many arguments"); num = get_argument(tree, 0); diff --git a/extension/readfile.c b/extension/readfile.c index 65f0efca8..d9a01ffd9 100644 --- a/extension/readfile.c +++ b/extension/readfile.c @@ -5,10 +5,12 @@ * Tue Apr 23 17:43:30 IDT 2002 * Revised per Peter Tillier * Mon Jun 9 17:05:11 IDT 2003 + * Revised for new dynamic function facilities + * Mon Jun 14 14:53:07 IDT 2004 */ /* - * Copyright (C) 2002, 2003 the Free Software Foundation, Inc. + * Copyright (C) 2002, 2003, 2004 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. @@ -47,7 +49,7 @@ NODE *tree; char *text; int fd; - if (do_lint && tree->param_cnt > 1) + if (do_lint && get_curfunc_arg_count() > 1) lintwarn("readfile: called with too many arguments"); filename = get_argument(tree, 0); diff --git a/extension/steps b/extension/steps index 8bac5d856..7ff5265f2 100755 --- a/extension/steps +++ b/extension/steps @@ -2,6 +2,7 @@ # Tue Nov 24 15:04:14 EST 1998 # Sun Aug 26 16:03:58 IDT 2001 # Sun Apr 28 15:59:57 IDT 2002 +# Mon Jun 21 17:03:37 IDT 2004 gcc -shared -Wall -DHAVE_CONFIG_H -c -O -g -I.. dl.c gcc -shared -Wall -DHAVE_CONFIG_H -c -O -g -I.. filefuncs.c @@ -9,9 +10,11 @@ gcc -shared -Wall -DHAVE_CONFIG_H -c -O -g -I.. fork.c gcc -shared -Wall -DHAVE_CONFIG_H -c -O -g -I.. ordchr.c gcc -shared -Wall -DHAVE_CONFIG_H -c -O -g -I.. arrayparm.c gcc -shared -Wall -DHAVE_CONFIG_H -c -O -g -I.. readfile.c +gcc -shared -Wall -DHAVE_CONFIG_H -c -O -g -I.. testarg.c ld -o dl.so -shared dl.o ld -o filefuncs.so -shared filefuncs.o ld -o fork.so -shared fork.o ld -o ordchr.so -shared ordchr.o ld -o arrayparm.so -shared arrayparm.o ld -o readfile.so -shared readfile.o +ld -o testarg.so -shared testarg.o diff --git a/extension/testarg.awk b/extension/testarg.awk new file mode 100644 index 000000000..4b9eb5170 --- /dev/null +++ b/extension/testarg.awk @@ -0,0 +1,6 @@ +BEGIN { + extension("./testarg.so", "dlload") + check_arg(x, a); + check_arg(y, b, z); + check_arg(p, q, r, s); +} diff --git a/extension/testarg.c b/extension/testarg.c new file mode 100644 index 000000000..747dd515a --- /dev/null +++ b/extension/testarg.c @@ -0,0 +1,40 @@ +#include "awk.h" + +static NODE * +do_check_arg(tree) +NODE *tree; +{ + int ret = 0, argc; + NODE *arg1, *arg2, *arg3; + + argc = get_curfunc_arg_count(); + printf("arg count: defined = %d, supplied = %d\n", tree->param_cnt, argc); + + arg1 = get_scalar_argument(tree, 0, FALSE); + arg2 = get_array_argument(tree, 1, FALSE); + arg3 = get_scalar_argument(tree, 2, TRUE); /* optional */ + if (argc > 3) { /* try to use an extra arg */ + NODE *arg4; + arg4 = get_array_argument(tree, 3, TRUE); + } + if (arg3 != NULL) + printf("3rd arg present\n\n"); + else + printf("no 3rd arg\n\n"); + /* Set the return value */ + set_value(tmp_number((AWKNUM) ret)); + + /* Just to make the interpreter happy */ + return tmp_number((AWKNUM) 0); +} + +/* dlload --- load new builtins in this library */ + +NODE * +dlload(tree, dl) +NODE *tree; +void *dl; +{ + make_builtin("check_arg", do_check_arg, 3); + return tmp_number((AWKNUM) 0); +} diff --git a/field.c b/field.c index ddb6dd4bd..a076f54a4 100644 --- a/field.c +++ b/field.c @@ -3,7 +3,7 @@ */ /* - * Copyright (C) 1986, 1988, 1989, 1991-2003 the Free Software Foundation, Inc. + * Copyright (C) 1986, 1988, 1989, 1991-2004 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. @@ -362,7 +362,7 @@ re_parse_field(long up_to, /* parse only up to this field number */ memset(&mbs, 0, sizeof(mbstate_t)); #endif - if (up_to == HUGE) + if (up_to == UNLIMITED) nf = 0; if (len == 0) return nf; @@ -406,7 +406,7 @@ re_parse_field(long up_to, /* parse only up to this field number */ scan = end; } *buf = scan; - return (nf); + return nf; } /* @@ -432,7 +432,7 @@ def_parse_field(long up_to, /* parse only up to this field number */ register char *end = scan + len; char sav; - if (up_to == HUGE) + if (up_to == UNLIMITED) nf = 0; if (len == 0) return nf; @@ -499,7 +499,7 @@ posix_def_parse_field(long up_to, /* parse only up to this field number */ register char *end = scan + len; char sav; - if (up_to == HUGE) + if (up_to == UNLIMITED) nf = 0; if (len == 0) return nf; @@ -561,7 +561,7 @@ null_parse_field(long up_to, /* parse only up to this field number */ register long nf = parse_high_water; register char *end = scan + len; - if (up_to == HUGE) + if (up_to == UNLIMITED) nf = 0; if (len == 0) return nf; @@ -618,7 +618,7 @@ sc_parse_field(long up_to, /* parse only up to this field number */ memset(&mbs, 0, sizeof(mbstate_t)); #endif - if (up_to == HUGE) + if (up_to == UNLIMITED) nf = 0; if (len == 0) return nf; @@ -686,7 +686,7 @@ fw_parse_field(long up_to, /* parse only up to this field number */ register long nf = parse_high_water; register char *end = scan + len; - if (up_to == HUGE) + if (up_to == UNLIMITED) nf = 0; if (len == 0) return nf; @@ -718,7 +718,7 @@ get_field(register long requested, Func_ptr *assign) if (! field0_valid) { /* first, parse remainder of input record */ if (NF == -1) { - NF = (*parse_field)(HUGE-1, &parse_extent, + NF = (*parse_field)(UNLIMITED-1, &parse_extent, fields_arr[0]->stlen - (parse_extent - fields_arr[0]->stptr), save_FS, FS_regexp, set_field, @@ -761,7 +761,7 @@ get_field(register long requested, Func_ptr *assign) */ if (parse_extent == fields_arr[0]->stptr + fields_arr[0]->stlen) NF = parse_high_water; - if (requested == HUGE-1) /* HUGE-1 means set NF */ + if (requested == UNLIMITED-1) /* UNLIMITED-1 means set NF */ requested = parse_high_water; } if (parse_high_water < requested) { /* requested beyond end of record */ @@ -870,7 +870,7 @@ do_split(NODE *tree) assoc_clear(arr); s = src2->stptr; - tmp = tmp_number((AWKNUM) (*parseit)(HUGE, &s, (int) src2->stlen, + tmp = tmp_number((AWKNUM) (*parseit)(UNLIMITED, &s, (int) src2->stlen, fs2, rp, set_element, arr)); unref(src2); unref(fs2); @@ -887,7 +887,7 @@ set_FIELDWIDTHS() register int i; static int fw_alloc = 4; static int warned = FALSE; - extern double strtod(); + extern unsigned long strtoul P((const char *, char **endptr, int base)); if (do_lint && ! warned) { warned = TRUE; @@ -901,7 +901,7 @@ set_FIELDWIDTHS() * semantics, and force $0 to be split totally. */ if (fields_arr != NULL) - (void) get_field(HUGE - 1, 0); + (void) get_field(UNLIMITED - 1, 0); parse_field = fw_parse_field; scan = force_string(FIELDWIDTHS_node->var_value)->stptr; @@ -914,7 +914,7 @@ set_FIELDWIDTHS() fw_alloc *= 2; erealloc(FIELDWIDTHS, int *, fw_alloc * sizeof(int), "set_FIELDWIDTHS"); } - FIELDWIDTHS[i] = (int) strtod(scan, &end); + FIELDWIDTHS[i] = (int) strtoul(scan, &end, 10); if (end == scan) break; if (FIELDWIDTHS[i] <= 0) @@ -942,7 +942,7 @@ set_FS() * semantics, and force $0 to be split totally. */ if (fields_arr != NULL) - (void) get_field(HUGE - 1, 0); + (void) get_field(UNLIMITED - 1, 0); /* It's possible that only IGNORECASE changed, or FS = FS */ /* @@ -959,9 +959,9 @@ set_FS() FS_regexp = (IGNORECASE ? FS_re_no_case : FS_re_yes_case); /* FS = FS */ - if (! using_FIELDWIDTHS()) + if (! using_FIELDWIDTHS()) { return; - else { + } else { remake_re = FALSE; goto choose_fs_function; } @@ -1032,13 +1032,13 @@ set_FS() } if (buf[0] != '\0') { - FS_re_yes_case = make_regexp(buf, strlen(buf), FALSE); - FS_re_no_case = make_regexp(buf, strlen(buf), TRUE); + FS_re_yes_case = make_regexp(buf, strlen(buf), FALSE, TRUE); + FS_re_no_case = make_regexp(buf, strlen(buf), TRUE, TRUE); FS_regexp = (IGNORECASE ? FS_re_no_case : FS_re_yes_case); parse_field = re_parse_field; } else if (parse_field == re_parse_field) { - FS_re_yes_case = make_regexp(fs->stptr, fs->stlen, FALSE); - FS_re_no_case = make_regexp(fs->stptr, fs->stlen, TRUE); + FS_re_yes_case = make_regexp(fs->stptr, fs->stlen, FALSE, TRUE); + FS_re_no_case = make_regexp(fs->stptr, fs->stlen, TRUE, TRUE); FS_regexp = (IGNORECASE ? FS_re_no_case : FS_re_yes_case); } else FS_re_yes_case = FS_re_no_case = FS_regexp = NULL; diff --git a/fixvers b/fixvers deleted file mode 100755 index 928bd4a09..000000000 --- a/fixvers +++ /dev/null @@ -1,58 +0,0 @@ -#! /bin/sh - -# fixvers --- make sure version.c and patchlev.h reflect -# the reality in configure.ac -# -# Copyright (C) 2001, 2002 the Free Software Foundation, Inc. -# -# This file is part of GAWK, the GNU implementation of the -# AWK Programming Language. -# -# GAWK 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. -# -# GAWK is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - -line=`grep '^AM_INIT_AUTOMAKE' configure.ac` - -case $1 in --v) - VERS=`echo $line | sed 's/.*, *\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9a-z]*\))/\1.\2/'` - sed "s/X\.Y/$VERS/" < version.in > version.new - if [ -f version.c ] && cmp version.c version.new - then - rm version.new - else - mv version.new version.c - fi - touch version.c - ;; - --p) - LEV=`echo $line | sed 's/.*, *\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9a-z]*\))/\"\3\"/'` - echo "#define PATCHLEVEL $LEV" > patchlev.new - if [ -f patchlev.h ] && cmp patchlev.h patchlev.new - then - rm patchlev.new - else - mv patchlev.new patchlev.h - fi - touch patchlev.h - ;; - -*) - echo "usage: $0 -v|-p" 1>&2 - exit 1 - ;; -esac - -exit 0 diff --git a/gawkmisc.c b/gawkmisc.c index 24a7d875f..3b50a8803 100644 --- a/gawkmisc.c +++ b/gawkmisc.c @@ -3,7 +3,7 @@ */ /* - * Copyright (C) 1986, 1988, 1989, 1991-2003 the Free Software Foundation, Inc. + * Copyright (C) 1986, 1988, 1989, 1991-2004 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. diff --git a/getopt.c b/getopt.c index 289d137e2..5336410ee 100644 --- a/getopt.c +++ b/getopt.c @@ -2,7 +2,7 @@ NOTE: getopt is now part of the C library, so if you don't know what "Keep this file name-space clean" means, talk to drepper@gnu.org before changing it! - Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001,2002 + Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001,2002,2003 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -692,12 +692,19 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) if (__asprintf (&buf, _("%s: option `%s' is ambiguous\n"), argv[0], argv[optind]) >= 0) { + _IO_flockfile (stderr); + + int old_flags2 = ((_IO_FILE *) stderr)->_flags2; + ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); + ((_IO_FILE *) stderr)->_flags2 = old_flags2; + _IO_funlockfile (stderr); + free (buf); } #else @@ -761,11 +768,20 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) #if defined _LIBC && defined USE_IN_LIBIO if (n >= 0) { + _IO_flockfile (stderr); + + int old_flags2 = ((_IO_FILE *) stderr)->_flags2; + ((_IO_FILE *) stderr)->_flags2 + |= _IO_FLAGS2_NOTCANCEL; + if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); + ((_IO_FILE *) stderr)->_flags2 = old_flags2; + _IO_funlockfile (stderr); + free (buf); } #endif @@ -792,11 +808,20 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) %s: option `%s' requires an argument\n"), argv[0], argv[optind - 1]) >= 0) { + _IO_flockfile (stderr); + + int old_flags2 = ((_IO_FILE *) stderr)->_flags2; + ((_IO_FILE *) stderr)->_flags2 + |= _IO_FLAGS2_NOTCANCEL; + if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); + ((_IO_FILE *) stderr)->_flags2 = old_flags2; + _IO_funlockfile (stderr); + free (buf); } #else @@ -861,11 +886,19 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) #if defined _LIBC && defined USE_IN_LIBIO if (n >= 0) { + _IO_flockfile (stderr); + + int old_flags2 = ((_IO_FILE *) stderr)->_flags2; + ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; + if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); + ((_IO_FILE *) stderr)->_flags2 = old_flags2; + _IO_funlockfile (stderr); + free (buf); } #endif @@ -919,11 +952,19 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) #if defined _LIBC && defined USE_IN_LIBIO if (n >= 0) { + _IO_flockfile (stderr); + + int old_flags2 = ((_IO_FILE *) stderr)->_flags2; + ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; + if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); + ((_IO_FILE *) stderr)->_flags2 = old_flags2; + _IO_funlockfile (stderr); + free (buf); } #endif @@ -962,11 +1003,19 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) _("%s: option requires an argument -- %c\n"), argv[0], c) >= 0) { + _IO_flockfile (stderr); + + int old_flags2 = ((_IO_FILE *) stderr)->_flags2; + ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; + if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); + ((_IO_FILE *) stderr)->_flags2 = old_flags2; + _IO_funlockfile (stderr); + free (buf); } #else @@ -1025,11 +1074,19 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) if (__asprintf (&buf, _("%s: option `-W %s' is ambiguous\n"), argv[0], argv[optind]) >= 0) { + _IO_flockfile (stderr); + + int old_flags2 = ((_IO_FILE *) stderr)->_flags2; + ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; + if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); + ((_IO_FILE *) stderr)->_flags2 = old_flags2; + _IO_funlockfile (stderr); + free (buf); } #else @@ -1061,11 +1118,20 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) %s: option `-W %s' doesn't allow an argument\n"), argv[0], pfound->name) >= 0) { + _IO_flockfile (stderr); + + int old_flags2 = ((_IO_FILE *) stderr)->_flags2; + ((_IO_FILE *) stderr)->_flags2 + |= _IO_FLAGS2_NOTCANCEL; + if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); + ((_IO_FILE *) stderr)->_flags2 = old_flags2; + _IO_funlockfile (stderr); + free (buf); } #else @@ -1094,11 +1160,20 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) %s: option `%s' requires an argument\n"), argv[0], argv[optind - 1]) >= 0) { + _IO_flockfile (stderr); + + int old_flags2 = ((_IO_FILE *) stderr)->_flags2; + ((_IO_FILE *) stderr)->_flags2 + |= _IO_FLAGS2_NOTCANCEL; + if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); + ((_IO_FILE *) stderr)->_flags2 = old_flags2; + _IO_funlockfile (stderr); + free (buf); } #else @@ -1160,11 +1235,19 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) %s: option requires an argument -- %c\n"), argv[0], c) >= 0) { + _IO_flockfile (stderr); + + int old_flags2 = ((_IO_FILE *) stderr)->_flags2; + ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; + if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); + ((_IO_FILE *) stderr)->_flags2 = old_flags2; + _IO_funlockfile (stderr); + free (buf); } #else diff --git a/getopt.h b/getopt.h index 4283c35b1..bf6e5538a 100644 --- a/getopt.h +++ b/getopt.h @@ -1,5 +1,5 @@ /* Declarations for getopt. - Copyright (C) 1989-1994, 1996-1999, 2001 Free Software Foundation, Inc. + Copyright (C) 1989-1994, 1996-1999,2001,2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -34,6 +34,14 @@ # include #endif +#ifndef __THROW +# if defined __cplusplus /* ADR: nuke this: && __GNUC_PREREQ (2,8) */ +# define __THROW throw () +# else +# define __THROW +# endif +#endif + #ifdef __cplusplus extern "C" { #endif @@ -142,7 +150,8 @@ struct option /* 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); +extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) + __THROW; # else /* not __GNU_LIBRARY__ */ extern int getopt (); # endif /* __GNU_LIBRARY__ */ @@ -150,10 +159,12 @@ extern int getopt (); # ifndef __need_getopt extern int getopt_long (int ___argc, char *const *___argv, const char *__shortopts, - const struct option *__longopts, int *__longind); + const struct option *__longopts, int *__longind) + __THROW; extern int getopt_long_only (int ___argc, char *const *___argv, const char *__shortopts, - const struct option *__longopts, int *__longind); + const struct option *__longopts, int *__longind) + __THROW; /* Internal only. Users should not call this directly. */ extern int _getopt_internal (int ___argc, char *const *___argv, diff --git a/getopt1.c b/getopt1.c index 22a7efbdd..ad06cc7f9 100644 --- a/getopt1.c +++ b/getopt1.c @@ -22,7 +22,11 @@ #include #endif -#include "getopt.h" +#ifdef _LIBC +# include +#else +# include "getopt.h" +#endif #if !defined __STDC__ || !__STDC__ /* This is a separate conditional since some stdc systems @@ -90,6 +94,10 @@ getopt_long_only (argc, argv, options, long_options, opt_index) return _getopt_internal (argc, argv, options, long_options, opt_index, 1); } +# ifdef _LIBC +libc_hidden_def (getopt_long) +libc_hidden_def (getopt_long_only) +# endif #endif /* Not ELIDE_CODE. */ diff --git a/install-sh b/install-sh index 36f96f3e0..e4160c991 100755 --- a/install-sh +++ b/install-sh @@ -1,19 +1,38 @@ #!/bin/sh -# # install - install a program, script, or datafile -# This comes from X11R5 (mit/util/scripts/install.sh). + +scriptversion=2004-04-01.17 + +# 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. # -# Copyright 1991 by the Massachusetts Institute of Technology +# 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. # -# Permission to use, copy, modify, distribute, and sell this software and its -# documentation for any purpose is hereby granted without fee, provided that -# the above copyright notice appear in all copies and that both that -# copyright notice and this permission notice appear in supporting -# documentation, and that the name of M.I.T. not be used in advertising or -# publicity pertaining to distribution of the software without specific, -# written prior permission. M.I.T. makes no representations about the -# suitability of this software for any purpose. It is provided "as is" -# without express or implied warranty. +# 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 @@ -23,13 +42,11 @@ # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. - # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" - # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" @@ -41,236 +58,268 @@ stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" -transformbasename="" -transform_arg="" +transformbasename= +transform_arg= instcmd="$mvprog" chmodcmd="$chmodprog 0755" -chowncmd="" -chgrpcmd="" -stripcmd="" +chowncmd= +chgrpcmd= +stripcmd= rmcmd="$rmprog -f" mvcmd="$mvprog" -src="" -dst="" -dir_arg="" - -while [ x"$1" != x ]; do - case $1 in - -c) instcmd=$cpprog - shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - -s) stripcmd=$stripprog - shift - continue;; - - -t=*) transformarg=`echo $1 | sed 's/-t=//'` - shift - continue;; - - -b=*) transformbasename=`echo $1 | sed 's/-b=//'` - shift - continue;; - - *) if [ x"$src" = x ] - then - src=$1 - else - # this colon is to work around a 386BSD /bin/sh bug - : - dst=$1 - fi - shift - continue;; - esac +src= +dst= +dir_arg= + +usage="Usage: $0 [OPTION]... SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 -d DIRECTORIES... + +In the first form, install SRCFILE to DSTFILE, removing SRCFILE by default. +In the second, create the directory path DIR. + +Options: +-b=TRANSFORMBASENAME +-c copy source (using $cpprog) instead of moving (using $mvprog). +-d create directories instead of installing files. +-g GROUP $chgrp installed files to GROUP. +-m MODE $chmod installed files to MODE. +-o USER $chown installed files to USER. +-s strip installed files (using $stripprog). +-t=TRANSFORM +--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 -n "$1"; do + case $1 in + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + -c) instcmd=$cpprog + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + --help) echo "$usage"; exit 0;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -s) stripcmd=$stripprog + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + --version) echo "$0 $scriptversion"; exit 0;; + + *) # When -d is used, all remaining arguments are directories to create. + test -n "$dir_arg" && break + # 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 + break;; + esac done -if [ x"$src" = x ] -then - echo "$0: no input file specified" >&2 - exit 1 -else - : +if test -z "$1"; 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 [ x"$dir_arg" != x ]; then - dst=$src - src="" - - if [ -d "$dst" ]; then - instcmd=: - chmodcmd="" - else - instcmd=$mkdirprog - fi -else - -# Waiting for this to be detected by the "$instcmd $src $dsttmp" command -# might cause directories to be created, which would be especially bad -# if $src (and thus $dsttmp) contains '*'. - - if [ -f "$src" ] || [ -d "$src" ] - then - : - else - echo "$0: $src does not exist" >&2 - exit 1 - fi - - if [ x"$dst" = x ] - then - echo "$0: no destination specified" >&2 - exit 1 - else - : - fi - -# If destination is a directory, append the input filename; if your system -# does not like double slashes in filenames, you may need to add some logic - - if [ -d "$dst" ] - then - dst=$dst/`basename "$src"` - else - : - fi -fi - -## this sed command emulates the dirname command -dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` - -# Make sure that the destination directory exists. -# this part is taken from Noah Friedman's mkinstalldirs script - -# Skip lots of stat calls in the usual case. -if [ ! -d "$dstdir" ]; then -defaultIFS=' - ' -IFS="${IFS-$defaultIFS}" - -oIFS=$IFS -# Some sh's can't handle IFS=/ for some reason. -IFS='%' -set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` -IFS=$oIFS - -pathcomp='' - -while [ $# -ne 0 ] ; do - pathcomp=$pathcomp$1 - shift - - if [ ! -d "$pathcomp" ] ; - then - $mkdirprog "$pathcomp" - else - : - fi +for src +do + # Protect names starting with `-'. + case $src in + -*) src=./$src ;; + esac + + if test -n "$dir_arg"; then + dst=$src + src= + + if test -d "$dst"; then + instcmd=: + chmodcmd= + else + instcmd=$mkdirprog + fi + else + # Waiting for this to be detected by the "$instcmd $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 - pathcomp=$pathcomp/ + # If destination is a directory, append the input filename; won't work + # if double slashes aren't ignored. + if test -d "$dst"; then + dst=$dst/`basename "$src"` + fi + fi + + # This sed command emulates the dirname command. + dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + + # Make sure that the destination directory exists. + + # Skip lots of stat calls in the usual case. + if test ! -d "$dstdir"; then + defaultIFS=' + ' + IFS="${IFS-$defaultIFS}" + + oIFS=$IFS + # Some sh's can't handle IFS=/ for some reason. + IFS='%' + set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` + IFS=$oIFS + + pathcomp= + + while test $# -ne 0 ; do + pathcomp=$pathcomp$1 + shift + if test ! -d "$pathcomp"; then + $mkdirprog "$pathcomp" || lasterr=$? + # mkdir can fail with a `File exist' error in case several + # install-sh are creating the directory concurrently. This + # is OK. + test ! -d "$pathcomp" && { (exit ${lasterr-1}); exit; } + fi + pathcomp=$pathcomp/ + done + fi + + if test -n "$dir_arg"; then + $doit $instcmd "$dst" \ + && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ + && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ + && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ + && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } + + else + # If we're going to rename the final executable, determine the name now. + if test -z "$transformarg"; then + dstfile=`basename "$dst"` + else + dstfile=`basename "$dst" $transformbasename \ + | sed $transformarg`$transformbasename + fi + + # don't allow the sed command to completely eliminate the filename. + test -z "$dstfile" && dstfile=`basename "$dst"` + + # 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 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0 + trap '(exit $?); exit' 1 2 13 15 + + # Move or copy the file name to the temp name + $doit $instcmd "$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 $instcmd $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 "$dsttmp"; } && + + # Now rename the file to the real destination. + { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 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 "$dstdir/$dstfile"; then + $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ + || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ + || { + echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 + (exit 1); exit + } + else + : + fi + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" + } + } + fi || { (exit 1); exit; } done -fi - -if [ x"$dir_arg" != x ] -then - $doit $instcmd "$dst" && - - if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi -else - -# If we're going to rename the final executable, determine the name now. - - if [ x"$transformarg" = x ] - then - dstfile=`basename "$dst"` - else - dstfile=`basename "$dst" $transformbasename | - sed $transformarg`$transformbasename - fi - -# don't allow the sed command to completely eliminate the filename - - if [ x"$dstfile" = x ] - then - dstfile=`basename "$dst"` - else - : - fi - -# Make a couple of temp file names in the proper directory. - - dsttmp=$dstdir/#inst.$$# - rmtmp=$dstdir/#rm.$$# - -# Trap to clean up temp files at exit. - - trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0 - trap '(exit $?); exit' 1 2 13 15 - -# Move or copy the file name to the temp name - - $doit $instcmd "$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 $instcmd $src $dsttmp" command. - - if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi && - -# 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 [ -f "$dstdir/$dstfile" ] - then - $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null || - $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null || - { - echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 - (exit 1); exit - } - else - : - fi -} && - -# Now rename the file to the real destination. - - $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" - -fi && # The final little trick to "correctly" pass the exit status to the exit trap. - { - (exit 0); exit + (exit 0); exit } + +# 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/ChangeLog b/intl/ChangeLog index eed2d21a4..751291929 100644 --- a/intl/ChangeLog +++ b/intl/ChangeLog @@ -1,4 +1,4 @@ -2003-05-22 GNU +2004-01-29 GNU - * Version 0.12.1 released. + * Version 0.14.1 released. diff --git a/intl/Makefile.in b/intl/Makefile.in index 882396481..05f15329e 100644 --- a/intl/Makefile.in +++ b/intl/Makefile.in @@ -73,6 +73,10 @@ HEADERS = \ eval-plural.h \ localcharset.h \ relocatable.h \ + xsize.h \ + printf-args.h printf-args.c \ + printf-parse.h wprintf-parse.h printf-parse.c \ + vasnprintf.h vasnwprintf.h vasnprintf.c \ os2compat.h \ libgnuintl.h.in SOURCES = \ @@ -96,6 +100,7 @@ SOURCES = \ relocatable.c \ localename.c \ log.c \ + printf.c \ osdep.c \ os2compat.c \ intl-compat.c @@ -120,6 +125,7 @@ OBJECTS = \ relocatable.$lo \ localename.$lo \ log.$lo \ + printf.$lo \ osdep.$lo \ intl-compat.$lo DISTFILES.common = Makefile.in \ @@ -127,7 +133,8 @@ 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 \ -Makefile.vms libgnuintl.h.msvc-shared README.woe32 Makefile.msvc +libgnuintl.h_vms Makefile.vms \ +libgnuintl.h.msvc-static libgnuintl.h.msvc-shared README.woe32 Makefile.msvc DISTFILES.obsolete = xopen-msg.sed linux-msg.sed po2tbl.sed.in cat-compat.c \ COPYING.LIB-2 gettext.h libgettext.h plural-eval.c libgnuintl.h @@ -155,9 +162,9 @@ libintl.la libgnuintl.la: $(OBJECTS) # 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=5 +LTV_CURRENT=7 LTV_REVISION=0 -LTV_AGE=3 +LTV_AGE=4 .SUFFIXES: .SUFFIXES: .c .y .o .lo .sin .sed @@ -209,6 +216,8 @@ localename.lo: $(srcdir)/localename.c $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/localename.c log.lo: $(srcdir)/log.c $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/log.c +printf.lo: $(srcdir)/printf.c + $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/printf.c osdep.lo: $(srcdir)/osdep.c $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/osdep.c intl-compat.lo: $(srcdir)/intl-compat.c @@ -224,7 +233,11 @@ ref-del.sed: $(srcdir)/ref-del.sin INCLUDES = -I. -I$(srcdir) -I.. libgnuintl.h: $(srcdir)/libgnuintl.h.in - cp $(srcdir)/libgnuintl.h.in libgnuintl.h + sed -e 's,@''HAVE_POSIX_PRINTF''@,@HAVE_POSIX_PRINTF@,g' \ + -e 's,@''HAVE_ASPRINTF''@,@HAVE_ASPRINTF@,g' \ + -e 's,@''HAVE_SNPRINTF''@,@HAVE_SNPRINTF@,g' \ + -e 's,@''HAVE_WPRINTF''@,@HAVE_WPRINTF@,g' \ + < $(srcdir)/libgnuintl.h.in > libgnuintl.h libintl.h: libgnuintl.h cp libgnuintl.h libintl.h @@ -250,7 +263,7 @@ install-exec: all $(INSTALL_DATA) libintl.$la $(DESTDIR)$(libdir)/libintl.$la; \ if test "@RELOCATABLE@" = yes; then \ dependencies=`sed -n -e 's,^dependency_libs=\(.*\),\1,p' < $(DESTDIR)$(libdir)/libintl.la | sed -e "s,^',," -e "s,'\$$,,"`; \ - if test -n "$dependencies"; then \ + if test -n "$$dependencies"; then \ rm -f $(DESTDIR)$(libdir)/libintl.la; \ fi; \ fi; \ @@ -412,6 +425,7 @@ dcigettext.$lo loadmsgcat.$lo plural.$lo plural-exp.$lo: $(srcdir)/plural-exp.h dcigettext.$lo: $(srcdir)/eval-plural.h localcharset.$lo: $(srcdir)/localcharset.h localealias.$lo localcharset.$lo relocatable.$lo: $(srcdir)/relocatable.h +printf.$lo: $(srcdir)/printf-args.h $(srcdir)/printf-args.c $(srcdir)/printf-parse.h $(srcdir)/wprintf-parse.h $(srcdir)/xsize.h $(srcdir)/printf-parse.c $(srcdir)/vasnprintf.h $(srcdir)/vasnwprintf.h $(srcdir)/vasnprintf.c tags: TAGS diff --git a/intl/VERSION b/intl/VERSION index 130318357..b4b846ca7 100644 --- a/intl/VERSION +++ b/intl/VERSION @@ -1 +1 @@ -GNU gettext library from gettext-0.12.1 +GNU gettext library from gettext-0.14.1 diff --git a/intl/bindtextdom.c b/intl/bindtextdom.c index 250f5e863..dcdc40085 100644 --- a/intl/bindtextdom.c +++ b/intl/bindtextdom.c @@ -1,5 +1,5 @@ /* Implementation of the bindtextdomain(3) function - Copyright (C) 1995-1998, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 1995-1998, 2000-2003 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 @@ -86,11 +86,6 @@ __libc_rwlock_define (extern, _nl_state_lock attribute_hidden) # define BIND_TEXTDOMAIN_CODESET libintl_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 @@ -98,10 +93,8 @@ static void set_binding_values PARAMS ((const char *domainname, 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; +set_binding_values (const char *domainname, + const char **dirnamep, const char **codesetp) { struct binding *binding; int modified; @@ -348,9 +341,7 @@ set_binding_values (domainname, dirnamep, codesetp) /* 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; +BINDTEXTDOMAIN (const char *domainname, const char *dirname) { set_binding_values (domainname, &dirname, NULL); return (char *) dirname; @@ -359,9 +350,7 @@ BINDTEXTDOMAIN (domainname, 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; +BIND_TEXTDOMAIN_CODESET (const char *domainname, const char *codeset) { set_binding_values (domainname, NULL, &codeset); return (char *) codeset; diff --git a/intl/config.charset b/intl/config.charset index 32becece9..43d45fb75 100755 --- a/intl/config.charset +++ b/intl/config.charset @@ -1,7 +1,7 @@ #! /bin/sh # Output a system dependent table of character encoding aliases. # -# Copyright (C) 2000-2003 Free Software Foundation, Inc. +# Copyright (C) 2000-2004 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 @@ -30,77 +30,77 @@ # 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 solaris 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-14 glibc -# ISO-8859-15 glibc aix osf solaris freebsd -# KOI8-R glibc solaris freebsd yes -# KOI8-U glibc freebsd yes -# KOI8-T glibc -# 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 woe32 dos -# CP922 aix -# CP932 aix woe32 dos -# CP943 aix -# CP949 osf woe32 dos -# CP950 woe32 dos -# CP1046 aix -# CP1124 aix -# CP1125 dos -# CP1129 aix -# CP1250 woe32 -# CP1251 glibc solaris woe32 -# CP1252 aix woe32 -# CP1253 woe32 -# CP1254 woe32 -# CP1255 glibc woe32 -# CP1256 woe32 -# CP1257 woe32 -# 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 solaris -# GBK glibc aix osf solaris woe32 dos -# GB18030 glibc solaris -# SHIFT_JIS hpux osf solaris freebsd yes -# JOHAB glibc solaris woe32 -# TIS-620 glibc aix hpux osf solaris -# VISCII glibc yes -# TCVN5712-1 glibc -# GEORGIAN-PS glibc -# 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 +# name MIME? used by which systems +# ASCII, ANSI_X3.4-1968 glibc solaris freebsd darwin +# ISO-8859-1 Y glibc aix hpux irix osf solaris freebsd darwin +# ISO-8859-2 Y glibc aix hpux irix osf solaris freebsd darwin +# ISO-8859-3 Y glibc solaris +# ISO-8859-4 Y osf solaris freebsd darwin +# ISO-8859-5 Y glibc aix hpux irix osf solaris freebsd darwin +# ISO-8859-6 Y glibc aix hpux solaris +# ISO-8859-7 Y glibc aix hpux irix osf solaris +# ISO-8859-8 Y glibc aix hpux osf solaris +# ISO-8859-9 Y glibc aix hpux irix osf solaris +# ISO-8859-13 glibc +# ISO-8859-14 glibc +# ISO-8859-15 glibc aix osf solaris freebsd +# KOI8-R Y glibc solaris freebsd darwin +# KOI8-U Y glibc freebsd darwin +# KOI8-T glibc +# 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 darwin dos +# CP869 dos +# CP874 woe32 dos +# CP922 aix +# CP932 aix woe32 dos +# CP943 aix +# CP949 osf woe32 dos +# CP950 woe32 dos +# CP1046 aix +# CP1124 aix +# CP1125 dos +# CP1129 aix +# CP1250 woe32 +# CP1251 glibc solaris darwin woe32 +# CP1252 aix woe32 +# CP1253 woe32 +# CP1254 woe32 +# CP1255 glibc woe32 +# CP1256 woe32 +# CP1257 woe32 +# GB2312 Y glibc aix hpux irix solaris freebsd darwin +# EUC-JP Y glibc aix hpux irix osf solaris freebsd darwin +# EUC-KR Y glibc aix hpux irix osf solaris freebsd darwin +# EUC-TW glibc aix hpux irix osf solaris +# BIG5 Y glibc aix hpux osf solaris freebsd darwin +# BIG5-HKSCS glibc solaris +# GBK glibc aix osf solaris woe32 dos +# GB18030 glibc solaris +# SHIFT_JIS Y hpux osf solaris freebsd darwin +# JOHAB glibc solaris woe32 +# TIS-620 glibc aix hpux osf solaris +# VISCII Y glibc +# TCVN5712-1 glibc +# GEORGIAN-PS glibc +# 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 Y glibc aix hpux osf solaris # # Note: Names which are not marked as being a MIME name should not be used in # Internet protocols for information interchange (mail, news, etc.). @@ -121,6 +121,105 @@ echo "# It was automatically generated from config.charset." # List of references, updated during installation: echo "# Packages using this file: " case "$os" in + linux-gnulibc1*) + # Linux libc5 doesn't have nl_langinfo(CODESET); therefore + # localcharset.c falls back to using the full locale name + # from the environment variables. + echo "C ASCII" + echo "POSIX ASCII" + for l in af af_ZA ca ca_ES da da_DK de de_AT de_BE de_CH de_DE de_LU \ + en en_AU en_BW en_CA en_DK en_GB en_IE en_NZ en_US en_ZA \ + en_ZW es es_AR es_BO es_CL es_CO es_DO es_EC es_ES es_GT \ + es_HN es_MX es_PA es_PE es_PY es_SV es_US es_UY es_VE et \ + et_EE eu eu_ES fi fi_FI fo fo_FO fr fr_BE fr_CA fr_CH fr_FR \ + fr_LU ga ga_IE gl gl_ES id id_ID in in_ID is is_IS it it_CH \ + it_IT kl kl_GL nl nl_BE nl_NL no no_NO pt pt_BR pt_PT sv \ + sv_FI sv_SE; do + echo "$l ISO-8859-1" + echo "$l.iso-8859-1 ISO-8859-1" + echo "$l.iso-8859-15 ISO-8859-15" + echo "$l.iso-8859-15@euro ISO-8859-15" + echo "$l@euro ISO-8859-15" + echo "$l.cp-437 CP437" + echo "$l.cp-850 CP850" + echo "$l.cp-1252 CP1252" + echo "$l.cp-1252@euro CP1252" + #echo "$l.atari-st ATARI-ST" # not a commonly used encoding + echo "$l.utf-8 UTF-8" + echo "$l.utf-8@euro UTF-8" + done + for l in cs cs_CZ hr hr_HR hu hu_HU pl pl_PL ro ro_RO sk sk_SK sl \ + sl_SI sr sr_CS sr_YU; do + echo "$l ISO-8859-2" + echo "$l.iso-8859-2 ISO-8859-2" + echo "$l.cp-852 CP852" + echo "$l.cp-1250 CP1250" + echo "$l.utf-8 UTF-8" + done + for l in mk mk_MK ru ru_RU; do + echo "$l ISO-8859-5" + echo "$l.iso-8859-5 ISO-8859-5" + echo "$l.koi8-r KOI8-R" + echo "$l.cp-866 CP866" + echo "$l.cp-1251 CP1251" + echo "$l.utf-8 UTF-8" + done + for l in ar ar_SA; do + echo "$l ISO-8859-6" + echo "$l.iso-8859-6 ISO-8859-6" + echo "$l.cp-864 CP864" + #echo "$l.cp-868 CP868" # not a commonly used encoding + echo "$l.cp-1256 CP1256" + echo "$l.utf-8 UTF-8" + done + for l in el el_GR gr gr_GR; do + echo "$l ISO-8859-7" + echo "$l.iso-8859-7 ISO-8859-7" + echo "$l.cp-869 CP869" + echo "$l.cp-1253 CP1253" + echo "$l.cp-1253@euro CP1253" + echo "$l.utf-8 UTF-8" + echo "$l.utf-8@euro UTF-8" + done + for l in he he_IL iw iw_IL; do + echo "$l ISO-8859-8" + echo "$l.iso-8859-8 ISO-8859-8" + echo "$l.cp-862 CP862" + echo "$l.cp-1255 CP1255" + echo "$l.utf-8 UTF-8" + done + for l in tr tr_TR; do + echo "$l ISO-8859-9" + echo "$l.iso-8859-9 ISO-8859-9" + echo "$l.cp-857 CP857" + echo "$l.cp-1254 CP1254" + echo "$l.utf-8 UTF-8" + done + for l in lt lt_LT lv lv_LV; do + #echo "$l BALTIC" # not a commonly used encoding, wrong encoding name + echo "$l ISO-8859-13" + done + for l in ru_UA uk uk_UA; do + echo "$l KOI8-U" + done + for l in zh zh_CN; do + #echo "$l GB_2312-80" # not a commonly used encoding, wrong encoding name + echo "$l GB2312" + done + for l in ja ja_JP ja_JP.EUC; do + echo "$l EUC-JP" + done + for l in ko ko_KR; do + echo "$l EUC-KR" + done + for l in th th_TH; do + echo "$l TIS-620" + done + for l in fa fa_IR; do + #echo "$l ISIRI-3342" # a broken encoding + echo "$l.utf-8 UTF-8" + done + ;; 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 @@ -297,6 +396,47 @@ case "$os" in echo "BIG5 BIG5" echo "SJIS SHIFT_JIS" ;; + darwin*) + # Darwin 6.8 doesn't have nl_langinfo(CODESET); therefore + # localcharset.c falls back to using the full locale name + # from the environment variables. + echo "C ASCII" + for l in en_AU en_CA en_GB en_US la_LN; do + echo "$l.US-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 nl_BE \ + nl_NL no_NO pt_PT sv_SE; do + echo "$l ISO-8859-1" + echo "$l.ISO8859-1 ISO-8859-1" + echo "$l.ISO8859-15 ISO-8859-15" + done + for l in la_LN; do + echo "$l.ISO8859-1 ISO-8859-1" + echo "$l.ISO8859-15 ISO-8859-15" + done + for l in cs_CZ hr_HR hu_HU la_LN pl_PL sl_SI; do + echo "$l.ISO8859-2 ISO-8859-2" + done + for l in la_LN lt_LT; do + echo "$l.ISO8859-4 ISO-8859-4" + done + for l in ru_RU; do + echo "$l.KOI8-R KOI8-R" + echo "$l.ISO8859-5 ISO-8859-5" + echo "$l.CP866 CP866" + done + for l in bg_BG; do + echo "$l.CP1251 CP1251" + 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 "ko_KR.EUC EUC-KR" + ;; beos*) # BeOS has a single locale, and it has UTF-8 encoding. echo "* UTF-8" @@ -410,6 +550,7 @@ case "$os" in echo "sq CP852" echo "sq_AL CP852" echo "sr CP852" # CP852 or CP866 or CP855 ?? + echo "sr_CS CP852" # CP852 or CP866 or CP855 ?? echo "sr_YU CP852" # CP852 or CP866 or CP855 ?? # ISO-8859-3 languages echo "mt CP850" diff --git a/intl/dcgettext.c b/intl/dcgettext.c index ca6a1c82d..850acdee9 100644 --- a/intl/dcgettext.c +++ b/intl/dcgettext.c @@ -1,5 +1,5 @@ /* Implementation of the dcgettext(3) function. - Copyright (C) 1995-1999, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 1995-1999, 2000-2003 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 @@ -44,10 +44,7 @@ /* 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; +DCGETTEXT (const char *domainname, const char *msgid, int category) { return DCIGETTEXT (domainname, msgid, NULL, 0, 0, category); } diff --git a/intl/dcigettext.c b/intl/dcigettext.c index f6edb95c0..35238e2cb 100644 --- a/intl/dcigettext.c +++ b/intl/dcigettext.c @@ -148,13 +148,17 @@ extern int errno; char *getwd (); # define getcwd(buf, max) getwd (buf) # else +# if VMS +# define getcwd(buf, max) (getcwd) (buf, max, 0) +# else char *getcwd (); +# endif # endif # ifndef HAVE_STPCPY -static char *stpcpy PARAMS ((char *dest, const char *src)); +static char *stpcpy (char *dest, const char *src); # endif # ifndef HAVE_MEMPCPY -static void *mempcpy PARAMS ((void *dest, const void *src, size_t n)); +static void *mempcpy (void *dest, const void *src, size_t n); # endif #endif @@ -248,11 +252,8 @@ static void *root; # 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; +transcmp (const void *p1, const void *p2) { const struct known_translation_t *s1; const struct known_translation_t *s2; @@ -304,19 +305,18 @@ INTVARDEF (_nl_default_dirname) 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)) +static char *plural_lookup (struct loaded_l10nfile *domain, + unsigned long int n, + const char *translation, size_t translation_len) internal_function; -static const char *guess_category_value PARAMS ((int category, - const char *categoryname)) +static const char *guess_category_value (int category, + const char *categoryname) internal_function; #ifdef _LIBC # include "../locale/localeinfo.h" # define category_to_name(category) _nl_category_names[category] #else -static const char *category_to_name PARAMS ((int category)) internal_function; +static const char *category_to_name (int category) internal_function; #endif @@ -424,13 +424,8 @@ static int enable_secure; 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; +DCIGETTEXT (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; @@ -703,11 +698,10 @@ DCIGETTEXT (domainname, msgid1, msgid2, plural, n, category) #ifndef _LIBC if (!ENABLE_SECURE) { - extern void _nl_log_untranslated PARAMS ((const char *logfilename, - const char *domainname, - const char *msgid1, - const char *msgid2, - int plural)); + extern void _nl_log_untranslated (const char *logfilename, + const char *domainname, + const char *msgid1, const char *msgid2, + int plural); const char *logfilename = getenv ("GETTEXT_LOG_UNTRANSLATED"); if (logfilename != NULL && logfilename[0] != '\0') @@ -724,11 +718,9 @@ DCIGETTEXT (domainname, msgid1, msgid2, plural, n, category) 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; +_nl_find_msg (struct loaded_l10nfile *domain_file, + struct binding *domainbinding, const char *msgid, + size_t *lengthp) { struct loaded_domain *domain; nls_uint32 nstrings; @@ -1035,11 +1027,8 @@ _nl_find_msg (domain_file, domainbinding, msgid, lengthp) /* 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; +plural_lookup (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; @@ -1076,8 +1065,7 @@ plural_lookup (domain, n, translation, translation_len) /* Return string representation of locale CATEGORY. */ static const char * internal_function -category_to_name (category) - int category; +category_to_name (int category) { const char *retval; @@ -1137,9 +1125,7 @@ category_to_name (category) /* 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; +guess_category_value (int category, const char *categoryname) { const char *language; const char *retval; @@ -1180,9 +1166,7 @@ guess_category_value (category, categoryname) to be defined. */ #if !_LIBC && !HAVE_STPCPY static char * -stpcpy (dest, src) - char *dest; - const char *src; +stpcpy (char *dest, const char *src) { while ((*dest++ = *src++) != '\0') /* Do nothing. */ ; @@ -1192,10 +1176,7 @@ stpcpy (dest, src) #if !_LIBC && !HAVE_MEMPCPY static void * -mempcpy (dest, src, n) - void *dest; - const void *src; - size_t n; +mempcpy (void *dest, const void *src, size_t n) { return (void *) ((char *) memcpy (dest, src, n) + n); } diff --git a/intl/dcngettext.c b/intl/dcngettext.c index 3a3404e2c..48a3e09e0 100644 --- a/intl/dcngettext.c +++ b/intl/dcngettext.c @@ -1,5 +1,5 @@ /* Implementation of the dcngettext(3) function. - Copyright (C) 1995-1999, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 1995-1999, 2000-2003 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 @@ -44,12 +44,9 @@ /* 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; +DCNGETTEXT (const char *domainname, + const char *msgid1, const char *msgid2, unsigned long int n, + int category) { return DCIGETTEXT (domainname, msgid1, msgid2, 1, n, category); } diff --git a/intl/dgettext.c b/intl/dgettext.c index cf5b4037f..b64b0f5d3 100644 --- a/intl/dgettext.c +++ b/intl/dgettext.c @@ -1,5 +1,5 @@ /* Implementation of the dgettext(3) function. - Copyright (C) 1995-1997, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 1995-1997, 2000-2003 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 @@ -20,9 +20,10 @@ # include #endif +#include "gettextP.h" + #include -#include "gettextP.h" #ifdef _LIBC # include #else @@ -46,9 +47,7 @@ /* Look up MSGID in the DOMAINNAME message catalog of the current LC_MESSAGES locale. */ char * -DGETTEXT (domainname, msgid) - const char *domainname; - const char *msgid; +DGETTEXT (const char *domainname, const char *msgid) { return DCGETTEXT (domainname, msgid, LC_MESSAGES); } diff --git a/intl/dngettext.c b/intl/dngettext.c index 67fd030f2..7815637f0 100644 --- a/intl/dngettext.c +++ b/intl/dngettext.c @@ -1,5 +1,5 @@ /* Implementation of the dngettext(3) function. - Copyright (C) 1995-1997, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 1995-1997, 2000-2003 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 @@ -20,9 +20,10 @@ # include #endif +#include "gettextP.h" + #include -#include "gettextP.h" #ifdef _LIBC # include #else @@ -46,11 +47,8 @@ /* 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; +DNGETTEXT (const char *domainname, + const char *msgid1, const char *msgid2, unsigned long int n) { return DCNGETTEXT (domainname, msgid1, msgid2, n, LC_MESSAGES); } diff --git a/intl/eval-plural.h b/intl/eval-plural.h index 19c7ca6ae..01bd5af5f 100644 --- a/intl/eval-plural.h +++ b/intl/eval-plural.h @@ -1,5 +1,5 @@ /* Plural expression evaluation. - Copyright (C) 2000-2002 Free Software Foundation, Inc. + Copyright (C) 2000-2003 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 @@ -21,16 +21,10 @@ #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; +plural_eval (struct expression *pexp, unsigned long int n) { switch (pexp->nargs) { diff --git a/intl/explodename.c b/intl/explodename.c index 2985064c9..52c25e727 100644 --- a/intl/explodename.c +++ b/intl/explodename.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-1998, 2000, 2001 Free Software Foundation, Inc. +/* Copyright (C) 1995-1998, 2000-2001, 2003 Free Software Foundation, Inc. Contributed by Ulrich Drepper , 1995. This program is free software; you can redistribute it and/or modify it @@ -38,8 +38,7 @@ /* @@ end of prolog @@ */ char * -_nl_find_language (name) - const char *name; +_nl_find_language (const char *name) { while (name[0] != '\0' && name[0] != '_' && name[0] != '@' && name[0] != '+' && name[0] != ',') @@ -50,17 +49,11 @@ _nl_find_language (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; +_nl_explode_name (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; diff --git a/intl/finddomain.c b/intl/finddomain.c index d24276442..4992a8c9e 100644 --- a/intl/finddomain.c +++ b/intl/finddomain.c @@ -1,5 +1,5 @@ /* Handle list of needed message catalogs - Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 1995-1999, 2000-2001, 2003 Free Software Foundation, Inc. Written by Ulrich Drepper , 1995. This program is free software; you can redistribute it and/or modify it @@ -47,11 +47,8 @@ static struct loaded_l10nfile *_nl_loaded_domains; 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; +_nl_find_domain (const char *dirname, char *locale, + const char *domainname, struct binding *domainbinding) { struct loaded_l10nfile *retval; const char *language; diff --git a/intl/gettext.c b/intl/gettext.c index 43d689f55..92c42faa7 100644 --- a/intl/gettext.c +++ b/intl/gettext.c @@ -1,5 +1,5 @@ /* Implementation of gettext(3) function. - Copyright (C) 1995, 1997, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 1995, 1997, 2000-2003 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 @@ -52,8 +52,7 @@ LC_MESSAGES locale. If not found, returns MSGID itself (the default text). */ char * -GETTEXT (msgid) - const char *msgid; +GETTEXT (const char *msgid) { return DCGETTEXT (NULL, msgid, LC_MESSAGES); } diff --git a/intl/gettextP.h b/intl/gettextP.h index f1748a356..4d66c3de3 100644 --- a/intl/gettextP.h +++ b/intl/gettextP.h @@ -36,14 +36,6 @@ /* @@ 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 @@ -159,64 +151,63 @@ struct binding extern int _nl_msg_cat_cntr; #ifndef _LIBC -const char *_nl_locale_name PARAMS ((int category, const char *categoryname)); +const char *_nl_locale_name (int category, const char *categoryname); #endif -struct loaded_l10nfile *_nl_find_domain PARAMS ((const char *__dirname, - char *__locale, - const char *__domainname, - struct binding *__domainbinding)) +struct loaded_l10nfile *_nl_find_domain (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)) +void _nl_load_domain (struct loaded_l10nfile *__domain, + struct binding *__domainbinding) internal_function; -void _nl_unload_domain PARAMS ((struct loaded_domain *__domain)) +void _nl_unload_domain (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)) +const char *_nl_init_domain_conv (struct loaded_l10nfile *__domain_file, + struct loaded_domain *__domain, + struct binding *__domainbinding) internal_function; -void _nl_free_domain_conv PARAMS ((struct loaded_domain *__domain)) +void _nl_free_domain_conv (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)) +char *_nl_find_msg (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)); +extern char *__gettext (const char *__msgid); +extern char *__dgettext (const char *__domainname, const char *__msgid); +extern char *__dcgettext (const char *__domainname, const char *__msgid, + int __category); +extern char *__ngettext (const char *__msgid1, const char *__msgid2, + unsigned long int __n); +extern char *__dngettext (const char *__domainname, + const char *__msgid1, const char *__msgid2, + unsigned long int n); +extern char *__dcngettext (const char *__domainname, + const char *__msgid1, const char *__msgid2, + unsigned long int __n, int __category); +extern char *__dcigettext (const char *__domainname, + const char *__msgid1, const char *__msgid2, + int __plural, unsigned long int __n, + int __category); +extern char *__textdomain (const char *__domainname); +extern char *__bindtextdomain (const char *__domainname, + const char *__dirname); +extern char *__bind_textdomain_codeset (const char *__domainname, + const char *__codeset); #else /* Declare the exported libintl_* functions, in a way that allows us to call them under their real name. */ +# undef _INTL_REDIRECT_INLINE +# undef _INTL_REDIRECT_MACROS # define _INTL_REDIRECT_MACROS # include "libgnuintl.h" -extern char *libintl_dcigettext PARAMS ((const char *__domainname, - const char *__msgid1, - const char *__msgid2, - int __plural, unsigned long int __n, - int __category)); +extern char *libintl_dcigettext (const char *__domainname, + const char *__msgid1, const char *__msgid2, + int __plural, unsigned long int __n, + int __category); #endif /* @@ begin of epilog @@ */ diff --git a/intl/gmo.h b/intl/gmo.h index d1fe4d6b8..e7c9cc14b 100644 --- a/intl/gmo.h +++ b/intl/gmo.h @@ -1,5 +1,5 @@ /* Description of GNU message catalog format: general file layout. - Copyright (C) 1995, 1997, 2000-2002 Free Software Foundation, Inc. + Copyright (C) 1995, 1997, 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 Library General Public License as published @@ -29,6 +29,7 @@ /* Revision number of the currently used .mo (binary) file format. */ #define MO_REVISION_NUMBER 0 +#define MO_REVISION_NUMBER_WITH_SYSDEP_I 1 /* The following contortions are an attempt to use the C preprocessor to determine an unsigned integral type that is 32 bits wide. An @@ -76,7 +77,7 @@ struct mo_file_header /* The revision number of the file format. */ nls_uint32 revision; - /* The following are only used in .mo files with major revision 0. */ + /* The following are only used in .mo files with major revision 0 or 1. */ /* The number of strings pairs. */ nls_uint32 nstrings; diff --git a/intl/hash-string.h b/intl/hash-string.h index b267a8778..093e3b1c1 100644 --- a/intl/hash-string.h +++ b/intl/hash-string.h @@ -1,5 +1,5 @@ /* Description of GNU message catalog format: string hashing function. - Copyright (C) 1995, 1997, 1998, 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 1995, 1997-1998, 2000-2003 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 @@ -18,14 +18,6 @@ /* @@ 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 @@ -33,11 +25,8 @@ /* 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; +hash_string (const char *str_param) { unsigned long int hval, g; const char *str = str_param; @@ -47,7 +36,7 @@ hash_string (str_param) while (*str != '\0') { hval <<= 4; - hval += (unsigned long int) *str++; + hval += (unsigned char) *str++; g = hval & ((unsigned long int) 0xf << (HASHWORDBITS - 4)); if (g != 0) { diff --git a/intl/intl-compat.c b/intl/intl-compat.c index 36b7af0f8..96f9d955d 100644 --- a/intl/intl-compat.c +++ b/intl/intl-compat.c @@ -58,8 +58,7 @@ DLL_EXPORTED char * -gettext (msgid) - const char *msgid; +gettext (const char *msgid) { return libintl_gettext (msgid); } @@ -67,9 +66,7 @@ gettext (msgid) DLL_EXPORTED char * -dgettext (domainname, msgid) - const char *domainname; - const char *msgid; +dgettext (const char *domainname, const char *msgid) { return libintl_dgettext (domainname, msgid); } @@ -77,10 +74,7 @@ dgettext (domainname, msgid) DLL_EXPORTED char * -dcgettext (domainname, msgid, category) - const char *domainname; - const char *msgid; - int category; +dcgettext (const char *domainname, const char *msgid, int category) { return libintl_dcgettext (domainname, msgid, category); } @@ -88,10 +82,7 @@ dcgettext (domainname, msgid, category) DLL_EXPORTED char * -ngettext (msgid1, msgid2, n) - const char *msgid1; - const char *msgid2; - unsigned long int n; +ngettext (const char *msgid1, const char *msgid2, unsigned long int n) { return libintl_ngettext (msgid1, msgid2, n); } @@ -99,11 +90,8 @@ ngettext (msgid1, msgid2, n) DLL_EXPORTED char * -dngettext (domainname, msgid1, msgid2, n) - const char *domainname; - const char *msgid1; - const char *msgid2; - unsigned long int n; +dngettext (const char *domainname, + const char *msgid1, const char *msgid2, unsigned long int n) { return libintl_dngettext (domainname, msgid1, msgid2, n); } @@ -111,12 +99,9 @@ dngettext (domainname, msgid1, msgid2, n) DLL_EXPORTED char * -dcngettext (domainname, msgid1, msgid2, n, category) - const char *domainname; - const char *msgid1; - const char *msgid2; - unsigned long int n; - int category; +dcngettext (const char *domainname, + const char *msgid1, const char *msgid2, unsigned long int n, + int category) { return libintl_dcngettext (domainname, msgid1, msgid2, n, category); } @@ -124,8 +109,7 @@ dcngettext (domainname, msgid1, msgid2, n, category) DLL_EXPORTED char * -textdomain (domainname) - const char *domainname; +textdomain (const char *domainname) { return libintl_textdomain (domainname); } @@ -133,9 +117,7 @@ textdomain (domainname) DLL_EXPORTED char * -bindtextdomain (domainname, dirname) - const char *domainname; - const char *dirname; +bindtextdomain (const char *domainname, const char *dirname) { return libintl_bindtextdomain (domainname, dirname); } @@ -143,9 +125,7 @@ bindtextdomain (domainname, dirname) DLL_EXPORTED char * -bind_textdomain_codeset (domainname, codeset) - const char *domainname; - const char *codeset; +bind_textdomain_codeset (const char *domainname, const char *codeset) { return libintl_bind_textdomain_codeset (domainname, codeset); } diff --git a/intl/l10nflist.c b/intl/l10nflist.c index ec8713f8e..eb995aafa 100644 --- a/intl/l10nflist.c +++ b/intl/l10nflist.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-1999, 2000, 2001, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1995-1999, 2000-2003 Free Software Foundation, Inc. Contributed by Ulrich Drepper , 1995. This program is free software; you can redistribute it and/or modify it @@ -58,7 +58,7 @@ # endif #else # ifndef HAVE_STPCPY -static char *stpcpy PARAMS ((char *dest, const char *src)); +static char *stpcpy (char *dest, const char *src); # endif #endif @@ -84,12 +84,8 @@ static char *stpcpy PARAMS ((char *dest, const char *src)); #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; +argz_count__ (const char *argz, size_t len) { size_t count = 0; while (len > 0) @@ -112,13 +108,8 @@ argz_count__ (argz, len) #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; +argz_stringify__ (char *argz, size_t len, int sep) { while (len > 0) { @@ -139,14 +130,8 @@ 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; +argz_next__ (char *argz, size_t argz_len, const char *entry) { if (entry) { @@ -167,11 +152,8 @@ argz_next__ (argz, argz_len, entry) /* Return number of bits set in X. */ -static int pop PARAMS ((int x)); - static inline int -pop (x) - int x; +pop (int x) { /* We assume that no more than 16 bits are used. */ x = ((x & ~0x5555) >> 1) + (x & 0x5555); @@ -184,23 +166,13 @@ pop (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; +_nl_make_l10nflist (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 **lastp; @@ -393,9 +365,7 @@ _nl_make_l10nflist (l10nfile_list, dirlist, dirlist_len, mask, language, 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; +_nl_normalize_codeset (const char *codeset, size_t name_len) { int len = 0; int only_digit = 1; @@ -442,9 +412,7 @@ _nl_normalize_codeset (codeset, name_len) to be defined. */ #if !_LIBC && !HAVE_STPCPY static char * -stpcpy (dest, src) - char *dest; - const char *src; +stpcpy (char *dest, const char *src) { while ((*dest++ = *src++) != '\0') /* Do nothing. */ ; diff --git a/intl/libgnuintl.h.in b/intl/libgnuintl.h.in index f596cfcb2..3be7eb990 100644 --- a/intl/libgnuintl.h.in +++ b/intl/libgnuintl.h.in @@ -47,16 +47,6 @@ # undef 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 @@ -93,7 +83,7 @@ extern "C" { If he doesn't, we choose the method. A third possible method is _INTL_REDIRECT_ASM, supported only by GCC. */ #if !(defined _INTL_REDIRECT_INLINE || defined _INTL_REDIRECT_MACROS) -# if __GNUC__ >= 2 && !defined __APPLE_CC__ && (defined __STDC__ || defined __cplusplus) +# if __GNUC__ >= 2 && !defined __APPLE_CC__ && !defined __MINGW32__ && !(__GNUC__ == 2 && defined _AIX) && (defined __STDC__ || defined __cplusplus) # define _INTL_REDIRECT_ASM # else # ifdef __cplusplus @@ -125,7 +115,7 @@ static inline char *gettext (const char *__msgid) #ifdef _INTL_REDIRECT_MACROS # define gettext libintl_gettext #endif -extern char *gettext _INTL_PARAMS ((const char *__msgid)) +extern char *gettext (const char *__msgid) _INTL_ASM (libintl_gettext); #endif @@ -141,8 +131,7 @@ static inline char *dgettext (const char *__domainname, const char *__msgid) #ifdef _INTL_REDIRECT_MACROS # define dgettext libintl_dgettext #endif -extern char *dgettext _INTL_PARAMS ((const char *__domainname, - const char *__msgid)) +extern char *dgettext (const char *__domainname, const char *__msgid) _INTL_ASM (libintl_dgettext); #endif @@ -160,9 +149,8 @@ static inline char *dcgettext (const char *__domainname, const char *__msgid, #ifdef _INTL_REDIRECT_MACROS # define dcgettext libintl_dcgettext #endif -extern char *dcgettext _INTL_PARAMS ((const char *__domainname, - const char *__msgid, - int __category)) +extern char *dcgettext (const char *__domainname, const char *__msgid, + int __category) _INTL_ASM (libintl_dcgettext); #endif @@ -181,9 +169,8 @@ static inline char *ngettext (const char *__msgid1, const char *__msgid2, #ifdef _INTL_REDIRECT_MACROS # define ngettext libintl_ngettext #endif -extern char *ngettext _INTL_PARAMS ((const char *__msgid1, - const char *__msgid2, - unsigned long int __n)) +extern char *ngettext (const char *__msgid1, const char *__msgid2, + unsigned long int __n) _INTL_ASM (libintl_ngettext); #endif @@ -201,10 +188,9 @@ static inline char *dngettext (const char *__domainname, const char *__msgid1, #ifdef _INTL_REDIRECT_MACROS # define dngettext libintl_dngettext #endif -extern char *dngettext _INTL_PARAMS ((const char *__domainname, - const char *__msgid1, - const char *__msgid2, - unsigned long int __n)) +extern char *dngettext (const char *__domainname, + const char *__msgid1, const char *__msgid2, + unsigned long int __n) _INTL_ASM (libintl_dngettext); #endif @@ -224,11 +210,9 @@ static inline char *dcngettext (const char *__domainname, #ifdef _INTL_REDIRECT_MACROS # define dcngettext libintl_dcngettext #endif -extern char *dcngettext _INTL_PARAMS ((const char *__domainname, - const char *__msgid1, - const char *__msgid2, - unsigned long int __n, - int __category)) +extern char *dcngettext (const char *__domainname, + const char *__msgid1, const char *__msgid2, + unsigned long int __n, int __category) _INTL_ASM (libintl_dcngettext); #endif @@ -246,7 +230,7 @@ static inline char *textdomain (const char *__domainname) #ifdef _INTL_REDIRECT_MACROS # define textdomain libintl_textdomain #endif -extern char *textdomain _INTL_PARAMS ((const char *__domainname)) +extern char *textdomain (const char *__domainname) _INTL_ASM (libintl_textdomain); #endif @@ -264,8 +248,7 @@ static inline char *bindtextdomain (const char *__domainname, #ifdef _INTL_REDIRECT_MACROS # define bindtextdomain libintl_bindtextdomain #endif -extern char *bindtextdomain _INTL_PARAMS ((const char *__domainname, - const char *__dirname)) +extern char *bindtextdomain (const char *__domainname, const char *__dirname) _INTL_ASM (libintl_bindtextdomain); #endif @@ -283,12 +266,103 @@ static inline char *bind_textdomain_codeset (const char *__domainname, #ifdef _INTL_REDIRECT_MACROS # define bind_textdomain_codeset libintl_bind_textdomain_codeset #endif -extern char *bind_textdomain_codeset _INTL_PARAMS ((const char *__domainname, - const char *__codeset)) +extern char *bind_textdomain_codeset (const char *__domainname, + const char *__codeset) _INTL_ASM (libintl_bind_textdomain_codeset); #endif +/* Support for format strings with positions in *printf(), following the + POSIX/XSI specification. + Note: These replacements for the *printf() functions are visible only + in source files that #include or #include "gettext.h". + Packages that use *printf() in source files that don't refer to _() + or gettext() but for which the format string could be the return value + of _() or gettext() need to add this #include. Oh well. */ + +#if !@HAVE_POSIX_PRINTF@ + +#include +#include + +/* Get va_list. */ +#if __STDC__ || defined __cplusplus || defined _MSC_VER +# include +#else +# include +#endif + +#undef fprintf +#define fprintf libintl_fprintf +extern int fprintf (FILE *, const char *, ...); +#undef vfprintf +#define vfprintf libintl_vfprintf +extern int vfprintf (FILE *, const char *, va_list); + +#undef printf +#define printf libintl_printf +extern int printf (const char *, ...); +#undef vprintf +#define vprintf libintl_vprintf +extern int vprintf (const char *, va_list); + +#undef sprintf +#define sprintf libintl_sprintf +extern int sprintf (char *, const char *, ...); +#undef vsprintf +#define vsprintf libintl_vsprintf +extern int vsprintf (char *, const char *, va_list); + +#if @HAVE_SNPRINTF@ + +#undef snprintf +#define snprintf libintl_snprintf +extern int snprintf (char *, size_t, const char *, ...); +#undef vsnprintf +#define vsnprintf libintl_vsnprintf +extern int vsnprintf (char *, size_t, const char *, va_list); + +#endif + +#if @HAVE_ASPRINTF@ + +#undef asprintf +#define asprintf libintl_asprintf +extern int asprintf (char **, const char *, ...); +#undef vasprintf +#define vasprintf libintl_vasprintf +extern int vasprintf (char **, const char *, va_list); + +#endif + +#if @HAVE_WPRINTF@ + +#undef fwprintf +#define fwprintf libintl_fwprintf +extern int fwprintf (FILE *, const wchar_t *, ...); +#undef vfwprintf +#define vfwprintf libintl_vfwprintf +extern int vfwprintf (FILE *, const wchar_t *, va_list); + +#undef wprintf +#define wprintf libintl_wprintf +extern int wprintf (const wchar_t *, ...); +#undef vwprintf +#define vwprintf libintl_vwprintf +extern int vwprintf (const wchar_t *, va_list); + +#undef swprintf +#define swprintf libintl_swprintf +extern int swprintf (wchar_t *, size_t, const wchar_t *, ...); +#undef vswprintf +#define vswprintf libintl_vswprintf +extern int vswprintf (wchar_t *, size_t, const wchar_t *, va_list); + +#endif + +#endif + + /* Support for relocatable packages. */ /* Sets the original and the current installation prefix of the package. @@ -298,8 +372,8 @@ extern char *bind_textdomain_codeset _INTL_PARAMS ((const char *__domainname, instead of "/"). */ #define libintl_set_relocation_prefix libintl_set_relocation_prefix extern void - libintl_set_relocation_prefix _INTL_PARAMS ((const char *orig_prefix, - const char *curr_prefix)); + libintl_set_relocation_prefix (const char *orig_prefix, + const char *curr_prefix); #ifdef __cplusplus diff --git a/intl/loadinfo.h b/intl/loadinfo.h index 1d3ba6162..65e5ebd1f 100644 --- a/intl/loadinfo.h +++ b/intl/loadinfo.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-1999, 2000-2002 Free Software Foundation, Inc. +/* Copyright (C) 1996-1999, 2000-2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1996. @@ -32,14 +32,6 @@ 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 @@ -89,8 +81,8 @@ struct loaded_l10nfile 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 const char *_nl_normalize_codeset (const char *codeset, + size_t name_len); /* Lookup a locale dependent file. *L10NFILE_LIST denotes a pool of lookup results of locale dependent @@ -107,19 +99,18 @@ extern const char *_nl_normalize_codeset PARAMS ((const char *codeset, furthermore its ->successor[] field contains a list of other lookup results from which this lookup result inherits. */ 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)); +_nl_make_l10nflist (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); /* Lookup the real locale name for a locale alias NAME, or NULL if NAME is not a locale alias (but possibly a real locale name). The return value is statically allocated and must not be freed. */ -extern const char *_nl_expand_alias PARAMS ((const char *name)); +extern const char *_nl_expand_alias (const char *name); /* Split a locale name NAME into its pieces: language, modifier, territory, codeset, special, sponsor, revision. @@ -139,18 +130,16 @@ extern const char *_nl_expand_alias PARAMS ((const char *name)); CEN_SPONSOR for *SPONSOR, CEN_REVISION for *REVISION. */ -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 int _nl_explode_name (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); /* Split a locale name NAME into a leading language part and all the rest. Return a pointer to the first character after the language, i.e. to the first byte of the rest. */ -extern char *_nl_find_language PARAMS ((const char *name)); +extern char *_nl_find_language (const char *name); #endif /* loadinfo.h */ diff --git a/intl/loadmsgcat.c b/intl/loadmsgcat.c index 8509bd345..99c51b4c5 100644 --- a/intl/loadmsgcat.c +++ b/intl/loadmsgcat.c @@ -1,5 +1,5 @@ /* Load needed message catalogs. - Copyright (C) 1995-1999, 2000-2003 Free Software Foundation, Inc. + Copyright (C) 1995-1999, 2000-2004 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 @@ -491,11 +491,6 @@ char *alloca (); #endif -/* Prototypes for local functions. Needed to ensure compiler checking of - function argument counts despite of K&R C function definition syntax. */ -static const char *get_sysdep_segment_value PARAMS ((const char *name)); - - /* 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. */ @@ -504,8 +499,7 @@ int _nl_msg_cat_cntr; /* Expand a system dependent string segment. Return NULL if unsupported. */ static const char * -get_sysdep_segment_value (name) - const char *name; +get_sysdep_segment_value (const char *name) { /* Test for an ISO C 99 section 7.8.1 format string directive. Syntax: @@ -754,6 +748,18 @@ get_sysdep_segment_value (name) } } } + /* Test for a glibc specific printf() format directive flag. */ + if (name[0] == 'I' && name[1] == '\0') + { +#if defined _LIBC || __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) + /* The 'I' flag, in numeric format directives, replaces ASCII digits + with the 'outdigits' defined in the LC_CTYPE locale facet. This is + used for Farsi (Persian) and maybe Arabic. */ + return "I"; +#else + return ""; +#endif + } /* Other system dependent strings are not valid. */ return NULL; } @@ -762,10 +768,9 @@ get_sysdep_segment_value (name) 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; +_nl_init_domain_conv (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 @@ -829,7 +834,7 @@ _nl_init_domain_conv (domain_file, domain, domainbinding) outcharset = _NL_CURRENT (LC_CTYPE, CODESET); # else # if HAVE_ICONV - extern const char *locale_charset PARAMS ((void)); + extern const char *locale_charset (void); outcharset = locale_charset (); # endif # endif @@ -881,8 +886,7 @@ _nl_init_domain_conv (domain_file, domain, domainbinding) /* Frees the codeset dependent parts of an opened message catalog. */ void internal_function -_nl_free_domain_conv (domain) - struct loaded_domain *domain; +_nl_free_domain_conv (struct loaded_domain *domain) { if (domain->conv_tab != NULL && domain->conv_tab != (char **) -1) free (domain->conv_tab); @@ -902,9 +906,8 @@ _nl_free_domain_conv (domain) message catalog do nothing. */ void internal_function -_nl_load_domain (domain_file, domainbinding) - struct loaded_l10nfile *domain_file; - struct binding *domainbinding; +_nl_load_domain (struct loaded_l10nfile *domain_file, + struct binding *domainbinding) { int fd; size_t size; @@ -1028,10 +1031,11 @@ _nl_load_domain (domain_file, domainbinding) /* Fill in the information about the available tables. */ revision = W (domain->must_swap, data->revision); - /* We support only the major revision 0. */ + /* We support only the major revisions 0 and 1. */ switch (revision >> 16) { case 0: + case 1: domain->nstrings = W (domain->must_swap, data->nstrings); domain->orig_tab = (const struct string_desc *) ((char *) data + W (domain->must_swap, data->orig_tab_offset)); @@ -1071,12 +1075,13 @@ _nl_load_domain (domain_file, domainbinding) const char **sysdep_segment_values; const nls_uint32 *orig_sysdep_tab; const nls_uint32 *trans_sysdep_tab; + nls_uint32 n_inmem_sysdep_strings; size_t memneed; char *mem; struct sysdep_string_desc *inmem_orig_sysdep_tab; struct sysdep_string_desc *inmem_trans_sysdep_tab; nls_uint32 *inmem_hash_tab; - unsigned int i; + unsigned int i, j; /* Get the values of the system dependent segments. */ n_sysdep_segments = @@ -1111,153 +1116,247 @@ _nl_load_domain (domain_file, domainbinding) + W (domain->must_swap, data->trans_sysdep_tab_offset)); /* Compute the amount of additional memory needed for the - system dependent strings and the augmented hash table. */ - memneed = 2 * n_sysdep_strings - * sizeof (struct sysdep_string_desc) - + domain->hash_size * sizeof (nls_uint32); - for (i = 0; i < 2 * n_sysdep_strings; i++) + system dependent strings and the augmented hash table. + At the same time, also drop string pairs which refer to + an undefined system dependent segment. */ + n_inmem_sysdep_strings = 0; + memneed = domain->hash_size * sizeof (nls_uint32); + for (i = 0; i < n_sysdep_strings; i++) { - const struct sysdep_string *sysdep_string = - (const struct sysdep_string *) - ((char *) data - + W (domain->must_swap, - i < n_sysdep_strings - ? orig_sysdep_tab[i] - : trans_sysdep_tab[i - n_sysdep_strings])); - size_t need = 0; - const struct segment_pair *p = sysdep_string->segments; - - if (W (domain->must_swap, p->sysdepref) != SEGMENTS_END) - for (p = sysdep_string->segments;; p++) - { - nls_uint32 sysdepref; - - need += W (domain->must_swap, p->segsize); - - sysdepref = W (domain->must_swap, p->sysdepref); - if (sysdepref == SEGMENTS_END) - break; - - if (sysdepref >= n_sysdep_segments) + int valid = 1; + size_t needs[2]; + + for (j = 0; j < 2; j++) + { + const struct sysdep_string *sysdep_string = + (const struct sysdep_string *) + ((char *) data + + W (domain->must_swap, + j == 0 + ? orig_sysdep_tab[i] + : trans_sysdep_tab[i])); + size_t need = 0; + const struct segment_pair *p = sysdep_string->segments; + + if (W (domain->must_swap, p->sysdepref) != SEGMENTS_END) + for (p = sysdep_string->segments;; p++) { - /* Invalid. */ - freea (sysdep_segment_values); - goto invalid; - } + nls_uint32 sysdepref; - need += strlen (sysdep_segment_values[sysdepref]); - } + need += W (domain->must_swap, p->segsize); - memneed += need; - } + sysdepref = W (domain->must_swap, p->sysdepref); + if (sysdepref == SEGMENTS_END) + break; - /* Allocate additional memory. */ - mem = (char *) malloc (memneed); - if (mem == NULL) - goto invalid; - - domain->malloced = mem; - inmem_orig_sysdep_tab = (struct sysdep_string_desc *) mem; - mem += n_sysdep_strings * sizeof (struct sysdep_string_desc); - inmem_trans_sysdep_tab = (struct sysdep_string_desc *) mem; - mem += n_sysdep_strings * sizeof (struct sysdep_string_desc); - inmem_hash_tab = (nls_uint32 *) mem; - mem += domain->hash_size * sizeof (nls_uint32); - - /* Compute the system dependent strings. */ - for (i = 0; i < 2 * n_sysdep_strings; i++) - { - const struct sysdep_string *sysdep_string = - (const struct sysdep_string *) - ((char *) data - + W (domain->must_swap, - i < n_sysdep_strings - ? orig_sysdep_tab[i] - : trans_sysdep_tab[i - n_sysdep_strings])); - const char *static_segments = - (char *) data - + W (domain->must_swap, sysdep_string->offset); - const struct segment_pair *p = sysdep_string->segments; + if (sysdepref >= n_sysdep_segments) + { + /* Invalid. */ + freea (sysdep_segment_values); + goto invalid; + } + + if (sysdep_segment_values[sysdepref] == NULL) + { + /* This particular string pair is invalid. */ + valid = 0; + break; + } + + need += strlen (sysdep_segment_values[sysdepref]); + } - /* Concatenate the segments, and fill - inmem_orig_sysdep_tab[i] (for i < n_sysdep_strings) and - inmem_trans_sysdep_tab[i-n_sysdep_strings] (for - i >= n_sysdep_strings). */ + needs[j] = need; + if (!valid) + break; + } - if (W (domain->must_swap, p->sysdepref) == SEGMENTS_END) + if (valid) { - /* Only one static segment. */ - inmem_orig_sysdep_tab[i].length = - W (domain->must_swap, p->segsize); - inmem_orig_sysdep_tab[i].pointer = static_segments; + n_inmem_sysdep_strings++; + memneed += needs[0] + needs[1]; } - else + } + memneed += 2 * n_inmem_sysdep_strings + * sizeof (struct sysdep_string_desc); + + if (n_inmem_sysdep_strings > 0) + { + unsigned int k; + + /* Allocate additional memory. */ + mem = (char *) malloc (memneed); + if (mem == NULL) + goto invalid; + + domain->malloced = mem; + inmem_orig_sysdep_tab = (struct sysdep_string_desc *) mem; + mem += n_inmem_sysdep_strings + * sizeof (struct sysdep_string_desc); + inmem_trans_sysdep_tab = (struct sysdep_string_desc *) mem; + mem += n_inmem_sysdep_strings + * sizeof (struct sysdep_string_desc); + inmem_hash_tab = (nls_uint32 *) mem; + mem += domain->hash_size * sizeof (nls_uint32); + + /* Compute the system dependent strings. */ + k = 0; + for (i = 0; i < n_sysdep_strings; i++) { - inmem_orig_sysdep_tab[i].pointer = mem; + int valid = 1; - for (p = sysdep_string->segments;; p++) + for (j = 0; j < 2; j++) { - nls_uint32 segsize = - W (domain->must_swap, p->segsize); - nls_uint32 sysdepref = - W (domain->must_swap, p->sysdepref); - size_t n; + const struct sysdep_string *sysdep_string = + (const struct sysdep_string *) + ((char *) data + + W (domain->must_swap, + j == 0 + ? orig_sysdep_tab[i] + : trans_sysdep_tab[i])); + const struct segment_pair *p = + sysdep_string->segments; + + if (W (domain->must_swap, p->sysdepref) + != SEGMENTS_END) + for (p = sysdep_string->segments;; p++) + { + nls_uint32 sysdepref; + + sysdepref = + W (domain->must_swap, p->sysdepref); + if (sysdepref == SEGMENTS_END) + break; + + if (sysdep_segment_values[sysdepref] == NULL) + { + /* This particular string pair is + invalid. */ + valid = 0; + break; + } + } + + if (!valid) + break; + } - if (segsize > 0) + if (valid) + { + for (j = 0; j < 2; j++) { - memcpy (mem, static_segments, segsize); - mem += segsize; - static_segments += segsize; + const struct sysdep_string *sysdep_string = + (const struct sysdep_string *) + ((char *) data + + W (domain->must_swap, + j == 0 + ? orig_sysdep_tab[i] + : trans_sysdep_tab[i])); + const char *static_segments = + (char *) data + + W (domain->must_swap, sysdep_string->offset); + const struct segment_pair *p = + sysdep_string->segments; + + /* Concatenate the segments, and fill + inmem_orig_sysdep_tab[k] (for j == 0) and + inmem_trans_sysdep_tab[k] (for j == 1). */ + + struct sysdep_string_desc *inmem_tab_entry = + (j == 0 + ? inmem_orig_sysdep_tab + : inmem_trans_sysdep_tab) + + k; + + if (W (domain->must_swap, p->sysdepref) + == SEGMENTS_END) + { + /* Only one static segment. */ + inmem_tab_entry->length = + W (domain->must_swap, p->segsize); + inmem_tab_entry->pointer = static_segments; + } + else + { + inmem_tab_entry->pointer = mem; + + for (p = sysdep_string->segments;; p++) + { + nls_uint32 segsize = + W (domain->must_swap, p->segsize); + nls_uint32 sysdepref = + W (domain->must_swap, p->sysdepref); + size_t n; + + if (segsize > 0) + { + memcpy (mem, static_segments, segsize); + mem += segsize; + static_segments += segsize; + } + + if (sysdepref == SEGMENTS_END) + break; + + n = strlen (sysdep_segment_values[sysdepref]); + memcpy (mem, sysdep_segment_values[sysdepref], n); + mem += n; + } + + inmem_tab_entry->length = + mem - inmem_tab_entry->pointer; + } } - if (sysdepref == SEGMENTS_END) - break; - - n = strlen (sysdep_segment_values[sysdepref]); - memcpy (mem, sysdep_segment_values[sysdepref], n); - mem += n; + k++; } - - inmem_orig_sysdep_tab[i].length = - mem - inmem_orig_sysdep_tab[i].pointer; } - } - - /* Compute the augmented hash table. */ - for (i = 0; i < domain->hash_size; i++) - inmem_hash_tab[i] = - W (domain->must_swap_hash_tab, domain->hash_tab[i]); - for (i = 0; i < n_sysdep_strings; i++) - { - const char *msgid = inmem_orig_sysdep_tab[i].pointer; - 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)); - - for (;;) + if (k != n_inmem_sysdep_strings) + abort (); + + /* Compute the augmented hash table. */ + for (i = 0; i < domain->hash_size; i++) + inmem_hash_tab[i] = + W (domain->must_swap_hash_tab, domain->hash_tab[i]); + for (i = 0; i < n_inmem_sysdep_strings; i++) { - if (inmem_hash_tab[idx] == 0) + const char *msgid = inmem_orig_sysdep_tab[i].pointer; + 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)); + + for (;;) { - /* Hash table entry is empty. Use it. */ - inmem_hash_tab[idx] = 1 + domain->nstrings + i; - break; - } + if (inmem_hash_tab[idx] == 0) + { + /* Hash table entry is empty. Use it. */ + inmem_hash_tab[idx] = 1 + domain->nstrings + i; + break; + } - if (idx >= domain->hash_size - incr) - idx -= domain->hash_size - incr; - else - idx += incr; + if (idx >= domain->hash_size - incr) + idx -= domain->hash_size - incr; + else + idx += incr; + } } - } - freea (sysdep_segment_values); + domain->n_sysdep_strings = n_inmem_sysdep_strings; + domain->orig_sysdep_tab = inmem_orig_sysdep_tab; + domain->trans_sysdep_tab = inmem_trans_sysdep_tab; - domain->n_sysdep_strings = n_sysdep_strings; - domain->orig_sysdep_tab = inmem_orig_sysdep_tab; - domain->trans_sysdep_tab = inmem_trans_sysdep_tab; + domain->hash_tab = inmem_hash_tab; + domain->must_swap_hash_tab = 0; + } + else + { + domain->n_sysdep_strings = 0; + domain->orig_sysdep_tab = NULL; + domain->trans_sysdep_tab = NULL; + } - domain->hash_tab = inmem_hash_tab; - domain->must_swap_hash_tab = 0; + freea (sysdep_segment_values); } else { @@ -1299,8 +1398,7 @@ _nl_load_domain (domain_file, domainbinding) #ifdef _LIBC void internal_function -_nl_unload_domain (domain) - struct loaded_domain *domain; +_nl_unload_domain (struct loaded_domain *domain) { if (domain->plural != &__gettext_germanic_plural) __gettext_free_exp (domain->plural); diff --git a/intl/localcharset.c b/intl/localcharset.c index d04d05368..4865f1037 100644 --- a/intl/localcharset.c +++ b/intl/localcharset.c @@ -86,7 +86,7 @@ # define ISSLASH(C) ((C) == DIRECTORY_SEPARATOR) #endif -#ifdef HAVE_GETC_UNLOCKED +#if HAVE_DECL_GETC_UNLOCKED # undef getc # define getc getc_unlocked #endif diff --git a/intl/locale.alias b/intl/locale.alias index bd7b9b31e..bd6bb2562 100644 --- a/intl/locale.alias +++ b/intl/locale.alias @@ -1,5 +1,5 @@ # Locale name alias data base. -# Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc. +# Copyright (C) 1996-2001,2003 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 @@ -29,8 +29,8 @@ # Packages using this file: -bokmal no_NO.ISO-8859-1 -bokmål no_NO.ISO-8859-1 +bokmal nb_NO.ISO-8859-1 +bokmål nb_NO.ISO-8859-1 catalan ca_ES.ISO-8859-1 croatian hr_HR.ISO-8859-2 czech cs_CZ.ISO-8859-2 @@ -61,9 +61,9 @@ 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 +no_NO nb_NO.ISO-8859-1 +no_NO.ISO-8859-1 nb_NO.ISO-8859-1 +norwegian nb_NO.ISO-8859-1 nynorsk nn_NO.ISO-8859-1 polish pl_PL.ISO-8859-2 portuguese pt_PT.ISO-8859-1 diff --git a/intl/localealias.c b/intl/localealias.c index 7c4ce58f2..2eaf8813e 100644 --- a/intl/localealias.c +++ b/intl/localealias.c @@ -110,11 +110,11 @@ __libc_lock_define_initialized (static, lock); # define freea(p) free (p) #endif -#if defined _LIBC_REENTRANT || defined HAVE_FGETS_UNLOCKED +#if defined _LIBC_REENTRANT || HAVE_DECL_FGETS_UNLOCKED # undef fgets # define fgets(buf, len, s) fgets_unlocked (buf, len, s) #endif -#if defined _LIBC_REENTRANT || defined HAVE_FEOF_UNLOCKED +#if defined _LIBC_REENTRANT || HAVE_DECL_FEOF_UNLOCKED # undef feof # define feof(s) feof_unlocked (s) #endif @@ -140,16 +140,15 @@ static size_t maxmap; /* Prototypes for local functions. */ -static size_t read_alias_file PARAMS ((const char *fname, int fname_len)) +static size_t read_alias_file (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)); +static int extend_alias_table (void); +static int alias_compare (const struct alias_map *map1, + const struct alias_map *map2); const char * -_nl_expand_alias (name) - const char *name; +_nl_expand_alias (const char *name) { static const char *locale_alias_path; struct alias_map *retval; @@ -172,8 +171,8 @@ _nl_expand_alias (name) if (nmap > 0) retval = (struct alias_map *) bsearch (&item, map, nmap, sizeof (struct alias_map), - (int (*) PARAMS ((const void *, - const void *)) + (int (*) (const void *, + const void *) ) alias_compare); else retval = NULL; @@ -215,9 +214,7 @@ _nl_expand_alias (name) static size_t internal_function -read_alias_file (fname, fname_len) - const char *fname; - int fname_len; +read_alias_file (const char *fname, int fname_len) { FILE *fp; char *full_fname; @@ -361,7 +358,7 @@ read_alias_file (fname, fname_len) if (added > 0) qsort (map, nmap, sizeof (struct alias_map), - (int (*) PARAMS ((const void *, const void *))) alias_compare); + (int (*) (const void *, const void *)) alias_compare); return added; } @@ -387,9 +384,7 @@ extend_alias_table () static int -alias_compare (map1, map2) - const struct alias_map *map1; - const struct alias_map *map2; +alias_compare (const struct alias_map *map1, const struct alias_map *map2) { #if defined _LIBC || defined HAVE_STRCASECMP return strcasecmp (map1->alias, map2->alias); diff --git a/intl/localename.c b/intl/localename.c index faacecd50..5662e54ff 100644 --- a/intl/localename.c +++ b/intl/localename.c @@ -1,5 +1,5 @@ /* Determine the current selected locale. - Copyright (C) 1995-1999, 2000-2002 Free Software Foundation, Inc. + Copyright (C) 1995-1999, 2000-2004 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 @@ -34,6 +34,124 @@ #ifdef WIN32 # define WIN32_LEAN_AND_MEAN # include +/* List of language codes, sorted by value: + 0x01 LANG_ARABIC + 0x02 LANG_BULGARIAN + 0x03 LANG_CATALAN + 0x04 LANG_CHINESE + 0x05 LANG_CZECH + 0x06 LANG_DANISH + 0x07 LANG_GERMAN + 0x08 LANG_GREEK + 0x09 LANG_ENGLISH + 0x0a LANG_SPANISH + 0x0b LANG_FINNISH + 0x0c LANG_FRENCH + 0x0d LANG_HEBREW + 0x0e LANG_HUNGARIAN + 0x0f LANG_ICELANDIC + 0x10 LANG_ITALIAN + 0x11 LANG_JAPANESE + 0x12 LANG_KOREAN + 0x13 LANG_DUTCH + 0x14 LANG_NORWEGIAN + 0x15 LANG_POLISH + 0x16 LANG_PORTUGUESE + 0x17 LANG_RHAETO_ROMANCE + 0x18 LANG_ROMANIAN + 0x19 LANG_RUSSIAN + 0x1a LANG_CROATIAN == LANG_SERBIAN + 0x1b LANG_SLOVAK + 0x1c LANG_ALBANIAN + 0x1d LANG_SWEDISH + 0x1e LANG_THAI + 0x1f LANG_TURKISH + 0x20 LANG_URDU + 0x21 LANG_INDONESIAN + 0x22 LANG_UKRAINIAN + 0x23 LANG_BELARUSIAN + 0x24 LANG_SLOVENIAN + 0x25 LANG_ESTONIAN + 0x26 LANG_LATVIAN + 0x27 LANG_LITHUANIAN + 0x28 LANG_TAJIK + 0x29 LANG_FARSI + 0x2a LANG_VIETNAMESE + 0x2b LANG_ARMENIAN + 0x2c LANG_AZERI + 0x2d LANG_BASQUE + 0x2e LANG_SORBIAN + 0x2f LANG_MACEDONIAN + 0x30 LANG_SUTU + 0x31 LANG_TSONGA + 0x32 LANG_TSWANA + 0x33 LANG_VENDA + 0x34 LANG_XHOSA + 0x35 LANG_ZULU + 0x36 LANG_AFRIKAANS + 0x37 LANG_GEORGIAN + 0x38 LANG_FAEROESE + 0x39 LANG_HINDI + 0x3a LANG_MALTESE + 0x3b LANG_SAAMI + 0x3c LANG_GAELIC + 0x3d LANG_YIDDISH + 0x3e LANG_MALAY + 0x3f LANG_KAZAK + 0x40 LANG_KYRGYZ + 0x41 LANG_SWAHILI + 0x42 LANG_TURKMEN + 0x43 LANG_UZBEK + 0x44 LANG_TATAR + 0x45 LANG_BENGALI + 0x46 LANG_PUNJABI + 0x47 LANG_GUJARATI + 0x48 LANG_ORIYA + 0x49 LANG_TAMIL + 0x4a LANG_TELUGU + 0x4b LANG_KANNADA + 0x4c LANG_MALAYALAM + 0x4d LANG_ASSAMESE + 0x4e LANG_MARATHI + 0x4f LANG_SANSKRIT + 0x50 LANG_MONGOLIAN + 0x51 LANG_TIBETAN + 0x52 LANG_WELSH + 0x53 LANG_CAMBODIAN + 0x54 LANG_LAO + 0x55 LANG_BURMESE + 0x56 LANG_GALICIAN + 0x57 LANG_KONKANI + 0x58 LANG_MANIPURI + 0x59 LANG_SINDHI + 0x5a LANG_SYRIAC + 0x5b LANG_SINHALESE + 0x5c LANG_CHEROKEE + 0x5d LANG_INUKTITUT + 0x5e LANG_AMHARIC + 0x5f LANG_TAMAZIGHT + 0x60 LANG_KASHMIRI + 0x61 LANG_NEPALI + 0x62 LANG_FRISIAN + 0x63 LANG_PASHTO + 0x64 LANG_TAGALOG + 0x65 LANG_DIVEHI + 0x66 LANG_EDO + 0x67 LANG_FULFULDE + 0x68 LANG_HAUSA + 0x69 LANG_IBIBIO + 0x6a LANG_YORUBA + 0x70 LANG_IGBO + 0x71 LANG_KANURI + 0x72 LANG_OROMO + 0x73 LANG_TIGRINYA + 0x74 LANG_GUARANI + 0x75 LANG_HAWAIIAN + 0x76 LANG_LATIN + 0x77 LANG_SOMALI + 0x78 LANG_YI + 0x79 LANG_PAPIAMENTU +*/ /* Mingw headers don't have latest language and sublanguage codes. */ # ifndef LANG_AFRIKAANS # define LANG_AFRIKAANS 0x36 @@ -41,6 +159,9 @@ # ifndef LANG_ALBANIAN # define LANG_ALBANIAN 0x1c # endif +# ifndef LANG_AMHARIC +# define LANG_AMHARIC 0x5e +# endif # ifndef LANG_ARABIC # define LANG_ARABIC 0x01 # endif @@ -62,12 +183,24 @@ # ifndef LANG_BENGALI # define LANG_BENGALI 0x45 # endif +# ifndef LANG_BURMESE +# define LANG_BURMESE 0x55 +# endif +# ifndef LANG_CAMBODIAN +# define LANG_CAMBODIAN 0x53 +# endif # ifndef LANG_CATALAN # define LANG_CATALAN 0x03 # endif +# ifndef LANG_CHEROKEE +# define LANG_CHEROKEE 0x5c +# endif # ifndef LANG_DIVEHI # define LANG_DIVEHI 0x65 # endif +# ifndef LANG_EDO +# define LANG_EDO 0x66 +# endif # ifndef LANG_ESTONIAN # define LANG_ESTONIAN 0x25 # endif @@ -77,27 +210,57 @@ # ifndef LANG_FARSI # define LANG_FARSI 0x29 # endif +# ifndef LANG_FRISIAN +# define LANG_FRISIAN 0x62 +# endif +# ifndef LANG_FULFULDE +# define LANG_FULFULDE 0x67 +# endif +# ifndef LANG_GAELIC +# define LANG_GAELIC 0x3c +# endif # ifndef LANG_GALICIAN # define LANG_GALICIAN 0x56 # endif # ifndef LANG_GEORGIAN # define LANG_GEORGIAN 0x37 # endif +# ifndef LANG_GUARANI +# define LANG_GUARANI 0x74 +# endif # ifndef LANG_GUJARATI # define LANG_GUJARATI 0x47 # endif +# ifndef LANG_HAUSA +# define LANG_HAUSA 0x68 +# endif +# ifndef LANG_HAWAIIAN +# define LANG_HAWAIIAN 0x75 +# endif # ifndef LANG_HEBREW # define LANG_HEBREW 0x0d # endif # ifndef LANG_HINDI # define LANG_HINDI 0x39 # endif +# ifndef LANG_IBIBIO +# define LANG_IBIBIO 0x69 +# endif +# ifndef LANG_IGBO +# define LANG_IGBO 0x70 +# endif # ifndef LANG_INDONESIAN # define LANG_INDONESIAN 0x21 # endif +# ifndef LANG_INUKTITUT +# define LANG_INUKTITUT 0x5d +# endif # ifndef LANG_KANNADA # define LANG_KANNADA 0x4b # endif +# ifndef LANG_KANURI +# define LANG_KANURI 0x71 +# endif # ifndef LANG_KASHMIRI # define LANG_KASHMIRI 0x60 # endif @@ -110,6 +273,12 @@ # ifndef LANG_KYRGYZ # define LANG_KYRGYZ 0x40 # endif +# ifndef LANG_LAO +# define LANG_LAO 0x54 +# endif +# ifndef LANG_LATIN +# define LANG_LATIN 0x76 +# endif # ifndef LANG_LATVIAN # define LANG_LATVIAN 0x26 # endif @@ -125,6 +294,9 @@ # ifndef LANG_MALAYALAM # define LANG_MALAYALAM 0x4c # endif +# ifndef LANG_MALTESE +# define LANG_MALTESE 0x3a +# endif # ifndef LANG_MANIPURI # define LANG_MANIPURI 0x58 # endif @@ -140,9 +312,24 @@ # ifndef LANG_ORIYA # define LANG_ORIYA 0x48 # endif +# ifndef LANG_OROMO +# define LANG_OROMO 0x72 +# endif +# ifndef LANG_PAPIAMENTU +# define LANG_PAPIAMENTU 0x79 +# endif +# ifndef LANG_PASHTO +# define LANG_PASHTO 0x63 +# endif # ifndef LANG_PUNJABI # define LANG_PUNJABI 0x46 # endif +# ifndef LANG_RHAETO_ROMANCE +# define LANG_RHAETO_ROMANCE 0x17 +# endif +# ifndef LANG_SAAMI +# define LANG_SAAMI 0x3b +# endif # ifndef LANG_SANSKRIT # define LANG_SANSKRIT 0x4f # endif @@ -152,18 +339,36 @@ # ifndef LANG_SINDHI # define LANG_SINDHI 0x59 # endif +# ifndef LANG_SINHALESE +# define LANG_SINHALESE 0x5b +# endif # ifndef LANG_SLOVAK # define LANG_SLOVAK 0x1b # endif +# ifndef LANG_SOMALI +# define LANG_SOMALI 0x77 +# endif # ifndef LANG_SORBIAN # define LANG_SORBIAN 0x2e # endif +# ifndef LANG_SUTU +# define LANG_SUTU 0x30 +# endif # ifndef LANG_SWAHILI # define LANG_SWAHILI 0x41 # endif # ifndef LANG_SYRIAC # define LANG_SYRIAC 0x5a # endif +# ifndef LANG_TAGALOG +# define LANG_TAGALOG 0x64 +# endif +# ifndef LANG_TAJIK +# define LANG_TAJIK 0x28 +# endif +# ifndef LANG_TAMAZIGHT +# define LANG_TAMAZIGHT 0x5f +# endif # ifndef LANG_TAMIL # define LANG_TAMIL 0x49 # endif @@ -176,6 +381,21 @@ # ifndef LANG_THAI # define LANG_THAI 0x1e # endif +# ifndef LANG_TIBETAN +# define LANG_TIBETAN 0x51 +# endif +# ifndef LANG_TIGRINYA +# define LANG_TIGRINYA 0x73 +# endif +# ifndef LANG_TSONGA +# define LANG_TSONGA 0x31 +# endif +# ifndef LANG_TSWANA +# define LANG_TSWANA 0x32 +# endif +# ifndef LANG_TURKMEN +# define LANG_TURKMEN 0x42 +# endif # ifndef LANG_UKRAINIAN # define LANG_UKRAINIAN 0x22 # endif @@ -185,9 +405,30 @@ # ifndef LANG_UZBEK # define LANG_UZBEK 0x43 # endif +# ifndef LANG_VENDA +# define LANG_VENDA 0x33 +# endif # ifndef LANG_VIETNAMESE # define LANG_VIETNAMESE 0x2a # endif +# ifndef LANG_WELSH +# define LANG_WELSH 0x52 +# endif +# ifndef LANG_XHOSA +# define LANG_XHOSA 0x34 +# endif +# ifndef LANG_YI +# define LANG_YI 0x78 +# endif +# ifndef LANG_YIDDISH +# define LANG_YIDDISH 0x3d +# endif +# ifndef LANG_YORUBA +# define LANG_YORUBA 0x6a +# endif +# ifndef LANG_ZULU +# define LANG_ZULU 0x35 +# endif # ifndef SUBLANG_ARABIC_SAUDI_ARABIA # define SUBLANG_ARABIC_SAUDI_ARABIA 0x01 # endif @@ -242,6 +483,12 @@ # ifndef SUBLANG_AZERI_CYRILLIC # define SUBLANG_AZERI_CYRILLIC 0x02 # endif +# ifndef SUBLANG_BENGALI_INDIA +# define SUBLANG_BENGALI_INDIA 0x00 +# endif +# ifndef SUBLANG_BENGALI_BANGLADESH +# define SUBLANG_BENGALI_BANGLADESH 0x01 +# endif # ifndef SUBLANG_CHINESE_MACAU # define SUBLANG_CHINESE_MACAU 0x05 # endif @@ -266,12 +513,54 @@ # ifndef SUBLANG_ENGLISH_PHILIPPINES # define SUBLANG_ENGLISH_PHILIPPINES 0x0d # endif +# ifndef SUBLANG_ENGLISH_INDONESIA +# define SUBLANG_ENGLISH_INDONESIA 0x0e +# endif +# ifndef SUBLANG_ENGLISH_HONGKONG +# define SUBLANG_ENGLISH_HONGKONG 0x0f +# endif +# ifndef SUBLANG_ENGLISH_INDIA +# define SUBLANG_ENGLISH_INDIA 0x10 +# endif +# ifndef SUBLANG_ENGLISH_MALAYSIA +# define SUBLANG_ENGLISH_MALAYSIA 0x11 +# endif +# ifndef SUBLANG_ENGLISH_SINGAPORE +# define SUBLANG_ENGLISH_SINGAPORE 0x12 +# endif # ifndef SUBLANG_FRENCH_LUXEMBOURG # define SUBLANG_FRENCH_LUXEMBOURG 0x05 # endif # ifndef SUBLANG_FRENCH_MONACO # define SUBLANG_FRENCH_MONACO 0x06 # endif +# ifndef SUBLANG_FRENCH_WESTINDIES +# define SUBLANG_FRENCH_WESTINDIES 0x07 +# endif +# ifndef SUBLANG_FRENCH_REUNION +# define SUBLANG_FRENCH_REUNION 0x08 +# endif +# ifndef SUBLANG_FRENCH_CONGO +# define SUBLANG_FRENCH_CONGO 0x09 +# endif +# ifndef SUBLANG_FRENCH_SENEGAL +# define SUBLANG_FRENCH_SENEGAL 0x0a +# endif +# ifndef SUBLANG_FRENCH_CAMEROON +# define SUBLANG_FRENCH_CAMEROON 0x0b +# endif +# ifndef SUBLANG_FRENCH_COTEDIVOIRE +# define SUBLANG_FRENCH_COTEDIVOIRE 0x0c +# endif +# ifndef SUBLANG_FRENCH_MALI +# define SUBLANG_FRENCH_MALI 0x0d +# endif +# ifndef SUBLANG_FRENCH_MOROCCO +# define SUBLANG_FRENCH_MOROCCO 0x0e +# endif +# ifndef SUBLANG_FRENCH_HAITI +# define SUBLANG_FRENCH_HAITI 0x0f +# endif # ifndef SUBLANG_GERMAN_LUXEMBOURG # define SUBLANG_GERMAN_LUXEMBOURG 0x04 # endif @@ -290,12 +579,30 @@ # ifndef SUBLANG_NEPALI_INDIA # define SUBLANG_NEPALI_INDIA 0x02 # endif +# ifndef SUBLANG_PUNJABI_INDIA +# define SUBLANG_PUNJABI_INDIA 0x00 +# endif +# ifndef SUBLANG_PUNJABI_PAKISTAN +# define SUBLANG_PUNJABI_PAKISTAN 0x01 +# endif +# ifndef SUBLANG_ROMANIAN_ROMANIA +# define SUBLANG_ROMANIAN_ROMANIA 0x00 +# endif +# ifndef SUBLANG_ROMANIAN_MOLDOVA +# define SUBLANG_ROMANIAN_MOLDOVA 0x01 +# endif # ifndef SUBLANG_SERBIAN_LATIN # define SUBLANG_SERBIAN_LATIN 0x02 # endif # ifndef SUBLANG_SERBIAN_CYRILLIC # define SUBLANG_SERBIAN_CYRILLIC 0x03 # endif +# ifndef SUBLANG_SINDHI_INDIA +# define SUBLANG_SINDHI_INDIA 0x00 +# endif +# ifndef SUBLANG_SINDHI_PAKISTAN +# define SUBLANG_SINDHI_PAKISTAN 0x01 +# endif # ifndef SUBLANG_SPANISH_GUATEMALA # define SUBLANG_SPANISH_GUATEMALA 0x04 # endif @@ -350,6 +657,18 @@ # ifndef SUBLANG_SWEDISH_FINLAND # define SUBLANG_SWEDISH_FINLAND 0x02 # endif +# ifndef SUBLANG_TAMAZIGHT_ARABIC +# define SUBLANG_TAMAZIGHT_ARABIC 0x01 +# endif +# ifndef SUBLANG_TAMAZIGHT_LATIN +# define SUBLANG_TAMAZIGHT_LATIN 0x02 +# endif +# ifndef SUBLANG_TIGRINYA_ETHIOPIA +# define SUBLANG_TIGRINYA_ETHIOPIA 0x00 +# endif +# ifndef SUBLANG_TIGRINYA_ERITREA +# define SUBLANG_TIGRINYA_ERITREA 0x01 +# endif # ifndef SUBLANG_URDU_PAKISTAN # define SUBLANG_URDU_PAKISTAN 0x01 # endif @@ -381,9 +700,7 @@ The result must not be freed; it is statically allocated. */ const char * -_nl_locale_name (category, categoryname) - int category; - const char *categoryname; +_nl_locale_name (int category, const char *categoryname) { const char *retval; @@ -454,7 +771,7 @@ _nl_locale_name (category, categoryname) { case LANG_AFRIKAANS: return "af_ZA"; case LANG_ALBANIAN: return "sq_AL"; - case 0x5e: /* AMHARIC */ return "am_ET"; + case LANG_AMHARIC: return "am_ET"; case LANG_ARABIC: switch (sub) { @@ -489,12 +806,18 @@ _nl_locale_name (category, categoryname) 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_BENGALI: + switch (sub) + { + case SUBLANG_BENGALI_INDIA: return "bn_IN"; + case SUBLANG_BENGALI_BANGLADESH: return "bn_BD"; + } + return "bn"; case LANG_BULGARIAN: return "bg_BG"; - case 0x55: /* BURMESE */ return "my_MM"; - case 0x53: /* CAMBODIAN */ return "km_KH"; + case LANG_BURMESE: return "my_MM"; + case LANG_CAMBODIAN: return "km_KH"; case LANG_CATALAN: return "ca_ES"; - case 0x5c: /* CHEROKEE */ return "chr_US"; + case LANG_CHEROKEE: return "chr_US"; case LANG_CHINESE: switch (sub) { @@ -516,13 +839,13 @@ _nl_locale_name (category, categoryname) switch (sub) { case SUBLANG_DEFAULT: return "hr_HR"; - case SUBLANG_SERBIAN_LATIN: return "sr_YU"; - case SUBLANG_SERBIAN_CYRILLIC: return "sr_YU@cyrillic"; + case SUBLANG_SERBIAN_LATIN: return "sr_CS"; + case SUBLANG_SERBIAN_CYRILLIC: return "sr_CS@cyrillic"; } return "hr"; case LANG_CZECH: return "cs_CZ"; case LANG_DANISH: return "da_DK"; - case LANG_DIVEHI: return "div_MV"; + case LANG_DIVEHI: return "dv_MV"; case LANG_DUTCH: switch (sub) { @@ -530,7 +853,7 @@ _nl_locale_name (category, categoryname) case SUBLANG_DUTCH_BELGIAN: /* FLEMISH, VLAAMS */ return "nl_BE"; } return "nl"; - case 0x66: /* EDO */ return "bin_NG"; + case LANG_EDO: return "bin_NG"; case LANG_ENGLISH: switch (sub) { @@ -551,6 +874,11 @@ _nl_locale_name (category, categoryname) case SUBLANG_ENGLISH_TRINIDAD: return "en_TT"; case SUBLANG_ENGLISH_ZIMBABWE: return "en_ZW"; case SUBLANG_ENGLISH_PHILIPPINES: return "en_PH"; + case SUBLANG_ENGLISH_INDONESIA: return "en_ID"; + case SUBLANG_ENGLISH_HONGKONG: return "en_HK"; + case SUBLANG_ENGLISH_INDIA: return "en_IN"; + case SUBLANG_ENGLISH_MALAYSIA: return "en_MY"; + case SUBLANG_ENGLISH_SINGAPORE: return "en_SG"; } return "en"; case LANG_ESTONIAN: return "et_EE"; @@ -566,11 +894,22 @@ _nl_locale_name (category, categoryname) case SUBLANG_FRENCH_SWISS: return "fr_CH"; case SUBLANG_FRENCH_LUXEMBOURG: return "fr_LU"; case SUBLANG_FRENCH_MONACO: return "fr_MC"; + case SUBLANG_FRENCH_WESTINDIES: return "fr"; /* Caribbean? */ + case SUBLANG_FRENCH_REUNION: return "fr_RE"; + case SUBLANG_FRENCH_CONGO: return "fr_CG"; + case SUBLANG_FRENCH_SENEGAL: return "fr_SN"; + case SUBLANG_FRENCH_CAMEROON: return "fr_CM"; + case SUBLANG_FRENCH_COTEDIVOIRE: return "fr_CI"; + case SUBLANG_FRENCH_MALI: return "fr_ML"; + case SUBLANG_FRENCH_MOROCCO: return "fr_MA"; + case SUBLANG_FRENCH_HAITI: return "fr_HT"; } return "fr"; - case 0x62: /* FRISIAN */ return "fy_NL"; - case 0x67: /* FULFULDE */ return "ful_NG"; - case 0x3c: /* GAELIC */ + case LANG_FRISIAN: return "fy_NL"; + case LANG_FULFULDE: + /* Spoken in Nigeria, Guinea, Senegal, Mali, Niger, Cameroon, Benin. */ + return "ff_NG"; + case LANG_GAELIC: switch (sub) { case 0x01: /* SCOTTISH */ return "gd_GB"; @@ -590,21 +929,21 @@ _nl_locale_name (category, categoryname) } return "de"; case LANG_GREEK: return "el_GR"; - case 0x74: /* GUARANI */ return "gn_PY"; + case LANG_GUARANI: return "gn_PY"; case LANG_GUJARATI: return "gu_IN"; - case 0x68: /* HAUSA */ return "ha_NG"; - case 0x75: /* HAWAIIAN */ + case LANG_HAUSA: return "ha_NG"; + case LANG_HAWAIIAN: /* FIXME: Do they mean Hawaiian ("haw_US", 1000 speakers) or Hawaii Creole English ("cpe_US", 600000 speakers)? */ return "cpe_US"; case LANG_HEBREW: return "he_IL"; case LANG_HINDI: return "hi_IN"; case LANG_HUNGARIAN: return "hu_HU"; - case 0x69: /* IBIBIO */ return "nic_NG"; + case LANG_IBIBIO: return "nic_NG"; case LANG_ICELANDIC: return "is_IS"; - case 0x70: /* IGBO */ return "ibo_NG"; + case LANG_IGBO: return "ig_NG"; case LANG_INDONESIAN: return "id_ID"; - case 0x5d: /* INUKTITUT */ return "iu_CA"; + case LANG_INUKTITUT: return "iu_CA"; case LANG_ITALIAN: switch (sub) { @@ -614,7 +953,7 @@ _nl_locale_name (category, categoryname) return "it"; case LANG_JAPANESE: return "ja_JP"; case LANG_KANNADA: return "kn_IN"; - case 0x71: /* KANURI */ return "kau_NG"; + case LANG_KANURI: return "kr_NG"; case LANG_KASHMIRI: switch (sub) { @@ -628,8 +967,8 @@ _nl_locale_name (category, categoryname) return "kok_IN"; case LANG_KOREAN: return "ko_KR"; case LANG_KYRGYZ: return "ky_KG"; - case 0x54: /* LAO */ return "lo_LA"; - case 0x76: /* LATIN */ return "la_VA"; + case LANG_LAO: return "lo_LA"; + case LANG_LATIN: return "la_VA"; case LANG_LATVIAN: return "lv_LV"; case LANG_LITHUANIAN: return "lt_LT"; case LANG_MACEDONIAN: return "mk_MK"; @@ -641,7 +980,7 @@ _nl_locale_name (category, categoryname) } return "ms"; case LANG_MALAYALAM: return "ml_IN"; - case 0x3a: /* MALTESE */ return "mt_MT"; + case LANG_MALTESE: return "mt_MT"; case LANG_MANIPURI: /* FIXME: Adjust this when such locales appear on Unix. */ return "mni_IN"; @@ -663,9 +1002,9 @@ _nl_locale_name (category, categoryname) } return "no"; case LANG_ORIYA: return "or_IN"; - case 0x72: /* OROMO */ return "om_ET"; - case 0x79: /* PAPIAMENTU */ return "pap_AN"; - case 0x63: /* PASHTO */ + case LANG_OROMO: return "om_ET"; + case LANG_PAPIAMENTU: return "pap_AN"; + case LANG_PASHTO: return "ps"; /* Ambiguous: could be "ps_PK" or "ps_AF". */ case LANG_POLISH: return "pl_PL"; case LANG_PORTUGUESE: @@ -677,18 +1016,36 @@ _nl_locale_name (category, categoryname) case SUBLANG_PORTUGUESE_BRAZILIAN: return "pt_BR"; } return "pt"; - case LANG_PUNJABI: return "pa_IN"; - case 0x17: /* RHAETO-ROMANCE */ return "rm_CH"; - case LANG_ROMANIAN: return "ro_RO"; + case LANG_PUNJABI: + switch (sub) + { + case SUBLANG_PUNJABI_INDIA: return "pa_IN"; /* Gurmukhi script */ + case SUBLANG_PUNJABI_PAKISTAN: return "pa_PK"; /* Arabic script */ + } + return "pa"; + case LANG_RHAETO_ROMANCE: return "rm_CH"; + case LANG_ROMANIAN: + switch (sub) + { + case SUBLANG_ROMANIAN_ROMANIA: return "ro_RO"; + case SUBLANG_ROMANIAN_MOLDOVA: return "ro_MD"; + } + return "ro"; case LANG_RUSSIAN: - return "ru"; /* Ambiguous: could be "ru_RU" or "ru_UA". */ - case 0x3b: /* SAMI */ return "se_NO"; + return "ru"; /* Ambiguous: could be "ru_RU" or "ru_UA" or "ru_MD". */ + case LANG_SAAMI: /* actually Northern Sami */ return "se_NO"; case LANG_SANSKRIT: return "sa_IN"; - case LANG_SINDHI: return "sd"; - case 0x5b: /* SINHALESE */ return "si_LK"; + case LANG_SINDHI: + switch (sub) + { + case SUBLANG_SINDHI_INDIA: return "sd_IN"; + case SUBLANG_SINDHI_PAKISTAN: return "sd_PK"; + } + return "sd"; + case LANG_SINHALESE: return "si_LK"; case LANG_SLOVAK: return "sk_SK"; case LANG_SLOVENIAN: return "sl_SI"; - case 0x77: /* SOMALI */ return "so_SO"; + case LANG_SOMALI: return "so_SO"; case LANG_SORBIAN: /* FIXME: Adjust this when such locales appear on Unix. */ return "wen_DE"; @@ -718,7 +1075,7 @@ _nl_locale_name (category, categoryname) case SUBLANG_SPANISH_PUERTO_RICO: return "es_PR"; } return "es"; - case 0x30: /* SUTU */ return "bnt_TZ"; + case LANG_SUTU: return "bnt_TZ"; /* or "st_LS" or "nso_ZA"? */ case LANG_SWAHILI: return "sw_KE"; case LANG_SWEDISH: switch (sub) @@ -728,19 +1085,33 @@ _nl_locale_name (category, categoryname) } return "sv"; case LANG_SYRIAC: return "syr_TR"; /* An extinct language. */ - case 0x64: /* TAGALOG */ return "tl_PH"; - case 0x28: /* TAJIK */ return "tg_TJ"; - case 0x5f: /* TAMAZIGHT */ return "ber_MA"; + case LANG_TAGALOG: return "tl_PH"; + case LANG_TAJIK: return "tg_TJ"; + case LANG_TAMAZIGHT: + switch (sub) + { + /* FIXME: Adjust this when Tamazight locales appear on Unix. */ + case SUBLANG_TAMAZIGHT_ARABIC: return "ber_MA@arabic"; + case SUBLANG_TAMAZIGHT_LATIN: return "ber_MA@latin"; + } + return "ber_MA"; case LANG_TAMIL: return "ta"; /* Ambiguous: could be "ta_IN" or "ta_LK" or "ta_SG". */ case LANG_TATAR: return "tt_RU"; case LANG_TELUGU: return "te_IN"; case LANG_THAI: return "th_TH"; - case 0x51: /* TIBETAN */ return "bo_CN"; - case 0x73: /* TIGRINYA */ return "ti_ET"; - case 0x31: /* TSONGA */ return "ts_ZA"; + case LANG_TIBETAN: return "bo_CN"; + case LANG_TIGRINYA: + switch (sub) + { + case SUBLANG_TIGRINYA_ETHIOPIA: return "ti_ET"; + case SUBLANG_TIGRINYA_ERITREA: return "ti_ER"; + } + return "ti"; + case LANG_TSONGA: return "ts_ZA"; + case LANG_TSWANA: return "tn_BW"; case LANG_TURKISH: return "tr_TR"; - case 0x42: /* TURKMEN */ return "tk_TM"; + case LANG_TURKMEN: return "tk_TM"; case LANG_UKRAINIAN: return "uk_UA"; case LANG_URDU: switch (sub) @@ -752,19 +1123,18 @@ _nl_locale_name (category, categoryname) 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_LATIN: return "uz_UZ"; case SUBLANG_UZBEK_CYRILLIC: return "uz_UZ@cyrillic"; } return "uz"; - case 0x33: /* VENDA */ return "ven_ZA"; + case LANG_VENDA: return "ve_ZA"; case LANG_VIETNAMESE: return "vi_VN"; - case 0x52: /* WELSH */ return "cy_GB"; - case 0x34: /* XHOSA */ return "xh_ZA"; - case 0x78: /* YI */ return "sit_CN"; - case 0x3d: /* YIDDISH */ return "yi_IL"; - case 0x6a: /* YORUBA */ return "yo_NG"; - case 0x35: /* ZULU */ return "zu_ZA"; + case LANG_WELSH: return "cy_GB"; + case LANG_XHOSA: return "xh_ZA"; + case LANG_YI: return "sit_CN"; + case LANG_YIDDISH: return "yi_IL"; + case LANG_YORUBA: return "yo_NG"; + case LANG_ZULU: return "zu_ZA"; default: return "C"; } diff --git a/intl/log.c b/intl/log.c index 9c84791b9..cb6076e80 100644 --- a/intl/log.c +++ b/intl/log.c @@ -28,9 +28,7 @@ /* Print an ASCII string with quotes and escape sequences where needed. */ static void -print_escaped (stream, str) - FILE *stream; - const char *str; +print_escaped (FILE *stream, const char *str) { putc ('"', stream); for (; *str != '\0'; str++) @@ -52,12 +50,8 @@ print_escaped (stream, str) /* Add to the log file an entry denoting a failed translation. */ void -_nl_log_untranslated (logfilename, domainname, msgid1, msgid2, plural) - const char *logfilename; - const char *domainname; - const char *msgid1; - const char *msgid2; - int plural; +_nl_log_untranslated (const char *logfilename, const char *domainname, + const char *msgid1, const char *msgid2, int plural) { static char *last_logfilename = NULL; static FILE *last_logfile = NULL; diff --git a/intl/ngettext.c b/intl/ngettext.c index 17a27f4aa..e73e00c48 100644 --- a/intl/ngettext.c +++ b/intl/ngettext.c @@ -1,5 +1,5 @@ /* Implementation of ngettext(3) function. - Copyright (C) 1995, 1997, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 1995, 1997, 2000-2003 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 @@ -54,10 +54,7 @@ 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; +NGETTEXT (const char *msgid1, const char *msgid2, unsigned long int n) { return DCNGETTEXT (NULL, msgid1, msgid2, n, LC_MESSAGES); } diff --git a/intl/plural-exp.c b/intl/plural-exp.c index c937c011a..8c04e6426 100644 --- a/intl/plural-exp.c +++ b/intl/plural-exp.c @@ -1,5 +1,5 @@ /* Expression parsing for plural form selection. - Copyright (C) 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 2000-2001, 2003 Free Software Foundation, Inc. Written by Ulrich Drepper , 2000. This program is free software; you can redistribute it and/or modify it @@ -96,10 +96,8 @@ init_germanic_plural () void internal_function -EXTRACT_PLURAL_EXPRESSION (nullentry, pluralp, npluralsp) - const char *nullentry; - struct expression **pluralp; - unsigned long int *npluralsp; +EXTRACT_PLURAL_EXPRESSION (const char *nullentry, struct expression **pluralp, + unsigned long int *npluralsp) { if (nullentry != NULL) { diff --git a/intl/plural-exp.h b/intl/plural-exp.h index 9e5d16583..49e2c5bfc 100644 --- a/intl/plural-exp.h +++ b/intl/plural-exp.h @@ -1,5 +1,5 @@ /* Expression parsing and evaluation for plural form selection. - Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 2000-2003 Free Software Foundation, Inc. Written by Ulrich Drepper , 2000. This program is free software; you can redistribute it and/or modify it @@ -20,14 +20,6 @@ #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 @@ -109,18 +101,18 @@ struct parse_args # define EXTRACT_PLURAL_EXPRESSION extract_plural_expression #endif -extern void FREE_EXPRESSION PARAMS ((struct expression *exp)) +extern void FREE_EXPRESSION (struct expression *exp) internal_function; -extern int PLURAL_PARSE PARAMS ((void *arg)); +extern int PLURAL_PARSE (void *arg); extern struct expression GERMANIC_PLURAL attribute_hidden; -extern void EXTRACT_PLURAL_EXPRESSION PARAMS ((const char *nullentry, - struct expression **pluralp, - unsigned long int *npluralsp)) +extern void EXTRACT_PLURAL_EXPRESSION (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)); +extern unsigned long int plural_eval (struct expression *pexp, + unsigned long int n); #endif #endif /* _PLURAL_EXP_H */ diff --git a/intl/plural.c b/intl/plural.c index 3a4fa20ca..72494f9eb 100644 --- a/intl/plural.c +++ b/intl/plural.c @@ -19,7 +19,7 @@ #line 1 "plural.y" /* Expression parsing for plural form selection. - Copyright (C) 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 2000-2001, 2003 Free Software Foundation, Inc. Written by Ulrich Drepper , 2000. This program is free software; you can redistribute it and/or modify it @@ -75,28 +75,13 @@ typedef union { #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)); +static int yylex (YYSTYPE *lval, const char **pexp); +static void yyerror (const char *str); /* Allocation of expressions. */ static struct expression * -new_exp (nargs, op, args) - int nargs; - enum operator op; - struct expression * const *args; +new_exp (int nargs, enum operator op, struct expression * const *args) { int i; struct expression *newp; @@ -125,16 +110,13 @@ new_exp (nargs, op, args) } static inline struct expression * -new_exp_0 (op) - enum operator op; +new_exp_0 (enum operator op) { return new_exp (0, op, NULL); } static inline struct expression * -new_exp_1 (op, right) - enum operator op; - struct expression *right; +new_exp_1 (enum operator op, struct expression *right) { struct expression *args[1]; @@ -143,10 +125,7 @@ new_exp_1 (op, right) } static struct expression * -new_exp_2 (op, left, right) - enum operator op; - struct expression *left; - struct expression *right; +new_exp_2 (enum operator op, struct expression *left, struct expression *right) { struct expression *args[2]; @@ -156,11 +135,8 @@ new_exp_2 (op, left, right) } static inline struct expression * -new_exp_3 (op, bexp, tbranch, fbranch) - enum operator op; - struct expression *bexp; - struct expression *tbranch; - struct expression *fbranch; +new_exp_3 (enum operator op, struct expression *bexp, + struct expression *tbranch, struct expression *fbranch) { struct expression *args[3]; @@ -236,8 +212,8 @@ static const short yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const short yyrline[] = { - 0, 174, 182, 186, 190, 194, 198, 202, 206, 210, - 214, 218, 223 + 0, 150, 158, 162, 166, 170, 174, 178, 182, 186, + 190, 194, 199 }; #endif @@ -1027,7 +1003,7 @@ yyparse (YYPARSE_PARAM_ARG) switch (yyn) { case 1: -#line 175 "plural.y" +#line 151 "plural.y" { if (yyvsp[0].exp == NULL) YYABORT; @@ -1035,68 +1011,68 @@ case 1: } break; case 2: -#line 183 "plural.y" +#line 159 "plural.y" { yyval.exp = new_exp_3 (qmop, yyvsp[-4].exp, yyvsp[-2].exp, yyvsp[0].exp); } break; case 3: -#line 187 "plural.y" +#line 163 "plural.y" { yyval.exp = new_exp_2 (lor, yyvsp[-2].exp, yyvsp[0].exp); } break; case 4: -#line 191 "plural.y" +#line 167 "plural.y" { yyval.exp = new_exp_2 (land, yyvsp[-2].exp, yyvsp[0].exp); } break; case 5: -#line 195 "plural.y" +#line 171 "plural.y" { yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp); } break; case 6: -#line 199 "plural.y" +#line 175 "plural.y" { yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp); } break; case 7: -#line 203 "plural.y" +#line 179 "plural.y" { yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp); } break; case 8: -#line 207 "plural.y" +#line 183 "plural.y" { yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp); } break; case 9: -#line 211 "plural.y" +#line 187 "plural.y" { yyval.exp = new_exp_1 (lnot, yyvsp[0].exp); } break; case 10: -#line 215 "plural.y" +#line 191 "plural.y" { yyval.exp = new_exp_0 (var); } break; case 11: -#line 219 "plural.y" +#line 195 "plural.y" { if ((yyval.exp = new_exp_0 (num)) != NULL) yyval.exp->val.num = yyvsp[0].num; } break; case 12: -#line 224 "plural.y" +#line 200 "plural.y" { yyval.exp = yyvsp[-1].exp; } @@ -1334,13 +1310,12 @@ case 12: #endif return yyresult; } -#line 229 "plural.y" +#line 205 "plural.y" void internal_function -FREE_EXPRESSION (exp) - struct expression *exp; +FREE_EXPRESSION (struct expression *exp) { if (exp == NULL) return; @@ -1366,9 +1341,7 @@ FREE_EXPRESSION (exp) static int -yylex (lval, pexp) - YYSTYPE *lval; - const char **pexp; +yylex (YYSTYPE *lval, const char **pexp) { const char *exp = *pexp; int result; @@ -1511,8 +1484,7 @@ yylex (lval, pexp) static void -yyerror (str) - const char *str; +yyerror (const char *str) { /* Do nothing. We don't print error messages here. */ } diff --git a/intl/plural.y b/intl/plural.y index 616b7c11a..4d33bd7c7 100644 --- a/intl/plural.y +++ b/intl/plural.y @@ -1,6 +1,6 @@ %{ /* Expression parsing for plural form selection. - Copyright (C) 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 2000-2001, 2003 Free Software Foundation, Inc. Written by Ulrich Drepper , 2000. This program is free software; you can redistribute it and/or modify it @@ -54,28 +54,13 @@ %{ /* 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)); +static int yylex (YYSTYPE *lval, const char **pexp); +static void yyerror (const char *str); /* Allocation of expressions. */ static struct expression * -new_exp (nargs, op, args) - int nargs; - enum operator op; - struct expression * const *args; +new_exp (int nargs, enum operator op, struct expression * const *args) { int i; struct expression *newp; @@ -104,16 +89,13 @@ new_exp (nargs, op, args) } static inline struct expression * -new_exp_0 (op) - enum operator op; +new_exp_0 (enum operator op) { return new_exp (0, op, NULL); } static inline struct expression * -new_exp_1 (op, right) - enum operator op; - struct expression *right; +new_exp_1 (enum operator op, struct expression *right) { struct expression *args[1]; @@ -122,10 +104,7 @@ new_exp_1 (op, right) } static struct expression * -new_exp_2 (op, left, right) - enum operator op; - struct expression *left; - struct expression *right; +new_exp_2 (enum operator op, struct expression *left, struct expression *right) { struct expression *args[2]; @@ -135,11 +114,8 @@ new_exp_2 (op, left, right) } static inline struct expression * -new_exp_3 (op, bexp, tbranch, fbranch) - enum operator op; - struct expression *bexp; - struct expression *tbranch; - struct expression *fbranch; +new_exp_3 (enum operator op, struct expression *bexp, + struct expression *tbranch, struct expression *fbranch) { struct expression *args[3]; @@ -230,8 +206,7 @@ exp: exp '?' exp ':' exp void internal_function -FREE_EXPRESSION (exp) - struct expression *exp; +FREE_EXPRESSION (struct expression *exp) { if (exp == NULL) return; @@ -257,9 +232,7 @@ FREE_EXPRESSION (exp) static int -yylex (lval, pexp) - YYSTYPE *lval; - const char **pexp; +yylex (YYSTYPE *lval, const char **pexp) { const char *exp = *pexp; int result; @@ -402,8 +375,7 @@ yylex (lval, pexp) static void -yyerror (str) - const char *str; +yyerror (const char *str) { /* Do nothing. We don't print error messages here. */ } diff --git a/intl/printf-args.c b/intl/printf-args.c new file mode 100644 index 000000000..f6f3219e7 --- /dev/null +++ b/intl/printf-args.c @@ -0,0 +1,119 @@ +/* Decomposed printf argument list. + Copyright (C) 1999, 2002-2003 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +/* Specification. */ +#include "printf-args.h" + +#ifdef STATIC +STATIC +#endif +int +printf_fetchargs (va_list args, arguments *a) +{ + size_t i; + argument *ap; + + for (i = 0, ap = &a->arg[0]; i < a->count; i++, ap++) + switch (ap->type) + { + case TYPE_SCHAR: + ap->a.a_schar = va_arg (args, /*signed char*/ int); + break; + case TYPE_UCHAR: + ap->a.a_uchar = va_arg (args, /*unsigned char*/ int); + break; + case TYPE_SHORT: + ap->a.a_short = va_arg (args, /*short*/ int); + break; + case TYPE_USHORT: + ap->a.a_ushort = va_arg (args, /*unsigned short*/ int); + break; + case TYPE_INT: + ap->a.a_int = va_arg (args, int); + break; + case TYPE_UINT: + ap->a.a_uint = va_arg (args, unsigned int); + break; + case TYPE_LONGINT: + ap->a.a_longint = va_arg (args, long int); + break; + case TYPE_ULONGINT: + ap->a.a_ulongint = va_arg (args, unsigned long int); + break; +#ifdef HAVE_LONG_LONG + case TYPE_LONGLONGINT: + ap->a.a_longlongint = va_arg (args, long long int); + break; + case TYPE_ULONGLONGINT: + ap->a.a_ulonglongint = va_arg (args, unsigned long long int); + break; +#endif + case TYPE_DOUBLE: + ap->a.a_double = va_arg (args, double); + break; +#ifdef HAVE_LONG_DOUBLE + case TYPE_LONGDOUBLE: + ap->a.a_longdouble = va_arg (args, long double); + break; +#endif + case TYPE_CHAR: + ap->a.a_char = va_arg (args, int); + break; +#ifdef HAVE_WINT_T + case TYPE_WIDE_CHAR: + ap->a.a_wide_char = va_arg (args, wint_t); + break; +#endif + case TYPE_STRING: + ap->a.a_string = va_arg (args, const char *); + break; +#ifdef HAVE_WCHAR_T + case TYPE_WIDE_STRING: + ap->a.a_wide_string = va_arg (args, const wchar_t *); + break; +#endif + case TYPE_POINTER: + ap->a.a_pointer = va_arg (args, void *); + break; + case TYPE_COUNT_SCHAR_POINTER: + ap->a.a_count_schar_pointer = va_arg (args, signed char *); + break; + case TYPE_COUNT_SHORT_POINTER: + ap->a.a_count_short_pointer = va_arg (args, short *); + break; + case TYPE_COUNT_INT_POINTER: + ap->a.a_count_int_pointer = va_arg (args, int *); + break; + case TYPE_COUNT_LONGINT_POINTER: + ap->a.a_count_longint_pointer = va_arg (args, long int *); + break; +#ifdef HAVE_LONG_LONG + case TYPE_COUNT_LONGLONGINT_POINTER: + ap->a.a_count_longlongint_pointer = va_arg (args, long long int *); + break; +#endif + default: + /* Unknown type. */ + return -1; + } + return 0; +} diff --git a/intl/printf-args.h b/intl/printf-args.h new file mode 100644 index 000000000..f11e64c04 --- /dev/null +++ b/intl/printf-args.h @@ -0,0 +1,137 @@ +/* Decomposed printf argument list. + Copyright (C) 1999, 2002-2003 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + USA. */ + +#ifndef _PRINTF_ARGS_H +#define _PRINTF_ARGS_H + +/* Get size_t. */ +#include + +/* Get wchar_t. */ +#ifdef HAVE_WCHAR_T +# include +#endif + +/* Get wint_t. */ +#ifdef HAVE_WINT_T +# include +#endif + +/* Get va_list. */ +#include + + +/* Argument types */ +typedef enum +{ + TYPE_NONE, + TYPE_SCHAR, + TYPE_UCHAR, + TYPE_SHORT, + TYPE_USHORT, + TYPE_INT, + TYPE_UINT, + TYPE_LONGINT, + TYPE_ULONGINT, +#ifdef HAVE_LONG_LONG + TYPE_LONGLONGINT, + TYPE_ULONGLONGINT, +#endif + TYPE_DOUBLE, +#ifdef HAVE_LONG_DOUBLE + TYPE_LONGDOUBLE, +#endif + TYPE_CHAR, +#ifdef HAVE_WINT_T + TYPE_WIDE_CHAR, +#endif + TYPE_STRING, +#ifdef HAVE_WCHAR_T + TYPE_WIDE_STRING, +#endif + TYPE_POINTER, + TYPE_COUNT_SCHAR_POINTER, + TYPE_COUNT_SHORT_POINTER, + TYPE_COUNT_INT_POINTER, + TYPE_COUNT_LONGINT_POINTER +#ifdef HAVE_LONG_LONG +, TYPE_COUNT_LONGLONGINT_POINTER +#endif +} arg_type; + +/* Polymorphic argument */ +typedef struct +{ + arg_type type; + union + { + signed char a_schar; + unsigned char a_uchar; + short a_short; + unsigned short a_ushort; + int a_int; + unsigned int a_uint; + long int a_longint; + unsigned long int a_ulongint; +#ifdef HAVE_LONG_LONG + long long int a_longlongint; + unsigned long long int a_ulonglongint; +#endif + float a_float; + double a_double; +#ifdef HAVE_LONG_DOUBLE + long double a_longdouble; +#endif + int a_char; +#ifdef HAVE_WINT_T + wint_t a_wide_char; +#endif + const char* a_string; +#ifdef HAVE_WCHAR_T + const wchar_t* a_wide_string; +#endif + void* a_pointer; + signed char * a_count_schar_pointer; + short * a_count_short_pointer; + int * a_count_int_pointer; + long int * a_count_longint_pointer; +#ifdef HAVE_LONG_LONG + long long int * a_count_longlongint_pointer; +#endif + } + a; +} +argument; + +typedef struct +{ + size_t count; + argument *arg; +} +arguments; + + +/* Fetch the arguments, putting them into a. */ +#ifdef STATIC +STATIC +#else +extern +#endif +int printf_fetchargs (va_list args, arguments *a); + +#endif /* _PRINTF_ARGS_H */ diff --git a/intl/printf-parse.c b/intl/printf-parse.c new file mode 100644 index 000000000..d19f903d7 --- /dev/null +++ b/intl/printf-parse.c @@ -0,0 +1,537 @@ +/* Formatted output to strings. + Copyright (C) 1999-2000, 2002-2003 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +/* Specification. */ +#if WIDE_CHAR_VERSION +# include "wprintf-parse.h" +#else +# include "printf-parse.h" +#endif + +/* Get size_t, NULL. */ +#include + +/* Get intmax_t. */ +#if HAVE_STDINT_H_WITH_UINTMAX +# include +#endif +#if HAVE_INTTYPES_H_WITH_UINTMAX +# include +#endif + +/* malloc(), realloc(), free(). */ +#include + +/* Checked size_t computations. */ +#include "xsize.h" + +#if WIDE_CHAR_VERSION +# define PRINTF_PARSE wprintf_parse +# define CHAR_T wchar_t +# define DIRECTIVE wchar_t_directive +# define DIRECTIVES wchar_t_directives +#else +# define PRINTF_PARSE printf_parse +# define CHAR_T char +# define DIRECTIVE char_directive +# define DIRECTIVES char_directives +#endif + +#ifdef STATIC +STATIC +#endif +int +PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a) +{ + const CHAR_T *cp = format; /* pointer into format */ + size_t arg_posn = 0; /* number of regular arguments consumed */ + size_t d_allocated; /* allocated elements of d->dir */ + size_t a_allocated; /* allocated elements of a->arg */ + size_t max_width_length = 0; + size_t max_precision_length = 0; + + d->count = 0; + d_allocated = 1; + d->dir = malloc (d_allocated * sizeof (DIRECTIVE)); + if (d->dir == NULL) + /* Out of memory. */ + return -1; + + a->count = 0; + a_allocated = 0; + a->arg = NULL; + +#define REGISTER_ARG(_index_,_type_) \ + { \ + size_t n = (_index_); \ + if (n >= a_allocated) \ + { \ + size_t memory_size; \ + argument *memory; \ + \ + a_allocated = xtimes (a_allocated, 2); \ + if (a_allocated <= n) \ + a_allocated = xsum (n, 1); \ + memory_size = xtimes (a_allocated, sizeof (argument)); \ + if (size_overflow_p (memory_size)) \ + /* Overflow, would lead to out of memory. */ \ + goto error; \ + memory = (a->arg \ + ? realloc (a->arg, memory_size) \ + : malloc (memory_size)); \ + if (memory == NULL) \ + /* Out of memory. */ \ + goto error; \ + a->arg = memory; \ + } \ + while (a->count <= n) \ + a->arg[a->count++].type = TYPE_NONE; \ + if (a->arg[n].type == TYPE_NONE) \ + a->arg[n].type = (_type_); \ + else if (a->arg[n].type != (_type_)) \ + /* Ambiguous type for positional argument. */ \ + goto error; \ + } + + while (*cp != '\0') + { + CHAR_T c = *cp++; + if (c == '%') + { + size_t arg_index = ARG_NONE; + DIRECTIVE *dp = &d->dir[d->count];/* pointer to next directive */ + + /* Initialize the next directive. */ + dp->dir_start = cp - 1; + dp->flags = 0; + dp->width_start = NULL; + dp->width_end = NULL; + dp->width_arg_index = ARG_NONE; + dp->precision_start = NULL; + dp->precision_end = NULL; + dp->precision_arg_index = ARG_NONE; + dp->arg_index = ARG_NONE; + + /* Test for positional argument. */ + if (*cp >= '0' && *cp <= '9') + { + const CHAR_T *np; + + for (np = cp; *np >= '0' && *np <= '9'; np++) + ; + if (*np == '$') + { + size_t n = 0; + + for (np = cp; *np >= '0' && *np <= '9'; np++) + n = xsum (xtimes (n, 10), *np - '0'); + if (n == 0) + /* Positional argument 0. */ + goto error; + if (size_overflow_p (n)) + /* n too large, would lead to out of memory later. */ + goto error; + arg_index = n - 1; + cp = np + 1; + } + } + + /* Read the flags. */ + for (;;) + { + if (*cp == '\'') + { + dp->flags |= FLAG_GROUP; + cp++; + } + else if (*cp == '-') + { + dp->flags |= FLAG_LEFT; + cp++; + } + else if (*cp == '+') + { + dp->flags |= FLAG_SHOWSIGN; + cp++; + } + else if (*cp == ' ') + { + dp->flags |= FLAG_SPACE; + cp++; + } + else if (*cp == '#') + { + dp->flags |= FLAG_ALT; + cp++; + } + else if (*cp == '0') + { + dp->flags |= FLAG_ZERO; + cp++; + } + else + break; + } + + /* Parse the field width. */ + if (*cp == '*') + { + dp->width_start = cp; + cp++; + dp->width_end = cp; + if (max_width_length < 1) + max_width_length = 1; + + /* Test for positional argument. */ + if (*cp >= '0' && *cp <= '9') + { + const CHAR_T *np; + + for (np = cp; *np >= '0' && *np <= '9'; np++) + ; + if (*np == '$') + { + size_t n = 0; + + for (np = cp; *np >= '0' && *np <= '9'; np++) + n = xsum (xtimes (n, 10), *np - '0'); + if (n == 0) + /* Positional argument 0. */ + goto error; + if (size_overflow_p (n)) + /* n too large, would lead to out of memory later. */ + goto error; + dp->width_arg_index = n - 1; + cp = np + 1; + } + } + if (dp->width_arg_index == ARG_NONE) + { + dp->width_arg_index = arg_posn++; + if (dp->width_arg_index == ARG_NONE) + /* arg_posn wrapped around. */ + goto error; + } + REGISTER_ARG (dp->width_arg_index, TYPE_INT); + } + else if (*cp >= '0' && *cp <= '9') + { + size_t width_length; + + dp->width_start = cp; + for (; *cp >= '0' && *cp <= '9'; cp++) + ; + dp->width_end = cp; + width_length = dp->width_end - dp->width_start; + if (max_width_length < width_length) + max_width_length = width_length; + } + + /* Parse the precision. */ + if (*cp == '.') + { + cp++; + if (*cp == '*') + { + dp->precision_start = cp - 1; + cp++; + dp->precision_end = cp; + if (max_precision_length < 2) + max_precision_length = 2; + + /* Test for positional argument. */ + if (*cp >= '0' && *cp <= '9') + { + const CHAR_T *np; + + for (np = cp; *np >= '0' && *np <= '9'; np++) + ; + if (*np == '$') + { + size_t n = 0; + + for (np = cp; *np >= '0' && *np <= '9'; np++) + n = xsum (xtimes (n, 10), *np - '0'); + if (n == 0) + /* Positional argument 0. */ + goto error; + if (size_overflow_p (n)) + /* n too large, would lead to out of memory + later. */ + goto error; + dp->precision_arg_index = n - 1; + cp = np + 1; + } + } + if (dp->precision_arg_index == ARG_NONE) + { + dp->precision_arg_index = arg_posn++; + if (dp->precision_arg_index == ARG_NONE) + /* arg_posn wrapped around. */ + goto error; + } + REGISTER_ARG (dp->precision_arg_index, TYPE_INT); + } + else + { + size_t precision_length; + + dp->precision_start = cp - 1; + for (; *cp >= '0' && *cp <= '9'; cp++) + ; + dp->precision_end = cp; + precision_length = dp->precision_end - dp->precision_start; + if (max_precision_length < precision_length) + max_precision_length = precision_length; + } + } + + { + arg_type type; + + /* Parse argument type/size specifiers. */ + { + int flags = 0; + + for (;;) + { + if (*cp == 'h') + { + flags |= (1 << (flags & 1)); + cp++; + } + else if (*cp == 'L') + { + flags |= 4; + cp++; + } + else if (*cp == 'l') + { + flags += 8; + cp++; + } +#ifdef HAVE_INTMAX_T + else if (*cp == 'j') + { + if (sizeof (intmax_t) > sizeof (long)) + { + /* intmax_t = long long */ + flags += 16; + } + else if (sizeof (intmax_t) > sizeof (int)) + { + /* intmax_t = long */ + flags += 8; + } + cp++; + } +#endif + else if (*cp == 'z' || *cp == 'Z') + { + /* 'z' is standardized in ISO C 99, but glibc uses 'Z' + because the warning facility in gcc-2.95.2 understands + only 'Z' (see gcc-2.95.2/gcc/c-common.c:1784). */ + if (sizeof (size_t) > sizeof (long)) + { + /* size_t = long long */ + flags += 16; + } + else if (sizeof (size_t) > sizeof (int)) + { + /* size_t = long */ + flags += 8; + } + cp++; + } + else if (*cp == 't') + { + if (sizeof (ptrdiff_t) > sizeof (long)) + { + /* ptrdiff_t = long long */ + flags += 16; + } + else if (sizeof (ptrdiff_t) > sizeof (int)) + { + /* ptrdiff_t = long */ + flags += 8; + } + cp++; + } + else + break; + } + + /* Read the conversion character. */ + c = *cp++; + switch (c) + { + case 'd': case 'i': +#ifdef HAVE_LONG_LONG + if (flags >= 16 || (flags & 4)) + type = TYPE_LONGLONGINT; + else +#endif + if (flags >= 8) + type = TYPE_LONGINT; + else if (flags & 2) + type = TYPE_SCHAR; + else if (flags & 1) + type = TYPE_SHORT; + else + type = TYPE_INT; + break; + case 'o': case 'u': case 'x': case 'X': +#ifdef HAVE_LONG_LONG + if (flags >= 16 || (flags & 4)) + type = TYPE_ULONGLONGINT; + else +#endif + if (flags >= 8) + type = TYPE_ULONGINT; + else if (flags & 2) + type = TYPE_UCHAR; + else if (flags & 1) + type = TYPE_USHORT; + else + type = TYPE_UINT; + break; + case 'f': case 'F': case 'e': case 'E': case 'g': case 'G': + case 'a': case 'A': +#ifdef HAVE_LONG_DOUBLE + if (flags >= 16 || (flags & 4)) + type = TYPE_LONGDOUBLE; + else +#endif + type = TYPE_DOUBLE; + break; + case 'c': + if (flags >= 8) +#ifdef HAVE_WINT_T + type = TYPE_WIDE_CHAR; +#else + goto error; +#endif + else + type = TYPE_CHAR; + break; +#ifdef HAVE_WINT_T + case 'C': + type = TYPE_WIDE_CHAR; + c = 'c'; + break; +#endif + case 's': + if (flags >= 8) +#ifdef HAVE_WCHAR_T + type = TYPE_WIDE_STRING; +#else + goto error; +#endif + else + type = TYPE_STRING; + break; +#ifdef HAVE_WCHAR_T + case 'S': + type = TYPE_WIDE_STRING; + c = 's'; + break; +#endif + case 'p': + type = TYPE_POINTER; + break; + case 'n': +#ifdef HAVE_LONG_LONG + if (flags >= 16 || (flags & 4)) + type = TYPE_COUNT_LONGLONGINT_POINTER; + else +#endif + if (flags >= 8) + type = TYPE_COUNT_LONGINT_POINTER; + else if (flags & 2) + type = TYPE_COUNT_SCHAR_POINTER; + else if (flags & 1) + type = TYPE_COUNT_SHORT_POINTER; + else + type = TYPE_COUNT_INT_POINTER; + break; + case '%': + type = TYPE_NONE; + break; + default: + /* Unknown conversion character. */ + goto error; + } + } + + if (type != TYPE_NONE) + { + dp->arg_index = arg_index; + if (dp->arg_index == ARG_NONE) + { + dp->arg_index = arg_posn++; + if (dp->arg_index == ARG_NONE) + /* arg_posn wrapped around. */ + goto error; + } + REGISTER_ARG (dp->arg_index, type); + } + dp->conversion = c; + dp->dir_end = cp; + } + + d->count++; + if (d->count >= d_allocated) + { + size_t memory_size; + DIRECTIVE *memory; + + d_allocated = xtimes (d_allocated, 2); + memory_size = xtimes (d_allocated, sizeof (DIRECTIVE)); + if (size_overflow_p (memory_size)) + /* Overflow, would lead to out of memory. */ + goto error; + memory = realloc (d->dir, memory_size); + if (memory == NULL) + /* Out of memory. */ + goto error; + d->dir = memory; + } + } + } + d->dir[d->count].dir_start = cp; + + d->max_width_length = max_width_length; + d->max_precision_length = max_precision_length; + return 0; + +error: + if (a->arg) + free (a->arg); + if (d->dir) + free (d->dir); + return -1; +} + +#undef DIRECTIVES +#undef DIRECTIVE +#undef CHAR_T +#undef PRINTF_PARSE diff --git a/intl/printf-parse.h b/intl/printf-parse.h new file mode 100644 index 000000000..8aec50e2a --- /dev/null +++ b/intl/printf-parse.h @@ -0,0 +1,75 @@ +/* Parse printf format string. + Copyright (C) 1999, 2002-2003 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + USA. */ + +#ifndef _PRINTF_PARSE_H +#define _PRINTF_PARSE_H + +#include "printf-args.h" + + +/* Flags */ +#define FLAG_GROUP 1 /* ' flag */ +#define FLAG_LEFT 2 /* - flag */ +#define FLAG_SHOWSIGN 4 /* + flag */ +#define FLAG_SPACE 8 /* space flag */ +#define FLAG_ALT 16 /* # flag */ +#define FLAG_ZERO 32 + +/* arg_index value indicating that no argument is consumed. */ +#define ARG_NONE (~(size_t)0) + +/* A parsed directive. */ +typedef struct +{ + const char* dir_start; + const char* dir_end; + int flags; + const char* width_start; + const char* width_end; + size_t width_arg_index; + const char* precision_start; + const char* precision_end; + size_t precision_arg_index; + char conversion; /* d i o u x X f e E g G c s p n U % but not C S */ + size_t arg_index; +} +char_directive; + +/* A parsed format string. */ +typedef struct +{ + size_t count; + char_directive *dir; + size_t max_width_length; + size_t max_precision_length; +} +char_directives; + + +/* Parses the format string. Fills in the number N of directives, and fills + in directives[0], ..., directives[N-1], and sets directives[N].dir_start + to the end of the format string. Also fills in the arg_type fields of the + arguments and the needed count of arguments. */ +#ifdef STATIC +STATIC +#else +extern +#endif +int printf_parse (const char *format, char_directives *d, arguments *a); + +#endif /* _PRINTF_PARSE_H */ diff --git a/intl/printf.c b/intl/printf.c new file mode 100644 index 000000000..878646c2d --- /dev/null +++ b/intl/printf.c @@ -0,0 +1,371 @@ +/* Formatted output to strings, using POSIX/XSI format strings with positions. + Copyright (C) 2003 Free Software Foundation, Inc. + Written by Bruno Haible , 2003. + + 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + USA. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#ifdef __GNUC__ +# define alloca __builtin_alloca +# define HAVE_ALLOCA 1 +#else +# ifdef _MSC_VER +# include +# define alloca _alloca +# else +# if defined HAVE_ALLOCA_H || defined _LIBC +# include +# else +# ifdef _AIX + #pragma alloca +# else +# ifndef alloca +char *alloca (); +# endif +# endif +# endif +# endif +#endif + +#include + +#if !HAVE_POSIX_PRINTF + +#include +#include + +/* When building a DLL, we must export some functions. Note that because + the functions are only defined for binary backward compatibility, we + don't need to use __declspec(dllimport) in any case. */ +#if defined _MSC_VER && BUILDING_DLL +# define DLL_EXPORTED __declspec(dllexport) +#else +# define DLL_EXPORTED +#endif + +#define STATIC static + +/* Define auxiliary functions declared in "printf-args.h". */ +#include "printf-args.c" + +/* Define auxiliary functions declared in "printf-parse.h". */ +#include "printf-parse.c" + +/* Define functions declared in "vasnprintf.h". */ +#define vasnprintf libintl_vasnprintf +#include "vasnprintf.c" +#if 0 /* not needed */ +#define asnprintf libintl_asnprintf +#include "asnprintf.c" +#endif + +DLL_EXPORTED +int +libintl_vfprintf (FILE *stream, const char *format, va_list args) +{ + if (strchr (format, '$') == NULL) + return vfprintf (stream, format, args); + else + { + size_t length; + char *result = libintl_vasnprintf (NULL, &length, format, args); + int retval = -1; + if (result != NULL) + { + if (fwrite (result, 1, length, stream) == length) + retval = length; + free (result); + } + return retval; + } +} + +DLL_EXPORTED +int +libintl_fprintf (FILE *stream, const char *format, ...) +{ + va_list args; + int retval; + + va_start (args, format); + retval = libintl_vfprintf (stream, format, args); + va_end (args); + return retval; +} + +DLL_EXPORTED +int +libintl_vprintf (const char *format, va_list args) +{ + return libintl_vfprintf (stdout, format, args); +} + +DLL_EXPORTED +int +libintl_printf (const char *format, ...) +{ + va_list args; + int retval; + + va_start (args, format); + retval = libintl_vprintf (format, args); + va_end (args); + return retval; +} + +DLL_EXPORTED +int +libintl_vsprintf (char *resultbuf, const char *format, va_list args) +{ + if (strchr (format, '$') == NULL) + return vsprintf (resultbuf, format, args); + else + { + size_t length = (size_t) ~0 / (4 * sizeof (char)); + char *result = libintl_vasnprintf (resultbuf, &length, format, args); + if (result != resultbuf) + { + free (result); + return -1; + } + else + return length; + } +} + +DLL_EXPORTED +int +libintl_sprintf (char *resultbuf, const char *format, ...) +{ + va_list args; + int retval; + + va_start (args, format); + retval = libintl_vsprintf (resultbuf, format, args); + va_end (args); + return retval; +} + +#if HAVE_SNPRINTF + +# if HAVE_DECL__SNPRINTF + /* Windows. */ +# define system_vsnprintf _vsnprintf +# else + /* Unix. */ +# define system_vsnprintf vsnprintf +# endif + +DLL_EXPORTED +int +libintl_vsnprintf (char *resultbuf, size_t length, const char *format, va_list args) +{ + if (strchr (format, '$') == NULL) + return system_vsnprintf (resultbuf, length, format, args); + else + { + size_t maxlength = length; + char *result = libintl_vasnprintf (resultbuf, &length, format, args); + if (result != resultbuf) + { + if (maxlength > 0) + { + if (length < maxlength) + abort (); + memcpy (resultbuf, result, maxlength - 1); + resultbuf[maxlength - 1] = '\0'; + } + free (result); + return -1; + } + else + return length; + } +} + +DLL_EXPORTED +int +libintl_snprintf (char *resultbuf, size_t length, const char *format, ...) +{ + va_list args; + int retval; + + va_start (args, format); + retval = libintl_vsnprintf (resultbuf, length, format, args); + va_end (args); + return retval; +} + +#endif + +#if HAVE_ASPRINTF + +DLL_EXPORTED +int +libintl_vasprintf (char **resultp, const char *format, va_list args) +{ + size_t length; + char *result = libintl_vasnprintf (NULL, &length, format, args); + if (result == NULL) + return -1; + *resultp = result; + return length; +} + +DLL_EXPORTED +int +libintl_asprintf (char **resultp, const char *format, ...) +{ + va_list args; + int retval; + + va_start (args, format); + retval = libintl_vasprintf (resultp, format, args); + va_end (args); + return retval; +} + +#endif + +#if HAVE_FWPRINTF + +#include + +#define WIDE_CHAR_VERSION 1 + +/* Define auxiliary functions declared in "wprintf-parse.h". */ +#include "printf-parse.c" + +/* Define functions declared in "vasnprintf.h". */ +#define vasnwprintf libintl_vasnwprintf +#include "vasnprintf.c" +#if 0 /* not needed */ +#define asnwprintf libintl_asnwprintf +#include "asnprintf.c" +#endif + +# if HAVE_DECL__SNWPRINTF + /* Windows. */ +# define system_vswprintf _vsnwprintf +# else + /* Unix. */ +# define system_vswprintf vswprintf +# endif + +DLL_EXPORTED +int +libintl_vfwprintf (FILE *stream, const wchar_t *format, va_list args) +{ + if (wcschr (format, '$') == NULL) + return vfwprintf (stream, format, args); + else + { + size_t length; + wchar_t *result = libintl_vasnwprintf (NULL, &length, format, args); + int retval = -1; + if (result != NULL) + { + size_t i; + for (i = 0; i < length; i++) + if (fputwc (result[i], stream) == WEOF) + break; + if (i == length) + retval = length; + free (result); + } + return retval; + } +} + +DLL_EXPORTED +int +libintl_fwprintf (FILE *stream, const wchar_t *format, ...) +{ + va_list args; + int retval; + + va_start (args, format); + retval = libintl_vfwprintf (stream, format, args); + va_end (args); + return retval; +} + +DLL_EXPORTED +int +libintl_vwprintf (const wchar_t *format, va_list args) +{ + return libintl_vfwprintf (stdout, format, args); +} + +DLL_EXPORTED +int +libintl_wprintf (const wchar_t *format, ...) +{ + va_list args; + int retval; + + va_start (args, format); + retval = libintl_vwprintf (format, args); + va_end (args); + return retval; +} + +DLL_EXPORTED +int +libintl_vswprintf (wchar_t *resultbuf, size_t length, const wchar_t *format, va_list args) +{ + if (wcschr (format, '$') == NULL) + return system_vswprintf (resultbuf, length, format, args); + else + { + size_t maxlength = length; + wchar_t *result = libintl_vasnwprintf (resultbuf, &length, format, args); + if (result != resultbuf) + { + if (maxlength > 0) + { + if (length < maxlength) + abort (); + memcpy (resultbuf, result, (maxlength - 1) * sizeof (wchar_t)); + resultbuf[maxlength - 1] = 0; + } + free (result); + return -1; + } + else + return length; + } +} + +DLL_EXPORTED +int +libintl_swprintf (wchar_t *resultbuf, size_t length, const wchar_t *format, ...) +{ + va_list args; + int retval; + + va_start (args, format); + retval = libintl_vswprintf (resultbuf, length, format, args); + va_end (args); + return retval; +} + +#endif + +#endif diff --git a/intl/relocatable.c b/intl/relocatable.c index 16f79a528..bf7c70854 100644 --- a/intl/relocatable.c +++ b/intl/relocatable.c @@ -42,7 +42,12 @@ #ifdef NO_XMALLOC # define xmalloc malloc #else -# include "xmalloc.h" +# include "xalloc.h" +#endif + +#if defined _WIN32 || defined __WIN32__ +# define WIN32_LEAN_AND_MEAN +# include #endif #if DEPENDS_ON_LIBCHARSET @@ -152,6 +157,8 @@ set_relocation_prefix (const char *orig_prefix_arg, const char *curr_prefix_arg) #endif } +#if !defined IN_LIBRARY || (defined PIC && defined INSTALLDIR) + /* Convenience function: Computes the current installation prefix, based on the original installation prefix, the original installation directory of a particular @@ -266,6 +273,8 @@ compute_curr_prefix (const char *orig_installprefix, } } +#endif /* !IN_LIBRARY || PIC */ + #if defined PIC && defined INSTALLDIR /* Full pathname of shared library, or NULL. */ @@ -304,7 +313,8 @@ DllMain (HINSTANCE module_handle, DWORD event, LPVOID reserved) static void find_shared_library_fullname () { -#ifdef __linux__ +#if defined __linux__ && __GLIBC__ >= 2 + /* Linux has /proc/self/maps. glibc 2 has the getline() function. */ FILE *fp; /* Open the current process' maps file. It describes one VMA per line. */ diff --git a/intl/relocatable.h b/intl/relocatable.h index d141200a6..48c5b71e2 100644 --- a/intl/relocatable.h +++ b/intl/relocatable.h @@ -20,6 +20,11 @@ #ifndef _RELOCATABLE_H #define _RELOCATABLE_H +#ifdef __cplusplus +extern "C" { +#endif + + /* This can be enabled through the configure --enable-relocatable option. */ #if ENABLE_RELOCATABLE @@ -64,4 +69,9 @@ extern const char * compute_curr_prefix (const char *orig_installprefix, #endif + +#ifdef __cplusplus +} +#endif + #endif /* _RELOCATABLE_H */ diff --git a/intl/textdomain.c b/intl/textdomain.c index f259c696d..8745a8435 100644 --- a/intl/textdomain.c +++ b/intl/textdomain.c @@ -1,5 +1,5 @@ /* Implementation of the textdomain(3) function. - Copyright (C) 1995-1998, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 1995-1998, 2000-2003 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 @@ -77,8 +77,7 @@ __libc_rwlock_define (extern, _nl_state_lock attribute_hidden) If DOMAINNAME is null, return the current default. If DOMAINNAME is "", reset to the default of "messages". */ char * -TEXTDOMAIN (domainname) - const char *domainname; +TEXTDOMAIN (const char *domainname) { char *new_domain; char *old_domain; diff --git a/intl/vasnprintf.c b/intl/vasnprintf.c new file mode 100644 index 000000000..8a62282d7 --- /dev/null +++ b/intl/vasnprintf.c @@ -0,0 +1,887 @@ +/* vsprintf with automatic memory allocation. + Copyright (C) 1999, 2002-2003 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + USA. */ + +/* Tell glibc's to provide a prototype for snprintf(). + 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 +#ifndef IN_LIBINTL +# include +#endif + +/* Specification. */ +#if WIDE_CHAR_VERSION +# include "vasnwprintf.h" +#else +# include "vasnprintf.h" +#endif + +#include /* snprintf(), sprintf() */ +#include /* abort(), malloc(), realloc(), free() */ +#include /* memcpy(), strlen() */ +#include /* errno */ +#include /* CHAR_BIT */ +#include /* DBL_MAX_EXP, LDBL_MAX_EXP */ +#if WIDE_CHAR_VERSION +# include "wprintf-parse.h" +#else +# include "printf-parse.h" +#endif + +/* Checked size_t computations. */ +#include "xsize.h" + +#ifdef HAVE_WCHAR_T +# ifdef HAVE_WCSLEN +# define local_wcslen wcslen +# else + /* Solaris 2.5.1 has wcslen() in a separate library libw.so. To avoid + a dependency towards this library, here is a local substitute. + Define this substitute only once, even if this file is included + twice in the same compilation unit. */ +# ifndef local_wcslen_defined +# define local_wcslen_defined 1 +static size_t +local_wcslen (const wchar_t *s) +{ + const wchar_t *ptr; + + for (ptr = s; *ptr != (wchar_t) 0; ptr++) + ; + return ptr - s; +} +# endif +# endif +#endif + +#if WIDE_CHAR_VERSION +# define VASNPRINTF vasnwprintf +# define CHAR_T wchar_t +# define DIRECTIVE wchar_t_directive +# define DIRECTIVES wchar_t_directives +# define PRINTF_PARSE wprintf_parse +# define USE_SNPRINTF 1 +# if HAVE_DECL__SNWPRINTF + /* On Windows, the function swprintf() has a different signature than + on Unix; we use the _snwprintf() function instead. */ +# define SNPRINTF _snwprintf +# else + /* Unix. */ +# define SNPRINTF swprintf +# endif +#else +# define VASNPRINTF vasnprintf +# define CHAR_T char +# define DIRECTIVE char_directive +# define DIRECTIVES char_directives +# define PRINTF_PARSE printf_parse +# define USE_SNPRINTF (HAVE_DECL__SNPRINTF || HAVE_SNPRINTF) +# if HAVE_DECL__SNPRINTF + /* Windows. */ +# define SNPRINTF _snprintf +# else + /* Unix. */ +# define SNPRINTF snprintf +# endif +#endif + +CHAR_T * +VASNPRINTF (CHAR_T *resultbuf, size_t *lengthp, const CHAR_T *format, va_list args) +{ + DIRECTIVES d; + arguments a; + + if (PRINTF_PARSE (format, &d, &a) < 0) + { + errno = EINVAL; + return NULL; + } + +#define CLEANUP() \ + free (d.dir); \ + if (a.arg) \ + free (a.arg); + + if (printf_fetchargs (args, &a) < 0) + { + CLEANUP (); + errno = EINVAL; + return NULL; + } + + { + size_t buf_neededlength; + CHAR_T *buf; + CHAR_T *buf_malloced; + const CHAR_T *cp; + size_t i; + DIRECTIVE *dp; + /* Output string accumulator. */ + CHAR_T *result; + size_t allocated; + size_t length; + + /* Allocate a small buffer that will hold a directive passed to + sprintf or snprintf. */ + buf_neededlength = + xsum4 (7, d.max_width_length, d.max_precision_length, 6); +#if HAVE_ALLOCA + if (buf_neededlength < 4000 / sizeof (CHAR_T)) + { + buf = (CHAR_T *) alloca (buf_neededlength * sizeof (CHAR_T)); + buf_malloced = NULL; + } + else +#endif + { + size_t buf_memsize = xtimes (buf_neededlength, sizeof (CHAR_T)); + if (size_overflow_p (buf_memsize)) + goto out_of_memory_1; + buf = (CHAR_T *) malloc (buf_memsize); + if (buf == NULL) + goto out_of_memory_1; + buf_malloced = buf; + } + + if (resultbuf != NULL) + { + result = resultbuf; + allocated = *lengthp; + } + else + { + result = NULL; + allocated = 0; + } + length = 0; + /* Invariants: + result is either == resultbuf or == NULL or malloc-allocated. + If length > 0, then result != NULL. */ + + /* Ensures that allocated >= needed. Aborts through a jump to + out_of_memory if needed is SIZE_MAX or otherwise too big. */ +#define ENSURE_ALLOCATION(needed) \ + if ((needed) > allocated) \ + { \ + size_t memory_size; \ + CHAR_T *memory; \ + \ + allocated = (allocated > 0 ? xtimes (allocated, 2) : 12); \ + if ((needed) > allocated) \ + allocated = (needed); \ + memory_size = xtimes (allocated, sizeof (CHAR_T)); \ + if (size_overflow_p (memory_size)) \ + goto out_of_memory; \ + if (result == resultbuf || result == NULL) \ + memory = (CHAR_T *) malloc (memory_size); \ + else \ + memory = (CHAR_T *) realloc (result, memory_size); \ + if (memory == NULL) \ + goto out_of_memory; \ + if (result == resultbuf && length > 0) \ + memcpy (memory, result, length * sizeof (CHAR_T)); \ + result = memory; \ + } + + for (cp = format, i = 0, dp = &d.dir[0]; ; cp = dp->dir_end, i++, dp++) + { + if (cp != dp->dir_start) + { + size_t n = dp->dir_start - cp; + size_t augmented_length = xsum (length, n); + + ENSURE_ALLOCATION (augmented_length); + memcpy (result + length, cp, n * sizeof (CHAR_T)); + length = augmented_length; + } + if (i == d.count) + break; + + /* Execute a single directive. */ + if (dp->conversion == '%') + { + size_t augmented_length; + + if (!(dp->arg_index == ARG_NONE)) + abort (); + augmented_length = xsum (length, 1); + ENSURE_ALLOCATION (augmented_length); + result[length] = '%'; + length = augmented_length; + } + else + { + if (!(dp->arg_index != ARG_NONE)) + abort (); + + if (dp->conversion == 'n') + { + switch (a.arg[dp->arg_index].type) + { + case TYPE_COUNT_SCHAR_POINTER: + *a.arg[dp->arg_index].a.a_count_schar_pointer = length; + break; + case TYPE_COUNT_SHORT_POINTER: + *a.arg[dp->arg_index].a.a_count_short_pointer = length; + break; + case TYPE_COUNT_INT_POINTER: + *a.arg[dp->arg_index].a.a_count_int_pointer = length; + break; + case TYPE_COUNT_LONGINT_POINTER: + *a.arg[dp->arg_index].a.a_count_longint_pointer = length; + break; +#ifdef HAVE_LONG_LONG + case TYPE_COUNT_LONGLONGINT_POINTER: + *a.arg[dp->arg_index].a.a_count_longlongint_pointer = length; + break; +#endif + default: + abort (); + } + } + else + { + arg_type type = a.arg[dp->arg_index].type; + CHAR_T *p; + unsigned int prefix_count; + int prefixes[2]; +#if !USE_SNPRINTF + size_t tmp_length; + CHAR_T tmpbuf[700]; + CHAR_T *tmp; + + /* Allocate a temporary buffer of sufficient size for calling + sprintf. */ + { + size_t width; + size_t precision; + + width = 0; + if (dp->width_start != dp->width_end) + { + if (dp->width_arg_index != ARG_NONE) + { + int arg; + + if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) + abort (); + arg = a.arg[dp->width_arg_index].a.a_int; + width = (arg < 0 ? (unsigned int) (-arg) : arg); + } + else + { + const CHAR_T *digitp = dp->width_start; + + do + width = xsum (xtimes (width, 10), *digitp++ - '0'); + while (digitp != dp->width_end); + } + } + + precision = 6; + if (dp->precision_start != dp->precision_end) + { + if (dp->precision_arg_index != ARG_NONE) + { + int arg; + + if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) + abort (); + arg = a.arg[dp->precision_arg_index].a.a_int; + precision = (arg < 0 ? 0 : arg); + } + else + { + const CHAR_T *digitp = dp->precision_start + 1; + + precision = 0; + do + precision = xsum (xtimes (precision, 10), *digitp++ - '0'); + while (digitp != dp->precision_end); + } + } + + switch (dp->conversion) + { + + case 'd': case 'i': case 'u': +# ifdef HAVE_LONG_LONG + if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT) + tmp_length = + (unsigned int) (sizeof (unsigned long long) * CHAR_BIT + * 0.30103 /* binary -> decimal */ + * 2 /* estimate for FLAG_GROUP */ + ) + + 1 /* turn floor into ceil */ + + 1; /* account for leading sign */ + else +# endif + if (type == TYPE_LONGINT || type == TYPE_ULONGINT) + tmp_length = + (unsigned int) (sizeof (unsigned long) * CHAR_BIT + * 0.30103 /* binary -> decimal */ + * 2 /* estimate for FLAG_GROUP */ + ) + + 1 /* turn floor into ceil */ + + 1; /* account for leading sign */ + else + tmp_length = + (unsigned int) (sizeof (unsigned int) * CHAR_BIT + * 0.30103 /* binary -> decimal */ + * 2 /* estimate for FLAG_GROUP */ + ) + + 1 /* turn floor into ceil */ + + 1; /* account for leading sign */ + break; + + case 'o': +# ifdef HAVE_LONG_LONG + if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT) + tmp_length = + (unsigned int) (sizeof (unsigned long long) * CHAR_BIT + * 0.333334 /* binary -> octal */ + ) + + 1 /* turn floor into ceil */ + + 1; /* account for leading sign */ + else +# endif + if (type == TYPE_LONGINT || type == TYPE_ULONGINT) + tmp_length = + (unsigned int) (sizeof (unsigned long) * CHAR_BIT + * 0.333334 /* binary -> octal */ + ) + + 1 /* turn floor into ceil */ + + 1; /* account for leading sign */ + else + tmp_length = + (unsigned int) (sizeof (unsigned int) * CHAR_BIT + * 0.333334 /* binary -> octal */ + ) + + 1 /* turn floor into ceil */ + + 1; /* account for leading sign */ + break; + + case 'x': case 'X': +# ifdef HAVE_LONG_LONG + if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT) + tmp_length = + (unsigned int) (sizeof (unsigned long long) * CHAR_BIT + * 0.25 /* binary -> hexadecimal */ + ) + + 1 /* turn floor into ceil */ + + 2; /* account for leading sign or alternate form */ + else +# endif + if (type == TYPE_LONGINT || type == TYPE_ULONGINT) + tmp_length = + (unsigned int) (sizeof (unsigned long) * CHAR_BIT + * 0.25 /* binary -> hexadecimal */ + ) + + 1 /* turn floor into ceil */ + + 2; /* account for leading sign or alternate form */ + else + tmp_length = + (unsigned int) (sizeof (unsigned int) * CHAR_BIT + * 0.25 /* binary -> hexadecimal */ + ) + + 1 /* turn floor into ceil */ + + 2; /* account for leading sign or alternate form */ + break; + + case 'f': case 'F': +# ifdef HAVE_LONG_DOUBLE + if (type == TYPE_LONGDOUBLE) + tmp_length = + (unsigned int) (LDBL_MAX_EXP + * 0.30103 /* binary -> decimal */ + * 2 /* estimate for FLAG_GROUP */ + ) + + 1 /* turn floor into ceil */ + + 10; /* sign, decimal point etc. */ + else +# endif + tmp_length = + (unsigned int) (DBL_MAX_EXP + * 0.30103 /* binary -> decimal */ + * 2 /* estimate for FLAG_GROUP */ + ) + + 1 /* turn floor into ceil */ + + 10; /* sign, decimal point etc. */ + tmp_length = xsum (tmp_length, precision); + break; + + case 'e': case 'E': case 'g': case 'G': + case 'a': case 'A': + tmp_length = + 12; /* sign, decimal point, exponent etc. */ + tmp_length = xsum (tmp_length, precision); + break; + + case 'c': +# if defined HAVE_WINT_T && !WIDE_CHAR_VERSION + if (type == TYPE_WIDE_CHAR) + tmp_length = MB_CUR_MAX; + else +# endif + tmp_length = 1; + break; + + case 's': +# ifdef HAVE_WCHAR_T + if (type == TYPE_WIDE_STRING) + { + tmp_length = + local_wcslen (a.arg[dp->arg_index].a.a_wide_string); + +# if !WIDE_CHAR_VERSION + tmp_length = xtimes (tmp_length, MB_CUR_MAX); +# endif + } + else +# endif + tmp_length = strlen (a.arg[dp->arg_index].a.a_string); + break; + + case 'p': + tmp_length = + (unsigned int) (sizeof (void *) * CHAR_BIT + * 0.25 /* binary -> hexadecimal */ + ) + + 1 /* turn floor into ceil */ + + 2; /* account for leading 0x */ + break; + + default: + abort (); + } + + if (tmp_length < width) + tmp_length = width; + + tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */ + } + + if (tmp_length <= sizeof (tmpbuf) / sizeof (CHAR_T)) + tmp = tmpbuf; + else + { + size_t tmp_memsize = xtimes (tmp_length, sizeof (CHAR_T)); + + if (size_overflow_p (tmp_memsize)) + /* Overflow, would lead to out of memory. */ + goto out_of_memory; + tmp = (CHAR_T *) malloc (tmp_memsize); + if (tmp == NULL) + /* Out of memory. */ + goto out_of_memory; + } +#endif + + /* Construct the format string for calling snprintf or + sprintf. */ + p = buf; + *p++ = '%'; + if (dp->flags & FLAG_GROUP) + *p++ = '\''; + if (dp->flags & FLAG_LEFT) + *p++ = '-'; + if (dp->flags & FLAG_SHOWSIGN) + *p++ = '+'; + if (dp->flags & FLAG_SPACE) + *p++ = ' '; + if (dp->flags & FLAG_ALT) + *p++ = '#'; + if (dp->flags & FLAG_ZERO) + *p++ = '0'; + if (dp->width_start != dp->width_end) + { + size_t n = dp->width_end - dp->width_start; + memcpy (p, dp->width_start, n * sizeof (CHAR_T)); + p += n; + } + if (dp->precision_start != dp->precision_end) + { + size_t n = dp->precision_end - dp->precision_start; + memcpy (p, dp->precision_start, n * sizeof (CHAR_T)); + p += n; + } + + switch (type) + { +#ifdef HAVE_LONG_LONG + case TYPE_LONGLONGINT: + case TYPE_ULONGLONGINT: + *p++ = 'l'; + /*FALLTHROUGH*/ +#endif + case TYPE_LONGINT: + case TYPE_ULONGINT: +#ifdef HAVE_WINT_T + case TYPE_WIDE_CHAR: +#endif +#ifdef HAVE_WCHAR_T + case TYPE_WIDE_STRING: +#endif + *p++ = 'l'; + break; +#ifdef HAVE_LONG_DOUBLE + case TYPE_LONGDOUBLE: + *p++ = 'L'; + break; +#endif + default: + break; + } + *p = dp->conversion; +#if USE_SNPRINTF + p[1] = '%'; + p[2] = 'n'; + p[3] = '\0'; +#else + p[1] = '\0'; +#endif + + /* Construct the arguments for calling snprintf or sprintf. */ + prefix_count = 0; + if (dp->width_arg_index != ARG_NONE) + { + if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) + abort (); + prefixes[prefix_count++] = a.arg[dp->width_arg_index].a.a_int; + } + if (dp->precision_arg_index != ARG_NONE) + { + if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) + abort (); + prefixes[prefix_count++] = a.arg[dp->precision_arg_index].a.a_int; + } + +#if USE_SNPRINTF + /* Prepare checking whether snprintf returns the count + via %n. */ + ENSURE_ALLOCATION (xsum (length, 1)); + result[length] = '\0'; +#endif + + for (;;) + { + size_t maxlen; + int count; + int retcount; + + maxlen = allocated - length; + count = -1; + retcount = 0; + +#if USE_SNPRINTF +# define SNPRINTF_BUF(arg) \ + switch (prefix_count) \ + { \ + case 0: \ + retcount = SNPRINTF (result + length, maxlen, buf, \ + arg, &count); \ + break; \ + case 1: \ + retcount = SNPRINTF (result + length, maxlen, buf, \ + prefixes[0], arg, &count); \ + break; \ + case 2: \ + retcount = SNPRINTF (result + length, maxlen, buf, \ + prefixes[0], prefixes[1], arg, \ + &count); \ + break; \ + default: \ + abort (); \ + } +#else +# define SNPRINTF_BUF(arg) \ + switch (prefix_count) \ + { \ + case 0: \ + count = sprintf (tmp, buf, arg); \ + break; \ + case 1: \ + count = sprintf (tmp, buf, prefixes[0], arg); \ + break; \ + case 2: \ + count = sprintf (tmp, buf, prefixes[0], prefixes[1],\ + arg); \ + break; \ + default: \ + abort (); \ + } +#endif + + switch (type) + { + case TYPE_SCHAR: + { + int arg = a.arg[dp->arg_index].a.a_schar; + SNPRINTF_BUF (arg); + } + break; + case TYPE_UCHAR: + { + unsigned int arg = a.arg[dp->arg_index].a.a_uchar; + SNPRINTF_BUF (arg); + } + break; + case TYPE_SHORT: + { + int arg = a.arg[dp->arg_index].a.a_short; + SNPRINTF_BUF (arg); + } + break; + case TYPE_USHORT: + { + unsigned int arg = a.arg[dp->arg_index].a.a_ushort; + SNPRINTF_BUF (arg); + } + break; + case TYPE_INT: + { + int arg = a.arg[dp->arg_index].a.a_int; + SNPRINTF_BUF (arg); + } + break; + case TYPE_UINT: + { + unsigned int arg = a.arg[dp->arg_index].a.a_uint; + SNPRINTF_BUF (arg); + } + break; + case TYPE_LONGINT: + { + long int arg = a.arg[dp->arg_index].a.a_longint; + SNPRINTF_BUF (arg); + } + break; + case TYPE_ULONGINT: + { + unsigned long int arg = a.arg[dp->arg_index].a.a_ulongint; + SNPRINTF_BUF (arg); + } + break; +#ifdef HAVE_LONG_LONG + case TYPE_LONGLONGINT: + { + long long int arg = a.arg[dp->arg_index].a.a_longlongint; + SNPRINTF_BUF (arg); + } + break; + case TYPE_ULONGLONGINT: + { + unsigned long long int arg = a.arg[dp->arg_index].a.a_ulonglongint; + SNPRINTF_BUF (arg); + } + break; +#endif + case TYPE_DOUBLE: + { + double arg = a.arg[dp->arg_index].a.a_double; + SNPRINTF_BUF (arg); + } + break; +#ifdef HAVE_LONG_DOUBLE + case TYPE_LONGDOUBLE: + { + long double arg = a.arg[dp->arg_index].a.a_longdouble; + SNPRINTF_BUF (arg); + } + break; +#endif + case TYPE_CHAR: + { + int arg = a.arg[dp->arg_index].a.a_char; + SNPRINTF_BUF (arg); + } + break; +#ifdef HAVE_WINT_T + case TYPE_WIDE_CHAR: + { + wint_t arg = a.arg[dp->arg_index].a.a_wide_char; + SNPRINTF_BUF (arg); + } + break; +#endif + case TYPE_STRING: + { + const char *arg = a.arg[dp->arg_index].a.a_string; + SNPRINTF_BUF (arg); + } + break; +#ifdef HAVE_WCHAR_T + case TYPE_WIDE_STRING: + { + const wchar_t *arg = a.arg[dp->arg_index].a.a_wide_string; + SNPRINTF_BUF (arg); + } + break; +#endif + case TYPE_POINTER: + { + void *arg = a.arg[dp->arg_index].a.a_pointer; + SNPRINTF_BUF (arg); + } + break; + default: + abort (); + } + +#if USE_SNPRINTF + /* Portability: Not all implementations of snprintf() + are ISO C 99 compliant. Determine the number of + bytes that snprintf() has produced or would have + produced. */ + if (count >= 0) + { + /* Verify that snprintf() has NUL-terminated its + result. */ + if (count < maxlen && result[length + count] != '\0') + abort (); + /* Portability hack. */ + if (retcount > count) + count = retcount; + } + else + { + /* snprintf() doesn't understand the '%n' + directive. */ + if (p[1] != '\0') + { + /* Don't use the '%n' directive; instead, look + at the snprintf() return value. */ + p[1] = '\0'; + continue; + } + else + { + /* Look at the snprintf() return value. */ + if (retcount < 0) + { + /* HP-UX 10.20 snprintf() is doubly deficient: + It doesn't understand the '%n' directive, + *and* it returns -1 (rather than the length + that would have been required) when the + buffer is too small. */ + size_t bigger_need = + xsum (xtimes (allocated, 2), 12); + ENSURE_ALLOCATION (bigger_need); + continue; + } + else + count = retcount; + } + } +#endif + + /* Attempt to handle failure. */ + if (count < 0) + { + if (!(result == resultbuf || result == NULL)) + free (result); + if (buf_malloced != NULL) + free (buf_malloced); + CLEANUP (); + errno = EINVAL; + return NULL; + } + +#if !USE_SNPRINTF + if (count >= tmp_length) + /* tmp_length was incorrectly calculated - fix the + code above! */ + abort (); +#endif + + /* Make room for the result. */ + if (count >= maxlen) + { + /* Need at least count bytes. But allocate + proportionally, to avoid looping eternally if + snprintf() reports a too small count. */ + size_t n = + xmax (xsum (length, count), xtimes (allocated, 2)); + + ENSURE_ALLOCATION (n); +#if USE_SNPRINTF + continue; +#endif + } + +#if USE_SNPRINTF + /* The snprintf() result did fit. */ +#else + /* Append the sprintf() result. */ + memcpy (result + length, tmp, count * sizeof (CHAR_T)); + if (tmp != tmpbuf) + free (tmp); +#endif + + length += count; + break; + } + } + } + } + + /* Add the final NUL. */ + ENSURE_ALLOCATION (xsum (length, 1)); + result[length] = '\0'; + + if (result != resultbuf && length + 1 < allocated) + { + /* Shrink the allocated memory if possible. */ + CHAR_T *memory; + + memory = (CHAR_T *) realloc (result, (length + 1) * sizeof (CHAR_T)); + if (memory != NULL) + result = memory; + } + + if (buf_malloced != NULL) + free (buf_malloced); + CLEANUP (); + *lengthp = length; + return result; + + out_of_memory: + if (!(result == resultbuf || result == NULL)) + free (result); + if (buf_malloced != NULL) + free (buf_malloced); + out_of_memory_1: + CLEANUP (); + errno = ENOMEM; + return NULL; + } +} + +#undef SNPRINTF +#undef USE_SNPRINTF +#undef PRINTF_PARSE +#undef DIRECTIVES +#undef DIRECTIVE +#undef CHAR_T +#undef VASNPRINTF diff --git a/intl/vasnprintf.h b/intl/vasnprintf.h new file mode 100644 index 000000000..65f1bc13d --- /dev/null +++ b/intl/vasnprintf.h @@ -0,0 +1,61 @@ +/* vsprintf with automatic memory allocation. + Copyright (C) 2002-2003 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + USA. */ + +#ifndef _VASNPRINTF_H +#define _VASNPRINTF_H + +/* Get va_list. */ +#include + +/* Get size_t. */ +#include + +#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 + +/* Write formatted output to a string dynamically allocated with malloc(). + You can pass a preallocated buffer for the result in RESULTBUF and its + size in *LENGTHP; otherwise you pass RESULTBUF = NULL. + If successful, return the address of the string (this may be = RESULTBUF + if no dynamic memory allocation was necessary) and set *LENGTHP to the + number of resulting bytes, excluding the trailing NUL. Upon error, set + errno and return NULL. */ +extern char * asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...) + __attribute__ ((__format__ (__printf__, 3, 4))); +extern char * vasnprintf (char *resultbuf, size_t *lengthp, const char *format, va_list args) + __attribute__ ((__format__ (__printf__, 3, 0))); + +#ifdef __cplusplus +} +#endif + +#endif /* _VASNPRINTF_H */ diff --git a/intl/vasnwprintf.h b/intl/vasnwprintf.h new file mode 100644 index 000000000..d3cef4cbc --- /dev/null +++ b/intl/vasnwprintf.h @@ -0,0 +1,46 @@ +/* vswprintf with automatic memory allocation. + Copyright (C) 2002-2003 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + USA. */ + +#ifndef _VASNWPRINTF_H +#define _VASNWPRINTF_H + +/* Get va_list. */ +#include + +/* Get wchar_t, size_t. */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Write formatted output to a string dynamically allocated with malloc(). + You can pass a preallocated buffer for the result in RESULTBUF and its + size in *LENGTHP; otherwise you pass RESULTBUF = NULL. + If successful, return the address of the string (this may be = RESULTBUF + if no dynamic memory allocation was necessary) and set *LENGTHP to the + number of resulting bytes, excluding the trailing NUL. Upon error, set + errno and return NULL. */ +extern wchar_t * asnwprintf (wchar_t *resultbuf, size_t *lengthp, const wchar_t *format, ...); +extern wchar_t * vasnwprintf (wchar_t *resultbuf, size_t *lengthp, const wchar_t *format, va_list args); + +#ifdef __cplusplus +} +#endif + +#endif /* _VASNWPRINTF_H */ diff --git a/intl/wprintf-parse.h b/intl/wprintf-parse.h new file mode 100644 index 000000000..24a2cfc28 --- /dev/null +++ b/intl/wprintf-parse.h @@ -0,0 +1,75 @@ +/* Parse printf format string. + Copyright (C) 1999, 2002-2003 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + USA. */ + +#ifndef _WPRINTF_PARSE_H +#define _WPRINTF_PARSE_H + +#include "printf-args.h" + + +/* Flags */ +#define FLAG_GROUP 1 /* ' flag */ +#define FLAG_LEFT 2 /* - flag */ +#define FLAG_SHOWSIGN 4 /* + flag */ +#define FLAG_SPACE 8 /* space flag */ +#define FLAG_ALT 16 /* # flag */ +#define FLAG_ZERO 32 + +/* arg_index value indicating that no argument is consumed. */ +#define ARG_NONE (~(size_t)0) + +/* A parsed directive. */ +typedef struct +{ + const wchar_t* dir_start; + const wchar_t* dir_end; + int flags; + const wchar_t* width_start; + const wchar_t* width_end; + size_t width_arg_index; + const wchar_t* precision_start; + const wchar_t* precision_end; + size_t precision_arg_index; + wchar_t conversion; /* d i o u x X f e E g G c s p n U % but not C S */ + size_t arg_index; +} +wchar_t_directive; + +/* A parsed format string. */ +typedef struct +{ + size_t count; + wchar_t_directive *dir; + size_t max_width_length; + size_t max_precision_length; +} +wchar_t_directives; + + +/* Parses the format string. Fills in the number N of directives, and fills + in directives[0], ..., directives[N-1], and sets directives[N].dir_start + to the end of the format string. Also fills in the arg_type fields of the + arguments and the needed count of arguments. */ +#ifdef STATIC +STATIC +#else +extern +#endif +int wprintf_parse (const wchar_t *format, wchar_t_directives *d, arguments *a); + +#endif /* _WPRINTF_PARSE_H */ diff --git a/intl/xsize.h b/intl/xsize.h new file mode 100644 index 000000000..362e24b72 --- /dev/null +++ b/intl/xsize.h @@ -0,0 +1,109 @@ +/* xsize.h -- Checked size_t computations. + + Copyright (C) 2003 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + USA. */ + +#ifndef _XSIZE_H +#define _XSIZE_H + +/* Get size_t. */ +#include + +/* Get SIZE_MAX. */ +#include +#if HAVE_STDINT_H +# include +#endif + +/* The size of memory objects is often computed through expressions of + type size_t. Example: + void* p = malloc (header_size + n * element_size). + These computations can lead to overflow. When this happens, malloc() + returns a piece of memory that is way too small, and the program then + crashes while attempting to fill the memory. + To avoid this, the functions and macros in this file check for overflow. + The convention is that SIZE_MAX represents overflow. + malloc (SIZE_MAX) is not guaranteed to fail -- think of a malloc + implementation that uses mmap --, it's recommended to use size_overflow_p() + or size_in_bounds_p() before invoking malloc(). + The example thus becomes: + size_t size = xsum (header_size, xtimes (n, element_size)); + void *p = (size_in_bounds_p (size) ? malloc (size) : NULL); +*/ + +/* Convert an arbitrary value >= 0 to type size_t. */ +#define xcast_size_t(N) \ + ((N) <= SIZE_MAX ? (size_t) (N) : SIZE_MAX) + +/* Sum of two sizes, with overflow check. */ +static inline size_t +#if __GNUC__ >= 3 +__attribute__ ((__pure__)) +#endif +xsum (size_t size1, size_t size2) +{ + size_t sum = size1 + size2; + return (sum >= size1 ? sum : SIZE_MAX); +} + +/* Sum of three sizes, with overflow check. */ +static inline size_t +#if __GNUC__ >= 3 +__attribute__ ((__pure__)) +#endif +xsum3 (size_t size1, size_t size2, size_t size3) +{ + return xsum (xsum (size1, size2), size3); +} + +/* Sum of four sizes, with overflow check. */ +static inline size_t +#if __GNUC__ >= 3 +__attribute__ ((__pure__)) +#endif +xsum4 (size_t size1, size_t size2, size_t size3, size_t size4) +{ + return xsum (xsum (xsum (size1, size2), size3), size4); +} + +/* Maximum of two sizes, with overflow check. */ +static inline size_t +#if __GNUC__ >= 3 +__attribute__ ((__pure__)) +#endif +xmax (size_t size1, size_t size2) +{ + /* No explicit check is needed here, because for any n: + max (SIZE_MAX, n) == SIZE_MAX and max (n, SIZE_MAX) == SIZE_MAX. */ + return (size1 >= size2 ? size1 : size2); +} + +/* Multiplication of a count with an element size, with overflow check. + The count must be >= 0 and the element size must be > 0. + This is a macro, not an inline function, so that it works correctly even + when N is of a wider tupe and N > SIZE_MAX. */ +#define xtimes(N, ELSIZE) \ + ((N) <= SIZE_MAX / (ELSIZE) ? (size_t) (N) * (ELSIZE) : SIZE_MAX) + +/* Check for overflow. */ +#define size_overflow_p(SIZE) \ + ((SIZE) == SIZE_MAX) +/* Check against overflow. */ +#define size_in_bounds_p(SIZE) \ + ((SIZE) != SIZE_MAX) + +#endif /* _XSIZE_H */ diff --git a/io.c b/io.c index fff138832..b8bab6d58 100644 --- a/io.c +++ b/io.c @@ -3,7 +3,7 @@ */ /* - * Copyright (C) 1986, 1988, 1989, 1991-2003 the Free Software Foundation, Inc. + * Copyright (C) 1986, 1988, 1989, 1991-2004 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. @@ -122,7 +122,7 @@ typedef enum recvalues { REC_OK, /* record and terminator found, recmatch struct filled in */ NOTERM, /* no terminator found, give me more input data */ TERMATEND, /* found terminator at end of buffer */ - TERMNEAREND, /* found terminator close to end of buffer, for RE might be bigger */ + TERMNEAREND /* found terminator close to end of buffer, for RE might be bigger */ } RECVALUE; /* Between calls to a scanning routine, the state is stored in */ /* an [[enum scanstate]] variable. Not all states apply to all */ @@ -134,7 +134,7 @@ typedef enum scanstate { NOSTATE, /* scanning not started yet (all) */ INLEADER, /* skipping leading data (RS = "") */ INDATA, /* in body of record (all) */ - INTERM, /* scanning terminator (RS = "", RS = regexp) */ + INTERM /* scanning terminator (RS = "", RS = regexp) */ } SCANSTATE; /* When a record is seen ([[REC_OK]] or [[TERMATEND]]), the following */ /* structure is filled in. */ @@ -201,6 +201,8 @@ static jmp_buf filebuf; /* for do_nextfile() */ #if defined(MSDOS) || defined(OS2) || defined(WIN32) \ || defined(__EMX__) || defined(__CYGWIN__) +/* binmode --- convert BINMODE to string for fopen */ + static const char * binmode(const char *mode) { @@ -245,7 +247,7 @@ static IOBUF * nextfile(int skipping) { static long i = 1; - static int files = 0; + static int files = FALSE; NODE *arg; static IOBUF *curfile = NULL; static IOBUF mybuf; @@ -274,7 +276,7 @@ nextfile(int skipping) ARGIND_node->var_value = make_number((AWKNUM) i); } if (! arg_assign(arg->stptr, FALSE)) { - files++; + files = TRUE; fname = arg->stptr; curfile = iop_open(fname, binmode("r"), &mybuf); if (curfile == NULL) @@ -288,10 +290,11 @@ nextfile(int skipping) break; } } - if (files == 0) { - files++; + if (files == FALSE) { + files = TRUE; /* no args. -- use stdin */ /* FNR is init'ed to 0 */ + unref(FILENAME_node->var_value); FILENAME_node->var_value = make_string("-", 1); fname = "-"; curfile = iop_open(fname, binmode("r"), &mybuf); @@ -305,7 +308,7 @@ nextfile(int skipping) fatal(_("cannot open file `%s' for reading (%s)"), fname, strerror(errno)); /* NOTREACHED */ - return 0; + return (IOBUF *) 0; } /* set_FNR --- update internal FNR from awk variable */ @@ -555,6 +558,22 @@ redirect(NODE *tree, int *errflg) #endif /* HAVE_SOCKETS */ for (rp = red_head; rp != NULL; rp = rp->next) { +#ifndef PIPES_SIMULATED + /* + * This is an efficiency hack. We want to + * recover the process slot for dead children, + * if at all possible. Messing with signal() for + * SIGCLD leads to lots of headaches. However, if + * we've gotten EOF from a child input pipeline, it's + * good bet that the child has died. So recover it. + */ + if ((rp->flag & RED_EOF) && tree->type == Node_redirect_pipein) { + if (rp->pid != -1) + wait_any(0); + } +#endif /* PIPES_SIMULATED */ + + /* now check for a match */ if (strlen(rp->value) == tmp->stlen && STREQN(rp->value, str, tmp->stlen) && ((rp->flag & ~(RED_NOBUF|RED_EOF|RED_PTY)) == tflag @@ -769,8 +788,12 @@ close_one() for (rp = red_head; rp != NULL; rp = rp->next) rplast = rp; /* now work back up through the list */ - for (rp = rplast; rp != NULL; rp = rp->prev) - if (rp->fp != NULL && (rp->flag & RED_FILE) != 0) { + for (rp = rplast; rp != NULL; rp = rp->prev) { + /* don't close standard files! */ + if (rp->fp == NULL || rp->fp == stderr || rp->fp == stdout) + continue; + + if ((rp->flag & RED_FILE) != 0) { rp->flag |= RED_USED; errno = 0; if (/* do_lint && */ fclose(rp->fp) != 0) @@ -779,6 +802,7 @@ close_one() rp->fp = NULL; break; } + } if (rp == NULL) /* surely this is the only reason ??? */ fatal(_("too many pipes or input files open")); @@ -846,22 +870,13 @@ do_close(NODE *tree) return tmp; } -/* close_redir --- close an open file or pipe */ +/* close_rp --- separate function to just do closing */ static int -close_redir(register struct redirect *rp, int exitwarn, two_way_close_type how) +close_rp(struct redirect *rp, two_way_close_type how) { int status = 0; - if (rp == NULL) - return 0; - if (rp->fp == stdout || rp->fp == stderr) - return 0; - - if (do_lint && (rp->flag & RED_TWOWAY) == 0 && how != CLOSE_ALL) - lintwarn(_("close: redirection `%s' not opened with `|&', second argument ignored"), - rp->value); - errno = 0; if ((rp->flag & RED_TWOWAY) != 0) { /* two-way pipe */ /* write end: */ @@ -911,6 +926,27 @@ close_redir(register struct redirect *rp, int exitwarn, two_way_close_type how) } } + return status; +} + +/* close_redir --- close an open file or pipe */ + +static int +close_redir(register struct redirect *rp, int exitwarn, two_way_close_type how) +{ + int status = 0; + + if (rp == NULL) + return 0; + if (rp->fp == stdout || rp->fp == stderr) + goto checkwarn; /* bypass closing, remove from list */ + + if (do_lint && (rp->flag & RED_TWOWAY) == 0 && how != CLOSE_ALL) + lintwarn(_("close: redirection `%s' not opened with `|&', second argument ignored"), + rp->value); + + status = close_rp(rp, how); + /* SVR4 awk checks and warns about status of close */ if (status != 0) { char *s = strerror(errno); @@ -934,6 +970,7 @@ close_redir(register struct redirect *rp, int exitwarn, two_way_close_type how) } } +checkwarn: if (exitwarn) { /* * Don't use lintwarn() here. If lint warnings are fatal, @@ -1230,7 +1267,7 @@ devopen(const char *name, const char *mode) char *cp; char *ptr; int flag = 0; - extern double strtod(); + extern unsigned long strtoul P((const char *, char **endptr, int base)); flag = str2mode(mode); @@ -1258,7 +1295,7 @@ devopen(const char *name, const char *mode) openfd = fileno(stderr); else if (STREQN(cp, "fd/", 3)) { cp += 3; - openfd = (int) strtod(cp, &ptr); + openfd = (int) strtoul(cp, &ptr, 10); if (openfd <= INVALID_HANDLE || ptr == cp) openfd = INVALID_HANDLE; } @@ -1474,7 +1511,7 @@ useropen(IOBUF *iop, const char *name ATTRIBUTE_UNUSED, const char *mode ATTRIBU sprintf(tbuf, "%d %d %d %d", (int) getuid(), (int) geteuid(), (int) getgid(), (int) getegid()); cp = tbuf + strlen(tbuf); -#if defined(NGROUPS_MAX) && NGROUPS_MAX > 0 +#if defined (HAVE_GETGROUPS) && defined(NGROUPS_MAX) && NGROUPS_MAX > 0 for (i = 0; i < ngroups; i++) { *cp++ = ' '; sprintf(cp, "%d", (int) groupset[i]); @@ -1778,7 +1815,7 @@ two_way_open(const char *str, struct redirect *rp) signal(SIGPIPE, SIG_DFL); execl("/bin/sh", "sh", "-c", str, NULL); - _exit(127); + _exit(errno == ENOENT ? 127 : 126); case -1: save_errno = errno; @@ -2014,7 +2051,7 @@ wait_any(int interesting) /* pid of interest, if any */ signal(SIGHUP, hstat); signal(SIGINT, istat); signal(SIGQUIT, qstat); - return(status); + return status; } /* gawk_popen --- open an IOBUF on a child process */ @@ -2088,7 +2125,7 @@ gawk_popen(const char *cmd, struct redirect *rp) if (rp->iop == NULL) (void) close(p[0]); - return (rp->iop); + return rp->iop; } /* gawk_pclose --- close an open child pipe */ @@ -2137,7 +2174,7 @@ gawk_popen(const char *cmd, struct redirect *rp) current = NULL; } rp->ifp = current; - return (rp->iop); + return rp->iop; } /* gawk_pclose --- close an open child pipe */ @@ -2186,7 +2223,7 @@ gawk_popen(const char *cmd, struct redirect *rp) rp->iop = iop_alloc(current, name, NULL); if (rp->iop == NULL) (void) close(current); - return (rp->iop); + return rp->iop; } /* gawk_pclose --- close an open child pipe */ @@ -2336,10 +2373,10 @@ do_pathopen(const char *file) int len; if (STREQ(file, "-")) - return (0); + return 0; if (do_traditional) - return (devopen(file, "r")); + return devopen(file, "r"); if (first) { first = FALSE; @@ -2352,7 +2389,7 @@ do_pathopen(const char *file) /* some kind of path name, no search */ if (ispath(file)) - return (devopen(file, "r")); + return devopen(file, "r"); /* no arbitrary limits: */ len = strlen(awkpath) + strlen(file) + 2; @@ -2374,7 +2411,7 @@ do_pathopen(const char *file) strcpy(trypath, file); if ((fd = devopen(trypath, "r")) > INVALID_HANDLE) { free(trypath); - return (fd); + return fd; } /* no luck, keep going */ @@ -2388,7 +2425,7 @@ do_pathopen(const char *file) * working directory in it. Therefore try to open the file in the * current directory. */ - return (devopen(file, "r")); + return devopen(file, "r"); } #ifdef TEST @@ -2636,7 +2673,7 @@ rsrescan(IOBUF *iop, struct recmatch *recm, SCANSTATE *state) /* case 1, no match */ if (research(RSre, bp, 0, iop->dataend - bp, TRUE) == -1) { /* set len, in case this all there is. */ - recm->len = iop->dataend - iop->off - 1; + recm->len = iop->dataend - iop->off; return NOTERM; } @@ -3010,8 +3047,8 @@ set_RS() } else if (RS->stlen > 1) { static int warned = FALSE; - RS_re_yes_case = make_regexp(RS->stptr, RS->stlen, FALSE); - RS_re_no_case = make_regexp(RS->stptr, RS->stlen, TRUE); + RS_re_yes_case = make_regexp(RS->stptr, RS->stlen, FALSE, TRUE); + RS_re_no_case = make_regexp(RS->stptr, RS->stlen, TRUE, TRUE); RS_regexp = (IGNORECASE ? RS_re_no_case : RS_re_yes_case); matchrec = rsrescan; diff --git a/m4/ChangeLog b/m4/ChangeLog index 846cf1480..9cc5f1618 100644 --- a/m4/ChangeLog +++ b/m4/ChangeLog @@ -1,3 +1,33 @@ +Mon Aug 2 12:18:15 2004 Arnold D. Robbins + + * Release 3.1.4: Release tar file made. + +2004-02-19 gettextize + + * po.m4: Upgrade to gettext-0.14.1. + +2004-01-16 gettextize + + * gettext.m4: Upgrade to gettext-0.13.1. + * intmax.m4: New file, from gettext-0.13.1. + * lib-ld.m4: Upgrade to gettext-0.13.1. + * lib-prefix.m4: Upgrade to gettext-0.13.1. + * longdouble.m4: New file, from gettext-0.13.1. + * longlong.m4: Upgrade to gettext-0.13.1. + * po.m4: Upgrade to gettext-0.13.1. + * printf-posix.m4: New file, from gettext-0.13.1. + * signed.m4: New file, from gettext-0.13.1. + * size_max.m4: New file, from gettext-0.13.1. + * ulonglong.m4: Upgrade to gettext-0.13.1. + * wchar_t.m4: New file, from gettext-0.13.1. + * wint_t.m4: New file, from gettext-0.13.1. + * xsize.m4: New file, from gettext-0.13.1. + * Makefile.am: New file. + +Thu Jan 15 15:51:12 2004 Arnold D. Robbins + + * m4/arch.m4, m4/socket.m4, m4/strtod.m4: Quoting fixed for automake 1.8.x. + Mon Jul 7 11:01:43 2003 Arnold D. Robbins * Release 3.1.3: Release tar file made. diff --git a/m4/arch.m4 b/m4/arch.m4 index 723193603..778cd1104 100644 --- a/m4/arch.m4 +++ b/m4/arch.m4 @@ -1,7 +1,7 @@ dnl dnl arch.m4 --- autoconf input file for gawk dnl -dnl Copyright (C) 1995, 1996, 1998, 1999, 2000, 2003 the Free Software Foundation, Inc. +dnl Copyright (C) 1995, 1996, 1998, 1999, 2000, 2003, 2004 the Free Software Foundation, Inc. dnl dnl This file is part of GAWK, the GNU implementation of the dnl AWK Progamming Language. @@ -22,7 +22,7 @@ dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA dnl dnl Check for AIX and add _XOPEN_SOURCE_EXTENDED -AC_DEFUN(GAWK_AC_AIX_TWEAK, [ +AC_DEFUN([GAWK_AC_AIX_TWEAK], [ AC_MSG_CHECKING([for AIX compilation hacks]) AC_CACHE_VAL(gawk_cv_aix_hack, [ if test -d /lpp @@ -37,7 +37,7 @@ AC_MSG_RESULT([${gawk_cv_aix_hack}]) ])dnl dnl Check for Alpha Linux systems -AC_DEFUN(GAWK_AC_LINUX_ALPHA, [ +AC_DEFUN([GAWK_AC_LINUX_ALPHA], [ AC_MSG_CHECKING([for Linux/Alpha compilation hacks]) AC_CACHE_VAL(gawk_cv_linux_alpha_hack, [ if test "Linux" = "`uname`" && test "alpha" = "`uname -m`" diff --git a/m4/gettext.m4 b/m4/gettext.m4 index 16070b40a..a374f03fa 100644 --- a/m4/gettext.m4 +++ b/m4/gettext.m4 @@ -1,4 +1,4 @@ -# gettext.m4 serial 20 (gettext-0.12) +# gettext.m4 serial 28 (gettext-0.13) dnl Copyright (C) 1995-2003 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General @@ -354,9 +354,18 @@ AC_DEFUN([AM_INTL_SUBDIR], AC_REQUIRE([AC_ISC_POSIX])dnl AC_REQUIRE([AC_HEADER_STDC])dnl AC_REQUIRE([AC_C_CONST])dnl + AC_REQUIRE([bh_C_SIGNED])dnl AC_REQUIRE([AC_C_INLINE])dnl AC_REQUIRE([AC_TYPE_OFF_T])dnl AC_REQUIRE([AC_TYPE_SIZE_T])dnl + AC_REQUIRE([jm_AC_TYPE_LONG_LONG])dnl + AC_REQUIRE([gt_TYPE_LONGDOUBLE])dnl + AC_REQUIRE([gt_TYPE_WCHAR_T])dnl + AC_REQUIRE([gt_TYPE_WINT_T])dnl + AC_REQUIRE([jm_AC_HEADER_INTTYPES_H]) + AC_REQUIRE([jm_AC_HEADER_STDINT_H]) + AC_REQUIRE([gt_TYPE_INTMAX_T]) + AC_REQUIRE([gt_PRINTF_POSIX]) AC_REQUIRE([AC_FUNC_ALLOCA])dnl AC_REQUIRE([AC_FUNC_MMAP])dnl AC_REQUIRE([jm_GLIBC21])dnl @@ -364,14 +373,57 @@ AC_DEFUN([AM_INTL_SUBDIR], AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])dnl AC_REQUIRE([gt_HEADER_INTTYPES_H])dnl AC_REQUIRE([gt_INTTYPES_PRI])dnl + AC_REQUIRE([gl_XSIZE])dnl + AC_CHECK_TYPE([ptrdiff_t], , + [AC_DEFINE([ptrdiff_t], [long], + [Define as the type of the result of subtracting two pointers, if the system doesn't define it.]) + ]) 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 getc_unlocked getcwd getegid \ -geteuid getgid getuid mempcpy munmap putenv setenv setlocale stpcpy \ -strcasecmp strdup strtoul tsearch __argz_count __argz_stringify __argz_next \ + AC_CHECK_FUNCS([asprintf fwprintf getcwd getegid geteuid getgid getuid \ +mempcpy munmap putenv setenv setlocale snprintf stpcpy strcasecmp strdup \ +strtoul tsearch wcslen __argz_count __argz_stringify __argz_next \ __fsetlocking]) + dnl Use the _snprintf function only if it is declared (because on NetBSD it + dnl is defined as a weak alias of snprintf; we prefer to use the latter). + gt_CHECK_DECL(_snprintf, [#include ]) + gt_CHECK_DECL(_snwprintf, [#include ]) + + dnl Use the *_unlocked functions only if they are declared. + dnl (because some of them were defined without being declared in Solaris + dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built + dnl on Solaris 2.5.1 to run on Solaris 2.6). + dnl Don't use AC_CHECK_DECLS because it isn't supported in autoconf-2.13. + gt_CHECK_DECL(feof_unlocked, [#include ]) + gt_CHECK_DECL(fgets_unlocked, [#include ]) + gt_CHECK_DECL(getc_unlocked, [#include ]) + + case $gt_cv_func_printf_posix in + *yes) HAVE_POSIX_PRINTF=1 ;; + *) HAVE_POSIX_PRINTF=0 ;; + esac + AC_SUBST([HAVE_POSIX_PRINTF]) + if test "$ac_cv_func_asprintf" = yes; then + HAVE_ASPRINTF=1 + else + HAVE_ASPRINTF=0 + fi + AC_SUBST([HAVE_ASPRINTF]) + if test "$ac_cv_func_snprintf" = yes; then + HAVE_SNPRINTF=1 + else + HAVE_SNPRINTF=0 + fi + AC_SUBST([HAVE_SNPRINTF]) + if test "$ac_cv_func_wprintf" = yes; then + HAVE_WPRINTF=1 + else + HAVE_WPRINTF=0 + fi + AC_SUBST([HAVE_WPRINTF]) + AM_ICONV AM_LANGINFO_CODESET if test $ac_cv_header_locale_h = yes; then @@ -411,5 +463,25 @@ changequote([,])dnl ]) +dnl gt_CHECK_DECL(FUNC, INCLUDES) +dnl Check whether a function is declared. +AC_DEFUN([gt_CHECK_DECL], +[ + AC_CACHE_CHECK([whether $1 is declared], ac_cv_have_decl_$1, + [AC_TRY_COMPILE([$2], [ +#ifndef $1 + char *p = (char *) $1; +#endif +], ac_cv_have_decl_$1=yes, ac_cv_have_decl_$1=no)]) + if test $ac_cv_have_decl_$1 = yes; then + gt_value=1 + else + gt_value=0 + fi + AC_DEFINE_UNQUOTED([HAVE_DECL_]translit($1, [a-z], [A-Z]), [$gt_value], + [Define to 1 if you have the declaration of `$1', and to 0 if you don't.]) +]) + + dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version]) AC_DEFUN([AM_GNU_GETTEXT_VERSION], []) diff --git a/m4/intmax.m4 b/m4/intmax.m4 new file mode 100644 index 000000000..dfb08ccc9 --- /dev/null +++ b/m4/intmax.m4 @@ -0,0 +1,32 @@ +# intmax.m4 serial 1 (gettext-0.12) +dnl Copyright (C) 2002-2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Bruno Haible. +dnl Test whether the system has the 'intmax_t' type, but don't attempt to +dnl find a replacement if it is lacking. + +AC_DEFUN([gt_TYPE_INTMAX_T], +[ + AC_REQUIRE([jm_AC_HEADER_INTTYPES_H]) + AC_REQUIRE([jm_AC_HEADER_STDINT_H]) + AC_CACHE_CHECK(for intmax_t, gt_cv_c_intmax_t, + [AC_TRY_COMPILE([ +#include +#include +#if HAVE_STDINT_H_WITH_UINTMAX +#include +#endif +#if HAVE_INTTYPES_H_WITH_UINTMAX +#include +#endif +], [intmax_t x = -1;], gt_cv_c_intmax_t=yes, gt_cv_c_intmax_t=no)]) + if test $gt_cv_c_intmax_t = yes; then + AC_DEFINE(HAVE_INTMAX_T, 1, + [Define if you have the 'intmax_t' type in or .]) + fi +]) diff --git a/m4/lib-ld.m4 b/m4/lib-ld.m4 index 11d0ce773..38aeaec19 100644 --- a/m4/lib-ld.m4 +++ b/m4/lib-ld.m4 @@ -1,4 +1,4 @@ -# lib-ld.m4 serial 2 (gettext-0.12) +# lib-ld.m4 serial 3 (gettext-0.13) dnl Copyright (C) 1996-2003 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General @@ -14,11 +14,12 @@ dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no. AC_DEFUN([AC_LIB_PROG_LD_GNU], [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld, [# I'd rather use --version here, but apparently some GNU ld's only accept -v. -if $LD -v 2>&1 &5; then - acl_cv_prog_gnu_ld=yes -else - acl_cv_prog_gnu_ld=no -fi]) +case `$LD -v 2>&1 &1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then - test "$with_gnu_ld" != no && break - else - test "$with_gnu_ld" != yes && break - fi + case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in + *GNU* | *'with BFD'*) + test "$with_gnu_ld" != no && break ;; + *) + test "$with_gnu_ld" != yes && break ;; + esac fi done IFS="$ac_save_ifs" diff --git a/m4/lib-prefix.m4 b/m4/lib-prefix.m4 index c719bc809..8aff5a9d2 100644 --- a/m4/lib-prefix.m4 +++ b/m4/lib-prefix.m4 @@ -1,4 +1,4 @@ -# lib-prefix.m4 serial 2 (gettext-0.12) +# lib-prefix.m4 serial 3 (gettext-0.13) dnl Copyright (C) 2001-2003 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General @@ -13,7 +13,7 @@ dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't dnl require excessive bracketing. ifdef([AC_HELP_STRING], [AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])], -[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])]) +[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])]) dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed dnl to access previously installed libraries. The basic assumption is that diff --git a/m4/longdouble.m4 b/m4/longdouble.m4 new file mode 100644 index 000000000..1333d2f57 --- /dev/null +++ b/m4/longdouble.m4 @@ -0,0 +1,30 @@ +# longdouble.m4 serial 1 (gettext-0.12) +dnl Copyright (C) 2002-2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Bruno Haible. +dnl Test whether the compiler supports the 'long double' type. +dnl Prerequisite: AC_PROG_CC + +AC_DEFUN([gt_TYPE_LONGDOUBLE], +[ + AC_CACHE_CHECK([for long double], gt_cv_c_long_double, + [if test "$GCC" = yes; then + gt_cv_c_long_double=yes + else + AC_TRY_COMPILE([ + /* The Stardent Vistra knows sizeof(long double), but does not support it. */ + long double foo = 0.0; + /* On Ultrix 4.3 cc, long double is 4 and double is 8. */ + int array [2*(sizeof(long double) >= sizeof(double)) - 1]; + ], , + gt_cv_c_long_double=yes, gt_cv_c_long_double=no) + fi]) + if test $gt_cv_c_long_double = yes; then + AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define if you have the 'long double' type.]) + fi +]) diff --git a/m4/longlong.m4 b/m4/longlong.m4 index daa95c075..d7d7350b3 100644 --- a/m4/longlong.m4 +++ b/m4/longlong.m4 @@ -1,4 +1,10 @@ -#serial 2 +# longlong.m4 serial 4 +dnl Copyright (C) 1999-2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. dnl From Paul Eggert. @@ -7,29 +13,13 @@ dnl From Paul Eggert. AC_DEFUN([jm_AC_TYPE_LONG_LONG], [ AC_CACHE_CHECK([for long long], ac_cv_type_long_long, - [AC_TRY_LINK([long long ll = 1; int i = 63;], + [AC_TRY_LINK([long long ll = 1LL; int i = 63;], [long long llmax = (long long) -1; return ll << i | ll >> i | llmax / ll | llmax % ll;], ac_cv_type_long_long=yes, ac_cv_type_long_long=no)]) if test $ac_cv_type_long_long = yes; then AC_DEFINE(HAVE_LONG_LONG, 1, - [Define if you have the long long type.]) - fi -]) - -# Define HAVE_UNSIGNED_LONG_LONG if 'unsigned long long' works. - -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.]) + [Define if you have the 'long long' type.]) fi ]) diff --git a/m4/po.m4 b/m4/po.m4 index 861e3dec3..e16199881 100644 --- a/m4/po.m4 +++ b/m4/po.m4 @@ -1,4 +1,4 @@ -# po.m4 serial 1 (gettext-0.12) +# po.m4 serial 3 (gettext-0.14) dnl Copyright (C) 1995-2003 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General @@ -111,7 +111,7 @@ AC_DEFUN([AM_PO_SUBDIRS], test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" POMAKEFILEDEPS="POTFILES.in" - # ALL_LINGUAS, POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES depend + # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend # on $ac_dir but don't depend on user-specified configuration # parameters. if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then @@ -127,19 +127,27 @@ AC_DEFUN([AM_PO_SUBDIRS], # The set of available languages was given in configure.in. eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS' fi + # Compute POFILES + # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po) + # Compute UPDATEPOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update) + # Compute DUMMYPOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop) + # Compute GMOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo) case "$ac_given_srcdir" in .) srcdirpre= ;; *) srcdirpre='$(srcdir)/' ;; esac POFILES= - GMOFILES= UPDATEPOFILES= DUMMYPOFILES= + GMOFILES= for lang in $ALL_LINGUAS; do POFILES="$POFILES $srcdirpre$lang.po" - GMOFILES="$GMOFILES $srcdirpre$lang.gmo" UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" DUMMYPOFILES="$DUMMYPOFILES $lang.nop" + GMOFILES="$GMOFILES $srcdirpre$lang.gmo" done # CATALOGS depends on both $ac_dir and the user's LINGUAS # environment variable. @@ -174,7 +182,7 @@ AC_DEFUN([AM_PO_SUBDIRS], done fi test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" - sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" + sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do if test -f "$f"; then case "$f" in @@ -188,10 +196,231 @@ AC_DEFUN([AM_PO_SUBDIRS], esac done], [# Capture the value of obsolete ALL_LINGUAS because we need it to compute - # POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES, CATALOGS. But hide it + # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it # from automake. eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"' # Capture the value of LINGUAS because we need it to compute CATALOGS. LINGUAS="${LINGUAS-%UNSET%}" ]) ]) + +dnl Postprocesses a Makefile in a directory containing PO files. +AC_DEFUN([AM_POSTPROCESS_PO_MAKEFILE], +[ + # When this code is run, in config.status, two variables have already been + # set: + # - OBSOLETE_ALL_LINGUAS is the value of LINGUAS set in configure.in, + # - LINGUAS is the value of the environment variable LINGUAS at configure + # time. + +changequote(,)dnl + # 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 + + # Find a way to echo strings without interpreting backslash. + if test "X`(echo '\t') 2>/dev/null`" = 'X\t'; then + gt_echo='echo' + else + if test "X`(printf '%s\n' '\t') 2>/dev/null`" = 'X\t'; then + gt_echo='printf %s\n' + else + echo_func () { + cat < "$ac_file.tmp" + if grep -l '@TCLCATALOGS@' "$ac_file" > /dev/null; then + # Add dependencies that cannot be formulated as a simple suffix rule. + for lang in $ALL_LINGUAS; do + frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` + cat >> "$ac_file.tmp" < /dev/null; then + # Add dependencies that cannot be formulated as a simple suffix rule. + for lang in $ALL_LINGUAS; do + frobbedlang=`echo $lang | sed -e 's/_/-/g'` + cat >> "$ac_file.tmp" <> "$ac_file.tmp" < +#include +/* The string "%2$d %1$d", with dollar characters protected from the shell's + dollar expansion (possibly an autoconf bug). */ +static char format[] = { '%', '2', '$', 'd', ' ', '%', '1', '$', 'd', '\0' }; +static char buf[100]; +int main () +{ + sprintf (buf, format, 33, 55); + return (strcmp (buf, "55 33") != 0); +}], gt_cv_func_printf_posix=yes, gt_cv_func_printf_posix=no, + [ + AC_EGREP_CPP(notposix, [ +#if defined __NetBSD__ || defined _MSC_VER || defined __MINGW32__ || defined __CYGWIN__ + notposix +#endif + ], gt_cv_func_printf_posix="guessing no", + gt_cv_func_printf_posix="guessing yes") + ]) + ]) + case $gt_cv_func_printf_posix in + *yes) + AC_DEFINE(HAVE_POSIX_PRINTF, 1, + [Define if your printf() function supports format strings with positions.]) + ;; + esac +]) diff --git a/m4/signed.m4 b/m4/signed.m4 new file mode 100644 index 000000000..dc1f54f10 --- /dev/null +++ b/m4/signed.m4 @@ -0,0 +1,19 @@ +# signed.m4 serial 1 (gettext-0.10.40) +dnl Copyright (C) 2001-2002 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Bruno Haible. + +AC_DEFUN([bh_C_SIGNED], +[ + AC_CACHE_CHECK([for signed], bh_cv_c_signed, + [AC_TRY_COMPILE(, [signed char x;], bh_cv_c_signed=yes, bh_cv_c_signed=no)]) + if test $bh_cv_c_signed = no; then + AC_DEFINE(signed, , + [Define to empty if the C compiler doesn't support this keyword.]) + fi +]) diff --git a/m4/size_max.m4 b/m4/size_max.m4 new file mode 100644 index 000000000..5762fc333 --- /dev/null +++ b/m4/size_max.m4 @@ -0,0 +1,61 @@ +# size_max.m4 serial 2 +dnl Copyright (C) 2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Bruno Haible. + +AC_DEFUN([gl_SIZE_MAX], +[ + AC_CHECK_HEADERS(stdint.h) + dnl First test whether the system already has SIZE_MAX. + AC_MSG_CHECKING([for SIZE_MAX]) + result= + AC_EGREP_CPP([Found it], [ +#include +#if HAVE_STDINT_H +#include +#endif +#ifdef SIZE_MAX +Found it +#endif +], result=yes) + if test -z "$result"; then + dnl Define it ourselves. Here we assume that the type 'size_t' is not wider + dnl than the type 'unsigned long'. + dnl The _AC_COMPUTE_INT macro works up to LONG_MAX, since it uses 'expr', + dnl which is guaranteed to work from LONG_MIN to LONG_MAX. + _AC_COMPUTE_INT([~(size_t)0 / 10], res_hi, + [#include ], result=?) + _AC_COMPUTE_INT([~(size_t)0 % 10], res_lo, + [#include ], result=?) + _AC_COMPUTE_INT([sizeof (size_t) <= sizeof (unsigned int)], fits_in_uint, + [#include ], result=?) + if test "$fits_in_uint" = 1; then + dnl Even though SIZE_MAX fits in an unsigned int, it must be of type + dnl 'unsigned long' if the type 'size_t' is the same as 'unsigned long'. + AC_TRY_COMPILE([#include + extern size_t foo; + extern unsigned long foo; + ], [], fits_in_uint=0) + fi + if test -z "$result"; then + if test "$fits_in_uint" = 1; then + result="$res_hi$res_lo"U + else + result="$res_hi$res_lo"UL + fi + else + dnl Shouldn't happen, but who knows... + result='~(size_t)0' + fi + fi + AC_MSG_RESULT([$result]) + if test "$result" != yes; then + AC_DEFINE_UNQUOTED([SIZE_MAX], [$result], + [Define as the maximum value of type 'size_t', if the system doesn't define it.]) + fi +]) diff --git a/m4/socket.m4 b/m4/socket.m4 index e0b51fb18..be8942473 100644 --- a/m4/socket.m4 +++ b/m4/socket.m4 @@ -1,7 +1,7 @@ dnl dnl socket.m4 --- autoconf input file for gawk dnl -dnl Copyright (C) 1995, 1996, 1998, 1999, 2000, 2003 the Free Software Foundation, Inc. +dnl Copyright (C) 1995, 1996, 1998, 1999, 2000, 2003, 2004 the Free Software Foundation, Inc. dnl dnl This file is part of GAWK, the GNU implementation of the dnl AWK Progamming Language. @@ -23,7 +23,7 @@ dnl dnl Find the socket libraries dnl largely stolen from AC_PATH_XTRA -AC_DEFUN(GAWK_AC_LIB_SOCKETS, [ +AC_DEFUN([GAWK_AC_LIB_SOCKETS], [ gawk_have_sockets=no # Check for system-dependent location of socket libraries diff --git a/m4/strtod.m4 b/m4/strtod.m4 index 8f0abaa72..16dd33bf6 100644 --- a/m4/strtod.m4 +++ b/m4/strtod.m4 @@ -1,7 +1,7 @@ dnl dnl strtod.m4 --- autoconf input file for gawk dnl -dnl Copyright (C) 2001, 2002 the Free Software Foundation, Inc. +dnl Copyright (C) 2001, 2002, 2004 the Free Software Foundation, Inc. dnl dnl This file is part of GAWK, the GNU implementation of the dnl AWK Progamming Language. @@ -22,8 +22,7 @@ dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA dnl Check for strtod with C89 semantics -AC_DEFUN(GAWK_AC_FUNC_STRTOD_C89, -[ +AC_DEFUN([GAWK_AC_FUNC_STRTOD_C89], [ AC_CHECK_HEADERS(stdlib.h) AC_CHECK_FUNCS(strtod) AC_CACHE_CHECK([for strtod with C89 semantics], gawk_ac_cv_func_strtod_c89, diff --git a/m4/ulonglong.m4 b/m4/ulonglong.m4 index c375e474c..1da8b809e 100644 --- a/m4/ulonglong.m4 +++ b/m4/ulonglong.m4 @@ -1,5 +1,5 @@ -# ulonglong.m4 serial 2 (fileutils-4.0.32, gettext-0.10.40) -dnl Copyright (C) 1999-2002 Free Software Foundation, Inc. +# ulonglong.m4 serial 3 +dnl Copyright (C) 1999-2003 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General dnl Public License, this file may be distributed as part of a program @@ -8,16 +8,18 @@ dnl the same distribution terms as the rest of that program. dnl From Paul Eggert. +# Define HAVE_UNSIGNED_LONG_LONG if 'unsigned long long' works. + 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;], + [AC_TRY_LINK([unsigned long long ull = 1ULL; 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.]) + [Define if you have the 'unsigned long long' type.]) fi ]) diff --git a/m4/wchar_t.m4 b/m4/wchar_t.m4 new file mode 100644 index 000000000..d8fd1ec5c --- /dev/null +++ b/m4/wchar_t.m4 @@ -0,0 +1,22 @@ +# wchar_t.m4 serial 1 (gettext-0.12) +dnl Copyright (C) 2002-2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Bruno Haible. +dnl Test whether has the 'wchar_t' type. +dnl Prerequisite: AC_PROG_CC + +AC_DEFUN([gt_TYPE_WCHAR_T], +[ + AC_CACHE_CHECK([for wchar_t], gt_cv_c_wchar_t, + [AC_TRY_COMPILE([#include + wchar_t foo = (wchar_t)'\0';], , + gt_cv_c_wchar_t=yes, gt_cv_c_wchar_t=no)]) + if test $gt_cv_c_wchar_t = yes; then + AC_DEFINE(HAVE_WCHAR_T, 1, [Define if you have the 'wchar_t' type.]) + fi +]) diff --git a/m4/wint_t.m4 b/m4/wint_t.m4 new file mode 100644 index 000000000..3d8d21594 --- /dev/null +++ b/m4/wint_t.m4 @@ -0,0 +1,22 @@ +# wint_t.m4 serial 1 (gettext-0.12) +dnl Copyright (C) 2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl From Bruno Haible. +dnl Test whether has the 'wint_t' type. +dnl Prerequisite: AC_PROG_CC + +AC_DEFUN([gt_TYPE_WINT_T], +[ + AC_CACHE_CHECK([for wint_t], gt_cv_c_wint_t, + [AC_TRY_COMPILE([#include + wint_t foo = (wchar_t)'\0';], , + gt_cv_c_wint_t=yes, gt_cv_c_wint_t=no)]) + if test $gt_cv_c_wint_t = yes; then + AC_DEFINE(HAVE_WINT_T, 1, [Define if you have the 'wint_t' type.]) + fi +]) diff --git a/m4/xsize.m4 b/m4/xsize.m4 new file mode 100644 index 000000000..9b7cf9b49 --- /dev/null +++ b/m4/xsize.m4 @@ -0,0 +1,14 @@ +# xsize.m4 serial 2 +dnl Copyright (C) 2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +AC_DEFUN([gl_XSIZE], +[ + dnl Prerequisites of lib/xsize.h. + AC_REQUIRE([gl_SIZE_MAX]) + AC_CHECK_HEADERS(stdint.h) +]) diff --git a/main.c b/main.c index 40a12f834..87a229588 100644 --- a/main.c +++ b/main.c @@ -3,7 +3,7 @@ */ /* - * Copyright (C) 1986, 1988, 1989, 1991-2003 the Free Software Foundation, Inc. + * Copyright (C) 1986, 1988, 1989, 1991-2004 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. @@ -25,11 +25,6 @@ #include "awk.h" #include "getopt.h" -#ifdef TANDEM -#include "ptchlvl.h" /* blech */ -#else -#include "patchlev.h" -#endif #ifndef O_BINARY #include @@ -87,6 +82,10 @@ int errcount = 0; /* error counter, used by yyerror() */ NODE *Nnull_string; /* The global null string */ +#if ENABLE_NLS && defined(HAVE_LOCALE_H) +struct lconv loc; /* current locale */ +#endif /* ENABLE_NLS && defined(HAVE_LOCALE_H) */ + /* The name the program was invoked under, for error messages */ const char *myname; @@ -141,7 +140,7 @@ int gawk_mb_cur_max = 1; /* MB_CUR_MAX value, see comment in main() */ int output_is_tty = FALSE; /* control flushing of output */ -extern const char *version_string; /* current version, for printing */ +extern const char *version_string; #if defined (HAVE_GETGROUPS) && defined(NGROUPS_MAX) && NGROUPS_MAX > 0 GETGROUPS_T *groupset; /* current group set */ @@ -252,8 +251,8 @@ main(int argc, char **argv) gawk_mb_cur_max = MB_CUR_MAX; #endif - bindtextdomain(PACKAGE, LOCALEDIR); - textdomain(PACKAGE); + (void) bindtextdomain(PACKAGE, LOCALEDIR); + (void) textdomain(PACKAGE); (void) signal(SIGFPE, catchsig); (void) signal(SIGSEGV, catchsig); @@ -556,6 +555,10 @@ main(int argc, char **argv) setlocale(LC_NUMERIC, ""); #endif +#if ENABLE_NLS && defined(HAVE_LOCALE_H) + loc = *localeconv(); /* Make a local copy of locale numeric info */ +#endif + /* Whew. Finally, run the program. */ if (begin_block != NULL) { in_begin_rule = TRUE; @@ -569,7 +572,7 @@ main(int argc, char **argv) (void) interpret(end_block); } in_end_rule = FALSE; - if (close_io() != 0 && exit_val == 0) + if (close_io() != 0 && ! exiting && exit_val == 0) exit_val = 1; if (do_profiling) { @@ -787,7 +790,7 @@ static const struct varinit varinit[] = { {&OFMT_node, "OFMT", Node_OFMT, "%.6g", 0, set_OFMT }, {&RLENGTH_node, "RLENGTH", Node_var, NULL, 0, NULL }, {&RSTART_node, "RSTART", Node_var, NULL, 0, NULL }, -{&SUBSEP_node, "SUBSEP", Node_var, "\034", 0, NULL }, +{&SUBSEP_node, "SUBSEP", Node_SUBSEP, "\034", 0, NULL }, {&ARGIND_node, "ARGIND", Node_var, NULL, 0, NULL }, {&ERRNO_node, "ERRNO", Node_var, NULL, 0, NULL }, {&RT_node, "RT", Node_var, "", 0, NULL }, @@ -891,6 +894,9 @@ load_procinfo() * do it the slow and stupid way. sigh. */ + aptr = assoc_lookup(PROCINFO_node, tmp_string("version", 7), FALSE); + *aptr = make_string(VERSION, strlen(VERSION)); + value = getpid(); aptr = assoc_lookup(PROCINFO_node, tmp_string("pid", 3), FALSE); *aptr = make_number(value); @@ -1043,7 +1049,7 @@ nostalgia() static void version() { - printf("%s.%s\n", version_string, PATCHLEVEL); + printf("%s\n", version_string); /* * Per GNU coding standards, print copyright info, * then exit successfully, do nothing else. @@ -1069,6 +1075,8 @@ init_fds() lintwarn(_("no pre-opened fd %d"), fd); #endif newfd = devopen("/dev/null", "r+"); + /* turn off some compiler warnings "set but not used" */ + newfd += 0; #ifdef MAKE_A_HEROIC_EFFORT if (do_lint && newfd < 0) lintwarn(_("could not pre-open /dev/null for fd %d"), fd); diff --git a/mbsupport.h b/mbsupport.h new file mode 100644 index 000000000..78a27ed81 --- /dev/null +++ b/mbsupport.h @@ -0,0 +1,54 @@ +/* + * mbsupport.h --- Localize determination of whether we have multibyte stuff. + */ + +/* + * Copyright (C) 2004 the Free Software Foundation, Inc. + * + * This file is part of GAWK, the GNU implementation of the + * AWK Programming Language. + * + * GAWK 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. + * + * GAWK is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +/* + * This file is needed because we test for 1i8n support in 3 different + * places, and we want a consistent definition in all of them. Following + * the ``Don't Repeat Yourself'' principle from "The Pragmatic Programmer", + * we centralize the tests here. + * + * This test is the union of all the current tests. + */ + +#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_WCTYPE_T) \ + && (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/missing b/missing index 6a37006e8..e7ef83a1c 100755 --- a/missing +++ b/missing @@ -1,6 +1,10 @@ #! /bin/sh # Common stub for a few missing GNU programs while installing. -# Copyright (C) 1996, 1997, 1999, 2000, 2002 Free Software Foundation, Inc. + +scriptversion=2003-09-02.23 + +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 +# Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify @@ -38,12 +42,23 @@ else configure_ac=configure.in fi +msg="missing on your system" + case "$1" in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 + # Exit code 63 means version mismatch. This often happens + # when the user try to use an ancient version of a tool on + # a file that requires a minimum version. In this case we + # we should proceed has if the program had been absent, or + # if --run hadn't been passed. + if test $? = 63; then + run=: + msg="probably too old" + fi ;; esac @@ -74,11 +89,13 @@ Supported PROGRAM values: lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags - yacc create \`y.tab.[ch]', if possible, from existing .[ch]" + yacc create \`y.tab.[ch]', if possible, from existing .[ch] + +Send bug reports to ." ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) - echo "missing 0.4 - GNU automake" + echo "missing $scriptversion (GNU Automake)" ;; -*) @@ -94,7 +111,7 @@ Supported PROGRAM values: fi echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if +WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." @@ -108,7 +125,7 @@ WARNING: \`$1' is missing on your system. You should only need it if fi echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if +WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." @@ -122,7 +139,7 @@ WARNING: \`$1' is missing on your system. You should only need it if fi echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if +WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." @@ -146,7 +163,7 @@ WARNING: \`$1' is missing on your system. You should only need it if fi echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if +WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." @@ -162,10 +179,10 @@ WARNING: \`$1' is missing on your system. You should only need it if fi echo 1>&2 "\ -WARNING: \`$1' is needed, and you do not seem to have it handy on your - system. You might have modified some files without having the +WARNING: \`$1' is needed, but is $msg. + You might have modified some files without having the proper tools for further handling them. - You can get \`$1Help2man' as part of \`Autoconf' from any GNU + You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` @@ -185,7 +202,7 @@ WARNING: \`$1' is needed, and you do not seem to have it handy on your bison|yacc) echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if +WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." @@ -215,7 +232,7 @@ WARNING: \`$1' is missing on your system. You should only need it if lex|flex) echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if +WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." @@ -243,7 +260,7 @@ WARNING: \`$1' is missing on your system. You should only need it if fi echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if +WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." @@ -268,7 +285,7 @@ WARNING: \`$1' is missing on your system. You should only need it if fi echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if +WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, @@ -323,10 +340,10 @@ WARNING: I can't seem to be able to run \`tar' with the given arguments. *) echo 1>&2 "\ -WARNING: \`$1' is needed, and you do not seem to have it handy on your - system. You might have modified some files without having the +WARNING: \`$1' is needed, and is $msg. + You might have modified some files without having the proper tools for further handling them. Check the \`README' file, - it often tells you about the needed prerequirements for installing + it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 @@ -334,3 +351,10 @@ WARNING: \`$1' is needed, and you do not seem to have it handy on your esac exit 0 + +# 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/missing_d/ChangeLog b/missing_d/ChangeLog index da1d09a5c..c0d38c197 100644 --- a/missing_d/ChangeLog +++ b/missing_d/ChangeLog @@ -1,3 +1,20 @@ +Mon Aug 2 12:18:15 2004 Arnold D. Robbins + + * Release 3.1.4: Release tar file made. + +Mon May 3 09:24:21 2004 Arnold D. Robbins + + * strtoul.c: New file. + +Sun May 2 18:03:54 2004 Arnold D. Robbins + + * strtod.c (gawk_strtod): Check for locale's decimal point + instead of hard-wiring period. + +Tue Jan 20 10:38:48 2004 Arnold D. Robbins + + * memmove.c: New file. + Mon Jul 7 11:01:43 2003 Arnold D. Robbins * Release 3.1.3: Release tar file made. diff --git a/missing_d/memmove.c b/missing_d/memmove.c new file mode 100644 index 000000000..928b812e1 --- /dev/null +++ b/missing_d/memmove.c @@ -0,0 +1,149 @@ +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if 0 +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)bcopy.c 8.1 (Berkeley) 6/4/93"; +#endif /* LIBC_SCCS and not lint */ + +#include +#include +#endif + +/* + * sizeof(word) MUST BE A POWER OF TWO + * SO THAT wmask BELOW IS ALL ONES + */ +typedef int word; /* "word" used for optimal copy speed */ + +#define wsize sizeof(word) +#define wmask (wsize - 1) + +/* ADR: 1/2004. For gawk, we need memmove(). */ +#define MEMMOVE 1 + +/* + * Copy a block of memory, handling overlap. + * This is the routine that actually implements + * (the portable versions of) bcopy, memcpy, and memmove. + */ +#ifdef MEMCOPY +void * +memcpy(dst0, src0, length) +#else +#ifdef MEMMOVE +void * +memmove(dst0, src0, length) +#else +void +bcopy(src0, dst0, length) +#endif +#endif + void *dst0; + const void *src0; + register size_t length; +{ + register char *dst = dst0; + register const char *src = src0; + register size_t t; + + if (length == 0 || dst == src) /* nothing to do */ + goto done; + + /* + * Macros: loop-t-times; and loop-t-times, t>0 + */ +#define TLOOP(s) if (t) TLOOP1(s) +#define TLOOP1(s) do { s; } while (--t) + + if ((unsigned long)dst < (unsigned long)src) { + /* + * Copy forward. + */ + t = (int)src; /* only need low bits */ + if ((t | (int)dst) & wmask) { + /* + * Try to align operands. This cannot be done + * unless the low bits match. + */ + if ((t ^ (int)dst) & wmask || length < wsize) + t = length; + else + t = wsize - (t & wmask); + length -= t; + TLOOP1(*dst++ = *src++); + } + /* + * Copy whole words, then mop up any trailing bytes. + */ + t = length / wsize; + TLOOP(*(word *)dst = *(word *)src; src += wsize; dst += wsize); + t = length & wmask; + TLOOP(*dst++ = *src++); + } else { + /* + * Copy backwards. Otherwise essentially the same. + * Alignment works as before, except that it takes + * (t&wmask) bytes to align, not wsize-(t&wmask). + */ + src += length; + dst += length; + t = (int)src; + if ((t | (int)dst) & wmask) { + if ((t ^ (int)dst) & wmask || length <= wsize) + t = length; + else + t &= wmask; + length -= t; + TLOOP1(*--dst = *--src); + } + t = length / wsize; + TLOOP(src -= wsize; dst -= wsize; *(word *)dst = *(word *)src); + t = length & wmask; + TLOOP(*--dst = *--src); + } +done: +#if defined(MEMCOPY) || defined(MEMMOVE) + return (dst0); +#else + return; +#endif +} +#undef wsize +#undef wmask +#undef MEMMOVE +#undef TLOOP +#undef TLOOP1 diff --git a/missing_d/strtod.c b/missing_d/strtod.c index e33a5b5e5..fc97b8d86 100644 --- a/missing_d/strtod.c +++ b/missing_d/strtod.c @@ -28,6 +28,8 @@ * doesn't look like we failed. Sigh. * * Xmass 2002. Fix a bug in ptr determination, eg. for "0e0". + * + * Spring 2004. Update for I18N. Oh joy. */ #if 0 @@ -66,7 +68,15 @@ register const char **ptr; dig++; } - if (*s == '.') { + if ( +#if ENABLE_NLS && defined(HAVE_LOCALE_H) + loc.decimal_point != NULL + ? *s == loc.decimal_point[0] + : *s == '.' +#else + *s == '.' +#endif + ) { s++; while (*s == '0') { s++; diff --git a/missing_d/strtoul.c b/missing_d/strtoul.c new file mode 100644 index 000000000..ccabfbebf --- /dev/null +++ b/missing_d/strtoul.c @@ -0,0 +1,223 @@ +/* + * Very simple implementation of strtoul() for gawk, + * for old systems. Descriptive prose from the Linux man page. + * + * May 2004 + */ + +/* #define TEST 1 */ + +#ifdef TEST +#include +#include +#include +#include +#include +#include +#define TRUE 1 +#define FALSE 0 +#define strtoul mystrtoul +#endif + +#ifndef ULONG_MAX +#define ULONG_MAX (~ 0UL) +#endif + +unsigned long int +strtoul(nptr, endptr, base) +const char *nptr; +char **endptr; +int base; +{ + static char lower[] = "abcdefghijklmnopqrstuvwxyz"; + + unsigned long result = 0UL; + char *nptr_orig = (char *) nptr; + int neg = FALSE; + char *cp, c; + int val; + int sawdigs = FALSE; + + /* + * The strtoul() function converts the initial part of the + * string in nptr to an unsigned long integer value according + * to the given base, which must be between 2 and 36 inclusive, + * or be the special value 0. + */ + + if ((base != 0 && (base < 2 || base > 36)) || nptr == NULL) { + if (endptr != NULL) + *endptr = nptr_orig; + errno = EINVAL; + return 0; + } + + /* + * The string must [sic] begin with an arbitrary amount of white space + * (as determined by isspace(3)) followed by a single optional + * `+' or `-' sign. + */ + while (isspace(*nptr)) + nptr++; + + if (*nptr == '+') + nptr++; + else if (*nptr == '-') { + nptr++; + neg = TRUE; + } + + /* + * If base is zero or 16, the string may then include a `0x' prefix, + * and the number will be read in base 16; otherwise, a zero base is + * taken as 10 (decimal) unless the next character is `0', in which + * case it is taken as 8 (octal). + */ + if ((base == 0 || base == 16) + && nptr[0] == '0' + && (nptr[1] == 'x' || nptr[1] == 'X')) { + base = 16; /* force it */ + nptr += 2; /* skip 0x */ + } else if ((base == 0 || base == 8) && nptr[0] == '0') { + base = 8; + nptr++; + } else if (base == 0) + base = 10; + + /* + * The remainder of the string is converted to an unsigned long int + * value in the obvious manner, stopping at the first character + * which is not a valid digit in the given base. (In bases above 10, + * the letter `A' in either upper or lower case represents 10, + * `B' represents 11, and so forth, with `Z' representing 35.) + */ + for (; *nptr != '\0'; nptr++) { + c = *nptr; +#if ENABLE_NLS && defined(HAVE_LOCALE_H) + if (base == 10 + && loc.thousands_sep != NULL + && loc.thousands_sep[0] != '\0' + && c == loc.thousands_sep[0]) + continue; +#endif + switch (c) { + case '0': case '1': case '2': + case '3': case '4': case '5': + case '6': case '7': case '8': + case '9': + val = c - '0'; + if (val >= base) /* even base 2 allowed ... */ + goto out; + result *= base; + result += val; + sawdigs = TRUE; + break; + 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': + c += 'a' - 'A'; /* downcase */ + /* fall through */ + 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': + cp = strchr(lower, c); + val = cp - lower; + val += 10; /* 'a' == 10 */ + if (val >= base) + goto out; + result *= base; + result += val; + sawdigs = TRUE; + break; + default: + goto out; + } + } +out: + /* + * If endptr is not NULL, strtoul() stores the address of the + * first invalid character in *endptr. If there were no digits + * at all, strtoul() stores the original value of nptr in *endptr + * (and returns 0). In particular, if *nptr is not `\0' but + * **endptr is `\0' on return, the entire string is valid. + */ + if (endptr != NULL) { + if (! sawdigs) { + *endptr = nptr_orig; + return 0; + } else + *endptr = (char *) nptr; + } + + /* + * RETURN VALUE + * The strtoul() function returns either the result of the + * conversion or, if there was a leading minus sign, the + * negation of the result of the conversion, unless the original + * (non-negated) value would overflow; in the latter case, + * strtoul() returns ULONG_MAX and sets the global variable errno + * to ERANGE. + */ + + /* + * ADR: This computation is probably bogus. If it's a + * problem, upgrade to a modern system. + */ + if (neg && result == ULONG_MAX) { + errno = ERANGE; + return ULONG_MAX; + } else if (neg) + result = -result; + + return result; +} + +#ifdef TEST +#undef strtoul +int main(void) +{ + char *endptr; + unsigned long res1, res2; + + res1 = strtoul("0xdeadBeeF", & endptr, 0), + res2 = mystrtoul("0xdeadBeeF", & endptr, 0), +printf("(real,my)strtoul(\"0xdeadBeeF\", & endptr, 0) is %lu, %lu *endptr = %d\n", + res1, res2, *endptr); + + res1 = strtoul("0101101", & endptr, 2), + res2 = mystrtoul("0101101", & endptr, 2), +printf("(real,my)strtoul(\"0101101\", & endptr, 2) is %lu, %lu *endptr = %d\n", + res1, res2, *endptr); + + res1 = strtoul("01011012", & endptr, 2), + res2 = mystrtoul("01011012", & endptr, 2), +printf("(real,my)strtoul(\"01011012\", & endptr, 2) is %lu, %lu *endptr = %d\n", + res1, res2, *endptr); + + res1 = strtoul(" +42a", & endptr, 0), + res2 = mystrtoul(" +42a", & endptr, 0), +printf("(real,my)strtoul(\" +42a\", & endptr, 0) is %lu, %lu *endptr = %d\n", + res1, res2, *endptr); + + res1 = strtoul("0377", & endptr, 0), + res2 = mystrtoul("0377", & endptr, 0), +printf("(real,my)strtoul(\"0377\", & endptr, 0) is %lu, %lu *endptr = %d\n", + res1, res2, *endptr); + + res1 = strtoul("Z", & endptr, 36), + res2 = mystrtoul("Z", & endptr, 36), +printf("(real,my)strtoul(\"Z\", & endptr, 36) is %lu, %lu *endptr = %d\n", + res1, res2, *endptr); + + res1 = strtoul("qZ*", & endptr, 36), + res2 = mystrtoul("qZ*", & endptr, 36), +printf("(real,my)strtoul(\"qZ*\", & endptr, 36) is %lu, %lu *endptr = %d\n", + res1, res2, *endptr); +} +#endif diff --git a/mkinstalldirs b/mkinstalldirs index d2d5f21b6..6fbe5e117 100755 --- a/mkinstalldirs +++ b/mkinstalldirs @@ -1,20 +1,32 @@ #! /bin/sh # mkinstalldirs --- make directory hierarchy -# Author: Noah Friedman + +scriptversion=2004-02-15.20 + +# Original author: Noah Friedman # Created: 1993-05-16 -# Public domain +# Public domain. +# +# This file is maintained in Automake, please report +# bugs to or send patches to +# . errstatus=0 dirmode="" usage="\ -Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..." +Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ... + +Create each directory DIR (with mode MODE, if specified), including all +leading file name components. + +Report bugs to ." # process command line arguments while test $# -gt 0 ; do case $1 in -h | --help | --h*) # -h for help - echo "$usage" 1>&2 + echo "$usage" exit 0 ;; -m) # -m PERM arg @@ -23,6 +35,10 @@ while test $# -gt 0 ; do dirmode=$1 shift ;; + --version) + echo "$0 $scriptversion" + exit 0 + ;; --) # stop option processing shift break @@ -50,17 +66,37 @@ case $# in 0) exit 0 ;; esac +# Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and +# mkdir -p a/c at the same time, both will detect that a is missing, +# one will create a, then the other will try to create a and die with +# a "File exists" error. This is a problem when calling mkinstalldirs +# from a parallel make. We use --version in the probe to restrict +# ourselves to GNU mkdir, which is thread-safe. case $dirmode in '') - if mkdir -p -- . 2>/dev/null; then + if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then echo "mkdir -p -- $*" exec mkdir -p -- "$@" + else + # On NextStep and OpenStep, the `mkdir' command does not + # recognize any option. It will interpret all options as + # directories to create, and then abort because `.' already + # exists. + test -d ./-p && rmdir ./-p + test -d ./--version && rmdir ./--version fi ;; *) - if mkdir -m "$dirmode" -p -- . 2>/dev/null; then + if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 && + test ! -d ./--version; then echo "mkdir -m $dirmode -p -- $*" exec mkdir -m "$dirmode" -p -- "$@" + else + # Clean up after NextStep and OpenStep mkdir. + for d in ./-m ./-p ./--version "./$dirmode"; + do + test -d $d && rmdir $d + done fi ;; esac @@ -84,17 +120,17 @@ do mkdir "$pathcomp" || lasterr=$? if test ! -d "$pathcomp"; then - errstatus=$lasterr + errstatus=$lasterr else - if test ! -z "$dirmode"; then + if test ! -z "$dirmode"; then echo "chmod $dirmode $pathcomp" - lasterr="" - chmod "$dirmode" "$pathcomp" || lasterr=$? + lasterr="" + chmod "$dirmode" "$pathcomp" || lasterr=$? - if test ! -z "$lasterr"; then - errstatus=$lasterr - fi - fi + if test ! -z "$lasterr"; then + errstatus=$lasterr + fi + fi fi fi @@ -107,5 +143,8 @@ exit $errstatus # 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: -# mkinstalldirs ends here diff --git a/node.c b/node.c index 05b258b5d..4ef76e328 100644 --- a/node.c +++ b/node.c @@ -3,7 +3,7 @@ */ /* - * Copyright (C) 1986, 1988, 1989, 1991-2001, 2003 the Free Software Foundation, Inc. + * Copyright (C) 1986, 1988, 1989, 1991-2001, 2003, 2004 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. @@ -187,6 +187,8 @@ format_val(const char *format, int index, register NODE *s) s->flags = oflags; s->stfmt = (char) index; s->stlen = r->stlen; + if ((s->flags & STRCUR) != 0) + free(s->stptr); s->stptr = r->stptr; freenode(r); /* Do not free_temp(r)! We want */ freenode(dummy); /* to keep s->stptr == r->stpr. */ diff --git a/patchlev.h b/patchlev.h deleted file mode 100644 index 787e79373..000000000 --- a/patchlev.h +++ /dev/null @@ -1 +0,0 @@ -#define PATCHLEVEL "3" diff --git a/pc/ChangeLog b/pc/ChangeLog index 29ed6ce5d..545a2945b 100644 --- a/pc/ChangeLog +++ b/pc/ChangeLog @@ -1,3 +1,34 @@ +Mon Aug 2 12:18:15 2004 Arnold D. Robbins + + * Release 3.1.4: Release tar file made. + +Sun Jun 13 17:40:09 2004 Scott Deifik + + * Makefile: Reduce the stack size for MSC. + * Makefile.tst: Synchronized with main distribution. + +Sun Jun 13 17:39:47 2004 Arnold D. Robbins + + * Makefile (AWKOBJS2, PAWKOBJS2): Restore version.o. + +Tue Jun 1 22:31:36 2004 Arnold D. Robbins + + * Makefile (AWKOBJS2, PAWKOBJS2): Remove version.o. + + Per Jim Meyering: + * popen.c (scriptify): Check `realloc' return value. + +Tue Mar 2 18:10:55 2004 Arnold D. Robbins + + * Makefile (LIBOJBS): Add `dfa$O' into list. + (main$O rule): Removed, since patchlev.h not part of dist + anymore. + +Tue Mar 2 18:09:54 2004 Scott Deifik + + * config.h (HAVE_ALLOCA_H): Undefine. + * Makefile (LMSC): Adjust stack size for MSC. + Mon Jul 7 11:01:43 2003 Arnold D. Robbins * Release 3.1.3: Release tar file made. @@ -131,7 +162,7 @@ Sun Jan 28 15:50:02 2001 Eli Zaretskii Wed Jan 17 10:59:32 2001 Eli Zaretskii - * gawkmisc.pc (os_close_on_exec) [__DJGPP__]: Don't print the + * gawkmisc.pc (os_close_on_exec) [__DJGPP__]: Don't print the warning about failure to set close-on-exec bit, unless it's DJGPP 2.04 or later. @@ -230,8 +261,8 @@ Thu Nov 12 21:01:24 1998 Darrel Hankerson omitted from 3.0.3. * README.pc updated to clarify the procedure for building - non-LFN versions on LFN systems, and to note that Windows32 gawk - may require Windows32 utilities. + non-LFN versions on LFN systems, and to note that Windows32 gawk + may require Windows32 utilities. * emxbnd target modified to accomodate older versions of emx. @@ -247,7 +278,7 @@ Thu May 15 12:49:08 1997 Arnold D. Robbins * Release 3.0.3: Release tar file made. -Tues May 13 20:06:09 1997 Darrel Hankerson +Tue May 13 20:06:09 1997 Darrel Hankerson * vcWin32 target added. Some new tests for WIN32 in gawkmisc.c io.c, and regex.c. Makefile changes for nmake, which can't diff --git a/pc/Makefile b/pc/Makefile index db5febf95..22b04cc70 100644 --- a/pc/Makefile +++ b/pc/Makefile @@ -214,7 +214,8 @@ MSCCL = -FPi #MSCCL = -FPc # If the stack gets much smaller than 3000, the "longwrds" test fails. -LMSC = link $(LF) $(LNKRSP) $(STDARGV)/NOE,$@,,/NOD:llibce $(MSCLIB)$(LF2)/STACK:0x4320,nul +LMSC = link $(LF) $(LNKRSP) $(STDARGV)/NOE,$@,,/NOD:llibce $(MSCLIB)$(LF2)/STACK:0x3299,nul + # CLMSC-linking works when building under OS/2 CLMSC = $(CC) -o $@ $(LF) $(GAWKOBJS) $(STDARGV) $(LF2) -link /NOE/NOI/STACK:0x6f00 @@ -322,7 +323,7 @@ ALLOBJS = $(AWKOBJS) awkgram$O getid$O $(OBJ) # LIBOBJS # GNU and other stuff that gawk uses as library routines. -LIBOBJS= getopt$O getopt1$O regex$O random$O +LIBOBJS= getopt$O getopt1$O dfa$O regex$O random$O GAWKOBJS = $(ALLOBJS) $(LIBOBJS) PGAWKOBJS = $(PAWKOBJS1) $(PAWKOBJS2) $(LIBOBJS) awkgram$O getid$O $(OBJ) @@ -366,8 +367,6 @@ getopt1$O: getopt.h gawk.exp: gawkw32.def $(DYN_MAKEXP) -main$O: patchlev.h - eval_p$O: eval.c profile_p$O: profile.c diff --git a/pc/Makefile.tst b/pc/Makefile.tst index 4a61d28d1..df712d5df 100644 --- a/pc/Makefile.tst +++ b/pc/Makefile.tst @@ -1,6 +1,6 @@ # Makefile for GNU Awk test suite. # -# Copyright (C) 1988-2003 the Free Software Foundation, Inc. +# Copyright (C) 1988-2004 the Free Software Foundation, Inc. # # This file is part of GAWK, the GNU implementation of the # AWK Programming Language. @@ -116,13 +116,13 @@ BASIC_TESTS = addcomma anchgsub argarray arrayparm arrayref arrymem1 \ arrayprm2 arrayprm3 arryref2 arryref3 arryref4 arryref5 arynasty \ arynocls aryprm1 aryprm2 aryprm3 aryprm4 aryprm5 aryprm6 aryprm7 \ aryprm8 arysubnm asgext awkpath back89 backgsub childin clobber \ - clsflnam compare compare2 concat1 convfmt datanonl defref \ - delarprm delarpm2 dynlj eofsplit fldchg fldchgnf fmttest fnamedat \ + clsflnam compare compare2 concat1 concat2 concat3 convfmt datanonl defref \ + delarprm delarpm2 delfunc dynlj eofsplit exitval1 fldchg fldchgnf fmttest fnamedat \ fnarray fnarray2 fnarydel fnaryscl fnasgnm fnmisc fnparydl \ - forsimp fsbs fsrs fstabplus funsemnl funsmnam funstack getline \ + fordel forsimp fsbs fsrs fstabplus funsemnl funsmnam funstack getline \ getline2 getline3 getlnbuf getnr2tb getnr2tm gsubasgn gsubtest \ gsubtst2 gsubtst3 gsubtst4 gsubtst5 hsprint inputred intest \ - intprec leaddig leadnl litoct longsub longwrds math membug1 \ + intprec leaddig leadnl litoct longsub longwrds manglprm math membug1 \ messages minusstr mmap8k nasty nasty2 negexp nested nfldstr \ nfneg nfset nlfldsep nlinstr nlstrina noeffect nofmtch noloop1 \ noloop2 nonl noparms nors nulrsend numindex numsubstr octsub ofmt \ @@ -132,20 +132,16 @@ BASIC_TESTS = addcomma anchgsub argarray arrayparm arrayref arrymem1 \ reindops reparse resplit rs rsnul1nl rsnulbig rsnulbig2 rstest1 \ rstest2 rstest3 rstest4 rstest5 rswhite scalar sclforin sclifin \ sortempty splitargv splitarr splitdef splitvar splitwht sprintfc \ - strtod subslash substr swaplns synerr1 tradanch tweakfld uninit2 \ - uninit3 uninit4 uninitialized zeroe0 zeroflag - - -UNIX_TESTS = fflush getlnhd pid pipeio1 pipeio2 poundbang poundbang2 space strftlng - -GAWK_EXT_TESTS = argtest asort asorti badargs clos1way fieldwdth fsfwfs \ - gensub gnuops2 gnureops icasefs icasers igncdym igncfs ignrcase lint \ - match1 match2 manyfiles nondec posix procinfs regx8bit rebuf reint \ - shadow sort1 strtonum strftime whiny + strcat1 strtod subamp subsepnm subslash substr swaplns synerr1 tradanch \ + tweakfld uninit2 uninit3 uninit4 uninitialized unterm zeroe0 zeroflag +UNIX_TESTS = fflush getlnhd pid pipeio1 pipeio2 poundbang space strftlng +GAWK_EXT_TESTS = argtest asort asorti backw badargs clos1way fieldwdth fsfwfs \ + gensub gnuops2 gnureops icasefs icasers igncdym igncfs ignrcase \ + ignrcas2 lint match1 match2 manyfiles nondec posix procinfs \ + printfbad1 regx8bit rebuf reint shadow sort1 strtonum strftime whiny EXTRA_TESTS = regtest inftest - INET_TESTS = inetechu inetecht inetdayu inetdayt # List of the tests which should be run with --lint option: @@ -158,6 +154,7 @@ GENTESTS_UNUSED = Makefile.in gtlnbufv.awk printfloat.awk switch2.awk # Make the pass-fail last and dependent on others to avoid # spurious errors if `make -j' in effect. check: msg \ + printlang \ basic-msg-start basic basic-msg-end \ unix-msg-start unix-tests unix-msg-end \ extend-msg-start gawk-extensions extend-msg-end \ @@ -181,6 +178,9 @@ msg:: @echo 'some systems may omit a leading zero and the floating point' @echo 'precision may lead to slightly different output in a few cases.' +printlang:: + @$(AWK) -f $(srcdir)/printlang.awk + basic-msg-start: @echo "======== Starting basic tests ========" @@ -213,17 +213,13 @@ poundbang:: else \ sed "s;/tmp/gawk;../$(AWKPROG);" < $(srcdir)/poundbang.awk > ./_pbd.awk ; \ chmod +x ./_pbd.awk ; \ - ./_pbd.awk $(srcdir)/poundbang.awk > _`basename $@`; \ + LC_ALL=$${GAWKLOCALE:-C} LANG=$${GAWKLOCALE:-C} ./_pbd.awk $(srcdir)/poundbang.awk > _`basename $@`; \ fi @-$(CMP) $(srcdir)/poundbang.awk _`basename $@` && rm -f _`basename $@` _pbd.awk -poundbang2: - @echo $@ - @LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 make poundbang - messages:: @echo $@ - @LC_ALL=C LANG=C $(AWK) -f $(srcdir)/messages.awk >out2 2>out3 + @$(AWK) -f $(srcdir)/messages.awk >out2 2>out3 @-$(CMP) $(srcdir)/out1.ok out1 && $(CMP) $(srcdir)/out2.ok out2 && $(CMP) $(srcdir)/out3.ok out3 && rm -f out1 out2 out3 argarray:: @@ -232,7 +228,7 @@ argarray:: .) : ;; \ *) cp $(srcdir)/argarray.in . ;; \ esac - @TEST=test echo just a test | LC_ALL=C LANG=C $(AWK) -f $(srcdir)/argarray.awk ./argarray.in - >_$@ + @TEST=test echo just a test | $(AWK) -f $(srcdir)/argarray.awk ./argarray.in - >_$@ @case $(srcdir) in \ .) : ;; \ *) rm -f ./argarray.in ;; \ @@ -250,95 +246,96 @@ manyfiles:: @rm -rf junk @mkdir junk @$(AWK) 'BEGIN { for (i = 1; i <= 300; i++) print i, i}' >_$@ - @LC_ALL=C LANG=C $(AWK) -f $(srcdir)/manyfiles.awk _$@ _$@ - @wc -l junk/* | $(AWK) '$$1 != 2' | wc -l | sed 's/ *//g' > _$@ + @$(AWK) -f $(srcdir)/manyfiles.awk _$@ _$@ + @wc -l junk/* | $(AWK) '$$1 != 2' | wc -l | sed "s/ *//g" > _$@ @rm -rf junk ; $(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ compare:: @echo $@ - @LC_ALL=C LANG=C $(AWK) -f $(srcdir)/compare.awk 0 1 $(srcdir)/compare.in >_$@ + @$(AWK) -f $(srcdir)/compare.awk 0 1 $(srcdir)/compare.in >_$@ @-$(CMP) $(srcdir)/compare.ok _$@ && rm -f _$@ inftest:: @echo $@ @echo This test is very machine specific... - @echo 'Both MSC 7.0 and 8.0 gawk generate a floating point exception.' - @echo 'EMX gawk uses #INF rather than Inf.' - @LC_ALL=C LANG=C $(AWK) -f $(srcdir)/inftest.awk | sed 's/inf/Inf/g' >_$@ - @-$(CMP) $(srcdir)/inftest.ok _$@ && rm -f _$@ + @echo This sometimes seems to cause problems for MSC gawk, so do not + @echo run it. +# @$(AWK) -f $(srcdir)/inftest.awk | sed "s/inf/Inf/g" >_$@ +# @-$(CMP) $(srcdir)/inftest.ok _$@ && rm -f _$@ getline2:: @echo $@ - @LC_ALL=C LANG=C $(AWK) -f $(srcdir)/getline2.awk $(srcdir)/getline2.awk $(srcdir)/getline2.awk >_$@ + @$(AWK) -f $(srcdir)/getline2.awk $(srcdir)/getline2.awk $(srcdir)/getline2.awk >_$@ @-$(CMP) $(srcdir)/getline2.ok _$@ && rm -f _$@ awkpath:: @echo $@ - @LC_ALL=C LANG=C AWKPATH="$(srcdir)$(PATH_SEPARATOR)$(srcdir)/lib" $(AWK) -f awkpath.awk >_$@ + @AWKPATH="$(srcdir)$(PATH_SEPARATOR)$(srcdir)/lib" $(AWK) -f awkpath.awk >_$@ @-$(CMP) $(srcdir)/awkpath.ok _$@ && rm -f _$@ argtest:: @echo $@ - @LC_ALL=C LANG=C $(AWK) -f $(srcdir)/argtest.awk -x -y abc >_$@ + @$(AWK) -f $(srcdir)/argtest.awk -x -y abc >_$@ @-$(CMP) $(srcdir)/argtest.ok _$@ && rm -f _$@ badargs:: @echo $@ - @-LC_ALL=C LANG=C $(AWK) -f 2>&1 | grep -v patchlevel >_$@ + @-$(AWK) -f 2>&1 | grep -v patchlevel >_$@ @-$(CMP) $(srcdir)/badargs.ok _$@ && rm -f _$@ nonl:: @echo $@ -# @-LC_ALL=C LANG=C AWKPATH=$(srcdir) $(AWK) --lint -f nonl.awk /dev/null >_$@ 2>&1 - @-LC_ALL=C LANG=C AWKPATH=$(srcdir) $(AWK) --lint -f nonl.awk NUL >_$@ 2>&1 + @-AWKPATH=$(srcdir) $(AWK) --lint -f nonl.awk /dev/null >_$@ 2>&1 @-$(CMP) $(srcdir)/nonl.ok _$@ && rm -f _$@ strftime:: @echo This test could fail on slow machines or on a minute boundary, @echo so if it does, double check the actual results: @echo $@ - @LC_ALL=C; export LC_ALL; LANG=C; export LANG; \ +# @GAWK_LOCALE=C; export GAWK_LOCALE; \ +# TZ=GMT0; export TZ; \ +# (LC_ALL=C date) | $(AWK) -v OUTPUT=_$@ -f $(srcdir)/strftime.awk + @GAWK_LOCALE=C; export GAWK_LOCALE; \ TZ=GMT0; export TZ; \ - date | $(AWK) -v OUTPUT=_$@ -f $(srcdir)/strftime.awk + (LC_ALL=C $(DATE)) | $(AWK) -v OUTPUT=_$@ -f $(srcdir)/strftime.awk @-$(CMP) strftime.ok _$@ && rm -f _$@ strftime.ok || exit 0 litoct:: @echo $@ - @echo ab | LC_ALL=C LANG=C $(AWK) --traditional -f $(srcdir)/litoct.awk >_$@ + @echo ab | $(AWK) --traditional -f $(srcdir)/litoct.awk >_$@ @-$(CMP) $(srcdir)/litoct.ok _$@ && rm -f _$@ fflush:: @echo $@ - @LC_ALL=C LANG=C $(srcdir)/fflush.sh >_$@ + @$(srcdir)/fflush.sh >_$@ @-$(CMP) $(srcdir)/fflush.ok _$@ && rm -f _$@ tweakfld:: @echo $@ - @LC_ALL=C LANG=C $(AWK) -f $(srcdir)/tweakfld.awk $(srcdir)/tweakfld.in >_$@ + @$(AWK) -f $(srcdir)/tweakfld.awk $(srcdir)/tweakfld.in >_$@ @rm -f errors.cleanup @-$(CMP) $(srcdir)/tweakfld.ok _$@ && rm -f _$@ mmap8k:: @echo $@ - @LC_ALL=C LANG=C $(AWK) '{ print }' $(srcdir)/mmap8k.in >_$@ + @$(AWK) '{ print }' $(srcdir)/mmap8k.in >_$@ @-$(CMP) $(srcdir)/mmap8k.in _$@ && rm -f _$@ tradanch:: @echo $@ - @LC_ALL=C LANG=C $(AWK) --traditional -f $(srcdir)/tradanch.awk $(srcdir)/tradanch.in >_$@ + @$(AWK) --traditional -f $(srcdir)/tradanch.awk $(srcdir)/tradanch.in >_$@ @-$(CMP) $(srcdir)/tradanch.ok _$@ && rm -f _$@ # AIX /bin/sh exec's the last command in a list, therefore issue a ":" # command so that pid.sh is fork'ed as a child before being exec'ed. pid:: @echo pid - @AWKPATH=$(srcdir) AWK=$(AWKPROG) LC_ALL=C LANG=C $(SHELL) $(srcdir)/pid.sh $$$$ > _`basename $@` ; : - @echo 'Expect pid to fail in DOS.' + @AWKPATH=$(srcdir) AWK=$(AWKPROG) $(SHELL) $(srcdir)/pid.sh $$$$ > _`basename $@` ; : @-$(CMP) $(srcdir)/pid.ok _`basename $@` && rm -f _`basename $@` _`basename $@`.in strftlng:: @echo $@ - @TZ=UTC; export TZ; LC_ALL=C LANG=C $(AWK) -f $(srcdir)/strftlng.awk >_$@ + @TZ=UTC; export TZ; $(AWK) -f $(srcdir)/strftlng.awk >_$@ @if $(CMP) -s $(srcdir)/strftlng.ok _$@ ; then : ; else \ TZ=UTC0; export TZ; $(AWK) -f $(srcdir)/strftlng.awk >_$@ ; \ fi @@ -351,42 +348,41 @@ nors:: reint:: @echo $@ - @LC_ALL=C LANG=C $(AWK) --re-interval -f $(srcdir)/reint.awk $(srcdir)/reint.in >_$@ + @$(AWK) --re-interval -f $(srcdir)/reint.awk $(srcdir)/reint.in >_$@ @-$(CMP) $(srcdir)/reint.ok _$@ && rm -f _$@ pipeio1:: @echo $@ - @LC_ALL=C LANG=C $(AWK) -f $(srcdir)/pipeio1.awk >_$@ + @$(AWK) -f $(srcdir)/pipeio1.awk >_$@ @rm -f test1 test2 @-$(CMP) $(srcdir)/pipeio1.ok _$@ && rm -f _$@ pipeio2:: @echo $@ - @LC_ALL=C LANG=C $(AWK) -v SRCDIR=$(srcdir) -f $(srcdir)/pipeio2.awk >_$@ + @$(AWK) -v SRCDIR=$(srcdir) -f $(srcdir)/pipeio2.awk >_$@ @-$(CMP) $(srcdir)/pipeio2.ok _$@ && rm -f _$@ clobber:: @echo $@ - @LC_ALL=C LANG=C $(AWK) -f $(srcdir)/clobber.awk >_$@ + @$(AWK) -f $(srcdir)/clobber.awk >_$@ @-$(CMP) $(srcdir)/clobber.ok seq && $(CMP) $(srcdir)/clobber.ok _$@ && rm -f _$@ @rm -f seq arynocls:: @echo $@ - @-AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -v INPUT=$(srcdir)/arynocls.in -f arynocls.awk >_$@ + @-AWKPATH=$(srcdir) $(AWK) -v INPUT=$(srcdir)/arynocls.in -f arynocls.awk >_$@ @-$(CMP) $(srcdir)/arynocls.ok _$@ && rm -f _$@ getlnbuf:: @echo $@ - @-AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f getlnbuf.awk $(srcdir)/getlnbuf.in > _$@ - @-AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f gtlnbufv.awk $(srcdir)/getlnbuf.in > _2$@ + @-AWKPATH=$(srcdir) $(AWK) -f getlnbuf.awk $(srcdir)/getlnbuf.in > _$@ + @-AWKPATH=$(srcdir) $(AWK) -f gtlnbufv.awk $(srcdir)/getlnbuf.in > _2$@ @-$(CMP) $(srcdir)/getlnbuf.ok _$@ && $(CMP) $(srcdir)/getlnbuf.ok _2$@ && rm -f _$@ _2$@ inetmesg:: @echo These tests only work if your system supports the services @echo "'discard'" at port 9 and "'daytimed'" at port 13. Check your @echo file /etc/services and do "'netstat -a'". - @echo Expect inet tests to fail with MSC and DJGPP because "|&" is not supported. inetechu:: @echo This test is for establishing UDP connections @@ -408,28 +404,27 @@ inetdayt:: redfilnm:: @echo $@ - @LC_ALL=C LANG=C $(AWK) -f $(srcdir)/redfilnm.awk srcdir=$(srcdir) $(srcdir)/redfilnm.in >_$@ + @$(AWK) -f $(srcdir)/redfilnm.awk srcdir=$(srcdir) $(srcdir)/redfilnm.in >_$@ @-$(CMP) $(srcdir)/redfilnm.ok _$@ && rm -f _$@ leaddig:: @echo $@ - @LC_ALL=C LANG=C $(AWK) -v x=2E -f $(srcdir)/leaddig.awk >_$@ + @$(AWK) -v x=2E -f $(srcdir)/leaddig.awk >_$@ @-$(CMP) $(srcdir)/leaddig.ok _$@ && rm -f _$@ gsubtst3:: @echo $@ - @LC_ALL=C LANG=C $(AWK) --re-interval -f $(srcdir)/$@.awk $(srcdir)/$@.in >_$@ + @$(AWK) --re-interval -f $(srcdir)/$@.awk $(srcdir)/$@.in >_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ space:: @echo $@ - @echo 'Expect space to fail with DJGPP.' - @LC_ALL=C LANG=C $(AWK) -f ' ' $(srcdir)/space.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @$(AWK) -f ' ' $(srcdir)/space.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ printf0:: @echo $@ - @LC_ALL=C LANG=C $(AWK) --posix -f $(srcdir)/$@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @$(AWK) --posix -f $(srcdir)/$@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ rsnulbig:: @@ -453,822 +448,879 @@ whiny:: @WHINY_USERS=1 $(AWK) -f $(srcdir)/$@.awk $(srcdir)/$@.in >_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +ignrcas2:: + @echo $@ + @GAWK_LOCALE=en_US ; export GAWK_LOCALE ; \ + $(AWK) -f $(srcdir)/$@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >> _$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +subamp:: + @echo $@ + @GAWK_LOCALE=en_US.UTF-8 ; export GAWK_LOCALE ; \ + $(AWK) -f $(srcdir)/$@.awk $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >> _$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +# This test makes sure gawk exits with a zero code. +# Thus, unconditionally generate the exit code. +exitval1:: + @echo $@ + @$(AWK) -f $(srcdir)/exitval1.awk >_$@ 2>&1; echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ Gt-dummy: # file Maketests, generated from Makefile.am by the Gentests program addcomma: @echo addcomma - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ anchgsub: @echo anchgsub - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ arrayparm: @echo arrayparm - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ arrayref: @echo arrayref - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ arrymem1: @echo arrymem1 - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ arrayprm2: @echo arrayprm2 - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ arrayprm3: @echo arrayprm3 - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ arryref2: @echo arryref2 - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ arryref3: @echo arryref3 - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ arryref4: @echo arryref4 - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ arryref5: @echo arryref5 - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ arynasty: @echo arynasty - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ aryprm1: @echo aryprm1 - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ aryprm2: @echo aryprm2 - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ aryprm3: @echo aryprm3 - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ aryprm4: @echo aryprm4 - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ aryprm5: @echo aryprm5 - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ aryprm6: @echo aryprm6 - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ aryprm7: @echo aryprm7 - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ aryprm8: @echo aryprm8 - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ arysubnm: @echo arysubnm - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ asgext: @echo asgext - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ back89: @echo back89 - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ backgsub: @echo backgsub - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ childin: @echo childin - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ clsflnam: @echo clsflnam - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ compare2: @echo compare2 - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ concat1: @echo concat1 - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +concat2: + @echo concat2 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +concat3: + @echo concat3 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ convfmt: @echo convfmt - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ datanonl: @echo datanonl - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ defref: @echo defref - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ delarprm: @echo delarprm - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ delarpm2: @echo delarpm2 - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +delfunc: + @echo delfunc + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ dynlj: @echo dynlj - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ eofsplit: @echo eofsplit - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ fldchg: @echo fldchg - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ fldchgnf: @echo fldchgnf - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ fmttest: @echo fmttest - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ fnamedat: @echo fnamedat - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ fnarray: @echo fnarray - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ fnarray2: @echo fnarray2 - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ fnarydel: @echo fnarydel - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ fnaryscl: @echo fnaryscl - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ fnasgnm: @echo fnasgnm - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ fnmisc: @echo fnmisc - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ fnparydl: @echo fnparydl - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +fordel: + @echo fordel + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ forsimp: @echo forsimp - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ fsbs: @echo fsbs - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ fsrs: @echo fsrs - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ fstabplus: @echo fstabplus - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ funsemnl: @echo funsemnl - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ funsmnam: @echo funsmnam - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ funstack: @echo funstack - @echo 'Expect funstack to fail with MSC DOS versions.' - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ getline: @echo getline - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ getline3: @echo getline3 - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ getnr2tb: @echo getnr2tb - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ getnr2tm: @echo getnr2tm - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ gsubasgn: @echo gsubasgn - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ gsubtest: @echo gsubtest - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ gsubtst2: @echo gsubtst2 - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ gsubtst4: @echo gsubtst4 - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ gsubtst5: @echo gsubtst5 - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ hsprint: @echo hsprint - @echo 'hsprint may fail due to 1.27e+01 not being equal to' - @echo '1.27e+001 (and similarly for other numbers) for MSC gawk.' - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ inputred: @echo inputred - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ intest: @echo intest - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ intprec: @echo intprec - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ leadnl: @echo leadnl - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ longsub: @echo longsub - @echo 'Expect longsub to fail with MSC DOS versions.' - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ longwrds: @echo longwrds - @echo "longwrds may run out of environment space with MSC DOS versions." - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +manglprm: + @echo manglprm + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ math: @echo math - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ membug1: @echo membug1 - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ minusstr: @echo minusstr - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ nasty: @echo nasty - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ nasty2: @echo nasty2 - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ negexp: @echo negexp - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ nested: @echo nested - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ nfldstr: @echo nfldstr - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ nfneg: @echo nfneg - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ nfset: @echo nfset - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ nlfldsep: @echo nlfldsep - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ nlinstr: @echo nlinstr - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ nlstrina: @echo nlstrina - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ noeffect: @echo noeffect - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ nofmtch: @echo nofmtch - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ noloop1: @echo noloop1 - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ noloop2: @echo noloop2 - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ noparms: @echo noparms - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ nulrsend: @echo nulrsend - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ numindex: @echo numindex - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ numsubstr: @echo numsubstr - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ octsub: @echo octsub - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ ofmt: @echo ofmt - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ ofmtbig: @echo ofmtbig - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ ofmtfidl: @echo ofmtfidl - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ ofmts: @echo ofmts - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ onlynl: @echo onlynl - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ opasnidx: @echo opasnidx - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ opasnslf: @echo opasnslf - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ paramdup: @echo paramdup - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ paramtyp: @echo paramtyp - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ parseme: @echo parseme - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ pcntplus: @echo pcntplus - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ prdupval: @echo prdupval - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ prec: @echo prec - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ printf1: @echo printf1 - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ prmarscl: @echo prmarscl - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ prmreuse: @echo prmreuse - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ prt1eval: @echo prt1eval - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ prtoeval: @echo prtoeval - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ psx96sub: @echo psx96sub - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ rand: @echo rand - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ rebt8b1: @echo rebt8b1 - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ rebt8b2: @echo rebt8b2 - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ regeq: @echo regeq - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ reindops: @echo reindops - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ reparse: @echo reparse - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ resplit: @echo resplit - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ rs: @echo rs - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ rsnul1nl: @echo rsnul1nl - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ rstest1: @echo rstest1 - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ rstest2: @echo rstest2 - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ rstest3: @echo rstest3 - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ rstest4: @echo rstest4 - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ rstest5: @echo rstest5 - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ rswhite: @echo rswhite - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ scalar: @echo scalar - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ sclforin: @echo sclforin - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ sclifin: @echo sclifin - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ sortempty: @echo sortempty - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ splitargv: @echo splitargv - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ splitarr: @echo splitarr - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ splitdef: @echo splitdef - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ splitvar: @echo splitvar - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ splitwht: @echo splitwht - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ sprintfc: @echo sprintfc - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +strcat1: + @echo strcat1 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ strtod: @echo strtod - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +subsepnm: + @echo subsepnm + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ subslash: @echo subslash - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ substr: @echo substr - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ swaplns: @echo swaplns - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ synerr1: @echo synerr1 - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ uninit2: @echo uninit2 - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ uninit3: @echo uninit3 - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ uninit4: @echo uninit4 - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ uninitialized: @echo uninitialized - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +unterm: + @echo unterm + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ zeroe0: @echo zeroe0 - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ zeroflag: @echo zeroflag - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ getlnhd: @echo getlnhd - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ asort: @echo asort - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ asorti: @echo asorti - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +backw: + @echo backw + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ clos1way: @echo clos1way - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ - @echo Expect clos1way to fail with MSC and DJGPP because "|&" is not supported. fieldwdth: @echo fieldwdth - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ fsfwfs: @echo fsfwfs - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ gensub: @echo gensub - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ gnuops2: @echo gnuops2 - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ gnureops: @echo gnureops - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ icasefs: @echo icasefs - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ icasers: @echo icasers - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ igncdym: @echo igncdym - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ igncfs: @echo igncfs - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ ignrcase: @echo ignrcase - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ lint: @echo lint - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ match1: @echo match1 - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ match2: @@ -1278,44 +1330,47 @@ match2: nondec: @echo nondec - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ posix: @echo posix - @echo 'posix test may fail due to 1.500000e+000 not being equal to' - @echo '1.500000e+00 for MSC gawk.' - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ procinfs: @echo procinfs - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +printfbad1: + @echo printfbad1 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ regx8bit: @echo regx8bit - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ rebuf: @echo rebuf - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ shadow: @echo shadow - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ sort1: @echo sort1 - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ strtonum: @echo strtonum - @AWKPATH=$(srcdir) LC_ALL=C LANG=C $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ # end of file Maketests @@ -1341,7 +1396,7 @@ diffout: for i in _* ; \ do \ echo ============== $$i ============= ; \ - diff -c $${i#_}.ok $$i ; \ + diff -c $(srcdir)/$${i#_}.ok $$i ; \ done | more # This target is for testing with electric fence. diff --git a/pc/config.h b/pc/config.h index 01893676b..047417c0b 100644 --- a/pc/config.h +++ b/pc/config.h @@ -5,7 +5,7 @@ */ /* - * Copyright (C) 1995-2002 the Free Software Foundation, Inc. + * Copyright (C) 1995-2004 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. @@ -62,7 +62,7 @@ #define HAVE_ALLOCA 1 /* Define if you have and it should be used (not on Ultrix). */ -#define HAVE_ALLOCA_H 1 +/* #undef HAVE_ALLOCA_H */ /* Define if you don't have vprintf but do have _doprnt. */ /* #undef HAVE_DOPRNT */ diff --git a/pc/gawkmisc.pc b/pc/gawkmisc.pc index b34dc947a..6f81c1447 100644 --- a/pc/gawkmisc.pc +++ b/pc/gawkmisc.pc @@ -255,7 +255,7 @@ os_is_setuid() static int orig_tty_mode = -1; int -os_setbinmode (fd, mode) +os_setbinmode(fd, mode) int fd, mode; { int prev_mode = setmode(fd, mode); diff --git a/pc/gawkw32.def b/pc/gawkw32.def index 5a0e3227b..68c1118a2 100644 --- a/pc/gawkw32.def +++ b/pc/gawkw32.def @@ -9,6 +9,7 @@ EXPORTS get_argument @1 set_value @2 make_builtin @3 +get_curfunc_arg_count @4 ;; functions for manipulating data types mk_number @11 diff --git a/pc/popen.c b/pc/popen.c index 28e1ebd50..77cedc158 100644 --- a/pc/popen.c +++ b/pc/popen.c @@ -86,7 +86,10 @@ scriptify(char *command) } slashify(name, p); if (! (i = unixshell(p))) { - realloc(name, strlen(name) + 5); + char *p = (char *) realloc(name, strlen(name) + 5); + if (p == NULL) + return NULL; + name = p; strcat(name, ".bat"); } if (s) sprintf(cmd + strlen(cmd), " %cc ", unixshell(s) ? '-' : '/'); diff --git a/po/ChangeLog b/po/ChangeLog index 5b6336f64..f99acbef3 100644 --- a/po/ChangeLog +++ b/po/ChangeLog @@ -1,3 +1,16 @@ +Mon Aug 2 12:18:15 2004 Arnold D. Robbins + + * Release 3.1.4: Release tar file made. + +2004-02-19 gettextize + + * Makefile.in.in: Upgrade to gettext-0.14.1. + * Rules-quot: Upgrade to gettext-0.14.1. + +2004-01-16 gettextize + + * Makefile.in.in: Upgrade to gettext-0.13.1. + Mon Jul 7 11:01:43 2003 Arnold D. Robbins * Release 3.1.3: Release tar file made. diff --git a/po/LINGUAS b/po/LINGUAS index 2d9b51e1e..8bcb16363 100644 --- a/po/LINGUAS +++ b/po/LINGUAS @@ -8,3 +8,6 @@ de da pt_BR ca +pl +ja +ro diff --git a/po/Makefile.in.in b/po/Makefile.in.in index 27b721aa8..53efc5e16 100644 --- a/po/Makefile.in.in +++ b/po/Makefile.in.in @@ -1,5 +1,5 @@ # Makefile for PO directory in any package using GNU gettext. -# Copyright (C) 1995-1997, 2000-2003 by Ulrich Drepper +# Copyright (C) 1995-1997, 2000-2004 by Ulrich Drepper # # 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 @@ -7,6 +7,8 @@ # functionality. # Please note that the actual code of GNU gettext is covered by the GNU # General Public License and is *not* in the public domain. +# +# Origin: gettext-0.14 PACKAGE = @PACKAGE@ VERSION = @VERSION@ @@ -55,7 +57,7 @@ CATALOGS = @CATALOGS@ # Makevars gets inserted here. (Don't remove this line!) .SUFFIXES: -.SUFFIXES: .po .gmo .mo .sed .sin .nop .po-update +.SUFFIXES: .po .gmo .mo .sed .sin .nop .po-create .po-update .po.mo: @echo "$(MSGFMT) -c -o $@ $<"; \ @@ -86,7 +88,7 @@ all-no: # $(POFILES) has been designed to not touch files that don't need to be # changed. stamp-po: $(srcdir)/$(DOMAIN).pot - test -z "$(CATALOGS)" || $(MAKE) $(CATALOGS) + test -z "$(GMOFILES)" || $(MAKE) $(GMOFILES) @echo "touch stamp-po" @echo timestamp > stamp-poT @mv stamp-poT stamp-po @@ -128,9 +130,13 @@ $(srcdir)/$(DOMAIN).pot: # Note that a PO file is not touched if it doesn't need to be changed. $(POFILES): $(srcdir)/$(DOMAIN).pot @lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \ - test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ - echo "$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot"; \ - cd $(srcdir) && $(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot + if test -f "$(srcdir)/$${lang}.po"; then \ + test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ + echo "$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot"; \ + cd $(srcdir) && $(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot; \ + else \ + $(MAKE) $${lang}.po-create; \ + fi install: install-exec install-data @@ -310,6 +316,13 @@ update-po: Makefile test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES) $(MAKE) update-gmo +# General rule for creating PO files. + +.nop.po-create: + @lang=`echo $@ | sed -e 's/\.po-create$$//'`; \ + echo "File $$lang.po does not exist. If you are a translator, you can create it through 'msginit'." 1>&2; \ + exit 1 + # General rule for updating PO files. .nop.po-update: diff --git a/po/POTFILES.in b/po/POTFILES.in index a23ba31d1..807df3366 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -22,4 +22,3 @@ regcomp.c regex_internal.c regexec.c replace.c -version.c diff --git a/po/Rules-quot b/po/Rules-quot index 5f46d237d..9c2a995e3 100644 --- a/po/Rules-quot +++ b/po/Rules-quot @@ -4,6 +4,11 @@ DISTFILES.common.extra1 = quot.sed boldquot.sed en@quot.header en@boldquot.heade .SUFFIXES: .insert-header .po-update-en +en@quot.po-create: + $(MAKE) en@quot.po-update +en@boldquot.po-create: + $(MAKE) en@boldquot.po-update + en@quot.po-update: en@quot.po-update-en en@boldquot.po-update: en@boldquot.po-update-en diff --git a/po/ca.gmo b/po/ca.gmo index bed9a5af9..9dc12416f 100644 Binary files a/po/ca.gmo and b/po/ca.gmo differ diff --git a/po/ca.po b/po/ca.po index 1d7462718..d34daa2af 100644 --- a/po/ca.po +++ b/po/ca.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: gawk 3.1.31\n" "Report-Msgid-Bugs-To: arnold@skeeve.com\n" -"POT-Creation-Date: 2003-07-07 11:20-0700\n" +"POT-Creation-Date: 2004-07-15 13:02+0300\n" "PO-Revision-Date: 2003-05-07 21:13+0100\n" "Last-Translator: Antoni Bella Perez \n" "Language-Team: Catalan \n" @@ -16,56 +16,61 @@ msgstr "" "X-Generator: KBabel 1.0.1\n" #: array.c:112 +#, fuzzy, c-format +msgid "attempt to use function `%s' as an array" +msgstr "s'ha intentat usar la funció «%s» com a una matriu" + +#: array.c:115 #, c-format msgid "attempt to use scalar parameter `%s' as an array" msgstr "s'ha intentat usar un paràmetre escalar «%s» com a una matriu" -#: array.c:113 +#: array.c:118 #, c-format msgid "attempt to use scalar `%s' as array" msgstr "s'ha intentat usar la dada escalar «%s» com a una matriu" -#: array.c:151 +#: array.c:156 #, fuzzy, c-format msgid "from %s" msgstr "%s (de %s)" -#: array.c:506 +#: array.c:511 #, c-format msgid "reference to uninitialized element `%s[\"%s\"]'" msgstr "referència a un element sense valor inicial «%s[\"%s\"]»" -#: array.c:512 +#: array.c:517 #, c-format msgid "subscript of array `%s' is null string" msgstr "el subscript de la matriu «%s» és una cadena nul·la" -#: array.c:609 +#: array.c:621 #, c-format msgid "delete: index `%s' not in array `%s'" msgstr "delete: l'índex «%s» no està en la matriu «%s»" -#: array.c:769 +#: array.c:791 #, c-format msgid "%s: empty (null)\n" msgstr "%s: buit (nul)\n" -#: array.c:774 +#: array.c:796 #, c-format msgid "%s: empty (zero)\n" msgstr "%s: buit (zero)\n" -#: array.c:778 +#: array.c:800 #, c-format msgid "%s: table_size = %d, array_size = %d\n" msgstr "%s: mida_taula = %d, mida_matriu = %d\n" -#: array.c:807 +#: array.c:829 #, fuzzy, c-format msgid "%s: is parameter\n" msgstr "%s: és un paràmetre\n" -#: array.c:812 +#: array.c:834 #, c-format msgid "%s: array_ref to %s\n" msgstr "%s: ref_matriu a %s\n" @@ -92,484 +97,479 @@ msgstr "" "la constant d'expressió regular «/%s/» sembla un comentari en C, perà no ho " "és" -#: awkgram.y:340 awkgram.y:615 +#: awkgram.y:341 awkgram.y:619 msgid "statement may have no effect" msgstr "la declaració podria no tindre efecte" -#: awkgram.y:435 awkgram.y:455 +#: awkgram.y:436 awkgram.y:456 #, fuzzy, c-format msgid "`%s' used in %s action" msgstr "«next» és usat dintre de l'acció BEGIN o END" -#: awkgram.y:448 awkgram.y:451 +#: awkgram.y:449 awkgram.y:452 msgid "`nextfile' is a gawk extension" msgstr "«nextfile» és una extensió de gawk" -#: awkgram.y:465 +#: awkgram.y:466 msgid "`return' used outside function context" msgstr "«return» és usat fora del context d'una funció" -#: awkgram.y:504 +#: awkgram.y:508 msgid "plain `print' in BEGIN or END rule should probably be `print \"\"'" msgstr "" "el «print» simple en la regla BEGIN o END probablement ha de ser «print \"\"»" -#: awkgram.y:517 awkgram.y:524 +#: awkgram.y:521 awkgram.y:528 msgid "`delete array' is a gawk extension" msgstr "«delete array» és una extensió de gawk" -#: awkgram.y:532 awkgram.y:539 +#: awkgram.y:536 awkgram.y:543 #, fuzzy msgid "`delete(array)' is a non-portable tawk extension" msgstr "«delete array» és una extensió de gawk" -#: awkgram.y:583 +#: awkgram.y:587 #, c-format msgid "duplicate case values in switch body: %s" msgstr "" -#: awkgram.y:593 +#: awkgram.y:597 msgid "Duplicate `default' detected in switch body" msgstr "" -#: awkgram.y:681 +#: awkgram.y:686 msgid "multistage two-way pipelines don't work" msgstr "les canonades bidireccionals multi-etapes no funcionen" -#: awkgram.y:772 +#: awkgram.y:777 msgid "regular expression on right of assignment" msgstr "expressió regular a la dreta d'una assignació" -#: awkgram.y:782 +#: awkgram.y:800 msgid "regular expression on left of `~' or `!~' operator" msgstr "expressió regular a l'esquerra de l'operador «~» o «!~»" -#: awkgram.y:790 +#: awkgram.y:808 msgid "regular expression on right of comparison" msgstr "expressió regular a la derta de la comparació" -#: awkgram.y:857 +#: awkgram.y:875 msgid "non-redirected `getline' undefined inside END action" msgstr "«getline» no redirigit sense definir dintre de l'acció FINAL" -#: awkgram.y:884 +#: awkgram.y:902 msgid "call of `length' without parentheses is not portable" msgstr "la crida de «length» sense parèntesis no és portable" -#: awkgram.y:887 +#: awkgram.y:905 msgid "call of `length' without parentheses is deprecated by POSIX" msgstr "la crida de «length» sense parèntesis està desaprovada per POSIX" -#: awkgram.y:940 +#: awkgram.y:958 msgid "use of non-array as array" msgstr "" -#: awkgram.y:942 +#: awkgram.y:960 msgid "invalid subscript expression" msgstr "expressió de subscript no vàlida" -#: awkgram.y:1140 +#: awkgram.y:1158 #, fuzzy msgid "unexpected newline or end of string" msgstr "nova línia inesperada" -#: awkgram.y:1235 +#: awkgram.y:1254 msgid "empty program text on command line" msgstr "el text del programa en la línia de comandaments està buit" -#: awkgram.y:1292 +#: awkgram.y:1307 #, c-format msgid "can't open source file `%s' for reading (%s)" msgstr "no es pot obrir el fitxer font «%s» per a lectura (%s)" -#: awkgram.y:1327 +#: awkgram.y:1384 #, c-format msgid "can't read sourcefile `%s' (%s)" msgstr "no es pot llegir el fitxer font «%s» (%s)" -#: awkgram.y:1335 +#: awkgram.y:1392 #, c-format msgid "source file `%s' is empty" msgstr "el fitxer font «%s» està buit" -#: awkgram.y:1537 awkgram.y:1647 awkgram.y:1665 awkgram.y:2015 awkgram.y:2100 +#: awkgram.y:1590 awkgram.y:1700 awkgram.y:1718 awkgram.y:2068 awkgram.y:2153 msgid "source file does not end in newline" msgstr "el fitxer font no finalitza amb un retorn de carro" -#: awkgram.y:1601 +#: awkgram.y:1654 msgid "unterminated regexp ends with `\\' at end of file" msgstr "expressió regular sense finalitzar acaba amb «\\» al final del fitxer" -#: awkgram.y:1621 +#: awkgram.y:1674 msgid "unterminated regexp" msgstr "expressió regular sense finalitzar" -#: awkgram.y:1624 +#: awkgram.y:1677 msgid "unterminated regexp at end of file" msgstr "expressió regular sense finalitzar al final del fitxer" -#: awkgram.y:1691 +#: awkgram.y:1744 msgid "use of `\\ #...' line continuation is not portable" msgstr "l'ús de «\\ #...» com a continuació de línia no és portable" -#: awkgram.y:1703 +#: awkgram.y:1756 msgid "backslash not last character on line" msgstr "la barra invertida no és l'últim caràcter en la línia" -#: awkgram.y:1748 +#: awkgram.y:1801 msgid "POSIX does not allow operator `**='" msgstr "POSIX no permet l'operador «**=»" -#: awkgram.y:1750 +#: awkgram.y:1803 msgid "old awk does not support operator `**='" msgstr "l'antic awk no suporta l'operador «**=»" -#: awkgram.y:1759 +#: awkgram.y:1812 msgid "POSIX does not allow operator `**'" msgstr "POSIX no permet l'operador «**»" -#: awkgram.y:1761 +#: awkgram.y:1814 msgid "old awk does not support operator `**'" msgstr "l'antic awk no suporta l'operador «**=»" -#: awkgram.y:1792 +#: awkgram.y:1845 msgid "operator `^=' is not supported in old awk" msgstr "l'operador «^=» no està suportat en l'antic awk" -#: awkgram.y:1800 +#: awkgram.y:1853 msgid "operator `^' is not supported in old awk" msgstr "l'operador «^» no està suportat en l'antic awk" -#: awkgram.y:1884 awkgram.y:1901 +#: awkgram.y:1937 awkgram.y:1954 msgid "unterminated string" msgstr "cadena sense finalitzar" -#: awkgram.y:2061 +#: awkgram.y:2114 #, c-format msgid "invalid char '%c' in expression" msgstr "caràcter «%c» no vàlid en l'expressió" -#: awkgram.y:2121 +#: awkgram.y:2162 #, c-format msgid "`%s' is a gawk extension" msgstr "«%s» és una extensió de gawk" -#: awkgram.y:2124 +#: awkgram.y:2165 #, c-format msgid "`%s' is a Bell Labs extension" msgstr "«%s» és una extensió de Bell Labs" -#: awkgram.y:2127 +#: awkgram.y:2168 #, c-format msgid "POSIX does not allow `%s'" msgstr "POSIX no permet «%s»" -#: awkgram.y:2131 +#: awkgram.y:2172 #, c-format msgid "`%s' is not supported in old awk" msgstr "«%s» no està suportat en l'antic awk" -#: awkgram.y:2158 +#: awkgram.y:2198 msgid "`goto' considered harmful!\n" msgstr "«goto» se considera nefast!\n" -#: awkgram.y:2220 +#: awkgram.y:2260 #, c-format msgid "%d is invalid as number of arguments for %s" msgstr "%d no és vàlid com a nombre d'arguments per a %s" -#: awkgram.y:2239 awkgram.y:2242 +#: awkgram.y:2279 awkgram.y:2282 msgid "match: third argument is a gawk extension" msgstr "match: el tercer argument és una extensió de gawk" -#: awkgram.y:2255 +#: awkgram.y:2295 #, c-format msgid "%s: string literal as last arg of substitute has no effect" msgstr "%s: la cadena literal com a últim argument de substitució no té efecte" -#: awkgram.y:2258 +#: awkgram.y:2298 #, fuzzy, c-format msgid "%s third parameter is not a changeable object" msgstr "sub: el tercer argument no és un objecte intercanviable" -#: awkgram.y:2285 awkgram.y:2288 +#: awkgram.y:2325 awkgram.y:2328 msgid "close: second argument is a gawk extension" msgstr "close: el segon argument és una extensió de gawk" -#: awkgram.y:2298 +#: awkgram.y:2338 msgid "use of dcgettext(_\"...\") is incorrect: remove leading underscore" msgstr "" "l'ús de dcgettext(_\"...\") no és correcte: elimineu el guió baix inicial" -#: awkgram.y:2313 +#: awkgram.y:2353 #, fuzzy msgid "use of dcngettext(_\"...\") is incorrect: remove leading underscore" msgstr "" "l'ús de dcgettext(_\"...\") no és correcte: elimineu el guió baix inicial" -#: awkgram.y:2384 +#: awkgram.y:2424 #, c-format msgid "function `%s': parameter #%d, `%s', duplicates parameter #%d" msgstr "funció «%s»: paràmetre #%d, «%s», duplica al paràmetre #%d" -#: awkgram.y:2417 +#: awkgram.y:2457 #, c-format msgid "function `%s': parameter `%s' shadows global variable" msgstr "funció «%s»: paràmetre «%s» ofusca la variable global" -#: awkgram.y:2529 +#: awkgram.y:2569 #, c-format msgid "could not open `%s' for writing (%s)" msgstr "no es pot obrir «%s» per a escriptura (%s)" -#: awkgram.y:2530 profile.c:93 +#: awkgram.y:2570 profile.c:93 msgid "sending profile to standard error" msgstr "enviant el perfil a l'eixida d'error estàndard" -#: awkgram.y:2562 +#: awkgram.y:2602 #, c-format msgid "%s: close failed (%s)" msgstr "%s: tancament erroni (%s)" -#: awkgram.y:2684 +#: awkgram.y:2723 msgid "shadow_funcs() called twice!" msgstr "shadow_funcs() crida dos vegades!" -#: awkgram.y:2711 +#: awkgram.y:2750 msgid "there were shadowed variables." msgstr "" -#: awkgram.y:2784 +#: awkgram.y:2823 #, c-format msgid "function `%s': can't use function name as parameter name" msgstr "funció «%s»: no pot usar el nom de la funció com a paràmetre" -#: awkgram.y:2794 +#: awkgram.y:2833 #, c-format msgid "function name `%s' previously defined" msgstr "nom de la funció «%s» definida prèviament" -#: awkgram.y:2945 awkgram.y:2951 +#: awkgram.y:2984 awkgram.y:2990 #, c-format msgid "function `%s' called but never defined" msgstr "es crida a la funció «%s» però no s'ha definit" -#: awkgram.y:2954 +#: awkgram.y:2993 #, c-format msgid "function `%s' defined but never called" msgstr "es defineix la funció «%s» però no s'ha cridat mai" -#: awkgram.y:2981 +#: awkgram.y:3020 #, c-format msgid "regexp constant for parameter #%d yields boolean value" msgstr "" "l'expressió regular constant per al paràmetre #%d condueix a un valor booleà" -#: awkgram.y:2994 -#, c-format +#: awkgram.y:3033 +#, fuzzy, c-format msgid "" "function `%s' called with space between name and `(',\n" -"%s" +"or used as a variable or an array" msgstr "" "s'ha cridat a la funció «%s» amb espai entre el nom i el «(»,\n" "%s" -#: awkgram.y:2996 -#, fuzzy -msgid "or used as a variable or an array" -msgstr "no es pot usar el nom de la funció «%s» com a variable o matriu" - -#: builtin.c:137 +#: builtin.c:149 #, c-format msgid "%s to \"%s\" failed (%s)" msgstr "%s a \"%s\" ha fallat (%s)" -#: builtin.c:138 +#: builtin.c:150 msgid "standard output" msgstr "eixida estàndard" -#: builtin.c:139 +#: builtin.c:151 msgid "reason unknown" msgstr "motiu desconegut" -#: builtin.c:152 +#: builtin.c:164 msgid "exp: received non-numeric argument" msgstr "exp: s'ha rebut un argument que no és un número" -#: builtin.c:158 +#: builtin.c:170 #, c-format msgid "exp: argument %g is out of range" msgstr "exp: l'argument %g està fora de rang" -#: builtin.c:216 +#: builtin.c:228 #, c-format msgid "fflush: cannot flush: pipe `%s' opened for reading, not writing" msgstr "" "fflush: no es pot netejar: la canonada «%s» s'ha obert per a lectura, no per " "a escriptura" -#: builtin.c:219 +#: builtin.c:231 #, c-format msgid "fflush: cannot flush: file `%s' opened for reading, not writing" msgstr "" "fflush: no es pot netejar: el fitxer «%s» s'ha obert per a lectura, no per a " "escriptura" -#: builtin.c:231 +#: builtin.c:243 #, c-format msgid "fflush: `%s' is not an open file, pipe or co-process" msgstr "fflush: «%s» no és un fitxer obert, canonada o co-procés" -#: builtin.c:325 +#: builtin.c:338 msgid "index: received non-string first argument" msgstr "índex: el primer argument rebut no és una cadena" -#: builtin.c:327 +#: builtin.c:340 msgid "index: received non-string second argument" msgstr "índex: el segon argument rebut no és una cadena" -#: builtin.c:437 +#: builtin.c:454 msgid "int: received non-numeric argument" msgstr "int: s'ha rebut un argument no numèric" -#: builtin.c:454 +#: builtin.c:471 msgid "length: received non-string argument" msgstr "length: s'ha rebut un argument que no és una cadena" -#: builtin.c:470 +#: builtin.c:487 msgid "log: received non-numeric argument" msgstr "log: s'ha rebut un argument no numèric" -#: builtin.c:473 +#: builtin.c:490 #, c-format msgid "log: received negative argument %g" msgstr "log: s'ha rebut l'argument negatiu %g" -#: builtin.c:635 builtin.c:638 +#: builtin.c:654 builtin.c:657 msgid "must use `count$' on all formats or none" msgstr "" -#: builtin.c:740 +#: builtin.c:759 msgid "`$' is not permitted in awk formats" msgstr "no es permeten «$» en els formats awk" -#: builtin.c:746 +#: builtin.c:765 msgid "arg count with `$' must be > 0" msgstr "el compte d'arguments amb «$» ha de ser > 0" -#: builtin.c:748 +#: builtin.c:767 #, fuzzy, c-format msgid "arg count %ld greater than total number of supplied arguments" msgstr "" "el comte d'arguments %d és major que el nombre total d'arguments " "proporcionats" -#: builtin.c:750 +#: builtin.c:769 msgid "`$' not permitted after period in format" msgstr "no es permet «$» després d'un punt en el format" -#: builtin.c:763 +#: builtin.c:782 msgid "no `$' supplied for positional field width or precision" msgstr "no es proporciona «$» per a l'ample o precisió del camp de posició" -#: builtin.c:821 +#: builtin.c:848 msgid "`l' is meaningless in awk formats; ignored" msgstr "«l» manca de significat en els formats awk; serà ignorat" -#: builtin.c:825 +#: builtin.c:852 msgid "`l' is not permitted in POSIX awk formats" msgstr "«l» no està permés en els formats POSIX de awk" -#: builtin.c:836 +#: builtin.c:863 msgid "`L' is meaningless in awk formats; ignored" msgstr "«L» manca de significat en els formats awk; serà ignorat" -#: builtin.c:840 +#: builtin.c:867 msgid "`L' is not permitted in POSIX awk formats" msgstr "«L» no està permés en els formats POSIX de awk" -#: builtin.c:851 +#: builtin.c:878 msgid "`h' is meaningless in awk formats; ignored" msgstr "«h» manca de significat en els formats awk; serà ignorat" -#: builtin.c:855 +#: builtin.c:882 msgid "`h' is not permitted in POSIX awk formats" msgstr "«h» no està permés en els formats POSIX de awk" -#: builtin.c:1055 +#: builtin.c:1111 #, c-format msgid "[s]printf: value %g is out of range for `%%%c' format" msgstr "" -#: builtin.c:1108 +#: builtin.c:1171 msgid "not enough arguments to satisfy format string" msgstr "no hi ha prou arguments per a satisfer el format d'una cadena" -#: builtin.c:1110 +#: builtin.c:1173 msgid "^ ran out for this one" msgstr "^ desbordament per a aquest" -#: builtin.c:1115 +#: builtin.c:1178 msgid "[s]printf: format specifier does not have control letter" msgstr "[s]printf: l'especificador de format no conté lletra de control" -#: builtin.c:1118 +#: builtin.c:1181 msgid "too many arguments supplied for format string" msgstr "s'han proporcionat masses arguments per a la cadena de format" -#: builtin.c:1184 builtin.c:1187 +#: builtin.c:1247 builtin.c:1250 msgid "printf: no arguments" msgstr "printf: sense arguments" -#: builtin.c:1211 +#: builtin.c:1274 msgid "sqrt: received non-numeric argument" msgstr "sqrt: s'ha rebut un argument no numèric" -#: builtin.c:1215 +#: builtin.c:1278 #, c-format msgid "sqrt: called with negative argument %g" msgstr "sqrt: cridat amb l'argument negatiu %g" -#: builtin.c:1238 +#: builtin.c:1301 #, c-format msgid "substr: start index %g is invalid, using 1" msgstr "substr: l'índex d'inici %g no és vàlid, usant 1" -#: builtin.c:1243 +#: builtin.c:1306 #, c-format msgid "substr: non-integer start index %g will be truncated" msgstr "substr: l'índex d'inici no enter %g serà truncat" -#: builtin.c:1262 +#: builtin.c:1325 #, fuzzy, c-format msgid "substr: length %g is not >= 1" msgstr "substr: la longitud %g és <= 0" -#: builtin.c:1264 +#: builtin.c:1327 #, fuzzy, c-format msgid "substr: length %g is not >= 0" msgstr "substr: la longitud %g és <= 0" -#: builtin.c:1271 +#: builtin.c:1334 #, c-format msgid "substr: non-integer length %g will be truncated" msgstr "substr: la longitud sobre un nombre no enter %g serà truncada" -#: builtin.c:1276 +#: builtin.c:1339 #, c-format msgid "substr: length %g too big for string indexing, truncating to %g" msgstr "" -#: builtin.c:1288 +#: builtin.c:1351 msgid "substr: source string is zero length" msgstr "substr: la cadena font és de longitud zero" -#: builtin.c:1294 +#: builtin.c:1357 #, fuzzy, c-format msgid "substr: start index %g is past end of string" msgstr "substr: l'índex d'inici %d sobrepassa l'acabament de la cadena" -#: builtin.c:1302 +#: builtin.c:1365 #, fuzzy, c-format msgid "" "substr: length %g at start index %g exceeds length of first argument (%lu)" @@ -577,248 +577,273 @@ msgstr "" "substr: la longitud %d a l'índex d'inici %d excedeix la longitud del 1er " "argument (%d)" -#: builtin.c:1337 +#: builtin.c:1400 #, fuzzy msgid "strftime: received non-string first argument" msgstr "strftime: el primer argument rebut no és una cadena" -#: builtin.c:1343 +#: builtin.c:1406 msgid "strftime: received empty format string" msgstr "strftime: s'ha rebut una cadena de format buida" -#: builtin.c:1352 +#: builtin.c:1415 #, fuzzy msgid "strftime: received non-numeric second argument" msgstr "strftime: el segon argument rebut no és numèric" -#: builtin.c:1415 +#: builtin.c:1478 msgid "mktime: received non-string argument" msgstr "mktime: s'ha rebut un argument que no és una cadena" -#: builtin.c:1460 +#: builtin.c:1523 #, fuzzy msgid "system: received non-string argument" msgstr "system: s'ha rebut un argument que no és una cadena" -#: builtin.c:1581 eval.c:1883 +#: builtin.c:1644 eval.c:2019 #, fuzzy, c-format msgid "reference to uninitialized field `$%d'" msgstr "referència a una variable sense inicialitzar «%s»" -#: builtin.c:1608 +#: builtin.c:1671 #, fuzzy msgid "tolower: received non-string argument" msgstr "tolower: s'ha rebut un argument que no és una cadena" -#: builtin.c:1657 +#: builtin.c:1720 #, fuzzy msgid "toupper: received non-string argument" msgstr "toupper: s'ha rebut un argument que no és una cadena" -#: builtin.c:1702 +#: builtin.c:1765 msgid "atan2: received non-numeric first argument" msgstr "atan2: el primer argument rebut no és numèric" -#: builtin.c:1704 +#: builtin.c:1767 msgid "atan2: received non-numeric second argument" msgstr "atan2: el segon argument rebut no és numèric" -#: builtin.c:1723 +#: builtin.c:1786 msgid "sin: received non-numeric argument" msgstr "sin: s'ha rebut un argument que no és numèric" -#: builtin.c:1739 +#: builtin.c:1802 msgid "cos: received non-numeric argument" msgstr "cos: s'ha rebut un argument que no és numèric" -#: builtin.c:1788 +#: builtin.c:1852 msgid "srand: received non-numeric argument" msgstr "srand: s'ha rebut un argument que no és numèric" -#: builtin.c:1823 +#: builtin.c:1887 msgid "match: third argument is not an array" msgstr "match: el tercer argument no és una matriu" -#: builtin.c:2307 +#: builtin.c:2414 msgid "gensub: third argument of 0 treated as 1" msgstr "gensub: el tercer argument de 0 és tractat com a 1" -#: builtin.c:2416 builtin.c:2418 +#: builtin.c:2572 msgid "lshift: received non-numeric first argument" msgstr "lshift: el primer argument rebut no és numèric" -#: builtin.c:2420 +#: builtin.c:2574 +#, fuzzy +msgid "lshift: received non-numeric second argument" +msgstr "strftime: el segon argument rebut no és numèric" + +#: builtin.c:2580 #, c-format msgid "lshift(%lf, %lf): negative values will give strange results" msgstr "lshift(%lf, %lf): els valors negatius donaran resultats estranys" -#: builtin.c:2422 +#: builtin.c:2582 #, c-format msgid "lshift(%lf, %lf): fractional values will be truncated" msgstr "lshift(%lf, %lf): els valors fraccionaris sernn truncats" -#: builtin.c:2424 +#: builtin.c:2584 #, c-format msgid "lshift(%lf, %lf): too large shift value will give strange results" msgstr "" "lshift(%lf, %lf): un valor de desplaçament massa gran donarà resultats " "estranys" -#: builtin.c:2453 builtin.c:2455 +#: builtin.c:2610 msgid "rshift: received non-numeric first argument" msgstr "rshift: el primer argument rebut no és numèric" -#: builtin.c:2457 +#: builtin.c:2612 +#, fuzzy +msgid "rshift: received non-numeric second argument" +msgstr "strftime: el segon argument rebut no és numèric" + +#: builtin.c:2618 #, c-format msgid "rshift(%lf, %lf): negative values will give strange results" msgstr "rshift(%lf, %lf): els valors negatius donaran resultats estranys" -#: builtin.c:2459 +#: builtin.c:2620 #, c-format msgid "rshift(%lf, %lf): fractional values will be truncated" msgstr "rshift(%lf, %lf): els valors fraccionaris seran truncats" -#: builtin.c:2461 +#: builtin.c:2622 #, c-format msgid "rshift(%lf, %lf): too large shift value will give strange results" msgstr "" "rshift(%lf, %lf): un valor de desplaçament massa gran donarà resultats " "estranys" -#: builtin.c:2490 builtin.c:2492 +#: builtin.c:2648 msgid "and: received non-numeric first argument" msgstr "and: el primer argument rebut no és numèric" -#: builtin.c:2494 +#: builtin.c:2650 +#, fuzzy +msgid "and: received non-numeric second argument" +msgstr "atan2: el segon argument rebut no és numèric" + +#: builtin.c:2656 #, c-format msgid "and(%lf, %lf): negative values will give strange results" msgstr "and(%lf, %lf): els valors negatius donaran resultats estranys" -#: builtin.c:2496 +#: builtin.c:2658 #, c-format msgid "and(%lf, %lf): fractional values will be truncated" msgstr "and(%lf, %lf): els valors fraccionaris seran truncats" -#: builtin.c:2525 builtin.c:2527 +#: builtin.c:2684 msgid "or: received non-numeric first argument" msgstr "or: el primer argument rebut no és numèric" -#: builtin.c:2529 +#: builtin.c:2686 +#, fuzzy +msgid "or: received non-numeric second argument" +msgstr "atan2: el segon argument rebut no és numèric" + +#: builtin.c:2692 #, c-format msgid "or(%lf, %lf): negative values will give strange results" msgstr "or(%lf, %lf): els valors negatius donaran resultats estranys" -#: builtin.c:2531 +#: builtin.c:2694 #, c-format msgid "or(%lf, %lf): fractional values will be truncated" msgstr "or(%lf, %lf): els valors fraccionaris seran truncats" -#: builtin.c:2560 builtin.c:2562 +#: builtin.c:2720 msgid "xor: received non-numeric first argument" msgstr "xor: el primer argument rebut no és numèric" -#: builtin.c:2564 +#: builtin.c:2722 +#, fuzzy +msgid "xor: received non-numeric second argument" +msgstr "atan2: el segon argument rebut no és numèric" + +#: builtin.c:2728 #, c-format msgid "xor(%lf, %lf): negative values will give strange results" msgstr "xor(%lf, %lf): els valors negatius donaran resultats estranys" -#: builtin.c:2566 +#: builtin.c:2730 #, c-format msgid "xor(%lf, %lf): fractional values will be truncated" msgstr "xor(%lf, %lf): els valors fraccionaris seran truncats" -#: builtin.c:2594 +#: builtin.c:2754 msgid "compl: received non-numeric argument" msgstr "compl: s'ha rebut un argument que no és numèric" -#: builtin.c:2596 +#: builtin.c:2760 #, c-format msgid "compl(%lf): negative value will give strange results" msgstr "compl(%lf): el valor negatiu donarà resultats estranys" -#: builtin.c:2598 +#: builtin.c:2762 #, c-format msgid "compl(%lf): fractional value will be truncated" msgstr "compl(%lf): el valor fraccionari serà truncat" -#: builtin.c:2771 +#: builtin.c:2935 #, c-format msgid "dcgettext: `%s' is not a valid locale category" msgstr "dcgettext: «%s» no és una categoria local vàlida" -#: eval.c:266 +#: eval.c:303 #, c-format msgid "unknown nodetype %d" msgstr "tipo de node %d desconegut" -#: eval.c:312 +#: eval.c:350 msgid "buffer overflow in genflags2str" msgstr "desbordament del cau temporal en genflags2str" -#: eval.c:647 +#: eval.c:382 eval.c:388 profile.c:837 +#, c-format +msgid "attempt to use array `%s' in a scalar context" +msgstr "s'ha intentat usar la matriu «%s» en un context escalar" + +#: eval.c:730 #, fuzzy, c-format msgid "for loop: array `%s' changed size from %ld to %ld during loop execution" msgstr "" "bucle for: la matriu «%s» ha canviat de mida de %d a %d durant l'execució " "del bucle" -#: eval.c:668 +#: eval.c:751 msgid "`break' outside a loop is not portable" msgstr "«break» a fora d'un bucle no és portable" -#: eval.c:672 +#: eval.c:755 msgid "`break' outside a loop is not allowed" msgstr "no es permet «break» a fora d'un bucle" -#: eval.c:689 +#: eval.c:772 msgid "`continue' outside a loop is not portable" msgstr "«continue» fora d'un bucle no és portable" -#: eval.c:693 +#: eval.c:776 msgid "`continue' outside a loop is not allowed" msgstr "no es permet «continue» a fora d'un bucle" -#: eval.c:727 +#: eval.c:810 msgid "`next' cannot be called from a BEGIN rule" msgstr "«next» no es pot cridar des d'una regla BEGIN" -#: eval.c:729 +#: eval.c:812 msgid "`next' cannot be called from an END rule" msgstr "«next» no es pot cridar des d'una regla FINAL" -#: eval.c:738 +#: eval.c:821 msgid "`nextfile' cannot be called from a BEGIN rule" msgstr "«nextfile» no es pot cridar des d'una regla BEGIN" -#: eval.c:740 +#: eval.c:823 msgid "`nextfile' cannot be called from an END rule" msgstr "«nextfile» no es pot cridar des d'una regla FINAL" -#: eval.c:785 +#: eval.c:872 msgid "statement has no effect" msgstr "la sentència no té efecte" -#: eval.c:828 eval.c:1726 +#: eval.c:915 eval.c:1873 #, c-format msgid "can't use function name `%s' as variable or array" msgstr "no es pot usar el nom de la funció «%s» com a variable o matriu" -#: eval.c:835 eval.c:841 +#: eval.c:922 eval.c:928 #, c-format msgid "reference to uninitialized argument `%s'" msgstr "referència a un argument sense inicialitzar «%s»" -#: eval.c:848 eval.c:907 eval.c:1732 eval.c:1742 profile.c:807 -#, c-format -msgid "attempt to use array `%s' in a scalar context" -msgstr "s'ha intentat usar la matriu «%s» en un context escalar" - -#: eval.c:858 eval.c:1752 +#: eval.c:937 eval.c:1882 #, c-format msgid "reference to uninitialized variable `%s'" msgstr "referència a una variable sense inicialitzar «%s»" -#: eval.c:1007 +#: eval.c:1083 msgid "" "concatenation: side effects in one expression have changed the length of " "another!" @@ -826,49 +851,50 @@ msgstr "" "concatenació: els efectes colaterals en una expressió han canviat la " "longitud d'una altra!" -#: eval.c:1032 +#: eval.c:1162 msgid "assignment used in conditional context" msgstr "assignació usada en un context condicional" -#: eval.c:1122 +#: eval.c:1252 msgid "division by zero attempted" msgstr "s'ha intentat una divisió per zero" -#: eval.c:1137 +#: eval.c:1267 #, c-format msgid "division by zero attempted in `%%'" msgstr "s'ha intentat una divisió per zero en «%%»" -#: eval.c:1152 profile.c:683 +#: eval.c:1282 profile.c:713 #, c-format msgid "illegal type (%s) in tree_eval" msgstr "tipus il·legal (%s) en tree_eval" -#: eval.c:1328 +#: eval.c:1459 msgid "division by zero attempted in `/='" msgstr "s'ha intentat una divisió per zero en «/=»" -#: eval.c:1346 +#: eval.c:1477 #, c-format msgid "division by zero attempted in `%%='" msgstr "s'ha intentat una divisió per zero en «%%=»" -#: eval.c:1586 +#: eval.c:1738 #, c-format msgid "function `%s' called with more arguments than declared" msgstr "s'ha cridat a la funció «%s» amb més arguments dels declarats" -#: eval.c:1633 +#: eval.c:1782 #, c-format msgid "function `%s' not defined" msgstr "la funció «%s» no està definida" -#: eval.c:1639 +#: eval.c:1788 #, c-format msgid "function %s called\n" msgstr "s'ha cridat a la funció %s\n" -#: eval.c:1698 +#: eval.c:1845 +#, c-format msgid "" "\n" "\t# Function Call Stack:\n" @@ -878,42 +904,43 @@ msgstr "" "\t# Pila de Crides a les Funcions:\n" "\n" -#: eval.c:1701 +#: eval.c:1848 +#, c-format msgid "\t# -- main --\n" msgstr "\t# -- principal --\n" -#: eval.c:1867 +#: eval.c:2003 msgid "attempt to field reference from non-numeric value" msgstr "s'ha intentat una referència de camp a partir d'un valor no numèric" -#: eval.c:1869 +#: eval.c:2005 msgid "attempt to reference from null string" msgstr "s'ha intentat una referència a partir d'una cadena nul·la" -#: eval.c:1875 +#: eval.c:2011 #, c-format msgid "attempt to access field %d" msgstr "s'ha intentat accedir al camp %d" -#: eval.c:1896 eval.c:1903 profile.c:900 +#: eval.c:2032 eval.c:2039 profile.c:934 msgid "assignment is not allowed to result of builtin function" msgstr "" "no es permet l'assignació per a obtindre un resultat d'una funció interna" -#: eval.c:1951 +#: eval.c:2103 msgid "`IGNORECASE' is a gawk extension" msgstr "«IGNORECASE» és una extensió de gawk" -#: eval.c:1980 +#: eval.c:2133 msgid "`BINMODE' is a gawk extension" msgstr "«BINMODE» és una extensió de gawk" -#: eval.c:2092 +#: eval.c:2255 #, c-format msgid "bad `%sFMT' specification `%s'" msgstr "«%sFMT» especificació errònia «%s»" -#: eval.c:2170 +#: eval.c:2333 msgid "turning off `--lint' due to assignment to `LINT'" msgstr "desactivant «--lint» degut a una assignació a «LINT»" @@ -931,7 +958,56 @@ msgstr "extension: no es pot obrir msgid "extension: library `%s': cannot call function `%s' (%s)\n" msgstr "extension: biblioteca «%s»: no es pot cridar a la funció «%s» (%s)\n" -#: ext.c:183 +#: ext.c:102 +msgid "extension: missing function name" +msgstr "" + +#: ext.c:107 +#, fuzzy, c-format +msgid "extension: illegal character `%c' in function name `%s'" +msgstr "extension: biblioteca «%s»: no es pot cridar a la funció «%s» (%s)\n" + +#: ext.c:113 +#, fuzzy, c-format +msgid "extension: can't redefine function `%s'" +msgstr "extension: no es pot obrir «%s» (%s)\n" + +#: ext.c:117 +#, fuzzy, c-format +msgid "extension: function `%s' already defined" +msgstr "la funció «%s» no està definida" + +#: ext.c:122 +#, c-format +msgid "extension: can't use gawk built-in `%s' as function name" +msgstr "" + +#: ext.c:124 +#, fuzzy, c-format +msgid "extension: function name `%s' previously defined" +msgstr "nom de la funció «%s» definida prèviament" + +#: ext.c:201 +#, c-format +msgid "function `%s' defined to take no more than `%d' argument(s)" +msgstr "" + +#: ext.c:204 +#, fuzzy, c-format +msgid "function `%s': missing argument #%d" +msgstr "la funció «%s» no està definida" + +#: ext.c:214 +#, fuzzy, c-format +msgid "function `%s': argument #%d: attempt to use scalar as an array" +msgstr "s'ha intentat usar la dada escalar «%s» com a una matriu" + +#: ext.c:218 +#, c-format +msgid "function `%s': argument #%d: attempt to use array as a scalar" +msgstr "" + +#: ext.c:243 msgid "Operation Not Supported" msgstr "Operació No Suportada" @@ -960,536 +1036,536 @@ msgstr "el camp %d en FIELDWIDTHS, hauria de ser > 0" msgid "null string for `FS' is a gawk extension" msgstr "la cadena nul·la per a «FS» és una extensió de gawk" -#: getopt.c:692 getopt.c:704 +#: getopt.c:692 getopt.c:711 #, c-format msgid "%s: option `%s' is ambiguous\n" msgstr "%s: l'opció «%s» és ambigua\n" -#: getopt.c:737 getopt.c:741 +#: getopt.c:744 getopt.c:748 #, c-format msgid "%s: option `--%s' doesn't allow an argument\n" msgstr "%s: l'opció «--%s» no admet cap argument\n" -#: getopt.c:750 getopt.c:755 +#: getopt.c:757 getopt.c:762 #, c-format msgid "%s: option `%c%s' doesn't allow an argument\n" msgstr "%s: l'opció «%c%s» no admet cap argument\n" -#: getopt.c:791 getopt.c:804 getopt.c:1093 getopt.c:1106 +#: getopt.c:807 getopt.c:829 getopt.c:1159 getopt.c:1181 #, c-format msgid "%s: option `%s' requires an argument\n" msgstr "%s: l'opció «%s» requereix un argument\n" -#: getopt.c:842 getopt.c:845 +#: getopt.c:867 getopt.c:870 #, c-format msgid "%s: unrecognized option `--%s'\n" msgstr "%s: no es reconeix l'opció «--%s»\n" -#: getopt.c:853 getopt.c:856 +#: getopt.c:878 getopt.c:881 #, c-format msgid "%s: unrecognized option `%c%s'\n" msgstr "%s: no es reconeix l'opció «%c%s»\n" -#: getopt.c:903 getopt.c:906 +#: getopt.c:936 getopt.c:939 #, c-format msgid "%s: illegal option -- %c\n" msgstr "%s: opció il·legal -- %c\n" -#: getopt.c:912 getopt.c:915 +#: getopt.c:945 getopt.c:948 #, c-format msgid "%s: invalid option -- %c\n" msgstr "%s: opció no vàlida -- %c\n" -#: getopt.c:962 getopt.c:973 getopt.c:1159 getopt.c:1172 main.c:434 +#: getopt.c:1003 getopt.c:1022 getopt.c:1234 getopt.c:1255 main.c:433 #, c-format msgid "%s: option requires an argument -- %c\n" msgstr "%s: l'opció requereix un argument -- %c\n" -#: getopt.c:1025 getopt.c:1036 +#: getopt.c:1074 getopt.c:1093 #, c-format msgid "%s: option `-W %s' is ambiguous\n" msgstr "%s: l'opció «-W %s» és ambigua\n" -#: getopt.c:1060 getopt.c:1072 +#: getopt.c:1117 getopt.c:1138 #, c-format msgid "%s: option `-W %s' doesn't allow an argument\n" msgstr "%s: l'opció «-W %s» no admet cap argument\n" -#: io.c:305 +#: io.c:308 #, c-format msgid "cannot open file `%s' for reading (%s)" msgstr "no es pot obrir el fitxer «%s» per a lectura (%s)" -#: io.c:392 +#: io.c:395 #, c-format msgid "close of fd %d (`%s') failed (%s)" msgstr "la finalització del descriptor fd %d («%s») ha fallat (%s)" -#: io.c:530 +#: io.c:533 #, c-format msgid "invalid tree type %s in redirect()" msgstr "tipus d'arbre %s no vàlid dintre de redirect()" -#: io.c:536 +#: io.c:539 #, c-format msgid "expression in `%s' redirection only has numeric value" msgstr "l'expressió en la redirecció «%s» solt té un valor numèric" -#: io.c:542 +#: io.c:545 #, c-format msgid "expression for `%s' redirection has null string value" msgstr "l'expressió per a la redirecció «%s» té un valor de cadena nul·la" -#: io.c:547 +#: io.c:550 #, c-format msgid "filename `%s' for `%s' redirection may be result of logical expression" msgstr "" "el fitxer «%s» per a la redirecció «%s» pot ser resultat d'una expressió " "lògica" -#: io.c:569 +#: io.c:588 #, c-format msgid "unnecessary mixing of `>' and `>>' for file `%.*s'" msgstr "mescla innecessària de «>» i «>>» per al fitxer «%.*s»" -#: io.c:621 +#: io.c:640 #, c-format msgid "can't open pipe `%s' for output (%s)" msgstr "no es pot obrir la canonada «%s» per a l'eixida (%s)" -#: io.c:630 +#: io.c:649 #, c-format msgid "can't open pipe `%s' for input (%s)" msgstr "no es pot obrir la canonada «%s» per a l'entrada (%s)" -#: io.c:643 +#: io.c:662 #, c-format msgid "can't open two way socket `%s' for input/output (%s)" msgstr "" "no es pot obrir un socket bidireccional «%s» per a les entrades/eixides (%s)" -#: io.c:647 +#: io.c:666 #, c-format msgid "can't open two way pipe `%s' for input/output (%s)" msgstr "" "no es pot obrir una canonada bidireccional «%s» per a les entrades/eixides (%" "s)" -#: io.c:723 +#: io.c:742 #, c-format msgid "can't redirect from `%s' (%s)" msgstr "no es pot redirigir des de «%s» (%s)" -#: io.c:726 +#: io.c:745 #, c-format msgid "can't redirect to `%s' (%s)" msgstr "no es pot redirigir cap a «%s» (%s)" -#: io.c:765 +#: io.c:784 msgid "" "reached system limit for open files: starting to multiplex file descriptors" msgstr "" "s'ha arribat al límit del sistema per a fitxers oberts: es començarà a " "multiplexar els descriptors de fitxer" -#: io.c:777 +#: io.c:800 #, c-format msgid "close of `%s' failed (%s)." msgstr "la finalització de «%s» ha fallat (%s)" -#: io.c:784 +#: io.c:808 msgid "too many pipes or input files open" msgstr "masses canonades o fitxers d'entrada oberts" -#: io.c:807 +#: io.c:831 msgid "close: second argument must be `to' or `from'" msgstr "close: el segon argument hauria de ser «to» o «from»" -#: io.c:821 +#: io.c:845 #, c-format msgid "close: `%.*s' is not an open file, pipe or co-process" msgstr "close: «%.*s» no és un fitxer obert, canonada o co-procés" -#: io.c:825 +#: io.c:849 msgid "close of redirection that was never opened" msgstr "finalització d'una redirecció que no s'ha obert" -#: io.c:862 +#: io.c:945 #, c-format msgid "close: redirection `%s' not opened with `|&', second argument ignored" msgstr "" "close: la redirecció «%s» no s'obre amb «|&», s'ignora el segon argument" -#: io.c:924 +#: io.c:960 #, c-format msgid "failure status (%d) on pipe close of `%s' (%s)" msgstr "estaus de falla (%d) en la finalització de la canonada «%s» (%s)" -#: io.c:927 +#: io.c:963 #, c-format msgid "failure status (%d) on file close of `%s' (%s)" msgstr "estatus de falla (%d) en la finalització del fitxer «%s» (%s)" -#: io.c:946 +#: io.c:983 #, c-format msgid "no explicit close of socket `%s' provided" msgstr "no s'aporta la finalització explícita del socket «%s»" -#: io.c:949 +#: io.c:986 #, c-format msgid "no explicit close of co-process `%s' provided" msgstr "no s'aporta la finalització explícita del co-procés «%s»" -#: io.c:952 +#: io.c:989 #, c-format msgid "no explicit close of pipe `%s' provided" msgstr "no s'aporta la finalització explícita de la canonada «%s»" -#: io.c:955 +#: io.c:992 #, c-format msgid "no explicit close of file `%s' provided" msgstr "no s'aporta la finalització explícita del fitxer «%s»" -#: io.c:984 io.c:1038 +#: io.c:1021 io.c:1075 #, c-format msgid "error writing standard output (%s)" msgstr "error a l'escriure en l'eixida estàndard (%s)" -#: io.c:988 io.c:1042 +#: io.c:1025 io.c:1079 #, c-format msgid "error writing standard error (%s)" msgstr "error a l'escriure en l'eixida d'error estàndard (%s)" -#: io.c:996 +#: io.c:1033 #, c-format msgid "pipe flush of `%s' failed (%s)." msgstr "la neteja de la canonada de «%sx» ha fallat (%s)." -#: io.c:999 +#: io.c:1036 #, c-format msgid "co-process flush of pipe to `%s' failed (%s)." msgstr "la neteja de la canonada per al co-procés de «%sx» ha fallat (%s)." -#: io.c:1002 +#: io.c:1039 #, c-format msgid "file flush of `%s' failed (%s)." msgstr "la neteja del fitxer «%sx» ha fallat (%s)." -#: io.c:1161 +#: io.c:1198 msgid "/inet/raw client not ready yet, sorry" msgstr "el client /inet/raw encara no està a punt, ho sento" -#: io.c:1163 io.c:1200 +#: io.c:1200 io.c:1237 msgid "only root may use `/inet/raw'." msgstr "sols el root pot usar «/inet/raw»." -#: io.c:1198 +#: io.c:1235 msgid "/inet/raw server not ready yet, sorry" msgstr "el servidor /inet/raw encara no està a punt, ho sento" -#: io.c:1288 +#: io.c:1325 #, c-format msgid "no (known) protocol supplied in special filename `%s'" msgstr "no s'aporta cap protocol (conegut) en el nom del fitxer especial «%s»" -#: io.c:1306 +#: io.c:1343 #, c-format msgid "special file name `%s' is incomplete" msgstr "el nom del fitxer especial «%s» està incomplet" -#: io.c:1318 +#: io.c:1355 #, c-format msgid "local port invalid in `%s'" msgstr "port local no vàlid en «%s»" -#: io.c:1330 +#: io.c:1367 msgid "must supply a remote hostname to `/inet'" msgstr "s'ha de subministrar un nom de sistema remot a «/inet»" -#: io.c:1345 +#: io.c:1382 msgid "must supply a remote port to `/inet'" msgstr "s'ha de subministrar un port remot a «/inet»" -#: io.c:1351 +#: io.c:1388 #, c-format msgid "remote port invalid in `%s'" msgstr "port remot no vàlid en «%s»" -#: io.c:1361 +#: io.c:1398 msgid "TCP/IP communications are not supported" msgstr "les comunicacions TCP/IP no estan suportades" -#: io.c:1370 io.c:1551 +#: io.c:1407 io.c:1588 #, c-format msgid "file `%s' is a directory" msgstr "el fitxer «%s» és un directori" -#: io.c:1440 +#: io.c:1477 #, c-format msgid "use `PROCINFO[\"%s\"]' instead of `%s'" msgstr "useu «PROCINFO[\"%s\"]» en comptes de «%s»" -#: io.c:1472 +#: io.c:1509 msgid "use `PROCINFO[...]' instead of `/dev/user'" msgstr "useu «PROCINFO[...]» en comptes de «/dev/user»" -#: io.c:1537 io.c:1711 +#: io.c:1574 io.c:1748 #, c-format msgid "could not open `%s', mode `%s'" msgstr "no es pot obrir «%s», mode «%s»" -#: io.c:1762 +#: io.c:1799 #, fuzzy, c-format msgid "close of master pty failed (%s)" msgstr "ha fallat la finalització de la canonada (%s)" -#: io.c:1764 io.c:1916 io.c:2068 +#: io.c:1801 io.c:1953 io.c:2105 #, c-format msgid "close of stdout in child failed (%s)" msgstr "" "ha fallat la finalització de l'eixida estàndard en els processos fills (%s)" -#: io.c:1767 +#: io.c:1804 #, fuzzy, c-format msgid "moving slave pty to stdout in child failed (dup: %s)" msgstr "" "ha fallat la redirecció cap a l'eixida estàndard dels processos fills (dup: %" "s)" -#: io.c:1769 io.c:1921 +#: io.c:1806 io.c:1958 #, c-format msgid "close of stdin in child failed (%s)" msgstr "" "ha fallat la finalització de l'entrada estàndard en els processos fills (%s)" -#: io.c:1772 +#: io.c:1809 #, fuzzy, c-format msgid "moving slave pty to stdin in child failed (dup: %s)" msgstr "" "ha fallat la redirecció cap a l'entrada estàndard dels processos fills (dup: " "%s)" -#: io.c:1774 io.c:1793 +#: io.c:1811 io.c:1830 #, fuzzy, c-format msgid "close of slave pty failed (%s)" msgstr "ha fallat la finalització de la canonada (%s)" -#: io.c:1867 io.c:1919 io.c:2049 io.c:2071 +#: io.c:1904 io.c:1956 io.c:2086 io.c:2108 #, c-format msgid "moving pipe to stdout in child failed (dup: %s)" msgstr "" "ha fallat la redirecció cap a l'eixida estàndard dels processos fills (dup: %" "s)" -#: io.c:1871 io.c:1924 +#: io.c:1908 io.c:1961 #, c-format msgid "moving pipe to stdin in child failed (dup: %s)" msgstr "" "ha fallat la redirecció cap a l'entrada estàndard dels processos fills (dup: " "%s)" -#: io.c:1888 io.c:2062 +#: io.c:1925 io.c:2099 msgid "restoring stdout in parent process failed\n" msgstr "ha fallat la restauració de l'eixida estàndard en el procés pare\n" -#: io.c:1893 +#: io.c:1930 msgid "restoring stdin in parent process failed\n" msgstr "ha fallat la restauració de l'entrada estàndard en el procés pare\n" -#: io.c:1927 io.c:2073 io.c:2084 +#: io.c:1964 io.c:2110 io.c:2121 #, c-format msgid "close of pipe failed (%s)" msgstr "ha fallat la finalització de la canonada (%s)" -#: io.c:1972 +#: io.c:2009 msgid "`|&' not supported" msgstr "«|&» no està suportat" -#: io.c:2039 +#: io.c:2076 #, c-format msgid "cannot open pipe `%s' (%s)" msgstr "no es pot obrir la canonada «%s» (%s)" -#: io.c:2080 +#: io.c:2117 #, c-format msgid "cannot create child process for `%s' (fork: %s)" msgstr "no es pot crear el procés fill per a «%s» (fork: %s)" -#: io.c:2423 +#: io.c:2460 #, c-format msgid "data file `%s' is empty" msgstr "el fitxer de dades «%s» està buit" -#: io.c:2466 io.c:2474 +#: io.c:2503 io.c:2511 msgid "could not allocate more input memory" msgstr "" -#: io.c:2832 io.c:2895 +#: io.c:2869 io.c:2932 #, c-format msgid "error reading input file `%s': %s" msgstr "error en llegir el fitxer d'entrada «%s»: %s" -#: io.c:3020 +#: io.c:3057 msgid "multicharacter value of `RS' is a gawk extension" msgstr "el valor multicaràcter de «RS» és una extensió de gawk" -#: main.c:324 +#: main.c:323 msgid "`-m[fr]' option irrelevant in gawk" msgstr "l'opción «-m[fr]» és irrellevant en gawk" -#: main.c:326 +#: main.c:325 msgid "-m option usage: `-m[fr] nnn'" msgstr "ús de l'opció -m: «-m[fr] nnn»" -#: main.c:343 +#: main.c:342 #, c-format msgid "%s: option `-W %s' unrecognized, ignored\n" msgstr "%s: no es reconeix l'opció «-W %s», serà ignorada\n" -#: main.c:380 +#: main.c:379 msgid "empty argument to `--source' ignored" msgstr "s'igonarà l'argument buit per a l'opció «--source»" -#: main.c:451 +#: main.c:450 msgid "environment variable `POSIXLY_CORRECT' set: turning on `--posix'" msgstr "" "la variable d'entorn «POSIXLY_CORRECT» està establerta: usant «--posix»" -#: main.c:456 +#: main.c:455 msgid "`--posix' overrides `--traditional'" msgstr "«--posix» solapa a «--traditional»" -#: main.c:467 +#: main.c:466 msgid "`--posix'/`--traditional' overrides `--non-decimal-data'" msgstr "«--posix» i «--traditional» solapen a «--non-decimal-data»" -#: main.c:471 +#: main.c:470 #, fuzzy, c-format msgid "running %s setuid root may be a security problem" msgstr "executar %s com a setuid root pot ser un problema de seguretat" -#: main.c:512 +#: main.c:511 #, fuzzy, c-format msgid "can't set binary mode on stdin (%s)" msgstr "no es pot establir el mode en l'entrada estàndard (%s)" -#: main.c:515 +#: main.c:514 #, fuzzy, c-format msgid "can't set binary mode on stdout (%s)" msgstr "no es pot establir el mode en l'eixida estàndard (%s)" -#: main.c:517 +#: main.c:516 #, fuzzy, c-format msgid "can't set binary mode on stderr (%s)" msgstr "no es pot establir el mode en l'eixida d'error estàndard (%s)" -#: main.c:547 +#: main.c:546 msgid "no program text at all!" msgstr "no hi ha cap text per al programa!" -#: main.c:620 +#: main.c:623 #, c-format msgid "Usage: %s [POSIX or GNU style options] -f progfile [--] file ...\n" msgstr "Ús: %s [opcions d'estil POSIX o GNU] -f fitx_prog [--] fitxer ...\n" -#: main.c:622 +#: main.c:625 #, c-format msgid "Usage: %s [POSIX or GNU style options] [--] %cprogram%c file ...\n" msgstr "Ús: %s [opcions d'estil POSIX o GNU] [--] %cprograma%c fitxer ...\n" -#: main.c:627 +#: main.c:630 msgid "POSIX options:\t\tGNU long options:\n" msgstr "Opcions POSIX:\t\tOpcions llargues GNU:\n" -#: main.c:628 +#: main.c:631 msgid "\t-f progfile\t\t--file=progfile\n" msgstr "\t-f fitx_prog\t\t--file=fitx_prog\n" -#: main.c:629 +#: main.c:632 msgid "\t-F fs\t\t\t--field-separator=fs\n" msgstr "\t-F fs\t\t\t--field-separator=fs (fs=sep_camp)\n" -#: main.c:630 +#: main.c:633 msgid "\t-v var=val\t\t--assign=var=val\n" msgstr "\t-v var=valor\t\t--assign=var=valor\n" -#: main.c:631 +#: main.c:634 msgid "\t-m[fr] val\n" msgstr "\t-m[fr] valor\n" -#: main.c:632 +#: main.c:635 msgid "\t-W compat\t\t--compat\n" msgstr "\t-W compat\t\t--compat\n" -#: main.c:633 +#: main.c:636 msgid "\t-W copyleft\t\t--copyleft\n" msgstr "\t-W copyleft\t\t--copyleft\n" -#: main.c:634 +#: main.c:637 msgid "\t-W copyright\t\t--copyright\n" msgstr "\t-W copyright\t\t--copyright\n" -#: main.c:635 +#: main.c:638 msgid "\t-W dump-variables[=file]\t--dump-variables[=file]\n" msgstr "\t-W dump-variables[=fitxer] --dump-variables[=fitxer]\n" -#: main.c:636 +#: main.c:639 msgid "\t-W gen-po\t\t--gen-po\n" msgstr "\t-W gen-po\t\t--gen-po\n" -#: main.c:637 +#: main.c:640 msgid "\t-W help\t\t\t--help\n" msgstr "\t-W help\t\t\t--help\n" -#: main.c:638 +#: main.c:641 msgid "\t-W lint[=fatal]\t\t--lint[=fatal]\n" msgstr "\t-W lint[=fatal]\t\t--lint[=fatal]\n" -#: main.c:639 +#: main.c:642 msgid "\t-W lint-old\t\t--lint-old\n" msgstr "\t-W lint-old\t\t--lint-old\n" -#: main.c:640 +#: main.c:643 msgid "\t-W non-decimal-data\t--non-decimal-data\n" msgstr "\t-W non-decimal-data\t--non-decimal-data\n" -#: main.c:642 +#: main.c:645 msgid "\t-W nostalgia\t\t--nostalgia\n" msgstr "\t-W nostalgia\t\t--nostalgia\n" -#: main.c:645 +#: main.c:648 msgid "\t-W parsedebug\t\t--parsedebug\n" msgstr "\t-W parsedebug\t\t--parsedebug\n" -#: main.c:647 +#: main.c:650 msgid "\t-W profile[=file]\t--profile[=file]\n" msgstr "\t-W profile[=fitxer]\t--profile[=fitxer]\n" -#: main.c:648 +#: main.c:651 msgid "\t-W posix\t\t--posix\n" msgstr "\t-W posix\t\t--posix\n" -#: main.c:649 +#: main.c:652 msgid "\t-W re-interval\t\t--re-interval\n" msgstr "\t-W re-interval\t\t--re-interval\n" -#: main.c:650 +#: main.c:653 msgid "\t-W source=program-text\t--source=program-text\n" msgstr "\t-W source=text_prog\t--source=text_prog\n" -#: main.c:651 +#: main.c:654 msgid "\t-W traditional\t\t--traditional\n" msgstr "\t-W traditional\t\t--traditional\n" -#: main.c:652 +#: main.c:655 msgid "\t-W usage\t\t--usage\n" msgstr "\t-W usage\t\t--usage\n" -#: main.c:653 +#: main.c:656 msgid "\t-W version\t\t--version\n" msgstr "\t-W version\t\t--version\n" -#: main.c:657 +#: main.c:660 #, fuzzy msgid "" "\n" @@ -1498,21 +1574,21 @@ msgid "" "\n" msgstr "a la secció «Reporting Problems and Bugs» de la versió impresa.\n" -#: main.c:661 +#: main.c:664 msgid "" "gawk is a pattern scanning and processing language.\n" "By default it reads standard input and writes standard output.\n" "\n" msgstr "" -#: main.c:665 +#: main.c:668 msgid "" "Examples:\n" "\tgawk '{ sum += $1 }; END { print sum }' file\n" "\tgawk -F: '{ print $1 }' /etc/passwd\n" msgstr "" -#: main.c:682 +#: main.c:685 #, c-format msgid "" "Copyright (C) 1989, 1991-%d Free Software Foundation.\n" @@ -1531,7 +1607,7 @@ msgstr "" "Llicència, o (a la vostra elecció) qualsevol versió posterior.\n" "\n" -#: main.c:690 +#: main.c:693 msgid "" "This program is distributed in the hope that it will be useful,\n" "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" @@ -1545,7 +1621,7 @@ msgstr "" "Per a més detalls consulteu la Llicència Pública General de GNU.\n" "\n" -#: main.c:696 +#: main.c:699 msgid "" "You should have received a copy of the GNU General Public License\n" "along with this program; if not, write to the Free Software\n" @@ -1555,51 +1631,52 @@ msgstr "" "Pública General de GNU; si no és així, escriviu a la Free Software\n" "Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n" -#: main.c:730 +#: main.c:733 msgid "-Ft does not set FS to tab in POSIX awk" msgstr "-Ft no permet inicialitzar FS a un tabulador en la versió POSIX de awk" -#: main.c:956 +#: main.c:962 #, c-format msgid "" "%s: `%s' argument to `-v' not in `var=value' form\n" "\n" msgstr "" -#: main.c:976 +#: main.c:982 #, c-format msgid "`%s' is not a legal variable name" msgstr "" -#: main.c:979 +#: main.c:985 #, c-format msgid "`%s' is not a variable name, looking for file `%s=%s'" msgstr "" -#: main.c:1012 +#: main.c:1018 msgid "floating point exception" msgstr "excepció de coma flotant" -#: main.c:1019 +#: main.c:1025 msgid "fatal error: internal error" msgstr "error fatal: error intern" -#: main.c:1069 +#: main.c:1075 #, c-format msgid "no pre-opened fd %d" msgstr "no s'ha pre-obert el descriptor fd per a %d" -#: main.c:1074 +#: main.c:1082 #, c-format msgid "could not pre-open /dev/null for fd %d" msgstr "no es pot pre-obrir /dev/null per al descriptor fd %d" -#: main.c:1097 main.c:1106 +#: main.c:1105 main.c:1114 #, c-format msgid "could not find groups: %s" msgstr "no es poden trobar els grups: %s" #: msg.c:54 +#, c-format msgid "cmd. line:" msgstr "línia cmd.:" @@ -1619,19 +1696,19 @@ msgstr "Fatal: " msgid "can't convert string to float" msgstr "no es pot convertir la cadena a coma flotant" -#: node.c:355 +#: node.c:357 msgid "backslash at end of string" msgstr "barra invertida al final de la cadena" -#: node.c:539 +#: node.c:541 msgid "POSIX does not allow `\\x' escapes" msgstr "POSIX no permet seqüències d'escapada «\\x»" -#: node.c:545 +#: node.c:547 msgid "no hex digits in `\\x' escape sequence" msgstr "no hi ha dígits hexadecimals en la seqüència d'escapada «\\x»" -#: node.c:579 +#: node.c:581 #, c-format msgid "escape sequence `\\%c' treated as plain `%c'" msgstr "la seqüència d'escapada «\\%c» és tractada com a una simple «%c»" @@ -1646,21 +1723,27 @@ msgstr "%s %s msgid "could not open `%s' for writing: %s" msgstr "no es pot obrir «%s» per a escriptura: %s" -#: profile.c:449 +#: profile.c:467 #, fuzzy, c-format msgid "internal error: %s with null vname" msgstr "error intern: Node_var amb vname nul" -#: profile.c:512 +#: profile.c:530 msgid "# treated internally as `delete'" msgstr "" -#: profile.c:1162 +#: profile.c:1167 +#, c-format +msgid "# this is a dynamically loaded extension function" +msgstr "" + +#: profile.c:1198 #, c-format msgid "\t# gawk profile, created %s\n" msgstr "\t# perfil gawk, creat %s\n" -#: profile.c:1165 +#: profile.c:1201 +#, c-format msgid "" "\t# BEGIN block(s)\n" "\n" @@ -1668,7 +1751,8 @@ msgstr "" "\t# Bloc(s) INICI\n" "\n" -#: profile.c:1175 +#: profile.c:1211 +#, c-format msgid "" "\t# Rule(s)\n" "\n" @@ -1676,7 +1760,8 @@ msgstr "" "\t# Regla(es)\n" "\n" -#: profile.c:1181 +#: profile.c:1217 +#, c-format msgid "" "\t# END block(s)\n" "\n" @@ -1684,7 +1769,8 @@ msgstr "" "\t# Bloc(s) FINAL\n" "\n" -#: profile.c:1201 +#: profile.c:1237 +#, c-format msgid "" "\n" "\t# Functions, listed alphabetically\n" @@ -1692,88 +1778,87 @@ msgstr "" "\n" "\t# Funcions, llistades alfabèticament\n" -#: profile.c:1413 +#: profile.c:1452 #, c-format msgid "unexpected type %s in prec_level" msgstr "tipus %s inesperat en prec_level" -#: re.c:193 -#, c-format -msgid "regex match failed, not enough memory to match string \"%.*s%s\"" -msgstr "" - -#: regcomp.c:136 +#: regcomp.c:150 msgid "Success" msgstr "Èxit" -#: regcomp.c:139 +#: regcomp.c:153 msgid "No match" msgstr "No hi ha concordança" -#: regcomp.c:142 +#: regcomp.c:156 msgid "Invalid regular expression" msgstr "Expressió regular no vàlida" -#: regcomp.c:145 +#: regcomp.c:159 msgid "Invalid collation character" msgstr "Caràcter de comparació no vàlid" -#: regcomp.c:148 +#: regcomp.c:162 msgid "Invalid character class name" msgstr "Nom de classe de caràcters no vàlid" -#: regcomp.c:151 +#: regcomp.c:165 msgid "Trailing backslash" msgstr "Barra invertida extra al final" -#: regcomp.c:154 +#: regcomp.c:168 msgid "Invalid back reference" msgstr "Referència cap enradera no vàlida" -#: regcomp.c:157 +#: regcomp.c:171 msgid "Unmatched [ or [^" msgstr "[ o [^ desemparellats" -#: regcomp.c:160 +#: regcomp.c:174 msgid "Unmatched ( or \\(" msgstr "( o \\( desemparellats" -#: regcomp.c:163 +#: regcomp.c:177 msgid "Unmatched \\{" msgstr "\\{ desemparellat" -#: regcomp.c:166 +#: regcomp.c:180 msgid "Invalid content of \\{\\}" msgstr "Contingut no vàlid de \\{\\}" -#: regcomp.c:169 +#: regcomp.c:183 msgid "Invalid range end" msgstr "Final de rang no vàlid" -#: regcomp.c:172 +#: regcomp.c:186 msgid "Memory exhausted" msgstr "Memòria exhaurida" -#: regcomp.c:175 +#: regcomp.c:189 msgid "Invalid preceding regular expression" msgstr "Expressió regular precedent no vàlida" -#: regcomp.c:178 +#: regcomp.c:192 msgid "Premature end of regular expression" msgstr "Fí prematura de l'expressió regular" -#: regcomp.c:181 +#: regcomp.c:195 msgid "Regular expression too big" msgstr "L'expressió regular és massa gran" -#: regcomp.c:184 +#: regcomp.c:198 msgid "Unmatched ) or \\)" msgstr ") o \\) desemparellats" -#: regcomp.c:621 +#: regcomp.c:668 msgid "No previous regular expression" msgstr "No hi ha una expressió regular prèvia" +#, fuzzy +#~ msgid "or used as a variable or an array" +#~ msgstr "no es pot usar el nom de la funció «%s» com a variable o matriu" + #, fuzzy #~ msgid "substr: length %g is < 0" #~ msgstr "substr: la longitud %g és <= 0" @@ -1814,9 +1899,6 @@ msgstr "No hi ha una expressi #~ msgid "or used in other expression context" #~ msgstr "o s'ha emprat en un altre context de l'expressió" -#~ msgid "attempt to use function `%s' as array" -#~ msgstr "s'ha intentat usar la funció «%s» com a una matriu" - #~ msgid "`%s' is a function, assignment is not allowed" #~ msgstr "«%s» és una funció, l'assignació no és permesa" diff --git a/po/da.gmo b/po/da.gmo index 76ba08150..e5d3a1417 100644 Binary files a/po/da.gmo and b/po/da.gmo differ diff --git a/po/da.po b/po/da.po index f2913c9f9..484ee46ca 100644 --- a/po/da.po +++ b/po/da.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: gawk 3.1.31\n" "Report-Msgid-Bugs-To: arnold@skeeve.com\n" -"POT-Creation-Date: 2003-07-07 11:20-0700\n" +"POT-Creation-Date: 2004-07-15 13:02+0300\n" "PO-Revision-Date: 2002-11-09 10:09+0100\n" "Last-Translator: Keld Simonsen \n" "Language-Team: Danish \n" @@ -15,56 +15,61 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" #: array.c:112 +#, fuzzy, c-format +msgid "attempt to use function `%s' as an array" +msgstr "forsøg på at bruge funktionen \"%s\" som vektor" + +#: array.c:115 #, c-format msgid "attempt to use scalar parameter `%s' as an array" msgstr "forsøg på at bruge skalarparameteren \"%s\" som en vektor" -#: array.c:113 +#: array.c:118 #, c-format msgid "attempt to use scalar `%s' as array" msgstr "forsøg på at bruge skalaren \"%s\" som vektor" -#: array.c:151 +#: array.c:156 #, fuzzy, c-format msgid "from %s" msgstr "%s (fra %s)" -#: array.c:506 +#: array.c:511 #, c-format msgid "reference to uninitialized element `%s[\"%s\"]'" msgstr "reference til ikke-initieret element \"%s[\"%s\"]\"" -#: array.c:512 +#: array.c:517 #, c-format msgid "subscript of array `%s' is null string" msgstr "indeks i vektoren \"%s\" er en tom streng" -#: array.c:609 +#: array.c:621 #, c-format msgid "delete: index `%s' not in array `%s'" msgstr "delete: indeks \"%s\" findes ikke i vektoren \"%s\"" -#: array.c:769 +#: array.c:791 #, c-format msgid "%s: empty (null)\n" msgstr "%s: tom (nil)\n" -#: array.c:774 +#: array.c:796 #, c-format msgid "%s: empty (zero)\n" msgstr "%s: tom (nul)\n" -#: array.c:778 +#: array.c:800 #, c-format msgid "%s: table_size = %d, array_size = %d\n" msgstr "%s: tabelstørrelse = %d, vektorstørrelse = %d\n" -#: array.c:807 +#: array.c:829 #, fuzzy, c-format msgid "%s: is parameter\n" msgstr "%s: er en parameter\n" -#: array.c:812 +#: array.c:834 #, c-format msgid "%s: array_ref to %s\n" msgstr "%s: vektorreference til %s\n" @@ -89,481 +94,476 @@ msgstr "\"%s\" er en indbygget funktion, den kan ikke omdefineres" msgid "regexp constant `/%s/' looks like a C comment, but is not" msgstr "regexp-konstanten \"/%s/\" ser ud som en C-kommentar, men er det ikke" -#: awkgram.y:340 awkgram.y:615 +#: awkgram.y:341 awkgram.y:619 msgid "statement may have no effect" msgstr "kommandoen har måske ikke nogen effekt" -#: awkgram.y:435 awkgram.y:455 +#: awkgram.y:436 awkgram.y:456 #, fuzzy, c-format msgid "`%s' used in %s action" msgstr "\"next\" brugt i BEGIN- eller END-handling" -#: awkgram.y:448 awkgram.y:451 +#: awkgram.y:449 awkgram.y:452 msgid "`nextfile' is a gawk extension" msgstr "\"nextfile\" er en gawk-udvidelse" -#: awkgram.y:465 +#: awkgram.y:466 msgid "`return' used outside function context" msgstr "\"return\" brugt uden for funktion" -#: awkgram.y:504 +#: awkgram.y:508 msgid "plain `print' in BEGIN or END rule should probably be `print \"\"'" msgstr "" "alenestående \"print\" i BEGIN eller END-regel bør muligvis være 'print \"\"'" -#: awkgram.y:517 awkgram.y:524 +#: awkgram.y:521 awkgram.y:528 msgid "`delete array' is a gawk extension" msgstr "\"delete array\" er en gawk-udvidelse" -#: awkgram.y:532 awkgram.y:539 +#: awkgram.y:536 awkgram.y:543 #, fuzzy msgid "`delete(array)' is a non-portable tawk extension" msgstr "\"delete array\" er en gawk-udvidelse" -#: awkgram.y:583 +#: awkgram.y:587 #, c-format msgid "duplicate case values in switch body: %s" msgstr "" -#: awkgram.y:593 +#: awkgram.y:597 msgid "Duplicate `default' detected in switch body" msgstr "" -#: awkgram.y:681 +#: awkgram.y:686 msgid "multistage two-way pipelines don't work" msgstr "flertrins dobbeltrettede datakanaler fungerer ikke" -#: awkgram.y:772 +#: awkgram.y:777 msgid "regular expression on right of assignment" msgstr "regulært udtryk i højreleddet af en tildeling" -#: awkgram.y:782 +#: awkgram.y:800 msgid "regular expression on left of `~' or `!~' operator" msgstr "regulært udtryk på venstre side af en \"~\"- eller \"!~\"-operator" -#: awkgram.y:790 +#: awkgram.y:808 msgid "regular expression on right of comparison" msgstr "regulært udtryk i højreleddet af en sammenligning" -#: awkgram.y:857 +#: awkgram.y:875 msgid "non-redirected `getline' undefined inside END action" msgstr "ikke-omdirigeret \"getline\" udefineret inde i END-handling" -#: awkgram.y:884 +#: awkgram.y:902 msgid "call of `length' without parentheses is not portable" msgstr "kald af \"length\" uden parenteser er ikke portabelt" -#: awkgram.y:887 +#: awkgram.y:905 msgid "call of `length' without parentheses is deprecated by POSIX" msgstr "kald af \"length\" uden parenteser er forældet ifølge POSIX" -#: awkgram.y:940 +#: awkgram.y:958 msgid "use of non-array as array" msgstr "" -#: awkgram.y:942 +#: awkgram.y:960 msgid "invalid subscript expression" msgstr "ugyldig indeksudtryk" -#: awkgram.y:1140 +#: awkgram.y:1158 #, fuzzy msgid "unexpected newline or end of string" msgstr "uventet nylinjetegn" -#: awkgram.y:1235 +#: awkgram.y:1254 msgid "empty program text on command line" msgstr "tom programtekst på kommandolinjen" -#: awkgram.y:1292 +#: awkgram.y:1307 #, c-format msgid "can't open source file `%s' for reading (%s)" msgstr "kan ikke åbne kildefilen \"%s\" for læsning (%s)" -#: awkgram.y:1327 +#: awkgram.y:1384 #, c-format msgid "can't read sourcefile `%s' (%s)" msgstr "kan ikke læse kildefilen \"%s\" (%s)" -#: awkgram.y:1335 +#: awkgram.y:1392 #, c-format msgid "source file `%s' is empty" msgstr "kildefilen \"%s\" er tom" -#: awkgram.y:1537 awkgram.y:1647 awkgram.y:1665 awkgram.y:2015 awkgram.y:2100 +#: awkgram.y:1590 awkgram.y:1700 awkgram.y:1718 awkgram.y:2068 awkgram.y:2153 msgid "source file does not end in newline" msgstr "kildefilen slutter ikke med en ny linje" -#: awkgram.y:1601 +#: awkgram.y:1654 msgid "unterminated regexp ends with `\\' at end of file" msgstr "uafsluttet regulært udtryk slutter med \"\\\" i slutningen af filen" -#: awkgram.y:1621 +#: awkgram.y:1674 msgid "unterminated regexp" msgstr "uafsluttet regulært udtryk" -#: awkgram.y:1624 +#: awkgram.y:1677 msgid "unterminated regexp at end of file" msgstr "uafsluttet regulært udtryk i slutningen af filen" -#: awkgram.y:1691 +#: awkgram.y:1744 msgid "use of `\\ #...' line continuation is not portable" msgstr "Brug af \"\\ #...\" for linjefortsættelse er ikke portabelt" -#: awkgram.y:1703 +#: awkgram.y:1756 msgid "backslash not last character on line" msgstr "sidste tegn på linjen er ikke en omvendt skråstreg" -#: awkgram.y:1748 +#: awkgram.y:1801 msgid "POSIX does not allow operator `**='" msgstr "POSIX tillader ikke operatoren \"**=\"" -#: awkgram.y:1750 +#: awkgram.y:1803 msgid "old awk does not support operator `**='" msgstr "gamle awk understøtter ikke operatoren \"**=\"" -#: awkgram.y:1759 +#: awkgram.y:1812 msgid "POSIX does not allow operator `**'" msgstr "POSIX tillader ikke operatoren \"**\"" -#: awkgram.y:1761 +#: awkgram.y:1814 msgid "old awk does not support operator `**'" msgstr "gamle awk understøtter ikke operatoren \"**\"" -#: awkgram.y:1792 +#: awkgram.y:1845 msgid "operator `^=' is not supported in old awk" msgstr "operatoren \"^=\" understøttes ikke i gamle awk" -#: awkgram.y:1800 +#: awkgram.y:1853 msgid "operator `^' is not supported in old awk" msgstr "operatoren \"^\" understøttes ikke i gamle awk" -#: awkgram.y:1884 awkgram.y:1901 +#: awkgram.y:1937 awkgram.y:1954 msgid "unterminated string" msgstr "uafsluttet streng" -#: awkgram.y:2061 +#: awkgram.y:2114 #, c-format msgid "invalid char '%c' in expression" msgstr "ugyldigt tegn \"%c\" i udtryk" -#: awkgram.y:2121 +#: awkgram.y:2162 #, c-format msgid "`%s' is a gawk extension" msgstr "\"%s\" er en gawk-udvidelse" -#: awkgram.y:2124 +#: awkgram.y:2165 #, c-format msgid "`%s' is a Bell Labs extension" msgstr "\"%s\" er en Bell Labs-udvidelse" -#: awkgram.y:2127 +#: awkgram.y:2168 #, c-format msgid "POSIX does not allow `%s'" msgstr "POSIX tillader ikke \"%s\"" -#: awkgram.y:2131 +#: awkgram.y:2172 #, c-format msgid "`%s' is not supported in old awk" msgstr "\"%s\" understøttes ikke i gamle awk" -#: awkgram.y:2158 +#: awkgram.y:2198 msgid "`goto' considered harmful!\n" msgstr "\"goto\" anses for skadlig!\n" -#: awkgram.y:2220 +#: awkgram.y:2260 #, c-format msgid "%d is invalid as number of arguments for %s" msgstr "%d er et ugyldigt antal argumenter for %s" -#: awkgram.y:2239 awkgram.y:2242 +#: awkgram.y:2279 awkgram.y:2282 msgid "match: third argument is a gawk extension" msgstr "match: tredje argument er en gawk-udvidelse" -#: awkgram.y:2255 +#: awkgram.y:2295 #, c-format msgid "%s: string literal as last arg of substitute has no effect" msgstr "" "%s: bogstavelig streng som sidste argument til erstatning har ingen effekt" -#: awkgram.y:2258 +#: awkgram.y:2298 #, fuzzy, c-format msgid "%s third parameter is not a changeable object" msgstr "sub: tredje argument er ikke et ændringsbart objekt" -#: awkgram.y:2285 awkgram.y:2288 +#: awkgram.y:2325 awkgram.y:2328 msgid "close: second argument is a gawk extension" msgstr "close: andet argument er en gawk-udvidelse" -#: awkgram.y:2298 +#: awkgram.y:2338 msgid "use of dcgettext(_\"...\") is incorrect: remove leading underscore" msgstr "" "brug af dcgettext(_\"...\") er fejlagtigt: fjern det indledende " "understregningstegn" -#: awkgram.y:2313 +#: awkgram.y:2353 #, fuzzy msgid "use of dcngettext(_\"...\") is incorrect: remove leading underscore" msgstr "" "brug af dcgettext(_\"...\") er fejlagtigt: fjern det indledende " "understregningstegn" -#: awkgram.y:2384 +#: awkgram.y:2424 #, c-format msgid "function `%s': parameter #%d, `%s', duplicates parameter #%d" msgstr "funktionen \"%s\": parameter %d, \"%s\", er samme som parameter %d" -#: awkgram.y:2417 +#: awkgram.y:2457 #, c-format msgid "function `%s': parameter `%s' shadows global variable" msgstr "funktionen \"%s\": parameteren \"%s\" overskygger en global variabel" -#: awkgram.y:2529 +#: awkgram.y:2569 #, c-format msgid "could not open `%s' for writing (%s)" msgstr "kunne ikke åbne \"%s\" for skrivning (%s)" -#: awkgram.y:2530 profile.c:93 +#: awkgram.y:2570 profile.c:93 msgid "sending profile to standard error" msgstr "sender profilen til standard fejl" -#: awkgram.y:2562 +#: awkgram.y:2602 #, c-format msgid "%s: close failed (%s)" msgstr "%s: mislykkedes at lukke (%s)" -#: awkgram.y:2684 +#: awkgram.y:2723 msgid "shadow_funcs() called twice!" msgstr "shadow_funcs() kaldt to gange!" -#: awkgram.y:2711 +#: awkgram.y:2750 msgid "there were shadowed variables." msgstr "" -#: awkgram.y:2784 +#: awkgram.y:2823 #, c-format msgid "function `%s': can't use function name as parameter name" msgstr "funktionen \"%s\": kan ikke bruge funktionsnavn som parameternavn" -#: awkgram.y:2794 +#: awkgram.y:2833 #, c-format msgid "function name `%s' previously defined" msgstr "funktionsnavnet \"%s\" er allerede defineret" -#: awkgram.y:2945 awkgram.y:2951 +#: awkgram.y:2984 awkgram.y:2990 #, c-format msgid "function `%s' called but never defined" msgstr "funktionen \"%s\" kaldt, men aldrig defineret" -#: awkgram.y:2954 +#: awkgram.y:2993 #, c-format msgid "function `%s' defined but never called" msgstr "funktionen \"%s\" defineret, men aldrig kaldt" -#: awkgram.y:2981 +#: awkgram.y:3020 #, c-format msgid "regexp constant for parameter #%d yields boolean value" msgstr "konstant regulært udtryk for parameter %d giver en boolesk værdi" -#: awkgram.y:2994 -#, c-format +#: awkgram.y:3033 +#, fuzzy, c-format msgid "" "function `%s' called with space between name and `(',\n" -"%s" +"or used as a variable or an array" msgstr "" "funktionen \"%s\" kaldt med blanktegn mellem navnet og \"(\",\n" "%s" -#: awkgram.y:2996 -#, fuzzy -msgid "or used as a variable or an array" -msgstr "kan ikke bruge funktionsnavnet \"%s\" som variabel eller vektor" - -#: builtin.c:137 +#: builtin.c:149 #, c-format msgid "%s to \"%s\" failed (%s)" msgstr "%s til \"%s\" mislykkedes (%s)" -#: builtin.c:138 +#: builtin.c:150 msgid "standard output" msgstr "standard ud" -#: builtin.c:139 +#: builtin.c:151 msgid "reason unknown" msgstr "ukendt årsag" -#: builtin.c:152 +#: builtin.c:164 msgid "exp: received non-numeric argument" msgstr "exp: fik et ikke-numerisk argument" -#: builtin.c:158 +#: builtin.c:170 #, c-format msgid "exp: argument %g is out of range" msgstr "exp: argumentet %g er uden for tilladt område" -#: builtin.c:216 +#: builtin.c:228 #, c-format msgid "fflush: cannot flush: pipe `%s' opened for reading, not writing" msgstr "" "fflush: kan ikke spole: datakanalen \"%s\" åbnet for læsning, ikke skrivning" -#: builtin.c:219 +#: builtin.c:231 #, c-format msgid "fflush: cannot flush: file `%s' opened for reading, not writing" msgstr "fflush: kan ikke spole: filen \"%s\" åbnet for læsning, ikke skrivning" -#: builtin.c:231 +#: builtin.c:243 #, c-format msgid "fflush: `%s' is not an open file, pipe or co-process" msgstr "fflush: \"%s\" er ikke en åben fil, datakanal eller ko proces" -#: builtin.c:325 +#: builtin.c:338 msgid "index: received non-string first argument" msgstr "indeks: første argument er ikke en streng" -#: builtin.c:327 +#: builtin.c:340 msgid "index: received non-string second argument" msgstr "indeks: andet argument er ikke en streng" -#: builtin.c:437 +#: builtin.c:454 msgid "int: received non-numeric argument" msgstr "int: fik et ikke-numerisk argument" -#: builtin.c:454 +#: builtin.c:471 msgid "length: received non-string argument" msgstr "length: fik et argument som ikke er en streng" -#: builtin.c:470 +#: builtin.c:487 msgid "log: received non-numeric argument" msgstr "log: fik et ikke-numerisk argument" -#: builtin.c:473 +#: builtin.c:490 #, c-format msgid "log: received negative argument %g" msgstr "log: fik et negativt argument %g" -#: builtin.c:635 builtin.c:638 +#: builtin.c:654 builtin.c:657 msgid "must use `count$' on all formats or none" msgstr "" -#: builtin.c:740 +#: builtin.c:759 msgid "`$' is not permitted in awk formats" msgstr "\"$\" tillades ikke i awkformat" -#: builtin.c:746 +#: builtin.c:765 msgid "arg count with `$' must be > 0" msgstr "argumentantallet med \"$\" skal være > 0" -#: builtin.c:748 +#: builtin.c:767 #, fuzzy, c-format msgid "arg count %ld greater than total number of supplied arguments" msgstr "argumentantallet %d er større end antal givne argumenter" -#: builtin.c:750 +#: builtin.c:769 msgid "`$' not permitted after period in format" msgstr "\"$\" tillades ikke efter et punktum i formatet" -#: builtin.c:763 +#: builtin.c:782 msgid "no `$' supplied for positional field width or precision" msgstr "intet \"$\" angivet for positionsangivet feltbredde eller præcision" -#: builtin.c:821 +#: builtin.c:848 msgid "`l' is meaningless in awk formats; ignored" msgstr "\"l\" er meningsløst i awk-formater, ignoreret" -#: builtin.c:825 +#: builtin.c:852 msgid "`l' is not permitted in POSIX awk formats" msgstr "\"l\" tillades ikke i POSIX awk-formater" -#: builtin.c:836 +#: builtin.c:863 msgid "`L' is meaningless in awk formats; ignored" msgstr "\"L\" er meningsløst i awk-formater, ignoreret" -#: builtin.c:840 +#: builtin.c:867 msgid "`L' is not permitted in POSIX awk formats" msgstr "\"L\" tillades ikke i POSIX awk-formater" -#: builtin.c:851 +#: builtin.c:878 msgid "`h' is meaningless in awk formats; ignored" msgstr "\"h\" er meningsløst i awk-formater, ignoreret" -#: builtin.c:855 +#: builtin.c:882 msgid "`h' is not permitted in POSIX awk formats" msgstr "\"h\" tillades ikke i POSIX awk-formater" -#: builtin.c:1055 +#: builtin.c:1111 #, c-format msgid "[s]printf: value %g is out of range for `%%%c' format" msgstr "" -#: builtin.c:1108 +#: builtin.c:1171 msgid "not enough arguments to satisfy format string" msgstr "for få argumenter til formatstrengen" -#: builtin.c:1110 +#: builtin.c:1173 msgid "^ ran out for this one" msgstr "^ sluttede her" -#: builtin.c:1115 +#: builtin.c:1178 msgid "[s]printf: format specifier does not have control letter" msgstr "[s]printf: formatspecifiereren har intet kommandobogstav" -#: builtin.c:1118 +#: builtin.c:1181 msgid "too many arguments supplied for format string" msgstr "for mange argumenter til formatstrengen" -#: builtin.c:1184 builtin.c:1187 +#: builtin.c:1247 builtin.c:1250 msgid "printf: no arguments" msgstr "printf: ingen argumenter" -#: builtin.c:1211 +#: builtin.c:1274 msgid "sqrt: received non-numeric argument" msgstr "sqrt: fik ikke-numerisk argument" -#: builtin.c:1215 +#: builtin.c:1278 #, c-format msgid "sqrt: called with negative argument %g" msgstr "sqrt: kaldt med negativt argument %g" -#: builtin.c:1238 +#: builtin.c:1301 #, c-format msgid "substr: start index %g is invalid, using 1" msgstr "substr: startindeks %g er ugyldigt, bruger 1" -#: builtin.c:1243 +#: builtin.c:1306 #, c-format msgid "substr: non-integer start index %g will be truncated" msgstr "substr: startindeks %g som ikke er et heltal bliver trunkeret" -#: builtin.c:1262 +#: builtin.c:1325 #, fuzzy, c-format msgid "substr: length %g is not >= 1" msgstr "substr: længden %g er <= 0" -#: builtin.c:1264 +#: builtin.c:1327 #, fuzzy, c-format msgid "substr: length %g is not >= 0" msgstr "substr: længden %g er <= 0" -#: builtin.c:1271 +#: builtin.c:1334 #, c-format msgid "substr: non-integer length %g will be truncated" msgstr "substr: længden %g som ikke er et heltal bliver trunkeret" -#: builtin.c:1276 +#: builtin.c:1339 #, c-format msgid "substr: length %g too big for string indexing, truncating to %g" msgstr "" -#: builtin.c:1288 +#: builtin.c:1351 msgid "substr: source string is zero length" msgstr "substr: kildestrengen er tom" -#: builtin.c:1294 +#: builtin.c:1357 #, fuzzy, c-format msgid "substr: start index %g is past end of string" msgstr "substr: startindeks %d er forbi slutningen på strengen" -#: builtin.c:1302 +#: builtin.c:1365 #, fuzzy, c-format msgid "" "substr: length %g at start index %g exceeds length of first argument (%lu)" @@ -571,295 +571,321 @@ msgstr "" "substr: længden %d ved startindeks %d overskrider længden af første argument " "(%d)" -#: builtin.c:1337 +#: builtin.c:1400 #, fuzzy msgid "strftime: received non-string first argument" msgstr "strftime: fik et første argument som ikke er en streng" -#: builtin.c:1343 +#: builtin.c:1406 msgid "strftime: received empty format string" msgstr "strftime: fik en tom formatstreng" -#: builtin.c:1352 +#: builtin.c:1415 #, fuzzy msgid "strftime: received non-numeric second argument" msgstr "strftime: fik et ikke-numerisk andet argument" -#: builtin.c:1415 +#: builtin.c:1478 msgid "mktime: received non-string argument" msgstr "mktime: fik et argument som ikke er en streng" -#: builtin.c:1460 +#: builtin.c:1523 #, fuzzy msgid "system: received non-string argument" msgstr "system: fik et argument som ikke er en streng" -#: builtin.c:1581 eval.c:1883 +#: builtin.c:1644 eval.c:2019 #, fuzzy, c-format msgid "reference to uninitialized field `$%d'" msgstr "reference til ikke-initieret variabel \"%s\"" -#: builtin.c:1608 +#: builtin.c:1671 #, fuzzy msgid "tolower: received non-string argument" msgstr "tolower: fik et argument som ikke er en streng" -#: builtin.c:1657 +#: builtin.c:1720 #, fuzzy msgid "toupper: received non-string argument" msgstr "toupper: fik et argument som ikke er en streng" -#: builtin.c:1702 +#: builtin.c:1765 msgid "atan2: received non-numeric first argument" msgstr "atan2: fik et ikke-numerisk første argument" -#: builtin.c:1704 +#: builtin.c:1767 msgid "atan2: received non-numeric second argument" msgstr "atan2: fik et ikke-numerisk andet argument" -#: builtin.c:1723 +#: builtin.c:1786 msgid "sin: received non-numeric argument" msgstr "sin: fik et ikke-numerisk argument" -#: builtin.c:1739 +#: builtin.c:1802 msgid "cos: received non-numeric argument" msgstr "cos: fik et ikke-numerisk argument" -#: builtin.c:1788 +#: builtin.c:1852 msgid "srand: received non-numeric argument" msgstr "srand: fik et ikke-numerisk argument" -#: builtin.c:1823 +#: builtin.c:1887 msgid "match: third argument is not an array" msgstr "match: tredje argument er ikke en vektor" -#: builtin.c:2307 +#: builtin.c:2414 msgid "gensub: third argument of 0 treated as 1" msgstr "gensub: Nullet i tredje argument behandlet som et ét-tal" -#: builtin.c:2416 builtin.c:2418 +#: builtin.c:2572 msgid "lshift: received non-numeric first argument" msgstr "lshift: fik et ikke-numerisk første argument" -#: builtin.c:2420 +#: builtin.c:2574 +#, fuzzy +msgid "lshift: received non-numeric second argument" +msgstr "strftime: fik et ikke-numerisk andet argument" + +#: builtin.c:2580 #, c-format msgid "lshift(%lf, %lf): negative values will give strange results" msgstr "lshift(%lf, %lf): negative værdier vil give mærkelige resultater" -#: builtin.c:2422 +#: builtin.c:2582 #, c-format msgid "lshift(%lf, %lf): fractional values will be truncated" msgstr "lshift(%lf, %lf): flydendetalsværdier vil blive trunkeret" -#: builtin.c:2424 +#: builtin.c:2584 #, c-format msgid "lshift(%lf, %lf): too large shift value will give strange results" msgstr "" "lshift(%lf, %lf): for store skifteværdier vil give mærkelige resultater" -#: builtin.c:2453 builtin.c:2455 +#: builtin.c:2610 msgid "rshift: received non-numeric first argument" msgstr "rshift: fik et ikke-numerisk første argument" -#: builtin.c:2457 +#: builtin.c:2612 +#, fuzzy +msgid "rshift: received non-numeric second argument" +msgstr "strftime: fik et ikke-numerisk andet argument" + +#: builtin.c:2618 #, c-format msgid "rshift(%lf, %lf): negative values will give strange results" msgstr "rshift(%lf, %lf): negative værdier vil give mærkelige resultater" -#: builtin.c:2459 +#: builtin.c:2620 #, c-format msgid "rshift(%lf, %lf): fractional values will be truncated" msgstr "rshift(%lf, %lf): flydendetalsværdier vil blive trunkeret" -#: builtin.c:2461 +#: builtin.c:2622 #, c-format msgid "rshift(%lf, %lf): too large shift value will give strange results" msgstr "" "rshift(%lf, %lf): for store skifteværdier vil give mærkelige resultater" -#: builtin.c:2490 builtin.c:2492 +#: builtin.c:2648 msgid "and: received non-numeric first argument" msgstr "and: fik et ikke-numerisk første argument" -#: builtin.c:2494 +#: builtin.c:2650 +#, fuzzy +msgid "and: received non-numeric second argument" +msgstr "atan2: fik et ikke-numerisk andet argument" + +#: builtin.c:2656 #, c-format msgid "and(%lf, %lf): negative values will give strange results" msgstr "and(%lf, %lf): negative værdier vil give mærkelige resultater" -#: builtin.c:2496 +#: builtin.c:2658 #, c-format msgid "and(%lf, %lf): fractional values will be truncated" msgstr "and(%lf, %lf): flydendetalsværdier vil blive trunkeret" -#: builtin.c:2525 builtin.c:2527 +#: builtin.c:2684 msgid "or: received non-numeric first argument" msgstr "or: fik et ikke-numerisk første argument" -#: builtin.c:2529 +#: builtin.c:2686 +#, fuzzy +msgid "or: received non-numeric second argument" +msgstr "atan2: fik et ikke-numerisk andet argument" + +#: builtin.c:2692 #, c-format msgid "or(%lf, %lf): negative values will give strange results" msgstr "or(%lf, %lf): negative værdier vil give mærkelige resultater" -#: builtin.c:2531 +#: builtin.c:2694 #, c-format msgid "or(%lf, %lf): fractional values will be truncated" msgstr "or(%lf, %lf): flydendetalsværdier vil blive trunkeret" -#: builtin.c:2560 builtin.c:2562 +#: builtin.c:2720 msgid "xor: received non-numeric first argument" msgstr "xor: fik et ikke-numerisk første argument" -#: builtin.c:2564 +#: builtin.c:2722 +#, fuzzy +msgid "xor: received non-numeric second argument" +msgstr "atan2: fik et ikke-numerisk andet argument" + +#: builtin.c:2728 #, c-format msgid "xor(%lf, %lf): negative values will give strange results" msgstr "xor(%lf, %lf): negative værdier vil give mærkelige resultater" -#: builtin.c:2566 +#: builtin.c:2730 #, c-format msgid "xor(%lf, %lf): fractional values will be truncated" msgstr "xor(%lf, %lf): flydendetalsværdier vil blive trunkeret" -#: builtin.c:2594 +#: builtin.c:2754 msgid "compl: received non-numeric argument" msgstr "compl: fik et ikke-numerisk argument" -#: builtin.c:2596 +#: builtin.c:2760 #, c-format msgid "compl(%lf): negative value will give strange results" msgstr "compl(%lf): negative værdier vil give mærkelige resultater" -#: builtin.c:2598 +#: builtin.c:2762 #, c-format msgid "compl(%lf): fractional value will be truncated" msgstr "compl(%lf): flydendetalsværdier vil blive trunkeret" -#: builtin.c:2771 +#: builtin.c:2935 #, c-format msgid "dcgettext: `%s' is not a valid locale category" msgstr "dcgettext: \"%s\" er ikke en gyldig lokalekategori" -#: eval.c:266 +#: eval.c:303 #, c-format msgid "unknown nodetype %d" msgstr "ukendt nodetype %d" -#: eval.c:312 +#: eval.c:350 msgid "buffer overflow in genflags2str" msgstr "bufferoverløb i genflags2str" -#: eval.c:647 +#: eval.c:382 eval.c:388 profile.c:837 +#, c-format +msgid "attempt to use array `%s' in a scalar context" +msgstr "forsøg på at bruge vektoren \"%s\" i skalarsammenhæng" + +#: eval.c:730 #, fuzzy, c-format msgid "for loop: array `%s' changed size from %ld to %ld during loop execution" msgstr "" "for-løkke: vektoren \"%s\" ændrede størrelse fra %d til %d under løkke-" "udførelsen" -#: eval.c:668 +#: eval.c:751 msgid "`break' outside a loop is not portable" msgstr "\"break\" uden for en løkke er ikke portabelt" -#: eval.c:672 +#: eval.c:755 msgid "`break' outside a loop is not allowed" msgstr "\"break\" uden for en løkke er ikke tilladt" -#: eval.c:689 +#: eval.c:772 msgid "`continue' outside a loop is not portable" msgstr "\"continue\" uden for en løkke er ikke portabelt" -#: eval.c:693 +#: eval.c:776 msgid "`continue' outside a loop is not allowed" msgstr "\"continue\" uden for en løkke er ikke tilladt" -#: eval.c:727 +#: eval.c:810 msgid "`next' cannot be called from a BEGIN rule" msgstr "\"next\" kan ikke kaldes fra en BEGIN-regel" -#: eval.c:729 +#: eval.c:812 msgid "`next' cannot be called from an END rule" msgstr "\"next\" kan ikke kaldes fra en END-regel" -#: eval.c:738 +#: eval.c:821 msgid "`nextfile' cannot be called from a BEGIN rule" msgstr "\"nextfile\" kan ikke kaldes fra en BEGIN-regel" -#: eval.c:740 +#: eval.c:823 msgid "`nextfile' cannot be called from an END rule" msgstr "\"nextfile\" kan ikke kaldes fra en END-regel" -#: eval.c:785 +#: eval.c:872 msgid "statement has no effect" msgstr "kommandoen har ingen effekt" -#: eval.c:828 eval.c:1726 +#: eval.c:915 eval.c:1873 #, c-format msgid "can't use function name `%s' as variable or array" msgstr "kan ikke bruge funktionsnavnet \"%s\" som variabel eller vektor" -#: eval.c:835 eval.c:841 +#: eval.c:922 eval.c:928 #, c-format msgid "reference to uninitialized argument `%s'" msgstr "reference til ikke-initieret argument \"%s\"" -#: eval.c:848 eval.c:907 eval.c:1732 eval.c:1742 profile.c:807 -#, c-format -msgid "attempt to use array `%s' in a scalar context" -msgstr "forsøg på at bruge vektoren \"%s\" i skalarsammenhæng" - -#: eval.c:858 eval.c:1752 +#: eval.c:937 eval.c:1882 #, c-format msgid "reference to uninitialized variable `%s'" msgstr "reference til ikke-initieret variabel \"%s\"" -#: eval.c:1007 +#: eval.c:1083 msgid "" "concatenation: side effects in one expression have changed the length of " "another!" msgstr "" "concatenation: sideeffekter i et udtryk har ændret længden af et andet!" -#: eval.c:1032 +#: eval.c:1162 msgid "assignment used in conditional context" msgstr "tildeling brugt i sammenligningsammenhæng" -#: eval.c:1122 +#: eval.c:1252 msgid "division by zero attempted" msgstr "forsøgte at dividere med nul" -#: eval.c:1137 +#: eval.c:1267 #, c-format msgid "division by zero attempted in `%%'" msgstr "forsøgte at dividere med nul i \"%%\"" -#: eval.c:1152 profile.c:683 +#: eval.c:1282 profile.c:713 #, c-format msgid "illegal type (%s) in tree_eval" msgstr "ikke tilladt type (%s) i tree_eval" -#: eval.c:1328 +#: eval.c:1459 msgid "division by zero attempted in `/='" msgstr "forsøgte at dividere med nul i \"/=\"" -#: eval.c:1346 +#: eval.c:1477 #, c-format msgid "division by zero attempted in `%%='" msgstr "forsøgte at dividere med nul i \"%%=\"" -#: eval.c:1586 +#: eval.c:1738 #, c-format msgid "function `%s' called with more arguments than declared" msgstr "funktionen \"%s\" kaldt med flere argumenter end deklareret" -#: eval.c:1633 +#: eval.c:1782 #, c-format msgid "function `%s' not defined" msgstr "funktionen \"%s\" er ikke defineret" -#: eval.c:1639 +#: eval.c:1788 #, c-format msgid "function %s called\n" msgstr "funktionen %s kaldt\n" -#: eval.c:1698 +#: eval.c:1845 +#, c-format msgid "" "\n" "\t# Function Call Stack:\n" @@ -869,41 +895,42 @@ msgstr "" "\t# Funktionskaldsstak:\n" "\n" -#: eval.c:1701 +#: eval.c:1848 +#, c-format msgid "\t# -- main --\n" msgstr "\t# -- main --\n" -#: eval.c:1867 +#: eval.c:2003 msgid "attempt to field reference from non-numeric value" msgstr "forsøg på at feltreferere fra ikke-numerisk værdi" -#: eval.c:1869 +#: eval.c:2005 msgid "attempt to reference from null string" msgstr "forsøg på at referere fra tom streng" -#: eval.c:1875 +#: eval.c:2011 #, c-format msgid "attempt to access field %d" msgstr "forsøg på at få adgang til felt nummer %d" -#: eval.c:1896 eval.c:1903 profile.c:900 +#: eval.c:2032 eval.c:2039 profile.c:934 msgid "assignment is not allowed to result of builtin function" msgstr "tildeling er ikke tilladt til resultatet fra en indbygget funktion" -#: eval.c:1951 +#: eval.c:2103 msgid "`IGNORECASE' is a gawk extension" msgstr "\"IGNORECASE\" er en gawk-udvidelse" -#: eval.c:1980 +#: eval.c:2133 msgid "`BINMODE' is a gawk extension" msgstr "\"BINMODE\" er en gawk-udvidelse" -#: eval.c:2092 +#: eval.c:2255 #, c-format msgid "bad `%sFMT' specification `%s'" msgstr "fejlagtig \"%sFMT\"-specifikation \"%s\"" -#: eval.c:2170 +#: eval.c:2333 msgid "turning off `--lint' due to assignment to `LINT'" msgstr "deaktiverer \"--lint\" på grund af en tildeling til \"LINT\"" @@ -921,7 +948,56 @@ msgstr "extension: kan ikke msgid "extension: library `%s': cannot call function `%s' (%s)\n" msgstr "extension: bibliotek \"%s\": kan ikke kalde funktionen \"%s\" (%s)\n" -#: ext.c:183 +#: ext.c:102 +msgid "extension: missing function name" +msgstr "" + +#: ext.c:107 +#, fuzzy, c-format +msgid "extension: illegal character `%c' in function name `%s'" +msgstr "extension: bibliotek \"%s\": kan ikke kalde funktionen \"%s\" (%s)\n" + +#: ext.c:113 +#, fuzzy, c-format +msgid "extension: can't redefine function `%s'" +msgstr "extension: kan ikke åbne \"%s\" (%s)\n" + +#: ext.c:117 +#, fuzzy, c-format +msgid "extension: function `%s' already defined" +msgstr "funktionen \"%s\" er ikke defineret" + +#: ext.c:122 +#, c-format +msgid "extension: can't use gawk built-in `%s' as function name" +msgstr "" + +#: ext.c:124 +#, fuzzy, c-format +msgid "extension: function name `%s' previously defined" +msgstr "funktionsnavnet \"%s\" er allerede defineret" + +#: ext.c:201 +#, c-format +msgid "function `%s' defined to take no more than `%d' argument(s)" +msgstr "" + +#: ext.c:204 +#, fuzzy, c-format +msgid "function `%s': missing argument #%d" +msgstr "funktionen \"%s\" er ikke defineret" + +#: ext.c:214 +#, fuzzy, c-format +msgid "function `%s': argument #%d: attempt to use scalar as an array" +msgstr "forsøg på at bruge skalaren \"%s\" som vektor" + +#: ext.c:218 +#, c-format +msgid "function `%s': argument #%d: attempt to use array as a scalar" +msgstr "" + +#: ext.c:243 msgid "Operation Not Supported" msgstr "Operationen understøttes ikke" @@ -950,523 +1026,523 @@ msgstr "felt %d i FIELDWIDTHS skal v msgid "null string for `FS' is a gawk extension" msgstr "tom streng som \"FS\" er en gawk-udvidelse" -#: getopt.c:692 getopt.c:704 +#: getopt.c:692 getopt.c:711 #, c-format msgid "%s: option `%s' is ambiguous\n" msgstr "%s: flaget \"%s\" er flertydigt\n" -#: getopt.c:737 getopt.c:741 +#: getopt.c:744 getopt.c:748 #, c-format msgid "%s: option `--%s' doesn't allow an argument\n" msgstr "%s: flaget \"--%s\" tillader ikke noget argument\n" -#: getopt.c:750 getopt.c:755 +#: getopt.c:757 getopt.c:762 #, c-format msgid "%s: option `%c%s' doesn't allow an argument\n" msgstr "%s: flaget \"%c%s\" tillader ikke noget argument\n" -#: getopt.c:791 getopt.c:804 getopt.c:1093 getopt.c:1106 +#: getopt.c:807 getopt.c:829 getopt.c:1159 getopt.c:1181 #, c-format msgid "%s: option `%s' requires an argument\n" msgstr "%s: flaget \"%s\" kræver et argument\n" -#: getopt.c:842 getopt.c:845 +#: getopt.c:867 getopt.c:870 #, c-format msgid "%s: unrecognized option `--%s'\n" msgstr "%s: ukendt flag \"--%s\"\n" -#: getopt.c:853 getopt.c:856 +#: getopt.c:878 getopt.c:881 #, c-format msgid "%s: unrecognized option `%c%s'\n" msgstr "%s: ukendt flag \"%c%s\"\n" -#: getopt.c:903 getopt.c:906 +#: getopt.c:936 getopt.c:939 #, c-format msgid "%s: illegal option -- %c\n" msgstr "%s: ikke tilladt flag -- %c\n" -#: getopt.c:912 getopt.c:915 +#: getopt.c:945 getopt.c:948 #, c-format msgid "%s: invalid option -- %c\n" msgstr "%s: ugyldig flag -- %c\n" -#: getopt.c:962 getopt.c:973 getopt.c:1159 getopt.c:1172 main.c:434 +#: getopt.c:1003 getopt.c:1022 getopt.c:1234 getopt.c:1255 main.c:433 #, c-format msgid "%s: option requires an argument -- %c\n" msgstr "%s: flaget kræver et argument -- %c\n" -#: getopt.c:1025 getopt.c:1036 +#: getopt.c:1074 getopt.c:1093 #, c-format msgid "%s: option `-W %s' is ambiguous\n" msgstr "%s: flaget \"-W %s\" er flertydigt\n" -#: getopt.c:1060 getopt.c:1072 +#: getopt.c:1117 getopt.c:1138 #, c-format msgid "%s: option `-W %s' doesn't allow an argument\n" msgstr "%s: flaget \"-W %s\" tillader ikke noget argument\n" -#: io.c:305 +#: io.c:308 #, c-format msgid "cannot open file `%s' for reading (%s)" msgstr "kan ikke åbne filen \"%s\" for læsning (%s)" -#: io.c:392 +#: io.c:395 #, c-format msgid "close of fd %d (`%s') failed (%s)" msgstr "lukning af fd %d (\"%s\") mislykkedes (%s)" -#: io.c:530 +#: io.c:533 #, c-format msgid "invalid tree type %s in redirect()" msgstr "ugyldig trætype %s i redirect()" -#: io.c:536 +#: io.c:539 #, c-format msgid "expression in `%s' redirection only has numeric value" msgstr "udtrykket i \"%s\"-omdirigering har kun numerisk værdi" -#: io.c:542 +#: io.c:545 #, c-format msgid "expression for `%s' redirection has null string value" msgstr "udtrykket for \"%s\"-omdirigering har en tom streng som værdi" -#: io.c:547 +#: io.c:550 #, c-format msgid "filename `%s' for `%s' redirection may be result of logical expression" msgstr "" "filnavnet \"%s\" for \"%s\"-omdirigering kan være resultatet af et logisk " "udtryk" -#: io.c:569 +#: io.c:588 #, c-format msgid "unnecessary mixing of `>' and `>>' for file `%.*s'" msgstr "unødig blanding af \">\" og \">>\" for filen \"%.*s\"" -#: io.c:621 +#: io.c:640 #, c-format msgid "can't open pipe `%s' for output (%s)" msgstr "kan ikke åbne røret \"%s\" for udskrivning (%s)" -#: io.c:630 +#: io.c:649 #, c-format msgid "can't open pipe `%s' for input (%s)" msgstr "kan ikke åbne røret \"%s\" for indtastning (%s)" -#: io.c:643 +#: io.c:662 #, c-format msgid "can't open two way socket `%s' for input/output (%s)" msgstr "kan ikke åbne tovejssoklen \"%s\" for ind-/uddata (%s)" -#: io.c:647 +#: io.c:666 #, c-format msgid "can't open two way pipe `%s' for input/output (%s)" msgstr "kan ikke åbne tovejsrøret \"%s\" for ind-/uddata (%s)" -#: io.c:723 +#: io.c:742 #, c-format msgid "can't redirect from `%s' (%s)" msgstr "kan ikke omdirigere fra \"%s\" (%s)" -#: io.c:726 +#: io.c:745 #, c-format msgid "can't redirect to `%s' (%s)" msgstr "kan ikke omdirigere til \"%s\" (%s)" -#: io.c:765 +#: io.c:784 msgid "" "reached system limit for open files: starting to multiplex file descriptors" msgstr "" "nåede systembegrænsningen for åbne filer: begynder at multiplekse " "fildeskriptorer" -#: io.c:777 +#: io.c:800 #, c-format msgid "close of `%s' failed (%s)." msgstr "lukning af \"%s\" mislykkedes (%s)" -#: io.c:784 +#: io.c:808 msgid "too many pipes or input files open" msgstr "for mange rør eller inddatafiler åbne" -#: io.c:807 +#: io.c:831 msgid "close: second argument must be `to' or `from'" msgstr "close: andet argument skal være \"to\" eller \"from\"" -#: io.c:821 +#: io.c:845 #, c-format msgid "close: `%.*s' is not an open file, pipe or co-process" msgstr "close: \"%.*s\" er ikke en åben fil, datakanal eller ko-proces" -#: io.c:825 +#: io.c:849 msgid "close of redirection that was never opened" msgstr "lukning af omdirigering som aldrig åbnedes" -#: io.c:862 +#: io.c:945 #, c-format msgid "close: redirection `%s' not opened with `|&', second argument ignored" msgstr "" "close: omdirigeringen \"%s\" åbnedes ikke med \"|&\", andet argument " "ignoreret" -#: io.c:924 +#: io.c:960 #, c-format msgid "failure status (%d) on pipe close of `%s' (%s)" msgstr "fejlstatus (%d) fra rørlukning af \"%s\" (%s)" -#: io.c:927 +#: io.c:963 #, c-format msgid "failure status (%d) on file close of `%s' (%s)" msgstr "fejlstatus (%d) fra fillukning af \"%s\" (%s)" -#: io.c:946 +#: io.c:983 #, c-format msgid "no explicit close of socket `%s' provided" msgstr "ingen eksplicit lukning af soklen \"%s\" angivet" -#: io.c:949 +#: io.c:986 #, c-format msgid "no explicit close of co-process `%s' provided" msgstr "ingen eksplicit lukning af ko-processen \"%s\" angivet" -#: io.c:952 +#: io.c:989 #, c-format msgid "no explicit close of pipe `%s' provided" msgstr "ingen eksplicit lukning af røret \"%s\" angivet" -#: io.c:955 +#: io.c:992 #, c-format msgid "no explicit close of file `%s' provided" msgstr "ingen eksplicit lukning af filen \"%s\" angivet" -#: io.c:984 io.c:1038 +#: io.c:1021 io.c:1075 #, c-format msgid "error writing standard output (%s)" msgstr "fejl ved skrivning til standard ud (%s)" -#: io.c:988 io.c:1042 +#: io.c:1025 io.c:1079 #, c-format msgid "error writing standard error (%s)" msgstr "fejl ved skrivning til standard fejl (%s)" -#: io.c:996 +#: io.c:1033 #, c-format msgid "pipe flush of `%s' failed (%s)." msgstr "rørspuling af \"%s\" mislykkedes (%s)" -#: io.c:999 +#: io.c:1036 #, c-format msgid "co-process flush of pipe to `%s' failed (%s)." msgstr "ko-processpuling af røret til \"%s\" mislykkedes (%s)" -#: io.c:1002 +#: io.c:1039 #, c-format msgid "file flush of `%s' failed (%s)." msgstr "filspuling af \"%s\" mislykkedes (%s)" -#: io.c:1161 +#: io.c:1198 msgid "/inet/raw client not ready yet, sorry" msgstr "/inet/raw-klient er desværre ikke klar endnu" -#: io.c:1163 io.c:1200 +#: io.c:1200 io.c:1237 msgid "only root may use `/inet/raw'." msgstr "kun root kan bruge \"/inet/raw\"." -#: io.c:1198 +#: io.c:1235 msgid "/inet/raw server not ready yet, sorry" msgstr "/inet/raw-server er desværre ikke klar endnu" -#: io.c:1288 +#: io.c:1325 #, c-format msgid "no (known) protocol supplied in special filename `%s'" msgstr "ingen (kendt) protokol opgivet i special-filnavn \"%s\"" -#: io.c:1306 +#: io.c:1343 #, c-format msgid "special file name `%s' is incomplete" msgstr "special-filnavn \"%s\" er ufuldstændigt" -#: io.c:1318 +#: io.c:1355 #, c-format msgid "local port invalid in `%s'" msgstr "lokal port ugyldig i \"%s\"" -#: io.c:1330 +#: io.c:1367 msgid "must supply a remote hostname to `/inet'" msgstr "skal angive et fjernmaskinenavn til \"/inet\"" -#: io.c:1345 +#: io.c:1382 msgid "must supply a remote port to `/inet'" msgstr "skal angive en fjernport til \"/inet\"" -#: io.c:1351 +#: io.c:1388 #, c-format msgid "remote port invalid in `%s'" msgstr "fjernporten ugyldig i \"%s\"" -#: io.c:1361 +#: io.c:1398 msgid "TCP/IP communications are not supported" msgstr "TCP/IP-kommunikation understøttes ikke" -#: io.c:1370 io.c:1551 +#: io.c:1407 io.c:1588 #, c-format msgid "file `%s' is a directory" msgstr "filen \"%s\" er et katalog" -#: io.c:1440 +#: io.c:1477 #, c-format msgid "use `PROCINFO[\"%s\"]' instead of `%s'" msgstr "brug \"PROCINFO[\"%s\"]\" i stedet for \"%s\"" -#: io.c:1472 +#: io.c:1509 msgid "use `PROCINFO[...]' instead of `/dev/user'" msgstr "brug \"PROCINFO[...]\" i stedet for \"dev/user\"" -#: io.c:1537 io.c:1711 +#: io.c:1574 io.c:1748 #, c-format msgid "could not open `%s', mode `%s'" msgstr "kunne ikke åbne \"%s\", tilstand \"%s\"" -#: io.c:1762 +#: io.c:1799 #, fuzzy, c-format msgid "close of master pty failed (%s)" msgstr "lukning af røret mislykkedes (%s)" -#: io.c:1764 io.c:1916 io.c:2068 +#: io.c:1801 io.c:1953 io.c:2105 #, c-format msgid "close of stdout in child failed (%s)" msgstr "lukning af standard ud i barnet mislykkedes (%s)" -#: io.c:1767 +#: io.c:1804 #, fuzzy, c-format msgid "moving slave pty to stdout in child failed (dup: %s)" msgstr "flytning af rør til standard ud i barnet mislykkedes (dup: %s)" -#: io.c:1769 io.c:1921 +#: io.c:1806 io.c:1958 #, c-format msgid "close of stdin in child failed (%s)" msgstr "lukning af standard ind i barnet mislykkedes (%s)" -#: io.c:1772 +#: io.c:1809 #, fuzzy, c-format msgid "moving slave pty to stdin in child failed (dup: %s)" msgstr "flytning af rør til standard ind i barnet mislykkedes (dup: %s)" -#: io.c:1774 io.c:1793 +#: io.c:1811 io.c:1830 #, fuzzy, c-format msgid "close of slave pty failed (%s)" msgstr "lukning af røret mislykkedes (%s)" -#: io.c:1867 io.c:1919 io.c:2049 io.c:2071 +#: io.c:1904 io.c:1956 io.c:2086 io.c:2108 #, c-format msgid "moving pipe to stdout in child failed (dup: %s)" msgstr "flytning af rør til standard ud i barnet mislykkedes (dup: %s)" -#: io.c:1871 io.c:1924 +#: io.c:1908 io.c:1961 #, c-format msgid "moving pipe to stdin in child failed (dup: %s)" msgstr "flytning af rør til standard ind i barnet mislykkedes (dup: %s)" -#: io.c:1888 io.c:2062 +#: io.c:1925 io.c:2099 msgid "restoring stdout in parent process failed\n" msgstr "genskabelse af standard ud i forælderprocessen mislykkedes\n" -#: io.c:1893 +#: io.c:1930 msgid "restoring stdin in parent process failed\n" msgstr "genskabelse af standard ind i forælderprocessen mislykkedes\n" -#: io.c:1927 io.c:2073 io.c:2084 +#: io.c:1964 io.c:2110 io.c:2121 #, c-format msgid "close of pipe failed (%s)" msgstr "lukning af røret mislykkedes (%s)" -#: io.c:1972 +#: io.c:2009 msgid "`|&' not supported" msgstr "\"|&\" understøttes ikke" -#: io.c:2039 +#: io.c:2076 #, c-format msgid "cannot open pipe `%s' (%s)" msgstr "kan ikke åbne røret \"%s\" (%s)" -#: io.c:2080 +#: io.c:2117 #, c-format msgid "cannot create child process for `%s' (fork: %s)" msgstr "kan ikke oprette barneproces for \"%s\" (fork: %s)" -#: io.c:2423 +#: io.c:2460 #, c-format msgid "data file `%s' is empty" msgstr "datafilen \"%s\" er tom" -#: io.c:2466 io.c:2474 +#: io.c:2503 io.c:2511 msgid "could not allocate more input memory" msgstr "" -#: io.c:2832 io.c:2895 +#: io.c:2869 io.c:2932 #, c-format msgid "error reading input file `%s': %s" msgstr "fejl ved læsning af inddatafilen \"%s\": %s" -#: io.c:3020 +#: io.c:3057 msgid "multicharacter value of `RS' is a gawk extension" msgstr "flertegnsværdien af \"RS\" er en gawk-udvidelse" -#: main.c:324 +#: main.c:323 msgid "`-m[fr]' option irrelevant in gawk" msgstr "\"-m[fr]\"-flaget er irrelevant i gawk" -#: main.c:326 +#: main.c:325 msgid "-m option usage: `-m[fr] nnn'" msgstr "-m-flagets brug: \"-m[fr] nnn\"" -#: main.c:343 +#: main.c:342 #, c-format msgid "%s: option `-W %s' unrecognized, ignored\n" msgstr "%s: flaget \"-W %s\" ukendt, ignoreret\n" -#: main.c:380 +#: main.c:379 msgid "empty argument to `--source' ignored" msgstr "tomt argument til \"--source\" ignoreret" -#: main.c:451 +#: main.c:450 msgid "environment variable `POSIXLY_CORRECT' set: turning on `--posix'" msgstr "miljøvariablen \"POSIXLY_CORRECT\" sat: aktiverer \"--posix\"" -#: main.c:456 +#: main.c:455 msgid "`--posix' overrides `--traditional'" msgstr "\"--posix\" tilsidesætter \"--traditional\"" -#: main.c:467 +#: main.c:466 msgid "`--posix'/`--traditional' overrides `--non-decimal-data'" msgstr "\"--posix\"/\"--traditional\" tilsidesætter \"--non-decimal-data\"" -#: main.c:471 +#: main.c:470 #, fuzzy, c-format msgid "running %s setuid root may be a security problem" msgstr "at køre %s setuid root kan være et sikkerhedsproblem" -#: main.c:512 +#: main.c:511 #, fuzzy, c-format msgid "can't set binary mode on stdin (%s)" msgstr "kan ikke sætte tilstand på standard ind (%s)" -#: main.c:515 +#: main.c:514 #, fuzzy, c-format msgid "can't set binary mode on stdout (%s)" msgstr "kan ikke sætte tilstand på standard ud (%s)" -#: main.c:517 +#: main.c:516 #, fuzzy, c-format msgid "can't set binary mode on stderr (%s)" msgstr "kan ikke sætte tilstand på standard fejl (%s)" -#: main.c:547 +#: main.c:546 msgid "no program text at all!" msgstr "ingen programtekst overhovedet!" -#: main.c:620 +#: main.c:623 #, c-format msgid "Usage: %s [POSIX or GNU style options] -f progfile [--] file ...\n" msgstr "Brug: %s [POSIX- eller GNU-stilflag] -f progfil [--] fil ...\n" -#: main.c:622 +#: main.c:625 #, c-format msgid "Usage: %s [POSIX or GNU style options] [--] %cprogram%c file ...\n" msgstr "Brug: %s [POSIX- eller GNU-stilflag] %cprogram%c fil ...\n" -#: main.c:627 +#: main.c:630 msgid "POSIX options:\t\tGNU long options:\n" msgstr "POSIX-flag:\t\tGNU lange flag:\n" -#: main.c:628 +#: main.c:631 msgid "\t-f progfile\t\t--file=progfile\n" msgstr "\t-f progfil\t\t--file=progfil\n" -#: main.c:629 +#: main.c:632 msgid "\t-F fs\t\t\t--field-separator=fs\n" msgstr "\t-F fs\t\t\t--field-separator=fs\n" -#: main.c:630 +#: main.c:633 msgid "\t-v var=val\t\t--assign=var=val\n" msgstr "\t-v var=værdi\t\t--assign=var=værdi\n" -#: main.c:631 +#: main.c:634 msgid "\t-m[fr] val\n" msgstr "\t-m[fr] værdi\n" -#: main.c:632 +#: main.c:635 msgid "\t-W compat\t\t--compat\n" msgstr "\t-W compat\t\t--compat\n" -#: main.c:633 +#: main.c:636 msgid "\t-W copyleft\t\t--copyleft\n" msgstr "\t-W copyleft\t\t--copyleft\n" -#: main.c:634 +#: main.c:637 msgid "\t-W copyright\t\t--copyright\n" msgstr "\t-W copyright\t\t--copyright\n" -#: main.c:635 +#: main.c:638 msgid "\t-W dump-variables[=file]\t--dump-variables[=file]\n" msgstr "\t-W dump-variables[=fil]\t--dump-variables[=fil]\n" -#: main.c:636 +#: main.c:639 msgid "\t-W gen-po\t\t--gen-po\n" msgstr "\t-W gen-po\t\t--gen-po\n" -#: main.c:637 +#: main.c:640 msgid "\t-W help\t\t\t--help\n" msgstr "\t-W help\t\t\t--help\n" -#: main.c:638 +#: main.c:641 msgid "\t-W lint[=fatal]\t\t--lint[=fatal]\n" msgstr "\t-W lint[=fatal]\t\t--lint[=fatal]\n" -#: main.c:639 +#: main.c:642 msgid "\t-W lint-old\t\t--lint-old\n" msgstr "\t-W lint-old\t\t--lint-old\n" -#: main.c:640 +#: main.c:643 msgid "\t-W non-decimal-data\t--non-decimal-data\n" msgstr "\t-W non-decimal-data\t--non-decimal-data\n" -#: main.c:642 +#: main.c:645 msgid "\t-W nostalgia\t\t--nostalgia\n" msgstr "\t-W nostalgia\t\t--nostalgia\n" -#: main.c:645 +#: main.c:648 msgid "\t-W parsedebug\t\t--parsedebug\n" msgstr "\t-W parsedebug\t\t--parsedebug\n" -#: main.c:647 +#: main.c:650 msgid "\t-W profile[=file]\t--profile[=file]\n" msgstr "\t-W profile[=fil]\t--profile[=fil]\n" -#: main.c:648 +#: main.c:651 msgid "\t-W posix\t\t--posix\n" msgstr "\t-W posix\t\t--posix\n" -#: main.c:649 +#: main.c:652 msgid "\t-W re-interval\t\t--re-interval\n" msgstr "\t-W re-interval\t\t--re-interval\n" -#: main.c:650 +#: main.c:653 msgid "\t-W source=program-text\t--source=program-text\n" msgstr "\t-W source=programtekst\t--source=programtekst\n" -#: main.c:651 +#: main.c:654 msgid "\t-W traditional\t\t--traditional\n" msgstr "\t-W traditional\t\t--traditional\n" -#: main.c:652 +#: main.c:655 msgid "\t-W usage\t\t--usage\n" msgstr "\t-W usage\t\t--usage\n" -#: main.c:653 +#: main.c:656 msgid "\t-W version\t\t--version\n" msgstr "\t-W version\t\t--version\n" -#: main.c:657 +#: main.c:660 #, fuzzy msgid "" "\n" @@ -1477,21 +1553,21 @@ msgstr "" "sektionen \"Reporting Problems and Bugs\" i den trykte version.\n" "Rapportér synpunkter på oversættelsen til .\n" -#: main.c:661 +#: main.c:664 msgid "" "gawk is a pattern scanning and processing language.\n" "By default it reads standard input and writes standard output.\n" "\n" msgstr "" -#: main.c:665 +#: main.c:668 msgid "" "Examples:\n" "\tgawk '{ sum += $1 }; END { print sum }' file\n" "\tgawk -F: '{ print $1 }' /etc/passwd\n" msgstr "" -#: main.c:682 +#: main.c:685 #, c-format msgid "" "Copyright (C) 1989, 1991-%d Free Software Foundation.\n" @@ -1510,7 +1586,7 @@ msgstr "" "enhver senere version.\n" "\n" -#: main.c:690 +#: main.c:693 msgid "" "This program is distributed in the hope that it will be useful,\n" "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" @@ -1524,7 +1600,7 @@ msgstr "" "General Public License for yderligere information.\n" "\n" -#: main.c:696 +#: main.c:699 msgid "" "You should have received a copy of the GNU General Public License\n" "along with this program; if not, write to the Free Software\n" @@ -1534,51 +1610,52 @@ msgstr "" "med dette program. Hvis ikke, så skriv til Free Software Foundation,\n" "Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n" -#: main.c:730 +#: main.c:733 msgid "-Ft does not set FS to tab in POSIX awk" msgstr "-Ft sætter ikke FS til tab i POSIX-awk" -#: main.c:956 +#: main.c:962 #, c-format msgid "" "%s: `%s' argument to `-v' not in `var=value' form\n" "\n" msgstr "" -#: main.c:976 +#: main.c:982 #, c-format msgid "`%s' is not a legal variable name" msgstr "" -#: main.c:979 +#: main.c:985 #, c-format msgid "`%s' is not a variable name, looking for file `%s=%s'" msgstr "" -#: main.c:1012 +#: main.c:1018 msgid "floating point exception" msgstr "flydendetalsundtagelse" -#: main.c:1019 +#: main.c:1025 msgid "fatal error: internal error" msgstr "fatal fejl: intern fejl" -#: main.c:1069 +#: main.c:1075 #, c-format msgid "no pre-opened fd %d" msgstr "ingen for-åbnet fd %d" -#: main.c:1074 +#: main.c:1082 #, c-format msgid "could not pre-open /dev/null for fd %d" msgstr "kunne ikke for-åbne /dev/null for fd %d" -#: main.c:1097 main.c:1106 +#: main.c:1105 main.c:1114 #, c-format msgid "could not find groups: %s" msgstr "kunne ikke finde grupper: %s" #: msg.c:54 +#, c-format msgid "cmd. line:" msgstr "kommandolinje:" @@ -1598,19 +1675,19 @@ msgstr "fatal: " msgid "can't convert string to float" msgstr "kan ikke konvertere en streng til flydende tal" -#: node.c:355 +#: node.c:357 msgid "backslash at end of string" msgstr "omvendt skråstreg i slutningen af strengen" -#: node.c:539 +#: node.c:541 msgid "POSIX does not allow `\\x' escapes" msgstr "POSIX tillader ikke \"\\x\"-kontrolsekvenser" -#: node.c:545 +#: node.c:547 msgid "no hex digits in `\\x' escape sequence" msgstr "ingen heksadecimale cifre i \"\\x\"-kontrolsekvenser" -#: node.c:579 +#: node.c:581 #, c-format msgid "escape sequence `\\%c' treated as plain `%c'" msgstr "kontrolsekvensen \"\\%c\" behandlet som kun \"%c\"" @@ -1625,21 +1702,27 @@ msgstr "%s %s \"%s\": kunne ikke s msgid "could not open `%s' for writing: %s" msgstr "kunne ikke åbne \"%s\" for skrivning: %s" -#: profile.c:449 +#: profile.c:467 #, fuzzy, c-format msgid "internal error: %s with null vname" msgstr "intern fejl: Node_var med null vname" -#: profile.c:512 +#: profile.c:530 msgid "# treated internally as `delete'" msgstr "" -#: profile.c:1162 +#: profile.c:1167 +#, c-format +msgid "# this is a dynamically loaded extension function" +msgstr "" + +#: profile.c:1198 #, c-format msgid "\t# gawk profile, created %s\n" msgstr "\t# gawkprofil, oprettet %s\n" -#: profile.c:1165 +#: profile.c:1201 +#, c-format msgid "" "\t# BEGIN block(s)\n" "\n" @@ -1647,7 +1730,8 @@ msgstr "" "\t# BEGIN-blok\n" "\n" -#: profile.c:1175 +#: profile.c:1211 +#, c-format msgid "" "\t# Rule(s)\n" "\n" @@ -1655,7 +1739,8 @@ msgstr "" "\t# Regel/regler\n" "\n" -#: profile.c:1181 +#: profile.c:1217 +#, c-format msgid "" "\t# END block(s)\n" "\n" @@ -1663,7 +1748,8 @@ msgstr "" "\t# END-blok\n" "\n" -#: profile.c:1201 +#: profile.c:1237 +#, c-format msgid "" "\n" "\t# Functions, listed alphabetically\n" @@ -1671,88 +1757,87 @@ msgstr "" "\n" "\t# Funktioner, listede alfabetisk\n" -#: profile.c:1413 +#: profile.c:1452 #, c-format msgid "unexpected type %s in prec_level" msgstr "uventet type %s i prec_level" -#: re.c:193 -#, c-format -msgid "regex match failed, not enough memory to match string \"%.*s%s\"" -msgstr "" - -#: regcomp.c:136 +#: regcomp.c:150 msgid "Success" msgstr "Lykkedes" -#: regcomp.c:139 +#: regcomp.c:153 msgid "No match" msgstr "Mislykkedes" -#: regcomp.c:142 +#: regcomp.c:156 msgid "Invalid regular expression" msgstr "Ugyldigt regulært udtryk" -#: regcomp.c:145 +#: regcomp.c:159 msgid "Invalid collation character" msgstr "Ugyldigt kollationeringstegn" -#: regcomp.c:148 +#: regcomp.c:162 msgid "Invalid character class name" msgstr "Ugyldigt tegnklassenavn" -#: regcomp.c:151 +#: regcomp.c:165 msgid "Trailing backslash" msgstr "Efterfølgende omvendt skråstreg" -#: regcomp.c:154 +#: regcomp.c:168 msgid "Invalid back reference" msgstr "Ugyldig bagudreference" -#: regcomp.c:157 +#: regcomp.c:171 msgid "Unmatched [ or [^" msgstr "Ubalanceret [ eller [^" -#: regcomp.c:160 +#: regcomp.c:174 msgid "Unmatched ( or \\(" msgstr "Ubalanceret ( eller \\(" -#: regcomp.c:163 +#: regcomp.c:177 msgid "Unmatched \\{" msgstr "Ubalanceret \\{" -#: regcomp.c:166 +#: regcomp.c:180 msgid "Invalid content of \\{\\}" msgstr "Ugyldigt indhold i \\{\\}" -#: regcomp.c:169 +#: regcomp.c:183 msgid "Invalid range end" msgstr "Ugyldig intervalslutning" -#: regcomp.c:172 +#: regcomp.c:186 msgid "Memory exhausted" msgstr "Hukommelsen opbrugt" -#: regcomp.c:175 +#: regcomp.c:189 msgid "Invalid preceding regular expression" msgstr "Ugyldigt foregående regulært udtryk" -#: regcomp.c:178 +#: regcomp.c:192 msgid "Premature end of regular expression" msgstr "For tidligt slut på regulært udtryk" -#: regcomp.c:181 +#: regcomp.c:195 msgid "Regular expression too big" msgstr "Regulært udtryk for stort" -#: regcomp.c:184 +#: regcomp.c:198 msgid "Unmatched ) or \\)" msgstr "Ubalanceret ) eller \\)" -#: regcomp.c:621 +#: regcomp.c:668 msgid "No previous regular expression" msgstr "Intet foregående regulært udtryk" +#, fuzzy +#~ msgid "or used as a variable or an array" +#~ msgstr "kan ikke bruge funktionsnavnet \"%s\" som variabel eller vektor" + #, fuzzy #~ msgid "substr: length %g is < 0" #~ msgstr "substr: længden %g er <= 0" @@ -1791,9 +1876,6 @@ msgstr "Intet foreg #~ msgid "or used in other expression context" #~ msgstr "eller brugt i andre udtrykssammenhænge" -#~ msgid "attempt to use function `%s' as array" -#~ msgstr "forsøg på at bruge funktionen \"%s\" som vektor" - #~ msgid "`%s' is a function, assignment is not allowed" #~ msgstr "\"%s\" er en funktion, tildeling er ikke tilladt" diff --git a/po/de.gmo b/po/de.gmo index 667d62d8f..e053b72ec 100644 Binary files a/po/de.gmo and b/po/de.gmo differ diff --git a/po/de.po b/po/de.po index 6e2886237..d0fad61f3 100644 --- a/po/de.po +++ b/po/de.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: gawk 3.1.0\n" "Report-Msgid-Bugs-To: arnold@skeeve.com\n" -"POT-Creation-Date: 2003-07-07 11:20-0700\n" +"POT-Creation-Date: 2004-07-15 13:02+0300\n" "PO-Revision-Date: 2002-04-03 18:55+02:00\n" "Last-Translator: Christian Kirsch \n" "Language-Team: German \n" @@ -15,56 +15,61 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" #: array.c:112 +#, fuzzy, c-format +msgid "attempt to use function `%s' as an array" +msgstr "Versuch, die Funktion '%s' als Array zu verwenden." + +#: array.c:115 #, c-format msgid "attempt to use scalar parameter `%s' as an array" msgstr "Versuch den skalaren Parameter '%s' als Array zu benutzen." -#: array.c:113 +#: array.c:118 #, c-format msgid "attempt to use scalar `%s' as array" msgstr "Versuch, Skalar '%s' als Array zu verwenden." -#: array.c:151 +#: array.c:156 #, fuzzy, c-format msgid "from %s" msgstr "%s (von %s)" -#: array.c:506 +#: array.c:511 #, c-format msgid "reference to uninitialized element `%s[\"%s\"]'" msgstr "Bezug auf nicht-initialisiertes Element »%s[\"%s\"]«" -#: array.c:512 +#: array.c:517 #, c-format msgid "subscript of array `%s' is null string" msgstr "Index in Array »%s« ist Nullstring." -#: array.c:609 +#: array.c:621 #, c-format msgid "delete: index `%s' not in array `%s'" msgstr "delete: Index »%s« nicht in Feld »%s« vorhanden." -#: array.c:769 +#: array.c:791 #, c-format msgid "%s: empty (null)\n" msgstr "%s: leer (Null)\n" -#: array.c:774 +#: array.c:796 #, c-format msgid "%s: empty (zero)\n" msgstr "%s: leer (0)\n" -#: array.c:778 +#: array.c:800 #, c-format msgid "%s: table_size = %d, array_size = %d\n" msgstr "%s: Table_size = %d, array_size = %d\n" -#: array.c:807 +#: array.c:829 #, fuzzy, c-format msgid "%s: is parameter\n" msgstr "%s: ist ein Parameter\n" -#: array.c:812 +#: array.c:834 #, c-format msgid "%s: array_ref to %s\n" msgstr "%s: Array-Referenz auf %s\n" @@ -91,488 +96,483 @@ msgstr "" "Konstanter Regulärer Ausdruck '/%s' sieht wie ein C-Kommentar aus, ist aber " "keiner." -#: awkgram.y:340 awkgram.y:615 +#: awkgram.y:341 awkgram.y:619 msgid "statement may have no effect" msgstr "Statement möglicherweise ohne Effekt." -#: awkgram.y:435 awkgram.y:455 +#: awkgram.y:436 awkgram.y:456 #, fuzzy, c-format msgid "`%s' used in %s action" msgstr "'next' in BEGIN- oder END-Aktion benutzt." -#: awkgram.y:448 awkgram.y:451 +#: awkgram.y:449 awkgram.y:452 msgid "`nextfile' is a gawk extension" msgstr "'nextfile' ist eine gawk-Erweiterung." -#: awkgram.y:465 +#: awkgram.y:466 msgid "`return' used outside function context" msgstr "'return' außerhalb einer Funktion benutzt." -#: awkgram.y:504 +#: awkgram.y:508 msgid "plain `print' in BEGIN or END rule should probably be `print \"\"'" msgstr "" "Einfaches 'print' in BEGIN- oder END-Regel soll vermutlich 'print \"\"' sein." -#: awkgram.y:517 awkgram.y:524 +#: awkgram.y:521 awkgram.y:528 msgid "`delete array' is a gawk extension" msgstr "'delete array' ist eine gawk-Erweiterung." -#: awkgram.y:532 awkgram.y:539 +#: awkgram.y:536 awkgram.y:543 #, fuzzy msgid "`delete(array)' is a non-portable tawk extension" msgstr "'delete array' ist eine gawk-Erweiterung." -#: awkgram.y:583 +#: awkgram.y:587 #, c-format msgid "duplicate case values in switch body: %s" msgstr "" -#: awkgram.y:593 +#: awkgram.y:597 msgid "Duplicate `default' detected in switch body" msgstr "" -#: awkgram.y:681 +#: awkgram.y:686 msgid "multistage two-way pipelines don't work" msgstr "'multistage' Zweiwege-Pipes funktionieren nicht." -#: awkgram.y:772 +#: awkgram.y:777 msgid "regular expression on right of assignment" msgstr "Regulärer Ausdruck auf der rechten Seite einer Zuweisung." -#: awkgram.y:782 +#: awkgram.y:800 msgid "regular expression on left of `~' or `!~' operator" msgstr "Regulärer Ausdruck links vom '~'- oder '!~'-Operator." -#: awkgram.y:790 +#: awkgram.y:808 msgid "regular expression on right of comparison" msgstr "Regulärer Ausdruck rechts von einem Vergleich." -#: awkgram.y:857 +#: awkgram.y:875 msgid "non-redirected `getline' undefined inside END action" msgstr "" "Nicht-umgelenktes 'getline' ist innerhalb der END-Aktion nicht definiert." -#: awkgram.y:884 +#: awkgram.y:902 msgid "call of `length' without parentheses is not portable" msgstr "Aufruf von 'length' ohne Klammern ist nicht portabel." -#: awkgram.y:887 +#: awkgram.y:905 msgid "call of `length' without parentheses is deprecated by POSIX" msgstr "Aufruf von 'length' ohne Klammern ist in POSIX-Mode veraltet." -#: awkgram.y:940 +#: awkgram.y:958 msgid "use of non-array as array" msgstr "" -#: awkgram.y:942 +#: awkgram.y:960 msgid "invalid subscript expression" msgstr "Ungültiger Index-Ausdruck." -#: awkgram.y:1140 +#: awkgram.y:1158 #, fuzzy msgid "unexpected newline or end of string" msgstr "Unerwartetes Zeilenende" -#: awkgram.y:1235 +#: awkgram.y:1254 msgid "empty program text on command line" msgstr "Kein Programmtext auf der Kommandozeile." -#: awkgram.y:1292 +#: awkgram.y:1307 #, c-format msgid "can't open source file `%s' for reading (%s)" msgstr "Kann Quelldatei '%s' nicht zum Lesen öffnen (%s)." -#: awkgram.y:1327 +#: awkgram.y:1384 #, c-format msgid "can't read sourcefile `%s' (%s)" msgstr "Kann Quelldatei '%s' nicht lesen (%s)." -#: awkgram.y:1335 +#: awkgram.y:1392 #, c-format msgid "source file `%s' is empty" msgstr "Quelldatei '%s' ist leer." -#: awkgram.y:1537 awkgram.y:1647 awkgram.y:1665 awkgram.y:2015 awkgram.y:2100 +#: awkgram.y:1590 awkgram.y:1700 awkgram.y:1718 awkgram.y:2068 awkgram.y:2153 msgid "source file does not end in newline" msgstr "Quelldatei hört nicht mit Zeilenende auf." -#: awkgram.y:1601 +#: awkgram.y:1654 msgid "unterminated regexp ends with `\\' at end of file" msgstr "" "Nicht-beendeter Regulärer Ausdruck (hört mit '\\' auf) am Ende der Datei." -#: awkgram.y:1621 +#: awkgram.y:1674 msgid "unterminated regexp" msgstr "Nicht-beendeter Regulärer Ausdruck" -#: awkgram.y:1624 +#: awkgram.y:1677 msgid "unterminated regexp at end of file" msgstr "Nicht-beendeter Regulärer Ausdruck am Dateiende." -#: awkgram.y:1691 +#: awkgram.y:1744 msgid "use of `\\ #...' line continuation is not portable" msgstr "" "Die Verwendung von '\\#...' zur Fortsetzung von Zeilen ist nicht portabel." -#: awkgram.y:1703 +#: awkgram.y:1756 msgid "backslash not last character on line" msgstr "Backslash ist nicht letztes Zeichen auf der Zeile." -#: awkgram.y:1748 +#: awkgram.y:1801 msgid "POSIX does not allow operator `**='" msgstr "POSIX erlaubt den Operator '**=' nicht." -#: awkgram.y:1750 +#: awkgram.y:1803 msgid "old awk does not support operator `**='" msgstr "Das alte awk erlaubt den Operator '**=' nicht." -#: awkgram.y:1759 +#: awkgram.y:1812 msgid "POSIX does not allow operator `**'" msgstr "POSIX erlaubt den Operator '**' nicht." -#: awkgram.y:1761 +#: awkgram.y:1814 msgid "old awk does not support operator `**'" msgstr "Das alte awk erlaubt den Operator '**' nicht." -#: awkgram.y:1792 +#: awkgram.y:1845 msgid "operator `^=' is not supported in old awk" msgstr "Das alte awk kennt den Operator '^=' nicht." -#: awkgram.y:1800 +#: awkgram.y:1853 msgid "operator `^' is not supported in old awk" msgstr "Das alte awk kennt den Operator '^' nicht." -#: awkgram.y:1884 awkgram.y:1901 +#: awkgram.y:1937 awkgram.y:1954 msgid "unterminated string" msgstr "Nicht-beendeter String" -#: awkgram.y:2061 +#: awkgram.y:2114 #, c-format msgid "invalid char '%c' in expression" msgstr "Ungültiges Zeichen '%c' in einem Ausdruck." -#: awkgram.y:2121 +#: awkgram.y:2162 #, c-format msgid "`%s' is a gawk extension" msgstr "'%s' ist eine gawk-Erweiterung" -#: awkgram.y:2124 +#: awkgram.y:2165 #, c-format msgid "`%s' is a Bell Labs extension" msgstr "'%s' ist eine Erweiterung der Bell Labs." -#: awkgram.y:2127 +#: awkgram.y:2168 #, c-format msgid "POSIX does not allow `%s'" msgstr "POSIX gestattet '%s' nicht." -#: awkgram.y:2131 +#: awkgram.y:2172 #, c-format msgid "`%s' is not supported in old awk" msgstr "Das alte awk gestattet '%s' nicht." -#: awkgram.y:2158 +#: awkgram.y:2198 msgid "`goto' considered harmful!\n" msgstr "'goto' gilt als schlechter Stil!\n" -#: awkgram.y:2220 +#: awkgram.y:2260 #, c-format msgid "%d is invalid as number of arguments for %s" msgstr "Unzulässige Argumentzahl %d für %s." -#: awkgram.y:2239 awkgram.y:2242 +#: awkgram.y:2279 awkgram.y:2282 msgid "match: third argument is a gawk extension" msgstr "match: Das dritte Argument ist eine gawk-Erweiterung." -#: awkgram.y:2255 +#: awkgram.y:2295 #, c-format msgid "%s: string literal as last arg of substitute has no effect" msgstr "%s: Ein String als letztes Argument von substitute hat keinen Effekt." -#: awkgram.y:2258 +#: awkgram.y:2298 #, fuzzy, c-format msgid "%s third parameter is not a changeable object" msgstr "Der dritte Parameter von sub ist ein unveränderliches Objekt." -#: awkgram.y:2285 awkgram.y:2288 +#: awkgram.y:2325 awkgram.y:2328 msgid "close: second argument is a gawk extension" msgstr "close: Das zweite Argument ist eine gawk-Erweiterung." -#: awkgram.y:2298 +#: awkgram.y:2338 msgid "use of dcgettext(_\"...\") is incorrect: remove leading underscore" msgstr "" "Fehlerhafte Verwendung von dcgettext(_\"...\"): \n" "Entfernen Sie den führenden Unterstrich." -#: awkgram.y:2313 +#: awkgram.y:2353 #, fuzzy msgid "use of dcngettext(_\"...\") is incorrect: remove leading underscore" msgstr "" "Fehlerhafte Verwendung von dcgettext(_\"...\"): \n" "Entfernen Sie den führenden Unterstrich." -#: awkgram.y:2384 +#: awkgram.y:2424 #, c-format msgid "function `%s': parameter #%d, `%s', duplicates parameter #%d" msgstr "Funktion '%s': Parameter #%d, '%s' wiederholt Parameter #%d." -#: awkgram.y:2417 +#: awkgram.y:2457 #, c-format msgid "function `%s': parameter `%s' shadows global variable" msgstr "Funktion '%s': Parameter '%s' verdeckt eine globale Variable." -#: awkgram.y:2529 +#: awkgram.y:2569 #, c-format msgid "could not open `%s' for writing (%s)" msgstr "Kann '%s' nicht zum Schreiben öffnen (%s)." -#: awkgram.y:2530 profile.c:93 +#: awkgram.y:2570 profile.c:93 msgid "sending profile to standard error" msgstr "Schicke Profile auf Stadard-Fehlerausgabe." -#: awkgram.y:2562 +#: awkgram.y:2602 #, c-format msgid "%s: close failed (%s)" msgstr "%s: close gescheitert (%s)." -#: awkgram.y:2684 +#: awkgram.y:2723 msgid "shadow_funcs() called twice!" msgstr "shadow_funcs() zweimal aufgerufen!" -#: awkgram.y:2711 +#: awkgram.y:2750 msgid "there were shadowed variables." msgstr "" -#: awkgram.y:2784 +#: awkgram.y:2823 #, c-format msgid "function `%s': can't use function name as parameter name" msgstr "Funktion '%s': Kann Funktionsnamen nicht als Parameternamen benutzen." -#: awkgram.y:2794 +#: awkgram.y:2833 #, c-format msgid "function name `%s' previously defined" msgstr "Funktion '%s' ist bereits definiert." -#: awkgram.y:2945 awkgram.y:2951 +#: awkgram.y:2984 awkgram.y:2990 #, c-format msgid "function `%s' called but never defined" msgstr "Aufgerufene funktion '%s' ist nirgends definiert." -#: awkgram.y:2954 +#: awkgram.y:2993 #, c-format msgid "function `%s' defined but never called" msgstr "Funktion '%s' wird nirgends aufgerufen." -#: awkgram.y:2981 +#: awkgram.y:3020 #, c-format msgid "regexp constant for parameter #%d yields boolean value" msgstr "" "Konstanter Regulärer Ausdruck für Parameter #%d ergibt einen logischen Wert." -#: awkgram.y:2994 -#, c-format +#: awkgram.y:3033 +#, fuzzy, c-format msgid "" "function `%s' called with space between name and `(',\n" -"%s" +"or used as a variable or an array" msgstr "" "Funktion '%s' mit Leerzeichen zwischen Name und '(' aufgerufen, \n" "%s" -#: awkgram.y:2996 -#, fuzzy -msgid "or used as a variable or an array" -msgstr "Kann Funktion '%s' nicht als Variable oder Array verwenden." - -#: builtin.c:137 +#: builtin.c:149 #, c-format msgid "%s to \"%s\" failed (%s)" msgstr "%s to \"%s\" fehlgeschlagen (%s)" -#: builtin.c:138 +#: builtin.c:150 msgid "standard output" msgstr "Standardausgabe" -#: builtin.c:139 +#: builtin.c:151 msgid "reason unknown" msgstr "Unbekannte Ursache" -#: builtin.c:152 +#: builtin.c:164 msgid "exp: received non-numeric argument" msgstr "exp: Argument ist keine Zahl." -#: builtin.c:158 +#: builtin.c:170 #, c-format msgid "exp: argument %g is out of range" msgstr "exp: Argument %g außerhalb des gültigen Zahlenbereichs." -#: builtin.c:216 +#: builtin.c:228 #, c-format msgid "fflush: cannot flush: pipe `%s' opened for reading, not writing" msgstr "" "fflush: Leeren der Puffer nicht möglich, Pipe »%s« ist nur zum Lesen " "geöffnet." -#: builtin.c:219 +#: builtin.c:231 #, c-format msgid "fflush: cannot flush: file `%s' opened for reading, not writing" msgstr "" "fflush: Leeren der Puffer nicht möglich, Datei »%s« ist nur zum Lesen " "geöffnet." -#: builtin.c:231 +#: builtin.c:243 #, c-format msgid "fflush: `%s' is not an open file, pipe or co-process" msgstr "fflush: »%s« ist keine geöffnete Datei, Pipe oder Prozess." -#: builtin.c:325 +#: builtin.c:338 msgid "index: received non-string first argument" msgstr "index: Erstes Argument ist kein String." -#: builtin.c:327 +#: builtin.c:340 msgid "index: received non-string second argument" msgstr "index: Zweites Argument ist kein string." -#: builtin.c:437 +#: builtin.c:454 msgid "int: received non-numeric argument" msgstr "Argument ist keine Zahl." -#: builtin.c:454 +#: builtin.c:471 msgid "length: received non-string argument" msgstr "length: Argument ist kein String." -#: builtin.c:470 +#: builtin.c:487 msgid "log: received non-numeric argument" msgstr "log: Argument ist keine Zahl." -#: builtin.c:473 +#: builtin.c:490 #, c-format msgid "log: received negative argument %g" msgstr "log: Negatives Argument %g." -#: builtin.c:635 builtin.c:638 +#: builtin.c:654 builtin.c:657 msgid "must use `count$' on all formats or none" msgstr "" -#: builtin.c:740 +#: builtin.c:759 msgid "`$' is not permitted in awk formats" msgstr "»$« ist in awk-Formaten nicht zulässig." -#: builtin.c:746 +#: builtin.c:765 msgid "arg count with `$' must be > 0" msgstr "Argumentnummer bei »$« muss > 0 sein." -#: builtin.c:748 +#: builtin.c:767 #, fuzzy, c-format msgid "arg count %ld greater than total number of supplied arguments" msgstr "Argumentnummer %d ist größer als Anzahl angegebener Argumente." -#: builtin.c:750 +#: builtin.c:769 msgid "`$' not permitted after period in format" msgstr "»$« nach Punkt in Formatangabe nicht zulässig." -#: builtin.c:763 +#: builtin.c:782 msgid "no `$' supplied for positional field width or precision" msgstr "»$« fehlt in positionsabhängiger Feldbreite oder Genauigkeit." # -#: builtin.c:821 +#: builtin.c:848 msgid "`l' is meaningless in awk formats; ignored" msgstr "»l« ist in awk-Formaten bedeutungslos, ignoriert." -#: builtin.c:825 +#: builtin.c:852 msgid "`l' is not permitted in POSIX awk formats" msgstr "»l« in POSIX-awk-Formaten nicht zulässig." -#: builtin.c:836 +#: builtin.c:863 msgid "`L' is meaningless in awk formats; ignored" msgstr "»L« ist in awk-Formaten bedeutungslos, ignoriert." -#: builtin.c:840 +#: builtin.c:867 msgid "`L' is not permitted in POSIX awk formats" msgstr "»L« in POSIX-awk-Formaten nicht zulässig." -#: builtin.c:851 +#: builtin.c:878 msgid "`h' is meaningless in awk formats; ignored" msgstr "»h« ist in awk-Formaten bedeutungslos, ignoriert." -#: builtin.c:855 +#: builtin.c:882 msgid "`h' is not permitted in POSIX awk formats" msgstr "»h« in POSIX-awk-Formaten nicht zulässig.<" -#: builtin.c:1055 +#: builtin.c:1111 #, c-format msgid "[s]printf: value %g is out of range for `%%%c' format" msgstr "" -#: builtin.c:1108 +#: builtin.c:1171 msgid "not enough arguments to satisfy format string" msgstr "Nicht genügend Argumente für Formatangabe." -#: builtin.c:1110 +#: builtin.c:1173 msgid "^ ran out for this one" msgstr "^ ran out for this one" -#: builtin.c:1115 +#: builtin.c:1178 msgid "[s]printf: format specifier does not have control letter" msgstr "[s]printf: Format-Specifier hat keinen Controlcode." -#: builtin.c:1118 +#: builtin.c:1181 msgid "too many arguments supplied for format string" msgstr "Zu viele Argumente für Formatstring." -#: builtin.c:1184 builtin.c:1187 +#: builtin.c:1247 builtin.c:1250 msgid "printf: no arguments" msgstr "printf: Keine Argumente" -#: builtin.c:1211 +#: builtin.c:1274 msgid "sqrt: received non-numeric argument" msgstr "sqrt: Argument ist keine Zahl." -#: builtin.c:1215 +#: builtin.c:1278 #, c-format msgid "sqrt: called with negative argument %g" msgstr "sqrt: Argument %g ist negativ." -#: builtin.c:1238 +#: builtin.c:1301 #, c-format msgid "substr: start index %g is invalid, using 1" msgstr "substr: Start-Index %g ist ungültig, 1 wird benutzt." -#: builtin.c:1243 +#: builtin.c:1306 #, c-format msgid "substr: non-integer start index %g will be truncated" msgstr "substr: Start-Wert %g wird abgeschnitten." -#: builtin.c:1262 +#: builtin.c:1325 #, fuzzy, c-format msgid "substr: length %g is not >= 1" msgstr "substr: Länge %g ist kleiner oder gleich 0." -#: builtin.c:1264 +#: builtin.c:1327 #, fuzzy, c-format msgid "substr: length %g is not >= 0" msgstr "substr: Länge %g ist kleiner oder gleich 0." -#: builtin.c:1271 +#: builtin.c:1334 #, c-format msgid "substr: non-integer length %g will be truncated" msgstr "substr: Länge %g wird abgeschnitten." -#: builtin.c:1276 +#: builtin.c:1339 #, c-format msgid "substr: length %g too big for string indexing, truncating to %g" msgstr "" -#: builtin.c:1288 +#: builtin.c:1351 msgid "substr: source string is zero length" msgstr "substr: String ist leer." -#: builtin.c:1294 +#: builtin.c:1357 #, fuzzy, c-format msgid "substr: start index %g is past end of string" msgstr "substr: Start-Wert %d liegt hinter dem Ende des Strings." -#: builtin.c:1302 +#: builtin.c:1365 #, fuzzy, c-format msgid "" "substr: length %g at start index %g exceeds length of first argument (%lu)" @@ -580,247 +580,272 @@ msgstr "" "substr: Länge %d am Start-Wert %d überschreitet Länge des ersten Arguments (%" "d)." -#: builtin.c:1337 +#: builtin.c:1400 #, fuzzy msgid "strftime: received non-string first argument" msgstr "strftime: Erstes Argument ist kein String." -#: builtin.c:1343 +#: builtin.c:1406 msgid "strftime: received empty format string" msgstr "strftime: Format-String ist leer." -#: builtin.c:1352 +#: builtin.c:1415 #, fuzzy msgid "strftime: received non-numeric second argument" msgstr "strftime. Zweites Argument ist keine Zahl." -#: builtin.c:1415 +#: builtin.c:1478 msgid "mktime: received non-string argument" msgstr "mktime: Argument ist kein String." -#: builtin.c:1460 +#: builtin.c:1523 #, fuzzy msgid "system: received non-string argument" msgstr "system: Argument ist kein String." -#: builtin.c:1581 eval.c:1883 +#: builtin.c:1644 eval.c:2019 #, fuzzy, c-format msgid "reference to uninitialized field `$%d'" msgstr "Referenz auf die nicht-initialisierte Variable '%s'." -#: builtin.c:1608 +#: builtin.c:1671 #, fuzzy msgid "tolower: received non-string argument" msgstr "tolower: Argument ist kein String." -#: builtin.c:1657 +#: builtin.c:1720 #, fuzzy msgid "toupper: received non-string argument" msgstr "toupper: Argument ist kein String." -#: builtin.c:1702 +#: builtin.c:1765 msgid "atan2: received non-numeric first argument" msgstr "atan2: Erstes Argument ist keine Zahl." -#: builtin.c:1704 +#: builtin.c:1767 msgid "atan2: received non-numeric second argument" msgstr "atan2: Zweites Argument ist keine Zahl." -#: builtin.c:1723 +#: builtin.c:1786 msgid "sin: received non-numeric argument" msgstr "sin: Argument istk eine Zahl." -#: builtin.c:1739 +#: builtin.c:1802 msgid "cos: received non-numeric argument" msgstr "cos: Argument ist keine Zahl." -#: builtin.c:1788 +#: builtin.c:1852 msgid "srand: received non-numeric argument" msgstr "srand: Argument ist keine Zahl." -#: builtin.c:1823 +#: builtin.c:1887 msgid "match: third argument is not an array" msgstr "match: Drittes Argument ist kein Array." -#: builtin.c:2307 +#: builtin.c:2414 msgid "gensub: third argument of 0 treated as 1" msgstr "gensub: Drittes Argument 0 als 1 interpretiert" -#: builtin.c:2416 builtin.c:2418 +#: builtin.c:2572 msgid "lshift: received non-numeric first argument" msgstr "lshift: Erstes Argument ist keine Zahl." -#: builtin.c:2420 +#: builtin.c:2574 +#, fuzzy +msgid "lshift: received non-numeric second argument" +msgstr "strftime. Zweites Argument ist keine Zahl." + +#: builtin.c:2580 #, c-format msgid "lshift(%lf, %lf): negative values will give strange results" msgstr "" "lshift(%lf, %lf): Negative Werte werden merkwürdige Ergebnisse liefern." -#: builtin.c:2422 +#: builtin.c:2582 #, c-format msgid "lshift(%lf, %lf): fractional values will be truncated" msgstr "lshift(%lf, %lf): Dezimalteil wird abgeschnitten." -#: builtin.c:2424 +#: builtin.c:2584 #, c-format msgid "lshift(%lf, %lf): too large shift value will give strange results" msgstr "" "lshift(%lf, %lf): Zu große Shift-Werte werden merkwürdige Ergebnisse liefern." -#: builtin.c:2453 builtin.c:2455 +#: builtin.c:2610 msgid "rshift: received non-numeric first argument" msgstr "rshift: Erstes Argument ist keine Zahl." -#: builtin.c:2457 +#: builtin.c:2612 +#, fuzzy +msgid "rshift: received non-numeric second argument" +msgstr "strftime. Zweites Argument ist keine Zahl." + +#: builtin.c:2618 #, c-format msgid "rshift(%lf, %lf): negative values will give strange results" msgstr "" "rshift (%lf, %lf): Negative Werte werden merkwürdige Ergebnisse liefern." -#: builtin.c:2459 +#: builtin.c:2620 #, c-format msgid "rshift(%lf, %lf): fractional values will be truncated" msgstr "rshift(%lf, %lf): Dezimalteil wird abgeschnitten." -#: builtin.c:2461 +#: builtin.c:2622 #, c-format msgid "rshift(%lf, %lf): too large shift value will give strange results" msgstr "" "rshift(%lf, %lf): Zu große Shift-Werte werden merkwürdige Ergebnisse liefern." -#: builtin.c:2490 builtin.c:2492 +#: builtin.c:2648 msgid "and: received non-numeric first argument" msgstr "and: Erstes Argument ist keine Zahl." -#: builtin.c:2494 +#: builtin.c:2650 +#, fuzzy +msgid "and: received non-numeric second argument" +msgstr "atan2: Zweites Argument ist keine Zahl." + +#: builtin.c:2656 #, c-format msgid "and(%lf, %lf): negative values will give strange results" msgstr "and(%lf, %lf): Negative Werte werden merkwürdige Ergebnisse liefern." -#: builtin.c:2496 +#: builtin.c:2658 #, c-format msgid "and(%lf, %lf): fractional values will be truncated" msgstr "and(%lf, %lf): Dezimalteil wird abgeschnitten." -#: builtin.c:2525 builtin.c:2527 +#: builtin.c:2684 msgid "or: received non-numeric first argument" msgstr "or: Erstes Argument ist keine Zahl." -#: builtin.c:2529 +#: builtin.c:2686 +#, fuzzy +msgid "or: received non-numeric second argument" +msgstr "atan2: Zweites Argument ist keine Zahl." + +#: builtin.c:2692 #, c-format msgid "or(%lf, %lf): negative values will give strange results" msgstr "or(%lf, %lf): Negative Werte werden merkwürdige Ergebnisse liefern." -#: builtin.c:2531 +#: builtin.c:2694 #, c-format msgid "or(%lf, %lf): fractional values will be truncated" msgstr "or(%lf, %lf): Dezimalteil wird abgeschnitten." -#: builtin.c:2560 builtin.c:2562 +#: builtin.c:2720 msgid "xor: received non-numeric first argument" msgstr "xor: Erstes Argument ist keine Zahl." -#: builtin.c:2564 +#: builtin.c:2722 +#, fuzzy +msgid "xor: received non-numeric second argument" +msgstr "atan2: Zweites Argument ist keine Zahl." + +#: builtin.c:2728 #, c-format msgid "xor(%lf, %lf): negative values will give strange results" msgstr "xor(%lf, %lf: Negative Werte werden merkwürdige Ergebnisse liefern." -#: builtin.c:2566 +#: builtin.c:2730 #, c-format msgid "xor(%lf, %lf): fractional values will be truncated" msgstr "xor(%lf, %lf): Dezimalteil wird abgeschnitten." -#: builtin.c:2594 +#: builtin.c:2754 msgid "compl: received non-numeric argument" msgstr "compl: Erstes Argument ist keine Zahl." -#: builtin.c:2596 +#: builtin.c:2760 #, c-format msgid "compl(%lf): negative value will give strange results" msgstr "compl(%lf): Negativer Wert wird merkwürdige Ergebnisse liefern." -#: builtin.c:2598 +#: builtin.c:2762 #, c-format msgid "compl(%lf): fractional value will be truncated" msgstr "compl(%lf): Dezimalteil wird abgeschnitten." -#: builtin.c:2771 +#: builtin.c:2935 #, c-format msgid "dcgettext: `%s' is not a valid locale category" msgstr "dcgettext: '%s' ist keine gültige Locale-Kategorie." -#: eval.c:266 +#: eval.c:303 #, c-format msgid "unknown nodetype %d" msgstr "Unbekannter Knotentyp %d" -#: eval.c:312 +#: eval.c:350 msgid "buffer overflow in genflags2str" msgstr "Pufferüberlauf in genflags2str." -#: eval.c:647 +#: eval.c:382 eval.c:388 profile.c:837 +#, c-format +msgid "attempt to use array `%s' in a scalar context" +msgstr "Versuch, das Array '%s' in Skalarkontext zu verwenden." + +#: eval.c:730 #, fuzzy, c-format msgid "for loop: array `%s' changed size from %ld to %ld during loop execution" msgstr "" "for-Schleife: Array '%s' ändert Größse von %d zu %d innerhalb der Schleife." -#: eval.c:668 +#: eval.c:751 msgid "`break' outside a loop is not portable" msgstr "'break' außerhalb einer Schleife ist nicht portabel." -#: eval.c:672 +#: eval.c:755 msgid "`break' outside a loop is not allowed" msgstr "'break' außerhalb einer Schleife ist nicht zulässig." -#: eval.c:689 +#: eval.c:772 msgid "`continue' outside a loop is not portable" msgstr "'continue' außerhalb einer Schleife ist nicht portabel." -#: eval.c:693 +#: eval.c:776 msgid "`continue' outside a loop is not allowed" msgstr "'continue' außerhalb einer Schleife ist nicht zulässig." -#: eval.c:727 +#: eval.c:810 msgid "`next' cannot be called from a BEGIN rule" msgstr "'next' kann nicht in einer BEGIN-Regel benutzt werden." -#: eval.c:729 +#: eval.c:812 msgid "`next' cannot be called from an END rule" msgstr "'next' kann nicht in einer END-Regel benutzt werden." -#: eval.c:738 +#: eval.c:821 msgid "`nextfile' cannot be called from a BEGIN rule" msgstr "'nextfile' kann nicht in einer BEGIN-Regel benutzt werden." -#: eval.c:740 +#: eval.c:823 msgid "`nextfile' cannot be called from an END rule" msgstr "'nextfile' kann nicht in einer END-Regel benutzt werden." -#: eval.c:785 +#: eval.c:872 msgid "statement has no effect" msgstr "Anweisung hat keinen Effekt." -#: eval.c:828 eval.c:1726 +#: eval.c:915 eval.c:1873 #, c-format msgid "can't use function name `%s' as variable or array" msgstr "Kann Funktion '%s' nicht als Variable oder Array verwenden." -#: eval.c:835 eval.c:841 +#: eval.c:922 eval.c:928 #, c-format msgid "reference to uninitialized argument `%s'" msgstr "Referenz auf nicht-initialisiertes Argument '%s'." -#: eval.c:848 eval.c:907 eval.c:1732 eval.c:1742 profile.c:807 -#, c-format -msgid "attempt to use array `%s' in a scalar context" -msgstr "Versuch, das Array '%s' in Skalarkontext zu verwenden." - -#: eval.c:858 eval.c:1752 +#: eval.c:937 eval.c:1882 #, c-format msgid "reference to uninitialized variable `%s'" msgstr "Referenz auf die nicht-initialisierte Variable '%s'." -#: eval.c:1007 +#: eval.c:1083 msgid "" "concatenation: side effects in one expression have changed the length of " "another!" @@ -828,49 +853,50 @@ msgstr "" "Konkatenierung: Seiteneffekte in einem Ausdruck haben die Länge des anderen\n" "geändert!" -#: eval.c:1032 +#: eval.c:1162 msgid "assignment used in conditional context" msgstr "Zuweisung in einer Bedingung." -#: eval.c:1122 +#: eval.c:1252 msgid "division by zero attempted" msgstr "Division durch Null versucht." -#: eval.c:1137 +#: eval.c:1267 #, c-format msgid "division by zero attempted in `%%'" msgstr "Division durch Null versucht in '%%'." -#: eval.c:1152 profile.c:683 +#: eval.c:1282 profile.c:713 #, c-format msgid "illegal type (%s) in tree_eval" msgstr "Illegaler Typ (%s) in tree_eval" -#: eval.c:1328 +#: eval.c:1459 msgid "division by zero attempted in `/='" msgstr "Division durch Null versucht in '/='." -#: eval.c:1346 +#: eval.c:1477 #, c-format msgid "division by zero attempted in `%%='" msgstr "Division durch Null versucht in '%%='." -#: eval.c:1586 +#: eval.c:1738 #, c-format msgid "function `%s' called with more arguments than declared" msgstr "Funktion '%s' mit zu vielen Argumenten aufgerufen." -#: eval.c:1633 +#: eval.c:1782 #, c-format msgid "function `%s' not defined" msgstr "Funktion '%s' ist nicht definiert." -#: eval.c:1639 +#: eval.c:1788 #, c-format msgid "function %s called\n" msgstr "Funktion %s aufgerufen\n" -#: eval.c:1698 +#: eval.c:1845 +#, c-format msgid "" "\n" "\t# Function Call Stack:\n" @@ -880,42 +906,43 @@ msgstr "" "\t# Funktion Aufruf-Stack\n" "\n" -#: eval.c:1701 +#: eval.c:1848 +#, c-format msgid "\t# -- main --\n" msgstr "\t# -- main --\n" -#: eval.c:1867 +#: eval.c:2003 msgid "attempt to field reference from non-numeric value" msgstr "Nicht-numerischer Wert für Feldreferenz verwendet." -#: eval.c:1869 +#: eval.c:2005 msgid "attempt to reference from null string" msgstr "Referenz von einem Null-String" -#: eval.c:1875 +#: eval.c:2011 #, c-format msgid "attempt to access field %d" msgstr "Versuch des Zugriffs auf Feld %d." -#: eval.c:1896 eval.c:1903 profile.c:900 +#: eval.c:2032 eval.c:2039 profile.c:934 msgid "assignment is not allowed to result of builtin function" msgstr "" "Zuweisungen an das Ergebnis einer eingebauten Funktion sind nicht erlaubt." -#: eval.c:1951 +#: eval.c:2103 msgid "`IGNORECASE' is a gawk extension" msgstr "'IGNORECASE' ist eine gawk-Erweiterung" -#: eval.c:1980 +#: eval.c:2133 msgid "`BINMODE' is a gawk extension" msgstr "'BINMODE' ist eine gawk-Erweiterung." -#: eval.c:2092 +#: eval.c:2255 #, c-format msgid "bad `%sFMT' specification `%s'" msgstr "Falsche '%sFMT'-Angabe '%s'" -#: eval.c:2170 +#: eval.c:2333 msgid "turning off `--lint' due to assignment to `LINT'" msgstr "'--lint' wird abgeschaltet, da 'LINT' gesetzt ist." @@ -933,7 +960,56 @@ msgstr "extension: Kann '%s' nicht msgid "extension: library `%s': cannot call function `%s' (%s)\n" msgstr "extension: Bibliothek '%s': kann Funktion '%s' nicht aufrufen (%s)\n" -#: ext.c:183 +#: ext.c:102 +msgid "extension: missing function name" +msgstr "" + +#: ext.c:107 +#, fuzzy, c-format +msgid "extension: illegal character `%c' in function name `%s'" +msgstr "extension: Bibliothek '%s': kann Funktion '%s' nicht aufrufen (%s)\n" + +#: ext.c:113 +#, fuzzy, c-format +msgid "extension: can't redefine function `%s'" +msgstr "extension: Kann '%s' nicht öffnen (%s)\n" + +#: ext.c:117 +#, fuzzy, c-format +msgid "extension: function `%s' already defined" +msgstr "Funktion '%s' ist nicht definiert." + +#: ext.c:122 +#, c-format +msgid "extension: can't use gawk built-in `%s' as function name" +msgstr "" + +#: ext.c:124 +#, fuzzy, c-format +msgid "extension: function name `%s' previously defined" +msgstr "Funktion '%s' ist bereits definiert." + +#: ext.c:201 +#, c-format +msgid "function `%s' defined to take no more than `%d' argument(s)" +msgstr "" + +#: ext.c:204 +#, fuzzy, c-format +msgid "function `%s': missing argument #%d" +msgstr "Funktion '%s' ist nicht definiert." + +#: ext.c:214 +#, fuzzy, c-format +msgid "function `%s': argument #%d: attempt to use scalar as an array" +msgstr "Versuch, Skalar '%s' als Array zu verwenden." + +#: ext.c:218 +#, c-format +msgid "function `%s': argument #%d: attempt to use array as a scalar" +msgstr "" + +#: ext.c:243 msgid "Operation Not Supported" msgstr "Operation nicht möglich." @@ -962,524 +1038,524 @@ msgstr "Feld %d in FIELDWIDTHS muss > 0 sein." msgid "null string for `FS' is a gawk extension" msgstr "Null-String für 'FS' ist eine gawk-Erweiterung." -#: getopt.c:692 getopt.c:704 +#: getopt.c:692 getopt.c:711 #, c-format msgid "%s: option `%s' is ambiguous\n" msgstr "%s: Option '%s' ist mehrdeutig.\n" -#: getopt.c:737 getopt.c:741 +#: getopt.c:744 getopt.c:748 #, c-format msgid "%s: option `--%s' doesn't allow an argument\n" msgstr "%s: Option '--%s' erlaubt kein Argument.\n" -#: getopt.c:750 getopt.c:755 +#: getopt.c:757 getopt.c:762 #, c-format msgid "%s: option `%c%s' doesn't allow an argument\n" msgstr "%s: Option '%c%s\" erlaubt kein Argument.\n" -#: getopt.c:791 getopt.c:804 getopt.c:1093 getopt.c:1106 +#: getopt.c:807 getopt.c:829 getopt.c:1159 getopt.c:1181 #, c-format msgid "%s: option `%s' requires an argument\n" msgstr "%s: Option '%s' erfordert ein Argument.\n" -#: getopt.c:842 getopt.c:845 +#: getopt.c:867 getopt.c:870 #, c-format msgid "%s: unrecognized option `--%s'\n" msgstr "%s: Unbekannte Option '--%s'.\n" -#: getopt.c:853 getopt.c:856 +#: getopt.c:878 getopt.c:881 #, c-format msgid "%s: unrecognized option `%c%s'\n" msgstr "%s: Unbekannte Option '%c%s'.\n" -#: getopt.c:903 getopt.c:906 +#: getopt.c:936 getopt.c:939 #, c-format msgid "%s: illegal option -- %c\n" msgstr "%s: Illegale Option -- %c.\n" -#: getopt.c:912 getopt.c:915 +#: getopt.c:945 getopt.c:948 #, c-format msgid "%s: invalid option -- %c\n" msgstr "%s: Ungültige Option -- %c.\n" -#: getopt.c:962 getopt.c:973 getopt.c:1159 getopt.c:1172 main.c:434 +#: getopt.c:1003 getopt.c:1022 getopt.c:1234 getopt.c:1255 main.c:433 #, c-format msgid "%s: option requires an argument -- %c\n" msgstr "%s Option erfordert ein Argument -- %c.\n" -#: getopt.c:1025 getopt.c:1036 +#: getopt.c:1074 getopt.c:1093 #, c-format msgid "%s: option `-W %s' is ambiguous\n" msgstr "%s: Option '-W %s' ist mehrdeutig.\n" -#: getopt.c:1060 getopt.c:1072 +#: getopt.c:1117 getopt.c:1138 #, c-format msgid "%s: option `-W %s' doesn't allow an argument\n" msgstr "%s. Option '-W %s' erlaubt kein Argument.\n" -#: io.c:305 +#: io.c:308 #, c-format msgid "cannot open file `%s' for reading (%s)" msgstr "Kann Datei '%s' nicht zum Lesen öffnen (%s)." -#: io.c:392 +#: io.c:395 #, c-format msgid "close of fd %d (`%s') failed (%s)" msgstr "Schließen von Dateideskriptor %d ('%s') gescheitert (%s)." -#: io.c:530 +#: io.c:533 #, c-format msgid "invalid tree type %s in redirect()" msgstr "Ungültiger Tree-Typ %s in redirect()." -#: io.c:536 +#: io.c:539 #, c-format msgid "expression in `%s' redirection only has numeric value" msgstr "Ausdruck in '%s' Umlenkung hat nur einen numerischen Wert." -#: io.c:542 +#: io.c:545 #, c-format msgid "expression for `%s' redirection has null string value" msgstr "Ausdruck für '%s' Umlenkung ist ein leerer String." -#: io.c:547 +#: io.c:550 #, c-format msgid "filename `%s' for `%s' redirection may be result of logical expression" msgstr "" "Dateiname '%s' für '%s' Umlenkung kann Ergebnis eines logischen Ausdrucks " "sein." -#: io.c:569 +#: io.c:588 #, c-format msgid "unnecessary mixing of `>' and `>>' for file `%.*s'" msgstr "Unnötige Kombination von '>' und '>>' für Datei '%.*s'." -#: io.c:621 +#: io.c:640 #, c-format msgid "can't open pipe `%s' for output (%s)" msgstr "Kann Pipe '%s' nicht für Ausgabe öffnen (%s)." -#: io.c:630 +#: io.c:649 #, c-format msgid "can't open pipe `%s' for input (%s)" msgstr "Kann Pipe '%s' nicht für Eingabe öffnen (%s)." -#: io.c:643 +#: io.c:662 #, c-format msgid "can't open two way socket `%s' for input/output (%s)" msgstr "Kann bidirektionalen Socket '%s' nicht für Ein-/Ausgabe öffnen (%s)." -#: io.c:647 +#: io.c:666 #, c-format msgid "can't open two way pipe `%s' for input/output (%s)" msgstr "Kann bidirektionale Pipe '%s' nicht für Ein-/Ausgabe öffnen (%s)." -#: io.c:723 +#: io.c:742 #, c-format msgid "can't redirect from `%s' (%s)" msgstr "Kann nicht von '%s' umlenken (%s)." -#: io.c:726 +#: io.c:745 #, c-format msgid "can't redirect to `%s' (%s)" msgstr "Kann nicht auf '%s' umlenken (%s)." -#: io.c:765 +#: io.c:784 msgid "" "reached system limit for open files: starting to multiplex file descriptors" msgstr "" "Systemgrenze offener Dateien erreicht; beginne mit Multiplexing von " "Dateideskriptoren." -#: io.c:777 +#: io.c:800 #, c-format msgid "close of `%s' failed (%s)." msgstr "Schließen von '%s' gescheitert (%s)." -#: io.c:784 +#: io.c:808 msgid "too many pipes or input files open" msgstr "Zu viele Pipes oder Eingabedateien offen." -#: io.c:807 +#: io.c:831 msgid "close: second argument must be `to' or `from'" msgstr "close: Zweites Argument muss 'to' oder 'from' sein." -#: io.c:821 +#: io.c:845 #, c-format msgid "close: `%.*s' is not an open file, pipe or co-process" msgstr "close: '%.*s' ist keine offene Datei, Pipe oder Ko-Prozess." -#: io.c:825 +#: io.c:849 msgid "close of redirection that was never opened" msgstr "'close' für eine Umlenkung, die nie geöffnet wurde." -#: io.c:862 +#: io.c:945 #, c-format msgid "close: redirection `%s' not opened with `|&', second argument ignored" msgstr "" "close: Umlenkung '%s' nicht mit '[&' geöffnet, zweites Argument wird " "ignoriert." -#: io.c:924 +#: io.c:960 #, c-format msgid "failure status (%d) on pipe close of `%s' (%s)" msgstr "Fehlerstatus (%d) beim Schließen der Pipe '%s' (%s)." -#: io.c:927 +#: io.c:963 #, c-format msgid "failure status (%d) on file close of `%s' (%s)" msgstr "Fehlerstatus (%d) beim Schließen de rDatei '%s' (%s)." -#: io.c:946 +#: io.c:983 #, c-format msgid "no explicit close of socket `%s' provided" msgstr "Das explizite des Sockets '%s' fehlt." -#: io.c:949 +#: io.c:986 #, c-format msgid "no explicit close of co-process `%s' provided" msgstr "Das explizite Schließen des Ko-Prozesses '%s' fehlt." -#: io.c:952 +#: io.c:989 #, c-format msgid "no explicit close of pipe `%s' provided" msgstr "Das explizite Schließen der Pipe '%s' fehlt." -#: io.c:955 +#: io.c:992 #, c-format msgid "no explicit close of file `%s' provided" msgstr "Das explizite Schließen der Datei '%s' fehlt." -#: io.c:984 io.c:1038 +#: io.c:1021 io.c:1075 #, c-format msgid "error writing standard output (%s)" msgstr "Fehler beim Schreiben auf stdout (%s)." -#: io.c:988 io.c:1042 +#: io.c:1025 io.c:1079 #, c-format msgid "error writing standard error (%s)" msgstr "Fehler beim Schreiben auf stderr (%s)." -#: io.c:996 +#: io.c:1033 #, c-format msgid "pipe flush of `%s' failed (%s)." msgstr "Leeren der Pipe '%s' gescheitert (%s)." -#: io.c:999 +#: io.c:1036 #, c-format msgid "co-process flush of pipe to `%s' failed (%s)." msgstr "Ko-Prozess: Leeren der Pipe zu '%s' gescheitert (%s)." -#: io.c:1002 +#: io.c:1039 #, c-format msgid "file flush of `%s' failed (%s)." msgstr "Flush der Datei '%s' gescheitert (%s)." -#: io.c:1161 +#: io.c:1198 msgid "/inet/raw client not ready yet, sorry" msgstr "/inet/raw Client noch nicht fertig." -#: io.c:1163 io.c:1200 +#: io.c:1200 io.c:1237 msgid "only root may use `/inet/raw'." msgstr "Nur root darf '/inet/raw' benutzen" -#: io.c:1198 +#: io.c:1235 msgid "/inet/raw server not ready yet, sorry" msgstr "'/inet/raw'-Server noch nicht fertig." -#: io.c:1288 +#: io.c:1325 #, c-format msgid "no (known) protocol supplied in special filename `%s'" msgstr "Kein bekanntes Protokoll in Dateinamen '%s' angegeben." -#: io.c:1306 +#: io.c:1343 #, c-format msgid "special file name `%s' is incomplete" msgstr "Dateiname '%s' ist unvollständig." -#: io.c:1318 +#: io.c:1355 #, c-format msgid "local port invalid in `%s'" msgstr "Lokaler Port in '%s' ist ungültig." -#: io.c:1330 +#: io.c:1367 msgid "must supply a remote hostname to `/inet'" msgstr "Sie müssen einen Rechnernamen in '/inet' angeben." -#: io.c:1345 +#: io.c:1382 msgid "must supply a remote port to `/inet'" msgstr "Sie müssen einen Port in '/inet' angeben." -#: io.c:1351 +#: io.c:1388 #, c-format msgid "remote port invalid in `%s'" msgstr "Port-Angabe in '%s' ist ungültig." -#: io.c:1361 +#: io.c:1398 msgid "TCP/IP communications are not supported" msgstr "TCP/IP-Verbindungen sind nicht möglich." -#: io.c:1370 io.c:1551 +#: io.c:1407 io.c:1588 #, c-format msgid "file `%s' is a directory" msgstr "Datei '%s' ist ein Verzeichnis." -#: io.c:1440 +#: io.c:1477 #, c-format msgid "use `PROCINFO[\"%s\"]' instead of `%s'" msgstr "Benutzen Sie 'PROCINFO[\"%s\"]' statt '%s'" -#: io.c:1472 +#: io.c:1509 msgid "use `PROCINFO[...]' instead of `/dev/user'" msgstr "Benutzen Sie 'PROCINFO[...] statt '/dev/user'." -#: io.c:1537 io.c:1711 +#: io.c:1574 io.c:1748 #, c-format msgid "could not open `%s', mode `%s'" msgstr "Konnte '%s' nicht öffnen, Mode '%s'." -#: io.c:1762 +#: io.c:1799 #, fuzzy, c-format msgid "close of master pty failed (%s)" msgstr "Schließen der Pipe gescheitert (%s)." -#: io.c:1764 io.c:1916 io.c:2068 +#: io.c:1801 io.c:1953 io.c:2105 #, c-format msgid "close of stdout in child failed (%s)" msgstr "Schließen von stdout in Kindprozess gescheitert (%s)." -#: io.c:1767 +#: io.c:1804 #, fuzzy, c-format msgid "moving slave pty to stdout in child failed (dup: %s)" msgstr "Verschieben der Pipe zu stdout in Kindprozess gescheitert (dup: %s)." -#: io.c:1769 io.c:1921 +#: io.c:1806 io.c:1958 #, c-format msgid "close of stdin in child failed (%s)" msgstr "Schließen von stdin im Kindprozess gescheitert (%s)." -#: io.c:1772 +#: io.c:1809 #, fuzzy, c-format msgid "moving slave pty to stdin in child failed (dup: %s)" msgstr "Verschieben der Pipe zu stdin in Kindprozess gescheitert (dup: %s)." -#: io.c:1774 io.c:1793 +#: io.c:1811 io.c:1830 #, fuzzy, c-format msgid "close of slave pty failed (%s)" msgstr "Schließen der Pipe gescheitert (%s)." -#: io.c:1867 io.c:1919 io.c:2049 io.c:2071 +#: io.c:1904 io.c:1956 io.c:2086 io.c:2108 #, c-format msgid "moving pipe to stdout in child failed (dup: %s)" msgstr "Verschieben der Pipe zu stdout in Kindprozess gescheitert (dup: %s)." -#: io.c:1871 io.c:1924 +#: io.c:1908 io.c:1961 #, c-format msgid "moving pipe to stdin in child failed (dup: %s)" msgstr "Verschieben der Pipe zu stdin in Kindprozess gescheitert (dup: %s)." -#: io.c:1888 io.c:2062 +#: io.c:1925 io.c:2099 msgid "restoring stdout in parent process failed\n" msgstr "" -#: io.c:1893 +#: io.c:1930 msgid "restoring stdin in parent process failed\n" msgstr "" -#: io.c:1927 io.c:2073 io.c:2084 +#: io.c:1964 io.c:2110 io.c:2121 #, c-format msgid "close of pipe failed (%s)" msgstr "Schließen der Pipe gescheitert (%s)." -#: io.c:1972 +#: io.c:2009 msgid "`|&' not supported" msgstr "'|&' nicht möglich." -#: io.c:2039 +#: io.c:2076 #, c-format msgid "cannot open pipe `%s' (%s)" msgstr "Kann Pipe '%s' nicht öffnen (%s)." -#: io.c:2080 +#: io.c:2117 #, c-format msgid "cannot create child process for `%s' (fork: %s)" msgstr "Kann Kindprozess für '%s' nicht erzeugen (fork: %s)." -#: io.c:2423 +#: io.c:2460 #, c-format msgid "data file `%s' is empty" msgstr "Datei '%s' ist leer." -#: io.c:2466 io.c:2474 +#: io.c:2503 io.c:2511 msgid "could not allocate more input memory" msgstr "" -#: io.c:2832 io.c:2895 +#: io.c:2869 io.c:2932 #, c-format msgid "error reading input file `%s': %s" msgstr "Fehler beim Lesen der Eingabedatei '%s': %s." -#: io.c:3020 +#: io.c:3057 msgid "multicharacter value of `RS' is a gawk extension" msgstr "Multicharacter-Wert von 'RS' ist eine gawk-Erweiterung." -#: main.c:324 +#: main.c:323 msgid "`-m[fr]' option irrelevant in gawk" msgstr "Option '-m[fr]' ist in gawk bedeutungslos." -#: main.c:326 +#: main.c:325 msgid "-m option usage: `-m[fr] nnn'" msgstr "Anwendung der Option -m: '-m[fr] nnn'" -#: main.c:343 +#: main.c:342 #, c-format msgid "%s: option `-W %s' unrecognized, ignored\n" msgstr "%s: Option '-W %s' unbekannt, ignoriert.\n" -#: main.c:380 +#: main.c:379 msgid "empty argument to `--source' ignored" msgstr "Leeres Argument für '--source' ignoriert." -#: main.c:451 +#: main.c:450 msgid "environment variable `POSIXLY_CORRECT' set: turning on `--posix'" msgstr "" "Umgebungsvariable 'POSIXLY_CORRECT' ist gesetzt: '--posix' angeschaltet." -#: main.c:456 +#: main.c:455 msgid "`--posix' overrides `--traditional'" msgstr "'--posix' hat Vorrang vor '--traditional'" -#: main.c:467 +#: main.c:466 msgid "`--posix'/`--traditional' overrides `--non-decimal-data'" msgstr "'--posix' /'--traditional' hat Vorrang vor '--non-decimal-data'." -#: main.c:471 +#: main.c:470 #, fuzzy, c-format msgid "running %s setuid root may be a security problem" msgstr "%s als setuid root auszuführen, kann zu Sicherheitsproblemen führen." -#: main.c:512 +#: main.c:511 #, fuzzy, c-format msgid "can't set binary mode on stdin (%s)" msgstr "Kann Mode für stdin nicht setzen (%s)." -#: main.c:515 +#: main.c:514 #, fuzzy, c-format msgid "can't set binary mode on stdout (%s)" msgstr "Kann Mode für stdout nicht setzen (%s)." -#: main.c:517 +#: main.c:516 #, fuzzy, c-format msgid "can't set binary mode on stderr (%s)" msgstr "Kann Mode für stderr nicht setzen (%s)." -#: main.c:547 +#: main.c:546 msgid "no program text at all!" msgstr "Kein Programmtext." -#: main.c:620 +#: main.c:623 #, c-format msgid "Usage: %s [POSIX or GNU style options] -f progfile [--] file ...\n" msgstr "Anwendung: %s [POSIX- oder GNU-Optionen] -f PROGRAM [--] Datei ...\n" -#: main.c:622 +#: main.c:625 #, c-format msgid "Usage: %s [POSIX or GNU style options] [--] %cprogram%c file ...\n" msgstr "Anwendung: %s [POSIX- oder GNU-Optionen] -- %cPROGRAM%c Datei ...\n" -#: main.c:627 +#: main.c:630 msgid "POSIX options:\t\tGNU long options:\n" msgstr "POSIX-Optionen\t\tGNU-Optionen (lang):\n" -#: main.c:628 +#: main.c:631 msgid "\t-f progfile\t\t--file=progfile\n" msgstr "\t-f PROGRAM\t\t--file=PROGRAM\n" -#: main.c:629 +#: main.c:632 msgid "\t-F fs\t\t\t--field-separator=fs\n" msgstr "\t-F Feldtrenner\t\t\t--field-separator=Feldtrenner\n" -#: main.c:630 +#: main.c:633 msgid "\t-v var=val\t\t--assign=var=val\n" msgstr "\t-v var=Wert\t\t--assign=var=Wert\n" -#: main.c:631 +#: main.c:634 msgid "\t-m[fr] val\n" msgstr "\t-m[fr] Wert\n" -#: main.c:632 +#: main.c:635 msgid "\t-W compat\t\t--compat\n" msgstr "\t-W compat\t\t--compat\n" -#: main.c:633 +#: main.c:636 msgid "\t-W copyleft\t\t--copyleft\n" msgstr "\t-W copyleft\t\t--copyleft\n" -#: main.c:634 +#: main.c:637 msgid "\t-W copyright\t\t--copyright\n" msgstr "\t-W copyright\t\t--copyright\n" -#: main.c:635 +#: main.c:638 msgid "\t-W dump-variables[=file]\t--dump-variables[=file]\n" msgstr "\t-W dump-variables[=Datei]\t--dump-variables[=Datei]\n" -#: main.c:636 +#: main.c:639 msgid "\t-W gen-po\t\t--gen-po\n" msgstr "\t-W gen-po\t\t--gen-po\n" -#: main.c:637 +#: main.c:640 msgid "\t-W help\t\t\t--help\n" msgstr "\t-W help\t\t\t--help\n" -#: main.c:638 +#: main.c:641 msgid "\t-W lint[=fatal]\t\t--lint[=fatal]\n" msgstr "\t-W lint[=fatal]\t\t--lint[=fatal]\n" -#: main.c:639 +#: main.c:642 msgid "\t-W lint-old\t\t--lint-old\n" msgstr "\t-W lint-old\t\t--lint-old\n" -#: main.c:640 +#: main.c:643 msgid "\t-W non-decimal-data\t--non-decimal-data\n" msgstr "\t-W non-decimal-data\t--non-decimal-data\n" -#: main.c:642 +#: main.c:645 msgid "\t-W nostalgia\t\t--nostalgia\n" msgstr "\t-W nostalgia\t\t--nostalgia\n" -#: main.c:645 +#: main.c:648 msgid "\t-W parsedebug\t\t--parsedebug\n" msgstr "\t-W parsedebug\t\t--parsedebug\n" -#: main.c:647 +#: main.c:650 msgid "\t-W profile[=file]\t--profile[=file]\n" msgstr "\t-W profile[=Datei]\t--profile[=Datei]\n" -#: main.c:648 +#: main.c:651 msgid "\t-W posix\t\t--posix\n" msgstr "\t-W posix\t\t--posix\n" -#: main.c:649 +#: main.c:652 msgid "\t-W re-interval\t\t--re-interval\n" msgstr "\t-W re-interval\t\t--re-interval\n" -#: main.c:650 +#: main.c:653 msgid "\t-W source=program-text\t--source=program-text\n" msgstr "\t-W source=Programmtext\t--source=Programmtext\n" -#: main.c:651 +#: main.c:654 msgid "\t-W traditional\t\t--traditional\n" msgstr "\t-W traditional\t\t--traditional\n" -#: main.c:652 +#: main.c:655 msgid "\t-W usage\t\t--usage\n" msgstr "\t-W usage\t\t--usage\n" -#: main.c:653 +#: main.c:656 msgid "\t-W version\t\t--version\n" msgstr "\t-W version\t\t--version\n" -#: main.c:657 +#: main.c:660 #, fuzzy msgid "" "\n" @@ -1490,21 +1566,21 @@ msgstr "" "den Sie im Kapitel 'Reporting Problems and Bugs' in der \n" "gedruckten Version finden.\n" -#: main.c:661 +#: main.c:664 msgid "" "gawk is a pattern scanning and processing language.\n" "By default it reads standard input and writes standard output.\n" "\n" msgstr "" -#: main.c:665 +#: main.c:668 msgid "" "Examples:\n" "\tgawk '{ sum += $1 }; END { print sum }' file\n" "\tgawk -F: '{ print $1 }' /etc/passwd\n" msgstr "" -#: main.c:682 +#: main.c:685 #, fuzzy, c-format msgid "" "Copyright (C) 1989, 1991-%d Free Software Foundation.\n" @@ -1524,7 +1600,7 @@ msgstr "" "spätere Version.\n" "\n" -#: main.c:690 +#: main.c:693 msgid "" "This program is distributed in the hope that it will be useful,\n" "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" @@ -1538,7 +1614,7 @@ msgstr "" "GNU General Public License for more details.\n" "\n" -#: main.c:696 +#: main.c:699 msgid "" "You should have received a copy of the GNU General Public License\n" "along with this program; if not, write to the Free Software\n" @@ -1549,51 +1625,52 @@ msgstr "" "Software Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-" "1307, USA.\n" -#: main.c:730 +#: main.c:733 msgid "-Ft does not set FS to tab in POSIX awk" msgstr "-Ft setzt FS im POSIX-awk nicht auf Tab." -#: main.c:956 +#: main.c:962 #, c-format msgid "" "%s: `%s' argument to `-v' not in `var=value' form\n" "\n" msgstr "" -#: main.c:976 +#: main.c:982 #, c-format msgid "`%s' is not a legal variable name" msgstr "" -#: main.c:979 +#: main.c:985 #, c-format msgid "`%s' is not a variable name, looking for file `%s=%s'" msgstr "" -#: main.c:1012 +#: main.c:1018 msgid "floating point exception" msgstr "Floating point exception" -#: main.c:1019 +#: main.c:1025 msgid "fatal error: internal error" msgstr "Fataler Fehler: interner Fehler" -#: main.c:1069 +#: main.c:1075 #, c-format msgid "no pre-opened fd %d" msgstr "Kein geöffneter Dateideskriptor %d" -#: main.c:1074 +#: main.c:1082 #, c-format msgid "could not pre-open /dev/null for fd %d" msgstr "Konnte /dev/null nicht für Dateideskriptor %d öffnen." -#: main.c:1097 main.c:1106 +#: main.c:1105 main.c:1114 #, c-format msgid "could not find groups: %s" msgstr "Konnte Gruppen nicht finden: %s" #: msg.c:54 +#, c-format msgid "cmd. line:" msgstr "Kommandozeile:" @@ -1613,19 +1690,19 @@ msgstr "Fatal: " msgid "can't convert string to float" msgstr "Kann String nicht in Gleitkommazahl konvertieren." -#: node.c:355 +#: node.c:357 msgid "backslash at end of string" msgstr "Backslash am String-Ende." -#: node.c:539 +#: node.c:541 msgid "POSIX does not allow `\\x' escapes" msgstr "POSIX erlabut keine '\\x'-Escapes." -#: node.c:545 +#: node.c:547 msgid "no hex digits in `\\x' escape sequence" msgstr "Keine Hex-Ziffern in '\\x'-Escape." -#: node.c:579 +#: node.c:581 #, c-format msgid "escape sequence `\\%c' treated as plain `%c'" msgstr "Escape-Sequenz '\\%c' als '%c' behandelt." @@ -1640,21 +1717,27 @@ msgstr "%s %s '%s': Konnte close-on-exec nicht setzen: %s" msgid "could not open `%s' for writing: %s" msgstr "Konnte '%s' nicht zum Schreiben öffnen: %s" -#: profile.c:449 +#: profile.c:467 #, fuzzy, c-format msgid "internal error: %s with null vname" msgstr "Interner Fehler: Node_var with null vname." -#: profile.c:512 +#: profile.c:530 msgid "# treated internally as `delete'" msgstr "" -#: profile.c:1162 +#: profile.c:1167 +#, c-format +msgid "# this is a dynamically loaded extension function" +msgstr "" + +#: profile.c:1198 #, c-format msgid "\t# gawk profile, created %s\n" msgstr "\t# gawk-Profil, erzeugt %s\n" -#: profile.c:1165 +#: profile.c:1201 +#, c-format msgid "" "\t# BEGIN block(s)\n" "\n" @@ -1662,7 +1745,8 @@ msgstr "" "\t# BEGIN block(s)\n" "\n" -#: profile.c:1175 +#: profile.c:1211 +#, c-format msgid "" "\t# Rule(s)\n" "\n" @@ -1670,7 +1754,8 @@ msgstr "" "\t# Rule(s)\n" "\n" -#: profile.c:1181 +#: profile.c:1217 +#, c-format msgid "" "\t# END block(s)\n" "\n" @@ -1678,7 +1763,8 @@ msgstr "" "\t# END block(s)\n" "\n" -#: profile.c:1201 +#: profile.c:1237 +#, c-format msgid "" "\n" "\t# Functions, listed alphabetically\n" @@ -1686,88 +1772,87 @@ msgstr "" "\n" "\t# Functionen, alphabetisch sortiert\n" -#: profile.c:1413 +#: profile.c:1452 #, c-format msgid "unexpected type %s in prec_level" msgstr "Unerwarteter Typ %s in prec_level." -#: re.c:193 -#, c-format -msgid "regex match failed, not enough memory to match string \"%.*s%s\"" -msgstr "" - -#: regcomp.c:136 +#: regcomp.c:150 msgid "Success" msgstr "Erfolg" -#: regcomp.c:139 +#: regcomp.c:153 msgid "No match" msgstr "Kein Treffer" -#: regcomp.c:142 +#: regcomp.c:156 msgid "Invalid regular expression" msgstr "Ungültiger Regulärer Ausdruck." -#: regcomp.c:145 +#: regcomp.c:159 msgid "Invalid collation character" msgstr "Ungültiges Zeichen." -#: regcomp.c:148 +#: regcomp.c:162 msgid "Invalid character class name" msgstr "Ungültier Name für Zeichenklasse." -#: regcomp.c:151 +#: regcomp.c:165 msgid "Trailing backslash" msgstr "Angehängter Backslash" -#: regcomp.c:154 +#: regcomp.c:168 msgid "Invalid back reference" msgstr "Ungültige Referenze" -#: regcomp.c:157 +#: regcomp.c:171 msgid "Unmatched [ or [^" msgstr "[ oder [^ nicht geschlossen" -#: regcomp.c:160 +#: regcomp.c:174 msgid "Unmatched ( or \\(" msgstr "( oder \\( nicht geschlossen" -#: regcomp.c:163 +#: regcomp.c:177 msgid "Unmatched \\{" msgstr "\\{ nicht geschlossen" -#: regcomp.c:166 +#: regcomp.c:180 msgid "Invalid content of \\{\\}" msgstr "Ungültiger Inhalt von \\{\\}" -#: regcomp.c:169 +#: regcomp.c:183 msgid "Invalid range end" msgstr "Ungültiges Bereichsende" -#: regcomp.c:172 +#: regcomp.c:186 msgid "Memory exhausted" msgstr "Kein Speicher mehr." -#: regcomp.c:175 +#: regcomp.c:189 msgid "Invalid preceding regular expression" msgstr "Vorangehender Regulärer Ausdruck ist ungültig." -#: regcomp.c:178 +#: regcomp.c:192 msgid "Premature end of regular expression" msgstr "Vorzeitiges Ende des Regulären Ausdrucks." -#: regcomp.c:181 +#: regcomp.c:195 msgid "Regular expression too big" msgstr "Regulärer Ausdruck zu groß." -#: regcomp.c:184 +#: regcomp.c:198 msgid "Unmatched ) or \\)" msgstr ") oder \\) nicht geöffnet" -#: regcomp.c:621 +#: regcomp.c:668 msgid "No previous regular expression" msgstr "Kein vorangehender Regulärer Ausdruck." +#, fuzzy +#~ msgid "or used as a variable or an array" +#~ msgstr "Kann Funktion '%s' nicht als Variable oder Array verwenden." + #, fuzzy #~ msgid "substr: length %g is < 0" #~ msgstr "substr: Länge %g ist kleiner oder gleich 0." @@ -1806,9 +1891,6 @@ msgstr "Kein vorangehender Regul #~ msgid "or used in other expression context" #~ msgstr "or in anderem Kontext benutzt" -#~ msgid "attempt to use function `%s' as array" -#~ msgstr "Versuch, die Funktion '%s' als Array zu verwenden." - #~ msgid "`%s' is a function, assignment is not allowed" #~ msgstr "'%s' ist eine Funktion, Zuweisungen sind nicht erlaubt." diff --git a/po/es.gmo b/po/es.gmo index afc22a465..c9a474ae7 100644 Binary files a/po/es.gmo and b/po/es.gmo differ diff --git a/po/es.po b/po/es.po index 585b8cb8c..e6f9bc9b7 100644 --- a/po/es.po +++ b/po/es.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: gawk 3.1.2g\n" "Report-Msgid-Bugs-To: arnold@skeeve.com\n" -"POT-Creation-Date: 2003-07-07 11:20-0700\n" +"POT-Creation-Date: 2004-07-15 13:02+0300\n" "PO-Revision-Date: 2003-06-29 14:53-0500\n" "Last-Translator: Cristian Othón Martínez Vera \n" "Language-Team: Spanish \n" @@ -15,56 +15,61 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" #: array.c:112 +#, fuzzy, c-format +msgid "attempt to use function `%s' as an array" +msgstr "se intentó usar la función `%s' como una matriz" + +#: array.c:115 #, c-format msgid "attempt to use scalar parameter `%s' as an array" msgstr "se intentó usar el parámetro escalar `%s como una matriz'" -#: array.c:113 +#: array.c:118 #, c-format msgid "attempt to use scalar `%s' as array" msgstr "se intentó usar el dato escalar `%s' como una matriz" -#: array.c:151 +#: array.c:156 #, c-format msgid "from %s" msgstr "desde %s" -#: array.c:506 +#: array.c:511 #, c-format msgid "reference to uninitialized element `%s[\"%s\"]'" msgstr "referencia al elemento sin valor inicial `%s[\"%s\"]'" -#: array.c:512 +#: array.c:517 #, c-format msgid "subscript of array `%s' is null string" msgstr "el subíndice de la matriz `%s' es la cadena nula" -#: array.c:609 +#: array.c:621 #, c-format msgid "delete: index `%s' not in array `%s'" msgstr "delete: el índice `%s' no está en la matriz `%s'" -#: array.c:769 +#: array.c:791 #, c-format msgid "%s: empty (null)\n" msgstr "%s: vacío (nulo)\n" -#: array.c:774 +#: array.c:796 #, c-format msgid "%s: empty (zero)\n" msgstr "%s: vacío (cero)\n" -#: array.c:778 +#: array.c:800 #, c-format msgid "%s: table_size = %d, array_size = %d\n" msgstr "%s: tamaño_tabla = %d, tamaño_matriz = %d\n" -#: array.c:807 +#: array.c:829 #, c-format msgid "%s: is parameter\n" msgstr "%s: es un parámetro\n" -#: array.c:812 +#: array.c:834 #, c-format msgid "%s: array_ref to %s\n" msgstr "%s: array_ref a %s\n" @@ -90,485 +95,481 @@ msgstr "" "la constante de expresión regular `/%s/' parece un comentario de C, pero no " "lo es" -#: awkgram.y:340 awkgram.y:615 +#: awkgram.y:341 awkgram.y:619 msgid "statement may have no effect" msgstr "la sentencia puede no tener efecto" -#: awkgram.y:435 awkgram.y:455 +#: awkgram.y:436 awkgram.y:456 #, c-format msgid "`%s' used in %s action" msgstr "se usó `%s' en la acción %s" -#: awkgram.y:448 awkgram.y:451 +#: awkgram.y:449 awkgram.y:452 msgid "`nextfile' is a gawk extension" msgstr "`nextfile' es una extensión de gawk" -#: awkgram.y:465 +#: awkgram.y:466 msgid "`return' used outside function context" msgstr "se usó `return' fuera del contexto de la función" -#: awkgram.y:504 +#: awkgram.y:508 msgid "plain `print' in BEGIN or END rule should probably be `print \"\"'" msgstr "" "el `print' simple en la regla BEGIN o END probablemente debe ser `print \"\"'" -#: awkgram.y:517 awkgram.y:524 +#: awkgram.y:521 awkgram.y:528 msgid "`delete array' is a gawk extension" msgstr "`delete array' es una extensión de gawk" -#: awkgram.y:532 awkgram.y:539 +#: awkgram.y:536 awkgram.y:543 msgid "`delete(array)' is a non-portable tawk extension" msgstr "`delete(array)' es una extensión de gawk que no es transportable" -#: awkgram.y:583 +#: awkgram.y:587 #, c-format msgid "duplicate case values in switch body: %s" msgstr "valores case duplicados en el cuerpo de un switch: %s" -#: awkgram.y:593 +#: awkgram.y:597 msgid "Duplicate `default' detected in switch body" msgstr "Se detectó un `default' duplicado en el cuerpo de un switch" -#: awkgram.y:681 +#: awkgram.y:686 msgid "multistage two-way pipelines don't work" msgstr "las líneas de trabajo de dos vías multiestado no funcionan" -#: awkgram.y:772 +#: awkgram.y:777 msgid "regular expression on right of assignment" msgstr "expresión regular del lado derecho de una asignación" -#: awkgram.y:782 +#: awkgram.y:800 msgid "regular expression on left of `~' or `!~' operator" msgstr "expresión regular a la izquierda del operador `~' o `!~'" -#: awkgram.y:790 +#: awkgram.y:808 msgid "regular expression on right of comparison" msgstr "expresión regular a la derecha de una comparación" -#: awkgram.y:857 +#: awkgram.y:875 msgid "non-redirected `getline' undefined inside END action" msgstr "`getline' no redirigido indefinido dentro de la acción de END" -#: awkgram.y:884 +#: awkgram.y:902 msgid "call of `length' without parentheses is not portable" msgstr "la llamada de `length' sin paréntesis no es transportable" -#: awkgram.y:887 +#: awkgram.y:905 msgid "call of `length' without parentheses is deprecated by POSIX" msgstr "la llamada de `length' sin paréntesis está obsoleta por POSIX" -#: awkgram.y:940 +#: awkgram.y:958 msgid "use of non-array as array" msgstr "uso de una matriz que no es matriz" -#: awkgram.y:942 +#: awkgram.y:960 msgid "invalid subscript expression" msgstr "expresión de subíndice inválida" -#: awkgram.y:1140 +#: awkgram.y:1158 msgid "unexpected newline or end of string" msgstr "nueva línea o fin de la cadena inesperados" -#: awkgram.y:1235 +#: awkgram.y:1254 msgid "empty program text on command line" msgstr "texto de programa vacío en la linea de comando" -#: awkgram.y:1292 +#: awkgram.y:1307 #, c-format msgid "can't open source file `%s' for reading (%s)" msgstr "no se puede abrir el fichero fuente `%s' para lectura (%s)" -#: awkgram.y:1327 +#: awkgram.y:1384 #, c-format msgid "can't read sourcefile `%s' (%s)" msgstr "no se puede leer el fichero fuente `%s' (%s)" -#: awkgram.y:1335 +#: awkgram.y:1392 #, c-format msgid "source file `%s' is empty" msgstr "el fichero fuente `%s' está vacío" -#: awkgram.y:1537 awkgram.y:1647 awkgram.y:1665 awkgram.y:2015 awkgram.y:2100 +#: awkgram.y:1590 awkgram.y:1700 awkgram.y:1718 awkgram.y:2068 awkgram.y:2153 msgid "source file does not end in newline" msgstr "el fichero fuente no termina con línea nueva" -#: awkgram.y:1601 +#: awkgram.y:1654 msgid "unterminated regexp ends with `\\' at end of file" msgstr "expresión regular sin terminar termina con `\\` al final del fichero" -#: awkgram.y:1621 +#: awkgram.y:1674 msgid "unterminated regexp" msgstr "expresión regular sin terminar" -#: awkgram.y:1624 +#: awkgram.y:1677 msgid "unterminated regexp at end of file" msgstr "expresión regular sin terminar al final del fichero" -#: awkgram.y:1691 +#: awkgram.y:1744 msgid "use of `\\ #...' line continuation is not portable" msgstr "el uso de la continuación de línea `\\ #...' no es transportable" -#: awkgram.y:1703 +#: awkgram.y:1756 msgid "backslash not last character on line" msgstr "la barra invertida no es el último caracter en la línea" -#: awkgram.y:1748 +#: awkgram.y:1801 msgid "POSIX does not allow operator `**='" msgstr "POSIX no permite el operador `**='" -#: awkgram.y:1750 +#: awkgram.y:1803 msgid "old awk does not support operator `**='" msgstr "el awk antiguo no da soporte al operador `**='" -#: awkgram.y:1759 +#: awkgram.y:1812 msgid "POSIX does not allow operator `**'" msgstr "POSIX no permite el operador `**'" -#: awkgram.y:1761 +#: awkgram.y:1814 msgid "old awk does not support operator `**'" msgstr "el awk antiguo no da soporte al operador `**='" -#: awkgram.y:1792 +#: awkgram.y:1845 msgid "operator `^=' is not supported in old awk" msgstr "el operador `^=' no tiene soporte en el awk antiguo" -#: awkgram.y:1800 +#: awkgram.y:1853 msgid "operator `^' is not supported in old awk" msgstr "el operador `^' no tiene soporte en el awk antiguo" -#: awkgram.y:1884 awkgram.y:1901 +#: awkgram.y:1937 awkgram.y:1954 msgid "unterminated string" msgstr "cadena sin terminar" -#: awkgram.y:2061 +#: awkgram.y:2114 #, c-format msgid "invalid char '%c' in expression" msgstr "caracter '%c' inválido en la expresión" -#: awkgram.y:2121 +#: awkgram.y:2162 #, c-format msgid "`%s' is a gawk extension" msgstr "`%s' es una extensión de gawk" -#: awkgram.y:2124 +#: awkgram.y:2165 #, c-format msgid "`%s' is a Bell Labs extension" msgstr "`%s' es una extensión de Bell Labs" -#: awkgram.y:2127 +#: awkgram.y:2168 #, c-format msgid "POSIX does not allow `%s'" msgstr "POSIX no permite `%s'" -#: awkgram.y:2131 +#: awkgram.y:2172 #, c-format msgid "`%s' is not supported in old awk" msgstr "`%s' no tiene soporte en el awk antiguo" -#: awkgram.y:2158 +#: awkgram.y:2198 msgid "`goto' considered harmful!\n" msgstr "¡`goto' se considera dañino!\n" -#: awkgram.y:2220 +#: awkgram.y:2260 #, c-format msgid "%d is invalid as number of arguments for %s" msgstr "%d es inválido como número de argumentos para %s" -#: awkgram.y:2239 awkgram.y:2242 +#: awkgram.y:2279 awkgram.y:2282 msgid "match: third argument is a gawk extension" msgstr "match: el tercer argumento es una extensión de gawk" -#: awkgram.y:2255 +#: awkgram.y:2295 #, c-format msgid "%s: string literal as last arg of substitute has no effect" msgstr "" "%s: la literal de cadena como último argumento de substitute no tiene efecto" -#: awkgram.y:2258 +#: awkgram.y:2298 #, c-format msgid "%s third parameter is not a changeable object" msgstr "el tercer argumento de %s no es un objecto que se puede cambiar" -#: awkgram.y:2285 awkgram.y:2288 +#: awkgram.y:2325 awkgram.y:2328 msgid "close: second argument is a gawk extension" msgstr "close: el segundo argumento es una extensión de gawk" -#: awkgram.y:2298 +#: awkgram.y:2338 msgid "use of dcgettext(_\"...\") is incorrect: remove leading underscore" msgstr "" "el uso de dcgettext(_\"...\") es incorrecto: quite el subrayado inicial" -#: awkgram.y:2313 +#: awkgram.y:2353 msgid "use of dcngettext(_\"...\") is incorrect: remove leading underscore" msgstr "" "el uso de dcngettext(_\"...\") es incorrecto: quite el subrayado inicial" -#: awkgram.y:2384 +#: awkgram.y:2424 #, c-format msgid "function `%s': parameter #%d, `%s', duplicates parameter #%d" msgstr "función `%s': parámetro #%d, `%s', duplica el parámetro #%d" -#: awkgram.y:2417 +#: awkgram.y:2457 #, c-format msgid "function `%s': parameter `%s' shadows global variable" msgstr "función `%s': parámetro `%s' obscurece la variable global" -#: awkgram.y:2529 +#: awkgram.y:2569 #, c-format msgid "could not open `%s' for writing (%s)" msgstr "no se puede abrir `%s' para escritura (%s)" -#: awkgram.y:2530 profile.c:93 +#: awkgram.y:2570 profile.c:93 msgid "sending profile to standard error" msgstr "enviando perfil a la salida estándar de error" -#: awkgram.y:2562 +#: awkgram.y:2602 #, c-format msgid "%s: close failed (%s)" msgstr "%s: falló close (%s)" -#: awkgram.y:2684 +#: awkgram.y:2723 msgid "shadow_funcs() called twice!" msgstr "¡shadow_funcs() llamada dos veces!" -#: awkgram.y:2711 +#: awkgram.y:2750 msgid "there were shadowed variables." msgstr "hay variables opacadas." -#: awkgram.y:2784 +#: awkgram.y:2823 #, c-format msgid "function `%s': can't use function name as parameter name" msgstr "" "función `%s': no se puede usar un nombre de función como nombre de parámetro" -#: awkgram.y:2794 +#: awkgram.y:2833 #, c-format msgid "function name `%s' previously defined" msgstr "el nombre de función `%s' se definió previamente" -#: awkgram.y:2945 awkgram.y:2951 +#: awkgram.y:2984 awkgram.y:2990 #, c-format msgid "function `%s' called but never defined" msgstr "se llamó a la función `%s' pero nunca se definió" -#: awkgram.y:2954 +#: awkgram.y:2993 #, c-format msgid "function `%s' defined but never called" msgstr "la función `%s' está definida pero nunca se llamó" -#: awkgram.y:2981 +#: awkgram.y:3020 #, c-format msgid "regexp constant for parameter #%d yields boolean value" msgstr "" "la constante de expresión regular para el parámetro #%d da un valor booleano" -#: awkgram.y:2994 -#, c-format +#: awkgram.y:3033 +#, fuzzy, c-format msgid "" "function `%s' called with space between name and `(',\n" -"%s" +"or used as a variable or an array" msgstr "" "se llamó la función `%s' con espacio entre el nombre y el `(',\n" "%s" -#: awkgram.y:2996 -msgid "or used as a variable or an array" -msgstr "o se usó como una variable o una matriz" - -#: builtin.c:137 +#: builtin.c:149 #, c-format msgid "%s to \"%s\" failed (%s)" msgstr "falló %s a \"%s\" (%s)" -#: builtin.c:138 +#: builtin.c:150 msgid "standard output" msgstr "salida estándar" -#: builtin.c:139 +#: builtin.c:151 msgid "reason unknown" msgstr "razón desconocida" -#: builtin.c:152 +#: builtin.c:164 msgid "exp: received non-numeric argument" msgstr "exp: se recibió un argumento que no es un número" -#: builtin.c:158 +#: builtin.c:170 #, c-format msgid "exp: argument %g is out of range" msgstr "exp: el argumento %g está fuera de rango" -#: builtin.c:216 +#: builtin.c:228 #, c-format msgid "fflush: cannot flush: pipe `%s' opened for reading, not writing" msgstr "" "fflush: no se puede limpiar: se abrió la tubería `%s' para lectura, no para " "escritura" -#: builtin.c:219 +#: builtin.c:231 #, c-format msgid "fflush: cannot flush: file `%s' opened for reading, not writing" msgstr "" "fflush: no se puede limpiar: se abrió el fichero `%s' para lectura, no para " "escritura" -#: builtin.c:231 +#: builtin.c:243 #, c-format msgid "fflush: `%s' is not an open file, pipe or co-process" msgstr "fflush: `%s' no es un fichero abierto, tubería o co-proceso" -#: builtin.c:325 +#: builtin.c:338 msgid "index: received non-string first argument" msgstr "index: el primer argumento recibido no es una cadena" -#: builtin.c:327 +#: builtin.c:340 msgid "index: received non-string second argument" msgstr "index: el segundo argumento recibido no es una cadena" -#: builtin.c:437 +#: builtin.c:454 msgid "int: received non-numeric argument" msgstr "int: se recibió un argumento que no es un número" -#: builtin.c:454 +#: builtin.c:471 msgid "length: received non-string argument" msgstr "length: se recibió un argumento que no es una cadena" -#: builtin.c:470 +#: builtin.c:487 msgid "log: received non-numeric argument" msgstr "log: se recibió un argumento que no es un número" -#: builtin.c:473 +#: builtin.c:490 #, c-format msgid "log: received negative argument %g" msgstr "log: se recibió el argumento negativo %g" -#: builtin.c:635 builtin.c:638 +#: builtin.c:654 builtin.c:657 msgid "must use `count$' on all formats or none" msgstr "se debe utilizar `count$' en todos los formatos o en ninguno" -#: builtin.c:740 +#: builtin.c:759 msgid "`$' is not permitted in awk formats" msgstr "no se permite `$' en los formatos de awk" -#: builtin.c:746 +#: builtin.c:765 msgid "arg count with `$' must be > 0" msgstr "la cuenta de argumentos con `$' debe ser > 0" -#: builtin.c:748 +#: builtin.c:767 #, c-format msgid "arg count %ld greater than total number of supplied arguments" msgstr "" "la cuenta de argumentos %ld es mayor que el número total de argumentos " "proporcionados" -#: builtin.c:750 +#: builtin.c:769 msgid "`$' not permitted after period in format" msgstr "no se permite `$' después de un punto en el formato" -#: builtin.c:763 +#: builtin.c:782 msgid "no `$' supplied for positional field width or precision" msgstr "" "no se proporciona `$' para el ancho o la precisión del campo posicional" -#: builtin.c:821 +#: builtin.c:848 msgid "`l' is meaningless in awk formats; ignored" msgstr "`l' no tiene significado en los formatos de awk; ignorado" -#: builtin.c:825 +#: builtin.c:852 msgid "`l' is not permitted in POSIX awk formats" msgstr "no se permite `l' en los formatos POSIX de awk" -#: builtin.c:836 +#: builtin.c:863 msgid "`L' is meaningless in awk formats; ignored" msgstr "`L' no tiene significado en los formatos de awk; ignorado" -#: builtin.c:840 +#: builtin.c:867 msgid "`L' is not permitted in POSIX awk formats" msgstr "no se permite `L' en los formatos POSIX de awk" -#: builtin.c:851 +#: builtin.c:878 msgid "`h' is meaningless in awk formats; ignored" msgstr "`h' no tiene significado en los formatos de awk; ignorado" -#: builtin.c:855 +#: builtin.c:882 msgid "`h' is not permitted in POSIX awk formats" msgstr "no se permite `h' en los formatos POSIX de awk" -#: builtin.c:1055 +#: builtin.c:1111 #, c-format msgid "[s]printf: value %g is out of range for `%%%c' format" msgstr "[s]printf: el valor %g está fuera del rango del formato `%%%c'" -#: builtin.c:1108 +#: builtin.c:1171 msgid "not enough arguments to satisfy format string" msgstr "no hay suficientes argumentos para satisfacer a la cadena de formato" -#: builtin.c:1110 +#: builtin.c:1173 msgid "^ ran out for this one" msgstr "se acabó ^ para éste" -#: builtin.c:1115 +#: builtin.c:1178 msgid "[s]printf: format specifier does not have control letter" msgstr "[s]printf: el especificador de formato no tiene letras de control" -#: builtin.c:1118 +#: builtin.c:1181 msgid "too many arguments supplied for format string" msgstr "se proporcionaron demasiados argumentos para la cadena de formato" -#: builtin.c:1184 builtin.c:1187 +#: builtin.c:1247 builtin.c:1250 msgid "printf: no arguments" msgstr "printf: sin argumentos" -#: builtin.c:1211 +#: builtin.c:1274 msgid "sqrt: received non-numeric argument" msgstr "sqrt: se recibió un argumento que no es un número" -#: builtin.c:1215 +#: builtin.c:1278 #, c-format msgid "sqrt: called with negative argument %g" msgstr "sqrt: llamado con el argumento negativo %g" -#: builtin.c:1238 +#: builtin.c:1301 #, c-format msgid "substr: start index %g is invalid, using 1" msgstr "substr: el índice de inicio %g es inválido, usando 1" -#: builtin.c:1243 +#: builtin.c:1306 #, c-format msgid "substr: non-integer start index %g will be truncated" msgstr "substr: el índice de inicio no entero %g será truncado" -#: builtin.c:1262 +#: builtin.c:1325 #, fuzzy, c-format msgid "substr: length %g is not >= 1" msgstr "substr: la longitud %g es <= 0" -#: builtin.c:1264 +#: builtin.c:1327 #, fuzzy, c-format msgid "substr: length %g is not >= 0" msgstr "substr: la longitud %g es <= 0" -#: builtin.c:1271 +#: builtin.c:1334 #, c-format msgid "substr: non-integer length %g will be truncated" msgstr "substr: la longitud no entera %g será truncada" -#: builtin.c:1276 +#: builtin.c:1339 #, c-format msgid "substr: length %g too big for string indexing, truncating to %g" msgstr "" "substr: la longitud %g es demasiado grande para ser índice de cadena, se " "trunca a %g" -#: builtin.c:1288 +#: builtin.c:1351 msgid "substr: source string is zero length" msgstr "substr: la cadena de origen es de longitud cero" -#: builtin.c:1294 +#: builtin.c:1357 #, c-format msgid "substr: start index %g is past end of string" msgstr "substr: el índice de inicio %g está después del fin de la cadena" -#: builtin.c:1302 +#: builtin.c:1365 #, c-format msgid "" "substr: length %g at start index %g exceeds length of first argument (%lu)" @@ -576,243 +577,269 @@ msgstr "" "substr: la cadena %g en el índice de inicio %g excede la longitud del primer " "argumento (%lu)" -#: builtin.c:1337 +#: builtin.c:1400 msgid "strftime: received non-string first argument" msgstr "strftime: el primer argumento que se recibió no es una cadena" -#: builtin.c:1343 +#: builtin.c:1406 msgid "strftime: received empty format string" msgstr "strftime: se recibió una cadena de formato vacía" -#: builtin.c:1352 +#: builtin.c:1415 msgid "strftime: received non-numeric second argument" msgstr "strftime: el segundo argumento que se recibió no es un número" -#: builtin.c:1415 +#: builtin.c:1478 msgid "mktime: received non-string argument" msgstr "mktime: se recibió un argumento que no es una cadena" -#: builtin.c:1460 +#: builtin.c:1523 msgid "system: received non-string argument" msgstr "system: se recibió un argumento que no es una cadena" -#: builtin.c:1581 eval.c:1883 +#: builtin.c:1644 eval.c:2019 #, c-format msgid "reference to uninitialized field `$%d'" msgstr "referencia al campo sin inicializar `$%d'" -#: builtin.c:1608 +#: builtin.c:1671 msgid "tolower: received non-string argument" msgstr "tolower: se recibió un argumento que no es una cadena" -#: builtin.c:1657 +#: builtin.c:1720 msgid "toupper: received non-string argument" msgstr "toupper: se recibió un argumento que no es una cadena" -#: builtin.c:1702 +#: builtin.c:1765 msgid "atan2: received non-numeric first argument" msgstr "atan2: el primer argumento recibido no es un número" -#: builtin.c:1704 +#: builtin.c:1767 msgid "atan2: received non-numeric second argument" msgstr "atan2: el segundo argumento recibido no es un número" -#: builtin.c:1723 +#: builtin.c:1786 msgid "sin: received non-numeric argument" msgstr "sin: se recibió un argumento que no es un número" -#: builtin.c:1739 +#: builtin.c:1802 msgid "cos: received non-numeric argument" msgstr "cos: se recibió un argumento que no es un número" -#: builtin.c:1788 +#: builtin.c:1852 msgid "srand: received non-numeric argument" msgstr "srand: se recibió un argumento que no es un número" -#: builtin.c:1823 +#: builtin.c:1887 msgid "match: third argument is not an array" msgstr "match: el tercer argumento no es una matriz" -#: builtin.c:2307 +#: builtin.c:2414 +#, fuzzy msgid "gensub: third argument of 0 treated as 1" msgstr "gensub: el tercer argumento de 0 se trata como 1" -#: builtin.c:2416 builtin.c:2418 +#: builtin.c:2572 msgid "lshift: received non-numeric first argument" msgstr "lshift: el primer argumento recibido no es un número" -#: builtin.c:2420 +#: builtin.c:2574 +#, fuzzy +msgid "lshift: received non-numeric second argument" +msgstr "strftime: el segundo argumento que se recibió no es un número" + +#: builtin.c:2580 #, c-format msgid "lshift(%lf, %lf): negative values will give strange results" msgstr "lshift(%lf, %lf): los valores negativos darán resultados extraños" -#: builtin.c:2422 +#: builtin.c:2582 #, c-format msgid "lshift(%lf, %lf): fractional values will be truncated" msgstr "lshift(%lf, %lf): los valores fraccionarios serán truncados" -#: builtin.c:2424 +#: builtin.c:2584 #, c-format msgid "lshift(%lf, %lf): too large shift value will give strange results" msgstr "" "lshift(%lf, %lf): un valor de desplazamiento muy grande dará resultados " "extraños" -#: builtin.c:2453 builtin.c:2455 +#: builtin.c:2610 msgid "rshift: received non-numeric first argument" msgstr "rshift: el primer argumento recibido no es un número" -#: builtin.c:2457 +#: builtin.c:2612 +#, fuzzy +msgid "rshift: received non-numeric second argument" +msgstr "strftime: el segundo argumento que se recibió no es un número" + +#: builtin.c:2618 #, c-format msgid "rshift(%lf, %lf): negative values will give strange results" msgstr "rshift(%lf, %lf): los valores negativos darán resultados extraños" -#: builtin.c:2459 +#: builtin.c:2620 #, c-format msgid "rshift(%lf, %lf): fractional values will be truncated" msgstr "rshift(%lf, %lf): los valores fraccionarios serán truncados" -#: builtin.c:2461 +#: builtin.c:2622 #, c-format msgid "rshift(%lf, %lf): too large shift value will give strange results" msgstr "" "rshift(%lf, %lf): un valor de desplazamiento muy grande dará resultados " "extraños" -#: builtin.c:2490 builtin.c:2492 +#: builtin.c:2648 msgid "and: received non-numeric first argument" msgstr "and: el primer argumento recibido no es un número" -#: builtin.c:2494 +#: builtin.c:2650 +#, fuzzy +msgid "and: received non-numeric second argument" +msgstr "atan2: el segundo argumento recibido no es un número" + +#: builtin.c:2656 #, c-format msgid "and(%lf, %lf): negative values will give strange results" msgstr "and(%lf, %lf): los valores negativos darán resultados extraños" -#: builtin.c:2496 +#: builtin.c:2658 #, c-format msgid "and(%lf, %lf): fractional values will be truncated" msgstr "and(%lf, %lf): los valores fraccionarios serán truncados" -#: builtin.c:2525 builtin.c:2527 +#: builtin.c:2684 msgid "or: received non-numeric first argument" msgstr "or: el primer argumento recibido no es un número" -#: builtin.c:2529 +#: builtin.c:2686 +#, fuzzy +msgid "or: received non-numeric second argument" +msgstr "atan2: el segundo argumento recibido no es un número" + +#: builtin.c:2692 #, c-format msgid "or(%lf, %lf): negative values will give strange results" msgstr "or(%lf, %lf): los valores negativos darán resultados extraños" -#: builtin.c:2531 +#: builtin.c:2694 #, c-format msgid "or(%lf, %lf): fractional values will be truncated" msgstr "or(%lf, %lf): los valores fraccionarios serán truncados" -#: builtin.c:2560 builtin.c:2562 +#: builtin.c:2720 msgid "xor: received non-numeric first argument" msgstr "xor: el primer argumento recibido no es un número" -#: builtin.c:2564 +#: builtin.c:2722 +#, fuzzy +msgid "xor: received non-numeric second argument" +msgstr "atan2: el segundo argumento recibido no es un número" + +#: builtin.c:2728 #, c-format msgid "xor(%lf, %lf): negative values will give strange results" msgstr "xor(%lf, %lf): los valores negativos darán resultados extraños" -#: builtin.c:2566 +#: builtin.c:2730 #, c-format msgid "xor(%lf, %lf): fractional values will be truncated" msgstr "xor(%lf, %lf): los valores fraccionarios serán truncados" -#: builtin.c:2594 +#: builtin.c:2754 msgid "compl: received non-numeric argument" msgstr "compl: se recibió un argumento que no es un número" -#: builtin.c:2596 +#: builtin.c:2760 #, c-format msgid "compl(%lf): negative value will give strange results" msgstr "compl(%lf): el valor negativo dará resultados extraños" -#: builtin.c:2598 +#: builtin.c:2762 #, c-format msgid "compl(%lf): fractional value will be truncated" msgstr "compl(%lf): el valor fraccionario será truncado" -#: builtin.c:2771 +#: builtin.c:2935 #, c-format msgid "dcgettext: `%s' is not a valid locale category" msgstr "dcgettext: `%s' no es una categoría local válida" -#: eval.c:266 +#: eval.c:303 #, c-format msgid "unknown nodetype %d" msgstr "tipo de nodo %d desconocido" -#: eval.c:312 +#: eval.c:350 msgid "buffer overflow in genflags2str" msgstr "desbordamiento de almacenamiento temporal en genflags2str" -#: eval.c:647 +#: eval.c:382 eval.c:388 profile.c:837 +#, c-format +msgid "attempt to use array `%s' in a scalar context" +msgstr "se intentó usar la matriz `%s' en un contexto escalar" + +#: eval.c:730 #, c-format msgid "for loop: array `%s' changed size from %ld to %ld during loop execution" msgstr "" "ciclo for: la matriz `%s' cambió de tamaño de %ld a %ld durante la ejecución " "del ciclo" -#: eval.c:668 +#: eval.c:751 msgid "`break' outside a loop is not portable" msgstr "`break' fuera de un ciclo no es transportable" -#: eval.c:672 +#: eval.c:755 msgid "`break' outside a loop is not allowed" msgstr "no se permite `break' fuera de un ciclo" -#: eval.c:689 +#: eval.c:772 msgid "`continue' outside a loop is not portable" msgstr "`continue' fuera de un ciclo no es transportable" -#: eval.c:693 +#: eval.c:776 msgid "`continue' outside a loop is not allowed" msgstr "no se permite `continue' fuera de un ciclo" -#: eval.c:727 +#: eval.c:810 msgid "`next' cannot be called from a BEGIN rule" msgstr "`next' no se puede llamar desde una regla BEGIN" -#: eval.c:729 +#: eval.c:812 msgid "`next' cannot be called from an END rule" msgstr "`next' no se puede llamar desde una regla END" -#: eval.c:738 +#: eval.c:821 msgid "`nextfile' cannot be called from a BEGIN rule" msgstr "`nextfile' no se puede llamar desde una regla BEGIN" -#: eval.c:740 +#: eval.c:823 msgid "`nextfile' cannot be called from an END rule" msgstr "`nextfile' no se puede llamar desde una regla END" -#: eval.c:785 +#: eval.c:872 msgid "statement has no effect" msgstr "la sentencia no tiene efecto" -#: eval.c:828 eval.c:1726 +#: eval.c:915 eval.c:1873 #, c-format msgid "can't use function name `%s' as variable or array" msgstr "no se puede usar el nombre de la función `%s' como variable o matriz" -#: eval.c:835 eval.c:841 +#: eval.c:922 eval.c:928 #, c-format msgid "reference to uninitialized argument `%s'" msgstr "referencia al argumento sin inicializar `%s'" -#: eval.c:848 eval.c:907 eval.c:1732 eval.c:1742 profile.c:807 -#, c-format -msgid "attempt to use array `%s' in a scalar context" -msgstr "se intentó usar la matriz `%s' en un contexto escalar" - -#: eval.c:858 eval.c:1752 +#: eval.c:937 eval.c:1882 #, c-format msgid "reference to uninitialized variable `%s'" msgstr "referencia a la variable sin inicializar `%s'" -#: eval.c:1007 +#: eval.c:1083 msgid "" "concatenation: side effects in one expression have changed the length of " "another!" @@ -820,49 +847,50 @@ msgstr "" "concatenación: ¡Los efectos laterales en una expresión han cambiado la " "longitud de otra!" -#: eval.c:1032 +#: eval.c:1162 msgid "assignment used in conditional context" msgstr "se usó una asignación en un contexto condicional" -#: eval.c:1122 +#: eval.c:1252 msgid "division by zero attempted" msgstr "se intentó una división por cero" -#: eval.c:1137 +#: eval.c:1267 #, c-format msgid "division by zero attempted in `%%'" msgstr "se intentó una división por cero en `%%'" -#: eval.c:1152 profile.c:683 +#: eval.c:1282 profile.c:713 #, c-format msgid "illegal type (%s) in tree_eval" msgstr "tipo ilegal (%s) en tree_eval" -#: eval.c:1328 +#: eval.c:1459 msgid "division by zero attempted in `/='" msgstr "se intentó una división por cero en `/='" -#: eval.c:1346 +#: eval.c:1477 #, c-format msgid "division by zero attempted in `%%='" msgstr "se intentó una división por cero en `%%='" -#: eval.c:1586 +#: eval.c:1738 #, c-format msgid "function `%s' called with more arguments than declared" msgstr "se llamó a la función `%s' con más argumentos de los declarados" -#: eval.c:1633 +#: eval.c:1782 #, c-format msgid "function `%s' not defined" msgstr "la función `%s' no está definida" -#: eval.c:1639 +#: eval.c:1788 #, c-format msgid "function %s called\n" msgstr "se llamó a la función %s\n" -#: eval.c:1698 +#: eval.c:1845 +#, c-format msgid "" "\n" "\t# Function Call Stack:\n" @@ -872,41 +900,42 @@ msgstr "" "\t# Pila de Llamadas de Funciones:\n" "\n" -#: eval.c:1701 +#: eval.c:1848 +#, c-format msgid "\t# -- main --\n" msgstr "\t# -- principal --\n" -#: eval.c:1867 +#: eval.c:2003 msgid "attempt to field reference from non-numeric value" msgstr "se intentó una referencia de campo desde un valor que no es un número" -#: eval.c:1869 +#: eval.c:2005 msgid "attempt to reference from null string" msgstr "se intentó una referencia desde una cadena nula" -#: eval.c:1875 +#: eval.c:2011 #, c-format msgid "attempt to access field %d" msgstr "se intentó accesar al campo %d" -#: eval.c:1896 eval.c:1903 profile.c:900 +#: eval.c:2032 eval.c:2039 profile.c:934 msgid "assignment is not allowed to result of builtin function" msgstr "no se permite asignación como resultado de una función interna" -#: eval.c:1951 +#: eval.c:2103 msgid "`IGNORECASE' is a gawk extension" msgstr "`IGNORECASE' es una extensión de gawk" -#: eval.c:1980 +#: eval.c:2133 msgid "`BINMODE' is a gawk extension" msgstr "`BINMODE' es una extensión de gawk" -#: eval.c:2092 +#: eval.c:2255 #, c-format msgid "bad `%sFMT' specification `%s'" msgstr "especificación `%sFMT' `%s' errónea" -#: eval.c:2170 +#: eval.c:2333 msgid "turning off `--lint' due to assignment to `LINT'" msgstr "desactivando `--lint' debido a una asignación a `LINT'" @@ -925,7 +954,57 @@ msgid "extension: library `%s': cannot call function `%s' (%s)\n" msgstr "" "extension: biblioteca `%s': no se puede llamar a la función `%s' (%s)\n" -#: ext.c:183 +#: ext.c:102 +msgid "extension: missing function name" +msgstr "" + +#: ext.c:107 +#, fuzzy, c-format +msgid "extension: illegal character `%c' in function name `%s'" +msgstr "" +"extension: biblioteca `%s': no se puede llamar a la función `%s' (%s)\n" + +#: ext.c:113 +#, fuzzy, c-format +msgid "extension: can't redefine function `%s'" +msgstr "extension: no se puede abrir `%s' (%s)\n" + +#: ext.c:117 +#, fuzzy, c-format +msgid "extension: function `%s' already defined" +msgstr "la función `%s' no está definida" + +#: ext.c:122 +#, c-format +msgid "extension: can't use gawk built-in `%s' as function name" +msgstr "" + +#: ext.c:124 +#, fuzzy, c-format +msgid "extension: function name `%s' previously defined" +msgstr "el nombre de función `%s' se definió previamente" + +#: ext.c:201 +#, c-format +msgid "function `%s' defined to take no more than `%d' argument(s)" +msgstr "" + +#: ext.c:204 +#, fuzzy, c-format +msgid "function `%s': missing argument #%d" +msgstr "la función `%s' no está definida" + +#: ext.c:214 +#, fuzzy, c-format +msgid "function `%s': argument #%d: attempt to use scalar as an array" +msgstr "se intentó usar el dato escalar `%s' como una matriz" + +#: ext.c:218 +#, c-format +msgid "function `%s': argument #%d: attempt to use array as a scalar" +msgstr "" + +#: ext.c:243 msgid "Operation Not Supported" msgstr "No Se Da Soporte A La Operación" @@ -955,539 +1034,539 @@ msgstr "el campo %d en FIELDWIDTHS, debe ser > 0" msgid "null string for `FS' is a gawk extension" msgstr "la cadena nula para `FS' es una extensión de gawk" -#: getopt.c:692 getopt.c:704 +#: getopt.c:692 getopt.c:711 #, c-format msgid "%s: option `%s' is ambiguous\n" msgstr "%s: la opción `%s' es ambigua\n" -#: getopt.c:737 getopt.c:741 +#: getopt.c:744 getopt.c:748 #, c-format msgid "%s: option `--%s' doesn't allow an argument\n" msgstr "%s: la opción `--%s' no admite ningún argumento\n" -#: getopt.c:750 getopt.c:755 +#: getopt.c:757 getopt.c:762 #, 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" -#: getopt.c:791 getopt.c:804 getopt.c:1093 getopt.c:1106 +#: getopt.c:807 getopt.c:829 getopt.c:1159 getopt.c:1181 #, c-format msgid "%s: option `%s' requires an argument\n" msgstr "%s: la opción `%s' requiere un argumento\n" -#: getopt.c:842 getopt.c:845 +#: getopt.c:867 getopt.c:870 #, c-format msgid "%s: unrecognized option `--%s'\n" msgstr "%s: no se reconoce la opción `--%s'\n" -#: getopt.c:853 getopt.c:856 +#: getopt.c:878 getopt.c:881 #, c-format msgid "%s: unrecognized option `%c%s'\n" msgstr "%s: no se reconoce la opción `%c%s'\n" -#: getopt.c:903 getopt.c:906 +#: getopt.c:936 getopt.c:939 #, c-format msgid "%s: illegal option -- %c\n" msgstr "%s: opción ilegal -- %c\n" -#: getopt.c:912 getopt.c:915 +#: getopt.c:945 getopt.c:948 #, c-format msgid "%s: invalid option -- %c\n" msgstr "%s: opción inválida -- %c\n" -#: getopt.c:962 getopt.c:973 getopt.c:1159 getopt.c:1172 main.c:434 +#: getopt.c:1003 getopt.c:1022 getopt.c:1234 getopt.c:1255 main.c:433 #, c-format msgid "%s: option requires an argument -- %c\n" msgstr "%s: la opción requiere un argumento -- %c\n" -#: getopt.c:1025 getopt.c:1036 +#: getopt.c:1074 getopt.c:1093 #, c-format msgid "%s: option `-W %s' is ambiguous\n" msgstr "%s: la opción `-W %s' es ambigua\n" -#: getopt.c:1060 getopt.c:1072 +#: getopt.c:1117 getopt.c:1138 #, 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" -#: io.c:305 +#: io.c:308 #, c-format msgid "cannot open file `%s' for reading (%s)" msgstr "no se puede abrir el fichero `%s' para lectura (%s)" -#: io.c:392 +#: io.c:395 #, c-format msgid "close of fd %d (`%s') failed (%s)" msgstr "falló al cerrar el df %d (`%s') (%s)" -#: io.c:530 +#: io.c:533 #, c-format msgid "invalid tree type %s in redirect()" msgstr "tipo de árbol %s inválido en redirect()" -#: io.c:536 +#: io.c:539 #, c-format msgid "expression in `%s' redirection only has numeric value" msgstr "la expresión en la redirección `%s' sólo tiene un valor numérico" -#: io.c:542 +#: io.c:545 #, c-format msgid "expression for `%s' redirection has null string value" msgstr "la expresión para la redirección `%s' tiene un valor de cadena nula" -#: io.c:547 +#: io.c:550 #, c-format msgid "filename `%s' for `%s' redirection may be result of logical expression" msgstr "" "el fichero `%s' para la redirección `%s' puede ser resultado de una " "expresión lógica" -#: io.c:569 +#: io.c:588 #, c-format msgid "unnecessary mixing of `>' and `>>' for file `%.*s'" msgstr "mezcla innecesaria de `>' y `>>' para el fichero `%.*s'" -#: io.c:621 +#: io.c:640 #, c-format msgid "can't open pipe `%s' for output (%s)" msgstr "no se puede abrir la tubería `%s' para la salida (%s)" -#: io.c:630 +#: io.c:649 #, c-format msgid "can't open pipe `%s' for input (%s)" msgstr "no se puede abrir la tubería `%s' para la entrada (%s)" -#: io.c:643 +#: io.c:662 #, c-format msgid "can't open two way socket `%s' for input/output (%s)" msgstr "" "no se puede abrir el `socket' de dos vías `%s' para entrada/salida (%s)" -#: io.c:647 +#: io.c:666 #, c-format msgid "can't open two way pipe `%s' for input/output (%s)" msgstr "no se puede abrir la tubería de dos vías `%s' para entrada/salida (%s)" -#: io.c:723 +#: io.c:742 #, c-format msgid "can't redirect from `%s' (%s)" msgstr "no se puede redirigir desde `%s' (%s)" -#: io.c:726 +#: io.c:745 #, c-format msgid "can't redirect to `%s' (%s)" msgstr "no se puede redirigir a `%s' (%s)" -#: io.c:765 +#: io.c:784 msgid "" "reached system limit for open files: starting to multiplex file descriptors" msgstr "" "se alcanzó el límite del sistema para ficheros abiertos: comenzando a " "multiplexar los descriptores de fichero" -#: io.c:777 +#: io.c:800 #, c-format msgid "close of `%s' failed (%s)." msgstr "falló al cerrar `%s' (%s)." -#: io.c:784 +#: io.c:808 msgid "too many pipes or input files open" msgstr "demasiadas tuberías o ficheros de entrada abiertos" -#: io.c:807 +#: io.c:831 msgid "close: second argument must be `to' or `from'" msgstr "close: el segundo argumento debe ser `to' o `from'" -#: io.c:821 +#: io.c:845 #, c-format msgid "close: `%.*s' is not an open file, pipe or co-process" msgstr "close: `%.*s' no es un fichero abierto, tubería o co-proceso" -#: io.c:825 +#: io.c:849 msgid "close of redirection that was never opened" msgstr "cerrado de una redirección que nunca fue abierta" -#: io.c:862 +#: io.c:945 #, c-format msgid "close: redirection `%s' not opened with `|&', second argument ignored" msgstr "" "close: la redirección `%s' no se abre con `|&', se ignoró el segundo " "argumento" -#: io.c:924 +#: io.c:960 #, c-format msgid "failure status (%d) on pipe close of `%s' (%s)" msgstr "estado de fallo (%d) al cerrar la tubería de `%s' (%s)" -#: io.c:927 +#: io.c:963 #, c-format msgid "failure status (%d) on file close of `%s' (%s)" msgstr "estado de fallo (%d) al cerrar el fichero de `%s' (%s)" -#: io.c:946 +#: io.c:983 #, c-format msgid "no explicit close of socket `%s' provided" msgstr "no se provee el cerrado explícito del `socket' `%s'" -#: io.c:949 +#: io.c:986 #, c-format msgid "no explicit close of co-process `%s' provided" msgstr "no se provee el cerrado explícito del co-proceso `%s'" -#: io.c:952 +#: io.c:989 #, c-format msgid "no explicit close of pipe `%s' provided" msgstr "no se provee el cerrado explícito del la tubería `%s'" -#: io.c:955 +#: io.c:992 #, c-format msgid "no explicit close of file `%s' provided" msgstr "no se provee el cerrado explícito del fichero `%s'" -#: io.c:984 io.c:1038 +#: io.c:1021 io.c:1075 #, c-format msgid "error writing standard output (%s)" msgstr "error al escribir en la salida estándar (%s)" -#: io.c:988 io.c:1042 +#: io.c:1025 io.c:1079 #, c-format msgid "error writing standard error (%s)" msgstr "error al escribir en la salida estándar de error (%s)" -#: io.c:996 +#: io.c:1033 #, c-format msgid "pipe flush of `%s' failed (%s)." msgstr "falló la limpieza de la tubería de `%s' (%s)." -#: io.c:999 +#: io.c:1036 #, c-format msgid "co-process flush of pipe to `%s' failed (%s)." msgstr "falló la limpieza del co-proceso de la tubería a `%s' (%s)." -#: io.c:1002 +#: io.c:1039 #, c-format msgid "file flush of `%s' failed (%s)." msgstr "falló la limpieza del fichero de `%s' (%s)." -#: io.c:1161 +#: io.c:1198 msgid "/inet/raw client not ready yet, sorry" msgstr "el cliente /inet/raw no está listo aún, perdón" -#: io.c:1163 io.c:1200 +#: io.c:1200 io.c:1237 msgid "only root may use `/inet/raw'." msgstr "sólo root puede utilizar `/inet/raw'." -#: io.c:1198 +#: io.c:1235 msgid "/inet/raw server not ready yet, sorry" msgstr "el servidor /inet/raw no está listo aún, perdón" -#: io.c:1288 +#: io.c:1325 #, c-format msgid "no (known) protocol supplied in special filename `%s'" msgstr "" "no se proporciona algún protocolo (conocido) en el nombre de fichero " "especial `%s'" -#: io.c:1306 +#: io.c:1343 #, c-format msgid "special file name `%s' is incomplete" msgstr "el nombre de fichero especial `%s' está incompleto" -#: io.c:1318 +#: io.c:1355 #, c-format msgid "local port invalid in `%s'" msgstr "puerto local inválido en `%s'" -#: io.c:1330 +#: io.c:1367 msgid "must supply a remote hostname to `/inet'" msgstr "se debe proporcionar a `/inet' un nombre de anfitrión remoto" -#: io.c:1345 +#: io.c:1382 msgid "must supply a remote port to `/inet'" msgstr "se debe proporcionar a `/inet' un puerto remoto" -#: io.c:1351 +#: io.c:1388 #, c-format msgid "remote port invalid in `%s'" msgstr "puerto remoto inválido en `%s'" -#: io.c:1361 +#: io.c:1398 msgid "TCP/IP communications are not supported" msgstr "No tienen soporte las comunicaciones TCP/IP" -#: io.c:1370 io.c:1551 +#: io.c:1407 io.c:1588 #, c-format msgid "file `%s' is a directory" msgstr "el fichero `%s' es un directorio" -#: io.c:1440 +#: io.c:1477 #, c-format msgid "use `PROCINFO[\"%s\"]' instead of `%s'" msgstr "use `PROCINFO[\"%s\"]' en lugar de `%s'" -#: io.c:1472 +#: io.c:1509 msgid "use `PROCINFO[...]' instead of `/dev/user'" msgstr "use `PROCINFO[...]' en lugar de `/dev/user'" -#: io.c:1537 io.c:1711 +#: io.c:1574 io.c:1748 #, c-format msgid "could not open `%s', mode `%s'" msgstr "no se puede abrir `%s', modo `%s'" -#: io.c:1762 +#: io.c:1799 #, c-format msgid "close of master pty failed (%s)" msgstr "falló al cerrar el pty maestro (%s)" -#: io.c:1764 io.c:1916 io.c:2068 +#: io.c:1801 io.c:1953 io.c:2105 #, c-format msgid "close of stdout in child failed (%s)" msgstr "falló al cerrar la salida estándar en el hijo (%s)" -#: io.c:1767 +#: io.c:1804 #, c-format msgid "moving slave pty to stdout in child failed (dup: %s)" msgstr "" "falló el movimiento del pty esclavo a la salida estándar en el hijo (dup: %s)" -#: io.c:1769 io.c:1921 +#: io.c:1806 io.c:1958 #, c-format msgid "close of stdin in child failed (%s)" msgstr "falló al cerrar la entrada estándar en el hijo (%s)" -#: io.c:1772 +#: io.c:1809 #, c-format msgid "moving slave pty to stdin in child failed (dup: %s)" msgstr "" "falló el movimiento del pty esclavo a la entrada estándar en el hijo (dup: %" "s)" -#: io.c:1774 io.c:1793 +#: io.c:1811 io.c:1830 #, c-format msgid "close of slave pty failed (%s)" msgstr "falló al cerrar el pty esclavo (%s)" -#: io.c:1867 io.c:1919 io.c:2049 io.c:2071 +#: io.c:1904 io.c:1956 io.c:2086 io.c:2108 #, c-format msgid "moving pipe to stdout in child failed (dup: %s)" msgstr "falló el movimiento a la salida estándar en el hijo (dup: %s)" -#: io.c:1871 io.c:1924 +#: io.c:1908 io.c:1961 #, c-format msgid "moving pipe to stdin in child failed (dup: %s)" msgstr "" "falló el movimiento de la tubería a la entrada estándar en el hijo (dup: %s)" -#: io.c:1888 io.c:2062 +#: io.c:1925 io.c:2099 msgid "restoring stdout in parent process failed\n" msgstr "falló la restauración de la salida estándar en el proceso padre\n" -#: io.c:1893 +#: io.c:1930 msgid "restoring stdin in parent process failed\n" msgstr "falló la restauración de la entrada estándar en el proceso padre\n" -#: io.c:1927 io.c:2073 io.c:2084 +#: io.c:1964 io.c:2110 io.c:2121 #, c-format msgid "close of pipe failed (%s)" msgstr "falló al cerrar la tubería (%s)" -#: io.c:1972 +#: io.c:2009 msgid "`|&' not supported" msgstr "`|&' no tiene soporte" -#: io.c:2039 +#: io.c:2076 #, c-format msgid "cannot open pipe `%s' (%s)" msgstr "no se puede abrir la tubería `%s' (%s)" -#: io.c:2080 +#: io.c:2117 #, c-format msgid "cannot create child process for `%s' (fork: %s)" msgstr "no se puede crear el proceso hijo para `%s' (fork: %s)" -#: io.c:2423 +#: io.c:2460 #, c-format msgid "data file `%s' is empty" msgstr "el fichero de datos `%s' está vacío" -#: io.c:2466 io.c:2474 +#: io.c:2503 io.c:2511 msgid "could not allocate more input memory" msgstr "no se puede reservar más memoria de entrada" -#: io.c:2832 io.c:2895 +#: io.c:2869 io.c:2932 #, c-format msgid "error reading input file `%s': %s" msgstr "error al leer el fichero de entrada `%s': %s" -#: io.c:3020 +#: io.c:3057 msgid "multicharacter value of `RS' is a gawk extension" msgstr "el valor multicaracter de `RS' es una extensión de gawk" -#: main.c:324 +#: main.c:323 msgid "`-m[fr]' option irrelevant in gawk" msgstr "la opción -m[fr] es irrelevante en gawk" -#: main.c:326 +#: main.c:325 msgid "-m option usage: `-m[fr] nnn'" msgstr "uso de la opción -m: `-m[fr]' nnn" -#: main.c:343 +#: main.c:342 #, c-format msgid "%s: option `-W %s' unrecognized, ignored\n" msgstr "%s: no se reconoce la opción `-W %s', se ignora\n" -#: main.c:380 +#: main.c:379 msgid "empty argument to `--source' ignored" msgstr "se ignora el argumento vacío para `--source'" -#: main.c:451 +#: main.c:450 msgid "environment variable `POSIXLY_CORRECT' set: turning on `--posix'" msgstr "" "la variable de ambiente `POSIXLY_CORRECT' está establecida: activando `--" "posix'" -#: main.c:456 +#: main.c:455 msgid "`--posix' overrides `--traditional'" msgstr "`--posix' se impone a `--traditional'" -#: main.c:467 +#: main.c:466 msgid "`--posix'/`--traditional' overrides `--non-decimal-data'" msgstr "`--posix'/`--traditional' se imponen a `--non-decimal-data'" -#: main.c:471 +#: main.c:470 #, c-format msgid "running %s setuid root may be a security problem" msgstr "ejecutar %s como setuid root puede ser un problema de seguridad" -#: main.c:512 +#: main.c:511 #, c-format msgid "can't set binary mode on stdin (%s)" msgstr "no se puede establecer el modo binario en la entrada estándar (%s)" -#: main.c:515 +#: main.c:514 #, c-format msgid "can't set binary mode on stdout (%s)" msgstr "no se puede establecer el modo binario en la salida estándar (%s)" -#: main.c:517 +#: main.c:516 #, c-format msgid "can't set binary mode on stderr (%s)" msgstr "" "no se puede establecer el modo binario en la salida estándar de error (%s)" -#: main.c:547 +#: main.c:546 msgid "no program text at all!" msgstr "¡No hay ningún programa de texto!" -#: main.c:620 +#: main.c:623 #, c-format msgid "Usage: %s [POSIX or GNU style options] -f progfile [--] file ...\n" msgstr "" "Modo de empleo: %s [opciones estilo POSIX o GNU] -f fichprog [--] " "fichero ...\n" -#: main.c:622 +#: main.c:625 #, c-format msgid "Usage: %s [POSIX or GNU style options] [--] %cprogram%c file ...\n" msgstr "" "Modo de empleo: %s [opciones estilo POSIX o GNU] [--] %cprograma%c " "fichero ...\n" -#: main.c:627 +#: main.c:630 msgid "POSIX options:\t\tGNU long options:\n" msgstr "Opciones POSIX:\t\tOpciones largas GNU:\n" -#: main.c:628 +#: main.c:631 msgid "\t-f progfile\t\t--file=progfile\n" msgstr "\t-f fichprog\t\t--file=fichprog\n" -#: main.c:629 +#: main.c:632 msgid "\t-F fs\t\t\t--field-separator=fs\n" msgstr "\t-F sc\t\t\t--field-separator=sc\n" -#: main.c:630 +#: main.c:633 msgid "\t-v var=val\t\t--assign=var=val\n" msgstr "\t-v var=valor\t\t--assign=var=valor\n" -#: main.c:631 +#: main.c:634 msgid "\t-m[fr] val\n" msgstr "\t-m[fr] valor\n" -#: main.c:632 +#: main.c:635 msgid "\t-W compat\t\t--compat\n" msgstr "\t-W compat\t\t--compat\n" -#: main.c:633 +#: main.c:636 msgid "\t-W copyleft\t\t--copyleft\n" msgstr "\t-W copyleft\t\t--copyleft\n" -#: main.c:634 +#: main.c:637 msgid "\t-W copyright\t\t--copyright\n" msgstr "\t-W copyright\t\t--copyright\n" -#: main.c:635 +#: main.c:638 msgid "\t-W dump-variables[=file]\t--dump-variables[=file]\n" msgstr "\t-W dump-variables[=fichero]\t--dump-variables[=fichero]\n" -#: main.c:636 +#: main.c:639 msgid "\t-W gen-po\t\t--gen-po\n" msgstr "\t-W gen-po\t\t--gen-po\n" -#: main.c:637 +#: main.c:640 msgid "\t-W help\t\t\t--help\n" msgstr "\t-W help\t\t\t--help\n" -#: main.c:638 +#: main.c:641 msgid "\t-W lint[=fatal]\t\t--lint[=fatal]\n" msgstr "\t-W lint[=fatal]\t\t--lint[=fatal]\n" -#: main.c:639 +#: main.c:642 msgid "\t-W lint-old\t\t--lint-old\n" msgstr "\t-W lint-old\t\t--lint-old\n" -#: main.c:640 +#: main.c:643 msgid "\t-W non-decimal-data\t--non-decimal-data\n" msgstr "\t-W non-decimal-data\t--non-decimal-data\n" -#: main.c:642 +#: main.c:645 msgid "\t-W nostalgia\t\t--nostalgia\n" msgstr "\t-W nostalgia\t\t--nostalgia\n" -#: main.c:645 +#: main.c:648 msgid "\t-W parsedebug\t\t--parsedebug\n" msgstr "\t-W parsedebug\t\t--parsedebug\n" -#: main.c:647 +#: main.c:650 msgid "\t-W profile[=file]\t--profile[=file]\n" msgstr "\t-W profile[=fichero]\t--profile[=fichero]\n" -#: main.c:648 +#: main.c:651 msgid "\t-W posix\t\t--posix\n" msgstr "\t-W posix\t\t--posix\n" -#: main.c:649 +#: main.c:652 msgid "\t-W re-interval\t\t--re-interval\n" msgstr "\t-W re-interval\t\t--re-interval\n" # Esta es la línea más larga de la lista de argumentos. # Probar con gawk para revisar tabuladores. cfuga -#: main.c:650 +#: main.c:653 msgid "\t-W source=program-text\t--source=program-text\n" msgstr "\t-W source=texto-prog\t--source=texto-prog\n" -#: main.c:651 +#: main.c:654 msgid "\t-W traditional\t\t--traditional\n" msgstr "\t-W traditional\t\t--traditional\n" -#: main.c:652 +#: main.c:655 msgid "\t-W usage\t\t--usage\n" msgstr "\t-W usage\t\t--usage\n" -#: main.c:653 +#: main.c:656 msgid "\t-W version\t\t--version\n" msgstr "\t-W version\t\t--version\n" -#: main.c:657 +#: main.c:660 msgid "" "\n" "To report bugs, see node `Bugs' in `gawk.info', which is\n" @@ -1500,7 +1579,7 @@ msgstr "" "impresa.\n" "\n" -#: main.c:661 +#: main.c:664 msgid "" "gawk is a pattern scanning and processing language.\n" "By default it reads standard input and writes standard output.\n" @@ -1510,7 +1589,7 @@ msgstr "" "Por omisión lee la entrada estándar y escribe en la salida estándar.\n" "\n" -#: main.c:665 +#: main.c:668 msgid "" "Examples:\n" "\tgawk '{ sum += $1 }; END { print sum }' file\n" @@ -1520,7 +1599,7 @@ msgstr "" "\tgawk '{ sum += $1 }; END { print sum }' fichero\n" "\tgawk -F: '{ print $1 }' /etc/passwd\n" -#: main.c:682 +#: main.c:685 #, c-format msgid "" "Copyright (C) 1989, 1991-%d Free Software Foundation.\n" @@ -1540,7 +1619,7 @@ msgstr "" "(a su elección) cualquier versión posterior.\n" "\n" -#: main.c:690 +#: main.c:693 msgid "" "This program is distributed in the hope that it will be useful,\n" "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" @@ -1554,7 +1633,7 @@ msgstr "" "Licencia Pública General de GNU para más detalles.\n" "\n" -#: main.c:696 +#: main.c:699 msgid "" "You should have received a copy of the GNU General Public License\n" "along with this program; if not, write to the Free Software\n" @@ -1564,11 +1643,11 @@ msgstr "" "junto con este programa; si no es así, escriba a la Free Software\n" "Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n" -#: main.c:730 +#: main.c:733 msgid "-Ft does not set FS to tab in POSIX awk" msgstr "-Ft no establece FS a tabulador en el awk de POSIX" -#: main.c:956 +#: main.c:962 #, c-format msgid "" "%s: `%s' argument to `-v' not in `var=value' form\n" @@ -1577,40 +1656,41 @@ msgstr "" "%s: el argumento `%s' para `-v' no es de la forma `var=valor'\n" "\n" -#: main.c:976 +#: main.c:982 #, c-format msgid "`%s' is not a legal variable name" msgstr "`%s' no es un nombre de variable legal" -#: main.c:979 +#: main.c:985 #, c-format msgid "`%s' is not a variable name, looking for file `%s=%s'" msgstr "`%s' no es un nombre de variable, se busca el fichero `%s=%s'" -#: main.c:1012 +#: main.c:1018 msgid "floating point exception" msgstr "excepción de coma flotante" -#: main.c:1019 +#: main.c:1025 msgid "fatal error: internal error" msgstr "error fatal: error interno" -#: main.c:1069 +#: main.c:1075 #, c-format msgid "no pre-opened fd %d" msgstr "no existe el df %d abierto previamente" -#: main.c:1074 +#: main.c:1082 #, c-format msgid "could not pre-open /dev/null for fd %d" msgstr "no se puede abrir previamente /dev/null para el df %d" -#: main.c:1097 main.c:1106 +#: main.c:1105 main.c:1114 #, c-format msgid "could not find groups: %s" msgstr "no se pueden encontrar los grupos: %s" #: msg.c:54 +#, c-format msgid "cmd. line:" msgstr "línea ord.:" @@ -1630,19 +1710,19 @@ msgstr "fatal: " msgid "can't convert string to float" msgstr "no se puede convertir una cadena a coma flotante" -#: node.c:355 +#: node.c:357 msgid "backslash at end of string" msgstr "barra invertida al final de la cadena" -#: node.c:539 +#: node.c:541 msgid "POSIX does not allow `\\x' escapes" msgstr "POSIX no permite escapes `\\x'" -#: node.c:545 +#: node.c:547 msgid "no hex digits in `\\x' escape sequence" msgstr "no hay dígitos hexadecimales en la secuencia de escape `\\x'" -#: node.c:579 +#: node.c:581 #, c-format msgid "escape sequence `\\%c' treated as plain `%c'" msgstr "la secuencia de escape `\\%c' tratada como una simple `%c'" @@ -1657,21 +1737,27 @@ msgstr "%s %s `%s': no se puede establecer close-on-exec: (fcntl: %s)" msgid "could not open `%s' for writing: %s" msgstr "no se puede abrir `%s' para escritura: %s" -#: profile.c:449 +#: profile.c:467 #, c-format msgid "internal error: %s with null vname" msgstr "error interno: %s con vname nulo" -#: profile.c:512 +#: profile.c:530 msgid "# treated internally as `delete'" msgstr "# se trata internamente como `delete'" -#: profile.c:1162 +#: profile.c:1167 +#, c-format +msgid "# this is a dynamically loaded extension function" +msgstr "" + +#: profile.c:1198 #, c-format msgid "\t# gawk profile, created %s\n" msgstr "\t# perfil de gawk, creado %s\n" -#: profile.c:1165 +#: profile.c:1201 +#, c-format msgid "" "\t# BEGIN block(s)\n" "\n" @@ -1679,7 +1765,8 @@ msgstr "" "\t# bloque(s) BEGIN\n" "\n" -#: profile.c:1175 +#: profile.c:1211 +#, c-format msgid "" "\t# Rule(s)\n" "\n" @@ -1687,7 +1774,8 @@ msgstr "" "\t# Regla(s)\n" "\n" -#: profile.c:1181 +#: profile.c:1217 +#, c-format msgid "" "\t# END block(s)\n" "\n" @@ -1695,7 +1783,8 @@ msgstr "" "\t# bloque(s) END\n" "\n" -#: profile.c:1201 +#: profile.c:1237 +#, c-format msgid "" "\n" "\t# Functions, listed alphabetically\n" @@ -1703,93 +1792,94 @@ msgstr "" "\n" "\t# Funciones, enumeradas alfabéticamente\n" -#: profile.c:1413 +#: profile.c:1452 #, c-format msgid "unexpected type %s in prec_level" msgstr "tipo %s inesperado en prec_level" -#: re.c:193 -#, c-format -msgid "regex match failed, not enough memory to match string \"%.*s%s\"" -msgstr "" -"falló la coincidencia de la expresión regular, no hay suficiente memoria " -"para que coincida la cadena \"%.*s%s\"" - -#: regcomp.c:136 +#: regcomp.c:150 msgid "Success" msgstr "Éxito" -#: regcomp.c:139 +#: regcomp.c:153 msgid "No match" msgstr "No hay coincidencia" -#: regcomp.c:142 +#: regcomp.c:156 msgid "Invalid regular expression" msgstr "Expresión regular inválida" -#: regcomp.c:145 +#: regcomp.c:159 msgid "Invalid collation character" msgstr "Caracter de ordenación inválido" -#: regcomp.c:148 +#: regcomp.c:162 msgid "Invalid character class name" msgstr "Nombre de clase de caracter inválido" -#: regcomp.c:151 +#: regcomp.c:165 msgid "Trailing backslash" msgstr "Barra invertida extra al final" -#: regcomp.c:154 +#: regcomp.c:168 msgid "Invalid back reference" msgstr "Referencia hacia atrás inválida" -#: regcomp.c:157 +#: regcomp.c:171 msgid "Unmatched [ or [^" msgstr "[ o [^ desemparejados" -#: regcomp.c:160 +#: regcomp.c:174 msgid "Unmatched ( or \\(" msgstr "( o \\( desemparejados" -#: regcomp.c:163 +#: regcomp.c:177 msgid "Unmatched \\{" msgstr "\\{ desemparejado" -#: regcomp.c:166 +#: regcomp.c:180 msgid "Invalid content of \\{\\}" msgstr "Contenido inválido de \\{\\}" -#: regcomp.c:169 +#: regcomp.c:183 msgid "Invalid range end" msgstr "Final de rango inválido" -#: regcomp.c:172 +#: regcomp.c:186 msgid "Memory exhausted" msgstr "Memoria agotada" -#: regcomp.c:175 +#: regcomp.c:189 msgid "Invalid preceding regular expression" msgstr "Expresión regular precedente inválida" -#: regcomp.c:178 +#: regcomp.c:192 msgid "Premature end of regular expression" msgstr "Fin prematuro de la expresión regular" -#: regcomp.c:181 +#: regcomp.c:195 msgid "Regular expression too big" msgstr "La expresión regular es demasiado grande" -#: regcomp.c:184 +#: regcomp.c:198 msgid "Unmatched ) or \\)" msgstr ") o \\) desemparejados" -#: regcomp.c:621 +#: regcomp.c:668 msgid "No previous regular expression" msgstr "No hay una expresión regular previa" +#~ msgid "or used as a variable or an array" +#~ msgstr "o se usó como una variable o una matriz" + #~ msgid "substr: length %g is < 0" #~ msgstr "substr: la longitud %g es < 0" +#~ msgid "regex match failed, not enough memory to match string \"%.*s%s\"" +#~ msgstr "" +#~ "falló la coincidencia de la expresión regular, no hay suficiente memoria " +#~ "para que coincida la cadena \"%.*s%s\"" + #~ msgid "delete: illegal use of variable `%s' as array" #~ msgstr "delete: uso ilegal de la variable `%s' como una matriz" @@ -1808,9 +1898,6 @@ msgstr "No hay una expresi #~ msgid "or used in other expression context" #~ msgstr "se usó or en otro contexto de la expresión" -#~ msgid "attempt to use function `%s' as array" -#~ msgstr "se intentó usar la función `%s' como una matriz" - #~ msgid "`%s' is a function, assignment is not allowed" #~ msgstr "`%s' es una función, no se permite asignación" diff --git a/po/fr.gmo b/po/fr.gmo index babf07b86..cc2662e6a 100644 Binary files a/po/fr.gmo and b/po/fr.gmo differ diff --git a/po/fr.po b/po/fr.po index d0b7e7789..2634df8e9 100644 --- a/po/fr.po +++ b/po/fr.po @@ -1,83 +1,90 @@ -# Messages français pour gawk. -# Copyright © 1996 Free Software Foundation, Inc. -# Michel Robitaille , since 1996. +# Messages français pour make. +# Copyright (C) 2004 Free Software Foundation, Inc. +# Michel Robitaille , 1996. # msgid "" msgstr "" -"Project-Id-Version: gawk 3.1.2g\n" +"Project-Id-Version: gawk 3.1.31\n" "Report-Msgid-Bugs-To: arnold@skeeve.com\n" -"POT-Creation-Date: 2003-07-07 11:20-0700\n" -"PO-Revision-Date: 2003-06-26 08:00-0500\n" +"POT-Creation-Date: 2004-07-15 13:02+0300\n" +"PO-Revision-Date: 2004-05-10 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: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" #: array.c:112 +#, fuzzy, c-format +msgid "attempt to use function `%s' as an array" +msgstr "tentative d'utilisation de la fonction « %s » dans le tableau" + +#: array.c:115 #, c-format msgid "attempt to use scalar parameter `%s' as an array" msgstr "" "tentative d'utilisation d'un paramètre scalaire « %s » comme un tableau" -#: array.c:113 +#: array.c:118 #, c-format msgid "attempt to use scalar `%s' as array" msgstr "tentative d'utilisation du scalaire « %s » comme un tableau" -#: array.c:151 -#, c-format +#: array.c:156 +#, fuzzy, c-format msgid "from %s" -msgstr "de %s" +msgstr "%s (de %s)" -#: array.c:506 +#: array.c:511 #, c-format msgid "reference to uninitialized element `%s[\"%s\"]'" msgstr "référence à un élément non initialisé « %s[\"%s\"] »" -#: array.c:512 +#: array.c:517 #, c-format msgid "subscript of array `%s' is null string" msgstr "sous-description du tableau « %s » contient une chaîne nulle" -#: array.c:609 +#: array.c:621 #, c-format msgid "delete: index `%s' not in array `%s'" msgstr "destruction: index « %s » n'est pas dans le tableau « %s »" -#: array.c:769 +#: array.c:791 #, c-format msgid "%s: empty (null)\n" msgstr "%s: vide (null)\n" -#: array.c:774 +#: array.c:796 #, c-format msgid "%s: empty (zero)\n" msgstr "%s: vide (zéro)\n" -#: array.c:778 +#: array.c:800 #, c-format msgid "%s: table_size = %d, array_size = %d\n" msgstr "%s: table_size = %d, array_size = %d\n" -#: array.c:807 -#, c-format +#: array.c:829 +#, fuzzy, c-format msgid "%s: is parameter\n" msgstr "%s: est un paramètre\n" -#: array.c:812 +#: array.c:834 #, c-format msgid "%s: array_ref to %s\n" msgstr "%s: array_ref de %s\n" #: awkgram.y:208 -#, c-format +#, fuzzy, c-format msgid "%s blocks must have an action part" -msgstr "Les blocs %s doivent avoir une partie action" +msgstr "Les blocs de FIN doivent avoir une partie action" #: awkgram.y:211 +#, fuzzy msgid "each rule must have a pattern or an action part" -msgstr "chaque règle doit avoir un pattern ou une partie action" +msgstr "Les blocs de FIN doivent avoir une partie action" #: awkgram.y:267 #, c-format @@ -91,728 +98,757 @@ msgstr "" "la constante d'expression régulière « /%s/ » ressemble à un commentaire en " "C, mais ne l'est pas" -#: awkgram.y:340 awkgram.y:615 +#: awkgram.y:341 awkgram.y:619 msgid "statement may have no effect" msgstr "la déclaration peut n'avoir aucun effet" -#: awkgram.y:435 awkgram.y:455 -#, c-format +#: awkgram.y:436 awkgram.y:456 +#, fuzzy, c-format msgid "`%s' used in %s action" -msgstr "« %s » utilisé dans l'action %s" +msgstr "« next » utilisé dans l'action BEGIN ou END" -#: awkgram.y:448 awkgram.y:451 +#: awkgram.y:449 awkgram.y:452 msgid "`nextfile' is a gawk extension" msgstr "« nextfile » est une extension de gawk" -#: awkgram.y:465 +#: awkgram.y:466 msgid "`return' used outside function context" msgstr "« return » utilisé en dehors du contexte d'une fonction" -#: awkgram.y:504 +#: awkgram.y:508 msgid "plain `print' in BEGIN or END rule should probably be `print \"\"'" msgstr "" "utilisation de « print » dans une règle BEGIN ou END doit être probablement " "« print \"\" »" -#: awkgram.y:517 awkgram.y:524 +#: awkgram.y:521 awkgram.y:528 msgid "`delete array' is a gawk extension" msgstr "« delete array » est une extension de gawk" -#: awkgram.y:532 awkgram.y:539 +#: awkgram.y:536 awkgram.y:543 +#, fuzzy msgid "`delete(array)' is a non-portable tawk extension" -msgstr "« delete(array) » est une extension tawk non portable" +msgstr "« delete array » est une extension de gawk" -#: awkgram.y:583 +#: awkgram.y:587 #, c-format msgid "duplicate case values in switch body: %s" -msgstr "valeur de case en double dans le corp du switch: %s" +msgstr "" -#: awkgram.y:593 +#: awkgram.y:597 msgid "Duplicate `default' detected in switch body" -msgstr "Double « default » détecté dans le corps du switch" +msgstr "" -#: awkgram.y:681 +#: awkgram.y:686 msgid "multistage two-way pipelines don't work" msgstr "pipelines bidirectionnel à multi-étapes ne fonctionnent pas" -#: awkgram.y:772 +#: awkgram.y:777 msgid "regular expression on right of assignment" msgstr "expression régulière à la droite de l'affectation" -#: awkgram.y:782 +#: awkgram.y:800 msgid "regular expression on left of `~' or `!~' operator" msgstr "expression régulière sur la gauche de l'opérateur « ~ » ou « !~ »" -#: awkgram.y:790 +#: awkgram.y:808 msgid "regular expression on right of comparison" msgstr "expression régulière sur la droite de la comparaison" -#: awkgram.y:857 +#: awkgram.y:875 msgid "non-redirected `getline' undefined inside END action" msgstr "« getline » non redirigé indéfini à l'intérieur de l'action END" -#: awkgram.y:884 +#: awkgram.y:902 msgid "call of `length' without parentheses is not portable" msgstr "l'appel de « length » sans les parenthèses n'est pas portable" -#: awkgram.y:887 +#: awkgram.y:905 msgid "call of `length' without parentheses is deprecated by POSIX" msgstr "l'appel de « length » sans les parenthèses est déprécié par POSIX" -#: awkgram.y:940 +#: awkgram.y:958 msgid "use of non-array as array" -msgstr "utilisation d'un non-tableau comme tableau" +msgstr "" -#: awkgram.y:942 +#: awkgram.y:960 msgid "invalid subscript expression" msgstr "sous-expression invalide" -#: awkgram.y:1140 +#: awkgram.y:1158 +#, fuzzy msgid "unexpected newline or end of string" -msgstr "nouvelle ligne inattendue ou fin de chaîne" +msgstr "nouvelle ligne inattendue" -#: awkgram.y:1235 +#: awkgram.y:1254 msgid "empty program text on command line" msgstr "texte du programme sur la ligne de commande est vide" -#: awkgram.y:1292 +#: awkgram.y:1307 #, c-format msgid "can't open source file `%s' for reading (%s)" msgstr "ne peut ouvrir le fichier source « %s » pour lecture (%s)" -#: awkgram.y:1327 +#: awkgram.y:1384 #, c-format msgid "can't read sourcefile `%s' (%s)" msgstr "ne peut lire le fichier source « %s » (%s)" -#: awkgram.y:1335 +#: awkgram.y:1392 #, c-format msgid "source file `%s' is empty" msgstr "fichier source « %s » est vide" -#: awkgram.y:1537 awkgram.y:1647 awkgram.y:1665 awkgram.y:2015 awkgram.y:2100 +#: awkgram.y:1590 awkgram.y:1700 awkgram.y:1718 awkgram.y:2068 awkgram.y:2153 msgid "source file does not end in newline" msgstr "fichier source ne se termine pas par un retour de chariot" -#: awkgram.y:1601 +#: awkgram.y:1654 msgid "unterminated regexp ends with `\\' at end of file" msgstr "" "expression régulière non termineé se terminant par « \\ » à la fin du fichier" -#: awkgram.y:1621 +#: awkgram.y:1674 msgid "unterminated regexp" msgstr "expression régulière non terminée" -#: awkgram.y:1624 +#: awkgram.y:1677 msgid "unterminated regexp at end of file" msgstr "expression régulière non terminée à la fin du fichier" -#: awkgram.y:1691 +#: awkgram.y:1744 msgid "use of `\\ #...' line continuation is not portable" msgstr "" "utilisation de « \\ #... » comme continuation de ligne n'est pas portable" -#: awkgram.y:1703 +#: awkgram.y:1756 msgid "backslash not last character on line" msgstr "la barre oblique inverse n'est pas le dernier caractère sur la ligne" -#: awkgram.y:1748 +#: awkgram.y:1801 msgid "POSIX does not allow operator `**='" msgstr "POSIX ne permet un opérateur « **= »" -#: awkgram.y:1750 +#: awkgram.y:1803 msgid "old awk does not support operator `**='" msgstr "l'ancien awk ne supporte pas l'opérateur « **= »" -#: awkgram.y:1759 +#: awkgram.y:1812 msgid "POSIX does not allow operator `**'" msgstr "POSIX ne permet pas l'opérateur « ** »" -#: awkgram.y:1761 +#: awkgram.y:1814 msgid "old awk does not support operator `**'" msgstr "l'ancien awk ne supporte pas l'opérateur « ** »" -#: awkgram.y:1792 +#: awkgram.y:1845 msgid "operator `^=' is not supported in old awk" msgstr "l'opérateur « ^= » n'est pas supporté dans l'ancien awk" -#: awkgram.y:1800 +#: awkgram.y:1853 msgid "operator `^' is not supported in old awk" msgstr "l'opérateur « ^ » n'est pas supporté dans l'ancien awk" -#: awkgram.y:1884 awkgram.y:1901 +#: awkgram.y:1937 awkgram.y:1954 msgid "unterminated string" msgstr "chaîne non complétée" -#: awkgram.y:2061 +#: awkgram.y:2114 #, c-format msgid "invalid char '%c' in expression" msgstr "caractère invalide « %c » dans l'expression" -#: awkgram.y:2121 +#: awkgram.y:2162 #, c-format msgid "`%s' is a gawk extension" msgstr "« %s » est une extension de gawk" -#: awkgram.y:2124 +#: awkgram.y:2165 #, c-format msgid "`%s' is a Bell Labs extension" msgstr "« %s » est une extension de Bell Labs" -#: awkgram.y:2127 +#: awkgram.y:2168 #, c-format msgid "POSIX does not allow `%s'" msgstr "POSIX ne permet pas « %s »" -#: awkgram.y:2131 +#: awkgram.y:2172 #, c-format msgid "`%s' is not supported in old awk" msgstr "« %s » n'est pas supporté dans l'ancien awk" -#: awkgram.y:2158 +#: awkgram.y:2198 msgid "`goto' considered harmful!\n" msgstr "« goto » considéré néfaste!\n" -#: awkgram.y:2220 +#: awkgram.y:2260 #, c-format msgid "%d is invalid as number of arguments for %s" msgstr "%d est invalide comme nombre d'arguments pour %s" -#: awkgram.y:2239 awkgram.y:2242 +#: awkgram.y:2279 awkgram.y:2282 msgid "match: third argument is a gawk extension" msgstr "match: 3e argument est une extension de gawk" -#: awkgram.y:2255 +#: awkgram.y:2295 #, c-format msgid "%s: string literal as last arg of substitute has no effect" msgstr "" -"%s: la chaîne litérale comme dernier argument d'une substitution n'a aucun " +"%s: la chaîne litérale comme dernier arguement d'une substitution n'a aucun " "effet" -#: awkgram.y:2258 -#, c-format +#: awkgram.y:2298 +#, fuzzy, c-format msgid "%s third parameter is not a changeable object" -msgstr "3e paramètre %s n'est pas un objet modifiable" +msgstr "sub: 3e paramètre n'est pas un objet interchangeable" -#: awkgram.y:2285 awkgram.y:2288 +#: awkgram.y:2325 awkgram.y:2328 msgid "close: second argument is a gawk extension" msgstr "close: 2e argument est une extension de gawk" -#: awkgram.y:2298 +#: awkgram.y:2338 msgid "use of dcgettext(_\"...\") is incorrect: remove leading underscore" msgstr "" "utilisation de dcgettext(_\"...\") est incorrect: enlever les soulignés en " "en-tête" -#: awkgram.y:2313 +#: awkgram.y:2353 +#, fuzzy msgid "use of dcngettext(_\"...\") is incorrect: remove leading underscore" msgstr "" -"utilisation de dcgettext(_\"...\") est incorrecte: enlever les soulignés de " -"l'en-tête" +"utilisation de dcgettext(_\"...\") est incorrect: enlever les soulignés en " +"en-tête" -#: awkgram.y:2384 +#: awkgram.y:2424 #, c-format msgid "function `%s': parameter #%d, `%s', duplicates parameter #%d" msgstr "fonction « %s »: paramètre #%d, « %s » est un double du paramètre #%d" -#: awkgram.y:2417 +#: awkgram.y:2457 #, c-format msgid "function `%s': parameter `%s' shadows global variable" msgstr "fonction « %s »: paramètre « %s » porte ombrage à la variable globale" -#: awkgram.y:2529 +#: awkgram.y:2569 #, c-format msgid "could not open `%s' for writing (%s)" msgstr "ne peut ourvrir « %s » en écriture (%s)" -#: awkgram.y:2530 profile.c:93 +#: awkgram.y:2570 profile.c:93 msgid "sending profile to standard error" msgstr "redirection du profile vers stderr" -#: awkgram.y:2562 +#: awkgram.y:2602 #, c-format msgid "%s: close failed (%s)" msgstr "%s: échec de fermeture (%s)" -#: awkgram.y:2684 +#: awkgram.y:2723 msgid "shadow_funcs() called twice!" msgstr "shadows_funcs() appelé deux fois!" -#: awkgram.y:2711 +#: awkgram.y:2750 msgid "there were shadowed variables." -msgstr "il y a quelques variables qui sont cachées par ombrage" +msgstr "" -#: awkgram.y:2784 +#: awkgram.y:2823 #, c-format msgid "function `%s': can't use function name as parameter name" msgstr "fonction « %s »: ne peut utilise le nom de la fonction comme paramètre" -#: awkgram.y:2794 +#: awkgram.y:2833 #, c-format msgid "function name `%s' previously defined" msgstr "nom de la fonction « %s » définie précédemment" -#: awkgram.y:2945 awkgram.y:2951 +#: awkgram.y:2984 awkgram.y:2990 #, c-format msgid "function `%s' called but never defined" msgstr "fonction « %s » appelé mais jamais définie" -#: awkgram.y:2954 +#: awkgram.y:2993 #, c-format msgid "function `%s' defined but never called" msgstr "fonction « %s » définie mais jamais utilisée" -#: awkgram.y:2981 +#: awkgram.y:3020 #, c-format msgid "regexp constant for parameter #%d yields boolean value" msgstr "" "expression régulière constante pour le paramètre #%d conduit à une valeur " "booléenne" -#: awkgram.y:2994 -#, c-format +#: awkgram.y:3033 +#, fuzzy, c-format msgid "" "function `%s' called with space between name and `(',\n" -"%s" +"or used as a variable or an array" msgstr "" "fonction « %s » appelée avec un espace entre le nom et « ( »,\n" "%s" -#: awkgram.y:2996 -msgid "or used as a variable or an array" -msgstr "ou utilisé comme une variable ou un tableau" - -#: builtin.c:137 +#: builtin.c:149 #, c-format msgid "%s to \"%s\" failed (%s)" msgstr "%s vers « %s » échec (%s)" -#: builtin.c:138 +#: builtin.c:150 msgid "standard output" msgstr "sortie standard" -#: builtin.c:139 +#: builtin.c:151 msgid "reason unknown" msgstr "raison inconnue" -#: builtin.c:152 +#: builtin.c:164 msgid "exp: received non-numeric argument" -msgstr "exp: argument fourni n'est pas numérique" +msgstr "exp: argument n'est pas numérique" -#: builtin.c:158 +#: builtin.c:170 #, c-format msgid "exp: argument %g is out of range" -msgstr "exp: argument fourni %g est hors gamme" +msgstr "exp: argument %g est hors limite" -#: builtin.c:216 +#: builtin.c:228 #, c-format msgid "fflush: cannot flush: pipe `%s' opened for reading, not writing" msgstr "" "fflush: ne peut vider: le pipe « %s » est oouvert en lecture, pas en écriture" -#: builtin.c:219 +#: builtin.c:231 #, c-format msgid "fflush: cannot flush: file `%s' opened for reading, not writing" msgstr "" "fflush: ne peut vider: fichier « %s » ouvert en lecture, pas en écriture" -#: builtin.c:231 +#: builtin.c:243 #, c-format msgid "fflush: `%s' is not an open file, pipe or co-process" msgstr "" "fflush: « %s » n'est pas ni un fichier ouvert, un pipe ou un co-processus" -#: builtin.c:325 +#: builtin.c:338 msgid "index: received non-string first argument" -msgstr "index: premier argument fourni n'est pas une chaîne" +msgstr "index: premier argument n'est pas une chaîne" -#: builtin.c:327 +#: builtin.c:340 msgid "index: received non-string second argument" -msgstr "index: second argument fourni n'est pas une chaîne" +msgstr "index: second argument n'est pas une chaîne" -#: builtin.c:437 +#: builtin.c:454 msgid "int: received non-numeric argument" -msgstr "int: argument fourni n'est pas numérique" +msgstr "int: argument n'est pas numérique" -#: builtin.c:454 +#: builtin.c:471 msgid "length: received non-string argument" -msgstr "length: argument fourni n'est pas une chaîne" +msgstr "length: argument n'est pas une chaîne" -#: builtin.c:470 +#: builtin.c:487 msgid "log: received non-numeric argument" -msgstr "log: argument fourni n'est pas numérique" +msgstr "log: argument n'est pas numérique" -#: builtin.c:473 +#: builtin.c:490 #, c-format msgid "log: received negative argument %g" -msgstr "log: argument fourni négatif %g" +msgstr "log: argument négatif %g" -#: builtin.c:635 builtin.c:638 +#: builtin.c:654 builtin.c:657 msgid "must use `count$' on all formats or none" -msgstr "doit utiliser « count$ » pour tous les formats ou aucun" +msgstr "" -#: builtin.c:740 +#: builtin.c:759 msgid "`$' is not permitted in awk formats" msgstr "« $ » n'est pas permis dans les formats awk" -#: builtin.c:746 +#: builtin.c:765 msgid "arg count with `$' must be > 0" msgstr "décompte d'arguments avec « $ » doit être > 0" -#: builtin.c:748 -#, c-format +#: builtin.c:767 +#, fuzzy, c-format msgid "arg count %ld greater than total number of supplied arguments" -msgstr "compteur d'arguments %ld est > que le nombre total fournis d'arguments" +msgstr "compteur d'arguments %d est > que le nombre total fournis d'arguments" -#: builtin.c:750 +#: builtin.c:769 msgid "`$' not permitted after period in format" msgstr "« $ » n'est pas permis après le point" -#: builtin.c:763 +#: builtin.c:782 msgid "no `$' supplied for positional field width or precision" msgstr "aucun « $ » fourni dans le champ positionnel (longueur ou précision)" -#: builtin.c:821 +#: builtin.c:848 msgid "`l' is meaningless in awk formats; ignored" msgstr "« l » n'a aucun sens dans les formats de awk; ignoré" -#: builtin.c:825 +#: builtin.c:852 msgid "`l' is not permitted in POSIX awk formats" msgstr "« l » n'est pas permis dans les format POSIX de awk" -#: builtin.c:836 +#: builtin.c:863 msgid "`L' is meaningless in awk formats; ignored" msgstr "« L » n'a aucun sens dans les formats s de awk; ignoré" -#: builtin.c:840 +#: builtin.c:867 msgid "`L' is not permitted in POSIX awk formats" msgstr "« L » n'est pas permis dans les formats POSIX de awk" -#: builtin.c:851 +#: builtin.c:878 msgid "`h' is meaningless in awk formats; ignored" msgstr "« h » n'a aucun send dans les formats de awk; ignoré" -#: builtin.c:855 +#: builtin.c:882 msgid "`h' is not permitted in POSIX awk formats" msgstr "« h » n'est pas permis dans les formats POSIX de awk" -#: builtin.c:1055 +#: builtin.c:1111 #, c-format msgid "[s]printf: value %g is out of range for `%%%c' format" -msgstr "[s]printf: valeur %g est hors gamme pour le format « %%%c »" +msgstr "" -#: builtin.c:1108 +#: builtin.c:1171 msgid "not enough arguments to satisfy format string" msgstr "pas assez d'arguments pour satisfaire le format d'une chaîne" -#: builtin.c:1110 +#: builtin.c:1173 msgid "^ ran out for this one" msgstr "^ débordement pour celle-ci" -#: builtin.c:1115 +#: builtin.c:1178 msgid "[s]printf: format specifier does not have control letter" msgstr "" "[s]printf: spécificateur de format ne contient pas de lettre de contrôle" -#: builtin.c:1118 +#: builtin.c:1181 msgid "too many arguments supplied for format string" msgstr "trop d'arguments pour la chaîne de format" -#: builtin.c:1184 builtin.c:1187 +#: builtin.c:1247 builtin.c:1250 msgid "printf: no arguments" msgstr "printf: aucun argument" -#: builtin.c:1211 +#: builtin.c:1274 msgid "sqrt: received non-numeric argument" -msgstr "sqrt: argument fourni n'est pas numérique" +msgstr "sqrt: argument n'est pas numérique" -#: builtin.c:1215 +#: builtin.c:1278 #, c-format msgid "sqrt: called with negative argument %g" msgstr "sqrt: appelé avec un argument négatif %g" -#: builtin.c:1238 +#: builtin.c:1301 #, c-format msgid "substr: start index %g is invalid, using 1" msgstr "substr: début de l'index %g est invalide, utilise 1" -#: builtin.c:1243 +#: builtin.c:1306 #, c-format msgid "substr: non-integer start index %g will be truncated" msgstr "substr: début avec un nombre non entier %g sera tronqué" -#: builtin.c:1262 +#: builtin.c:1325 #, fuzzy, c-format msgid "substr: length %g is not >= 1" msgstr "substr: longueur %g est <= 0" -#: builtin.c:1264 +#: builtin.c:1327 #, fuzzy, c-format msgid "substr: length %g is not >= 0" msgstr "substr: longueur %g est <= 0" -#: builtin.c:1271 +#: builtin.c:1334 #, c-format msgid "substr: non-integer length %g will be truncated" msgstr "substr: longueur avec un nombre non entier %g sera tronqué" -#: builtin.c:1276 +#: builtin.c:1339 #, c-format msgid "substr: length %g too big for string indexing, truncating to %g" msgstr "" -"substr: longueur %g trop grande pour l'indexation de chaîne, troncation à %g" -#: builtin.c:1288 +#: builtin.c:1351 msgid "substr: source string is zero length" msgstr "substr: chaîne de départ est de longueur zéro" -#: builtin.c:1294 -#, c-format +#: builtin.c:1357 +#, fuzzy, c-format msgid "substr: start index %g is past end of string" -msgstr "substr: début de l'index %g dépasse la fin de la chaîne" +msgstr "substr: début de l'index %d dépasse la fin de la chaîne" -#: builtin.c:1302 -#, c-format +#: builtin.c:1365 +#, fuzzy, c-format msgid "" "substr: length %g at start index %g exceeds length of first argument (%lu)" msgstr "" -"substr: longueur %g débute avec l'index %g déborde la longueur du 1er " -"argument (%lu)" +"substr: longueur %d début avec l'index %d déborde la longueur du 1er " +"arguement (%d)" -#: builtin.c:1337 +#: builtin.c:1400 +#, fuzzy msgid "strftime: received non-string first argument" -msgstr "strftime: premier argument fourni n'est pas une chaîne" +msgstr "strftim: premier argument n'est pas une chaîne" -#: builtin.c:1343 +#: builtin.c:1406 msgid "strftime: received empty format string" msgstr "strftime: chaîne de format vide" -#: builtin.c:1352 +#: builtin.c:1415 +#, fuzzy msgid "strftime: received non-numeric second argument" -msgstr "strftime: second argument fourni n'est pas numérique" +msgstr "strftime: second argument n'est pas un chaîne" -#: builtin.c:1415 +#: builtin.c:1478 msgid "mktime: received non-string argument" -msgstr "mktime: argument fourni n'est pas une chaîne" +msgstr "mktime: argument n'est pas une chaîne" -#: builtin.c:1460 +#: builtin.c:1523 +#, fuzzy msgid "system: received non-string argument" -msgstr "system: argument fourni n'est pas une chaîne" +msgstr "system: argument n'est pas une chaîne" -#: builtin.c:1581 eval.c:1883 -#, c-format +#: builtin.c:1644 eval.c:2019 +#, fuzzy, c-format msgid "reference to uninitialized field `$%d'" -msgstr "référence à un champ non initialisée « $%d »" +msgstr "référence à une variable non initialisée « %s »" -#: builtin.c:1608 +#: builtin.c:1671 +#, fuzzy msgid "tolower: received non-string argument" -msgstr "tolower: argument fourni n'est pas une chaîne" +msgstr "tolower: argument n'est pas une chaîne" -#: builtin.c:1657 +#: builtin.c:1720 +#, fuzzy msgid "toupper: received non-string argument" -msgstr "toupper: argument fourni n'est pas une chaîne" +msgstr "toupper: argument n'est pas une chaîne" -#: builtin.c:1702 +#: builtin.c:1765 msgid "atan2: received non-numeric first argument" -msgstr "atan2: premier argument fourni n'est pas numérique" +msgstr "atan2: premier argument n'est pas numérique" -#: builtin.c:1704 +#: builtin.c:1767 msgid "atan2: received non-numeric second argument" -msgstr "atan2: second argument fourni n'est pas numérique" +msgstr "atan2: second argument n'est pas numérique" -#: builtin.c:1723 +#: builtin.c:1786 msgid "sin: received non-numeric argument" -msgstr "sin: argument fourni n'est pas numérique" +msgstr "sin: argument n'est pas numérique" -#: builtin.c:1739 +#: builtin.c:1802 msgid "cos: received non-numeric argument" -msgstr "cos: argument fourni n'est pas numérique" +msgstr "cos: argument n'est pas numérique" -#: builtin.c:1788 +#: builtin.c:1852 msgid "srand: received non-numeric argument" -msgstr "srand: argument fourni n'est pas numérique" +msgstr "srand: argument n'est pas numérique" -#: builtin.c:1823 +#: builtin.c:1887 msgid "match: third argument is not an array" -msgstr "match: le 3e argument fourni n'est pas un tableau" +msgstr "match: le 3e argument n'est pas un tableau" -#: builtin.c:2307 +#: builtin.c:2414 +#, fuzzy msgid "gensub: third argument of 0 treated as 1" -msgstr "gensub: le 3e argument fourni de 0 traité comme un 1" +msgstr "gensub: le 3e argument de 0 traité comme un 1" -#: builtin.c:2416 builtin.c:2418 +#: builtin.c:2572 msgid "lshift: received non-numeric first argument" -msgstr "lshift: premier argument fourni n'est pas numérique" +msgstr "lshift: premier argument n'est pas numérique" + +#: builtin.c:2574 +#, fuzzy +msgid "lshift: received non-numeric second argument" +msgstr "atan2: second argument n'est pas numérique" -#: builtin.c:2420 +#: builtin.c:2580 #, c-format msgid "lshift(%lf, %lf): negative values will give strange results" msgstr "lshift(%lf, %lf): valeurs négatives donneront d'étranges résultats" -#: builtin.c:2422 +#: builtin.c:2582 #, c-format msgid "lshift(%lf, %lf): fractional values will be truncated" msgstr "lshift(%lf, %lf): valeurs fractionnaires seront tronquées" -#: builtin.c:2424 +#: builtin.c:2584 #, c-format msgid "lshift(%lf, %lf): too large shift value will give strange results" msgstr "lshift(%lf, %lf): trop grand déplacement donnera d'étranges résultats" -#: builtin.c:2453 builtin.c:2455 +#: builtin.c:2610 msgid "rshift: received non-numeric first argument" -msgstr "rshift: premier argument fourni n'est pas numérique" +msgstr "rshift: premier argument n'est pas numérique" + +#: builtin.c:2612 +#, fuzzy +msgid "rshift: received non-numeric second argument" +msgstr "atan2: second argument n'est pas numérique" -#: builtin.c:2457 +#: builtin.c:2618 #, c-format msgid "rshift(%lf, %lf): negative values will give strange results" msgstr "rshift(%lf, %lf): valeurs négatives donneront d'étranges résultats" -#: builtin.c:2459 +#: builtin.c:2620 #, c-format msgid "rshift(%lf, %lf): fractional values will be truncated" msgstr "rshift(%lf, %lf): valeurs fractionnaires seront tronquées" -#: builtin.c:2461 +#: builtin.c:2622 #, c-format msgid "rshift(%lf, %lf): too large shift value will give strange results" msgstr "rshift(%lf, %lf): trop grand déplacement donnera d'étranges résultats" -#: builtin.c:2490 builtin.c:2492 +#: builtin.c:2648 msgid "and: received non-numeric first argument" -msgstr "and: premier argument fourni n'est pas numérique" +msgstr "and: premier argument n'est pas numérique" -#: builtin.c:2494 +#: builtin.c:2650 +#, fuzzy +msgid "and: received non-numeric second argument" +msgstr "atan2: second argument n'est pas numérique" + +#: builtin.c:2656 #, c-format msgid "and(%lf, %lf): negative values will give strange results" msgstr "and(%lf, %lf): valeurs négatives donneront d'étranges résultats" -#: builtin.c:2496 +#: builtin.c:2658 #, c-format msgid "and(%lf, %lf): fractional values will be truncated" msgstr "and(%lf, %lf): valeurs fractionnaires seront tronquées" -#: builtin.c:2525 builtin.c:2527 +#: builtin.c:2684 msgid "or: received non-numeric first argument" -msgstr "or: premier argument fourni n'est pas numérique" +msgstr "or: premier argument n'est pas numérique" + +#: builtin.c:2686 +#, fuzzy +msgid "or: received non-numeric second argument" +msgstr "atan2: second argument n'est pas numérique" -#: builtin.c:2529 +#: builtin.c:2692 #, c-format msgid "or(%lf, %lf): negative values will give strange results" msgstr "or(%lf, %lf): valeurs négatives donneront d'étranges résultats" -#: builtin.c:2531 +#: builtin.c:2694 #, c-format msgid "or(%lf, %lf): fractional values will be truncated" msgstr "or(%lf, %lf): valeurs fractionnaires seront tronquées" -#: builtin.c:2560 builtin.c:2562 +#: builtin.c:2720 msgid "xor: received non-numeric first argument" -msgstr "xor: premier argument fourni n'est pas numérique" +msgstr "xor: premier argument n'est pas numérique" + +#: builtin.c:2722 +#, fuzzy +msgid "xor: received non-numeric second argument" +msgstr "atan2: second argument n'est pas numérique" -#: builtin.c:2564 +#: builtin.c:2728 #, c-format msgid "xor(%lf, %lf): negative values will give strange results" msgstr "xor(%lf, %lf): valeurs négatives donneront d'étranges résultats" -#: builtin.c:2566 +#: builtin.c:2730 #, c-format msgid "xor(%lf, %lf): fractional values will be truncated" msgstr "xor(%lf, %lf): valeurs fractionnaires seront tronquées" -#: builtin.c:2594 +#: builtin.c:2754 msgid "compl: received non-numeric argument" -msgstr "compl: argument fourni n'est pas numérique" +msgstr "compl: argument n'est pas numérique" -#: builtin.c:2596 +#: builtin.c:2760 #, c-format msgid "compl(%lf): negative value will give strange results" msgstr "compl(%lf): valeurs négatives donneront d'étranges résultats" -#: builtin.c:2598 +#: builtin.c:2762 #, c-format msgid "compl(%lf): fractional value will be truncated" msgstr "compl(%lf): valeurs fractionnaires seront tronquées" -#: builtin.c:2771 +#: builtin.c:2935 #, c-format msgid "dcgettext: `%s' is not a valid locale category" msgstr "dcgettext: « %s » n'est pas dans un catégorie de localisation valide" -#: eval.c:266 +#: eval.c:303 #, c-format msgid "unknown nodetype %d" msgstr "type de noeud inconnu %d" -#: eval.c:312 +#: eval.c:350 msgid "buffer overflow in genflags2str" msgstr "débordement de tampo dans genflag2str" -#: eval.c:647 +#: eval.c:382 eval.c:388 profile.c:837 #, c-format +msgid "attempt to use array `%s' in a scalar context" +msgstr "tentative d'utilisation du tableau « %s » dans un contexte scalaire" + +#: eval.c:730 +#, fuzzy, c-format msgid "for loop: array `%s' changed size from %ld to %ld during loop execution" msgstr "" -"for loop: tableau « %s » a changé de taille de %ld à %ld durant l'exécution " -"de la boucle" +"for loop: tableau « %s » a changé de taille de %d à %d durant l'exécution de " +"la boucle" -#: eval.c:668 +#: eval.c:751 msgid "`break' outside a loop is not portable" msgstr "« break » en dehors de la boucle n'est pas portable" -#: eval.c:672 +#: eval.c:755 msgid "`break' outside a loop is not allowed" msgstr "« break » en dehors de la boucle n'est pas permis" -#: eval.c:689 +#: eval.c:772 msgid "`continue' outside a loop is not portable" msgstr "« continue » en dehors de la boucle n'est pas portable" -#: eval.c:693 +#: eval.c:776 msgid "`continue' outside a loop is not allowed" msgstr "« continue » en dehors de la boucle n'est pas permis" -#: eval.c:727 +#: eval.c:810 msgid "`next' cannot be called from a BEGIN rule" msgstr "« next » ne peut être appelé depuis une règle BEGIN" -#: eval.c:729 +#: eval.c:812 msgid "`next' cannot be called from an END rule" msgstr "« next » ne peut être appelé depuis une règle END" -#: eval.c:738 +#: eval.c:821 msgid "`nextfile' cannot be called from a BEGIN rule" msgstr "« nextfile » ne peut être appelé depuis une règle BEGIN" -#: eval.c:740 +#: eval.c:823 msgid "`nextfile' cannot be called from an END rule" msgstr "« nextfile » ne peut être appelé depuis une règle END" -#: eval.c:785 +#: eval.c:872 msgid "statement has no effect" msgstr "la déclaration n'a aucun effet" -#: eval.c:828 eval.c:1726 +#: eval.c:915 eval.c:1873 #, c-format msgid "can't use function name `%s' as variable or array" msgstr "" "ne peut utiliser le nom de la fonction « %s » comme variable ou tableau" -#: eval.c:835 eval.c:841 +#: eval.c:922 eval.c:928 #, c-format msgid "reference to uninitialized argument `%s'" msgstr "référence à un argument non initialisé « %s »" -#: eval.c:848 eval.c:907 eval.c:1732 eval.c:1742 profile.c:807 -#, c-format -msgid "attempt to use array `%s' in a scalar context" -msgstr "tentative d'utilisation du tableau « %s » dans un contexte scalaire" - -#: eval.c:858 eval.c:1752 +#: eval.c:937 eval.c:1882 #, c-format msgid "reference to uninitialized variable `%s'" msgstr "référence à une variable non initialisée « %s »" -#: eval.c:1007 +#: eval.c:1083 msgid "" "concatenation: side effects in one expression have changed the length of " "another!" @@ -820,49 +856,50 @@ msgstr "" "concaténation: effects de bord dans une expression a modifié la longueur " "d'une autre!" -#: eval.c:1032 +#: eval.c:1162 msgid "assignment used in conditional context" msgstr "affectation utilisé dans un contexte conditionnel" -#: eval.c:1122 +#: eval.c:1252 msgid "division by zero attempted" msgstr "tentative de division par zéro" -#: eval.c:1137 +#: eval.c:1267 #, c-format msgid "division by zero attempted in `%%'" msgstr "tentative de division par zéro dans « %% »" -#: eval.c:1152 profile.c:683 +#: eval.c:1282 profile.c:713 #, c-format msgid "illegal type (%s) in tree_eval" msgstr "type illégal (%s) dans tree_eval" -#: eval.c:1328 +#: eval.c:1459 msgid "division by zero attempted in `/='" msgstr "tentative de division par zéro dans « /= »" -#: eval.c:1346 +#: eval.c:1477 #, c-format msgid "division by zero attempted in `%%='" msgstr "tentative de division par zéro dans « %%= »" -#: eval.c:1586 +#: eval.c:1738 #, c-format msgid "function `%s' called with more arguments than declared" msgstr "fonction « %s » appelée avec plus d'arguments que déclarées" -#: eval.c:1633 +#: eval.c:1782 #, c-format msgid "function `%s' not defined" msgstr "fonction « %s » non définie" -#: eval.c:1639 +#: eval.c:1788 #, c-format msgid "function %s called\n" msgstr "fonction %s appelée\n" -#: eval.c:1698 +#: eval.c:1845 +#, c-format msgid "" "\n" "\t# Function Call Stack:\n" @@ -872,43 +909,44 @@ msgstr "" "\t# Appel d'une fonction sur la pile:\n" "\n" -#: eval.c:1701 +#: eval.c:1848 +#, c-format msgid "\t# -- main --\n" msgstr "#t# -- main --\n" -#: eval.c:1867 +#: eval.c:2003 msgid "attempt to field reference from non-numeric value" msgstr "tentative de référence un champ à partir d'une valeur non numérique" -#: eval.c:1869 +#: eval.c:2005 msgid "attempt to reference from null string" msgstr "tentative de référence à partir d'une chaîne nulle" -#: eval.c:1875 +#: eval.c:2011 #, c-format msgid "attempt to access field %d" msgstr "tentative d'accès du champ %d" -#: eval.c:1896 eval.c:1903 profile.c:900 +#: eval.c:2032 eval.c:2039 profile.c:934 msgid "assignment is not allowed to result of builtin function" msgstr "" "l'affectation n'est pas permise pour obtenir un résultat d'une fonction " "interne" -#: eval.c:1951 +#: eval.c:2103 msgid "`IGNORECASE' is a gawk extension" msgstr "« IGNORECASE » est une extension de gawk" -#: eval.c:1980 +#: eval.c:2133 msgid "`BINMODE' is a gawk extension" msgstr "« BINMODE » est une extension de gawk" -#: eval.c:2092 +#: eval.c:2255 #, c-format msgid "bad `%sFMT' specification `%s'" msgstr "« %sFMT » spécification erronée « %s »" -#: eval.c:2170 +#: eval.c:2333 msgid "turning off `--lint' due to assignment to `LINT'" msgstr "désactivation « --lint » en raison d'une affectation à « LINT »" @@ -926,7 +964,56 @@ msgstr "extension: ne peut ouvrir msgid "extension: library `%s': cannot call function `%s' (%s)\n" msgstr "extension: librairie « %s »: ne peut appeler la fonction « %s » (%s)\n" -#: ext.c:183 +#: ext.c:102 +msgid "extension: missing function name" +msgstr "" + +#: ext.c:107 +#, fuzzy, c-format +msgid "extension: illegal character `%c' in function name `%s'" +msgstr "extension: librairie « %s »: ne peut appeler la fonction « %s » (%s)\n" + +#: ext.c:113 +#, fuzzy, c-format +msgid "extension: can't redefine function `%s'" +msgstr "extension: ne peut ouvrir « %s » (%s)\n" + +#: ext.c:117 +#, fuzzy, c-format +msgid "extension: function `%s' already defined" +msgstr "fonction « %s » non définie" + +#: ext.c:122 +#, c-format +msgid "extension: can't use gawk built-in `%s' as function name" +msgstr "" + +#: ext.c:124 +#, fuzzy, c-format +msgid "extension: function name `%s' previously defined" +msgstr "nom de la fonction « %s » définie précédemment" + +#: ext.c:201 +#, c-format +msgid "function `%s' defined to take no more than `%d' argument(s)" +msgstr "" + +#: ext.c:204 +#, fuzzy, c-format +msgid "function `%s': missing argument #%d" +msgstr "fonction « %s » non définie" + +#: ext.c:214 +#, fuzzy, c-format +msgid "function `%s': argument #%d: attempt to use scalar as an array" +msgstr "tentative d'utilisation du scalaire « %s » comme un tableau" + +#: ext.c:218 +#, c-format +msgid "function `%s': argument #%d: attempt to use array as a scalar" +msgstr "" + +#: ext.c:243 msgid "Operation Not Supported" msgstr "Opération non supportée" @@ -955,564 +1042,554 @@ msgstr "champ %d dans FIELDWIDTHS, doit msgid "null string for `FS' is a gawk extension" msgstr "chaîne vide pour « FS » est une extension de gawk" -#: getopt.c:692 getopt.c:704 +#: getopt.c:692 getopt.c:711 #, c-format msgid "%s: option `%s' is ambiguous\n" msgstr "%s: option « %s » est ambiguë\n" -#: getopt.c:737 getopt.c:741 +#: getopt.c:744 getopt.c:748 #, c-format msgid "%s: option `--%s' doesn't allow an argument\n" -msgstr "%s: option « --%s » n'admet pas d'argument\n" +msgstr "%s: option « --%s » n'admet pas d'arguement\n" -#: getopt.c:750 getopt.c:755 +#: getopt.c:757 getopt.c:762 #, c-format msgid "%s: option `%c%s' doesn't allow an argument\n" -msgstr "%s: l'option « %c%s » ne requiert pas d'argument\n" +msgstr "%s: l'option « %c%s » ne requiert pas d'arguement\n" -#: getopt.c:791 getopt.c:804 getopt.c:1093 getopt.c:1106 +#: getopt.c:807 getopt.c:829 getopt.c:1159 getopt.c:1181 #, c-format msgid "%s: option `%s' requires an argument\n" msgstr "%s: l'option « %s » requiert un argument\n" -#: getopt.c:842 getopt.c:845 +#: getopt.c:867 getopt.c:870 #, c-format msgid "%s: unrecognized option `--%s'\n" msgstr "%s: option non reconnue « --%s »\n" -#: getopt.c:853 getopt.c:856 +#: getopt.c:878 getopt.c:881 #, c-format msgid "%s: unrecognized option `%c%s'\n" msgstr "%s: option non reconnue « %c%s »\n" -#: getopt.c:903 getopt.c:906 +#: getopt.c:936 getopt.c:939 #, c-format msgid "%s: illegal option -- %c\n" msgstr "%s: option illégale -- %c\n" -#: getopt.c:912 getopt.c:915 +#: getopt.c:945 getopt.c:948 #, c-format msgid "%s: invalid option -- %c\n" msgstr "%s: option invalide -- %c\n" -#: getopt.c:962 getopt.c:973 getopt.c:1159 getopt.c:1172 main.c:434 +#: getopt.c:1003 getopt.c:1022 getopt.c:1234 getopt.c:1255 main.c:433 #, c-format msgid "%s: option requires an argument -- %c\n" -msgstr "%s: l'option requiert un argument -- %c\n" +msgstr "%s: l'option requiert un arguement -- %c\n" -#: getopt.c:1025 getopt.c:1036 +#: getopt.c:1074 getopt.c:1093 #, c-format msgid "%s: option `-W %s' is ambiguous\n" msgstr "%s: l'option « -W %s » est ambiguë\n" -#: getopt.c:1060 getopt.c:1072 +#: getopt.c:1117 getopt.c:1138 #, c-format msgid "%s: option `-W %s' doesn't allow an argument\n" -msgstr "%s: l'option « -W %s » ne requiert pas d'argument\n" +msgstr "%s: l'option « -W %s » ne requiert pas d'arguement\n" -#: io.c:305 +#: io.c:308 #, c-format msgid "cannot open file `%s' for reading (%s)" msgstr "ne peut ouvrir le fichier « %s » en lecture (%s)" -#: io.c:392 +#: io.c:395 #, c-format msgid "close of fd %d (`%s') failed (%s)" msgstr "fermeture de fd %d (« %s ») en échec (%s)" -#: io.c:530 +#: io.c:533 #, c-format msgid "invalid tree type %s in redirect()" msgstr "type d'arbre invalide %s dans redirect()" -#: io.c:536 +#: io.c:539 #, c-format msgid "expression in `%s' redirection only has numeric value" msgstr "" "l'expression de la redirection de « %s » a seulement une valeur numérique" -#: io.c:542 +#: io.c:545 #, c-format msgid "expression for `%s' redirection has null string value" msgstr "" "l'expression de la redirection de « %s » a une valeur nulle pour la chaîne" -#: io.c:547 +#: io.c:550 #, c-format msgid "filename `%s' for `%s' redirection may be result of logical expression" msgstr "" "nom de fichier « %s » pour le redirection « %s » peut être le résultat d'une " "expression logique" -#: io.c:569 +#: io.c:588 #, c-format msgid "unnecessary mixing of `>' and `>>' for file `%.*s'" msgstr "mélange non nécessaire de « > » et de « >> » pour le fichier « %.*s »" -#: io.c:621 +#: io.c:640 #, c-format msgid "can't open pipe `%s' for output (%s)" msgstr "ne peut ouvrir un pipe « %s » en sortie (%s)" -#: io.c:630 +#: io.c:649 #, c-format msgid "can't open pipe `%s' for input (%s)" msgstr "ne peut ouvrir un pipe « %s » en entrée (%s)" -#: io.c:643 +#: io.c:662 #, c-format msgid "can't open two way socket `%s' for input/output (%s)" msgstr "" "ne peut ouvrir un socket bidirectionnel « %s » pour les entrées/sorties (%s)" -#: io.c:647 +#: io.c:666 #, c-format msgid "can't open two way pipe `%s' for input/output (%s)" msgstr "" "ne peut ouvrir un pipe bidirectionnel « %s » pour les entrées/sorties (%s)" -#: io.c:723 +#: io.c:742 #, c-format msgid "can't redirect from `%s' (%s)" msgstr "ne peut rediriger de « %s » (%s)" -#: io.c:726 +#: io.c:745 #, c-format msgid "can't redirect to `%s' (%s)" msgstr "ne peut rediriger vers « %s » (%s)" -#: io.c:765 +#: io.c:784 msgid "" "reached system limit for open files: starting to multiplex file descriptors" msgstr "" "limite système atteinte pour l'ouverture des fichiers: début du multiplexage " "des descripteurs de fichiers" -#: io.c:777 +#: io.c:800 #, c-format msgid "close of `%s' failed (%s)." msgstr "fermeture de « %s » en échec (%s)" -#: io.c:784 +#: io.c:808 msgid "too many pipes or input files open" msgstr "trop de pipes ou de fichiers en lecture ouverts" -#: io.c:807 +#: io.c:831 msgid "close: second argument must be `to' or `from'" msgstr "close: 2e argument doit être « to » ou « from »" -#: io.c:821 +#: io.c:845 #, c-format msgid "close: `%.*s' is not an open file, pipe or co-process" msgstr "close: « %.*s » n'est pas ni un fichier ouvert, pipe ou co-processus" -#: io.c:825 +#: io.c:849 msgid "close of redirection that was never opened" msgstr "fermeture de la redirection qui n'a jamais été ouverte" -#: io.c:862 +#: io.c:945 #, c-format msgid "close: redirection `%s' not opened with `|&', second argument ignored" msgstr "" "close: redirection « %s » n'a pas été ouverte ave « |& » 2e argument ignoré" -#: io.c:924 +#: io.c:960 #, c-format msgid "failure status (%d) on pipe close of `%s' (%s)" msgstr "constat d'échec (%d) lors de la fermeture du pipe « %s » (%s)" -#: io.c:927 +#: io.c:963 #, c-format msgid "failure status (%d) on file close of `%s' (%s)" msgstr "constat d'échec (%d) lors de la fermeture du fichier « %s » (%s)" -#: io.c:946 +#: io.c:983 #, c-format msgid "no explicit close of socket `%s' provided" msgstr "aucune fermeture explicite du socket « %s » fournie" -#: io.c:949 +#: io.c:986 #, c-format msgid "no explicit close of co-process `%s' provided" msgstr "aucune fermeture explicite du co-processus « %s » fournie" -#: io.c:952 +#: io.c:989 #, c-format msgid "no explicit close of pipe `%s' provided" msgstr "aucune fermeture explicite du pipe « %s » fournie" -#: io.c:955 +#: io.c:992 #, c-format msgid "no explicit close of file `%s' provided" msgstr "aucune fermeture explicite du fichier « %s » fournie" -#: io.c:984 io.c:1038 +#: io.c:1021 io.c:1075 #, c-format msgid "error writing standard output (%s)" msgstr "erreur lors de l'écriture vers stdout (%s)" -#: io.c:988 io.c:1042 +#: io.c:1025 io.c:1079 #, c-format msgid "error writing standard error (%s)" msgstr "erreur lors de l'écriture vers stderr (%s)" -#: io.c:996 +#: io.c:1033 #, c-format msgid "pipe flush of `%s' failed (%s)." msgstr "vidange du pipie de « %s » en échec (%s)" -#: io.c:999 +#: io.c:1036 #, c-format msgid "co-process flush of pipe to `%s' failed (%s)." msgstr "vidange du pipe par le co-processus vers « %s » en échec (%s)" -#: io.c:1002 +#: io.c:1039 #, c-format msgid "file flush of `%s' failed (%s)." msgstr "vidange du fichier « %s » en échec (%s)" -#: io.c:1161 +#: io.c:1198 msgid "/inet/raw client not ready yet, sorry" msgstr "le client /inet/raw n'est pas encore prêt, désolé" -#: io.c:1163 io.c:1200 +#: io.c:1200 io.c:1237 msgid "only root may use `/inet/raw'." msgstr "seul root peut utiliser « /inet/raw »" -#: io.c:1198 +#: io.c:1235 msgid "/inet/raw server not ready yet, sorry" msgstr "le serveur /inet/raw n'est pas encore prêt, désolé" -#: io.c:1288 +#: io.c:1325 #, c-format msgid "no (known) protocol supplied in special filename `%s'" msgstr "aucun protocole (connu) fourni dans le nom de fichier spécial « %s »" -#: io.c:1306 +#: io.c:1343 #, c-format msgid "special file name `%s' is incomplete" msgstr "nom spécial de fichier « %s » est incomplet" -#: io.c:1318 +#: io.c:1355 #, c-format msgid "local port invalid in `%s'" msgstr "port local invalide dans « %s »" -#: io.c:1330 +#: io.c:1367 msgid "must supply a remote hostname to `/inet'" msgstr "un nom de hôte distant doit être fourni à « /inet »" -#: io.c:1345 +#: io.c:1382 msgid "must supply a remote port to `/inet'" msgstr "un port distant doit être fournis à « /inet »" -#: io.c:1351 +#: io.c:1388 #, c-format msgid "remote port invalid in `%s'" msgstr "port distant invalide dans « %s »" -#: io.c:1361 +#: io.c:1398 msgid "TCP/IP communications are not supported" msgstr "les communications TCP/IP ne sont pas supportées" -#: io.c:1370 io.c:1551 +#: io.c:1407 io.c:1588 #, c-format msgid "file `%s' is a directory" msgstr "le fichier « %s » est un répertoire" -#: io.c:1440 +#: io.c:1477 #, c-format msgid "use `PROCINFO[\"%s\"]' instead of `%s'" msgstr "utliser « PROCINFO[\"%s\"] » au lieu de « %s »" -#: io.c:1472 +#: io.c:1509 msgid "use `PROCINFO[...]' instead of `/dev/user'" msgstr "utliser « PROCINFO[\"%s\"] » au lieu de « /dev/user »" -#: io.c:1537 io.c:1711 +#: io.c:1574 io.c:1748 #, c-format msgid "could not open `%s', mode `%s'" msgstr "ne peut ouvrir « %s », mode « %s »" -#: io.c:1762 -#, c-format +#: io.c:1799 +#, fuzzy, c-format msgid "close of master pty failed (%s)" -msgstr "échec de la fermeture du pty maître (%s)" +msgstr "échec de la fermeture du pipe (%s)" -#: io.c:1764 io.c:1916 io.c:2068 +#: io.c:1801 io.c:1953 io.c:2105 #, c-format msgid "close of stdout in child failed (%s)" msgstr "échec de fermeture de stdout du processus fils (%s)" -#: io.c:1767 -#, c-format +#: io.c:1804 +#, fuzzy, c-format msgid "moving slave pty to stdout in child failed (dup: %s)" -msgstr "" -"échec de redirection du pty esclave vers stdout du processus fils (dup: %s)" +msgstr "échec de redirection du pipe vers stdout du processus fils (dup: %s)" -#: io.c:1769 io.c:1921 +#: io.c:1806 io.c:1958 #, c-format msgid "close of stdin in child failed (%s)" msgstr "échec de fermeture de stdin du processus fils (%s)" -#: io.c:1772 -#, c-format +#: io.c:1809 +#, fuzzy, c-format msgid "moving slave pty to stdin in child failed (dup: %s)" -msgstr "" -"échec de redirection du pty esclave vers stdin du processus fils (dup: %s)" +msgstr "échec de redirection du pipe vers stdin du processus fils (dup: %s)" -#: io.c:1774 io.c:1793 -#, c-format +#: io.c:1811 io.c:1830 +#, fuzzy, c-format msgid "close of slave pty failed (%s)" -msgstr "échec de la fermeture du pty esclave (%s)" +msgstr "échec de la fermeture du pipe (%s)" -#: io.c:1867 io.c:1919 io.c:2049 io.c:2071 +#: io.c:1904 io.c:1956 io.c:2086 io.c:2108 #, c-format msgid "moving pipe to stdout in child failed (dup: %s)" msgstr "échec de redirection du pipe vers stdout du processus fils (dup: %s)" -#: io.c:1871 io.c:1924 +#: io.c:1908 io.c:1961 #, c-format msgid "moving pipe to stdin in child failed (dup: %s)" msgstr "échec de redirection du pipe vers stdin du processus fils (dup: %s)" -#: io.c:1888 io.c:2062 +#: io.c:1925 io.c:2099 msgid "restoring stdout in parent process failed\n" msgstr "restauration de stdout par le processus parent a échoué\n" -#: io.c:1893 +#: io.c:1930 msgid "restoring stdin in parent process failed\n" msgstr "restauration de stdin par le processus parent a échoué\n" -#: io.c:1927 io.c:2073 io.c:2084 +#: io.c:1964 io.c:2110 io.c:2121 #, c-format msgid "close of pipe failed (%s)" msgstr "échec de la fermeture du pipe (%s)" -#: io.c:1972 +#: io.c:2009 msgid "`|&' not supported" msgstr "« |& » non supporté" -#: io.c:2039 +#: io.c:2076 #, c-format msgid "cannot open pipe `%s' (%s)" msgstr "ne ouvrir un pipe « %s » (%s)" -#: io.c:2080 +#: io.c:2117 #, c-format msgid "cannot create child process for `%s' (fork: %s)" msgstr "ne créer le processus fils pour « %s » (fork: %s)" -#: io.c:2423 +#: io.c:2460 #, c-format msgid "data file `%s' is empty" msgstr "le fichier de données « %s » est vide" -#: io.c:2466 io.c:2474 +#: io.c:2503 io.c:2511 msgid "could not allocate more input memory" -msgstr "ne peut allouer plus de mémoire pour l'entrée" +msgstr "" -#: io.c:2832 io.c:2895 +#: io.c:2869 io.c:2932 #, c-format msgid "error reading input file `%s': %s" msgstr "erreur lors de la lecture du fichier source « %s »: %s" -#: io.c:3020 +#: io.c:3057 msgid "multicharacter value of `RS' is a gawk extension" msgstr "valeur de « RS » avec multiple caractères est une extension gawk" -#: main.c:324 +#: main.c:323 msgid "`-m[fr]' option irrelevant in gawk" msgstr "« -m[fr] » est une option non pertinente en gawk" -#: main.c:326 +#: main.c:325 msgid "-m option usage: `-m[fr] nnn'" msgstr "-m usage de l'option: « -m[fr] nnn »" -#: main.c:343 +#: main.c:342 #, c-format msgid "%s: option `-W %s' unrecognized, ignored\n" msgstr "%s: l'option « -W %s » n'est pas reconnue, ignorée\n" -#: main.c:380 +#: main.c:379 msgid "empty argument to `--source' ignored" msgstr "argument vide à l'option « --source », ignorée" -#: main.c:451 +#: main.c:450 msgid "environment variable `POSIXLY_CORRECT' set: turning on `--posix'" msgstr "" "variable d'environnement « POSIXLY__CORRECT » initialisée: utilisation de « " "--posix »" -#: main.c:456 +#: main.c:455 msgid "`--posix' overrides `--traditional'" msgstr "« --posix » écrase « --traditional »" -#: main.c:467 +#: main.c:466 msgid "`--posix'/`--traditional' overrides `--non-decimal-data'" msgstr "« --posix »/« --traditional » écrase « --non-decimal-data »" -#: main.c:471 -#, c-format +#: main.c:470 +#, fuzzy, c-format msgid "running %s setuid root may be a security problem" msgstr "" -"l'exécution de %s en mode setuid root peut causer un problème de sécurité" +"exécution de %s en mode setuid root peut causer un problème de sécurité" -#: main.c:512 -#, c-format +#: main.c:511 +#, fuzzy, c-format msgid "can't set binary mode on stdin (%s)" -msgstr "ne peut initialiser le mode binaire sur stdin (%s)" +msgstr "ne peut initialiser le mode sur stdin (%s)" -#: main.c:515 -#, c-format +#: main.c:514 +#, fuzzy, c-format msgid "can't set binary mode on stdout (%s)" -msgstr "ne peut initialiser le mode binaire sur stdout (%s)" +msgstr "ne peut initialiser le mode sur stdout (%s)" -#: main.c:517 -#, c-format +#: main.c:516 +#, fuzzy, c-format msgid "can't set binary mode on stderr (%s)" -msgstr "ne peut initialiser le mode binaire sur stderr (%s)" +msgstr "ne peut initialiser le mode sur stderr (%s)" -#: main.c:547 +#: main.c:546 msgid "no program text at all!" msgstr "aucun programme!" -#: main.c:620 +#: main.c:623 #, c-format msgid "Usage: %s [POSIX or GNU style options] -f progfile [--] file ...\n" msgstr "" "Usage: %s [style des options POSIX ou GNU] -f fichierprog [--] fichier ...\n" -#: main.c:622 +#: main.c:625 #, c-format msgid "Usage: %s [POSIX or GNU style options] [--] %cprogram%c file ...\n" msgstr "" "Usage: %s [style des options POSIX ou GNU] [--] %cprogram%c fichier ...\n" -#: main.c:627 +#: main.c:630 msgid "POSIX options:\t\tGNU long options:\n" msgstr "Options POSIX:\t\toptions de long format GNU:\n" -#: main.c:628 +#: main.c:631 msgid "\t-f progfile\t\t--file=progfile\n" msgstr "\t-f fichierprog\t\t--file=fichierprog\n" -#: main.c:629 +#: main.c:632 msgid "\t-F fs\t\t\t--field-separator=fs\n" msgstr "#t-F fs\t\t\t--field-separator=fs\n" -#: main.c:630 +#: main.c:633 msgid "\t-v var=val\t\t--assign=var=val\n" msgstr "#t-v var=valeur\t\t--assign=var=valeur\n" -#: main.c:631 +#: main.c:634 msgid "\t-m[fr] val\n" msgstr "\t-m[fr] valeur\n" -#: main.c:632 +#: main.c:635 msgid "\t-W compat\t\t--compat\n" msgstr "\t-W compat\t\t--compat\n" -#: main.c:633 +#: main.c:636 msgid "\t-W copyleft\t\t--copyleft\n" msgstr "\t-W copyleft\t\t--copyleft\n" -#: main.c:634 +#: main.c:637 msgid "\t-W copyright\t\t--copyright\n" msgstr "\t-W copyright\t\t--copyright\n" -#: main.c:635 +#: main.c:638 msgid "\t-W dump-variables[=file]\t--dump-variables[=file]\n" msgstr "\t-W dump-variables[=fichier]\t--dump-variables[=fichier]\n" -#: main.c:636 +#: main.c:639 msgid "\t-W gen-po\t\t--gen-po\n" msgstr "\t-W gen-po\t\t--gen-po\n" -#: main.c:637 +#: main.c:640 msgid "\t-W help\t\t\t--help\n" msgstr "\t-W help\t\t\t--help\n" -#: main.c:638 +#: main.c:641 msgid "\t-W lint[=fatal]\t\t--lint[=fatal]\n" msgstr "\t-W lint[=fatal]\t\t--lint[=fatal]\n" -#: main.c:639 +#: main.c:642 msgid "\t-W lint-old\t\t--lint-old\n" msgstr "\t-W lint-old\t\t--lint-old\n" -#: main.c:640 +#: main.c:643 msgid "\t-W non-decimal-data\t--non-decimal-data\n" msgstr "\t-W non-decimal-data\t--non-decimal-data\n" -#: main.c:642 +#: main.c:645 msgid "\t-W nostalgia\t\t--nostalgia\n" msgstr "\t-W nostalgia\t\t--nostalgia\n" -#: main.c:645 +#: main.c:648 msgid "\t-W parsedebug\t\t--parsedebug\n" msgstr "\t-W parsedebug\t\t--parsedebug\n" -#: main.c:647 +#: main.c:650 msgid "\t-W profile[=file]\t--profile[=file]\n" msgstr "\t-W profile[=fichier]\t--profile[=fichier]\n" -#: main.c:648 +#: main.c:651 msgid "\t-W posix\t\t--posix\n" msgstr "\t-W posix\t\t--posix\n" -#: main.c:649 +#: main.c:652 msgid "\t-W re-interval\t\t--re-interval\n" msgstr "\t-W re-interval\t\t--re-interval\n" -#: main.c:650 +#: main.c:653 msgid "\t-W source=program-text\t--source=program-text\n" msgstr "\t-W source=program-text\t--source=program-text\n" -#: main.c:651 +#: main.c:654 msgid "\t-W traditional\t\t--traditional\n" msgstr "\t-W traditional\t\t--traditional\n" -#: main.c:652 +#: main.c:655 msgid "\t-W usage\t\t--usage\n" msgstr "\t-W usage\t\t--usage\n" -#: main.c:653 +#: main.c:656 msgid "\t-W version\t\t--version\n" msgstr "\t-W version\t\t--version\n" -#: main.c:657 +#: main.c:660 +#, fuzzy msgid "" "\n" "To report bugs, see node `Bugs' in `gawk.info', which is\n" "section `Reporting Problems and Bugs' in the printed version.\n" "\n" -msgstr "" -"\n" -"Pour rapporter une anomalie, voir la rubrique « Bugs » dans « gawk.info »\n" -"dans la section « Reporting Problems and Bugs » de la version imprimée.\n" +msgstr "section « Reporting Problems and Bugs » dans la version imprimée.\n" -#: main.c:661 +#: main.c:664 msgid "" "gawk is a pattern scanning and processing language.\n" "By default it reads standard input and writes standard output.\n" "\n" msgstr "" -"gawk est un analyseur de patron et un traitement de langage.\n" -"Par défaut, il lit de l'entrée standard et écrit sur la sortie standard.\n" -"\n" -#: main.c:665 +#: main.c:668 msgid "" "Examples:\n" "\tgawk '{ sum += $1 }; END { print sum }' file\n" "\tgawk -F: '{ print $1 }' /etc/passwd\n" msgstr "" -"Exemples:\n" -"\tgawk '{ sum += $1 }; END { print sum }' fichier\n" -"\tgawk -F: '{ print $1 }' /etc/passwd\n" -#: main.c:682 +#: main.c:685 #, c-format msgid "" "Copyright (C) 1989, 1991-%d Free Software Foundation.\n" @@ -1531,7 +1608,7 @@ msgstr "" "soit (selon vos préférences) toute version ultérieure.\n" "\n" -#: main.c:690 +#: main.c:693 msgid "" "This program is distributed in the hope that it will be useful,\n" "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" @@ -1546,7 +1623,7 @@ msgstr "" "Pour plus d'informations à ce sujet, consulter la « GNU General Public " "License ».\n" -#: main.c:696 +#: main.c:699 msgid "" "You should have received a copy of the GNU General Public License\n" "along with this program; if not, write to the Free Software\n" @@ -1556,55 +1633,54 @@ msgstr "" "avec ce programme; sinon, écrire à la Free Software Foundation, Inc.,\n" "59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n" -#: main.c:730 +#: main.c:733 msgid "-Ft does not set FS to tab in POSIX awk" msgstr "" "-Ft ne permet pas d'initialiser FS à un tabulateur dans la version POSIX de " "awk" -#: main.c:956 +#: main.c:962 #, c-format msgid "" "%s: `%s' argument to `-v' not in `var=value' form\n" "\n" msgstr "" -"%s: `%s' argument à `-v' n'a pas le format `var=valeur'\n" -"\n" -#: main.c:976 +#: main.c:982 #, c-format msgid "`%s' is not a legal variable name" -msgstr "`%s' n'est pas un nom de variable légal" +msgstr "" -#: main.c:979 +#: main.c:985 #, c-format msgid "`%s' is not a variable name, looking for file `%s=%s'" -msgstr "`%s' n'est pas un nom de variable, recherche du fichier `%s=%s'" +msgstr "" -#: main.c:1012 +#: main.c:1018 msgid "floating point exception" msgstr "exception de la virgule flottante" -#: main.c:1019 +#: main.c:1025 msgid "fatal error: internal error" msgstr "erreur fatale: erreur interne" -#: main.c:1069 +#: main.c:1075 #, c-format msgid "no pre-opened fd %d" msgstr "aucun fd pré-ouvert pour %d" -#: main.c:1074 +#: main.c:1082 #, c-format msgid "could not pre-open /dev/null for fd %d" msgstr "ne peut pré-ouvrir /dev/null pour le descripteud fd %d" -#: main.c:1097 main.c:1106 +#: main.c:1105 main.c:1114 #, c-format msgid "could not find groups: %s" msgstr "n'a pu trouvé les groupes: %s" #: msg.c:54 +#, c-format msgid "cmd. line:" msgstr "cmd. ligne:" @@ -1624,19 +1700,19 @@ msgstr "Fatal: " msgid "can't convert string to float" msgstr "ne peut convertir la chaîne en nombre flottant" -#: node.c:355 +#: node.c:357 msgid "backslash at end of string" msgstr "barre oblique inverse à la fin de la chaîne" -#: node.c:539 +#: node.c:541 msgid "POSIX does not allow `\\x' escapes" msgstr "POSIX ne permet pas de séquence d'échappement « \\x »" -#: node.c:545 +#: node.c:547 msgid "no hex digits in `\\x' escape sequence" msgstr "aucun chiffre hexadécimal dans la séquence d'échappement « \\x » " -#: node.c:579 +#: node.c:581 #, c-format msgid "escape sequence `\\%c' treated as plain `%c'" msgstr "séquence d'échappement « \\%c » traitée simplement comme « %c »" @@ -1651,21 +1727,27 @@ msgstr "%s %s msgid "could not open `%s' for writing: %s" msgstr "ne peut ouvrir « %s » en écriture: %s" -#: profile.c:449 -#, c-format +#: profile.c:467 +#, fuzzy, c-format msgid "internal error: %s with null vname" -msgstr "erreur interne: %s avec un vname nul" +msgstr "erreur interne: Node_var avec un vname nul" -#: profile.c:512 +#: profile.c:530 msgid "# treated internally as `delete'" -msgstr "# traitée de manière interne comme « delete »" +msgstr "" -#: profile.c:1162 +#: profile.c:1167 +#, c-format +msgid "# this is a dynamically loaded extension function" +msgstr "" + +#: profile.c:1198 #, c-format msgid "\t# gawk profile, created %s\n" msgstr "\t# profile gawk, créé %s\n" -#: profile.c:1165 +#: profile.c:1201 +#, c-format msgid "" "\t# BEGIN block(s)\n" "\n" @@ -1673,7 +1755,8 @@ msgstr "" "#t# DÉBUT de bloc(s)\n" "\n" -#: profile.c:1175 +#: profile.c:1211 +#, c-format msgid "" "\t# Rule(s)\n" "\n" @@ -1681,7 +1764,8 @@ msgstr "" "\t# Règle(s)\n" "\n" -#: profile.c:1181 +#: profile.c:1217 +#, c-format msgid "" "\t# END block(s)\n" "\n" @@ -1689,7 +1773,8 @@ msgstr "" "\t# FIN de bloc(s)\n" "\n" -#: profile.c:1201 +#: profile.c:1237 +#, c-format msgid "" "\n" "\t# Functions, listed alphabetically\n" @@ -1697,115 +1782,109 @@ msgstr "" "\n" "\t# Liste alphabétique des fonctions\n" -#: profile.c:1413 +#: profile.c:1452 #, c-format msgid "unexpected type %s in prec_level" msgstr "type %s inattendu dans prec_level" -#: re.c:193 -#, c-format -msgid "regex match failed, not enough memory to match string \"%.*s%s\"" -msgstr "" -"échec de concordance de regex, pas assez de mémoire pour traiter la chaîne " -"\"%.*s%s\"" - -#: regcomp.c:136 +#: regcomp.c:150 msgid "Success" msgstr "Succès" -#: regcomp.c:139 +#: regcomp.c:153 msgid "No match" msgstr "Aucune concordance" -#: regcomp.c:142 +#: regcomp.c:156 msgid "Invalid regular expression" msgstr "Expression régulière invalide" -#: regcomp.c:145 +#: regcomp.c:159 msgid "Invalid collation character" msgstr "Caractère de collation invalide" -#: regcomp.c:148 +#: regcomp.c:162 msgid "Invalid character class name" msgstr "Nom de classe de caractères invalide" -#: regcomp.c:151 +#: regcomp.c:165 msgid "Trailing backslash" msgstr "Barre oblique inverse de terminaison" -#: regcomp.c:154 +#: regcomp.c:168 msgid "Invalid back reference" msgstr "Mauvaise référence arrière" -#: regcomp.c:157 +#: regcomp.c:171 msgid "Unmatched [ or [^" msgstr "Non appariement de [ ou [^" -#: regcomp.c:160 +#: regcomp.c:174 msgid "Unmatched ( or \\(" msgstr "Non appariement de ( ou \\(" -#: regcomp.c:163 +#: regcomp.c:177 msgid "Unmatched \\{" msgstr "Non appariement de \\{" -#: regcomp.c:166 +#: regcomp.c:180 msgid "Invalid content of \\{\\}" msgstr "Contenu invalide de \\{\\}" -#: regcomp.c:169 +#: regcomp.c:183 msgid "Invalid range end" msgstr "Borne finale invalide" -#: regcomp.c:172 +#: regcomp.c:186 msgid "Memory exhausted" msgstr "Mémoire épuisée" -#: regcomp.c:175 +#: regcomp.c:189 msgid "Invalid preceding regular expression" msgstr "Expression régulière précédente invalide" -#: regcomp.c:178 +#: regcomp.c:192 msgid "Premature end of regular expression" msgstr "Fin prématurée de l'expression régulière" -#: regcomp.c:181 +#: regcomp.c:195 msgid "Regular expression too big" msgstr "Expression régulière trop grande" -#: regcomp.c:184 +#: regcomp.c:198 msgid "Unmatched ) or \\)" msgstr "Non appariement de ) ou \\)" -#: regcomp.c:621 +#: regcomp.c:668 msgid "No previous regular expression" msgstr "Aucune expression régulière antérieure" -#~ msgid "substr: length %g is < 0" -#~ msgstr "substr: longueur %g est < 0" - #~ msgid "delete: illegal use of variable `%s' as array" #~ msgstr "" #~ "destruction: utilisation illégale d'une variable « %s » comme tableau" #~ msgid "asort: first argument is not an array" -#~ msgstr "asort(): le premier argument fourni n'est pas dans le tableau" +#~ msgstr "asort(): le premier argument n'est pas dans le tableau" #~ msgid "asort: second argument is not an array" -#~ msgstr "asort(): le second argument fourni n'est pas dans le tableau" +#~ msgstr "asort(): le scond argument n'est pas dans le tableau" -#~ msgid "internal error: Node_var_array with null vname" -#~ msgstr "erreur interne: Node_var_array avec un vname nul" +#~ msgid "" +#~ "\n" +#~ "To report bugs, see node `Bugs' in `gawk.info', which is\n" +#~ msgstr "" +#~ "\n" +#~ "Pour rapporter une anomalie, voir « Bugs » dans « gawk.info », dans la\n" #~ msgid "invalid syntax in name `%s' for variable assignment" #~ msgstr "syntaxe invalide dans le nom « %s » pour l'affectation de variable" +#~ msgid "internal error: Node_var_array with null vname" +#~ msgstr "erreur interne: Node_var_array avec un vname nul" + #~ msgid "or used in other expression context" #~ msgstr "ou utilisée dans un autre contexte d'expression" -#~ msgid "attempt to use function `%s' as array" -#~ msgstr "tentative d'utilisation de la fonction « %s » dans le tableau" - #~ msgid "`%s' is a function, assignment is not allowed" #~ msgstr "« %s » est une fonction, l'affectation n'est pas permise" @@ -1825,9 +1904,6 @@ msgstr "Aucune expression r #~ msgid "gsub third parameter is not a changeable object" #~ msgstr "gsub: 3e paramètre n'est pas un objet interchangeable" -#~ msgid "Unbalanced [" -#~ msgstr "Non appariement de [" - #~ msgid "Unfinished \\ escape" #~ msgstr "séquence d'échappement \\ non terminée" @@ -1837,6 +1913,9 @@ msgstr "Aucune expression r #~ msgid "malformed repeat count" #~ msgstr "compteur de répétition mal composé" +#~ msgid "Unbalanced [" +#~ msgstr "Non appariement de [" + #~ msgid "Unbalanced (" #~ msgstr "Non appariement de (" @@ -1852,13 +1931,6 @@ msgstr "Aucune expression r #~ msgid "internal error: file `%s', line %d\n" #~ msgstr "erreur interne: fichier « %s », ligne %d\n" -#~ msgid "" -#~ "\n" -#~ "To report bugs, see node `Bugs' in `gawk.info', which is\n" -#~ msgstr "" -#~ "\n" -#~ "Pour rapporter une anomalie, voir « Bugs » dans « gawk.info », dans la\n" - #~ msgid "pipe from `%s': could not set close-on-exec (fcntl: %s)" #~ msgstr "pipe de `%s': ne peut initialiser close-on-exec (fcntl: %s)" diff --git a/po/gawk.pot b/po/gawk.pot index 125798e34..af70f8270 100644 --- a/po/gawk.pot +++ b/po/gawk.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: arnold@skeeve.com\n" -"POT-Creation-Date: 2003-07-07 11:20-0700\n" +"POT-Creation-Date: 2004-07-15 13:02+0300\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -18,55 +18,60 @@ msgstr "" #: array.c:112 #, c-format +msgid "attempt to use function `%s' as an array" +msgstr "" + +#: array.c:115 +#, c-format msgid "attempt to use scalar parameter `%s' as an array" msgstr "" -#: array.c:113 +#: array.c:118 #, c-format msgid "attempt to use scalar `%s' as array" msgstr "" -#: array.c:151 +#: array.c:156 #, c-format msgid "from %s" msgstr "" -#: array.c:506 +#: array.c:511 #, c-format msgid "reference to uninitialized element `%s[\"%s\"]'" msgstr "" -#: array.c:512 +#: array.c:517 #, c-format msgid "subscript of array `%s' is null string" msgstr "" -#: array.c:609 +#: array.c:621 #, c-format msgid "delete: index `%s' not in array `%s'" msgstr "" -#: array.c:769 +#: array.c:791 #, c-format msgid "%s: empty (null)\n" msgstr "" -#: array.c:774 +#: array.c:796 #, c-format msgid "%s: empty (zero)\n" msgstr "" -#: array.c:778 +#: array.c:800 #, c-format msgid "%s: table_size = %d, array_size = %d\n" msgstr "" -#: array.c:807 +#: array.c:829 #, c-format msgid "%s: is parameter\n" msgstr "" -#: array.c:812 +#: array.c:834 #, c-format msgid "%s: array_ref to %s\n" msgstr "" @@ -90,793 +95,811 @@ msgstr "" msgid "regexp constant `/%s/' looks like a C comment, but is not" msgstr "" -#: awkgram.y:340 awkgram.y:615 +#: awkgram.y:341 awkgram.y:619 msgid "statement may have no effect" msgstr "" -#: awkgram.y:435 awkgram.y:455 +#: awkgram.y:436 awkgram.y:456 #, c-format msgid "`%s' used in %s action" msgstr "" -#: awkgram.y:448 awkgram.y:451 +#: awkgram.y:449 awkgram.y:452 msgid "`nextfile' is a gawk extension" msgstr "" -#: awkgram.y:465 +#: awkgram.y:466 msgid "`return' used outside function context" msgstr "" -#: awkgram.y:504 +#: awkgram.y:508 msgid "plain `print' in BEGIN or END rule should probably be `print \"\"'" msgstr "" -#: awkgram.y:517 awkgram.y:524 +#: awkgram.y:521 awkgram.y:528 msgid "`delete array' is a gawk extension" msgstr "" -#: awkgram.y:532 awkgram.y:539 +#: awkgram.y:536 awkgram.y:543 msgid "`delete(array)' is a non-portable tawk extension" msgstr "" -#: awkgram.y:583 +#: awkgram.y:587 #, c-format msgid "duplicate case values in switch body: %s" msgstr "" -#: awkgram.y:593 +#: awkgram.y:597 msgid "Duplicate `default' detected in switch body" msgstr "" -#: awkgram.y:681 +#: awkgram.y:686 msgid "multistage two-way pipelines don't work" msgstr "" -#: awkgram.y:772 +#: awkgram.y:777 msgid "regular expression on right of assignment" msgstr "" -#: awkgram.y:782 +#: awkgram.y:800 msgid "regular expression on left of `~' or `!~' operator" msgstr "" -#: awkgram.y:790 +#: awkgram.y:808 msgid "regular expression on right of comparison" msgstr "" -#: awkgram.y:857 +#: awkgram.y:875 msgid "non-redirected `getline' undefined inside END action" msgstr "" -#: awkgram.y:884 +#: awkgram.y:902 msgid "call of `length' without parentheses is not portable" msgstr "" -#: awkgram.y:887 +#: awkgram.y:905 msgid "call of `length' without parentheses is deprecated by POSIX" msgstr "" -#: awkgram.y:940 +#: awkgram.y:958 msgid "use of non-array as array" msgstr "" -#: awkgram.y:942 +#: awkgram.y:960 msgid "invalid subscript expression" msgstr "" -#: awkgram.y:1140 +#: awkgram.y:1158 msgid "unexpected newline or end of string" msgstr "" -#: awkgram.y:1235 +#: awkgram.y:1254 msgid "empty program text on command line" msgstr "" -#: awkgram.y:1292 +#: awkgram.y:1307 #, c-format msgid "can't open source file `%s' for reading (%s)" msgstr "" -#: awkgram.y:1327 +#: awkgram.y:1384 #, c-format msgid "can't read sourcefile `%s' (%s)" msgstr "" -#: awkgram.y:1335 +#: awkgram.y:1392 #, c-format msgid "source file `%s' is empty" msgstr "" -#: awkgram.y:1537 awkgram.y:1647 awkgram.y:1665 awkgram.y:2015 awkgram.y:2100 +#: awkgram.y:1590 awkgram.y:1700 awkgram.y:1718 awkgram.y:2068 awkgram.y:2153 msgid "source file does not end in newline" msgstr "" -#: awkgram.y:1601 +#: awkgram.y:1654 msgid "unterminated regexp ends with `\\' at end of file" msgstr "" -#: awkgram.y:1621 +#: awkgram.y:1674 msgid "unterminated regexp" msgstr "" -#: awkgram.y:1624 +#: awkgram.y:1677 msgid "unterminated regexp at end of file" msgstr "" -#: awkgram.y:1691 +#: awkgram.y:1744 msgid "use of `\\ #...' line continuation is not portable" msgstr "" -#: awkgram.y:1703 +#: awkgram.y:1756 msgid "backslash not last character on line" msgstr "" -#: awkgram.y:1748 +#: awkgram.y:1801 msgid "POSIX does not allow operator `**='" msgstr "" -#: awkgram.y:1750 +#: awkgram.y:1803 msgid "old awk does not support operator `**='" msgstr "" -#: awkgram.y:1759 +#: awkgram.y:1812 msgid "POSIX does not allow operator `**'" msgstr "" -#: awkgram.y:1761 +#: awkgram.y:1814 msgid "old awk does not support operator `**'" msgstr "" -#: awkgram.y:1792 +#: awkgram.y:1845 msgid "operator `^=' is not supported in old awk" msgstr "" -#: awkgram.y:1800 +#: awkgram.y:1853 msgid "operator `^' is not supported in old awk" msgstr "" -#: awkgram.y:1884 awkgram.y:1901 +#: awkgram.y:1937 awkgram.y:1954 msgid "unterminated string" msgstr "" -#: awkgram.y:2061 +#: awkgram.y:2114 #, c-format msgid "invalid char '%c' in expression" msgstr "" -#: awkgram.y:2121 +#: awkgram.y:2162 #, c-format msgid "`%s' is a gawk extension" msgstr "" -#: awkgram.y:2124 +#: awkgram.y:2165 #, c-format msgid "`%s' is a Bell Labs extension" msgstr "" -#: awkgram.y:2127 +#: awkgram.y:2168 #, c-format msgid "POSIX does not allow `%s'" msgstr "" -#: awkgram.y:2131 +#: awkgram.y:2172 #, c-format msgid "`%s' is not supported in old awk" msgstr "" -#: awkgram.y:2158 +#: awkgram.y:2198 msgid "`goto' considered harmful!\n" msgstr "" -#: awkgram.y:2220 +#: awkgram.y:2260 #, c-format msgid "%d is invalid as number of arguments for %s" msgstr "" -#: awkgram.y:2239 awkgram.y:2242 +#: awkgram.y:2279 awkgram.y:2282 msgid "match: third argument is a gawk extension" msgstr "" -#: awkgram.y:2255 +#: awkgram.y:2295 #, c-format msgid "%s: string literal as last arg of substitute has no effect" msgstr "" -#: awkgram.y:2258 +#: awkgram.y:2298 #, c-format msgid "%s third parameter is not a changeable object" msgstr "" -#: awkgram.y:2285 awkgram.y:2288 +#: awkgram.y:2325 awkgram.y:2328 msgid "close: second argument is a gawk extension" msgstr "" -#: awkgram.y:2298 +#: awkgram.y:2338 msgid "use of dcgettext(_\"...\") is incorrect: remove leading underscore" msgstr "" -#: awkgram.y:2313 +#: awkgram.y:2353 msgid "use of dcngettext(_\"...\") is incorrect: remove leading underscore" msgstr "" -#: awkgram.y:2384 +#: awkgram.y:2424 #, c-format msgid "function `%s': parameter #%d, `%s', duplicates parameter #%d" msgstr "" -#: awkgram.y:2417 +#: awkgram.y:2457 #, c-format msgid "function `%s': parameter `%s' shadows global variable" msgstr "" -#: awkgram.y:2529 +#: awkgram.y:2569 #, c-format msgid "could not open `%s' for writing (%s)" msgstr "" -#: awkgram.y:2530 profile.c:93 +#: awkgram.y:2570 profile.c:93 msgid "sending profile to standard error" msgstr "" -#: awkgram.y:2562 +#: awkgram.y:2602 #, c-format msgid "%s: close failed (%s)" msgstr "" -#: awkgram.y:2684 +#: awkgram.y:2723 msgid "shadow_funcs() called twice!" msgstr "" -#: awkgram.y:2711 +#: awkgram.y:2750 msgid "there were shadowed variables." msgstr "" -#: awkgram.y:2784 +#: awkgram.y:2823 #, c-format msgid "function `%s': can't use function name as parameter name" msgstr "" -#: awkgram.y:2794 +#: awkgram.y:2833 #, c-format msgid "function name `%s' previously defined" msgstr "" -#: awkgram.y:2945 awkgram.y:2951 +#: awkgram.y:2984 awkgram.y:2990 #, c-format msgid "function `%s' called but never defined" msgstr "" -#: awkgram.y:2954 +#: awkgram.y:2993 #, c-format msgid "function `%s' defined but never called" msgstr "" -#: awkgram.y:2981 +#: awkgram.y:3020 #, c-format msgid "regexp constant for parameter #%d yields boolean value" msgstr "" -#: awkgram.y:2994 +#: awkgram.y:3033 #, c-format msgid "" "function `%s' called with space between name and `(',\n" -"%s" -msgstr "" - -#: awkgram.y:2996 -msgid "or used as a variable or an array" +"or used as a variable or an array" msgstr "" -#: builtin.c:137 +#: builtin.c:149 #, c-format msgid "%s to \"%s\" failed (%s)" msgstr "" -#: builtin.c:138 +#: builtin.c:150 msgid "standard output" msgstr "" -#: builtin.c:139 +#: builtin.c:151 msgid "reason unknown" msgstr "" -#: builtin.c:152 +#: builtin.c:164 msgid "exp: received non-numeric argument" msgstr "" -#: builtin.c:158 +#: builtin.c:170 #, c-format msgid "exp: argument %g is out of range" msgstr "" -#: builtin.c:216 +#: builtin.c:228 #, c-format msgid "fflush: cannot flush: pipe `%s' opened for reading, not writing" msgstr "" -#: builtin.c:219 +#: builtin.c:231 #, c-format msgid "fflush: cannot flush: file `%s' opened for reading, not writing" msgstr "" -#: builtin.c:231 +#: builtin.c:243 #, c-format msgid "fflush: `%s' is not an open file, pipe or co-process" msgstr "" -#: builtin.c:325 +#: builtin.c:338 msgid "index: received non-string first argument" msgstr "" -#: builtin.c:327 +#: builtin.c:340 msgid "index: received non-string second argument" msgstr "" -#: builtin.c:437 +#: builtin.c:454 msgid "int: received non-numeric argument" msgstr "" -#: builtin.c:454 +#: builtin.c:471 msgid "length: received non-string argument" msgstr "" -#: builtin.c:470 +#: builtin.c:487 msgid "log: received non-numeric argument" msgstr "" -#: builtin.c:473 +#: builtin.c:490 #, c-format msgid "log: received negative argument %g" msgstr "" -#: builtin.c:635 builtin.c:638 +#: builtin.c:654 builtin.c:657 msgid "must use `count$' on all formats or none" msgstr "" -#: builtin.c:740 +#: builtin.c:759 msgid "`$' is not permitted in awk formats" msgstr "" -#: builtin.c:746 +#: builtin.c:765 msgid "arg count with `$' must be > 0" msgstr "" -#: builtin.c:748 +#: builtin.c:767 #, c-format msgid "arg count %ld greater than total number of supplied arguments" msgstr "" -#: builtin.c:750 +#: builtin.c:769 msgid "`$' not permitted after period in format" msgstr "" -#: builtin.c:763 +#: builtin.c:782 msgid "no `$' supplied for positional field width or precision" msgstr "" -#: builtin.c:821 +#: builtin.c:848 msgid "`l' is meaningless in awk formats; ignored" msgstr "" -#: builtin.c:825 +#: builtin.c:852 msgid "`l' is not permitted in POSIX awk formats" msgstr "" -#: builtin.c:836 +#: builtin.c:863 msgid "`L' is meaningless in awk formats; ignored" msgstr "" -#: builtin.c:840 +#: builtin.c:867 msgid "`L' is not permitted in POSIX awk formats" msgstr "" -#: builtin.c:851 +#: builtin.c:878 msgid "`h' is meaningless in awk formats; ignored" msgstr "" -#: builtin.c:855 +#: builtin.c:882 msgid "`h' is not permitted in POSIX awk formats" msgstr "" -#: builtin.c:1055 +#: builtin.c:1111 #, c-format msgid "[s]printf: value %g is out of range for `%%%c' format" msgstr "" -#: builtin.c:1108 +#: builtin.c:1171 msgid "not enough arguments to satisfy format string" msgstr "" -#: builtin.c:1110 +#: builtin.c:1173 msgid "^ ran out for this one" msgstr "" -#: builtin.c:1115 +#: builtin.c:1178 msgid "[s]printf: format specifier does not have control letter" msgstr "" -#: builtin.c:1118 +#: builtin.c:1181 msgid "too many arguments supplied for format string" msgstr "" -#: builtin.c:1184 builtin.c:1187 +#: builtin.c:1247 builtin.c:1250 msgid "printf: no arguments" msgstr "" -#: builtin.c:1211 +#: builtin.c:1274 msgid "sqrt: received non-numeric argument" msgstr "" -#: builtin.c:1215 +#: builtin.c:1278 #, c-format msgid "sqrt: called with negative argument %g" msgstr "" -#: builtin.c:1238 +#: builtin.c:1301 #, c-format msgid "substr: start index %g is invalid, using 1" msgstr "" -#: builtin.c:1243 +#: builtin.c:1306 #, c-format msgid "substr: non-integer start index %g will be truncated" msgstr "" -#: builtin.c:1262 +#: builtin.c:1325 #, c-format msgid "substr: length %g is not >= 1" msgstr "" -#: builtin.c:1264 +#: builtin.c:1327 #, c-format msgid "substr: length %g is not >= 0" msgstr "" -#: builtin.c:1271 +#: builtin.c:1334 #, c-format msgid "substr: non-integer length %g will be truncated" msgstr "" -#: builtin.c:1276 +#: builtin.c:1339 #, c-format msgid "substr: length %g too big for string indexing, truncating to %g" msgstr "" -#: builtin.c:1288 +#: builtin.c:1351 msgid "substr: source string is zero length" msgstr "" -#: builtin.c:1294 +#: builtin.c:1357 #, c-format msgid "substr: start index %g is past end of string" msgstr "" -#: builtin.c:1302 +#: builtin.c:1365 #, c-format msgid "" "substr: length %g at start index %g exceeds length of first argument (%lu)" msgstr "" -#: builtin.c:1337 +#: builtin.c:1400 msgid "strftime: received non-string first argument" msgstr "" -#: builtin.c:1343 +#: builtin.c:1406 msgid "strftime: received empty format string" msgstr "" -#: builtin.c:1352 +#: builtin.c:1415 msgid "strftime: received non-numeric second argument" msgstr "" -#: builtin.c:1415 +#: builtin.c:1478 msgid "mktime: received non-string argument" msgstr "" -#: builtin.c:1460 +#: builtin.c:1523 msgid "system: received non-string argument" msgstr "" -#: builtin.c:1581 eval.c:1883 +#: builtin.c:1644 eval.c:2019 #, c-format msgid "reference to uninitialized field `$%d'" msgstr "" -#: builtin.c:1608 +#: builtin.c:1671 msgid "tolower: received non-string argument" msgstr "" -#: builtin.c:1657 +#: builtin.c:1720 msgid "toupper: received non-string argument" msgstr "" -#: builtin.c:1702 +#: builtin.c:1765 msgid "atan2: received non-numeric first argument" msgstr "" -#: builtin.c:1704 +#: builtin.c:1767 msgid "atan2: received non-numeric second argument" msgstr "" -#: builtin.c:1723 +#: builtin.c:1786 msgid "sin: received non-numeric argument" msgstr "" -#: builtin.c:1739 +#: builtin.c:1802 msgid "cos: received non-numeric argument" msgstr "" -#: builtin.c:1788 +#: builtin.c:1852 msgid "srand: received non-numeric argument" msgstr "" -#: builtin.c:1823 +#: builtin.c:1887 msgid "match: third argument is not an array" msgstr "" -#: builtin.c:2307 +#: builtin.c:2414 msgid "gensub: third argument of 0 treated as 1" msgstr "" -#: builtin.c:2416 builtin.c:2418 +#: builtin.c:2572 msgid "lshift: received non-numeric first argument" msgstr "" -#: builtin.c:2420 +#: builtin.c:2574 +msgid "lshift: received non-numeric second argument" +msgstr "" + +#: builtin.c:2580 #, c-format msgid "lshift(%lf, %lf): negative values will give strange results" msgstr "" -#: builtin.c:2422 +#: builtin.c:2582 #, c-format msgid "lshift(%lf, %lf): fractional values will be truncated" msgstr "" -#: builtin.c:2424 +#: builtin.c:2584 #, c-format msgid "lshift(%lf, %lf): too large shift value will give strange results" msgstr "" -#: builtin.c:2453 builtin.c:2455 +#: builtin.c:2610 msgid "rshift: received non-numeric first argument" msgstr "" -#: builtin.c:2457 +#: builtin.c:2612 +msgid "rshift: received non-numeric second argument" +msgstr "" + +#: builtin.c:2618 #, c-format msgid "rshift(%lf, %lf): negative values will give strange results" msgstr "" -#: builtin.c:2459 +#: builtin.c:2620 #, c-format msgid "rshift(%lf, %lf): fractional values will be truncated" msgstr "" -#: builtin.c:2461 +#: builtin.c:2622 #, c-format msgid "rshift(%lf, %lf): too large shift value will give strange results" msgstr "" -#: builtin.c:2490 builtin.c:2492 +#: builtin.c:2648 msgid "and: received non-numeric first argument" msgstr "" -#: builtin.c:2494 +#: builtin.c:2650 +msgid "and: received non-numeric second argument" +msgstr "" + +#: builtin.c:2656 #, c-format msgid "and(%lf, %lf): negative values will give strange results" msgstr "" -#: builtin.c:2496 +#: builtin.c:2658 #, c-format msgid "and(%lf, %lf): fractional values will be truncated" msgstr "" -#: builtin.c:2525 builtin.c:2527 +#: builtin.c:2684 msgid "or: received non-numeric first argument" msgstr "" -#: builtin.c:2529 +#: builtin.c:2686 +msgid "or: received non-numeric second argument" +msgstr "" + +#: builtin.c:2692 #, c-format msgid "or(%lf, %lf): negative values will give strange results" msgstr "" -#: builtin.c:2531 +#: builtin.c:2694 #, c-format msgid "or(%lf, %lf): fractional values will be truncated" msgstr "" -#: builtin.c:2560 builtin.c:2562 +#: builtin.c:2720 msgid "xor: received non-numeric first argument" msgstr "" -#: builtin.c:2564 +#: builtin.c:2722 +msgid "xor: received non-numeric second argument" +msgstr "" + +#: builtin.c:2728 #, c-format msgid "xor(%lf, %lf): negative values will give strange results" msgstr "" -#: builtin.c:2566 +#: builtin.c:2730 #, c-format msgid "xor(%lf, %lf): fractional values will be truncated" msgstr "" -#: builtin.c:2594 +#: builtin.c:2754 msgid "compl: received non-numeric argument" msgstr "" -#: builtin.c:2596 +#: builtin.c:2760 #, c-format msgid "compl(%lf): negative value will give strange results" msgstr "" -#: builtin.c:2598 +#: builtin.c:2762 #, c-format msgid "compl(%lf): fractional value will be truncated" msgstr "" -#: builtin.c:2771 +#: builtin.c:2935 #, c-format msgid "dcgettext: `%s' is not a valid locale category" msgstr "" -#: eval.c:266 +#: eval.c:303 #, c-format msgid "unknown nodetype %d" msgstr "" -#: eval.c:312 +#: eval.c:350 msgid "buffer overflow in genflags2str" msgstr "" -#: eval.c:647 +#: eval.c:382 eval.c:388 profile.c:837 +#, c-format +msgid "attempt to use array `%s' in a scalar context" +msgstr "" + +#: eval.c:730 #, c-format msgid "for loop: array `%s' changed size from %ld to %ld during loop execution" msgstr "" -#: eval.c:668 +#: eval.c:751 msgid "`break' outside a loop is not portable" msgstr "" -#: eval.c:672 +#: eval.c:755 msgid "`break' outside a loop is not allowed" msgstr "" -#: eval.c:689 +#: eval.c:772 msgid "`continue' outside a loop is not portable" msgstr "" -#: eval.c:693 +#: eval.c:776 msgid "`continue' outside a loop is not allowed" msgstr "" -#: eval.c:727 +#: eval.c:810 msgid "`next' cannot be called from a BEGIN rule" msgstr "" -#: eval.c:729 +#: eval.c:812 msgid "`next' cannot be called from an END rule" msgstr "" -#: eval.c:738 +#: eval.c:821 msgid "`nextfile' cannot be called from a BEGIN rule" msgstr "" -#: eval.c:740 +#: eval.c:823 msgid "`nextfile' cannot be called from an END rule" msgstr "" -#: eval.c:785 +#: eval.c:872 msgid "statement has no effect" msgstr "" -#: eval.c:828 eval.c:1726 +#: eval.c:915 eval.c:1873 #, c-format msgid "can't use function name `%s' as variable or array" msgstr "" -#: eval.c:835 eval.c:841 +#: eval.c:922 eval.c:928 #, c-format msgid "reference to uninitialized argument `%s'" msgstr "" -#: eval.c:848 eval.c:907 eval.c:1732 eval.c:1742 profile.c:807 -#, c-format -msgid "attempt to use array `%s' in a scalar context" -msgstr "" - -#: eval.c:858 eval.c:1752 +#: eval.c:937 eval.c:1882 #, c-format msgid "reference to uninitialized variable `%s'" msgstr "" -#: eval.c:1007 +#: eval.c:1083 msgid "" "concatenation: side effects in one expression have changed the length of " "another!" msgstr "" -#: eval.c:1032 +#: eval.c:1162 msgid "assignment used in conditional context" msgstr "" -#: eval.c:1122 +#: eval.c:1252 msgid "division by zero attempted" msgstr "" -#: eval.c:1137 +#: eval.c:1267 #, c-format msgid "division by zero attempted in `%%'" msgstr "" -#: eval.c:1152 profile.c:683 +#: eval.c:1282 profile.c:713 #, c-format msgid "illegal type (%s) in tree_eval" msgstr "" -#: eval.c:1328 +#: eval.c:1459 msgid "division by zero attempted in `/='" msgstr "" -#: eval.c:1346 +#: eval.c:1477 #, c-format msgid "division by zero attempted in `%%='" msgstr "" -#: eval.c:1586 +#: eval.c:1738 #, c-format msgid "function `%s' called with more arguments than declared" msgstr "" -#: eval.c:1633 +#: eval.c:1782 #, c-format msgid "function `%s' not defined" msgstr "" -#: eval.c:1639 +#: eval.c:1788 #, c-format msgid "function %s called\n" msgstr "" -#: eval.c:1698 +#: eval.c:1845 +#, c-format msgid "" "\n" "\t# Function Call Stack:\n" "\n" msgstr "" -#: eval.c:1701 +#: eval.c:1848 +#, c-format msgid "\t# -- main --\n" msgstr "" -#: eval.c:1867 +#: eval.c:2003 msgid "attempt to field reference from non-numeric value" msgstr "" -#: eval.c:1869 +#: eval.c:2005 msgid "attempt to reference from null string" msgstr "" -#: eval.c:1875 +#: eval.c:2011 #, c-format msgid "attempt to access field %d" msgstr "" -#: eval.c:1896 eval.c:1903 profile.c:900 +#: eval.c:2032 eval.c:2039 profile.c:934 msgid "assignment is not allowed to result of builtin function" msgstr "" -#: eval.c:1951 +#: eval.c:2103 msgid "`IGNORECASE' is a gawk extension" msgstr "" -#: eval.c:1980 +#: eval.c:2133 msgid "`BINMODE' is a gawk extension" msgstr "" -#: eval.c:2092 +#: eval.c:2255 #, c-format msgid "bad `%sFMT' specification `%s'" msgstr "" -#: eval.c:2170 +#: eval.c:2333 msgid "turning off `--lint' due to assignment to `LINT'" msgstr "" @@ -894,7 +917,56 @@ msgstr "" msgid "extension: library `%s': cannot call function `%s' (%s)\n" msgstr "" -#: ext.c:183 +#: ext.c:102 +msgid "extension: missing function name" +msgstr "" + +#: ext.c:107 +#, c-format +msgid "extension: illegal character `%c' in function name `%s'" +msgstr "" + +#: ext.c:113 +#, c-format +msgid "extension: can't redefine function `%s'" +msgstr "" + +#: ext.c:117 +#, c-format +msgid "extension: function `%s' already defined" +msgstr "" + +#: ext.c:122 +#, c-format +msgid "extension: can't use gawk built-in `%s' as function name" +msgstr "" + +#: ext.c:124 +#, c-format +msgid "extension: function name `%s' previously defined" +msgstr "" + +#: ext.c:201 +#, c-format +msgid "function `%s' defined to take no more than `%d' argument(s)" +msgstr "" + +#: ext.c:204 +#, c-format +msgid "function `%s': missing argument #%d" +msgstr "" + +#: ext.c:214 +#, c-format +msgid "function `%s': argument #%d: attempt to use scalar as an array" +msgstr "" + +#: ext.c:218 +#, c-format +msgid "function `%s': argument #%d: attempt to use array as a scalar" +msgstr "" + +#: ext.c:243 msgid "Operation Not Supported" msgstr "" @@ -923,517 +995,517 @@ msgstr "" msgid "null string for `FS' is a gawk extension" msgstr "" -#: getopt.c:692 getopt.c:704 +#: getopt.c:692 getopt.c:711 #, c-format msgid "%s: option `%s' is ambiguous\n" msgstr "" -#: getopt.c:737 getopt.c:741 +#: getopt.c:744 getopt.c:748 #, c-format msgid "%s: option `--%s' doesn't allow an argument\n" msgstr "" -#: getopt.c:750 getopt.c:755 +#: getopt.c:757 getopt.c:762 #, c-format msgid "%s: option `%c%s' doesn't allow an argument\n" msgstr "" -#: getopt.c:791 getopt.c:804 getopt.c:1093 getopt.c:1106 +#: getopt.c:807 getopt.c:829 getopt.c:1159 getopt.c:1181 #, c-format msgid "%s: option `%s' requires an argument\n" msgstr "" -#: getopt.c:842 getopt.c:845 +#: getopt.c:867 getopt.c:870 #, c-format msgid "%s: unrecognized option `--%s'\n" msgstr "" -#: getopt.c:853 getopt.c:856 +#: getopt.c:878 getopt.c:881 #, c-format msgid "%s: unrecognized option `%c%s'\n" msgstr "" -#: getopt.c:903 getopt.c:906 +#: getopt.c:936 getopt.c:939 #, c-format msgid "%s: illegal option -- %c\n" msgstr "" -#: getopt.c:912 getopt.c:915 +#: getopt.c:945 getopt.c:948 #, c-format msgid "%s: invalid option -- %c\n" msgstr "" -#: getopt.c:962 getopt.c:973 getopt.c:1159 getopt.c:1172 main.c:434 +#: getopt.c:1003 getopt.c:1022 getopt.c:1234 getopt.c:1255 main.c:433 #, c-format msgid "%s: option requires an argument -- %c\n" msgstr "" -#: getopt.c:1025 getopt.c:1036 +#: getopt.c:1074 getopt.c:1093 #, c-format msgid "%s: option `-W %s' is ambiguous\n" msgstr "" -#: getopt.c:1060 getopt.c:1072 +#: getopt.c:1117 getopt.c:1138 #, c-format msgid "%s: option `-W %s' doesn't allow an argument\n" msgstr "" -#: io.c:305 +#: io.c:308 #, c-format msgid "cannot open file `%s' for reading (%s)" msgstr "" -#: io.c:392 +#: io.c:395 #, c-format msgid "close of fd %d (`%s') failed (%s)" msgstr "" -#: io.c:530 +#: io.c:533 #, c-format msgid "invalid tree type %s in redirect()" msgstr "" -#: io.c:536 +#: io.c:539 #, c-format msgid "expression in `%s' redirection only has numeric value" msgstr "" -#: io.c:542 +#: io.c:545 #, c-format msgid "expression for `%s' redirection has null string value" msgstr "" -#: io.c:547 +#: io.c:550 #, c-format msgid "filename `%s' for `%s' redirection may be result of logical expression" msgstr "" -#: io.c:569 +#: io.c:588 #, c-format msgid "unnecessary mixing of `>' and `>>' for file `%.*s'" msgstr "" -#: io.c:621 +#: io.c:640 #, c-format msgid "can't open pipe `%s' for output (%s)" msgstr "" -#: io.c:630 +#: io.c:649 #, c-format msgid "can't open pipe `%s' for input (%s)" msgstr "" -#: io.c:643 +#: io.c:662 #, c-format msgid "can't open two way socket `%s' for input/output (%s)" msgstr "" -#: io.c:647 +#: io.c:666 #, c-format msgid "can't open two way pipe `%s' for input/output (%s)" msgstr "" -#: io.c:723 +#: io.c:742 #, c-format msgid "can't redirect from `%s' (%s)" msgstr "" -#: io.c:726 +#: io.c:745 #, c-format msgid "can't redirect to `%s' (%s)" msgstr "" -#: io.c:765 +#: io.c:784 msgid "" "reached system limit for open files: starting to multiplex file descriptors" msgstr "" -#: io.c:777 +#: io.c:800 #, c-format msgid "close of `%s' failed (%s)." msgstr "" -#: io.c:784 +#: io.c:808 msgid "too many pipes or input files open" msgstr "" -#: io.c:807 +#: io.c:831 msgid "close: second argument must be `to' or `from'" msgstr "" -#: io.c:821 +#: io.c:845 #, c-format msgid "close: `%.*s' is not an open file, pipe or co-process" msgstr "" -#: io.c:825 +#: io.c:849 msgid "close of redirection that was never opened" msgstr "" -#: io.c:862 +#: io.c:945 #, c-format msgid "close: redirection `%s' not opened with `|&', second argument ignored" msgstr "" -#: io.c:924 +#: io.c:960 #, c-format msgid "failure status (%d) on pipe close of `%s' (%s)" msgstr "" -#: io.c:927 +#: io.c:963 #, c-format msgid "failure status (%d) on file close of `%s' (%s)" msgstr "" -#: io.c:946 +#: io.c:983 #, c-format msgid "no explicit close of socket `%s' provided" msgstr "" -#: io.c:949 +#: io.c:986 #, c-format msgid "no explicit close of co-process `%s' provided" msgstr "" -#: io.c:952 +#: io.c:989 #, c-format msgid "no explicit close of pipe `%s' provided" msgstr "" -#: io.c:955 +#: io.c:992 #, c-format msgid "no explicit close of file `%s' provided" msgstr "" -#: io.c:984 io.c:1038 +#: io.c:1021 io.c:1075 #, c-format msgid "error writing standard output (%s)" msgstr "" -#: io.c:988 io.c:1042 +#: io.c:1025 io.c:1079 #, c-format msgid "error writing standard error (%s)" msgstr "" -#: io.c:996 +#: io.c:1033 #, c-format msgid "pipe flush of `%s' failed (%s)." msgstr "" -#: io.c:999 +#: io.c:1036 #, c-format msgid "co-process flush of pipe to `%s' failed (%s)." msgstr "" -#: io.c:1002 +#: io.c:1039 #, c-format msgid "file flush of `%s' failed (%s)." msgstr "" -#: io.c:1161 +#: io.c:1198 msgid "/inet/raw client not ready yet, sorry" msgstr "" -#: io.c:1163 io.c:1200 +#: io.c:1200 io.c:1237 msgid "only root may use `/inet/raw'." msgstr "" -#: io.c:1198 +#: io.c:1235 msgid "/inet/raw server not ready yet, sorry" msgstr "" -#: io.c:1288 +#: io.c:1325 #, c-format msgid "no (known) protocol supplied in special filename `%s'" msgstr "" -#: io.c:1306 +#: io.c:1343 #, c-format msgid "special file name `%s' is incomplete" msgstr "" -#: io.c:1318 +#: io.c:1355 #, c-format msgid "local port invalid in `%s'" msgstr "" -#: io.c:1330 +#: io.c:1367 msgid "must supply a remote hostname to `/inet'" msgstr "" -#: io.c:1345 +#: io.c:1382 msgid "must supply a remote port to `/inet'" msgstr "" -#: io.c:1351 +#: io.c:1388 #, c-format msgid "remote port invalid in `%s'" msgstr "" -#: io.c:1361 +#: io.c:1398 msgid "TCP/IP communications are not supported" msgstr "" -#: io.c:1370 io.c:1551 +#: io.c:1407 io.c:1588 #, c-format msgid "file `%s' is a directory" msgstr "" -#: io.c:1440 +#: io.c:1477 #, c-format msgid "use `PROCINFO[\"%s\"]' instead of `%s'" msgstr "" -#: io.c:1472 +#: io.c:1509 msgid "use `PROCINFO[...]' instead of `/dev/user'" msgstr "" -#: io.c:1537 io.c:1711 +#: io.c:1574 io.c:1748 #, c-format msgid "could not open `%s', mode `%s'" msgstr "" -#: io.c:1762 +#: io.c:1799 #, c-format msgid "close of master pty failed (%s)" msgstr "" -#: io.c:1764 io.c:1916 io.c:2068 +#: io.c:1801 io.c:1953 io.c:2105 #, c-format msgid "close of stdout in child failed (%s)" msgstr "" -#: io.c:1767 +#: io.c:1804 #, c-format msgid "moving slave pty to stdout in child failed (dup: %s)" msgstr "" -#: io.c:1769 io.c:1921 +#: io.c:1806 io.c:1958 #, c-format msgid "close of stdin in child failed (%s)" msgstr "" -#: io.c:1772 +#: io.c:1809 #, c-format msgid "moving slave pty to stdin in child failed (dup: %s)" msgstr "" -#: io.c:1774 io.c:1793 +#: io.c:1811 io.c:1830 #, c-format msgid "close of slave pty failed (%s)" msgstr "" -#: io.c:1867 io.c:1919 io.c:2049 io.c:2071 +#: io.c:1904 io.c:1956 io.c:2086 io.c:2108 #, c-format msgid "moving pipe to stdout in child failed (dup: %s)" msgstr "" -#: io.c:1871 io.c:1924 +#: io.c:1908 io.c:1961 #, c-format msgid "moving pipe to stdin in child failed (dup: %s)" msgstr "" -#: io.c:1888 io.c:2062 +#: io.c:1925 io.c:2099 msgid "restoring stdout in parent process failed\n" msgstr "" -#: io.c:1893 +#: io.c:1930 msgid "restoring stdin in parent process failed\n" msgstr "" -#: io.c:1927 io.c:2073 io.c:2084 +#: io.c:1964 io.c:2110 io.c:2121 #, c-format msgid "close of pipe failed (%s)" msgstr "" -#: io.c:1972 +#: io.c:2009 msgid "`|&' not supported" msgstr "" -#: io.c:2039 +#: io.c:2076 #, c-format msgid "cannot open pipe `%s' (%s)" msgstr "" -#: io.c:2080 +#: io.c:2117 #, c-format msgid "cannot create child process for `%s' (fork: %s)" msgstr "" -#: io.c:2423 +#: io.c:2460 #, c-format msgid "data file `%s' is empty" msgstr "" -#: io.c:2466 io.c:2474 +#: io.c:2503 io.c:2511 msgid "could not allocate more input memory" msgstr "" -#: io.c:2832 io.c:2895 +#: io.c:2869 io.c:2932 #, c-format msgid "error reading input file `%s': %s" msgstr "" -#: io.c:3020 +#: io.c:3057 msgid "multicharacter value of `RS' is a gawk extension" msgstr "" -#: main.c:324 +#: main.c:323 msgid "`-m[fr]' option irrelevant in gawk" msgstr "" -#: main.c:326 +#: main.c:325 msgid "-m option usage: `-m[fr] nnn'" msgstr "" -#: main.c:343 +#: main.c:342 #, c-format msgid "%s: option `-W %s' unrecognized, ignored\n" msgstr "" -#: main.c:380 +#: main.c:379 msgid "empty argument to `--source' ignored" msgstr "" -#: main.c:451 +#: main.c:450 msgid "environment variable `POSIXLY_CORRECT' set: turning on `--posix'" msgstr "" -#: main.c:456 +#: main.c:455 msgid "`--posix' overrides `--traditional'" msgstr "" -#: main.c:467 +#: main.c:466 msgid "`--posix'/`--traditional' overrides `--non-decimal-data'" msgstr "" -#: main.c:471 +#: main.c:470 #, c-format msgid "running %s setuid root may be a security problem" msgstr "" -#: main.c:512 +#: main.c:511 #, c-format msgid "can't set binary mode on stdin (%s)" msgstr "" -#: main.c:515 +#: main.c:514 #, c-format msgid "can't set binary mode on stdout (%s)" msgstr "" -#: main.c:517 +#: main.c:516 #, c-format msgid "can't set binary mode on stderr (%s)" msgstr "" -#: main.c:547 +#: main.c:546 msgid "no program text at all!" msgstr "" -#: main.c:620 +#: main.c:623 #, c-format msgid "Usage: %s [POSIX or GNU style options] -f progfile [--] file ...\n" msgstr "" -#: main.c:622 +#: main.c:625 #, c-format msgid "Usage: %s [POSIX or GNU style options] [--] %cprogram%c file ...\n" msgstr "" -#: main.c:627 +#: main.c:630 msgid "POSIX options:\t\tGNU long options:\n" msgstr "" -#: main.c:628 +#: main.c:631 msgid "\t-f progfile\t\t--file=progfile\n" msgstr "" -#: main.c:629 +#: main.c:632 msgid "\t-F fs\t\t\t--field-separator=fs\n" msgstr "" -#: main.c:630 +#: main.c:633 msgid "\t-v var=val\t\t--assign=var=val\n" msgstr "" -#: main.c:631 +#: main.c:634 msgid "\t-m[fr] val\n" msgstr "" -#: main.c:632 +#: main.c:635 msgid "\t-W compat\t\t--compat\n" msgstr "" -#: main.c:633 +#: main.c:636 msgid "\t-W copyleft\t\t--copyleft\n" msgstr "" -#: main.c:634 +#: main.c:637 msgid "\t-W copyright\t\t--copyright\n" msgstr "" -#: main.c:635 +#: main.c:638 msgid "\t-W dump-variables[=file]\t--dump-variables[=file]\n" msgstr "" -#: main.c:636 +#: main.c:639 msgid "\t-W gen-po\t\t--gen-po\n" msgstr "" -#: main.c:637 +#: main.c:640 msgid "\t-W help\t\t\t--help\n" msgstr "" -#: main.c:638 +#: main.c:641 msgid "\t-W lint[=fatal]\t\t--lint[=fatal]\n" msgstr "" -#: main.c:639 +#: main.c:642 msgid "\t-W lint-old\t\t--lint-old\n" msgstr "" -#: main.c:640 +#: main.c:643 msgid "\t-W non-decimal-data\t--non-decimal-data\n" msgstr "" -#: main.c:642 +#: main.c:645 msgid "\t-W nostalgia\t\t--nostalgia\n" msgstr "" -#: main.c:645 +#: main.c:648 msgid "\t-W parsedebug\t\t--parsedebug\n" msgstr "" -#: main.c:647 +#: main.c:650 msgid "\t-W profile[=file]\t--profile[=file]\n" msgstr "" -#: main.c:648 +#: main.c:651 msgid "\t-W posix\t\t--posix\n" msgstr "" -#: main.c:649 +#: main.c:652 msgid "\t-W re-interval\t\t--re-interval\n" msgstr "" -#: main.c:650 +#: main.c:653 msgid "\t-W source=program-text\t--source=program-text\n" msgstr "" -#: main.c:651 +#: main.c:654 msgid "\t-W traditional\t\t--traditional\n" msgstr "" -#: main.c:652 +#: main.c:655 msgid "\t-W usage\t\t--usage\n" msgstr "" -#: main.c:653 +#: main.c:656 msgid "\t-W version\t\t--version\n" msgstr "" -#: main.c:657 +#: main.c:660 msgid "" "\n" "To report bugs, see node `Bugs' in `gawk.info', which is\n" @@ -1441,21 +1513,21 @@ msgid "" "\n" msgstr "" -#: main.c:661 +#: main.c:664 msgid "" "gawk is a pattern scanning and processing language.\n" "By default it reads standard input and writes standard output.\n" "\n" msgstr "" -#: main.c:665 +#: main.c:668 msgid "" "Examples:\n" "\tgawk '{ sum += $1 }; END { print sum }' file\n" "\tgawk -F: '{ print $1 }' /etc/passwd\n" msgstr "" -#: main.c:682 +#: main.c:685 #, c-format msgid "" "Copyright (C) 1989, 1991-%d Free Software Foundation.\n" @@ -1467,7 +1539,7 @@ msgid "" "\n" msgstr "" -#: main.c:690 +#: main.c:693 msgid "" "This program is distributed in the hope that it will be useful,\n" "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" @@ -1476,58 +1548,59 @@ msgid "" "\n" msgstr "" -#: main.c:696 +#: main.c:699 msgid "" "You should have received a copy of the GNU General Public License\n" "along with this program; if not, write to the Free Software\n" "Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n" msgstr "" -#: main.c:730 +#: main.c:733 msgid "-Ft does not set FS to tab in POSIX awk" msgstr "" -#: main.c:956 +#: main.c:962 #, c-format msgid "" "%s: `%s' argument to `-v' not in `var=value' form\n" "\n" msgstr "" -#: main.c:976 +#: main.c:982 #, c-format msgid "`%s' is not a legal variable name" msgstr "" -#: main.c:979 +#: main.c:985 #, c-format msgid "`%s' is not a variable name, looking for file `%s=%s'" msgstr "" -#: main.c:1012 +#: main.c:1018 msgid "floating point exception" msgstr "" -#: main.c:1019 +#: main.c:1025 msgid "fatal error: internal error" msgstr "" -#: main.c:1069 +#: main.c:1075 #, c-format msgid "no pre-opened fd %d" msgstr "" -#: main.c:1074 +#: main.c:1082 #, c-format msgid "could not pre-open /dev/null for fd %d" msgstr "" -#: main.c:1097 main.c:1106 +#: main.c:1105 main.c:1114 #, c-format msgid "could not find groups: %s" msgstr "" #: msg.c:54 +#, c-format msgid "cmd. line:" msgstr "" @@ -1547,19 +1620,19 @@ msgstr "" msgid "can't convert string to float" msgstr "" -#: node.c:355 +#: node.c:357 msgid "backslash at end of string" msgstr "" -#: node.c:539 +#: node.c:541 msgid "POSIX does not allow `\\x' escapes" msgstr "" -#: node.c:545 +#: node.c:547 msgid "no hex digits in `\\x' escape sequence" msgstr "" -#: node.c:579 +#: node.c:581 #, c-format msgid "escape sequence `\\%c' treated as plain `%c'" msgstr "" @@ -1574,122 +1647,126 @@ msgstr "" msgid "could not open `%s' for writing: %s" msgstr "" -#: profile.c:449 +#: profile.c:467 #, c-format msgid "internal error: %s with null vname" msgstr "" -#: profile.c:512 +#: profile.c:530 msgid "# treated internally as `delete'" msgstr "" -#: profile.c:1162 +#: profile.c:1167 +#, c-format +msgid "# this is a dynamically loaded extension function" +msgstr "" + +#: profile.c:1198 #, c-format msgid "\t# gawk profile, created %s\n" msgstr "" -#: profile.c:1165 +#: profile.c:1201 +#, c-format msgid "" "\t# BEGIN block(s)\n" "\n" msgstr "" -#: profile.c:1175 +#: profile.c:1211 +#, c-format msgid "" "\t# Rule(s)\n" "\n" msgstr "" -#: profile.c:1181 +#: profile.c:1217 +#, c-format msgid "" "\t# END block(s)\n" "\n" msgstr "" -#: profile.c:1201 +#: profile.c:1237 +#, c-format msgid "" "\n" "\t# Functions, listed alphabetically\n" msgstr "" -#: profile.c:1413 +#: profile.c:1452 #, c-format msgid "unexpected type %s in prec_level" msgstr "" -#: re.c:193 -#, c-format -msgid "regex match failed, not enough memory to match string \"%.*s%s\"" -msgstr "" - -#: regcomp.c:136 +#: regcomp.c:150 msgid "Success" msgstr "" -#: regcomp.c:139 +#: regcomp.c:153 msgid "No match" msgstr "" -#: regcomp.c:142 +#: regcomp.c:156 msgid "Invalid regular expression" msgstr "" -#: regcomp.c:145 +#: regcomp.c:159 msgid "Invalid collation character" msgstr "" -#: regcomp.c:148 +#: regcomp.c:162 msgid "Invalid character class name" msgstr "" -#: regcomp.c:151 +#: regcomp.c:165 msgid "Trailing backslash" msgstr "" -#: regcomp.c:154 +#: regcomp.c:168 msgid "Invalid back reference" msgstr "" -#: regcomp.c:157 +#: regcomp.c:171 msgid "Unmatched [ or [^" msgstr "" -#: regcomp.c:160 +#: regcomp.c:174 msgid "Unmatched ( or \\(" msgstr "" -#: regcomp.c:163 +#: regcomp.c:177 msgid "Unmatched \\{" msgstr "" -#: regcomp.c:166 +#: regcomp.c:180 msgid "Invalid content of \\{\\}" msgstr "" -#: regcomp.c:169 +#: regcomp.c:183 msgid "Invalid range end" msgstr "" -#: regcomp.c:172 +#: regcomp.c:186 msgid "Memory exhausted" msgstr "" -#: regcomp.c:175 +#: regcomp.c:189 msgid "Invalid preceding regular expression" msgstr "" -#: regcomp.c:178 +#: regcomp.c:192 msgid "Premature end of regular expression" msgstr "" -#: regcomp.c:181 +#: regcomp.c:195 msgid "Regular expression too big" msgstr "" -#: regcomp.c:184 +#: regcomp.c:198 msgid "Unmatched ) or \\)" msgstr "" -#: regcomp.c:621 +#: regcomp.c:668 msgid "No previous regular expression" msgstr "" diff --git a/po/he.gmo b/po/he.gmo index c2e39e546..d00c1c72d 100644 Binary files a/po/he.gmo and b/po/he.gmo differ diff --git a/po/he.po b/po/he.po index a64f3a28e..f9fcf2803 100644 --- a/po/he.po +++ b/po/he.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: gawk 3.1.1a\n" "Report-Msgid-Bugs-To: arnold@skeeve.com\n" -"POT-Creation-Date: 2003-07-07 11:20-0700\n" +"POT-Creation-Date: 2004-07-15 13:02+0300\n" "PO-Revision-Date: 2002-04-28 21:46+0300\n" "Last-Translator: Eli Zaretskii \n" "Language-Team: Hebrew \n" @@ -15,58 +15,63 @@ msgstr "" "Content-Transfer-Encoding: 8-bit\n" #: array.c:112 +#, fuzzy, c-format +msgid "attempt to use function `%s' as an array" +msgstr "êøòîë `%s' äéö÷ðåôá ùåîéù ïåéñð" + +#: array.c:115 #, c-format msgid "attempt to use scalar parameter `%s' as an array" msgstr "êøòî äéä åìéàë `%s' éøì÷ñ øèîøôá ùåîéù ïåéñð" -#: array.c:113 +#: array.c:118 #, c-format msgid "attempt to use scalar `%s' as array" msgstr "êøòîë `%s' øàì÷ñá éåâù ùåîéù" # This is not translated because it cannot be reworded in Hebrew # without looking awkward. -#: array.c:151 +#: array.c:156 #, fuzzy, c-format msgid "from %s" msgstr "%s (from %s)" -#: array.c:506 +#: array.c:511 #, c-format msgid "reference to uninitialized element `%s[\"%s\"]'" msgstr "ìçåúî åðéàù `%s[\"%s\"]' èðîìàì äééðô" -#: array.c:512 +#: array.c:517 #, c-format msgid "subscript of array `%s' is null string" msgstr "`%s' êøòî ïééöîë ä÷éø úæåøçîá ùåîéù" -#: array.c:609 +#: array.c:621 #, c-format msgid "delete: index `%s' not in array `%s'" msgstr "`%s' ïééöî ìéëî åðéà `%s' êøòî :delete" -#: array.c:769 +#: array.c:791 #, c-format msgid "%s: empty (null)\n" msgstr "%s: (ñôåàî) ÷éø\n" -#: array.c:774 +#: array.c:796 #, c-format msgid "%s: empty (zero)\n" msgstr "%s: (ä÷éø hash úìáè) ÷éø\n" -#: array.c:778 +#: array.c:800 #, c-format msgid "%s: table_size = %d, array_size = %d\n" msgstr "%s: table_size = %d, array_size = %d\n" -#: array.c:807 +#: array.c:829 #, c-format msgid "%s: is parameter\n" msgstr "øèîøô åðéä %s\n" -#: array.c:812 +#: array.c:834 #, c-format msgid "%s: array_ref to %s\n" msgstr "%s: %s-ì (array_ref) äéðôä\n" @@ -91,759 +96,780 @@ msgstr " msgid "regexp constant `/%s/' looks like a C comment, but is not" msgstr "äøòä åðéà êà ,C úôùá äøòä åîë äàøð `/%s/' éøìåâø éåèéá" -#: awkgram.y:340 awkgram.y:615 +#: awkgram.y:341 awkgram.y:619 msgid "statement may have no effect" msgstr "úéìëú íåù äéäú àì äæ éåèéáìù ïëúé" -#: awkgram.y:435 awkgram.y:455 +#: awkgram.y:436 awkgram.y:456 #, fuzzy, c-format msgid "`%s' used in %s action" msgstr "END åà BEGIN ìù äìåòô úøãâäá `next'-á ùåîéù" -#: awkgram.y:448 awkgram.y:451 +#: awkgram.y:449 awkgram.y:452 msgid "`nextfile' is a gawk extension" msgstr "gawk-ì úéôéöôñ äáçøä åðéä `nextfile'" -#: awkgram.y:465 +#: awkgram.y:466 msgid "`return' used outside function context" msgstr "äéö÷ðåô ìù èñ÷èðå÷á àìù `return'-á ùåîéù" -#: awkgram.y:504 +#: awkgram.y:508 msgid "plain `print' in BEGIN or END rule should probably be `print \"\"'" msgstr "`print \"\"' úåéäì íúñä ïî êéøö END åà BEGIN éììëá èåùô `print'" -#: awkgram.y:517 awkgram.y:524 +#: awkgram.y:521 awkgram.y:528 msgid "`delete array' is a gawk extension" msgstr "gawk-ì úéôéöôñ äáçøä åðéä `delete array'" -#: awkgram.y:532 awkgram.y:539 +#: awkgram.y:536 awkgram.y:543 #, fuzzy msgid "`delete(array)' is a non-portable tawk extension" msgstr "gawk-ì úéôéöôñ äáçøä åðéä `delete array'" -#: awkgram.y:583 +#: awkgram.y:587 #, c-format msgid "duplicate case values in switch body: %s" msgstr "" -#: awkgram.y:593 +#: awkgram.y:597 msgid "Duplicate `default' detected in switch body" msgstr "" -#: awkgram.y:681 +#: awkgram.y:686 msgid "multistage two-way pipelines don't work" msgstr "íéãáåò íðéà íéáìù éáåøî íééðååéë-åã íé÷éôà" -#: awkgram.y:772 +#: awkgram.y:777 msgid "regular expression on right of assignment" msgstr "êøò úîùä úàøåä ìù ïéîé ãöá éøìåâø éåèéá" -#: awkgram.y:782 +#: awkgram.y:800 msgid "regular expression on left of `~' or `!~' operator" msgstr "`!~' åà `~' øåèøôåàì ìàîùî éøìåâø éåèéá" -#: awkgram.y:790 +#: awkgram.y:808 msgid "regular expression on right of comparison" msgstr "äàååùä ìù ïéîé ãöá éøìåâø éåèéá" -#: awkgram.y:857 +#: awkgram.y:875 msgid "non-redirected `getline' undefined inside END action" msgstr "END úìåòô êåúá øãâåî åðéà äééðôä àìì `getline'" -#: awkgram.y:884 +#: awkgram.y:902 msgid "call of `length' without parentheses is not portable" msgstr "úéìéáèøåô äðéà íééøâåñ àìì `length'-ì äàéø÷" -#: awkgram.y:887 +#: awkgram.y:905 msgid "call of `length' without parentheses is deprecated by POSIX" msgstr "POSIX ï÷úì ãåâéðá äðéä íééøâåñ àìì `length'-ì äàéø÷" -#: awkgram.y:940 +#: awkgram.y:958 msgid "use of non-array as array" msgstr "" -#: awkgram.y:942 +#: awkgram.y:960 msgid "invalid subscript expression" msgstr "êøòî ïééöîá éåâù øéáçú ìòá éåèéá" -#: awkgram.y:1140 +#: awkgram.y:1158 #, fuzzy msgid "unexpected newline or end of string" msgstr "éåôö-éúìá íå÷îá äøåù óåñ" -#: awkgram.y:1235 +#: awkgram.y:1254 msgid "empty program text on command line" msgstr "äãå÷ôä úøåùî äìá÷úä ä÷éø úéðëú" -#: awkgram.y:1292 +#: awkgram.y:1307 #, c-format msgid "can't open source file `%s' for reading (%s)" msgstr "åúàéø÷ íùì `%s' øå÷î õáå÷ úçéúôá (%s) äì÷ú" -#: awkgram.y:1327 +#: awkgram.y:1384 #, c-format msgid "can't read sourcefile `%s' (%s)" msgstr "`%s' øå÷î õáå÷î äàéø÷á (%s) äì÷ú" -#: awkgram.y:1335 +#: awkgram.y:1392 #, c-format msgid "source file `%s' is empty" msgstr "÷éø åðéä `%s' øå÷î õáå÷" -#: awkgram.y:1537 awkgram.y:1647 awkgram.y:1665 awkgram.y:2015 awkgram.y:2100 +#: awkgram.y:1590 awkgram.y:1700 awkgram.y:1718 awkgram.y:2068 awkgram.y:2153 msgid "source file does not end in newline" msgstr "äøåù-óåñ åúá íééúñî åðéà øå÷îä õáå÷" -#: awkgram.y:1601 +#: awkgram.y:1654 msgid "unterminated regexp ends with `\\' at end of file" msgstr "õáå÷ä óñá `\\'-á íééúñî øåîâ-éúìá éøìåâø éåèéá" -#: awkgram.y:1621 +#: awkgram.y:1674 msgid "unterminated regexp" msgstr "øåîâ-éúìá éøìåâø éåèéá" -#: awkgram.y:1624 +#: awkgram.y:1677 msgid "unterminated regexp at end of file" msgstr "õáå÷ä óåñá øåîâ-éúìá éøìåâø éåèéá" -#: awkgram.y:1691 +#: awkgram.y:1744 msgid "use of `\\ #...' line continuation is not portable" msgstr "éìéáèøåô åðéà äøåù êùîäì ïîéñë `\\ #...'-á ùåîéù" -#: awkgram.y:1703 +#: awkgram.y:1756 msgid "backslash not last character on line" msgstr "äøåùá ïåøçà åú åðéàù êåôä ïñëåì" -#: awkgram.y:1748 +#: awkgram.y:1801 msgid "POSIX does not allow operator `**='" msgstr "`**=' øåèøôåà äùøî åðéà POSIX" -#: awkgram.y:1750 +#: awkgram.y:1803 msgid "old awk does not support operator `**='" msgstr "`**=' øåèøôåàá êîåú åðéà ïùé awk" -#: awkgram.y:1759 +#: awkgram.y:1812 msgid "POSIX does not allow operator `**'" msgstr "`**' øåèøôåà äùøî åðéà POSIX" -#: awkgram.y:1761 +#: awkgram.y:1814 msgid "old awk does not support operator `**'" msgstr "`**' øåèøôåàá êîåú åðéà ïùé awk" -#: awkgram.y:1792 +#: awkgram.y:1845 msgid "operator `^=' is not supported in old awk" msgstr "ïùé awk-á êîúð åðéà `^=' øåèøôåà" -#: awkgram.y:1800 +#: awkgram.y:1853 msgid "operator `^' is not supported in old awk" msgstr "ïùé awk-á êîúð åðéà `^' øåèøôåà" -#: awkgram.y:1884 awkgram.y:1901 +#: awkgram.y:1937 awkgram.y:1954 msgid "unterminated string" msgstr "äøåîâ-éúìá úæåøçî" -#: awkgram.y:2061 +#: awkgram.y:2114 #, c-format msgid "invalid char '%c' in expression" msgstr "éåèéáá '%c' éåâù åú" -#: awkgram.y:2121 +#: awkgram.y:2162 #, c-format msgid "`%s' is a gawk extension" msgstr "gawk-ì úéôéöôñ äáçøä äðéä `%s'" -#: awkgram.y:2124 +#: awkgram.y:2165 #, c-format msgid "`%s' is a Bell Labs extension" msgstr "Bell úåãáòî úñøâá awk-ì úéôéöôñ äáçøä åðéä `%s'" -#: awkgram.y:2127 +#: awkgram.y:2168 #, c-format msgid "POSIX does not allow `%s'" msgstr "`%s' äùøî åðéà POSIX" -#: awkgram.y:2131 +#: awkgram.y:2172 #, c-format msgid "`%s' is not supported in old awk" msgstr "ïùé awk-á êîúð åðéà `%s'" -#: awkgram.y:2158 +#: awkgram.y:2198 msgid "`goto' considered harmful!\n" msgstr "!òø-òâô áùçð `goto'\n" -#: awkgram.y:2220 +#: awkgram.y:2260 #, c-format msgid "%d is invalid as number of arguments for %s" msgstr "íéèðîåâøà øôñîë %d ìá÷ì ìåëé åðéà %s" -#: awkgram.y:2239 awkgram.y:2242 +#: awkgram.y:2279 awkgram.y:2282 msgid "match: third argument is a gawk extension" msgstr "gawk-ì úéôéöôñ äáçøä åðéä `match' ìù éùéìù èðîåâøà" -#: awkgram.y:2255 +#: awkgram.y:2295 #, c-format msgid "%s: string literal as last arg of substitute has no effect" msgstr "úéìëú íåù äì ïéà `%s' ìù ïåøçà èðîåâøàë äòåá÷ úæåøçî" -#: awkgram.y:2258 +#: awkgram.y:2298 #, fuzzy, c-format msgid "%s third parameter is not a changeable object" msgstr "éåðéù-øá è÷ééáåà åðéà `sub' ìù éùéìù èðîåâøà" -#: awkgram.y:2285 awkgram.y:2288 +#: awkgram.y:2325 awkgram.y:2328 msgid "close: second argument is a gawk extension" msgstr "gawk-ì úéôéöôñ äáçøä åðéä `close' ìù éðù èðîåâøà" -#: awkgram.y:2298 +#: awkgram.y:2338 msgid "use of dcgettext(_\"...\") is incorrect: remove leading underscore" msgstr "èðîåâøà úîã÷áù ïåúçú-ó÷î ÷ìñì ùé :dcgettext(_\"...\")-á éåâù ùåîéù" -#: awkgram.y:2313 +#: awkgram.y:2353 msgid "use of dcngettext(_\"...\") is incorrect: remove leading underscore" msgstr "èðîåâøà úîã÷áù ïåúçú-ó÷î ÷ìñì ùé :dncgettext(_\"...\")-á éåâù ùåîéù" -#: awkgram.y:2384 +#: awkgram.y:2424 #, c-format msgid "function `%s': parameter #%d, `%s', duplicates parameter #%d" msgstr "`%s' äéö÷ðåôá %d 'ñî øèîøôì ääæ ,`%s' ,%d 'ñî øèîøô ìù åîù" -#: awkgram.y:2417 +#: awkgram.y:2457 #, c-format msgid "function `%s': parameter `%s' shadows global variable" msgstr "éìáåìâ äðúùî ìò ìéôàî `%s' äéö÷ðåôá `%s' øèîøô" -#: awkgram.y:2529 +#: awkgram.y:2569 #, c-format msgid "could not open `%s' for writing (%s)" msgstr "äáéúë íùì `%s' úçéúôá (%s) äì÷ú" -#: awkgram.y:2530 profile.c:93 +#: awkgram.y:2570 profile.c:93 msgid "sending profile to standard error" msgstr "éð÷ú úåàéâù õåøòì çìùð òåöéá ìéôåøô" -#: awkgram.y:2562 +#: awkgram.y:2602 #, c-format msgid "%s: close failed (%s)" msgstr "`%s' úøéâñ úòá (%s) äì÷ú" -#: awkgram.y:2684 +#: awkgram.y:2723 msgid "shadow_funcs() called twice!" msgstr "!íééîòô äàø÷ð shadow_funcs()" -#: awkgram.y:2711 +#: awkgram.y:2750 msgid "there were shadowed variables." msgstr "" -#: awkgram.y:2784 +#: awkgram.y:2823 #, c-format msgid "function `%s': can't use function name as parameter name" msgstr "øèîøô íùë ùîùì ìåëé åðéà äéö÷ðåô íù :`%s' äéö÷ðåôá" -#: awkgram.y:2794 +#: awkgram.y:2833 #, c-format msgid "function name `%s' previously defined" msgstr "úøãâåî øáë `%s' íùá äéö÷ðåô" -#: awkgram.y:2945 awkgram.y:2951 +#: awkgram.y:2984 awkgram.y:2990 #, c-format msgid "function `%s' called but never defined" msgstr "úøãâåî äðéàù `%s' äéö÷ðåôì äàéø÷" -#: awkgram.y:2954 +#: awkgram.y:2993 #, c-format msgid "function `%s' defined but never called" msgstr "úàø÷ð àì êà ,äøãâåä `%s' äéö÷ðåô" -#: awkgram.y:2981 +#: awkgram.y:3020 #, c-format msgid "regexp constant for parameter #%d yields boolean value" msgstr "éðàéìåá êøò áéðî %d 'ñî øèîøôë òåá÷ éøìåâø éåèéá" -#: awkgram.y:2994 -#, c-format +#: awkgram.y:3033 +#, fuzzy, c-format msgid "" "function `%s' called with space between name and `(',\n" -"%s" +"or used as a variable or an array" msgstr "" ",`(' ïéáì äîù ïéá íéçååø íò `%s' äéö÷ðåôì äàéø÷\n" "%s" -#: awkgram.y:2996 -#, fuzzy -msgid "or used as a variable or an array" -msgstr "êøòî åà äðúùîë `%s' äéö÷ðåô íùá ùîúùäì ïéà" - -#: builtin.c:137 +#: builtin.c:149 #, c-format msgid "%s to \"%s\" failed (%s)" msgstr "%s é\"ò \"%s\"-ì äáéúëá (%s) äì÷ú" -#: builtin.c:138 +#: builtin.c:150 msgid "standard output" msgstr "úéèøãðèñ èìô úãéçé" -#: builtin.c:139 +#: builtin.c:151 msgid "reason unknown" msgstr "äòåãé-éúìá äáéñî" -#: builtin.c:152 +#: builtin.c:164 msgid "exp: received non-numeric argument" msgstr "øôñî åðéà èðîåâøà :exp" -#: builtin.c:158 +#: builtin.c:170 #, c-format msgid "exp: argument %g is out of range" msgstr "øúåîä íåçúá åðéà %g èðîåâøà :exp" -#: builtin.c:216 +#: builtin.c:228 #, c-format msgid "fflush: cannot flush: pipe `%s' opened for reading, not writing" msgstr "äáéúëì àì ,äàéø÷ì çåúô `%s' ÷éôà :õöåçä ï÷åøì ïúéð àì :fflush" -#: builtin.c:219 +#: builtin.c:231 #, c-format msgid "fflush: cannot flush: file `%s' opened for reading, not writing" msgstr "äáéúëì àì ,äàéø÷ì çåúô `%s' õáå÷ :õöåçä ï÷åøì ïúéð àì :fflush" -#: builtin.c:231 +#: builtin.c:243 #, c-format msgid "fflush: `%s' is not an open file, pipe or co-process" msgstr "ìéá÷î êéìäú åà çåúô ÷éôà ,çåúô õáå÷ åðéà `%s' :fflush" -#: builtin.c:325 +#: builtin.c:338 msgid "index: received non-string first argument" msgstr "úæåøçî åðéà ïåùàø èðîåâøà :index" -#: builtin.c:327 +#: builtin.c:340 msgid "index: received non-string second argument" msgstr "úæåøçî åðéà éðù èðîåâøà :index" -#: builtin.c:437 +#: builtin.c:454 msgid "int: received non-numeric argument" msgstr "øôñî åðéà èðîåâøà :int" -#: builtin.c:454 +#: builtin.c:471 msgid "length: received non-string argument" msgstr "úæåøçî åðéà èðîåâøà :length" -#: builtin.c:470 +#: builtin.c:487 msgid "log: received non-numeric argument" msgstr "øôñî åðéà èðîåâøà :log" -#: builtin.c:473 +#: builtin.c:490 #, c-format msgid "log: received negative argument %g" msgstr "%g éìéìù èðîåâøà íò àø÷ð :log" -#: builtin.c:635 builtin.c:638 +#: builtin.c:654 builtin.c:657 msgid "must use `count$' on all formats or none" msgstr "ãçà óàá åà íéèîøåôä ìëá åà øúåî `count$'-á ùåîéù" -#: builtin.c:740 +#: builtin.c:759 msgid "`$' is not permitted in awk formats" msgstr "awk ìù íéèîøåôá ùåîéùì øåñà `$'" -#: builtin.c:746 +#: builtin.c:765 msgid "arg count with `$' must be > 0" msgstr "0-î ìåãâ úåéäì áééç `$' ãéì èðîåâøàä äðåî" -#: builtin.c:748 +#: builtin.c:767 #, fuzzy, c-format msgid "arg count %ld greater than total number of supplied arguments" msgstr "íéèðîåâøàä ìù ììåëä íøôñîî ìåãâ %d èðîåâøàä äðåî" -#: builtin.c:750 +#: builtin.c:769 msgid "`$' not permitted after period in format" msgstr "èîøåôá äãå÷ðä éøçà òéôåäì ìåëé åðéà `$'" -#: builtin.c:763 +#: builtin.c:782 msgid "no `$' supplied for positional field width or precision" msgstr "å÷åéã åà äãù áçåø ïééöîá èðîåâøàä äðåî øåáò `$' àöîð àì" -#: builtin.c:821 +#: builtin.c:848 msgid "`l' is meaningless in awk formats; ignored" msgstr "çðæåä ;awk ìù èîøåôá úåòîùî øñç åðéä `l'" -#: builtin.c:825 +#: builtin.c:852 msgid "`l' is not permitted in POSIX awk formats" msgstr "POSIX éô-ìò awk ìù èîøåôá òéôåäì ìåëé åðéà `l'" -#: builtin.c:836 +#: builtin.c:863 msgid "`L' is meaningless in awk formats; ignored" msgstr "çðæåä ;awk ìù èîøåôá úåòîùî øñç åðéä `L'" -#: builtin.c:840 +#: builtin.c:867 msgid "`L' is not permitted in POSIX awk formats" msgstr "POSIX éô-ìò awk ìù èîøåôá òéôåäì ìåëé åðéà `L'" -#: builtin.c:851 +#: builtin.c:878 msgid "`h' is meaningless in awk formats; ignored" msgstr "çðæåä ;awk ìù èîøåôá úåòîùî øñç åðéä `h'" -#: builtin.c:855 +#: builtin.c:882 msgid "`h' is not permitted in POSIX awk formats" msgstr "POSIX éô-ìò awk ìù èîøåôá òéôåäì ìåëé åðéà `h'" -#: builtin.c:1055 +#: builtin.c:1111 #, c-format msgid "[s]printf: value %g is out of range for `%%%c' format" msgstr "" -#: builtin.c:1108 +#: builtin.c:1171 msgid "not enough arguments to satisfy format string" msgstr "èîøåôä øåáò íéèðîåâøà ÷éôñî ïéà" -#: builtin.c:1110 +#: builtin.c:1173 msgid "^ ran out for this one" msgstr "^ íéèðîåâøàä éì åøîâð ïàë" -#: builtin.c:1115 +#: builtin.c:1178 msgid "[s]printf: format specifier does not have control letter" msgstr "äøîää úø÷á úåà ìéëî åðéà èîøåôä :[s]printf" -#: builtin.c:1118 +#: builtin.c:1181 msgid "too many arguments supplied for format string" msgstr "èîøåôä øåáò íéèðîåâøà éãî øúåé" -#: builtin.c:1184 builtin.c:1187 +#: builtin.c:1247 builtin.c:1250 msgid "printf: no arguments" msgstr "èðîåâøà óà ïéà :printf" -#: builtin.c:1211 +#: builtin.c:1274 msgid "sqrt: received non-numeric argument" msgstr "øôñî åðéà èðîåâøà :sqrt" -#: builtin.c:1215 +#: builtin.c:1278 #, c-format msgid "sqrt: called with negative argument %g" msgstr "%g éìéìù èðîåâøà íò àø÷ð :sqrt" -#: builtin.c:1238 +#: builtin.c:1301 #, c-format msgid "substr: start index %g is invalid, using 1" msgstr "1-á óìçåä ,éåâù åðéä %g äìçúä ïééöî :substr" -#: builtin.c:1243 +#: builtin.c:1306 #, c-format msgid "substr: non-integer start index %g will be truncated" msgstr "õöå÷é ,íìù øôñî åðéàù, %g äìçúä ïééöî ìù åëøò :substr" -#: builtin.c:1262 +#: builtin.c:1325 #, fuzzy, c-format msgid "substr: length %g is not >= 1" msgstr "0-î ìåãâ øôñî åððéà %g êøåà :substr" -#: builtin.c:1264 +#: builtin.c:1327 #, fuzzy, c-format msgid "substr: length %g is not >= 0" msgstr "0-î ìåãâ øôñî åððéà %g êøåà :substr" -#: builtin.c:1271 +#: builtin.c:1334 #, c-format msgid "substr: non-integer length %g will be truncated" msgstr "õöå÷é ,íìù øôñî åðéàù ,%g êøåà :substr" -#: builtin.c:1276 +#: builtin.c:1339 #, c-format msgid "substr: length %g too big for string indexing, truncating to %g" msgstr "" -#: builtin.c:1288 +#: builtin.c:1351 msgid "substr: source string is zero length" msgstr "ñôà êøåàá äðéä øå÷îä úæåøçî :substr" -#: builtin.c:1294 +#: builtin.c:1357 #, fuzzy, c-format msgid "substr: start index %g is past end of string" msgstr "úæåøçîä óåñì øáòî åðéä %d äìçúä ïééöî :substr" -#: builtin.c:1302 +#: builtin.c:1365 #, fuzzy, c-format msgid "" "substr: length %g at start index %g exceeds length of first argument (%lu)" msgstr "" "%d äëøåàå %d ïééöîá äúìéçúù úæåøçî-úúì ÷éôñî åðéà (%d) úæåøçî êøåà :substr" -#: builtin.c:1337 +#: builtin.c:1400 msgid "strftime: received non-string first argument" msgstr "úæåøçî åðéà ïåùàø èðîåâøà :strftime" -#: builtin.c:1343 +#: builtin.c:1406 msgid "strftime: received empty format string" msgstr "ä÷éø èîøåô úæåøçî :strftime" -#: builtin.c:1352 +#: builtin.c:1415 msgid "strftime: received non-numeric second argument" msgstr "øôñî åðéà éðù èðîåâøà :strftime" -#: builtin.c:1415 +#: builtin.c:1478 msgid "mktime: received non-string argument" msgstr "úæåøçî åðéà èðîåâøà :mktime" -#: builtin.c:1460 +#: builtin.c:1523 msgid "system: received non-string argument" msgstr "úæåøçî åðéà èðîåâøà :system" -#: builtin.c:1581 eval.c:1883 +#: builtin.c:1644 eval.c:2019 #, fuzzy, c-format msgid "reference to uninitialized field `$%d'" msgstr "`%s' ìçåúî-éúìá äðúùîì äéðôä" -#: builtin.c:1608 +#: builtin.c:1671 msgid "tolower: received non-string argument" msgstr "úæåøçî åðéà èðîåâøà :tolower" -#: builtin.c:1657 +#: builtin.c:1720 msgid "toupper: received non-string argument" msgstr "úæåøçî åðéà èðîåâøà :toupper" -#: builtin.c:1702 +#: builtin.c:1765 msgid "atan2: received non-numeric first argument" msgstr "øôñî åðéà ïåùàø èðîåâøà :atan2" -#: builtin.c:1704 +#: builtin.c:1767 msgid "atan2: received non-numeric second argument" msgstr "øôñî åðéà éðù èðîåâøà :atan2" -#: builtin.c:1723 +#: builtin.c:1786 msgid "sin: received non-numeric argument" msgstr "øôñî åðéà èðîåâøà :sin" -#: builtin.c:1739 +#: builtin.c:1802 msgid "cos: received non-numeric argument" msgstr "øôñî åðéà èðîåâøà :cos" -#: builtin.c:1788 +#: builtin.c:1852 msgid "srand: received non-numeric argument" msgstr "øôñî åðéà èðîåâøà :srand" -#: builtin.c:1823 +#: builtin.c:1887 msgid "match: third argument is not an array" msgstr "êøòî åðéà éùéìù èðîåâøà :match" -#: builtin.c:2307 +#: builtin.c:2414 msgid "gensub: third argument of 0 treated as 1" msgstr "1-á óìçåä 0 åëøòù éùéìù èðîåâøà :gensub" -#: builtin.c:2416 builtin.c:2418 +#: builtin.c:2572 msgid "lshift: received non-numeric first argument" msgstr "øôñî åðéà ïåùàø èðîåâøà :lshift" -#: builtin.c:2420 +#: builtin.c:2574 +#, fuzzy +msgid "lshift: received non-numeric second argument" +msgstr "øôñî åðéà éðù èðîåâøà :strftime" + +#: builtin.c:2580 #, c-format msgid "lshift(%lf, %lf): negative values will give strange results" msgstr "úåéåôö-éúìá úåàöåú åáéðé íééìéìù íéëøò :lshift(%lf, %lf)" -#: builtin.c:2422 +#: builtin.c:2582 #, c-format msgid "lshift(%lf, %lf): fractional values will be truncated" msgstr "åööå÷é íéøåáù íéëøò :lshift(%lf, %lf)" -#: builtin.c:2424 +#: builtin.c:2584 #, c-format msgid "lshift(%lf, %lf): too large shift value will give strange results" msgstr "úåéåôö-éúìá úåàöåú áéðé éãî ìåãâ äææä øåòéù :lshift(%lf, %lf)" -#: builtin.c:2453 builtin.c:2455 +#: builtin.c:2610 msgid "rshift: received non-numeric first argument" msgstr "øôñî åðéà ïåùàø èðîåâøà :rshift" -#: builtin.c:2457 +#: builtin.c:2612 +#, fuzzy +msgid "rshift: received non-numeric second argument" +msgstr "øôñî åðéà éðù èðîåâøà :strftime" + +#: builtin.c:2618 #, c-format msgid "rshift(%lf, %lf): negative values will give strange results" msgstr "úåéåôö-éúìá úåàöåú åáéðé íééìéìù íéëøò :rshift(%lf, %lf)" -#: builtin.c:2459 +#: builtin.c:2620 #, c-format msgid "rshift(%lf, %lf): fractional values will be truncated" msgstr "åööå÷é íéøåáù íéëøò :rshift(%lf, %lf)" -#: builtin.c:2461 +#: builtin.c:2622 #, c-format msgid "rshift(%lf, %lf): too large shift value will give strange results" msgstr "úåéåôö-éúìá úåàöåú áéðé éãî ìåãâ äææä øåòéù :rshift(%lf, %lf)" -#: builtin.c:2490 builtin.c:2492 +#: builtin.c:2648 msgid "and: received non-numeric first argument" msgstr "øôñî åðéà ïåùàø èðîåâøà :and" -#: builtin.c:2494 +#: builtin.c:2650 +#, fuzzy +msgid "and: received non-numeric second argument" +msgstr "øôñî åðéà éðù èðîåâøà :atan2" + +#: builtin.c:2656 #, c-format msgid "and(%lf, %lf): negative values will give strange results" msgstr "úåéåôö-éúìá úåàöåú åáéðé íééìéìù íéëøò :and(%lf, %lf)" -#: builtin.c:2496 +#: builtin.c:2658 #, c-format msgid "and(%lf, %lf): fractional values will be truncated" msgstr "åööå÷é íéøåáù íéëøò :and(%lf, %lf)" -#: builtin.c:2525 builtin.c:2527 +#: builtin.c:2684 msgid "or: received non-numeric first argument" msgstr "øôñî åðéà ïåùàø èðîåâøà :or" -#: builtin.c:2529 +#: builtin.c:2686 +#, fuzzy +msgid "or: received non-numeric second argument" +msgstr "øôñî åðéà éðù èðîåâøà :atan2" + +#: builtin.c:2692 #, c-format msgid "or(%lf, %lf): negative values will give strange results" msgstr "úåéåôö-éúìá úåàöåú åáéðé íééìéìù íéëøò :or(%lf, %lf)" -#: builtin.c:2531 +#: builtin.c:2694 #, c-format msgid "or(%lf, %lf): fractional values will be truncated" msgstr "åööå÷é íéøåáù íéëøò :or(%lf, %lf)" -#: builtin.c:2560 builtin.c:2562 +#: builtin.c:2720 msgid "xor: received non-numeric first argument" msgstr "øôñî åðéà ïåùàø èðîåâøà :xor" -#: builtin.c:2564 +#: builtin.c:2722 +#, fuzzy +msgid "xor: received non-numeric second argument" +msgstr "øôñî åðéà éðù èðîåâøà :atan2" + +#: builtin.c:2728 #, c-format msgid "xor(%lf, %lf): negative values will give strange results" msgstr "úåéåôö-éúìá úåàöåú åáéðé íééìéìù íéëøò :xor(%lf, %lf)" -#: builtin.c:2566 +#: builtin.c:2730 #, c-format msgid "xor(%lf, %lf): fractional values will be truncated" msgstr "åööå÷é íéøåáù íéëøò :xor(%lf, %lf)" -#: builtin.c:2594 +#: builtin.c:2754 msgid "compl: received non-numeric argument" msgstr "øôñî åðéà èðîåâøà :compl" -#: builtin.c:2596 +#: builtin.c:2760 #, c-format msgid "compl(%lf): negative value will give strange results" msgstr "úåéåôö-éúìá úåàöåú áéðé éìéìù êøò :compl(%lf)" -#: builtin.c:2598 +#: builtin.c:2762 #, c-format msgid "compl(%lf): fractional value will be truncated" msgstr "õöå÷é øåáù êøò :compl(%lf)" -#: builtin.c:2771 +#: builtin.c:2935 #, c-format msgid "dcgettext: `%s' is not a valid locale category" msgstr "äðé÷ú íå÷éî úééøåâè÷ åðéà `%s' :dcgettext" -#: eval.c:266 +#: eval.c:303 #, c-format msgid "unknown nodetype %d" msgstr "%d ääåæî-éúìá âåñ ìòá node" -#: eval.c:312 +#: eval.c:350 msgid "buffer overflow in genflags2str" msgstr "genflags2str-á õöåç úùéìâ" -#: eval.c:647 +#: eval.c:382 eval.c:388 profile.c:837 +#, c-format +msgid "attempt to use array `%s' in a scalar context" +msgstr "øàì÷ñ ùøåãä èñ÷èðå÷á `%s' êøòîá ùåîéù ïåéñð" + +#: eval.c:730 #, fuzzy, c-format msgid "for loop: array `%s' changed size from %ld to %ld during loop execution" msgstr "(`%s' êøòî) äàìåìä òåöéá êìäîá %d-î %d-ì äðåù êøòî ìù åìãåâ :for úàìåì" -#: eval.c:668 +#: eval.c:751 msgid "`break' outside a loop is not portable" msgstr "éìéáèøåô åðéà äàìåìì õåçî `break'" -#: eval.c:672 +#: eval.c:755 msgid "`break' outside a loop is not allowed" msgstr "äàìåìì õåçî `break'-á ùîúùäì ïéà" -#: eval.c:689 +#: eval.c:772 msgid "`continue' outside a loop is not portable" msgstr "éìéáèøåô åðéà äàìåìì õåçî `continue'" -#: eval.c:693 +#: eval.c:776 msgid "`continue' outside a loop is not allowed" msgstr "äàìåìì õåçî `continue'-á ùîúùäì ïéà" -#: eval.c:727 +#: eval.c:810 msgid "`next' cannot be called from a BEGIN rule" msgstr "BEGIN éììë êåúî `next'-ì àåø÷ì ïéà" -#: eval.c:729 +#: eval.c:812 msgid "`next' cannot be called from an END rule" msgstr "END éììë êåúî `next'-ì àåø÷ì ïéà" -#: eval.c:738 +#: eval.c:821 msgid "`nextfile' cannot be called from a BEGIN rule" msgstr "BEGIN éììë êåúî `nextfile'-ì àåø÷ì ïéà" -#: eval.c:740 +#: eval.c:823 msgid "`nextfile' cannot be called from an END rule" msgstr "END éììë êåúî `nextfile'-ì àåø÷ì ïéà" -#: eval.c:785 +#: eval.c:872 msgid "statement has no effect" msgstr "úéìëú-úìåèð äàøåä" -#: eval.c:828 eval.c:1726 +#: eval.c:915 eval.c:1873 #, c-format msgid "can't use function name `%s' as variable or array" msgstr "êøòî åà äðúùîë `%s' äéö÷ðåô íùá ùîúùäì ïéà" -#: eval.c:835 eval.c:841 +#: eval.c:922 eval.c:928 #, c-format msgid "reference to uninitialized argument `%s'" msgstr "`%s' ìçåúî-éúìá èðîåâøàì äéðôä" -#: eval.c:848 eval.c:907 eval.c:1732 eval.c:1742 profile.c:807 -#, c-format -msgid "attempt to use array `%s' in a scalar context" -msgstr "øàì÷ñ ùøåãä èñ÷èðå÷á `%s' êøòîá ùåîéù ïåéñð" - -#: eval.c:858 eval.c:1752 +#: eval.c:937 eval.c:1882 #, c-format msgid "reference to uninitialized variable `%s'" msgstr "`%s' ìçåúî-éúìá äðúùîì äéðôä" -#: eval.c:1007 +#: eval.c:1083 msgid "" "concatenation: side effects in one expression have changed the length of " "another!" msgstr "" "!øçà éåèéá ìù åëøåà éåðéùì åîøâ ãçà éåèéá áåùéç ìù éàåì-úåòôåú :concatenation" -#: eval.c:1032 +#: eval.c:1162 msgid "assignment used in conditional context" msgstr "éàðú ìù èñ÷èðå÷á äîùäá ùåîéù" -#: eval.c:1122 +#: eval.c:1252 msgid "division by zero attempted" msgstr "ñôàá ä÷åìç ïåéñð" -#: eval.c:1137 +#: eval.c:1267 #, c-format msgid "division by zero attempted in `%%'" msgstr "`%%'-á ñôàá ä÷åìç ïåéñð" -#: eval.c:1152 profile.c:683 +#: eval.c:1282 profile.c:713 #, c-format msgid "illegal type (%s) in tree_eval" msgstr "tree_eval-á (%s) éåâù âåñ" -#: eval.c:1328 +#: eval.c:1459 msgid "division by zero attempted in `/='" msgstr "`/='-á ñôàá ä÷åìç ïåéñð" -#: eval.c:1346 +#: eval.c:1477 #, c-format msgid "division by zero attempted in `%%='" msgstr "`%%='-á ñôàá ä÷åìç ïåéñð" -#: eval.c:1586 +#: eval.c:1738 #, c-format msgid "function `%s' called with more arguments than declared" msgstr "äúæøëäá øùàî íéèðîåâøà øúåé íò `%s' äéö÷ðåôì äàéø÷" -#: eval.c:1633 +#: eval.c:1782 #, c-format msgid "function `%s' not defined" msgstr "úøãâåî äðéà `%s' äéö÷ðåô" -#: eval.c:1639 +#: eval.c:1788 #, c-format msgid "function %s called\n" msgstr "`%s' äéö÷ðåôì äàéø÷\n" -#: eval.c:1698 +#: eval.c:1845 +#, c-format msgid "" "\n" "\t# Function Call Stack:\n" @@ -853,41 +879,42 @@ msgstr "" "\t# :úåéö÷ðåôì úåàéø÷ä úéðñçî\n" "\n" -#: eval.c:1701 +#: eval.c:1848 +#, c-format msgid "\t# -- main --\n" msgstr "\t# -- main --\n" -#: eval.c:1867 +#: eval.c:2003 msgid "attempt to field reference from non-numeric value" msgstr "øôñî åðéàù êøò úåòöîàá äãùì äéðôä ïåéñð" -#: eval.c:1869 +#: eval.c:2005 msgid "attempt to reference from null string" msgstr "ä÷éø úæåøçî úåòöîàá äãùì äéðôä ïåéñð" -#: eval.c:1875 +#: eval.c:2011 #, c-format msgid "attempt to access field %d" msgstr "%d 'ñî äãùì äùéâ ïåéñð" -#: eval.c:1896 eval.c:1903 profile.c:900 +#: eval.c:2032 eval.c:2039 profile.c:934 msgid "assignment is not allowed to result of builtin function" msgstr "úéðáåî äéö÷ðåô ìù äàöåúá êøò áéöäì ïéà" -#: eval.c:1951 +#: eval.c:2103 msgid "`IGNORECASE' is a gawk extension" msgstr "gawk-ì úéôéöôñ äáçøä åðéä `IGNORECASE'" -#: eval.c:1980 +#: eval.c:2133 msgid "`BINMODE' is a gawk extension" msgstr "gawk-ì úéôéöôñ äáçøä åðéä `BINMODE'" -#: eval.c:2092 +#: eval.c:2255 #, c-format msgid "bad `%sFMT' specification `%s'" msgstr "äðé÷ú `%sFMT' úøãâä åðéà `%s'" -#: eval.c:2170 +#: eval.c:2333 msgid "turning off `--lint' due to assignment to `LINT'" msgstr "`LINT'-ì êøò úîùä á÷ò `--lint' ìèáî" @@ -905,7 +932,56 @@ msgstr "`%s' msgid "extension: library `%s': cannot call function `%s' (%s)\n" msgstr "`%s' äéøôñî `%s' äéö÷ðåôì äàéø÷á (%s) äì÷ú äòøéà :extension\n" -#: ext.c:183 +#: ext.c:102 +msgid "extension: missing function name" +msgstr "" + +#: ext.c:107 +#, fuzzy, c-format +msgid "extension: illegal character `%c' in function name `%s'" +msgstr "`%s' äéøôñî `%s' äéö÷ðåôì äàéø÷á (%s) äì÷ú äòøéà :extension\n" + +#: ext.c:113 +#, fuzzy, c-format +msgid "extension: can't redefine function `%s'" +msgstr "`%s' úçéúô úòá (%s) äì÷ú äòøéà :extension\n" + +#: ext.c:117 +#, fuzzy, c-format +msgid "extension: function `%s' already defined" +msgstr "úøãâåî äðéà `%s' äéö÷ðåô" + +#: ext.c:122 +#, c-format +msgid "extension: can't use gawk built-in `%s' as function name" +msgstr "" + +#: ext.c:124 +#, fuzzy, c-format +msgid "extension: function name `%s' previously defined" +msgstr "úøãâåî øáë `%s' íùá äéö÷ðåô" + +#: ext.c:201 +#, c-format +msgid "function `%s' defined to take no more than `%d' argument(s)" +msgstr "" + +#: ext.c:204 +#, fuzzy, c-format +msgid "function `%s': missing argument #%d" +msgstr "úøãâåî äðéà `%s' äéö÷ðåô" + +#: ext.c:214 +#, fuzzy, c-format +msgid "function `%s': argument #%d: attempt to use scalar as an array" +msgstr "êøòîë `%s' øàì÷ñá éåâù ùåîéù" + +#: ext.c:218 +#, c-format +msgid "function `%s': argument #%d: attempt to use array as a scalar" +msgstr "" + +#: ext.c:243 msgid "Operation Not Supported" msgstr "úëîúð äðéà åæ äìåòô" @@ -936,523 +1012,523 @@ msgstr "gawk- # The way the leading "%s:" is translated is a terrible kludge, # but what can I do? FIXME. -#: getopt.c:692 getopt.c:704 +#: getopt.c:692 getopt.c:711 #, c-format msgid "%s: option `%s' is ambiguous\n" msgstr "%s úéðëú øåáò éòîùî-ãç åðéà `%s' ïééôàî\n" -#: getopt.c:737 getopt.c:741 +#: getopt.c:744 getopt.c:748 #, c-format msgid "%s: option `--%s' doesn't allow an argument\n" msgstr "%s úéðëú øåáò èðîåâøà ìá÷î åðéà `--%s' ïééôàî\n" -#: getopt.c:750 getopt.c:755 +#: getopt.c:757 getopt.c:762 #, c-format msgid "%s: option `%c%s' doesn't allow an argument\n" msgstr "%s úéðëú øåáò èðîåâøà ìá÷î åðéà `%c%s' ïééôàî\n" -#: getopt.c:791 getopt.c:804 getopt.c:1093 getopt.c:1106 +#: getopt.c:807 getopt.c:829 getopt.c:1159 getopt.c:1181 #, c-format msgid "%s: option `%s' requires an argument\n" msgstr "%s úéðëú øåáò èðîåâøà áééçî `%s' ïééôàî\n" -#: getopt.c:842 getopt.c:845 +#: getopt.c:867 getopt.c:870 #, c-format msgid "%s: unrecognized option `--%s'\n" msgstr "%s úéðëú øåáò `--%s' ääåæî-éúìá ïééôàî\n" -#: getopt.c:853 getopt.c:856 +#: getopt.c:878 getopt.c:881 #, c-format msgid "%s: unrecognized option `%c%s'\n" msgstr "%s úéðëú øåáò `%c%s' ääåæî-éúìá ïééôàî\n" # "Illegal" is against GNU coding standards, but since Posix requires # it (see the comment below), let's say that in Hebrew as well... -#: getopt.c:903 getopt.c:906 +#: getopt.c:936 getopt.c:939 #, c-format msgid "%s: illegal option -- %c\n" msgstr "%s: é÷åç-éúìá ïééôàî -- %c\n" -#: getopt.c:912 getopt.c:915 +#: getopt.c:945 getopt.c:948 #, c-format msgid "%s: invalid option -- %c\n" msgstr "%s úéðëú øåáò éåâù ïééôàî -- %c\n" -#: getopt.c:962 getopt.c:973 getopt.c:1159 getopt.c:1172 main.c:434 +#: getopt.c:1003 getopt.c:1022 getopt.c:1234 getopt.c:1255 main.c:433 #, c-format msgid "%s: option requires an argument -- %c\n" msgstr "%s: èðîåâøà áééçî ïééôàî -- %c\n" -#: getopt.c:1025 getopt.c:1036 +#: getopt.c:1074 getopt.c:1093 #, c-format msgid "%s: option `-W %s' is ambiguous\n" msgstr "%s úéðëú øåáò éòîùî-ãç åðéà `-W %s' ïééôàî\n" -#: getopt.c:1060 getopt.c:1072 +#: getopt.c:1117 getopt.c:1138 #, c-format msgid "%s: option `-W %s' doesn't allow an argument\n" msgstr "%s úéðëú øåáò èðîåâøà ìá÷î åðéà `-W %s' ïééôàî\n" -#: io.c:305 +#: io.c:308 #, c-format msgid "cannot open file `%s' for reading (%s)" msgstr "åúàéø÷ íùì `%s' õáå÷ úçéúôá (%s) äì÷ú" -#: io.c:392 +#: io.c:395 #, c-format msgid "close of fd %d (`%s') failed (%s)" msgstr "(%d èìô/èì÷ õåøò) `%s' úøéâñá (%s) äì÷ú" -#: io.c:530 +#: io.c:533 #, c-format msgid "invalid tree type %s in redirect()" msgstr "redirect() äéö÷ðåôá %s éåâù õò âåñ" -#: io.c:536 +#: io.c:539 #, c-format msgid "expression in `%s' redirection only has numeric value" msgstr "ãáìá éøîåð êøò áéðî `%s' èìô/èì÷ úééðôäá éåèéá" -#: io.c:542 +#: io.c:545 #, c-format msgid "expression for `%s' redirection has null string value" msgstr "ä÷éø úæåøçî áéðî `%s' èìô/èì÷ úééðôäá éåèéá" -#: io.c:547 +#: io.c:550 #, c-format msgid "filename `%s' for `%s' redirection may be result of logical expression" msgstr "éâåì éåèéá ìù äàöåú úåéäì ìåìò `%s' õáå÷ íù `%s' èìô/èì÷ úééðôäá" -#: io.c:569 +#: io.c:588 #, c-format msgid "unnecessary mixing of `>' and `>>' for file `%.*s'" msgstr "`%.*s' õáå÷ øåáò `>>'-á ïäå `>'-á ïä øúåéî ùåîéù" -#: io.c:621 +#: io.c:640 #, c-format msgid "can't open pipe `%s' for output (%s)" msgstr "èìô êøåöì `%s' ÷éôà úçéúôá (%s) äì÷ú" -#: io.c:630 +#: io.c:649 #, c-format msgid "can't open pipe `%s' for input (%s)" msgstr "èì÷ êøåöì `%s' ÷éôà úçéúôá (%s) äì÷ú" -#: io.c:643 +#: io.c:662 #, c-format msgid "can't open two way socket `%s' for input/output (%s)" msgstr "èìô/èì÷ êøåöì éðååéë-åã (socket) ò÷ùë `%s' úçéúôá (%s) äì÷ú" -#: io.c:647 +#: io.c:666 #, c-format msgid "can't open two way pipe `%s' for input/output (%s)" msgstr "èìô/èì÷ êøåöì éðååéë-åã (pipe) ÷éôàë `%s' úçéúôá (%s) äì÷ú" -#: io.c:723 +#: io.c:742 #, c-format msgid "can't redirect from `%s' (%s)" msgstr "`%s'-î äééðôäá (%s) äì÷ú" -#: io.c:726 +#: io.c:745 #, c-format msgid "can't redirect to `%s' (%s)" msgstr "`%s' ìà äééðôäá (%s) äì÷ú" -#: io.c:765 +#: io.c:784 msgid "" "reached system limit for open files: starting to multiplex file descriptors" msgstr "èìô/èì÷ éöåøò áåáéø úìéçú ;íéçåúô íéöá÷ øôñî ìù úëøòî úìáâîì äòâä" -#: io.c:777 +#: io.c:800 #, c-format msgid "close of `%s' failed (%s)." msgstr "`%s' úøéâñá (%s) äì÷ú" -#: io.c:784 +#: io.c:808 msgid "too many pipes or input files open" msgstr "úéðîæ-åá íéçåúô èì÷ éöá÷ åà (pipes) íé÷éôà éãî øúåé" -#: io.c:807 +#: io.c:831 msgid "close: second argument must be `to' or `from'" msgstr "`from' åà `to' úåéäì áééç `close' ìù éðùä èðîåâøàä" -#: io.c:821 +#: io.c:845 #, c-format msgid "close: `%.*s' is not an open file, pipe or co-process" msgstr "ìéá÷î êéìäú åà çåúô ÷éôà ,çåúô õáå÷ åðéà `%.*s' :close" -#: io.c:825 +#: io.c:849 msgid "close of redirection that was never opened" msgstr "íìåòî äçúôð àìù äééðôä úøéâñ" -#: io.c:862 +#: io.c:945 #, c-format msgid "close: redirection `%s' not opened with `|&', second argument ignored" msgstr "çðæåä éðùä èðîåâøàä ,`|&' é\"ò äçúôð àì `%s' äééðôä" -#: io.c:924 +#: io.c:960 #, c-format msgid "failure status (%d) on pipe close of `%s' (%s)" msgstr "(%d äì÷ú ãå÷) `%s'-ì ÷éôà úøéâñá (%s) äì÷ú" -#: io.c:927 +#: io.c:963 #, c-format msgid "failure status (%d) on file close of `%s' (%s)" msgstr "(%d äì÷ú ãå÷) `%s' õáå÷ úøéâñá (%s) äì÷ú" -#: io.c:946 +#: io.c:983 #, c-format msgid "no explicit close of socket `%s' provided" msgstr "ùøåôîá øâñð àì (socket) `%s' ò÷ù" -#: io.c:949 +#: io.c:986 #, c-format msgid "no explicit close of co-process `%s' provided" msgstr "ùøåôîá øâñð àì (co-process) `%s' ìéá÷î êéìäú" -#: io.c:952 +#: io.c:989 #, c-format msgid "no explicit close of pipe `%s' provided" msgstr "ùøåôîá øâñð àì (pipe) `%s' ÷éôà" -#: io.c:955 +#: io.c:992 #, c-format msgid "no explicit close of file `%s' provided" msgstr "ùøåôîá øâñð àì `%s' õáå÷" -#: io.c:984 io.c:1038 +#: io.c:1021 io.c:1075 #, c-format msgid "error writing standard output (%s)" msgstr "éð÷ú èìô õåøòì äáéúëá (%s) äì÷ú" -#: io.c:988 io.c:1042 +#: io.c:1025 io.c:1079 #, c-format msgid "error writing standard error (%s)" msgstr "éð÷ú úåàéâù õåøòì äáéúëá (%s) äì÷ú" -#: io.c:996 +#: io.c:1033 #, c-format msgid "pipe flush of `%s' failed (%s)." msgstr "`%s'-ì ÷éôà ìù õöåç ïå÷éøá (%s) äì÷ú" -#: io.c:999 +#: io.c:1036 #, c-format msgid "co-process flush of pipe to `%s' failed (%s)." msgstr "`%s'-ì ìéá÷î êéìäú ÷éôà ìù õöåç ïå÷éøá (%s) äì÷ú" -#: io.c:1002 +#: io.c:1039 #, c-format msgid "file flush of `%s' failed (%s)." msgstr "`%s' ìù õáå÷ éðåúð õöåç ïå÷éøá (%s) äì÷ú" -#: io.c:1161 +#: io.c:1198 msgid "/inet/raw client not ready yet, sorry" msgstr "ïëåî íøè /inet/raw çå÷ì ,íéøòèöî" -#: io.c:1163 io.c:1200 +#: io.c:1200 io.c:1237 msgid "only root may use `/inet/raw'." msgstr "ãáìá root ùîúùîì øúåî `inet/raw'-á ùåîéù" -#: io.c:1198 +#: io.c:1235 msgid "/inet/raw server not ready yet, sorry" msgstr "ïëåî íøè /inet/raw úøù ,íéøòèöî" -#: io.c:1288 +#: io.c:1325 #, c-format msgid "no (known) protocol supplied in special filename `%s'" msgstr "`%s' ãçåéî õáå÷ íùá ääåæî-éúìá åà øñç ìå÷åèåøô" -#: io.c:1306 +#: io.c:1343 #, c-format msgid "special file name `%s' is incomplete" msgstr "íìù åðéà `%s' ãçåéî õáå÷" -#: io.c:1318 +#: io.c:1355 #, c-format msgid "local port invalid in `%s'" msgstr "`%s'-á äéåâù úéîå÷î äàéöé" -#: io.c:1330 +#: io.c:1367 msgid "must supply a remote hostname to `/inet'" msgstr "`/inet' øåáò ÷çåøî çøàî-áùçî íù øéãâäì äáåç" -#: io.c:1345 +#: io.c:1382 msgid "must supply a remote port to `/inet'" msgstr "`/inet' øåáò ú÷çåøî äàéöé øéãâäì äáåç" -#: io.c:1351 +#: io.c:1388 #, c-format msgid "remote port invalid in `%s'" msgstr "`%s'-á äéåâù ú÷çåøî äàéöé" -#: io.c:1361 +#: io.c:1398 msgid "TCP/IP communications are not supported" msgstr "TCP/IP úøåù÷úá äëéîú ïéà" -#: io.c:1370 io.c:1551 +#: io.c:1407 io.c:1588 #, c-format msgid "file `%s' is a directory" msgstr "äé÷éú åðéä `%s' õáå÷" -#: io.c:1440 +#: io.c:1477 #, c-format msgid "use `PROCINFO[\"%s\"]' instead of `%s'" msgstr "`PROCINFO[\"%s\"]'-á ùîúùäì óéãò `%s' íå÷îá" -#: io.c:1472 +#: io.c:1509 msgid "use `PROCINFO[...]' instead of `/dev/user'" msgstr "`/dev/user' éðô-ìò óéãò `PROCINFO[...]'-á ùåîéù" # This probably sounds nonsensical in Hebrew, but what can I do, # given the original message text? -#: io.c:1537 io.c:1711 +#: io.c:1574 io.c:1748 #, c-format msgid "could not open `%s', mode `%s'" msgstr "`%s' øåáò `%s' äìåòô ïôåà úçéúôá ïåìùë" -#: io.c:1762 +#: io.c:1799 #, fuzzy, c-format msgid "close of master pty failed (%s)" msgstr "÷éôà úøéâñá (%s) äì÷ú" -#: io.c:1764 io.c:1916 io.c:2068 +#: io.c:1801 io.c:1953 io.c:2105 #, c-format msgid "close of stdout in child failed (%s)" msgstr "úá-úéðëúá stdout úøéâñá (%s) äì÷ú" -#: io.c:1767 +#: io.c:1804 #, fuzzy, c-format msgid "moving slave pty to stdout in child failed (dup: %s)" msgstr "úá-úéðëúá stdout-ì ÷éôà ìåôëùá (dup: %s) äì÷ú" -#: io.c:1769 io.c:1921 +#: io.c:1806 io.c:1958 #, c-format msgid "close of stdin in child failed (%s)" msgstr "úá-úéðëúá stdin úøéâñá (%s) äì÷ú" -#: io.c:1772 +#: io.c:1809 #, fuzzy, c-format msgid "moving slave pty to stdin in child failed (dup: %s)" msgstr "úá-úéðëúá stdin-ì ÷éôà ìåôëùá (dup: %s) äì÷ú" -#: io.c:1774 io.c:1793 +#: io.c:1811 io.c:1830 #, fuzzy, c-format msgid "close of slave pty failed (%s)" msgstr "÷éôà úøéâñá (%s) äì÷ú" -#: io.c:1867 io.c:1919 io.c:2049 io.c:2071 +#: io.c:1904 io.c:1956 io.c:2086 io.c:2108 #, c-format msgid "moving pipe to stdout in child failed (dup: %s)" msgstr "úá-úéðëúá stdout-ì ÷éôà ìåôëùá (dup: %s) äì÷ú" -#: io.c:1871 io.c:1924 +#: io.c:1908 io.c:1961 #, c-format msgid "moving pipe to stdin in child failed (dup: %s)" msgstr "úá-úéðëúá stdin-ì ÷éôà ìåôëùá (dup: %s) äì÷ú" -#: io.c:1888 io.c:2062 +#: io.c:1925 io.c:2099 msgid "restoring stdout in parent process failed\n" msgstr "áà-úéðëúá stdout ÷éôà øåæçùá äì÷ú\n" -#: io.c:1893 +#: io.c:1930 msgid "restoring stdin in parent process failed\n" msgstr "áà-úéðëúá stdin ÷éôà øåæçùá äì÷ú\n" -#: io.c:1927 io.c:2073 io.c:2084 +#: io.c:1964 io.c:2110 io.c:2121 #, c-format msgid "close of pipe failed (%s)" msgstr "÷éôà úøéâñá (%s) äì÷ú" -#: io.c:1972 +#: io.c:2009 msgid "`|&' not supported" msgstr "`|&'-á äëéîú ïéà" -#: io.c:2039 +#: io.c:2076 #, c-format msgid "cannot open pipe `%s' (%s)" msgstr "`%s' ÷éôà úçéúôá (%s) äì÷ú" -#: io.c:2080 +#: io.c:2117 #, c-format msgid "cannot create child process for `%s' (fork: %s)" msgstr "`%s' úá-úéðëúì êéìäú úøéöéá (fork: %s) äì÷ú" -#: io.c:2423 +#: io.c:2460 #, c-format msgid "data file `%s' is empty" msgstr "÷éø åðéä `%s' íéðåúð õáå÷" -#: io.c:2466 io.c:2474 +#: io.c:2503 io.c:2511 msgid "could not allocate more input memory" msgstr "" -#: io.c:2832 io.c:2895 +#: io.c:2869 io.c:2932 #, c-format msgid "error reading input file `%s': %s" msgstr "`%s' õáå÷ úàéø÷á (%s) äì÷ú" -#: io.c:3020 +#: io.c:3057 msgid "multicharacter value of `RS' is a gawk extension" msgstr "gawk-ì úéôéöôñ äáçøä äðéä `RS' ìù êøòá íéåú øôñîá äëéîú" -#: main.c:324 +#: main.c:323 msgid "`-m[fr]' option irrelevant in gawk" msgstr "gawk øåáò éèðååìø åðéà `-m[fr]' ïééôàî" -#: main.c:326 +#: main.c:325 msgid "-m option usage: `-m[fr] nnn'" msgstr "`-m[fr] nnn' :-m ïééôàîá ùåîéù ïôåà" -#: main.c:343 +#: main.c:342 #, c-format msgid "%s: option `-W %s' unrecognized, ignored\n" msgstr "çðæåä ,%s úéðëú øåáò øëåî åðéà `-W %s' ïééôàî\n" -#: main.c:380 +#: main.c:379 msgid "empty argument to `--source' ignored" msgstr "çðæåä `--source'-ì ÷éø èðîåâøà" -#: main.c:451 +#: main.c:450 msgid "environment variable `POSIXLY_CORRECT' set: turning on `--posix'" msgstr "`--posix' ìéòôî :øãâåî `POSIXLY_CORRECT' äáéáñ äðúùî" -#: main.c:456 +#: main.c:455 msgid "`--posix' overrides `--traditional'" msgstr "`--traditional' ìò øáåâ `--posix'" -#: main.c:467 +#: main.c:466 msgid "`--posix'/`--traditional' overrides `--non-decimal-data'" msgstr "`--non-decimal-data' ìò øáåâ `--posix'/`--traditional'" -#: main.c:471 +#: main.c:470 #, c-format msgid "running %s setuid root may be a security problem" msgstr "òãéî úçèáàá òåâôì äìåìò setuid root-ë %s úöøä" -#: main.c:512 +#: main.c:511 #, fuzzy, c-format msgid "can't set binary mode on stdin (%s)" msgstr "stdin úìåòô ïôåà úòéá÷á (%s) äì÷ú" -#: main.c:515 +#: main.c:514 #, fuzzy, c-format msgid "can't set binary mode on stdout (%s)" msgstr "stdout úìåòô ïôåà úòéá÷á (%s) äì÷ú" -#: main.c:517 +#: main.c:516 #, fuzzy, c-format msgid "can't set binary mode on stderr (%s)" msgstr "stderr úìåòô ïôåà úòéá÷á (%s) äì÷ú" -#: main.c:547 +#: main.c:546 msgid "no program text at all!" msgstr "!ììë àöîðá äéä àì úéðëú ìù èñ÷è" -#: main.c:620 +#: main.c:623 #, c-format msgid "Usage: %s [POSIX or GNU style options] -f progfile [--] file ...\n" msgstr "" "%s [GNU åà POSIX ïåðâñá íéðééôàî] -f úéðëú-íù [--] õáå÷-íù ... :ùåîéù ïôåà\n" -#: main.c:622 +#: main.c:625 #, c-format msgid "Usage: %s [POSIX or GNU style options] [--] %cprogram%c file ...\n" msgstr "" "%s [GNU åà POSIX ïåðâñá íéðééôàî] [--] %cúéðëú%c õáå÷-íù ... :ùåîéù ïôåà\n" -#: main.c:627 +#: main.c:630 msgid "POSIX options:\t\tGNU long options:\n" msgstr ":POSIX éðééôàî\t\t:íéëåøà GNU éðééôàî\n" -#: main.c:628 +#: main.c:631 msgid "\t-f progfile\t\t--file=progfile\n" msgstr "\t-f úéðëú-õáå÷\t\t--file=úéðëú-õáå÷\n" -#: main.c:629 +#: main.c:632 msgid "\t-F fs\t\t\t--field-separator=fs\n" msgstr "\t-F úåãù-ãéøôî\t\t--field-separator=úåãù-ãéøôî\n" -#: main.c:630 +#: main.c:633 msgid "\t-v var=val\t\t--assign=var=val\n" msgstr "\t-v äðúùî=êøò\t\t--assign=äðúùî=êøò\n" -#: main.c:631 +#: main.c:634 msgid "\t-m[fr] val\n" msgstr "\t-m[fr] êøò\n" -#: main.c:632 +#: main.c:635 msgid "\t-W compat\t\t--compat\n" msgstr "\t-W compat\t\t--compat\n" -#: main.c:633 +#: main.c:636 msgid "\t-W copyleft\t\t--copyleft\n" msgstr "\t-W copyleft\t\t--copyleft\n" -#: main.c:634 +#: main.c:637 msgid "\t-W copyright\t\t--copyright\n" msgstr "\t-W copyright\t\t--copyright\n" -#: main.c:635 +#: main.c:638 msgid "\t-W dump-variables[=file]\t--dump-variables[=file]\n" msgstr "\t-W dump-variables[=õáå÷-íù]\t--dump-variables[=õáå÷-íù]\n" -#: main.c:636 +#: main.c:639 msgid "\t-W gen-po\t\t--gen-po\n" msgstr "\t-W gen-po\t\t--gen-po\n" -#: main.c:637 +#: main.c:640 msgid "\t-W help\t\t\t--help\n" msgstr "\t-W help\t\t\t--help\n" -#: main.c:638 +#: main.c:641 msgid "\t-W lint[=fatal]\t\t--lint[=fatal]\n" msgstr "\t-W lint[=fatal]\t\t--lint[=fatal]\n" -#: main.c:639 +#: main.c:642 msgid "\t-W lint-old\t\t--lint-old\n" msgstr "\t-W lint-old\t\t--lint-old\n" -#: main.c:640 +#: main.c:643 msgid "\t-W non-decimal-data\t--non-decimal-data\n" msgstr "\t-W non-decimal-data\t--non-decimal-data\n" -#: main.c:642 +#: main.c:645 msgid "\t-W nostalgia\t\t--nostalgia\n" msgstr "\t-W nostalgia\t\t--nostalgia\n" -#: main.c:645 +#: main.c:648 msgid "\t-W parsedebug\t\t--parsedebug\n" msgstr "\t-W parsedebug\t\t--parsedebug\n" -#: main.c:647 +#: main.c:650 msgid "\t-W profile[=file]\t--profile[=file]\n" msgstr "\t-W profile[=õáå÷-íù]\t--profile[=õáå÷-íù]\n" -#: main.c:648 +#: main.c:651 msgid "\t-W posix\t\t--posix\n" msgstr "\t-W posix\t\t--posix\n" -#: main.c:649 +#: main.c:652 msgid "\t-W re-interval\t\t--re-interval\n" msgstr "\t-W re-interval\t\t--re-interval\n" -#: main.c:650 +#: main.c:653 msgid "\t-W source=program-text\t--source=program-text\n" msgstr "\t-W source=úéðëú-èñ÷è\t--source=úéðëú-èñ÷è\n" -#: main.c:651 +#: main.c:654 msgid "\t-W traditional\t\t--traditional\n" msgstr "\t-W traditional\t\t--traditional\n" -#: main.c:652 +#: main.c:655 msgid "\t-W usage\t\t--usage\n" msgstr "\t-W usage\t\t--usage\n" -#: main.c:653 +#: main.c:656 msgid "\t-W version\t\t--version\n" msgstr "\t-W version\t\t--version\n" -#: main.c:657 +#: main.c:660 msgid "" "\n" "To report bugs, see node `Bugs' in `gawk.info', which is\n" @@ -1464,7 +1540,7 @@ msgstr "" " .ñôãåîä êéøãîá `Reporting Problems and Bugs' ä÷ñô\n" "\n" -#: main.c:661 +#: main.c:664 msgid "" "gawk is a pattern scanning and processing language.\n" "By default it reads standard input and writes standard output.\n" @@ -1473,7 +1549,7 @@ msgstr "" ".èñ÷è úåéðáú ìù ãåáéòå äé÷øñì äôù åðéä gawk\n" ".éð÷ú èìôì áúåëå éð÷ú èì÷ õåøò àøå÷ àåä ìãçî úøéøáë\n" -#: main.c:665 +#: main.c:668 msgid "" "Examples:\n" "\tgawk '{ sum += $1 }; END { print sum }' file\n" @@ -1483,7 +1559,7 @@ msgstr "" "\tgawk '{ sum += $1 }; END { print sum }' file\n" "\tgawk -F: '{ print $1 }' /etc/passwd\n" -#: main.c:682 +#: main.c:685 #, c-format msgid "" "Copyright (C) 1989, 1991-%d Free Software Foundation.\n" @@ -1501,7 +1577,7 @@ msgstr "" " íàå ,ïåéùøä ìù 2 àñøâá íà ;Free Software Foundation\n" " .øúåé úøçåàî àñøâ ìëá (íëì äøåîùä äéöôåàë)\n" -#: main.c:690 +#: main.c:693 msgid "" "This program is distributed in the hope that it will be useful,\n" "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" @@ -1514,7 +1590,7 @@ msgstr "" ",íéèøôì .úîéåñî úéìëú åæéàì äîàúä åà úåøéçñ ìù\n" " .GNU General Public License-á åðééò àðà\n" -#: main.c:696 +#: main.c:699 msgid "" "You should have received a copy of the GNU General Public License\n" "along with this program; if not, write to the Free Software\n" @@ -1524,48 +1600,48 @@ msgstr "" "Free Software Foundation, Inc.-ì åáúë àðà ,åúåà íúìáé÷ àì íà\n" ".59 Temple Place - Suite 330, Boston, MA 02111-1307, USA\n" -#: main.c:730 +#: main.c:733 msgid "-Ft does not set FS to tab in POSIX awk" msgstr "awk ìù POSIX úñøâá TAB úåéäì FS-ì íøåâ åðéà -Ft" -#: main.c:956 +#: main.c:962 #, c-format msgid "" "%s: `%s' argument to `-v' not in `var=value' form\n" "\n" msgstr "" -#: main.c:976 +#: main.c:982 #, c-format msgid "`%s' is not a legal variable name" msgstr "" -#: main.c:979 +#: main.c:985 #, c-format msgid "`%s' is not a variable name, looking for file `%s=%s'" msgstr "" -#: main.c:1012 +#: main.c:1018 msgid "floating point exception" msgstr "äôö äãå÷ð éáåùéçá äâéøç" -#: main.c:1019 +#: main.c:1025 msgid "fatal error: internal error" msgstr "úéîéðô äðëú úàéâù :äøåîç äì÷ú" # FIXME: I wonder how many people will understand what "fd 2" means. -#: main.c:1069 +#: main.c:1075 #, c-format msgid "no pre-opened fd %d" msgstr "ùàøî çåúô åðéà %d èìô/èì÷ õåøò" # FIXME: /dev/null might not be known to all. -#: main.c:1074 +#: main.c:1082 #, c-format msgid "could not pre-open /dev/null for fd %d" msgstr "/dev/null-ì %d èìô/èì÷ õåøò çåúôì ïúéð àì" -#: main.c:1097 main.c:1106 +#: main.c:1105 main.c:1114 #, c-format msgid "could not find groups: %s" msgstr "%s :úëøòîá íéùîúùî úåöåá÷ ìò òãéî ïéà" @@ -1575,6 +1651,7 @@ msgstr "%s : # wrong if both these headings and the message text after them is in # Hebrew, due to changed directionality. #: msg.c:54 +#, c-format msgid "cmd. line:" msgstr "cmd. line:" @@ -1594,19 +1671,19 @@ msgstr "fatal: " msgid "can't convert string to float" msgstr "øôñîì äøîäì úðúéð äðéà úæåøçî" -#: node.c:355 +#: node.c:357 msgid "backslash at end of string" msgstr "úæåøçî óåñá êåôä ïñëåì" -#: node.c:539 +#: node.c:541 msgid "POSIX does not allow `\\x' escapes" msgstr "`\\x' âåñî äø÷á úåøãñ äùøî åðéà POSIX ï÷ú" -#: node.c:545 +#: node.c:547 msgid "no hex digits in `\\x' escape sequence" msgstr "`\\x' äø÷á úøãñá úåéìîéöãñ÷ä úåøôñá ùîúùäì ïéà" -#: node.c:579 +#: node.c:581 #, c-format msgid "escape sequence `\\%c' treated as plain `%c'" msgstr "éìåìéî åúë ìôåè `\\%c' äø÷á úøãñá `%c' åú" @@ -1621,21 +1698,27 @@ msgstr "%s %s `%s' msgid "could not open `%s' for writing: %s" msgstr "äáéúë êøåöì `%s' úçéúô úòá (%s) äì÷ú" -#: profile.c:449 +#: profile.c:467 #, fuzzy, c-format msgid "internal error: %s with null vname" msgstr "ñôåàî åìù vname-äù Node_var :úéîéðô äðëú úàéâù" -#: profile.c:512 +#: profile.c:530 msgid "# treated internally as `delete'" msgstr "" -#: profile.c:1162 +#: profile.c:1167 +#, c-format +msgid "# this is a dynamically loaded extension function" +msgstr "" + +#: profile.c:1198 #, c-format msgid "\t# gawk profile, created %s\n" msgstr "\t# %s êéøàúî gawk ìù ìéôåøô\n" -#: profile.c:1165 +#: profile.c:1201 +#, c-format msgid "" "\t# BEGIN block(s)\n" "\n" @@ -1643,7 +1726,8 @@ msgstr "" "\t# BEGIN ÷åìá\n" "\n" -#: profile.c:1175 +#: profile.c:1211 +#, c-format msgid "" "\t# Rule(s)\n" "\n" @@ -1651,7 +1735,8 @@ msgstr "" "\t# (íé)ììë\n" "\n" -#: profile.c:1181 +#: profile.c:1217 +#, c-format msgid "" "\t# END block(s)\n" "\n" @@ -1659,7 +1744,8 @@ msgstr "" "\t# END ÷åìá\n" "\n" -#: profile.c:1201 +#: profile.c:1237 +#, c-format msgid "" "\n" "\t# Functions, listed alphabetically\n" @@ -1667,88 +1753,91 @@ msgstr "" "\n" "\t# úéá-óìà øãñá ,úåéö÷ðåô\n" -#: profile.c:1413 +#: profile.c:1452 #, c-format msgid "unexpected type %s in prec_level" msgstr "prec_level-á %s éåâù âåñ" -#: re.c:193 -#, c-format -msgid "regex match failed, not enough memory to match string \"%.*s%s\"" -msgstr "\"%.*s%s\" úæåøçî úîàúäì ïåøëæ éã ïéà ,ìùëð éøìåâø éåèéáì äîàúä ùåôéç" - -#: regcomp.c:136 +#: regcomp.c:150 msgid "Success" msgstr "äçìöä" -#: regcomp.c:139 +#: regcomp.c:153 msgid "No match" msgstr "äîéàúî úæåøçî äàöîð àì" -#: regcomp.c:142 +#: regcomp.c:156 msgid "Invalid regular expression" msgstr "éåâù éøìåâø éåèéá" -#: regcomp.c:145 +#: regcomp.c:159 msgid "Invalid collation character" msgstr "øãâåî-éúìá øåãéñ åú" -#: regcomp.c:148 +#: regcomp.c:162 msgid "Invalid character class name" msgstr "íéåú úöåá÷ ìù øãâåî-éúìá íù" -#: regcomp.c:151 +#: regcomp.c:165 msgid "Trailing backslash" msgstr "`\\' éøåçà ïñëåìá íééúñî éøìåâø éåèéá" -#: regcomp.c:154 +#: regcomp.c:168 msgid "Invalid back reference" msgstr "íãå÷ éåèéá-úúì äéåâù äééðôä" -#: regcomp.c:157 +#: regcomp.c:171 msgid "Unmatched [ or [^" msgstr "âåæ-ïá åì ïéàù [^ åà [" -#: regcomp.c:160 +#: regcomp.c:174 msgid "Unmatched ( or \\(" msgstr "âåæ-ïá åì ïéàù \\( åà (" -#: regcomp.c:163 +#: regcomp.c:177 msgid "Unmatched \\{" msgstr "âåæ-ïá åì ïéàù \\{" -#: regcomp.c:166 +#: regcomp.c:180 msgid "Invalid content of \\{\\}" msgstr "\\{\\} êåúá éåâù äðáî" -#: regcomp.c:169 +#: regcomp.c:183 msgid "Invalid range end" msgstr "íéåú íåçú ìù äéåâù äøãâä" -#: regcomp.c:172 +#: regcomp.c:186 msgid "Memory exhausted" msgstr "ïåøëæä øîâð" -#: regcomp.c:175 +#: regcomp.c:189 msgid "Invalid preceding regular expression" msgstr "íéé÷ åðéà åà éåâù íãå÷ éøìåâø éåèéá" -#: regcomp.c:178 +#: regcomp.c:192 msgid "Premature end of regular expression" msgstr "éãî íã÷åî íééúñî éøìåâø éåèéá" -#: regcomp.c:181 +#: regcomp.c:195 msgid "Regular expression too big" msgstr "éãî áëøåî åà ìåãâ éøìåâø éåèéá" -#: regcomp.c:184 +#: regcomp.c:198 msgid "Unmatched ) or \\)" msgstr "âåæ-ïá åì ïéàù \\) åà )" -#: regcomp.c:621 +#: regcomp.c:668 msgid "No previous regular expression" msgstr "íãå÷ éøìåâø éåèéá ïéà" +#, fuzzy +#~ msgid "or used as a variable or an array" +#~ msgstr "êøòî åà äðúùîë `%s' äéö÷ðåô íùá ùîúùäì ïéà" + +#~ msgid "regex match failed, not enough memory to match string \"%.*s%s\"" +#~ msgstr "" +#~ "\"%.*s%s\" úæåøçî úîàúäì ïåøëæ éã ïéà ,ìùëð éøìåâø éåèéáì äîàúä ùåôéç" + #, fuzzy #~ msgid "substr: length %g is < 0" #~ msgstr "0-î ìåãâ øôñî åððéà %g êøåà :substr" @@ -1787,9 +1876,6 @@ msgstr " #~ msgid "or used in other expression context" #~ msgstr "øçà éåèéá ìù èñ÷èðå÷á äá ùåîéù åà" -#~ msgid "attempt to use function `%s' as array" -#~ msgstr "êøòîë `%s' äéö÷ðåôá ùåîéù ïåéñð" - #~ msgid "`%s' is a function, assignment is not allowed" #~ msgstr "äøåñà äá êøò úîùä ,äéö÷ðåô àéä `%s'" diff --git a/po/it.gmo b/po/it.gmo index 28c81fea1..f83fbbbe2 100644 Binary files a/po/it.gmo and b/po/it.gmo differ diff --git a/po/it.po b/po/it.po index ec8d9f8e0..8676ec8b9 100644 --- a/po/it.po +++ b/po/it.po @@ -1,14 +1,14 @@ # Italian messages for GNU Awk -# Copyright (C) 2002-2003 Free Software Foundation, Inc. -# Antonio Colombo , 2003. +# Copyright (C) 2002-2004 Free Software Foundation, Inc. +# Antonio Colombo . # msgid "" msgstr "" "Project-Id-Version: gawk 3.1.35\n" "Report-Msgid-Bugs-To: arnold@skeeve.com\n" -"POT-Creation-Date: 2003-07-07 11:20-0700\n" -"PO-Revision-Date: 2003-06-10 11:11+0100\n" -"Last-Translator: Antonio Colombo \n" +"POT-Creation-Date: 2004-07-15 13:02+0300\n" +"PO-Revision-Date: 2004-07-09 07:25+0100\n" +"Last-Translator: Antonio Colombo \n" "Language-Team: Italian \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=ISO-8859-8\n" @@ -16,55 +16,60 @@ msgstr "" #: array.c:112 #, c-format +msgid "attempt to use function `%s' as an array" +msgstr "tentativo di usare funzione '%s' come vettore" + +#: array.c:115 +#, c-format msgid "attempt to use scalar parameter `%s' as an array" msgstr "tentativo di unare il parametro scalare `%s' come un vettore" -#: array.c:113 +#: array.c:118 #, c-format msgid "attempt to use scalar `%s' as array" msgstr "tentativo di usare scalare '%s' come vettore" -#: array.c:151 +#: array.c:156 #, c-format msgid "from %s" msgstr "da %s" -#: array.c:506 +#: array.c:511 #, c-format msgid "reference to uninitialized element `%s[\"%s\"]'" msgstr "referenza a elemento non inizializzato `%s[\"%s\"]'" -#: array.c:512 +#: array.c:517 #, c-format msgid "subscript of array `%s' is null string" msgstr "l'indice del vettore '%s' è una stringa nulla" -#: array.c:609 +#: array.c:621 #, c-format msgid "delete: index `%s' not in array `%s'" msgstr "delete: indice `%s' non presente nel vettore `%s'" -#: array.c:769 +#: array.c:791 #, c-format msgid "%s: empty (null)\n" msgstr "%s: vuoto (nullo)\n" -#: array.c:774 +#: array.c:796 #, c-format msgid "%s: empty (zero)\n" msgstr "%s: vuoto (zero)\n" -#: array.c:778 +#: array.c:800 #, c-format msgid "%s: table_size = %d, array_size = %d\n" msgstr "%s: dimensione_tabella = %d, dimensione_vettore = %d\n" -#: array.c:807 +#: array.c:829 #, c-format msgid "%s: is parameter\n" msgstr "%s: è parametro\n" -#: array.c:812 +#: array.c:834 #, c-format msgid "%s: array_ref to %s\n" msgstr "%s: referenza_vettoriale a %s\n" @@ -88,478 +93,474 @@ msgstr "`%s' msgid "regexp constant `/%s/' looks like a C comment, but is not" msgstr "costante 'regexp' `/%s/' sembra un commento commento C, ma non lo è" -#: awkgram.y:340 awkgram.y:615 +#: awkgram.y:341 awkgram.y:619 msgid "statement may have no effect" msgstr "istruzione che può non aver alcun effetto" -#: awkgram.y:435 awkgram.y:455 +#: awkgram.y:436 awkgram.y:456 #, c-format msgid "`%s' used in %s action" msgstr "`%s' usato in 'azione' %s" -#: awkgram.y:448 awkgram.y:451 +#: awkgram.y:449 awkgram.y:452 msgid "`nextfile' is a gawk extension" msgstr "`nextfile' è un'estensione gawk" -#: awkgram.y:465 +#: awkgram.y:466 msgid "`return' used outside function context" msgstr "`return' usato fuori da una funzione" -#: awkgram.y:504 +#: awkgram.y:508 msgid "plain `print' in BEGIN or END rule should probably be `print \"\"'" msgstr "`print' da solo in BEGIN o END dovrebbe forse essere `print \"\"'" -#: awkgram.y:517 awkgram.y:524 +#: awkgram.y:521 awkgram.y:528 msgid "`delete array' is a gawk extension" msgstr "`delete array' è un'estensione gawk" -#: awkgram.y:532 awkgram.y:539 +#: awkgram.y:536 awkgram.y:543 msgid "`delete(array)' is a non-portable tawk extension" msgstr "`delete(array)' è un'estensione tawk non-portabile" -#: awkgram.y:583 +#: awkgram.y:587 #, c-format msgid "duplicate case values in switch body: %s" msgstr "valori di 'case' doppi all'interno di uno 'switch': %s" -#: awkgram.y:593 +#: awkgram.y:597 msgid "Duplicate `default' detected in switch body" msgstr "Valori per difetto doppi all'interno di uno 'switch'" -#: awkgram.y:681 +#: awkgram.y:686 msgid "multistage two-way pipelines don't work" msgstr "'pipelines' multistadio bidirezionali non funzionano" -#: awkgram.y:772 +#: awkgram.y:777 msgid "regular expression on right of assignment" msgstr "espressione regolare usata per assegnare un valore" -#: awkgram.y:782 +#: awkgram.y:800 msgid "regular expression on left of `~' or `!~' operator" msgstr "espressione regolare prima di operatore `~' o `!~'" -#: awkgram.y:790 +#: awkgram.y:808 msgid "regular expression on right of comparison" msgstr "espressione regolare a destra in un confronto" -#: awkgram.y:857 +#: awkgram.y:875 msgid "non-redirected `getline' undefined inside END action" msgstr "`getline' non re-diretta indefinita dentro 'azione' END" -#: awkgram.y:884 +#: awkgram.y:902 msgid "call of `length' without parentheses is not portable" msgstr "chiamata a `length' senza parentesi non portabile" -#: awkgram.y:887 +#: awkgram.y:905 msgid "call of `length' without parentheses is deprecated by POSIX" msgstr "chiamata a `length' senza parentesi sconsigliata da POSIX" -#: awkgram.y:940 +#: awkgram.y:958 msgid "use of non-array as array" msgstr "uso di non-vettore come vettore" -#: awkgram.y:942 +#: awkgram.y:960 msgid "invalid subscript expression" msgstr "espressione indice invalida" -#: awkgram.y:1140 +#: awkgram.y:1158 msgid "unexpected newline or end of string" msgstr "carattere 'a capo' o fine stringa inaspettati" -#: awkgram.y:1235 +#: awkgram.y:1254 msgid "empty program text on command line" msgstr "programma nullo sulla linea comandi" -#: awkgram.y:1292 +#: awkgram.y:1307 #, c-format msgid "can't open source file `%s' for reading (%s)" msgstr "non riesco ad aprire file sorgente `%s' in lettura (%s)" -#: awkgram.y:1327 +#: awkgram.y:1384 #, c-format msgid "can't read sourcefile `%s' (%s)" msgstr "non riesco a leggere file sorgente `%s' (%s)" -#: awkgram.y:1335 +#: awkgram.y:1392 #, c-format msgid "source file `%s' is empty" msgstr "file sorgente `%s' vuoto" -#: awkgram.y:1537 awkgram.y:1647 awkgram.y:1665 awkgram.y:2015 awkgram.y:2100 +#: awkgram.y:1590 awkgram.y:1700 awkgram.y:1718 awkgram.y:2068 awkgram.y:2153 msgid "source file does not end in newline" msgstr "file sorgente non termina con carattere 'a capo'" -#: awkgram.y:1601 +#: awkgram.y:1654 msgid "unterminated regexp ends with `\\' at end of file" msgstr "espressione regolare non completata termina con `\\' a fine file" -#: awkgram.y:1621 +#: awkgram.y:1674 msgid "unterminated regexp" msgstr "espressione regolare non completata" -#: awkgram.y:1624 +#: awkgram.y:1677 msgid "unterminated regexp at end of file" msgstr "espressione regolare non completata a fine file" -#: awkgram.y:1691 +#: awkgram.y:1744 msgid "use of `\\ #...' line continuation is not portable" msgstr "uso di `\\ #...' continuazione linea non portabile" -#: awkgram.y:1703 +#: awkgram.y:1756 msgid "backslash not last character on line" msgstr "'\\' non è l'ultimo carattere della linea" -#: awkgram.y:1748 +#: awkgram.y:1801 msgid "POSIX does not allow operator `**='" msgstr "POSIX non permette l'operatore `**='" -#: awkgram.y:1750 +#: awkgram.y:1803 msgid "old awk does not support operator `**='" msgstr "il vecchio awk non supporta l'operatore `**='" -#: awkgram.y:1759 +#: awkgram.y:1812 msgid "POSIX does not allow operator `**'" msgstr "POSIX non permette l'operatore `**'" -#: awkgram.y:1761 +#: awkgram.y:1814 msgid "old awk does not support operator `**'" msgstr "il vecchio awk non supporta l'operatore `**'" -#: awkgram.y:1792 +#: awkgram.y:1845 msgid "operator `^=' is not supported in old awk" msgstr "l'operatore `^=' non è supportato nel vecchio awk" -#: awkgram.y:1800 +#: awkgram.y:1853 msgid "operator `^' is not supported in old awk" msgstr "l'operatore `^' non è supportato nel vecchio awk" -#: awkgram.y:1884 awkgram.y:1901 +#: awkgram.y:1937 awkgram.y:1954 msgid "unterminated string" msgstr "stringa non terminata" -#: awkgram.y:2061 +#: awkgram.y:2114 #, c-format msgid "invalid char '%c' in expression" msgstr "carattere '%c' invalido in un'espressione" -#: awkgram.y:2121 +#: awkgram.y:2162 #, c-format msgid "`%s' is a gawk extension" msgstr "`%s' è un'estensione gawk" -#: awkgram.y:2124 +#: awkgram.y:2165 #, c-format msgid "`%s' is a Bell Labs extension" msgstr "`%s' è un'estensione Bell Labs" -#: awkgram.y:2127 +#: awkgram.y:2168 #, c-format msgid "POSIX does not allow `%s'" msgstr "POSIX non permette `%s'" -#: awkgram.y:2131 +#: awkgram.y:2172 #, c-format msgid "`%s' is not supported in old awk" msgstr "`%s' non è supportato nel vecchio awk" -#: awkgram.y:2158 +#: awkgram.y:2198 msgid "`goto' considered harmful!\n" msgstr "`goto' considerato pericoloso!\n" -#: awkgram.y:2220 +#: awkgram.y:2260 #, c-format msgid "%d is invalid as number of arguments for %s" msgstr "%d invalido come numero di argomenti per %s" -#: awkgram.y:2239 awkgram.y:2242 +#: awkgram.y:2279 awkgram.y:2282 msgid "match: third argument is a gawk extension" msgstr "match: il terzo argomento è un'estensione gawk" -#: awkgram.y:2255 +#: awkgram.y:2295 #, c-format msgid "%s: string literal as last arg of substitute has no effect" msgstr "%s: una stringa come ultimo argomento di 'substitute' non ha effetto" -#: awkgram.y:2258 +#: awkgram.y:2298 #, c-format msgid "%s third parameter is not a changeable object" msgstr "il terzo parametro di '%s' non è un oggetto modificabile" -#: awkgram.y:2285 awkgram.y:2288 +#: awkgram.y:2325 awkgram.y:2328 msgid "close: second argument is a gawk extension" msgstr "close: il secondo argomento è un'estensione gawk" -#: awkgram.y:2298 +#: awkgram.y:2338 msgid "use of dcgettext(_\"...\") is incorrect: remove leading underscore" msgstr "" "uso scorretto di dcgettext(_\"...\"): togliere il carattere '_' iniziale" -#: awkgram.y:2313 +#: awkgram.y:2353 msgid "use of dcngettext(_\"...\") is incorrect: remove leading underscore" msgstr "" "uso scorretto di dcngettext(_\"...\"): togliere il carattere '_' iniziale" -#: awkgram.y:2384 +#: awkgram.y:2424 #, c-format msgid "function `%s': parameter #%d, `%s', duplicates parameter #%d" msgstr "funzione `%s': parametro #%d, `%s', duplica parametro #%d" -#: awkgram.y:2417 +#: awkgram.y:2457 #, c-format msgid "function `%s': parameter `%s' shadows global variable" msgstr "funzione `%s': parametro `%s' nasconde variabile globale" -#: awkgram.y:2529 +#: awkgram.y:2569 #, c-format msgid "could not open `%s' for writing (%s)" msgstr "non riesco ad aprire `%s' in scrittura (%s)" -#: awkgram.y:2530 profile.c:93 +#: awkgram.y:2570 profile.c:93 msgid "sending profile to standard error" msgstr "mando profilo a 'standard error'" -#: awkgram.y:2562 +#: awkgram.y:2602 #, c-format msgid "%s: close failed (%s)" msgstr "%s: 'close' fallita (%s)" -#: awkgram.y:2684 +#: awkgram.y:2723 msgid "shadow_funcs() called twice!" msgstr "shadow_funcs() chiamata due volte!" -#: awkgram.y:2711 +#: awkgram.y:2750 msgid "there were shadowed variables." msgstr "c'erano variabili nascoste." -#: awkgram.y:2784 +#: awkgram.y:2823 #, c-format msgid "function `%s': can't use function name as parameter name" msgstr "funzione `%s': non posso usare nome della funzione come nome parametro" -#: awkgram.y:2794 +#: awkgram.y:2833 #, c-format msgid "function name `%s' previously defined" msgstr "funzione di nome `%s' definita in precedenza" -#: awkgram.y:2945 awkgram.y:2951 +#: awkgram.y:2984 awkgram.y:2990 #, c-format msgid "function `%s' called but never defined" msgstr "funzione `%s' chiamata ma mai definita" -#: awkgram.y:2954 +#: awkgram.y:2993 #, c-format msgid "function `%s' defined but never called" msgstr "funzione `%s' definita ma mai chiamata" -#: awkgram.y:2981 +#: awkgram.y:3020 #, c-format msgid "regexp constant for parameter #%d yields boolean value" msgstr "" "espressione regolare di valore costante per parametro #%d genera valore " "booleano" -#: awkgram.y:2994 +#: awkgram.y:3033 #, c-format msgid "" "function `%s' called with space between name and `(',\n" -"%s" +"or used as a variable or an array" msgstr "" "funzione `%s' chiamata con spazio tra il nome e `(',\n" -"%s" +"o usata come variabile o vettore" -#: awkgram.y:2996 -msgid "or used as a variable or an array" -msgstr "o usato come variabile o come vettore" - -#: builtin.c:137 +#: builtin.c:149 #, c-format msgid "%s to \"%s\" failed (%s)" msgstr "%s a \"%s\" fallita (%s)" -#: builtin.c:138 +#: builtin.c:150 msgid "standard output" msgstr "standard output" -#: builtin.c:139 +#: builtin.c:151 msgid "reason unknown" msgstr "ragione indeterminata" -#: builtin.c:152 +#: builtin.c:164 msgid "exp: received non-numeric argument" msgstr "exp: argomento non numerico" -#: builtin.c:158 +#: builtin.c:170 #, c-format msgid "exp: argument %g is out of range" msgstr "exp: argomento %g non accettabile" -#: builtin.c:216 +#: builtin.c:228 #, c-format msgid "fflush: cannot flush: pipe `%s' opened for reading, not writing" msgstr "" "fflush: non posso scaricare: 'pipe' `%s' aperta in lettura, non in scrittura" -#: builtin.c:219 +#: builtin.c:231 #, c-format msgid "fflush: cannot flush: file `%s' opened for reading, not writing" msgstr "" "fflush: non posso scaricare: file `%s' aperto in lettura, non in scrittura" -#: builtin.c:231 +#: builtin.c:243 #, c-format msgid "fflush: `%s' is not an open file, pipe or co-process" msgstr "fflush: `%s' non è un file aperto, una 'pipe' o un co-processo" -#: builtin.c:325 +#: builtin.c:338 msgid "index: received non-string first argument" msgstr "index: il primo argomento non è una stringa" -#: builtin.c:327 +#: builtin.c:340 msgid "index: received non-string second argument" msgstr "index: il secondo argomento non è una stringa" -#: builtin.c:437 +#: builtin.c:454 msgid "int: received non-numeric argument" msgstr "int: argomento non numerico" -#: builtin.c:454 +#: builtin.c:471 msgid "length: received non-string argument" msgstr "length: l'argomento non è una stringa" -#: builtin.c:470 +#: builtin.c:487 msgid "log: received non-numeric argument" msgstr "log: argomento non numerico" -#: builtin.c:473 +#: builtin.c:490 #, c-format msgid "log: received negative argument %g" msgstr "log: argomento negativo %g" -#: builtin.c:635 builtin.c:638 +#: builtin.c:654 builtin.c:657 msgid "must use `count$' on all formats or none" msgstr "'count$' va usato per tutti i formati o per nessuno" -#: builtin.c:740 +#: builtin.c:759 msgid "`$' is not permitted in awk formats" msgstr "`$' non permesso nei 'format' awk" -#: builtin.c:746 +#: builtin.c:765 msgid "arg count with `$' must be > 0" msgstr "il numero di argomento con `$' deve essere > 0" -#: builtin.c:748 +#: builtin.c:767 #, c-format msgid "arg count %ld greater than total number of supplied arguments" msgstr "" "numero di argomenti (%ld) maggiore del numero totale di argomenti specificati" -#: builtin.c:750 +#: builtin.c:769 msgid "`$' not permitted after period in format" msgstr "`$' non permesso dopo un punto nel 'format'" -#: builtin.c:763 +#: builtin.c:782 msgid "no `$' supplied for positional field width or precision" msgstr "" "nessun `$' specificato per larghezza o precisione di un campo posizionale" -#: builtin.c:821 +#: builtin.c:848 msgid "`l' is meaningless in awk formats; ignored" msgstr "`l' non ha senso nei 'format' awk; ignorata" -#: builtin.c:825 +#: builtin.c:852 msgid "`l' is not permitted in POSIX awk formats" msgstr "`l' non permessa nei 'format' awk POSIX" -#: builtin.c:836 +#: builtin.c:863 msgid "`L' is meaningless in awk formats; ignored" msgstr "`L' non ha senso nei 'format' awk; ignorata" -#: builtin.c:840 +#: builtin.c:867 msgid "`L' is not permitted in POSIX awk formats" msgstr "`L' non permessa nei 'format' awk POSIX" -#: builtin.c:851 +#: builtin.c:878 msgid "`h' is meaningless in awk formats; ignored" msgstr "`h' non ha senso nei 'format' awk; ignorata" -#: builtin.c:855 +#: builtin.c:882 msgid "`h' is not permitted in POSIX awk formats" msgstr "`h' non permessa nei 'format' awk POSIX" -#: builtin.c:1055 +#: builtin.c:1111 #, c-format msgid "[s]printf: value %g is out of range for `%%%c' format" msgstr "[s]printf: valore %g non accettabile per il 'format' `%%%c'" -#: builtin.c:1108 +#: builtin.c:1171 msgid "not enough arguments to satisfy format string" msgstr "mancano argomenti per completare il 'format'" -#: builtin.c:1110 +#: builtin.c:1173 msgid "^ ran out for this one" msgstr "^ uscito per questo" -#: builtin.c:1115 +#: builtin.c:1178 msgid "[s]printf: format specifier does not have control letter" msgstr "[s]printf: il designatore di 'format' non ha una lettera di controllo" -#: builtin.c:1118 +#: builtin.c:1181 msgid "too many arguments supplied for format string" msgstr "troppi argomenti specificati per il 'format'" -#: builtin.c:1184 builtin.c:1187 +#: builtin.c:1247 builtin.c:1250 msgid "printf: no arguments" msgstr "printf: manca argomento" -#: builtin.c:1211 +#: builtin.c:1274 msgid "sqrt: received non-numeric argument" msgstr "sqrt: argomento non numerico" -#: builtin.c:1215 +#: builtin.c:1278 #, c-format msgid "sqrt: called with negative argument %g" msgstr "sqrt: chiamata con argomento negativo %g" -#: builtin.c:1238 +#: builtin.c:1301 #, c-format msgid "substr: start index %g is invalid, using 1" msgstr "substr: indice di partenza %g invalido, uso 1" -#: builtin.c:1243 +#: builtin.c:1306 #, c-format msgid "substr: non-integer start index %g will be truncated" msgstr "substr: indice di partenza non intero %g: sarà troncato" -#: builtin.c:1262 -#, fuzzy, c-format +#: builtin.c:1325 +#, c-format msgid "substr: length %g is not >= 1" -msgstr "substr: lunghezza %g <= 0" +msgstr "substr: lunghezza %g non >= 1" -#: builtin.c:1264 -#, fuzzy, c-format +#: builtin.c:1327 +#, c-format msgid "substr: length %g is not >= 0" -msgstr "substr: lunghezza %g <= 0" +msgstr "substr: lunghezza %g non >= 0" -#: builtin.c:1271 +#: builtin.c:1334 #, c-format msgid "substr: non-integer length %g will be truncated" msgstr "substr: lunghezza non intera %g: sarà truncata" -#: builtin.c:1276 +#: builtin.c:1339 #, c-format msgid "substr: length %g too big for string indexing, truncating to %g" msgstr "substr: lunghezza %g troppo elevata per indice stringa, tronco a %g" -#: builtin.c:1288 +#: builtin.c:1351 msgid "substr: source string is zero length" msgstr "substr: stringa di partenza lunga zero" -#: builtin.c:1294 +#: builtin.c:1357 #, c-format msgid "substr: start index %g is past end of string" msgstr "substr: indice di partenza %g oltre la fine della stringa" -#: builtin.c:1302 +#: builtin.c:1365 #, c-format msgid "" "substr: length %g at start index %g exceeds length of first argument (%lu)" @@ -567,239 +568,259 @@ msgstr "" "substr: lunghezza %g all'indice di partenza %g supera la lunghezza del primo " "argomento (%lu)" -#: builtin.c:1337 +#: builtin.c:1400 msgid "strftime: received non-string first argument" msgstr "strftime: il primo argomento non è una stringa" -#: builtin.c:1343 +#: builtin.c:1406 msgid "strftime: received empty format string" msgstr "strftime: 'format' è una stringa nulla" -#: builtin.c:1352 +#: builtin.c:1415 msgid "strftime: received non-numeric second argument" msgstr "strftime: il secondo argomento non è numerico" -#: builtin.c:1415 +#: builtin.c:1478 msgid "mktime: received non-string argument" msgstr "mktime: l'argomento non è una stringa" -#: builtin.c:1460 +#: builtin.c:1523 msgid "system: received non-string argument" msgstr "system: l'argomento non è una stringa" -#: builtin.c:1581 eval.c:1883 +#: builtin.c:1644 eval.c:2019 #, c-format msgid "reference to uninitialized field `$%d'" msgstr "referenza a variabile non inizializzata `$%d'" -#: builtin.c:1608 +#: builtin.c:1671 msgid "tolower: received non-string argument" msgstr "tolower: l'argomento non è una stringa" -#: builtin.c:1657 +#: builtin.c:1720 msgid "toupper: received non-string argument" msgstr "toupper: l'argomento non è una stringa" -#: builtin.c:1702 +#: builtin.c:1765 msgid "atan2: received non-numeric first argument" msgstr "atan2: il primo argomento non è numerico" -#: builtin.c:1704 +#: builtin.c:1767 msgid "atan2: received non-numeric second argument" msgstr "atan2: il secondo argomento non è numerico" -#: builtin.c:1723 +#: builtin.c:1786 msgid "sin: received non-numeric argument" msgstr "sin: l'argomento non è numerico" -#: builtin.c:1739 +#: builtin.c:1802 msgid "cos: received non-numeric argument" msgstr "cos: l'argomento non è numerico" -#: builtin.c:1788 +#: builtin.c:1852 msgid "srand: received non-numeric argument" msgstr "srand: l'argomento non è numerico" -#: builtin.c:1823 +#: builtin.c:1887 msgid "match: third argument is not an array" msgstr "match: il terzo argomento non è un vettore" -#: builtin.c:2307 +#: builtin.c:2414 msgid "gensub: third argument of 0 treated as 1" msgstr "gensub: il terzo argomento è 0, trattato come 1" -#: builtin.c:2416 builtin.c:2418 +#: builtin.c:2572 msgid "lshift: received non-numeric first argument" msgstr "lshift: il primo argomento non è numerico" -#: builtin.c:2420 +#: builtin.c:2574 +msgid "lshift: received non-numeric second argument" +msgstr "lshift: il secondo argomento non è numerico" + +#: builtin.c:2580 #, c-format msgid "lshift(%lf, %lf): negative values will give strange results" msgstr "lshift(%lf, %lf): valori negativi daranno risultati strani" -#: builtin.c:2422 +#: builtin.c:2582 #, c-format msgid "lshift(%lf, %lf): fractional values will be truncated" msgstr "lshift(%lf, %lf): valori con decimali verranno troncati" -#: builtin.c:2424 +#: builtin.c:2584 #, c-format msgid "lshift(%lf, %lf): too large shift value will give strange results" msgstr "lshift(%lf, %lf): valori troppo alti daranno risultati strani" -#: builtin.c:2453 builtin.c:2455 +#: builtin.c:2610 msgid "rshift: received non-numeric first argument" msgstr "rshift: il primo argomento non è numerico" -#: builtin.c:2457 +#: builtin.c:2612 +msgid "rshift: received non-numeric second argument" +msgstr "rshift: il secondo argomento non è numerico" + +#: builtin.c:2618 #, c-format msgid "rshift(%lf, %lf): negative values will give strange results" msgstr "rshift(%lf, %lf): valori negativi daranno risultati strani" -#: builtin.c:2459 +#: builtin.c:2620 #, c-format msgid "rshift(%lf, %lf): fractional values will be truncated" msgstr "rshift(%lf, %lf): valori con decimali verranno troncati" -#: builtin.c:2461 +#: builtin.c:2622 #, c-format msgid "rshift(%lf, %lf): too large shift value will give strange results" msgstr "rshift(%lf, %lf): valori troppo alti daranno risultati strani" -#: builtin.c:2490 builtin.c:2492 +#: builtin.c:2648 msgid "and: received non-numeric first argument" msgstr "and: il primo argomento non è numerico" -#: builtin.c:2494 +#: builtin.c:2650 +msgid "and: received non-numeric second argument" +msgstr "and: il secondo argomento non è numerico" + +#: builtin.c:2656 #, c-format msgid "and(%lf, %lf): negative values will give strange results" msgstr "and(%lf, %lf): valori negativi daranno risultati strani" -#: builtin.c:2496 +#: builtin.c:2658 #, c-format msgid "and(%lf, %lf): fractional values will be truncated" msgstr "and(%lf, %lf): valori con decimali verranno troncati" -#: builtin.c:2525 builtin.c:2527 +#: builtin.c:2684 msgid "or: received non-numeric first argument" msgstr "or: il primo argomento non è numerico" -#: builtin.c:2529 +#: builtin.c:2686 +msgid "or: received non-numeric second argument" +msgstr "or: il secondo argomento non è numerico" + +#: builtin.c:2692 #, c-format msgid "or(%lf, %lf): negative values will give strange results" msgstr "or(%lf, %lf): valori negativi daranno risultati strani" -#: builtin.c:2531 +#: builtin.c:2694 #, c-format msgid "or(%lf, %lf): fractional values will be truncated" msgstr "or(%lf, %lf): valori con decimali verranno troncati" -#: builtin.c:2560 builtin.c:2562 +#: builtin.c:2720 msgid "xor: received non-numeric first argument" msgstr "xor: il primo argomento non è numerico" -#: builtin.c:2564 +#: builtin.c:2722 +msgid "xor: received non-numeric second argument" +msgstr "xor: il secondo argomento non è numerico" + +#: builtin.c:2728 #, c-format msgid "xor(%lf, %lf): negative values will give strange results" msgstr "xor(%lf, %lf): valori negativi daranno risultati strani" -#: builtin.c:2566 +#: builtin.c:2730 #, c-format msgid "xor(%lf, %lf): fractional values will be truncated" msgstr "xor(%lf, %lf): valori con decimali verranno troncati" -#: builtin.c:2594 +#: builtin.c:2754 msgid "compl: received non-numeric argument" msgstr "compl: l'argomento non è numerico" -#: builtin.c:2596 +#: builtin.c:2760 #, c-format msgid "compl(%lf): negative value will give strange results" msgstr "compl(%lf): valore negativo darà risultati strani" -#: builtin.c:2598 +#: builtin.c:2762 #, c-format msgid "compl(%lf): fractional value will be truncated" msgstr "compl(%lf): valore con decimali verrà troncato" -#: builtin.c:2771 +#: builtin.c:2935 #, c-format msgid "dcgettext: `%s' is not a valid locale category" msgstr "dcgettext: `%s' non è una categoria 'locale' valida" -#: eval.c:266 +#: eval.c:303 #, c-format msgid "unknown nodetype %d" msgstr "tipo nodo sconosciuto %d" -#: eval.c:312 +#: eval.c:350 msgid "buffer overflow in genflags2str" msgstr "superament limiti buffer in 'genflags2str'" -#: eval.c:647 +#: eval.c:382 eval.c:388 profile.c:837 +#, c-format +msgid "attempt to use array `%s' in a scalar context" +msgstr "tentativo di usare vettore `%s' in un contesto scalare" + +#: eval.c:730 #, c-format msgid "for loop: array `%s' changed size from %ld to %ld during loop execution" msgstr "" "ciclo for: vettore `%s' ha cambiato dimensione da %ld a %ld durante " "l'esecuzione del ciclo" -#: eval.c:668 +#: eval.c:751 msgid "`break' outside a loop is not portable" msgstr "`break' all'esterno di un ciclo non è portabile" -#: eval.c:672 +#: eval.c:755 msgid "`break' outside a loop is not allowed" msgstr "`break' all'esterno di un ciclo non è consentito" -#: eval.c:689 +#: eval.c:772 msgid "`continue' outside a loop is not portable" msgstr "`continue' all'esterno di un ciclo non è portabile" -#: eval.c:693 +#: eval.c:776 msgid "`continue' outside a loop is not allowed" msgstr "`continue' all'esterno di un ciclo non è consentito" -#: eval.c:727 +#: eval.c:810 msgid "`next' cannot be called from a BEGIN rule" msgstr "`next' non può essere chiamato da una regola BEGIN" -#: eval.c:729 +#: eval.c:812 msgid "`next' cannot be called from an END rule" msgstr "`next' non può essere chiamato da una regola END" -#: eval.c:738 +#: eval.c:821 msgid "`nextfile' cannot be called from a BEGIN rule" msgstr "`nextfile' non può essere chiamato da una regola BEGIN" -#: eval.c:740 +#: eval.c:823 msgid "`nextfile' cannot be called from an END rule" msgstr "`nextfile' non può essere chiamato da una regola END" -#: eval.c:785 +#: eval.c:872 msgid "statement has no effect" msgstr "istruzione che non fa nulla" -#: eval.c:828 eval.c:1726 +#: eval.c:915 eval.c:1873 #, c-format msgid "can't use function name `%s' as variable or array" msgstr "non posso usare nome di funzione `%s' come variabile o vettore" -#: eval.c:835 eval.c:841 +#: eval.c:922 eval.c:928 #, c-format msgid "reference to uninitialized argument `%s'" msgstr "referenza ad argomento non inizializzato `%s'" -#: eval.c:848 eval.c:907 eval.c:1732 eval.c:1742 profile.c:807 -#, c-format -msgid "attempt to use array `%s' in a scalar context" -msgstr "tentativo di usare vettore `%s' in un contesto scalare" - -#: eval.c:858 eval.c:1752 +#: eval.c:937 eval.c:1882 #, c-format msgid "reference to uninitialized variable `%s'" msgstr "referenza a variabile non inizializzata `%s'" -#: eval.c:1007 +#: eval.c:1083 msgid "" "concatenation: side effects in one expression have changed the length of " "another!" @@ -807,49 +828,50 @@ msgstr "" "concatenatione: effetti secondari in una espressione hanno modificato la " "lunghezza di un'altra espressione!" -#: eval.c:1032 +#: eval.c:1162 msgid "assignment used in conditional context" msgstr "assegnamento usato nel contesto di un test condizionale" -#: eval.c:1122 +#: eval.c:1252 msgid "division by zero attempted" msgstr "tentativo di dividere per zero" -#: eval.c:1137 +#: eval.c:1267 #, c-format msgid "division by zero attempted in `%%'" msgstr "divisione per zero tentata in `%%'" -#: eval.c:1152 profile.c:683 +#: eval.c:1282 profile.c:713 #, c-format msgid "illegal type (%s) in tree_eval" msgstr "tipo non ammesso (%s) in 'tree_eval'" -#: eval.c:1328 +#: eval.c:1459 msgid "division by zero attempted in `/='" msgstr "divisione per zero tentata in `/='" -#: eval.c:1346 +#: eval.c:1477 #, c-format msgid "division by zero attempted in `%%='" msgstr "divisione per zero tentata in `%%='" -#: eval.c:1586 +#: eval.c:1738 #, c-format msgid "function `%s' called with more arguments than declared" msgstr "funzione `%s' chiamata con più argomenti di quelli previsti" -#: eval.c:1633 +#: eval.c:1782 #, c-format msgid "function `%s' not defined" msgstr "funzione `%s' non definita" -#: eval.c:1639 +#: eval.c:1788 #, c-format msgid "function %s called\n" msgstr "funzione %s chiamata\n" -#: eval.c:1698 +#: eval.c:1845 +#, c-format msgid "" "\n" "\t# Function Call Stack:\n" @@ -859,41 +881,42 @@ msgstr "" "\t# 'Stack' (Pila) Chiamate Funzione:\n" "\n" -#: eval.c:1701 +#: eval.c:1848 +#, c-format msgid "\t# -- main --\n" msgstr "\t# -- principale --\n" -#: eval.c:1867 +#: eval.c:2003 msgid "attempt to field reference from non-numeric value" msgstr "tentativo di referenziare campo da valore non numerico" -#: eval.c:1869 +#: eval.c:2005 msgid "attempt to reference from null string" msgstr "tentativo to referenziare da stringa nulla" -#: eval.c:1875 +#: eval.c:2011 #, c-format msgid "attempt to access field %d" msgstr "tentativo di accedere al campo %d" -#: eval.c:1896 eval.c:1903 profile.c:900 +#: eval.c:2032 eval.c:2039 profile.c:934 msgid "assignment is not allowed to result of builtin function" msgstr "assegnamento non permesso al risultato di una funzione interna" -#: eval.c:1951 +#: eval.c:2103 msgid "`IGNORECASE' is a gawk extension" msgstr "`IGNORECASE' è un'estensione gawk" -#: eval.c:1980 +#: eval.c:2133 msgid "`BINMODE' is a gawk extension" msgstr "`BINMODE' è un'estensione gawk" -#: eval.c:2092 +#: eval.c:2255 #, c-format msgid "bad `%sFMT' specification `%s'" msgstr "specificazione invalida `%sFMT' `%s'" -#: eval.c:2170 +#: eval.c:2333 msgid "turning off `--lint' due to assignment to `LINT'" msgstr "disabilito `--lint' a causa di assegnamento a `LINT'" @@ -904,14 +927,65 @@ msgstr "`extension' #: ext.c:74 #, c-format msgid "extension: cannot open `%s' (%s)\n" -msgstr "extension: non riesco ad aprire `%s' (%s)\n" +msgstr "estensione: non riesco ad aprire `%s' (%s)\n" #: ext.c:82 #, c-format msgid "extension: library `%s': cannot call function `%s' (%s)\n" -msgstr "extension: biblioteca `%s': non riesco a chiamare funzione `%s' (%s)\n" +msgstr "" +"estensione: biblioteca `%s': non riesco a chiamare funzione `%s' (%s)\n" + +#: ext.c:102 +msgid "extension: missing function name" +msgstr "estensione: manca nome di funzione" + +#: ext.c:107 +#, c-format +msgid "extension: illegal character `%c' in function name `%s'" +msgstr "estensione: carattere non ammesso `%c' nel nome di funzione `%s'" + +#: ext.c:113 +#, c-format +msgid "extension: can't redefine function `%s'" +msgstr "estensione: non riesco a ridefinire funzione `%s'" + +#: ext.c:117 +#, c-format +msgid "extension: function `%s' already defined" +msgstr "estensione: funzione `%s' già definita" + +#: ext.c:122 +#, c-format +msgid "extension: can't use gawk built-in `%s' as function name" +msgstr "" +"estensione: nome funzione interna gawk `%s' non ammesso come nome funzione" -#: ext.c:183 +#: ext.c:124 +#, c-format +msgid "extension: function name `%s' previously defined" +msgstr "estensione: funzione di nome `%s' definita in precedenza" + +#: ext.c:201 +#, c-format +msgid "function `%s' defined to take no more than `%d' argument(s)" +msgstr "funzione `%s' definita con al massimo `%d' argumenti/o" + +#: ext.c:204 +#, c-format +msgid "function `%s': missing argument #%d" +msgstr "funzione `%s': manca argomento #%d" + +#: ext.c:214 +#, c-format +msgid "function `%s': argument #%d: attempt to use scalar as an array" +msgstr "funzione `%s': argomento #%d: tentativo di usare scalare come vettore" + +#: ext.c:218 +#, c-format +msgid "function `%s': argument #%d: attempt to use array as a scalar" +msgstr "funzione `%s': argomento #%d: tentativo di usare vettore come scalare" + +#: ext.c:243 msgid "Operation Not Supported" msgstr "Operazione Non Supportata" @@ -940,526 +1014,526 @@ msgstr "campo %d in FIELDWIDTHS, deve essere > 0" msgid "null string for `FS' is a gawk extension" msgstr "la stringa nulla usata come `FS' è un'estensione gawk" -#: getopt.c:692 getopt.c:704 +#: getopt.c:692 getopt.c:711 #, c-format msgid "%s: option `%s' is ambiguous\n" msgstr "%s: opzione `%s' ambigua\n" -#: getopt.c:737 getopt.c:741 +#: getopt.c:744 getopt.c:748 #, c-format msgid "%s: option `--%s' doesn't allow an argument\n" msgstr "%s: opzione `--%s' non prevede un argomento\n" -#: getopt.c:750 getopt.c:755 +#: getopt.c:757 getopt.c:762 #, c-format msgid "%s: option `%c%s' doesn't allow an argument\n" msgstr "%s: opzione `%c%s' non prevede un argomento\n" -#: getopt.c:791 getopt.c:804 getopt.c:1093 getopt.c:1106 +#: getopt.c:807 getopt.c:829 getopt.c:1159 getopt.c:1181 #, c-format msgid "%s: option `%s' requires an argument\n" msgstr "%s: opzione `%s' richiede un argomento\n" -#: getopt.c:842 getopt.c:845 +#: getopt.c:867 getopt.c:870 #, c-format msgid "%s: unrecognized option `--%s'\n" msgstr "%s: opzione sconosciuta `--%s'\n" -#: getopt.c:853 getopt.c:856 +#: getopt.c:878 getopt.c:881 #, c-format msgid "%s: unrecognized option `%c%s'\n" msgstr "%s: opzione sconosciuta `%c%s'\n" -#: getopt.c:903 getopt.c:906 +#: getopt.c:936 getopt.c:939 #, c-format msgid "%s: illegal option -- %c\n" msgstr "%s: opzione non permessa -- %c\n" -#: getopt.c:912 getopt.c:915 +#: getopt.c:945 getopt.c:948 #, c-format msgid "%s: invalid option -- %c\n" msgstr "%s: opzione non valida -- %c\n" -#: getopt.c:962 getopt.c:973 getopt.c:1159 getopt.c:1172 main.c:434 +#: getopt.c:1003 getopt.c:1022 getopt.c:1234 getopt.c:1255 main.c:433 #, c-format msgid "%s: option requires an argument -- %c\n" msgstr "%s: l'opzione richiede un argomento -- %c\n" -#: getopt.c:1025 getopt.c:1036 +#: getopt.c:1074 getopt.c:1093 #, c-format msgid "%s: option `-W %s' is ambiguous\n" msgstr "%s: opzione `-W %s' ambigua\n" -#: getopt.c:1060 getopt.c:1072 +#: getopt.c:1117 getopt.c:1138 #, c-format msgid "%s: option `-W %s' doesn't allow an argument\n" msgstr "%s: opzione `-W %s' non prevede un argomento\n" -#: io.c:305 +#: io.c:308 #, c-format msgid "cannot open file `%s' for reading (%s)" msgstr "non riesco ad aprire file `%s' in lettura (%s)" -#: io.c:392 +#: io.c:395 #, c-format msgid "close of fd %d (`%s') failed (%s)" msgstr "chiusura di fd %d (`%s') fallita (%s)" -#: io.c:530 +#: io.c:533 #, c-format msgid "invalid tree type %s in redirect()" msgstr "tipo di albero invalido %s in redirect()" -#: io.c:536 +#: io.c:539 #, c-format msgid "expression in `%s' redirection only has numeric value" msgstr "espressione nella re-direzione `%s' ha solo un valore numerico" -#: io.c:542 +#: io.c:545 #, c-format msgid "expression for `%s' redirection has null string value" msgstr "espressione nella re-direzione `%s' ha per valore la stringa nulla" -#: io.c:547 +#: io.c:550 #, c-format msgid "filename `%s' for `%s' redirection may be result of logical expression" msgstr "" "nome file `%s' per la re-direzione `%s' può essere il risultato di una " "espressione logica" -#: io.c:569 +#: io.c:588 #, c-format msgid "unnecessary mixing of `>' and `>>' for file `%.*s'" msgstr "mistura non necessaria di `>' e `>>' per il file `%.*s'" -#: io.c:621 +#: io.c:640 #, c-format msgid "can't open pipe `%s' for output (%s)" msgstr "non posso aprire 'pipe' `%s' in scrittura (%s)" -#: io.c:630 +#: io.c:649 #, c-format msgid "can't open pipe `%s' for input (%s)" msgstr "non posso aprire 'pipe' `%s' in lettura (%s)" -#: io.c:643 +#: io.c:662 #, c-format msgid "can't open two way socket `%s' for input/output (%s)" msgstr "" "non posso aprire 'socket' bidirezionale `%s' per lettura/scrittura (%s)" -#: io.c:647 +#: io.c:666 #, c-format msgid "can't open two way pipe `%s' for input/output (%s)" msgstr "non posso aprire 'pipe' bidirezionale `%s' per lettura/scrittura (%s)" -#: io.c:723 +#: io.c:742 #, c-format msgid "can't redirect from `%s' (%s)" msgstr "non posso re-dirigere da `%s' (%s)" -#: io.c:726 +#: io.c:745 #, c-format msgid "can't redirect to `%s' (%s)" msgstr "non posso re-dirigere a `%s' (%s)" -#: io.c:765 +#: io.c:784 msgid "" "reached system limit for open files: starting to multiplex file descriptors" msgstr "" "numero massimo consentito di file aperti raggiunto: comincio a riutilizzare " "i descrittori di file" -#: io.c:777 +#: io.c:800 #, c-format msgid "close of `%s' failed (%s)." msgstr "chiusura di `%s' fallita (%s)." -#: io.c:784 +#: io.c:808 msgid "too many pipes or input files open" msgstr "troppe 'pipe' o file di input aperti" -#: io.c:807 +#: io.c:831 msgid "close: second argument must be `to' or `from'" msgstr "close: il secondo argomento deve essere `a' o `da'" -#: io.c:821 +#: io.c:845 #, c-format msgid "close: `%.*s' is not an open file, pipe or co-process" msgstr "close: `%.*s' non è un file aperto, una 'pipe' o un co-processo" -#: io.c:825 +#: io.c:849 msgid "close of redirection that was never opened" msgstr "chiusura di una re-direzione mai aperta" -#: io.c:862 +#: io.c:945 #, c-format msgid "close: redirection `%s' not opened with `|&', second argument ignored" msgstr "close: re-direzione `%s' non aperta con `|&', ignoro secondo argomento" -#: io.c:924 +#: io.c:960 #, c-format msgid "failure status (%d) on pipe close of `%s' (%s)" msgstr "errore ritornato (%d) dalla chiusura della 'pipe' `%s' (%s)" -#: io.c:927 +#: io.c:963 #, c-format msgid "failure status (%d) on file close of `%s' (%s)" msgstr "errore ritornato (%d) dalla chiusura del file `%s' (%s)" -#: io.c:946 +#: io.c:983 #, c-format msgid "no explicit close of socket `%s' provided" msgstr "nessuna chiusura esplicita richiesta per 'socket' `%s'" -#: io.c:949 +#: io.c:986 #, c-format msgid "no explicit close of co-process `%s' provided" msgstr "nessuna chiusura esplicita richiesta per co-processo `%s'" -#: io.c:952 +#: io.c:989 #, c-format msgid "no explicit close of pipe `%s' provided" msgstr "nessuna chiusura esplicita richiesta per 'pipe' `%s'" -#: io.c:955 +#: io.c:992 #, c-format msgid "no explicit close of file `%s' provided" msgstr "nessuna chiusura esplicita richiesta per file `%s'" -#: io.c:984 io.c:1038 +#: io.c:1021 io.c:1075 #, c-format msgid "error writing standard output (%s)" msgstr "errore scrivendo 'standard output' (%s)" -#: io.c:988 io.c:1042 +#: io.c:1025 io.c:1079 #, c-format msgid "error writing standard error (%s)" msgstr "errore scrivendo 'standard error' (%s)" -#: io.c:996 +#: io.c:1033 #, c-format msgid "pipe flush of `%s' failed (%s)." msgstr "scaricamento di 'pipe' `%s' fallita (%s)." -#: io.c:999 +#: io.c:1036 #, c-format msgid "co-process flush of pipe to `%s' failed (%s)." msgstr "scaricamento da co-processo di 'pipe' a `%s' fallita (%s)." -#: io.c:1002 +#: io.c:1039 #, c-format msgid "file flush of `%s' failed (%s)." msgstr "scaricamento di file `%s' fallita (%s)." -#: io.c:1161 +#: io.c:1198 msgid "/inet/raw client not ready yet, sorry" msgstr "spiacente, 'client' /inet/raw non ancora pronto" -#: io.c:1163 io.c:1200 +#: io.c:1200 io.c:1237 msgid "only root may use `/inet/raw'." msgstr "solo root può usare `/inet/raw'." -#: io.c:1198 +#: io.c:1235 msgid "/inet/raw server not ready yet, sorry" msgstr "spiacente, 'server' /inet/raw non ancora pronto" -#: io.c:1288 +#: io.c:1325 #, c-format msgid "no (known) protocol supplied in special filename `%s'" msgstr "nessuno protocollo (conosciuto) specificato nel filename speciale `%s'" -#: io.c:1306 +#: io.c:1343 #, c-format msgid "special file name `%s' is incomplete" msgstr "nome file speciale `%s' incompleto" -#: io.c:1318 +#: io.c:1355 #, c-format msgid "local port invalid in `%s'" msgstr "porta locale invalida in `%s'" -#: io.c:1330 +#: io.c:1367 msgid "must supply a remote hostname to `/inet'" msgstr "va fornito nome di 'host' remoto a `/inet'" -#: io.c:1345 +#: io.c:1382 msgid "must supply a remote port to `/inet'" msgstr "va fornita porta remota a `/inet'" -#: io.c:1351 +#: io.c:1388 #, c-format msgid "remote port invalid in `%s'" msgstr "porta remota invalida in `%s'" -#: io.c:1361 +#: io.c:1398 msgid "TCP/IP communications are not supported" msgstr "comunicazioni TCP/IP non supportate" -#: io.c:1370 io.c:1551 +#: io.c:1407 io.c:1588 #, c-format msgid "file `%s' is a directory" msgstr "file `%s' è una 'directory'" -#: io.c:1440 +#: io.c:1477 #, c-format msgid "use `PROCINFO[\"%s\"]' instead of `%s'" msgstr "usa `PROCINFO[\"%s\"]' invece che `%s'" -#: io.c:1472 +#: io.c:1509 msgid "use `PROCINFO[...]' instead of `/dev/user'" msgstr "usa `PROCINFO[...]' invece che `/dev/user'" -#: io.c:1537 io.c:1711 +#: io.c:1574 io.c:1748 #, c-format msgid "could not open `%s', mode `%s'" msgstr "non riesco ad aprire `%s', modo `%s'" -#: io.c:1762 +#: io.c:1799 #, c-format msgid "close of master pty failed (%s)" msgstr "fallita chiusura di 'pty' principale (%s)" -#: io.c:1764 io.c:1916 io.c:2068 +#: io.c:1801 io.c:1953 io.c:2105 #, c-format msgid "close of stdout in child failed (%s)" msgstr "fallita chiusura di 'stdout' nel processo-figlio (%s)" -#: io.c:1767 +#: io.c:1804 #, c-format msgid "moving slave pty to stdout in child failed (dup: %s)" msgstr "" "fallito trasferimento di 'pty' secondaria a 'stdout' nel processo-figlio " "(dup: %s)" -#: io.c:1769 io.c:1921 +#: io.c:1806 io.c:1958 #, c-format msgid "close of stdin in child failed (%s)" msgstr "fallita chiusura di 'stdin' nel processo-figlio (%s)" -#: io.c:1772 +#: io.c:1809 #, c-format msgid "moving slave pty to stdin in child failed (dup: %s)" msgstr "" "fallito trasferimento di 'pty' secondaria a 'stdin' nel processo-figlio " "(dup: %s)" -#: io.c:1774 io.c:1793 +#: io.c:1811 io.c:1830 #, c-format msgid "close of slave pty failed (%s)" msgstr "fallita chiusura di 'pty' secondaria (%s)" -#: io.c:1867 io.c:1919 io.c:2049 io.c:2071 +#: io.c:1904 io.c:1956 io.c:2086 io.c:2108 #, c-format msgid "moving pipe to stdout in child failed (dup: %s)" msgstr "fallito passaggio di 'pipe' a 'stdout' nel processo-figlio (dup: %s)" -#: io.c:1871 io.c:1924 +#: io.c:1908 io.c:1961 #, c-format msgid "moving pipe to stdin in child failed (dup: %s)" msgstr "fallito passaggio di pipe a 'stdin' nel processo-figlio (dup: %s)" -#: io.c:1888 io.c:2062 +#: io.c:1925 io.c:2099 msgid "restoring stdout in parent process failed\n" msgstr "fallito ripristino di 'stdout' nel processo-padre\n" -#: io.c:1893 +#: io.c:1930 msgid "restoring stdin in parent process failed\n" msgstr "fallito ripristino di 'stdin' nel processo-padre\n" -#: io.c:1927 io.c:2073 io.c:2084 +#: io.c:1964 io.c:2110 io.c:2121 #, c-format msgid "close of pipe failed (%s)" msgstr "fallita chiusura di 'pipe' (%s)" -#: io.c:1972 +#: io.c:2009 msgid "`|&' not supported" msgstr "`|&' non supportato" -#: io.c:2039 +#: io.c:2076 #, c-format msgid "cannot open pipe `%s' (%s)" msgstr "non riesco ad aprire 'pipe' `%s' (%s)" -#: io.c:2080 +#: io.c:2117 #, c-format msgid "cannot create child process for `%s' (fork: %s)" msgstr "non riesco a creare processo-figlio per `%s' (fork: %s)" -#: io.c:2423 +#: io.c:2460 #, c-format msgid "data file `%s' is empty" msgstr "file dati `%s' vuoto" -#: io.c:2466 io.c:2474 +#: io.c:2503 io.c:2511 msgid "could not allocate more input memory" msgstr "non riesco ad allocare ulteriore memoria per l'input" -#: io.c:2832 io.c:2895 +#: io.c:2869 io.c:2932 #, c-format msgid "error reading input file `%s': %s" msgstr "errore leggendo file di input `%s': %s" -#: io.c:3020 +#: io.c:3057 msgid "multicharacter value of `RS' is a gawk extension" msgstr "valore multicarattere per `RS' è un'estensione gawk" -#: main.c:324 +#: main.c:323 msgid "`-m[fr]' option irrelevant in gawk" msgstr "`-m[fr]' opzione irrilevante per gawk" -#: main.c:326 +#: main.c:325 msgid "-m option usage: `-m[fr] nnn'" msgstr "-m uso opzione: `-m[fr] nnn'" -#: main.c:343 +#: main.c:342 #, c-format msgid "%s: option `-W %s' unrecognized, ignored\n" msgstr "%s: opzione `-W %s' non riconosciuta, ignorata\n" -#: main.c:380 +#: main.c:379 msgid "empty argument to `--source' ignored" msgstr "argomento di `--source' mancante, comando ignorato" -#: main.c:451 +#: main.c:450 msgid "environment variable `POSIXLY_CORRECT' set: turning on `--posix'" msgstr "variable d'ambiente `POSIXLY_CORRECT' impostata: attivo `--posix'" -#: main.c:456 +#: main.c:455 msgid "`--posix' overrides `--traditional'" msgstr "`--posix' annulla `--traditional'" -#: main.c:467 +#: main.c:466 msgid "`--posix'/`--traditional' overrides `--non-decimal-data'" msgstr "`--posix'/`--traditional' annulla `--non-decimal-data'" -#: main.c:471 +#: main.c:470 #, c-format msgid "running %s setuid root may be a security problem" msgstr "eseguire %s con 'setuid' root può essere un rischio per la sicurezza" -#: main.c:512 +#: main.c:511 #, c-format msgid "can't set binary mode on stdin (%s)" msgstr "non posso impostare modalità binaria su 'stdin'(%s)" -#: main.c:515 +#: main.c:514 #, c-format msgid "can't set binary mode on stdout (%s)" msgstr "non posso impostare modalità binaria su 'stdout'(%s)" -#: main.c:517 +#: main.c:516 #, c-format msgid "can't set binary mode on stderr (%s)" msgstr "non posso impostare modalità binaria su 'stderr'(%s)" -#: main.c:547 +#: main.c:546 msgid "no program text at all!" msgstr "manca del tutto il testo del programma!" -#: main.c:620 +#: main.c:623 #, c-format msgid "Usage: %s [POSIX or GNU style options] -f progfile [--] file ...\n" msgstr "Uso: %s [opzioni in stile POSIX o GNU] -f fileprog [--] file ...\n" -#: main.c:622 +#: main.c:625 #, c-format msgid "Usage: %s [POSIX or GNU style options] [--] %cprogram%c file ...\n" msgstr "Usage: %s [opzioni in stile POSIX o GNU] [--] %cprogramma%c file ...\n" -#: main.c:627 +#: main.c:630 msgid "POSIX options:\t\tGNU long options:\n" msgstr "Opzioni POSIX:\t\topzioni lunghe GNU:\n" -#: main.c:628 +#: main.c:631 msgid "\t-f progfile\t\t--file=progfile\n" msgstr "\t-f fileprog\t\t--file=fileprog\n" -#: main.c:629 +#: main.c:632 msgid "\t-F fs\t\t\t--field-separator=fs\n" msgstr "\t-F fs\t\t\t--field-separator=fs\n" -#: main.c:630 +#: main.c:633 msgid "\t-v var=val\t\t--assign=var=val\n" msgstr "\t-v var=valore\t\t--assign=var=valore\n" -#: main.c:631 +#: main.c:634 msgid "\t-m[fr] val\n" msgstr "\t-m[fr] valore\n" -#: main.c:632 +#: main.c:635 msgid "\t-W compat\t\t--compat\n" msgstr "\t-W compat\t\t--compat\n" -#: main.c:633 +#: main.c:636 msgid "\t-W copyleft\t\t--copyleft\n" msgstr "\t-W copyleft\t\t--copyleft\n" -#: main.c:634 +#: main.c:637 msgid "\t-W copyright\t\t--copyright\n" msgstr "\t-W copyright\t\t--copyright\n" -#: main.c:635 +#: main.c:638 msgid "\t-W dump-variables[=file]\t--dump-variables[=file]\n" msgstr "\t-W dump-variables[=file]\t--dump-variables[=file]\n" -#: main.c:636 +#: main.c:639 msgid "\t-W gen-po\t\t--gen-po\n" msgstr "\t-W gen-po\t\t--gen-po\n" -#: main.c:637 +#: main.c:640 msgid "\t-W help\t\t\t--help\n" msgstr "\t-W help\t\t\t--help\n" -#: main.c:638 +#: main.c:641 msgid "\t-W lint[=fatal]\t\t--lint[=fatal]\n" msgstr "\t-W lint[=fatal]\t\t--lint[=fatal]\n" -#: main.c:639 +#: main.c:642 msgid "\t-W lint-old\t\t--lint-old\n" msgstr "\t-W lint-old\t\t--lint-old\n" -#: main.c:640 +#: main.c:643 msgid "\t-W non-decimal-data\t--non-decimal-data\n" msgstr "\t-W non-decimal-data\t--non-decimal-data\n" -#: main.c:642 +#: main.c:645 msgid "\t-W nostalgia\t\t--nostalgia\n" msgstr "\t-W nostalgia\t\t--nostalgia\n" -#: main.c:645 +#: main.c:648 msgid "\t-W parsedebug\t\t--parsedebug\n" msgstr "\t-W parsedebug\t\t--parsedebug\n" -#: main.c:647 +#: main.c:650 msgid "\t-W profile[=file]\t--profile[=file]\n" msgstr "\t-W profile[=file]\t--profile[=file]\n" -#: main.c:648 +#: main.c:651 msgid "\t-W posix\t\t--posix\n" msgstr "\t-W posix\t\t--posix\n" -#: main.c:649 +#: main.c:652 msgid "\t-W re-interval\t\t--re-interval\n" msgstr "\t-W re-interval\t\t--re-interval\n" -#: main.c:650 +#: main.c:653 msgid "\t-W source=program-text\t--source=program-text\n" msgstr "\t-W source=testo-programma\t--source=testo-programma\n" -#: main.c:651 +#: main.c:654 msgid "\t-W traditional\t\t--traditional\n" msgstr "\t-W traditional\t\t--traditional\n" -#: main.c:652 +#: main.c:655 msgid "\t-W usage\t\t--usage\n" msgstr "\t-W usage\t\t--usage\n" -#: main.c:653 +#: main.c:656 msgid "\t-W version\t\t--version\n" msgstr "\t-W version\t\t--version\n" -#: main.c:657 +#: main.c:660 msgid "" "\n" "To report bugs, see node `Bugs' in `gawk.info', which is\n" @@ -1471,7 +1545,7 @@ msgstr "" "sezione `Reporting Problems and Bugs' nella versione a stampa.\n" "\n" -#: main.c:661 +#: main.c:664 msgid "" "gawk is a pattern scanning and processing language.\n" "By default it reads standard input and writes standard output.\n" @@ -1481,7 +1555,7 @@ msgstr "" "Senza parametri, legge da 'standard input' e scrive su 'standard output'.\n" "\n" -#: main.c:665 +#: main.c:668 msgid "" "Examples:\n" "\tgawk '{ sum += $1 }; END { print sum }' file\n" @@ -1491,7 +1565,7 @@ msgstr "" "\tgawk '{ sum += $1 }; END { print sum }' file\n" "\tgawk -F: '{ print $1 }' /etc/passwd\n" -#: main.c:682 +#: main.c:685 #, c-format msgid "" "Copyright (C) 1989, 1991-%d Free Software Foundation.\n" @@ -1510,7 +1584,7 @@ msgstr "" "Licenza, o (a tua scelta) a una qualsiasi versione successiva.\n" "\n" -#: main.c:690 +#: main.c:693 msgid "" "This program is distributed in the hope that it will be useful,\n" "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" @@ -1524,7 +1598,7 @@ msgstr "" "Vedi la 'GNU General Public License' per ulteriori dettagli.\n" "\n" -#: main.c:696 +#: main.c:699 msgid "" "You should have received a copy of the GNU General Public License\n" "along with this program; if not, write to the Free Software\n" @@ -1534,11 +1608,11 @@ msgstr "" "assieme a questo programma; se non è così, scrivi alla Free Software\n" "Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n" -#: main.c:730 +#: main.c:733 msgid "-Ft does not set FS to tab in POSIX awk" msgstr "-Ft non imposta FS a 'tab' nell'awk POSIX" -#: main.c:956 +#: main.c:962 #, c-format msgid "" "%s: `%s' argument to `-v' not in `var=value' form\n" @@ -1547,40 +1621,41 @@ msgstr "" "%s: `%s' argomento di `-v' non in forma `var=valore'\n" "\n" -#: main.c:976 +#: main.c:982 #, c-format msgid "`%s' is not a legal variable name" msgstr "`%s' non è un nome di variabile ammesso" -#: main.c:979 +#: main.c:985 #, c-format msgid "`%s' is not a variable name, looking for file `%s=%s'" msgstr "`%s' non è un nome di variabile, cerco il file `%s=%s'" -#: main.c:1012 +#: main.c:1018 msgid "floating point exception" msgstr "eccezione floating point" -#: main.c:1019 +#: main.c:1025 msgid "fatal error: internal error" msgstr "errore fatale: errore interno" -#: main.c:1069 +#: main.c:1075 #, c-format msgid "no pre-opened fd %d" msgstr "manca 'fd' predefinita %d" -#: main.c:1074 +#: main.c:1082 #, c-format msgid "could not pre-open /dev/null for fd %d" msgstr "non riesco a predefinire /dev/null per 'fd' %d" -#: main.c:1097 main.c:1106 +#: main.c:1105 main.c:1114 #, c-format msgid "could not find groups: %s" msgstr "non riesco a trovare gruppi: %s" #: msg.c:54 +#, c-format msgid "cmd. line:" msgstr "linea progr.:" @@ -1600,19 +1675,19 @@ msgstr "fatale: " msgid "can't convert string to float" msgstr "non riesco a convertire stringa a valore in virgola mobile" -#: node.c:355 +#: node.c:357 msgid "backslash at end of string" msgstr "'\\' a fine stringa" -#: node.c:539 +#: node.c:541 msgid "POSIX does not allow `\\x' escapes" msgstr "POSIX non permette formato `\\x'" -#: node.c:545 +#: node.c:547 msgid "no hex digits in `\\x' escape sequence" msgstr "niente cifre esadecimanli nel formato `\\x'" -#: node.c:579 +#: node.c:581 #, c-format msgid "escape sequence `\\%c' treated as plain `%c'" msgstr " sequenza in formato `\\%c' considerata come semplice `%c'" @@ -1627,21 +1702,27 @@ msgstr "%s %s `%s': non riesco a impostare 'close-on-exec': (fcntl: %s)" msgid "could not open `%s' for writing: %s" msgstr "non riesco ad aprire `%s' in scrittura: %s" -#: profile.c:449 +#: profile.c:467 #, c-format msgid "internal error: %s with null vname" msgstr "errore interno: %s con 'vname' nullo" -#: profile.c:512 +#: profile.c:530 msgid "# treated internally as `delete'" msgstr "# gestito internamente come 'delete' (cancellazione)" -#: profile.c:1162 +#: profile.c:1167 +#, c-format +msgid "# this is a dynamically loaded extension function" +msgstr "# questa è una funzione di estensione caricata dinamicamente" + +#: profile.c:1198 #, c-format msgid "\t# gawk profile, created %s\n" msgstr "\t# profilo gawk, creato %s\n" -#: profile.c:1165 +#: profile.c:1201 +#, c-format msgid "" "\t# BEGIN block(s)\n" "\n" @@ -1649,7 +1730,8 @@ msgstr "" "\t# blocco(hi) BEGIN\n" "\n" -#: profile.c:1175 +#: profile.c:1211 +#, c-format msgid "" "\t# Rule(s)\n" "\n" @@ -1657,7 +1739,8 @@ msgstr "" "\t# Regola(e)\n" "\n" -#: profile.c:1181 +#: profile.c:1217 +#, c-format msgid "" "\t# END block(s)\n" "\n" @@ -1665,7 +1748,8 @@ msgstr "" "\t# blocco(hi) END\n" "\n" -#: profile.c:1201 +#: profile.c:1237 +#, c-format msgid "" "\n" "\t# Functions, listed alphabetically\n" @@ -1673,89 +1757,79 @@ msgstr "" "\n" "\t# Funzioni, listate in ordine alfabetico\n" -#: profile.c:1413 +#: profile.c:1452 #, c-format msgid "unexpected type %s in prec_level" msgstr "tipo non previsto %s in 'prec_level'" -#: re.c:193 -#, c-format -msgid "regex match failed, not enough memory to match string \"%.*s%s\"" -msgstr "" -"fallita ricerca di 'espressione regolare', non c'è memoria sufficiente a " -"ricercare la stringa \"%.*s%s\"" - -#: regcomp.c:136 +#: regcomp.c:150 msgid "Success" msgstr "Successo" -#: regcomp.c:139 +#: regcomp.c:153 msgid "No match" msgstr "Nessuna corrispondenza" -#: regcomp.c:142 +#: regcomp.c:156 msgid "Invalid regular expression" msgstr "Espressione regolare invalida" -#: regcomp.c:145 +#: regcomp.c:159 msgid "Invalid collation character" msgstr "Carattere di ordinamento non valido" -#: regcomp.c:148 +#: regcomp.c:162 msgid "Invalid character class name" msgstr "Nome di 'classe di caratteri' invalido" -#: regcomp.c:151 +#: regcomp.c:165 msgid "Trailing backslash" msgstr "'\\' finale" -#: regcomp.c:154 +#: regcomp.c:168 msgid "Invalid back reference" msgstr "Riferimento indietro invalido" -#: regcomp.c:157 +#: regcomp.c:171 msgid "Unmatched [ or [^" msgstr "[ or [^ non chiusa" -#: regcomp.c:160 +#: regcomp.c:174 msgid "Unmatched ( or \\(" msgstr "( or \\( non chiusa" -#: regcomp.c:163 +#: regcomp.c:177 msgid "Unmatched \\{" msgstr "\\{ non chiusa" -#: regcomp.c:166 +#: regcomp.c:180 msgid "Invalid content of \\{\\}" msgstr "Contenuto di \\{\\} invalido" -#: regcomp.c:169 +#: regcomp.c:183 msgid "Invalid range end" msgstr "Fine di intervallo invalido" -#: regcomp.c:172 +#: regcomp.c:186 msgid "Memory exhausted" msgstr "Memoria esaurita" -#: regcomp.c:175 +#: regcomp.c:189 msgid "Invalid preceding regular expression" msgstr "Espressione regolare precedente invalida" -#: regcomp.c:178 +#: regcomp.c:192 msgid "Premature end of regular expression" msgstr "Fine di expressione regolare inaspettata" -#: regcomp.c:181 +#: regcomp.c:195 msgid "Regular expression too big" msgstr "Espressione regolare troppo complessa" -#: regcomp.c:184 +#: regcomp.c:198 msgid "Unmatched ) or \\)" msgstr ") or \\) non aperta" -#: regcomp.c:621 +#: regcomp.c:668 msgid "No previous regular expression" msgstr "Nessuna espressione regolare precedente" - -#~ msgid "substr: length %g is < 0" -#~ msgstr "substr: lunghezza %g < 0" diff --git a/po/ja.gmo b/po/ja.gmo new file mode 100644 index 000000000..bda67809a Binary files /dev/null and b/po/ja.gmo differ diff --git a/po/ja.po b/po/ja.po new file mode 100644 index 000000000..d524a1785 --- /dev/null +++ b/po/ja.po @@ -0,0 +1,1860 @@ +# Japanese messages for gawk. +# Copyright (C) 2003 Free Software Foundation, Inc. +# This file is distributed under the same license as the gawk package. +# Makoto Hosoya , 2003. +# +msgid "" +msgstr "" +"Project-Id-Version: gawk 3.1.2g\n" +"Report-Msgid-Bugs-To: arnold@skeeve.com\n" +"POT-Creation-Date: 2004-07-15 13:02+0300\n" +"PO-Revision-Date: 2003-08-26 03:06+0900\n" +"Last-Translator: Makoto Hosoya \n" +"Language-Team: Japanese \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=EUC-JP\n" +"Content-Transfer-Encoding: 8bit\n" + +#: array.c:112 +#, fuzzy, c-format +msgid "attempt to use function `%s' as an array" +msgstr "¥¹¥«¥é¡¼ `%s' ¤òÇÛÎó¤È¤·¤Æ»ÈÍѤ·¤Æ¤¤¤Þ¤¹¡£" + +#: array.c:115 +#, c-format +msgid "attempt to use scalar parameter `%s' as an array" +msgstr "¥¹¥«¥é¡¼¥Ñ¥é¥á¡¼¥¿ `%s' ¤òÇÛÎó¤È¤·¤Æ»ÈÍѤ·¤Æ¤¤¤Þ¤¹¡£" + +#: array.c:118 +#, c-format +msgid "attempt to use scalar `%s' as array" +msgstr "¥¹¥«¥é¡¼ `%s' ¤òÇÛÎó¤È¤·¤Æ»ÈÍѤ·¤Æ¤¤¤Þ¤¹¡£" + +#: array.c:156 +#, c-format +msgid "from %s" +msgstr "%s ¤«¤é" + +#: array.c:511 +#, c-format +msgid "reference to uninitialized element `%s[\"%s\"]'" +msgstr "½é´ü²½¤µ¤ì¤Æ¤¤¤Ê¤¤Í×ÁÇ `%s[\"%s\"]' ¤ò»²¾È¤·¤Æ¤¤¤Þ¤¹¡£" + +#: array.c:517 +#, c-format +msgid "subscript of array `%s' is null string" +msgstr "ÇÛÎó¤Îź»ú `%s' ¤¬¶õÎó¤Ç¤¹¡£" + +#: array.c:621 +#, c-format +msgid "delete: index `%s' not in array `%s'" +msgstr "delete: ÇÛÎó `%2$s' ¤Ë»Øɸ `%1$s' ¤Ï¤¢¤ê¤Þ¤»¤ó¡£" + +#: array.c:791 +#, c-format +msgid "%s: empty (null)\n" +msgstr "%s: ¶õ (null)\n" + +#: array.c:796 +#, c-format +msgid "%s: empty (zero)\n" +msgstr "%s: ¶õ (zero)\n" + +#: array.c:800 +#, c-format +msgid "%s: table_size = %d, array_size = %d\n" +msgstr "%s: ¥Æ¡¼¥Ö¥ë¥µ¥¤¥º (table_size) = %d, ÇÛÎó¥µ¥¤¥º (array_size) = %d\n" + +#: array.c:829 +#, c-format +msgid "%s: is parameter\n" +msgstr "%s: ¤Ï¥Ñ¥é¥á¡¼¥¿¤Ç¤¹¡£\n" + +#: array.c:834 +#, c-format +msgid "%s: array_ref to %s\n" +msgstr "%s: %s ¤Ø¤ÎÇÛÎó»²¾È (array_ref)\n" + +#: awkgram.y:208 +#, c-format +msgid "%s blocks must have an action part" +msgstr "%s ¥Ö¥í¥Ã¥¯¤Ë¤Ï¥¢¥¯¥·¥ç¥óÉô¤¬É¬¿Ü¤Ç¤¹¡£" + +#: awkgram.y:211 +msgid "each rule must have a pattern or an action part" +msgstr "³Æ¥ë¡¼¥ë¤Ë¤Ï¥Ñ¥¿¡¼¥ó¤Þ¤¿¤Ï¥¢¥¯¥·¥ç¥óÉô¤¬É¬¿Ü¤Ç¤¹¡£" + +#: awkgram.y:267 +#, c-format +msgid "`%s' is a built-in function, it cannot be redefined" +msgstr "`%s' ¤ÏÁȹþ¤ß´Ø¿ô¤Ç¤¹¡£ºÆÄêµÁ¤Ç¤­¤Þ¤»¤ó¡£" + +#: awkgram.y:314 +#, c-format +msgid "regexp constant `/%s/' looks like a C comment, but is not" +msgstr "Àµµ¬É½¸½Äê¿ô `/%s/' ¤Ï C¥³¥á¥ó¥È¤Ë»÷¤Æ¤¤¤Þ¤¹¤¬¡¢°ã¤¤¤Þ¤¹¡£" + +#: awkgram.y:341 awkgram.y:619 +msgid "statement may have no effect" +msgstr "Ì¿Îáʸ¤Ë¤Ï¸ú²Ì¤¬Ìµ¤¤¤«¤â¤·¤ì¤Þ¤»¤ó¡£" + +#: awkgram.y:436 awkgram.y:456 +#, c-format +msgid "`%s' used in %s action" +msgstr "`%s' ¤¬ %s ¤Î¥¢¥¯¥·¥ç¥ó¤Ç»È¤ï¤ì¤Þ¤·¤¿¡£" + +#: awkgram.y:449 awkgram.y:452 +msgid "`nextfile' is a gawk extension" +msgstr "`nextfile' ¤Ï gawk ÆÃÍ­¤Î³ÈÄ¥¤Ç¤¹¡£" + +#: awkgram.y:466 +msgid "`return' used outside function context" +msgstr "`return' ¤¬´Ø¿ôÄêµÁʸ¤Î³°¤Ç»È¤ï¤ì¤Þ¤·¤¿¡£" + +#: awkgram.y:508 +msgid "plain `print' in BEGIN or END rule should probably be `print \"\"'" +msgstr "" +"BEGIN ¤Þ¤¿¤Ï END ¥ë¡¼¥ëÆâ¤Î°ú¿ô¤Î̵¤¤ `print' ¤Ï `print \"\"' ¤À¤È»×¤ï¤ì¤Þ" +"¤¹¡£" + +#: awkgram.y:521 awkgram.y:528 +msgid "`delete array' is a gawk extension" +msgstr "`delete array' ¤Ï gawk ÆÃÍ­¤Î³ÈÄ¥¤Ç¤¹¡£" + +#: awkgram.y:536 awkgram.y:543 +msgid "`delete(array)' is a non-portable tawk extension" +msgstr "`delete(array)' ¤Ï tawk ÆÃÍ­¤Î³ÈÄ¥¤Ç¤¹¡£Â¾¤Î awk ¤Ç¤Ï»ÈÍѤǤ­¤Þ¤»¤ó¡£" + +#: awkgram.y:587 +#, c-format +msgid "duplicate case values in switch body: %s" +msgstr "switch ʸ¤ÎÃæ¤Ë½ÅÊ£¤·¤¿ case Ãͤ¬»ÈÍѤµ¤ì¤Æ¤¤¤Þ¤¹: %s" + +#: awkgram.y:597 +msgid "Duplicate `default' detected in switch body" +msgstr "switch ʸ¤ÎÃæ¤Ë `default' ¤¬½ÅÊ£¤·¤Æ¤¤¤Þ¤¹¡£" + +#: awkgram.y:686 +msgid "multistage two-way pipelines don't work" +msgstr "¿Ãʳ¬¤ÇÁÐÊý¸þ¥Ñ¥¤¥×¤òÍøÍѤ·¤¿¼°¤Ï»ÈÍѤǤ­¤Þ¤»¤ó¡£" + +#: awkgram.y:777 +msgid "regular expression on right of assignment" +msgstr "Àµµ¬É½¸½¤¬ÂåÆþ¼°¤Î±¦Êդ˻ÈÍѤµ¤ì¤Æ¤¤¤Þ¤¹¡£" + +#: awkgram.y:800 +msgid "regular expression on left of `~' or `!~' operator" +msgstr "`~' ¤ä `!~' ±é»»»Ò¤Îº¸ÊÕ¤ËÀµµ¬É½¸½¤¬»ÈÍѤµ¤ì¤Æ¤¤¤Þ¤¹¡£" + +#: awkgram.y:808 +msgid "regular expression on right of comparison" +msgstr "Èæ³Ó¼°¤Î±¦ÊÕ¤ËÀµµ¬É½¸½¤¬»ÈÍѤµ¤ì¤Æ¤¤¤Þ¤¹¡£" + +#: awkgram.y:875 +msgid "non-redirected `getline' undefined inside END action" +msgstr "¥ê¥À¥¤¥ì¥¯¥È¤µ¤ì¤Æ¤¤¤Ê¤¤ `getline' ¤Ï END ¥¢¥¯¥·¥ç¥ó¤Ç¤Ï̤ÄêµÁ¤Ç¤¹¡£" + +#: awkgram.y:902 +msgid "call of `length' without parentheses is not portable" +msgstr "³ç¸Ì̵¤·¤Î `length' ¤Ï¾¤Î awk ¤Ç»ÈÍѤǤ­¤Þ¤»¤ó¡£" + +#: awkgram.y:905 +msgid "call of `length' without parentheses is deprecated by POSIX" +msgstr "POSIX ¤Ï³ç¸Ì̵¤·¤Ç¤Î `length' ¤Î»ÈÍѤò¿ä¾©¤·¤Þ¤»¤ó¡£" + +#: awkgram.y:958 +msgid "use of non-array as array" +msgstr "ÇÛÎó¤Ç¤Ê¤¤¤â¤Î¤òÇÛÎó¤È¤·¤Æ»ÈÍѤ·¤Æ¤¤¤Þ¤¹¡£" + +#: awkgram.y:960 +msgid "invalid subscript expression" +msgstr "ź»ú¼°¤¬ÉÔÀµ¤Ç¤¹¡£" + +#: awkgram.y:1158 +msgid "unexpected newline or end of string" +msgstr "ͽÁÛ³°¤Î²þ¹Ô¤Þ¤¿¤Ïʸ»úÎó¤Î½ªÃ¼¤¬¤¢¤ê¤Þ¤¹¡£" + +#: awkgram.y:1254 +msgid "empty program text on command line" +msgstr "¥³¥Þ¥ó¥É¹Ô¤Î¥×¥í¥°¥é¥àɽµ­¤¬¶õ¤Ç¤¹¡£" + +#: awkgram.y:1307 +#, c-format +msgid "can't open source file `%s' for reading (%s)" +msgstr "¥½¡¼¥¹¥Õ¥¡¥¤¥ë `%s' ¤òÆɤ߹þ¤à¤¿¤á¤Ë³«¤±¤Þ¤»¤ó (%s)¡£" + +#: awkgram.y:1384 +#, c-format +msgid "can't read sourcefile `%s' (%s)" +msgstr "¥½¡¼¥¹¥Õ¥¡¥¤¥ë `%s' ¤òÆɤ߹þ¤á¤Þ¤»¤ó (%s)¡£" + +#: awkgram.y:1392 +#, c-format +msgid "source file `%s' is empty" +msgstr "¥½¡¼¥¹¥Õ¥¡¥¤¥ë `%s' ¤Ï¶õ¤Ç¤¹¡£" + +#: awkgram.y:1590 awkgram.y:1700 awkgram.y:1718 awkgram.y:2068 awkgram.y:2153 +msgid "source file does not end in newline" +msgstr "¥½¡¼¥¹¥Õ¥¡¥¤¥ë¤¬²þ¹Ô¤Ç½ª¤Ã¤Æ¤¤¤Þ¤»¤ó¡£" + +#: awkgram.y:1654 +msgid "unterminated regexp ends with `\\' at end of file" +msgstr "½ªÃ¼¤µ¤ì¤Æ¤¤¤Ê¤¤Àµµ¬É½¸½¤¬¥Õ¥¡¥¤¥ëºÇ¸å¤Î `\\' ¤Ç½ª¤Ã¤Æ¤¤¤Þ¤¹¡£" + +#: awkgram.y:1674 +msgid "unterminated regexp" +msgstr "Àµµ¬É½¸½¤¬½ªÃ¼¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£" + +#: awkgram.y:1677 +msgid "unterminated regexp at end of file" +msgstr "¥Õ¥¡¥¤¥ë¤ÎÃæ¤ÇÀµµ¬É½¸½¤¬½ªÃ¼¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£" + +#: awkgram.y:1744 +msgid "use of `\\ #...' line continuation is not portable" +msgstr "`\\ #...' ·Á¼°¤Î¹Ô·Ñ³¤Ï¾¤Î awk ¤Ç»È¤¨¤Þ¤»¤ó¡£" + +#: awkgram.y:1756 +msgid "backslash not last character on line" +msgstr "¥Ð¥Ã¥¯¥¹¥é¥Ã¥·¥å¤¬¹ÔºÇ¸å¤Îʸ»ú¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤»¤ó¡£" + +#: awkgram.y:1801 +msgid "POSIX does not allow operator `**='" +msgstr "POSIX ¤Ï±é»»»Ò `**=' ¤òµö²Ä¤·¤Þ¤»¤ó¡£" + +#: awkgram.y:1803 +msgid "old awk does not support operator `**='" +msgstr "±é»»»Ò `**=' ¤Ï¸Å¤¤ awk ¤Ç»È¤¨¤Þ¤»¤ó¡£" + +#: awkgram.y:1812 +msgid "POSIX does not allow operator `**'" +msgstr "POSIX ¤Ç¤Ï±é»»»Ò `**' ¤òµö²Ä¤·¤Æ¤¤¤Þ¤»¤ó¡£" + +#: awkgram.y:1814 +msgid "old awk does not support operator `**'" +msgstr "±é»»»Ò `**' ¤Ï¸Å¤¤ awk ¤Ç»È¤¨¤Þ¤»¤ó¡£" + +#: awkgram.y:1845 +msgid "operator `^=' is not supported in old awk" +msgstr "±é»»»Ò `^=' ¤Ï¸Å¤¤ awk ¤Ç»È¤¨¤Þ¤»¤ó¡£" + +#: awkgram.y:1853 +msgid "operator `^' is not supported in old awk" +msgstr "±é»»»Ò `^' ¤Ï¸Å¤¤ awk ¤Ç»È¤¨¤Þ¤»¤ó¡£" + +#: awkgram.y:1937 awkgram.y:1954 +msgid "unterminated string" +msgstr "ʸ»úÎ󤬽ªÃ¼¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£" + +#: awkgram.y:2114 +#, c-format +msgid "invalid char '%c' in expression" +msgstr "ɽ¸½¤Î char '%c' ¤ÏÉÔÀµ¤Ç¤¹¡£" + +#: awkgram.y:2162 +#, c-format +msgid "`%s' is a gawk extension" +msgstr "`%s' ¤Ï gawk ÆÃÍ­¤Î³ÈÄ¥¤Ç¤¹¡£" + +#: awkgram.y:2165 +#, c-format +msgid "`%s' is a Bell Labs extension" +msgstr "`%s' ¤Ï¥Ù¥ë¸¦µæ½ê¤Ë¤è¤ë³ÈÄ¥¤Ç¤¹¡£" + +#: awkgram.y:2168 +#, c-format +msgid "POSIX does not allow `%s'" +msgstr "POSIX ¤Ï `%s' ¤òµö²Ä¤·¤Þ¤»¤ó¡£" + +#: awkgram.y:2172 +#, c-format +msgid "`%s' is not supported in old awk" +msgstr "`%s' ¤Ï¸Å¤¤ awk ¤Ç»ÈÍѤǤ­¤Þ¤»¤ó¡£" + +#: awkgram.y:2198 +msgid "`goto' considered harmful!\n" +msgstr "`goto' ¤ÏÍ­³²¤Ç¤¹!\n" + +#: awkgram.y:2260 +#, c-format +msgid "%d is invalid as number of arguments for %s" +msgstr "%d ¤Ï %s ¤Ë»È¤¨¤ë°ú¿ô¤Î¿ô¤È¤·¤Æ¤ÏÉÔÀµ¤Ç¤¹¡£" + +#: awkgram.y:2279 awkgram.y:2282 +msgid "match: third argument is a gawk extension" +msgstr "match: Âè»°°ú¿ô¤Ï gawk ÆÃÍ­¤Î³ÈÄ¥¤Ç¤¹¡£" + +#: awkgram.y:2295 +#, c-format +msgid "%s: string literal as last arg of substitute has no effect" +msgstr "%s: ʸ»úÎó¥ê¥Æ¥é¥ë¤òÃÖ¤­´¹¤¨ºÇ¸å¤Î°ú¿ô¤Ë»ÈÍѤ¹¤ë¤È¸ú²Ì¤¬¤¢¤ê¤Þ¤»¤ó¡£" + +#: awkgram.y:2298 +#, c-format +msgid "%s third parameter is not a changeable object" +msgstr "%s Âè»°¥Ñ¥é¥á¡¼¥¿¤Ï²ÄÊÑ¥ª¥Ö¥¸¥§¥¯¥È¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£" + +#: awkgram.y:2325 awkgram.y:2328 +msgid "close: second argument is a gawk extension" +msgstr "close: ÂèÆó°ú¿ô¤Ï gawk ÆÃÍ­¤Î³ÈÄ¥¤Ç¤¹¡£" + +#: awkgram.y:2338 +msgid "use of dcgettext(_\"...\") is incorrect: remove leading underscore" +msgstr "" +"dcgettext(_\"...\")¤Î»È¤¤Êý¤¬´Ö°ã¤Ã¤Æ¤¤¤Þ¤¹: ºÇ½é¤Î¥¢¥ó¥À¡¼¥¹¥³¥¢¤òºï½ü¤·¤Æ¤¯" +"¤À¤µ¤¤¡£" + +#: awkgram.y:2353 +msgid "use of dcngettext(_\"...\") is incorrect: remove leading underscore" +msgstr "" +"dcngettext(_\"...\")¤Î»È¤¤Êý¤¬´Ö°ã¤Ã¤Æ¤¤¤Þ¤¹: ºÇ½é¤Î¥¢¥ó¥À¡¼¥¹¥³¥¢¤òºï½ü¤·¤Æ" +"¤¯¤À¤µ¤¤¡£" + +#: awkgram.y:2424 +#, c-format +msgid "function `%s': parameter #%d, `%s', duplicates parameter #%d" +msgstr "´Ø¿ô `%s': ¥Ñ¥é¥á¡¼¥¿ #%d, `%s' ¤¬¥Ñ¥é¥á¡¼¥¿ #%d ¤È½ÅÊ£¤·¤Æ¤¤¤Þ¤¹¡£" + +#: awkgram.y:2457 +#, c-format +msgid "function `%s': parameter `%s' shadows global variable" +msgstr "´Ø¿ô `%s': ¥Ñ¥é¥á¡¼¥¿ `%s' ¤¬Âç°èÊÑ¿ô¤òʤ¤¤±£¤·¤Æ¤¤¤Þ¤¹¡£" + +#: awkgram.y:2569 +#, c-format +msgid "could not open `%s' for writing (%s)" +msgstr "`%s' ¤ò½ñ¹þ¤ßÍѤ˳«¤±¤Þ¤»¤ó¤Ç¤·¤¿ (%s)¡£" + +#: awkgram.y:2570 profile.c:93 +msgid "sending profile to standard error" +msgstr "¥×¥í¥Õ¥¡¥¤¥ë¤òɸ½à¥¨¥é¡¼¤ËÁ÷¤Ã¤Æ¤¤¤Þ¤¹¡£" + +#: awkgram.y:2602 +#, c-format +msgid "%s: close failed (%s)" +msgstr "%s: ÊĤ¸¤ë¤³¤È¤¬¤Ç¤­¤Þ¤»¤ó (%s)¡£" + +#: awkgram.y:2723 +msgid "shadow_funcs() called twice!" +msgstr "shadow_funcs() ¤òÆó²ó¸Æ¤Ó½Ð¤·¤Æ¤¤¤Þ¤¹!" + +#: awkgram.y:2750 +msgid "there were shadowed variables." +msgstr "ʤ¤¤±£¤µ¤ì¤¿ÊÑ¿ô¤¬¤¢¤ê¤Þ¤·¤¿¡£" + +#: awkgram.y:2823 +#, c-format +msgid "function `%s': can't use function name as parameter name" +msgstr "´Ø¿ô `%s': ´Ø¿ô̾¤Ï¥Ñ¥é¥á¡¼¥¿Ì¾¤Ë»ÈÍѤǤ­¤Þ¤»¤ó¡£" + +#: awkgram.y:2833 +#, c-format +msgid "function name `%s' previously defined" +msgstr "´Ø¿ô̾ `%s' ¤ÏÄêµÁºÑ¤ß¤Ç¤¹¡£" + +#: awkgram.y:2984 awkgram.y:2990 +#, c-format +msgid "function `%s' called but never defined" +msgstr "̤ÄêµÁ¤Î´Ø¿ô `%s' ¤ò¸Æ¤Ó½Ð¤·¤Þ¤·¤¿¡£" + +#: awkgram.y:2993 +#, c-format +msgid "function `%s' defined but never called" +msgstr "ÄêµÁ¤µ¤ì¤¿´Ø¿ô `%s' ¤Ï°ìÅÙ¤â¸Æ¤Ó½Ð¤µ¤ì¤Þ¤»¤ó¤Ç¤·¤¿¡£" + +#: awkgram.y:3020 +#, c-format +msgid "regexp constant for parameter #%d yields boolean value" +msgstr "¥Ñ¥é¥á¡¼¥¿ #%d ¤ÎÀµµ¬É½¸½Äê¿ô¤Ï¥Ö¡¼¥ëÃͤò½ÐÎϤ·¤Þ¤¹¡£" + +#: awkgram.y:3033 +#, fuzzy, c-format +msgid "" +"function `%s' called with space between name and `(',\n" +"or used as a variable or an array" +msgstr "" +"´Ø¿ô̾¤È `(' ¤Î´Ö¤Ë¥¹¥Ú¡¼¥¹¤òÆþ¤ì¤Æ´Ø¿ô `%s' ¤ò¸Æ¤Ó½Ð¤·¤Æ¤¤¤Þ¤¹¡£\n" +"%s" + +#: builtin.c:149 +#, c-format +msgid "%s to \"%s\" failed (%s)" +msgstr "%s ¤«¤é \"%s\" ¤Ø½ÐÎϤǤ­¤Þ¤»¤ó (%s)¡£" + +#: builtin.c:150 +msgid "standard output" +msgstr "ɸ½à½ÐÎÏ" + +#: builtin.c:151 +msgid "reason unknown" +msgstr "¸¶°øÉÔÌÀ" + +#: builtin.c:164 +msgid "exp: received non-numeric argument" +msgstr "exp: °ú¿ô¤¬¿ôÃͤǤϤ¢¤ê¤Þ¤»¤ó¡£" + +#: builtin.c:170 +#, c-format +msgid "exp: argument %g is out of range" +msgstr "exp: °ú¿ô %g ¤¬µöÍÆÈϰϤòĶ¤¨¤Æ¤¤¤Þ¤¹¡£" + +#: builtin.c:228 +#, c-format +msgid "fflush: cannot flush: pipe `%s' opened for reading, not writing" +msgstr "fflush: ¥Õ¥é¥Ã¥·¥åÉÔ²Ä: ¥Ñ¥¤¥× `%s' ¤ÏÆɤ߹þ¤ßÀìÍѤǤ¹¡£" + +#: builtin.c:231 +#, c-format +msgid "fflush: cannot flush: file `%s' opened for reading, not writing" +msgstr "fflush: ¥Õ¥é¥Ã¥·¥åÉÔ²Ä: ¥Õ¥¡¥¤¥ë `%s' ¤ÏÆɤ߹þ¤ßÀìÍѤǤ¹¡£" + +#: builtin.c:243 +#, c-format +msgid "fflush: `%s' is not an open file, pipe or co-process" +msgstr "" +"fflush: `%s' ¤Ï¥Õ¥¡¥¤¥ë¤«¡¢¥Ñ¥¤¥×¤«¡¢ÊÂ¹Ô¥×¥í¥»¥¹¤Ç¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡£" + +#: builtin.c:338 +msgid "index: received non-string first argument" +msgstr "index: Âè°ì°ú¿ô¤¬Ê¸»úÎó¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£" + +#: builtin.c:340 +msgid "index: received non-string second argument" +msgstr "index: ÂèÆó°ú¿ô¤¬Ê¸»úÎó¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£" + +#: builtin.c:454 +msgid "int: received non-numeric argument" +msgstr "int: °ú¿ô¤¬¿ôÃͤǤϤ¢¤ê¤Þ¤»¤ó¡£" + +#: builtin.c:471 +msgid "length: received non-string argument" +msgstr "length: °ú¿ô¤¬Ê¸»úÎó¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£" + +#: builtin.c:487 +msgid "log: received non-numeric argument" +msgstr "log: °ú¿ô¤¬¿ôÃͤǤϤ¢¤ê¤Þ¤»¤ó¡£" + +#: builtin.c:490 +#, c-format +msgid "log: received negative argument %g" +msgstr "log: °ú¿ô %g ¤¬Éé¤ÎÃͤǤ¹¡£" + +#: builtin.c:654 builtin.c:657 +msgid "must use `count$' on all formats or none" +msgstr "" +"`count$¡Ç¤ÏÁ´¤Æ¤Î½ñ¼°»ØÄê¤ËŬÍѤ¹¤ë¡¢¤Þ¤¿¤ÏÁ´¤Æ¤ËŬÍѤ·¤Ê¤¤¤Î¤É¤Á¤é¤«¤Ç¤·¤«»È" +"¤¨¤Þ¤»¤ó¡£" + +#: builtin.c:759 +msgid "`$' is not permitted in awk formats" +msgstr "`$' ¤Ï awk ¤Ç¤Ï»È¤¨¤Þ¤»¤ó¡£" + +#: builtin.c:765 +msgid "arg count with `$' must be > 0" +msgstr "½ç½ø»ØÄê¤Î `$' ¤Ë»È¤¨¤ë¿ô»ú¤ÏÀµ¤ÎÃͤǤ¹¡£" + +#: builtin.c:767 +#, c-format +msgid "arg count %ld greater than total number of supplied arguments" +msgstr "½ç½ø»ØÄê %ld ¤¬Í¿¤¨¤é¤ì¤Æ¤¤¤ë°ú¿ô¤Î¿ô¤òĶ¤¨¤Æ¤¤¤Þ¤¹¡£" + +#: builtin.c:769 +msgid "`$' not permitted after period in format" +msgstr "`$' ¤Ï½ñ¼°»ØÄê¤Î¥Ô¥ê¥ª¥É `.' ¤Î¸å¤Ë»ÈÍѤǤ­¤Þ¤»¤ó¡£" + +#: builtin.c:782 +msgid "no `$' supplied for positional field width or precision" +msgstr "¥Õ¥£¡¼¥ë¥ÉÉý¡¢¤Þ¤¿¤ÏÀºÅ٤λØÄê»Ò¤Ë `$' ¤¬Í¿¤¨¤é¤ì¤Æ¤¤¤Þ¤»¤ó¡£" + +#: builtin.c:848 +msgid "`l' is meaningless in awk formats; ignored" +msgstr "awk ¤Î½ñ¼°»ØÄê¤Ç¤Ï `l' ¤Ï̵°ÕÌ£¤Ç¤¹¡£Ìµ»ë¤·¤Þ¤¹¡£" + +#: builtin.c:852 +msgid "`l' is not permitted in POSIX awk formats" +msgstr "POSIX ½àµò¤Î awk ¤Ç¤Ï `l' ¤Ï»ÈÍѤǤ­¤Þ¤»¤ó¡£" + +#: builtin.c:863 +msgid "`L' is meaningless in awk formats; ignored" +msgstr "awk ¤Î½ñ¼°»ØÄê¤Ç¤Ï `L' ¤Ï̵°ÕÌ£¤Ç¤¹¡£Ìµ»ë¤·¤Þ¤¹¡£" + +#: builtin.c:867 +msgid "`L' is not permitted in POSIX awk formats" +msgstr "POSIX ½àµò¤Î awk ¤Ç¤Ï `L' ¤Ï»ÈÍѤǤ­¤Þ¤»¤ó¡£" + +#: builtin.c:878 +msgid "`h' is meaningless in awk formats; ignored" +msgstr "awk ¤Î½ñ¼°»ØÄê¤Ç¤Ï `h' ¤Ï̵°ÕÌ£¤Ç¤¹¡£Ìµ»ë¤·¤Þ¤¹¡£" + +#: builtin.c:882 +msgid "`h' is not permitted in POSIX awk formats" +msgstr "POSIX ½àµò¤Î awk ¤Ç¤Ï `h' ¤Ï»ÈÍѤǤ­¤Þ¤»¤ó¡£" + +#: builtin.c:1111 +#, c-format +msgid "[s]printf: value %g is out of range for `%%%c' format" +msgstr "[s]printf: %g ¤ÎÃͤ¬½ñ¼° `%%%c' ¤ÎµöÍÆÈϰϤòĶ¤¨¤Æ¤¤¤Þ¤¹¡£" + +#: builtin.c:1171 +msgid "not enough arguments to satisfy format string" +msgstr "½ñ¼°»ØÄꤹ¤ë¤¿¤á¤Î°ú¿ô¤¬Â­¤ê¤Þ¤»¤ó¡£" + +#: builtin.c:1173 +msgid "^ ran out for this one" +msgstr "^ ¤³¤³¤«¤é­¤ê¤Þ¤»¤ó" + +#: builtin.c:1178 +msgid "[s]printf: format specifier does not have control letter" +msgstr "[s]printf: ½ñ¼°»ØÄê»Ò¤ËÀ©¸æʸ»ú¤¬¤¢¤ê¤Þ¤»¤ó¡£" + +#: builtin.c:1181 +msgid "too many arguments supplied for format string" +msgstr "½ñ¼°»ØÄêʸ»úÎó¤Î°ú¿ô¤¬Â¿²á¤®¤Þ¤¹¡£" + +#: builtin.c:1247 builtin.c:1250 +msgid "printf: no arguments" +msgstr "printf: °ú¿ô¤¬¤¢¤ê¤Þ¤»¤ó¡£" + +#: builtin.c:1274 +msgid "sqrt: received non-numeric argument" +msgstr "sqrt: °ú¿ô¤¬¿ôÃͤǤϤ¢¤ê¤Þ¤»¤ó¡£" + +#: builtin.c:1278 +#, c-format +msgid "sqrt: called with negative argument %g" +msgstr "sqrt: °ú¿ô¤ËÉé¤ÎÃÍ %g ¤ò»ÈÍѤ·¤Æ¤¤¤Þ¤¹¡£" + +#: builtin.c:1301 +#, c-format +msgid "substr: start index %g is invalid, using 1" +msgstr "substr: µ¯ÅÀ»Øɸ %g ¤¬ÉÔÀµ¤Ç¤¹¡££±¤ò»È¤¤¤Þ¤¹¡£" + +#: builtin.c:1306 +#, c-format +msgid "substr: non-integer start index %g will be truncated" +msgstr "substr: µ¯ÅÀ»Øɸ %g ¤Î¾®¿ôÅÀ°Ê²¼¤ÏÀÚ¤ê¼Î¤Æ¤Þ¤¹¡£" + +#: builtin.c:1325 +#, fuzzy, c-format +msgid "substr: length %g is not >= 1" +msgstr "substr: ʸ»ú¿ô %g ¤¬ <= 0 ¤Ç¤¹¡£" + +#: builtin.c:1327 +#, fuzzy, c-format +msgid "substr: length %g is not >= 0" +msgstr "substr: ʸ»ú¿ô %g ¤¬ <= 0 ¤Ç¤¹¡£" + +#: builtin.c:1334 +#, c-format +msgid "substr: non-integer length %g will be truncated" +msgstr "substr: ʸ»ú¿ô %g ¤Î¾®¿ôÅÀ°Ê²¼¤ÏÀÚ¤ê¼Î¤Æ¤Þ¤¹¡£" + +#: builtin.c:1339 +#, c-format +msgid "substr: length %g too big for string indexing, truncating to %g" +msgstr "substr: ʸ»ú¿ô %g ¤ÏºÇÂçÃͤòĶ¤¨¤Æ¤¤¤Þ¤¹¡£%g ¤ò»È¤¤¤Þ¤¹¡£" + +#: builtin.c:1351 +msgid "substr: source string is zero length" +msgstr "substr: ʸ»úÎó¤ÎŤµ¤¬¥¼¥í¤Ç¤¹¡£" + +#: builtin.c:1357 +#, c-format +msgid "substr: start index %g is past end of string" +msgstr "substr: µ¯ÅÀ»Øɸ %g ¤¬Ê¸»úÎó¤ÎŤµ¤òĶ¤¨¤Æ¤¤¤Þ¤¹¡£" + +#: builtin.c:1365 +#, c-format +msgid "" +"substr: length %g at start index %g exceeds length of first argument (%lu)" +msgstr "" +"substr: µ¯ÅÀ»Øɸ %2$g ¤«¤é¤Îʸ»ú¿ô %1$g ¤Ïʸ»úÎó¤ÎŤµ %3$lu ¤òĶ¤¨¤Æ¤¤¤Þ¤¹¡£" + +#: builtin.c:1400 +msgid "strftime: received non-string first argument" +msgstr "strftime: Âè°ì°ú¿ô¤¬Ê¸»úÎó¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£" + +#: builtin.c:1406 +msgid "strftime: received empty format string" +msgstr "strftime: ½ñ¼°»ØÄêʸ»úÎ󤬶õ¤Ç¤¹¡£" + +#: builtin.c:1415 +msgid "strftime: received non-numeric second argument" +msgstr "strftime: ÂèÆó°ú¿ô¤¬¿ôÃͤǤϤ¢¤ê¤Þ¤»¤ó¡£" + +#: builtin.c:1478 +msgid "mktime: received non-string argument" +msgstr "mktime: °ú¿ô¤¬Ê¸»úÎó¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£" + +#: builtin.c:1523 +msgid "system: received non-string argument" +msgstr "system: °ú¿ô¤¬Ê¸»úÎó¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£" + +#: builtin.c:1644 eval.c:2019 +#, c-format +msgid "reference to uninitialized field `$%d'" +msgstr "½é´ü²½¤µ¤ì¤Æ¤¤¤Ê¤¤¥Õ¥£¡¼¥ë¥É `$%d' ¤ò»²¾È¤·¤Æ¤¤¤Þ¤¹¡£" + +#: builtin.c:1671 +msgid "tolower: received non-string argument" +msgstr "tolower: °ú¿ô¤¬Ê¸»úÎó¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£" + +#: builtin.c:1720 +msgid "toupper: received non-string argument" +msgstr "toupper: °ú¿ô¤¬Ê¸»úÎó¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£" + +#: builtin.c:1765 +msgid "atan2: received non-numeric first argument" +msgstr "atan2: Âè°ì°ú¿ô¤¬¿ôÃͤǤϤ¢¤ê¤Þ¤»¤ó¡£" + +#: builtin.c:1767 +msgid "atan2: received non-numeric second argument" +msgstr "atan2: ÂèÆó°ú¿ô¤¬¿ôÃͤǤϤ¢¤ê¤Þ¤»¤ó¡£" + +#: builtin.c:1786 +msgid "sin: received non-numeric argument" +msgstr "sin: °ú¿ô¤¬¿ôÃͤǤϤ¢¤ê¤Þ¤»¤ó¡£" + +#: builtin.c:1802 +msgid "cos: received non-numeric argument" +msgstr "cos: °ú¿ô¤¬¿ôÃͤǤϤ¢¤ê¤Þ¤»¤ó¡£" + +#: builtin.c:1852 +msgid "srand: received non-numeric argument" +msgstr "srand: °ú¿ô¤¬¿ôÃͤǤϤ¢¤ê¤Þ¤»¤ó¡£" + +#: builtin.c:1887 +msgid "match: third argument is not an array" +msgstr "match: Âè»°°ú¿ô¤¬ÇÛÎó̾¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£" + +#: builtin.c:2414 +#, fuzzy +msgid "gensub: third argument of 0 treated as 1" +msgstr "gensub: Âè»°°ú¿ô¤¬ 0 ¤Ç¤¹¡£1 ¤òÂå¤ï¤ê¤Ë»ÈÍѤ·¤Þ¤¹¡£" + +#: builtin.c:2572 +msgid "lshift: received non-numeric first argument" +msgstr "lshift: Âè°ì°ú¿ô¤¬¿ôÃͤǤϤ¢¤ê¤Þ¤»¤ó¡£" + +#: builtin.c:2574 +#, fuzzy +msgid "lshift: received non-numeric second argument" +msgstr "strftime: ÂèÆó°ú¿ô¤¬¿ôÃͤǤϤ¢¤ê¤Þ¤»¤ó¡£" + +#: builtin.c:2580 +#, c-format +msgid "lshift(%lf, %lf): negative values will give strange results" +msgstr "lshift(%lf, %lf): Éé¤Î¿ôÃͤò»ÈÍѤ¹¤ë¤È°Û¾ï¤Ê·ë²Ì¤Ë¤Ê¤ê¤Þ¤¹¡£" + +#: builtin.c:2582 +#, c-format +msgid "lshift(%lf, %lf): fractional values will be truncated" +msgstr "lshift(%lf, %lf): ¾®¿ôÅÀ°Ê²¼¤ÏÀÚ¤ê¼Î¤Æ¤Ë¤Ê¤ê¤Þ¤¹¡£" + +#: builtin.c:2584 +#, c-format +msgid "lshift(%lf, %lf): too large shift value will give strange results" +msgstr "lshift(%lf, %lf): ¥·¥Õ¥ÈÃͤ¬Â礭²á¤®¤ë¤È°Û¾ï¤Ê·ë²Ì¤Ë¤Ê¤ê¤Þ¤¹¡£" + +#: builtin.c:2610 +msgid "rshift: received non-numeric first argument" +msgstr "rshift: Âè°ì°ú¿ô¤¬¿ôÃͤǤϤ¢¤ê¤Þ¤»¤ó¡£" + +#: builtin.c:2612 +#, fuzzy +msgid "rshift: received non-numeric second argument" +msgstr "strftime: ÂèÆó°ú¿ô¤¬¿ôÃͤǤϤ¢¤ê¤Þ¤»¤ó¡£" + +#: builtin.c:2618 +#, c-format +msgid "rshift(%lf, %lf): negative values will give strange results" +msgstr "rshift(%lf, %lf): Éé¤Î¿ôÃͤò»ÈÍѤ¹¤ë¤È°Û¾ï¤Ê·ë²Ì¤Ë¤Ê¤ê¤Þ¤¹¡£" + +#: builtin.c:2620 +#, c-format +msgid "rshift(%lf, %lf): fractional values will be truncated" +msgstr "rshift(%lf, %lf): ¾®¿ôÅÀ°Ê²¼¤ÏÀÚ¤ê¼Î¤Æ¤Ë¤Ê¤ê¤Þ¤¹¡£" + +#: builtin.c:2622 +#, c-format +msgid "rshift(%lf, %lf): too large shift value will give strange results" +msgstr "rshift(%lf, %lf): ¥·¥Õ¥ÈÃͤ¬Â礭²á¤®¤ë¤È°Û¾ï¤Ê·ë²Ì¤Ë¤Ê¤ê¤Þ¤¹¡£" + +#: builtin.c:2648 +msgid "and: received non-numeric first argument" +msgstr "and: Âè°ì°ú¿ô¤¬¿ôÃͤǤϤ¢¤ê¤Þ¤»¤ó¡£" + +#: builtin.c:2650 +#, fuzzy +msgid "and: received non-numeric second argument" +msgstr "atan2: ÂèÆó°ú¿ô¤¬¿ôÃͤǤϤ¢¤ê¤Þ¤»¤ó¡£" + +#: builtin.c:2656 +#, c-format +msgid "and(%lf, %lf): negative values will give strange results" +msgstr "and(%lf, %lf): Éé¤Î¿ôÃͤò»ÈÍѤ¹¤ë¤È°Û¾ï¤Ê·ë²Ì¤Ë¤Ê¤ê¤Þ¤¹¡£" + +#: builtin.c:2658 +#, c-format +msgid "and(%lf, %lf): fractional values will be truncated" +msgstr "and(%lf, %lf): ¾®¿ôÅÀ°Ê²¼¤ÏÀÚ¤ê¼Î¤Æ¤Ë¤Ê¤ê¤Þ¤¹¡£" + +#: builtin.c:2684 +msgid "or: received non-numeric first argument" +msgstr "or: Âè°ì°ú¿ô¤¬¿ôÃͤǤϤ¢¤ê¤Þ¤»¤ó¡£" + +#: builtin.c:2686 +#, fuzzy +msgid "or: received non-numeric second argument" +msgstr "atan2: ÂèÆó°ú¿ô¤¬¿ôÃͤǤϤ¢¤ê¤Þ¤»¤ó¡£" + +#: builtin.c:2692 +#, c-format +msgid "or(%lf, %lf): negative values will give strange results" +msgstr "or(%lf, %lf): Éé¤Î¿ôÃͤò»ÈÍѤ¹¤ë¤È°Û¾ï¤Ê·ë²Ì¤Ë¤Ê¤ê¤Þ¤¹¡£" + +#: builtin.c:2694 +#, c-format +msgid "or(%lf, %lf): fractional values will be truncated" +msgstr "or(%lf, %lf): ¾®¿ôÅÀ°Ê²¼¤ÏÀÚ¤ê¼Î¤Æ¤Ë¤Ê¤ê¤Þ¤¹¡£" + +#: builtin.c:2720 +msgid "xor: received non-numeric first argument" +msgstr "xor: Âè°ì°ú¿ô¤¬¿ôÃͤǤϤ¢¤ê¤Þ¤»¤ó¡£" + +#: builtin.c:2722 +#, fuzzy +msgid "xor: received non-numeric second argument" +msgstr "atan2: ÂèÆó°ú¿ô¤¬¿ôÃͤǤϤ¢¤ê¤Þ¤»¤ó¡£" + +#: builtin.c:2728 +#, c-format +msgid "xor(%lf, %lf): negative values will give strange results" +msgstr "xor(%lf, %lf): Éé¤Î¿ôÃͤò»ÈÍѤ¹¤ë¤È°Û¾ï¤Ê·ë²Ì¤Ë¤Ê¤ê¤Þ¤¹¡£" + +#: builtin.c:2730 +#, c-format +msgid "xor(%lf, %lf): fractional values will be truncated" +msgstr "xor(%lf, %lf): ¾®¿ôÅÀ°Ê²¼¤ÏÀÚ¤ê¼Î¤Æ¤Ë¤Ê¤ê¤Þ¤¹¡£" + +#: builtin.c:2754 +msgid "compl: received non-numeric argument" +msgstr "compl: °ú¿ô¤¬¿ôÃͤǤϤ¢¤ê¤Þ¤»¤ó¡£" + +#: builtin.c:2760 +#, c-format +msgid "compl(%lf): negative value will give strange results" +msgstr "compl(%lf): Éé¤Î¿ôÃͤò»ÈÍѤ¹¤ë¤È°Û¾ï¤Ê·ë²Ì¤Ë¤Ê¤ê¤Þ¤¹¡£" + +#: builtin.c:2762 +#, c-format +msgid "compl(%lf): fractional value will be truncated" +msgstr "compl(%lf): ¾®¿ôÅÀ°Ê²¼¤ÏÀÚ¤ê¼Î¤Æ¤Ë¤Ê¤ê¤Þ¤¹¡£" + +#: builtin.c:2935 +#, c-format +msgid "dcgettext: `%s' is not a valid locale category" +msgstr "dcgettext: `%s' ¤ÏÉÔÀµ¤Ê¥í¥«¡¼¥ë¡¦¥«¥Æ¥´¥ê¡¼¤Ç¤¹¡£" + +#: eval.c:303 +#, c-format +msgid "unknown nodetype %d" +msgstr "¥Î¡¼¥É %d ¤Î¼ïÎबÉÔÌÀ¤Ç¤¹¡£" + +#: eval.c:350 +msgid "buffer overflow in genflags2str" +msgstr "genflags2str ¤¬¥Ð¥Ã¥Õ¥¡ÍÆÎ̤òĶ²á¤·¤Þ¤·¤¿¡£" + +#: eval.c:382 eval.c:388 profile.c:837 +#, c-format +msgid "attempt to use array `%s' in a scalar context" +msgstr "¥¹¥«¥é¡¼´Ä¶­¤ËÇÛÎó `%s' ¤ò»ÈÍѤ·¤Æ¤¤¤Þ¤¹¡£" + +#: eval.c:730 +#, c-format +msgid "for loop: array `%s' changed size from %ld to %ld during loop execution" +msgstr "" +"for ¥ë¡¼¥×: ¥ë¡¼¥×Ãæ¤ËÇÛÎó `%s' ¤Î¥µ¥¤¥º¤¬ %ld ¤«¤é %ld ¤ËÊѤï¤ê¤Þ¤·¤¿¡£" + +#: eval.c:751 +msgid "`break' outside a loop is not portable" +msgstr "¥ë¡¼¥×¤Î³°¤Ç»ÈÍѤ¹¤ë `break' ¤Ï¾¤Î awk ¤Ç»ÈÍѤǤ­¤Þ¤»¤ó¡£" + +#: eval.c:755 +msgid "`break' outside a loop is not allowed" +msgstr "¥ë¡¼¥×¤Î³°¤Ç¤Ï `break' ¤ò»ÈÍѤǤ­¤Þ¤»¤ó¡£" + +#: eval.c:772 +msgid "`continue' outside a loop is not portable" +msgstr "¥ë¡¼¥×¤Î³°¤Ç»ÈÍѤ¹¤ë `continue' ¤Ï¾¤Î awk ¤Ç»ÈÍѤǤ­¤Þ¤»¤ó¡£" + +#: eval.c:776 +msgid "`continue' outside a loop is not allowed" +msgstr "¥ë¡¼¥×¤Î³°¤Ç¤Ï `continue' ¤ò»ÈÍѤǤ­¤Þ¤»¤ó¡£" + +#: eval.c:810 +msgid "`next' cannot be called from a BEGIN rule" +msgstr "BEGIN ¥ë¡¼¥ë¤«¤é¤Ï `next' ¤ò¸Æ¤Ó½Ð¤»¤Þ¤»¤ó¡£" + +#: eval.c:812 +msgid "`next' cannot be called from an END rule" +msgstr "END ¥ë¡¼¥ë¤«¤é¤Ï `next' ¤ò¸Æ¤Ó½Ð¤»¤Þ¤»¤ó¡£" + +#: eval.c:821 +msgid "`nextfile' cannot be called from a BEGIN rule" +msgstr "BEGIN ¥ë¡¼¥ë¤«¤é¤Ï `nextfile' ¤ò¸Æ¤Ó½Ð¤»¤Þ¤»¤ó¡£" + +#: eval.c:823 +msgid "`nextfile' cannot be called from an END rule" +msgstr "END ¥ë¡¼¥ë¤«¤é¤Ï `nextfile' ¤ò¸Æ¤Ó½Ð¤»¤Þ¤»¤ó¡£" + +#: eval.c:872 +msgid "statement has no effect" +msgstr "Ì¿Îáʸ¤Ë¸ú²Ì¤Ï¤¢¤ê¤Þ¤»¤ó¡£" + +#: eval.c:915 eval.c:1873 +#, c-format +msgid "can't use function name `%s' as variable or array" +msgstr "´Ø¿ô̾ `%s' ¤ÏÊÑ¿ô¤äÇÛÎó¤Ë¤Ï»È¤¨¤Þ¤»¤ó¡£" + +#: eval.c:922 eval.c:928 +#, c-format +msgid "reference to uninitialized argument `%s'" +msgstr "½é´ü²½¤µ¤ì¤Æ¤¤¤Ê¤¤°ú¿ô `%s' ¤ò»²¾È¤·¤Æ¤¤¤Þ¤¹¡£" + +#: eval.c:937 eval.c:1882 +#, c-format +msgid "reference to uninitialized variable `%s'" +msgstr "½é´ü²½¤µ¤ì¤Æ¤¤¤Ê¤¤ÊÑ¿ô `%s' ¤ò»²¾È¤·¤Æ¤¤¤Þ¤¹¡£" + +#: eval.c:1083 +msgid "" +"concatenation: side effects in one expression have changed the length of " +"another!" +msgstr "" +"concatenation¡Êʸ»úÎóÏ¢·ë¡Ë: °ìÊý¤Î¼°¤ÎÉûºîÍѤǡ¢¤â¤¦°ìÊý¤ÎŤµ¤¬ÊѤï¤ê¤Þ¤·" +"¤¿!" + +#: eval.c:1162 +msgid "assignment used in conditional context" +msgstr "¾ò·ïʸÃæ¤Ç¤ÎÂåÆþ" + +#: eval.c:1252 +msgid "division by zero attempted" +msgstr "¥¼¥í¤Ç¤Î½ü»»¤ò¹Ô¤¤¤Þ¤·¤¿¡£" + +#: eval.c:1267 +#, c-format +msgid "division by zero attempted in `%%'" +msgstr "`%%' ¤Ç¥¼¥í¤Ç¤Î½ü»»¤ò¹Ô¤¤¤Þ¤·¤¿¡£" + +#: eval.c:1282 profile.c:713 +#, c-format +msgid "illegal type (%s) in tree_eval" +msgstr "tree_eval ¤ÎÃæ¤ËÉÔÀµ¤Ê¥¿¥¤¥× (%s) ¤¬»ÈÍѤµ¤ì¤Æ¤¤¤Þ¤¹¡£" + +#: eval.c:1459 +msgid "division by zero attempted in `/='" +msgstr "`/=' ¤Ç¥¼¥í¤Ç¤Î½ü»»¤ò¹Ô¤¤¤Þ¤·¤¿¡£" + +#: eval.c:1477 +#, c-format +msgid "division by zero attempted in `%%='" +msgstr "`%%=' ¤Ç¥¼¥í¤Ç¤Î½ü»»¤ò¹Ô¤¤¤Þ¤·¤¿¡£" + +#: eval.c:1738 +#, c-format +msgid "function `%s' called with more arguments than declared" +msgstr "Àë¸À¤µ¤ì¤Æ¤¤¤ë¿ô¤è¤ê¿¤¤°ú¿ô¤ò»È¤Ã¤Æ´Ø¿ô `%s' ¤ò¸Æ¤Ó½Ð¤·¤Þ¤·¤¿¡£" + +#: eval.c:1782 +#, c-format +msgid "function `%s' not defined" +msgstr "´Ø¿ô `%s' ¤ÏÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£" + +#: eval.c:1788 +#, c-format +msgid "function %s called\n" +msgstr "´Ø¿ô `%s' ¤ò¸Æ¤Ó½Ð¤·¤Þ¤·¤¿¡£\n" + +#: eval.c:1845 +#, c-format +msgid "" +"\n" +"\t# Function Call Stack:\n" +"\n" +msgstr "" +"\n" +"\t# ¸Æ½Ð´Ø¿ô¥¹¥¿¥Ã¥¯:\n" +"\n" + +#: eval.c:1848 +#, c-format +msgid "\t# -- main --\n" +msgstr "\t# -- ¥á¥¤¥ó --\n" + +#: eval.c:2003 +msgid "attempt to field reference from non-numeric value" +msgstr "¿ôÃͰʳ°¤ÎÃͤò»È¤Ã¤Æ¥Õ¥¤¡¼¥ë¥É¤ò»²¾È¤·¤Æ¤¤¤Þ¤¹¡£" + +#: eval.c:2005 +msgid "attempt to reference from null string" +msgstr "¶õÎó¤ò»È¤Ã¤Æ»²¾È¤·¤Æ¤¤¤Þ¤¹¡£" + +#: eval.c:2011 +#, c-format +msgid "attempt to access field %d" +msgstr "¥Õ¥£¡¼¥ë¥É %d ¤ò»²¾È¤·¤Æ¤¤¤Þ¤¹¡£" + +#: eval.c:2032 eval.c:2039 profile.c:934 +msgid "assignment is not allowed to result of builtin function" +msgstr "Áȹþ´Ø¿ô¤ÎÌá¤êÃͤËÂåÆþ¤Ï¤Ç¤­¤Þ¤»¤ó¡£" + +#: eval.c:2103 +msgid "`IGNORECASE' is a gawk extension" +msgstr "`IGNORECASE' ¤Ï gawk ÆÃÍ­¤Î³ÈÄ¥¤Ç¤¹¡£" + +#: eval.c:2133 +msgid "`BINMODE' is a gawk extension" +msgstr "`BINMODE' ¤Ï gawk ÆÃÍ­¤Î³ÈÄ¥¤Ç¤¹¡£" + +#: eval.c:2255 +#, c-format +msgid "bad `%sFMT' specification `%s'" +msgstr "`%sFMT' ¤Î»ØÄê `%s' ¤¬´Ö°ã¤Ã¤Æ¤¤¤Þ¤¹¡£" + +#: eval.c:2333 +msgid "turning off `--lint' due to assignment to `LINT'" +msgstr "`LINT' ¤Ø¤ÎÂåÆþ¤Ë½¾¤¤ `--lint' ¤ò̵¸ú¤Ë¤·¤Þ¤¹¡£" + +#: ext.c:60 ext.c:64 +msgid "`extension' is a gawk extension" +msgstr "`extension' ¤Ï gawk ÆÃÍ­¤Î³ÈÄ¥¤Ç¤¹¡£" + +#: ext.c:74 +#, c-format +msgid "extension: cannot open `%s' (%s)\n" +msgstr "extension: `%s' ¤ò³«¤±¤Þ¤»¤ó (%s)¡£\n" + +#: ext.c:82 +#, c-format +msgid "extension: library `%s': cannot call function `%s' (%s)\n" +msgstr "extension: ¥é¥¤¥Ö¥é¥ê `%s': ´Ø¿ô `%s' ¤ò¸Æ¤Ó½Ð¤»¤Þ¤»¤ó (%s)¡£\n" + +#: ext.c:102 +msgid "extension: missing function name" +msgstr "" + +#: ext.c:107 +#, fuzzy, c-format +msgid "extension: illegal character `%c' in function name `%s'" +msgstr "extension: ¥é¥¤¥Ö¥é¥ê `%s': ´Ø¿ô `%s' ¤ò¸Æ¤Ó½Ð¤»¤Þ¤»¤ó (%s)¡£\n" + +#: ext.c:113 +#, fuzzy, c-format +msgid "extension: can't redefine function `%s'" +msgstr "extension: `%s' ¤ò³«¤±¤Þ¤»¤ó (%s)¡£\n" + +#: ext.c:117 +#, fuzzy, c-format +msgid "extension: function `%s' already defined" +msgstr "´Ø¿ô `%s' ¤ÏÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£" + +#: ext.c:122 +#, c-format +msgid "extension: can't use gawk built-in `%s' as function name" +msgstr "" + +#: ext.c:124 +#, fuzzy, c-format +msgid "extension: function name `%s' previously defined" +msgstr "´Ø¿ô̾ `%s' ¤ÏÄêµÁºÑ¤ß¤Ç¤¹¡£" + +#: ext.c:201 +#, c-format +msgid "function `%s' defined to take no more than `%d' argument(s)" +msgstr "" + +#: ext.c:204 +#, fuzzy, c-format +msgid "function `%s': missing argument #%d" +msgstr "´Ø¿ô `%s' ¤ÏÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£" + +#: ext.c:214 +#, fuzzy, c-format +msgid "function `%s': argument #%d: attempt to use scalar as an array" +msgstr "¥¹¥«¥é¡¼ `%s' ¤òÇÛÎó¤È¤·¤Æ»ÈÍѤ·¤Æ¤¤¤Þ¤¹¡£" + +#: ext.c:218 +#, c-format +msgid "function `%s': argument #%d: attempt to use array as a scalar" +msgstr "" + +#: ext.c:243 +msgid "Operation Not Supported" +msgstr "¤³¤ÎÁàºî¤Ï¼ÂÁõ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£" + +#: field.c:315 +msgid "NF set to negative value" +msgstr "NF ¤¬Éé¤ÎÃͤǤ¹¡£" + +#: field.c:808 +msgid "split: second argument is not an array" +msgstr "split: ÂèÆó°ú¿ô¤¬ÇÛÎó¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£" + +#: field.c:842 +msgid "split: null string for third arg is a gawk extension" +msgstr "split: Âè»°°ú¿ô¤Ë¶õÎó¤ò»ÈÍѤ¹¤ë¤Î¤Ï gawk ÆÃÍ­¤Î³ÈÄ¥¤Ç¤¹¡£" + +#: field.c:894 +msgid "`FIELDWIDTHS' is a gawk extension" +msgstr "`FIELDWIDTHS' ¤Ï gawk ÆÃÍ­¤Î³ÈÄ¥¤Ç¤¹¡£" + +#: field.c:921 +#, c-format +msgid "field %d in FIELDWIDTHS, must be > 0" +msgstr "FIELDWIDTHS ¤Î Âè %d ¥Õ¥£¡¼¥ë¥É¤ÏÀµ¤ÎÃͤǤʤ±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡£" + +#: field.c:994 +msgid "null string for `FS' is a gawk extension" +msgstr "`FS' ¤Ë¶õÎó¤ò»ÈÍѤ¹¤ë¤Î¤Ï gawk ÆÃÍ­¤Î³ÈÄ¥¤Ç¤¹¡£" + +#: getopt.c:692 getopt.c:711 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: ¥ª¥×¥·¥ç¥ó `%s' ¤ÏÛ£Ëæ¤Ç¤¹¡£\n" + +#: getopt.c:744 getopt.c:748 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: ¥ª¥×¥·¥ç¥ó `--%s' ¤Ë°ú¿ô¤Ï¤¢¤ê¤Þ¤»¤ó¡£\n" + +#: getopt.c:757 getopt.c:762 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: ¥ª¥×¥·¥ç¥ó `%c%s' ¤Ë°ú¿ô¤Ï¤¢¤ê¤Þ¤»¤ó¡£\n" + +#: getopt.c:807 getopt.c:829 getopt.c:1159 getopt.c:1181 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: ¥ª¥×¥·¥ç¥ó `%s' ¤Ë¤Ï°ú¿ô¤¬É¬ÍפǤ¹¡£\n" + +#: getopt.c:867 getopt.c:870 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: ǧ¼±¤Ç¤­¤Ê¤¤¥ª¥×¥·¥ç¥ó `--%s'\n" + +#: getopt.c:878 getopt.c:881 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: ǧ¼±¤Ç¤­¤Ê¤¤¥ª¥×¥·¥ç¥ó `%c%s'\n" + +#: getopt.c:936 getopt.c:939 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: ÉÔÀµ¤Ê¥ª¥×¥·¥ç¥ó -- %c\n" + +#: getopt.c:945 getopt.c:948 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: ̵¸ú¤Ê¥ª¥×¥·¥ç¥ó -- %c\n" + +#: getopt.c:1003 getopt.c:1022 getopt.c:1234 getopt.c:1255 main.c:433 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: °ú¿ô¤¬É¬Íפʥª¥×¥·¥ç¥ó -- %c\n" + +#: getopt.c:1074 getopt.c:1093 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: ¥ª¥×¥·¥ç¥ó `-W %s' ¤ÏÛ£Ëæ¤Ç¤¹¡£\n" + +#: getopt.c:1117 getopt.c:1138 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: ¥ª¥×¥·¥ç¥ó `-W %s' ¤Ë°ú¿ô¤Ï¤¢¤ê¤Þ¤»¤ó¡£\n" + +#: io.c:308 +#, c-format +msgid "cannot open file `%s' for reading (%s)" +msgstr "¥Õ¥¡¥¤¥ë `%s' ¤òÆɤ߹þ¤à¤¿¤á¤Ë³«¤±¤Þ¤»¤ó (%s)¡£" + +#: io.c:395 +#, c-format +msgid "close of fd %d (`%s') failed (%s)" +msgstr "fd %d (`%s') ¤òÊĤ¸¤ë¤³¤È¤¬¤Ç¤­¤Þ¤»¤ó (%s)¡£" + +#: io.c:533 +#, c-format +msgid "invalid tree type %s in redirect()" +msgstr "redirect() ¤ÎÃæ¤ÇÉÔÀµ¤Ê¥Ä¥ê¡¼¥¿¥¤¥× %s ¤ò»ÈÍѤ·¤Æ¤¤¤Þ¤¹¡£" + +#: io.c:539 +#, c-format +msgid "expression in `%s' redirection only has numeric value" +msgstr "`%s' ¥ê¥À¥¤¥ì¥¯¥È¤ÎÌ¿Îá¼°¤Ë¿ôÃͤ·¤«µ­½Ò¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£" + +#: io.c:545 +#, c-format +msgid "expression for `%s' redirection has null string value" +msgstr "`%s' ¥ê¥À¥¤¥ì¥¯¥È¤ÎÌ¿Îá¼°¤¬¶õÎó¤Ç¤¹¡£" + +#: io.c:550 +#, c-format +msgid "filename `%s' for `%s' redirection may be result of logical expression" +msgstr "" +"`%2$s' ¥ê¥À¥¤¥ì¥¯¥È¤ËÏÀÍý±é»»¤Î·ë²Ì¤È»×¤ï¤ì¤ë¥Õ¥¡¥¤¥ë̾ `%1$s' ¤¬»È¤ï¤ì¤Æ¤¤¤Þ" +"¤¹¡£" + +#: io.c:588 +#, c-format +msgid "unnecessary mixing of `>' and `>>' for file `%.*s'" +msgstr "¥Õ¥¡¥¤¥ë `%.*s' ¤ÇɬÍװʾå¤Ë `>' ¤È `>>' ¤òÁȹ礻¤Æ¤¤¤Þ¤¹¡£" + +#: io.c:640 +#, c-format +msgid "can't open pipe `%s' for output (%s)" +msgstr "½ÐÎÏÍѤ˥ѥ¤¥× `%s' ¤ò³«¤±¤Þ¤»¤ó (%s)¡£" + +#: io.c:649 +#, c-format +msgid "can't open pipe `%s' for input (%s)" +msgstr "ÆþÎÏÍѤ˥ѥ¤¥× `%s' ¤ò³«¤±¤Þ¤»¤ó (%s)¡£" + +#: io.c:662 +#, c-format +msgid "can't open two way socket `%s' for input/output (%s)" +msgstr "Æþ½ÐÎÏÍѤÎÁÐÊý¸þ¥½¥±¥Ã¥È `%s' ¤¬³«¤±¤Þ¤»¤ó (%s)¡£" + +#: io.c:666 +#, c-format +msgid "can't open two way pipe `%s' for input/output (%s)" +msgstr "Æþ½ÐÎÏÍѤÎÁÐÊý¸þ¥Ñ¥¤¥× `%s' ¤¬³«¤±¤Þ¤»¤ó (%s)¡£" + +#: io.c:742 +#, c-format +msgid "can't redirect from `%s' (%s)" +msgstr "`%s' ¤«¤é¥ê¥À¥¤¥ì¥¯¥È¤Ç¤­¤Þ¤»¤ó (%s)¡£" + +#: io.c:745 +#, c-format +msgid "can't redirect to `%s' (%s)" +msgstr "`%s' ¤Ë¥ê¥À¥¤¥ì¥¯¥È¤Ç¤­¤Þ¤»¤ó (%s)¡£" + +#: io.c:784 +msgid "" +"reached system limit for open files: starting to multiplex file descriptors" +msgstr "" +"³«¤¤¤Æ¤¤¤ë¥Õ¥¡¥¤¥ë¤Î¿ô¤¬¥·¥¹¥Æ¥àÀ©¸Â¤Ë㤷¤Þ¤·¤¿¡£¥Õ¥¡¥¤¥ëµ­½Ò»Ò¤ò¿½Å²½¤·¤Þ" +"¤¹¡£" + +#: io.c:800 +#, c-format +msgid "close of `%s' failed (%s)." +msgstr "`%s' ¤¬ÊĤ¸¤é¤ì¤Þ¤»¤ó (%s)¡£" + +#: io.c:808 +msgid "too many pipes or input files open" +msgstr "³«¤¤¤Æ¤¤¤ë¥Ñ¥¤¥×¤Þ¤¿¤ÏÆþÎÏ¥Õ¥¡¥¤¥ë¤Î¿ô¤¬Â¿²á¤®¤Þ¤¹¡£" + +#: io.c:831 +msgid "close: second argument must be `to' or `from'" +msgstr "close: ÂèÆó°ú¿ô¤Ë»ÈÍѤǤ­¤ë¤Î¤Ï `to' ¤Þ¤¿¤Ï `from' ¤Ç¤¹¡£" + +#: io.c:845 +#, c-format +msgid "close: `%.*s' is not an open file, pipe or co-process" +msgstr "" +"close: `%.*s' ¤Ï¥Õ¥¡¥¤¥ë¡¢¥Ñ¥¤¥×¡¢ÊÂ¹Ô¥×¥í¥»¥¹¤Î¤¤¤º¤ì¤Ç¤â¤¢¤ê¤Þ¤»¤ó¡£" + +#: io.c:849 +msgid "close of redirection that was never opened" +msgstr "³«¤¤¤Æ¤Ê¤¤¥ê¥À¥¤¥ì¥¯¥È¤òÊĤ¸¤è¤¦¤È¤·¤Æ¤¤¤Þ¤¹¡£" + +#: io.c:945 +#, c-format +msgid "close: redirection `%s' not opened with `|&', second argument ignored" +msgstr "" +"close: ¥ê¥À¥¤¥ì¥¯¥È `%s' ¤Ï `|&' ¤ò»È¤Ã¤Æ¤¤¤Þ¤»¤ó¡£ÂèÆó°ú¿ô¤Ï̵»ë¤·¤Þ¤¹¡£" + +#: io.c:960 +#, c-format +msgid "failure status (%d) on pipe close of `%s' (%s)" +msgstr "¥Ñ¥¤¥× `%2$s' ¤òÊĤ¸¤¿¤È¤­¤Î¾õÂÖ¥³¡¼¥É¤¬¼ºÇÔ (%1$d) ¤Ç¤·¤¿ (%3$s)¡£" + +#: io.c:963 +#, c-format +msgid "failure status (%d) on file close of `%s' (%s)" +msgstr "¥Õ¥¡¥¤¥ë `%2$s' ¤òÊĤ¸¤¿¤È¤­¤Î¾õÂÖ¥³¡¼¥É¤¬¼ºÇÔ (%1$d) ¤Ç¤·¤¿ (%3$s)¡£" + +#: io.c:983 +#, c-format +msgid "no explicit close of socket `%s' provided" +msgstr "¥½¥±¥Ã¥È `%s' ¤òÌÀ¼¨¤·¤ÆÊĤ¸¤Æ¤¤¤Þ¤»¤ó¡£" + +#: io.c:986 +#, c-format +msgid "no explicit close of co-process `%s' provided" +msgstr "ÊÂ¹Ô¥×¥í¥»¥¹ `%s' ¤òÌÀ¼¨¤·¤ÆÊĤ¸¤Æ¤¤¤Þ¤»¤ó¡£" + +#: io.c:989 +#, c-format +msgid "no explicit close of pipe `%s' provided" +msgstr "¥Ñ¥¤¥× `%s' ¤òÌÀ¼¨¤·¤ÆÊĤ¸¤Æ¤¤¤Þ¤»¤ó¡£" + +#: io.c:992 +#, c-format +msgid "no explicit close of file `%s' provided" +msgstr "¥Õ¥¡¥¤¥ë `%s' ¤òÌÀ¼¨¤·¤ÆÊĤ¸¤Æ¤¤¤Þ¤»¤ó¡£" + +#: io.c:1021 io.c:1075 +#, c-format +msgid "error writing standard output (%s)" +msgstr "ɸ½à½ÐÎϤؤνñ¹þ¤ß¥¨¥é¡¼ (%s)" + +#: io.c:1025 io.c:1079 +#, c-format +msgid "error writing standard error (%s)" +msgstr "ɸ½à¥¨¥é¡¼¤Ø¤Î½ñ¹þ¤ß¥¨¥é¡¼ (%s)" + +#: io.c:1033 +#, c-format +msgid "pipe flush of `%s' failed (%s)." +msgstr "¥Ñ¥¤¥× `%s' ¤ò¥Õ¥é¥Ã¥·¥å¤Ç¤­¤Þ¤»¤ó (%s)¡£" + +#: io.c:1036 +#, c-format +msgid "co-process flush of pipe to `%s' failed (%s)." +msgstr "`%s' ¤ØÀܳ¤¹¤ë¥Ñ¥¤¥×¤òÊÂ¹Ô¥×¥í¥»¥¹¤«¤é¥Õ¥é¥Ã¥·¥å¤Ç¤­¤Þ¤»¤ó (%s)¡£" + +#: io.c:1039 +#, c-format +msgid "file flush of `%s' failed (%s)." +msgstr "¥Õ¥¡¥¤¥ë `%s' ¤ò¥Õ¥é¥Ã¥·¥å¤Ç¤­¤Þ¤»¤ó (%s)¡£" + +#: io.c:1198 +msgid "/inet/raw client not ready yet, sorry" +msgstr "»ÄÇ°¤Ê¤¬¤é¡¢/inet/raw ¥¯¥é¥¤¥¢¥ó¥È¤Î½àÈ÷¤¬¤Ç¤­¤Æ¤¤¤Þ¤»¤ó¡£" + +#: io.c:1200 io.c:1237 +msgid "only root may use `/inet/raw'." +msgstr "`/inet/raw' ¤Ï root ¥æ¡¼¥¶¡¼¤Î¤ß»ÈÍѤǤ­¤Þ¤¹¡£" + +#: io.c:1235 +msgid "/inet/raw server not ready yet, sorry" +msgstr "»ÄÇ°¤Ê¤¬¤é¡¢/inet/raw ¥µ¡¼¥Ð¡¼¤Î½àÈ÷¤¬¤Ç¤­¤Æ¤¤¤Þ¤»¤ó¡£" + +#: io.c:1325 +#, c-format +msgid "no (known) protocol supplied in special filename `%s'" +msgstr "" +"¥¹¥Ú¥·¥ã¥ë¥Õ¥¡¥¤¥ë̾ `%s' ¤Ë¡Êǧ¼±¤Ç¤­¤ë¡Ë¥×¥í¥È¥³¥ë¤¬»ØÄꤵ¤ì¤Æ¤¤¤Þ¤»¤ó¡£" + +#: io.c:1343 +#, c-format +msgid "special file name `%s' is incomplete" +msgstr "¥¹¥Ú¥·¥ã¥ë¥Õ¥¡¥¤¥ë̾ `%s' ¤ÏÉÔ´°Á´¤Ç¤¹¡£" + +#: io.c:1355 +#, c-format +msgid "local port invalid in `%s'" +msgstr "`%s' ¤Î¥í¡¼¥«¥ë¥Ý¡¼¥È¤¬Ìµ¸ú¤Ç¤¹¡£" + +#: io.c:1367 +msgid "must supply a remote hostname to `/inet'" +msgstr "`/inet' ¤Ë¤Ï¥ê¥â¡¼¥È¥Û¥¹¥È̾¤¬É¬ÍפǤ¹¡£" + +#: io.c:1382 +msgid "must supply a remote port to `/inet'" +msgstr "`/inet' ¤Ë¤Ï¥ê¥â¡¼¥È¥Ý¡¼¥ÈÈֹ椬ɬÍפǤ¹¡£" + +#: io.c:1388 +#, c-format +msgid "remote port invalid in `%s'" +msgstr "`%s' ¤Î¥ê¥â¡¼¥È¥Ý¡¼¥È¤¬Ìµ¸ú¤Ç¤¹¡£" + +#: io.c:1398 +msgid "TCP/IP communications are not supported" +msgstr "TCP/IP Àܳ¤Ï»ÈÍѤǤ­¤Þ¤»¤ó¡£" + +#: io.c:1407 io.c:1588 +#, c-format +msgid "file `%s' is a directory" +msgstr "¥Õ¥¡¥¤¥ë `%s' ¤Ï¥Ç¥£¥ì¥¯¥È¥ê¤Ç¤¹¡£" + +#: io.c:1477 +#, c-format +msgid "use `PROCINFO[\"%s\"]' instead of `%s'" +msgstr "`%2$s' ¤ÎÂå¤ï¤ê¤Ë `PROCINFO[\"%1$s\"]' ¤ò»ÈÍѤ·¤Æ¤¯¤À¤µ¤¤¡£" + +#: io.c:1509 +msgid "use `PROCINFO[...]' instead of `/dev/user'" +msgstr "`/dev/user' ¤ÎÂå¤ï¤ê¤Ë `PROCINFO[...]' ¤ò»ÈÍѤ·¤Æ¤¯¤À¤µ¤¤¡£" + +#: io.c:1574 io.c:1748 +#, c-format +msgid "could not open `%s', mode `%s'" +msgstr "`%s' (¥â¡¼¥É `%s') ¤ò³«¤±¤Þ¤»¤ó¡£" + +#: io.c:1799 +#, c-format +msgid "close of master pty failed (%s)" +msgstr "¥Þ¥¹¥¿¡¼ pty ¤òÊĤ¸¤é¤ì¤Þ¤»¤ó (%s)¡£" + +#: io.c:1801 io.c:1953 io.c:2105 +#, c-format +msgid "close of stdout in child failed (%s)" +msgstr "»Ò¥×¥í¥»¥¹¤¬É¸½à½ÐÎϤòÊĤ¸¤é¤ì¤Þ¤»¤ó (%s)¡£" + +#: io.c:1804 +#, c-format +msgid "moving slave pty to stdout in child failed (dup: %s)" +msgstr "»Ò¥×¥í¥»¥¹¤¬¥¹¥ì¡¼¥Ö pty ¤òɸ½à½ÐÎϤ˰ÜÆ°¤Ç¤­¤Þ¤»¤ó (dup: %s)¡£" + +#: io.c:1806 io.c:1958 +#, c-format +msgid "close of stdin in child failed (%s)" +msgstr "»Ò¥×¥í¥»¥¹¤¬É¸½àÆþÎϤòÊĤ¸¤é¤ì¤Þ¤»¤ó (%s)¡£" + +#: io.c:1809 +#, c-format +msgid "moving slave pty to stdin in child failed (dup: %s)" +msgstr "»Ò¥×¥í¥»¥¹¤¬¥¹¥ì¡¼¥Ö pty ¤òɸ½àÆþÎϤ˰ÜÆ°¤Ç¤­¤Þ¤»¤ó (dup: %s)¡£" + +#: io.c:1811 io.c:1830 +#, c-format +msgid "close of slave pty failed (%s)" +msgstr "¥¹¥ì¡¼¥Ö pty ¤òÊĤ¸¤é¤ì¤Þ¤»¤ó (%s)¡£" + +#: io.c:1904 io.c:1956 io.c:2086 io.c:2108 +#, c-format +msgid "moving pipe to stdout in child failed (dup: %s)" +msgstr "»Ò¥×¥í¥»¥¹¤¬¥Ñ¥¤¥×¤òɸ½à½ÐÎϤ˰ÜÆ°¤Ç¤­¤Þ¤»¤ó (dup: %s)¡£" + +#: io.c:1908 io.c:1961 +#, c-format +msgid "moving pipe to stdin in child failed (dup: %s)" +msgstr "»Ò¥×¥í¥»¥¹¤¬¥Ñ¥¤¥×¤òɸ½àÆþÎϤ˰ÜÆ°¤Ç¤­¤Þ¤»¤ó (dup: %s)¡£" + +#: io.c:1925 io.c:2099 +msgid "restoring stdout in parent process failed\n" +msgstr "¿Æ¥×¥í¥»¥¹¤¬É¸½à½ÐÎϤòÉüµì¤Ç¤­¤Þ¤»¤ó¡£\n" + +#: io.c:1930 +msgid "restoring stdin in parent process failed\n" +msgstr "¿Æ¥×¥í¥»¥¹¤¬É¸½àÆþÎϤòÉüµì¤Ç¤­¤Þ¤»¤ó¡£\n" + +#: io.c:1964 io.c:2110 io.c:2121 +#, c-format +msgid "close of pipe failed (%s)" +msgstr "¥Ñ¥¤¥×¤òÊĤ¸¤é¤ì¤Þ¤»¤ó (%s)¡£" + +#: io.c:2009 +msgid "`|&' not supported" +msgstr "`|&' ¤Ï»ÈÍѤǤ­¤Þ¤»¤ó¡£" + +#: io.c:2076 +#, c-format +msgid "cannot open pipe `%s' (%s)" +msgstr "¥Ñ¥¤¥× `%s' ¤¬³«¤±¤Þ¤»¤ó (%s)¡£" + +#: io.c:2117 +#, c-format +msgid "cannot create child process for `%s' (fork: %s)" +msgstr "`%s' ÍÑ¤Î»Ò¥×¥í¥»¥¹¤ò¼Â¹Ô¤Ç¤­¤Þ¤»¤ó (fork: %s)¡£" + +#: io.c:2460 +#, c-format +msgid "data file `%s' is empty" +msgstr "¥Ç¡¼¥¿¥Õ¥¡¥¤¥ë `%s' ¤Ï¶õ¤Ç¤¹¡£" + +#: io.c:2503 io.c:2511 +msgid "could not allocate more input memory" +msgstr "ÆþÎÏÍÑ¥á¥â¥ê¡¼¤ò¤³¤ì°Ê¾å³ÎÊݤǤ­¤Þ¤»¤ó¡£" + +#: io.c:2869 io.c:2932 +#, c-format +msgid "error reading input file `%s': %s" +msgstr "ÆþÎÏ¥Õ¥¡¥¤¥ë `%s' ¤òÆɤ߹þ¤ßÃæ¤Ë¥¨¥é¡¼¤¬È¯À¸¤·¤Þ¤·¤¿: %s¡£" + +#: io.c:3057 +msgid "multicharacter value of `RS' is a gawk extension" +msgstr "Ê£¿ô¤Îʸ»ú¤ò `RS' ¤Ë»ÈÍѤ¹¤ë¤Î¤Ï gawk ÆÃÍ­¤Î³ÈÄ¥¤Ç¤¹¡£" + +#: main.c:323 +msgid "`-m[fr]' option irrelevant in gawk" +msgstr "gawk ¤Ç¤Ï¥ª¥×¥·¥ç¥ó `-m[fr]' ¤Ë¸ú²Ì¤Ï¤¢¤ê¤Þ¤»¤ó¡£" + +#: main.c:325 +msgid "-m option usage: `-m[fr] nnn'" +msgstr "-m ¥ª¥×¥·¥ç¥ó¤Î»ÈÍÑË¡: `-m[fr] ¿ôÃÍ'" + +#: main.c:342 +#, c-format +msgid "%s: option `-W %s' unrecognized, ignored\n" +msgstr "%s: ¥ª¥×¥·¥ç¥ó `-W %s' ¤Ïǧ¼±¤Ç¤­¤Þ¤»¤ó¡£Ìµ»ë¤·¤Þ¤¹¡£\n" + +#: main.c:379 +msgid "empty argument to `--source' ignored" +msgstr "¶õ°ú¿ô¤Î `--source' ¤Ï̵»ë¤µ¤ì¤Þ¤¹¡£" + +#: main.c:450 +msgid "environment variable `POSIXLY_CORRECT' set: turning on `--posix'" +msgstr "" +"´Ä¶­ÊÑ¿ô `POSIXLY_CORRECT' ¤¬»ØÄꤵ¤ì¤Æ¤¤¤Þ¤¹¡£¥ª¥×¥·¥ç¥ó `--posix' ¤òÍ­¸ú¤Ë" +"¤·¤Þ¤¹¡£" + +#: main.c:455 +msgid "`--posix' overrides `--traditional'" +msgstr "¥ª¥×¥·¥ç¥ó `--posix' ¤Ï `--traditional' ¤ò̵¸ú¤Ë¤·¤Þ¤¹¡£" + +#: main.c:466 +msgid "`--posix'/`--traditional' overrides `--non-decimal-data'" +msgstr "" +"¥ª¥×¥·¥ç¥ó `--posix'/`--traditional' ¤Ï `--non-decimal-data' ¤ò̵¸ú¤Ë¤·¤Þ¤¹¡£" + +#: main.c:470 +#, c-format +msgid "running %s setuid root may be a security problem" +msgstr "" +"setuid root ¤Ç %s ¤ò¼Â¹Ô¤¹¤ë¤È¡¢¥»¥­¥å¥ê¥Æ¥£¾å¤ÎÌäÂ꤬ȯÀ¸¤¹¤ë¾ì¹ç¤¬¤¢¤ê¤Þ" +"¤¹¡£" + +#: main.c:511 +#, c-format +msgid "can't set binary mode on stdin (%s)" +msgstr "ɸ½àÆþÎϤò¥Ð¥¤¥Ê¥ê¥â¡¼¥É¤ËÀßÄê¤Ç¤­¤Þ¤»¤ó (%s)¡£" + +#: main.c:514 +#, c-format +msgid "can't set binary mode on stdout (%s)" +msgstr "ɸ½à½ÐÎϤò¥Ð¥¤¥Ê¥ê¥â¡¼¥É¤ËÀßÄê¤Ç¤­¤Þ¤»¤ó (%s)¡£" + +#: main.c:516 +#, c-format +msgid "can't set binary mode on stderr (%s)" +msgstr "ɸ½à¥¨¥é¡¼¤ò¥Ð¥¤¥Ê¥ê¥â¡¼¥É¤ËÀßÄê¤Ç¤­¤Þ¤»¤ó (%s)¡£" + +#: main.c:546 +msgid "no program text at all!" +msgstr "¥×¥í¥°¥é¥àʸ¤¬Á´¤¯¤¢¤ê¤Þ¤»¤ó!" + +#: main.c:623 +#, c-format +msgid "Usage: %s [POSIX or GNU style options] -f progfile [--] file ...\n" +msgstr "" +"»È¤¤Êý: %s [POSIX ¤Þ¤¿¤Ï GNU ·Á¼°¥ª¥×¥·¥ç¥ó] -f ¥×¥í¥°¥é¥à¥Õ¥¡¥¤¥ë [--] ÆþÎÏ" +"¥Õ¥¡¥¤¥ë ¡Ä\n" + +#: main.c:625 +#, c-format +msgid "Usage: %s [POSIX or GNU style options] [--] %cprogram%c file ...\n" +msgstr "" +"»È¤¤Êý: %s [POSIX ¤Þ¤¿¤Ï GNU ·Á¼°¥ª¥×¥·¥ç¥ó] [--] %c¥×¥í¥°¥é¥à%c ÆþÎÏ¥Õ¥¡¥¤" +"¥ë ¡Ä\n" + +#: main.c:630 +msgid "POSIX options:\t\tGNU long options:\n" +msgstr "POSIX ¥ª¥×¥·¥ç¥ó:\t\tGNU Ĺ·Á¼°¥ª¥×¥·¥ç¥ó\n" + +#: main.c:631 +msgid "\t-f progfile\t\t--file=progfile\n" +msgstr "\t-f ¥×¥í¥°¥é¥à¥Õ¥¡¥¤¥ë\t\t--file=¥×¥í¥°¥é¥à¥Õ¥¡¥¤¥ë\n" + +#: main.c:632 +msgid "\t-F fs\t\t\t--field-separator=fs\n" +msgstr "" +"\t-F ¥Õ¥£¡¼¥ë¥É¥»¥Ñ¥ì¡¼¥¿\t\t\t--field-separator=¥Õ¥£¡¼¥ë¥É¥»¥Ñ¥ì¡¼¥¿\n" + +#: main.c:633 +msgid "\t-v var=val\t\t--assign=var=val\n" +msgstr "\t-v ÊÑ¿ô=ÂåÆþÃÍ\t\t--assign=ÊÑ¿ô=ÂåÆþÃÍ\n" + +#: main.c:634 +msgid "\t-m[fr] val\n" +msgstr "\t-m[fr] ¿ôÃÍ\n" + +#: main.c:635 +msgid "\t-W compat\t\t--compat\n" +msgstr "\t-W compat\t\t--compat\n" + +#: main.c:636 +msgid "\t-W copyleft\t\t--copyleft\n" +msgstr "\t-W copyleft\t\t--copyleft\n" + +#: main.c:637 +msgid "\t-W copyright\t\t--copyright\n" +msgstr "\t-W copyright\t\t--copyright\n" + +#: main.c:638 +msgid "\t-W dump-variables[=file]\t--dump-variables[=file]\n" +msgstr "\t-W dump-variables[=¥Õ¥¡¥¤¥ë]\t--dump-variables[=¥Õ¥¡¥¤¥ë]\n" + +#: main.c:639 +msgid "\t-W gen-po\t\t--gen-po\n" +msgstr "\t-W gen-po\t\t--gen-po\n" + +#: main.c:640 +msgid "\t-W help\t\t\t--help\n" +msgstr "\t-W help\t\t\t--help\n" + +#: main.c:641 +msgid "\t-W lint[=fatal]\t\t--lint[=fatal]\n" +msgstr "\t-W lint[=fatal]\t\t--lint[=fatal]\n" + +#: main.c:642 +msgid "\t-W lint-old\t\t--lint-old\n" +msgstr "\t-W lint-old\t\t--lint-old\n" + +#: main.c:643 +msgid "\t-W non-decimal-data\t--non-decimal-data\n" +msgstr "\t-W non-decimal-data\t--non-decimal-data\n" + +#: main.c:645 +msgid "\t-W nostalgia\t\t--nostalgia\n" +msgstr "\t-W nostalgia\t\t--nostalgia\n" + +#: main.c:648 +msgid "\t-W parsedebug\t\t--parsedebug\n" +msgstr "\t-W parsedebug\t\t--parsedebug\n" + +#: main.c:650 +msgid "\t-W profile[=file]\t--profile[=file]\n" +msgstr "\t-W profile[=¥Õ¥¡¥¤¥ë]\t--profile[=¥Õ¥¡¥¤¥ë]\n" + +#: main.c:651 +msgid "\t-W posix\t\t--posix\n" +msgstr "\t-W posix\t\t--posix\n" + +#: main.c:652 +msgid "\t-W re-interval\t\t--re-interval\n" +msgstr "\t-W re-interval\t\t--re-interval\n" + +#: main.c:653 +msgid "\t-W source=program-text\t--source=program-text\n" +msgstr "\t-W source=¥×¥í¥°¥é¥àʸ\t--source=¥×¥í¥°¥é¥àʸ\n" + +#: main.c:654 +msgid "\t-W traditional\t\t--traditional\n" +msgstr "\t-W traditional\t\t--traditional\n" + +#: main.c:655 +msgid "\t-W usage\t\t--usage\n" +msgstr "\t-W usage\t\t--usage\n" + +#: main.c:656 +msgid "\t-W version\t\t--version\n" +msgstr "\t-W version\t\t--version\n" + +#: main.c:660 +msgid "" +"\n" +"To report bugs, see node `Bugs' in `gawk.info', which is\n" +"section `Reporting Problems and Bugs' in the printed version.\n" +"\n" +msgstr "" +"\n" +"¥Ð¥°¤òÊó¹ð¤¹¤ë¤Ë¤Ï¡¢`gawk.info¡Ê±Ñʸ¡Ë' ¤Î `Bugs' ¥Î¡¼¥É¤ò\n" +"»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡£ °õºþ¤µ¤ì¤¿¥Þ¥Ë¥å¥¢¥ë¤ÇÂбþ¤¹¤ë¥»¥¯¥·¥ç¥ó\n" +"¤Ï¡¢`Reporting Problems and Bugs' ¤Ç¤¹¡£\n" +"\n" + +#: main.c:664 +msgid "" +"gawk is a pattern scanning and processing language.\n" +"By default it reads standard input and writes standard output.\n" +"\n" +msgstr "" +"gawk ¤Ï¡¢¥Ñ¥¿¡¼¥ó¤ò¸¡º÷¡¢¤½¤·¤Æ½èÍý¤¹¤ë¸À¸ì¤Ç¤¹¡£\n" +"¥Ç¥Õ¥©¥ë¥ÈÀßÄê¤Ç¤Ï¡¢É¸½àÆþÎϤòÆɤ߹þ¤ß¡¢É¸½à½ÐÎϤ˽ñ¤­½Ð¤·¤Þ¤¹¡£\n" +"\n" + +#: main.c:668 +msgid "" +"Examples:\n" +"\tgawk '{ sum += $1 }; END { print sum }' file\n" +"\tgawk -F: '{ print $1 }' /etc/passwd\n" +msgstr "" +"»ÈÍÑÎã:\n" +"\tgawk '{ sum += $1 }; END { print sum }' ÆþÎÏ¥Õ¥¡¥¤¥ë\n" +"\tgawk -F: '{ print $1 }' /etc/passwd\n" + +#: main.c:685 +#, c-format +msgid "" +"Copyright (C) 1989, 1991-%d Free Software Foundation.\n" +"\n" +"This program is free software; you can redistribute it and/or modify\n" +"it under the terms of the GNU General Public License as published by\n" +"the Free Software Foundation; either version 2 of the License, or\n" +"(at your option) any later version.\n" +"\n" +msgstr "" +"Copyright (C) 1989, 1991-%d Free Software Foundation.\n" +"\n" +"ËÜ¥×¥í¥°¥é¥à¤Ï¥Õ¥ê¡¼¡¦¥½¥Õ¥È¥¦¥¨¥¢¤Ç¤¹¡£Free Software Foundation ¸øɽ¤Î\n" +"GNU General Public License¡Ê¥Ð¡¼¥¸¥ç¥ó£²¡¢¤Þ¤¿¤Ï¡¢¤³¤ì°Ê¸å¤Î¥Ð¡¼¥¸¥ç¥ó¡Ë\n" +"¤Ë½¾¤¤ºÆÇÛÉÛ¡¢µÚ¤Ó/¤Þ¤¿¤Ï¡¢Êѹ¹¤ò²Ã¤¨¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£\n" +"\n" + +#: main.c:693 +msgid "" +"This program is distributed in the hope that it will be useful,\n" +"but WITHOUT ANY WARRANTY; without even the implied warranty of\n" +"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" +"GNU General Public License for more details.\n" +"\n" +msgstr "" +"ËÜ¥×¥í¥°¥é¥à¤Ï¡¢ÍøÍѲÁÃͤ¬¤¢¤ë¤³¤È¤ò´üÂÔ¤·¤ÆÇÛÉÛ¤µ¤ì¤Æ¤¤¤Þ¤¹¤¬¡¢\n" +"¤³¤ì¤Ï¡¢ÆÃÄêÌÜŪ¤Ë»ÈÍѲÄǽ¤Ç¤¢¤ë¤³¤È¡¢µÚ¤Ó¡¢¾¦ÍÑÌÜŪ¤Ë»ÈÍѤǤ­¤ë\n" +"¤³¤È¤ò°Å¼¨¤¹¤ë¤â¤Î¤Ç¤Ï¤Ê¤¯¡¢¤¤¤«¤Ê¤ëÊݾڤâ°ìÀÚ¤¢¤ê¤Þ¤»¤ó¡£\n" +"¾Ü¤·¤¯¤Ï¡¢GNU General Public License ¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡£\n" +"\n" + +#: main.c:699 +msgid "" +"You should have received a copy of the GNU General Public License\n" +"along with this program; if not, write to the Free Software\n" +"Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n" +msgstr "" +"ËÜ¥×¥í¥°¥é¥à¤Ë¤Ï¡¢GNU General Public License ¤¬ÅºÉÕ¤µ¤ì¤Æ¤¤¤ë¤Ï¤º¤Ç¤¹¡£\n" +"¤â¤·¡¢ËÜ¥×¥í¥°¥é¥à¤È°ì½ï¤Ë GNU General Public License ¤òÆþ¼ê¤·¤Ê¤«¤Ã¤¿\n" +"¾ì¹ç¤Ë¤Ï¡¢\n" +"\tFree Software Foundation, Inc.,\n" +"\t59 Temple Place - Suite 330, Boston, MA 02111-1307, USA\n" +"¤Ø½ñÌ̤ǤªÃΤ餻¤¯¤À¤µ¤¤¡£\n" + +#: main.c:733 +msgid "-Ft does not set FS to tab in POSIX awk" +msgstr "POSIX »ÅÍͤΠawk ¤Ç¤Ï -Ft ¤Ç FS ¤ò¥¿¥Ö¤ËÀßÄê¤Ç¤­¤Þ¤»¤ó¡£" + +#: main.c:962 +#, c-format +msgid "" +"%s: `%s' argument to `-v' not in `var=value' form\n" +"\n" +msgstr "" +"%s: ¥ª¥×¥·¥ç¥ó `-v' ¤Î°ú¿ô `%s' ¤¬ `ÊÑ¿ô=ÂåÆþÃÍ' ¤Î·Á¼°¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤»¤ó¡£\n" +"\n" + +#: main.c:982 +#, c-format +msgid "`%s' is not a legal variable name" +msgstr "`%s' ¤ÏÉÔÀµ¤ÊÊÑ¿ô̾¤Ç¤¹¡£" + +#: main.c:985 +#, c-format +msgid "`%s' is not a variable name, looking for file `%s=%s'" +msgstr "`%s' ¤ÏÊÑ¿ô̾¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£`%s=%s' ¤Î¥Õ¥¡¥¤¥ë¤òõ¤·¤Þ¤¹¡£" + +#: main.c:1018 +msgid "floating point exception" +msgstr "ÉâÆ°¾®¿ôÅÀÎã³°" + +#: main.c:1025 +msgid "fatal error: internal error" +msgstr "Ã×̿Ū¥¨¥é¡¼: ÆâÉô¥¨¥é¡¼" + +#: main.c:1075 +#, c-format +msgid "no pre-opened fd %d" +msgstr "fd %d ¤¬»öÁ°¤Ë³«¤¤¤Æ¤¤¤Þ¤»¤ó¡£" + +#: main.c:1082 +#, c-format +msgid "could not pre-open /dev/null for fd %d" +msgstr "»öÁ°¤Ë fd %d ÍÑ¤Ë /dev/null ¤ò³«¤±¤Þ¤»¤ó¡£" + +#: main.c:1105 main.c:1114 +#, c-format +msgid "could not find groups: %s" +msgstr "¥°¥ë¡¼¥×¤¬¸«¤Ä¤«¤ê¤Þ¤»¤ó: %s" + +#: msg.c:54 +#, c-format +msgid "cmd. line:" +msgstr "¥³¥Þ¥ó¥É¥é¥¤¥ó:" + +#: msg.c:120 +msgid "warning: " +msgstr "·Ù¹ð: " + +#: msg.c:142 +msgid "error: " +msgstr "¥¨¥é¡¼: " + +#: msg.c:178 +msgid "fatal: " +msgstr "Ã×̿Ū: " + +#: node.c:58 node.c:65 node.c:74 node.c:88 node.c:115 +msgid "can't convert string to float" +msgstr "ʸ»úÎ󤫤éÉâÆ°¾®¿ô¤ËÊÑ´¹¤Ç¤­¤Þ¤»¤ó¡£" + +#: node.c:357 +msgid "backslash at end of string" +msgstr "ʸ»úÎó¤Î½ª¤ê¤Ë¥Ð¥Ã¥¯¥¹¥é¥Ã¥·¥å¤¬»È¤ï¤ì¤Æ¤¤¤Þ¤¹¡£" + +#: node.c:541 +msgid "POSIX does not allow `\\x' escapes" +msgstr "POSIX ¤Ï `\\x' ¥¨¥¹¥±¡¼¥×¤òµö²Ä¤·¤Þ¤»¤ó¡£" + +#: node.c:547 +msgid "no hex digits in `\\x' escape sequence" +msgstr "`\\x' ¥¨¥¹¥±¡¼¥×¥·¡¼¥±¥ó¥¹¤Ë 16 ¿Ê¿ô¤¬¤¢¤ê¤Þ¤»¤ó¡£" + +#: node.c:581 +#, c-format +msgid "escape sequence `\\%c' treated as plain `%c'" +msgstr "¥¨¥¹¥±¡¼¥×¥·¡¼¥±¥ó¥¹ `\\%c' ¤Ï `%c' ¤ÈƱÅù¤Ë°·¤ï¤ì¤Þ¤¹¡£" + +#: posix/gawkmisc.c:172 +#, c-format +msgid "%s %s `%s': could not set close-on-exec: (fcntl: %s)" +msgstr "%s %s `%s': close-on-exec ¤òÀßÄê¤Ç¤­¤Þ¤»¤ó: (fcntl: %s)" + +#: profile.c:91 +#, c-format +msgid "could not open `%s' for writing: %s" +msgstr "`%s' ¤ò½ñ¹þ¤ßÍѤ˳«¤±¤Þ¤»¤ó¤Ç¤·¤¿: %s" + +#: profile.c:467 +#, c-format +msgid "internal error: %s with null vname" +msgstr "ÆâÉô¥¨¥é¡¼: %s ¤Î vname ¤¬Ìµ¸ú¤Ç¤¹¡£" + +#: profile.c:530 +msgid "# treated internally as `delete'" +msgstr "# ÆâÉô¤Ç¤Ï `delete' ¤È¤·¤Æ°·¤ï¤ì¤Þ¤·¤¿¡£" + +#: profile.c:1167 +#, c-format +msgid "# this is a dynamically loaded extension function" +msgstr "" + +#: profile.c:1198 +#, c-format +msgid "\t# gawk profile, created %s\n" +msgstr "\t# gawk ¥×¥í¥Õ¥¡¥¤¥ë¡¢ºîÀ®Æü»þ %s\n" + +#: profile.c:1201 +#, c-format +msgid "" +"\t# BEGIN block(s)\n" +"\n" +msgstr "" +"\t# BEGIN ¥Ö¥í¥Ã¥¯\n" +"\n" + +#: profile.c:1211 +#, c-format +msgid "" +"\t# Rule(s)\n" +"\n" +msgstr "" +"\t# ¥ë¡¼¥ë\n" +"\n" + +#: profile.c:1217 +#, c-format +msgid "" +"\t# END block(s)\n" +"\n" +msgstr "" +"\t# END ¥Ö¥í¥Ã¥¯\n" +"\n" + +#: profile.c:1237 +#, c-format +msgid "" +"\n" +"\t# Functions, listed alphabetically\n" +msgstr "" +"\n" +"\t# ´Ø¿ô°ìÍ÷¡Ê¥¢¥ë¥Õ¥¡¥Ù¥Ã¥È½ç¡Ë\n" + +#: profile.c:1452 +#, c-format +msgid "unexpected type %s in prec_level" +msgstr "prec_level Ãæ¤Î %s ¤ÏͽÁÛ³°¤Î¥¿¥¤¥×¤Ç¤¹¡£" + +#: regcomp.c:150 +msgid "Success" +msgstr "À®¸ù" + +#: regcomp.c:153 +msgid "No match" +msgstr "³ºÅö̵¤·" + +#: regcomp.c:156 +msgid "Invalid regular expression" +msgstr "̵¸ú¤ÊÀµµ¬É½¸½" + +#: regcomp.c:159 +msgid "Invalid collation character" +msgstr "̵¸ú¤Ê¾È¹çʸ»ú" + +#: regcomp.c:162 +msgid "Invalid character class name" +msgstr "̵¸ú¤Êʸ»ú¥¯¥é¥¹Ì¾" + +#: regcomp.c:165 +msgid "Trailing backslash" +msgstr "ºÇ¸å¤Ë¥Ð¥Ã¥¯¥¹¥é¥Ã¥·¥å¤¬ÉÕ¤¤¤Æ¤¤¤Þ¤¹¡£" + +#: regcomp.c:168 +msgid "Invalid back reference" +msgstr "¸åÊý¤Ø¤Î»²¾È¤¬Ìµ¸ú¤Ç¤¹¡£" + +#: regcomp.c:171 +msgid "Unmatched [ or [^" +msgstr "[ ¤Þ¤¿¤Ï [^ ¤¬Âбþ¤·¤Þ¤»¤ó¡£" + +#: regcomp.c:174 +msgid "Unmatched ( or \\(" +msgstr "( ¤Þ¤¿¤Ï \\( ¤¬Âбþ¤·¤Þ¤»¤ó¡£" + +#: regcomp.c:177 +msgid "Unmatched \\{" +msgstr "\\{ ¤¬Âбþ¤·¤Þ¤»¤ó¡£" + +#: regcomp.c:180 +msgid "Invalid content of \\{\\}" +msgstr "\\{\\} ¤ÎÆâÍƤ¬Ìµ¸ú¤Ç¤¹¡£" + +#: regcomp.c:183 +msgid "Invalid range end" +msgstr "ÈÏ°Ï»ØÄê¤Î½ªÃ¼¤¬Ìµ¸ú¤Ç¤¹¡£" + +#: regcomp.c:186 +msgid "Memory exhausted" +msgstr "¥á¥â¥ê¡¼¤¬Â­¤ê¤Þ¤»¤ó¡£" + +#: regcomp.c:189 +msgid "Invalid preceding regular expression" +msgstr "Àè¹Ô¤ÎÀµµ¬É½¸½¤¬Ìµ¸ú¤Ç¤¹¡£" + +#: regcomp.c:192 +msgid "Premature end of regular expression" +msgstr "Àµµ¬É½¸½¤¬½ªÃ¼¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£" + +#: regcomp.c:195 +msgid "Regular expression too big" +msgstr "Àµµ¬É½¸½¤¬Ä¹²á¤®¤Þ¤¹¡£" + +#: regcomp.c:198 +msgid "Unmatched ) or \\)" +msgstr ") ¤Þ¤¿¤Ï \\) ¤¬Âбþ¤·¤Þ¤»¤ó¡£" + +#: regcomp.c:668 +msgid "No previous regular expression" +msgstr "¤³¤ì¤è¤êÁ°¤Ë»ÈÍѤ·¤¿Àµµ¬É½¸½¤Ï¤¢¤ê¤Þ¤»¤ó¡£" + +#~ msgid "or used as a variable or an array" +#~ msgstr "¤Þ¤¿¤ÏÊÑ¿ô¤«ÇÛÎó¤È¤·¤Æ»È¤Ã¤Æ¤¤¤Þ¤¹¡£" + +#~ msgid "regex match failed, not enough memory to match string \"%.*s%s\"" +#~ msgstr "" +#~ "¥á¥â¥ê¡¼¤¬Â­¤é¤Ê¤¤¤¿¤á¡¢Àµµ¬É½¸½ \"%.*s%s\" ¤ò¸¡º÷¤Ç¤­¤Þ¤»¤ó¤Ç¤·¤¿¡£" + +#~ msgid "substr: length %g is < 0" +#~ msgstr "substr: ʸ»ú¿ô %g ¤¬ < 0 ¤Ç¤¹¡£" diff --git a/po/pl.gmo b/po/pl.gmo new file mode 100644 index 000000000..f1fc811f9 Binary files /dev/null and b/po/pl.gmo differ diff --git a/po/pl.po b/po/pl.po new file mode 100644 index 000000000..3357867c4 --- /dev/null +++ b/po/pl.po @@ -0,0 +1,1939 @@ +# Polish translations for GNU AWK package. +# Copyright (C) 2003, 2004 Free Software Foundation, Inc. +# Wojciech Polak , 2003, 2004. +# additional help by Sergey Poznyakoff , 2003. +# +msgid "" +msgstr "" +"Project-Id-Version: gawk 3.1.3l\n" +"Report-Msgid-Bugs-To: arnold@skeeve.com\n" +"POT-Creation-Date: 2004-07-15 13:02+0300\n" +"PO-Revision-Date: 2004-07-18 19:36+0200\n" +"Last-Translator: Wojciech Polak \n" +"Language-Team: Polish \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-2\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " +"|| n%100>=20) ? 1 : 2);\n" + +#: array.c:112 +#, c-format +msgid "attempt to use function `%s' as an array" +msgstr "próba u¿ycia funkcji `%s' jako tablicy" + +#: array.c:115 +#, c-format +msgid "attempt to use scalar parameter `%s' as an array" +msgstr "próba u¿ycia parametru `%s' skalaru jako tablicy" + +#: array.c:118 +#, c-format +msgid "attempt to use scalar `%s' as array" +msgstr "próba u¿ycia skalaru `%s' jako tablicy" + +#: array.c:156 +#, c-format +msgid "from %s" +msgstr "od %s" + +#: array.c:511 +#, c-format +msgid "reference to uninitialized element `%s[\"%s\"]'" +msgstr "odwo³anie do niezainicjowanego elementu `%s[\"%s\"]'" + +#: array.c:517 +#, c-format +msgid "subscript of array `%s' is null string" +msgstr "indeks tablicy `%s' jest zerowym ³añcuchem" + +#: array.c:621 +#, c-format +msgid "delete: index `%s' not in array `%s'" +msgstr "delete: indeks `%s' nie jest w tablicy `%s'" + +#: array.c:791 +#, c-format +msgid "%s: empty (null)\n" +msgstr "%s: pusty (null)\n" + +#: array.c:796 +#, c-format +msgid "%s: empty (zero)\n" +msgstr "%s: pusty (zero)\n" + +#: array.c:800 +#, c-format +msgid "%s: table_size = %d, array_size = %d\n" +msgstr "%s: table_size = %d, array_size = %d\n" + +#: array.c:829 +#, c-format +msgid "%s: is parameter\n" +msgstr "%s: jest parametrem\n" + +#: array.c:834 +#, c-format +msgid "%s: array_ref to %s\n" +msgstr "%s: array_ref do %s\n" + +#: awkgram.y:208 +#, c-format +msgid "%s blocks must have an action part" +msgstr "%s bloków musi posiadaæ czê¶æ dotycz±c± akcji" + +#: awkgram.y:211 +msgid "each rule must have a pattern or an action part" +msgstr "ka¿da regu³a musi posiadaæ wzorzec lub czê¶æ dotycz±c± akcji" + +#: awkgram.y:267 +#, c-format +msgid "`%s' is a built-in function, it cannot be redefined" +msgstr "" +"`%s' jest funkcj± wbudowan±, wiêc nie mo¿e zostaæ ponownie zdefiniowana" + +#: awkgram.y:314 +#, c-format +msgid "regexp constant `/%s/' looks like a C comment, but is not" +msgstr "" +"sta³e wyra¿enie regularne `/%s/' wygl±da jak komentarz C, ale nim nie jest" + +#: awkgram.y:341 awkgram.y:619 +msgid "statement may have no effect" +msgstr "instrukcja mo¿e nie mieæ ¿adnego efektu" + +#: awkgram.y:436 awkgram.y:456 +#, c-format +msgid "`%s' used in %s action" +msgstr "`%s' u¿yty w akcji %s" + +#: awkgram.y:449 awkgram.y:452 +msgid "`nextfile' is a gawk extension" +msgstr "`nextfile' jest rozszerzeniem gawk" + +#: awkgram.y:466 +msgid "`return' used outside function context" +msgstr "`return' u¿yty poza kontekstem funkcji" + +#: awkgram.y:508 +msgid "plain `print' in BEGIN or END rule should probably be `print \"\"'" +msgstr "" +"zwyk³y `print' w regu³ach BEGIN lub END powinien prawdopodobnie byæ jako " +"`print \"\"'" + +#: awkgram.y:521 awkgram.y:528 +msgid "`delete array' is a gawk extension" +msgstr "`delete tablica' jest rozszerzeniem gawk" + +#: awkgram.y:536 awkgram.y:543 +msgid "`delete(array)' is a non-portable tawk extension" +msgstr "`delete(tablica)' jest nieprzeno¶nym rozszerzeniem gawk" + +#: awkgram.y:587 +#, c-format +msgid "duplicate case values in switch body: %s" +msgstr "powielone warto¶ci case w ciele switch: %s" + +#: awkgram.y:597 +msgid "Duplicate `default' detected in switch body" +msgstr "wykryto powielony `default' w ciele switch" + +#: awkgram.y:686 +msgid "multistage two-way pipelines don't work" +msgstr "wieloetapowe dwukierunkowe linie potokowe nie dzia³aj±" + +#: awkgram.y:777 +msgid "regular expression on right of assignment" +msgstr "wyra¿anie regularne po prawej stronie przypisania" + +#: awkgram.y:800 +msgid "regular expression on left of `~' or `!~' operator" +msgstr "wyra¿enie regularne po lewej stronie operatora `~' lub `!~'" + +#: awkgram.y:808 +msgid "regular expression on right of comparison" +msgstr "wyra¿enie regularne po prawej stronie porównania" + +#: awkgram.y:875 +msgid "non-redirected `getline' undefined inside END action" +msgstr "" +"komenda `getline' bez przekierowania nie jest zdefiniowana wewn±trz akcji END" + +#: awkgram.y:902 +msgid "call of `length' without parentheses is not portable" +msgstr "wywo³anie `length' bez nawiasów jest nieprzeno¶ne" + +#: awkgram.y:905 +msgid "call of `length' without parentheses is deprecated by POSIX" +msgstr "wywo³anie `length' bez podania nawiasów jest niezalecane przez POSIX" + +#: awkgram.y:958 +msgid "use of non-array as array" +msgstr "u¿ycie nie-tablicy jako tablicy" + +#: awkgram.y:960 +msgid "invalid subscript expression" +msgstr "nieprawid³owe wyra¿enie indeksowe" + +#: awkgram.y:1158 +msgid "unexpected newline or end of string" +msgstr "niespodziewany znak nowego wiersza lub koñca ³añcucha" + +#: awkgram.y:1254 +msgid "empty program text on command line" +msgstr "pusty tekst programu w linii poleceñ" + +#: awkgram.y:1307 +#, c-format +msgid "can't open source file `%s' for reading (%s)" +msgstr "nie mo¿na otworzyæ pliku ¼ród³owego `%s' do czytania (%s)" + +#: awkgram.y:1384 +#, c-format +msgid "can't read sourcefile `%s' (%s)" +msgstr "nie mo¿na otworzyæ pliku ¼ród³owego `%s' (%s)" + +#: awkgram.y:1392 +#, c-format +msgid "source file `%s' is empty" +msgstr "plik ¼ród³owy `%s' jest pusty" + +#: awkgram.y:1590 awkgram.y:1700 awkgram.y:1718 awkgram.y:2068 awkgram.y:2153 +msgid "source file does not end in newline" +msgstr "plik ¼ród³owy nie posiada na koñcu znaku nowego wiersza" + +#: awkgram.y:1654 +msgid "unterminated regexp ends with `\\' at end of file" +msgstr "" +"niezakoñczone prawid³owo wyra¿enie regularne koñczy siê znakiem `\\' na " +"koñcu pliku" + +#: awkgram.y:1674 +msgid "unterminated regexp" +msgstr "niezakoñczone wyra¿enie regularne" + +#: awkgram.y:1677 +msgid "unterminated regexp at end of file" +msgstr "niezakoñczone wyra¿enie regularne na koñcu pliku" + +#: awkgram.y:1744 +msgid "use of `\\ #...' line continuation is not portable" +msgstr "u¿ycie `\\ #...' kontynuacji linii nie jest przeno¶ne" + +#: awkgram.y:1756 +msgid "backslash not last character on line" +msgstr "backslash nie jest ostatnim znakiem w wierszu" + +#: awkgram.y:1801 +msgid "POSIX does not allow operator `**='" +msgstr "POSIX nie zezwala na operator `**='" + +#: awkgram.y:1803 +msgid "old awk does not support operator `**='" +msgstr "stary awk nie wspiera operatora `**='" + +#: awkgram.y:1812 +msgid "POSIX does not allow operator `**'" +msgstr "POSIX nie zezwala na operator `**'" + +#: awkgram.y:1814 +msgid "old awk does not support operator `**'" +msgstr "stary awk nie wspiera operatora `**'" + +#: awkgram.y:1845 +msgid "operator `^=' is not supported in old awk" +msgstr "operator `^=' nie jest wspierany w starym awk" + +#: awkgram.y:1853 +msgid "operator `^' is not supported in old awk" +msgstr "operator `^' nie jest wspierany w starym awk" + +#: awkgram.y:1937 awkgram.y:1954 +msgid "unterminated string" +msgstr "niezakoñczony ³añcuch" + +#: awkgram.y:2114 +#, c-format +msgid "invalid char '%c' in expression" +msgstr "nieprawid³owy znak '%c' w wyra¿eniu" + +#: awkgram.y:2162 +#, c-format +msgid "`%s' is a gawk extension" +msgstr "`%s' jest rozszerzeniem gawk" + +#: awkgram.y:2165 +#, c-format +msgid "`%s' is a Bell Labs extension" +msgstr "`%s' jest rozszerzeniem Bell Labs" + +#: awkgram.y:2168 +#, c-format +msgid "POSIX does not allow `%s'" +msgstr "POSIX nie zezwala na `%s'" + +#: awkgram.y:2172 +#, c-format +msgid "`%s' is not supported in old awk" +msgstr "`%s' nie jest wspierany w starym awk" + +#: awkgram.y:2198 +msgid "`goto' considered harmful!\n" +msgstr "`goto' uwa¿ane za szkodliwe!\n" + +#: awkgram.y:2260 +#, c-format +msgid "%d is invalid as number of arguments for %s" +msgstr "%d jest nieprawid³owe jako liczba argumentów dla %s" + +#: awkgram.y:2279 awkgram.y:2282 +msgid "match: third argument is a gawk extension" +msgstr "match: trzeci argument jest rozszerzeniem gawk" + +#: awkgram.y:2295 +#, c-format +msgid "%s: string literal as last arg of substitute has no effect" +msgstr "" +"%s: litera³ ³añcuchowy jako ostatni argument podstawienia nie ma ¿adnego " +"efektu" + +#: awkgram.y:2298 +#, c-format +msgid "%s third parameter is not a changeable object" +msgstr "%s trzeci parametr nie jest zmiennym obiektem" + +#: awkgram.y:2325 awkgram.y:2328 +msgid "close: second argument is a gawk extension" +msgstr "close: drugi argument jest rozszerzeniem gawk" + +#: awkgram.y:2338 +msgid "use of dcgettext(_\"...\") is incorrect: remove leading underscore" +msgstr "nieprawid³owe u¿ycie dcgettext(_\"...\"): usuñ znak podkre¶lenia" + +#: awkgram.y:2353 +msgid "use of dcngettext(_\"...\") is incorrect: remove leading underscore" +msgstr "nieprawid³owe u¿ycie dcngettext(_\"...\"): usuñ znak podkre¶lenia" + +#: awkgram.y:2424 +#, c-format +msgid "function `%s': parameter #%d, `%s', duplicates parameter #%d" +msgstr "funkcja `%s': parametr #%d, `%s', powiela parametr #%d" + +#: awkgram.y:2457 +#, c-format +msgid "function `%s': parameter `%s' shadows global variable" +msgstr "funkcja `%s': parametr `%s' zas³ania globaln± zmienn±" + +#: awkgram.y:2569 +#, c-format +msgid "could not open `%s' for writing (%s)" +msgstr "nie mo¿na otworzyæ `%s' do zapisu (%s)" + +#: awkgram.y:2570 profile.c:93 +msgid "sending profile to standard error" +msgstr "wysy³anie profilu na standardowe wyj¶cie diagnostyczne" + +#: awkgram.y:2602 +#, c-format +msgid "%s: close failed (%s)" +msgstr "%s: zamkniêcie nie powiod³o siê (%s)" + +#: awkgram.y:2723 +msgid "shadow_funcs() called twice!" +msgstr "shadow_funcs() wywo³ana podwójnie!" + +#: awkgram.y:2750 +msgid "there were shadowed variables." +msgstr "wyst±pi³y przykryte zmienne." + +#: awkgram.y:2823 +#, c-format +msgid "function `%s': can't use function name as parameter name" +msgstr "funkcja `%s': nie mo¿na u¿yæ nazwy funkcji jako nazwy parametru" + +#: awkgram.y:2833 +#, c-format +msgid "function name `%s' previously defined" +msgstr "nazwa funkcji `%s' zosta³a zdefiniowana poprzednio" + +#: awkgram.y:2984 awkgram.y:2990 +#, c-format +msgid "function `%s' called but never defined" +msgstr "funkcja `%s' zosta³a wywo³ana, ale nigdy nie zosta³a zdefiniowana" + +#: awkgram.y:2993 +#, c-format +msgid "function `%s' defined but never called" +msgstr "funkcja `%s' zosta³a zdefiniowana, ale nigdy nie zosta³a wywo³ana" + +#: awkgram.y:3020 +#, c-format +msgid "regexp constant for parameter #%d yields boolean value" +msgstr "sta³e wyra¿enie regularne dla parametru #%d daje warto¶æ logiczn±" + +#: awkgram.y:3033 +#, c-format +msgid "" +"function `%s' called with space between name and `(',\n" +"or used as a variable or an array" +msgstr "" +"funkcja `%s' zosta³a wywo³ana z bia³ymi znakami pomiêdzy jej nazw± a znakiem " +"`(',\n" +"lub u¿yta jako zmienna lub jako tablica" + +#: builtin.c:149 +#, c-format +msgid "%s to \"%s\" failed (%s)" +msgstr "%s do \"%s\" nie powiód³ siê (%s)" + +#: builtin.c:150 +msgid "standard output" +msgstr "standardowe wyj¶cie" + +#: builtin.c:151 +msgid "reason unknown" +msgstr "nieznany powód" + +#: builtin.c:164 +msgid "exp: received non-numeric argument" +msgstr "exp: otrzymano argument nie bêd±cy liczb±" + +#: builtin.c:170 +#, c-format +msgid "exp: argument %g is out of range" +msgstr "exp: argument %g jest poza zasiêgiem" + +#: builtin.c:228 +#, c-format +msgid "fflush: cannot flush: pipe `%s' opened for reading, not writing" +msgstr "" +"fflush: nie mo¿na opró¿niæ: potok `%s' otwarty do czytania, a nie do zapisu" + +#: builtin.c:231 +#, c-format +msgid "fflush: cannot flush: file `%s' opened for reading, not writing" +msgstr "" +"fflush: nie mo¿na opró¿niæ: plik `%s' otwarty do czytania, a nie do zapisu" + +#: builtin.c:243 +#, c-format +msgid "fflush: `%s' is not an open file, pipe or co-process" +msgstr "fflush: `%s' nie jest ani otwartym plikiem, ani potokiem, ani procesem" + +#: builtin.c:338 +msgid "index: received non-string first argument" +msgstr "index: otrzymano pierwszy argument, który nie jest ³añcuchem" + +#: builtin.c:340 +msgid "index: received non-string second argument" +msgstr "index: otrzymano drugi argument, który nie jest ³añcuchem" + +#: builtin.c:454 +msgid "int: received non-numeric argument" +msgstr "int: otrzymano argument, który nie jest liczb±" + +#: builtin.c:471 +msgid "length: received non-string argument" +msgstr "length: otrzymano argument, który nie jest ³añcuchem" + +#: builtin.c:487 +msgid "log: received non-numeric argument" +msgstr "log: otrzymano argument, który nie jest liczb±" + +#: builtin.c:490 +#, c-format +msgid "log: received negative argument %g" +msgstr "log: otrzymano ujemny argument %g" + +#: builtin.c:654 builtin.c:657 +msgid "must use `count$' on all formats or none" +msgstr "nale¿y u¿yæ `count$' we wszystkich formatach lub nic" + +#: builtin.c:759 +msgid "`$' is not permitted in awk formats" +msgstr "`$' jest niedozwolony w formatach awk" + +#: builtin.c:765 +msgid "arg count with `$' must be > 0" +msgstr "argument count z `$' musi byæ > 0" + +#: builtin.c:767 +#, c-format +msgid "arg count %ld greater than total number of supplied arguments" +msgstr "argument count %ld wiêkszy ni¿ ca³kowita suma argumentów dostarczonych" + +#: builtin.c:769 +msgid "`$' not permitted after period in format" +msgstr "`$' jest niedozwolony po kropce w formacie" + +#: builtin.c:782 +msgid "no `$' supplied for positional field width or precision" +msgstr "brak `$' dla pozycyjnej szeroko¶ci pola lub precyzji" + +#: builtin.c:848 +msgid "`l' is meaningless in awk formats; ignored" +msgstr "`l' jest bezsensowny w formatach awk; zignorowany" + +#: builtin.c:852 +msgid "`l' is not permitted in POSIX awk formats" +msgstr "`l' jest niedozwolony w formatach POSIX awk" + +#: builtin.c:863 +msgid "`L' is meaningless in awk formats; ignored" +msgstr "`L' jest bezsensowny w formatach awk; zignorowany" + +#: builtin.c:867 +msgid "`L' is not permitted in POSIX awk formats" +msgstr "`L' jest niedozwolony w formatach POSIX awk" + +#: builtin.c:878 +msgid "`h' is meaningless in awk formats; ignored" +msgstr "`h' jest bezsensowny w formatach awk; zignorowany" + +#: builtin.c:882 +msgid "`h' is not permitted in POSIX awk formats" +msgstr "`h' jest niedozwolony w formatach POSIX awk" + +#: builtin.c:1111 +#, c-format +msgid "[s]printf: value %g is out of range for `%%%c' format" +msgstr "[s]printf: warto¶æ %g jest poza zasiêgiem dla formatu `%%%c'" + +#: builtin.c:1171 +msgid "not enough arguments to satisfy format string" +msgstr "" +"brak wystarczaj±cej liczby argumentów, aby zaspokoiæ ³añcuch formatuj±cy" + +#: builtin.c:1173 +msgid "^ ran out for this one" +msgstr "zabrak³o ^" + +#: builtin.c:1178 +msgid "[s]printf: format specifier does not have control letter" +msgstr "[s]printf: specyfikator formatu nie posiada kontrolnej litery" + +#: builtin.c:1181 +msgid "too many arguments supplied for format string" +msgstr "zbyt du¿o podanych argumentów w ³añcuchu formatuj±cym" + +#: builtin.c:1247 builtin.c:1250 +msgid "printf: no arguments" +msgstr "printf: brak argumentów" + +#: builtin.c:1274 +msgid "sqrt: received non-numeric argument" +msgstr "sqrt: otrzymano argument, który nie jest liczb±" + +#: builtin.c:1278 +#, c-format +msgid "sqrt: called with negative argument %g" +msgstr "sqrt: wywo³ana z ujemnym argumentem %g" + +#: builtin.c:1301 +#, c-format +msgid "substr: start index %g is invalid, using 1" +msgstr "substr: pocz±tkowy indeks %g jest nieprawid³owy, nast±pi u¿ycie 1" + +#: builtin.c:1306 +#, c-format +msgid "substr: non-integer start index %g will be truncated" +msgstr "" +"substr: pocz±tkowy indeks %g, który nie jest liczb± ca³kowit±, zostanie " +"obciêty" + +#: builtin.c:1325 +#, c-format +msgid "substr: length %g is not >= 1" +msgstr "substr: d³ugo¶æ %g nie jest >= 1" + +#: builtin.c:1327 +#, c-format +msgid "substr: length %g is not >= 0" +msgstr "substr: d³ugo¶æ %g nie jest >= 0" + +#: builtin.c:1334 +#, c-format +msgid "substr: non-integer length %g will be truncated" +msgstr "substr: d³ugo¶æ %g, która nie jest liczb± ca³kowit±, zostanie obciêta" + +#: builtin.c:1339 +#, c-format +msgid "substr: length %g too big for string indexing, truncating to %g" +msgstr "substr: d³ugo¶æ %g zbyt du¿a dla indeksu ³añcucha, obcinanie do %g" + +#: builtin.c:1351 +msgid "substr: source string is zero length" +msgstr "substr: ³añcuch ¼ród³owy ma zerow± d³ugo¶æ" + +#: builtin.c:1357 +#, c-format +msgid "substr: start index %g is past end of string" +msgstr "substr: pocz±tkowy indeks %g le¿y poza koñcem ³añcucha" + +#: builtin.c:1365 +#, c-format +msgid "" +"substr: length %g at start index %g exceeds length of first argument (%lu)" +msgstr "" +"substr: d³ugo¶æ %g zaczynaj±c od %g przekracza d³ugo¶æ pierwszego argumentu " +"(%lu)" + +#: builtin.c:1400 +msgid "strftime: received non-string first argument" +msgstr "strftime: otrzymano pierwszy argument, który nie jest ³añcuchem" + +#: builtin.c:1406 +msgid "strftime: received empty format string" +msgstr "strftime: otrzymano pusty ³añcuch formatuj±cy" + +#: builtin.c:1415 +msgid "strftime: received non-numeric second argument" +msgstr "strftime: otrzymano drugi argument, który nie jest liczb±" + +#: builtin.c:1478 +msgid "mktime: received non-string argument" +msgstr "mktime: otrzymano argument, który nie jest ³añcuchem" + +#: builtin.c:1523 +msgid "system: received non-string argument" +msgstr "system: otrzymano argument, który nie jest ³añcuchem" + +#: builtin.c:1644 eval.c:2019 +#, c-format +msgid "reference to uninitialized field `$%d'" +msgstr "odwo³anie do niezainicjowanego pola `$%d'" + +#: builtin.c:1671 +msgid "tolower: received non-string argument" +msgstr "tolower: otrzymano argument, który nie jest ³añcuchem" + +#: builtin.c:1720 +msgid "toupper: received non-string argument" +msgstr "toupper: otrzymano argument, który nie jest ³añcuchem" + +#: builtin.c:1765 +msgid "atan2: received non-numeric first argument" +msgstr "atan2: otrzymano pierwszy argument, który nie jest liczb±" + +#: builtin.c:1767 +msgid "atan2: received non-numeric second argument" +msgstr "atan2: otrzymano drugi argument, który nie jest liczb±" + +#: builtin.c:1786 +msgid "sin: received non-numeric argument" +msgstr "sin: otrzymano argument, który nie jest liczb±" + +#: builtin.c:1802 +msgid "cos: received non-numeric argument" +msgstr "cos: otrzymano argument, który nie jest liczb±" + +#: builtin.c:1852 +msgid "srand: received non-numeric argument" +msgstr "srand: otrzymano argument, który nie jest liczb±" + +#: builtin.c:1887 +msgid "match: third argument is not an array" +msgstr "match: otrzymano trzeci argument, który nie jest tablic±" + +#: builtin.c:2414 +msgid "gensub: third argument of 0 treated as 1" +msgstr "gensub: trzeci argument 0 potraktowany jako 1" + +#: builtin.c:2572 +msgid "lshift: received non-numeric first argument" +msgstr "lshift: otrzymano pierwszy argument, który nie jest liczb±" + +#: builtin.c:2574 +msgid "lshift: received non-numeric second argument" +msgstr "lshift: otrzymano drugi argument, który nie jest liczb±" + +#: builtin.c:2580 +#, c-format +msgid "lshift(%lf, %lf): negative values will give strange results" +msgstr "lshift(%lf, %lf): ujemne warto¶ci spowoduj± dziwne wyniki" + +#: builtin.c:2582 +#, c-format +msgid "lshift(%lf, %lf): fractional values will be truncated" +msgstr "lshift(%lf, %lf): u³amkowe warto¶ci zostan± obciête" + +#: builtin.c:2584 +#, c-format +msgid "lshift(%lf, %lf): too large shift value will give strange results" +msgstr "" +"lshift(%lf, %lf): zbyt du¿a warto¶æ przesuniêcia spowoduje dziwne wyniki" + +#: builtin.c:2610 +msgid "rshift: received non-numeric first argument" +msgstr "rshift: otrzymano pierwszy argument, który nie jest liczb±" + +#: builtin.c:2612 +msgid "rshift: received non-numeric second argument" +msgstr "rshift: otrzymano drugi argument, który nie jest liczb±" + +#: builtin.c:2618 +#, c-format +msgid "rshift(%lf, %lf): negative values will give strange results" +msgstr "rshift(%lf, %lf): ujemne warto¶ci spowoduj± dziwne wyniki" + +#: builtin.c:2620 +#, c-format +msgid "rshift(%lf, %lf): fractional values will be truncated" +msgstr "rshift(%lf, %lf): u³amkowe warto¶ci zostan± obciête" + +#: builtin.c:2622 +#, c-format +msgid "rshift(%lf, %lf): too large shift value will give strange results" +msgstr "" +"rshift(%lf, %lf): zbyt du¿a warto¶æ przesuniêcia spowoduje dziwne wyniki" + +#: builtin.c:2648 +msgid "and: received non-numeric first argument" +msgstr "and: otrzymano pierwszy argument, który nie jest liczb±" + +#: builtin.c:2650 +msgid "and: received non-numeric second argument" +msgstr "and: otrzymano drugi argument, który nie jest liczb±" + +#: builtin.c:2656 +#, c-format +msgid "and(%lf, %lf): negative values will give strange results" +msgstr "and(%lf, %lf): ujemne warto¶ci spowoduj± dziwne wyniki" + +#: builtin.c:2658 +#, c-format +msgid "and(%lf, %lf): fractional values will be truncated" +msgstr "and(%lf, %lf): u³amkowe warto¶ci zostan± obciête" + +#: builtin.c:2684 +msgid "or: received non-numeric first argument" +msgstr "or: otrzymano pierwszy argument, który nie jest liczb±" + +#: builtin.c:2686 +msgid "or: received non-numeric second argument" +msgstr "or: otrzymano drugi argument, który nie jest liczb±" + +#: builtin.c:2692 +#, c-format +msgid "or(%lf, %lf): negative values will give strange results" +msgstr "or(%lf, %lf): ujemne warto¶ci spowoduj± dziwne wyniki" + +#: builtin.c:2694 +#, c-format +msgid "or(%lf, %lf): fractional values will be truncated" +msgstr "or(%lf, %lf): u³amkowe warto¶ci zostan± obciête" + +#: builtin.c:2720 +msgid "xor: received non-numeric first argument" +msgstr "xor: otrzymano pierwszy argument, który nie jest liczb±" + +#: builtin.c:2722 +msgid "xor: received non-numeric second argument" +msgstr "xor: otrzymano drugi argument, który nie jest liczb±" + +#: builtin.c:2728 +#, c-format +msgid "xor(%lf, %lf): negative values will give strange results" +msgstr "xor(%lf, %lf): ujemne warto¶ci spowoduj± dziwne wyniki" + +#: builtin.c:2730 +#, c-format +msgid "xor(%lf, %lf): fractional values will be truncated" +msgstr "xor(%lf, %lf): u³amkowe warto¶ci zostan± obciête" + +#: builtin.c:2754 +msgid "compl: received non-numeric argument" +msgstr "compl: otrzymano argument, który nie jest liczb±" + +#: builtin.c:2760 +#, c-format +msgid "compl(%lf): negative value will give strange results" +msgstr "compl(%lf): ujemne warto¶ci spowoduj± dziwne wyniki" + +#: builtin.c:2762 +#, c-format +msgid "compl(%lf): fractional value will be truncated" +msgstr "compl(%lf): u³amkowe warto¶ci zostan± obciête" + +#: builtin.c:2935 +#, c-format +msgid "dcgettext: `%s' is not a valid locale category" +msgstr "dcgettext: `%s' nie jest prawid³ow± kategori± lokalizacji" + +#: eval.c:303 +#, c-format +msgid "unknown nodetype %d" +msgstr "nieznany typ wêz³a %d" + +#: eval.c:350 +msgid "buffer overflow in genflags2str" +msgstr "przepe³nienie bufora w genflags2str" + +#: eval.c:382 eval.c:388 profile.c:837 +#, c-format +msgid "attempt to use array `%s' in a scalar context" +msgstr "próba u¿ycia tablicy `%s' w kontek¶cie skalaru" + +#: eval.c:730 +#, c-format +msgid "for loop: array `%s' changed size from %ld to %ld during loop execution" +msgstr "" +"pêtla for: tablica `%s' zmieni³a rozmiar z %ld do %ld podczas wykonywania " +"pêtli" + +#: eval.c:751 +msgid "`break' outside a loop is not portable" +msgstr "instrukcja `break' poza pêtl± jest nieprzeno¶na" + +#: eval.c:755 +msgid "`break' outside a loop is not allowed" +msgstr "instrukcja `break' poza pêtl± jest niedozwolona" + +#: eval.c:772 +msgid "`continue' outside a loop is not portable" +msgstr "instrukcja `continue' poza pêtl± jest nieprzeno¶na" + +#: eval.c:776 +msgid "`continue' outside a loop is not allowed" +msgstr "instrukcja `continue' poza pêtl± jest niedozwolona" + +#: eval.c:810 +msgid "`next' cannot be called from a BEGIN rule" +msgstr "instrukcja `next' nie mo¿e byæ wywo³ana z wnêtrza regu³y BEGIN" + +#: eval.c:812 +msgid "`next' cannot be called from an END rule" +msgstr "instrukcja `next' nie mo¿e byæ wywo³ana z wnêtrza regu³y END" + +#: eval.c:821 +msgid "`nextfile' cannot be called from a BEGIN rule" +msgstr "instrukcja `nextfile' nie mo¿e byæ wywo³ana z wnêtrza regu³y BEGIN" + +#: eval.c:823 +msgid "`nextfile' cannot be called from an END rule" +msgstr "instrukcja `nextfile' nie mo¿e byæ wywo³ana z wnêtrza regu³y END" + +#: eval.c:872 +msgid "statement has no effect" +msgstr "instrukcja nie ma ¿adnego efektu" + +#: eval.c:915 eval.c:1873 +#, c-format +msgid "can't use function name `%s' as variable or array" +msgstr "nie mo¿na u¿yæ nazwy funkcji `%s' jako zmiennej lub tablicy" + +#: eval.c:922 eval.c:928 +#, c-format +msgid "reference to uninitialized argument `%s'" +msgstr "odwo³anie do niezainicjowanego argumentu `%s'" + +#: eval.c:937 eval.c:1882 +#, c-format +msgid "reference to uninitialized variable `%s'" +msgstr "odwo³anie do niezainicjowanej zmiennej `%s'" + +#: eval.c:1083 +msgid "" +"concatenation: side effects in one expression have changed the length of " +"another!" +msgstr "" +"konkatenacja: skutki uboczne w jednym wyra¿eniu spowodowa³y zmianê d³ugo¶ci " +"innego wyra¿enia!" + +#: eval.c:1162 +msgid "assignment used in conditional context" +msgstr "przypisanie u¿yte w kontek¶cie warunkowym" + +#: eval.c:1252 +msgid "division by zero attempted" +msgstr "próba dzielenia przez zero" + +#: eval.c:1267 +#, c-format +msgid "division by zero attempted in `%%'" +msgstr "próba dzielenia przez zero w `%%'" + +#: eval.c:1282 profile.c:713 +#, c-format +msgid "illegal type (%s) in tree_eval" +msgstr "nieprawid³owy typ (%s) w tree_eval" + +#: eval.c:1459 +msgid "division by zero attempted in `/='" +msgstr "próba dzielenia przez zero w `/='" + +#: eval.c:1477 +#, c-format +msgid "division by zero attempted in `%%='" +msgstr "próba dzielenia przez zero w `%%='" + +#: eval.c:1738 +#, c-format +msgid "function `%s' called with more arguments than declared" +msgstr "" +"funkcja `%s' zosta³a wywo³ana z wiêksz± ilo¶ci± argumentów ni¿ zosta³o to " +"zadeklarowane" + +#: eval.c:1782 +#, c-format +msgid "function `%s' not defined" +msgstr "funkcja `%s' nie zosta³a zdefiniowana" + +#: eval.c:1788 +#, c-format +msgid "function %s called\n" +msgstr "wywo³ano funkcjê %s\n" + +#: eval.c:1845 +#, c-format +msgid "" +"\n" +"\t# Function Call Stack:\n" +"\n" +msgstr "" +"\n" +"\t# Stos Wywo³awczy Funkcji:\n" +"\n" + +#: eval.c:1848 +#, c-format +msgid "\t# -- main --\n" +msgstr "\t# -- g³ówne --\n" + +#: eval.c:2003 +msgid "attempt to field reference from non-numeric value" +msgstr "próba odwo³ania do pola poprzez nienumeryczn± warto¶æ" + +#: eval.c:2005 +msgid "attempt to reference from null string" +msgstr "próba odwo³ania z zerowego ³añcucha" + +#: eval.c:2011 +#, c-format +msgid "attempt to access field %d" +msgstr "próba dostêpu do pola %d" + +#: eval.c:2032 eval.c:2039 profile.c:934 +msgid "assignment is not allowed to result of builtin function" +msgstr "przypisanie do wyniku wbudowanej funkcji nie jest dozwolone" + +#: eval.c:2103 +msgid "`IGNORECASE' is a gawk extension" +msgstr "`IGNORECASE' jest rozszerzeniem gawk" + +#: eval.c:2133 +msgid "`BINMODE' is a gawk extension" +msgstr "`BINMODE' jest rozszerzeniem gawk" + +#: eval.c:2255 +#, c-format +msgid "bad `%sFMT' specification `%s'" +msgstr "z³a specyfikacja `%sFMT' `%s'" + +#: eval.c:2333 +msgid "turning off `--lint' due to assignment to `LINT'" +msgstr "wy³±czenie `--lint' z powodu przypisania do `LINT'" + +#: ext.c:60 ext.c:64 +msgid "`extension' is a gawk extension" +msgstr "`extension' jest rozszerzeniem gawk" + +#: ext.c:74 +#, c-format +msgid "extension: cannot open `%s' (%s)\n" +msgstr "rozszerzenie: nie mo¿na otworzyæ `%s' (%s)\n" + +#: ext.c:82 +#, c-format +msgid "extension: library `%s': cannot call function `%s' (%s)\n" +msgstr "rozszerzenie: biblioteka `%s': nie mo¿na wywo³aæ funkcji `%s' (%s)\n" + +#: ext.c:102 +msgid "extension: missing function name" +msgstr "rozszerzenie: brakuj±ca nazwa funkcji" + +#: ext.c:107 +#, c-format +msgid "extension: illegal character `%c' in function name `%s'" +msgstr "rozszerzenie: nieprawid³owy znak `%c' w nazwie funkcji `%s'" + +#: ext.c:113 +#, c-format +msgid "extension: can't redefine function `%s'" +msgstr "rozszerzenie: nie mo¿na zredefiniowaæ funkcji `%s'" + +#: ext.c:117 +#, c-format +msgid "extension: function `%s' already defined" +msgstr "rozserzenie: funkcja `%s' zosta³a ju¿ zdefiniowana" + +#: ext.c:122 +#, c-format +msgid "extension: can't use gawk built-in `%s' as function name" +msgstr "rozszerzenie: nie mo¿na u¿yæ wbudowanej w gawk `%s' jako nazwy funkcji" + +#: ext.c:124 +#, c-format +msgid "extension: function name `%s' previously defined" +msgstr "rozserzenie: nazwa funkcji `%s' zosta³a zdefiniowana wcze¶niej" + +#: ext.c:201 +#, c-format +msgid "function `%s' defined to take no more than `%d' argument(s)" +msgstr "funkcja `%s' zdefiniowana aby pobraæ nie wiêcej ni¿ `%d' argument(ów)" + +#: ext.c:204 +#, c-format +msgid "function `%s': missing argument #%d" +msgstr "funkcja `%s': brakuje #%d argumentu" + +#: ext.c:214 +#, c-format +msgid "function `%s': argument #%d: attempt to use scalar as an array" +msgstr "funkcja `%s': argument #%d: próba u¿ycia skalaru jako tablicy" + +#: ext.c:218 +#, c-format +msgid "function `%s': argument #%d: attempt to use array as a scalar" +msgstr "funkcja `%s': argument #%d: próba u¿ycia tablicy jako skalaru" + +#: ext.c:243 +msgid "Operation Not Supported" +msgstr "Operacja nie jest wspierana" + +#: field.c:315 +msgid "NF set to negative value" +msgstr "NF ustawiony na warto¶æ ujemn±" + +#: field.c:808 +msgid "split: second argument is not an array" +msgstr "split: drugi argument nie jest tablic±" + +#: field.c:842 +msgid "split: null string for third arg is a gawk extension" +msgstr "split: zerowy ³añcuch dla trzeciego argumentu jest rozszerzeniem gawk" + +#: field.c:894 +msgid "`FIELDWIDTHS' is a gawk extension" +msgstr "`FIELDWIDTHS' jest rozszerzeniem gawk" + +#: field.c:921 +#, c-format +msgid "field %d in FIELDWIDTHS, must be > 0" +msgstr "pole nr %d w FIELDWIDTHS musi byæ wiêksze od zera" + +#: field.c:994 +msgid "null string for `FS' is a gawk extension" +msgstr "zerowy ³añcuch dla `FS' jest rozszerzeniem gawk" + +#: getopt.c:692 getopt.c:711 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: opcja `%s' jest niejednoznaczna\n" + +#: getopt.c:744 getopt.c:748 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: opcja `--%s' nie mo¿e mieæ argumentów\n" + +#: getopt.c:757 getopt.c:762 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: opcja `%c%s' nie mo¿e mieæ argumentów\n" + +#: getopt.c:807 getopt.c:829 getopt.c:1159 getopt.c:1181 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: opcja `%s' musi mieæ argument\n" + +#: getopt.c:867 getopt.c:870 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: nieznana opcja `--%s'\n" + +#: getopt.c:878 getopt.c:881 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: nieznana opcja `%c%s'\n" + +#: getopt.c:936 getopt.c:939 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: niew³a¶ciwa opcja -- %c\n" + +#: getopt.c:945 getopt.c:948 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: b³êdna opcja -- %c\n" + +#: getopt.c:1003 getopt.c:1022 getopt.c:1234 getopt.c:1255 main.c:433 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: opcja musi mieæ argument -- %c\n" + +#: getopt.c:1074 getopt.c:1093 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: opcja `-W %s' jest niejednoznaczna\n" + +#: getopt.c:1117 getopt.c:1138 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: opcja `-W %s' nie mo¿e mieæ argumentów\n" + +#: io.c:308 +#, c-format +msgid "cannot open file `%s' for reading (%s)" +msgstr "nie mo¿na otworzyæ pliku `%s' do czytania (%s)" + +#: io.c:395 +#, c-format +msgid "close of fd %d (`%s') failed (%s)" +msgstr "zamkniêcie fd %d (`%s') nie powiod³o siê (%s)" + +#: io.c:533 +#, c-format +msgid "invalid tree type %s in redirect()" +msgstr "nieprawid³owy typ drzewa %s w funkcji redirect()" + +#: io.c:539 +#, c-format +msgid "expression in `%s' redirection only has numeric value" +msgstr "wyra¿enie w przekierowaniu `%s' ma tylko warto¶æ numeryczn±" + +#: io.c:545 +#, c-format +msgid "expression for `%s' redirection has null string value" +msgstr "wyra¿enie dla przekierowania `%s' ma zerow± warto¶æ ³añcucha" + +#: io.c:550 +#, c-format +msgid "filename `%s' for `%s' redirection may be result of logical expression" +msgstr "" +"nazwa pliku `%s' dla przekierowania `%s' mo¿e byæ rezultatem logicznego " +"wyra¿enia" + +#: io.c:588 +#, c-format +msgid "unnecessary mixing of `>' and `>>' for file `%.*s'" +msgstr "niepotrzebne mieszanie `>' i `>>' dla pliku `%.*s'" + +#: io.c:640 +#, c-format +msgid "can't open pipe `%s' for output (%s)" +msgstr "nie mo¿na otworzyæ potoku `%s' jako wyj¶cia (%s)" + +#: io.c:649 +#, c-format +msgid "can't open pipe `%s' for input (%s)" +msgstr "nie mo¿na otworzyæ potoku `%s' jako wej¶cia (%s)" + +#: io.c:662 +#, c-format +msgid "can't open two way socket `%s' for input/output (%s)" +msgstr "" +"nie mo¿na otworzyæ dwukierunkowego gniazda `%s' jako wej¶cia/wyj¶cia (%s)" + +#: io.c:666 +#, c-format +msgid "can't open two way pipe `%s' for input/output (%s)" +msgstr "" +"nie mo¿na otworzyæ dwukierunkowego potoku `%s' jako wej¶cia/wyj¶cia (%s)" + +#: io.c:742 +#, c-format +msgid "can't redirect from `%s' (%s)" +msgstr "nie mo¿na przekierowaæ z `%s' (%s)" + +#: io.c:745 +#, c-format +msgid "can't redirect to `%s' (%s)" +msgstr "nie mo¿na przekierowaæ do `%s' (%s)" + +#: io.c:784 +msgid "" +"reached system limit for open files: starting to multiplex file descriptors" +msgstr "" +"osi±gniêto systemowy limit otwartych plików: rozpoczêcie multipleksowania " +"deskryptorów plików" + +#: io.c:800 +#, c-format +msgid "close of `%s' failed (%s)." +msgstr "zamkniêcie `%s' nie powiod³o siê (%s)." + +#: io.c:808 +msgid "too many pipes or input files open" +msgstr "zbyt du¿o otwartych potoków lub plików wej¶ciowych" + +#: io.c:831 +msgid "close: second argument must be `to' or `from'" +msgstr "close: drugim argumentem musi byæ `to' lub `from'" + +#: io.c:845 +#, c-format +msgid "close: `%.*s' is not an open file, pipe or co-process" +msgstr "" +"close: `%.*s' nie jest ani otwartym plikiem, ani potokiem, ani procesem" + +#: io.c:849 +msgid "close of redirection that was never opened" +msgstr "zamkniêcie przekierowania, które nigdy nie zosta³o otwarte" + +#: io.c:945 +#, c-format +msgid "close: redirection `%s' not opened with `|&', second argument ignored" +msgstr "" +"close: przekierowanie `%s' nie zosta³o otwarte z `|&', drugi argument " +"zignorowany" + +#: io.c:960 +#, c-format +msgid "failure status (%d) on pipe close of `%s' (%s)" +msgstr "status awarii (%d) podczas zamykania potoku `%s' (%s)" + +#: io.c:963 +#, c-format +msgid "failure status (%d) on file close of `%s' (%s)" +msgstr "status awarii (%d) podczas zamykania pliku `%s' (%s)" + +#: io.c:983 +#, c-format +msgid "no explicit close of socket `%s' provided" +msgstr "brak jawnego zamkniêcia gniazdka `%s'" + +#: io.c:986 +#, c-format +msgid "no explicit close of co-process `%s' provided" +msgstr "brak jawnego zamkniêcia procesu pomocniczego `%s'" + +#: io.c:989 +#, c-format +msgid "no explicit close of pipe `%s' provided" +msgstr "brak jawnego zamkniêcia potoku `%s'" + +#: io.c:992 +#, c-format +msgid "no explicit close of file `%s' provided" +msgstr "brak jawnego zamkniêcia pliku `%s'" + +#: io.c:1021 io.c:1075 +#, c-format +msgid "error writing standard output (%s)" +msgstr "b³±d podczas zapisu na standardowe wyj¶cie (%s)" + +#: io.c:1025 io.c:1079 +#, c-format +msgid "error writing standard error (%s)" +msgstr "b³±d podczas zapisu na standardowe wyj¶cie diagnostyczne (%s)" + +#: io.c:1033 +#, c-format +msgid "pipe flush of `%s' failed (%s)." +msgstr "opró¿nienie potoku `%s' nie powiod³o siê (%s)." + +#: io.c:1036 +#, c-format +msgid "co-process flush of pipe to `%s' failed (%s)." +msgstr "" +"opró¿nienie potoku do `%s' przez proces pomocniczy nie powiod³o siê (%s)." + +#: io.c:1039 +#, c-format +msgid "file flush of `%s' failed (%s)." +msgstr "opró¿nienie pliku `%s' nie powiod³o siê (%s)." + +#: io.c:1198 +msgid "/inet/raw client not ready yet, sorry" +msgstr "klient /inet/raw nie jest jeszcze gotowy, przykro mi" + +#: io.c:1200 io.c:1237 +msgid "only root may use `/inet/raw'." +msgstr "tylko superu¿ytkownik (root) mo¿e u¿yæ `/inet/raw'." + +#: io.c:1235 +msgid "/inet/raw server not ready yet, sorry" +msgstr "serwer /inet/raw nie jest jeszcze gotowy, przykro mi" + +#: io.c:1325 +#, c-format +msgid "no (known) protocol supplied in special filename `%s'" +msgstr "nie dostarczono (znanego) protoko³u w specjalnym pliku `%s'" + +#: io.c:1343 +#, c-format +msgid "special file name `%s' is incomplete" +msgstr "specjalna nazwa pliku `%s' jest niekompletna" + +#: io.c:1355 +#, c-format +msgid "local port invalid in `%s'" +msgstr "nieprawid³owy lokalny port `%s'" + +#: io.c:1367 +msgid "must supply a remote hostname to `/inet'" +msgstr "nale¿y dostarczyæ nazwê zdalnego hosta do `/inet'" + +#: io.c:1382 +msgid "must supply a remote port to `/inet'" +msgstr "nale¿y dostarczyæ numer zdalnego portu do `/inet'" + +#: io.c:1388 +#, c-format +msgid "remote port invalid in `%s'" +msgstr "nieprawid³owy zdalny port w `%s'" + +#: io.c:1398 +msgid "TCP/IP communications are not supported" +msgstr "Komunikacja TCP/IP nie jest wspierana" + +#: io.c:1407 io.c:1588 +#, c-format +msgid "file `%s' is a directory" +msgstr "plik `%s' jest katalogiem" + +#: io.c:1477 +#, c-format +msgid "use `PROCINFO[\"%s\"]' instead of `%s'" +msgstr "u¿yj `PROCINFO[\"%s\"]' zamiast `%s'" + +#: io.c:1509 +msgid "use `PROCINFO[...]' instead of `/dev/user'" +msgstr "u¿yj `PROCINFO[...]' zamiast `/dev/user'" + +#: io.c:1574 io.c:1748 +#, c-format +msgid "could not open `%s', mode `%s'" +msgstr "nie mo¿na otworzyæ `%s', tryb `%s'" + +#: io.c:1799 +#, c-format +msgid "close of master pty failed (%s)" +msgstr "zamkniêcie nadrzêdnego pty nie powiod³o siê (%s)" + +#: io.c:1801 io.c:1953 io.c:2105 +#, c-format +msgid "close of stdout in child failed (%s)" +msgstr "" +"zamkniêcie standardowego wyj¶cia w procesie potomnym nie powiod³o siê (%s)" + +#: io.c:1804 +#, c-format +msgid "moving slave pty to stdout in child failed (dup: %s)" +msgstr "" +"przesuniêcie podleg³ego pty na standardowe wyj¶cie w procesie potomnym nie " +"powiod³o siê (dup: %s)" + +#: io.c:1806 io.c:1958 +#, c-format +msgid "close of stdin in child failed (%s)" +msgstr "" +"zamkniêcie standardowego wej¶cia w procesie potomnym nie powiod³o siê (%s)" + +#: io.c:1809 +#, c-format +msgid "moving slave pty to stdin in child failed (dup: %s)" +msgstr "" +"przesuniêcie podleg³ego pty na standardowe wej¶cie w procesie potomnym nie " +"powiod³o siê (dup: %s)" + +#: io.c:1811 io.c:1830 +#, c-format +msgid "close of slave pty failed (%s)" +msgstr "zamkniêcie podleg³ego pty nie powiod³o siê (%s)" + +#: io.c:1904 io.c:1956 io.c:2086 io.c:2108 +#, c-format +msgid "moving pipe to stdout in child failed (dup: %s)" +msgstr "" +"przesuniêcie potoku na standardowe wyj¶cie w procesie potomnym nie powiod³o " +"siê (dup: %s)" + +#: io.c:1908 io.c:1961 +#, c-format +msgid "moving pipe to stdin in child failed (dup: %s)" +msgstr "" +"przesuniêcie potoku na standardowe wej¶cie w procesie potomnym nie powiod³o " +"siê (dup: %s)" + +#: io.c:1925 io.c:2099 +msgid "restoring stdout in parent process failed\n" +msgstr "" +"odzyskanie standardowego wyj¶cia w procesie potomnym nie powiod³o siê\n" + +#: io.c:1930 +msgid "restoring stdin in parent process failed\n" +msgstr "" +"odzyskanie standardowego wej¶cia w procesie potomnym nie powiod³o siê\n" + +#: io.c:1964 io.c:2110 io.c:2121 +#, c-format +msgid "close of pipe failed (%s)" +msgstr "zamkniêcie potoku nie powiod³o siê (%s)" + +#: io.c:2009 +msgid "`|&' not supported" +msgstr "`|&' nie jest wspierany" + +#: io.c:2076 +#, c-format +msgid "cannot open pipe `%s' (%s)" +msgstr "nie mo¿na otworzyæ potoku `%s' (%s)" + +#: io.c:2117 +#, c-format +msgid "cannot create child process for `%s' (fork: %s)" +msgstr "nie mo¿na utworzyæ procesu potomnego dla `%s' (fork: %s)" + +#: io.c:2460 +#, c-format +msgid "data file `%s' is empty" +msgstr "plik danych `%s' jest pusty" + +#: io.c:2503 io.c:2511 +msgid "could not allocate more input memory" +msgstr "nie mo¿na zarezerwowaæ wiêcej pamiêci wej¶ciowej" + +#: io.c:2869 io.c:2932 +#, c-format +msgid "error reading input file `%s': %s" +msgstr "b³±d podczas czytania z pliku `%s': %s" + +#: io.c:3057 +msgid "multicharacter value of `RS' is a gawk extension" +msgstr "wieloznakowa warto¶æ `RS' jest rozszerzeniem gawk" + +#: main.c:323 +msgid "`-m[fr]' option irrelevant in gawk" +msgstr "nieistotna opcja `-m[fr]' w gawk" + +#: main.c:325 +msgid "-m option usage: `-m[fr] nnn'" +msgstr "u¿ycie opcji -m: `-m[fr] nnn'" + +#: main.c:342 +#, c-format +msgid "%s: option `-W %s' unrecognized, ignored\n" +msgstr "%s: opcja `-W %s' nierozpoznana i zignorowana\n" + +#: main.c:379 +msgid "empty argument to `--source' ignored" +msgstr "pusty argument dla opcji `--source' zosta³ zignorowany" + +#: main.c:450 +msgid "environment variable `POSIXLY_CORRECT' set: turning on `--posix'" +msgstr "" +"zmienna ¶rodowiskowa `POSIXLY_CORRECT' ustawiona: `--posix' zosta³ w³±czony" + +#: main.c:455 +msgid "`--posix' overrides `--traditional'" +msgstr "opcja `--posix' zostanie u¿yta nad `--traditional'" + +#: main.c:466 +msgid "`--posix'/`--traditional' overrides `--non-decimal-data'" +msgstr "`--posix'/`--traditional' u¿yte nad opcj± `--non-decimal-data'" + +#: main.c:470 +#, c-format +msgid "running %s setuid root may be a security problem" +msgstr "" +"uruchamianie %s setuid root mo¿e byæ problemem pod wzglêdem bezpieczeñstwa" + +#: main.c:511 +#, c-format +msgid "can't set binary mode on stdin (%s)" +msgstr "nie mo¿na ustawiæ trybu binarnego na standardowym wej¶ciu (%s)" + +#: main.c:514 +#, c-format +msgid "can't set binary mode on stdout (%s)" +msgstr "nie mo¿na ustawiæ trybu binarnego na standardowym wyj¶ciu (%s)" + +#: main.c:516 +#, c-format +msgid "can't set binary mode on stderr (%s)" +msgstr "nie mo¿na ustawiæ trybu binarnego na wyj¶ciu diagnostycznym (%s)" + +#: main.c:546 +msgid "no program text at all!" +msgstr "brak tekstu programu!" + +#: main.c:623 +#, c-format +msgid "Usage: %s [POSIX or GNU style options] -f progfile [--] file ...\n" +msgstr "" +"U¿ycie: %s [styl opcji POSIX lub GNU] -f plik_z_programem [--] plik ...\n" + +#: main.c:625 +#, c-format +msgid "Usage: %s [POSIX or GNU style options] [--] %cprogram%c file ...\n" +msgstr "U¿ycie: %s [styl opcji POSIX lub GNU] [--] %cprogram%c plik ...\n" + +#: main.c:630 +msgid "POSIX options:\t\tGNU long options:\n" +msgstr "Opcje POSIX:\t\tD³ugie opcje GNU:\n" + +#: main.c:631 +msgid "\t-f progfile\t\t--file=progfile\n" +msgstr "\t-f program\t\t--file=program\n" + +#: main.c:632 +msgid "\t-F fs\t\t\t--field-separator=fs\n" +msgstr "\t-F fs\t\t\t--field-separator=fs\n" + +#: main.c:633 +msgid "\t-v var=val\t\t--assign=var=val\n" +msgstr "\t-v zmienna=warto¶æ\t--assign=zmienna=warto¶æ\n" + +#: main.c:634 +msgid "\t-m[fr] val\n" +msgstr "\t-m[fr] warto¶æ\n" + +#: main.c:635 +msgid "\t-W compat\t\t--compat\n" +msgstr "\t-W compat\t\t--compat\n" + +#: main.c:636 +msgid "\t-W copyleft\t\t--copyleft\n" +msgstr "\t-W copyleft\t\t--copyleft\n" + +#: main.c:637 +msgid "\t-W copyright\t\t--copyright\n" +msgstr "\t-W copyright\t\t--copyright\n" + +#: main.c:638 +msgid "\t-W dump-variables[=file]\t--dump-variables[=file]\n" +msgstr "\t-W dump-variables[=plik]\t--dump-variables[=plik]\n" + +#: main.c:639 +msgid "\t-W gen-po\t\t--gen-po\n" +msgstr "\t-W gen-po\t\t--gen-po\n" + +#: main.c:640 +msgid "\t-W help\t\t\t--help\n" +msgstr "\t-W help\t\t\t--help\n" + +#: main.c:641 +msgid "\t-W lint[=fatal]\t\t--lint[=fatal]\n" +msgstr "\t-W lint[=fatal]\t\t--lint[=fatal]\n" + +#: main.c:642 +msgid "\t-W lint-old\t\t--lint-old\n" +msgstr "\t-W lint-old\t\t--lint-old\n" + +#: main.c:643 +msgid "\t-W non-decimal-data\t--non-decimal-data\n" +msgstr "\t-W non-decimal-data\t--non-decimal-data\n" + +#: main.c:645 +msgid "\t-W nostalgia\t\t--nostalgia\n" +msgstr "\t-W nostalgia\t\t--nostalgia\n" + +#: main.c:648 +msgid "\t-W parsedebug\t\t--parsedebug\n" +msgstr "\t-W parsedebug\t\t--parsedebug\n" + +#: main.c:650 +msgid "\t-W profile[=file]\t--profile[=file]\n" +msgstr "\t-W profile[=plik]\t--profile[=plik]\n" + +#: main.c:651 +msgid "\t-W posix\t\t--posix\n" +msgstr "\t-W posix\t\t--posix\n" + +#: main.c:652 +msgid "\t-W re-interval\t\t--re-interval\n" +msgstr "\t-W re-interval\t\t--re-interval\n" + +#: main.c:653 +msgid "\t-W source=program-text\t--source=program-text\n" +msgstr "\t-W source=tekst-programu\t--source=tekst-programu\n" + +#: main.c:654 +msgid "\t-W traditional\t\t--traditional\n" +msgstr "\t-W traditional\t\t--traditional\n" + +#: main.c:655 +msgid "\t-W usage\t\t--usage\n" +msgstr "\t-W usage\t\t--usage\n" + +#: main.c:656 +msgid "\t-W version\t\t--version\n" +msgstr "\t-W version\t\t--version\n" + +#: main.c:660 +msgid "" +"\n" +"To report bugs, see node `Bugs' in `gawk.info', which is\n" +"section `Reporting Problems and Bugs' in the printed version.\n" +"\n" +msgstr "" +"\n" +"Aby zg³osiæ b³±d, prosimy zobaczyæ wêze³ `Bugs' w `gawk.info'\n" +"lub rozdzia³ p.t. `Reporting Problems and Bugs' w wydrukowanej\n" +"dokumentacji.\n" +"\n" + +#: main.c:664 +msgid "" +"gawk is a pattern scanning and processing language.\n" +"By default it reads standard input and writes standard output.\n" +"\n" +msgstr "" +"gawk jest jêzykiem skanowania i przetwarzania wzorców.\n" +"Program domy¶lnie czyta standardowe wej¶cie i zapisuje standardowe wyj¶cie.\n" +"\n" + +#: main.c:668 +msgid "" +"Examples:\n" +"\tgawk '{ sum += $1 }; END { print sum }' file\n" +"\tgawk -F: '{ print $1 }' /etc/passwd\n" +msgstr "" +"Przyk³ady:\n" +"\tgawk '{ suma += $1 }; END { print suma }' plik\n" +"\tgawk -F: '{ print $1 }' /etc/passwd\n" + +#: main.c:685 +#, c-format +msgid "" +"Copyright (C) 1989, 1991-%d Free Software Foundation.\n" +"\n" +"This program is free software; you can redistribute it and/or modify\n" +"it under the terms of the GNU General Public License as published by\n" +"the Free Software Foundation; either version 2 of the License, or\n" +"(at your option) any later version.\n" +"\n" +msgstr "" +"Copyright (C) 1989, 1991-%d Free Software Foundation.\n" +"\n" +"Ten program jest wolnym oprogramowaniem; mo¿esz go rozprowadzaæ dalej\n" +"i/lub modyfikowaæ na warunkach Powszechnej Licencji Publicznej GNU,\n" +"wydanej przez Fundacjê Wolnego Oprogramowania - wed³ug wersji 2-giej\n" +"tej Licencji lub której¶ z pó¼niejszych wersji.\n" +"\n" + +#: main.c:693 +msgid "" +"This program is distributed in the hope that it will be useful,\n" +"but WITHOUT ANY WARRANTY; without even the implied warranty of\n" +"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" +"GNU General Public License for more details.\n" +"\n" +msgstr "" +"Ten program rozpowszechniany jest z nadziej±, i¿ bêdzie on\n" +"u¿yteczny - jednak BEZ JAKIEJKOLWIEK GWARANCJI, nawet domy¶lnej\n" +"gwarancji PRZYDATNO¦CI HANDLOWEJ albo PRZYDATNO¦CI DO OKRE¦LONYCH\n" +"ZASTOSOWAÑ. W celu uzyskania bli¿szych informacji przeczytaj\n" +"Powszechn± Licencjê Publiczn± GNU.\n" +"\n" + +#: main.c:699 +msgid "" +"You should have received a copy of the GNU General Public License\n" +"along with this program; if not, write to the Free Software\n" +"Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n" +msgstr "" +"Z pewno¶ci± wraz z niniejszym programem otrzyma³e¶ te¿ egzemplarz\n" +"Powszechnej Licencji Publicznej GNU (GNU General Public License);\n" +"je¶li za¶ nie - napisz do Free Software Foundation, Inc., \n" +"59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n" + +#: main.c:733 +msgid "-Ft does not set FS to tab in POSIX awk" +msgstr "-Ft nie ustawia FS na znak tabulatora w POSIX awk" + +#: main.c:962 +#, c-format +msgid "" +"%s: `%s' argument to `-v' not in `var=value' form\n" +"\n" +msgstr "" +"%s: argument `%s' dla `-v' nie jest zgodny ze sk³adni± `zmienna=warto¶æ'\n" +"\n" + +#: main.c:982 +#, c-format +msgid "`%s' is not a legal variable name" +msgstr "`%s' nie jest dozwolon± nazw± zmiennej" + +#: main.c:985 +#, c-format +msgid "`%s' is not a variable name, looking for file `%s=%s'" +msgstr "`%s' nie jest nazw± zmiennej, szukanie pliku `%s=%s'" + +#: main.c:1018 +msgid "floating point exception" +msgstr "wyj±tek zmiennopozycyjny" + +#: main.c:1025 +msgid "fatal error: internal error" +msgstr "fatalny b³±d: wewnêtrzny b³±d" + +#: main.c:1075 +#, c-format +msgid "no pre-opened fd %d" +msgstr "brak ju¿ otwartego fd %d" + +#: main.c:1082 +#, c-format +msgid "could not pre-open /dev/null for fd %d" +msgstr "nie mo¿na otworzyæ zawczasu /dev/null dla fd %d" + +#: main.c:1105 main.c:1114 +#, c-format +msgid "could not find groups: %s" +msgstr "nie mo¿na znale¼æ grup: %s" + +#: msg.c:54 +#, c-format +msgid "cmd. line:" +msgstr "linia poleceñ:" + +#: msg.c:120 +msgid "warning: " +msgstr "ostrze¿enie: " + +#: msg.c:142 +msgid "error: " +msgstr "b³±d: " + +#: msg.c:178 +msgid "fatal: " +msgstr "fatalny b³±d: " + +#: node.c:58 node.c:65 node.c:74 node.c:88 node.c:115 +msgid "can't convert string to float" +msgstr "nie mo¿na zamieniæ ³añcucha do liczby zmiennopozycyjnej" + +#: node.c:357 +msgid "backslash at end of string" +msgstr "backslash na koñcu ³añcucha" + +#: node.c:541 +msgid "POSIX does not allow `\\x' escapes" +msgstr "POSIX nie zezwala na sekwencjê ucieczki `\\x'" + +#: node.c:547 +msgid "no hex digits in `\\x' escape sequence" +msgstr "brak liczb szesnastkowych w sekwencji ucieczki `\\x'" + +#: node.c:581 +#, c-format +msgid "escape sequence `\\%c' treated as plain `%c'" +msgstr "sekwencja ucieczki `\\%c' potraktowana jako zwyk³e `%c'" + +#: posix/gawkmisc.c:172 +#, c-format +msgid "%s %s `%s': could not set close-on-exec: (fcntl: %s)" +msgstr "%s %s `%s': nie mo¿na ustawiæ close-on-exec: (fcntl: %s)" + +#: profile.c:91 +#, c-format +msgid "could not open `%s' for writing: %s" +msgstr "nie mo¿na otworzyæ `%s' do zapisu: %s" + +#: profile.c:467 +#, c-format +msgid "internal error: %s with null vname" +msgstr "wewnêtrzny b³±d: %s z zerowym vname" + +#: profile.c:530 +msgid "# treated internally as `delete'" +msgstr "# potraktowany wewnêtrznie jako `delete'" + +#: profile.c:1167 +#, c-format +msgid "# this is a dynamically loaded extension function" +msgstr "# to jest dynamicznie ³adowana funkcja rozszerzenie" + +#: profile.c:1198 +#, c-format +msgid "\t# gawk profile, created %s\n" +msgstr "\t# profil programu gawk, utworzony %s\n" + +#: profile.c:1201 +#, c-format +msgid "" +"\t# BEGIN block(s)\n" +"\n" +msgstr "" +"\t# blok(i) BEGIN\n" +"\n" + +#: profile.c:1211 +#, c-format +msgid "" +"\t# Rule(s)\n" +"\n" +msgstr "" +"\t# Regu³y\n" +"\n" + +#: profile.c:1217 +#, c-format +msgid "" +"\t# END block(s)\n" +"\n" +msgstr "" +"\t# blok(i) END\n" +"\n" + +#: profile.c:1237 +#, c-format +msgid "" +"\n" +"\t# Functions, listed alphabetically\n" +msgstr "" +"\n" +"\t# Funkcje, spis alfabetyczny\n" + +#: profile.c:1452 +#, c-format +msgid "unexpected type %s in prec_level" +msgstr "niespodziewany typ %s w prec_level" + +#: regcomp.c:150 +msgid "Success" +msgstr "Sukces" + +#: regcomp.c:153 +msgid "No match" +msgstr "Brak dopasowania" + +#: regcomp.c:156 +msgid "Invalid regular expression" +msgstr "Nieprawid³owe wyra¿enie regularne" + +#: regcomp.c:159 +msgid "Invalid collation character" +msgstr "Nieprawid³owy znak porównania" + +#: regcomp.c:162 +msgid "Invalid character class name" +msgstr "Nieprawid³owa nazwa klasy znaku" + +#: regcomp.c:165 +msgid "Trailing backslash" +msgstr "Koñcowy znak backslash" + +#: regcomp.c:168 +msgid "Invalid back reference" +msgstr "Nieprawid³owe odwo³anie wsteczne" + +#: regcomp.c:171 +msgid "Unmatched [ or [^" +msgstr "Niedopasowany znak [ lub [^" + +#: regcomp.c:174 +msgid "Unmatched ( or \\(" +msgstr "Niedopasowany znak ( lub \\(" + +#: regcomp.c:177 +msgid "Unmatched \\{" +msgstr "Niedopasowany znak \\{" + +#: regcomp.c:180 +msgid "Invalid content of \\{\\}" +msgstr "Nieprawid³owa zawarto¶æ \\{\\}" + +#: regcomp.c:183 +msgid "Invalid range end" +msgstr "Nieprawid³owy koniec zakresu" + +#: regcomp.c:186 +msgid "Memory exhausted" +msgstr "Pamiêæ wyczerpana" + +#: regcomp.c:189 +msgid "Invalid preceding regular expression" +msgstr "Nieprawid³owe poprzedzaj±ce wyra¿enie regularne" + +#: regcomp.c:192 +msgid "Premature end of regular expression" +msgstr "Przedwczesny koniec wyra¿enia regularnego" + +#: regcomp.c:195 +msgid "Regular expression too big" +msgstr "Wyra¿enie regularne jest zbyt du¿e" + +#: regcomp.c:198 +msgid "Unmatched ) or \\)" +msgstr "Niedopasowany znak ) lub \\)" + +#: regcomp.c:668 +msgid "No previous regular expression" +msgstr "Brak poprzedniego wyra¿enia regularnego" + +#~ msgid "delete: illegal use of variable `%s' as array" +#~ msgstr "delete: nieprawid³owe u¿ycie zmiennej `%s' jako tablicy" + +#~ msgid "asort: first argument is not an array" +#~ msgstr "asort: pierwszy argument nie jest tablic±" + +#~ msgid "asort: second argument is not an array" +#~ msgstr "asort: drugi argument nie jest tablic±" + +#~ msgid "" +#~ "\n" +#~ "To report bugs, see node `Bugs' in `gawk.info', which is\n" +#~ msgstr "" +#~ "\n" +#~ "Aby zg³osiæ b³êdy, prosimy zobaczyæ wêze³ `Bugs' w `gawk.info', który " +#~ "jest\n" + +#~ msgid "invalid syntax in name `%s' for variable assignment" +#~ msgstr "b³±d sk³adni w nazwie `%s' dla przypisania zmiennej" + +#~ msgid "internal error: Node_var_array with null vname" +#~ msgstr "wewnêtrzny b³±d: Node_var_array z zerowym vname" + +#~ msgid "or used in other expression context" +#~ msgstr "lub u¿yty w innym kontek¶cie wyra¿enia" + +#~ msgid "`%s' is a function, assignment is not allowed" +#~ msgstr "`%s' jest funkcj±, zatem przypisanie nie jest dozwolone" + +#~ msgid "BEGIN blocks must have an action part" +#~ msgstr "Blok BEGIN musi posiadaæ czê¶æ dotycz±c± akcji" + +#~ msgid "`nextfile' used in BEGIN or END action" +#~ msgstr "`nextfile' u¿yty w akcji BEGIN lub END" + +#~ msgid "non-redirected `getline' undefined inside BEGIN or END action" +#~ msgstr "" +#~ "komenda `getline' bez przekierowania nie jest zdefiniowana wewn±trz akcji " +#~ "BEGIN lub END" + +#~ msgid "fptr %x not in tokentab\n" +#~ msgstr "brak fptr %x w tokentab\n" + +#~ msgid "gsub third parameter is not a changeable object" +#~ msgstr "trzeci parametr gsub nie jest zmiennym obiektem" + +#~ msgid "Unfinished \\ escape" +#~ msgstr "Niedokoñczona sekwencja ucieczki \\" + +#~ msgid "unfinished repeat count" +#~ msgstr "niedokoñczona liczba powtórzeñ" + +#~ msgid "malformed repeat count" +#~ msgstr "¼le sformatowana liczba powtórzeñ" + +#~ msgid "Unbalanced [" +#~ msgstr "[ nie do pary" + +#~ msgid "Unbalanced (" +#~ msgstr "( nie do pary" + +#~ msgid "No regexp syntax bits specified" +#~ msgstr "Nie zosta³y podane bity sk³adni wyra¿enia regularnego" + +#~ msgid "Unbalanced )" +#~ msgstr ") nie do pary" + +#~ msgid "out of memory" +#~ msgstr "brak pamiêci" + +#~ msgid "internal error: file `%s', line %d\n" +#~ msgstr "wewnêtrzny b³±d: plik `%s', linia %d\n" diff --git a/po/pt_BR.gmo b/po/pt_BR.gmo index 79e02ebb3..6c21305d4 100644 Binary files a/po/pt_BR.gmo and b/po/pt_BR.gmo differ diff --git a/po/pt_BR.po b/po/pt_BR.po index 492703831..ef4aee8b8 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: gawk 3.1.2g\n" "Report-Msgid-Bugs-To: arnold@skeeve.com\n" -"POT-Creation-Date: 2003-07-07 11:20-0700\n" +"POT-Creation-Date: 2004-07-15 13:02+0300\n" "PO-Revision-Date: 2003-06-26 16:18+0300\n" "Last-Translator: Juan Carlos Castro y Castro \n" "Language-Team: Brazilian Portuguese \n" @@ -16,56 +16,61 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" #: array.c:112 +#, fuzzy, c-format +msgid "attempt to use function `%s' as an array" +msgstr "tentativa de usar escalar `%s' como vetor" + +#: array.c:115 #, c-format msgid "attempt to use scalar parameter `%s' as an array" msgstr "tentativa de usar parâmetro escalar `%s' como vetor" -#: array.c:113 +#: array.c:118 #, c-format msgid "attempt to use scalar `%s' as array" msgstr "tentativa de usar escalar `%s' como vetor" -#: array.c:151 +#: array.c:156 #, c-format msgid "from %s" msgstr "de %s" -#: array.c:506 +#: array.c:511 #, c-format msgid "reference to uninitialized element `%s[\"%s\"]'" msgstr "referência a elemento não inicializado `%s[\"%s\"]'" -#: array.c:512 +#: array.c:517 #, c-format msgid "subscript of array `%s' is null string" msgstr "índice do vetor `%s' é uma string nula" -#: array.c:609 +#: array.c:621 #, c-format msgid "delete: index `%s' not in array `%s'" msgstr "delete: índice `%s' não está no vetor `%s'" -#: array.c:769 +#: array.c:791 #, c-format msgid "%s: empty (null)\n" msgstr "%s: vazio (nulo)\n" -#: array.c:774 +#: array.c:796 #, c-format msgid "%s: empty (zero)\n" msgstr "%s: vazio (zero)\n" -#: array.c:778 +#: array.c:800 #, c-format msgid "%s: table_size = %d, array_size = %d\n" msgstr "%s: table_size = %d, array_size = %d\n" -#: array.c:807 +#: array.c:829 #, c-format msgid "%s: is parameter\n" msgstr "%s: é parâmetro\n" -#: array.c:812 +#: array.c:834 #, c-format msgid "%s: array_ref to %s\n" msgstr "%s: array_ref para %s\n" @@ -89,475 +94,471 @@ msgstr "`%s' msgid "regexp constant `/%s/' looks like a C comment, but is not" msgstr "constante de expr. reg. `/%s/' parece um comentário C, mas não é" -#: awkgram.y:340 awkgram.y:615 +#: awkgram.y:341 awkgram.y:619 msgid "statement may have no effect" msgstr "declaração pode não ter efeito" -#: awkgram.y:435 awkgram.y:455 +#: awkgram.y:436 awkgram.y:456 #, c-format msgid "`%s' used in %s action" msgstr "`%s' usado em ação %s" -#: awkgram.y:448 awkgram.y:451 +#: awkgram.y:449 awkgram.y:452 msgid "`nextfile' is a gawk extension" msgstr "`nextfile' é uma extensão do gawk" -#: awkgram.y:465 +#: awkgram.y:466 msgid "`return' used outside function context" msgstr "`return' usado fora do contexto de função" -#: awkgram.y:504 +#: awkgram.y:508 msgid "plain `print' in BEGIN or END rule should probably be `print \"\"'" msgstr "" "`print' sozinho em regra BEGIN ou END provavelmente deveria ser `print \"\"'" -#: awkgram.y:517 awkgram.y:524 +#: awkgram.y:521 awkgram.y:528 msgid "`delete array' is a gawk extension" msgstr "`delete array' é uma extensão do gawk" -#: awkgram.y:532 awkgram.y:539 +#: awkgram.y:536 awkgram.y:543 msgid "`delete(array)' is a non-portable tawk extension" msgstr "`delete(array)' é uma extensão não-portável do tawk" -#: awkgram.y:583 +#: awkgram.y:587 #, c-format msgid "duplicate case values in switch body: %s" msgstr "valores de case duplicados no corpo do switch: %s" -#: awkgram.y:593 +#: awkgram.y:597 msgid "Duplicate `default' detected in switch body" msgstr "Detectado `default' duplicado no corpo do switch" -#: awkgram.y:681 +#: awkgram.y:686 msgid "multistage two-way pipelines don't work" msgstr "pipelines bidirecionais de múltiplos estágios não funcionam" -#: awkgram.y:772 +#: awkgram.y:777 msgid "regular expression on right of assignment" msgstr "expressão regular à direita de atribuição" -#: awkgram.y:782 +#: awkgram.y:800 msgid "regular expression on left of `~' or `!~' operator" msgstr "expressão regular à esquerda de operador `~' ou `!~'" -#: awkgram.y:790 +#: awkgram.y:808 msgid "regular expression on right of comparison" msgstr "expressão regular à direita de comparação" -#: awkgram.y:857 +#: awkgram.y:875 msgid "non-redirected `getline' undefined inside END action" msgstr "`getline' não-redirecionado não é definido dentro da ação END" -#: awkgram.y:884 +#: awkgram.y:902 msgid "call of `length' without parentheses is not portable" msgstr "chamada a `length' sem parênteses não é portável" -#: awkgram.y:887 +#: awkgram.y:905 msgid "call of `length' without parentheses is deprecated by POSIX" msgstr "chamada a `length' sem parênteses é obsoleta de acordo com POSIX" -#: awkgram.y:940 +#: awkgram.y:958 msgid "use of non-array as array" msgstr "uso de não-vetor como vetor" -#: awkgram.y:942 +#: awkgram.y:960 msgid "invalid subscript expression" msgstr "expressão de índice inválida" -#: awkgram.y:1140 +#: awkgram.y:1158 msgid "unexpected newline or end of string" msgstr "fim de linha ou de string inesperado" -#: awkgram.y:1235 +#: awkgram.y:1254 msgid "empty program text on command line" msgstr "texto de programa vazio na linha de comando" -#: awkgram.y:1292 +#: awkgram.y:1307 #, c-format msgid "can't open source file `%s' for reading (%s)" msgstr "impossível abrir arquivo-fonte `%s' para leitura (%s)" -#: awkgram.y:1327 +#: awkgram.y:1384 #, c-format msgid "can't read sourcefile `%s' (%s)" msgstr "impossível ler arquivo-fonte `%s' (%s)" -#: awkgram.y:1335 +#: awkgram.y:1392 #, c-format msgid "source file `%s' is empty" msgstr "arquivo-fonte `%s' está vazio" -#: awkgram.y:1537 awkgram.y:1647 awkgram.y:1665 awkgram.y:2015 awkgram.y:2100 +#: awkgram.y:1590 awkgram.y:1700 awkgram.y:1718 awkgram.y:2068 awkgram.y:2153 msgid "source file does not end in newline" msgstr "arquivo-fonte não termina em fim-de-linha" -#: awkgram.y:1601 +#: awkgram.y:1654 msgid "unterminated regexp ends with `\\' at end of file" msgstr "expressão regular inacabada termina com `\\' ao fim do arquivo" -#: awkgram.y:1621 +#: awkgram.y:1674 msgid "unterminated regexp" msgstr "expressão regular inacabada" -#: awkgram.y:1624 +#: awkgram.y:1677 msgid "unterminated regexp at end of file" msgstr "expressão regular inacabada no fim do arquivo" -#: awkgram.y:1691 +#: awkgram.y:1744 msgid "use of `\\ #...' line continuation is not portable" msgstr "uso da continuação de linha `\\ #...' não é portável" -#: awkgram.y:1703 +#: awkgram.y:1756 msgid "backslash not last character on line" msgstr "`\\' não é o último caracter da linha" -#: awkgram.y:1748 +#: awkgram.y:1801 msgid "POSIX does not allow operator `**='" msgstr "POSIX não permite o operador `**='" -#: awkgram.y:1750 +#: awkgram.y:1803 msgid "old awk does not support operator `**='" msgstr "o velho awk não suporta o operador `**='" -#: awkgram.y:1759 +#: awkgram.y:1812 msgid "POSIX does not allow operator `**'" msgstr "POSIX não permite o operador `**'" -#: awkgram.y:1761 +#: awkgram.y:1814 msgid "old awk does not support operator `**'" msgstr "o velho awk não suporta o operador `**'" -#: awkgram.y:1792 +#: awkgram.y:1845 msgid "operator `^=' is not supported in old awk" msgstr "o velho awk não suporta o operador `^='" -#: awkgram.y:1800 +#: awkgram.y:1853 msgid "operator `^' is not supported in old awk" msgstr "o velho awk não suporta o operador `^'" -#: awkgram.y:1884 awkgram.y:1901 +#: awkgram.y:1937 awkgram.y:1954 msgid "unterminated string" msgstr "string inacabada" -#: awkgram.y:2061 +#: awkgram.y:2114 #, c-format msgid "invalid char '%c' in expression" msgstr "caracter inválido '%c' em expressão" -#: awkgram.y:2121 +#: awkgram.y:2162 #, c-format msgid "`%s' is a gawk extension" msgstr "`%s' é uma extensão do gawk" -#: awkgram.y:2124 +#: awkgram.y:2165 #, c-format msgid "`%s' is a Bell Labs extension" msgstr "`%s' é uma extensão da Bell Labs" -#: awkgram.y:2127 +#: awkgram.y:2168 #, c-format msgid "POSIX does not allow `%s'" msgstr "POSIX não permite `%s'" -#: awkgram.y:2131 +#: awkgram.y:2172 #, c-format msgid "`%s' is not supported in old awk" msgstr "`%s' não é suportado no velho awk" -#: awkgram.y:2158 +#: awkgram.y:2198 msgid "`goto' considered harmful!\n" msgstr "`goto' é considerado danoso!\n" -#: awkgram.y:2220 +#: awkgram.y:2260 #, c-format msgid "%d is invalid as number of arguments for %s" msgstr "%d é inválido como número de argumentos para %s" -#: awkgram.y:2239 awkgram.y:2242 +#: awkgram.y:2279 awkgram.y:2282 msgid "match: third argument is a gawk extension" msgstr "match: terceiro argumento é uma extensão do gawk" -#: awkgram.y:2255 +#: awkgram.y:2295 #, c-format msgid "%s: string literal as last arg of substitute has no effect" msgstr "" "%s: string literal como último argumento de substituição não tem efeito" -#: awkgram.y:2258 +#: awkgram.y:2298 #, c-format msgid "%s third parameter is not a changeable object" msgstr "terceiro parâmetro %s não é um objeto modificável" -#: awkgram.y:2285 awkgram.y:2288 +#: awkgram.y:2325 awkgram.y:2328 msgid "close: second argument is a gawk extension" msgstr "close: segundo argumento é uma extensão do gawk" -#: awkgram.y:2298 +#: awkgram.y:2338 msgid "use of dcgettext(_\"...\") is incorrect: remove leading underscore" msgstr "uso de dcgettext(_\"...\") é incorreto: remova o `_' precedente" -#: awkgram.y:2313 +#: awkgram.y:2353 msgid "use of dcngettext(_\"...\") is incorrect: remove leading underscore" msgstr "uso de dcngettext(_\"...\") é incorreto: remova o `_' precedente" -#: awkgram.y:2384 +#: awkgram.y:2424 #, c-format msgid "function `%s': parameter #%d, `%s', duplicates parameter #%d" msgstr "função `%s': parâmetro #%d, `%s', duplica parâmetro #%d" -#: awkgram.y:2417 +#: awkgram.y:2457 #, c-format msgid "function `%s': parameter `%s' shadows global variable" msgstr "função `%s': parâmetro `%s' encobre variável global" -#: awkgram.y:2529 +#: awkgram.y:2569 #, c-format msgid "could not open `%s' for writing (%s)" msgstr "impossível abrir `%s' para escrita (%s)" -#: awkgram.y:2530 profile.c:93 +#: awkgram.y:2570 profile.c:93 msgid "sending profile to standard error" msgstr "enviando perfil para saída de erros" -#: awkgram.y:2562 +#: awkgram.y:2602 #, c-format msgid "%s: close failed (%s)" msgstr "%s: `close' falhou (%s)" -#: awkgram.y:2684 +#: awkgram.y:2723 msgid "shadow_funcs() called twice!" msgstr "shadow_funcs() chamada duas vezes!" -#: awkgram.y:2711 +#: awkgram.y:2750 msgid "there were shadowed variables." msgstr "houve variáveis encobertas." -#: awkgram.y:2784 +#: awkgram.y:2823 #, c-format msgid "function `%s': can't use function name as parameter name" msgstr "função `%s': não se pode usar o nome da função como nome de parâmetro" -#: awkgram.y:2794 +#: awkgram.y:2833 #, c-format msgid "function name `%s' previously defined" msgstr "nome de função `%s' definido anteriormente" -#: awkgram.y:2945 awkgram.y:2951 +#: awkgram.y:2984 awkgram.y:2990 #, c-format msgid "function `%s' called but never defined" msgstr "função `%s' chamada mas nunca definida" -#: awkgram.y:2954 +#: awkgram.y:2993 #, c-format msgid "function `%s' defined but never called" msgstr "função `%s' definida mas nunca chamada" -#: awkgram.y:2981 +#: awkgram.y:3020 #, c-format msgid "regexp constant for parameter #%d yields boolean value" msgstr "" "constante com expr. regular para parâmetro nº %d retorna valor booleano" -#: awkgram.y:2994 -#, c-format +#: awkgram.y:3033 +#, fuzzy, c-format msgid "" "function `%s' called with space between name and `(',\n" -"%s" +"or used as a variable or an array" msgstr "" "função `%s' chamada com espaço entre o nome e o `(',\n" "%s" -#: awkgram.y:2996 -msgid "or used as a variable or an array" -msgstr "ou usado como uma variável ou vetor" - -#: builtin.c:137 +#: builtin.c:149 #, c-format msgid "%s to \"%s\" failed (%s)" msgstr "%s para \"%s\" falhou (%s)" -#: builtin.c:138 +#: builtin.c:150 msgid "standard output" msgstr "saída padrão" -#: builtin.c:139 +#: builtin.c:151 msgid "reason unknown" msgstr "motivo desconhecido" -#: builtin.c:152 +#: builtin.c:164 msgid "exp: received non-numeric argument" msgstr "exp: recebeu argumento não-numérico" -#: builtin.c:158 +#: builtin.c:170 #, c-format msgid "exp: argument %g is out of range" msgstr "exp: argumento %g está fora da faixa" -#: builtin.c:216 +#: builtin.c:228 #, c-format msgid "fflush: cannot flush: pipe `%s' opened for reading, not writing" msgstr "" "fflush: erro ao descarregar: pipe `%s' aberto para leitura, não gravação" -#: builtin.c:219 +#: builtin.c:231 #, c-format msgid "fflush: cannot flush: file `%s' opened for reading, not writing" msgstr "" "fflush: erro ao descarregar: arquivo `%s' aberto para leitura, não gravação" -#: builtin.c:231 +#: builtin.c:243 #, c-format msgid "fflush: `%s' is not an open file, pipe or co-process" msgstr "fflush: `%s' não é um arquivo aberto, pipe ou co-processo" -#: builtin.c:325 +#: builtin.c:338 msgid "index: received non-string first argument" msgstr "index: recebeu primeiro argumento não-string" -#: builtin.c:327 +#: builtin.c:340 msgid "index: received non-string second argument" msgstr "index: recebeu segundo argumento não-string" -#: builtin.c:437 +#: builtin.c:454 msgid "int: received non-numeric argument" msgstr "int: recebeu argumento não-numérico" -#: builtin.c:454 +#: builtin.c:471 msgid "length: received non-string argument" msgstr "length: recebeu argumento não-string" -#: builtin.c:470 +#: builtin.c:487 msgid "log: received non-numeric argument" msgstr "log: recebeu argumento não-numérico" -#: builtin.c:473 +#: builtin.c:490 #, c-format msgid "log: received negative argument %g" msgstr "log: recebeu argumento negativo %g" -#: builtin.c:635 builtin.c:638 +#: builtin.c:654 builtin.c:657 msgid "must use `count$' on all formats or none" msgstr "deve usar `count$' em todos os formatos ou nenhum" -#: builtin.c:740 +#: builtin.c:759 msgid "`$' is not permitted in awk formats" msgstr "`$' não é permitido em formatos awk" -#: builtin.c:746 +#: builtin.c:765 msgid "arg count with `$' must be > 0" msgstr "nº de argumentos com `$' deve ser > 0" -#: builtin.c:748 +#: builtin.c:767 #, c-format msgid "arg count %ld greater than total number of supplied arguments" msgstr "nº de argumentos %ld maior que nº total de argumentos fornecidos" -#: builtin.c:750 +#: builtin.c:769 msgid "`$' not permitted after period in format" msgstr "`$' não é permitido depois de ponto no formato" -#: builtin.c:763 +#: builtin.c:782 msgid "no `$' supplied for positional field width or precision" msgstr "nenhum `$' fornecido para tamanho ou precisão de campo posicional" -#: builtin.c:821 +#: builtin.c:848 msgid "`l' is meaningless in awk formats; ignored" msgstr "`l' não faz sentido em formatos awk; ignorado" -#: builtin.c:825 +#: builtin.c:852 msgid "`l' is not permitted in POSIX awk formats" msgstr "`l' não é permitido em formatos POSIX awk" -#: builtin.c:836 +#: builtin.c:863 msgid "`L' is meaningless in awk formats; ignored" msgstr "`L' não faz sentido em formatos awk; ignorado" -#: builtin.c:840 +#: builtin.c:867 msgid "`L' is not permitted in POSIX awk formats" msgstr "`L' não é permitido em formatos POSIX awk" -#: builtin.c:851 +#: builtin.c:878 msgid "`h' is meaningless in awk formats; ignored" msgstr "`h' não faz sentido em formatos awk; ignorado" -#: builtin.c:855 +#: builtin.c:882 msgid "`h' is not permitted in POSIX awk formats" msgstr "`h' não é permitido em formatos POSIX awk" -#: builtin.c:1055 +#: builtin.c:1111 #, c-format msgid "[s]printf: value %g is out of range for `%%%c' format" msgstr "[s]printf: valor %g fora da faixa para formato `%%%c'" -#: builtin.c:1108 +#: builtin.c:1171 msgid "not enough arguments to satisfy format string" msgstr "argumentos insuficientes para a string de formato" -#: builtin.c:1110 +#: builtin.c:1173 msgid "^ ran out for this one" msgstr "^ acabou para este aqui" -#: builtin.c:1115 +#: builtin.c:1178 msgid "[s]printf: format specifier does not have control letter" msgstr "[s]printf: declaração de formato não tem letra de controle" -#: builtin.c:1118 +#: builtin.c:1181 msgid "too many arguments supplied for format string" msgstr "excesso de argumentos para a string de formato" -#: builtin.c:1184 builtin.c:1187 +#: builtin.c:1247 builtin.c:1250 msgid "printf: no arguments" msgstr "printf: nenhum argumento" -#: builtin.c:1211 +#: builtin.c:1274 msgid "sqrt: received non-numeric argument" msgstr "sqrt: recebeu argumento não-numérico" -#: builtin.c:1215 +#: builtin.c:1278 #, c-format msgid "sqrt: called with negative argument %g" msgstr "sqrt: chamada com argumento negativo %g" -#: builtin.c:1238 +#: builtin.c:1301 #, c-format msgid "substr: start index %g is invalid, using 1" msgstr "substr: posição inicial %g é inválida, usando 1" -#: builtin.c:1243 +#: builtin.c:1306 #, c-format msgid "substr: non-integer start index %g will be truncated" msgstr "substr: posição inicial %g não-inteira será truncada" -#: builtin.c:1262 +#: builtin.c:1325 #, fuzzy, c-format msgid "substr: length %g is not >= 1" msgstr "substr: comprimento %g é <= 0" -#: builtin.c:1264 +#: builtin.c:1327 #, fuzzy, c-format msgid "substr: length %g is not >= 0" msgstr "substr: comprimento %g é <= 0" -#: builtin.c:1271 +#: builtin.c:1334 #, c-format msgid "substr: non-integer length %g will be truncated" msgstr "substr: comprimento %g não-inteiro será truncado" -#: builtin.c:1276 +#: builtin.c:1339 #, c-format msgid "substr: length %g too big for string indexing, truncating to %g" msgstr "substr: comprimento %g excessivo para indexação, truncando para %g" -#: builtin.c:1288 +#: builtin.c:1351 msgid "substr: source string is zero length" msgstr "substr: string origem tem comprimento zero" -#: builtin.c:1294 +#: builtin.c:1357 #, c-format msgid "substr: start index %g is past end of string" msgstr "substr: posição inicial %g além do fim da string" -#: builtin.c:1302 +#: builtin.c:1365 #, c-format msgid "" "substr: length %g at start index %g exceeds length of first argument (%lu)" @@ -565,238 +566,263 @@ msgstr "" "substr: comprimento %g a partir da posição %g excede tamanho do 1º argumento " "(%lu)" -#: builtin.c:1337 +#: builtin.c:1400 msgid "strftime: received non-string first argument" msgstr "strftime: recebeu primeiro argumento não-string" -#: builtin.c:1343 +#: builtin.c:1406 msgid "strftime: received empty format string" msgstr "strftime: recebeu string de formato vazia" -#: builtin.c:1352 +#: builtin.c:1415 msgid "strftime: received non-numeric second argument" msgstr "strftime: recebeu segundo argumento não-numérico" -#: builtin.c:1415 +#: builtin.c:1478 msgid "mktime: received non-string argument" msgstr "mktime: recebeu argumento não-string" -#: builtin.c:1460 +#: builtin.c:1523 msgid "system: received non-string argument" msgstr "system: recebeu argumento não-string" -#: builtin.c:1581 eval.c:1883 +#: builtin.c:1644 eval.c:2019 #, c-format msgid "reference to uninitialized field `$%d'" msgstr "referência a campo não inicializado `$%d'" -#: builtin.c:1608 +#: builtin.c:1671 msgid "tolower: received non-string argument" msgstr "tolower: recebeu argumento não-string" -#: builtin.c:1657 +#: builtin.c:1720 msgid "toupper: received non-string argument" msgstr "toupper: recebeu argumento não-string" -#: builtin.c:1702 +#: builtin.c:1765 msgid "atan2: received non-numeric first argument" msgstr "atan2: recebeu primeiro argumento não-numérico" -#: builtin.c:1704 +#: builtin.c:1767 msgid "atan2: received non-numeric second argument" msgstr "atan2: recebeu segundo argumento não-numérico" -#: builtin.c:1723 +#: builtin.c:1786 msgid "sin: received non-numeric argument" msgstr "sin: recebeu argumento não-numérico" -#: builtin.c:1739 +#: builtin.c:1802 msgid "cos: received non-numeric argument" msgstr "cos: recebeu argumento não-numérico" -#: builtin.c:1788 +#: builtin.c:1852 msgid "srand: received non-numeric argument" msgstr "srand: recebeu argumento não-numérico" -#: builtin.c:1823 +#: builtin.c:1887 msgid "match: third argument is not an array" msgstr "match: terceiro argumento não é um vetor" -#: builtin.c:2307 +#: builtin.c:2414 msgid "gensub: third argument of 0 treated as 1" msgstr "gensub: 3º argumento 0 tratado como 1" -#: builtin.c:2416 builtin.c:2418 +#: builtin.c:2572 msgid "lshift: received non-numeric first argument" msgstr "lshift: recebeu primeiro argumento não-numérico" -#: builtin.c:2420 +#: builtin.c:2574 +#, fuzzy +msgid "lshift: received non-numeric second argument" +msgstr "strftime: recebeu segundo argumento não-numérico" + +#: builtin.c:2580 #, c-format msgid "lshift(%lf, %lf): negative values will give strange results" msgstr "lshift(%lf, %lf): valores negativos darão resultados estranhos" -#: builtin.c:2422 +#: builtin.c:2582 #, c-format msgid "lshift(%lf, %lf): fractional values will be truncated" msgstr "lshift(%lf, %lf): valores fracionários serão truncados" -#: builtin.c:2424 +#: builtin.c:2584 #, c-format msgid "lshift(%lf, %lf): too large shift value will give strange results" msgstr "lshift(%lf, %lf): deslocamento excessivo dará resultados estranhos" -#: builtin.c:2453 builtin.c:2455 +#: builtin.c:2610 msgid "rshift: received non-numeric first argument" msgstr "rshift: recebeu primeiro argumento não-numérico" -#: builtin.c:2457 +#: builtin.c:2612 +#, fuzzy +msgid "rshift: received non-numeric second argument" +msgstr "strftime: recebeu segundo argumento não-numérico" + +#: builtin.c:2618 #, c-format msgid "rshift(%lf, %lf): negative values will give strange results" msgstr "rshift(%lf, %lf): valores negativos darão resultados estranhos" -#: builtin.c:2459 +#: builtin.c:2620 #, c-format msgid "rshift(%lf, %lf): fractional values will be truncated" msgstr "rshift(%lf, %lf): valores fracionários serão truncados" -#: builtin.c:2461 +#: builtin.c:2622 #, c-format msgid "rshift(%lf, %lf): too large shift value will give strange results" msgstr "rshift(%lf, %lf): deslocamento excessivo dará resultados estranhos" -#: builtin.c:2490 builtin.c:2492 +#: builtin.c:2648 msgid "and: received non-numeric first argument" msgstr "and: recebeu primeiro argumento não-numérico" -#: builtin.c:2494 +#: builtin.c:2650 +#, fuzzy +msgid "and: received non-numeric second argument" +msgstr "atan2: recebeu segundo argumento não-numérico" + +#: builtin.c:2656 #, c-format msgid "and(%lf, %lf): negative values will give strange results" msgstr "and(%lf, %lf): valores negativos darão resultados estranhos" -#: builtin.c:2496 +#: builtin.c:2658 #, c-format msgid "and(%lf, %lf): fractional values will be truncated" msgstr "and(%lf, %lf): valores fracionários serão truncados" -#: builtin.c:2525 builtin.c:2527 +#: builtin.c:2684 msgid "or: received non-numeric first argument" msgstr "or: recebeu primeiro argumento não-numérico" -#: builtin.c:2529 +#: builtin.c:2686 +#, fuzzy +msgid "or: received non-numeric second argument" +msgstr "atan2: recebeu segundo argumento não-numérico" + +#: builtin.c:2692 #, c-format msgid "or(%lf, %lf): negative values will give strange results" msgstr "or(%lf, %lf): valores negativos darão resultados estranhos" -#: builtin.c:2531 +#: builtin.c:2694 #, c-format msgid "or(%lf, %lf): fractional values will be truncated" msgstr "or(%lf, %lf): valores fracionários serão truncados" -#: builtin.c:2560 builtin.c:2562 +#: builtin.c:2720 msgid "xor: received non-numeric first argument" msgstr "xor: recebeu primeiro argumento não-numérico" -#: builtin.c:2564 +#: builtin.c:2722 +#, fuzzy +msgid "xor: received non-numeric second argument" +msgstr "atan2: recebeu segundo argumento não-numérico" + +#: builtin.c:2728 #, c-format msgid "xor(%lf, %lf): negative values will give strange results" msgstr "xor(%lf, %lf): valores negativos darão resultados estranhos" -#: builtin.c:2566 +#: builtin.c:2730 #, c-format msgid "xor(%lf, %lf): fractional values will be truncated" msgstr "xor(%lf, %lf): valores fracionários serão truncados" -#: builtin.c:2594 +#: builtin.c:2754 msgid "compl: received non-numeric argument" msgstr "compl: recebeu primeiro argumento não-numérico" -#: builtin.c:2596 +#: builtin.c:2760 #, c-format msgid "compl(%lf): negative value will give strange results" msgstr "compl(%lf): valores negativos darão resultados estranhos" -#: builtin.c:2598 +#: builtin.c:2762 #, c-format msgid "compl(%lf): fractional value will be truncated" msgstr "compl(%lf): valores fracionários serão truncados" -#: builtin.c:2771 +#: builtin.c:2935 #, c-format msgid "dcgettext: `%s' is not a valid locale category" msgstr "dcgettext: `%s' não é uma categoria de \"locale\" válida" -#: eval.c:266 +#: eval.c:303 #, c-format msgid "unknown nodetype %d" msgstr "tipo de nodo desconhecido %d" -#: eval.c:312 +#: eval.c:350 msgid "buffer overflow in genflags2str" msgstr "estouro de buffer em genflags2str" -#: eval.c:647 +#: eval.c:382 eval.c:388 profile.c:837 +#, c-format +msgid "attempt to use array `%s' in a scalar context" +msgstr "tentativa de usar vetor `%s' em um contexto escalar" + +#: eval.c:730 #, c-format msgid "for loop: array `%s' changed size from %ld to %ld during loop execution" msgstr "" "loop for: vetor `%s' mudou de tamanho de %ld para %ld durante a execução" -#: eval.c:668 +#: eval.c:751 msgid "`break' outside a loop is not portable" msgstr "`break' fora de um loop não é portável" -#: eval.c:672 +#: eval.c:755 msgid "`break' outside a loop is not allowed" msgstr "`break' fora de um loop não é permitido" -#: eval.c:689 +#: eval.c:772 msgid "`continue' outside a loop is not portable" msgstr "`continue' fora de um loop não é portável" -#: eval.c:693 +#: eval.c:776 msgid "`continue' outside a loop is not allowed" msgstr "`continue' fora de um loop não é permitido" -#: eval.c:727 +#: eval.c:810 msgid "`next' cannot be called from a BEGIN rule" msgstr "`next' não pode ser chamado de uma regra BEGIN" -#: eval.c:729 +#: eval.c:812 msgid "`next' cannot be called from an END rule" msgstr "`next' não pode ser chamado de uma regra END" -#: eval.c:738 +#: eval.c:821 msgid "`nextfile' cannot be called from a BEGIN rule" msgstr "`nextfile' não pode ser chamado de uma regra BEGIN" -#: eval.c:740 +#: eval.c:823 msgid "`nextfile' cannot be called from an END rule" msgstr "`nextfile' não pode ser chamado de uma regra END" -#: eval.c:785 +#: eval.c:872 msgid "statement has no effect" msgstr "declaração não tem efeito" -#: eval.c:828 eval.c:1726 +#: eval.c:915 eval.c:1873 #, c-format msgid "can't use function name `%s' as variable or array" msgstr "não se pode usar o nome de função `%s' como variável ou vetor" -#: eval.c:835 eval.c:841 +#: eval.c:922 eval.c:928 #, c-format msgid "reference to uninitialized argument `%s'" msgstr "referência a argumento não inicializado `%s'" -#: eval.c:848 eval.c:907 eval.c:1732 eval.c:1742 profile.c:807 -#, c-format -msgid "attempt to use array `%s' in a scalar context" -msgstr "tentativa de usar vetor `%s' em um contexto escalar" - -#: eval.c:858 eval.c:1752 +#: eval.c:937 eval.c:1882 #, c-format msgid "reference to uninitialized variable `%s'" msgstr "referência a variável não inicializada `%s'" -#: eval.c:1007 +#: eval.c:1083 msgid "" "concatenation: side effects in one expression have changed the length of " "another!" @@ -804,49 +830,50 @@ msgstr "" "concatenação: efeitos colaterais em um contexto mudaram o comprimento de " "outro!" -#: eval.c:1032 +#: eval.c:1162 msgid "assignment used in conditional context" msgstr "atribuição usada em contexto condicional" -#: eval.c:1122 +#: eval.c:1252 msgid "division by zero attempted" msgstr "tentativa de divisão por zero" -#: eval.c:1137 +#: eval.c:1267 #, c-format msgid "division by zero attempted in `%%'" msgstr "tentativa de divisão por zero em `%%'" -#: eval.c:1152 profile.c:683 +#: eval.c:1282 profile.c:713 #, c-format msgid "illegal type (%s) in tree_eval" msgstr "tipo ilegal (%s) em tree_eval" -#: eval.c:1328 +#: eval.c:1459 msgid "division by zero attempted in `/='" msgstr "tentativa de divisão por zero em `/='" -#: eval.c:1346 +#: eval.c:1477 #, c-format msgid "division by zero attempted in `%%='" msgstr "tentativa de divisão por zero em `%%='" -#: eval.c:1586 +#: eval.c:1738 #, c-format msgid "function `%s' called with more arguments than declared" msgstr "função `%s' chamada com mais argumentos que os declarados" -#: eval.c:1633 +#: eval.c:1782 #, c-format msgid "function `%s' not defined" msgstr "função `%s' não definida" -#: eval.c:1639 +#: eval.c:1788 #, c-format msgid "function %s called\n" msgstr "função %s chamada\n" -#: eval.c:1698 +#: eval.c:1845 +#, c-format msgid "" "\n" "\t# Function Call Stack:\n" @@ -856,41 +883,42 @@ msgstr "" "\t# Pilha de Chamadas de Função:\n" "\n" -#: eval.c:1701 +#: eval.c:1848 +#, c-format msgid "\t# -- main --\n" msgstr "\t# -- main --\n" -#: eval.c:1867 +#: eval.c:2003 msgid "attempt to field reference from non-numeric value" msgstr "tentativa de referência a campo a partir de valor não-numérico" -#: eval.c:1869 +#: eval.c:2005 msgid "attempt to reference from null string" msgstr "tentativa de referência a partir de string nula" -#: eval.c:1875 +#: eval.c:2011 #, c-format msgid "attempt to access field %d" msgstr "tentativa de acessar campo %d" -#: eval.c:1896 eval.c:1903 profile.c:900 +#: eval.c:2032 eval.c:2039 profile.c:934 msgid "assignment is not allowed to result of builtin function" msgstr "atribuição não pode resultar de funções intrínsecas" -#: eval.c:1951 +#: eval.c:2103 msgid "`IGNORECASE' is a gawk extension" msgstr "`IGNORECASE' é uma extensão do gawk" -#: eval.c:1980 +#: eval.c:2133 msgid "`BINMODE' is a gawk extension" msgstr "`BINMODE' é uma extensão do gawk" -#: eval.c:2092 +#: eval.c:2255 #, c-format msgid "bad `%sFMT' specification `%s'" msgstr "especificação `%sFMT' inválida `%s'" -#: eval.c:2170 +#: eval.c:2333 msgid "turning off `--lint' due to assignment to `LINT'" msgstr "desativando `--lint' devido a atribuição a `LINT'" @@ -908,7 +936,56 @@ msgstr "extension: imposs msgid "extension: library `%s': cannot call function `%s' (%s)\n" msgstr "extension: biblioteca `%s': impossível chamar função `%s' (%s)\n" -#: ext.c:183 +#: ext.c:102 +msgid "extension: missing function name" +msgstr "" + +#: ext.c:107 +#, fuzzy, c-format +msgid "extension: illegal character `%c' in function name `%s'" +msgstr "extension: biblioteca `%s': impossível chamar função `%s' (%s)\n" + +#: ext.c:113 +#, fuzzy, c-format +msgid "extension: can't redefine function `%s'" +msgstr "extension: impossível abrir `%s' (%s)\n" + +#: ext.c:117 +#, fuzzy, c-format +msgid "extension: function `%s' already defined" +msgstr "função `%s' não definida" + +#: ext.c:122 +#, c-format +msgid "extension: can't use gawk built-in `%s' as function name" +msgstr "" + +#: ext.c:124 +#, fuzzy, c-format +msgid "extension: function name `%s' previously defined" +msgstr "nome de função `%s' definido anteriormente" + +#: ext.c:201 +#, c-format +msgid "function `%s' defined to take no more than `%d' argument(s)" +msgstr "" + +#: ext.c:204 +#, fuzzy, c-format +msgid "function `%s': missing argument #%d" +msgstr "função `%s' não definida" + +#: ext.c:214 +#, fuzzy, c-format +msgid "function `%s': argument #%d: attempt to use scalar as an array" +msgstr "tentativa de usar escalar `%s' como vetor" + +#: ext.c:218 +#, c-format +msgid "function `%s': argument #%d: attempt to use array as a scalar" +msgstr "" + +#: ext.c:243 msgid "Operation Not Supported" msgstr "Operação Não Suportada" @@ -937,524 +1014,524 @@ msgstr "campo %d em FIELDWIDTHS deve ser > 0" msgid "null string for `FS' is a gawk extension" msgstr "string nula para `FS' é uma extensão do gawk" -#: getopt.c:692 getopt.c:704 +#: getopt.c:692 getopt.c:711 #, c-format msgid "%s: option `%s' is ambiguous\n" msgstr "%s: opção `%s' é ambígua\n" -#: getopt.c:737 getopt.c:741 +#: getopt.c:744 getopt.c:748 #, c-format msgid "%s: option `--%s' doesn't allow an argument\n" msgstr "%s: opção `--%s' não aceita argumento\n" -#: getopt.c:750 getopt.c:755 +#: getopt.c:757 getopt.c:762 #, c-format msgid "%s: option `%c%s' doesn't allow an argument\n" msgstr "%s: opção `%c%s' não aceita argumento\n" -#: getopt.c:791 getopt.c:804 getopt.c:1093 getopt.c:1106 +#: getopt.c:807 getopt.c:829 getopt.c:1159 getopt.c:1181 #, c-format msgid "%s: option `%s' requires an argument\n" msgstr "%s: opção `%s' requer argumento\n" -#: getopt.c:842 getopt.c:845 +#: getopt.c:867 getopt.c:870 #, c-format msgid "%s: unrecognized option `--%s'\n" msgstr "%s: opção não reconhecida `--%s'\n" -#: getopt.c:853 getopt.c:856 +#: getopt.c:878 getopt.c:881 #, c-format msgid "%s: unrecognized option `%c%s'\n" msgstr "%s: opção não reconhecida `%c%s'\n" -#: getopt.c:903 getopt.c:906 +#: getopt.c:936 getopt.c:939 #, c-format msgid "%s: illegal option -- %c\n" msgstr "%s: opção ilegal -- %c\n" -#: getopt.c:912 getopt.c:915 +#: getopt.c:945 getopt.c:948 #, c-format msgid "%s: invalid option -- %c\n" msgstr "%s: opção inválida -- %c\n" -#: getopt.c:962 getopt.c:973 getopt.c:1159 getopt.c:1172 main.c:434 +#: getopt.c:1003 getopt.c:1022 getopt.c:1234 getopt.c:1255 main.c:433 #, c-format msgid "%s: option requires an argument -- %c\n" msgstr "%s: opção requer argumento -- %c\n" -#: getopt.c:1025 getopt.c:1036 +#: getopt.c:1074 getopt.c:1093 #, c-format msgid "%s: option `-W %s' is ambiguous\n" msgstr "%s: opção `-W %s' é ambígua\n" -#: getopt.c:1060 getopt.c:1072 +#: getopt.c:1117 getopt.c:1138 #, c-format msgid "%s: option `-W %s' doesn't allow an argument\n" msgstr "%s: opção `-W %s' não aceita argumento\n" -#: io.c:305 +#: io.c:308 #, c-format msgid "cannot open file `%s' for reading (%s)" msgstr "impossível abrir arquivo `%s' para leitura (%s)" -#: io.c:392 +#: io.c:395 #, c-format msgid "close of fd %d (`%s') failed (%s)" msgstr "fechamento do descritor %d (`%s') falhou (%s)" -#: io.c:530 +#: io.c:533 #, c-format msgid "invalid tree type %s in redirect()" msgstr "tipo de árvore %s inválido em redirect()" -#: io.c:536 +#: io.c:539 #, c-format msgid "expression in `%s' redirection only has numeric value" msgstr "expressão no redirecionamento `%s' só tem valor numérico" -#: io.c:542 +#: io.c:545 #, c-format msgid "expression for `%s' redirection has null string value" msgstr "expressão para o redirecionamento `%s' tem valor string nulo" -#: io.c:547 +#: io.c:550 #, c-format msgid "filename `%s' for `%s' redirection may be result of logical expression" msgstr "" "nome de arquivo `%s' para redirecionamento `%s' pode ser resultado de " "expressão lógica" -#: io.c:569 +#: io.c:588 #, c-format msgid "unnecessary mixing of `>' and `>>' for file `%.*s'" msgstr "mistura desnecessária de `>' e `>>' para arquivo `%.*s'" -#: io.c:621 +#: io.c:640 #, c-format msgid "can't open pipe `%s' for output (%s)" msgstr "impossível abrir pipe `%s' para saída (%s)" -#: io.c:630 +#: io.c:649 #, c-format msgid "can't open pipe `%s' for input (%s)" msgstr "impossível abrir pipe `%s' para entrada (%s)" -#: io.c:643 +#: io.c:662 #, c-format msgid "can't open two way socket `%s' for input/output (%s)" msgstr "impossível abrir socket bidirecional `%s' para entrada/saída (%s)" -#: io.c:647 +#: io.c:666 #, c-format msgid "can't open two way pipe `%s' for input/output (%s)" msgstr "impossível abrir pipe bidirecional `%s' para entrada/saída (%s)" -#: io.c:723 +#: io.c:742 #, c-format msgid "can't redirect from `%s' (%s)" msgstr "impossível redirecionar de `%s' (%s)" -#: io.c:726 +#: io.c:745 #, c-format msgid "can't redirect to `%s' (%s)" msgstr "impossível redirecionar para `%s' (%s)" -#: io.c:765 +#: io.c:784 msgid "" "reached system limit for open files: starting to multiplex file descriptors" msgstr "" "alcançado limite do sistema para arquivos abertos; começando a multiplexar " "descritores de arquivos" -#: io.c:777 +#: io.c:800 #, c-format msgid "close of `%s' failed (%s)." msgstr "fechamento de `%s' falhou (%s)" -#: io.c:784 +#: io.c:808 msgid "too many pipes or input files open" msgstr "excesso de pipes ou arquivos de entrada abertos" -#: io.c:807 +#: io.c:831 msgid "close: second argument must be `to' or `from'" msgstr "close: segundo argumento deve ser `to' ou `from'" -#: io.c:821 +#: io.c:845 #, c-format msgid "close: `%.*s' is not an open file, pipe or co-process" msgstr "close: `%.*s' não é um arquivo aberto, pipe ou co-processo" -#: io.c:825 +#: io.c:849 msgid "close of redirection that was never opened" msgstr "fechamento de redirecionamento que nunca foi aberto" -#: io.c:862 +#: io.c:945 #, c-format msgid "close: redirection `%s' not opened with `|&', second argument ignored" msgstr "" "close: redirecionamento `%s' não foi aberto com `|&', segundo argumento " "ignorado" -#: io.c:924 +#: io.c:960 #, c-format msgid "failure status (%d) on pipe close of `%s' (%s)" msgstr "status de falha (%d) ao fechar pipe de `%s' (%s)" -#: io.c:927 +#: io.c:963 #, c-format msgid "failure status (%d) on file close of `%s' (%s)" msgstr "status de falha (%d) ao fechar arquivo de `%s' (%s)" -#: io.c:946 +#: io.c:983 #, c-format msgid "no explicit close of socket `%s' provided" msgstr "fechamento explícito do socket `%s' não fornecido" -#: io.c:949 +#: io.c:986 #, c-format msgid "no explicit close of co-process `%s' provided" msgstr "fechamento explícito do co-processo `%s' não fornecido" -#: io.c:952 +#: io.c:989 #, c-format msgid "no explicit close of pipe `%s' provided" msgstr "fechamento explícito do pipe `%s' não fornecido" -#: io.c:955 +#: io.c:992 #, c-format msgid "no explicit close of file `%s' provided" msgstr "fechamento explícito do arquivo `%s' não fornecido" -#: io.c:984 io.c:1038 +#: io.c:1021 io.c:1075 #, c-format msgid "error writing standard output (%s)" msgstr "erro ao escrever na saída padrão (%s)" -#: io.c:988 io.c:1042 +#: io.c:1025 io.c:1079 #, c-format msgid "error writing standard error (%s)" msgstr "erro ao escrever na saída padrão de erros (%s)" -#: io.c:996 +#: io.c:1033 #, c-format msgid "pipe flush of `%s' failed (%s)." msgstr "descarga de pipe de `%s' falhou (%s)." -#: io.c:999 +#: io.c:1036 #, c-format msgid "co-process flush of pipe to `%s' failed (%s)." msgstr "descarga de co-processo de pipe para `%s' falhou (%s)." -#: io.c:1002 +#: io.c:1039 #, c-format msgid "file flush of `%s' failed (%s)." msgstr "descarga de arquivo de `%s' falhou (%s)." -#: io.c:1161 +#: io.c:1198 msgid "/inet/raw client not ready yet, sorry" msgstr "infelizmente, o cliente de /inet/raw não está concluído" -#: io.c:1163 io.c:1200 +#: io.c:1200 io.c:1237 msgid "only root may use `/inet/raw'." msgstr "apenas root pode usar `/inet/raw'." -#: io.c:1198 +#: io.c:1235 msgid "/inet/raw server not ready yet, sorry" msgstr "infelizmente, o servidor de /inet/raw não está concluído" -#: io.c:1288 +#: io.c:1325 #, c-format msgid "no (known) protocol supplied in special filename `%s'" msgstr "" "nenhum protocolo (conhecido) fornecido em nome de arquivo especial `%s'" -#: io.c:1306 +#: io.c:1343 #, c-format msgid "special file name `%s' is incomplete" msgstr "nome de arquivo especial `%s' está incompleto" -#: io.c:1318 +#: io.c:1355 #, c-format msgid "local port invalid in `%s'" msgstr "porta local inválida em `%s'" -#: io.c:1330 +#: io.c:1367 msgid "must supply a remote hostname to `/inet'" msgstr "deve ser fornecido um nome de host remoto para `/inet'" -#: io.c:1345 +#: io.c:1382 msgid "must supply a remote port to `/inet'" msgstr "deve ser fornecida uma porta remota para `/inet'" -#: io.c:1351 +#: io.c:1388 #, c-format msgid "remote port invalid in `%s'" msgstr "porta remota inválida em `%s'" -#: io.c:1361 +#: io.c:1398 msgid "TCP/IP communications are not supported" msgstr "comunicação TCP/IP não é suportada" -#: io.c:1370 io.c:1551 +#: io.c:1407 io.c:1588 #, c-format msgid "file `%s' is a directory" msgstr "arquivo `%s' é um diretório" -#: io.c:1440 +#: io.c:1477 #, c-format msgid "use `PROCINFO[\"%s\"]' instead of `%s'" msgstr "use `PROCINFO[\"%s\"]' em vez de `%s'" -#: io.c:1472 +#: io.c:1509 msgid "use `PROCINFO[...]' instead of `/dev/user'" msgstr "use `PROCINFO[...]' em vez de `/dev/user'" -#: io.c:1537 io.c:1711 +#: io.c:1574 io.c:1748 #, c-format msgid "could not open `%s', mode `%s'" msgstr "impossível abrir `%s', modo `%s'" -#: io.c:1762 +#: io.c:1799 #, c-format msgid "close of master pty failed (%s)" msgstr "falha ao fechar pty mestre (%s)" -#: io.c:1764 io.c:1916 io.c:2068 +#: io.c:1801 io.c:1953 io.c:2105 #, c-format msgid "close of stdout in child failed (%s)" msgstr "falha ao fechar stdout em filho (%s)" -#: io.c:1767 +#: io.c:1804 #, c-format msgid "moving slave pty to stdout in child failed (dup: %s)" msgstr "falha ao mover pty escrava para stdout em filho (dup: %s)" -#: io.c:1769 io.c:1921 +#: io.c:1806 io.c:1958 #, c-format msgid "close of stdin in child failed (%s)" msgstr "falha ao fechar stdin em filho (%s)" -#: io.c:1772 +#: io.c:1809 #, c-format msgid "moving slave pty to stdin in child failed (dup: %s)" msgstr "falha ao mover pty escrava para stdin em filho (dup: %s)" -#: io.c:1774 io.c:1793 +#: io.c:1811 io.c:1830 #, c-format msgid "close of slave pty failed (%s)" msgstr "falha ao fechar pty escrava (%s)" -#: io.c:1867 io.c:1919 io.c:2049 io.c:2071 +#: io.c:1904 io.c:1956 io.c:2086 io.c:2108 #, c-format msgid "moving pipe to stdout in child failed (dup: %s)" msgstr "falha ao mover pipe para stdout em processo pai (dup: %s)" -#: io.c:1871 io.c:1924 +#: io.c:1908 io.c:1961 #, c-format msgid "moving pipe to stdin in child failed (dup: %s)" msgstr "falha ao mover pipe para stdin em processo pai (dup: %s)" -#: io.c:1888 io.c:2062 +#: io.c:1925 io.c:2099 msgid "restoring stdout in parent process failed\n" msgstr "falha ao restaurar stdout em processo pai\n" -#: io.c:1893 +#: io.c:1930 msgid "restoring stdin in parent process failed\n" msgstr "falha ao restaurar stdin em processo pai\n" -#: io.c:1927 io.c:2073 io.c:2084 +#: io.c:1964 io.c:2110 io.c:2121 #, c-format msgid "close of pipe failed (%s)" msgstr "falha ao fechar pipe (%s)" -#: io.c:1972 +#: io.c:2009 msgid "`|&' not supported" msgstr "`|&' não suportado" -#: io.c:2039 +#: io.c:2076 #, c-format msgid "cannot open pipe `%s' (%s)" msgstr "impossível abrir pipe `%s' (%s)" -#: io.c:2080 +#: io.c:2117 #, c-format msgid "cannot create child process for `%s' (fork: %s)" msgstr "impossível criar processo filho para `%s' (fork: %s)" -#: io.c:2423 +#: io.c:2460 #, c-format msgid "data file `%s' is empty" msgstr "arquivo de dados `%s' vazio" -#: io.c:2466 io.c:2474 +#: io.c:2503 io.c:2511 msgid "could not allocate more input memory" msgstr "impossível alocar mais memória de entrada" -#: io.c:2832 io.c:2895 +#: io.c:2869 io.c:2932 #, c-format msgid "error reading input file `%s': %s" msgstr "erro ao ler arquivo de entrada `%s': %s" -#: io.c:3020 +#: io.c:3057 msgid "multicharacter value of `RS' is a gawk extension" msgstr "valor de múltiplos caracteres para `RS' é uma extensão do gawk" -#: main.c:324 +#: main.c:323 msgid "`-m[fr]' option irrelevant in gawk" msgstr "opção `-m[fr] é irrelevante no gawk" -#: main.c:326 +#: main.c:325 msgid "-m option usage: `-m[fr] nnn'" msgstr "uso da opção -m: `-m[fr] nnn'" -#: main.c:343 +#: main.c:342 #, c-format msgid "%s: option `-W %s' unrecognized, ignored\n" msgstr "%s: opção `-W %s' não reconhecida, ignorada\n" -#: main.c:380 +#: main.c:379 msgid "empty argument to `--source' ignored" msgstr "argumento vazio para --source ignorado" -#: main.c:451 +#: main.c:450 msgid "environment variable `POSIXLY_CORRECT' set: turning on `--posix'" msgstr "variável de ambiente `POSIXLY_CORRECT' ativada: ligando `--posix'" -#: main.c:456 +#: main.c:455 msgid "`--posix' overrides `--traditional'" msgstr "`--posix' sobrepõe `--traditional'" -#: main.c:467 +#: main.c:466 msgid "`--posix'/`--traditional' overrides `--non-decimal-data'" msgstr "`--posix'/`--traditional' sobrepõe `--non-decimal-data'" -#: main.c:471 +#: main.c:470 #, c-format msgid "running %s setuid root may be a security problem" msgstr "rodar %s com setuid root pode ser um problema de segurança" -#: main.c:512 +#: main.c:511 #, c-format msgid "can't set binary mode on stdin (%s)" msgstr "impossível ativar modo binário em stdin (%s)" -#: main.c:515 +#: main.c:514 #, c-format msgid "can't set binary mode on stdout (%s)" msgstr "impossível ativar modo binário em stdout (%s)" -#: main.c:517 +#: main.c:516 #, c-format msgid "can't set binary mode on stderr (%s)" msgstr "impossível ativar modo binário em stderr (%s)" -#: main.c:547 +#: main.c:546 msgid "no program text at all!" msgstr "nenhum texto de programa" -#: main.c:620 +#: main.c:623 #, c-format msgid "Usage: %s [POSIX or GNU style options] -f progfile [--] file ...\n" msgstr "Uso: %s [opções estilo POSIX ou GNU] -f arqprog [--] arquivo ...\n" -#: main.c:622 +#: main.c:625 #, c-format msgid "Usage: %s [POSIX or GNU style options] [--] %cprogram%c file ...\n" msgstr "Uso: %s [opções estilo POSIX ou GNU] [--] %cprograma%c arquivo ...\n" -#: main.c:627 +#: main.c:630 msgid "POSIX options:\t\tGNU long options:\n" msgstr "Opções POSIX: \t\tOpções longas GNU:\n" -#: main.c:628 +#: main.c:631 msgid "\t-f progfile\t\t--file=progfile\n" msgstr "\t-f arqprog \t\t--file=arqprog\n" -#: main.c:629 +#: main.c:632 msgid "\t-F fs\t\t\t--field-separator=fs\n" msgstr "\t-F fs\t\t\t--field-separator=fs\n" -#: main.c:630 +#: main.c:633 msgid "\t-v var=val\t\t--assign=var=val\n" msgstr "\t-v var=val\t\t--assign=var=val\n" -#: main.c:631 +#: main.c:634 msgid "\t-m[fr] val\n" msgstr "\t-m[fr] val\n" -#: main.c:632 +#: main.c:635 msgid "\t-W compat\t\t--compat\n" msgstr "\t-W compat\t\t--compat\n" -#: main.c:633 +#: main.c:636 msgid "\t-W copyleft\t\t--copyleft\n" msgstr "\t-W copyleft\t\t--copyleft\n" -#: main.c:634 +#: main.c:637 msgid "\t-W copyright\t\t--copyright\n" msgstr "\t-W copyright\t\t--copyright\n" -#: main.c:635 +#: main.c:638 msgid "\t-W dump-variables[=file]\t--dump-variables[=file]\n" msgstr "\t-W dump-variables[=arq] \t--dump-variables[=arq]\n" -#: main.c:636 +#: main.c:639 msgid "\t-W gen-po\t\t--gen-po\n" msgstr "\t-W gen-po\t\t--gen-po\n" -#: main.c:637 +#: main.c:640 msgid "\t-W help\t\t\t--help\n" msgstr "\t-W help\t\t\t--help\n" -#: main.c:638 +#: main.c:641 msgid "\t-W lint[=fatal]\t\t--lint[=fatal]\n" msgstr "\t-W lint[=fatal]\t\t--lint[=fatal]\n" -#: main.c:639 +#: main.c:642 msgid "\t-W lint-old\t\t--lint-old\n" msgstr "\t-W lint-old\t\t--lint-old\n" -#: main.c:640 +#: main.c:643 msgid "\t-W non-decimal-data\t--non-decimal-data\n" msgstr "\t-W non-decimal-data\t--non-decimal-data\n" -#: main.c:642 +#: main.c:645 msgid "\t-W nostalgia\t\t--nostalgia\n" msgstr "\t-W nostalgia\t\t--nostalgia\n" -#: main.c:645 +#: main.c:648 msgid "\t-W parsedebug\t\t--parsedebug\n" msgstr "\t-W parsedebug\t\t--parsedebug\n" -#: main.c:647 +#: main.c:650 msgid "\t-W profile[=file]\t--profile[=file]\n" msgstr "\t-W profile[=arq] \t--profile[=arq]\n" -#: main.c:648 +#: main.c:651 msgid "\t-W posix\t\t--posix\n" msgstr "\t-W posix\t\t--posix\n" -#: main.c:649 +#: main.c:652 msgid "\t-W re-interval\t\t--re-interval\n" msgstr "\t-W re-interval\t\t--re-interval\n" -#: main.c:650 +#: main.c:653 msgid "\t-W source=program-text\t--source=program-text\n" msgstr "\t-W source=program-text\t--source=program-text\n" -#: main.c:651 +#: main.c:654 msgid "\t-W traditional\t\t--traditional\n" msgstr "\t-W traditional\t\t--traditional\n" -#: main.c:652 +#: main.c:655 msgid "\t-W usage\t\t--usage\n" msgstr "\t-W usage\t\t--usage\n" -#: main.c:653 +#: main.c:656 msgid "\t-W version\t\t--version\n" msgstr "\t-W version\t\t--version\n" -#: main.c:657 +#: main.c:660 msgid "" "\n" "To report bugs, see node `Bugs' in `gawk.info', which is\n" @@ -1466,7 +1543,7 @@ msgstr "" "seção `Reportando Problemas e Bugs' na versão impressa.\n" "\n" -#: main.c:661 +#: main.c:664 msgid "" "gawk is a pattern scanning and processing language.\n" "By default it reads standard input and writes standard output.\n" @@ -1476,7 +1553,7 @@ msgstr "" "Por padrão, o gawk lê a entrada padrão e escreve na saída padrão.\n" "\n" -#: main.c:665 +#: main.c:668 msgid "" "Examples:\n" "\tgawk '{ sum += $1 }; END { print sum }' file\n" @@ -1486,7 +1563,7 @@ msgstr "" "\tgawk '{ soma += $1 }; END { print soma }' arquivo\n" "\tgawk -F: '{ print $1 }' /etc/passwd\n" -#: main.c:682 +#: main.c:685 #, c-format msgid "" "Copyright (C) 1989, 1991-%d Free Software Foundation.\n" @@ -1505,7 +1582,7 @@ msgstr "" "(aoseu critério) qualquer versão posterior.\n" "\n" -#: main.c:690 +#: main.c:693 msgid "" "This program is distributed in the hope that it will be useful,\n" "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" @@ -1517,7 +1594,7 @@ msgstr "" "QUALQUER GARANTIA. Veja a Licença Pública Geral GNU (GNU GPL)\n" "para mais detalhes.\n" -#: main.c:696 +#: main.c:699 msgid "" "You should have received a copy of the GNU General Public License\n" "along with this program; if not, write to the Free Software\n" @@ -1527,11 +1604,11 @@ msgstr "" "junto com este programa; caso contrário, escreva à Free Software\n" "Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n" -#: main.c:730 +#: main.c:733 msgid "-Ft does not set FS to tab in POSIX awk" msgstr "-Ft não faz FS ser tab no awk POSIX" -#: main.c:956 +#: main.c:962 #, c-format msgid "" "%s: `%s' argument to `-v' not in `var=value' form\n" @@ -1540,40 +1617,41 @@ msgstr "" "%s: argumento `%s' para `-v' não está na forma `var=valor'\n" "\n" -#: main.c:976 +#: main.c:982 #, c-format msgid "`%s' is not a legal variable name" msgstr "`%s' não é um nome legal de variável" -#: main.c:979 +#: main.c:985 #, c-format msgid "`%s' is not a variable name, looking for file `%s=%s'" msgstr "`%s' não é um nome de variável, procurando arquivo `%s=%s'" -#: main.c:1012 +#: main.c:1018 msgid "floating point exception" msgstr "exceção de ponto flutuante" -#: main.c:1019 +#: main.c:1025 msgid "fatal error: internal error" msgstr "erro fatal: erro interno" -#: main.c:1069 +#: main.c:1075 #, c-format msgid "no pre-opened fd %d" msgstr "nenhum descritor pré-aberto %d" -#: main.c:1074 +#: main.c:1082 #, c-format msgid "could not pre-open /dev/null for fd %d" msgstr "impossível pré-abrir /dev/null para descritor %d" -#: main.c:1097 main.c:1106 +#: main.c:1105 main.c:1114 #, c-format msgid "could not find groups: %s" msgstr "impossível achar grupos: %s" #: msg.c:54 +#, c-format msgid "cmd. line:" msgstr "lin. de com.:" @@ -1593,19 +1671,19 @@ msgstr "fatal: " msgid "can't convert string to float" msgstr "impossível converter string para float" -#: node.c:355 +#: node.c:357 msgid "backslash at end of string" msgstr "barra invertida (\\) no fim da string" -#: node.c:539 +#: node.c:541 msgid "POSIX does not allow `\\x' escapes" msgstr "POSIX não permite escapes do tipo `\\x'" -#: node.c:545 +#: node.c:547 msgid "no hex digits in `\\x' escape sequence" msgstr "nenhum dígito hexa em seqüência de escape `\\x'" -#: node.c:579 +#: node.c:581 #, c-format msgid "escape sequence `\\%c' treated as plain `%c'" msgstr "seqüência de escape `\\%c' tratada como `%c' normal" @@ -1620,21 +1698,27 @@ msgstr "%s %s `%s': imposs msgid "could not open `%s' for writing: %s" msgstr "impossível abrir `%s' para escrita: %s" -#: profile.c:449 +#: profile.c:467 #, c-format msgid "internal error: %s with null vname" msgstr "erro interno: %s com vname nulo" -#: profile.c:512 +#: profile.c:530 msgid "# treated internally as `delete'" msgstr "# tratado internamente como `delete'" -#: profile.c:1162 +#: profile.c:1167 +#, c-format +msgid "# this is a dynamically loaded extension function" +msgstr "" + +#: profile.c:1198 #, c-format msgid "\t# gawk profile, created %s\n" msgstr "\t# perfil gawk, criado %s\n" -#: profile.c:1165 +#: profile.c:1201 +#, c-format msgid "" "\t# BEGIN block(s)\n" "\n" @@ -1642,7 +1726,8 @@ msgstr "" "\t# bloco(s) BEGIN\n" "\n" -#: profile.c:1175 +#: profile.c:1211 +#, c-format msgid "" "\t# Rule(s)\n" "\n" @@ -1650,7 +1735,8 @@ msgstr "" "\t# Regra(s)\n" "\n" -#: profile.c:1181 +#: profile.c:1217 +#, c-format msgid "" "\t# END block(s)\n" "\n" @@ -1658,7 +1744,8 @@ msgstr "" "\t# bloco(s) END\n" "\n" -#: profile.c:1201 +#: profile.c:1237 +#, c-format msgid "" "\n" "\t# Functions, listed alphabetically\n" @@ -1666,90 +1753,91 @@ msgstr "" "\n" "\t# Funções, listadas alfabeticamente\n" -#: profile.c:1413 +#: profile.c:1452 #, c-format msgid "unexpected type %s in prec_level" msgstr "tipo inesperado %s em prec_level" -#: re.c:193 -#, c-format -msgid "regex match failed, not enough memory to match string \"%.*s%s\"" -msgstr "" -"busca por exp. reg. falhou, memória insuficiente para testar string \"%.*s%s" -"\"" - -#: regcomp.c:136 +#: regcomp.c:150 msgid "Success" msgstr "Sucesso" -#: regcomp.c:139 +#: regcomp.c:153 msgid "No match" msgstr "Sem combinação" -#: regcomp.c:142 +#: regcomp.c:156 msgid "Invalid regular expression" msgstr "Expressão regular inválida" -#: regcomp.c:145 +#: regcomp.c:159 msgid "Invalid collation character" msgstr "Caracter de combinação inválido" -#: regcomp.c:148 +#: regcomp.c:162 msgid "Invalid character class name" msgstr "Nome de classe de caracter inválido" -#: regcomp.c:151 +#: regcomp.c:165 msgid "Trailing backslash" msgstr "contra-barra (\\) finalizando" -#: regcomp.c:154 +#: regcomp.c:168 msgid "Invalid back reference" msgstr "Referência anterior inválida" -#: regcomp.c:157 +#: regcomp.c:171 msgid "Unmatched [ or [^" msgstr "[ ou [^ não emparelhado" -#: regcomp.c:160 +#: regcomp.c:174 msgid "Unmatched ( or \\(" msgstr "( ou \\( não emparelhado" -#: regcomp.c:163 +#: regcomp.c:177 msgid "Unmatched \\{" msgstr "\\{ não emparelhado" -#: regcomp.c:166 +#: regcomp.c:180 msgid "Invalid content of \\{\\}" msgstr "Conteúdo inválido de \\{\\}" -#: regcomp.c:169 +#: regcomp.c:183 msgid "Invalid range end" msgstr "Fim de faixa inválido" -#: regcomp.c:172 +#: regcomp.c:186 msgid "Memory exhausted" msgstr "Memória esgotada" -#: regcomp.c:175 +#: regcomp.c:189 msgid "Invalid preceding regular expression" msgstr "Expressão regular anterior inválida" -#: regcomp.c:178 +#: regcomp.c:192 msgid "Premature end of regular expression" msgstr "Fim prematuro da expressão regular" -#: regcomp.c:181 +#: regcomp.c:195 msgid "Regular expression too big" msgstr "Expressão regular grande demais" -#: regcomp.c:184 +#: regcomp.c:198 msgid "Unmatched ) or \\)" msgstr ") ou \\) desemparelhado" -#: regcomp.c:621 +#: regcomp.c:668 msgid "No previous regular expression" msgstr "Nenhuma expressão regular anterior" +#~ msgid "or used as a variable or an array" +#~ msgstr "ou usado como uma variável ou vetor" + +#~ msgid "regex match failed, not enough memory to match string \"%.*s%s\"" +#~ msgstr "" +#~ "busca por exp. reg. falhou, memória insuficiente para testar string \"%.*s" +#~ "%s\"" + #~ msgid "substr: length %g is < 0" #~ msgstr "substr: comprimento %g é < 0" diff --git a/po/ro.gmo b/po/ro.gmo new file mode 100644 index 000000000..fec28adb7 Binary files /dev/null and b/po/ro.gmo differ diff --git a/po/ro.po b/po/ro.po new file mode 100644 index 000000000..f419877ea --- /dev/null +++ b/po/ro.po @@ -0,0 +1,1931 @@ +# Mesajele în limba românã pentru pachetul gawk +# Copyright (C) 2003 Free Software Foundation, Inc. +# Eugen Hoanca , 2003. +# +msgid "" +msgstr "" +"Project-Id-Version: gawk 3.1.31\n" +"Report-Msgid-Bugs-To: arnold@skeeve.com\n" +"POT-Creation-Date: 2004-07-15 13:02+0300\n" +"PO-Revision-Date: 2003-09-15 17:48+0300\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" + +#: array.c:112 +#, fuzzy, c-format +msgid "attempt to use function `%s' as an array" +msgstr "încercare de folosire a funcþiei `%s' ca array" + +#: array.c:115 +#, c-format +msgid "attempt to use scalar parameter `%s' as an array" +msgstr "încercare de utilizare a parametrului scalar `%s' drept array" + +#: array.c:118 +#, c-format +msgid "attempt to use scalar `%s' as array" +msgstr "încercare de a utiliza scalarul `%s' ca array" + +#: array.c:156 +#, fuzzy, c-format +msgid "from %s" +msgstr "%s (din %s)" + +#: array.c:511 +#, c-format +msgid "reference to uninitialized element `%s[\"%s\"]'" +msgstr "referinþã la elementul neiniþializat `%s[\"%s\"]'" + +#: array.c:517 +#, c-format +msgid "subscript of array `%s' is null string" +msgstr "înscrierea array-ului `%s' este ºir null" + +#: array.c:621 +#, c-format +msgid "delete: index `%s' not in array `%s'" +msgstr "delete: indexul `%s' nu este în array-ul `%s'" + +#: array.c:791 +#, c-format +msgid "%s: empty (null)\n" +msgstr "%s: vid (null)\n" + +#: array.c:796 +#, c-format +msgid "%s: empty (zero)\n" +msgstr "%s: vid (zero)\n" + +#: array.c:800 +#, c-format +msgid "%s: table_size = %d, array_size = %d\n" +msgstr "%s: table_size = %d, array_size = %d\n" + +#: array.c:829 +#, fuzzy, c-format +msgid "%s: is parameter\n" +msgstr "%s: este parametru!\n" + +#: array.c:834 +#, c-format +msgid "%s: array_ref to %s\n" +msgstr "%s: array_ref cãtre %s\n" + +#: awkgram.y:208 +#, fuzzy, c-format +msgid "%s blocks must have an action part" +msgstr "Blocurile de END trebuie sã aibã un fragment de acþiune" + +#: awkgram.y:211 +#, fuzzy +msgid "each rule must have a pattern or an action part" +msgstr "Blocurile de END trebuie sã aibã un fragment de acþiune" + +#: awkgram.y:267 +#, c-format +msgid "`%s' is a built-in function, it cannot be redefined" +msgstr "`%s' este funcþie internã, nu poate fi redefinitã" + +#: awkgram.y:314 +#, c-format +msgid "regexp constant `/%s/' looks like a C comment, but is not" +msgstr "constanta regexp `/%s/' aratã ca un comentariu C, dar nu este" + +#: awkgram.y:341 awkgram.y:619 +msgid "statement may have no effect" +msgstr "declaraþia poate sã nu aibã nici un efect" + +#: awkgram.y:436 awkgram.y:456 +#, fuzzy, c-format +msgid "`%s' used in %s action" +msgstr "`next' folosit în acþiune BEGIN sau END" + +#: awkgram.y:449 awkgram.y:452 +msgid "`nextfile' is a gawk extension" +msgstr "`nextfile' este extensie gawk" + +#: awkgram.y:466 +msgid "`return' used outside function context" +msgstr "`return' folosit în afara contextului funcþiei" + +#: awkgram.y:508 +msgid "plain `print' in BEGIN or END rule should probably be `print \"\"'" +msgstr "" +"`print' simplu din regulile BEGIN sau END ar trebui sã fie probabil `print " +"\"\"'" + +#: awkgram.y:521 awkgram.y:528 +msgid "`delete array' is a gawk extension" +msgstr "`delete array' este extensie gawk" + +#: awkgram.y:536 awkgram.y:543 +#, fuzzy +msgid "`delete(array)' is a non-portable tawk extension" +msgstr "`delete array' este extensie gawk" + +#: awkgram.y:587 +#, c-format +msgid "duplicate case values in switch body: %s" +msgstr "" + +#: awkgram.y:597 +msgid "Duplicate `default' detected in switch body" +msgstr "" + +#: awkgram.y:686 +msgid "multistage two-way pipelines don't work" +msgstr "legãturile(pipelines) bidirecþionale multistage nu vor funcþiona" + +#: awkgram.y:777 +msgid "regular expression on right of assignment" +msgstr "expresie regularã în dreapta atribuirii" + +#: awkgram.y:800 +msgid "regular expression on left of `~' or `!~' operator" +msgstr "expresie regularã în stânga operatorului `~' sau `!~'" + +#: awkgram.y:808 +msgid "regular expression on right of comparison" +msgstr "expresie regularã în dreapta comparaþiei" + +#: awkgram.y:875 +msgid "non-redirected `getline' undefined inside END action" +msgstr "`getline' nedefinitã ºi neredirectatã înãuntrul unei acþiuni END" + +#: awkgram.y:902 +msgid "call of `length' without parentheses is not portable" +msgstr "apelarea lui `legth' fãrã paranteze nu este portabilã" + +#: awkgram.y:905 +msgid "call of `length' without parentheses is deprecated by POSIX" +msgstr "apelarea lui `length' fãrã paranteze nu mai este folositã în POSIX" + +#: awkgram.y:958 +msgid "use of non-array as array" +msgstr "" + +#: awkgram.y:960 +msgid "invalid subscript expression" +msgstr "expresie subscript invalidã" + +#: awkgram.y:1158 +#, fuzzy +msgid "unexpected newline or end of string" +msgstr "linie nouã neaºteptatã" + +#: awkgram.y:1254 +msgid "empty program text on command line" +msgstr "text program vid în linia de comandã" + +#: awkgram.y:1307 +#, c-format +msgid "can't open source file `%s' for reading (%s)" +msgstr "nu se poate deschide fiºierul sursã `%s' pentru citire (%s)" + +#: awkgram.y:1384 +#, c-format +msgid "can't read sourcefile `%s' (%s)" +msgstr "nu se poate citi fiºierul sursã `%s' (%s)" + +#: awkgram.y:1392 +#, c-format +msgid "source file `%s' is empty" +msgstr "fiºierul sursã `%s' este vid" + +#: awkgram.y:1590 awkgram.y:1700 awkgram.y:1718 awkgram.y:2068 awkgram.y:2153 +msgid "source file does not end in newline" +msgstr "fiºierul sursã nu se terminã în linie nouã" + +#: awkgram.y:1654 +msgid "unterminated regexp ends with `\\' at end of file" +msgstr "regexp-ul neterminat se terminã cu `\\'` la sfârºitul fiºierului" + +#: awkgram.y:1674 +msgid "unterminated regexp" +msgstr "regexp neterminat" + +#: awkgram.y:1677 +msgid "unterminated regexp at end of file" +msgstr "regexp neterminat la sfârºitul fiºierului" + +#: awkgram.y:1744 +msgid "use of `\\ #...' line continuation is not portable" +msgstr "folosirea continuãrii liniei `\\ #...' nu este portabilã" + +#: awkgram.y:1756 +msgid "backslash not last character on line" +msgstr "backslash nu este ultimul caracter din linie" + +#: awkgram.y:1801 +msgid "POSIX does not allow operator `**='" +msgstr "POSIX nu permite operatorul `**='" + +#: awkgram.y:1803 +msgid "old awk does not support operator `**='" +msgstr "vechiul awk nu suportã operatorul `**='" + +#: awkgram.y:1812 +msgid "POSIX does not allow operator `**'" +msgstr "POSIX nu permite operatorul `**'" + +#: awkgram.y:1814 +msgid "old awk does not support operator `**'" +msgstr "vechiul awk nu supoortã operatorul `**'" + +#: awkgram.y:1845 +msgid "operator `^=' is not supported in old awk" +msgstr "operatorul `^=' nu este suportat în vechiul awk" + +#: awkgram.y:1853 +msgid "operator `^' is not supported in old awk" +msgstr "operator `^' nu este suportat în vechiul awk" + +#: awkgram.y:1937 awkgram.y:1954 +msgid "unterminated string" +msgstr "ºir de caractere neterminat" + +#: awkgram.y:2114 +#, c-format +msgid "invalid char '%c' in expression" +msgstr "caracter invalid `%c' în expresie" + +#: awkgram.y:2162 +#, c-format +msgid "`%s' is a gawk extension" +msgstr "`%s' este extensie gawk" + +#: awkgram.y:2165 +#, c-format +msgid "`%s' is a Bell Labs extension" +msgstr "`%s' este extensie Bell Labs" + +#: awkgram.y:2168 +#, c-format +msgid "POSIX does not allow `%s'" +msgstr "POSIX nu permite `%s'" + +#: awkgram.y:2172 +#, c-format +msgid "`%s' is not supported in old awk" +msgstr "`%s' nu este suportat în vechiul awk" + +#: awkgram.y:2198 +msgid "`goto' considered harmful!\n" +msgstr "`goto' este considerat periculos!\n" + +#: awkgram.y:2260 +#, c-format +msgid "%d is invalid as number of arguments for %s" +msgstr "%d este invalid ca numãr de argumente pentru %s" + +#: awkgram.y:2279 awkgram.y:2282 +msgid "match: third argument is a gawk extension" +msgstr "match: al treilea argument este extensie gawk" + +#: awkgram.y:2295 +#, c-format +msgid "%s: string literal as last arg of substitute has no effect" +msgstr "" +"%s: ºirul de caractere literal ca ultim argument al înlocuitorului nu are " +"nici un efect" + +#: awkgram.y:2298 +#, fuzzy, c-format +msgid "%s third parameter is not a changeable object" +msgstr "al treilea parametru al sub nu este un obiect modificabil" + +#: awkgram.y:2325 awkgram.y:2328 +msgid "close: second argument is a gawk extension" +msgstr "close: al doilea argument este extensie gawk" + +#: awkgram.y:2338 +msgid "use of dcgettext(_\"...\") is incorrect: remove leading underscore" +msgstr "" +"folosirea lui dcgettext(_\"...\") este incorectã: eliminaþi liniuþa_jos de " +"la început" + +#: awkgram.y:2353 +#, fuzzy +msgid "use of dcngettext(_\"...\") is incorrect: remove leading underscore" +msgstr "" +"folosirea lui dcgettext(_\"...\") este incorectã: eliminaþi liniuþa_jos de " +"la început" + +#: awkgram.y:2424 +#, c-format +msgid "function `%s': parameter #%d, `%s', duplicates parameter #%d" +msgstr "funcþia `%s': parametrul #%d, `%s', parametrul duplicat #%d" + +#: awkgram.y:2457 +#, c-format +msgid "function `%s': parameter `%s' shadows global variable" +msgstr "" +"funcþia `%s': parametrul `%s' nu mai þine cont de(shadows) variabila globalã" + +#: awkgram.y:2569 +#, c-format +msgid "could not open `%s' for writing (%s)" +msgstr "nu s-a putut deschide `%s' pentru scriere (%s)" + +#: awkgram.y:2570 profile.c:93 +msgid "sending profile to standard error" +msgstr "se trimite profilul la dipsozitivul de eroare standard" + +#: awkgram.y:2602 +#, c-format +msgid "%s: close failed (%s)" +msgstr "%s: închidere eºuatã (%s)" + +#: awkgram.y:2723 +msgid "shadow_funcs() called twice!" +msgstr "shadow_funcs() apelatã de douã ori!" + +#: awkgram.y:2750 +msgid "there were shadowed variables." +msgstr "" + +#: awkgram.y:2823 +#, c-format +msgid "function `%s': can't use function name as parameter name" +msgstr "funcþia `%s': nu se poate folosi numele funcþiei ca nume de parametru" + +#: awkgram.y:2833 +#, c-format +msgid "function name `%s' previously defined" +msgstr "numele funcþiei `%s' a mai fost definit înainte" + +#: awkgram.y:2984 awkgram.y:2990 +#, c-format +msgid "function `%s' called but never defined" +msgstr "funcþia `%s' este apelatã dar niciodatã definitã" + +#: awkgram.y:2993 +#, c-format +msgid "function `%s' defined but never called" +msgstr "funcþia `%s' este definitã dar niciodatã apelatã" + +#: awkgram.y:3020 +#, c-format +msgid "regexp constant for parameter #%d yields boolean value" +msgstr "" +"regexp constant pentru parametrul #%d solicitã(yields) valoare booleanã" + +#: awkgram.y:3033 +#, fuzzy, c-format +msgid "" +"function `%s' called with space between name and `(',\n" +"or used as a variable or an array" +msgstr "" +"funcþia `%s' apelatã cu un spaþiu între nume ºi `(',\n" +"%s" + +#: builtin.c:149 +#, c-format +msgid "%s to \"%s\" failed (%s)" +msgstr "%s cãtre \"%s\" eºuatã (%s)" + +#: builtin.c:150 +msgid "standard output" +msgstr "ieºire(output) standard" + +#: builtin.c:151 +msgid "reason unknown" +msgstr "motiv necunoscut" + +#: builtin.c:164 +msgid "exp: received non-numeric argument" +msgstr "exp: s-a primit argument nenumeric" + +#: builtin.c:170 +#, c-format +msgid "exp: argument %g is out of range" +msgstr "exp: argumentul %g este în afara domeniului" + +#: builtin.c:228 +#, c-format +msgid "fflush: cannot flush: pipe `%s' opened for reading, not writing" +msgstr "" +"fflush: nu s-a putut face flush: legãtura(pipe) `%s' a fost deschisã pentru " +"citire, nu scriere" + +#: builtin.c:231 +#, c-format +msgid "fflush: cannot flush: file `%s' opened for reading, not writing" +msgstr "" +"fflush: nu s-a putut face flush: fiºierul `%s' a fost deschis pentru citire, " +"nu scriere" + +#: builtin.c:243 +#, c-format +msgid "fflush: `%s' is not an open file, pipe or co-process" +msgstr "fflush: `%s' nu este fiºier deschis, legãturã(pipe) sau co-proces" + +#: builtin.c:338 +msgid "index: received non-string first argument" +msgstr "index: s-a primit un prim argument non-ºir de caractere" + +#: builtin.c:340 +msgid "index: received non-string second argument" +msgstr "index: s-a primit un al doilea argument non-ºir de caractere" + +#: builtin.c:454 +msgid "int: received non-numeric argument" +msgstr "int: s-a primit argument nenumeric" + +#: builtin.c:471 +msgid "length: received non-string argument" +msgstr "legth: s-a primit argument non-string" + +#: builtin.c:487 +msgid "log: received non-numeric argument" +msgstr "log: s-a primit argument nenumeric" + +#: builtin.c:490 +#, c-format +msgid "log: received negative argument %g" +msgstr "log: s-a primit argument %g negativ" + +#: builtin.c:654 builtin.c:657 +msgid "must use `count$' on all formats or none" +msgstr "" + +#: builtin.c:759 +msgid "`$' is not permitted in awk formats" +msgstr "`$' nu este permis în formatele awk" + +#: builtin.c:765 +msgid "arg count with `$' must be > 0" +msgstr "numãrul de arg cu `%' trebuie sã fie > 0" + +#: builtin.c:767 +#, fuzzy, c-format +msgid "arg count %ld greater than total number of supplied arguments" +msgstr "" +"numãrul de arg %d este mai mare decât numãrul total de argumente furnizate" + +#: builtin.c:769 +msgid "`$' not permitted after period in format" +msgstr "`$' nu este permis în format dupã punct" + +#: builtin.c:782 +msgid "no `$' supplied for positional field width or precision" +msgstr "" +"nu s-a furnizat nici un `$' pentru câmpul poziþional lungime sau precisie" + +#: builtin.c:848 +msgid "`l' is meaningless in awk formats; ignored" +msgstr "`l' nu are sens în formatele awk; ignorat" + +#: builtin.c:852 +msgid "`l' is not permitted in POSIX awk formats" +msgstr "`l' nu este permis în formatele awk POSIX" + +#: builtin.c:863 +msgid "`L' is meaningless in awk formats; ignored" +msgstr "`L' nu are sens în formatele awk; ignorat" + +#: builtin.c:867 +msgid "`L' is not permitted in POSIX awk formats" +msgstr "`L' nu este permis în formatele POSIX awk" + +#: builtin.c:878 +msgid "`h' is meaningless in awk formats; ignored" +msgstr "`h' nu are sens în formatele awl; ignorat" + +#: builtin.c:882 +msgid "`h' is not permitted in POSIX awk formats" +msgstr "`h' nu este permis în formatele POSIX awk" + +#: builtin.c:1111 +#, c-format +msgid "[s]printf: value %g is out of range for `%%%c' format" +msgstr "" + +#: builtin.c:1171 +msgid "not enough arguments to satisfy format string" +msgstr "" +"nu existã destule argumente pentru satisfacerea formatului ºirului de " +"caractere" + +#: builtin.c:1173 +msgid "^ ran out for this one" +msgstr "^ insuficient pentru aceasta" + +#: builtin.c:1178 +msgid "[s]printf: format specifier does not have control letter" +msgstr "[s]printf: specificatorul de format nu are literã de control" + +#: builtin.c:1181 +msgid "too many arguments supplied for format string" +msgstr "prea multe argumente furnizate pentru formatul ºirului de caractere" + +#: builtin.c:1247 builtin.c:1250 +msgid "printf: no arguments" +msgstr "printf: nici un argument" + +#: builtin.c:1274 +msgid "sqrt: received non-numeric argument" +msgstr "sqrt: s-a primit argument nenumeric" + +#: builtin.c:1278 +#, c-format +msgid "sqrt: called with negative argument %g" +msgstr "sqrt: apelat cu argumentul negativ %g" + +#: builtin.c:1301 +#, c-format +msgid "substr: start index %g is invalid, using 1" +msgstr "substr: indexul de start %g este invalid, se foloseºte -1" + +#: builtin.c:1306 +#, c-format +msgid "substr: non-integer start index %g will be truncated" +msgstr "substr: indexul de start ne-întreg(integer) %g va fi trunchiat" + +#: builtin.c:1325 +#, fuzzy, c-format +msgid "substr: length %g is not >= 1" +msgstr "substr: lungimea %g este <= 0" + +#: builtin.c:1327 +#, fuzzy, c-format +msgid "substr: length %g is not >= 0" +msgstr "substr: lungimea %g este <= 0" + +#: builtin.c:1334 +#, c-format +msgid "substr: non-integer length %g will be truncated" +msgstr "substr lungimea ne-întregului(integer) %g va fi trunchiatã" + +#: builtin.c:1339 +#, c-format +msgid "substr: length %g too big for string indexing, truncating to %g" +msgstr "" + +#: builtin.c:1351 +msgid "substr: source string is zero length" +msgstr "substr: ºirul de caractere sursã are lungime zero" + +#: builtin.c:1357 +#, fuzzy, c-format +msgid "substr: start index %g is past end of string" +msgstr "substr: indexul de start %d este fostul sfârºit de ºir de caractere" + +#: builtin.c:1365 +#, fuzzy, c-format +msgid "" +"substr: length %g at start index %g exceeds length of first argument (%lu)" +msgstr "" +"substr: lungimea %d la indexul de start %d depãºeºte lungimea primului " +"argument (%d)" + +#: builtin.c:1400 +#, fuzzy +msgid "strftime: received non-string first argument" +msgstr "strftime: s-a primit primul argument non ºir de caractere" + +#: builtin.c:1406 +msgid "strftime: received empty format string" +msgstr "strftime: s-a primit ºir de caractere în format vid" + +#: builtin.c:1415 +#, fuzzy +msgid "strftime: received non-numeric second argument" +msgstr "strftime: s-a primit un al doilea argument nenumeric" + +#: builtin.c:1478 +msgid "mktime: received non-string argument" +msgstr "mktime: s-a primit argument non ºir de caractere" + +#: builtin.c:1523 +#, fuzzy +msgid "system: received non-string argument" +msgstr "system: s-a primit argument non ºir de caractere" + +#: builtin.c:1644 eval.c:2019 +#, fuzzy, c-format +msgid "reference to uninitialized field `$%d'" +msgstr "referinþã la variabila neiniþializatã `%s'" + +#: builtin.c:1671 +#, fuzzy +msgid "tolower: received non-string argument" +msgstr "tolower: s-a primit argument non-ºir de caractere" + +#: builtin.c:1720 +#, fuzzy +msgid "toupper: received non-string argument" +msgstr "toupper: s-a primit argument non-ºir de caractere" + +#: builtin.c:1765 +msgid "atan2: received non-numeric first argument" +msgstr "atan2: s-a primit un prim argument nenumeric" + +#: builtin.c:1767 +msgid "atan2: received non-numeric second argument" +msgstr "atan2: s-a primit un al doilea argument nenumeric" + +#: builtin.c:1786 +msgid "sin: received non-numeric argument" +msgstr "sin: s-a primit un argument nenumeric" + +#: builtin.c:1802 +msgid "cos: received non-numeric argument" +msgstr "cos: s-a primit un argument nenumeric" + +#: builtin.c:1852 +msgid "srand: received non-numeric argument" +msgstr "srand: s-a primit un argument nenumeric" + +#: builtin.c:1887 +msgid "match: third argument is not an array" +msgstr "match: al treilea argument nu este un array" + +#: builtin.c:2414 +#, fuzzy +msgid "gensub: third argument of 0 treated as 1" +msgstr "gensub: al 3-lea argument care este 0 va fi considerat 1" + +#: builtin.c:2572 +msgid "lshift: received non-numeric first argument" +msgstr "lshift: s-a primit un prim argument nenumeric" + +#: builtin.c:2574 +#, fuzzy +msgid "lshift: received non-numeric second argument" +msgstr "strftime: s-a primit un al doilea argument nenumeric" + +#: builtin.c:2580 +#, c-format +msgid "lshift(%lf, %lf): negative values will give strange results" +msgstr "lshift(%lf, %lf): valorile negative vor furniza rezultate ciudate" + +#: builtin.c:2582 +#, c-format +msgid "lshift(%lf, %lf): fractional values will be truncated" +msgstr "lshift(%lf, %lf): valorile fracþionale vor fi trunchiate" + +#: builtin.c:2584 +#, c-format +msgid "lshift(%lf, %lf): too large shift value will give strange results" +msgstr "" +"lshift(%lf, %lf): valorile schimbate prea mult vor da rezultate ciudate" + +#: builtin.c:2610 +msgid "rshift: received non-numeric first argument" +msgstr "rshift: s-a primit un prim argument nenumeric" + +#: builtin.c:2612 +#, fuzzy +msgid "rshift: received non-numeric second argument" +msgstr "strftime: s-a primit un al doilea argument nenumeric" + +#: builtin.c:2618 +#, c-format +msgid "rshift(%lf, %lf): negative values will give strange results" +msgstr "rshift(%lf, %lf): valorile negative vor da rezultate ciudate" + +#: builtin.c:2620 +#, c-format +msgid "rshift(%lf, %lf): fractional values will be truncated" +msgstr "rshift(%lf, %lf): valorile fracþionale vor fi trunchiate" + +#: builtin.c:2622 +#, c-format +msgid "rshift(%lf, %lf): too large shift value will give strange results" +msgstr "" +"rshift(%lf, %lf): valorile schimbate prea mult vor da rezultate ciudate" + +#: builtin.c:2648 +msgid "and: received non-numeric first argument" +msgstr "and: s-a primit un prim argument nenumeric" + +#: builtin.c:2650 +#, fuzzy +msgid "and: received non-numeric second argument" +msgstr "atan2: s-a primit un al doilea argument nenumeric" + +#: builtin.c:2656 +#, c-format +msgid "and(%lf, %lf): negative values will give strange results" +msgstr "and(%lf, %lf): valorile negative vor da rezultate ciudate" + +#: builtin.c:2658 +#, c-format +msgid "and(%lf, %lf): fractional values will be truncated" +msgstr "and(%lf, %lf): valorile fracþionale vor fi trunchiate" + +#: builtin.c:2684 +msgid "or: received non-numeric first argument" +msgstr "or: s-a primit un prim argument nenumeric" + +#: builtin.c:2686 +#, fuzzy +msgid "or: received non-numeric second argument" +msgstr "atan2: s-a primit un al doilea argument nenumeric" + +#: builtin.c:2692 +#, c-format +msgid "or(%lf, %lf): negative values will give strange results" +msgstr "or(%lf, %lf): valorile negative for da rezultate ciudate" + +#: builtin.c:2694 +#, c-format +msgid "or(%lf, %lf): fractional values will be truncated" +msgstr "or(%lf, %lf): valorile fracþionale vor fi trunchiate" + +#: builtin.c:2720 +msgid "xor: received non-numeric first argument" +msgstr "xor: s-a primit un prim argument nenumeric" + +#: builtin.c:2722 +#, fuzzy +msgid "xor: received non-numeric second argument" +msgstr "atan2: s-a primit un al doilea argument nenumeric" + +#: builtin.c:2728 +#, c-format +msgid "xor(%lf, %lf): negative values will give strange results" +msgstr "xor(%lf, %lf): valorile negative vor da rezultate ciudate" + +#: builtin.c:2730 +#, c-format +msgid "xor(%lf, %lf): fractional values will be truncated" +msgstr "xor(%lf, %lf): valorile fracþionale vor fi trunchiate" + +#: builtin.c:2754 +msgid "compl: received non-numeric argument" +msgstr "compl: s-a primit argument nenumeric" + +#: builtin.c:2760 +#, c-format +msgid "compl(%lf): negative value will give strange results" +msgstr "compl(%lf): valorile negative vor da rezultate ciudate" + +#: builtin.c:2762 +#, c-format +msgid "compl(%lf): fractional value will be truncated" +msgstr "compl(%lf): valorile fracþionale vor fi trunchiate" + +#: builtin.c:2935 +#, c-format +msgid "dcgettext: `%s' is not a valid locale category" +msgstr "dcgettext: `%s' nu este o categorie localã validã" + +#: eval.c:303 +#, c-format +msgid "unknown nodetype %d" +msgstr "tip nod %d necunoscut" + +#: eval.c:350 +msgid "buffer overflow in genflags2str" +msgstr "depãºire(overflow) de buffer în genflags2str" + +#: eval.c:382 eval.c:388 profile.c:837 +#, c-format +msgid "attempt to use array `%s' in a scalar context" +msgstr "încercare de a utiliza array-ul `%s' într-un context scalar" + +#: eval.c:730 +#, fuzzy, c-format +msgid "for loop: array `%s' changed size from %ld to %ld during loop execution" +msgstr "" +"for loop: array-ul `%s' ºi-a schimbat mãrimea din %d în %d în timpul " +"execuþiei buclei" + +#: eval.c:751 +msgid "`break' outside a loop is not portable" +msgstr "`break' în afara buclei nu este portabil" + +#: eval.c:755 +msgid "`break' outside a loop is not allowed" +msgstr "`break' în afara buclei nu este permis" + +#: eval.c:772 +msgid "`continue' outside a loop is not portable" +msgstr "`continue' în afara buclei nu este portabil" + +#: eval.c:776 +msgid "`continue' outside a loop is not allowed" +msgstr "`continue' în afara buclei nu este permis" + +#: eval.c:810 +msgid "`next' cannot be called from a BEGIN rule" +msgstr "`next' nu poate fi apelat dintr-o regulã BEGIN" + +#: eval.c:812 +msgid "`next' cannot be called from an END rule" +msgstr "`next' nu poate fi apelat dintr-o regulã END" + +#: eval.c:821 +msgid "`nextfile' cannot be called from a BEGIN rule" +msgstr "`nextfile' nu poate fi apelat dintr-o regulã BEGIN" + +#: eval.c:823 +msgid "`nextfile' cannot be called from an END rule" +msgstr "`nextfile' nu poate fi apelat dintr-o regulã END" + +#: eval.c:872 +msgid "statement has no effect" +msgstr "declaraþia nu are nici un efect" + +#: eval.c:915 eval.c:1873 +#, c-format +msgid "can't use function name `%s' as variable or array" +msgstr "nu se poate folosi numele funcþiei `%s' ca variabilã sau array" + +#: eval.c:922 eval.c:928 +#, c-format +msgid "reference to uninitialized argument `%s'" +msgstr "referinþã la argumentul neiniþializat `%s'" + +#: eval.c:937 eval.c:1882 +#, c-format +msgid "reference to uninitialized variable `%s'" +msgstr "referinþã la variabila neiniþializatã `%s'" + +#: eval.c:1083 +msgid "" +"concatenation: side effects in one expression have changed the length of " +"another!" +msgstr "" +"concatenation: efectele secundare dintr-o expresie au schimbat lungimea " +"alteia!" + +#: eval.c:1162 +msgid "assignment used in conditional context" +msgstr "atribuire folositã în context condiþional" + +#: eval.c:1252 +msgid "division by zero attempted" +msgstr "s-a încercat împãrþire la zero" + +#: eval.c:1267 +#, c-format +msgid "division by zero attempted in `%%'" +msgstr "s-a încercat împãrþire la zero în `%%'" + +#: eval.c:1282 profile.c:713 +#, c-format +msgid "illegal type (%s) in tree_eval" +msgstr "tip ilegal (%s) în tree_eval" + +#: eval.c:1459 +msgid "division by zero attempted in `/='" +msgstr "s-a încercat împãrþire la zero în `/='" + +#: eval.c:1477 +#, c-format +msgid "division by zero attempted in `%%='" +msgstr "s-a încercat împãrþire la zero în `%%='" + +#: eval.c:1738 +#, c-format +msgid "function `%s' called with more arguments than declared" +msgstr "" +"funcþia `%s' a fost apelatã cu mai multe argumente decât cele declarate" + +#: eval.c:1782 +#, c-format +msgid "function `%s' not defined" +msgstr "funcþia `%s' nu este definitã" + +#: eval.c:1788 +#, c-format +msgid "function %s called\n" +msgstr "funcþia %s a fost apelatã\n" + +#: eval.c:1845 +#, c-format +msgid "" +"\n" +"\t# Function Call Stack:\n" +"\n" +msgstr "" +"\n" +"\t# Stiva de Apelare a Funcþiei:\n" +"\n" + +#: eval.c:1848 +#, c-format +msgid "\t# -- main --\n" +msgstr "\t# -- principal(main) --\n" + +#: eval.c:2003 +msgid "attempt to field reference from non-numeric value" +msgstr "încercare de referinþã la câmp din valoare nenumericã" + +#: eval.c:2005 +msgid "attempt to reference from null string" +msgstr "încercare de referinþã din ºir de caractere vid(null)" + +#: eval.c:2011 +#, c-format +msgid "attempt to access field %d" +msgstr "încercare de accesare a câmpului %d" + +#: eval.c:2032 eval.c:2039 profile.c:934 +msgid "assignment is not allowed to result of builtin function" +msgstr "atribuirea nu este permisã rezultatului funcþiei interne" + +#: eval.c:2103 +msgid "`IGNORECASE' is a gawk extension" +msgstr "`IGNORECASE' este extensie gawk" + +#: eval.c:2133 +msgid "`BINMODE' is a gawk extension" +msgstr "`BINMODE' este extensie gawk" + +#: eval.c:2255 +#, c-format +msgid "bad `%sFMT' specification `%s'" +msgstr "`%sFMT' specificaþie `%s' invalidã" + +#: eval.c:2333 +msgid "turning off `--lint' due to assignment to `LINT'" +msgstr "se dezactiveazã `--lint' din cauza atribuirii lui `LINT'" + +#: ext.c:60 ext.c:64 +msgid "`extension' is a gawk extension" +msgstr "`extension' este o extensie gawk" + +#: ext.c:74 +#, c-format +msgid "extension: cannot open `%s' (%s)\n" +msgstr "extension: nu s-a putut deschide `%s' (%s)\n" + +#: ext.c:82 +#, c-format +msgid "extension: library `%s': cannot call function `%s' (%s)\n" +msgstr "extension: biblioteca `%s': nu pot apela funcþia `%s' (%s)\n" + +#: ext.c:102 +msgid "extension: missing function name" +msgstr "" + +#: ext.c:107 +#, fuzzy, c-format +msgid "extension: illegal character `%c' in function name `%s'" +msgstr "extension: biblioteca `%s': nu pot apela funcþia `%s' (%s)\n" + +#: ext.c:113 +#, fuzzy, c-format +msgid "extension: can't redefine function `%s'" +msgstr "extension: nu s-a putut deschide `%s' (%s)\n" + +#: ext.c:117 +#, fuzzy, c-format +msgid "extension: function `%s' already defined" +msgstr "funcþia `%s' nu este definitã" + +#: ext.c:122 +#, c-format +msgid "extension: can't use gawk built-in `%s' as function name" +msgstr "" + +#: ext.c:124 +#, fuzzy, c-format +msgid "extension: function name `%s' previously defined" +msgstr "numele funcþiei `%s' a mai fost definit înainte" + +#: ext.c:201 +#, c-format +msgid "function `%s' defined to take no more than `%d' argument(s)" +msgstr "" + +#: ext.c:204 +#, fuzzy, c-format +msgid "function `%s': missing argument #%d" +msgstr "funcþia `%s' nu este definitã" + +#: ext.c:214 +#, fuzzy, c-format +msgid "function `%s': argument #%d: attempt to use scalar as an array" +msgstr "încercare de a utiliza scalarul `%s' ca array" + +#: ext.c:218 +#, c-format +msgid "function `%s': argument #%d: attempt to use array as a scalar" +msgstr "" + +#: ext.c:243 +msgid "Operation Not Supported" +msgstr "Operaþie NeSuportatã" + +#: field.c:315 +msgid "NF set to negative value" +msgstr "NF setat la valoare negativã" + +#: field.c:808 +msgid "split: second argument is not an array" +msgstr "split: al doilea argument nu este un array" + +#: field.c:842 +msgid "split: null string for third arg is a gawk extension" +msgstr "split: ºirul nul pentru al treilea arg este o extensie gawk" + +#: field.c:894 +msgid "`FIELDWIDTHS' is a gawk extension" +msgstr "`FIELDWIDTHS' este extensie gawk" + +#: field.c:921 +#, c-format +msgid "field %d in FIELDWIDTHS, must be > 0" +msgstr "câmpul %d din FIELDWIDTHS trebuie sã fie > 0" + +#: field.c:994 +msgid "null string for `FS' is a gawk extension" +msgstr "ºirul de caractere null pentru `FS' este extensie gawk" + +#: getopt.c:692 getopt.c:711 +#, c-format +msgid "%s: option `%s' is ambiguous\n" +msgstr "%s: opþiunea `%s' este ambiguã\n" + +#: getopt.c:744 getopt.c:748 +#, c-format +msgid "%s: option `--%s' doesn't allow an argument\n" +msgstr "%s: opþiunea `--%s' nu permite parametri\n" + +#: getopt.c:757 getopt.c:762 +#, c-format +msgid "%s: option `%c%s' doesn't allow an argument\n" +msgstr "%s: opþiunea `%c%s' nu permite parametri\n" + +#: getopt.c:807 getopt.c:829 getopt.c:1159 getopt.c:1181 +#, c-format +msgid "%s: option `%s' requires an argument\n" +msgstr "%s: opþiunea `%s' necesitã un parametru\n" + +#: getopt.c:867 getopt.c:870 +#, c-format +msgid "%s: unrecognized option `--%s'\n" +msgstr "%s: opþiune necunoscutã `--%s'\n" + +#: getopt.c:878 getopt.c:881 +#, c-format +msgid "%s: unrecognized option `%c%s'\n" +msgstr "%s: opþiune necunoscutã `%c%s'\n" + +#: getopt.c:936 getopt.c:939 +#, c-format +msgid "%s: illegal option -- %c\n" +msgstr "%s: opþiune ilegalã -- %c\n" + +#: getopt.c:945 getopt.c:948 +#, c-format +msgid "%s: invalid option -- %c\n" +msgstr "%s: opþiune invalidã -- %c\n" + +#: getopt.c:1003 getopt.c:1022 getopt.c:1234 getopt.c:1255 main.c:433 +#, c-format +msgid "%s: option requires an argument -- %c\n" +msgstr "%s: opþiunea necesitã un parametru -- %c\n" + +#: getopt.c:1074 getopt.c:1093 +#, c-format +msgid "%s: option `-W %s' is ambiguous\n" +msgstr "%s: opþiunea `-W %s' este ambiguã\n" + +#: getopt.c:1117 getopt.c:1138 +#, c-format +msgid "%s: option `-W %s' doesn't allow an argument\n" +msgstr "%s: opþiunea `-W %s' nu permite parametri\n" + +#: io.c:308 +#, c-format +msgid "cannot open file `%s' for reading (%s)" +msgstr "nu s-a putu deschide `%s' pentru citire (%s)" + +#: io.c:395 +#, c-format +msgid "close of fd %d (`%s') failed (%s)" +msgstr "închiderea lui fd %d (`%s') eºuatã (%s)" + +#: io.c:533 +#, c-format +msgid "invalid tree type %s in redirect()" +msgstr "tip arbore(tree) invalid %s în redirect()" + +#: io.c:539 +#, c-format +msgid "expression in `%s' redirection only has numeric value" +msgstr "expresia din redirectarea `%s' are doar valoare numericã" + +#: io.c:545 +#, c-format +msgid "expression for `%s' redirection has null string value" +msgstr "expresia din redirectarea `%s' are valoar de ºir null" + +#: io.c:550 +#, c-format +msgid "filename `%s' for `%s' redirection may be result of logical expression" +msgstr "" +"numele de fiºier `%s' pentru redirectarea `%s' poate fi rezultatul unei " +"expresii logice" + +#: io.c:588 +#, c-format +msgid "unnecessary mixing of `>' and `>>' for file `%.*s'" +msgstr "amestecare nenecesarã a `>' ºi `>>' pentru fiºierul `%.*s'" + +#: io.c:640 +#, c-format +msgid "can't open pipe `%s' for output (%s)" +msgstr "nu se poate deschide legãtura(pipe) `%s' pentru output (%s)" + +#: io.c:649 +#, c-format +msgid "can't open pipe `%s' for input (%s)" +msgstr "nu se poate deschide legãtura(pipe) `%s' pentru input (%s)" + +#: io.c:662 +#, c-format +msgid "can't open two way socket `%s' for input/output (%s)" +msgstr "" +"nu se poate deschide socketul bidirecþional `%s' pentru input/output (%s)" + +#: io.c:666 +#, c-format +msgid "can't open two way pipe `%s' for input/output (%s)" +msgstr "" +"nu se poate deschide legãtura(pipe) bidirecþionalã `%s' pentru input/output " +"(%s)" + +#: io.c:742 +#, c-format +msgid "can't redirect from `%s' (%s)" +msgstr "nu se poate redirecta din `%s' (%s)" + +#: io.c:745 +#, c-format +msgid "can't redirect to `%s' (%s)" +msgstr "nu se poate redirecta cãtre `%s' (%s)" + +#: io.c:784 +msgid "" +"reached system limit for open files: starting to multiplex file descriptors" +msgstr "" +"s-a atins limita sistemului pentru fiºiere deschise: se începe muliplexarea " +"desciptorilor de fiºier" + +#: io.c:800 +#, c-format +msgid "close of `%s' failed (%s)." +msgstr "închiderea `%s' eºuatã (%s)." + +#: io.c:808 +msgid "too many pipes or input files open" +msgstr "prea multe legãturi(pipe) sau fiºiere de intrare(input) deschise" + +#: io.c:831 +msgid "close: second argument must be `to' or `from'" +msgstr "close: al doilea argument trebuie sã fie `to' sau `from'" + +#: io.c:845 +#, c-format +msgid "close: `%.*s' is not an open file, pipe or co-process" +msgstr "" +"close: `%.*s' nu este un fiºier deschis, o legãturã(pipe) sau un coproces" + +#: io.c:849 +msgid "close of redirection that was never opened" +msgstr "închiderea unei redirectãri care n-a fost deschisã niciodatã" + +#: io.c:945 +#, c-format +msgid "close: redirection `%s' not opened with `|&', second argument ignored" +msgstr "" +"close: redirectarea `%s' nu a fost deschisã cu `|&', al doilea argument " +"ignorat" + +#: io.c:960 +#, c-format +msgid "failure status (%d) on pipe close of `%s' (%s)" +msgstr "stare de avarie (%d) în legãtura(pipe) închisã în `%s' (%s)" + +#: io.c:963 +#, c-format +msgid "failure status (%d) on file close of `%s' (%s)" +msgstr "stare de avarie (%d) în fiºierul închis în `%s' (%s)" + +#: io.c:983 +#, c-format +msgid "no explicit close of socket `%s' provided" +msgstr "nu s-a furnizat închiderea explicitã a socketului `%s'" + +#: io.c:986 +#, c-format +msgid "no explicit close of co-process `%s' provided" +msgstr "nu s-a furnizat închiderea explicitã a coprocesului `%s' " + +#: io.c:989 +#, c-format +msgid "no explicit close of pipe `%s' provided" +msgstr "nu s-a furnizat închiderea explicitã a legãturii(pipe) `%s'" + +#: io.c:992 +#, c-format +msgid "no explicit close of file `%s' provided" +msgstr "nu s-a furnizat închiderea explicitã a fiºierului `%s'" + +#: io.c:1021 io.c:1075 +#, c-format +msgid "error writing standard output (%s)" +msgstr "eroare în scrierea la ieºirea(output) standard (%s)" + +#: io.c:1025 io.c:1079 +#, c-format +msgid "error writing standard error (%s)" +msgstr "eroare în scrierea la dispozitivul standard de eroare (%s)" + +#: io.c:1033 +#, c-format +msgid "pipe flush of `%s' failed (%s)." +msgstr "flush-ul legãturii(pipe) `%s' eºuat (%s)." + +#: io.c:1036 +#, c-format +msgid "co-process flush of pipe to `%s' failed (%s)." +msgstr "flush-ul legãturii(pipe) coprocesului la `%s' eºuat (%s)." + +#: io.c:1039 +#, c-format +msgid "file flush of `%s' failed (%s)." +msgstr "flush-ul de fiºier al `%s' eºuat (%s)." + +#: io.c:1198 +msgid "/inet/raw client not ready yet, sorry" +msgstr "clientul /inet/raw nu este pregãtit încã, scuze" + +#: io.c:1200 io.c:1237 +msgid "only root may use `/inet/raw'." +msgstr "doar root-ul poate folosi `/inet/raw'." + +#: io.c:1235 +msgid "/inet/raw server not ready yet, sorry" +msgstr "serverul /inet/raw nu este pregãtit încã, scuze" + +#: io.c:1325 +#, c-format +msgid "no (known) protocol supplied in special filename `%s'" +msgstr "nici un protocol (cunoscut) furnizat în numele de fiºier special `%s'" + +#: io.c:1343 +#, c-format +msgid "special file name `%s' is incomplete" +msgstr "numele special de fiºier `%s' nu este complet" + +#: io.c:1355 +#, c-format +msgid "local port invalid in `%s'" +msgstr "port local invalid în `%s'" + +#: io.c:1367 +msgid "must supply a remote hostname to `/inet'" +msgstr "trebuie furnizat un nume de host remote pentru `/inet'" + +#: io.c:1382 +msgid "must supply a remote port to `/inet'" +msgstr "trebuie furnizat un port remote pentru `/inet'" + +#: io.c:1388 +#, c-format +msgid "remote port invalid in `%s'" +msgstr "port remote invalid în `%s'" + +#: io.c:1398 +msgid "TCP/IP communications are not supported" +msgstr "Comunicaþiile TCP/IP nu sunt suportate" + +#: io.c:1407 io.c:1588 +#, c-format +msgid "file `%s' is a directory" +msgstr "fiºierul `%s' este director" + +#: io.c:1477 +#, c-format +msgid "use `PROCINFO[\"%s\"]' instead of `%s'" +msgstr "folosiþi `PROCINFO[\"%s\"]' în loc de `%s'" + +#: io.c:1509 +msgid "use `PROCINFO[...]' instead of `/dev/user'" +msgstr "folosiþi `PROCINFO[...]' în loc de `/dev/user'" + +#: io.c:1574 io.c:1748 +#, c-format +msgid "could not open `%s', mode `%s'" +msgstr "nu s-a putut deschide `%s', modul `%s'" + +#: io.c:1799 +#, fuzzy, c-format +msgid "close of master pty failed (%s)" +msgstr "închiderea legãturii(pipe) a eºuat (%s)" + +#: io.c:1801 io.c:1953 io.c:2105 +#, c-format +msgid "close of stdout in child failed (%s)" +msgstr "închiderea stdout în copil(child) a eºuat (%s)" + +#: io.c:1804 +#, fuzzy, c-format +msgid "moving slave pty to stdout in child failed (dup: %s)" +msgstr "mutarea legãturii(pipe) la stdout în copil(child) a eºuat (dup: %s)" + +#: io.c:1806 io.c:1958 +#, c-format +msgid "close of stdin in child failed (%s)" +msgstr "închiderea stdin în copil(child) a eºuat (%s)" + +#: io.c:1809 +#, fuzzy, c-format +msgid "moving slave pty to stdin in child failed (dup: %s)" +msgstr "mutarea legãturii(pipe) la stdin în copil(child) a eºuat (dup: %s)" + +#: io.c:1811 io.c:1830 +#, fuzzy, c-format +msgid "close of slave pty failed (%s)" +msgstr "închiderea legãturii(pipe) a eºuat (%s)" + +#: io.c:1904 io.c:1956 io.c:2086 io.c:2108 +#, c-format +msgid "moving pipe to stdout in child failed (dup: %s)" +msgstr "mutarea legãturii(pipe) la stdout în copil(child) a eºuat (dup: %s)" + +#: io.c:1908 io.c:1961 +#, c-format +msgid "moving pipe to stdin in child failed (dup: %s)" +msgstr "mutarea legãturii(pipe) la stdin în copil(child) a eºuat (dup: %s)" + +#: io.c:1925 io.c:2099 +msgid "restoring stdout in parent process failed\n" +msgstr "refacerea stdout în procesul pãrinte a eºuat\n" + +#: io.c:1930 +msgid "restoring stdin in parent process failed\n" +msgstr "refacerea stdin în procesul pãrinte a eºuat\n" + +#: io.c:1964 io.c:2110 io.c:2121 +#, c-format +msgid "close of pipe failed (%s)" +msgstr "închiderea legãturii(pipe) a eºuat (%s)" + +#: io.c:2009 +msgid "`|&' not supported" +msgstr "`|&' nesuportat" + +#: io.c:2076 +#, c-format +msgid "cannot open pipe `%s' (%s)" +msgstr "nu s-a putut deschide legãtura(pipe) `%s' (%s)" + +#: io.c:2117 +#, c-format +msgid "cannot create child process for `%s' (fork: %s)" +msgstr "nu s-a putu crea proces copil(child) pentru `%s' (fork: %s)" + +#: io.c:2460 +#, c-format +msgid "data file `%s' is empty" +msgstr "fiºierul de date `%s' este vid" + +#: io.c:2503 io.c:2511 +msgid "could not allocate more input memory" +msgstr "" + +#: io.c:2869 io.c:2932 +#, c-format +msgid "error reading input file `%s': %s" +msgstr "eroare în citirea fiºierului de intrare(input) `%s': %s" + +#: io.c:3057 +msgid "multicharacter value of `RS' is a gawk extension" +msgstr "valoarea multicaracter a `RS' este extensie gawk" + +#: main.c:323 +msgid "`-m[fr]' option irrelevant in gawk" +msgstr "`-m[fr]' opþiune irelevantã în gawk" + +#: main.c:325 +msgid "-m option usage: `-m[fr] nnn'" +msgstr "folosirea opþiunii -m : `-m[fr] nnn'" + +#: main.c:342 +#, c-format +msgid "%s: option `-W %s' unrecognized, ignored\n" +msgstr "%s: opþiunea `-W %s' nu e recunoscutã, ignoratã\n" + +#: main.c:379 +msgid "empty argument to `--source' ignored" +msgstr "argument vid pentru `--source' ignorat" + +#: main.c:450 +msgid "environment variable `POSIXLY_CORRECT' set: turning on `--posix'" +msgstr "" +"este setatã variabila de mediu `POSIXLY_CORRECT': se activeazã `--posix'" + +#: main.c:455 +msgid "`--posix' overrides `--traditional'" +msgstr "`--posix' suprascrie `--traditional'" + +#: main.c:466 +msgid "`--posix'/`--traditional' overrides `--non-decimal-data'" +msgstr "`--posix'/`--traditional' suprascrie `--non-decimal-data'" + +#: main.c:470 +#, fuzzy, c-format +msgid "running %s setuid root may be a security problem" +msgstr "dacã se ruleazã %s setuid root poate apãrea o problemã de securitate" + +#: main.c:511 +#, fuzzy, c-format +msgid "can't set binary mode on stdin (%s)" +msgstr "nu se poate seta modul pe stdin (%s)" + +#: main.c:514 +#, fuzzy, c-format +msgid "can't set binary mode on stdout (%s)" +msgstr "nu se poate seta modul pe stdout (%s)" + +#: main.c:516 +#, fuzzy, c-format +msgid "can't set binary mode on stderr (%s)" +msgstr "nu se poate seta modul pe stderr (%s)" + +#: main.c:546 +msgid "no program text at all!" +msgstr "nu existã nici un text de program!" + +#: main.c:623 +#, c-format +msgid "Usage: %s [POSIX or GNU style options] -f progfile [--] file ...\n" +msgstr "" +"Folosire: %s [opþiuni stil POSIX sau GNU] -f fiºierprogram [--] fiºier ...\n" + +#: main.c:625 +#, c-format +msgid "Usage: %s [POSIX or GNU style options] [--] %cprogram%c file ...\n" +msgstr "" +"Folosire: %s [opþiuni stil POSIX sau GNU] [--] %cprogram%c fiºier ...\n" + +#: main.c:630 +msgid "POSIX options:\t\tGNU long options:\n" +msgstr "opþiuni POSIX:\t\topþiuni lungi GNU:\n" + +#: main.c:631 +msgid "\t-f progfile\t\t--file=progfile\n" +msgstr "\t-f fiºierprogram\t\t--file=fiºierprogram\n" + +#: main.c:632 +msgid "\t-F fs\t\t\t--field-separator=fs\n" +msgstr "\t-F fs\t\t\t--field-separator=fs\n" + +#: main.c:633 +msgid "\t-v var=val\t\t--assign=var=val\n" +msgstr "\t-v var=val\t\t--assign=var=val\n" + +#: main.c:634 +msgid "\t-m[fr] val\n" +msgstr "\t-m[fr] val\n" + +#: main.c:635 +msgid "\t-W compat\t\t--compat\n" +msgstr "\t-W compat\t\t--compat\n" + +#: main.c:636 +msgid "\t-W copyleft\t\t--copyleft\n" +msgstr "\t-W copyleft\t\t--copyleft\n" + +#: main.c:637 +msgid "\t-W copyright\t\t--copyright\n" +msgstr "\t-W copyright\t\t--copyright\n" + +#: main.c:638 +msgid "\t-W dump-variables[=file]\t--dump-variables[=file]\n" +msgstr "\t-W dump-variables[=fiºier]\t--dump-variables[=fiºier]\n" + +#: main.c:639 +msgid "\t-W gen-po\t\t--gen-po\n" +msgstr "\t-W gen-po\t\t--gen-po\n" + +#: main.c:640 +msgid "\t-W help\t\t\t--help\n" +msgstr "\t-W help\t\t\t--help\n" + +#: main.c:641 +msgid "\t-W lint[=fatal]\t\t--lint[=fatal]\n" +msgstr "\t-W lint[=fatal]\t\t--lint[=fatal]\n" + +#: main.c:642 +msgid "\t-W lint-old\t\t--lint-old\n" +msgstr "\t-W lint-old\t\t--lint-old\n" + +#: main.c:643 +msgid "\t-W non-decimal-data\t--non-decimal-data\n" +msgstr "\t-W non-decimal-data\t--non-decimal-data\n" + +#: main.c:645 +msgid "\t-W nostalgia\t\t--nostalgia\n" +msgstr "\t-W nostalgia\t\t--nostalgia\n" + +#: main.c:648 +msgid "\t-W parsedebug\t\t--parsedebug\n" +msgstr "\t-W parsedebug\t\t--parsedebug\n" + +#: main.c:650 +msgid "\t-W profile[=file]\t--profile[=file]\n" +msgstr "\t-W profile[=fiºier]\t--profile[=fiºier]\n" + +#: main.c:651 +msgid "\t-W posix\t\t--posix\n" +msgstr "\t-W posix\t\t--posix\n" + +#: main.c:652 +msgid "\t-W re-interval\t\t--re-interval\n" +msgstr "\t-W re-interval\t\t--re-interval\n" + +#: main.c:653 +msgid "\t-W source=program-text\t--source=program-text\n" +msgstr "\t-W source=program-text\t--source=program-text\n" + +#: main.c:654 +msgid "\t-W traditional\t\t--traditional\n" +msgstr "\t-W traditional\t\t--traditional\n" + +#: main.c:655 +msgid "\t-W usage\t\t--usage\n" +msgstr "\t-W usage\t\t--usage\n" + +#: main.c:656 +msgid "\t-W version\t\t--version\n" +msgstr "\t-W version\t\t--version\n" + +#: main.c:660 +#, fuzzy +msgid "" +"\n" +"To report bugs, see node `Bugs' in `gawk.info', which is\n" +"section `Reporting Problems and Bugs' in the printed version.\n" +"\n" +msgstr "secþiunea `Reporting Problems and Bugs' în versiunea tipãritã.\n" + +#: main.c:664 +msgid "" +"gawk is a pattern scanning and processing language.\n" +"By default it reads standard input and writes standard output.\n" +"\n" +msgstr "" + +#: main.c:668 +msgid "" +"Examples:\n" +"\tgawk '{ sum += $1 }; END { print sum }' file\n" +"\tgawk -F: '{ print $1 }' /etc/passwd\n" +msgstr "" + +#: main.c:685 +#, c-format +msgid "" +"Copyright (C) 1989, 1991-%d Free Software Foundation.\n" +"\n" +"This program is free software; you can redistribute it and/or modify\n" +"it under the terms of the GNU General Public License as published by\n" +"the Free Software Foundation; either version 2 of the License, or\n" +"(at your option) any later version.\n" +"\n" +msgstr "" +"Copyright (C) 1989, 1991-%d Free Software Foundation.\n" +"\n" +"Acest program este software liber; poate fi redistribuit ºi/sau modificat\n" +"sub termenii Licenþei Publice Generale GNU publicatã de \n" +"Free Software Foundation; fie versiunea 2 a Licenþei, fie\n" +"(la latitudinea dumneavoastrã) orice versiune ulterioarã.\n" +"\n" + +#: main.c:693 +msgid "" +"This program is distributed in the hope that it will be useful,\n" +"but WITHOUT ANY WARRANTY; without even the implied warranty of\n" +"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" +"GNU General Public License for more details.\n" +"\n" +msgstr "" +"Acest program este distribuit în speranþa cã va fi folositor,\n" +"dar FÃRà NICI O GARANÞIE; chiar fãrã presupusa garanþie a\n" +"VANDABILITÃÞII sau MODIFICÃRII ÎNTR-UN SCOP PRIVAT. Cititi\n" +"Licenþa Publicã Generalã GNU pentru mai multe detalii.\n" +"\n" +"\n" + +#: main.c:699 +msgid "" +"You should have received a copy of the GNU General Public License\n" +"along with this program; if not, write to the Free Software\n" +"Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n" +msgstr "" +"Ar fi trebuit sã primiþi o copie a Licenþei Publice Generale GNU\n" +"împreunã cu acest program; dacã nu, scrieþi la Free Software\n" +"Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n" + +#: main.c:733 +msgid "-Ft does not set FS to tab in POSIX awk" +msgstr "-Ft nu seteazã FS în tab în POSIX awk" + +#: main.c:962 +#, c-format +msgid "" +"%s: `%s' argument to `-v' not in `var=value' form\n" +"\n" +msgstr "" + +#: main.c:982 +#, c-format +msgid "`%s' is not a legal variable name" +msgstr "" + +#: main.c:985 +#, c-format +msgid "`%s' is not a variable name, looking for file `%s=%s'" +msgstr "" + +#: main.c:1018 +msgid "floating point exception" +msgstr "excepþie virgulã mobilã" + +#: main.c:1025 +msgid "fatal error: internal error" +msgstr "eroare fatalã: eroare internã" + +#: main.c:1075 +#, c-format +msgid "no pre-opened fd %d" +msgstr "nici un fd predeschis %d" + +#: main.c:1082 +#, c-format +msgid "could not pre-open /dev/null for fd %d" +msgstr "nu s-a putut predeschide /dev/null pentru fd %d" + +#: main.c:1105 main.c:1114 +#, c-format +msgid "could not find groups: %s" +msgstr "nu am putut gãsi grupurile: %s" + +#: msg.c:54 +#, c-format +msgid "cmd. line:" +msgstr "linie cmd:" + +#: msg.c:120 +msgid "warning: " +msgstr "avertisment: " + +#: msg.c:142 +msgid "error: " +msgstr "eroare: " + +#: msg.c:178 +msgid "fatal: " +msgstr "fatal: " + +#: node.c:58 node.c:65 node.c:74 node.c:88 node.c:115 +msgid "can't convert string to float" +msgstr "nu se poate converti ºir de caractere în float" + +#: node.c:357 +msgid "backslash at end of string" +msgstr "backslash la sfârºitul ºirului de caractere" + +#: node.c:541 +msgid "POSIX does not allow `\\x' escapes" +msgstr "POSIX nu permite escape-uri `\\x'" + +#: node.c:547 +msgid "no hex digits in `\\x' escape sequence" +msgstr "nu existã digiþi hexa în secvenþa de escape `\\x'" + +#: node.c:581 +#, c-format +msgid "escape sequence `\\%c' treated as plain `%c'" +msgstr "secvenþa de escape `\\%c' tratatã ca `%c' simplu" + +#: posix/gawkmisc.c:172 +#, c-format +msgid "%s %s `%s': could not set close-on-exec: (fcntl: %s)" +msgstr "%s %s `%s': nu s-a putut seta close-on-exec: (fcntl: %s)" + +#: profile.c:91 +#, c-format +msgid "could not open `%s' for writing: %s" +msgstr "nu am putut deschide `%s' pentru scriere: %s" + +#: profile.c:467 +#, fuzzy, c-format +msgid "internal error: %s with null vname" +msgstr "eroare internã: Node_var cu vname null" + +#: profile.c:530 +msgid "# treated internally as `delete'" +msgstr "" + +#: profile.c:1167 +#, c-format +msgid "# this is a dynamically loaded extension function" +msgstr "" + +#: profile.c:1198 +#, c-format +msgid "\t# gawk profile, created %s\n" +msgstr "\t# profil gawk, creat %s\n" + +#: profile.c:1201 +#, c-format +msgid "" +"\t# BEGIN block(s)\n" +"\n" +msgstr "" +"\t# bloc(uri) BEGIN\n" +"\n" + +#: profile.c:1211 +#, c-format +msgid "" +"\t# Rule(s)\n" +"\n" +msgstr "" +"\t# Regulã(i)\n" +"\n" + +#: profile.c:1217 +#, c-format +msgid "" +"\t# END block(s)\n" +"\n" +msgstr "" +"\t# bloc(uri) END\n" +"\n" + +#: profile.c:1237 +#, c-format +msgid "" +"\n" +"\t# Functions, listed alphabetically\n" +msgstr "" +"\n" +"\t# Funcþii, listate alfabetic\n" + +#: profile.c:1452 +#, c-format +msgid "unexpected type %s in prec_level" +msgstr "tip %s neaºteptat în prec_level" + +#: regcomp.c:150 +msgid "Success" +msgstr "Succes" + +#: regcomp.c:153 +msgid "No match" +msgstr "Nici o potrivire" + +#: regcomp.c:156 +msgid "Invalid regular expression" +msgstr "Expresie regularã invalidã" + +#: regcomp.c:159 +msgid "Invalid collation character" +msgstr "Caracter de comparare invalid" + +#: regcomp.c:162 +msgid "Invalid character class name" +msgstr "nume clasã caracter invalid" + +#: regcomp.c:165 +msgid "Trailing backslash" +msgstr "Backslash final" + +#: regcomp.c:168 +msgid "Invalid back reference" +msgstr "referinþã anterioarã(back) invalidã" + +#: regcomp.c:171 +msgid "Unmatched [ or [^" +msgstr "[ sau [^ fãrã reciprocã" + +#: regcomp.c:174 +msgid "Unmatched ( or \\(" +msgstr "( sau \\( fãrã reciprocã" + +#: regcomp.c:177 +msgid "Unmatched \\{" +msgstr "{ fãrã reciprocã" + +#: regcomp.c:180 +msgid "Invalid content of \\{\\}" +msgstr "Conþinut invalid al \\{\\}" + +#: regcomp.c:183 +msgid "Invalid range end" +msgstr "Sfârºit de domeniu invalid" + +#: regcomp.c:186 +msgid "Memory exhausted" +msgstr "Memorie plinã" + +#: regcomp.c:189 +msgid "Invalid preceding regular expression" +msgstr "Expresie regularã anterioarã invalidã" + +#: regcomp.c:192 +msgid "Premature end of regular expression" +msgstr "Sfârºit prematur de expresie regularã" + +#: regcomp.c:195 +msgid "Regular expression too big" +msgstr "Expresie regularã prea mare" + +#: regcomp.c:198 +msgid "Unmatched ) or \\)" +msgstr ") or \\) fãrã reciprocã" + +#: regcomp.c:668 +msgid "No previous regular expression" +msgstr "Nu existã expresii regulare anterioare" + +#, fuzzy +#~ msgid "or used as a variable or an array" +#~ msgstr "nu se poate folosi numele funcþiei `%s' ca variabilã sau array" + +#~ msgid "delete: illegal use of variable `%s' as array" +#~ msgstr "delete: folosire ilegalã a variabilei `%s' ca array" + +#~ msgid "asort: first argument is not an array" +#~ msgstr "asort: primul argument nu este un array" + +#~ msgid "asort: second argument is not an array" +#~ msgstr "asort: al doilea argument nu este un array" + +#~ msgid "" +#~ "\n" +#~ "To report bugs, see node `Bugs' in `gawk.info', which is\n" +#~ msgstr "" +#~ "\n" +#~ "Pentru a raporta bug-urile, citiþi nodul `Bugs' în `gawk.info', " +#~ "reprezentând\n" + +#~ msgid "invalid syntax in name `%s' for variable assignment" +#~ msgstr "sintaxã invalidã în numele `%s' pentru atribuire de variabilã" + +#~ msgid "internal error: Node_var_array with null vname" +#~ msgstr "eroare internã: Node_var_array cu vname null" + +#~ msgid "or used in other expression context" +#~ msgstr "sau folositã în alt context al expresiei" + +#~ msgid "`%s' is a function, assignment is not allowed" +#~ msgstr "`%s' este o funcþie, atribuirea nu este permisã" + +#~ msgid "BEGIN blocks must have an action part" +#~ msgstr "Blocurile de BEGIN trebuie sa aibã un fragment de acþiune" + +#~ msgid "`nextfile' used in BEGIN or END action" +#~ msgstr "`nextfile' folosit în acþiune BEGIN sau END" + +#~ msgid "non-redirected `getline' undefined inside BEGIN or END action" +#~ msgstr "" +#~ "`getline' nedefinit ºi neredirectat înãuntrul unei acþiuni BEGIN sau END" + +#~ msgid "fptr %x not in tokentab\n" +#~ msgstr "fptr %x nu este în tokentab\n" + +#~ msgid "gsub third parameter is not a changeable object" +#~ msgstr "al treilea parametru al gsub nu este obiect modificabil" + +#~ msgid "Unfinished \\ escape" +#~ msgstr "\\ escape neterminat" + +#~ msgid "unfinished repeat count" +#~ msgstr "numãrãtoare repetatã neterminatã" + +#~ msgid "malformed repeat count" +#~ msgstr "numãrãtoare repetatã malformatã" + +#~ msgid "Unbalanced [" +#~ msgstr "[ fãrã reciproc" + +#~ msgid "Unbalanced (" +#~ msgstr "( fãrã reciproc" + +#~ msgid "No regexp syntax bits specified" +#~ msgstr "Nu s-au specificat biþi pentru sintaxa regexp" + +#~ msgid "Unbalanced )" +#~ msgstr ") fãrã reciproc" + +#~ msgid "out of memory" +#~ msgstr "memorie plinã" + +#~ msgid "internal error: file `%s', line %d\n" +#~ msgstr "eroare internã: fiºierul `%s', linia %d\n" diff --git a/po/sv.gmo b/po/sv.gmo index 73d6c090e..b5c5c1e9e 100644 Binary files a/po/sv.gmo and b/po/sv.gmo differ diff --git a/po/sv.po b/po/sv.po index 81a44cdcd..666080721 100644 --- a/po/sv.po +++ b/po/sv.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: gawk 3.1.1m\n" "Report-Msgid-Bugs-To: arnold@skeeve.com\n" -"POT-Creation-Date: 2003-07-07 11:20-0700\n" +"POT-Creation-Date: 2004-07-15 13:02+0300\n" "PO-Revision-Date: 2003-02-27 19:54+0100\n" "Last-Translator: Martin Sjögren \n" "Language-Team: Swedish \n" @@ -17,56 +17,61 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" #: array.c:112 +#, fuzzy, c-format +msgid "attempt to use function `%s' as an array" +msgstr "försök att använda funktionen \"%s\" som vektor" + +#: array.c:115 #, c-format msgid "attempt to use scalar parameter `%s' as an array" msgstr "försök att använda skalärparametern \"%s\" som en vektor" -#: array.c:113 +#: array.c:118 #, c-format msgid "attempt to use scalar `%s' as array" msgstr "försök att använda skalären \"%s\" som vektor" -#: array.c:151 +#: array.c:156 #, fuzzy, c-format msgid "from %s" msgstr "%s (från %s)" -#: array.c:506 +#: array.c:511 #, c-format msgid "reference to uninitialized element `%s[\"%s\"]'" msgstr "referens till ickeinitierat element \"%s[\"%s\"]\"" -#: array.c:512 +#: array.c:517 #, c-format msgid "subscript of array `%s' is null string" msgstr "index i vektorn \"%s\" är en tom sträng" -#: array.c:609 +#: array.c:621 #, c-format msgid "delete: index `%s' not in array `%s'" msgstr "delete: index \"%s\" finns inte i vektorn \"%s\"" -#: array.c:769 +#: array.c:791 #, c-format msgid "%s: empty (null)\n" msgstr "%s: tom (null)\n" -#: array.c:774 +#: array.c:796 #, c-format msgid "%s: empty (zero)\n" msgstr "%s: tom (noll)\n" -#: array.c:778 +#: array.c:800 #, c-format msgid "%s: table_size = %d, array_size = %d\n" msgstr "%s: tabellstorlek = %d, vektorstorlek = %d\n" -#: array.c:807 +#: array.c:829 #, c-format msgid "%s: is parameter\n" msgstr "%s: är en parameter\n" -#: array.c:812 +#: array.c:834 #, c-format msgid "%s: array_ref to %s\n" msgstr "%s: vektorreferens till %s\n" @@ -90,478 +95,474 @@ msgstr "\"%s\" msgid "regexp constant `/%s/' looks like a C comment, but is not" msgstr "regexp-konstanten \"/%s/\" ser ut som en C-kommentar men är inte det" -#: awkgram.y:340 awkgram.y:615 +#: awkgram.y:341 awkgram.y:619 msgid "statement may have no effect" msgstr "kommandot kanske inte har någon effekt" -#: awkgram.y:435 awkgram.y:455 +#: awkgram.y:436 awkgram.y:456 #, c-format msgid "`%s' used in %s action" msgstr "\"%s\" använd i %s-åtgärden" -#: awkgram.y:448 awkgram.y:451 +#: awkgram.y:449 awkgram.y:452 msgid "`nextfile' is a gawk extension" msgstr "\"nextfile\" är en gawk-utökning" -#: awkgram.y:465 +#: awkgram.y:466 msgid "`return' used outside function context" msgstr "\"return\" använd utanför funktion" -#: awkgram.y:504 +#: awkgram.y:508 msgid "plain `print' in BEGIN or END rule should probably be `print \"\"'" msgstr "" "ensamt \"print\" i BEGIN eller END-regel bör troligen vara 'print \"\"'" -#: awkgram.y:517 awkgram.y:524 +#: awkgram.y:521 awkgram.y:528 msgid "`delete array' is a gawk extension" msgstr "\"delete array\" är en gawk-utökning" -#: awkgram.y:532 awkgram.y:539 +#: awkgram.y:536 awkgram.y:543 msgid "`delete(array)' is a non-portable tawk extension" msgstr "\"delete(array)\" är en icke portabel tawk-utökning" -#: awkgram.y:583 +#: awkgram.y:587 #, c-format msgid "duplicate case values in switch body: %s" msgstr "" -#: awkgram.y:593 +#: awkgram.y:597 msgid "Duplicate `default' detected in switch body" msgstr "" -#: awkgram.y:681 +#: awkgram.y:686 msgid "multistage two-way pipelines don't work" msgstr "flerstegs dubbelriktade rör fungerar inte" -#: awkgram.y:772 +#: awkgram.y:777 msgid "regular expression on right of assignment" msgstr "reguljärt uttryck i högerledet av en tilldelning" -#: awkgram.y:782 +#: awkgram.y:800 msgid "regular expression on left of `~' or `!~' operator" msgstr "reguljärt uttryck på vänster sida om en \"~\"- eller \"!~\"-operator" -#: awkgram.y:790 +#: awkgram.y:808 msgid "regular expression on right of comparison" msgstr "reguljärt uttryck i högerledet av en jämförelse" -#: awkgram.y:857 +#: awkgram.y:875 msgid "non-redirected `getline' undefined inside END action" msgstr "icke omdirigerad \"getline\" odefinierad inuti END-åtgärd" -#: awkgram.y:884 +#: awkgram.y:902 msgid "call of `length' without parentheses is not portable" msgstr "anrop av \"length\" utan parenteser är inte portabelt" -#: awkgram.y:887 +#: awkgram.y:905 msgid "call of `length' without parentheses is deprecated by POSIX" msgstr "anrop av \"length\" utan parenteser är föråldrat enligt POSIX" -#: awkgram.y:940 +#: awkgram.y:958 msgid "use of non-array as array" msgstr "" -#: awkgram.y:942 +#: awkgram.y:960 msgid "invalid subscript expression" msgstr "ogiltig indexuttryck" -#: awkgram.y:1140 +#: awkgram.y:1158 msgid "unexpected newline or end of string" msgstr "oväntat nyradstecken eller slut på strängen" -#: awkgram.y:1235 +#: awkgram.y:1254 msgid "empty program text on command line" msgstr "tom programtext på kommandoraden" -#: awkgram.y:1292 +#: awkgram.y:1307 #, c-format msgid "can't open source file `%s' for reading (%s)" msgstr "kan inte öppna källfilen \"%s\" för läsning (%s)" -#: awkgram.y:1327 +#: awkgram.y:1384 #, c-format msgid "can't read sourcefile `%s' (%s)" msgstr "kan inte läsa källfilen \"%s\" (%s)" -#: awkgram.y:1335 +#: awkgram.y:1392 #, c-format msgid "source file `%s' is empty" msgstr "källfilen \"%s\" är tom" -#: awkgram.y:1537 awkgram.y:1647 awkgram.y:1665 awkgram.y:2015 awkgram.y:2100 +#: awkgram.y:1590 awkgram.y:1700 awkgram.y:1718 awkgram.y:2068 awkgram.y:2153 msgid "source file does not end in newline" msgstr "källfilen slutar inte med en ny rad" -#: awkgram.y:1601 +#: awkgram.y:1654 msgid "unterminated regexp ends with `\\' at end of file" msgstr "oavslutat reguljärt uttryck slutar med \"\\\" i slutet av filen" -#: awkgram.y:1621 +#: awkgram.y:1674 msgid "unterminated regexp" msgstr "oavslutat reguljärt uttryck" -#: awkgram.y:1624 +#: awkgram.y:1677 msgid "unterminated regexp at end of file" msgstr "oavslutat reguljärt uttryck i slutet av filen" -#: awkgram.y:1691 +#: awkgram.y:1744 msgid "use of `\\ #...' line continuation is not portable" msgstr "Användning av \"\\ #...\" för radfortsättning är inte portabelt" -#: awkgram.y:1703 +#: awkgram.y:1756 msgid "backslash not last character on line" msgstr "sista tecknet på raden är inte ett omvänt snedstreck" -#: awkgram.y:1748 +#: awkgram.y:1801 msgid "POSIX does not allow operator `**='" msgstr "POSIX tillåter inte operatorn \"**=\"" -#: awkgram.y:1750 +#: awkgram.y:1803 msgid "old awk does not support operator `**='" msgstr "gamla awk stöder inte operatorn \"**=\"" -#: awkgram.y:1759 +#: awkgram.y:1812 msgid "POSIX does not allow operator `**'" msgstr "POSIX tillåter inte operatorn \"**\"" -#: awkgram.y:1761 +#: awkgram.y:1814 msgid "old awk does not support operator `**'" msgstr "gamla awk stöder inte operatorn \"**\"" -#: awkgram.y:1792 +#: awkgram.y:1845 msgid "operator `^=' is not supported in old awk" msgstr "operatorn \"^=\" stöds inte i gamla awk" -#: awkgram.y:1800 +#: awkgram.y:1853 msgid "operator `^' is not supported in old awk" msgstr "operatorn \"^\" stöds inte i gamla awk" -#: awkgram.y:1884 awkgram.y:1901 +#: awkgram.y:1937 awkgram.y:1954 msgid "unterminated string" msgstr "oavslutad sträng" -#: awkgram.y:2061 +#: awkgram.y:2114 #, c-format msgid "invalid char '%c' in expression" msgstr "ogiltigt tecken \"%c\" i uttryck" -#: awkgram.y:2121 +#: awkgram.y:2162 #, c-format msgid "`%s' is a gawk extension" msgstr "\"%s\" är en gawk-utökning" -#: awkgram.y:2124 +#: awkgram.y:2165 #, c-format msgid "`%s' is a Bell Labs extension" msgstr "\"%s\" är en Bell Labs-utökning" -#: awkgram.y:2127 +#: awkgram.y:2168 #, c-format msgid "POSIX does not allow `%s'" msgstr "POSIX tillåter inte \"%s\"" -#: awkgram.y:2131 +#: awkgram.y:2172 #, c-format msgid "`%s' is not supported in old awk" msgstr "\"%s\" stöds inte i gamla awk" -#: awkgram.y:2158 +#: awkgram.y:2198 msgid "`goto' considered harmful!\n" msgstr "\"goto\" anses skadlig!\n" -#: awkgram.y:2220 +#: awkgram.y:2260 #, c-format msgid "%d is invalid as number of arguments for %s" msgstr "%d är ett ogiltigt antal argument för %s" -#: awkgram.y:2239 awkgram.y:2242 +#: awkgram.y:2279 awkgram.y:2282 msgid "match: third argument is a gawk extension" msgstr "match: tredje argumentet är en gawk-utökning" -#: awkgram.y:2255 +#: awkgram.y:2295 #, c-format msgid "%s: string literal as last arg of substitute has no effect" msgstr "" "%s: bokstavlig sträng som sista argument till ersättning har ingen effekt" -#: awkgram.y:2258 +#: awkgram.y:2298 #, c-format msgid "%s third parameter is not a changeable object" msgstr "%s: tredje argumentet är inte ett ändringsbart objekt" -#: awkgram.y:2285 awkgram.y:2288 +#: awkgram.y:2325 awkgram.y:2328 msgid "close: second argument is a gawk extension" msgstr "close: andra argumentet är en gawk-utökning" -#: awkgram.y:2298 +#: awkgram.y:2338 msgid "use of dcgettext(_\"...\") is incorrect: remove leading underscore" msgstr "" "användandet av dcgettext(_\"...\") är felaktigt: ta bort det inledande " "understrykningstecknet" -#: awkgram.y:2313 +#: awkgram.y:2353 msgid "use of dcngettext(_\"...\") is incorrect: remove leading underscore" msgstr "" "användandet av dcngettext(_\"...\") är felaktigt: ta bort det inledande " "understrykningstecknet" -#: awkgram.y:2384 +#: awkgram.y:2424 #, c-format msgid "function `%s': parameter #%d, `%s', duplicates parameter #%d" msgstr "funktionen \"%s\": parameter %d, \"%s\", är samma som parameter %d" -#: awkgram.y:2417 +#: awkgram.y:2457 #, c-format msgid "function `%s': parameter `%s' shadows global variable" msgstr "funktionen \"%s\": parametern \"%s\" överskuggar en global variabel" -#: awkgram.y:2529 +#: awkgram.y:2569 #, c-format msgid "could not open `%s' for writing (%s)" msgstr "kunde inte öpnna \"%s\" för skrivning (%s)" -#: awkgram.y:2530 profile.c:93 +#: awkgram.y:2570 profile.c:93 msgid "sending profile to standard error" msgstr "skickar profilen till standard fel" -#: awkgram.y:2562 +#: awkgram.y:2602 #, c-format msgid "%s: close failed (%s)" msgstr "%s: misslyckades att stänga (%s)" -#: awkgram.y:2684 +#: awkgram.y:2723 msgid "shadow_funcs() called twice!" msgstr "shadow_funcs() anropad två gånger!" -#: awkgram.y:2711 +#: awkgram.y:2750 msgid "there were shadowed variables." msgstr "det fanns överskuggade variabler." -#: awkgram.y:2784 +#: awkgram.y:2823 #, c-format msgid "function `%s': can't use function name as parameter name" msgstr "funktionen \"%s\": kan inte använda funktionsnamn som parameternamn" -#: awkgram.y:2794 +#: awkgram.y:2833 #, c-format msgid "function name `%s' previously defined" msgstr "funktionsnamnet \"%s\" är definierat sedan tidigare" -#: awkgram.y:2945 awkgram.y:2951 +#: awkgram.y:2984 awkgram.y:2990 #, c-format msgid "function `%s' called but never defined" msgstr "funktionen \"%s\" anropad men aldrig definierad" -#: awkgram.y:2954 +#: awkgram.y:2993 #, c-format msgid "function `%s' defined but never called" msgstr "funktionen \"%s\" definierad men aldrig anropad" -#: awkgram.y:2981 +#: awkgram.y:3020 #, c-format msgid "regexp constant for parameter #%d yields boolean value" msgstr "konstant reguljärt uttryck för parameter %d ger ett booleskt värde" -#: awkgram.y:2994 -#, c-format +#: awkgram.y:3033 +#, fuzzy, c-format msgid "" "function `%s' called with space between name and `(',\n" -"%s" +"or used as a variable or an array" msgstr "" "funktionen \"%s\" anropad med blanktecken mellan namnet och \"(\",\n" "%s" -#: awkgram.y:2996 -msgid "or used as a variable or an array" -msgstr "eller använd som variabel eller vektor" - -#: builtin.c:137 +#: builtin.c:149 #, c-format msgid "%s to \"%s\" failed (%s)" msgstr "%s till \"%s\" misslyckades (%s)" -#: builtin.c:138 +#: builtin.c:150 msgid "standard output" msgstr "standard ut" -#: builtin.c:139 +#: builtin.c:151 msgid "reason unknown" msgstr "okänd anledning" -#: builtin.c:152 +#: builtin.c:164 msgid "exp: received non-numeric argument" msgstr "exp: fick ett ickenumeriskt argument" -#: builtin.c:158 +#: builtin.c:170 #, c-format msgid "exp: argument %g is out of range" msgstr "exp: argumentet %g är inte inom tillåten gräns" -#: builtin.c:216 +#: builtin.c:228 #, c-format msgid "fflush: cannot flush: pipe `%s' opened for reading, not writing" msgstr "" "fflush: kan inte spola: röret \"%s\" öppnat för läsning, inte skrivning" -#: builtin.c:219 +#: builtin.c:231 #, c-format msgid "fflush: cannot flush: file `%s' opened for reading, not writing" msgstr "" "fflush: kan inte spola: filen \"%s\" öppnad för läsning, inte skrivning" -#: builtin.c:231 +#: builtin.c:243 #, c-format msgid "fflush: `%s' is not an open file, pipe or co-process" msgstr "fflush: \"%s\" är inte en öppen fil, rör eller koprocess" -#: builtin.c:325 +#: builtin.c:338 msgid "index: received non-string first argument" msgstr "index: första argumentet är inte en sträng" -#: builtin.c:327 +#: builtin.c:340 msgid "index: received non-string second argument" msgstr "index: andra argumentet är inte en sträng" -#: builtin.c:437 +#: builtin.c:454 msgid "int: received non-numeric argument" msgstr "int: fick ett ickenumeriskt argument" -#: builtin.c:454 +#: builtin.c:471 msgid "length: received non-string argument" msgstr "length: fick ett argument som inte är en sträng" -#: builtin.c:470 +#: builtin.c:487 msgid "log: received non-numeric argument" msgstr "log: fick ett ickenumeriskt argument" -#: builtin.c:473 +#: builtin.c:490 #, c-format msgid "log: received negative argument %g" msgstr "log: fick ett negativt argumentet %g" -#: builtin.c:635 builtin.c:638 +#: builtin.c:654 builtin.c:657 msgid "must use `count$' on all formats or none" msgstr "måste använda \"count$\" på alla eller inga format" -#: builtin.c:740 +#: builtin.c:759 msgid "`$' is not permitted in awk formats" msgstr "\"$\" tillåts inte i awkformat" -#: builtin.c:746 +#: builtin.c:765 msgid "arg count with `$' must be > 0" msgstr "argumentantalet med \"$\" måste vara > 0" -#: builtin.c:748 +#: builtin.c:767 #, c-format msgid "arg count %ld greater than total number of supplied arguments" msgstr "argumentantalet %ld är större än antalet givna argument" -#: builtin.c:750 +#: builtin.c:769 msgid "`$' not permitted after period in format" msgstr "\"$\" tillåts inte efter en punkt i formatet" -#: builtin.c:763 +#: builtin.c:782 msgid "no `$' supplied for positional field width or precision" msgstr "inget \"$\" bifogat för positionsangiven fältbredd eller precision" -#: builtin.c:821 +#: builtin.c:848 msgid "`l' is meaningless in awk formats; ignored" msgstr "\"l\" är meningslös i awk-format, ignorerad" -#: builtin.c:825 +#: builtin.c:852 msgid "`l' is not permitted in POSIX awk formats" msgstr "\"l\" tillåts inte i POSIX awk-format" -#: builtin.c:836 +#: builtin.c:863 msgid "`L' is meaningless in awk formats; ignored" msgstr "\"L\" är meningslös i awk-format, ignorerad" -#: builtin.c:840 +#: builtin.c:867 msgid "`L' is not permitted in POSIX awk formats" msgstr "\"L\" tillåts inte i POSIX awk-format" -#: builtin.c:851 +#: builtin.c:878 msgid "`h' is meaningless in awk formats; ignored" msgstr "\"h\" är meningslös i awk-format, ignorerad" -#: builtin.c:855 +#: builtin.c:882 msgid "`h' is not permitted in POSIX awk formats" msgstr "\"h\" tillåts inte i POSIX awk-format" -#: builtin.c:1055 +#: builtin.c:1111 #, c-format msgid "[s]printf: value %g is out of range for `%%%c' format" msgstr "" -#: builtin.c:1108 +#: builtin.c:1171 msgid "not enough arguments to satisfy format string" msgstr "för få argument för formatsträngen" -#: builtin.c:1110 +#: builtin.c:1173 msgid "^ ran out for this one" msgstr "^ tog slut här" -#: builtin.c:1115 +#: builtin.c:1178 msgid "[s]printf: format specifier does not have control letter" msgstr "[s]printf: formatspecifieraren har ingen kommandobokstav" -#: builtin.c:1118 +#: builtin.c:1181 msgid "too many arguments supplied for format string" msgstr "för många argument för formatsträngen" -#: builtin.c:1184 builtin.c:1187 +#: builtin.c:1247 builtin.c:1250 msgid "printf: no arguments" msgstr "printf: inga argument" -#: builtin.c:1211 +#: builtin.c:1274 msgid "sqrt: received non-numeric argument" msgstr "sqrt: fick ickenumeriskt argument" -#: builtin.c:1215 +#: builtin.c:1278 #, c-format msgid "sqrt: called with negative argument %g" msgstr "sqrt: anropad med negativt argument %g" -#: builtin.c:1238 +#: builtin.c:1301 #, c-format msgid "substr: start index %g is invalid, using 1" msgstr "substr: startindex %g är ogiltigt, använder 1" -#: builtin.c:1243 +#: builtin.c:1306 #, c-format msgid "substr: non-integer start index %g will be truncated" msgstr "substr: startindex %g som inte är ett heltal kommer trunkeras" -#: builtin.c:1262 +#: builtin.c:1325 #, fuzzy, c-format msgid "substr: length %g is not >= 1" msgstr "substr: längden %g är <= 0" -#: builtin.c:1264 +#: builtin.c:1327 #, fuzzy, c-format msgid "substr: length %g is not >= 0" msgstr "substr: längden %g är <= 0" -#: builtin.c:1271 +#: builtin.c:1334 #, c-format msgid "substr: non-integer length %g will be truncated" msgstr "substr: längden %g som inte är ett heltal kommer trunkeras" -#: builtin.c:1276 +#: builtin.c:1339 #, c-format msgid "substr: length %g too big for string indexing, truncating to %g" msgstr "substr: längden %g är för stor för strängindexering, trunkeras till %g" -#: builtin.c:1288 +#: builtin.c:1351 msgid "substr: source string is zero length" msgstr "substr: källsträngen är tom" -#: builtin.c:1294 +#: builtin.c:1357 #, c-format msgid "substr: start index %g is past end of string" msgstr "substr: startindex %g är bortom strängens slut" -#: builtin.c:1302 +#: builtin.c:1365 #, c-format msgid "" "substr: length %g at start index %g exceeds length of first argument (%lu)" @@ -569,288 +570,314 @@ msgstr "" "substr: längden %g vid startindex %g överskrider det första argumentets " "längd (%lu)" -#: builtin.c:1337 +#: builtin.c:1400 msgid "strftime: received non-string first argument" msgstr "strftime: fick ett första argument som inte är en sträng" -#: builtin.c:1343 +#: builtin.c:1406 msgid "strftime: received empty format string" msgstr "strftime: fick en tom formatsträng" -#: builtin.c:1352 +#: builtin.c:1415 msgid "strftime: received non-numeric second argument" msgstr "strftime: fick ett ickenumeriskt andra argument" -#: builtin.c:1415 +#: builtin.c:1478 msgid "mktime: received non-string argument" msgstr "mktime: fick ett argument som inte är en sträng" -#: builtin.c:1460 +#: builtin.c:1523 msgid "system: received non-string argument" msgstr "system: fick ett argument som inte är en sträng" -#: builtin.c:1581 eval.c:1883 +#: builtin.c:1644 eval.c:2019 #, fuzzy, c-format msgid "reference to uninitialized field `$%d'" msgstr "referens till icke initierad variabel \"%s\"" -#: builtin.c:1608 +#: builtin.c:1671 msgid "tolower: received non-string argument" msgstr "tolower: fick ett argument som inte är en sträng" -#: builtin.c:1657 +#: builtin.c:1720 msgid "toupper: received non-string argument" msgstr "toupper: fick ett argument som inte är en sträng" -#: builtin.c:1702 +#: builtin.c:1765 msgid "atan2: received non-numeric first argument" msgstr "atan2: fick ett ickenumeriskt första argument" -#: builtin.c:1704 +#: builtin.c:1767 msgid "atan2: received non-numeric second argument" msgstr "atan2: fick ett ickenumeriskt andra argument" -#: builtin.c:1723 +#: builtin.c:1786 msgid "sin: received non-numeric argument" msgstr "sin: fick ett ickenumeriskt argument" -#: builtin.c:1739 +#: builtin.c:1802 msgid "cos: received non-numeric argument" msgstr "cos: fick ett ickenumeriskt argument" -#: builtin.c:1788 +#: builtin.c:1852 msgid "srand: received non-numeric argument" msgstr "srand: fick ett ickenumeriskt argument" -#: builtin.c:1823 +#: builtin.c:1887 msgid "match: third argument is not an array" msgstr "match: tredje argumentet är inte en vektor" -#: builtin.c:2307 +#: builtin.c:2414 msgid "gensub: third argument of 0 treated as 1" msgstr "gensub: Nollan i tredje argumentet behandlad som en etta" -#: builtin.c:2416 builtin.c:2418 +#: builtin.c:2572 msgid "lshift: received non-numeric first argument" msgstr "lshift: fick ett ickenumeriskt första argument" -#: builtin.c:2420 +#: builtin.c:2574 +#, fuzzy +msgid "lshift: received non-numeric second argument" +msgstr "strftime: fick ett ickenumeriskt andra argument" + +#: builtin.c:2580 #, c-format msgid "lshift(%lf, %lf): negative values will give strange results" msgstr "lshift(%lf, %lf): negativa värden kommer ge konstiga resultat" -#: builtin.c:2422 +#: builtin.c:2582 #, c-format msgid "lshift(%lf, %lf): fractional values will be truncated" msgstr "lshift(%lf, %lf): flyttalsvärden kommer trunkeras" -#: builtin.c:2424 +#: builtin.c:2584 #, c-format msgid "lshift(%lf, %lf): too large shift value will give strange results" msgstr "lshift(%lf, %lf): för stora skiftvärden kommer ge konstiga resultat" -#: builtin.c:2453 builtin.c:2455 +#: builtin.c:2610 msgid "rshift: received non-numeric first argument" msgstr "rshift: fick ett ickenumeriskt första argument" -#: builtin.c:2457 +#: builtin.c:2612 +#, fuzzy +msgid "rshift: received non-numeric second argument" +msgstr "strftime: fick ett ickenumeriskt andra argument" + +#: builtin.c:2618 #, c-format msgid "rshift(%lf, %lf): negative values will give strange results" msgstr "rshift(%lf, %lf): negativa värden kommer ge konstiga resultat" -#: builtin.c:2459 +#: builtin.c:2620 #, c-format msgid "rshift(%lf, %lf): fractional values will be truncated" msgstr "rshift(%lf, %lf): flyttalsvärden kommer trunkeras" -#: builtin.c:2461 +#: builtin.c:2622 #, c-format msgid "rshift(%lf, %lf): too large shift value will give strange results" msgstr "rshift(%lf, %lf): för stora skiftvärden kommer ge konstiga resultat" -#: builtin.c:2490 builtin.c:2492 +#: builtin.c:2648 msgid "and: received non-numeric first argument" msgstr "and: fick ett ickenumeriskt första argument" -#: builtin.c:2494 +#: builtin.c:2650 +#, fuzzy +msgid "and: received non-numeric second argument" +msgstr "atan2: fick ett ickenumeriskt andra argument" + +#: builtin.c:2656 #, c-format msgid "and(%lf, %lf): negative values will give strange results" msgstr "and(%lf, %lf): negativa värden kommer ge konstiga resultat" -#: builtin.c:2496 +#: builtin.c:2658 #, c-format msgid "and(%lf, %lf): fractional values will be truncated" msgstr "and(%lf, %lf): flyttalsvärden kommer trunkeras" -#: builtin.c:2525 builtin.c:2527 +#: builtin.c:2684 msgid "or: received non-numeric first argument" msgstr "or: fick ett ickenumeriskt första argument" -#: builtin.c:2529 +#: builtin.c:2686 +#, fuzzy +msgid "or: received non-numeric second argument" +msgstr "atan2: fick ett ickenumeriskt andra argument" + +#: builtin.c:2692 #, c-format msgid "or(%lf, %lf): negative values will give strange results" msgstr "or(%lf, %lf): negativa värden kommer ge konstiga resultat" -#: builtin.c:2531 +#: builtin.c:2694 #, c-format msgid "or(%lf, %lf): fractional values will be truncated" msgstr "or(%lf, %lf): flyttalsvärden kommer trunkeras" -#: builtin.c:2560 builtin.c:2562 +#: builtin.c:2720 msgid "xor: received non-numeric first argument" msgstr "xor: fick ett ickenumeriskt första argument" -#: builtin.c:2564 +#: builtin.c:2722 +#, fuzzy +msgid "xor: received non-numeric second argument" +msgstr "atan2: fick ett ickenumeriskt andra argument" + +#: builtin.c:2728 #, c-format msgid "xor(%lf, %lf): negative values will give strange results" msgstr "xor(%lf, %lf): negativa värden kommer ge konstiga resultat" -#: builtin.c:2566 +#: builtin.c:2730 #, c-format msgid "xor(%lf, %lf): fractional values will be truncated" msgstr "xor(%lf, %lf): flyttalsvärden kommer trunkeras" -#: builtin.c:2594 +#: builtin.c:2754 msgid "compl: received non-numeric argument" msgstr "compl: fick ett ickenumeriskt argument" -#: builtin.c:2596 +#: builtin.c:2760 #, c-format msgid "compl(%lf): negative value will give strange results" msgstr "compl(%lf): negativa värden kommer ge konstiga resultat" -#: builtin.c:2598 +#: builtin.c:2762 #, c-format msgid "compl(%lf): fractional value will be truncated" msgstr "compl(%lf): flyttalsvärden kommer trunkeras" -#: builtin.c:2771 +#: builtin.c:2935 #, c-format msgid "dcgettext: `%s' is not a valid locale category" msgstr "dcgettext: \"%s\" är inte en giltig lokalkategori" -#: eval.c:266 +#: eval.c:303 #, c-format msgid "unknown nodetype %d" msgstr "okänd nodtyp %d" -#: eval.c:312 +#: eval.c:350 msgid "buffer overflow in genflags2str" msgstr "buffertöverflöd i genflags2str" -#: eval.c:647 +#: eval.c:382 eval.c:388 profile.c:837 +#, c-format +msgid "attempt to use array `%s' in a scalar context" +msgstr "försök att använda vektorn \"%s\" i skalärsammanhang" + +#: eval.c:730 #, c-format msgid "for loop: array `%s' changed size from %ld to %ld during loop execution" msgstr "" "forslinga: vektorn \"%s\" ändrade storlek från %ld till %ld under " "slingexekvering" -#: eval.c:668 +#: eval.c:751 msgid "`break' outside a loop is not portable" msgstr "\"break\" utanför en slinga är inte portabelt" -#: eval.c:672 +#: eval.c:755 msgid "`break' outside a loop is not allowed" msgstr "\"break\" utanför en slinga är inte tillåtet" -#: eval.c:689 +#: eval.c:772 msgid "`continue' outside a loop is not portable" msgstr "\"continue\" utanför en slinga är inte portabelt" -#: eval.c:693 +#: eval.c:776 msgid "`continue' outside a loop is not allowed" msgstr "\"continue\" utanför en slinga är inte tillåtet" -#: eval.c:727 +#: eval.c:810 msgid "`next' cannot be called from a BEGIN rule" msgstr "\"next\" kan inte anropas från en BEGIN-regel" -#: eval.c:729 +#: eval.c:812 msgid "`next' cannot be called from an END rule" msgstr "\"next\" kan inte anropas från en END-regel" -#: eval.c:738 +#: eval.c:821 msgid "`nextfile' cannot be called from a BEGIN rule" msgstr "\"nextfile\" kan inte anropas från en BEGIN-regel" -#: eval.c:740 +#: eval.c:823 msgid "`nextfile' cannot be called from an END rule" msgstr "\"nextfile\" kan inte anropas från en END-regel" -#: eval.c:785 +#: eval.c:872 msgid "statement has no effect" msgstr "kommandot har ingen effekt" -#: eval.c:828 eval.c:1726 +#: eval.c:915 eval.c:1873 #, c-format msgid "can't use function name `%s' as variable or array" msgstr "kan inte använda funktionsnamnet \"%s\" som variabel eller vektor" -#: eval.c:835 eval.c:841 +#: eval.c:922 eval.c:928 #, c-format msgid "reference to uninitialized argument `%s'" msgstr "referens till icke initierat argument \"%s\"" -#: eval.c:848 eval.c:907 eval.c:1732 eval.c:1742 profile.c:807 -#, c-format -msgid "attempt to use array `%s' in a scalar context" -msgstr "försök att använda vektorn \"%s\" i skalärsammanhang" - -#: eval.c:858 eval.c:1752 +#: eval.c:937 eval.c:1882 #, c-format msgid "reference to uninitialized variable `%s'" msgstr "referens till icke initierad variabel \"%s\"" -#: eval.c:1007 +#: eval.c:1083 msgid "" "concatenation: side effects in one expression have changed the length of " "another!" msgstr "" "concatenation: sidoeffekter i ett uttryck har ändrat längden av ett annat!" -#: eval.c:1032 +#: eval.c:1162 msgid "assignment used in conditional context" msgstr "tilldelning använt i jämförelsesammanhang" -#: eval.c:1122 +#: eval.c:1252 msgid "division by zero attempted" msgstr "försökte dividera med noll" -#: eval.c:1137 +#: eval.c:1267 #, c-format msgid "division by zero attempted in `%%'" msgstr "försökte dividera med noll i \"%%\"" -#: eval.c:1152 profile.c:683 +#: eval.c:1282 profile.c:713 #, c-format msgid "illegal type (%s) in tree_eval" msgstr "otillåten typ (%s) i tree_eval" -#: eval.c:1328 +#: eval.c:1459 msgid "division by zero attempted in `/='" msgstr "försökte dividera med noll i \"/=\"" -#: eval.c:1346 +#: eval.c:1477 #, c-format msgid "division by zero attempted in `%%='" msgstr "försökte dividera med noll i \"%%=\"" -#: eval.c:1586 +#: eval.c:1738 #, c-format msgid "function `%s' called with more arguments than declared" msgstr "funktionen \"%s\" anropad med fler argument än vad som deklarerats" -#: eval.c:1633 +#: eval.c:1782 #, c-format msgid "function `%s' not defined" msgstr "funktionen \"%s\" är inte definierad" -#: eval.c:1639 +#: eval.c:1788 #, c-format msgid "function %s called\n" msgstr "funktionen %s anropad\n" -#: eval.c:1698 +#: eval.c:1845 +#, c-format msgid "" "\n" "\t# Function Call Stack:\n" @@ -860,41 +887,42 @@ msgstr "" "\t# Funktionsanropsstack:\n" "\n" -#: eval.c:1701 +#: eval.c:1848 +#, c-format msgid "\t# -- main --\n" msgstr "\t# -- main --\n" -#: eval.c:1867 +#: eval.c:2003 msgid "attempt to field reference from non-numeric value" msgstr "försök att fältreferera från ickenumeriskt värde" -#: eval.c:1869 +#: eval.c:2005 msgid "attempt to reference from null string" msgstr "försök att referera från tom sträng" -#: eval.c:1875 +#: eval.c:2011 #, c-format msgid "attempt to access field %d" msgstr "försök att komma åt fält nummer %d" -#: eval.c:1896 eval.c:1903 profile.c:900 +#: eval.c:2032 eval.c:2039 profile.c:934 msgid "assignment is not allowed to result of builtin function" msgstr "det är inte tillåtet att tilldela resultatet från en inbyggd funktion" -#: eval.c:1951 +#: eval.c:2103 msgid "`IGNORECASE' is a gawk extension" msgstr "\"IGNORECASE\" är en gawk-utökning" -#: eval.c:1980 +#: eval.c:2133 msgid "`BINMODE' is a gawk extension" msgstr "\"BINMODE\" är en gawk-utökning" -#: eval.c:2092 +#: eval.c:2255 #, c-format msgid "bad `%sFMT' specification `%s'" msgstr "felaktig \"%sFMT\"-specifikation \"%s\"" -#: eval.c:2170 +#: eval.c:2333 msgid "turning off `--lint' due to assignment to `LINT'" msgstr "slår av \"--lint\" på grund av en tilldelning till \"LINT\"" @@ -912,7 +940,56 @@ msgstr "extension: kan inte msgid "extension: library `%s': cannot call function `%s' (%s)\n" msgstr "extension: bibliotek \"%s\": kan inte anropa funktionen \"%s\" (%s)\n" -#: ext.c:183 +#: ext.c:102 +msgid "extension: missing function name" +msgstr "" + +#: ext.c:107 +#, fuzzy, c-format +msgid "extension: illegal character `%c' in function name `%s'" +msgstr "extension: bibliotek \"%s\": kan inte anropa funktionen \"%s\" (%s)\n" + +#: ext.c:113 +#, fuzzy, c-format +msgid "extension: can't redefine function `%s'" +msgstr "extension: kan inte öppna \"%s\" (%s)\n" + +#: ext.c:117 +#, fuzzy, c-format +msgid "extension: function `%s' already defined" +msgstr "funktionen \"%s\" är inte definierad" + +#: ext.c:122 +#, c-format +msgid "extension: can't use gawk built-in `%s' as function name" +msgstr "" + +#: ext.c:124 +#, fuzzy, c-format +msgid "extension: function name `%s' previously defined" +msgstr "funktionsnamnet \"%s\" är definierat sedan tidigare" + +#: ext.c:201 +#, c-format +msgid "function `%s' defined to take no more than `%d' argument(s)" +msgstr "" + +#: ext.c:204 +#, fuzzy, c-format +msgid "function `%s': missing argument #%d" +msgstr "funktionen \"%s\" är inte definierad" + +#: ext.c:214 +#, fuzzy, c-format +msgid "function `%s': argument #%d: attempt to use scalar as an array" +msgstr "försök att använda skalären \"%s\" som vektor" + +#: ext.c:218 +#, c-format +msgid "function `%s': argument #%d: attempt to use array as a scalar" +msgstr "" + +#: ext.c:243 msgid "Operation Not Supported" msgstr "Operationen stöds inte" @@ -941,524 +1018,524 @@ msgstr "f msgid "null string for `FS' is a gawk extension" msgstr "tom sträng som \"FS\" är en gawk-utökning" -#: getopt.c:692 getopt.c:704 +#: getopt.c:692 getopt.c:711 #, c-format msgid "%s: option `%s' is ambiguous\n" msgstr "%s: flaggan \"%s\" är tvetydig\n" -#: getopt.c:737 getopt.c:741 +#: getopt.c:744 getopt.c:748 #, c-format msgid "%s: option `--%s' doesn't allow an argument\n" msgstr "%s: flaggan \"--%s\" tillåter inte argument\n" -#: getopt.c:750 getopt.c:755 +#: getopt.c:757 getopt.c:762 #, c-format msgid "%s: option `%c%s' doesn't allow an argument\n" msgstr "%s: flaggan \"%c%s\" tillåter inte argument\n" -#: getopt.c:791 getopt.c:804 getopt.c:1093 getopt.c:1106 +#: getopt.c:807 getopt.c:829 getopt.c:1159 getopt.c:1181 #, c-format msgid "%s: option `%s' requires an argument\n" msgstr "%s: flaggan \"%s\" kräver ett argument\n" -#: getopt.c:842 getopt.c:845 +#: getopt.c:867 getopt.c:870 #, c-format msgid "%s: unrecognized option `--%s'\n" msgstr "%s: okänd flagga \"--%s\"\n" -#: getopt.c:853 getopt.c:856 +#: getopt.c:878 getopt.c:881 #, c-format msgid "%s: unrecognized option `%c%s'\n" msgstr "%s: okänd flagga \"%c%s\"\n" -#: getopt.c:903 getopt.c:906 +#: getopt.c:936 getopt.c:939 #, c-format msgid "%s: illegal option -- %c\n" msgstr "%s: otillåten flagga -- %c\n" -#: getopt.c:912 getopt.c:915 +#: getopt.c:945 getopt.c:948 #, c-format msgid "%s: invalid option -- %c\n" msgstr "%s: ogiltig flagga -- %c\n" -#: getopt.c:962 getopt.c:973 getopt.c:1159 getopt.c:1172 main.c:434 +#: getopt.c:1003 getopt.c:1022 getopt.c:1234 getopt.c:1255 main.c:433 #, c-format msgid "%s: option requires an argument -- %c\n" msgstr "%s: flaggan kräver ett argument -- %c\n" -#: getopt.c:1025 getopt.c:1036 +#: getopt.c:1074 getopt.c:1093 #, c-format msgid "%s: option `-W %s' is ambiguous\n" msgstr "%s: flaggan \"-W %s\" är tvetydig\n" -#: getopt.c:1060 getopt.c:1072 +#: getopt.c:1117 getopt.c:1138 #, c-format msgid "%s: option `-W %s' doesn't allow an argument\n" msgstr "%s: flaggan \"-W %s\" tillåter inte något argument\n" -#: io.c:305 +#: io.c:308 #, c-format msgid "cannot open file `%s' for reading (%s)" msgstr "kan inte öppna filen \"%s\" för läsning (%s)" -#: io.c:392 +#: io.c:395 #, c-format msgid "close of fd %d (`%s') failed (%s)" msgstr "stängning av fd %d (\"%s\") misslyckades (%s)" -#: io.c:530 +#: io.c:533 #, c-format msgid "invalid tree type %s in redirect()" msgstr "ogiltig trädtyp %s i redirect()" -#: io.c:536 +#: io.c:539 #, c-format msgid "expression in `%s' redirection only has numeric value" msgstr "uttrycket i \"%s\"-omdirigering har bara numeriskt värde" -#: io.c:542 +#: io.c:545 #, c-format msgid "expression for `%s' redirection has null string value" msgstr "uttrycket för \"%s\"-omdirigering har en tom sträng som värde" -#: io.c:547 +#: io.c:550 #, c-format msgid "filename `%s' for `%s' redirection may be result of logical expression" msgstr "" "filnamnet \"%s\" för \"%s\"-omdirigering kan vara resultatet av ett logiskt " "uttryck" -#: io.c:569 +#: io.c:588 #, c-format msgid "unnecessary mixing of `>' and `>>' for file `%.*s'" msgstr "onödig blandning av \">\" och \">>\" för filen \"%.*s\"" -#: io.c:621 +#: io.c:640 #, c-format msgid "can't open pipe `%s' for output (%s)" msgstr "kan inte öppna röret \"%s\" för utmatning (%s)" -#: io.c:630 +#: io.c:649 #, c-format msgid "can't open pipe `%s' for input (%s)" msgstr "kan inte öppna röret \"%s\" för inmatning (%s)" -#: io.c:643 +#: io.c:662 #, c-format msgid "can't open two way socket `%s' for input/output (%s)" msgstr "kan inte öppna tvåvägsuttaget \"%s\" för in-/utmatning (%s)" -#: io.c:647 +#: io.c:666 #, c-format msgid "can't open two way pipe `%s' for input/output (%s)" msgstr "kan inte öppna tvåvägsröret \"%s\" för in-/utmatning (%s)" -#: io.c:723 +#: io.c:742 #, c-format msgid "can't redirect from `%s' (%s)" msgstr "kan inte dirigera om från \"%s\" (%s)" -#: io.c:726 +#: io.c:745 #, c-format msgid "can't redirect to `%s' (%s)" msgstr "kan inte dirigera om till \"%s\" (%s)" -#: io.c:765 +#: io.c:784 msgid "" "reached system limit for open files: starting to multiplex file descriptors" msgstr "" "nådde systembegränsningen för öppna filer: börjar multiplexa fildeskriptorer" -#: io.c:777 +#: io.c:800 #, c-format msgid "close of `%s' failed (%s)." msgstr "stängning av \"%s\" misslyckades (%s)" -#: io.c:784 +#: io.c:808 msgid "too many pipes or input files open" msgstr "för många rör eller indatafiler öppna" -#: io.c:807 +#: io.c:831 msgid "close: second argument must be `to' or `from'" msgstr "close: andra argumentet måste vara \"to\" eller \"from\"" -#: io.c:821 +#: io.c:845 #, c-format msgid "close: `%.*s' is not an open file, pipe or co-process" msgstr "close: \"%.*s\" är inte en öppen fil, rör eller koprocess" -#: io.c:825 +#: io.c:849 msgid "close of redirection that was never opened" msgstr "stängning av omdirigering som aldrig öppnades" -#: io.c:862 +#: io.c:945 #, c-format msgid "close: redirection `%s' not opened with `|&', second argument ignored" msgstr "" "close: omdirigeringen \"%s\" öppnades inte med \"|&\", andra argumentet " "ignorerat" -#: io.c:924 +#: io.c:960 #, c-format msgid "failure status (%d) on pipe close of `%s' (%s)" msgstr "felstatus (%d) från rörstängning av \"%s\" (%s)" -#: io.c:927 +#: io.c:963 #, c-format msgid "failure status (%d) on file close of `%s' (%s)" msgstr "felstatus (%d) från filstängning av \"%s\" (%s)" -#: io.c:946 +#: io.c:983 #, c-format msgid "no explicit close of socket `%s' provided" msgstr "ingen explicit stängning av uttaget \"%s\" tillhandahållen" -#: io.c:949 +#: io.c:986 #, c-format msgid "no explicit close of co-process `%s' provided" msgstr "ingen explicit stängning av koprocessen \"%s\" tillhandahållen" -#: io.c:952 +#: io.c:989 #, c-format msgid "no explicit close of pipe `%s' provided" msgstr "ingen explicit stängning av röret \"%s\" tillhandahållen" -#: io.c:955 +#: io.c:992 #, c-format msgid "no explicit close of file `%s' provided" msgstr "ingen explicit stängning av filen \"%s\" tillhandahållen" -#: io.c:984 io.c:1038 +#: io.c:1021 io.c:1075 #, c-format msgid "error writing standard output (%s)" msgstr "fel vid skrivning till standard ut (%s)" -#: io.c:988 io.c:1042 +#: io.c:1025 io.c:1079 #, c-format msgid "error writing standard error (%s)" msgstr "fel vid skrivning till standard fel (%s)" -#: io.c:996 +#: io.c:1033 #, c-format msgid "pipe flush of `%s' failed (%s)." msgstr "rörspolning av \"%s\" misslyckades (%s)" -#: io.c:999 +#: io.c:1036 #, c-format msgid "co-process flush of pipe to `%s' failed (%s)." msgstr "koprocesspolning av röret till \"%s\" misslyckades (%s)" -#: io.c:1002 +#: io.c:1039 #, c-format msgid "file flush of `%s' failed (%s)." msgstr "filspolning av \"%s\" misslyckades (%s)" -#: io.c:1161 +#: io.c:1198 msgid "/inet/raw client not ready yet, sorry" msgstr "/inet/raw-klient är tyvärr inte klar än" -#: io.c:1163 io.c:1200 +#: io.c:1200 io.c:1237 msgid "only root may use `/inet/raw'." msgstr "bara root kan använda \"/inet/raw\"." -#: io.c:1198 +#: io.c:1235 msgid "/inet/raw server not ready yet, sorry" msgstr "/inet/raw-server inte redo än, ledsen" -#: io.c:1288 +#: io.c:1325 #, c-format msgid "no (known) protocol supplied in special filename `%s'" msgstr "" "inget (känt) protokoll tillhandahållet i det speciella filnamnet \"%s\"" -#: io.c:1306 +#: io.c:1343 #, c-format msgid "special file name `%s' is incomplete" msgstr "speciellt filnamn \"%s\" är ofullständigt" -#: io.c:1318 +#: io.c:1355 #, c-format msgid "local port invalid in `%s'" msgstr "lokal port ogiltig i \"%s\"" -#: io.c:1330 +#: io.c:1367 msgid "must supply a remote hostname to `/inet'" msgstr "måste tillhandahålla ett fjärrdatornamn till \"/inet\"" -#: io.c:1345 +#: io.c:1382 msgid "must supply a remote port to `/inet'" msgstr "måste tillhandahålla en fjärrport till \"/inet\"" -#: io.c:1351 +#: io.c:1388 #, c-format msgid "remote port invalid in `%s'" msgstr "fjärrporten ogiltig i \"%s\"" -#: io.c:1361 +#: io.c:1398 msgid "TCP/IP communications are not supported" msgstr "TCP/IP-kommunikation stöds inte" -#: io.c:1370 io.c:1551 +#: io.c:1407 io.c:1588 #, c-format msgid "file `%s' is a directory" msgstr "filen \"%s\" är en katalog" -#: io.c:1440 +#: io.c:1477 #, c-format msgid "use `PROCINFO[\"%s\"]' instead of `%s'" msgstr "använd \"PROCINFO[\"%s\"]\" istället för \"%s\"" -#: io.c:1472 +#: io.c:1509 msgid "use `PROCINFO[...]' instead of `/dev/user'" msgstr "använd \"PROCINFO[...]\" istället för \"dev/user\"" -#: io.c:1537 io.c:1711 +#: io.c:1574 io.c:1748 #, c-format msgid "could not open `%s', mode `%s'" msgstr "kunde inte öppna \"%s\", läge \"%s\"" -#: io.c:1762 +#: io.c:1799 #, c-format msgid "close of master pty failed (%s)" msgstr "stängning av huvudpty misslyckades (%s)" -#: io.c:1764 io.c:1916 io.c:2068 +#: io.c:1801 io.c:1953 io.c:2105 #, c-format msgid "close of stdout in child failed (%s)" msgstr "stängning av standard ut i barnet misslyckades (%s)" -#: io.c:1767 +#: io.c:1804 #, c-format msgid "moving slave pty to stdout in child failed (dup: %s)" msgstr "flyttandet av slavpty till standard ut i barnet misslyckades (dup: %s)" -#: io.c:1769 io.c:1921 +#: io.c:1806 io.c:1958 #, c-format msgid "close of stdin in child failed (%s)" msgstr "stängning av standard in i barnet misslyckades (%s)" -#: io.c:1772 +#: io.c:1809 #, c-format msgid "moving slave pty to stdin in child failed (dup: %s)" msgstr "flyttandet av slavpty till standard in i barnet misslyckades (dup: %s)" -#: io.c:1774 io.c:1793 +#: io.c:1811 io.c:1830 #, c-format msgid "close of slave pty failed (%s)" msgstr "stängning av slavpty misslyckades (%s)" -#: io.c:1867 io.c:1919 io.c:2049 io.c:2071 +#: io.c:1904 io.c:1956 io.c:2086 io.c:2108 #, c-format msgid "moving pipe to stdout in child failed (dup: %s)" msgstr "flyttande av rör till standard ut i barnet misslyckades (dup: %s)" -#: io.c:1871 io.c:1924 +#: io.c:1908 io.c:1961 #, c-format msgid "moving pipe to stdin in child failed (dup: %s)" msgstr "flyttande av rör till standard in i barnet misslyckades (dup: %s)" -#: io.c:1888 io.c:2062 +#: io.c:1925 io.c:2099 msgid "restoring stdout in parent process failed\n" msgstr "återställande av standard ut i förälderprocessen misslyckades\n" -#: io.c:1893 +#: io.c:1930 msgid "restoring stdin in parent process failed\n" msgstr "återställande av standard in i förälderprocessen misslyckades\n" -#: io.c:1927 io.c:2073 io.c:2084 +#: io.c:1964 io.c:2110 io.c:2121 #, c-format msgid "close of pipe failed (%s)" msgstr "stängning av röret misslyckades (%s)" -#: io.c:1972 +#: io.c:2009 msgid "`|&' not supported" msgstr "\"|&\" stöds inte" -#: io.c:2039 +#: io.c:2076 #, c-format msgid "cannot open pipe `%s' (%s)" msgstr "kan inte öppna röret \"%s\" (%s)" -#: io.c:2080 +#: io.c:2117 #, c-format msgid "cannot create child process for `%s' (fork: %s)" msgstr "kan inte skapa barnprocess för \"%s\" (fork: %s)" -#: io.c:2423 +#: io.c:2460 #, c-format msgid "data file `%s' is empty" msgstr "datafilen \"%s\" är tom" -#: io.c:2466 io.c:2474 +#: io.c:2503 io.c:2511 msgid "could not allocate more input memory" msgstr "kunde inte allokera mer indataminne" -#: io.c:2832 io.c:2895 +#: io.c:2869 io.c:2932 #, c-format msgid "error reading input file `%s': %s" msgstr "fel vid läsning av indatafilen \"%s\": %s" -#: io.c:3020 +#: io.c:3057 msgid "multicharacter value of `RS' is a gawk extension" msgstr "flerteckensvärdet av \"RS\" är en gawk-utökning" -#: main.c:324 +#: main.c:323 msgid "`-m[fr]' option irrelevant in gawk" msgstr "\"-m[fr]\"-flaggan är irrelevant i gawk" -#: main.c:326 +#: main.c:325 msgid "-m option usage: `-m[fr] nnn'" msgstr "-m-flaggans användning: \"-m[fr] nnn\"" -#: main.c:343 +#: main.c:342 #, c-format msgid "%s: option `-W %s' unrecognized, ignored\n" msgstr "%s: flaggan \"-W %s\" okänd, ignorerad\n" -#: main.c:380 +#: main.c:379 msgid "empty argument to `--source' ignored" msgstr "tomt argument till \"--source\" ignorerat" -#: main.c:451 +#: main.c:450 msgid "environment variable `POSIXLY_CORRECT' set: turning on `--posix'" msgstr "miljövariabeln \"POSIXLY_CORRECT\" satt: slår på \"--posix\"" -#: main.c:456 +#: main.c:455 msgid "`--posix' overrides `--traditional'" msgstr "\"--posix\" åsidosätter \"--traditional\"" -#: main.c:467 +#: main.c:466 msgid "`--posix'/`--traditional' overrides `--non-decimal-data'" msgstr "\"--posix\"/\"--traditional\" åsidosätter \"--non-decimal-data\"" -#: main.c:471 +#: main.c:470 #, c-format msgid "running %s setuid root may be a security problem" msgstr "att köra %s setuid root kan vara ett säkerhetsproblem" -#: main.c:512 +#: main.c:511 #, c-format msgid "can't set binary mode on stdin (%s)" msgstr "kan inte sätta binärläge på standard in (%s)" -#: main.c:515 +#: main.c:514 #, c-format msgid "can't set binary mode on stdout (%s)" msgstr "kan inte sätta binärläge på standard ut (%s)" -#: main.c:517 +#: main.c:516 #, c-format msgid "can't set binary mode on stderr (%s)" msgstr "kan inte sätta binärläge på standard fel (%s)" -#: main.c:547 +#: main.c:546 msgid "no program text at all!" msgstr "ingen programtext alls!" -#: main.c:620 +#: main.c:623 #, c-format msgid "Usage: %s [POSIX or GNU style options] -f progfile [--] file ...\n" msgstr "" "Användning: %s [POSIX- eller GNU-stilsflaggor] -f progfil [--] fil ...\n" -#: main.c:622 +#: main.c:625 #, c-format msgid "Usage: %s [POSIX or GNU style options] [--] %cprogram%c file ...\n" msgstr "Användning: %s [POSIX- eller GNU-stilsflaggor] %cprogram%c fil ...\n" -#: main.c:627 +#: main.c:630 msgid "POSIX options:\t\tGNU long options:\n" msgstr "POSIX-flaggor:\t\tGNU långa flaggor:\n" -#: main.c:628 +#: main.c:631 msgid "\t-f progfile\t\t--file=progfile\n" msgstr "\t-f progfil\t\t--file=progfil\n" -#: main.c:629 +#: main.c:632 msgid "\t-F fs\t\t\t--field-separator=fs\n" msgstr "\t-F fs\t\t\t--field-separator=fs\n" -#: main.c:630 +#: main.c:633 msgid "\t-v var=val\t\t--assign=var=val\n" msgstr "\t-v var=värde\t\t--assign=var=värde\n" -#: main.c:631 +#: main.c:634 msgid "\t-m[fr] val\n" msgstr "\t-m[fr] värde\n" -#: main.c:632 +#: main.c:635 msgid "\t-W compat\t\t--compat\n" msgstr "\t-W compat\t\t--compat\n" -#: main.c:633 +#: main.c:636 msgid "\t-W copyleft\t\t--copyleft\n" msgstr "\t-W copyleft\t\t--copyleft\n" -#: main.c:634 +#: main.c:637 msgid "\t-W copyright\t\t--copyright\n" msgstr "\t-W copyright\t\t--copyright\n" -#: main.c:635 +#: main.c:638 msgid "\t-W dump-variables[=file]\t--dump-variables[=file]\n" msgstr "\t-W dump-variables[=fil]\t--dump-variables[=fil]\n" -#: main.c:636 +#: main.c:639 msgid "\t-W gen-po\t\t--gen-po\n" msgstr "\t-W gen-po\t\t--gen-po\n" -#: main.c:637 +#: main.c:640 msgid "\t-W help\t\t\t--help\n" msgstr "\t-W help\t\t\t--help\n" -#: main.c:638 +#: main.c:641 msgid "\t-W lint[=fatal]\t\t--lint[=fatal]\n" msgstr "\t-W lint[=fatal]\t\t--lint[=fatal]\n" -#: main.c:639 +#: main.c:642 msgid "\t-W lint-old\t\t--lint-old\n" msgstr "\t-W lint-old\t\t--lint-old\n" -#: main.c:640 +#: main.c:643 msgid "\t-W non-decimal-data\t--non-decimal-data\n" msgstr "\t-W non-decimal-data\t--non-decimal-data\n" -#: main.c:642 +#: main.c:645 msgid "\t-W nostalgia\t\t--nostalgia\n" msgstr "\t-W nostalgia\t\t--nostalgia\n" -#: main.c:645 +#: main.c:648 msgid "\t-W parsedebug\t\t--parsedebug\n" msgstr "\t-W parsedebug\t\t--parsedebug\n" -#: main.c:647 +#: main.c:650 msgid "\t-W profile[=file]\t--profile[=file]\n" msgstr "\t-W profile[=fil]\t--profile[=fil]\n" -#: main.c:648 +#: main.c:651 msgid "\t-W posix\t\t--posix\n" msgstr "\t-W posix\t\t--posix\n" -#: main.c:649 +#: main.c:652 msgid "\t-W re-interval\t\t--re-interval\n" msgstr "\t-W re-interval\t\t--re-interval\n" -#: main.c:650 +#: main.c:653 msgid "\t-W source=program-text\t--source=program-text\n" msgstr "\t-W source=programtext\t--source=programtext\n" -#: main.c:651 +#: main.c:654 msgid "\t-W traditional\t\t--traditional\n" msgstr "\t-W traditional\t\t--traditional\n" -#: main.c:652 +#: main.c:655 msgid "\t-W usage\t\t--usage\n" msgstr "\t-W usage\t\t--usage\n" -#: main.c:653 +#: main.c:656 msgid "\t-W version\t\t--version\n" msgstr "\t-W version\t\t--version\n" -#: main.c:657 +#: main.c:660 msgid "" "\n" "To report bugs, see node `Bugs' in `gawk.info', which is\n" @@ -1472,7 +1549,7 @@ msgstr "" "Rapportera synpunkter på översättningen till .\n" "\n" -#: main.c:661 +#: main.c:664 msgid "" "gawk is a pattern scanning and processing language.\n" "By default it reads standard input and writes standard output.\n" @@ -1482,7 +1559,7 @@ msgstr "" "Normalt läser det från standard in och skriver till standard ut.\n" "\n" -#: main.c:665 +#: main.c:668 msgid "" "Examples:\n" "\tgawk '{ sum += $1 }; END { print sum }' file\n" @@ -1492,7 +1569,7 @@ msgstr "" "\tgawk '{ sum += $1 }; END { print sum }' fil\n" "\tgawk -F: '{print $1 }' /etc/passwd\n" -#: main.c:682 +#: main.c:685 #, c-format msgid "" "Copyright (C) 1989, 1991-%d Free Software Foundation.\n" @@ -1511,7 +1588,7 @@ msgstr "" "någon senare version.\n" "\n" -#: main.c:690 +#: main.c:693 msgid "" "This program is distributed in the hope that it will be useful,\n" "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" @@ -1525,7 +1602,7 @@ msgstr "" "General Public License för ytterligare information.\n" "\n" -#: main.c:696 +#: main.c:699 msgid "" "You should have received a copy of the GNU General Public License\n" "along with this program; if not, write to the Free Software\n" @@ -1535,51 +1612,52 @@ msgstr "" "med detta program. Om inte, skriv till Free Software Foundation,\n" "Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n" -#: main.c:730 +#: main.c:733 msgid "-Ft does not set FS to tab in POSIX awk" msgstr "-Ft sätter inte FS till tab i POSIX-awk" -#: main.c:956 +#: main.c:962 #, c-format msgid "" "%s: `%s' argument to `-v' not in `var=value' form\n" "\n" msgstr "%s: Argumentet \"%s\" till \"-v\" är inte på formatet \"var=värde\"\n" -#: main.c:976 +#: main.c:982 #, c-format msgid "`%s' is not a legal variable name" msgstr "\"%s\" är inte ett giltigt variabelnamn" -#: main.c:979 +#: main.c:985 #, c-format msgid "`%s' is not a variable name, looking for file `%s=%s'" msgstr "\"%s\" är inte ett variabelnamn, letar efter filen \"%s=%s\"" -#: main.c:1012 +#: main.c:1018 msgid "floating point exception" msgstr "flyttalsundantag" -#: main.c:1019 +#: main.c:1025 msgid "fatal error: internal error" msgstr "ödesdigert fel: internt fel" -#: main.c:1069 +#: main.c:1075 #, c-format msgid "no pre-opened fd %d" msgstr "ingen föröppnad fd %d" -#: main.c:1074 +#: main.c:1082 #, c-format msgid "could not pre-open /dev/null for fd %d" msgstr "kunde inte föröppna /dev/null för fd %d" -#: main.c:1097 main.c:1106 +#: main.c:1105 main.c:1114 #, c-format msgid "could not find groups: %s" msgstr "kunde inte hitta grupper: %s" #: msg.c:54 +#, c-format msgid "cmd. line:" msgstr "kommandorad:" @@ -1599,19 +1677,19 @@ msgstr " msgid "can't convert string to float" msgstr "kan inte konvertera en sträng till flyttal" -#: node.c:355 +#: node.c:357 msgid "backslash at end of string" msgstr "omvänt snedstreck i slutet av strängen" -#: node.c:539 +#: node.c:541 msgid "POSIX does not allow `\\x' escapes" msgstr "POSIX tillåter inte \"\\x\"-kontrollsekvenser" -#: node.c:545 +#: node.c:547 msgid "no hex digits in `\\x' escape sequence" msgstr "inga hexadecimala siffror i \"\\x\"-kontrollsekvenser" -#: node.c:579 +#: node.c:581 #, c-format msgid "escape sequence `\\%c' treated as plain `%c'" msgstr "kontrollsekvensen \"\\%c\" behandlad som bara \"%c\"" @@ -1626,21 +1704,27 @@ msgstr "%s %s \"%s\": kunde inte s msgid "could not open `%s' for writing: %s" msgstr "kunde inte öppna \"%s\" för skrivning: %s" -#: profile.c:449 +#: profile.c:467 #, fuzzy, c-format msgid "internal error: %s with null vname" msgstr "internt fel: Node_var med null vname" -#: profile.c:512 +#: profile.c:530 msgid "# treated internally as `delete'" msgstr "# behandlad internt som \"delete\"" -#: profile.c:1162 +#: profile.c:1167 +#, c-format +msgid "# this is a dynamically loaded extension function" +msgstr "" + +#: profile.c:1198 #, c-format msgid "\t# gawk profile, created %s\n" msgstr "\t# gawkprofil, skapad %s\n" -#: profile.c:1165 +#: profile.c:1201 +#, c-format msgid "" "\t# BEGIN block(s)\n" "\n" @@ -1648,7 +1732,8 @@ msgstr "" "\t# BEGIN-block\n" "\n" -#: profile.c:1175 +#: profile.c:1211 +#, c-format msgid "" "\t# Rule(s)\n" "\n" @@ -1656,7 +1741,8 @@ msgstr "" "\t# Regel/regler\n" "\n" -#: profile.c:1181 +#: profile.c:1217 +#, c-format msgid "" "\t# END block(s)\n" "\n" @@ -1664,7 +1750,8 @@ msgstr "" "\t# END-block\n" "\n" -#: profile.c:1201 +#: profile.c:1237 +#, c-format msgid "" "\n" "\t# Functions, listed alphabetically\n" @@ -1672,90 +1759,91 @@ msgstr "" "\n" "\t# Funktioner, listade alfabetiskt\n" -#: profile.c:1413 +#: profile.c:1452 #, c-format msgid "unexpected type %s in prec_level" msgstr "oväntad typ %s i prec_level" -#: re.c:193 -#, c-format -msgid "regex match failed, not enough memory to match string \"%.*s%s\"" -msgstr "" -"regexmatchning misslyckades, inte tillräckligt mycket minne för att matcha " -"\"%.*s%s\"" - -#: regcomp.c:136 +#: regcomp.c:150 msgid "Success" msgstr "Lyckades" -#: regcomp.c:139 +#: regcomp.c:153 msgid "No match" msgstr "Misslyckades" -#: regcomp.c:142 +#: regcomp.c:156 msgid "Invalid regular expression" msgstr "Ogiltigt reguljärt uttryck" -#: regcomp.c:145 +#: regcomp.c:159 msgid "Invalid collation character" msgstr "Ogiltigt kollationeringstecken" -#: regcomp.c:148 +#: regcomp.c:162 msgid "Invalid character class name" msgstr "Ogiltigt teckenklassnamn" -#: regcomp.c:151 +#: regcomp.c:165 msgid "Trailing backslash" msgstr "Eftersläpande omvänt snedstreck" -#: regcomp.c:154 +#: regcomp.c:168 msgid "Invalid back reference" msgstr "Ogiltig bakåtrerefens" -#: regcomp.c:157 +#: regcomp.c:171 msgid "Unmatched [ or [^" msgstr "Obalanserad [ eller [^" -#: regcomp.c:160 +#: regcomp.c:174 msgid "Unmatched ( or \\(" msgstr "Obalanserad ( eller \\(" -#: regcomp.c:163 +#: regcomp.c:177 msgid "Unmatched \\{" msgstr "Obalanserad \\{" -#: regcomp.c:166 +#: regcomp.c:180 msgid "Invalid content of \\{\\}" msgstr "Ogiltigt innehåll i \\{\\}" -#: regcomp.c:169 +#: regcomp.c:183 msgid "Invalid range end" msgstr "Ogiltigt omfångsslut" -#: regcomp.c:172 +#: regcomp.c:186 msgid "Memory exhausted" msgstr "Minnet slut" -#: regcomp.c:175 +#: regcomp.c:189 msgid "Invalid preceding regular expression" msgstr "Ogiltigt föregående reguljärt uttryck" -#: regcomp.c:178 +#: regcomp.c:192 msgid "Premature end of regular expression" msgstr "För tidigt slut på reguljärt uttryck" -#: regcomp.c:181 +#: regcomp.c:195 msgid "Regular expression too big" msgstr "Reguljärt uttryck för stort" -#: regcomp.c:184 +#: regcomp.c:198 msgid "Unmatched ) or \\)" msgstr "Obalanserad ) eller \\)" -#: regcomp.c:621 +#: regcomp.c:668 msgid "No previous regular expression" msgstr "Inget föregående reguljärt uttryck" +#~ msgid "or used as a variable or an array" +#~ msgstr "eller använd som variabel eller vektor" + +#~ msgid "regex match failed, not enough memory to match string \"%.*s%s\"" +#~ msgstr "" +#~ "regexmatchning misslyckades, inte tillräckligt mycket minne för att " +#~ "matcha \"%.*s%s\"" + #~ msgid "substr: length %g is < 0" #~ msgstr "substr: längden %g är < 0" @@ -1794,9 +1882,6 @@ msgstr "Inget f #~ msgid "or used in other expression context" #~ msgstr "eller använt i andra uttryckssammanhang" -#~ msgid "attempt to use function `%s' as array" -#~ msgstr "försök att använda funktionen \"%s\" som vektor" - #~ msgid "`%s' is a function, assignment is not allowed" #~ msgstr "\"%s\" är en funktion, tilldelning är inte tillåtet" diff --git a/po/tr.gmo b/po/tr.gmo index 55b508b82..923c06764 100644 Binary files a/po/tr.gmo and b/po/tr.gmo differ diff --git a/po/tr.po b/po/tr.po index fd730ec2f..f6d98b862 100644 --- a/po/tr.po +++ b/po/tr.po @@ -1,13 +1,13 @@ # Turkish translations for GNU awk messages -# Copyright (C) 2003 Free Software Foundation, Inc. -# Nilgün Belma Bugüner , 2001, 2002, 2003. +# Copyright (C) 2004 Free Software Foundation, Inc. +# Nilgün Belma Bugüner , 2001, ..., 2004. # msgid "" msgstr "" -"Project-Id-Version: gawk 3.1.2g\n" +"Project-Id-Version: gawk 3.1.3l\n" "Report-Msgid-Bugs-To: arnold@skeeve.com\n" -"POT-Creation-Date: 2003-07-07 11:20-0700\n" -"PO-Revision-Date: 2003-06-25 07:43+0300\n" +"POT-Creation-Date: 2004-07-15 13:02+0300\n" +"PO-Revision-Date: 2004-07-19 10:15+0300\n" "Last-Translator: Nilgün Belma Bugüner \n" "Language-Team: Turkish \n" "MIME-Version: 1.0\n" @@ -17,55 +17,60 @@ msgstr "" #: array.c:112 #, c-format +msgid "attempt to use function `%s' as an array" +msgstr "`%s' iÅŸlevi dizi olarak kullanılmaya çalışılıyor" + +#: array.c:115 +#, c-format msgid "attempt to use scalar parameter `%s' as an array" msgstr "sayısal paramaetre `%s' bir dizi olarak kullanılmaya çalışılıyor" -#: array.c:113 +#: array.c:118 #, c-format msgid "attempt to use scalar `%s' as array" msgstr "sayısal `%s' dizi olarak kullanılmaya çalışılıyor" -#: array.c:151 +#: array.c:156 #, c-format msgid "from %s" msgstr "%s'den" -#: array.c:506 +#: array.c:511 #, c-format msgid "reference to uninitialized element `%s[\"%s\"]'" msgstr "ilklendirilmemiÅŸ öğeye ( %s[\"%s\"] ) baÅŸvuru yapılıyor" -#: array.c:512 +#: array.c:517 #, c-format msgid "subscript of array `%s' is null string" msgstr "dizinin indisi `%s' bir null dizge" -#: array.c:609 +#: array.c:621 #, c-format msgid "delete: index `%s' not in array `%s'" msgstr "delete: `%s' indeksi `%s' dizisinde deÄŸil" -#: array.c:769 +#: array.c:791 #, c-format msgid "%s: empty (null)\n" msgstr "%s: boÅŸ (null)\n" -#: array.c:774 +#: array.c:796 #, c-format msgid "%s: empty (zero)\n" msgstr "%s: boÅŸ (sıfır)\n" -#: array.c:778 +#: array.c:800 #, c-format msgid "%s: table_size = %d, array_size = %d\n" msgstr "%s: tablo_uzunluÄŸu = %d, dizi_indisi = %d\n" -#: array.c:807 +#: array.c:829 #, c-format msgid "%s: is parameter\n" msgstr "%s: parametredir\n" -#: array.c:812 +#: array.c:834 #, c-format msgid "%s: array_ref to %s\n" msgstr "%s: %s için dizi baÅŸvurusu\n" @@ -89,476 +94,472 @@ msgstr "`%s' bir yerleÅŸik iÅŸlevdir, yeniden atanamaz" msgid "regexp constant `/%s/' looks like a C comment, but is not" msgstr "düzenli ifade sabiti `/%s/' bir C açıklaması gibi görünüyor ama deÄŸil" -#: awkgram.y:340 awkgram.y:615 +#: awkgram.y:341 awkgram.y:619 msgid "statement may have no effect" msgstr "deyim bir etkiye sahip olmayabilir" -#: awkgram.y:435 awkgram.y:455 +#: awkgram.y:436 awkgram.y:456 #, c-format msgid "`%s' used in %s action" msgstr "`%s' %s eyleminde kullanılmış" -#: awkgram.y:448 awkgram.y:451 +#: awkgram.y:449 awkgram.y:452 msgid "`nextfile' is a gawk extension" msgstr "`nextfile' bir gawk uzantısıdır" -#: awkgram.y:465 +#: awkgram.y:466 msgid "`return' used outside function context" msgstr "`return' iÅŸlev baÄŸlamının dışında kullanılmış" -#: awkgram.y:504 +#: awkgram.y:508 msgid "plain `print' in BEGIN or END rule should probably be `print \"\"'" msgstr "BEGIN veya END kuralındaki `print' aslında `print \"\"' olmalıydı" -#: awkgram.y:517 awkgram.y:524 +#: awkgram.y:521 awkgram.y:528 msgid "`delete array' is a gawk extension" msgstr "`delete array' bir gawk uzantısıdır" -#: awkgram.y:532 awkgram.y:539 +#: awkgram.y:536 awkgram.y:543 msgid "`delete(array)' is a non-portable tawk extension" msgstr "`delete array' uyarlanabilir olmayan bir gawk uzantısıdır" -#: awkgram.y:583 +#: awkgram.y:587 #, c-format msgid "duplicate case values in switch body: %s" msgstr "switch içinde yinelenmiÅŸ case deÄŸerleri var: %s" -#: awkgram.y:593 +#: awkgram.y:597 msgid "Duplicate `default' detected in switch body" msgstr "switch içinde yinelenmiÅŸ `default' saptandı" -#: awkgram.y:681 +#: awkgram.y:686 msgid "multistage two-way pipelines don't work" msgstr "çok katlı iki yönlü veriyolları çalışmaz" -#: awkgram.y:772 +#: awkgram.y:777 msgid "regular expression on right of assignment" msgstr "düzenli ifade atamanın sağında" -#: awkgram.y:782 +#: awkgram.y:800 msgid "regular expression on left of `~' or `!~' operator" msgstr "düzenli ifade `~' ya da `!~' iÅŸlemiminin solunda" -#: awkgram.y:790 +#: awkgram.y:808 msgid "regular expression on right of comparison" msgstr "düzenli ifade karşılaÅŸtırmanın sağında" -#: awkgram.y:857 +#: awkgram.y:875 msgid "non-redirected `getline' undefined inside END action" msgstr "END eyleminin içinde yönlendirme yapmayan `getline' tanımsız" -#: awkgram.y:884 +#: awkgram.y:902 msgid "call of `length' without parentheses is not portable" msgstr "parantezsiz `length' çaÄŸrısı taşınabilir deÄŸil" -#: awkgram.y:887 +#: awkgram.y:905 msgid "call of `length' without parentheses is deprecated by POSIX" msgstr "parantezsiz `length' çaÄŸrısı POSIX'e uygun deÄŸil" -#: awkgram.y:940 +#: awkgram.y:958 msgid "use of non-array as array" msgstr "dizi olmayan deÄŸiÅŸken dizi olarak kullanılmış" -#: awkgram.y:942 +#: awkgram.y:960 msgid "invalid subscript expression" msgstr "indis ifadesi geçersiz" -#: awkgram.y:1140 +#: awkgram.y:1158 msgid "unexpected newline or end of string" msgstr "beklenmeyen satırsonu ya da dizge sonu" -#: awkgram.y:1235 +#: awkgram.y:1254 msgid "empty program text on command line" msgstr "komut satırında boÅŸ program metni" -#: awkgram.y:1292 +#: awkgram.y:1307 #, c-format msgid "can't open source file `%s' for reading (%s)" msgstr "kaynak dosyası `%s' okumak için açılamıyor (%s)" -#: awkgram.y:1327 +#: awkgram.y:1384 #, c-format msgid "can't read sourcefile `%s' (%s)" msgstr "kaynak dosyası `%s' okunamıyor (%s)" -#: awkgram.y:1335 +#: awkgram.y:1392 #, c-format msgid "source file `%s' is empty" msgstr "kaynak dosyası `%s' boÅŸ" -#: awkgram.y:1537 awkgram.y:1647 awkgram.y:1665 awkgram.y:2015 awkgram.y:2100 +#: awkgram.y:1590 awkgram.y:1700 awkgram.y:1718 awkgram.y:2068 awkgram.y:2153 msgid "source file does not end in newline" msgstr "kaynak dosyasının sonunda satırsonu eksik" -#: awkgram.y:1601 +#: awkgram.y:1654 msgid "unterminated regexp ends with `\\' at end of file" msgstr "sonlandırılmamış düzenli ifade dosya sonunda `\\' ile bitiyor" -#: awkgram.y:1621 +#: awkgram.y:1674 msgid "unterminated regexp" msgstr "sonlandırılmamış düzenli ifade" -#: awkgram.y:1624 +#: awkgram.y:1677 msgid "unterminated regexp at end of file" msgstr "dosya sonunda sonlandırılmamış düzenli ifade" -#: awkgram.y:1691 +#: awkgram.y:1744 msgid "use of `\\ #...' line continuation is not portable" msgstr "`\\ #...' satır uzatma kullanımı taşınabilir deÄŸil" -#: awkgram.y:1703 +#: awkgram.y:1756 msgid "backslash not last character on line" msgstr "tersbölü satırdaki son karakter deÄŸil" -#: awkgram.y:1748 +#: awkgram.y:1801 msgid "POSIX does not allow operator `**='" msgstr "`**=' iÅŸlemimi POSIX uyumlu deÄŸil" -#: awkgram.y:1750 +#: awkgram.y:1803 msgid "old awk does not support operator `**='" msgstr "`**=' iÅŸlemimini eski awk desteklemiyor" -#: awkgram.y:1759 +#: awkgram.y:1812 msgid "POSIX does not allow operator `**'" msgstr "`**' iÅŸlemimi POSIX uyumlu deÄŸil" -#: awkgram.y:1761 +#: awkgram.y:1814 msgid "old awk does not support operator `**'" msgstr "`**' iÅŸlemimini eski awk desteklemiyor" -#: awkgram.y:1792 +#: awkgram.y:1845 msgid "operator `^=' is not supported in old awk" msgstr "`^=' iÅŸlemimini eski awk desteklemiyor" -#: awkgram.y:1800 +#: awkgram.y:1853 msgid "operator `^' is not supported in old awk" msgstr "`^' iÅŸlemimini eski awk desteklemiyor" -#: awkgram.y:1884 awkgram.y:1901 +#: awkgram.y:1937 awkgram.y:1954 msgid "unterminated string" msgstr "sonlandırılmamış dizge" -#: awkgram.y:2061 +#: awkgram.y:2114 #, c-format msgid "invalid char '%c' in expression" msgstr "ifade içinde '%c' karakteri geçersiz" -#: awkgram.y:2121 +#: awkgram.y:2162 #, c-format msgid "`%s' is a gawk extension" msgstr "`%s' bir gawk uzantısıdır" -#: awkgram.y:2124 +#: awkgram.y:2165 #, c-format msgid "`%s' is a Bell Labs extension" msgstr "`%s' bir Bell Laboratuarları uzantısıdır" -#: awkgram.y:2127 +#: awkgram.y:2168 #, c-format msgid "POSIX does not allow `%s'" msgstr "`%s' POSIX uyumlu deÄŸil" -#: awkgram.y:2131 +#: awkgram.y:2172 #, c-format msgid "`%s' is not supported in old awk" msgstr "`%s' eski awk tarafından desteklemiyor" -#: awkgram.y:2158 +#: awkgram.y:2198 msgid "`goto' considered harmful!\n" msgstr "`goto' zararlı sayılır!\n" -#: awkgram.y:2220 +#: awkgram.y:2260 #, c-format msgid "%d is invalid as number of arguments for %s" msgstr "%d argüman sayısı olarak %s için geçersiz" -#: awkgram.y:2239 awkgram.y:2242 +#: awkgram.y:2279 awkgram.y:2282 msgid "match: third argument is a gawk extension" msgstr "match: üçüncü argüman bir gawk uzantısı" -#: awkgram.y:2255 +#: awkgram.y:2295 #, c-format msgid "%s: string literal as last arg of substitute has no effect" msgstr "%s: yerine kullanılan son argüman olarak dizge sabiti etkisiz" -#: awkgram.y:2258 +#: awkgram.y:2298 #, c-format msgid "%s third parameter is not a changeable object" msgstr "üçüncü %s parametresi deÄŸiÅŸtirilebilir bir nesne deÄŸil" -#: awkgram.y:2285 awkgram.y:2288 +#: awkgram.y:2325 awkgram.y:2328 msgid "close: second argument is a gawk extension" msgstr "close: ikinci argüman bir gawk uzantısı" -#: awkgram.y:2298 +#: awkgram.y:2338 msgid "use of dcgettext(_\"...\") is incorrect: remove leading underscore" msgstr "dcgettext(_\"...\") kullanımı yanlış: altçizgiyi kaldırın" -#: awkgram.y:2313 +#: awkgram.y:2353 msgid "use of dcngettext(_\"...\") is incorrect: remove leading underscore" msgstr "dcngettext(_\"...\") kullanımı yanlış: altçizgiyi kaldırın" -#: awkgram.y:2384 +#: awkgram.y:2424 #, c-format msgid "function `%s': parameter #%d, `%s', duplicates parameter #%d" msgstr "`%s' iÅŸlevi: %d. parametre, `%s', %d. parametrenin tekrarı" -#: awkgram.y:2417 +#: awkgram.y:2457 #, c-format msgid "function `%s': parameter `%s' shadows global variable" msgstr "`%s' iÅŸlevi: parametre, `%s'global deÄŸiÅŸkeni gölgeliyor" -#: awkgram.y:2529 +#: awkgram.y:2569 #, c-format msgid "could not open `%s' for writing (%s)" msgstr "`%s' yazmak için açılamadı (%s)" -#: awkgram.y:2530 profile.c:93 +#: awkgram.y:2570 profile.c:93 msgid "sending profile to standard error" msgstr "profil standart hataya gönderiliyor" -#: awkgram.y:2562 +#: awkgram.y:2602 #, c-format msgid "%s: close failed (%s)" msgstr "%s: kapatma baÅŸarısız (%s)" -#: awkgram.y:2684 +#: awkgram.y:2723 msgid "shadow_funcs() called twice!" msgstr "shadow_funcs() iki kere çaÄŸrıldı!" -#: awkgram.y:2711 +#: awkgram.y:2750 msgid "there were shadowed variables." msgstr "gölgeli deÄŸiÅŸkenler vardı." -#: awkgram.y:2784 +#: awkgram.y:2823 #, c-format msgid "function `%s': can't use function name as parameter name" msgstr "iÅŸlev `%s': iÅŸlev ismi parametre ismi olarak kullanılamaz" -#: awkgram.y:2794 +#: awkgram.y:2833 #, c-format msgid "function name `%s' previously defined" msgstr "iÅŸlev ismi `%s' önceden atanmış" -#: awkgram.y:2945 awkgram.y:2951 +#: awkgram.y:2984 awkgram.y:2990 #, c-format msgid "function `%s' called but never defined" msgstr "`%s' iÅŸlevi çaÄŸrıldı ama hiç atanmamış" -#: awkgram.y:2954 +#: awkgram.y:2993 #, c-format msgid "function `%s' defined but never called" msgstr "`%s' iÅŸlevi atanmış ama hiç çaÄŸrılmadı" -#: awkgram.y:2981 +#: awkgram.y:3020 #, c-format msgid "regexp constant for parameter #%d yields boolean value" msgstr "%d numaralı argüman bir düzenli ifade sabiti" -#: awkgram.y:2994 +#: awkgram.y:3033 #, c-format msgid "" "function `%s' called with space between name and `(',\n" -"%s" +"or used as a variable or an array" msgstr "" "`%s' iÅŸlevi `(' ile isim arasında boÅŸlukla çaÄŸrılmış,\n" -"%s" +"ya da bir deÄŸiÅŸken veya bir dizi olarak kullanılmış" -#: awkgram.y:2996 -msgid "or used as a variable or an array" -msgstr "ya da bir deÄŸiÅŸken ya da dizi olarak kullanılmış" - -#: builtin.c:137 +#: builtin.c:149 #, c-format msgid "%s to \"%s\" failed (%s)" msgstr "%s \"%s\"ya yazılamadı (%s)" -#: builtin.c:138 +#: builtin.c:150 msgid "standard output" msgstr "standart çıktı" -#: builtin.c:139 +#: builtin.c:151 msgid "reason unknown" msgstr "sebebi bilinmiyor" -#: builtin.c:152 +#: builtin.c:164 msgid "exp: received non-numeric argument" msgstr "exp: sayısal olmayan argüman alındı" -#: builtin.c:158 +#: builtin.c:170 #, c-format msgid "exp: argument %g is out of range" msgstr "exp: %g kapsamdışı" -#: builtin.c:216 +#: builtin.c:228 #, c-format msgid "fflush: cannot flush: pipe `%s' opened for reading, not writing" msgstr "" "fflush: kanala yazılamadı: veriyolu `%s' okumak için açıldı, yazmak için " "deÄŸil" -#: builtin.c:219 +#: builtin.c:231 #, c-format msgid "fflush: cannot flush: file `%s' opened for reading, not writing" msgstr "" "fflush: kanala yazılamadı: dosya `%s' okumak için açıldı, yazmak için deÄŸil" -#: builtin.c:231 +#: builtin.c:243 #, c-format msgid "fflush: `%s' is not an open file, pipe or co-process" msgstr "fflush: `%s' bir açık dosya, veriyolu ya da bir yan iÅŸlem deÄŸil" -#: builtin.c:325 +#: builtin.c:338 msgid "index: received non-string first argument" msgstr "index: ilk argüman dizge olmayan türde alındı" -#: builtin.c:327 +#: builtin.c:340 msgid "index: received non-string second argument" msgstr "index: ikinci argüman dizge olmayan türde alındı" -#: builtin.c:437 +#: builtin.c:454 msgid "int: received non-numeric argument" msgstr "int: sayısal olmayan argüman alındı" -#: builtin.c:454 +#: builtin.c:471 msgid "length: received non-string argument" msgstr "length: dizge olmayan argüman alındı" -#: builtin.c:470 +#: builtin.c:487 msgid "log: received non-numeric argument" msgstr "log: sayısal olmayan argüman alındı" -#: builtin.c:473 +#: builtin.c:490 #, c-format msgid "log: received negative argument %g" msgstr "log: negatif argüman %g alındı" -#: builtin.c:635 builtin.c:638 +#: builtin.c:654 builtin.c:657 msgid "must use `count$' on all formats or none" msgstr "tüm biçemlerde ya `count$' kullanmalısınız ya da hiçbir ÅŸey" -#: builtin.c:740 +#: builtin.c:759 msgid "`$' is not permitted in awk formats" msgstr "`$' awk biçemlerde kullanılmaz" -#: builtin.c:746 +#: builtin.c:765 msgid "arg count with `$' must be > 0" msgstr "`$' ile birlikte verilen argüman sayısı > 0 olmalıdır" -#: builtin.c:748 +#: builtin.c:767 #, c-format msgid "arg count %ld greater than total number of supplied arguments" msgstr "argüman sayısı %ld saÄŸlanmış toplam argüman sayısından büyük" -#: builtin.c:750 +#: builtin.c:769 msgid "`$' not permitted after period in format" msgstr "`$' biçem içinde noktadan sonra kullanılmaz" -#: builtin.c:763 +#: builtin.c:782 msgid "no `$' supplied for positional field width or precision" msgstr "konumsal alan geniÅŸliÄŸi ya da duyarlığı için `$' kullanılmamış" -#: builtin.c:821 +#: builtin.c:848 msgid "`l' is meaningless in awk formats; ignored" msgstr "`l' awk biçemlerde anlamsız; yoksayıldı" -#: builtin.c:825 +#: builtin.c:852 msgid "`l' is not permitted in POSIX awk formats" msgstr "`l' POSIX awk biçemlerde kullanılmaz" -#: builtin.c:836 +#: builtin.c:863 msgid "`L' is meaningless in awk formats; ignored" msgstr "`L' awk biçemlerde anlamsız; yoksayıldı" -#: builtin.c:840 +#: builtin.c:867 msgid "`L' is not permitted in POSIX awk formats" msgstr "`L' POSIX awk biçemlerde kullanılmaz" -#: builtin.c:851 +#: builtin.c:878 msgid "`h' is meaningless in awk formats; ignored" msgstr "`h' awk biçemlerde anlamsız; yoksayıldı" -#: builtin.c:855 +#: builtin.c:882 msgid "`h' is not permitted in POSIX awk formats" msgstr "`h' POSIX awk biçemlerde kullanılmaz" -#: builtin.c:1055 +#: builtin.c:1111 #, c-format msgid "[s]printf: value %g is out of range for `%%%c' format" msgstr "[s]printf: %g deÄŸeri `%%%c' biçimi için kapsamdışı" -#: builtin.c:1108 +#: builtin.c:1171 msgid "not enough arguments to satisfy format string" msgstr "biçem dizgesini oluÅŸturacak yeterli argüman yok" -#: builtin.c:1110 +#: builtin.c:1173 msgid "^ ran out for this one" msgstr "bir bunun için ^ tükendi" -#: builtin.c:1115 +#: builtin.c:1178 msgid "[s]printf: format specifier does not have control letter" msgstr "[s]printf: biçem belirteci denetim karakteri içermiyor" -#: builtin.c:1118 +#: builtin.c:1181 msgid "too many arguments supplied for format string" msgstr "biçem dizgesi için çok fazla argüman saÄŸlanmış" -#: builtin.c:1184 builtin.c:1187 +#: builtin.c:1247 builtin.c:1250 msgid "printf: no arguments" msgstr "printf: argüman yok" -#: builtin.c:1211 +#: builtin.c:1274 msgid "sqrt: received non-numeric argument" msgstr "sqrt: sayısal olmayan argüman alındı" -#: builtin.c:1215 +#: builtin.c:1278 #, c-format msgid "sqrt: called with negative argument %g" msgstr "sqrt: negatif argüman %g ile çaÄŸrıldı" -#: builtin.c:1238 +#: builtin.c:1301 #, c-format msgid "substr: start index %g is invalid, using 1" msgstr "substr: baÅŸlangıç indeksi olarak %g geçersiz, 1 kullanılıyor" -#: builtin.c:1243 +#: builtin.c:1306 #, c-format msgid "substr: non-integer start index %g will be truncated" msgstr "" "substr: tamsayı olmayan baÅŸlangıç indeksi %g den ondalık kısım çıkarılacak" -#: builtin.c:1262 -#, fuzzy, c-format +#: builtin.c:1325 +#, c-format msgid "substr: length %g is not >= 1" -msgstr "substr: uzunluk %g <= 0 dır" +msgstr "substr: uzunluk %g >= 1 deÄŸil" -#: builtin.c:1264 -#, fuzzy, c-format +#: builtin.c:1327 +#, c-format msgid "substr: length %g is not >= 0" -msgstr "substr: uzunluk %g <= 0 dır" +msgstr "substr: uzunluk %g => 0 deÄŸil" -#: builtin.c:1271 +#: builtin.c:1334 #, c-format msgid "substr: non-integer length %g will be truncated" msgstr "substr: tamsayı olmayan uzunluk %g den ondalık kısım çıkarılacak" -#: builtin.c:1276 +#: builtin.c:1339 #, c-format msgid "substr: length %g too big for string indexing, truncating to %g" msgstr "" "substr: dizge indislemesi için uzunluk olarak %g çok fazla, %g den sonrası " "gözardı ediliyor" -#: builtin.c:1288 +#: builtin.c:1351 msgid "substr: source string is zero length" msgstr "substr: kaynak dizge sıfır uzunlukta" -#: builtin.c:1294 +#: builtin.c:1357 #, c-format msgid "substr: start index %g is past end of string" msgstr "substr: baÅŸlangıç indisi %g dizgenin sonundan sonra" -#: builtin.c:1302 +#: builtin.c:1365 #, c-format msgid "" "substr: length %g at start index %g exceeds length of first argument (%lu)" @@ -566,288 +567,309 @@ msgstr "" "substr: uzunluk %g, %g baÅŸlangıç indisinde ilk argümanın uzunluÄŸunu (%lu) " "aÅŸar" -#: builtin.c:1337 +#: builtin.c:1400 msgid "strftime: received non-string first argument" msgstr "strftime: ilk argüman dizge olmayan türde alındı" -#: builtin.c:1343 +#: builtin.c:1406 msgid "strftime: received empty format string" msgstr "strftime: boÅŸ biçem dizgesi alındı" -#: builtin.c:1352 +#: builtin.c:1415 msgid "strftime: received non-numeric second argument" msgstr "strftime: ikinci argüman sayısal olmayan türde alındı" -#: builtin.c:1415 +#: builtin.c:1478 msgid "mktime: received non-string argument" msgstr "mktime: dizge olmayan argüman alındı" -#: builtin.c:1460 +#: builtin.c:1523 msgid "system: received non-string argument" msgstr "system: dizge olmayan argüman alındı" -#: builtin.c:1581 eval.c:1883 +#: builtin.c:1644 eval.c:2019 #, c-format msgid "reference to uninitialized field `$%d'" msgstr "ilklendirilmemiÅŸ `$%d' alanına baÅŸvuru" -#: builtin.c:1608 +#: builtin.c:1671 msgid "tolower: received non-string argument" msgstr "tolower: dizge olmayan argüman alındı" -#: builtin.c:1657 +#: builtin.c:1720 msgid "toupper: received non-string argument" msgstr "toupper: dizge olmayan argüman alındı" -#: builtin.c:1702 +#: builtin.c:1765 msgid "atan2: received non-numeric first argument" msgstr "atan2: ilk argüman sayısal olmayan türde alındı" -#: builtin.c:1704 +#: builtin.c:1767 msgid "atan2: received non-numeric second argument" msgstr "atan2: ikinci argüman sayısal olmayan türde alındı" -#: builtin.c:1723 +#: builtin.c:1786 msgid "sin: received non-numeric argument" msgstr "sin: sayısal olmayan argüman alındı" -#: builtin.c:1739 +#: builtin.c:1802 msgid "cos: received non-numeric argument" msgstr "cos: sayısal olmayan argüman alındı" -#: builtin.c:1788 +#: builtin.c:1852 msgid "srand: received non-numeric argument" msgstr "srand: sayısal olmayan argüman alındı" -#: builtin.c:1823 +#: builtin.c:1887 msgid "match: third argument is not an array" msgstr "match: üçüncü argüman bir dizi deÄŸil" -#: builtin.c:2307 +#: builtin.c:2414 msgid "gensub: third argument of 0 treated as 1" msgstr "gensub: 0 olan 3. argüman 1 kabul edildi" -#: builtin.c:2416 builtin.c:2418 +#: builtin.c:2572 msgid "lshift: received non-numeric first argument" msgstr "lshift: ilk argüman sayısal olmayan türde alındı" -#: builtin.c:2420 +#: builtin.c:2574 +msgid "lshift: received non-numeric second argument" +msgstr "lshift: ikinci argüman sayısal deÄŸil" + +#: builtin.c:2580 #, c-format msgid "lshift(%lf, %lf): negative values will give strange results" msgstr "lshift(%lf, %lf): negatif deÄŸerler tuhaf sonuçlar verecek" -#: builtin.c:2422 +#: builtin.c:2582 #, c-format msgid "lshift(%lf, %lf): fractional values will be truncated" msgstr "lshift(%lf, %lf): tamsayı kısım kalacak ÅŸekilde kalanı atılacak" -#: builtin.c:2424 +#: builtin.c:2584 #, c-format msgid "lshift(%lf, %lf): too large shift value will give strange results" msgstr "lshift(%lf, %lf): çok büyük kaydırma deÄŸeri tuhaf sonuçlar verecek" -#: builtin.c:2453 builtin.c:2455 +#: builtin.c:2610 msgid "rshift: received non-numeric first argument" msgstr "rshift: ilk argüman sayısal olmayan türde alındı" -#: builtin.c:2457 +#: builtin.c:2612 +msgid "rshift: received non-numeric second argument" +msgstr "rshift: ikinci argüman sayısal deÄŸil" + +#: builtin.c:2618 #, c-format msgid "rshift(%lf, %lf): negative values will give strange results" msgstr "rshift(%lf, %lf): negatif deÄŸerler tuhaf sonuçlar verecek" -#: builtin.c:2459 +#: builtin.c:2620 #, c-format msgid "rshift(%lf, %lf): fractional values will be truncated" msgstr "rshift(%lf, %lf): tamsayı kısım kalacak ÅŸekilde kalanı atılacak" -#: builtin.c:2461 +#: builtin.c:2622 #, c-format msgid "rshift(%lf, %lf): too large shift value will give strange results" msgstr "rshift(%lf, %lf): çok büyük kaydırma deÄŸeri tuhaf sonuçlar verecek" -#: builtin.c:2490 builtin.c:2492 +#: builtin.c:2648 msgid "and: received non-numeric first argument" msgstr "and: ilk argüman sayısal olmayan türde alındı" -#: builtin.c:2494 +#: builtin.c:2650 +msgid "and: received non-numeric second argument" +msgstr "and: ikinci argüman sayısal deÄŸil" + +#: builtin.c:2656 #, c-format msgid "and(%lf, %lf): negative values will give strange results" msgstr "and(%lf, %lf): negatif deÄŸerler tuhaf sonuçlar verecek" -#: builtin.c:2496 +#: builtin.c:2658 #, c-format msgid "and(%lf, %lf): fractional values will be truncated" msgstr "and(%lf, %lf): tamsayı kısım kalacak ÅŸekilde kalanı atılacak" -#: builtin.c:2525 builtin.c:2527 +#: builtin.c:2684 msgid "or: received non-numeric first argument" msgstr "or: ilk argüman sayısal olmayan türde alındı" -#: builtin.c:2529 +#: builtin.c:2686 +msgid "or: received non-numeric second argument" +msgstr "or: ikinci argüman sayısal deÄŸil" + +#: builtin.c:2692 #, c-format msgid "or(%lf, %lf): negative values will give strange results" msgstr "or(%lf, %lf): negatif deÄŸerler tuhaf sonuçlar verecek" -#: builtin.c:2531 +#: builtin.c:2694 #, c-format msgid "or(%lf, %lf): fractional values will be truncated" msgstr "or(%lf, %lf): tamsayı kısım kalacak ÅŸekilde kalanı atılacak" -#: builtin.c:2560 builtin.c:2562 +#: builtin.c:2720 msgid "xor: received non-numeric first argument" msgstr "xor: ilk argüman sayısal olmayan türde alındı" -#: builtin.c:2564 +#: builtin.c:2722 +msgid "xor: received non-numeric second argument" +msgstr "xor: ikinci argüman sayısal deÄŸil" + +#: builtin.c:2728 #, c-format msgid "xor(%lf, %lf): negative values will give strange results" msgstr "xor(%lf, %lf): negatif deÄŸerler tuhaf sonuçlar verecek" -#: builtin.c:2566 +#: builtin.c:2730 #, c-format msgid "xor(%lf, %lf): fractional values will be truncated" msgstr "xor(%lf, %lf): tamsayı kısım kalacak ÅŸekilde kalanı atılacak" -#: builtin.c:2594 +#: builtin.c:2754 msgid "compl: received non-numeric argument" msgstr "compl: sayısal olmayan argüman alındı" -#: builtin.c:2596 +#: builtin.c:2760 #, c-format msgid "compl(%lf): negative value will give strange results" msgstr "compl(%lf): negatif deÄŸerler tuhaf sonuçlar verecek" -#: builtin.c:2598 +#: builtin.c:2762 #, c-format msgid "compl(%lf): fractional value will be truncated" msgstr "compl(%lf): tamsayı kısım kalacak ÅŸekilde kalanı atılacak" -#: builtin.c:2771 +#: builtin.c:2935 #, c-format msgid "dcgettext: `%s' is not a valid locale category" msgstr "dcgettext: `%s' geçerli bir yerel kategori deÄŸil" -#: eval.c:266 +#: eval.c:303 #, c-format msgid "unknown nodetype %d" msgstr "%d. düğümtürü bilinmiyor" -#: eval.c:312 +#: eval.c:350 msgid "buffer overflow in genflags2str" msgstr "genflags2str içinde tampon taÅŸtı" -#: eval.c:647 +#: eval.c:382 eval.c:388 profile.c:837 +#, c-format +msgid "attempt to use array `%s' in a scalar context" +msgstr "`%s' dizisi bir sayısal baÄŸlamda kullanılmaya çalışılıyor" + +#: eval.c:730 #, c-format msgid "for loop: array `%s' changed size from %ld to %ld during loop execution" msgstr "" "for loop: `%s' dizisinin boyu döngünün yorumlanması sırasında %ld iken %ld " "oldu" -#: eval.c:668 +#: eval.c:751 msgid "`break' outside a loop is not portable" msgstr "döngü dışında `break' kullanımı taşınabilir deÄŸil" -#: eval.c:672 +#: eval.c:755 msgid "`break' outside a loop is not allowed" msgstr "döngü dışında `break' kullanımı yasak" -#: eval.c:689 +#: eval.c:772 msgid "`continue' outside a loop is not portable" msgstr "döngü dışında `continue' kullanımı taşınabilir deÄŸil" -#: eval.c:693 +#: eval.c:776 msgid "`continue' outside a loop is not allowed" msgstr "döngü dışında `continue' kullanımı yasak" -#: eval.c:727 +#: eval.c:810 msgid "`next' cannot be called from a BEGIN rule" msgstr "`next' bir BEGIN kuralından çaÄŸrılamaz" -#: eval.c:729 +#: eval.c:812 msgid "`next' cannot be called from an END rule" msgstr "`next' bir END kuralından çaÄŸrılamaz" -#: eval.c:738 +#: eval.c:821 msgid "`nextfile' cannot be called from a BEGIN rule" msgstr "`nextfile' bir BEGIN kuralından çaÄŸrılamaz" -#: eval.c:740 +#: eval.c:823 msgid "`nextfile' cannot be called from an END rule" msgstr "`nextfile' bir END kuralından çaÄŸrılamaz" -#: eval.c:785 +#: eval.c:872 msgid "statement has no effect" msgstr "deyim etkisiz" -#: eval.c:828 eval.c:1726 +#: eval.c:915 eval.c:1873 #, c-format msgid "can't use function name `%s' as variable or array" msgstr "`%s' iÅŸlev ismi bir deÄŸiÅŸken ya da dizi olarak kullanılamaz" -#: eval.c:835 eval.c:841 +#: eval.c:922 eval.c:928 #, c-format msgid "reference to uninitialized argument `%s'" msgstr "baÅŸlangıç deÄŸeri olmayan `%s' argümanına baÅŸvuru" -#: eval.c:848 eval.c:907 eval.c:1732 eval.c:1742 profile.c:807 -#, c-format -msgid "attempt to use array `%s' in a scalar context" -msgstr "`%s' dizisi bir sayısal baÄŸlamda kullanılmaya çalışılıyor" - -#: eval.c:858 eval.c:1752 +#: eval.c:937 eval.c:1882 #, c-format msgid "reference to uninitialized variable `%s'" msgstr "öndeÄŸer ataması yapılmamış `%s' deÄŸiÅŸkenine baÅŸvuru" -#: eval.c:1007 +#: eval.c:1083 msgid "" "concatenation: side effects in one expression have changed the length of " "another!" msgstr "" "bitiÅŸtirme: bir ifadenin yan etkileri diÄŸerinin uzunluÄŸunu deÄŸiÅŸtirmiÅŸ!" -#: eval.c:1032 +#: eval.c:1162 msgid "assignment used in conditional context" msgstr "koÅŸul baÄŸlamında atama yapılmış" -#: eval.c:1122 +#: eval.c:1252 msgid "division by zero attempted" msgstr "sıfırla bölme hatası" -#: eval.c:1137 +#: eval.c:1267 #, c-format msgid "division by zero attempted in `%%'" msgstr "`%%'de sıfırla bölme hatası" -#: eval.c:1152 profile.c:683 +#: eval.c:1282 profile.c:713 #, c-format msgid "illegal type (%s) in tree_eval" msgstr "tree_eval içinde kuraldışı tür (%s)" -#: eval.c:1328 +#: eval.c:1459 msgid "division by zero attempted in `/='" msgstr "`/='de sıfırla bölme hatası" -#: eval.c:1346 +#: eval.c:1477 #, c-format msgid "division by zero attempted in `%%='" msgstr "`%%='de sıfırla bölme hatası" -#: eval.c:1586 +#: eval.c:1738 #, c-format msgid "function `%s' called with more arguments than declared" msgstr "`%s' iÅŸlevi bildirilenden daha fazla argümanla çaÄŸrıldı" -#: eval.c:1633 +#: eval.c:1782 #, c-format msgid "function `%s' not defined" msgstr "`%s' iÅŸlevi tanımsız" -#: eval.c:1639 +#: eval.c:1788 #, c-format msgid "function %s called\n" msgstr "%s iÅŸlevi çaÄŸrıldı\n" -#: eval.c:1698 +#: eval.c:1845 +#, c-format msgid "" "\n" "\t# Function Call Stack:\n" @@ -857,41 +879,42 @@ msgstr "" "\t# Ä°ÅŸlev ÇaÄŸrı Yığını:\n" "\n" -#: eval.c:1701 +#: eval.c:1848 +#, c-format msgid "\t# -- main --\n" msgstr "\t# -- main --\n" -#: eval.c:1867 +#: eval.c:2003 msgid "attempt to field reference from non-numeric value" msgstr "sayısal olmayan deÄŸerden alan baÅŸvurusu" -#: eval.c:1869 +#: eval.c:2005 msgid "attempt to reference from null string" msgstr "null dizgeden alan baÅŸvurusu" -#: eval.c:1875 +#: eval.c:2011 #, c-format msgid "attempt to access field %d" msgstr "%d. alana eriÅŸilmeye çalışılıyor" -#: eval.c:1896 eval.c:1903 profile.c:900 +#: eval.c:2032 eval.c:2039 profile.c:934 msgid "assignment is not allowed to result of builtin function" msgstr "deÄŸiÅŸken ismine yerleÅŸik iÅŸlevin sonucu atanamaz" -#: eval.c:1951 +#: eval.c:2103 msgid "`IGNORECASE' is a gawk extension" msgstr "`IGNORECASE' bir gawk uzantısıdır" -#: eval.c:1980 +#: eval.c:2133 msgid "`BINMODE' is a gawk extension" msgstr "`BINMODE' bir gawk uzantısıdır" -#: eval.c:2092 +#: eval.c:2255 #, c-format msgid "bad `%sFMT' specification `%s'" msgstr "`%sFMT' özelliÄŸi `%s' hatalı" -#: eval.c:2170 +#: eval.c:2333 msgid "turning off `--lint' due to assignment to `LINT'" msgstr "`LINT' atamasından dolayı `--lint' kapatılıyor" @@ -909,7 +932,60 @@ msgstr "extension: `%s' açılamıyor (%s)\n" msgid "extension: library `%s': cannot call function `%s' (%s)\n" msgstr "extension: kitaplık `%s': `%s' iÅŸlevi çaÄŸrılamıyor (%s)\n" -#: ext.c:183 +#: ext.c:102 +msgid "extension: missing function name" +msgstr "extension: iÅŸlev ismi eksik" + +#: ext.c:107 +#, c-format +msgid "extension: illegal character `%c' in function name `%s'" +msgstr "extension: `%2$s' iÅŸlevindeki `%1$c' karakteri kuraldışı" + +#: ext.c:113 +#, c-format +msgid "extension: can't redefine function `%s'" +msgstr "extension: `%s' iÅŸlevi yeniden tanımlanamaz" + +#: ext.c:117 +#, c-format +msgid "extension: function `%s' already defined" +msgstr "extension: `%s' iÅŸlevi zaten tanımlı" + +#: ext.c:122 +#, c-format +msgid "extension: can't use gawk built-in `%s' as function name" +msgstr "extension: bir gawk yerleÅŸiÄŸi olan `%s' iÅŸlev ismi olamaz" + +#: ext.c:124 +#, c-format +msgid "extension: function name `%s' previously defined" +msgstr "extension: iÅŸlev ismi `%s' evvelce tanımlanmış" + +#: ext.c:201 +#, c-format +msgid "function `%s' defined to take no more than `%d' argument(s)" +msgstr "`%s' iÅŸlevi en çok `%d' argüman alabilecek ÅŸekilde tanımlı" + +#: ext.c:204 +#, c-format +msgid "function `%s': missing argument #%d" +msgstr "`%s' iÅŸlevi: %d. argüman eksik" + +#: ext.c:214 +#, c-format +msgid "function `%s': argument #%d: attempt to use scalar as an array" +msgstr "" +"`%s' iÅŸlevi: %d. argüman: tek deÄŸerli deÄŸiÅŸken bir dizi olarak kullanılmaya " +"çalışılıyor" + +#: ext.c:218 +#, c-format +msgid "function `%s': argument #%d: attempt to use array as a scalar" +msgstr "" +"`%s' iÅŸlevi: %d. argüman: dizi tek deÄŸerli bir deÄŸiÅŸken olarak kullanılmaya " +"çalışılıyor" + +#: ext.c:243 msgid "Operation Not Supported" msgstr "Ä°ÅŸlem Desteklenmiyor" @@ -938,526 +1014,526 @@ msgstr "FIELDWIDTHS içindeki %d. alan > 0 olmalı" msgid "null string for `FS' is a gawk extension" msgstr "`FS' için null dizge bir gawk uzantısıdır" -#: getopt.c:692 getopt.c:704 +#: getopt.c:692 getopt.c:711 #, c-format msgid "%s: option `%s' is ambiguous\n" msgstr "%s: `%s' seçeneÄŸi belirsiz\n" -#: getopt.c:737 getopt.c:741 +#: getopt.c:744 getopt.c:748 #, 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" -#: getopt.c:750 getopt.c:755 +#: getopt.c:757 getopt.c:762 #, 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" -#: getopt.c:791 getopt.c:804 getopt.c:1093 getopt.c:1106 +#: getopt.c:807 getopt.c:829 getopt.c:1159 getopt.c:1181 #, c-format msgid "%s: option `%s' requires an argument\n" msgstr "%s: `%s' seçeneÄŸi bir argümanla kullanılır\n" -#: getopt.c:842 getopt.c:845 +#: getopt.c:867 getopt.c:870 #, c-format msgid "%s: unrecognized option `--%s'\n" msgstr "%s: `--%s' seçeneÄŸi bilinmiyor\n" -#: getopt.c:853 getopt.c:856 +#: getopt.c:878 getopt.c:881 #, c-format msgid "%s: unrecognized option `%c%s'\n" msgstr "%s: `%c%s' seçeneÄŸi bilinmiyor\n" -#: getopt.c:903 getopt.c:906 +#: getopt.c:936 getopt.c:939 #, c-format msgid "%s: illegal option -- %c\n" msgstr "%s: kuraldışı seçenek -- %c\n" -#: getopt.c:912 getopt.c:915 +#: getopt.c:945 getopt.c:948 #, c-format msgid "%s: invalid option -- %c\n" msgstr "%s: geçersiz seçenek -- %c\n" -#: getopt.c:962 getopt.c:973 getopt.c:1159 getopt.c:1172 main.c:434 +#: getopt.c:1003 getopt.c:1022 getopt.c:1234 getopt.c:1255 main.c:433 #, c-format msgid "%s: option requires an argument -- %c\n" msgstr "%s: seçenek bir argümanla kullanılır -- %c\n" -#: getopt.c:1025 getopt.c:1036 +#: getopt.c:1074 getopt.c:1093 #, c-format msgid "%s: option `-W %s' is ambiguous\n" msgstr "%s: `-W %s' seçeneÄŸi belirsiz\n" -#: getopt.c:1060 getopt.c:1072 +#: getopt.c:1117 getopt.c:1138 #, 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" -#: io.c:305 +#: io.c:308 #, c-format msgid "cannot open file `%s' for reading (%s)" msgstr "`%s' okumak için açılamıyor (%s)" -#: io.c:392 +#: io.c:395 #, c-format msgid "close of fd %d (`%s') failed (%s)" msgstr "dosya tanımlayıcı %d (`%s') baÅŸarısız (%s)" -#: io.c:530 +#: io.c:533 #, c-format msgid "invalid tree type %s in redirect()" msgstr "redirect() içindeki aÄŸaç türü %s geçersiz" -#: io.c:536 +#: io.c:539 #, c-format msgid "expression in `%s' redirection only has numeric value" msgstr "`%s' yönlendirmesi içindeki ifade sadece sayısal deÄŸer içeriyor" -#: io.c:542 +#: io.c:545 #, c-format msgid "expression for `%s' redirection has null string value" msgstr "`%s' yönlendirmesi içindeki ifade null dizge deÄŸeri içeriyor" -#: io.c:547 +#: io.c:550 #, c-format msgid "filename `%s' for `%s' redirection may be result of logical expression" msgstr "" "`%s' dosya ismi (`%s' yönlendirmesi için) mantıksal ifadenin sonucu olabilir" -#: io.c:569 +#: io.c:588 #, c-format msgid "unnecessary mixing of `>' and `>>' for file `%.*s'" msgstr "`%.*s' dosyası için `>' ve `>>' karışımı gereksiz" -#: io.c:621 +#: io.c:640 #, c-format msgid "can't open pipe `%s' for output (%s)" msgstr "`%s' veriyolu çıktı için açılamadı (%s)" -#: io.c:630 +#: io.c:649 #, c-format msgid "can't open pipe `%s' for input (%s)" msgstr "`%s' veriyolu girdi için açılamadı (%s)" -#: io.c:643 +#: io.c:662 #, c-format msgid "can't open two way socket `%s' for input/output (%s)" msgstr "iki yönlü `%s' soketi G/Ç için açılamıyor (%s)" -#: io.c:647 +#: io.c:666 #, c-format msgid "can't open two way pipe `%s' for input/output (%s)" msgstr "iki yönlü `%s' veriyolu G/Ç için açılamıyor (%s)" -#: io.c:723 +#: io.c:742 #, c-format msgid "can't redirect from `%s' (%s)" msgstr "`%s'den yönlendirilemiyor (%s)" -#: io.c:726 +#: io.c:745 #, c-format msgid "can't redirect to `%s' (%s)" msgstr "`%s'e yönlendirilemiyor (%s)" -#: io.c:765 +#: io.c:784 msgid "" "reached system limit for open files: starting to multiplex file descriptors" msgstr "" "açık dosyalar için sistem sınırı aşıldı: çoÄŸul dosya tanımlayıcılara " "baÅŸlarken" -#: io.c:777 +#: io.c:800 #, c-format msgid "close of `%s' failed (%s)." msgstr "`%s' kapatılamadı (%s)." -#: io.c:784 +#: io.c:808 msgid "too many pipes or input files open" msgstr "çok fazla veriyolu ya da dosya açık" -#: io.c:807 +#: io.c:831 msgid "close: second argument must be `to' or `from'" msgstr "close: ikinci argüman `to' ya da `from' olmalı" -#: io.c:821 +#: io.c:845 #, c-format msgid "close: `%.*s' is not an open file, pipe or co-process" msgstr "close: `%.*s' bir açık dosya, veriyolu ya da alt-iÅŸlem deÄŸil" -#: io.c:825 +#: io.c:849 msgid "close of redirection that was never opened" msgstr "hiç açılmamış bir yönlendirmenin kapatılması" -#: io.c:862 +#: io.c:945 #, c-format msgid "close: redirection `%s' not opened with `|&', second argument ignored" msgstr "" "close: `%s' yönlendirmesi bir `|&' ile açılmamış, ikinci argüman yoksayıldı" -#: io.c:924 +#: io.c:960 #, c-format msgid "failure status (%d) on pipe close of `%s' (%s)" msgstr "baÅŸarısızlık durumu (%d): `%s' veriyolunun kapatılması (%s)" -#: io.c:927 +#: io.c:963 #, c-format msgid "failure status (%d) on file close of `%s' (%s)" msgstr "baÅŸarısızlık durumu (%d): `%s' dosyasının kapatılması (%s)" -#: io.c:946 +#: io.c:983 #, c-format msgid "no explicit close of socket `%s' provided" msgstr "`%s' soketinin açıkça kapatılması istenmedi" -#: io.c:949 +#: io.c:986 #, c-format msgid "no explicit close of co-process `%s' provided" msgstr "`%s' alt-iÅŸleminin açıkça kapatılması istenmedi" -#: io.c:952 +#: io.c:989 #, c-format msgid "no explicit close of pipe `%s' provided" msgstr "`%s' veriyolunun açıkça kapatılması istenmedi" -#: io.c:955 +#: io.c:992 #, c-format msgid "no explicit close of file `%s' provided" msgstr "`%s' dosyasının açıkça kapatılması istenmedi" -#: io.c:984 io.c:1038 +#: io.c:1021 io.c:1075 #, c-format msgid "error writing standard output (%s)" msgstr "standart çıktıya yazarken hata (%s)" -#: io.c:988 io.c:1042 +#: io.c:1025 io.c:1079 #, c-format msgid "error writing standard error (%s)" msgstr "standart hataya yazarken hata (%s)" -#: io.c:996 +#: io.c:1033 #, c-format msgid "pipe flush of `%s' failed (%s)." msgstr "`%s'in veriyolu ile veri aktarımı baÅŸarısız (%s)." -#: io.c:999 +#: io.c:1036 #, c-format msgid "co-process flush of pipe to `%s' failed (%s)." msgstr "`%s'e veriyolunun alt-iÅŸlemi ile veri aktarımı baÅŸarısız (%s)." -#: io.c:1002 +#: io.c:1039 #, c-format msgid "file flush of `%s' failed (%s)." msgstr "`%s'in dosya ile veri aktarımı baÅŸarısız (%s)." -#: io.c:1161 +#: io.c:1198 msgid "/inet/raw client not ready yet, sorry" msgstr "/inet/raw istemci henüz hazır deÄŸil" -#: io.c:1163 io.c:1200 +#: io.c:1200 io.c:1237 msgid "only root may use `/inet/raw'." msgstr "`/inet/raw' sadece root tarafından kullanılabilir" -#: io.c:1198 +#: io.c:1235 msgid "/inet/raw server not ready yet, sorry" msgstr "/inet/raw sunucu henüz hazır deÄŸil" -#: io.c:1288 +#: io.c:1325 #, c-format msgid "no (known) protocol supplied in special filename `%s'" msgstr "özel dosya ismi `%s' içinde (bilinen) bir protokol saÄŸlanmamış" -#: io.c:1306 +#: io.c:1343 #, c-format msgid "special file name `%s' is incomplete" msgstr "özel dosya ismi `%s' tamamlanmamış" -#: io.c:1318 +#: io.c:1355 #, c-format msgid "local port invalid in `%s'" msgstr "`%s' deki yerel port geçersiz" -#: io.c:1330 +#: io.c:1367 msgid "must supply a remote hostname to `/inet'" msgstr "`/inet' e bir karşı makina ismi saÄŸlanmalı" -#: io.c:1345 +#: io.c:1382 msgid "must supply a remote port to `/inet'" msgstr "`/inet' e bir karşı port saÄŸlanmalı" -#: io.c:1351 +#: io.c:1388 #, c-format msgid "remote port invalid in `%s'" msgstr "`%s' de karşı port geçersiz" -#: io.c:1361 +#: io.c:1398 msgid "TCP/IP communications are not supported" msgstr "TCP/IP haberleÅŸmesi desteklenmiyor" -#: io.c:1370 io.c:1551 +#: io.c:1407 io.c:1588 #, c-format msgid "file `%s' is a directory" msgstr "`%s' dosya deÄŸil dizin" -#: io.c:1440 +#: io.c:1477 #, c-format msgid "use `PROCINFO[\"%s\"]' instead of `%s'" msgstr "`PROCINFO[\"%s\"]' kullanın (`%s' yerine)" -#: io.c:1472 +#: io.c:1509 msgid "use `PROCINFO[...]' instead of `/dev/user'" msgstr "`/dev/user' yerine `PROCINFO[...]' kullanın" -#: io.c:1537 io.c:1711 +#: io.c:1574 io.c:1748 #, c-format msgid "could not open `%s', mode `%s'" msgstr "`%s', `%s' kipinde açılamadı" -#: io.c:1762 +#: io.c:1799 #, c-format msgid "close of master pty failed (%s)" msgstr "ana pty kapatılamadı (%s)" -#: io.c:1764 io.c:1916 io.c:2068 +#: io.c:1801 io.c:1953 io.c:2105 #, c-format msgid "close of stdout in child failed (%s)" msgstr "ast süreçte stdÇ kapatılamadı (%s)" -#: io.c:1767 +#: io.c:1804 #, c-format msgid "moving slave pty to stdout in child failed (dup: %s)" msgstr "ast süreçte yardımcı pty standart çıktıya taşınamadı (dup: %s)" -#: io.c:1769 io.c:1921 +#: io.c:1806 io.c:1958 #, c-format msgid "close of stdin in child failed (%s)" msgstr "ast süreçte stdG kapatılamadı (%s)" -#: io.c:1772 +#: io.c:1809 #, c-format msgid "moving slave pty to stdin in child failed (dup: %s)" msgstr "ast süreçte yardımcı pty standart girdiye taşınamadı (dup: %s)" -#: io.c:1774 io.c:1793 +#: io.c:1811 io.c:1830 #, c-format msgid "close of slave pty failed (%s)" msgstr "yardımcı pty kapatılamadı (%s)" -#: io.c:1867 io.c:1919 io.c:2049 io.c:2071 +#: io.c:1904 io.c:1956 io.c:2086 io.c:2108 #, c-format msgid "moving pipe to stdout in child failed (dup: %s)" msgstr "ast süreçte veriyolu standart çıktıya taşınamadı (dup: %s)" -#: io.c:1871 io.c:1924 +#: io.c:1908 io.c:1961 #, c-format msgid "moving pipe to stdin in child failed (dup: %s)" msgstr "ast süreçte veriyolu standart girdiye taşınamadı (dup: %s)" -#: io.c:1888 io.c:2062 +#: io.c:1925 io.c:2099 msgid "restoring stdout in parent process failed\n" msgstr "üst süreçte stdÇ eski durumuna getirilemedi\n" -#: io.c:1893 +#: io.c:1930 msgid "restoring stdin in parent process failed\n" msgstr "üst süreçte stdG eski durumuna getirilemedi\n" -#: io.c:1927 io.c:2073 io.c:2084 +#: io.c:1964 io.c:2110 io.c:2121 #, c-format msgid "close of pipe failed (%s)" msgstr "veriyolu kapatılamadı (%s)" -#: io.c:1972 +#: io.c:2009 msgid "`|&' not supported" msgstr "`|&' desteklenmiyor" -#: io.c:2039 +#: io.c:2076 #, c-format msgid "cannot open pipe `%s' (%s)" msgstr "`%s' veriyolu açılamıyor (%s)" -#: io.c:2080 +#: io.c:2117 #, c-format msgid "cannot create child process for `%s' (fork: %s)" msgstr "`%s' için ast süreç oluÅŸturulamıyor (fork: %s)" -#: io.c:2423 +#: io.c:2460 #, c-format msgid "data file `%s' is empty" msgstr "veri dosyası `%s' boÅŸ" -#: io.c:2466 io.c:2474 +#: io.c:2503 io.c:2511 msgid "could not allocate more input memory" msgstr "daha fazla girdi belleÄŸi ayrılamadı" -#: io.c:2832 io.c:2895 +#: io.c:2869 io.c:2932 #, c-format msgid "error reading input file `%s': %s" msgstr "`%s' girdi dosyası okunurken hata: %s" -#: io.c:3020 +#: io.c:3057 msgid "multicharacter value of `RS' is a gawk extension" msgstr "`RS' çoklu karakter deÄŸeri bir gawk uzantısıdır" -#: main.c:324 +#: main.c:323 msgid "`-m[fr]' option irrelevant in gawk" msgstr "`-m[fr]' seçeneÄŸi gawk'da böyle kullanılmaz" -#: main.c:326 +#: main.c:325 msgid "-m option usage: `-m[fr] nnn'" msgstr "-m seçeneÄŸinin kullanımı: `-m[fr] nnn'" -#: main.c:343 +#: main.c:342 #, c-format msgid "%s: option `-W %s' unrecognized, ignored\n" msgstr "%s: `-W %s' seçeneÄŸi tanımlı deÄŸil, yok sayıldı\n" -#: main.c:380 +#: main.c:379 msgid "empty argument to `--source' ignored" msgstr "`--source' seçeneÄŸi için boÅŸ argüman yoksayıldı" -#: main.c:451 +#: main.c:450 msgid "environment variable `POSIXLY_CORRECT' set: turning on `--posix'" msgstr "ortam deÄŸiÅŸkeni `POSIXLY_CORRECT' var: `--posix' kullanılıyor" -#: main.c:456 +#: main.c:455 msgid "`--posix' overrides `--traditional'" msgstr "`--posix' seçeneÄŸi `--traditional' seçeneÄŸini etkisiz kılar" -#: main.c:467 +#: main.c:466 msgid "`--posix'/`--traditional' overrides `--non-decimal-data'" msgstr "" "`--posix'/`--traditional' seçenekleri `--non-decimal-data' seçeneÄŸini " "etkisiz kılar" -#: main.c:471 +#: main.c:470 #, c-format msgid "running %s setuid root may be a security problem" msgstr "%s root yetkileriyle çalıştırıldığında güvenlik sorunları olabilir" -#: main.c:512 +#: main.c:511 #, c-format msgid "can't set binary mode on stdin (%s)" msgstr "standart girdi ikilik kipe ayarlanamaz (%s)" -#: main.c:515 +#: main.c:514 #, c-format msgid "can't set binary mode on stdout (%s)" msgstr "standart çıktı ikilik kipe ayarlanamaz (%s)" -#: main.c:517 +#: main.c:516 #, c-format msgid "can't set binary mode on stderr (%s)" msgstr "standart hata ikilik kipe ayarlanamaz (%s)" -#: main.c:547 +#: main.c:546 msgid "no program text at all!" msgstr "program metni hiç yok!" -#: main.c:620 +#: main.c:623 #, c-format msgid "Usage: %s [POSIX or GNU style options] -f progfile [--] file ...\n" msgstr "" "Kullanımı: %s [POSIX veya GNU tarzı seçenekler] -f progdosyası [--] " "dosya ...\n" -#: main.c:622 +#: main.c:625 #, c-format msgid "Usage: %s [POSIX or GNU style options] [--] %cprogram%c file ...\n" msgstr "" "Kullanımı: %s [POSIX veya GNU tarzı seçenekler] %cprogram%c dosya ...\n" -#: main.c:627 +#: main.c:630 msgid "POSIX options:\t\tGNU long options:\n" msgstr "POSIX seçenekleri: GNU uzun seçenekleri:\n" -#: main.c:628 +#: main.c:631 msgid "\t-f progfile\t\t--file=progfile\n" msgstr " -f progDosyası --file=progDosyası\n" -#: main.c:629 +#: main.c:632 msgid "\t-F fs\t\t\t--field-separator=fs\n" msgstr " -F ayraç --field-separator=ayraç\n" -#: main.c:630 +#: main.c:633 msgid "\t-v var=val\t\t--assign=var=val\n" msgstr " -v var=deÄŸer --assign=var=deÄŸer\n" -#: main.c:631 +#: main.c:634 msgid "\t-m[fr] val\n" msgstr " -m[fr] deÄŸer\n" -#: main.c:632 +#: main.c:635 msgid "\t-W compat\t\t--compat\n" msgstr " -W compat --compat\n" -#: main.c:633 +#: main.c:636 msgid "\t-W copyleft\t\t--copyleft\n" msgstr " -W copyleft --copyleft\n" -#: main.c:634 +#: main.c:637 msgid "\t-W copyright\t\t--copyright\n" msgstr " -W copyright --copyright\n" -#: main.c:635 +#: main.c:638 msgid "\t-W dump-variables[=file]\t--dump-variables[=file]\n" msgstr " -W dump-variables[=dosya] --dump-variables[=dosya]\n" -#: main.c:636 +#: main.c:639 msgid "\t-W gen-po\t\t--gen-po\n" msgstr " -W gen-po --gen-po\n" -#: main.c:637 +#: main.c:640 msgid "\t-W help\t\t\t--help\n" msgstr " -W help --help\n" -#: main.c:638 +#: main.c:641 msgid "\t-W lint[=fatal]\t\t--lint[=fatal]\n" msgstr " -W lint[=ölümcül] --lint[=ölümcül]\n" -#: main.c:639 +#: main.c:642 msgid "\t-W lint-old\t\t--lint-old\n" msgstr " -W lint-old --lint-old\n" -#: main.c:640 +#: main.c:643 msgid "\t-W non-decimal-data\t--non-decimal-data\n" msgstr " -W non-decimal-data --non-decimal-data\n" -#: main.c:642 +#: main.c:645 msgid "\t-W nostalgia\t\t--nostalgia\n" msgstr " -W nostalgia --nostalgia\n" -#: main.c:645 +#: main.c:648 msgid "\t-W parsedebug\t\t--parsedebug\n" msgstr " -W parsedebug --parsedebug\n" -#: main.c:647 +#: main.c:650 msgid "\t-W profile[=file]\t--profile[=file]\n" msgstr " -W profile[=dosya] --profile[=dosya]\n" -#: main.c:648 +#: main.c:651 msgid "\t-W posix\t\t--posix\n" msgstr " -W posix --posix\n" -#: main.c:649 +#: main.c:652 msgid "\t-W re-interval\t\t--re-interval\n" msgstr " -W re-interval --re-interval\n" -#: main.c:650 +#: main.c:653 msgid "\t-W source=program-text\t--source=program-text\n" msgstr " -W source=program-metni --source=program-metni\n" -#: main.c:651 +#: main.c:654 msgid "\t-W traditional\t\t--traditional\n" msgstr " -W traditional --traditional\n" -#: main.c:652 +#: main.c:655 msgid "\t-W usage\t\t--usage\n" msgstr " -W usage --usage\n" -#: main.c:653 +#: main.c:656 msgid "\t-W version\t\t--version\n" msgstr " -W version --version\n" -#: main.c:657 +#: main.c:660 msgid "" "\n" "To report bugs, see node `Bugs' in `gawk.info', which is\n" @@ -1471,7 +1547,7 @@ msgstr "" "Çeviri hatalarını adresine bildiriniz.\n" "\n" -#: main.c:661 +#: main.c:664 msgid "" "gawk is a pattern scanning and processing language.\n" "By default it reads standard input and writes standard output.\n" @@ -1481,7 +1557,7 @@ msgstr "" "Öntanımlı olarak standart girdiyi okur ve standart çıktıya yazar.\n" "\n" -#: main.c:665 +#: main.c:668 msgid "" "Examples:\n" "\tgawk '{ sum += $1 }; END { print sum }' file\n" @@ -1491,7 +1567,7 @@ msgstr "" "\tgawk '{ sum += $1 }; END { print sum }' dosya\n" "\tgawk -F: '{ print $1 }' /etc/passwd\n" -#: main.c:682 +#: main.c:685 #, c-format msgid "" "Copyright (C) 1989, 1991-%d Free Software Foundation.\n" @@ -1510,7 +1586,7 @@ msgstr "" "üzerinde deÄŸiÅŸiklik yapabilirsiniz.\n" "\n" -#: main.c:690 +#: main.c:693 msgid "" "This program is distributed in the hope that it will be useful,\n" "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" @@ -1524,7 +1600,7 @@ msgstr "" "edinmek için GNU Genel Kamu Lisansına bakınız.\n" "\n" -#: main.c:696 +#: main.c:699 msgid "" "You should have received a copy of the GNU General Public License\n" "along with this program; if not, write to the Free Software\n" @@ -1534,11 +1610,11 @@ msgstr "" "olacaksınız; yoksa Free Software Foundation, Inc., 59 Temple Place\n" "Suite 330, Boston, MA 02111-1307, USA. adresinden isteyebilirsiniz.\n" -#: main.c:730 +#: main.c:733 msgid "-Ft does not set FS to tab in POSIX awk" msgstr "POSIX awk -Ft ile dosya sistemini belirlemez" -#: main.c:956 +#: main.c:962 #, c-format msgid "" "%s: `%s' argument to `-v' not in `var=value' form\n" @@ -1547,40 +1623,41 @@ msgstr "" "%s: `-v' ile verilen `%s' argümanı `var=deÄŸer' biçiminde deÄŸil\n" "\n" -#: main.c:976 +#: main.c:982 #, c-format msgid "`%s' is not a legal variable name" msgstr "`%s' kurala uygun bir deÄŸiÅŸken ismi deÄŸil" -#: main.c:979 +#: main.c:985 #, c-format msgid "`%s' is not a variable name, looking for file `%s=%s'" msgstr "`%2$s=%3$s' için dosyaya bakınca, `%1$s' bir deÄŸiÅŸken ismi deÄŸil" -#: main.c:1012 +#: main.c:1018 msgid "floating point exception" msgstr "Gerçel sayı istisnası" -#: main.c:1019 +#: main.c:1025 msgid "fatal error: internal error" msgstr "ölümcül iç hata" -#: main.c:1069 +#: main.c:1075 #, c-format msgid "no pre-opened fd %d" msgstr "ön açılışlı bir %d dosya tanımlayıcısı yok" -#: main.c:1074 +#: main.c:1082 #, c-format msgid "could not pre-open /dev/null for fd %d" msgstr "%d dosya tanımlayıcısı için /dev/null ön açılışı yapılamadı" -#: main.c:1097 main.c:1106 +#: main.c:1105 main.c:1114 #, c-format msgid "could not find groups: %s" msgstr "gruplar bulunamadı: %s" #: msg.c:54 +#, c-format msgid "cmd. line:" msgstr "komut satırı:" @@ -1600,19 +1677,19 @@ msgstr "ölümcül: " msgid "can't convert string to float" msgstr "dizge gerçel sayıya dönüştürülemiyor" -#: node.c:355 +#: node.c:357 msgid "backslash at end of string" msgstr "dizge sonunda tersbölü" -#: node.c:539 +#: node.c:541 msgid "POSIX does not allow `\\x' escapes" msgstr "POSIX `\\x' öncelemelerine izin vermez" -#: node.c:545 +#: node.c:547 msgid "no hex digits in `\\x' escape sequence" msgstr "`\\x' önceleme dizgesinde onaltılık rakamlar yok" -#: node.c:579 +#: node.c:581 #, c-format msgid "escape sequence `\\%c' treated as plain `%c'" msgstr "`\\%c' önceleme dizgesi `%c' olarak kullanıldı" @@ -1627,21 +1704,27 @@ msgstr "%s %s `%s': close-on-exec belirlenemedi: (fcntl: %s)" msgid "could not open `%s' for writing: %s" msgstr "`%s' yazmak için açılamadı: %s" -#: profile.c:449 +#: profile.c:467 #, c-format msgid "internal error: %s with null vname" msgstr "iç hata: null vname'li %s" -#: profile.c:512 +#: profile.c:530 msgid "# treated internally as `delete'" msgstr "# dahili olarak `delete' varsayıldı" -#: profile.c:1162 +#: profile.c:1167 +#, c-format +msgid "# this is a dynamically loaded extension function" +msgstr "# bu özdevimli olarak yüklenmiÅŸ bir ek iÅŸlevdir" + +#: profile.c:1198 #, c-format msgid "\t# gawk profile, created %s\n" msgstr "\t# gawk profili, oluÅŸturuldu: %s\n" -#: profile.c:1165 +#: profile.c:1201 +#, c-format msgid "" "\t# BEGIN block(s)\n" "\n" @@ -1649,7 +1732,8 @@ msgstr "" "\t# BEGIN blokları\n" "\n" -#: profile.c:1175 +#: profile.c:1211 +#, c-format msgid "" "\t# Rule(s)\n" "\n" @@ -1657,7 +1741,8 @@ msgstr "" "\t# Kurallar\n" "\n" -#: profile.c:1181 +#: profile.c:1217 +#, c-format msgid "" "\t# END block(s)\n" "\n" @@ -1665,7 +1750,8 @@ msgstr "" "\t# END blokları\n" "\n" -#: profile.c:1201 +#: profile.c:1237 +#, c-format msgid "" "\n" "\t# Functions, listed alphabetically\n" @@ -1673,93 +1759,94 @@ msgstr "" "\n" "\t# Ä°ÅŸlevler, alfabetik sırayla\n" -#: profile.c:1413 +#: profile.c:1452 #, c-format msgid "unexpected type %s in prec_level" msgstr "prec_level'da anlaşılamayan tür %s" -#: re.c:193 -#, c-format -msgid "regex match failed, not enough memory to match string \"%.*s%s\"" -msgstr "" -"düzenli ifade eÅŸleÅŸmesi saÄŸlanamadı, \"%.*s%s\" dizgesini eÅŸleÅŸtirmek için " -"yeterli bellek yok" - -#: regcomp.c:136 +#: regcomp.c:150 msgid "Success" msgstr "BaÅŸarılı" -#: regcomp.c:139 +#: regcomp.c:153 msgid "No match" msgstr "EÅŸleÅŸmez" -#: regcomp.c:142 +#: regcomp.c:156 msgid "Invalid regular expression" msgstr "Düzenli ifade geçersiz" -#: regcomp.c:145 +#: regcomp.c:159 msgid "Invalid collation character" msgstr "KarşılaÅŸtırma karakteri geçersiz" -#: regcomp.c:148 +#: regcomp.c:162 msgid "Invalid character class name" msgstr "Karakter sınıf ismi geçersiz" -#: regcomp.c:151 +#: regcomp.c:165 msgid "Trailing backslash" msgstr "Ä°zleyen tersbölü" -#: regcomp.c:154 +#: regcomp.c:168 msgid "Invalid back reference" msgstr "Geriye baÅŸvuru geçersiz" -#: regcomp.c:157 +#: regcomp.c:171 msgid "Unmatched [ or [^" msgstr "[ ya da [^ eÅŸleÅŸmiyor" -#: regcomp.c:160 +#: regcomp.c:174 msgid "Unmatched ( or \\(" msgstr "( ya da \\( eÅŸleÅŸmiyor" -#: regcomp.c:163 +#: regcomp.c:177 msgid "Unmatched \\{" msgstr "\\{ eÅŸleÅŸmiyor" -#: regcomp.c:166 +#: regcomp.c:180 msgid "Invalid content of \\{\\}" msgstr "\\{\\} içeriÄŸi geçersiz" -#: regcomp.c:169 +#: regcomp.c:183 msgid "Invalid range end" msgstr "Kapsam sonu geçersiz" -#: regcomp.c:172 +#: regcomp.c:186 msgid "Memory exhausted" msgstr "Bellek tükendi" -#: regcomp.c:175 +#: regcomp.c:189 msgid "Invalid preceding regular expression" msgstr "düzenli ifade önceliÄŸi geçersiz" -#: regcomp.c:178 +#: regcomp.c:192 msgid "Premature end of regular expression" msgstr "Düzenli ifade sonu eksik kalmış" -#: regcomp.c:181 +#: regcomp.c:195 msgid "Regular expression too big" msgstr "Düzenli ifade çok büyük" -#: regcomp.c:184 +#: regcomp.c:198 msgid "Unmatched ) or \\)" msgstr ") ya da \\) eÅŸleÅŸmiyor" -#: regcomp.c:621 +#: regcomp.c:668 msgid "No previous regular expression" msgstr "Daha önce düzenli ifade yok" +#~ msgid "or used as a variable or an array" +#~ msgstr "ya da bir deÄŸiÅŸken ya da dizi olarak kullanılmış" + #~ msgid "substr: length %g is < 0" #~ msgstr "substr: uzunluk %g < 0" +#~ msgid "regex match failed, not enough memory to match string \"%.*s%s\"" +#~ msgstr "" +#~ "düzenli ifade eÅŸleÅŸmesi saÄŸlanamadı, \"%.*s%s\" dizgesini eÅŸleÅŸtirmek " +#~ "için yeterli bellek yok" + #~ msgid "delete: illegal use of variable `%s' as array" #~ msgstr "delete: `%s' deÄŸiÅŸkeninin dizi olarak kullanımı kuraldışı" @@ -1778,9 +1865,6 @@ msgstr "Daha önce düzenli ifade yok" #~ msgid "or used in other expression context" #~ msgstr "ya da diÄŸer ifadenin içeriÄŸinde kullanılmış" -#~ msgid "attempt to use function `%s' as array" -#~ msgstr "`%s' iÅŸlevi dizi olarak kullanılmaya çalışılıyor" - #~ msgid "`%s' is a function, assignment is not allowed" #~ msgstr "`%s' bir iÅŸlevdir, bir deÄŸiÅŸken ismi olarak kullanılamaz" diff --git a/posix/ChangeLog b/posix/ChangeLog index b2bcfb1be..e219a40e0 100644 --- a/posix/ChangeLog +++ b/posix/ChangeLog @@ -1,10 +1,14 @@ +Mon Aug 2 12:18:15 2004 Arnold D. Robbins + + * Release 3.1.4: Release tar file made. + Mon Jul 7 11:01:43 2003 Arnold D. Robbins * Release 3.1.3: Release tar file made. Sun May 25 16:23:43 2003 Corinna Vinschen - * gawkmisc.c (cygwin_premain0): New function. + * gawkmisc.c (cygwin_premain0): New function. Wed Mar 19 14:10:31 2003 Arnold D. Robbins diff --git a/posix/gawkmisc.c b/posix/gawkmisc.c index b421766ae..6ee973cc2 100644 --- a/posix/gawkmisc.c +++ b/posix/gawkmisc.c @@ -1,6 +1,6 @@ /* gawkmisc.c --- miscellaneous gawk routines that are OS specific. - Copyright (C) 1986, 1988, 1989, 1991 - 1998, 2001 - 2003 the Free Software Foundation, Inc. + Copyright (C) 1986, 1988, 1989, 1991 - 1998, 2001 - 2004 the 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 @@ -128,7 +128,7 @@ struct stat *stb; #ifdef HAVE_ST_BLKSIZE #define DEFBLKSIZE (stb->st_blksize > 0 ? stb->st_blksize : BUFSIZ) #else -#define DEFBLKSIZE BUFSIZ +#define DEFBLKSIZE BUFSIZ #endif if (S_ISREG(stb->st_mode) /* regular file */ @@ -204,7 +204,7 @@ os_is_setuid() /* os_setbinmode --- set binary mode on file */ int -os_setbinmode (fd, mode) +os_setbinmode(fd, mode) int fd, mode; { return 0; diff --git a/profile.c b/profile.c index 0a5b332fe..956f971f2 100644 --- a/profile.c +++ b/profile.c @@ -3,7 +3,7 @@ */ /* - * Copyright (C) 1999-2003 the Free Software Foundation, Inc. + * Copyright (C) 1999-2004 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. @@ -427,6 +427,24 @@ pprint(register NODE *volatile tree) } } +/* varname --- print a variable name, handling vars done with -v */ + +/* + * When `-v x=x' is given, the varname field ends up including the + * entire text. This gets printed in the profiled output if we're + * not careful. Oops. + * + * XXX: This is a band-aid; we really should fix the -v code. + */ + +static void +varname(const char *name) +{ + for (; *name != '\0' && *name != '='; name++) + putc(*name, prof_fp); + return; +} + /* tree_eval --- evaluate a subtree */ static void @@ -444,7 +462,7 @@ tree_eval(register NODE *tree) case Node_var: case Node_var_array: if (tree->vname != NULL) - fprintf(prof_fp, "%s", tree->vname); + varname(tree->vname); else fatal(_("internal error: %s with null vname"), nodetype2str(tree->type)); @@ -570,6 +588,10 @@ tree_eval(register NODE *tree) fprintf(prof_fp, "BINMODE"); return; + case Node_SUBSEP: + fprintf(prof_fp, "SUBSEP"); + return; + case Node_TEXTDOMAIN: fprintf(prof_fp, "TEXTDOMAIN"); return; @@ -612,6 +634,14 @@ tree_eval(register NODE *tree) tree_eval(tree->rnode); return; + case Node_assign_concat: + tree_eval(tree->lnode); + fprintf(prof_fp, " = "); + tree_eval(tree->lnode); + fprintf(prof_fp, " "); + tree_eval(tree->rnode); + return; + case Node_concat: fprintf(prof_fp, "("); tree_eval(tree->lnode); @@ -864,6 +894,10 @@ pp_lhs(register NODE *ptr) fprintf(prof_fp, "OFS"); break; + case Node_SUBSEP: + fprintf(prof_fp, "SUBSEP"); + break; + case Node_TEXTDOMAIN: fprintf(prof_fp, "TEXTDOMAIN"); break; @@ -1125,10 +1159,12 @@ pp_builtin(register NODE *tree) { const char *func = getfname(tree->builtin); - fprintf(prof_fp, "%s(", func ? func : "extension_function"); - if (func) + if (func != NULL) { + fprintf(prof_fp, "%s(", func); pp_list(tree->subnode); - fprintf(prof_fp, ")"); + fprintf(prof_fp, ")"); + } else + fprintf(prof_fp, _("# this is a dynamically loaded extension function")); } /* pp_func_call --- print a function call */ @@ -1306,6 +1342,7 @@ is_scalar(NODETYPE type) case Node_OFS: case Node_ORS: case Node_RS: + case Node_SUBSEP: case Node_TEXTDOMAIN: case Node_subscript: return TRUE; @@ -1342,6 +1379,7 @@ prec_level(NODETYPE type) case Node_OFS: case Node_ORS: case Node_RS: + case Node_SUBSEP: case Node_TEXTDOMAIN: return 15; @@ -1407,6 +1445,7 @@ prec_level(NODETYPE type) case Node_assign_plus: case Node_assign_minus: case Node_assign_exp: + case Node_assign_concat: return 1; default: diff --git a/re.c b/re.c index 5d9bcb268..55245f757 100644 --- a/re.c +++ b/re.c @@ -3,7 +3,7 @@ */ /* - * Copyright (C) 1991-2003 the Free Software Foundation, Inc. + * Copyright (C) 1991-2004 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. @@ -30,7 +30,7 @@ static reg_syntax_t syn; /* make_regexp --- generate compiled regular expressions */ Regexp * -make_regexp(const char *s, size_t len, int ignorecase) +make_regexp(const char *s, size_t len, int ignorecase, int dfa) { Regexp *rp; const char *rerr; @@ -39,6 +39,9 @@ make_regexp(const char *s, size_t len, int ignorecase) const char *end = s + len; register char *dest; register int c, c2; + static short first = TRUE; + static short no_dfa = FALSE; + int has_anchor = FALSE; #ifdef MBS_SUPPORT /* The number of bytes in the current multbyte character. It is 0, when the current character is a singlebyte character. */ @@ -49,6 +52,11 @@ make_regexp(const char *s, size_t len, int ignorecase) memset(&mbs, 0, sizeof(mbstate_t)); /* Initialize. */ #endif + if (first) { + first = FALSE; + no_dfa = (getenv("GAWK_NO_DFA") != NULL); /* for debugging and testing */ + } + /* Handle escaped characters first. */ /* @@ -131,8 +139,12 @@ make_regexp(const char *s, size_t len, int ignorecase) src++; break; } /* switch */ - } else + } else { + c = *src; + if (c == '^' || c == '$') + has_anchor = TRUE; *dest++ = *src++; /* not '\\' */ + } #ifdef MBS_SUPPORT if (gawk_mb_cur_max > 1 && is_multibyte) is_multibyte--; @@ -145,56 +157,98 @@ make_regexp(const char *s, size_t len, int ignorecase) rp->pat.allocated = 0; /* regex will allocate the buffer */ emalloc(rp->pat.fastmap, char *, 256, "make_regexp"); + /* + * Lo these many years ago, had I known what a P.I.T.A. IGNORECASE + * was going to turn out to be, I wouldn't have bothered with it. + * + * In the case where we have a multibyte character set, we have no + * choice but to use RE_ICASE, since the casetable is for single-byte + * character sets only. + * + * On the other hand, if we do have a single-byte character set, + * using the casetable should give a performance improvement, since + * it's computed only once, not each time a regex is compiled. We + * also think it's probably better for portability. See the + * discussion by the definition of casetable[] in eval.c. + */ +#ifdef MBS_SUPPORT + if (ignorecase) { + if (gawk_mb_cur_max > 1) { + syn |= RE_ICASE; + rp->pat.translate = NULL; + } else { + syn &= ~RE_ICASE; + rp->pat.translate = (char *) casetable; + } + } else { + rp->pat.translate = NULL; + syn &= ~RE_ICASE; + } +#else /* ! MBS_SUPPORT */ if (ignorecase) - rp->pat.translate = casetable; + rp->pat.translate = (char *) casetable; else rp->pat.translate = NULL; +#endif /* ! MBS_SUPPORT */ + + dfasyntax(syn | (ignorecase ? RE_ICASE : 0), ignorecase ? TRUE : FALSE, '\n'); + re_set_syntax(syn); + len = dest - temp; if ((rerr = re_compile_pattern(temp, len, &(rp->pat))) != NULL) fatal("%s: /%s/", rerr, temp); /* rerr already gettextized inside regex routines */ /* gack. this must be done *after* re_compile_pattern */ rp->pat.newline_anchor = FALSE; /* don't get \n in middle of string */ + if (dfa && ! no_dfa) { + dfacomp(temp, len, &(rp->dfareg), TRUE); + rp->dfa = TRUE; + } else + rp->dfa = FALSE; + rp->has_anchor = has_anchor; free(temp); return rp; } -/* research --- do a regexp search */ +/* research --- do a regexp search. use dfa if possible */ int -research(Regexp *rp, register const char *str, int start, +research(Regexp *rp, register char *str, int start, register size_t len, int need_start) { const char *ret = str; + int try_backref; - if (ret) { - /* - * Passing NULL as last arg speeds up search for cases - * where we don't need the start/end info. + /* + * Always do dfa search if can; if it fails, then even if + * need_start is true, we won't bother with the regex search. + */ + if (rp->dfa) { + char save; + int count = 0; + /* + * dfa likes to stick a '\n' right after the matched + * text. So we just save and restore the character. */ - int res = re_search(&(rp->pat), str, start+len, + save = str[start+len]; + ret = dfaexec(&(rp->dfareg), str+start, str+start+len, TRUE, + &count, &try_backref); + str[start+len] = save; + } + + if (ret) { + if (need_start || rp->dfa == FALSE || try_backref) { + /* + * Passing NULL as last arg speeds up search for cases + * where we don't need the start/end info. + */ + int res = re_search(&(rp->pat), str, start+len, start, len, need_start ? &(rp->regs) : NULL); - /* - * A return of -2 indicates that a heuristic in - * regex decided it might allocate too much memory - * on the C stack. This doesn't apply to gawk, which - * uses REGEX_MALLOC. This is dealt with by the - * assignment to re_max_failures in resetup(). - * Naetheless, we keep this code here as a fallback. - * - * XXX: The above comment is obsolete; the new regex - * doesn't have an re_max_failures variable. But we - * keep the code here just in case. - */ - if (res == -2) { - /* the 10 here is arbitrary */ - fatal(_("regex match failed, not enough memory to match string \"%.*s%s\""), - (int) (len > 10 ? 10 : len), str + start, - len > 10 ? "..." : ""); - } - return res; + return res; + } else + return 1; } else return -1; } @@ -217,8 +271,18 @@ refree(Regexp *rp) free(rp->regs.start); if (rp->regs.end) free(rp->regs.end); + if (rp->dfa) + dfafree(&(rp->dfareg)); free(rp); } + +/* dfaerror --- print an error message for the dfa routines */ + +void +dfaerror(const char *s) +{ + fatal("%s", s); +} /* re_update --- recompile a dynamic regexp */ @@ -245,6 +309,10 @@ re_update(NODE *t) } if (t->re_reg != NULL) refree(t->re_reg); + if (t->re_cnt > 0) + t->re_cnt++; + if (t->re_cnt > 10) + t->re_cnt = 0; if (t->re_text == NULL || (t->re_flags & CASE) != IGNORECASE) { t1 = force_string(tree_eval(t->re_exp)); unref(t->re_text); @@ -252,7 +320,7 @@ re_update(NODE *t) free_temp(t1); } t->re_reg = make_regexp(t->re_text->stptr, t->re_text->stlen, - IGNORECASE); + IGNORECASE, t->re_cnt); t->re_flags &= ~CASE; t->re_flags |= IGNORECASE; return t->re_reg; @@ -278,6 +346,24 @@ resetup() syn |= RE_INTERVALS; (void) re_set_syntax(syn); + dfasyntax(syn, FALSE, '\n'); +} + +/* avoid_dfa --- FIXME: temporary kludge function until we have a new dfa.c */ + +int +avoid_dfa(NODE *re, char *str, size_t len) +{ + char *end; + + if (! re->re_reg->has_anchor) + return FALSE; + + for (end = str + len; str < end; str++) + if (*str == '\n') + return TRUE; + + return FALSE; } /* reisstring --- return TRUE if the RE match is a simple string match */ diff --git a/regcomp.c b/regcomp.c index fd417b843..075566fd2 100644 --- a/regcomp.c +++ b/regcomp.c @@ -1,5 +1,5 @@ /* Extended regular expression matching and search library. - Copyright (C) 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa . @@ -18,112 +18,126 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -static reg_errcode_t re_compile_internal _RE_ARGS((regex_t *preg, const char * pattern, - int length, reg_syntax_t syntax)); -static void re_compile_fastmap_iter _RE_ARGS((regex_t *bufp, +static reg_errcode_t re_compile_internal (regex_t *preg, const char * pattern, + int length, reg_syntax_t syntax); +static void re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state, - char *fastmap)); -static reg_errcode_t init_dfa _RE_ARGS((re_dfa_t *dfa, int pat_len)); -static reg_errcode_t init_word_char _RE_ARGS((re_dfa_t *dfa)); + char *fastmap); +static reg_errcode_t init_dfa (re_dfa_t *dfa, int pat_len); +static void init_word_char (re_dfa_t *dfa); #ifdef RE_ENABLE_I18N -static void free_charset _RE_ARGS((re_charset_t *cset)); +static void free_charset (re_charset_t *cset); #endif /* RE_ENABLE_I18N */ -static void free_workarea_compile _RE_ARGS((regex_t *preg)); -static reg_errcode_t create_initial_state _RE_ARGS((re_dfa_t *dfa)); -static reg_errcode_t analyze _RE_ARGS((re_dfa_t *dfa)); -static reg_errcode_t analyze_tree _RE_ARGS((re_dfa_t *dfa, bin_tree_t *node)); -static void calc_first _RE_ARGS((re_dfa_t *dfa, bin_tree_t *node)); -static void calc_next _RE_ARGS((re_dfa_t *dfa, bin_tree_t *node)); -static void calc_epsdest _RE_ARGS((re_dfa_t *dfa, bin_tree_t *node)); -static reg_errcode_t duplicate_node_closure _RE_ARGS((re_dfa_t *dfa, int top_org_node, +static void free_workarea_compile (regex_t *preg); +static reg_errcode_t create_initial_state (re_dfa_t *dfa); +#ifdef RE_ENABLE_I18N +static void optimize_utf8 (re_dfa_t *dfa); +#endif +static reg_errcode_t analyze (re_dfa_t *dfa); +static reg_errcode_t analyze_tree (re_dfa_t *dfa, bin_tree_t *node); +static void calc_first (re_dfa_t *dfa, bin_tree_t *node); +static void calc_next (re_dfa_t *dfa, bin_tree_t *node); +static void calc_epsdest (re_dfa_t *dfa, bin_tree_t *node); +static reg_errcode_t duplicate_node_closure (re_dfa_t *dfa, int top_org_node, int top_clone_node, int root_node, - unsigned int constraint)); -static reg_errcode_t duplicate_node _RE_ARGS((int *new_idx, re_dfa_t *dfa, int org_idx, - unsigned int constraint)); -static int search_duplicated_node _RE_ARGS((re_dfa_t *dfa, int org_node, - unsigned int constraint)); -static reg_errcode_t calc_eclosure _RE_ARGS((re_dfa_t *dfa)); -static reg_errcode_t calc_eclosure_iter _RE_ARGS((re_node_set *new_set, re_dfa_t *dfa, - int node, int root)); -static void calc_inveclosure _RE_ARGS((re_dfa_t *dfa)); -static int fetch_number _RE_ARGS((re_string_t *input, re_token_t *token, - reg_syntax_t syntax)); -static re_token_t fetch_token _RE_ARGS((re_string_t *input, reg_syntax_t syntax)); -static int peek_token _RE_ARGS((re_token_t *token, re_string_t *input, - reg_syntax_t syntax)); -static int peek_token_bracket _RE_ARGS((re_token_t *token, re_string_t *input, - reg_syntax_t syntax)); -static bin_tree_t *parse _RE_ARGS((re_string_t *regexp, regex_t *preg, - reg_syntax_t syntax, reg_errcode_t *err)); -static bin_tree_t *parse_reg_exp _RE_ARGS((re_string_t *regexp, regex_t *preg, + unsigned int constraint); +static reg_errcode_t duplicate_node (int *new_idx, re_dfa_t *dfa, int org_idx, + unsigned int constraint); +static int search_duplicated_node (re_dfa_t *dfa, int org_node, + unsigned int constraint); +static reg_errcode_t calc_eclosure (re_dfa_t *dfa); +static reg_errcode_t calc_eclosure_iter (re_node_set *new_set, re_dfa_t *dfa, + int node, int root); +static void calc_inveclosure (re_dfa_t *dfa); +static int fetch_number (re_string_t *input, re_token_t *token, + reg_syntax_t syntax); +static void fetch_token (re_token_t *result, re_string_t *input, + reg_syntax_t syntax); +static int peek_token (re_token_t *token, re_string_t *input, + reg_syntax_t syntax); +static int peek_token_bracket (re_token_t *token, re_string_t *input, + reg_syntax_t syntax); +static bin_tree_t *parse (re_string_t *regexp, regex_t *preg, + reg_syntax_t syntax, reg_errcode_t *err); +static bin_tree_t *parse_reg_exp (re_string_t *regexp, regex_t *preg, re_token_t *token, reg_syntax_t syntax, - int nest, reg_errcode_t *err)); -static bin_tree_t *parse_branch _RE_ARGS((re_string_t *regexp, regex_t *preg, + int nest, reg_errcode_t *err); +static bin_tree_t *parse_branch (re_string_t *regexp, regex_t *preg, re_token_t *token, reg_syntax_t syntax, - int nest, reg_errcode_t *err)); -static bin_tree_t *parse_expression _RE_ARGS((re_string_t *regexp, regex_t *preg, + int nest, reg_errcode_t *err); +static bin_tree_t *parse_expression (re_string_t *regexp, regex_t *preg, re_token_t *token, reg_syntax_t syntax, - int nest, reg_errcode_t *err)); -static bin_tree_t *parse_sub_exp _RE_ARGS((re_string_t *regexp, regex_t *preg, + int nest, reg_errcode_t *err); +static bin_tree_t *parse_sub_exp (re_string_t *regexp, regex_t *preg, re_token_t *token, reg_syntax_t syntax, - int nest, reg_errcode_t *err)); -static bin_tree_t *parse_dup_op _RE_ARGS((bin_tree_t *dup_elem, re_string_t *regexp, + int nest, reg_errcode_t *err); +static bin_tree_t *parse_dup_op (bin_tree_t *dup_elem, re_string_t *regexp, re_dfa_t *dfa, re_token_t *token, - reg_syntax_t syntax, reg_errcode_t *err)); -static bin_tree_t *parse_bracket_exp _RE_ARGS((re_string_t *regexp, re_dfa_t *dfa, + reg_syntax_t syntax, reg_errcode_t *err); +static bin_tree_t *parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token, reg_syntax_t syntax, - reg_errcode_t *err)); -static reg_errcode_t parse_bracket_element _RE_ARGS((bracket_elem_t *elem, + reg_errcode_t *err); +static reg_errcode_t parse_bracket_element (bracket_elem_t *elem, re_string_t *regexp, re_token_t *token, int token_len, re_dfa_t *dfa, - reg_syntax_t syntax)); -static reg_errcode_t parse_bracket_symbol _RE_ARGS((bracket_elem_t *elem, + reg_syntax_t syntax, + int accept_hyphen); +static reg_errcode_t parse_bracket_symbol (bracket_elem_t *elem, re_string_t *regexp, - re_token_t *token)); + re_token_t *token); #ifndef _LIBC # ifdef RE_ENABLE_I18N -static reg_errcode_t build_range_exp _RE_ARGS((re_bitset_ptr_t sbcset, +static reg_errcode_t build_range_exp (re_bitset_ptr_t sbcset, re_charset_t *mbcset, int *range_alloc, bracket_elem_t *start_elem, - bracket_elem_t *end_elem)); -static reg_errcode_t build_collating_symbol _RE_ARGS((re_bitset_ptr_t sbcset, + bracket_elem_t *end_elem); +static reg_errcode_t build_collating_symbol (re_bitset_ptr_t sbcset, re_charset_t *mbcset, int *coll_sym_alloc, - const unsigned char *name)); + const unsigned char *name); # else /* not RE_ENABLE_I18N */ -static reg_errcode_t build_range_exp _RE_ARGS((re_bitset_ptr_t sbcset, +static reg_errcode_t build_range_exp (re_bitset_ptr_t sbcset, bracket_elem_t *start_elem, - bracket_elem_t *end_elem)); -static reg_errcode_t build_collating_symbol _RE_ARGS((re_bitset_ptr_t sbcset, - const unsigned char *name)); + bracket_elem_t *end_elem); +static reg_errcode_t build_collating_symbol (re_bitset_ptr_t sbcset, + const unsigned char *name); # endif /* not RE_ENABLE_I18N */ #endif /* not _LIBC */ #ifdef RE_ENABLE_I18N -static reg_errcode_t build_equiv_class _RE_ARGS((re_bitset_ptr_t sbcset, +static reg_errcode_t build_equiv_class (re_bitset_ptr_t sbcset, re_charset_t *mbcset, int *equiv_class_alloc, - const unsigned char *name)); -static reg_errcode_t build_charclass _RE_ARGS((RE_TRANSLATE_TYPE trans, + const unsigned char *name); +static reg_errcode_t build_charclass (unsigned RE_TRANSLATE_TYPE trans, re_bitset_ptr_t sbcset, re_charset_t *mbcset, int *char_class_alloc, - const unsigned char *class_name, - reg_syntax_t syntax)); + const char *class_name, + reg_syntax_t syntax); #else /* not RE_ENABLE_I18N */ -static reg_errcode_t build_equiv_class _RE_ARGS((re_bitset_ptr_t sbcset, - const unsigned char *name)); -static reg_errcode_t build_charclass _RE_ARGS((RE_TRANSLATE_TYPE trans, +static reg_errcode_t build_equiv_class (re_bitset_ptr_t sbcset, + const unsigned char *name); +static reg_errcode_t build_charclass (unsigned RE_TRANSLATE_TYPE trans, re_bitset_ptr_t sbcset, - const unsigned char *class_name, - reg_syntax_t syntax)); + const char *class_name, + reg_syntax_t syntax); #endif /* not RE_ENABLE_I18N */ -static bin_tree_t *build_word_op _RE_ARGS((re_dfa_t *dfa, RE_TRANSLATE_TYPE trans, - int not, reg_errcode_t *err)); -static void free_bin_tree _RE_ARGS((bin_tree_t *tree)); -static bin_tree_t *create_tree _RE_ARGS((bin_tree_t *left, bin_tree_t *right, - re_token_type_t type, int index)); -static bin_tree_t *duplicate_tree _RE_ARGS((const bin_tree_t *src, re_dfa_t *dfa)); +static bin_tree_t *build_charclass_op (re_dfa_t *dfa, + unsigned RE_TRANSLATE_TYPE trans, + const char *class_name, + const char *extra, + int non_match, reg_errcode_t *err); +static bin_tree_t *create_tree (re_dfa_t *dfa, + bin_tree_t *left, bin_tree_t *right, + re_token_type_t type, int index); +static bin_tree_t *re_dfa_add_tree_node (re_dfa_t *dfa, + bin_tree_t *left, bin_tree_t *right, + const re_token_t *token) + __attribute ((noinline)); +static bin_tree_t *duplicate_tree (const bin_tree_t *src, re_dfa_t *dfa); +static void mark_opt_subexp (const bin_tree_t *src, re_dfa_t *dfa); +static void mark_opt_subexp_iter (const bin_tree_t *src, re_dfa_t *dfa, int idx); /* 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. @@ -262,9 +276,6 @@ re_set_syntax (syntax) reg_syntax_t ret = re_syntax_options; re_syntax_options = syntax; -#ifdef RE_ENABLE_I18N - re_mb_cur_max = MB_CUR_MAX; -#endif return ret; } #ifdef _LIBC @@ -294,6 +305,7 @@ weak_alias (__re_compile_fastmap, re_compile_fastmap) #endif static inline void +__attribute ((always_inline)) re_set_fastmap (char *fastmap, int icase, int ch) { fastmap[ch] = 1; @@ -312,24 +324,42 @@ re_compile_fastmap_iter (bufp, init_state, fastmap) { re_dfa_t *dfa = (re_dfa_t *) bufp->buffer; int node_cnt; -#ifdef RE_ENABLE_I18N - int icase = (re_mb_cur_max == 1 && (bufp->syntax & RE_ICASE)); -#else - int icase = (bufp->syntax & RE_ICASE); -#endif + int icase = (dfa->mb_cur_max == 1 && (bufp->syntax & RE_ICASE)); for (node_cnt = 0; node_cnt < init_state->nodes.nelem; ++node_cnt) { int node = init_state->nodes.elems[node_cnt]; re_token_type_t type = dfa->nodes[node].type; if (type == CHARACTER) - re_set_fastmap (fastmap, icase, dfa->nodes[node].opr.c); + { + re_set_fastmap (fastmap, icase, dfa->nodes[node].opr.c); +#ifdef RE_ENABLE_I18N + if ((bufp->syntax & RE_ICASE) && dfa->mb_cur_max > 1) + { + unsigned char *buf = alloca (dfa->mb_cur_max), *p; + wchar_t wc; + mbstate_t state; + + p = buf; + *p++ = dfa->nodes[node].opr.c; + while (++node < dfa->nodes_len + && dfa->nodes[node].type == CHARACTER + && dfa->nodes[node].mb_partial) + *p++ = dfa->nodes[node].opr.c; + memset (&state, 0, sizeof (state)); + if (mbrtowc (&wc, (const char *) buf, p - buf, + &state) == p - buf + && __wcrtomb ((char *) buf, towlower (wc), &state) > 0) + re_set_fastmap (fastmap, 0, buf[0]); + } +#endif + } else if (type == SIMPLE_BRACKET) { int i, j, ch; for (i = 0, ch = 0; i < BITSET_UINTS; ++i) for (j = 0; j < UINT_BITS; ++j, ++ch) - if (dfa->nodes[node].opr.sbcset[i] & (1UL << j)) + if (dfa->nodes[node].opr.sbcset[i] & (1 << j)) re_set_fastmap (fastmap, icase, ch); } #ifdef RE_ENABLE_I18N @@ -358,7 +388,7 @@ re_compile_fastmap_iter (bufp, init_state, fastmap) re_set_fastmap (fastmap, icase, ch); } # else - if (re_mb_cur_max > 1) + if (dfa->mb_cur_max > 1) for (i = 0; i < SBC_MAX; ++i) if (__btowc (i) == WEOF) re_set_fastmap (fastmap, icase, i); @@ -371,10 +401,19 @@ re_compile_fastmap_iter (bufp, init_state, fastmap) memset (&state, '\0', sizeof (state)); __wcrtomb (buf, cset->mbchars[i], &state); re_set_fastmap (fastmap, icase, *(unsigned char *) buf); + if ((bufp->syntax & RE_ICASE) && dfa->mb_cur_max > 1) + { + __wcrtomb (buf, towlower (cset->mbchars[i]), &state); + re_set_fastmap (fastmap, 0, *(unsigned char *) buf); + } } } #endif /* RE_ENABLE_I18N */ - else if (type == END_OF_RE || type == OP_PERIOD) + else if (type == OP_PERIOD +#ifdef RE_ENABLE_I18N + || type == OP_UTF8_PERIOD +#endif /* RE_ENABLE_I18N */ + || type == END_OF_RE) { memset (fastmap, '\1', sizeof (char) * SBC_MAX); if (type == END_OF_RE) @@ -464,7 +503,7 @@ regcomp (preg, pattern, cflags) /* We have already checked preg->fastmap != NULL. */ if (BE (ret == REG_NOERROR, 1)) /* Compute the fastmap now, since regexec cannot modify the pattern - buffer. This function nevers fails in this implementation. */ + buffer. This function never fails in this implementation. */ (void) re_compile_fastmap (preg); else { @@ -530,17 +569,18 @@ free_dfa_content (re_dfa_t *dfa) re_free (dfa->subexps); - for (i = 0; i < dfa->nodes_len; ++i) - { - re_token_t *node = dfa->nodes + i; + if (dfa->nodes) + for (i = 0; i < dfa->nodes_len; ++i) + { + re_token_t *node = dfa->nodes + i; #ifdef RE_ENABLE_I18N - if (node->type == COMPLEX_BRACKET && node->duplicated == 0) - free_charset (node->opr.mbcset); - else + if (node->type == COMPLEX_BRACKET && node->duplicated == 0) + free_charset (node->opr.mbcset); + else #endif /* RE_ENABLE_I18N */ - if (node->type == SIMPLE_BRACKET && node->duplicated == 0) - re_free (node->opr.sbcset); - } + if (node->type == SIMPLE_BRACKET && node->duplicated == 0) + re_free (node->opr.sbcset); + } re_free (dfa->nexts); for (i = 0; i < dfa->nodes_len; ++i) { @@ -556,20 +596,21 @@ free_dfa_content (re_dfa_t *dfa) re_free (dfa->inveclosures); re_free (dfa->nodes); - for (i = 0; i <= dfa->state_hash_mask; ++i) - { - struct re_state_table_entry *entry = dfa->state_table + i; - for (j = 0; j < entry->num; ++j) - { - re_dfastate_t *state = entry->array[j]; - free_state (state); - } - re_free (entry->array); - } + if (dfa->state_table) + for (i = 0; i <= dfa->state_hash_mask; ++i) + { + struct re_state_table_entry *entry = dfa->state_table + i; + for (j = 0; j < entry->num; ++j) + { + re_dfastate_t *state = entry->array[j]; + free_state (state); + } + re_free (entry->array); + } re_free (dfa->state_table); - - if (dfa->word_char != NULL) - re_free (dfa->word_char); +#ifdef RE_ENABLE_I18N + re_free (dfa->sb_char); +#endif #ifdef DEBUG re_free (dfa->re_str); #endif @@ -587,8 +628,14 @@ regfree (preg) re_dfa_t *dfa = (re_dfa_t *) preg->buffer; if (BE (dfa != NULL, 1)) free_dfa_content (dfa); + preg->buffer = NULL; + preg->allocated = 0; re_free (preg->fastmap); + preg->fastmap = NULL; + + re_free (preg->translate); + preg->translate = NULL; } #ifdef _LIBC weak_alias (__regfree, regfree) @@ -689,7 +736,7 @@ re_compile_internal (preg, pattern, length, syntax) /* Initialize the dfa. */ dfa = (re_dfa_t *) preg->buffer; - if (preg->allocated < sizeof (re_dfa_t)) + if (BE (preg->allocated < sizeof (re_dfa_t), 0)) { /* If zero allocated, but buffer is non-null, try to realloc enough space. This loses if buffer's address is bogus, but @@ -699,14 +746,14 @@ re_compile_internal (preg, pattern, length, syntax) if (dfa == NULL) return REG_ESPACE; preg->allocated = sizeof (re_dfa_t); + preg->buffer = (unsigned char *) dfa; } - preg->buffer = (unsigned char *) dfa; preg->used = sizeof (re_dfa_t); err = init_dfa (dfa, length); if (BE (err != REG_NOERROR, 0)) { - re_free (dfa); + free_dfa_content (dfa); preg->buffer = NULL; preg->allocated = 0; return err; @@ -717,10 +764,13 @@ re_compile_internal (preg, pattern, length, syntax) #endif err = re_string_construct (®exp, pattern, length, preg->translate, - syntax & RE_ICASE); + syntax & RE_ICASE, dfa); if (BE (err != REG_NOERROR, 0)) { - re_free (dfa); + re_compile_internal_free_return: + free_workarea_compile (preg); + re_string_destruct (®exp); + free_dfa_content (dfa); preg->buffer = NULL; preg->allocated = 0; return err; @@ -732,6 +782,12 @@ re_compile_internal (preg, pattern, length, syntax) if (BE (dfa->str_tree == NULL, 0)) goto re_compile_internal_free_return; +#ifdef RE_ENABLE_I18N + /* If possible, do searching in single byte encoding to speed things up. */ + if (dfa->is_utf8 && !(syntax & RE_ICASE) && preg->translate == NULL) + optimize_utf8 (dfa); +#endif + /* Analyze the tree and collect information which is necessary to create the dfa. */ err = analyze (dfa); @@ -747,7 +803,6 @@ re_compile_internal (preg, pattern, length, syntax) if (BE (err != REG_NOERROR, 0)) { - re_compile_internal_free_return: free_dfa_content (dfa); preg->buffer = NULL; preg->allocated = 0; @@ -768,6 +823,9 @@ init_dfa (dfa, pat_len) memset (dfa, '\0', sizeof (re_dfa_t)); + /* Force allocation of str_tree_storage the first time. */ + dfa->str_tree_storage_idx = BIN_TREE_STORAGE_SIZE; + dfa->nodes_alloc = pat_len + 1; dfa->nodes = re_malloc (re_token_t, dfa->nodes_alloc); @@ -783,18 +841,36 @@ init_dfa (dfa, pat_len) dfa->subexps_alloc = 1; dfa->subexps = re_malloc (re_subexp_t, dfa->subexps_alloc); - dfa->word_char = NULL; - if (BE (dfa->nodes == NULL || dfa->state_table == NULL - || dfa->subexps == NULL, 0)) + dfa->mb_cur_max = MB_CUR_MAX; +#ifdef _LIBC + if (dfa->mb_cur_max == 6 + && strcmp (_NL_CURRENT (LC_CTYPE, _NL_CTYPE_CODESET_NAME), "UTF-8") == 0) + dfa->is_utf8 = 1; + dfa->map_notascii = (_NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MAP_TO_NONASCII) + != 0); +#endif +#ifdef RE_ENABLE_I18N + if (dfa->mb_cur_max > 1) { - /* We don't bother to free anything which was allocated. Very - soon the process will go down anyway. */ - dfa->subexps = NULL; - dfa->state_table = NULL; - dfa->nodes = NULL; - return REG_ESPACE; + int i, j, ch; + + dfa->sb_char = (re_bitset_ptr_t) calloc (sizeof (bitset), 1); + if (BE (dfa->sb_char == NULL, 0)) + return REG_ESPACE; + if (dfa->is_utf8) + memset (dfa->sb_char, 255, sizeof (unsigned int) * BITSET_UINTS / 2); + else + for (i = 0, ch = 0; i < BITSET_UINTS; ++i) + for (j = 0; j < UINT_BITS; ++j, ++ch) + if (btowc (ch) != WEOF) + dfa->sb_char[i] |= 1 << j; } +#endif + + if (BE (dfa->nodes == NULL || dfa->state_table == NULL + || dfa->subexps == NULL, 0)) + return REG_ESPACE; return REG_NOERROR; } @@ -802,19 +878,16 @@ init_dfa (dfa, pat_len) "word". In this case "word" means that it is the word construction character used by some operators like "\<", "\>", etc. */ -static reg_errcode_t +static void init_word_char (dfa) re_dfa_t *dfa; { int i, j, ch; - dfa->word_char = (re_bitset_ptr_t) calloc (sizeof (bitset), 1); - if (BE (dfa->word_char == NULL, 0)) - return REG_ESPACE; + dfa->word_ops_used = 1; for (i = 0, ch = 0; i < BITSET_UINTS; ++i) for (j = 0; j < UINT_BITS; ++j, ++ch) if (isalnum (ch) || ch == '_') - dfa->word_char[i] |= 1UL << j; - return REG_NOERROR; + dfa->word_char[i] |= 1 << j; } /* Free the work area which are only used while compiling. */ @@ -824,7 +897,14 @@ free_workarea_compile (preg) regex_t *preg; { re_dfa_t *dfa = (re_dfa_t *) preg->buffer; - free_bin_tree (dfa->str_tree); + bin_tree_storage_t *storage, *next; + for (storage = dfa->str_tree_storage; storage; storage = next) + { + next = storage->next; + re_free (storage); + } + dfa->str_tree_storage = NULL; + dfa->str_tree_storage_idx = BIN_TREE_STORAGE_SIZE; dfa->str_tree = NULL; re_free (dfa->org_indices); dfa->org_indices = NULL; @@ -910,6 +990,75 @@ create_initial_state (dfa) return REG_NOERROR; } +#ifdef RE_ENABLE_I18N +/* If it is possible to do searching in single byte encoding instead of UTF-8 + to speed things up, set dfa->mb_cur_max to 1, clear is_utf8 and change + DFA nodes where needed. */ + +static void +optimize_utf8 (dfa) + re_dfa_t *dfa; +{ + int node, i, mb_chars = 0, has_period = 0; + + for (node = 0; node < dfa->nodes_len; ++node) + switch (dfa->nodes[node].type) + { + case CHARACTER: + if (dfa->nodes[node].opr.c >= 0x80) + mb_chars = 1; + break; + case ANCHOR: + switch (dfa->nodes[node].opr.idx) + { + case LINE_FIRST: + case LINE_LAST: + case BUF_FIRST: + case BUF_LAST: + break; + default: + /* Word anchors etc. cannot be handled. */ + return; + } + break; + case OP_PERIOD: + has_period = 1; + break; + case OP_BACK_REF: + case OP_ALT: + case END_OF_RE: + case OP_DUP_ASTERISK: + case OP_DUP_QUESTION: + case OP_OPEN_SUBEXP: + case OP_CLOSE_SUBEXP: + break; + case SIMPLE_BRACKET: + /* Just double check. */ + for (i = 0x80 / UINT_BITS; i < BITSET_UINTS; ++i) + if (dfa->nodes[node].opr.sbcset[i]) + return; + break; + default: + return; + } + + if (mb_chars || has_period) + for (node = 0; node < dfa->nodes_len; ++node) + { + if (dfa->nodes[node].type == CHARACTER + && dfa->nodes[node].opr.c >= 0x80) + dfa->nodes[node].mb_partial = 0; + else if (dfa->nodes[node].type == OP_PERIOD) + dfa->nodes[node].type = OP_UTF8_PERIOD; + } + + /* The search can be in single byte locale. */ + dfa->mb_cur_max = 1; + dfa->is_utf8 = 0; + dfa->has_mb_node = dfa->nbackref > 0 || has_period; +} +#endif + /* Analyze the structure tree, and calculate "first", "next", "edest", "eclosure", and "inveclosure". */ @@ -998,6 +1147,7 @@ calc_first (dfa, node) case OP_CLOSE_BRACKET: case OP_OPEN_DUP_NUM: case OP_CLOSE_DUP_NUM: + case OP_DUP_PLUS: case OP_NON_MATCH_LIST: case OP_OPEN_COLL_ELEM: case OP_CLOSE_COLL_ELEM: @@ -1005,7 +1155,7 @@ calc_first (dfa, node) case OP_CLOSE_EQUIV_CLASS: case OP_OPEN_CHAR_CLASS: case OP_CLOSE_CHAR_CLASS: - /* These must not be appeared here. */ + /* These must not appear here. */ assert (0); #endif case END_OF_RE: @@ -1014,6 +1164,7 @@ calc_first (dfa, node) case OP_DUP_ASTERISK: case OP_DUP_QUESTION: #ifdef RE_ENABLE_I18N + case OP_UTF8_PERIOD: case COMPLEX_BRACKET: #endif /* RE_ENABLE_I18N */ case SIMPLE_BRACKET: @@ -1023,14 +1174,6 @@ calc_first (dfa, node) case OP_CLOSE_SUBEXP: node->first = idx; break; - case OP_DUP_PLUS: -#ifdef DEBUG - assert (node->left != NULL); -#endif - if (node->left->first == -1) - calc_first (dfa, node->left); - node->first = node->left->first; - break; case OP_ALT: node->first = idx; break; @@ -1070,7 +1213,6 @@ calc_next (dfa, node) switch (type) { case OP_DUP_ASTERISK: - case OP_DUP_PLUS: node->next = idx; break; case CONCAT: @@ -1105,7 +1247,6 @@ calc_epsdest (dfa, node) if (node->type == 0) { if (dfa->nodes[idx].type == OP_DUP_ASTERISK - || dfa->nodes[idx].type == OP_DUP_PLUS || dfa->nodes[idx].type == OP_DUP_QUESTION) { if (node->left->first == -1) @@ -1149,6 +1290,8 @@ calc_epsdest (dfa, node) || dfa->nodes[idx].type == OP_CLOSE_SUBEXP || dfa->nodes[idx].type == OP_BACK_REF) re_node_set_init_1 (dfa->edests + idx, node->next); + else + assert (!IS_EPSILON_NODE (dfa->nodes[idx].type)); } } @@ -1296,11 +1439,7 @@ duplicate_node (new_idx, dfa, org_idx, constraint) int *new_idx, org_idx; unsigned int constraint; { - re_token_t dup; - int dup_idx; - - dup = dfa->nodes[org_idx]; - dup_idx = re_dfa_add_node (dfa, dup, 1); + int dup_idx = re_dfa_add_node (dfa, dfa->nodes[org_idx], 1); if (BE (dup_idx == -1, 0)) return REG_ESPACE; dfa->nodes[dup_idx].constraint = constraint; @@ -1459,16 +1598,13 @@ calc_eclosure_iter (new_set, dfa, node, root) /* Fetch a token from INPUT. We must not use this function inside bracket expressions. */ -static re_token_t -fetch_token (input, syntax) +static void +fetch_token (result, input, syntax) + re_token_t *result; re_string_t *input; reg_syntax_t syntax; { - re_token_t token; - int consumed_byte; - consumed_byte = peek_token (&token, input, syntax); - re_string_skip_bytes (input, consumed_byte); - return token; + re_string_skip_bytes (input, peek_token (result, input, syntax)); } /* Peek a token from INPUT, and return the length of the token. @@ -1491,9 +1627,10 @@ peek_token (token, input, syntax) c = re_string_peek_byte (input, 0); token->opr.c = c; + token->word_char = 0; #ifdef RE_ENABLE_I18N token->mb_partial = 0; - if (re_mb_cur_max > 1 && + if (input->mb_cur_max > 1 && !re_string_first_byte (input, re_string_cur_idx (input))) { token->type = CHARACTER; @@ -1513,6 +1650,17 @@ peek_token (token, input, syntax) c2 = re_string_peek_byte_case (input, 1); token->opr.c = c2; token->type = CHARACTER; +#ifdef RE_ENABLE_I18N + if (input->mb_cur_max > 1) + { + wint_t wc = re_string_wchar_at (input, + re_string_cur_idx (input) + 1); + token->word_char = IS_WIDE_WORD_CHAR (wc) != 0; + } + else +#endif + token->word_char = IS_WORD_CHAR (c2) != 0; + switch (c2) { case '|': @@ -1531,28 +1679,28 @@ peek_token (token, input, syntax) if (!(syntax & RE_NO_GNU_OPS)) { token->type = ANCHOR; - token->opr.idx = WORD_FIRST; + token->opr.ctx_type = WORD_FIRST; } break; case '>': if (!(syntax & RE_NO_GNU_OPS)) { token->type = ANCHOR; - token->opr.idx = WORD_LAST; + token->opr.ctx_type = WORD_LAST; } break; case 'b': if (!(syntax & RE_NO_GNU_OPS)) { token->type = ANCHOR; - token->opr.idx = WORD_DELIM; + token->opr.ctx_type = WORD_DELIM; } break; case 'B': if (!(syntax & RE_NO_GNU_OPS)) { token->type = ANCHOR; - token->opr.idx = INSIDE_WORD; + token->opr.ctx_type = INSIDE_WORD; } break; case 'w': @@ -1563,18 +1711,28 @@ peek_token (token, input, syntax) if (!(syntax & RE_NO_GNU_OPS)) token->type = OP_NOTWORD; break; +#ifndef GAWK + case 's': + if (!(syntax & RE_NO_GNU_OPS)) + token->type = OP_SPACE; + break; + case 'S': + if (!(syntax & RE_NO_GNU_OPS)) + token->type = OP_NOTSPACE; + break; +#endif case '`': if (!(syntax & RE_NO_GNU_OPS)) { token->type = ANCHOR; - token->opr.idx = BUF_FIRST; + token->opr.ctx_type = BUF_FIRST; } break; case '\'': if (!(syntax & RE_NO_GNU_OPS)) { token->type = ANCHOR; - token->opr.idx = BUF_LAST; + token->opr.ctx_type = BUF_LAST; } break; case '(': @@ -1608,6 +1766,16 @@ peek_token (token, input, syntax) } token->type = CHARACTER; +#ifdef RE_ENABLE_I18N + if (input->mb_cur_max > 1) + { + wint_t wc = re_string_wchar_at (input, re_string_cur_idx (input)); + token->word_char = IS_WIDE_WORD_CHAR (wc) != 0; + } + else +#endif + token->word_char = IS_WORD_CHAR (token->opr.c); + switch (c) { case '\n': @@ -1652,16 +1820,15 @@ peek_token (token, input, syntax) token->type = OP_PERIOD; break; case '^': - if (!(syntax & RE_CONTEXT_INDEP_ANCHORS) && + if (!(syntax & (RE_CONTEXT_INDEP_ANCHORS | RE_CARET_ANCHORS_HERE)) && re_string_cur_idx (input) != 0) { char prev = re_string_peek_byte (input, -1); - if (prev != '|' && prev != '(' && - (!(syntax & RE_NEWLINE_ALT) || prev != '\n')) + if (!(syntax & RE_NEWLINE_ALT) || prev != '\n') break; } token->type = ANCHOR; - token->opr.idx = LINE_FIRST; + token->opr.ctx_type = LINE_FIRST; break; case '$': if (!(syntax & RE_CONTEXT_INDEP_ANCHORS) && @@ -1675,7 +1842,7 @@ peek_token (token, input, syntax) break; } token->type = ANCHOR; - token->opr.idx = LINE_LAST; + token->opr.ctx_type = LINE_LAST; break; default: break; @@ -1702,7 +1869,7 @@ peek_token_bracket (token, input, syntax) token->opr.c = c; #ifdef RE_ENABLE_I18N - if (re_mb_cur_max > 1 && + if (input->mb_cur_max > 1 && !re_string_first_byte (input, re_string_cur_idx (input))) { token->type = CHARACTER; @@ -1710,7 +1877,8 @@ peek_token_bracket (token, input, syntax) } #endif /* RE_ENABLE_I18N */ - if (c == '\\' && (syntax & RE_BACKSLASH_ESCAPE_IN_LISTS)) + if (c == '\\' && (syntax & RE_BACKSLASH_ESCAPE_IN_LISTS) + && re_string_cur_idx (input) + 1 < re_string_length (input)) { /* In this case, '\' escape a character. */ unsigned char c2; @@ -1724,7 +1892,10 @@ peek_token_bracket (token, input, syntax) { unsigned char c2; int token_len; - c2 = re_string_peek_byte (input, 1); + if (re_string_cur_idx (input) + 1 < re_string_length (input)) + c2 = re_string_peek_byte (input, 1); + else + c2 = 0; token->opr.c = c2; token_len = 2; switch (c2) @@ -1791,18 +1962,17 @@ parse (regexp, preg, syntax, err) re_dfa_t *dfa = (re_dfa_t *) preg->buffer; bin_tree_t *tree, *eor, *root; re_token_t current_token; - int new_idx; - current_token = fetch_token (regexp, syntax); + dfa->syntax = syntax; + fetch_token (¤t_token, regexp, syntax | RE_CARET_ANCHORS_HERE); tree = parse_reg_exp (regexp, preg, ¤t_token, syntax, 0, err); if (BE (*err != REG_NOERROR && tree == NULL, 0)) return NULL; - new_idx = re_dfa_add_node (dfa, current_token, 0); - eor = create_tree (NULL, NULL, 0, new_idx); + eor = re_dfa_add_tree_node (dfa, NULL, NULL, ¤t_token); if (tree != NULL) - root = create_tree (tree, eor, CONCAT, 0); + root = create_tree (dfa, tree, eor, CONCAT, 0); else root = eor; - if (BE (new_idx == -1 || eor == NULL || root == NULL, 0)) + if (BE (eor == NULL || root == NULL, 0)) { *err = REG_ESPACE; return NULL; @@ -1830,31 +2000,25 @@ parse_reg_exp (regexp, preg, token, syntax, nest, err) { re_dfa_t *dfa = (re_dfa_t *) preg->buffer; bin_tree_t *tree, *branch = NULL; - int new_idx; tree = parse_branch (regexp, preg, token, syntax, nest, err); if (BE (*err != REG_NOERROR && tree == NULL, 0)) return NULL; while (token->type == OP_ALT) { - re_token_t alt_token; - alt_token = *token; - new_idx = re_dfa_add_node (dfa, alt_token, 0); - *token = fetch_token (regexp, syntax); + re_token_t alt_token = *token; + fetch_token (token, regexp, syntax | RE_CARET_ANCHORS_HERE); if (token->type != OP_ALT && token->type != END_OF_RE && (nest == 0 || token->type != OP_CLOSE_SUBEXP)) { branch = parse_branch (regexp, preg, token, syntax, nest, err); if (BE (*err != REG_NOERROR && branch == NULL, 0)) - { - free_bin_tree (tree); - return NULL; - } + return NULL; } else branch = NULL; - tree = create_tree (tree, branch, 0, new_idx); - if (BE (new_idx == -1 || tree == NULL, 0)) + tree = re_dfa_add_tree_node (dfa, tree, branch, &alt_token); + if (BE (tree == NULL, 0)) { *err = REG_ESPACE; return NULL; @@ -1883,6 +2047,7 @@ parse_branch (regexp, preg, token, syntax, nest, err) reg_errcode_t *err; { bin_tree_t *tree, *exp; + re_dfa_t *dfa = (re_dfa_t *) preg->buffer; tree = parse_expression (regexp, preg, token, syntax, nest, err); if (BE (*err != REG_NOERROR && tree == NULL, 0)) return NULL; @@ -1893,12 +2058,11 @@ parse_branch (regexp, preg, token, syntax, nest, err) exp = parse_expression (regexp, preg, token, syntax, nest, err); if (BE (*err != REG_NOERROR && exp == NULL, 0)) { - free_bin_tree (tree); return NULL; } if (tree != NULL && exp != NULL) { - tree = create_tree (tree, exp, CONCAT, 0); + tree = create_tree (dfa, tree, exp, CONCAT, 0); if (tree == NULL) { *err = REG_ESPACE; @@ -1929,29 +2093,26 @@ parse_expression (regexp, preg, token, syntax, nest, err) { re_dfa_t *dfa = (re_dfa_t *) preg->buffer; bin_tree_t *tree; - int new_idx; switch (token->type) { case CHARACTER: - new_idx = re_dfa_add_node (dfa, *token, 0); - tree = create_tree (NULL, NULL, 0, new_idx); - if (BE (new_idx == -1 || tree == NULL, 0)) + tree = re_dfa_add_tree_node (dfa, NULL, NULL, token); + if (BE (tree == NULL, 0)) { *err = REG_ESPACE; return NULL; } #ifdef RE_ENABLE_I18N - if (re_mb_cur_max > 1) + if (dfa->mb_cur_max > 1) { while (!re_string_eoi (regexp) && !re_string_first_byte (regexp, re_string_cur_idx (regexp))) { bin_tree_t *mbc_remain; - *token = fetch_token (regexp, syntax); - new_idx = re_dfa_add_node (dfa, *token, 0); - mbc_remain = create_tree (NULL, NULL, 0, new_idx); - tree = create_tree (tree, mbc_remain, CONCAT, 0); - if (BE (new_idx == -1 || mbc_remain == NULL || tree == NULL, 0)) + fetch_token (token, regexp, syntax); + mbc_remain = re_dfa_add_tree_node (dfa, NULL, NULL, token); + tree = create_tree (dfa, tree, mbc_remain, CONCAT, 0); + if (BE (mbc_remain == NULL || tree == NULL, 0)) { *err = REG_ESPACE; return NULL; @@ -1977,10 +2138,9 @@ parse_expression (regexp, preg, token, syntax, nest, err) *err = REG_ESUBREG; return NULL; } - dfa->used_bkref_map |= 1UL << (token->opr.idx - 1); - new_idx = re_dfa_add_node (dfa, *token, 0); - tree = create_tree (NULL, NULL, 0, new_idx); - if (BE (new_idx == -1 || tree == NULL, 0)) + dfa->used_bkref_map |= 1 << (token->opr.idx - 1); + tree = re_dfa_add_tree_node (dfa, NULL, NULL, token); + if (BE (tree == NULL, 0)) { *err = REG_ESPACE; return NULL; @@ -1988,10 +2148,16 @@ parse_expression (regexp, preg, token, syntax, nest, err) ++dfa->nbackref; dfa->has_mb_node = 1; break; + case OP_OPEN_DUP_NUM: + if (syntax & RE_CONTEXT_INVALID_DUP) + { + *err = REG_BADRPT; + return NULL; + } + /* FALLTHROUGH */ case OP_DUP_ASTERISK: case OP_DUP_PLUS: case OP_DUP_QUESTION: - case OP_OPEN_DUP_NUM: if (syntax & RE_CONTEXT_INVALID_OPS) { *err = REG_BADRPT; @@ -1999,7 +2165,7 @@ parse_expression (regexp, preg, token, syntax, nest, err) } else if (syntax & RE_CONTEXT_INDEP_OPS) { - *token = fetch_token (regexp, syntax); + fetch_token (token, regexp, syntax); return parse_expression (regexp, preg, token, syntax, nest, err); } /* else fall through */ @@ -2016,37 +2182,30 @@ parse_expression (regexp, preg, token, syntax, nest, err) /* Then we can these characters as normal characters. */ token->type = CHARACTER; - new_idx = re_dfa_add_node (dfa, *token, 0); - tree = create_tree (NULL, NULL, 0, new_idx); - if (BE (new_idx == -1 || tree == NULL, 0)) + /* mb_partial and word_char bits should be initialized already + by peek_token. */ + tree = re_dfa_add_tree_node (dfa, NULL, NULL, token); + if (BE (tree == NULL, 0)) { *err = REG_ESPACE; return NULL; } break; case ANCHOR: - if (dfa->word_char == NULL) - { - *err = init_word_char (dfa); - if (BE (*err != REG_NOERROR, 0)) - return NULL; - } + if ((token->opr.ctx_type + & (WORD_DELIM | INSIDE_WORD | WORD_FIRST | WORD_LAST)) + && dfa->word_ops_used == 0) + init_word_char (dfa); if (token->opr.ctx_type == WORD_DELIM) { bin_tree_t *tree_first, *tree_last; - int idx_first, idx_last; token->opr.ctx_type = WORD_FIRST; - idx_first = re_dfa_add_node (dfa, *token, 0); - tree_first = create_tree (NULL, NULL, 0, idx_first); + tree_first = re_dfa_add_tree_node (dfa, NULL, NULL, token); token->opr.ctx_type = WORD_LAST; - idx_last = re_dfa_add_node (dfa, *token, 0); - tree_last = create_tree (NULL, NULL, 0, idx_last); + tree_last = re_dfa_add_tree_node (dfa, NULL, NULL, token); token->type = OP_ALT; - new_idx = re_dfa_add_node (dfa, *token, 0); - tree = create_tree (tree_first, tree_last, 0, new_idx); - if (BE (idx_first == -1 || idx_last == -1 || new_idx == -1 - || tree_first == NULL || tree_last == NULL - || tree == NULL, 0)) + tree = re_dfa_add_tree_node (dfa, tree_first, tree_last, token); + if (BE (tree_first == NULL || tree_last == NULL || tree == NULL, 0)) { *err = REG_ESPACE; return NULL; @@ -2054,9 +2213,8 @@ parse_expression (regexp, preg, token, syntax, nest, err) } else { - new_idx = re_dfa_add_node (dfa, *token, 0); - tree = create_tree (NULL, NULL, 0, new_idx); - if (BE (new_idx == -1 || tree == NULL, 0)) + tree = re_dfa_add_tree_node (dfa, NULL, NULL, token); + if (BE (tree == NULL, 0)) { *err = REG_ESPACE; return NULL; @@ -2066,28 +2224,35 @@ parse_expression (regexp, preg, token, syntax, nest, err) by repetition operators. eg. RE"^*" is invalid or "", it must not be "". */ - *token = fetch_token (regexp, syntax); + fetch_token (token, regexp, syntax); return tree; case OP_PERIOD: - new_idx = re_dfa_add_node (dfa, *token, 0); - tree = create_tree (NULL, NULL, 0, new_idx); - if (BE (new_idx == -1 || tree == NULL, 0)) + tree = re_dfa_add_tree_node (dfa, NULL, NULL, token); + if (BE (tree == NULL, 0)) { *err = REG_ESPACE; return NULL; } -#ifdef RE_ENABLE_I18N - if (re_mb_cur_max > 1) + if (dfa->mb_cur_max > 1) dfa->has_mb_node = 1; -#endif break; case OP_WORD: - tree = build_word_op (dfa, regexp->trans, 0, err); + tree = build_charclass_op (dfa, regexp->trans, "alnum", "_", 0, err); if (BE (*err != REG_NOERROR && tree == NULL, 0)) return NULL; break; case OP_NOTWORD: - tree = build_word_op (dfa, regexp->trans, 1, err); + tree = build_charclass_op (dfa, regexp->trans, "alnum", "_", 1, err); + if (BE (*err != REG_NOERROR && tree == NULL, 0)) + return NULL; + break; + case OP_SPACE: + tree = build_charclass_op (dfa, regexp->trans, "space", "", 0, err); + if (BE (*err != REG_NOERROR && tree == NULL, 0)) + return NULL; + break; + case OP_NOTSPACE: + tree = build_charclass_op (dfa, regexp->trans, "space", "", 1, err); if (BE (*err != REG_NOERROR && tree == NULL, 0)) return NULL; break; @@ -2104,7 +2269,7 @@ parse_expression (regexp, preg, token, syntax, nest, err) #endif return NULL; } - *token = fetch_token (regexp, syntax); + fetch_token (token, regexp, syntax); while (token->type == OP_DUP_ASTERISK || token->type == OP_DUP_PLUS || token->type == OP_DUP_QUESTION || token->type == OP_OPEN_DUP_NUM) @@ -2112,6 +2277,14 @@ parse_expression (regexp, preg, token, syntax, nest, err) tree = parse_dup_op (tree, regexp, dfa, token, syntax, err); if (BE (*err != REG_NOERROR && tree == NULL, 0)) return NULL; + /* In BRE consecutive duplications are not allowed. */ + if ((syntax & RE_CONTEXT_INVALID_DUP) + && (token->type == OP_DUP_ASTERISK + || token->type == OP_OPEN_DUP_NUM)) + { + *err = REG_BADRPT; + return NULL; + } dfa->has_plural_match = 1; } @@ -2137,9 +2310,8 @@ parse_sub_exp (regexp, preg, token, syntax, nest, err) re_dfa_t *dfa = (re_dfa_t *) preg->buffer; bin_tree_t *tree, *left_par, *right_par; size_t cur_nsub; - int new_idx; cur_nsub = preg->re_nsub++; - if (dfa->subexps_alloc < preg->re_nsub) + if (BE (dfa->subexps_alloc < preg->re_nsub, 0)) { re_subexp_t *new_array; dfa->subexps_alloc *= 2; @@ -2155,15 +2327,14 @@ parse_sub_exp (regexp, preg, token, syntax, nest, err) dfa->subexps[cur_nsub].start = dfa->nodes_len; dfa->subexps[cur_nsub].end = -1; - new_idx = re_dfa_add_node (dfa, *token, 0); - left_par = create_tree (NULL, NULL, 0, new_idx); - if (BE (new_idx == -1 || left_par == NULL, 0)) + left_par = re_dfa_add_tree_node (dfa, NULL, NULL, token); + if (BE (left_par == NULL, 0)) { *err = REG_ESPACE; return NULL; } - dfa->nodes[new_idx].opr.idx = cur_nsub; - *token = fetch_token (regexp, syntax); + dfa->nodes[left_par->node_idx].opr.idx = cur_nsub; + fetch_token (token, regexp, syntax | RE_CARET_ANCHORS_HERE); /* The subexpression may be a null string. */ if (token->type == OP_CLOSE_SUBEXP) @@ -2176,22 +2347,20 @@ parse_sub_exp (regexp, preg, token, syntax, nest, err) } if (BE (token->type != OP_CLOSE_SUBEXP, 0)) { - free_bin_tree (tree); - *err = REG_BADPAT; + *err = REG_EPAREN; return NULL; } - new_idx = re_dfa_add_node (dfa, *token, 0); + right_par = re_dfa_add_tree_node (dfa, NULL, NULL, token); dfa->subexps[cur_nsub].end = dfa->nodes_len; - right_par = create_tree (NULL, NULL, 0, new_idx); tree = ((tree == NULL) ? right_par - : create_tree (tree, right_par, CONCAT, 0)); - tree = create_tree (left_par, tree, CONCAT, 0); - if (BE (new_idx == -1 || right_par == NULL || tree == NULL, 0)) + : create_tree (dfa, tree, right_par, CONCAT, 0)); + tree = create_tree (dfa, left_par, tree, CONCAT, 0); + if (BE (right_par == NULL || tree == NULL, 0)) { *err = REG_ESPACE; return NULL; } - dfa->nodes[new_idx].opr.idx = cur_nsub; + dfa->nodes[right_par->node_idx].opr.idx = cur_nsub; return tree; } @@ -2199,8 +2368,8 @@ parse_sub_exp (regexp, preg, token, syntax, nest, err) /* This function parse repetition operators like "*", "+", "{1,3}" etc. */ static bin_tree_t * -parse_dup_op (dup_elem, regexp, dfa, token, syntax, err) - bin_tree_t *dup_elem; +parse_dup_op (elem, regexp, dfa, token, syntax, err) + bin_tree_t *elem; re_string_t *regexp; re_dfa_t *dfa; re_token_t *token; @@ -2208,16 +2377,14 @@ parse_dup_op (dup_elem, regexp, dfa, token, syntax, err) reg_errcode_t *err; { re_token_t dup_token; - bin_tree_t *tree = dup_elem, *work_tree; - int new_idx, start_idx = re_string_cur_idx (regexp); - re_token_t start_token; - start_token = *token; + bin_tree_t *tree = NULL; + int i, start, end, start_idx = re_string_cur_idx (regexp); + re_token_t start_token = *token; + if (token->type == OP_OPEN_DUP_NUM) { - int i; - int end = 0; - int start = fetch_number (regexp, token, syntax); - bin_tree_t *elem; + end = 0; + start = fetch_number (regexp, token, syntax); if (start == -1) { if (token->type == CHARACTER && token->opr.c == ',') @@ -2238,120 +2405,104 @@ parse_dup_op (dup_elem, regexp, dfa, token, syntax, err) if (BE (start == -2 || end == -2, 0)) { /* Invalid sequence. */ - if (token->type == OP_CLOSE_DUP_NUM) - goto parse_dup_op_invalid_interval; - else - goto parse_dup_op_ebrace; + if (BE (!(syntax & RE_INVALID_INTERVAL_ORD), 0)) + { + if (token->type == END_OF_RE) + *err = REG_EBRACE; + else + *err = REG_BADBR; + + return NULL; + } + + /* If the syntax bit is set, rollback. */ + re_string_set_index (regexp, start_idx); + *token = start_token; + token->type = CHARACTER; + /* mb_partial and word_char bits should be already initialized by + peek_token. */ + return elem; } - if (BE (start == 0 && end == 0, 0)) + + if (BE (end != -1 && start > end, 0)) { - /* We treat "{0}" and "{0,0}" as null string. */ - *token = fetch_token (regexp, syntax); - free_bin_tree (dup_elem); + /* First number greater than second. */ + *err = REG_BADBR; return NULL; } + } + else + { + start = (token->type == OP_DUP_PLUS) ? 1 : 0; + end = (token->type == OP_DUP_QUESTION) ? 1 : -1; + } - /* Extract "{n,m}" to "...{0,}". */ - elem = tree; - for (i = 0; i < start; ++i) - if (i != 0) - { - work_tree = duplicate_tree (elem, dfa); - tree = create_tree (tree, work_tree, CONCAT, 0); - if (BE (work_tree == NULL || tree == NULL, 0)) - goto parse_dup_op_espace; - } + /* Treat "{0}*" etc. as "{0}". */ + if (BE (elem == NULL, 0)) + start = end = 0; - if (end == -1) - { - /* We treat "{0,}" as "*". */ - dup_token.type = OP_DUP_ASTERISK; - if (start > 0) - { - elem = duplicate_tree (elem, dfa); - new_idx = re_dfa_add_node (dfa, dup_token, 0); - work_tree = create_tree (elem, NULL, 0, new_idx); - tree = create_tree (tree, work_tree, CONCAT, 0); - if (BE (elem == NULL || new_idx == -1 || work_tree == NULL - || tree == NULL, 0)) - goto parse_dup_op_espace; - } - else - { - new_idx = re_dfa_add_node (dfa, dup_token, 0); - tree = create_tree (elem, NULL, 0, new_idx); - if (BE (new_idx == -1 || tree == NULL, 0)) - goto parse_dup_op_espace; - } - } - else if (end - start > 0) + /* Extract "{n,m}" to "...{0,}". */ + else if (BE (start > 0, 0)) + { + tree = elem; + for (i = 2; i <= start; ++i) { - /* Then extract "{0,m}" to "??...?". */ - dup_token.type = OP_DUP_QUESTION; - if (start > 0) - { - elem = duplicate_tree (elem, dfa); - new_idx = re_dfa_add_node (dfa, dup_token, 0); - elem = create_tree (elem, NULL, 0, new_idx); - tree = create_tree (tree, elem, CONCAT, 0); - if (BE (elem == NULL || new_idx == -1 || tree == NULL, 0)) - goto parse_dup_op_espace; - } - else - { - new_idx = re_dfa_add_node (dfa, dup_token, 0); - tree = elem = create_tree (elem, NULL, 0, new_idx); - if (BE (new_idx == -1 || tree == NULL, 0)) - goto parse_dup_op_espace; - } - for (i = 1; i < end - start; ++i) - { - work_tree = duplicate_tree (elem, dfa); - tree = create_tree (tree, work_tree, CONCAT, 0); - if (BE (work_tree == NULL || tree == NULL, 0)) - { - *err = REG_ESPACE; - return NULL; - } - } + elem = duplicate_tree (elem, dfa); + tree = create_tree (dfa, tree, elem, CONCAT, 0); + if (BE (elem == NULL || tree == NULL, 0)) + goto parse_dup_op_espace; } } - else + + if (BE (end != start, 1)) { - new_idx = re_dfa_add_node (dfa, *token, 0); - tree = create_tree (tree, NULL, 0, new_idx); - if (BE (new_idx == -1 || tree == NULL, 0)) + dup_token.type = (end == -1 ? OP_DUP_ASTERISK : OP_DUP_QUESTION); + if (BE (start > 0, 0)) { - *err = REG_ESPACE; - return NULL; + elem = duplicate_tree (elem, dfa); + if (BE (elem == NULL, 0)) + goto parse_dup_op_espace; + + /* This subexpression will be marked as optional, so that + empty matches do not touch the registers. */ + mark_opt_subexp (elem, dfa); + + /* Prepare the tree with the modifier. */ + elem = re_dfa_add_tree_node (dfa, elem, NULL, &dup_token); + tree = create_tree (dfa, tree, elem, CONCAT, 0); } + else + { + /* We do not need to duplicate the tree because we have not + created it yet. */ + mark_opt_subexp (elem, dfa); + tree = elem = re_dfa_add_tree_node (dfa, elem, NULL, &dup_token); + } + + if (BE (elem == NULL || tree == NULL, 0)) + goto parse_dup_op_espace; + + /* This loop is actually executed only when end != -1, + to rewrite {0,n} as ???... We have + already created the start+1-th copy. */ + for (i = start + 2; i <= end; ++i) + { + elem = duplicate_tree (elem, dfa); + tree = create_tree (dfa, tree, elem, CONCAT, 0); + if (BE (elem == NULL || tree == NULL, 0)) + { + *err = REG_ESPACE; + return NULL; + } + } } - *token = fetch_token (regexp, syntax); + + fetch_token (token, regexp, syntax); return tree; parse_dup_op_espace: - free_bin_tree (tree); *err = REG_ESPACE; return NULL; - - parse_dup_op_ebrace: - if (BE (!(syntax & RE_INVALID_INTERVAL_ORD), 0)) - { - *err = REG_EBRACE; - return NULL; - } - goto parse_dup_op_rollback; - parse_dup_op_invalid_interval: - if (BE (!(syntax & RE_INVALID_INTERVAL_ORD), 0)) - { - *err = REG_BADBR; - return NULL; - } - parse_dup_op_rollback: - re_string_set_index (regexp, start_idx); - *token = start_token; - token->type = CHARACTER; - return dup_elem; } /* Size of the names for collating symbol/equivalence_class/character_class. @@ -2407,38 +2558,46 @@ build_range_exp (sbcset, start_elem, end_elem) ? __btowc (start_ch) : start_elem->opr.wch); end_wc = ((end_elem->type == SB_CHAR || end_elem->type == COLL_SYM) ? __btowc (end_ch) : end_elem->opr.wch); - cmp_buf[0] = start_wc; - cmp_buf[4] = end_wc; + cmp_buf[0] = start_wc != WEOF ? start_wc : start_ch; + cmp_buf[4] = end_wc != WEOF ? end_wc : end_ch; if (wcscoll (cmp_buf, cmp_buf + 4) > 0) return REG_ERANGE; - /* Check the space of the arrays. */ - if (*range_alloc == mbcset->nranges) + /* Got valid collation sequence values, add them as a new entry. + However, for !_LIBC we have no collation elements: if the + character set is single byte, the single byte character set + that we build below suffices. parse_bracket_exp passes + no MBCSET if dfa->mb_cur_max == 1. */ + if (mbcset) { - /* There are not enough space, need realloc. */ - wchar_t *new_array_start, *new_array_end; - int new_nranges; - - /* +1 in case of mbcset->nranges is 0. */ - new_nranges = 2 * mbcset->nranges + 1; - /* Use realloc since mbcset->range_starts and mbcset->range_ends - are NULL if *range_alloc == 0. */ - new_array_start = re_realloc (mbcset->range_starts, wchar_t, - new_nranges); - new_array_end = re_realloc (mbcset->range_ends, wchar_t, - new_nranges); - - if (BE (new_array_start == NULL || new_array_end == NULL, 0)) - return REG_ESPACE; - - mbcset->range_starts = new_array_start; - mbcset->range_ends = new_array_end; - *range_alloc = new_nranges; + /* Check the space of the arrays. */ + if (BE (*range_alloc == mbcset->nranges, 0)) + { + /* There is not enough space, need realloc. */ + wchar_t *new_array_start, *new_array_end; + int new_nranges; + + /* +1 in case of mbcset->nranges is 0. */ + new_nranges = 2 * mbcset->nranges + 1; + /* Use realloc since mbcset->range_starts and mbcset->range_ends + are NULL if *range_alloc == 0. */ + new_array_start = re_realloc (mbcset->range_starts, wchar_t, + new_nranges); + new_array_end = re_realloc (mbcset->range_ends, wchar_t, + new_nranges); + + if (BE (new_array_start == NULL || new_array_end == NULL, 0)) + return REG_ESPACE; + + mbcset->range_starts = new_array_start; + mbcset->range_ends = new_array_end; + *range_alloc = new_nranges; + } + + mbcset->range_starts[mbcset->nranges] = start_wc; + mbcset->range_ends[mbcset->nranges++] = end_wc; } - mbcset->range_starts[mbcset->nranges] = start_wc; - mbcset->range_ends[mbcset->nranges++] = end_wc; - /* Build the table for single byte characters. */ for (wc = 0; wc <= SBC_MAX; ++wc) { @@ -2522,6 +2681,7 @@ parse_bracket_exp (regexp, dfa, token, syntax, err) Return the index of the symbol in the SYMB_TABLE. */ static inline int32_t + __attribute ((always_inline)) seek_collating_symbol_entry (name, name_len) const unsigned char *name; size_t name_len; @@ -2554,25 +2714,26 @@ parse_bracket_exp (regexp, dfa, token, syntax, err) Return the value if succeeded, UINT_MAX otherwise. */ static inline unsigned int + __attribute ((always_inline)) lookup_collation_sequence_value (br_elem) bracket_elem_t *br_elem; { if (br_elem->type == SB_CHAR) { /* - if (re_mb_cur_max == 1) + if (MB_CUR_MAX == 1) */ if (nrules == 0) return collseqmb[br_elem->opr.ch]; else { wint_t wc = __btowc (br_elem->opr.ch); - return collseq_table_lookup (collseqwc, wc); + return __collseq_table_lookup (collseqwc, wc); } } else if (br_elem->type == MB_CHAR) { - return collseq_table_lookup (collseqwc, br_elem->opr.wch); + return __collseq_table_lookup (collseqwc, br_elem->opr.wch); } else if (br_elem->type == COLL_SYM) { @@ -2621,13 +2782,10 @@ parse_bracket_exp (regexp, dfa, token, syntax, err) update it. */ static inline reg_errcode_t -# ifdef RE_ENABLE_I18N + __attribute ((always_inline)) build_range_exp (sbcset, mbcset, range_alloc, start_elem, end_elem) re_charset_t *mbcset; int *range_alloc; -# else /* not RE_ENABLE_I18N */ - build_range_exp (sbcset, start_elem, end_elem) -# endif /* not RE_ENABLE_I18N */ re_bitset_ptr_t sbcset; bracket_elem_t *start_elem, *end_elem; { @@ -2635,33 +2793,6 @@ parse_bracket_exp (regexp, dfa, token, syntax, err) uint32_t start_collseq; uint32_t end_collseq; -# ifdef RE_ENABLE_I18N - /* Check the space of the arrays. */ - if (*range_alloc == mbcset->nranges) - { - /* There are not enough space, need realloc. */ - uint32_t *new_array_start; - uint32_t *new_array_end; - int new_nranges; - - /* +1 in case of mbcset->nranges is 0. */ - new_nranges = 2 * mbcset->nranges + 1; - /* Use realloc since mbcset->range_starts and mbcset->range_ends - are NULL if *range_alloc == 0. */ - new_array_start = re_realloc (mbcset->range_starts, uint32_t, - new_nranges); - new_array_end = re_realloc (mbcset->range_ends, uint32_t, - new_nranges); - - if (BE (new_array_start == NULL || new_array_end == NULL, 0)) - return REG_ESPACE; - - mbcset->range_starts = new_array_start; - mbcset->range_ends = new_array_end; - *range_alloc = new_nranges; - } -# endif /* RE_ENABLE_I18N */ - /* Equivalence Classes and Character Classes can't be a range start/end. */ if (BE (start_elem->type == EQUIV_CLASS || start_elem->type == CHAR_CLASS @@ -2677,23 +2808,50 @@ parse_bracket_exp (regexp, dfa, token, syntax, err) if (BE ((syntax & RE_NO_EMPTY_RANGES) && start_collseq > end_collseq, 0)) return REG_ERANGE; -# ifdef RE_ENABLE_I18N - /* Got valid collation sequence values, add them as a new entry. */ - mbcset->range_starts[mbcset->nranges] = start_collseq; - mbcset->range_ends[mbcset->nranges++] = end_collseq; -# endif /* RE_ENABLE_I18N */ + /* Got valid collation sequence values, add them as a new entry. + However, if we have no collation elements, and the character set + is single byte, the single byte character set that we + build below suffices. */ + if (nrules > 0 || dfa->mb_cur_max > 1) + { + /* Check the space of the arrays. */ + if (BE (*range_alloc == mbcset->nranges, 0)) + { + /* There is not enough space, need realloc. */ + uint32_t *new_array_start; + uint32_t *new_array_end; + int new_nranges; + + /* +1 in case of mbcset->nranges is 0. */ + new_nranges = 2 * mbcset->nranges + 1; + new_array_start = re_realloc (mbcset->range_starts, uint32_t, + new_nranges); + new_array_end = re_realloc (mbcset->range_ends, uint32_t, + new_nranges); + + if (BE (new_array_start == NULL || new_array_end == NULL, 0)) + return REG_ESPACE; + + mbcset->range_starts = new_array_start; + mbcset->range_ends = new_array_end; + *range_alloc = new_nranges; + } + + mbcset->range_starts[mbcset->nranges] = start_collseq; + mbcset->range_ends[mbcset->nranges++] = end_collseq; + } /* Build the table for single byte characters. */ for (ch = 0; ch <= SBC_MAX; ch++) { uint32_t ch_collseq; /* - if (re_mb_cur_max == 1) + if (MB_CUR_MAX == 1) */ if (nrules == 0) ch_collseq = collseqmb[ch]; else - ch_collseq = collseq_table_lookup (collseqwc, __btowc (ch)); + ch_collseq = __collseq_table_lookup (collseqwc, __btowc (ch)); if (start_collseq <= ch_collseq && ch_collseq <= end_collseq) bitset_set (sbcset, ch); } @@ -2707,13 +2865,10 @@ parse_bracket_exp (regexp, dfa, token, syntax, err) pointer argument sinse we may update it. */ static inline reg_errcode_t -# ifdef RE_ENABLE_I18N + __attribute ((always_inline)) build_collating_symbol (sbcset, mbcset, coll_sym_alloc, name) re_charset_t *mbcset; int *coll_sym_alloc; -# else /* not RE_ENABLE_I18N */ - build_collating_symbol (sbcset, name) -# endif /* not RE_ENABLE_I18N */ re_bitset_ptr_t sbcset; const unsigned char *name; { @@ -2739,23 +2894,23 @@ parse_bracket_exp (regexp, dfa, token, syntax, err) else return REG_ECOLLATE; -# ifdef RE_ENABLE_I18N /* Got valid collation sequence, add it as a new entry. */ /* Check the space of the arrays. */ - if (*coll_sym_alloc == mbcset->ncoll_syms) + if (BE (*coll_sym_alloc == mbcset->ncoll_syms, 0)) { /* Not enough, realloc it. */ /* +1 in case of mbcset->ncoll_syms is 0. */ - *coll_sym_alloc = 2 * mbcset->ncoll_syms + 1; + int new_coll_sym_alloc = 2 * mbcset->ncoll_syms + 1; /* Use realloc since mbcset->coll_syms is NULL if *alloc == 0. */ - mbcset->coll_syms = re_realloc (mbcset->coll_syms, int32_t, - *coll_sym_alloc); - if (BE (mbcset->coll_syms == NULL, 0)) + int32_t *new_coll_syms = re_realloc (mbcset->coll_syms, int32_t, + new_coll_sym_alloc); + if (BE (new_coll_syms == NULL, 0)) return REG_ESPACE; + mbcset->coll_syms = new_coll_syms; + *coll_sym_alloc = new_coll_sym_alloc; } mbcset->coll_syms[mbcset->ncoll_syms++] = idx; -# endif /* RE_ENABLE_I18N */ return REG_NOERROR; } else @@ -2777,11 +2932,11 @@ parse_bracket_exp (regexp, dfa, token, syntax, err) re_charset_t *mbcset; int coll_sym_alloc = 0, range_alloc = 0, mbchar_alloc = 0; int equiv_class_alloc = 0, char_class_alloc = 0; -#else /* not RE_ENABLE_I18N */ - int non_match = 0; #endif /* not RE_ENABLE_I18N */ + int non_match = 0; bin_tree_t *work_tree; - int token_len, new_idx; + int token_len; + int first_round = 1; #ifdef _LIBC collseqmb = (const unsigned char *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_COLLSEQMB); @@ -2789,7 +2944,7 @@ parse_bracket_exp (regexp, dfa, token, syntax, err) if (nrules) { /* - if (re_mb_cur_max > 1) + if (MB_CUR_MAX > 1) */ collseqwc = _NL_CURRENT (LC_COLLATE, _NL_COLLATE_COLLSEQWC); table_size = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_SYMB_HASH_SIZEMB); @@ -2822,11 +2977,9 @@ parse_bracket_exp (regexp, dfa, token, syntax, err) if (token->type == OP_NON_MATCH_LIST) { #ifdef RE_ENABLE_I18N - int i; mbcset->non_match = 1; -#else /* not RE_ENABLE_I18N */ - non_match = 1; #endif /* not RE_ENABLE_I18N */ + non_match = 1; if (syntax & RE_HAT_LISTS_NOT_NEWLINE) bitset_set (sbcset, '\0'); re_string_skip_bytes (regexp, token_len); /* Skip a token. */ @@ -2836,12 +2989,6 @@ parse_bracket_exp (regexp, dfa, token, syntax, err) *err = REG_BADPAT; goto parse_bracket_exp_free_return; } -#ifdef RE_ENABLE_I18N - if (re_mb_cur_max > 1) - for (i = 0; i < SBC_MAX; ++i) - if (__btowc (i) == WEOF) - bitset_set (sbcset, i); -#endif /* RE_ENABLE_I18N */ } /* We treat the first ']' as a normal character. */ @@ -2859,43 +3006,50 @@ parse_bracket_exp (regexp, dfa, token, syntax, err) start_elem.opr.name = start_name_buf; ret = parse_bracket_element (&start_elem, regexp, token, token_len, dfa, - syntax); + syntax, first_round); if (BE (ret != REG_NOERROR, 0)) { *err = ret; goto parse_bracket_exp_free_return; } + first_round = 0; + /* Get information about the next token. We need it in any case. */ token_len = peek_token_bracket (token, regexp, syntax); - if (BE (token->type == END_OF_RE, 0)) - { - *err = REG_BADPAT; - goto parse_bracket_exp_free_return; - } - if (token->type == OP_CHARSET_RANGE) + + /* Do not check for ranges if we know they are not allowed. */ + if (start_elem.type != CHAR_CLASS && start_elem.type != EQUIV_CLASS) { - re_string_skip_bytes (regexp, token_len); /* Skip '-'. */ - token_len2 = peek_token_bracket (&token2, regexp, syntax); if (BE (token->type == END_OF_RE, 0)) { - *err = REG_BADPAT; + *err = REG_EBRACK; goto parse_bracket_exp_free_return; } - if (token2.type == OP_CLOSE_BRACKET) + if (token->type == OP_CHARSET_RANGE) { - /* We treat the last '-' as a normal character. */ - re_string_skip_bytes (regexp, -token_len); - token->type = CHARACTER; + re_string_skip_bytes (regexp, token_len); /* Skip '-'. */ + token_len2 = peek_token_bracket (&token2, regexp, syntax); + if (BE (token2.type == END_OF_RE, 0)) + { + *err = REG_EBRACK; + goto parse_bracket_exp_free_return; + } + if (token2.type == OP_CLOSE_BRACKET) + { + /* We treat the last '-' as a normal character. */ + re_string_skip_bytes (regexp, -token_len); + token->type = CHARACTER; + } + else + is_range_exp = 1; } - else - is_range_exp = 1; } if (is_range_exp == 1) { end_elem.opr.name = end_name_buf; ret = parse_bracket_element (&end_elem, regexp, &token2, token_len2, - dfa, syntax); + dfa, syntax, 1); if (BE (ret != REG_NOERROR, 0)) { *err = ret; @@ -2903,16 +3057,19 @@ parse_bracket_exp (regexp, dfa, token, syntax, err) } token_len = peek_token_bracket (token, regexp, syntax); - if (BE (token->type == END_OF_RE, 0)) - { - *err = REG_BADPAT; - goto parse_bracket_exp_free_return; - } + +#ifdef _LIBC + *err = build_range_exp (sbcset, mbcset, &range_alloc, + &start_elem, &end_elem); +#else +# ifdef RE_ENABLE_I18N *err = build_range_exp (sbcset, -#ifdef RE_ENABLE_I18N - mbcset, &range_alloc, + dfa->mb_cur_max > 1 ? mbcset : NULL, + &range_alloc, &start_elem, &end_elem); +# else + *err = build_range_exp (sbcset, &start_elem, &end_elem); +# endif #endif /* RE_ENABLE_I18N */ - &start_elem, &end_elem); if (BE (*err != REG_NOERROR, 0)) goto parse_bracket_exp_free_return; } @@ -2926,16 +3083,18 @@ parse_bracket_exp (regexp, dfa, token, syntax, err) #ifdef RE_ENABLE_I18N case MB_CHAR: /* Check whether the array has enough space. */ - if (mbchar_alloc == mbcset->nmbchars) + if (BE (mbchar_alloc == mbcset->nmbchars, 0)) { + wchar_t *new_mbchars; /* Not enough, realloc it. */ /* +1 in case of mbcset->nmbchars is 0. */ mbchar_alloc = 2 * mbcset->nmbchars + 1; /* Use realloc since array is NULL if *alloc == 0. */ - mbcset->mbchars = re_realloc (mbcset->mbchars, wchar_t, - mbchar_alloc); - if (BE (mbcset->mbchars == NULL, 0)) + new_mbchars = re_realloc (mbcset->mbchars, wchar_t, + mbchar_alloc); + if (BE (new_mbchars == NULL, 0)) goto parse_bracket_exp_espace; + mbcset->mbchars = new_mbchars; } mbcset->mbchars[mbcset->nmbchars++] = start_elem.opr.wch; break; @@ -2959,19 +3118,24 @@ parse_bracket_exp (regexp, dfa, token, syntax, err) goto parse_bracket_exp_free_return; break; case CHAR_CLASS: - ret = build_charclass (regexp->trans, sbcset, + *err = build_charclass (regexp->trans, sbcset, #ifdef RE_ENABLE_I18N mbcset, &char_class_alloc, #endif /* RE_ENABLE_I18N */ start_elem.opr.name, syntax); - if (BE (ret != REG_NOERROR, 0)) - goto parse_bracket_exp_espace; + if (BE (*err != REG_NOERROR, 0)) + goto parse_bracket_exp_free_return; break; default: assert (0); break; } } + if (BE (token->type == END_OF_RE, 0)) + { + *err = REG_EBRACK; + goto parse_bracket_exp_free_return; + } if (token->type == OP_CLOSE_BRACKET) break; } @@ -2979,42 +3143,54 @@ parse_bracket_exp (regexp, dfa, token, syntax, err) re_string_skip_bytes (regexp, token_len); /* Skip a token. */ /* If it is non-matching list. */ -#ifdef RE_ENABLE_I18N - if (mbcset->non_match) -#else /* not RE_ENABLE_I18N */ if (non_match) -#endif /* not RE_ENABLE_I18N */ bitset_not (sbcset); +#ifdef RE_ENABLE_I18N + /* Ensure only single byte characters are set. */ + if (dfa->mb_cur_max > 1) + bitset_mask (sbcset, dfa->sb_char); +#endif /* RE_ENABLE_I18N */ + /* Build a tree for simple bracket. */ br_token.type = SIMPLE_BRACKET; br_token.opr.sbcset = sbcset; - new_idx = re_dfa_add_node (dfa, br_token, 0); - work_tree = create_tree (NULL, NULL, 0, new_idx); - if (BE (new_idx == -1 || work_tree == NULL, 0)) + work_tree = re_dfa_add_tree_node (dfa, NULL, NULL, &br_token); + if (BE (work_tree == NULL, 0)) goto parse_bracket_exp_espace; #ifdef RE_ENABLE_I18N if (mbcset->nmbchars || mbcset->ncoll_syms || mbcset->nequiv_classes - || mbcset->nranges || (re_mb_cur_max > 1 && (mbcset->nchar_classes - || mbcset->non_match))) + || mbcset->nranges || (dfa->mb_cur_max > 1 && (mbcset->nchar_classes + || mbcset->non_match))) { re_token_t alt_token; bin_tree_t *mbc_tree; + int sbc_idx; /* Build a tree for complex bracket. */ + dfa->has_mb_node = 1; + for (sbc_idx = 0; sbc_idx < BITSET_UINTS; ++sbc_idx) + if (sbcset[sbc_idx]) + break; + /* If there are no bits set in sbcset, there is no point + of having both SIMPLE_BRACKET and COMPLEX_BRACKET. */ + if (sbc_idx == BITSET_UINTS) + { + re_free (sbcset); + dfa->nodes[work_tree->node_idx].type = COMPLEX_BRACKET; + dfa->nodes[work_tree->node_idx].opr.mbcset = mbcset; + return work_tree; + } br_token.type = COMPLEX_BRACKET; br_token.opr.mbcset = mbcset; - dfa->has_mb_node = 1; - new_idx = re_dfa_add_node (dfa, br_token, 0); - mbc_tree = create_tree (NULL, NULL, 0, new_idx); - if (BE (new_idx == -1 || mbc_tree == NULL, 0)) + mbc_tree = re_dfa_add_tree_node (dfa, NULL, NULL, &br_token); + if (BE (mbc_tree == NULL, 0)) goto parse_bracket_exp_espace; /* Then join them by ALT node. */ - dfa->has_plural_match = 1; alt_token.type = OP_ALT; - new_idx = re_dfa_add_node (dfa, alt_token, 0); - work_tree = create_tree (work_tree, mbc_tree, 0, new_idx); - if (BE (new_idx != -1 && mbc_tree != NULL, 1)) + dfa->has_plural_match = 1; + work_tree = re_dfa_add_tree_node (dfa, work_tree, mbc_tree, &alt_token); + if (BE (mbc_tree != NULL, 1)) return work_tree; } else @@ -3039,13 +3215,15 @@ parse_bracket_exp (regexp, dfa, token, syntax, err) /* Parse an element in the bracket expression. */ static reg_errcode_t -parse_bracket_element (elem, regexp, token, token_len, dfa, syntax) +parse_bracket_element (elem, regexp, token, token_len, dfa, syntax, + accept_hyphen) bracket_elem_t *elem; re_string_t *regexp; re_token_t *token; int token_len; re_dfa_t *dfa; reg_syntax_t syntax; + int accept_hyphen; { #ifdef RE_ENABLE_I18N int cur_char_size; @@ -3062,6 +3240,17 @@ parse_bracket_element (elem, regexp, token, token_len, dfa, syntax) if (token->type == OP_OPEN_COLL_ELEM || token->type == OP_OPEN_CHAR_CLASS || token->type == OP_OPEN_EQUIV_CLASS) return parse_bracket_symbol (elem, regexp, token); + if (BE (token->type == OP_CHARSET_RANGE, 0) && !accept_hyphen) + { + /* A '-' must only appear as anything but a range indicator before + the closing bracket. Everything else is an error. */ + re_token_t token2; + (void) peek_token_bracket (&token2, regexp, syntax); + if (token2.type != OP_CLOSE_BRACKET) + /* The actual error value is not standardized since this whole + case is undefined. But ERANGE makes good sense. */ + return REG_ERANGE; + } elem->type = SB_CHAR; elem->opr.ch = token->opr.c; return REG_NOERROR; @@ -3079,14 +3268,18 @@ parse_bracket_symbol (elem, regexp, token) { unsigned char ch, delim = token->opr.c; int i = 0; + if (re_string_eoi(regexp)) + return REG_EBRACK; for (;; ++i) { - if (re_string_eoi(regexp) || i >= BRACKET_NAME_BUF_SIZE) + if (i >= BRACKET_NAME_BUF_SIZE) return REG_EBRACK; if (token->type == OP_OPEN_CHAR_CLASS) ch = re_string_fetch_byte_case (regexp); else ch = re_string_fetch_byte (regexp); + if (re_string_eoi(regexp)) + return REG_EBRACK; if (ch == delim && re_string_peek_byte (regexp, 0) == ']') break; elem->opr.name[i] = ch; @@ -3127,7 +3320,7 @@ build_equiv_class (sbcset, name) re_bitset_ptr_t sbcset; const unsigned char *name; { -#if defined _LIBC && defined RE_ENABLE_I18N +#if defined _LIBC uint32_t nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES); if (nrules != 0) { @@ -3179,21 +3372,24 @@ build_equiv_class (sbcset, name) } } /* Check whether the array has enough space. */ - if (*equiv_class_alloc == mbcset->nequiv_classes) + if (BE (*equiv_class_alloc == mbcset->nequiv_classes, 0)) { /* Not enough, realloc it. */ /* +1 in case of mbcset->nequiv_classes is 0. */ - *equiv_class_alloc = 2 * mbcset->nequiv_classes + 1; + int new_equiv_class_alloc = 2 * mbcset->nequiv_classes + 1; /* Use realloc since the array is NULL if *alloc == 0. */ - mbcset->equiv_classes = re_realloc (mbcset->equiv_classes, int32_t, - *equiv_class_alloc); - if (BE (mbcset->equiv_classes == NULL, 0)) + int32_t *new_equiv_classes = re_realloc (mbcset->equiv_classes, + int32_t, + new_equiv_class_alloc); + if (BE (new_equiv_classes == NULL, 0)) return REG_ESPACE; + mbcset->equiv_classes = new_equiv_classes; + *equiv_class_alloc = new_equiv_class_alloc; } mbcset->equiv_classes[mbcset->nequiv_classes++] = idx1; } else -#endif /* _LIBC && RE_ENABLE_I18N */ +#endif /* _LIBC */ { if (BE (strlen ((const char *) name) != 1, 0)) return REG_ECOLLATE; @@ -3216,69 +3412,70 @@ build_charclass (trans, sbcset, mbcset, char_class_alloc, class_name, syntax) #else /* not RE_ENABLE_I18N */ build_charclass (trans, sbcset, class_name, syntax) #endif /* not RE_ENABLE_I18N */ - RE_TRANSLATE_TYPE trans; + unsigned RE_TRANSLATE_TYPE trans; re_bitset_ptr_t sbcset; - const unsigned char *class_name; + const char *class_name; reg_syntax_t syntax; { int i; - const char *name = (const char *) class_name; /* In case of REG_ICASE "upper" and "lower" match the both of upper and lower cases. */ if ((syntax & RE_ICASE) - && (strcmp (name, "upper") == 0 || strcmp (name, "lower") == 0)) - name = "alpha"; + && (strcmp (class_name, "upper") == 0 || strcmp (class_name, "lower") == 0)) + class_name = "alpha"; #ifdef RE_ENABLE_I18N /* Check the space of the arrays. */ - if (*char_class_alloc == mbcset->nchar_classes) + if (BE (*char_class_alloc == mbcset->nchar_classes, 0)) { /* Not enough, realloc it. */ /* +1 in case of mbcset->nchar_classes is 0. */ - *char_class_alloc = 2 * mbcset->nchar_classes + 1; + int new_char_class_alloc = 2 * mbcset->nchar_classes + 1; /* Use realloc since array is NULL if *alloc == 0. */ - mbcset->char_classes = re_realloc (mbcset->char_classes, wctype_t, - *char_class_alloc); - if (BE (mbcset->char_classes == NULL, 0)) + wctype_t *new_char_classes = re_realloc (mbcset->char_classes, wctype_t, + new_char_class_alloc); + if (BE (new_char_classes == NULL, 0)) return REG_ESPACE; + mbcset->char_classes = new_char_classes; + *char_class_alloc = new_char_class_alloc; } - mbcset->char_classes[mbcset->nchar_classes++] = __wctype (name); + mbcset->char_classes[mbcset->nchar_classes++] = __wctype (class_name); #endif /* RE_ENABLE_I18N */ -#define BUILD_CHARCLASS_LOOP(ctype_func)\ - for (i = 0; i < SBC_MAX; ++i) \ - { \ - if (ctype_func (i)) \ +#define BUILD_CHARCLASS_LOOP(ctype_func) \ + for (i = 0; i < SBC_MAX; ++i) \ + { \ + if (ctype_func (i)) \ { \ int ch = trans ? trans[i] : i; \ bitset_set (sbcset, ch); \ } \ } - if (strcmp (name, "alnum") == 0) + if (strcmp (class_name, "alnum") == 0) BUILD_CHARCLASS_LOOP (isalnum) - else if (strcmp (name, "cntrl") == 0) + else if (strcmp (class_name, "cntrl") == 0) BUILD_CHARCLASS_LOOP (iscntrl) - else if (strcmp (name, "lower") == 0) + else if (strcmp (class_name, "lower") == 0) BUILD_CHARCLASS_LOOP (islower) - else if (strcmp (name, "space") == 0) + else if (strcmp (class_name, "space") == 0) BUILD_CHARCLASS_LOOP (isspace) - else if (strcmp (name, "alpha") == 0) + else if (strcmp (class_name, "alpha") == 0) BUILD_CHARCLASS_LOOP (isalpha) - else if (strcmp (name, "digit") == 0) + else if (strcmp (class_name, "digit") == 0) BUILD_CHARCLASS_LOOP (isdigit) - else if (strcmp (name, "print") == 0) + else if (strcmp (class_name, "print") == 0) BUILD_CHARCLASS_LOOP (isprint) - else if (strcmp (name, "upper") == 0) + else if (strcmp (class_name, "upper") == 0) BUILD_CHARCLASS_LOOP (isupper) - else if (strcmp (name, "blank") == 0) + else if (strcmp (class_name, "blank") == 0) BUILD_CHARCLASS_LOOP (isblank) - else if (strcmp (name, "graph") == 0) + else if (strcmp (class_name, "graph") == 0) BUILD_CHARCLASS_LOOP (isgraph) - else if (strcmp (name, "punct") == 0) + else if (strcmp (class_name, "punct") == 0) BUILD_CHARCLASS_LOOP (ispunct) - else if (strcmp (name, "xdigit") == 0) + else if (strcmp (class_name, "xdigit") == 0) BUILD_CHARCLASS_LOOP (isxdigit) else return REG_ECTYPE; @@ -3287,23 +3484,22 @@ build_charclass (trans, sbcset, class_name, syntax) } static bin_tree_t * -build_word_op (dfa, trans, not, err) +build_charclass_op (dfa, trans, class_name, extra, non_match, err) re_dfa_t *dfa; - RE_TRANSLATE_TYPE trans; - int not; + unsigned RE_TRANSLATE_TYPE trans; + const char *class_name; + const char *extra; + int non_match; reg_errcode_t *err; { re_bitset_ptr_t sbcset; #ifdef RE_ENABLE_I18N re_charset_t *mbcset; int alloc = 0; -#else /* not RE_ENABLE_I18N */ - int non_match = 0; #endif /* not RE_ENABLE_I18N */ reg_errcode_t ret; re_token_t br_token; bin_tree_t *tree; - int new_idx; sbcset = (re_bitset_ptr_t) calloc (sizeof (unsigned int), BITSET_UINTS); #ifdef RE_ENABLE_I18N @@ -3320,21 +3516,14 @@ build_word_op (dfa, trans, not, err) return NULL; } - if (not) + if (non_match) { #ifdef RE_ENABLE_I18N - int i; /* if (syntax & RE_HAT_LISTS_NOT_NEWLINE) bitset_set(cset->sbcset, '\0'); */ mbcset->non_match = 1; - if (re_mb_cur_max > 1) - for (i = 0; i < SBC_MAX; ++i) - if (__btowc (i) == WEOF) - bitset_set (sbcset, i); -#else /* not RE_ENABLE_I18N */ - non_match = 1; #endif /* not RE_ENABLE_I18N */ } @@ -3343,7 +3532,7 @@ build_word_op (dfa, trans, not, err) #ifdef RE_ENABLE_I18N mbcset, &alloc, #endif /* RE_ENABLE_I18N */ - (const unsigned char *) "alpha", 0); + class_name, 0); if (BE (ret != REG_NOERROR, 0)) { @@ -3355,26 +3544,28 @@ build_word_op (dfa, trans, not, err) return NULL; } /* \w match '_' also. */ - bitset_set (sbcset, '_'); + for (; *extra; extra++) + bitset_set (sbcset, *extra); /* If it is non-matching list. */ -#ifdef RE_ENABLE_I18N - if (mbcset->non_match) -#else /* not RE_ENABLE_I18N */ if (non_match) -#endif /* not RE_ENABLE_I18N */ bitset_not (sbcset); +#ifdef RE_ENABLE_I18N + /* Ensure only single byte characters are set. */ + if (dfa->mb_cur_max > 1) + bitset_mask (sbcset, dfa->sb_char); +#endif + /* Build a tree for simple bracket. */ br_token.type = SIMPLE_BRACKET; br_token.opr.sbcset = sbcset; - new_idx = re_dfa_add_node (dfa, br_token, 0); - tree = create_tree (NULL, NULL, 0, new_idx); - if (BE (new_idx == -1 || tree == NULL, 0)) + tree = re_dfa_add_tree_node (dfa, NULL, NULL, &br_token); + if (BE (tree == NULL, 0)) goto build_word_op_espace; #ifdef RE_ENABLE_I18N - if (re_mb_cur_max > 1) + if (dfa->mb_cur_max > 1) { re_token_t alt_token; bin_tree_t *mbc_tree; @@ -3382,15 +3573,14 @@ build_word_op (dfa, trans, not, err) br_token.type = COMPLEX_BRACKET; br_token.opr.mbcset = mbcset; dfa->has_mb_node = 1; - new_idx = re_dfa_add_node (dfa, br_token, 0); - mbc_tree = create_tree (NULL, NULL, 0, new_idx); - if (BE (new_idx == -1 || mbc_tree == NULL, 0)) + mbc_tree = re_dfa_add_tree_node (dfa, NULL, NULL, &br_token); + if (BE (mbc_tree == NULL, 0)) goto build_word_op_espace; /* Then join them by ALT node. */ alt_token.type = OP_ALT; - new_idx = re_dfa_add_node (dfa, alt_token, 0); - tree = create_tree (tree, mbc_tree, 0, new_idx); - if (BE (new_idx != -1 && mbc_tree != NULL, 1)) + dfa->has_plural_match = 1; + tree = re_dfa_add_tree_node (dfa, tree, mbc_tree, &alt_token); + if (BE (mbc_tree != NULL, 1)) return tree; } else @@ -3426,7 +3616,7 @@ fetch_number (input, token, syntax) unsigned char c; while (1) { - *token = fetch_token (input, syntax); + fetch_token (token, input, syntax); c = token->opr.c; if (BE (token->type == END_OF_RE, 0)) return -2; @@ -3457,24 +3647,29 @@ free_charset (re_charset_t *cset) /* Functions for binary tree operation. */ -/* Create a node of tree. - Note: This function automatically free left and right if malloc fails. */ +/* Create a tree node. */ static bin_tree_t * -create_tree (left, right, type, index) +create_tree (dfa, left, right, type, index) + re_dfa_t *dfa; bin_tree_t *left; bin_tree_t *right; re_token_type_t type; int index; { bin_tree_t *tree; - tree = re_malloc (bin_tree_t, 1); - if (BE (tree == NULL, 0)) + if (BE (dfa->str_tree_storage_idx == BIN_TREE_STORAGE_SIZE, 0)) { - free_bin_tree (left); - free_bin_tree (right); - return NULL; + bin_tree_storage_t *storage = re_malloc (bin_tree_storage_t, 1); + + if (storage == NULL) + return NULL; + storage->next = dfa->str_tree_storage; + dfa->str_tree_storage = storage; + dfa->str_tree_storage_idx = 0; } + tree = &dfa->str_tree_storage->data[dfa->str_tree_storage_idx++]; + tree->parent = NULL; tree->left = left; tree->right = right; @@ -3491,20 +3686,66 @@ create_tree (left, right, type, index) return tree; } -/* Free the sub tree pointed by TREE. */ +/* Create both a DFA node and a tree for it. */ + +static bin_tree_t * +re_dfa_add_tree_node (dfa, left, right, token) + re_dfa_t *dfa; + bin_tree_t *left; + bin_tree_t *right; + const re_token_t *token; +{ + int new_idx = re_dfa_add_node (dfa, *token, 0); + + if (new_idx == -1) + return NULL; + + return create_tree (dfa, left, right, 0, new_idx); +} + +/* Mark the tree SRC as an optional subexpression. */ + +static void +mark_opt_subexp (src, dfa) + const bin_tree_t *src; + re_dfa_t *dfa; +{ + /* Pass an OPT_SUBEXP_IDX which is != 1 if the duplicated tree is + a subexpression. */ + if (src->type == CONCAT + && src->left->type == NON_TYPE + && dfa->nodes[src->left->node_idx].type == OP_OPEN_SUBEXP) + mark_opt_subexp_iter (src, dfa, dfa->nodes[src->left->node_idx].opr.idx); +} + + +/* Recursive tree walker for mark_opt_subexp. */ static void -free_bin_tree (tree) - bin_tree_t *tree; +mark_opt_subexp_iter (src, dfa, idx) + const bin_tree_t *src; + re_dfa_t *dfa; + int idx; { - if (tree == NULL) - return; - /*re_node_set_free (&tree->eclosure);*/ - free_bin_tree (tree->left); - free_bin_tree (tree->right); - re_free (tree); + int node_idx; + + if (src->type == NON_TYPE) + { + node_idx = src->node_idx; + if ((dfa->nodes[node_idx].type == OP_OPEN_SUBEXP + || dfa->nodes[node_idx].type == OP_CLOSE_SUBEXP) + && dfa->nodes[node_idx].opr.idx == idx) + dfa->nodes[node_idx].opt_subexp = 1; + } + + if (src->left != NULL) + mark_opt_subexp_iter (src->left, dfa, idx); + + if (src->right != NULL) + mark_opt_subexp_iter (src->right, dfa, idx); } + /* Duplicate the node SRC, and return new node. */ static bin_tree_t * @@ -3528,10 +3769,7 @@ duplicate_tree (src, dfa) { right = duplicate_tree (src->right, dfa); if (right == NULL) - { - free_bin_tree (left); - return NULL; - } + return NULL; } /* At last, duplicate itself. */ @@ -3540,20 +3778,11 @@ duplicate_tree (src, dfa) new_node_idx = re_dfa_add_node (dfa, dfa->nodes[src->node_idx], 0); dfa->nodes[new_node_idx].duplicated = 1; if (BE (new_node_idx == -1, 0)) - { - free_bin_tree (left); - free_bin_tree (right); - return NULL; - } + return NULL; } else new_node_idx = src->type; - new_tree = create_tree (left, right, src->type, new_node_idx); - if (BE (new_tree == NULL, 0)) - { - free_bin_tree (left); - free_bin_tree (right); - } + new_tree = create_tree (dfa, left, right, src->type, new_node_idx); return new_tree; } diff --git a/regex.c b/regex.c index fdfe654d4..bf63f2eca 100644 --- a/regex.c +++ b/regex.c @@ -18,27 +18,57 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef _AIX +#pragma alloca +#else +# ifndef allocax /* predefined by HP cc +Olibcalls */ +# ifdef __GNUC__ +# define alloca(size) __builtin_alloca (size) +# else +# if HAVE_ALLOCA_H +# include +# else +# ifdef __hpux + void *alloca (); +# else +# if !defined __OS2__ && !defined WIN32 + char *alloca (); +# else +# include /* OS/2 defines alloca in here */ +# endif +# endif +# endif +# endif +# endif +#endif + #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) \ +# 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) \ +# 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) \ +# 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) \ +# define re_match(bufp, string, size, pos, regs) \ __re_match (bufp, string, size, pos, regs) -# define re_search(bufp, string, size, startpos, range, 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) \ +# 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) \ +# 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 re_compile_fastmap(bufp) __re_compile_fastmap (bufp) + +# include "../locale/localeinfo.h" #endif #ifdef HAVE_CONFIG_H diff --git a/regex.h b/regex.h index 3794051d8..e0e762018 100644 --- a/regex.h +++ b/regex.h @@ -1,6 +1,6 @@ /* Definitions for data structures and routines for the regular expression library. - Copyright (C) 1985,1989-93,1995-98,2000,2001,2002 + Copyright (C) 1985,1989-93,1995-98,2000,2001,2002,2003 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -22,6 +22,8 @@ #ifndef _REGEX_H #define _REGEX_H 1 +#include + /* Allow the use in C++ code. */ #ifdef __cplusplus extern "C" { @@ -168,6 +170,15 @@ typedef unsigned long int reg_syntax_t; If not set, then case is significant. */ #define RE_ICASE (RE_INVALID_INTERVAL_ORD << 1) +/* This bit is used internally like RE_CONTEXT_INDEP_ANCHORS but only + for ^, because it is difficult to scan the regex backwards to find + whether ^ should be special. */ +#define RE_CARET_ANCHORS_HERE (RE_ICASE << 1) + +/* If this bit is set, then \{ cannot be first in an bre or + immediately after an alternation or begin-group operator. */ +#define RE_CONTEXT_INVALID_DUP (RE_CARET_ANCHORS_HERE << 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 @@ -222,7 +233,7 @@ extern reg_syntax_t re_syntax_options; | RE_INTERVALS | RE_NO_EMPTY_RANGES) #define RE_SYNTAX_POSIX_BASIC \ - (_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM) + (_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM | RE_CONTEXT_INVALID_DUP) /* Differs from ..._POSIX_BASIC only in that RE_BK_PLUS_QM becomes RE_LIMITED_OPS, i.e., \? \+ \| are not recognized. Actually, this diff --git a/regex_internal.c b/regex_internal.c index 72cb7c063..d970e15c3 100644 --- a/regex_internal.c +++ b/regex_internal.c @@ -1,5 +1,5 @@ /* Extended regular expression matching and search library. - Copyright (C) 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa . @@ -18,27 +18,28 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -static void re_string_construct_common _RE_ARGS((const char *str, int len, +static void re_string_construct_common (const char *str, int len, re_string_t *pstr, - RE_TRANSLATE_TYPE trans, int icase)); + RE_TRANSLATE_TYPE trans, int icase, + const re_dfa_t *dfa) internal_function; #ifdef RE_ENABLE_I18N -static int re_string_skip_chars _RE_ARGS((re_string_t *pstr, int new_raw_idx, - wint_t *last_wc)); +static int re_string_skip_chars (re_string_t *pstr, int new_raw_idx, + wint_t *last_wc) internal_function; #endif /* RE_ENABLE_I18N */ -static re_dfastate_t *create_newstate_common _RE_ARGS((re_dfa_t *dfa, +static re_dfastate_t *create_newstate_common (re_dfa_t *dfa, const re_node_set *nodes, - unsigned int hash)); -static reg_errcode_t register_state _RE_ARGS((re_dfa_t *dfa, re_dfastate_t *newstate, - unsigned int hash)); -static re_dfastate_t *create_ci_newstate _RE_ARGS((re_dfa_t *dfa, + unsigned int hash) internal_function; +static reg_errcode_t register_state (re_dfa_t *dfa, re_dfastate_t *newstate, + unsigned int hash) internal_function; +static re_dfastate_t *create_ci_newstate (re_dfa_t *dfa, const re_node_set *nodes, - unsigned int hash)); -static re_dfastate_t *create_cd_newstate _RE_ARGS((re_dfa_t *dfa, + unsigned int hash) internal_function; +static re_dfastate_t *create_cd_newstate (re_dfa_t *dfa, const re_node_set *nodes, unsigned int context, - unsigned int hash)); -static inline unsigned int calc_state_hash _RE_ARGS((const re_node_set *nodes, - unsigned int context)); + unsigned int hash) internal_function; +static unsigned int inline calc_state_hash (const re_node_set *nodes, + unsigned int context) internal_function; /* Functions for string operation. */ @@ -46,46 +47,47 @@ static inline unsigned int calc_state_hash _RE_ARGS((const re_node_set *nodes, re_string_reconstruct before using the object. */ static reg_errcode_t -re_string_allocate (pstr, str, len, init_len, trans, icase) +re_string_allocate (pstr, str, len, init_len, trans, icase, dfa) re_string_t *pstr; const char *str; int len, init_len, icase; RE_TRANSLATE_TYPE trans; + const re_dfa_t *dfa; { reg_errcode_t ret; - int init_buf_len = (len + 1 < init_len) ? len + 1: init_len; - re_string_construct_common (str, len, pstr, trans, icase); - pstr->stop = pstr->len; + int init_buf_len; + + /* Ensure at least one character fits into the buffers. */ + if (init_len < dfa->mb_cur_max) + init_len = dfa->mb_cur_max; + init_buf_len = (len + 1 < init_len) ? len + 1: init_len; + re_string_construct_common (str, len, pstr, trans, icase, dfa); ret = re_string_realloc_buffers (pstr, init_buf_len); if (BE (ret != REG_NOERROR, 0)) return ret; - pstr->mbs_case = (MBS_CASE_ALLOCATED (pstr) ? pstr->mbs_case - : (unsigned char *) str); - pstr->mbs = MBS_ALLOCATED (pstr) ? pstr->mbs : pstr->mbs_case; - pstr->valid_len = (MBS_CASE_ALLOCATED (pstr) || MBS_ALLOCATED (pstr) -#ifdef RE_ENABLE_I18N - || re_mb_cur_max > 1 -#endif - ) ? pstr->valid_len : len; + pstr->word_char = dfa->word_char; + pstr->word_ops_used = dfa->word_ops_used; + pstr->mbs = pstr->mbs_allocated ? pstr->mbs : (unsigned char *) str; + pstr->valid_len = (pstr->mbs_allocated || dfa->mb_cur_max > 1) ? 0 : len; + pstr->valid_raw_len = pstr->valid_len; return REG_NOERROR; } /* This function allocate the buffers, and initialize them. */ static reg_errcode_t -re_string_construct (pstr, str, len, trans, icase) +re_string_construct (pstr, str, len, trans, icase, dfa) re_string_t *pstr; const char *str; int len, icase; RE_TRANSLATE_TYPE trans; + const re_dfa_t *dfa; { reg_errcode_t ret; - re_string_construct_common (str, len, pstr, trans, icase); - pstr->stop = pstr->len; - /* Set 0 so that this function can initialize whole buffers. */ - pstr->valid_len = 0; + memset (pstr, '\0', sizeof (re_string_t)); + re_string_construct_common (str, len, pstr, trans, icase, dfa); if (len > 0) { @@ -93,15 +95,27 @@ re_string_construct (pstr, str, len, trans, icase) if (BE (ret != REG_NOERROR, 0)) return ret; } - pstr->mbs_case = (MBS_CASE_ALLOCATED (pstr) ? pstr->mbs_case - : (unsigned char *) str); - pstr->mbs = MBS_ALLOCATED (pstr) ? pstr->mbs : pstr->mbs_case; + pstr->mbs = pstr->mbs_allocated ? pstr->mbs : (unsigned char *) str; if (icase) { #ifdef RE_ENABLE_I18N - if (re_mb_cur_max > 1) - build_wcs_upper_buffer (pstr); + if (dfa->mb_cur_max > 1) + { + while (1) + { + ret = build_wcs_upper_buffer (pstr); + if (BE (ret != REG_NOERROR, 0)) + return ret; + if (pstr->valid_raw_len >= len) + break; + if (pstr->bufs_len > pstr->valid_len + dfa->mb_cur_max) + break; + ret = re_string_realloc_buffers (pstr, pstr->bufs_len * 2); + if (BE (ret != REG_NOERROR, 0)) + return ret; + } + } else #endif /* RE_ENABLE_I18N */ build_upper_buffer (pstr); @@ -109,7 +123,7 @@ re_string_construct (pstr, str, len, trans, icase) else { #ifdef RE_ENABLE_I18N - if (re_mb_cur_max > 1) + if (dfa->mb_cur_max > 1) build_wcs_buffer (pstr); else #endif /* RE_ENABLE_I18N */ @@ -117,12 +131,13 @@ re_string_construct (pstr, str, len, trans, icase) if (trans != NULL) re_string_translate_buffer (pstr); else - pstr->valid_len = len; + { + pstr->valid_len = pstr->bufs_len; + pstr->valid_raw_len = pstr->bufs_len; + } } } - /* Initialized whole buffers, then valid_len == bufs_len. */ - pstr->valid_len = pstr->bufs_len; return REG_NOERROR; } @@ -134,15 +149,22 @@ re_string_realloc_buffers (pstr, new_buf_len) int new_buf_len; { #ifdef RE_ENABLE_I18N - if (re_mb_cur_max > 1) + if (pstr->mb_cur_max > 1) { wint_t *new_array = re_realloc (pstr->wcs, wint_t, new_buf_len); if (BE (new_array == NULL, 0)) return REG_ESPACE; pstr->wcs = new_array; + if (pstr->offsets != NULL) + { + int *new_array = re_realloc (pstr->offsets, int, new_buf_len); + if (BE (new_array == NULL, 0)) + return REG_ESPACE; + pstr->offsets = new_array; + } } #endif /* RE_ENABLE_I18N */ - if (MBS_ALLOCATED (pstr)) + if (pstr->mbs_allocated) { unsigned char *new_array = re_realloc (pstr->mbs, unsigned char, new_buf_len); @@ -150,34 +172,31 @@ re_string_realloc_buffers (pstr, new_buf_len) return REG_ESPACE; pstr->mbs = new_array; } - if (MBS_CASE_ALLOCATED (pstr)) - { - unsigned char *new_array = re_realloc (pstr->mbs_case, unsigned char, - new_buf_len); - if (BE (new_array == NULL, 0)) - return REG_ESPACE; - pstr->mbs_case = new_array; - if (!MBS_ALLOCATED (pstr)) - pstr->mbs = pstr->mbs_case; - } pstr->bufs_len = new_buf_len; return REG_NOERROR; } static void -re_string_construct_common (str, len, pstr, trans, icase) +re_string_construct_common (str, len, pstr, trans, icase, dfa) const char *str; int len; re_string_t *pstr; RE_TRANSLATE_TYPE trans; int icase; + const re_dfa_t *dfa; { - memset (pstr, '\0', sizeof (re_string_t)); pstr->raw_mbs = (const unsigned char *) str; pstr->len = len; - pstr->trans = trans; + pstr->raw_len = len; + pstr->trans = (unsigned RE_TRANSLATE_TYPE) trans; pstr->icase = icase ? 1 : 0; + pstr->mbs_allocated = (trans != NULL || icase); + pstr->mb_cur_max = dfa->mb_cur_max; + pstr->is_utf8 = dfa->is_utf8; + pstr->map_notascii = dfa->map_notascii; + pstr->stop = pstr->len; + pstr->raw_stop = pstr->stop; } #ifdef RE_ENABLE_I18N @@ -197,18 +216,39 @@ static void build_wcs_buffer (pstr) re_string_t *pstr; { +#ifdef _LIBC + unsigned char buf[pstr->mb_cur_max]; +#else + unsigned char buf[64]; +#endif mbstate_t prev_st; int byte_idx, end_idx, mbclen, remain_len; + /* Build the buffers from pstr->valid_len to either pstr->len or pstr->bufs_len. */ - end_idx = (pstr->bufs_len > pstr->len)? pstr->len : pstr->bufs_len; + end_idx = (pstr->bufs_len > pstr->len) ? pstr->len : pstr->bufs_len; for (byte_idx = pstr->valid_len; byte_idx < end_idx;) { wchar_t wc; + const char *p; + remain_len = end_idx - byte_idx; prev_st = pstr->cur_state; - mbclen = mbrtowc (&wc, ((const char *) pstr->raw_mbs + pstr->raw_mbs_idx - + byte_idx), remain_len, &pstr->cur_state); + /* Apply the translation if we need. */ + if (BE (pstr->trans != NULL, 0)) + { + int i, ch; + + for (i = 0; i < pstr->mb_cur_max && i < remain_len; ++i) + { + ch = pstr->raw_mbs [pstr->raw_mbs_idx + byte_idx + i]; + buf[i] = pstr->trans[ch]; + } + p = (const char *) buf; + } + else + p = (const char *) pstr->raw_mbs + pstr->raw_mbs_idx + byte_idx; + mbclen = mbrtowc (&wc, p, remain_len, &pstr->cur_state); if (BE (mbclen == (size_t) -2, 0)) { /* The buffer doesn't have enough space, finish to build. */ @@ -220,15 +260,11 @@ build_wcs_buffer (pstr) /* We treat these cases as a singlebyte character. */ mbclen = 1; wc = (wchar_t) pstr->raw_mbs[pstr->raw_mbs_idx + byte_idx]; + if (BE (pstr->trans != NULL, 0)) + wc = pstr->trans[wc]; pstr->cur_state = prev_st; } - /* Apply the translateion if we need. */ - if (pstr->trans != NULL && mbclen == 1) - { - int ch = pstr->trans[pstr->raw_mbs[pstr->raw_mbs_idx + byte_idx]]; - pstr->mbs_case[byte_idx] = ch; - } /* Write wide character and padding. */ pstr->wcs[byte_idx++] = wc; /* Write paddings. */ @@ -236,62 +272,224 @@ build_wcs_buffer (pstr) pstr->wcs[byte_idx++] = WEOF; } pstr->valid_len = byte_idx; + pstr->valid_raw_len = byte_idx; } /* Build wide character buffer PSTR->WCS like build_wcs_buffer, but for REG_ICASE. */ -static void +static int build_wcs_upper_buffer (pstr) re_string_t *pstr; { mbstate_t prev_st; - int byte_idx, end_idx, mbclen, remain_len; - /* Build the buffers from pstr->valid_len to either pstr->len or - pstr->bufs_len. */ - end_idx = (pstr->bufs_len > pstr->len)? pstr->len : pstr->bufs_len; - for (byte_idx = pstr->valid_len; byte_idx < end_idx;) + int src_idx, byte_idx, end_idx, mbclen, remain_len; +#ifdef _LIBC + unsigned char buf[pstr->mb_cur_max]; +#else + unsigned char buf[64]; +#endif + + byte_idx = pstr->valid_len; + end_idx = (pstr->bufs_len > pstr->len) ? pstr->len : pstr->bufs_len; + +#ifdef _LIBC + /* The following optimization assumes that the wchar_t encoding is + always ISO 10646. */ + if (! pstr->map_notascii && pstr->trans == NULL && !pstr->offsets_needed) { - wchar_t wc; - remain_len = end_idx - byte_idx; - prev_st = pstr->cur_state; - mbclen = mbrtowc (&wc, ((const char *) pstr->raw_mbs + pstr->raw_mbs_idx - + byte_idx), remain_len, &pstr->cur_state); - if (BE (mbclen == (size_t) -2, 0)) - { - /* The buffer doesn't have enough space, finish to build. */ - pstr->cur_state = prev_st; - break; - } - else if (mbclen == 1 || mbclen == (size_t) -1 || mbclen == 0) + while (byte_idx < end_idx) { - /* In case of a singlebyte character. */ - int ch = pstr->raw_mbs[pstr->raw_mbs_idx + byte_idx]; - /* Apply the translateion if we need. */ - if (pstr->trans != NULL && mbclen == 1) + wchar_t wc; + + if (isascii (pstr->raw_mbs[pstr->raw_mbs_idx + byte_idx]) + && mbsinit (&pstr->cur_state)) { - ch = pstr->trans[ch]; - pstr->mbs_case[byte_idx] = ch; + /* In case of a singlebyte character. */ + pstr->mbs[byte_idx] + = toupper (pstr->raw_mbs[pstr->raw_mbs_idx + byte_idx]); + /* The next step uses the assumption that wchar_t is encoded + with ISO 10646: all ASCII values can be converted like + this. */ + pstr->wcs[byte_idx] = (wchar_t) pstr->mbs[byte_idx]; + ++byte_idx; + continue; + } + + remain_len = end_idx - byte_idx; + prev_st = pstr->cur_state; + mbclen = mbrtowc (&wc, + ((const char *) pstr->raw_mbs + pstr->raw_mbs_idx + + byte_idx), remain_len, &pstr->cur_state); + if (BE (mbclen > 0, 1)) + { + wchar_t wcu = wc; + if (iswlower (wc)) + { + int mbcdlen; + + wcu = towupper (wc); + mbcdlen = wcrtomb (buf, wcu, &prev_st); + if (BE (mbclen == mbcdlen, 1)) + memcpy (pstr->mbs + byte_idx, buf, mbclen); + else + { + src_idx = byte_idx; + goto offsets_needed; + } + } + else + memcpy (pstr->mbs + byte_idx, + pstr->raw_mbs + pstr->raw_mbs_idx + byte_idx, mbclen); + pstr->wcs[byte_idx++] = wcu; + /* Write paddings. */ + for (remain_len = byte_idx + mbclen - 1; byte_idx < remain_len ;) + pstr->wcs[byte_idx++] = WEOF; + } + else if (mbclen == (size_t) -1 || mbclen == 0) + { + /* It is an invalid character or '\0'. Just use the byte. */ + int ch = pstr->raw_mbs[pstr->raw_mbs_idx + byte_idx]; + pstr->mbs[byte_idx] = ch; + /* And also cast it to wide char. */ + pstr->wcs[byte_idx++] = (wchar_t) ch; + if (BE (mbclen == (size_t) -1, 0)) + pstr->cur_state = prev_st; } - pstr->wcs[byte_idx] = iswlower (wc) ? toupper (wc) : wc; - pstr->mbs[byte_idx++] = islower (ch) ? toupper (ch) : ch; - if (BE (mbclen == (size_t) -1, 0)) - pstr->cur_state = prev_st; - } - else /* mbclen > 1 */ - { - if (iswlower (wc)) - wcrtomb ((char *) pstr->mbs + byte_idx, towupper (wc), &prev_st); else - memcpy (pstr->mbs + byte_idx, - pstr->raw_mbs + pstr->raw_mbs_idx + byte_idx, mbclen); - pstr->wcs[byte_idx++] = iswlower (wc) ? toupper (wc) : wc; - /* Write paddings. */ - for (remain_len = byte_idx + mbclen - 1; byte_idx < remain_len ;) - pstr->wcs[byte_idx++] = WEOF; + { + /* The buffer doesn't have enough space, finish to build. */ + pstr->cur_state = prev_st; + break; + } } + pstr->valid_len = byte_idx; + pstr->valid_raw_len = byte_idx; + return REG_NOERROR; } + else +#endif + for (src_idx = pstr->valid_raw_len; byte_idx < end_idx;) + { + wchar_t wc; + const char *p; +#ifdef _LIBC +offsets_needed: +#endif + remain_len = end_idx - byte_idx; + prev_st = pstr->cur_state; + if (BE (pstr->trans != NULL, 0)) + { + int i, ch; + + for (i = 0; i < pstr->mb_cur_max && i < remain_len; ++i) + { + ch = pstr->raw_mbs [pstr->raw_mbs_idx + src_idx + i]; + buf[i] = pstr->trans[ch]; + } + p = (const char *) buf; + } + else + p = (const char *) pstr->raw_mbs + pstr->raw_mbs_idx + src_idx; + mbclen = mbrtowc (&wc, p, remain_len, &pstr->cur_state); + if (BE (mbclen > 0, 1)) + { + wchar_t wcu = wc; + if (iswlower (wc)) + { + int mbcdlen; + + wcu = towupper (wc); + mbcdlen = wcrtomb ((char *)buf, wcu, &prev_st); + if (BE (mbclen == mbcdlen, 1)) + memcpy (pstr->mbs + byte_idx, buf, mbclen); + else + { + int i; + + if (byte_idx + mbcdlen > pstr->bufs_len) + { + pstr->cur_state = prev_st; + break; + } + + if (pstr->offsets == NULL) + { + pstr->offsets = re_malloc (int, pstr->bufs_len); + + if (pstr->offsets == NULL) + return REG_ESPACE; + } + if (!pstr->offsets_needed) + { + for (i = 0; i < byte_idx; ++i) + pstr->offsets[i] = i; + pstr->offsets_needed = 1; + } + + memcpy (pstr->mbs + byte_idx, buf, mbcdlen); + pstr->wcs[byte_idx] = wcu; + pstr->offsets[byte_idx] = src_idx; + for (i = 1; i < mbcdlen; ++i) + { + pstr->offsets[byte_idx + i] + = src_idx + (i < mbclen ? i : mbclen - 1); + pstr->wcs[byte_idx + i] = WEOF; + } + pstr->len += mbcdlen - mbclen; + if (pstr->raw_stop > src_idx) + pstr->stop += mbcdlen - mbclen; + end_idx = (pstr->bufs_len > pstr->len) + ? pstr->len : pstr->bufs_len; + byte_idx += mbcdlen; + src_idx += mbclen; + continue; + } + } + else + memcpy (pstr->mbs + byte_idx, p, mbclen); + + if (BE (pstr->offsets_needed != 0, 0)) + { + int i; + for (i = 0; i < mbclen; ++i) + pstr->offsets[byte_idx + i] = src_idx + i; + } + src_idx += mbclen; + + pstr->wcs[byte_idx++] = wcu; + /* Write paddings. */ + for (remain_len = byte_idx + mbclen - 1; byte_idx < remain_len ;) + pstr->wcs[byte_idx++] = WEOF; + } + else if (mbclen == (size_t) -1 || mbclen == 0) + { + /* It is an invalid character or '\0'. Just use the byte. */ + int ch = pstr->raw_mbs[pstr->raw_mbs_idx + src_idx]; + + if (BE (pstr->trans != NULL, 0)) + ch = pstr->trans [ch]; + pstr->mbs[byte_idx] = ch; + + if (BE (pstr->offsets_needed != 0, 0)) + pstr->offsets[byte_idx] = src_idx; + ++src_idx; + + /* And also cast it to wide char. */ + pstr->wcs[byte_idx++] = (wchar_t) ch; + if (BE (mbclen == (size_t) -1, 0)) + pstr->cur_state = prev_st; + } + else + { + /* The buffer doesn't have enough space, finish to build. */ + pstr->cur_state = prev_st; + break; + } + } pstr->valid_len = byte_idx; + pstr->valid_raw_len = src_idx; + return REG_NOERROR; } /* Skip characters until the index becomes greater than NEW_RAW_IDX. @@ -308,7 +506,7 @@ re_string_skip_chars (pstr, new_raw_idx, last_wc) wchar_t wc = 0; /* Skip the characters which are not necessary to check. */ - for (rawbuf_idx = pstr->raw_mbs_idx + pstr->valid_len; + for (rawbuf_idx = pstr->raw_mbs_idx + pstr->valid_raw_len; rawbuf_idx < new_raw_idx;) { int remain_len; @@ -343,17 +541,15 @@ build_upper_buffer (pstr) for (char_idx = pstr->valid_len; char_idx < end_idx; ++char_idx) { int ch = pstr->raw_mbs[pstr->raw_mbs_idx + char_idx]; - if (pstr->trans != NULL) - { - ch = pstr->trans[ch]; - pstr->mbs_case[char_idx] = ch; - } + if (BE (pstr->trans != NULL, 0)) + ch = pstr->trans[ch]; if (islower (ch)) pstr->mbs[char_idx] = toupper (ch); else pstr->mbs[char_idx] = ch; } pstr->valid_len = char_idx; + pstr->valid_raw_len = char_idx; } /* Apply TRANS to the buffer in PSTR. */ @@ -368,37 +564,39 @@ re_string_translate_buffer (pstr) for (buf_idx = pstr->valid_len; buf_idx < end_idx; ++buf_idx) { int ch = pstr->raw_mbs[pstr->raw_mbs_idx + buf_idx]; - pstr->mbs_case[buf_idx] = pstr->trans[ch]; + pstr->mbs[buf_idx] = pstr->trans[ch]; } pstr->valid_len = buf_idx; + pstr->valid_raw_len = buf_idx; } /* This function re-construct the buffers. - Concretely, convert to wide character in case of re_mb_cur_max > 1, + Concretely, convert to wide character in case of pstr->mb_cur_max > 1, convert to upper case in case of REG_ICASE, apply translation. */ static reg_errcode_t -re_string_reconstruct (pstr, idx, eflags, newline) +re_string_reconstruct (pstr, idx, eflags) re_string_t *pstr; - int idx, eflags, newline; + int idx, eflags; { int offset = idx - pstr->raw_mbs_idx; if (offset < 0) { /* Reset buffer. */ #ifdef RE_ENABLE_I18N - if (re_mb_cur_max > 1) + if (pstr->mb_cur_max > 1) memset (&pstr->cur_state, '\0', sizeof (mbstate_t)); #endif /* RE_ENABLE_I18N */ - pstr->len += pstr->raw_mbs_idx; - pstr->stop += pstr->raw_mbs_idx; - pstr->valid_len = pstr->raw_mbs_idx = 0; + pstr->len = pstr->raw_len; + pstr->stop = pstr->raw_stop; + pstr->valid_len = 0; + pstr->raw_mbs_idx = 0; + pstr->valid_raw_len = 0; + pstr->offsets_needed = 0; pstr->tip_context = ((eflags & REG_NOTBOL) ? CONTEXT_BEGBUF : CONTEXT_NEWLINE | CONTEXT_BEGBUF); - if (!MBS_CASE_ALLOCATED (pstr)) - pstr->mbs_case = (unsigned char *) pstr->raw_mbs; - if (!MBS_ALLOCATED (pstr) && !MBS_CASE_ALLOCATED (pstr)) + if (!pstr->mbs_allocated) pstr->mbs = (unsigned char *) pstr->raw_mbs; offset = idx; } @@ -406,23 +604,26 @@ re_string_reconstruct (pstr, idx, eflags, newline) if (offset != 0) { /* Are the characters which are already checked remain? */ - if (offset < pstr->valid_len) + if (offset < pstr->valid_raw_len +#ifdef RE_ENABLE_I18N + /* Handling this would enlarge the code too much. + Accept a slowdown in that case. */ + && pstr->offsets_needed == 0 +#endif + ) { /* Yes, move them to the front of the buffer. */ - pstr->tip_context = re_string_context_at (pstr, offset - 1, eflags, - newline); + pstr->tip_context = re_string_context_at (pstr, offset - 1, eflags); #ifdef RE_ENABLE_I18N - if (re_mb_cur_max > 1) + if (pstr->mb_cur_max > 1) memmove (pstr->wcs, pstr->wcs + offset, (pstr->valid_len - offset) * sizeof (wint_t)); #endif /* RE_ENABLE_I18N */ - if (MBS_ALLOCATED (pstr)) + if (pstr->mbs_allocated) memmove (pstr->mbs, pstr->mbs + offset, pstr->valid_len - offset); - if (MBS_CASE_ALLOCATED (pstr)) - memmove (pstr->mbs_case, pstr->mbs_case + offset, - pstr->valid_len - offset); pstr->valid_len -= offset; + pstr->valid_raw_len -= offset; #if DEBUG assert (pstr->valid_len > 0); #endif @@ -430,19 +631,78 @@ re_string_reconstruct (pstr, idx, eflags, newline) else { /* No, skip all characters until IDX. */ +#ifdef RE_ENABLE_I18N + if (BE (pstr->offsets_needed, 0)) + { + pstr->len = pstr->raw_len - idx + offset; + pstr->stop = pstr->raw_stop - idx + offset; + pstr->offsets_needed = 0; + } +#endif pstr->valid_len = 0; + pstr->valid_raw_len = 0; #ifdef RE_ENABLE_I18N - if (re_mb_cur_max > 1) + if (pstr->mb_cur_max > 1) { int wcs_idx; - wint_t wc; - pstr->valid_len = re_string_skip_chars (pstr, idx, &wc) - idx; - for (wcs_idx = 0; wcs_idx < pstr->valid_len; ++wcs_idx) - pstr->wcs[wcs_idx] = WEOF; - if (pstr->trans && wc <= 0xff) - wc = pstr->trans[wc]; - pstr->tip_context = (IS_WIDE_WORD_CHAR (wc) ? CONTEXT_WORD - : ((newline && IS_WIDE_NEWLINE (wc)) + wint_t wc = WEOF; + +#ifdef _LIBC + if (pstr->is_utf8) + { + const unsigned char *raw, *p, *q, *end; + + /* Special case UTF-8. Multi-byte chars start with any + byte other than 0x80 - 0xbf. */ + raw = pstr->raw_mbs + pstr->raw_mbs_idx; + end = raw + (offset - pstr->mb_cur_max); + for (p = raw + offset - 1; p >= end; --p) + if ((*p & 0xc0) != 0x80) + { + mbstate_t cur_state; + wchar_t wc2; + int mlen = raw + pstr->len - p; + unsigned char buf[6]; + + q = p; + if (BE (pstr->trans != NULL, 0)) + { + int i = mlen < 6 ? mlen : 6; + while (--i >= 0) + buf[i] = pstr->trans[p[i]]; + q = buf; + } + /* XXX Don't use mbrtowc, we know which conversion + to use (UTF-8 -> UCS4). */ + memset (&cur_state, 0, sizeof (cur_state)); + mlen = mbrtowc (&wc2, p, mlen, &cur_state) + - (raw + offset - p); + if (mlen >= 0) + { + memset (&pstr->cur_state, '\0', + sizeof (mbstate_t)); + pstr->valid_len = mlen; + wc = wc2; + } + break; + } + } +#endif + if (wc == WEOF) + pstr->valid_len = re_string_skip_chars (pstr, idx, &wc) - idx; + if (BE (pstr->valid_len, 0)) + { + for (wcs_idx = 0; wcs_idx < pstr->valid_len; ++wcs_idx) + pstr->wcs[wcs_idx] = WEOF; + if (pstr->mbs_allocated) + memset (pstr->mbs, 255, pstr->valid_len); + } + pstr->valid_raw_len = pstr->valid_len; + pstr->tip_context = ((BE (pstr->word_ops_used != 0, 0) + && IS_WIDE_WORD_CHAR (wc)) + ? CONTEXT_WORD + : ((IS_WIDE_NEWLINE (wc) + && pstr->newline_anchor) ? CONTEXT_NEWLINE : 0)); } else @@ -451,18 +711,14 @@ re_string_reconstruct (pstr, idx, eflags, newline) int c = pstr->raw_mbs[pstr->raw_mbs_idx + offset - 1]; if (pstr->trans) c = pstr->trans[c]; - pstr->tip_context = (IS_WORD_CHAR (c) ? CONTEXT_WORD - : ((newline && IS_NEWLINE (c)) + pstr->tip_context = (bitset_contain (pstr->word_char, c) + ? CONTEXT_WORD + : ((IS_NEWLINE (c) && pstr->newline_anchor) ? CONTEXT_NEWLINE : 0)); } } - if (!MBS_CASE_ALLOCATED (pstr)) - { - pstr->mbs_case += offset; - /* In case of !MBS_ALLOCATED && !MBS_CASE_ALLOCATED. */ - if (!MBS_ALLOCATED (pstr)) - pstr->mbs += offset; - } + if (!pstr->mbs_allocated) + pstr->mbs += offset; } pstr->raw_mbs_idx = idx; pstr->len -= offset; @@ -470,10 +726,14 @@ re_string_reconstruct (pstr, idx, eflags, newline) /* Then build the buffers. */ #ifdef RE_ENABLE_I18N - if (re_mb_cur_max > 1) + if (pstr->mb_cur_max > 1) { if (pstr->icase) - build_wcs_upper_buffer (pstr); + { + int ret = build_wcs_upper_buffer (pstr); + if (BE (ret != REG_NOERROR, 0)) + return ret; + } else build_wcs_buffer (pstr); } @@ -484,31 +744,106 @@ re_string_reconstruct (pstr, idx, eflags, newline) build_upper_buffer (pstr); else if (pstr->trans != NULL) re_string_translate_buffer (pstr); + else + pstr->valid_len = pstr->len; } pstr->cur_idx = 0; return REG_NOERROR; } +static unsigned char +re_string_peek_byte_case (pstr, idx) + const re_string_t *pstr; + int idx; +{ + int ch, off; + + /* Handle the common (easiest) cases first. */ + if (BE (!pstr->mbs_allocated, 1)) + return re_string_peek_byte (pstr, idx); + +#ifdef RE_ENABLE_I18N + if (pstr->mb_cur_max > 1 + && ! re_string_is_single_byte_char (pstr, pstr->cur_idx + idx)) + return re_string_peek_byte (pstr, idx); +#endif + + off = pstr->cur_idx + idx; +#ifdef RE_ENABLE_I18N + if (pstr->offsets_needed) + off = pstr->offsets[off]; +#endif + + ch = pstr->raw_mbs[pstr->raw_mbs_idx + off]; + +#ifdef RE_ENABLE_I18N + /* Ensure that e.g. for tr_TR.UTF-8 BACKSLASH DOTLESS SMALL LETTER I + this function returns CAPITAL LETTER I instead of first byte of + DOTLESS SMALL LETTER I. The latter would confuse the parser, + since peek_byte_case doesn't advance cur_idx in any way. */ + if (pstr->offsets_needed && !isascii (ch)) + return re_string_peek_byte (pstr, idx); +#endif + + return ch; +} + +static unsigned char +re_string_fetch_byte_case (pstr) + re_string_t *pstr; +{ + if (BE (!pstr->mbs_allocated, 1)) + return re_string_fetch_byte (pstr); + +#ifdef RE_ENABLE_I18N + if (pstr->offsets_needed) + { + int off, ch; + + /* For tr_TR.UTF-8 [[:islower:]] there is + [[: CAPITAL LETTER I WITH DOT lower:]] in mbs. Skip + in that case the whole multi-byte character and return + the original letter. On the other side, with + [[: DOTLESS SMALL LETTER I return [[:I, as doing + anything else would complicate things too much. */ + + if (!re_string_first_byte (pstr, pstr->cur_idx)) + return re_string_fetch_byte (pstr); + + off = pstr->offsets[pstr->cur_idx]; + ch = pstr->raw_mbs[pstr->raw_mbs_idx + off]; + + if (! isascii (ch)) + return re_string_fetch_byte (pstr); + + re_string_skip_bytes (pstr, + re_string_char_size_at (pstr, pstr->cur_idx)); + return ch; + } +#endif + + return pstr->raw_mbs[pstr->raw_mbs_idx + pstr->cur_idx++]; +} + static void re_string_destruct (pstr) re_string_t *pstr; { #ifdef RE_ENABLE_I18N re_free (pstr->wcs); + re_free (pstr->offsets); #endif /* RE_ENABLE_I18N */ - if (MBS_ALLOCATED (pstr)) + if (pstr->mbs_allocated) re_free (pstr->mbs); - if (MBS_CASE_ALLOCATED (pstr)) - re_free (pstr->mbs_case); } /* Return the context at IDX in INPUT. */ static unsigned int -re_string_context_at (input, idx, eflags, newline_anchor) +re_string_context_at (input, idx, eflags) const re_string_t *input; - int idx, eflags, newline_anchor; + int idx, eflags; { int c; if (idx < 0 || idx == input->len) @@ -522,7 +857,7 @@ re_string_context_at (input, idx, eflags, newline_anchor) : CONTEXT_NEWLINE | CONTEXT_ENDBUF); } #ifdef RE_ENABLE_I18N - if (re_mb_cur_max > 1) + if (input->mb_cur_max > 1) { wint_t wc; int wc_idx = idx; @@ -537,17 +872,18 @@ re_string_context_at (input, idx, eflags, newline_anchor) return input->tip_context; } wc = input->wcs[wc_idx]; - if (IS_WIDE_WORD_CHAR (wc)) + if (BE (input->word_ops_used != 0, 0) && IS_WIDE_WORD_CHAR (wc)) return CONTEXT_WORD; - return (newline_anchor && IS_WIDE_NEWLINE (wc)) ? CONTEXT_NEWLINE : 0; + return (IS_WIDE_NEWLINE (wc) && input->newline_anchor + ? CONTEXT_NEWLINE : 0); } else #endif { c = re_string_byte_at (input, idx); - if (IS_WORD_CHAR (c)) + if (bitset_contain (input->word_char, c)) return CONTEXT_WORD; - return (newline_anchor && IS_NEWLINE (c)) ? CONTEXT_NEWLINE : 0; + return IS_NEWLINE (c) && input->newline_anchor ? CONTEXT_NEWLINE : 0; } } @@ -645,43 +981,86 @@ re_node_set_add_intersect (dest, src1, src2) re_node_set *dest; const re_node_set *src1, *src2; { - int i1, i2, id; - if (src1->nelem > 0 && src2->nelem > 0) + int i1, i2, is, id, delta, sbase; + if (src1->nelem == 0 || src2->nelem == 0) + return REG_NOERROR; + + /* We need dest->nelem + 2 * elems_in_intersection; this is a + conservative estimate. */ + if (src1->nelem + src2->nelem + dest->nelem > dest->alloc) { - if (src1->nelem + src2->nelem + dest->nelem > dest->alloc) - { - dest->alloc = src1->nelem + src2->nelem + dest->nelem; - dest->elems = re_realloc (dest->elems, int, dest->alloc); - if (BE (dest->elems == NULL, 0)) - return REG_ESPACE; - } + int new_alloc = src1->nelem + src2->nelem + dest->alloc; + int *new_elems = re_realloc (dest->elems, int, new_alloc); + if (BE (new_elems == NULL, 0)) + return REG_ESPACE; + dest->elems = new_elems; + dest->alloc = new_alloc; } - else - return REG_NOERROR; - for (i1 = i2 = id = 0 ; i1 < src1->nelem && i2 < src2->nelem ;) + /* Find the items in the intersection of SRC1 and SRC2, and copy + into the top of DEST those that are not already in DEST itself. */ + sbase = dest->nelem + src1->nelem + src2->nelem; + i1 = src1->nelem - 1; + i2 = src2->nelem - 1; + id = dest->nelem - 1; + for (;;) { - if (src1->elems[i1] > src2->elems[i2]) + if (src1->elems[i1] == src2->elems[i2]) { - ++i2; - continue; + /* Try to find the item in DEST. Maybe we could binary search? */ + while (id >= 0 && dest->elems[id] > src1->elems[i1]) + --id; + + if (id < 0 || dest->elems[id] != src1->elems[i1]) + dest->elems[--sbase] = src1->elems[i1]; + + if (--i1 < 0 || --i2 < 0) + break; } - if (src1->elems[i1] == src2->elems[i2]) + + /* Lower the highest of the two items. */ + else if (src1->elems[i1] < src2->elems[i2]) { - while (id < dest->nelem && dest->elems[id] < src2->elems[i2]) - ++id; - if (id < dest->nelem && dest->elems[id] == src2->elems[i2]) - ++id; - else - { - memmove (dest->elems + id + 1, dest->elems + id, - sizeof (int) * (dest->nelem - id)); - dest->elems[id++] = src2->elems[i2++]; - ++dest->nelem; - } + if (--i2 < 0) + break; + } + else + { + if (--i1 < 0) + break; } - ++i1; } + + id = dest->nelem - 1; + is = dest->nelem + src1->nelem + src2->nelem - 1; + delta = is - sbase + 1; + + /* Now copy. When DELTA becomes zero, the remaining + DEST elements are already in place; this is more or + less the same loop that is in re_node_set_merge. */ + dest->nelem += delta; + if (delta > 0 && id >= 0) + for (;;) + { + if (dest->elems[is] > dest->elems[id]) + { + /* Copy from the top. */ + dest->elems[id + delta--] = dest->elems[is--]; + if (delta == 0) + break; + } + else + { + /* Slide from the bottom. */ + dest->elems[id + delta] = dest->elems[id]; + if (--id < 0) + break; + } + } + + /* Copy remaining SRC elements. */ + memcpy (dest->elems, dest->elems + sbase, delta * sizeof (int)); + return REG_NOERROR; } @@ -746,70 +1125,83 @@ re_node_set_merge (dest, src) re_node_set *dest; const re_node_set *src; { - int si, di; + int is, id, sbase, delta; if (src == NULL || src->nelem == 0) return REG_NOERROR; - if (dest->alloc < src->nelem + dest->nelem) + if (dest->alloc < 2 * src->nelem + dest->nelem) { - int *new_buffer; - dest->alloc = 2 * (src->nelem + dest->alloc); - new_buffer = re_realloc (dest->elems, int, dest->alloc); + int new_alloc = 2 * (src->nelem + dest->alloc); + int *new_buffer = re_realloc (dest->elems, int, new_alloc); if (BE (new_buffer == NULL, 0)) return REG_ESPACE; dest->elems = new_buffer; + dest->alloc = new_alloc; } - for (si = 0, di = 0 ; si < src->nelem && di < dest->nelem ;) + if (BE (dest->nelem == 0, 0)) { - int cp_from, ncp, mid, right, src_elem = src->elems[si]; - /* Binary search the spot we will add the new element. */ - right = dest->nelem; - while (di < right) - { - mid = (di + right) / 2; - if (dest->elems[mid] < src_elem) - di = mid + 1; - else - right = mid; - } - if (di >= dest->nelem) - break; + dest->nelem = src->nelem; + memcpy (dest->elems, src->elems, src->nelem * sizeof (int)); + return REG_NOERROR; + } - if (dest->elems[di] == src_elem) - { - /* Skip since, DEST already has the element. */ - ++di; - ++si; - continue; - } + /* Copy into the top of DEST the items of SRC that are not + found in DEST. Maybe we could binary search in DEST? */ + for (sbase = dest->nelem + 2 * src->nelem, + is = src->nelem - 1, id = dest->nelem - 1; is >= 0 && id >= 0; ) + { + if (dest->elems[id] == src->elems[is]) + is--, id--; + else if (dest->elems[id] < src->elems[is]) + dest->elems[--sbase] = src->elems[is--]; + else /* if (dest->elems[id] > src->elems[is]) */ + --id; + } - /* Skip the src elements which are less than dest->elems[di]. */ - cp_from = si; - while (si < src->nelem && src->elems[si] < dest->elems[di]) - ++si; - /* Copy these src elements. */ - ncp = si - cp_from; - memmove (dest->elems + di + ncp, dest->elems + di, - sizeof (int) * (dest->nelem - di)); - memcpy (dest->elems + di, src->elems + cp_from, - sizeof (int) * ncp); - /* Update counters. */ - di += ncp; - dest->nelem += ncp; + if (is >= 0) + { + /* If DEST is exhausted, the remaining items of SRC must be unique. */ + sbase -= is + 1; + memcpy (dest->elems + sbase, src->elems, (is + 1) * sizeof (int)); } - /* Copy remaining src elements. */ - if (si < src->nelem) + id = dest->nelem - 1; + is = dest->nelem + 2 * src->nelem - 1; + delta = is - sbase + 1; + if (delta == 0) + return REG_NOERROR; + + /* Now copy. When DELTA becomes zero, the remaining + DEST elements are already in place. */ + dest->nelem += delta; + for (;;) { - memcpy (dest->elems + di, src->elems + si, - sizeof (int) * (src->nelem - si)); - dest->nelem += src->nelem - si; + if (dest->elems[is] > dest->elems[id]) + { + /* Copy from the top. */ + dest->elems[id + delta--] = dest->elems[is--]; + if (delta == 0) + break; + } + else + { + /* Slide from the bottom. */ + dest->elems[id + delta] = dest->elems[id]; + if (--id < 0) + { + /* Copy remaining SRC elements. */ + memcpy (dest->elems, dest->elems + sbase, + delta * sizeof (int)); + break; + } + } } + return REG_NOERROR; } /* Insert the new element ELEM to the re_node_set* SET. - return 0 if SET already has ELEM, + SET should not already have ELEM. return -1 if an error is occured, return 1 otherwise. */ static int @@ -817,9 +1209,9 @@ re_node_set_insert (set, elem) re_node_set *set; int elem; { - int idx, right, mid; - /* In case of the set is empty. */ - if (set->elems == NULL || set->alloc == 0) + int idx; + /* In case the set is empty. */ + if (set->alloc == 0) { if (BE (re_node_set_init_1 (set, elem) == REG_NOERROR, 1)) return 1; @@ -827,43 +1219,39 @@ re_node_set_insert (set, elem) return -1; } - /* Binary search the spot we will add the new element. */ - idx = 0; - right = set->nelem; - while (idx < right) + if (BE (set->nelem, 0) == 0) { - mid = (idx + right) / 2; - if (set->elems[mid] < elem) - idx = mid + 1; - else - right = mid; + /* We already guaranteed above that set->alloc != 0. */ + set->elems[0] = elem; + ++set->nelem; + return 1; } /* Realloc if we need. */ - if (set->alloc < set->nelem + 1) + if (set->alloc == set->nelem) { int *new_array; set->alloc = set->alloc * 2; - new_array = re_malloc (int, set->alloc); + new_array = re_realloc (set->elems, int, set->alloc); if (BE (new_array == NULL, 0)) return -1; - /* Copy the elements they are followed by the new element. */ - if (idx > 0) - memcpy (new_array, set->elems, sizeof (int) * (idx)); - /* Copy the elements which follows the new element. */ - if (set->nelem - idx > 0) - memcpy (new_array + idx + 1, set->elems + idx, - sizeof (int) * (set->nelem - idx)); - re_free (set->elems); set->elems = new_array; } + + /* Move the elements which follows the new element. Test the + first element separately to skip a check in the inner loop. */ + if (elem < set->elems[0]) + { + idx = 0; + for (idx = set->nelem; idx > 0; idx--) + set->elems[idx] = set->elems[idx - 1]; + } else { - /* Move the elements which follows the new element. */ - if (set->nelem - idx > 0) - memmove (set->elems + idx + 1, set->elems + idx, - sizeof (int) * (set->nelem - idx)); + for (idx = set->nelem; set->elems[idx - 1] > elem; idx--) + set->elems[idx] = set->elems[idx - 1]; } + /* Insert the new element. */ set->elems[idx] = elem; ++set->nelem; @@ -871,7 +1259,7 @@ re_node_set_insert (set, elem) } /* Compare two node sets SET1 and SET2. - return 1 if SET1 and SET2 are equivalent, retrun 0 otherwise. */ + return 1 if SET1 and SET2 are equivalent, return 0 otherwise. */ static int re_node_set_compare (set1, set2) @@ -880,7 +1268,7 @@ re_node_set_compare (set1, set2) int i; if (set1 == NULL || set2 == NULL || set1->nelem != set2->nelem) return 0; - for (i = 0 ; i < set1->nelem ; i++) + for (i = set1->nelem ; --i >= 0 ; ) if (set1->elems[i] != set2->elems[i]) return 0; return 1; @@ -918,10 +1306,9 @@ re_node_set_remove_at (set, idx) { if (idx < 0 || idx >= set->nelem) return; - if (idx < set->nelem - 1) - memmove (set->elems + idx, set->elems + idx + 1, - sizeof (int) * (set->nelem - idx - 1)); --set->nelem; + for (; idx < set->nelem; idx++) + set->elems[idx] = set->elems[idx + 1]; } @@ -934,27 +1321,26 @@ re_dfa_add_node (dfa, token, mode) re_token_t token; int mode; { - if (dfa->nodes_len >= dfa->nodes_alloc) + if (BE (dfa->nodes_len >= dfa->nodes_alloc, 0)) { - re_token_t *new_array; - dfa->nodes_alloc *= 2; - new_array = re_realloc (dfa->nodes, re_token_t, dfa->nodes_alloc); + int new_nodes_alloc = dfa->nodes_alloc * 2; + re_token_t *new_array = re_realloc (dfa->nodes, re_token_t, + new_nodes_alloc); if (BE (new_array == NULL, 0)) return -1; - else - dfa->nodes = new_array; + dfa->nodes = new_array; if (mode) { int *new_nexts, *new_indices; re_node_set *new_edests, *new_eclosures, *new_inveclosures; - new_nexts = re_realloc (dfa->nexts, int, dfa->nodes_alloc); - new_indices = re_realloc (dfa->org_indices, int, dfa->nodes_alloc); - new_edests = re_realloc (dfa->edests, re_node_set, dfa->nodes_alloc); + new_nexts = re_realloc (dfa->nexts, int, new_nodes_alloc); + new_indices = re_realloc (dfa->org_indices, int, new_nodes_alloc); + new_edests = re_realloc (dfa->edests, re_node_set, new_nodes_alloc); new_eclosures = re_realloc (dfa->eclosures, re_node_set, - dfa->nodes_alloc); + new_nodes_alloc); new_inveclosures = re_realloc (dfa->inveclosures, re_node_set, - dfa->nodes_alloc); + new_nodes_alloc); if (BE (new_nexts == NULL || new_indices == NULL || new_edests == NULL || new_eclosures == NULL || new_inveclosures == NULL, 0)) @@ -965,8 +1351,10 @@ re_dfa_add_node (dfa, token, mode) dfa->eclosures = new_eclosures; dfa->inveclosures = new_inveclosures; } + dfa->nodes_alloc = new_nodes_alloc; } dfa->nodes[dfa->nodes_len] = token; + dfa->nodes[dfa->nodes_len].opt_subexp = 0; dfa->nodes[dfa->nodes_len].duplicated = 0; dfa->nodes[dfa->nodes_len].constraint = 0; return dfa->nodes_len++; @@ -1063,10 +1451,9 @@ re_acquire_state_context (err, dfa, nodes, context) for (i = 0 ; i < spot->num ; i++) { re_dfastate_t *state = spot->array[i]; - if (hash != state->hash) - continue; - if (re_node_set_compare (state->entrance_nodes, nodes) - && state->context == context) + if (state->hash == hash + && state->context == context + && re_node_set_compare (state->entrance_nodes, nodes)) return state; } /* There are no appropriate state in `dfa', create the new one. */ @@ -1101,7 +1488,6 @@ create_newstate_common (dfa, nodes, hash) return NULL; } newstate->trtable = NULL; - newstate->trtable_search = NULL; newstate->hash = hash; return newstate; } @@ -1118,14 +1504,15 @@ register_state (dfa, newstate, hash) struct re_state_table_entry *spot; spot = dfa->state_table + (hash & dfa->state_hash_mask); - if (spot->alloc <= spot->num) + if (BE (spot->alloc <= spot->num, 0)) { - re_dfastate_t **new_array; - spot->alloc = 2 * spot->num + 2; - new_array = re_realloc (spot->array, re_dfastate_t *, spot->alloc); + int new_alloc = 2 * spot->num + 2; + re_dfastate_t **new_array = re_realloc (spot->array, re_dfastate_t *, + new_alloc); if (BE (new_array == NULL, 0)) return REG_ESPACE; spot->array = new_array; + spot->alloc = new_alloc; } spot->array[spot->num++] = newstate; return REG_NOERROR; @@ -1160,7 +1547,8 @@ create_ci_newstate (dfa, nodes, hash) newstate->halt = 1; #ifdef RE_ENABLE_I18N else if (type == COMPLEX_BRACKET - || (type == OP_PERIOD && re_mb_cur_max > 1)) + || type == OP_UTF8_PERIOD + || (type == OP_PERIOD && dfa->mb_cur_max > 1)) newstate->accept_mb = 1; #endif /* RE_ENABLE_I18N */ else if (type == OP_BACK_REF) @@ -1211,7 +1599,8 @@ create_cd_newstate (dfa, nodes, context, hash) newstate->halt = 1; #ifdef RE_ENABLE_I18N else if (type == COMPLEX_BRACKET - || (type == OP_PERIOD && re_mb_cur_max > 1)) + || type == OP_UTF8_PERIOD + || (type == OP_PERIOD && dfa->mb_cur_max > 1)) newstate->accept_mb = 1; #endif /* RE_ENABLE_I18N */ else if (type == OP_BACK_REF) @@ -1261,6 +1650,5 @@ free_state (state) } re_node_set_free (&state->nodes); re_free (state->trtable); - re_free (state->trtable_search); re_free (state); } diff --git a/regex_internal.h b/regex_internal.h index 6e81710e0..6bc09b36e 100644 --- a/regex_internal.h +++ b/regex_internal.h @@ -1,5 +1,5 @@ /* Extended regular expression matching and search library. - Copyright (C) 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa . @@ -21,10 +21,6 @@ #ifndef _REGEX_INTERNAL_H #define _REGEX_INTERNAL_H 1 -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #if 0 @@ -81,7 +77,9 @@ # define gettext_noop(String) String #endif -#if (defined MB_CUR_MAX && HAVE_LOCALE_H && HAVE_WCTYPE_H && HAVE_WCHAR_H && HAVE_WCRTOMB && HAVE_MBRTOWC && HAVE_WCSCOLL) || _LIBC +#include "mbsupport.h" /* gawk */ + +#if (defined MBS_SUPPORT) || _LIBC # define RE_ENABLE_I18N #endif @@ -108,11 +106,17 @@ # define __wctype wctype # define __iswctype iswctype # define __btowc btowc +# define __mempcpy mempcpy # define __wcrtomb wcrtomb # define attribute_hidden -# define __thread #endif /* not _LIBC */ +#ifdef __GNUC__ +# define __attribute(arg) __attribute__ (arg) +#else +# define __attribute(arg) +#endif + #if _LIBC || __GNUC__ >= 3 # define BE(expr, val) __builtin_expect (expr, val) #else @@ -120,10 +124,6 @@ # define inline #endif -#ifdef RE_ENABLE_I18N -__thread int re_mb_cur_max = 1; -#endif - extern const char __re_error_msgid[] attribute_hidden; extern const size_t __re_error_msgid_idx[] attribute_hidden; @@ -133,18 +133,20 @@ extern const size_t __re_error_msgid_idx[] attribute_hidden; #define BITSET_UINTS ((SBC_MAX + UINT_BITS - 1) / UINT_BITS) typedef unsigned int bitset[BITSET_UINTS]; typedef unsigned int *re_bitset_ptr_t; +typedef const unsigned int *re_const_bitset_ptr_t; -#define bitset_set(set,i) (set[i / UINT_BITS] |= 1UL << i % UINT_BITS) -#define bitset_clear(set,i) (set[i / UINT_BITS] &= ~(1UL << i % UINT_BITS)) -#define bitset_contain(set,i) (set[i / UINT_BITS] & (1UL << i % UINT_BITS)) +#define bitset_set(set,i) (set[i / UINT_BITS] |= 1 << i % UINT_BITS) +#define bitset_clear(set,i) (set[i / UINT_BITS] &= ~(1 << i % UINT_BITS)) +#define bitset_contain(set,i) (set[i / UINT_BITS] & (1 << i % UINT_BITS)) #define bitset_empty(set) memset (set, 0, sizeof (unsigned int) * BITSET_UINTS) #define bitset_set_all(set) \ memset (set, 255, sizeof (unsigned int) * BITSET_UINTS) #define bitset_copy(dest,src) \ memcpy (dest, src, sizeof (unsigned int) * BITSET_UINTS) -static inline void bitset_not _RE_ARGS((bitset set)); -static inline void bitset_merge _RE_ARGS((bitset dest, const bitset src)); -static inline void bitset_not_merge _RE_ARGS((bitset dest, const bitset src)); +static inline void bitset_not (bitset set); +static inline void bitset_merge (bitset dest, const bitset src); +static inline void bitset_not_merge (bitset dest, const bitset src); +static inline void bitset_mask (bitset dest, const bitset src); #define PREV_WORD_CONSTRAINT 0x0001 #define PREV_NOTWORD_CONSTRAINT 0x0002 @@ -179,8 +181,33 @@ typedef enum { NON_TYPE = 0, + /* Node type, These are used by token, node, tree. */ + CHARACTER = 1, + END_OF_RE = 2, + SIMPLE_BRACKET = 3, + OP_BACK_REF = 4, + OP_PERIOD = 5, +#ifdef RE_ENABLE_I18N + COMPLEX_BRACKET = 6, + OP_UTF8_PERIOD = 7, +#endif /* RE_ENABLE_I18N */ + + /* We define EPSILON_BIT as a macro so that OP_OPEN_SUBEXP is used + when the debugger shows values of this enum type. */ +#define EPSILON_BIT 8 + OP_OPEN_SUBEXP = EPSILON_BIT | 0, + OP_CLOSE_SUBEXP = EPSILON_BIT | 1, + OP_ALT = EPSILON_BIT | 2, + OP_DUP_ASTERISK = EPSILON_BIT | 3, + OP_DUP_PLUS = EPSILON_BIT | 4, + OP_DUP_QUESTION = EPSILON_BIT | 5, + ANCHOR = EPSILON_BIT | 6, + + /* Tree type, these are used only by tree. */ + CONCAT = 16, + /* Token type, these are used only by token. */ - OP_OPEN_BRACKET, + OP_OPEN_BRACKET = 17, OP_CLOSE_BRACKET, OP_CHARSET_RANGE, OP_OPEN_DUP_NUM, @@ -194,32 +221,10 @@ typedef enum OP_CLOSE_CHAR_CLASS, OP_WORD, OP_NOTWORD, - BACK_SLASH, - - /* Tree type, these are used only by tree. */ - CONCAT, - ALT, - SUBEXP, - SIMPLE_BRACKET, -#ifdef RE_ENABLE_I18N - COMPLEX_BRACKET, -#endif /* RE_ENABLE_I18N */ + OP_SPACE, + OP_NOTSPACE, + BACK_SLASH - /* Node type, These are used by token, node, tree. */ - OP_OPEN_SUBEXP, - OP_CLOSE_SUBEXP, - OP_PERIOD, - CHARACTER, - END_OF_RE, - OP_ALT, - OP_DUP_ASTERISK, - OP_DUP_PLUS, - OP_DUP_QUESTION, - OP_BACK_REF, - ANCHOR, - - /* Dummy marker. */ - END_OF_RE_TOKEN_T } re_token_type_t; #ifdef RE_ENABLE_I18N @@ -289,18 +294,18 @@ typedef struct #endif unsigned int constraint : 10; /* context constraint */ unsigned int duplicated : 1; + unsigned int opt_subexp : 1; #ifdef RE_ENABLE_I18N + /* These 2 bits can be moved into the union if needed (e.g. if running out + of bits; move opr.c to opr.c.c and move the flags to opr.c.flags). */ unsigned int mb_partial : 1; #endif + unsigned int word_char : 1; } re_token_t; -#define IS_EPSILON_NODE(type) \ - ((type) == OP_ALT || (type) == OP_DUP_ASTERISK || (type) == OP_DUP_PLUS \ - || (type) == OP_DUP_QUESTION || (type) == ANCHOR \ - || (type) == OP_OPEN_SUBEXP || (type) == OP_CLOSE_SUBEXP) - +#define IS_EPSILON_NODE(type) ((type) & EPSILON_BIT) #define ACCEPT_MB_NODE(type) \ - ((type) == COMPLEX_BRACKET || (type) == OP_PERIOD) + ((type) >= OP_PERIOD && (type) <= OP_UTF8_PERIOD) struct re_string_t { @@ -311,13 +316,10 @@ struct re_string_t REG_ICASE, upper cases of the string are stored, otherwise MBS points the same address that RAW_MBS points. */ unsigned char *mbs; - /* Store the case sensitive multibyte string. In case of - "case insensitive mode", the original string are stored, - otherwise MBS_CASE points the same address that MBS points. */ - unsigned char *mbs_case; #ifdef RE_ENABLE_I18N /* Store the wide character string which is corresponding to MBS. */ wint_t *wcs; + int *offsets; mbstate_t cur_state; #endif /* Index in RAW_MBS. Each character mbs[i] corresponds to @@ -325,15 +327,21 @@ struct re_string_t int raw_mbs_idx; /* The length of the valid characters in the buffers. */ int valid_len; - /* The length of the buffers MBS, MBS_CASE, and WCS. */ + /* The corresponding number of bytes in raw_mbs array. */ + int valid_raw_len; + /* The length of the buffers MBS and WCS. */ int bufs_len; /* The index in MBS, which is updated by re_string_fetch_byte. */ int cur_idx; - /* This is length_of_RAW_MBS - RAW_MBS_IDX. */ + /* length of RAW_MBS array. */ + int raw_len; + /* This is RAW_LEN - RAW_MBS_IDX + VALID_LEN - VALID_RAW_LEN. */ int len; /* End of the buffer may be shorter than its length in the cases such as re_match_2, re_search_2. Then, we use STOP for end of the buffer instead of LEN. */ + int raw_stop; + /* This is RAW_STOP - RAW_MBS_IDX adjusted through OFFSETS. */ int stop; /* The context of mbs[0]. We store the context independently, since @@ -341,51 +349,78 @@ struct re_string_t the beginning of the input string. */ unsigned int tip_context; /* The translation passed as a part of an argument of re_compile_pattern. */ - RE_TRANSLATE_TYPE trans; + unsigned RE_TRANSLATE_TYPE trans; + /* Copy of re_dfa_t's word_char. */ + re_const_bitset_ptr_t word_char; /* 1 if REG_ICASE. */ - unsigned int icase : 1; + unsigned char icase; + unsigned char is_utf8; + unsigned char map_notascii; + unsigned char mbs_allocated; + unsigned char offsets_needed; + unsigned char newline_anchor; + unsigned char word_ops_used; + int mb_cur_max; }; typedef struct re_string_t re_string_t; -/* In case of REG_ICASE, we allocate the buffer dynamically for mbs. */ -#define MBS_ALLOCATED(pstr) (pstr->icase) -/* In case that we need translation, we allocate the buffer dynamically - for mbs_case. Note that mbs == mbs_case if not REG_ICASE. */ -#define MBS_CASE_ALLOCATED(pstr) (pstr->trans != NULL) -static reg_errcode_t re_string_allocate _RE_ARGS((re_string_t *pstr, const char *str, + +struct re_dfa_t; +typedef struct re_dfa_t re_dfa_t; + +#ifndef _LIBC +# ifdef __i386__ +# define internal_function __attribute ((regparm (3), stdcall)) +# else +# define internal_function +# endif +#endif + +#ifndef RE_NO_INTERNAL_PROTOTYPES +static reg_errcode_t re_string_allocate (re_string_t *pstr, const char *str, int len, int init_len, - RE_TRANSLATE_TYPE trans, int icase)); -static reg_errcode_t re_string_construct _RE_ARGS((re_string_t *pstr, const char *str, int len, - RE_TRANSLATE_TYPE trans, int icase)); -static reg_errcode_t re_string_reconstruct _RE_ARGS((re_string_t *pstr, int idx, - int eflags, int newline)); -static reg_errcode_t re_string_realloc_buffers _RE_ARGS((re_string_t *pstr, int new_buf_len)); -#ifdef RE_ENABLE_I18N -static void build_wcs_buffer _RE_ARGS((re_string_t *pstr)); -static void build_wcs_upper_buffer _RE_ARGS((re_string_t *pstr)); -#endif /* RE_ENABLE_I18N */ -static void build_upper_buffer _RE_ARGS((re_string_t *pstr)); -static void re_string_translate_buffer _RE_ARGS((re_string_t *pstr)); -static void re_string_destruct _RE_ARGS((re_string_t *pstr)); -#ifdef RE_ENABLE_I18N -static int re_string_elem_size_at _RE_ARGS((const re_string_t *pstr, int idx)); -static inline int re_string_char_size_at _RE_ARGS((const re_string_t *pstr, int idx)); -static inline wint_t re_string_wchar_at _RE_ARGS((const re_string_t *pstr, int idx)); -#endif /* RE_ENABLE_I18N */ -static unsigned int re_string_context_at _RE_ARGS((const re_string_t *input, int idx, - int eflags, int newline_anchor)); + RE_TRANSLATE_TYPE trans, int icase, + const re_dfa_t *dfa) + internal_function; +static reg_errcode_t re_string_construct (re_string_t *pstr, const char *str, + int len, RE_TRANSLATE_TYPE trans, + int icase, const re_dfa_t *dfa) + internal_function; +static reg_errcode_t re_string_reconstruct (re_string_t *pstr, int idx, + int eflags) internal_function; +static reg_errcode_t re_string_realloc_buffers (re_string_t *pstr, + int new_buf_len) + internal_function; +# ifdef RE_ENABLE_I18N +static void build_wcs_buffer (re_string_t *pstr) internal_function; +static int build_wcs_upper_buffer (re_string_t *pstr) internal_function; +# endif /* RE_ENABLE_I18N */ +static void build_upper_buffer (re_string_t *pstr) internal_function; +static void re_string_translate_buffer (re_string_t *pstr) internal_function; +static void re_string_destruct (re_string_t *pstr) internal_function; +# ifdef RE_ENABLE_I18N +static int re_string_elem_size_at (const re_string_t *pstr, int idx) + internal_function; +static inline int re_string_char_size_at (const re_string_t *pstr, int idx) + internal_function; +static inline wint_t re_string_wchar_at (const re_string_t *pstr, int idx) + internal_function; +# endif /* RE_ENABLE_I18N */ +static unsigned int re_string_context_at (const re_string_t *input, int idx, + int eflags) internal_function; +static unsigned char re_string_peek_byte_case (const re_string_t *pstr, + int idx) internal_function; +static unsigned char re_string_fetch_byte_case (re_string_t *pstr) + internal_function; +#endif #define re_string_peek_byte(pstr, offset) \ ((pstr)->mbs[(pstr)->cur_idx + offset]) -#define re_string_peek_byte_case(pstr, offset) \ - ((pstr)->mbs_case[(pstr)->cur_idx + offset]) #define re_string_fetch_byte(pstr) \ ((pstr)->mbs[(pstr)->cur_idx++]) -#define re_string_fetch_byte_case(pstr) \ - ((pstr)->mbs_case[(pstr)->cur_idx++]) #define re_string_first_byte(pstr, idx) \ - ((idx) == (pstr)->len || (pstr)->wcs[idx] != WEOF) + ((idx) == (pstr)->valid_len || (pstr)->wcs[idx] != WEOF) #define re_string_is_single_byte_char(pstr, idx) \ - ((pstr)->wcs[idx] != WEOF && ((pstr)->len == (idx) \ + ((pstr)->wcs[idx] != WEOF && ((pstr)->valid_len == (idx) + 1 \ || (pstr)->wcs[(idx) + 1] != WEOF)) #define re_string_eoi(pstr) ((pstr)->stop <= (pstr)->cur_idx) #define re_string_cur_idx(pstr) ((pstr)->cur_idx) @@ -396,7 +431,9 @@ static unsigned int re_string_context_at _RE_ARGS((const re_string_t *input, int #define re_string_set_index(pstr,idx) ((pstr)->cur_idx = (idx)) #define re_malloc(t,n) ((t *) malloc ((n) * sizeof (t))) -#define re_realloc(p,t,n) ((t *) realloc (p, (n) * sizeof (t))) +/* SunOS 4.1.x realloc doesn't accept null pointers: pre-Standard C. Sigh. */ +#define re_realloc(p,t,n) ((p != NULL) ? (t *) realloc (p,(n)*sizeof(t)) : (t *) calloc(n,sizeof(t))) + #define re_free(p) free (p) struct bin_tree_t @@ -416,6 +453,15 @@ struct bin_tree_t }; typedef struct bin_tree_t bin_tree_t; +#define BIN_TREE_STORAGE_SIZE \ + ((1024 - sizeof (void *)) / sizeof (bin_tree_t)) + +struct bin_tree_storage_t +{ + struct bin_tree_storage_t *next; + bin_tree_t data[BIN_TREE_STORAGE_SIZE]; +}; +typedef struct bin_tree_storage_t bin_tree_storage_t; #define CONTEXT_WORD 1 #define CONTEXT_NEWLINE (CONTEXT_WORD << 1) @@ -451,11 +497,7 @@ struct re_dfastate_t re_node_set nodes; re_node_set *entrance_nodes; struct re_dfastate_t **trtable; - struct re_dfastate_t **trtable_search; - /* If this state is a special state. - A state is a special state if the state is the halt state, or - a anchor. */ - unsigned int context : 2; + unsigned int context : 4; unsigned int halt : 1; /* If this state can accept `multi byte'. Note that we refer to multibyte characters, and multi character @@ -464,6 +506,7 @@ struct re_dfastate_t /* If this state has backreference node(s). */ unsigned int has_backref : 1; unsigned int has_constraint : 1; + unsigned int word_trtable : 1; }; typedef struct re_dfastate_t re_dfastate_t; @@ -525,13 +568,18 @@ struct re_backref_cache_entry typedef struct { + /* The string object corresponding to the input string. */ + re_string_t input; +#if defined _LIBC || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L) + re_dfa_t *const dfa; +#else + re_dfa_t *dfa; +#endif /* EFLAGS of the argument of regexec. */ int eflags; /* Where the matching ends. */ int match_last; int last_node; - /* The string object corresponding to the input string. */ - re_string_t *input; /* The state log used by the matcher. */ re_dfastate_t **state_log; int state_log_top; @@ -577,71 +625,83 @@ struct re_fail_stack_t struct re_dfa_t { - re_bitset_ptr_t word_char; - - /* number of subexpressions `re_nsub' is in regex_t. */ - int subexps_alloc; re_subexp_t *subexps; - re_token_t *nodes; int nodes_alloc; int nodes_len; - bin_tree_t *str_tree; int *nexts; int *org_indices; re_node_set *edests; re_node_set *eclosures; re_node_set *inveclosures; struct re_state_table_entry *state_table; - unsigned int state_hash_mask; re_dfastate_t *init_state; re_dfastate_t *init_state_word; re_dfastate_t *init_state_nl; re_dfastate_t *init_state_begbuf; + bin_tree_t *str_tree; + bin_tree_storage_t *str_tree_storage; + re_bitset_ptr_t sb_char; + int str_tree_storage_idx; + + /* number of subexpressions `re_nsub' is in regex_t. */ + int subexps_alloc; + unsigned int state_hash_mask; int states_alloc; int init_node; int nbackref; /* The number of backreference in this dfa. */ /* Bitmap expressing which backreference is used. */ unsigned int used_bkref_map; -#ifdef DEBUG - char* re_str; -#endif unsigned int has_plural_match : 1; /* If this dfa has "multibyte node", which is a backreference or a node which can accept multibyte character or multi character collating element. */ unsigned int has_mb_node : 1; + unsigned int is_utf8 : 1; + unsigned int map_notascii : 1; + unsigned int word_ops_used : 1; + int mb_cur_max; + bitset word_char; + reg_syntax_t syntax; +#ifdef DEBUG + char* re_str; +#endif }; -typedef struct re_dfa_t re_dfa_t; -static reg_errcode_t re_node_set_alloc _RE_ARGS((re_node_set *set, int size)); -static reg_errcode_t re_node_set_init_1 _RE_ARGS((re_node_set *set, int elem)); -static reg_errcode_t re_node_set_init_2 _RE_ARGS((re_node_set *set, int elem1, int elem2)); +#ifndef RE_NO_INTERNAL_PROTOTYPES +static reg_errcode_t re_node_set_alloc (re_node_set *set, int size) internal_function; +static reg_errcode_t re_node_set_init_1 (re_node_set *set, int elem) internal_function; +static reg_errcode_t re_node_set_init_2 (re_node_set *set, int elem1, + int elem2) internal_function; #define re_node_set_init_empty(set) memset (set, '\0', sizeof (re_node_set)) -static reg_errcode_t re_node_set_init_copy _RE_ARGS((re_node_set *dest, - const re_node_set *src)); -static reg_errcode_t re_node_set_add_intersect _RE_ARGS((re_node_set *dest, +static reg_errcode_t re_node_set_init_copy (re_node_set *dest, + const re_node_set *src) internal_function; +static reg_errcode_t re_node_set_add_intersect (re_node_set *dest, const re_node_set *src1, - const re_node_set *src2)); -static reg_errcode_t re_node_set_init_union _RE_ARGS((re_node_set *dest, + const re_node_set *src2) internal_function; +static reg_errcode_t re_node_set_init_union (re_node_set *dest, const re_node_set *src1, - const re_node_set *src2)); -static reg_errcode_t re_node_set_merge _RE_ARGS((re_node_set *dest, const re_node_set *src)); -static int re_node_set_insert _RE_ARGS((re_node_set *set, int elem)); -static int re_node_set_compare _RE_ARGS((const re_node_set *set1, const re_node_set *set2)); -static int re_node_set_contains _RE_ARGS((const re_node_set *set, int elem)); -static void re_node_set_remove_at _RE_ARGS((re_node_set *set, int idx)); + const re_node_set *src2) internal_function; +static reg_errcode_t re_node_set_merge (re_node_set *dest, + const re_node_set *src) internal_function; +static int re_node_set_insert (re_node_set *set, int elem) internal_function; +static int re_node_set_compare (const re_node_set *set1, + const re_node_set *set2) internal_function; +static int re_node_set_contains (const re_node_set *set, int elem) internal_function; +static void re_node_set_remove_at (re_node_set *set, int idx) internal_function; #define re_node_set_remove(set,id) \ (re_node_set_remove_at (set, re_node_set_contains (set, id) - 1)) #define re_node_set_empty(p) ((p)->nelem = 0) #define re_node_set_free(set) re_free ((set)->elems) -static int re_dfa_add_node _RE_ARGS((re_dfa_t *dfa, re_token_t token, int mode)); -static re_dfastate_t *re_acquire_state _RE_ARGS((reg_errcode_t *err, re_dfa_t *dfa, - const re_node_set *nodes)); -static re_dfastate_t *re_acquire_state_context _RE_ARGS((reg_errcode_t *err, re_dfa_t *dfa, +static int re_dfa_add_node (re_dfa_t *dfa, re_token_t token, int mode) internal_function; +static re_dfastate_t *re_acquire_state (reg_errcode_t *err, re_dfa_t *dfa, + const re_node_set *nodes) internal_function; +static re_dfastate_t *re_acquire_state_context (reg_errcode_t *err, + re_dfa_t *dfa, const re_node_set *nodes, - unsigned int context)); -static void free_state _RE_ARGS((re_dfastate_t *state)); + unsigned int context) internal_function; +static void free_state (re_dfastate_t *state) internal_function; +#endif typedef enum @@ -667,8 +727,7 @@ typedef struct /* Inline functions for bitset operation. */ static inline void -bitset_not (set) - bitset set; +bitset_not (bitset set) { int bitset_i; for (bitset_i = 0; bitset_i < BITSET_UINTS; ++bitset_i) @@ -676,9 +735,7 @@ bitset_not (set) } static inline void -bitset_merge (dest, src) - bitset dest; - const bitset src; +bitset_merge (bitset dest, const bitset src) { int bitset_i; for (bitset_i = 0; bitset_i < BITSET_UINTS; ++bitset_i) @@ -686,45 +743,48 @@ bitset_merge (dest, src) } static inline void -bitset_not_merge (dest, src) - bitset dest; - const bitset src; +bitset_not_merge (bitset dest, const bitset src) { int i; for (i = 0; i < BITSET_UINTS; ++i) dest[i] |= ~src[i]; } -#ifdef RE_ENABLE_I18N +static inline void +bitset_mask (bitset dest, const bitset src) +{ + int bitset_i; + for (bitset_i = 0; bitset_i < BITSET_UINTS; ++bitset_i) + dest[bitset_i] &= src[bitset_i]; +} + +#if defined RE_ENABLE_I18N && !defined RE_NO_INTERNAL_PROTOTYPES /* Inline functions for re_string. */ static inline int -re_string_char_size_at (pstr, idx) - const re_string_t *pstr; - int idx; +internal_function +re_string_char_size_at (const re_string_t *pstr, int idx) { int byte_idx; - if (re_mb_cur_max == 1) + if (pstr->mb_cur_max == 1) return 1; - for (byte_idx = 1; idx + byte_idx < pstr->len; ++byte_idx) + for (byte_idx = 1; idx + byte_idx < pstr->valid_len; ++byte_idx) if (pstr->wcs[idx + byte_idx] != WEOF) break; return byte_idx; } static inline wint_t -re_string_wchar_at (pstr, idx) - const re_string_t *pstr; - int idx; +internal_function +re_string_wchar_at (const re_string_t *pstr, int idx) { - if (re_mb_cur_max == 1) + if (pstr->mb_cur_max == 1) return (wint_t) pstr->mbs[idx]; return (wint_t) pstr->wcs[idx]; } static int -re_string_elem_size_at (pstr, idx) - const re_string_t *pstr; - int idx; +internal_function +re_string_elem_size_at (const re_string_t *pstr, int idx) { #ifdef _LIBC const unsigned char *p, *extra; diff --git a/regexec.c b/regexec.c index 841218e7d..8a4f57c7c 100644 --- a/regexec.c +++ b/regexec.c @@ -1,5 +1,5 @@ /* Extended regular expression matching and search library. - Copyright (C) 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa . @@ -18,178 +18,172 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -static reg_errcode_t match_ctx_init _RE_ARGS((re_match_context_t *cache, int eflags, - re_string_t *input, int n)); -static void match_ctx_clean _RE_ARGS((re_match_context_t *mctx)); -static void match_ctx_free _RE_ARGS((re_match_context_t *cache)); -static void match_ctx_free_subtops _RE_ARGS((re_match_context_t *mctx)); -static reg_errcode_t match_ctx_add_entry _RE_ARGS((re_match_context_t *cache, int node, - int str_idx, int from, int to)); -static int search_cur_bkref_entry _RE_ARGS((re_match_context_t *mctx, int str_idx)); -static void match_ctx_clear_flag _RE_ARGS((re_match_context_t *mctx)); -static reg_errcode_t match_ctx_add_subtop _RE_ARGS((re_match_context_t *mctx, int node, - int str_idx)); -static re_sub_match_last_t * match_ctx_add_sublast _RE_ARGS((re_sub_match_top_t *subtop, - int node, int str_idx)); -static void sift_ctx_init _RE_ARGS((re_sift_context_t *sctx, re_dfastate_t **sifted_sts, +static reg_errcode_t match_ctx_init (re_match_context_t *cache, int eflags, + int n) internal_function; +static void match_ctx_clean (re_match_context_t *mctx) internal_function; +static void match_ctx_free (re_match_context_t *cache) internal_function; +static void match_ctx_free_subtops (re_match_context_t *mctx) + internal_function; +static reg_errcode_t match_ctx_add_entry (re_match_context_t *cache, int node, + int str_idx, int from, int to) + internal_function; +static int search_cur_bkref_entry (re_match_context_t *mctx, int str_idx) + internal_function; +static void match_ctx_clear_flag (re_match_context_t *mctx) internal_function; +static reg_errcode_t match_ctx_add_subtop (re_match_context_t *mctx, int node, + int str_idx) internal_function; +static re_sub_match_last_t * match_ctx_add_sublast (re_sub_match_top_t *subtop, + int node, int str_idx) + internal_function; +static void sift_ctx_init (re_sift_context_t *sctx, re_dfastate_t **sifted_sts, re_dfastate_t **limited_sts, int last_node, - int last_str_idx, int check_subexp)); -static reg_errcode_t re_search_internal _RE_ARGS((const regex_t *preg, + int last_str_idx, int check_subexp) + internal_function; +static reg_errcode_t re_search_internal (const regex_t *preg, const char *string, int length, int start, int range, int stop, size_t nmatch, regmatch_t pmatch[], - int eflags)); -static int re_search_2_stub _RE_ARGS((struct re_pattern_buffer *bufp, + int eflags) internal_function; +static int re_search_2_stub (struct re_pattern_buffer *bufp, const char *string1, int length1, const char *string2, int length2, int start, int range, struct re_registers *regs, - int stop, int ret_len)); -static int re_search_stub _RE_ARGS((struct re_pattern_buffer *bufp, + int stop, int ret_len) internal_function; +static int re_search_stub (struct re_pattern_buffer *bufp, const char *string, int length, int start, int range, int stop, struct re_registers *regs, - int ret_len)); -static unsigned re_copy_regs _RE_ARGS((struct re_registers *regs, regmatch_t *pmatch, - int nregs, int regs_allocated)); -static inline re_dfastate_t *acquire_init_state_context _RE_ARGS((reg_errcode_t *err, - const regex_t *preg, - const re_match_context_t *mctx, - int idx)); -static reg_errcode_t prune_impossible_nodes _RE_ARGS((const regex_t *preg, - re_match_context_t *mctx)); -static int check_matching _RE_ARGS((const regex_t *preg, re_match_context_t *mctx, - int fl_search, int fl_longest_match)); -static int check_halt_node_context _RE_ARGS((const re_dfa_t *dfa, int node, - unsigned int context)); -static int check_halt_state_context _RE_ARGS((const regex_t *preg, - const re_dfastate_t *state, - const re_match_context_t *mctx, int idx)); -static void update_regs _RE_ARGS((re_dfa_t *dfa, regmatch_t *pmatch, int cur_node, - int cur_idx, int nmatch)); -static int proceed_next_node _RE_ARGS((const regex_t *preg, int nregs, regmatch_t *regs, - const re_match_context_t *mctx, + int ret_len) internal_function; +static unsigned re_copy_regs (struct re_registers *regs, regmatch_t *pmatch, + int nregs, int regs_allocated) internal_function; +static inline re_dfastate_t *acquire_init_state_context + (reg_errcode_t *err, const re_match_context_t *mctx, int idx) + __attribute ((always_inline)) internal_function; +static reg_errcode_t prune_impossible_nodes (re_match_context_t *mctx) + internal_function; +static int check_matching (re_match_context_t *mctx, int fl_longest_match, + int *p_match_first) + internal_function; +static int check_halt_node_context (const re_dfa_t *dfa, int node, + unsigned int context) internal_function; +static int check_halt_state_context (const re_match_context_t *mctx, + const re_dfastate_t *state, int idx) + internal_function; +static void update_regs (re_dfa_t *dfa, regmatch_t *pmatch, + regmatch_t *prev_idx_match, int cur_node, + int cur_idx, int nmatch) internal_function; +static int proceed_next_node (const re_match_context_t *mctx, + int nregs, regmatch_t *regs, int *pidx, int node, re_node_set *eps_via_nodes, - struct re_fail_stack_t *fs)); -static reg_errcode_t push_fail_stack _RE_ARGS((struct re_fail_stack_t *fs, + struct re_fail_stack_t *fs) internal_function; +static reg_errcode_t push_fail_stack (struct re_fail_stack_t *fs, int str_idx, int *dests, int nregs, regmatch_t *regs, - re_node_set *eps_via_nodes)); -static int pop_fail_stack _RE_ARGS((struct re_fail_stack_t *fs, int *pidx, int nregs, - regmatch_t *regs, re_node_set *eps_via_nodes)); -static reg_errcode_t set_regs _RE_ARGS((const regex_t *preg, + re_node_set *eps_via_nodes) internal_function; +static int pop_fail_stack (struct re_fail_stack_t *fs, int *pidx, int nregs, + regmatch_t *regs, re_node_set *eps_via_nodes) internal_function; +static reg_errcode_t set_regs (const regex_t *preg, const re_match_context_t *mctx, size_t nmatch, regmatch_t *pmatch, - int fl_backtrack)); -static reg_errcode_t free_fail_stack_return _RE_ARGS((struct re_fail_stack_t *fs)); + int fl_backtrack) internal_function; +static reg_errcode_t free_fail_stack_return (struct re_fail_stack_t *fs) internal_function; #ifdef RE_ENABLE_I18N -static int sift_states_iter_mb _RE_ARGS((const regex_t *preg, - const re_match_context_t *mctx, +static int sift_states_iter_mb (const re_match_context_t *mctx, re_sift_context_t *sctx, - int node_idx, int str_idx, int max_str_idx)); + int node_idx, int str_idx, int max_str_idx) internal_function; #endif /* RE_ENABLE_I18N */ -static reg_errcode_t sift_states_backward _RE_ARGS((const regex_t *preg, - re_match_context_t *mctx, - re_sift_context_t *sctx)); -static reg_errcode_t update_cur_sifted_state _RE_ARGS((const regex_t *preg, - re_match_context_t *mctx, +static reg_errcode_t sift_states_backward (re_match_context_t *mctx, + re_sift_context_t *sctx) internal_function; +static reg_errcode_t update_cur_sifted_state (re_match_context_t *mctx, re_sift_context_t *sctx, int str_idx, - re_node_set *dest_nodes)); -static reg_errcode_t add_epsilon_src_nodes _RE_ARGS((re_dfa_t *dfa, + re_node_set *dest_nodes) internal_function; +static reg_errcode_t add_epsilon_src_nodes (re_dfa_t *dfa, re_node_set *dest_nodes, - const re_node_set *candidates)); -static reg_errcode_t sub_epsilon_src_nodes _RE_ARGS((re_dfa_t *dfa, int node, + const re_node_set *candidates) internal_function; +static reg_errcode_t sub_epsilon_src_nodes (re_dfa_t *dfa, int node, re_node_set *dest_nodes, - const re_node_set *and_nodes)); -static int check_dst_limits _RE_ARGS((re_dfa_t *dfa, re_node_set *limits, - re_match_context_t *mctx, int dst_node, - int dst_idx, int src_node, int src_idx)); -static int check_dst_limits_calc_pos _RE_ARGS((re_dfa_t *dfa, re_match_context_t *mctx, + const re_node_set *and_nodes) internal_function; +static int check_dst_limits (re_match_context_t *mctx, re_node_set *limits, + int dst_node, int dst_idx, int src_node, + int src_idx) internal_function; +static int check_dst_limits_calc_pos (re_match_context_t *mctx, int limit, re_node_set *eclosures, - int subexp_idx, int node, int str_idx)); -static reg_errcode_t check_subexp_limits _RE_ARGS((re_dfa_t *dfa, + int subexp_idx, int node, int str_idx) internal_function; +static reg_errcode_t check_subexp_limits (re_dfa_t *dfa, re_node_set *dest_nodes, const re_node_set *candidates, re_node_set *limits, struct re_backref_cache_entry *bkref_ents, - int str_idx)); -static reg_errcode_t sift_states_bkref _RE_ARGS((const regex_t *preg, - re_match_context_t *mctx, + int str_idx) internal_function; +static reg_errcode_t sift_states_bkref (re_match_context_t *mctx, re_sift_context_t *sctx, - int str_idx, re_node_set *dest_nodes)); -static reg_errcode_t clean_state_log_if_need _RE_ARGS((re_match_context_t *mctx, - int next_state_log_idx)); -static reg_errcode_t merge_state_array _RE_ARGS((re_dfa_t *dfa, re_dfastate_t **dst, - re_dfastate_t **src, int num)); -static re_dfastate_t *transit_state _RE_ARGS((reg_errcode_t *err, const regex_t *preg, + int str_idx, re_node_set *dest_nodes) internal_function; +static reg_errcode_t clean_state_log_if_needed (re_match_context_t *mctx, + int next_state_log_idx) internal_function; +static reg_errcode_t merge_state_array (re_dfa_t *dfa, re_dfastate_t **dst, + re_dfastate_t **src, int num) internal_function; +static re_dfastate_t *transit_state (reg_errcode_t *err, re_match_context_t *mctx, - re_dfastate_t *state, int fl_search)); -static reg_errcode_t check_subexp_matching_top _RE_ARGS((re_dfa_t *dfa, - re_match_context_t *mctx, + re_dfastate_t *state) internal_function; +static reg_errcode_t check_subexp_matching_top (re_match_context_t *mctx, re_node_set *cur_nodes, - int str_idx)); -static re_dfastate_t *transit_state_sb _RE_ARGS((reg_errcode_t *err, const regex_t *preg, - re_dfastate_t *pstate, - int fl_search, - re_match_context_t *mctx)); + int str_idx) internal_function; +#if 0 +static re_dfastate_t *transit_state_sb (reg_errcode_t *err, + re_match_context_t *mctx, + re_dfastate_t *pstate) internal_function; +#endif #ifdef RE_ENABLE_I18N -static reg_errcode_t transit_state_mb _RE_ARGS((const regex_t *preg, - re_dfastate_t *pstate, - re_match_context_t *mctx)); +static reg_errcode_t transit_state_mb (re_match_context_t *mctx, + re_dfastate_t *pstate) internal_function; #endif /* RE_ENABLE_I18N */ -static reg_errcode_t transit_state_bkref _RE_ARGS((const regex_t *preg, - re_node_set *nodes, - re_match_context_t *mctx)); -static reg_errcode_t get_subexp _RE_ARGS((const regex_t *preg, re_match_context_t *mctx, - int bkref_node, int bkref_str_idx)); -static reg_errcode_t get_subexp_sub _RE_ARGS((const regex_t *preg, - re_match_context_t *mctx, - re_sub_match_top_t *sub_top, +static reg_errcode_t transit_state_bkref (re_match_context_t *mctx, + const re_node_set *nodes) internal_function; +static reg_errcode_t get_subexp (re_match_context_t *mctx, + int bkref_node, int bkref_str_idx) internal_function; +static reg_errcode_t get_subexp_sub (re_match_context_t *mctx, + const re_sub_match_top_t *sub_top, re_sub_match_last_t *sub_last, - int bkref_node, int bkref_str)); -static int find_subexp_node _RE_ARGS((re_dfa_t *dfa, re_node_set *nodes, - int subexp_idx, int fl_open)); -static reg_errcode_t check_arrival _RE_ARGS((const regex_t *preg, - re_match_context_t *mctx, + int bkref_node, int bkref_str) internal_function; +static int find_subexp_node (const re_dfa_t *dfa, const re_node_set *nodes, + int subexp_idx, int type) internal_function; +static reg_errcode_t check_arrival (re_match_context_t *mctx, state_array_t *path, int top_node, int top_str, int last_node, int last_str, - int fl_open)); -static reg_errcode_t check_arrival_add_next_nodes _RE_ARGS((const regex_t *preg, - re_dfa_t *dfa, - re_match_context_t *mctx, + int type) internal_function; +static reg_errcode_t check_arrival_add_next_nodes (re_match_context_t *mctx, int str_idx, re_node_set *cur_nodes, - re_node_set *next_nodes)); -static reg_errcode_t check_arrival_expand_ecl _RE_ARGS((re_dfa_t *dfa, + re_node_set *next_nodes) internal_function; +static reg_errcode_t check_arrival_expand_ecl (re_dfa_t *dfa, re_node_set *cur_nodes, - int ex_subexp, int fl_open)); -static reg_errcode_t check_arrival_expand_ecl_sub _RE_ARGS((re_dfa_t *dfa, + int ex_subexp, int type) internal_function; +static reg_errcode_t check_arrival_expand_ecl_sub (re_dfa_t *dfa, re_node_set *dst_nodes, int target, int ex_subexp, - int fl_open)); -static reg_errcode_t expand_bkref_cache _RE_ARGS((const regex_t *preg, - re_match_context_t *mctx, + int type) internal_function; +static reg_errcode_t expand_bkref_cache (re_match_context_t *mctx, re_node_set *cur_nodes, int cur_str, int last_str, int subexp_num, - int fl_open)); -static re_dfastate_t **build_trtable _RE_ARGS((const regex_t *dfa, - const re_dfastate_t *state, - int fl_search)); + int type) internal_function; +static re_dfastate_t **build_trtable (re_dfa_t *dfa, + re_dfastate_t *state) internal_function; #ifdef RE_ENABLE_I18N -static int check_node_accept_bytes _RE_ARGS((const regex_t *preg, int node_idx, - const re_string_t *input, int idx)); +static int check_node_accept_bytes (re_dfa_t *dfa, int node_idx, + const re_string_t *input, int idx) internal_function; # ifdef _LIBC -static unsigned int find_collation_sequence_value _RE_ARGS((const unsigned char *mbs, - size_t name_len)); +static unsigned int find_collation_sequence_value (const unsigned char *mbs, + size_t name_len) internal_function; # endif /* _LIBC */ #endif /* RE_ENABLE_I18N */ -static int group_nodes_into_DFAstates _RE_ARGS((const regex_t *dfa, +static int group_nodes_into_DFAstates (re_dfa_t *dfa, const re_dfastate_t *state, re_node_set *states_node, - bitset *states_ch)); -static int check_node_accept _RE_ARGS((const regex_t *preg, const re_token_t *node, - const re_match_context_t *mctx, int idx)); -static reg_errcode_t extend_buffers _RE_ARGS((re_match_context_t *mctx)); + bitset *states_ch) internal_function; +static int check_node_accept (const re_match_context_t *mctx, + const re_token_t *node, int idx) internal_function; +static reg_errcode_t extend_buffers (re_match_context_t *mctx) internal_function; /* Entry point for POSIX code. */ @@ -455,35 +449,23 @@ re_copy_regs (regs, pmatch, nregs, regs_allocated) if (regs_allocated == REGS_UNALLOCATED) { /* No. So allocate them with malloc. */ regs->start = re_malloc (regoff_t, need_regs); - if (BE (regs->start == NULL, 0)) - return REGS_UNALLOCATED; regs->end = re_malloc (regoff_t, need_regs); - if (BE (regs->end == NULL, 0)) - { - re_free (regs->start); - return REGS_UNALLOCATED; - } + if (BE (regs->start == NULL, 0) || BE (regs->end == NULL, 0)) + return REGS_UNALLOCATED; regs->num_regs = need_regs; } else if (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 (need_regs > regs->num_regs) + if (BE (need_regs > regs->num_regs, 0)) { - regs->start = re_realloc (regs->start, regoff_t, need_regs); - if (BE (regs->start == NULL, 0)) - { - if (regs->end != NULL) - re_free (regs->end); - return REGS_UNALLOCATED; - } - regs->end = re_realloc (regs->end, regoff_t, need_regs); - if (BE (regs->end == NULL, 0)) - { - re_free (regs->start); - return REGS_UNALLOCATED; - } + regoff_t *new_start = re_realloc (regs->start, regoff_t, need_regs); + regoff_t *new_end = re_realloc (regs->end, regoff_t, need_regs); + if (BE (new_start == NULL, 0) || BE (new_end == NULL, 0)) + return REGS_UNALLOCATED; + regs->start = new_start; + regs->end = new_end; regs->num_regs = need_regs; } } @@ -584,33 +566,60 @@ re_search_internal (preg, string, length, start, range, stop, nmatch, pmatch, { reg_errcode_t err; re_dfa_t *dfa = (re_dfa_t *)preg->buffer; - re_string_t input; int left_lim, right_lim, incr; int fl_longest_match, match_first, match_last = -1; int fast_translate, sb; +#if defined _LIBC || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L) + re_match_context_t mctx = { .dfa = dfa }; +#else re_match_context_t mctx; +#endif char *fastmap = ((preg->fastmap != NULL && preg->fastmap_accurate && range && !preg->can_be_null) ? preg->fastmap : NULL); +#if !(defined _LIBC || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L)) + memset (&mctx, '\0', sizeof (re_match_context_t)); + mctx.dfa = dfa; +#endif + /* Check if the DFA haven't been compiled. */ if (BE (preg->used == 0 || dfa->init_state == NULL || dfa->init_state_word == NULL || dfa->init_state_nl == NULL || dfa->init_state_begbuf == NULL, 0)) return REG_NOMATCH; +#ifdef DEBUG + /* We assume front-end functions already check them. */ + assert (start + range >= 0 && start + range <= length); +#endif + + /* If initial states with non-begbuf contexts have no elements, + the regex must be anchored. If preg->newline_anchor is set, + we'll never use init_state_nl, so do not check it. */ + if (dfa->init_state->nodes.nelem == 0 + && dfa->init_state_word->nodes.nelem == 0 + && (dfa->init_state_nl->nodes.nelem == 0 + || !preg->newline_anchor)) + { + if (start != 0 && start + range != 0) + return REG_NOMATCH; + start = range = 0; + } + re_node_set_init_empty (&empty_set); - memset (&mctx, '\0', sizeof (re_match_context_t)); /* We must check the longest matching, if nmatch > 0. */ fl_longest_match = (nmatch != 0 || dfa->nbackref); - err = re_string_allocate (&input, string, length, dfa->nodes_len + 1, - preg->translate, preg->syntax & RE_ICASE); + err = re_string_allocate (&mctx.input, string, length, dfa->nodes_len + 1, + preg->translate, preg->syntax & RE_ICASE, dfa); if (BE (err != REG_NOERROR, 0)) goto free_return; - input.stop = stop; + mctx.input.stop = stop; + mctx.input.raw_stop = stop; + mctx.input.newline_anchor = preg->newline_anchor; - err = match_ctx_init (&mctx, eflags, &input, dfa->nbackref * 2); + err = match_ctx_init (&mctx, eflags, dfa->nbackref * 2); if (BE (err != REG_NOERROR, 0)) goto free_return; @@ -620,7 +629,7 @@ re_search_internal (preg, string, length, start, range, stop, nmatch, pmatch, multi character collating element. */ if (nmatch > 1 || dfa->has_mb_node) { - mctx.state_log = re_malloc (re_dfastate_t *, dfa->nodes_len + 1); + mctx.state_log = re_malloc (re_dfastate_t *, mctx.input.bufs_len + 1); if (BE (mctx.state_log == NULL, 0)) { err = REG_ESPACE; @@ -630,24 +639,15 @@ re_search_internal (preg, string, length, start, range, stop, nmatch, pmatch, else mctx.state_log = NULL; -#ifdef DEBUG - /* We assume front-end functions already check them. */ - assert (start + range >= 0 && start + range <= length); -#endif - match_first = start; - input.tip_context = ((eflags & REG_NOTBOL) ? CONTEXT_BEGBUF - : CONTEXT_NEWLINE | CONTEXT_BEGBUF); + mctx.input.tip_context = (eflags & REG_NOTBOL) ? CONTEXT_BEGBUF + : CONTEXT_NEWLINE | CONTEXT_BEGBUF; /* Check incrementally whether of not the input string match. */ incr = (range < 0) ? -1 : 1; left_lim = (range < 0) ? start + range : start; right_lim = (range < 0) ? start : start + range; -#ifdef RE_ENABLE_I18N - sb = re_mb_cur_max == 1; -#else - sb = 1; -#endif + sb = dfa->mb_cur_max == 1; fast_translate = sb || !(preg->syntax & RE_ICASE || preg->translate); for (;;) @@ -707,19 +707,21 @@ re_search_internal (preg, string, length, start, range, stop, nmatch, pmatch, instead. */ /* If MATCH_FIRST is out of the valid range, reconstruct the buffers. */ - if (input.raw_mbs_idx + input.valid_len <= match_first - || match_first < input.raw_mbs_idx) + if (mctx.input.raw_mbs_idx + mctx.input.valid_raw_len + <= match_first + || match_first < mctx.input.raw_mbs_idx) { - err = re_string_reconstruct (&input, match_first, eflags, - preg->newline_anchor); + err = re_string_reconstruct (&mctx.input, match_first, + eflags); if (BE (err != REG_NOERROR, 0)) goto free_return; } /* If MATCH_FIRST is out of the buffer, leave it as '\0'. Note that MATCH_FIRST must not be smaller than 0. */ ch = ((match_first >= length) ? 0 - : re_string_byte_at (&input, - match_first - input.raw_mbs_idx)); + : re_string_byte_at (&mctx.input, + match_first + - mctx.input.raw_mbs_idx)); if (fastmap[ch]) break; match_first += incr; @@ -731,21 +733,21 @@ re_search_internal (preg, string, length, start, range, stop, nmatch, pmatch, } /* Reconstruct the buffers so that the matcher can assume that - the matching starts from the begining of the buffer. */ - err = re_string_reconstruct (&input, match_first, eflags, - preg->newline_anchor); + the matching starts from the beginning of the buffer. */ + err = re_string_reconstruct (&mctx.input, match_first, eflags); if (BE (err != REG_NOERROR, 0)) goto free_return; #ifdef RE_ENABLE_I18N /* Eliminate it when it is a component of a multibyte character and isn't the head of a multibyte character. */ - if (sb || re_string_first_byte (&input, 0)) + if (sb || re_string_first_byte (&mctx.input, 0)) #endif { /* It seems to be appropriate one, then use the matcher. */ /* We assume that the matching starts from 0. */ mctx.state_log_top = mctx.nbkref_ents = mctx.max_mb_elem_len = 0; - match_last = check_matching (preg, &mctx, 0, fl_longest_match); + match_last = check_matching (&mctx, fl_longest_match, + range >= 0 ? &match_first : NULL); if (match_last != -1) { if (BE (match_last == -2, 0)) @@ -759,20 +761,21 @@ re_search_internal (preg, string, length, start, range, stop, nmatch, pmatch, if ((!preg->no_sub && nmatch > 1) || dfa->nbackref) { re_dfastate_t *pstate = mctx.state_log[match_last]; - mctx.last_node = check_halt_state_context (preg, pstate, - &mctx, match_last); + mctx.last_node = check_halt_state_context (&mctx, pstate, + match_last); } if ((!preg->no_sub && nmatch > 1 && dfa->has_plural_match) || dfa->nbackref) { - err = prune_impossible_nodes (preg, &mctx); + err = prune_impossible_nodes (&mctx); if (err == REG_NOERROR) break; if (BE (err != REG_NOMATCH, 0)) goto free_return; + match_last = -1; } else - break; /* We found a matching. */ + break; /* We found a match. */ } } match_ctx_clean (&mctx); @@ -789,7 +792,7 @@ re_search_internal (preg, string, length, start, range, stop, nmatch, pmatch, int reg_idx; /* Initialize registers. */ - for (reg_idx = 0; reg_idx < nmatch; ++reg_idx) + for (reg_idx = 1; reg_idx < nmatch; ++reg_idx) pmatch[reg_idx].rm_so = pmatch[reg_idx].rm_eo = -1; /* Set the points where matching start/end. */ @@ -805,10 +808,26 @@ re_search_internal (preg, string, length, start, range, stop, nmatch, pmatch, } /* At last, add the offset to the each registers, since we slided - the buffers so that We can assume that the matching starts from 0. */ + the buffers so that we could assume that the matching starts + from 0. */ for (reg_idx = 0; reg_idx < nmatch; ++reg_idx) if (pmatch[reg_idx].rm_so != -1) { +#ifdef RE_ENABLE_I18N + if (BE (mctx.input.offsets_needed != 0, 0)) + { + if (pmatch[reg_idx].rm_so == mctx.input.valid_len) + pmatch[reg_idx].rm_so += mctx.input.valid_raw_len - mctx.input.valid_len; + else + pmatch[reg_idx].rm_so = mctx.input.offsets[pmatch[reg_idx].rm_so]; + if (pmatch[reg_idx].rm_eo == mctx.input.valid_len) + pmatch[reg_idx].rm_eo += mctx.input.valid_raw_len - mctx.input.valid_len; + else + pmatch[reg_idx].rm_eo = mctx.input.offsets[pmatch[reg_idx].rm_eo]; + } +#else + assert (mctx.input.offsets_needed == 0); +#endif pmatch[reg_idx].rm_so += match_first; pmatch[reg_idx].rm_eo += match_first; } @@ -818,18 +837,17 @@ re_search_internal (preg, string, length, start, range, stop, nmatch, pmatch, re_free (mctx.state_log); if (dfa->nbackref) match_ctx_free (&mctx); - re_string_destruct (&input); + re_string_destruct (&mctx.input); return err; } static reg_errcode_t -prune_impossible_nodes (preg, mctx) - const regex_t *preg; +prune_impossible_nodes (mctx) re_match_context_t *mctx; { + re_dfa_t *const dfa = mctx->dfa; int halt_node, match_last; reg_errcode_t ret; - re_dfa_t *dfa = (re_dfa_t *)preg->buffer; re_dfastate_t **sifted_states; re_dfastate_t **lim_states = NULL; re_sift_context_t sctx; @@ -859,7 +877,7 @@ prune_impossible_nodes (preg, mctx) match_ctx_clear_flag (mctx); sift_ctx_init (&sctx, sifted_states, lim_states, halt_node, match_last, 0); - ret = sift_states_backward (preg, mctx, &sctx); + ret = sift_states_backward (mctx, &sctx); re_node_set_free (&sctx.limits); if (BE (ret != REG_NOERROR, 0)) goto free_return; @@ -873,10 +891,11 @@ prune_impossible_nodes (preg, mctx) ret = REG_NOMATCH; goto free_return; } - } while (!mctx->state_log[match_last]->halt); - halt_node = check_halt_state_context (preg, + } while (mctx->state_log[match_last] == NULL + || !mctx->state_log[match_last]->halt); + halt_node = check_halt_state_context (mctx, mctx->state_log[match_last], - mctx, match_last); + match_last); } ret = merge_state_array (dfa, sifted_states, lim_states, match_last + 1); @@ -889,7 +908,7 @@ prune_impossible_nodes (preg, mctx) { sift_ctx_init (&sctx, sifted_states, lim_states, halt_node, match_last, 0); - ret = sift_states_backward (preg, mctx, &sctx); + ret = sift_states_backward (mctx, &sctx); re_node_set_free (&sctx.limits); if (BE (ret != REG_NOERROR, 0)) goto free_return; @@ -911,20 +930,17 @@ prune_impossible_nodes (preg, mctx) since initial states may have constraints like "\<", "^", etc.. */ static inline re_dfastate_t * -acquire_init_state_context (err, preg, mctx, idx) +acquire_init_state_context (err, mctx, idx) reg_errcode_t *err; - const regex_t *preg; const re_match_context_t *mctx; int idx; { - re_dfa_t *dfa = (re_dfa_t *) preg->buffer; - + re_dfa_t *const dfa = mctx->dfa; *err = REG_NOERROR; if (dfa->init_state->has_constraint) { unsigned int context; - context = re_string_context_at (mctx->input, idx - 1, mctx->eflags, - preg->newline_anchor); + context = re_string_context_at (&mctx->input, idx - 1, mctx->eflags); if (IS_WORD_CONTEXT (context)) return dfa->init_state_word; else if (IS_ORDINARY_CONTEXT (context)) @@ -951,25 +967,27 @@ acquire_init_state_context (err, preg, mctx, idx) /* Check whether the regular expression match input string INPUT or not, and return the index where the matching end, return -1 if not match, or return -2 in case of an error. - FL_SEARCH means we must search where the matching starts, FL_LONGEST_MATCH means we want the POSIX longest matching. + If P_MATCH_FIRST is not NULL, and the match fails, it is set to the + next place where we may want to try matching. Note that the matcher assume that the maching starts from the current index of the buffer. */ static int -check_matching (preg, mctx, fl_search, fl_longest_match) - const regex_t *preg; +check_matching (mctx, fl_longest_match, p_match_first) re_match_context_t *mctx; - int fl_search, fl_longest_match; + int fl_longest_match; + int *p_match_first; { - re_dfa_t *dfa = (re_dfa_t *) preg->buffer; + re_dfa_t *const dfa = mctx->dfa; reg_errcode_t err; int match = 0; int match_last = -1; - int cur_str_idx = re_string_cur_idx (mctx->input); + int cur_str_idx = re_string_cur_idx (&mctx->input); re_dfastate_t *cur_state; + int at_init_state = p_match_first != NULL, skipped = 0; - cur_state = acquire_init_state_context (&err, preg, mctx, cur_str_idx); + cur_state = acquire_init_state_context (&err, mctx, cur_str_idx); /* An initial state must not be NULL(invalid state). */ if (BE (cur_state == NULL, 0)) return -2; @@ -978,25 +996,26 @@ check_matching (preg, mctx, fl_search, fl_longest_match) /* Check OP_OPEN_SUBEXP in the initial state in case that we use them later. E.g. Processing back references. */ - if (dfa->nbackref) + if (BE (dfa->nbackref, 0)) { - err = check_subexp_matching_top (dfa, mctx, &cur_state->nodes, 0); + at_init_state = 0; + err = check_subexp_matching_top (mctx, &cur_state->nodes, 0); if (BE (err != REG_NOERROR, 0)) return err; - } - if (cur_state->has_backref) - { - err = transit_state_bkref (preg, &cur_state->nodes, mctx); - if (BE (err != REG_NOERROR, 0)) - return err; + if (cur_state->has_backref) + { + err = transit_state_bkref (mctx, &cur_state->nodes); + if (BE (err != REG_NOERROR, 0)) + return err; + } } /* If the RE accepts NULL string. */ - if (cur_state->halt) + if (BE (cur_state->halt, 0)) { if (!cur_state->has_constraint - || check_halt_state_context (preg, cur_state, mctx, cur_str_idx)) + || check_halt_state_context (mctx, cur_state, cur_str_idx)) { if (!fl_longest_match) return cur_str_idx; @@ -1008,33 +1027,26 @@ check_matching (preg, mctx, fl_search, fl_longest_match) } } - while (!re_string_eoi (mctx->input)) + while (!re_string_eoi (&mctx->input)) { - cur_state = transit_state (&err, preg, mctx, cur_state, - fl_search && !match); + re_dfastate_t *old_state = cur_state; + cur_state = transit_state (&err, mctx, cur_state); + if (at_init_state) + { + if (old_state == cur_state) + skipped++; + else + at_init_state = 0; + } + if (cur_state == NULL) /* Reached at the invalid state or an error. */ { - cur_str_idx = re_string_cur_idx (mctx->input); + cur_str_idx = re_string_cur_idx (&mctx->input); if (BE (err != REG_NOERROR, 0)) return -2; - if (fl_search && !match) - { - /* Restart from initial state, since we are searching - the point from where matching start. */ -#ifdef RE_ENABLE_I18N - if (re_mb_cur_max == 1 - || re_string_first_byte (mctx->input, cur_str_idx)) -#endif /* RE_ENABLE_I18N */ - cur_state = acquire_init_state_context (&err, preg, mctx, - cur_str_idx); - if (BE (cur_state == NULL && err != REG_NOERROR, 0)) - return -2; - if (mctx->state_log != NULL) - mctx->state_log[cur_str_idx] = cur_state; - } - else if (!fl_longest_match && match) + if (!fl_longest_match && match) break; - else /* (fl_longest_match && match) || (!fl_search && !match) */ + else { if (mctx->state_log == NULL) break; @@ -1055,17 +1067,21 @@ check_matching (preg, mctx, fl_search, fl_longest_match) /* Reached at a halt state. Check the halt state can satisfy the current context. */ if (!cur_state->has_constraint - || check_halt_state_context (preg, cur_state, mctx, - re_string_cur_idx (mctx->input))) + || check_halt_state_context (mctx, cur_state, + re_string_cur_idx (&mctx->input))) { /* We found an appropriate halt state. */ - match_last = re_string_cur_idx (mctx->input); + match_last = re_string_cur_idx (&mctx->input); match = 1; if (!fl_longest_match) break; } } } + + if (match_last == -1 && skipped) + *p_match_first += skipped; + return match_last; } @@ -1092,22 +1108,19 @@ static int check_halt_node_context (dfa, node, context) match the context, return the node. */ static int -check_halt_state_context (preg, state, mctx, idx) - const regex_t *preg; - const re_dfastate_t *state; +check_halt_state_context (mctx, state, idx) const re_match_context_t *mctx; + const re_dfastate_t *state; int idx; { - re_dfa_t *dfa = (re_dfa_t *) preg->buffer; int i; unsigned int context; #ifdef DEBUG assert (state->halt); #endif - context = re_string_context_at (mctx->input, idx, mctx->eflags, - preg->newline_anchor); + context = re_string_context_at (&mctx->input, idx, mctx->eflags); for (i = 0; i < state->nodes.nelem; ++i) - if (check_halt_node_context (dfa, state->nodes.elems[i], context)) + if (check_halt_node_context (mctx->dfa, state->nodes.elems[i], context)) return state->nodes.elems[i]; return 0; } @@ -1118,15 +1131,14 @@ check_halt_state_context (preg, state, mctx, idx) of errors. */ static int -proceed_next_node (preg, nregs, regs, mctx, pidx, node, eps_via_nodes, fs) - const regex_t *preg; - regmatch_t *regs; +proceed_next_node (mctx, nregs, regs, pidx, node, eps_via_nodes, fs) const re_match_context_t *mctx; + regmatch_t *regs; int nregs, *pidx, node; re_node_set *eps_via_nodes; struct re_fail_stack_t *fs; { - re_dfa_t *dfa = (re_dfa_t *)preg->buffer; + re_dfa_t *const dfa = mctx->dfa; int i, err, dest_node; dest_node = -1; if (IS_EPSILON_NODE (dfa->nodes[node].type)) @@ -1135,7 +1147,7 @@ proceed_next_node (preg, nregs, regs, mctx, pidx, node, eps_via_nodes, fs) int ndest, dest_nodes[2]; err = re_node_set_insert (eps_via_nodes, node); if (BE (err < 0, 0)) - return -1; + return -2; /* Pick up valid destinations. */ for (ndest = 0, i = 0; i < dfa->edests[node].nelem; ++i) { @@ -1151,8 +1163,10 @@ proceed_next_node (preg, nregs, regs, mctx, pidx, node, eps_via_nodes, fs) /* In order to avoid infinite loop like "(a*)*". */ if (re_node_set_contains (eps_via_nodes, dest_nodes[0])) return dest_nodes[1]; - if (fs != NULL) - push_fail_stack (fs, *pidx, dest_nodes, nregs, regs, eps_via_nodes); + if (fs != NULL + && push_fail_stack (fs, *pidx, dest_nodes, nregs, regs, + eps_via_nodes)) + return -2; return dest_nodes[0]; } else @@ -1162,7 +1176,7 @@ proceed_next_node (preg, nregs, regs, mctx, pidx, node, eps_via_nodes, fs) #ifdef RE_ENABLE_I18N if (ACCEPT_MB_NODE (type)) - naccepted = check_node_accept_bytes (preg, node, mctx->input, *pidx); + naccepted = check_node_accept_bytes (dfa, node, &mctx->input, *pidx); else #endif /* RE_ENABLE_I18N */ if (type == OP_BACK_REF) @@ -1175,7 +1189,7 @@ proceed_next_node (preg, nregs, regs, mctx, pidx, node, eps_via_nodes, fs) return -1; else if (naccepted) { - char *buf = (char *) re_string_get_buffer (mctx->input); + char *buf = (char *) re_string_get_buffer (&mctx->input); if (memcmp (buf + regs[subexp_idx].rm_so, buf + *pidx, naccepted) != 0) return -1; @@ -1195,7 +1209,7 @@ proceed_next_node (preg, nregs, regs, mctx, pidx, node, eps_via_nodes, fs) } if (naccepted != 0 - || check_node_accept (preg, dfa->nodes + node, mctx, *pidx)) + || check_node_accept (mctx, dfa->nodes + node, *pidx)) { dest_node = dfa->nexts[node]; *pidx = (naccepted == 0) ? *pidx + 1 : *pidx + naccepted; @@ -1222,16 +1236,18 @@ push_fail_stack (fs, str_idx, dests, nregs, regs, eps_via_nodes) if (fs->num == fs->alloc) { struct re_fail_stack_ent_t *new_array; - fs->alloc *= 2; new_array = realloc (fs->stack, (sizeof (struct re_fail_stack_ent_t) - * fs->alloc)); + * fs->alloc * 2)); if (new_array == NULL) return REG_ESPACE; + fs->alloc *= 2; fs->stack = new_array; } fs->stack[num].idx = str_idx; fs->stack[num].node = dests[1]; fs->stack[num].regs = re_malloc (regmatch_t, nregs); + if (fs->stack[num].regs == NULL) + return REG_ESPACE; memcpy (fs->stack[num].regs, regs, sizeof (regmatch_t) * nregs); err = re_node_set_init_copy (&fs->stack[num].eps_via_nodes, eps_via_nodes); return err; @@ -1246,7 +1262,7 @@ pop_fail_stack (fs, pidx, nregs, regs, eps_via_nodes) { int num = --fs->num; assert (num >= 0); - *pidx = fs->stack[num].idx; + *pidx = fs->stack[num].idx; memcpy (regs, fs->stack[num].regs, sizeof (regmatch_t) * nregs); re_node_set_free (eps_via_nodes); re_free (fs->stack[num].regs); @@ -1257,7 +1273,7 @@ pop_fail_stack (fs, pidx, nregs, regs, eps_via_nodes) /* Set the positions where the subexpressions are starts/ends to registers PMATCH. Note: We assume that pmatch[0] is already set, and - pmatch[i].rm_so == pmatch[i].rm_eo == -1 (i > 1). */ + pmatch[i].rm_so == pmatch[i].rm_eo == -1 for 0 < i < nmatch. */ static reg_errcode_t set_regs (preg, mctx, nmatch, pmatch, fl_backtrack) @@ -1267,14 +1283,13 @@ set_regs (preg, mctx, nmatch, pmatch, fl_backtrack) regmatch_t *pmatch; int fl_backtrack; { - re_dfa_t *dfa = (re_dfa_t *)preg->buffer; + re_dfa_t *dfa = (re_dfa_t *) preg->buffer; int idx, cur_node, real_nmatch; re_node_set eps_via_nodes; struct re_fail_stack_t *fs; - struct re_fail_stack_t fs_body; - fs_body.num = 0; - fs_body.alloc = 2; - fs_body.stack = NULL; + struct re_fail_stack_t fs_body = { 0, 2, NULL }; + regmatch_t *prev_idx_match; + #ifdef DEBUG assert (nmatch > 1); assert (mctx->state_log != NULL); @@ -1283,15 +1298,23 @@ set_regs (preg, mctx, nmatch, pmatch, fl_backtrack) { fs = &fs_body; fs->stack = re_malloc (struct re_fail_stack_ent_t, fs->alloc); + if (fs->stack == NULL) + return REG_ESPACE; } else fs = NULL; + cur_node = dfa->init_node; real_nmatch = (nmatch <= preg->re_nsub) ? nmatch : preg->re_nsub + 1; re_node_set_init_empty (&eps_via_nodes); + + prev_idx_match = (regmatch_t *) alloca (sizeof (regmatch_t) * real_nmatch); + memcpy (prev_idx_match, pmatch, sizeof (regmatch_t) * real_nmatch); + for (idx = pmatch[0].rm_so; idx <= pmatch[0].rm_eo ;) { - update_regs (dfa, pmatch, cur_node, idx, real_nmatch); + update_regs (dfa, pmatch, prev_idx_match, cur_node, idx, real_nmatch); + if (idx == pmatch[0].rm_eo && cur_node == mctx->last_node) { int reg_idx; @@ -1316,13 +1339,17 @@ set_regs (preg, mctx, nmatch, pmatch, fl_backtrack) } /* Proceed to next node. */ - cur_node = proceed_next_node (preg, nmatch, pmatch, mctx, &idx, cur_node, + cur_node = proceed_next_node (mctx, nmatch, pmatch, &idx, cur_node, &eps_via_nodes, fs); if (BE (cur_node < 0, 0)) { - if (cur_node == -2) - return REG_ESPACE; + if (BE (cur_node == -2, 0)) + { + re_node_set_free (&eps_via_nodes); + free_fail_stack_return (fs); + return REG_ESPACE; + } if (fs) cur_node = pop_fail_stack (fs, &idx, nmatch, pmatch, &eps_via_nodes); @@ -1355,31 +1382,55 @@ free_fail_stack_return (fs) } static void -update_regs (dfa, pmatch, cur_node, cur_idx, nmatch) +update_regs (dfa, pmatch, prev_idx_match, cur_node, cur_idx, nmatch) re_dfa_t *dfa; - regmatch_t *pmatch; + regmatch_t *pmatch, *prev_idx_match; int cur_node, cur_idx, nmatch; { int type = dfa->nodes[cur_node].type; - int reg_num; - if (type != OP_OPEN_SUBEXP && type != OP_CLOSE_SUBEXP) - return; - reg_num = dfa->nodes[cur_node].opr.idx + 1; - if (reg_num >= nmatch) - return; if (type == OP_OPEN_SUBEXP) { + int reg_num = dfa->nodes[cur_node].opr.idx + 1; + /* We are at the first node of this sub expression. */ - pmatch[reg_num].rm_so = cur_idx; - pmatch[reg_num].rm_eo = -1; + if (reg_num < nmatch) + { + pmatch[reg_num].rm_so = cur_idx; + pmatch[reg_num].rm_eo = -1; + } } else if (type == OP_CLOSE_SUBEXP) - /* We are at the first node of this sub expression. */ - pmatch[reg_num].rm_eo = cur_idx; + { + int reg_num = dfa->nodes[cur_node].opr.idx + 1; + if (reg_num < nmatch) + { + /* We are at the last node of this sub expression. */ + if (pmatch[reg_num].rm_so < cur_idx) + { + pmatch[reg_num].rm_eo = cur_idx; + /* This is a non-empty match or we are not inside an optional + subexpression. Accept this right away. */ + memcpy (prev_idx_match, pmatch, sizeof (regmatch_t) * nmatch); + } + else + { + if (dfa->nodes[cur_node].opt_subexp + && prev_idx_match[reg_num].rm_so != -1) + /* We transited through an empty match for an optional + subexpression, like (a?)*, and this is not the subexp's + first match. Copy back the old content of the registers + so that matches of an inner subexpression are undone as + well, like in ((a?))*. */ + memcpy (pmatch, prev_idx_match, sizeof (regmatch_t) * nmatch); + else + /* We completed a subexpression, but it may be part of + an optional one, so do not update PREV_IDX_MATCH. */ + pmatch[reg_num].rm_eo = cur_idx; + } + } + } } -#define NUMBER_OF_STATE 1 - /* This function checks the STATE_LOG from the SCTX->last_str_idx to 0 and sift the nodes in each states according to the following rules. Updated state_log will be wrote to STATE_LOG. @@ -1393,24 +1444,23 @@ update_regs (dfa, pmatch, cur_node, cur_idx, nmatch) i. If 'b' isn't in the STATE_LOG[STR_IDX+strlen('s')], we throw away the node `a'. ii. If 'b' is in the STATE_LOG[STR_IDX+strlen('s')] but 'b' is - throwed away, we throw away the node `a'. - 3. When 0 <= STR_IDX < n and 'a' epsilon transit to 'b': + thrown away, we throw away the node `a'. + 3. When 0 <= STR_IDX < MATCH_LAST and 'a' epsilon transit to 'b': i. If 'b' isn't in the STATE_LOG[STR_IDX], we throw away the node `a'. - ii. If 'b' is in the STATE_LOG[STR_IDX] but 'b' is throwed away, + ii. If 'b' is in the STATE_LOG[STR_IDX] but 'b' is thrown away, we throw away the node `a'. */ #define STATE_NODE_CONTAINS(state,node) \ ((state) != NULL && re_node_set_contains (&(state)->nodes, node)) static reg_errcode_t -sift_states_backward (preg, mctx, sctx) - const regex_t *preg; +sift_states_backward (mctx, sctx) re_match_context_t *mctx; re_sift_context_t *sctx; { + re_dfa_t *const dfa = mctx->dfa; reg_errcode_t err; - re_dfa_t *dfa = (re_dfa_t *)preg->buffer; int null_cnt = 0; int str_idx = sctx->last_str_idx; re_node_set cur_dest; @@ -1426,7 +1476,7 @@ sift_states_backward (preg, mctx, sctx) err = re_node_set_init_1 (&cur_dest, sctx->last_node); if (BE (err != REG_NOERROR, 0)) return err; - err = update_cur_sifted_state (preg, mctx, sctx, str_idx, &cur_dest); + err = update_cur_sifted_state (mctx, sctx, str_idx, &cur_dest); if (BE (err != REG_NOERROR, 0)) goto free_return; @@ -1460,12 +1510,12 @@ sift_states_backward (preg, mctx, sctx) int naccepted = 0; re_token_type_t type = dfa->nodes[prev_node].type; - if (IS_EPSILON_NODE(type)) + if (IS_EPSILON_NODE (type)) continue; #ifdef RE_ENABLE_I18N /* If the node may accept `multi byte'. */ if (ACCEPT_MB_NODE (type)) - naccepted = sift_states_iter_mb (preg, mctx, sctx, prev_node, + naccepted = sift_states_iter_mb (mctx, sctx, prev_node, str_idx, sctx->last_str_idx); #endif /* RE_ENABLE_I18N */ @@ -1473,8 +1523,7 @@ sift_states_backward (preg, mctx, sctx) See update_cur_sifted_state(). */ if (!naccepted - && check_node_accept (preg, dfa->nodes + prev_node, mctx, - str_idx) + && check_node_accept (mctx, dfa->nodes + prev_node, str_idx) && STATE_NODE_CONTAINS (sctx->sifted_states[str_idx + 1], dfa->nexts[prev_node])) naccepted = 1; @@ -1485,7 +1534,7 @@ sift_states_backward (preg, mctx, sctx) if (sctx->limits.nelem) { int to_idx = str_idx + naccepted; - if (check_dst_limits (dfa, &sctx->limits, mctx, + if (check_dst_limits (mctx, &sctx->limits, dfa->nexts[prev_node], to_idx, prev_node, str_idx)) continue; @@ -1502,7 +1551,7 @@ sift_states_backward (preg, mctx, sctx) - It can epsilon transit to a node in CUR_DEST. - It is in CUR_SRC. And update state_log. */ - err = update_cur_sifted_state (preg, mctx, sctx, str_idx, &cur_dest); + err = update_cur_sifted_state (mctx, sctx, str_idx, &cur_dest); if (BE (err != REG_NOERROR, 0)) goto free_return; } @@ -1514,16 +1563,16 @@ sift_states_backward (preg, mctx, sctx) /* Helper functions. */ -static inline reg_errcode_t -clean_state_log_if_need (mctx, next_state_log_idx) +static reg_errcode_t +clean_state_log_if_needed (mctx, next_state_log_idx) re_match_context_t *mctx; int next_state_log_idx; { int top = mctx->state_log_top; - if (next_state_log_idx >= mctx->input->bufs_len - || (next_state_log_idx >= mctx->input->valid_len - && mctx->input->valid_len < mctx->input->len)) + if (next_state_log_idx >= mctx->input.bufs_len + || (next_state_log_idx >= mctx->input.valid_len + && mctx->input.valid_len < mctx->input.len)) { reg_errcode_t err; err = extend_buffers (mctx); @@ -1570,15 +1619,14 @@ merge_state_array (dfa, dst, src, num) } static reg_errcode_t -update_cur_sifted_state (preg, mctx, sctx, str_idx, dest_nodes) - const regex_t *preg; +update_cur_sifted_state (mctx, sctx, str_idx, dest_nodes) re_match_context_t *mctx; re_sift_context_t *sctx; int str_idx; re_node_set *dest_nodes; { + re_dfa_t *const dfa = mctx->dfa; reg_errcode_t err; - re_dfa_t *dfa = (re_dfa_t *)preg->buffer; const re_node_set *candidates; candidates = ((mctx->state_log[str_idx] == NULL) ? &empty_set : &mctx->state_log[str_idx]->nodes); @@ -1609,7 +1657,7 @@ update_cur_sifted_state (preg, mctx, sctx, str_idx, dest_nodes) if ((mctx->state_log[str_idx] != NULL && mctx->state_log[str_idx]->has_backref)) { - err = sift_states_bkref (preg, mctx, sctx, str_idx, dest_nodes); + err = sift_states_bkref (mctx, sctx, str_idx, dest_nodes); if (BE (err != REG_NOERROR, 0)) return err; } @@ -1696,12 +1744,12 @@ sub_epsilon_src_nodes (dfa, node, dest_nodes, candidates) } static int -check_dst_limits (dfa, limits, mctx, dst_node, dst_idx, src_node, src_idx) - re_dfa_t *dfa; - re_node_set *limits; +check_dst_limits (mctx, limits, dst_node, dst_idx, src_node, src_idx) re_match_context_t *mctx; + re_node_set *limits; int dst_node, dst_idx, src_node, src_idx; { + re_dfa_t *const dfa = mctx->dfa; int lim_idx, src_pos, dst_pos; for (lim_idx = 0; lim_idx < limits->nelem; ++lim_idx) @@ -1711,10 +1759,10 @@ check_dst_limits (dfa, limits, mctx, dst_node, dst_idx, src_node, src_idx) ent = mctx->bkref_ents + limits->elems[lim_idx]; subexp_idx = dfa->nodes[ent->node].opr.idx - 1; - dst_pos = check_dst_limits_calc_pos (dfa, mctx, limits->elems[lim_idx], + dst_pos = check_dst_limits_calc_pos (mctx, limits->elems[lim_idx], dfa->eclosures + dst_node, subexp_idx, dst_node, dst_idx); - src_pos = check_dst_limits_calc_pos (dfa, mctx, limits->elems[lim_idx], + src_pos = check_dst_limits_calc_pos (mctx, limits->elems[lim_idx], dfa->eclosures + src_node, subexp_idx, src_node, src_idx); @@ -1731,60 +1779,98 @@ check_dst_limits (dfa, limits, mctx, dst_node, dst_idx, src_node, src_idx) } static int -check_dst_limits_calc_pos (dfa, mctx, limit, eclosures, subexp_idx, node, +check_dst_limits_calc_pos (mctx, limit, eclosures, subexp_idx, from_node, str_idx) - re_dfa_t *dfa; re_match_context_t *mctx; re_node_set *eclosures; - int limit, subexp_idx, node, str_idx; + int limit, subexp_idx, from_node, str_idx; { + re_dfa_t *const dfa = mctx->dfa; struct re_backref_cache_entry *lim = mctx->bkref_ents + limit; - int pos = (str_idx < lim->subexp_from ? -1 - : (lim->subexp_to < str_idx ? 1 : 0)); - if (pos == 0 - && (str_idx == lim->subexp_from || str_idx == lim->subexp_to)) + int node_idx; + + /* If we are outside the range of the subexpression, return -1 or 1. */ + if (str_idx < lim->subexp_from) + return -1; + + if (lim->subexp_to < str_idx) + return 1; + + /* If we are within the subexpression, return 0. */ + if (str_idx != lim->subexp_from && str_idx != lim->subexp_to) + return 0; + + /* Else, we are on the boundary: examine the nodes on the epsilon + closure. */ + for (node_idx = 0; node_idx < eclosures->nelem; ++node_idx) { - int node_idx; - for (node_idx = 0; node_idx < eclosures->nelem; ++node_idx) + int node = eclosures->elems[node_idx]; + switch (dfa->nodes[node].type) { - int node = eclosures->elems[node_idx]; - re_token_type_t type= dfa->nodes[node].type; - if (type == OP_BACK_REF) - { - int bi = search_cur_bkref_entry (mctx, str_idx); - for (; bi < mctx->nbkref_ents; ++bi) - { - struct re_backref_cache_entry *ent = mctx->bkref_ents + bi; - if (ent->str_idx > str_idx) - break; - if (ent->node == node && ent->subexp_from == ent->subexp_to) - { - int cpos, dst; - dst = dfa->edests[node].elems[0]; - cpos = check_dst_limits_calc_pos (dfa, mctx, limit, - dfa->eclosures + dst, - subexp_idx, dst, - str_idx); - if ((str_idx == lim->subexp_from && cpos == -1) - || (str_idx == lim->subexp_to && cpos == 0)) - return cpos; - } - } - } - if (type == OP_OPEN_SUBEXP && subexp_idx == dfa->nodes[node].opr.idx - && str_idx == lim->subexp_from) - { - pos = -1; + case OP_BACK_REF: + { + int bi = search_cur_bkref_entry (mctx, str_idx); + for (; bi < mctx->nbkref_ents; ++bi) + { + struct re_backref_cache_entry *ent = mctx->bkref_ents + bi; + int dst, cpos; + + /* If this backreference goes beyond the point we're + examining, don't go any further. */ + if (ent->str_idx > str_idx) + break; + + if (ent->node != node || ent->subexp_from != ent->subexp_to) + continue; + + /* Recurse trying to reach the OP_OPEN_SUBEXP and + OP_CLOSE_SUBEXP cases below. But, if the + destination node is the same node as the source + node, don't recurse because it would cause an + infinite loop: a regex that exhibits this behavior + is ()\1*\1* */ + dst = dfa->edests[node].elems[0]; + if (dst == from_node) + { + if (str_idx == lim->subexp_from) + return -1; + else /* if (str_idx == lim->subexp_to) */ + return 0; + } + + cpos = check_dst_limits_calc_pos (mctx, limit, + dfa->eclosures + dst, + subexp_idx, dst, + str_idx); + + if (cpos == -1 && str_idx == lim->subexp_from) + return -1; + + if (cpos == 0 /* && str_idx == lim->lim->subexp_to */) + return 0; + } break; } - if (type == OP_CLOSE_SUBEXP && subexp_idx == dfa->nodes[node].opr.idx - && str_idx == lim->subexp_to) + + case OP_OPEN_SUBEXP: + if (str_idx == lim->subexp_from && subexp_idx == dfa->nodes[node].opr.idx) + return -1; + break; + + case OP_CLOSE_SUBEXP: + if (str_idx == lim->subexp_to && subexp_idx == dfa->nodes[node].opr.idx) + return 0; + break; + + default: break; } - if (node_idx == eclosures->nelem && str_idx == lim->subexp_to) - pos = 1; } - return pos; + + if (str_idx == lim->subexp_to) + return 1; + else + return 0; } /* Check the limitations of sub expressions LIMITS, and remove the nodes @@ -1819,7 +1905,7 @@ check_subexp_limits (dfa, dest_nodes, candidates, limits, bkref_ents, str_idx) for (node_idx = 0; node_idx < dest_nodes->nelem; ++node_idx) { int node = dest_nodes->elems[node_idx]; - re_token_type_t type= dfa->nodes[node].type; + re_token_type_t type = dfa->nodes[node].type; if (type == OP_OPEN_SUBEXP && subexp_idx == dfa->nodes[node].opr.idx) ops_node = node; @@ -1832,34 +1918,38 @@ check_subexp_limits (dfa, dest_nodes, candidates, limits, bkref_ents, str_idx) /* Note that (ent->subexp_to = str_idx != ent->subexp_from). */ if (ops_node >= 0) { - err = sub_epsilon_src_nodes(dfa, ops_node, dest_nodes, - candidates); + err = sub_epsilon_src_nodes (dfa, ops_node, dest_nodes, + candidates); if (BE (err != REG_NOERROR, 0)) return err; } + /* Check the limitation of the close subexpression. */ - for (node_idx = 0; node_idx < dest_nodes->nelem; ++node_idx) - { - int node = dest_nodes->elems[node_idx]; - if (!re_node_set_contains (dfa->inveclosures + node, cls_node) - && !re_node_set_contains (dfa->eclosures + node, cls_node)) - { - /* It is against this limitation. - Remove it form the current sifted state. */ - err = sub_epsilon_src_nodes(dfa, node, dest_nodes, - candidates); - if (BE (err != REG_NOERROR, 0)) - return err; - --node_idx; - } - } + if (cls_node >= 0) + for (node_idx = 0; node_idx < dest_nodes->nelem; ++node_idx) + { + int node = dest_nodes->elems[node_idx]; + if (!re_node_set_contains (dfa->inveclosures + node, + cls_node) + && !re_node_set_contains (dfa->eclosures + node, + cls_node)) + { + /* It is against this limitation. + Remove it form the current sifted state. */ + err = sub_epsilon_src_nodes (dfa, node, dest_nodes, + candidates); + if (BE (err != REG_NOERROR, 0)) + return err; + --node_idx; + } + } } else /* (ent->subexp_to != str_idx) */ { for (node_idx = 0; node_idx < dest_nodes->nelem; ++node_idx) { int node = dest_nodes->elems[node_idx]; - re_token_type_t type= dfa->nodes[node].type; + re_token_type_t type = dfa->nodes[node].type; if (type == OP_CLOSE_SUBEXP || type == OP_OPEN_SUBEXP) { if (subexp_idx != dfa->nodes[node].opr.idx) @@ -1869,8 +1959,8 @@ check_subexp_limits (dfa, dest_nodes, candidates, limits, bkref_ents, str_idx) { /* It is against this limitation. Remove it form the current sifted state. */ - err = sub_epsilon_src_nodes(dfa, node, dest_nodes, - candidates); + err = sub_epsilon_src_nodes (dfa, node, dest_nodes, + candidates); if (BE (err != REG_NOERROR, 0)) return err; } @@ -1882,15 +1972,14 @@ check_subexp_limits (dfa, dest_nodes, candidates, limits, bkref_ents, str_idx) } static reg_errcode_t -sift_states_bkref (preg, mctx, sctx, str_idx, dest_nodes) - const regex_t *preg; +sift_states_bkref (mctx, sctx, str_idx, dest_nodes) re_match_context_t *mctx; re_sift_context_t *sctx; int str_idx; re_node_set *dest_nodes; { + re_dfa_t *const dfa = mctx->dfa; reg_errcode_t err; - re_dfa_t *dfa = (re_dfa_t *)preg->buffer; int node_idx, node; re_sift_context_t local_sctx; const re_node_set *candidates; @@ -1900,7 +1989,7 @@ sift_states_bkref (preg, mctx, sctx, str_idx, dest_nodes) for (node_idx = 0; node_idx < candidates->nelem; ++node_idx) { - int cur_bkref_idx = re_string_cur_idx (mctx->input); + int cur_bkref_idx = re_string_cur_idx (&mctx->input); re_token_type_t type; node = candidates->elems[node_idx]; type = dfa->nodes[node].type; @@ -1930,7 +2019,7 @@ sift_states_bkref (preg, mctx, sctx, str_idx, dest_nodes) || sctx->sifted_states[to_idx] == NULL || !STATE_NODE_CONTAINS (sctx->sifted_states[to_idx], dst_node) - || check_dst_limits (dfa, &sctx->limits, mctx, node, + || check_dst_limits (mctx, &sctx->limits, node, str_idx, dst_node, to_idx)) continue; { @@ -1963,7 +2052,7 @@ sift_states_bkref (preg, mctx, sctx, str_idx, dest_nodes) goto free_return; } cur_state = local_sctx.sifted_states[str_idx]; - err = sift_states_backward (preg, mctx, &local_sctx); + err = sift_states_backward (mctx, &local_sctx); if (BE (err != REG_NOERROR, 0)) goto free_return; if (sctx->limited_states != NULL) @@ -2006,21 +2095,20 @@ sift_states_bkref (preg, mctx, sctx, str_idx, dest_nodes) #ifdef RE_ENABLE_I18N static int -sift_states_iter_mb (preg, mctx, sctx, node_idx, str_idx, max_str_idx) - const regex_t *preg; +sift_states_iter_mb (mctx, sctx, node_idx, str_idx, max_str_idx) const re_match_context_t *mctx; re_sift_context_t *sctx; int node_idx, str_idx, max_str_idx; { - re_dfa_t *dfa = (re_dfa_t *) preg->buffer; + re_dfa_t *const dfa = mctx->dfa; int naccepted; /* Check the node can accept `multi byte'. */ - naccepted = check_node_accept_bytes (preg, node_idx, mctx->input, str_idx); + naccepted = check_node_accept_bytes (dfa, node_idx, &mctx->input, str_idx); if (naccepted > 0 && str_idx + naccepted <= max_str_idx && !STATE_NODE_CONTAINS (sctx->sifted_states[str_idx + naccepted], dfa->nexts[node_idx])) /* The node can't accept the `multi byte', or the - destination was already throwed away, then the node + destination was already thrown away, then the node could't accept the current input `multi byte'. */ naccepted = 0; /* Otherwise, it is sure that the node could accept @@ -2038,21 +2126,19 @@ sift_states_iter_mb (preg, mctx, sctx, node_idx, str_idx, max_str_idx) update the destination of STATE_LOG. */ static re_dfastate_t * -transit_state (err, preg, mctx, state, fl_search) +transit_state (err, mctx, state) reg_errcode_t *err; - const regex_t *preg; re_match_context_t *mctx; re_dfastate_t *state; - int fl_search; { - re_dfa_t *dfa = (re_dfa_t *) preg->buffer; + re_dfa_t *const dfa = mctx->dfa; re_dfastate_t **trtable, *next_state; unsigned char ch; int cur_idx; - if (re_string_cur_idx (mctx->input) + 1 >= mctx->input->bufs_len - || (re_string_cur_idx (mctx->input) + 1 >= mctx->input->valid_len - && mctx->input->valid_len < mctx->input->len)) + if (re_string_cur_idx (&mctx->input) + 1 >= mctx->input.bufs_len + || (re_string_cur_idx (&mctx->input) + 1 >= mctx->input.valid_len + && mctx->input.valid_len < mctx->input.len)) { *err = extend_buffers (mctx); if (BE (*err != REG_NOERROR, 0)) @@ -2063,7 +2149,7 @@ transit_state (err, preg, mctx, state, fl_search) if (state == NULL) { next_state = state; - re_string_skip_bytes (mctx->input, 1); + re_string_skip_bytes (&mctx->input, 1); } else { @@ -2071,7 +2157,7 @@ transit_state (err, preg, mctx, state, fl_search) /* If the current state can accept multibyte. */ if (state->accept_mb) { - *err = transit_state_mb (preg, state, mctx); + *err = transit_state_mb (mctx, state); if (BE (*err != REG_NOERROR, 0)) return NULL; } @@ -2081,28 +2167,44 @@ transit_state (err, preg, mctx, state, fl_search) if (1) { /* Use transition table */ - ch = re_string_fetch_byte (mctx->input); - trtable = fl_search ? state->trtable_search : state->trtable; + ch = re_string_fetch_byte (&mctx->input); + trtable = state->trtable; if (trtable == NULL) { - trtable = build_trtable (preg, state, fl_search); - if (fl_search) - state->trtable_search = trtable; + trtable = build_trtable (dfa, state); + if (trtable == NULL) + { + *err = REG_ESPACE; + return NULL; + } + } + if (BE (state->word_trtable, 0)) + { + unsigned int context; + context + = re_string_context_at (&mctx->input, + re_string_cur_idx (&mctx->input) - 1, + mctx->eflags); + if (IS_WORD_CONTEXT (context)) + next_state = trtable[ch + SBC_MAX]; else - state->trtable = trtable; + next_state = trtable[ch]; } - next_state = trtable[ch]; + else + next_state = trtable[ch]; } +#if 0 else { /* don't use transition table */ - next_state = transit_state_sb (err, preg, state, fl_search, mctx); + next_state = transit_state_sb (err, mctx, state); if (BE (next_state == NULL && err != REG_NOERROR, 0)) return NULL; } +#endif } - cur_idx = re_string_cur_idx (mctx->input); + cur_idx = re_string_cur_idx (&mctx->input); /* Update the state_log if we need. */ if (mctx->state_log != NULL) { @@ -2139,9 +2241,9 @@ transit_state (err, preg, mctx, state, fl_search) /* Note: We already add the nodes of the initial state, then we don't need to add them here. */ - context = re_string_context_at (mctx->input, - re_string_cur_idx (mctx->input) - 1, - mctx->eflags, preg->newline_anchor); + context = re_string_context_at (&mctx->input, + re_string_cur_idx (&mctx->input) - 1, + mctx->eflags); next_state = mctx->state_log[cur_idx] = re_acquire_state_context (err, dfa, &next_nodes, context); /* We don't need to check errors here, since the return value of @@ -2152,24 +2254,24 @@ transit_state (err, preg, mctx, state, fl_search) } } - /* Check OP_OPEN_SUBEXP in the current state in case that we use them - later. We must check them here, since the back references in the - next state might use them. */ - if (dfa->nbackref && next_state/* && fl_process_bkref */) + if (BE (dfa->nbackref, 0) && next_state != NULL) { - *err = check_subexp_matching_top (dfa, mctx, &next_state->nodes, + /* Check OP_OPEN_SUBEXP in the current state in case that we use them + later. We must check them here, since the back references in the + next state might use them. */ + *err = check_subexp_matching_top (mctx, &next_state->nodes, cur_idx); if (BE (*err != REG_NOERROR, 0)) return NULL; - } - /* If the next state has back references. */ - if (next_state != NULL && next_state->has_backref) - { - *err = transit_state_bkref (preg, &next_state->nodes, mctx); - if (BE (*err != REG_NOERROR, 0)) - return NULL; - next_state = mctx->state_log[cur_idx]; + /* If the next state has back references. */ + if (next_state->has_backref) + { + *err = transit_state_bkref (mctx, &next_state->nodes); + if (BE (*err != REG_NOERROR, 0)) + return NULL; + next_state = mctx->state_log[cur_idx]; + } } return next_state; } @@ -2182,12 +2284,12 @@ transit_state (err, preg, mctx, state, fl_search) correspoding back references. */ static reg_errcode_t -check_subexp_matching_top (dfa, mctx, cur_nodes, str_idx) - re_dfa_t *dfa; +check_subexp_matching_top (mctx, cur_nodes, str_idx) re_match_context_t *mctx; re_node_set *cur_nodes; int str_idx; { + re_dfa_t *const dfa = mctx->dfa; int node_idx; reg_errcode_t err; @@ -2200,6 +2302,7 @@ check_subexp_matching_top (dfa, mctx, cur_nodes, str_idx) { int node = cur_nodes->elems[node_idx]; if (dfa->nodes[node].type == OP_OPEN_SUBEXP + && dfa->nodes[node].opr.idx < (8 * sizeof (dfa->used_bkref_map)) && dfa->used_bkref_map & (1 << dfa->nodes[node].opr.idx)) { err = match_ctx_add_subtop (mctx, node, str_idx); @@ -2210,21 +2313,20 @@ check_subexp_matching_top (dfa, mctx, cur_nodes, str_idx) return REG_NOERROR; } +#if 0 /* Return the next state to which the current state STATE will transit by accepting the current input byte. */ static re_dfastate_t * -transit_state_sb (err, preg, state, fl_search, mctx) +transit_state_sb (err, mctx, state) reg_errcode_t *err; - const regex_t *preg; - re_dfastate_t *state; - int fl_search; re_match_context_t *mctx; + re_dfastate_t *state; { - re_dfa_t *dfa = (re_dfa_t *) preg->buffer; + re_dfa_t *const dfa = mctx->dfa; re_node_set next_nodes; re_dfastate_t *next_state; - int node_cnt, cur_str_idx = re_string_cur_idx (mctx->input); + int node_cnt, cur_str_idx = re_string_cur_idx (&mctx->input); unsigned int context; *err = re_node_set_alloc (&next_nodes, state->nodes.nelem + 1); @@ -2233,7 +2335,7 @@ transit_state_sb (err, preg, state, fl_search, mctx) for (node_cnt = 0; node_cnt < state->nodes.nelem; ++node_cnt) { int cur_node = state->nodes.elems[node_cnt]; - if (check_node_accept (preg, dfa->nodes + cur_node, mctx, cur_str_idx)) + if (check_node_accept (mctx, dfa->nodes + cur_node, cur_str_idx)) { *err = re_node_set_merge (&next_nodes, dfa->eclosures + dfa->nexts[cur_node]); @@ -2244,49 +2346,25 @@ transit_state_sb (err, preg, state, fl_search, mctx) } } } - if (fl_search) - { -#ifdef RE_ENABLE_I18N - int not_initial = 0; - if (re_mb_cur_max > 1) - for (node_cnt = 0; node_cnt < next_nodes.nelem; ++node_cnt) - if (dfa->nodes[next_nodes.elems[node_cnt]].type == CHARACTER) - { - not_initial = dfa->nodes[next_nodes.elems[node_cnt]].mb_partial; - break; - } - if (!not_initial) -#endif - { - *err = re_node_set_merge (&next_nodes, - dfa->init_state->entrance_nodes); - if (BE (*err != REG_NOERROR, 0)) - { - re_node_set_free (&next_nodes); - return NULL; - } - } - } - context = re_string_context_at (mctx->input, cur_str_idx, mctx->eflags, - preg->newline_anchor); + context = re_string_context_at (&mctx->input, cur_str_idx, mctx->eflags); next_state = re_acquire_state_context (err, dfa, &next_nodes, context); /* We don't need to check errors here, since the return value of this function is next_state and ERR is already set. */ re_node_set_free (&next_nodes); - re_string_skip_bytes (mctx->input, 1); + re_string_skip_bytes (&mctx->input, 1); return next_state; } +#endif #ifdef RE_ENABLE_I18N static reg_errcode_t -transit_state_mb (preg, pstate, mctx) - const regex_t *preg; - re_dfastate_t *pstate; +transit_state_mb (mctx, pstate) re_match_context_t *mctx; + re_dfastate_t *pstate; { + re_dfa_t *const dfa = mctx->dfa; reg_errcode_t err; - re_dfa_t *dfa = (re_dfa_t *) preg->buffer; int i; for (i = 0; i < pstate->nodes.nelem; ++i) @@ -2299,26 +2377,26 @@ transit_state_mb (preg, pstate, mctx) if (dfa->nodes[cur_node_idx].constraint) { - context = re_string_context_at (mctx->input, - re_string_cur_idx (mctx->input), - mctx->eflags, preg->newline_anchor); + context = re_string_context_at (&mctx->input, + re_string_cur_idx (&mctx->input), + mctx->eflags); if (NOT_SATISFY_NEXT_CONSTRAINT (dfa->nodes[cur_node_idx].constraint, context)) continue; } - /* How many bytes the node can accepts? */ + /* How many bytes the node can accept? */ if (ACCEPT_MB_NODE (dfa->nodes[cur_node_idx].type)) - naccepted = check_node_accept_bytes (preg, cur_node_idx, mctx->input, - re_string_cur_idx (mctx->input)); + naccepted = check_node_accept_bytes (dfa, cur_node_idx, &mctx->input, + re_string_cur_idx (&mctx->input)); if (naccepted == 0) continue; /* The node can accepts `naccepted' bytes. */ - dest_idx = re_string_cur_idx (mctx->input) + naccepted; + dest_idx = re_string_cur_idx (&mctx->input) + naccepted; mctx->max_mb_elem_len = ((mctx->max_mb_elem_len < naccepted) ? naccepted : mctx->max_mb_elem_len); - err = clean_state_log_if_need (mctx, dest_idx); + err = clean_state_log_if_needed (mctx, dest_idx); if (BE (err != REG_NOERROR, 0)) return err; #ifdef DEBUG @@ -2338,8 +2416,7 @@ transit_state_mb (preg, pstate, mctx) if (BE (err != REG_NOERROR, 0)) return err; } - context = re_string_context_at (mctx->input, dest_idx - 1, mctx->eflags, - preg->newline_anchor); + context = re_string_context_at (&mctx->input, dest_idx - 1, mctx->eflags); mctx->state_log[dest_idx] = re_acquire_state_context (&err, dfa, &dest_nodes, context); if (dest_state != NULL) @@ -2352,22 +2429,21 @@ transit_state_mb (preg, pstate, mctx) #endif /* RE_ENABLE_I18N */ static reg_errcode_t -transit_state_bkref (preg, nodes, mctx) - const regex_t *preg; - re_node_set *nodes; +transit_state_bkref (mctx, nodes) re_match_context_t *mctx; + const re_node_set *nodes; { + re_dfa_t *const dfa = mctx->dfa; reg_errcode_t err; - re_dfa_t *dfa = (re_dfa_t *) preg->buffer; int i; - int cur_str_idx = re_string_cur_idx (mctx->input); + int cur_str_idx = re_string_cur_idx (&mctx->input); for (i = 0; i < nodes->nelem; ++i) { int dest_str_idx, prev_nelem, bkc_idx; int node_idx = nodes->elems[i]; unsigned int context; - re_token_t *node = dfa->nodes + node_idx; + const re_token_t *node = dfa->nodes + node_idx; re_node_set *new_dest_nodes; /* Check whether `node' is a backreference or not. */ @@ -2376,8 +2452,8 @@ transit_state_bkref (preg, nodes, mctx) if (node->constraint) { - context = re_string_context_at (mctx->input, cur_str_idx, - mctx->eflags, preg->newline_anchor); + context = re_string_context_at (&mctx->input, cur_str_idx, + mctx->eflags); if (NOT_SATISFY_NEXT_CONSTRAINT (node->constraint, context)) continue; } @@ -2385,7 +2461,7 @@ transit_state_bkref (preg, nodes, mctx) /* `node' is a backreference. Check the substring which the substring matched. */ bkc_idx = mctx->nbkref_ents; - err = get_subexp (preg, mctx, node_idx, cur_str_idx); + err = get_subexp (mctx, node_idx, cur_str_idx); if (BE (err != REG_NOERROR, 0)) goto free_return; @@ -2408,8 +2484,8 @@ transit_state_bkref (preg, nodes, mctx) : dfa->eclosures + dfa->nexts[node_idx]); dest_str_idx = (cur_str_idx + bkref_ent->subexp_to - bkref_ent->subexp_from); - context = re_string_context_at (mctx->input, dest_str_idx - 1, - mctx->eflags, preg->newline_anchor); + context = re_string_context_at (&mctx->input, dest_str_idx - 1, + mctx->eflags); dest_state = mctx->state_log[dest_str_idx]; prev_nelem = ((mctx->state_log[cur_str_idx] == NULL) ? 0 : mctx->state_log[cur_str_idx]->nodes.nelem); @@ -2446,11 +2522,11 @@ transit_state_bkref (preg, nodes, mctx) if (subexp_len == 0 && mctx->state_log[cur_str_idx]->nodes.nelem > prev_nelem) { - err = check_subexp_matching_top (dfa, mctx, new_dest_nodes, + err = check_subexp_matching_top (mctx, new_dest_nodes, cur_str_idx); if (BE (err != REG_NOERROR, 0)) goto free_return; - err = transit_state_bkref (preg, new_dest_nodes, mctx); + err = transit_state_bkref (mctx, new_dest_nodes); if (BE (err != REG_NOERROR, 0)) goto free_return; } @@ -2468,19 +2544,19 @@ transit_state_bkref (preg, nodes, mctx) delay these checking for prune_impossible_nodes(). */ static reg_errcode_t -get_subexp (preg, mctx, bkref_node, bkref_str_idx) - const regex_t *preg; +get_subexp (mctx, bkref_node, bkref_str_idx) re_match_context_t *mctx; int bkref_node, bkref_str_idx; { + re_dfa_t *const dfa = mctx->dfa; int subexp_num, sub_top_idx; - re_dfa_t *dfa = (re_dfa_t *) preg->buffer; - char *buf = (char *) re_string_get_buffer (mctx->input); + const char *buf = (const char *) re_string_get_buffer (&mctx->input); /* Return if we have already checked BKREF_NODE at BKREF_STR_IDX. */ int cache_idx = search_cur_bkref_entry (mctx, bkref_str_idx); for (; cache_idx < mctx->nbkref_ents; ++cache_idx) { - struct re_backref_cache_entry *entry = mctx->bkref_ents + cache_idx; + const struct re_backref_cache_entry *entry + = &mctx->bkref_ents[cache_idx]; if (entry->str_idx > bkref_str_idx) break; if (entry->node == bkref_node) @@ -2494,14 +2570,14 @@ get_subexp (preg, mctx, bkref_node, bkref_str_idx) reg_errcode_t err; re_sub_match_top_t *sub_top = mctx->sub_tops[sub_top_idx]; re_sub_match_last_t *sub_last; - int sub_last_idx, sl_str; - char *bkref_str; + int sub_last_idx, sl_str, bkref_str_off; + const char *bkref_str; if (dfa->nodes[sub_top->node].opr.idx != subexp_num) continue; /* It isn't related. */ sl_str = sub_top->str_idx; - bkref_str = buf + bkref_str_idx; + bkref_str_off = bkref_str_idx; /* At first, check the last node of sub expressions we already evaluated. */ for (sub_last_idx = 0; sub_last_idx < sub_top->nlasts; ++sub_last_idx) @@ -2512,17 +2588,24 @@ get_subexp (preg, mctx, bkref_node, bkref_str_idx) /* The matched string by the sub expression match with the substring at the back reference? */ if (sl_str_diff > 0 - && memcmp (bkref_str, buf + sl_str, sl_str_diff) != 0) + && memcmp (buf + bkref_str_off, buf + sl_str, sl_str_diff) != 0) break; /* We don't need to search this sub expression any more. */ - bkref_str += sl_str_diff; + bkref_str_off += sl_str_diff; sl_str += sl_str_diff; - err = get_subexp_sub (preg, mctx, sub_top, sub_last, bkref_node, + err = get_subexp_sub (mctx, sub_top, sub_last, bkref_node, bkref_str_idx); + + /* Reload buf, since the preceding call might have reallocated + the buffer. */ + buf = (const char *) re_string_get_buffer (&mctx->input); + if (err == REG_NOMATCH) continue; if (BE (err != REG_NOERROR, 0)) return err; } + bkref_str = buf + bkref_str_off; + if (sub_last_idx < sub_top->nlasts) continue; if (sub_last_idx > 0) @@ -2531,18 +2614,17 @@ get_subexp (preg, mctx, bkref_node, bkref_str_idx) for (; sl_str <= bkref_str_idx; ++sl_str) { int cls_node, sl_str_off; - re_node_set *nodes; + const re_node_set *nodes; sl_str_off = sl_str - sub_top->str_idx; /* The matched string by the sub expression match with the substring at the back reference? */ - if (sl_str_off > 0 - && memcmp (bkref_str++, buf + sl_str - 1, 1) != 0) + if (sl_str_off > 0 && *bkref_str++ != buf[sl_str - 1]) break; /* We don't need to search this sub expression any more. */ if (mctx->state_log[sl_str] == NULL) continue; /* Does this state have a ')' of the sub expression? */ nodes = &mctx->state_log[sl_str]->nodes; - cls_node = find_subexp_node (dfa, nodes, subexp_num, 0); + cls_node = find_subexp_node (dfa, nodes, subexp_num, OP_CLOSE_SUBEXP); if (cls_node == -1) continue; /* No. */ if (sub_top->path == NULL) @@ -2554,8 +2636,8 @@ get_subexp (preg, mctx, bkref_node, bkref_str_idx) } /* Can the OP_OPEN_SUBEXP node arrive the OP_CLOSE_SUBEXP node in the current context? */ - err = check_arrival (preg, mctx, sub_top->path, sub_top->node, - sub_top->str_idx, cls_node, sl_str, 0); + err = check_arrival (mctx, sub_top->path, sub_top->node, + sub_top->str_idx, cls_node, sl_str, OP_CLOSE_SUBEXP); if (err == REG_NOMATCH) continue; if (BE (err != REG_NOERROR, 0)) @@ -2563,7 +2645,7 @@ get_subexp (preg, mctx, bkref_node, bkref_str_idx) sub_last = match_ctx_add_sublast (sub_top, cls_node, sl_str); if (BE (sub_last == NULL, 0)) return REG_ESPACE; - err = get_subexp_sub (preg, mctx, sub_top, sub_last, bkref_node, + err = get_subexp_sub (mctx, sub_top, sub_last, bkref_node, bkref_str_idx); if (err == REG_NOMATCH) continue; @@ -2579,18 +2661,17 @@ get_subexp (preg, mctx, bkref_node, bkref_str_idx) and SUB_LAST. */ static reg_errcode_t -get_subexp_sub (preg, mctx, sub_top, sub_last, bkref_node, bkref_str) - const regex_t *preg; +get_subexp_sub (mctx, sub_top, sub_last, bkref_node, bkref_str) re_match_context_t *mctx; - re_sub_match_top_t *sub_top; + const re_sub_match_top_t *sub_top; re_sub_match_last_t *sub_last; int bkref_node, bkref_str; { reg_errcode_t err; int to_idx; /* Can the subexpression arrive the back reference? */ - err = check_arrival (preg, mctx, &sub_last->path, sub_last->node, - sub_last->str_idx, bkref_node, bkref_str, 1); + err = check_arrival (mctx, &sub_last->path, sub_last->node, + sub_last->str_idx, bkref_node, bkref_str, OP_OPEN_SUBEXP); if (err != REG_NOERROR) return err; err = match_ctx_add_entry (mctx, bkref_node, bkref_str, sub_top->str_idx, @@ -2598,7 +2679,7 @@ get_subexp_sub (preg, mctx, sub_top, sub_last, bkref_node, bkref_str) if (BE (err != REG_NOERROR, 0)) return err; to_idx = bkref_str + sub_last->str_idx - sub_top->str_idx; - clean_state_log_if_need (mctx, to_idx); + clean_state_log_if_needed (mctx, to_idx); return REG_NOERROR; } @@ -2611,18 +2692,17 @@ get_subexp_sub (preg, mctx, sub_top, sub_last, bkref_node, bkref_str) E.g. RE: (a){2} */ static int -find_subexp_node (dfa, nodes, subexp_idx, fl_open) - re_dfa_t *dfa; - re_node_set *nodes; - int subexp_idx, fl_open; +find_subexp_node (dfa, nodes, subexp_idx, type) + const re_dfa_t *dfa; + const re_node_set *nodes; + int subexp_idx, type; { int cls_idx; for (cls_idx = 0; cls_idx < nodes->nelem; ++cls_idx) { int cls_node = nodes->elems[cls_idx]; - re_token_t *node = dfa->nodes + cls_node; - if (((fl_open && node->type == OP_OPEN_SUBEXP) - || (!fl_open && node->type == OP_CLOSE_SUBEXP)) + const re_token_t *node = dfa->nodes + cls_node; + if (node->type == type && node->opr.idx == subexp_idx) return cls_node; } @@ -2635,14 +2715,13 @@ find_subexp_node (dfa, nodes, subexp_idx, fl_open) Return REG_NOERROR if it can arrive, or REG_NOMATCH otherwise. */ static reg_errcode_t -check_arrival (preg, mctx, path, top_node, top_str, last_node, last_str, - fl_open) - const regex_t *preg; +check_arrival (mctx, path, top_node, top_str, last_node, last_str, + type) re_match_context_t *mctx; state_array_t *path; - int top_node, top_str, last_node, last_str, fl_open; + int top_node, top_str, last_node, last_str, type; { - re_dfa_t *dfa = (re_dfa_t *) preg->buffer; + re_dfa_t *const dfa = mctx->dfa; reg_errcode_t err; int subexp_num, backup_cur_idx, str_idx, null_cnt; re_dfastate_t *cur_state = NULL; @@ -2652,14 +2731,17 @@ check_arrival (preg, mctx, path, top_node, top_str, last_node, last_str, subexp_num = dfa->nodes[top_node].opr.idx; /* Extend the buffer if we need. */ - if (path->alloc < last_str + mctx->max_mb_elem_len + 1) + if (BE (path->alloc < last_str + mctx->max_mb_elem_len + 1, 0)) { re_dfastate_t **new_array; int old_alloc = path->alloc; path->alloc += last_str + mctx->max_mb_elem_len + 1; new_array = re_realloc (path->array, re_dfastate_t *, path->alloc); if (new_array == NULL) - return REG_ESPACE; + { + path->alloc = old_alloc; + return REG_ESPACE; + } path->array = new_array; memset (new_array + old_alloc, '\0', sizeof (re_dfastate_t *) * (path->alloc - old_alloc)); @@ -2669,19 +2751,18 @@ check_arrival (preg, mctx, path, top_node, top_str, last_node, last_str, /* Temporary modify MCTX. */ backup_state_log = mctx->state_log; - backup_cur_idx = mctx->input->cur_idx; + backup_cur_idx = mctx->input.cur_idx; mctx->state_log = path->array; - mctx->input->cur_idx = str_idx; + mctx->input.cur_idx = str_idx; /* Setup initial node set. */ - context = re_string_context_at (mctx->input, str_idx - 1, mctx->eflags, - preg->newline_anchor); + context = re_string_context_at (&mctx->input, str_idx - 1, mctx->eflags); if (str_idx == top_str) { err = re_node_set_init_1 (&next_nodes, top_node); if (BE (err != REG_NOERROR, 0)) return err; - err = check_arrival_expand_ecl (dfa, &next_nodes, subexp_num, fl_open); + err = check_arrival_expand_ecl (dfa, &next_nodes, subexp_num, type); if (BE (err != REG_NOERROR, 0)) { re_node_set_free (&next_nodes); @@ -2704,8 +2785,8 @@ check_arrival (preg, mctx, path, top_node, top_str, last_node, last_str, { if (next_nodes.nelem) { - err = expand_bkref_cache (preg, mctx, &next_nodes, str_idx, last_str, - subexp_num, fl_open); + err = expand_bkref_cache (mctx, &next_nodes, str_idx, last_str, + subexp_num, type); if (BE ( err != REG_NOERROR, 0)) { re_node_set_free (&next_nodes); @@ -2736,8 +2817,8 @@ check_arrival (preg, mctx, path, top_node, top_str, last_node, last_str, } if (cur_state) { - err = check_arrival_add_next_nodes(preg, dfa, mctx, str_idx, - &cur_state->nodes, &next_nodes); + err = check_arrival_add_next_nodes (mctx, str_idx, + &cur_state->nodes, &next_nodes); if (BE (err != REG_NOERROR, 0)) { re_node_set_free (&next_nodes); @@ -2747,23 +2828,21 @@ check_arrival (preg, mctx, path, top_node, top_str, last_node, last_str, ++str_idx; if (next_nodes.nelem) { - err = check_arrival_expand_ecl (dfa, &next_nodes, subexp_num, - fl_open); + err = check_arrival_expand_ecl (dfa, &next_nodes, subexp_num, type); if (BE (err != REG_NOERROR, 0)) { re_node_set_free (&next_nodes); return err; } - err = expand_bkref_cache (preg, mctx, &next_nodes, str_idx, last_str, - subexp_num, fl_open); + err = expand_bkref_cache (mctx, &next_nodes, str_idx, last_str, + subexp_num, type); if (BE ( err != REG_NOERROR, 0)) { re_node_set_free (&next_nodes); return err; } } - context = re_string_context_at (mctx->input, str_idx - 1, mctx->eflags, - preg->newline_anchor); + context = re_string_context_at (&mctx->input, str_idx - 1, mctx->eflags); cur_state = re_acquire_state_context (&err, dfa, &next_nodes, context); if (BE (cur_state == NULL && err != REG_NOERROR, 0)) { @@ -2780,14 +2859,13 @@ check_arrival (preg, mctx, path, top_node, top_str, last_node, last_str, /* Fix MCTX. */ mctx->state_log = backup_state_log; - mctx->input->cur_idx = backup_cur_idx; + mctx->input.cur_idx = backup_cur_idx; - if (cur_nodes == NULL) - return REG_NOMATCH; /* Then check the current node set has the node LAST_NODE. */ - return (re_node_set_contains (cur_nodes, last_node) - || re_node_set_contains (cur_nodes, last_node) ? REG_NOERROR - : REG_NOMATCH); + if (cur_nodes != NULL && re_node_set_contains (cur_nodes, last_node)) + return REG_NOERROR; + + return REG_NOMATCH; } /* Helper functions for check_arrival. */ @@ -2799,13 +2877,12 @@ check_arrival (preg, mctx, path, top_node, top_str, last_node, last_str, Can't we unify them? */ static reg_errcode_t -check_arrival_add_next_nodes (preg, dfa, mctx, str_idx, cur_nodes, next_nodes) - const regex_t *preg; - re_dfa_t *dfa; +check_arrival_add_next_nodes (mctx, str_idx, cur_nodes, next_nodes) re_match_context_t *mctx; int str_idx; re_node_set *cur_nodes, *next_nodes; { + re_dfa_t *const dfa = mctx->dfa; int cur_idx; reg_errcode_t err; re_node_set union_set; @@ -2815,13 +2892,13 @@ check_arrival_add_next_nodes (preg, dfa, mctx, str_idx, cur_nodes, next_nodes) int naccepted = 0; int cur_node = cur_nodes->elems[cur_idx]; re_token_type_t type = dfa->nodes[cur_node].type; - if (IS_EPSILON_NODE(type)) + if (IS_EPSILON_NODE (type)) continue; #ifdef RE_ENABLE_I18N /* If the node may accept `multi byte'. */ if (ACCEPT_MB_NODE (type)) { - naccepted = check_node_accept_bytes (preg, cur_node, mctx->input, + naccepted = check_node_accept_bytes (dfa, cur_node, &mctx->input, str_idx); if (naccepted > 1) { @@ -2838,21 +2915,12 @@ check_arrival_add_next_nodes (preg, dfa, mctx, str_idx, cur_nodes, next_nodes) re_node_set_free (&union_set); return err; } - err = re_node_set_insert (&union_set, next_node); - if (BE (err < 0, 0)) - { - re_node_set_free (&union_set); - return REG_ESPACE; - } } - else + err = re_node_set_insert (&union_set, next_node); + if (BE (err < 0, 0)) { - err = re_node_set_insert (&union_set, next_node); - if (BE (err < 0, 0)) - { - re_node_set_free (&union_set); - return REG_ESPACE; - } + re_node_set_free (&union_set); + return REG_ESPACE; } mctx->state_log[next_idx] = re_acquire_state (&err, dfa, &union_set); @@ -2866,8 +2934,7 @@ check_arrival_add_next_nodes (preg, dfa, mctx, str_idx, cur_nodes, next_nodes) } #endif /* RE_ENABLE_I18N */ if (naccepted - || check_node_accept (preg, dfa->nodes + cur_node, mctx, - str_idx)) + || check_node_accept (mctx, dfa->nodes + cur_node, str_idx)) { err = re_node_set_insert (next_nodes, dfa->nexts[cur_node]); if (BE (err < 0, 0)) @@ -2888,10 +2955,10 @@ check_arrival_add_next_nodes (preg, dfa, mctx, str_idx, cur_nodes, next_nodes) */ static reg_errcode_t -check_arrival_expand_ecl (dfa, cur_nodes, ex_subexp, fl_open) +check_arrival_expand_ecl (dfa, cur_nodes, ex_subexp, type) re_dfa_t *dfa; re_node_set *cur_nodes; - int ex_subexp, fl_open; + int ex_subexp, type; { reg_errcode_t err; int idx, outside_node; @@ -2909,7 +2976,7 @@ check_arrival_expand_ecl (dfa, cur_nodes, ex_subexp, fl_open) { int cur_node = cur_nodes->elems[idx]; re_node_set *eclosure = dfa->eclosures + cur_node; - outside_node = find_subexp_node (dfa, eclosure, ex_subexp, fl_open); + outside_node = find_subexp_node (dfa, eclosure, ex_subexp, type); if (outside_node == -1) { /* There are no problematic nodes, just merge them. */ @@ -2924,7 +2991,7 @@ check_arrival_expand_ecl (dfa, cur_nodes, ex_subexp, fl_open) { /* There are problematic nodes, re-calculate incrementally. */ err = check_arrival_expand_ecl_sub (dfa, &new_nodes, cur_node, - ex_subexp, fl_open); + ex_subexp, type); if (BE (err != REG_NOERROR, 0)) { re_node_set_free (&new_nodes); @@ -2942,22 +3009,20 @@ check_arrival_expand_ecl (dfa, cur_nodes, ex_subexp, fl_open) problematic append it to DST_NODES. */ static reg_errcode_t -check_arrival_expand_ecl_sub (dfa, dst_nodes, target, ex_subexp, fl_open) +check_arrival_expand_ecl_sub (dfa, dst_nodes, target, ex_subexp, type) re_dfa_t *dfa; - int target, ex_subexp, fl_open; + int target, ex_subexp, type; re_node_set *dst_nodes; { - int cur_node, type; + int cur_node; for (cur_node = target; !re_node_set_contains (dst_nodes, cur_node);) { int err; - type = dfa->nodes[cur_node].type; - if (((type == OP_OPEN_SUBEXP && fl_open) - || (type == OP_CLOSE_SUBEXP && !fl_open)) + if (dfa->nodes[cur_node].type == type && dfa->nodes[cur_node].opr.idx == ex_subexp) { - if (!fl_open) + if (type == OP_CLOSE_SUBEXP) { err = re_node_set_insert (dst_nodes, cur_node); if (BE (err == -1, 0)) @@ -2974,7 +3039,7 @@ check_arrival_expand_ecl_sub (dfa, dst_nodes, target, ex_subexp, fl_open) { err = check_arrival_expand_ecl_sub (dfa, dst_nodes, dfa->edests[cur_node].elems[1], - ex_subexp, fl_open); + ex_subexp, type); if (BE (err != REG_NOERROR, 0)) return err; } @@ -2989,15 +3054,14 @@ check_arrival_expand_ecl_sub (dfa, dst_nodes, target, ex_subexp, fl_open) in MCTX->BKREF_ENTS. */ static reg_errcode_t -expand_bkref_cache (preg, mctx, cur_nodes, cur_str, last_str, subexp_num, - fl_open) - const regex_t *preg; +expand_bkref_cache (mctx, cur_nodes, cur_str, last_str, subexp_num, + type) re_match_context_t *mctx; - int cur_str, last_str, subexp_num, fl_open; + int cur_str, last_str, subexp_num, type; re_node_set *cur_nodes; { + re_dfa_t *const dfa = mctx->dfa; reg_errcode_t err; - re_dfa_t *dfa = (re_dfa_t *) preg->buffer; int cache_idx, cache_idx_start; /* The current state. */ @@ -3025,8 +3089,7 @@ expand_bkref_cache (preg, mctx, cur_nodes, cur_str, last_str, subexp_num, if (re_node_set_contains (cur_nodes, next_node)) continue; err = re_node_set_init_1 (&new_dests, next_node); - err2 = check_arrival_expand_ecl (dfa, &new_dests, subexp_num, - fl_open); + err2 = check_arrival_expand_ecl (dfa, &new_dests, subexp_num, type); err3 = re_node_set_merge (cur_nodes, &new_dests); re_node_set_free (&new_dests); if (BE (err != REG_NOERROR || err2 != REG_NOERROR @@ -3080,14 +3143,13 @@ expand_bkref_cache (preg, mctx, cur_nodes, cur_str, last_str, subexp_num, Return the new table if succeeded, otherwise return NULL. */ static re_dfastate_t ** -build_trtable (preg, state, fl_search) - const regex_t *preg; - const re_dfastate_t *state; - int fl_search; +build_trtable (dfa, state) + re_dfa_t *dfa; + re_dfastate_t *state; { reg_errcode_t err; - re_dfa_t *dfa = (re_dfa_t *) preg->buffer; - int i, j, k, ch; + int i, j, ch; + unsigned int elem, mask; int dests_node_malloced = 0, dest_states_malloced = 0; int ndests; /* Number of the destination states from `state'. */ re_dfastate_t **trtable; @@ -3116,25 +3178,22 @@ build_trtable (preg, state, fl_search) dests_ch = (bitset *) (dests_node + SBC_MAX); /* Initialize transiton table. */ - trtable = (re_dfastate_t **) calloc (sizeof (re_dfastate_t *), SBC_MAX); - if (BE (trtable == NULL, 0)) - { - if (dests_node_malloced) - free (dests_node); - return NULL; - } + state->word_trtable = 0; /* At first, group all nodes belonging to `state' into several destinations. */ - ndests = group_nodes_into_DFAstates (preg, state, dests_node, dests_ch); + ndests = group_nodes_into_DFAstates (dfa, state, dests_node, dests_ch); if (BE (ndests <= 0, 0)) { if (dests_node_malloced) free (dests_node); /* Return NULL in case of an error, trtable otherwise. */ if (ndests == 0) - return trtable; - free (trtable); + { + state->trtable = (re_dfastate_t **) + calloc (sizeof (re_dfastate_t *), SBC_MAX);; + return state->trtable; + } return NULL; } @@ -3160,7 +3219,6 @@ build_trtable (preg, state, fl_search) re_node_set_free (&follows); for (i = 0; i < ndests; ++i) re_node_set_free (dests_node + i); - free (trtable); if (dests_node_malloced) free (dests_node); return NULL; @@ -3187,26 +3245,6 @@ build_trtable (preg, state, fl_search) goto out_free; } } - /* If search flag is set, merge the initial state. */ - if (fl_search) - { -#ifdef RE_ENABLE_I18N - int not_initial = 0; - for (j = 0; j < follows.nelem; ++j) - if (dfa->nodes[follows.elems[j]].type == CHARACTER) - { - not_initial = dfa->nodes[follows.elems[j]].mb_partial; - break; - } - if (!not_initial) -#endif - { - err = re_node_set_merge (&follows, - dfa->init_state->entrance_nodes); - if (BE (err != REG_NOERROR, 0)) - goto out_free; - } - } dest_states[i] = re_acquire_state_context (&err, dfa, &follows, 0); if (BE (dest_states[i] == NULL && err != REG_NOERROR, 0)) goto out_free; @@ -3218,11 +3256,16 @@ build_trtable (preg, state, fl_search) CONTEXT_WORD); if (BE (dest_states_word[i] == NULL && err != REG_NOERROR, 0)) goto out_free; + + if (dest_states[i] != dest_states_word[i] + && dfa->mb_cur_max > 1) + state->word_trtable = 1; + dest_states_nl[i] = re_acquire_state_context (&err, dfa, &follows, CONTEXT_NEWLINE); if (BE (dest_states_nl[i] == NULL && err != REG_NOERROR, 0)) goto out_free; - } + } else { dest_states_word[i] = dest_states[i]; @@ -3231,47 +3274,76 @@ build_trtable (preg, state, fl_search) bitset_merge (acceptable, dests_ch[i]); } - /* Update the transition table. */ - /* For all characters ch...: */ - for (i = 0, ch = 0; i < BITSET_UINTS; ++i) - for (j = 0; j < UINT_BITS; ++j, ++ch) - if ((acceptable[i] >> j) & 1) - { - /* The current state accepts the character ch. */ - if (IS_WORD_CHAR (ch)) + if (!BE (state->word_trtable, 0)) + { + /* We don't care about whether the following character is a word + character, or we are in a single-byte character set so we can + discern by looking at the character code: allocate a + 256-entry transition table. */ + trtable = (re_dfastate_t **) calloc (sizeof (re_dfastate_t *), SBC_MAX); + if (BE (trtable == NULL, 0)) + goto out_free; + + /* For all characters ch...: */ + for (i = 0; i < BITSET_UINTS; ++i) + for (ch = i * UINT_BITS, elem = acceptable[i], mask = 1; + elem; + mask <<= 1, elem >>= 1, ++ch) + if (BE (elem & 1, 0)) { - for (k = 0; k < ndests; ++k) - if ((dests_ch[k][i] >> j) & 1) - { - /* k-th destination accepts the word character ch. */ - trtable[ch] = dest_states_word[k]; - /* There must be only one destination which accepts - character ch. See group_nodes_into_DFAstates. */ - break; - } + /* There must be exactly one destination which accepts + character ch. See group_nodes_into_DFAstates. */ + for (j = 0; (dests_ch[j][i] & mask) == 0; ++j) + ; + + /* j-th destination accepts the word character ch. */ + if (dfa->word_char[i] & mask) + trtable[ch] = dest_states_word[j]; + else + trtable[ch] = dest_states[j]; } - else /* not WORD_CHAR */ + } + else + { + /* We care about whether the following character is a word + character, and we are in a multi-byte character set: discern + by looking at the character code: build two 256-entry + transition tables, one starting at trtable[0] and one + starting at trtable[SBC_MAX]. */ + trtable = (re_dfastate_t **) calloc (sizeof (re_dfastate_t *), + 2 * SBC_MAX); + if (BE (trtable == NULL, 0)) + goto out_free; + + /* For all characters ch...: */ + for (i = 0; i < BITSET_UINTS; ++i) + for (ch = i * UINT_BITS, elem = acceptable[i], mask = 1; + elem; + mask <<= 1, elem >>= 1, ++ch) + if (BE (elem & 1, 0)) { - for (k = 0; k < ndests; ++k) - if ((dests_ch[k][i] >> j) & 1) - { - /* k-th destination accepts the non-word character ch. */ - trtable[ch] = dest_states[k]; - /* There must be only one destination which accepts - character ch. See group_nodes_into_DFAstates. */ - break; - } + /* There must be exactly one destination which accepts + character ch. See group_nodes_into_DFAstates. */ + for (j = 0; (dests_ch[j][i] & mask) == 0; ++j) + ; + + /* j-th destination accepts the word character ch. */ + trtable[ch] = dest_states[j]; + trtable[ch + SBC_MAX] = dest_states_word[j]; } - } + } + /* new line */ if (bitset_contain (acceptable, NEWLINE_CHAR)) { /* The current state accepts newline character. */ - for (k = 0; k < ndests; ++k) - if (bitset_contain (dests_ch[k], NEWLINE_CHAR)) + for (j = 0; j < ndests; ++j) + if (bitset_contain (dests_ch[j], NEWLINE_CHAR)) { /* k-th destination accepts newline character. */ - trtable[NEWLINE_CHAR] = dest_states_nl[k]; + trtable[NEWLINE_CHAR] = dest_states_nl[j]; + if (state->word_trtable) + trtable[NEWLINE_CHAR + SBC_MAX] = dest_states_nl[j]; /* There must be only one destination which accepts newline. See group_nodes_into_DFAstates. */ break; @@ -3288,6 +3360,7 @@ build_trtable (preg, state, fl_search) if (dests_node_malloced) free (dests_node); + state->trtable = trtable; return trtable; } @@ -3297,14 +3370,13 @@ build_trtable (preg, state, fl_search) to DEST_CH[i]. This function return the number of destinations. */ static int -group_nodes_into_DFAstates (preg, state, dests_node, dests_ch) - const regex_t *preg; +group_nodes_into_DFAstates (dfa, state, dests_node, dests_ch) + re_dfa_t *dfa; const re_dfastate_t *state; re_node_set *dests_node; bitset *dests_ch; { reg_errcode_t err; - const re_dfa_t *dfa = (re_dfa_t *) preg->buffer; int i, j, k; int ndests; /* Number of the destinations from `state'. */ bitset accepts; /* Characters a node can accept. */ @@ -3328,12 +3400,27 @@ group_nodes_into_DFAstates (preg, state, dests_node, dests_ch) } else if (type == OP_PERIOD) { - bitset_set_all (accepts); - if (!(preg->syntax & RE_DOT_NEWLINE)) +#ifdef RE_ENABLE_I18N + if (dfa->mb_cur_max > 1) + bitset_merge (accepts, dfa->sb_char); + else +#endif + bitset_set_all (accepts); + if (!(dfa->syntax & RE_DOT_NEWLINE)) bitset_clear (accepts, '\n'); - if (preg->syntax & RE_DOT_NOT_NULL) + if (dfa->syntax & RE_DOT_NOT_NULL) bitset_clear (accepts, '\0'); } +#ifdef RE_ENABLE_I18N + else if (type == OP_UTF8_PERIOD) + { + memset (accepts, 255, sizeof (unsigned int) * BITSET_UINTS / 2); + if (!(dfa->syntax & RE_DOT_NEWLINE)) + bitset_clear (accepts, '\n'); + if (dfa->syntax & RE_DOT_NOT_NULL) + bitset_clear (accepts, '\0'); + } +#endif else continue; @@ -3341,12 +3428,6 @@ group_nodes_into_DFAstates (preg, state, dests_node, dests_ch) match it the context. */ if (constraint) { - if (constraint & NEXT_WORD_CONSTRAINT) - for (j = 0; j < BITSET_UINTS; ++j) - accepts[j] &= dfa->word_char[j]; - if (constraint & NEXT_NOTWORD_CONSTRAINT) - for (j = 0; j < BITSET_UINTS; ++j) - accepts[j] &= ~dfa->word_char[j]; if (constraint & NEXT_NEWLINE_CONSTRAINT) { int accepts_newline = bitset_contain (accepts, NEWLINE_CHAR); @@ -3356,10 +3437,54 @@ group_nodes_into_DFAstates (preg, state, dests_node, dests_ch) else continue; } + if (constraint & NEXT_ENDBUF_CONSTRAINT) + { + bitset_empty (accepts); + continue; + } + + if (constraint & NEXT_WORD_CONSTRAINT) + { + unsigned int any_set = 0; + if (type == CHARACTER && !node->word_char) + { + bitset_empty (accepts); + continue; + } +#ifdef RE_ENABLE_I18N + if (dfa->mb_cur_max > 1) + for (j = 0; j < BITSET_UINTS; ++j) + any_set |= (accepts[j] &= (dfa->word_char[j] | ~dfa->sb_char[j])); + else +#endif + for (j = 0; j < BITSET_UINTS; ++j) + any_set |= (accepts[j] &= dfa->word_char[j]); + if (!any_set) + continue; + } + if (constraint & NEXT_NOTWORD_CONSTRAINT) + { + unsigned int any_set = 0; + if (type == CHARACTER && node->word_char) + { + bitset_empty (accepts); + continue; + } +#ifdef RE_ENABLE_I18N + if (dfa->mb_cur_max > 1) + for (j = 0; j < BITSET_UINTS; ++j) + any_set |= (accepts[j] &= ~(dfa->word_char[j] & dfa->sb_char[j])); + else +#endif + for (j = 0; j < BITSET_UINTS; ++j) + any_set |= (accepts[j] &= ~dfa->word_char[j]); + if (!any_set) + continue; + } } /* Then divide `accepts' into DFA states, or create a new - state. */ + state. Above, we make sure that accepts is not empty. */ for (j = 0; j < ndests; ++j) { bitset intersec; /* Intersection sets, see below. */ @@ -3436,37 +3561,94 @@ group_nodes_into_DFAstates (preg, state, dests_node, dests_ch) can only accept one byte. */ static int -check_node_accept_bytes (preg, node_idx, input, str_idx) - const regex_t *preg; +check_node_accept_bytes (dfa, node_idx, input, str_idx) + re_dfa_t *dfa; int node_idx, str_idx; const re_string_t *input; { - const re_dfa_t *dfa = (re_dfa_t *) preg->buffer; const re_token_t *node = dfa->nodes + node_idx; - int elem_len = re_string_elem_size_at (input, str_idx); - int char_len = re_string_char_size_at (input, str_idx); + int char_len, elem_len; int i; -# ifdef _LIBC - int j; - uint32_t nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES); -# endif /* _LIBC */ - if (elem_len <= 1 && char_len <= 1) - return 0; + + if (BE (node->type == OP_UTF8_PERIOD, 0)) + { + unsigned char c = re_string_byte_at (input, str_idx), d; + if (BE (c < 0xc2, 1)) + return 0; + + if (str_idx + 2 > input->len) + return 0; + + d = re_string_byte_at (input, str_idx + 1); + if (c < 0xe0) + return (d < 0x80 || d > 0xbf) ? 0 : 2; + else if (c < 0xf0) + { + char_len = 3; + if (c == 0xe0 && d < 0xa0) + return 0; + } + else if (c < 0xf8) + { + char_len = 4; + if (c == 0xf0 && d < 0x90) + return 0; + } + else if (c < 0xfc) + { + char_len = 5; + if (c == 0xf8 && d < 0x88) + return 0; + } + else if (c < 0xfe) + { + char_len = 6; + if (c == 0xfc && d < 0x84) + return 0; + } + else + return 0; + + if (str_idx + char_len > input->len) + return 0; + + for (i = 1; i < char_len; ++i) + { + d = re_string_byte_at (input, str_idx + i); + if (d < 0x80 || d > 0xbf) + return 0; + } + return char_len; + } + + char_len = re_string_char_size_at (input, str_idx); if (node->type == OP_PERIOD) { + if (char_len <= 1) + return 0; + /* FIXME: I don't think this if is needed, as both '\n' + and '\0' are char_len == 1. */ /* '.' accepts any one character except the following two cases. */ - if ((!(preg->syntax & RE_DOT_NEWLINE) && + if ((!(dfa->syntax & RE_DOT_NEWLINE) && re_string_byte_at (input, str_idx) == '\n') || - ((preg->syntax & RE_DOT_NOT_NULL) && + ((dfa->syntax & RE_DOT_NOT_NULL) && re_string_byte_at (input, str_idx) == '\0')) return 0; return char_len; } - else if (node->type == COMPLEX_BRACKET) + + elem_len = re_string_elem_size_at (input, str_idx); + if (elem_len <= 1 && char_len <= 1) + return 0; + + if (node->type == COMPLEX_BRACKET) { const re_charset_t *cset = node->opr.mbcset; # ifdef _LIBC - const unsigned char *pin = re_string_get_buffer (input) + str_idx; + const unsigned char *pin = ((char *) re_string_get_buffer (input) + + str_idx); + int j; + uint32_t nrules; # endif /* _LIBC */ int match_len = 0; wchar_t wc = ((cset->nranges || cset->nchar_classes || cset->nmbchars) @@ -3491,6 +3673,7 @@ check_node_accept_bytes (preg, node_idx, input, str_idx) } # ifdef _LIBC + nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES); if (nrules != 0) { unsigned int in_collseq = 0; @@ -3529,7 +3712,7 @@ check_node_accept_bytes (preg, node_idx, input, str_idx) if (elem_len <= char_len) { collseqwc = _NL_CURRENT (LC_COLLATE, _NL_COLLATE_COLLSEQWC); - in_collseq = collseq_table_lookup (collseqwc, wc); + in_collseq = __collseq_table_lookup (collseqwc, wc); } else in_collseq = find_collation_sequence_value (pin, elem_len); @@ -3676,33 +3859,41 @@ find_collation_sequence_value (mbs, mbs_len) byte of the INPUT. */ static int -check_node_accept (preg, node, mctx, idx) - const regex_t *preg; - const re_token_t *node; +check_node_accept (mctx, node, idx) const re_match_context_t *mctx; + const re_token_t *node; int idx; { + re_dfa_t *const dfa = mctx->dfa; unsigned char ch; if (node->constraint) { /* The node has constraints. Check whether the current context satisfies the constraints. */ - unsigned int context = re_string_context_at (mctx->input, idx, - mctx->eflags, - preg->newline_anchor); + unsigned int context = re_string_context_at (&mctx->input, idx, + mctx->eflags); if (NOT_SATISFY_NEXT_CONSTRAINT (node->constraint, context)) return 0; } - ch = re_string_byte_at (mctx->input, idx); - if (node->type == CHARACTER) - return node->opr.c == ch; - else if (node->type == SIMPLE_BRACKET) - return bitset_contain (node->opr.sbcset, ch); - else if (node->type == OP_PERIOD) - return !((ch == '\n' && !(preg->syntax & RE_DOT_NEWLINE)) - || (ch == '\0' && (preg->syntax & RE_DOT_NOT_NULL))); - else - return 0; + ch = re_string_byte_at (&mctx->input, idx); + switch (node->type) + { + case CHARACTER: + return node->opr.c == ch; + case SIMPLE_BRACKET: + return bitset_contain (node->opr.sbcset, ch); +#ifdef RE_ENABLE_I18N + case OP_UTF8_PERIOD: + if (ch >= 0x80) + return 0; + /* FALLTHROUGH */ +#endif + case OP_PERIOD: + return !((ch == '\n' && !(dfa->syntax & RE_DOT_NEWLINE)) + || (ch == '\0' && (dfa->syntax & RE_DOT_NOT_NULL))); + default: + return 0; + } } /* Extend the buffers, if the buffers have run out. */ @@ -3712,7 +3903,7 @@ extend_buffers (mctx) re_match_context_t *mctx; { reg_errcode_t ret; - re_string_t *pstr = mctx->input; + re_string_t *pstr = &mctx->input; /* Double the lengthes of the buffers. */ ret = re_string_realloc_buffers (pstr, pstr->bufs_len * 2); @@ -3722,9 +3913,11 @@ extend_buffers (mctx) if (mctx->state_log != NULL) { /* And double the length of state_log. */ - re_dfastate_t **new_array; - new_array = re_realloc (mctx->state_log, re_dfastate_t *, - pstr->bufs_len * 2); + /* XXX We have no indication of the size of this buffer. If this + allocation fail we have no indication that the state_log array + does not have the right size. */ + re_dfastate_t **new_array = re_realloc (mctx->state_log, re_dfastate_t *, + pstr->bufs_len + 1); if (BE (new_array == NULL, 0)) return REG_ESPACE; mctx->state_log = new_array; @@ -3734,8 +3927,12 @@ extend_buffers (mctx) if (pstr->icase) { #ifdef RE_ENABLE_I18N - if (re_mb_cur_max > 1) - build_wcs_upper_buffer (pstr); + if (pstr->mb_cur_max > 1) + { + ret = build_wcs_upper_buffer (pstr); + if (BE (ret != REG_NOERROR, 0)) + return ret; + } else #endif /* RE_ENABLE_I18N */ build_upper_buffer (pstr); @@ -3743,15 +3940,13 @@ extend_buffers (mctx) else { #ifdef RE_ENABLE_I18N - if (re_mb_cur_max > 1) + if (pstr->mb_cur_max > 1) build_wcs_buffer (pstr); else #endif /* RE_ENABLE_I18N */ { if (pstr->trans != NULL) re_string_translate_buffer (pstr); - else - pstr->valid_len = pstr->bufs_len; } } return REG_NOERROR; @@ -3763,13 +3958,11 @@ extend_buffers (mctx) /* Initialize MCTX. */ static reg_errcode_t -match_ctx_init (mctx, eflags, input, n) +match_ctx_init (mctx, eflags, n) re_match_context_t *mctx; int eflags, n; - re_string_t *input; { mctx->eflags = eflags; - mctx->input = input; mctx->match_last = -1; if (n > 0) { @@ -3778,12 +3971,13 @@ match_ctx_init (mctx, eflags, input, n) if (BE (mctx->bkref_ents == NULL || mctx->sub_tops == NULL, 0)) return REG_ESPACE; } - else - mctx->bkref_ents = NULL; - mctx->nbkref_ents = 0; + /* Already zero-ed by the caller. + else + mctx->bkref_ents = NULL; + mctx->nbkref_ents = 0; + mctx->nsub_tops = 0; */ mctx->abkref_ents = n; mctx->max_mb_elem_len = 1; - mctx->nsub_tops = 0; mctx->asub_tops = n; return REG_NOERROR; } @@ -3901,9 +4095,7 @@ match_ctx_clear_flag (mctx) { int i; for (i = 0; i < mctx->nbkref_ents; ++i) - { - mctx->bkref_ents[i].flag = 0; - } + mctx->bkref_ents[i].flag = 0; } /* Register the node NODE, whose type is OP_OPEN_SUBEXP, and which matches @@ -3918,18 +4110,19 @@ match_ctx_add_subtop (mctx, node, str_idx) assert (mctx->sub_tops != NULL); assert (mctx->asub_tops > 0); #endif - if (mctx->nsub_tops == mctx->asub_tops) + if (BE (mctx->nsub_tops == mctx->asub_tops, 0)) { - re_sub_match_top_t **new_array; - mctx->asub_tops *= 2; - new_array = re_realloc (mctx->sub_tops, re_sub_match_top_t *, - mctx->asub_tops); + int new_asub_tops = mctx->asub_tops * 2; + re_sub_match_top_t **new_array = re_realloc (mctx->sub_tops, + re_sub_match_top_t *, + new_asub_tops); if (BE (new_array == NULL, 0)) return REG_ESPACE; mctx->sub_tops = new_array; + mctx->asub_tops = new_asub_tops; } mctx->sub_tops[mctx->nsub_tops] = calloc (1, sizeof (re_sub_match_top_t)); - if (mctx->sub_tops[mctx->nsub_tops] == NULL) + if (BE (mctx->sub_tops[mctx->nsub_tops] == NULL, 0)) return REG_ESPACE; mctx->sub_tops[mctx->nsub_tops]->node = node; mctx->sub_tops[mctx->nsub_tops++]->str_idx = str_idx; @@ -3945,23 +4138,25 @@ match_ctx_add_sublast (subtop, node, str_idx) int node, str_idx; { re_sub_match_last_t *new_entry; - if (subtop->nlasts == subtop->alasts) + if (BE (subtop->nlasts == subtop->alasts, 0)) { - re_sub_match_last_t **new_array; - subtop->alasts = 2 * subtop->alasts + 1; - new_array = re_realloc (subtop->lasts, re_sub_match_last_t *, - subtop->alasts); + int new_alasts = 2 * subtop->alasts + 1; + re_sub_match_last_t **new_array = re_realloc (subtop->lasts, + re_sub_match_last_t *, + new_alasts); if (BE (new_array == NULL, 0)) return NULL; subtop->lasts = new_array; + subtop->alasts = new_alasts; } new_entry = calloc (1, sizeof (re_sub_match_last_t)); - if (BE (new_entry == NULL, 0)) - return NULL; - subtop->lasts[subtop->nlasts] = new_entry; - new_entry->node = node; - new_entry->str_idx = str_idx; - ++subtop->nlasts; + if (BE (new_entry != NULL, 1)) + { + subtop->lasts[subtop->nlasts] = new_entry; + new_entry->node = node; + new_entry->str_idx = str_idx; + ++subtop->nlasts; + } return new_entry; } diff --git a/replace.c b/replace.c index 81e17455d..f43f9c351 100644 --- a/replace.c +++ b/replace.c @@ -35,6 +35,10 @@ #include "missing_d/memset.c" #endif /* HAVE_MEMSET */ +#ifndef HAVE_MEMMOVE +#include "missing_d/memmove.c" +#endif /* HAVE_MEMMOVE */ + #ifndef HAVE_STRNCASECMP #include "missing_d/strncasecmp.c" #endif /* HAVE_STRCASE */ @@ -55,16 +59,22 @@ #include "missing_d/strtod.c" #endif /* HAVE_STRTOD */ +#ifndef HAVE_STRTOUL +#include "missing_d/strtoul.c" +#endif /* HAVE_STRTOUL */ + #ifndef HAVE_TZSET #include "missing_d/tzset.c" #endif /* HAVE_TZSET */ -#ifndef HAVE_MKTIME -#include "missing_d/mktime.c" -#endif /* HAVE_MKTIME */ - #if defined TANDEM #include "strdupc" #include "getidc" #include "strnchkc" #endif /* TANDEM */ + +#ifndef HAVE_MKTIME +/* mktime.c defines main() if DEBUG is set */ +#undef DEBUG +#include "missing_d/mktime.c" +#endif /* HAVE_MKTIME */ diff --git a/test/ChangeLog b/test/ChangeLog index 88bcbb798..16b03278a 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,93 @@ +Mon Aug 2 12:18:15 2004 Arnold D. Robbins + + * Release 3.1.4: Release tar file made. + +Wed Jul 14 16:04:46 2004 Arnold D. Robbins + + * Makefile.am (rstest6): new test. + * rstest6.awk, rstest6.in, rstest6.ok: new files. + +Tue Jul 13 10:53:32 2004 Arnold D. Robbins + + * strftlng: Use `$(CMP) ... >/dev/null 2>&1' instead of `-s' + for OS/2 and other systems that use `CMP = diff -a'. + +Mon Jun 14 18:44:39 2004 Pat Rankin + + * longwrds.awk: allow caller the means to override SORT command. + +Tue Jun 8 14:12:52 2004 Arnold D. Robbins + + * Makefile.am (fordel, printfbad1): new tests. + * fordel.awk, fordel.ok: new files. + * printfbad1.awk, printfbad1.ok: new files. + +Mon Apr 19 20:29:52 2004 Arnold D. Robbins + + * Makefile.am (manglprm): new test. + * manglprm.awk, manglprm.in, manglprm.ok: new files. + +Mon Feb 23 18:39:24 2004 Arnold D. Robbins + + * inftest.awk: Add loop limit per Nelson H.F. Beebe. + * Makefile.am (strftime): Use LC_ALL=C for `date' invocation. + +Thu Feb 12 02:08:15 2004 Stepan Kasal + + * Makefile.am (diffout): Use $(srcdir), when we are not building + in the source tree. + +Wed Feb 11 10:23:39 2004 Arnold D. Robbins + + * Makefile.am (strcat1): new test. + * strcat1.awk, strcat1.ok: new files. + +Fri Feb 6 12:09:55 2004 Arnold D. Robbins + + * Makefile.am (CLEANFILES): Added. + +Thu Feb 5 15:34:14 2004 Arnold D. Robbins + + * Makefile.am (exitval1): new test. + * exitval1.awk, exitval1.ok: new files. + +Mon Feb 2 10:29:19 2004 Arnold D. Robbins + + * Makefile.am (subamp): new test. + * subamp.awk, subamp.in, subamp.ok: new files. + + * subamp, ignrcas2, strftime: Set GAWK_LOCALE, not LC_ALL. + +Wed Jan 14 15:28:34 2004 Arnold D. Robbins + + * Makefile.am (backw): new test. + * backw.awk, backw.in, backw.ok: new files. + +Mon Dec 1 10:29:22 2003 Arnold D. Robbins + + * Makefile.am (concat3): new test. + * concat3.awk, concat3.ok: new files. + +Sun Nov 2 16:05:21 2003 Arnold D. Robbins + + * Makefile.am (concat2): new test. + * concat2.awk, concat2.ok: new files. + +Wed Oct 29 13:35:37 2003 Arnold D. Robbins + + * Makefile.am (subsepnm): new test. + * subsepnm.awk, subsepnm.ok: new files. + +Mon Sep 15 16:05:37 2003 Arnold D. Robbins + + * Makefile.am (ignrcas2): new test. + * ignrcas2.awk, ignrcas2.ok: new files. + +Tue Sep 9 16:03:34 2003 Arnold D. Robbins + + * Makefile.am (unterm): new test. + * unterm.awk, unterm.ok: new files. + Mon Jul 7 11:01:43 2003 Arnold D. Robbins * Release 3.1.3: Release tar file made. @@ -9,7 +99,7 @@ Fri Jul 4 11:12:07 2003 Arnold D. Robbins Thu Jun 26 15:44:33 2003 Arnold D. Robbins - * Makefile.am (match2, whiny): new test. + * Makefile.am (match2, whiny): new tests. * match2.awk, match2.ok: new files. * whiny.awk, whiny.ok: new files. diff --git a/test/Makefile.am b/test/Makefile.am index 0a4b68e3d..db23d1f0e 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,7 +1,7 @@ # # test/Makefile.am --- automake input file for gawk # -# Copyright (C) 1988-2003 the Free Software Foundation, Inc. +# Copyright (C) 1988-2004 the Free Software Foundation, Inc. # # This file is part of GAWK, the GNU implementation of the # AWK Programming Language. @@ -95,6 +95,9 @@ EXTRA_DIST = \ backgsub.awk \ backgsub.in \ backgsub.ok \ + backw.awk \ + backw.in \ + backw.ok \ badargs.ok \ childin.awk \ childin.in \ @@ -114,6 +117,10 @@ EXTRA_DIST = \ concat1.awk \ concat1.in \ concat1.ok \ + concat2.awk \ + concat2.ok \ + concat3.awk \ + concat3.ok \ convfmt.awk \ convfmt.ok \ datanonl.awk \ @@ -125,10 +132,14 @@ EXTRA_DIST = \ delarprm.ok \ delarpm2.awk \ delarpm2.ok \ + delfunc.awk \ + delfunc.ok \ dynlj.awk \ dynlj.ok \ eofsplit.awk \ eofsplit.ok \ + exitval1.awk \ + exitval1.ok \ fflush.ok \ fflush.sh \ fieldwdth.awk \ @@ -160,6 +171,8 @@ EXTRA_DIST = \ fnmisc.ok \ fnparydl.awk \ fnparydl.ok \ + fordel.awk \ + fordel.ok \ forsimp.awk \ forsimp.ok \ fsbs.awk \ @@ -237,6 +250,8 @@ EXTRA_DIST = \ ignrcase.awk \ ignrcase.in \ ignrcase.ok \ + ignrcas2.awk \ + ignrcas2.ok \ inftest.awk \ inftest.ok \ inputred.awk \ @@ -260,6 +275,9 @@ EXTRA_DIST = \ longwrds.awk \ longwrds.ok \ longwrds.in \ + manglprm.awk \ + manglprm.in \ + manglprm.ok \ manyfiles.awk \ manyfiles.ok \ match1.awk \ @@ -380,6 +398,8 @@ EXTRA_DIST = \ printf0.ok \ printf1.awk \ printf1.ok \ + printfbad1.awk \ + printfbad1.ok \ printfloat.awk \ printlang.awk \ prmarscl.awk \ @@ -442,6 +462,9 @@ EXTRA_DIST = \ rstest4.ok \ rstest5.awk \ rstest5.ok \ + rstest6.awk \ + rstest6.in \ + rstest6.ok \ rswhite.awk \ rswhite.in \ rswhite.ok \ @@ -473,6 +496,8 @@ EXTRA_DIST = \ sprintfc.awk \ sprintfc.in \ sprintfc.ok \ + strcat1.awk \ + strcat1.ok \ strtod.awk \ strtod.in \ strtod.ok \ @@ -481,6 +506,11 @@ EXTRA_DIST = \ strftime.awk \ strftlng.awk \ strftlng.ok \ + subamp.awk \ + subamp.in \ + subamp.ok \ + subsepnm.awk \ + subsepnm.ok \ subslash.awk \ subslash.ok \ substr.awk \ @@ -505,6 +535,8 @@ EXTRA_DIST = \ uninit4.ok \ uninitialized.awk \ uninitialized.ok \ + unterm.awk \ + unterm.ok \ whiny.awk \ whiny.in \ whiny.ok \ @@ -513,18 +545,21 @@ EXTRA_DIST = \ zeroflag.awk \ zeroflag.ok +# Get rid of core files when cleaning +CLEANFILES = core core.* + # try to keep these sorted BASIC_TESTS = addcomma anchgsub argarray arrayparm arrayref arrymem1 \ arrayprm2 arrayprm3 arryref2 arryref3 arryref4 arryref5 arynasty \ arynocls aryprm1 aryprm2 aryprm3 aryprm4 aryprm5 aryprm6 aryprm7 \ aryprm8 arysubnm asgext awkpath back89 backgsub childin clobber \ - clsflnam compare compare2 concat1 convfmt datanonl defref \ - delarprm delarpm2 dynlj eofsplit fldchg fldchgnf fmttest fnamedat \ + clsflnam compare compare2 concat1 concat2 concat3 convfmt datanonl defref \ + delarprm delarpm2 delfunc dynlj eofsplit exitval1 fldchg fldchgnf fmttest fnamedat \ fnarray fnarray2 fnarydel fnaryscl fnasgnm fnmisc fnparydl \ - forsimp fsbs fsrs fstabplus funsemnl funsmnam funstack getline \ + fordel forsimp fsbs fsrs fstabplus funsemnl funsmnam funstack getline \ getline2 getline3 getlnbuf getnr2tb getnr2tm gsubasgn gsubtest \ gsubtst2 gsubtst3 gsubtst4 gsubtst5 hsprint inputred intest \ - intprec leaddig leadnl litoct longsub longwrds math membug1 \ + intprec leaddig leadnl litoct longsub longwrds manglprm math membug1 \ messages minusstr mmap8k nasty nasty2 negexp nested nfldstr \ nfneg nfset nlfldsep nlinstr nlstrina noeffect nofmtch noloop1 \ noloop2 nonl noparms nors nulrsend numindex numsubstr octsub ofmt \ @@ -534,15 +569,15 @@ BASIC_TESTS = addcomma anchgsub argarray arrayparm arrayref arrymem1 \ reindops reparse resplit rs rsnul1nl rsnulbig rsnulbig2 rstest1 \ rstest2 rstest3 rstest4 rstest5 rswhite scalar sclforin sclifin \ sortempty splitargv splitarr splitdef splitvar splitwht sprintfc \ - strtod subslash substr swaplns synerr1 tradanch tweakfld uninit2 \ - uninit3 uninit4 uninitialized zeroe0 zeroflag + strcat1 strtod subamp subsepnm subslash substr swaplns synerr1 tradanch \ + tweakfld uninit2 uninit3 uninit4 uninitialized unterm zeroe0 zeroflag UNIX_TESTS = fflush getlnhd pid pipeio1 pipeio2 poundbang space strftlng -GAWK_EXT_TESTS = argtest asort asorti badargs clos1way fieldwdth fsfwfs \ - gensub gnuops2 gnureops icasefs icasers igncdym igncfs ignrcase lint \ - match1 match2 manyfiles nondec posix procinfs regx8bit rebuf reint \ - shadow sort1 strtonum strftime whiny +GAWK_EXT_TESTS = argtest asort asorti backw badargs clos1way fieldwdth fsfwfs \ + gensub gnuops2 gnureops icasefs icasers igncdym igncfs ignrcase \ + ignrcas2 lint match1 match2 manyfiles nondec posix procinfs \ + printfbad1 regx8bit rebuf reint rstest6 shadow sort1 strtonum strftime whiny EXTRA_TESTS = regtest inftest @@ -559,6 +594,9 @@ AWKPROG = ../gawk$(EXEEXT) # This business forces the locale to be C for running the tests, # unless we override it to something else for testing. +# +# This can also be done in individual tests where we wish to +# check things specifically not in the C locale. AWK = LC_ALL=$${GAWKLOCALE:-C} LANG=$${GAWKLOCALE:-C} $(AWKPROG) # Message stuff is to make it a little easier to follow. @@ -701,9 +739,9 @@ strftime:: @echo This test could fail on slow machines or on a minute boundary, @echo so if it does, double check the actual results: @echo $@ - @LC_ALL=C; export LC_ALL; LANG=C; export LANG; \ + @GAWK_LOCALE=C; export GAWK_LOCALE; \ TZ=GMT0; export TZ; \ - date | $(AWK) -v OUTPUT=_$@ -f $(srcdir)/strftime.awk + (LC_ALL=C date) | $(AWK) -v OUTPUT=_$@ -f $(srcdir)/strftime.awk @-$(CMP) strftime.ok _$@ && rm -f _$@ strftime.ok || exit 0 litoct:: @@ -742,7 +780,7 @@ pid:: strftlng:: @echo $@ @TZ=UTC; export TZ; $(AWK) -f $(srcdir)/strftlng.awk >_$@ - @if $(CMP) -s $(srcdir)/strftlng.ok _$@ ; then : ; else \ + @if $(CMP) $(srcdir)/strftlng.ok _$@ >/dev/null 2>&1 ; then : ; else \ TZ=UTC0; export TZ; $(AWK) -f $(srcdir)/strftlng.awk >_$@ ; \ fi @-$(CMP) $(srcdir)/strftlng.ok _$@ && rm -f _$@ @@ -854,6 +892,25 @@ whiny:: @WHINY_USERS=1 $(AWK) -f $(srcdir)/$@.awk $(srcdir)/$@.in >_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +ignrcas2:: + @echo $@ + @GAWK_LOCALE=en_US ; export GAWK_LOCALE ; \ + $(AWK) -f $(srcdir)/$@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >> _$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +subamp:: + @echo $@ + @GAWK_LOCALE=en_US.UTF-8 ; export GAWK_LOCALE ; \ + $(AWK) -f $(srcdir)/$@.awk $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >> _$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +# This test makes sure gawk exits with a zero code. +# Thus, unconditionally generate the exit code. +exitval1:: + @echo $@ + @$(AWK) -f $(srcdir)/exitval1.awk >_$@ 2>&1; echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + # Targets generated for other tests: include Maketests @@ -876,7 +933,7 @@ diffout: for i in _* ; \ do \ echo ============== $$i ============= ; \ - diff -c $${i#_}.ok $$i ; \ + diff -c $(srcdir)/$${i#_}.ok $$i ; \ done | more # This target is for testing with electric fence. diff --git a/test/Makefile.in b/test/Makefile.in index 0c9185246..5619fdc9a 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.7.5 from Makefile.am. +# Makefile.in generated by automake 1.8.5 from Makefile.am. # @configure_input@ -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 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. @@ -17,7 +17,7 @@ # # test/Makefile.am --- automake input file for gawk # -# Copyright (C) 1988-2003 the Free Software Foundation, Inc. +# Copyright (C) 1988-2004 the Free Software Foundation, Inc. # # This file is part of GAWK, the GNU implementation of the # AWK Programming Language. @@ -36,7 +36,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA # - srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ @@ -44,7 +43,6 @@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. - am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 @@ -59,6 +57,35 @@ NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : host_triplet = @host@ +DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/Maketests ChangeLog +subdir = test +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/arch.m4 \ + $(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/iconv.m4 \ + $(top_srcdir)/m4/intdiv0.m4 $(top_srcdir)/m4/intmax.m4 \ + $(top_srcdir)/m4/intmax_t.m4 $(top_srcdir)/m4/inttypes-pri.m4 \ + $(top_srcdir)/m4/inttypes.m4 $(top_srcdir)/m4/inttypes_h.m4 \ + $(top_srcdir)/m4/lcmessage.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/longdouble.m4 $(top_srcdir)/m4/longlong.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/printf-posix.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/m4/signed.m4 $(top_srcdir)/m4/size_max.m4 \ + $(top_srcdir)/m4/socket.m4 $(top_srcdir)/m4/stdint_h.m4 \ + $(top_srcdir)/m4/strtod.m4 $(top_srcdir)/m4/uintmax_t.m4 \ + $(top_srcdir)/m4/ulonglong.m4 $(top_srcdir)/m4/wchar_t.m4 \ + $(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/m4/xsize.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMDEP_FALSE = @AMDEP_FALSE@ @@ -70,6 +97,9 @@ AUTOMAKE = @AUTOMAKE@ # This business forces the locale to be C for running the tests, # unless we override it to something else for testing. +# +# This can also be done in individual tests where we wish to +# check things specifically not in the C locale. AWK = LC_ALL=$${GAWKLOCALE:-C} LANG=$${GAWKLOCALE:-C} $(AWKPROG) BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@ CATOBJEXT = @CATOBJEXT@ @@ -90,6 +120,10 @@ EXEEXT = @EXEEXT@ GENCAT = @GENCAT@ GLIBC21 = @GLIBC21@ GMSGFMT = @GMSGFMT@ +HAVE_ASPRINTF = @HAVE_ASPRINTF@ +HAVE_POSIX_PRINTF = @HAVE_POSIX_PRINTF@ +HAVE_SNPRINTF = @HAVE_SNPRINTF@ +HAVE_WPRINTF = @HAVE_WPRINTF@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -160,6 +194,7 @@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ +mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ @@ -167,7 +202,6 @@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ - EXTRA_DIST = \ reg \ lib \ @@ -240,6 +274,9 @@ EXTRA_DIST = \ backgsub.awk \ backgsub.in \ backgsub.ok \ + backw.awk \ + backw.in \ + backw.ok \ badargs.ok \ childin.awk \ childin.in \ @@ -259,6 +296,10 @@ EXTRA_DIST = \ concat1.awk \ concat1.in \ concat1.ok \ + concat2.awk \ + concat2.ok \ + concat3.awk \ + concat3.ok \ convfmt.awk \ convfmt.ok \ datanonl.awk \ @@ -270,10 +311,14 @@ EXTRA_DIST = \ delarprm.ok \ delarpm2.awk \ delarpm2.ok \ + delfunc.awk \ + delfunc.ok \ dynlj.awk \ dynlj.ok \ eofsplit.awk \ eofsplit.ok \ + exitval1.awk \ + exitval1.ok \ fflush.ok \ fflush.sh \ fieldwdth.awk \ @@ -305,6 +350,8 @@ EXTRA_DIST = \ fnmisc.ok \ fnparydl.awk \ fnparydl.ok \ + fordel.awk \ + fordel.ok \ forsimp.awk \ forsimp.ok \ fsbs.awk \ @@ -382,6 +429,8 @@ EXTRA_DIST = \ ignrcase.awk \ ignrcase.in \ ignrcase.ok \ + ignrcas2.awk \ + ignrcas2.ok \ inftest.awk \ inftest.ok \ inputred.awk \ @@ -405,6 +454,9 @@ EXTRA_DIST = \ longwrds.awk \ longwrds.ok \ longwrds.in \ + manglprm.awk \ + manglprm.in \ + manglprm.ok \ manyfiles.awk \ manyfiles.ok \ match1.awk \ @@ -525,6 +577,8 @@ EXTRA_DIST = \ printf0.ok \ printf1.awk \ printf1.ok \ + printfbad1.awk \ + printfbad1.ok \ printfloat.awk \ printlang.awk \ prmarscl.awk \ @@ -587,6 +641,9 @@ EXTRA_DIST = \ rstest4.ok \ rstest5.awk \ rstest5.ok \ + rstest6.awk \ + rstest6.in \ + rstest6.ok \ rswhite.awk \ rswhite.in \ rswhite.ok \ @@ -618,6 +675,8 @@ EXTRA_DIST = \ sprintfc.awk \ sprintfc.in \ sprintfc.ok \ + strcat1.awk \ + strcat1.ok \ strtod.awk \ strtod.in \ strtod.ok \ @@ -626,6 +685,11 @@ EXTRA_DIST = \ strftime.awk \ strftlng.awk \ strftlng.ok \ + subamp.awk \ + subamp.in \ + subamp.ok \ + subsepnm.awk \ + subsepnm.ok \ subslash.awk \ subslash.ok \ substr.awk \ @@ -650,6 +714,8 @@ EXTRA_DIST = \ uninit4.ok \ uninitialized.awk \ uninitialized.ok \ + unterm.awk \ + unterm.ok \ whiny.awk \ whiny.in \ whiny.ok \ @@ -659,18 +725,21 @@ EXTRA_DIST = \ zeroflag.ok +# Get rid of core files when cleaning +CLEANFILES = core core.* + # try to keep these sorted BASIC_TESTS = addcomma anchgsub argarray arrayparm arrayref arrymem1 \ arrayprm2 arrayprm3 arryref2 arryref3 arryref4 arryref5 arynasty \ arynocls aryprm1 aryprm2 aryprm3 aryprm4 aryprm5 aryprm6 aryprm7 \ aryprm8 arysubnm asgext awkpath back89 backgsub childin clobber \ - clsflnam compare compare2 concat1 convfmt datanonl defref \ - delarprm delarpm2 dynlj eofsplit fldchg fldchgnf fmttest fnamedat \ + clsflnam compare compare2 concat1 concat2 concat3 convfmt datanonl defref \ + delarprm delarpm2 delfunc dynlj eofsplit exitval1 fldchg fldchgnf fmttest fnamedat \ fnarray fnarray2 fnarydel fnaryscl fnasgnm fnmisc fnparydl \ - forsimp fsbs fsrs fstabplus funsemnl funsmnam funstack getline \ + fordel forsimp fsbs fsrs fstabplus funsemnl funsmnam funstack getline \ getline2 getline3 getlnbuf getnr2tb getnr2tm gsubasgn gsubtest \ gsubtst2 gsubtst3 gsubtst4 gsubtst5 hsprint inputred intest \ - intprec leaddig leadnl litoct longsub longwrds math membug1 \ + intprec leaddig leadnl litoct longsub longwrds manglprm math membug1 \ messages minusstr mmap8k nasty nasty2 negexp nested nfldstr \ nfneg nfset nlfldsep nlinstr nlstrina noeffect nofmtch noloop1 \ noloop2 nonl noparms nors nulrsend numindex numsubstr octsub ofmt \ @@ -680,20 +749,16 @@ BASIC_TESTS = addcomma anchgsub argarray arrayparm arrayref arrymem1 \ reindops reparse resplit rs rsnul1nl rsnulbig rsnulbig2 rstest1 \ rstest2 rstest3 rstest4 rstest5 rswhite scalar sclforin sclifin \ sortempty splitargv splitarr splitdef splitvar splitwht sprintfc \ - strtod subslash substr swaplns synerr1 tradanch tweakfld uninit2 \ - uninit3 uninit4 uninitialized zeroe0 zeroflag - + strcat1 strtod subamp subsepnm subslash substr swaplns synerr1 tradanch \ + tweakfld uninit2 uninit3 uninit4 uninitialized unterm zeroe0 zeroflag UNIX_TESTS = fflush getlnhd pid pipeio1 pipeio2 poundbang space strftlng - -GAWK_EXT_TESTS = argtest asort asorti badargs clos1way fieldwdth fsfwfs \ - gensub gnuops2 gnureops icasefs icasers igncdym igncfs ignrcase lint \ - match1 match2 manyfiles nondec posix procinfs regx8bit rebuf reint \ - shadow sort1 strtonum strftime whiny - +GAWK_EXT_TESTS = argtest asort asorti backw badargs clos1way fieldwdth fsfwfs \ + gensub gnuops2 gnureops icasefs icasers igncdym igncfs ignrcase \ + ignrcas2 lint match1 match2 manyfiles nondec posix procinfs \ + printfbad1 regx8bit rebuf reint rstest6 shadow sort1 strtonum strftime whiny EXTRA_TESTS = regtest inftest - INET_TESTS = inetechu inetecht inetdayu inetdayt # List of the tests which should be run with --lint option: @@ -701,25 +766,40 @@ NEED_LINT = defref noeffect nofmtch shadow uninit2 uninit3 uninit4 uninitialized # List of the files that appear in manual tests or are for reserve testing: GENTESTS_UNUSED = Makefile.in gtlnbufv.awk printfloat.awk switch2.awk - CMP = cmp AWKPROG = ../gawk$(EXEEXT) -subdir = test -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -DIST_SOURCES = -DIST_COMMON = README $(srcdir)/Maketests ChangeLog Makefile.am \ - Makefile.in all: all-am .SUFFIXES: -$(srcdir)/Makefile.in: Makefile.am $(srcdir)/Maketests $(top_srcdir)/configure.ac $(ACLOCAL_M4) +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(srcdir)/Maketests $(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 test/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu test/Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) +.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 uninstall-info-am: tags: TAGS TAGS: @@ -727,10 +807,6 @@ TAGS: ctags: CTAGS CTAGS: -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = .. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ @@ -744,7 +820,7 @@ distdir: $(DISTFILES) dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ @@ -762,7 +838,6 @@ distdir: $(DISTFILES) check-am: all-am check: check-am all-am: Makefile - installdirs: install: install-am install-exec: install-exec-am @@ -775,31 +850,32 @@ install-am: all-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - INSTALL_STRIP_FLAG=-s \ + 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: - -rm -f Makefile $(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: @@ -815,7 +891,7 @@ install-man: installcheck-am: maintainer-clean: maintainer-clean-am - + -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am @@ -833,8 +909,8 @@ ps-am: uninstall-am: uninstall-info-am .PHONY: all all-am check check-am clean clean-generic distclean \ - distclean-generic distdir dvi dvi-am info info-am install \ - install-am install-data install-data-am install-exec \ + distclean-generic distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-exec \ install-exec-am install-info install-info-am install-man \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ @@ -981,9 +1057,9 @@ strftime:: @echo This test could fail on slow machines or on a minute boundary, @echo so if it does, double check the actual results: @echo $@ - @LC_ALL=C; export LC_ALL; LANG=C; export LANG; \ + @GAWK_LOCALE=C; export GAWK_LOCALE; \ TZ=GMT0; export TZ; \ - date | $(AWK) -v OUTPUT=_$@ -f $(srcdir)/strftime.awk + (LC_ALL=C date) | $(AWK) -v OUTPUT=_$@ -f $(srcdir)/strftime.awk @-$(CMP) strftime.ok _$@ && rm -f _$@ strftime.ok || exit 0 litoct:: @@ -1022,7 +1098,7 @@ pid:: strftlng:: @echo $@ @TZ=UTC; export TZ; $(AWK) -f $(srcdir)/strftlng.awk >_$@ - @if $(CMP) -s $(srcdir)/strftlng.ok _$@ ; then : ; else \ + @if $(CMP) $(srcdir)/strftlng.ok _$@ >/dev/null 2>&1 ; then : ; else \ TZ=UTC0; export TZ; $(AWK) -f $(srcdir)/strftlng.awk >_$@ ; \ fi @-$(CMP) $(srcdir)/strftlng.ok _$@ && rm -f _$@ @@ -1133,6 +1209,25 @@ whiny:: @echo $@ @WHINY_USERS=1 $(AWK) -f $(srcdir)/$@.awk $(srcdir)/$@.in >_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +ignrcas2:: + @echo $@ + @GAWK_LOCALE=en_US ; export GAWK_LOCALE ; \ + $(AWK) -f $(srcdir)/$@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >> _$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +subamp:: + @echo $@ + @GAWK_LOCALE=en_US.UTF-8 ; export GAWK_LOCALE ; \ + $(AWK) -f $(srcdir)/$@.awk $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >> _$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +# This test makes sure gawk exits with a zero code. +# Thus, unconditionally generate the exit code. +exitval1:: + @echo $@ + @$(AWK) -f $(srcdir)/exitval1.awk >_$@ 2>&1; echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ Gt-dummy: # file Maketests, generated from Makefile.am by the Gentests program addcomma: @@ -1275,6 +1370,16 @@ concat1: @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +concat2: + @echo concat2 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +concat3: + @echo concat3 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + convfmt: @echo convfmt @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -1300,6 +1405,11 @@ delarpm2: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +delfunc: + @echo delfunc + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + dynlj: @echo dynlj @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -1365,6 +1475,11 @@ fnparydl: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +fordel: + @echo fordel + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + forsimp: @echo forsimp @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -1480,6 +1595,11 @@ longwrds: @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +manglprm: + @echo manglprm + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + math: @echo math @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -1810,11 +1930,21 @@ sprintfc: @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +strcat1: + @echo strcat1 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + strtod: @echo strtod @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +subsepnm: + @echo subsepnm + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + subslash: @echo subslash @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -1855,6 +1985,11 @@ uninitialized: @AWKPATH=$(srcdir) $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +unterm: + @echo unterm + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + zeroe0: @echo zeroe0 @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -1880,6 +2015,11 @@ asorti: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +backw: + @echo backw + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + clos1way: @echo clos1way @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -1965,6 +2105,11 @@ procinfs: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +printfbad1: + @echo printfbad1 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + regx8bit: @echo regx8bit @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -1975,6 +2120,11 @@ rebuf: @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +rstest6: + @echo rstest6 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + shadow: @echo shadow @AWKPATH=$(srcdir) $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -2013,7 +2163,7 @@ diffout: for i in _* ; \ do \ echo ============== $$i ============= ; \ - diff -c $${i#_}.ok $$i ; \ + diff -c $(srcdir)/$${i#_}.ok $$i ; \ done | more # This target is for testing with electric fence. diff --git a/test/Maketests b/test/Maketests index 27108d6da..2a0100b02 100644 --- a/test/Maketests +++ b/test/Maketests @@ -140,6 +140,16 @@ concat1: @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +concat2: + @echo concat2 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +concat3: + @echo concat3 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + convfmt: @echo convfmt @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -165,6 +175,11 @@ delarpm2: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +delfunc: + @echo delfunc + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + dynlj: @echo dynlj @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -230,6 +245,11 @@ fnparydl: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +fordel: + @echo fordel + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + forsimp: @echo forsimp @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -345,6 +365,11 @@ longwrds: @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +manglprm: + @echo manglprm + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + math: @echo math @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -675,11 +700,21 @@ sprintfc: @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +strcat1: + @echo strcat1 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + strtod: @echo strtod @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +subsepnm: + @echo subsepnm + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + subslash: @echo subslash @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -720,6 +755,11 @@ uninitialized: @AWKPATH=$(srcdir) $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +unterm: + @echo unterm + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + zeroe0: @echo zeroe0 @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -745,6 +785,11 @@ asorti: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +backw: + @echo backw + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + clos1way: @echo clos1way @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -830,6 +875,11 @@ procinfs: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +printfbad1: + @echo printfbad1 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + regx8bit: @echo regx8bit @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -840,6 +890,11 @@ rebuf: @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +rstest6: + @echo rstest6 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + shadow: @echo shadow @AWKPATH=$(srcdir) $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/backw.awk b/test/backw.awk new file mode 100644 index 000000000..078a5d895 --- /dev/null +++ b/test/backw.awk @@ -0,0 +1 @@ +/\w+/ diff --git a/test/backw.in b/test/backw.in new file mode 100644 index 000000000..ec09f608b --- /dev/null +++ b/test/backw.in @@ -0,0 +1,3 @@ +123 +abc +456 diff --git a/test/backw.ok b/test/backw.ok new file mode 100644 index 000000000..ec09f608b --- /dev/null +++ b/test/backw.ok @@ -0,0 +1,3 @@ +123 +abc +456 diff --git a/test/concat2.awk b/test/concat2.awk new file mode 100644 index 000000000..a94b29b58 --- /dev/null +++ b/test/concat2.awk @@ -0,0 +1,8 @@ +function f(s, x) { + x = 1 + s = 3 + s = s x + print s +} + +BEGIN { for (i = 1; i <=12; i++) f() } diff --git a/test/concat2.ok b/test/concat2.ok new file mode 100644 index 000000000..b7b86e5c6 --- /dev/null +++ b/test/concat2.ok @@ -0,0 +1,12 @@ +31 +31 +31 +31 +31 +31 +31 +31 +31 +31 +31 +31 diff --git a/test/concat3.awk b/test/concat3.awk new file mode 100644 index 000000000..554c9a904 --- /dev/null +++ b/test/concat3.awk @@ -0,0 +1 @@ +BEGIN { a; a = a (b "c"); print a; print b } diff --git a/test/concat3.ok b/test/concat3.ok new file mode 100644 index 000000000..880233128 --- /dev/null +++ b/test/concat3.ok @@ -0,0 +1,2 @@ +c + diff --git a/test/delfunc.awk b/test/delfunc.awk new file mode 100644 index 000000000..365a76ba9 --- /dev/null +++ b/test/delfunc.awk @@ -0,0 +1,7 @@ +# from Stepan Kasal, 9 July 2003 +function f() +{ + delete f +} + +BEGIN { f() } diff --git a/test/delfunc.ok b/test/delfunc.ok new file mode 100644 index 000000000..d12f0bc93 --- /dev/null +++ b/test/delfunc.ok @@ -0,0 +1,2 @@ +gawk: delfunc.awk:4: fatal: attempt to use function `f' as an array +EXIT CODE: 2 diff --git a/test/exitval1.awk b/test/exitval1.awk new file mode 100644 index 000000000..550200d2c --- /dev/null +++ b/test/exitval1.awk @@ -0,0 +1,3 @@ +# This should exit 0, even though child exits 1 +BEGIN { "exit 1" | getline junk ; exit 12 } +END { exit 0 } diff --git a/test/exitval1.ok b/test/exitval1.ok new file mode 100644 index 000000000..eca5994be --- /dev/null +++ b/test/exitval1.ok @@ -0,0 +1 @@ +EXIT CODE: 0 diff --git a/test/fordel.awk b/test/fordel.awk new file mode 100644 index 000000000..58ede20fb --- /dev/null +++ b/test/fordel.awk @@ -0,0 +1,65 @@ +#Date: Mon, 7 Jun 2004 10:40:28 -0500 +#From: mary1john8@earthlink.net +#To: arnold@skeeve.com +#Subject: gawk internal errors +#Message-ID: <20040607154028.GA2457@apollo> +# +#Hello, +# +# gawk-3.1.3i internal errors: +# +#[1] +# +#$> ./gawk 'BEGIN { for (i in a) delete a; }' +BEGIN { for (i in a) delete a; } +#gawk: fatal error: internal error +#Aborted +# +#------------------------------------------------------------------ +#--- awkgram.y.orig 2004-06-07 09:42:14.000000000 -0500 +#+++ awkgram.y 2004-06-07 09:45:58.000000000 -0500 +#@@ -387,7 +387,7 @@ +# * Check that the body is a `delete a[i]' statement, +# * and that both the loop var and array names match. +# */ +#- if ($8 != NULL && $8->type == Node_K_delete) { +#+ if ($8 != NULL && $8->type == Node_K_delete && $8->rnode != NULL) { +# NODE *arr, *sub; +# +# assert($8->rnode->type == Node_expression_list); +#------------------------------------------------------------------ +# +# +#[2] +# +#$> ./gawk 'BEGIN { printf("%3$*10$.*1$s\n", 20, 10, "hello"); }' +#gawk: fatal error: internal error +#Aborted +# +#------------------------------------------------------------------ +#--- builtin.c.orig 2004-06-07 10:04:20.000000000 -0500 +#+++ builtin.c 2004-06-07 10:06:08.000000000 -0500 +#@@ -780,7 +780,10 @@ +# s1++; +# n0--; +# } +#- +#+ if (val >= num_args) { +#+ toofew = TRUE; +#+ break; +#+ } +# arg = the_args[val]; +# } else { +# parse_next_arg(); +#------------------------------------------------------------------ +# +# +# Finally, a test for the rewritten get_src_buf(): +# +#$> AWKBUFSIZE=2 make check +# +#I get 3 failed tests. Not sure this is of any interest. +# +# +#Thanks, +#John diff --git a/test/fordel.ok b/test/fordel.ok new file mode 100644 index 000000000..e69de29bb diff --git a/test/ignrcas2.awk b/test/ignrcas2.awk new file mode 100644 index 000000000..b7ef0cdf8 --- /dev/null +++ b/test/ignrcas2.awk @@ -0,0 +1,13 @@ +# Based on test program submitted by: +# Date: Sun, 7 Sep 2003 23:11:51 +0200 +# From: Michael Mauch +# To: bug-gawk@gnu.org +# Subject: Internal error in gawk-3.1.3 with character class + +BEGIN { + IGNORECASE = 1 + if ("a" ~ /[[:alnum:]]/) + print "OK" + else + print "NOT OK" +} diff --git a/test/ignrcas2.ok b/test/ignrcas2.ok new file mode 100644 index 000000000..d86bac9de --- /dev/null +++ b/test/ignrcas2.ok @@ -0,0 +1 @@ +OK diff --git a/test/inftest.awk b/test/inftest.awk index f24bd7e32..a8226178e 100644 --- a/test/inftest.awk +++ b/test/inftest.awk @@ -1,5 +1,8 @@ BEGIN { + k = 0 x = 100 - do { y = x ; x *= 1000; print x,y } while ( y < x ) + # Added k limit test after finding some systems that didn't terminate + # the loop correctly, sigh... + do { k++; y = x ; x *= 1000; print x,y } while ( y < x && k < 1700) print "loop terminated" } diff --git a/test/longwrds.awk b/test/longwrds.awk index d496ac793..d4b4d92db 100644 --- a/test/longwrds.awk +++ b/test/longwrds.awk @@ -1,4 +1,10 @@ # From Gawk Manual modified by bug fix and removal of punctuation + +# Invoker can customize sort command if necessary. +BEGIN { + if (!SORT) SORT = "LC_ALL=C sort" +} + # Record every word which is used at least once { for (i = 1; i <= NF; i++) { @@ -14,8 +20,8 @@ END { for (x in used) if (length(x) > 10) { ++num_long_words - print x | "LC_ALL=C sort" + print x | SORT } - print(num_long_words, "long words") | "LC_ALL=C sort" - close("LC_ALL=C sort") + print(num_long_words, "long words") | SORT + close(SORT) } diff --git a/test/manglprm.awk b/test/manglprm.awk new file mode 100644 index 000000000..3a4306ccb --- /dev/null +++ b/test/manglprm.awk @@ -0,0 +1,41 @@ +# From beebe@sunshine.math.utah.edu Thu Jul 10 00:36:16 2003 +# Date: Wed, 9 Jul 2003 06:42:54 -0600 (MDT) +# From: "Nelson H. F. Beebe" +# To: "Arnold Robbins" +# Cc: beebe@math.utah.edu +# X-US-Mail: "Center for Scientific Computing, Department of Mathematics, 110 +# LCB, University of Utah, 155 S 1400 E RM 233, Salt Lake City, UT +# 84112-0090, USA" +# X-Telephone: +1 801 581 5254 +# X-FAX: +1 801 585 1640, +1 801 581 4148 +# X-URL: http://www.math.utah.edu/~beebe +# Subject: gawk-3.1.3 (and earlier): reproducible core dump +# X-SpamBouncer: 1.4 (10/07/01) +# X-SBClass: OK +# +# I have a reproducible core dump in gawk-3.1.3, and recent gawk +# versions. +# +# Consider the following test program, reduced from a much larger one: +# +# % cat gawk-dump.awk + + { process($0) } + + function out_debug(s) + { + print s + } + + function process(s, n,parts) + { + out_debug("Buffer = [" protect(Buffer) "]") + Buffer = Buffer s + n = split(Buffer,parts,"\n") + } + + function protect(s) + { + gsub("\n", "\\n", s) + return (s) + } diff --git a/test/manglprm.in b/test/manglprm.in new file mode 100644 index 000000000..73709ba68 --- /dev/null +++ b/test/manglprm.in @@ -0,0 +1 @@ +Testing diff --git a/test/manglprm.ok b/test/manglprm.ok new file mode 100644 index 000000000..b13c4566f --- /dev/null +++ b/test/manglprm.ok @@ -0,0 +1 @@ +Buffer = [] diff --git a/test/printfbad1.awk b/test/printfbad1.awk new file mode 100644 index 000000000..1b478df99 --- /dev/null +++ b/test/printfbad1.awk @@ -0,0 +1,65 @@ +#Date: Mon, 7 Jun 2004 10:40:28 -0500 +#From: mary1john8@earthlink.net +#To: arnold@skeeve.com +#Subject: gawk internal errors +#Message-ID: <20040607154028.GA2457@apollo> +# +#Hello, +# +# gawk-3.1.3i internal errors: +# +#[1] +# +#$> ./gawk 'BEGIN { for (i in a) delete a; }' +#gawk: fatal error: internal error +#Aborted +# +#------------------------------------------------------------------ +#--- awkgram.y.orig 2004-06-07 09:42:14.000000000 -0500 +#+++ awkgram.y 2004-06-07 09:45:58.000000000 -0500 +#@@ -387,7 +387,7 @@ +# * Check that the body is a `delete a[i]' statement, +# * and that both the loop var and array names match. +# */ +#- if ($8 != NULL && $8->type == Node_K_delete) { +#+ if ($8 != NULL && $8->type == Node_K_delete && $8->rnode != NULL) { +# NODE *arr, *sub; +# +# assert($8->rnode->type == Node_expression_list); +#------------------------------------------------------------------ +# +# +#[2] +# +#$> ./gawk 'BEGIN { printf("%3$*10$.*1$s\n", 20, 10, "hello"); }' +BEGIN { printf("%3$*10$.*1$s\n", 20, 10, "hello"); } +#gawk: fatal error: internal error +#Aborted +# +#------------------------------------------------------------------ +#--- builtin.c.orig 2004-06-07 10:04:20.000000000 -0500 +#+++ builtin.c 2004-06-07 10:06:08.000000000 -0500 +#@@ -780,7 +780,10 @@ +# s1++; +# n0--; +# } +#- +#+ if (val >= num_args) { +#+ toofew = TRUE; +#+ break; +#+ } +# arg = the_args[val]; +# } else { +# parse_next_arg(); +#------------------------------------------------------------------ +# +# +# Finally, a test for the rewritten get_src_buf(): +# +#$> AWKBUFSIZE=2 make check +# +#I get 3 failed tests. Not sure this is of any interest. +# +# +#Thanks, +#John diff --git a/test/printfbad1.ok b/test/printfbad1.ok new file mode 100644 index 000000000..d02140a68 --- /dev/null +++ b/test/printfbad1.ok @@ -0,0 +1,5 @@ +gawk: printfbad1.awk:35: fatal: not enough arguments to satisfy format string + `%3$*10$.*1$s +' + ^ ran out for this one +EXIT CODE: 2 diff --git a/test/rstest6.awk b/test/rstest6.awk new file mode 100644 index 000000000..3481c0a3f --- /dev/null +++ b/test/rstest6.awk @@ -0,0 +1,6 @@ +# Wed Jul 14 16:02:45 IDT 2004 +# Test case from John Haque mary1john8@earthlink.net + +BEGIN { RS = "XYZ" } + +{ print } diff --git a/test/rstest6.in b/test/rstest6.in new file mode 100644 index 000000000..a6bddc4a1 --- /dev/null +++ b/test/rstest6.in @@ -0,0 +1 @@ +ABCD \ No newline at end of file diff --git a/test/rstest6.ok b/test/rstest6.ok new file mode 100644 index 000000000..9ed461429 --- /dev/null +++ b/test/rstest6.ok @@ -0,0 +1 @@ +ABCD diff --git a/test/strcat1.awk b/test/strcat1.awk new file mode 100644 index 000000000..0d28017cb --- /dev/null +++ b/test/strcat1.awk @@ -0,0 +1,6 @@ + +function f1(b) { b = b "c"; print f(b); } + +function f(a) { a = a "b"; return a; } + +BEGIN { A = "a"; f1(A); } diff --git a/test/strcat1.ok b/test/strcat1.ok new file mode 100644 index 000000000..66a2f4b49 --- /dev/null +++ b/test/strcat1.ok @@ -0,0 +1 @@ +acb diff --git a/test/subamp.awk b/test/subamp.awk new file mode 100644 index 000000000..2638e6ead --- /dev/null +++ b/test/subamp.awk @@ -0,0 +1 @@ +{ sub(/[a-z]/, "&") ; print } diff --git a/test/subamp.in b/test/subamp.in new file mode 100644 index 000000000..72943a16f --- /dev/null +++ b/test/subamp.in @@ -0,0 +1 @@ +aaa diff --git a/test/subamp.ok b/test/subamp.ok new file mode 100644 index 000000000..72943a16f --- /dev/null +++ b/test/subamp.ok @@ -0,0 +1 @@ +aaa diff --git a/test/subsepnm.awk b/test/subsepnm.awk new file mode 100644 index 000000000..976eef96e --- /dev/null +++ b/test/subsepnm.awk @@ -0,0 +1 @@ +BEGIN { SUBSEP = 10; a[1, 1] = 100 ; print a[1 SUBSEP 1] } diff --git a/test/subsepnm.ok b/test/subsepnm.ok new file mode 100644 index 000000000..29d6383b5 --- /dev/null +++ b/test/subsepnm.ok @@ -0,0 +1 @@ +100 diff --git a/test/unterm.awk b/test/unterm.awk new file mode 100644 index 000000000..c420c47b3 --- /dev/null +++ b/test/unterm.awk @@ -0,0 +1 @@ +BEGIN{x=".........................................................................................................................................................................................................................................................} \ No newline at end of file diff --git a/test/unterm.ok b/test/unterm.ok new file mode 100644 index 000000000..a8e7e598c --- /dev/null +++ b/test/unterm.ok @@ -0,0 +1,3 @@ +gawk: unterm.awk:1: BEGIN{x=".........................................................................................................................................................................................................................................................} +gawk: unterm.awk:1: ^ unterminated string +EXIT CODE: 1 diff --git a/unsupported/atari/ChangeLog b/unsupported/atari/ChangeLog index 7717bd3ab..c6a9e11e9 100644 --- a/unsupported/atari/ChangeLog +++ b/unsupported/atari/ChangeLog @@ -1,3 +1,7 @@ +Mon Aug 2 12:18:15 2004 Arnold D. Robbins + + * Release 3.1.4: Release tar file made. + Mon Jul 7 11:01:43 2003 Arnold D. Robbins * Release 3.1.3: Release tar file made. diff --git a/unsupported/tandem/ChangeLog b/unsupported/tandem/ChangeLog index 6a9cdeb43..ea426f252 100644 --- a/unsupported/tandem/ChangeLog +++ b/unsupported/tandem/ChangeLog @@ -1,3 +1,7 @@ +Mon Aug 2 12:18:15 2004 Arnold D. Robbins + + * Release 3.1.4: Release tar file made. + Mon Jul 7 11:01:43 2003 Arnold D. Robbins * Release 3.1.3: Release tar file made. diff --git a/unsupported/tandem/ptchlvl.h b/unsupported/tandem/ptchlvl.h deleted file mode 100644 index 026f4a727..000000000 --- a/unsupported/tandem/ptchlvl.h +++ /dev/null @@ -1 +0,0 @@ -#define PATCHLEVEL 0 diff --git a/version.c b/version.c index ded3f0cdf..bbc93d602 100644 --- a/version.c +++ b/version.c @@ -1,7 +1,6 @@ -#if ! defined(__STDC__) || __STDC__ < 1 -#define const -#endif -const char *version_string = "@(#)GNU Awk 3.1"; +#include "config.h" + +const char *version_string = "@(#)GNU Awk 3.1.4"; /* 1.02 fixed /= += *= etc to return the new Left Hand Side instead of the Right Hand Side */ diff --git a/version.in b/version.in index 4c77ba64d..63074d7fa 100644 --- a/version.in +++ b/version.in @@ -1,7 +1,6 @@ -#if ! defined(__STDC__) || __STDC__ < 1 -#define const -#endif -const char *version_string = "@(#)GNU Awk X.Y"; +#include "config.h" + +const char *version_string = "@(#)GNU Awk @VERSION@"; /* 1.02 fixed /= += *= etc to return the new Left Hand Side instead of the Right Hand Side */ diff --git a/vms/ChangeLog b/vms/ChangeLog index d16e219b2..4c8368750 100644 --- a/vms/ChangeLog +++ b/vms/ChangeLog @@ -1,3 +1,16 @@ +Mon Aug 2 12:18:15 2004 Arnold D. Robbins + + * Release 3.1.4: Release tar file made. + +Mon Jun 14 18:40:22 2004 Pat Rankin + + * descrip.mms (dfa.c, dfa.h): reinstate these. + (gettext.h, mbsupport.h): add these. + (patchlev.h): remove this. + + * vmstest.com (longwrds): customize it. + (getline, getline2): replace getline with getline2. + Mon Jul 7 11:01:43 2003 Arnold D. Robbins * Release 3.1.3: Release tar file made. diff --git a/vms/descrip.mms b/vms/descrip.mms index 30ad5074c..9c3b2efdc 100644 --- a/vms/descrip.mms +++ b/vms/descrip.mms @@ -88,7 +88,7 @@ ECHO = write sys$output NOOP = continue # object files -AWKOBJ1 = array.obj,awkgram.obj,builtin.obj,ext.obj,\ +AWKOBJ1 = array.obj,awkgram.obj,builtin.obj,dfa.obj,ext.obj,\ field.obj,gawkmisc.obj,getopt.obj,getopt1.obj,io.obj,main.obj,\ msg.obj,node.obj,random.obj,re.obj AWKOBJ2 = regex.obj,replace.obj,version.obj,eval.obj,profile.obj @@ -102,13 +102,13 @@ VMSCMD = gawk_cmd.obj # built from .cld file VMSOBJS = $(VMSCODE),$(VMSCMD) # source and documentation files -AWKSRC = array.c,builtin.c,ext.c,eval.c,field.c,gawkmisc.c,\ +AWKSRC = array.c,builtin.c,ext.c,eval.c,dfa.c,field.c,gawkmisc.c,\ getopt.c,getopt1.c,io.c,main.c,msg.c,node.c,random.c,re.c,\ random.c,regcomp.c,regex.c,regex_internal.c,regexec.c,\ replace.c,version.c,eval.c,profile.c -ALLSRC = $(AWKSRC),awkgram.y,awk.h,custom.h,getopt.h,\ - patchlev.h,protos.h,random.h +ALLSRC = $(AWKSRC),awkgram.y,awk.h,custom.h,dfa.h,getopt.h,\ + gettext.h,mbsupport.h,protos.h,random.h VMSSRC = $(VMSDIR)gawkmisc.vms,$(VMSDIR)vms_misc.c,$(VMSDIR)vms_popen.c,\ $(VMSDIR)vms_fwrite.c,$(VMSDIR)vms_args.c,$(VMSDIR)vms_gawk.c,\ @@ -122,7 +122,7 @@ DOCS= $(DOCDIR)gawk.1,$(DOCDIR)gawk.texi,$(DOCDIR)texinfo.tex # Release of gawk REL=3.1 -PATCHLVL=3 +PATCHLVL=4 # generic target all : gawk @@ -159,11 +159,12 @@ $(VMSCODE) : awk.h config.h $(VMSDIR)redirect.h $(VMSDIR)vms.h gawkmisc.obj : gawkmisc.c $(VMSDIR)gawkmisc.vms -$(AWKOBJS) : awk.h regex.h config.h $(VMSDIR)redirect.h +$(AWKOBJS) : awk.h gettext.h mbsupport.h regex.h dfa.h \ + config.h $(VMSDIR)redirect.h random.obj : random.h builtin.obj : random.h -main.obj : patchlev.h awkgram.obj : awkgram.c awk.h +dfa.obj : dfa.c dfa.h regex.obj : regex.c regcomp.c regex_internal.c regexec.c regex.h regex_internal.h # bison or yacc required diff --git a/vms/vmsbuild.com b/vms/vmsbuild.com index 0da62445e..2e169c773 100644 --- a/vms/vmsbuild.com +++ b/vms/vmsbuild.com @@ -9,7 +9,7 @@ $! gawk 3.1.0 revised, Mar'01 $! gawk 3.1.1 revised, Apr'02 $! $ REL = "3.1" !release version number -$ PATCHLVL = "3" +$ PATCHLVL = "4" $! $! $ CCFLAGS = "/noList" ! "/noOpt/Debug" diff --git a/vms/vmstest.com b/vms/vmstest.com index 8fb26a53f..23e46e56a 100644 --- a/vms/vmstest.com +++ b/vms/vmstest.com @@ -32,7 +32,7 @@ $ if bigtest_list.nes."" then goto bigtest_loop $ return $ $basic: basic_lst1 = "msg swaplns messages argarray longwrds" - - + " getline fstabplus compare arrayref rs fsrs rand" - + + " getline2 fstabplus compare arrayref rs fsrs rand" - + " fsbs negexp asgext anchgsub splitargv awkpath nfset" - + " reparse convfmt arrayparm paramdup nonl defref" - + " nofmtch litoct resplit rswhite prmarscl sclforin" - @@ -172,10 +172,9 @@ $ if $status then rm tmp.; $ return $ $longwrds: echo "longwrds" -$ gawk -f longwrds.awk manpage >tmp.too -$ sort tmp.too tmp. +$ gawk -v "SORT=sort sys$input: tmp." -f longwrds.awk longwrds.in >_NL: $ cmp longwrds.ok tmp. -$ if $status then rm tmp.;,tmp.too; +$ if $status then rm tmp.; $ return $ $fieldwdth: echo "fieldwdth" @@ -258,9 +257,9 @@ $ if $status then rm tmp.; $ set On $ return $ -$getline: echo "getline" -$ gawk -f getline.awk getline.awk getline.awk >tmp. -$ cmp getline.ok tmp. +$getline2: echo "getline2" +$ gawk -f getline2.awk getline2.awk getline2.awk >tmp. +$ cmp getline2.ok tmp. $ if $status then rm tmp.; $ return $ @@ -590,7 +589,7 @@ $fnarray: echo "fnarray" $ set noOn $ AWKPATH_srcdir $ gawk -f fnarray.awk >tmp. 2>&1 -$ if .not.$status then call exit_code 2 +$ if .not.$status then call exit_code 1 $ set On $ cmp fnarray.ok tmp. $ if $status then rm tmp.; diff --git a/ylwrap b/ylwrap index 71e522500..f86e21730 100755 --- a/ylwrap +++ b/ylwrap @@ -1,8 +1,10 @@ #! /bin/sh # ylwrap - wrapper for lex/yacc invocations. -# -# Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002 Free Software -# Foundation, Inc. + +scriptversion=2003-11-18.20 + +# Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003 +# Free Software Foundation, Inc. # # Written by Tom Tromey . # @@ -25,23 +27,52 @@ # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. -# Usage: -# ylwrap INPUT [OUTPUT DESIRED]... -- PROGRAM [ARGS]... -# * INPUT is the input file -# * OUTPUT is file PROG generates -# * DESIRED is file we actually want -# * PROGRAM is program to run -# * ARGS are passed to PROG -# Any number of OUTPUT,DESIRED pairs may be used. +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + +case "$1" in + '') + echo "$0: No files given. Try \`$0 --help' for more information." 1>&2 + exit 1 + ;; + --basedir) + basedir=$2 + shift 2 + ;; + -h|--h*) + cat <<\EOF +Usage: ylwrap [--help|--version] INPUT [OUTPUT DESIRED]... -- PROGRAM [ARGS]... + +Wrapper for lex/yacc invocations, renaming files as desired. + + INPUT is the input file + OUTPUT is one file PROG generates + DESIRED is the file we actually want instead of OUTPUT + PROGRAM is program to run + ARGS are passed to PROG + +Any number of OUTPUT,DESIRED pairs may be used. + +Report bugs to . +EOF + exit 0 + ;; + -v|--v*) + echo "ylwrap $scriptversion" + exit 0 + ;; +esac + # The input. input="$1" shift case "$input" in - [\\/]* | ?:[\\/]*) + [\\/]* | ?:[\\/]*) # Absolute path; do nothing. ;; - *) + *) # Relative path. Make it absolute. input="`pwd`/$input" ;; @@ -49,12 +80,12 @@ esac pairlist= while test "$#" -ne 0; do - if test "$1" = "--"; then - shift - break - fi - pairlist="$pairlist $1" - shift + if test "$1" = "--"; then + shift + break + fi + pairlist="$pairlist $1" + shift done # The program to run. @@ -62,8 +93,8 @@ prog="$1" shift # Make any relative path in $prog absolute. case "$prog" in - [\\/]* | ?:[\\/]*) ;; - *[\\/]*) prog="`pwd`/$prog" ;; + [\\/]* | ?:[\\/]*) ;; + *[\\/]*) prog="`pwd`/$prog" ;; esac # FIXME: add hostname here for parallel makes that run commands on @@ -75,82 +106,104 @@ mkdir $dirname || exit 1 cd $dirname case $# in - 0) $prog "$input" ;; - *) $prog "$@" "$input" ;; + 0) $prog "$input" ;; + *) $prog "$@" "$input" ;; esac status=$? if test $status -eq 0; then - set X $pairlist - shift - first=yes - # Since DOS filename conventions don't allow two dots, - # the DOS version of Bison writes out y_tab.c instead of y.tab.c - # and y_tab.h instead of y.tab.h. Test to see if this is the case. - y_tab_nodot="no" - if test -f y_tab.c || test -f y_tab.h; then - y_tab_nodot="yes" - fi - - # The directory holding the input. - input_dir=`echo "$input" | sed -e 's,\([\\/]\)[^\\/]*$,\1,'` - # Quote $INPUT_DIR so we can use it in a regexp. - # FIXME: really we should care about more than `.' and `\'. - input_rx=`echo "$input_dir" | sed 's,\\\\,\\\\\\\\,g;s,\\.,\\\\.,g'` - - while test "$#" -ne 0; do - from="$1" - # Handle y_tab.c and y_tab.h output by DOS - if test $y_tab_nodot = "yes"; then - if test $from = "y.tab.c"; then - from="y_tab.c" - else - if test $from = "y.tab.h"; then - from="y_tab.h" - fi - fi - fi - if test -f "$from"; then - # If $2 is an absolute path name, then just use that, - # otherwise prepend `../'. - case "$2" in - [\\/]* | ?:[\\/]*) target="$2";; - *) target="../$2";; - esac - - # Edit out `#line' or `#' directives. - # - # We don't want the resulting debug information to point at - # an absolute srcdir; it is better for it to just mention the - # .y file with no path. - # - # We want to use the real output file name, not yy.lex.c for - # instance. - # - # We want the include guards to be adjusted too. - FROM=`echo "$from" | sed \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\ - -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'` - TARGET=`echo "$2" | sed \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\ - -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'` - sed "/^#/{s,$input_rx,,;s,$from,$2,;s,$FORM,$TO,;}" "$from" >"$target" || - status=$? + set X $pairlist + shift + first=yes + # Since DOS filename conventions don't allow two dots, + # the DOS version of Bison writes out y_tab.c instead of y.tab.c + # and y_tab.h instead of y.tab.h. Test to see if this is the case. + y_tab_nodot="no" + if test -f y_tab.c || test -f y_tab.h; then + y_tab_nodot="yes" + fi + + # The directory holding the input. + input_dir=`echo "$input" | sed -e 's,\([\\/]\)[^\\/]*$,\1,'` + # Quote $INPUT_DIR so we can use it in a regexp. + # FIXME: really we should care about more than `.' and `\'. + input_rx=`echo "$input_dir" | sed 's,\\\\,\\\\\\\\,g;s,\\.,\\\\.,g'` + + while test "$#" -ne 0; do + from="$1" + # Handle y_tab.c and y_tab.h output by DOS + if test $y_tab_nodot = "yes"; then + if test $from = "y.tab.c"; then + from="y_tab.c" else - # A missing file is only an error for the first file. This - # is a blatant hack to let us support using "yacc -d". If -d - # is not specified, we don't want an error when the header - # file is "missing". - if test $first = yes; then - status=1 - fi + if test $from = "y.tab.h"; then + from="y_tab.h" + fi + fi + fi + if test -f "$from"; then + # If $2 is an absolute path name, then just use that, + # otherwise prepend `../'. + case "$2" in + [\\/]* | ?:[\\/]*) target="$2";; + *) target="../$2";; + esac + + # We do not want to overwrite a header file if it hasn't + # changed. This avoid useless recompilations. However the + # parser itself (the first file) should always be updated, + # because it is the destination of the .y.c rule in the + # Makefile. Divert the output of all other files to a temporary + # file so we can compare them to existing versions. + if test $first = no; then + realtarget="$target" + target="tmp-`echo $target | sed s/.*[\\/]//g`" + fi + # Edit out `#line' or `#' directives. + # + # We don't want the resulting debug information to point at + # an absolute srcdir; it is better for it to just mention the + # .y file with no path. + # + # We want to use the real output file name, not yy.lex.c for + # instance. + # + # We want the include guards to be adjusted too. + FROM=`echo "$from" | sed \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\ + -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'` + TARGET=`echo "$2" | sed \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\ + -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'` + + sed -e "/^#/!b" -e "s,$input_rx,," -e "s,$from,$2," \ + -e "s,$FROM,$TARGET," "$from" >"$target" || status=$? + + # Check whether header files must be updated. + if test $first = no; then + if test -f "$realtarget" && cmp -s "$realtarget" "$target"; then + echo "$2" is unchanged + rm -f "$target" + else + echo updating "$2" + mv -f "$target" "$realtarget" + fi + fi + else + # A missing file is only an error for the first file. This + # is a blatant hack to let us support using "yacc -d". If -d + # is not specified, we don't want an error when the header + # file is "missing". + if test $first = yes; then + status=1 fi - shift - shift - first=no - done + fi + shift + shift + first=no + done else - status=$? + status=$? fi # Remove the directory. @@ -158,3 +211,12 @@ cd .. rm -rf $dirname exit $status + +# 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: