projects
/
YACASL2.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
dd0cec4
)
comet2monitorの修正
author
j8takagi
<j8takagi@nifty.com>
Mon, 11 Feb 2019 14:29:48 +0000
(23:29 +0900)
committer
j8takagi
<j8takagi@nifty.com>
Mon, 11 Feb 2019 14:29:48 +0000
(23:29 +0900)
src/monitor.c
patch
|
blob
|
history
src/word.c
patch
|
blob
|
history
diff --git
a/src/monitor.c
b/src/monitor.c
index
831a47a
..
a921e8d
100644
(file)
--- a/
src/monitor.c
+++ b/
src/monitor.c
@@
-349,19
+349,20
@@
void monitor()
buf = malloc_chk(MONINSIZE + 1, "monitor.buf");
fgets(buf, MONINSIZE, stdin);
if((p = strchr(buf, '\n')) != NULL) {
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);
}
}
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);
}
shutdown();
freebps();
free_cmdtable(HASH_CODE);
freecerr();
exit(0);
}
+ FREE(buf);
} while(cmdtype == MONREPEAT);
}
} while(cmdtype == MONREPEAT);
}
diff --git
a/src/word.c
b/src/word.c
index
d26438f
..
74a2786
100644
(file)
--- a/
src/word.c
+++ b/
src/word.c
@@
-84,6
+84,9
@@
WORD nh2word(const char *str)
WORD w;
assert(sizeof(WORD) * 8 == 16); /* WORD型のサイズが16ビットであることを確認 */
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;
if(!isdigit(*str) && *str != '-' && *str != '#') {
setcerr(114, str); /* not integer */
return 0x0;