view autocal/gmagicmain.c @ 42:dcf7cd305e2b

fc-rfcal-gmagic started
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 27 May 2017 05:04:14 +0000
parents
children 8c7b0ba1e5c4
line wrap: on
line source

/*
 * This module contains the main() function for fc-rfcal-gmagic.
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <rvinterf/l1tm.h>
#include <rvinterf/exitcodes.h>
#include "stdband.h"

static struct band {
	char		*name;
	unsigned	rfpw_std_band;
	unsigned	default_arfcn;
} bands[] = {
	{"850",  RFPW_STD_BAND_850,  189},
	{"900",  RFPW_STD_BAND_900,   37},
	{"1800", RFPW_STD_BAND_1800, 698},
	{"1900", RFPW_STD_BAND_1900, 661},
	{0,	 0,		     0}
};
static struct band *selected_band;
static unsigned arfcn;

finish_cmdline(argc, argv)
	char **argv;
{
	extern int optind;
	struct band *band;

	if (argc - optind < 1 || argc - optind > 2) {
		fprintf(stderr, "usage: %s band [arfcn]\n", argv[0]);
		exit(ERROR_USAGE);
	}
	for (band = bands; band->name; band++)
		if (!strcmp(band->name, argv[optind]))
			break;
	if (!band->name) {
		fprintf(stderr, "error: \"%s\" is not a known band\n",
			argv[optind]);
		exit(ERROR_USAGE);
	}
	selected_band = band;
	if (argv[optind+1])
		arfcn = atoi(argv[optind+1]);
	else
		arfcn = band->default_arfcn;
	return(0);
}

main(argc, argv)
	char **argv;
{
	socket_pathname_options(argc, argv);
	finish_cmdline(argc, argv);
	connect_rvinterf_socket();
	connect_tsid_socket();


}