/* hextol.c - convert hexadecimal number from string
 */


/* Return the conversion of the hexadecimal number in "string".
 */
long mstrtol(char *string)
{
	long num = 0;
	int c = 0;
	int n;

	if (!string)
		return (0);

	while (c < 8) {

		n = (n = string[c], (n > 47)
		     && (n < 58) ? n - 48 : (n &= 223, (n > 64)
					     && (n < 71) ? n - 55 : -1));

		if (n < 0)
			return (num);	    /* isn't the ? operator lovely. */

		num = (num << 4) + n;
		c++;
	}

	return (num);
}

/* EOF */
