1#!/bin/sh 2# Copyright (C) 2021-2023 Free Software Foundation, Inc. 3 4# This program is free software: you can redistribute it and/or modify 5# it under the terms of the GNU General Public License as published by 6# the Free Software Foundation, either version 3 of the License, or 7# (at your option) any later version. 8 9# This program is distributed in the hope that it will be useful, 10# but WITHOUT ANY WARRANTY; without even the implied warranty of 11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12# GNU General Public License for more details. 13 14# You should have received a copy of the GNU General Public License 15# along with this program. If not, see <https://www.gnu.org/licenses/>. 16 17. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src 18print_ver_ cat 19 20# \r followed by \n is displayed as ^M$ 21# Up to and including 8.32 the $ would have displayed at the start of the line 22# overwriting the first character 23printf 'a\rb\r\nc\n\r\nd\r' > 'in' || framework_failure_ 24printf 'a\rb^M$\nc$\n^M$\nd\r' > 'exp' || framework_failure_ 25cat -E 'in' > out || fail=1 26compare exp out || fail=1 27 28# Ensure \r\n spanning files (or buffers) is handled 29printf '1\r' > in2 || framework_failure_ 30printf '\n2\r\n' > in2b || framework_failure_ 31printf '1^M$\n2^M$\n' > 'exp' || framework_failure_ 32cat -E 'in2' 'in2b' > out || fail=1 33compare exp out || fail=1 34 35# Ensure \r at end of buffer is handled 36printf '1\r' > in2 || framework_failure_ 37printf '2\r\n' > in2b || framework_failure_ 38printf '1\r2^M$\n' > 'exp' || framework_failure_ 39cat -E 'in2' 'in2b' > out || fail=1 40compare exp out || fail=1 41 42Exit $fail 43