X-Git-Url: https://plomlompom.com/repos/index.html?a=blobdiff_plain;f=src%2Fwincontrol.c;h=cfa593b42455b81e58dd1ff325c89a128a87d1a9;hb=f8325a4ea617b15315183d7a8027c0b913c91034;hp=4ebf9ef666a308d9fb6c5c5c94b3be8f9cfd7eee;hpb=f6aaf0667ee0f1ab62342ff7becca2beb6cabc9c;p=plomrogue
diff --git a/src/wincontrol.c b/src/wincontrol.c
index 4ebf9ef..cfa593b 100644
--- a/src/wincontrol.c
+++ b/src/wincontrol.c
@@ -19,7 +19,7 @@ extern struct Win init_win_from_file(struct World * world, char * w_name,
void (* f) (struct Win *))
{
char * err = "Trouble in init_win_from_file() with malloc().";
- char * prefix = "config/Win_";
+ char * prefix = "config/windows/";
uint8_t size = strlen(prefix) + strlen(w_name) + 1;
char * path = malloc(size);
exit_err(NULL == path, world, err);
@@ -34,6 +34,9 @@ extern struct Win init_win_from_file(struct World * world, char * w_name,
char * line = malloc(linemax);
err = "Trouble in init_win_from_file() with fgets().";
exit_err(NULL == fgets(line, linemax, file), world, err);
+ char * title = malloc(strlen(line));
+ memcpy(title, line, strlen(line) - 1);
+ exit_err(NULL == fgets(line, linemax, file), world, err);
int16_t height = atoi(line);
exit_err(NULL == fgets(line, linemax, file), world, err);
int16_t width = atoi(line);
@@ -42,7 +45,10 @@ extern struct Win init_win_from_file(struct World * world, char * w_name,
exit_err(fclose(file), world, err);
struct WinMeta * wmeta = world->wins.meta;
- return init_win(wmeta, w_name, height, width, world, f);
+ struct Win w;
+ init_win(wmeta, &w, title, height, width, world, f);
+ free(title);
+ return w;
}
@@ -51,7 +57,7 @@ extern void sorted_wintoggle(struct World * world)
{
char * err = "Trouble in sorted_wintoggle() with fopen() on file "
"'config/toggle_win_order'.";
- FILE * file = fopen("config/toggle_win_order", "r");
+ FILE * file = fopen("config/windows/toggle_order", "r");
exit_err(NULL == file, world, err);
uint16_t linemax;
textfile_sizes(file, &linemax, NULL);