diff options
author | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-02-23 17:13:57 +0000 |
---|---|---|
committer | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-02-23 17:13:57 +0000 |
commit | 9c4950dff36fc6083132969ac592045c5cda464e (patch) | |
tree | a6044b368ffd4c159c9584c7fcf17347cb8cee67 /utils.c | |
parent | efb2e34d2948dbc76d3be4a3a8805f7baba44bcc (diff) |
add 'consumed' argument to ast_get_time_t, so callers can know how many characters were used in the parser
update pbx_dundi to use ast_get_time_t
eliminate some compiler warnings
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@10871 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'utils.c')
-rw-r--r-- | utils.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -1051,9 +1051,10 @@ void __ast_string_field_index_build(struct ast_string_field_mgr *mgr, /* * get values from config variables. */ -int ast_get_time_t(const char *src, time_t *dst, time_t _default) +int ast_get_time_t(const char *src, time_t *dst, time_t _default, int *consumed) { long t; + int scanned; if (dst == NULL) return -1; @@ -1064,8 +1065,10 @@ int ast_get_time_t(const char *src, time_t *dst, time_t _default) return -1; /* only integer at the moment, but one day we could accept more formats */ - if (sscanf(src, "%ld", &t) == 1) { + if (sscanf(src, "%ld%n", &t, &scanned) == 1) { *dst = t; + if (consumed) + *consumed = scanned; return 0; } else return -1; |