From a1f9b3a9b8718244a88a30b57d5fbdf1a3a3409c Mon Sep 17 00:00:00 2001 From: Nick Chambers Date: Mon, 20 Jun 2022 13:20:00 -0500 Subject: [PATCH] Tranform string values into double-precision numbers --- src/scribe.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/scribe.c b/src/scribe.c index b46ee6c..0def6cb 100644 --- a/src/scribe.c +++ b/src/scribe.c @@ -21,6 +21,14 @@ uint8_t gargoyle_from_rope(struct gargoyle_opt *opt, const char *brand) { if(*end) { return GARGOYLE_ERR_INVALID_UINT; } + } else if(opt->type & GARGOYLE_TYPE_DBLE) { + char *end = NULL; + double *val = opt->val; + *val = strtod(brand, &end); + + if(*end) { + return GARGOYLE_ERR_INVALID_DBLE; + } } return 0;