From: David Levine Date: Fri, 29 Aug 2014 13:50:51 +0000 (-0500) Subject: fmt_scan() no longer subtracts 1 from the width. This has the effect X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/e537b780f7aea8df01ddca1976f8c128d9c1fb55?ds=sidebyside;hp=-c fmt_scan() no longer subtracts 1 from the width. This has the effect of no longer counting the trailing newline in the output of scan(1), inc(1), and the other programs that rely on it. --- e537b780f7aea8df01ddca1976f8c128d9c1fb55 diff --git a/docs/pending-release-notes b/docs/pending-release-notes index 81946359..941a13ed 100644 --- a/docs/pending-release-notes +++ b/docs/pending-release-notes @@ -29,3 +29,7 @@ DEPRECATED FEATURES --------- BUG FIXES --------- + +- The format scanner no longer subtracts 1 from the width. This has the + effect of no longer counting the trailing newline in the output of + scan(1), inc(1), and the other programs that rely on the format scanner. diff --git a/sbr/fmt_scan.c b/sbr/fmt_scan.c index 998d3938..47a5fe87 100644 --- a/sbr/fmt_scan.c +++ b/sbr/fmt_scan.c @@ -380,15 +380,8 @@ fmt_scan (struct format *format, charstring_t scanlp, int width, int *dat, struct mailname *mn; /* - * The newline counts in the display width, for backward - * compatibility. To change that so that the newline doesn't - * count, remove the following statement. - */ - --width; - - /* - * max is the same as width, but unsigned. So comparisons - * with charstring_chars() won't raise compile warning. + * max is the same as width, but unsigned so comparisons + * with charstring_chars() won't raise compile warnings. */ max = width; savestr = str = NULL; diff --git a/test/bad-input/test-header b/test/bad-input/test-header index 0666cdb9..1716ff1f 100755 --- a/test/bad-input/test-header +++ b/test/bad-input/test-header @@ -35,7 +35,7 @@ EOF # check scan cat >"$expected" < "$actual" 2>&1 check "$expected" "$actual" @@ -78,7 +78,7 @@ check "$expected" "$actual" msgfile="$MH_TEST_DIR/Mail/inbox/12" printf 'Date: Sat, 12 Jan 2013 09:07:01 -0600\nReceived:' >"$msgfile" cat >"$expected" <"$expected_err" <"$expected" <"$actual" 2>"$actual_err" @@ -127,7 +127,7 @@ Test EOF cat >"$expected" <"$expected_err" <> 13 09/28 Mister Burster Message two<>" @@ -99,8 +99,8 @@ EOF run_prog burst 14 || exit -run_test 'scan -width 80 14-last' \ -" 14 09/29 Test Burst Messag Test digest<> 16 09/28 Mister Burster Message two<> 17 09/28 Mister Burster Message three<>" diff --git a/test/burst/test-burst-mime b/test/burst/test-burst-mime index 46de62aa..9a07c0ab 100755 --- a/test/burst/test-burst-mime +++ b/test/burst/test-burst-mime @@ -37,9 +37,10 @@ EOF run_prog burst 11 -run_test 'scan -width 80 11-last' \ -" 11 09/29 Test Burst Messag Test MIME digest<> 16 09/28 Mister Burster Message two<> 17 09/28 Mister Burster Message three<>" diff --git a/test/dist/test-dist b/test/dist/test-dist index 155f7733..0d0d7b04 100755 --- a/test/dist/test-dist +++ b/test/dist/test-dist @@ -366,7 +366,7 @@ This is message number 1 EOF test_dist 1 -noedit -to somebody@example.com -fcc outbox -run_test 'scan +outbox -width 6' ' 1 ' +run_test 'scan +outbox -width 6' ' 1 ' cat >"$expected" < @@ -382,7 +382,7 @@ This is message number 1 EOF test_dist +inbox 1 -noedit -to somebody@example.com -fcc +outbox -run_test 'scan +outbox -width 6 2' ' 2 ' +run_test 'scan +outbox -width 6 2' ' 2 ' # # Check that dist encodes headers using RFC-2047 properly diff --git a/test/format/test-dp b/test/format/test-dp index fb3cc917..43a39e91 100755 --- a/test/format/test-dp +++ b/test/format/test-dp @@ -105,7 +105,7 @@ check $expected $actual # check -width cat >"$expected" < "$actual" 2>&1 diff --git a/test/inc/test-inc-scanout b/test/inc/test-inc-scanout index 140b54c0..1d814549 100755 --- a/test/inc/test-inc-scanout +++ b/test/inc/test-inc-scanout @@ -191,13 +191,13 @@ EOF run_test "inc -file ${MH_TEST_DIR}/test.mbox -width 120 -truncate" \ "Incorporating new mail into inbox... - 11+ 03/01 Mr Nobody Who is on first?<"$MH_TEST_DIR/mess" <> 9 09/29 Test9 Testing message 9<> 10 09/29 Test10 Testing message 10<> - 11 03/01 Mr Nobody Who is on first?<> 21 09/29 Test9 Testing message 9<> 22 09/29 Test10 Testing message 10<> - 23 03/01 Mr Nobody Who is on first?<>" check "$testmessage" `mhpath +inbox 11` 'keep first' @@ -105,11 +106,13 @@ run_test "inc -user ${TESTUSER} -host 127.0.0.1 -port $testport -width 80 \ -pack $MH_TEST_DIR/inc.mbox" \ "Incorporating new mail into (null)... - 1 12/17 No Such User Hello< "$expected" < "$expected" <"$actual" + LC_ALL=C scan -width 74 last >"$actual" check "$expected" "$actual" fi @@ -133,13 +133,13 @@ else echo "Unsupported width for U+2019: $width" fi -run_prog scan -width 75 last >"$actual" +run_prog scan -width 74 last >"$actual" check "$expected" "$actual" if test "$ICONV_ENABLED" -eq 1; then cat >"$expected" <"${MH_TEST_DIR}/Mail/inbox/13" <