delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/07/15/06:29:48

Date: Mon, 15 Jul 1996 13:25:20 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: "Dr. John Refling" <refling AT comet DOT lbl DOT gov>
Cc: djgpp AT delorie DOT com, DJ Delorie <dj AT delorie DOT com>
Subject: Re: fgrep from grep20b.zip crashes my machine....
In-Reply-To: <4scfv2$8fd@overload.lbl.gov>
Message-Id: <Pine.SUN.3.91.960715113208.13316T-100000@is>
Mime-Version: 1.0

On 15 Jul 1996, Dr. John Refling wrote:

> I think that grep does too.  I haven't analysed it very well, but it seems
> to me that unbalanced qoutes kill it.  For example:
> 
> fgrep "
> 
> sends my machine to its death.  Anybody else notice this?

That bug was corrected ages ago!  Your machine isn't dead, it just sits
there waiting for input endlessly (because, when the command line is
empty, the defaqult behavior is to read stdin), and you cannot interrupt
it because of the way signals are implemented in DJGPP v2.  I've uploaded
a corrected version to DJ Delorie's server somewhere in April, but it
still didn't make it to SimTel as of this writing... 

If you care to build it yourself, download the sources (grep20s.zip), 
apply the patch below, then recompile Grep.

*** grep.c~0	Tue Sep 26 12:07:08 1995
--- grep.c	Mon Mar 11 18:37:58 1996
*************** main(argc, argv)
*** 847,853 ****
  	  {
  #ifdef  __MSDOS__
              /* This allows to grep through binary files, even from a pipe. */
!             setmode(desc, O_BINARY);
  #endif
  	    filename = desc == 0 ? "(standard input)" : argv[optind];
  	    count = grep(desc);
--- 847,854 ----
  	  {
  #ifdef  __MSDOS__
              /* This allows to grep through binary files, even from a pipe. */
!             if (!isatty(desc))
!               setmode(desc, O_BINARY);
  #endif
  	    filename = desc == 0 ? "(standard input)" : argv[optind];
  	    count = grep(desc);
*************** main(argc, argv)
*** 874,880 ****
      {
        filename = "(standard input)";
  #ifdef  __MSDOS__
!       setmode(0, O_BINARY);
  #endif
        count = grep(0);
        if (count_matches)
--- 875,882 ----
      {
        filename = "(standard input)";
  #ifdef  __MSDOS__
!       if (!isatty(0))
!         setmode(0, O_BINARY);
  #endif
        count = grep(0);
        if (count_matches)

- Raw text -


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