| iMatix home page
| << | < | > | >>
SFL Logo SFL
Version 2.11

 

strip_file_name

#include "sflfile.h"
char
*strip_file_name (
    char *name)

Synopsis

Returns the path for a fully-qualified filename. The path is cleaned-up and resolved. The returned string is held in a static area that should be copied directly after calling this function. The returned path does not end in '/' unless that is the entire path. If the supplied name contains no path, the returned path is ".".

Source Code - (sflfile.c)

{
    char *path_end;

    ASSERT (name);
    ASSERT (strlen (name) <= LINE_MAX);

    strcpy (work_name, name);
    path_end = strrchr (work_name, PATHEND);
#if (defined (MSDOS_FILESYSTEM))
    if (path_end == NULL)
        path_end = strrchr (work_name, '/');
#endif
    if (path_end == NULL)
        return (".");
    else
      {
        path_end [1] = '\0';
        return (clean path (work_name));
      }
}

| << | < | > | >> iMatix Copyright © 1996-2000 iMatix Corporation