diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2007-10-11 05:16:45 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2007-10-11 05:16:45 -0400 |
commit | 96ae6ea0be1b902c28b3b463c27da42b41e2b63a (patch) | |
tree | fbc18761d4fa93d7b0f6dbf3496289fa32bd363a /arch/x86/boot/string.c | |
parent | 0530bf37cebcf22a73652937c2340bc1ebd92000 (diff) |
i386: move boot
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/boot/string.c')
-rw-r--r-- | arch/x86/boot/string.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/arch/x86/boot/string.c b/arch/x86/boot/string.c new file mode 100644 index 000000000000..481a22097781 --- /dev/null +++ b/arch/x86/boot/string.c | |||
@@ -0,0 +1,52 @@ | |||
1 | /* -*- linux-c -*- ------------------------------------------------------- * | ||
2 | * | ||
3 | * Copyright (C) 1991, 1992 Linus Torvalds | ||
4 | * Copyright 2007 rPath, Inc. - All Rights Reserved | ||
5 | * | ||
6 | * This file is part of the Linux kernel, and is made available under | ||
7 | * the terms of the GNU General Public License version 2. | ||
8 | * | ||
9 | * ----------------------------------------------------------------------- */ | ||
10 | |||
11 | /* | ||
12 | * arch/i386/boot/string.c | ||
13 | * | ||
14 | * Very basic string functions | ||
15 | */ | ||
16 | |||
17 | #include "boot.h" | ||
18 | |||
19 | int strcmp(const char *str1, const char *str2) | ||
20 | { | ||
21 | const unsigned char *s1 = (const unsigned char *)str1; | ||
22 | const unsigned char *s2 = (const unsigned char *)str2; | ||
23 | int delta = 0; | ||
24 | |||
25 | while (*s1 || *s2) { | ||
26 | delta = *s2 - *s1; | ||
27 | if (delta) | ||
28 | return delta; | ||
29 | s1++; | ||
30 | s2++; | ||
31 | } | ||
32 | return 0; | ||
33 | } | ||
34 | |||
35 | size_t strnlen(const char *s, size_t maxlen) | ||
36 | { | ||
37 | const char *es = s; | ||
38 | while (*es && maxlen) { | ||
39 | es++; | ||
40 | maxlen--; | ||
41 | } | ||
42 | |||
43 | return (es - s); | ||
44 | } | ||
45 | |||
46 | unsigned int atou(const char *s) | ||
47 | { | ||
48 | unsigned int i = 0; | ||
49 | while (isdigit(*s)) | ||
50 | i = i * 10 + (*s++ - '0'); | ||
51 | return i; | ||
52 | } | ||