mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-15 21:05:08 +00:00
Fix lint/igor warnings
This commit is contained in:
parent
19be69c56f
commit
7d57771bcc
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=330879
|
@ -24,7 +24,7 @@
|
||||||
.\"
|
.\"
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd Nov 2, 2015
|
.Dd Mar 13, 2018
|
||||||
.Dt FIGPAR 3
|
.Dt FIGPAR 3
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
|
@ -38,22 +38,30 @@
|
||||||
.In figpar.h
|
.In figpar.h
|
||||||
.Ft int
|
.Ft int
|
||||||
.Fo parse_config
|
.Fo parse_config
|
||||||
.Fa "struct figpar_config options[], const char *path"
|
.Fa "struct figpar_config options[]"
|
||||||
.Fa "int \*[lp]*unknown\*[rp]\*[lp]struct figpar_config *option, uint32_t line"
|
.Fa "const char *path"
|
||||||
.Fa "char *directive, char *value\*[rp], uint8_t processing_options"
|
.Fa "int \*[lp]*unknown\*[rp]\*[lp]struct figpar_config *option"
|
||||||
|
.Fa "uint32_t line"
|
||||||
|
.Fa "char *directive"
|
||||||
|
.Fa "char *value\*[rp]"
|
||||||
|
.Fa "uint8_t processing_options"
|
||||||
.Fc
|
.Fc
|
||||||
.Ft "struct figpar_config *"
|
.Ft "struct figpar_config *"
|
||||||
.Fo get_config_option
|
.Fo get_config_option
|
||||||
.Fa "struct figpar_config options[], const char *directive"
|
.Fa "struct figpar_config options[]"
|
||||||
|
.Fa "const char *directive"
|
||||||
.Fc
|
.Fc
|
||||||
.In string_m.h
|
.In string_m.h
|
||||||
.Ft int
|
.Ft int
|
||||||
.Fo replaceall
|
.Fo replaceall
|
||||||
.Fa "char *source, const char *find, const char *replace"
|
.Fa "char *source"
|
||||||
|
.Fa "const char *find"
|
||||||
|
.Fa "const char *replace"
|
||||||
.Fc
|
.Fc
|
||||||
.Ft unsigned int
|
.Ft unsigned int
|
||||||
.Fo strcount
|
.Fo strcount
|
||||||
.Fa "const char *source, const char *find"
|
.Fa "const char *source"
|
||||||
|
.Fa "const char *find"
|
||||||
.Fc
|
.Fc
|
||||||
.Ft void
|
.Ft void
|
||||||
.Fo strexpand
|
.Fo strexpand
|
||||||
|
@ -70,7 +78,8 @@
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
The
|
The
|
||||||
.Nm
|
.Nm
|
||||||
library provides a light-weight, portable framework for parsing configuration
|
library provides a light-weight,
|
||||||
|
portable framework for parsing configuration
|
||||||
files.
|
files.
|
||||||
The library uses
|
The library uses
|
||||||
.Xr open 2 ,
|
.Xr open 2 ,
|
||||||
|
@ -87,8 +96,9 @@ provides raw data to a set of callback functions.
|
||||||
These callback functions can in-turn initiate abort through their return value,
|
These callback functions can in-turn initiate abort through their return value,
|
||||||
allowing custom syntax validation during parsing.
|
allowing custom syntax validation during parsing.
|
||||||
.Pp
|
.Pp
|
||||||
Configuration directives, types, and callback functions are provided through
|
Configuration directives,
|
||||||
data structures defined in
|
types,
|
||||||
|
and callback functions are provided through data structures defined in
|
||||||
.In figpar.h :
|
.In figpar.h :
|
||||||
.Bd -literal -offset indent
|
.Bd -literal -offset indent
|
||||||
struct figpar_config {
|
struct figpar_config {
|
||||||
|
@ -132,7 +142,7 @@ argument to
|
||||||
.Fn parse_config
|
.Fn parse_config
|
||||||
is a mask of bit fields which indicate various
|
is a mask of bit fields which indicate various
|
||||||
processing options.
|
processing options.
|
||||||
The possible flags are as follows:
|
The possible flags are:
|
||||||
.Bl -tag -width FIGPAR_BREAK_ON_SEMICOLON
|
.Bl -tag -width FIGPAR_BREAK_ON_SEMICOLON
|
||||||
.It Dv FIGPAR_BREAK_ON_EQUALS
|
.It Dv FIGPAR_BREAK_ON_EQUALS
|
||||||
An equals sign
|
An equals sign
|
||||||
|
@ -151,7 +161,8 @@ Normally directives are matched case insensitively using
|
||||||
.Xr fnmatch 3 .
|
.Xr fnmatch 3 .
|
||||||
This flag enables directive matching to be case sensitive.
|
This flag enables directive matching to be case sensitive.
|
||||||
.It Dv FIGPAR_REQUIRE_EQUALS
|
.It Dv FIGPAR_REQUIRE_EQUALS
|
||||||
If a directive is not followed by an equals, processing is aborted.
|
If a directive is not followed by an equals,
|
||||||
|
processing is aborted.
|
||||||
.It Dv FIGPAR_STRICT_EQUALS
|
.It Dv FIGPAR_STRICT_EQUALS
|
||||||
Equals must be part of the directive to be considered a delimiter between
|
Equals must be part of the directive to be considered a delimiter between
|
||||||
directive and value.
|
directive and value.
|
||||||
|
@ -159,7 +170,7 @@ directive and value.
|
||||||
.Pp
|
.Pp
|
||||||
The
|
The
|
||||||
.Fa options
|
.Fa options
|
||||||
struct array pointer can be NULL and every directive will invoke the
|
struct array pointer can be NULL and every directive will run the
|
||||||
.Fn unknown
|
.Fn unknown
|
||||||
function argument.
|
function argument.
|
||||||
.Pp
|
.Pp
|
||||||
|
@ -168,13 +179,16 @@ The directive for each figpar_config item in the
|
||||||
options argument is matched against each parsed directive using
|
options argument is matched against each parsed directive using
|
||||||
.Xr fnmatch 3
|
.Xr fnmatch 3
|
||||||
until a match is found.
|
until a match is found.
|
||||||
If a match is found, the
|
If a match is found,
|
||||||
|
the
|
||||||
.Fn action
|
.Fn action
|
||||||
function for that figpar_config directive is invoked with the line number,
|
function for that figpar_config directive is run with the line number,
|
||||||
directive, and value.
|
directive,
|
||||||
Otherwise if no match, the
|
and value.
|
||||||
|
Otherwise if no match,
|
||||||
|
the
|
||||||
.Fn unknown
|
.Fn unknown
|
||||||
function is invoked
|
function is run
|
||||||
.Pq with the same arguments .
|
.Pq with the same arguments .
|
||||||
.Pp
|
.Pp
|
||||||
If either
|
If either
|
||||||
|
@ -197,19 +211,20 @@ is entirely optional as-is the use of
|
||||||
.Fa "enum figpar_cfgtype"
|
.Fa "enum figpar_cfgtype"
|
||||||
or
|
or
|
||||||
.Fa "union figpar_cfgvalue" .
|
.Fa "union figpar_cfgvalue" .
|
||||||
For example, you could choose to pass a NULL pointer to
|
For example,
|
||||||
|
a NULL pointer can be passed to
|
||||||
.Fn parse_config
|
.Fn parse_config
|
||||||
for the first argument and then provide a simple
|
for the first argument while providing a simple
|
||||||
.Fa unknown
|
.Fa unknown
|
||||||
function based on
|
function based on
|
||||||
.Xr queue 3
|
.Xr queue 3
|
||||||
that populates a singly-linked list of your own struct containing the
|
that populates a singly-linked list of a struct containing the
|
||||||
.Fa directive
|
.Fa directive
|
||||||
and
|
and
|
||||||
.Fa value .
|
.Fa value .
|
||||||
.Pp
|
.Pp
|
||||||
In addition, the following miscellaneous string manipulation routines are
|
In addition,
|
||||||
provided by
|
miscellaneous string manipulation routines are provided by
|
||||||
.In string_m.h :
|
.In string_m.h :
|
||||||
.Bl -tag -width strexpandnl()
|
.Bl -tag -width strexpandnl()
|
||||||
.It Fn replaceall
|
.It Fn replaceall
|
||||||
|
@ -224,8 +239,7 @@ Count the number of occurrences of one string that appear in the
|
||||||
.Fa source
|
.Fa source
|
||||||
string.
|
string.
|
||||||
Return value is the total count.
|
Return value is the total count.
|
||||||
An example use would be if you need to know how large a block of memory needs
|
An example use would be to show how large a block of memory needs to be for a
|
||||||
to be for a
|
|
||||||
.Fn replaceall
|
.Fn replaceall
|
||||||
series.
|
series.
|
||||||
.It Fn strexpand
|
.It Fn strexpand
|
||||||
|
|
Loading…
Reference in a new issue