Index: Makefile
--- Makefile.orig	2003-10-20 22:23:19.000000000 +0200
+++ Makefile	2004-05-18 10:38:54.000000000 +0200
@@ -3,12 +3,15 @@
 mandir = $(prefix)/share/man
 docdir = $(prefix)/share/doc
 INSTALL = install
-CFLAGS = -Wall -g3
+CC      = cc
+CFLAGS  =
+LDFLAGS =
+LIBS    = -lpopt -lsmbclient
 
 all: smbget
 
 smbget: smbget.o
-	$(CC) -o $@ $< -lpopt -lsmbclient
+	$(CC) -o $@ $< $(LDFLAGS) $(LIBS)
 
 %.o: %.c
 	$(CC) $(CFLAGS) -c $< -o $@ -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
Index: smbget.c
--- smbget.c.orig	2003-11-15 18:15:03.000000000 +0100
+++ smbget.c	2004-05-18 10:45:38.000000000 +0200
@@ -6,7 +6,6 @@
 #define VERSION "0.6"
 
 #define _GNU_SOURCE
-#include <malloc.h>
 #include <stdio.h>
 #include <string.h>
 #include <unistd.h>
@@ -29,6 +28,27 @@
 #define OFF_T_FORMAT "%ld"
 #endif
 
+static size_t my_strnlen(const char *string, size_t maxlen)
+{
+    const char *end = memchr(string, '\0', maxlen);
+    return end ? end - string : maxlen;
+}
+
+static char *my_strndup(const char *s, size_t n)
+{
+    size_t len;
+    char *new;
+
+    len = my_strnlen(s, n);
+    if ((new = malloc(len + 1)) == NULL)
+        return NULL;
+    new[len] = '\0';
+    memcpy(new, s, len);
+    return new;
+}
+
+#define strndup my_strndup
+
 int columns = 0;
 
 time_t total_start_time = 0;
