SimpleOS

LXR

Navigation



Site hébergé par : enix

The LXR Cross Referencer for SOS

source navigation ]
diff markup ]
identifier search ]
general search ]
 
 
Article:1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 6.5 ] [ 7 ] [ 7.5 ] [ 8 ] [ 9 ] [ 9.5 ]

001 /* Copyright (C) 2003  The KOS Team
002    Copyright (C) 1999  Free Software Foundation
003 
004    This program is free software; you can redistribute it and/or
005    modify it under the terms of the GNU General Public License
006    as published by the Free Software Foundation; either version 2
007    of the License, or (at your option) any later version.
008    
009    This program is distributed in the hope that it will be useful,
010    but WITHOUT ANY WARRANTY; without even the implied warranty of
011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
012    GNU General Public License for more details.
013    
014    You should have received a copy of the GNU General Public License
015    along with this program; if not, write to the Free Software
016    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
017    USA. 
018 */
019 #ifndef _SOS_LIBC_STRING_H_
020 #define _SOS_LIBC_STRING_H_
021 
022 #include <types.h>
023 
024 /**
025  * @file string.h
026  *
027  * Most of the prototypes of these functions are borrowed from
028  * FreeBSD, but their implementation (in klibc.c) come either from Kos
029  * (GPL v2) or from David Decotigny (SOS).
030  */
031 
032 void *memcpy(void *dst, const void *src, register unsigned int size ) ;
033 void *memset(void *dst, register int c, register unsigned int length ) ;
034 int memcmp(const void *s1, const void *s2, size_t n);
035 
036 unsigned int strlen( register const char *str) ;
037 unsigned int strnlen(const char * s, size_t maxlen);
038 
039 /**
040  * @note Same as strncpy(), with a slightly different semantic.
041  * Actually, strncpy(3C) says " The result will not be null-terminated
042  * if the length of 'from' is n or more.".  Here, 'dst' is ALWAYS
043  * null-terminated. And its total len will ALWAYS be <= len, with
044  * null-terminating-char included.
045  */
046 char *strzcpy( register char *dst, register const char *src,
047                register int len ) ;
048 
049 /**
050  * @note Same as strncat(), with the same semantic : 'dst' is ALWAYS
051  * null-terminated. And its total len will ALWAYS be <= len, with
052  * null-terminating-char included.
053  */
054 char *strzcat (char *dest, const char *src,
055                const size_t len);
056  
057 int strcmp(register const char *s1, register const char *s2 );
058 int strncmp(register const char *s1, register const char *s2,
059             register int len );
060 
061 
062 #define islower(c)  (('a' <= (c)) && ((c) <= 'z'))
063 #define isupper(c)  (('A' <= (c)) && ((c) <= 'Z'))
064 #define isdigit(c)  (('0' <= (c)) && ((c) <= '9'))
065 #define isspace(c)  (((c) == ' ') || ((c) == '\t') || \
066                     ((c) == '\f') || ((c) == '\n') || \
067                     ((c) == '\r') || ((c) == '\v'))
068 #define isprint(c)  ((' ' <= (c)) && ((c) <= '~'))
069 
070 long long int strtoll(const char *nptr, char **endptr, int base);
071 long int strtol(const char *nptr, char **endptr, int base);
072 long long atoll(const char *nptr);
073 long atol(const char *nptr);
074 
075 
076 #endif /* _SOS_LIBC_STRING_H_ */

source navigation ] diff markup ] identifier search ] general search ]