isdigit.c (1302B)
1 /************************************************************************ 2 * * 3 * Copyright (c) 1982, Fred Fish * 4 * All Rights Reserved * 5 * * 6 * This software and/or documentation is released for public * 7 * distribution for personal, non-commercial use only. * 8 * Limited rights to use, modify, and redistribute are hereby * 9 * granted for non-commercial purposes, provided that all * 10 * copyright notices remain intact and all changes are clearly * 11 * documented. The author makes no warranty of any kind with * 12 * respect to this product and explicitly disclaims any implied * 13 * warranties of merchantability or fitness for any particular * 14 * purpose. * 15 * * 16 ************************************************************************ 17 */ 18 19 20 /* 21 * LIBRARY FUNCTION 22 * 23 * isdigit test character for numeric property 24 * 25 * SYNOPSIS 26 * 27 * int isdigit(ch) 28 * char ch; 29 * 30 * DESCRIPTION 31 * 32 * Returns TRUE or FALSE depending upon whether the specified 33 * character is a numeric character or not. 34 * 35 * BUGS 36 * 37 * May fail on machines in which native character set is not ASCII. 38 * 39 */ 40 41 #include <stdio.h> 42 43 #define TRUE 1 44 #define FALSE 0 45 46 int isdigit(ch) 47 char ch; 48 { 49 if (ch > '9' || ch < '0') { 50 return(FALSE); 51 } else { 52 return(TRUE); 53 } 54 }