From 3edca0fd3c5b0411ef2dc95bfe9f34865b5fb55f Mon Sep 17 00:00:00 2001 From: Joe Date: Thu, 21 Dec 2023 20:20:20 +0100 Subject: must rewrite inti --- c_ldirs.go | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'c_ldirs.go') diff --git a/c_ldirs.go b/c_ldirs.go index df2e373..03d5657 100644 --- a/c_ldirs.go +++ b/c_ldirs.go @@ -39,7 +39,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * hardflip: src/c_ldirs.go - * Thu Dec 21 14:03:40 2023 + * Thu Dec 21 18:06:00 2023 * Joe * * the directories linked list @@ -57,3 +57,18 @@ type DirsNode struct { type DirsList struct { head *DirsNode } + +// adds a directory node to the list +func (ldirs *DirsList) add_back(node *DirsNode) { + new_node := node + + if ldirs.head == nil { + ldirs.head = new_node + return + } + curr := ldirs.head + for curr.next != nil { + curr = curr.next + } + curr.next = new_node +} -- cgit v1.2.3