home *** CD-ROM | disk | FTP | other *** search
-
- /* ----------------------------------------------------------------------
- * FILE: rh.h
- * (c) 1989 Ken Stauffer
- * This header contains the #define's for the tokens.
- * It also contains the initialized arrays. By having
- * rh.c define a symbol MAIN, the space is allocated for these globals
- * only once.
- *
- * ---------------------------------------------------------------------- */
-
- #include <stdio.h>
-
- #define START 256
- #define OR 256 /* || */
- #define AND 257 /* && */
- #define LE 258 /* <= */
- #define LT 259 /* < */
- #define GE 260 /* >= */
- #define GT 261 /* > */
- #define NE 262 /* != */
- #define EQ 263 /* == */
- #define BOR 264 /* | */
- #define BAND 265 /* & */
- #define BXOR 266 /* ^ */
- #define NOT 267 /* ! */
- #define PLUS 268 /* + */
- #define MUL 269 /* * */
- #define MINUS 270 /* - */
- #define DIV 271 /* / */
- #define MOD 272 /* % */
- #define BNOT 273 /* ~ */
- #define UNIMINUS 274 /* - */
- #define SHIFTL 275 /* << */
- #define SHIFTR 276 /* >> */
- #define QM 277 /* ? */
- #define COLON 278 /* : */
- #define NOP 279 /* */
-
- #define NUMBER 280 /* eg. 1234,NOW,IFDIR */
- #define STAR 281 /* eg. "*.BAK" */
- #define FIELD 282 /* mode, uid */
- #define MACRONAME 283
- #define UNKNOWN 284
-
- #define NOW_INDEX 1 /* where to place the current time */
- #define MACRO_INDEX 0 /* where the macro name goes */
-
- #define LENGTH 100 /* size of stack program */
- #define MEM 20 /* size of stack */
- #define IDLENGTH 20
- #define STARLEN 1000 /* total chars available for strings */
-
- #if BSD || SUN
- #define DEPTH getdtablesize()
- #endif
-
- #if XENIX || SYSV
- /* This value was arbitrarily chosen */
- #define DEPTH 24
- #endif
-
- struct instr {
- int i_type;
- long i_value;
- };
-
- #ifdef MAIN
-
- extern c_or(), c_and(), c_le(), c_lt(), c_ge(),
- c_gt(), c_ne(), c_eq(), c_bor(), c_band(),
- c_bxor(), c_not(), c_plus(), c_mul(), c_minus(),
- c_div(), c_mod(), c_number(), c_atime(), c_ctime(),
- c_dev(), c_gid(), c_ino(), c_mode(), c_mtime(),
- c_nlink(), c_rdev(), c_size(), c_uid(), c_star(),
- c_bnot(), c_uniminus(), c_lshift(), c_rshift(), c_qm(),
- c_colon(), c_nop();
-
- #if SUN || BSD
- char *identifiers[]={ "", "NOW" , "IFBLK", "IFCHR", "IFDIR", "IFLNK", "IFMT",
- "IFREG", "IFSOCK", "ISGID", "ISUID", "ISVTX",
- "atime", "ctime", "dev", "gid", "ino",
- "mode", "mtime", "nlink", "rdev", "size", "uid",
- NULL };
-
- long constants[]={ 0,0,
- S_IFBLK, S_IFCHR, S_IFDIR, S_IFLNK, S_IFMT, S_IFREG, S_IFSOCK,
- S_ISGID, S_ISUID, S_ISVTX, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
- #endif
-
- #if XENIX || SYSV
- char *identifiers[]={ "", "NOW", "IFBLK", "IFCHR", "IFDIR", "IFMT",
- "IFREG", "IFIFO", "ISGID", "ISUID", "ISVTX",
- "atime", "ctime", "dev", "gid", "ino",
- "mode", "mtime", "nlink", "rdev", "size", "uid",
- NULL };
-
- long constants[]={ 0,0,
- S_IFBLK, S_IFCHR, S_IFDIR, S_IFMT, S_IFREG, S_IFIFO,
- S_ISGID, S_ISUID, S_ISVTX, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
- #endif
-
- int (*commands[])()= {
- c_or, c_and, c_le, c_lt, c_ge,
- c_gt, c_ne, c_eq, c_bor, c_band,
- c_bxor, c_not, c_plus, c_mul, c_minus,
- c_div, c_mod, c_bnot, c_uniminus,c_lshift,
- c_rshift, c_qm, c_colon, c_nop, c_number,
- c_star, c_atime, c_ctime, c_dev, c_gid,
- c_ino, c_mode, c_mtime, c_nlink, c_rdev,
- c_size, c_uid };
-
- long tokenval;
- long token;
-
- struct instr StackProgram[ LENGTH ];
- int PC;
-
- long Stack[ MEM ];
- int SP;
-
- struct stat *globuf;
- char *fname;
- int dashf;
- int dashl;
- int dashe;
- int dashr;
- int dashh;
- int dashm;
- int dasha;
- char *expstr;
- FILE *expfile;
-
- char Starbuf[ STARLEN ];
- int starfree=0;
-
- #else
- extern long constants[];
- extern char *identifiers[];
- extern int (*commands[])();
-
- extern long tokenval;
- extern long token;
- extern struct instr StackProgram[];
- extern int PC;
- extern long Stack[];
- extern int SP;
- extern struct stat *globuf;
- extern char *fname;
- extern char Starbuf[];
- extern int starfree;
- extern int dashf;
- extern int dashl;
- extern int dashe;
- extern int dashr;
- extern int dashh;
- extern int dashm;
- extern int dasha;
- extern char *expstr;
- extern FILE *expfile;
- #endif
-