+
+/*
+ * Try to load a parser plugin with file name matching some of the
+ * following candidates (%s being the requested name):
+ *
+ * "%s_parser.so"
+ * "./%s_parser.so"
+ * "<exec_path>/%s_parser.so"
+ */
+int load_parser_plugin(const char *name)
+{
+ char str[256], parser[] = "_parser.so";
+ int ret;
+
+ strncpy(str, name, sizeof(str));
+ strncat(str, parser, sizeof(str) - 1);
+ ret = load_plugin(str);
+ if (!ret)
+ return 0;
+
+ strncpy(str, "./", sizeof(str));
+ strncat(str, name, sizeof(str) - 1);
+ strncat(str, parser, sizeof(str) - 1);
+ ret = load_plugin(str);
+ if (!ret)
+ return 0;
+
+ if (!exec_path)
+ return 0;
+
+ strncpy(str, exec_path, sizeof(str));
+ strncat(str, "/", sizeof(str) - 1);
+ strncat(str, name, sizeof(str) - 1);
+ strncat(str, parser, sizeof(str) - 1);
+ return load_plugin(str);
+}