diff options
author | Anton Luka Šijanec <anton@sijanec.eu> | 2023-01-08 23:48:11 +0100 |
---|---|---|
committer | Anton Luka Šijanec <anton@sijanec.eu> | 2023-01-08 23:48:11 +0100 |
commit | 9b3caf1f841cf451ba162bcaf83a96ba0c834a78 (patch) | |
tree | 1ea5adf151c03064c58f9e44fc72e8f87bfba16c /utils/midpoint.c | |
parent | idea for metadl via tcp for outgoing connections implemented, not tested, compiles (diff) | |
download | travnik-9b3caf1f841cf451ba162bcaf83a96ba0c834a78.tar travnik-9b3caf1f841cf451ba162bcaf83a96ba0c834a78.tar.gz travnik-9b3caf1f841cf451ba162bcaf83a96ba0c834a78.tar.bz2 travnik-9b3caf1f841cf451ba162bcaf83a96ba0c834a78.tar.lz travnik-9b3caf1f841cf451ba162bcaf83a96ba0c834a78.tar.xz travnik-9b3caf1f841cf451ba162bcaf83a96ba0c834a78.tar.zst travnik-9b3caf1f841cf451ba162bcaf83a96ba0c834a78.zip |
Diffstat (limited to 'utils/midpoint.c')
-rw-r--r-- | utils/midpoint.c | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/utils/midpoint.c b/utils/midpoint.c index 1a2e6f3..c736143 100644 --- a/utils/midpoint.c +++ b/utils/midpoint.c @@ -2,25 +2,6 @@ #include <error.h> #define S0(x) (x ? x : "") -/** - * converts a hexadecimal string to bytes - * - * b and h may not overlap, unless they are the same address - * - * @param b [out] array of bytes to write to with capacity l - * @param h [in] array of hex to read from with 2l hex digits - * @param l [in] length of output array - */ - -void hex2bin (unsigned char * b, const char * h, int l) { - for (int i = 0; i < l; i++) { - char ms = *h++; - char ls = *h++; - b[i] = (ms >= 'a' ? ms - 'a' + 10 : (ms >= 'A' ? ms - 'A' + 10 : ms - '0')) << 4; - b[i] |= (ls >= 'a' ? ls - 'a' + 10 : (ls >= 'A' ? ls - 'A' + 10 : ls - '0')); - } -} - int main (int argc, char ** argv) { if (argc < 3) error_at_line(1, 0, __FILE__, __LINE__, "%s <bin|add|subtract|divide|midpoint> <a> [b]", S0(argv[0])); |