Browse Source

simpler lsx

master
Connor Lane Smith 13 years ago
parent
commit
86e9e6f1ec
3 changed files with 6 additions and 11 deletions
  1. +2
    -1
      dmenu.1
  2. +3
    -7
      lsx.1
  3. +1
    -3
      lsx.c

+ 2
- 1
dmenu.1 View File

@ -95,4 +95,5 @@ Exit without selecting an item, returning failure.
.B Ctrl\-y .B Ctrl\-y
Paste the current X selection into the input field. Paste the current X selection into the input field.
.SH SEE ALSO .SH SEE ALSO
.IR dwm (1)
.IR dwm (1),
.IR lsx (1)

+ 3
- 7
lsx.1 View File

@ -3,13 +3,9 @@
lsx \- list executables lsx \- list executables
.SH SYNOPSIS .SH SYNOPSIS
.B lsx .B lsx
.RB [ \-v ]
.RI [ directory ...] .RI [ directory ...]
.SH DESCRIPTION .SH DESCRIPTION
.B lsx .B lsx
lists the executables in each directory. If no directories are given the current
working directory is used.
.SH OPTIONS
.TP
.B \-v
prints version information to stdout, then exits.
lists the executables in each
.IR directory .
If none are given the current working directory is used.

+ 1
- 3
lsx.c View File

@ -14,8 +14,6 @@ main(int argc, char *argv[]) {
if(argc < 2) if(argc < 2)
lsx("."); 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++) else for(i = 1; i < argc; i++)
lsx(argv[i]); lsx(argv[i]);
return EXIT_SUCCESS; return EXIT_SUCCESS;
@ -34,7 +32,7 @@ lsx(const char *dir) {
} }
while((d = readdir(dp))) { while((d = readdir(dp))) {
snprintf(buf, sizeof buf, "%s/%s", dir, d->d_name); 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); puts(d->d_name);
} }
closedir(dp); closedir(dp);


Loading…
Cancel
Save