summaryrefslogtreecommitdiff
path: root/lang/langcomp.c
diff options
context:
space:
mode:
authorrob rob@31f1291d-b8d6-0310-a050-a5561fc1590b <rob rob@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>2004-10-12 21:48:40 +0000
committerrob rob@31f1291d-b8d6-0310-a050-a5561fc1590b <rob rob@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>2004-10-12 21:48:40 +0000
commitee5de492f765f02b09fee772540017fb5ea1007e (patch)
treece2c80ecf8f19b2ccef62ad6c90b97b47b6c9c45 /lang/langcomp.c
parent61ad72831ef31065b31a49908bab487dcf6cc54f (diff)
BUILD : 1.7.5 (391) BUGS : N/A NOTES : Code tidy, added make strict to the makefile, allowing ansi Wall pedantic to be used for compiling
git-svn-id: svn://svn.anope.org/anope/trunk@391 31f1291d-b8d6-0310-a050-a5561fc1590b git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@256 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'lang/langcomp.c')
-rw-r--r--lang/langcomp.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/lang/langcomp.c b/lang/langcomp.c
index 791e23f93..cca689263 100644
--- a/lang/langcomp.c
+++ b/lang/langcomp.c
@@ -44,12 +44,16 @@
#include <stdlib.h>
#include <string.h>
#undef getline
+
int numstrings = 0; /* Number of strings we should have */
char **stringnames; /* Names of the strings (from index file) */
char **strings; /* Strings we have loaded */
int linenum = 0; /* Current line number in input file */
+
+char *anopeStrDup(const char *src);
+
/*************************************************************************/
/* Read the index file and load numstrings and stringnames. Return -1 on
@@ -80,7 +84,7 @@ int read_index_file()
while (fgets(buf, sizeof(buf), f)) {
if (buf[strlen(buf)-1] == '\n')
buf[strlen(buf)-1] = '\0';
- if (!(stringnames[i++] = strdup(buf))) {
+ if (!(stringnames[i++] = anopeStrDup(buf))) {
perror("strdup()");
return -1;
}
@@ -143,10 +147,20 @@ int fput32(int val, FILE *f)
}
/*************************************************************************/
+char *anopeStrDup(const char *src) {
+ char *ret=NULL;
+ if(src) {
+ if( (ret = (char *)malloc(strlen(src)+1)) ) {;
+ strcpy(ret,src);
+ }
+ }
+ return ret;
+}
+/*************************************************************************/
int main(int ac, char **av)
{
- unsigned char *filename = NULL, *s;
+ char *filename = NULL, *s;
char langname[254], outfile[256];
FILE *in, *out;
int warn = 0;