1
0
mirror of https://github.com/anope/anope.git synced 2026-06-26 04:26:38 +02:00
Files
anope/lang/langtool.c
T
dane dane@31f1291d-b8d6-0310-a050-a5561fc1590b 76fee36660 BUILD : 1.7.3 (194) BUGS : none NOTES : Rolled back win32 support files in lieu of a branch.
git-svn-id: svn://svn.anope.org/anope/trunk@194 31f1291d-b8d6-0310-a050-a5561fc1590b


git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@137 5417fbe8-f217-4b02-8779-1006273d7864
2004-06-15 18:44:04 +00:00

60 lines
1.0 KiB
C

/* Needed due to Windows lack of a decent interpreter */
#include <string.h>
#include <stdio.h>
char *strip(char *str)
{
char *c;
if ((c = strchr(str,'\n')))
*c = 0;
if ((c = strchr(str,'\r')))
*c = 0;
return str;
}
int main(int argc, char *argv[])
{
if (argc < 2)
exit(1);
/* Build the index file */
if (!strcmp(argv[1], "index"))
{
FILE *fd = fopen("en_us.l", "rb");
FILE *fdout = fopen("index", "wb");
char buf[1024];
if (!fd || !fdout)
exit(2);
while (fgets(buf, 1023, fd))
{
if (isupper(*buf))
fprintf(fdout, "%s", buf);
}
fclose(fd);
fclose(fdout);
}
/* Build the language.h file */
else if (!strcmp(argv[1], "language.h"))
{
FILE *fd = fopen("index", "r");
FILE *fdout = fopen("language.h", "w");
char buf[1024];
int i = 0;
if (!fd || !fdout)
exit(2);
fprintf(stderr, "Generating language.h... ");
while (fgets(buf, 1023, fd))
fprintf(fdout, "#define %-32s %d\n", strip(buf), i++);
fprintf(fdout, "#define NUM_STRINGS %d\n", i);
fprintf(stderr, "%d strings\n", i);
}
return 0;
}