]> git.sur5r.net Git - cc65/blobdiff - src/ar65/main.c
Minor style adjustment.
[cc65] / src / ar65 / main.c
index 7a2a9ca6261b8d196bc42bd32b2607c10c614a62..48561027fb109972479810378b301f8977acc35c 100644 (file)
@@ -1,34 +1,34 @@
 /*****************************************************************************/
-/*                                                                          */
-/*                                 main.c                                   */
-/*                                                                          */
-/*                   Main program for the ar65 archiver                     */
-/*                                                                          */
-/*                                                                          */
-/*                                                                          */
-/* (C) 1998-2001 Ullrich von Bassewitz                                      */
-/*              Wacholderweg 14                                             */
-/*              D-70597 Stuttgart                                           */
-/* EMail:       uz@musoftware.de                                            */
-/*                                                                          */
-/*                                                                          */
-/* This software is provided 'as-is', without any expressed or implied      */
+/*                                                                           */
+/*                                  main.c                                   */
+/*                                                                           */
+/*                    Main program for the ar65 archiver                     */
+/*                                                                           */
+/*                                                                           */
+/*                                                                           */
+/* (C) 1998-2013, Ullrich von Bassewitz                                      */
+/*                Roemerstrasse 52                                           */
+/*                D-70794 Filderstadt                                        */
+/* EMail:         uz@cc65.org                                                */
+/*                                                                           */
+/*                                                                           */
+/* This software is provided 'as-is', without any expressed or implied       */
 /* warranty.  In no event will the authors be held liable for any damages    */
-/* arising from the use of this software.                                   */
-/*                                                                          */
+/* arising from the use of this software.                                    */
+/*                                                                           */
 /* Permission is granted to anyone to use this software for any purpose,     */
 /* including commercial applications, and to alter it and redistribute it    */
-/* freely, subject to the following restrictions:                           */
-/*                                                                          */
+/* freely, subject to the following restrictions:                            */
+/*                                                                           */
 /* 1. The origin of this software must not be misrepresented; you must not   */
 /*    claim that you wrote the original software. If you use this software   */
 /*    in a product, an acknowledgment in the product documentation would be  */
-/*    appreciated but is not required.                                      */
+/*    appreciated but is not required.                                       */
 /* 2. Altered source versions must be plainly marked as such, and must not   */
-/*    be misrepresented as being the original software.                             */
-/* 3. This notice may not be removed or altered from any source                     */
-/*    distribution.                                                         */
-/*                                                                          */
+/*    be misrepresented as being the original software.                      */
+/* 3. This notice may not be removed or altered from any source              */
+/*    distribution.                                                          */
+/*                                                                           */
 /*****************************************************************************/
 
 
@@ -52,7 +52,7 @@
 
 
 /*****************************************************************************/
-/*                                  Code                                    */
+/*                                   Code                                    */
 /*****************************************************************************/
 
 
 static void Usage (void)
 /* Print usage information and exit */
 {
-    fprintf (stderr,
-            "Usage: %s <operation> lib file|module ...\n"
-            "Operation is one of:\n"
-            "\ta\tAdd modules\n"
-            "\td\tDelete modules\n"
-            "\tl\tList library contents\n"
-            "\tx\tExtract modules\n"
-            "\tV\tPrint the archiver version\n",
-            ProgName);
+    fprintf (stderr, "Usage: %s <operation ...> lib file|module ...\n"
+            "Operations are some of:\n"
+            "\tr\tAdd modules\n"
+            "\td\tDelete modules\n"
+            "\tt\tList library table\n"
+            "\tv\tIncrease verbosity (put before other operation)\n"
+            "\tx\tExtract modules\n"
+            "\tV\tPrint the archiver version\n",
+            ProgName);
     exit (EXIT_FAILURE);
 }
 
@@ -84,61 +84,57 @@ int main (int argc, char* argv [])
 
     /* We must have a file name */
     if (ArgCount < 2) {
-       Usage ();
+        Usage ();
     }
 
     /* Check the parameters */
     I = 1;
     while (I < ArgCount) {
 
-       /* Get the argument */
-       const char* Arg = ArgVec [I];
+        /* Get the argument */
+        const char* Arg = ArgVec [I];
 
-       /* Check for an option */
-       if (strlen (Arg) != 1) {
-           Usage ();
-       }
-       switch (Arg [0]) {
+        switch (Arg [0]) {
 
-           case 'a':
-               AddObjFiles (ArgCount - I - 1, &ArgVec[I+1]);
-               break;
+            case 'r': /* POSIX.2 */
+            case 'a': /* staying compatible */
+                AddObjFiles (ArgCount - I - 1, &ArgVec[I+1]);
+                break;
 
-           case 'd':
-               DelObjFiles (ArgCount - I - 1, &ArgVec [I+1]);
-               break;
+            case 'd':
+                DelObjFiles (ArgCount - I - 1, &ArgVec [I+1]);
+                break;
 
-           case 'l':
-               ListObjFiles (ArgCount - I - 1, &ArgVec [I+1]);
-               break;
+            case 't': /* POSIX.2 */
+            case 'l': /* staying compatible */
+                if (Arg [1] == 'v') {
+                    ++Verbosity;
+                }
+                ListObjFiles (ArgCount - I - 1, &ArgVec [I+1]);
+                break;
 
-           case 'v':
-               ++Verbosity;
-               break;
+            case 'v':
+                ++Verbosity;
+                break;
 
-           case 'x':
-               ExtractObjFiles (ArgCount - I - 1, &ArgVec [I+1]);
-               break;
+            case 'x':
+                ExtractObjFiles (ArgCount - I - 1, &ArgVec [I+1]);
+                break;
 
-           case 'V':
-               fprintf (stderr,
-                        "ar65 V%u.%u.%u - (C) Copyright 1998-1999 Ullrich von Bassewitz\n",
-                        VER_MAJOR, VER_MINOR, VER_PATCH);
-               break;
+            case 'V':
+                fprintf (stderr, "%s V%s\n", ProgName, GetVersionAsString ());
+                break;
 
-           default:
-               fprintf (stderr, "Unknown option: %s\n", Arg);
-               Usage ();
+            default:
+                fprintf (stderr, "Unknown option: %s\n", Arg);
+                Usage ();
 
-       }
+        }
 
-       /* Next argument */
-       ++I;
+        /* Next argument */
+        ++I;
     }
 
     /* Return an apropriate exit code */
     return EXIT_SUCCESS;
 }
-
-
-