📄 help.cpp
字号:
/* help.cpp -- This file is part of the UPX executable compressor. Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer Copyright (C) 1996-2007 Laszlo Molnar All Rights Reserved. UPX and the UCL library are free software; you can redistribute them and/or modify them under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Markus F.X.J. Oberhumer Laszlo Molnar <mfx@users.sourceforge.net> <ml1050@users.sourceforge.net> */#include "conf.h"#include "compress.h"#include "packmast.h"#include "packer.h"/*************************************************************************//**************************************************************************/static bool head_done = 0;void show_head(void){ FILE *f = con_term; int fg; if (head_done) return; head_done = 1;#define V(x) (strcmp(UPX_VERSION_STRING, UPX_VERSION_STRING4) ? UPX_VERSION_STRING : UPX_VERSION_STRING x) fg = con_fg(f,FG_GREEN); con_fprintf(f, " Ultimate Packer for eXecutables\n" " Copyright (C) 1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007\n" "UPX %-10s Markus Oberhumer, Laszlo Molnar & John Reiser %14s\n\n",#if (ACC_OS_DOS16 || ACC_OS_DOS32) V("d"),#elif (ACC_OS_WIN16 || ACC_OS_WIN32 || ACC_OS_WIN64) V("w"),#elif 0 && defined(__linux__) V("l"),#else UPX_VERSION_STRING,#endif UPX_VERSION_DATE); fg = con_fg(f,fg);#undef V UNUSED(fg);}/*************************************************************************//**************************************************************************/void show_usage(void){ FILE *f = con_term; con_fprintf(f,"Usage: %s [-123456789dlthVL] [-qvfk] [-o file] %sfile..\n", progname,#if defined(__DJGPP__) || defined(__EMX__) "[@]");#else "");#endif}/*************************************************************************//**************************************************************************/struct PackerNames{ struct Entry { const char* fname; const char* sname; }; Entry names[64]; size_t names_count; const options_t *o; PackerNames() : names_count(0), o(NULL) { } void add(const Packer *p) { p->assertPacker(); assert(names_count < 64); names[names_count].fname = p->getFullName(o); names[names_count].sname = p->getName(); names_count++; } static Packer* visit(Packer *p, void *user) { PackerNames *self = (PackerNames *) user; self->add(p); return NULL; } static int __acc_cdecl_qsort cmp_fname(const void *a, const void *b) { return strcmp(((const Entry *) a)->fname, ((const Entry *) b)->fname); } static int __acc_cdecl_qsort cmp_sname(const void *a, const void *b) { return strcmp(((const Entry *) a)->sname, ((const Entry *) b)->sname); }};static void show_all_packers(FILE *f, int verbose){ options_t o; o.reset(); PackerNames pn; pn.o = &o; PackMaster::visitAllPackers(pn.visit, NULL, &o, &pn); qsort(pn.names, pn.names_count, sizeof(PackerNames::Entry), pn.cmp_fname); size_t pos = 0; for (size_t i = 0; i < pn.names_count; ++i) { const char *fn = pn.names[i].fname; const char *sn = pn.names[i].sname; if (verbose) { con_fprintf(f, " %-32s %s\n", fn, sn); } else { if (pos == 0) { con_fprintf(f, " %s", fn); pos = 2 + strlen(fn); } else if (pos + 1 + strlen(fn) > 80) { con_fprintf(f, "\n %s", fn); pos = 2 + strlen(fn); } else { con_fprintf(f, " %s", fn); pos += 1 + strlen(fn); } } } if (!verbose && pn.names_count) con_fprintf(f, "\n");}/*************************************************************************//**************************************************************************/void show_help(int verbose){ FILE *f = con_term; int fg; show_head(); show_usage(); fg = con_fg(f,FG_YELLOW); con_fprintf(f,"\nCommands:\n"); fg = con_fg(f,fg); con_fprintf(f, " -1 compress faster -9 compress better\n" "%s" " -d decompress -l list compressed file\n" " -t test compressed file -V display version number\n" " -h give %s help -L display software license\n%s", verbose == 0 ? "" : " --best compress best (can be slow for big files)\n", verbose == 0 ? "more" : "this", verbose == 0 ? "" : "\n"); fg = con_fg(f,FG_YELLOW); con_fprintf(f,"Options:\n"); fg = con_fg(f,fg); con_fprintf(f, " -q be quiet -v be verbose\n" " -oFILE write output to 'FILE'\n" //" -f force overwrite of output files and compression of suspicious files\n" " -f force compression of suspicious files\n" "%s%s" , (verbose == 0) ? " -k keep backup files\n" : ""#if 1 , (verbose > 0) ? " --no-color, --mono, --color, --no-progress change look\n" : ""#else , ""#endif ); if (verbose > 0) { fg = con_fg(f,FG_YELLOW); con_fprintf(f,"\nCompression tuning options:\n"); fg = con_fg(f,fg); con_fprintf(f, " --brute try all available compression methods & filters [slow]\n" " --ultra-brute try even more compression variants [very slow]\n" "\n"); fg = con_fg(f,FG_YELLOW); con_fprintf(f,"Backup options:\n"); fg = con_fg(f,fg); con_fprintf(f, " -k, --backup keep backup files\n" " --no-backup no backup files [default]\n" "\n"); fg = con_fg(f,FG_YELLOW); con_fprintf(f,"Overlay options:\n"); fg = con_fg(f,fg); con_fprintf(f, " --overlay=copy copy any extra data attached to the file [default]\n" " --overlay=strip strip any extra data attached to the file [DANGEROUS]\n" " --overlay=skip don't compress a file with an overlay\n"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -