1 |
commit: 722871c0ae15221ffcb11c761533f628ec081a57 |
2 |
Author: William Hubbs <williamh <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Feb 25 21:00:03 2012 +0000 |
4 |
Commit: William Hubbs <williamh <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Feb 25 21:41:31 2012 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=722871c0 |
7 |
|
8 |
librc: make rc_proc_getent available for all operating systems |
9 |
|
10 |
This looks up an option on the kernel command line. For now, it works on |
11 |
linux and returns NULL on the bsds, but we are definitely open to |
12 |
patches for that side. |
13 |
|
14 |
--- |
15 |
src/librc/librc-misc.c | 6 ++++-- |
16 |
src/librc/rc.h.in | 2 -- |
17 |
2 files changed, 4 insertions(+), 4 deletions(-) |
18 |
|
19 |
diff --git a/src/librc/librc-misc.c b/src/librc/librc-misc.c |
20 |
index 6e9fce6..06f97e7 100644 |
21 |
--- a/src/librc/librc-misc.c |
22 |
+++ b/src/librc/librc-misc.c |
23 |
@@ -128,10 +128,10 @@ rc_getline(char **line, size_t *len, FILE *fp) |
24 |
} |
25 |
librc_hidden_def(rc_getline) |
26 |
|
27 |
-#ifdef __linux__ |
28 |
char * |
29 |
rc_proc_getent(const char *ent) |
30 |
{ |
31 |
+#ifdef __linux__ |
32 |
FILE *fp; |
33 |
char *proc, *p, *value = NULL; |
34 |
size_t i, len; |
35 |
@@ -171,9 +171,11 @@ rc_proc_getent(const char *ent) |
36 |
free(proc); |
37 |
|
38 |
return value; |
39 |
+#else |
40 |
+ return NULL; |
41 |
+#endif |
42 |
} |
43 |
librc_hidden_def(rc_proc_getent) |
44 |
-#endif |
45 |
|
46 |
RC_STRINGLIST * |
47 |
rc_config_list(const char *file) |
48 |
|
49 |
diff --git a/src/librc/rc.h.in b/src/librc/rc.h.in |
50 |
index 468990e..eaae25f 100644 |
51 |
--- a/src/librc/rc.h.in |
52 |
+++ b/src/librc/rc.h.in |
53 |
@@ -360,12 +360,10 @@ bool rc_newer_than(const char *, const char *, time_t *, char *); |
54 |
* @return true if source is older than target, otherwise false */ |
55 |
bool rc_older_than(const char *, const char *, time_t *, char *); |
56 |
|
57 |
-#ifdef __linux__ |
58 |
/*! Read variables/values from /proc/cmdline |
59 |
* @param value |
60 |
* @return pointer to the value, otherwise NULL */ |
61 |
char *rc_proc_getent(const char *); |
62 |
-#endif |
63 |
|
64 |
/*! Update the cached dependency tree if it's older than any init script, |
65 |
* its configuration file or an external configuration file the init script |