2003-08-18 09:44:49 +00:00
|
|
|
/* Take file names apart into directory and base names.
|
|
|
|
|
|
2005-06-02 05:05:29 +00:00
|
|
|
Copyright (C) 1998, 2001, 2003, 2004, 2005 Free Software Foundation, Inc.
|
1998-12-07 06:26:12 +00:00
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
|
the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
|
any later version.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with this program; if not, write to the Free Software Foundation,
|
2005-05-14 07:58:06 +00:00
|
|
|
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
1998-12-07 06:26:12 +00:00
|
|
|
|
|
|
|
|
#ifndef DIRNAME_H_
|
|
|
|
|
# define DIRNAME_H_ 1
|
|
|
|
|
|
2004-08-02 17:33:24 +00:00
|
|
|
# include <stdbool.h>
|
2003-06-06 19:42:03 +00:00
|
|
|
# include <stddef.h>
|
|
|
|
|
|
2001-05-12 15:46:36 +00:00
|
|
|
# ifndef DIRECTORY_SEPARATOR
|
|
|
|
|
# define DIRECTORY_SEPARATOR '/'
|
|
|
|
|
# endif
|
|
|
|
|
|
|
|
|
|
# ifndef ISSLASH
|
|
|
|
|
# define ISSLASH(C) ((C) == DIRECTORY_SEPARATOR)
|
|
|
|
|
# endif
|
|
|
|
|
|
2004-06-30 22:37:03 +00:00
|
|
|
# ifndef FILE_SYSTEM_PREFIX_LEN
|
2005-06-02 05:05:29 +00:00
|
|
|
# define FILE_SYSTEM_PREFIX_LEN(File_name) 0
|
2001-05-12 15:46:36 +00:00
|
|
|
# endif
|
|
|
|
|
|
2004-08-05 23:01:03 +00:00
|
|
|
# define IS_ABSOLUTE_FILE_NAME(F) ISSLASH ((F)[FILE_SYSTEM_PREFIX_LEN (F)])
|
|
|
|
|
# define IS_RELATIVE_FILE_NAME(F) (! IS_ABSOLUTE_FILE_NAME (F))
|
2004-05-29 21:57:27 +00:00
|
|
|
|
2005-06-02 05:05:29 +00:00
|
|
|
char *base_name (char const *file);
|
|
|
|
|
char *dir_name (char const *file);
|
|
|
|
|
size_t base_len (char const *file);
|
|
|
|
|
size_t dir_len (char const *file);
|
2001-05-12 15:46:36 +00:00
|
|
|
|
2005-06-02 05:05:29 +00:00
|
|
|
bool strip_trailing_slashes (char *file);
|
1998-12-07 06:26:12 +00:00
|
|
|
|
|
|
|
|
#endif /* not DIRNAME_H_ */
|