]> diplodocus.org Git - nmh/blobdiff - h/addrsbr.h
new.c: Order two return statements to match comment.
[nmh] / h / addrsbr.h
index 25d6a755ee0ff5498444689c9f340bb3a5966f0e..a9e989781282939db574cf7a4a392b577fc73fdc 100644 (file)
@@ -1,12 +1,6 @@
-
-/*
- * addrsbr.h -- definitions for the address parsing system
+/* addrsbr.h -- definitions for the address parsing system
  */
 
  */
 
-#define        AD_HOST 1               /* getm(): lookup official hostname    */
-#define        AD_NHST 0               /* getm(): do not lookup official name */
-#define        AD_NAME AD_NHST         /* AD_HOST is TOO slow                 */
-
 #define        UUCPHOST        (-1)
 #define        LOCALHOST       0
 #define        NETHOST         1
 #define        UUCPHOST        (-1)
 #define        LOCALHOST       0
 #define        NETHOST         1
@@ -32,6 +26,10 @@ struct mailname {
     char *m_note;              /* Note (post-address comment) */
 };
 
     char *m_note;              /* Note (post-address comment) */
 };
 
+/*
+ * See notes for auxformat() below.
+ */
+
 #define        adrformat(m) auxformat ((m), 1)
 
 /*
 #define        adrformat(m) auxformat ((m), 1)
 
 /*
@@ -40,6 +38,12 @@ struct mailname {
 void mnfree(struct mailname *);
 int ismymbox(struct mailname *);
 
 void mnfree(struct mailname *);
 int ismymbox(struct mailname *);
 
+/*
+ * Enable Email Address Internationalization, which requires
+ * support of 8-bit addresses.
+ */
+void enable_eai(void);
+
 /*
  * Parse an address header, and return a sequence of email addresses.
  * This function is the main entry point into the nmh address parser.
 /*
  * Parse an address header, and return a sequence of email addresses.
  * This function is the main entry point into the nmh address parser.
@@ -58,7 +62,23 @@ int ismymbox(struct mailname *);
 
 char *getname(const char *header);
 
 
 char *getname(const char *header);
 
-char *auxformat(struct mailname *, int);
+/*
+ * Format an email address given a struct mailname.
+ *
+ * This function takes a pointer to a struct mailname and returns a pointer
+ * to a static buffer holding the resulting email address.
+ *
+ * It is worth noting that group names are NOT handled, so if you want to
+ * do something with groups you need to handle it externally to this function.
+ *
+ * Arguments include:
+ *
+ * mp          - Pointer to mailname structure
+ * extras      - If true, include the personal name and/or note in the
+ *               address.  Otherwise, omit it.
+ */
+
+char *auxformat(struct mailname *mp, int extras);
 
 /*
  * Parse an email address into it's components.
 
 /*
  * Parse an email address into it's components.
@@ -73,21 +93,17 @@ char *auxformat(struct mailname *, int);
  *               localhost().
  * dftype      - If dfhost is given, use dftype as the email address type
  *               if no host is in the email address.
  *               localhost().
  * dftype      - If dfhost is given, use dftype as the email address type
  *               if no host is in the email address.
- * wanthost    - One of AD_HOST or AD_NHST.  If AD_HOST, look up the
- *               "official name" of the host.  Well, that's what the
- *               documentation says, at least ... support for that
- *               functionality was removed when hostable support was
- *               removed and the address parser was converted by default
- *               to always being in DUMB mode.  So nowadays this only
- *               affects where error messages are put if there is no
- *               host part (set it to AD_HOST if you want error messages
- *               to appear on standard error).
- * eresult     - Any error string returned by the address parser.  String
- *               must contain sufficient room for the error message.
- *               (BUFSIZ is used in general by the code).  Can be NULL.
+ * eresult     - A buffer containing an error message returned by the
+ *               address parser.  May be NULL.
+ * eresultsize - The size of the buffer passed in eresult.
  *
  * A pointer to an allocated struct mailname corresponding to the email
  * address is returned.
  *
  * A pointer to an allocated struct mailname corresponding to the email
  * address is returned.
+ *
+ * This function used to have an argument called 'wanthost' which would
+ * control whether or not it would canonicalize hostnames in email
+ * addresses.  This functionality was removed for nmh 1.5, and eventually
+ * all of the code that used this argument was garbage collected.
  */
  */
-struct mailname *getm(char *str, char *dfhost, int dftype,
-                     int wanthost, char *eresult);
+struct mailname *getm(char *str, char *dfhost, int dftype, char *eresult,
+                     size_t eresultsize);