aboutsummaryrefslogtreecommitdiff
path: root/unix/boot/spp/rpp/ratlibr/getwrd.r
diff options
context:
space:
mode:
Diffstat (limited to 'unix/boot/spp/rpp/ratlibr/getwrd.r')
-rw-r--r--unix/boot/spp/rpp/ratlibr/getwrd.r25
1 files changed, 25 insertions, 0 deletions
diff --git a/unix/boot/spp/rpp/ratlibr/getwrd.r b/unix/boot/spp/rpp/ratlibr/getwrd.r
new file mode 100644
index 00000000..ec324af0
--- /dev/null
+++ b/unix/boot/spp/rpp/ratlibr/getwrd.r
@@ -0,0 +1,25 @@
+include defs
+
+# getwrd - get non-blank word from in (i) into out, increment i
+
+ integer function getwrd (in, i, out)
+ character in (ARB), out (ARB)
+ integer i
+
+ integer j
+
+ while (in (i) == BLANK | in (i) == TAB)
+ i = i + 1
+
+ j = 1
+ while (in (i) != EOS & in (i) != BLANK
+ & in (i) != TAB & in (i) != NEWLINE) {
+ out (j) = in (i)
+ i = i + 1
+ j = j + 1
+ }
+ out (j) = EOS
+
+ getwrd = j - 1
+ return
+ end