perl 3.0: (no announcement message available)
[p5sagit/p5-mst-13.2.git] / x2p / str.c
index 5de045a..94aeab1 100644 (file)
--- a/x2p/str.c
+++ b/x2p/str.c
@@ -1,8 +1,13 @@
-/* $Header: str.c,v 1.0 87/12/18 13:07:26 root Exp $
+/* $Header: str.c,v 3.0 89/10/18 15:35:18 lwall Locked $
+ *
+ *    Copyright (c) 1989, Larry Wall
+ *
+ *    You may distribute under the terms of the GNU General Public License
+ *    as specified in the README file that comes with the perl 3.0 kit.
  *
  * $Log:       str.c,v $
- * Revision 1.0  87/12/18  13:07:26  root
- * Initial revision
+ * Revision 3.0  89/10/18  15:35:18  lwall
+ * 3.0 baseline
  * 
  */
 
@@ -281,7 +286,7 @@ register FILE *fp;
 
     register char *bp;         /* we're going to steal some values */
     register int cnt;          /*  from the stdio struct and put EVERYTHING */
-    register char *ptr;                /*   in the innermost loop into registers */
+    register STDCHAR *ptr;     /*   in the innermost loop into registers */
     register char newline = '\n';      /* (assuming at least 6 registers) */
     int i;
     int bpx;
@@ -294,9 +299,14 @@ register FILE *fp;
     bp = str->str_ptr;                 /* move these two too to registers */
     ptr = fp->_ptr;
     for (;;) {
-       while (--cnt >= 0) {                    /* this */      /* eat */
-           if ((*bp++ = *ptr++) == newline)    /* really */    /* dust */
-               goto thats_all_folks;           /* screams */   /* sed :-) */ 
+       while (--cnt >= 0) {
+           if ((*bp++ = *ptr++) == newline)
+               if (bp <= str->str_ptr || bp[-2] != '\\')
+                   goto thats_all_folks;
+               else {
+                   line++;
+                   bp -= 2;
+               }
        }
        
        fp->_cnt = cnt;                 /* deregisterize cnt and ptr */