"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "arg_parser.cc" between
zutils-1.8.tar.lz and zutils-1.9.tar.lz

About: Zutils is a collection of utilities able to deal with any combination of compressed and non-compressed files transparently. The utilities zcat, zcmp, zdiff, zgrep and ztest supports the compressors bzip2, gzip, lzip and xz.

arg_parser.cc  (zutils-1.8.tar.lz):arg_parser.cc  (zutils-1.9.tar.lz)
/* Arg_parser - POSIX/GNU command line argument parser. (C++ version) /* Arg_parser - POSIX/GNU command line argument parser. (C++ version)
Copyright (C) 2006-2019 Antonio Diaz Diaz. Copyright (C) 2006-2020 Antonio Diaz Diaz.
This library is free software. Redistribution and use in source and This library is free software. Redistribution and use in source and
binary forms, with or without modification, are permitted provided binary forms, with or without modification, are permitted provided
that the following conditions are met: that the following conditions are met:
1. Redistributions of source code must retain the above copyright 1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer. notice, this list of conditions, and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright 2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the notice, this list of conditions, and the following disclaimer in the
documentation and/or other materials provided with the distribution. documentation and/or other materials provided with the distribution.
This library is distributed in the hope that it will be useful, This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/ */
#include <cstring> #include <cstring>
#include <string> #include <string>
#include <vector> #include <vector>
#include "arg_parser.h" #include "arg_parser.h"
bool Arg_parser::parse_long_option( const char * const opt, const char * const a rg, bool Arg_parser::parse_long_option( const char * const opt, const char * const a rg,
const Option options[], int & argind ) const Option options[], int & argind )
skipping to change at line 167 skipping to change at line 167
else if( !parse_long_option( opt, arg, options, argind ) ) break; else if( !parse_long_option( opt, arg, options, argind ) ) break;
} }
else if( !parse_short_option( opt, arg, options, argind ) ) break; else if( !parse_short_option( opt, arg, options, argind ) ) break;
} }
else else
{ {
if( in_order ) data.push_back( Record( argv[argind++] ) ); if( in_order ) data.push_back( Record( argv[argind++] ) );
else non_options.push_back( argv[argind++] ); else non_options.push_back( argv[argind++] );
} }
} }
if( error_.size() ) data.clear(); if( !error_.empty() ) data.clear();
else else
{ {
for( unsigned i = 0; i < non_options.size(); ++i ) for( unsigned i = 0; i < non_options.size(); ++i )
data.push_back( Record( non_options[i] ) ); data.push_back( Record( non_options[i] ) );
while( argind < argc ) while( argind < argc )
data.push_back( Record( argv[argind++] ) ); data.push_back( Record( argv[argind++] ) );
} }
} }
Arg_parser::Arg_parser( const char * const opt, const char * const arg, Arg_parser::Arg_parser( const char * const opt, const char * const arg,
skipping to change at line 189 skipping to change at line 189
{ {
if( !opt || !opt[0] || !options ) return; if( !opt || !opt[0] || !options ) return;
if( opt[0] == '-' && opt[1] ) // we found an option if( opt[0] == '-' && opt[1] ) // we found an option
{ {
int argind = 1; // dummy int argind = 1; // dummy
if( opt[1] == '-' ) if( opt[1] == '-' )
{ if( opt[2] ) parse_long_option( opt, arg, options, argind ); } { if( opt[2] ) parse_long_option( opt, arg, options, argind ); }
else else
parse_short_option( opt, arg, options, argind ); parse_short_option( opt, arg, options, argind );
if( error_.size() ) data.clear(); if( !error_.empty() ) data.clear();
} }
else data.push_back( Record( opt ) ); else data.push_back( Record( opt ) );
} }
 End of changes. 4 change blocks. 
18 lines changed or deleted 18 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)