Small Application C

#include
#include
#include
#include
#include
#include
#define PACKAGE "forvavo"
/* recursion */
void recdir(char *dir);
int main(int argc, char *argv[]) {
if(argc != 2)
fprintf(stderr, "%s [directory]\n", PACKAGE), exit(EXIT_FAILURE);
else {
printf("\n");
printf(" \n");
printf(" favorites\n");
printf(" \n");
printf("\n");
recdir(argv[1]);
printf("\n");
printf("\n");
}
return 0;
}
void recdir(char *dir) {
DIR *dp;
FILE *fp;
char *ptr;
char line[1024];
struct dirent *entry;
struct stat statbuf;
if((dp = opendir(dir)) == NULL) {
fprintf(stderr, "Cannot open directory: %s\n", dir);
return;
}
chdir(dir);
while((entry = readdir(dp)) != NULL) {
stat(entry->d_name, &statbuf);
if(S_ISDIR(statbuf.st_mode)) {
if(strcmp(".", entry->d_name) == 0 || strcmp("..", entry->d_name) == 0)
continue;
printf("\n

%s

\n", entry->d_name);
printf(" \n");
closedir(dp);
}