Esempio n. 1
0
int main (int argc, char* argv [])
/* Assembler main program */
{
    unsigned I;

    /* Initialize the cmdline module */
    InitCmdLine (&argc, &argv, "ar65");

    /* We must have a file name */
    if (ArgCount < 2) {
	Usage ();
    }

    /* Check the parameters */
    I = 1;
    while (I < ArgCount) {

	/* Get the argument */
	const char* Arg = ArgVec [I];

	/* Check for an option */
	if (strlen (Arg) != 1) {
	    Usage ();
	}
	switch (Arg [0]) {

	    case 'a':
		AddObjFiles (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 'v':
		++Verbosity;
		break;

	    case 'x':
		ExtractObjFiles (ArgCount - I - 1, &ArgVec [I+1]);
		break;

	    case 'V':
		fprintf (stderr,
       	       	       	 "ar65 V%s - (C) Copyright 1998-2009 Ullrich von Bassewitz\n",
			 GetVersionAsString ());
		break;

	    default:
		fprintf (stderr, "Unknown option: %s\n", Arg);
		Usage ();

	}

	/* Next argument */
	++I;
    }

    /* Return an apropriate exit code */
    return EXIT_SUCCESS;
}
Esempio n. 2
0
int main (int argc, char* argv [])
/* Assembler main program */
{
    unsigned I;

    /* Initialize the cmdline module */
    InitCmdLine (&argc, &argv, "ar65");

    /* We must have a file name */
    if (ArgCount < 2) {
        Usage ();
    }

    /* Check the parameters */
    I = 1;
    while (I < ArgCount) {

        /* Get the argument */
        const char* Arg = ArgVec [I];

        switch (Arg [0]) {

            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 '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 'x':
                ExtractObjFiles (ArgCount - I - 1, &ArgVec [I+1]);
                break;

            case 'V':
                fprintf (stderr, "%s V%s\n", ProgName, GetVersionAsString ());
                break;

            default:
                fprintf (stderr, "Unknown option: %s\n", Arg);
                Usage ();

        }

        /* Next argument */
        ++I;
    }

    /* Return an apropriate exit code */
    return EXIT_SUCCESS;
}