diff options
| author | certus certus@31f1291d-b8d6-0310-a050-a5561fc1590b <certus certus@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864> | 2004-06-10 23:52:45 +0000 |
|---|---|---|
| committer | certus certus@31f1291d-b8d6-0310-a050-a5561fc1590b <certus certus@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864> | 2004-06-10 23:52:45 +0000 |
| commit | eece3847bfed4e3bac99df0f5f511ee7ecbedd45 (patch) | |
| tree | dd3754a0c5e73a40eee8b007c36fdd26a1282ec5 /lang/langtool.c | |
| parent | 3bba983a6100e2d698660d5aa0d12a1c0c1ab2b0 (diff) | |
BUILD : 1.7.3 (186) BUGS : NOTES : Added langtool.c and modified some langcomp.c stuff in behalf of codemastr (win32 port)
git-svn-id: svn://svn.anope.org/anope/trunk@186 31f1291d-b8d6-0310-a050-a5561fc1590b
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@131 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'lang/langtool.c')
| -rw-r--r-- | lang/langtool.c | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/lang/langtool.c b/lang/langtool.c new file mode 100644 index 000000000..3175118e0 --- /dev/null +++ b/lang/langtool.c @@ -0,0 +1,59 @@ +/* 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; + +} |
