view serial/baud_parse.c @ 99:97ba63d9361a

scripts/fcsim1-sst: turn off STK & OTA services In the initial unprogrammed state of the cards from Grcard, SST has services 25 through 29 set to allocated and activated. However, these cards appear to not actually support OTA, ENVELOPE commands do nothing (just return SW 9000), and they were never observed issuing any proactive SIM commands, even after a feature-generous TERMINAL PROFILE. Therefore, let's list these STK & OTA services as allocated, but not activated in our FCSIM1 SST.
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 05 May 2021 04:26:07 +0000
parents 8f505d413815
children
line wrap: on
line source

/*
 * This module handles the parsing of the baud rate and speed enhancement
 * command line argument.
 */

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

unsigned baud_base, baud_spenh, spenh_host_max;

void
parse_baud_spenh_arg(arg)
	char *arg;
{
	char *cp;

	if (!isdigit(*arg)) {
inv:		fprintf(stderr,
			"error: invalid baud/spenh selection argument \"%s\"\n",
			arg);
		exit(1);
	}
	baud_base = strtoul(arg, &cp, 10);
	if (!*cp)
		return;
	if (*cp++ != ',')
		goto inv;
	if (!isdigit(*cp))
		goto inv;
	baud_spenh = strtoul(cp, &cp, 10);
	if (!*cp) {
		spenh_host_max = 1;
		return;
	}
	if (*cp++ != ',')
		goto inv;
	if (!isdigit(*cp) || cp[1])
		goto inv;
	spenh_host_max = *cp - '0';
	switch (spenh_host_max) {
	case 1:
	case 2:
	case 4:
	case 8:
		break;
	default:
		fprintf(stderr,
	"error: speed enhancement multiplier can only be 1, 2, 4 or 8\n");
		exit(1);
	}
}