---
name: "notcurses_stop"
section: "3"
platform: "linux"
package: "notcurses"
version: "3.0.17-3"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/notcurses_stop"
---

# notcurses\_stop(3)

free up resources and restore initial terminal state

## NAME

notcurses\_stop - free up resources and restore initial terminal state

## SYNOPSIS

**#include \<notcurses/notcurses.h\>**

**int notcurses\_stop(struct notcurses\*** *nc***);**

## DESCRIPTION

**notcurses\_stop** frees up any resources associated with the **struct notcurses** provided as **nc**, and attempts to restore the terminal to its state prior to calling **[notcurses\_init(3)](/notcurses_init/3.md)**. It also unregisters any signal handlers put into place by **[notcurses\_init(3)](/notcurses_init/3.md)**. **nc** must not be used following the call, and all references to ncplanes, cells, etc. are invalidated.

Once the terminal has been reset, a summary of runtime and performance is printed, unless **NCOPTION\_SUPPRESS\_BANNERS** was provided to **[notcurses\_init(3)](/notcurses_init/3.md)**.

The first step taken by **notcurses\_stop** is a call to the internal function **notcurses\_stop\_minimal**. This is the same function called by the fatal signal handlers installed in the absence of **NCOPTION\_NO\_QUIT\_SIGHANDLERS**. This function:

- •

  Disables the Notcurses signal handlers

- •

  Emits the **op** terminfo capability, if supported

- •

  Emits the **sgr0** terminfo capability, if supported

- •

  Emits the **oc** terminfo capability, if supported

- •

  Emits the **rmcup** terminfo capability, if supported (and if **NCOPTION\_NO\_ALTERNATE\_SCREEN** was not provided).

- •

  Emits the **cnorm** terminfo capability, if supported

Respectively, these restore the default colorpair to its original value (**op**), turn off all text attributes (**sgr0**), restore the default palette (**oc**), exit the alternate screen (**rmcup**), and restore the cursor to its default appearance (**cnorm**).

It is legal to pass **NULL** to **notcurses\_stop**. This is a no-op.

## NOTES

Behavior is undefined if other threads are working with **nc** when or after this function is called. It is unlikely to be good.

## RETURN VALUES

On success, 0 is returned. Otherwise, a negative value is returned.

## SEE ALSO

**[notcurses(3)](/notcurses/3.md)**, **[notcurses\_init(3)](/notcurses_init/3.md)**, **[terminfo(5)](/terminfo/5.md)**

## AUTHORS

nick black ⟨nickblack@linux.com⟩\\c.
