Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 373219 | Differences between
and this patch

Collapse All | Expand All

(-)a/init.d/Makefile (-1 / +1 lines)
Lines 1-7 Link Here
1
DIR=	${INITDIR}
1
DIR=	${INITDIR}
2
SRCS=	bootmisc.in fsck.in hostname.in local.in localmount.in netmount.in \
2
SRCS=	bootmisc.in fsck.in hostname.in local.in localmount.in netmount.in \
3
	network.in root.in savecache.in staticroute.in swap.in swclock.in \
3
	network.in root.in savecache.in staticroute.in swap.in swclock.in \
4
	sysctl.in urandom.in
4
	sysctl.in urandom.in functions.sh.in
5
BIN=	${OBJS}
5
BIN=	${OBJS}
6
6
7
# Build our old net foo or not
7
# Build our old net foo or not
(-)a/init.d/functions.sh.in (+6 lines)
Line 0 Link Here
1
#!/bin/sh
2
3
. "@LIBEXECDIR@/sh/functions.sh"
4
5
ewarn "Warning: using @SYSCONFDIR@/init.d/functions.sh has been deprecated and"
6
ewarn "will be removed in the future. Please use @LIBEXECDIR@/sh/functions.sh instead!"
(-)a/man/Makefile (+2 lines)
Lines 1-3 Link Here
1
SRCS=einfo.3.in rc_runlevel.3.in
1
MAN3=		einfo.3 \
2
MAN3=		einfo.3 \
2
		rc_config.3 rc_deptree.3 rc_find_pids.3 rc_plugin_hook.3 \
3
		rc_config.3 rc_deptree.3 rc_find_pids.3 rc_plugin_hook.3 \
3
		rc_runlevel.3 rc_service.3 rc_stringlist.3
4
		rc_runlevel.3 rc_service.3 rc_stringlist.3
Lines 18-23 MAKE_LINKS= suffix=$${man\#*.}; \ Link Here
18
19
19
MK=		../mk
20
MK=		../mk
20
include ${MK}/sys.mk
21
include ${MK}/sys.mk
22
include ${MK}/scripts.mk
21
include ${MK}/gitignore.mk
23
include ${MK}/gitignore.mk
22
24
23
all:
25
all:
(-)a/man/einfo.3 (-205 lines)
Lines 1-205 Link Here
1
.\" Copyright (c) 2007-2008 Roy Marples
2
.\" All rights reserved
3
.\"
4
.\" Redistribution and use in source and binary forms, with or without
5
.\" modification, are permitted provided that the following conditions
6
.\" are met:
7
.\" 1. Redistributions of source code must retain the above copyright
8
.\"    notice, this list of conditions and the following disclaimer.
9
.\" 2. Redistributions in binary form must reproduce the above copyright
10
.\"    notice, this list of conditions and the following disclaimer in the
11
.\"    documentation and/or other materials provided with the distribution.
12
.\"
13
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23
.\" SUCH DAMAGE.
24
.\"
25
.Dd Mar 16, 2008
26
.Dt EINFO 3 SMM
27
.Os OpenRC
28
.Sh NAME
29
.Nm einfo , ewarn , eerror , ebegin ,
30
.Nm einfon , ewarnn , eerrorn , ebeginn ,
31
.Nm einfov , ewarnv , ebeginv ,
32
.Nm einfovn , ewarnvn , ebeginvn ,
33
.Nm ewarnx , eerrorx ,
34
.Nm eend , ewend ,
35
.Nm eendv , ewendv ,
36
.Nm ebracket ,
37
.Nm eindent , eoutdent ,
38
.Nm eindentv , eoutdentv ,
39
.Nm eprefix
40
.Nd colorful informational output
41
.Sh LIBRARY
42
Enhanced Information output library (libeinfo, -leinfo)
43
.Sh SYNOPSIS
44
.In einfo.h
45
.Ft int Fn einfo "const char * restrict format" ...
46
.Ft int Fn ewarn "const char * restrict format" ...
47
.Ft int Fn eerror "const char * restrict format" ...
48
.Ft int Fn ebegin "const char * restrict format" ...
49
.Ft int Fn einfon "const char * restrict format" ...
50
.Ft int Fn ewarnn "const char * restrict format" ...
51
.Ft int Fn eerrorn "const char * restrict format" ...
52
.Ft int Fn ebeginn "const char * restrict format" ...
53
.Ft int Fn einfov "const char * restrict format" ...
54
.Ft int Fn ewarnv "const char * restrict format" ...
55
.Ft int Fn ebeginv "const char * restrict format" ...
56
.Ft int Fn einfovn "const char * restrict format" ...
57
.Ft int Fn ewarnvn "const char * restrict format" ...
58
.Ft int Fn ebeginvn "const char * restrict format" ...
59
.Ft int Fn ewarnx "const char * restrict format" ...
60
.Ft int Fn eerrorx "const char * restrict format" ...
61
.Ft int Fn eend "int retval" "const char * restrict format" ...
62
.Ft int Fn ewend "int retval" "const char * restrict format" ...
63
.Ft int Fn eendv "int retval" "const char * restrict format" ...
64
.Ft int Fn ewendv "int retval" "const char * restrict format" ...
65
.Ft void Fn ebracket "int col" "ECOLOR color" "const char * restrict msg"
66
.Ft void Fn eindent void
67
.Ft void Fn eoutdent void
68
.Ft void Fn eindentv void
69
.Ft void Fn eoutdentv void
70
.Ft void Fn eprefix "const char * prefix"
71
.Sh DESCRIPTION
72
The
73
.Fn einfo
74
family of functions provide a simple informational output that is colorised.
75
Basically
76
.Fn einfo ,
77
.Fn ewarn
78
and
79
.Fn eerror
80
behave exactly like
81
.Fn printf
82
but prefix the output with a colored *. The function called denotes the color
83
used with
84
.Fn einfo
85
being green,
86
.Fn ewarn
87
being yellow and
88
.Fn eerror
89
being red.
90
einfo goes to stdout and the others go to stderr.
91
The number of real characters printed is returned.
92
.Fn ebegin
93
is identical to
94
.Fn einfo
95
except that 3 dots are appended to the output.
96
.Pp
97
.Fn einfov ,
98
.Fn ewarnv
99
and
100
.Fn ebeginv
101
work the same way to
102
.Fn einfo ,
103
.Fn ewarn ,
104
and
105
.Fn ebegin
106
respectively, but only work when
107
.Va EINFO_VERBOSE
108
is true. You can also make the
109
.Fn einfo ,
110
.Fn ewarn ,
111
and
112
.Fn ebegin
113
functions silent by setting
114
.Va EINFO_QUIET
115
to true.
116
.Pp
117
These functions are designed to output a whole line, so they also
118
append a newline to the string. To stop this behaviour, you can use the
119
functions
120
.Fn einfon , 
121
.Fn ewarnn ,
122
.Fn eerrorn ,
123
.Fn einfovn ,
124
.Fn ewarnvn ,
125
and
126
.Fn ebeginvn .
127
.Pp
128
.Fn eend ,
129
.Fn ewend ,
130
.Fn eendv
131
and
132
.Fn ewendv
133
are the counterparts to the above functions. If
134
.Fa retval
135
is zero then ok in green is printed in a bracket at the end of the prior
136
line. Otherwise we print the formatted string using
137
.Fn error
138
(or
139
.Fn ewarn
140
if
141
.Fn ewend
142
is called) !! in red (or yellow if
143
.Fn ewend
144
is called) is printed in a bracket at the end of the line.
145
The value of
146
.Fa retval
147
is returned.
148
.Pp
149
.Fn ebracket
150
does the same as
151
.Fn eend
152
but prints
153
.Fa msg
154
instead of ok or !! in the color 
155
.Fa color
156
at the column
157
.Fa col .
158
.Pp
159
.Fn eindent
160
indents subsequent calls to the above functions by 3 characters.
161
.Fn eoutdent
162
removes an
163
.Fn eindent .
164
.Fn eindentv
165
and
166
.Fn eoutdentv
167
only work when
168
.Va EINFO_VERBOSE
169
is true.
170
.Pp
171
.Fn eprefix
172
prefixes the string
173
.Fa prefix
174
to the above functions.
175
.Sh IMPLEMENTATION NOTES
176
einfo can optionally be linked against the
177
.Lb libtermcap
178
so that we can correctly query the connected console for our color and
179
cursor escape codes.
180
If not, then we have a hard coded list of terminals we know about that support
181
the commonly used codes for color and cursor position.
182
.Sh ENVIRONMENT
183
.Va EINFO_QUIET
184
when set to true makes the
185
.Fn einfo
186
and
187
.Fn einfon
188
family of functions quiet, so nothing is printed.
189
.Pp
190
.Va EINFO_VERBOSE
191
when set to true makes the
192
.Fn einfov
193
and
194
.Fn einfovn
195
family of functions work, so they do print.
196
.Sh FILES
197
.Pa /etc/init.d/functions.sh
198
is provided by OpenRC, which allows shell scripts to use the above functions.
199
For historical reasons our verbose functions are prefixed with v instead of
200
suffixed. So einfov becomes veinfo, einfovn becomes veinfon.
201
Rinse and repeat for the other verbose functions.
202
.Sh SEE ALSO
203
.Xr printf 3 ,
204
.Sh AUTHORS
205
.An Roy Marples <roy@marples.name>
(-)a/man/einfo.3.in (+205 lines)
Line 0 Link Here
1
.\" Copyright (c) 2007-2008 Roy Marples
2
.\" All rights reserved
3
.\"
4
.\" Redistribution and use in source and binary forms, with or without
5
.\" modification, are permitted provided that the following conditions
6
.\" are met:
7
.\" 1. Redistributions of source code must retain the above copyright
8
.\"    notice, this list of conditions and the following disclaimer.
9
.\" 2. Redistributions in binary form must reproduce the above copyright
10
.\"    notice, this list of conditions and the following disclaimer in the
11
.\"    documentation and/or other materials provided with the distribution.
12
.\"
13
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23
.\" SUCH DAMAGE.
24
.\"
25
.Dd Mar 16, 2008
26
.Dt EINFO 3 SMM
27
.Os OpenRC
28
.Sh NAME
29
.Nm einfo , ewarn , eerror , ebegin ,
30
.Nm einfon , ewarnn , eerrorn , ebeginn ,
31
.Nm einfov , ewarnv , ebeginv ,
32
.Nm einfovn , ewarnvn , ebeginvn ,
33
.Nm ewarnx , eerrorx ,
34
.Nm eend , ewend ,
35
.Nm eendv , ewendv ,
36
.Nm ebracket ,
37
.Nm eindent , eoutdent ,
38
.Nm eindentv , eoutdentv ,
39
.Nm eprefix
40
.Nd colorful informational output
41
.Sh LIBRARY
42
Enhanced Information output library (libeinfo, -leinfo)
43
.Sh SYNOPSIS
44
.In einfo.h
45
.Ft int Fn einfo "const char * restrict format" ...
46
.Ft int Fn ewarn "const char * restrict format" ...
47
.Ft int Fn eerror "const char * restrict format" ...
48
.Ft int Fn ebegin "const char * restrict format" ...
49
.Ft int Fn einfon "const char * restrict format" ...
50
.Ft int Fn ewarnn "const char * restrict format" ...
51
.Ft int Fn eerrorn "const char * restrict format" ...
52
.Ft int Fn ebeginn "const char * restrict format" ...
53
.Ft int Fn einfov "const char * restrict format" ...
54
.Ft int Fn ewarnv "const char * restrict format" ...
55
.Ft int Fn ebeginv "const char * restrict format" ...
56
.Ft int Fn einfovn "const char * restrict format" ...
57
.Ft int Fn ewarnvn "const char * restrict format" ...
58
.Ft int Fn ebeginvn "const char * restrict format" ...
59
.Ft int Fn ewarnx "const char * restrict format" ...
60
.Ft int Fn eerrorx "const char * restrict format" ...
61
.Ft int Fn eend "int retval" "const char * restrict format" ...
62
.Ft int Fn ewend "int retval" "const char * restrict format" ...
63
.Ft int Fn eendv "int retval" "const char * restrict format" ...
64
.Ft int Fn ewendv "int retval" "const char * restrict format" ...
65
.Ft void Fn ebracket "int col" "ECOLOR color" "const char * restrict msg"
66
.Ft void Fn eindent void
67
.Ft void Fn eoutdent void
68
.Ft void Fn eindentv void
69
.Ft void Fn eoutdentv void
70
.Ft void Fn eprefix "const char * prefix"
71
.Sh DESCRIPTION
72
The
73
.Fn einfo
74
family of functions provide a simple informational output that is colorised.
75
Basically
76
.Fn einfo ,
77
.Fn ewarn
78
and
79
.Fn eerror
80
behave exactly like
81
.Fn printf
82
but prefix the output with a colored *. The function called denotes the color
83
used with
84
.Fn einfo
85
being green,
86
.Fn ewarn
87
being yellow and
88
.Fn eerror
89
being red.
90
einfo goes to stdout and the others go to stderr.
91
The number of real characters printed is returned.
92
.Fn ebegin
93
is identical to
94
.Fn einfo
95
except that 3 dots are appended to the output.
96
.Pp
97
.Fn einfov ,
98
.Fn ewarnv
99
and
100
.Fn ebeginv
101
work the same way to
102
.Fn einfo ,
103
.Fn ewarn ,
104
and
105
.Fn ebegin
106
respectively, but only work when
107
.Va EINFO_VERBOSE
108
is true. You can also make the
109
.Fn einfo ,
110
.Fn ewarn ,
111
and
112
.Fn ebegin
113
functions silent by setting
114
.Va EINFO_QUIET
115
to true.
116
.Pp
117
These functions are designed to output a whole line, so they also
118
append a newline to the string. To stop this behaviour, you can use the
119
functions
120
.Fn einfon , 
121
.Fn ewarnn ,
122
.Fn eerrorn ,
123
.Fn einfovn ,
124
.Fn ewarnvn ,
125
and
126
.Fn ebeginvn .
127
.Pp
128
.Fn eend ,
129
.Fn ewend ,
130
.Fn eendv
131
and
132
.Fn ewendv
133
are the counterparts to the above functions. If
134
.Fa retval
135
is zero then ok in green is printed in a bracket at the end of the prior
136
line. Otherwise we print the formatted string using
137
.Fn error
138
(or
139
.Fn ewarn
140
if
141
.Fn ewend
142
is called) !! in red (or yellow if
143
.Fn ewend
144
is called) is printed in a bracket at the end of the line.
145
The value of
146
.Fa retval
147
is returned.
148
.Pp
149
.Fn ebracket
150
does the same as
151
.Fn eend
152
but prints
153
.Fa msg
154
instead of ok or !! in the color 
155
.Fa color
156
at the column
157
.Fa col .
158
.Pp
159
.Fn eindent
160
indents subsequent calls to the above functions by 3 characters.
161
.Fn eoutdent
162
removes an
163
.Fn eindent .
164
.Fn eindentv
165
and
166
.Fn eoutdentv
167
only work when
168
.Va EINFO_VERBOSE
169
is true.
170
.Pp
171
.Fn eprefix
172
prefixes the string
173
.Fa prefix
174
to the above functions.
175
.Sh IMPLEMENTATION NOTES
176
einfo can optionally be linked against the
177
.Lb libtermcap
178
so that we can correctly query the connected console for our color and
179
cursor escape codes.
180
If not, then we have a hard coded list of terminals we know about that support
181
the commonly used codes for color and cursor position.
182
.Sh ENVIRONMENT
183
.Va EINFO_QUIET
184
when set to true makes the
185
.Fn einfo
186
and
187
.Fn einfon
188
family of functions quiet, so nothing is printed.
189
.Pp
190
.Va EINFO_VERBOSE
191
when set to true makes the
192
.Fn einfov
193
and
194
.Fn einfovn
195
family of functions work, so they do print.
196
.Sh FILES
197
.Pa @LIBEXECDIR@/sh/functions.sh
198
is provided by OpenRC, which allows shell scripts to use the above functions.
199
For historical reasons our verbose functions are prefixed with v instead of
200
suffixed. So einfov becomes veinfo, einfovn becomes veinfon.
201
Rinse and repeat for the other verbose functions.
202
.Sh SEE ALSO
203
.Xr printf 3 ,
204
.Sh AUTHORS
205
.An Roy Marples <roy@marples.name>
(-)a/man/rc_runlevel.3 (-66 lines)
Lines 1-66 Link Here
1
.\" Copyright (c) 2007-2008 Roy Marples
2
.\" All rights reserved
3
.\"
4
.\" Redistribution and use in source and binary forms, with or without
5
.\" modification, are permitted provided that the following conditions
6
.\" are met:
7
.\" 1. Redistributions of source code must retain the above copyright
8
.\"    notice, this list of conditions and the following disclaimer.
9
.\" 2. Redistributions in binary form must reproduce the above copyright
10
.\"    notice, this list of conditions and the following disclaimer in the
11
.\"    documentation and/or other materials provided with the distribution.
12
.\"
13
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23
.\" SUCH DAMAGE.
24
.\"
25
.Dd Mar 16, 2008
26
.Dt RC_RUNLEVEL 3 SMM
27
.Os OpenRC
28
.Sh NAME
29
.Nm rc_runlevel_get , rc_runlevel_exists , rc_runlevel_list , rc_runlevel_set ,
30
.Nm rc_runlevel_starting , rc_runlevel_stopping
31
.Nd RC runlevel functions
32
.Sh LIBRARY
33
Run Command library (librc, -lrc)
34
.Sh SYNOPSIS
35
.In rc.h 
36
.Ft "char *" Fn rc_runlevel_get void
37
.Ft bool Fn rc_runlevel_exists
38
.Ft "RC_STRINGLIST *" Fn rc_runlevel_list void
39
.Ft bool Fn rc_runlevel_set "const char *runlevel"
40
.Ft bool Fn rc_runlevel_starting void
41
.Ft bool Fn rc_runlevel_stopping void
42
.Sh DESCRIPTION
43
These functions provide a means of querying OpenRC to find out which runlevel
44
we are in and what services are in which runlevel.
45
.Sh IMPLEMENTATION NOTES
46
Each function that returns
47
.Fr "char *"
48
returns a malloced NULL terminated string that should be freed when done.
49
.Pp
50
Each function that returns
51
.Fr "RC_STRINGLIST *"
52
should by freed by calling
53
.Fn rc_stringlist_free
54
when done.
55
.Sh FILES
56
.Pa /etc/init.d/functions.sh
57
is provided by OpenRC, which allows shell scripts to use the above functions.
58
For historical reasons our verbose functions are prefixed with v instead of
59
suffixed. So einfov becomes veinfo, einfovn becomes veinfon.
60
Rinse and repeat for the other verbose functions.
61
.Sh SEE ALSO
62
.Xr malloc 3 ,
63
.Xr free 3
64
.Xr rc_stringlist_free 3
65
.Sh AUTHORS
66
.An Roy Marples <roy@marples.name>
(-)a/man/rc_runlevel.3.in (+66 lines)
Line 0 Link Here
1
.\" Copyright (c) 2007-2008 Roy Marples
2
.\" All rights reserved
3
.\"
4
.\" Redistribution and use in source and binary forms, with or without
5
.\" modification, are permitted provided that the following conditions
6
.\" are met:
7
.\" 1. Redistributions of source code must retain the above copyright
8
.\"    notice, this list of conditions and the following disclaimer.
9
.\" 2. Redistributions in binary form must reproduce the above copyright
10
.\"    notice, this list of conditions and the following disclaimer in the
11
.\"    documentation and/or other materials provided with the distribution.
12
.\"
13
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23
.\" SUCH DAMAGE.
24
.\"
25
.Dd Mar 16, 2008
26
.Dt RC_RUNLEVEL 3 SMM
27
.Os OpenRC
28
.Sh NAME
29
.Nm rc_runlevel_get , rc_runlevel_exists , rc_runlevel_list , rc_runlevel_set ,
30
.Nm rc_runlevel_starting , rc_runlevel_stopping
31
.Nd RC runlevel functions
32
.Sh LIBRARY
33
Run Command library (librc, -lrc)
34
.Sh SYNOPSIS
35
.In rc.h 
36
.Ft "char *" Fn rc_runlevel_get void
37
.Ft bool Fn rc_runlevel_exists
38
.Ft "RC_STRINGLIST *" Fn rc_runlevel_list void
39
.Ft bool Fn rc_runlevel_set "const char *runlevel"
40
.Ft bool Fn rc_runlevel_starting void
41
.Ft bool Fn rc_runlevel_stopping void
42
.Sh DESCRIPTION
43
These functions provide a means of querying OpenRC to find out which runlevel
44
we are in and what services are in which runlevel.
45
.Sh IMPLEMENTATION NOTES
46
Each function that returns
47
.Fr "char *"
48
returns a malloced NULL terminated string that should be freed when done.
49
.Pp
50
Each function that returns
51
.Fr "RC_STRINGLIST *"
52
should by freed by calling
53
.Fn rc_stringlist_free
54
when done.
55
.Sh FILES
56
.Pa @LIBEXECDIR@/sh/functions.sh
57
is provided by OpenRC, which allows shell scripts to use the above functions.
58
For historical reasons our verbose functions are prefixed with v instead of
59
suffixed. So einfov becomes veinfo, einfovn becomes veinfon.
60
Rinse and repeat for the other verbose functions.
61
.Sh SEE ALSO
62
.Xr malloc 3 ,
63
.Xr free 3
64
.Xr rc_stringlist_free 3
65
.Sh AUTHORS
66
.An Roy Marples <roy@marples.name>
(-)a/sh/Makefile (-3 lines)
Lines 12-20 include Makefile.${OS} Link Here
12
include ${MK}/scripts.mk
12
include ${MK}/scripts.mk
13
13
14
_installafter:
14
_installafter:
15
	${INSTALL} -d ${DESTDIR}/${INITDIR}
16
	@# Put functions.sh into init for backwards compat
17
	ln -snf ${LIBEXECDIR}/sh/functions.sh ${DESTDIR}/${INITDIR} || exit $$?
18
15
19
check test::
16
check test::
20
	./runtests.sh
17
	./runtests.sh
(-)a/sh/gendepends.sh.in (-1 / +1 lines)
Lines 4-10 Link Here
4
# Copyright (c) 2007-2009 Roy Marples <roy@marples.name>
4
# Copyright (c) 2007-2009 Roy Marples <roy@marples.name>
5
# All rights reserved. Released under the 2-clause BSD license.
5
# All rights reserved. Released under the 2-clause BSD license.
6
6
7
. @SYSCONFDIR@/init.d/functions.sh
7
. @LIBEXECDIR@/sh/functions.sh
8
. @LIBEXECDIR@/sh/rc-functions.sh
8
. @LIBEXECDIR@/sh/rc-functions.sh
9
9
10
config() {
10
config() {
(-)a/sh/runscript.sh.in (-2 / +1 lines)
Lines 28-34 if [ ! -e ${RC_SVCDIR}/softlevel ]; then Link Here
28
	exit 1
28
	exit 1
29
fi
29
fi
30
30
31
sourcex "@SYSCONFDIR@/init.d/functions.sh"
31
sourcex "@LIBEXECDIR@/sh/functions.sh"
32
sourcex "@LIBEXECDIR@/sh/rc-functions.sh"
32
sourcex "@LIBEXECDIR@/sh/rc-functions.sh"
33
33
34
# Support LiveCD foo
34
# Support LiveCD foo
35
- 

Return to bug 373219