summaryrefslogtreecommitdiffstats
path: root/scripts/bareboxenv.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2012-09-27 10:18:40 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2012-09-28 16:21:30 +0200
commitc861e4cab67bffacd1b85bd19861304f8cc7acf5 (patch)
tree23ff32dfe40e5ec486b392e72e108b8927a24c0c /scripts/bareboxenv.c
parent1af6fdcd03dbc311d785625bd6e2329f7ce1adb7 (diff)
downloadbarebox-c861e4cab67bffacd1b85bd19861304f8cc7acf5.tar.gz
barebox-c861e4cab67bffacd1b85bd19861304f8cc7acf5.tar.xz
scripts/bareboxenv: Only print information if -v is given
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'scripts/bareboxenv.c')
-rw-r--r--scripts/bareboxenv.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/scripts/bareboxenv.c b/scripts/bareboxenv.c
index f7f5351ca6..91f5bc29d8 100644
--- a/scripts/bareboxenv.c
+++ b/scripts/bareboxenv.c
@@ -133,7 +133,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);
}
@@ -142,8 +143,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;
@@ -154,6 +156,9 @@ int main(int argc, char *argv[])
case 'p':
pad = strtoul(optarg, NULL, 0);
break;
+ case 'v':
+ verbose = 1;
+ break;
}
}
@@ -187,11 +192,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);