Clean up mklang a bit.

This commit is contained in:
Mari the Deer 2025-03-07 12:26:22 +01:00
commit d799a2f97b
2 changed files with 21 additions and 18 deletions

View file

@ -1,3 +1,3 @@
[default]
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r1191 \cu(vie 07 mar 2025 11:50:31 CET)\c-";
SWWM_SHORTVER="\cw1.3pre r1191 \cu(2025-03-07 11:50:31)\c-";
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r1192 \cu(vie 07 mar 2025 12:26:22 CET)\c-";
SWWM_SHORTVER="\cw1.3pre r1192 \cu(2025-03-07 12:26:22)\c-";

View file

@ -36,6 +36,7 @@ char *lang = 0;
FILE *lf = 0;
char *txt = 0;
long txtlen = 0;
int nl = 0, nf = 0;
void processentry( char *entname )
{
@ -70,6 +71,7 @@ gettag:
processend:
if ( gottag ) printf("\n");
else printf(" \033[1;31mEMPTY???\033[0m\n");
nf++;
return;
processtag:
printf(" \033[1;36mTAG\033[0m");
@ -202,24 +204,12 @@ int main( int argc, char **argv )
const char langs[][16] =
{
"default",
"es",
/* "jp",
"ru",
"fr",
"it",
"de",
"pl"*/
"es"
};
const char langfiles[][32] =
{
"language.def_lore",
"language.es_lore",
/* "language.jp_lore",
"language.ru_lore",
"language.fr_lore",
"language.it_lore",
"language.de_lore",
"language.pl_lore",*/
"language.es_lore"
};
int nlangs = sizeof(langs)/16; // hacky, but works
char mpath[PATH_MAX+1];
@ -238,12 +228,24 @@ int main( int argc, char **argv )
int lim = PATH_MAX-(appendto-mpath);
for ( int i=0; i<nlangs; i++ )
{
if ( snprintf(appendto,lim,"lore/%s",langs[i]) >= lim )
{
fprintf(stderr,"\033[31mpath length exceeded (over %u bytes).\033[0m\n",PATH_MAX);
continue;
}
DIR *d = opendir(mpath);
if ( !d )
{
fprintf(stderr,"\033[31mskipping language \033[1m'%s'\033[22m: \033[1m%s\033[0m\n",langs[i],strerror(errno));
continue;
}
closedir(d);
printf("\033[33mprocessing language \033[1m'%s'\033[0m\n",langs[i]);
if ( snprintf(appendto,lim,"%s",langfiles[i]) >= lim )
{
fprintf(stderr,"\033[31mpath length exceeded (over %u bytes).\033[0m\n",PATH_MAX);
continue;
}
printf("\033[33mprocessing language \033[1m'%s'\033[0m\n",langs[i]);
lf = fopen(mpath,"wb");
if ( !lf )
{
@ -256,12 +258,13 @@ int main( int argc, char **argv )
if ( nb >= lim )
{
fprintf(stderr,"\033[31mpath length exceeded (over %u bytes).\033[0m\n",PATH_MAX);
fclose(lf);
continue;
}
loopdir(mpath,appendto,nb,lim);
fclose(lf);
nl++;
}
printf("\033[33mfinished: \033[1m%d\033[22m languages, \033[1m%d\033[22m total files\n",nl,nf);
return 0;
}