[Cgdb-devel] -d parameter fix and enhancement
Brought to you by:
bobbybrasko,
crouchingturbo
From: Horst S. <ho...@sc...> - 2006-08-02 17:36:35
|
Re-sending my previous patch, which now - patches SVN HEAD (r830) - modifies cgdb/src/usage.c instead of the autogenerated cgdb.1 cgdb.c | 13 ++++++++++++- usage.c | 3 ++- 2 files changed, 14 insertions(+), 2 deletions(-) Index: cgdb/src/cgdb.c =================================================================== --- cgdb/src/cgdb.c (revision 830) +++ cgdb/src/cgdb.c (working copy) @@ -719,7 +719,13 @@ exit (0); case 'd': debugger_path = strdup (optarg); - n += 2; + if (optarg == (*argv)[n + 1]) { + /* optarg is in next argv (-d foo) */ + n += 2; + } else { + /* optarg is in this argv (-dfoo) */ + n++; + } break; case 'h': usage (); @@ -731,6 +737,11 @@ *argc -= n; *argv += n; + + if (strcmp(**argv, "--") == 0) { + (*argc)--; + (*argv)++; + } } /* init_home_dir: Attempts to create a config directory in the user's home Index: cgdb/src/usage.c =================================================================== --- cgdb/src/usage.c (revision 830) +++ cgdb/src/usage.c (working copy) @@ -13,7 +13,7 @@ { printf( "CGDB Usage:\n" -" cgdb [cgdb options] [gdb options]\n" +" cgdb [cgdb options] [--] [gdb options]\n" "\n" "CGDB Options:\n" #ifdef HAVE_GETOPT_H @@ -27,5 +27,6 @@ " -h Print help (this message) and then exit.\n" #endif " -d Set debugger to use.\n" +" -- Separator to avoid ambiguities between gdb and cgdb options.\n" ); } -- PGP-Key 0xD40E0E7A |