From 6ad9b164547e471aa7fa31ba0357e62fd9ca4dc3 Mon Sep 17 00:00:00 2001 From: matiasbian Date: Thu, 21 Jun 2018 19:45:08 -0300 Subject: [PATCH] gettext.h added - gettenv overwrite fixed. --- src/gfx_curses.c | 2 +- src/main.c | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/gfx_curses.c b/src/gfx_curses.c index 649f206..5b7dd3c 100644 --- a/src/gfx_curses.c +++ b/src/gfx_curses.c @@ -3,7 +3,7 @@ #include #include "gfx.h" #include "merge.h" -#include +#include #include #define NUMBER_OF_COLORS 7 diff --git a/src/main.c b/src/main.c index d888c5a..51cf663 100644 --- a/src/main.c +++ b/src/main.c @@ -14,10 +14,23 @@ void draw_then_sleep(struct gfx_state *s, struct gamestate *g) gfx_sleep(160 / g->opts->grid_width); } +char *targetDir(char *env, char *path) +{ + char *dir; + char *dirEnv; + dirEnv = getenv(env); + dir = malloc(strlen(dirEnv) + strlen(path) + 1); + strcpy(dir, dirEnv); + strcat(dir,path); + return dir; +} + int main(int argc, char **argv) { + + setlocale (LC_ALL, ""); - bindtextdomain ("gfx_terminal", strcat(getenv("PWD"),"/18n/")); + bindtextdomain ("gfx_terminal", targetDir("PWD","/18n/")); textdomain ("gfx_terminal"); struct gamestate *g = gamestate_init(argc, argv);