]> git.sur5r.net Git - cc65/blobdiff - src/sp65/input.c
Added parsing of arguments to --read. The explicit format spec is currently
[cc65] / src / sp65 / input.c
index d7b17686f49b09f5f9289cbe02031554f7f90718..735e4920c163dfe14489c2c1f5dd947f8c4f57f0 100644 (file)
@@ -36,7 +36,7 @@
 /* common */
 #include "fileid.h"
 
-/* sp65 */        
+/* sp65 */
 #include "error.h"
 #include "input.h"
 #include "pcx.h"
@@ -78,6 +78,19 @@ static const FileId FormatTable[] = {
 
 
 
+int FindInputFormat (const char* Name)
+/* Find an input format by name. The function returns a value less than zero
+ * if Name is not a known input format.
+ */
+{
+    /* Search for the entry in the table */
+    const FileId* F = GetFileId (Name, FormatTable,
+                                 sizeof (FormatTable) / sizeof (FormatTable[0]));
+    return (F == 0)? -1 : F->Id;
+}
+
+
+
 Bitmap* ReadInputFile (const char* Name, InputFormat Format)
 /* Read a bitmap from a file and return it. If Format is ifAuto, the routine
  * tries to determine the format from the file name extension.