diff options
author | Connor Lane Smith <cls@lubutu.com> | 2011-06-18 07:50:46 +0100 |
---|---|---|
committer | Connor Lane Smith <cls@lubutu.com> | 2011-06-18 07:50:46 +0100 |
commit | 86e9e6f1ecc4711d8fe447f5c0f2c1bd0feb8568 (patch) | |
tree | 78004216c78d80f867713a8afd10ff0797fb62f4 | |
parent | eadf090413c530e69e8568492ebeb4b4087bd2ad (diff) |
simpler lsx
-rw-r--r-- | dmenu.1 | 3 | ||||
-rw-r--r-- | lsx.1 | 10 | ||||
-rw-r--r-- | lsx.c | 4 |
3 files changed, 6 insertions, 11 deletions
@@ -95,4 +95,5 @@ Exit without selecting an item, returning failure. | |||
95 | .B Ctrl\-y | 95 | .B Ctrl\-y |
96 | Paste the current X selection into the input field. | 96 | Paste the current X selection into the input field. |
97 | .SH SEE ALSO | 97 | .SH SEE ALSO |
98 | .IR dwm (1) | 98 | .IR dwm (1), |
99 | .IR lsx (1) | ||
@@ -3,13 +3,9 @@ | |||
3 | lsx \- list executables | 3 | lsx \- list executables |
4 | .SH SYNOPSIS | 4 | .SH SYNOPSIS |
5 | .B lsx | 5 | .B lsx |
6 | .RB [ \-v ] | ||
7 | .RI [ directory ...] | 6 | .RI [ directory ...] |
8 | .SH DESCRIPTION | 7 | .SH DESCRIPTION |
9 | .B lsx | 8 | .B lsx |
10 | lists the executables in each directory. If no directories are given the current | 9 | lists the executables in each |
11 | working directory is used. | 10 | .IR directory . |
12 | .SH OPTIONS | 11 | If none are given the current working directory is used. |
13 | .TP | ||
14 | .B \-v | ||
15 | prints version information to stdout, then exits. | ||
@@ -14,8 +14,6 @@ main(int argc, char *argv[]) { | |||
14 | 14 | ||
15 | if(argc < 2) | 15 | if(argc < 2) |
16 | lsx("."); | 16 | lsx("."); |
17 | else if(!strcmp(argv[1], "-v")) | ||
18 | puts("lsx-0.2, © 2006-2011 dmenu engineers, see LICENSE for details"); | ||
19 | else for(i = 1; i < argc; i++) | 17 | else for(i = 1; i < argc; i++) |
20 | lsx(argv[i]); | 18 | lsx(argv[i]); |
21 | return EXIT_SUCCESS; | 19 | return EXIT_SUCCESS; |
@@ -34,7 +32,7 @@ lsx(const char *dir) { | |||
34 | } | 32 | } |
35 | while((d = readdir(dp))) { | 33 | while((d = readdir(dp))) { |
36 | snprintf(buf, sizeof buf, "%s/%s", dir, d->d_name); | 34 | snprintf(buf, sizeof buf, "%s/%s", dir, d->d_name); |
37 | if(stat(buf, &st) == 0 && S_ISREG(st.st_mode) && access(buf, X_OK) == 0) | 35 | if(!stat(buf, &st) && S_ISREG(st.st_mode) && access(buf, X_OK) == 0) |
38 | puts(d->d_name); | 36 | puts(d->d_name); |
39 | } | 37 | } |
40 | closedir(dp); | 38 | closedir(dp); |