diff --git a/cmd/Makefile b/cmd/Makefile index d357a04c..e4537d8b 100644 --- a/cmd/Makefile +++ b/cmd/Makefile @@ -4,22 +4,30 @@ include ../config.mk CFLAGS += -I../liblitz -I../libixp -I../libcext -LDFLAGS += -L../liblitz -llitz -L../libixp -lixp -L../libcext -lcext +LDFLAGS += -L../libixp -lixp -L../libcext -lcext +X11LDFLAGS += -L../liblitz -llitz -SRC = wmiimenu.c wmiipsel.c wmiir.c wmiisetsid.c wmiiwarp.c -OBJ = ${SRC:.c=.o} +X11SRC = wmiimenu.c wmiipsel.c wmiiwarp.c +SRC = wmiir.c wmiisetsid.c +ALLSRC = ${SRC} ${X11SRC} -all: ${OBJ} +all: ${ALLSRC:.c=} @echo built wmii commands .c.o: @echo CC $< @${CC} -c ${CFLAGS} $< + +${SRC:.c=}: ${SRC:.c=.o} @echo LD $* @${CC} -o $* $*.o ${LDFLAGS} +${X11SRC:.c=}: ${X11SRC:.c=.o} + @echo LD $* + @${CC} -o $* $*.o ${LDFLAGS} ${X11LDFLAGS} + # Solaris # @${CC} -o $* $*.o ${LDFLAGS} -lsocket clean: - rm -f wmiimenu wmiir wmiipsel wmiiwarp wmiisetsid *.o + rm -f ${SRC:.c=} *.o diff --git a/cmd/wm/Makefile b/cmd/wm/Makefile index ca5e4dad..a6fd0733 100644 --- a/cmd/wm/Makefile +++ b/cmd/wm/Makefile @@ -4,7 +4,7 @@ include ../../config.mk CFLAGS += -I../../liblitz -I../../libixp -I../../libcext -LDFLAGS += -L../../liblitz -llitz -L../../libixp -lixp -L../../libcext -lcext -lm +X11LDFLAGS += -L../../liblitz -llitz -L../../libixp -lixp -L../../libcext -lcext -lm # Solaris # LDFLAGS += -lsocket @@ -24,7 +24,7 @@ ${OBJ}: wm.h wmiiwm: ${OBJ} @echo LD $@ - @${CC} -o $@ ${OBJ} ${LDFLAGS} + @${CC} -o $@ ${OBJ} ${X11LDFLAGS} clean: rm -f wmiiwm *.o diff --git a/cmd/wm/client.c b/cmd/wm/client.c index 933adc3f..212e6ce7 100644 --- a/cmd/wm/client.c +++ b/cmd/wm/client.c @@ -741,6 +741,7 @@ void apply_tags(Client *c, const char *tags) { unsigned int i, j = 0, n; + int len = sizeof(c->tags); char buf[256]; char *toks[32]; @@ -761,11 +762,11 @@ apply_tags(Client *c, const char *tags) qsort(toks, j, sizeof(char *), compare_tags); if(!j) toks[j++] = "nil"; - for(i=0, n=0; i < j; i++) + for(i=0, n=0; i < j && len > 1; i++) if(!n || strcmp(toks[i], toks[n-1])) { if(n) - cext_strlcat(c->tags, "+", sizeof(c->tags) - strlen(c->tags) - 1); - cext_strlcat(c->tags, toks[i], sizeof(c->tags) - strlen(c->tags) - 1); + len -= cext_strlcat(c->tags, "+", len); + len -= cext_strlcat(c->tags, toks[i], len); toks[n++] = toks[i]; } toks[n] = nil; diff --git a/cmd/wm/wmii b/cmd/wm/wmii index e71144fc..5e6cf5a5 100644 --- a/cmd/wm/wmii +++ b/cmd/wm/wmii @@ -1,8 +1,6 @@ #!/bin/sh # start wmiiwm and wait for its termination -wmiiwm -c || exit 1 - WMII_CONFPATH="$HOME/.wmii-4:CONFPREFIX/wmii-4" export WMII_CONFPATH WMII_NS_DIR="/tmp/ns.$USER.${DISPLAY%.0}" export WMII_NS_DIR WMII_ADDRESS="unix!$WMII_NS_DIR/wmii" export WMII_ADDRESS diff --git a/config.mk b/config.mk index 3a036e93..b0c8e235 100644 --- a/config.mk +++ b/config.mk @@ -11,12 +11,14 @@ X11LIB = /usr/X11R6/lib VERSION = 4-current # includes and libs -LIBS = -L${PREFIX}/lib -L/usr/lib -lc -L${X11LIB} -lX11 +LIBS = -L${PREFIX}/lib -L/usr/lib -lc +X11LIBS = -L${X11LIB} -lX11 # Linux/BSD CFLAGS = -g -Wall -I. -I${PREFIX}/include -I/usr/include -I${X11INC} \ -DVERSION=\"${VERSION}\" LDFLAGS = -g ${LIBS} +X11LDFLAGS = ${LDFLAGS} ${X11LIBS} # Solaris #CFLAGS = -fast -xtarget=ultra ${INCLUDES} -DVERSION=\"${VERSION}\"