home *** CD-ROM | disk | FTP | other *** search
- /* 1.0 01-08-86 (tobase.c)
- ************************************************************************
- * Robert C. Tausworthe *
- * Jet Propulsion Laboratory *
- * Pasadena, CA 91009 1986 *
- ************************************************************************/
-
- #include "defs.h"
- #include "stdtyp.h"
-
- /************************************************************************/
- METACHAR
- tobase(c, b) /* Return value of character c to base b, if
- valid, or EOF if not. */
- /*----------------------------------------------------------------------*/
- {
- int n;
-
- if (isdigit(c = tolower(c)))
- c -= '0';
- else if (isalpha(c))
- c -= 'W'; /* 'W' is 'a' - 10 */
- else
- return EOF;
-
- return (c < b ? c : EOF);
- }