-/*
- * mime_type.c -- routine to determine the MIME Content-Type of a file
+/* mime_type.c -- routine to determine the MIME Content-Type of a file
*
* This code is Copyright (c) 2014, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
#include <h/mh.h>
#include <h/utils.h>
#include <h/tws.h>
+#include "mime_type.h"
#ifdef MIMETYPEPROC
static char *get_file_info(const char *, const char *);
if ((p = strrchr(file_name, '.')) != NULL) {
for (np = m_defs; np; np = np->n_next) {
if (strncasecmp(np->n_name, "mhshow-suffix-", 14) == 0 &&
- strcasecmp(p, np->n_field ? np->n_field : "") == 0) {
+ strcasecmp(p, FENDNULL(np->n_field)) == 0) {
content_type = strdup(np->n_name + 14);
break;
}
FILE *fp;
if ((fp = popen(cmd, "r")) != NULL) {
- char buf[BUFSIZ >= 2048 ? BUFSIZ : 2048];
+ char buf[max(BUFSIZ, 2048)];
buf[0] = '\0';
if (fgets(buf, sizeof buf, fp)) {