X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Far65%2Fmain.c;h=5877520de4be5d0d1db9402d8f8b48971acb3a37;hb=bee54df02967b774c485b0a7fa703b5a76345d4e;hp=120190173264d007b5d4554ab1a25fca263c4be0;hpb=53dd513176425872128ef26031d00952ef7a0628;p=cc65 diff --git a/src/ar65/main.c b/src/ar65/main.c index 120190173..5877520de 100644 --- a/src/ar65/main.c +++ b/src/ar65/main.c @@ -6,20 +6,20 @@ /* */ /* */ /* */ -/* (C) 1998 Ullrich von Bassewitz */ -/* Wacholderweg 14 */ -/* D-70597 Stuttgart */ -/* EMail: uz@musoftware.de */ -/* */ -/* */ +/* (C) 1998-2009, 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. */ -/* */ +/* */ /* 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: */ -/* */ +/* */ /* 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 */ @@ -28,7 +28,7 @@ /* be misrepresented as being the original software. */ /* 3. This notice may not be removed or altered from any source */ /* distribution. */ -/* */ +/* */ /*****************************************************************************/ @@ -38,11 +38,12 @@ #include #include -#include "../common/version.h" +/* common */ +#include "cmdline.h" +#include "print.h" +#include "version.h" #include "global.h" -#include "error.h" -#include "mem.h" #include "add.h" #include "del.h" #include "list.h" @@ -59,15 +60,14 @@ static void Usage (void) /* Print usage information and exit */ { - fprintf (stderr, - "Usage: %s 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); + printf ("Usage: %s 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); exit (EXIT_FAILURE); } @@ -76,19 +76,22 @@ static void Usage (void) int main (int argc, char* argv []) /* Assembler main program */ { - int I; + unsigned I; + + /* Initialize the cmdline module */ + InitCmdLine (&argc, &argv, "ar65"); /* We must have a file name */ - if (argc < 2) { + if (ArgCount < 2) { Usage (); } /* Check the parameters */ I = 1; - while (I < argc) { + while (I < ArgCount) { /* Get the argument */ - const char* Arg = argv [I]; + const char* Arg = ArgVec [I]; /* Check for an option */ if (strlen (Arg) != 1) { @@ -97,29 +100,29 @@ int main (int argc, char* argv []) switch (Arg [0]) { case 'a': - AddObjFiles (argc - I - 1, &argv [I+1]); + AddObjFiles (ArgCount - I - 1, &ArgVec[I+1]); break; case 'd': - DelObjFiles (argc - I - 1, &argv [I+1]); + DelObjFiles (ArgCount - I - 1, &ArgVec [I+1]); break; case 'l': - ListObjFiles (argc - I - 1, &argv [I+1]); + ListObjFiles (ArgCount - I - 1, &ArgVec [I+1]); break; case 'v': - ++Verbose; + ++Verbosity; break; case 'x': - ExtractObjFiles (argc - I - 1, &argv [I+1]); + 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); + "ar65 V%s - (C) Copyright 1998-2009 Ullrich von Bassewitz\n", + GetVersionAsString ()); break; default: