commandhelper: Factor out printArguments

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Tim Wiederhake 2021-02-01 12:27:52 +01:00 committed by Peter Krempa
parent d23bc5506e
commit 99ceaffd15

View File

@ -80,6 +80,15 @@ static struct Arguments *parseArguments(int argc, char** argv)
return NULL; return NULL;
} }
static void printArguments(FILE *log, int argc, char** argv)
{
size_t i;
for (i = 1; i < argc; i++) {
fprintf(log, "ARG:%s\n", argv[i]);
}
}
static int envsort(const void *a, const void *b) static int envsort(const void *a, const void *b)
{ {
const char *astr = *(const char**)a; const char *astr = *(const char**)a;
@ -115,9 +124,7 @@ int main(int argc, char **argv) {
if (!log || !args) if (!log || !args)
goto cleanup; goto cleanup;
for (i = 1; i < argc; i++) { printArguments(log, argc, argv);
fprintf(log, "ARG:%s\n", argv[i]);
}
for (n = 0; environ[n]; n++) { for (n = 0; environ[n]; n++) {
} }