File 0001-Add-command-line-support-for-the-version-s-f-command.patch of Package ngspice
From e6ba353542c8dde1a7d3d94d642dae3f3b3fe80d Mon Sep 17 00:00:00 2001
From: Ralf Habacker <ralf.habacker@freenet.de>
Date: Fri, 9 Jan 2026 00:20:21 +0100
Subject: [PATCH] Add command line support for the 'version [-s|-f]' command
---
src/main.c | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/src/main.c b/src/main.c
index a5a83c011..2fea773a2 100644
--- a/src/main.c
+++ b/src/main.c
@@ -764,6 +764,8 @@ show_help(void)
" -t, --term=TERM set the terminal type\n"
" -h, --help display this help and exit\n"
" -v, --version output version information and exit\n"
+ " -f, --version-full output full version information\n"
+ " --version-small output small version information\n"
"\n"
"Report bugs to %s.\n", cp_program, Bug_Addr);
}
@@ -961,6 +963,8 @@ int main(int argc, char **argv)
{"define", required_argument, NULL, 'D'},
{"help", no_argument, NULL, 'h'},
{"version", no_argument, NULL, 'v'},
+ {"version-full", no_argument, NULL, 'f'},
+ {"version-small", no_argument, NULL, 256},
{"batch", no_argument, NULL, 'b'},
{"autorun", no_argument, NULL, 'a'},
{"circuitfile", required_argument, NULL, 'c'},
@@ -978,7 +982,7 @@ int main(int argc, char **argv)
int option_index = 0;
- int c = getopt_long(argc, argv, "D:hvbac:ino:pqr:st:",
+ int c = getopt_long(argc, argv, "D:hvfbac:ino:pqr:st:",
long_options, &option_index);
if (c == -1) {
@@ -1013,6 +1017,22 @@ int main(int argc, char **argv)
sp_shutdown(EXIT_INFO);
break;
+ case 'f': /* Full version info */
+ {
+ wordlist wl = { "-f", NULL, NULL };
+ com_version(&wl);
+ sp_shutdown(EXIT_INFO);
+ }
+ break;
+
+ case 256: /* --version-small */
+ {
+ wordlist wl = { "-s", NULL, NULL };
+ com_version(&wl);
+ sp_shutdown(EXIT_INFO);
+ }
+ break;
+
case 'b': /* Batch mode */
{
bool x_false = FALSE;
--
2.51.0