aboutsummaryrefslogtreecommitdiff
path: root/sys/imio/imgimage.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/imio/imgimage.x
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'sys/imio/imgimage.x')
-rw-r--r--sys/imio/imgimage.x40
1 files changed, 40 insertions, 0 deletions
diff --git a/sys/imio/imgimage.x b/sys/imio/imgimage.x
new file mode 100644
index 00000000..9e81d409
--- /dev/null
+++ b/sys/imio/imgimage.x
@@ -0,0 +1,40 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+# IMGIMAGE -- Get the name of an individual image within a cluster of images,
+# i.e., the image name minus any image section.
+
+procedure imgimage (imspec, image, maxch)
+
+char imspec[ARB] # full image specification
+char image[ARB] # receives image name
+int maxch
+
+int cl_index, cl_size
+pointer sp, cluster, ksection, section
+
+begin
+ call smark (sp)
+ call salloc (cluster, SZ_PATHNAME, TY_CHAR)
+ call salloc (ksection, SZ_FNAME, TY_CHAR)
+ call salloc (section, SZ_FNAME, TY_CHAR)
+
+ call imparse (imspec,
+ Memc[cluster], SZ_PATHNAME,
+ Memc[ksection], SZ_FNAME,
+ Memc[section], SZ_FNAME, cl_index, cl_size)
+
+ if (cl_index >= 0 && cl_size == -1) {
+ call sprintf (image, maxch, "%s[%d]")
+ call pargstr (Memc[cluster])
+ call pargi (cl_index)
+ } else if (cl_index >= 0 && cl_size > 0) {
+ call sprintf (image, maxch, "%s[%d/%d]")
+ call pargstr (Memc[cluster])
+ call pargi (cl_index)
+ call pargi (cl_size)
+ } else
+ call strcpy (Memc[cluster], image, maxch)
+
+ call strcat (Memc[ksection], image, maxch)
+ call sfree (sp)
+end