OSDN Git Service

libjava/
[pf3gnuchains/gcc-fork.git] / libjava / gnu / gcj / convert / gen-from-JIS.c
index 1374580..d4cca14 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999  Free Software Foundation
+/* Copyright (C) 1999, 2008  Free Software Foundation
 
    This file is part of libgcj.
 
@@ -7,6 +7,10 @@ Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
 details.  */
 
 #include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include "make-trie.h"
+
 struct chval
 {
   unsigned char b1;            /* 1st byte */
@@ -59,6 +63,11 @@ main(int argc, char** argv)
   int low1_uc = 0xFFFF, high1_uc = 0;
   int low2_uc = 0xFFFF, high2_uc = 0;
   int i;  int row, col;
+  if (argc < 2)
+    {
+      fprintf (stderr, "missing argument!\n");
+      exit (-1);
+    }
   if (strcmp (argv[1], "JIS0208") == 0)
     chtab = chtab_0208;
   else if (strcmp (argv[1], "JIS0212") == 0)
@@ -106,8 +115,7 @@ main(int argc, char** argv)
 
   fprintf(out,"/* This file is automatically generated from %s.TXT. */\n",
          argv[1]);
-  fprintf(out,"#pragma GCC java_exceptions\n",
-         argv[1]);
+  fprintf(out,"#pragma GCC java_exceptions\n");
   fprintf(out, "unsigned short %s_to_Unicode[%d][%d] = {\n",
          argv[1], max1 - min1 + 1,  max2 - min2 + 1);
   i = 0;
@@ -156,7 +164,7 @@ main(int argc, char** argv)
                }
              else
                {
-                 fprintf (stderr, "error - char table our of order!\n");
+                 fprintf (stderr, "error - char table out of order!\n");
                  exit (-1);
                }
              if (col != max2)