home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
vol_100
/
153_01
/
curfor.c
< prev
next >
Wrap
Text File
|
1985-03-10
|
2KB
|
51 lines
/* *** curfor.c *** */
/* */
/* IBM - PC microsoft "C" */
/* */
/* Function to move the cursor forward x relative columns. */
/* */
/* Written by L. Cuthbertson, March 1984. */
/* */
/*********************************************************************/
/* */
#define NULL '\000'
#define POUND '#'
curfor(x)
int x;
{
extern char CUF[];
char xrel[3],command[20];
int i,inpos,outpos;
/* initialize screen controls */
scrinit();
/* convert integer relative motion into string */
sprintf(xrel,"%d",x);
/* build command line */
inpos = 0; /* position within control string */
outpos = 0; /* position within command string */
while (CUF[inpos] != POUND)
command[outpos++] = CUF[inpos++];
for (i=0;xrel[i] != NULL;i++)
command[outpos++] = xrel[i];
inpos++;
while (CUF[inpos] != NULL)
command[outpos++] = CUF[inpos++];
command[outpos] = NULL;
/* write command to screen */
writes(command);
}
/* check for invalid month */
if (imo < 1 || imo > 12) return(-1);
/* check for invalid day */
if (ida