summaryrefslogtreecommitdiffstats
path: root/zcmp.cc
diff options
context:
space:
mode:
Diffstat (limited to 'zcmp.cc')
-rw-r--r--zcmp.cc23
1 files changed, 12 insertions, 11 deletions
diff --git a/zcmp.cc b/zcmp.cc
index f0603af..99a1540 100644
--- a/zcmp.cc
+++ b/zcmp.cc
@@ -95,7 +95,7 @@ const char * format_num3( long long num )
{
const char * const si_prefix = "kMGTPEZY";
const char * const binary_prefix = "KMGTPEZY";
- enum { buffers = 8, bufsize = 4 * sizeof (long long) };
+ enum { buffers = 8, bufsize = 4 * sizeof num };
static char buffer[buffers][bufsize]; // circle of static buffers for printf
static int current = 0;
@@ -408,26 +408,27 @@ int main( const int argc, const char * const argv[] )
const int code = parser.code( argind );
if( !code ) break; // no more options
const char * const pn = parser.parsed_name( argind ).c_str();
- const std::string & arg = parser.argument( argind );
+ const std::string & sarg = parser.argument( argind );
+ const char * const arg = sarg.c_str();
switch( code )
{
case 'b': print_bytes = true; break;
case 'h': show_help(); return 0;
- case 'i': parse_ignore_initial( arg.c_str(), pn, ignore_initial ); break;
+ case 'i': parse_ignore_initial( arg, pn, ignore_initial ); break;
case 'l': verbosity = 1; break;
- case 'M': parse_format_list( arg, pn ); break;
- case 'n': max_size = getnum( arg.c_str(), pn ); break;
+ case 'M': parse_format_list( sarg, pn ); break;
+ case 'n': max_size = getnum( arg, pn ); break;
case 'N': break;
- case 'O': parse_format_types2( arg, pn, format_types ); break;
+ case 'O': parse_format_types2( sarg, pn, format_types ); break;
case 'q':
case 's': verbosity = -1; break;
case 'v': verbosity = 1; break;
case 'V': show_version(); return 0;
- case bz2_opt: parse_compressor( arg, fmt_bz2 ); break;
- case gz_opt: parse_compressor( arg, fmt_gz ); break;
- case lz_opt: parse_compressor( arg, fmt_lz ); break;
- case xz_opt: parse_compressor( arg, fmt_xz ); break;
- case zst_opt: parse_compressor( arg, fmt_zst ); break;
+ case bz2_opt: parse_compressor( sarg, fmt_bz2 ); break;
+ case gz_opt: parse_compressor( sarg, fmt_gz ); break;
+ case lz_opt: parse_compressor( sarg, fmt_lz ); break;
+ case xz_opt: parse_compressor( sarg, fmt_xz ); break;
+ case zst_opt: parse_compressor( sarg, fmt_zst ); break;
default : internal_error( "uncaught option." );
}
} // end process options