Back to index

glibc  2.9
Functions | Variables
bug-ftw1.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 result
int cnt
int sawroot

Function Documentation

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

Definition at line 33 of file bug-ftw1.c.

{
  if (++cnt >= 10)
    return 1;

  printf ("%d: \"%s\" -> ", cnt, fname);
  if (strcmp (fname, "/") == 0 && sawroot)
    {
      puts ("root directory reported twice");
      result = 1;
    }
  else if (fname[0] != '/')
    {
      puts ("missing '/' as first character");
      result = 1;
    }
  else if (fname[1] == '/')
    {
      puts ("double '/' at beginning");
      result = 1;
    }
  else
    {
      puts ("OK");
      sawroot |= strcmp (fname, "/") == 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 65 of file bug-ftw1.c.

{
  mtrace ();

  ftw ("/", callback, 10);

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

  return result;
}

Here is the call graph for this function:


Variable Documentation

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

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

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