view lwar/main.c @ 171:d610b8aef91b

Added LWAR skeleton
author lost
date Sun, 01 Mar 2009 19:37:03 +0000
parents
children 47427342e41d
line wrap: on
line source

/*
main.c
Copyright © 2009 William Astle

This file is part of LWAR.

LWAR is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.

This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.

You should have received a copy of the GNU General Public License along with
this program. If not, see <http://www.gnu.org/licenses/>.


Implements the program startup code

*/

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <argp.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>

#include "lwar.h"

// command line option handling
const char *argp_program_version = "LWAR from " PACKAGE_STRING;
const char *argp_program_bug_address = PACKAGE_BUGREPORT;

static error_t parse_opts(int key, char *arg, struct argp_state *state)
{
	switch (key)
	{
	case 'd':
		// debug
		debug_level++;
		break;
	
//	case ARGP_KEY_ARG:
//
//		break;
		
	default:
		return ARGP_ERR_UNKNOWN;
	}
	return 0;
}

static struct argp_option options[] =
{
	{ "debug",		'd',	0,		0,
				"Set debug mode"},
	{ 0 }
};

static struct argp argp =
{
	options,
	parse_opts,
	"<input file> ...",
	"LWLINK, a HD6309 and MC6809 cross-linker"
};

// main function; parse command line, set up assembler state, and run the
// assembler on the first file
int main(int argc, char **argv)
{
	argp_parse(&argp, argc, argv, 0, 0, NULL);
	
	exit(0);
}