diff mod2wav.c @ 300:4972ca91d062

Cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 11 Oct 2012 17:55:15 +0300
parents 245b15cd1919
children
line wrap: on
line diff
--- a/mod2wav.c	Thu Oct 11 17:50:06 2012 +0300
+++ b/mod2wav.c	Thu Oct 11 17:55:15 2012 +0300
@@ -18,7 +18,7 @@
 #include "dmmutex.h"
 
 
-char    *srcFilename = NULL, *destFilename = NULL;
+char    *optInFilename = NULL, *optOutFilename = NULL;
 int     optOutFormat = JSS_AUDIO_S16,
         optOutChannels = 2,
         optOutFreq = 44100,
@@ -108,11 +108,11 @@
 
 BOOL argHandleFile(char *currArg)
 {
-    if (!srcFilename)
-        srcFilename = currArg;
+    if (!optInFilename)
+        optInFilename = currArg;
     else
-    if (!destFilename)
-        destFilename = currArg;
+    if (!optOutFilename)
+        optOutFilename = currArg;
     else
     {
         dmError("Too many filename arguments (only source and dest needed) '%s'\n", currArg);
@@ -143,9 +143,9 @@
         exit(1);
 
     // Check arguments
-    if (!srcFilename || !destFilename)
+    if (optInFilename == NULL || optOutFilename == NULL)
     {
-        dmError("Input or output file not specified!\n");
+        dmError("Input or output file not specified. Try --help.\n");
         return 1;
     }
     
@@ -153,15 +153,15 @@
     jssInit();
     
     // Open the source file
-    if ((inFile = dmf_create_stdio(srcFilename, "rb")) == NULL)
+    if ((inFile = dmf_create_stdio(optInFilename, "rb")) == NULL)
     {
         dmError("Error opening input file '%s', %d: %s\n",
-            srcFilename, errno, strerror(errno));
+            optInFilename, errno, strerror(errno));
         return 1;
     }
 
     // Read module file
-    fprintf(stderr, "Reading file: %s\n", srcFilename);
+    fprintf(stderr, "Reading file: %s\n", optInFilename);
 #ifdef JSS_SUP_XM
     fprintf(stderr, "* Trying XM...\n");
     result = jssLoadXM(inFile, &mod);
@@ -248,9 +248,9 @@
     }
     
     // Open output file
-    if ((outFile = fopen(destFilename, "wb")) == NULL)
+    if ((outFile = fopen(optOutFilename, "wb")) == NULL)
     {
-        dmError("Error opening output file '%s'. (%s)\n", srcFilename, strerror(errno));
+        dmError("Error opening output file '%s'. (%s)\n", optInFilename, strerror(errno));
         return 7;
     }