Xinqi Bao's Git
57c03bf1e26736f6a121eda1609cf9bdd3335204
1 /* See LICENSE file for copyright and license details. */
9 static void lsx(const char *dir
);
11 static int status
= EXIT_SUCCESS
;
14 main(int argc
, char *argv
[]) {
19 else for(i
= 1; i
< argc
; i
++)
25 lsx(const char *dir
) {
31 if(!(dp
= opendir(dir
))) {
32 status
= EXIT_FAILURE
;
36 while((d
= readdir(dp
)))
37 if(snprintf(buf
, sizeof buf
, "%s/%s", dir
, d
->d_name
) < (int)sizeof buf
38 && stat(buf
, &st
) == 0 && S_ISREG(st
.st_mode
) && access(buf
, X_OK
) == 0)