Back to index

glibc  2.9
Defines | Functions
bug19.c File Reference
#include <assert.h>
#include <errno.h>
#include <stdio.h>
#include "../test-skeleton.c"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


#define CHAR   char
#define L(str)   str
#define FPUTS   fputs
#define FSCANF   fscanf
#define TEST_FUNCTION   do_test ()


static int do_test (void)

Define Documentation

#define CHAR   char

Definition at line 6 of file bug19.c.

#define FPUTS   fputs

Definition at line 8 of file bug19.c.

#define FSCANF   fscanf

Definition at line 9 of file bug19.c.

#define L (   str)    str

Definition at line 7 of file bug19.c.

#define TEST_FUNCTION   do_test ()

Definition at line 57 of file bug19.c.

Function Documentation

static int do_test ( void  ) [static]

Definition at line 14 of file bug19.c.

  FILE *fp = tmpfile ();
  if (fp == NULL)
      puts ("cannot open file");
      return 1;

  FPUTS (L("7-11"), fp);
  rewind (fp);

  printf("setting errno to EINTR\n");
  errno = EINTR;

  printf("checking sscanf\n");

  int i, j, n;

  i = j = n = 0;
  FSCANF (fp, L(" %i - %i %n"), &i, &j, &n);
  printf ("found %i-%i (length=%i)\n", i, j, n);

  int result = 0;
  if (i != 7)
      printf ("i is %d, expected 7\n", i);
      result = 1;
  if (j != 11)
      printf ("j is %d, expected 11\n", j);
      result = 1;
  if (n != 4)
      printf ("n is %d, expected 4\n", j);
      result = 1;

  return result;

Here is the call graph for this function: