ka@spanky.UUCP (06/07/83)
# I was impressed with stolaf!borman's code to speed up readnews. # It decreased the time for vnews -x -n net.misc to find the first # article from 80 seconds to 1.5 seconds. To install his changes # into vnews, feed the body of this article into the shell. This # is supposed to work even if you have made local changes, but the # original visual.c will be moved to OLDvisual.c so you can do a # diff to be sure. The call to growlin will be fixed if you haven't # already changed it. mv visual.c OLDvisual.c (sed 's/ //' | ed OLDvisual.c) <<\! H /^getnextart/kg /^appfile/+22c growline(icol); . 'g+66a badart: . 'g+63,'g+65c if ((fp = fopen(filename, "r")) == NULL) { /* since there can be holes in legal article numbers, */ /* we wait till we hit 5 consecutive bad articles */ /* before we haul off and scan the directory */ if (++noaccess < 5) goto badart; fp = fopen(dirname(groupdir), "r"); if (fp == NULL) { msg("Can't open %s", dirname(groupdir)); #ifdef DEBUG fprintf(stderr, "can't open groupdir (%s)\n", dirname(groupdir)); #endif noaccess = 0; goto badart; } nextnum = rflag ? 0 : ngsize; while (fread(&dir, sizeof(dir), 1, fp) == 1) { if (!dir.d_ino) continue; tnum = atol(dir.d_name); #ifdef DEBUG fprintf(stderr, "art %s (%ld) next %ld\n", dir.d_name, tnum, nextnum); #endif DEBUG if (tnum <= 0) continue; if (rflag ? (tnum > nextnum && tnum < bit) : (tnum < nextnum && tnum > bit)) nextnum = tnum; } if (rflag ? (nextnum >= bit) : (nextnum <= bit)) goto badart; do { clear(bit); nextbit(); } while (rflag ? (nextnum < bit) : (nextnum > bit)); obit = -1; aabs = FALSE; fclose(fp); goto nextart; #ifdef DEBUG fprintf(stderr, "bit %d nextnum %ld\n", bit, nextnum); #endif DEBUG } else noaccess = 0; if (hread(&h, fp, TRUE) == NULL . 'g+2a int noaccess; struct direct dir; long nextnum, tnum; long atol(); . 0;/^ \* Kludge: space/;.c * Kludge: space so that routines can access beyond . 0;/^#include "rparams\.h"$/a #include <sys/dir.h> . w visual.c !