diff mbox series

[1/2] client: add option -d for dryrun

Message ID 1551971455-3323-1-git-send-email-philippe.reynes@softathome.com
State Accepted
Headers show
Series [1/2] client: add option -d for dryrun | expand

Commit Message

Philippe REYNES March 7, 2019, 3:10 p.m. UTC
The tools client don't support the option dryrun,
but the API for external programs does. So we add
an option -d to enable the dryrun feature.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
---
 tools/client.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Stefano Babic March 8, 2019, 9:43 a.m. UTC | #1
On 07/03/19 16:10, Philippe Reynes wrote:
> The tools client don't support the option dryrun,
> but the API for external programs does. So we add
> an option -d to enable the dryrun feature.
> 
> Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
> ---
>  tools/client.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/client.c b/tools/client.c
> index 3a7946b..73fef47 100644
> --- a/tools/client.c
> +++ b/tools/client.c
> @@ -40,6 +40,7 @@ static void usage(void) {
>  char buf[256];
>  int fd;
>  int verbose = 1;
> +bool dryrun = false;
>  
>  pthread_mutex_t mymutex;
>  
> @@ -103,7 +104,7 @@ static int send_file(const char* filename) {
>  	/* synchronize with a mutex */
>  	pthread_mutex_lock(&mymutex);
>  	rc = swupdate_async_start(readimage, printstatus,
> -				end, false);
> +				end, dryrun);
>  	if (rc)
>  		printf("swupdate_async_start returns %d\n", rc);
>  
> @@ -126,8 +127,11 @@ int main(int argc, char *argv[]) {
>  	pthread_mutex_init(&mymutex, NULL);
>  
>  	/* parse command line options */
> -	while ((c = getopt(argc, argv, "hqv")) != EOF) {
> +	while ((c = getopt(argc, argv, "dhqv")) != EOF) {
>  		switch (c) {
> +		case 'd':
> +			dryrun = true;
> +			break;
>  		case 'h':
>  			usage();
>  			return 0;
> 
Acked-by: Stefano Babic <sbabic@denx.de>

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/tools/client.c b/tools/client.c
index 3a7946b..73fef47 100644
--- a/tools/client.c
+++ b/tools/client.c
@@ -40,6 +40,7 @@  static void usage(void) {
 char buf[256];
 int fd;
 int verbose = 1;
+bool dryrun = false;
 
 pthread_mutex_t mymutex;
 
@@ -103,7 +104,7 @@  static int send_file(const char* filename) {
 	/* synchronize with a mutex */
 	pthread_mutex_lock(&mymutex);
 	rc = swupdate_async_start(readimage, printstatus,
-				end, false);
+				end, dryrun);
 	if (rc)
 		printf("swupdate_async_start returns %d\n", rc);
 
@@ -126,8 +127,11 @@  int main(int argc, char *argv[]) {
 	pthread_mutex_init(&mymutex, NULL);
 
 	/* parse command line options */
-	while ((c = getopt(argc, argv, "hqv")) != EOF) {
+	while ((c = getopt(argc, argv, "dhqv")) != EOF) {
 		switch (c) {
+		case 'd':
+			dryrun = true;
+			break;
 		case 'h':
 			usage();
 			return 0;