EDK2 doxygen online documents - Firmware Encoding Index 1
EDK2 doxygen online documents - Firmware Encoding Index

StdLib/LibC/Locale/wcsxfrm.c

Go to the documentation of this file.
00001 /*  $NetBSD: wcsxfrm.c,v 1.2 2006/10/15 16:14:08 christos Exp $ */
00002 
00003 /*-
00004  * Copyright (c)2003 Citrus Project,
00005  * All rights reserved.
00006  *
00007  * Redistribution and use in source and binary forms, with or without
00008  * modification, are permitted provided that the following conditions
00009  * are met:
00010  * 1. Redistributions of source code must retain the above copyright
00011  *    notice, this list of conditions and the following disclaimer.
00012  * 2. Redistributions in binary form must reproduce the above copyright
00013  *    notice, this list of conditions and the following disclaimer in the
00014  *    documentation and/or other materials provided with the distribution.
00015  *
00016  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
00017  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00018  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00019  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
00020  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00021  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00022  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00023  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00024  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00025  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00026  * SUCH DAMAGE.
00027  */
00028 #include  <LibConfig.h>
00029 #include  <sys/EfiCdefs.h>
00030 #if defined(LIBC_SCCS) && !defined(lint)
00031 __RCSID("$NetBSD: wcsxfrm.c,v 1.2 2006/10/15 16:14:08 christos Exp $");
00032 #endif /* LIBC_SCCS and not lint */
00033 
00034 #include "namespace.h"
00035 
00036 #include <assert.h>
00037 #include <wchar.h>
00038 
00039 /*
00040  * Compare strings with using collating information.
00041  */
00042 size_t
00043 wcsxfrm(
00044   wchar_t *s1,
00045   const wchar_t *s2,
00046   size_t n
00047   )
00048 {
00049   size_t len;
00050 
00051   /* XXX: LC_COLLATE should be implemented. */
00052 
00053   len = wcslen(s2);
00054   if (len<n)
00055     wcscpy(s1, s2);
00056   else {
00057     /*
00058      * SUSv3 says:
00059      *   If the value returned is n or more, the contents
00060      *   of the array pointed to by ws1 are unspecified.
00061      */
00062     /* thus, do nothing */
00063   }
00064 
00065   return (len);
00066 }
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Defines