Kernel - Fixed hack that was tripping armv7 alignment warnings
[tpg/acess2.git] / Usermode / Libraries / libposix.so_src / unistd.c
index 78896db..09b603c 100644 (file)
@@ -11,6 +11,7 @@
 #include <sys/select.h>
 #include <stdio.h>
 #include <string.h>
+#include <acess/devices/pty.h>
 
 // === CODE ===
 int unlink(const char *pathname)
@@ -78,6 +79,11 @@ int seek(int fd, int whence, off_t dest)
        return _SysSeek(fd, whence, dest);
 }
 
+off_t lseek(int fd, off_t offset, int whence)
+{
+       return _SysSeek(fd, whence, offset);
+}
+
 off_t tell(int fd)
 {
        return _SysTell(fd);
@@ -173,18 +179,27 @@ int chdir(const char *dir)
 
 int mkdir(const char *pathname, mode_t mode)
 {
-       _SysDebug("TODO: POSIX mkdir(%i, 0%o)", pathname, mode);
-       return -1;
+       _SysDebug("TODO: POSIX mkdir('%s', 0%o)", pathname, mode);
+       _SysMkDir(pathname);
+       return 0;
 }
 
 char *getpass(const char *prompt)
 {
        static char passbuf[PASS_MAX+1];
+       struct ptymode  oldmode, mode;
+       _SysIOCtl(STDIN_FILENO, PTY_IOCTL_GETMODE, &oldmode);
+       mode.InputMode = PTYIMODE_CANON;
+       mode.OutputMode = 0;
+       _SysIOCtl(STDIN_FILENO, PTY_IOCTL_SETMODE, &mode);
        fprintf(stderr, "%s", prompt);
        fgets(passbuf, PASS_MAX+1, stdin);
        fprintf(stderr, "\n");
        for( int i = strlen(passbuf); i > 0 && (passbuf[i-1] == '\r' || passbuf[i-1] == '\n'); i -- )
                passbuf[i-1] = 0;
+
+       _SysIOCtl(STDIN_FILENO, PTY_IOCTL_SETMODE, &oldmode);
+
        return passbuf;
 }
 

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