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 /noao/imred/quadred/src/quad/ccdlog.x | |
download | iraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz |
Initial commit
Diffstat (limited to 'noao/imred/quadred/src/quad/ccdlog.x')
-rw-r--r-- | noao/imred/quadred/src/quad/ccdlog.x | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/noao/imred/quadred/src/quad/ccdlog.x b/noao/imred/quadred/src/quad/ccdlog.x new file mode 100644 index 00000000..61bbff10 --- /dev/null +++ b/noao/imred/quadred/src/quad/ccdlog.x @@ -0,0 +1,42 @@ + +# 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 (image, str) + +char image[ARB] # Image name +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 eprintf ("%s: %s\n") + call pargstr (image) + 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 fprintf (fd, "%s: %s\n") + call pargstr (image) + call pargstr (str) + call close (fd) + } + + call sfree (sp) +end |