# control_add_sub

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

```c
void control_add_sub(struct client *c, const char *name, enum control_sub_type type, int id, const char *format)
```

## Parameters

- `c` (`struct client *`)
- `name` (`const char *`)
- `type` (`enum control_sub_type`)
- `id` (`int`)
- `format` (`const char *`)

## Called by

- [`cmd_refresh_client_update_subscription`](/en/tmux/latest/reference/c-function-cmd-refresh-client-c-cmd_refresh_client_update_subscription/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-refresh-client.c#L75)

## Calls

- [`control_free_sub`](/en/tmux/latest/reference/c-function-control-c-control_free_sub/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/control.c#L1148)
- [`xcalloc`](/en/tmux/latest/reference/c-function-xcalloc/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/control.c#L1150)
- [`xstrdup`](/en/tmux/latest/reference/c-function-xstrdup/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/control.c#L1151)

## Other function references

- [`control_check_subs_timer`](/en/tmux/latest/reference/c-function-control-c-control_check_subs_timer/) (function)

## Referenced declarations

- [`client`](/en/tmux/latest/reference/c-struct-client/) (struct)
- [`client.control_state`](/en/tmux/latest/reference/c-struct-client-control_state/) (attribute)
- [`control_sub_type`](/en/tmux/latest/reference/c-enum-control_sub_type/) (enum)
- [`control_sub.format`](/en/tmux/latest/reference/c-struct-control_sub-format/) (attribute)
- [`control_sub.id`](/en/tmux/latest/reference/c-struct-control_sub-id/) (attribute)
- [`control_sub.name`](/en/tmux/latest/reference/c-struct-control_sub-name/) (attribute)
- [`control_sub.panes`](/en/tmux/latest/reference/c-struct-control_sub-panes/) (attribute)
- [`control_state.subs`](/en/tmux/latest/reference/c-struct-control_state-subs/) (attribute)
- [`control_state.subs_timer`](/en/tmux/latest/reference/c-struct-control_state-subs_timer/) (attribute)
- [`control_sub.type`](/en/tmux/latest/reference/c-struct-control_sub-type/) (attribute)
- [`control_sub.windows`](/en/tmux/latest/reference/c-struct-control_sub-windows/) (attribute)
