[wiki] [sites] build-page: tiny code-style and rename of function || Hiltjo Posthuma

From: <git_AT_suckless.org>
Date: Thu, 19 Mar 2020 13:26:25 +0100

commit c947416e8b1b37e6394f64867d553689c4e45076
Author: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
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
_AT_@ -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;
_AT_@ -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))
_AT_@ -227,7 +227,7 @@ last_dir(char *this)
         }
         closedir(dp);
 
- return !dir;
+ return dir;
 }
 
 void
_AT_@ -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(' ');
Received on Thu Mar 19 2020 - 13:26:25 CET

This archive was generated by hypermail 2.3.0 : Thu Mar 19 2020 - 13:36:50 CET