#include "vat.h"
#include "plugin.h"
#include <signal.h>
+#include <limits.h>
vat_main_t vat_main;
/* ignore SIGPIPE, SIGCHLD */
case SIGPIPE:
case SIGCHLD:
+ case SIGWINCH:
sa.sa_sigaction = (void *) SIG_IGN;
break;
}
}
+static void
+vat_find_plugin_path ()
+{
+ char *p, path[PATH_MAX];
+ int rv;
+ u8 *s;
+
+ /* find executable path */
+ if ((rv = readlink ("/proc/self/exe", path, PATH_MAX - 1)) == -1)
+ return;
+
+ /* readlink doesn't provide null termination */
+ path[rv] = 0;
+
+ /* strip filename */
+ if ((p = strrchr (path, '/')) == 0)
+ return;
+ *p = 0;
+
+ /* strip bin/ */
+ if ((p = strrchr (path, '/')) == 0)
+ return;
+ *p = 0;
+
+ s = format (0, "%s/lib/" CLIB_TARGET_TRIPLET "/vpp_api_test_plugins:"
+ "%s/lib/vpp_api_test_plugins", path, path);
+ vec_add1 (s, 0);
+ vat_plugin_path = (char *) s;
+}
+
int
main (int argc, char **argv)
{
vec_validate (vam->cmd_reply, 0);
vec_reset_length (vam->cmd_reply);
+ vat_find_plugin_path ();
+
unformat_init_command_line (a, argv);
while (unformat_check_input (a) != UNFORMAT_END_OF_INPUT)