set_character_class (s) register char *s;
set_character_class (register char *s)
set_character_class (s)    register char *s;{    register int i;			/* iterator, index into s */    int len;				/* length of s */    int acc;				/* accumulator */    int low, high;			/* bounds of range [0..127] */    int base;				/* 8, 10, 16 (octal, decimal, hex) */    int numbers;			/* count of numbers per range */    int digits;				/* count of digits in a number */    static char *errfmt = "%s:  %s in range string \"%s\" (position %d)\n";    if (!s || !s[0]) return -1;    base = 10;				/* in case we ever add octal, hex */    low = high = -1;			/* out of range */    for (i = 0, len = strlen (s), acc = 0, numbers = digits = 0;	 i < len; i++) {	char c = s[i];	if (isspace(c)) {	    continue;	} else if (isdigit(c)) {	    acc = acc * base + (c - '0');	    digits++;	    continue;	} else if (c == '-') {	    low = acc;	    acc = 0;	    if (digits == 0) {		fprintf (stderr, errfmt, ProgramName, "missing number", s, i);		return (-1);	    }	    digits = 0;	    numbers++;	    continue;	} else if (c == ':') {	    if (numbers == 0)	      low = acc;	    else if (numbers == 1)	      high = acc;	    else {		fprintf (stderr, errfmt, ProgramName, "too many numbers",			 s, i);		return (-1);	    }	    digits = 0;	    numbers++;	    acc = 0;	    continue;	} else if (c == ',') {	    /*	     * now, process it	     */	    if (high < 0) {		high = low;		numbers++;	    }	    if (numbers != 2) {		fprintf (stderr, errfmt, ProgramName, "bad value number",			 s, i);	    } else if (SetCharacterClassRange (low, high, acc) != 0) {		fprintf (stderr, errfmt, ProgramName, "bad range", s, i);	    }	    low = high = -1;	    acc = 0;	    digits = 0;	    numbers = 0;	    continue;	} else {	    fprintf (stderr, errfmt, ProgramName, "bad character", s, i);	    return (-1);	}				/* end if else if ... else */    }    if (low < 0 && high < 0) return (0);    /*     * now, process it     */    if (high < 0) high = low;    if (numbers < 1 || numbers > 2) {	fprintf (stderr, errfmt, ProgramName, "bad value number", s, i);    } else if (SetCharacterClassRange (low, high, acc) != 0) {	fprintf (stderr, errfmt, ProgramName, "bad range", s, i);    }    return (0);}