WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] [Mini-OS] Add strrchr()

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [Mini-OS] Add strrchr()
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 23 Nov 2007 17:40:10 -0800
Delivery-date: Fri, 23 Nov 2007 17:40:40 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1195836164 0
# Node ID dc9246357cdbe27655fd0ac7ef229d25b00c628c
# Parent  b1324eca1cd991001b4f8ea75e1121b29cec7b4a
[Mini-OS] Add strrchr()

Add strrchr(), useful e.g. for grabbing the last part of a xenbus
path.

Signed-off-by: Samuel Thibault <samuel.thibault@xxxxxxxxxx>
---
 extras/mini-os/include/lib.h |    1 +
 extras/mini-os/lib/string.c  |    9 +++++++++
 2 files changed, 10 insertions(+)

diff -r b1324eca1cd9 -r dc9246357cdb extras/mini-os/include/lib.h
--- a/extras/mini-os/include/lib.h      Fri Nov 23 16:42:23 2007 +0000
+++ b/extras/mini-os/include/lib.h      Fri Nov 23 16:42:44 2007 +0000
@@ -87,6 +87,7 @@ size_t strnlen(const char *s, size_t cou
 size_t strnlen(const char *s, size_t count);
 size_t strlen(const char *s);
 char  *strchr(const char *s, int c);
+char  *strrchr(const char *s, int c);
 char  *strstr(const char *s1, const char *s2);
 char * strcat(char * dest, const char * src);
 char  *strdup(const char *s);
diff -r b1324eca1cd9 -r dc9246357cdb extras/mini-os/lib/string.c
--- a/extras/mini-os/lib/string.c       Fri Nov 23 16:42:23 2007 +0000
+++ b/extras/mini-os/lib/string.c       Fri Nov 23 16:42:44 2007 +0000
@@ -140,6 +140,15 @@ char * strchr(const char * s, int c)
         return (char *)s;
 }
 
+char * strrchr(const char * s, int c)
+{
+        const char *res;
+        for(; *s != '\0'; ++s)
+                if (*s == (char) c)
+                        res = s;
+        return (char *)res;
+}
+
 char * strstr(const char * s1,const char * s2)
 {
         int l1, l2;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [Mini-OS] Add strrchr(), Xen patchbot-unstable <=