Allow [.$C$4D-2 cits....] (for example) buried in citations
authorRobert R. Henry <rrh@ucbvax.Berkeley.EDU>
Wed, 25 Jan 1984 04:55:43 +0000 (20:55 -0800)
committerRobert R. Henry <rrh@ucbvax.Berkeley.EDU>
Wed, 25 Jan 1984 04:55:43 +0000 (20:55 -0800)
to change the citation format string.  Unfortunately, the citation string
can only be set once, and effect the entire file.  Also, add citation format
9, for printing the entire last name of the principle author.

SCCS-vsn: contrib/bib/src/bib.c 2.3

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

index 2ddc996..9e5dee1 100644 (file)
@@ -253,8 +253,26 @@ main(argc, argv)
    char huntstr[HUNTSIZE];
 {  char rf[REFSIZE], ref[REFSIZE], *r, *hunt();
    int  i, match(), getwrd();
    char huntstr[HUNTSIZE];
 {  char rf[REFSIZE], ref[REFSIZE], *r, *hunt();
    int  i, match(), getwrd();
-
-   r = hunt(huntstr);
+   char        *realhstr;
+
+   realhstr = huntstr;
+   if (strncmp(huntstr, "$C$", 3) == 0){
+       char *from, *to;
+       for(from = huntstr + 3, to = citetemplate; *from; from++, to++){
+               switch(*from){
+               case '\0':
+               case ' ':
+               case '\n':
+               case '\t':      goto outcopy;
+               default:        *to = *from;
+               }
+       }
+   outcopy: ;
+       *to = 0;
+       *from = 0;
+       realhstr = from + 1;
+   }
+   r = hunt(realhstr);
    if (r != NULL) {
       /* exapand defined string */
       strcpy(rf, r);
    if (r != NULL) {
       /* exapand defined string */
       strcpy(rf, r);
@@ -285,7 +303,7 @@ main(argc, argv)
       return(refspos[numrefs]);
       }
    else {
       return(refspos[numrefs]);
       }
    else {
-      bibwarning("no reference matching %s\n", huntstr);
+      bibwarning("no reference matching %s\n", realhstr);
       return( (long) -1 );
       }
 }
       return( (long) -1 );
       }
 }