brewco/rdsession.c

changeset 464
4a624c071ca9
parent 446
78e9d5234d15
child 469
d26def846029
equal deleted inserted replaced
463:a1da58215b65 464:4a624c071ca9
24 #include "rdsession.h" 24 #include "rdsession.h"
25 #include "util.h" 25 #include "util.h"
26 #include "xutil.h" 26 #include "xutil.h"
27 27
28 extern int debug; 28 extern int debug;
29 extern char *etcpath;
29 30
30 31
31 const char BREWSTEP[14][10] = { "NA", "INIT", "WAITSTART", "PREMASH", "MASHING", "IODINE", "REMOVE", "PREBOIL", "BOIL", "BOILDONE", "COOLING", "WHIRLPOOL", "CLEANUP", "DONE" }; 32 const char BREWSTEP[14][10] = { "NA", "INIT", "WAITSTART", "PREMASH", "MASHING", "IODINE", "REMOVE", "PREBOIL", "BOIL", "BOILDONE", "COOLING", "WHIRLPOOL", "CLEANUP", "DONE" };
32 const char MASHSTEP[5][8] = { "NA", "PROMPT", "HEATING", "REST", "DONE" }; 33 const char MASHSTEP[5][8] = { "NA", "PROMPT", "HEATING", "REST", "DONE" };
33 34
136 xmlFreeTextWriter(writer); 137 xmlFreeTextWriter(writer);
137 138
138 /* 139 /*
139 * Now write the XML configuration 140 * Now write the XML configuration
140 */ 141 */
141 if (getenv((char *)"USER") == NULL) { 142 mypath = xstrcpy(etcpath);
142 mypath = xstrcpy((char *)"/root");
143 } else {
144 mypath = xstrcpy(getenv((char *)"HOME"));
145 }
146 mypath = xstrcat(mypath, (char *)"/.brewco/var/");
147 mkdirs(mypath, 0755);
148 mypath = xstrcat(mypath, (char *)"brewing.xml"); 143 mypath = xstrcat(mypath, (char *)"brewing.xml");
149 144
150 if (debug) 145 if (debug)
151 fprintf(stdout, "Writing %s\n", mypath); 146 fprintf(stdout, "Writing %s\n", mypath);
152 147
189 char *mypath; 184 char *mypath;
190 xmlDocPtr doc; 185 xmlDocPtr doc;
191 xmlNodePtr cur; 186 xmlNodePtr cur;
192 xmlChar *key; 187 xmlChar *key;
193 188
194 syslog(LOG_NOTICE, "HOME='%s' USER='%s' LOGNAME='%s'", MBSE_SS(getenv((char *)"HOME")), MBSE_SS(getenv((char *)"USER")), MBSE_SS(getenv((char *)"LOGNAME")));
195
196 /* 189 /*
197 * Search config file 190 * Search config file
198 */ 191 */
199 if (getenv((char *)"USER") == NULL) { 192 mypath = xstrcpy(etcpath);
200 mypath = xstrcpy((char *)"/root");
201 } else {
202 mypath = xstrcpy(getenv((char *)"HOME"));
203 }
204 mypath = xstrcat(mypath, (char *)"/.brewco/var/");
205 mkdirs(mypath, 0755);
206 mypath = xstrcat(mypath, (char *)"brewing.xml"); 193 mypath = xstrcat(mypath, (char *)"brewing.xml");
207 194
208 /* 195 /*
209 * See if we have a brewing state file. 196 * See if we have a brewing state file.
210 */ 197 */

mercurial