11
/*---------------------------------------------------------------------------
16
/*---------------------------------------------------------------------------
17
* Prints a message in printf-style if the verbosity flag is set.
18
* A newline is added automatically.
20
void notify(const char * message, ...)
26
fputs("ptyshell: ", stderr);
28
va_start(args, message);
29
vfprintf(stderr, message, args);
36
/*---------------------------------------------------------------------------
37
* Prints an error message with printf-style formatting (a newline is
38
* added automatically).
40
void error(const char * message, ...)
43
const char * errno_desc = NULL;
45
/* If errno is set, get its string description. */
47
errno_desc = strerror(errno);
50
fputs("ptyshell: ", stderr);
52
va_start(args, message);
53
vfprintf(stderr, message, args);
56
/* If errno was set, append the error description. */
59
fputs(errno_desc, stderr);
68
* Reports a failed assertion and terminates the program.
69
* This call never returns.
71
void failed_assertion(const char * cond)
73
fprintf(stderr, "ptyshell: assertion failed: %s\n", cond);
78
* Introduces an assertion. If the condition 'x' is not valid
79
* at the run-time, the program is immediately terminated.
81
#define assert(x) if (!(x)) { failed_assertion(#x); }