aboutsummaryrefslogtreecommitdiff
path: root/noao/imred/ccdred/src/ccdlog.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 /noao/imred/ccdred/src/ccdlog.x
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'noao/imred/ccdred/src/ccdlog.x')
-rw-r--r--noao/imred/ccdred/src/ccdlog.x46
1 files changed, 46 insertions, 0 deletions
diff --git a/noao/imred/ccdred/src/ccdlog.x b/noao/imred/ccdred/src/ccdlog.x
new file mode 100644
index 00000000..48453704
--- /dev/null
+++ b/noao/imred/ccdred/src/ccdlog.x
@@ -0,0 +1,46 @@
+include <imhdr.h>
+include <imset.h>
+
+# CCDLOG -- Log information about the processing with the image name.
+#
+# 1. If the package "verbose" parameter is set print the string preceded
+# by the image name.
+# 2. If the package "logfile" parameter is not null append the string,
+# preceded by the image name, to the file.
+
+procedure ccdlog (im, str)
+
+pointer im # IMIO pointer
+char str[ARB] # Log string
+
+int fd, open()
+bool clgetb()
+pointer sp, fname
+errchk open
+
+begin
+ call smark (sp)
+ call salloc (fname, SZ_FNAME, TY_CHAR)
+
+ # Write to the standard error output if "verbose".
+ if (clgetb ("verbose")) {
+ call imstats (im, IM_IMAGENAME, Memc[fname], SZ_FNAME)
+ call eprintf ("%s: %s\n")
+ call pargstr (Memc[fname])
+ call pargstr (str)
+ }
+
+ # Append to the "logfile" if not null.
+ call clgstr ("logfile", Memc[fname], SZ_FNAME)
+ call xt_stripwhite (Memc[fname])
+ if (Memc[fname] != EOS) {
+ fd = open (Memc[fname], APPEND, TEXT_FILE)
+ call imstats (im, IM_IMAGENAME, Memc[fname], SZ_FNAME)
+ call fprintf (fd, "%s: %s\n")
+ call pargstr (Memc[fname])
+ call pargstr (str)
+ call close (fd)
+ }
+
+ call sfree (sp)
+end