]> diplodocus.org Git - nmh/blob - sbr/atooi.c
Reverted commit 9a4b4a3d3b27fe4a7ff6d0b8724ce1c06b5917eb.
[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 }