#include "tincctl.h"
#include "top.h"
+#ifdef HAVE_MINGW
+#define mkdir(a, b) mkdir(a)
+#endif
+
/* The name this program was run with. */
static char *program_name = NULL;
slash = c;
#endif
- if (slash++) {
- c = xmalloc((slash - argv[0]) + sizeof("tincd"));
- sprintf(c, "%.*stincd", (int)(slash - argv[0]), argv[0]);
- }
+ if (slash++)
+ xasprintf(&c, "%.*stincd", (int)(slash - argv[0]), argv[0]);
else
c = "tincd";
#ifndef HAVE_MINGW
char *editor = getenv("VISUAL") ?: getenv("EDITOR") ?: "vi";
#else
- char *editor = "edit"
+ char *editor = "edit";
#endif
char *command;
fprintf(out, "Name = %s\n", name);
char buf[4096];
- while(fgets(buf, sizeof buf, in))
- fputs(buf, out);
+ while(fgets(buf, sizeof buf, in)) {
+ if(strcspn(buf, "\t =") != 4 || strncasecmp(buf, "Name", 4))
+ fputs(buf, out);
+ }
if(ferror(in)) {
fprintf(stderr, "Error while reading configuration file %s: %s\n", filename, strerror(errno));