Logo Search packages:      
Sourcecode: ladcca version File versions  Download package

main.c

/*
 *   LADCCA 
 *    
 *   Copyright (C) 2002 Robert Ham <rah@bash.sh>
 *    
 *   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., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#include "ac-config.h"

#include <ladcca/ladcca.h>

#include <getopt.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "ladcca_control.h"

static void print_help () {
  printf("LADCCA Control version %s\n", PACKAGE_VERSION);
  printf("Copyright (C) 2002 Robert Ham <rah@bash.sh>\n");
  printf("\n");
  printf("This program comes with ABSOLUTELY NO WARRANTY.  You are licensed to use it\n");
  printf("under the terms of the GNU General Public License, version 2 or later.  See\n");
  printf("the COPYING file that came with this software for details.\n");
  printf("\n");
  printf(" -h, --help                  Display this help info\n");
  printf("     --ladcca-server <host>  Connect to server running on <host>\n");
  printf("     --ladcca-port <port>    Connect to server on port <port>\n");
  printf("\n");
}
                            

int main (int argc, char ** argv)
{
  ladcca_control_t control;
  cca_args_t * cca_args;
  cca_client_t * cca_client;
  int opt;
  const char * options = "h";
  struct option long_options[] = {
    { "help", 0, NULL, 'h' },
    { 0, 0, 0, 0 }
  };
  
  cca_args = cca_extract_args (&argc, &argv);

  while ((opt = getopt_long (argc, argv, options, long_options, NULL)) != -1)
    {
      switch (opt)
      {
      case 'h':
        print_help ();
        exit (0);
        break;

      case ':':
        print_help ();
        exit (1);
        break;
      case '?':
        print_help ();
        exit (1);
        break;
    }
  }
  
  cca_client = cca_init (cca_args, "LADCCA Control", CCA_Server_Interface|CCA_Terminal, CCA_PROTOCOL (2,0));
  
  if (!cca_client)
    {
      fprintf (stderr, "%s: could not initialise ladcca\n", __FUNCTION__);
      exit (1);
    }
  
  ladcca_control_init (&control);
  control.client = cca_client;
  
  ladcca_control_main (&control);

  return 0;
}


Generated by  Doxygen 1.6.0   Back to index