- printf("Load the following URL in your browser and authorize nmh"
- " to access %s:\n"
- "\n%s\n\n"
- "Enter the authorization code: ",
- mh_oauth_svc_display_name(ctx), url);
+ if (browser) {
+ char *command = concat(browser, " '", url, "'", NULL);
+ int status = OK;
+
+ printf("Follow the prompts in your browser to authorize nmh"
+ " to access %s.\n",
+ mh_oauth_svc_display_name(ctx));
+ sleep(1);
+
+ status = system(command);
+ free(command);
+
+ if (status != OK) {
+ adios ((char *) browser, "SYSTEM");
+ }
+ } else {
+ printf("Load the following URL in your browser and authorize nmh"
+ " to access %s:\n\n%s\n\n",
+ mh_oauth_svc_display_name(ctx), url);
+ }
+ printf("Enter the authorization code: ");