aboutsummaryrefslogtreecommitdiff
path: root/noao/onedspec/splot/stshelp.x
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 /noao/onedspec/splot/stshelp.x
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'noao/onedspec/splot/stshelp.x')
-rw-r--r--noao/onedspec/splot/stshelp.x34
1 files changed, 34 insertions, 0 deletions
diff --git a/noao/onedspec/splot/stshelp.x b/noao/onedspec/splot/stshelp.x
new file mode 100644
index 00000000..f34de38a
--- /dev/null
+++ b/noao/onedspec/splot/stshelp.x
@@ -0,0 +1,34 @@
+include <error.h>
+
+
+# STS_HELP -- Issue a help line
+
+procedure sts_help (line, nlines, fname, ptr)
+
+int line # Line to print
+int nlines # Number of lines of help
+char fname[ARB] # Help file
+pointer ptr # Cache help
+
+int fd, open(), getline()
+
+begin
+ if (ptr == NULL) {
+ iferr (fd = open (fname, READ_ONLY, TEXT_FILE)) {
+ call erract (EA_WARN)
+ return
+ }
+ nlines = 0
+ call malloc (ptr, SZ_LINE, TY_CHAR)
+ while (getline (fd, Memc[ptr+nlines*SZ_LINE]) != EOF) {
+ nlines = nlines + 1
+ call realloc (ptr, (nlines+1)*SZ_LINE, TY_CHAR)
+ }
+ call close (fd)
+ }
+
+ if (line >= 1 && line <= nlines) {
+ call putline (STDOUT, Memc[ptr+(line-1)*SZ_LINE])
+ call flush (STDOUT)
+ }
+end