summaryrefslogtreecommitdiff
path: root/firmware/include
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/include')
-rw-r--r--firmware/include/ctype.h75
-rw-r--r--firmware/include/errno.h145
-rw-r--r--firmware/include/file.h3
-rw-r--r--firmware/include/format.h (renamed from firmware/include/sprintf.h)21
-rw-r--r--firmware/include/inttypes.h112
-rw-r--r--firmware/include/memory.h2
-rw-r--r--firmware/include/stdio.h48
-rw-r--r--firmware/include/stdlib.h58
-rw-r--r--firmware/include/strcasecmp.h (renamed from firmware/include/sscanf.h)18
-rw-r--r--firmware/include/strcasestr.h26
-rw-r--r--firmware/include/string-extra.h27
-rw-r--r--firmware/include/string.h86
-rw-r--r--firmware/include/strlcat.h26
-rw-r--r--firmware/include/strlcpy.h26
-rw-r--r--firmware/include/sys/types.h23
-rw-r--r--firmware/include/time.h49
-rw-r--r--firmware/include/timefuncs.h3
17 files changed, 137 insertions, 611 deletions
diff --git a/firmware/include/ctype.h b/firmware/include/ctype.h
deleted file mode 100644
index 648e06dc5c..0000000000
--- a/firmware/include/ctype.h
+++ /dev/null
@@ -1,75 +0,0 @@
1#ifndef _CTYPE_H_
2#ifdef __cplusplus
3extern "C" {
4#endif
5#define _CTYPE_H_
6
7#include "_ansi.h"
8
9int _EXFUN(isalnum, (int __c));
10int _EXFUN(isalpha, (int __c));
11int _EXFUN(iscntrl, (int __c));
12int _EXFUN(isdigit, (int __c));
13int _EXFUN(isgraph, (int __c));
14int _EXFUN(islower, (int __c));
15int _EXFUN(isprint, (int __c));
16int _EXFUN(ispunct, (int __c));
17int _EXFUN(isspace, (int __c));
18int _EXFUN(isupper, (int __c));
19int _EXFUN(isxdigit,(int __c));
20int _EXFUN(tolower, (int __c));
21int _EXFUN(toupper, (int __c));
22
23#ifndef __STRICT_ANSI__
24int _EXFUN(isascii, (int __c));
25int _EXFUN(toascii, (int __c));
26int _EXFUN(_tolower, (int __c));
27int _EXFUN(_toupper, (int __c));
28#endif
29
30#define _U 01
31#define _L 02
32#define _N 04
33#define _S 010
34#define _P 020
35#define _C 040
36#define _X 0100
37#define _B 0200
38
39#ifdef PLUGIN
40#define _ctype_ (rb->_rbctype_)
41#else
42extern const unsigned char _ctype_[257];
43#endif
44
45#ifndef __cplusplus
46#define isalpha(c) ((_ctype_+1)[(unsigned char)(c)]&(_U|_L))
47#define isupper(c) ((_ctype_+1)[(unsigned char)(c)]&_U)
48#define islower(c) ((_ctype_+1)[(unsigned char)(c)]&_L)
49#define isdigit(c) ((_ctype_+1)[(unsigned char)(c)]&_N)
50#define isxdigit(c) ((_ctype_+1)[(unsigned char)(c)]&(_X|_N))
51#define isspace(c) ((_ctype_+1)[(unsigned char)(c)]&_S)
52#define ispunct(c) ((_ctype_+1)[(unsigned char)(c)]&_P)
53#define isalnum(c) ((_ctype_+1)[(unsigned char)(c)]&(_U|_L|_N))
54#define isprint(c) ((_ctype_+1)[(unsigned char)(c)]&(_P|_U|_L|_N|_B))
55#define isgraph(c) ((_ctype_+1)[(unsigned char)(c)]&(_P|_U|_L|_N))
56#define iscntrl(c) ((_ctype_+1)[(unsigned char)(c)]&_C)
57/* Non-gcc versions will get the library versions, and will be
58 slightly slower */
59#ifdef __GNUC__
60# define toupper(c) \
61 __extension__ ({ int __x = (unsigned char) (c); islower(__x) ? (__x - 'a' + 'A') : __x;})
62# define tolower(c) \
63 __extension__ ({ int __x = (unsigned char) (c); isupper(__x) ? (__x - 'A' + 'a') : __x;})
64#endif
65#endif /* !__cplusplus */
66
67#ifndef __STRICT_ANSI__
68#define isascii(c) ((unsigned char)(c)<=0177)
69#define toascii(c) ((c)&0177)
70#endif
71
72#ifdef __cplusplus
73}
74#endif
75#endif /* _CTYPE_H_ */
diff --git a/firmware/include/errno.h b/firmware/include/errno.h
deleted file mode 100644
index 6a24a1938f..0000000000
--- a/firmware/include/errno.h
+++ /dev/null
@@ -1,145 +0,0 @@
1/* errno is not a global variable, because that would make using it
2 non-reentrant. Instead, its address is returned by the function
3 __errno. */
4
5#if (defined(SIMULATOR)||defined(__PCTOOL__)) && !defined(__MINGW32__) && !defined(__CYGWIN__)
6
7#include "/usr/include/errno.h" /* use the host system implementation */
8
9#else /* use our own implementation */
10
11#ifndef _SYS_ERRNO_H_
12
13#ifdef PLUGIN
14#define errno (*rb->__errno)
15#else
16extern int errno;
17#endif
18
19#define EPERM 1 /* Not super-user */
20#define ENOENT 2 /* No such file or directory */
21#define ESRCH 3 /* No such process */
22#define EINTR 4 /* Interrupted system call */
23#define EIO 5 /* I/O error */
24#define ENXIO 6 /* No such device or address */
25#define E2BIG 7 /* Arg list too long */
26#define ENOEXEC 8 /* Exec format error */
27#define EBADF 9 /* Bad file number */
28#define ECHILD 10 /* No children */
29#define EAGAIN 11 /* No more processes */
30#define ENOMEM 12 /* Not enough core */
31#define EACCES 13 /* Permission denied */
32#define EFAULT 14 /* Bad address */
33#define ENOTBLK 15 /* Block device required */
34#define EBUSY 16 /* Mount device busy */
35#define EEXIST 17 /* File exists */
36#define EXDEV 18 /* Cross-device link */
37#define ENODEV 19 /* No such device */
38#define ENOTDIR 20 /* Not a directory */
39#define EISDIR 21 /* Is a directory */
40#define EINVAL 22 /* Invalid argument */
41#define ENFILE 23 /* Too many open files in system */
42#define EMFILE 24 /* Too many open files */
43#define ENOTTY 25 /* Not a typewriter */
44#define ETXTBSY 26 /* Text file busy */
45#define EFBIG 27 /* File too large */
46#define ENOSPC 28 /* No space left on device */
47#define ESPIPE 29 /* Illegal seek */
48#define EROFS 30 /* Read only file system */
49#define EMLINK 31 /* Too many links */
50#define EPIPE 32 /* Broken pipe */
51#define EDOM 33 /* Math arg out of domain of func */
52#define ERANGE 34 /* Math result not representable */
53#define ENOMSG 35 /* No message of desired type */
54#define EIDRM 36 /* Identifier removed */
55#define ECHRNG 37 /* Channel number out of range */
56#define EL2NSYNC 38 /* Level 2 not synchronized */
57#define EL3HLT 39 /* Level 3 halted */
58#define EL3RST 40 /* Level 3 reset */
59#define ELNRNG 41 /* Link number out of range */
60#define EUNATCH 42 /* Protocol driver not attached */
61#define ENOCSI 43 /* No CSI structure available */
62#define EL2HLT 44 /* Level 2 halted */
63#define EDEADLK 45 /* Deadlock condition */
64#define ENOLCK 46 /* No record locks available */
65#define EBADE 50 /* Invalid exchange */
66#define EBADR 51 /* Invalid request descriptor */
67#define EXFULL 52 /* Exchange full */
68#define ENOANO 53 /* No anode */
69#define EBADRQC 54 /* Invalid request code */
70#define EBADSLT 55 /* Invalid slot */
71#define EDEADLOCK 56 /* File locking deadlock error */
72#define EBFONT 57 /* Bad font file fmt */
73#define ENOSTR 60 /* Device not a stream */
74#define ENODATA 61 /* No data (for no delay io) */
75#define ETIME 62 /* Timer expired */
76#define ENOSR 63 /* Out of streams resources */
77#define ENONET 64 /* Machine is not on the network */
78#define ENOPKG 65 /* Package not installed */
79#define EREMOTE 66 /* The object is remote */
80#define ENOLINK 67 /* The link has been severed */
81#define EADV 68 /* Advertise error */
82#define ESRMNT 69 /* Srmount error */
83#define ECOMM 70 /* Communication error on send */
84#define EPROTO 71 /* Protocol error */
85#define EMULTIHOP 74 /* Multihop attempted */
86#define ELBIN 75 /* Inode is remote (not really error) */
87#define EDOTDOT 76 /* Cross mount point (not really error) */
88#define EBADMSG 77 /* Trying to read unreadable message */
89#define ENOTUNIQ 80 /* Given log. name not unique */
90#define EBADFD 81 /* f.d. invalid for this operation */
91#define EREMCHG 82 /* Remote address changed */
92#define ELIBACC 83 /* Can't access a needed shared lib */
93#define ELIBBAD 84 /* Accessing a corrupted shared lib */
94#define ELIBSCN 85 /* .lib section in a.out corrupted */
95#define ELIBMAX 86 /* Attempting to link in too many libs */
96#define ELIBEXEC 87 /* Attempting to exec a shared library */
97#define ENOSYS 88 /* Function not implemented */
98#define ENMFILE 89 /* No more files */
99#define ENOTEMPTY 90 /* Directory not empty */
100#define ENAMETOOLONG 91 /* File or path name too long */
101#define ELOOP 92 /* Too many symbolic links */
102#define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */
103#define EPFNOSUPPORT 96 /* Protocol family not supported */
104#define ECONNRESET 104 /* Connection reset by peer */
105#define ENOBUFS 105 /* No buffer space available */
106#define EAFNOSUPPORT 106 /* Address family not supported by protocol family */
107#define EPROTOTYPE 107 /* Protocol wrong type for socket */
108#define ENOTSOCK 108 /* Socket operation on non-socket */
109#define ENOPROTOOPT 109 /* Protocol not available */
110#define ESHUTDOWN 110 /* Can't send after socket shutdown */
111#define ECONNREFUSED 111 /* Connection refused */
112#define EADDRINUSE 112 /* Address already in use */
113#define ECONNABORTED 113 /* Connection aborted */
114#define ENETUNREACH 114 /* Network is unreachable */
115#define ENETDOWN 115 /* Network interface is not configured */
116#define ETIMEDOUT 116 /* Connection timed out */
117#define EHOSTDOWN 117 /* Host is down */
118#define EHOSTUNREACH 118 /* Host is unreachable */
119#define EINPROGRESS 119 /* Connection already in progress */
120#define EALREADY 120 /* Socket already connected */
121#define EDESTADDRREQ 121 /* Destination address required */
122#define EMSGSIZE 122 /* Message too long */
123#define EPROTONOSUPPORT 123 /* Unknown protocol */
124#define ESOCKTNOSUPPORT 124 /* Socket type not supported */
125#define EADDRNOTAVAIL 125 /* Address not available */
126#define ENETRESET 126
127#define EISCONN 127 /* Socket is already connected */
128#define ENOTCONN 128 /* Socket is not connected */
129#define ETOOMANYREFS 129
130#define EPROCLIM 130
131#define EUSERS 131
132#define EDQUOT 132
133#define ESTALE 133
134#define ENOTSUP 134 /* Not supported */
135#define ENOMEDIUM 135 /* No medium (in tape drive) */
136#define ENOSHARE 136 /* No such host or network path */
137#define ECASECLASH 137 /* Filename exists with different case */
138
139/* From cygwin32. */
140#define EWOULDBLOCK EAGAIN /* Operation would block */
141
142#define __ELASTERROR 2000 /* Users can add values starting here */
143
144#endif /* _SYS_ERRNO_H */
145#endif /* !SIMULATOR */
diff --git a/firmware/include/file.h b/firmware/include/file.h
index ec0ab87759..2d5c9b88ab 100644
--- a/firmware/include/file.h
+++ b/firmware/include/file.h
@@ -23,6 +23,7 @@
23#define _FILE_H_ 23#define _FILE_H_
24 24
25#include <sys/types.h> 25#include <sys/types.h>
26#include "_ansi.h"
26 27
27#undef MAX_PATH /* this avoids problems when building simulator */ 28#undef MAX_PATH /* this avoids problems when building simulator */
28#define MAX_PATH 260 29#define MAX_PATH 260
@@ -94,5 +95,5 @@ extern int rename(const char* path, const char* newname);
94extern int ftruncate(int fd, off_t length); 95extern int ftruncate(int fd, off_t length);
95extern off_t filesize(int fd); 96extern off_t filesize(int fd);
96extern int release_files(int volume); 97extern int release_files(int volume);
97 98int fdprintf (int fd, const char *fmt, ...) ATTRIBUTE_PRINTF(2, 3);
98#endif 99#endif
diff --git a/firmware/include/sprintf.h b/firmware/include/format.h
index 869b73eb13..6a00574644 100644
--- a/firmware/include/sprintf.h
+++ b/firmware/include/format.h
@@ -19,22 +19,19 @@
19 * 19 *
20 ****************************************************************************/ 20 ****************************************************************************/
21 21
22#ifndef __SPRINTF_H__ 22#ifndef __FORMAT_H__
23#define __SPRINTF_H__ 23#define __FORMAT_H__
24 24
25#include <stddef.h> 25int format(
26#include <stdarg.h> 26 /* call 'push()' for each output letter */
27#include <_ansi.h> 27 int (*push)(void *userp, unsigned char data),
28 28 void *userp,
29int snprintf (char *buf, size_t size, const char *fmt, ...) 29 const char *fmt,
30 ATTRIBUTE_PRINTF(3, 4); 30 va_list ap);
31
32int vsnprintf (char *buf, int size, const char *fmt, va_list ap);
33int fdprintf (int fd, const char *fmt, ...) ATTRIBUTE_PRINTF(2, 3);
34 31
35/* callback function is called for every output character (byte) with userp and 32/* callback function is called for every output character (byte) with userp and
36 * should return 0 when ch is a char other than '\0' that should stop printing */ 33 * should return 0 when ch is a char other than '\0' that should stop printing */
37int vuprintf(int (*push)(void *userp, unsigned char data), 34int vuprintf(int (*push)(void *userp, unsigned char data),
38 void *userp, const char *fmt, va_list ap); 35 void *userp, const char *fmt, va_list ap);
39 36
40#endif /* __SPRINTF_H__ */ 37#endif /* __FORMAT_H__ */
diff --git a/firmware/include/inttypes.h b/firmware/include/inttypes.h
deleted file mode 100644
index f7f5099bd7..0000000000
--- a/firmware/include/inttypes.h
+++ /dev/null
@@ -1,112 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2005 by Dave Chapman
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22#ifndef __INTTYPES_H__
23#define __INTTYPES_H__
24
25#ifndef WPSEDITOR
26
27#include <limits.h>
28
29/* 8 bit */
30#define INT8_MIN SCHAR_MIN
31#define INT8_MAX SCHAR_MAX
32#define UINT8_MAX UCHAR_MAX
33#define int8_t signed char
34#define uint8_t unsigned char
35
36/* 16 bit */
37#if USHRT_MAX == 0xffff
38
39#define INT16_MIN SHRT_MIN
40#define INT16_MAX SHRT_MAX
41#define UINT16_MAX USHRT_MAX
42#define int16_t short
43#define uint16_t unsigned short
44
45#endif
46
47/* 32 bit */
48#if ULONG_MAX == 0xfffffffful
49
50#define INT32_MIN LONG_MIN
51#define INT32_MAX LONG_MAX
52#define UINT32_MAX ULONG_MAX
53#define int32_t long
54#define uint32_t unsigned long
55
56#define INTPTR_MIN LONG_MIN
57#define INTPTR_MAX LONG_MAX
58#define UINTPTR_MAX ULONG_MAX
59#define intptr_t long
60#define uintptr_t unsigned long
61
62#elif UINT_MAX == 0xffffffffu
63
64#define INT32_MIN INT_MIN
65#define INT32_MAX INT_MAX
66#define UINT32_MAX UINT_MAX
67#define int32_t int
68#define uint32_t unsigned int
69
70#endif
71
72/* 64 bit */
73#ifndef LLONG_MIN
74#define LLONG_MIN ((long long)9223372036854775808ull)
75#endif
76
77#ifndef LLONG_MAX
78#define LLONG_MAX 9223372036854775807ll
79#endif
80
81#ifndef ULLONG_MAX
82#define ULLONG_MAX 18446744073709551615ull
83#endif
84
85#if ULONG_MAX == 0xffffffffffffffffull
86
87#define INT64_MIN LONG_MIN
88#define INT64_MAX LONG_MAX
89#define UINT64_MAX ULONG_MAX
90#define int64_t long
91#define uint64_t unsigned long
92
93#define INTPTR_MIN LONG_MIN
94#define INTPTR_MAX LONG_MAX
95#define UINTPTR_MAX ULONG_MAX
96#define intptr_t long
97#define uintptr_t unsigned long
98
99#else
100
101#define INT64_MIN LLONG_MIN
102#define INT64_MAX LLONG_MAX
103#define UINT64_MAX ULLONG_MAX
104#define int64_t long long
105#define uint64_t unsigned long long
106
107#endif
108#else
109#include <stdint.h>
110#endif /* !WPSEDITOR*/
111
112#endif /* __INTTYPES_H__ */
diff --git a/firmware/include/memory.h b/firmware/include/memory.h
index 0b12629049..d025bce610 100644
--- a/firmware/include/memory.h
+++ b/firmware/include/memory.h
@@ -22,7 +22,7 @@
22#ifndef _MEMORY_H_ 22#ifndef _MEMORY_H_
23#define _MEMORY_H_ 23#define _MEMORY_H_
24 24
25#include <sys/types.h> 25#include "inttypes.h"
26 26
27void memset16(void *dst, int val, size_t len); 27void memset16(void *dst, int val, size_t len);
28 28
diff --git a/firmware/include/stdio.h b/firmware/include/stdio.h
deleted file mode 100644
index 6ae2ff603a..0000000000
--- a/firmware/include/stdio.h
+++ /dev/null
@@ -1,48 +0,0 @@
1#ifndef _STDIO_H_
2#define _STDIO_H_
3
4#include <_ansi.h>
5
6#define __need_size_t
7#include <stddef.h>
8
9#define __need___va_list
10#include <stdarg.h>
11
12#ifndef NULL
13#define NULL 0
14#endif
15
16#define EOF (-1)
17
18#ifndef SEEK_SET
19#define SEEK_SET 0 /* set file offset to offset */
20#endif
21#ifndef SEEK_CUR
22#define SEEK_CUR 1 /* set file offset to current plus offset */
23#endif
24#ifndef SEEK_END
25#define SEEK_END 2 /* set file offset to EOF plus offset */
26#endif
27
28#define TMP_MAX 26
29
30#ifdef __GNUC__
31#define __VALIST __gnuc_va_list
32#else
33#define __VALIST char*
34#endif
35
36int snprintf (char *buf, size_t size, const char *fmt, ...);
37int vsnprintf (char *buf, int size, const char *fmt, __VALIST ap);
38
39#ifdef SIMULATOR
40typedef void FILE;
41int vfprintf(FILE *stream, const char *format, __VALIST ap);
42#ifdef WIN32
43#define FILENAME_MAX 260 /* ugly hard-coded value of a limit that is set
44 in file.h */
45#endif
46#endif
47
48#endif /* _STDIO_H_ */
diff --git a/firmware/include/stdlib.h b/firmware/include/stdlib.h
deleted file mode 100644
index 6de00c816d..0000000000
--- a/firmware/include/stdlib.h
+++ /dev/null
@@ -1,58 +0,0 @@
1/*
2 * stdlib.h
3 *
4 * Definitions for common types, variables, and functions.
5 */
6
7#ifndef _STDLIB_H_
8#ifdef __cplusplus
9extern "C" {
10#endif
11#define _STDLIB_H_
12
13#include "_ansi.h"
14
15#define __need_size_t
16#define __need_wchar_t
17#include <stddef.h>
18
19#ifndef NULL
20#define NULL ((void*)0)
21#endif
22
23#define EXIT_FAILURE 1
24#define EXIT_SUCCESS 0
25
26_VOID _EXFUN(qsort,(_PTR __base, size_t __nmemb, size_t __size, int(*_compar)(const _PTR, const _PTR)));
27
28void *malloc(size_t);
29void *calloc (size_t nmemb, size_t size);
30void free(void *);
31void *realloc(void *, size_t);
32
33#define RAND_MAX INT_MAX
34
35void srand(unsigned int seed);
36int rand(void);
37
38#ifndef ABS
39#if defined(__GNUC__)
40#define ABS(a) ({typeof (a) ___a = (a); ___a < 0 ? -___a: ___a; })
41#else
42#define ABS(a) (((a) < 0) ? -(a) : (a))
43#endif /* __GNUC__ */
44#endif
45
46#define abs(x) (ABS(x))
47#define labs(x) abs(x)
48
49#ifdef SIMULATOR
50void exit(int status);
51#endif
52
53int atoi (const char *str);
54
55#ifdef __cplusplus
56}
57#endif
58#endif /* _STDLIB_H_ */
diff --git a/firmware/include/sscanf.h b/firmware/include/strcasecmp.h
index 26f63dd16d..630f3c9fd8 100644
--- a/firmware/include/sscanf.h
+++ b/firmware/include/strcasecmp.h
@@ -7,7 +7,7 @@
7 * \/ \/ \/ \/ \/ 7 * \/ \/ \/ \/ \/
8 * $Id$ 8 * $Id$
9 * 9 *
10 * Copyright (C) 2006 by Tomasz Malesinski 10 * Copyright (C) 2010 Thomas Martitz
11 * 11 *
12 * This program is free software; you can redistribute it and/or 12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License 13 * modify it under the terms of the GNU General Public License
@@ -19,14 +19,10 @@
19 * 19 *
20 ****************************************************************************/ 20 ****************************************************************************/
21 21
22#ifndef __SSCANF_H__
23#define __SSCANF_H__
24 22
25#include <stddef.h> 23#ifndef __STRCASECMP_H__
26#include <stdarg.h> 24#define __STRCASECMP_H__
27#include <_ansi.h> 25#include <string.h>
28 26int strcasecmp(const char *s1, const char *s2);
29int sscanf(const char *s, const char *fmt, ...) 27int strncasecmp(const char *s1, const char *s2, size_t n);
30 ATTRIBUTE_SCANF(2, 3); 28#endif
31
32#endif /* __SSCANF_H__ */
diff --git a/firmware/include/strcasestr.h b/firmware/include/strcasestr.h
new file mode 100644
index 0000000000..a6d2f2c472
--- /dev/null
+++ b/firmware/include/strcasestr.h
@@ -0,0 +1,26 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2010 Thomas Martitz
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22
23#ifndef __STRLCASESTR_H__
24#define __STRLCASESTR_H__
25char *strcasestr(const char *, const char *);
26#endif
diff --git a/firmware/include/string-extra.h b/firmware/include/string-extra.h
new file mode 100644
index 0000000000..5fe5ab8119
--- /dev/null
+++ b/firmware/include/string-extra.h
@@ -0,0 +1,27 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2010 Thomas Martitz
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22
23#include <string.h>
24#include "strlcpy.h"
25#include "strlcat.h"
26#include "strcasecmp.h"
27#include "strcasestr.h"
diff --git a/firmware/include/string.h b/firmware/include/string.h
deleted file mode 100644
index 1a2e056717..0000000000
--- a/firmware/include/string.h
+++ /dev/null
@@ -1,86 +0,0 @@
1/*
2 * string.h
3 *
4 * Definitions for memory and string functions.
5 */
6
7#ifndef _STRING_H_
8#define _STRING_H_
9
10#ifdef __cplusplus
11extern "C" {
12#endif
13
14#include "_ansi.h"
15
16#define __need_size_t
17#include <stddef.h>
18
19#ifndef NULL
20#define NULL ((void*)0)
21#endif
22
23_PTR _EXFUN(memchr,(const _PTR, int, size_t));
24int _EXFUN(memcmp,(const _PTR, const _PTR, size_t));
25_PTR _EXFUN(memcpy,(_PTR, const _PTR, size_t));
26_PTR _EXFUN(memmove,(_PTR, const _PTR, size_t));
27_PTR _EXFUN(memset,(_PTR, int, size_t));
28char *_EXFUN(strcat,(char *, const char *));
29char *_EXFUN(strchr,(const char *, int));
30int _EXFUN(strcmp,(const char *, const char *));
31int _EXFUN(strcoll,(const char *, const char *));
32char *_EXFUN(strcpy,(char *, const char *));
33size_t _EXFUN(strcspn,(const char *, const char *));
34char *_EXFUN(strerror,(int));
35size_t _EXFUN(strlen,(const char *));
36char *_EXFUN(strncat,(char *, const char *, size_t));
37int _EXFUN(strncmp,(const char *, const char *, size_t));
38char *_EXFUN(strpbrk,(const char *, const char *));
39char *_EXFUN(strrchr,(const char *, int));
40size_t _EXFUN(strspn,(const char *, const char *));
41char *_EXFUN(strstr,(const char *, const char *));
42char *_EXFUN(strcasestr,(const char *, const char *));
43
44size_t strlcpy(char *dst, const char *src, size_t siz);
45size_t strlcat(char *dst, const char *src, size_t siz);
46
47#ifndef _REENT_ONLY
48char *_EXFUN(strtok,(char *, const char *));
49#endif
50
51size_t _EXFUN(strxfrm,(char *, const char *, size_t));
52
53#ifndef __STRICT_ANSI__
54char *_EXFUN(strtok_r,(char *, const char *, char **));
55
56_PTR _EXFUN(memccpy,(_PTR, const _PTR, int, size_t));
57int _EXFUN(strcasecmp,(const char *, const char *));
58int _EXFUN(strncasecmp,(const char *, const char *, size_t));
59
60#ifdef __CYGWIN__
61#ifndef DEFS_H /* Kludge to work around problem compiling in gdb */
62const char *_EXFUN(strsignal, (int __signo));
63#endif
64int _EXFUN(strtosigno, (const char *__name));
65#endif
66
67/* These function names are used on Windows and perhaps other systems. */
68#ifndef strcmpi
69#define strcmpi strcasecmp
70#endif
71#ifndef stricmp
72#define stricmp strcasecmp
73#endif
74#ifndef strncmpi
75#define strncmpi strncasecmp
76#endif
77#ifndef strnicmp
78#define strnicmp strncasecmp
79#endif
80
81#endif /* ! __STRICT_ANSI__ */
82
83#ifdef __cplusplus
84}
85#endif
86#endif /* _STRING_H_ */
diff --git a/firmware/include/strlcat.h b/firmware/include/strlcat.h
new file mode 100644
index 0000000000..dbde60c21b
--- /dev/null
+++ b/firmware/include/strlcat.h
@@ -0,0 +1,26 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2010 Thomas Martitz
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22
23#ifndef __STRLCAT_H__
24#define __STRLCAT_H__
25size_t strlcat(char *dst, const char *src, size_t siz);
26#endif
diff --git a/firmware/include/strlcpy.h b/firmware/include/strlcpy.h
new file mode 100644
index 0000000000..f94ed52ba8
--- /dev/null
+++ b/firmware/include/strlcpy.h
@@ -0,0 +1,26 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2010 Thomas Martitz
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22
23#ifndef __STRLCPY_H__
24#define __STRLCPY_H__
25size_t strlcpy(char *dst, const char *src, size_t siz);
26#endif
diff --git a/firmware/include/sys/types.h b/firmware/include/sys/types.h
index 95181dab19..07f9e9c8c7 100644
--- a/firmware/include/sys/types.h
+++ b/firmware/include/sys/types.h
@@ -7,7 +7,7 @@
7 * \/ \/ \/ \/ \/ 7 * \/ \/ \/ \/ \/
8 * $Id$ 8 * $Id$
9 * 9 *
10 * Copyright (C) 2005 by Daniel Stenberg 10 * Copyright (C) 2010 Thomas Martitz
11 * 11 *
12 * This program is free software; you can redistribute it and/or 12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License 13 * modify it under the terms of the GNU General Public License
@@ -19,8 +19,17 @@
19 * 19 *
20 ****************************************************************************/ 20 ****************************************************************************/
21 21
22#ifndef _SYS_TYPES_H_ 22/**
23#define _SYS_TYPES_H_ 23 * provide a sys/types.h for compatibility with imported code
24 **/
25
26#ifndef __TYPES_H__
27#define __TYPES_H__
28
29
30/*
31 * include string.h for size_t for convinence */
32#include <string.h>
24 33
25#if !defined(__ssize_t_defined) && !defined(_SSIZE_T_) && !defined(ssize_t) && !defined(_SSIZE_T_DECLARED) 34#if !defined(__ssize_t_defined) && !defined(_SSIZE_T_) && !defined(ssize_t) && !defined(_SSIZE_T_DECLARED)
26#define __ssize_t_defined 35#define __ssize_t_defined
@@ -43,10 +52,4 @@ typedef signed long off_t;
43typedef unsigned int mode_t; 52typedef unsigned int mode_t;
44#endif 53#endif
45 54
46#if !defined(_SIZE_T) && !defined(_SIZE_T_DECLARED) 55#endif /* __TYPES_H__ */
47#define _SIZE_T
48#define _SIZE_T_DECLARED
49typedef unsigned long size_t;
50#endif
51
52#endif /* _SYS_TYPES_H */
diff --git a/firmware/include/time.h b/firmware/include/time.h
deleted file mode 100644
index 28680494f9..0000000000
--- a/firmware/include/time.h
+++ /dev/null
@@ -1,49 +0,0 @@
1/*
2 * time.h
3 *
4 * Struct declaration for dealing with time.
5 */
6
7#ifndef _TIME_H_
8#define _TIME_H_
9
10#ifdef WPSEDITOR
11#include <sys/types.h>
12#include <time.h>
13#endif
14
15struct tm
16{
17 int tm_sec;
18 int tm_min;
19 int tm_hour;
20 int tm_mday;
21 int tm_mon;
22 int tm_year;
23 int tm_wday;
24 int tm_yday;
25 int tm_isdst;
26};
27
28#if !defined(_TIME_T_DEFINED) && !defined(_TIME_T_DECLARED)
29typedef long time_t;
30
31/* this define below is used by the mingw headers to prevent duplicate
32 typedefs */
33#define _TIME_T_DEFINED
34#define _TIME_T_DECLARED
35time_t time(time_t *t);
36struct tm *localtime(const time_t *timep);
37
38#endif /* SIMULATOR */
39
40#ifdef __PCTOOL__
41/* this time.h does not define struct timespec,
42 so tell sys/stat.h not to use it */
43#undef __USE_MISC
44#endif
45
46
47#endif /* _TIME_H_ */
48
49
diff --git a/firmware/include/timefuncs.h b/firmware/include/timefuncs.h
index f51fa996cc..86a41a516b 100644
--- a/firmware/include/timefuncs.h
+++ b/firmware/include/timefuncs.h
@@ -30,9 +30,6 @@ struct tm *get_time(void);
30int set_time(const struct tm *tm); 30int set_time(const struct tm *tm);
31bool valid_time(const struct tm *tm); 31bool valid_time(const struct tm *tm);
32void set_day_of_week(struct tm *tm); 32void set_day_of_week(struct tm *tm);
33#if CONFIG_RTC
34time_t mktime(struct tm *t);
35#endif
36 33
37#endif /* _TIMEFUNCS_H_ */ 34#endif /* _TIMEFUNCS_H_ */
38 35