#include "logging.h"
#include "memory.h"
#include "string2.h"
+#ifdef HAVE_STRINGPREP_H
+#include <stringprep.h>
+#elif defined(HAVE_IDN_STRINGPREP_H)
+#include <idn/stringprep.h>
+#endif
#ifdef HAVE_IDN2_H
#include <idn2.h>
#elif defined(HAVE_IDN_IDN2_H)
return mailbox;
}
+
+/**
+ * mutt_idna_print_version - Create an IDN version string
+ * @retval str Version string
+ *
+ * @note This is a static string and must not be freed.
+ */
+const char *mutt_idna_print_version(void)
+{
+ static char vstring[STRING];
+
+#ifdef HAVE_IDN2_H
+ snprintf(vstring, sizeof(vstring), "libidn2: %s (compiled with %s)",
+ idn2_check_version(NULL), IDN2_VERSION);
+#elif defined(HAVE_LIBIDN)
+ snprintf(vstring, sizeof(vstring), "libidn: %s (compiled with %s)",
+ stringprep_check_version(NULL), STRINGPREP_VERSION);
+#endif
+
+ return vstring;
+}
int mutt_idna_to_ascii_lz(const char *input, char **output, int flags);
char *mutt_idna_intl_to_local(const char *user, const char *domain, int flags);
char *mutt_idna_local_to_intl(const char *user, const char *domain);
+const char *mutt_idna_print_version(void);
+
#endif /* _MUTT_IDNA_H */
#include <unistd.h>
#include "mutt/mutt.h"
#include "mutt_curses.h"
-#ifdef HAVE_STRINGPREP_H
-#include <stringprep.h>
-#elif defined(HAVE_IDN_STRINGPREP_H)
-#include <idn/stringprep.h>
-#endif
-#ifdef HAVE_IDN2_H
-#include <idn2.h>
-#elif defined(HAVE_IDN_IDN2_H)
-#include <idn/idn2.h>
-#elif defined(HAVE_IDNA_H)
-#include <idna.h>
-#elif defined(HAVE_IDN_IDNA_H)
-#include <idn/idna.h>
-#endif
/* #include "protos.h" */
const char *mutt_make_version(void);
printf("\nlibiconv: %d.%d", _LIBICONV_VERSION >> 8, _LIBICONV_VERSION & 0xff);
#endif
-#ifdef HAVE_IDN2_H
- printf("\nlibidn: %s (compiled with %s)", idn2_check_version(NULL), IDN2_VERSION);
-#elif defined(HAVE_LIBIDN)
- printf("\nlibidn: %s (compiled with %s)", stringprep_check_version(NULL), STRINGPREP_VERSION);
+#ifdef HAVE_LIBIDN
+ printf("\n%s", mutt_idna_print_version());
#endif
#ifdef USE_HCACHE