#ifndef lint
-static char *sccsid = "@(#)refer5.c 4.2 (Berkeley) 7/18/83";
+static char *sccsid = "@(#)refer5.c 4.7 (Berkeley) 4/23/86";
#endif
#include "refer..c"
#define SAME 0
-#define NFLAB 2000
-#define NLABC 100
+#define NFLAB 3000 /* number of bytes to record all labels */
+#define NLABC 1000 /* max number of labels */
-static char sig[NLABC];
+static char sig[MXSIG];
static char bflab[NFLAB];
static char *labtab[NLABC];
static char *lbp = bflab;
static char stbuff[50];
static int prevsig;
-putsig (nf, flds, nref, nstline, endline) /* choose signal style */
+putsig (nf, flds, nref, nstline, endline, toindex) /* choose signal style */
char *flds[], *nstline, *endline;
{
- char t[100], t1[100], t2[100], format[10], *sd, *stline;
+ char t[100], t1[MXSIG], t2[100], format[10], *sd, *stline;
int addon, another = 0;
static FILE *fhide = 0;
int i;
}
}
else {
- if (sort)
- sprintf(t, "%c%d%c", FLAG, nref, FLAG);
- else
- sprintf(t, "%d", 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",
Ifile, Iline, sd);
+ if ((strlen(sig) + strlen(t)) > MXSIG)
+ err("sig overflow (%d)", MXSIG);
strcat(sig, t);
#if EBUG
fprintf(stderr, "sig is now %s leng %d\n",sig,strlen(sig));
if (bare == 0) {
if (!another) {
sprintf(t1, "%s%s\%s\n", stline, sig, endline);
+ if (strlen(t1) > MXSIG)
+ err("t1 overflow (%d)", MXSIG);
append(t1);
flout();
sig[0] = 0;
}
}
else {
- strcat(sig, ",\\|");
+ if (labels) {
+ strcat(sig, ",\\|");
+ } else {
+ /*
+ * Seperate reference numbers with AFLAG
+ * for later sorting and condensing.
+ */
+ t1[0] = AFLAG;
+ t1[1] = '\0';
+ strcat(sig, t1);
+ }
if (fo == ftemp) { /* hide if need be */
sprintf(hidenam, "/tmp/rj%dc", getpid());
#if EBUG
fhide = fopen(hidenam, "w");
if (fhide == NULL)
err("Can't get scratch file %s",
- (void) hidenam);
+ hidenam);
fo = fhide;
}
}
}
if (bare < 2)
- if (nf > 0)
+ if (nf > 0 && toindex)
fprintf(fo,".ds [F %s%c",t,sep);
if (bare > 0)
flout();
char *t;
{
int i;
- int x = -1;
+ int x = 'a' - 1;
for(i = 1; i < nref; i++) {
if (strcmp(labtab[i], t) == 0)
if (nref > NLABC)
err("nref in labc overflow (%d)", NLABC);
#if EBUG
- fprintf(stderr, "lbp up to %d of 2000\n", lbp-bflab);
+ fprintf(stderr, "lbp up to %d of %d\n", lbp-bflab, NFLAB);
#endif
return(labc[nref] = x+1);
}