CE Implement line editing
All checks were successful
Build documentation / build-and-deploy (push) Successful in 2m8s
All checks were successful
Build documentation / build-and-deploy (push) Successful in 2m8s
This commit is contained in:
@@ -118,3 +118,25 @@ int isxdigit (int c) { return isdigit (c) || (c >= 'A' && c <= 'F') || (c >= 'a'
|
||||
int isascii (int c) { return (c >= 0 && c <= 127); }
|
||||
|
||||
int isblank (int c) { return (c == ' ' || c == '\t'); }
|
||||
|
||||
/* SOURCE: https://aticleworld.com/memmove-function-implementation-in-c/ */
|
||||
void* memmove (void* dest, const void* src, unsigned int n) {
|
||||
unsigned char isCopyRequire = 0; // flag bit
|
||||
char* pcSource = (char*)src;
|
||||
char* pcDstn = (char*)dest;
|
||||
// return if pcDstn and pcSource is NULL
|
||||
if ((pcSource == NULL) || (pcDstn == NULL)) {
|
||||
return NULL;
|
||||
}
|
||||
// overlap buffer
|
||||
if ((pcSource < pcDstn) && (pcDstn < pcSource + n)) {
|
||||
for (pcDstn += n, pcSource += n; n--;) {
|
||||
*--pcDstn = *--pcSource;
|
||||
}
|
||||
} else {
|
||||
while (n--) {
|
||||
*pcDstn++ = *pcSource++;
|
||||
}
|
||||
}
|
||||
return dest;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user