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

taceyjo1 lon-capa-cvs@mail.lon-capa.org
Wed, 04 Feb 2004 17:17:26 -0000


taceyjo1		Wed Feb  4 12:17:26 2004 EDT

  Modified files:              
    /loncom	lond 
  Log:
  Here is the modified LS with obsolete checking, it currently just appends a &0 if not and &1 if it is at the end.
  Please bang on this and let me know if it causes anything to be eaten or otherwise cause indigestion of your code
  thanks
  
  
Index: loncom/lond
diff -u loncom/lond:1.172 loncom/lond:1.173
--- loncom/lond:1.172	Thu Jan 15 10:28:30 2004
+++ loncom/lond	Wed Feb  4 12:17:26 2004
@@ -2,7 +2,7 @@
 # The LearningOnline Network
 # lond "LON Daemon" Server (port "LOND" 5663)
 #
-# $Id: lond,v 1.172 2004/01/15 15:28:30 www Exp $
+# $Id: lond,v 1.173 2004/02/04 17:17:26 taceyjo1 Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -53,7 +53,7 @@
 my $status='';
 my $lastlog='';
 
-my $VERSION='$Revision: 1.172 $'; #' stupid emacs
+my $VERSION='$Revision: 1.173 $'; #' stupid emacs
 my $remoteVERSION;
 my $currenthostid;
 my $currentdomainid;
@@ -2724,6 +2724,7 @@
 # -------------------------------------------------------------------------- ls
 		} elsif ($userinput =~ /^ls/) {
 		    if(isClient) {
+			my $obs;
 			my ($cmd,$ulsdir)=split(/:/,$userinput);
 			my $ulsout='';
 			my $ulsfn;
@@ -2731,9 +2732,19 @@
 			    if(-d $ulsdir) {
 				if (opendir(LSDIR,$ulsdir)) {
 				    while ($ulsfn=readdir(LSDIR)) {
+					undef $obs; 
 					my @ulsstats=stat($ulsdir.'/'.$ulsfn);
-					$ulsout.=$ulsfn.'&'.
-					    join('&',@ulsstats).':';
+					#We do some obsolete checking here
+					if(-e $ulsdir.'/'.$ulsfn.".meta") { 
+					    open(FILE, $ulsdir.'/'.$ulsfn.".meta");
+					    my @obsolete=<FILE>;
+					    foreach my $obsolete (@obsolete) {
+					        if($obsolete =~ m|(<obsolete>)(on)|) { $obs = 1; } 
+					    }
+					}
+					$ulsout.=$ulsfn.'&'.join('&',@ulsstats);
+					if($obs eq '1') { $ulsout.="&1:"; }
+					else { $ulsout.="&0:"; }
 				    }
 				    closedir(LSDIR);
 				}