diff options
author | Steve French <sfrench@us.ibm.com> | 2007-07-19 02:38:57 +0200 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2007-07-19 02:38:57 +0200 |
commit | 1ff8392c32a2645d2665ca779ecb91bb29361c13 (patch) | |
tree | 860b95e9a499ade4060848740fc6ce1fbb4e4e8d /arch/i386/boot/string.c | |
parent | [CIFS] merge conflict in fs/cifs/export.c (diff) | |
parent | Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hsk... (diff) | |
download | linux-1ff8392c32a2645d2665ca779ecb91bb29361c13.tar.xz linux-1ff8392c32a2645d2665ca779ecb91bb29361c13.zip |
Merge branch 'master' of /pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts:
fs/cifs/export.c
Diffstat (limited to 'arch/i386/boot/string.c')
-rw-r--r-- | arch/i386/boot/string.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/arch/i386/boot/string.c b/arch/i386/boot/string.c new file mode 100644 index 000000000000..481a22097781 --- /dev/null +++ b/arch/i386/boot/string.c @@ -0,0 +1,52 @@ +/* -*- linux-c -*- ------------------------------------------------------- * + * + * Copyright (C) 1991, 1992 Linus Torvalds + * Copyright 2007 rPath, Inc. - All Rights Reserved + * + * This file is part of the Linux kernel, and is made available under + * the terms of the GNU General Public License version 2. + * + * ----------------------------------------------------------------------- */ + +/* + * arch/i386/boot/string.c + * + * Very basic string functions + */ + +#include "boot.h" + +int strcmp(const char *str1, const char *str2) +{ + const unsigned char *s1 = (const unsigned char *)str1; + const unsigned char *s2 = (const unsigned char *)str2; + int delta = 0; + + while (*s1 || *s2) { + delta = *s2 - *s1; + if (delta) + return delta; + s1++; + s2++; + } + return 0; +} + +size_t strnlen(const char *s, size_t maxlen) +{ + const char *es = s; + while (*es && maxlen) { + es++; + maxlen--; + } + + return (es - s); +} + +unsigned int atou(const char *s) +{ + unsigned int i = 0; + while (isdigit(*s)) + i = i * 10 + (*s++ - '0'); + return i; +} |