with new add_profile_entry() function.
struct msgs_array;
+void add_profile_entry (const char *, const char *);
void adios (char *, char *, ...) NORETURN;
void admonish (char *, char *, ...);
void advertise (char *, char *, char *, va_list);
opp = npp;
}
+
+
+void
+add_profile_entry (const char *key, const char *value) {
+ struct node *newnode = (struct node *) mh_xmalloc (sizeof *newnode);
+
+ /* This inserts the new node at the beginning of m_defs because
+ that doesn't require traversing it or checking to see if it's
+ empty. */
+ newnode->n_name = getcpy (key);
+ newnode->n_field = getcpy (value);
+ newnode->n_context = 0;
+ newnode->n_next = m_defs;
+ m_defs = newnode;
+}
continue;
case CREDENTIALSSW: {
- /* post doesn't read the profile, so insert credentials
- entry the hard way. */
- struct node *np = (struct node *) mh_xmalloc (sizeof *np);
-
if (!(cp = *argp++) || *cp == '-')
adios (NULL, "missing argument to %s", argp[-2]);
- np->n_name = "credentials";
- np->n_field = cp;
- np->n_context = 0;
- np->n_next = m_defs;
- m_defs = np;
+ add_profile_entry ("credentials", cp);
continue;
}