From 52af611753d12db045528cd719c5e51167d8f085 Mon Sep 17 00:00:00 2001 From: handa Date: Fri, 4 Jun 2004 11:44:25 +0000 Subject: [PATCH] (compare_coding_name): New function. (list_coding): Sort the list of codings by their names. --- example/mconv.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/example/mconv.c b/example/mconv.c index 378733b..7aec262 100644 --- a/example/mconv.c +++ b/example/mconv.c @@ -138,6 +138,15 @@ /* Print all coding system names. */ +int +compare_coding_name (const void *elt1, const void *elt2) +{ + const MSymbol *n1 = elt1; + const MSymbol *n2 = elt2; + + return strcmp (msymbol_name (*n1), msymbol_name (*n2)); +} + void list_coding () { @@ -147,6 +156,7 @@ list_coding () int len, clm; n = mconv_list_codings (&codings); + qsort (codings, n, sizeof (MSymbol), compare_coding_name); clm = 0; for (i = 0; i < n; i++) { -- 1.7.10.4