strncoll2.c

Go to the documentation of this file.
00001 #ifdef HAVE_CONFIG_H
00002 #include "config.h"
00003 #endif /* HAVE_CONFIG_H */
00004 
00005 #ifndef HAVE_STRNCOLL
00006 
00007 #include <string.h>
00008 #include <clib.h>
00009 
00010 /* AIX requires this to be the first thing in the file.  */
00011 #ifndef __GNUC__
00012 # if HAVE_ALLOCA_H
00013 #  include <alloca.h>
00014 # else
00015 #  ifdef _AIX
00016 #pragma alloca
00017 #  else
00018 #   ifndef alloca /* predefined by HP cc +Olibcalls */
00019 char *alloca ();
00020 #   endif
00021 #  endif
00022 # endif
00023 #endif
00024 
00025 int strncoll(const char* a, const char* b, int len)
00026 {
00027   char* tmpa = (char*)alloca(len + 1);
00028   char* tmpb = (char*)alloca(len + 1);
00029   
00030   memcpy(tmpa, a, len);
00031   tmpa[len] = '\0';
00032 
00033   memcpy(tmpb, b, len);
00034   tmpb[len] = '\0';
00035 
00036   return strcoll(tmpa, tmpb);
00037 }
00038 
00039 #endif /* HAVE_STRNCOLL */

Generated on Sun Jun 8 10:56:34 2008 for GNUmifluz by  doxygen 1.5.5