1 | /*
|
---|
2 | * Copyright (C) 1991, 1992 Linus Torvalds
|
---|
3 | * Copyright (C) 2004 Tobias Lorenz
|
---|
4 | *
|
---|
5 | * string handling functions
|
---|
6 | * based on linux/include/linux/ctype.h
|
---|
7 | * and linux/include/linux/string.h
|
---|
8 | *
|
---|
9 | * This program is free software; you can redistribute it and/or modify
|
---|
10 | * it under the terms of the GNU General Public License version 2 as
|
---|
11 | * published by the Free Software Foundation.
|
---|
12 | */
|
---|
13 |
|
---|
14 | #ifndef ETHERBOOT_STRING_H
|
---|
15 | #define ETHERBOOT_STRING_H
|
---|
16 |
|
---|
17 | #include "bits/string.h"
|
---|
18 |
|
---|
19 |
|
---|
20 | /* *** FROM ctype.h *** */
|
---|
21 |
|
---|
22 | #define isdigit(c) ((c & 0x04) != 0)
|
---|
23 | #define islower(c) ((c & 0x02) != 0)
|
---|
24 | //#define isspace(c) ((c & 0x20) != 0)
|
---|
25 | #define isupper(c) ((c & 0x01) != 0)
|
---|
26 |
|
---|
27 | static inline unsigned char tolower(unsigned char c)
|
---|
28 | {
|
---|
29 | if (isupper(c))
|
---|
30 | c -= 'A'-'a';
|
---|
31 | return c;
|
---|
32 | }
|
---|
33 |
|
---|
34 | static inline unsigned char toupper(unsigned char c)
|
---|
35 | {
|
---|
36 | if (islower(c))
|
---|
37 | c -= 'a'-'A';
|
---|
38 | return c;
|
---|
39 | }
|
---|
40 |
|
---|
41 |
|
---|
42 | /* *** FROM string.h *** */
|
---|
43 |
|
---|
44 | int strnicmp(const char *s1, const char *s2, size_t len);
|
---|
45 | char * strcpy(char * dest,const char *src);
|
---|
46 | char * strncpy(char * dest,const char *src,size_t count);
|
---|
47 | char * strcat(char * dest, const char * src);
|
---|
48 | char * strncat(char *dest, const char *src, size_t count);
|
---|
49 | int strcmp(const char * cs,const char * ct);
|
---|
50 | int strncmp(const char * cs,const char * ct,size_t count);
|
---|
51 | char * strchr(const char * s, int c);
|
---|
52 | char * strrchr(const char * s, int c);
|
---|
53 | size_t strlen(const char * s);
|
---|
54 | size_t strnlen(const char * s, size_t count);
|
---|
55 | size_t strspn(const char *s, const char *accept);
|
---|
56 | char * strpbrk(const char * cs,const char * ct);
|
---|
57 | char * strtok(char * s,const char * ct);
|
---|
58 | char * strsep(char **s, const char *ct);
|
---|
59 | void * memset(void * s,int c,size_t count);
|
---|
60 | char * bcopy(const char * src, char * dest, int count);
|
---|
61 | void * memcpy(void * dest,const void *src,size_t count);
|
---|
62 | void * memmove(void * dest,const void *src,size_t count);
|
---|
63 | int memcmp(const void * cs,const void * ct,size_t count);
|
---|
64 | void * memscan(void * addr, int c, size_t size);
|
---|
65 | char * strstr(const char * s1,const char * s2);
|
---|
66 | void * memchr(const void *s, int c, size_t n);
|
---|
67 |
|
---|
68 | #endif /* ETHERBOOT_STRING */
|
---|