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