/* Written by James M. Rogers, 27 January 1999 */ /* This program is released to the public domain. */ /* An example of a C cgi program This program will produce html output to represent characters by their group membership in the ctype library. */ #include #include #define UPPER 255 #define LOWER 0 main (){ int i; /* print the content tag */ printf("Content-type: text/html\n\n"); /* print the html header */ printf("\n\nClass Membership by Character\n\n\n"); /* begin the table */ printf("\n"); /* print a pretty blank row */ printf(""); /* print a pretty blank row */ printf(""); /* print the headings for the rows */ printf(""); /* print a pretty blank row */ printf(""); /* print a pretty blank row */ printf(""); /* go thru the characters one at a time from lowest to highest */ for (i=LOWER;i<=UPPER;i++) { /* begin the next row */ printf(""); /* begin the next entry */ printf(""); /* begin the next entry */ printf(""); /* begin the next entry */ printf(""); /* print a blank column */ printf(""); /* begin the next entry */ printf(""); /* begin the next entry */ printf(""); /* begin the next entry */ printf(""); /* begin the next entry */ printf(""); /* begin the next entry */ printf(""); /* begin the next entry */ printf(""); /* begin the next entry */ printf(""); /* begin the next entry */ printf(""); /* begin the next entry */ printf(""); /* begin the next entry */ printf(""); /* begin the next entry */ printf(""); /* end row */ printf("\n"); } /* end for */ /* print a pretty blank row */ printf(""); /* print a pretty blank row */ printf(""); /* close the table, body and html document, we are done */ printf("
valuehexcharlowerupperalphadigitxdigitalnumpunctgraphprintspacecntrl
"); printf("%d ", i); /* end entry */ printf(""); printf("%X ", i); /* end entry */ printf(""); if(isprint(i)) { printf("%c ", i); } else { printf(" "); } /* end entry */ printf(""); if (islower(i)) { printf("*"); } else { printf(" "); } /* end entry */ printf(""); if (isupper(i)) { printf("*"); } else { printf(" "); } /* end entry */ printf(""); if (isalpha(i)) { printf("*"); } else { printf(" "); } /* end entry */ printf(""); if (isdigit(i)) { printf("*"); } else { printf(" "); } /* end entry */ printf(""); if (isxdigit(i)) { printf("*"); } else { printf(" "); } /* end entry */ printf(""); if (isalnum(i)) { printf("*"); } else { printf(" "); } /* end entry */ printf(""); if (ispunct(i)) { printf("*"); } else { printf(" "); } /* end entry */ printf(""); if (isgraph(i)) { printf("*"); } else { printf(" "); } /* end entry */ printf(""); if (isprint(i)) { printf("*"); } else { printf(" "); } /* end entry */ printf(""); if (isspace(i)) { printf("*"); } else { printf(" "); } /* end entry */ printf(""); if (iscntrl(i)) { printf("*"); } else { printf(" "); } /* end entry */ printf("
\n\n\n"); } /* end main */