1 /* This file is part of the YAZ toolkit.
2 * Copyright (C) 1995-2013 Index Data
3 * See the file LICENSE for details.
8 * \brief Implements atoi_n function.
16 #include <yaz/marcdisp.h>
17 #include <yaz/yaz-iconv.h>
19 int atoi_n(const char *buf, int len)
25 if (yaz_isdigit(*buf))
26 val = val*10 + (*buf - '0');
32 int atoi_n_check(const char *buf, int size, int *val)
35 for (i = 0; i < size; i++)
36 if (!yaz_isdigit(buf[i]))
38 *val = atoi_n(buf, size);
45 * c-file-style: "Stroustrup"
46 * indent-tabs-mode: nil
48 * vim: shiftwidth=4 tabstop=8 expandtab