Annotation of 43BSD/contrib/rn/inews.c.1.pat, revision 1.1

1.1     ! root        1: *** inews.c.1.std      Tue Oct  2 16:09:59 1984
        !             2: --- inews.c.1  Fri Sep 21 14:50:49 1984
        !             3: ***************
        !             4: *** 483,488
        !             5:   /*
        !             6:    *   Link ARTICLE into dir for ngname and update active file.
        !             7:    */
        !             8:   localize(ngname)
        !             9:   char *ngname;
        !            10:   {
        !            11: 
        !            12: --- 483,491 -----
        !            13:   /*
        !            14:    *   Link ARTICLE into dir for ngname and update active file.
        !            15:    */
        !            16: + #ifdef DOXREFS
        !            17: + long
        !            18: + #endif
        !            19:   localize(ngname)
        !            20:   char *ngname;
        !            21:   {
        !            22: ***************
        !            23: *** 515,520
        !            24:        }
        !            25:        for (;;) {
        !            26:                sprintf(bfr, "%s/%ld", dirname(ngname), ngsize+1);
        !            27:                if (link(ARTICLE, bfr) == 0) break;
        !            28:                e = errno;      /* keep log from clobbering it */
        !            29:                fprintf(stderr, "Cannot install article as %s\n", bfr);
        !            30: 
        !            31: --- 518,528 -----
        !            32:        }
        !            33:        for (;;) {
        !            34:                sprintf(bfr, "%s/%ld", dirname(ngname), ngsize+1);
        !            35: + #ifdef LINKART
        !            36: +              if (mylink(ARTICLE, bfr) == 0) break;
        !            37: +                              /* on first file inits ARTICLE, on subsequent */
        !            38: +                              /* files "links" to first article */
        !            39: + #else
        !            40:                if (link(ARTICLE, bfr) == 0) break;
        !            41:   #endif
        !            42:                e = errno;      /* keep log from clobbering it */
        !            43: ***************
        !            44: *** 516,521
        !            45:        for (;;) {
        !            46:                sprintf(bfr, "%s/%ld", dirname(ngname), ngsize+1);
        !            47:                if (link(ARTICLE, bfr) == 0) break;
        !            48:                e = errno;      /* keep log from clobbering it */
        !            49:                fprintf(stderr, "Cannot install article as %s\n", bfr);
        !            50:                log("Cannot install article as %s", bfr);
        !            51: 
        !            52: --- 524,530 -----
        !            53:                                /* files "links" to first article */
        !            54:   #else
        !            55:                if (link(ARTICLE, bfr) == 0) break;
        !            56: + #endif
        !            57:                e = errno;      /* keep log from clobbering it */
        !            58:                fprintf(stderr, "Cannot install article as %s\n", bfr);
        !            59:                log("Cannot install article as %s", bfr);
        !            60: ***************
        !            61: *** 542,547
        !            62:                strcpy(firstbufname, bfr);
        !            63:        sprintf(bfr, "%s/%ld ", ngname, ngsize+1);
        !            64:        addhist(bfr);
        !            65:        return TRUE;
        !            66:   }
        !            67:   
        !            68: 
        !            69: --- 551,557 -----
        !            70:                strcpy(firstbufname, bfr);
        !            71:        sprintf(bfr, "%s/%ld ", ngname, ngsize+1);
        !            72:        addhist(bfr);
        !            73: + #ifndef DOXREFS
        !            74:        return TRUE;
        !            75:   #else DOXREFS
        !            76:        return ngsize+1;
        !            77: ***************
        !            78: *** 543,548
        !            79:        sprintf(bfr, "%s/%ld ", ngname, ngsize+1);
        !            80:        addhist(bfr);
        !            81:        return TRUE;
        !            82:   }
        !            83:   
        !            84:   /*
        !            85: 
        !            86: --- 553,561 -----
        !            87:        addhist(bfr);
        !            88:   #ifndef DOXREFS
        !            89:        return TRUE;
        !            90: + #else DOXREFS
        !            91: +      return ngsize+1;
        !            92: + #endif DOXREFS
        !            93:   }
        !            94:   
        !            95:   /*
        !            96: ***************
        !            97: *** 553,558
        !            98:        register char *ptr;
        !            99:        register FILE *tfp;
        !           100:        int badgroup = 0, goodgroup = 0;
        !           101:   
        !           102:        /* Fill up the rest of header. */
        !           103:        if (mode != PROC) {
        !           104: 
        !           105: --- 566,574 -----
        !           106:        register char *ptr;
        !           107:        register FILE *tfp;
        !           108:        int badgroup = 0, goodgroup = 0;
        !           109: + #ifdef DOXREFS
        !           110: +      register char *nextxref = header.xref; 
        !           111: + #endif DOXREFS
        !           112:   
        !           113:        /* Fill up the rest of header. */
        !           114:        if (mode != PROC) {
        !           115: ***************
        !           116: *** 565,570
        !           117:        if (mode==PROC)
        !           118:                log("from %s relay %s", header.from, header.relayversion);
        !           119:   
        !           120:        /* Write article to temp file. */
        !           121:        tfp = xfopen(mktemp(ARTICLE), "w");
        !           122:        lhwrite(&header, tfp);
        !           123: 
        !           124: --- 581,593 -----
        !           125:        if (mode==PROC)
        !           126:                log("from %s relay %s", header.from, header.relayversion);
        !           127:   
        !           128: + #ifdef LINKART
        !           129: +      *ARTICLE = '\0';        /* tell mylink() to snarf the name */
        !           130: + #else !LINKART
        !           131: + #ifdef DOXREFS
        !           132: +      /* Open temp file for article, but link before writing */
        !           133: +      tfp = xfopen(mktemp(ARTICLE), "w");
        !           134: + #else DOXREFS
        !           135:        /* Write article to temp file. */
        !           136:        tfp = xfopen(mktemp(ARTICLE), "w");
        !           137:        lhwrite(&header, tfp);
        !           138: ***************
        !           139: *** 577,582
        !           140:        }
        !           141:        fclose(tfp);
        !           142:        fclose(infp);
        !           143:   
        !           144:        if (is_ctl) {
        !           145:                control(&header);
        !           146: 
        !           147: --- 600,607 -----
        !           148:        }
        !           149:        fclose(tfp);
        !           150:        fclose(infp);
        !           151: + #endif DOXREFS
        !           152: + #endif LINKART
        !           153:   
        !           154:        if (is_ctl) {
        !           155:                control(&header);
        !           156: ***************
        !           157: *** 593,598
        !           158:                        }
        !           159:                }
        !           160:        } else {
        !           161:                for (ptr = nbuf; *ptr;) {
        !           162:                        if (*ptr == '-') {
        !           163:                                while (*ptr++)
        !           164: 
        !           165: --- 618,627 -----
        !           166:                        }
        !           167:                }
        !           168:        } else {
        !           169: + #ifdef DOXREFS
        !           170: +              sprintf(nextxref,"%s ",SYSNAME);
        !           171: +              nextxref += strlen(nextxref);
        !           172: + #endif
        !           173:                for (ptr = nbuf; *ptr;) {
        !           174:                        if (*ptr == '-') {
        !           175:                                while (*ptr++)
        !           176: ***************
        !           177: *** 610,615
        !           178:                        }
        !           179:                        else
        !           180:                                goodgroup++;
        !           181:                        if (*nbuf)
        !           182:                                localize(ptr);
        !           183:                        while (*ptr++)
        !           184: 
        !           185: --- 639,645 -----
        !           186:                        }
        !           187:                        else
        !           188:                                goodgroup++;
        !           189: + #ifndef DOXREFS
        !           190:                        if (*nbuf)
        !           191:                                localize(ptr);
        !           192:   #else DOXREFS
        !           193: ***************
        !           194: *** 612,617
        !           195:                                goodgroup++;
        !           196:                        if (*nbuf)
        !           197:                                localize(ptr);
        !           198:                        while (*ptr++)
        !           199:                                ;
        !           200:                }
        !           201: 
        !           202: --- 642,653 -----
        !           203:   #ifndef DOXREFS
        !           204:                        if (*nbuf)
        !           205:                                localize(ptr);
        !           206: + #else DOXREFS
        !           207: +                      if (*nbuf)
        !           208: +                              sprintf(nextxref,"%s:%ld ",ptr,localize(ptr));
        !           209: +                      while (*nextxref)
        !           210: +                              nextxref++;
        !           211: + #endif DOXREFS
        !           212:                        while (*ptr++)
        !           213:                                ;
        !           214:                }
        !           215: ***************
        !           216: *** 616,621
        !           217:                                ;
        !           218:                }
        !           219:        }
        !           220:   
        !           221:   #ifdef NOFORWARD
        !           222:        if (*nbuf)
        !           223: 
        !           224: --- 652,663 -----
        !           225:                                ;
        !           226:                }
        !           227:        }
        !           228: + #ifdef DOXREFS
        !           229: +      if (goodgroup < 2)
        !           230: +          header.xref[0] = '\0';
        !           231: +      else
        !           232: +          *(nextxref-1) = '\0';
        !           233: + #endif
        !           234:   
        !           235:   #ifdef LINKART
        !           236:        tfp = xfopen(ARTICLE,"w");      /* open 1st article localized */
        !           237: ***************
        !           238: *** 617,622
        !           239:                }
        !           240:        }
        !           241:   
        !           242:   #ifdef NOFORWARD
        !           243:        if (*nbuf)
        !           244:   #endif
        !           245: 
        !           246: --- 659,683 -----
        !           247:            *(nextxref-1) = '\0';
        !           248:   #endif
        !           249:   
        !           250: + #ifdef LINKART
        !           251: +      tfp = xfopen(ARTICLE,"w");      /* open 1st article localized */
        !           252: + #endif
        !           253: + 
        !           254: + #if defined(LINKART) || defined(DOXREFS)
        !           255: +      /* Now that xref is constructed, write article to temp file. */
        !           256: +      /* (We ought to detect no room at this point and clean up.) */ 
        !           257: +      lhwrite(&header, tfp);
        !           258: +      while (fgets(bfr, BUFLEN, infp) != NULL) {
        !           259: +              /*
        !           260: +              if (!strncmp(bfr, "From ", 5))
        !           261: +                      putc('>', tfp);
        !           262: +              */
        !           263: +              fputs(bfr, tfp);
        !           264: +      }
        !           265: +      fclose(tfp);
        !           266: +      fclose(infp);
        !           267: + #endif LINKART || DOXREFS
        !           268: + 
        !           269:   #ifdef NOFORWARD
        !           270:        if (*nbuf)
        !           271:   #endif
        !           272: ***************
        !           273: *** 861,863
        !           274:                mclose(fd);
        !           275:        }
        !           276:   }
        !           277: 
        !           278: --- 922,946 -----
        !           279:                mclose(fd);
        !           280:        }
        !           281:   }
        !           282: + 
        !           283: + #ifdef LINKART
        !           284: + mylink(tmpart,linkfrom)
        !           285: + char *tmpart, *linkfrom;
        !           286: + {
        !           287: +     struct stat statbuf;
        !           288: + 
        !           289: +     if (stat(linkfrom,&statbuf)==0)
        !           290: +      return -1;
        !           291: +     if (!*tmpart)
        !           292: +      strcpy(tmpart,linkfrom);
        !           293: +     else {
        !           294: +      FILE *linkfp = fopen(linkfrom,"w");
        !           295: + 
        !           296: +      if (!linkfp)
        !           297: +          return -1;
        !           298: +      fprintf(linkfp,"%s\n",tmpart);
        !           299: +      fclose(linkfp);
        !           300: +     }
        !           301: +     return 0;
        !           302: + }
        !           303: + #endif LINKART

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.