openrc/man/rc_config.3
Mike Frysinger 301161a7a4 use HEAD in git URIs to point to the default branch
This makes the URIs shorter and dynamic: whatever the default branch
the repo uses will be used.
2021-12-20 20:07:00 -05:00

60 lines
1.7 KiB
Groff

.\" Copyright (c) 2007-2015 The OpenRC Authors.
.\" See the Authors file at the top-level directory of this distribution and
.\" https://github.com/OpenRC/openrc/blob/HEAD/AUTHORS
.\"
.\" This file is part of OpenRC. It is subject to the license terms in
.\" the LICENSE file found in the top-level directory of this
.\" distribution and at https://github.com/OpenRC/openrc/blob/HEAD/LICENSE
.\" This file may not be copied, modified, propagated, or distributed
.\" except according to the terms contained in the LICENSE file.
.\"
.Dd Mar 17, 2008
.Dt RC_CONFIG 3 SMM
.Os OpenRC
.Sh NAME
.Nm rc_config_list , rc_config_load , rc_config_value , rc_yesno
.Nd functions to query OpenRC service configurations
.Sh LIBRARY
Run Command library (librc, -lrc)
.Sh SYNOPSIS
.In rc.h
.Ft "RC_STRINGLIST *" Fn rc_config_list "const char *file"
.Ft "RC_STRINGLIST *" Fn rc_config_load "const char *file"
.Ft "char *" Fn rc_config_value "const char *const *list" "const char *entry"
.Ft bool Fn rc_yesno "const char *value"
.Sh DESCRIPTION
These functions provide an easy means of querying OpenRC configuration files.
.Pp
.Fn rc_config_list
returns a list of non comment lines in
.Fa file .
.Fn rc_config_load
does the same, but attempts to parse the line as if it was
a shell assignment.
.Fn rc_config_value
returns the value of
.Fa entry
found in
.Fa list .
.Pp
Each list should be freed using
.Fn rc_stringlist_free
when done.
.Pp
.Fn rc_yesno
returns if
.Fa value
is true, yes, on or 1 regardless of case, otherwise false.
If
.Fa value
is also not false, no, off or 0 regardless of case then
.Va errno
is set to
.Va EINVAL .
.Sh SEE ALSO
.Xr malloc 3 ,
.Xr rc_stringlist_free 3 ,
.Xr sh 1
.Sh AUTHORS
.An Roy Marples <roy@marples.name>