2 * Copyright (c) 2015 Cisco and/or its affiliates.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
16 #include <vppinfra/format.h>
18 void vlib_cli_output (void * vm, char * fmt, ...)
19 { clib_warning ("%s", fmt); }
22 * build system finesse hack
23 * since we can't build everything in one build system, this
24 * hack exists to make sure that the invoked program runs against
25 * the right libraries.
28 int main (int argc, char ** argv)
30 void *handle, *main_handle;
31 int (*fp)(int argc, char **argv);
34 /* n1k_harness <plugin-name> <plugin args> */
37 fformat (stderr, "usage: %s <plugin-name> [<plugin-args>...]\n",
42 handle = dlopen (argv[1], RTLD_LAZY);
45 * Note: this can happen if the plugin has an undefined symbol reference,
46 * so print a warning. Otherwise, the poor slob won't know what happened.
47 * Ask me how I know that...
51 clib_warning ("%s", dlerror());
55 main_handle = dlsym (handle, "plugin_main");
56 if (main_handle == 0) {
57 clib_warning ("plugin_main(int argc, char **argv) missing...\n");
63 rv = (*fp)(argc-2, argv+2);