+int error(const char * text, ...)
+{
+ char buf[EBUFSIZ];
+ char buf1[EBUFSIZ];
+
+ err_setup();
+
+ va_list arg;
+ va_start(arg, text);
+ vsprintf(buf, text, arg);
+ va_end(arg);
+
+ if (listing > 0)
+ ship_ln(buf);
+
+ if (cur_inobj)
+ {
+ switch (cur_inobj->in_type)
+ {
+ case SRC_IFILE:
+ sprintf(buf1, "%s %d: Error: %s\n", curfname, curlineno, buf);
+ break;
+ case SRC_IMACRO:
+ sprintf(buf1, "%s %d: Error: %s\n", curfname, cur_inobj->inobj.imacro->im_macro->lineList->lineno, buf);
+ break;
+ case SRC_IREPT:
+ sprintf(buf1, "%s %d: Error: %s\n", curfname, cur_inobj->inobj.irept->lineno, buf);
+ break;
+ }
+ }
+ else
+ // No current file so cur_inobj is NULL
+ sprintf(buf1, "%s %d: Error: %s\n", curfname, curlineno, buf);
+
+ if (err_flag)
+ unused = write(err_fd, buf1, (LONG)strlen(buf1));
+ else
+ printf("%s", buf1);
+
+ taglist('E');
+ errcnt++;
+
+ return ERROR;
+}