#include <arpa/inet.h>
#include <fcntl.h>
#include <ifaddrs.h>
+#include <limits.h>
#include <locale.h>
#include <netdb.h>
#include <stdarg.h>
return smprintf("%d", entropy);
}
+/* hostname */
+char *
+hostname(const char *null)
+{
+ char hostname[HOST_NAME_MAX];
+ FILE *fp;
+
+ /* open hostname file */
+ if (!(fp = fopen("/proc/sys/kernel/hostname", "r"))) {
+ fprintf(stderr, "Could not open hostname file.\n");
+ return smprintf("n/a");
+ }
+
+ /* extract hostname */
+ fscanf(fp, "%s\n", hostname);
+
+ /* close hostname file */
+ fclose(fp);
+
+ /* return entropy */
+ return smprintf("%s", hostname);
+}
+
/* ip address */
char *
ip(const char *interface)