1 /* coded by Ketmar // Vampire Avalon (psyc://ketmar.no-ip.org/~Ketmar)
2 * Understanding is not required. Only obedience.
4 * This program is free software. It comes without any warranty, to
5 * the extent permitted by applicable law. You can redistribute it
6 * and/or modify it under the terms of the Do What The Fuck You Want
7 * To Public License, Version 2, as published by Sam Hocevar. See
8 * http://www.wtfpl.net/txt/copying/ for more details.
99 static inline const char *findTRC (char c
) {
101 for (size_t f
= 0; f
< sizeof(atrans
)/sizeof(atrans
[0]); ++f
) {
102 if (atrans
[f
].code
== cc
) return atrans
[f
].ch
;
108 char *translitstr (const char *src
) {
110 if (src
== NULL
) src
= "";
111 res
= dest
= calloc(strlen(src
)*3+2, sizeof(char));
112 for (int f
= 0; f
< strlen(src
); ++f
) {
113 const char *ch
= findTRC(src
[f
]);
115 for (; *ch
; ++ch
) *dest
++ = le2lower(*ch
);
117 *dest
++ = le2lower(src
[f
]);