diff options
| author | Richard Qin <richard.qin.x@gmail.com> | 2026-04-13 04:34:50 +0800 |
|---|---|---|
| committer | Richard Qin <richard.qin.x@gmail.com> | 2026-04-13 04:34:50 +0800 |
| commit | 2141017d7c688a0f6659c3ffe5730f281f7551ae (patch) | |
| tree | f8a586c0dae38f3291a9580e9b24d73204b4f109 /ricochet/src/main.cc | |
| parent | c495d71d413da0db8be510e290787fd576835842 (diff) | |
| download | rcc-project-2141017d7c688a0f6659c3ffe5730f281f7551ae.tar.gz rcc-project-2141017d7c688a0f6659c3ffe5730f281f7551ae.tar.xz | |
feat: implement configurable homepage and user-agent via config.txt
Diffstat (limited to 'ricochet/src/main.cc')
| -rw-r--r-- | ricochet/src/main.cc | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/ricochet/src/main.cc b/ricochet/src/main.cc index 1037833..562861a 100644 --- a/ricochet/src/main.cc +++ b/ricochet/src/main.cc @@ -16,6 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ +#include <fstream> #include <iostream> #include <span> #include <string_view> @@ -41,28 +42,27 @@ int main( int argc, char* argv[] ) ricochet::core::print_license_notice(); + std::string start_url; if ( args.size() < 2 ) { - std::cerr << "Error: No URL provided.\n"; - print_usage( args[0] ); - return 1; + start_url = ricochet::core::Browser::get_configured_homepage(); + } else { + start_url = std::string( args[1] ); } - const std::string_view input = args[1]; - - if ( input == "show" ) { - if ( args[2] == "w" ) { + if ( args.size() >= 2 && args[1] == "show" ) { + if ( args.size() >= 3 && args[2] == "w" ) { ricochet::core::show_warranty(); - } else if ( args[2] == "c" ) { + return 0; + } + if ( args.size() >= 3 && args[2] == "c" ) { ricochet::core::show_copying(); - } else { - std::cerr << "Error: Invalid argument for show command.\n"; - print_usage( args[0] ); - return 1; + return 0; } - return 0; + std::cerr << "Error: Invalid argument for show command.\n"; + print_usage( args[0] ); + return 1; } - std::string start_url( input ); if ( !start_url.starts_with( "http://" ) && !start_url.starts_with( "https://" ) ) { start_url.insert( 0, "https://" ); } |
