Example #1
0
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");
}
Example #2
0
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");
}
Example #3
0
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));
}
Example #4
0
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);
}
Example #5
0
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);
}
Example #6
0
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);
}
Example #7
0
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);
}
Example #8
0
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;
}