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