Corrected small bug in GetCommState16. Parity check can be disabled
[wine.git] / misc / string.c
blob025f2d468d121e82206786699d80ded6af1295f6
1 /*
2 * implementation of MSDEVS extensions to string.h
4 * Copyright 1999 Corel Corporation (Albert den Haan)
5 */
7 /* WARNING: The Wine declarations are in tchar.h for now since string.h is
8 * not available to be altered in most development environments. MSDEVS 5
9 * declarse these functions in its own "string.h" */
11 #include "tchar.h"
13 #include <ctype.h>
14 #include <assert.h>
16 char *_strlwr(char *string) {
17 char *cp;
19 assert(string != NULL);
21 for(cp = string; *cp; cp++) {
22 *cp = tolower(*cp);
24 return string;
27 char *_strrev(char *string) {
28 char *pcFirst, *pcLast;
29 assert(string != NULL);
31 pcFirst = pcLast = string;
33 /* find the last character of the string
34 * (i.e. before the assumed nul-character) */
35 while(*(pcLast + 1)) {
36 pcLast++;
39 /* if the following ASSERT fails look for a bad (i.e. not nul-terminated)
40 * string */
41 assert(pcFirst <= pcLast);
43 /* reverse the string */
44 while(pcFirst < pcLast) {
45 /* swap characters across the middle */
46 char cTemp = *pcFirst;
47 *pcFirst = *pcLast;
48 *pcLast = cTemp;
49 /* move towards the middle of the string */
50 pcFirst++;
51 pcLast--;
54 return string;
57 char *_strupr(char *string) {
58 char *cp;
60 assert(string != NULL);
62 for(cp = string; *cp; cp++) {
63 *cp = toupper(*cp);
65 return string;