home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 5 Edit
/
05-Edit.zip
/
assist11.zip
/
TOGGLE.C
< prev
next >
Wrap
Text File
|
1999-04-25
|
1KB
|
57 lines
/******************************************************************/
/* Assistant/2 copyright (c) 1998 Hinnerk Becker */
/* Macro Example Code */
/******************************************************************/
/******************************************************************/
/* NOTE: Read the text from STDIN. */
/* */
/* Write your results to STDOUT. */
/* The macro will wait until this process terminates */
/******************************************************************/
#include <stdio.h>
#include <fcntl.h>
#include <io.h>
int main(int argc, void * arg[]) {
char ch, mode;
int count;
if(argc!=2) return 1;
mode = * ( (char *) arg[1]);
setmode(fileno(stdin), O_BINARY);
setmode(fileno(stdout), O_BINARY);
do {
count = fread(&ch,1,1,stdin);
if(count) {
if(mode=='D'&&ch>='A'&&ch<='Z')
putchar(ch-'A'+'a');
else
if(mode=='U'&&ch>='a'&&ch<='z')
putchar(ch-'a'+'A');
/* needed if you use EXEC_I instead of EXEC_IC */
/* else
if(ch==10)
printf("<CR>");
else
if(ch=='<')
printf("<<>");
*/
else
putchar(ch);
}
}
while(count);
setmode(fileno(stdout), O_TEXT);
setmode(fileno(stdin), O_TEXT);
return 0;
}