diff --git a/src/intern_blks/ya_intern.c b/src/intern_blks/ya_intern.c index 67c3648..8c73241 100644 --- a/src/intern_blks/ya_intern.c +++ b/src/intern_blks/ya_intern.c @@ -50,7 +50,7 @@ struct reserved_blk ya_reserved_blks[YA_INTERNAL_LEN] = { #include -/* generic function to print error messages from blocks */ +/* generic function to print error messages from blocks and exit */ void ya_block_error(ya_block_t *blk, char *error_msg, ...) { va_list args; if(blk == NULL) @@ -71,6 +71,23 @@ void ya_block_error(ya_block_t *blk, char *error_msg, ...) { pthread_exit(NULL); } +/* generic function to print warning messages from blocks (non-fatal) */ +void ya_block_warning(ya_block_t *blk, char *error_msg, ...) { + va_list args; + if(blk == NULL) + return; + + fprintf(stderr, "W: %s.%s: ", blk->bar->name, blk->name); + va_start(args, error_msg); + fprintf(stderr, error_msg, args); + va_end(args); + fprintf(stderr, "\n"); + + fflush(stderr); +} + + + FILE* ya_fopen(char* fpath, ya_block_t *blk) { FILE* tfile = fopen(fpath, "r"); if (tfile == NULL)