This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: problem with mounting / as binary or not


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.

---
#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);
}
---

--
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@cygnus.com" with one line of text: "help".

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]