X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/4e6bc7b6d19bd083ee0446a3a7f2968a1b9dba20..9cca3d060843239d619fa41168cb6342d6ac5461:/h/addrsbr.h diff --git a/h/addrsbr.h b/h/addrsbr.h index a753e623..1b147f68 100644 --- a/h/addrsbr.h +++ b/h/addrsbr.h @@ -3,10 +3,6 @@ * 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 @@ -32,6 +28,10 @@ struct mailname { char *m_note; /* Note (post-address comment) */ }; +/* + * See notes for auxformat() below. + */ + #define adrformat(m) auxformat ((m), 1) /* @@ -40,6 +40,12 @@ struct mailname { void mnfree(struct mailname *); int ismymbox(struct mailname *); +/* + * Enable Email Address Internationalization, which requires + * support of 8-bit addresses. + */ +void enable_eai(); + /* * Parse an address header, and return a sequence of email addresses. * This function is the main entry point into the nmh address parser. @@ -57,8 +63,24 @@ int ismymbox(struct mailname *); */ char *getname(const char *header); -char *getlocaladdr(void); -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. @@ -73,21 +95,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. - * 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. + * + * This function used to have an argument called 'wanthost' which would + * control whether or not it would canonicalize hostnames in email + * addresses. This functionalit 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);