mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 1/3] scripts/bareboxenv: Only print information if -v is given
Date: Thu, 27 Sep 2012 19:14:00 +0200	[thread overview]
Message-ID: <1348766042-18815-2-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1348766042-18815-1-git-send-email-s.hauer@pengutronix.de>

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 scripts/bareboxenv.c |   15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/scripts/bareboxenv.c b/scripts/bareboxenv.c
index a4aec94..f44a1f8 100644
--- a/scripts/bareboxenv.c
+++ b/scripts/bareboxenv.c
@@ -130,7 +130,8 @@ void usage(char *prgname)
 		"options:\n"
 		"  -s        save (directory -> environment sector)\n"
 		"  -l        load (environment sector -> directory)\n"
-		"  -p <size> pad output file to given size\n",
+		"  -p <size> pad output file to given size\n"
+		"  -v        verbose\n",
 		prgname);
 }
 
@@ -139,8 +140,9 @@ int main(int argc, char *argv[])
 	int opt;
 	int save = 0, load = 0, pad = 0, fd;
 	char *filename = NULL, *dirname = NULL;
+	int verbose = 0;
 
-	while((opt = getopt(argc, argv, "slp:")) != -1) {
+	while((opt = getopt(argc, argv, "slp:v")) != -1) {
 		switch (opt) {
 		case 's':
 			save = 1;
@@ -151,6 +153,9 @@ int main(int argc, char *argv[])
 		case 'p':
 			pad = strtoul(optarg, NULL, 0);
 			break;
+		case 'v':
+			verbose = 1;
+			break;
 		}
 	}
 
@@ -184,11 +189,13 @@ int main(int argc, char *argv[])
 	}
 
 	if (load) {
-		printf("loading env from file %s to %s\n", filename, dirname);
+		if (verbose)
+			printf("loading env from file %s to %s\n", filename, dirname);
 		envfs_load(filename, dirname);
 	}
 	if (save) {
-		printf("saving contents of %s to file %s\n", dirname, filename);
+		if (verbose)
+			printf("saving contents of %s to file %s\n", dirname, filename);
 		envfs_save(filename, dirname);
 	}
 	exit(0);
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2012-09-27 17:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-27 17:13 [PATCH] Fix environment generation dependencies Sascha Hauer
2012-09-27 17:14 ` Sascha Hauer [this message]
2012-09-27 17:14 ` [PATCH 2/3] environment generation: remove unused CLEAN_FILES Sascha Hauer
2012-09-27 17:14 ` [PATCH 3/3] environment generation: Fix dependencies Sascha Hauer
2012-09-27 18:42   ` Jean-Christophe PLAGNIOL-VILLARD

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1348766042-18815-2-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox