From d1e2afc6e969fc647394959f03ae0b867385d1a1 Mon Sep 17 00:00:00 2001 From: Joe Date: Wed, 27 Dec 2023 20:20:20 +0100 Subject: aint easy --- c_exec.go | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'c_exec.go') diff --git a/c_exec.go b/c_exec.go index cd7a11c..80fd132 100644 --- a/c_exec.go +++ b/c_exec.go @@ -128,26 +128,23 @@ func c_format_rdp(host *HostNode) []string { return cmd_fmt } -func c_format_cmd(dir_id, host_id uint64, ldirs *DirsList) { +func c_format_cmd(host *HostNode) { var cmd_fmt []string - host := ldirs.sel(dir_id).lhost.sel(host_id) - if host == nil { - c_die("host id not found", nil) - } - if host.Protocol == 0 { + switch host.Protocol { + case 0: cmd_fmt = c_format_ssh(host) - } else if host.Protocol == 1 { + case 1: cmd_fmt = c_format_rdp(host) - } else if host.Protocol > 1 { + default: c_die("type not found", nil) } c_exec_cmd(cmd_fmt) } -func c_exec(dir_id, host_id uint64, ldirs *DirsList) { - if ldirs.head == nil { +func c_exec(host *HostNode) { + if host == nil { return } - c_format_cmd(dir_id, host_id, ldirs) + c_format_cmd(host) } -- cgit v1.2.3