mirror of
https://github.com/reactos/wine.git
synced 2024-11-25 04:39:45 +00:00
Implemented some CRTDLL string functions.
This commit is contained in:
parent
61afa33b03
commit
6d7773c974
@ -28,6 +28,7 @@ C_SRCS = \
|
||||
spooler.c \
|
||||
spy.c \
|
||||
stress.c \
|
||||
string.c \
|
||||
system.c \
|
||||
tapi32.c \
|
||||
toolhelp.c \
|
||||
|
67
misc/string.c
Normal file
67
misc/string.c
Normal file
@ -0,0 +1,67 @@
|
||||
/*
|
||||
* implementation of MSDEVS extensions to string.h
|
||||
*
|
||||
* Copyright 1999 Corel Corporation (Albert den Haan)
|
||||
*/
|
||||
|
||||
/* WARNING: The Wine declarations are in tchar.h for now since string.h is
|
||||
* not available to be altered in most development environments. MSDEVS 5
|
||||
* declarse these functions in its own "string.h" */
|
||||
|
||||
#include "tchar.h"
|
||||
|
||||
#include <ctype.h>
|
||||
#include <assert.h>
|
||||
|
||||
char *_strlwr(char *string) {
|
||||
char *cp;
|
||||
|
||||
assert(string != NULL);
|
||||
|
||||
for(cp = string; *cp; cp++) {
|
||||
*cp = tolower(*cp);
|
||||
}
|
||||
return string;
|
||||
}
|
||||
|
||||
char *_strrev(char *string) {
|
||||
char *pcFirst, *pcLast;
|
||||
assert(string != NULL);
|
||||
|
||||
pcFirst = pcLast = string;
|
||||
|
||||
/* find the last character of the string
|
||||
* (i.e. before the assumed nul-character) */
|
||||
while(*(pcLast + 1)) {
|
||||
pcLast++;
|
||||
}
|
||||
|
||||
/* if the following ASSERT fails look for a bad (i.e. not nul-terminated)
|
||||
* string */
|
||||
assert(pcFirst <= pcLast);
|
||||
|
||||
/* reverse the string */
|
||||
while(pcFirst < pcLast) {
|
||||
/* swap characters across the middle */
|
||||
char cTemp = *pcFirst;
|
||||
*pcFirst = *pcLast;
|
||||
*pcLast = cTemp;
|
||||
/* move towards the middle of the string */
|
||||
pcFirst++;
|
||||
pcLast--;
|
||||
}
|
||||
|
||||
return string;
|
||||
}
|
||||
|
||||
char *_strupr(char *string) {
|
||||
char *cp;
|
||||
|
||||
assert(string != NULL);
|
||||
|
||||
for(cp = string; *cp; cp++) {
|
||||
*cp = toupper(*cp);
|
||||
}
|
||||
return string;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user