Bell 32V development
[unix-history] / usr / src / cmd / sed / sed1.c
index 52dd768..1acc476 100644 (file)
@@ -1,41 +1,6 @@
 #include       <stdio.h>
 #include "sed.h"
 
 #include       <stdio.h>
 #include "sed.h"
 
-char   *trans[040]  = {
-       "\\01",
-       "\\02",
-       "\\03",
-       "\\04",
-       "\\05",
-       "\\06",
-       "\\07",
-       "<\b-",
-       ">\b-",
-       "\n",
-       "\\13",
-       "\\14",
-       "\\15",
-       "\\16",
-       "\\17",
-       "\\20",
-       "\\21",
-       "\\22",
-       "\\23",
-       "\\24",
-       "\\25",
-       "\\26",
-       "\\27",
-       "\\30",
-       "\\31",
-       "\\32",
-       "\\33",
-       "\\34",
-       "\\35",
-       "\\36",
-       "\\37"
-};
-char   rub[] = {"\177"};
-
 execute(file)
 char *file;
 {
 execute(file)
 char *file;
 {
@@ -404,7 +369,7 @@ command(ipc)
 union reptr    *ipc;
 {
        register int    i;
 union reptr    *ipc;
 {
        register int    i;
-       register char   *p1, *p2, *p3;
+       register char   *p1, *p2;
        char    *execp;
 
 
        char    *execp;
 
 
@@ -461,9 +426,7 @@ union reptr *ipc;
                        *spend++ = '\n';
                        p1 = spend;
                        p2 = holdsp;
                        *spend++ = '\n';
                        p1 = spend;
                        p2 = holdsp;
-                       while(*p1++ = *p2++)
-                               if(p1 >= lbend)
-                                       break;
+                       while(*p1++ = *p2++);
                        spend = p1-1;
                        break;
 
                        spend = p1-1;
                        break;
 
@@ -478,9 +441,7 @@ union reptr *ipc;
                        *hspend++ = '\n';
                        p1 = hspend;
                        p2 = linebuf;
                        *hspend++ = '\n';
                        p1 = hspend;
                        p2 = linebuf;
-                       while(*p1++ = *p2++)
-                               if(p1 >= hend)
-                                       break;
+                       while(*p1++ = *p2++);
                        hspend = p1-1;
                        break;
 
                        hspend = p1-1;
                        break;
 
@@ -495,42 +456,6 @@ union reptr        *ipc;
                        break;
 
                case LCOM:
                        break;
 
                case LCOM:
-                       p1 = linebuf;
-                       p2 = genbuf;
-                       genbuf[72] = 0;
-                       while(*p1)
-                               if(*p1 >= 040) {
-                                       if(*p1 == 0177) {
-                                               p3 = rub;
-                                               while(*p2++ = *p3++)
-                                                       if(p2 >= lcomend) {
-                                                               *p2 = '\\';
-                                                               fprintf(stdout, "%s\n", genbuf);
-                                                               p2 = genbuf;
-                                                       }
-                                               p2--;
-                                               p1++;
-                                               continue;
-                                       }
-                                       *p2++ = *p1++;
-                                       if(p2 >= lcomend) {
-                                               *p2 = '\\';
-                                               fprintf(stdout, "%s\n", genbuf);
-                                               p2 = genbuf;
-                                       }
-                               } else {
-                                       p3 = trans[*p1-1];
-                                       while(*p2++ = *p3++)
-                                               if(p2 >= lcomend) {
-                                                       *p2 = '\\';
-                                                       fprintf(stdout, "%s\n", genbuf);
-                                                       p2 = genbuf;
-                                               }
-                                       p2--;
-                                       p1++;
-                               }
-                       *p2 = 0;
-                       fprintf(stdout, "%s\n", genbuf);
                        break;
 
                case NCOM:
                        break;
 
                case NCOM:
@@ -596,7 +521,7 @@ union reptr *ipc;
 
                case SCOM:
                        i = substitute(ipc);
 
                case SCOM:
                        i = substitute(ipc);
-                       if(ipc->pfl && i)
+                       if(ipc->pfl && nflag && i)
                                if(ipc->pfl == 1) {
                                        for(p1 = linebuf; p1 < spend; p1++)
                                                putc(*p1, stdout);
                                if(ipc->pfl == 1) {
                                        for(p1 = linebuf; p1 < spend; p1++)
                                                putc(*p1, stdout);
@@ -641,8 +566,7 @@ union reptr *ipc;
 
 }
 
 
 }
 
-char   *
-gline(addr)
+char   *gline(addr)
 char   *addr;
 {
        register char   *p1, *p2;
 char   *addr;
 {
        register char   *p1, *p2;