patch by Strake. previously is was not feasible to duplicate this
functionality of the functions these were modeled on, since argv[0]
was not saved at program startup, but now that it's available it's
easy to use.
#include <stdarg.h>
#include <stdlib.h>
+extern char *__progname;
+
void vwarn(const char *fmt, va_list ap)
{
+ fprintf (stderr, "%s: ", __progname);
if (fmt) vfprintf(stderr, fmt, ap);
perror("");
}
void vwarnx(const char *fmt, va_list ap)
{
+ fprintf (stderr, "%s: ", __progname);
if (fmt) vfprintf(stderr, fmt, ap);
putc('\n', stderr);
}