// -*- C++ -*-
//
//  This file is part of Siena, a wide-area event notification system
//  or, in other words, a content-based routing mechanism. See
//  http://www.cs.colorado.edu/~carzanig/siena
//
//  Author: Antonio Carzaniga <carzanig@cs.colorado.edu>
//
//  Copyright (C) 1998-1999 University of Colorado
//
//  This program 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 2
//  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, write to the Free Software
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307, USA.
//  Or contact Antonio Carzaniga <carzanig@cs.colorado.edu>.
//
//
// $Id: main.cc,v 1.3 2002/12/02 16:26:18 carzanig Exp $
//
#include <iostream>
#include <cstdlib>
#include <cstring>

#include <gtk/gtk.h>

#include "smon.h"

using namespace std;

void print_usage(const char *name) 
{
    cerr << "usage: " << name << " [-port number]" << endl;
    exit(-1);
}

int main(int argc, char *argv[])
{
    unsigned short port = 1996;

    for (int i=1; i< argc; i++) {	// parses command-line parameters
	if (strcmp(argv[i], "-port")==0) {
	    if (++i < argc) {
		port = atoi(argv[i]);
	    } else {
		print_usage(argv[0]);
	    }
	} else {
	    print_usage(argv[0]);
	}
    } 

    gtk_set_locale();
    gtk_init(&argc, &argv);
    
    smon_create_gui();
    smon_open_port(port);

    gtk_main();
    return 0;
}
