dmenu_path.c (shell is a bottleneck)
Connor Lane Smith cls@lubutu.com
Fri, 08 Oct 2010 23:24:22 +0100
3 files changed,
108 insertions(+),
34 deletions(-)
M
Makefile
→
Makefile
@@ -3,7 +3,7 @@ # See LICENSE file for copyright and license details.
include config.mk -all: options dmenu +all: options dmenu dmenu_path options: @echo dmenu build options:@@ -11,22 +11,21 @@ @echo "CFLAGS = ${CFLAGS}"
@echo "LDFLAGS = ${LDFLAGS}" @echo "CC = ${CC}" -dmenu.o: dmenu.c config.mk - @echo CC $< - @${CC} -c ${CFLAGS} $< +dmenu: dmenu.c config.mk +dmenu_path: dmenu_path.c -dmenu: dmenu.o +dmenu dmenu_path: @echo CC -o $@ - @${CC} -o $@ $+ ${LDFLAGS} + @${CC} -o $@ $< ${CFLAGS} ${LDFLAGS} clean: @echo cleaning - @rm -f dmenu dmenu.o dmenu-${VERSION}.tar.gz + @rm -f dmenu dmenu_path dmenu-${VERSION}.tar.gz dist: clean @echo creating dist tarball @mkdir -p dmenu-${VERSION} - @cp LICENSE Makefile README config.mk dmenu.1 dmenu.c dmenu_path dmenu_run dmenu-${VERSION} + @cp LICENSE Makefile README config.mk dmenu.1 dmenu.c dmenu_path.c dmenu_run dmenu-${VERSION} @tar -cf dmenu-${VERSION}.tar dmenu-${VERSION} @gzip dmenu-${VERSION}.tar @rm -rf dmenu-${VERSION}
D
dmenu_path
@@ -1,26 +0,0 @@
-#!/bin/sh -CACHE=$HOME/.dmenu_cache -IFS=: - -uptodate() { - test -f "$CACHE" && - for dir in $PATH - do - test ! $dir -nt "$CACHE" || return 1 - done -} - -if ! uptodate -then - for dir in $PATH - do - cd "$dir" && - for file in * - do - test -x "$file" && echo "$file" - done - done | sort -u > "$CACHE".$$ && - mv "$CACHE".$$ "$CACHE" -fi - -cat "$CACHE"