summaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
authorMarc Kleine-Budde <mkl@pengutronix.de>2015-03-05 15:37:14 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2015-03-06 07:43:49 +0100
commit7033089ddf4c62fa2cfd4549d2bbfe0c101c65d1 (patch)
treee9df57419b2a53d6adbeef23bebbc74ef7036d14 /commands
parent85799d1b755ad3ea1fd80cecd913eea6b00a5c87 (diff)
downloadbarebox-7033089ddf4c62fa2cfd4549d2bbfe0c101c65d1.tar.gz
barebox-7033089ddf4c62fa2cfd4549d2bbfe0c101c65d1.tar.xz
environment: envfs_{load, save}: add possibility to call with filename and dirname == NULL
This patch moves fallback to default into the envfs_{load,save} functions. Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands')
-rw-r--r--commands/saveenv.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/commands/saveenv.c b/commands/saveenv.c
index 43f16dc490..6f210b7ec1 100644
--- a/commands/saveenv.c
+++ b/commands/saveenv.c
@@ -27,7 +27,7 @@ static int do_saveenv(int argc, char *argv[])
{
int ret, opt;
unsigned envfs_flags = 0;
- char *filename, *dirname;
+ char *filename = NULL, *dirname = NULL;
printf("saving environment\n");
while ((opt = getopt(argc, argv, "z")) > 0) {
@@ -39,15 +39,11 @@ static int do_saveenv(int argc, char *argv[])
}
/* destination and source are given? */
- if (argc - optind < 2)
- dirname = "/env";
- else
+ if (argc - optind > 1)
dirname = argv[optind + 1];
/* destination only given? */
- if (argc - optind < 1)
- filename = default_environment_path_get();
- else
+ if (argc - optind > 0)
filename = argv[optind];
ret = envfs_save(filename, dirname, envfs_flags);