25 lines
458 B
C
25 lines
458 B
C
#include <stdio.h>
|
|
#include <dirent.h>
|
|
|
|
int
|
|
filter(const struct dirent *p)
|
|
{
|
|
int len;
|
|
len = strlen(p->d_name);
|
|
if (len > 2 && strcmp(p->d_name + len - 2, ".h") == 0)
|
|
return 1;
|
|
else if (len > 4 && strcmp(p->d_name + len - 4, ".cpp") == 0)
|
|
return 1;
|
|
else
|
|
return 0;
|
|
}
|
|
|
|
main()
|
|
{
|
|
int i, n, x;
|
|
struct dirent **p;
|
|
n = scandir(".", &p, filter, alphasort);
|
|
for (i = 0; i < n; i++)
|
|
printf("<a href=\"%s\">%s</a><br>\n", p[i]->d_name, p[i]->d_name);
|
|
}
|