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 3/4] automount: optionally make directory
Date: Sun, 15 Apr 2012 16:51:56 +0200	[thread overview]
Message-ID: <1334501517-29478-4-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1334501517-29478-1-git-send-email-s.hauer@pengutronix.de>

Add an option to create the mount path to make using this command easier.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 commands/automount.c |   13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/commands/automount.c b/commands/automount.c
index 8c0e4de..aa1e417 100644
--- a/commands/automount.c
+++ b/commands/automount.c
@@ -27,9 +27,9 @@
 
 static int do_automount(int argc, char *argv[])
 {
-	int opt, ret;
+	int opt, ret, make_dir = 0;
 
-	while ((opt = getopt(argc, argv, "lr:")) > 0) {
+	while ((opt = getopt(argc, argv, "lr:d")) > 0) {
 		switch (opt) {
 		case 'l':
 			automount_print();
@@ -37,12 +37,21 @@ static int do_automount(int argc, char *argv[])
 		case 'r':
 			automount_remove(optarg);
 			return 0;
+		case 'd':
+			make_dir = 1;
+			break;
 		}
 	}
 
 	if (optind + 2 != argc)
 		return COMMAND_ERROR_USAGE;
 
+	if (make_dir) {
+		ret = make_directory(argv[optind]);
+		if (ret)
+			return ret;
+	}
+
 	ret = automount_add(argv[optind], argv[optind + 1]);
 	if (ret)
 		printf("adding automountpoint failed: %s\n",
-- 
1.7.10


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

  parent reply	other threads:[~2012-04-15 14:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-15 14:51 [PATCH] automount work Sascha Hauer
2012-04-15 14:51 ` [PATCH 1/4] automount: Pass automount pass as environment variable Sascha Hauer
2012-04-15 14:51 ` [PATCH 2/4] automount: fix argument parsing Sascha Hauer
2012-04-15 14:51 ` Sascha Hauer [this message]
2012-04-15 14:51 ` [PATCH 4/4] automount: remove existing automountpoint Sascha Hauer

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=1334501517-29478-4-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