incfile: fixed 'D' so that the entire definition of a word will be
authorGary M. Levin <garrison@ucbvax.Berkeley.EDU>
Wed, 12 Jun 1985 07:45:20 +0000 (23:45 -0800)
committerGary M. Levin <garrison@ucbvax.Berkeley.EDU>
Wed, 12 Jun 1985 07:45:20 +0000 (23:45 -0800)
flushed when it has already been defined.
disambiguate: fixed loop conditions to avoid compares past end of list

SCCS-vsn: contrib/bib/src/bibargs.c 2.9

usr/src/contrib/bib/src/bibargs.c

index 748f25a..92d879b 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)bibargs.c  2.8     %G%";
+static char sccsid[] = "@(#)bibargs.c  2.9     %G%";
 #endif not lint
 /*
         Authored by: Tim Budd, University of Arizona, 1983.
 #endif not lint
 /*
         Authored by: Tim Budd, University of Arizona, 1983.
@@ -292,8 +292,12 @@ incfile(np)
 
          case 'D': if ((i = getwrd(line, 1, word)) == 0)
                       error("word expected in definition");
 
          case 'D': if ((i = getwrd(line, 1, word)) == 0)
                       error("word expected in definition");
-                  if (wordsearch(word))
+                  if (wordsearch(word)) { /* already there-toss rest of def.*/
+                       while(line[strlen(line)-1] == '\\' ) {
+                            if (tfgets(line, LINELENGTH, fd) == NULL) break;
+                       }
                        break;
                        break;
+                  }
                    for (p = &line[i]; *p == ' '; p++) ;
                    for (strcpy(dline, p); dline[strlen(dline)-1] == '\\'; ){
                        dline[strlen(dline)-1] = '\n';
                    for (p = &line[i]; *p == ' '; p++) ;
                    for (strcpy(dline, p); dline[strlen(dline)-1] == '\\'; ){
                        dline[strlen(dline)-1] = '\n';
@@ -992,14 +996,14 @@ return(cp);
 {  reg int i, j;
        char adstr;
 
 {  reg int i, j;
        char adstr;
 
-   for (i = 0; i < numrefs; i = j) {
+   for (i = 0; i < numrefs-1; i = j) {
       j = i + 1;
       if (strcmp(refinfo[i].ri_cite, refinfo[j].ri_cite)==0) {
          adstr = 'a';
       j = i + 1;
       if (strcmp(refinfo[i].ri_cite, refinfo[j].ri_cite)==0) {
          adstr = 'a';
-         for(j = i+1; strcmp(refinfo[i].ri_cite,refinfo[j].ri_cite) == 0; j++) {
+         for(j = i+1;
+            j<numrefs && strcmp(refinfo[i].ri_cite,refinfo[j].ri_cite) == 0;
+            j++) {
             adstr = 'a' + (j-i);
             adstr = 'a' + (j-i);
-            if (j == numrefs)
-               break;
            refinfo[j].ri_disambig[0] = adstr;
             }
         refinfo[i].ri_disambig[0] = 'a';
            refinfo[j].ri_disambig[0] = adstr;
             }
         refinfo[i].ri_disambig[0] = 'a';