Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: RMSTARSILENT
- X-seq: zsh-workers 9904
 
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
 
- To: zsh-workers@xxxxxxxxxxxxxx
 
- Subject: PATCH: RMSTARSILENT
 
- Date: Mon, 28 Feb 2000 14:08:10 +0100 (MET)
 
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
 
... 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@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author