Back to index

glibc  2.9
Defines | Functions | Variables
tst-ext2.c File Reference
#include <stdio.h>
#include <stdio_ext.h>
#include "../test-skeleton.c"

Go to the source code of this file.

Defines

#define PREPARE(argc, argv)
#define TEST_FUNCTION   do_test ()

Functions

static int do_test (void)

Variables

static char * fname

Define Documentation

#define PREPARE (   argc,
  argv 
)
Value:
do {                                                           \
    int fd = create_temp_file ("tst-ext2", &fname);                   \
    if (fd == -1)                                              \
      {                                                               \
       puts ("cannot create temporary file");                         \
       exit (1);                                               \
      }                                                               \
    close (fd);                                                       \
  } while (0)

Definition at line 7 of file tst-ext2.c.

#define TEST_FUNCTION   do_test ()

Definition at line 57 of file tst-ext2.c.


Function Documentation

static int do_test ( void  ) [static]

Definition at line 20 of file tst-ext2.c.

{
  int res = 0;

  FILE *fp;

  fp = fopen (fname, "w");
  printf ("Initial state for write-only stream: %d %d\n",
          __freading (fp) != 0, __fwriting (fp) != 0);
  res |= ((__freading (fp) != 0) != 0
         || (__fwriting (fp) != 0) != 1);
  fclose (fp);

  fp = fopen (fname, "r");
  printf ("Initial state for read-only stream:  %d %d\n",
          __freading (fp) != 0, __fwriting (fp) != 0);
  res |= ((__freading (fp) != 0) != 1
         || (__fwriting (fp) != 0) != 0);
  fclose (fp);

  fp = fopen (fname, "r+");
  printf ("Initial state for read-write stream: %d %d\n",
          __freading (fp) != 0, __fwriting (fp) != 0);
  res |= ((__freading (fp) != 0) != 0
         || (__fwriting (fp) != 0) != 0);
  fclose (fp);

  fp = fopen (fname, "w+");
  printf ("Initial state for read-write stream: %d %d\n",
          __freading (fp) != 0, __fwriting (fp) != 0);
  res |= ((__freading (fp) != 0) != 0
         || (__fwriting (fp) != 0) != 0);
  fclose (fp);

  return res;
}

Here is the call graph for this function:


Variable Documentation

char* fname [static]

Definition at line 5 of file tst-ext2.c.