---
name: "bsde_parse_rule_string"
section: "3"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["freebsd"]
url: "https://new.carta.tech/bsde_parse_rule"
---

# bsde\_parse\_rule\_string(3)

parse file system firewall rules

Part of [bsde\_parse\_rule(3)](/bsde_parse_rule/3.md).

## NAME

**bsde\_parse\_rule**, **bsde\_parse\_rule\_string** – parse file system firewall rules

## LIBRARY

library “libugidfw”

## SYNOPSIS

**#include \<ugidfw.h\>**

*int*\

**bsde\_parse\_rule**(*int argc*, *char \*argv\[\]*, *struct mac\_bsdextended\_rule \*rule*, *size\_t buflen*, *char \*errstr*);

*int*\

**bsde\_parse\_rule\_string**(*const char \*string*, *struct mac\_bsdextended\_rule \*rule*, *size\_t buflen*, *char \*errstr*);

## DESCRIPTION

The **bsde\_parse\_rule**() function parses an argument vector (e.g. *argv* as passed to **main**()) into *rule*. If an error occurs, *\*errstr* is filled in with the error string (up to *errlen* characters, including the terminating NUL).

The **bsde\_parse\_rule\_string**() function is identical to **bsde\_parse\_rule**(), except that it parses a single string rather than an array of arguments.

## RETURN VALUES

The **bsde\_parse\_rule\_string**() and **bsde\_parse\_rule**() functions return 0 if successful; otherwise the value -1 is returned and the value of *\*errstr* is filled in as documented in DESCRIPTION.

## SEE ALSO

[bsde\_delete\_rule(3)](/bsde_delete_rule/3.md), [bsde\_get\_rule(3)](/bsde_get_rule/3.md), [bsde\_get\_rule\_count(3)](/bsde_get_rule_count/3.md), [bsde\_get\_rule\_slots(3)](/bsde_get_rule_slots/3.md), [bsde\_rule\_to\_string(3)](/bsde_rule_to_string/3.md), [bsde\_set\_rule(3)](/bsde_set_rule/3.md), [libugidfw(3)](/libugidfw/3.md), [mac\_bsdextended(4)](/mac_bsdextended/4.md), [ugidfw(8)](/ugidfw/8.md)

## AUTHORS

This software was contributed to the FreeBSD Project by Network Associates Labs, the Security Research Division of Network Associates Inc. under DARPA/SPAWAR contract N66001-01-C-8035 (“CBOSS”), as part of the DARPA CHATS research program.
