---
name: "cl_hp_unfold_field"
section: "3"
platform: "linux"
package: "libcanlock-dev"
version: "3.3.1-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/cl_hp_unfold_field"
---

# cl\_hp\_unfold\_field(3)

Unfold header field

## NAME

cl\_hp\_unfold\_field - Unfold header field

## SYNOPSIS

```
#include <libcanlock-3/canlock-hp.h>

char *cl_hp_unfold_field(const char *data, size_t *data_len);
```

## DESCRIPTION

The **cl\_hp\_unfold\_field**() function unfolds a header field.

The parameter *data* should point to the beginning of the input data.\
 Specify the length of the input data with the value pointed to by the *data\_len* parameter.

RFC 5322 specifies in Section 2.2 that CR and LF control characters in header field bodies are allowed for folding use only. This function removes all CR and LF control characters from the input data.

## RETURN VALUE

Upon successful completion a pointer to a new memory block, containing the unfolded header field with NUL-termination, is returned. Otherwise, **NULL** is returned.

On success, the caller is responsible to **free**() the memory block allocated for the output data.

On success the value pointed to by *data\_len* is updated to the length of the unfolded header field (without NUL-termination).

## AUTHORS

Michael Baeuerle

## REPORTING BUGS

Report bugs to \<mailto:michael.baeuerle@gmx.net\>.

## STANDARDS

**cl\_hp\_unfold\_field**() tries to comply with the following standards:

RFC 5322

## SEE ALSO

[**free**(3)](/free/3.md), [**cl\_hp\_get\_field**(3)](/cl_hp_get_field/3.md), [**cl\_hp\_parse\_field**(3)](/cl_hp_parse_field/3.md), [**canlock-hfp**(1)](/canlock-hfp/1.md), [**canlock-mhp**(1)](/canlock-mhp/1.md), [**canlock**(1)](/canlock/1.md)
