From Thomas Eberhardt <thomas@mathematik.uni-Bremen.de>
[unix-history] / usr.bin / elvis / move2.c
index 0a7167e..2c768cd 100644 (file)
@@ -267,11 +267,11 @@ MARK      m_bsrch(m, ptrn)
 
                /* compile the pattern */
                re = regcomp(ptrn);
 
                /* compile the pattern */
                re = regcomp(ptrn);
+#endif
                if (!re)
                {
                        return MARK_UNSET;
                }
                if (!re)
                {
                        return MARK_UNSET;
                }
-#endif
        }
        else if (!re)
        {
        }
        else if (!re)
        {
@@ -309,12 +309,13 @@ MARK      m_bsrch(m, ptrn)
                if (regexec(re, line, 1) && (int)(re->startp[0] - line) < pos)
 #endif
                {
                if (regexec(re, line, 1) && (int)(re->startp[0] - line) < pos)
 #endif
                {
+                       try = 0;
                        /* match!  now find the last acceptable one in this line */
                        do
                        {
 #ifdef REGEX
                        /* match!  now find the last acceptable one in this line */
                        do
                        {
 #ifdef REGEX
-                               last = rm[0].rm_so;
-                               try = rm[0].rm_eo;
+                               last = try + rm[0].rm_so;
+                               try += rm[0].rm_eo;
 #else
                                last = (int)(re->startp[0] - line);
                                try = (int)(re->endp[0] - line);
 #else
                                last = (int)(re->startp[0] - line);
                                try = (int)(re->endp[0] - line);