------ sed 3.02 ------ * configure.in: Because of code change in 3.01a, bump the minor revision number for the release (now 3.02). ------ sed 3.01a ------ Sun Jul 26 16:07:55 PDT 1998 Ken Pizzini * 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. ------ sed 3.01 ***RELEASE VERSION*** ------ Tue Jul 21 06:04:42 PDT 1998 Ken Pizzini * 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 * djgpp/config.btm: New file to support the 4DOS alternative to command.com. (Sumitted by Eli Zaretskii on behalf of an anonymous 4DOS user.) ------ sed 3.01-beta18 ------ Fri Jul 17 00:36:34 PDT 1998 Ken Pizzini * djgpp/config.sed: my "tweak" in beta17 was too hastily considered. Back it out. * configure.in: update to beta18. ------ sed 3.01-beta17 ------ Wed Jul 15 01:02:15 PDT 1998 Ken Pizzini * djgpp/config.sed: tweak/simplify s,,, commands at end. * configure.in: update to beta17. 1998-07-14 Eli Zaretskii * 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. ------ sed 3.01-beta16 ------ Thu Jul 9 13:06:00 PDT 1998 16:51:43 PDT 1998 Ken Pizzini * 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 * 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. ------ sed 3.01-beta15 ------ Sun Jul 5 21:02:16 PDT 1998 Ken Pizzini * 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 * sed/compile.c(bad_prog): add more detail to error messages about -e strings. Sun Jul 5 14:29:45 PDT 1998 Ken Pizzini * 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. ------ sed 3.01-beta14 ------ Sat Jul 4 09:54:45 PDT 1998 Ken Pizzini * sed/basicdefs.h, sed/compile.c, sed/execute.c: per report by "Kaveh R. Ghazi" , 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. ------ sed 3.01-beta13 ------ Thu Jul 2 23:46:13 PDT 1998 Ken Pizzini * 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 ". * 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 , depending on the value passed to configure's --with-regex= option. Thu Jul 2 17:22:31 PDT 1998 Ken Pizzini * 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 ). * 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 .) * testsuite/dc.good, testsuite/dc.inp: per suggestion from Greg Ubben , use base 16 output to exercise even more of the dc.sed script. * configure.in, testsuite/version.good: update to beta13. ------ sed 3.01-beta12 ------ Sun Jun 28 16:21:02 PDT 1998 Ken Pizzini * 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 . * dc.sed, testsuite/Makefile.in, testsuite/dc.inp, testsuite/dc.good: added this remarkable script, written and contributed by Greg Ubben , 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. ------ sed 3.01-beta11 ------ Fri Jun 12 16:41:48 PDT 1998 Ken Pizzini * 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 * 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 * 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. ------ sed 3.01-beta10 ------ Fri Jun 5 00:54:25 PDT 1998 Ken Pizzini * 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 * sed/compile.c(snarf_char_class): added code to recognize \n or \ sequence within a char-class as the newline character. Tue Jun 2 11:56:02 PDT 1998 Ken Pizzini * configure.in: added check for 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 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 * 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. ------ sed 3.01-beta9 ------ Sat May 30 17:28:00 PDT 1998 Ken Pizzini * 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 * 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 * 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 * 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 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. ------ sed 3.01-beta8 ------ Sat May 23 20:04:31 HST 1998 Ken Pizzini * 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 * 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. ------ sed 3.01-beta7 ------ Sat May 23 16:07:09 HST 1998 Ken Pizzini * sed/execute.c: #undef'd EXPERIMENTAL_DASH_N_OPTIMIZATION because its code is buggy. Tue May 19 17:03:52 HST 1998 Ken Pizzini * 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 * 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. ------ sed 3.01-beta6 ------ Wed May 13 21:44:28 PDT 1998 Ken Pizzini * lib/Makefile.am: fix spelling of libsed_a_LIBADD in libsed_a_DEPENDENCIES. * configure.in, testsuite/version.good: update to beta6. ------ sed 3.01-beta5 ------ Wed May 13 14:38:08 PDT 1998 Ken Pizzini * 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 for the bug report.] Wed May 13 13:54:04 PDT 1998 Ken Pizzini * 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. ------ sed 3.01-beta4 ------ Wed May 13 06:39:06 PDT 1998 Ken Pizzini * rename writeout.good? to wrtout?.good and subwrite.good? to subwrt?.good to comply with DOS 8+3 file name restrictions. [Eli Zaretskii 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 * 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 * 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. ------ sed 3.01-beta3 ------ Mon May 11 18:50:56 PDT 1998 Ken Pizzini * sed/Makefile.am: fix INCLUDES to work right with VPATH. [Thanks to Jim Meyering 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. ------ sed 3.01-beta2 ------ Sat May 9 22:35:45 PDT 1998 Ken Pizzini * sed/sed.c: add #include in HAVE_MMAP block (needed on some machines). * lib/memmove.c: #include , if HAVE_MEMORY_H. Sat May 9 21:29:00 PDT 1998 Ken Pizzini * 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. ------ sed 3.01-beta1 ------ Fri May 8 15:08:28 PDT 1998 Ken Pizzini * 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 * doc/sed.1, doc/Makefile.am: wrote (very basic) man page. Thu May 7 20:40:21 PDT 1998 Ken Pizzini * 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 * 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 * 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 * 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 * 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 * 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 * 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 for the bug report.) Wed Apr 15 11:35:31 PDT 1998 Ken Pizzini * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 Thu Aug 14 17:43:27 PDT 1997 Ken Pizzini * utils.c (ck_fclose): modified to ignore NULL parameter. Thu Aug 14 12:08:45 PDT 1997 Ken Pizzini * execute.c: tweaked execute_program() to eliminate gratuitous "goto" usage. Thu Aug 14 11:30:04 PDT 1997 Ken Pizzini * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * sed.c, utils.c, utils.h: de-linting oriented cleanup. Sun Jul 13 00:46:48 PDT 1997 Ken Pizzini * 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. ------ sed 3.00 ------ Sat Dec 30 20:16:59 1995 Tom Lord * sed.c: Use posix entry points to regexp functions. Fix enough bugs to pass the test-suite. ....... Jason Molenda * testsuite/: trippy test suite. ------ sed 2.05 ------ Wed May 11 07:46:24 1994 Chip Salzenberg (chip@fin.uucp) * sed.c (compile_address): Recognize numeric addresses. Fixes typo made during installation of "~" feature. ------ sed 2.04 ------ Sat Apr 30 17:17:38 1994 Tom Lord (lord@x1.cygnus.com) * 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. ------ sed 2.03 ------ Sat Aug 7 01:04:59 1993 Tom Lord (lord@unix7.andrew.cmu.edu) * sed.c (compile_regex): report error messages for bogus regexps. SEE ALSO: ChangeLog.rx ------ no version information ------ 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 * sed.c: added new tests of no_default_output to make -n work. Thanks Andrew Herbert * sed.c, configure.in,Makefile.in: autoconfed bcopy and const. Thanks "J.T. Conklin" * 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: