1c80476e4SDavid E. O'Brien /* 2c80476e4SDavid E. O'Brien * sh.dir.h: Directory data structures and globals 3c80476e4SDavid E. O'Brien */ 4c80476e4SDavid E. O'Brien /*- 5c80476e4SDavid E. O'Brien * Copyright (c) 1980, 1991 The Regents of the University of California. 6c80476e4SDavid E. O'Brien * All rights reserved. 7c80476e4SDavid E. O'Brien * 8c80476e4SDavid E. O'Brien * Redistribution and use in source and binary forms, with or without 9c80476e4SDavid E. O'Brien * modification, are permitted provided that the following conditions 10c80476e4SDavid E. O'Brien * are met: 11c80476e4SDavid E. O'Brien * 1. Redistributions of source code must retain the above copyright 12c80476e4SDavid E. O'Brien * notice, this list of conditions and the following disclaimer. 13c80476e4SDavid E. O'Brien * 2. Redistributions in binary form must reproduce the above copyright 14c80476e4SDavid E. O'Brien * notice, this list of conditions and the following disclaimer in the 15c80476e4SDavid E. O'Brien * documentation and/or other materials provided with the distribution. 1629301572SMark Peek * 3. Neither the name of the University nor the names of its contributors 17c80476e4SDavid E. O'Brien * may be used to endorse or promote products derived from this software 18c80476e4SDavid E. O'Brien * without specific prior written permission. 19c80476e4SDavid E. O'Brien * 20c80476e4SDavid E. O'Brien * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21c80476e4SDavid E. O'Brien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22c80476e4SDavid E. O'Brien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23c80476e4SDavid E. O'Brien * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24c80476e4SDavid E. O'Brien * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25c80476e4SDavid E. O'Brien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26c80476e4SDavid E. O'Brien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27c80476e4SDavid E. O'Brien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28c80476e4SDavid E. O'Brien * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29c80476e4SDavid E. O'Brien * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30c80476e4SDavid E. O'Brien * SUCH DAMAGE. 31c80476e4SDavid E. O'Brien */ 32c80476e4SDavid E. O'Brien #ifndef _h_sh_dir 33c80476e4SDavid E. O'Brien #define _h_sh_dir 34c80476e4SDavid E. O'Brien /* 35c80476e4SDavid E. O'Brien * Structure for entries in directory stack. 36c80476e4SDavid E. O'Brien */ 37c80476e4SDavid E. O'Brien struct directory { 38c80476e4SDavid E. O'Brien struct directory *di_next; /* next in loop */ 39c80476e4SDavid E. O'Brien struct directory *di_prev; /* prev in loop */ 40c80476e4SDavid E. O'Brien unsigned short *di_count; /* refcount of processes */ 41c80476e4SDavid E. O'Brien Char *di_name; /* actual name */ 42c80476e4SDavid E. O'Brien }; 43c80476e4SDavid E. O'Brien EXTERN struct directory *dcwd IZERO_STRUCT; /* the one we are in now */ 44c80476e4SDavid E. O'Brien EXTERN int symlinks; 45c80476e4SDavid E. O'Brien 46c80476e4SDavid E. O'Brien #define SYM_CHASE 1 47c80476e4SDavid E. O'Brien #define SYM_IGNORE 2 48c80476e4SDavid E. O'Brien #define SYM_EXPAND 3 49c80476e4SDavid E. O'Brien 50c80476e4SDavid E. O'Brien #define TRM(a) ((a) & TRIM) 51c80476e4SDavid E. O'Brien #define NTRM(a) (a) 52c80476e4SDavid E. O'Brien #define ISDOT(c) (NTRM((c)[0]) == '.' && ((NTRM((c)[1]) == '\0') || \ 53c80476e4SDavid E. O'Brien (NTRM((c)[1]) == '/'))) 54c80476e4SDavid E. O'Brien #define ISDOTDOT(c) (NTRM((c)[0]) == '.' && ISDOT(&((c)[1]))) 55c80476e4SDavid E. O'Brien 56c80476e4SDavid E. O'Brien #endif /* _h_sh_dir */ 57