Mail Archives: cygwin/2000/05/24/11:03:51
Hallo!
I've found, that for DOS-EOL (\n\r)
fgets returns the string terminated by \r
(for UNIX-EOL (\n) is all OK).
By this way I can't use any makefile generated
by "bash ./configure" under W32 without converting it into
unix-EOL.
It was some DOS-EOL problem with sed.exe and I recompiled it with
CYGNUS on W32
To configure "sed" without right working "sed" I used sed-replacement
script:
#! bash
! d2u_s $1 $2 $3 $4
! sed_org "$@"
and wrote small d2u_s.c (MUST be compiled with CYGNUS!) to convert "-f
filename" file from DOS-EOL to UNIX-EOL.
If you interesting I can sent you sed-binaries :-)
Serge
*********d2u_s.c*********
#include <stdio.h>
void d2u(char * arg)
{
FILE* in;
FILE* tmp;
FILE* out;
int c;
in=fopen(arg,"rb");
tmp=fopen("d2u_tmp_","wb");
while((c=fgetc(in)) != EOF)
{
fprintf(tmp,"%c",(char)c);
}
fclose(tmp);
fclose(in);
tmp=fopen("d2u_tmp_","rb");
out=fopen(arg,"wb");
while((c=fgetc(tmp)) != EOF)
{
if(c!=0x0D) fprintf(out,"%c",(char)c);
}
fclose(out);
fclose(tmp);
}
int main(int argc, char ** argv)
{
int i;
for(i=1;i<argc;i++)
{
if(argv[i][0]=='-')
if(argv[i][1]=='f')
if(argv[i][2]==0x00)
if((i+1)<argc) d2u(argv[i+1]);
}
return 0;
}
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com
- Raw text -