Codebase list nbtscan-unixwiz / c5bf2ff2-415e-4a2c-892f-dd2f7301b9dd/main all_digitsA.c
c5bf2ff2-415e-4a2c-892f-dd2f7301b9dd/main

Tree @c5bf2ff2-415e-4a2c-892f-dd2f7301b9dd/main (Download .tar.gz)

all_digitsA.c @c5bf2ff2-415e-4a2c-892f-dd2f7301b9dd/mainraw · history · blame

/*
 * $Id: //devel/tools/main/nbtscan/all_digitsA.c#1 $
 *
 * written by :	Stephen J. Friedl
 *		Software Consultant
 *		[email protected]
 *
 *	Is the given string composed entirely of digits right up
 *	to the terminating NUL byte? We define an empty string as
 *	*not* all digits.
 */
#ifndef COMMONFILE
# define COMMONFILE "libcommon.h"
#endif
#include COMMONFILE
#include <ctype.h>
#include "penlib.h"

int __stdcall all_digitsA(const char *s, int *n)
{
const char	*s_save = s;

	assert(s != 0);
	assert(n != 0);

	*n = 0;

	while ( isdigit(*s) )
		*n = (*n * 10) + (*s++ - '0');

	return (*s == 0) && (s > s_save);
}