extern int htoi PROTO ((Char[]));
/* Report an error message formatted with one integer argument. */
-extern void lerrif PROTO ((const char *, int));
+extern void lerrif PROTO ((const char *, ...));
/* Report an error message formatted with one string argument. */
-extern void lerrsf PROTO ((const char *, const char *));
+extern void lerrsf PROTO ((const char *, ...));
/* Like lerrsf, but also exit after displaying message. */
-extern void lerrsf_fatal PROTO ((const char *, const char *));
+extern void lerrsf_fatal PROTO ((const char *, ...));
/* Spit out a "#line" statement. */
extern void line_directive_out PROTO ((FILE *, int));
/* lerrif - report an error message formatted with one integer argument */
-void lerrif (msg, arg)
- const char *msg;
- int arg;
-{
+void lerrif (const char *msg, ...) {
char errmsg[MAXLINE];
+ va_list args;
- snprintf (errmsg, sizeof(errmsg), msg, arg);
+ va_start(args, msg);
+ vsnprintf (errmsg, sizeof(errmsg), msg, args);
+ va_end(args);
flexerror (errmsg);
}
/* lerrsf - report an error message formatted with one string argument */
-void lerrsf (msg, arg)
- const char *msg, arg[];
+void lerrsf (const char *msg, ...)
{
char errmsg[MAXLINE];
+ va_list args;
- snprintf (errmsg, sizeof(errmsg)-1, msg, arg);
+ va_start(args, msg);
+ vsnprintf (errmsg, sizeof(errmsg)-1, msg, args);
+ va_end(args);
errmsg[sizeof(errmsg)-1] = 0; /* ensure NULL termination */
flexerror (errmsg);
}
/* lerrsf_fatal - as lerrsf, but call flexfatal */
-void lerrsf_fatal (msg, arg)
- const char *msg, arg[];
+void lerrsf_fatal (const char *msg, ...)
{
char errmsg[MAXLINE];
+ va_list args;
+ va_start(args, msg);
- snprintf (errmsg, sizeof(errmsg)-1, msg, arg);
+ vsnprintf (errmsg, sizeof(errmsg)-1, msg, args);
+ va_end(args);
errmsg[sizeof(errmsg)-1] = 0; /* ensure NULL termination */
flexfatal (errmsg);
}
assert(_sf_stk == NULL);
_sf_stk = (scanflags_t*) flex_alloc ( sizeof(scanflags_t) * (_sf_max = 32));
if (!_sf_stk)
- lerrsf_fatal(_("Unable to allocate %ld of stack"),
- (long)sizeof(scanflags_t));
+ lerrsf_fatal(_("Unable to allocate %ld of stack"), sizeof(scanflags_t));
_sf_stk[_sf_top_ix] = 0;
}