diff --git a/include/unistd.h b/include/unistd.h
index 5c6426e3..1c4086ad 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -51,6 +51,7 @@ int access (char const *s, int mode);
int close (int fd);
int execvp (char const *file, char *const argv[]);
char *getcwd (char *buf, size_t size);
+int isatty (int fd);
off_t lseek (int fd, off_t offset, int whence);
int read (int fd, void* buf, size_t n);
int unlink (char const *file_name);
diff --git a/lib/libc.c b/lib/libc.c
index bfef3eec..97565c31 100644
--- a/lib/libc.c
+++ b/lib/libc.c
@@ -18,6 +18,7 @@
* along with Mes. If not, see .
*/
+#include
#include
#include
@@ -419,4 +420,11 @@ sprintf (char *str, char const* format, ...)
va_end (ap);
return r;
}
+
+int
+isatty (int fd)
+{
+ return ioctl (fd, TCGETS, 0) == -14; // MAGIC
+}
+
#endif //!POSIX