diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-07-08 20:46:52 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-07-08 20:46:52 -0400 |
commit | fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch) | |
tree | bdda434976bc09c864f2e4fa6f16ba1952b1e555 /sys/imio/dbc/imgcom.x | |
download | iraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz |
Initial commit
Diffstat (limited to 'sys/imio/dbc/imgcom.x')
-rw-r--r-- | sys/imio/dbc/imgcom.x | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/sys/imio/dbc/imgcom.x b/sys/imio/dbc/imgcom.x new file mode 100644 index 00000000..504c0c55 --- /dev/null +++ b/sys/imio/dbc/imgcom.x @@ -0,0 +1,66 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include <syserr.h> +include <ctype.h> +include "idbc.h" + +# IMGCOM -- Get the comment field for a keyword. + +procedure imgcom (im, key, comment) + +pointer im #I image descriptor +char key[ARB] #I parameter to be set +char comment[ARB] #O comment string + +bool string_valued +int ch, i, n, j, ic, op +pointer rp, ip, sp, buf +int idb_findrecord(), ctowrd(), stridx(), idb_getstring() +errchk syserrs + +define end_ 91 +begin + call smark (sp) + call salloc (buf, SZ_LINE, TY_CHAR) + + # Special fields do not have comment. + if (key[1] == 'i' && key[2] == '_') { + comment[1] = EOS + return + } + + # Find the record. + if (idb_findrecord (im, key, rp) == 0) + call syserrs (SYS_IDBKEYNF, key) + + ip = IDB_STARTVALUE + if (ctowrd (Memc[rp], ip, Memc[buf], SZ_LINE) <= 0) { + comment[1] = EOS + goto end_ + } + + # Look for '/' + while (ip < IDB_RECLEN && (Memc[rp+ip] != '/')) + ip = ip + 1 + if (ip == IDB_RECLEN) { + comment[1] = EOS + goto end_ + } + op = rp+ip+1 + while (op < IDB_RECLEN+rp && (IS_WHITE(Memc[op]) || Memc[op] == '\n')) + op = op + 1 + + # Copy comment section + for (i = 1; Memc[op] != '\n' && op < IDB_RECLEN+rp; op=op+1) { + comment[i] = Memc[op] + i = i + 1 + } + # Trim + i = i - 1 + while (i >= 1 && IS_WHITE(comment[i])) + i = i - 1 + + comment[i+1] = EOS +end_ + call sfree (sp) +end |