---
name: "radcli_ctx_set_opt_str"
section: "3"
platform: "linux"
package: "radcli"
version: "2.0.1-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/radcli_ctx_set_opt_str"
---

# radcli\_ctx\_set\_opt\_str(3)

Set a string-typed configuration option.

## NAME

radcli\_ctx\_set\_opt\_str - Set a string-typed configuration option.

## SYNOPSIS

```
#include <radcli/>

int radcli_ctx_set_opt_str(
    radcli_ctx   *ctx,
    radcli_opt_id opt,
    const char   *val
);
```

## DESCRIPTION

Stores val for opt on ctx, validating it against opt's own grammar (e.g. #RADCLI\_OPT\_AUTHSERVER accepts the "host\[:port\[:secret\]\]" form a config file's authserver line does). Valid for any radcli\_opt\_id whose RC\_OPTION\_TABLE type is RADCLI\_OPT\_TYPE\_STR or RADCLI\_OPT\_TYPE\_SRV; use radcli\_ctx\_set\_opt\_int() for an RADCLI\_OPT\_TYPE\_INT option instead.

## PARAMETERS

- **ctx**

  a context from radcli\_ctx\_new() or radcli\_ctx\_read\_config().

- **opt**

  the option to set.

- **val**

  the value; for #RADCLI\_OPT\_AUTHSERVER/#RADCLI\_OPT\_ACCTSERVER, the shared secret is better set with radcli\_ctx\_set\_secret() than embedded in this string.

## RETURN VALUE

0 on success, -1 on failure (NULL ctx, opt out of range, wrong type for opt, or an invalid val for opt's grammar).

## SEE ALSO

[*radcli\_ctx\_apply*(3)](/radcli_ctx_apply/3.md), [*radcli\_ctx\_free*(3)](/radcli_ctx_free/3.md), [*radcli\_ctx\_get\_opt\_int*(3)](/radcli_ctx_get_opt_int/3.md), [*radcli\_ctx\_get\_opt\_str*(3)](/radcli_ctx_get_opt_str/3.md), [*radcli\_ctx\_new*(3)](/radcli_ctx_new/3.md), [*radcli\_ctx\_read\_config*(3)](/radcli_ctx_read_config/3.md), [*radcli\_ctx\_read\_dictionary*(3)](/radcli_ctx_read_dictionary/3.md), [*radcli\_ctx\_read\_dictionary\_from\_buffer*(3)](/radcli_ctx_read_dictionary_from_buffer/3.md), [*radcli\_ctx\_set\_opt\_int*(3)](/radcli_ctx_set_opt_int/3.md), [*radcli\_ctx\_set\_secret*(3)](/radcli_ctx_set_secret/3.md), [*radcli\_ctx\_set\_tls\_psk*(3)](/radcli_ctx_set_tls_psk/3.md)
