split the options parsing code into options.c
[rsync/rsync.git] / util.c
diff --git a/util.c b/util.c
index f74228e..9b28cb0 100644 (file)
--- a/util.c
+++ b/util.c
@@ -446,3 +446,12 @@ void kill_all(int sig)
        }
 }
 
+/* like strncpy but does not 0 fill the buffer and always null 
+   terminates (thus it can use maxlen+1 space in d) */
+void strlcpy(char *d, char *s, int maxlen)
+{
+       int len = strlen(s);
+       if (len > maxlen) len = maxlen;
+       memcpy(d, s, len);
+       d[len] = 0;
+}