|
@@ -4,6 +4,7 @@
|
|
* Data is taken from stdin and is returned to stdout.
|
|
* Data is taken from stdin and is returned to stdout.
|
|
*
|
|
*
|
|
* Licensed under GPL-3.
|
|
* Licensed under GPL-3.
|
|
|
|
+ * ® 2012 - 2015 Andrew Savchenko <bircoph gmail com>
|
|
*/
|
|
*/
|
|
|
|
|
|
#include <stdio.h>
|
|
#include <stdio.h>
|
|
@@ -24,7 +25,7 @@ const char *const ct[ALPHA_CNT][TRANSL_CNT]={
|
|
{"д", "d", NULL},
|
|
{"д", "d", NULL},
|
|
{"е", "e", "je", "ye", NULL},
|
|
{"е", "e", "je", "ye", NULL},
|
|
{"ё", "e", "jo", "yo", NULL},
|
|
{"ё", "e", "jo", "yo", NULL},
|
|
- {"ж", "j", "z", NULL},
|
|
|
|
|
|
+ {"ж", "j", "z", "zh", NULL},
|
|
{"з", "z", NULL},
|
|
{"з", "z", NULL},
|
|
{"и", "i", NULL},
|
|
{"и", "i", NULL},
|
|
{"й", "j", "i", NULL},
|
|
{"й", "j", "i", NULL},
|
|
@@ -82,9 +83,9 @@ void convline(char *in, char *out, size_t out_start, size_t out_len)
|
|
fork = malloc(sizeof(char)*fork_len);
|
|
fork = malloc(sizeof(char)*fork_len);
|
|
|
|
|
|
// copy base value
|
|
// copy base value
|
|
- strcpy(fork, out);
|
|
|
|
|
|
+ memcpy(fork, out, out_start);
|
|
// get value from conversion table
|
|
// get value from conversion table
|
|
- strcpy(fork+out_start, ct[i][j]);
|
|
|
|
|
|
+ memcpy(fork+out_start, ct[i][j], tr_len);
|
|
// fork further expansion for an alternative translation
|
|
// fork further expansion for an alternative translation
|
|
convline(in+2, fork, out_start+tr_len, fork_len);
|
|
convline(in+2, fork, out_start+tr_len, fork_len);
|
|
}
|
|
}
|
|
@@ -98,7 +99,7 @@ void convline(char *in, char *out, size_t out_start, size_t out_len)
|
|
}
|
|
}
|
|
|
|
|
|
// get value from conversion table
|
|
// get value from conversion table
|
|
- strcpy(out+out_start, ct[i][1]);
|
|
|
|
|
|
+ memcpy(out+out_start, ct[i][1], tr_len);
|
|
|
|
|
|
// go to next char
|
|
// go to next char
|
|
out_start += tr_len;
|
|
out_start += tr_len;
|