MCPcopy Create free account
hub / github.com/NetHack/NetHack / count_bind_keys

Function count_bind_keys

src/cmd.c:2207–2231  ·  view source on GitHub ↗

return number of extended commands bound to a non-default key */

Source from the content-addressed store, hash-verified

2205
2206/* return number of extended commands bound to a non-default key */
2207int
2208count_bind_keys(void)
2209{
2210 struct Cmd_bind *bind = gc.Cmd.cmdbinds;
2211 int i, nbinds = 0;
2212 uchar keys[256];
2213
2214 (void) memset(keys, 0, sizeof(uchar) * 256);
2215
2216 /* commands bound to different key */
2217 while (bind) {
2218 keys[bind->key] = 1;
2219 if (bind->userbind && bind->cmd && bind->cmd->key != bind->key) {
2220 nbinds++;
2221 }
2222 bind = bind->next;
2223 }
2224
2225 /* commands which should be bound to a key, but aren't */
2226 for (i = 0; i < extcmdlist_length; i++)
2227 if (extcmdlist[i].key && !keys[extcmdlist[i].key])
2228 nbinds++;
2229
2230 return nbinds;
2231}
2232
2233/* show changed key bindings in text, or if sbuf is non-null, append to it */
2234void

Callers 2

optfn_o_bind_keysFunction · 0.85
handler_rebind_keysFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected