From: j8takagi Date: Thu, 18 Jun 2026 09:35:54 +0000 (+0900) Subject: comet2コマンドで、複数ファイル指定時に2つ目以降は無視されるInfoを表示するように X-Git-Tag: v0.5p57~5 X-Git-Url: https://j8takagi.net/gitweb?a=commitdiff_plain;h=89d0fdd7b4c6ac0ee6fb834c06d65a34d5458440;p=yacasl2.git comet2コマンドで、複数ファイル指定時に2つ目以降は無視されるInfoを表示するように --- diff --git a/src/comet2.c b/src/comet2.c index b3f59a9..e381780 100644 --- a/src/comet2.c +++ b/src/comet2.c @@ -88,7 +88,11 @@ int main(int argc, char *argv[]) } comet2_init(memsize, clocks); /* COMET II仮想マシンの初期化 */ execptr->start = 0; - execptr->end = loadassemble(argv[optind], execptr->start); + execptr->end = loadassemble(argv[optind++], execptr->start); + if(optind < argc) { + warn_ignore_arg(argc - optind, argv + optind); + } + /* 残りの引数(オプション以外の引数)があるかチェック */ if(execptr->end > 0 && cerr->num == 0) { exec(); /* プログラム実行 */ } diff --git a/test/system/comet2_opt/opt_2ndarg/0.txt b/test/system/comet2_opt/opt_2ndarg/0.txt new file mode 100644 index 0000000..d81dd9d --- /dev/null +++ b/test/system/comet2_opt/opt_2ndarg/0.txt @@ -0,0 +1,2 @@ +Hello, World! +Info: arguments '../../../../as/sample/test.o ../../../../as/sample/test.o' are ignored. diff --git a/test/system/comet2_opt/opt_2ndarg/Makefile b/test/system/comet2_opt/opt_2ndarg/Makefile new file mode 100644 index 0000000..b6dac59 --- /dev/null +++ b/test/system/comet2_opt/opt_2ndarg/Makefile @@ -0,0 +1,2 @@ +include ../Define.mk +include ../Test.mk diff --git a/test/system/comet2_opt/opt_2ndarg/cmd b/test/system/comet2_opt/opt_2ndarg/cmd new file mode 100755 index 0000000..37090b5 --- /dev/null +++ b/test/system/comet2_opt/opt_2ndarg/cmd @@ -0,0 +1 @@ +../../../../comet2 ../../../../as/sample/hello.o ../../../../as/sample/test.o ../../../../as/sample/test.o