]> git.sur5r.net Git - i3/i3status/blobdiff - config.c
Beautify wireless code
[i3/i3status] / config.c
index aa7973e0009296e0109d2734d9bd6925a1d44162..e77ff2ef871b9887b710a9b604da1b5bc6857701 100644 (file)
--- a/config.c
+++ b/config.c
@@ -19,11 +19,12 @@ const char *wmii_path;
 const char *time_format;
 const char *battery_path;
 bool use_colors;
+bool get_ethspeed;
 const char *wmii_normcolors = "#222222 #333333";
 char order[MAX_ORDER][2];
 const char **run_watches;
 unsigned int num_run_watches;
-int interval = 1;
+unsigned int interval = 1;
 
 void die(const char *fmt, ...);
 
@@ -108,8 +109,11 @@ int load_configuration(const char *configfile) {
                OPT("wmii_path")
                {
                        char *globbed = glob_path(dest_value);
-                       if ((stat(globbed, &stbuf)) == -1)
-                               die("wmii_path contains an invalid path");
+                       if ((stat(globbed, &stbuf)) == -1) {
+                               fprintf(stderr, "Warning: wmii_path contains an invalid path\n");
+                               free(globbed);
+                               globbed = strdup(dest_value);
+                       }
                        if (globbed[strlen(globbed)-1] != '/')
                                die("wmii_path is not terminated by /");
                        wmii_path = globbed;
@@ -120,8 +124,6 @@ int load_configuration(const char *configfile) {
                }
                OPT("battery_path")
                {
-                       if ((stat(dest_value, &stbuf)) == -1)
-                               die("battery_path contains an invalid path");
                        battery_path = strdup(dest_value);
                }
                OPT("run_watch")
@@ -161,6 +163,10 @@ int load_configuration(const char *configfile) {
                {
                        use_colors = true;
                }
+               OPT("get_ethspeed")
+               {
+                       get_ethspeed = true;
+               }
                OPT("normcolors")
                {
                        wmii_normcolors = strdup(dest_value);
@@ -179,7 +185,7 @@ int load_configuration(const char *configfile) {
        fclose(handle);
 
        if (wmii_path == NULL)
-               die("No wmii_path specified in configuration file");
+               exit(EXIT_FAILURE);
 
        return result;
 }