Part of the swftools package.
Copyright (c) 2001 Matthias Kramm <kramm@quiss.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- This file is distributed under the GPL, see file COPYING for details */
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <stdlib.h>
#include <stdio.h>
len = pos;
/* for(t=0;t<len;t++) {
- printf("(%d) %s=%s %s\n", t, strndup(name[t], namelen[t]), strndup(value[t], valuelen[t]),
+ printf("(%d) %s=%s %s\n", t, strdup_n(name[t], namelen[t]), strdup_n(value[t], valuelen[t]),
isboolean[t]?"(boolean)":"");
}*/
value[pos].str = text;
value[pos].len = strlen(text);
/*printf("setting boolean parameter %s (to %s)\n",
- strndup(name[pos], namelen[pos]),
- strndup(value[pos], valuelen[pos]));*/
+ strdup_n(name[pos], namelen[pos]),
+ strdup_n(value[pos], valuelen[pos]));*/
break;
}
}
if((type == ASSIGNMENT && !strncmp(name[pos].str, text, name[pos].len>textlen?name[pos].len:textlen)) ||
(type != ASSIGNMENT && !set[pos])) {
if(set[pos]) {
- syntaxerror("value %s set twice (old value:%s)", text, strndup(value[pos].str, value[pos].len));
+ syntaxerror("value %s set twice (old value:%s)", text, strdup_n(value[pos].str, value[pos].len));
}
if(type == ASSIGNMENT)
readToken();
value[pos].len = strlen(text);
#if 0//def DEBUG
printf("setting parameter %s (to %s)\n",
- strndup(name[pos].str, name[pos].len),
- strndup(value[pos].str, value[pos].len));
+ strdup_n(name[pos].str, name[pos].len),
+ strdup_n(value[pos].str, value[pos].len));
#endif
break;
}
}
#if 0//def DEBUG
for(t=0;t<len;t++) {
- printf("%s=%s\n", strndup(name[t].str, name[t].len), strndup(value[t].str, value[t].len));
+ printf("%s=%s\n", strdup_n(name[t].str, name[t].len), strdup_n(value[t].str, value[t].len));
}
#endif
for(t=0;t<len;t++) {
}
if(value[t].str == 0) {
pushBack();
- syntaxerror("value for parameter %s missing (no default)", strndup(name[t].str, name[t].len));
+ syntaxerror("value for parameter %s missing (no default)", strdup_n(name[t].str, name[t].len));
}
}