diff options
author | Aaro Koskinen <aaro.koskinen@nokia.com> | 2015-09-30 15:57:55 +0300 |
---|---|---|
committer | Aaro Koskinen <aaro.koskinen@nokia.com> | 2015-09-30 15:57:55 +0300 |
commit | c4cd1d4d93e4a45a088edb6517555aa7e06e5f86 (patch) | |
tree | 4529a045943ee56bf1e96a6d2820318f36e5473d /src/basic/fileio.h | |
parent | 5e6ad75f259942c33bbb0b9bfc1e8dd5cc0d96e7 (diff) |
fileio: make get_status_field() more generic
All users of get_status_field() expect the field pattern to occur in
the beginning of a line, and the delimiter is ':'.
Hardcode this into the function, and also skip any whitespace before ':'
to support fields in files like /proc/cpuinfo. Add support for returning
the full field value (currently stops on first whitespace).
Rename the function so it's easier to ensure all callers switch to new
semantics.
Diffstat (limited to 'src/basic/fileio.h')
-rw-r--r-- | src/basic/fileio.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/basic/fileio.h b/src/basic/fileio.h index 2e8148ff24..4998d4d042 100644 --- a/src/basic/fileio.h +++ b/src/basic/fileio.h @@ -48,4 +48,4 @@ int write_env_file(const char *fname, char **l); int executable_is_script(const char *path, char **interpreter); -int get_status_field(const char *filename, const char *pattern, char **field); +int get_proc_field(const char *filename, const char *pattern, const char *terminator, char **field); |