1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-27 04:21:16 +02:00

* Parse multi-valued options.

This commit is contained in:
Eelco Dolstra 2005-09-22 15:43:22 +00:00
parent fbedf6056e
commit 4578a490ce
5 changed files with 54 additions and 16 deletions

View file

@ -665,6 +665,21 @@ Strings unpackStrings(const string & s)
}
Strings tokenizeString(const string & s, const string & separators)
{
Strings result;
string::size_type pos = s.find_first_not_of(separators, 0);
while (pos != string::npos) {
string::size_type end = s.find_first_of(separators, pos + 1);
if (end == string::npos) end = s.size();
string token(s, pos, end - pos);
result.push_back(token);
pos = s.find_first_not_of(separators, end);
}
return result;
}
string statusToString(int status)
{
if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) {