Last change
on this file since 559 was
444,
checked in by satin@…, 6 years ago
|
add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc
|
File size:
746 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 <errno.h> |
---|
8 | #include <sys/types.h> |
---|
9 | #include <stdlib.h> |
---|
10 | #include <string.h> |
---|
11 | #include <argz.h> |
---|
12 | |
---|
13 | error_t |
---|
14 | argz_add_sep (char **argz, |
---|
15 | size_t *argz_len, |
---|
16 | const char *str, |
---|
17 | int sep) |
---|
18 | { |
---|
19 | char *str_argz = 0; |
---|
20 | size_t str_argz_len = 0; |
---|
21 | size_t last = *argz_len; |
---|
22 | |
---|
23 | argz_create_sep (str, sep, &str_argz, &str_argz_len); |
---|
24 | |
---|
25 | if (str_argz_len) |
---|
26 | { |
---|
27 | *argz_len += str_argz_len; |
---|
28 | |
---|
29 | if(!(*argz = (char *)realloc(*argz, *argz_len))) |
---|
30 | return ENOMEM; |
---|
31 | |
---|
32 | memcpy(*argz + last, str_argz, str_argz_len); |
---|
33 | } |
---|
34 | return 0; |
---|
35 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.