FreeCalypso > hg > freecalypso-tools
diff uptools/libcoding/hexdecode2.c @ 966:ec7e23d5151f
fcup-smsend: add support for backslash escapes, new -e option
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 01 Sep 2023 15:44:52 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uptools/libcoding/hexdecode2.c Fri Sep 01 15:44:52 2023 +0000 @@ -0,0 +1,14 @@ +/* + * This module is a subset of hexdigits.c from fc-sim-tools/libutil. + */ + +decode_hex_digit(c) +{ + if (c >= '0' && c <= '9') + return(c - '0'); + if (c >= 'A' && c <= 'F') + return(c - 'A' + 10); + if (c >= 'a' && c <= 'f') + return(c - 'a' + 10); + return(-1); +}