aboutsummaryrefslogblamecommitdiffstats
path: root/strtoh.c
blob: 990673a6327733c89d6a16317529b3e439d4e1e2 (plain) (tree)
1
2
                                                         
                   



























                                                                                               
/* See LICENSE file for copyright and license details. */
#include "common.h"
#ifndef TEST


signed short int
libsimple_strtoh(const char *restrict nptr, char **restrict end, int base) /* TODO test, man */
{
	signed long int r = strtol(nptr, end, base);
	if(r < SHRT_MIN) {
		r = SHRT_MIN;
		errno = ERANGE;
	} else if(r > SHRT_MAX) {
		r = SHRT_MAX;
		errno = ERANGE;
	}
	return (signed short int)r;
}


#else
#include "test.h"

int
main(void)
{
	return 0;
}

#endif