--- nono/vm/romemu_luna1.cpp 2026/04/29 17:04:50 1.1.1.1 +++ nono/vm/romemu_luna1.cpp 2026/04/29 17:04:53 1.1.1.2 @@ -230,19 +230,11 @@ Luna1PROMEmuDevice::Command() // 1ワードごとに分解 strcpy(&buf[0], inputbuf.c_str()); char *p = &buf[0]; - char *s = p; - while (*p != '\0') { - if (*p == ' ') { - *p++ = '\0'; - arg.push_back(std::string(s)); - s = p; - } else { - p++; + for (char *ap; (ap = strsep(&p, " ")) != NULL; ) { + if (*ap != '\0') { + arg.push_back(std::string(ap)); } } - if (p != s) { - arg.push_back(std::string(s)); - } if (loglevel >= 1) { for (int i = 0; i < arg.size(); i++) { putmsgn("arg[%d]=|%s|", i, arg[i].c_str());