isprint/isspace segfaulting

Raj raju@mailandnews.com
Wed Dec 10 05:27:00 GMT 2003


Hi all,
Using isprint or isspace is resulting in a segfault. Program attached below.
This on RedHat 9.0, using glibc-common-2.3.2-11.9, glibc-2.3.2-11.9, 
glibc-devel-2.3.2-11.9,
glibc-kernheaders-2.4-8.10.

PS: In the below program if i declare 'ch' as 'char', then things work 
fine. Only when it is declared as 'int' does the problem shows up.

Is this expected ?

Thx for any info.

/Raj

-------------Start of program-----------
#include <ctype.h>

int main()
{
         unsigned int ch; //Change this to char or unsigned char.

        scanf("%c",&ch);

        if(!isspace(ch)){//isprint also has the same problem
                puts("NO");
        }
        else {
                puts("YES");
        }
}
--------------End of program------------------



More information about the Libc-alpha mailing list