fputs("};\n", stdout);
}
-#define dupstring(TARGET, SOURCE) do { free(TARGET); if (SOURCE) { size_t len = strlen(SOURCE); (TARGET) = malloc(len+1); memcpy((TARGET), (SOURCE), len); } else (TARGET) = 0; } while(0)
+#define dupstring(TARGET, SOURCE) do { free(TARGET); if (SOURCE) { size_t len = strlen(SOURCE) + 1; (TARGET) = malloc(len); memcpy((TARGET), (SOURCE), len); } else (TARGET) = 0; } while(0)
/*** MANAGING LISTS OF STRINGS ***/
{
for (sl = conn->origins; sl; sl = sl->next)
fprintf(stdout, "# %s\n", sl->value);
- if (conn->name == NULL
- || conn->host == NULL
+ if (conn->host == NULL
|| conn->password == NULL
|| conn->class == NULL)
{
- fprintf(stderr, "H:line missing C:line for %s\n",sl->value);
+ fprintf(stderr, "H:line missing C:line for %s\n", conn->name);
continue;
}
continue;
}
+ /* If it had no value before, drop it now since the lexer does
+ * not accept empty strings and the grammar does not accept
+ * empty stringlists.*/
+ if (!feat->values) {
+ fprintf(stdout, "# Above feature had no value.\n");
+ continue;
+ }
+
/* Wasn't remapped, wasn't removed: print it out. */
fprintf(stdout, "\t\"%s\" =", feat->name);
for (sl = feat->values; sl; sl = sl->next)