diff options
Diffstat (limited to 'coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src')
26 files changed, 9564 insertions, 0 deletions
diff --git a/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/ABOUT-NLS b/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/ABOUT-NLS new file mode 100644 index 0000000..3575535 --- /dev/null +++ b/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/ABOUT-NLS @@ -0,0 +1,1111 @@ +1 Notes on the Free Translation Project +*************************************** + +Free software is going international! The Free Translation Project is +a way to get maintainers of free software, translators, and users all +together, so that free software will gradually become able to speak many +languages. A few packages already provide translations for their +messages. + + If you found this `ABOUT-NLS' file inside a distribution, you may +assume that the distributed package does use GNU `gettext' internally, +itself available at your nearest GNU archive site. But you do _not_ +need to install GNU `gettext' prior to configuring, installing or using +this package with messages translated. + + Installers will find here some useful hints. These notes also +explain how users should proceed for getting the programs to use the +available translations. They tell how people wanting to contribute and +work on translations can contact the appropriate team. + + When reporting bugs in the `intl/' directory or bugs which may be +related to internationalization, you should tell about the version of +`gettext' which is used. The information can be found in the +`intl/VERSION' file, in internationalized packages. + +1.1 Quick configuration advice +============================== + +If you want to exploit the full power of internationalization, you +should configure it using + + ./configure --with-included-gettext + +to force usage of internationalizing routines provided within this +package, despite the existence of internationalizing capabilities in the +operating system where this package is being installed. So far, only +the `gettext' implementation in the GNU C library version 2 provides as +many features (such as locale alias, message inheritance, automatic +charset conversion or plural form handling) as the implementation here. +It is also not possible to offer this additional functionality on top +of a `catgets' implementation. Future versions of GNU `gettext' will +very likely convey even more functionality. So it might be a good idea +to change to GNU `gettext' as soon as possible. + + So you need _not_ provide this option if you are using GNU libc 2 or +you have installed a recent copy of the GNU gettext package with the +included `libintl'. + +1.2 INSTALL Matters +=================== + +Some packages are "localizable" when properly installed; the programs +they contain can be made to speak your own native language. Most such +packages use GNU `gettext'. Other packages have their own ways to +internationalization, predating GNU `gettext'. + + By default, this package will be installed to allow translation of +messages. It will automatically detect whether the system already +provides the GNU `gettext' functions. If not, the included GNU +`gettext' library will be used. This library is wholly contained +within this package, usually in the `intl/' subdirectory, so prior +installation of the GNU `gettext' package is _not_ required. +Installers may use special options at configuration time for changing +the default behaviour. The commands: + + ./configure --with-included-gettext + ./configure --disable-nls + +will, respectively, bypass any pre-existing `gettext' to use the +internationalizing routines provided within this package, or else, +_totally_ disable translation of messages. + + When you already have GNU `gettext' installed on your system and run +configure without an option for your new package, `configure' will +probably detect the previously built and installed `libintl.a' file and +will decide to use this. This might not be desirable. You should use +the more recent version of the GNU `gettext' library. I.e. if the file +`intl/VERSION' shows that the library which comes with this package is +more recent, you should use + + ./configure --with-included-gettext + +to prevent auto-detection. + + The configuration process will not test for the `catgets' function +and therefore it will not be used. The reason is that even an +emulation of `gettext' on top of `catgets' could not provide all the +extensions of the GNU `gettext' library. + + Internationalized packages usually have many `po/LL.po' files, where +LL gives an ISO 639 two-letter code identifying the language. Unless +translations have been forbidden at `configure' time by using the +`--disable-nls' switch, all available translations are installed +together with the package. However, the environment variable `LINGUAS' +may be set, prior to configuration, to limit the installed set. +`LINGUAS' should then contain a space separated list of two-letter +codes, stating which languages are allowed. + +1.3 Using This Package +====================== + +As a user, if your language has been installed for this package, you +only have to set the `LANG' environment variable to the appropriate +`LL_CC' combination. Here `LL' is an ISO 639 two-letter language code, +and `CC' is an ISO 3166 two-letter country code. For example, let's +suppose that you speak German and live in Germany. At the shell +prompt, merely execute `setenv LANG de_DE' (in `csh'), +`export LANG; LANG=de_DE' (in `sh') or `export LANG=de_DE' (in `bash'). +This can be done from your `.login' or `.profile' file, once and for +all. + + You might think that the country code specification is redundant. +But in fact, some languages have dialects in different countries. For +example, `de_AT' is used for Austria, and `pt_BR' for Brazil. The +country code serves to distinguish the dialects. + + The locale naming convention of `LL_CC', with `LL' denoting the +language and `CC' denoting the country, is the one use on systems based +on GNU libc. On other systems, some variations of this scheme are +used, such as `LL' or `LL_CC.ENCODING'. You can get the list of +locales supported by your system for your language by running the +command `locale -a | grep '^LL''. + + Not all programs have translations for all languages. By default, an +English message is shown in place of a nonexistent translation. If you +understand other languages, you can set up a priority list of languages. +This is done through a different environment variable, called +`LANGUAGE'. GNU `gettext' gives preference to `LANGUAGE' over `LANG' +for the purpose of message handling, but you still need to have `LANG' +set to the primary language; this is required by other parts of the +system libraries. For example, some Swedish users who would rather +read translations in German than English for when Swedish is not +available, set `LANGUAGE' to `sv:de' while leaving `LANG' to `sv_SE'. + + Special advice for Norwegian users: The language code for Norwegian +bokma*l changed from `no' to `nb' recently (in 2003). During the +transition period, while some message catalogs for this language are +installed under `nb' and some older ones under `no', it's recommended +for Norwegian users to set `LANGUAGE' to `nb:no' so that both newer and +older translations are used. + + In the `LANGUAGE' environment variable, but not in the `LANG' +environment variable, `LL_CC' combinations can be abbreviated as `LL' +to denote the language's main dialect. For example, `de' is equivalent +to `de_DE' (German as spoken in Germany), and `pt' to `pt_PT' +(Portuguese as spoken in Portugal) in this context. + +1.4 Translating Teams +===================== + +For the Free Translation Project to be a success, we need interested +people who like their own language and write it well, and who are also +able to synergize with other translators speaking the same language. +Each translation team has its own mailing list. The up-to-date list of +teams can be found at the Free Translation Project's homepage, +`http://www.iro.umontreal.ca/contrib/po/HTML/', in the "National teams" +area. + + If you'd like to volunteer to _work_ at translating messages, you +should become a member of the translating team for your own language. +The subscribing address is _not_ the same as the list itself, it has +`-request' appended. For example, speakers of Swedish can send a +message to `sv-request@li.org', having this message body: + + subscribe + + Keep in mind that team members are expected to participate +_actively_ in translations, or at solving translational difficulties, +rather than merely lurking around. If your team does not exist yet and +you want to start one, or if you are unsure about what to do or how to +get started, please write to `translation@iro.umontreal.ca' to reach the +coordinator for all translator teams. + + The English team is special. It works at improving and uniformizing +the terminology in use. Proven linguistic skill are praised more than +programming skill, here. + +1.5 Available Packages +====================== + +Languages are not equally supported in all packages. The following +matrix shows the current state of internationalization, as of July +2006. The matrix shows, in regard of each package, for which languages +PO files have been submitted to translation coordination, with a +translation percentage of at least 50%. + + Ready PO files af am ar az be bg bs ca cs cy da de el en en_GB eo + +----------------------------------------------------+ + GNUnet | [] | + a2ps | [] [] [] [] [] | + aegis | () | + ant-phone | () | + anubis | [] | + ap-utils | | + aspell | [] [] [] [] | + bash | [] [] [] | + batchelor | [] | + bfd | | + bibshelf | [] | + binutils | [] | + bison | [] [] | + bison-runtime | [] | + bluez-pin | [] [] [] [] [] | + cflow | [] | + clisp | [] [] | + console-tools | [] [] | + coreutils | [] [] [] [] | + cpio | | + cpplib | [] [] [] | + cryptonit | [] | + darkstat | [] () [] | + dialog | [] [] [] [] [] [] | + diffutils | [] [] [] [] [] [] | + doodle | [] | + e2fsprogs | [] [] | + enscript | [] [] [] [] | + error | [] [] [] [] | + fetchmail | [] [] () [] | + fileutils | [] [] | + findutils | [] [] [] | + flex | [] [] [] | + fslint | [] | + gas | | + gawk | [] [] [] | + gbiff | [] | + gcal | [] | + gcc | [] | + gettext-examples | [] [] [] [] [] | + gettext-runtime | [] [] [] [] [] | + gettext-tools | [] [] | + gimp-print | [] [] [] [] | + gip | [] | + gliv | [] | + glunarclock | [] | + gmult | [] [] | + gnubiff | () | + gnucash | () () [] | + gnucash-glossary | [] () | + gnuedu | | + gnulib | [] [] [] [] [] [] | + gnunet-gtk | | + gnutls | | + gpe-aerial | [] [] | + gpe-beam | [] [] | + gpe-calendar | [] [] | + gpe-clock | [] [] | + gpe-conf | [] [] | + gpe-contacts | | + gpe-edit | [] | + gpe-filemanager | | + gpe-go | [] | + gpe-login | [] [] | + gpe-ownerinfo | [] [] | + gpe-package | | + gpe-sketchbook | [] [] | + gpe-su | [] [] | + gpe-taskmanager | [] [] | + gpe-timesheet | [] | + gpe-today | [] [] | + gpe-todo | | + gphoto2 | [] [] [] [] | + gprof | [] [] | + gpsdrive | () () | + gramadoir | [] [] | + grep | [] [] [] [] [] [] | + gretl | | + gsasl | | + gss | | + gst-plugins | [] [] [] [] | + gst-plugins-base | [] [] [] | + gst-plugins-good | [] [] [] [] [] [] [] | + gstreamer | [] [] [] [] [] [] [] | + gtick | [] () | + gtkam | [] [] [] | + gtkorphan | [] [] | + gtkspell | [] [] [] [] | + gutenprint | [] | + hello | [] [] [] [] [] | + id-utils | [] [] | + impost | | + indent | [] [] [] | + iso_3166 | [] [] | + iso_3166_1 | [] [] [] [] [] | + iso_3166_2 | | + iso_3166_3 | [] | + iso_4217 | [] | + iso_639 | [] [] | + jpilot | [] | + jtag | | + jwhois | | + kbd | [] [] [] [] | + keytouch | | + keytouch-editor | | + keytouch-keyboa... | | + latrine | () | + ld | [] | + leafpad | [] [] [] [] [] | + libc | [] [] [] [] [] | + libexif | [] | + libextractor | [] | + libgpewidget | [] [] [] | + libgpg-error | [] | + libgphoto2 | [] [] | + libgphoto2_port | [] [] | + libgsasl | | + libiconv | [] [] | + libidn | [] [] | + lifelines | [] () | + lilypond | [] | + lingoteach | | + lynx | [] [] [] [] | + m4 | [] [] [] [] | + mailutils | [] | + make | [] [] | + man-db | [] () [] [] | + minicom | [] [] [] | + mysecretdiary | [] [] | + nano | [] [] () [] | + nano_1_0 | [] () [] [] | + opcodes | [] | + parted | | + pilot-qof | [] | + psmisc | [] | + pwdutils | | + python | | + qof | | + radius | [] | + recode | [] [] [] [] [] [] | + rpm | [] [] | + screem | | + scrollkeeper | [] [] [] [] [] [] [] [] | + sed | [] [] [] | + sh-utils | [] [] | + shared-mime-info | [] [] [] | + sharutils | [] [] [] [] [] [] | + shishi | | + silky | | + skencil | [] () | + sketch | [] () | + solfege | | + soundtracker | [] [] | + sp | [] | + stardict | [] | + system-tools-ba... | [] [] [] [] [] [] [] [] [] | + tar | [] | + texinfo | [] [] [] | + textutils | [] [] [] | + tin | () () | + tp-robot | [] | + tuxpaint | [] [] [] [] [] | + unicode-han-tra... | | + unicode-transla... | | + util-linux | [] [] [] [] | + vorbis-tools | [] [] [] [] | + wastesedge | () | + wdiff | [] [] [] [] | + wget | [] [] | + xchat | [] [] [] [] [] | + xkeyboard-config | | + xpad | [] [] | + +----------------------------------------------------+ + af am ar az be bg bs ca cs cy da de el en en_GB eo + 11 0 1 2 8 21 1 42 43 2 62 99 18 1 16 16 + + es et eu fa fi fr ga gl gu he hi hr hu id is it + +--------------------------------------------------+ + GNUnet | | + a2ps | [] [] [] () | + aegis | | + ant-phone | [] | + anubis | [] | + ap-utils | [] [] | + aspell | [] [] [] | + bash | [] [] [] | + batchelor | [] [] | + bfd | [] | + bibshelf | [] [] [] | + binutils | [] [] [] | + bison | [] [] [] [] [] [] | + bison-runtime | [] [] [] [] [] | + bluez-pin | [] [] [] [] [] | + cflow | | + clisp | [] [] | + console-tools | | + coreutils | [] [] [] [] [] [] | + cpio | [] [] [] | + cpplib | [] [] | + cryptonit | [] | + darkstat | [] () [] [] [] | + dialog | [] [] [] [] [] [] [] [] | + diffutils | [] [] [] [] [] [] [] [] [] | + doodle | [] [] | + e2fsprogs | [] [] [] | + enscript | [] [] [] | + error | [] [] [] [] [] | + fetchmail | [] | + fileutils | [] [] [] [] [] [] | + findutils | [] [] [] [] | + flex | [] [] [] | + fslint | [] | + gas | [] [] | + gawk | [] [] [] [] | + gbiff | [] | + gcal | [] [] | + gcc | [] | + gettext-examples | [] [] [] [] [] | + gettext-runtime | [] [] [] [] [] [] | + gettext-tools | [] [] [] | + gimp-print | [] [] | + gip | [] [] [] | + gliv | () | + glunarclock | [] [] [] | + gmult | [] [] [] | + gnubiff | () () | + gnucash | () () () | + gnucash-glossary | [] [] | + gnuedu | [] | + gnulib | [] [] [] [] [] [] [] [] | + gnunet-gtk | | + gnutls | | + gpe-aerial | [] [] | + gpe-beam | [] [] | + gpe-calendar | [] [] [] [] | + gpe-clock | [] [] [] [] | + gpe-conf | [] | + gpe-contacts | [] [] | + gpe-edit | [] [] [] [] | + gpe-filemanager | [] | + gpe-go | [] [] [] | + gpe-login | [] [] [] | + gpe-ownerinfo | [] [] [] [] [] | + gpe-package | [] | + gpe-sketchbook | [] [] | + gpe-su | [] [] [] [] | + gpe-taskmanager | [] [] [] | + gpe-timesheet | [] [] [] [] | + gpe-today | [] [] [] [] | + gpe-todo | [] | + gphoto2 | [] [] [] [] [] | + gprof | [] [] [] [] | + gpsdrive | () () [] () | + gramadoir | [] [] | + grep | [] [] [] [] [] [] [] [] [] [] [] [] | + gretl | [] [] [] | + gsasl | [] | + gss | [] | + gst-plugins | [] [] [] | + gst-plugins-base | [] [] | + gst-plugins-good | [] [] [] | + gstreamer | [] [] [] | + gtick | [] [] [] [] [] | + gtkam | [] [] [] [] | + gtkorphan | [] [] | + gtkspell | [] [] [] [] [] [] | + gutenprint | [] | + hello | [] [] [] [] [] [] [] [] [] [] [] [] [] | + id-utils | [] [] [] [] [] | + impost | [] [] | + indent | [] [] [] [] [] [] [] [] [] [] | + iso_3166 | [] [] [] | + iso_3166_1 | [] [] [] [] [] [] [] | + iso_3166_2 | [] | + iso_3166_3 | [] | + iso_4217 | [] [] [] [] | + iso_639 | [] [] [] [] [] | + jpilot | [] [] | + jtag | [] | + jwhois | [] [] [] [] [] | + kbd | [] [] | + keytouch | [] | + keytouch-editor | [] | + keytouch-keyboa... | [] | + latrine | [] [] [] | + ld | [] [] | + leafpad | [] [] [] [] [] [] | + libc | [] [] [] [] [] | + libexif | [] | + libextractor | [] | + libgpewidget | [] [] [] [] [] | + libgpg-error | | + libgphoto2 | [] [] [] | + libgphoto2_port | [] [] | + libgsasl | [] [] | + libiconv | [] | + libidn | [] [] | + lifelines | () | + lilypond | [] | + lingoteach | [] [] [] | + lynx | [] [] [] | + m4 | [] [] [] [] | + mailutils | [] [] | + make | [] [] [] [] [] [] [] [] | + man-db | () | + minicom | [] [] [] [] | + mysecretdiary | [] [] [] | + nano | [] () [] [] [] [] | + nano_1_0 | [] [] [] [] [] | + opcodes | [] [] [] [] | + parted | [] [] [] [] | + pilot-qof | | + psmisc | [] [] [] | + pwdutils | | + python | | + qof | | + radius | [] [] | + recode | [] [] [] [] [] [] [] [] | + rpm | [] [] | + screem | | + scrollkeeper | [] [] [] | + sed | [] [] [] [] [] | + sh-utils | [] [] [] [] [] [] [] | + shared-mime-info | [] [] [] [] [] [] | + sharutils | [] [] [] [] [] [] [] [] | + shishi | | + silky | [] | + skencil | [] [] | + sketch | [] [] | + solfege | [] | + soundtracker | [] [] [] | + sp | [] | + stardict | [] | + system-tools-ba... | [] [] [] [] [] [] [] [] | + tar | [] [] [] [] [] [] | + texinfo | [] [] | + textutils | [] [] [] [] [] | + tin | [] () | + tp-robot | [] [] [] [] | + tuxpaint | [] [] | + unicode-han-tra... | | + unicode-transla... | [] [] | + util-linux | [] [] [] [] [] [] [] | + vorbis-tools | [] [] | + wastesedge | () | + wdiff | [] [] [] [] [] [] [] [] | + wget | [] [] [] [] [] [] [] [] | + xchat | [] [] [] [] [] [] [] [] | + xkeyboard-config | [] [] [] [] | + xpad | [] [] [] | + +--------------------------------------------------+ + es et eu fa fi fr ga gl gu he hi hr hu id is it + 89 21 16 2 41 119 61 14 1 8 1 6 61 30 0 53 + + ja ko ku ky lg lt lv mk mn ms mt nb ne nl nn no + +--------------------------------------------------+ + GNUnet | | + a2ps | () [] [] () | + aegis | () | + ant-phone | [] | + anubis | [] [] [] | + ap-utils | [] | + aspell | [] [] | + bash | [] | + batchelor | [] [] | + bfd | | + bibshelf | [] | + binutils | | + bison | [] [] [] | + bison-runtime | [] [] [] | + bluez-pin | [] [] [] | + cflow | | + clisp | [] | + console-tools | | + coreutils | [] | + cpio | | + cpplib | [] | + cryptonit | [] | + darkstat | [] [] | + dialog | [] [] | + diffutils | [] [] [] | + doodle | | + e2fsprogs | [] | + enscript | [] | + error | [] | + fetchmail | [] [] | + fileutils | [] [] | + findutils | [] | + flex | [] [] | + fslint | [] [] | + gas | | + gawk | [] [] | + gbiff | [] | + gcal | | + gcc | | + gettext-examples | [] [] | + gettext-runtime | [] [] [] | + gettext-tools | [] [] | + gimp-print | [] [] | + gip | [] [] | + gliv | [] | + glunarclock | [] [] | + gmult | [] [] | + gnubiff | | + gnucash | () () | + gnucash-glossary | [] | + gnuedu | | + gnulib | [] [] [] [] | + gnunet-gtk | | + gnutls | | + gpe-aerial | [] | + gpe-beam | [] | + gpe-calendar | [] | + gpe-clock | [] [] | + gpe-conf | [] [] | + gpe-contacts | [] | + gpe-edit | [] [] | + gpe-filemanager | [] | + gpe-go | [] [] | + gpe-login | [] [] | + gpe-ownerinfo | [] | + gpe-package | [] | + gpe-sketchbook | [] [] | + gpe-su | [] [] | + gpe-taskmanager | [] [] [] | + gpe-timesheet | [] | + gpe-today | [] | + gpe-todo | | + gphoto2 | [] [] | + gprof | | + gpsdrive | () () () | + gramadoir | () | + grep | [] [] [] | + gretl | | + gsasl | [] | + gss | | + gst-plugins | [] | + gst-plugins-base | | + gst-plugins-good | [] | + gstreamer | [] | + gtick | [] | + gtkam | [] | + gtkorphan | [] | + gtkspell | [] [] | + gutenprint | | + hello | [] [] [] [] [] [] [] [] | + id-utils | [] | + impost | | + indent | [] [] | + iso_3166 | [] | + iso_3166_1 | [] [] | + iso_3166_2 | [] | + iso_3166_3 | [] | + iso_4217 | [] [] [] | + iso_639 | [] [] | + jpilot | () () () | + jtag | | + jwhois | [] | + kbd | [] | + keytouch | [] | + keytouch-editor | | + keytouch-keyboa... | | + latrine | [] | + ld | | + leafpad | [] [] | + libc | [] [] [] [] [] | + libexif | | + libextractor | | + libgpewidget | [] | + libgpg-error | | + libgphoto2 | [] | + libgphoto2_port | [] | + libgsasl | [] | + libiconv | | + libidn | [] [] | + lifelines | [] | + lilypond | | + lingoteach | [] | + lynx | [] [] | + m4 | [] [] | + mailutils | | + make | [] [] [] | + man-db | () | + minicom | [] | + mysecretdiary | [] | + nano | [] [] [] | + nano_1_0 | [] [] [] | + opcodes | [] | + parted | [] [] | + pilot-qof | | + psmisc | [] [] [] | + pwdutils | | + python | | + qof | | + radius | | + recode | [] | + rpm | [] [] | + screem | [] | + scrollkeeper | [] [] [] [] | + sed | [] [] | + sh-utils | [] [] | + shared-mime-info | [] [] [] [] [] | + sharutils | [] [] | + shishi | | + silky | [] | + skencil | | + sketch | | + solfege | | + soundtracker | | + sp | () | + stardict | [] [] | + system-tools-ba... | [] [] [] [] | + tar | [] [] [] | + texinfo | [] [] [] | + textutils | [] [] [] | + tin | | + tp-robot | [] | + tuxpaint | [] | + unicode-han-tra... | | + unicode-transla... | | + util-linux | [] [] | + vorbis-tools | [] | + wastesedge | [] | + wdiff | [] [] | + wget | [] [] | + xchat | [] [] [] [] | + xkeyboard-config | [] | + xpad | [] [] [] | + +--------------------------------------------------+ + ja ko ku ky lg lt lv mk mn ms mt nb ne nl nn no + 40 24 2 1 1 3 1 2 3 21 0 15 1 101 5 3 + + nso or pa pl pt pt_BR rm ro ru rw sk sl sq sr sv ta + +------------------------------------------------------+ + GNUnet | | + a2ps | () [] [] [] [] [] [] | + aegis | () () | + ant-phone | [] [] | + anubis | [] [] [] | + ap-utils | () | + aspell | [] [] | + bash | [] [] [] | + batchelor | [] [] | + bfd | | + bibshelf | [] | + binutils | [] [] | + bison | [] [] [] [] [] | + bison-runtime | [] [] [] [] | + bluez-pin | [] [] [] [] [] [] [] [] [] | + cflow | [] | + clisp | [] | + console-tools | [] | + coreutils | [] [] [] [] | + cpio | [] [] [] | + cpplib | [] | + cryptonit | [] [] | + darkstat | [] [] [] [] [] [] | + dialog | [] [] [] [] [] [] [] [] [] | + diffutils | [] [] [] [] [] [] | + doodle | [] [] | + e2fsprogs | [] [] | + enscript | [] [] [] [] [] | + error | [] [] [] [] | + fetchmail | [] [] [] | + fileutils | [] [] [] [] [] | + findutils | [] [] [] [] [] [] | + flex | [] [] [] [] [] | + fslint | [] [] [] [] | + gas | | + gawk | [] [] [] [] | + gbiff | [] | + gcal | [] | + gcc | [] | + gettext-examples | [] [] [] [] [] [] [] [] | + gettext-runtime | [] [] [] [] [] [] [] [] | + gettext-tools | [] [] [] [] [] [] [] | + gimp-print | [] [] | + gip | [] [] [] [] | + gliv | [] [] [] [] | + glunarclock | [] [] [] [] [] [] | + gmult | [] [] [] [] | + gnubiff | () | + gnucash | () [] | + gnucash-glossary | [] [] [] | + gnuedu | | + gnulib | [] [] [] [] [] | + gnunet-gtk | [] | + gnutls | [] [] | + gpe-aerial | [] [] [] [] [] [] [] | + gpe-beam | [] [] [] [] [] [] [] | + gpe-calendar | [] [] [] [] [] [] [] [] | + gpe-clock | [] [] [] [] [] [] [] [] | + gpe-conf | [] [] [] [] [] [] [] | + gpe-contacts | [] [] [] [] [] | + gpe-edit | [] [] [] [] [] [] [] [] | + gpe-filemanager | [] [] | + gpe-go | [] [] [] [] [] [] | + gpe-login | [] [] [] [] [] [] [] [] | + gpe-ownerinfo | [] [] [] [] [] [] [] [] | + gpe-package | [] [] | + gpe-sketchbook | [] [] [] [] [] [] [] [] | + gpe-su | [] [] [] [] [] [] [] [] | + gpe-taskmanager | [] [] [] [] [] [] [] [] | + gpe-timesheet | [] [] [] [] [] [] [] [] | + gpe-today | [] [] [] [] [] [] [] [] | + gpe-todo | [] [] [] [] | + gphoto2 | [] [] [] [] [] | + gprof | [] [] [] | + gpsdrive | [] [] [] | + gramadoir | [] [] | + grep | [] [] [] [] [] [] [] [] | + gretl | [] | + gsasl | [] [] | + gss | [] [] [] | + gst-plugins | [] [] [] [] | + gst-plugins-base | [] | + gst-plugins-good | [] [] [] [] | + gstreamer | [] [] [] | + gtick | [] [] [] | + gtkam | [] [] [] [] | + gtkorphan | [] | + gtkspell | [] [] [] [] [] [] [] [] | + gutenprint | [] | + hello | [] [] [] [] [] [] [] [] | + id-utils | [] [] [] [] | + impost | [] | + indent | [] [] [] [] [] [] | + iso_3166 | [] [] [] [] [] [] | + iso_3166_1 | [] [] [] [] | + iso_3166_2 | | + iso_3166_3 | [] [] [] [] | + iso_4217 | [] [] [] [] | + iso_639 | [] [] [] [] | + jpilot | | + jtag | [] | + jwhois | [] [] [] [] | + kbd | [] [] [] | + keytouch | [] | + keytouch-editor | [] | + keytouch-keyboa... | [] | + latrine | [] [] | + ld | [] | + leafpad | [] [] [] [] [] [] | + libc | [] [] [] [] [] | + libexif | [] | + libextractor | [] [] | + libgpewidget | [] [] [] [] [] [] [] | + libgpg-error | [] [] | + libgphoto2 | [] | + libgphoto2_port | [] [] [] | + libgsasl | [] [] [] [] | + libiconv | | + libidn | [] [] () | + lifelines | [] [] | + lilypond | | + lingoteach | [] | + lynx | [] [] [] | + m4 | [] [] [] [] [] | + mailutils | [] [] [] [] | + make | [] [] [] [] | + man-db | [] [] | + minicom | [] [] [] [] [] | + mysecretdiary | [] [] [] [] | + nano | [] [] | + nano_1_0 | [] [] [] [] | + opcodes | [] [] | + parted | [] | + pilot-qof | [] | + psmisc | [] [] | + pwdutils | [] [] | + python | | + qof | [] | + radius | [] [] | + recode | [] [] [] [] [] [] [] | + rpm | [] [] [] [] | + screem | | + scrollkeeper | [] [] [] [] [] [] [] | + sed | [] [] [] [] [] [] [] [] [] | + sh-utils | [] [] [] | + shared-mime-info | [] [] [] [] [] | + sharutils | [] [] [] [] | + shishi | [] | + silky | [] | + skencil | [] [] [] | + sketch | [] [] [] | + solfege | [] | + soundtracker | [] [] | + sp | | + stardict | [] [] [] | + system-tools-ba... | [] [] [] [] [] [] [] [] [] | + tar | [] [] [] [] [] | + texinfo | [] [] [] [] | + textutils | [] [] [] | + tin | () | + tp-robot | [] | + tuxpaint | [] [] [] [] [] | + unicode-han-tra... | | + unicode-transla... | | + util-linux | [] [] [] [] | + vorbis-tools | [] [] | + wastesedge | | + wdiff | [] [] [] [] [] [] | + wget | [] [] [] [] | + xchat | [] [] [] [] [] [] [] | + xkeyboard-config | [] [] | + xpad | [] [] [] | + +------------------------------------------------------+ + nso or pa pl pt pt_BR rm ro ru rw sk sl sq sr sv ta + 0 2 3 58 31 53 5 76 72 5 42 48 12 51 130 2 + + tg th tk tr uk ven vi wa xh zh_CN zh_HK zh_TW zu + +---------------------------------------------------+ + GNUnet | [] | 2 + a2ps | [] [] [] | 19 + aegis | | 0 + ant-phone | [] [] | 6 + anubis | [] [] [] | 11 + ap-utils | () [] | 4 + aspell | [] [] [] | 14 + bash | [] | 11 + batchelor | [] [] | 9 + bfd | | 1 + bibshelf | [] | 7 + binutils | [] [] [] | 9 + bison | [] [] [] | 19 + bison-runtime | [] [] [] | 16 + bluez-pin | [] [] [] [] [] [] | 28 + cflow | [] [] | 4 + clisp | | 6 + console-tools | [] [] | 5 + coreutils | [] [] | 17 + cpio | [] [] [] | 9 + cpplib | [] [] [] [] | 11 + cryptonit | | 5 + darkstat | [] () () | 15 + dialog | [] [] [] [] [] | 30 + diffutils | [] [] [] [] | 28 + doodle | [] | 6 + e2fsprogs | [] [] | 10 + enscript | [] [] [] | 16 + error | [] [] [] [] | 18 + fetchmail | [] [] | 12 + fileutils | [] [] [] | 18 + findutils | [] [] [] | 17 + flex | [] [] | 15 + fslint | [] | 9 + gas | [] | 3 + gawk | [] [] | 15 + gbiff | [] | 5 + gcal | [] | 5 + gcc | [] [] [] | 6 + gettext-examples | [] [] [] [] [] [] | 26 + gettext-runtime | [] [] [] [] [] [] | 28 + gettext-tools | [] [] [] [] [] | 19 + gimp-print | [] [] | 12 + gip | [] [] | 12 + gliv | [] [] | 8 + glunarclock | [] [] [] | 15 + gmult | [] [] [] [] | 15 + gnubiff | [] | 1 + gnucash | () | 2 + gnucash-glossary | [] [] | 9 + gnuedu | [] | 2 + gnulib | [] [] [] [] [] | 28 + gnunet-gtk | | 1 + gnutls | | 2 + gpe-aerial | [] [] | 14 + gpe-beam | [] [] | 14 + gpe-calendar | [] [] [] [] | 19 + gpe-clock | [] [] [] [] | 20 + gpe-conf | [] [] | 14 + gpe-contacts | [] [] | 10 + gpe-edit | [] [] [] [] | 19 + gpe-filemanager | [] | 5 + gpe-go | [] [] | 14 + gpe-login | [] [] [] [] [] | 20 + gpe-ownerinfo | [] [] [] [] | 20 + gpe-package | [] | 5 + gpe-sketchbook | [] [] | 16 + gpe-su | [] [] [] | 19 + gpe-taskmanager | [] [] [] | 19 + gpe-timesheet | [] [] [] [] | 18 + gpe-today | [] [] [] [] [] | 20 + gpe-todo | [] | 6 + gphoto2 | [] [] [] [] | 20 + gprof | [] [] | 11 + gpsdrive | | 4 + gramadoir | [] | 7 + grep | [] [] [] [] | 33 + gretl | | 4 + gsasl | [] [] | 6 + gss | [] | 5 + gst-plugins | [] [] [] | 15 + gst-plugins-base | [] [] [] | 9 + gst-plugins-good | [] [] [] | 18 + gstreamer | [] [] [] | 17 + gtick | [] | 11 + gtkam | [] | 13 + gtkorphan | [] | 7 + gtkspell | [] [] [] [] [] [] | 26 + gutenprint | | 3 + hello | [] [] [] [] [] | 39 + id-utils | [] [] | 14 + impost | [] | 4 + indent | [] [] [] [] | 25 + iso_3166 | [] [] [] | 15 + iso_3166_1 | [] [] | 20 + iso_3166_2 | | 2 + iso_3166_3 | [] [] | 9 + iso_4217 | [] [] | 14 + iso_639 | [] | 14 + jpilot | [] [] [] [] | 7 + jtag | [] | 3 + jwhois | [] [] [] | 13 + kbd | [] [] | 12 + keytouch | [] | 4 + keytouch-editor | | 2 + keytouch-keyboa... | | 2 + latrine | [] [] | 8 + ld | [] [] [] [] | 8 + leafpad | [] [] [] [] | 23 + libc | [] [] [] | 23 + libexif | [] | 4 + libextractor | [] | 5 + libgpewidget | [] [] [] | 19 + libgpg-error | [] | 4 + libgphoto2 | [] | 8 + libgphoto2_port | [] [] [] | 11 + libgsasl | [] | 8 + libiconv | [] | 4 + libidn | [] [] | 10 + lifelines | | 4 + lilypond | | 2 + lingoteach | [] | 6 + lynx | [] [] [] | 15 + m4 | [] [] [] | 18 + mailutils | [] | 8 + make | [] [] [] | 20 + man-db | [] | 6 + minicom | [] | 14 + mysecretdiary | [] [] | 12 + nano | [] [] | 15 + nano_1_0 | [] [] [] | 18 + opcodes | [] [] | 10 + parted | [] [] [] | 10 + pilot-qof | [] | 3 + psmisc | [] | 10 + pwdutils | [] | 3 + python | | 0 + qof | [] | 2 + radius | [] | 6 + recode | [] [] [] | 25 + rpm | [] [] [] [] | 14 + screem | [] | 2 + scrollkeeper | [] [] [] [] | 26 + sed | [] [] [] | 22 + sh-utils | [] | 15 + shared-mime-info | [] [] [] [] | 23 + sharutils | [] [] [] | 23 + shishi | | 1 + silky | [] | 4 + skencil | [] | 7 + sketch | | 6 + solfege | | 2 + soundtracker | [] [] | 9 + sp | [] | 3 + stardict | [] [] [] [] | 11 + system-tools-ba... | [] [] [] [] [] [] [] | 37 + tar | [] [] [] [] | 19 + texinfo | [] [] [] | 15 + textutils | [] [] [] | 17 + tin | | 1 + tp-robot | [] [] [] | 10 + tuxpaint | [] [] [] | 16 + unicode-han-tra... | | 0 + unicode-transla... | | 2 + util-linux | [] [] [] | 20 + vorbis-tools | [] [] | 11 + wastesedge | | 1 + wdiff | [] [] | 22 + wget | [] [] [] | 19 + xchat | [] [] [] [] | 28 + xkeyboard-config | [] [] [] [] | 11 + xpad | [] [] [] | 14 + +---------------------------------------------------+ + 77 teams tg th tk tr uk ven vi wa xh zh_CN zh_HK zh_TW zu + 172 domains 0 1 1 78 39 0 135 13 1 50 3 54 0 2054 + + Some counters in the preceding matrix are higher than the number of +visible blocks let us expect. This is because a few extra PO files are +used for implementing regional variants of languages, or language +dialects. + + For a PO file in the matrix above to be effective, the package to +which it applies should also have been internationalized and +distributed as such by its maintainer. There might be an observable +lag between the mere existence a PO file and its wide availability in a +distribution. + + If July 2006 seems to be old, you may fetch a more recent copy of +this `ABOUT-NLS' file on most GNU archive sites. The most up-to-date +matrix with full percentage details can be found at +`http://www.iro.umontreal.ca/contrib/po/HTML/matrix.html'. + +1.6 Using `gettext' in new packages +=================================== + +If you are writing a freely available program and want to +internationalize it you are welcome to use GNU `gettext' in your +package. Of course you have to respect the GNU Library General Public +License which covers the use of the GNU `gettext' library. This means +in particular that even non-free programs can use `libintl' as a shared +library, whereas only free software can use `libintl' as a static +library or use modified versions of `libintl'. + + Once the sources are changed appropriately and the setup can handle +the use of `gettext' the only thing missing are the translations. The +Free Translation Project is also available for packages which are not +developed inside the GNU project. Therefore the information given above +applies also for every other Free Software Project. Contact +`translation@iro.umontreal.ca' to make the `.pot' files available to +the translation teams. + diff --git a/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/AUTHORS b/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/AUTHORS new file mode 100644 index 0000000..4474df9 --- /dev/null +++ b/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/AUTHORS @@ -0,0 +1,5 @@ +GNU Sed was first authored by Jay Fenlason (hack@gnu.org) +and later modified by Tom Lord (lord@gnu.org). + +It is currently being maintained by Ken Pizzini (ken@gnu.org) +and Paolo Bonzini (bonzini@gnu.org). diff --git a/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/BUGS b/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/BUGS new file mode 100644 index 0000000..138f3cd --- /dev/null +++ b/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/BUGS @@ -0,0 +1,133 @@ +* ABOUT BUGS + +Before reporting a bug, please check the list of known bugs +and the list of oft-reported non-bugs (below). + +Bugs and comments may be sent to bonzini@gnu.org; please +include in the Subject: header the first line of the output of +``sed --version''. + +Please do not send a bug report like this: + + [while building frobme-1.3.4] + $ configure + sed: file sedscr line 1: Unknown option to 's' + +If sed doesn't configure your favorite package, take a few extra +minutes to identify the specific problem and make a stand-alone test +case. + +A stand-alone test case includes all the data necessary to perform the +test, and the specific invocation of sed that causes the problem. The +smaller a stand-alone test case is, the better. A test case should +not involve something as far removed from sed as ``try to configure +frobme-1.3.4''. Yes, that is in principle enough information to look +for the bug, but that is not a very practical prospect. + + + +* NON-BUGS + +`N' command on the last line + + Most versions of sed exit without printing anything when the `N' + command is issued on the last line of a file. GNU sed instead + prints pattern space before exiting unless of course the `-n' + command switch has been specified. More information on the reason + behind this choice can be found in the Info manual. + + +regex syntax clashes (problems with backslashes) + + sed uses the Posix basic regular expression syntax. According to + the standard, the meaning of some escape sequences is undefined in + this syntax; notable in the case of GNU sed are `\|', `\+', `\?', + `\`', `\'', `\<', `\>', `\b', `\B', `\w', and `\W'. + + As in all GNU programs that use Posix basic regular expressions, sed + interprets these escape sequences as meta-characters. So, `x\+' + matches one or more occurrences of `x'. `abc\|def' matches either + `abc' or `def'. + + This syntax may cause problems when running scripts written for other + seds. Some sed programs have been written with the assumption that + `\|' and `\+' match the literal characters `|' and `+'. Such scripts + must be modified by removing the spurious backslashes if they are to + be used with recent versions of sed (not only GNU sed). + + On the other hand, some scripts use `s|abc\|def||g' to remove occurrences + of _either_ `abc' or `def'. While this worked until sed 4.0.x, newer + versions interpret this as removing the string `abc|def'. This is + again undefined behavior according to POSIX, but this interpretation + is arguably more robust: the older one, for example, required that + the regex matcher parsed `\/' as `/' in the common case of escaping + a slash, which is again undefined behavior; the new behavior avoids + this, and this is good because the regex matcher is only partially + under our control. + + In addition, GNU sed supports several escape characters (some of + which are multi-character) to insert non-printable characters + in scripts (`\a', `\c', `\d', `\o', `\r', `\t', `\v', `\x'). These + can cause similar problems with scripts written for other seds. + + +-i clobbers read-only files + + In short, `sed d -i' will let one delete the contents of + a read-only file, and in general the `-i' option will let + one clobber protected files. This is not a bug, but rather a + consequence of how the Unix filesystem works. + + The permissions on a file say what can happen to the data + in that file, while the permissions on a directory say what can + happen to the list of files in that directory. `sed -i' + will not ever open for writing a file that is already on disk, + rather, it will work on a temporary file that is finally renamed + to the original name: if you rename or delete files, you're actually + modifying the contents of the directory, so the operation depends on + the permissions of the directory, not of the file). For this same + reason, sed will not let one use `-i' on a writeable file in a + read-only directory, and will break hard or symbolic links when + `-i' is used on such a file. + + +`0a' does not work (gives an error) + + There is no line 0. 0 is a special address that is only used to treat + addresses like `0,/RE/' as active when the script starts: if you + write `1,/abc/d' and the first line includes the word `abc', then + that match would be ignored because address ranges must span at least + two lines (barring the end of the file); but what you probably wanted is + to delete every line up to the first one including `abc', and this + is obtained with `0,/abc/d'. + + +`[a-z]' is case insensitive +`s/.*//' does not clear pattern space + + You are encountering problems with locales. POSIX mandates that `[a-z]' + uses the current locale's collation order -- in C parlance, that means + strcoll(3) instead of strcmp(3). Some locales have a case insensitive + strcoll, others don't. + + Another problem is that [a-z] tries to use collation symbols. This + only happens if you are on the GNU system, using GNU libc's regular + expression matcher instead of compiling the one supplied with GNU sed. + In a Danish locale, for example, the regular expression `^[a-z]$' + matches the string `aa', because `aa' is a single collating symbol that + comes after `a' and before `b'; `ll' behaves similarly in Spanish + locales, or `ij' in Dutch locales. + + Another common localization-related problem happens if your input stream + includes invalid multibyte sequences. POSIX mandates that such + sequences are _not_ matched by `.', so that `s/.*//' will not clear + pattern space as you would expect. In fact, there is no way to clear + sed's buffers in the middle of the script in most multibyte locales + (including UTF-8 locales). For this reason, GNU sed provides a `z' + command (for `zap') as an extension. + + However, to work around both of these problems, which may cause bugs + in shell scripts, you can set the LC_ALL environment variable to `C', + or set the locale on a more fine-grained basis with the other LC_* + environment variables. + diff --git a/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/COPYING b/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/COPYING new file mode 100644 index 0000000..4432540 --- /dev/null +++ b/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. 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 +them 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 prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. 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. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state 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 a brief 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 3 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, see <http://www.gnu.org/licenses/>. + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + <program> Copyright (C) <year> <name of author> + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +<http://www.gnu.org/licenses/>. + + The GNU 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. But first, please read +<http://www.gnu.org/philosophy/why-not-lgpl.html>. + diff --git a/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/ChangeLog b/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/ChangeLog new file mode 100644 index 0000000..dcfb5f5 --- /dev/null +++ b/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/ChangeLog @@ -0,0 +1,3185 @@ +2009-06-27 Paolo Bonzini <bonzini@gnu.org> + + * configure.ac: Bump version. + * NEWS: Bump version. + * gnulib: Update. + * doc/sed.1: Regenerate. + +2009-06-25 Paolo Bonzini <bonzini@gnu.org> + + * autoboot.conf: Add selinux-h. + * execute.c: Copy over file creation context before creating a new file. + +2009-06-25 Paolo Bonzini <bonzini@gnu.org> + + * execute.c: Do not copy ACLs until the file is copied. + * utils.c (ck_mkstemp): Set a restrictive umask on temporary files. + +2009-06-26 Paolo Bonzini <bonzini@gnu.org> + + * autoboot: Do not use GIT_CONFIG_LOCAL. + +2009-06-15 Paolo Bonzini <bonzini@gnu.org> + + * autoboot.conf: Add memchr again. + * gnulib: Update. + +2009-06-11 Sergey Farbotka <z8sergey8z@gmail.com> (tiny change) + + * sed/execute.c (open_next_file): Fix off-by-one causing problems + under Cygwin. + +2009-05-11 Paolo Bonzini <bonzini@gnu.org> + + * sed/compile.c (snarf_char_class): Fix logic bug with [[[ in regular + expressions (and a possibly uninitialized use of variable delim stemming + from the bug). Uninitialized variable bug reported by Zhongxing Xu. + * testsuite/brackets.good: New. + * testsuite/brackets.inp: New. + * testsuite/brackets.sed: New. + * testsuite/Makefile.am: Add test. + * testsuite/Makefile.tests: Add test. + +2009-05-11 Paolo Bonzini <bonzini@gnu.org> + + * configure.ac: Define COPYRIGHT_YEAR. + * Makefile.am (dist-hook): Test it. + * sed/mbcs.c: Fix copyright years. + * sed/sed.c: Fix copyright years. Change COPYRIGHT_NOTICE to + COPYRIGHT_YEAR. + * sed/utils.c: Fix copyright years. + * testsuite/version.gin: Use COPYRIGHT_YEAR. + +2009-04-30 Paolo Bonzini <bonzini@gnu.org> + + * sed/compile.c: Declare bool arguments as int instead to please AIX XLC. + * sed/execute.c: Declare bool arguments as int instead to please AIX XLC. + * sed/utils.c: Declare bool arguments as int instead to please AIX XLC. + * sed/utils.h: Declare bool arguments as int instead to please AIX XLC. + +2009-04-27 Paolo Bonzini <bonzini@gnu.org> + + * configure.ac: Bump version number. + * configure: Regenerate. + +2009-04-27 Paolo Bonzini <bonzini@gnu.org> + + * configure.ac: Do not create homonymous links from builddir to srcdir. + * testsuite/Makefile.tests: Create readin.in2 here. + * testsuite/Makefile.am: Do not distribute it. + +2009-04-27 Paolo Bonzini <bonzini@gnu.org> + + * autoboot.conf: Add rename. + * gnulib: Update. + +2009-04-27 Paolo Bonzini <bonzini@gnu.org> + + * configure.ac: XFAIL UTF-8 tests where appropriate. + +2009-04-27 Paolo Bonzini <bonzini@gnu.org> + + * testsuite/Makefile.tests: Handle CRLF endings for mingw. + +2009-04-27 Paolo Bonzini <bonzini@gnu.org> + + * configure.ac: Link readin.in2 into builddir. + * configure: Regenerate. + * doc/Makefile.am: Do not distribute sed.html. Do not update + sed.texi if the output does not change. + * sed/Makefile.am: Order libraries according to their dependencies. + * sed/compile.c (get_openfile): Declare FAIL as int. + * sed/sed.c: Avoid printf ("") if REG_PERL is not defined. + * testsuite/eval.in2: Do not include in the repository. + * testsuite/Makefile.am: Clean always eval.in2 and never readin.in2. + * testsuite/Makefile.tests: Provide a default empty definition of TIME + and remove rules for readin.in2. + +2009-03-31 Paolo Bonzini <bonzini@gnu.org> + + * bootstrap.sh.in: Add __bool_true_false_are_defined. + * bootstrap.sh: Regenerate. + * basicdefs.h: Do not provide bool definitions for BOOTSTRAP at all. + +2009-03-31 Paolo Bonzini <bonzini@gnu.org> + + * sed/sed.c (contact): New. + (usage): From here. + (main): Use it for `sed --version' too. + + * configure.ac: Point to GNU project mailing lists. + * sed/sed.c (contact): Use PACKAGE_BUGREPORT. + * testsuite/version.gin: Likewise. + * testsuite/version.good: Regenerate. + * doc/sed.1: Regenerate. + + * bootstrap.sh.in (PACKAGE_BUGREPORT): New. + * bootstrap.sh: Regenerate. + +2009-03-31 Paolo Bonzini <bonzini@gnu.org> + + * testsuite/Makefile.am: Distribute utf8-3 and utf8-4 test files. + +2009-02-17 Paolo Bonzini <bonzini@gnu.org> + + * testsuite/Makefile.tests: Rewrite rule for utf8-[1234]. + Reported by Ralf Wildenhues. + +2009-02-17 Paolo Bonzini <bonzini@gnu.org> + + * sed/sed.c (usage): Print homepage URL. + * testsuite/version.gin: Update. + +2009-01-28 Paolo Bonzini <bonzini@gnu.org> + + * sed/sed.c (usage): Only print the bug report address for `sed --help'. + (main): Print it for `sed --version' too. + * testsuite/version.gin: Adapt. + * testsuite/Makefile.tests: Refine help message test. + +2009-01-23 Paolo Bonzini <bonzini@gnu.org> + Hideo AOKI <hideo.aoki.tk@hitachi.com> + + * sed/compile.c (match_slash): Fix MBCS behavior. + * sed/sed.h (MBSINIT): New. + +2009-01-20 Paolo Bonzini <bonzini@gnu.org> + + * autoboot.conf, bootstrap.sh.in: Remove memchr, memcmp, memmove + compatibility code. + * gnulib: Update. + +2009-01-09 Paolo Bonzini <bonzini@gnu.org> + + * tests/SPENCER.tests: Add testcases for glibc bugzilla 697. + * gnulib: Update. + +2009-01-05 Paolo Bonzini <bonzini@gnu.org> + + * execute.c (read_pattern_space): Reset hold space at end-of-file + if input->reset_at_next_file. + +2008-12-31 Ralf Wildenhues <Ralf.Wildenhues@gmx.de> + + Let --posix turn off more GNU extensions. + * sed/compile.c (mark_subst_opts): Turn off subst options i, I, + s, S, x, X, m, and M in --posix mode. + (compile_address): Disallow address modifiers, `FIRST~STEP', + `ADDR1,+N', and `ADDR1,~N' in --posix mode. + (compile_program): In --posix mode, do not accept e or z commands; + do not accept text between an a, c, or i command and the following + backslash; do not accept an argument to the l command. + +2008-12-22 Paolo Bonzini <bonzini@gnu.org> + + * autoboot.conf: Request modules emulating mb functions. + * configure.ac: Do not look for mb functions here. + +2008-10-03 Paolo Bonzini <bonzini@gnu.org> + Jim Meyering <meyering@redhat.com> + + * autoboot.conf: Add localcharset. + * Makefile.am: Remove intl subdir. Require Automake 1.10. + * configure.ac: Remove useless macros, switch to external gettext. + * lib/Makefile.am: Remove intl subdir from CPPFLAGS. + * sed/Makefile.am: Remove intl subdir from CPPFLAGS. + +2008-10-02 Paolo Bonzini <bonzini@gnu.org> + + * autoboot: Sync with gnulib's build-aux/bootstrap. + +2008-09-29 Paolo Bonzini <bonzini@gnu.org> + + * autoboot: Sync with gnulib's build-aux/bootstrap. + +2008-09-29 Paolo Bonzini <bonzini@gnu.org> + + * testsuite/Makefile.am: Add the utf8-{1,2,3,4} tests. + * testsuite/Makefile.tests: Add the utf8-{1,2,3,4} tests. + * testsuite/runtest: Support skipping tests. + * testsuite/utf8-1.good: New. + * testsuite/utf8-1.inp: New. + * testsuite/utf8-1.sed: New. + * testsuite/utf8-2.good: New. + * testsuite/utf8-2.inp: New. + * testsuite/utf8-2.sed: New. + * testsuite/utf8-3.good: New. + * testsuite/utf8-3.inp: New. + * testsuite/utf8-3.sed: New. + * testsuite/utf8-4.good: New. + * testsuite/utf8-4.inp: New. + * testsuite/utf8-4.sed: New. + +2008-09-29 Paolo Bonzini <bonzini@gnu.org> + + * BUGS: Document s/.*.// behavior with invalid multibyte sequences. + * NEWS: Document `z' extension. + * doc/sed-in.texi: Document both things. + * sed/compile.c (compile_program): Recognize `z'. + * sed/execute.c (execute_program): Execute `z'. + * testsuite/Makefile.am: Add badenc test. + * testsuite/Makefile.tests: Add badenc test. + * testsuite/badenc.good: New. + * testsuite/badenc.inp: New. + * testsuite/badenc.sed: New. + +2008-09-28 Paolo Bonzini <bonzini@gnu.org> + + * basicdefs.h: Replace alloca cruft with alloca.h. + * bootstrap.sh.in: Update for new gnulib. + * bootstrap.sh: Update for new gnulib. + * configure.ac: Move gnulib macros earlier. + * sed/execute.c: Do not include acl.h when bootstrapping. + +2008-08-27 Paolo Bonzini <bonzini@gnu.org> + + * sed/execute.c (closedown): Close the input file! + +2008-08-20 Paolo Bonzini <bonzini@gnu.org> + + * configure.ac: Add gl_DISABLE_THREADS. + +2008-08-20 Ralf Wildenhues <ralf.wildenhues@gmx.de + + * doc/sed-in.texi: Drop leading whitespace where appropriate, + do not use TABs. + * doc/sed.texi: Regnerate. + +2008-08-19 Paolo Bonzini <bonzini@gnu.org> + + * sed/compile.c: Do not include strverscmp.c. + +2008-07-21 Paolo Bonzini <bonzini@gnu.org> + + * doc/sed-in.texi: Remove northpark.edu address for sed FAQ. + * doc/sed.texi: Regenerate. + +2008-07-10 Paolo Bonzini <bonzini@gnu.org> + + * doc/sed-in.texi: Make the description of ^ and $ more precise. + * doc/sed.texi: Regenerate. + +2008-06-04 Vladimir Marek <vladimir.marek@sun.com> + + * basicdefs.h: Don't hardcode usage of prototypes on SunStudio. + +2008-05-15 Paolo Bonzini <bonzini@gnu.org> + + * autoboot.conf: Update for newer gnulib. + +2008-05-15 Paolo Bonzini <bonzini@gnu.org> + + * bootstrap.sh.in: Define bool, true, false. Reported by + Jason Stover. Adjust for gnulib changes. + * bootstrap.sh: Regenerate. + +2008-04-24 Paul Eggert <eggert@twinsun.com> + + * sed/compile.c (match_slash): Treat 's&foo&\&&' compatibly with + traditional 'sed'. + * testsuite/bsd.sh: Add test case for this. + * testsuite/bsd.good: Add test case output. + +2008-04-24 Paolo Bonzini <bonzini@gnu.org> + + * sed/compile.c (setup_replacement): Fix bug with \& in POSIX mode. + +2008-01-16 Jim Meyering <meyering@redhat.com> + + * sed/execute.c (open_next_file, get_backup_file_name): Avoid + warnings from gcc. + +2008-01-16 Jim Meyering <meyering@redhat.com> + + * sed/compile.c (snarf_char_class): Reverse order of conjuncts + so that "delim" is not used uninitialized. + +2008-01-16 Jim Meyering <meyering@redhat.com> + + * sed/utils.c (panic): Remove declaration of unused local, "fd". + +2008-01-16 Jim Meyering <meyering@redhat.com> + + * sed/execute.c (open_next_file, get_backup_file_name): Avoid + warnings from gcc. Avoid shadowing global "pipe". + +2008-01-16 Jim Meyering <meyering@redhat.com> + + * autoboot.conf (gnulib_modules): Add stat-macros and pathmax. + +2007-10-25 Paolo Bonzini <bonzini@gnu.org> + Mike Frysinger <vapier@gentoo.org> + + * doc/sed.x (q, Q): Document argument. + * configure.ac: Remove texi2html checks. + * doc/Makefile.am: Remove rules for sed.html, always distribute it. + +2007-08-14 Paolo Bonzini <bonzini@gnu.org> + + * sed/execute.c (open_next_file): Follow symlink here... + (closedown): ... not here. + +2007-06-29 Paolo Bonzini <bonzini@gnu.org> + + * sed/mbcs.c: Upgrade to GPLv3. + * sed/regexp.c: Upgrade to GPLv3. + * sed/sed.c: Upgrade to GPLv3. + * sed/sed.h: Upgrade to GPLv3. + * sed/utils.c: Upgrade to GPLv3. + * sed/utils.h: Upgrade to GPLv3. + * sed/compile.c: Upgrade to GPLv3. + * sed/execute.c: Upgrade to GPLv3. + * sed/fmt.c: Upgrade to GPLv3. + +2007-03-01 Masatake YAMATO <jet@gyve.org> (tiny change) + + * sed/compile.c (compile_program): Accept 0,/REGEXP/ address + specification only if --posix is not specified. + +2007-02-05 Paolo Bonzini <bonzini@gnu.org> + + * testsuite/bug-regex27.c, testsuite/bug-regex28.c: New, from + glibc (written by Jakub Jelinek). + +2007-01-26 Paolo Bonzini <bonzini@gnu.org> + + * sed/compile.c (check_final_program): Don't set text if the + pending_text is initialized but empty. + * sed/execute.c (output_line): Don't print text if it is NULL. + * testsuite/Makefile.am (TESTS): Add insert. + * testsuite/Makefile.tests (insert): New. + * testsuite/insert.good, testsuite/insert.sed, testsuite/insert.inp: New + testcase from Jonas Koelker. + +2006-12-29 Paolo Bonzini <bonzini@gnu.org> + + * sed/compile.c: Fix warnings. + * sed/execute.c: Fix warnings. + +2006-12-22 Bruno Haible <bruno@clisp.org> + + * sed/utils.c: Include pathmax. + * sed/mbcs.c: Use local_charset. + * sed/execute.c: Copy with padding after the mbstate_t member. + +2006-12-21 Paolo Bonzini <bonzini@gnu.org> + + * sed/mbcs.c: Include string.h (reported by Henning Nielsen Lund). + * sed/fmt.c: Likewise. + * sed/regexp.c: Likewise. + +2006-12-18 Paolo Bonzini <bonzini@gnu.org> + + * sed/execute.c (closedown): Remove dead code. + +2006-12-17 Paolo Bonzini <bonzini@gnu.org> + + * sed/utils.c: Include limits.h. + +2006-12-16 Paolo Bonzini <bonzini@gnu.org> + + * doc/sed-in.texi: Document --follow-symlinks. + +2006-12-15 Paolo Bonzini <bonzini@gnu.org> + + * sed/regexp.c: Disable all extensions on --posix. + +2006-09-24 Paolo Bonzini <bonzini@gnu.org> + + * sed/execute.c: Support ACLs. + * lib/utils.c: Move... + * sed/utils.c: ... here, and remove xmalloc. + +2006-08-21 Paolo Bonzini <bonzini@gnu.org> + + * sed/regexp.c: Accept NUL bytes for `.'. Accept 'a\(b' in + POSIXLY_CORRECT/POSIXLY_BASIC posixicity. + +2006-08-03 Paolo Bonzini <bonzini@gnu.org> + + Revert this part of the previous change: + + 2006-08-03 Paolo Bonzini <bonzini@gnu.org> + + * sed/compile.c (get_openfile): Change second argument to char + and turn it into a string within the function. Adjust callers. + +2006-08-03 Paolo Bonzini <bonzini@gnu.org> + Corinna Vinschen <vinschen@redhat.com> + + * lib/getline.c (getline): Remove Windows special casing. + * lib/utils.c (register_open_file, ck_fdopen): New. + (ck_fopen, ck_mkstemp): Use register_open_file. + * lib/utils.h (ck_fdopen): New. + * sed/execute.c (open_next_file): Reopen stdin. + * sed/sed.h (read_mode): New. + * sed/sed.c (read_mode): New. + (main): Set it on --binary. + (usage): Document --binary. + * sed/compile.c (get_openfile): Change second argument to char + and turn it into a string within the function. Adjust callers. + * sed/execute.c (dump_append_queue, open_next_file): Use it + as mode for ck_fopen. + +2006-08-03 Paolo Bonzini <bonzini@gnu.org> + + * sed/execute.c (str_append): Use is_utf8 to skip useless work. + * sed/mbcs.c (initialize_mbcs): Look for a UTF-8 locale. + (is_utf8): New. + * sed/sed.h (is_utf8): New. + +2006-07-13 Paolo Bonzini <bonzini@gnu.org> + + * bootstrap.sh.in: Add a few autoconfy tests. + * Makefile.am: Update distributed bootstrap.sh. + +2006-05-15 Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de> + + * sed/basicdefs.h (OB_MALLOC): Turn VCAST into void * cast. + +2006-02-03 Paolo Bonzini <bonzini@gnu.org> + + * sed/compile.c (compile_program) <case 'y'>: Pass false to match_slash. + +2005-09-07 Paolo Bonzini <bonzini@gnu.org> + + * lib/regcomp.c: Update from upstream. + * lib/regex.c: Update from upstream. + * lib/regex_.h: Update from upstream. + * lib/regex_internal.c: Update from upstream. + * lib/regex_internal.h: Update from upstream. + * lib/regexec.c: Update from upstream. + +2005-08-30 Paolo Bonzini <bonzini@gnu.org> + + * sed/execute.c (reset_addresses): Never activate ADDR_IS_NUM_MOD + addresses. + * testsuite/modulo.good, testsuite/modulo.inp, testsuite/modulo.sed: + New. + * testsuite/Makefile.tests: Add new testcase. + * testsuite/Makefile.am: Add new testcase. + * testsuite/Makefile.in: Regenerate. + +2005-05-18 Maciej W. Rozycki <macro@linux-mips.org> + + * configure.ac: Use a cache variable for the libcP test. + * configure: Regenerate. + +2005-05-16 Eero Hakkinen <eero17@bigfoot.com> + + * sed/compile.c (snarf_char_class): Fix handling of + [^]xyz]. + +2005-04-04 Paolo Bonzini <bonzini@gnu.org> + + * sed/execute.c (process_files): Do not add a default + command-line in in-place editing mode. + +2005-02-10 Paolo Bonzini <bonzini@gnu.org> + + * testsuite/Makefile.tests: Add new testcase. + * testsuite/Makefile.am: Add new testcase. + * testsuite/Makefile.in: Regenerate. + * testsuite/appquit.good, testsuite/appquit.inp, + testsuite/appquit.sed: New testcase. + * testsuite/readin.sed: Quit after the last r command. + * testsuite/readin.good: Adjust. + * sed/execute.c (execute_program): Dump the results of the + a/r/R commands just before quitting. + +2005-02-10 Paolo Bonzini <bonzini@gnu.org> + + * sed/regexp.c: Fix off-by-one error in the "invalid reference + to subexpression" message. Debian bug 294339. + +2005-02-08 Paolo Bonzini <bonzini@gnu.org> + + * lib/obstack.h: include config.h. + +2005-02-01 Paolo Bonzini <bonzini@gnu.org> + + * doc/Makefile.am: Don't enable MAKEINFO_HTML and TEXI2HTML_HTML + rules unless BUILD_HTML. + +2005-01-25 Paolo Bonzini <bonzini@gnu.org> + + * sed/regexp.c: Fix building on GCC 2.95 and earlier. + +2004-12-26 Paolo Bonzini <bonzini@gnu.org> + + Do not use leftmost-longest matching for addresses. + + * NEWS: Add a note about this. + * testsuite/recall2.good, testsuite/recall2.inp, + testsuite/recall2.sed: New test. + * testsuite/Makefile.am, testsuite/Makefile.tests: Add the + recall2 test. + * sed/sed.h (struct regex): New. + (struct addr, struct subst, compile_regex, match_regex, + release_regex): Use it instead of regex_t. + * sed/compile.c (compile_program): Update for new meaning of + the third parameter of compile_regex. + * sed/execute.c (do_subst): Pass less conservative value to + the regsize parameter of match_regex. + * sed/regexp.c (compile_regex_1): New, extracted out of + compile_regex. The third parameter, needed_sub, now includes + \0 (so 10 means that \0 .. \9 are needed). Pass RE_NO_SUB + if needed_sub is zero. + (compile_regex): Accept a struct regex instead of a regex_t. + Save the regular expression's text. + (match_regex): Accept a struct regex instead of a regex_t. + Recompile the pattern if it was compiled with RE_NO_SUB. + (release_regex): Accept a struct regex instead of a regex_t. + + * doc/Makefile.am: Generate sed.texi correctly when + building outside srcdir. + +2004-12-26 Paolo Bonzini <bonzini@gnu.org> + + * BUGS: Add section about [a-z] matching uppercase characters, + and other locale issues. + * doc/sed-in.texi [!PERL]: Likewise. + +2004-11-15 Paolo Bonzini <bonzini@gnu.org> + + * sed/execute.c (str_append_modified): Copy the first character + when using \l or \u in a multi-byte configuration. Use + WCRTOMB instead of wcrtomb. + * sed/sed.h (WCRTOMB): New. + +2004-11-11 Paolo Bonzini <bonzini@gnu.org> + + * tst-rxspecer.c: Do not mix instructions and + declarations. + * basicdefs.h: Include locale.h before #defining + gettext, to avoid breakage under Solaris. + * sed/sed.c: do not include locale.h. + +2004-11-03 Paolo Bonzini <bonzini@gnu.org> + + * bug-regex11.c: Improve portability. + * bug-regex12.c: Improve portability. + * bug-regex13.c: Improve portability. + * bug-regex14.c: Improve portability. + * bug-regex21.c: Improve portability. + * bug-regex9.c: Improve portability. + * tst-boost.c: Improve portability. + * tst-pcre.c: Improve portability. + * tst-regex.c: Improve portability. + * tst-rxspencer.c: Improve portability. + +2004-10-08 Paolo Bonzini <bonzini@gnu.org> + + * lib/utils.c (utils_id_s): Renamed to open_files. + (struct id): Renamed to struct open_file. + +2004-10-08 Jakub Jelinek <jakub@redhat.com> + + * testsuite/Makefile.tests (bug-regex*, run-tests, + run-ptests): Use $(SED). + (version): Likewise; prepend $(SED) invocation with $(SEDENV). + +2004-08-16 Paolo Bonzini <bonzini@gnu.org> + + *** Version 4.1.2 released. + +2004-08-06 Paolo Bonzini <bonzini@gnu.org> + + * sed/compile.c (bad_command): Fix off-by-one error. + (snarf_char_class): Fix problem with [.....[] (i.e. + last char in class is a bracket. + +2004-06-30 Paolo Bonzini <bonzini@gnu.org> + + *** Version 4.1.1 released. + +2004-06-29 Paolo Bonzini <bonzini@gnu.org> + + * sed/compile.c (mark_subst_opts): Return int. + * sed/execute.c (open_next_file): Fix uninitialized + variable. + +2004-06-10 Paolo Bonzini <bonzini@gnu.org> + + *** Version 4.1 released. + +2004-03-25 Paolo Bonzini <bonzini@gnu.org> + + * lib/obstack.h: Get current version. + +2004-03-13 Paolo Bonzini <bonzini@gnu.org> + + Exit as soon as possible on an I/O error, and with + a better error message. + + * lib/utils.c (ck_mkstemp, ck_rename, ck_getline): New + functions. Save temporary files into utils_id_s. + (struct id): Add a field named temp. + (ck_fopen): Init the new temp field of struct id. + (panic): Unlink temporary files before exiting. + * sed/execute.c (read_file_line): Use ck_getline. + (closedown): Use ck_rename. + (open_next_file): Use ck_mkstemp. + +2004-01-20 Paolo Bonzini <bonzini@gnu.org> + + * sed/sed.h (enum addr_state): New definition. + (enum addr_type): Remove ADDR_IS_NUM2. + (struct sed_cmd): Replace a1_matched with range_state. + * sed/compile.c (next_cmd_entry): Use range_state. + (compile_program): Death to ADDR_IS_NUM2. Compile + N,Mp as Np if N>=M. + * sed/execute.c (match_address_p): Rewritten. Handle + ADDR_IS_NUM here. + (match_an_address_p): Suit to new match_address_p. + (execute_program): Adjust to use range_state in `c'. + Handle addr_bang here. + (reset_addresses): Use range_state. + + (struct input): New field "reset_at_next_file". + (read_pattern_space): Use it instead of "separate_files". + (process_files): Initialize it. + +2004-01-17 Paolo Bonzini <bonzini@gnu.org> + + * sed/sed.h: Do not include wchar.h and wctype.h, and do + not include the alloca stuff. + * basicdefs.h: Move all that here. + +2004-01-15 Paolo Bonzini <bonzini@gnu.org> + + * sed/regexp.c [REG_PERL]: Use REG_STARTEND instead of regexec2. + +2004-01-09 Paul Eggert <eggert@twinsun.com> + Paolo Bonzini <bonzini@gnu.org> + + * sed/sed.h (posixicity): New variable, replaces POSIXLY_CORRECT. + * sed/sed.c (main): Set it. + * sed/compile.c: Use it instead of POSIXLY_CORRECT. + * sed/execute.c: Use it instead of POSIXLY_CORRECT. + * doc/sed-in.texi: Document it and --posix. + +2004-01-05 Paul Eggert <eggert@twinsun.com> + Paolo Bonzini <bonzini@gnu.org> + + * NEWS: Fix [\n] to match either backslash or n in POSIXLY_CORRECT mode. + * doc/sed-in.texi: Document this. Also, document regular expressions + a bit better overall, using terminology that's more similar to POSIX. + * sed/sed.h (enum text_types): New definition. + * sed/compile.c (normalize_text): Replace final parameter with one of + type normalize_text. If TEXT_REGEX and in POSIXLY_CORRECT mode, + grok character classes without replacing \n inside them. + +2004-01-03 Paolo Bonzini <bonzini@gnu.org> + + * sed/execute.c (execute_program): print final line + after executing N, if not POSIXLY_CORRECT. + +2003-12-28 Paolo Bonzini <bonzini@gnu.org> + + * sed/compile.c: fix "\\\n" in RHS of s command. + Reported by Mike Castle. + * testsuite/bkslashes.inp, testsuite/bkslashes.good, + testsuite/bkslashes.sed: New files. + * testsuite/Makefile.am, testsuite/Makefile.tests: Add + the bkslashes test. + +2003-12-16 Paolo Bonzini <bonzini@gnu.org> + + *** Version 4.0b released. + + * sed/mbcs.c: New file. + * sed/sed.h: Declare macros for mbcs.c. + * sed/compile.c: Use them. + (brlen): Moved to mbcs.c. + * sed/execute.c: Use them. + * sed/sed.c: call initialize_mbcs (). + +2003-12-14 Paolo Bonzini <bonzini@gnu.org> + + * sed/regex.c (match_regex): fix memory leak. + +2003-11-27 Paolo Bonzini <bonzini@gnu.org> + + * sed/execute.c (reset_addresses): leave addresses 0 + and 0~STEP enabled. + +2003-11-15 Jakub Jelinek <jakub@redhat.com> + + * sed/regex.c: Use fastmap. + +2003-09-21 Paolo Bonzini <bonzini@gnu.org> + + *** Version 4.0a released. + + * sed/execute.c (struct line): Add mbstate field. + (str_append): Keep mbstate up to date. + (str_append_modified): Likewise, and use towupper/towlower. + (line_init): Initialize mbstate. + (line_copy): Copy mbstate. + (line_append): Copy mbstate. + +2003-07-15 Stepan Kasal <kasal@ucw.cz> + Paolo Bonzini <bonzini@fnu.org> + + Change the way we treat lines which are not terminated by a newline. + Such lines are printed without the terminating newline (as before) + but as soon as more text is sent to the same output stream, the + missing newline is printed, so that the two lines don't concatenate. + + * sed/execute.c (output_file): Is now struct output; users adjusted + to access the fp field, call output_missing_newline before, and + call flush_output afterwards. + (read_file_line): Set line.chomped FALSE each time we encounter a + line without the newline terminator, no matter whether this is the + last input file or not, and no matter whether we are in + POSIXLY_CORRECT mode or not. + (output_missing_newline): New function which prints the suppressed + newline, if necessary. + (flush_output): New function for a common pattern. + (output_line): Use struct output, set its flag accordingly. + (dump_append_queue): Use `ck_fwrite' instead of output_line. + (do_list): Flush the output stream at the end. + (closedown): The code ``if(separate_files) rewind_read_files();'' + (read_pattern_space): ... has been moved here. + (process_files): Don't do the default `p' at the end, ... + (execute_program): ... as this function is now responsible for it; + add the code to the end of the function and to the command `q'; + the commands `d', `D' and `Q' thus no longer have to forge an empty + line. + (execute_program): Commands `c' and `i' no longer call the + function output_line with chomped==FALSE; instead, they chomp + the text and call the function with chomped==TRUE. + (execute_program): Command `e' no longer uses output_line; it + calls ck_fwrite directly. Commands `e', `L' and `=' flush + the output stream at the end. + * sed/compile.c (special_files): Use `struct output' instead of the + file name. + (get_openfile): ... special files are no longer copied to file_read + or file_write. + (fp_list): Move to sed.h (users adjusted) and rename as... + * sed/sed.h (struct output): ...this. New flag missing_newline + associated to the output stream. + (struct sed_cmd, struct subst): Use `struct output *' instead of mere + `FILE *'; adjust compile.c and execute.c. + * testsuite/noeolw.sed, testsuite/noeolw.good, testsuite/noeolw.1good, + testsuite/noeolw.2good: New tests + +2003-07-15 Stepan Kasal <kasal@ucw.cz> + + * lib/utils.h, sed/sed.h: #include "basicdefs.h", + don't include it from various *.c files. + * sed/regex.c: Don't include regex.h as it's included via sed.h. + +2003-06-11 Paolo Bonzini <bonzini@gnu.org> + + * lib/getline.c: Don't realloc with first param = NULL. + +2003-05-07 Paolo Bonzini <bonzini@gnu.org> + + * sed/execute.c: Make treatment of ADDR_IS_NUM_MOD + simpler, and fix bugs in 0~5,+1 + * sed/compile.c: Complain about addresses like 0 + and 0,3 which are sources of misunderstandings. + Reported by Akim Demaille <akim@epita.fr> + +2003-03-25 Paolo Bonzini <bonzini@gnu.org> + + *** Version 4.0.7 released + + * sed/execute.c (append_replacement): Extract from + do_subst + (do_subst): Don't update count when a match was + skipped. + * testsuite/xbxcx3.good, testsuite/xbxcx3.sed, + testsuite/xbxcx3.inp: Regression tests + +2003-03-23 Paolo Bonzini <bonzini@gnu.org> + + * sed/execute.c (do_subst): Fix several bugs with + numbered matches + * testsuite/numsub2.good, testsuite/numsub2.inp, + testsuite/numsub2.sed, testsuite/numsub3.good, + testsuite/numsub3.inp, testsuite/numsub3.sed, + testsuite/numsub4.good, testsuite/numsub4.inp, + testsuite/numsub4.sed, testsuite/numsub5.good, + testsuite/numsub5.inp, testsuite/numsub5.sed: + regression tests for the bugs + +2003-03-15 Paolo Bonzini <bonzini@gnu.org> + + *** Version 4.0.6 released + + * lib/mkstemp.c: Include sys/file.h if available for the + benefit of Ultrix + +2003-03-14 Paolo Bonzini <bonzini@gnu.org> + + * sed/compile.c: Replace flagT with bool + * sed/execute.c: Replace flagT with bool + * sed/fmt.c: Replace flagT with bool + * sed/sed.c: Replace flagT with bool + * sed/regex.c: Replace flagT with bool + +2003-03-13 Paolo Bonzini <bonzini@gnu.org> + + * sed/compile.c (compile_program): Understand parameter + of `v'. + + * sed/sed.c (usage): Split help message into multiple + strings + (main): Don't understand -h and -V + +2003-03-12 Paolo Bonzini <bonzini@gnu.org> + + * sed/compile.c (match_slash, snarf_char_class): More + multibyte character support + (brlen): New function + * testsuite/classes.good, testsuite/classes.inp, + testsuite/classes.sed: New files + +2003-03-10 Paolo Bonzini <bonzini@gnu.org> + + * sed/compile.c (match_slash): Strip the \ in front of + slashes (so that the matcher sees x/ for s/x\///). Don't + match / and [ unless at the start of a character. + +2003-02-18 Paolo Bonzini <bonzini@gnu.org> + + * sed/regex.c (compile_regex): // matches the last regular + expression even in POSIXLY_CORRECT mode. + * sed/compile.c (normalize_text): Treat multibyte character + sets correctly + (read_text): Don't swallow backslash sequences, run text + through normalize_text + (compile_program): Ditto for y command + + * sed/compile.c (normalize_text): Add parameter that says + whether the text will be processed further to remove more + backslash escapes. Callers adjusted + (match_slash): Remove same parameter from here. Callers adjusted. + +2003-02-15 Paolo Bonzini <bonzini@gnu.org> + + * sed/sed.h: Fix prototype for match_regex, declare re_registers + if REG_PERL + * sed/execute.c (do_subst): Use re_registers + * sed/regex.c (copy_regs): New function + [REG_PERL]: Use re_registers + [!REG_PERL]: Avoid using internal entry points, support pre-glibc + 2.3 regex for the sake of --without-included-regex. + +2003-01-04 Paolo Bonzini <bonzini@gnu.org> + + * sed/sed.h: Move some stuff from here... + * sed/basicdefs.h: ...to here + * lib/utils.c (ck_fopen): Add FAIL parameter + * lib/utils.h: Adjust parameter + * sed/compile.c, sed/execute.c, sed/sed.c: Adjust callers + + * sed/basicdefs.h: Add TRUE/FALSE + * sed/compile.c, sed/execute.c, sed/sed.c: Use them + * sed/fmt.c: Do not redefine them + +2003-01-02 Paolo Bonzini <bonzini@gnu.org> + + * sed/sed.c: Bump copyright year + +2002-12-24 Paolo Bonzini <bonzini@gnu.org> + + * sed/sed.c: Use bindtextdomain + * sed/basicdefs.h [__EMX__]: Define initialize_main + * lib/getline.c [__EMX__]: Strip trailing CR + + * sed/regex.c: Don't use N_ on the lines that define + error messages, some compilers complain. + +2002-12-18 Paolo Bonzini <bonzini@gnu.org> + + *** Version 4.0.5 released + + * sed/compile.c: Don't use N_ on the lines that define + error messages, some compilers complain. + +2002-12-16 Paolo Bonzini <bonzini@gnu.org> + + * sed/compile.c: Improvements to some error messages; + `a', `i', `l', `L', `r' accept two addresses except in + POSIXLY_CORRECT mode. + +2002-12-14 Paolo Bonzini <bonzini@gnu.org> + + * lib/regex_internal.c: Fix problem on non-glibc + systems, from Jakub Jelinek + * lib/regex.c (RE_ENABLE_I18N): Conditionalize on + HAVE_MBRTOWC and HAVE_WCRTOMB. + * lib/getline.c: Fix compilation on non-glibc system + * lib/snprintf.c: Fix compilation on non-glibc system + * lib/basicdefs.h [P_]: Make more portable + +2002-12-12 Paolo Bonzini <bonzini@gnu.org> + + *** Version 4.0.4 released + +2002-11-21 Paolo Bonzini <bonzini@gnu.org> + + *** Version 4.0.3 released + +2002-11-19 Paolo Bonzini <bonzini@gnu.org> + + *** Version 4.0.2 released + +2002-11-05 Paolo Bonzini <bonzini@gnu.org> + + *** Version 4.0.1 released + +2002-10-23 Paolo Bonzini <bonzini@gnu.org> + + *** Version 4.0 released + +2002-10-28 Paolo Bonzini <bonzini@gnu.org> + + * lib/utils.c: Don't fail for EBADF in fflush + * src/sed.c: the_program is now a global + +2002-10-19 Paolo Bonzini <bonzini@gnu.org> + + * src/sed.c: Print GNU sed in --version for GNU sed, + and super-sed for super-sed (thanks to Bruno Haible) + +2002-10-17 Paolo Bonzini <bonzini@gnu.org> + + *** Version 3.96 released + +2002-10-16 Isamu Hasegawa <isamu@yamato.ibm.com> + + * src/execute.c (execute_program): Multibyte 'y' + * src/compile.c (compile_program): Likewise + * src/sed.h: Likewise + +2002-10-08 Paolo Bonzini <bonzini@gnu.org> + + *** Version 3.95 released + +2002-07-15 Paolo Bonzini <bonzini@gnu.org> + + * src/sed.h: rfile --> fname, wfile --> fp + * src/compile.c (compile_command): Parse 'R' like 'w', use + separate lists for file read and file write + * src/compile.c (get_openfile): New name of get_writefile + * src/compile.c (rewind_read_files): New function + * src/sed.h: Declared here + * src/execute.c (closedown): And called here + * src/execute.c (append_queue): Added 'free' field + * src/execute.c (execute_program): Implement 'R' + +2002-06-09 Paolo Bonzini <bonzini@gnu.org> + + * src/execute.c (do_subst): Replaced flag was set on every + regexp match, while the first matches should not set it + for s///N. + +2002-06-08 Paolo Bonzini <bonzini@gnu.org> + + * src/compile.c (compile_file): Open the script in text mode + * lib/utils.c (utils_fp_name): Shorten the output + * lib/utils.c (ck_fread, ck_fwrite, ck_fflush): Clearerr + after printing an error. + * lib/utils.c (ck_fclose): Work on stdout as well if stream == NULL + and flush before closing to check for errors + +2002-05-30 Paolo Bonzini <bonzini@gnu.org> + + * src/compile.c (compile_program): Implement W + * src/execute.c (execute_program): Likewise + +2002-04-23 Paolo Bonzini <bonzini@gnu.org> + + * src/sed.c (usage, main): Parse -s + * src/sed.h (separate_files): New variable + * src/execute.c (separate_files): New variable + * src/execute.c (reset_addresses): New function to make range + addresses work separately on each file when using in-place + editing + * src/execute.c (execute_program): The `n' and `N' use test_eof + so that the script restarts at end of file, not at end of input + * src/execute.c (test_dollar_EOF): Make $ work separately + on each file when using -s; renamed to test_eof + +2002-02-28 Paolo Bonzini <bonzini@gnu.org> + + * src/sed.h (struct sed_cmd): exit_status -> int_arg + * src/compile.c: Likewise + * src/execute.c: Likewise + + * src/compile.c (compile_command): Parse `l' like + `q' and `Q'; default for int_arg is -1 + * src/execute.c (do_list): New argument, used instead + of lcmd_out_line_len + (execute_program): Interpret int_arg for the `l' command; + return 0 for `q' and `Q' if int_arg is -1 + + * src/fmt.c: New file, looted from GNU textutils + * src/compile.c: Parse `L' + * src/execute.c: Execute `L' + +2002-02-14 Paolo Bonzini <bonzini@gnu.org> + + * src/execute.c (str_append_modified): Fixed a stupid + bug (stop condition was *start == *end, meant to be + start == end) + +2002-02-05 Paolo Bonzini <bonzini@gnu.org> + + * lib/utils.c: Added directory parameter to + temp_file_template + * lib/utils.h: Adjusted + * src/execute.c: Adjusted + +2002-01-29 Paolo Bonzini <bonzini@gnu.org> + + * src/compile.c (mark_subst_opts): Signal an error if + there are multiple g or p options + * src/compile.c (compile_program): Raise appropriate + error if second string in y command is longer than + first (used to be "excess junk after command") + +2001-12-31 Paolo Bonzini <bonzini@gnu.org> + + * lib/getline.c: Strip the terminating \r under Windows + or MS-DOS. + + * testsuite/xemacs.sed, testsuite/xemacs.inp, + testsuite/xemacs.good: Submitted by John Fremlin + (john@fremlin.de) + +2001-12-27 Paolo Bonzini <bonzini@gnu.org> + + * sed/execute.c (do_subst): Flags in optimized s/^xx/ + commands were discarded (see the change below) + +2001-12-19 Paolo Bonzini <bonzini@gnu.org> + + * sed/execute.c (resize_line): Limit inactive space to two + thirds of a buffer + * sed/execute.c (line_init): Initialize buf->active + * sed/execute.c (str_append, str_append_modified, line_copy, + do_list, do_subst, execute_program, process_files): Operate + on active space + + * sed/execute.c (do_subst): Optimize s/^xx// by making a part + of the buffer inactive and s/xx$// by truncating it. + * sed/execute.c (execute_program): Optimize D by making a part + of the buffer inactive + + * testsuite/uniq.sed, testsuite/uniq.inp, testsuite/uniq.good: + added to test P and D commands. + * testsuite/fasts.sed, testsuite/fasts.inp, testsuite/fasts.good: + added to test the new optimization done on the `s' command. + +2001-12-17 Paolo Bonzini <bonzini@gnu.org> + + * testsuite/dc.inp: Also compute Easter of 2002 :-) + + * sed/execute.c [!HAVE_FCHMOD]: Don't chmod the output file + if working in-place + +2001-11-12 Paolo Bonzini <bonzini@gnu.org> + + * sed/sed.h (struct sed_cmd): a1 is a pointer too + * sed/compile.c: Likewise + * sed/execute.c: Likewise + + * sed/compile.c: Use obstacks + * sed/execute.c: Likewise + +2001-11-09 Paolo Bonzini <bonzini@gnu.org> + + * sed/compile.c (mark_subst_opts): Parse option `e', + preserve two occurrences of the `e' and `p' options. + * sed/execute.c (do_subst) [HAVE_POPEN]: Interpret option + `e' (evaluate, like Perl's but uses Bourne shell). + * sed/sed.h (struct subst): Add an `eval' flag. + + * sed/compile.c (compile_program): Compile command `e' + like `c'. + * sed/execute.c (execute_program): Execute command `e'. + +2001-09-25 Paolo Bonzini <bonzini@gnu.org> + + * sed/compile.c (get_writefile) [!POSIXLY_CORRECT]: + support /dev/stdout + * sed/execute.c (open_next_file, closedown): Support + in-place editing + * sed/execute.c (backup_file_name): New function to + support in-place editing + * sed/main.c (usage, main): Parse -i. + * sed/utils.c: Moved to lib directory + + * lib/utils.c (temp_file_template): New function. + * sed/utils.h: Declared temp_file_template. + +2001-09-05 Paolo Bonzini <bonzini@gnu.org> + + * sed/execute.c (do_subst): `baaac', if passed through + s/a*/x/g, gave `xbxxcx' rather than `xbxcx' (because an + empty string matched before the `c'. Fixed. + + * sed/execute.c: Removed mmap support, I/O is done using + getline (slower but more bug-proof). + * sed/utils.c: Likewise. + * lib/getline.c: New file + +2001-03-22 Paolo Bonzini <bonzini@gnu.org> + + * sed/compile.c (normalize_text) [POSIXLY_CORRECT]: Enable + escapes in modes other than BRE. + +2001-03-21 Paolo Bonzini <bonzini@gnu.org> + + * sed/compile.c (normalize_text): Support \XXX in Perl mode, + \oXXX in non-Perl mode. + +2001-03-18 Paolo Bonzini <bonzini@gnu.org> + + * sed/compile.c (compile_program): Fixed missing break when + compiling 'q' and 'Q'. + + * sed/compile.c (check_final_program): Removed now spurious + call to compile_regex + * sed/regex.c (compile_regex): Don't track the last compiled + regex + * sed/regex.c (execute_regex): Track here the last compiled + regex + +2001-03-02 Paolo Bonzini <bonzini@gnu.org> + + * sed/compile.c (setup_replacement): Support \[lLuUE] like + Perl and vi. + * sed/compile.c (new_replacement): Accept new parameter + to support \[lLUuE]. + * sed/sed.h (enum replacement_types): New declaration + * sed/execute.c (do_subst): Use new function str_append_modified + to apply the changes required via \[lLUuE]. + * sed/execute.c (str_append_modified): New function + +2001-03-02 Paolo Bonzini <bonzini@gnu.org> + + * sed/compile.c (setup_replacement): Count the number of backreferences + that the RHS needs + * sed/regex.c (compile_regex): Check if there is a sufficient number + of backreferences (new argument needed_sub replaces nosub) + * sed/compile.c (compile_address, compile_program, + check_final_program): Callers adjusted + +2001-02-08 Paolo Bonzini <bonzini@gnu.org> + + * sed/compile.c (compile_program): Added `Q' (quit without output) + * sed/execute.c (execute_program): Ditto + + * sed/compile.c (compile_program): Fill in exit_status for `q' and `Q' + * sed/execute.c (execute_program): Return -1 for `go on', 0..255 + to set the exit status + * sed/execute.c (process_files): Interpret new convention for + execute_program, return sed's exit code + * sed/sed.c (main): Return process_files's exit code + * sed/sed.h (struct sed_cmd): Declare exit_status + +2001-01-07 Paolo Bonzini <bonzini@gnu.org> + + * sed/compile.c (compile_program): Added `T' (branch if failed) + * sed/execute.c (shrink_program, execute_program): Ditto + +2001-01-04 Paolo Bonzini <bonzini@gnu.org> + + * testsuite/Makefile.am: Use automake's implementation + of `make check'. Removed the test targets + * testsuite/Makefile.tests: Moved the test targets here + (new file). + * testsuite/runtest: New file + + * testsuite/Makefile.tests: `khadafy' test uses EREs. + + * testsuite/spencer.inp: Removed the ^* test + + * testsuite/spencer.sh: Don't rely on awk; more comments too + +2001-01-03 Paolo Bonzini <bonzini@gnu.org> + + * sed/compile.c(snarf_char_class) [REG_PERL]: Don't parse + `\n' specially + * sed/compile.c(match_slash) [REG_PERL]: Ditto + + * sed/compile.c(read_text) [REG_PERL]: Support [xX] modifiers + * sed/compile.c(mark_subst_opts) [REG_PERL]: Ditto + +2000-12-21 Paolo Bonzini <bonzini@gnu.org> + + * lib/snprintf.c [BOOTSTRAP]: Don't include stdio.h + * lib/strerror.c [BOOTSTRAP]: Don't include stdio.h + * sed/execute.c [!HAVE_ISATTY]: Don't buffer stdin + +2000-12-11 Paolo Bonzini <bonzini@gnu.org> + + * sed/compile.c(mark_subst_opts): Support [mMsS] flags + * sed/compile.c(read_text): Support [MS] flags for + addresses + * sed/regex.c(compile_regex): Support arbitrary flags for + regncomp. + + * sed/regex.c(compile_regex) [REG_PERL]: Don't call + normalize_text. + +2000-12-08 Paolo Bonzini <bonzini@gnu.org> + + * basicdefs.h: Moved here from the `sed' subdirectory. + + * configure.in: Removed crap to pick a regex engine. + Added snprintf to the AC_REPLACE_FUNCS call. + + * lib/snprintf.c: New file. + + * sed/regex.c(compile_regex): Use regncomp + * sed/regex.c(match_regex): Use regexec2 + + * sed/compile.c(compile_program): Implemented the `v' command. + + * sed/sed.c(main): Implemented the `r' and `R' options + + * sed/sed.h: Replaced use_extended_syntax_t with + extended_regexp_flags to support Perl regular expressions. + + * sed/execute.c(open_next_file): Don't mmap stdin (because + we cannot seek into it, so a redirected stdin's contents + would not be "eaten" by sed) + +Mon Aug 30 23:40:08 PDT 1999 Ken Pizzini <ken@gnu.org> + + *** Version 3.02.80 released + + * sed/execute.c(do_subst): lib/regex.c(re_search_2) seems to + want one extra backreference register; humor it. + + * sed/regex.c(compile_regex): work around some odd assumptions + that lib/regex.c(re_compile_pattern) makes about our desired + RE syntax. + + * configure.in: tweaked version to 3.02.80; added new entries + to the ALL_LINGUAS definition. + + * doc/sed.1, doc/sed.texi, BUGS: explicitly request the output + of sed --version in bug-reporting instructions. + + * doc/sed.texi: the old "informal seders list" is dead; document + the new sed-users mailing list instead (under Other Resources). + + +Thu Aug 19 23:27:54 PDT 1999 Ken Pizzini <ken@gnu.org> + + * sed/sed.h: Add explicit #include of "regex-sed.h" (rather + than relying on parent file doing so); change the "cmd_regex" + member of sed_cmd: make it a pointer (instead of a struct), + and change its name to cmd_subst; add prototypes for newly + exported functions bad_prog(), normalize_text(), compile_regex(), + match_regex(), and release_regex(); drop rx_testing variable. + + * sed/compile.c: move the compile_regex() function to regex.c; + export bad_prog() and normalize_text() functions; eliminate the + rx_testing debris; rename the NOLEAKS symbol to more descriptive + DEBUG_LEAKS; make cmd_regex to cmd_subst fixes (see above); + make use of newly abstracted release_regex() function. + + * sed/execute.c: abstract out the regex matching to + regex.c:match_regex(); NOLEAKS to DEBUG_LEAKS change; + cmd_regex to cmd_subst structure member name change. + + * sed/execute.c(do_subst): use re_registers/regoff_t instead of + regmatch_t to hold the backreference registers, make "offset" + always be relative to the beginning of the string (rather than + a delta from "start"), defer some matching bookkeeping (e.g., + not_bol_p) to match_regex(). + + * sed/sed.c(main): loose rx_testing variable; NOLEAKS + (aka DEBUG_LEAKS) code attempting to release + _nl_current_default_domain is problematic, so omit it. + + * sed/regex.c: new file --- abstracts out the interface to the + regex engine so that less conditional code is required in + compile.c and execute.c, and so as to make a change of engine + easier; implements compile_regex() (which looks an awful lot + like the one that used to live in compile.c), match_regex(), + and (if DEBUG_LEAKS is set) release_regex(). + +Sun Apr 18 04:40:46 PDT 1999 Ken Pizzini <ken@gnu.org> + + * sed/sed.c(main): conditionalize calls to setlocale() and + textdomain() to only occur if their support is needed/wanted. + +Sun Apr 18 03:01:46 PDT 1999 Ken Pizzini <ken@gnu.org> + + * bootstrap.sh: "foo || bar && baz" was not grouping like I + expected ("foo || (bar && baz)") under at least one shell, + so change the test for a pre-existing config.h file to an + if statement. + + * bootstrap.sh: added -DUSE_REGEX_GNU_H option to the + compiler invocation, to ensure that we get a usable + regex library included. + +Sun Apr 18 02:59:42 PDT 1999 Ken Pizzini <ken@gnu.org> + + * sed/sed.h, sed/utils.c: conditionalized inclusion of <libintl.h> + to occur only if ENABLE_NLS is defined. + +Sun Apr 18 01:48:45 PDT 1999 Ken Pizzini <ken@gnu.org> + + * sed/compile.c(xofa,normalize_text,convert_number): change + name of xofa() function to convert_number(); change semantics + to do all of the work of the text->number conversion. + + * sed/compile.c(normalize_text): add new \dDDD decimal + and \oOOO octal escapes. + +Sun Mar 28 21:05:07 PST 1999 Ken Pizzini <ken@gnu.org> + + * sed/sed.c(main): if NOLEAKS is set, free up a word that + the call to textdomain() allocated. + + * sed/execute.c(read_file_line): plug up (minor) memory leak: + if buffer.alloc==0 we may have malloc()'d 1 byte anyway, + so be sure to FREE(buffer.text) before calling line_init(); + +Fri Mar 26 16:52:10 PST 1999 Ken Pizzini <ken@gnu.org> + + * sed/compile.c(match_slash): somewhere between 3.02 + and 3.02a we lost the ability to use a newline as + the s/// delimiter; restore this ability. + + * sed/compile.c(compile_regex): forget about trying + to cache the compiled form of the last RE --- it + causes more problems than its worth. We now only + cache the source form. + + * testsuite/help.good: update to reflect output containing + new options. + +Sun Dec 6 00:51:23 PST 1998 Ken Pizzini <ken@gnu.org> + + * sed/utils.c(ck_fwrite): fix i18n bug of using a printf + fragment of "item%s" to handle plural text. + +Mon Nov 23 11:03:40 PST 1998 Ken Pizzini <ken@gnu.org> + + * doc/sed.1, doc/sed.texi: ran ispell over these + files to catch the more obvious typos... + +Sun Nov 1 00:09:07 PST 1998 Ken Pizzini <ken@gnu.org> + + * sed/execute.c(do_list): make a `lcmd_out_line_len' + (--line-length) of zero mean "infinite length", + i.e., "never wrap". + +Sat Oct 31 23:06:50 PST 1998 Ken Pizzini <ken@gnu.org> + + * execute.c(match_an_address_p,process_files), + compile.c(compile_program): back out the "zero-address" + changes of 1998-09-27. It was a neat idea, but there are + too many dark corners which don't work well. The + special code for handling line ranges starting at + address zero (from 1998-08-31) are still there though: + this seems to work fine with no surprises. + +Sat Oct 31 22:18:59 PST 1998 Ken Pizzini <ken@gnu.org> + + * sed/sed.c, sed/sed.h, sed/execute.c: added new + `lcmd_out_line_len' variable. (Idea suggested by + Carlos J. G. Duarte <l38076@alfa.ist.utl.pt>.) + Also added ATOI macro (which uses strtoul() if available, + with fall-back to atoi()). + * sed/sed.c(main): attempt to use COLS environment variable + to set a reasonable `lcmd_out_line_len'; added -l/--line-length + command-line options to set the new `lcmd_out_line_len' flag. + * sed/sed.c(usage): documented new -l/--line-length options. + * sed/execute.c(do_list): use `lcmd_out_line_len' variable + instead of `LCMD_OUT_LINE_LEN'. + * sed/execute.c: deleted now obsolete LCMD_OUT_LINE_LEN define. + * configure.in: added strtoul to the AC_CHECK_FUNCS call. + +Sat Oct 31 21:37:17 PST 1998 Ken Pizzini <ken@gnu.org> + + * sed/sed.c, sed/sed.h, sed/execute.c: added new `force_unbuffered' + flag. (Idea suggested by Frank Strauss <strauss@escape.de>.) + * sed/sed.c(main): added -u/--unbuffered command-line options + to set the new `force_unbuffered' flag. + * sed/sed.c(usage): documented new -u/--unbuffered options. + * sed/execute.c: changed the name of the `is_tty' flag in struct + input to a more generic `no_buffering'; also removed HAVE_ISATTY + conditional on this member. + * sed/execute.c(slow_getline): removed HAVE_ISATTY conditonal + compilation of this function. + * sed/execute.c(output_line): if force_unbuffered is set, + then force a fflush() even if writing to stdout. + * sed/execute.c(open_next_file): added handling of the + new `force_unbuffered' flag so that slow_getline() + will always be used for input. + * sed/execute.c(read_file_line): changed the (conditionally + compiled) test of `input->is_tty' to (unconditionally) + use the new spelling `input->no_buffering'. + +Thu Oct 15 12:08:09 PDT 1998 Ken Pizzini <ken@gnu.org> + + * configure.in: deleted AC_ARG_PROGRAM call; this is already + done for us by AM_INIT_AUTOMAKE, and we were winding up + with a doubled-transform. + +Sun Sep 27 01:42:42 PDT 1998 Ken Pizzini <ken@gnu.org> + + * compile.c(compile_program): remove special-case code for matching + address range with a `0' beginning. + + * compile.c(compile_address): change default addr_number to + be a pragmatically impossible countT value, instead of zero. + + * execute.c: spell macro REGNEXEC() unconditionally instead of + playing with conditional definition of regnexec() macro. + + * execute.c(match_an_address_p): added third argument (and changed + callers in match_address_p). Added special code to ignore + non-numeric matches when processing "line zero". + + * execute.c(process_files): added a "line zero" pass through the + commands script. + +Sun Sep 27 00:20:53 PDT 1998 Ken Pizzini <ken@gnu.org> + + * compile.c(xofa,normalize_text): new functions. + * compile.c(compile_regex): cache last_compiled_re (with its + associated flags); add POSIXLY_CORRECT behavior for empty RE. + Make use of the new normalize_text() function. + * compile.c(setup_replacement): Make use of the new normalize_text() + function. + +Sat Sep 26 22:59:13 PDT 1998 Ken Pizzini <ken@gnu.org> + + * lib/regex-gnu.h: added missing prototype for regncomp(). + +Mon Sep 14 20:47:23 PDT 1998 Ken Pizzini <ken@gnu.org> + + * sed/sed.c(main): use EXIT_SUCCESS instead of 0, in case + we are built on a system (such as VMS) where EXIT_SUCCESS + is distinct from 0. + +Wed Sep 9 22:17:28 PDT 1998 Ken Pizzini <ken@gnu.org> + + * sed/Makefile.am: added -I../intl the INCLUDES line; if we are + building in a directory outside the source tree and the system + we are building on does not have a <libintl.h> header, then + the build was failing, because libintl.h is a build-time + constructed source file. + + * configure.in: tweaked version to be 3.02b. + +Wed Sep 9 19:28:14 PDT 1998 Ken Pizzini <ken@gnu.org> + + *** Version 3.02a released + + * sed/compile.c(mark_subst_opts,read_label,compile_program): + wherever we accept a ; as a command terminator, also allow a } or + a # to appear. (This allows for less cluttered-looking scripts, + such as: sed '/foo/{x;G}' (instead of: sed '/foo/{x;G;}').) + +Wed Sep 9 18:17:07 PDT 1998 Ken Pizzini <ken@gnu.org> + + * sed/compile.c(compile_regex): use regncomp() instead + of regcomp(), so that a script with NULs in its REs + will work in the expected manner. + + * sed/compile.c(ADDNUL,REGNCOMP): added support macros + for above. + + * lib/regex.c(regncomp,regcomp): added regncomp() and + made regcomp() a simple wrapper function. + +Mon Aug 31 21:48:30 PDT 1998 Ken Pizzini <ken@gnu.org> + + * sed/sed.c(compile_program): if the first address of + a range is the number 0 (or a 0~N sequence), start + out in the "a1_matched" state. This allows one + to match an initial chunk of a file without undue + convolutions for handling the case where the match + for the end of the sequence happens to be the first + line. + +Sun Aug 16 03:34:25 PDT 1998 Ken Pizzini <ken@gnu.org> + + * sed/compile.c(snarf_char_class,match_slash): simplify + handling of "premature newline" error. Also, get the + line number right in the error message if we encounter + a "premature newline" during char-class snarfing. + +Sun Aug 16 02:59:20 PDT 1998 Ken Pizzini <ken@gnu.org> + + * sed/compile.c: added N_() markers and corresponding gettext() + (er, _()) calls. + + * Merged in i18n contribution from Erick Branderhorst + <Erick.Branderhorst@asml.nl>. His ChangeLog entry + for the changes I've incorporated so far: + +1998-07-24 Erick Branderhorst <Erick.Branderhorst@asml.nl> + * configure.in (ALL_LINGUAS, AM_GNU_GETTEXT): nl + * sed/{sed.h,utils.c}: #include <libintl.h> #define _(String) + gettext (String) + * sed/sed.c: #include <locale.h> + * po/POTFILES.in: sed/{compile,execute,sed,utils}.c + * run gettextize -f + * acconfig.h: #undef LOCALEDIR ENABLE_NLS HAVE_CATGETS + HAVE_GETTEXT HAVE_LC_MESSAGES HAVE_STPCPY + +Fri Aug 14 13:52:57 PDT 1998 Ken Pizzini <ken@gnu.org> + + * Merged code from 3.02 with a branched development + tree from late May; the following (out-of-order) + changelog entry is from the branched tree. + +Sat May 30 12:23:16 PDT 1998 Ken Pizzini <ken@gnu.org> + + * sed/compile.c, sed/execute.c: added (conditional on NOLEAKS macro) + code to free all dynamically allocated memory. + + * sed/sed.c, sed/compile.c, sed/execute.c: much shuffling + of code --- ordered functions such that no forward + declarations are necessary, and placed all static prototypes + immediately before the actual function definition. + This accomplished two things: first, I find the new ordering + a more natural way to read the code than the previous + ordering, and second, the new ordering give the compiler + a better opportunity to discover inlining possibilities. + (The odd "prototype declaration+old-style definition" + style is used because I feel it is the least ugly way + of supporting K&R1 C while still getting the benefit of + prototypes when they are available.) + + * sed/basicdefs.h: added MEMCPY() macro to hide the VCAST()s + that ought to be used with memcpy(). + + * sed/execute.c: Change calls to memcpy() to go through the + new MEMCPY() macro. Various prototypes: elide variable name + if it does not add any human-useful documentary information + to the bare type. + + * sed/sed.c(main): Updated calls to compile_string() to add third + (length) argument. Changed call to obsolete close_all_files() + to a call to the new finish_program(). + + * sed/sed.c(map_file): Attempt to clean-up how "size" gets + cast and tested; remove spurious S_ISREG test (just let + mmap() fail if it doesn't support the underlying file type). + + * sed/sed.c: Deleted old RX library stub declarations. + + * sed/sed.c(map_file,unmap_file): added VCAST()s to the + mmap()/munmap() calls. + + * sed/utils.c(ck_fclose): added support for ANSI C + functionality where passing a NULL argument means + to fclose() _all_ open streams. (Well, almost. + Only closes streams which were previously ck_fopen()ed, + as I don't care to figure out how to autoconf-detect + whether fclose(NULL) is properly supported on a given + platform.) + + * sed/sed.h: Renamed `struct text_buf' member `text_len' + to `text_length'. Abstracted out `enum addr_types' + from `struct addr'; added new enum types num2,step,step_mod; + renamed mod to num_mod. De-unionized the regex,number, + {modulo-offset/step} components of `struct addr', in + anticipation of new features. Changed type of `a2' member + of `struct sed_cmd': now a pointer to save space. + Abstracted out `struct replacement' from `struct subst'. + Cleaned up declaration of `x' union of `struct addr'. + Fixed prototype for compile_string(). Replaced prototype + for old close_all_files() with one for new finish_program(). + + * sed/sed.h, sed/compile.c, sed/execute.c: changed to + simplify the data structures used for branches and + command blocks: simplified `struct vector'; made + `struct label' local to compile.c; `struct sed_cmd' + was modified to support a simpler design for branches + and blocks. + + * sed/execute.c: Conditionally added ADDNUL() macro so that + the function call overhead is only incurred if nul_append() + _must_ be called. Made some commentary edits, including + typo fixes. + * sed/execute.c(resize_line): changed semantics of "len" argument + from "additional length" to "target length"; made + INITIAL_BUFFER_SIZE a minimum allocation length. + * sed/execute.c(str_append): adjusted to new resize_line() + semantics. + * sed/execute.c(line_copy): use FREE()+MALLOC() instead of + REALLOC() to avoid unnecessary copying of old text; add the + "try doubling first" allocation heuristic (just like + resize_line() does). + * sed/execute.c(line_exchange): new function. + * sed/execute.c(nul_append): make whole function (not just its + body) conditional on HAVE_REGNEXEC macro; adjust to new + resize_line() semantics. + * sed/execute.c(read_mem_line): use str_append() instead if + custom in-line code; compensate for new default of + "line.chomped = 0" in read_pattern_space() by setting + "line.chomped = 1" where appropriate. + * sed/execute.c(read_file_line): use different trigger to + determine that "buffer" is uninitialized, and do a full + initialization if required; use str_append() instead of custom + in-line code in two places; compensate for new default of + "line.chomped = 0" in read_pattern_space() by setting + "line.chomped = 1" where appropriate. + * sed/execute.c(output_line): don't bother calling ck_fwrite() + if length==0. + * sed/execute.c(release_append_queue): new function. + * sed/execute.c(dump_append_queue): use release_append_queue() + instead of in-line equivalent. + * sed/execute.c(read_pattern_space): conditionalize call to + dump_append_queue() for alleged performance reasons; changed + default "line.chomped" value to more common "1", and added an + assignment of "0" where this made a difference. + * sed/execute.c(match_an_address_p): deleted "is_addr2_p" + argument; reorder cases to match order in enum declaration; add + cases for new "addr_is_num2", "addr_is_step", and + "addr_is_step_mod" address types; alter nul_append() call to be + through ADDNUL() macro; fix to new struct member and enum + spellings in (formerly addr_is_mod); addr_is_num_mod case. + * sed/execute.c(match_address_p): remove oblsolete third argument + to calls to match_address_p(); alter references to sed_cmd + member a2 to reflect new pointer status; add new support for + a2->addr_type addr_is_step and addr_is_step_mod cases. + * sed/execute.c(do_subst): add NOLEAKS support logic; use + ADDNUL() wrapper to nul_append(); simplify replacement + expansion by using the new "struct replacement" data structure; + use line_exchange() function instead of custom in-line code. + * sed/execute.c(process_files): added NOLEAKS code. + * sed/execute.c(execute_program): updated implementations + of the `{', `}', `:', `b', and `t' commands; modified + `c' command gratuituosly; fixed potential memory + overrun in `D' command. Simplified how nonstandard + `loop increments' work. Use line_exchange() instead of + custom in-line code in 'x' case. + * sed/execute.c[EXPERIMENTAL_DASH_N_OPTIMIZATION conditional + code]: various modifications intended to keep this + code in sync with the new changes, but the code still + retains its previous bugs. + + * sed/compile.c: use "exit(EXIT_FAILURE) instead of "exit(1)", + just in case we get compiled under VMS. + * sed/compile.c: Change type of prog_info.base to decrease needs + for casting; then elimiated the casts in question ;-). + * sed/compile.c: Added struct sed_label (moved from sed.h, then + modified). + * sed/compile.c: Removed "readit_p" flag from struct fp_list. + * sed/compile.c: Added module-global "blocks" variable. + * sed/compile.c: Extracted more error-message constant strings + to named variables. + * sed/compile.c(check_final_program): updated to + reflect new data structures and use new fucntions. + Added call to compile_regex() to release unneeded + memory. + * sed/compile.c: deleted obsolete new_vector() function; + abstracted new read_label() function; abstracted new + release_label() function; added new `blocks' module-static + variable. + * sed/compile.c(compile_program): updated implementations + of the `{', `}', `:', `b', and `t' commands; modified + initialization from NULL vector. + * sed/compile.c(compile_regex): added mechanism to + release memory consumed by the cached `last' RE. + * sed/compile.c(setup_jump,setup_label): updated + name (from setup_jump to setup_label) and prototype; + changed body to reflect data structure changes. + * sed/compile.c: Add OPEN_BRACE and CLOSE_BRACE macros for better + "vi" editing behavior. + * sed/compile.c(compile_filename,read_filename,get_writefile): + Replaced function compile_filename() with more orthogonal functions + read_filename(), get_writefile(). + * sed/compile.c(compile_regex): Added ability to free the remembered + "last RE" in compile_regex (for benifit of "NOLEAKS" code). + * Made adjustments dictated by the change to struct sed_cmd which made + the a2 member a pointer-to-addr instead of an addr. + * sed/compile.c(setup_jump,read_label,setup_label,release_label): + Added functions read_label(), setup_label(), release_label(); deleted + function setup_jump(). + * sed/compile.c(new_replacement,setup_replacement,release_replacement): + new functions. + * sed/compile.c: Adjusted to new spelling of text_buf member + ("text_length" instead of "text_len"). + * sed/compile.c(new_vector): deleted function. (Due to new handling + of blocks, only one instance remained, and that one was just as + clear in-lined.) + * sed/compile.c(compile_string): Added third argument; it now + takes a counted string instead of a NUL-terminated string. + * sed/compile.c(compile_file): added variable "map_base" to + compensate for new type of prog_info.base. + * sed/compile.c(check_final_program): reflect new style of + handling blocks and struct sed_label. + * sed/compile.c(close_all_files,finish_program): replaced function + close_all_files() with more generic finish_program(). + * sed/compile.c(read_text): added new feature: if first non-blank + character after the {a,i,c} command character is not "\", then + use the trailing text on that line as the (first) line of text. + Also added code conditional on NO_INPUT_INDENT to support the + "feature" of stripping leading blanks from each input line; I + do not read POSIX as permitting this behavior, nor do I think + it is a good idea, so it is disabled by default, but some have + argued that this blank-stripping is the "correct" behavior, so + I offer them the option of building their sed that way. + * sed/compile.c(compile_address): added xxx,+n and xxx,~n addressing; + simplified code. + * sed/compile.c(compile_program): added BAD_PLUS error detection; + adjusted to new cur_cmd->a2 pointer status; added addr_is_num2 + detection; deleted pointless "a2->addr_number < a1.addr_number" + check (addr_is_num2 semantics handle this just fine); updated + code for '{', '}', ':', 'b', and 't' to reflect new design + of branch handling, including making use of new functions + related to the new design); added support for feature already + mentioned in read_text() where {a,i,c} commands are able to have + their text start on the same line as the command; changed some + error messages (hopefully for the better); localized variables + specific to individual commands (particularly 's' and 'y'); + made use of new setup_replacement() function in 's' command. + +Mon Aug 10 19:58:49 PDT 1998 Ken Pizzini <ken@gnu.org> + + * doc/sed.texi, doc/sed.1: sedtut10.txt is apparently dead. + Deleted references to it and added a pointer to + http://seders.icheme.org/tutorials/. (Pointed out by + Joerg Heitkoetter <joerg@de.uu.net>.) + +Sat Aug 8 18:11:57 PDT 1998 Ken Pizzini <ken@gnu.org> + + * djgpp/config.btm: per request by Michel de Ruiter + <mdruiter@cs.vu.nl>, added "%1" to "%9" parameters. + +Mon Aug 3 11:44:55 PDT 1998 Ken Pizzini <ken@gnu.org> + + * doc/sed.texi: fix a couple of typos. (Submitted by + Alan Modra <alan@spri.levels.unisa.edu.au>.) + +Sat Aug 01 17:49:06 PDT 1998 Ken Pizzini <ken@gnu.org> + + *** Version 3.02 released + + * configure.in: Because of code change in 3.01a, bump the + minor revision number for the release (now 3.02). + +Sun Jul 26 16:07:55 PDT 1998 Ken Pizzini <ken@gnu.org> + + *** Version 3.01a released + + * sed/compile.c(snarf_char_class): the POSIX char-class + recognition loop forgot to update its concept of "prev" + as the loop progressed. + + * testsuite/Makefile.am: The dependency of version.good + on [testsuite/]Makefile introduced in the previous + release was botched -- it referred to "Makefile" + as "$(srcdir)/Makefile, which of course doesn't work + if you aren't building in the source tree. + + * djgpp/Makefile.am: add forgotten "config.btm" EXTRA_DIST + member. + + * configure.in: update version. + +Tue Jul 21 06:04:42 PDT 1998 Ken Pizzini <ken@gnu.org> + + *** Version 3.01 released + + * configure.in: mark as release version! + + * Makefile.am: add BUGS and THANKS to the EXTRA_DIST target. + + * testsuite/Makefile.am: add dependency of version.good + on [testsuite/]Makefile. + +Mon Jul 20 12:38:10 PDT 1998 Ken Pizzini <ken@gnu.org> + + * djgpp/config.btm: New file to support the 4DOS alternative + to command.com. (Sumitted by Eli Zaretskii on behalf of + an anonymous 4DOS user.) + +Fri Jul 17 00:36:34 PDT 1998 Ken Pizzini <ken@gnu.org> + + *** Version 3.01-beta18 released + + * djgpp/config.sed: my "tweak" in beta17 was too + hastily considered. Back it out. + + * configure.in: update to beta18. + +Wed Jul 15 01:02:15 PDT 1998 Ken Pizzini <ken@gnu.org> + + *** Version 3.01-beta17 released + + * djgpp/config.sed: tweak/simplify s,,, commands at end. + + * configure.in: update to beta17. + +1998-07-14 Eli Zaretskii <eliz@is.elta.co.il> + + * djgpp/config.sed: Edit all the occurences of = in the context of + --option=value, including in the help messages, into + --option:value, but leave DOS-style d:/foo/bar file names intact. + + * djgpp/config.bat: Use --srcdir:foo instead of --srcdir=foo. + + * testsuite/Makefile.am (help, version): Remove temporary files + explicitly, don't use shell wildcards, so it works under DOS 8+3 + limits. + +Thu Jul 9 13:06:00 PDT 1998 16:51:43 PDT 1998 Ken Pizzini <ken@gnu.org> + + *** Version 3.01-beta16 released + + * djgpp/config.sed: tweak the configure script to use : + instead of = for --with-foo=bar option parsing, to + work around problems with how command.com handles =s. + +Wed Jul 8 16:51:43 PDT 1998 Ken Pizzini <ken@gnu.org> + + * djgpp/config.bat: correct inappropriate behavior that I + introduced in the beta13 changes (if first argument is + a directory, it needs to be handled as the --srcdir). + + * testsuite/version.gin, testsuite/version.good, testsuite/Makefile.am: + Add target to automake to automatically update version.good + from (new file) version.gin, instead of hand-editing the version + number each release. + + * testsuite/Makefile.am: miscellaneous gratuitious tweakage -- + mainly adding $(RM) commands just because I didn't like + leaving the tmp* files from successful runs laying about. + Also some editorial comments. + + * configure.in: update to beta16. Added and commented out + experiment with AC_OUTPUT() for testsuite/version.good. + Added code to properly handle bare (without =xxx) + "--with-regex" option. + +Sun Jul 5 21:02:16 PDT 1998 Ken Pizzini <ken@gnu.org> + + *** Version 3.01-beta15 released + + * sed/utils.c(ck_fflush), sed/utils.h, sed/execute.c(output_line): + add and use new ck_fflush() function. + +Sun Jul 5 15:23:47 PDT 1998 Ken Pizzini <ken@gnu.org> + + * sed/compile.c(bad_prog): add more detail to error + messages about -e strings. + +Sun Jul 5 14:29:45 PDT 1998 Ken Pizzini <ken@gnu.org> + + * sed/compile.c(mark_subst_opts), sed/execute.c(do_subst): + Define better semantics for interaction of the `g' flag + with a numeric flag to the s/// command. It used to + be that the `g' command siezed control; now the first + (number-1) matches are skipped and then `g' gets control + after that. (It is not clear whether this is a feature + sneaking in during late beta, or a bug fix; the changes + involved were trivial, so I decided to treat it as a bug + fix.) + + * configure.in, testsuite/version.good: update to beta15. + +Sat Jul 4 09:54:45 PDT 1998 Ken Pizzini <ken@gnu.org> + + *** Version 3.01-beta14 released + + * sed/basicdefs.h, sed/compile.c, sed/execute.c: + per report by "Kaveh R. Ghazi" <ghazi@caip.rutgers.edu>, + copied the ISXXX macros from lib/regex.c so that + silly machines which require isascii() to be true + before the other isXXX() macros are valid will + still work. + + * configure.in, testsuite/version.good: update to beta14. + +Thu Jul 2 23:46:13 PDT 1998 Ken Pizzini <ken@gnu.org> + + *** Version 3.01-beta13 released + + * configure.in, acconfig.h: set USE_REGEX_GNU_H symbol if we + are going to be using lib/regex.c. + + * lib/Makefile.am, lib/regex.h, lib/regex-gnu.h, lib/regex.c: + rename lib/regex.h to lib/regex-gnu.h, so that those who + choose to use a different regex implementation will not + pick-up lib/regex.h when doing "#include <regex.h>". + + * sed/regex-sed.h, sed/Makefile.am, sed/compile.c, sed/execute.c, + sed/sed.c: create sed/regex-sed.h which acts as a switch + to choose either lib/regex.h or the user-supplied <regex.h>, + depending on the value passed to configure's --with-regex= + option. + +Thu Jul 2 17:22:31 PDT 1998 Ken Pizzini <ken@gnu.org> + + * configure.in: if an alternative --with-regex= is given, + do an AC_CHECK_FUNCS(regnexec regexec) to ensure that + at least one of these functions is available. Also, + parallel changes for the default case. + + * sed/execute.c, acconfig.h: retire use of the WITH_REGNEXEC + test macro in favor of HAVE_REGNEXEC test macro created + by above change. + + * djgpp/config.bat: Play games to handle "install-sh", + DOS filename restrictions, GNU makefile default rules, + and getting a correct run of "configure" (contributed + by Eli Zaretskii <eliz@is.elta.co.il>). + + * djgpp/Makefile.am, testsuite/Makefile.am, testsuite/Makefile.in, + Makefile.am, configure.in: Various automake targets + (such as distcheck) failed with old configuration. + The simplest solution was to just add these .am + files. (The testsuite/Makefile.in was just renamed to + testsuite/Makefile.am, then various redundant defines and + targets were deleted.) (Reported by Erick Branderhorst + <Erick.Branderhorst@asml.nl>.) + + * testsuite/dc.good, testsuite/dc.inp: per suggestion from + Greg Ubben <gsu@romulus.ncsc.mil>, use base 16 output to + exercise even more of the dc.sed script. + + * configure.in, testsuite/version.good: update to beta13. + +Sun Jun 28 16:21:02 PDT 1998 Ken Pizzini <ken@gnu.org> + + *** Version 3.01-beta12 released + + * doc/sed.texi: Avoid mixing @code and @samp markups together: + they look ugly in Info. Use @url and @email instead of @example. + Add indexes. (Basis of changes contributed by Eli Zaretskii.) + + * djgpp/*, Makefile.am: add support for the DJGPP compiler, + contributed by Eli Zaretskii <eliz@is.elta.co.il>. + + * dc.sed, testsuite/Makefile.in, testsuite/dc.inp, testsuite/dc.good: + added this remarkable script, written and contributed + by Greg Ubben <gsu@romulus.ncsc.mil>, both as a work of + art for general admiration, and also for use in regression + testing. + + * configure.in, lib/Makefile.am: add --with-regex=regexlib + option, which overrides the use of lib/regex.c. + + * configure.in, testsuite/version.good: update to beta12. + +Fri Jun 12 16:41:48 PDT 1998 Ken Pizzini <ken@gnu.org> + + *** Version 3.01-beta11 released + + * sed/compile.c: add module-static variables first_script + (for #n change below) and pending_text (for a/c/i change + below). + + * sed/compile.c(compile_file), sed/compile.c(compile_program): + Instead of having #n trigger the -n option in *any file*, + have #n trigger the -n option only if they are the first + two bytes of the first script or script-file. + + * sed/compile.c(compile_string), sed/compile.c(compile_file): + clear the first_script variable at end of these functions. + + * sed/sed.h: tease out the struct text_buf declaration from + struct sed_cmd, so that a pointer to such can be passed + to new sed/compile.c(read_text) function. + + * sed/compile.c(compile_program), sed/compile.c(read_text): + Tease out handling of text to a/c/i commands to new + read_text() function. Handle (via aid of pending_text + variable) texts which span more than one script/script-file + option. In particular, restore the ability to have this + work: sed -e '1i\' -e 'foo' + + * sed/compile.c(check_final_program): close off any dangling + pending_text allocation. + +Thu Jun 11 11:17:46 PDT 1998 Ken Pizzini <ken@gnu.org> + + * sed/execute.c(do_subst): fixed two bugs: s/ */X/g was failing + to match the final empty string after the end of the pattern + space; and /^foo$/s/o/x/3p was printing, despite the failure + to do a substition. + +Fri Jun 5 04:40:24 PDT 1998 Ken Pizzini <ken@gnu.org> + + * configure.in: change the AC_ARG_WITH(regnexec, ...) + to be the more appropriate AC_ARG_ENABLE(regnexec, ...). + + * configure.in, testsuite/version.good: update to beta11. + +Fri Jun 5 00:54:25 PDT 1998 Ken Pizzini <ken@gnu.org> + + *** Version 3.01-beta10 released + + * sed/execute.c: forgot to P_() the prototype and + old-style the declaration for bootstrap_memchr()! + +Thu Jun 4 18:42:30 PDT 1998 Ken Pizzini <ken@gnu.org> + + * sed/compile.c(snarf_char_class): added code to + recognize \n or \<newline> sequence within a + char-class as the newline character. + +Tue Jun 2 11:56:02 PDT 1998 Ken Pizzini <ken@gnu.org> + + * configure.in: added check for <sys/types.h> and + a AC_ARG_WITH(regnexec,...) check, to simplify use + of other regex libraries which have regexec() but + not regnexec(), with the corresponding loss of + functionality (regexps will not work right against + input lines which contain NULs). + + * sed/execute.c: add nul_append() function, a #define + for a regnexec() -> regexec() macro (conditional on + the lack of the WITH_REGNEXEC symbol), and a couple + of calls to nul_append() (in match_an_address_p() + and do_subst()) to permit the use of the POSIX standard + regexec() function call instead of the suggested + regnexec() call. + + * sed/compile.c, sed/execute.c, sed/sed.c: check for + <sys/types.h> and include it (before "regex.h") if + available. This makes it simpler to use the system's + regex library instead of the one in lib/regex.c, should + that be desired. + +Tue Jun 2 08:41:05 PDT 1998 Ken Pizzini <ken@gnu.org> + + * sed/basicdefs.h: define VCAST macros to allow sed to + compile on systems which predate the definition + of "void *", and yet still get feedback about + stupid programming errors from systems which *do* + know about "void *"s. Also define MALLOC, REALLOC, + MEMDUP, and FREE macros to keep under control the + degree of code ugliness which would otherwise be + introduced in making use of the VCAST macro. + + * sed/compile.c, sed/execute.c, sed/sed.c, sed/utils.c: + pervasively use the new VCAST, MALLOC, REALLOC, MEMDUP, + and FREE macros wherever appropriate. + + * sed/utils.c, sed/utils.h: correct type of first arguments + to ck_fread() and ck_fwrite() to be [const] VOID *. + + * sed/basicdefs.h, sed/execute.c: protect against + the rumored systems which stupidly #define __STDC__ 0. + + * testsuite/help.good, testsuite/Makefile.in: make + the ``help'' test insensitive to the spelling of + the executable's name. Also, enhanced `make clean' + target. + + * doc/sed.texi, doc/sed.1: correct documentation of `q' + command; fix typos. + + * configure, testsuite/version.good: update to beta10. + +Sat May 30 17:28:00 PDT 1998 Ken Pizzini <ken@gnu.org> + + *** Version 3.01-beta9 released + + * Makefile.am: make testsuite a normal SUBDIR. + + * configure.in: discontinue using AC_ISC_POSIX -- + check for -lcposix library instead; added + testsuite/Makefile to AC_OUTPUT list. + + * lib/memmove.c(memmove): fixed wrong sense used + for HAVE_BCOPY test. + + * sed/execute.c: checked more specifically for a version + of gcc which supports __attribute__ (i.e., >= 2.7). + + * testsuite/*: renamed files to fit 14 char limit. + + * testsuite/Makefile, testsuite/Makefile.in: Makefile + renamed to Makefile.in and then modified so that + "make -j check" from top directory will work. + + * testsuite/subwrite.sed, testsuite/writeout.sed: changed + file name of the "w" command to be consistent with the + new naming used in testsuite/Makefile.in. + + * doc/sed.1, doc/sed.texi: fixed some typos, formatting + glitches, and poor wordings. + +Sat May 30 04:02:29 PDT 1998 Ken Pizzini <ken@gnu.org> + + * configure.in: specify that config.h is to be derived + from config_h.in in order to avoid the braindead + DOS filesystem limitations. + +Fri May 29 21:56:30 PDT 1998 Ken Pizzini <ken@gnu.org> + + * sed/compile.c(compile_address), doc/sed.texi: gave + a better definition to the meaning of N~0 address + forms -- N~M addresses now mean that lines match + when there exists a non-negative x such that + lineno == N+x*M. + +Fri May 29 12:07:38 PDT 1998 Ken Pizzini <ken@gnu.org> + + * sed/compile.c(compile_address), + sed/execute.c(match_an_address_p): update semantics of + N~M address form: now N is the first line which will + match and M is the step between succeeding matches. + If N<M this works out to the same as before, but the + new behavior for N>=M seems more useful. + + * doc/sed.1, doc/sed.texi: update documentation of N~M + address form; added "Other Resources" node to sed.texi; + minor formatting changes to some items in sed.1 with + an eye to improving clarity. + + * configure.in, testsuite/version.good: update to beta9. + +Sat May 23 20:04:31 HST 1998 Ken Pizzini <ken@gnu.org> + + *** Version 3.01-beta8 released + + * sed/compile.c(compile_regex): forgot to make last_re be + a *copy* of the buffered text in today's earlier fix. + + * sed/execute.c(read_file_line): EOF check was wrong -- + it forgot to allow for the possibility that we were + appending to the end of the ``line'' (instead of merely + reading a fresh line). + +Sat May 23 18:07:18 HST 1998 Ken Pizzini <ken@gnu.org> + + * sed/compile.c(compile_regex): don't track compiled version + of regex -- the modifiers may change. Track the regex + source instead. (For "last regex" (aka //) notation.) + + * configure.in, testsuite/version.good: update to beta8. + +Sat May 23 16:07:09 HST 1998 Ken Pizzini <ken@gnu.org> + + *** Version 3.01-beta7 released + + * sed/execute.c: #undef'd EXPERIMENTAL_DASH_N_OPTIMIZATION + because its code is buggy. + +Tue May 19 17:03:52 HST 1998 Ken Pizzini <ken@gnu.org> + + * sed/sed.c: label rx library code as such with #ifdefs + (instead of just #if 0). + + * sed/compile.c(compile_program): make incremental + improvement to the "Unknown command" error message. + +Sat May 16 23:16:26 HST 1998 Ken Pizzini <ken@gnu.org> + + * testsuite/Makefile: simplify: get rid of automatic run + against system's sed; don't time by default; allow for + alternative comparison command. + + * configure.in, testsuite/version.good: update to beta7. + +Wed May 13 21:44:28 PDT 1998 Ken Pizzini <ken@gnu.org> + + *** Version 3.01-beta6 released + + * lib/Makefile.am: fix spelling of libsed_a_LIBADD in + libsed_a_DEPENDENCIES. + + * configure.in, testsuite/version.good: update to beta6. + +Wed May 13 14:38:08 PDT 1998 Ken Pizzini <ken@gnu.org> + + *** Version 3.01-beta5 released + + * sed/execute.c(do_subst): added not_bol_p variable to track when + we have iterated past the beginning of the pattern. + [Thanks to Jim Meyering <meyering@ascend.com> for the bug report.] + +Wed May 13 13:54:04 PDT 1998 Ken Pizzini <ken@gnu.org> + + * sed/execute.c(bootstrap_memchr): new function. When + bootstrapping we don't know if we are on a 64-bit machine, + so lib/memchr.c breaks. Supply this (slow) implementation + just to get us bootstrapped. + + * bootstrap.sh: add a #define BOOTSTRAP symbol; add -I. + for emphasis for the compiles in sed/; be explicit + about what files we're bothering to compile. + + * configure.in, testsuite/version.good: update version + to beta5. + +Wed May 13 06:39:06 PDT 1998 Ken Pizzini <ken@gnu.org> + + *** Version 3.01-beta4 released + + * rename writeout.good? to wrtout?.good and subwrite.good? to + subwrt?.good to comply with DOS 8+3 file name restrictions. + [Eli Zaretskii <eliz@is.elta.co.il> suggested this to + simplify DJGPP ports, and it was easy.] + + * testsuite/Makefile: reflect above name changes. + +Wed May 12 21:09:32 PDT 1998 Ken Pizzini <ken@gnu.org> + + * sed/sed.c(usage): fix non-portable omission of \n\ at end of + lines within long string. + + * sed/sed.c(main): remove spurious argument to fprintf() in the + 'V'ersion output. + + * sed/execute.c(line_append): embed newline between the two + text fragments unconditionally. + + * sed/execute.c(do_subst): change structure assignment to memcpy() + (for portability reasons). + + * README.bootstrap: suggest using -w option. + +Tue May 12 10:02:37 PDT 1998 Ken Pizzini <ken@gnu.org> + + * configure.in: use AC_REPLACE_FUNCS where appropriate. + + * lib/Makefile.am: updated to reflect AC_REPLACE_FUNCS change in + configure.in. + + * lib/memchr.c lib/memcmp.c: revert to standard GNU versions. + + * lib/alloca.c: added this missing file. + + * testsuite/version.good: updated for new version identifier. + +Mon May 11 18:50:56 PDT 1998 Ken Pizzini <ken@gnu.org> + + *** Version 3.01-beta3 released + + * sed/Makefile.am: fix INCLUDES to work right with VPATH. + [Thanks to Jim Meyering <meyering@ascend.com> for the bug report.] + + * sed/sed.c(usage): make --help output more user-friendly? + + * sed/execute.c(execute_program): fix bug in 'x' command introduced + in the alleged portability fix of May 9. + + * configure.in: update version to 3.01-beta3. + + * testsuite/version.good, testsuite/help.good: freshen with + latest output. + +Sat May 9 22:35:45 PDT 1998 Ken Pizzini <ken@gnu.org> + + *** Version 3.01-beta2 released + + * sed/sed.c: add #include <sys/types.h> in HAVE_MMAP + block (needed on some machines). + + * lib/memmove.c: #include <memory.h>, if HAVE_MEMORY_H. + +Sat May 9 21:29:00 PDT 1998 Ken Pizzini <ken@gnu.org> + + * configure.in: remove dangling references to rx library; + added HEADER and FUNC checks for items used by source in + lib/. + + * lib/ansidecl.h, lib/memcopy.h, lib/pagecopy.h, lib/string.h + lib/memcpy.c, lib/memmove.c: deletes these files. There + are still pieces of glibc missing to support these, and + it isn't worth the headache right now. + + * lib/memmove.c: de novo, simpler version. Uses bcopy() + if available, and slow-but-simple code if not. + + * lib/Makefile.am: remove references to deleted files. + Added forgotten reference to memcpy.c. Re-ordered + SOURCE entries to reflect dependencies for systems + which lack ranlib. + + * sed/basicdefs.h: updated to reflect above changes to lib/, + and experience with non-STDC compilers. + + * lib/regex.c: made regerror() function publicly visible. + + * lib/strerror.c: use old-style function declaration. + + * sed/compile.c, sed/execute.c, sed/sed.c, sed/utils.c, + sed/sed.h, sed/utils.h: ensure that private definitions of + some symbols do not cause problems when #include'ing system + headers (mainly by re-ordering the #include directives). + (This is particularly an issue for bootstrap.sh runs.) + + * sed/execute.c (execute_program): use memcpy() instead of + structure assingment ('x' command), for portablility to + old compilers. + + * sed/execute.c (slow_getline): use old-style function + declaration, with a P_ prototype. + + * sed/sed.c: change the type of the fallback MAP_FAILED + definition to work on archaic systems. (Modern systems + should be defining it themselves, so the change from + void * shouldn't be a problem.) + + * bootstrap.sh, README.bootstrap: actual testing of bootstrap + code revealed that I was too optimistic. Redesigned and + replaced implementation. + + * testsuite/Makefile: ignore errors from reference-implementation + seds that aren't up to snuff. + + * testsuite/help.good, testsuite/version.good: update to + current version's output. + +Fri May 8 15:08:28 PDT 1998 Ken Pizzini <ken@gnu.org> + + *** Version 3.01-beta1 released + + * sed/sed.c (main, usage): once again tweak the --help and + --version output to bettery comply with GNU coding standards. + + * testsuite/help.good, testsuite/version.good: update to + reflect above change. + + * doc/sed.texi: fix "Invoking" node's spelling to comply + with GNU standards. + +Fri May 8 11:43:10 PDT 1998 Ken Pizzini <ken@gnu.org> + + * doc/sed.1, doc/Makefile.am: wrote (very basic) man page. + +Thu May 7 20:40:21 PDT 1998 Ken Pizzini <ken@gnu.org> + + * lib/Makefile.am, lib/memmove.c, lib/memchr.c, lib/regex.c, + lib/memcpy.c, lib/regex.h, lib/memcopy.h, lib/string.h, + lib/pagecopy.h, lib/ansidecl.h: grab yet-another-version + from gnu.org for baseline and/or edit copyright boilerplate + using official lgpl2gpl.sed script. Take care not to + loose regnexec() interface or special conditional-compilation + code. + +Wed May 6 23:35:12 PDT 1998 Ken Pizzini <ken@gnu.org> + + * lib/regex.c, lib/regex.h: take from grep-2.1 distribution, + then trivially added the regnexec() interface. + + * sed/sed.c, sed/compile.c, sed/execute.c: made modifications + to work with regex instead of rx. + + * rx/*: deleted directory; the code is just too slow. + I think it will be easier to extend regex to fully + support POSIX.2 than to tune rx to be reasonable. + Even if this supposition is wrong, I'd rather make + the 3.01 release with the slightly deficient regex. + + * Makefile.am lib/Makefile.am, sed/Makefile.am: made changes + related to the substitution of regex for rx. + + * lib/Makefile.am, sed/Makefile.am: since regex is not a + ``compatability'' module, changed name of library to + ``libsed.a''. + + * lib/memchr.c, lib/memcpy.c, lib/memmove.c: add conditional + compilation code to leave zero-sized .o file if system + already supports the implemented function. + + * testsuite/help.good, testsuite/version.good: brought + up-to-date (once again). + + * NEWS, ANNOUNCE: changes to reflect this batch of changes. + +Wed May 6 18:40:47 PDT 1998 Ken Pizzini <ken@gnu.org> + + * sed/execute.c: discovered awful bug in '}' handling: + it could read past the end of vec (because `n' was + being decremented below zero)! Needed to "continue" + instead of "break". + +Tue May 5 14:34:38 PDT 1998 Ken Pizzini <ken@gnu.org> + + * doc/sed.texi, doc/version.texi: wrote some rudimentary + texinfo documentation. + + * ANNOUNCE, NEWS, README, README.rx, Makefile.am: + more updates for the upcoming beta-release. + + * sed/compile.c, sed/execute.c, sed/sed.c, sed/utils.c, + sed/sed.h, lib/strerror.c: update copyright notice text. + +Fri May 1 15:41:37 PDT 1998 Ken Pizzini <ken@gnu.org> + + * sed/execute.c (match_an_address_p, match_address_p): if + the second element of an address range is a line number, + and that line number is *less than* (or equal to) the + current line number, we only match the one line (per + POSIX.2, section 4.55.7.1). [Bug discovered as reported + in the seders mailing list FAQ.] + + * AUTHORS, NEWS, acconfig.h, configure.in, doc/Makefile.am, + lib/Makefile.am, sed/Makefile.am, lib/README, + testsuite/help.good, testsuite/version.good: + Updated in anticipation of the 3.01-beta1 release. + Reorganized development source tree to make creation + of a distribution simpler. Most notable changes were + to the various Makefile.am files and configure.in, but + some minor edits (such as deleting or changing #include + directives) have been made in many other source files. + + * bootstrap.sh, README.bootstrap: created a mechanism for + creating sed on a system which lacks a working sed. + +Thu Apr 16 23:52:11 PDT 1998 Ken Pizzini <ken@gnu.org> + + * sed.h, sed.c, execute.c, compile.c: did a spell-check on + the comments; fixed several typos. + +Thu Apr 16 13:43:01 PDT 1998 Ken Pizzini <ken@gnu.org> + + * execute.c (do_subst): fixed bug where the "replaced" flag + was being set to one inappropriately when at least one + but fewer than sub->numb matches of the regexp were found. + (Thanks to Simon Taylor <staylor@hermes.iaccess.com.au> + for the bug report.) + +Wed Apr 15 11:35:31 PDT 1998 Ken Pizzini <ken@gnu.org> + + * sed.h, sed.c, compile.c, execute.c: having a concern that + a cast was being done inappropriately, and realizing that + there is no quick way to locate all casts in a program, I + went through and marked all casts with a simple macro. + Now it is a simple matter to locate the casts, and it is + also a simple matter to turn of casts for a lint session + (if it should be desired). + +Wed Apr 15 10:29:21 PDT 1998 Ken Pizzini <ken@gnu.org> + + * compile.c, sed.c: redo compile phase so that brace + expressions can be spread across multiple files. + For example: + printf '{' >a; printf 'l;d' >b; printf '}' >c + sed -f a -f b -f c foo + will now compile (and work), instead of complaining + about an unmatched '{'. The mess created in compile.c + allowed a little simplification to the command-line + processing of "-e" options in sed.c. + + sed.h: added (opaque) err_info member to struct vector; + added comments to the members of struct vector. + +Wed Apr 14 23:50:50 PDT 1998 Ken Pizzini <ken@gnu.org> + + * sed.h, sed.c, compile.c, execute.c: added types countT and + flagT in order to clarify what various "int"s were doing. + Also makes it easy to change the type used for counts + (for example, to "unsigned long long") if desired, although + there are still some gotchas (such as the printf() format + for the '=' command). + +Tue Apr 14 17:34:54 PDT 1998 Ken Pizzini <ken@gnu.org> + + * execute.c (execute_program, process_files, count_branches, + shrink_program): Added a first attempt at program optimization. + We now can quit early if we are running with the "-n" + and all of the commands are known to be valid only for + lines less than the current line. Thus the "sed" in + "foo | sed -n 1,2p" will print read three lines, printint + the first two, and then quit, regardless of how much longer + "foo" might run or output. This optimization does not buy + much in most cases (it sometimes even costs a little), + but when it does help it can help big. The code is + all conditionally compiled based on the + EXPERIMENTAL_DASH_N_OPTIMIZATION symbol being #defined, + so it can be easily omitted if it causes problems. + +Tue Apr 14 12:25:06 PDT 1998 Ken Pizzini <ken@gnu.org> + + * execute.c (test_dollar_EOF, last_file_with_data_p): + test_dollar_EOF() was incorrectly returning a false (0) + when there were unprocessed files, none of which had any + data (either unopenable or zero-length). Created + last_file_with_data_p() to detect this situation, and + modified test_dollar_EOF() to make use of it. + +Thu Apr 2 23:02:18 PST 1998 Ken Pizzini <ken@gnu.org> + + * compile.c (match_slash): match_slash() did not handle + [.coll.], [=equiv=], and [:class:] sequences within a + character class. Added snarf_char_class() [which is a + remote derivative of parse_char_class() from GNU ed-0.2] + to deal with the details, and altered match_slash() + to make use of it. Also created the trivial + add_then_next() to avoid clutter in snarf_char_class(). + +Thu Apr 2 20:34:42 PST 1998 Ken Pizzini <ken@gnu.org> + + * execute.c, sed.c, sed.h: There was a severe bug in + how the code handled "sed 5n a b" when "a" consists + of exactly five lines -- it behaved like "sed 5q a b"! + + Rearranged where files get opened -- large scale + changes primarily involving main(), process_files(), + and read_pattern_space(), but also touching on several + other parts of execute.c. The read_pattern_space() + function became unwieldly and parts were split into + open_next_file(), closedown(), read_always_fail(), + read_mem_line(), and read_file_line(). The + at_end_of_file_p() function became obsolete and was + eliminated; test_dollar_EOF_p() was updated. A few + global and module-static variables were elminated, and + "struct line" was extended; comments were added to the + "struct line" declartation to document some important + dependencies in it. + + I undertook the reorganization with dread, but I + feel that the new organization is an improvement + well beyond just fixing the bug that inspired it. + +Thu Apr 2 01:16:25 PST 1998 Ken Pizzini <ken@gnu.org> + + * execute.c (read_file_line, slow_getline): the fread() + buffering code gives insufficient feedback to a user + running sed with a tty input device, so I created + slow_getline() for reading from a tty device. + Additionally, EOF detection has been made a little more + sensitive to avoid requiring multiple EOFs to be entered + from a tty. + + * configure.in: added isatty() check. + +Wed Apr 1 11:04:30 PST 1998 Ken Pizzini <ken@gnu.org> + + * configure.in (CPPFLAGS, LDFLAGS, LIBS): + Set to appropriate values if large file support needs + explicit enabling. Code fragment taken from a 1997-10-25 + patch to gawk by Paul Eggert <eggert@twinsun.com> + +Thu Aug 14 17:43:27 PDT 1997 Ken Pizzini <ken@gnu.org> + + * utils.c (ck_fclose): modified to ignore NULL parameter. + +Thu Aug 14 12:08:45 PDT 1997 Ken Pizzini <ken@gnu.org> + + * execute.c: tweaked execute_program() to eliminate + gratuitous "goto" usage. + +Thu Aug 14 11:30:04 PDT 1997 Ken Pizzini <ken@gnu.org> + + * compile.c: added case-insensitive modifier ('I') to + address and s/// regexps. The s/// case also accepts + the more popular 'i' modifier. (The address regexp + cannot use 'i' as a modifier, as that conflicts with + the use of the 'i'nsert command.) + +Thu Aug 14 09:29:06 PDT 1997 Ken Pizzini <ken@gnu.org> + + * compile.c: abstracted out match_slash() from the s///, y///, + and address-regexp special-case codes. + + * execute.c: made dump_append_queue() use ck_fread() instead + of hand-rolled error checking. + +Mon Jul 28 10:50:41 PDT 1997 Ken Pizzini <ken@gnu.org> + + * sed.c, sed.h, execute.c: POSIX.2, section 4.55.7, says that + a newline must end *every* output line. But I think that + it is useful (when seding a binary file) to omit a trailing + newline if the input lacks one. Thus the addition of + POSIXLY_CORRECT behavior. + + * execute.c: however, when seding multiple files my feeling + is that it makes sense to have each file but the last + behave as-if it ended in a newline. Modified read_pattern_space() + accordingly. + + * utils.c: realized that add1_buffer(), for performance reasons, + shouldn't be calling memcpy() (indirectly via add_buffer()), + so rewrote it. + +Sat Jul 26 23:08:28 PDT 1997 Ken Pizzini <ken@gnu.org> + + * execute.c: attempted to make read_pattern_space more + efficient for the the non-mmap() case. + + * utils.c, utils.h, execute.c: new function ck_fread() + created and used. + +Sat Jul 26 20:22:14 PDT 1997 Ken Pizzini <ken@gnu.org> + + * execute.c, compile.c, sed.c: abstracted the mmap() + interface into map_file()/unmap_file() [sed.c], and + changed the ad-hoc code in compile_file() [compile.c] + and process_file() [execute.c] to make use of the new + interface. + +Sat Jul 26 19:45:46 PDT 1997 Ken Pizzini <ken@gnu.org> + + * execute.c, compile.c, configure.in: Check to see if mmap() + is available; if so make use of it on regular files. + + * compile.c: compile_file() now closes the input file + when it is through! + +Sun Jul 20 23:57:02 PDT 1997 Ken Pizzini <ken@gnu.org> + + * compile.c: modified parsing to permit whitespace in more + places where it makes sense; + added backslash escaping to the y/// command, per POSIX. + + * execute.c: Merged append_pattern_space() into read_pattern_space(); + moved body of 's' command to new function do_subst(); + moved body of 'l' command to new function do_list(); + changed output of 'l' command to conform to POSIX.2; + made line handling conform to POSIX; added output_line() function; + redesigned append-space algorithm; added append_queue structure and + the next_append_slot() and dump_append_queue() functions. + + * sed.h: moved the definition of what is now struct subst + outside of the definition of struct sed_cmd. + +Sat Jul 19 16:29:09 PDT 1997 Ken Pizzini <ken@gnu.org> + + * sed.c, execute.c, sed.h, Makefile.am: Separated out the + pieces dealing with executing the program from the top-level + parameter parsing and control. + +Sat Jul 19 01:16:35 PDT 1997 Ken Pizzini <ken@gnu.org> + + * sed.c, compile.c, sed.h, Makefile.am: separate out the + pieces dealing with compiling the program from the pieces + dealing with interpreting the result. + + * compile.c: add functions in_nonblank() and in_integer(), + and change interface to compile_address() with an eye + to making code clearer. + +Fri Jul 18 13:35:50 PDT 1997 Ken Pizzini <ken@gnu.org> + + * utils.c: attempt at a quasi-unification of the + STDC and traditional C approaches to panic(). + + * sed.c: eliminate some gratuitous bit twiddling. + (Using flag bits can be a useful technique, but + this code is cleaner without them.) + + * sed.c: place mutually exclusive members of struct addr + within a union, mainly to document the exclusivity; + eliminate unused structure members from struct fp_list; + eliminate unnecessary module-global variables; + remove some #if 0 code that is too odd to keep; + allegedly simplified the 'l' case of execute_program(); + allegedly simplified inchar(); + localized some static variables; + renamed some variables to better document their purpose; + removed some goto-s rendered obsolete by other changes. + +Thu Jul 17 15:30:44 PDT 1997 Ken Pizzini <ken@gnu.org> + + * utils.c, utils.h, sed.c: added and made use of + ck_free() function. + + * utils.c, utils.h, sed.c: changed all the *_buffer() + functions to take/return an incomplete type + "struct buffer *" instead of using VOID *. + + * utils.c, utils.h, sed.c: renamed "finish_buffer()" + to "free_buffer()", on the premise that the new + name better describes the function's purpose. + +Wed Jul 16 13:52:14 PDT 1997 Ken Pizzini <ken@gnu.org> + + * utils.c, utils.h, sed.c: added and made use of + ck_memdup() function. + + * sed.c: protected a call to add1_buffer() in + compile_program() which could have tried to + push an EOF if a a/i/c command ended with + a '\', EOF sequence. + + * utils.c: added sanity check to add1_buffer() so that + EOF will not be added to the buffer. + +Wed Jul 16 03:56:26 PDT 1997 Ken Pizzini <ken@gnu.org> + + * configure.in, compat.h, compat.c: added memchr. + + * sed.c: got rid of arbitrary NUM_FPS limit; + made global functions and variables "static" where appropriate; + make various cosmetic changes, hopefully improving readability; + simplified some redundant predicates; + simplified some code, but nothing fundamental (yet?). + +Wed Jul 16 00:24:54 PDT 1997 Ken Pizzini <ken@gnu.org> + + * alloca.c, getopt.c, getopt.h, getopt1.c: updated from + versions in textutils-1.22. + + * Makefile.in, Makefile.am, configure.in: put in automake support. + + * basicdefs.h, compat.h, compat.c [, sed.c, utils.c]: took out + some very ugly compatibility #ifdefs and packaged into one + place. + + * sed.c, utils.c: some gratuitous formatting changes. + + * utils.c: changed datatype of utils_id_s in order to + eliminate arbitrary array size. + +Sun Jul 13 17:00:26 PDT 1997 Ken Pizzini <ken@gnu.org> + + * sed.c, utils.c, utils.h: de-linting oriented cleanup. + +Sun Jul 13 00:46:48 PDT 1997 Ken Pizzini <ken@gnu.org> + + * sed.c: fixed bug which caused SEGV for files missing a + final newline. Corrected calls to regnexec to pass the + proper parameters, in the proper order. + +Sat Dec 30 20:16:59 1995 Tom Lord <lord@beehive> + + *** Version 3.00 released + + * sed.c: Use posix entry points to regexp functions. + Fix enough bugs to pass the test-suite. + +....... Jason Molenda <crash@cygnus.com> + + * testsuite/: trippy test suite. + + +Wed May 11 07:46:24 1994 Chip Salzenberg (chip@fin.uucp) + + *** Version 2.05 released + + * sed.c (compile_address): Recognize numeric addresses. + Fixes typo made during installation of "~" feature. + +Sat Apr 30 17:17:38 1994 Tom Lord (lord@x1.cygnus.com) + + *** Version 2.04 released + + * sed.c: applied a patch from + From: kap1@tao.cpe.uchicago.edu (Dietrich Kappe) + + Dietrich writes: + + As my contribution to the creeping feature creature in sed, + here is a new type of address. The address has form n~m, + which means "the line number is equal to n modulo m." The + modifications to sed are trivial, and the general + usefulness of this address should be obvious. If m is 0 or + missing, 1 is used in its place (could be a bug or a + feature :-). + +Sat Apr 30 17:17:38 1994 Tom Lord (lord@x1.cygnus.com) + + * rx.c (solve_destination): protect `solution' more carefully. + This is a cleanup of a patch from Kevin Buettner + (kev@cujo.geg.mot.com). + +Sat Apr 30 17:17:38 1994 Tom Lord (lord@x1.cygnus.com) + + * rx.c: make translation tables unsigned chars + + * sed.c (main): Compile accumulated -e commands as + soon as a -f command comes along. This ensures that + the commands are executed in the right order. + +Mon Oct 25 14:41:47 1993 Tom Lord (lord@rtl.cygnus.com) + + * sed.c (execute_program): 'w' flushes the buffer after it + writes -- diagnosed by doug@research.att.com. 'r' and 'w' to + the same file is now supported -- hopefully even in a way that + satisfies Posix (it now behaves differently from some + /bin/sed's and the spec is hard to read so i'm not sure). + + Also, 'r' of a non-existent file is now permitted. + +Mon Oct 11 21:06:10 1993 Tom Lord (lord@cygnus.com) + + * sed.c (execute_program): remember that 'b' and 't' are more + like longjmp than goto. Patch from tom@basil.icce.rug.nl (Tom + R.Hageman) + + * rx.c: patch from From: fin!chip@rutgers.edu (Chip + Salzenberg) to get rid of compiler warnings. + + +Sat Aug 7 01:04:59 1993 Tom Lord (lord@unix7.andrew.cmu.edu) + + *** Version 2.03 released + + * sed.c (compile_regex): report error messages for bogus + regexps. + + SEE ALSO: ChangeLog.rx + + +Wed Jul 21 00:28:03 1993 Tom Lord (lord@unix8.andrew.cmu.edu) + + * alloca.c: upgraded to a more recent version + + * rx.c (re_search_2): prefer matches with longer + subexpressions to those with shorter ones, giving precedence + to low numbered subexpressions. + + * rx.c (re_compile): don't free `params' if its null. + +Fri Jul 16 01:12:08 1993 Tom Lord (lord@unix8.andrew.cmu.edu) + + * rx.[ch], sed.c: rx replaces regex. + + + +Thu May 27 11:13:03 1993 Tom Lord (lord@unix3.andrew.cmu.edu) + + * sed.c (execute_program, match_addr): caught more cases + that need to be sensitive to a missing \n at EOF. + +Fri May 21 00:39:22 1993 Tom Lord (lord@unix8.andrew.cmu.edu) + + * sed.c (execute_program): apply gaumondp's patch + to fix '\xabcxs/foo/bar/'. + + * sed.c (execute_program): + If a second address is a regexp, never match it on the + same line as the first address. + + * sed.c (compile_regexp): + Numeric ranges x,y s.t. y < x are now treated as x,x. + There was a bug in that they were being handled like x,x+1. + + * sed.c (execute_program, read_pattern_space, + append_pattern_space) don't add newlines to lines + that don't have them. + +Wed May 19 13:34:45 1993 Tom Lord (lord@unix9.andrew.cmu.edu) + + * sed.c (compile_program): grok \\n in comments. + +Mon May 17 16:34:50 1993 Tom Lord (lord@unix9.andrew.cmu.edu) + + * alloca.c: new (standard) file + + * configure.in: AC_CONSTified + + * sed.c (compile_program): properly diagnose the error of + a missing command (e.g. sed /x/). (thanks gaumondp) + + * sed.c (compile_regexp): handle character classes correctly. + Thanks gaumondp@ERE.UMontreal.CA + and schwab@issan.informatik.uni-dortmund.de. + +Thu May 6 12:37:18 1993 Tom Lord (lord@unix10.andrew.cmu.edu) + + * sed.c (compile_filename, execute_program): don't use + `access' or `/dev/null'. + + * sed.c (execute_program): 'N' at EOF should delete the pat buf. + + * sed.c (compile_filename): truncate, don't append files + being openned for `w' or `s///w' + + * sed.c (execute_program): -n switch shouldn't effect `i' or `c'. + + * sed.c (compile_program): don't compile unescaped newlines + into the substitution string of an `s' command (they are an error). + + * sed.c (compile_regex): correctly skip over character + sets that contain `]'. + + * sed.c (execute_program): patch from gaumondp + Correctly handle empty-string matches in the case of an `s' + command with a repeat count. + + * sed.c (compile_program): patch from gaumondp@ere.UMontreal.ca. + Don't consume characters after the label of a `b', `t' or `:' command. + + * sed.c (compile_program): unmatched open braces are an error. + + * sed.c (compile_file): when consuming an initial comment, + count lines correctly. + +Wed Nov 18 02:10:58 1992 Tom Lord (lord@unix2.andrew.cmu.edu) + + * sed.c (execute_program): Made s///p print even if -n was + specified. + + * sed.c (compile_string): Changed the type of this function to + fix a compile warning. + +Wed Nov 4 17:15:34 1992 Tom Lord (lord@unix7.andrew.cmu.edu) + + * sed.c (main): Initialize the hold area to contain "\n" + instead of "". In execute_program, all lines are expected + to be newline terminated. Also, if H is the first command + in the script, the result is a pattern buffer that begins + with a blank line. Thanks to pinard@iro.umontreal.ca + (Francois Pinard) for pointing out this and many other bugs. + + * sed.c (execute_program): Fixed a case of `D' command. + Thanks Chris Weber <weber@bucknell.edu> + + * sed.c: added new tests of no_default_output to make -n work. + Thanks Andrew Herbert <andrew@werple.apana.org.au> + + * sed.c, configure.in,Makefile.in: autoconfed bcopy and const. + Thanks "J.T. Conklin" <jtc@gain.com> + + * sed.c: made prog_cur, prog_start, and prog_end unsigned so + that users could write `sed -e s/ÿ/foo/g'. + +Tue Oct 13 00:04:05 1992 Tom Lord (lord@unix3.andrew.cmu.edu) + + * sed.c (execute_program): fixed the cycling behavior of 'D' + + * sed.c: integrated patch that closes files + + * sed.c: changed regexp syntax + +Fri May 22 15:11:12 1992 Tom Lord (lord at moriarty.bh.andrew.cmu.edu) + + * regex.c: this is not my change, but a pointer to the fact + that karl@gnu fixed some regexp bugs that were plaguing sed. + +Thu Apr 30 13:02:21 1992 Tom Lord (lord at unix3.andrew.cmu.edu) + + * sed.c (compile_program, execute_program) + subprograms are now compiled with an explicit continuation ;) + return_v and return_i in struct vector. execute_program + no longer recurses to execute subprograms (case '{') and now + understands a return instruction (case '{'). + +Tue Apr 28 17:13:04 1992 Tom Lord (lord at unix7.andrew.cmu.edu) + + * sed.c (compile_address) added \?regexp? syntax for addresses. + + * sed.c (main) added {} intervals to the obscure regexp + syntax. + + * sed.c (compile_program) after calling compile_address, + normalize numeric addresses (make a2.addr_number > a1.addr_number). + This is necessary because line numbers must match exactly, + but sed does not try to match a2 until after a1 has matched, + yet a1,a2 where a2 <= a1 is defined to be equivelent to + a1,a1+1 + +Sat Feb 29 10:55:54 1992 David J. MacKenzie (djm@nutrimat) + + * sed.c (usage): Document long options as starting with `--'. + +Mon Dec 9 23:56:40 1991 David J. MacKenzie (djm at wookumz.gnu.ai.mit.edu) + + * sed.c: Include sys/types.h, for new regex.h. + +Tue Nov 5 02:16:01 1991 David J. MacKenzie (djm at wookumz.gnu.ai.mit.edu) + + * utils.c: Change NO_VFPRINTF to VPRINTF_MISSING, for + compatibility with autoconf. + +Mon Sep 2 22:02:40 1991 David J. MacKenzie (djm at apple-gunkies) + + * sed.c (compile_regex): Treat \ as a normal character when in + a char class. + +Thu Aug 8 00:15:33 1991 David J. MacKenzie (djm at bleen) + + * Version 1.08. + + * sed.c (compile_filename): If reading a file fails, read + /dev/null instead. It's what Unix and POSIX do, effectively. + + * sed.c (compile_regex): The 'slash' character doesn't + terminate the regex if it's in a character class. + + * sed.c (main): If given no args, or bad option, print usage + message. + (usage): New function. + + * sed.c (execute_program): Amount written for 'P' command was + wrong. From stephend@ksr.com (Stephen Davis). + +Wed Aug 7 16:51:14 1991 David J. MacKenzie (djm at apple-gunkies) + + * sed.c (append_pattern_space): Check for buffer full before + instead of after writing to buffer. Don't need to test for + EOF initially anymore, due to the next change. + (execute_program): For 'n' and 'N' commands, if eof is reached + in input, quit the script like Unix sed does. + Fix memory allocation problems for 'a' and 'r' commands. + (compile_program): Fix off by one error in processing comments. + All of the above are from Tapani Tarvainen, tarvaine@tukki.jyu.fi. + + * sed.c (setup_jump): Use isblank instead of testing for ' ' + or '\t', for POSIX locales. + + * utils.c (ck_strdup): Renamed from strdup. + * sed.c: Change callers. + + * sed.c, utils.c: Clean up declarations and includes to get + rid of compiler warnings. + + * sed.c (main): Add long-named options. Don't complain if -n + is given twice. + +Fri Aug 2 12:33:16 1991 David J. MacKenzie (djm at apple-gunkies) + + * configure: Support +srcdir arg. Create config.status and + remove it and Makefile if interrupted while creating them. + * Makefile.in: Change DESTDIR to prefix. + +Mon Jul 15 13:07:39 1991 David J. MacKenzie (djm at wookumz.gnu.ai.mit.edu) + + * sed.c (main): Add -V option to print version number. + (USAGE): Mention -V. + +Mon Jul 8 01:42:22 1991 David J. MacKenzie (djm at geech.gnu.ai.mit.edu) + + * sed.c: Define bcopy in terms of memcpy if STDC_HEADERS as + well as if USG. + (compile_filename): Don't glob filename (for 'r' and 'w' + commands). Unix sed doesn't do it and it's not very useful, + since it can only match 0 or 1 files. + (execute_program): Change '\a' to 007 since some compilers + don't recognize \a. + * utils.c: New file; code moved from sed.c. + * Replace Makefile with Makefile.in and configure. + Update README. + +Tue Mar 26 13:00:48 EST 1991 Jay Fenlason (hack@gnu.ai.mit.edu) + + * sed.c (match_address) Added a trivial cast for portability. + +Mon Feb 25 13:23:29 EST 1991 Jay Fenlason (hack@ai.mit.edu) + + * sed.c Changed 's' command to work with latest version of regex() + routines, which mysteriously changed somewhere in there. . . + A one-line patch from David Eckelkamp (eckelkamp@mcc.com). + + Initialize the fastmap in the hopes that it'll make sed faster. + +Thu Feb 21 13:42:27 EST 1991 Jay Fenlason (hack@ai.mti.edu) + + * sed.c Change panic to compile with other __STDC__ compilers. + +Wed Jan 30 10:46:38 EST 1991 Jay Fenlason (hack@ai.mit.edu) + + * sed.c Changed version number. Made new release. + +Tue Nov 27 15:34:51 EST 1990 Jay Fenlason (hack@ai.mit.edu) + + * sed.c (setup_jump) Don't blow chunks if there isn't a label + after a b or t command. + + (main) Don't panic if it a branch command doesn't have + a label to branch to. + + (main) Collect all the -e arguments together and parse them + all at once. This way, -e { -e mumble -e } will work. + + All these small patches from David Schmidt (davids@isc-br.isc-br.com) + +Tue Sep 11 12:51:37 EDT 1990 Jay Fenlason (hack@ai.mit.edu) + + * sed.c Changed some function forward declarations to use VOID * + instead of char * + +Mon Jul 16 11:12:54 EDT 1990 Jay Fenlason (hack@ai.mit.edu) + + * sed.c (ck_malloc) Use malloc(1) instead of malloc(0) if given + a request for zero bytes. + +Tue Jun 5 02:05:37 1990 David J. MacKenzie (djm at albert.ai.mit.edu) + + * sed.c: Remove excess newlines from calls to panic. + Reformat some comments to fit in 79 columns. + Base whether to use void * on __STDC__, not __GNU__. + (main): Add missing arg when printing usage message. + Print usage if given invalid arg. + (panic) [__STDC__]: Add missing ", ...". + (compile_filename): Print correct error message if glob_filename + returns NULL. + +Thu Apr 5 21:41:12 1990 Jim Kingdon (kingdon at pogo.ai.mit.edu) + + * sed.c (execute_program, case 'r'): When need to realloc append.text, + multiply append.alloc by 2 instead of adding + cur_cmd->x.cmd_txt.text_len. + +Tue Mar 6 15:55:35 EST 1990 Jay Fenlason (hack@ai.mit.edu) + + * sed.c (compile_regex) Allocate 10 bytes extra space needed by + re_compile_pattern. + +Sun Feb 25 16:32:10 1990 Jim Kingdon (kingdon at pogo.ai.mit.edu) + + * sed.c (execute_program, case 'l'): Print \00 instead of \0. + Print backslash as \\ not \. + Print \xx instead of /xx. + +Thu Feb 1 14:02:28 EST 1990 hack@wookumz + + * sed.c (memchr) Use () inside inner loop so it will work correctly. + A two character patch from Robert A Bruce (rab@allspice.berkeley.edu) + +Wed Sep 27 18:47:39 EDT 1989 hack@ai.mit.edu + + * sed.c (compile_regex) New function. When compiling regex, + turn ^ into \` and $ into \' so that they won't match on embedded + newlines. UN*X pattern matching is a crock. + (compile_program, compile_address) call compile_regex. + +Mon Sep 18 10:15:32 EDT 1989 hack@ai.mit.edu + + * sed.c (compile_program): define translate as unsigned char * so + that y command will work on non-ascii characters. + + Changed version number to 1.06. + +Thu Sep 14 15:57:08 EDT 1989 hack@ai.mit.edu + + * sed.c (compile_program) Let programs use ; to terminate } as + well as newline. + + (read_file) Print an error msg to stderr if it can't open an + input file. + +Thu Mar 23 18:04:46 1989 Randall Smith (randy at apple-gunkies.ai.mit.edu) + + * Makefile, sed.c: Added new copyright notice. + + * Makefile: Make distributions which follow the symlinks. + +hack@ai.mit.edu + + 1.05 Fixed error in 'r' (now does things in the right order) + + 1.04 Fixed s/re/rep/[number] + + 1.03 Fixes from Mike Haertel for regexps that match the + empty string, and for Ritchie stdio (non-sticky EOF) + + 1.02 Fixed 't', 'b', ':' to trim leading spaces and tabs + Fixed \\ in replacement of 's' command + Added comments + + 1.01 Added s/re/rep/[digits] + added #n as first line of script + added filename globbing + added 'l' command + All in the name of POSIX + + 1.00 Began (thinking about) distributing this file + +Local Variables: +mode: indented-text +left-margin: 8 +version-control: never +End: diff --git a/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/INSTALL b/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/INSTALL new file mode 100644 index 0000000..23e5f25 --- /dev/null +++ b/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/INSTALL @@ -0,0 +1,236 @@ +Installation Instructions +************************* + +Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free +Software Foundation, Inc. + +This file is free documentation; the Free Software Foundation gives +unlimited permission to copy, distribute and modify it. + +Basic Installation +================== + +These are generic installation instructions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, and a +file `config.log' containing compiler output (useful mainly for +debugging `configure'). + + It can also use an optional file (typically called `config.cache' +and enabled with `--cache-file=config.cache' or simply `-C') that saves +the results of its tests to speed up reconfiguring. (Caching is +disabled by default to prevent problems with accidental use of stale +cache files.) + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If you are using the cache, and at +some point `config.cache' contains results you don't want to keep, you +may remove or edit it. + + The file `configure.ac' (or `configure.in') is used to create +`configure' by a program called `autoconf'. You only need +`configure.ac' if you want to change it or regenerate `configure' using +a newer version of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. If you're + using `csh' on an old version of System V, you might need to type + `sh ./configure' instead to prevent `csh' from trying to execute + `configure' itself. + + Running `configure' takes awhile. While running, it prints some + messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + +Compilers and Options +===================== + +Some systems require unusual options for compilation or linking that the +`configure' script does not know about. Run `./configure --help' for +details on some of the pertinent environment variables. + + You can give `configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here +is an example: + + ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix + + *Note Defining Variables::, for more details. + +Compiling For Multiple Architectures +==================================== + +You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of `make' that +supports the `VPATH' variable, such as GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + If you have to use a `make' that does not support the `VPATH' +variable, you have to compile the package for one architecture at a +time in the source code directory. After you have installed the +package for one architecture, use `make distclean' before reconfiguring +for another architecture. + +Installation Names +================== + +By default, `make install' installs the package's commands under +`/usr/local/bin', include files under `/usr/local/include', etc. You +can specify an installation prefix other than `/usr/local' by giving +`configure' the option `--prefix=PREFIX'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +pass the option `--exec-prefix=PREFIX' to `configure', the package uses +PREFIX as the prefix for installing programs and libraries. +Documentation and other data files still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=DIR' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + +Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + +There may be some features `configure' cannot figure out automatically, +but needs to determine by the type of machine the package will run on. +Usually, assuming the package is built to be run on the _same_ +architectures, `configure' can figure that out, but if it prints a +message saying it cannot guess the machine type, give it the +`--build=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name which has the form: + + CPU-COMPANY-SYSTEM + +where SYSTEM can have one of these forms: + + OS KERNEL-OS + + See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the machine type. + + If you are _building_ compiler tools for cross-compiling, you should +use the option `--target=TYPE' to select the type of system they will +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the +"host" platform (i.e., that on which the generated programs will +eventually be run) with `--host=TYPE'. + +Sharing Defaults +================ + +If you want to set default values for `configure' scripts to share, you +can create a site shell script called `config.site' that gives default +values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Defining Variables +================== + +Variables not defined in a site shell script can be set in the +environment passed to `configure'. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the `configure' command line, using `VAR=value'. For example: + + ./configure CC=/usr/local2/bin/gcc + +causes the specified `gcc' to be used as the C compiler (unless it is +overridden in the site shell script). Here is a another example: + + /bin/bash ./configure CONFIG_SHELL=/bin/bash + +Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent +configuration-related scripts to be executed by `/bin/bash'. + +`configure' Invocation +====================== + +`configure' recognizes the following options to control how it operates. + +`--help' +`-h' + Print a summary of the options to `configure', and exit. + +`--version' +`-V' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally `config.cache'. FILE defaults to `/dev/null' to + disable caching. + +`--config-cache' +`-C' + Alias for `--cache-file=config.cache'. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`configure' also accepts some other, not widely useful, options. Run +`configure --help' for more details. + diff --git a/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/NEWS b/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/NEWS new file mode 100644 index 0000000..cd755d2 --- /dev/null +++ b/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/NEWS @@ -0,0 +1,502 @@ +Sed 4.2.1 + +* fix parsing of s/[[[[[[[[[]// + +* security contexts are preserved by -i too under SELinux + +* temporary files for sed -i are not made group/world-readable until + they are complete + +---------------------------------------------------------------------------- +Sed 4.2 + +* now released under GPLv3 + +* added a new extension `z` to clear pattern space even in the presence +of invalid multibyte sequences + +* a preexisting GNU gettext installation is needed in order to compile +GNU sed with NLS support + +* new option --follow-symlinks, available when editing a file in-place. +This option may not be available on some systems (in this case, the +option will *not* be a no-op; it will be completely unavailable). +In the future, the option may be added as a no-op on systems without +symbolic links at all, since in this case a no-op is effectively +indistinguishable from a correct implementation. + +* hold-space is reset between different files in -i and -s modes. + +* multibyte processing fixed + +* the following GNU extensions are turned off by --posix: options [iImMsSxX] +in the `s' command, address kinds `FIRST~STEP' and `ADDR1,+N' and `ADDR1,~N', +line address 0, `e' or `z' commands, text between an `a' or `c' or `i' +command and the following backslash, arguments to the `l' command. +--posix disables all extensions to regular expressions. + +* fixed bug in 'i\' giving a segmentation violation if given alone. + +* much improved portability + +* much faster in UTF-8 locales + +* will correctly replace ACLs when using -i + +* will now accept NUL bytes for `.' + +---------------------------------------------------------------------------- +Sed 4.1.5 + +* fix parsing of a negative character class not including a closed bracket, + like [^]] or [^]a-z]. + +* fix parsing of [ inside an y command, like y/[/A/. + +* output the result of commands a, r, R when a q command is found. + +---------------------------------------------------------------------------- +Sed 4.1.4 + +* \B correctly means "not on a word boundary" rather than "inside a word" + +* bugfixes for platform without internationalization + +* more thorough testing framework for tarballs (`make full-distcheck') + +---------------------------------------------------------------------------- +Sed 4.1.3 + +* regex addresses do not use leftmost-longest matching. In other words, + /.\+/ only looks for a single character, and does not try to find as + many of them as possible like it used to do. + +* added a note to BUGS and the manual about changed interpretation + of `s|abc\|def||', and about localization issues. + +* fixed --disable-nls build problems on Solaris. + +* fixed `make check' in non-English locales. + +* `make check' tests the regex library by default if the included regex + is used (regex tests had to be enabled separately up to now). + +---------------------------------------------------------------------------- +Sed 4.1.2 + +* fix bug in 'y' command in multi-byte character sets + +* fix severe bug in parsing of ranges with an embedded open bracket + +* fix off-by-one error when printing a "bad command" error + +---------------------------------------------------------------------------- +Sed 4.1.1 + +* preserve permissions of in-place edited files + +* yield an error when running -i on terminals or other non regular files + +* do not interpret - as stdin when running in in-place editing mode + +* fix bug that prevented 's' command modifiers from working + +---------------------------------------------------------------------------- +Sed 4.1 + +* // matches the last regular expression even in POSIXLY_CORRECT mode. + +* change the way we treat lines which are not terminated by a newline. +Such lines are printed without the terminating newline (as before) +but as soon as more text is sent to the same output stream, the +missing newline is printed, so that the two lines don't concatenate. +The behavior is now independent from POSIXLY_CORRECT because POSIX +actually has undefined behavior in this case, and the new implementation +arguably gives the ``least expected surprise''. Thanks to Stepan +Kasal for the implementation. + +* documentation improvements, with updated references to the POSIX.2 +specification + +* error messages on I/O errors are better, and -i does not leave temporary +files around (e.g. when running ``sed -i'' on a directory). + +* escapes are accepted in the y command (for example: y/o/\n/ transforms +o's into newlines) + +* -i option tries to set the owner and group to the same as the input file + +* `L' command is deprecated and will be removed in sed 4.2. + +* line number addresses are processed differently -- this is supposedly +conformant to POSIX and surely more idiot-proof. Line number addresses +are not affected by jumping around them: they are activated and +deactivated exactly where the script says, while previously + 5,8b + 1,5d +would actually delete lines 1,2,3,4 and 9 (!). + +* multibyte characters are taken in consideration to compute the +operands of s and y, provided you set LC_CTYPE correctly. They are +also considered by \l, \L, \u, \U, \E. + +* [\n] matches either backslash or 'n' when POSIXLY_CORRECT. + +* new option --posix, disables all GNU extensions. POSIXLY_CORRECT only +disables GNU extensions that violate the POSIX standard. + +* options -h and -V are not supported anymore, use --help and --version. + +* removed documentation for \s and \S which worked incorrectly + +* restored correct behavior for \w and \W: match [[:alnum:]_] and +[^[:alnum:]_] (they used to match [[:alpha:]_] and [^[:alpha:]_] + +* the special address 0 can only be used in 0,/RE/ or 0~STEP addresses; +other cases give an error (you are hindering portability for no reason +if specifying 0,N and you are giving a dead command if specifying 0 +alone). + +* when a \ is used to escape the character that would terminate an operand +of the s or y commands, the backslash is removed before the regex is +compiled. This is left undefined by POSIX; this behavior makes `s+x\+++g' +remove occurrences of `x+', consistently with `s/x\///g'. (However, if +you enjoy yourself trying `s*x\***g', sed will use the `x*' regex, and you +won't be able to pass down `x\*' while using * as the delimiter; ideas on +how to simplify the parser in this respect, and/or gain more coherent +semantics, are welcome). + + +---------------------------------------------------------------------------- +Sed 4.0.9 + +* 0 address behaves correctly in single-file (-i and -s) mode. + +* documentation improvements. + +* tested with many hosts and compilers. + +* updated regex matcher from upstream, with many bugfixes and speedups. + +* the `N' command's feature that is detailed in the BUGS file was disabled +by the first change below in sed 4.0.8. The behavior has now been +restored, and is only enabled if POSIXLY_CORRECT behavior is not +requested. + +---------------------------------------------------------------------------- +Sed 4.0.8 + +* fix `sed n' printing the last line twice. + +* fix incorrect error message for invalid character classes. + +* fix segmentation violation with repeated empty subexpressions. + +* fix incorrect parsing of ^ after escaped (. + +* more comprehensive test suite (and with many expected failures...) + +---------------------------------------------------------------------------- +Sed 4.0.7 + +* VPATH builds working on non-glibc machines + +* fixed bug in s///Np: was printing even if less than N matches were +found. + +* fixed infinite loop on s///N when LHS matched a null string and +there were not enough matches in pattern space + +* behavior of s///N is consistent with s///g when the LHS can match +a null string (and the infinite loop did not happen :-) + +* updated some translations + +---------------------------------------------------------------------------- +Sed 4.0.6 + +* added parameter to `v' for the version of sed that is expected. + +* configure switch --without-included-regex to use the system regex matcher + +* fix for -i option under Cygwin + +---------------------------------------------------------------------------- +Sed 4.0.5 + +* portability fixes + +* improvements to some error messages (e.g. y/abc/defg/ incorrectly said +`excess characters after command' instead of `y arguments have different +lengths') + +* `a', `i', `l', `L', `r' accept two addresses except in POSIXLY_CORRECT +mode. Only `q' and `Q' do not accept two addresses in standard (GNU) mode. + +---------------------------------------------------------------------------- +Sed 4.0.4 + +* documentation fixes + +* update regex matcher + +---------------------------------------------------------------------------- +Sed 4.0.3 + +* fix packaging problem (two missing translation catalogs) + +---------------------------------------------------------------------------- +Sed 4.0.2 + +* more translations + +* fix build problems (vpath builds and bootstrap builds) + +---------------------------------------------------------------------------- +Sed 4.0.1 + +* Remove last vestiges of super-sed + +* man page automatically built + +* more translations provided + +* portability improvements + +---------------------------------------------------------------------------- +Sed 4.0 + +* Update regex matcher + +---------------------------------------------------------------------------- +Sed 3.96 + +* `y' command supports multibyte character sets + +* Update regex matcher + +---------------------------------------------------------------------------- +Sed 3.95 + +* `R' command reads a single line from a file. + +* CR-LF pairs are always ignored under Windows, even if (under Cygwin) +a disk is mounted as binary. + +* More attention to errors on stdout + +* New `W' command to write first line of pattern space to a file + +* Can customize line wrap width on single `l' commands + +* `L' command formats and reflows paragraphs like `fmt' does. + +* The test suite makefiles are better organized (this change is +transparent however). + +* Compiles and bootstraps out-of-the-box under MinGW32 and Cygwin. + +* Optimizes cases when pattern space is truncated at its start or at +its end by `D' or by a substitution command with an empty RHS. +For example scripts like this, + + seq 1 10000 | tr \\n \ | ./sed ':a; s/^[0-9][0-9]* //; ta' + +whose behavior was quadratic with previous versions of sed, have +now linear behavior. + +* New command `e' to pipe the output of a command into the output +of sed. + +* New option `e' to pass the output of the `s' command through the +Bourne shell and get the result into pattern space. + +* Switched to obstacks in the parser -- less memory-related bugs +(there were none AFAIK but you never know) and less memory usage. + +* New option -i, to support in-place editing a la Perl. Usually one +had to use ed or, for more complex tasks, resort to Perl; this is +not necessary anymore. + +* Dumped buffering code. The performance loss is 10%, but it caused +bugs in systems with CRLF termination. The current solution is +not definitive, though. + +* Bug fix: Made the behavior of s/A*/x/g (i.e. `s' command with a +possibly empty LHS) more consistent: + + pattern GNU sed 3.x GNU sed 4.x + B xBx xBx + BC xBxCx xBxCx + BAC xBxxCx xBxCx + BAAC xBxxCx xBxCx + +* Bug fix: the // empty regular expressions now refers to the last +regular expression that was matched, rather than to the last +regular expression that was compiled. This richer behavior seems +to be the correct one (albeit neither one is POSIXLY_CORRECT). + +* Check for invalid backreferences in the RHS of the `s' command +(e.g. s/1234/\1/) + +* Support for \[lLuUE] in the RHS of the `s' command like in Perl. + +* New regular expression matcher + +* Bug fix: if a file was redirected to be stdin, sed did not consume +it. So + (sed d; sed G) < TESTFILE + +double-spaced TESTFILE, while the equivalent `useless use of cat' + cat TESTFILE | (sed d; sed G) + +printed nothing (which is the correct behavior). A test for this +bug was added to the test suite. + +* The documentation is now much better, with a few examples provided, +and a thorough description of regular expressions. The manual often +refers to "GNU extensions", but if they are described here they are +specific to this version. + +* Documented command-line option: + -r, --regexp-extended + Use extended regexps -- e.g. (abc+) instead of \(abc\+\) + +* Added feature to the `w' command and to the `w' option of the `s' +command: if the file name is /dev/stderr, it means the standard +error (inspired by awk); and similarly for /dev/stdout. This is +disabled if POSIXLY_CORRECT is set. + +* Added `m' and `M' modifiers to `s' command for multi-line +matching (Perl-style); in addresses, only `M' works. + +* Added `Q' command for `silent quit'; added ability to pass +an exit code from a sed script to the caller. + +* Added `T' command for `branch if failed'. + +* Added `v' command, which is a do-nothing intended to fail on +seds that do not support GNU sed 4.0's extensions. + +---------------------------------------------------------------------------- +Sed 3.02.80 + +* Started new version nomenclature for pre-3.03 releases. (I'm being +pessimistic in assuming that .90 won't give me enough breathing room.) + +* Bug fixes: the regncomp()/regnexec() interfaces proved to be inadequate to +properly handle expressions such as "s/\</#/g". Re-abstracted the regex +code in the sed/ tree, and now use the re_search_2() interface to the GNU +regex routines. This change also fixed a bug where /./ did not match the +NUL character. Had the glibc folk fix a bug in lib/regex.c where +'s/0*\([0-9][0-9]\)/X\1X/' failed to match on input "002". + +* Added new command-line options: + -u, --unbuffered + Do not attempt to read-ahead more than required; do not buffer stdout. + -l N, --line-length=N + Specify the desired line-wrap length for the `l' command. + A length of "0" means "never wrap". + +* New internationalization translations added: fr ru de it el sk pt_BR sv +(plus nl from 3.02a). + +* The s/// command now understands the following escapes +(in both halves): + \a an "alert" (BEL) + \f a form-feed + \n a newline + \r a carriage-return + \t a horizontal tab + \v a vertical tab + \oNNN a character with the octal value NNN + \dNNN a character with the decimal value NNN + \xNN a character with the hexadecimal value NN +This behavior is disabled if POSIXLY_CORRECT is set, at least for the +time being (until I can be convinced that this behavior does not violate +the POSIX standard). (Incidentally, \b (backspace) was omitted because +of the conflict with the existing "word boundary" meaning. \ooo octal +format was omitted because of the conflict with backreference syntax.) + +* If POSIXLY_CORRECT is set, the empty RE // now is the null match +instead of "repeat the last REmatch". As far as I can tell +this behavior is mandated by POSIX, but it would break too many +legacy sed scripts to blithely change GNU sed's default behavior. + +---------------------------------------------------------------------------- +Sed 3.02a + +* Added internationalization support, and an initial (already out of date) +set of Dutch message translations (both provided by Erick Branderhorst). + +* Added support for scripts like: + sed -e 1ifoo -e '$abar' +(note no need for \ <newline> after a, i, and c commands). +Also, conditionally (on NO_INPUT_INDENT) added +experimental support for skipping leading whitespace on +each {a,i,c} input line. + +* Added addressing of the form: + /foo/,+5 p (print from foo to 5th line following) + /foo/,~5 p (print from foo to next line whose line number is a multiple of 5) +The first address of these can be any of the previously existing +addressing types; the +N and ~N forms are only allowed as the +second address of a range. + +* Added support for pseudo-address "0" as the first address in an +address-range, simplifying scripts which happen to match the end +address on the first line of input. For example, a script +which deletes all lines from the beginning of the file to the +first line which contains "foo" is now simply "sed 0,/foo/d", +whereas before one had to go through contortions to deal with +the possibility that "foo" might appear on the first line of +the input. + +* Made NUL characters in regexps work "correctly" --- i.e., a NUL +in a RE matches a NUL; it does not prematurely terminate the RE. +(This only works in -f scripts, as the POSIX.1 exec*() interface +only passes NUL-terminated strings, and so sed will only be able +to see up to the first NUL in any -e scriptlet.) + +* Wherever a `;' is accepted as a command terminator, also allow a `}' +or a `#' to appear. (This allows for less cluttered-looking scripts.) + +* Lots of internal changes that are only relevant to source junkies +and development testing. Some of which might cause imperceptible +performance improvements. + +---------------------------------------------------------------------------- +Sed 3.02 + +* Fixed a bug in the parsing of character classes (e.g., /[[:space:]]/). +Corrected an omission in djgpp/Makefile.am and an improper dependency +in testsuite/Makefile.am. + +---------------------------------------------------------------------------- +Sed 3.01 + +* This version of sed mainly contains bug fixes and portability +enhancements, plus performance enhancements related to sed's handling +of input files. Due to excess performance penalties, I have reverted +(relative to 3.00) to using regex.c instead of the rx package for +regular expression handling, at the expense of losing true POSIX.2 +BRE compatibility. However, performance related to regular expression +handling *still* needs a fair bit of work. + +* One new feature has been added: regular expressions may be followed +with an "I" directive ("i" was taken [the "i"nsert command]) to +indicate that the regexp should be matched in a case-insensitive +manner. Also of note are a new organization to the source code, +new documentation, and a new maintainer. + +---------------------------------------------------------------------------- +Sed 3.0 + +* This version of sed passes the new test-suite donated by +Jason Molenda. + +* Overall performance has been improved in the following sense: Sed 3.0 +is often slightly slower than sed 2.05. On a few scripts, though, sed +2.05 was so slow as to be nearly useless or to use up unreasonable +amounts of memory. These problems have been fixed and in such cases, +sed 3.0 should have acceptable performance. diff --git a/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/README b/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/README new file mode 100644 index 0000000..3da31c2 --- /dev/null +++ b/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/README @@ -0,0 +1,13 @@ +This is the GNU implementation of sed, the Unix stream editor. + +See the NEWS file for a brief summary and the ChangeLog for +more detailed descriptions of changes. + +See the file INSTALL for generic compilation and installation +instructions. + +See the file BUGS for instructions about reporting bugs. + +The file README.boot gives instructions for making a "bootstrap" +version of sed on systems which lack any pre-existing and working +version of sed. diff --git a/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/README-alpha b/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/README-alpha new file mode 100644 index 0000000..9235efe --- /dev/null +++ b/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/README-alpha @@ -0,0 +1,8 @@ +This is an alpha version of GNU sed. Please try it on a wide +range of scripts (especially configure scripts) and submit +bug reports to bonzini@gnu.org. + +Thanks, + +Paolo Bonzini +GNU sed maintainer diff --git a/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/README.boot b/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/README.boot new file mode 100644 index 0000000..fd2d1a0 --- /dev/null +++ b/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/README.boot @@ -0,0 +1,23 @@ +Because a working sed is a prerequisite for running the ``configure'' +script, I have provided the script ``bootstrap.sh'' which will attempt +to build a version of sed adequate for running ``configure''. If it +fails, edit the ``config.h'' file that was created according to the +comments found therein, and then try running ``bootstrap.sh'' again. + +The bootstrap build is quite likely to babble on and on with +various compiler warnings. You may want to tell bootstrap.sh +how to invoke your compiler with warnings disabled. For example, +with a Bourne-like shell and gcc one could use: + $ CC='gcc -w' sh bootstrap.sh +or with a csh-like shell, one could try: + % env CC='gcc -w' sh bootstrap.sh + +Once you get a working version of sed, temporarily install sed/sed +somewhere in your $PATH, and then really re-build the normal way +(starting with ``sh configure''); the bootstrap version is almost +certainly more crippled than it needs to be on your machine. + +I don't much care to hear about any bugs in ``bootstrap'' versions +of sed beyond those which actually keep the ``bootstrap'' version from +building, or sed's configure script from running properly. I am +especially uninterested in compiler warnings from the bootstrap build. diff --git a/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/THANKS b/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/THANKS new file mode 100644 index 0000000..76397d2 --- /dev/null +++ b/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/THANKS @@ -0,0 +1,54 @@ +Akim Demaille <akim@epita.fr> +Alan Modra <alan@spri.levels.unisa.edu.au> +Arnold Robbins <arnold@skeeve.com> +Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> +Andrew Herbert <andrew@werple.apana.org.au> +Bruno Haible <haible@ilog.fr> +Chip Salzenberg <chip@fin.uucp> +Chris Weber <weber@bucknell.edu> +Corinna Vinschen <vinschen@redhat.com> +Daniel R. Grayson <dan@math.uiuc.edu> +David Eckelkamp <eckelkamp@mcc.com> +David J. MacKenzie <djm@nutrimat> +David Schmidt <davids@isc-br.isc-br.com> +Dietrich Kappe <kap1@tao.cpe.uchicago.edu> +Doug McIlroy <doug@research.att.com> +Eero Hakkinen <eero17@bigfoot.com> +Eli Zaretskii <eliz@is.elta.co.il> +Eric Pement <epement@moody.edu> +Erick Branderhorst <Erick.Branderhorst@asml.nl> +Francois Pinard <pinard@iro.umontreal.ca> +Gaumond Pierre <gaumondp@ERE.UMontreal.CA> +Greg Ubben <gsu@romulus.ncsc.mil> +Isamu Hasegawa <isamu@yamato.ibm.com> +J.T. Conklin <jtc@gain.com> +Jakub Jelinek <jakub@redhat.com> +Jason Molenda <crash@cygnus.com> +Jim Meyering <meyering@ascend.com> +Laurent Vogel <lvl@club-internet.fr> +Karl Berry <karl@freefriends.org> +Karl Heuer <kwzh@gnu.org> +Kaveh R. Ghazi <ghazi@caip.rutgers.edu> +Kevin Buettner <kev@cujo.geg.mot.com> +Maciej W. Rozycki <macro@linux-mips.org> +Mark Kettenis <kettenis@phys.uva.nl> +Michael De La Rue <delarue@NTCCSC01WA.ntc.nokia.com> +Michel de Ruiter <mdruiter@cs.vu.nl> +Paul Eggert <eggert@twinsun.com> +Robert A Bruce <rab@allspice.berkeley.edu> +Ronnie Glasscock <Ronnie.N.Glasscock@bridge.bellsouth.com> +Sergey Farbotka <z8sergey8z@gmail.com> +Simon Taylor <simon@unisolve.com.au> +Stepan Kasal <kasal@ucw.cz> +Stephen Davis <stephend@ksr.com> +Steve Ingram <si@maps-r-us.com> +Tapani Tarvainen <tarvaine@tukki.jyu.fi> +Timothy J Luoma <luomat@peak.org> +Tom R.Hageman <tom@basil.icce.rug.nl> +Ulrich Drepper <drepper@redhat.com> +Vladimir Marek <vladimir.marek@sun.com> +Vladimir Volovich <vvv@vvv.vsu.ru> +Wichert Akkerman <wakkerma@debian.org> +Zhongxing Xu <xuzhongxing@gmail.com> + +And the GNU translation teams. diff --git a/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/doc/sed.info b/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/doc/sed.info new file mode 100644 index 0000000..5e1c9ae --- /dev/null +++ b/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/doc/sed.info @@ -0,0 +1,2558 @@ +This is ../../doc/sed.info, produced by makeinfo version 4.12 from +../../doc//config.texi. + +INFO-DIR-SECTION Text creation and manipulation +START-INFO-DIR-ENTRY +* sed: (sed). Stream EDitor. + +END-INFO-DIR-ENTRY + + This file documents version 4.2.1 of GNU `sed', a stream editor. + + Copyright (C) 1998, 1999, 2001, 2002, 2003, 2004 Free Software +Foundation, Inc. + + This document is released under the terms of the GNU Free +Documentation License as published by the Free Software Foundation; +either version 1.1, or (at your option) any later version. + + You should have received a copy of the GNU Free Documentation +License along with GNU `sed'; see the file `COPYING.DOC'. If not, +write to the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02110-1301, USA. + + There are no Cover Texts and no Invariant Sections; this text, along +with its equivalent in the printed manual, constitutes the Title Page. + + +File: sed.info, Node: Top, Next: Introduction, Up: (dir) + +sed, a stream editor +******************** + +This file documents version 4.2.1 of GNU `sed', a stream editor. + + Copyright (C) 1998, 1999, 2001, 2002, 2003, 2004 Free Software +Foundation, Inc. + + This document is released under the terms of the GNU Free +Documentation License as published by the Free Software Foundation; +either version 1.1, or (at your option) any later version. + + You should have received a copy of the GNU Free Documentation +License along with GNU `sed'; see the file `COPYING.DOC'. If not, +write to the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02110-1301, USA. + + There are no Cover Texts and no Invariant Sections; this text, along +with its equivalent in the printed manual, constitutes the Title Page. + +* Menu: + +* Introduction:: Introduction +* Invoking sed:: Invocation +* sed Programs:: `sed' programs +* Examples:: Some sample scripts +* Limitations:: Limitations and (non-)limitations of GNU `sed' +* Other Resources:: Other resources for learning about `sed' +* Reporting Bugs:: Reporting bugs + +* Extended regexps:: `egrep'-style regular expressions + +* Concept Index:: A menu with all the topics in this manual. +* Command and Option Index:: A menu with all `sed' commands and + command-line options. + +--- The detailed node listing --- + +sed Programs: +* Execution Cycle:: How `sed' works +* Addresses:: Selecting lines with `sed' +* Regular Expressions:: Overview of regular expression syntax +* Common Commands:: Often used commands +* The "s" Command:: `sed''s Swiss Army Knife +* Other Commands:: Less frequently used commands +* Programming Commands:: Commands for `sed' gurus +* Extended Commands:: Commands specific of GNU `sed' +* Escapes:: Specifying special characters + +Examples: +* Centering lines:: +* Increment a number:: +* Rename files to lower case:: +* Print bash environment:: +* Reverse chars of lines:: +* tac:: Reverse lines of files +* cat -n:: Numbering lines +* cat -b:: Numbering non-blank lines +* wc -c:: Counting chars +* wc -w:: Counting words +* wc -l:: Counting lines +* head:: Printing the first lines +* tail:: Printing the last lines +* uniq:: Make duplicate lines unique +* uniq -d:: Print duplicated lines of input +* uniq -u:: Remove all duplicated lines +* cat -s:: Squeezing blank lines + + +File: sed.info, Node: Introduction, Next: Invoking sed, Prev: Top, Up: Top + +1 Introduction +************** + +`sed' is a stream editor. A stream editor is used to perform basic text +transformations on an input stream (a file or input from a pipeline). +While in some ways similar to an editor which permits scripted edits +(such as `ed'), `sed' works by making only one pass over the input(s), +and is consequently more efficient. But it is `sed''s ability to +filter text in a pipeline which particularly distinguishes it from +other types of editors. + + +File: sed.info, Node: Invoking sed, Next: sed Programs, Prev: Introduction, Up: Top + +2 Invocation +************ + +Normally `sed' is invoked like this: + + sed SCRIPT INPUTFILE... + + The full format for invoking `sed' is: + + sed OPTIONS... [SCRIPT] [INPUTFILE...] + + If you do not specify INPUTFILE, or if INPUTFILE is `-', `sed' +filters the contents of the standard input. The SCRIPT is actually the +first non-option parameter, which `sed' specially considers a script +and not an input file if (and only if) none of the other OPTIONS +specifies a script to be executed, that is if neither of the `-e' and +`-f' options is specified. + + `sed' may be invoked with the following command-line options: + +`--version' + Print out the version of `sed' that is being run and a copyright + notice, then exit. + +`--help' + Print a usage message briefly summarizing these command-line + options and the bug-reporting address, then exit. + +`-n' +`--quiet' +`--silent' + By default, `sed' prints out the pattern space at the end of each + cycle through the script (*note How `sed' works: Execution Cycle.). + These options disable this automatic printing, and `sed' only + produces output when explicitly told to via the `p' command. + +`-e SCRIPT' +`--expression=SCRIPT' + Add the commands in SCRIPT to the set of commands to be run while + processing the input. + +`-f SCRIPT-FILE' +`--file=SCRIPT-FILE' + Add the commands contained in the file SCRIPT-FILE to the set of + commands to be run while processing the input. + +`-i[SUFFIX]' +`--in-place[=SUFFIX]' + This option specifies that files are to be edited in-place. GNU + `sed' does this by creating a temporary file and sending output to + this file rather than to the standard output.(1). + + This option implies `-s'. + + When the end of the file is reached, the temporary file is renamed + to the output file's original name. The extension, if supplied, + is used to modify the name of the old file before renaming the + temporary file, thereby making a backup copy(2)). + + This rule is followed: if the extension doesn't contain a `*', + then it is appended to the end of the current filename as a + suffix; if the extension does contain one or more `*' characters, + then _each_ asterisk is replaced with the current filename. This + allows you to add a prefix to the backup file, instead of (or in + addition to) a suffix, or even to place backup copies of the + original files into another directory (provided the directory + already exists). + + If no extension is supplied, the original file is overwritten + without making a backup. + +`-l N' +`--line-length=N' + Specify the default line-wrap length for the `l' command. A + length of 0 (zero) means to never wrap long lines. If not + specified, it is taken to be 70. + +`--posix' + GNU `sed' includes several extensions to POSIX sed. In order to + simplify writing portable scripts, this option disables all the + extensions that this manual documents, including additional + commands. Most of the extensions accept `sed' programs that are + outside the syntax mandated by POSIX, but some of them (such as + the behavior of the `N' command described in *note Reporting + Bugs::) actually violate the standard. If you want to disable + only the latter kind of extension, you can set the + `POSIXLY_CORRECT' variable to a non-empty value. + +`-b' +`--binary' + This option is available on every platform, but is only effective + where the operating system makes a distinction between text files + and binary files. When such a distinction is made--as is the case + for MS-DOS, Windows, Cygwin--text files are composed of lines + separated by a carriage return _and_ a line feed character, and + `sed' does not see the ending CR. When this option is specified, + `sed' will open input files in binary mode, thus not requesting + this special processing and considering lines to end at a line + feed. + +`--follow-symlinks' + This option is available only on platforms that support symbolic + links and has an effect only if option `-i' is specified. In this + case, if the file that is specified on the command line is a + symbolic link, `sed' will follow the link and edit the ultimate + destination of the link. The default behavior is to break the + symbolic link, so that the link destination will not be modified. + +`-r' +`--regexp-extended' + Use extended regular expressions rather than basic regular + expressions. Extended regexps are those that `egrep' accepts; + they can be clearer because they usually have less backslashes, + but are a GNU extension and hence scripts that use them are not + portable. *Note Extended regular expressions: Extended regexps. + +`-s' +`--separate' + By default, `sed' will consider the files specified on the command + line as a single continuous long stream. This GNU `sed' extension + allows the user to consider them as separate files: range + addresses (such as `/abc/,/def/') are not allowed to span several + files, line numbers are relative to the start of each file, `$' + refers to the last line of each file, and files invoked from the + `R' commands are rewound at the start of each file. + +`-u' +`--unbuffered' + Buffer both input and output as minimally as practical. (This is + particularly useful if the input is coming from the likes of `tail + -f', and you wish to see the transformed output as soon as + possible.) + + + If no `-e', `-f', `--expression', or `--file' options are given on +the command-line, then the first non-option argument on the command +line is taken to be the SCRIPT to be executed. + + If any command-line parameters remain after processing the above, +these parameters are interpreted as the names of input files to be +processed. A file name of `-' refers to the standard input stream. +The standard input will be processed if no file names are specified. + + ---------- Footnotes ---------- + + (1) This applies to commands such as `=', `a', `c', `i', `l', `p'. +You can still write to the standard output by using the `w' or `W' +commands together with the `/dev/stdout' special file + + (2) Note that GNU `sed' creates the backup file whether or not any +output is actually changed. + + +File: sed.info, Node: sed Programs, Next: Examples, Prev: Invoking sed, Up: Top + +3 `sed' Programs +**************** + +A `sed' program consists of one or more `sed' commands, passed in by +one or more of the `-e', `-f', `--expression', and `--file' options, or +the first non-option argument if zero of these options are used. This +document will refer to "the" `sed' script; this is understood to mean +the in-order catenation of all of the SCRIPTs and SCRIPT-FILEs passed +in. + + Each `sed' command consists of an optional address or address range, +followed by a one-character command name and any additional +command-specific code. + +* Menu: + +* Execution Cycle:: How `sed' works +* Addresses:: Selecting lines with `sed' +* Regular Expressions:: Overview of regular expression syntax +* Common Commands:: Often used commands +* The "s" Command:: `sed''s Swiss Army Knife +* Other Commands:: Less frequently used commands +* Programming Commands:: Commands for `sed' gurus +* Extended Commands:: Commands specific of GNU `sed' +* Escapes:: Specifying special characters + + +File: sed.info, Node: Execution Cycle, Next: Addresses, Up: sed Programs + +3.1 How `sed' Works +=================== + +`sed' maintains two data buffers: the active _pattern_ space, and the +auxiliary _hold_ space. Both are initially empty. + + `sed' operates by performing the following cycle on each lines of +input: first, `sed' reads one line from the input stream, removes any +trailing newline, and places it in the pattern space. Then commands +are executed; each command can have an address associated to it: +addresses are a kind of condition code, and a command is only executed +if the condition is verified before the command is to be executed. + + When the end of the script is reached, unless the `-n' option is in +use, the contents of pattern space are printed out to the output +stream, adding back the trailing newline if it was removed.(1) Then the +next cycle starts for the next input line. + + Unless special commands (like `D') are used, the pattern space is +deleted between two cycles. The hold space, on the other hand, keeps +its data between cycles (see commands `h', `H', `x', `g', `G' to move +data between both buffers). + + ---------- Footnotes ---------- + + (1) Actually, if `sed' prints a line without the terminating +newline, it will nevertheless print the missing newline as soon as more +text is sent to the same output stream, which gives the "least expected +surprise" even though it does not make commands like `sed -n p' exactly +identical to `cat'. + + +File: sed.info, Node: Addresses, Next: Regular Expressions, Prev: Execution Cycle, Up: sed Programs + +3.2 Selecting lines with `sed' +============================== + +Addresses in a `sed' script can be in any of the following forms: +`NUMBER' + Specifying a line number will match only that line in the input. + (Note that `sed' counts lines continuously across all input files + unless `-i' or `-s' options are specified.) + +`FIRST~STEP' + This GNU extension matches every STEPth line starting with line + FIRST. In particular, lines will be selected when there exists a + non-negative N such that the current line-number equals FIRST + (N + * STEP). Thus, to select the odd-numbered lines, one would use + `1~2'; to pick every third line starting with the second, `2~3' + would be used; to pick every fifth line starting with the tenth, + use `10~5'; and `50~0' is just an obscure way of saying `50'. + +`$' + This address matches the last line of the last file of input, or + the last line of each file when the `-i' or `-s' options are + specified. + +`/REGEXP/' + This will select any line which matches the regular expression + REGEXP. If REGEXP itself includes any `/' characters, each must + be escaped by a backslash (`\'). + + The empty regular expression `//' repeats the last regular + expression match (the same holds if the empty regular expression is + passed to the `s' command). Note that modifiers to regular + expressions are evaluated when the regular expression is compiled, + thus it is invalid to specify them together with the empty regular + expression. + +`\%REGEXP%' + (The `%' may be replaced by any other single character.) + + This also matches the regular expression REGEXP, but allows one to + use a different delimiter than `/'. This is particularly useful + if the REGEXP itself contains a lot of slashes, since it avoids + the tedious escaping of every `/'. If REGEXP itself includes any + delimiter characters, each must be escaped by a backslash (`\'). + +`/REGEXP/I' +`\%REGEXP%I' + The `I' modifier to regular-expression matching is a GNU extension + which causes the REGEXP to be matched in a case-insensitive manner. + +`/REGEXP/M' +`\%REGEXP%M' + The `M' modifier to regular-expression matching is a GNU `sed' + extension which causes `^' and `$' to match respectively (in + addition to the normal behavior) the empty string after a newline, + and the empty string before a newline. There are special character + sequences (`\`' and `\'') which always match the beginning or the + end of the buffer. `M' stands for `multi-line'. + + + If no addresses are given, then all lines are matched; if one +address is given, then only lines matching that address are matched. + + An address range can be specified by specifying two addresses +separated by a comma (`,'). An address range matches lines starting +from where the first address matches, and continues until the second +address matches (inclusively). + + If the second address is a REGEXP, then checking for the ending +match will start with the line _following_ the line which matched the +first address: a range will always span at least two lines (except of +course if the input stream ends). + + If the second address is a NUMBER less than (or equal to) the line +matching the first address, then only the one line is matched. + + GNU `sed' also supports some special two-address forms; all these +are GNU extensions: +`0,/REGEXP/' + A line number of `0' can be used in an address specification like + `0,/REGEXP/' so that `sed' will try to match REGEXP in the first + input line too. In other words, `0,/REGEXP/' is similar to + `1,/REGEXP/', except that if ADDR2 matches the very first line of + input the `0,/REGEXP/' form will consider it to end the range, + whereas the `1,/REGEXP/' form will match the beginning of its + range and hence make the range span up to the _second_ occurrence + of the regular expression. + + Note that this is the only place where the `0' address makes + sense; there is no 0-th line and commands which are given the `0' + address in any other way will give an error. + +`ADDR1,+N' + Matches ADDR1 and the N lines following ADDR1. + +`ADDR1,~N' + Matches ADDR1 and the lines following ADDR1 until the next line + whose input line number is a multiple of N. + + Appending the `!' character to the end of an address specification +negates the sense of the match. That is, if the `!' character follows +an address range, then only lines which do _not_ match the address range +will be selected. This also works for singleton addresses, and, +perhaps perversely, for the null address. + + +File: sed.info, Node: Regular Expressions, Next: Common Commands, Prev: Addresses, Up: sed Programs + +3.3 Overview of Regular Expression Syntax +========================================= + +To know how to use `sed', people should understand regular expressions +("regexp" for short). A regular expression is a pattern that is +matched against a subject string from left to right. Most characters +are "ordinary": they stand for themselves in a pattern, and match the +corresponding characters in the subject. As a trivial example, the +pattern + + The quick brown fox + +matches a portion of a subject string that is identical to itself. The +power of regular expressions comes from the ability to include +alternatives and repetitions in the pattern. These are encoded in the +pattern by the use of "special characters", which do not stand for +themselves but instead are interpreted in some special way. Here is a +brief description of regular expression syntax as used in `sed'. + +`CHAR' + A single ordinary character matches itself. + +`*' + Matches a sequence of zero or more instances of matches for the + preceding regular expression, which must be an ordinary character, + a special character preceded by `\', a `.', a grouped regexp (see + below), or a bracket expression. As a GNU extension, a postfixed + regular expression can also be followed by `*'; for example, `a**' + is equivalent to `a*'. POSIX 1003.1-2001 says that `*' stands for + itself when it appears at the start of a regular expression or + subexpression, but many nonGNU implementations do not support this + and portable scripts should instead use `\*' in these contexts. + +`\+' + As `*', but matches one or more. It is a GNU extension. + +`\?' + As `*', but only matches zero or one. It is a GNU extension. + +`\{I\}' + As `*', but matches exactly I sequences (I is a decimal integer; + for portability, keep it between 0 and 255 inclusive). + +`\{I,J\}' + Matches between I and J, inclusive, sequences. + +`\{I,\}' + Matches more than or equal to I sequences. + +`\(REGEXP\)' + Groups the inner REGEXP as a whole, this is used to: + + * Apply postfix operators, like `\(abcd\)*': this will search + for zero or more whole sequences of `abcd', while `abcd*' + would search for `abc' followed by zero or more occurrences + of `d'. Note that support for `\(abcd\)*' is required by + POSIX 1003.1-2001, but many non-GNU implementations do not + support it and hence it is not universally portable. + + * Use back references (see below). + +`.' + Matches any character, including newline. + +`^' + Matches the null string at beginning of the pattern space, i.e. + what appears after the circumflex must appear at the beginning of + the pattern space. + + In most scripts, pattern space is initialized to the content of + each line (*note How `sed' works: Execution Cycle.). So, it is a + useful simplification to think of `^#include' as matching only + lines where `#include' is the first thing on line--if there are + spaces before, for example, the match fails. This simplification + is valid as long as the original content of pattern space is not + modified, for example with an `s' command. + + `^' acts as a special character only at the beginning of the + regular expression or subexpression (that is, after `\(' or `\|'). + Portable scripts should avoid `^' at the beginning of a + subexpression, though, as POSIX allows implementations that treat + `^' as an ordinary character in that context. + +`$' + It is the same as `^', but refers to end of pattern space. `$' + also acts as a special character only at the end of the regular + expression or subexpression (that is, before `\)' or `\|'), and + its use at the end of a subexpression is not portable. + +`[LIST]' +`[^LIST]' + Matches any single character in LIST: for example, `[aeiou]' + matches all vowels. A list may include sequences like + `CHAR1-CHAR2', which matches any character between (inclusive) + CHAR1 and CHAR2. + + A leading `^' reverses the meaning of LIST, so that it matches any + single character _not_ in LIST. To include `]' in the list, make + it the first character (after the `^' if needed), to include `-' + in the list, make it the first or last; to include `^' put it + after the first character. + + The characters `$', `*', `.', `[', and `\' are normally not + special within LIST. For example, `[\*]' matches either `\' or + `*', because the `\' is not special here. However, strings like + `[.ch.]', `[=a=]', and `[:space:]' are special within LIST and + represent collating symbols, equivalence classes, and character + classes, respectively, and `[' is therefore special within LIST + when it is followed by `.', `=', or `:'. Also, when not in + `POSIXLY_CORRECT' mode, special escapes like `\n' and `\t' are + recognized within LIST. *Note Escapes::. + +`REGEXP1\|REGEXP2' + Matches either REGEXP1 or REGEXP2. Use parentheses to use complex + alternative regular expressions. The matching process tries each + alternative in turn, from left to right, and the first one that + succeeds is used. It is a GNU extension. + +`REGEXP1REGEXP2' + Matches the concatenation of REGEXP1 and REGEXP2. Concatenation + binds more tightly than `\|', `^', and `$', but less tightly than + the other regular expression operators. + +`\DIGIT' + Matches the DIGIT-th `\(...\)' parenthesized subexpression in the + regular expression. This is called a "back reference". + Subexpressions are implicity numbered by counting occurrences of + `\(' left-to-right. + +`\n' + Matches the newline character. + +`\CHAR' + Matches CHAR, where CHAR is one of `$', `*', `.', `[', `\', or `^'. + Note that the only C-like backslash sequences that you can + portably assume to be interpreted are `\n' and `\\'; in particular + `\t' is not portable, and matches a `t' under most implementations + of `sed', rather than a tab character. + + + Note that the regular expression matcher is greedy, i.e., matches +are attempted from left to right and, if two or more matches are +possible starting at the same character, it selects the longest. + +Examples: +`abcdef' + Matches `abcdef'. + +`a*b' + Matches zero or more `a's followed by a single `b'. For example, + `b' or `aaaaab'. + +`a\?b' + Matches `b' or `ab'. + +`a\+b\+' + Matches one or more `a's followed by one or more `b's: `ab' is the + shortest possible match, but other examples are `aaaab' or + `abbbbb' or `aaaaaabbbbbbb'. + +`.*' +`.\+' + These two both match all the characters in a string; however, the + first matches every string (including the empty string), while the + second matches only strings containing at least one character. + +`^main.*(.*)' + his matches a string starting with `main', followed by an opening + and closing parenthesis. The `n', `(' and `)' need not be + adjacent. + +`^#' + This matches a string beginning with `#'. + +`\\$' + This matches a string ending with a single backslash. The regexp + contains two backslashes for escaping. + +`\$' + Instead, this matches a string consisting of a single dollar sign, + because it is escaped. + +`[a-zA-Z0-9]' + In the C locale, this matches any ASCII letters or digits. + +`[^ tab]\+' + (Here `tab' stands for a single tab character.) This matches a + string of one or more characters, none of which is a space or a + tab. Usually this means a word. + +`^\(.*\)\n\1$' + This matches a string consisting of two equal substrings separated + by a newline. + +`.\{9\}A$' + This matches nine characters followed by an `A'. + +`^.\{15\}A' + This matches the start of a string that contains 16 characters, + the last of which is an `A'. + + + +File: sed.info, Node: Common Commands, Next: The "s" Command, Prev: Regular Expressions, Up: sed Programs + +3.4 Often-Used Commands +======================= + +If you use `sed' at all, you will quite likely want to know these +commands. + +`#' + [No addresses allowed.] + + The `#' character begins a comment; the comment continues until + the next newline. + + If you are concerned about portability, be aware that some + implementations of `sed' (which are not POSIX conformant) may only + support a single one-line comment, and then only when the very + first character of the script is a `#'. + + Warning: if the first two characters of the `sed' script are `#n', + then the `-n' (no-autoprint) option is forced. If you want to put + a comment in the first line of your script and that comment begins + with the letter `n' and you do not want this behavior, then be + sure to either use a capital `N', or place at least one space + before the `n'. + +`q [EXIT-CODE]' + This command only accepts a single address. + + Exit `sed' without processing any more commands or input. Note + that the current pattern space is printed if auto-print is not + disabled with the `-n' options. The ability to return an exit + code from the `sed' script is a GNU `sed' extension. + +`d' + Delete the pattern space; immediately start next cycle. + +`p' + Print out the pattern space (to the standard output). This + command is usually only used in conjunction with the `-n' + command-line option. + +`n' + If auto-print is not disabled, print the pattern space, then, + regardless, replace the pattern space with the next line of input. + If there is no more input then `sed' exits without processing any + more commands. + +`{ COMMANDS }' + A group of commands may be enclosed between `{' and `}' characters. + This is particularly useful when you want a group of commands to + be triggered by a single address (or address-range) match. + + + +File: sed.info, Node: The "s" Command, Next: Other Commands, Prev: Common Commands, Up: sed Programs + +3.5 The `s' Command +=================== + +The syntax of the `s' (as in substitute) command is +`s/REGEXP/REPLACEMENT/FLAGS'. The `/' characters may be uniformly +replaced by any other single character within any given `s' command. +The `/' character (or whatever other character is used in its stead) +can appear in the REGEXP or REPLACEMENT only if it is preceded by a `\' +character. + + The `s' command is probably the most important in `sed' and has a +lot of different options. Its basic concept is simple: the `s' command +attempts to match the pattern space against the supplied REGEXP; if the +match is successful, then that portion of the pattern space which was +matched is replaced with REPLACEMENT. + + The REPLACEMENT can contain `\N' (N being a number from 1 to 9, +inclusive) references, which refer to the portion of the match which is +contained between the Nth `\(' and its matching `\)'. Also, the +REPLACEMENT can contain unescaped `&' characters which reference the +whole matched portion of the pattern space. Finally, as a GNU `sed' +extension, you can include a special sequence made of a backslash and +one of the letters `L', `l', `U', `u', or `E'. The meaning is as +follows: + +`\L' + Turn the replacement to lowercase until a `\U' or `\E' is found, + +`\l' + Turn the next character to lowercase, + +`\U' + Turn the replacement to uppercase until a `\L' or `\E' is found, + +`\u' + Turn the next character to uppercase, + +`\E' + Stop case conversion started by `\L' or `\U'. + + To include a literal `\', `&', or newline in the final replacement, +be sure to precede the desired `\', `&', or newline in the REPLACEMENT +with a `\'. + + The `s' command can be followed by zero or more of the following +FLAGS: + +`g' + Apply the replacement to _all_ matches to the REGEXP, not just the + first. + +`NUMBER' + Only replace the NUMBERth match of the REGEXP. + + Note: the POSIX standard does not specify what should happen when + you mix the `g' and NUMBER modifiers, and currently there is no + widely agreed upon meaning across `sed' implementations. For GNU + `sed', the interaction is defined to be: ignore matches before the + NUMBERth, and then match and replace all matches from the NUMBERth + on. + +`p' + If the substitution was made, then print the new pattern space. + + Note: when both the `p' and `e' options are specified, the + relative ordering of the two produces very different results. In + general, `ep' (evaluate then print) is what you want, but + operating the other way round can be useful for debugging. For + this reason, the current version of GNU `sed' interprets specially + the presence of `p' options both before and after `e', printing + the pattern space before and after evaluation, while in general + flags for the `s' command show their effect just once. This + behavior, although documented, might change in future versions. + +`w FILE-NAME' + If the substitution was made, then write out the result to the + named file. As a GNU `sed' extension, two special values of + FILE-NAME are supported: `/dev/stderr', which writes the result to + the standard error, and `/dev/stdout', which writes to the standard + output.(1) + +`e' + This command allows one to pipe input from a shell command into + pattern space. If a substitution was made, the command that is + found in pattern space is executed and pattern space is replaced + with its output. A trailing newline is suppressed; results are + undefined if the command to be executed contains a NUL character. + This is a GNU `sed' extension. + +`I' +`i' + The `I' modifier to regular-expression matching is a GNU extension + which makes `sed' match REGEXP in a case-insensitive manner. + +`M' +`m' + The `M' modifier to regular-expression matching is a GNU `sed' + extension which causes `^' and `$' to match respectively (in + addition to the normal behavior) the empty string after a newline, + and the empty string before a newline. There are special character + sequences (`\`' and `\'') which always match the beginning or the + end of the buffer. `M' stands for `multi-line'. + + + ---------- Footnotes ---------- + + (1) This is equivalent to `p' unless the `-i' option is being used. + + +File: sed.info, Node: Other Commands, Next: Programming Commands, Prev: The "s" Command, Up: sed Programs + +3.6 Less Frequently-Used Commands +================================= + +Though perhaps less frequently used than those in the previous section, +some very small yet useful `sed' scripts can be built with these +commands. + +`y/SOURCE-CHARS/DEST-CHARS/' + (The `/' characters may be uniformly replaced by any other single + character within any given `y' command.) + + Transliterate any characters in the pattern space which match any + of the SOURCE-CHARS with the corresponding character in DEST-CHARS. + + Instances of the `/' (or whatever other character is used in its + stead), `\', or newlines can appear in the SOURCE-CHARS or + DEST-CHARS lists, provide that each instance is escaped by a `\'. + The SOURCE-CHARS and DEST-CHARS lists _must_ contain the same + number of characters (after de-escaping). + +`a\' +`TEXT' + As a GNU extension, this command accepts two addresses. + + Queue the lines of text which follow this command (each but the + last ending with a `\', which are removed from the output) to be + output at the end of the current cycle, or when the next input + line is read. + + Escape sequences in TEXT are processed, so you should use `\\' in + TEXT to print a single backslash. + + As a GNU extension, if between the `a' and the newline there is + other than a whitespace-`\' sequence, then the text of this line, + starting at the first non-whitespace character after the `a', is + taken as the first line of the TEXT block. (This enables a + simplification in scripting a one-line add.) This extension also + works with the `i' and `c' commands. + +`i\' +`TEXT' + As a GNU extension, this command accepts two addresses. + + Immediately output the lines of text which follow this command + (each but the last ending with a `\', which are removed from the + output). + +`c\' +`TEXT' + Delete the lines matching the address or address-range, and output + the lines of text which follow this command (each but the last + ending with a `\', which are removed from the output) in place of + the last line (or in place of each line, if no addresses were + specified). A new cycle is started after this command is done, + since the pattern space will have been deleted. + +`=' + As a GNU extension, this command accepts two addresses. + + Print out the current input line number (with a trailing newline). + +`l N' + Print the pattern space in an unambiguous form: non-printable + characters (and the `\' character) are printed in C-style escaped + form; long lines are split, with a trailing `\' character to + indicate the split; the end of each line is marked with a `$'. + + N specifies the desired line-wrap length; a length of 0 (zero) + means to never wrap long lines. If omitted, the default as + specified on the command line is used. The N parameter is a GNU + `sed' extension. + +`r FILENAME' + As a GNU extension, this command accepts two addresses. + + Queue the contents of FILENAME to be read and inserted into the + output stream at the end of the current cycle, or when the next + input line is read. Note that if FILENAME cannot be read, it is + treated as if it were an empty file, without any error indication. + + As a GNU `sed' extension, the special value `/dev/stdin' is + supported for the file name, which reads the contents of the + standard input. + +`w FILENAME' + Write the pattern space to FILENAME. As a GNU `sed' extension, + two special values of FILE-NAME are supported: `/dev/stderr', + which writes the result to the standard error, and `/dev/stdout', + which writes to the standard output.(1) + + The file will be created (or truncated) before the first input + line is read; all `w' commands (including instances of `w' flag on + successful `s' commands) which refer to the same FILENAME are + output without closing and reopening the file. + +`D' + Delete text in the pattern space up to the first newline. If any + text is left, restart cycle with the resultant pattern space + (without reading a new line of input), otherwise start a normal + new cycle. + +`N' + Add a newline to the pattern space, then append the next line of + input to the pattern space. If there is no more input then `sed' + exits without processing any more commands. + +`P' + Print out the portion of the pattern space up to the first newline. + +`h' + Replace the contents of the hold space with the contents of the + pattern space. + +`H' + Append a newline to the contents of the hold space, and then + append the contents of the pattern space to that of the hold space. + +`g' + Replace the contents of the pattern space with the contents of the + hold space. + +`G' + Append a newline to the contents of the pattern space, and then + append the contents of the hold space to that of the pattern space. + +`x' + Exchange the contents of the hold and pattern spaces. + + + ---------- Footnotes ---------- + + (1) This is equivalent to `p' unless the `-i' option is being used. + + +File: sed.info, Node: Programming Commands, Next: Extended Commands, Prev: Other Commands, Up: sed Programs + +3.7 Commands for `sed' gurus +============================ + +In most cases, use of these commands indicates that you are probably +better off programming in something like `awk' or Perl. But +occasionally one is committed to sticking with `sed', and these +commands can enable one to write quite convoluted scripts. + +`: LABEL' + [No addresses allowed.] + + Specify the location of LABEL for branch commands. In all other + respects, a no-op. + +`b LABEL' + Unconditionally branch to LABEL. The LABEL may be omitted, in + which case the next cycle is started. + +`t LABEL' + Branch to LABEL only if there has been a successful `s'ubstitution + since the last input line was read or conditional branch was taken. + The LABEL may be omitted, in which case the next cycle is started. + + + +File: sed.info, Node: Extended Commands, Next: Escapes, Prev: Programming Commands, Up: sed Programs + +3.8 Commands Specific to GNU `sed' +================================== + +These commands are specific to GNU `sed', so you must use them with +care and only when you are sure that hindering portability is not evil. +They allow you to check for GNU `sed' extensions or to do tasks that +are required quite often, yet are unsupported by standard `sed's. + +`e [COMMAND]' + This command allows one to pipe input from a shell command into + pattern space. Without parameters, the `e' command executes the + command that is found in pattern space and replaces the pattern + space with the output; a trailing newline is suppressed. + + If a parameter is specified, instead, the `e' command interprets + it as a command and sends its output to the output stream (like + `r' does). The command can run across multiple lines, all but the + last ending with a back-slash. + + In both cases, the results are undefined if the command to be + executed contains a NUL character. + +`L N' + This GNU `sed' extension fills and joins lines in pattern space to + produce output lines of (at most) N characters, like `fmt' does; + if N is omitted, the default as specified on the command line is + used. This command is considered a failed experiment and unless + there is enough request (which seems unlikely) will be removed in + future versions. + +`Q [EXIT-CODE]' + This command only accepts a single address. + + This command is the same as `q', but will not print the contents + of pattern space. Like `q', it provides the ability to return an + exit code to the caller. + + This command can be useful because the only alternative ways to + accomplish this apparently trivial function are to use the `-n' + option (which can unnecessarily complicate your script) or + resorting to the following snippet, which wastes time by reading + the whole file without any visible effect: + + :eat + $d Quit silently on the last line + N Read another line, silently + g Overwrite pattern space each time to save memory + b eat + +`R FILENAME' + Queue a line of FILENAME to be read and inserted into the output + stream at the end of the current cycle, or when the next input + line is read. Note that if FILENAME cannot be read, or if its end + is reached, no line is appended, without any error indication. + + As with the `r' command, the special value `/dev/stdin' is + supported for the file name, which reads a line from the standard + input. + +`T LABEL' + Branch to LABEL only if there have been no successful + `s'ubstitutions since the last input line was read or conditional + branch was taken. The LABEL may be omitted, in which case the next + cycle is started. + +`v VERSION' + This command does nothing, but makes `sed' fail if GNU `sed' + extensions are not supported, simply because other versions of + `sed' do not implement it. In addition, you can specify the + version of `sed' that your script requires, such as `4.0.5'. The + default is `4.0' because that is the first version that + implemented this command. + + This command enables all GNU extensions even if `POSIXLY_CORRECT' + is set in the environment. + +`W FILENAME' + Write to the given filename the portion of the pattern space up to + the first newline. Everything said under the `w' command about + file handling holds here too. + +`z' + This command empties the content of pattern space. It is usually + the same as `s/.*//', but is more efficient and works in the + presence of invalid multibyte sequences in the input stream. + POSIX mandates that such sequences are _not_ matched by `.', so + that there is no portable way to clear `sed''s buffers in the + middle of the script in most multibyte locales (including UTF-8 + locales). + + +File: sed.info, Node: Escapes, Prev: Extended Commands, Up: sed Programs + +3.9 GNU Extensions for Escapes in Regular Expressions +===================================================== + +Until this chapter, we have only encountered escapes of the form `\^', +which tell `sed' not to interpret the circumflex as a special +character, but rather to take it literally. For example, `\*' matches +a single asterisk rather than zero or more backslashes. + + This chapter introduces another kind of escape(1)--that is, escapes +that are applied to a character or sequence of characters that +ordinarily are taken literally, and that `sed' replaces with a special +character. This provides a way of encoding non-printable characters in +patterns in a visible manner. There is no restriction on the +appearance of non-printing characters in a `sed' script but when a +script is being prepared in the shell or by text editing, it is usually +easier to use one of the following escape sequences than the binary +character it represents: + + The list of these escapes is: + +`\a' + Produces or matches a BEL character, that is an "alert" (ASCII 7). + +`\f' + Produces or matches a form feed (ASCII 12). + +`\n' + Produces or matches a newline (ASCII 10). + +`\r' + Produces or matches a carriage return (ASCII 13). + +`\t' + Produces or matches a horizontal tab (ASCII 9). + +`\v' + Produces or matches a so called "vertical tab" (ASCII 11). + +`\cX' + Produces or matches `CONTROL-X', where X is any character. The + precise effect of `\cX' is as follows: if X is a lower case + letter, it is converted to upper case. Then bit 6 of the + character (hex 40) is inverted. Thus `\cz' becomes hex 1A, but + `\c{' becomes hex 3B, while `\c;' becomes hex 7B. + +`\dXXX' + Produces or matches a character whose decimal ASCII value is XXX. + +`\oXXX' + Produces or matches a character whose octal ASCII value is XXX. + +`\xXX' + Produces or matches a character whose hexadecimal ASCII value is + XX. + + `\b' (backspace) was omitted because of the conflict with the +existing "word boundary" meaning. + + Other escapes match a particular character class and are valid only +in regular expressions: + +`\w' + Matches any "word" character. A "word" character is any letter or + digit or the underscore character. + +`\W' + Matches any "non-word" character. + +`\b' + Matches a word boundary; that is it matches if the character to + the left is a "word" character and the character to the right is a + "non-word" character, or vice-versa. + +`\B' + Matches everywhere but on a word boundary; that is it matches if + the character to the left and the character to the right are + either both "word" characters or both "non-word" characters. + +`\`' + Matches only at the start of pattern space. This is different + from `^' in multi-line mode. + +`\'' + Matches only at the end of pattern space. This is different from + `$' in multi-line mode. + + + ---------- Footnotes ---------- + + (1) All the escapes introduced here are GNU extensions, with the +exception of `\n'. In basic regular expression mode, setting +`POSIXLY_CORRECT' disables them inside bracket expressions. + + +File: sed.info, Node: Examples, Next: Limitations, Prev: sed Programs, Up: Top + +4 Some Sample Scripts +********************* + +Here are some `sed' scripts to guide you in the art of mastering `sed'. + +* Menu: + +Some exotic examples: +* Centering lines:: +* Increment a number:: +* Rename files to lower case:: +* Print bash environment:: +* Reverse chars of lines:: + +Emulating standard utilities: +* tac:: Reverse lines of files +* cat -n:: Numbering lines +* cat -b:: Numbering non-blank lines +* wc -c:: Counting chars +* wc -w:: Counting words +* wc -l:: Counting lines +* head:: Printing the first lines +* tail:: Printing the last lines +* uniq:: Make duplicate lines unique +* uniq -d:: Print duplicated lines of input +* uniq -u:: Remove all duplicated lines +* cat -s:: Squeezing blank lines + + +File: sed.info, Node: Centering lines, Next: Increment a number, Up: Examples + +4.1 Centering Lines +=================== + +This script centers all lines of a file on a 80 columns width. To +change that width, the number in `\{...\}' must be replaced, and the +number of added spaces also must be changed. + + Note how the buffer commands are used to separate parts in the +regular expressions to be matched--this is a common technique. + + #!/usr/bin/sed -f + + # Put 80 spaces in the buffer + 1 { + x + s/^$/ / + s/^.*$/&&&&&&&&/ + x + } + + # del leading and trailing spaces + y/tab/ / + s/^ *// + s/ *$// + + # add a newline and 80 spaces to end of line + G + + # keep first 81 chars (80 + a newline) + s/^\(.\{81\}\).*$/\1/ + + # \2 matches half of the spaces, which are moved to the beginning + s/^\(.*\)\n\(.*\)\2/\2\1/ + + +File: sed.info, Node: Increment a number, Next: Rename files to lower case, Prev: Centering lines, Up: Examples + +4.2 Increment a Number +====================== + +This script is one of a few that demonstrate how to do arithmetic in +`sed'. This is indeed possible,(1) but must be done manually. + + To increment one number you just add 1 to last digit, replacing it +by the following digit. There is one exception: when the digit is a +nine the previous digits must be also incremented until you don't have +a nine. + + This solution by Bruno Haible is very clever and smart because it +uses a single buffer; if you don't have this limitation, the algorithm +used in *note Numbering lines: cat -n, is faster. It works by +replacing trailing nines with an underscore, then using multiple `s' +commands to increment the last digit, and then again substituting +underscores with zeros. + + #!/usr/bin/sed -f + + /[^0-9]/ d + + # replace all leading 9s by _ (any other character except digits, could + # be used) + :d + s/9\(_*\)$/_\1/ + td + + # incr last digit only. The first line adds a most-significant + # digit of 1 if we have to add a digit. + # + # The `tn' commands are not necessary, but make the thing + # faster + + s/^\(_*\)$/1\1/; tn + s/8\(_*\)$/9\1/; tn + s/7\(_*\)$/8\1/; tn + s/6\(_*\)$/7\1/; tn + s/5\(_*\)$/6\1/; tn + s/4\(_*\)$/5\1/; tn + s/3\(_*\)$/4\1/; tn + s/2\(_*\)$/3\1/; tn + s/1\(_*\)$/2\1/; tn + s/0\(_*\)$/1\1/; tn + + :n + y/_/0/ + + ---------- Footnotes ---------- + + (1) `sed' guru Greg Ubben wrote an implementation of the `dc' RPN +calculator! It is distributed together with sed. + + +File: sed.info, Node: Rename files to lower case, Next: Print bash environment, Prev: Increment a number, Up: Examples + +4.3 Rename Files to Lower Case +============================== + +This is a pretty strange use of `sed'. We transform text, and +transform it to be shell commands, then just feed them to shell. Don't +worry, even worse hacks are done when using `sed'; I have seen a script +converting the output of `date' into a `bc' program! + + The main body of this is the `sed' script, which remaps the name +from lower to upper (or vice-versa) and even checks out if the remapped +name is the same as the original name. Note how the script is +parameterized using shell variables and proper quoting. + + #! /bin/sh + # rename files to lower/upper case... + # + # usage: + # move-to-lower * + # move-to-upper * + # or + # move-to-lower -R . + # move-to-upper -R . + # + + help() + { + cat << eof + Usage: $0 [-n] [-r] [-h] files... + + -n do nothing, only see what would be done + -R recursive (use find) + -h this message + files files to remap to lower case + + Examples: + $0 -n * (see if everything is ok, then...) + $0 * + + $0 -R . + + eof + } + + apply_cmd='sh' + finder='echo "$@" | tr " " "\n"' + files_only= + + while : + do + case "$1" in + -n) apply_cmd='cat' ;; + -R) finder='find "$@" -type f';; + -h) help ; exit 1 ;; + *) break ;; + esac + shift + done + + if [ -z "$1" ]; then + echo Usage: $0 [-h] [-n] [-r] files... + exit 1 + fi + + LOWER='abcdefghijklmnopqrstuvwxyz' + UPPER='ABCDEFGHIJKLMNOPQRSTUVWXYZ' + + case `basename $0` in + *upper*) TO=$UPPER; FROM=$LOWER ;; + *) FROM=$UPPER; TO=$LOWER ;; + esac + + eval $finder | sed -n ' + + # remove all trailing slashes + s/\/*$// + + # add ./ if there is no path, only a filename + /\//! s/^/.\// + + # save path+filename + h + + # remove path + s/.*\/// + + # do conversion only on filename + y/'$FROM'/'$TO'/ + + # now line contains original path+file, while + # hold space contains the new filename + x + + # add converted file name to line, which now contains + # path/file-name\nconverted-file-name + G + + # check if converted file name is equal to original file name, + # if it is, do not print nothing + /^.*\/\(.*\)\n\1/b + + # now, transform path/fromfile\n, into + # mv path/fromfile path/tofile and print it + s/^\(.*\/\)\(.*\)\n\(.*\)$/mv "\1\2" "\1\3"/p + + ' | $apply_cmd + + +File: sed.info, Node: Print bash environment, Next: Reverse chars of lines, Prev: Rename files to lower case, Up: Examples + +4.4 Print `bash' Environment +============================ + +This script strips the definition of the shell functions from the +output of the `set' Bourne-shell command. + + #!/bin/sh + + set | sed -n ' + :x + + # if no occurrence of "=()" print and load next line + /=()/! { p; b; } + / () $/! { p; b; } + + # possible start of functions section + # save the line in case this is a var like FOO="() " + h + + # if the next line has a brace, we quit because + # nothing comes after functions + n + /^{/ q + + # print the old line + x; p + + # work on the new line now + x; bx + ' + + +File: sed.info, Node: Reverse chars of lines, Next: tac, Prev: Print bash environment, Up: Examples + +4.5 Reverse Characters of Lines +=============================== + +This script can be used to reverse the position of characters in lines. +The technique moves two characters at a time, hence it is faster than +more intuitive implementations. + + Note the `tx' command before the definition of the label. This is +often needed to reset the flag that is tested by the `t' command. + + Imaginative readers will find uses for this script. An example is +reversing the output of `banner'.(1) + + #!/usr/bin/sed -f + + /../! b + + # Reverse a line. Begin embedding the line between two newlines + s/^.*$/\ + &\ + / + + # Move first character at the end. The regexp matches until + # there are zero or one characters between the markers + tx + :x + s/\(\n.\)\(.*\)\(.\n\)/\3\2\1/ + tx + + # Remove the newline markers + s/\n//g + + ---------- Footnotes ---------- + + (1) This requires another script to pad the output of banner; for +example + + #! /bin/sh + + banner -w $1 $2 $3 $4 | + sed -e :a -e '/^.\{0,'$1'\}$/ { s/$/ /; ba; }' | + ~/sedscripts/reverseline.sed + + +File: sed.info, Node: tac, Next: cat -n, Prev: Reverse chars of lines, Up: Examples + +4.6 Reverse Lines of Files +========================== + +This one begins a series of totally useless (yet interesting) scripts +emulating various Unix commands. This, in particular, is a `tac' +workalike. + + Note that on implementations other than GNU `sed' this script might +easily overflow internal buffers. + + #!/usr/bin/sed -nf + + # reverse all lines of input, i.e. first line became last, ... + + # from the second line, the buffer (which contains all previous lines) + # is *appended* to current line, so, the order will be reversed + 1! G + + # on the last line we're done -- print everything + $ p + + # store everything on the buffer again + h + + +File: sed.info, Node: cat -n, Next: cat -b, Prev: tac, Up: Examples + +4.7 Numbering Lines +=================== + +This script replaces `cat -n'; in fact it formats its output exactly +like GNU `cat' does. + + Of course this is completely useless and for two reasons: first, +because somebody else did it in C, second, because the following +Bourne-shell script could be used for the same purpose and would be +much faster: + + #! /bin/sh + sed -e "=" $@ | sed -e ' + s/^/ / + N + s/^ *\(......\)\n/\1 / + ' + + It uses `sed' to print the line number, then groups lines two by two +using `N'. Of course, this script does not teach as much as the one +presented below. + + The algorithm used for incrementing uses both buffers, so the line +is printed as soon as possible and then discarded. The number is split +so that changing digits go in a buffer and unchanged ones go in the +other; the changed digits are modified in a single step (using a `y' +command). The line number for the next line is then composed and +stored in the hold space, to be used in the next iteration. + + #!/usr/bin/sed -nf + + # Prime the pump on the first line + x + /^$/ s/^.*$/1/ + + # Add the correct line number before the pattern + G + h + + # Format it and print it + s/^/ / + s/^ *\(......\)\n/\1 /p + + # Get the line number from hold space; add a zero + # if we're going to add a digit on the next line + g + s/\n.*$// + /^9*$/ s/^/0/ + + # separate changing/unchanged digits with an x + s/.9*$/x&/ + + # keep changing digits in hold space + h + s/^.*x// + y/0123456789/1234567890/ + x + + # keep unchanged digits in pattern space + s/x.*$// + + # compose the new number, remove the newline implicitly added by G + G + s/\n// + h + + +File: sed.info, Node: cat -b, Next: wc -c, Prev: cat -n, Up: Examples + +4.8 Numbering Non-blank Lines +============================= + +Emulating `cat -b' is almost the same as `cat -n'--we only have to +select which lines are to be numbered and which are not. + + The part that is common to this script and the previous one is not +commented to show how important it is to comment `sed' scripts +properly... + + #!/usr/bin/sed -nf + + /^$/ { + p + b + } + + # Same as cat -n from now + x + /^$/ s/^.*$/1/ + G + h + s/^/ / + s/^ *\(......\)\n/\1 /p + x + s/\n.*$// + /^9*$/ s/^/0/ + s/.9*$/x&/ + h + s/^.*x// + y/0123456789/1234567890/ + x + s/x.*$// + G + s/\n// + h + + +File: sed.info, Node: wc -c, Next: wc -w, Prev: cat -b, Up: Examples + +4.9 Counting Characters +======================= + +This script shows another way to do arithmetic with `sed'. In this +case we have to add possibly large numbers, so implementing this by +successive increments would not be feasible (and possibly even more +complicated to contrive than this script). + + The approach is to map numbers to letters, kind of an abacus +implemented with `sed'. `a's are units, `b's are tens and so on: we +simply add the number of characters on the current line as units, and +then propagate the carry to tens, hundreds, and so on. + + As usual, running totals are kept in hold space. + + On the last line, we convert the abacus form back to decimal. For +the sake of variety, this is done with a loop rather than with some 80 +`s' commands(1): first we convert units, removing `a's from the number; +then we rotate letters so that tens become `a's, and so on until no +more letters remain. + + #!/usr/bin/sed -nf + + # Add n+1 a's to hold space (+1 is for the newline) + s/./a/g + H + x + s/\n/a/ + + # Do the carry. The t's and b's are not necessary, + # but they do speed up the thing + t a + : a; s/aaaaaaaaaa/b/g; t b; b done + : b; s/bbbbbbbbbb/c/g; t c; b done + : c; s/cccccccccc/d/g; t d; b done + : d; s/dddddddddd/e/g; t e; b done + : e; s/eeeeeeeeee/f/g; t f; b done + : f; s/ffffffffff/g/g; t g; b done + : g; s/gggggggggg/h/g; t h; b done + : h; s/hhhhhhhhhh//g + + : done + $! { + h + b + } + + # On the last line, convert back to decimal + + : loop + /a/! s/[b-h]*/&0/ + s/aaaaaaaaa/9/ + s/aaaaaaaa/8/ + s/aaaaaaa/7/ + s/aaaaaa/6/ + s/aaaaa/5/ + s/aaaa/4/ + s/aaa/3/ + s/aa/2/ + s/a/1/ + + : next + y/bcdefgh/abcdefg/ + /[a-h]/ b loop + p + + ---------- Footnotes ---------- + + (1) Some implementations have a limit of 199 commands per script + + +File: sed.info, Node: wc -w, Next: wc -l, Prev: wc -c, Up: Examples + +4.10 Counting Words +=================== + +This script is almost the same as the previous one, once each of the +words on the line is converted to a single `a' (in the previous script +each letter was changed to an `a'). + + It is interesting that real `wc' programs have optimized loops for +`wc -c', so they are much slower at counting words rather than +characters. This script's bottleneck, instead, is arithmetic, and +hence the word-counting one is faster (it has to manage smaller +numbers). + + Again, the common parts are not commented to show the importance of +commenting `sed' scripts. + + #!/usr/bin/sed -nf + + # Convert words to a's + s/[ tab][ tab]*/ /g + s/^/ / + s/ [^ ][^ ]*/a /g + s/ //g + + # Append them to hold space + H + x + s/\n// + + # From here on it is the same as in wc -c. + /aaaaaaaaaa/! bx; s/aaaaaaaaaa/b/g + /bbbbbbbbbb/! bx; s/bbbbbbbbbb/c/g + /cccccccccc/! bx; s/cccccccccc/d/g + /dddddddddd/! bx; s/dddddddddd/e/g + /eeeeeeeeee/! bx; s/eeeeeeeeee/f/g + /ffffffffff/! bx; s/ffffffffff/g/g + /gggggggggg/! bx; s/gggggggggg/h/g + s/hhhhhhhhhh//g + :x + $! { h; b; } + :y + /a/! s/[b-h]*/&0/ + s/aaaaaaaaa/9/ + s/aaaaaaaa/8/ + s/aaaaaaa/7/ + s/aaaaaa/6/ + s/aaaaa/5/ + s/aaaa/4/ + s/aaa/3/ + s/aa/2/ + s/a/1/ + y/bcdefgh/abcdefg/ + /[a-h]/ by + p + + +File: sed.info, Node: wc -l, Next: head, Prev: wc -w, Up: Examples + +4.11 Counting Lines +=================== + +No strange things are done now, because `sed' gives us `wc -l' +functionality for free!!! Look: + + #!/usr/bin/sed -nf + $= + + +File: sed.info, Node: head, Next: tail, Prev: wc -l, Up: Examples + +4.12 Printing the First Lines +============================= + +This script is probably the simplest useful `sed' script. It displays +the first 10 lines of input; the number of displayed lines is right +before the `q' command. + + #!/usr/bin/sed -f + 10q + + +File: sed.info, Node: tail, Next: uniq, Prev: head, Up: Examples + +4.13 Printing the Last Lines +============================ + +Printing the last N lines rather than the first is more complex but +indeed possible. N is encoded in the second line, before the bang +character. + + This script is similar to the `tac' script in that it keeps the +final output in the hold space and prints it at the end: + + #!/usr/bin/sed -nf + + 1! {; H; g; } + 1,10 !s/[^\n]*\n// + $p + h + + Mainly, the scripts keeps a window of 10 lines and slides it by +adding a line and deleting the oldest (the substitution command on the +second line works like a `D' command but does not restart the loop). + + The "sliding window" technique is a very powerful way to write +efficient and complex `sed' scripts, because commands like `P' would +require a lot of work if implemented manually. + + To introduce the technique, which is fully demonstrated in the rest +of this chapter and is based on the `N', `P' and `D' commands, here is +an implementation of `tail' using a simple "sliding window." + + This looks complicated but in fact the working is the same as the +last script: after we have kicked in the appropriate number of lines, +however, we stop using the hold space to keep inter-line state, and +instead use `N' and `D' to slide pattern space by one line: + + #!/usr/bin/sed -f + + 1h + 2,10 {; H; g; } + $q + 1,9d + N + D + + Note how the first, second and fourth line are inactive after the +first ten lines of input. After that, all the script does is: exiting +on the last line of input, appending the next input line to pattern +space, and removing the first line. + + +File: sed.info, Node: uniq, Next: uniq -d, Prev: tail, Up: Examples + +4.14 Make Duplicate Lines Unique +================================ + +This is an example of the art of using the `N', `P' and `D' commands, +probably the most difficult to master. + + #!/usr/bin/sed -f + h + + :b + # On the last line, print and exit + $b + N + /^\(.*\)\n\1$/ { + # The two lines are identical. Undo the effect of + # the n command. + g + bb + } + + # If the `N' command had added the last line, print and exit + $b + + # The lines are different; print the first and go + # back working on the second. + P + D + + As you can see, we mantain a 2-line window using `P' and `D'. This +technique is often used in advanced `sed' scripts. + + +File: sed.info, Node: uniq -d, Next: uniq -u, Prev: uniq, Up: Examples + +4.15 Print Duplicated Lines of Input +==================================== + +This script prints only duplicated lines, like `uniq -d'. + + #!/usr/bin/sed -nf + + $b + N + /^\(.*\)\n\1$/ { + # Print the first of the duplicated lines + s/.*\n// + p + + # Loop until we get a different line + :b + $b + N + /^\(.*\)\n\1$/ { + s/.*\n// + bb + } + } + + # The last line cannot be followed by duplicates + $b + + # Found a different one. Leave it alone in the pattern space + # and go back to the top, hunting its duplicates + D + + +File: sed.info, Node: uniq -u, Next: cat -s, Prev: uniq -d, Up: Examples + +4.16 Remove All Duplicated Lines +================================ + +This script prints only unique lines, like `uniq -u'. + + #!/usr/bin/sed -f + + # Search for a duplicate line --- until that, print what you find. + $b + N + /^\(.*\)\n\1$/ ! { + P + D + } + + :c + # Got two equal lines in pattern space. At the + # end of the file we simply exit + $d + + # Else, we keep reading lines with `N' until we + # find a different one + s/.*\n// + N + /^\(.*\)\n\1$/ { + bc + } + + # Remove the last instance of the duplicate line + # and go back to the top + D + + +File: sed.info, Node: cat -s, Prev: uniq -u, Up: Examples + +4.17 Squeezing Blank Lines +========================== + +As a final example, here are three scripts, of increasing complexity +and speed, that implement the same function as `cat -s', that is +squeezing blank lines. + + The first leaves a blank line at the beginning and end if there are +some already. + + #!/usr/bin/sed -f + + # on empty lines, join with next + # Note there is a star in the regexp + :x + /^\n*$/ { + N + bx + } + + # now, squeeze all '\n', this can be also done by: + # s/^\(\n\)*/\1/ + s/\n*/\ + / + + This one is a bit more complex and removes all empty lines at the +beginning. It does leave a single blank line at end if one was there. + + #!/usr/bin/sed -f + + # delete all leading empty lines + 1,/^./{ + /./!d + } + + # on an empty line we remove it and all the following + # empty lines, but one + :x + /./!{ + N + s/^\n$// + tx + } + + This removes leading and trailing blank lines. It is also the +fastest. Note that loops are completely done with `n' and `b', without +relying on `sed' to restart the the script automatically at the end of +a line. + + #!/usr/bin/sed -nf + + # delete all (leading) blanks + /./!d + + # get here: so there is a non empty + :x + # print it + p + # get next + n + # got chars? print it again, etc... + /./bx + + # no, don't have chars: got an empty line + :z + # get next, if last line we finish here so no trailing + # empty lines are written + n + # also empty? then ignore it, and get next... this will + # remove ALL empty lines + /./!bz + + # all empty lines were deleted/ignored, but we have a non empty. As + # what we want to do is to squeeze, insert a blank line artificially + i\ + + bx + + +File: sed.info, Node: Limitations, Next: Other Resources, Prev: Examples, Up: Top + +5 GNU `sed''s Limitations and Non-limitations +********************************************* + +For those who want to write portable `sed' scripts, be aware that some +implementations have been known to limit line lengths (for the pattern +and hold spaces) to be no more than 4000 bytes. The POSIX standard +specifies that conforming `sed' implementations shall support at least +8192 byte line lengths. GNU `sed' has no built-in limit on line length; +as long as it can `malloc()' more (virtual) memory, you can feed or +construct lines as long as you like. + + However, recursion is used to handle subpatterns and indefinite +repetition. This means that the available stack space may limit the +size of the buffer that can be processed by certain patterns. + + +File: sed.info, Node: Other Resources, Next: Reporting Bugs, Prev: Limitations, Up: Top + +6 Other Resources for Learning About `sed' +****************************************** + +In addition to several books that have been written about `sed' (either +specifically or as chapters in books which discuss shell programming), +one can find out more about `sed' (including suggestions of a few +books) from the FAQ for the `sed-users' mailing list, available from: + `http://sed.sourceforge.net/sedfaq.html' + + Also of interest are +`http://www.student.northpark.edu/pemente/sed/index.htm' and +`http://sed.sf.net/grabbag', which include `sed' tutorials and other +`sed'-related goodies. + + The `sed-users' mailing list itself maintained by Sven Guckes. To +subscribe, visit `http://groups.yahoo.com' and search for the +`sed-users' mailing list. + + +File: sed.info, Node: Reporting Bugs, Next: Extended regexps, Prev: Other Resources, Up: Top + +7 Reporting Bugs +**************** + +Email bug reports to <bonzini@gnu.org>. Be sure to include the word +"sed" somewhere in the `Subject:' field. Also, please include the +output of `sed --version' in the body of your report if at all possible. + + Please do not send a bug report like this: + + while building frobme-1.3.4 + $ configure + error--> sed: file sedscr line 1: Unknown option to 's' + + If GNU `sed' doesn't configure your favorite package, take a few +extra minutes to identify the specific problem and make a stand-alone +test case. Unlike other programs such as C compilers, making such test +cases for `sed' is quite simple. + + A stand-alone test case includes all the data necessary to perform +the test, and the specific invocation of `sed' that causes the problem. +The smaller a stand-alone test case is, the better. A test case should +not involve something as far removed from `sed' as "try to configure +frobme-1.3.4". Yes, that is in principle enough information to look +for the bug, but that is not a very practical prospect. + + Here are a few commonly reported bugs that are not bugs. + +`N' command on the last line + Most versions of `sed' exit without printing anything when the `N' + command is issued on the last line of a file. GNU `sed' prints + pattern space before exiting unless of course the `-n' command + switch has been specified. This choice is by design. + + For example, the behavior of + sed N foo bar + would depend on whether foo has an even or an odd number of + lines(1). Or, when writing a script to read the next few lines + following a pattern match, traditional implementations of `sed' + would force you to write something like + /foo/{ $!N; $!N; $!N; $!N; $!N; $!N; $!N; $!N; $!N } + instead of just + /foo/{ N;N;N;N;N;N;N;N;N; } + + In any case, the simplest workaround is to use `$d;N' in scripts + that rely on the traditional behavior, or to set the + `POSIXLY_CORRECT' variable to a non-empty value. + +Regex syntax clashes (problems with backslashes) + `sed' uses the POSIX basic regular expression syntax. According to + the standard, the meaning of some escape sequences is undefined in + this syntax; notable in the case of `sed' are `\|', `\+', `\?', + `\`', `\'', `\<', `\>', `\b', `\B', `\w', and `\W'. + + As in all GNU programs that use POSIX basic regular expressions, + `sed' interprets these escape sequences as special characters. + So, `x\+' matches one or more occurrences of `x'. `abc\|def' + matches either `abc' or `def'. + + This syntax may cause problems when running scripts written for + other `sed's. Some `sed' programs have been written with the + assumption that `\|' and `\+' match the literal characters `|' and + `+'. Such scripts must be modified by removing the spurious + backslashes if they are to be used with modern implementations of + `sed', like GNU `sed'. + + On the other hand, some scripts use s|abc\|def||g to remove + occurrences of _either_ `abc' or `def'. While this worked until + `sed' 4.0.x, newer versions interpret this as removing the string + `abc|def'. This is again undefined behavior according to POSIX, + and this interpretation is arguably more robust: older `sed's, for + example, required that the regex matcher parsed `\/' as `/' in the + common case of escaping a slash, which is again undefined + behavior; the new behavior avoids this, and this is good because + the regex matcher is only partially under our control. + + In addition, this version of `sed' supports several escape + characters (some of which are multi-character) to insert + non-printable characters in scripts (`\a', `\c', `\d', `\o', `\r', + `\t', `\v', `\x'). These can cause similar problems with scripts + written for other `sed's. + +`-i' clobbers read-only files + In short, `sed -i' will let you delete the contents of a read-only + file, and in general the `-i' option (*note Invocation: Invoking + sed.) lets you clobber protected files. This is not a bug, but + rather a consequence of how the Unix filesystem works. + + The permissions on a file say what can happen to the data in that + file, while the permissions on a directory say what can happen to + the list of files in that directory. `sed -i' will not ever open + for writing a file that is already on disk. Rather, it will work + on a temporary file that is finally renamed to the original name: + if you rename or delete files, you're actually modifying the + contents of the directory, so the operation depends on the + permissions of the directory, not of the file. For this same + reason, `sed' does not let you use `-i' on a writeable file in a + read-only directory, and will break hard or symbolic links when + `-i' is used on such a file. + +`0a' does not work (gives an error) + There is no line 0. 0 is a special address that is only used to + treat addresses like `0,/RE/' as active when the script starts: if + you write `1,/abc/d' and the first line includes the word `abc', + then that match would be ignored because address ranges must span + at least two lines (barring the end of the file); but what you + probably wanted is to delete every line up to the first one + including `abc', and this is obtained with `0,/abc/d'. + +`[a-z]' is case insensitive + You are encountering problems with locales. POSIX mandates that + `[a-z]' uses the current locale's collation order - in C parlance, + that means using `strcoll(3)' instead of `strcmp(3)'. Some + locales have a case-insensitive collation order, others don't. + + Another problem is that `[a-z]' tries to use collation symbols. + This only happens if you are on the GNU system, using GNU libc's + regular expression matcher instead of compiling the one supplied + with GNU sed. In a Danish locale, for example, the regular + expression `^[a-z]$' matches the string `aa', because this is a + single collating symbol that comes after `a' and before `b'; `ll' + behaves similarly in Spanish locales, or `ij' in Dutch locales. + + To work around these problems, which may cause bugs in shell + scripts, set the `LC_COLLATE' and `LC_CTYPE' environment variables + to `C'. + +`s/.*//' does not clear pattern space + This happens if your input stream includes invalid multibyte + sequences. POSIX mandates that such sequences are _not_ matched + by `.', so that `s/.*//' will not clear pattern space as you would + expect. In fact, there is no way to clear sed's buffers in the + middle of the script in most multibyte locales (including UTF-8 + locales). For this reason, GNU `sed' provides a `z' command (for + `zap') as an extension. + + To work around these problems, which may cause bugs in shell + scripts, set the `LC_COLLATE' and `LC_CTYPE' environment variables + to `C'. + + ---------- Footnotes ---------- + + (1) which is the actual "bug" that prompted the change in behavior + + +File: sed.info, Node: Extended regexps, Next: Concept Index, Prev: Reporting Bugs, Up: Top + +Appendix A Extended regular expressions +*************************************** + +The only difference between basic and extended regular expressions is in +the behavior of a few characters: `?', `+', parentheses, and braces +(`{}'). While basic regular expressions require these to be escaped if +you want them to behave as special characters, when using extended +regular expressions you must escape them if you want them _to match a +literal character_. + +Examples: +`abc?' + becomes `abc\?' when using extended regular expressions. It + matches the literal string `abc?'. + +`c\+' + becomes `c+' when using extended regular expressions. It matches + one or more `c's. + +`a\{3,\}' + becomes `a{3,}' when using extended regular expressions. It + matches three or more `a's. + +`\(abc\)\{2,3\}' + becomes `(abc){2,3}' when using extended regular expressions. It + matches either `abcabc' or `abcabcabc'. + +`\(abc*\)\1' + becomes `(abc*)\1' when using extended regular expressions. + Backreferences must still be escaped when using extended regular + expressions. + + +File: sed.info, Node: Concept Index, Next: Command and Option Index, Prev: Extended regexps, Up: Top + +Concept Index +************* + +This is a general index of all issues discussed in this manual, with the +exception of the `sed' commands and command-line options. + + +* Menu: + +* 0 address: Reporting Bugs. (line 103) +* Additional reading about sed: Other Resources. (line 6) +* ADDR1,+N: Addresses. (line 78) +* ADDR1,~N: Addresses. (line 78) +* Address, as a regular expression: Addresses. (line 27) +* Address, last line: Addresses. (line 22) +* Address, numeric: Addresses. (line 8) +* Addresses, in sed scripts: Addresses. (line 6) +* Append hold space to pattern space: Other Commands. (line 125) +* Append next input line to pattern space: Other Commands. (line 105) +* Append pattern space to hold space: Other Commands. (line 117) +* Appending text after a line: Other Commands. (line 27) +* Backreferences, in regular expressions: The "s" Command. (line 19) +* Branch to a label, if s/// failed: Extended Commands. (line 63) +* Branch to a label, if s/// succeeded: Programming Commands. + (line 22) +* Branch to a label, unconditionally: Programming Commands. + (line 18) +* Buffer spaces, pattern and hold: Execution Cycle. (line 6) +* Bugs, reporting: Reporting Bugs. (line 6) +* Case-insensitive matching: The "s" Command. (line 94) +* Caveat -- #n on first line: Common Commands. (line 20) +* Command groups: Common Commands. (line 50) +* Comments, in scripts: Common Commands. (line 12) +* Conditional branch <1>: Extended Commands. (line 63) +* Conditional branch: Programming Commands. + (line 22) +* Copy hold space into pattern space: Other Commands. (line 121) +* Copy pattern space into hold space: Other Commands. (line 113) +* Delete first line from pattern space: Other Commands. (line 99) +* Disabling autoprint, from command line: Invoking sed. (line 34) +* empty regular expression: Addresses. (line 31) +* Emptying pattern space <1>: Reporting Bugs. (line 130) +* Emptying pattern space: Extended Commands. (line 85) +* Evaluate Bourne-shell commands: Extended Commands. (line 12) +* Evaluate Bourne-shell commands, after substitution: The "s" Command. + (line 85) +* Exchange hold space with pattern space: Other Commands. (line 129) +* Excluding lines: Addresses. (line 101) +* Extended regular expressions, choosing: Invoking sed. (line 113) +* Extended regular expressions, syntax: Extended regexps. (line 6) +* Files to be processed as input: Invoking sed. (line 141) +* Flow of control in scripts: Programming Commands. + (line 11) +* Global substitution: The "s" Command. (line 51) +* GNU extensions, /dev/stderr file <1>: Other Commands. (line 88) +* GNU extensions, /dev/stderr file: The "s" Command. (line 78) +* GNU extensions, /dev/stdin file <1>: Extended Commands. (line 53) +* GNU extensions, /dev/stdin file: Other Commands. (line 78) +* GNU extensions, /dev/stdout file <1>: Other Commands. (line 88) +* GNU extensions, /dev/stdout file <2>: The "s" Command. (line 78) +* GNU extensions, /dev/stdout file: Invoking sed. (line 149) +* GNU extensions, 0 address <1>: Reporting Bugs. (line 103) +* GNU extensions, 0 address: Addresses. (line 78) +* GNU extensions, 0,ADDR2 addressing: Addresses. (line 78) +* GNU extensions, ADDR1,+N addressing: Addresses. (line 78) +* GNU extensions, ADDR1,~N addressing: Addresses. (line 78) +* GNU extensions, branch if s/// failed: Extended Commands. (line 63) +* GNU extensions, case modifiers in s commands: The "s" Command. + (line 23) +* GNU extensions, checking for their presence: Extended Commands. + (line 69) +* GNU extensions, disabling: Invoking sed. (line 81) +* GNU extensions, emptying pattern space <1>: Reporting Bugs. (line 130) +* GNU extensions, emptying pattern space: Extended Commands. (line 85) +* GNU extensions, evaluating Bourne-shell commands <1>: Extended Commands. + (line 12) +* GNU extensions, evaluating Bourne-shell commands: The "s" Command. + (line 85) +* GNU extensions, extended regular expressions: Invoking sed. (line 113) +* GNU extensions, g and NUMBER modifier interaction in s command: The "s" Command. + (line 57) +* GNU extensions, I modifier <1>: The "s" Command. (line 94) +* GNU extensions, I modifier: Addresses. (line 49) +* GNU extensions, in-place editing <1>: Reporting Bugs. (line 85) +* GNU extensions, in-place editing: Invoking sed. (line 51) +* GNU extensions, L command: Extended Commands. (line 26) +* GNU extensions, M modifier: The "s" Command. (line 99) +* GNU extensions, modifiers and the empty regular expression: Addresses. + (line 31) +* GNU extensions, N~M addresses: Addresses. (line 13) +* GNU extensions, quitting silently: Extended Commands. (line 36) +* GNU extensions, R command: Extended Commands. (line 53) +* GNU extensions, reading a file a line at a time: Extended Commands. + (line 53) +* GNU extensions, reformatting paragraphs: Extended Commands. (line 26) +* GNU extensions, returning an exit code <1>: Extended Commands. + (line 36) +* GNU extensions, returning an exit code: Common Commands. (line 30) +* GNU extensions, setting line length: Other Commands. (line 65) +* GNU extensions, special escapes <1>: Reporting Bugs. (line 78) +* GNU extensions, special escapes: Escapes. (line 6) +* GNU extensions, special two-address forms: Addresses. (line 78) +* GNU extensions, subprocesses <1>: Extended Commands. (line 12) +* GNU extensions, subprocesses: The "s" Command. (line 85) +* GNU extensions, to basic regular expressions <1>: Reporting Bugs. + (line 51) +* GNU extensions, to basic regular expressions: Regular Expressions. + (line 26) +* GNU extensions, two addresses supported by most commands: Other Commands. + (line 25) +* GNU extensions, unlimited line length: Limitations. (line 6) +* GNU extensions, writing first line to a file: Extended Commands. + (line 80) +* Goto, in scripts: Programming Commands. + (line 18) +* Greedy regular expression matching: Regular Expressions. (line 143) +* Grouping commands: Common Commands. (line 50) +* Hold space, appending from pattern space: Other Commands. (line 117) +* Hold space, appending to pattern space: Other Commands. (line 125) +* Hold space, copy into pattern space: Other Commands. (line 121) +* Hold space, copying pattern space into: Other Commands. (line 113) +* Hold space, definition: Execution Cycle. (line 6) +* Hold space, exchange with pattern space: Other Commands. (line 129) +* In-place editing: Reporting Bugs. (line 85) +* In-place editing, activating: Invoking sed. (line 51) +* In-place editing, Perl-style backup file names: Invoking sed. + (line 62) +* Inserting text before a line: Other Commands. (line 46) +* Labels, in scripts: Programming Commands. + (line 14) +* Last line, selecting: Addresses. (line 22) +* Line length, setting <1>: Other Commands. (line 65) +* Line length, setting: Invoking sed. (line 76) +* Line number, printing: Other Commands. (line 62) +* Line selection: Addresses. (line 6) +* Line, selecting by number: Addresses. (line 8) +* Line, selecting by regular expression match: Addresses. (line 27) +* Line, selecting last: Addresses. (line 22) +* List pattern space: Other Commands. (line 65) +* Mixing g and NUMBER modifiers in the s command: The "s" Command. + (line 57) +* Next input line, append to pattern space: Other Commands. (line 105) +* Next input line, replace pattern space with: Common Commands. + (line 44) +* Non-bugs, 0 address: Reporting Bugs. (line 103) +* Non-bugs, in-place editing: Reporting Bugs. (line 85) +* Non-bugs, localization-related: Reporting Bugs. (line 112) +* Non-bugs, N command on the last line: Reporting Bugs. (line 31) +* Non-bugs, regex syntax clashes: Reporting Bugs. (line 51) +* Parenthesized substrings: The "s" Command. (line 19) +* Pattern space, definition: Execution Cycle. (line 6) +* Perl-style regular expressions, multiline: Addresses. (line 54) +* Portability, comments: Common Commands. (line 15) +* Portability, line length limitations: Limitations. (line 6) +* Portability, N command on the last line: Reporting Bugs. (line 31) +* POSIXLY_CORRECT behavior, bracket expressions: Regular Expressions. + (line 105) +* POSIXLY_CORRECT behavior, enabling: Invoking sed. (line 84) +* POSIXLY_CORRECT behavior, escapes: Escapes. (line 11) +* POSIXLY_CORRECT behavior, N command: Reporting Bugs. (line 46) +* Print first line from pattern space: Other Commands. (line 110) +* Printing line number: Other Commands. (line 62) +* Printing text unambiguously: Other Commands. (line 65) +* Quitting <1>: Extended Commands. (line 36) +* Quitting: Common Commands. (line 30) +* Range of lines: Addresses. (line 65) +* Range with start address of zero: Addresses. (line 78) +* Read next input line: Common Commands. (line 44) +* Read text from a file <1>: Extended Commands. (line 53) +* Read text from a file: Other Commands. (line 78) +* Reformat pattern space: Extended Commands. (line 26) +* Reformatting paragraphs: Extended Commands. (line 26) +* Replace hold space with copy of pattern space: Other Commands. + (line 113) +* Replace pattern space with copy of hold space: Other Commands. + (line 121) +* Replacing all text matching regexp in a line: The "s" Command. + (line 51) +* Replacing only Nth match of regexp in a line: The "s" Command. + (line 55) +* Replacing selected lines with other text: Other Commands. (line 52) +* Requiring GNU sed: Extended Commands. (line 69) +* Script structure: sed Programs. (line 6) +* Script, from a file: Invoking sed. (line 46) +* Script, from command line: Invoking sed. (line 41) +* sed program structure: sed Programs. (line 6) +* Selecting lines to process: Addresses. (line 6) +* Selecting non-matching lines: Addresses. (line 101) +* Several lines, selecting: Addresses. (line 65) +* Slash character, in regular expressions: Addresses. (line 41) +* Spaces, pattern and hold: Execution Cycle. (line 6) +* Special addressing forms: Addresses. (line 78) +* Standard input, processing as input: Invoking sed. (line 143) +* Stream editor: Introduction. (line 6) +* Subprocesses <1>: Extended Commands. (line 12) +* Subprocesses: The "s" Command. (line 85) +* Substitution of text, options: The "s" Command. (line 47) +* Text, appending: Other Commands. (line 27) +* Text, deleting: Common Commands. (line 36) +* Text, insertion: Other Commands. (line 46) +* Text, printing: Common Commands. (line 39) +* Text, printing after substitution: The "s" Command. (line 65) +* Text, writing to a file after substitution: The "s" Command. + (line 78) +* Transliteration: Other Commands. (line 14) +* Unbuffered I/O, choosing: Invoking sed. (line 131) +* Usage summary, printing: Invoking sed. (line 28) +* Version, printing: Invoking sed. (line 24) +* Working on separate files: Invoking sed. (line 121) +* Write first line to a file: Extended Commands. (line 80) +* Write to a file: Other Commands. (line 88) +* Zero, as range start address: Addresses. (line 78) + + +File: sed.info, Node: Command and Option Index, Prev: Concept Index, Up: Top + +Command and Option Index +************************ + +This is an alphabetical list of all `sed' commands and command-line +options. + + +* Menu: + +* # (comments): Common Commands. (line 12) +* --binary: Invoking sed. (line 93) +* --expression: Invoking sed. (line 41) +* --file: Invoking sed. (line 46) +* --follow-symlinks: Invoking sed. (line 104) +* --help: Invoking sed. (line 28) +* --in-place: Invoking sed. (line 51) +* --line-length: Invoking sed. (line 76) +* --quiet: Invoking sed. (line 34) +* --regexp-extended: Invoking sed. (line 113) +* --silent: Invoking sed. (line 34) +* --unbuffered: Invoking sed. (line 131) +* --version: Invoking sed. (line 24) +* -b: Invoking sed. (line 93) +* -e: Invoking sed. (line 41) +* -f: Invoking sed. (line 46) +* -i: Invoking sed. (line 51) +* -l: Invoking sed. (line 76) +* -n: Invoking sed. (line 34) +* -n, forcing from within a script: Common Commands. (line 20) +* -r: Invoking sed. (line 113) +* -u: Invoking sed. (line 131) +* : (label) command: Programming Commands. + (line 14) +* = (print line number) command: Other Commands. (line 62) +* a (append text lines) command: Other Commands. (line 27) +* b (branch) command: Programming Commands. + (line 18) +* c (change to text lines) command: Other Commands. (line 52) +* D (delete first line) command: Other Commands. (line 99) +* d (delete) command: Common Commands. (line 36) +* e (evaluate) command: Extended Commands. (line 12) +* G (appending Get) command: Other Commands. (line 125) +* g (get) command: Other Commands. (line 121) +* H (append Hold) command: Other Commands. (line 117) +* h (hold) command: Other Commands. (line 113) +* i (insert text lines) command: Other Commands. (line 46) +* L (fLow paragraphs) command: Extended Commands. (line 26) +* l (list unambiguously) command: Other Commands. (line 65) +* N (append Next line) command: Other Commands. (line 105) +* n (next-line) command: Common Commands. (line 44) +* P (print first line) command: Other Commands. (line 110) +* p (print) command: Common Commands. (line 39) +* q (quit) command: Common Commands. (line 30) +* Q (silent Quit) command: Extended Commands. (line 36) +* r (read file) command: Other Commands. (line 78) +* R (read line) command: Extended Commands. (line 53) +* s command, option flags: The "s" Command. (line 47) +* T (test and branch if failed) command: Extended Commands. (line 63) +* t (test and branch if successful) command: Programming Commands. + (line 22) +* v (version) command: Extended Commands. (line 69) +* w (write file) command: Other Commands. (line 88) +* W (write first line) command: Extended Commands. (line 80) +* x (eXchange) command: Other Commands. (line 129) +* y (transliterate) command: Other Commands. (line 14) +* z (Zap) command: Extended Commands. (line 85) +* {} command grouping: Common Commands. (line 50) + + + +Tag Table: +Node: Top944 +Node: Introduction3867 +Node: Invoking sed4421 +Ref: Invoking sed-Footnote-110512 +Ref: Invoking sed-Footnote-210704 +Node: sed Programs10803 +Node: Execution Cycle11951 +Ref: Execution Cycle-Footnote-113129 +Node: Addresses13430 +Node: Regular Expressions18174 +Node: Common Commands26082 +Node: The "s" Command28085 +Ref: The "s" Command-Footnote-132422 +Node: Other Commands32494 +Ref: Other Commands-Footnote-137636 +Node: Programming Commands37708 +Node: Extended Commands38622 +Node: Escapes42630 +Ref: Escapes-Footnote-145641 +Node: Examples45832 +Node: Centering lines46928 +Node: Increment a number47820 +Ref: Increment a number-Footnote-149380 +Node: Rename files to lower case49500 +Node: Print bash environment52203 +Node: Reverse chars of lines52958 +Ref: Reverse chars of lines-Footnote-153959 +Node: tac54176 +Node: cat -n54943 +Node: cat -b56765 +Node: wc -c57512 +Ref: wc -c-Footnote-159420 +Node: wc -w59489 +Node: wc -l60953 +Node: head61197 +Node: tail61528 +Node: uniq63209 +Node: uniq -d63997 +Node: uniq -u64708 +Node: cat -s65419 +Node: Limitations67270 +Node: Other Resources68111 +Node: Reporting Bugs68956 +Ref: Reporting Bugs-Footnote-176092 +Node: Extended regexps76163 +Node: Concept Index77349 +Node: Command and Option Index92298 + +End Tag Table diff --git a/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/po/ChangeLog b/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/po/ChangeLog new file mode 100644 index 0000000..0042d6f --- /dev/null +++ b/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/po/ChangeLog @@ -0,0 +1,53 @@ +2004-11-11 Paolo Bonzini <bonzini@gnu.org> + + * Makevars: New. + +2004-11-02 gettextize <bug-gnu-utils@gnu.org> + + * Makefile.in.in: Upgrade to gettext-0.10.40. + +2002-10-26 Paolo Bonzini <bonzini@gnu.org> + + * po/*.po: updated from Translation Project + +2001-10-19 gettextize <bug-gnu-utils@gnu.org> + + * Makefile.in.in: Upgrade to gettext-0.10.40. + * cat-id-tbl.c: Remove file. + * stamp-cat-id: Remove file. + +2001-03-02 Paolo Bonzini <bonzini@gnu.org> + + * po/it.po: updated + * po/sed.pot: likewise. + +2000-12-10 Paolo Bonzini <bonzini@gnu.org> + + * po/it.po: Italian translation reviewed for new POT file. + * po/sed.pot: updated + +Mon Mar 15 16:25:53 PST 1999 Ken Pizzini <ken@gnu.org> + + * po/it.po: new translation file. + +Sun Feb 7 21:22:17 PST 1999 Ken Pizzini <ken@gnu.org> + + * po/de.po: new translation file. + +Sat Dec 12 11:18:55 PST 1998 Ken Pizzini <ken@gnu.org> + + * po/ru.po: new translation file. + +Sun Dec 6 00:51:23 PST 1998 Ken Pizzini <ken@gnu.org> + + * po/fr.po: new translation file. + +Sun Aug 16 02:59:20 PDT 1998 Ken Pizzini <ken@gnu.org> + + * sed/compile.c: added N_() markers and corresponding gettext() + (er, _()) calls. + * po/sed.pot: updated to reflect changed and newly marked text. + +1998-07-24 Erick Branderhorst <Erick.Branderhorst@asml.nl> + + * po/nl.po: Dutch translation. diff --git a/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/testsuite/bug-regex10.c b/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/testsuite/bug-regex10.c new file mode 100644 index 0000000..1a21617 --- /dev/null +++ b/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/testsuite/bug-regex10.c @@ -0,0 +1,65 @@ +/* Test for re_match with non-zero start. + Copyright (C) 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek <jakub@redhat.com>, 2002. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301 USA. */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <locale.h> +#include <stdio.h> +#include <string.h> +#include <regex.h> + +int +main (void) +{ + struct re_pattern_buffer regex; + struct re_registers regs; + const char *s; + int match; + int result = 0; + + regs.num_regs = 1; + memset (®ex, '\0', sizeof (regex)); + s = re_compile_pattern ("[abc]*d", 7, ®ex); + if (s != NULL) + { + puts ("re_compile_pattern return non-NULL value"); + result = 1; + } + else + { + match = re_match (®ex, "foacabdxy", 9, 2, ®s); + if (match != 5) + { + printf ("re_match returned %d, expected 5\n", match); + result = 1; + } + else if (regs.start[0] != 2 || regs.end[0] != 7) + { + printf ("re_match returned %d..%d, expected 2..7\n", + regs.start[0], regs.end[0]); + result = 1; + } + puts (" -> OK"); + } + + return result; +} diff --git a/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/testsuite/bug-regex11.c b/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/testsuite/bug-regex11.c new file mode 100644 index 0000000..dbfa3f9 --- /dev/null +++ b/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/testsuite/bug-regex11.c @@ -0,0 +1,143 @@ +/* Regular expression tests. + Copyright (C) 2002, 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek <jakub@redhat.com>, 2002. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301 USA. */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <sys/types.h> +#ifdef HAVE_MCHECK_H +#include <mcheck.h> +#endif +#include <regex.h> +#include <stdio.h> +#include <stdlib.h> + +/* Tests supposed to match. */ +struct +{ + const char *pattern; + const char *string; + int flags, nmatch; + regmatch_t rm[5]; +} tests[] = { + /* Test for newline handling in regex. */ + { "[^~]*~", "\nx~y", 0, 2, { { 0, 3 }, { -1, -1 } } }, + /* Other tests. */ + { "a(.*)b", "a b", REG_EXTENDED, 2, { { 0, 3 }, { 1, 2 } } }, + { ".*|\\([KIO]\\)\\([^|]*\\).*|?[KIO]", "10~.~|P|K0|I10|O16|?KSb", 0, 3, + { { 0, 21 }, { 15, 16 }, { 16, 18 } } }, + { ".*|\\([KIO]\\)\\([^|]*\\).*|?\\1", "10~.~|P|K0|I10|O16|?KSb", 0, 3, + { { 0, 21 }, { 8, 9 }, { 9, 10 } } }, + { "^\\(a*\\)\\1\\{9\\}\\(a\\{0,9\\}\\)\\([0-9]*;.*[^a]\\2\\([0-9]\\)\\)", + "a1;;0a1aa2aaa3aaaa4aaaaa5aaaaaa6aaaaaaa7aaaaaaaa8aaaaaaaaa9aa2aa1a0", 0, + 5, { { 0, 67 }, { 0, 0 }, { 0, 1 }, { 1, 67 }, { 66, 67 } } }, + /* Test for BRE expression anchoring. POSIX says just that this may match; + in glibc regex it always matched, so avoid changing it. */ + { "\\(^\\|foo\\)bar", "bar", 0, 2, { { 0, 3 }, { -1, -1 } } }, + { "\\(foo\\|^\\)bar", "bar", 0, 2, { { 0, 3 }, { -1, -1 } } }, + /* In ERE this must be treated as an anchor. */ + { "(^|foo)bar", "bar", REG_EXTENDED, 2, { { 0, 3 }, { -1, -1 } } }, + { "(foo|^)bar", "bar", REG_EXTENDED, 2, { { 0, 3 }, { -1, -1 } } }, + /* Here ^ cannot be treated as an anchor according to POSIX. */ + { "(^|foo)bar", "(^|foo)bar", 0, 2, { { 0, 10 }, { -1, -1 } } }, + { "(foo|^)bar", "(foo|^)bar", 0, 2, { { 0, 10 }, { -1, -1 } } }, + /* More tests on backreferences. */ + { "()\\1", "x", REG_EXTENDED, 2, { { 0, 0 }, { 0, 0 } } }, + { "()x\\1", "x", REG_EXTENDED, 2, { { 0, 1 }, { 0, 0 } } }, + { "()\\1*\\1*", "", REG_EXTENDED, 2, { { 0, 0 }, { 0, 0 } } }, + { "([0-9]).*\\1(a*)", "7;7a6", REG_EXTENDED, 3, { { 0, 4 }, { 0, 1 }, { 3, 4 } } }, + { "([0-9]).*\\1(a*)", "7;7a", REG_EXTENDED, 3, { { 0, 4 }, { 0, 1 }, { 3, 4 } } }, + { "(b)()c\\1", "bcb", REG_EXTENDED, 3, { { 0, 3 }, { 0, 1 }, { 1, 1 } } }, + { "()(b)c\\2", "bcb", REG_EXTENDED, 3, { { 0, 3 }, { 0, 0 }, { 0, 1 } } }, + { "a(b)()c\\1", "abcb", REG_EXTENDED, 3, { { 0, 4 }, { 1, 2 }, { 2, 2 } } }, + { "a()(b)c\\2", "abcb", REG_EXTENDED, 3, { { 0, 4 }, { 1, 1 }, { 1, 2 } } }, + { "()(b)\\1c\\2", "bcb", REG_EXTENDED, 3, { { 0, 3 }, { 0, 0 }, { 0, 1 } } }, + { "(b())\\2\\1", "bbbb", REG_EXTENDED, 3, { { 0, 2 }, { 0, 1 }, { 1, 1 } } }, + { "a()(b)\\1c\\2", "abcb", REG_EXTENDED, 3, { { 0, 4 }, { 1, 1 }, { 1, 2 } } }, + { "a()d(b)\\1c\\2", "adbcb", REG_EXTENDED, 3, { { 0, 5 }, { 1, 1 }, { 2, 3 } } }, + { "a(b())\\2\\1", "abbbb", REG_EXTENDED, 3, { { 0, 3 }, { 1, 2 }, { 2, 2 } } }, + { "(bb())\\2\\1", "bbbb", REG_EXTENDED, 3, { { 0, 4 }, { 0, 2 }, { 2, 2 } } }, + { "^(.?)(.?)(.?)(.?)(.?).?\\5\\4\\3\\2\\1$", + "level", REG_NOSUB | REG_EXTENDED, 0, { { -1, -1 } } }, + { "^(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.).?\\9\\8\\7\\6\\5\\4\\3\\2\\1$|^.?$", + "level", REG_NOSUB | REG_EXTENDED, 0, { { -1, -1 } } }, + { "^(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.).?\\9\\8\\7\\6\\5\\4\\3\\2\\1$|^.?$", + "abcdedcba", REG_EXTENDED, 1, { { 0, 9 } } }, +#if 0 + /* XXX Not used since they fail so far. */ + { "^(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.).?\\9\\8\\7\\6\\5\\4\\3\\2\\1$|^.?$", + "ababababa", REG_EXTENDED, 1, { { 0, 9 } } }, + { "^(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?).?\\9\\8\\7\\6\\5\\4\\3\\2\\1$", + "level", REG_NOSUB | REG_EXTENDED, 0, { { -1, -1 } } }, + { "^(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?).?\\9\\8\\7\\6\\5\\4\\3\\2\\1$", + "ababababa", REG_EXTENDED, 1, { { 0, 9 } } }, +#endif +}; + +int +main (void) +{ + regex_t re; + regmatch_t rm[5]; + size_t i; + int n, ret = 0; + +#ifdef HAVE_MCHECK_H + mtrace (); +#endif + + for (i = 0; i < sizeof (tests) / sizeof (tests[0]); ++i) + { + n = regcomp (&re, tests[i].pattern, tests[i].flags); + if (n != 0) + { + char buf[500]; + regerror (n, &re, buf, sizeof (buf)); + printf ("%s: regcomp %lu failed: %s\n", tests[i].pattern, i, buf); + ret = 1; + continue; + } + + if (regexec (&re, tests[i].string, tests[i].nmatch, rm, 0)) + { + printf ("%s: regexec %lu failed\n", tests[i].pattern, i); + ret = 1; + regfree (&re); + continue; + } + + for (n = 0; n < tests[i].nmatch; ++n) + if (rm[n].rm_so != tests[i].rm[n].rm_so + || rm[n].rm_eo != tests[i].rm[n].rm_eo) + { + if (tests[i].rm[n].rm_so == -1 && tests[i].rm[n].rm_eo == -1) + break; + printf ("%s: regexec %lu match failure rm[%d] %d..%d\n", + tests[i].pattern, i, n, rm[n].rm_so, rm[n].rm_eo); + ret = 1; + break; + } + + regfree (&re); + } + + return ret; +} diff --git a/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/testsuite/bug-regex12.c b/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/testsuite/bug-regex12.c new file mode 100644 index 0000000..a4db0cc --- /dev/null +++ b/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/testsuite/bug-regex12.c @@ -0,0 +1,81 @@ +/* Regular expression tests. + Copyright (C) 2002, 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek <jakub@redhat.com>, 2002. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301 USA. */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <sys/types.h> +#ifdef HAVE_MCHECK_H +#include <mcheck.h> +#endif +#include <regex.h> +#include <stdio.h> +#include <stdlib.h> + +/* Tests supposed to not match. */ +struct +{ + const char *pattern; + const char *string; + int flags, nmatch; +} tests[] = { + { "^<\\([^~]*\\)\\([^~]\\)[^~]*~\\1\\(.\\).*|=.*\\3.*\\2", + "<,.8~2,~so-|=-~.0,123456789<><", REG_NOSUB, 0 }, + /* In ERE, all carets must be treated as anchors. */ + { "a^b", "a^b", REG_EXTENDED, 0 } +}; + +int +main (void) +{ + regex_t re; + regmatch_t rm[4]; + size_t i; + int n, ret = 0; + +#ifdef HAVE_MCHECK_H + mtrace (); +#endif + + for (i = 0; i < sizeof (tests) / sizeof (tests[0]); ++i) + { + n = regcomp (&re, tests[i].pattern, tests[i].flags); + if (n != 0) + { + char buf[500]; + regerror (n, &re, buf, sizeof (buf)); + printf ("regcomp %lu failed: %s\n", i, buf); + ret = 1; + continue; + } + + if (! regexec (&re, tests[i].string, tests[i].nmatch, + tests[i].nmatch ? rm : NULL, 0)) + { + printf ("regexec %lu incorrectly matched\n", i); + ret = 1; + } + + regfree (&re); + } + + return ret; +} diff --git a/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/testsuite/bug-regex13.c b/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/testsuite/bug-regex13.c new file mode 100644 index 0000000..a28c5fa --- /dev/null +++ b/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/testsuite/bug-regex13.c @@ -0,0 +1,111 @@ +/* Regular expression tests. + Copyright (C) 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>, 2002. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301 USA. */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <sys/types.h> +#ifdef HAVE_MCHECK_H +#include <mcheck.h> +#endif +#include <regex.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +static struct +{ + int syntax; + const char *pattern; + const char *string; + int start; +} tests[] = { + {RE_BACKSLASH_ESCAPE_IN_LISTS, "[0\\-9]", "1", -1}, /* It should not match. */ + {RE_BACKSLASH_ESCAPE_IN_LISTS, "[0\\-9]", "-", 0}, /* It should match. */ + {RE_SYNTAX_POSIX_BASIC, "s1\n.*\ns3", "s1\ns2\ns3", 0}, + {RE_SYNTAX_POSIX_EXTENDED, "ab{0}c", "ac", 0}, + {RE_SYNTAX_POSIX_EXTENDED, "ab{0}c", "abc", -1}, + {RE_SYNTAX_POSIX_EXTENDED, "ab{0}c", "abbc", -1}, + /* Nested duplication. */ + {RE_SYNTAX_POSIX_EXTENDED, "ab{1}{1}c", "ac", -1}, + {RE_SYNTAX_POSIX_EXTENDED, "ab{1}{1}c", "abc", 0}, + {RE_SYNTAX_POSIX_EXTENDED, "ab{1}{1}c", "abbc", -1}, + {RE_SYNTAX_POSIX_EXTENDED, "ab{2}{2}c", "ac", -1}, + {RE_SYNTAX_POSIX_EXTENDED, "ab{2}{2}c", "abbc", -1}, + {RE_SYNTAX_POSIX_EXTENDED, "ab{2}{2}c", "abbbbc", 0}, + {RE_SYNTAX_POSIX_EXTENDED, "ab{2}{2}c", "abbbbbc", -1}, + {RE_SYNTAX_POSIX_EXTENDED, "ab{0}{1}c", "ac", 0}, + {RE_SYNTAX_POSIX_EXTENDED, "ab{0}{1}c", "abc", -1}, + {RE_SYNTAX_POSIX_EXTENDED, "ab{0}{1}c", "abbc", -1}, + {RE_SYNTAX_POSIX_EXTENDED, "ab{1}{0}c", "ac", 0}, + {RE_SYNTAX_POSIX_EXTENDED, "ab{1}{0}c", "abc", -1}, + {RE_SYNTAX_POSIX_EXTENDED, "ab{1}{0}c", "abbc", -1}, + {RE_SYNTAX_POSIX_EXTENDED, "ab{0}*c", "ac", 0}, + {RE_SYNTAX_POSIX_EXTENDED, "ab{0}*c", "abc", -1}, + {RE_SYNTAX_POSIX_EXTENDED, "ab{0}*c", "abbc", -1}, + {RE_SYNTAX_POSIX_EXTENDED, "ab{0}?c", "ac", 0}, + {RE_SYNTAX_POSIX_EXTENDED, "ab{0}?c", "abc", -1}, + {RE_SYNTAX_POSIX_EXTENDED, "ab{0}?c", "abbc", -1}, + {RE_SYNTAX_POSIX_EXTENDED, "ab{0}+c", "ac", 0}, + {RE_SYNTAX_POSIX_EXTENDED, "ab{0}+c", "abc", -1}, + {RE_SYNTAX_POSIX_EXTENDED, "ab{0}+c", "abbc", -1}, +}; + +int +main (void) +{ + struct re_pattern_buffer regbuf; + const char *err; + size_t i; + int ret = 0; + +#ifdef HAVE_MCHECK_H + mtrace (); +#endif + + for (i = 0; i < sizeof (tests) / sizeof (tests[0]); ++i) + { + int start; + re_set_syntax (tests[i].syntax); + memset (®buf, '\0', sizeof (regbuf)); + err = re_compile_pattern (tests[i].pattern, strlen (tests[i].pattern), + ®buf); + if (err != NULL) + { + printf ("re_compile_pattern failed: %s\n", err); + ret = 1; + continue; + } + + start = re_search (®buf, tests[i].string, strlen (tests[i].string), + 0, strlen (tests[i].string), NULL); + if (start != tests[i].start) + { + printf ("re_search failed %d\n", start); + ret = 1; + regfree (®buf); + continue; + } + regfree (®buf); + } + + return ret; +} diff --git a/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/testsuite/bug-regex14.c b/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/testsuite/bug-regex14.c new file mode 100644 index 0000000..4b296d8 --- /dev/null +++ b/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/testsuite/bug-regex14.c @@ -0,0 +1,62 @@ +/* Tests re_comp and re_exec. + Copyright (C) 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>, 2002. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301 USA. */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#define _REGEX_RE_COMP +#include <sys/types.h> +#ifdef HAVE_MCHECK_H +#include <mcheck.h> +#endif +#include <regex.h> +#include <stdio.h> +#include <stdlib.h> + +int +main (void) +{ + const char *err; + size_t i; + int ret = 0; + +#ifdef HAVE_MCHECK_H + mtrace (); +#endif + + for (i = 0; i < 100; ++i) + { + err = re_comp ("a t.st"); + if (err) + { + printf ("re_comp failed: %s\n", err); + ret = 1; + } + + if (! re_exec ("This is a test.")) + { + printf ("re_exec failed\n"); + ret = 1; + } + } + + return ret; +} diff --git a/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/testsuite/bug-regex15.c b/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/testsuite/bug-regex15.c new file mode 100644 index 0000000..76aa92d --- /dev/null +++ b/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/testsuite/bug-regex15.c @@ -0,0 +1,53 @@ +/* Test for memory/CPU leak in regcomp. */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <sys/types.h> +#include <sys/time.h> +#ifdef HAVE_SYS_RESOURCE_H +#include <sys/resource.h> +#endif +#include <regex.h> +#include <stdio.h> +#include <stdlib.h> + +#define TEST_DATA_LIMIT (32 << 20) + +int +main () +{ +#ifdef RLIMIT_DATA + regex_t re; + int reerr; + + /* Try to avoid eating all memory if a test leaks. */ + struct rlimit data_limit; + if (getrlimit (RLIMIT_DATA, &data_limit) == 0) + { + if ((rlim_t) TEST_DATA_LIMIT > data_limit.rlim_max) + data_limit.rlim_cur = data_limit.rlim_max; + else if (data_limit.rlim_cur > (rlim_t) TEST_DATA_LIMIT) + data_limit.rlim_cur = (rlim_t) TEST_DATA_LIMIT; + if (setrlimit (RLIMIT_DATA, &data_limit) < 0) + perror ("setrlimit: RLIMIT_DATA"); + } + else + perror ("getrlimit: RLIMIT_DATA"); + + reerr = regcomp (&re, "^6?3?[25]?5?[14]*[25]*[69]*+[58]*87?4?$", + REG_EXTENDED | REG_NOSUB); + if (reerr != 0) + { + char buf[100]; + regerror (reerr, &re, buf, sizeof buf); + printf ("regerror %s\n", buf); + return 1; + } + + return 0; +#else + return 77; +#endif +} diff --git a/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/testsuite/bug-regex16.c b/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/testsuite/bug-regex16.c new file mode 100644 index 0000000..7a1d3c8 --- /dev/null +++ b/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/testsuite/bug-regex16.c @@ -0,0 +1,39 @@ +/* Test re_compile_pattern error messages. */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <stdio.h> +#include <string.h> +#include <regex.h> + +int +main (void) +{ + struct re_pattern_buffer re; + const char *s; + int ret = 0; + + re_set_syntax (RE_SYNTAX_POSIX_EGREP); + memset (&re, 0, sizeof (re)); + s = re_compile_pattern ("[[.invalid_collating_symbol.]]", 30, &re); + if (s == NULL || strcmp (s, "Invalid collation character")) + { + printf ("re_compile_pattern returned %s\n", s); + ret = 1; + } + s = re_compile_pattern ("[[=invalid_equivalence_class=]]", 31, &re); + if (s == NULL || strcmp (s, "Invalid collation character")) + { + printf ("re_compile_pattern returned %s\n", s); + ret = 1; + } + s = re_compile_pattern ("[[:invalid_character_class:]]", 29, &re); + if (s == NULL || strcmp (s, "Invalid character class name")) + { + printf ("re_compile_pattern returned %s\n", s); + ret = 1; + } + return ret; +} diff --git a/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/testsuite/bug-regex21.c b/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/testsuite/bug-regex21.c new file mode 100644 index 0000000..0232876 --- /dev/null +++ b/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/testsuite/bug-regex21.c @@ -0,0 +1,53 @@ +/* Test for memory leaks in regcomp. + Copyright (C) 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek <jakub@redhat.com>, 2003. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301 USA. */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef HAVE_MCHECK_H +#include <mcheck.h> +#endif +#include <regex.h> +#include <stdio.h> + +int main (void) +{ + regex_t re; + int i; + int ret = 0; + +#ifdef HAVE_MCHECK_H + mtrace (); +#endif + + for (i = 0; i < 32; ++i) + { + if (regcomp (&re, "X-.+:.+Y=\".*\\.(A|B|C|D|E|F|G|H|I", + REG_EXTENDED | REG_ICASE) == 0) + { + puts ("regcomp unexpectedly succeeded"); + ret = 1; + } + else + regfree (&re); + } + return ret; +} diff --git a/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/testsuite/bug-regex27.c b/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/testsuite/bug-regex27.c new file mode 100644 index 0000000..340ade9 --- /dev/null +++ b/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/testsuite/bug-regex27.c @@ -0,0 +1,65 @@ +/* Test REG_NEWLINE. + Copyright (C) 2007 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek <jakub@redhat.com>, 2007. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <config.h> +#include <regex.h> +#include <stdio.h> +#include <string.h> + +struct tests +{ + const char *regex; + const char *string; + int cflags; + int retval; +} tests[] = { + { "a.b", "a\nb", REG_EXTENDED | REG_NEWLINE, REG_NOMATCH }, + { "a.b", "a\nb", REG_EXTENDED, 0 }, + { "a[^x]b", "a\nb", REG_EXTENDED | REG_NEWLINE, REG_NOMATCH }, + { "a[^x]b", "a\nb", REG_EXTENDED, 0 } +}; + +int +main (void) +{ + regex_t r; + size_t i; + int ret = 0; + + for (i = 0; i < sizeof (tests) / sizeof (tests[i]); ++i) + { + memset (&r, 0, sizeof (r)); + if (regcomp (&r, tests[i].regex, tests[i].cflags)) + { + printf ("regcomp %lu failed\n", i); + ret = 1; + continue; + } + int rv = regexec (&r, tests[i].string, 0, NULL, 0); + if (rv != tests[i].retval) + { + printf ("regexec %lu unexpected value %d != %d\n", + i, rv, tests[i].retval); + ret = 1; + } + regfree (&r); + } + return ret; +} diff --git a/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/testsuite/bug-regex28.c b/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/testsuite/bug-regex28.c new file mode 100644 index 0000000..f546b35 --- /dev/null +++ b/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/testsuite/bug-regex28.c @@ -0,0 +1,76 @@ +/* Test RE_HAT_LISTS_NOT_NEWLINE and RE_DOT_NEWLINE. + Copyright (C) 2007 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek <jakub@redhat.com>, 2007. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <config.h> +#include <regex.h> +#include <stdio.h> +#include <string.h> + +struct tests +{ + const char *regex; + const char *string; + reg_syntax_t syntax; + int retval; +} tests[] = { +#define EGREP RE_SYNTAX_EGREP +#define EGREP_NL (RE_SYNTAX_EGREP | RE_DOT_NEWLINE) & ~RE_HAT_LISTS_NOT_NEWLINE + { "a.b", "a\nb", EGREP, -1 }, + { "a.b", "a\nb", EGREP_NL, 0 }, + { "a[^x]b", "a\nb", EGREP, -1 }, + { "a[^x]b", "a\nb", EGREP_NL, 0 }, + /* While \S and \W are internally handled as [^[:space:]] and [^[:alnum:]_], + RE_HAT_LISTS_NOT_NEWLINE did not make any difference, so ensure + it doesn't change. */ + { "a\\Sb", "a\nb", EGREP, -1 }, + { "a\\Sb", "a\nb", EGREP_NL, -1 }, + { "a\\Wb", "a\nb", EGREP, 0 }, + { "a\\Wb", "a\nb", EGREP_NL, 0 } +}; + +int +main (void) +{ + struct re_pattern_buffer r; + size_t i; + int ret = 0; + + for (i = 0; i < sizeof (tests) / sizeof (tests[i]); ++i) + { + re_set_syntax (tests[i].syntax); + memset (&r, 0, sizeof (r)); + if (re_compile_pattern (tests[i].regex, strlen (tests[i].regex), &r)) + { + printf ("re_compile_pattern %lu failed\n", i); + ret = 1; + continue; + } + size_t len = strlen (tests[i].string); + int rv = re_search (&r, tests[i].string, len, 0, len, NULL); + if (rv != tests[i].retval) + { + printf ("re_search %lu unexpected value %d != %d\n", + i, rv, tests[i].retval); + ret = 1; + } + regfree (&r); + } + return ret; +} diff --git a/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/testsuite/bug-regex7.c b/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/testsuite/bug-regex7.c new file mode 100644 index 0000000..2051985 --- /dev/null +++ b/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/testsuite/bug-regex7.c @@ -0,0 +1,96 @@ +/* Test for regs allocation in re_search and re_match. + Copyright (C) 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Stepan Kasal <kasal@math.cas.cz>, 2002. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301 USA. */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <locale.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/types.h> +#include <regex.h> + + +int +main (void) +{ + struct re_pattern_buffer regex; + struct re_registers regs; + const char *s; + int match, n; + int result = 0; + + memset (®ex, '\0', sizeof (regex)); + regs.start = regs.end = NULL; + regs.num_regs = 0; + s = re_compile_pattern ("a", 1, ®ex); + if (s != NULL) + { + puts ("failed to compile pattern \"a\""); + result = 1; + } + else + { + match = re_search (®ex, "baobab", 6, 0, 6, ®s); + n = 1; + if (match != 1) + { + printf ("re_search returned %d, expected 1\n", match); + result = 1; + } + else if (regs.num_regs <= n || regs.start[n] != -1 || regs.end[n] != -1) + { + puts ("re_search failed to fill the -1 sentinel"); + result = 1; + } + } + + free (regex.buffer); + memset (®ex, '\0', sizeof (regex)); + + s = re_compile_pattern ("\\(\\(\\(a\\)\\)\\)", 13, ®ex); + if (s != NULL) + { + puts ("failed to compile pattern /\\(\\(\\(a\\)\\)\\)/"); + result = 1; + } + else + { + match = re_match (®ex, "apl", 3, 0, ®s); + n = 4; + if (match != 1) + { + printf ("re_match returned %d, expected 1\n", match); + result = 1; + } + else if (regs.num_regs <= n || regs.start[n] != -1 || regs.end[n] != -1) + { + puts ("re_match failed to fill the -1 sentinel"); + result = 1; + } + } + + if (result == 0) + puts (" -> OK"); + + return result; +} diff --git a/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/testsuite/bug-regex8.c b/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/testsuite/bug-regex8.c new file mode 100644 index 0000000..e39ad59 --- /dev/null +++ b/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/testsuite/bug-regex8.c @@ -0,0 +1,88 @@ +/* Test for the STOP parameter of re_match_2 and re_search_2. + Copyright (C) 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Stepan Kasal <kasal@math.cas.cz>, 2002. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301 USA. */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <locale.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/types.h> +#include <regex.h> + + +int +main (void) +{ + struct re_pattern_buffer regex; + const char *s; + int match[4]; + + memset (®ex, '\0', sizeof (regex)); + + s = re_compile_pattern ("xy$", 3, ®ex); + if (s != NULL) + { + puts ("failed to compile pattern \"xy$\""); + return 1; + } + else + match[0] = re_match_2(®ex,"xyz",3,NULL,0,0,NULL,2); + + free (regex.buffer); + memset (®ex, '\0', sizeof (regex)); + + s = re_compile_pattern ("xy\\>", 4, ®ex); + if (s != NULL) + { + puts ("failed to compile pattern \"xy\\>\""); + return 1; + } + else + match[1] = re_search_2(®ex,"xyz",3,NULL,0,0,2,NULL,2); + + free (regex.buffer); + memset (®ex, '\0', sizeof (regex)); + + s = re_compile_pattern ("xy \\<", 5, ®ex); + if (s != NULL) + { + puts ("failed to compile pattern \"xy \\<\""); + return 1; + } + else + { + match[2] = re_match_2(®ex,"xy ",4,NULL,0,0,NULL,3); + match[3] = re_match_2(®ex,"xy z",4,NULL,0,0,NULL,3); + } + + if (match[0] != -1 || match[1] != -1 || match[2] != -1 || match[3] != 3) + { + printf ("re_{match,search}_2 returned %d,%d,%d,%d, expected -1,-1,-1,3\n", + match[0], match[1], match[2], match[3]); + return 1; + } + + puts (" -> OK"); + + return 0; +} diff --git a/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/testsuite/bug-regex9.c b/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/testsuite/bug-regex9.c new file mode 100644 index 0000000..c0e9e18 --- /dev/null +++ b/coreutils-5.3.0-bin/contrib/sed/4.2.1/sed-4.2.1/sed-4.2.1-src/testsuite/bug-regex9.c @@ -0,0 +1,75 @@ +/* Test for memory handling in regex. + Copyright (C) 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2001. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301 USA. */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <sys/types.h> +#ifdef HAVE_MCHECK_H +#include <mcheck.h> +#endif +#include <regex.h> +#include <stdio.h> +#include <stdlib.h> + + +static const char text[] = "#! /bin/sh"; + +int +main (void) +{ + regex_t re; + regmatch_t rm[2]; + int n; + +#ifdef HAVE_MCHECK_H + mtrace (); +#endif + + n = regcomp (&re, "^#! */.*/(k|ba||pdk|z)sh", REG_EXTENDED); + if (n != 0) + { + char buf[500]; + regerror (n, &re, buf, sizeof (buf)); + printf ("regcomp failed: %s\n", buf); + exit (1); + } + + for (n = 0; n < 20; ++n) + { + if (regexec (&re, text, 2, rm, 0)) + { + puts ("regexec failed"); + exit (2); + } + if (rm[0].rm_so != 0 || rm[0].rm_eo != 10 + || rm[1].rm_so != 8 || rm[1].rm_eo != 8) + { + printf ("regexec match failure: %d %d %d %d\n", + rm[0].rm_so, rm[0].rm_eo, rm[1].rm_so, rm[1].rm_eo); + exit (3); + } + } + + regfree (&re); + + return 0; +} |