# format_add_cb

- **Language:** C
- **Kind:** function
- **Source:** https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/format.c#L3969
- **Page:** https://libtmux.org/en/tmux/latest/reference/c-function-format_add_cb/

```c
void format_add_cb(struct format_tree *ft, const char *key, format_cb cb)
```

## Parameters

- `ft` (`struct format_tree *`)
- `key` (`const char *`)
- `cb` (`format_cb`)

## Called by

- [`window_copy_formats`](/en/tmux/latest/reference/c-function-window-copy-c-window_copy_formats/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/window-copy.c#L1031)

## Calls

- [`xmalloc`](/en/tmux/latest/reference/c-function-xmalloc/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/format.c#L3974)
- [`xstrdup`](/en/tmux/latest/reference/c-function-xstrdup/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/format.c#L3975)

## Referenced declarations

- [`format_entry.cb`](/en/tmux/latest/reference/c-struct-format_entry-cb/) (attribute)
- [`format_cb`](/en/tmux/latest/reference/c-typedef-format_cb/) (typealias)
- [`format_tree`](/en/tmux/latest/reference/c-struct-format_tree/) (struct)
- [`format_entry.key`](/en/tmux/latest/reference/c-struct-format_entry-key/) (attribute)
- [`format_entry.time`](/en/tmux/latest/reference/c-struct-format_entry-time/) (attribute)
- [`format_tree.tree`](/en/tmux/latest/reference/c-struct-format_tree-tree/) (attribute)
- [`format_entry.value`](/en/tmux/latest/reference/c-struct-format_entry-value/) (attribute)
