Prepared for first GUI version.

committer: mfx <mfx> 968541447 +0000
This commit is contained in:
Markus F.X.J. Oberhumer
2000-09-09 23:17:27 +00:00
parent 679fabef25
commit 4e6fc92d8a
12 changed files with 67 additions and 23 deletions
+5 -1
View File
@@ -50,8 +50,10 @@
#endif
// just in case
#undef NDEBUG
#undef dos
#undef linux
#undef small
#undef tos
#undef unix
@@ -503,7 +505,7 @@ struct options_t {
bool le;
} wcle;
struct {
bool compress_exports;
int compress_exports;
int compress_icons;
bool compress_resources;
int strip_relocs;
@@ -515,6 +517,7 @@ extern struct options_t * volatile opt;
// main.cpp
extern const char *progname;
void init_options(struct options_t *o);
bool set_ec(int ec);
#if defined(__GNUC__)
void e_exit(int ec) __attribute__((noreturn));
@@ -527,6 +530,7 @@ void e_exit(int ec);
void printSetNl(int need_nl);
void printClearLine(FILE *f = NULL);
void printErr(const char *iname, const Throwable *e);
void printUnhandledException(const char *iname, const exception *e);
#if defined(__GNUC__)
void printErr(const char *iname, const char *format, ...)
__attribute__((format(printf,2,3)));
+4
View File
@@ -37,6 +37,10 @@
#undef USE_SCREEN_CURSES
#undef USE_FRAMES
#if defined(WITH_GUI) && !defined(NO_CONSOLE)
# define NO_CONSOLE
#endif
#if 1 && defined(__linux__)
# define USE_SCREEN
# define USE_SCREEN_VCSA
+3 -4
View File
@@ -238,7 +238,6 @@ con_fprintf(f,
con_fprintf(f,
" http://upx.tsx.org\n"
" http://wildsau.idv.uni-linz.ac.at/mfx/upx.html\n"
" http://www.nexus.hu/upx\n"
);
(void)con_fg(f,FG_ORANGE);
con_fprintf(f,
@@ -260,10 +259,10 @@ void show_version(int x)
UNUSED(x);
fprintf(f,"upx %s\n",UPX_VERSION_STRING);
#if defined(WITH_UCL)
fprintf(f,"UCL data compression library %s\n", ucl_version_string());
#elif defined(WITH_NRV)
#if defined(WITH_NRV)
fprintf(f,"NRV data compression library %s\n", nrv_version_string());
#elif defined(WITH_UCL)
fprintf(f,"UCL data compression library %s\n", ucl_version_string());
#endif
fprintf(f,"Copyright (C) 1996,1997,1998,1999,2000 Markus Franz Xaver Johannes Oberhumer\n");
fprintf(f,"Copyright (C) 1996,1997,1998,1999,2000 Laszlo Molnar\n");
+8 -5
View File
@@ -34,7 +34,7 @@
// options
**************************************************************************/
static void init_options(struct options_t *o)
void init_options(struct options_t *o)
{
memset(o, 0, sizeof(*o));
memset(&o->crp, 0xff, sizeof(o->crp));
@@ -51,7 +51,7 @@ static void init_options(struct options_t *o)
o->console = CON_INIT;
o->verbose = 2;
o->w32pe.compress_exports = true;
o->w32pe.compress_exports = 1;
o->w32pe.compress_icons = 2;
o->w32pe.compress_resources = true;
o->w32pe.strip_relocs = -1;
@@ -608,9 +608,8 @@ static int do_option(int optc, const char *arg)
opt->wcle.le = true;
break;
case 630:
opt->w32pe.compress_exports = true;
if (mfx_optarg && strcmp(mfx_optarg,"0") == 0)
opt->w32pe.compress_exports = false;
opt->w32pe.compress_exports = 1;
getoptvar(&opt->w32pe.compress_exports, 0, 1);
//printf("compress_exports: %d\n", opt->w32pe.compress_exports);
break;
case 631:
@@ -977,6 +976,8 @@ void upx_sanity_check(void)
// main entry point
**************************************************************************/
#if !defined(WITH_GUI)
int main(int argc, char *argv[])
{
int i;
@@ -1127,6 +1128,8 @@ int main(int argc, char *argv[])
return exit_code;
}
#endif /* !defined(WITH_GUI) */
/*
vi:ts=4:et:nowrap
+16
View File
@@ -145,6 +145,19 @@ void printWarn(const char *iname, const char *format, ...)
}
void printUnhandledException(const char *iname, const exception *e)
{
if (e)
printErr(iname,"unhandled exception: %s\n", prettyName(e->what()));
else
printErr(iname,"internal error: unhandled exception!\n");
if (opt->cmd != CMD_COMPRESS)
{
printErr(iname," this file has possibly been modified/hacked; take care!\n");
}
}
/*************************************************************************
// FIXME: should use colors and a consistent layout here
**************************************************************************/
@@ -208,7 +221,10 @@ void info(const char *format, ...)
void infoWarning(const char *format, ...)
{
if (opt->info_mode <= 0)
{
// FIXME - should still print something here
return;
}
va_list args;
char buf[1024];
va_start(args,format);
+8
View File
@@ -33,6 +33,10 @@ class OutputFile;
class Packer;
class UiPacker;
#if defined(WITH_GUI)
class CMainDlg;
#endif
/*************************************************************************
//
@@ -104,6 +108,10 @@ protected:
static long update_u_len;
static long update_fc_len;
static long update_fu_len;
#if defined(WITH_GUI)
CMainDlg* pMain;
#endif
};
+2 -2
View File
@@ -1,2 +1,2 @@
#define UPX_VERSION_STRING "1.09.2"
#define UPX_VERSION_DATE "May 13th 2000"
#define UPX_VERSION_STRING "1.09.3"
#define UPX_VERSION_DATE "Sep 10th 2000"
+11 -5
View File
@@ -65,7 +65,7 @@ void do_one_file(const char *iname, char *oname)
if (r == -1)
throw FileNotFoundException(iname);
if (!S_ISREG(st.st_mode))
if (!(S_ISREG(st.st_mode)))
throwIOException("not a regular file -- skipped");
#if defined(__unix__)
// no special bits may be set
@@ -124,7 +124,7 @@ void do_one_file(const char *iname, char *oname)
int omode = 0600;
fo.sopen(tname,flags,shmode,omode);
#endif
// open succeeded - set oname
// open succeeded - now set oname[]
strcpy(oname,tname);
}
}
@@ -177,6 +177,8 @@ void do_one_file(const char *iname, char *oname)
// make backup
char bakname[PATH_MAX+1];
makebakname(bakname,iname);
if (file_exists(bakname))
maketempname(bakname,iname,".000",1);
File::rename(iname,bakname);
}
File::rename(oname,iname);
@@ -213,6 +215,8 @@ void do_one_file(const char *iname, char *oname)
// process all files from the commandline
**************************************************************************/
#if !defined(WITH_GUI)
void do_files(int i, int argc, char *argv[])
{
if (opt->verbose >= 1)
@@ -247,19 +251,19 @@ void do_files(int i, int argc, char *argv[])
e_exit(EXIT_ERROR);
//throw;
} catch (const exception &e) {
printErr(iname,"unhandled exception: %s\n", prettyName(e.what()));
printUnhandledException(iname,&e);
if (oname[0])
(void) ::unlink(oname);
e_exit(EXIT_ERROR);
//throw;
} catch (const exception *e) {
printErr(iname,"unhandled exception: %s\n", prettyName(e->what()));
printUnhandledException(iname,e);
if (oname[0])
(void) ::unlink(oname);
e_exit(EXIT_ERROR);
//throw;
} catch (...) {
printErr(iname,"internal error: unhandled exception !\n");
printUnhandledException(iname,NULL);
if (oname[0])
(void) ::unlink(oname);
e_exit(EXIT_ERROR);
@@ -284,6 +288,8 @@ void do_files(int i, int argc, char *argv[])
UiPacker::uiFileInfoTotal();
}
#endif /* !defined(WITH_GUI) */
/*
vi:ts=4:et