Added fallback for isdigit() if ctype.h is not available.

git-svn-id: file:///home/mbr/svn/fwknop/trunk@23 510a4753-2344-4c79-9c09-4d669213fbeb
This commit is contained in:
Damien Stuart 2008-12-26 21:04:38 +00:00
parent 98bb7ed536
commit 620ffec5cc
2 changed files with 11 additions and 2 deletions

View File

@ -32,7 +32,6 @@
#include <stdio.h>
#include <sys/types.h>
#include <ctype.h>
#if STDC_HEADERS
#include <stdlib.h>
@ -45,6 +44,13 @@
#include <unistd.h>
#endif
#if HAVE_CTYPE_H
#include <ctype.h> /* Using this if isdigit() */
#else
/* Fall-back does not account for locale */
#define isdigit(c) (c >= 48 && c <= 57)
#endif
/* Convenient macros for wrapping sections in 'extern "C" {' constructs.
*/
#ifdef __cplusplus

View File

@ -202,8 +202,11 @@ int validate_access_msg(const char *msg)
*/
ndx++;
while(*ndx != '\0')
if(isdigit(*(ndx++)) == 0)
{
if(isdigit(*ndx) == 0)
return(FKO_ERROR_INVALID_SPA_ACCESS_MSG);
ndx++;
}
return(FKO_SUCCESS);
}