POK
/home/jaouen/pok_official/pok/trunk/libpok/libc/string/streq.c
00001 /*
00002  *                               POK header
00003  * 
00004  * The following file is a part of the POK project. Any modification should
00005  * made according to the POK licence. You CANNOT use this file or a part of
00006  * this file is this part of a file for your own project
00007  *
00008  * For more information on the POK licence, please see our LICENCE FILE
00009  *
00010  * Please follow the coding guidelines described in doc/CODING_GUIDELINES
00011  *
00012  *                                      Copyright (c) 2007-2009 POK team 
00013  *
00014  * Created by julien on Thu Jan 15 23:34:13 2009 
00015  */
00016 
00017 #include <core/dependencies.h>
00018 #include <libc/string.h>
00019 #include <types.h>
00020 
00021 #ifdef POK_CONFIG_NEEDS_FUNC_STREQ
00022 
00023 /*
00024 ** XXX: This is really crap !
00025 **
00026 ** Please use strcmp instead.
00027 */
00028 int streq (char* s1, char* s2)
00029 {
00030    char* s11 = s1;
00031    char* s22 = s2;
00032 
00033    uint8_t minlen = strlen (s1) < strlen (s2) ? strlen (s1) : strlen (s2);
00034    while( ((s11 != NULL) && (s22 != NULL)) && (minlen > 0))
00035    {
00036       if (*s11 != *s22)
00037       {
00038          return 0;
00039       }
00040       minlen--;
00041       s11++;
00042       s22++;
00043    }
00044 
00045    return 1;
00046 }
00047 
00048 #endif
00049