* This module is believed to contain source code proprietary to AT&T.
* Use and redistribution is subject to the Berkeley Software License
* Agreement and your Software Agreement with AT&T (Western Electric).
static char sccsid
[] = "@(#)refer5.c 4.11 (Berkeley) 4/18/91";
#define NFLAB 3000 /* number of bytes to record all labels */
#define NLABC 1000 /* max number of labels */
static char bflab
[NFLAB
];
static char *labtab
[NLABC
];
static char *lbp
= bflab
;
putsig (nf
, flds
, nref
, nstline
, endline
, toindex
) /* choose signal style */
char *flds
[], *nstline
, *endline
;
char t
[100], t1
[MXSIG
], t2
[100], format
[10], *sd
, *stline
;
sprintf(t
, "%s%c", labtab
[nref
], labc
[nref
]);
sprintf(t
, "%s", fpar(nf
,flds
,t1
,keywant
,1,0));
if (science
&& t
[0] == 0) {
sd
= fpar(nf
, flds
, t2
, 'D', 1, 0);
sprintf(t
, "%s, %s", fpar(nf
,flds
,t1
,'A',1,0),
nmlen
>0 ? "%%.%ds%%s" : "%%s%%s",
/* format is %s%s for default labels */
/* or %.3s%s eg if wanted */
sd
= fpar(nf
, flds
, t2
, 'D', 1, 0);
for (sdb
= sd
; *sd
; sd
++)
sprintf(t
, format
, fpar(nf
,flds
,t1
,'A',1,0),
if ((!keywant
|| addon
) && !science
) {
addch(t
, keylet(t
, nref
));
sprintf(t
, "%c%d%c", FLAG
, nref
, FLAG
);
another
= prefix (".[", sd
=lookat());
if (another
&& (strcmp(".[\n", sd
) != SAME
))
fprintf(stderr
, "File %s line %d: punctuation ignored from: %s",
if ((strlen(sig
) + strlen(t
)) > MXSIG
)
err("sig overflow (%d)", MXSIG
);
fprintf(stderr
, "sig is now %s leng %d\n",sig
,strlen(sig
));
strcpy (stline
, nstline
);
if (stline
[2] || endline
[2]) {
sprintf(t1
, "%s%s%s\n", stline
, sig
, endline
);
err("t1 overflow (%d)", MXSIG
);
fhide
= fopen(hidenam
, "r");
while ((ch
= getc(fhide
)) != EOF
)
* Seperate reference numbers with AFLAG
* for later sorting and condensing.
if (fo
== ftemp
) { /* hide if need be */
sprintf(hidenam
, "%s/rj%dc", _PATH_TMP
, getpid());
fprintf(stderr
, "hiding in %s\n", hidenam
);
fhide
= fopen(hidenam
, "w");
err("Can't get scratch file %s",
fprintf(fo
,".ds [F %s%c",t
,sep
);
fprintf(stderr
, "sig is now %s\n",sig
);
fpar (nf
, flds
, out
, c
, seq
, prepend
)
/* following if statement modified to cope with Q authors */
if ((flds
[i
][1] == c
|| (c
== 'A' && flds
[i
][1] == 'Q'))
/* for titles use first word otherwise last */
if (c
== 'T' || c
== 'J' || c
== 'Q') {
/* if its not 'L' then use just the last word */
while (p
> s
&& *p
!= ' ')
/* special wart for authors */
if (c
== 'A' && (p
[-1] == ',' || p
[1] =='(')) {
while (p
> s
&& *p
!= ' ')
initadd(out
, flds
[i
]+2, p
);
putkey(nf
, flds
, nref
, keystr
)
fprintf(fo
, "%s%c%c", labtab
[nref
], labc
[nref
], sep
);
while (ctype
= *keystr
++) {
for(i
= 1; i
<= count
; i
++) {
sf
= fpar(nf
, flds
, t1
, ctype
, i
, 1);
fprintf(fo
, "%s%c", sf
, '-');
fprintf(fo
, "%c%d%c%c", FLAG
, nref
, FLAG
, sep
);
strcpy(labtab
[nref
]=lbp
, t
);
for(i
= 1; i
< nref
; i
++) {
if (strcmp(labtab
[i
], t
) == 0)
err("bflab overflow (%d)", NFLAB
);
err("nref in labc overflow (%d)", NLABC
);
fprintf(stderr
, "lbp up to %d of %d\n", lbp
-bflab
, NFLAB
);
return(labc
[nref
] = x
+1);
while (*t
&& *t
!= ',' && *t
!= ' ')
while (n
-- && (c
= *t
++) > 0) {
static char *articles
[] = {
artskp(s
) /* skips over initial "a ", "an ", "the " in s */
for (p
= articles
; *p
; p
++) {
for (r1
= *p
; ((*r1
^ *r2
) & ~040 ) == 0; r1
++)
if (*r1
== 0 && *r2
!= 0)