Xinqi Bao's Git
1 /* See LICENSE file for copyright and license details. */
10 static void lsx(const char *dir
);
12 static int status
= EXIT_SUCCESS
;
15 main(int argc
, char *argv
[]) {
20 else for(i
= 1; i
< argc
; i
++)
26 lsx(const char *dir
) {
32 for(dp
= opendir(dir
); dp
&& (d
= readdir(dp
)); errno
= 0)
33 if(snprintf(buf
, sizeof buf
, "%s/%s", dir
, d
->d_name
) < (int)sizeof buf
34 && access(buf
, X_OK
) == 0 && stat(buf
, &st
) == 0 && S_ISREG(st
.st_mode
))
38 status
= EXIT_FAILURE
;