gno/bin/vi/inc.c
gdr-ftp 784e3de7cd Initial checkin of aroff, binprint, center, less, ls, make, makemake,
passwd, ps, purge, shutdown, stty, upper, and vi.  These sources are
for the versions of the utils shipped with GNO v2.0.4.
1998-03-09 08:30:21 +00:00

33 lines
775 B
C

/*
* STEVIE - Simply Try this Editor for VI Enthusiasts
*
* Code Contributions By : Tim Thompson twitch!tjt
* Tony Andrews onecom!wldrdg!tony
* G. R. (Fred) Walter watmath!grwalter
*/
#include "stevie.h"
/*
* inc(p)
*
* Increment the line pointer 'p' crossing line boundaries as necessary. Return
* 1 when crossing a line, -1 when at end of file, 0 otherwise.
*/
int
inc(LPtr *lp)
{
register char *p = &(lp->linep->s[lp->index]);
if (*p != NUL) { /* still within line */
lp->index++;
return ((p[1] != NUL) ? 0 : 1);
}
if (lp->linep->next != Fileend->linep) { /* there is a next line */
lp->index = 0;
lp->linep = lp->linep->next;
return 1;
}
return -1;
}