]> git.ipfire.org Git - thirdparty/glibc.git/blame - string/argz-next.c
Update copyright notices with scripts/update-copyrights
[thirdparty/glibc.git] / string / argz-next.c
CommitLineData
7a12c6bb 1/* Iterate through the elements of an argz block.
d4697bc9 2 Copyright (C) 1995-2014 Free Software Foundation, Inc.
c84142e8 3 This file is part of the GNU C Library.
29659dd2 4 Written by Miles Bader <miles@gnu.org>
7a12c6bb 5
c84142e8 6 The GNU C Library is free software; you can redistribute it and/or
41bdb6e2
AJ
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
7a12c6bb 10
c84142e8
UD
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
7a12c6bb 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
41bdb6e2 14 Lesser General Public License for more details.
7a12c6bb 15
41bdb6e2 16 You should have received a copy of the GNU Lesser General Public
59ba27a6
PE
17 License along with the GNU C Library; if not, see
18 <http://www.gnu.org/licenses/>. */
7a12c6bb
RM
19
20#include <argz.h>
21#include <string.h>
22
23char *
29659dd2 24__argz_next (const char *argz, size_t argz_len, const char *entry)
7a12c6bb
RM
25{
26 if (entry)
27 {
28 if (entry < argz + argz_len)
29 entry = strchr (entry, '\0') + 1;
30
8f0c527e 31 return entry >= argz + argz_len ? NULL : (char *) entry;
7a12c6bb
RM
32 }
33 else
34 if (argz_len > 0)
531e4bca 35 return (char *) argz;
7a12c6bb
RM
36 else
37 return NULL;
38}
39weak_alias (__argz_next, argz_next)