[LON-CAPA-cvs] cvs: loncom / lond

stredwic lon-capa-cvs@mail.lon-capa.org
Wed, 17 Jul 2002 19:06:30 -0000


stredwic		Wed Jul 17 15:06:30 2002 EDT

  Modified files:              
    /loncom	lond 
  Log:
  Now the ls command works with files.  It will check to see if the value is
  a directory.  If it is a directory it opens it reads all the files, stats them
  and returns them.  If it is not a directory it stats the value and returns
  it.
  
  
Index: loncom/lond
diff -u loncom/lond:1.82 loncom/lond:1.83
--- loncom/lond:1.82	Tue Jun 18 15:39:13 2002
+++ loncom/lond	Wed Jul 17 15:06:30 2002
@@ -2,7 +2,7 @@
 # The LearningOnline Network
 # lond "LON Daemon" Server (port "LOND" 5663)
 #
-# $Id: lond,v 1.82 2002/06/18 19:39:13 www Exp $
+# $Id: lond,v 1.83 2002/07/17 19:06:30 stredwic Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1402,14 +1402,20 @@
                        my $ulsout='';
                        my $ulsfn;
                        if (-e $ulsdir) {
-			if (opendir(LSDIR,$ulsdir)) {
-                          while ($ulsfn=readdir(LSDIR)) {
-			     my @ulsstats=stat($ulsdir.'/'.$ulsfn);
-                             $ulsout.=$ulsfn.'&'.join('&',@ulsstats).':';
-                          }
-                          closedir(LSDIR);
-		        }
-		       } else {
+                           if(-d $ulsdir) {
+                               if (opendir(LSDIR,$ulsdir)) {
+                                   while ($ulsfn=readdir(LSDIR)) {
+                                       my @ulsstats=stat($ulsdir.'/'.$ulsfn);
+                                       $ulsout.=$ulsfn.'&'.
+                                                join('&',@ulsstats).':';
+                                   }
+                                   closedir(LSDIR);
+                               }
+                           } else {
+                               my @ulsstats=stat($ulsdir);
+                               $ulsout.=$ulsfn.'&'.join('&',@ulsstats).':';
+                           }
+                       } else {
                           $ulsout='no_such_dir';
                        }
                        if ($ulsout eq '') { $ulsout='empty'; }