mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: barebox@lists.infradead.org
Subject: [PATCH 1/3] string: add skip_spaces support
Date: Wed, 26 Jan 2011 17:46:02 +0100	[thread overview]
Message-ID: <1296060364-23113-1-git-send-email-plagnioj@jcrosoft.com> (raw)
In-Reply-To: <20110126164348.GF1441@game.jcrosoft.org>

need by parse_args for the command line parsing

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 include/linux/string.h |    1 +
 lib/string.c           |   14 ++++++++++++++
 2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/include/linux/string.h b/include/linux/string.h
index 62d743e..b4b48fb 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -59,6 +59,7 @@ extern char * _strchr(const char *,int);
 #ifndef __HAVE_ARCH_STRRCHR
 extern char * _strrchr(const char *,int);
 #endif
+extern char * skip_spaces(const char *);
 #ifndef __HAVE_ARCH_STRSTR
 extern char * _strstr(const char *,const char *);
 #endif
diff --git a/lib/string.c b/lib/string.c
index 77435aa..5ffb861 100644
--- a/lib/string.c
+++ b/lib/string.c
@@ -214,6 +214,20 @@ char * _strrchr(const char * s, int c)
 #endif
 EXPORT_SYMBOL(_strrchr);
 
+/**
+ * skip_spaces - Removes leading whitespace from @str.
+ * @str: The string to be stripped.
+ *
+ * Returns a pointer to the first non-whitespace character in @str.
+ */
+char *skip_spaces(const char *str)
+{
+	while (isspace(*str))
+		++str;
+	return (char *)str;
+}
+EXPORT_SYMBOL(skip_spaces);
+
 #ifndef __HAVE_ARCH_STRLEN
 /**
  * strlen - Find the length of a string
-- 
1.7.2.3


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

  reply	other threads:[~2011-01-26 16:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-26 16:43 [RFC] Boot command line support Jean-Christophe PLAGNIOL-VILLARD
2011-01-26 16:46 ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2011-01-26 16:46 ` [PATCH 2/3] add command line boot support Jean-Christophe PLAGNIOL-VILLARD
2011-01-27  9:20   ` Sascha Hauer
2011-01-27 11:55     ` Jean-Christophe PLAGNIOL-VILLARD
2011-01-27 13:10       ` Sascha Hauer
2011-01-27 13:15         ` Jean-Christophe PLAGNIOL-VILLARD
2011-01-26 16:46 ` [PATCH 3/3] __setup test Jean-Christophe PLAGNIOL-VILLARD
2014-02-07 11:04 ` [RFC] Boot command line support Jean-Christophe PLAGNIOL-VILLARD
2011-01-27 13:02 [PATCH 1/3] string: add skip_spaces support 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=1296060364-23113-1-git-send-email-plagnioj@jcrosoft.com \
    --to=plagnioj@jcrosoft.com \
    --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