From: Pekka Enberg <penberg@cs.helsinki.fi>
To: Michael Holzheu <holzheu@de.ibm.com>
Cc: ioe-lkml@rameria.de, linux-kernel@vger.kernel.org,
mschwid2@de.ibm.com, joern@wohnheim.fh-wedel.de
Subject: Re: [PATCH/RFC] s390: Hypervisor File System
Date: Tue, 25 Apr 2006 10:32:16 +0300 [thread overview]
Message-ID: <1145950336.11463.8.camel@localhost> (raw)
In-Reply-To: <1145948304.11463.5.camel@localhost>
On Mon, 2006-04-24 at 19:19 +0200, Michael Holzheu wrote:
> > +#ifndef __HAVE_ARCH_STRRTRIM
> > +/**
> > + * strrtrim - Remove trailing characters specified in @reject
> > + * @s: The string to be searched
> > + * @reject: The string of letters to avoid
> > + */
> > +void strrtrim(char *s, const char *reject)
On Tue, 2006-04-25 at 09:58 +0300, Pekka Enberg wrote:
> I think this should return s to be consistent with other string API
> functions.
Hmm, thinking about this, I think a better API would be to not have that
reject parameter at all. Would something like this be accetable for your
use?
Pekka
diff --git a/include/linux/string.h b/include/linux/string.h
index c61306d..3d66cae 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -56,6 +56,9 @@ #endif
#ifndef __HAVE_ARCH_STRRCHR
extern char * strrchr(const char *,int);
#endif
+#ifndef __HAVE_ARCH_STRSTRIP
+extern char * strstrip(char *);
+#endif
#ifndef __HAVE_ARCH_STRSTR
extern char * strstr(const char *,const char *);
#endif
diff --git a/lib/string.c b/lib/string.c
index 064f631..5b4257d 100644
--- a/lib/string.c
+++ b/lib/string.c
@@ -301,6 +301,38 @@ char *strnchr(const char *s, size_t coun
EXPORT_SYMBOL(strnchr);
#endif
+#ifndef __HAVE_ARCH_STRSTRIP
+/**
+ * strstrip - Removes leading and trailing whitespace from @s.
+ * @s: The string to be stripped.
+ *
+ * Note that the first trailing whitespace is replaced with a %NUL-terminator
+ * in the given string @s. Returns a pointer to the first non-whitespace
+ * character in @s.
+ */
+char *strstrip(char *s)
+{
+ size_t size;
+ char *end;
+
+ size = strlen(s);
+
+ if (!size)
+ return s;
+
+ end = s + size - 1;
+ while (end != s && isspace(*end))
+ end--;
+ *(end + 1) = '\0';
+
+ while (*s && isspace(*s))
+ s++;
+
+ return s;
+}
+EXPORT_SYMBOL(strstrip);
+#endif
+
#ifndef __HAVE_ARCH_STRLEN
/**
* strlen - Find the length of a string
next prev parent reply other threads:[~2006-04-25 7:32 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-24 17:19 [PATCH/RFC] s390: Hypervisor File System Michael Holzheu
2006-04-25 6:58 ` Pekka Enberg
2006-04-25 7:32 ` Pekka Enberg [this message]
2006-04-25 7:47 ` Andrew Morton
2006-04-25 8:01 ` Pekka Enberg
2006-04-25 8:52 ` Jörn Engel
2006-04-25 9:00 ` Pekka Enberg
2006-04-25 12:22 ` Michael Holzheu
2006-04-25 14:33 ` Pekka Enberg
2006-04-25 14:45 ` Jörn Engel
2006-04-26 9:30 ` Michael Holzheu
-- strict thread matches above, loose matches on Subject: below --
2006-04-21 11:35 Michael Holzheu
2006-04-21 11:53 ` Pekka Enberg
2006-04-21 13:56 ` Michael Holzheu
2006-04-21 14:55 ` Arnd Bergmann
2006-04-21 15:31 ` Michael Holzheu
2006-04-21 13:32 ` Pekka Enberg
2006-04-21 14:08 ` Michael Holzheu
2006-04-21 15:38 ` Pekka Enberg
2006-04-21 16:40 ` Martin Schwidefsky
2006-04-25 14:04 ` Pekka Enberg
2006-04-21 14:42 ` Pekka Enberg
2006-04-21 14:59 ` Michael Holzheu
2006-04-21 15:41 ` Pekka Enberg
2006-04-21 15:18 ` Jörn Engel
2006-04-21 15:36 ` Michael Holzheu
2006-04-21 15:46 ` Jörn Engel
2006-04-21 22:30 ` Ingo Oeser
2006-04-24 17:17 ` Michael Holzheu
2006-04-24 19:57 ` Ingo Oeser
2006-04-25 6:27 ` Pekka Enberg
2006-04-24 17:19 ` Michael Holzheu
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=1145950336.11463.8.camel@localhost \
--to=penberg@cs.helsinki.fi \
--cc=holzheu@de.ibm.com \
--cc=ioe-lkml@rameria.de \
--cc=joern@wohnheim.fh-wedel.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mschwid2@de.ibm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.