source: trunk/libs/newlib/src/newlib/libc/argz/argz_append.c @ 444

Last change on this file since 444 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 630 bytes
Line 
1/* Copyright (C) 2002 by  Red Hat, Incorporated. All rights reserved.
2 *
3 * Permission to use, copy, modify, and distribute this software
4 * is freely granted, provided that this notice is preserved.
5 */
6
7#include <argz.h>
8#include <errno.h>
9#include <sys/types.h>
10#include <string.h>
11#include <stdlib.h>
12
13error_t
14argz_append (char **argz,
15       size_t *argz_len,
16       const char *buf,
17       size_t buf_len)
18{
19  if (buf_len)
20    {
21      size_t last = *argz_len;
22
23      *argz_len += buf_len;
24
25      if(!(*argz = (char *)realloc(*argz, *argz_len)))
26        return ENOMEM;
27
28      memcpy(*argz + last, buf, buf_len);
29    }
30  return 0;
31}
Note: See TracBrowser for help on using the repository browser.