tracker-0.16.2/src/tracker-writeback/tracker-main.c

No issues found

Incomplete coverage

Tool Failure ID Location Function Message Data
clang-analyzer no-output-found tracker-main.c Message(text='Unable to locate XML output from invoke-clang-analyzer') None
Failure running clang-analyzer ('no-output-found')
Message
Unable to locate XML output from invoke-clang-analyzer
  1 /*
  2  * Copyright (C) 2009, Nokia <ivan.frade@nokia.com>
  3  *
  4  * This library is free software; you can redistribute it and/or
  5  * modify it under the terms of the GNU General Public
  6  * License as published by the Free Software Foundation; either
  7  * version 2 of the License, or (at your option) any later version.
  8  *
  9  * This library is distributed in the hope that it will be useful,
 10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 12  * General Public License for more details.
 13  *
 14  * You should have received a copy of the GNU General Public
 15  * License along with this library; if not, write to the
 16  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 17  * Boston, MA  02110-1301, USA.
 18  */
 19 
 20 #include "config.h"
 21 
 22 #include <stdlib.h>
 23 #include <locale.h>
 24 
 25 #include <glib/gi18n.h>
 26 
 27 #include <libtracker-common/tracker-log.h>
 28 
 29 #include "tracker-writeback.h"
 30 #include "tracker-config.h"
 31 
 32 #define ABOUT	  \
 33 	"Tracker " PACKAGE_VERSION "\n"
 34 
 35 #define LICENSE	  \
 36 	"This program is free software and comes without any warranty.\n" \
 37 	"It is licensed under version 2 or later of the General Public " \
 38 	"License which can be viewed at:\n" \
 39 	"\n" \
 40 	"  http://www.gnu.org/licenses/gpl.txt\n"
 41 
 42 #define QUIT_TIMEOUT 30 /* 1/2 minutes worth of seconds */
 43 
 44 static gboolean      version;
 45 static gint          verbosity = -1;
 46 static gboolean      disable_shutdown;
 47 
 48 static GOptionEntry  entries[] = {
 49 	{ "version", 'V', 0,
 50 	  G_OPTION_ARG_NONE, &version,
 51 	  N_("Displays version information"),
 52 	  NULL },
 53 	{ "verbosity", 'v', 0,
 54 	  G_OPTION_ARG_INT, &verbosity,
 55 	  N_("Logging, 0 = errors only, "
 56 	     "1 = minimal, 2 = detailed and 3 = debug (default=0)"),
 57 	  NULL },
 58 	/* Debug run is used to avoid that the mainloop exits, so that
 59 	 * as a developer you can be relax when running the tool in gdb */
 60 	{ "disable-shutdown", 'd', 0,
 61 	  G_OPTION_ARG_NONE, &disable_shutdown,
 62 	  N_("Disable shutting down after 30 seconds of inactivity"),
 63 	  NULL },
 64 	{ NULL }
 65 };
 66 
 67 
 68 static void
 69 sanity_check_option_values (TrackerConfig *config)
 70 {
 71 	g_message ("General options:");
 72 	g_message ("  Verbosity  ............................  %d",
 73 	           tracker_config_get_verbosity (config));
 74 }
 75 
 76 int
 77 main (int   argc,
 78       char *argv[])
 79 {
 80 	TrackerConfig *config;
 81 	TrackerController *controller;
 82 	GOptionContext *context;
 83 	GMainLoop *loop;
 84 	GError *error = NULL;
 85 	gchar *log_filename;
 86 	guint shutdown_timeout;
 87 
 88 	/* Set up locale */
 89 	setlocale (LC_ALL, "");
 90 
 91 	bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
 92 	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
 93 	textdomain (GETTEXT_PACKAGE);
 94 
 95 	/* Translators: this messagge will apper immediately after the
 96 	 * usage string - Usage: COMMAND <THIS_MESSAGE>
 97 	 */
 98 	context = g_option_context_new (_("- start the tracker writeback service"));
 99 
100 	g_option_context_add_main_entries (context, entries, NULL);
101 	g_option_context_parse (context, &argc, &argv, &error);
102 	g_option_context_free (context);
103 
104 	if (version) {
105 		g_print ("\n" ABOUT "\n" LICENSE "\n");
106 		return EXIT_SUCCESS;
107 	}
108 
109 	/* Initialize logging */
110 	config = tracker_config_new ();
111 
112 	if (verbosity > -1) {
113 		tracker_config_set_verbosity (config, verbosity);
114 	}
115 
116 	tracker_log_init (tracker_config_get_verbosity (config),
117 	                  &log_filename);
118 	if (log_filename != NULL) {
119 		g_message ("Using log file:'%s'", log_filename);
120 		g_free (log_filename);
121 	}
122 
123 	sanity_check_option_values (config);
124 
125 	if (disable_shutdown) {
126 		shutdown_timeout = 0;
127 	} else {
128 		shutdown_timeout = QUIT_TIMEOUT;
129 	}
130 
131 	controller = tracker_controller_new (shutdown_timeout, &error);
132 
133 	if (error) {
134 		g_critical ("Error creating controller: %s", error->message);
135 		g_error_free (error);
136 		return EXIT_FAILURE;
137 	}
138 
139 	g_message ("Main thread is: %p", g_thread_self ());
140 
141 	loop = g_main_loop_new (NULL, FALSE);
142 	g_main_loop_run (loop);
143 
144 
145 	tracker_log_shutdown ();
146 
147 	g_object_unref (controller);
148 
149 	g_main_loop_unref (loop);
150 
151 	g_object_unref (config);
152 
153 	return EXIT_SUCCESS;
154 }