X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fcommand.c;h=a11a8dca9ce220a00e9b69fcf9dbb4cf950e8ad1;hb=0d9ec668b22535ba40fbcd4f15ee2fa13e6048ea;hp=3f0d3fb0d28a20bf017a7902af2b6d79251d9225;hpb=65dff54bd2ed75672de82f4c14ab9fac963eaa86;p=ncmpc.git diff --git a/src/command.c b/src/command.c index 3f0d3fb..a11a8dc 100644 --- a/src/command.c +++ b/src/command.c @@ -254,6 +254,30 @@ get_command_definitions(void) { return cmds; } + +size_t +get_cmds_max_name_width(command_definition_t *c) +{ + static size_t max = 0; + + if (max != 0) + return max; + + size_t len; + command_definition_t *p; + + for (p = c; p->name != NULL; p++) { + /* + * width and length are considered the same here, as command + * names are not translated. + */ + len = (size_t) strlen(p->name); + if (len > max) + max = len; + } + + return max; +} #endif const char *