|
|
|
@ -14,8 +14,6 @@ main(int argc, char *argv[]) { |
|
|
|
|
|
|
|
|
|
if(argc < 2) |
|
|
|
|
lsx("."); |
|
|
|
|
else if(!strcmp(argv[1], "-v")) |
|
|
|
|
puts("lsx-0.2, © 2006-2011 dmenu engineers, see LICENSE for details"); |
|
|
|
|
else for(i = 1; i < argc; i++) |
|
|
|
|
lsx(argv[i]); |
|
|
|
|
return EXIT_SUCCESS; |
|
|
|
@ -34,7 +32,7 @@ lsx(const char *dir) { |
|
|
|
|
} |
|
|
|
|
while((d = readdir(dp))) { |
|
|
|
|
snprintf(buf, sizeof buf, "%s/%s", dir, d->d_name); |
|
|
|
|
if(stat(buf, &st) == 0 && S_ISREG(st.st_mode) && access(buf, X_OK) == 0) |
|
|
|
|
if(!stat(buf, &st) && S_ISREG(st.st_mode) && access(buf, X_OK) == 0) |
|
|
|
|
puts(d->d_name); |
|
|
|
|
} |
|
|
|
|
closedir(dp); |
|
|
|
|