summaryrefslogtreecommitdiffstats
path: root/dmenu_path.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--dmenu_path.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/dmenu_path.c b/dmenu_path.c
index 1575f1d..15d0da0 100644
--- a/dmenu_path.c
+++ b/dmenu_path.c
@@ -8,22 +8,21 @@
#define CACHE ".dmenu_cache"
-static int qstrcmp(const void *a, const void *b);
static void die(const char *s);
+static int qstrcmp(const void *a, const void *b);
static void scan(void);
static int uptodate(void);
static char **items = NULL;
-static const char *Home, *Path;
-static size_t count = 0;
+static const char *home, *path;
int
main(void) {
- if(!(Home = getenv("HOME")))
+ if(!(home = getenv("HOME")))
die("no $HOME");
- if(!(Path = getenv("PATH")))
+ if(!(path = getenv("PATH")))
die("no $PATH");
- if(chdir(Home) < 0)
+ if(chdir(home) < 0)
die("chdir failed");
if(uptodate()) {
execlp("cat", "cat", CACHE, NULL);
@@ -47,15 +46,16 @@ qstrcmp(const void *a, const void *b) {
void
scan(void) {
char buf[PATH_MAX];
- char *dir, *path;
- size_t i;
+ char *dir, *p;
+ size_t i, count;
struct dirent *ent;
DIR *dp;
FILE *cache;
- if(!(path = strdup(Path)))
+ count = 0;
+ if(!(p = strdup(path)))
die("strdup failed");
- for(dir = strtok(path, ":"); dir; dir = strtok(NULL, ":")) {
+ for(dir = strtok(p, ":"); dir; dir = strtok(NULL, ":")) {
if(!(dp = opendir(dir)))
continue;
while((ent = readdir(dp))) {
@@ -79,23 +79,23 @@ scan(void) {
fprintf(stdout, "%s\n", items[i]);
}
fclose(cache);
- free(path);
+ free(p);
}
int
uptodate(void) {
- char *dir, *path;
+ char *dir, *p;
time_t mtime;
struct stat st;
if(stat(CACHE, &st) < 0)
return 0;
mtime = st.st_mtime;
- if(!(path = strdup(Path)))
+ if(!(p = strdup(path)))
die("strdup failed");
- for(dir = strtok(path, ":"); dir; dir = strtok(NULL, ":"))
+ for(dir = strtok(p, ":"); dir; dir = strtok(NULL, ":"))
if(!stat(dir, &st) && st.st_mtime > mtime)
return 0;
- free(path);
+ free(p);
return 1;
}
ht'> These variables make it simpler to change the paths to this for ports. `pkg-config` is avoided because it sucks, in particular for cross-compilation. A commented path for *BSD is added, the Xft includes are located at: /usr/X11R6/include there. Also already bump the version number to 4.6, a release will come approximately in August. 2015-07-19fix prompt color style how it used to beGravatar Hiltjo Posthuma 1-1/+1 This is the style how it was before the big Xft change. The colors were inverted, this was not the case before the change. Reported by "zvz" on #suckless IRC, thanks! 2015-06-27Use libdraw: add Xft and fallback-fonts support to graphics libGravatar Hiltjo Posthuma 11-316/+684 - libdraw, util: add drw.{c,h}, util.{c,h} and update code. - libdraw: fix drw_rect(): use w and h parameter. - libdraw: print errstr if last character in string was ":" (sbase). - libdraw: drw_clr_free() allow valid free(NULL). - config.def.h: set default font to monospace. - cleanup() on exit. - LICENSE: update license string for dmenu -v to 2015. - LICENSE: add myself to LICENSE 2014-09-17applied Hiltjo's patch as suggested on the ml to fix ControlMask for C-j and C-mGravatar Anselm R Garbe 2-2/+5 2014-07-30fix crash with ctrl-enter as inputGravatar Hiltjo Posthuma 1-1/+2 reproduce: ./dmenu; send EOF; press ctrl+enter. 2014-05-29updated copyright notices in LICENSE and dmenu.c fileGravatar Anselm R Garbe 2-2/+2 2013-08-13applied Martin Kühl's inverse matching flag to stestGravatar Anselm R Garbe 2-4/+7 2013-08-02applied Martti Kühne's dmenu monitor patchGravatar Anselm R Garbe 3-4/+14 https://gist.github.com/mar77i/3349298/raw/f6581ca96627f4c71c0bd1faf531daaf2a613b95/monarg.patch becomes upstream now 2013-06-28accepted vi'is exit approach ^[ (suggested by Arkaduisz)Gravatar Anselm R Garbe 1-0/+2