cvs commit: src/usr.bin/sed process.c src/tools/regression/usr.bin/sed regress.c0.out regress.c1.out regress.c2.out regress.c3.out regress.sh

Yar Tikhiy yar at FreeBSD.org
Sun Apr 1 13:25:04 UTC 2007


yar         2007-04-01 13:25:03 UTC

  FreeBSD src repository

  Modified files:
    usr.bin/sed          process.c 
    tools/regression/usr.bin/sed regress.sh 
  Added files:
    tools/regression/usr.bin/sed regress.c0.out regress.c1.out 
                                 regress.c2.out regress.c3.out 
  Log:
  This trivial change should fix at least 3 similar bugs.  All of
  them are related to the `c' function's need to know if we are at
  the actual end of the address range.  (It must print the text not
  earlier than the whole pattern space was deleted.)  It appears the
  only sed function with this requirement.
  
  There is `lastaddr' set by applies(), which is to notify the `c'
  function, but it can't always help because it's false when we are
  hitting the end of file early.  There is also a bug in applies()
  due to which `lastaddr' isn't set to true on degenerate ranges such
  as `$,$' or `N,$' if N appears the last line number.
  
  Handling early EOF condition in applies() could look more logical,
  but it would effectively revert sed to the unreasonable behaviour
  rev. 1.26 of main.c fought against, as it would require lastline()
  be called for each line within each address range.  So it's better
  to call lastline() only if needed by the `c' function.
  
  Together with this change to sed go regression tests for the bugs
  fixed (c1-c3).  A basic test of `c' (c0) is also added as it helped
  me to spot my own error.
  
  Discussed with:         dds
  Tested by:              the regression tests
  MFC after:              1 week
  
  Revision  Changes    Path
  1.1       +4 -0      src/tools/regression/usr.bin/sed/regress.c0.out (new)
  1.1       +4 -0      src/tools/regression/usr.bin/sed/regress.c1.out (new)
  1.1       +3 -0      src/tools/regression/usr.bin/sed/regress.c2.out (new)
  1.1       +3 -0      src/tools/regression/usr.bin/sed/regress.c3.out (new)
  1.12      +13 -1     src/tools/regression/usr.bin/sed/regress.sh
  1.42      +1 -1      src/usr.bin/sed/process.c


More information about the cvs-all mailing list