~ubuntu-branches/ubuntu/hoary/scilab/hoary

« back to all changes in this revision

Viewing changes to macros/util/dir.sci

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2005-01-09 22:58:21 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050109225821-473xr8vhgugxxx5j
Tags: 3.0-12
changed configure.in to build scilab's own malloc.o, closes: #255869

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
function L=dir(str)
 
2
  mask = int32(61440), dirtype = 16384,
 
3
  if argn(2)==1 then
 
4
    files=listfiles(str)
 
5
  else
 
6
   files=listfiles()
 
7
  end
 
8
  
 
9
  n=size(files,'*')
 
10
  if n<>0 then files=gsort(files,'g','i'),end
 
11
  
 
12
  dt=zeros(n,1)
 
13
  bytes=zeros(n,1)
 
14
  isd(n,1)=%f
 
15
  for k=1:n
 
16
    [x,ierr]=fileinfo(files(k)) 
 
17
    if x<>[] then
 
18
      dt(k)=x(6)
 
19
      bytes(k)=x(1);
 
20
      isd(k)=double(int32(x(2)) & mask) == dirtype
 
21
    end
 
22
  end
 
23
  L=tlist(['dir','name','date','bytes','isdir'],files,dt,bytes,isd)
 
24
endfunction
 
25