annotate src/po/sjiscorr.c @ 19729:bc91817dda84

Added tag v8.2.0420 for changeset 41a1ea967a979d27907c0048cadf5b851343e81f
author Bram Moolenaar <Bram@vim.org>
date Fri, 20 Mar 2020 19:45:04 +0100
parents b79453d0d01c
children 45c0a5330758
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
7856
226ed297307f commit https://github.com/vim/vim/commit/d14e00ea67afbaa8cb4a7e6b1eb306da6a2d5adb
Christian Brabandt <cb@256bit.org>
parents: 7837
diff changeset
10 main(int argc, char **argv)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 char buffer[BUFSIZ];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 char *p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 while (fgets(buffer, BUFSIZ, stdin) != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 for (p = buffer; *p != 0; p++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 {
14187
b79453d0d01c patch 8.1.0111: .po files do not use recommended names
Christian Brabandt <cb@256bit.org>
parents: 7856
diff changeset
19 if (strncmp(p, "charset=utf-8", 13) == 0
b79453d0d01c patch 8.1.0111: .po files do not use recommended names
Christian Brabandt <cb@256bit.org>
parents: 7856
diff changeset
20 || strncmp(p, "charset=UTF-8", 13) == 0)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 fputs("charset=cp932", stdout);
4502
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
23 p += 12;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 }
6351
65df2fba429b updated for version 7.4.508
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
25 else if (strncmp(p, "# Original translations", 23) == 0)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 fputs("# generated from ja.po, DO NOT EDIT", stdout);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 while (p[1] != '\n')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 ++p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 else if (*(unsigned char *)p == 0x81 && p[1] == '_')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 putchar('\\');
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 ++p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 if (*p & 0x80)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 putchar(*p++);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 if (*p == '\\')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 putchar(*p);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 }
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 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 }