chiark / gitweb /
[PATCH] klibc: update to version 0.196
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>
Mon, 17 Jan 2005 08:26:07 +0000 (09:26 +0100)
committerGreg KH <gregkh@suse.de>
Wed, 27 Apr 2005 06:21:58 +0000 (23:21 -0700)
klibc/Makefile
klibc/include/string.h
klibc/klibc/Makefile
klibc/klibc/getopt.c
klibc/klibc/memchr.c
klibc/klibc/memrchr.c [new file with mode: 0644]
klibc/version

index 8823a33bfd94e51b0f6e2edb3ae62e79a283a29e..2506417ef5bbc7038e322f55d1f42b554a462902 100644 (file)
@@ -1,5 +1,5 @@
 VERSION := $(shell cat version)
-SUBDIRS = klibc
+SUBDIRS = klibc ash ipconfig nfsmount utils kinit gzip
 
 all:
 
index 3bbb217e98f2778e9e98e547ad480a59c2a7e341..5608a3c963dd1deaafe2c8cd90186f2e1459b0e5 100644 (file)
@@ -10,6 +10,7 @@
 
 __extern void *memccpy(void *, const void *, int, size_t);
 __extern void *memchr(const void *, int, size_t);
+__extern void *memrchr(const void *, int, size_t);
 __extern int memcmp(const void *, const void *, size_t);
 __extern void *memcpy(void *, const void *, size_t);
 __extern void *memmove(void *, const void *, size_t);
@@ -20,6 +21,7 @@ __extern int strcasecmp(const char *, const char *);
 __extern int strncasecmp(const char *, const char *, size_t);
 __extern char *strcat(char *, const char *);
 __extern char *strchr(const char *, int);
+__extern char *strrchr(const char *, int);
 __extern int strcmp(const char *, const char *);
 __extern char *strcpy(char *, const char *);
 __extern size_t strcspn(const char *, const char *);
@@ -34,7 +36,6 @@ __extern int strncmp(const char *, const char *, size_t);
 __extern char *strncpy(char *, const char *, size_t);
 __extern size_t strlcpy(char *, const char *, size_t);
 __extern char *strpbrk(const char *, const char *);
-__extern char *strrchr(const char *, int);
 __extern char *strsep(char **, const char *);
 __extern size_t strspn(const char *, const char *);
 __extern char *strstr(const char *, const char *);
index 0d44ce549442cfbed5cb730242a8cc7c90e09681..d01b2e43269b0c75ce7679bcf61637b7c3488eb8 100644 (file)
@@ -30,7 +30,7 @@ LIBOBJS = vsnprintf.o snprintf.o vsprintf.o sprintf.o \
          sigaction.o sigpending.o sigprocmask.o sigsuspend.o \
          brk.o sbrk.o malloc.o realloc.o calloc.o mmap.o \
          memcpy.o memcmp.o memset.o memccpy.o memmem.o memswap.o \
-         memmove.o memchr.o \
+         memmove.o memchr.o memrchr.o \
          strcasecmp.o strncasecmp.o strndup.o strerror.o \
          strcat.o strchr.o strcmp.o strcpy.o strdup.o strlen.o strnlen.o \
          strncat.o strlcpy.o strlcat.o \
index 5a992dcdd7370ed83d8cef04baa77c8251f1bfea..cd534bf3047997ebb465679073fc9156afab43d5 100644 (file)
@@ -51,6 +51,7 @@ int getopt(int argc, char * const *argv, const char *optstring)
          optind += 2;
        } else {
          /* Missing argument */
+         optind++;
          return (optstring[0] == ':') ? ':' : '?';
        }
       }
index c5c5fa29632672a8735465667b297c38549c3707..2e5e4cc7f20b977642af202c3b398042f0778e76 100644 (file)
@@ -12,6 +12,7 @@ void *memchr(const void *s, int c, size_t n)
   while ( n-- ) {
     if ( *sp == (unsigned char)c )
       return (void *)sp;
+    sp++;
   }
 
   return NULL;
diff --git a/klibc/klibc/memrchr.c b/klibc/klibc/memrchr.c
new file mode 100644 (file)
index 0000000..10d9c29
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * memrchr.c
+ */
+
+#include <stddef.h>
+#include <string.h>
+
+void *memrchr(const void *s, int c, size_t n)
+{
+  const unsigned char *sp =
+    (const unsigned char *)s + n - 1;
+
+  while ( n-- ) {
+    if ( *sp == (unsigned char)c )
+      return (void *)sp;
+    sp--;
+  }
+
+  return NULL;
+}
index b553d446e15dbf512a622c7fcf141aca85c3c575..3759b0aad007f9717b8c7edf8f5780b1151a1d5c 100644 (file)
@@ -1 +1 @@
-0.194
+0.196