This is the mail archive of the cygwin mailing list for the Cygwin project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Here's the code from newlib's argz_insert:
error_t _DEFUN (argz_insert, (argz, argz_len, before, entry), char **argz _AND size_t *argz_len _AND char *before _AND const char *entry) { int len = 0;
if (before == NULL) return argz_add(argz, argz_len, entry);
if (before < *argz || before >= *argz + *argz_len) return EINVAL;
while (before != *argz && before[-1]) before--;
len = strlen(entry) + 1;
if(!(*argz = (char *)realloc(*argz, *argz_len + len))) return ENOMEM;
memmove(before + len, before, *argz + *argz_len - before);
memcpy(before, entry, len);
*argz_len += len;
return 0; }
-- Chuck
-- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |