diff options
| author | Robin Burchell w00t@inspircd.org <Robin Burchell w00t@inspircd.org@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-10-07 23:38:25 +0000 |
|---|---|---|
| committer | Robin Burchell w00t@inspircd.org <Robin Burchell w00t@inspircd.org@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-10-07 23:38:25 +0000 |
| commit | 3324e62bae6f04e4f16f113b2e3352fae242f405 (patch) | |
| tree | cfdd8d39e374619cad772aff317e2998fa078548 /lang | |
| parent | 728fe3e1d42bf8cac353787480701b0a62559272 (diff) | |
Merge branch 'anopeng' into anopeng-config
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1428 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'lang')
| -rw-r--r-- | lang/Makefile | 32 | ||||
| -rw-r--r-- | lang/langcomp.c | 2 | ||||
| -rw-r--r-- | lang/langtool.c | 148 |
3 files changed, 92 insertions, 90 deletions
diff --git a/lang/Makefile b/lang/Makefile index 2c6a66c89..bcc77c6ef 100644 --- a/lang/Makefile +++ b/lang/Makefile @@ -44,39 +44,39 @@ spotless: clean cat: cat.l langcomp index - ./langcomp $@.l + @./langcomp $@.l de: de.l langcomp index - ./langcomp $@.l + @./langcomp $@.l en_us: en_us.l langcomp index - ./langcomp $@.l + @./langcomp $@.l es: es.l langcomp index - ./langcomp $@.l + @./langcomp $@.l fr: fr.l langcomp index - ./langcomp $@.l + @./langcomp $@.l gr: gr.l langcomp index - ./langcomp $@.l + @./langcomp $@.l hun: hun.l langcomp index - ./langcomp $@.l + @./langcomp $@.l it: it.l langcomp index - ./langcomp $@.l + @./langcomp $@.l nl: nl.l langcomp index - ./langcomp $@.l + @./langcomp $@.l pl: pl.l langcomp index - ./langcomp $@.l + @./langcomp $@.l pt: pt.l langcomp index - ./langcomp $@.l + @./langcomp $@.l ru: ru.l langcomp index - ./langcomp $@.l + @./langcomp $@.l tr: tr.l langcomp index - ./langcomp $@.l + @./langcomp $@.l langcomp: langcomp.c - $(CC) $(CFLAGS) langcomp.c -o $@ + @../run-cc.pl $(CC) $(CFLAGS) langcomp.c -o $@ language.h: index Makefile @perl -e <index >$@ 'print STDERR "Generating language.h... "; $$i=0; while (<>) { chop; printf "#define %-32s %d\n", $$_, $$i++; } print "\n#define NUM_STRINGS $$i\n"; print STDERR "$$i strings\n";' - cp language.h ../include + @cp language.h ../include index: en_us.l - grep '^[A-Z]' en_us.l >index + @grep '^[A-Z]' en_us.l >index diff --git a/lang/langcomp.c b/lang/langcomp.c index d9c40f8fb..e9495462f 100644 --- a/lang/langcomp.c +++ b/lang/langcomp.c @@ -188,7 +188,7 @@ int main(int ac, char **av) s = strrchr(filename, '.'); if (!s) s = filename + strlen(filename); - if (s-filename > sizeof(langname)-3) + if (s-filename > (int)sizeof(langname)-3) s = filename + sizeof(langname)-1; strncpy(langname, filename, s-filename); langname[s-filename] = '\0'; diff --git a/lang/langtool.c b/lang/langtool.c index f97f29b99..32d9639f7 100644 --- a/lang/langtool.c +++ b/lang/langtool.c @@ -1,74 +1,76 @@ -/* Language stuff generator for win32. - * - * (C) 2003-2008 Anope Team - * Contact us at info@anope.org - * - * Please read COPYING and README for furhter details. - * - * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. - * - * Written by Dominick Meglio <codemastr@unrealircd.com> - * - */ - -#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); +/* Language stuff generator for win32.
+ *
+ * (C) 2003-2008 Anope Team
+ * Contact us at info@anope.org
+ *
+ * Please read COPYING and README for furhter details.
+ *
+ * Based on the original code of Epona by Lara.
+ * Based on the original code of Services by Andy Church.
+ *
+ * Written by Dominick Meglio <codemastr@unrealircd.com>
+ *
+ */
+
+#include <string.h>
+#include <stdio.h>
+#include <cstdlib>
+#include <cctype>
+
+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); - } - return 0; - -} + 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);
+ fclose(fd);
+ fclose(fdout);
+ }
+ return 0;
+
+}
|
