Directive s=pw sets structure to phrase if term includes blank(s).
[yaz-moved-to-github.git] / util / atoin.c
1 /*
2  * Copyright (c) 1997, Index Data
3  * See the file LICENSE for details.
4  * Sebastian Hammer, Adam Dickmeiss
5  *
6  * $Log: atoin.c,v $
7  * Revision 1.3  2000-02-29 13:44:55  adam
8  * Check for config.h (currently not generated).
9  *
10  * Revision 1.2  1999/11/30 13:47:12  adam
11  * Improved installation. Moved header files to include/yaz.
12  *
13  * Revision 1.1  1997/09/04 07:52:27  adam
14  * Moved atoi_n function to separate source file.
15  *
16  */
17
18 #if HAVE_CONFIG_H
19 #include <config.h>
20 #endif
21
22 #include <string.h>
23 #include <ctype.h>
24 #include <yaz/yaz-util.h>
25
26 int atoi_n (const char *buf, int len)
27 {
28     int val = 0;
29
30     while (--len >= 0)
31     {
32         if (isdigit (*buf))
33             val = val*10 + (*buf - '0');
34         buf++;
35     }
36     return val;
37 }