changeset: 2777:eff0e75864cd
tag: tip
user: Kris Maglione <kris_AT_suckless.org>
date: Thu Aug 12 20:10:13 2010 -0400
files: cmd/menu/history.c cmd/wmii/mouse.c cmd/wmiir.c
description:
Fix wmiir proglist.
diff -r 4ecd918e7afa -r eff0e75864cd cmd/menu/history.c
--- a/cmd/menu/history.c Tue Aug 10 05:46:00 2010 -0400
+++ b/cmd/menu/history.c Thu Aug 12 20:10:13 2010 -0400
@@ -59,7 +59,7 @@
fd = mkstemp(tmp);
if(fd < 0) {
fprint(2, "%s: Can't create temporary history file %q: %r\n", argv0, path);
- return;
+ _exit(1);
}
hist.string = input.string;
@@ -84,10 +84,11 @@
for(h=first; h; h=h->next)
if(Bprint(&b, "%s\n", h->string) < 0) {
unlink(tmp);
- exit(1);
+ fprint(2, "%s: Can't write temporary history file %q: %r\n", argv0, path);
+ _exit(1);
}
Bterm(&b);
rename(tmp, path);
- exit(0);
+ _exit(0);
}
diff -r 4ecd918e7afa -r eff0e75864cd cmd/wmii/mouse.c
--- a/cmd/wmii/mouse.c Tue Aug 10 05:46:00 2010 -0400
+++ b/cmd/wmii/mouse.c Thu Aug 12 20:10:13 2010 -0400
@@ -643,7 +643,7 @@
static void
_grab(XWindow w, uint button, ulong mod) {
XGrabButton(display, button, mod, w, false, ButtonMask,
- GrabModeSync, GrabModeAsync, None, None);
+ GrabModeSync, GrabModeSync, None, None);
}
/* Doesn't belong here */
diff -r 4ecd918e7afa -r eff0e75864cd cmd/wmiir.c
--- a/cmd/wmiir.c Tue Aug 10 05:46:00 2010 -0400
+++ b/cmd/wmiir.c Thu Aug 12 20:10:13 2010 -0400
@@ -4,10 +4,12 @@
#define IXP_NO_P9_
#define IXP_P9_STRUCTS
#include <dirent.h>
+#include <errno.h>
#include <limits.h>
#include <locale.h>
#include <stdio.h>
#include <string.h>
+#include <sys/stat.h>
#include <sys/signal.h>
#include <time.h>
#include <unistd.h>
@@ -432,7 +434,9 @@
xproglist(int argc, char *argv[]) {
DIR *d;
struct dirent *de;
- char *dir;
+ struct stat stat;
+ char *dir, *cwd;
+ int i;
quotefmtinstall();
@@ -441,12 +445,19 @@
usage();
}ARGEND;
+ i = 7, cwd = nil;
+ do
+ cwd = erealloc(cwd, 1<<i);
+ while(!getcwd(cwd, 1<<i) && errno == ERANGE);
+
while((dir = ARGF()))
/* Don't use Blprint. wimenu expects UTF-8. */
- if((d = opendir(dir))) {
- while((de = readdir(d)))
- if(access(de->d_name, X_OK))
+ if(!chdir(cwd) && !chdir(dir) && (d = opendir(dir))) {
+ while((de = readdir(d))) {
+ lstat(de->d_name, &stat);
+ if(S_ISREG(stat.st_mode) && !access(de->d_name, X_OK))
Bprint(outbuf, "%q\n", de->d_name);
+ }
closedir(d);
}
Received on Fri Aug 13 2010 - 02:10:25 CEST
This archive was generated by hypermail 2.2.0 : Fri Aug 13 2010 - 02:12:04 CEST