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