Include <sys/types.h> and "config.h".
[m17n/libotf.git] / example / otfdump.c
index c589d16..3ec19e0 100644 (file)
@@ -23,10 +23,12 @@ write to the Free Software Foundation, Inc., 59 Temple Place, Suite
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <unistd.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
+#include <libgen.h>
 
 #include <otf.h>
 
@@ -865,8 +867,7 @@ dump_lookup_subtable_gsub (int indent, int index, unsigned type,
              subtable->u.extension1.ExtensionOffset);
       dump_lookup_subtable_gsub (indent, index, 
                                 subtable->u.extension1.ExtensionLookupType,
-                                (subtable
-                                 + subtable->u.extension1.ExtensionOffset));
+                                subtable->u.extension1.ExtensionSubtable);
       break;
 
     case 8:
@@ -1089,6 +1090,21 @@ dump_lookup_subtable_gpos (int indent, int index, unsigned type,
       else
        printf (" invalid");
       break;
+
+    case 9:
+      if (subtable->Format == 1)
+       {
+         IPRINT ("(ExtensionLookupType %d)",
+                 subtable->u.extension1.ExtensionLookupType);
+         IPRINT ("(ExtensionOffset %d)",
+                 subtable->u.extension1.ExtensionOffset);
+         dump_lookup_subtable_gpos
+           (indent, index, 
+            subtable->u.extension1.ExtensionLookupType,
+            subtable->u.extension1.ExtensionSubtable);
+       }
+      else
+       printf (" invalid");
     }
   printf (")");
 }
@@ -1387,10 +1403,10 @@ main (int argc, char **argv)
 {
   OTF *otf;
 
-  if (argc != 2)
+  if (argc != 2 || !strcmp (argv[1], "-h") || !strcmp (argv[1], "--help"))
     {
-      fprintf (stderr, "Usage, dtfdump OTF-FILE");
-      exit (1);
+      fprintf (stderr, "Usage: %s OTF-FILE\n", basename (argv[0]));
+      exit (argc != 2);
     }
   
   otf = OTF_open (argv[1]);