 +    } else if (!strcmp(g_argn[i], "ps_stderr")) {
 +      int fd2 = open(g_argv[i], O_WRONLY);
 +      dup2(fd2, 2);
++    } else if (!strcmp(g_argn[i], "ps_tty_prefix")) {
++      g_tty_prefix = g_argv[i];
++      struct tioc_nacl_output handler;
++      handler.handler = TtyOutputHandler;
++      handler.user_data = NULL;
++      int tty_fd = open("/dev/tty", O_WRONLY);
++      if (tty_fd != -1) {
++        ioctl(tty_fd, TIOCNACLOUTPUT, &handler);
++        close(tty_fd);
++      }
 +    } else if (!strcmp(g_argn[i], "sdl_mount_http")) {
 +      const char* source;
 +      const char* target = "/";

+#include <ppapi/c/pp_rect.h>
+
+#include "nacl_io/nacl_io.h"
+
+static PP_Instance g_instance;
+static PPB_GetInterface g_get_browser_interface;
+static struct PPB_InputEvent_1_0* g_input_event_interface;
+static struct PPB_View_1_1* g_view_interface;
+static int g_width = 0;

 	if ( CPU_haveCPUID() ) {
diff --git a/src/main/nacl/pepper_instance.c b/src/main/nacl/pepper_instance.c
new file mode 100644
index 0000000..0a3ca79
--- /dev/null
+++ b/src/main/nacl/pepper_instance.c
@@ -0,0 +1,310 @@
+/*
+ * Copyright (c) 2011 The Native Client Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
