FreeCalypso > hg > fc-sim-tools
view libcommon/exit.c @ 86:de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 11 Apr 2021 03:19:22 +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); }