| * Private support code. | * Private support code. | ||||
| */ | */ | ||||
| static void log(const char *msg, ...) | |||||
| { | |||||
| va_list params; | |||||
| va_start(params, msg); | |||||
| vfprintf(stderr, msg, params); | |||||
| fputc('\n', stderr); | |||||
| va_end(params); | |||||
| } | |||||
| static void err(const char *errmsg, ...) | static void err(const char *errmsg, ...) | ||||
| { | { | ||||
| va_list params; | va_list params; | ||||
| va_start(params, errmsg); | va_start(params, errmsg); | ||||
| vsnprintf(mbr_errorbuf, sizeof(mbr_errorbuf), errmsg, params); | vsnprintf(mbr_errorbuf, sizeof(mbr_errorbuf), errmsg, params); | ||||
| va_end(params); | va_end(params); | ||||
| log("mbrowrap error: %s", mbr_errorbuf); | |||||
| fprintf(stderr, "mbrowrap error: %s\n", mbr_errorbuf); | |||||
| } | } | ||||
| static int create_pipes(int p1[2], int p2[2], int p3[2]) | static int create_pipes(int p1[2], int p2[2], int p3[2]) | ||||
| msg = "mbrola died and wait status is weird"; | msg = "mbrola died and wait status is weird"; | ||||
| } | } | ||||
| log("mbrowrap error: %s", msg); | |||||
| fprintf(stderr, "mbrowrap error: %s\n", msg); | |||||
| len = strlen(mbr_errorbuf); | len = strlen(mbr_errorbuf); | ||||
| if (!len) | if (!len) | ||||
| strncmp(buf_ptr, "Input Flush Signal", 18) == 0) | strncmp(buf_ptr, "Input Flush Signal", 18) == 0) | ||||
| continue; | continue; | ||||
| *lf = 0; | *lf = 0; | ||||
| log("mbrola: %s", buf_ptr); | |||||
| fprintf(stderr, "mbrola: %s\n", buf_ptr); | |||||
| // is this the last line? | // is this the last line? | ||||
| if (lf == &buf_ptr[result - 1]) { | if (lf == &buf_ptr[result - 1]) { | ||||
| snprintf(mbr_errorbuf, sizeof(mbr_errorbuf), | snprintf(mbr_errorbuf, sizeof(mbr_errorbuf), |