Am 30.11.2015 um 12:31 schrieb Siarhei Siamashka:
What if 'count' is much larger than 'argc' here?

The revised file_upload() now takes care of it, and will error out in that case.

Regards, B. Nortmann

--
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
>From b6966d19269d33baaa79a7af5548ba79f0505673 Mon Sep 17 00:00:00 2001
From: Bernhard Nortmann <bernhard.nortm...@web.de>
Date: Thu, 26 Nov 2015 16:16:58 +0100
Subject: [PATCH v6 7/9] fel: implement "write-with-progress" and "multiwrite"

The two new commands both imply that a (simple) progress bar
display is requested. "multi[write]" allows to upload a group
of files with a single command, resulting in their transfer
showing a common, 'overall' progress status.

Signed-off-by: Bernhard Nortmann <bernhard.nortm...@web.de>
---
 fel.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/fel.c b/fel.c
index bbad5fe..36fb544 100644
--- a/fel.c
+++ b/fel.c
@@ -1298,6 +1298,9 @@ int main(int argc, char **argv)
                        "       exe[cute] address               Call function 
address\n"
                        "       read address length file        Write memory 
contents into file\n"
                        "       write address file              Store file 
contents into memory\n"
+                       "       write-with-progress addr file   \"write\" with 
progress bar\n"
+                       "       multi[write] # addr file ...    
\"write-with-progress\" multiple files,\n"
+                       "                                       sharing a 
common progress status\n"
                        "       ver[sion]                       Show BROM 
version\n"
                        "       clear address length            Clear memory\n"
                        "       fill address length value       Fill memory\n"
@@ -1361,6 +1364,14 @@ int main(int argc, char **argv)
                } else if (strcmp(argv[1], "write") == 0 && argc > 3) {
                        skip += 2 * file_upload(handle, 1, argc - 2, argv + 2,
                                        pflag_active ? progress_bar : NULL);
+               } else if (strcmp(argv[1], "write-with-progress") == 0 && argc 
> 3) {
+                       skip += 2 * file_upload(handle, 1, argc - 2, argv + 2,
+                                               progress_bar);
+               } else if ((strcmp(argv[1], "multiwrite") == 0 ||
+                           strcmp(argv[1], "multi") == 0) && argc > 4) {
+                       size_t count = strtoul(argv[2], NULL, 0); /* file count 
*/
+                       skip = 2 + 2 * file_upload(handle, count, argc - 3,
+                                                  argv + 3, progress_bar);
                } else if (strcmp(argv[1], "read") == 0 && argc > 4) {
                        size_t size = strtoul(argv[3], NULL, 0);
                        void *buf = malloc(size);
-- 
2.4.6

Reply via email to