aboutsummaryrefslogtreecommitdiff
path: root/pkg/utilities/nttools/stxtools/strjust.x
diff options
context:
space:
mode:
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
+