FreeCalypso > hg > fc-sim-tools
view libutil/pinentry.c @ 83:3055d5c9e7a3
fc-simtool update-rec* commands: check curfile_record_len
and error out if it is not set
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 11 Apr 2021 02:38:31 +0000 |
parents | 34bbb0585cab |
children |
line wrap: on
line source
#include <sys/types.h> #include <ctype.h> #include <stdio.h> encode_pin_entry(arg, dest) char *arg; u_char *dest; { unsigned n; n = 0; while (*arg) { if (!isdigit(*arg)) { fprintf(stderr, "error: PIN argument contains a non-digit character\n"); return(-1); } if (n >= 8) { fprintf(stderr, "error: PIN argument is too long\n"); return(-1); } *dest++ = *arg++; n++; } for (; n < 8; n++) *dest++ = 0xFF; return(0); }