TSP (libtsp/FL) - FLdirName

## FLdirName

#### Routine

int FLdirName (const char Fname[], char Bname[])

#### Purpose

Return all but the last component of a file path

#### Description

This routine takes a file path specification and returns all but the right-most component of the file name. Components are separated by / characters. If no / character appears in the name, an empty string is returned. For MS-DOS, the directory separator character is \.

Examples:

       "abc/def"      => "abc"
       "abc/def/"     => "abc/def"
       "abc/bcd/def"  => "abc/bcd"
       "/abc/def"     => "/abc"
       "/abc/bcd/def" => "/abc/bcd"
       "./def"        => "."
       "def"          => ""

Special cases:

       "/def"         => "/"
       "/"            => "/"

#### Parameters

<- int FLdirName
  Number of characters in the output string
-> const char Fname[]
  Input character string with the path name
<- char Bname[]
  Output string with the all but the last path name component. This string at most FILENAME_MAX characters long including the terminating null character.

#### Author / revision

P. Kabal Copyright (C) 1997 / Revision 1.18 1997/10/14

#### See Also

FLbaseName, FLdefName, FLexpHome

Main Index libtsp