1% notcurses_stop(3) 2% nick black <nickblack@linux.com> 3% v3.0.1 4 5# NAME 6 7notcurses_stop - free up resources and restore initial terminal state 8 9# SYNOPSIS 10 11**#include <notcurses/notcurses.h>** 12 13**int notcurses_stop(struct notcurses* ***nc***);** 14 15# DESCRIPTION 16 17**notcurses_stop** frees up any resources associated with the 18**struct notcurses** provided as **nc**, and attempts to restore the terminal to its 19state prior to calling **notcurses_init(3)**. It also unregisters any signal 20handlers put into place by **notcurses_init(3)**. **nc** must not be used 21following the call, and all references to ncplanes, cells, etc. are 22invalidated. 23 24Once the terminal has been reset, a summary of runtime and performance is 25printed, unless **NCOPTION_SUPPRESS_BANNERS** was provided to 26**notcurses_init(3)**. 27 28The first step taken by **notcurses_stop** is a call to the internal function 29**notcurses_stop_minimal**. This is the same function called by the fatal 30signal handlers installed in the absence of **NCOPTION_NO_QUIT_SIGHANDLERS**. 31This function: 32 33* Disables the Notcurses signal handlers 34* Emits the **op** terminfo capability, if supported 35* Emits the **sgr0** terminfo capability, if supported 36* Emits the **oc** terminfo capability, if supported 37* Emits the **rmcup** terminfo capability, if supported (and if 38 **NCOPTION_NO_ALTERNATE_SCREEN** was not provided). 39* Emits the **cnorm** terminfo capability, if supported 40 41Respectively, these restore the default colorpair to its original value 42(**op**), turn off all text attributes (**sgr0**), restore the default 43palette (**oc**), exit the alternate screen (**rmcup**), and restore the 44cursor to its default appearance (**cnorm**). 45 46It is legal to pass **NULL** to **notcurses_stop**. This is a no-op. 47 48# NOTES 49 50Behavior is undefined if other threads are working with **nc** when or after 51this function is called. It is unlikely to be good. 52 53# RETURN VALUES 54 55On success, 0 is returned. Otherwise, a negative value is returned. 56 57# SEE ALSO 58 59**notcurses(3)**, 60**notcurses_init(3)**, 61**terminfo(5)** 62