home *** CD-ROM | disk | FTP | other *** search
- /* Propaganda Speak -- MY VERSION! */
- #include<stdio.h>
-
- #define BOLD_ON "\033\041" /* This is the string that precedes "bold" letters */
- #define BOLD_OFF "\033\042"
-
-
-
-
- int main() {
- char *string;
- int counter;
- char *buffer;
-
- /* Now we read in the 'string' line */
- /* We are allowed 20,000 characters */
-
- string = (char *) malloc(20000);
-
-
- /* Initialize them all */
-
-
- /* Read them in from stdin--preceded by a '*' */
- gets(string);
-
- if(string[0] == '*')
- string += 2; /* Get rid of the * and space */
- else {
- puts("Error, not a pspeak-usable file");
- exit(1);
- }
-
- /* Now begin */
-
- counter = 0;
- while(1) {
- if(string[counter] == ' ') /* Avoid spaces */
- counter++;
- char outchar;
- outchar = getchar();
- if(outchar == EOF)
- break; /* End of file */
- if((outchar & ~0x20) == string[counter]) { /* Turn off the #5 bit */
- printf(BOLD_ON);
- putchar(outchar);
- printf(BOLD_OFF);
- counter++;
- if(counter > strlen(string))
- counter = 0;
- } else {
- putchar(outchar);
- }
- }
- }
-