User`s guide

150
K
A
DAK
KwikNet Low Level Services
kn_dprintf kn_dprintf
Purpose Format and Log a Text Message
Used by
n Task o ISP o Timer Procedure n Restart Procedure n Exit Procedure
Setup Prototype is in file KN_API.H.
#include "KN_LIB.H"
void kn_dprintf(int attrib, const char *fmtp, ...);
Description Attrib is a parameter which defines the message attributes. Applications
should use the value of 0 for attrib. Valid attributes are described in
Chapter 1.6.
Fmtp is a pointer to a format specification string similar to that expected
by the C library procedure printf(). Allowable format specifications
are summarized in the description of procedure kn_fmt().
The format string is followed by zero or more parameters of types
specified by the format string.
Returns Nothing
Example #include "kn_lib.h"
char *bufp; /* Input buffer pointer */
struct in_addr ipaddr; /* IPv4 address (numeric) */
char ipstring[40]; /* IPv4 addr (dotted decimal)*/
bufp = "192. 168. 5"; /* An unusual input string */
if (kn_inet_addr(bufp, &ipaddr) != 1)
kn_dprintf(0, "Conversion of '%s' to 0xC0A80500" \
"(192.168.5.0) failed.\n", bufp);
else if (kn_inet_ntoa(&ipaddr, ipstring) !=
strlen("192.168.5.0"))
kn_dprintf(0, "Conversion to '192.168.5.0' failed.\n");
else {
kn_dprintf(0, "Converted '%s' to 0x%08lx to '%s'.\n",
bufp, ntohl(ipaddr.s_addr), ipstring);
/* The previous message should read: */
/* "Converted '192. 168. 5' to 0xc0a80500 */
/* to '192.168.5.0'." */
}
See Also kn_fmt(), kn_netstats()