diff options
author | Miika Turkia <miika.turkia@gmail.com> | 2017-11-27 20:28:41 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-11-27 13:42:10 -0800 |
commit | 8be626d2c1f7d6a91eecb45dc91cdeb961f0a62b (patch) | |
tree | 2d84710a4094bc2c5841fd337c07e0d54b3f9f30 /core/parse.c | |
parent | b3605de93e1c5e7f5a68f6692b8d26806f575625 (diff) | |
download | subsurface-8be626d2c1f7d6a91eecb45dc91cdeb961f0a62b.tar.gz |
Move atoi_n to parse.c
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Diffstat (limited to 'core/parse.c')
-rw-r--r-- | core/parse.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/core/parse.c b/core/parse.c index 3335b8f57..57f6eb019 100644 --- a/core/parse.c +++ b/core/parse.c @@ -12,6 +12,7 @@ #include "gettext.h" int metric = 1; +int diveid = -1; /* static union { @@ -516,3 +517,15 @@ void add_dive_site(char *ds_name, struct dive *dive) free(to_free); } +int atoi_n(char *ptr, unsigned int len) +{ + if (len < 10) { + char buf[10]; + + memcpy(buf, ptr, len); + buf[len] = 0; + return atoi(buf); + } + return 0; +} + |