aboutsummaryrefslogtreecommitdiff
path: root/sys/libc/stgio.c
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
commitfa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch)
treebdda434976bc09c864f2e4fa6f16ba1952b1e555 /sys/libc/stgio.c
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'sys/libc/stgio.c')
-rw-r--r--sys/libc/stgio.c60
1 files changed, 60 insertions, 0 deletions
diff --git a/sys/libc/stgio.c b/sys/libc/stgio.c
new file mode 100644
index 00000000..498a020a
--- /dev/null
+++ b/sys/libc/stgio.c
@@ -0,0 +1,60 @@
+/* Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+*/
+
+#define import_spp
+#define import_libc
+#define import_xnames
+#include <iraf.h>
+
+
+/* STGIO.C -- STDGRAPH graphics terminal i/o interface. This is a C binding
+** for the VOS STDGRAPH graphics kernel text i/o routines. These are used to
+** do direct i/o to the graphics terminal, whether or not the terminal is in
+** graphics mode. When the terminal is not in graphics mode, i.e., when the
+** "workstation is deactivated", these routines are equivalent to the FIO
+** putline and getline procedures.
+**
+** nchars|EOF = c_stggetline (STDIN, buf)
+** c_stgputline (STDOUT, buf)
+*/
+
+
+/* C_STGGETLINE -- Get a line of text from the graphics terminal.
+*/
+int
+c_stggetline (
+ XINT fd, /* input stream */
+ char *buf, /* user string buffer */
+ int maxch /* max bufer size */
+)
+{
+ XCHAR xbuf[maxch+1];
+ XINT x_fd = fd;
+ int status;
+
+ iferr (status = STG_GETLINE (&x_fd, xbuf))
+ return (EOF);
+ else {
+ c_strpak (xbuf, buf, maxch);
+ return (status);
+ }
+}
+
+
+/* C_STGPUTLINE -- Put a line of text to the graphics terminal.
+*/
+int
+c_stgputline (
+ XINT fd, /* input stream */
+ char *buf /* user string buffer */
+)
+{
+ XCHAR xbuf[SZ_LINE+1];
+ XINT x_fd = fd;
+
+ c_strupk (buf, xbuf, SZ_LINE);
+ iferr (STG_PUTLINE (&x_fd, xbuf))
+ return (ERR);
+ else
+ return (OK);
+}