--- gammu/common/gsmstate.c.orig 2008-12-16 14:11:54.000000000 +0100 +++ gammu/common/gsmstate.c 2008-12-21 13:59:48.000000000 +0100 @@ -971,6 +971,7 @@ { char configfile[PATH_MAX + 1]; char *envpath; + char *home_etc; GSM_Error error; *result = NULL; @@ -988,14 +989,24 @@ /* Reset as we're using strcat */ configfile[0] = 0; + /* Try user etc dir */ + home_etc = getenv("HOME_ETC"); + if (home_etc) { + strcat(configfile, home_etc); + strcat(configfile, GAMMURC_NAME); + + error = GSM_TryReadGammuRC(configfile, result); + if (error == ERR_NONE) return ERR_NONE; + } else { /* Try user home */ - envpath = getenv("HOME"); - if (envpath) { + envpath = getenv("HOME"); + if (envpath) { strcat(configfile, envpath); strcat(configfile, GAMMURC_NAME); error = GSM_TryReadGammuRC(configfile, result); if (error == ERR_NONE) return ERR_NONE; + } } #if defined(WIN32)