static int var_cmp (const void *a, const void *b)
{
- return (strcmp (((var_t *) a)->name, ((var_t *) b)->name));
+ return (m_strcmp (((var_t *) a)->name, ((var_t *) b)->name));
}
enum output_formats_t {
static void add_var (const char *name)
{
- outbuf = realloc (outbuf, (++outcount) * sizeof (var_t));
+ p_realloc(&outbuf, ++outcount);
outbuf[outcount - 1].seen = 0;
outbuf[outcount - 1].name = strdup(name);
outbuf[outcount - 1].descr = NULL;
if (lold == 0)
outbuf[outcount - 1].descr = strdup(s);
else {
- outbuf[outcount - 1].descr =
- realloc (outbuf[outcount - 1].descr, lold + lnew + 1);
- memcpy (&(outbuf[outcount - 1].descr[lold - 1]) + 1, s, lnew);
+ p_realloc(&outbuf[outcount - 1].descr, lold + lnew + 1);
+ memcpy(&(outbuf[outcount - 1].descr[lold - 1]) + 1, s, lnew);
}
outbuf[outcount - 1].descr[lold + lnew] = '\0';
return (1);
if (!(p = get_token (token, sizeof (token), buffer)))
continue;
- if (!strcmp (token, "/*++*/"))
+ if (!m_strcmp (token, "/*++*/"))
active = 1;
- else if (!strcmp (token, "/*--*/")) {
+ else if (!m_strcmp (token, "/*--*/")) {
docstat = flush_doc (docstat);
active = 0;
}
- else if (active && (!strcmp (token, "/**") || !strcmp (token, "**")))
+ else if (active && (!m_strcmp (token, "/**") || !m_strcmp (token, "**")))
docstat = handle_docline (p, docstat);
- else if (active && !strcmp (token, "{")) {
+ else if (active && !m_strcmp (token, "{")) {
docstat = flush_doc (docstat);
handle_confline (p);
}
for (line = 0; line < outcount; line++) {
if (outbuf[line].descr) {
fprintf (out, "%s\n", outbuf[line].descr);
- free (outbuf[line].descr);
+ p_delete(&outbuf[line].descr);
}
- free (outbuf[line].name);
+ p_delete(&outbuf[line].name);
}
- free (outbuf);
+ p_delete(&outbuf);
}
/* skip whitespace */
int type;
for (type = DT_NONE; types[type].machine; type++)
- if (!strcmp (types[type].machine, s))
+ if (!m_strcmp (types[type].machine, s))
return type;
return DT_NONE;
if (!(s = get_token (buff, sizeof (buff), s)))
return;
- if (!strcmp (buff, "|")) {
+ if (!m_strcmp (buff, "|")) {
/* ignore subtype and comma */
if (!(s = get_token (buff, sizeof (buff), s)))
return;
while (1) {
if (!(s = get_token (buff, sizeof (buff), s)))
return;
- if (!strcmp (buff, ","))
+ if (!m_strcmp (buff, ","))
break;
}
/* option name or UL &address */
if (!(s = get_token (buff, sizeof (buff), s)))
return;
- if (!strcmp (buff, "UL"))
+ if (!m_strcmp (buff, "UL"))
if (!(s = get_token (buff, sizeof (buff), s)))
return;
/* <default value> or UL <default value> */
if (!(s = get_token (buff, sizeof (buff), s)))
return;
- if (!strcmp (buff, "UL")) {
+ if (!m_strcmp (buff, "UL")) {
if (!(s = get_token (buff, sizeof (buff), s)))
return;
}
memset(val, 0, sizeof(val));
do {
- if (!strcmp (buff, "}"))
+ if (!m_strcmp (buff, "}"))
break;
m_strcat(val, sizeof(val), buff);
print_confline (varname, type, val);
}
-static void char_to_escape (char *dest, unsigned int c)
+static void char_to_escape (char *dest, int len, unsigned int c)
{
switch (c) {
case '\r':
- strcpy (dest, "\\r");
- break; /* __STRCPY_CHECKED__ */
+ m_strcpy(dest, len, "\\r");
+ break;
case '\n':
- strcpy (dest, "\\n");
- break; /* __STRCPY_CHECKED__ */
+ m_strcpy(dest, len, "\\n");
+ break;
case '\t':
- strcpy (dest, "\\t");
- break; /* __STRCPY_CHECKED__ */
+ m_strcpy(dest, len, "\\t");
+ break;
case '\f':
- strcpy (dest, "\\f");
- break; /* __STRCPY_CHECKED__ */
+ m_strcpy(dest, len, "\\f");
+ break;
default:
- sprintf (dest, "\\%03o", c);
+ sprintf (dest, len, "\\%03o", c);
break;
}
}
{
char buff[16];
- char_to_escape (buff, c);
+ char_to_escape(buff, sizeof(buff), c);
add_s (buff);
}
for (; *v; v++) {
if (*v < ' ' || *v & 0x80) {
- char_to_escape (buff, (unsigned int) *v);
+ char_to_escape(buff, sizeof(buff), (unsigned int) *v);
sgml_fputs (buff);
continue;
}