aboutsummaryrefslogtreecommitdiff
path: root/pkg/utilities/t_ucase.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 /pkg/utilities/t_ucase.x
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'pkg/utilities/t_ucase.x')
-rw-r--r--pkg/utilities/t_ucase.x42
1 files changed, 42 insertions, 0 deletions
diff --git a/pkg/utilities/t_ucase.x b/pkg/utilities/t_ucase.x
new file mode 100644
index 00000000..a7332338
--- /dev/null
+++ b/pkg/utilities/t_ucase.x
@@ -0,0 +1,42 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+# UCASE -- Convert the standard input or a list of files to upper case.
+
+procedure t_ucase()
+
+pointer sp, line, in_file, out_file
+int list, in, out
+bool strne()
+int open(), clpopni(), clgfil(), getline(), clplen()
+
+begin
+ call smark (sp)
+ call salloc (line, SZ_LINE, TY_CHAR)
+ call salloc (in_file, SZ_FNAME, TY_CHAR)
+ call salloc (out_file, SZ_FNAME, TY_CHAR)
+
+ list = clpopni ("files")
+
+ # Multiple files are converted to files of the same name with the
+ # extension ".uc".
+
+ while (clgfil (list, Memc[in_file], SZ_FNAME) != EOF) {
+ in = open (Memc[in_file], READ_ONLY, TEXT_FILE)
+ if (clplen (list) > 1 && strne (Memc[in_file], "STDIN")) {
+ call strcpy (Memc[in_file], Memc[out_file], SZ_FNAME)
+ call strcat (".uc", Memc[out_file], SZ_FNAME)
+ } else
+ call strcpy ("STDOUT", Memc[out_file], SZ_FNAME)
+ out = open (Memc[out_file], NEW_FILE, TEXT_FILE)
+
+ while (getline (in, Memc[line]) != EOF) {
+ call strupr (Memc[line])
+ call putline (out, Memc[line])
+ }
+ call close (in)
+ call close (out)
+ }
+
+ call clpcls (list)
+ call sfree (sp)
+end