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 
13 char *
argz_next(char * argz,size_t argz_len,const char * entry)14 argz_next (char *argz,
15        size_t argz_len,
16        const char *entry)
17 {
18   if (entry)
19     {
20       while(*entry != '\0')
21         entry++;
22       entry++;
23 
24       if (entry >= argz + argz_len)
25         return NULL;
26       else
27         return (char *) entry;
28     }
29   else
30     {
31       if (argz_len > 0)
32         return (char *) argz;
33       else
34         return NULL;
35     }
36 }
37