mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 01:57:45 +00:00
Add some basic setgroups(), getgroups() and initgroups().
Also teach /bin/id to print the user's supplemental groups.
This commit is contained in:
parent
d3bd3791cb
commit
a7f1d892a9
12 changed files with 167 additions and 19 deletions
|
@ -8,6 +8,7 @@ template<typename T>
|
|||
class DoublyLinkedList {
|
||||
private:
|
||||
struct Node {
|
||||
explicit Node(const T& v) : value(v) { }
|
||||
explicit Node(T&& v) : value(move(v)) { }
|
||||
T value;
|
||||
Node* next { nullptr };
|
||||
|
@ -38,17 +39,13 @@ public:
|
|||
|
||||
void append(T&& value)
|
||||
{
|
||||
auto* node = new Node(move(value));
|
||||
if (!m_head) {
|
||||
ASSERT(!m_tail);
|
||||
m_head = node;
|
||||
m_tail = node;
|
||||
return;
|
||||
}
|
||||
ASSERT(m_tail);
|
||||
m_tail->next = node;
|
||||
node->prev = m_tail;
|
||||
m_tail = node;
|
||||
append_node(new Node(move(value)));
|
||||
|
||||
}
|
||||
|
||||
void append(const T& value)
|
||||
{
|
||||
append_node(new Node(value));
|
||||
}
|
||||
|
||||
bool containsSlow(const T& value) const
|
||||
|
@ -136,6 +133,20 @@ public:
|
|||
private:
|
||||
friend class Iterator;
|
||||
|
||||
void append_node(Node* node)
|
||||
{
|
||||
if (!m_head) {
|
||||
ASSERT(!m_tail);
|
||||
m_head = node;
|
||||
m_tail = node;
|
||||
return;
|
||||
}
|
||||
ASSERT(m_tail);
|
||||
m_tail->next = node;
|
||||
node->prev = m_tail;
|
||||
m_tail = node;
|
||||
}
|
||||
|
||||
Node* head() { return m_head; }
|
||||
const Node* head() const { return m_head; }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue