File libs3-progress.diff of Package libs3

Index: libs3/src/s3.c
===================================================================
--- libs3.orig/src/s3.c
+++ libs3/src/s3.c
@@ -2028,6 +2028,7 @@ static int putObjectDataCallback(int buf
         (put_object_callback_data *) callbackData;
 
     int ret = 0;
+    static int compl = -1;
 
     if (data->contentLength) {
         int toRead = ((data->contentLength > (unsigned) bufferSize) ?
@@ -2044,15 +2045,20 @@ static int putObjectDataCallback(int buf
     data->totalContentLength -= ret;
 
     if (data->contentLength && !data->noStatus) {
-        // Avoid a weird bug in MingW, which won't print the second integer
-        // value properly when it's in the same call, so print separately
-        printf("%llu bytes remaining ",
-               (unsigned long long) data->totalContentLength);
-        printf("(%d%% complete) ...\n",
-               (int) (((data->totalOriginalContentLength -
-                        data->totalContentLength) * 100) /
-                      data->totalOriginalContentLength));
+        int prcnt = ((data->originalContentLength - data->contentLength) * 200)
+                    / data->originalContentLength;
+        if (prcnt != compl) {
+            // Avoid a weird bug in MingW, which won't print the second integer
+            // value properly when it's in the same call, so print separately
+            printf("%llu bytes remaining ",
+                   (unsigned long long) data->contentLength);
+            printf("(%d%% complete) ... \r", prcnt/2);
+	    fflush(stdout);
+	    compl = prcnt;
+	}
     }
+    if (!data->contentLength)
+	    printf("\n");
 
     return ret;
 }