mirror of
https://github.com/0intro/wmii
synced 2024-11-21 21:31:33 +03:00
Fix wmiir proglist.
This commit is contained in:
parent
65c8c8d536
commit
96389a015e
@ -59,7 +59,7 @@ history_dump(const char *path, int max) {
|
||||
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 @@ history_dump(const char *path, int max) {
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -643,7 +643,7 @@ mouse_checkresize(Frame *f, Point p, bool exec) {
|
||||
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 */
|
||||
|
19
cmd/wmiir.c
19
cmd/wmiir.c
@ -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 @@ static int
|
||||
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 @@ xproglist(int argc, char *argv[]) {
|
||||
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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user