home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Elysian Archive
/
AmigaElysianArchive.iso
/
comm
/
reflo101.lha
/
Reflow.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-09-06
|
1KB
|
55 lines
#include <exec/types.h>
#include <stdio.h>
main(int argc, char **argv)
{
FILE *fp,*ofp;
UBYTE buf[200];
BOOL fulline=FALSE;
if (argc != 3 || *argv[1]=='?')
{
printf("\x1b[4mReflow V1.01 for PManager 3.00 by Johan Billing!\n\x1b[0m"
"Usage: Reflow <Infile> <Outfile>\n");
exit(0);
}
if(!(fp=fopen(argv[1],"r")))
{
printf("Unable to open file '%s' for reading!\n",argv[1]);
exit(0);
}
if(!(ofp=fopen(argv[2],"w")))
{
printf("Unable to open file '%s' for writing!\n",argv[2]);
fclose(fp);
exit(0);
}
while(!feof(fp))
{
if(fgets(buf,99,fp))
{
if(buf[0] != 10 && buf[0] != 32 && strlen(buf) > 65)
{
if(buf[strlen(buf)-2] == 32) buf[strlen(buf)-1]=0;
else buf[strlen(buf)-1]=32;
fulline=TRUE;
}
else
{
if(fulline && buf[0]==10)
{
strcat(buf,"\n");
}
fulline=FALSE;
}
fprintf(ofp,"%s",buf);
}
}
fclose(fp);
fclose(ofp);
}