changeset 9:c1fba4abf56f

Make filename printing optional.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 25 Sep 2014 02:07:49 +0300
parents cfc74ec918dc
children 48a938436cd7 20bcf214b282
files sidinfo.c
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/sidinfo.c	Thu Sep 25 02:07:38 2014 +0300
+++ b/sidinfo.c	Thu Sep 25 02:07:49 2014 +0300
@@ -32,6 +32,7 @@
 
     PSF_DATA_SIZE      = 0x00100000,
     PSF_HASH           = 0x00200000,
+    PSF_FILENAME       = 0x10000000,
 
     PSF_ALL            = 0xffffffff,
 };
@@ -60,6 +61,7 @@
     { PSF_SID_AUTHOR     , "Author"     , NULL },
     { PSF_SID_COPYRIGHT  , "Copyright"  , NULL },
     { PSF_HASH           , "Hash"       , NULL },
+    { PSF_FILENAME       , "Filename"   , NULL },
     { PSF_ALL            , "All"        , NULL },
 };
 
@@ -447,8 +449,11 @@
 #define PR(xindex, xfmt, xaltfmt, ...) siPrintPSIDInfoLine(outFile, parsable, hex, flags, xindex, xfmt, xaltfmt, __VA_ARGS__ )
 
 
-void siPrintPSIDInformation(FILE *outFile, const BOOL parsable, const BOOL hex, const uint32_t flags, const PSIDHeader *psid)
+void siPrintPSIDInformation(FILE *outFile, const BOOL parsable, const BOOL hex,
+    const uint32_t flags, const char *filename, const PSIDHeader *psid)
 {
+    PR(12, "%s", NULL, filename);
+
     PR( 0, "%s", NULL, psid->magic);
     PR( 1, "%d.%d", NULL, (psid->version & 0xff), (psid->version >> 8));
     PR( 2, "%d", "$%08x", psid->dataOffset);
@@ -506,8 +511,7 @@
         goto error;
 
     // Output
-    fprintf(stdout, "%s\n", optInFilename);
-    siPrintPSIDInformation(stdout, optParsable, optHexadecimal, optFields, &psid);
+    siPrintPSIDInformation(stdout, optParsable, optHexadecimal, optFields, optInFilename, &psid);
 
     ret = 0;