* lin-lwp.c (stop_wait_callback): Remove bogus assertions in the
[deliverable/binutils-gdb.git] / gdb / top.c
index dd5a8c3a60855077bb945e0ba8e16fd9e39b1659..ccb6aecd6e4863316c7e5b6837bf5836ca48755c 100644 (file)
--- a/gdb/top.c
+++ b/gdb/top.c
 
 /* Prototypes for local functions */
 
-static void dont_repeat_command PARAMS ((char *, int));
+static void dont_repeat_command (char *, int);
 
-static void source_cleanup_lines PARAMS ((PTR));
+static void source_cleanup_lines (PTR);
 
-static void user_defined_command PARAMS ((char *, int));
+static void user_defined_command (char *, int);
 
-static void init_signals PARAMS ((void));
+static void init_signals (void);
 
 #ifdef STOP_SIGNAL
-static void stop_sig PARAMS ((int));
+static void stop_sig (int);
 #endif
 
-static char *line_completion_function PARAMS ((char *, int, char *, int));
+static char *line_completion_function (char *, int, char *, int);
 
-static char *readline_line_completion_function PARAMS ((char *, int));
+static char *readline_line_completion_function (char *, int);
 
-/* NOTE 1999-04-29: this function will be static again, after we make the
-   event loop be the default command loop for gdb, and we merge
-   event-top.c into this file, top.c */
-/* static */ void command_loop_marker PARAMS ((int));
+static void while_command (char *, int);
 
-static void while_command PARAMS ((char *, int));
+static void if_command (char *, int);
 
-static void if_command PARAMS ((char *, int));
+static struct command_line *build_command_line (enum command_control_type,
+                                               char *);
 
-static struct command_line *
-  build_command_line PARAMS ((enum command_control_type, char *));
+static struct command_line *get_command_line (enum command_control_type,
+                                             char *);
 
-static struct command_line *
-  get_command_line PARAMS ((enum command_control_type, char *));
+static void realloc_body_list (struct command_line *, int);
 
-static void realloc_body_list PARAMS ((struct command_line *, int));
-
-static enum misc_command_type read_next_line PARAMS ((struct command_line **));
+static enum misc_command_type read_next_line (struct command_line **);
 
 static enum command_control_type
-recurse_read_control_structure PARAMS ((struct command_line *));
+recurse_read_control_structure (struct command_line *);
 
-static struct cleanup *setup_user_args PARAMS ((char *));
+static struct cleanup *setup_user_args (char *);
 
-static char *locate_arg PARAMS ((char *));
+static char *locate_arg (char *);
 
-static char *insert_args PARAMS ((char *));
+static char *insert_args (char *);
 
-static void arg_cleanup PARAMS ((void));
+static void arg_cleanup (void *);
 
-static void init_main PARAMS ((void));
+static void init_main (void);
 
-static void init_cmd_lists PARAMS ((void));
+static void init_cmd_lists (void);
 
-static void float_handler PARAMS ((int));
+static void float_handler (int);
 
-static void init_signals PARAMS ((void));
+static void init_signals (void);
 
-static void set_verbose PARAMS ((char *, int, struct cmd_list_element *));
+static void set_verbose (char *, int, struct cmd_list_element *);
 
-static void show_history PARAMS ((char *, int));
+static void show_history (char *, int);
 
-static void set_history PARAMS ((char *, int));
+static void set_history (char *, int);
 
-static void set_history_size_command PARAMS ((char *, int,
-                                             struct cmd_list_element *));
+static void set_history_size_command (char *, int, struct cmd_list_element *);
 
-static void show_commands PARAMS ((char *, int));
+static void show_commands (char *, int);
 
-static void echo_command PARAMS ((char *, int));
+static void echo_command (char *, int);
 
-static void pwd_command PARAMS ((char *, int));
+static void pwd_command (char *, int);
 
-static void show_version PARAMS ((char *, int));
+static void show_version (char *, int);
 
-static void document_command PARAMS ((char *, int));
+static void document_command (char *, int);
 
-static void define_command PARAMS ((char *, int));
+static void define_command (char *, int);
 
-static void validate_comname PARAMS ((char *));
+static void validate_comname (char *);
 
-static void help_command PARAMS ((char *, int));
+static void help_command (char *, int);
 
-static void show_command PARAMS ((char *, int));
+static void show_command (char *, int);
 
-static void info_command PARAMS ((char *, int));
+static void info_command (char *, int);
 
-static void complete_command PARAMS ((char *, int));
+static void complete_command (char *, int);
 
-static void do_nothing PARAMS ((int));
+static void do_nothing (int);
 
-static void show_debug PARAMS ((char *, int));
+static void show_debug (char *, int);
 
-static void set_debug PARAMS ((char *, int));
+static void set_debug (char *, int);
 
 #ifdef SIGHUP
 /* NOTE 1999-04-29: This function will be static again, once we modify
    gdb to use the event loop as the default command loop and we merge
    event-top.c into this file, top.c */
-/* static */ int quit_cover PARAMS ((PTR));
+/* static */ int quit_cover (PTR);
 
-static void disconnect PARAMS ((int));
+static void disconnect (int);
 #endif
 
-static void source_cleanup PARAMS ((FILE *));
+static void do_restore_instream_cleanup (void *stream);
+
+static struct cleanup *make_cleanup_free_command_lines (struct command_line **);
 
 /* Default command line prompt.  This is overriden in some configs. */
 
@@ -284,14 +280,14 @@ char gdb_dirbuf[1024];
    The function receives two args: an input stream,
    and a prompt string.  */
 
-void (*window_hook) PARAMS ((FILE *, char *));
+void (*window_hook) (FILE *, char *);
 
 int epoch_interface;
 int xgdb_verbose;
 
 /* gdb prints this when reading a command interactively */
 static char *gdb_prompt_string;        /* the global prompt string */
-extern char *get_prompt PARAMS ((void));       /* access function for prompt string */
+extern char *get_prompt (void);        /* access function for prompt string */
 
 /* Buffer used for reading command lines, and the size
    allocated for it so far.  */
@@ -369,7 +365,7 @@ struct user_args
 #ifndef STOP_SIGNAL
 #ifdef SIGTSTP
 #define STOP_SIGNAL SIGTSTP
-static void stop_sig PARAMS ((int));
+static void stop_sig (int);
 #endif
 #endif
 
@@ -391,31 +387,31 @@ static void stop_sig PARAMS ((int));
 /* Called after most modules have been initialized, but before taking users
    command file.  */
 
-void (*init_ui_hook) PARAMS ((char *argv0));
+void (*init_ui_hook) (char *argv0);
 
 /* This hook is called from within gdb's many mini-event loops which could
    steal control from a real user interface's event loop. It returns
    non-zero if the user is requesting a detach, zero otherwise. */
 
-int (*ui_loop_hook) PARAMS ((int));
+int (*ui_loop_hook) (int);
 
 /* Called instead of command_loop at top level.  Can be invoked via
    return_to_top_level.  */
 
-void (*command_loop_hook) PARAMS ((void));
+void (*command_loop_hook) (void);
 
 
 /* Called from print_frame_info to list the line we stopped in.  */
 
-void (*print_frame_info_listing_hook) PARAMS ((struct symtab * s, int line,
-                                              int stopline, int noerror));
+void (*print_frame_info_listing_hook) (struct symtab * s, int line,
+                                      int stopline, int noerror);
 /* Replaces most of query.  */
 
-int (*query_hook) PARAMS ((const char *, va_list));
+int (*query_hook) (const char *, va_list);
 
 /* Replaces most of warning.  */
 
-void (*warning_hook) PARAMS ((const char *, va_list));
+void (*warning_hook) (const char *, va_list);
 
 /* These three functions support getting lines of text from the user.  They
    are used in sequence.  First readline_begin_hook is called with a text
@@ -428,51 +424,51 @@ void (*warning_hook) PARAMS ((const char *, va_list));
    to notify the GUI that we are done with the interaction window and it
    can close it. */
 
-void (*readline_begin_hook) PARAMS ((char *,...));
-char *(*readline_hook) PARAMS ((char *));
-void (*readline_end_hook) PARAMS ((void));
+void (*readline_begin_hook) (char *, ...);
+char *(*readline_hook) (char *);
+void (*readline_end_hook) (void);
 
 /* Called as appropriate to notify the interface of the specified breakpoint
    conditions.  */
 
-void (*create_breakpoint_hook) PARAMS ((struct breakpoint * bpt));
-void (*delete_breakpoint_hook) PARAMS ((struct breakpoint * bpt));
-void (*modify_breakpoint_hook) PARAMS ((struct breakpoint * bpt));
+void (*create_breakpoint_hook) (struct breakpoint * bpt);
+void (*delete_breakpoint_hook) (struct breakpoint * bpt);
+void (*modify_breakpoint_hook) (struct breakpoint * bpt);
 
 /* Called as appropriate to notify the interface that we have attached
    to or detached from an already running process. */
 
-void (*attach_hook) PARAMS ((void));
-void (*detach_hook) PARAMS ((void));
+void (*attach_hook) (void);
+void (*detach_hook) (void);
 
 /* Called during long calculations to allow GUI to repair window damage, and to
    check for stop buttons, etc... */
 
-void (*interactive_hook) PARAMS ((void));
+void (*interactive_hook) (void);
 
 /* Called when the registers have changed, as a hint to a GUI
    to minimize window update. */
 
-void (*registers_changed_hook) PARAMS ((void));
+void (*registers_changed_hook) (void);
 
 /* Tell the GUI someone changed the register REGNO. -1 means
    that the caller does not know which register changed or
    that several registers have changed (see value_assign). */
-void (*register_changed_hook) PARAMS ((int regno));
+void (*register_changed_hook) (int regno);
 
 /* Tell the GUI someone changed LEN bytes of memory at ADDR */
-void (*memory_changed_hook) PARAMS ((CORE_ADDR addr, int len));
+void (*memory_changed_hook) (CORE_ADDR addr, int len);
 
 /* Called when going to wait for the target.  Usually allows the GUI to run
    while waiting for target events.  */
 
-int (*target_wait_hook) PARAMS ((int pid, struct target_waitstatus * status));
+int (*target_wait_hook) (int pid, struct target_waitstatus * status);
 
 /* Used by UI as a wrapper around command execution.  May do various things
    like enabling/disabling buttons, etc...  */
 
-void (*call_command_hook) PARAMS ((struct cmd_list_element * c, char *cmd,
-                                  int from_tty));
+void (*call_command_hook) (struct cmd_list_element * c, char *cmd,
+                          int from_tty);
 
 /* Called after a `set' command has finished.  Is only run if the
    `set' command succeeded.  */
@@ -481,7 +477,7 @@ void (*set_hook) (struct cmd_list_element * c);
 
 /* Called when the current thread changes.  Argument is thread id.  */
 
-void (*context_hook) PARAMS ((int id));
+void (*context_hook) (int id);
 
 /* Takes control from error ().  Typically used to prevent longjmps out of the
    middle of the GUI.  Usually used in conjunction with a catch routine.  */
@@ -507,8 +503,7 @@ static SIGJMP_BUF *catch_return;
 /* Return for reason REASON to the nearest containing catch_errors().  */
 
 NORETURN void
-return_to_top_level (reason)
-     enum return_reason reason;
+return_to_top_level (enum return_reason reason)
 {
   quit_flag = 0;
   immediate_quit = 0;
@@ -574,11 +569,8 @@ return_to_top_level (reason)
    between utils.c and top.c? */
 
 int
-catch_errors (func, args, errstring, mask)
-     catch_errors_ftype *func;
-     PTR args;
-     char *errstring;
-     return_mask mask;
+catch_errors (catch_errors_ftype *func, PTR args, char *errstring,
+             return_mask mask)
 {
   SIGJMP_BUF *saved_catch;
   SIGJMP_BUF catch;
@@ -704,8 +696,7 @@ catch_command_errors (catch_command_errors_ftype * command,
 
 #ifdef SIGHUP
 static void
-disconnect (signo)
-     int signo;
+disconnect (int signo)
 {
   catch_errors (quit_cover, NULL,
              "Could not kill the program being debugged", RETURN_MASK_ALL);
@@ -719,8 +710,7 @@ disconnect (signo)
    gdb to use the event loop as the default command loop and we merge
    event-top.c into this file, top.c */
 /* static */ int
-quit_cover (s)
-     PTR s;
+quit_cover (PTR s)
 {
   caution = 0;                 /* Throw caution to the wind -- we're exiting.
                                   This prevents asking the user dumb questions.  */
@@ -760,8 +750,7 @@ static int source_error_allocated;
    user-defined command).  */
 
 static void
-source_cleanup (stream)
-     FILE *stream;
+do_restore_instream_cleanup (void *stream)
 {
   /* Restore the previous input stream.  */
   instream = stream;
@@ -769,24 +758,31 @@ source_cleanup (stream)
 
 /* Read commands from STREAM.  */
 void
-read_command_file (stream)
-     FILE *stream;
+read_command_file (FILE *stream)
 {
   struct cleanup *cleanups;
 
-  cleanups = make_cleanup ((make_cleanup_func) source_cleanup, instream);
+  cleanups = make_cleanup (do_restore_instream_cleanup, instream);
   instream = stream;
   command_loop ();
   do_cleanups (cleanups);
 }
 \f
-extern void init_proc PARAMS ((void));
+extern void init_proc (void);
 
-void (*pre_init_ui_hook) PARAMS ((void));
+void (*pre_init_ui_hook) (void);
+
+#ifdef __MSDOS__
+void
+do_chdir_cleanup (void *old_dir)
+{
+  chdir (old_dir);
+  free (old_dir);
+}
+#endif
 
 void
-gdb_init (argv0)
-     char *argv0;
+gdb_init (char *argv0)
 {
   if (pre_init_ui_hook)
     pre_init_ui_hook ();
@@ -799,7 +795,7 @@ gdb_init (argv0)
 #ifdef __MSDOS__
   /* Make sure we return to the original directory upon exit, come
      what may, since the OS doesn't do that for us.  */
-  make_final_cleanup ((make_cleanup_func) chdir, strsave (current_directory));
+  make_final_cleanup (do_chdir_cleanup, xstrdup (current_directory));
 #endif
 
   init_cmd_lists ();           /* This needs to be done first */
@@ -848,9 +844,7 @@ gdb_init (argv0)
    control commands (if/while).  */
 
 static struct command_line *
-build_command_line (type, args)
-     enum command_control_type type;
-     char *args;
+build_command_line (enum command_control_type type, char *args)
 {
   struct command_line *cmd;
 
@@ -874,9 +868,7 @@ build_command_line (type, args)
    such as "if" and "while".  */
 
 static struct command_line *
-get_command_line (type, arg)
-     enum command_control_type type;
-     char *arg;
+get_command_line (enum command_control_type type, char *arg)
 {
   struct command_line *cmd;
   struct cleanup *old_chain = NULL;
@@ -884,7 +876,7 @@ get_command_line (type, arg)
   /* Allocate and build a new command line structure.  */
   cmd = build_command_line (type, arg);
 
-  old_chain = make_cleanup ((make_cleanup_func) free_command_lines, &cmd);
+  old_chain = make_cleanup_free_command_lines (&cmd);
 
   /* Read in the body of this command.  */
   if (recurse_read_control_structure (cmd) == invalid_control)
@@ -901,10 +893,8 @@ get_command_line (type, arg)
 /* Recursively print a command (including full control structures).  */
 #ifdef UI_OUT
 void
-print_command_lines (uiout, cmd, depth)
-     struct ui_out *uiout;
-     struct command_line *cmd;
-     unsigned int depth;
+print_command_lines (struct ui_out *uiout, struct command_line *cmd,
+                    unsigned int depth)
 {
   struct command_line *list;
 
@@ -991,10 +981,8 @@ print_command_lines (uiout, cmd, depth)
 }
 #else
 void
-print_command_line (cmd, depth, stream)
-     struct command_line *cmd;
-     unsigned int depth;
-     struct ui_file *stream;
+print_command_line (struct command_line *cmd, unsigned int depth,
+                   struct ui_file *stream)
 {
   unsigned int i;
 
@@ -1075,8 +1063,7 @@ print_command_line (cmd, depth, stream)
 /* Execute the command in CMD.  */
 
 enum command_control_type
-execute_control_command (cmd)
-     struct command_line *cmd;
+execute_control_command (struct command_line *cmd)
 {
   struct expression *expr;
   struct command_line *current;
@@ -1094,8 +1081,7 @@ execute_control_command (cmd)
       new_line = insert_args (cmd->line);
       if (!new_line)
        return invalid_control;
-      old_chain = make_cleanup ((make_cleanup_func) free_current_contents,
-                               &new_line);
+      old_chain = make_cleanup (free_current_contents, &new_line);
       execute_command (new_line, 0);
       ret = cmd->control_type;
       break;
@@ -1113,10 +1099,9 @@ execute_control_command (cmd)
        new_line = insert_args (cmd->line);
        if (!new_line)
          return invalid_control;
-       old_chain = make_cleanup ((make_cleanup_func) free_current_contents,
-                                 &new_line);
+       old_chain = make_cleanup (free_current_contents, &new_line);
        expr = parse_expression (new_line);
-       make_cleanup ((make_cleanup_func) free_current_contents, &expr);
+       make_cleanup (free_current_contents, &expr);
 
        ret = simple_control;
        loop = 1;
@@ -1174,11 +1159,10 @@ execute_control_command (cmd)
        new_line = insert_args (cmd->line);
        if (!new_line)
          return invalid_control;
-       old_chain = make_cleanup ((make_cleanup_func) free_current_contents,
-                                 &new_line);
+       old_chain = make_cleanup (free_current_contents, &new_line);
        /* Parse the conditional for the if statement.  */
        expr = parse_expression (new_line);
-       make_cleanup ((make_cleanup_func) free_current_contents, &expr);
+       make_cleanup (free_current_contents, &expr);
 
        current = NULL;
        ret = simple_control;
@@ -1226,9 +1210,7 @@ execute_control_command (cmd)
    loop condition is nonzero.  */
 
 static void
-while_command (arg, from_tty)
-     char *arg;
-     int from_tty;
+while_command (char *arg, int from_tty)
 {
   struct command_line *command = NULL;
 
@@ -1246,9 +1228,7 @@ while_command (arg, from_tty)
    on the value of the if conditional.  */
 
 static void
-if_command (arg, from_tty)
-     char *arg;
-     int from_tty;
+if_command (char *arg, int from_tty)
 {
   struct command_line *command = NULL;
 
@@ -1264,7 +1244,7 @@ if_command (arg, from_tty)
 
 /* Cleanup */
 static void
-arg_cleanup ()
+arg_cleanup (void *ignore)
 {
   struct user_args *oargs = user_args;
   if (!user_args)
@@ -1278,8 +1258,7 @@ arg_cleanup ()
    $arg0, $arg1 ... $argMAXUSERARGS.  */
 
 static struct cleanup *
-setup_user_args (p)
-     char *p;
+setup_user_args (char *p)
 {
   struct user_args *args;
   struct cleanup *old_chain;
@@ -1291,7 +1270,7 @@ setup_user_args (p)
   args->next = user_args;
   user_args = args;
 
-  old_chain = make_cleanup ((make_cleanup_func) arg_cleanup, 0);
+  old_chain = make_cleanup (arg_cleanup, 0/*ignored*/);
 
   if (p == NULL)
     return old_chain;
@@ -1361,8 +1340,7 @@ setup_user_args (p)
    or NULL if P contains no arguments.  */
 
 static char *
-locate_arg (p)
-     char *p;
+locate_arg (char *p)
 {
   while ((p = strchr (p, '$')))
     {
@@ -1377,8 +1355,7 @@ locate_arg (p)
    arguments found in line, with the updated copy being placed into nline.  */
 
 static char *
-insert_args (line)
-     char *line;
+insert_args (char *line)
 {
   char *p, *save_line, *new_line;
   unsigned len, i;
@@ -1438,9 +1415,7 @@ insert_args (line)
 }
 
 void
-execute_user_command (c, args)
-     struct cmd_list_element *c;
-     char *args;
+execute_user_command (struct cmd_list_element *c, char *args)
 {
   register struct command_line *cmdlines;
   struct cleanup *old_chain;
@@ -1455,7 +1430,7 @@ execute_user_command (c, args)
 
   /* Set the instream to 0, indicating execution of a
      user-defined function.  */
-  old_chain = make_cleanup ((make_cleanup_func) source_cleanup, instream);
+  old_chain = make_cleanup (do_restore_instream_cleanup, instream);
   instream = (FILE *) 0;
   while (cmdlines)
     {
@@ -1474,16 +1449,14 @@ execute_user_command (c, args)
    Pass FROM_TTY as second argument to the defining function.  */
 
 void
-execute_command (p, from_tty)
-     char *p;
-     int from_tty;
+execute_command (char *p, int from_tty)
 {
   register struct cmd_list_element *c;
   register enum language flang;
   static int warned = 0;
   char *line;
   /* FIXME: These should really be in an appropriate header file */
-  extern void serial_log_command PARAMS ((const char *));
+extern void serial_log_command (const char *);
 
   free_all_values ();
 
@@ -1575,21 +1548,11 @@ execute_command (p, from_tty)
     }
 }
 
-/* ARGSUSED */
-/* NOTE 1999-04-29: This function will be static again, once we modify
-   gdb to use the event loop as the default command loop and we merge
-   event-top.c into this file, top.c */
-/* static */ void
-command_loop_marker (foo)
-     int foo;
-{
-}
-
 /* Read commands from `instream' and execute them
    until end of file or error reading instream.  */
 
 void
-command_loop ()
+command_loop (void)
 {
   struct cleanup *old_chain;
   char *command;
@@ -1612,7 +1575,7 @@ command_loop ()
       quit_flag = 0;
       if (instream == stdin && stdin_is_tty)
        reinitialize_more_filter ();
-      old_chain = make_cleanup ((make_cleanup_func) command_loop_marker, 0);
+      old_chain = make_cleanup (null_cleanup, 0);
 
 #if defined(TUI)
       /* A bit of paranoia: I want to make sure the "insert_mode" global
@@ -1693,7 +1656,7 @@ simplified_command_loop (read_input_func, execute_command_func)
       quit_flag = 0;
       if (instream == stdin && stdin_is_tty)
        reinitialize_more_filter ();
-      old_chain = make_cleanup ((make_cleanup_func) command_loop_marker, 0);
+      old_chain = make_cleanup (null_cleanup, 0);
 
       /* Get a command-line. */
       command = (*read_input_func) (instream == stdin ?
@@ -1714,7 +1677,7 @@ simplified_command_loop (read_input_func, execute_command_func)
 /* Commands call this if they do not want to be repeated by null lines.  */
 
 void
-dont_repeat ()
+dont_repeat (void)
 {
   if (server_command)
     return;
@@ -1734,8 +1697,7 @@ dont_repeat ()
 
    A NULL return means end of file.  */
 char *
-gdb_readline (prompt_arg)
-     char *prompt_arg;
+gdb_readline (char *prompt_arg)
 {
   int c;
   char *result;
@@ -1833,6 +1795,12 @@ char *gdb_completer_word_break_characters =
 char *gdb_completer_command_word_break_characters =
 " \t\n!@#$%^&*()+=|~`}{[]\"';:?/>.<,";
 
+/* When completing on file names, we remove from the list of word
+   break characters any characters that are commonly used in file
+   names, such as '-', '+', '~', etc.  Otherwise, readline displays
+   incorrect completion candidates.  */
+char *gdb_completer_file_name_break_characters = " \t\n*|\"';:?/><";
+
 /* Characters that can be used to quote completion strings.  Note that we
    can't include '"' because the gdb C parser treats such quoted sequences
    as strings. */
@@ -1845,21 +1813,17 @@ char *gdb_completer_quote_characters =
    but don't want to complete on anything else either.  */
 /* ARGSUSED */
 char **
-noop_completer (text, prefix)
-     char *text;
-     char *prefix;
+noop_completer (char *text, char *prefix)
 {
   return NULL;
 }
 
 /* Complete on filenames.  */
 char **
-filename_completer (text, word)
-     char *text;
-     char *word;
+filename_completer (char *text, char *word)
 {
   /* From readline.  */
-  extern char *filename_completion_function PARAMS ((char *, int));
+extern char *filename_completion_function (char *, int);
   int subsequent_name;
   char **return_val;
   int return_val_used;
@@ -1887,6 +1851,11 @@ filename_completer (text, word)
          return_val[return_val_used++] = p;
          break;
        }
+      /* We need to set subsequent_name to a non-zero value before the
+        continue line below, because otherwise, if the first file seen
+        by GDB is a backup file whose name ends in a `~', we will loop
+        indefinitely.  */
+      subsequent_name = 1;
       /* Like emacs, don't complete on old versions.  Especially useful
          in the "source" command.  */
       if (p[strlen (p) - 1] == '~')
@@ -1916,7 +1885,6 @@ filename_completer (text, word)
            free (p);
          }
       }
-      subsequent_name = 1;
     }
 #if 0
   /* There is no way to do this just long enough to affect quote inserting
@@ -1973,11 +1941,7 @@ filename_completer (text, word)
    free the string.  */
 
 static char *
-line_completion_function (text, matches, line_buffer, point)
-     char *text;
-     int matches;
-     char *line_buffer;
-     int point;
+line_completion_function (char *text, int matches, char *line_buffer, int point)
 {
   static char **list = (char **) NULL; /* Cache of completions */
   static int index;            /* Next cached completion */
@@ -2118,6 +2082,9 @@ line_completion_function (text, matches, line_buffer, point)
                      /* It is a normal command; what comes after it is
                         completed by the command's completer function.  */
                      list = (*c->completer) (p, word);
+                     if (c->completer == filename_completer)
+                       rl_completer_word_break_characters =
+                         gdb_completer_file_name_break_characters;
                    }
                }
              else
@@ -2164,6 +2131,9 @@ line_completion_function (text, matches, line_buffer, point)
                {
                  /* It is a normal command.  */
                  list = (*c->completer) (p, word);
+                 if (c->completer == filename_completer)
+                   rl_completer_word_break_characters =
+                     gdb_completer_file_name_break_characters;
                }
            }
        }
@@ -2200,9 +2170,7 @@ line_completion_function (text, matches, line_buffer, point)
 /* Line completion interface function for readline.  */
 
 static char *
-readline_line_completion_function (text, matches)
-     char *text;
-     int matches;
+readline_line_completion_function (char *text, int matches)
 {
   return line_completion_function (text, matches, rl_line_buffer, rl_point);
 }
@@ -2212,8 +2180,7 @@ readline_line_completion_function (text, matches)
    location after the "word". */
 
 char *
-skip_quoted (str)
-     char *str;
+skip_quoted (char *str)
 {
   char quote_char = '\0';
   char *scan;
@@ -2246,8 +2213,7 @@ skip_quoted (str)
 
 #ifdef STOP_SIGNAL
 static void
-stop_sig (signo)
-     int signo;
+stop_sig (int signo)
 {
 #if STOP_SIGNAL == SIGTSTP
   signal (SIGTSTP, SIG_DFL);
@@ -2267,8 +2233,7 @@ stop_sig (signo)
 
 /* Initialize signal handlers. */
 static void
-do_nothing (signo)
-     int signo;
+do_nothing (int signo)
 {
   /* Under System V the default disposition of a signal is reinstated after
      the signal is caught and delivered to an application process.  On such
@@ -2280,7 +2245,7 @@ do_nothing (signo)
 }
 
 static void
-init_signals ()
+init_signals (void)
 {
   signal (SIGINT, request_quit);
 
@@ -2326,10 +2291,7 @@ init_signals ()
    simple input as the user has requested.  */
 
 char *
-command_line_input (prompt_arg, repeat, annotation_suffix)
-     char *prompt_arg;
-     int repeat;
-     char *annotation_suffix;
+command_line_input (char *prompt_arg, int repeat, char *annotation_suffix)
 {
   static char *linebuffer = 0;
   static unsigned linelength = 0;
@@ -2551,9 +2513,7 @@ command_line_input (prompt_arg, repeat, annotation_suffix)
    clause for an "if" command.  */
 
 static void
-realloc_body_list (command, new_length)
-     struct command_line *command;
-     int new_length;
+realloc_body_list (struct command_line *command, int new_length)
 {
   int n;
   struct command_line **body_list;
@@ -2578,8 +2538,7 @@ realloc_body_list (command, new_length)
    "end", return such an indication to the caller.  */
 
 static enum misc_command_type
-read_next_line (command)
-     struct command_line **command;
+read_next_line (struct command_line **command)
 {
   char *p, *p1, *prompt_ptr, control_prompt[256];
   int i = 0;
@@ -2676,8 +2635,7 @@ read_next_line (command)
    following commands are nested.  */
 
 static enum command_control_type
-recurse_read_control_structure (current_cmd)
-     struct command_line *current_cmd;
+recurse_read_control_structure (struct command_line *current_cmd)
 {
   int current_body, i;
   enum misc_command_type val;
@@ -2789,9 +2747,7 @@ recurse_read_control_structure (current_cmd)
 #define END_MESSAGE "End with a line saying just \"end\"."
 
 struct command_line *
-read_command_lines (prompt_arg, from_tty)
-     char *prompt_arg;
-     int from_tty;
+read_command_lines (char *prompt_arg, int from_tty)
 {
   struct command_line *head, *tail, *next;
   struct cleanup *old_chain;
@@ -2851,8 +2807,7 @@ read_command_lines (prompt_arg, from_tty)
       else
        {
          head = next;
-         old_chain = make_cleanup ((make_cleanup_func) free_command_lines,
-                                   &head);
+         old_chain = make_cleanup_free_command_lines (&head);
        }
       tail = next;
     }
@@ -2879,8 +2834,7 @@ read_command_lines (prompt_arg, from_tty)
 /* Free a chain of struct command_line's.  */
 
 void
-free_command_lines (lptr)
-     struct command_line **lptr;
+free_command_lines (struct command_line **lptr)
 {
   register struct command_line *l = *lptr;
   register struct command_line *next;
@@ -2901,13 +2855,25 @@ free_command_lines (lptr)
       l = next;
     }
 }
+
+static void
+do_free_command_lines_cleanup (void *arg)
+{
+  free_command_lines (arg);
+}
+
+static struct cleanup *
+make_cleanup_free_command_lines (struct command_line **arg)
+{
+  return make_cleanup (do_free_command_lines_cleanup, arg);
+}
 \f
 /* Add an element to the list of info subcommands.  */
 
 struct cmd_list_element *
 add_info (name, fun, doc)
      char *name;
-     void (*fun) PARAMS ((char *, int));
+     void (*fun) (char *, int);
      char *doc;
 {
   return add_cmd (name, no_class, fun, doc, &infolist);
@@ -2916,10 +2882,7 @@ add_info (name, fun, doc)
 /* Add an alias to the list of info subcommands.  */
 
 struct cmd_list_element *
-add_info_alias (name, oldname, abbrev_flag)
-     char *name;
-     char *oldname;
-     int abbrev_flag;
+add_info_alias (char *name, char *oldname, int abbrev_flag)
 {
   return add_alias_cmd (name, oldname, 0, abbrev_flag, &infolist);
 }
@@ -2929,9 +2892,7 @@ add_info_alias (name, oldname, abbrev_flag)
 
 /* ARGSUSED */
 static void
-info_command (arg, from_tty)
-     char *arg;
-     int from_tty;
+info_command (char *arg, int from_tty)
 {
   printf_unfiltered ("\"info\" must be followed by the name of an info command.\n");
   help_list (infolist, "info ", -1, gdb_stdout);
@@ -2941,9 +2902,7 @@ info_command (arg, from_tty)
 
 /* ARGSUSED */
 static void
-complete_command (arg, from_tty)
-     char *arg;
-     int from_tty;
+complete_command (char *arg, int from_tty)
 {
   int i;
   int argpoint;
@@ -2968,9 +2927,7 @@ complete_command (arg, from_tty)
 
 /* ARGSUSED */
 static void
-show_command (arg, from_tty)
-     char *arg;
-     int from_tty;
+show_command (char *arg, int from_tty)
 {
   cmd_show_list (showlist, from_tty, "");
 }
@@ -2981,7 +2938,7 @@ struct cmd_list_element *
 add_com (name, class, fun, doc)
      char *name;
      enum command_class class;
-     void (*fun) PARAMS ((char *, int));
+     void (*fun) (char *, int);
      char *doc;
 {
   return add_cmd (name, class, fun, doc, &cmdlist);
@@ -2990,18 +2947,14 @@ add_com (name, class, fun, doc)
 /* Add an alias or abbreviation command to the list of commands.  */
 
 struct cmd_list_element *
-add_com_alias (name, oldname, class, abbrev_flag)
-     char *name;
-     char *oldname;
-     enum command_class class;
-     int abbrev_flag;
+add_com_alias (char *name, char *oldname, enum command_class class,
+              int abbrev_flag)
 {
   return add_alias_cmd (name, oldname, class, abbrev_flag, &cmdlist);
 }
 
 void
-error_no_arg (why)
-     char *why;
+error_no_arg (char *why)
 {
   error ("Argument required (%s).", why);
 }
@@ -3016,8 +2969,7 @@ help_command (command, from_tty)
 }
 \f
 static void
-validate_comname (comname)
-     char *comname;
+validate_comname (char *comname)
 {
   register char *p;
 
@@ -3035,16 +2987,12 @@ validate_comname (comname)
 
 /* This is just a placeholder in the command data structures.  */
 static void
-user_defined_command (ignore, from_tty)
-     char *ignore;
-     int from_tty;
+user_defined_command (char *ignore, int from_tty)
 {
 }
 
 static void
-define_command (comname, from_tty)
-     char *comname;
-     int from_tty;
+define_command (char *comname, int from_tty)
 {
   register struct command_line *cmds;
   register struct cmd_list_element *c, *newc, *hookc = 0;
@@ -3119,9 +3067,7 @@ define_command (comname, from_tty)
 }
 
 static void
-document_command (comname, from_tty)
-     char *comname;
-     int from_tty;
+document_command (char *comname, int from_tty)
 {
   struct command_line *doclines;
   register struct cmd_list_element *c;
@@ -3164,8 +3110,7 @@ document_command (comname, from_tty)
 \f
 /* Print the GDB banner. */
 void
-print_gdb_version (stream)
-     struct ui_file *stream;
+print_gdb_version (struct ui_file *stream)
 {
   /* From GNU coding standards, first line is meant to be easy for a
      program to parse, and is just canonical program name and version
@@ -3209,9 +3154,7 @@ There is absolutely no warranty for GDB.  Type \"show warranty\" for details.\n"
 
 /* ARGSUSED */
 static void
-show_version (args, from_tty)
-     char *args;
-     int from_tty;
+show_version (char *args, int from_tty)
 {
   immediate_quit++;
   print_gdb_version (gdb_stdout);
@@ -3236,9 +3179,9 @@ show_version (args, from_tty)
 static int gdb_prompt_escape;
 
 static int
-get_prompt_1 (formatted_prompt)
-     char *formatted_prompt;
+get_prompt_1 (void *data)
 {
+  char *formatted_prompt = data;
   char *local_prompt;
 
   if (event_loop_p)
@@ -3465,7 +3408,7 @@ get_prompt_1 (formatted_prompt)
 }
 
 char *
-get_prompt ()
+get_prompt (void)
 {
   static char buf[MAX_PROMPT_SIZE];
 
@@ -3485,8 +3428,7 @@ get_prompt ()
 }
 
 void
-set_prompt (s)
-     char *s;
+set_prompt (char *s)
 {
 /* ??rehrauer: I don't know why this fails, since it looks as though
    assignments to prompt are wrapped in calls to savestring...
@@ -3504,7 +3446,7 @@ set_prompt (s)
    non-zero if we should quit, zero if we shouldn't.  */
 
 int
-quit_confirm ()
+quit_confirm (void)
 {
   if (inferior_pid != 0 && target_has_execution)
     {
@@ -3530,9 +3472,7 @@ quit_confirm ()
 /* Quit without asking for confirmation.  */
 
 void
-quit_force (args, from_tty)
-     char *args;
-     int from_tty;
+quit_force (char *args, int from_tty)
 {
   int exit_code = 0;
 
@@ -3578,9 +3518,7 @@ quit_force (args, from_tty)
 /* Handle the quit command.  */
 
 void
-quit_command (args, from_tty)
-     char *args;
-     int from_tty;
+quit_command (char *args, int from_tty)
 {
   if (!quit_confirm ())
     error ("Not confirmed.");
@@ -3591,16 +3529,14 @@ quit_command (args, from_tty)
    desires that questions be asked of them on that terminal.  */
 
 int
-input_from_terminal_p ()
+input_from_terminal_p (void)
 {
   return gdb_has_a_terminal () && (instream == stdin) & caution;
 }
 \f
 /* ARGSUSED */
 static void
-pwd_command (args, from_tty)
-     char *args;
-     int from_tty;
+pwd_command (char *args, int from_tty)
 {
   if (args)
     error ("The \"pwd\" command does not take an argument: %s", args);
@@ -3614,9 +3550,7 @@ pwd_command (args, from_tty)
 }
 
 void
-cd_command (dir, from_tty)
-     char *dir;
-     int from_tty;
+cd_command (char *dir, int from_tty)
 {
   int len;
   /* Found something other than leading repetitions of "/..".  */
@@ -3723,8 +3657,7 @@ struct source_cleanup_lines_args
 };
 
 static void
-source_cleanup_lines (args)
-     PTR args;
+source_cleanup_lines (PTR args)
 {
   struct source_cleanup_lines_args *p =
   (struct source_cleanup_lines_args *) args;
@@ -3735,10 +3668,14 @@ source_cleanup_lines (args)
 }
 
 /* ARGSUSED */
+static void
+do_fclose_cleanup (void *stream)
+{
+  fclose (stream);
+}
+
 void
-source_command (args, from_tty)
-     char *args;
-     int from_tty;
+source_command (char *args, int from_tty)
 {
   FILE *stream;
   struct cleanup *old_cleanups;
@@ -3763,7 +3700,7 @@ source_command (args, from_tty)
        return;
     }
 
-  make_cleanup ((make_cleanup_func) fclose, stream);
+  make_cleanup (do_fclose_cleanup, stream);
 
   old_lines.old_line = source_line_number;
   old_lines.old_file = source_file_name;
@@ -3798,9 +3735,7 @@ source_command (args, from_tty)
 
 /* ARGSUSED */
 static void
-echo_command (text, from_tty)
-     char *text;
-     int from_tty;
+echo_command (char *text, int from_tty)
 {
   char *p = text;
   register int c;
@@ -3830,9 +3765,7 @@ echo_command (text, from_tty)
 
 /* ARGSUSED */
 static void
-dont_repeat_command (ignored, from_tty)
-     char *ignored;
-     int from_tty;
+dont_repeat_command (char *ignored, int from_tty)
 {
   *line = 0;                   /* Can't call dont_repeat here because we're not
                                   necessarily reading from stdin.  */
@@ -3843,9 +3776,7 @@ dont_repeat_command (ignored, from_tty)
 /* Number of commands to print in each call to show_commands.  */
 #define Hist_print 10
 static void
-show_commands (args, from_tty)
-     char *args;
-     int from_tty;
+show_commands (char *args, int from_tty)
 {
   /* Index for history commands.  Relative to history_base.  */
   int offset;
@@ -3858,7 +3789,7 @@ show_commands (args, from_tty)
      than the number of the last command).  Relative to history_base.  */
   int hist_len;
 
-  extern HIST_ENTRY *history_get PARAMS ((int));
+extern HIST_ENTRY *history_get (int);
 
   /* Print out some of the commands from the command history.  */
   /* First determine the length of the history list.  */
@@ -3922,10 +3853,7 @@ show_commands (args, from_tty)
 /* Called by do_setshow_command.  */
 /* ARGSUSED */
 static void
-set_history_size_command (args, from_tty, c)
-     char *args;
-     int from_tty;
-     struct cmd_list_element *c;
+set_history_size_command (char *args, int from_tty, struct cmd_list_element *c)
 {
   if (history_size == INT_MAX)
     unstifle_history ();
@@ -3940,9 +3868,7 @@ set_history_size_command (args, from_tty, c)
 
 /* ARGSUSED */
 static void
-set_history (args, from_tty)
-     char *args;
-     int from_tty;
+set_history (char *args, int from_tty)
 {
   printf_unfiltered ("\"set history\" must be followed by the name of a history subcommand.\n");
   help_list (sethistlist, "set history ", -1, gdb_stdout);
@@ -3950,9 +3876,7 @@ set_history (args, from_tty)
 
 /* ARGSUSED */
 static void
-show_history (args, from_tty)
-     char *args;
-     int from_tty;
+show_history (char *args, int from_tty)
 {
   cmd_show_list (showhistlist, from_tty, "");
 }
@@ -3962,10 +3886,7 @@ int info_verbose = 0;            /* Default verbose msgs off */
 /* Called by do_setshow_command.  An elaborate joke.  */
 /* ARGSUSED */
 static void
-set_verbose (args, from_tty, c)
-     char *args;
-     int from_tty;
-     struct cmd_list_element *c;
+set_verbose (char *args, int from_tty, struct cmd_list_element *c)
 {
   char *cmdname = "verbose";
   struct cmd_list_element *showcmd;
@@ -3985,8 +3906,7 @@ set_verbose (args, from_tty, c)
 }
 
 static void
-float_handler (signo)
-     int signo;
+float_handler (int signo)
 {
   /* This message is based on ANSI C, section 4.7.  Note that integer
      divide by zero causes this, so "float" is a misnomer.  */
@@ -3995,24 +3915,20 @@ float_handler (signo)
 }
 
 static void
-set_debug (arg, from_tty)
-     char *arg;
-     int from_tty;
+set_debug (char *arg, int from_tty)
 {
   printf_unfiltered ("\"set debug\" must be followed by the name of a print subcommand.\n");
   help_list (setdebuglist, "set debug ", -1, gdb_stdout);
 }
 
 static void
-show_debug (args, from_tty)
-     char *args;
-     int from_tty;
+show_debug (char *args, int from_tty)
 {
   cmd_show_list (showdebuglist, from_tty, "");
 }
 
 static void
-init_cmd_lists ()
+init_cmd_lists (void)
 {
   cmdlist = NULL;
   infolist = NULL;
@@ -4044,7 +3960,7 @@ init_cmd_lists ()
  */
 
 void
-init_history ()
+init_history (void)
 {
   char *tmpenv;
 
@@ -4075,7 +3991,7 @@ init_history ()
 }
 
 static void
-init_main ()
+init_main (void)
 {
   struct cmd_list_element *c;
 
This page took 0.04196 seconds and 4 git commands to generate.