FreeCalypso > hg > freecalypso-tools
view rvinterf/tmsh/main.c @ 995:74024eb17e04
fc-loadtool help: improve language regarding 16 MiB flash chips
In FC project history, 16 MiB flash originally meant Pirelli DP-L10.
Then we got FCDEV3B with the same flash (our own design), but now we are
discovering more Calypso devices that used such large flash, both late
Calypso era (Sony Ericsson K2x0) as well as much earlier ones (FIC FLUID
devices.txt file with 2004 dates, Leonardo+ rev 5). Hence we need to
migrate to more generic or neutral language in associated documentation,
without giving elevated status to specific examples that drove our
early project history.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 03 Dec 2023 21:11:12 +0000 |
parents | e40bb5a6c6b9 |
children |
line wrap: on
line source
/* * This module contains the main() function for fc-tmsh. */ #include <sys/types.h> #include <sys/errno.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "exitcodes.h" extern char *socket_pathname; extern char *rvinterf_ttyport, *rvinterf_Bopt, *rvinterf_lopt, *rvinterf_wopt; extern int sock; int ttyhacks, dflag; int oneshot_nowait; main(argc, argv) char **argv; { extern int optind; extern char *optarg; int c, sopt = 0; fd_set fds; while ((c = getopt(argc, argv, "B:dl:np:s:w:")) != EOF) switch (c) { case 'B': rvinterf_Bopt = optarg; continue; case 'd': dflag++; continue; case 'l': rvinterf_lopt = optarg; continue; case 'n': oneshot_nowait++; continue; case 'p': rvinterf_ttyport = optarg; continue; case 's': socket_pathname = optarg; sopt++; continue; case 'w': rvinterf_wopt = optarg; continue; case '?': default: /* error msg already printed */ exit(ERROR_USAGE); } if (rvinterf_ttyport) { if (sopt) { fprintf(stderr, "%s error: -p and -s options are mutually exclusive\n", argv[0]); exit(ERROR_USAGE); } launch_rvinterf(argv[optind] && !oneshot_nowait); } else { if (rvinterf_Bopt || rvinterf_lopt || rvinterf_wopt) { fprintf(stderr, "%s error: -B, -l and -w options are meaningful only when launching rvinterf\n", argv[0]); exit(ERROR_USAGE); } connect_local_socket(); } if (argv[optind]) return oneshot_command(argc - optind, argv + optind); ttyhacks = isatty(0) && !dflag; init(); tty_init(); for (;;) { FD_ZERO(&fds); FD_SET(0, &fds); FD_SET(sock, &fds); c = select(sock+1, &fds, 0, 0, 0); if (c < 0) { if (errno == EINTR) continue; tty_cleanup(); perror("select"); exit(ERROR_UNIX); } if (FD_ISSET(0, &fds)) handle_tty_input(); if (FD_ISSET(sock, &fds)) handle_rvinterf_input(); fflush(stdout); } }