xref: /openbsd-src/gnu/usr.bin/perl/util.h (revision db3296cf5c1dd9058ceecc3a29fe4aaa0bd26000)
1 /*    util.h
2  *
3  *    Copyright (c) 1991-2002, Larry Wall
4  *
5  *    You may distribute under the terms of either the GNU General Public
6  *    License or the Artistic License, as specified in the README file.
7  *
8  */
9 
10 #ifdef VMS
11 #  define PERL_FILE_IS_ABSOLUTE(f) \
12 	(*(f) == '/'							\
13 	 || (strchr(f,':')						\
14 	     || ((*(f) == '[' || *(f) == '<')				\
15 		 && (isALNUM((f)[1]) || strchr("$-_]>",(f)[1])))))
16 
17 #else		/* !VMS */
18 #  ifdef WIN32
19 #    define PERL_FILE_IS_ABSOLUTE(f) \
20 	(*(f) == '/'							\
21 	 || ((f)[0] && (f)[1] == ':')		/* drive name */	\
22 	 || ((f)[0] == '\\' && (f)[1] == '\\'))	/* UNC path */
23 #  else		/* !WIN32 */
24 #  ifdef NETWARE
25 #    define PERL_FILE_IS_ABSOLUTE(f) \
26 	(((f)[0] && (f)[1] == ':')		/* drive name */	\
27 	 || ((f)[0] == '\\' && (f)[1] == '\\')	/* UNC path */	\
28 	 ||	((f)[3] == ':'))				/* volume name, currently only sys */
29 #  else		/* !NETWARE */
30 #    if defined( DOSISH) || defined(EPOC)
31 #      define PERL_FILE_IS_ABSOLUTE(f) \
32 	(*(f) == '/'							\
33 	 || ((f)[0] && (f)[1] == ':'))		/* drive name */
34 #    else	/* NEITHER DOSISH NOR EPOCISH */
35 #      ifdef MACOS_TRADITIONAL
36 #        define PERL_FILE_IS_ABSOLUTE(f)	(strchr(f, ':') && *(f) != ':')
37 #      else /* !MACOS_TRADITIONAL */
38 #        define PERL_FILE_IS_ABSOLUTE(f)	(*(f) == '/')
39 #      endif /* MACOS_TRADITIONAL */
40 #    endif	/* DOSISH */
41 #   endif	/* NETWARE */
42 #  endif	/* WIN32 */
43 #endif		/* VMS */
44