Usermode/libposix - Updates to get curl and netsurf compiled
authorJohn Hodge <[email protected]>
Sun, 11 May 2014 06:58:35 +0000 (14:58 +0800)
committerJohn Hodge <[email protected]>
Sun, 11 May 2014 06:58:35 +0000 (14:58 +0800)
Usermode/Libraries/libposix.so_src/include_exp/endian.h [new file with mode: 0644]
Usermode/Libraries/libposix.so_src/include_exp/regex.h [new file with mode: 0644]
Usermode/Libraries/libposix.so_src/include_exp/strings.h [new file with mode: 0644]
Usermode/Libraries/libposix.so_src/include_exp/unistd.h
Usermode/Libraries/libposix.so_src/unistd.c

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 (file)
index 0000000..a70ec0d
--- /dev/null
@@ -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 (file)
index 0000000..a830286
--- /dev/null
@@ -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 (file)
index 0000000..9c4114d
--- /dev/null
@@ -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
+
index 6519b3b..10c4779 100644 (file)
@@ -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);
 
index 3af7bcb..dca2963 100644 (file)
@@ -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;
+}

UCC git Repository :: git.ucc.asn.au