/*****************************************************************************/
/* */
-/* main.c */
+/* main.c */
/* */
/* Main program for the co65 object file converter */
/* */
/*****************************************************************************/
-/* Code */
+/* Code */
/*****************************************************************************/
{
/* Print an error and abort if the name is not ok */
if (!ValidSegName (Seg)) {
- Error ("Segment name `%s' is invalid", Seg);
+ Error ("Segment name `%s' is invalid", Seg);
}
}
static void OptDebug (const char* Opt attribute ((unused)),
- const char* Arg attribute ((unused)))
+ const char* Arg attribute ((unused)))
/* Enable debugging code */
{
++Debug;
static void OptDebugInfo (const char* Opt attribute ((unused)),
- const char* Arg attribute ((unused)))
+ const char* Arg attribute ((unused)))
/* Add debug info to the object file */
{
DebugInfo = 1;
static void OptHelp (const char* Opt attribute ((unused)),
- const char* Arg attribute ((unused)))
+ const char* Arg attribute ((unused)))
/* Print usage information and exit */
{
Usage ();
static void OptNoOutput (const char* Opt attribute ((unused)),
- const char* Arg attribute ((unused)))
+ const char* Arg attribute ((unused)))
/* Handle the --no-output option */
{
NoOutput = 1;
static void OptVerbose (const char* Opt attribute ((unused)),
- const char* Arg attribute ((unused)))
+ const char* Arg attribute ((unused)))
/* Increase verbosity */
{
++Verbosity;
static void OptVersion (const char* Opt attribute ((unused)),
- const char* Arg attribute ((unused)))
+ const char* Arg attribute ((unused)))
/* Print the assembler version */
{
- fprintf (stderr,
- "co65 V%s - (C) Copyright 1998-2009 Ullrich von Bassewitz\n",
- GetVersionAsString ());
+ fprintf (stderr, "co65 V%s\n", GetVersionAsString ());
}
{
/* Program long options */
static const LongOpt OptTab[] = {
- { "--bss-label", 1, OptBssLabel },
- { "--bss-name", 1, OptBssName },
- { "--code-label", 1, OptCodeLabel },
- { "--code-name", 1, OptCodeName },
- { "--data-label", 1, OptDataLabel },
- { "--data-name", 1, OptDataName },
- { "--debug", 0, OptDebug },
- { "--debug-info", 0, OptDebugInfo },
- { "--help", 0, OptHelp },
- { "--no-output", 0, OptNoOutput },
+ { "--bss-label", 1, OptBssLabel },
+ { "--bss-name", 1, OptBssName },
+ { "--code-label", 1, OptCodeLabel },
+ { "--code-name", 1, OptCodeName },
+ { "--data-label", 1, OptDataLabel },
+ { "--data-name", 1, OptDataName },
+ { "--debug", 0, OptDebug },
+ { "--debug-info", 0, OptDebugInfo },
+ { "--help", 0, OptHelp },
+ { "--no-output", 0, OptNoOutput },
{ "--o65-model", 1, OptO65Model },
- { "--verbose", 0, OptVerbose },
- { "--version", 0, OptVersion },
- { "--zeropage-label", 1, OptZeropageLabel },
- { "--zeropage-name", 1, OptZeropageName },
+ { "--verbose", 0, OptVerbose },
+ { "--version", 0, OptVersion },
+ { "--zeropage-label", 1, OptZeropageLabel },
+ { "--zeropage-name", 1, OptZeropageName },
};
unsigned I;
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 (Arg [0] == '-') {
- switch (Arg [1]) {
+ /* Check for an option */
+ if (Arg [0] == '-') {
+ switch (Arg [1]) {
- case '-':
- LongOption (&I, OptTab, sizeof(OptTab)/sizeof(OptTab[0]));
- break;
+ case '-':
+ LongOption (&I, OptTab, sizeof(OptTab)/sizeof(OptTab[0]));
+ break;
- case 'g':
- OptDebugInfo (Arg, 0);
- break;
+ case 'g':
+ OptDebugInfo (Arg, 0);
+ break;
- case 'h':
- OptHelp (Arg, 0);
- break;
+ case 'h':
+ OptHelp (Arg, 0);
+ break;
case 'm':
OptO65Model (Arg, GetArg (&I, 2));
OptNoOutput (Arg, 0);
break;
- case 'o':
- OutputName = GetArg (&I, 2);
- break;
-
- case 'v':
- OptVerbose (Arg, 0);
- break;
-
- case 'V':
- OptVersion (Arg, 0);
- break;
-
- default:
- UnknownOption (Arg);
- break;
-
- }
- } else {
- /* Filename. Check if we already had one */
- if (InputName) {
- Error ("Don't know what to do with `%s'", Arg);
- } else {
- InputName = Arg;
- }
- }
-
- /* Next argument */
- ++I;
+ case 'o':
+ OutputName = GetArg (&I, 2);
+ break;
+
+ case 'v':
+ OptVerbose (Arg, 0);
+ break;
+
+ case 'V':
+ OptVersion (Arg, 0);
+ break;
+
+ default:
+ UnknownOption (Arg);
+ break;
+
+ }
+ } else {
+ /* Filename. Check if we already had one */
+ if (InputName) {
+ Error ("Don't know what to do with `%s'", Arg);
+ } else {
+ InputName = Arg;
+ }
+ }
+
+ /* Next argument */
+ ++I;
}
/* Do we have an input file? */
if (InputName == 0) {
- Error ("No input file");
+ Error ("No input file");
}
/* Generate the name of the output file if none was specified */