1 /*
2  * Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers.
3  *	All rights reserved.
4  *
5  * By using this file, you agree to the terms and conditions set
6  * forth in the LICENSE file which can be found at the top level of
7  * the sendmail distribution.
8  *
9  *	$Id: path.h,v 1.6 2001/04/03 01:53:00 gshapiro Exp $
10  */
11 
12 /*
13 **  Portable names for standard filesystem paths
14 **  and macros for directories.
15 */
16 
17 #ifndef SM_PATH_H
18 # define SM_PATH_H
19 
20 # include <sm/gen.h>
21 
22 # ifdef WIN32
23 #  define SM_PATH_DEVNULL	"NUL"
24 #  define SM_IS_DIR_DELIM(c)	((c) == '/' || (c) == '\\')
25 #  define SM_FIRST_DIR_DELIM(s)	strpbrk(s, "/\\")
26 
27 #  define SM_LAST_DIR_DELIM(s)	sm_last_dir_delim(s)
28 
29 /* Warning: this must be accessible as array */
30 #  define SM_IS_DIR_START(s)	(((s)[1] == ':' && \
31 			(((s)[2] == '/') || ((s)[2] == '\\'))) \
32 			|| (((s)[0] == '/') || ((s)[0] == '\\')))
33 
34 extern char	*sm_last_dir_delim __P((const char *));
35 extern bool	sm_path_isdevnull __P((const char *));
36 
37 # else /* WIN32 */
38 #  define SM_PATH_DEVNULL	"/dev/null"
39 #  define SM_IS_DIR_DELIM(c)	((c) == '/')
40 #  define SM_FIRST_DIR_DELIM(s)	strchr(s, '/')
41 #  define SM_LAST_DIR_DELIM(s)	strrchr(s, '/')
42 
43 /* Warning: this must be accessible as array */
44 #  define SM_IS_DIR_START(s)	((s)[0] == '/')
45 
46 #  define sm_path_isdevnull(path)	(strcmp(path, "/dev/null") == 0)
47 # endif /* WIN32 */
48 
49 #endif /* ! SM_PATH_H */
50