From: molnarl AT cdata DOT tvnet DOT hu Date: Tue, 23 Sep 1997 16:22:43 +0200 (MET DST) To: djgpp-workers AT delorie DOT com Subject: perl and stdio test Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk Perl's Configure script uses this test, to decide whether libc's stdio is "standard". I was a little bit surprised, when I saw that the script wrote that "Your stdio isn't very std.". I looked at libc's source, and found, that _filbuf doesn't convert 0x0d 0x0a -> 0x0a if the file is opened in text mode, but getc() does. Then I found why: there is an optimalization in fseek() which wants the bytes unaltered. I'm just curious, is there another reason why filbuf doesn't make the conversion? -- echo "Checking how std your stdio is..." >&4 $cat >try.c < #define FILE_ptr(fp) (fp)->_ptr #define FILE_cnt(fp) (fp)->_cnt main() { FILE *fp = fopen("try.c", "r"); char c = getc(fp); if ( 18 <= FILE_cnt(fp) && strncmp(FILE_ptr(fp), "include \n", 18) == 0 ) exit(0); exit(1); } EOP val="$undef" if $cc $ccflags $ldflags -o try try.c $libs >/dev/null 2>&1; then if ./try; then echo "Your stdio acts pretty std." val="$define" else echo "Your stdio isn't very std." fi else echo "Your stdio doesn't appear very std." fi