aboutsummaryrefslogtreecommitdiff
path: root/src/main.cc
diff options
context:
space:
mode:
authorRichard Qin <richard.qin.x@gmail.com>2026-04-13 04:34:50 +0800
committerRichard Qin <richard.qin.x@gmail.com>2026-04-13 04:34:50 +0800
commit8449f5fcefc5406f1666257bacb3bb1afda978e1 (patch)
treefe3dc5b34916f69b4aef6795d7f14abc298609e1 /src/main.cc
parent466e609d1a3c8efa4eea4b0fb4b1aeecd0d0706a (diff)
downloadrwebbrowser-8449f5fcefc5406f1666257bacb3bb1afda978e1.tar.gz
rwebbrowser-8449f5fcefc5406f1666257bacb3bb1afda978e1.tar.xz
feat: implement configurable homepage and user-agent via config.txt
Diffstat (limited to 'src/main.cc')
-rw-r--r--src/main.cc28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/main.cc b/src/main.cc
index 1037833..562861a 100644
--- a/src/main.cc
+++ b/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://" );
}