strsep.3: don't silently ignore errors

Reported by:	bde
MFC with:	r334275
This commit is contained in:
Ed Maste 2018-05-28 18:29:15 +00:00
parent 5bd0cf6dc8
commit 0eff530775
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=334291

View File

@ -86,9 +86,10 @@ to parse a string, and prints each token in separate line:
char *token, *string, *tofree;
tofree = string = strdup("abc,def,ghi");
if (string != NULL)
while ((token = strsep(&string, ",")) != NULL)
printf("%s\en", token);
if (string == NULL)
err(1, "strdup");
while ((token = strsep(&string, ",")) != NULL)
printf("%s\en", token);
free(tofree);
.Ed