void vwarnx(const char *fmt, va_list ap) { if (err_file == 0) err_set_file(NULL); fprintf(err_file, "%s: ", _getprogname()); if (fmt != NULL) vfprintf(err_file, fmt, ap); fprintf(err_file, "\n"); }
void vwarnx (const char *fmt, va_list ap) { if(err_file == 0) err_set_file((FILE*)0); fprintf(err_file, "%s: ", calc_prog_name()); if(fmt != NULL) vfprintf(err_file, fmt, ap); fprintf(err_file, "\n"); }
void vwarnc(int code, const char *fmt, va_list ap) { if (err_file == 0) err_set_file(NULL); fprintf(err_file, "%s: ", _getprogname()); if (fmt != NULL) { vfprintf(err_file, fmt, ap); fprintf(err_file, ": "); } fprintf(err_file, "%s\n", strerror(code)); }
void verrx (int eval, const char *fmt, va_list ap) { if (err_file == 0) err_set_file((FILE *)0); fprintf(err_file, "%s: ", calc_prog_name()); if (fmt != NULL) vfprintf(err_file, fmt, ap); fprintf(err_file, "\n"); exit(eval); }
void verrx(int eval, const char *fmt, va_list ap) { if (err_file == 0) err_set_file(NULL); fprintf(err_file, "%s: ", _getprogname()); if (fmt != NULL) vfprintf(err_file, fmt, ap); fprintf(err_file, "\n"); if (err_exit) err_exit(eval); exit(eval); }
void verrc(int eval, int code, const char *fmt, va_list ap) { if (err_file == NULL) err_set_file(NULL); fprintf(err_file, "%s: ", _getprogname()); if (fmt != NULL) { vfprintf(err_file, fmt, ap); fprintf(err_file, ": "); } fprintf(err_file, "%s\n", strerror(code)); if (err_exit) err_exit(eval); exit(eval); }
void verrc (int eval, int code, const char *fmt, va_list ap) { if (err_file == 0) err_set_file((FILE *)0); fprintf(err_file, "%s: ", calc_prog_name()); if (fmt != NULL) { vfprintf(err_file, fmt, ap); fprintf(err_file, ": "); } fprintf(err_file, "%s\n", strerror(code)); exit(eval); }
int main(int argc, char **argv) { int i; if (argc != 2) { printf("usage!\n"); exit(1); } printf("testing err_set_file\n"); err_set_file(stdout); printf("testing err_set_exit\n"); err_set_exit(custom_exit); errno = ENOMEM; printf("testing warn and vwarn\n"); warn("\ttest of %s", "warn"); printf("testing warnx and vwarnx\n"); warnx("\ttest of warnx"); i = atoi(argv[1]); switch (i) { case 0: printf("testing err and verr\n"); err(1, "\ttest of %s", "err"); break; case 1: printf("testing errx and verrx\n"); errx(2, "\ttest of %s", "verrx"); /* bogus */ break; default: printf("unknown case: %d\n", i); exit(1); } return 0; }