Elena Zannoni wrote: > > J. Johnston writes: > > The following solves a number of problems with the mi -environment commands. > > For starters, each command now has an mi cmd wrapper so arguments may use the > > syntax of adding double-quotes to handle extraneous characters such as spaces. > > > > The -environment-pwd command now lists the output in mi syntax: > > > > e.g. > > -environment-pwd > > ^done,cwd="...." > > > > The -environment-directory command has been changed to output in mi format. > > It also has been changed to allow for no arguments being passed. > > If no arguments are passed, it behaves like the gdb dir command and resets the > > source search path to the default, however, no confirmation query is performed. If an empty > > string "" is passed, it is ignored so this can be used to display the current > > search path without modifying it. > > > > e.g. > > -environment-directory /usr/bin /usr/local/bin > > ^done,source-path="/usr/bin:/usr/local/bin:$cdir:$cwd" > > > > The -environment-path command has been changed to output in mi format. > > It also has been changed to allow for no arguments being passed. When > > no arguments are passed, the current object search path is displayed. > > > > e.g. > > -environment-path > > ^done,path="....." > > > > For mi1 or below, the previous behavior is preserved by rerouting the commands > > to their old cli counterparts. > > Hmmm, I think the testsuite changes are ok. Also the addition of the > new file is fine. However I don't think we should be duplicating the > mod_path() code. Would it be possible to maybe split mod_path() in 2 > or more functions, and have MI call one of them? > I mean > > mod_path() > { > do_cli_specific_stuff; > call add_path(args1); > .... > } > > mi_env_path() > { > do_mi_specific_stuff; > call add_path(args2); > ..... > } > > similarly for other code that may have been duplicated. > > Thanks > Elena I have taken your advice and have added a new interface: add_path which takes an additional argument. The mod_path() routine calls it one way, the mi code calls it another. Of the other code I copied, there is no value add in trying to make it common as I copied a few lines here and there. I found I had to modify the tilde_expand() prototype in defs.h to get my build working. I have a combined source tree and there was a conflict with tilde.h found in the readline directory. The defs.h prototype was not declaring the argument as const. Ok to commit? -- Jeff J. gdb/ChangeLog: 2002-11-07 Jeff Johnston * defs.h (init_last_source_visited): New prototype. (add_path): Ditto. (tilde_expand): Change prototype to const char * to match readline.h. * source.c (add_path): New function that adds to a specified path. (mod_path): Change to call add_path. (init_last_source_visited): New function to allow interfaces to initialize static variable: last_source_visited. gdb/mi/ChangeLog: 2002-11-07 Jeff Johnston * mi-cmds.c (-environment-directory) Change to use mi_cmd_env_dir, (-environment-cd): Change to use mi_cmd_env_cd,. (-environment-pwd): Change to use mi_cmd_env_pwd. (-environment-path): Change to use mi_cmd_env_path. * mi-cmds.h (mi_cmd_env_cd, mi_cmd_env_dir): New prototypes. (mi_cmd_env_path, mi_cmd_env_pwd): Ditto. * mi-cmd-env.c: New file. Part of fix for PR gdb/741. * gdbmi.texinfo (environment-cd): Update output and example. (environment-pwd): Ditto. (environment-dir): Update output, description, and examples. (environment-path): Ditto. gdb/testsuite/gdb.mi/ChangeLog: 2002-11-07 Jeff Johnston * mi-basics.exp: Change tests for -environment-directory. Also add tests for -environment-cd and -environment-pwd. Part of fix for PR gdb/741.