Implement the "m", "o", "g" include modifiers to tweak the permissions,
[rsync/rsync.git] / util.c
diff --git a/util.c b/util.c
index bc01afd..27fd44f 100644 (file)
--- a/util.c
+++ b/util.c
@@ -840,6 +840,25 @@ size_t stringjoin(char *dest, size_t destsize, ...)
        return ret;
 }
 
+/* Append formatted text at *dest_ptr up to a maximum of sz (like snprintf).
+ * On success, advance *dest_ptr and return True; on overflow, return False. */
+BOOL snappendf(char **dest_ptr, size_t sz, const char *format, ...)
+{
+       va_list ap;
+       size_t len;
+       
+       va_start(ap, format);
+       len = vsnprintf(*dest_ptr, sz, format, ap);
+       va_end(ap);
+
+       if (len >= sz)
+               return False;
+       else {
+               *dest_ptr += len;
+               return True;
+       }
+}
+
 int count_dir_elements(const char *p)
 {
        int cnt = 0, new_component = 1;