X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=util%2Fatoin.c;fp=util%2Fatoin.c;h=4c4b5e808f03dfd0a2ea198bd408d709c0af091e;hb=2a782cebfa5189908617c8938ea0baac5d636587;hp=0000000000000000000000000000000000000000;hpb=43613b8c6c0d998668f15f493ea3612f55384279;p=yaz-moved-to-github.git diff --git a/util/atoin.c b/util/atoin.c new file mode 100644 index 0000000..4c4b5e8 --- /dev/null +++ b/util/atoin.c @@ -0,0 +1,27 @@ +/* + * Copyright (c) 1997, Index Data + * See the file LICENSE for details. + * Sebastian Hammer, Adam Dickmeiss + * + * $Log: atoin.c,v $ + * Revision 1.1 1997-09-04 07:52:27 adam + * Moved atoi_n function to separate source file. + * + */ + +#include +#include +#include + +int atoi_n (const char *buf, int len) +{ + int val = 0; + + while (--len >= 0) + { + if (isdigit (*buf)) + val = val*10 + (*buf - '0'); + buf++; + } + return val; +}