comparison rvinterf/etmsync/simplemain.c @ 916:8e1c55cf7989

fc-getpirimei implemented, compiles
author Space Falcon <falcon@ivan.Harhan.ORG>
date Tue, 08 Sep 2015 18:59:29 +0000
parents
children
comparison
equal deleted inserted replaced
915:7b805007dcfc 916:8e1c55cf7989
1 /*
2 * This module contains the main() function for simple etmsync programs
3 * that execute a single operation without a command dispatcher.
4 */
5
6 #include <stdio.h>
7 #include <stdlib.h>
8 #include <unistd.h>
9 #include "exitcodes.h"
10
11 extern char *socket_pathname;
12 extern char *rvinterf_ttyport, *rvinterf_Bopt, *rvinterf_lopt, *rvinterf_wopt;
13
14 main(argc, argv)
15 char **argv;
16 {
17 extern int optind;
18 extern char *optarg;
19 int c, sopt = 0;
20
21 while ((c = getopt(argc, argv, "B:l:p:s:w:")) != EOF)
22 switch (c) {
23 case 'B':
24 rvinterf_Bopt = optarg;
25 continue;
26 case 'l':
27 rvinterf_lopt = optarg;
28 continue;
29 case 'p':
30 rvinterf_ttyport = optarg;
31 continue;
32 case 's':
33 socket_pathname = optarg;
34 sopt++;
35 continue;
36 case 'w':
37 rvinterf_wopt = optarg;
38 continue;
39 case '?':
40 default:
41 /* error msg already printed */
42 exit(ERROR_USAGE);
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(ERROR_USAGE);
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(ERROR_USAGE);
58 }
59 connect_local_socket();
60 }
61
62 return single_op_main(argc - optind, argv + optind);
63 }