xref: /freebsd/lib/libbsdconf/bsdconf_format_generic.c (revision 3fe5961a0b708da599d42cbb6b5e4f030c28ea45)
1 /*
2  * Copyright (c) 2013-2026 Devin Teske <dteske@FreeBSD.org>
3  * Copyright (c) 2021-2026 Faraz Vahedi <kfv@FreeBSD.org>
4  *
5  * SPDX-License-Identifier: BSD-2-Clause
6  */
7 
8 #include "bsdconf_formats.h"
9 
10 /*
11  * BSDCONF_FORMAT_GENERIC: `name[=value]' assignments with values quoted
12  * only when required to round-trip (embedded whitespace or a comment
13  * character). The fallback when nothing more specific is known about a
14  * file, and the default base for derived formats. It has a target keyword
15  * so that a sysconf(8)-style consumer can apply it to an arbitrary file
16  * explicitly, but no default path; the caller must always name the file.
17  *
18  * NB: Formats whose statements are a space-separated directive and value
19  * with no equals sign at all (the httpd.conf style the ancestral figpar
20  * engine was raised on) need no descriptor of their own to parse: with
21  * BSDCONF_BREAK_ON_EQUALS omitted, the first whitespace-delimited token is
22  * the directive and the remainder of the line is the raw value, and
23  * directive matching is case insensitive unless BSDCONF_CASE_SENSITIVE is
24  * set.
25  */
26 const struct bsdconf_format_def bsdconf_format_generic_def = {
27 	.keyword	= "generic",
28 	.path		= NULL,		/* no default path */
29 	.sources	= NULL,		/* no source list */
30 	.processing	= BSDCONF_BREAK_ON_EQUALS | BSDCONF_CASE_SENSITIVE,
31 	.put		= 0,
32 };
33