From: sloane@kuhub.cc.ukans.edu (Bob Sloane)
Newsgroups: news.software.anu-news
Subject: Re: Search does not behave properly on 6.1b5
Date: 12 Jan 93 11:25:56 CST
Organization: University of Kansas Academic Computing Services

In <1hqg8kINN1la@dayub.dayton.saic.com>, ake@dayton.saic.com (Earle Ake) writes:
> 	If anyone else has fixed this then please post a patch.  If I get no
> responses, I will try to track down the problem.

I have a partial fix, but so far I haven't figured out how to fix the
problem completely.  This fix has not been completely tested, so there
may be problems with it.
-- 
USmail: Bob Sloane, University of Kansas Computer Center, Lawrence, KS, 66045
E-mail: sloane@kuhub.cc.ukans.edu, sloane@ukanvax.bitnet, AT&T: (913)864-0444 

*** $news:[newsmgr.news_v61_src]newssearch.c
--- $news:[newsmgr.news_src]newssearch.c
**************
*** 513,518
    unsigned short ngroup_len = 0, s_len;
    $DESCRIPTOR(ngroup_dsc,ngroup);
    $DESCRIPTOR(s_dsc,s);
  
    if (cli$present(c$dsc("HEADER")) == CLI$_NEGATED) ldheader = 0;
    if (cli$present(c$dsc("TPU")) & 1) ldtpu = 1;
--- 513,519 -----
    unsigned short ngroup_len = 0, s_len;
    $DESCRIPTOR(ngroup_dsc,ngroup);
    $DESCRIPTOR(s_dsc,s);
+   int status;
  
    if (cli$present(c$dsc("HEADER")) == CLI$_NEGATED) ldheader = 0;
    if (cli$present(c$dsc("TPU")) & 1) ldtpu = 1;
**************
*** 527,533
      }
    else i = 0;
  
!   if (!context) {
      dheader = ldheader;
      dtpu = ldtpu;
      num_groups = 0;
--- 528,538 -----
      }
    else i = 0;
  
!   if ((status=cli$get_value(c$dsc("TARGET"),&s_dsc,&s_len)) & 1) {
!     int g;
!     cxtgrp = 0;
!     cxtitm = 0;
!     context = 0;              
      dheader = ldheader;
      dtpu = ldtpu;
      sea_groups = num_groups = 1;
**************
*** 530,536
    if (!context) {
      dheader = ldheader;
      dtpu = ldtpu;
!     num_groups = 0;
      }
  
    if (cli$present(c$dsc("NEWSGROUPS")) & 1) {
--- 535,547 -----
      context = 0;              
      dheader = ldheader;
      dtpu = ldtpu;
!     sea_groups = num_groups = 1;
!     d_itm[0].fitm = -1;
!     d_itm[0].ngrp = curr_g;
!     for (g = 1; g < NOTE_RANGE_MAX; ++g) {
!       d_itm[g].fitm = 0    /* reset items in table at /NEWGROUPS*/;
!       }
!     s[s_len] = '\0';
      }
    else if (!context) {
      int g;
**************
*** 532,537
      dtpu = ldtpu;
      num_groups = 0;
      }
  
    if (cli$present(c$dsc("NEWSGROUPS")) & 1) {
      if (context) {
--- 543,564 -----
        }
      s[s_len] = '\0';
      }
+   else if (!context) {
+     int g;
+     status = get_input_dflt(&s_dsc,c$dsc("Search String: "),&s_len,
+       c$dsc(target),0);
+     if (status == RMS$_EOF) return(0);
+     s[s_len] = '\0';
+     if (!i) display_call = 1;
+     dheader = ldheader;
+     dtpu = ldtpu;
+     sea_groups = num_groups = 1;
+     d_itm[0].fitm = -1;
+     d_itm[0].ngrp = curr_g;
+     for (g = 1; g < NOTE_RANGE_MAX; ++g) {
+       d_itm[g].fitm = 0    /* reset items in table at /NEWGROUPS*/;
+       }
+     }
  
    if (cli$present(c$dsc("NEWSGROUPS")) & 1) {
      if (context) {
**************
*** 581,605
      while (d_itm[num_groups].fitm) ++num_groups;
      }
    get_filter();
- 
-   if (cli$get_value(c$dsc("TARGET"),&s_dsc,&s_len) & 1) {
-     if (context) {
-       cxtgrp = 0;
-       cxtitm = 0;
-       context = 0;              
-       dheader = ldheader;
-       dtpu = ldtpu;
-       num_groups = 0;
-       }
-     s[s_len] = '\0';
-     }
-   else if (!context) {
-     status = get_input_dflt(&s_dsc,c$dsc("Search String: "),&s_len,
-       c$dsc(target),0);
-     if (status == RMS$_EOF) return(0);
-     s[s_len] = '\0';
-     if (!i) display_call = 1;
-     }
  
    if (cli$present(c$dsc("WILDCARD")) & 1) s_type = 1;
    else if (cli$present(c$dsc("PATTERN")) & 1) s_type = 2;
--- 608,613 -----
      while (d_itm[num_groups].fitm) ++num_groups;
      }
    get_filter();
  
    if (cli$present(c$dsc("WILDCARD")) & 1) s_type = 1;
    else if (cli$present(c$dsc("PATTERN")) & 1) s_type = 2;