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