* language.c (set_language_command): Use languages table when

printing available languages.
This commit is contained in:
Tom Tromey
1996-02-05 20:50:26 +00:00
parent cb62d2bc1e
commit fc71ad23dd
2 changed files with 38 additions and 17 deletions

View File

@ -1,8 +1,16 @@
Sat Feb 3 10:45:10 1996 Fred Fish <fnf@cygnus.com>
Mon Feb 5 09:51:55 1996 Tom Tromey <tromey@creche.cygnus.com>
* exec.c (exec_file_command): Fix problem reported by Hans Verkuil
(hans@wyst.hobby.nl) where filename in malloc'd memory is referenced
after being freed.
* language.c (set_language_command): Use languages table when
printing available languages.
Sat Feb 3 12:22:05 1996 Fred Fish <fnf@cygnus.com>
Fix problems reported by Hans Verkuil (hans@wyst.hobby.nl):
* command.c (add_cmd): Add missing initialization for enums member.
Reorder members to match structure declaration to make it easier to
tell when one is missing.
* exec.c (exec_file_command): Fix problem where filename in malloc'd
memory is referenced after being freed.
Sat Feb 3 03:26:21 1996 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)

View File

@ -28,6 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
whenever the working language changes. That would be a lot faster. */
#include "defs.h"
#include <ctype.h>
#include "gdb_string.h"
#ifdef ANSI_PROTOTYPES
#include <stdarg.h>
@ -163,19 +164,31 @@ set_language_command (ignore, from_tty)
enum language flang;
char *err_lang;
/* FIXME -- do this from the list, with HELP. */
if (!language || !language[0]) {
printf_unfiltered("The currently understood settings are:\n\n");
printf_unfiltered ("local or auto Automatic setting based on source file\n");
printf_unfiltered ("c Use the C language\n");
printf_unfiltered ("c++ Use the C++ language\n");
printf_unfiltered ("chill Use the Chill language\n");
printf_unfiltered ("fortran Use the Fortran language\n");
printf_unfiltered ("modula-2 Use the Modula-2 language\n");
/* Restore the silly string. */
set_language(current_language->la_language);
return;
}
if (!language || !language[0])
{
printf_unfiltered("The currently understood settings are:\n\n");
printf_unfiltered ("local or auto Automatic setting based on source file\n");
for (i = 0; i < languages_size; ++i)
{
/* Already dealt with these above. */
if (languages[i]->la_language == language_unknown
|| languages[i]->la_language == language_auto)
continue;
/* FIXME for now assume that the human-readable name is just
a capitalization of the internal name. */
printf_unfiltered ("%-16s Use the %c%s language\n",
languages[i]->la_name,
/* Capitalize first letter of language
name. */
toupper (languages[i]->la_name[0]),
languages[i]->la_name + 1);
}
/* Restore the silly string. */
set_language(current_language->la_language);
return;
}
/* Search the list of languages for a match. */
for (i = 0; i < languages_size; i++) {