summaryrefslogtreecommitdiff
path: root/ot_scan.h
diff options
context:
space:
mode:
Diffstat (limited to 'ot_scan.h')
-rw-r--r--ot_scan.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/ot_scan.h b/ot_scan.h
new file mode 100644
index 0000000..860a088
--- /dev/null
+++ b/ot_scan.h
@@ -0,0 +1,21 @@
1/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
2 It is considered beerware. Prost. Skol. Cheers or whatever.
3
4 $id$ */
5
6#ifndef OT_SCAN_H__
7#define OT_SCAN_H__
8
9#include <stddef.h>
10#include <stdint.h>
11
12/* Read an unsigned decimal number from src into dest and return how many
13 characters were consumed. Returns zero and leaves dest untouched when src
14 does not begin with a digit, or when the value would exceed max. */
15size_t scan_udec(const char *src, uint64_t *dest, uint64_t max);
16
17/* As scan_udec, but following the bencode integer grammar, which permits a
18 leading zero on zero alone. */
19size_t scan_udec_bencode(const char *src, uint64_t *dest, uint64_t max);
20
21#endif