+/*
+ This is a bit complicated, so let me explain it in details. All lines that
+ were read from the local file (the only one we will ever modify) are stored
+ in a (doubly) linked list. Our problem is to know at which position in this
+ list should we insert the new entries/subgroups. To solve it we keep three
+ variables for each group: m_pLine, m_pLastEntry and m_pLastGroup.
+
+ m_pLine points to the line containing "[group_name]"
+ m_pLastEntry points to the last entry of this group in the local file.
+ m_pLastGroup subgroup
+
+ Initially, they're NULL all three. When the group (an entry/subgroup) is read
+ from the local file, the corresponding variable is set. However, if the group
+ was read from the global file and then modified or created by the application
+ these variables are still NULL and we need to create the corresponding lines.
+ See the following functions (and comments preceding them) for the details of
+ how we do it.
+
+ Also, when our last entry/group are deleted we need to find the new last
+ element - the code in DeleteEntry/Subgroup does this by backtracking the list
+ of lines until it either founds an entry/subgroup (and this is the new last
+ element) or the m_pLine of the group, in which case there are no more entries
+ (or subgroups) left and m_pLast<element> becomes NULL.
+
+ NB: This last problem could be avoided for entries if we added new entries
+ immediately after m_pLine, but in this case the entries would appear
+ backwards in the config file (OTOH, it's not that important) and as we
+ would still need to do it for the subgroups the code wouldn't have been
+ significantly less complicated.
+ */
+
+// Return the line which contains "[our name]". If we're still not in the list,
+// add our line to it immediately after the last line of our parent group if we
+// have it or in the very beginning if we're the root group.