From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31245 invoked by alias); 9 Dec 2013 21:25:22 -0000 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 Received: (qmail 31234 invoked by uid 89); 9 Dec 2013 21:25:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.8 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-qe0-f51.google.com Received: from Unknown (HELO mail-qe0-f51.google.com) (209.85.128.51) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Mon, 09 Dec 2013 21:25:21 +0000 Received: by mail-qe0-f51.google.com with SMTP id 1so3344532qee.24 for ; Mon, 09 Dec 2013 13:25:13 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.224.127.74 with SMTP id f10mr38115326qas.56.1386624313004; Mon, 09 Dec 2013 13:25:13 -0800 (PST) Received: by 10.96.175.66 with HTTP; Mon, 9 Dec 2013 13:25:12 -0800 (PST) In-Reply-To: <83a9gayoez.fsf@gnu.org> References: <1386579696-26136-1-git-send-email-a3at.mail@gmail.com> <83a9gayoez.fsf@gnu.org> Date: Mon, 09 Dec 2013 21:25:00 -0000 Message-ID: Subject: Re: [PATCH] gdb: set filename-display shortpath support From: Azat Khuzhin To: Eli Zaretskii Cc: gdb-patches@sourceware.org Content-Type: text/plain; charset=UTF-8 X-SW-Source: 2013-12/txt/msg00354.txt.bz2 On Mon, Dec 9, 2013 at 8:33 PM, Eli Zaretskii wrote: >> From: Azat Khuzhin >> Cc: Azat Khuzhin >> Date: Mon, 9 Dec 2013 13:01:36 +0400 >> >> Display only non-common part of filename and compilation directory > > Thanks. > >> + for (;;) >> + { >> + size_t min_part_len; >> + >> + slash_name = strstr (slash_name, SLASH_STRING); >> + slash_dir = strstr (slash_dir, SLASH_STRING); >> + if (slash_name == NULL || slash_dir == NULL) >> + break; > > It is wrong to use SLASH_STRING to search for directory separators; > that is non-portable. SLASH_STRING is for constructing file names > from directories and the basename. > > To look for directory separators, please use lbasename, ldirname, or > similar functions, which already know about possible separators on > each supported platform. Now i see that SLASH_STRING can have only '/' value. So I replaced it by IS_DIR_SEPARATOR in v5 patch. Thanks. > >> @@ -2093,9 +2137,11 @@ is not specified, print all substitution rules."), >> Set how to display filenames."), _("\ >> Show how to display filenames."), _("\ >> filename-display can be:\n\ >> - basename - display only basename of a filename\n\ >> - relative - display a filename relative to the compilation directory\n\ >> - absolute - display an absolute filename\n\ >> + basename - display only basename of a filename\n\ >> + relative - display a filename relative to the compilation directory\n\ >> + absolute - display an absolute filename\n\ >> + shortpath - display only non-common part of filename and compilation \ >> +directory\n\ > > This should use "filenames", not "a filename", since the option > affects any displayed file name, not just one of them. Agree. > >> By default, relative filenames are displayed."), > > This is ambiguous. I suggest to say "The default is \"relative\"." I think that this is not part of "shortpath" patch, I can another one to fix it. > > Sorry for not paying attention when you first posted the patch. No problems. Thanks. -- Respectfully Azat Khuzhin