+static void rethink_display(void);
+
+static void
+add_pattern(char *patt)
+{
+ struct pattern_node *n = xmalloc(sizeof(*n) + strlen(patt));
+ strcpy(n->pattern, patt);
+ if (patt = strchr(n->pattern, '='))
+ {
+ *patt++ = 0;
+ n->name = patt;
+ }
+ else
+ n->name = NULL;
+ clist_add_tail(&patterns, &n->n);
+}
+
+static void
+add_inbox(void)
+{
+ struct passwd *p = getpwuid(getuid());
+ if (!p)
+ die("You don't exist, go away!");
+ char buf[sizeof("/var/mail/") + strlen(p->pw_name) + 7];
+ sprintf(buf, "/var/mail/%s=INBOX", p->pw_name);
+ add_pattern(buf);
+}
+
+static void
+init_options(struct options *o)
+{
+ o->priority = -1;
+ o->hide = -1;
+ o->hide_if_empty = -1;
+ o->beep = -1;
+ o->highlight = -1;
+ o->snippets = -1;
+}
+
+static void
+setup_options(struct mbox *b)
+{
+ b->o = global_options;
+ CLIST_FOR_EACH(struct option_node *, n, options)
+ if (!fnmatch(n->pattern, b->name, 0))
+ {
+ debug("\tApplied options %s\n", n->pattern);
+#define MERGE(f) if (n->o.f >= 0) b->o.f = n->o.f
+ MERGE(priority);
+ MERGE(hide);
+ MERGE(hide_if_empty);
+ MERGE(highlight);
+ MERGE(beep);
+ MERGE(snippets);
+ }
+}