--- cci/usr/src/bin/ed.c 2019/07/28 12:24:19 1.1 +++ cci/usr/src/bin/ed.c 2019/07/28 12:27:23 1.1.1.2 @@ -73,6 +73,7 @@ char crbuf[512]; #endif CRYPT char perm[768]; char tperm[768]; +int listn; int listf; int col; char *globp; @@ -271,11 +272,17 @@ commands() continue; case '\n': + case '\r': if (addr2==0) addr2 = dot+1; addr1 = addr2; goto print; + case 'n': + listn++; + newline(); + goto print; + case 'l': listf++; case 'p': @@ -286,10 +293,15 @@ commands() nonzero(); a1 = addr1; do { + if(listn) { + count = a1 - zero; + putd(); + putchr('\t'); + } puts(getline(*a1++)); } while (a1 <= addr2); dot = addr2; - listf = 0; + pflag = listf = listn = 0; continue; case 'Q': @@ -521,10 +533,12 @@ newline() if ((c = getchr()) == '\n') return; - if (c=='p' || c=='l') { + if (c=='p' || c=='l' || c == 'n') { pflag++; if (c=='l') listf++; + if (c=='n') + listn++; if (getchr() == '\n') return; } @@ -607,7 +621,7 @@ char *s; register c; wrapp = 0; - listf = 0; + listf = listn = 0; putchr('?'); puts(s); count = 0;