+static int
+catch_command_errors (catch_command_errors_ftype *command,
+ char *arg, int from_tty)
+{
+ TRY
+ {
+ int was_sync = current_ui->prompt_state == PROMPT_BLOCKED;
+
+ command (arg, from_tty);
+
+ maybe_wait_sync_command_done (was_sync);
+ }
+ CATCH (e, RETURN_MASK_ALL)
+ {
+ return handle_command_errors (e);
+ }
+ END_CATCH
+
+ return 1;
+}
+
+/* Type of the command callback passed to catch_command_errors_const. */
+
+typedef void (catch_command_errors_const_ftype) (const char *, int);
+
+/* Like catch_command_errors, but works with const command and args. */
+
+static int
+catch_command_errors_const (catch_command_errors_const_ftype *command,
+ const char *arg, int from_tty)
+{
+ TRY
+ {
+ int was_sync = current_ui->prompt_state == PROMPT_BLOCKED;
+
+ command (arg, from_tty);
+
+ maybe_wait_sync_command_done (was_sync);
+ }
+ CATCH (e, RETURN_MASK_ALL)
+ {
+ return handle_command_errors (e);
+ }
+ END_CATCH
+
+ return 1;
+}
+
+/* Adapter for symbol_file_add_main that translates 'from_tty' to a
+ symfile_add_flags. */
+
+static void
+symbol_file_add_main_adapter (const char *arg, int from_tty)
+{
+ symfile_add_flags add_flags = 0;
+
+ if (from_tty)
+ add_flags |= SYMFILE_VERBOSE;
+
+ symbol_file_add_main (arg, add_flags);
+}
+
+/* Type of this option. */
+enum cmdarg_kind
+{
+ /* Option type -x. */
+ CMDARG_FILE,
+
+ /* Option type -ex. */
+ CMDARG_COMMAND,
+
+ /* Option type -ix. */
+ CMDARG_INIT_FILE,