From: handa Date: Fri, 4 Jun 2004 11:44:25 +0000 (+0000) Subject: (compare_coding_name): New function. X-Git-Tag: withdl~105 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=52af611753d12db045528cd719c5e51167d8f085;p=m17n%2Fm17n-lib.git (compare_coding_name): New function. (list_coding): Sort the list of codings by their names. --- 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++) {