summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rw-r--r--utils/midpoint.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/utils/midpoint.c b/utils/midpoint.c
index c736143..60ad65c 100644
--- a/utils/midpoint.c
+++ b/utils/midpoint.c
@@ -4,7 +4,7 @@
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]));
+ error_at_line(1, 0, __FILE__, __LINE__, "%s <bin|add|subtract|divide|midpoint|closer> <a> [b] [t]", S0(argv[0]));
if (argv[1][0] == 'b' || argv[1][0] == 'B') {
unsigned char a[strlen(argv[2])/2+1];
a[strlen(argv[2])/2] = '\0';
@@ -38,6 +38,13 @@ int main (int argc, char ** argv) {
char out[41];
out[40] = '\0';
unsigned char r[20];
+ if (argv[1][0] == 'c' || argv[1][0] == 'C') {
+ if (!argv[4] || strlen(argv[4]) != 40)
+ error_at_line(4, 0, __FILE__, __LINE__, "(!t || strlen(t) != 40) && closer");
+ unsigned char t[20];
+ hex2bin(t, argv[4], 20);
+ return closer(a, b, t);
+ }
if (argv[1][0] == 'a' || argv[1][0] == 'A') {
memcpy(r, a, 20);
add(r, b);