FreeCalypso > hg > fc-pcsc-tools
view uicc/script.c @ 109:8a27f45bc1e6
fc-simtool fplmn-dump: support output redirection
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 19 Feb 2021 06:53:14 +0000 |
parents | 1b1468869ccf |
children | ede661d78730 |
line wrap: on
line source
/* * This module implements the exec command, which is our scripting facility. */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <strings.h> cmd_exec(argc, argv) char **argv; { FILE *f; char linebuf[512], *cp; int lineno, retval = 0; f = fopen(argv[1], "r"); if (!f) { perror(argv[1]); return(-1); } for (lineno = 1; fgets(linebuf, sizeof linebuf, f); lineno++) { cp = index(linebuf, '\n'); if (!cp) { fprintf(stderr, "%s line %d: missing newline\n", argv[1], lineno); fclose(f); return(-1); } *cp = '\0'; retval = simtool_dispatch_cmd(linebuf, 1); if (retval) break; } fclose(f); return(retval); }