Rename fmt_addcomp() to fmt_addcomptext().
Create new function fmt_addcompentry().
struct comp *fmt_findcomp(char *component);
/*
+ * Search for a component structure in the component hash table.
+ *
+ * Identical to fmd_findcomp(), but is case-INSENSITIVE.
+ */
+
+struct comp *fmt_findcasecmp(char *component);
+
+/*
+ * Add a component entry to the component hash table
+ *
+ * component - The name of the component to add to the hash table.
+ *
+ * If the component is already in the hash table, this function will do
+ * nothing. Returns 1 if a component was added, 0 if it already existed.
+ */
+
+int fmt_addcompentry(char *component);
+
+/*
* Add a string to a component hash table entry. Arguments are:
*
* component - The name of the component to add text to. The component
* in the component hash table, this function will return -1.
*/
-int fmt_addcomp(char *component, char *text);
+int fmt_addcomptext(char *component, char *text);
/*
* Append to an existing component. Arguments are:
}
/*
+ * Like fmt_findcomp, but case-insensitive.
+ */
+
+struct comp *
+fmt_findcasecmp(char *component)
+{
+ struct comp *cm;
+
+ for (cm = wantcomp[CHASH(component)]; cm; cm = cm->c_next)
+ if (mh_strcasecmp(component, cm->c_name) == 0)
+ break;
+
+ return cm;
+}
+
+/*
+ * Add an entry to the component hash table
+ *
+ * Returns true if the component was added, 0 if it already existed.
+ *
+ */
+
+int
+fmt_addcompentry(char *component)
+{
+ struct comp *cm;
+ int i;
+
+ FINDCOMP(cm, component);
+
+ if (cm)
+ return 0;
+
+ NEWCOMP(cm, component);
+
+ /*
+ * ncomp is really meant for fmt_compile() and this function is
+ * meant to be used outside of it. So decrement it just to be safe
+ * (internal callers should be using NEWCOMP()).
+ */
+
+ ncomp--;
+
+ return 1;
+}
+
+/*
* Add a string to a component hash table entry.
*
* Note the special handling for components marked with CT_ADDR. The comments
*/
int
-fmt_addcomp(char *component, char *text)
+fmt_addcomptext(char *component, char *text)
{
int i, found = 0, bucket = CHASH(component);
struct comp *cptr = wantcomp[bucket];
switch (state = m_getfld (state, name, buf, sizeof(buf), fp)) {
case FLD:
case FLDPLUS:
- bucket = fmt_addcomp(name, buf);
+ bucket = fmt_addcomptext(name, buf);
for (ip = ignores; *ip; ip++)
if (!mh_strcasecmp (name, *ip)) {
while (state == FLDPLUS) {
switch (state = m_getfld (state, name, tmpbuf, SBUFSIZ, inb)) {
case FLD:
case FLDPLUS:
- i = fmt_addcomp(name, tmpbuf);
+ i = fmt_addcomptext(name, tmpbuf);
if (i != -1) {
char_read += msg_count;
while (state == FLDPLUS) {