Main of the nasl QA linter.
165 static gboolean debug = FALSE;
166 static gchar *include_dir = NULL;
167 static gchar *nvt_file_list = NULL;
168 static const gchar **nvt_files = NULL;
169 struct arglist *script_infos = g_malloc0 (
sizeof (
struct arglist));
170 GError *error = NULL;
171 GOptionContext *option_context;
172 static GOptionEntry entries[] = {
173 {
"debug",
'd', 0, G_OPTION_ARG_NONE, &debug,
174 "Output debug log messages.", NULL},
175 {
"nvt-list",
'l', 0, G_OPTION_ARG_STRING, &nvt_file_list,
176 "Process files from <file>",
"<file>"},
177 {
"include-dir",
'i', 0, G_OPTION_ARG_STRING, &include_dir,
178 "Search for includes in <dir>",
"<dir>"},
179 {G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &nvt_files,
180 "Absolute path to one or more nasl scripts",
"NASL_FILE..."},
185 g_option_context_new (
"- standalone NASL linter for OpenVAS");
186 g_option_context_add_main_entries (option_context, entries, NULL);
187 if (!g_option_context_parse (option_context, &argc, &argv, &error))
189 g_error (
"%s\n\n", error->message);
191 g_option_context_free (option_context);
193 #if !GLIB_CHECK_VERSION(2, 35, 0) 206 if (include_dir != NULL)
210 g_log_set_handler (NULL,
213 GINT_TO_POINTER (G_LOG_LEVEL_DEBUG|G_LOG_LEVEL_INFO|
216 G_LOG_LEVEL_CRITICAL|
219 g_log_set_handler (NULL,
222 GINT_TO_POINTER (G_LOG_LEVEL_WARNING|
223 G_LOG_LEVEL_CRITICAL|
227 if (nvt_file_list != NULL)
228 err += process_file_list(nvt_file_list, mode, script_infos);
231 if (nvt_files != NULL)
232 err += process_files(nvt_files, mode, script_infos);
234 g_print (
"%d errors found\n",
err);
#define NASL_COMMAND_LINE
#define NASL_ALWAYS_SIGNED
int add_nasl_inc_dir(const char *)
Adds the given string as directory for searching for includes.