libc: add ctermid
authorAlan Cox <alan@etchedpixels.co.uk>
Sat, 24 Oct 2015 12:56:07 +0000 (13:56 +0100)
committerAlan Cox <alan@etchedpixels.co.uk>
Sat, 24 Oct 2015 12:56:07 +0000 (13:56 +0100)
Yes this is a cheap implementation but it works as we have a proper
/dev/tty now

Library/libs/ctermid.c [new file with mode: 0644]

diff --git a/Library/libs/ctermid.c b/Library/libs/ctermid.c
new file mode 100644 (file)
index 0000000..c30e355
--- /dev/null
@@ -0,0 +1,15 @@
+#include <stdio.h>
+#include <string.h>
+
+/* We have a real /dev/tty so this is a valid answer and
+   to spec */
+
+static char path[L_ctermid] = "/dev/tty";
+
+char *ctermid(char *p)
+{
+  if (p)
+    return strcpy(p, path);
+  else
+    return path;
+}