ken@turtlevax.UUCP (Ken Turkowski) (10/05/84)
In the standard distributed version of postnews, one must laboriously enter the article numbers of a referenced article until it is the one that you want. Below is an enhancement which allows one to peruse the articles by just hitting the carriage return. The default is to start with the most recent article and work your way back, but the direction of search can be changed with '+' and '-'; of course, one may also explicitly give the number. Below is a set of diffs with context: ----------------------------------------------------------------- *** postnews.c_old --- postnews.c *************** *** 53,58 register char *c; int fd; char canpost; getpr("In what newsgroup was the article posted? ",ng); if (!valid_ng(ng, &i, &j, &canpost)) --- 53,59 ----- register char *c; int fd; char canpost; + int lastnum, dir; getpr("In what newsgroup was the article posted? ",ng); if (!valid_ng(ng, &i, &j, &canpost)) *************** *** 62,67 byebye("You are not allowed to post to that group."); printf("Valid article numbers are from %ld to %ld\n", j, i); for(;;) { getpr("\nWhat was the article number? ", num); --- 63,70 ----- byebye("You are not allowed to post to that group."); printf("Valid article numbers are from %ld to %ld\n", j, i); + lastnum = i + 1; + dir = -1; for(;;) { getpr("\nWhat was the article number? ", num); *************** *** 65,72 for(;;) { getpr("\nWhat was the article number? ", num); ! if (num == 0) ! continue; sprintf(original, "%s/%s", SPOOL, ng); for (c=original+strlen(SPOOL)+1; *c ;++c) if (*c == '.') --- 68,84 ----- for(;;) { getpr("\nWhat was the article number? ", num); ! switch (num[0]) { ! case '+': ! dir = 1; ! sprintf(num, "%d", lastnum + 1); ! break; ! case '-': ! dir = -1; ! case 0: ! sprintf(num, "%d", lastnum + dir); ! break; ! } sprintf(original, "%s/%s", SPOOL, ng); for (c=original+strlen(SPOOL)+1; *c ;++c) if (*c == '.') *************** *** 81,87 printf("%s\n", buf); if (article_line(original, "Subject: ", buf)) printf("%s\n", buf); ! if (askyes("Is this the one you want? ", "")) break; } else printf("I can't find that article.\n"); --- 93,99 ----- printf("%s\n", buf); if (article_line(original, "Subject: ", buf)) printf("%s\n", buf); ! if (askyes("Is this the one you want? ", "n")) break; } else printf("I can't find that article.\n"); *************** *** 85,90 break; } else printf("I can't find that article.\n"); } followup(original); --- 97,103 ----- break; } else printf("I can't find that article.\n"); + lastnum = atoi(num); } followup(original); -- Ken Turkowski @ CADLINC, Palo Alto, CA UUCP: {amd,decwrl,flairvax,nsc}!turtlevax!ken ARPA: turtlevax!ken@DECWRL.ARPA