# include "refer..c" # define SAME 0 # define NFLAB 2000 # define NLABC 100 static char sig[NLABC]; static char bflab[NFLAB]; static char *labtab[NLABC]; static char *lbp bflab; static char labc[NLABC]; static char stbuff[50]; static int prevsig; putsig (nf, flds, nref, nstline, endline) char *flds[], *nstline, *endline; { /* choose signal style */ char t[100], t1[100], t2[100], format[10], *sd; int another 0; int addon; char *stline; static FILE *fhide 0; if (labels) { if (nf==0) /* old */ sprintf(t, "%s%c", labtab[nref], labc[nref]); else { *t=0; if (keywant) sprintf(t, "%s", fpar(nf, flds, t1, keywant, 1, 0)); if (t[0]==0) { sprintf(format, nmlen>0 ? "%%.%ds%%s" : "%%s%%s", nmlen); /* format is %s%s for default labels or %.3s%s eg if wanted */ sd = fpar(nf, flds, t2, 'D', 1, 0); if (dtlen>0) { char *sdb; for(sdb=sd; *sd; sd++); sd = sd-dtlen; if (sd0) fprintf(fo,".ds [F %s%c",t,sep); if (bare>0) flout(); # if D1 fprintf(stderr, "sig is now %s\n",sig); # endif } fpar (nf, flds, out, c, seq, prepend) char *flds[], *out; { char *p, *s; int i, fnd 0; for(i=0; i= seq) { if (c=='T' || c == 'J') /* for titles use first word otherwise last */ { p=flds[i]+3; if (prefix("A ", p)) p +=2; if (prefix("An ", p)) p +=3; if (prefix("The ", p)) p+= 4; mycpy2(out, p, 20); return(out); } for(s=p= flds[i]+2; *p; p++); while (p>s && *p != ' ') p--; /* special wart for authors */ if (c=='A' && (p[-1] == ',' || p[1] =='(')) { p--; while (p>s && *p != ' ') p--; mycpy (out, p+1); } else strcpy (out, p+1); if (c=='A' && prepend) initadd(out, flds[i]+2, p); return(out); } return(0); } putkey(nf, flds, nref, keystr) char *flds[], *keystr; { char t1[50], *sf; int ctype, i, count; fprintf(fo, ".\\\""); if (nf <= 0) fprintf(fo, "%s%c%c", labtab[nref], labc[nref], sep); else { while (ctype= *keystr++) { count = atoi(keystr); if (*keystr=='+') count=999; if (count<=0) count=1; for(i=1; i<=count; i++) { sf= fpar(nf, flds, t1, ctype, i, 1); if (sf==0) break; sf = artskp(sf); fprintf(fo, "%s%c", sf, '-'); } } fprintf(fo, "%c%d%c%c", FLAG, nref, FLAG, sep); } } keylet(t, nref) char *t; { int i; int x 'a'-1; for(i=1; iNFLAB) err("bflab overflow (%d)", NFLAB); if (nref >NLABC) err ("nref in labc overflow (%d)", NLABC); # ifdef D1 fprintf(stderr, "lbp up to %d of 2000\n", lbp-bflab); # endif return (labc[nref] = x+1); } mycpy(s,t) char *s, *t; { while (*t && *t != ',' && *t != ' ') *s++ = *t++; *s=0; } mycpy2 (s, t, n) char *s, *t; { int c; while (n-- && (c= *t++)>0) { if (c==' ')c= '-'; *s++ = c; } *s=0; } initadd(to, from, stop) char *to, *from, *stop; { int c, nalph 1; while (*to) to++; while (from