diff --git a/src/file.h b/src/file.h index c8e7ef6b..fc5422c6 100644 --- a/src/file.h +++ b/src/file.h @@ -131,7 +131,7 @@ public: off_t getBytesWritten() const { return bytes_written; } - // FIXME - these won't work when using the `--stdout' option + // FIXME - these won't work when using the '--stdout' option virtual void seek(off_t off, int whence) { assert(!opt->to_stdout); diff --git a/src/help.cpp b/src/help.cpp index cd1111ec..f65d2ab2 100644 --- a/src/help.cpp +++ b/src/help.cpp @@ -136,7 +136,7 @@ static void show_all_packers(FILE *f, int verbose) const char *sn = pn.names[i].sname; if (verbose) { - con_fprintf(f, " %-30s %s\n", fn, sn); + con_fprintf(f, " %-32s %s\n", fn, sn); } else { @@ -187,7 +187,7 @@ void show_help(int verbose) con_fprintf(f, " -q be quiet -v be verbose\n" - " -oFILE write output to `FILE'\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" @@ -202,7 +202,14 @@ void show_help(int verbose) if (verbose > 0) { fg = con_fg(f,FG_YELLOW); - con_fprintf(f,"\nBackup options:\n"); + con_fprintf(f,"\nCompression tuning options:\n"); + fg = con_fg(f,fg); + con_fprintf(f, + " --brute try all available compression methods & filters\n" + " --ultra-brute try even more compression variants\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" @@ -312,15 +319,22 @@ void show_help(int verbose) "\n"); } - con_fprintf(f, - "file.. executables to (de)compress\n" - "\n"); - fg = con_fg(f,FG_YELLOW); - con_fprintf(f,"This version supports:\n"); - fg = con_fg(f,fg); - show_all_packers(f, verbose); + con_fprintf(f, "file.. executables to (de)compress\n"); + + if (verbose > 0) + { + fg = con_fg(f,FG_YELLOW); + con_fprintf(f,"\nThis version supports:\n"); + fg = con_fg(f,fg); + show_all_packers(f, verbose); + } + else + { + con_fprintf(f,"\nType '%s --help' for more detailed help.\n", progname); + } + con_fprintf(f,"\nUPX comes with ABSOLUTELY NO WARRANTY; for details visit http://upx.sf.net\n" -// "\nUPX comes with ABSOLUTELY NO WARRANTY; for details type `upx -L'.\n" +// "\nUPX comes with ABSOLUTELY NO WARRANTY; for details type 'upx -L'.\n" ""); #if defined(DEBUG) || defined(TESTING) @@ -423,7 +437,7 @@ void show_version(int x) #if defined(WITH_LZMA) fprintf(fp, "Copyright (C) 1999-2006 Igor Pavlov\n"); #endif - fprintf(fp, "UPX comes with ABSOLUTELY NO WARRANTY; for details type `%s -L'.\n", progname); + fprintf(fp, "UPX comes with ABSOLUTELY NO WARRANTY; for details type '%s -L'.\n", progname); } diff --git a/src/main.cpp b/src/main.cpp index 2196f77b..31a4f17a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -183,7 +183,7 @@ static void e_method(int m, int l) static void e_optarg(const char *n) { fflush(con_term); - fprintf(stderr,"%s: invalid argument in option `%s'\n", argv0, n); + fprintf(stderr,"%s: invalid argument in option '%s'\n", argv0, n); e_exit(EXIT_USAGE); } @@ -191,7 +191,7 @@ static void e_optarg(const char *n) static void e_optval(const char *n) { fflush(con_term); - fprintf(stderr,"%s: invalid value for option `%s'\n", argv0, n); + fprintf(stderr,"%s: invalid value for option '%s'\n", argv0, n); e_exit(EXIT_USAGE); } @@ -201,10 +201,10 @@ void e_envopt(const char *n) { fflush(con_term); if (n) - fprintf(stderr,"%s: invalid string `%s' in environment variable `%s'\n", + fprintf(stderr,"%s: invalid string '%s' in environment variable '%s'\n", argv0, n, OPTIONS_VAR); else - fprintf(stderr,"%s: illegal option in environment variable `%s'\n", + fprintf(stderr,"%s: illegal option in environment variable '%s'\n", argv0, OPTIONS_VAR); e_exit(EXIT_USAGE); } @@ -227,7 +227,7 @@ void check_not_both(bool e1, bool e2, const char *c1, const char *c2) if (e1 && e2) { fprintf(stderr,"%s: ",argv0); - fprintf(stderr,"cannot use both `%s' and `%s'\n", c1, c2); + fprintf(stderr,"cannot use both '%s' and '%s'\n", c1, c2); e_usage(); } } @@ -264,14 +264,14 @@ void check_options(int i, int argc) check_not_both(opt->to_stdout, opt->output_name != NULL, "--stdout", "-o"); if (opt->to_stdout && opt->cmd == CMD_COMPRESS) { - fprintf(stderr,"%s: cannot use `--stdout' when compressing\n", argv0); + fprintf(stderr,"%s: cannot use '--stdout' when compressing\n", argv0); e_usage(); } if (opt->to_stdout || opt->output_name) { if (i + 1 != argc) { - fprintf(stderr,"%s: need exactly one argument when using `%s'\n", + fprintf(stderr,"%s: need exactly one argument when using '%s'\n", argv0, opt->to_stdout ? "--stdout" : "-o"); e_usage(); } @@ -333,7 +333,7 @@ static void set_output_name(const char *n, bool allow_m) #if 1 if (done_output_name > 0) { - fprintf(stderr,"%s: option `-o' more than once given\n",argv0); + fprintf(stderr,"%s: option '-o' more than once given\n",argv0); e_usage(); } #endif @@ -356,7 +356,7 @@ static void set_script_name(const char *n, bool allow_m) #if 1 if (done_script_name > 0) { - fprintf(stderr,"%s: option `--script' more than once given\n",argv0); + fprintf(stderr,"%s: option '--script' more than once given\n",argv0); e_usage(); } #endif @@ -508,10 +508,13 @@ static int do_option(int optc, const char *arg) set_cmd(CMD_HELP); break; case 'h'+256: -#if 0 - /* according to GNU standards */ - set_term(stdout); - opt->console = CON_FILE; +#if 1 + if (!acc_isatty(STDOUT_FILENO)) + { + /* according to GNU standards */ + set_term(stdout); + opt->console = CON_FILE; + } #endif show_help(1); e_exit(EXIT_OK); @@ -716,7 +719,7 @@ static int do_option(int optc, const char *arg) opt->backup = 1; break; case 541: - if (opt->backup != 1) // do not overide `--backup' + if (opt->backup != 1) // do not overide '--backup' opt->backup = 0; break; // overlay diff --git a/src/p_armpe.cpp b/src/p_armpe.cpp index 164d9cb0..8dfb9c83 100644 --- a/src/p_armpe.cpp +++ b/src/p_armpe.cpp @@ -554,7 +554,7 @@ void PackArmPe::pack(OutputFile *fo) if (ih.entry && ih.entry < rvamin) throwCantPack("run a virus scanner on this file!"); if (!opt->force && ih.subsystem == 1) - throwCantPack("subsystem `native' is not supported (try --force)"); + throwCantPack("subsystem 'native' is not supported (try --force)"); if (ih.filealign < 0x200) throwCantPack("filealign < 0x200 is not yet supported"); diff --git a/src/p_elf.h b/src/p_elf.h index 5c0c92f1..cd8d8f47 100644 --- a/src/p_elf.h +++ b/src/p_elf.h @@ -192,7 +192,7 @@ struct Shdr SHF_EXECINSTR = (1 << 2), /* Executable */ SHF_MERGE = (1 << 4), /* Might be merged */ SHF_STRINGS = (1 << 5), /* Contains nul-terminated strings */ - SHF_INFO_LINK = (1 << 6), /* `sh_info' contains SHT index */ + SHF_INFO_LINK = (1 << 6), /* 'sh_info' contains SHT index */ SHF_LINK_ORDER = (1 << 7), /* Preserve order after combining */ }; } diff --git a/src/p_lx_elf.cpp b/src/p_lx_elf.cpp index b8319f9a..a0879cbd 100644 --- a/src/p_lx_elf.cpp +++ b/src/p_lx_elf.cpp @@ -776,12 +776,12 @@ bool PackLinuxElf32::canPack() // additional requirements for linux/elf386 if (get_native16(&ehdr->e_ehsize) != sizeof(*ehdr)) { - throwCantPack("invalid Ehdr e_ehsize; try `--force-execve'"); + throwCantPack("invalid Ehdr e_ehsize; try '--force-execve'"); return false; } unsigned const e_phoff = get_native32(&ehdr->e_phoff); if (e_phoff != sizeof(*ehdr)) {// Phdrs not contiguous with Ehdr - throwCantPack("non-contiguous Ehdr/Phdr; try `--force-execve'"); + throwCantPack("non-contiguous Ehdr/Phdr; try '--force-execve'"); return false; } @@ -794,7 +794,7 @@ bool PackLinuxElf32::canPack() return false; if (1!=exetype && phdr->PT_LOAD32 == get_native32(&phdr->p_type)) { if (phdr->p_offset != 0) { - throwCantPack("invalid Phdr p_offset; try `--force-execve'"); + throwCantPack("invalid Phdr p_offset; try '--force-execve'"); return false; } exetype = 1; @@ -901,12 +901,12 @@ PackLinuxElf64amd::canPack() // additional requirements for linux/elf386 if (get_native16(&ehdr->e_ehsize) != sizeof(*ehdr)) { - throwCantPack("invalid Ehdr e_ehsize; try `--force-execve'"); + throwCantPack("invalid Ehdr e_ehsize; try '--force-execve'"); return false; } acc_uint64l_t const e_phoff = get_native64(&ehdr->e_phoff); if (e_phoff != sizeof(*ehdr)) {// Phdrs not contiguous with Ehdr - throwCantPack("non-contiguous Ehdr/Phdr; try `--force-execve'"); + throwCantPack("non-contiguous Ehdr/Phdr; try '--force-execve'"); return false; } @@ -919,7 +919,7 @@ PackLinuxElf64amd::canPack() if (phdr->PT_LOAD64 == get_native32(&phdr->p_type)) { // Just avoid the "rewind" when unpacking? //if (phdr->p_offset != 0) { - // throwCantPack("invalid Phdr p_offset; try `--force-execve'"); + // throwCantPack("invalid Phdr p_offset; try '--force-execve'"); // return false; //} exetype = 1; diff --git a/src/p_tmt.cpp b/src/p_tmt.cpp index 40b3476d..6f390661 100644 --- a/src/p_tmt.cpp +++ b/src/p_tmt.cpp @@ -168,7 +168,7 @@ int PackTmt::readFileHeader() fi->seek(adam_offset,SEEK_SET); fi->readx(&ih,sizeof(ih)); - // FIXME: should add some checks for the values in `ih' + // FIXME: should add some checks for the values in 'ih' return UPX_F_TMT_ADAM; #undef H4 diff --git a/src/p_tos.cpp b/src/p_tos.cpp index 6983626c..99517287 100644 --- a/src/p_tos.cpp +++ b/src/p_tos.cpp @@ -307,19 +307,19 @@ bool PackTos::checkFileHeader() if ((f & F_PROTMODE) != F_PROT_P) { if (opt->force < 1) - throwCantPack("no private memory protection; use option `-f' to force packing"); + throwCantPack("no private memory protection; use option '-f' to force packing"); } if (f & F_SHTEXT) { if (opt->force < 1) - throwCantPack("shared text segment; use option `-f' to force packing"); + throwCantPack("shared text segment; use option '-f' to force packing"); } #if 0 // fh_reserved seems to be unused if (ih.fh_reserved != 0) { if (opt->force < 1) - throwCantPack("reserved header field set; use option `-f' to force packing"); + throwCantPack("reserved header field set; use option '-f' to force packing"); } #endif return true; diff --git a/src/p_unix.cpp b/src/p_unix.cpp index fa5d7e60..6cb48ec6 100644 --- a/src/p_unix.cpp +++ b/src/p_unix.cpp @@ -62,7 +62,7 @@ bool PackUnix::canPack() #if defined(__unix__) // must be executable by owner if ((fi->st.st_mode & S_IXUSR) == 0) - throwCantPack("file not executable; try `chmod +x'"); + throwCantPack("file not executable; try 'chmod +x'"); #endif if (file_size < 4096) throwCantPack("file is too small"); diff --git a/src/p_vmlinz.cpp b/src/p_vmlinz.cpp index ff47ea57..92c224ae 100644 --- a/src/p_vmlinz.cpp +++ b/src/p_vmlinz.cpp @@ -208,7 +208,7 @@ int PackVmlinuzI386::decompressKernel() if (fd_pos != file_size) { //printf("fd_pos: %ld, file_size: %ld\n", (long)fd_pos, (long)file_size); - throwCantPack("trailing bytes after kernel image; use option `-f' to force packing"); + throwCantPack("trailing bytes after kernel image; use option '-f' to force packing"); } @@ -227,7 +227,7 @@ int PackVmlinuzI386::decompressKernel() && 0x0F==ibuf[19] && 0xA2==ibuf[20] // cpuid ) goto head_ok; - throwCantPack("unrecognized kernel architecture; use option `-f' to force packing"); + throwCantPack("unrecognized kernel architecture; use option '-f' to force packing"); head_ok: // FIXME: more checks for special magic bytes in ibuf ??? diff --git a/src/p_w32pe.cpp b/src/p_w32pe.cpp index a6e6cb1e..534211d4 100644 --- a/src/p_w32pe.cpp +++ b/src/p_w32pe.cpp @@ -649,7 +649,7 @@ void PackW32Pe::pack(OutputFile *fo) if (ih.entry && ih.entry < rvamin) throwCantPack("run a virus scanner on this file!"); if (!opt->force && ih.subsystem == 1) - throwCantPack("subsystem `native' is not supported (try --force)"); + throwCantPack("subsystem 'native' is not supported (try --force)"); if (ih.filealign < 0x200) throwCantPack("filealign < 0x200 is not yet supported"); diff --git a/src/packer.cpp b/src/packer.cpp index 8757f17f..ba4d660a 100644 --- a/src/packer.cpp +++ b/src/packer.cpp @@ -538,7 +538,7 @@ void Packer::checkOverlay(unsigned overlay) return; info("Found overlay: %d bytes", overlay); if (opt->overlay == opt->SKIP_OVERLAY) - throw OverlayException("file has overlay -- skipped; try `--overlay=copy'"); + throw OverlayException("file has overlay -- skipped; try '--overlay=copy'"); } @@ -732,7 +732,7 @@ void Packer::checkAlreadyPacked(const void *b, int blen) //if (!tmp.fillPackHeader((unsigned char *)b + boff, blen - boff)) // return; // - // This also would require that the buffer in `b' holds + // This also would require that the buffer in 'b' holds // the full PackHeader, and not only the 4 magic bytes. throwAlreadyPacked(); diff --git a/src/snprintf.cpp b/src/snprintf.cpp index 952a417f..41b73a14 100644 --- a/src/snprintf.cpp +++ b/src/snprintf.cpp @@ -333,7 +333,7 @@ static double my_modf(double x0, double *iptr) static void fmtfp (char *buffer, size_t *currlen, size_t maxlen, LDOUBLE fvalue, int min, int max, int flags) { - /* avoid warnings with `gcc -Wshadow' */ + /* avoid warnings with 'gcc -Wshadow' */ #undef index #define index iindex int signvalue = 0; diff --git a/src/ui.cpp b/src/ui.cpp index 5cd70d03..7f547c28 100644 --- a/src/ui.cpp +++ b/src/ui.cpp @@ -241,7 +241,7 @@ void UiPacker::startCallback(unsigned u_len, unsigned step, s->bar_len = 64; s->pos = -2; s->spin_counter = 0; - s->bar_pos = 1; // because of the leading `\r' + s->bar_pos = 1; // because of the leading '\r' s->pass_digits = 0; cb.reset(); @@ -481,7 +481,7 @@ void UiPacker::doCallback(unsigned isize, unsigned osize) #if 0 s->screen->putString(s->screen,msg,s->b_cx,s->b_cy); #else - // FIXME: this doesn't honor `--mono' etc. + // FIXME: this doesn't honor '--mono' etc. int attr = FG_CYAN | s->s_bg; s->screen->putStringAttr(s->screen,msg,attr,s->b_cx,s->b_cy); #endif diff --git a/src/work.cpp b/src/work.cpp index 544e2f93..1326b79b 100644 --- a/src/work.cpp +++ b/src/work.cpp @@ -108,7 +108,7 @@ void do_one_file(const char *iname, char *oname) if (opt->to_stdout) { if (!fo.openStdout(1, opt->force ? true : false)) - throwIOException("data not written to a terminal; Use `-f' to force."); + throwIOException("data not written to a terminal; Use '-f' to force."); } else {