delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/09/06/11:14:49

From: elia AT itatlanta DOT com (Paul Vincent Elia)
Subject: Re: problem with mounting / as binary or not
6 Sep 1997 11:14:49 -0700 :
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <3.0.3.32.19970831172113.006b55f8.cygnus.gnu-win32@pop.mindspring.com>
Mime-Version: 1.0
X-Sender: paulelia AT pop DOT mindspring DOT com
X-Mailer: QUALCOMM Windows Eudora Pro Version 3.0.3 (32)
Original-To: hubert DOT fauque AT wanadoo DOT fr (Hubert FAUQUE), gnu-win32 AT cygnus DOT com
In-Reply-To: <3405e496.230818880@smtp.wanadoo.fr>
Original-Sender: owner-gnu-win32 AT cygnus DOT com

At 12:04 PM 8/28/97 GMT, Hubert FAUQUE wrote:

>

>I have installed Sergey's cygwin.dll and bash and I am having a

>problem:

>bash didn't find .bashrc at startup, so as I have seen on a previous

>message I have mounted c: as / with text=binary and it works for bash;

>but now is the problem: make doesn't find any include files; 

>if there is 

>  include file

>in the Makefile,

>it gives the message

>  file^M: no such file or directory

>it doesn't find the file because it adds a ^M at the end of the name;

>

>Has anybody found a solution?

>

>thanks

>

>Hubert

>

>


I know this isn't the best solution, but it may help. I wrote a simple
program (makeunix) that converts all CRLF to LF in the supplied text
file. Syntax: makeunix <<file_with_DOS_CRLFs> . It outputs to a tempfile
(same name always), deletes the original file, and renames the tempfile
back to the original filename. I've needed it for other reasons and it
has worked fine.


---

<bigger>#include <<fcntl.h>

#include <<stdio.h>


#define TEMPFILE "./~fix.tmp"


const int BUFFER_SIZE = (16 * 1024);


main (int argc, char *argv[])

{

  char buffer[BUFFER_SIZE];

  char buffer2[BUFFER_SIZE];

  int i, j, in_file, out_file, read_size;


  if (argc != 2)

    {

    printf("Usage: makeunix <<file_with_DOS_CRLFs>\n");

    exit(8);

    }


  in_file = open(argv[1],O_RDONLY);

  if (in_file<<0)

    {

    printf("Error: Could not open input file %s\n",argv[1]);

    exit(8);

    }


  out_file = open(TEMPFILE,O_BINARY|O_WRONLY|O_TRUNC|O_CREAT,0644);

  if (out_file<<0)

    {

    printf("Error: Could not create temporary output file\n");

    exit(8);

    }


  while(1)

    {

    read_size = read(in_file,buffer,sizeof(buffer));

    if (read_size==0) break; // End of file

    if (read_size<<0)

      {

      printf("Error: Problem reading from input file %s\n", argv[1]);

      exit(8);

      }


    for (i=j=0;i<<read_size;i++) if (buffer[i]!='\015')
buffer2[j++]=buffer[i];

    write(out_file,buffer2,(unsigned int)j);


    }


  close(in_file);

  close(out_file);

  remove(argv[1]);

  rename(TEMPFILE,argv[1]);

  return(0);

}

---</bigger>

--

Paul V. Elia, President, IT Atlanta, Inc., Information Technology Consultants


    (404) 467-8485    fax: (404) 846-9124    http://www.itatlanta.com
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


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