.TH ATOHE 3SU SU
.SH NAME
.B atohe \-
convert ascii string to short integer with overflow detection
.SH SYNOPSIS
.nf
#include "../include/cwp.h"
short atohe(s);
char s[];
.SH DESCRIPTION
.I Atohe
returns the conversion of an ascii string to short integer if the converted
value is within the bounds specified in the system dependent
include file limits.h.  On overflow it returns zero
and sets the global integer variable, errno, to EDOM as defined
in intro(2).  It is up to the programmer of the calling program
to check errno as in the EXAMPLE below.
.P
A test driver is contained in the arraypkge.c source code and the
makefile in the su/lib directory has a routine for compiling and
running the driver.
.SH EXAMPLE
.na
.nf
	#include "../include/cwp.h"
	...
	char s[BUFSIZ];
	short n;
	...
		errno = 0;
		n = atohe(s);
		if (errno) {
			/* Error processing */
		} else {
			/* Normal use of n */
		}
.fi
.ad
.SH RETURN VALUE
The short integer corresponding to the ascii string.
.SH CAVEATS
The code assumes that conversion of unsigned to signed contains no
surprises for numbers in the lower half of the range.
.P
Size limits on the integer data types are machine dependent and
are read from the file limits.h.
.SH SEE ALSO
intro(2)
.SH AUTHOR
Jack, Brian.  Major credit to: Plum, "Reliable Data Structures in C",
p. 2-17.  Also relevant: Kernighan and Ritchie, "The C Programming
Language", p. 58.
.SH SOURCE
su/lib/atopkge.c
.SH REVISION LEVEL
1.10
