summaryrefslogtreecommitdiffstats
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;
}
ss='logheader'>2015-09-27separate program-specific c99 bool and X11Gravatar Hiltjo Posthuma 2-11/+10 True, False are X11-specific, make sure to use c99 stdbool for program-specific things. ... also remove left-over vim mode string in config. 2015-09-27config.mk: fix _XOPEN_SOURCE=700 for getline()Gravatar Hiltjo Posthuma 1-1/+1 2015-09-27config.mk: improve feature test checkGravatar Hiltjo Posthuma 1-1/+1 this fixes a crash on NetBSD because it requires -D_XOPEN_SOURCE (strdup, usleep). thanks k0ga and stateless for reporting and fixing this issue! 2015-08-06Fixed typo introduced by shared codeGravatar Eric Pruitt 1-1/+1 2015-07-19stest: get rid of getopt, use suckless arg.hGravatar Hiltjo Posthuma 3-53/+141 ... also some style improvements. 2015-07-19config.mk: add FREETYPELIBS and FREETYPEINCGravatar Hiltjo Posthuma 1-3/+9 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 td> 2009-09-11Adding README file.Gravatar Enno Boland (tox) 2-1/+26 2009-09-11unfocus should return false; renaming cookie-file.Gravatar Enno Boland (tox) 1-2/+2 2009-09-11surf embeds now itself into another window.Gravatar Enno Boland (tox) 1-8/+9 2009-09-10Added tag 0.1.1 for changeset 3ef997607115Gravatar Enno Boland (tox) 1-0/+1 2009-09-10bugfix releaseGravatar Enno Boland (tox) 1-1/+1 2009-09-10removing unneeded background color.Gravatar Enno Boland (tox) 1-1/+0 2009-09-10rearranging some source.Gravatar Enno Boland (tox) 1-12/+19 2009-09-10adding user stylesheets.Gravatar Enno Boland (tox) 1-10/+21 2009-09-10Added tag 0.1 for changeset 9c8ebcf54061Gravatar Enno Boland (tox) 1-0/+2 2009-09-10dist doesn't work. fixing Makefile.Gravatar Enno Boland (tox) 1-1/+1