1 /***********************************************************************************
2  * an_string.c
3  ***********************************************************************************
4  * anubisnet string work-on library, advanced commands to manipulate strings
5  * Author: Bjoern Berg, June 2002
6  * Email: clergyman@gmx.de
7  *
8  * Implemented for: dbf Reader and Converter for dBase 3
9  * Version 0.2
10  *
11  * History:
12  * - Version 0.2 - April 2003
13  * - Version 0.1.1 - September 2002
14  *   pasted into extra header file to use it in other programmes
15  * - Version 0.1 - June 2002
16  *	 first implementation in dbf.c
17  ************************************************************************************/
18 
19 #include <assert.h>
20 #include "an_string.h"
21 
22 /* * * * COUNTUMLAUTS
23  * we use this function to get the number of umlauts in
24  * the string and decide if we have to convert or not */
25 int
countumlauts(const char * src)26 countumlauts (const char *src)
27 {
28 	int count;
29 	count = 0;
30 	for(; *src; src++) {
31 		printf("%c\n", *src);
32     	switch(*src) {
33       	case '\341':
34 			printf("� gefunden\n");
35         	count++;
36         	break;
37       	case '\204':
38         	count++;
39         	break;
40       	case '\216':
41         	count++;
42         	break;
43       	case '\224':
44 			printf("� gefunden\n");
45         	count++;
46         	break;
47     	}
48 	}
49 	return count;
50 
51 }
52 
53 
54 /* * * * CONVUML
55  * converts german special chars into standard chars */
56 void
convuml(char * dest,const char * src)57 convuml(char *dest, const char *src)
58 {
59 	while(*src != '\0') {
60     switch(*src) {
61       case '�':
62         *dest++ = 's';
63         *dest++ = 's';
64         break;
65       case '�':
66         *dest++ = 'a';
67         *dest++ = 'e';
68         break;
69       case '�':
70         *dest++ = 'o';
71         *dest++ = 'e';
72         break;
73       case '�':
74         *dest++ = 'u';
75         *dest++ = 'e';
76         break;
77       default:
78         *dest++ = *src;
79     }
80     src++;
81   }
82   *dest = '\0';
83 }
84