num_files: Variable declarations at top of block
This commit is contained in:
parent
dcffaeaf57
commit
0a287616b2
@ -11,13 +11,14 @@ num_files(const char *dir)
|
||||
{
|
||||
struct dirent *dp;
|
||||
DIR *fd;
|
||||
int num = 0;
|
||||
int num;
|
||||
|
||||
if (!(fd = opendir(dir))) {
|
||||
fprintf(stderr, "opendir '%s': %s\n", dir, strerror(errno));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
num = 0;
|
||||
while ((dp = readdir(fd))) {
|
||||
if (!strcmp(dp->d_name, ".") || !strcmp(dp->d_name, "..")) {
|
||||
continue; /* skip self and parent */
|
||||
|
Loading…
Reference in New Issue
Block a user