sh.dir.h revision 100616
1100616Smp/* $Header: /src/pub/tcsh/sh.dir.h,v 3.6 2002/03/08 17:36:46 christos Exp $ */
259243Sobrien/*
359243Sobrien * sh.dir.h: Directory data structures and globals
459243Sobrien */
559243Sobrien/*-
659243Sobrien * Copyright (c) 1980, 1991 The Regents of the University of California.
759243Sobrien * All rights reserved.
859243Sobrien *
959243Sobrien * Redistribution and use in source and binary forms, with or without
1059243Sobrien * modification, are permitted provided that the following conditions
1159243Sobrien * are met:
1259243Sobrien * 1. Redistributions of source code must retain the above copyright
1359243Sobrien *    notice, this list of conditions and the following disclaimer.
1459243Sobrien * 2. Redistributions in binary form must reproduce the above copyright
1559243Sobrien *    notice, this list of conditions and the following disclaimer in the
1659243Sobrien *    documentation and/or other materials provided with the distribution.
17100616Smp * 3. Neither the name of the University nor the names of its contributors
1859243Sobrien *    may be used to endorse or promote products derived from this software
1959243Sobrien *    without specific prior written permission.
2059243Sobrien *
2159243Sobrien * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2259243Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2359243Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2459243Sobrien * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2559243Sobrien * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2659243Sobrien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2759243Sobrien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2859243Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2959243Sobrien * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3059243Sobrien * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3159243Sobrien * SUCH DAMAGE.
3259243Sobrien */
3359243Sobrien#ifndef _h_sh_dir
3459243Sobrien#define _h_sh_dir
3559243Sobrien/*
3659243Sobrien * Structure for entries in directory stack.
3759243Sobrien */
3859243Sobrienstruct directory {
3959243Sobrien    struct directory *di_next;	/* next in loop */
4059243Sobrien    struct directory *di_prev;	/* prev in loop */
4159243Sobrien    unsigned short *di_count;	/* refcount of processes */
4259243Sobrien    Char   *di_name;		/* actual name */
4359243Sobrien};
4459243SobrienEXTERN struct directory *dcwd IZERO_STRUCT;	/* the one we are in now */
4559243SobrienEXTERN int symlinks;
4659243Sobrien
4759243Sobrien#define SYM_CHASE	1
4859243Sobrien#define SYM_IGNORE	2
4959243Sobrien#define SYM_EXPAND	3
5059243Sobrien
5159243Sobrien#define TRM(a) ((a) & TRIM)
5259243Sobrien#define NTRM(a) (a)
5359243Sobrien#define ISDOT(c) (NTRM((c)[0]) == '.' && ((NTRM((c)[1]) == '\0') || \
5459243Sobrien		  (NTRM((c)[1]) == '/')))
5559243Sobrien#define ISDOTDOT(c) (NTRM((c)[0]) == '.' && ISDOT(&((c)[1])))
5659243Sobrien
5759243Sobrien#endif				/* _h_sh_dir */
58