mirror of
https://github.com/dschmenk/apple2pi.git
synced 2024-11-30 22:50:47 +00:00
25 lines
338 B
C
25 lines
338 B
C
|
#include <stdio.h>
|
||
|
#include <fcntl.h>
|
||
|
|
||
|
int main(int argc, char **argv)
|
||
|
{
|
||
|
int fout;
|
||
|
char c;
|
||
|
|
||
|
if (argc > 1)
|
||
|
fout = open(argv[1], O_WRONLY|O_CREAT, 0644);
|
||
|
else
|
||
|
fout = 1;
|
||
|
while ((c = getc(stdin)) != EOF)
|
||
|
{
|
||
|
if (c == '\n')
|
||
|
c = '\r';
|
||
|
if (c == '\t')
|
||
|
c = ' ';
|
||
|
c |= 0x80;
|
||
|
write(fout, &c, 1);
|
||
|
}
|
||
|
close(fout);
|
||
|
return (0);
|
||
|
}
|