make hexdump return a 'char *' rather than printing by itself

diff --git a/src/input/ipaccess.c b/src/input/ipaccess.c
index 98f47fb..6c83d6d 100644
--- a/src/input/ipaccess.c
+++ b/src/input/ipaccess.c
@@ -124,10 +124,7 @@
 	if (hh->proto == IPAC_PROTO_IPACCESS)
 		return ipaccess_rcvmsg(msg, bfd->fd);
 
-	if (debug_mask & DMI) { 
-		fprintf(stdout, "RX %u: ", ts_nr);
-		hexdump(msgb_l2(msg), ret);
-	}
+	DEBUGP(DMI, "RX %u: %s\n", ts_nr, hexdump(msgb_l2(msg), ret));
 
 	link = e1inp_lookup_sign_link(e1i_ts, 0, hh->proto);
 	if (!link) {
@@ -197,10 +194,7 @@
 		return -EINVAL;
 	}
 
-	if (debug_mask & DMI) {
-		fprintf(stdout, "TX %u: ", ts_nr);
-		hexdump(l2_data, hh->len);
-	}
+	DEBUGP(DMI, "TX %u: %s\n", ts_nr, hexdump(l2_data, hh->len));
 
 	ret = send(bfd->fd, msg->data, msg->len, 0);
 	msgb_free(msg);
diff --git a/src/input/misdn.c b/src/input/misdn.c
index 8acf4c9..245df50 100644
--- a/src/input/misdn.c
+++ b/src/input/misdn.c
@@ -148,10 +148,7 @@
 		break;
 	case DL_DATA_IND:
 		msg->l2h = msg->data + MISDN_HEADER_LEN;
-		if (debug_mask & DMI) { 
-			fprintf(stdout, "RX: ");
-			hexdump(msgb_l2(msg), ret - MISDN_HEADER_LEN);
-		}
+		DEBUGP(DMI, "RX: %s\n", hexdump(msgb_l2(msg), ret - MISDN_HEADER_LEN));
 		ret = e1inp_rx_ts(e1i_ts, msg, l2addr.tei, l2addr.sapi);
 		break;
 	default:
@@ -185,10 +182,8 @@
 	hh = (struct mISDNhead *) msgb_push(msg, sizeof(*hh));
 	hh->prim = DL_DATA_REQ;
 
-	if (debug_mask & DMI) {
-		fprintf(stdout, "TX TEI(%d): ", sign_link->tei);
-		hexdump(l2_data, msg->len - MISDN_HEADER_LEN);
-	}
+	DEBUGP(DMI, "TX TEI(%d): %s\n", sign_link->tei,
+		hexdump(l2_data, msg->len - MISDN_HEADER_LEN));
 
 	/* construct the sockaddr */
 	sa.family = AF_ISDN;
@@ -223,10 +218,8 @@
 
 	subchan_mux_out(mx, tx_buf+sizeof(*hh), BCHAN_TX_GRAN);
 
-	if (debug_mask & DMIB) {
-		fprintf(stdout, "BCHAN TX: ");
-		hexdump(tx_buf+sizeof(*hh), BCHAN_TX_GRAN);
-	}
+	DEBUGP(DMIB, "BCHAN TX: %s\n",
+		hexdump(tx_buf+sizeof(*hh), BCHAN_TX_GRAN));
 
 	ret = send(bfd->fd, tx_buf, sizeof(*hh) + BCHAN_TX_GRAN, 0);
 	if (ret < sizeof(*hh) + BCHAN_TX_GRAN)
@@ -266,10 +259,8 @@
 	switch (hh->prim) {
 	case PH_DATA_IND:
 		msg->l2h = msg->data + MISDN_HEADER_LEN;
-		if (debug_mask & DMIB) {
-			fprintf(stdout, "BCHAN RX: ");
-			hexdump(msgb_l2(msg), ret - MISDN_HEADER_LEN);
-		}
+		DEBUGP(DMIB, "BCHAN RX: %s\n",
+			hexdump(msgb_l2(msg), ret - MISDN_HEADER_LEN));
 		ret = e1inp_rx_ts(e1i_ts, msg, 0, 0);
 		break;
 	case PH_ACTIVATE_IND: