zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: RMSTARSILENT
@ 2000-02-28 13:08 Sven Wischnowsky
  2000-02-28 19:12 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Sven Wischnowsky @ 2000-02-28 13:08 UTC (permalink / raw)
  To: zsh-workers


... or, more precisely, getquery() and noquery().

Doing `rm *' didn't work for me any more because getquery() always
retunred immediatly with `n'. Although this makes `rm *' really save,
I think it shouldn't do that. The problem was in noquery():

  int
  noquery(int purge)
  {
      int c, val = 0;

  #ifdef FIONREAD
      ioctl(SHTTY, FIONREAD, (char *)&val);
      if (purge) {
	  while(val--)
	      read(SHTTY, &c, 1);
      }
  #endif

      return val;
  }

So, with FIONREAD and purge!=0, we always returned -1. That was wrong, 
wasn't it?

Bye
 Sven

diff -ru ../z.old/Src/utils.c Src/utils.c
--- ../z.old/Src/utils.c	Mon Feb 28 12:58:36 2000
+++ Src/utils.c	Mon Feb 28 14:02:26 2000
@@ -1318,7 +1318,7 @@
 #ifdef FIONREAD
     ioctl(SHTTY, FIONREAD, (char *)&val);
     if (purge) {
-	while(val--)
+	for (; val; val--)
 	    read(SHTTY, &c, 1);
     }
 #endif

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: PATCH: RMSTARSILENT
  2000-02-28 13:08 PATCH: RMSTARSILENT Sven Wischnowsky
@ 2000-02-28 19:12 ` Bart Schaefer
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2000-02-28 19:12 UTC (permalink / raw)
  To: zsh-workers

On Feb 28,  2:08pm, Sven Wischnowsky wrote:
} Subject: PATCH: RMSTARSILENT
}
} ... or, more precisely, getquery() and noquery().
} 
} Doing `rm *' didn't work for me any more because getquery() always
} retunred immediatly with `n'.
} 
}   #ifdef FIONREAD
}       ioctl(SHTTY, FIONREAD, (char *)&val);
}       if (purge) {
} 	  while(val--)
} 	      read(SHTTY, &c, 1);
}       }
}   #endif
} 
} So, with FIONREAD and purge!=0, we always returned -1. That was wrong, 
} wasn't it?

Oops, yes.  I meant to write "if (purge && val)".  Sorry about that.

Your fix is of course equivalent.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2000-02-28 19:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-02-28 13:08 PATCH: RMSTARSILENT Sven Wischnowsky
2000-02-28 19:12 ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).