Mercurial > hg > Members > kono > nitros9-code
view 3rdparty/packages/ed/catsub.c @ 2868:cfa46960b6bd
makefiles: Rename DW3 to DW all over
Rename dw3*.sb to dwio*.sb
This is part of getting default and lwtools-port branches
together, trying to avoid things falling through the
cracks.
author | Tormod Volden <debian.tormod@gmail.com> |
---|---|
date | Sun, 24 Nov 2013 11:13:40 +0100 |
parents | bef1844de0dc |
children |
line wrap: on
line source
/* catsub.c */ #include <stdio.h> #include "tools.h" #include "ed.h" extern char *paropen[9], *parclose[9]; char *catsub(from, to, sub, new, newend) char *from, *to, *sub, *new, *newend; { char *cp, *cp2; for (cp = new; *sub != EOS && cp < newend;) { if (*sub == DITTO) for (cp2 = from; cp2 < to;) { *cp++ = *cp2++; if (cp >= newend) break; } else if (*sub == ESCAPE) { sub++; if ('1' <= *sub && *sub <= '9') { char *parcl = parclose[*sub - '1']; for (cp2 = paropen[*sub - '1']; cp2 < parcl;) { *cp++ = *cp2++; if (cp >= newend) break; } } else *cp++ = *sub; } else *cp++ = *sub; sub++; } return(cp); }