Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=cfpm.git;a=commitdiff;h=4bb63ecceb15f6b6d84c7bb46f520cb8fed9cfed

commit 4bb63ecceb15f6b6d84c7bb46f520cb8fed9cfed
Author: James Buren <r...@frugalware.org>
Date:   Wed Oct 28 19:58:27 2009 -0500

Utility.c
* add new function

diff --git a/src/Utility.c b/src/Utility.c
index 98aac28..820f216 100644
--- a/src/Utility.c
+++ b/src/Utility.c
@@ -50,3 +50,23 @@ char *xstrdup(const char *str) {

return dup;
}
+
+char *xstrndup(const char *str,size_t num) {
+  size_t len;
+  char *dup;
+
+  assert((str != NULL));
+
+  len = strlen(str);
+
+  if(len > num)
+    len = num;
+
+  dup = xalloc(char,len+1);
+
+  strncpy(dup,str,len);
+
+  dup[len] = '\0';
+
+  return dup;
+}
_______________________________________________
Frugalware-git mailing list
Frugalware-git@frugalware.org
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to