sh.dir.h revision 167465
118334Speter/* $Header: /p/tcsh/cvsroot/tcsh/sh.dir.h,v 3.6 2002/03/08 17:36:46 christos Exp $ */
218334Speter/*
318334Speter * sh.dir.h: Directory data structures and globals
418334Speter */
5132718Skan/*-
690075Sobrien * Copyright (c) 1980, 1991 The Regents of the University of California.
718334Speter * All rights reserved.
818334Speter *
990075Sobrien * Redistribution and use in source and binary forms, with or without
1018334Speter * modification, are permitted provided that the following conditions
1190075Sobrien * are met:
1290075Sobrien * 1. Redistributions of source code must retain the above copyright
1390075Sobrien *    notice, this list of conditions and the following disclaimer.
1490075Sobrien * 2. Redistributions in binary form must reproduce the above copyright
1518334Speter *    notice, this list of conditions and the following disclaimer in the
1690075Sobrien *    documentation and/or other materials provided with the distribution.
1790075Sobrien * 3. Neither the name of the University nor the names of its contributors
1890075Sobrien *    may be used to endorse or promote products derived from this software
1990075Sobrien *    without specific prior written permission.
2018334Speter *
2118334Speter * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2290075Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23169689Skan * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24169689Skan * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2518334Speter * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26117395Skan * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27117395Skan * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28117395Skan * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29117395Skan * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30117395Skan * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31117395Skan * SUCH DAMAGE.
32117395Skan */
3318334Speter#ifndef _h_sh_dir
3418334Speter#define _h_sh_dir
3518334Speter/*
3618334Speter * Structure for entries in directory stack.
3718334Speter */
3818334Speterstruct directory {
3918334Speter    struct directory *di_next;	/* next in loop */
4018334Speter    struct directory *di_prev;	/* prev in loop */
4118334Speter    unsigned short *di_count;	/* refcount of processes */
4218334Speter    Char   *di_name;		/* actual name */
4318334Speter};
4418334SpeterEXTERN struct directory *dcwd IZERO_STRUCT;	/* the one we are in now */
4518334SpeterEXTERN int symlinks;
4618334Speter
4718334Speter#define SYM_CHASE	1
4818334Speter#define SYM_IGNORE	2
4918334Speter#define SYM_EXPAND	3
5018334Speter
5190075Sobrien#define TRM(a) ((a) & TRIM)
5218334Speter#define NTRM(a) (a)
5390075Sobrien#define ISDOT(c) (NTRM((c)[0]) == '.' && ((NTRM((c)[1]) == '\0') || \
5490075Sobrien		  (NTRM((c)[1]) == '/')))
5590075Sobrien#define ISDOTDOT(c) (NTRM((c)[0]) == '.' && ISDOT(&((c)[1])))
5690075Sobrien
5750397Sobrien#endif				/* _h_sh_dir */
5818334Speter