2012 copyright
[psensor.git] / src / server / server.c
index fbafba5..65f0ee8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010-2011 jeanfi@gmail.com
+ * Copyright (C) 2010-2012 jeanfi@gmail.com
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
@@ -43,7 +43,6 @@
 
 #include "psensor_json.h"
 #include "url.h"
-#include "p_io.h"
 #include "server.h"
 
 static const char *program_name;
@@ -78,7 +77,7 @@ void print_version()
                 "<http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>\n"
                 "This is free software: you are free to change and redistribute it.\n"
                 "There is NO WARRANTY, to the extent permitted by law.\n"),
-              "2010-2011");
+              "2010-2012");
 }
 
 void print_help()
@@ -151,15 +150,10 @@ create_response_api(const char *nurl,
        char *page = NULL;
 
        if (!strcmp(nurl, URL_BASE_API_1_0_SENSORS))  {
-
                page = sensors_to_json_string(server_data.sensors);
-
 #ifdef HAVE_GTOP
-#ifdef HAVE_SYSINFO_FCT
        } else if (!strcmp(nurl, URL_API_1_0_SYSINFO)) {
-
                page = sysinfo_to_json_string(&server_data.psysinfo);
-#endif
        } else if (!strcmp(nurl, URL_API_1_0_CPU_USAGE)) {
                page = sensor_to_json_string(server_data.cpu_usage);
 #endif
@@ -324,7 +318,7 @@ int main(int argc, char *argv[])
        textdomain(PACKAGE);
 #endif
 
-       server_data.www_dir = DEFAULT_WWW_DIR;
+       server_data.www_dir = NULL;
        server_data.psysinfo.interfaces = NULL;
 
        while ((optc = getopt_long(argc, argv,
@@ -353,6 +347,8 @@ int main(int argc, char *argv[])
                }
        }
 
+       server_data.www_dir = strdup(DEFAULT_WWW_DIR);
+
        if (!cmdok || optind != argc) {
                fprintf(stderr, _("Try `%s --help' for more information.\n"),
                        program_name);
@@ -387,9 +383,7 @@ int main(int argc, char *argv[])
                pthread_mutex_lock(&mutex);
 
 #ifdef HAVE_GTOP
-#ifdef HAVE_SYSINFO_FCT
                sysinfo_update(&server_data.psysinfo);
-#endif
                cpu_usage_sensor_update(server_data.cpu_usage);
 #endif
                psensor_list_update_measures(server_data.sensors);
@@ -409,9 +403,7 @@ int main(int argc, char *argv[])
        sensors_cleanup();
 
 #ifdef HAVE_GTOP
-#ifdef HAVE_SYSINFO_FCT
        sysinfo_cleanup();
-#endif
        cpu_cleanup();
 #endif