1294332Sdes/* $Header: /p/tcsh/cvsroot/tcsh/sh.dir.h,v 3.6 2002/03/08 17:36:46 christos Exp $ */
2276707Sdes/*
3276707Sdes * sh.dir.h: Directory data structures and globals
4276707Sdes */
5276707Sdes/*-
6276707Sdes * Copyright (c) 1980, 1991 The Regents of the University of California.
7276707Sdes * All rights reserved.
8276707Sdes *
9276707Sdes * Redistribution and use in source and binary forms, with or without
10276707Sdes * modification, are permitted provided that the following conditions
11276707Sdes * are met:
12276707Sdes * 1. Redistributions of source code must retain the above copyright
13276707Sdes *    notice, this list of conditions and the following disclaimer.
14276707Sdes * 2. Redistributions in binary form must reproduce the above copyright
15276707Sdes *    notice, this list of conditions and the following disclaimer in the
16276707Sdes *    documentation and/or other materials provided with the distribution.
17276707Sdes * 3. Neither the name of the University nor the names of its contributors
18276707Sdes *    may be used to endorse or promote products derived from this software
19276707Sdes *    without specific prior written permission.
20276707Sdes *
21276707Sdes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22276707Sdes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23294332Sdes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24276707Sdes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25276707Sdes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26276707Sdes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27276707Sdes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28276707Sdes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29276707Sdes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30276707Sdes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31276707Sdes * SUCH DAMAGE.
32276707Sdes */
33294332Sdes#ifndef _h_sh_dir
34294332Sdes#define _h_sh_dir
35276707Sdes/*
36276707Sdes * Structure for entries in directory stack.
37294332Sdes */
38276707Sdesstruct directory {
39276707Sdes    struct directory *di_next;	/* next in loop */
40276707Sdes    struct directory *di_prev;	/* prev in loop */
41276707Sdes    unsigned short *di_count;	/* refcount of processes */
42276707Sdes    Char   *di_name;		/* actual name */
43276707Sdes};
44276707SdesEXTERN struct directory *dcwd IZERO_STRUCT;	/* the one we are in now */
45276707SdesEXTERN int symlinks;
46276707Sdes
47276707Sdes#define SYM_CHASE	1
48276707Sdes#define SYM_IGNORE	2
49276707Sdes#define SYM_EXPAND	3
50276707Sdes
51276707Sdes#define TRM(a) ((a) & TRIM)
52276707Sdes#define NTRM(a) (a)
53276707Sdes#define ISDOT(c) (NTRM((c)[0]) == '.' && ((NTRM((c)[1]) == '\0') || \
54276707Sdes		  (NTRM((c)[1]) == '/')))
55276707Sdes#define ISDOTDOT(c) (NTRM((c)[0]) == '.' && ISDOT(&((c)[1])))
56276707Sdes
57276707Sdes#endif				/* _h_sh_dir */
58276707Sdes