view sw/mcsi-rxtx/main.c @ 13:315428573a25

fc-mcsi-rxtx: implement record function
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 28 Oct 2024 07:24:53 +0000
parents 8a386263dd51
children
line wrap: on
line source

/*
 * Main module for fc-mcsi-rxtx program: interactive, modeled after fc-shell.
 */

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

int ttyhacks, dflag;

main(argc, argv)
	char **argv;
{
	extern int optind;
	int c;

	while ((c = getopt(argc, argv, "d")) != EOF) {
		switch (c) {
		case 'd':
			dflag++;
			continue;
		default:
		usage:
			fprintf(stderr, "usage: %s [-d] ttyport\n", argv[0]);
			exit(1);
		}
	}
	if (argc != optind + 1)
		goto usage;
	open_serial_port(argv[optind]);
	set_serial_baudrate(187500);
	init_serial_flush();
	ttyhacks = isatty(0) && !dflag;
	tty_init();
	main_loop();		/* does not return */
}