aboutsummaryrefslogtreecommitdiff
path: root/pkg/system/help/lroff/center.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 /pkg/system/help/lroff/center.x
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'pkg/system/help/lroff/center.x')
-rw-r--r--pkg/system/help/lroff/center.x32
1 files changed, 32 insertions, 0 deletions
diff --git a/pkg/system/help/lroff/center.x b/pkg/system/help/lroff/center.x
new file mode 100644
index 00000000..b3581f3a
--- /dev/null
+++ b/pkg/system/help/lroff/center.x
@@ -0,0 +1,32 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <chars.h>
+include "lroff.h"
+
+# CENTER_TEXT -- Center and output the next input line within the current
+# left and right margins. The optional argument specifies the column
+# (measured from the left margin) at which the text is to be centered.
+
+procedure center_text (in, out, linebuf, ip)
+
+extern in(), out()
+char linebuf[ARB]
+int ip
+
+int len_inputline, center_column, nblanks, i
+int in(), input(), lgetarg()
+errchk breakline, input, outc, outline
+include "lroff.com"
+
+begin
+ call breakline (out, NJ)
+ center_column = lgetarg (linebuf, ip, (left_margin + right_margin) / 2)
+ len_inputline = input (in, linebuf) - 1
+
+ if (len_inputline != EOF) {
+ nblanks = center_column - (len_inputline / 2) - left_margin
+ for (i=1; i <= nblanks; i=i+1)
+ call outc (out, BLANK)
+ call outline (out, linebuf)
+ }
+end