1931 mypath = xstrcat(mypath, (char *)"/.thermferm/etc/"); |
1931 mypath = xstrcat(mypath, (char *)"/.thermferm/etc/"); |
1932 mkdirs(mypath, 0755); |
1932 mkdirs(mypath, 0755); |
1933 mypath = xstrcat(mypath, (char *)"thermferm.xml"); |
1933 mypath = xstrcat(mypath, (char *)"thermferm.xml"); |
1934 if ((doc = xmlParseFile(mypath)) == NULL) { |
1934 if ((doc = xmlParseFile(mypath)) == NULL) { |
1935 /* |
1935 /* |
1936 * Not in the users home directory |
1936 * No config file, create a fresh one |
1937 */ |
1937 */ |
1938 free(mypath); |
1938 syslog(LOG_NOTICE, "rdconfig: %s not found, creating", mypath); |
1939 mypath = xstrcpy((char *)"/etc/mbsepi-apps/thermferm.xml"); |
1939 wrconfig(); |
|
1940 |
1940 if ((doc = xmlParseFile(mypath)) == NULL) { |
1941 if ((doc = xmlParseFile(mypath)) == NULL) { |
1941 /* |
1942 syslog(LOG_NOTICE, "rdconfig: could not create %s", mypath); |
1942 * Try /usr/local/etc |
|
1943 */ |
|
1944 free(mypath); |
1943 free(mypath); |
1945 mypath = xstrcpy((char *)"/usr/local/etc/mbsepi-apps/thermferm.xml"); |
1944 return 1; |
1946 if ((doc = xmlParseFile(mypath)) == NULL) { |
|
1947 syslog(LOG_NOTICE, "rdconfig: could not find thermferm.xml"); |
|
1948 return 1; |
|
1949 } |
|
1950 } |
1945 } |
1951 } |
1946 } |
1952 syslog(LOG_NOTICE, "rdconfig: using %s", mypath); |
1947 syslog(LOG_NOTICE, "rdconfig: using %s", mypath); |
1953 |
1948 |
1954 if ((cur = xmlDocGetRootElement(doc)) == NULL) { |
1949 if ((cur = xmlDocGetRootElement(doc)) == NULL) { |