MCPcopy Create free account
hub / github.com/F-Stack/f-stack / MkPeerCmd

Function MkPeerCmd

tools/ngctl/mkpeer.c:60–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58};
59
60static int
61MkPeerCmd(int ac, char **av)
62{
63 struct ngm_mkpeer mkp;
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(mkp.type, sizeof(mkp.type), "%s", av[1]);
75 snprintf(mkp.ourhook, sizeof(mkp.ourhook), "%s", av[2]);
76 snprintf(mkp.peerhook, sizeof(mkp.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_MKPEER, &mkp, sizeof(mkp)) < 0) {
85 warn("send msg");
86 return (CMDRTN_ERROR);
87 }
88 return (CMDRTN_OK);
89}
90

Callers

nothing calls this directly

Calls 2

snprintfFunction · 0.85
NgSendMsgFunction · 0.85

Tested by

no test coverage detected