Index: uspace/Makefile
===================================================================
--- uspace/Makefile	(revision 423e5e870fcfa2de97aafe676e896a602162ecf5)
+++ uspace/Makefile	(revision f5c80460a9886faf736b47c8926a4dae299030cc)
@@ -35,4 +35,5 @@
 DIRS = \
 	app/bdsh \
+	app/cpp \
 	app/edit \
 	app/getterm \
@@ -144,4 +145,5 @@
 	lib/block \
 	lib/clui \
+	lib/compat \
 	lib/softint \
 	lib/softfloat \
Index: uspace/Makefile.common
===================================================================
--- uspace/Makefile.common	(revision 423e5e870fcfa2de97aafe676e896a602162ecf5)
+++ uspace/Makefile.common	(revision f5c80460a9886faf736b47c8926a4dae299030cc)
@@ -82,4 +82,6 @@
 LIBSOFTINT_PREFIX = $(LIB_PREFIX)/softint
 
+LIBCOMPAT_PREFIX = $(LIB_PREFIX)/compat
+
 LIBBLOCK_PREFIX = $(LIB_PREFIX)/block
 LIBFS_PREFIX = $(LIB_PREFIX)/fs
Index: uspace/lib/compat/Makefile
===================================================================
--- uspace/lib/compat/Makefile	(revision f5c80460a9886faf736b47c8926a4dae299030cc)
+++ uspace/lib/compat/Makefile	(revision f5c80460a9886faf736b47c8926a4dae299030cc)
@@ -0,0 +1,39 @@
+#
+# Copyright (c) 2011 Jiri Zarevucky
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# - Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# - Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in the
+#   documentation and/or other materials provided with the distribution.
+# - The name of the author may not be used to endorse or promote products
+#   derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+USPACE_PREFIX = ../..
+LIBRARY = libcompat
+
+SOURCES = \
+	ctype.c \
+	isatty.c \
+	sys/stat.c \
+	string.c \
+	time.c
+
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/lib/compat/compat
===================================================================
--- uspace/lib/compat/compat	(revision f5c80460a9886faf736b47c8926a4dae299030cc)
+++ uspace/lib/compat/compat	(revision f5c80460a9886faf736b47c8926a4dae299030cc)
@@ -0,0 +1,1 @@
+/home/jirkazr/HelenOS_pcc/uspace/lib/compat
Index: uspace/lib/compat/ctype.c
===================================================================
--- uspace/lib/compat/ctype.c	(revision f5c80460a9886faf736b47c8926a4dae299030cc)
+++ uspace/lib/compat/ctype.c	(revision f5c80460a9886faf736b47c8926a4dae299030cc)
@@ -0,0 +1,10 @@
+
+#include "ctype.h"
+
+int isxdigit(int ch) {
+	return isdigit(ch) ||
+	       (ch >= 'a' && ch <= 'f') ||
+	       (ch >= 'A' && ch <= 'F');
+}
+
+
Index: uspace/lib/compat/ctype.h
===================================================================
--- uspace/lib/compat/ctype.h	(revision f5c80460a9886faf736b47c8926a4dae299030cc)
+++ uspace/lib/compat/ctype.h	(revision f5c80460a9886faf736b47c8926a4dae299030cc)
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2011 Jiri Zarevucky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef COMPAT_CTYPE_H
+#define COMPAT_CTYPE_H
+
+#include <ctype.h>
+
+extern int isxdigit(int ch);
+
+#endif /* COMPAT_CTYPE_H */
+
Index: uspace/lib/compat/isatty.c
===================================================================
--- uspace/lib/compat/isatty.c	(revision f5c80460a9886faf736b47c8926a4dae299030cc)
+++ uspace/lib/compat/isatty.c	(revision f5c80460a9886faf736b47c8926a4dae299030cc)
@@ -0,0 +1,8 @@
+#include "unistd.h"
+
+
+int isatty(int fd) {
+	// TODO: stub
+	return 0;
+}
+
Index: uspace/lib/compat/string.c
===================================================================
--- uspace/lib/compat/string.c	(revision f5c80460a9886faf736b47c8926a4dae299030cc)
+++ uspace/lib/compat/string.c	(revision f5c80460a9886faf736b47c8926a4dae299030cc)
@@ -0,0 +1,252 @@
+/*
+ * Copyright (c) 2011 Jiri Zarevucky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+ 
+
+#include "string.h"
+#include "assert.h"
+#include <str_error.h>
+
+/**
+ * Defined for convenience. Returns pointer to the terminating nul character.
+ */
+static char *strzero(const char *s) {
+	for (; *s != '\0'; ++ s) ;;
+	return (char*) s;
+}
+
+char *strcpy(char *dest, const char *src) {
+	assert (dest != NULL);
+	assert (src != NULL);
+
+	return (char *) memcpy(dest, src, strlen(src) + 1);
+}
+
+char *strncpy(char *dest, const char *src, size_t n) {
+	assert (dest != NULL);
+	assert (src != NULL);
+
+	size_t len = strlen(src) + 1;
+	memcpy(dest, src, (n < len ? n : len));
+	if (n > len) {
+		/* the standard requires that nul characters
+		   are appended to the length of n */
+		memset(dest + len, '\0', n - len);
+	}
+	return dest;
+}
+
+char *strcat(char *dest, const char *src) {
+	assert (dest != NULL);
+	assert (src != NULL);
+
+	strcpy(strzero(dest), src);
+	return dest;
+}
+
+char *strncat(char *dest, const char *src, size_t n) {
+	assert (dest != NULL);
+	assert (src != NULL);
+
+	char *zeroptr = strncpy(strzero(dest), src, n);
+	/* strncpy doesn't append the nul terminator */
+	zeroptr[n] = '\0';
+	return dest;
+}
+
+int memcmp(const void *mem1, const void *mem2, size_t n) {
+	assert (mem1 != NULL);
+	assert (mem2 != NULL);
+
+	const unsigned char *s1 = mem1;
+	const unsigned char *s2 = mem2;
+	
+	while (n != 0 && *s1 == *s2) {
+		n --;
+		s1 ++;
+		s2 ++;
+	}
+	
+	return (n == 0) ? 0 : (*s2 - *s1);
+}
+
+int strcmp(const char *s1, const char *s2) {
+	assert (s1 != NULL);
+	assert (s2 != NULL);
+
+	return strncmp(s1, s2, STR_NO_LIMIT);
+}
+
+int strncmp(const char *s1, const char *s2, size_t n) {
+	assert (s1 != NULL);
+	assert (s2 != NULL);
+
+	while (n != 0 && *s1 == *s2 && *s1 != '\0') {
+		n --;
+		s1 ++;
+		s2 ++;
+	}
+	
+	return (n == 0) ? 0 : (*s2 - *s1);
+}
+
+/* currently ignores locale and just calls strcmp */
+int strcoll(const char *s1, const char *s2) {
+	assert (s1 != NULL);
+	assert (s2 != NULL);
+
+	return strcmp(s1, s2);
+}
+
+/* strcoll is stub, so this just makes a copy */
+size_t strxfrm(char *s1, const char *s2, size_t n) {
+	assert (s1 != NULL || n == 0);
+	assert (s2 != NULL);
+
+	size_t len = strlen(s2);
+
+	if (n > len)
+		strcpy(s1, s2);
+
+	return len;
+}
+
+void *memchr(const void *mem, int c, size_t n) {
+	assert (mem != NULL);
+	
+	const unsigned char *s = mem;
+	
+	for (; n != 0; -- n) {
+		if (*s == (unsigned char) c) {
+			return (void *) s;
+		}
+		s ++;
+	}
+	return NULL;
+}
+
+
+char *strchr(const char *s, int c) {
+	assert (s != NULL);
+	
+	if (c == '\0')
+		return strzero(s);
+	
+	while (*s != (char) c) {
+		if (*s == '\0')
+			return NULL;
+		
+		s ++;
+	}
+	return (char *) s;
+}
+
+char *strrchr(const char *s, int c) {
+	assert (s != NULL);
+	
+	const char *ptr;
+	
+	for (ptr = strzero(s); ptr >= s; -- ptr) {
+		if (*ptr == (char) c)
+			return (char *) ptr;
+	}
+	return NULL;
+}
+
+/* the same as strpbrk, except it returns pointer to the nul terminator
+   if no occurence is found */
+static char *strpbrk_null(const char *s1, const char *s2) {
+	while (!strchr(s2, *s1))
+		++ s1;
+	return (char *) s1;
+}
+
+size_t strcspn(const char *s1, const char *s2) {
+	assert (s1 != NULL);
+	assert (s2 != NULL);
+
+	char *ptr = strpbrk_null(s1, s2);
+	return (size_t) (ptr - s1);
+}
+
+char *strpbrk(const char *s1, const char *s2) {
+	assert (s1 != NULL);
+	assert (s2 != NULL);
+
+	char *ptr = strpbrk_null(s1, s2);
+	return (*ptr == '\0') ? NULL : ptr;
+}
+
+size_t strspn(const char *s1, const char *s2) {
+	assert (s1 != NULL);
+	assert (s2 != NULL);
+
+	const char *ptr;
+	for (ptr = s1; *ptr != '\0'; ++ ptr) {
+		if (!strchr(s2, *ptr))
+			break;
+	}
+	return ptr - s1;
+}
+
+/* returns true if s2 is a prefix of s1 */
+static bool begins_with(const char *s1, const char *s2) {
+	for (; *s1 == *s2 && *s2 != '\0'; ++ s1, ++ s2) ;;
+	return *s2 == '\0';
+}
+
+char *strstr(const char *s1, const char *s2) {
+	assert (s1 != NULL);
+	assert (s2 != NULL);
+
+	if (*s2 == '\0')
+		return (char *) s1;
+
+	while (*s1 != '\0') {
+		s1 = strchr(s1, *s2);
+		
+		if (s1 == NULL)
+			return NULL;
+		
+		if (begins_with(s1, s2))
+			return (char *) s1;
+		
+		s1 ++;
+	}
+	
+	return NULL;
+}
+
+char *strerror(int errnum) {
+	return (char *) str_error (-errnum);
+}
+
+size_t strlen(const char *s) {
+	assert (s != NULL);
+	return (size_t) (strzero(s) - s);
+}
+
Index: uspace/lib/compat/string.h
===================================================================
--- uspace/lib/compat/string.h	(revision f5c80460a9886faf736b47c8926a4dae299030cc)
+++ uspace/lib/compat/string.h	(revision f5c80460a9886faf736b47c8926a4dae299030cc)
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2011 Jiri Zarevucky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef COMPAT_STRING_H
+#define COMPAT_STRING_H
+
+#include <mem.h>
+#include <str.h>
+
+/// available in str.h
+//
+// char *strtok(char * /* restrict */ s1, const char * /* restrict */ s2);
+
+/// available in mem.h
+//
+// void *memset(void *, int, size_t);
+// void *memcpy(void *, const void *, size_t);
+// void *memmove(void *, const void *, size_t);
+
+#ifndef NULL
+	#define NULL  ((void *) 0)
+#endif
+
+extern char *strcpy(char * /* restrict */ dest, const char * /* restrict */ src);
+extern char *strncpy(char * /* restrict */ dest, const char * /* restrict */ src, size_t n);
+
+extern char *strcat(char * /* restrict */ dest, const char * /* restrict */ src);
+extern char *strncat(char * /* restrict */ dest, const char * /* restrict */ src, size_t n);
+
+extern int memcmp(const void *mem1, const void *mem2, size_t n);
+extern void *memchr(const void *mem, int c, size_t n);
+
+extern int strcmp(const char *s1, const char *s2);
+extern int strncmp(const char *s1, const char *s2, size_t n);
+extern int strcoll(const char *s1, const char *s2);
+extern size_t strxfrm(char * /* restrict */ s1, const char * /* restrict */ s2, size_t n);
+
+extern char *strchr(const char *s, int c);
+extern char *strrchr(const char *s, int c);
+extern char *strpbrk(const char *s1, const char *s2);
+extern size_t strcspn(const char *s1, const char *s2);
+extern size_t strspn(const char *s1, const char *s2);
+extern char *strstr(const char *s1, const char *s2);
+
+extern char *strerror(int errnum);
+
+extern size_t strlen(const char *s);
+
+#endif  // COMPAT_STRING_H
+
Index: uspace/lib/compat/sys/stat.c
===================================================================
--- uspace/lib/compat/sys/stat.c	(revision f5c80460a9886faf736b47c8926a4dae299030cc)
+++ uspace/lib/compat/sys/stat.c	(revision f5c80460a9886faf736b47c8926a4dae299030cc)
@@ -0,0 +1,44 @@
+
+#include "stat.h"
+#include <mem.h>
+
+#undef stat
+#undef fstat
+
+static void stat_to_posix (struct posix_stat *dest, struct stat *src) {
+	
+	memset(dest, 0, sizeof(struct posix_stat));
+	
+	dest->st_dev = src->device;
+	
+	/* HelenOS doesn't support permissions, so we set them all */
+	dest->st_mode = S_IRWXU | S_IRWXG | S_IRWXO;
+	if (src->is_file)
+		dest->st_mode |= S_IFREG;
+	if (src->is_directory)
+		dest->st_mode |= S_IFDIR;
+	
+	dest->st_nlink = src->lnkcnt;
+	dest->st_size = src->size;
+}
+
+int posix_fstat(int fd, struct posix_stat *st) {
+	struct stat hst;
+	if (fstat(fd, &hst) == -1) {
+		// FIXME: propagate a POSIX compatible errno
+		return -1;
+	}
+	stat_to_posix(st, &hst);
+	return 0;
+}
+
+int posix_stat(const char *path, struct posix_stat *st) {
+	struct stat hst;
+	if (stat(path, &hst) == -1) {
+		// FIXME: propagate a POSIX compatible errno
+		return -1;
+	}
+	stat_to_posix(st, &hst);
+	return 0;
+}
+
Index: uspace/lib/compat/sys/stat.h
===================================================================
--- uspace/lib/compat/sys/stat.h	(revision f5c80460a9886faf736b47c8926a4dae299030cc)
+++ uspace/lib/compat/sys/stat.h	(revision f5c80460a9886faf736b47c8926a4dae299030cc)
@@ -0,0 +1,79 @@
+
+#ifndef COMPAT_STAT_H
+#define COMPAT_STAT_H
+
+#include <sys/stat.h>
+#include "time.h"
+
+/* values are the same as on Linux */
+#define S_IFMT     0170000   /* all file types */
+#define S_IFSOCK   0140000   /* socket */
+#define S_IFLNK    0120000   /* symbolic link */
+#define S_IFREG    0100000   /* regular file */
+#define S_IFBLK    0060000   /* block device */
+#define S_IFDIR    0040000   /* directory */
+#define S_IFCHR    0020000   /* character device */
+#define S_IFIFO    0010000   /* FIFO */
+
+#define S_ISUID    0004000   /* SUID */
+#define S_ISGID    0002000   /* SGID */
+#define S_ISVTX    0001000   /* sticky */
+
+#define S_IRWXU    00700     /* owner permissions */
+#define S_IRUSR    00400
+#define S_IWUSR    00200
+#define S_IXUSR    00100
+
+#define S_IRWXG    00070     /* group permissions */
+#define S_IRGRP    00040
+#define S_IWGRP    00020
+#define S_IXGRP    00010
+
+#define S_IRWXO    00007     /* other permissions */
+#define S_IROTH    00004
+#define S_IWOTH    00002
+#define S_IXOTH    00001
+
+#define S_ISREG(m) ((m & S_IFREG) != 0)
+#define S_ISDIR(m) ((m & S_IFDIR) != 0)
+#define S_ISCHR(m) ((m & S_IFCHR) != 0)
+#define S_ISBLK(m) ((m & S_IFBLK) != 0)
+#define S_ISFIFO(m) ((m & S_IFIFO) != 0)
+#define S_ISLNK(m) ((m & S_IFLNK) != 0)   /* symbolic link? (Not in POSIX.1-1996.) */
+#define S_ISSOCK(m) ((m & S_IFSOCK) != 0) /* socket? (Not in POSIX.1-1996.) */
+
+typedef devmap_handle_t dev_t;
+typedef unsigned int ino_t;
+typedef unsigned int nlink_t;
+typedef unsigned int uid_t;
+typedef unsigned int gid_t;
+typedef aoff64_t off_t;
+typedef unsigned int blksize_t;
+typedef unsigned int blkcnt_t;
+
+struct posix_stat {
+	struct stat sys_stat;
+
+	dev_t     st_dev;     /* ID of device containing file */
+	ino_t     st_ino;     /* inode number */
+	mode_t    st_mode;    /* protection */
+	nlink_t   st_nlink;   /* number of hard links */
+	uid_t     st_uid;     /* user ID of owner */
+	gid_t     st_gid;     /* group ID of owner */
+	dev_t     st_rdev;    /* device ID (if special file) */
+	off_t     st_size;    /* total size, in bytes */
+	blksize_t st_blksize; /* blocksize for file system I/O */
+	blkcnt_t  st_blocks;  /* number of 512B blocks allocated */
+	time_t    st_atime;   /* time of last access */
+	time_t    st_mtime;   /* time of last modification */
+	time_t    st_ctime;   /* time of last status change */
+};
+
+extern int posix_fstat(int, struct posix_stat *);
+extern int posix_stat(const char *, struct posix_stat *);
+
+#define fstat posix_fstat
+#define stat posix_stat
+
+#endif /* COMPAT_STAT_H */
+
Index: uspace/lib/compat/time.c
===================================================================
--- uspace/lib/compat/time.c	(revision f5c80460a9886faf736b47c8926a4dae299030cc)
+++ uspace/lib/compat/time.c	(revision f5c80460a9886faf736b47c8926a4dae299030cc)
@@ -0,0 +1,20 @@
+
+#include "time.h"
+
+
+struct tm *localtime(const time_t *timep) {
+	// FIXME: stub
+	static struct tm result = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+	return &result;
+}
+
+char *asctime(const struct tm *tm) {
+	// FIXME: stub
+	static char result[] = "Mon Jan 01 00:00:00 1900\n";
+	return result;
+}
+
+char *ctime(const time_t *timep) {
+	return asctime(localtime(timep));
+}
+
Index: uspace/lib/compat/time.h
===================================================================
--- uspace/lib/compat/time.h	(revision f5c80460a9886faf736b47c8926a4dae299030cc)
+++ uspace/lib/compat/time.h	(revision f5c80460a9886faf736b47c8926a4dae299030cc)
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2011 Jiri Zarevucky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+ 
+#ifndef COMPAT_TIME_H
+#define COMPAT_TIME_H
+
+#include <time.h>
+
+struct tm {
+	int tm_sec;         /* seconds */
+	int tm_min;         /* minutes */
+	int tm_hour;        /* hours */
+	int tm_mday;        /* day of the month */
+	int tm_mon;         /* month */
+	int tm_year;        /* year */
+	int tm_wday;        /* day of the week */
+	int tm_yday;        /* day in the year */
+	int tm_isdst;       /* daylight saving time */
+
+};
+
+extern char *asctime(const struct tm *tm);
+extern struct tm *localtime(const time_t *timep);
+extern char *ctime(const time_t *timep);
+
+#endif /* COMPAT_TIME_H */
+
Index: uspace/lib/compat/unistd.h
===================================================================
--- uspace/lib/compat/unistd.h	(revision f5c80460a9886faf736b47c8926a4dae299030cc)
+++ uspace/lib/compat/unistd.h	(revision f5c80460a9886faf736b47c8926a4dae299030cc)
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2011 Jiri Zarevucky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+ 
+#ifndef COMPAT_UNISTD_H
+#define COMPAT_UNISTD_H
+
+//#include <getopt.h>
+
+extern char *optarg;
+extern int optind, opterr, optopt;
+extern int getopt(int, char * const [], const char *);
+
+extern int isatty(int fd);
+
+#endif /* COMPAT_UNISTD_H */
+
