gettext.h added - gettenv overwrite fixed.

This commit is contained in:
matiasbian 2018-06-21 19:45:08 -03:00
parent 70897bc9db
commit 6ad9b16454
2 changed files with 15 additions and 2 deletions

View File

@ -3,7 +3,7 @@
#include <unistd.h>
#include "gfx.h"
#include "merge.h"
#include <libintl.h>
#include <gettext.h>
#include <locale.h>
#define NUMBER_OF_COLORS 7

View File

@ -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);