aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cmd/samterm/main.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/cmd/samterm/main.c b/src/cmd/samterm/main.c
index 79d3e0ec..07c3426a 100644
--- a/src/cmd/samterm/main.c
+++ b/src/cmd/samterm/main.c
@@ -361,6 +361,10 @@ ctlw(Rasp *r, long o, long p)
long
ctlu(Rasp *r, long o, long p)
{
+ if(--p < o)
+ return o;
+ if(raspc(r, p)=='\n')
+ return p;
for(; p-1>=o && raspc(r, p-1)!='\n'; --p)
;
return p>=o? p : o;