brewco/rdrecipes.c

changeset 464
4a624c071ca9
parent 463
a1da58215b65
child 473
fdd30e935079
equal deleted inserted replaced
463:a1da58215b65 464:4a624c071ca9
24 #include "rdrecipes.h" 24 #include "rdrecipes.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 a_recipe *recipes = NULL; 31 a_recipe *recipes = NULL;
31 32
32 33
33 const char SKIPYN[2][4] = { "NO", "YES" }; 34 const char SKIPYN[2][4] = { "NO", "YES" };
286 xmlFreeTextWriter(writer); 287 xmlFreeTextWriter(writer);
287 288
288 /* 289 /*
289 * Now write the XML recipes 290 * Now write the XML recipes
290 */ 291 */
291 if (getenv((char *)"USER") == NULL) { 292 mypath = xstrcpy(etcpath);
292 mypath = xstrcpy((char *)"/root");
293 } else {
294 mypath = xstrcpy(getenv((char *)"HOME"));
295 }
296 mypath = xstrcat(mypath, (char *)"/.brewco/etc/");
297 mkdirs(mypath, 0755);
298 mypath = xstrcat(mypath, (char *)"recipes.xml"); 293 mypath = xstrcat(mypath, (char *)"recipes.xml");
299 294
300 if (debug) 295 if (debug)
301 fprintf(stdout, "Writing %s\n", mypath); 296 fprintf(stdout, "Writing %s\n", mypath);
302 297
569 char *mypath; 564 char *mypath;
570 xmlDocPtr doc; 565 xmlDocPtr doc;
571 xmlNodePtr cur; 566 xmlNodePtr cur;
572 a_recipe *recipe; 567 a_recipe *recipe;
573 568
574 syslog(LOG_NOTICE, "HOME='%s' USER='%s' LOGNAME='%s'", MBSE_SS(getenv((char *)"HOME")), MBSE_SS(getenv((char *)"USER")), MBSE_SS(getenv((char *)"LOGNAME")));
575
576 /* 569 /*
577 * Search config file 570 * Search config file
578 */ 571 */
579 if (getenv((char *)"USER") == NULL) { 572 mypath = xstrcpy(etcpath);
580 mypath = xstrcpy((char *)"/root");
581 } else {
582 mypath = xstrcpy(getenv((char *)"HOME"));
583 }
584 mypath = xstrcat(mypath, (char *)"/.brewco/etc/");
585 mkdirs(mypath, 0755);
586 mypath = xstrcat(mypath, (char *)"recipes.xml"); 573 mypath = xstrcat(mypath, (char *)"recipes.xml");
587 574
588 /* 575 /*
589 * Free possible old recipes list 576 * Free possible old recipes list
590 */ 577 */

mercurial