home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
QBasic & Borland Pascal & C
/
Delphi5.iso
/
C
/
Samples
/
CSAPE32.ARJ
/
SOURCE
/
CSSRC
/
SDOVRWRT.C
< prev
next >
Wrap
C/C++ Source or Header
|
1990-03-28
|
1KB
|
49 lines
/*
sdovrwrt.c
% sed_Overwrite
C-scape 3.2
Copyright (c) 1986, 1987, by Oakland Group, Inc.
ALL RIGHTS RESERVED.
Revision History:
-----------------
11/06/86 jmd Now returns the overwritten character.
11/16/86 sng Now handles variable-length fields.
11/18/87 jmd changed names of some low-level funcs
3/24/89 jmd Added test for same character
4/13/89 jmd added sed_GetCurrField macro
3/28/90 jmd ansi-fied
*/
#include "sed.h"
char sed_Overwrite(sed_type sed, int scancode)
/*
modifies: the sed.
effects: overwrites the character at the current field number and
position with the scancode given. If the new character
is the same as the old, does nothing.
returns: the old character.
*/
{
char old_char;
field_type field;
cs_Assert(sed_Ok(sed), CS_SD_OVR_SED, 0);
field = sed_GetCurrField(sed);
/* Remember the old character. */
old_char = field_GetRecord(field)[sed_GetRecordPos(sed)];
if (old_char != (char) scancode) {
field_SetChar(field, sed_GetRecordPos(sed), (char) scancode);
sd_overwrite(sed);
}
return(old_char);
}