Re: Recursive copy (was: How's Sather coming along?)

Sather User <[email protected]> Sat, 15 Dec 2012 13:39:13 +1030 (CST)
Newsgroups gmane.comp.lang.sather.announce
Message-ID <[email protected]>
--- earlier_dart.sa	2012-12-15 12:57:59.030500014 +1030
+++ dart.sa	2012-12-15 13:31:22.453672120 +1030
@@ -11,7 +11,7 @@
 class DART is
    include PATH;
    const noerr, helped, few_args, src_not_dir, dst_shaft_not_dir,
-	 dst_exists, no_src, no_dst, bad_mkdir;
+	 dst_exists, no_src, no_dst, bad_mkdir, bad_open;
    const base_mode:INT:=0o777;
    const path_separator:CHAR:='/';
    shared me:STR;
@@ -39,7 +39,6 @@
    end;

    make_symlink(oldpath,newpath:STR) is
-      ERRNO::reset;
       i::=SYMLINK::make_symlink(oldpath,newpath);
       if i = 0 then return end;
       msg::="write_symlink("+oldpath+","+newpath+"): ";
@@ -90,7 +89,7 @@
 	 mkdir(newdir,base_mode);
       when INT then
 	 msg::="mkdir("+newdir+", ...) failed: ";
-	 return err(bad_mkdir, msg+"ERRNO::errno="+exception.str)
+	 return err(bad_mkdir, msg+"ERRNO::errno="+exception)
       when STR then
 	 return err(bad_mkdir, exception)
       end;
@@ -101,8 +100,7 @@
       protect
 	 delve(src);
       when $STR then
-	 #OUT+"delve exception "+exception.str+"\n";
-	       return 0
+	 return err(bad_open, "delve exception: "+exception);
       end;

       src_dir_stat.store_times(dst, pathchew(src).tip);
@@ -125,13 +123,13 @@
 	       f1::=FILE::open_for_read(src_stub+path_separator+n);
 	       if f1.error then
 		  emsg ::= newdest+": open_for_read failed, errno="
-			+ERRNO::errno.str;
+			+ERRNO::errno;
 		  raise emsg
 	       end;
 	       f2::=FILE::open_for_write(newdest);
 	       if f2.error then
 		  emsg ::= newdest+": open_for_write failed, errno="
-			+ERRNO::errno.str;
+			+ERRNO::errno;
 		  raise emsg
 	       end;
 	       f2+f1.fstr;
@@ -155,8 +153,10 @@
 	       SYMLINK::read_symlink(src_stub+path_separator+n,
 				     LSTAT::st_size_lobits);
 	       make_symlink(SYMLINK::val, dst_stub+path_separator+n);
-	       spear::=pathchew(dst_stub+path_separator+n);
-	       LSTAT::store_times(spear.shaft, spear.tip)
+	       if UTIME::is_defined__use_atfile then
+		  spear::=pathchew(dst_stub+path_separator+n);
+		  LSTAT::store_times(spear.shaft, spear.tip)
+	       end
 	    else
 	       #ERR+src_stub+path_separator+n
 		     +": unhandled file type "