From bb8a62314e7453b343b50ac5fa0da307a2361381 Mon Sep 17 00:00:00 2001 From: j8takagi Date: Sun, 31 May 2026 00:03:35 +0900 Subject: [PATCH] =?utf8?q?comet2monitor=E3=81=A7=E5=BC=95=E6=95=B0?= =?utf8?q?=E3=81=8C=E7=84=A1=E8=A6=96=E3=81=95=E3=82=8C=E3=82=8B=E5=A0=B4?= =?utf8?q?=E5=90=88=E3=81=AE=E3=83=A1=E3=83=83=E3=82=BB=E3=83=BC=E3=82=B8?= =?utf8?q?=E3=82=92=E8=A8=AD=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- include/monitor.h | 8 ++++++++ src/comet2monitor.c | 5 +++++ src/monitor.c | 3 ++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/include/monitor.h b/include/monitor.h index a503183..b81c71e 100644 --- a/include/monitor.h +++ b/include/monitor.h @@ -93,6 +93,14 @@ MONCMDLINE *monlinetok(const char *line); */ MONCMDTYPE monitorcmd(char *cmd, MONARGS *args); +/** + * @brief 引数が無視されることを表示する + * + * @param argc 引数の配列数 + * @param *argv 引数配列 + */ +void warn_ignore_arg(int argc, char *argv[]); + /** * @brief ブレークポイント表にアドレスがある場合はtrue、ない場合はfalseを返す * diff --git a/src/comet2monitor.c b/src/comet2monitor.c index 1f08637..d71c93b 100644 --- a/src/comet2monitor.c +++ b/src/comet2monitor.c @@ -1,6 +1,7 @@ #include "package.h" #include "exec.h" #include "load.h" +#include "monitor.h" /** * comet2monitorコマンドのオプション @@ -70,6 +71,10 @@ int main(int argc, char *argv[]) goto comet2monitorfin; } } + /* 残りの引数(オプション以外の引数)があるかチェック */ + if (optind < argc) { + warn_ignore_arg(argc - optind, argv + optind); + } create_cmdtable(HASH_CMDTYPE); reset(memsize, clocks); /* COMET II仮想マシンのリセット */ execptr->start = 0; diff --git a/src/monitor.c b/src/monitor.c index 8ad69ce..aabb23c 100644 --- a/src/monitor.c +++ b/src/monitor.c @@ -196,13 +196,14 @@ bool stracmp(char *str1, int str2c, char *str2v[]) void warn_ignore_arg(int argc, char *argv[]) { int i; + fprintf(stderr, "Info: arguments '"); for(i = 0; i < argc; i++) { if(i > 0) { fprintf(stderr, " "); } fprintf(stderr, "%s", argv[i]); } - fprintf(stderr, ": ignored.\n"); + fprintf(stderr, "' are ignored.\n"); } void mon_break(int argc, char *argv[]) -- 2.47.3