From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27038 invoked by alias); 8 Nov 2011 15:36:36 -0000 Received: (qmail 26926 invoked by uid 22791); 8 Nov 2011 15:36:35 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,TW_XD X-Spam-Check-By: sourceware.org Received: from mail-fx0-f41.google.com (HELO mail-fx0-f41.google.com) (209.85.161.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 08 Nov 2011 15:36:21 +0000 Received: by faaq16 with SMTP id q16so839673faa.0 for ; Tue, 08 Nov 2011 07:36:20 -0800 (PST) Received: by 10.223.87.211 with SMTP id x19mr55146050fal.8.1320766580229; Tue, 08 Nov 2011 07:36:20 -0800 (PST) MIME-Version: 1.0 Received: by 10.223.103.67 with HTTP; Tue, 8 Nov 2011 07:35:39 -0800 (PST) In-Reply-To: <20111108093759.279E3246194@ruffy.mtv.corp.google.com> References: <20111108093759.279E3246194@ruffy.mtv.corp.google.com> From: Hui Zhu Date: Tue, 08 Nov 2011 15:36:00 -0000 Message-ID: Subject: Re: [RFC] "New" command "!" To: Doug Evans Cc: gdb-patches@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-11/txt/msg00191.txt.bz2 Cool! Then cmdline can call shell cmd like ftp? That is great. Thanks, Hui On Tue, Nov 8, 2011 at 17:37, Doug Evans wrote: > Hi. > I mentioned this before in an offhand comment, > but now I'm submitting this RFC. > I'll add tests,docs,NEWS if the code part is ok. > > Am I missing something? > Is there a reason not to add this? > > 2011-11-08 =A0Doug Evans =A0 > > =A0 =A0 =A0 =A0New command "!", not just for xdb. > =A0 =A0 =A0 =A0* cli/cli-cmds.c (init_cli_cmds): Remove xdb_commands cond= ition on > =A0 =A0 =A0 =A0adding "!" command, always add it. > =A0 =A0 =A0 =A0* cli/cli-decode.c (find_command_name_length): Recognize "= !" as a > =A0 =A0 =A0 =A0command of length one. > > Index: cli/cli-cmds.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > RCS file: /cvs/src/src/gdb/cli/cli-cmds.c,v > retrieving revision 1.118 > diff -u -p -r1.118 cli-cmds.c > --- cli/cli-cmds.c =A0 =A0 =A01 Nov 2011 14:51:22 -0000 =A0 =A0 =A0 1.118 > +++ cli/cli-cmds.c =A0 =A0 =A08 Nov 2011 09:21:42 -0000 > @@ -1825,14 +1825,7 @@ Two arguments (separated by a comma) are > =A0 if (xdb_commands) > =A0 =A0 add_com_alias ("va", "disassemble", class_xdb, 0); > > - =A0/* NOTE: cagney/2000-03-20: Being able to enter ``(gdb) !ls'' would > - =A0 =A0 be a really useful feature. =A0Unfortunately, the below wont do > - =A0 =A0 this. =A0Instead it adds support for the form ``(gdb) ! ls'' > - =A0 =A0 (i.e. the space is required). =A0If the ``!'' command below is > - =A0 =A0 added the complains about no ``!'' command would be replaced by > - =A0 =A0 complains about how the ``!'' command is broken :-) =A0*/ > - =A0if (xdb_commands) > - =A0 =A0add_com_alias ("!", "shell", class_support, 0); > + =A0add_com_alias ("!", "shell", class_support, 0); > > =A0 c =3D add_com ("make", class_support, make_command, _("\ > =A0Run the ``make'' program using the rest of the line as arguments.")); > Index: cli/cli-decode.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > RCS file: /cvs/src/src/gdb/cli/cli-decode.c,v > retrieving revision 1.98 > diff -u -p -r1.98 cli-decode.c > --- cli/cli-decode.c =A0 =A09 Oct 2011 22:21:42 -0000 =A0 =A0 =A0 1.98 > +++ cli/cli-decode.c =A0 =A08 Nov 2011 09:30:22 -0000 > @@ -1127,11 +1127,16 @@ find_command_name_length (const char *te > =A0 =A0 =A0Note that this is larger than the character set allowed when > =A0 =A0 =A0creating user-defined commands. =A0*/ > > + =A0/* Recognize '!' as a single character command so that, e.g., "!ls" > + =A0 =A0 works as expected. =A0*/ > + =A0if (*p =3D=3D '!') > + =A0 =A0return 1; > + > =A0 while (isalnum (*p) || *p =3D=3D '-' || *p =3D=3D '_' > =A0 =A0 =A0 =A0 /* Characters used by TUI specific commands. =A0*/ > =A0 =A0 =A0 =A0 || *p =3D=3D '+' || *p =3D=3D '<' || *p =3D=3D '>' || *p = =3D=3D '$' > =A0 =A0 =A0 =A0 /* Characters used for XDB compatibility. =A0*/ > - =A0 =A0 =A0 =A0|| (xdb_commands && (*p =3D=3D '!' || *p =3D=3D '/' || *= p =3D=3D '?'))) > + =A0 =A0 =A0 =A0|| (xdb_commands && (*p =3D=3D '/' || *p =3D=3D '?'))) > =A0 =A0 p++; > > =A0 return p - text; >