Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore terminal background colour on quit #383

Closed
wants to merge 5 commits into from
Closed

Restore terminal background colour on quit #383

wants to merge 5 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Mar 22, 2022

The background colour of the user's terminal is restored on quit, but Direwolf output is unaffected. The following screenshot shows the changes made.
2022-03-22_02:20:28

@@ -221,6 +221,7 @@ int main (int argc, char *argv[])

if (num_clients < 1 || num_clients > MAX_CLIENTS) {
printf ("Specify up to %d TNCs on the command line.\n", MAX_CLIENTS);
dw_printf ("\e[0m\e\n\e[0J\e");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like dw_printf ("\e[0m\e\n\e[0J\e"); always goes with exit (x);
Consider to combine those two. It might look like:

// Exit from DW and restore terminal color
void dw_exit(int exit_code)
{
    dw_printf ("\e[0m\e\n\e[0J\e");
    exit (exit_code);
}
dw_exit(1);

@ew1abz
Copy link
Contributor

ew1abz commented Jul 7, 2022

Extremely useful improvement! Thanks a lot!

@natem-nvsd You can squash your five commits into just one. It'll make Git history cleaner and review easier.
https://www.cloudbees.com/blog/git-squash-how-to-condense-your-commit-history

@ghost ghost closed this by deleting the head repository Nov 14, 2022
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant