all: nwhod nwho
-nwhod: nwhod.o
+nwhod: nwhod.o util.o
nwhod.o: nwhod.c nwho.h
+util.o: util.c nwho.h
-nwho: nwho.o
+nwho: nwho.o util.o
nwho.o: nwho.c nwho.h
clean:
{
return sizeof(struct nwho_pkt) - (MAX_USERS - ntohl(pkt->num_users))*sizeof(struct userinfo);
}
+
+/* util.c */
+
+void die(char *msg, ...) __attribute__((noreturn));
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <stdarg.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/socket.h>
static time_t now, last_local_scan;
static char hostname[64];
-static void die(char *msg, ...) __attribute__((noreturn));
-
-static void
-die(char *msg, ...)
-{
- va_list args;
-
- va_start(args, msg);
- fprintf(stderr, "nwhod: ");
- vfprintf(stderr, msg, args);
- fputc('\n', stderr);
- exit(1);
-}
-
static void
net_init(char *name)
{
--- /dev/null
+/*
+ * The Remote User Information Lister -- Utility Functions
+ *
+ * (c) 1997--2010 Martin Mares <mj@ucw.cz>
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+
+#include "nwho.h"
+
+void
+die(char *msg, ...)
+{
+ va_list args;
+
+ va_start(args, msg);
+ fprintf(stderr, "nwhod: ");
+ vfprintf(stderr, msg, args);
+ fputc('\n', stderr);
+ exit(1);
+}
+