File:  [MW Coherent from dump] / coherent / b / lib / libc / gen / atol.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Wed May 29 04:56:35 2019 UTC (7 years ago) by root
Branches: MarkWilliams, MAIN
CVS tags: relic, HEAD
coherent

/*
 * C general utilities library.
 * atol()
 * ANSI 4.10.1.3.
 * Convert ASCII to long (the old fashioned way).
 */

#include <stdlib.h>
#include <ctype.h>

long
atol(nptr) register char *nptr;
{
	register long	val;
	register int	c;
	register int	sign;

	val = sign = 0;

	/* Leading whitespace. */
	while (isspace(c = *nptr++))
		;

	/* Optional sign. */
	if (c == '-') {
		sign = 1;
		c = *nptr++;
	} else if (c == '+')
		c = *nptr++;

	/* Process digit string. */
	for ( ; isdigit(c); c = *nptr++)
		val = val * 10 + c - '0';
	return (sign ? -val : val);
}

/* end of atol.c */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.