From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27527 invoked by alias); 28 Oct 2003 16:08:30 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 27494 invoked from network); 28 Oct 2003 16:08:29 -0000 Received: from unknown (HELO localhost.redhat.com) (207.219.125.105) by sources.redhat.com with SMTP; 28 Oct 2003 16:08:29 -0000 Received: from gnu.org (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id 75E892B89; Mon, 27 Oct 2003 11:45:08 -0500 (EST) Message-ID: <3F9D4B94.7040502@gnu.org> Date: Tue, 28 Oct 2003 16:08:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:1.0.2) Gecko/20030820 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Daniel Jacobowitz , Jim Ingham Cc: gdb-patches@sources.redhat.com Subject: Re: report valid values for all errors for enum variables... References: <20031028040347.GA26218@nevyn.them.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2003-10/txt/msg00810.txt.bz2 Jim, Since you're looking a that code, can you please tweak it so that it uses a mem_file instead of the 1024 byte stack buffer. Is there a test case? Andrew + /* If there was an error, print an informative + error message. */ char msg[1024]; ! if (arg == NULL) ! strcpy (msg, "Requires an argument."); ! else if (nmatches <= 0) ! sprintf (msg, "Undefined item: \"%s\".", arg); ! else if (nmatches > 1) ! sprintf (msg, "Ambiguous item \"%s\".", arg); ! strcat (msg, " Valid values are "); for (i = 0; c->enums[i]; i++) {