FreeCalypso > hg > fc-rfcal-tools
comparison 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 |
comparison
equal
deleted
inserted
replaced
41:3f4221ef916a | 42:dcf7cd305e2b |
---|---|
1 /* | |
2 * This module contains the main() function for fc-rfcal-gmagic. | |
3 */ | |
4 | |
5 #include <stdio.h> | |
6 #include <stdlib.h> | |
7 #include <string.h> | |
8 #include <strings.h> | |
9 #include <rvinterf/l1tm.h> | |
10 #include <rvinterf/exitcodes.h> | |
11 #include "stdband.h" | |
12 | |
13 static struct band { | |
14 char *name; | |
15 unsigned rfpw_std_band; | |
16 unsigned default_arfcn; | |
17 } bands[] = { | |
18 {"850", RFPW_STD_BAND_850, 189}, | |
19 {"900", RFPW_STD_BAND_900, 37}, | |
20 {"1800", RFPW_STD_BAND_1800, 698}, | |
21 {"1900", RFPW_STD_BAND_1900, 661}, | |
22 {0, 0, 0} | |
23 }; | |
24 static struct band *selected_band; | |
25 static unsigned arfcn; | |
26 | |
27 finish_cmdline(argc, argv) | |
28 char **argv; | |
29 { | |
30 extern int optind; | |
31 struct band *band; | |
32 | |
33 if (argc - optind < 1 || argc - optind > 2) { | |
34 fprintf(stderr, "usage: %s band [arfcn]\n", argv[0]); | |
35 exit(ERROR_USAGE); | |
36 } | |
37 for (band = bands; band->name; band++) | |
38 if (!strcmp(band->name, argv[optind])) | |
39 break; | |
40 if (!band->name) { | |
41 fprintf(stderr, "error: \"%s\" is not a known band\n", | |
42 argv[optind]); | |
43 exit(ERROR_USAGE); | |
44 } | |
45 selected_band = band; | |
46 if (argv[optind+1]) | |
47 arfcn = atoi(argv[optind+1]); | |
48 else | |
49 arfcn = band->default_arfcn; | |
50 return(0); | |
51 } | |
52 | |
53 main(argc, argv) | |
54 char **argv; | |
55 { | |
56 socket_pathname_options(argc, argv); | |
57 finish_cmdline(argc, argv); | |
58 connect_rvinterf_socket(); | |
59 connect_tsid_socket(); | |
60 | |
61 | |
62 } |