ls -a should at least display '. ..'

git-svn-id: https://kippo.googlecode.com/svn/trunk@198 951d7100-d841-11de-b865-b3884708a8e2
This commit is contained in:
desaster 2011-02-06 08:14:31 +00:00
parent 4fde1e5c52
commit dbf8e84d88
1 changed files with 3 additions and 5 deletions

View File

@ -49,18 +49,16 @@ class command_ls(HoneyPotCommand):
self.honeypot.writeln( self.honeypot.writeln(
'ls: cannot access %s: No such file or directory' % path) 'ls: cannot access %s: No such file or directory' % path)
return return
if not len(files):
return
l = [x[A_NAME] for x in files \ l = [x[A_NAME] for x in files \
if self.show_hidden or not x[A_NAME].startswith('.')] if self.show_hidden or not x[A_NAME].startswith('.')]
if self.show_hidden:
l.insert(0, '..')
l.insert(0, '.')
if not l: if not l:
return return
count = 0 count = 0
maxlen = max([len(x) for x in l]) maxlen = max([len(x) for x in l])
perline = int(self.honeypot.user.windowSize[1] / (maxlen + 1)) perline = int(self.honeypot.user.windowSize[1] / (maxlen + 1))
if self.show_hidden:
l.insert(0, '..')
l.insert(0, '.')
for f in l: for f in l:
if count == perline: if count == perline:
count = 0 count = 0