apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Greene <greenecompcons...@cox.net>
Subject apr_file_ungetc question
Date Sat, 20 May 2006 00:44:23 GMT
Once again getting APR 1.2.7 working with OS/2 and Open Watcom, I have a 
failure during testfile. The test is failing at test_ungetc. Part seems 
to be the test and part the OS/2 source. In the test, the file is opened 
APR_READ not APR_READ|APR_WRITE. However, I also need to know exactly 
how apr_file_ungetc should actually work.

1. rewind 1 character
2. write character to stream

The file_datafile.txt contains:

This is the file data file.

As I see testfile, this is the sequence:

1. apr_file_open     <file_datafile.txt>
2. apr_file_getc     <returns T>
3. apr_file_ungetc   <rewind 1 and write 'X'>

file_datafile.txt is now:

Xhis is the file data file.

4. apr_file_getc    <returns h - is this correct?>

I ask the last because of the check:

ABTS_INT_EQUAL(tc, 'X', (int)ch);

which fails because apr_file_getc returns 'h'. Should apr_file_ungetc 
rewind, write char, and rewind again ?

Last, because test_ungetc changes file_datafile.txt it causes 
file_contents_equal to fail which expects file_datafile.txt to be unchanged.

Michael

Mime
View raw message