8 const char *program_name
;
10 /* report(): Write 'mesg' with specified 'prefix' to stderr */
11 static void report(const char *prefix
, const char *msg
, va_list params
)
13 fputs(prefix
, stderr
);
14 vfprintf(stderr
, msg
, params
);
18 void error(int line_nr
, const char *err
, ...)
22 fprintf(stderr
, "%s:%d: error: ", program_name
, line_nr
);
24 va_start(params
, err
);
25 vfprintf(stderr
, err
, params
);
31 void fatal(const char *err
, ...)
35 va_start(params
, err
);
36 report("fatal: ", err
, params
);
42 void error_setup(const char *name
)
46 p
= strrchr(name
, '/');
47 program_name
= (p
== NULL
? name
: ++p
);