testdir -- basic test for C library directory access routines
last edit: 25-Apr-1987 D A Gwyn
register struct dirent
*dp
;
int nerrs
= 0; /* total not found */
if ( (dirp
= opendir( "." )) == NULL
)
(void)fprintf( stderr
, "Cannot open \".\" directory\n" );
while (dp
= readdir (dirp
))
printf ("ino=%d len=%d name=\"%s\"\n",
dp
-> d_ino
, strlen (dp
-> d_name
), dp
-> d_name
);
while ( (dp
= readdir( dirp
)) != NULL
)
if ( strcmp( dp
->d_name
, *argv
) == 0 )
(void)printf( "\"%s\" found.\n", *argv
);
(void)printf( "\"%s\" not found.\n", *argv
);