--- /dev/null
+/*
+ Convert from strings to numbers, or numbers to strings
+ Copyright (c) 2010 TJ <linux@tjworld.net>
+
+ 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 3 of the License, or
+ (at your option) any later version.
+
+ This program 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 program (See the COPYRIGHT file the base directory).
+ If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __CONVERT_H
+#define __CONVERT_H
+
+unsigned long hextoul(const char *str);
+int hex_into_ul(const char *str, unsigned long *result);
+void bytetohex(const char c, char *str);
+void ultohex(unsigned long u, char *str);
+
+#endif
--- /dev/null
+/*
+ libc standard library functions
+ Copyright (c) 2010 TJ <linux@tjworld.net>
+
+ 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 3 of the License, or
+ (at your option) any later version.
+
+ This program 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 program (See the COPYRIGHT file the base directory).
+ If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __STDLIB_H
+#define __STDLIB_H
+
+long int atol(const char *str);
+int atoi(const char *str);
+
+/*
+ These functions are unused and not defined
+
+long a64l(const char *);
+void abort(void);
+int abs(int);
+int atexit(void (*)(void));
+double atof(const char *);
+void *bsearch(const void *, const void *, size_t, size_t,
+ int (*)(const void *, const void *));
+void *calloc(size_t, size_t);
+div_t div(int, int);
+double drand48(void);
+char *ecvt(double, int, int *, int *);
+double erand48(unsigned short int[3]);
+void exit(int);
+char *fcvt (double, int, int *, int *);
+void free(void *);
+
+
+char *gcvt(double, int, char *);
+char *getenv(const char *);
+int getsubopt(char **, char *const *, char **);
+int grantpt(int);
+char *initstate(unsigned int, char *, size_t);
+long int jrand48(unsigned short int[3]);
+char *l64a(long);
+long int labs(long int);
+void lcong48(unsigned short int[7]);
+ldiv_t ldiv(long int, long int);
+long int lrand48(void);
+void *malloc(size_t);
+int mblen(const char *, size_t);
+size_t mbstowcs(wchar_t *, const char *, size_t);
+int mbtowc(wchar_t *, const char *, size_t);
+char *mktemp(char *);
+int mkstemp(char *);
+long int mrand48(void);
+long int nrand48(unsigned short int [3]);
+char *ptsname(int);
+int putenv(char *);
+void qsort(void *, size_t, size_t, int (*)(const void *,
+ const void *));
+int rand(void);
+int rand_r(unsigned int *);
+long random(void);
+void *realloc(void *, size_t);
+char *realpath(const char *, char *);
+unsigned short int seed48(unsigned short int[3]);
+void setkey(const char *);
+char *setstate(const char *);
+void srand(unsigned int);
+void srand48(long int);
+void srandom(unsigned);
+double strtod(const char *, char **);
+long int strtol(const char *, char **, int);
+unsigned long int
+ strtoul(const char *, char **, int);
+int system(const char *);
+int ttyslot(void); (LEGACY)
+int unlockpt(int);
+void *valloc(size_t); (LEGACY)
+size_t wcstombs(char *, const wchar_t *, size_t);
+int wctomb(char *, wchar_t);
+*/
+
+#endif
--- /dev/null
+/*
+ libc string and memory functions
+ Copyright (c) 2010 TJ <linux@tjworld.net>
+
+ 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 3 of the License, or
+ (at your option) any later version.
+
+ This program 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 program (See the COPYRIGHT file the base directory).
+ If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __STRING_H
+#define __STRING_H
+
+#include <stddef.h> // for size_t
+
+char *strcpy(char *s1, const char *s2);
+size_t strlen(const char *s1);
+int strcmp(const char *s1, const char *s2);
+char *strcat(char *s1, const char *s2);
+int strncmp(const char *s1, const char *s2, size_t n);
+char *strchr(const char *str, int c);
+int __strcmp(const char *s1, const char *s2);
+void *memset(void *p, int c, size_t n);
+void *memcpy(void *p1, const void *p2, size_t n);
+void *memmove(void *p1, const void *p2, size_t n);
+int memcmp(const void *p1, const void *p2, size_t n);
+
+/*
+ These functions are unused and not defined
+
+void *memccpy(void *, const void *, int, size_t);
+void *memchr(const void *, int, size_t);
+int strcoll(const char *, const char *);
+size_t strcspn(const char *, const char *);
+char *strdup(const char *);
+char *strerror(int);
+char *strncat(char *, const char *, size_t);
+char *strncpy(char *, const char *, size_t);
+char *strpbrk(const char *, const char *);
+char *strrchr(const char *, int);
+size_t strspn(const char *, const char *);
+char *strstr(const char *, const char *);
+char *strtok(char *, const char *);
+char *strtok_r(char *, const char *, char **);
+size_t strxfrm(char *, const char *, size_t);
+*/
+
+#endif
--- /dev/null
+libc_functions = atol.o atoi.o strcpy.o strlen.o strcmp.o strcat.o strncmp.o strchr.o __strcmp.o memset.o memcpy.o memmove.o memcmp.o hextoul.o ultohex.o bytetohex.o hex_into_ul.o
+
+libc.o: $(libc_functions)
+ $(LD) -r -N -o libc.o $(libc_functions)
+
+#all: libc.o
+
+clean:
+ rm -f *.o
+
+.PHONY: all clean
--- /dev/null
+/*
+ Compare strings
+ Copyright (c) 2010 TJ <linux@tjworld.net>
+
+ 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 3 of the License, or
+ (at your option) any later version.
+
+ This program 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 program (See the COPYRIGHT file the base directory).
+ If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <string.h>
+
+int
+__strcmp(const char *s1, const char *s2) {
+ int result = 0;
+
+ return result;
+}
--- /dev/null
+/*
+ ASCII character to integer
+ Copyright (c) 2010 TJ <linux@tjworld.net>
+
+ 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 3 of the License, or
+ (at your option) any later version.
+
+ This program 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 program (See the COPYRIGHT file the base directory).
+ If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <stdlib.h>
+
+int
+atoi(const char *str) {
+ int result = 0;
+
+ return result;
+}
+
--- /dev/null
+/*
+ ASCII character to long
+ Copyright (c) 2010 TJ <linux@tjworld.net>
+
+ 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 3 of the License, or
+ (at your option) any later version.
+
+ This program 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 program (See the COPYRIGHT file the base directory).
+ If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <stdlib.h>
+
+long int
+atol(const char *str) {
+ long int result = 0;
+
+ return result;
+}
+
--- /dev/null
+/*
+ Convert from byte to hex string
+ Copyright (c) 2010 TJ <linux@tjworld.net>
+
+ 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 3 of the License, or
+ (at your option) any later version.
+
+ This program 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 program (See the COPYRIGHT file the base directory).
+ If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <libc/convert.h>
+
+void
+bytetohex(const char c, char *str) {
+}
--- /dev/null
+/*
+ Convert from hex string to number
+ Copyright (c) 2010 TJ <linux@tjworld.net>
+
+ 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 3 of the License, or
+ (at your option) any later version.
+
+ This program 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 program (See the COPYRIGHT file the base directory).
+ If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <libc/convert.h>
+
+int
+hex_into_ul(const char *str, unsigned long *result) {
+ int ret = 0;
+
+ return ret;
+}
--- /dev/null
+/*
+ Convert from hex string to number
+ Copyright (c) 2010 TJ <linux@tjworld.net>
+
+ 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 3 of the License, or
+ (at your option) any later version.
+
+ This program 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 program (See the COPYRIGHT file the base directory).
+ If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <libc/convert.h>
+
+unsigned long
+hextoul(const char *str) {
+ unsigned long ret = 0;
+
+ return ret;
+}
--- /dev/null
+/*
+ Compare memory buffers
+ Copyright (c) 2010 TJ <linux@tjworld.net>
+
+ 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 3 of the License, or
+ (at your option) any later version.
+
+ This program 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 program (See the COPYRIGHT file the base directory).
+ If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <string.h>
+
+int
+memcmp(const void *p1, const void *p2, size_t n) {
+ int result = 0;
+
+ return result;
+}
--- /dev/null
+/*
+ Copy bytes between memory buffers
+ Copyright (c) 2010 TJ <linux@tjworld.net>
+
+ 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 3 of the License, or
+ (at your option) any later version.
+
+ This program 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 program (See the COPYRIGHT file the base directory).
+ If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <string.h>
+
+void *
+memcpy(void *p1, const void *p2, size_t n) {
+ return p1;
+}
--- /dev/null
+/*
+ Move bytes between memory buffers
+ Copyright (c) 2010 TJ <linux@tjworld.net>
+
+ 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 3 of the License, or
+ (at your option) any later version.
+
+ This program 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 program (See the COPYRIGHT file the base directory).
+ If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <string.h>
+
+void *
+memmove(void *p1, const void *p2, size_t n) {
+ return p1;
+}
--- /dev/null
+/*
+ Set bytes in memory buffer
+ Copyright (c) 2010 TJ <linux@tjworld.net>
+
+ 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 3 of the License, or
+ (at your option) any later version.
+
+ This program 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 program (See the COPYRIGHT file the base directory).
+ If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <string.h>
+
+void *
+memset(void *p, int c, size_t n) {
+ return p;
+}
--- /dev/null
+/*
+ Concatenate strings
+ Copyright (c) 2010 TJ <linux@tjworld.net>
+
+ 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 3 of the License, or
+ (at your option) any later version.
+
+ This program 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 program (See the COPYRIGHT file the base directory).
+ If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <string.h>
+
+char *
+strcat(char *s1, const char *s2) {
+ char *str = s1;
+
+ return str;
+}
--- /dev/null
+/*
+ Find character in string
+ Copyright (c) 2010 TJ <linux@tjworld.net>
+
+ 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 3 of the License, or
+ (at your option) any later version.
+
+ This program 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 program (See the COPYRIGHT file the base directory).
+ If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <string.h>
+
+char *
+strchr(const char *str, int c) {
+ char *p = (char *)str;
+
+ return p;
+}
--- /dev/null
+/*
+ Compare strings
+ Copyright (c) 2010 TJ <linux@tjworld.net>
+
+ 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 3 of the License, or
+ (at your option) any later version.
+
+ This program 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 program (See the COPYRIGHT file the base directory).
+ If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <string.h>
+
+int
+strcmp(const char *s1, const char *s2) {
+ int result = 0;
+
+ return result;
+}
--- /dev/null
+/*
+ Copy a string
+ Copyright (c) 2010 TJ <linux@tjworld.net>
+
+ 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 3 of the License, or
+ (at your option) any later version.
+
+ This program 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 program (See the COPYRIGHT file the base directory).
+ If not, see <http://www.gnu.org/licenses/>.
+*/
+
+char *
+strcpy(char *s1, const char *s2) {
+ return s1;
+}
+
--- /dev/null
+/*
+ Get length of ASCII string
+ Copyright (c) 2010 TJ <linux@tjworld.net>
+
+ 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 3 of the License, or
+ (at your option) any later version.
+
+ This program 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 program (See the COPYRIGHT file the base directory).
+ If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <string.h>
+
+size_t
+strlen(const char *s1) {
+ size_t len = 0;
+
+ return len;
+}
--- /dev/null
+/*
+ Compare strings limited by count
+ Copyright (c) 2010 TJ <linux@tjworld.net>
+
+ 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 3 of the License, or
+ (at your option) any later version.
+
+ This program 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 program (See the COPYRIGHT file the base directory).
+ If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <string.h>
+
+int
+strncmp(const char *s1, const char *s2, size_t n) {
+ int result = 0;
+
+ return result;
+}
--- /dev/null
+/*
+ Convert from number to hex string
+ Copyright (c) 2010 TJ <linux@tjworld.net>
+
+ 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 3 of the License, or
+ (at your option) any later version.
+
+ This program 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 program (See the COPYRIGHT file the base directory).
+ If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <libc/convert.h>
+
+void
+ultohex(unsigned long u, char *str) {
+}