(VERSION): Set to 1.2.0.
[m17n/m17n-lib.git] / example / mconv.c
index 4c94774..a3f64a2 100644 (file)
@@ -1,4 +1,4 @@
-/* mconv.c -- Code converter.
+/* mconv.c -- Code converter.                          -*- coding: euc-jp; -*-
    Copyright (C) 2003, 2004
      National Institute of Advanced Industrial Science and Technology (AIST)
      Registration Number H15PRO112
    Copyright (C) 2003, 2004
      National Institute of Advanced Industrial Science and Technology (AIST)
      Registration Number H15PRO112
@@ -21,7 +21,7 @@
    02111-1307, USA.  */
 
 /***en
    02111-1307, USA.  */
 
 /***en
-    @page mconv convert file code
+    @enpage mconv convert file code
 
     @section mconv-synopsis SYNOPSIS
 
 
     @section mconv-synopsis SYNOPSIS
 
@@ -73,7 +73,7 @@
     </ul>
 */
 /***ja
     </ul>
 */
 /***ja
-    @page mconv ¥Õ¥¡¥¤¥ë¤Î¥³¡¼¥É¤òÊÑ´¹¤¹¤ë
+    @japage mconv ¥Õ¥¡¥¤¥ë¤Î¥³¡¼¥É¤òÊÑ´¹¤¹¤ë
 
     @section mconv-synopsis SYNOPSIS
 
 
     @section mconv-synopsis SYNOPSIS
 
 #include <m17n.h>
 #include <m17n-misc.h>
 
 #include <m17n.h>
 #include <m17n-misc.h>
 
-#define VERSION "1.0"
+#define VERSION "1.2.0"
 
 /* Print all coding system names.  */
 
 
 /* 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 ()
 {
 void
 list_coding ()
 {
@@ -147,6 +156,7 @@ list_coding ()
   int len, clm;
 
   n = mconv_list_codings (&codings);
   int len, clm;
 
   n = mconv_list_codings (&codings);
+  qsort (codings, n, sizeof (MSymbol), compare_coding_name);
   clm = 0;
   for (i = 0; i < n; i++)
     {
   clm = 0;
   for (i = 0; i < n; i++)
     {
@@ -391,6 +401,8 @@ main (int argc, char **argv)
 
   /* Clear away.  */
   mconv_free_converter (converter);
 
   /* Clear away.  */
   mconv_free_converter (converter);
+  fclose (in);
+  fclose (out);
   m17n_object_unref (mt);
   M17N_FINI ();
   exit (0);
   m17n_object_unref (mt);
   M17N_FINI ();
   exit (0);