of no longer counting the trailing newline in the output of scan(1),
inc(1), and the other programs that rely on it.
---------
BUG FIXES
---------
---------
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.
- * 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;
*/
max = width;
savestr = str = NULL;
# check scan
cat >"$expected" <<EOF
# check scan
cat >"$expected" <<EOF
- 11 12/18 foo@example.edu test<<This is a multi-part message in MIME forma
+ 11 12/18 foo@example.edu test<<This is a multi-part message in MIME format
EOF
run_prog scan -width 80 last > "$actual" 2>&1
check "$expected" "$actual"
EOF
run_prog scan -width 80 last > "$actual" 2>&1
check "$expected" "$actual"
msgfile="$MH_TEST_DIR/Mail/inbox/12"
printf 'Date: Sat, 12 Jan 2013 09:07:01 -0600\nReceived:' >"$msgfile"
cat >"$expected" <<EOF
msgfile="$MH_TEST_DIR/Mail/inbox/12"
printf 'Date: Sat, 12 Jan 2013 09:07:01 -0600\nReceived:' >"$msgfile"
cat >"$expected" <<EOF
EOF
cat >"$expected_err" <<EOF
scan: eof encountered in field "Received"
EOF
cat >"$expected_err" <<EOF
scan: eof encountered in field "Received"
ThisHeaderFieldNameIsWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaayTooLong: OK
EOF
cat >"$expected" <<EOF
EOF
run_prog scan -width 13 last >"$actual" 2>"$actual_err"
EOF
run_prog scan -width 13 last >"$actual" 2>"$actual_err"
EOF
cat >"$expected" <<EOF
EOF
cat >"$expected" <<EOF
EOF
cat >"$expected_err" <<EOF
scan: eol encountered in field "If a header field name has at least 512 characters without a newline or colon, it will raise a format error in m_getfld(). Here is a test of that. 01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901"
EOF
cat >"$expected_err" <<EOF
scan: eol encountered in field "If a header field name has at least 512 characters without a newline or colon, it will raise a format error in m_getfld(). Here is a test of that. 01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901"
run_prog burst 11 || exit
run_prog burst 11 || exit
-run_test 'scan -width 80 11-last' \
-" 11 09/29 Test Burst Messag Test digest<<------- Message one From: Mister Bu
+run_test 'scan -width 80 11-last' "\
+ 11 09/29 Test Burst Messag Test digest<<------- Message one From: Mister Bur
12+ 09/28 Mister Burster Message one<<This is message one >>
13 09/28 Mister Burster Message two<<This is message two For real. >>"
12+ 09/28 Mister Burster Message one<<This is message one >>
13 09/28 Mister Burster Message two<<This is message two For real. >>"
run_prog burst 14 || exit
run_prog burst 14 || exit
-run_test 'scan -width 80 14-last' \
-" 14 09/29 Test Burst Messag Test digest<<This is a preamble ------- Message
+run_test 'scan -width 80 14-last' "\
+ 14 09/29 Test Burst Messag Test digest<<This is a preamble ------- Message o
15+ 09/28 Mister Burster Message one<<-This is message one >>
16 09/28 Mister Burster Message two<<This is message two For real. >>
17 09/28 Mister Burster Message three<<Will this one work? >>"
15+ 09/28 Mister Burster Message one<<-This is message one >>
16 09/28 Mister Burster Message two<<This is message two For real. >>
17 09/28 Mister Burster Message three<<Will this one work? >>"
-run_test 'scan -width 80 11-last' \
-" 11 09/29 Test Burst Messag Test MIME digest<<From: Mister Burster <burst2@e
- 12+ 09/28 Mister Burster Message one<<- - This line should not be unstuff"
+run_test 'scan -width 80 11-last' "\
+ 11 09/29 Test Burst Messag Test MIME digest<<From: Mister Burster <burst2@ex
+ 12+ 09/28 Mister Burster Message one<<- - This line should not be unstuff\
+e"
#
# Create another test message that does multipart/digest checking
#
# Create another test message that does multipart/digest checking
run_prog burst 14 || exit
run_prog burst 14 || exit
-run_test 'scan -width 80 14-last' \
-" 14 09/29 Test Burst Messag Test digest<<This is a preamble ------- =_aaaaaa
+run_test 'scan -width 80 14-last' "\
+ 14 09/29 Test Burst Messag Test digest<<This is a preamble ------- =_aaaaaaa
15+ 09/28 Mister Burster Message one<<- -This is message one >>
16 09/28 Mister Burster Message two<<This is message two - For real.>>
17 09/28 Mister Burster Message three<<Will this one work? >>"
15+ 09/28 Mister Burster Message one<<- -This is message one >>
16 09/28 Mister Burster Message two<<This is message two - For real.>>
17 09/28 Mister Burster Message three<<Will this one work? >>"
EOF
test_dist 1 -noedit -to somebody@example.com -fcc outbox
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" <<EOF
From: Test1 <test1@example.com>
cat >"$expected" <<EOF
From: Test1 <test1@example.com>
EOF
test_dist +inbox 1 -noedit -to somebody@example.com -fcc +outbox
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
#
# Check that dist encodes headers using RFC-2047 properly
# check -width
cat >"$expected" <<EOF
# check -width
cat >"$expected" <<EOF
EOF
run_prog $dp -width 17 'Sun Jul 1 2012' > "$actual" 2>&1
EOF
run_prog $dp -width 17 'Sun Jul 1 2012' > "$actual" 2>&1
run_test "inc -file ${MH_TEST_DIR}/test.mbox -width 120 -truncate" \
"Incorporating new mail into inbox...
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?<<Abbott: Every dollar of it. And why not, the man's entitled to it. Cos"
+ 11+ 03/01 Mr Nobody Who is on first?<<Abbott: Every dollar of it. And why not, the man's entitled to it. Cost"
check `mhpath +inbox 11` "${MH_TEST_DIR}/test.mbox.2" "keep first"
rm -f "${MH_TEST_DIR}/test.mbox" "${MH_TEST_DIR}/test.mbox.2"
run_test "scan -width 120 +inbox 11" \
check `mhpath +inbox 11` "${MH_TEST_DIR}/test.mbox.2" "keep first"
rm -f "${MH_TEST_DIR}/test.mbox" "${MH_TEST_DIR}/test.mbox.2"
run_test "scan -width 120 +inbox 11" \
- " 11+ 03/01 Mr Nobody Who is on first?<<Abbott: Every dollar of it. And why not, the man's entitled to it. Cos"
+ " 11+ 03/01 Mr Nobody Who is on first?<<Abbott: Every dollar of it. And why not, the man's entitled to it. Cost"
# check header field name with ':' character than lands on m_getfld() buffer
cat >"$MH_TEST_DIR/mess" <<EOF
# check header field name with ':' character than lands on m_getfld() buffer
cat >"$MH_TEST_DIR/mess" <<EOF
8 09/29 Test8 Testing message 8<<This is message number 8 >>
9 09/29 Test9 Testing message 9<<This is message number 9 >>
10 09/29 Test10 Testing message 10<<This is message number 10 >>
8 09/29 Test8 Testing message 8<<This is message number 8 >>
9 09/29 Test9 Testing message 9<<This is message number 9 >>
10 09/29 Test10 Testing message 10<<This is message number 10 >>
- 11 03/01 Mr Nobody Who is on first?<<Abbott: Every dollar of it. An
+ 11 03/01 Mr Nobody Who is on first?<<Abbott: Every dollar of it. And
12 12/18 foo@example.edu test'
run_test "inc -width 80 -file $MH_TEST_DIR/msgbox -truncate" \
'Incorporating new mail into inbox...
12 12/18 foo@example.edu test'
run_test "inc -width 80 -file $MH_TEST_DIR/msgbox -truncate" \
'Incorporating new mail into inbox...
20 09/29 Test8 Testing message 8<<This is message number 8 >>
21 09/29 Test9 Testing message 9<<This is message number 9 >>
22 09/29 Test10 Testing message 10<<This is message number 10 >>
20 09/29 Test8 Testing message 8<<This is message number 8 >>
21 09/29 Test9 Testing message 9<<This is message number 9 >>
22 09/29 Test10 Testing message 10<<This is message number 10 >>
- 23 03/01 Mr Nobody Who is on first?<<Abbott: Every dollar of it. An
+ 23 03/01 Mr Nobody Who is on first?<<Abbott: Every dollar of it. And
24 12/18 foo@example.edu test'
rm -f "$MH_TEST_DIR/msgbox"
24 12/18 foo@example.edu test'
rm -f "$MH_TEST_DIR/msgbox"
run_test "inc -user ${TESTUSER} -host 127.0.0.1 -port $testport -width 80" \
"Incorporating new mail into inbox...
run_test "inc -user ${TESTUSER} -host 127.0.0.1 -port $testport -width 80" \
"Incorporating new mail into inbox...
- 11+ 12/17 No Such User Hello<<Hey man, how's it going? . Hope you're do"
+ 11+ 12/17 No Such User Hello<<Hey man, how's it going? . Hope you're do\
+i"
check "$testmessage" `mhpath +inbox 11` 'keep first'
# Check multiple messages at once
check "$testmessage" `mhpath +inbox 11` 'keep first'
# Check multiple messages at once
run_test "inc -user ${TESTUSER} -host 127.0.0.1 -port $testport -width 80" \
"Incorporating new mail into inbox...
run_test "inc -user ${TESTUSER} -host 127.0.0.1 -port $testport -width 80" \
"Incorporating new mail into inbox...
- 11+ 12/17 No Such User Hello<<Hey man, how's it going? . Hope you're do
- 12 12/18 A Real User Anything new?<<What's been happening at your pla
+ 11+ 12/17 No Such User Hello<<Hey man, how's it going? . Hope you're doi
+ 12 12/18 A Real User Anything new?<<What's been happening at your plac
13 12/19 Nathan Explosion Brutal<<Dude, nmh is totally brutal. >>"
check "$testmessage" `mhpath +inbox 11` 'keep first'
13 12/19 Nathan Explosion Brutal<<Dude, nmh is totally brutal. >>"
check "$testmessage" `mhpath +inbox 11` 'keep first'
-pack $MH_TEST_DIR/inc.mbox" \
"Incorporating new mail into (null)...
-pack $MH_TEST_DIR/inc.mbox" \
"Incorporating new mail into (null)...
- 1 12/17 No Such User Hello<<Hey man, how's it going? . Hope you're do"
+ 1 12/17 No Such User Hello<<Hey man, how's it going? . Hope you're do\
+i"
run_test "inc -file $MH_TEST_DIR/inc.mbox -truncate -width 80" \
"Incorporating new mail into inbox...
run_test "inc -file $MH_TEST_DIR/inc.mbox -truncate -width 80" \
"Incorporating new mail into inbox...
- 11+ 12/17 No Such User Hello<<Hey man, how's it going? . Hope you're do"
+ 11+ 12/17 No Such User Hello<<Hey man, how's it going? . Hope you're do\
+i"
check $testmessage `mhpath +inbox 11` 'keep first'
rm -f "$MH_TEST_DIR/inc.mbox" "$MH_TEST_DIR/.inc.map" "$netrc"
check $testmessage `mhpath +inbox 11` 'keep first'
rm -f "$MH_TEST_DIR/inc.mbox" "$MH_TEST_DIR/.inc.map" "$netrc"
-pack $MH_TEST_DIR/inc.mbox" \
"Incorporating new mail into (null)...
-pack $MH_TEST_DIR/inc.mbox" \
"Incorporating new mail into (null)...
- 1 12/17 No Such User Hello<<Hey man, how's it going? ." </dev/null
+ 1 12/17 No Such User Hello<<Hey man, how's it going? . " </dev/null
run_test "inc -file $MH_TEST_DIR/inc.mbox -truncate -width 65" \
"Incorporating new mail into inbox...
run_test "inc -file $MH_TEST_DIR/inc.mbox -truncate -width 65" \
"Incorporating new mail into inbox...
- 11+ 12/17 No Such User Hello<<Hey man, how's it going? ." </dev/null
+ 11+ 12/17 No Such User Hello<<Hey man, how's it going? . " </dev/null
check $testmessage `mhpath +inbox 11`
rm -f "$MH_TEST_DIR/inc.mbox" "$MH_TEST_DIR/.inc.map" "$netrc"
check $testmessage `mhpath +inbox 11`
rm -f "$MH_TEST_DIR/inc.mbox" "$MH_TEST_DIR/.inc.map" "$netrc"
run_test "inc -notruncate -width 80 -file $testmessage" \
"Incorporating new mail into inbox...
run_test "inc -notruncate -width 80 -file $testmessage" \
"Incorporating new mail into inbox...
- 11+ 12/17 No Such User Hello, how are you?<<This is a test; will it wor
+ 11+ 12/17 No Such User Hello, how are you?<<This is a test; will it work
$testmessage not zero'd"
rmm 11
$testmessage not zero'd"
rmm 11
if test "$width" -eq 3; then
cat > "$expected" <<EOF
if test "$width" -eq 3; then
cat > "$expected" <<EOF
- 11 03/02 David st Hubbins Spın̈al Tap → Tap into America!<<Things are look
+ 11 03/02 David st Hubbins Spın̈al Tap → Tap into America!<<Things are looki
EOF
elif test "$width" -eq 2; then
cat > "$expected" <<EOF
EOF
elif test "$width" -eq 2; then
cat > "$expected" <<EOF
- 11 03/02 David st Hubbins Spın̈al Tap → Tap into America!<<Things are looki
+ 11 03/02 David st Hubbins Spın̈al Tap → Tap into America!<<Things are lookin
EOF
else
echo "Unsupported width for UTF-8 test string: $width"
EOF
else
echo "Unsupported width for UTF-8 test string: $width"
EOF
# Don't use run_prog here because it loses the environment setting.
EOF
# Don't use run_prog here because it loses the environment setting.
- LC_ALL=C scan -width 75 last >"$actual"
+ LC_ALL=C scan -width 74 last >"$actual"
check "$expected" "$actual"
fi
check "$expected" "$actual"
fi
echo "Unsupported width for U+2019: $width"
fi
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" <<EOF
check "$expected" "$actual"
if test "$ICONV_ENABLED" -eq 1; then
cat >"$expected" <<EOF
- 13 01/13 sender@example.co <<The Subject: is an encoded single quote, 0x92.
+ 13 01/13 sender@example.co <<The Subject: is an encoded single quote, 0x92.
EOF
cat >"${MH_TEST_DIR}/Mail/inbox/13" <<EOF
EOF
cat >"${MH_TEST_DIR}/Mail/inbox/13" <<EOF