Commit 4a57dfec authored by Kir Kolyshkin's avatar Kir Kolyshkin Committed by Andrei Vagin

compel plugins: add optional plugins

As we have more than 1 working plugin right now, let's implement
the TODO item for "compel plugins" command.
Signed-off-by: 's avatarKir Kolyshkin <kir@openvz.org>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent 98204deb
...@@ -125,7 +125,8 @@ static int usage(int rc) { ...@@ -125,7 +125,8 @@ static int usage(int rc) {
fprintf(out, fprintf(out,
"Usage:\n" "Usage:\n"
" compel [--compat] includes | cflags | ldflags | plugins\n" " compel [--compat] includes | cflags | ldflags\n"
" compel plugins [PLUGIN_NAME ...]\n"
" compel [--compat] [--static] libs\n" " compel [--compat] [--static] libs\n"
" compel -f FILE -o FILE [-p NAME] [-l N] hgen\n" " compel -f FILE -o FILE [-p NAME] [-l N] hgen\n"
" -f, --file FILE input (parasite object) file name\n" " -f, --file FILE input (parasite object) file name\n"
...@@ -188,18 +189,27 @@ static void print_ldflags(bool compat) ...@@ -188,18 +189,27 @@ static void print_ldflags(bool compat)
} }
} }
static void print_plugins(const char *list[]) static void print_plugin(const char *name)
{ {
const char suffix[] = ".lib.a"; const char suffix[] = ".lib.a";
while (*list != NULL) { if (uninst_root)
if (uninst_root) printf("%s/plugins/%s%s\n",
printf("%s/plugins/%s%s\n", uninst_root, name, suffix);
uninst_root, *list, suffix); else
else printf("%s/compel/%s%s\n", LIBEXECDIR, name, suffix);
printf("%s/compel/%s%s\n", LIBEXECDIR, *list, suffix); }
list++;
} static void print_plugins(char *const list[])
{
char *builtin_list[] = { "std", NULL };
char **p = builtin_list;
while (*p != NULL)
print_plugin(*p++);
while (*list != NULL)
print_plugin(*list++);
} }
static int print_libs(bool is_static) static int print_libs(bool is_static)
...@@ -294,7 +304,6 @@ int main(int argc, char *argv[]) ...@@ -294,7 +304,6 @@ int main(int argc, char *argv[])
bool is_static = false; bool is_static = false;
int opt, idx; int opt, idx;
char *action; char *action;
const char *plugins_list[] = { "std", NULL };
static const char short_opts[] = "csf:o:p:hVl:"; static const char short_opts[] = "csf:o:p:hVl:";
static struct option long_opts[] = { static struct option long_opts[] = {
...@@ -372,9 +381,7 @@ int main(int argc, char *argv[]) ...@@ -372,9 +381,7 @@ int main(int argc, char *argv[])
} }
if (!strcmp(action, "plugins")) { if (!strcmp(action, "plugins")) {
/* TODO: add option to specify additional plugins print_plugins(argv + optind);
* if/when we'll have any */
print_plugins(plugins_list);
return 0; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment