Index: config.c =================================================================== --- config.c +++ config.c 2012-04-21 10:56:26.198755220 +0200 @@ -27,6 +27,10 @@ #include <getopt.h> #endif +#include <unistd.h> +#include <sys/socket.h> +#include <fcntl.h> + #include "types_defs.h" #include "config.h" @@ -97,9 +101,22 @@ exit (EXIT_FAILURE); } } + if ((f = fopen (configFilePath, "r")) == NULL) { - printf ("%s error: can't open config file %s\n", PACKAGE, configFilePath); - exit (EXIT_FAILURE); + static char skelConfigFilePath[FILENAME_MAX] = "/etc/skel/.wmdrawerrc"; + if (stat (skelConfigFilePath, &buf) != -1) { + char cmd[FILENAME_MAX*2 + 4]; + sprintf (cmd, "cp %s %s", skelConfigFilePath, configFilePath); + system (cmd); + if ((f = fopen (configFilePath, "r")) == NULL) { + printf ("%s error: can't open config file %s\n", PACKAGE, configFilePath); + exit (EXIT_FAILURE); + } + } + else { + printf ("%s error: can't open config file %s nor %s\n", PACKAGE, configFilePath, skelConfigFilePath); + exit (EXIT_FAILURE); + } } if (stat (configFilePath, &buf) == 0) {