aboutsummaryrefslogtreecommitdiff
path: root/sys/tty/ttyclln.x
diff options
context:
space:
mode:
authorJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
committerJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
commit40e5a5811c6ffce9b0974e93cdd927cbcf60c157 (patch)
tree4464880c571602d54f6ae114729bf62a89518057 /sys/tty/ttyclln.x
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'sys/tty/ttyclln.x')
-rw-r--r--sys/tty/ttyclln.x32
1 files changed, 32 insertions, 0 deletions
diff --git a/sys/tty/ttyclln.x b/sys/tty/ttyclln.x
new file mode 100644
index 00000000..34e57328
--- /dev/null
+++ b/sys/tty/ttyclln.x
@@ -0,0 +1,32 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <chars.h>
+include "tty.h"
+
+# TTYCLEARLN -- Clear the current line. The cursor is left positioned at the
+# left margin. If the clear has to be performed by overwriting the line with
+# blanks, the final column is not cleared.
+
+procedure ttyclearln (fd, tty)
+
+int fd
+pointer tty
+pointer sp, buf
+int nchars, ttygets()
+errchk salloc, ttygets, putc, ttywrite, fprintf, pargi
+
+begin
+ call smark (sp)
+ call salloc (buf, SZ_CTRLSTR, TY_CHAR)
+
+ nchars = ttygets (tty, "ce", Memc[buf], SZ_CTRLSTR)
+ if (nchars > 0) {
+ call putci (fd, '\r')
+ call ttywrite (fd, tty, Memc[buf], nchars, 1)
+ } else {
+ call fprintf (fd, "\r%*w\r")
+ call pargi (T_NCOLS(tty) - 1)
+ }
+
+ call sfree (sp)
+end