comparison rvinterf/etmsync/fsiomain.c @ 275:cedf09b6b5ac

started laying the foundation for fc-fsio host utility
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Sun, 23 Feb 2014 20:27:15 +0000
parents
children 909f00c15f27
comparison
equal deleted inserted replaced
274:e3f17ff16915 275:cedf09b6b5ac
1 /*
2 * This module contains the main() function for fc-fsio.
3 */
4
5 #include <stdio.h>
6 #include <stdlib.h>
7
8 char *socket_pathname = "/tmp/rvinterf_socket";
9 int sock;
10
11 extern char *rvinterf_ttyport, *rvinterf_Bopt, *rvinterf_lopt, *rvinterf_wopt;
12
13 main(argc, argv)
14 char **argv;
15 {
16 extern int optind;
17 extern char *optarg;
18 int c, sopt = 0;
19
20 while ((c = getopt(argc, argv, "B:l:p:s:w:")) != EOF)
21 switch (c) {
22 case 'B':
23 rvinterf_Bopt = optarg;
24 continue;
25 case 'l':
26 rvinterf_lopt = optarg;
27 continue;
28 case 'p':
29 rvinterf_ttyport = optarg;
30 continue;
31 case 's':
32 socket_pathname = optarg;
33 sopt++;
34 continue;
35 case 'w':
36 rvinterf_wopt = optarg;
37 continue;
38 case '?':
39 default:
40 usage: fprintf(stderr,
41 "usage: %s [options] [command]\n", argv[0]);
42 exit(1);
43 }
44 if (rvinterf_ttyport) {
45 if (sopt) {
46 fprintf(stderr,
47 "%s error: -p and -s options are mutually exclusive\n",
48 argv[0]);
49 exit(1);
50 }
51 launch_rvinterf();
52 } else {
53 if (rvinterf_Bopt || rvinterf_lopt || rvinterf_wopt) {
54 fprintf(stderr,
55 "%s error: -B, -l and -w options are meaningful only when launching rvinterf\n",
56 argv[0]);
57 exit(1);
58 }
59 connect_local_socket();
60 }
61
62
63 }