delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2000/05/24/11:03:51

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sourceware DOT cygnus DOT com>
List-Archive: <http://sourceware.cygnus.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sourceware DOT cygnus DOT com>
List-Help: <mailto:cygwin-help AT sourceware DOT cygnus DOT com>, <http://sourceware.cygnus.com/ml/#faqs>
Sender: cygwin-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com
Message-ID: <392BEE34.67F53431@physik.uni-augsburg.de>
Date: Wed, 24 May 2000 16:59:00 +0200
From: "Sergey R. Grigoriev" <Serguei DOT Grigoriev AT Physik DOT Uni-Augsburg DOT DE>
Reply-To: Serguei DOT Grigoriev AT Physik DOT Uni-Augsburg DOT DE
Organization: Uni-Augsburg
X-Mailer: Mozilla 4.7 [en] (Win98; U)
X-Accept-Language: de,en
MIME-Version: 1.0
To: cygwin AT sourceware DOT cygnus DOT com
Subject: DOS-EOL bug in "fgets"

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019