Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site utcsstat.UUCP Path: utzoo!utcsstat!geoff From: geoff@utcsstat.UUCP (Geoff Collyer) Newsgroups: net.news.b Subject: assorted 2.10.1 bug fixes and changes Message-ID: <1889@utcsstat.UUCP> Date: Tue, 8-May-84 05:40:06 EDT Article-I.D.: utcsstat.1889 Posted: Tue May 8 05:40:06 1984 Date-Received: Tue, 8-May-84 05:47:42 EDT Organization: U. of Toronto, Canada Lines: 123 I don't think I've seen any of these bugs posted yet. I put sortactive() in our readnews and got loud screams from users who were suddenly seeing groups they had never read before in front of all their old favourites. If you want groups not in the user's .newsrc yet in the active file to appear *last*, add the marked lines in the middle of sortactive() (in rfuncs.c) table[nlines].rcpos = findrcline(line); + if (table[nlines].rcpos == -1) /* not in .newsrc */ + table[nlines].rcpos = LINES; /* huge, sort to the end */ table[nlines].actpos = actpos; Elsewhere in rfuncs.c, I found some more sscanf's whose return values were unchecked (yawn). I suppose I should 'egrep scanf *.c' some day and fix them once and for all. Line numbers are approximate. 35c35,38 < sscanf(afline, "%s %ld", bfr, &nngsize); --- > if (sscanf(afline, "%s %ld", bfr, &nngsize) < 2) { > bfr[0] = '\0'; > nngsize = 0; > } 257c256,259 < sscanf(afline, "%s %ld", bfr, &nngsize); --- > if (sscanf(afline, "%s %ld", bfr, &nngsize) < 2) { > bfr[0] = '\0'; > nngsize = 0; > } There's a latent bug in selectng() in rfuncs.c which only showed up here when a user without an options line in his .newsrc tried `readnews -x' and was told `No news.'; he knew this was too good to be true and reported it. 75,82c78,83 < if (!xflag) { < i = findrcline(name); < if (i >= 0) { < if (index(rcline[i], '!')) { < groupdir[0] = 0; < return 1; < } < sprintf(rcbuf, "%s,%ld", rcline[i], ngsize+1); --- > if (xflag || (i = findrcline(name)) < 0) > sprintf(rcbuf, "ng: %ld", ngsize+1); > else { > if (index(rcline[i], '!')) { > groupdir[0] = 0; > return 1; 84,85c85 < else < sprintf(rcbuf, "ng: %ld", ngsize+1); --- > sprintf(rcbuf, "%s,%ld", rcline[i], ngsize+1); The problem is that under -x, the old code didn't initialise rcbuf. If the above diffs aren't enough, here's the new code fragment: if (xflag || (i = findrcline(name)) < 0) sprintf(rcbuf, "ng: %ld", ngsize+1); else { if (index(rcline[i], '!')) { groupdir[0] = 0; return 1; } sprintf(rcbuf, "%s,%ld", rcline[i], ngsize+1); } Our readr.c didn't ever print the `Last article' prompt and I fixed it by rearranging readr() (I also fixed a debugging printf format): if (getnextart(FALSE)) { /* no more articles */ if (sigtrap || !news) break; /* don't print Last article */ /* else fall through */ } else { #ifdef DEBUG printf("after getnextart, fp %x, pos %ld, bit %d, group '%s', filename '%s'\n", fp, ftell(fp), bit, groupdir, filename); #endif strcpy(goodone, filename); if (pflag || lflag || eflag) { /* This code should be gotten rid of */ if (sigtrap) { qfflush(ofp); fprintf(ofp, "\n"); cdump(ofp); _exit(0); /* kludge! drop when qfflush works */ return; } clear(bit); nextbit(); if (fp) { fclose(fp); fp = NULL; } continue; } } for (; ; ) { If you are using sortactive(), you'll probably want to read the user's .newrc, even under -x, so that you can sort the active file into .newsrc order. In readnews.c, I changed a few lines and added two: 225c225,226 < if (!xflag && (rcfp = xfopen(newsrc, "r"))) { --- > /* must read newsrc under xflag for sortactive() */ > if ((rcfp = xfopen(newsrc, "r"))) { sortactive(); + if (xflag) + line = -1; /* ignore newsrc by forgetting its contents */ That's all for today. Geoff Collyer, U. of Toronto Computing Services