]> diplodocus.org Git - nmh/blob - sbr/atooi.c
Alter mh-chart(7)'s NAME to be lowercase.
[nmh] / sbr / atooi.c
1
2 /*
3 * atooi.c -- octal version of atoi()
4 *
5 * This code is Copyright (c) 2002, by the authors of nmh. See the
6 * COPYRIGHT file in the root directory of the nmh distribution for
7 * complete copyright information.
8 */
9
10 #include <h/mh.h>
11
12
13 int
14 atooi(char *cp)
15 {
16 int i, base;
17
18 i = 0;
19 base = 8;
20 while (*cp >= '0' && *cp <= '7') {
21 i *= base;
22 i += *cp++ - '0';
23 }
24
25 return i;
26 }