looking for 'quit' in cadaverrc

Henrik Holst henrik at witsbits.com
Mon Oct 6 03:15:32 EDT 2008


lör 2008-10-04 klockan 16:58 +0200 skrev Wolfram Riedel:
> Hi,
> 
> I'm trying to automate uploading to a webdav server with cadaver.
> This actually works using netrc for credentials and cadaverrc as sort 
> of batch script. But it seems that in cadaverrc the 'quit' command is 
> not supported or ignored, leaving the process in an interactive state 
> after uploading.
> It would be great if you could get 'quit' to work, give me a hint if I 
> overlooked something, or tell me if there is a better approach for 
> doing this.
> 
> Regards,
> Wolfram

I've looked over the code and noticed that you are indeed correct, not
only does it not quit it also processes all lines after the quit command
in .cadaverrc!!

I have added a patch to this mail that corrects this, hopefully Joe will
accept it into mainline :)

--- cadaver-0.23.2/src/cadaver.c	2007-08-22 14:17:27.000000000 +0200
+++ cadaver/src/cadaver.c	2008-10-06 09:12:49.000000000 +0200
@@ -586,8 +586,9 @@
 #endif
 }
 
-static void init_rcfile(void)
+static int init_rcfile(void)
 {
+    int ret = 0;
     char *rcfile, buf[BUFSIZ];
     struct stat st;
     FILE *f;
@@ -602,7 +603,10 @@
 	} else {
 	    for (;;) {
 		if (fgets(buf, BUFSIZ, f) != NULL) {
-		    execute_command(ne_shave(buf, "\r\n"));
+		    ret = execute_command(ne_shave(buf, "\r\n"));
+
+		    if (ret != 0)
+		        break;
 		} else {
 		    break;
 		}
@@ -611,6 +615,7 @@
 	}
     }
     free(rcfile);
+    return ret;
 }
 
 
@@ -867,7 +872,8 @@
 
     init_signals();
     init_locking();
-    init_rcfile();
+
+    ret = init_rcfile();
     
     parse_args(argc, argv);
 
@@ -1046,7 +1052,7 @@
 	putchar((n<len-1)?'=':
 		 (n==(len-1)?'>':' '));
     }
-    printf(_("] %5.1f%% of %" NE_FMT_OFF_T " bytes"), pc*100, total);
+    printf(_("] %5.1f%% of %" NE_FMT_NE_OFF_T " bytes"), pc*100, total);
     fflush(stdout);
 }
 

/Henrik Holst
Witsbits AB
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cadaver.c.patch
Type: text/x-patch
Size: 1049 bytes
Desc: not available
Url : http://lists.manyfish.co.uk/pipermail/cadaver/attachments/20081006/3d266030/attachment-0007.bin 


More information about the cadaver mailing list