commit c947416e8b1b37e6394f64867d553689c4e45076
Author: Hiltjo Posthuma <[email protected]>
Date:   Thu Mar 19 13:25:45 2020 +0100

    build-page: tiny code-style and rename of function
    
    This version is now running live. Thanks!

diff --git a/build-page.c b/build-page.c
index 1eba1ca9..f21ecb39 100644
--- a/build-page.c
+++ b/build-page.c
@@ -207,7 +207,7 @@ qsort_strcmp(const void *a, const void *b)
 }
 
 int
-last_dir(char *this)
+has_subdirs(char *this)
 {
        DIR *dp;
        struct dirent *de;
@@ -219,7 +219,7 @@ last_dir(char *this)
 
        dir = 0;
        while (dir == 0 && (de = readdir(dp))) {
-               if (*de->d_name == '.')
+               if (de->d_name[0] == '.')
                        continue;
                snprintf(newdir, sizeof(newdir), this ? "%2$s/%1$s" : "%s", 
de->d_name, this);
                if (stat_isdir(newdir))
@@ -227,7 +227,7 @@ last_dir(char *this)
        }
        closedir(dp);
 
-       return !dir;
+       return dir;
 }
 
 void
@@ -275,7 +275,7 @@ menu_panel(char *domain, char *page, char *this, int depth)
                        fputs("/</a>", stdout);
                }
 
-               if (highlight && !last_dir(newdir)) {
+               if (highlight && has_subdirs(newdir)) {
                        putchar('
');
                        for (i = 0; i < depth + 2; ++i)
                                putchar('       ');


Reply via email to