Mercurial > vim
annotate src/po/sjiscorr.c @ 17722:bf807c68ac80 v8.1.1858
patch 8.1.1858: test for multi-byte mapping fails on some systems
commit https://github.com/vim/vim/commit/2f710afe7f166973c879bf7424678ba84368c1bb
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Aug 16 20:56:03 2019 +0200
patch 8.1.1858: test for multi-byte mapping fails on some systems
Problem: Test for multi-byte mapping fails on some systems.
Solution: Test in another way.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 16 Aug 2019 21:00:03 +0200 |
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 } |