From a4cc01bf2e726b219ccca7620780985864791cd1 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sat, 10 May 2014 17:05:02 +0800 Subject: [PATCH] Usermode/libposix - add stubbed getopt --- Usermode/Libraries/libposix.so_src/Makefile | 2 +- Usermode/Libraries/libposix.so_src/getopt.c | 21 +++++++++++++++ .../libposix.so_src/include_exp/getopt.h | 27 +++++++++++++++++++ 3 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 Usermode/Libraries/libposix.so_src/getopt.c create mode 100644 Usermode/Libraries/libposix.so_src/include_exp/getopt.h diff --git a/Usermode/Libraries/libposix.so_src/Makefile b/Usermode/Libraries/libposix.so_src/Makefile index dcbf8f53..41684d6e 100644 --- a/Usermode/Libraries/libposix.so_src/Makefile +++ b/Usermode/Libraries/libposix.so_src/Makefile @@ -11,7 +11,7 @@ LDFLAGS += -soname libposix.so -Map map.txt -lc OBJ = main.o unistd.o dirent.o stat.o utmpx.o termios.o OBJ += pwd.o syslog.o sys_time.o sys_ioctl.o sys_resource.o OBJ += fcntl.o clocks.o sys_wait.o unistd_crypt.o -OBJ += grp.o pty.o mktemp.o utime.o +OBJ += grp.o pty.o mktemp.o utime.o getopt.o DEPFILES := $(OBJ:%.o=%.d) BIN = libposix.so diff --git a/Usermode/Libraries/libposix.so_src/getopt.c b/Usermode/Libraries/libposix.so_src/getopt.c new file mode 100644 index 00000000..ab6186bb --- /dev/null +++ b/Usermode/Libraries/libposix.so_src/getopt.c @@ -0,0 +1,21 @@ +/* + * Acess2 POSIX Emulation Layer + * - By John Hodge (thePowersGang) + * + * getopt.c + * - getopt() command line parsing code + */ +#include + +// === GLOBALS === +char* optarg; + int opterr; + int optind; + int optopt; + +// === CODE === +int getopt(int argc, char * const argv[], const char *optstring) +{ + return -1; +} + diff --git a/Usermode/Libraries/libposix.so_src/include_exp/getopt.h b/Usermode/Libraries/libposix.so_src/include_exp/getopt.h new file mode 100644 index 00000000..b6db119e --- /dev/null +++ b/Usermode/Libraries/libposix.so_src/include_exp/getopt.h @@ -0,0 +1,27 @@ +/* + * Acess2 POSIX Emulation Layer + * - By John Hodge (thePowersGang) + * + * getopt.h + * - getopt() command line parsing code + */ +#ifndef _LIBPOSIX_GETOPT_H_ +#define _LIBPOSIX_GETOPT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +extern char* optarg; +extern int opterr; +extern int optind; +extern int optopt; + +extern int getopt(int argc, char * const argv[], const char *optstring); + +#ifdef __cplusplus +} +#endif + +#endif + -- 2.20.1