 +
 +/*** EXTRACTOR STUFF ***/
 +
-+static void extract_monsterdata_to_haskell(FILE* f);
-+static void extract_itemdata_to_haskell(FILE* f);
++#include "date.h"
++static void extract_monsterdata_to_haskell(
++        FILE* f
++      , const char* variant
++      , const char* command_prefix );
++static const char* detect_variant( const char** command_prefix );
 +
 +static int extract_data(int argc, char* argv[])
 +{
 +    FILE* f;
++    char name[300];
++    const char* command_prefix, *variant_str;
 +
 +    if (argc <= 1)
 +    {
 +        printf("Usage:\n");
 +        printf("%s [language]\n\n", argv[0]);
 +        printf("Where language is one of: \n");
-+        printf("  haskell [monster-data-file] [item-data-file]\n\n");
-+        printf("Monster data file defaults to MonsterData.hs and \n");
-+        printf("item data file defaults to ItemData.hs.\n\n");
++        printf("  haskell\n\n");
 +        return 0;
 +    }
 +
++    variant_str = detect_variant( &command_prefix );
++    sprintf( name, "%s.hs", variant_str );
 +    if (argc >= 2 && !strcmp(argv[1], "haskell"))
 +    {
-+        if (argc >= 3)
-+            f = fopen(argv[2], "wb");
-+        else
-+            f = fopen("MonsterData.hs", "wb");
++        fprintf( stderr, "Writing to '%s'...\n", variant_str );
++        f = fopen(name, "wb");
 +        if (!f)
 +        {
 +            perror("fopen");
 +            return -1;
 +        }
-+        extract_monsterdata_to_haskell(f);
++        extract_monsterdata_to_haskell(f, variant_str, command_prefix );
 +        fclose(f);
-+
-+        if (argc >= 4)
-+            f = fopen(argv[3], "wb");
-+        else
-+            f = fopen("ItemData.hs", "wb");
-+
-+        if (!f)
-+        {
-+            perror("fopen");
-+            return -1;
-+        }
-+
-+        extract_itemdata_to_haskell(f);
-+        fclose(f);
++        fprintf( stderr, "Done.\n" );
 +    }
 +    else
 +    {

+            AT(AD_RBRE, "AdRandomBreath")
+            AT(AD_SAMU, "AdAmuletSteal")
+            AT(AD_CURS, "AdCurse")
+#ifdef AD_LVLT
+            AT(AD_LVLT, "AdLevelTeleport")
+            AT(AD_BLNK, "AdBlink")

 	register int fd;
 #ifdef CHDIR
 	register char *dir;
@@ -538,4 +542,439 @@
 	return;
 }
 
