aboutsummaryrefslogtreecommitdiff
path: root/sys/imfort/imhcpy.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 /sys/imfort/imhcpy.x
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'sys/imfort/imhcpy.x')
-rw-r--r--sys/imfort/imhcpy.x49
1 files changed, 49 insertions, 0 deletions
diff --git a/sys/imfort/imhcpy.x b/sys/imfort/imhcpy.x
new file mode 100644
index 00000000..27d4321c
--- /dev/null
+++ b/sys/imfort/imhcpy.x
@@ -0,0 +1,49 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+include "imfort.h"
+
+# IMHCPY -- Copy the non-pixel fields of an existing image header to a new
+# image header. Only fields not set by IMCREA are copied.
+
+procedure imhcpy (o_im, n_im, ier)
+
+pointer o_im # old image
+pointer n_im # new image
+int ier
+
+int junk
+pointer sp, root, o_ua, n_ua
+string imhdr "imhdr"
+int fnroot()
+bool strne()
+
+begin
+ call smark (sp)
+ call salloc (root, SZ_FNAME, TY_CHAR)
+
+ if (strne (IM_MAGIC(o_im), imhdr) || strne (IM_MAGIC(n_im), imhdr)) {
+ ier = IE_MAGIC
+ call sfree (sp)
+ return
+ }
+
+ o_ua = IM_USERAREA(o_im)
+ n_ua = IM_USERAREA(n_im)
+
+ # Copy the non-pixel fields.
+ call strcpy (IM_TITLE(o_im), IM_TITLE(n_im), SZ_IMTITLE)
+ call strcpy (IM_HISTORY(o_im), IM_HISTORY(n_im), SZ_IMHIST)
+ call strcpy (Memc[o_ua], Memc[n_ua], ARB)
+
+ # Record the inheritance in the history buffer.
+ junk = fnroot (IM_HDRFILE(o_im), Memc[root], SZ_FNAME)
+ call strcat ("New copy of ", IM_HISTORY(n_im), SZ_IMHIST)
+ call strcat (Memc[root], IM_HISTORY(n_im), SZ_IMHIST)
+ call strcat ("\n", IM_HISTORY(n_im), SZ_IMHIST)
+
+ IM_UPDATE(n_im) = YES
+
+ ier = OK
+ call sfree (sp)
+end