]> diplodocus.org Git - nmh/blobdiff - uip/ali.c
Use pref_encoding() to select the default encoding for all headers.
[nmh] / uip / ali.c
index 880fe2123e4ddbe79216bb06d6d461bf5ad99605..1fa7ef848bca3166fec90df8ce98b3904cc94c2b 100644 (file)
--- a/uip/ali.c
+++ b/uip/ali.c
 #include <h/mts.h>
 #include <h/utils.h>
 
-static struct swit switches[] = {
-#define        ALIASW                0
-    { "alias aliasfile", 0 },
-#define        NALIASW               1
-    { "noalias", -7 },
-#define        LISTSW                2
-    { "list", 0 },
-#define        NLISTSW               3
-    { "nolist", 0 },
-#define        NORMSW                4
-    { "normalize", 0 },
-#define        NNORMSW               5
-    { "nonormalize", 0 },
-#define        USERSW                6
-    { "user", 0 },
-#define        NUSERSW               7
-    { "nouser", 0 },
-#define VERSIONSW             8
-    { "version", 0 },
-#define        HELPSW                9
-    { "help", 0 },
-    { NULL, 0 }
-};
+#define ALI_SWITCHES \
+    X("alias aliasfile", 0, ALIASW) \
+    X("noalias", -7, NALIASW) \
+    X("list", 0, LISTSW) \
+    X("nolist", 0, NLISTSW) \
+    X("normalize", 0, NORMSW) \
+    X("nonormalize", 0, NNORMSW) \
+    X("user", 0, USERSW) \
+    X("nouser", 0, NUSERSW) \
+    X("version", 0, VERSIONSW) \
+    X("help", 0, HELPSW) \
+
+#define X(sw, minchars, id) id,
+DEFINE_SWITCH_ENUM(ALI);
+#undef X
+
+#define X(sw, minchars, id) { sw, minchars, id },
+DEFINE_SWITCH_ARRAY(ALI, switches);
+#undef X
 
 static int pos = 1;
 
@@ -235,8 +231,10 @@ print_usr (char *s, int list, int norm)
        while ((cp = getname (pp))) {
            if ((np = getm (cp, NULL, 0, norm, NULL)) == NULL)
                continue;
-           if (!mh_strcasecmp (mp->m_host, np->m_host)
-                   && !mh_strcasecmp (mp->m_mbox, np->m_mbox)) {
+           if (!strcasecmp (mp->m_host ? mp->m_host : "",
+                            np->m_host ? np->m_host : "")  &&
+               !strcasecmp (mp->m_mbox ? mp->m_mbox : "",
+                            np->m_mbox ? np->m_mbox : "")) {
                vp = vp ? add (ak->ak_name, add (",", vp))
                    : getcpy (ak->ak_name);
                mnfree (np);