aboutsummaryrefslogtreecommitdiff
path: root/pkg/utilities/nttools/stxtools/strjust.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 /pkg/utilities/nttools/stxtools/strjust.x
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'pkg/utilities/nttools/stxtools/strjust.x')
-rw-r--r--pkg/utilities/nttools/stxtools/strjust.x31
1 files changed, 31 insertions, 0 deletions
diff --git a/pkg/utilities/nttools/stxtools/strjust.x b/pkg/utilities/nttools/stxtools/strjust.x
new file mode 100644
index 00000000..5f50f080
--- /dev/null
+++ b/pkg/utilities/nttools/stxtools/strjust.x
@@ -0,0 +1,31 @@
+include <ctype.h>
+
+# STRJUST -- Remove whitspace from a string and convert to lower case
+#
+# B.Simon 30-Jan-95 copied from synphot$strfix
+
+procedure strjust (str)
+
+char str[ARB] # u: string to convert
+#--
+int ic, jc
+
+begin
+ jc = 1
+ for (ic = 1; str[ic] != EOS; ic = ic + 1) {
+ if (IS_WHITE(str[ic]))
+ next
+
+ if (IS_UPPER(str[ic])) {
+ str[jc] = TO_LOWER(str[ic])
+
+ } else if (jc < ic) {
+ str[jc] = str[ic]
+ }
+
+ jc = jc + 1
+ }
+
+ str[jc] = EOS
+end
+