]> j8takagi.net git repositories - yacasl2.git/commitdiff
comet2コマンドで、複数ファイル指定時に2つ目以降は無視されるInfoを表示するように
authorj8takagi <j8takagi@nifty.com>
Thu, 18 Jun 2026 09:35:54 +0000 (18:35 +0900)
committerj8takagi <j8takagi@nifty.com>
Thu, 18 Jun 2026 09:35:54 +0000 (18:35 +0900)
src/comet2.c
test/system/comet2_opt/opt_2ndarg/0.txt [new file with mode: 0644]
test/system/comet2_opt/opt_2ndarg/Makefile [new file with mode: 0644]
test/system/comet2_opt/opt_2ndarg/cmd [new file with mode: 0755]

index b3f59a9d1b412f4195413914f1ffe6ef1da17fda..e381780c0fb24f58ea6cf9d4becad267e383b6ae 100644 (file)
@@ -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 (file)
index 0000000..d81dd9d
--- /dev/null
@@ -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 (file)
index 0000000..b6dac59
--- /dev/null
@@ -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 (executable)
index 0000000..37090b5
--- /dev/null
@@ -0,0 +1 @@
+../../../../comet2 ../../../../as/sample/hello.o ../../../../as/sample/test.o ../../../../as/sample/test.o