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