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 - my solution
Date Sat, 20 May 2006 01:05:31 GMT
--- E:\apr-1.2.7\test\testfile.c        2006-02-09 18:13:38.000000000 -0500
+++ E:\apr-1.2.7_ow\test\testfile.c     2006-05-19 20:50:46.000000000 -0400
@@ -344,23 +344,27 @@
  static void test_ungetc(abts_case *tc, void *data)
  {
      apr_file_t *f = NULL;
+    apr_off_t offset = -1;
      apr_status_t rv;
      char ch;

-    rv = apr_file_open(&f, FILENAME, APR_READ, 0, p);
+    rv = apr_file_open(&f, FILENAME, APR_READ|APR_WRITE, 0, p);
      ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);

-    apr_file_getc(&ch, f);
+    rv = apr_file_getc(&ch, f);
      ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
      ABTS_INT_EQUAL(tc, (int)TESTSTR[0], (int)ch);

-    apr_file_ungetc('X', f);
+    rv = apr_file_ungetc('X', f);
      ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);

-    apr_file_getc(&ch, f);
+    apr_file_seek(f, APR_CUR, &offset);
+    rv = apr_file_getc(&ch, f);
      ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
      ABTS_INT_EQUAL(tc, 'X', (int)ch);

+    apr_file_ungetc('T', f);
+
      apr_file_close(f);
  }

Mime
View raw message