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:
parent
fbedf6056e
commit
4578a490ce
5 changed files with 54 additions and 16 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue