From 43a608e1488e492941b920c36a2aef5c3e3a1cc2 Mon Sep 17 00:00:00 2001 From: kkato233 Date: Fri, 21 Nov 2014 00:29:03 +0900 Subject: [PATCH] =?utf8?q?nkf32.dll=20=E3=81=A7=20SetNkfOption=20=E3=81=AE?= =?utf8?q?=E3=83=90=E3=82=B0=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit SetNkfOption で 複数のオプションを指定した場合に正しくオプションが指定できないバグの修正。 --- nkf32dll.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/nkf32dll.c b/nkf32dll.c index facbb4b..c2208d7 100644 --- a/nkf32dll.c +++ b/nkf32dll.c @@ -341,11 +341,58 @@ int CALLBACK SetNkfOption(LPSTR optStr) return 0; } +int findspace(const char* str) +{ + int find_n = 0; + while (*str != 0) { + if (*str == ' ') { + find_n++; + } + str++; + } + return find_n; +} +// ƒIƒvƒVƒ‡ƒ“‚ª ‹ó”’‚Å‹æØ‚ç‚ê‚Ä‚¢‚éê‡‚É options ‚𕡐”ŒÄ‚яo‚· +void callOptions() +{ + char *work = strdup(optStr0); + int len = strlen(optStr0); + for (int i = 0; i < len; i++) { + if (work[i] == ' ') { + work[i] = '\0'; + } + } + int i = 0; + while (i < len) + { + // •¶Žš‚ð’T‚· + if (work[i] != '\0') { + // options ŒÄ‚яo‚µ + options(&work[i]); + + // •¶Žš‚̏I’[‚ð’T‚· + while (work[i] != '\0' && i < len) { + i++; + } + } + else { + i++; + } + } + free(work); +} + void options0(void) { reinit(); if ( optStr0 != NULL ) { - options(optStr0); + // option ‚Ì’†‚É ‹ó”’‚ª‚ ‚Á‚½ê‡ options ‚𕪊„‚µ‚ČĂяo‚· + if (findspace(optStr0) > 0) { + callOptions(); + } + else { + options(optStr0); + } } } -- 2.11.0