Code

Merge remote branches 'jn/keydef' and 'jn/dev'
[ncmpc.git] / src / command.c
index 3f0d3fb0d28a20bf017a7902af2b6d79251d9225..a11a8dca9ce220a00e9b69fcf9dbb4cf950e8ad1 100644 (file)
@@ -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 *