changeset 337:b420025e5cd2

Change argument handling.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 15 Oct 2012 15:57:30 +0300
parents 13dba73cf28e
children cd57ba1130eb
files xm2jss.c
diffstat 1 files changed, 19 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/xm2jss.c	Mon Oct 15 14:34:06 2012 +0300
+++ b/xm2jss.c	Mon Oct 15 15:57:30 2012 +0300
@@ -46,16 +46,15 @@
 
 DMOptArg optList[] = {
     { 0, '?', "help",           "Show this help", OPT_NONE },
-    { 5, 'v', "verbose",        "Be more verbose", OPT_NONE },
-    { 6, 'o', "output",         "Output file", OPT_ARGREQ },
-    { 1, 'i', "ignore",         "Ignore errors", OPT_NONE },
-    { 2, 'p', "patterns",       "Pattern storage mode", OPT_ARGREQ },
-    { 3, 'E', "strip-ext-instr","Strip ext. instruments (implies -I -S)", OPT_NONE },
-    { 9, 'I', "strip-instr",    "Strip instruments (implies -S)", OPT_NONE },
-    { 4, 'S', "strip-samples",  "Strip instr. sampledata", OPT_NONE },
+    { 1, 'v', "verbose",        "Be more verbose", OPT_NONE },
+    { 2, 'i', "ignore",         "Ignore errors", OPT_NONE },
+    { 3, 'p', "patterns",       "Pattern storage mode", OPT_ARGREQ },
+    { 4, 'E', "strip-ext-instr","Strip ext. instruments (implies -I -S)", OPT_NONE },
+    { 5, 'I', "strip-instr",    "Strip instruments (implies -S)", OPT_NONE },
+    { 6, 'S', "strip-samples",  "Strip instr. sampledata", OPT_NONE },
     { 7, '8', "smode8",         "8-bit sample conversion flags", OPT_ARGREQ },
     { 8, '1', "smode16",        "16-bit sample conversion flags", OPT_ARGREQ },
-    {10, 'O', "optimize",       "Optimize module", OPT_NONE },
+    { 9, 'O', "optimize",       "Optimize module", OPT_NONE },
 };
 
 const int optListN = sizeof(optList) / sizeof(optList[0]);
@@ -65,7 +64,7 @@
 {
     int i;
 
-    dmPrintBanner(stdout, dmProgName, "[options] <module.xm>");
+    dmPrintBanner(stdout, dmProgName, "[options] <input.xm> <output.jmod>");
     dmArgsPrintHelp(stdout, optList, optListN);
 
     printf("\n"
@@ -97,10 +96,14 @@
         break;
 
     case 1:
+        dmVerbosity++;
+        break;
+
+    case 2:
         optIgnoreErrors = TRUE;
         break;
 
-    case 2:
+    case 3:
         optPatternMode = atoi(optArg);
         if (optPatternMode <= 0 || optPatternMode >= PATMODE_LAST)
         {
@@ -109,21 +112,14 @@
         }
         break;
 
+    case 4: optStripExtInstr = TRUE; break;
+    case 5: optStripInstr = TRUE; break;
+    case 6: optStripSamples = TRUE; break;
+
     case 7: optSampMode8 = atoi(optArg) & SAMPMODE_MASK; break;
     case 8: optSampMode16 = atoi(optArg) & SAMPMODE_MASK; break;
 
-    case 4: optStripSamples = TRUE; break;
-    case 3: optStripExtInstr = TRUE; break;
-    case 9: optStripInstr = TRUE; break;
-    case 10: optOptimize = TRUE; break;
-
-    case 5:
-        dmVerbosity++;
-        break;
-    
-    case 6:
-        optOutFilename = optArg;
-        break;
+    case 9: optOptimize = TRUE; break;
 
     default:
         dmError("Unknown argument '%s'.\n", currArg);
@@ -139,6 +135,7 @@
     // Was not option argument
     if (!optInFilename)
         optInFilename = currArg;
+    else
     if (!optOutFilename)
         optOutFilename = currArg;
     else