recording errors; error program can now pick up this format
SCCS-vsn: contrib/bib/src/bib.c 1.3
SCCS-vsn: contrib/bib/src/bibargs.c 1.3
extern int foot, sort, personal;
extern int hyphen, ordcite;
extern char sortstr[], pfile[], citetemplate[];
extern int foot, sort, personal;
extern int hyphen, ordcite;
extern char sortstr[], pfile[], citetemplate[];
+ char *bibfname; /* file name currently reading */
+ char *biblineno; /* line number in that file */
arguments are read by doargs (bibargs.c)
*/
arguments are read by doargs (bibargs.c)
*/
- if (doargs(argc, argv, DEFSTYLE ) == 0)
+ if (doargs(argc, argv, DEFSTYLE ) == 0){
+ bibfname = "<stdin>";
/*
sort references, make citations, add disambiguating characters
/*
sort references, make citations, add disambiguating characters
FILE *fd;
{ char lastc, c, d;
FILE *fd;
{ char lastc, c, d;
lastc = 0;
while (getch(c, fd) != EOF)
if (c == '[' || c == '{')
lastc = 0;
while (getch(c, fd) != EOF)
if (c == '[' || c == '{')
else {
if (lastc) putc(lastc, tfd);
lastc = c;
else {
if (lastc) putc(lastc, tfd);
lastc = c;
+ if (c == '\n')
+ biblineno++;
}
if (lastc) putc(lastc, tfd);
}
}
if (lastc) putc(lastc, tfd);
}
return(refspos[numrefs]);
}
else {
return(refspos[numrefs]);
}
else {
- fprintf(stderr,"no reference matching %s\n", huntstr);
+ bibwarning("no reference matching %s\n", huntstr);
if (*p == '\n')
if (*(p+1) == '\n') { /* end */
if (*(p+2) != 0)
if (*p == '\n')
if (*(p+1) == '\n') { /* end */
if (*(p+2) != 0)
- fprintf(stderr,"multiple references match %s\n",huntstr);
+ bibwarning("multiple references match %s\n", huntstr);
putc(c, ofd);
}
if (dumped == false)
putc(c, ofd);
}
if (dumped == false)
- fprintf(stderr,"Warning: references never dumped\n");
+ bibwarning("Warning: references never dumped\n", (char *)0);
}
fprintf(ofd,".][\n");
}
}
fprintf(ofd,".][\n");
}
+/*
+ * print out a warning message
+ */
+bibwarning(msg, arg)
+ char *msg;
+ char *arg;
+{
+ fprintf(stderr, "`%s', line %d: ", bibfname, biblineno);
+ fprintf(stderr, msg, arg);
+}
char *words[MAXDEFS]; /* defined words */
char *defs[MAXDEFS]; /* defined word definitions */
int wordtop = -1; /* top of defined words array */
char *words[MAXDEFS]; /* defined words */
char *defs[MAXDEFS]; /* defined word definitions */
int wordtop = -1; /* top of defined words array */
+ char *bibfname;
+ char *biblineno;
/* where output goes */
extern FILE *tfd;
/* where output goes */
extern FILE *tfd;
style = false;
incfile( defstyle );
}
style = false;
incfile( defstyle );
}
rdtext(stdin);
numfiles++;
break;
rdtext(stdin);
numfiles++;
break;
error(": can't open");
}
else {
error(": can't open");
}
else {
rdtext(fd);
fclose(fd);
}
rdtext(fd);
fclose(fd);
}