view libcommon/exit.c @ 93:6041c601304d

fcsim1-mkprov: revert OTA key addition It appears that GrcardSIM2 cards (which is what we got for FCSIM1) do not support OTA after all, contrary to what we were previously led to believe by some tech support emails from Grcard - apparently those support emails and OTA descriptions referred to some other card model(s).
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 21 Apr 2021 05:38:39 +0000
parents 812779459ddd
children
line wrap: on
line source

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>

extern unsigned calypso_fd;
extern FILE *cpipeF, *rpipeF;

calypso_poweroff()
{
	int c;

	fputs("poweroff\n", cpipeF);
	fflush(cpipeF);
	while ((c = getc(rpipeF)) != EOF)
		putchar(c);
	exit(0);
}

good_exit()
{
	if (calypso_fd)
		calypso_poweroff();
	exit(0);
}

cmd_exit(argc, argv)
	char **argv;
{
	if (argc < 2)
		good_exit();
	if (!calypso_fd) {
		fprintf(stderr,
	"error: exit arguments are only meaningful with Calypso back end\n");
		return(-1);
	}
	if (!strcmp(argv[1], "bare"))
		exit(0);
	if (!strcmp(argv[1], "iota-off"))
		calypso_poweroff();
	fprintf(stderr, "error: \"%s\" is not an understood exit mode\n",
		argv[1]);
	return(-1);
}