FreeCalypso > hg > fc-sim-tools
view libutil/plmnlist.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 | 34bbb0585cab |
children |
line wrap: on
line source
/* * This module implements a function for reading PLMN lists from files. */ #include <sys/types.h> #include <ctype.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <strings.h> extern FILE *open_script_input_file(); read_plmn_list_from_file(filename, buf, ef_len) char *filename; u_char *buf; unsigned ef_len; { FILE *inf; int lineno, rc; char linebuf[1024], *cp, *np; u_char *dp, *endp; inf = open_script_input_file(filename); if (!inf) { perror(filename); return(-1); } dp = buf; endp = buf + ef_len; for (lineno = 1; fgets(linebuf, sizeof linebuf, inf); lineno++) { if (!index(linebuf, '\n')) { fprintf(stderr, "%s line %d: too long or missing newline\n", filename, lineno); fclose(inf); return(-1); } for (cp = linebuf; ; ) { while (isspace(*cp)) cp++; if (*cp == '\0' || *cp == '#') break; for (np = cp; *cp && !isspace(*cp); cp++) ; if (*cp) *cp++ = '\0'; if (dp >= endp) { fprintf(stderr, "%s line %d: number of PLMN codes exceeds EF size\n", filename, lineno); fclose(inf); return(-1); } rc = encode_plmn_3bytes(np, dp); if (rc < 0) { fprintf(stderr, "%s line %d: invalid MCC-MNC\n", filename, lineno); fclose(inf); return(-1); } dp += 3; } } fclose(inf); while (dp < endp) *dp++ = 0xFF; return(0); }