home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
QBasic & Borland Pascal & C
/
Delphi5.iso
/
C
/
Samples
/
CSAPE32.ARJ
/
SOURCE
/
CSSRC
/
FLDPULLR.C
< prev
next >
Wrap
C/C++ Source or Header
|
1990-03-28
|
1KB
|
61 lines
/*
fldpullr.c 5/11/88
% field_PullRight
C-scape 3.2
Copyright (c) 1986, 1987, by Oakland Group, Inc.
ALL RIGHTS RESERVED.
Revision History:
-----------------
3/28/90 jmd ansi-fied
*/
#include "field.h"
char field_PullRight(field_type f, int fpos)
/*
modifies: the field.
effects: deletes the character at fpos, pulls in the characters to the
right:
|heello mom |
^
|hello mom |
^
returns: the deleted character. If the cursor is over empty area,
return '\0'.
*/
{
char del_char;
int reclen, recpos;
reclen = strlen(f->record);
/* If the cursor is past the last character, quit and return '\0'... */
if (fpos >= reclen) {
return('\0');
}
/* ...else the cursor is to the left. */
else { /* if (fpos < reclen) */
/* Remember the deleted character. */
del_char = f->record[fpos];
/* pull the record and the merge */
for (recpos = fpos; recpos < f->reclen; recpos++) {
if (f->merge != NULL) {
f->merge[f->r2m[recpos]] = (f->record[recpos+1] != '\0') ?
f->record[recpos+1] :
MRGPADCHAR;
}
if ((f->record[recpos] = f->record[recpos+1]) == '\0') {
break;
}
}
return(del_char);
}
}