|
[ source navigation ] [ diff markup ] [ identifier search ] [ general search ] |
|||
|
001 /* Copyright (C) 2003 The KOS Team 001 /* Copyright (C) 2003 The KOS Team 002 Copyright (C) 1999 Free Software Foundatio 002 Copyright (C) 1999 Free Software Foundation 003 003 004 This program is free software; you can redi 004 This program is free software; you can redistribute it and/or 005 modify it under the terms of the GNU Genera 005 modify it under the terms of the GNU General Public License 006 as published by the Free Software Foundatio 006 as published by the Free Software Foundation; either version 2 007 of the License, or (at your option) any lat 007 of the License, or (at your option) any later version. 008 008 009 This program is distributed in the hope tha 009 This program is distributed in the hope that it will be useful, 010 but WITHOUT ANY WARRANTY; without even the 010 but WITHOUT ANY WARRANTY; without even the implied warranty of 011 MERCHANTABILITY or FITNESS FOR A PARTICULAR 011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 012 GNU General Public License for more details 012 GNU General Public License for more details. 013 013 014 You should have received a copy of the GNU 014 You should have received a copy of the GNU General Public License 015 along with this program; if not, write to t 015 along with this program; if not, write to the Free Software 016 Foundation, Inc., 59 Temple Place - Suite 3 016 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 017 USA. 017 USA. 018 */ 018 */ 019 #ifndef _SOS_LIBC_STRING_H_ 019 #ifndef _SOS_LIBC_STRING_H_ 020 #define _SOS_LIBC_STRING_H_ 020 #define _SOS_LIBC_STRING_H_ 021 021 022 #include <types.h> 022 #include <types.h> 023 023 024 /** 024 /** 025 * @file string.h 025 * @file string.h 026 * 026 * 027 * Most of the prototypes of these functions a 027 * Most of the prototypes of these functions are borrowed from 028 * FreeBSD, but their implementation (in klibc 028 * FreeBSD, but their implementation (in klibc.c) come either from Kos 029 * (GPL v2) or from David Decotigny (SOS). 029 * (GPL v2) or from David Decotigny (SOS). 030 */ 030 */ 031 031 032 void *memcpy(void *dst, const void *src, regis 032 void *memcpy(void *dst, const void *src, register unsigned int size ) ; 033 void *memset(void *dst, register int c, regist 033 void *memset(void *dst, register int c, register unsigned int length ) ; 034 int memcmp(const void *s1, const void *s2, siz 034 int memcmp(const void *s1, const void *s2, size_t n); 035 035 036 unsigned int strlen( register const char *str) 036 unsigned int strlen( register const char *str) ; 037 unsigned int strnlen(const char * s, size_t ma 037 unsigned int strnlen(const char * s, size_t maxlen); 038 038 039 /** 039 /** 040 * @note Same as strncpy(), with a slightly di 040 * @note Same as strncpy(), with a slightly different semantic. 041 * Actually, strncpy(3C) says " The result wil 041 * Actually, strncpy(3C) says " The result will not be null-terminated 042 * if the length of 'from' is n or more.". He 042 * if the length of 'from' is n or more.". Here, 'dst' is ALWAYS 043 * null-terminated. And its total len will ALW 043 * null-terminated. And its total len will ALWAYS be <= len, with 044 * null-terminating-char included. 044 * null-terminating-char included. 045 */ 045 */ 046 char *strzcpy( register char *dst, register co 046 char *strzcpy( register char *dst, register const char *src, 047 register int len ) ; 047 register int len ) ; 048 048 049 /** 049 /** 050 * @note Same as strncat(), with the same sema 050 * @note Same as strncat(), with the same semantic : 'dst' is ALWAYS 051 * null-terminated. And its total len will ALW 051 * null-terminated. And its total len will ALWAYS be <= len, with 052 * null-terminating-char included. 052 * null-terminating-char included. 053 */ 053 */ 054 char *strzcat (char *dest, const char *src, 054 char *strzcat (char *dest, const char *src, 055 const size_t len); 055 const size_t len); 056 056 057 int strcmp(register const char *s1, register c 057 int strcmp(register const char *s1, register const char *s2 ); 058 int strncmp(register const char *s1, register 058 int strncmp(register const char *s1, register const char *s2, 059 register int len ); 059 register int len ); 060 060 061 #endif /* _SOS_LIBC_STRING_H_ */ 061 #endif /* _SOS_LIBC_STRING_H_ */
[ source navigation ] | [ diff markup ] | [ identifier search ] | [ general search ] |