annotate src/po/sjiscorr.c @ 2001:98cdf5c477ec v7.2.298

updated for version 7.2-298
author vimboss
date Tue, 17 Nov 2009 13:57:22 +0000
parents 3fc0f57ecb91
children 605c9ce57ec3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 * Simplistic program to correct SJIS inside strings. When a trail byte is a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3 * backslash it needs to be doubled.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4 * Public domain.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6 #include <stdio.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 #include <string.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 main(argc, argv)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 int argc;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 char **argv;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 char buffer[BUFSIZ];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 char *p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 while (fgets(buffer, BUFSIZ, stdin) != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 for (p = buffer; *p != 0; p++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 if (strncmp(p, "charset=euc-jp", 14) == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 fputs("charset=cp932", stdout);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 p += 13;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 else if (strncmp(p, "ja.po - Japanese message file", 29) == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 fputs("ja.sjis.po - Japanese message file for Vim (version 6.x)\n", stdout);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 fputs("# generated from ja.po, DO NOT EDIT", stdout);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 while (p[1] != '\n')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 ++p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 else if (*(unsigned char *)p == 0x81 && p[1] == '_')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 putchar('\\');
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 ++p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 if (*p & 0x80)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 putchar(*p++);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 if (*p == '\\')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 putchar(*p);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 putchar(*p);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 }