comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <stephen_leake@stephe-leake.org>
Subject: Re: Ada.Directories.Base_Name and dot files
Date: Thu, 08 Oct 2009 05:39:00 -0400
Date: 2009-10-08T05:39:00-04:00	[thread overview]
Message-ID: <uhbua1ayz.fsf@stephe-leake.org> (raw)
In-Reply-To: 4acc8c20$0$284$14726298@news.sunsite.dk

Thomas L�cke <"tl at ada-dk.org"> writes:

> begin
>    IO.Put_Line (Item => "1: " & D.Base_Name (Name => "foo.txt"));
>    IO.Put_Line (Item => "2: " & D.Base_Name (Name => ".foo"));
>    IO.Put_Line (Item => "3: " & D.Base_Name (Name => ".foo.bar"));
> end Dot;
> ++++
>
> The output I get is this:
>
> ++++
> 1: foo
> 2:
> 3: .foo
> ++++
>
> What I had hoped for, was this:
>
> ++++
> 1: foo
> 2: .foo
> 3: .foo
> ++++

Just out of curiosity, what made you hope for this? The Gnu coreutils
basename function doesn't do what you want, either:

$ basename foo.txt
foo.txt
$ basename foo.txt .txt
foo
$ basename .foo
.foo
$ basename .foo .foo
.foo
$ basename .foo.bar
.foo.bar
$ basename .foo.bar .bar
.foo
$ basename .foo.bar .foo
.foo.bar
$ basename .foo.bar .foo.bar
.foo.bar


> With the current null string solution, you'd have to do some manual
> parsing to get to the actual basename of a dot file.

What is your definition of "the actual basename"?

> Is there a good reason for the current behavior?

It's well-defined. And it does what I want :).

-- 
-- Stephe



  parent reply	other threads:[~2009-10-08  9:39 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-07 12:40 Ada.Directories.Base_Name and dot files 
2009-10-07 14:46 ` Yannick Duchêne Hibou57
2009-10-07 17:06   ` 
2009-10-07 14:52 ` Adam Beneschan
2009-10-07 17:06   ` 
2009-10-07 15:10 ` Adam Beneschan
2009-10-07 15:37   ` Yannick Duchêne Hibou57
2009-10-11  2:39     ` Randy Brukardt
2009-10-07 20:11   ` 
2009-10-08  9:39 ` Stephen Leake [this message]
2009-10-08  9:58   ` 
2009-10-26 19:26     ` Type casting Bruno
2009-10-26 20:02       ` Jeffrey R. Carter
2009-10-26 20:09       ` Adam Beneschan
2009-10-26 19:27     ` Conversions Bruno
2009-10-26 20:09       ` Conversions Jeffrey R. Carter
2009-10-26 20:19       ` Conversions Adam Beneschan
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox