delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/05/15/20:41:27

From: jeffdb AT netzone DOT com ("Mikey")
Subject: Re: Pls help: can't rebuild terminfo after installing ncurses
15 May 1997 20:41:27 -0700 :
Sender: mail AT cygnus DOT com
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <199705151902.MAA11694.cygnus.gnu-win32@nz1.netzone.com>
X-Mailer: Microsoft Outlook Express 4.71.0544.0
Original-To: <bpr AT gecko DOT de>
Original-Cc: "cygnus" <gnu-win32 AT cygnus DOT com>
X-Priority: 3
X-MSMail-Priority: Normal
MIME-Version: 1.0
X-MimeOLE: Produced By Microsoft MimeOLE Engine V4.71.0544.0
Original-Sender: owner-gnu-win32 AT cygnus DOT com

This is a multi-part message in MIME format.

------=_NextPart_000_01BC60FE.F431DF00
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit

did you get rid of the \r\n's in tst.c?
you now have a un*x system, any "text" that you send to gcc
or cpp must have LF only.

appended is a small program that I rewrote from djgpp source for linux, and
gnu-win32 to convert,
it will do disk files if given them on the command line, ie ./dtou
windows.h
gives you a windows.h with no \r's, ./dtou * converts all files in the
directory
and if called with no arguments stdin|dtou|stdout.
or ./dtou< windows.h > windows.new.

it will not work across mount points, unless they are on the same
filesystem.

if you link it to ./utod, it will convert the other way, \n to \r\n
ln -s dtou.exe utod, at least under win95, this works.

I didn't bother with ^Z since you almost never see it any more as an eof
except that micros*** aparently uses it to protect notes at the end of some
of
their header files.Well what can you expect from a company that is still
selling DOS in 1997 disguised as a GUI?

 ----
From: Bernd Prager <bernd AT asterix DOT gecko DOT de>
To: Mikey <jeffdb AT netzone DOT com>
Date: Thursday, May 15, 1997 6:31 AM
Subject: Re: Pls help: can't rebuild terminfo after installing ncurses

>
>> Nucrses recognizes systems that define O_BINARY as needing text mode
>>  reads.
>>
>> Solution, remount your filesystems as binary.
>> ie for drv in d e f g;do umount $drv:\\;mount -b $drv:\\ /$drv;done
>> then use registry editor to change fbinary to 1 for /,
>> and reinstall user-tools.exe, and cdk.exe, to fix the header files.
>> you will find that many things work much better.
>>  ----
>
>I done it exactly. Now I can't compile simple programs:
>-------- snip -------------------
>[6]: gcc tst.c
>tst.c:1: syntax error before `<'
>gcc: Internal compiler error: program cc1 got fatal signal 33
>[7]: cat tst.c
><include stdio.h>
>
>main()
>{puts ("hello world!"); }
>
>[9]: mount
>Device           Directory           Type        Flags
>\\.\tape1:       /dev/st1            native      no-mixed,text!=binary
>\\.\tape0:       /dev/st0            native      no-mixed,text!=binary
>\\.\b:           /dev/fd1            native      no-mixed,text!=binary
>\\.\a:           /dev/fd0            native      no-mixed,text!=binary
>c:\gnuwin32\b18  /                   native      no-mixed,text=binary
>-------- snip -------------------
>Did I forgot something?
>Bernd
>_____________________________________________________________________
>Bernd Prager
>GECKO mbH; Wismarsche Str.3, 18057 Rostock; Germany
>http://www.gecko.de
>
>PGP Key fingerprint = 83 54 6A 3B 7A 9D 6C 0E F3 41 CE 99 11 30 B7 D6
>public key by mailto:bpr AT gecko DOT de?Subject=SendPGPKey
>_____________________________________________________________________
> 

------=_NextPart_000_01BC60FE.F431DF00
Content-Type: application/octet-stream;
	name="dtou.c"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="dtou.c"

/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */=0A=
/* modified for unixish paths, and direct conversion by=0A=
jeffdb AT netzone DOT com Mikey */ =0A=
#include <stdio.h>=0A=
#include <sys/types.h>=0A=
#include <utime.h>=0A=
#include <fcntl.h>=0A=
#include <sys/stat.h>=0A=
#include <stdlib.h>=0A=
#include <string.h>=0A=
#include <unistd.h>=0A=
#include <dirent.h>=0A=
#define BUFFSIZE 4096=0A=
=0A=
#ifndef O_BINARY=0A=
#  define O_BINARY 0=0A=
#endif=0A=
=0A=
static int=0A=
cvt(char *fname, int is_dtou)=0A=
{=0A=
  int sf, df, il, ol, end;=0A=
  register char *iptr, *optr;=0A=
  char ibuf[BUFFSIZE], obuf[BUFFSIZE * 2 + 1], ctrlz[1];=0A=
  char tfname[FILENAME_MAX];=0A=
  struct utimbuf ftime;=0A=
  struct stat *mystat, oldstat;=0A=
=0A=
  mystat =3D &oldstat;=0A=
  if (*fname =3D=3D '-')=0A=
    {=0A=
      sf =3D 0; =0A=
  /*    printf("stdin =3D %d\n", sf); */=0A=
      df =3D 1; =0A=
  /*    printf("stdout =3D %d\n", *stdout); */=0A=
    }=0A=
  else=0A=
    {=0A=
=0A=
      sprintf(tfname, "cvt$$");=0A=
      sf =3D open(fname, O_RDONLY|O_BINARY); /* O_TEXT dosen't work in =
cygwin32 b17.1 w/binary mounted filesystems so we have to do it all =
ourselves. */=0A=
      if (sf < 1)=0A=
        {=0A=
          perror(fname);=0A=
          return 1;=0A=
        }=0A=
      df =3D open(tfname, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, 0644);=0A=
      if (df < 1)=0A=
        {=0A=
          perror(tfname);=0A=
          close(sf);=0A=
          return 1;=0A=
        }=0A=
    }=0A=
  while ((il=3Dread(sf, ibuf, BUFFSIZE)) > 0)=0A=
    {=0A=
    iptr =3D &ibuf;=0A=
    optr =3D &obuf;=0A=
    if (is_dtou)=0A=
	{=0A=
      il++;=0A=
	}=0A=
=0A=
    ol =3D il;=0A=
    if (is_dtou)=0A=
      {=0A=
        while(il > 0)=0A=
          {=0A=
            while ((*iptr !=3D '\r') && (il > 0))=0A=
	      {=0A=
	        *optr++ =3D *iptr++;=0A=
	        il--;=0A=
	      }=0A=
            *iptr++;=0A=
            ol--;=0A=
	    il--;=0A=
          }=0A=
      }=0A=
    else=0A=
      {=0A=
        while(il > 0)=0A=
	  {=0A=
	    while ((*iptr !=3D '\n') && (il > 0))=0A=
	      {=0A=
		*optr++ =3D *iptr++;=0A=
	 	il--;=0A=
	      }=0A=
	      if (il)=0A=
		{=0A=
	          *optr++ =3D '\r';=0A=
	          *optr++ =3D *iptr++;=0A=
	          ol++;=0A=
	          il--;=0A=
		}=0A=
           }=0A=
      } 	=0A=
    write(df, obuf, ol);=0A=
    }=0A=
  if (*fname !=3D '-')=0A=
    { =0A=
	  fstat(sf, mystat);=0A=
	  ftime.actime =3D oldstat.st_atime;=0A=
	  ftime.modtime =3D oldstat.st_mtime;=0A=
	  utime(tfname, &ftime);=0A=
	  close(sf);=0A=
	  close(df);=0A=
	  remove(fname);=0A=
	  rename(tfname, fname);=0A=
    }=0A=
  return 0;=0A=
}=0A=
=0A=
int=0A=
main(int argc, char **argv)=0A=
{=0A=
  int i;=0A=
  int is_dtou =3D 0;=0A=
  int rv =3D 0;=0A=
  char *temp, *progname;=0A=
=0A=
  progname =3D argv[0];=0A=
  temp =3D strrchr(progname, '/');=0A=
  if (temp =3D=3D NULL)=0A=
    {=0A=
    temp =3D progname;=0A=
    }=0A=
  else=0A=
    {=0A=
    ++temp;=0A=
    }=0A=
  if (strlen (temp) >=3D 4 && strcmp (temp + strlen (temp) - 4, ".exe") =
=3D=3D 0)=0A=
    *(temp + strlen (temp) - 4) =3D '\0'; /* dump .exe suffix if =
necessary */ =0A=
=0A=
  if (strcmp (temp + strlen (temp) - 4, "dtou") =3D=3D 0)=0A=
      is_dtou =3D 1;=0A=
=0A=
  if (argc =3D=3D 1)=0A=
	{=0A=
	rv +=3D cvt((char *)"-\0", is_dtou);=0A=
	return rv;=0A=
	}=0A=
=0A=
/*  if (argv[argc] =3D=3D '-')=0A=
	printf("print to stdout\n"); */=0A=
	=0A=
 =0A=
  for (argc--, argv++; argc; argc--, argv++)=0A=
    rv +=3D cvt(*argv, is_dtou);=0A=
  return rv;=0A=
}=0A=

------=_NextPart_000_01BC60FE.F431DF00--

-
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