-/* Use launch_other_browser as the default browser launcher, with the string
- passed in as the other_browser_cmd
- Resulting other_browser_cmd is always safe to free(), even if a pointer
- to a string constant is passed in */
-static void use_other_browser_cmd(struct swb_context *ctx, char *cmd) {
- size_t len = strlen(cmd);
-
- free(ctx->other_browser_cmd);
- ctx->other_browser_cmd = calloc(len+1, sizeof(char));
- if (!ctx->other_browser_cmd) {
- log_msg("malloc failed!\n");
- /* Ideally, we'd configure the built-in default here -- but
- it's possible we could be called in that path */
- exit(1);
- } else {
- ctx->other_browser_cmd = strncpy(ctx->other_browser_cmd,
- cmd, len+1);
- ctx->default_browser_launcher = launch_other_browser;
- }
-}
-