Expand PMF_FN_* macros.
[netbsd-mini2440.git] / usr.sbin / sup / source / atoo.c
blobe8f0d4a0c7b19d99a841202068aa0b63c2d088bd
1 /* $NetBSD: atoo.c,v 1.4 2002/07/10 20:19:38 wiz Exp $ */
3 /*
4 * Copyright (c) 1991 Carnegie Mellon University
5 * All Rights Reserved.
7 * Permission to use, copy, modify and distribute this software and its
8 * documentation is hereby granted, provided that both the copyright
9 * notice and this permission notice appear in all copies of the
10 * software, derivative works or modified versions, and any portions
11 * thereof, and that both notices appear in supporting documentation.
13 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
14 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
15 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
17 * Carnegie Mellon requests users of this software to return to
19 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
20 * School of Computer Science
21 * Carnegie Mellon University
22 * Pittsburgh PA 15213-3890
24 * any improvements or extensions that they make and grant Carnegie the rights
25 * to redistribute these changes.
27 /* atoo -- convert ascii to octal
29 * Usage: i = atoo (string);
30 * unsigned int i;
31 * char *string;
33 * Atoo converts the value contained in "string" into an
34 * unsigned integer, assuming that the value represents
35 * an octal number.
37 * HISTORY
38 * 20-Nov-79 Steven Shafer (sas) at Carnegie-Mellon University
39 * Rewritten for VAX.
42 #include "supcdefs.h"
43 #include "supextern.h"
45 unsigned int
46 atoo(char *ap)
48 unsigned int n;
49 char *p;
51 p = ap;
52 n = 0;
53 while (*p == ' ' || *p == ' ')
54 p++;
55 while (*p >= '0' && *p <= '7')
56 n = n * 8 + *p++ - '0';
57 return (n);