aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--c_josh.go5
-rw-r--r--c_lhosts.go11
-rwxr-xr-xjoshbin2924784 -> 2924784 bytes
3 files changed, 15 insertions, 1 deletions
diff --git a/c_josh.go b/c_josh.go
index 2cd6c01..61ee0bb 100644
--- a/c_josh.go
+++ b/c_josh.go
@@ -61,7 +61,10 @@ func display_servers(lhost *HostList) {
curr = curr.next
}
fmt.Println()
- curr = lhost.head
+ curr = lhost.sel(2)
+ if curr == nil {
+ c_die("host id not found", nil)
+ }
fmt.Println ("ssh", "-i", curr.Priv, "-p", strconv.Itoa(int(curr.Port)), curr.User + "@" + curr.Host)
cmd := exec.Command("ssh", "-i", curr.Priv, "-p", strconv.Itoa(int(curr.Port)), curr.User + "@" + curr.Host)
cmd.Stdin = os.Stdin
diff --git a/c_lhosts.go b/c_lhosts.go
index cbe1f71..ac25a3c 100644
--- a/c_lhosts.go
+++ b/c_lhosts.go
@@ -102,3 +102,14 @@ func (lhost *HostList) del(id uint64) {
curr.next = curr.next.next
}
}
+
+func (lhost *HostList) sel(id uint64) *HostNode {
+ curr := lhost.head
+ for curr.next != nil && curr.ID != id {
+ curr = curr.next
+ }
+ if curr.ID != id {
+ return nil
+ }
+ return curr
+}
diff --git a/josh b/josh
index 91cb381..2470e47 100755
--- a/josh
+++ b/josh
Binary files differ