simpler lsx 86e9e6f1
Connor Lane Smith · 2011-06-18 07:50 3 file(s) · +6 −11
dmenu.1 +2 −1
95 95
.B Ctrl\-y
96 96
Paste the current X selection into the input field.
97 97
.SH SEE ALSO
98 -
.IR dwm (1)
98 +
.IR dwm (1),
99 +
.IR lsx (1)
lsx.1 +3 −7
3 3
lsx \- list executables
4 4
.SH SYNOPSIS
5 5
.B lsx
6 -
.RB [ \-v ]
7 6
.RI [ directory ...]
8 7
.SH DESCRIPTION
9 8
.B lsx
10 -
lists the executables in each directory. If no directories are given the current
11 -
working directory is used.
12 -
.SH OPTIONS
13 -
.TP
14 -
.B \-v
15 -
prints version information to stdout, then exits.
9 +
lists the executables in each
10 +
.IR directory .
11 +
If none are given the current working directory is used.
lsx.c +1 −3
14 14
15 15
	if(argc < 2)
16 16
		lsx(".");
17 -
	else if(!strcmp(argv[1], "-v"))
18 -
		puts("lsx-0.2, © 2006-2011 dmenu engineers, see LICENSE for details");
19 17
	else for(i = 1; i < argc; i++)
20 18
		lsx(argv[i]);
21 19
	return EXIT_SUCCESS;
34 32
	}
35 33
	while((d = readdir(dp))) {
36 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 36
			puts(d->d_name);
39 37
	}
40 38
	closedir(dp);