summaryrefslogtreecommitdiff
path: root/device/lib/pic16/libc/string
diff options
context:
space:
mode:
authorXavier ASUS <xavi92psx@gmail.com>2019-10-18 00:31:54 +0200
committerXavier ASUS <xavi92psx@gmail.com>2019-10-18 00:31:54 +0200
commit268a53de823a6750d6256ee1fb1e7707b4b45740 (patch)
tree42c1799a9a82b2f7d9790ee9fe181d72a7274751 /device/lib/pic16/libc/string
downloadsdcc-gas-268a53de823a6750d6256ee1fb1e7707b4b45740.tar.gz
sdcc-3.9.0 fork implementing GNU assembler syntax
This fork aims to provide better support for stm8-binutils
Diffstat (limited to 'device/lib/pic16/libc/string')
-rw-r--r--device/lib/pic16/libc/string/memccpy.c50
-rw-r--r--device/lib/pic16/libc/string/memchr.c48
-rw-r--r--device/lib/pic16/libc/string/memchrpgm.c48
-rw-r--r--device/lib/pic16/libc/string/memchrram.c48
-rw-r--r--device/lib/pic16/libc/string/memcmp.c44
-rw-r--r--device/lib/pic16/libc/string/memcpy.c44
-rw-r--r--device/lib/pic16/libc/string/memcpypgm2ram.c44
-rw-r--r--device/lib/pic16/libc/string/memcpyram2ram.c44
-rw-r--r--device/lib/pic16/libc/string/memmove.c60
-rw-r--r--device/lib/pic16/libc/string/memrchr.c50
-rw-r--r--device/lib/pic16/libc/string/memset.c43
-rw-r--r--device/lib/pic16/libc/string/strcat.c46
-rw-r--r--device/lib/pic16/libc/string/strchr.c41
-rw-r--r--device/lib/pic16/libc/string/strcmp.c46
-rw-r--r--device/lib/pic16/libc/string/strcpy.c40
-rw-r--r--device/lib/pic16/libc/string/strcspn.c48
-rw-r--r--device/lib/pic16/libc/string/strlen.c40
-rw-r--r--device/lib/pic16/libc/string/strlwr.c44
-rw-r--r--device/lib/pic16/libc/string/strncat.c47
-rw-r--r--device/lib/pic16/libc/string/strncmp.c44
-rw-r--r--device/lib/pic16/libc/string/strncpy.c48
-rw-r--r--device/lib/pic16/libc/string/strpbrk.c43
-rw-r--r--device/lib/pic16/libc/string/strrchr.c49
-rw-r--r--device/lib/pic16/libc/string/strspn.c48
-rw-r--r--device/lib/pic16/libc/string/strstr.c57
-rw-r--r--device/lib/pic16/libc/string/strtok.c69
-rw-r--r--device/lib/pic16/libc/string/strupr.c44
27 files changed, 1277 insertions, 0 deletions
diff --git a/device/lib/pic16/libc/string/memccpy.c b/device/lib/pic16/libc/string/memccpy.c
new file mode 100644
index 0000000..015b829
--- /dev/null
+++ b/device/lib/pic16/libc/string/memccpy.c
@@ -0,0 +1,50 @@
+/*-------------------------------------------------------------------------
+ memccpy.c - part of string library functions
+
+ Copyright (C) 2004, Vangelis Rokas <vrokas at otenet.gr>
+ Copyright (C) 1999, Sandeep Dutta <sandeep.dutta at usa.net>
+
+ This library 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, or (at your option) any
+ later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this library; see the file COPYING. If not, write to the
+ Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA.
+
+ As a special exception, if you link this library with other files,
+ some of which are compiled with SDCC, to produce an executable,
+ this library does not by itself cause the resulting executable to
+ be covered by the GNU General Public License. This exception does
+ not however invalidate any other reasons why the executable file
+ might be covered by the GNU General Public License.
+-------------------------------------------------------------------------*/
+
+#include <string.h>
+
+void *
+memccpy (void *dst, void *src, char c, size_t acount)
+{
+ char *d = dst;
+ char *s = src;
+
+ /*
+ * copy from lower addresses to higher addresses
+ */
+ while (acount--)
+ {
+ if (*s == c)
+ return ++s;
+
+ *d++ = *s++;
+ }
+
+ return NULL;
+}
diff --git a/device/lib/pic16/libc/string/memchr.c b/device/lib/pic16/libc/string/memchr.c
new file mode 100644
index 0000000..7f46be0
--- /dev/null
+++ b/device/lib/pic16/libc/string/memchr.c
@@ -0,0 +1,48 @@
+/*-------------------------------------------------------------------------
+ memchr.c - part of string library functions
+
+ Copyright (C) 2004, Vangelis Rokas <vrokas at otenet.gr>
+ Copyright (C) 1999, Sandeep Dutta <sandeep.dutta at usa.net>
+
+ This library 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, or (at your option) any
+ later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this library; see the file COPYING. If not, write to the
+ Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA.
+
+ As a special exception, if you link this library with other files,
+ some of which are compiled with SDCC, to produce an executable,
+ this library does not by itself cause the resulting executable to
+ be covered by the GNU General Public License. This exception does
+ not however invalidate any other reasons why the executable file
+ might be covered by the GNU General Public License.
+-------------------------------------------------------------------------*/
+
+#include <string.h>
+
+void *
+memchr (const void *s, char c, size_t count)
+{
+ if (!count)
+ return NULL;
+
+ while ((*(char *)s != c) && count)
+ {
+ s = (char *)s + sizeof (char *);
+ --count;
+ }
+
+ if (count)
+ return s;
+ else
+ return NULL;
+}
diff --git a/device/lib/pic16/libc/string/memchrpgm.c b/device/lib/pic16/libc/string/memchrpgm.c
new file mode 100644
index 0000000..9903b69
--- /dev/null
+++ b/device/lib/pic16/libc/string/memchrpgm.c
@@ -0,0 +1,48 @@
+/*-------------------------------------------------------------------------
+ memchrpgm.c - part of string library functions
+
+ Copyright (C) 2004, Vangelis Rokas <vrokas at otenet.gr>
+ Copyright (C) 1999, Sandeep Dutta <sandeep.dutta at usa.net>
+
+ This library 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, or (at your option) any
+ later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this library; see the file COPYING. If not, write to the
+ Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA.
+
+ As a special exception, if you link this library with other files,
+ some of which are compiled with SDCC, to produce an executable,
+ this library does not by itself cause the resulting executable to
+ be covered by the GNU General Public License. This exception does
+ not however invalidate any other reasons why the executable file
+ might be covered by the GNU General Public License.
+-------------------------------------------------------------------------*/
+
+#include <string.h>
+
+__code void *
+memchrpgm (__code void *s, char c, size_t count)
+{
+ if (!count)
+ return NULL;
+
+ while ((*(__code char *)s != c) && count)
+ {
+ s = (__code char *)s + sizeof (__code char *);
+ --count;
+ }
+
+ if (count)
+ return s;
+ else
+ return NULL;
+}
diff --git a/device/lib/pic16/libc/string/memchrram.c b/device/lib/pic16/libc/string/memchrram.c
new file mode 100644
index 0000000..4ac8ddf
--- /dev/null
+++ b/device/lib/pic16/libc/string/memchrram.c
@@ -0,0 +1,48 @@
+/*-------------------------------------------------------------------------
+ memchrram.c - part of string library functions
+
+ Copyright (C) 2004, Vangelis Rokas <vrokas at otenet.gr>
+ Copyright (C) 1999, Sandeep Dutta <sandeep.dutta at usa.net>
+
+ This library 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, or (at your option) any
+ later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this library; see the file COPYING. If not, write to the
+ Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA.
+
+ As a special exception, if you link this library with other files,
+ some of which are compiled with SDCC, to produce an executable,
+ this library does not by itself cause the resulting executable to
+ be covered by the GNU General Public License. This exception does
+ not however invalidate any other reasons why the executable file
+ might be covered by the GNU General Public License.
+-------------------------------------------------------------------------*/
+
+#include <string.h>
+
+__data void *
+memchrram (__data void *s, char c, size_t count)
+{
+ if (!count)
+ return NULL;
+
+ while ((*(__data char *)s != c) && count)
+ {
+ s = (__data char *)s + sizeof (__data char *);
+ --count;
+ }
+
+ if (count)
+ return s;
+ else
+ return NULL;
+}
diff --git a/device/lib/pic16/libc/string/memcmp.c b/device/lib/pic16/libc/string/memcmp.c
new file mode 100644
index 0000000..012d021
--- /dev/null
+++ b/device/lib/pic16/libc/string/memcmp.c
@@ -0,0 +1,44 @@
+/*-------------------------------------------------------------------------
+ memcmp.c - part of string library functions
+
+ Copyright (C) 1999, Sandeep Dutta <sandeep.dutta at usa.net>
+
+ This library 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, or (at your option) any
+ later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this library; see the file COPYING. If not, write to the
+ Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA.
+
+ As a special exception, if you link this library with other files,
+ some of which are compiled with SDCC, to produce an executable,
+ this library does not by itself cause the resulting executable to
+ be covered by the GNU General Public License. This exception does
+ not however invalidate any other reasons why the executable file
+ might be covered by the GNU General Public License.
+-------------------------------------------------------------------------*/
+
+#include <string.h>
+
+int
+memcmp (const void * buf1, const void * buf2, size_t count)
+{
+ if (!count)
+ return 0;
+
+ while (--count && (*((const char *)buf1) == *((const char *)buf2)))
+ {
+ buf1 = (const char *)buf1 + 1;
+ buf2 = (const char *)buf2 + 1;
+ }
+
+ return *((const unsigned char *)buf1) - *((const unsigned char *)buf2);
+}
diff --git a/device/lib/pic16/libc/string/memcpy.c b/device/lib/pic16/libc/string/memcpy.c
new file mode 100644
index 0000000..dced669
--- /dev/null
+++ b/device/lib/pic16/libc/string/memcpy.c
@@ -0,0 +1,44 @@
+/*-------------------------------------------------------------------------
+ memcpy.c - part of string library functions
+
+ Copyright (C) 1999, Sandeep Dutta <sandeep.dutta at usa.net>
+
+ This library 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, or (at your option) any
+ later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this library; see the file COPYING. If not, write to the
+ Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA.
+
+ As a special exception, if you link this library with other files,
+ some of which are compiled with SDCC, to produce an executable,
+ this library does not by itself cause the resulting executable to
+ be covered by the GNU General Public License. This exception does
+ not however invalidate any other reasons why the executable file
+ might be covered by the GNU General Public License.
+-------------------------------------------------------------------------*/
+
+#include <string.h>
+
+void *
+memcpy (void *dst, const void *src, size_t acount)
+{
+ char *d = dst;
+ const char *s = src;
+
+ /*
+ * copy from lower addresses to higher addresses
+ */
+ while (acount--)
+ *d++ = *s++;
+
+ return dst;
+}
diff --git a/device/lib/pic16/libc/string/memcpypgm2ram.c b/device/lib/pic16/libc/string/memcpypgm2ram.c
new file mode 100644
index 0000000..3071b91
--- /dev/null
+++ b/device/lib/pic16/libc/string/memcpypgm2ram.c
@@ -0,0 +1,44 @@
+/*-------------------------------------------------------------------------
+ memcpypgm2ram.c - part of string library functions
+
+ Copyright (C) 1999, Sandeep Dutta <sandeep.dutta at usa.net>
+
+ This library 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, or (at your option) any
+ later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this library; see the file COPYING. If not, write to the
+ Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA.
+
+ As a special exception, if you link this library with other files,
+ some of which are compiled with SDCC, to produce an executable,
+ this library does not by itself cause the resulting executable to
+ be covered by the GNU General Public License. This exception does
+ not however invalidate any other reasons why the executable file
+ might be covered by the GNU General Public License.
+-------------------------------------------------------------------------*/
+
+#include <string.h>
+
+__data void *
+memcpypgm2ram (__data void *dst, __code void *src, size_t acount)
+{
+ char __data *d = dst;
+ char __code *s = src;
+
+ /*
+ * copy from lower addresses to higher addresses
+ */
+ while (acount--)
+ *d++ = *s++;
+
+ return dst;
+}
diff --git a/device/lib/pic16/libc/string/memcpyram2ram.c b/device/lib/pic16/libc/string/memcpyram2ram.c
new file mode 100644
index 0000000..84a67cd
--- /dev/null
+++ b/device/lib/pic16/libc/string/memcpyram2ram.c
@@ -0,0 +1,44 @@
+/*-------------------------------------------------------------------------
+ memcpyram2ram.c - part of string library functions
+
+ Copyright (C) 1999, Sandeep Dutta <sandeep.dutta at usa.net>
+
+ This library 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, or (at your option) any
+ later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this library; see the file COPYING. If not, write to the
+ Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA.
+
+ As a special exception, if you link this library with other files,
+ some of which are compiled with SDCC, to produce an executable,
+ this library does not by itself cause the resulting executable to
+ be covered by the GNU General Public License. This exception does
+ not however invalidate any other reasons why the executable file
+ might be covered by the GNU General Public License.
+-------------------------------------------------------------------------*/
+
+#include <string.h>
+
+__data void *
+memcpyram2ram (__data void *dst, __data void *src, size_t acount)
+{
+ char __data *d = dst;
+ char __data *s = src;
+
+ /*
+ * copy from lower addresses to higher addresses
+ */
+ while (acount--)
+ *d++ = *s++;
+
+ return dst;
+}
diff --git a/device/lib/pic16/libc/string/memmove.c b/device/lib/pic16/libc/string/memmove.c
new file mode 100644
index 0000000..634847f
--- /dev/null
+++ b/device/lib/pic16/libc/string/memmove.c
@@ -0,0 +1,60 @@
+/*-------------------------------------------------------------------------
+ memmove.c - part of string library functions
+
+ Copyright (C) 1999, Sandeep Dutta <sandeep.dutta at usa.net>
+ Adapted by Erik Petrich <epetrich at users.sourceforge.net>
+
+ This library 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, or (at your option) any
+ later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this library; see the file COPYING. If not, write to the
+ Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA.
+
+ As a special exception, if you link this library with other files,
+ some of which are compiled with SDCC, to produce an executable,
+ this library does not by itself cause the resulting executable to
+ be covered by the GNU General Public License. This exception does
+ not however invalidate any other reasons why the executable file
+ might be covered by the GNU General Public License.
+-------------------------------------------------------------------------*/
+
+#include <string.h>
+
+void *
+memmove (void *dst, const void *src, size_t acount)
+{
+ char *d;
+ const char *s;
+
+ if (((int)src < (int)dst) && ((((int)src) + acount) > (int)dst))
+ {
+ /*
+ * copy from higher addresses to lower addresses
+ */
+ d = ((char *)dst) + acount - 1;
+ s = ((char *)src) + acount - 1;
+ while (acount--)
+ *d-- = *s--;
+ }
+ else
+ {
+ /*
+ * copy from lower addresses to higher addresses
+ */
+ d = dst;
+ s = src;
+ while (acount--)
+ *d++ = *s++;
+ }
+
+ return dst;
+}
diff --git a/device/lib/pic16/libc/string/memrchr.c b/device/lib/pic16/libc/string/memrchr.c
new file mode 100644
index 0000000..fa82214
--- /dev/null
+++ b/device/lib/pic16/libc/string/memrchr.c
@@ -0,0 +1,50 @@
+/*-------------------------------------------------------------------------
+ memrchr.c - part of string library functions
+
+ Copyright (C) 2004, Vangelis Rokas <vrokas at otenet.gr>
+ Copyright (C) 1999, Sandeep Dutta <sandeep.dutta at usa.net>
+
+ This library 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, or (at your option) any
+ later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this library; see the file COPYING. If not, write to the
+ Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA.
+
+ As a special exception, if you link this library with other files,
+ some of which are compiled with SDCC, to produce an executable,
+ this library does not by itself cause the resulting executable to
+ be covered by the GNU General Public License. This exception does
+ not however invalidate any other reasons why the executable file
+ might be covered by the GNU General Public License.
+-------------------------------------------------------------------------*/
+
+#include <string.h>
+
+void *
+memrchr (void *s, char c, size_t count)
+{
+ if (!count)
+ return NULL;
+
+ s = (char *)s + sizeof (char *) * count;
+
+ while (*(char *)s != c && count)
+ {
+ s = (char *)s - sizeof(char *);
+ --count;
+ }
+
+ if (count)
+ return s;
+ else
+ return NULL;
+}
diff --git a/device/lib/pic16/libc/string/memset.c b/device/lib/pic16/libc/string/memset.c
new file mode 100644
index 0000000..2c6693c
--- /dev/null
+++ b/device/lib/pic16/libc/string/memset.c
@@ -0,0 +1,43 @@
+/*-------------------------------------------------------------------------
+ memset.c - part of string library functions
+
+ Copyright (C) 1999, Sandeep Dutta <sandeep.dutta at usa.net>
+
+ This library 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, or (at your option) any
+ later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this library; see the file COPYING. If not, write to the
+ Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA.
+
+ As a special exception, if you link this library with other files,
+ some of which are compiled with SDCC, to produce an executable,
+ this library does not by itself cause the resulting executable to
+ be covered by the GNU General Public License. This exception does
+ not however invalidate any other reasons why the executable file
+ might be covered by the GNU General Public License.
+-------------------------------------------------------------------------*/
+
+#include <string.h>
+
+void *
+memset (void _STRING_SPEC *buf, unsigned char ch, size_t count)
+{
+ register unsigned char *ret = buf;
+
+ while (count--)
+ {
+ *(unsigned char *)ret = ch;
+ ++ret;
+ }
+
+ return buf;
+}
diff --git a/device/lib/pic16/libc/string/strcat.c b/device/lib/pic16/libc/string/strcat.c
new file mode 100644
index 0000000..29be2d4
--- /dev/null
+++ b/device/lib/pic16/libc/string/strcat.c
@@ -0,0 +1,46 @@
+/*-------------------------------------------------------------------------
+ strcat.c - part of string library functions
+
+ Copyright (C) 1999, Sandeep Dutta <sandeep.dutta at usa.net>
+
+ This library 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, or (at your option) any
+ later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this library; see the file COPYING. If not, write to the
+ Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA.
+
+ As a special exception, if you link this library with other files,
+ some of which are compiled with SDCC, to produce an executable,
+ this library does not by itself cause the resulting executable to
+ be covered by the GNU General Public License. This exception does
+ not however invalidate any other reasons why the executable file
+ might be covered by the GNU General Public License.
+-------------------------------------------------------------------------*/
+
+#include <string.h>
+
+char *
+strcat (char *dst, char *src)
+{
+ char *cp = dst;
+
+ /* find end of dst */
+ while (*cp)
+ cp++;
+
+ /* Copy src to end of dst */
+ while (*cp++ = *src++)
+ ;
+
+ /* return dst */
+ return dst;
+}
diff --git a/device/lib/pic16/libc/string/strchr.c b/device/lib/pic16/libc/string/strchr.c
new file mode 100644
index 0000000..5820e2b
--- /dev/null
+++ b/device/lib/pic16/libc/string/strchr.c
@@ -0,0 +1,41 @@
+/*-------------------------------------------------------------------------
+ strchr.c - part of string library functions
+
+ Copyright (C) 1999, Sandeep Dutta <sandeep.dutta at usa.net>
+
+ This library 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, or (at your option) any
+ later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this library; see the file COPYING. If not, write to the
+ Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA.
+
+ As a special exception, if you link this library with other files,
+ some of which are compiled with SDCC, to produce an executable,
+ this library does not by itself cause the resulting executable to
+ be covered by the GNU General Public License. This exception does
+ not however invalidate any other reasons why the executable file
+ might be covered by the GNU General Public License.
+-------------------------------------------------------------------------*/
+
+#include <string.h>
+
+char *
+strchr (char *string, char ch)
+{
+ while (*string && *string != ch)
+ ++string;
+
+ if (*string == ch)
+ return string;
+
+ return NULL;
+}
diff --git a/device/lib/pic16/libc/string/strcmp.c b/device/lib/pic16/libc/string/strcmp.c
new file mode 100644
index 0000000..3b35a1c
--- /dev/null
+++ b/device/lib/pic16/libc/string/strcmp.c
@@ -0,0 +1,46 @@
+/*-------------------------------------------------------------------------
+ strcmp.c - part of string library functions
+
+ Copyright (C) 1999, Sandeep Dutta <sandeep.dutta at usa.net>
+
+ This library 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, or (at your option) any
+ later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this library; see the file COPYING. If not, write to the
+ Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA.
+
+ As a special exception, if you link this library with other files,
+ some of which are compiled with SDCC, to produce an executable,
+ this library does not by itself cause the resulting executable to
+ be covered by the GNU General Public License. This exception does
+ not however invalidate any other reasons why the executable file
+ might be covered by the GNU General Public License.
+-------------------------------------------------------------------------*/
+
+#include <string.h>
+
+int
+strcmp (char *asrc, char *adst)
+{
+ register int ret = 0 ;
+
+ while (!(ret = *asrc - *adst) && *adst)
+ ++asrc, ++adst;
+
+ if (ret < 0)
+ ret = -1 ;
+ else if (ret > 0)
+ ret = 1 ;
+
+ return ret;
+}
+
diff --git a/device/lib/pic16/libc/string/strcpy.c b/device/lib/pic16/libc/string/strcpy.c
new file mode 100644
index 0000000..0cdef92
--- /dev/null
+++ b/device/lib/pic16/libc/string/strcpy.c
@@ -0,0 +1,40 @@
+/*-------------------------------------------------------------------------
+ strcpy.c - part of string library functions
+
+ Copyright (C) 1999, Sandeep Dutta <sandeep.dutta at usa.net>
+
+ This library 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, or (at your option) any
+ later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this library; see the file COPYING. If not, write to the
+ Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA.
+
+ As a special exception, if you link this library with other files,
+ some of which are compiled with SDCC, to produce an executable,
+ this library does not by itself cause the resulting executable to
+ be covered by the GNU General Public License. This exception does
+ not however invalidate any other reasons why the executable file
+ might be covered by the GNU General Public License.
+-------------------------------------------------------------------------*/
+
+#include <string.h>
+
+char *
+strcpy (char *d, char *s)
+{
+ register char *d1 = d;
+
+ while (*d1++ = *s++)
+ ;
+
+ return d;
+}
diff --git a/device/lib/pic16/libc/string/strcspn.c b/device/lib/pic16/libc/string/strcspn.c
new file mode 100644
index 0000000..6c3e2d1
--- /dev/null
+++ b/device/lib/pic16/libc/string/strcspn.c
@@ -0,0 +1,48 @@
+/*-------------------------------------------------------------------------
+ strcspn.c - part of string library functions
+
+ Copyright (C) 1999, Sandeep Dutta <sandeep.dutta at usa.net>
+ Bug fixed by Vangelis Rokas <vrokas at otenet.gr> (2004)
+
+ This library 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, or (at your option) any
+ later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this library; see the file COPYING. If not, write to the
+ Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA.
+
+ As a special exception, if you link this library with other files,
+ some of which are compiled with SDCC, to produce an executable,
+ this library does not by itself cause the resulting executable to
+ be covered by the GNU General Public License. This exception does
+ not however invalidate any other reasons why the executable file
+ might be covered by the GNU General Public License.
+-------------------------------------------------------------------------*/
+
+#include <string.h>
+
+int
+strcspn (char *string, char *control)
+{
+ register int count = 0;
+ register char ch;
+
+ while (ch = *string)
+ {
+ if (strchr (control, ch))
+ break;
+ else
+ count++ ;
+ string++;
+ }
+
+ return count;
+}
diff --git a/device/lib/pic16/libc/string/strlen.c b/device/lib/pic16/libc/string/strlen.c
new file mode 100644
index 0000000..1bcdd19
--- /dev/null
+++ b/device/lib/pic16/libc/string/strlen.c
@@ -0,0 +1,40 @@
+/*-------------------------------------------------------------------------
+ strlen.c - part of string library functions
+
+ Copyright (C) 1999, Sandeep Dutta <sandeep.dutta at usa.net>
+
+ This library 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, or (at your option) any
+ later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this library; see the file COPYING. If not, write to the
+ Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA.
+
+ As a special exception, if you link this library with other files,
+ some of which are compiled with SDCC, to produce an executable,
+ this library does not by itself cause the resulting executable to
+ be covered by the GNU General Public License. This exception does
+ not however invalidate any other reasons why the executable file
+ might be covered by the GNU General Public License.
+-------------------------------------------------------------------------*/
+
+#include <string.h>
+
+int
+strlen (char *str)
+{
+ register int i = 0 ;
+
+ while (*str++)
+ i++;
+
+ return i;
+}
diff --git a/device/lib/pic16/libc/string/strlwr.c b/device/lib/pic16/libc/string/strlwr.c
new file mode 100644
index 0000000..169a623
--- /dev/null
+++ b/device/lib/pic16/libc/string/strlwr.c
@@ -0,0 +1,44 @@
+/*-------------------------------------------------------------------------
+ strlwr.c - part of string library functions
+
+ Copyright (C) 2004, Vangelis Rokas <vrokas at otenet.gr>
+
+ This library 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, or (at your option) any
+ later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this library; see the file COPYING. If not, write to the
+ Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA.
+
+ As a special exception, if you link this library with other files,
+ some of which are compiled with SDCC, to produce an executable,
+ this library does not by itself cause the resulting executable to
+ be covered by the GNU General Public License. This exception does
+ not however invalidate any other reasons why the executable file
+ might be covered by the GNU General Public License.
+-------------------------------------------------------------------------*/
+
+#include <ctype.h>
+#include <string.h>
+
+char *
+strlwr (char *str)
+{
+ char *ret = str;
+
+ while (*str)
+ {
+ *str = tolower (*str);
+ str++;
+ }
+
+ return ret;
+}
diff --git a/device/lib/pic16/libc/string/strncat.c b/device/lib/pic16/libc/string/strncat.c
new file mode 100644
index 0000000..77693f4
--- /dev/null
+++ b/device/lib/pic16/libc/string/strncat.c
@@ -0,0 +1,47 @@
+/*-------------------------------------------------------------------------
+ strncat.c - part of string library functions
+
+ Copyright (C) 1999, Sandeep Dutta <sandeep.dutta at usa.net>
+
+ This library 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, or (at your option) any
+ later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this library; see the file COPYING. If not, write to the
+ Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA.
+
+ As a special exception, if you link this library with other files,
+ some of which are compiled with SDCC, to produce an executable,
+ this library does not by itself cause the resulting executable to
+ be covered by the GNU General Public License. This exception does
+ not however invalidate any other reasons why the executable file
+ might be covered by the GNU General Public License.
+-------------------------------------------------------------------------*/
+
+#include <string.h>
+
+char *
+strncat (char *front, char * back, size_t count)
+{
+ char *start = front;
+
+ while (*front++)
+ ;
+
+ front--;
+ while (count--)
+ if (!(*front++ = *back++))
+ return start;
+
+ *front = '\0';
+
+ return start;
+}
diff --git a/device/lib/pic16/libc/string/strncmp.c b/device/lib/pic16/libc/string/strncmp.c
new file mode 100644
index 0000000..2778911
--- /dev/null
+++ b/device/lib/pic16/libc/string/strncmp.c
@@ -0,0 +1,44 @@
+/*-------------------------------------------------------------------------
+ strncmp.c - part of string library functions
+
+ Copyright (C) 1999, Sandeep Dutta <sandeep.dutta at usa.net>
+
+ This library 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, or (at your option) any
+ later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this library; see the file COPYING. If not, write to the
+ Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA.
+
+ As a special exception, if you link this library with other files,
+ some of which are compiled with SDCC, to produce an executable,
+ this library does not by itself cause the resulting executable to
+ be covered by the GNU General Public License. This exception does
+ not however invalidate any other reasons why the executable file
+ might be covered by the GNU General Public License.
+-------------------------------------------------------------------------*/
+
+#include <string.h>
+
+int
+strncmp (char *first, char *last, size_t count)
+{
+ if (!count)
+ return 0;
+
+ while (--count && *first && *first == *last)
+ {
+ first++;
+ last++;
+ }
+
+ return *first - *last;
+}
diff --git a/device/lib/pic16/libc/string/strncpy.c b/device/lib/pic16/libc/string/strncpy.c
new file mode 100644
index 0000000..d7cce67
--- /dev/null
+++ b/device/lib/pic16/libc/string/strncpy.c
@@ -0,0 +1,48 @@
+/*-------------------------------------------------------------------------
+ strncpy.c - part of string library functions
+
+ Copyright (C) 1999, Sandeep Dutta <sandeep.dutta at usa.net>
+
+ This library 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, or (at your option) any
+ later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this library; see the file COPYING. If not, write to the
+ Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA.
+
+ As a special exception, if you link this library with other files,
+ some of which are compiled with SDCC, to produce an executable,
+ this library does not by itself cause the resulting executable to
+ be covered by the GNU General Public License. This exception does
+ not however invalidate any other reasons why the executable file
+ might be covered by the GNU General Public License.
+-------------------------------------------------------------------------*/
+
+#include <string.h>
+
+char *
+strncpy (char *d, char *s, size_t n)
+{
+ register char *d1 = d;
+
+ while (n && *s)
+ {
+ n--;
+ *d1++ = *s++;
+ }
+
+ while (n--)
+ {
+ *d1++ = '\0';
+ }
+
+ return d;
+}
diff --git a/device/lib/pic16/libc/string/strpbrk.c b/device/lib/pic16/libc/string/strpbrk.c
new file mode 100644
index 0000000..c3451c8
--- /dev/null
+++ b/device/lib/pic16/libc/string/strpbrk.c
@@ -0,0 +1,43 @@
+/*-------------------------------------------------------------------------
+ strpbrk.c - part of string library functions
+
+ Copyright (C) 1999, Sandeep Dutta <sandeep.dutta at usa.net>
+
+ This library 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, or (at your option) any
+ later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this library; see the file COPYING. If not, write to the
+ Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA.
+
+ As a special exception, if you link this library with other files,
+ some of which are compiled with SDCC, to produce an executable,
+ this library does not by itself cause the resulting executable to
+ be covered by the GNU General Public License. This exception does
+ not however invalidate any other reasons why the executable file
+ might be covered by the GNU General Public License.
+-------------------------------------------------------------------------*/
+
+#include <string.h>
+
+char *
+strpbrk (char *string, char *control)
+{
+ register char ch;
+
+ while(ch = *string)
+ {
+ if (strchr (control, ch))
+ return string;
+ }
+
+ return NULL;
+}
diff --git a/device/lib/pic16/libc/string/strrchr.c b/device/lib/pic16/libc/string/strrchr.c
new file mode 100644
index 0000000..c543c96
--- /dev/null
+++ b/device/lib/pic16/libc/string/strrchr.c
@@ -0,0 +1,49 @@
+/*-------------------------------------------------------------------------
+ strrchr.c - part of string library functions
+
+ Copyright (C) 1999, Sandeep Dutta <sandeep.dutta at usa.net>
+
+ This library 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, or (at your option) any
+ later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this library; see the file COPYING. If not, write to the
+ Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA.
+
+ As a special exception, if you link this library with other files,
+ some of which are compiled with SDCC, to produce an executable,
+ this library does not by itself cause the resulting executable to
+ be covered by the GNU General Public License. This exception does
+ not however invalidate any other reasons why the executable file
+ might be covered by the GNU General Public License.
+-------------------------------------------------------------------------*/
+
+#include <string.h>
+
+char *
+strrchr (char *string, char ch)
+{
+ register char *s = string;
+
+ /* find end of string */
+ while (*s++)
+ ;
+
+ /* search towards front */
+ while (--s != string && *s != ch)
+ ;
+
+ /* char found ? */
+ if (*s == ch)
+ return s;
+
+ return NULL;
+}
diff --git a/device/lib/pic16/libc/string/strspn.c b/device/lib/pic16/libc/string/strspn.c
new file mode 100644
index 0000000..e3af1a3
--- /dev/null
+++ b/device/lib/pic16/libc/string/strspn.c
@@ -0,0 +1,48 @@
+/*-------------------------------------------------------------------------
+ strspn.c - part of string library functions
+
+ Copyright (C) 1999, Sandeep Dutta <sandeep.dutta at usa.net>
+
+ This library 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, or (at your option) any
+ later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this library; see the file COPYING. If not, write to the
+ Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA.
+
+ As a special exception, if you link this library with other files,
+ some of which are compiled with SDCC, to produce an executable,
+ this library does not by itself cause the resulting executable to
+ be covered by the GNU General Public License. This exception does
+ not however invalidate any other reasons why the executable file
+ might be covered by the GNU General Public License.
+-------------------------------------------------------------------------*/
+
+#include <string.h>
+
+int
+strspn (char *string, char *control)
+{
+ register int count = 0;
+ register char ch;
+
+ while (ch = *string)
+ {
+ if (strchr (control, ch))
+ ++count;
+ else
+ break;
+
+ ++string;
+ }
+
+ return count;
+}
diff --git a/device/lib/pic16/libc/string/strstr.c b/device/lib/pic16/libc/string/strstr.c
new file mode 100644
index 0000000..c99f847
--- /dev/null
+++ b/device/lib/pic16/libc/string/strstr.c
@@ -0,0 +1,57 @@
+/*-------------------------------------------------------------------------
+ strstr.c - part of string library functions
+
+ Copyright (C) 1999, Sandeep Dutta <sandeep.dutta at usa.net>
+
+ This library 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, or (at your option) any
+ later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this library; see the file COPYING. If not, write to the
+ Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA.
+
+ As a special exception, if you link this library with other files,
+ some of which are compiled with SDCC, to produce an executable,
+ this library does not by itself cause the resulting executable to
+ be covered by the GNU General Public License. This exception does
+ not however invalidate any other reasons why the executable file
+ might be covered by the GNU General Public License.
+-------------------------------------------------------------------------*/
+
+#include <string.h>
+
+char *
+strstr (char *str1, char *str2)
+{
+ char *cp = str1;
+ char *s1;
+ char *s2;
+
+
+ if (!*str2)
+ return str1;
+
+ while (*cp)
+ {
+ s1 = cp;
+ s2 = str2;
+
+ while (*s1 && *s2 && !(*s1-*s2))
+ s1++, s2++;
+
+ if (!*s2)
+ return cp;
+
+ ++cp;
+ }
+
+ return NULL;
+}
diff --git a/device/lib/pic16/libc/string/strtok.c b/device/lib/pic16/libc/string/strtok.c
new file mode 100644
index 0000000..f9cbdd0
--- /dev/null
+++ b/device/lib/pic16/libc/string/strtok.c
@@ -0,0 +1,69 @@
+/*-------------------------------------------------------------------------
+ strtok.c - part of string library functions
+
+ Copyright (C) 1999, Sandeep Dutta <sandeep.dutta at usa.net>
+
+ This library 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, or (at your option) any
+ later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this library; see the file COPYING. If not, write to the
+ Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA.
+
+ As a special exception, if you link this library with other files,
+ some of which are compiled with SDCC, to produce an executable,
+ this library does not by itself cause the resulting executable to
+ be covered by the GNU General Public License. This exception does
+ not however invalidate any other reasons why the executable file
+ might be covered by the GNU General Public License.
+-------------------------------------------------------------------------*/
+
+#include <string.h>
+
+char *
+strtok (char *str, char *control)
+{
+ static char *s = NULL;
+ register char *s1;
+
+ if (str)
+ s = str;
+
+ if (!s)
+ return NULL;
+
+ while (*s)
+ {
+ if (strchr (control, *s))
+ s++;
+ else
+ break;
+ }
+
+ s1 = s;
+
+ while (*s)
+ {
+ if (strchr (control, *s))
+ {
+ *s = '\0';
+ return s1;
+ }
+ ++s;
+ }
+
+ s = NULL;
+
+ if (*s1)
+ return s1;
+ else
+ return NULL;
+}
diff --git a/device/lib/pic16/libc/string/strupr.c b/device/lib/pic16/libc/string/strupr.c
new file mode 100644
index 0000000..4010372
--- /dev/null
+++ b/device/lib/pic16/libc/string/strupr.c
@@ -0,0 +1,44 @@
+/*-------------------------------------------------------------------------
+ strupr.c - part of string library functions
+
+ Copyright (C) 2004, Vangelis Rokas <vrokas at otenet.gr>
+
+ This library 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, or (at your option) any
+ later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this library; see the file COPYING. If not, write to the
+ Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA.
+
+ As a special exception, if you link this library with other files,
+ some of which are compiled with SDCC, to produce an executable,
+ this library does not by itself cause the resulting executable to
+ be covered by the GNU General Public License. This exception does
+ not however invalidate any other reasons why the executable file
+ might be covered by the GNU General Public License.
+-------------------------------------------------------------------------*/
+
+#include <ctype.h>
+#include <string.h>
+
+char *
+strupr (char *str)
+{
+ char *ret = str;
+
+ while (*str)
+ {
+ *str = toupper (*str);
+ ++str;
+ }
+
+ return ret;
+}