--- loncom/lond	2004/01/14 01:08:31	1.171
+++ loncom/lond	2004/02/17 20:07:25	1.175
@@ -2,7 +2,7 @@
 # The LearningOnline Network
 # lond "LON Daemon" Server (port "LOND" 5663)
 #
-# $Id: lond,v 1.171 2004/01/14 01:08:31 albertel Exp $
+# $Id: lond,v 1.175 2004/02/17 20:07:25 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -53,7 +53,7 @@ my $DEBUG = 0;		       # Non zero to ena
 my $status='';
 my $lastlog='';
 
-my $VERSION='$Revision: 1.171 $'; #' stupid emacs
+my $VERSION='$Revision: 1.175 $'; #' stupid emacs
 my $remoteVERSION;
 my $currenthostid;
 my $currentdomainid;
@@ -817,14 +817,17 @@ my $children               = 0;        #
 sub REAPER {                        # takes care of dead children
     $SIG{CHLD} = \&REAPER;
     &status("Handling child death");
-    my $pid = wait;
-    if (defined($children{$pid})) {
-	&logthis("Child $pid died");
-	$children --;
-	delete $children{$pid};
-    } else {
-	&logthis("Unknown Child $pid died");
-    }
+    my $pid;
+    do {
+	$pid = waitpid(-1,&WNOHANG());
+	if (defined($children{$pid})) {
+	    &logthis("Child $pid died");
+	    $children --;
+	    delete $children{$pid};
+	} else {
+	    &logthis("Unknown Child $pid died");
+	}
+    } while ( $pid > 0 );
     &status("Finished Handling child death");
 }
 
@@ -1020,7 +1023,7 @@ sub logstatus {
     my $docdir=$perlvar{'lonDocRoot'};
     {
     my $fh=IO::File->new(">>$docdir/lon-status/londstatus.txt");
-    print $fh $$."\t".$currenthostid."\t".$status."\t".$lastlog."\n";
+    print $fh $$."\t".$clientname."\t".$currenthostid."\t".$status."\t".$lastlog."\n";
     $fh->close();
     }
     &status("Finished londstatus.txt");
@@ -2213,7 +2216,7 @@ sub make_new_child {
 			my %hash;
 			if (tie(%hash,'GDBM_File',"$proname/$namespace.db",&GDBM_WRCREAT(),0640)) {
 			    foreach my $key (@keys) {
-				delete($hash{&unescape($key)});
+				delete($hash{$key});
 			    }
 			    if (untie(%hash)) {
 				print $client "ok\n";
@@ -2724,6 +2727,8 @@ sub make_new_child {
 # -------------------------------------------------------------------------- ls
 		} elsif ($userinput =~ /^ls/) {
 		    if(isClient) {
+			my $obs;
+			my $rights;
 			my ($cmd,$ulsdir)=split(/:/,$userinput);
 			my $ulsout='';
 			my $ulsfn;
@@ -2731,9 +2736,22 @@ sub make_new_child {
 			    if(-d $ulsdir) {
 				if (opendir(LSDIR,$ulsdir)) {
 				    while ($ulsfn=readdir(LSDIR)) {
+					undef $obs, $rights; 
 					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; } 
+						if($obsolete =~ m|(<copyright>)(default)|) { $rights = 1; }
+					    }
+					}
+					$ulsout.=$ulsfn.'&'.join('&',@ulsstats);
+					if($obs eq '1') { $ulsout.="&1"; }
+					else { $ulsout.="&0"; }
+					if($rights eq '1') { $ulsout.="&1:"; }
+					else { $ulsout.="&0:"; }
 				    }
 				    closedir(LSDIR);
 				}