src: more clang-format
This commit is contained in:
+7
-6
@@ -76,14 +76,15 @@ ifeq ($(shell uname),Linux)
|
|||||||
CLANG_FORMAT_FILES += bele.h bele_policy.h
|
CLANG_FORMAT_FILES += bele.h bele_policy.h
|
||||||
CLANG_FORMAT_FILES += c_file.cpp c_init.cpp c_none.cpp c_screen.cpp
|
CLANG_FORMAT_FILES += c_file.cpp c_init.cpp c_none.cpp c_screen.cpp
|
||||||
CLANG_FORMAT_FILES += compress_lzma.cpp compress_ucl.cpp compress_zlib.cpp
|
CLANG_FORMAT_FILES += compress_lzma.cpp compress_ucl.cpp compress_zlib.cpp
|
||||||
CLANG_FORMAT_FILES += except.cpp except.h
|
CLANG_FORMAT_FILES += console.h except.cpp except.h
|
||||||
CLANG_FORMAT_FILES += file.cpp file.h lefile.cpp lefile.h
|
CLANG_FORMAT_FILES += file.cpp file.h lefile.cpp lefile.h
|
||||||
CLANG_FORMAT_FILES += linker.cpp linker.h packhead.cpp packmast.cpp packmast.h
|
CLANG_FORMAT_FILES += linker.cpp linker.h main.cpp msg.cpp options.cpp options.h
|
||||||
CLANG_FORMAT_FILES += main.cpp options.cpp options.h packer.cpp packer.h
|
CLANG_FORMAT_FILES += p_armpe.cpp p_armpe.h p_com.cpp p_com.h p_djgpp2.cpp p_djgpp2.h
|
||||||
CLANG_FORMAT_FILES += p_armpe.cpp p_armpe.h
|
CLANG_FORMAT_FILES += p_exe.cpp p_exe.h p_ps1.cpp p_ps1.h p_sys.cpp p_sys.h
|
||||||
CLANG_FORMAT_FILES += p_com.cpp p_com.h p_djgpp2.cpp p_djgpp2.h p_exe.cpp p_exe.h p_ps1.cpp p_ps1.h
|
CLANG_FORMAT_FILES += p_tmt.cpp p_tmt.h p_tos.cpp p_tos.h
|
||||||
CLANG_FORMAT_FILES += p_sys.cpp p_sys.h p_tmt.cpp p_tmt.h p_tos.cpp p_tos.h p_wcle.cpp p_wcle.h
|
|
||||||
CLANG_FORMAT_FILES += p_w32pe.h p_w64pep.h
|
CLANG_FORMAT_FILES += p_w32pe.h p_w64pep.h
|
||||||
|
CLANG_FORMAT_FILES += p_wcle.cpp p_wcle.h
|
||||||
|
CLANG_FORMAT_FILES += packer.cpp packer.h packhead.cpp packmast.cpp packmast.h
|
||||||
CLANG_FORMAT_FILES += s_djgpp2.cpp s_object.cpp s_vcsa.cpp s_win32.cpp screen.h
|
CLANG_FORMAT_FILES += s_djgpp2.cpp s_object.cpp s_vcsa.cpp s_win32.cpp screen.h
|
||||||
CLANG_FORMAT_FILES += ui.cpp ui.h work.cpp
|
CLANG_FORMAT_FILES += ui.cpp ui.h work.cpp
|
||||||
CLANG_FORMAT_FILES += $(wildcard util/[a-ln-z]*.[ch]* util/mem*.[ch]*)
|
CLANG_FORMAT_FILES += $(wildcard util/[a-ln-z]*.[ch]* util/mem*.[ch]*)
|
||||||
|
|||||||
+56
-76
@@ -25,8 +25,6 @@
|
|||||||
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
//
|
//
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
@@ -40,120 +38,103 @@
|
|||||||
#undef USE_FRAMES
|
#undef USE_FRAMES
|
||||||
|
|
||||||
#if 1 && (WITH_GUI) && !defined(NO_CONSOLE)
|
#if 1 && (WITH_GUI) && !defined(NO_CONSOLE)
|
||||||
# define NO_CONSOLE 1
|
#define NO_CONSOLE 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 1 && defined(__linux__)
|
#if 1 && defined(__linux__)
|
||||||
# define USE_SCREEN 1
|
#define USE_SCREEN 1
|
||||||
# define USE_SCREEN_VCSA 1
|
#define USE_SCREEN_VCSA 1
|
||||||
# if !(HAVE_LINUX_KD_H)
|
#if !(HAVE_LINUX_KD_H)
|
||||||
# undef USE_SCREEN
|
#undef USE_SCREEN
|
||||||
# undef USE_SCREEN_VCSA
|
#undef USE_SCREEN_VCSA
|
||||||
# endif
|
#endif
|
||||||
# if !(HAVE_LINUX_KDEV_T_H) || !(HAVE_LINUX_MAJOR_H)
|
#if !(HAVE_LINUX_KDEV_T_H) || !(HAVE_LINUX_MAJOR_H)
|
||||||
# undef USE_SCREEN
|
#undef USE_SCREEN
|
||||||
# undef USE_SCREEN_VCSA
|
#undef USE_SCREEN_VCSA
|
||||||
# endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 1 && (ACC_OS_DOS32) && defined(__DJGPP__)
|
#if 1 && (ACC_OS_DOS32) && defined(__DJGPP__)
|
||||||
# define USE_SCREEN 1
|
#define USE_SCREEN 1
|
||||||
#elif 1 && (ACC_OS_CYGWIN || ACC_OS_WIN32 || ACC_OS_WIN64)
|
#elif 1 && (ACC_OS_CYGWIN || ACC_OS_WIN32 || ACC_OS_WIN64)
|
||||||
# define USE_SCREEN 1
|
#define USE_SCREEN 1
|
||||||
# define USE_SCREEN_WIN32 1
|
#define USE_SCREEN_WIN32 1
|
||||||
#elif 1 && (ACC_OS_EMX && defined(__RSXNT__))
|
#elif 1 && (ACC_OS_EMX && defined(__RSXNT__))
|
||||||
# define USE_SCREEN 1
|
#define USE_SCREEN 1
|
||||||
# define USE_SCREEN_WIN32 1
|
#define USE_SCREEN_WIN32 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if 0 || (NO_ANSI)
|
#if 0 || (NO_ANSI)
|
||||||
# undef USE_ANSI
|
#undef USE_ANSI
|
||||||
#endif
|
#endif
|
||||||
#if 0 || (NO_SCREEN)
|
#if 0 || (NO_SCREEN)
|
||||||
# undef USE_SCREEN
|
#undef USE_SCREEN
|
||||||
#endif
|
#endif
|
||||||
#if 0 || (NO_FRAMES) || !(USE_SCREEN)
|
#if 0 || (NO_FRAMES) || !(USE_SCREEN)
|
||||||
# undef USE_FRAMES
|
#undef USE_FRAMES
|
||||||
#endif
|
#endif
|
||||||
#if 1
|
#if 1
|
||||||
# undef USE_FRAMES
|
#undef USE_FRAMES
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if 0 || (USE_ANSI) || (USE_SCREEN)
|
#if 0 || (USE_ANSI) || (USE_SCREEN)
|
||||||
# define USE_CONSOLE 1
|
#define USE_CONSOLE 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0 || (NO_CONSOLE) || !(USE_CONSOLE)
|
#if 0 || (NO_CONSOLE) || !(USE_CONSOLE)
|
||||||
# undef USE_CONSOLE
|
#undef USE_CONSOLE
|
||||||
# undef USE_ANSI
|
#undef USE_ANSI
|
||||||
# undef USE_SCREEN
|
#undef USE_SCREEN
|
||||||
# undef USE_SCREEN_VCSA
|
#undef USE_SCREEN_VCSA
|
||||||
# undef USE_SCREEN_CURSES
|
#undef USE_SCREEN_CURSES
|
||||||
# undef USE_FRAMES
|
#undef USE_FRAMES
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
//
|
//
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
enum {
|
enum { CON_INIT, CON_NONE, CON_FILE, CON_ANSI_MONO, CON_ANSI_COLOR, CON_SCREEN, CON_UNUSED };
|
||||||
CON_INIT,
|
|
||||||
CON_NONE,
|
|
||||||
CON_FILE,
|
|
||||||
CON_ANSI_MONO,
|
|
||||||
CON_ANSI_COLOR,
|
|
||||||
CON_SCREEN,
|
|
||||||
CON_UNUSED
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#if (USE_CONSOLE)
|
#if (USE_CONSOLE)
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
int (*init)(FILE *f, int, int);
|
int (*init)(FILE *f, int, int);
|
||||||
int (*set_fg)(FILE *f, int fg);
|
int (*set_fg)(FILE *f, int fg);
|
||||||
void (*print0)(FILE *f, const char *s);
|
void (*print0)(FILE *f, const char *s);
|
||||||
bool (*intro)(FILE *f);
|
bool (*intro)(FILE *f);
|
||||||
}
|
} console_t;
|
||||||
console_t;
|
|
||||||
|
|
||||||
|
|
||||||
void con_fprintf(FILE *f, const char *format, ...) attribute_format(2, 3);
|
void con_fprintf(FILE *f, const char *format, ...) attribute_format(2, 3);
|
||||||
|
|
||||||
|
#define FG_BLACK 0x00
|
||||||
#define FG_BLACK 0x00
|
#define FG_BLUE 0x01
|
||||||
#define FG_BLUE 0x01
|
#define FG_GREEN 0x02
|
||||||
#define FG_GREEN 0x02
|
#define FG_CYAN 0x03
|
||||||
#define FG_CYAN 0x03
|
#define FG_RED 0x04
|
||||||
#define FG_RED 0x04
|
#define FG_VIOLET 0x05
|
||||||
#define FG_VIOLET 0x05
|
#define FG_ORANGE 0x06
|
||||||
#define FG_ORANGE 0x06
|
#define FG_LTGRAY 0x07
|
||||||
#define FG_LTGRAY 0x07
|
#define FG_DKGRAY 0x08
|
||||||
#define FG_DKGRAY 0x08
|
#define FG_BRTBLUE 0x09
|
||||||
#define FG_BRTBLUE 0x09
|
#define FG_BRTGREEN 0x0a
|
||||||
#define FG_BRTGREEN 0x0a
|
#define FG_BRTCYAN 0x0b
|
||||||
#define FG_BRTCYAN 0x0b
|
#define FG_BRTRED 0x0c
|
||||||
#define FG_BRTRED 0x0c
|
|
||||||
#define FG_BRTVIOLET 0x0d
|
#define FG_BRTVIOLET 0x0d
|
||||||
#define FG_YELLOW 0x0e
|
#define FG_YELLOW 0x0e
|
||||||
#define FG_WHITE 0x0f
|
#define FG_WHITE 0x0f
|
||||||
|
|
||||||
#define BG_BLACK 0x00
|
#define BG_BLACK 0x00
|
||||||
#define BG_BLUE 0x10
|
#define BG_BLUE 0x10
|
||||||
#define BG_GREEN 0x20
|
#define BG_GREEN 0x20
|
||||||
#define BG_CYAN 0x30
|
#define BG_CYAN 0x30
|
||||||
#define BG_RED 0x40
|
#define BG_RED 0x40
|
||||||
#define BG_VIOLET 0x50
|
#define BG_VIOLET 0x50
|
||||||
#define BG_ORANGE 0x60
|
#define BG_ORANGE 0x60
|
||||||
#define BG_WHITE 0x70
|
#define BG_WHITE 0x70
|
||||||
|
|
||||||
#endif /* USE_CONSOLE */
|
#endif /* USE_CONSOLE */
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
//
|
//
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
@@ -172,13 +153,12 @@ extern console_t console_ansi_mono;
|
|||||||
extern console_t console_ansi_color;
|
extern console_t console_ansi_color;
|
||||||
extern console_t console_screen;
|
extern console_t console_screen;
|
||||||
|
|
||||||
|
#define con_fg(f, x) con->set_fg(f, x)
|
||||||
#define con_fg(f,x) con->set_fg(f,x)
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#define con_fg(f,x) 0
|
#define con_fg(f, x) 0
|
||||||
#define con_fprintf fprintf
|
#define con_fprintf fprintf
|
||||||
|
|
||||||
#endif /* USE_CONSOLE */
|
#endif /* USE_CONSOLE */
|
||||||
|
|
||||||
|
|||||||
+57
-92
@@ -25,10 +25,8 @@
|
|||||||
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
// FIXME: if stdout is redirected to a file and stderr is not, should
|
// FIXME: if stdout is redirected to a file and stderr is not, should
|
||||||
// we write all error messages to both stderr and stdout ?
|
// we write all error messages to both stderr and stdout ?
|
||||||
@@ -36,25 +34,20 @@
|
|||||||
|
|
||||||
static int pr_need_nl = 0;
|
static int pr_need_nl = 0;
|
||||||
|
|
||||||
|
void printSetNl(int need_nl) { pr_need_nl = need_nl; }
|
||||||
|
|
||||||
void printSetNl(int need_nl)
|
void printClearLine(FILE *f) {
|
||||||
{
|
static char clear_line_msg[1 + 79 + 1 + 1];
|
||||||
pr_need_nl = need_nl;
|
if (!clear_line_msg[0]) {
|
||||||
}
|
|
||||||
|
|
||||||
void printClearLine(FILE *f)
|
|
||||||
{
|
|
||||||
static char clear_line_msg[1+79+1+1];
|
|
||||||
if (!clear_line_msg[0])
|
|
||||||
{
|
|
||||||
char *msg = clear_line_msg;
|
char *msg = clear_line_msg;
|
||||||
msg[0] = '\r';
|
msg[0] = '\r';
|
||||||
memset(msg+1,' ',79);
|
memset(msg + 1, ' ', 79);
|
||||||
msg[80] = '\r';
|
msg[80] = '\r';
|
||||||
msg[81] = 0;
|
msg[81] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
fflush(stdout); fflush(stderr);
|
fflush(stdout);
|
||||||
|
fflush(stderr);
|
||||||
if (f == nullptr)
|
if (f == nullptr)
|
||||||
f = stdout;
|
f = stdout;
|
||||||
con_fprintf(f, "%s", clear_line_msg);
|
con_fprintf(f, "%s", clear_line_msg);
|
||||||
@@ -62,24 +55,21 @@ void printClearLine(FILE *f)
|
|||||||
printSetNl(0);
|
printSetNl(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void pr_print(bool c, const char *msg) {
|
||||||
static void pr_print(bool c, const char *msg)
|
|
||||||
{
|
|
||||||
if (c && !opt->to_stdout)
|
if (c && !opt->to_stdout)
|
||||||
con_fprintf(stderr, "%s", msg);
|
con_fprintf(stderr, "%s", msg);
|
||||||
else
|
else
|
||||||
fprintf(stderr, "%s", msg);
|
fprintf(stderr, "%s", msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pr_error(const char *iname, const char *msg, bool is_warning)
|
static void pr_error(const char *iname, const char *msg, bool is_warning) {
|
||||||
{
|
fflush(stdout);
|
||||||
fflush(stdout); fflush(stderr);
|
fflush(stderr);
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
buf[0] = 0;
|
buf[0] = 0;
|
||||||
if (pr_need_nl == 2)
|
if (pr_need_nl == 2)
|
||||||
printClearLine(stdout);
|
printClearLine(stdout);
|
||||||
else if (pr_need_nl)
|
else if (pr_need_nl) {
|
||||||
{
|
|
||||||
buf[0] = '\n';
|
buf[0] = '\n';
|
||||||
buf[1] = 0;
|
buf[1] = 0;
|
||||||
printSetNl(0);
|
printSetNl(0);
|
||||||
@@ -90,35 +80,34 @@ static void pr_error(const char *iname, const char *msg, bool is_warning)
|
|||||||
// At least I can use some colors then...
|
// At least I can use some colors then...
|
||||||
bool c = acc_isatty(STDERR_FILENO) ? 1 : 0;
|
bool c = acc_isatty(STDERR_FILENO) ? 1 : 0;
|
||||||
|
|
||||||
int fg = con_fg(stderr,FG_BRTRED);
|
int fg = con_fg(stderr, FG_BRTRED);
|
||||||
snprintf(buf+strlen(buf),sizeof(buf)-strlen(buf),"%s: ", progname);
|
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%s: ", progname);
|
||||||
pr_print(c,buf);
|
pr_print(c, buf);
|
||||||
//(void)con_fg(stderr,FG_RED);
|
//(void)con_fg(stderr,FG_RED);
|
||||||
snprintf(buf,sizeof(buf),"%s: ", iname);
|
snprintf(buf, sizeof(buf), "%s: ", iname);
|
||||||
pr_print(c,buf);
|
pr_print(c, buf);
|
||||||
//(void)con_fg(stderr,FG_BRTRED);
|
//(void)con_fg(stderr,FG_BRTRED);
|
||||||
pr_print(c,msg);
|
pr_print(c, msg);
|
||||||
pr_print(c,"\n");
|
pr_print(c, "\n");
|
||||||
fflush(stdout); fflush(stderr);
|
fflush(stdout);
|
||||||
fg = con_fg(stderr,fg);
|
fflush(stderr);
|
||||||
|
fg = con_fg(stderr, fg);
|
||||||
|
|
||||||
UNUSED(is_warning);
|
UNUSED(is_warning);
|
||||||
UNUSED(fg);
|
UNUSED(fg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void printErr(const char *iname, const Throwable *e) {
|
||||||
void printErr(const char *iname, const Throwable *e)
|
|
||||||
{
|
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
size_t l;
|
size_t l;
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "%s", prettyName(typeid(*e).name()));
|
snprintf(buf, sizeof(buf), "%s", prettyName(typeid(*e).name()));
|
||||||
l = strlen(buf);
|
l = strlen(buf);
|
||||||
if (l < sizeof(buf) && e->getMsg())
|
if (l < sizeof(buf) && e->getMsg())
|
||||||
snprintf(buf+l, sizeof(buf)-l, ": %s", e->getMsg());
|
snprintf(buf + l, sizeof(buf) - l, ": %s", e->getMsg());
|
||||||
l = strlen(buf);
|
l = strlen(buf);
|
||||||
if (l < sizeof(buf) && e->getErrno()) {
|
if (l < sizeof(buf) && e->getErrno()) {
|
||||||
snprintf(buf+l, sizeof(buf)-l, ": %s", strerror(e->getErrno()));
|
snprintf(buf + l, sizeof(buf) - l, ": %s", strerror(e->getErrno()));
|
||||||
#if 1
|
#if 1
|
||||||
// some compilers (e.g. Borland C++) put a trailing '\n'
|
// some compilers (e.g. Borland C++) put a trailing '\n'
|
||||||
// into strerror() result
|
// into strerror() result
|
||||||
@@ -127,127 +116,103 @@ void printErr(const char *iname, const Throwable *e)
|
|||||||
buf[l] = 0;
|
buf[l] = 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
pr_error(iname,buf,e->isWarning());
|
pr_error(iname, buf, e->isWarning());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void printErr(const char *iname, const char *format, ...) {
|
||||||
void printErr(const char *iname, const char *format, ...)
|
|
||||||
{
|
|
||||||
va_list args;
|
va_list args;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
|
|
||||||
va_start(args,format);
|
va_start(args, format);
|
||||||
upx_safe_vsnprintf(buf,sizeof(buf),format,args);
|
upx_safe_vsnprintf(buf, sizeof(buf), format, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
pr_error(iname,buf,false);
|
pr_error(iname, buf, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void printWarn(const char *iname, const char *format, ...) {
|
||||||
void printWarn(const char *iname, const char *format, ...)
|
|
||||||
{
|
|
||||||
va_list args;
|
va_list args;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
|
|
||||||
va_start(args,format);
|
va_start(args, format);
|
||||||
upx_safe_vsnprintf(buf,sizeof(buf),format,args);
|
upx_safe_vsnprintf(buf, sizeof(buf), format, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
pr_error(iname,buf,true);
|
pr_error(iname, buf, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void printUnhandledException(const char *iname, const std::exception *e) {
|
||||||
void printUnhandledException(const char *iname, const std::exception *e)
|
|
||||||
{
|
|
||||||
if (e)
|
if (e)
|
||||||
printErr(iname,"unhandled exception: %s\n", prettyName(e->what()));
|
printErr(iname, "unhandled exception: %s\n", prettyName(e->what()));
|
||||||
else
|
else
|
||||||
printErr(iname,"internal error: unhandled exception!\n");
|
printErr(iname, "internal error: unhandled exception!\n");
|
||||||
if (opt->cmd != CMD_COMPRESS)
|
if (opt->cmd != CMD_COMPRESS) {
|
||||||
{
|
printErr(iname, " this file has possibly been modified/hacked; take care!\n");
|
||||||
printErr(iname," this file has possibly been modified/hacked; take care!\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
// FIXME: should use colors and a consistent layout here
|
// FIXME: should use colors and a consistent layout here
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
static int info_header = 0;
|
static int info_header = 0;
|
||||||
|
|
||||||
|
static void info_print(const char *msg) {
|
||||||
static void info_print(const char *msg)
|
|
||||||
{
|
|
||||||
if (opt->info_mode <= 0)
|
if (opt->info_mode <= 0)
|
||||||
return;
|
return;
|
||||||
FILE *f = opt->to_stdout ? stderr : stdout;
|
FILE *f = opt->to_stdout ? stderr : stdout;
|
||||||
if (pr_need_nl)
|
if (pr_need_nl) {
|
||||||
{
|
|
||||||
printClearLine(f);
|
printClearLine(f);
|
||||||
con_fprintf(f,"%s\n",msg);
|
con_fprintf(f, "%s\n", msg);
|
||||||
}
|
} else if (pr_need_nl)
|
||||||
else if (pr_need_nl)
|
con_fprintf(f, "\n%s\n", msg);
|
||||||
con_fprintf(f,"\n%s\n",msg);
|
|
||||||
else
|
else
|
||||||
con_fprintf(f,"%s\n",msg);
|
con_fprintf(f, "%s\n", msg);
|
||||||
fflush(f);
|
fflush(f);
|
||||||
printSetNl(0);
|
printSetNl(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void infoHeader() { info_header = 0; }
|
||||||
|
|
||||||
void infoHeader()
|
void infoHeader(const char *format, ...) {
|
||||||
{
|
|
||||||
info_header = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void infoHeader(const char *format, ...)
|
|
||||||
{
|
|
||||||
if (opt->info_mode <= 0)
|
if (opt->info_mode <= 0)
|
||||||
return;
|
return;
|
||||||
va_list args;
|
va_list args;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
va_start(args,format);
|
va_start(args, format);
|
||||||
upx_safe_vsnprintf(buf,sizeof(buf),format,args);
|
upx_safe_vsnprintf(buf, sizeof(buf), format, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
info_print(buf);
|
info_print(buf);
|
||||||
info_header = 1;
|
info_header = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void info(const char *format, ...) {
|
||||||
void info(const char *format, ...)
|
|
||||||
{
|
|
||||||
if (opt->info_mode <= 0)
|
if (opt->info_mode <= 0)
|
||||||
return;
|
return;
|
||||||
va_list args;
|
va_list args;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
const int n = 4 * info_header;
|
const int n = 4 * info_header;
|
||||||
memset(buf, ' ', n);
|
memset(buf, ' ', n);
|
||||||
va_start(args,format);
|
va_start(args, format);
|
||||||
upx_safe_vsnprintf(buf+n,sizeof(buf)-n,format,args);
|
upx_safe_vsnprintf(buf + n, sizeof(buf) - n, format, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
info_print(buf);
|
info_print(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void infoWarning(const char *format, ...) {
|
||||||
void infoWarning(const char *format, ...)
|
if (opt->info_mode <= 0) {
|
||||||
{
|
|
||||||
if (opt->info_mode <= 0)
|
|
||||||
{
|
|
||||||
// FIXME - should still print something here
|
// FIXME - should still print something here
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
va_list args;
|
va_list args;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
va_start(args,format);
|
va_start(args, format);
|
||||||
upx_safe_vsnprintf(buf,sizeof(buf),format,args);
|
upx_safe_vsnprintf(buf, sizeof(buf), format, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
info("[WARNING] %s\n", buf);
|
info("[WARNING] %s\n", buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void infoWriting(const char *what, long size) {
|
||||||
void infoWriting(const char *what, long size)
|
|
||||||
{
|
|
||||||
if (opt->info_mode <= 0)
|
if (opt->info_mode <= 0)
|
||||||
return;
|
return;
|
||||||
info("Writing %s: %ld bytes", what, size);
|
info("Writing %s: %ld bytes", what, size);
|
||||||
|
|||||||
Reference in New Issue
Block a user