mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 16:45:03 +00:00
Add getpwent() family of functions to LibC.
Also add a little /etc/passwd database. There's just me in there.
This commit is contained in:
@@ -75,4 +75,19 @@ ByteBuffer String::toByteBuffer() const
|
||||
return ByteBuffer::copy(reinterpret_cast<const byte*>(characters()), length());
|
||||
}
|
||||
|
||||
unsigned String::toUInt(bool& ok) const
|
||||
{
|
||||
unsigned value = 0;
|
||||
for (size_t i = 0; i < length(); ++i) {
|
||||
if (characters()[i] < '0' || characters()[i] > '9') {
|
||||
ok = false;
|
||||
return 0;
|
||||
}
|
||||
value = value * 10;
|
||||
value += characters()[i] - '0';
|
||||
}
|
||||
ok = true;
|
||||
return value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user