Mercurial > vim
annotate src/po/sjiscorr.c @ 31544:922e7109afcf
Added tag v9.0.1104 for changeset 0c0ecf489f050d8fae471253972a30de7bb4cbfb
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 27 Dec 2022 18:30:07 +0100 |
parents | b79453d0d01c |
children | 45c0a5330758 |
rev | line source |
---|---|
7 | 1 /* |
2 * Simplistic program to correct SJIS inside strings. When a trail byte is a | |
3 * backslash it needs to be doubled. | |
4 * Public domain. | |
5 */ | |
6 #include <stdio.h> | |
7 #include <string.h> | |
8 | |
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 | 11 { |
12 char buffer[BUFSIZ]; | |
13 char *p; | |
14 | |
15 while (fgets(buffer, BUFSIZ, stdin) != NULL) | |
16 { | |
17 for (p = buffer; *p != 0; p++) | |
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 | 21 { |
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 | 24 } |
6351 | 25 else if (strncmp(p, "# Original translations", 23) == 0) |
7 | 26 { |
27 fputs("# generated from ja.po, DO NOT EDIT", stdout); | |
28 while (p[1] != '\n') | |
29 ++p; | |
30 } | |
31 else if (*(unsigned char *)p == 0x81 && p[1] == '_') | |
32 { | |
33 putchar('\\'); | |
34 ++p; | |
35 } | |
36 else | |
37 { | |
38 if (*p & 0x80) | |
39 { | |
40 putchar(*p++); | |
41 if (*p == '\\') | |
42 putchar(*p); | |
43 } | |
44 putchar(*p); | |
45 } | |
46 } | |
47 } | |
48 } |