/*
SSSD helper calls - can be used by libraries for external use as well
Authors:
Simo Sorce <ssorce@redhat.com>
Copyright (C) 2017 Red Hat
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <talloc.h>
#include <stdbool.h>
#include <errno.h>
#include <ctype.h>
#include <string.h>
#include <strings.h>
#define EOK 0
{
int ret;
int num_strings = 0;
return EINVAL;
}
return ENOMEM;
}
do {
substr_len = 0;
/* If this is not the first substring, then move from the separator. */
}
/* Find end of the first substring */
substr_end++;
substr_len++;
}
if (trim) {
/* Trim leading whitespace */
substr_begin++;
substr_len--;
}
/* Trim trailing whitespace */
substr_end--;
substr_len--;
}
}
/* Copy the substring to the output list of strings */
if (skip_empty == false || substr_len > 0) {
goto done;
}
/* empty string is stored for substr_len == 0 */
goto done;
}
num_strings++;
}
} while (*sep_pos != '\0');
/* No allocations were done, make space for the NULL */
goto done;
}
}
if (size) {
*size = num_strings;
}
done:
return ret;
}
{
size_t c;
return false;
}
return true;
}
}
return false;
}