diff options
author | Jay Freeman <saurik@saurik.com> | 2009-06-18 21:13:38 +0000 |
---|---|---|
committer | Jay Freeman <saurik@saurik.com> | 2009-06-18 21:13:38 +0000 |
commit | 5ed718ec79aa5d126d81cd9453bc00ca20208451 (patch) | |
tree | 72ec0a822ca8dbbe077731c348952ec5918d6d5e /data/ipkg/strndup.diff | |
parent | 2b8a416faa0ffd207f16ff6295d97c26b4bdd597 (diff) |
Added ipkg (for WebOS compatibility).
git-svn-id: http://svn.telesphoreo.org/trunk@621 514c082c-b64e-11dc-b46d-3d985efe055d
Diffstat (limited to 'data/ipkg/strndup.diff')
-rw-r--r-- | data/ipkg/strndup.diff | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/data/ipkg/strndup.diff b/data/ipkg/strndup.diff new file mode 100644 index 000000000..88e742e7f --- /dev/null +++ b/data/ipkg/strndup.diff @@ -0,0 +1,30 @@ +diff -ru ipkg-0.99.163/ipkg_conf.c ipkg-0.99.163+iPhone/ipkg_conf.c +--- ipkg-0.99.163/ipkg_conf.c 2006-04-17 22:20:44.000000000 +0000 ++++ ipkg-0.99.163+iPhone/ipkg_conf.c 2009-06-12 00:16:22.000000000 +0000 +@@ -28,6 +28,26 @@ + #include "str_util.h" + #include "xsystem.h" + ++#ifndef HAVE_STRNDUP ++char * ++strndup (const char *string, size_t length) ++{ ++ char *result; ++ ++ if ((int)strlen (string) < length) ++ return strdup (string); ++ ++ result = (char *)malloc (length + 1); ++ if (!result) ++ return NULL; ++ ++ memcpy (result, string, length); ++ result[length] = '\0'; ++ ++ return result; ++} ++#endif ++ + static int ipkg_conf_parse_file(ipkg_conf_t *conf, const char *filename, + pkg_src_list_t *pkg_src_list, + nv_pair_list_t *tmp_dest_nv_pair_list, |