From: John Hodge Date: Sun, 11 May 2014 06:58:35 +0000 (+0800) Subject: Usermode/libposix - Updates to get curl and netsurf compiled X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=23511012ba2a6063770da17c6564839860b9ed64;p=tpg%2Facess2.git Usermode/libposix - Updates to get curl and netsurf compiled --- diff --git a/Usermode/Libraries/libposix.so_src/include_exp/endian.h b/Usermode/Libraries/libposix.so_src/include_exp/endian.h new file mode 100644 index 00000000..a70ec0d7 --- /dev/null +++ b/Usermode/Libraries/libposix.so_src/include_exp/endian.h @@ -0,0 +1,11 @@ +/* + */ +#ifndef _LIBPOSIX_ENDIAN_H_ +#define _LIBPOSIX_ENDIAN_H_ + +#define __LITTLE_ENDIAN 0 +#define __BIG_ENDIAN 0 +#define __BYTE_ORDER __LITTLE_ENDIAN + +#endif + diff --git a/Usermode/Libraries/libposix.so_src/include_exp/regex.h b/Usermode/Libraries/libposix.so_src/include_exp/regex.h new file mode 100644 index 00000000..a830286c --- /dev/null +++ b/Usermode/Libraries/libposix.so_src/include_exp/regex.h @@ -0,0 +1,36 @@ +/* + * Acess2 POSIX Emulation Library + * - By John Hodge (thePowersGang) + * + * regex.h + * - POSIX regular expression support + */ +#ifndef _LIBPOSIX_REGEX_H_ +#define _LIBPOSIX_REGEX_H_ + +typedef struct { + void *unused; +} regex_t; + +typedef size_t regoff_t; + +typedef struct { + regoff_t rm_so; + regoff_t rm_eo; +} regmatch_t; + +extern int regcomp(regex_t *preg, const char *regex, int cflags); +extern int regexec(const regex_t *preg, const char *string, size_t nmatch, regmatch_t pmatch[], int eflags); +extern size_t regerror(int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size); +extern void regfree(regex_t *preg); + +enum { + REG_BADBR = 1, + REG_BADPAT, + REG_BADRPT, +}; + + +#endif + + diff --git a/Usermode/Libraries/libposix.so_src/include_exp/strings.h b/Usermode/Libraries/libposix.so_src/include_exp/strings.h new file mode 100644 index 00000000..9c4114d9 --- /dev/null +++ b/Usermode/Libraries/libposix.so_src/include_exp/strings.h @@ -0,0 +1,14 @@ +/* + * Acess2 POSIX Emulation Library + * - By John Hodge (thePowersGang) + * + * strings.h + * - BSD's verison of string.h + */ +#ifndef _LIBPOSIX_STRINGS_H_ +#define _LIBPOSIX_STRINGS_H_ + + + +#endif + diff --git a/Usermode/Libraries/libposix.so_src/include_exp/unistd.h b/Usermode/Libraries/libposix.so_src/include_exp/unistd.h index 6519b3b7..10c4779f 100644 --- a/Usermode/Libraries/libposix.so_src/include_exp/unistd.h +++ b/Usermode/Libraries/libposix.so_src/include_exp/unistd.h @@ -71,6 +71,10 @@ extern int chmod(const char *path, mode_t mode); extern int unlink(const char *pathname); +#define F_OK 00 +#define R_OK 04 +#define W_OK 02 +#define X_OK 01 extern int access(const char *pathname, int mode); extern pid_t setsid(void); @@ -93,6 +97,7 @@ extern unsigned int alarm(unsigned int seconds); extern char *crypt(const char *key, const char *salt); // - pty.c +extern int isatty(int fd); extern char *ttyname(int fd); extern int ttyname_r(int fd, char *buf, size_t buflen); diff --git a/Usermode/Libraries/libposix.so_src/unistd.c b/Usermode/Libraries/libposix.so_src/unistd.c index 3af7bcbc..dca29630 100644 --- a/Usermode/Libraries/libposix.so_src/unistd.c +++ b/Usermode/Libraries/libposix.so_src/unistd.c @@ -292,3 +292,21 @@ int ttyname_r(int fd, char *buf, size_t buflen) return ENOTIMPL; } + +int isatty(int fd) +{ + if( fd < 0 ) { + errno = EBADF; + return 0; + } + + int type = _SysIOCtl(fd, DRV_IOCTL_TYPE, NULL); + if( type == -1 ) + return 0; + if( type != DRV_TYPE_TERMINAL ) { + errno = ENOTTY; + // NOTE: Pre POSIX 2001, EINVAL was returned + return 0; + } + return 1; +}