* strnlen for klibc
@ 2004-07-15 9:07 Harald Hoyer
2004-07-15 16:39 ` H. Peter Anvin
0 siblings, 1 reply; 2+ messages in thread
From: Harald Hoyer @ 2004-07-15 9:07 UTC (permalink / raw)
To: linux-hotplug
[-- Attachment #1: Type: text/plain, Size: 34 bytes --]
this implements strnlen for klibc
[-- Attachment #2: udev-025-klibc-strnlen.patch --]
[-- Type: text/x-patch, Size: 854 bytes --]
--- udev-025/klibc/klibc/strlen.c.strnlen 2004-04-21 23:39:10.000000000 +0200
+++ udev-025/klibc/klibc/strlen.c 2004-06-02 15:25:47.840212248 +0200
@@ -12,3 +12,13 @@
return ss-s;
}
+size_t strnlen(const char *s, size_t maxlen)
+{
+ const char *ss = s;
+ while(*ss && (maxlen > 0)) {
+ ss++;
+ maxlen--;
+ }
+ return ss-s;
+}
+
--- udev-025/klibc/klibc/include/string.h.strnlen 2004-06-02 15:26:45.185494440 +0200
+++ udev-025/klibc/klibc/include/string.h 2004-06-02 15:27:06.987180080 +0200
@@ -27,6 +27,7 @@
__extern char *strndup(const char *, size_t);
__extern char *strerror(int);
__extern size_t strlen(const char *);
+__extern size_t strnlen(const char *, size_t);
__extern char *strncat(char *, const char *, size_t);
__extern int strncmp(const char *, const char *, size_t);
__extern char *strncpy(char *, const char *, size_t);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-07-15 16:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-15 9:07 strnlen for klibc Harald Hoyer
2004-07-15 16:39 ` H. Peter Anvin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).