Fixed coredump when issuing d$ on a blank line. Fixes bin/191.

This commit is contained in:
David Greenman 1995-01-28 01:58:14 +00:00
parent f700afc402
commit 3bd0d9a279
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=5972

View File

@ -119,13 +119,15 @@ delete(sp, ep, fm, tm, lmode)
GETLINE_ERR(sp, fm->lno);
return (1);
}
GET_SPACE_RET(sp, bp, blen, len);
if (fm->cno != 0)
memmove(bp, p, fm->cno);
memmove(bp + fm->cno, p + (tm->cno + 1), len - (tm->cno + 1));
if (file_sline(sp, ep, fm->lno,
bp, len - ((tm->cno - fm->cno) + 1)))
goto err;
if (len != 0) {
GET_SPACE_RET(sp, bp, blen, len);
if (fm->cno != 0)
memmove(bp, p, fm->cno);
memmove(bp + fm->cno, p + (tm->cno + 1), len - (tm->cno + 1));
if (file_sline(sp, ep, fm->lno,
bp, len - ((tm->cno - fm->cno) + 1)))
goto err;
}
goto done;
}