V25 with 64-bit support
[pforth] / csrc / pf_main.c
index 9d8568d..df38d0c 100644 (file)
@@ -66,14 +66,14 @@ int main( int argc, char **argv )
        const char *SourceName = NULL;\r
        char IfInit = FALSE;\r
        char *s;\r
        const char *SourceName = NULL;\r
        char IfInit = FALSE;\r
        char *s;\r
-       int32 i;\r
+       cell_t i;\r
        int Result;\r
 \r
 /* For Metroworks on Mac */\r
 #ifdef __MWERKS__\r
        argc = ccommand(&argv);\r
 #endif\r
        int Result;\r
 \r
 /* For Metroworks on Mac */\r
 #ifdef __MWERKS__\r
        argc = ccommand(&argv);\r
 #endif\r
-\r
+       \r
 /* Parse command line. */\r
        for( i=1; i<argc; i++ )\r
        {\r
 /* Parse command line. */\r
        for( i=1; i<argc; i++ )\r
        {\r
@@ -90,13 +90,25 @@ int main( int argc, char **argv )
                                IfInit = TRUE;\r
                                DicName = NULL;\r
                                break;\r
                                IfInit = TRUE;\r
                                DicName = NULL;\r
                                break;\r
+                               \r
                        case 'q':\r
                                pfSetQuiet( TRUE );\r
                                break;\r
                        case 'q':\r
                                pfSetQuiet( TRUE );\r
                                break;\r
+                               \r
                        case 'd':\r
                                if( *s != '\0' ) DicName = s;\r
                        case 'd':\r
                                if( *s != '\0' ) DicName = s;\r
-                               else DicName = PF_DEFAULT_DICTIONARY;\r
+                               // Allow space after -d (Thanks Aleksej Saushev)\r
+                               // Make sure there is another argument.\r
+                               else if( (i+1) < argc )\r
+                               {\r
+                                       DicName = argv[++i];\r
+                               }\r
+                               if (DicName == NULL || *DicName == '\0')\r
+                               {\r
+                                       DicName = PF_DEFAULT_DICTIONARY;\r
+                               }\r
                                break;\r
                                break;\r
+                               \r
                        default:\r
                                ERR(("Unrecognized option!\n"));\r
                                ERR(("pforth {-i} {-q} {-dfilename.dic} {sourcefilename}\n"));\r
                        default:\r
                                ERR(("Unrecognized option!\n"));\r
                                ERR(("pforth {-i} {-q} {-dfilename.dic} {sourcefilename}\n"));\r