On Tue, Jul 10, 2012 at 02:33:24PM +0200, Peter Hatina wrote: > Another try. > > Peter Hatina > EMEA ENG-Desktop Development > Red Hat Czech, Brno > > --- > generator/Makefile.am | 2 +- > generator/options.cpp | 6 ++++-- > generator/options.h | 1 + > 3 files changed, 6 insertions(+), 3 deletions(-) > > diff --git a/generator/Makefile.am b/generator/Makefile.am > index b6a01f2..ce7f42c 100644 > --- a/generator/Makefile.am > +++ b/generator/Makefile.am > @@ -1,4 +1,4 @@ > -bin_PROGRAMS = spice_xpi_generator > +bin_PROGRAMS = spice-xpi-generator > spice_xpi_generator_SOURCES = \ > generator.cpp \ > main.cpp \ > diff --git a/generator/options.cpp b/generator/options.cpp > index 723ca7e..806c721 100644 > --- a/generator/options.cpp > +++ b/generator/options.cpp > @@ -18,6 +18,7 @@ > #include <iostream> > extern "C" { > # include <getopt.h> > +# include <libgen.h> I'd go with the GNU version of basename, the fact that the one from libgen.h is modifying its argument is a bit worrisome (see man 3 basename). Looks good otherwise. Christophe > } > #include "options.h" > > @@ -25,7 +26,8 @@ Options::Options(int argc, char **argv): > m_help(false), > m_good(true), > m_input_filename(), > - m_output_filename() > + m_output_filename(), > + m_bin_name(argv && argv[0] ? basename(argv[0]) : "spice-xpi-generator") > { > static struct option longopts[] = { > { "input", required_argument, NULL, 'i' }, > @@ -60,7 +62,7 @@ Options::~Options() > void Options::printHelp() const > { > std::cout << "Spice-xpi test page generator\n\n" > - << "Usage: ./generator [-h] [-i input] [-o output]\n\n" > + << "Usage: " << m_bin_name << " [-h] [-i input] [-o output]\n\n" > << "Application options:\n" > << " -i, --input input filename (stdin used, if not specified)\n" > << " -o, --output output filename (stdout used, if not specified)\n" > diff --git a/generator/options.h b/generator/options.h > index 7c990e5..dfac369 100644 > --- a/generator/options.h > +++ b/generator/options.h > @@ -37,6 +37,7 @@ private: > bool m_good; > std::string m_input_filename; > std::string m_output_filename; > + const std::string m_bin_name; > }; > > #endif // OPTIONS_H > -- > 1.7.10.4 > > _______________________________________________ > Spice-devel mailing list > Spice-devel@xxxxxxxxxxxxxxxxxxxxx > http://lists.freedesktop.org/mailman/listinfo/spice-devel
Attachment:
pgpU8vKdEwT4i.pgp
Description: PGP signature
_______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel