#include <stdio.h>#include <locale.h>#include <ctype.h>
Go to the source code of this file.
Functions | |
| char * | flag (int b) |
| void | describe_char (int c) |
| int | main () |
| void describe_char | ( | int | c | ) |
Definition at line 43 of file test-ctype.c.
References flag().
Referenced by main().
{
unsigned char cp = c,
up = toupper(c),
lo = tolower(c);
if (!isprint(cp))
cp = ' ';
if (!isprint(up))
up = ' ';
if (!isprint(lo))
lo = ' ';
printf("chr#%-4d%2c%6s%6s%6s%6s%6s%6s%6s%6s%6s%6s%6s%4c%4c\n", c, cp, flag(isalnum(c)), flag(isalpha(c)), flag(iscntrl(c)), flag(isdigit(c)), flag(islower(c)), flag(isgraph(c)), flag(isprint(c)), flag(ispunct(c)), flag(isspace(c)), flag(isupper(c)), flag(isxdigit(c)), lo, up);
}
| char * flag | ( | int | b | ) |
Definition at line 33 of file test-ctype.c.
Referenced by _ltree_union(), connectDBComplete(), describe_char(), fetch_tuple_flag(), g_intbig_union(), getopt_long(), ghstore_union(), gtrgm_union(), gtsvector_union(), makeCompoundFlags(), makepol(), NIImportAffixes(), and NIImportOOAffixes().
{
#ifdef LONG_FLAG
return b ? "yes" : "no";
#else
return b ? "+" : " ";
#endif
}
| int main | ( | void | ) |
Definition at line 60 of file test-ctype.c.
References describe_char().
{
short c;
char *cur_locale;
cur_locale = setlocale(LC_ALL, "");
if (cur_locale)
fprintf(stderr, "Successfully set locale to \"%s\"\n", cur_locale);
else
{
fprintf(stderr, "Cannot setup locale. Either your libc does not provide\nlocale support, or your locale data is corrupt, or you have not set\nLANG or LC_CTYPE environment variable to proper value. Program aborted.\n");
return 1;
}
printf("char# char alnum alpha cntrl digit lower graph print punct space upper xdigit lo up\n");
for (c = 0; c <= 255; c++)
describe_char(c);
return 0;
}
1.7.1