| 58 | }; |
| 59 | |
| 60 | static int |
| 61 | ConnectCmd(int ac, char **av) |
| 62 | { |
| 63 | struct ngm_connect con; |
| 64 | const char *path = "."; |
| 65 | |
| 66 | /* Get arguments */ |
| 67 | switch (ac) { |
| 68 | case 5: |
| 69 | path = av[1]; |
| 70 | ac--; |
| 71 | av++; |
| 72 | /* FALLTHROUGH */ |
| 73 | case 4: |
| 74 | snprintf(con.path, sizeof(con.path), "%s", av[1]); |
| 75 | snprintf(con.ourhook, sizeof(con.ourhook), "%s", av[2]); |
| 76 | snprintf(con.peerhook, sizeof(con.peerhook), "%s", av[3]); |
| 77 | break; |
| 78 | default: |
| 79 | return (CMDRTN_USAGE); |
| 80 | } |
| 81 | |
| 82 | /* Send message */ |
| 83 | if (NgSendMsg(csock, path, NGM_GENERIC_COOKIE, |
| 84 | NGM_CONNECT, &con, sizeof(con)) < 0) { |
| 85 | warn("send msg"); |
| 86 | return (CMDRTN_ERROR); |
| 87 | } |
| 88 | return (CMDRTN_OK); |
| 89 | } |
| 90 | |