aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe <rbo@gmx.us>2024-01-04 20:20:20 +0100
committerJoe <rbo@gmx.us>2024-01-04 20:20:20 +0100
commit6149c669d1f8da881a58879bc54220be6d25e555 (patch)
tree0eb7ca76892454112cc0d6f279ea0d8749b1e9ca
parentunique id maybe? (diff)
downloadhardflip-6149c669d1f8da881a58879bc54220be6d25e555.tar.gz
hardflip-6149c669d1f8da881a58879bc54220be6d25e555.tar.bz2
hardflip-6149c669d1f8da881a58879bc54220be6d25e555.tar.xz
hardflip-6149c669d1f8da881a58879bc54220be6d25e555.tar.zst
hardflip-6149c669d1f8da881a58879bc54220be6d25e555.zip
ok this is great
Diffstat (limited to '')
-rw-r--r--c_hardflip.go24
-rw-r--r--c_ldirs.go12
-rw-r--r--c_lhosts.go12
3 files changed, 42 insertions, 6 deletions
diff --git a/c_hardflip.go b/c_hardflip.go
index f11cf19..1e232a1 100644
--- a/c_hardflip.go
+++ b/c_hardflip.go
@@ -62,6 +62,11 @@ type HardData struct {
data_dir string
}
+type HardSel interface {
+ is_dir() bool
+ get_id() uint64
+}
+
func main() {
data_dir := c_get_data_dir()
opts := HardOpts{true, true, false}
@@ -73,19 +78,26 @@ func main() {
opts,
data_dir,
}
- for dir := ldirs.head; dir != nil ; dir = dir.next {
+
+ for sel := ldirs.head; sel != nil ; sel = sel.next {
spaces := ""
- for i := 0; i < int(dir.Depth - 1) * 2; i++ {
+ for i := 0; i < int(sel.Depth - 1) * 2; i++ {
spaces += " "
}
- fmt.Println(dir.ID, spaces, dir.Name, "DIR")
- for host := dir.lhost.head; host != nil; host = host.next {
+ if sel.is_dir() == true {
+ fmt.Print(spaces, "DIR ", sel.ID, " ")
+ }
+ fmt.Println(sel.Name)
+ for sel := sel.lhost.head; sel != nil; sel = sel.next {
spaces := ""
- for i := 0; i < int(host.Parent.Depth - 1) * 2; i++ {
+ for i := 0; i < int(sel.Parent.Depth - 1) * 2; i++ {
spaces += " "
}
spaces += " "
- fmt.Println(host.ID, spaces, host.Name, "HOST")
+ if sel.is_dir() == false {
+ fmt.Print(spaces, "HOST ", sel.ID, " ")
+ }
+ fmt.Println(sel.Name)
}
}
// for dir := ldirs.head; dir != nil ; dir = dir.next {
diff --git a/c_ldirs.go b/c_ldirs.go
index b647944..4533d57 100644
--- a/c_ldirs.go
+++ b/c_ldirs.go
@@ -126,3 +126,15 @@ func (ldirs *DirsList) count() (uint64, uint64) {
}
return count_dirs, count_hosts
}
+
+func (dir *DirsNode) is_dir() bool {
+ return true
+}
+
+func (dir *DirsNode) get_id() uint64 {
+ return dir.ID
+}
+
+func (dir *DirsNode) get_next() *DirsNode {
+ return dir.next
+}
diff --git a/c_lhosts.go b/c_lhosts.go
index 6e7ea77..0b7f702 100644
--- a/c_lhosts.go
+++ b/c_lhosts.go
@@ -152,3 +152,15 @@ func (lhost *HostList) count() uint64 {
}
return count
}
+
+func (host *HostNode) is_dir() bool {
+ return false
+}
+
+func (host *HostNode) get_id() uint64 {
+ return host.ID
+}
+
+func (host *HostNode) get_next() *HostNode {
+ return host.next
+}