I finally found where the error occurs.
The error occurred in the command_interpreter function in the interpreter.c file.
I modified the last of the command_interpreter function to look like this:
When the error is corrected, it must be reverted to the original.
Code:
send_to_char(ch, "Commands Error!\r\n");
// ((*complete_cmd_info[cmd].command_pointer) (ch, line, cmd, complete_cmd_info[cmd].subcmd));
Then, I modified it to show what arg and line return.
Code:
line = any_one_arg(argument, arg);
Add the following to the next line.
This was used to find the cause of the error. To see how the arguments I entered work.
Code:
send_to_char(ch, "arg: %s line: %s\r\n", arg, line);
If I type
You will get the following results.
Code:
500H 100M 82V (news) (motd) > arg: aa line: dd ddd typo
In the case of Hangul, it is natural to change the order of commands.
The current English version of typo usage is as follows.
Code:
typo submit <header>
In the case of <header>, a string containing spaces can be used.
However, in the case of Hangul, it is natural to change the order of commands as follows.
Code:
submit <header> typo
Basic instruction comes last, auxiliary instruction comes first.
Also, since Hangul uses double-byte characters, it is not possible to determine if it is Hangul using isalpha().
So add the following at the end of the utils.h file.
Code:
#define ishan(ch) (((ch) & 0xE0) > 0x90)
#define ishanasc(ch) (isascii(ch) || ishan(ch))
#define ishanalp(ch) (isalpha(ch) || ishan(ch))
#define isnhdigit(ch) (!ishan(ch) && isdigit(ch))
#define isnhspace(ch) (!ishan(ch) && isspace(ch))
Code:
static int _parse_name(char *arg, char *name)
{
int i;
skip_spaces(&arg);
for (i = 0; (*name = *arg); arg++, i++, name++)
if (!isalpha(*arg))
return (1);
if (!i)
return (1);
return (0);
}
Change the code above as below.
Hangul is not read 1byte at a time like the English alphabet, and only 2bytes are read to complete Hangul characters.
Code:
static int _parse_name(char *arg, char *name)
{
int i;
//skip_spaces(&arg);
for (; isnhspace(*arg); arg++);
for (i = 0; (*name = *arg); arg++, i++, name++)
//if (!isalpha(*arg))
if (!ishanalp(*arg))
return (1);
if (!i)
return (1);
return (0);
}
Also, the void skip_spaces(char **string) function must be modified as follows to use Korean.
Code:
// for (; **string && **string != '\t' && isspace(**string); (*string)++);
for (; **string && isnhspace(**string); (*string)++);
Finally, you need to change the order of commands in command_interpreter.
I don't know if this is the right way.
This is how I found it out by searching the Internet.
Code:
void command_interpreter(struct char_data *ch, char *argument)
{
int cmd, length;
char *line;
char arg[MAX_INPUT_LENGTH];
// Change commands to Hangul word order
char hanparse[MAX_INPUT_LENGTH];
char hancommand[MAX_INPUT_LENGTH];
REMOVE_BIT_AR(AFF_FLAGS(ch), AFF_HIDE);
/* just drop to next line for hitting CR */
skip_spaces(&argument);
if (!*argument)
return;
// Change commands to Korean word order
sprintf(hanparse, "%s", argument);
if(strrchr(hanparse, ' ')) {
sprintf(hancommand, "%s ", strrchr(hanparse, ' '));
hanparse[strlen(hanparse) - (strlen(hancommand) - 1)] = '\0';
strcat(hancommand, hanparse);
argument = hancommand;
} else
argument = hanparse;
skip_spaces(&argument);
/* special case to handle one-character, non-alphanumeric commands; requested
* by many people so "'hi" or ";godnet test" is possible. Patch sent by Eric
* Green and Stefan Wasilewski. */
// Change not to skip Hangul
if (!ishanalp(*argument)) {
// if (!isalpha(*argument)) {
arg[0] = argument[0];
arg[1] = '\0';
line = argument + 1;
} else
line = any_one_arg(argument, arg);
It is true that errors occur in this function, but I need to correct it because of my weak program skills.
The commands entered are not English, and similar Korean commands should be printed even if they are Korean.
Of course, most commands have been changed to Korean.
We've figured out why and where the error occurred, but the error still persists.