]> diplodocus.org Git - nmh/blob - sbr/atooi.c
pending-release-notes: add mhshow's "-prefer", and mh-format's %(kibi/kilo)
[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 register 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 }