]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/basic/fileio.h
fileio: make get_status_field() more generic
authorAaro Koskinen <aaro.koskinen@nokia.com>
Wed, 30 Sep 2015 12:57:55 +0000 (15:57 +0300)
committerAaro Koskinen <aaro.koskinen@nokia.com>
Wed, 30 Sep 2015 12:57:55 +0000 (15:57 +0300)
commitc4cd1d4d93e4a45a088edb6517555aa7e06e5f86
tree4529a045943ee56bf1e96a6d2820318f36e5473d
parent5e6ad75f259942c33bbb0b9bfc1e8dd5cc0d96e7
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.
src/basic/fileio.c
src/basic/fileio.h
src/basic/process-util.c
src/basic/virt.c
src/shared/sleep-config.c
src/test/test-fileio.c