Skip to content

Commit

Permalink
Include license and warranty statement with solc.
Browse files Browse the repository at this point in the history
  • Loading branch information
chriseth committed Jun 8, 2017
1 parent 1fba984 commit d6c3a9b
Show file tree
Hide file tree
Showing 2 changed files with 701 additions and 3 deletions.
28 changes: 25 additions & 3 deletions solc/CommandLineInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ static string const g_strHelp = "help";
static string const g_strInputFile = "input-file";
static string const g_strInterface = "interface";
static string const g_strJulia = "julia";
static string const g_strLicense = "license";
static string const g_strLibraries = "libraries";
static string const g_strLink = "link";
static string const g_strMetadata = "metadata";
Expand Down Expand Up @@ -186,6 +187,14 @@ static void version()
exit(0);
}

static void license()
{
cout <<
#include <solc/license_escaped.h>
<< endl;
exit(0);
}

static bool needsHumanTargetedStdout(po::variables_map const& _args)
{
if (_args.count(g_argGas))
Expand Down Expand Up @@ -510,8 +519,13 @@ void CommandLineInterface::createFile(string const& _fileName, string const& _da
bool CommandLineInterface::parseArguments(int _argc, char** _argv)
{
// Declare the supported options.
po::options_description desc(
R"(solc, the Solidity commandline compiler.
po::options_description desc(R"(solc, the Solidity commandline compiler.
Solidity Copyright (C) 2014-2017 Ethereum Foundation.
This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you
are welcome to redistribute it under certain conditions. See 'solc --license'
for details.
Usage: solc [options] [input_file...]
Compiles the given Solidity input files (or the standard input if none given or
"-" is used as a file name) and outputs the components specified in the options
Expand All @@ -523,10 +537,12 @@ remap paths using the context:prefix=path syntax.
Allowed options)",
po::options_description::m_default_line_length,
po::options_description::m_default_line_length - 23);
po::options_description::m_default_line_length - 23
);
desc.add_options()
(g_argHelp.c_str(), "Show help message and exit.")
(g_argVersion.c_str(), "Show version and exit.")
(g_strLicense.c_str(), "Show licensing information and exit.")
(g_argOptimize.c_str(), "Enable bytecode optimizer.")
(
g_argOptimizeRuns.c_str(),
Expand Down Expand Up @@ -633,6 +649,12 @@ Allowed options)",
return false;
}

if (m_args.count(g_strLicense))
{
license();
return false;
}

if (m_args.count(g_argCombinedJson))
{
vector<string> requests;
Expand Down
Loading

0 comments on commit d6c3a9b

Please sign in to comment.