~arivigo/scalc-devel

Register cleanup with atexit() after checking for -v v1 APPLIED

Sebastian LaVine: 1
 Register cleanup with atexit() after checking for -v

 1 files changed, 2 insertions(+), 2 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~arivigo/scalc-devel/patches/23834/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH] Register cleanup with atexit() after checking for -v Export this patch

This fixes a bug where the terminal would be messed up (not showing
input, newlines being weird) after running `scalc -v`.
---
 scalc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scalc.c b/scalc.c
index ae2a889..7d22607 100644
--- a/scalc.c
+++ b/scalc.c
@@ -213,8 +213,6 @@ main(int argc, char *argv[])
	char expr[SCALC_EXPR_SIZE];
	int opt, prompt_mode;

	atexit(cleanup);

	while ((opt = getopt(argc, argv, ":v")) != -1) {
		switch (opt) {
		case 'v':
@@ -225,6 +223,8 @@ main(int argc, char *argv[])
		}
	}

	atexit(cleanup);

	if (optind < argc)
		filearg = argv[optind];
	else 
-- 
2.32.0
Yeah, this makes sense and fixes the issue.

Tested-by: Steven Guikal <void@fluix.one>
Thank you so much! Merged into master! 

-- 
Ariadna Vigo
Web: <https://ariadnavigo.xyz>
PGP: 0xA3B1324836A669BD