From 566d54fe549286895fdef8aa9f385686405dd290 Mon Sep 17 00:00:00 2001 From: Nicholas Noll Date: Wed, 13 Oct 2021 16:46:20 -0700 Subject: RM(rc): old code. too many assumptions baked in --- sys/cmd/rc/rc.h | 149 -------------------------------------------------------- 1 file changed, 149 deletions(-) delete mode 100644 sys/cmd/rc/rc.h (limited to 'sys/cmd/rc/rc.h') diff --git a/sys/cmd/rc/rc.h b/sys/cmd/rc/rc.h deleted file mode 100644 index c91bdd4..0000000 --- a/sys/cmd/rc/rc.h +++ /dev/null @@ -1,149 +0,0 @@ -#include "unix.h" - -#define YYMAXDEPTH 500 -#ifndef PAREN -#ifndef YYMAJOR -#include "x.tab.h" -#endif -#endif - -#undef pipe /* so that /dev/fd works */ -#define searchpath rcsearchpath /* avoid new libc function */ - -typedef struct Tree Tree; -typedef struct Word Word; -typedef struct Io Io; -typedef union Code Code; -typedef struct Var Var; -typedef struct Words Words; -typedef struct Redir Redir; -typedef struct Thread Thread; -typedef struct Builtin Builtin; - -struct Tree -{ - int type; - int rtype, fd0, fd1; /* details of REDIR PIPE DUP tokens */ - char *str; - int quoted; - int iskw; - Tree *child[3]; - Tree *next; -}; - -Tree *newtree(void); -void freetree(Tree*); - -Tree *token(char*, int); -Tree *klook(char*); - -Tree *tree1(int, Tree*); -Tree *tree2(int, Tree*, Tree*); -Tree *tree3(int, Tree*, Tree*, Tree*); - -Tree *mung1(Tree*, Tree*); -Tree *mung2(Tree*, Tree*, Tree*); -Tree *mung3(Tree*, Tree*, Tree*, Tree*); -Tree *epimung(Tree*, Tree*); -Tree *simplemung(Tree*); -Tree *heredoc(Tree*); - -extern Tree *cmdtree; - -/* - * The first word of any code vector is a reference count. - * Always create a new reference to a code vector by calling codecopy(.). - * Always call codefree(.) when deleting a reference. - */ -union Code -{ - void (*f)(void); - int i; - char *s; -}; - -extern char *promptstr; -extern int doprompt; - -#define NTOK 8192 -extern char tok[NTOK]; - -#define APPEND 1 -#define WRITE 2 -#define READ 3 -#define HERE 4 -#define DUPFD 5 -#define CLOSE 6 -#define RDWR 7 - -struct Var -{ - char *name; /* ascii name */ - Word *val; /* value */ - int changed; - Code *fn; /* pointer to function's code vector */ - int fnchanged; - int pc; /* pc of start of function */ - Var *next; /* next on hash or local list */ - void (*changefn)(Var*); -}; -Var *vlook(char*), *gvlook(char*), *newvar(char*, Var*); - -#define NVAR 521 -extern Var *gvar[NVAR]; /* hash for globals */ - -#define new(type) ((type *)emalloc(sizeof(type))) -void *emalloc(long); -void *Malloc(ulong); -void efree(void*); -#define NOFILE 128 /* should come from */ - -struct Here -{ - Tree *tag; - char *name; - struct Here *next; -}; -/* - * Glob character escape in strings: - * In a string, GLOB must be followed by *?[ or GLOB. - * GLOB* matches any string - * GLOB? matches any single character - * GLOB[...] matches anything in the brackets - * GLOBGLOB matches GLOB - */ -#define GLOB ((char)0x01) -/* - * onebyte(c), twobyte(c), threebyte(c) - * Is c the first character of a one- two- or three-byte utf sequence? - */ -#define onebyte(c) ((c&0x80)==0x00) -#define twobyte(c) ((c&0xe0)==0xc0) -#define threebyte(c) ((c&0xf0)==0xe0) -#define fourbyte(c) ((c&0xf8)==0xf0) - -extern char **argp; -extern char **args; -extern int nerror; /* number of errors encountered during compilation */ -/* - * Which fds are the reading/writing end of a pipe? - * Unfortunately, this can vary from system to system. - * 9th edition Unix doesn't care, the following defines - * work on plan 9. - */ -#define PRD 0 -#define PWR 1 -extern char *Rcmain, *Fdprefix; -#define register - -char *getstatus(void); - -/* - * How many dot commands have we executed? - * Used to ensure that -v flag doesn't print rcmain. - */ -extern int ndot; -extern int lastc; -extern int lastword; -extern int kidpid; -extern int mypid; -- cgit v1.2.1