fix config file path
[AROS.git] / compiler / clib / mblen.c
blob7ed2e8d51eb126baa8ec99926251ee5d8f08bfe4
1 /*
2 Copyright © 2004-2012, The AROS Development Team. All rights reserved.
3 $Id$
5 C99 function mblen().
6 */
8 #include <aros/debug.h>
10 /*****************************************************************************
12 NAME */
14 #include <string.h>
15 #include <stdlib.h>
17 int mblen(
19 /* SYNOPSIS */
20 const char *s,
21 size_t n)
23 /* FUNCTION
24 This function returns the number of bytes of the next multi-byte
25 character.
27 INPUTS
28 s: string pointer to look at next multi-byte character.
29 n: The maximum number of bytes to look at.
31 RESULT
32 if s is not NULL will return the length in bytes of the next
33 multi-byte character in s; 0 is return when it is a NULL
34 byte character; -1 if it is not a valid multi-byte character.
35 If s is NULL zero or non-zero is returned when multi-byte encodings
36 resp. don't or do have state-dependent encodings.
38 NOTES
39 arosc.library currently only implements the "C" locale
40 This means that either 0 or 1 is returned when s is not NULL.
42 EXAMPLE
44 BUGS
46 SEE ALSO
48 INTERNALS
50 ******************************************************************************/
52 if (s == NULL)
53 /* No state-dependent encondings */
54 return 0;
56 if (n == 0 || *s == '\0')
57 return 0;
59 if (isascii(*s))
60 return 1;
61 else
62 return -1;