openrc/man/rc_config.3

60 lines
1.7 KiB
Groff
Raw Normal View History

.\" 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
2007-12-25 03:33:27 +05:30
.\"
.\" 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.
2007-12-25 03:33:27 +05:30
.\"
.Dd Mar 17, 2008
2007-12-25 03:33:27 +05:30
.Dt RC_CONFIG 3 SMM
.Os OpenRC
.Sh NAME
.Nm rc_config_list , rc_config_load , rc_config_value , rc_yesno
2007-12-25 03:33:27 +05:30
.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"
2007-12-25 03:33:27 +05:30
.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
2007-12-25 03:33:27 +05:30
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
2008-01-07 18:09:27 +05:30
.Xr malloc 3 ,
.Xr rc_stringlist_free 3 ,
2007-12-25 03:33:27 +05:30
.Xr sh 1
.Sh AUTHORS
2008-12-31 00:38:51 +05:30
.An Roy Marples <roy@marples.name>