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
Cc: Patrice Vilchez <patrice.vilchez@atmel.com>,
	Nicolas Ferre <nicolas.ferre@atmel.com>
Subject: [PATCH 1/3] string: add skip_spaces support
Date: Thu, 27 Jan 2011 14:02:21 +0100	[thread overview]
Message-ID: <1296133343-7834-1-git-send-email-plagnioj@jcrosoft.com> (raw)

need by parse_args for the command line parsing

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: Patrice Vilchez <patrice.vilchez@atmel.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-27 13:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-27 13:02 Jean-Christophe PLAGNIOL-VILLARD [this message]
2011-01-27 13:02 ` [PATCH 2/3] add command line boot support Jean-Christophe PLAGNIOL-VILLARD
2011-01-27 13:02 ` [PATCH 3/3] cmdline: add section initsetup_calls to be able to discard them Jean-Christophe PLAGNIOL-VILLARD
  -- strict thread matches above, loose matches on Subject: below --
2011-01-26 16:43 [RFC] Boot command line support Jean-Christophe PLAGNIOL-VILLARD
2011-01-26 16:46 ` [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=1296133343-7834-1-git-send-email-plagnioj@jcrosoft.com \
    --to=plagnioj@jcrosoft.com \
    --cc=barebox@lists.infradead.org \
    --cc=nicolas.ferre@atmel.com \
    --cc=patrice.vilchez@atmel.com \
    /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