aboutsummaryrefslogtreecommitdiff
path: root/libgfortran/intrinsics/tty.c
diff options
context:
space:
mode:
Diffstat (limited to 'libgfortran/intrinsics/tty.c')
-rw-r--r--libgfortran/intrinsics/tty.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/libgfortran/intrinsics/tty.c b/libgfortran/intrinsics/tty.c
index 3a3d2bd..f4bfecd 100644
--- a/libgfortran/intrinsics/tty.c
+++ b/libgfortran/intrinsics/tty.c
@@ -31,6 +31,7 @@ Boston, MA 02110-1301, USA. */
#include "config.h"
#include "libgfortran.h"
#include "../io/io.h"
+
#include <string.h>
/* LOGICAL FUNCTION ISATTY(UNIT)
@@ -95,3 +96,28 @@ ttynam_sub (int *unit, char * name, gfc_charlen_type name_len)
}
}
}
+
+
+extern void ttynam (char **, gfc_charlen_type *, int);
+export_proto(ttynam);
+
+void
+ttynam (char ** name, gfc_charlen_type * name_len, int unit)
+{
+ gfc_unit *u;
+
+ u = find_unit (unit);
+ if (u != NULL)
+ {
+ *name = stream_ttyname (u->s);
+ if (*name != NULL)
+ {
+ *name_len = strlen (*name);
+ *name = strdup (*name);
+ return;
+ }
+ }
+
+ *name_len = 0;
+ *name = NULL;
+}