From: Jouni Malinen Date: Sat, 20 Nov 2010 10:41:15 +0000 (+0200) Subject: edit: Sort completion list X-Git-Tag: hostap-1-bp~780 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ef6ee3e5a3bd231d40eec3ee0a480f8de8ab696e;p=thirdparty%2Fhostap.git edit: Sort completion list --- diff --git a/src/utils/edit.c b/src/utils/edit.c index 448d584df..69daeaaa7 100644 --- a/src/utils/edit.c +++ b/src/utils/edit.c @@ -349,6 +349,11 @@ static int max_common_length(char **c) } +static int cmp_str(const void *a, const void *b) +{ + return os_strcmp(* (const char **) a, * (const char **) b); +} + static void complete(int list) { char **c; @@ -379,6 +384,7 @@ static void complete(int list) len = max_common_length(c); if (len <= plen && count > 1) { if (list) { + qsort(c, count, sizeof(char *), cmp_str); edit_clear_line(); printf("\r"); for (i = 0; c[i]; i++)