#include "qtypes.h"
typedef void (*hashfunc_t) (unsigned char *out, const unsigned char *in, int n);
-qbool hmac(
+qbool d_hmac(
hashfunc_t hfunc, int hlen, int hblock,
unsigned char *out,
const unsigned char *in, int n,
const unsigned char *key, int k
);
-#define HMAC_MDFOUR_16BYTES(out, in, n, key, k) hmac(mdfour, 16, 64, out, in, n, key, k)
-#define HMAC_SHA256_32BYTES(out, in, n, key, k) hmac(sha256, 32, 64, out, in, n, key, k)
+#define HMAC_MDFOUR_16BYTES(out, in, n, key, k) d_hmac(mdfour, 16, 64, out, in, n, key, k)
+#define HMAC_SHA256_32BYTES(out, in, n, key, k) d_hmac(sha256, 32, 64, out, in, n, key, k)
#endif
#pragma comment(lib, "winmm.lib")
#endif
#else
-# ifdef __FreeBSD__
+# if defined(__FreeBSD__) || defined(__NetBSD__)
# include <sys/sysctl.h>
# endif
# include <unistd.h>
#else
static char exenamebuf[MAX_OSPATH+1];
ssize_t n = -1;
+#if defined(__FreeBSD__) || defined(__NetBSD__)
#if defined(__FreeBSD__)
int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1};
+#else
+ int mib[4] = {CTL_KERN, KERN_PROC_ARGS, -1, KERN_PROC_PATHNAME};
+#endif
size_t exenamebuflen = sizeof(exenamebuf)-1;
if (sysctl(mib, 4, exenamebuf, &exenamebuflen, NULL, 0) == 0)
{