2009/1/17 Eli Zaretskii : >> Date: Fri, 16 Jan 2009 20:08:06 -0200 >> From: Alfredo Ortega >> Cc: gdb-patches@sourceware.org >> >> gcc will complain about tmpnamp() like this: >> >> test.c:(.text+0x13): warning: the use of `tempnam' is dangerous, >> better use `mkstemp' > > You say "tmpnam ()", but the GCC message is for `tempnam'. Which one > is it? These are different functions. > You are right, I screwed with the test, but the error is the same: /home/alfred/gdb/gdb-6.8/src/gdb/breakpoint.c:609: warning: the use of `tmpnam' is dangerous, better use `mkstemp' I'm posting my latest patch, there are multiple changes: 1) Following the suggestion of Tom Tromey, i made "commands" a prefix command, and now it is "commands edit n". The change is still backwards compatible. (Didn't made it to auto-complete like other commands...need to read a little on how to do this) 2) Now there is a "set external-editor" and "show external-editor", this variable has precedence over the "EDITOR" environment variable, (If not set, GDB follows the old behavior with "EDITOR" and "/bin/ex") 3) There is a external_editor() utility function in utils.c that one should call if needing an external text editor. 4) Following the suggestions of Eli, now I use an auxiliary function of libiberty for temporary file generation, all strings are dynamic and there is much better error reporting. This is a much better patch, but also is a much bigger one (I already sent the FSF form that Tom suggested), so surely there are plenty of errors. Corrections are welcomed. Regards, Alfredo 2009-01-16 Alfredo Ortega * breakpoint.c (commands_command,_initialize_breakpoint): Add the 'edit' keyword to the 'commands' command to allow the use of an external editor to add or modify commands. * utils.c,defs.h (external_editor,initialize_utils): Added an utility function to return the external text editor of the system. Added "set external-editor" and "show external-editor" commands to set/show the external editor variable 2009-01-16 Alfredo Ortega * gdb.texinfo, refcard.tex (breakpoint commands, set external-editor, show external-editor): Added documentation of the edit option, for editing commands with an external editor. Also, added a brief description of the "set external-editor" and "show external-editor" commands.