diff lib/misc.c @ 378:712d3810f4e1

2003-1-27 Brian Masney <masneyb@gftp.org> * lib/gftp.h lib/misc.c src/gtk/gtkui_transfer.c src/text/textui.c - added gftp_get_transfer_action(). When a file is to be transfered and already exists, this will return the default action that should be taken. * src/text/textui.c (gftpui_ask_transfer) - implemented this function so that whenever a file exists and is to be transfered, the user will be prompted on whether or not to overwrite/skip/resume * src/text/gftp-text.c (gftp_text_ask_question) - fixups for inputing a single character
author masneyb
date Tue, 27 Jan 2004 23:48:26 +0000
parents d207b8241e96
children 38bfc112ab46
line wrap: on
line diff
--- a/lib/misc.c	Sat Jan 24 11:45:11 2004 +0000
+++ b/lib/misc.c	Tue Jan 27 23:48:26 2004 +0000
@@ -1316,3 +1316,23 @@
   return (newstr);
 }
 
+
+int
+gftp_get_transfer_action (gftp_request * request, gftp_file * fle)
+{
+  intptr_t overwrite_default;
+
+  gftp_lookup_request_option (request, "overwrite_default", &overwrite_default);
+
+  if (overwrite_default)
+    fle->transfer_action = GFTP_TRANS_ACTION_OVERWRITE;
+  else if (fle->startsize == fle->size)
+    fle->transfer_action = GFTP_TRANS_ACTION_SKIP;
+  else if (fle->startsize > fle->size)
+    fle->transfer_action = GFTP_TRANS_ACTION_OVERWRITE;
+  else
+    fle->transfer_action = GFTP_TRANS_ACTION_RESUME;
+
+  return (fle->transfer_action);
+}
+