4 # On stderr, near and total misses are reported.
5 # '-l<flags>' argument adds ls -l<flags> of each file found.
8 if sys
.path
[0] in (".", ""): del sys
.path
[0]
14 sys
.stderr
.write(str + '\n')
17 pathlist
= os
.environ
['PATH'].split(os
.pathsep
)
22 if sys
.argv
[1:] and sys
.argv
[1][:2] == '-l':
23 longlist
= sys
.argv
[1]
26 for prog
in sys
.argv
[1:]:
29 filename
= os
.path
.join(dir, prog
)
31 st
= os
.stat(filename
)
34 if not S_ISREG(st
[ST_MODE
]):
35 msg(filename
+ ': not a disk file')
37 mode
= S_IMODE(st
[ST_MODE
])
49 msg(filename
+ ': not executable')
51 sts
= os
.system('ls ' + longlist
+ ' ' + filename
)
52 if sts
: msg('"ls -l" exit status: ' + repr(sts
))
54 msg(prog
+ ': not found')
59 if __name__
== '__main__':