FreeCalypso > hg > fc-sim-tools
view libcommon/exit.c @ 70:ce3752d3d3b4
doc/SIM-in-Calypso-phone: update for fc-host-tools-r15 release
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 27 Mar 2021 19:44:31 +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); }