From: Tim Kientzle Date: Mon, 28 Dec 2009 00:00:45 +0000 (-0500) Subject: Be more tolerant of end-of-line variations. X-Git-Tag: v2.8.0~43 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2db62fd65ca4b9e8e78306a69420eaf066c065b1;p=thirdparty%2Flibarchive.git Be more tolerant of end-of-line variations. SVN-Revision: 1782 --- diff --git a/cpio/test/test_option_version.c b/cpio/test/test_option_version.c index 722b600c5..7345da1e5 100644 --- a/cpio/test/test_option_version.c +++ b/cpio/test/test_option_version.c @@ -74,14 +74,14 @@ verify(const char *p, size_t s) /* Skip a single trailing a,b,c, or d. */ if (*q == 'a' || *q == 'b' || *q == 'c' || *q == 'd') ++q; - /* All terminated by a newline. */ + /* All terminated by end-of-line: \r, \r\n, or \n */ assert(s >= 1); failure("Version: %s", p); -#if defined(_WIN32) && !defined(__CYGWIN__) - assertEqualMem(q, "\x0d\x0a", 2); -#else - assertEqualMem(q, "\x0a", 1); -#endif + if (*q == '\x0d') { + if (q[1] != '\0') + assertEqualMem(q, "\x0d\x0a", 2); + } else + assertEqualMem(q, "\x0a", 1); }