buf = malloc_chk(MONINSIZE + 1, "monitor.buf");
fgets(buf, MONINSIZE, stdin);
if((p = strchr(buf, '\n')) != NULL) {
- strcpy(p, "");
+ p = '\0';
}
if((moncmdl = monlinetok(buf)) != NULL) {
cmdtype = monitorcmd(moncmdl->cmd, moncmdl->args);
free_moncmdline(moncmdl);
}
- FREE(buf);
- if(cmdtype == MONQUIT) {
+ if(!buf[0] || cmdtype == MONQUIT) {
+ FREE(buf);
shutdown();
freebps();
free_cmdtable(HASH_CODE);
freecerr();
exit(0);
}
+ FREE(buf);
} while(cmdtype == MONREPEAT);
}
WORD w;
assert(sizeof(WORD) * 8 == 16); /* WORD型のサイズが16ビットであることを確認 */
+ if(str == NULL) {
+ return 0x0;
+ }
if(!isdigit(*str) && *str != '-' && *str != '#') {
setcerr(114, str); /* not integer */
return 0x0;