FreeCalypso > hg > fc-sim-sniff
comparison sw/sniff-rx/main.c @ 22:b112c2df6c43
sw: simtrace3-sniff-rx program written, compiles
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 22 Aug 2023 06:16:44 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
21:c4346cdc9641 | 22:b112c2df6c43 |
---|---|
1 /* | |
2 * Main module for simtrace3-sniff-rx program. | |
3 */ | |
4 | |
5 #include <stdio.h> | |
6 #include <stdlib.h> | |
7 | |
8 FILE *main_outf; | |
9 int logfile_flag; | |
10 | |
11 main(argc, argv) | |
12 char **argv; | |
13 { | |
14 if (argc < 2 || argc > 3) { | |
15 fprintf(stderr, "usage: %s ttyport [logfile]\n", argv[0]); | |
16 exit(1); | |
17 } | |
18 open_serial_port(argv[1]); | |
19 set_serial_baudrate(3000000); | |
20 init_serial_flush(); | |
21 if (argv[2]) { | |
22 main_outf = fopen(argv[2], "a"); | |
23 if (!main_outf) { | |
24 perror(argv[2]); | |
25 exit(1); | |
26 } | |
27 logfile_flag = 1; | |
28 } else { | |
29 main_outf = stdout; | |
30 logfile_flag = 0; | |
31 } | |
32 main_loop(); /* does not return */ | |
33 } |