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