Added macro PRINTF_ERROR_RETURN which working with progressbar

This commit is contained in:
Pali Rohár committed 2012-09-23 17:09:27 +02:00
1 parent e4f7cf7bc5
commit e66d87fde0
3 files changed
+8 -5

No files matched your search

+3
View File
@@ -20,6 +20,8 @@
#ifndef PRINTF_UTILS_H
#define PRINTF_UTILS_H
#include "global.h"
extern int printf_prev;
#define PRINTF_BACK() do { if ( printf_prev ) { printf("\r%-*s\r", printf_prev, ""); printf_prev = 0; } } while (0)
@@ -27,6 +29,7 @@ extern int printf_prev;
#define PRINTF_LINE(...) do { PRINTF_BACK(); PRINTF_ADD(__VA_ARGS__); fflush(stdout); } while (0)
#define PRINTF_END() do { if ( printf_prev ) { printf("\n"); printf_prev = 0; } } while (0)
#define PRINTF_ERROR(...) do { PRINTF_END(); ERROR_INFO(__VA_ARGS__); } while (0)
#define PRINTF_ERROR_RETURN(str, ...) do { PRINTF_ERROR("%s", str); return __VA_ARGS__; } while (0)
void printf_progressbar(unsigned long long part, unsigned long long total);
void printf_and_wait(const char * format, ...);