[uClibc] isnumeric() and ctype.h

Marc Leeman marc.leeman at barco.com
Tue Aug 24 06:54:58 UTC 2004


Regarding my footnote comment last week, here is a more elaborate
description.

Sorry, I haven't fixed it, I just don't include the ctypes file. If I am
not mistaking, I'll look it up and fix it (if needed). Please check the
followingi (don't mind the space):

-- host --
[mleeman at gemini mleeman]$ powerpc-linux-uclibc-gcc -Wall -DCTYPE -o test
isnumeric.c
[mleeman at gemini mleeman]$ cp test
~/targets/target.uclibc.02/root/ppcstream/
-- target ---
# ./test 
18: 23 is NOT a number
25: NOT a space

-- host --
[mleeman at gemini mleeman]$ powerpc-linux-uclibc-gcc -Wall -o test
isnumeric.c
isnumeric.c: In function `main':
isnumeric.c:14: warning: implicit declaration of function `isdigit'
isnumeric.c:21: warning: implicit declaration of function `isspace'
[mleeman at gemini mleeman]$ cp test
~/targets/target.uclibc.02/root/ppcstream/
-- target --
# ./test 
15: 23 is a number
25: NOT a space

-- test program --
#include <stdio.h>
#include <stdlib.h>

#ifdef CTYPE 
#include <ctype.h>
#endif

int main(int argc, char* argv[]){
	const char* number = "23";
	const char space = ' ';

	/* Test with isdigit */

	if(isdigit(*number)){
		fprintf(stdout,"%d: %s is a number\n", __LINE__,number);
	}
	else{
		fprintf(stdout,"%d: %s is NOT a number\n", __LINE__,number);
	}

	if(isspace(space)){
		fprintf(stdout,"%d: a space\n", __LINE__);
	}
	else{
		fprintf(stdout,"%d: NOT a space\n", __LINE__);
	}

	return EXIT_SUCCESS;
}

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.busybox.net/pipermail/uclibc/attachments/20040824/41b767f1/attachment-0002.pgp 


More information about the uClibc mailing list