summaryrefslogtreecommitdiffstats
path: root/zcmpdiff.cc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2022-12-08 15:52:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2022-12-08 15:52:49 +0000
commit5a7a494ba28f0dfaa5792f70585ca4dfe3c3051a (patch)
treebf7d15bc5746003a969b81574707882fbe2df8cb /zcmpdiff.cc
parentReleasing debian version 1.12~pre2-2. (diff)
downloadzutils-5a7a494ba28f0dfaa5792f70585ca4dfe3c3051a.tar.xz
zutils-5a7a494ba28f0dfaa5792f70585ca4dfe3c3051a.zip
Merging upstream version 1.12~rc1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'zcmpdiff.cc')
-rw-r--r--zcmpdiff.cc12
1 files changed, 7 insertions, 5 deletions
diff --git a/zcmpdiff.cc b/zcmpdiff.cc
index 5688ee2..31b3f86 100644
--- a/zcmpdiff.cc
+++ b/zcmpdiff.cc
@@ -54,11 +54,13 @@ void parse_format_types2( const std::string & arg, const char * const pn,
int format_types[2] )
{
const unsigned i = std::min( arg.find( ',' ), arg.size() );
- if( i > 0 ) format_types[0] = parse_format_type( arg.substr( 0, i ), pn );
- else format_types[0] = -1;
- if( i + 1 < arg.size() ) format_types[1] =
- parse_format_type( arg.substr( i + 1 ), pn );
- else format_types[1] = -1;
+ if( i != std::min( arg.rfind( ',' ), arg.size() ) )
+ { show_option_error( arg.c_str(), "Too many formats in", pn );
+ std::exit( 1 ); }
+ format_types[0] =
+ ( i > 0 ) ? parse_format_type( arg.substr( 0, i ), pn ) : -1;
+ format_types[1] =
+ ( i + 1 < arg.size() ) ? parse_format_type( arg.substr( i + 1 ), pn ) : -1;
}