summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Naumov <alexander_naumov@opensuse.org>2020-01-10 20:27:58 +0100
committerAlexander Naumov <alexander_naumov@opensuse.org>2020-01-10 20:27:58 +0100
commit4a48bb2798691e68e5b33aea1df902ad6cd40da2 (patch)
tree9fc16a2cb80a683d4ddb7ee3c3c94993be55e292
parentd7bd327fdf799c82f9a359365d461edb755056ea (diff)
downloadscreen-4a48bb2798691e68e5b33aea1df902ad6cd40da2.tar.gz
Fix return code of '--version' and '-v'
Bug #57571
-rw-r--r--src/screen.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/screen.c b/src/screen.c
index 53d00f2..8ef3a0e 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -353,8 +353,10 @@ int main(int argc, char **argv)
argc--;
break;
}
- if (ap[1] == '-' && !strncmp(ap, "--version", 9))
- Panic(0, "Screen version %s", version);
+ if (ap[1] == '-' && !strncmp(ap, "--version", 9)) {
+ printf("Screen version %s\n", version);
+ exit(0);
+ }
if (ap[1] == '-' && !strncmp(ap, "--help", 6))
exit_with_usage(myname, NULL, NULL);
while (ap && *ap && *++ap) {
@@ -568,8 +570,8 @@ int main(int argc, char **argv)
cmdflag = true;
break;
case 'v':
- Panic(0, "Screen version %s", version);
- /* NOTREACHED */
+ printf("Screen version %s\n", version);
+ exit(0);
case 'U':
nwin_options.encoding = nwin_options.encoding == -1 ? UTF8 : 0;
break;