From 8fb99b99f7915dcc9a48b818940ba56b202287da Mon Sep 17 00:00:00 2001 From: Simon McVittie <smcv@collabora.com> Date: Fri, 26 Jul 2019 13:27:06 +0100 Subject: [PATCH] inspect-library: Treat "-" as meaning stdin To test: echo "foo@Base" | ./_build/helpers/x86_64-linux-gnu-inspect-library libz.so.1 - This isn't used for anything yet, but when we give it more integration into the library, we might want to use a pipe to supply the list of symbols. For instance, if we use deb-symbols(5) symbols lists (which describe one or more shared libraries, each with their symbols) to describe the Steam Runtime, then we'll want something like this pseudocode: while lines remain: SONAME = next line until first whitespace run helper with pipes on stdin and stdout while next line starts with one of ('|', '*', ' '): if next line starts with ' ': symbol@version = rest of line until first whitespace write symbol@version to pipe else: ignore '* Field: value' or '| alternative dependency' close pipe to helper's stdin collect results from stdout collect exit status add SrtLibrary to list of libraries Signed-off-by: Simon McVittie <smcv@collabora.com> --- helpers/inspect-library.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/helpers/inspect-library.c b/helpers/inspect-library.c index 9a749b3a0..3c625cd62 100644 --- a/helpers/inspect-library.c +++ b/helpers/inspect-library.c @@ -125,7 +125,11 @@ main (int argc, if (argc == 3) { - fp = fopen(argv[2], "r"); + if (strcmp(argv[2], "-") == 0) + fp = stdin; + else + fp = fopen(argv[2], "r"); + if (fp == NULL) { int saved_errno = errno; -- GitLab