Back to index

glibc  2.9
Functions | Variables
bug-ftw2.c File Reference
#include <ftw.h>
#include <mcheck.h>
#include <stdio.h>
#include <string.h>

Go to the source code of this file.

Functions

static int callback (const char *fname, const struct stat *st, int flag)
int main (void)

Variables

int cnt
int result
int sawown
int sawcur

Function Documentation

static int callback ( const char *  fname,
const struct stat st,
int  flag 
) [static]

Definition at line 34 of file bug-ftw2.c.

{
  printf ("%d: \"%s\" -> ", ++cnt, fname);
  if (strcmp (fname, ".") == 0 && sawcur)
    {
      puts ("current directory reported twice");
      result = 1;
    }
  else if (strcmp (fname, "./bug-ftw2.c") == 0 && sawown)
    {
      puts ("source file reported twice");
      result = 1;
    }
  else if (fname[0] != '.')
    {
      puts ("missing '.' as first character");
      result = 1;
    }
  else if (fname[1] != '\0' && fname[1] != '/')
    {
      puts ("no '/' in second position");
      result = 1;
    }
  else
    {
      puts ("OK");
      sawcur |= strcmp (fname, ".") == 0;
      sawown |= strcmp (fname, "./bug-ftw2.c") == 0;
    }

  return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int main ( void  )

Definition at line 69 of file bug-ftw2.c.

{
  mtrace ();

  ftw (".", callback, 10);

  if (! sawcur)
    {
      puts ("current directory wasn't reported");
      result = 1;
    }

  if (! sawown)
    {
      puts ("source file wasn't reported");
      result = 1;
    }

  return result;
}

Here is the call graph for this function:


Variable Documentation

Definition at line 27 of file bug-ftw2.c.

Definition at line 28 of file bug-ftw2.c.

Definition at line 30 of file bug-ftw2.c.

Definition at line 29 of file bug-ftw2.c.