SCCS-vsn: bin/csh/func.c 5.31
-static char sccsid[] = "@(#)func.c 5.30 (Berkeley) %G%";
+static char sccsid[] = "@(#)func.c 5.31 (Berkeley) %G%";
#endif /* not lint */
#include <sys/types.h>
#endif /* not lint */
#include <sys/types.h>
{
struct Ain o;
struct whyle *nwp;
{
struct Ain o;
struct whyle *nwp;
- if (o.type != F_SEEK)
- return;
for (; whyles; whyles = nwp) {
register struct whyle *wp = whyles;
nwp = wp->w_next;
for (; whyles; whyles = nwp) {
register struct whyle *wp = whyles;
nwp = wp->w_next;
- if (wp->w_start.type != F_SEEK)
- break;
- if (wp->w_end.type != I_SEEK) {
- if (wp->w_end.type != F_SEEK)
- break;
- if (o.f_seek >= wp->w_start.f_seek &&
- (wp->w_end.f_seek == 0 || o.f_seek < wp->w_end.f_seek))
- break;
+
+ /*
+ * We free loops that have different seek types.
+ */
+ if (wp->w_end.type != I_SEEK && wp->w_start.type == wp->w_end.type &&
+ wp->w_start.type == o.type) {
+ if (wp->w_end.type == F_SEEK) {
+ if (o.f_seek >= wp->w_start.f_seek &&
+ (wp->w_end.f_seek == 0 || o.f_seek < wp->w_end.f_seek))
+ break;
+ }
+ else {
+ if (o.a_seek >= wp->w_start.a_seek &&
+ (wp->w_end.a_seek == 0 || o.a_seek < wp->w_end.a_seek))
+ break;
+ }
if (wp->w_fe0)
blkfree(wp->w_fe0);
if (wp->w_fename)
if (wp->w_fe0)
blkfree(wp->w_fe0);
if (wp->w_fename)