Introduction
Introduction Statistics Contact Development Disclaimer Help
Split out default filter initialization - noice - small file browser (mirror / …
git clone git://git.codemadness.org/noice
Log
Files
Refs
README
LICENSE
---
commit 45e6fafc4708b10314be3399814c0f07d4ab8e1c
parent dd29e81df5e3aa917bb89d13282c3ba38f458a3f
Author: sin <[email protected]>
Date: Mon, 22 Aug 2016 14:10:14 +0100
Split out default filter initialization
Diffstat:
M noice.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/noice.c b/noice.c
@@ -238,6 +238,12 @@ setfilter(regex_t *regex, char *filter)
return r;
}
+void
+initfilter(int dot, char **ifilter)
+{
+ *ifilter = dot ? "." : "^[^.]";
+}
+
int
visible(regex_t *regex, char *file)
{
@@ -734,7 +740,7 @@ nochange:
goto begin;
case SEL_TOGGLEDOT:
showhidden ^= 1;
- ifilter = showhidden ? "." : "^[^.]";
+ initfilter(showhidden, &ifilter);
strlcpy(fltr, ifilter, sizeof(fltr));
goto begin;
case SEL_MTIME:
@@ -795,11 +801,7 @@ main(int argc, char *argv[])
if (getuid() == 0)
showhidden = 1;
-
- if (showhidden)
- ifilter = ".";
- else
- ifilter = "^[^.]";
+ initfilter(showhidden, &ifilter);
if (argv[1] != NULL) {
ipath = argv[1];
You are viewing proxied material from codemadness.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.