temp: SR: IO_ADDRESS conversion
[linux-ginger.git] / arch / x86 / boot / string.c
blobf94b7a0c2abf8e2477ec5589a54ba682872f680b
1 /* -*- linux-c -*- ------------------------------------------------------- *
3 * Copyright (C) 1991, 1992 Linus Torvalds
4 * Copyright 2007 rPath, Inc. - All Rights Reserved
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.
9 * ----------------------------------------------------------------------- */
12 * Very basic string functions
15 #include "boot.h"
17 int strcmp(const char *str1, const char *str2)
19 const unsigned char *s1 = (const unsigned char *)str1;
20 const unsigned char *s2 = (const unsigned char *)str2;
21 int delta = 0;
23 while (*s1 || *s2) {
24 delta = *s2 - *s1;
25 if (delta)
26 return delta;
27 s1++;
28 s2++;
30 return 0;
33 size_t strnlen(const char *s, size_t maxlen)
35 const char *es = s;
36 while (*es && maxlen) {
37 es++;
38 maxlen--;
41 return (es - s);
44 unsigned int atou(const char *s)
46 unsigned int i = 0;
47 while (isdigit(*s))
48 i = i * 10 + (*s++ - '0');
49 return i;