diff options
author | Thomas Fitzsimmons <fitzsim@redhat.com> | 2002-06-14 20:51:09 +0000 |
---|---|---|
committer | Thomas Fitzsimmons <fitzsim@redhat.com> | 2002-06-14 20:51:09 +0000 |
commit | b56d7e7937d0604025833e8c881f96c1d0e4147f (patch) | |
tree | b98ef1a34268c301f83b38c5f32bd03e95292543 /newlib/libc/argz/argz_add_sep.c | |
parent | a77d35f7d207dc7c940a1bef94d42ca66795cb2d (diff) | |
download | newlib-b56d7e7937d0604025833e8c881f96c1d0e4147f.zip newlib-b56d7e7937d0604025833e8c881f96c1d0e4147f.tar.gz newlib-b56d7e7937d0604025833e8c881f96c1d0e4147f.tar.bz2 |
* libc/argz: New directory.
* libc/argz/*: New files.
* libc/argz/argz_add.c: New file.
* libc/argz/argz_add_sep.c: New file.
* libc/argz/argz_append.c: New file.
* libc/argz/argz_count.c: New file.
* libc/argz/argz_create.c: New file.
* libc/argz/argz_create_sep.c: New file.
* libc/argz/argz_delete.c: New file.
* libc/argz/argz_extract.c: New file.
* libc/argz/argz_insert.c: New file.
* libc/argz/argz_next.c: New file.
* libc/argz/argz_replace.c: New file.
* libc/argz/argz_stringify.c: New file.
* libc/argz/buf_findstr.c: New file.
* libc/argz/envz_add.c: New file.
* libc/argz/envz_entry.c: New file.
* libc/argz/envz_get.c: New file.
* libc/argz/envz_merge.c: New file.
* libc/argz/envz_remove.c: New file.
* libc/argz/envz_strip.c: New file.
* libc/include/argz.h: New file.
* libc/include/envz.h: New file.
* Makefile.am (LIBC_OBJECTLISTS): Add
libc/argz/objectlist.awk.in.
* libc/Makefile.am (SUBDIRS): Add argz.
(SUBLIBS): Add argz/libargz.la.
* libc/configure.in (AC_OUTPUT): Add argz/Makefile.
* libc/include/errno.h: Add error_t typedef.
Diffstat (limited to 'newlib/libc/argz/argz_add_sep.c')
-rw-r--r-- | newlib/libc/argz/argz_add_sep.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/newlib/libc/argz/argz_add_sep.c b/newlib/libc/argz/argz_add_sep.c new file mode 100644 index 0000000..e175554 --- /dev/null +++ b/newlib/libc/argz/argz_add_sep.c @@ -0,0 +1,29 @@ +/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved. + * + * Permission to use, copy, modify, and distribute this software + * is freely granted, provided that this notice is preserved. + */ + +#include <errno.h> +#include <sys/types.h> +#include <stdlib.h> +#include <string.h> +#include <argz.h> + +error_t +argz_add_sep (char **argz, size_t *argz_len, const char *str, int sep) +{ + char *str_argz = 0; + size_t str_argz_len = 0; + size_t last = *argz_len; + + argz_create_sep (str, sep, &str_argz, &str_argz_len); + + *argz_len += str_argz_len; + + if(!(*argz = (char *)realloc(*argz, *argz_len))) + return ENOMEM; + + memcpy(*argz + last, str_argz, str_argz_len); + return 0; +} |