'x', 'n', 'v', 't', 's', 'i', 'e', 'r', 'k', 'u', 0
};
-INT flagval[] = {
+int flagval[] = {
execpr, noexec, readpr, oneflg, stdflg, intflg, errflg, rshflg,
keyflg, setflg, 0
};
/* ======== option handling ======== */
-INT options(argc, argv)
+int options(argc, argv)
STRING *argv;
-INT argc;
+int argc;
{
register STRING cp;
register STRING *argp = argv;
{
/* count args */
register STRING *argp = argi;
- register INT argn = 0;
+ register int argn = 0;
while (Rcheat(*argp++) != ENDARGS) {
argn++;
register POS rbytes = round(nbytes + BYTESPERWORD, BYTESPERWORD);
for (;;) {
- INT c = 0;
+ int c = 0;
register BLKPTR p = blokp;
register BLKPTR q;
do {
chkbptr(ptr)
BLKPTR ptr;
{
- INT exf = 0;
+ int exf = 0;
register BLKPTR p = end;
register BLKPTR q;
- INT us = 0, un = 0;
+ int us = 0, un = 0;
for (;;) {
q = Rcheat(p->word) & ~BUSY;
TREPTR makefork(flgs, i)
-INT flgs;
+int flgs;
TREPTR i;
{
register FORKPTR t;
}
static TREPTR makelist(type, i, r)
-INT type;
+int type;
TREPTR i, r;
{
register LSTPTR t;
*/
TREPTR cmd(sym, flg)
-register INT sym;
-INT flg;
+register int sym;
+int flg;
{
register TREPTR i, e;
static TREPTR list(flg)
{
register TREPTR r;
- register INT b;
+ register int b;
r = term(flg);
while (r && ((b = (wdval == ANDFSYM)) || wdval == ORFSYM)
}
static REGPTR syncase(esym)
-register INT esym;
+register int esym;
{
skipnl();
if (wdval == esym) {
case IFSYM:
{
- register INT w;
+ register int w;
t = (TREPTR) getstak(IFTYPE);
((IFPTR) t)->iftyp = TIF;
((IFPTR) t)->iftre = cmd(THSYM, NLFLG);
register ARGPTR argp;
register ARGPTR *argtail;
register ARGPTR *argset = 0;
- INT keywd = 1;
+ int keywd = 1;
t = (TREPTR) getstak(COMTYPE);
((COMPTR) t)->comio = io; /*initial io chain */
argtail = &(((COMPTR) t)->comarg);
static IOPTR inout(lastio)
IOPTR lastio;
{
- register INT iof;
+ register int iof;
register IOPTR iop;
register CHAR c;
static void chksym(sym)
{
- register INT x = sym & wdval;
+ register int x = sym & wdval;
if (((x & SYMFLG) ? x : sym) != wdval) {
synbad();
;
/* temp files and io */
extern UFD output;
-extern INT ioset;
+extern int ioset;
extern IOPTR iotemp; /* files to be deleted sometime */
extern IOPTR iopend; /* documents waiting to be read at NL */
/* substitution */
-extern INT dolc;
+extern int dolc;
extern STRING *dolv;
extern DOLPTR argfor;
extern ARGPTR gchain;
/* name tree and words */
extern SYSTAB reserved;
-extern INT wdval;
-extern INT wdnum;
+extern int wdval;
+extern int wdnum;
extern ARGPTR wdarg;
-extern INT wdset;
+extern int wdset;
extern BOOL reserv;
/* prompting */
/* transput */
extern CHAR tmpout[];
extern STRING tmpnam;
-extern INT serial;
+extern int serial;
#define TMPNAM 7
extern FILE standin;
#define input (standin->fdes)
#define eof (standin->feof)
-extern INT peekc;
+extern int peekc;
extern STRING comdiv;
extern const char devnull[];
#define execpr 04000
#define readpr 010000
#define keyflg 020000
-extern INT flags;
+extern int flags;
/* error exits from various parts of shell */
#include <setjmp.h>
extern const char readonly[];
/* execflgs */
-extern INT exitval;
+extern int exitval;
extern BOOL execbrk;
-extern INT loopcnt;
-extern INT breakcnt;
+extern int loopcnt;
+extern int breakcnt;
/* messages */
extern const char mailmsg[];
}
exitsh(xno)
-INT xno;
+int xno;
{
/* Arrive here from `FATAL' errors
* a) exit command,
static void addg();
-INT expand(as, rflg)
+int expand(as, rflg)
STRING as;
{
- INT count, dirf;
+ int count, dirf;
BOOL dir = 0;
STRING rescan = 0;
register STRING s, cs;
gmatch(s, p)
register STRING s, p;
{
- register INT scc;
+ register int scc;
CHAR c;
if (scc = *s++) {
case '[':
{
BOOL ok;
- INT lc;
+ int lc;
ok = 0;
lc = 077777;
while (c = *p++) {
STRING as1, as2, as3;
{
register STRING s1, s2;
- register INT c;
+ register int c;
s2 = locstak() + BYTESPERWORD;
void fault(sig)
-register INT sig;
+register int sig;
{
- register INT flag;
+ register int flag;
signal(sig, fault);
if (sig == MEMF) {
ignsig(n)
{
- register INT s, i;
+ register int s, i;
#if 0
// FIXME: need to do proper SIG_IGN checks/handling
if ((s = signal(i = n, 1) & 01) == 0) {
getsig(n)
{
- register INT i;
+ register int i;
if (trapflg[i = n] & SIGMOD || ignsig(i) == 0) {
signal(i, fault);
oldsigs()
{
- register INT i;
+ register int i;
register STRING t;
i = MAXTRAP;
}
clrsig(i)
-INT i;
+int i;
{
free(trapcom[i]);
trapcom[i] = 0;
chktrap()
{
/* check for traps */
- register INT i = MAXTRAP;
+ register int i = MAXTRAP;
register STRING t;
trapnote &= ~TRAPSET;
trapflg[i] &= ~TRAPSET;
if (t = trapcom[i]
) {
- INT savxit = exitval;
+ int savxit = exitval;
execexp(t, 0);
exitval = savxit;
exitset();
}
chkpipe(pv)
-INT *pv;
+int *pv;
{
if (pipe(pv) < 0 || pv[INPIPE] < 0 || pv[OTPIPE] < 0) {
error(piperr);
chkopen(idf)
STRING idf;
{
- register INT rc;
+ register int rc;
if ((rc = open(idf, 0)) < 0) {
failed(idf, badopen);
}
sh_rename(f1, f2)
-register INT f1, f2;
+register int f1, f2;
{
if (f1 != f2) {
dup2(f1, f2);
create(s)
STRING s;
{
- register INT rc;
+ register int rc;
if ((rc = creat(s, 0666)) < 0) {
failed(s, badcreate);
{
CHAR c, *ends;
register CHAR *cline, *clinep;
- INT fd;
+ int fd;
register IOPTR iop;
if (iop = ioparg) {
;
}
if (d == DOLLAR) {
- register INT c;
+ register int c;
if ((c = readc(), dolchar(c))
) {
NAMPTR n = (NAMPTR) NIL;
- INT dolg = 0;
+ int dolg = 0;
BOOL bra;
register STRING argp, v;
CHAR idb[2];
{
register TREPTR t =
makefork(FPOU, cmd(EOFSYM, MTFLG | NLFLG));
- INT pv[2];
+ int pv[2];
/* this is done like this so that the pipe
* is open only when needed
#define CPYSIZ 512
subst(in, ot)
-INT in, ot;
+int in, ot;
{
register CHAR c;
FILEBLK fb;
- register INT count = CPYSIZ;
+ register int count = CPYSIZ;
push(&fb);
initf(in);
main(c, v)
-INT c;
+int c;
STRING v[];
{
- register INT rflag = ttyflg;
+ register int rflag = ttyflg;
/* initialise storage allocation */
stdsigs();
BOOL prof;
{
register L_INT mailtime = 0;
- register INT userid;
+ register int userid;
struct stat statb;
/* move input */
}
Ldup(fa, fb)
-register INT fa, fb;
+register int fa, fb;
{
dup2(fa, fb);
close(fa);
typedef char CHAR;
typedef char BOOL;
typedef int UFD;
-typedef int INT;
typedef float REAL;
typedef void *ADDRESS;
typedef long int L_INT;
struct sysnod {
STRING sysnam;
- INT sysval;
+ int sysval;
};
typedef struct sysnod SYSNOD;
/* this node is a proforma for those that follow */
struct trenod {
- INT tretyp;
+ int tretyp;
IOPTR treio;
};
struct dolnod {
DOLPTR dolnxt;
- INT doluse;
+ int doluse;
CHAR dolarg[1];
};
struct forknod {
- INT forktyp;
+ int forktyp;
IOPTR forkio;
TREPTR forktre;
};
struct comnod {
- INT comtyp;
+ int comtyp;
IOPTR comio;
ARGPTR comarg;
ARGPTR comset;
};
struct ifnod {
- INT iftyp;
+ int iftyp;
TREPTR iftre;
TREPTR thtre;
TREPTR eltre;
};
struct whnod {
- INT whtyp;
+ int whtyp;
TREPTR whtre;
TREPTR dotre;
};
struct fornod {
- INT fortyp;
+ int fortyp;
TREPTR fortre;
STRING fornam;
COMPTR forlst;
};
struct swnod {
- INT swtyp;
+ int swtyp;
STRING swarg;
REGPTR swlst;
};
};
struct parnod {
- INT partyp;
+ int partyp;
TREPTR partre;
};
struct lstnod {
- INT lsttyp;
+ int lsttyp;
TREPTR lstlef;
TREPTR lstrit;
};
struct ionod {
- INT iofile;
+ int iofile;
STRING ioname;
IOPTR ionxt;
IOPTR iolst;
setlist(arg, xp)
register ARGPTR arg;
-INT xp;
+int xp;
{
while (arg) {
register STRING s = mactrim(arg->argval);
void setname(argi, xp)
STRING argi;
-INT xp;
+int xp;
{
register STRING argscan = argi;
register NAMPTR n;
}
}
-INT readvar(names)
+int readvar(names)
STRING *names;
{
FILEBLK fb;
register FILE f = &fb;
register CHAR c;
- register INT rc = 0;
+ register int rc = 0;
NAMPTR n = lookup(*names++); /* done now to avoid storage mess */
STKPTR rel = (STKPTR) relstak();
assnum(p, i)
STRING *p;
-INT i;
+int i;
{
itos(i);
replace(p, numbuf);
{
register NAMPTR nscan = namep;
register NAMPTR *prev;
- INT LR;
+ int LR;
if (!chkid(nam)
) {
}
}
-static INT namec;
+static int namec;
void countnam(n)
NAMPTR n;
STRING namid;
STRING namval;
STRING namenv;
- INT namflg;
+ int namflg;
};
prt(t)
L_INT t;
{
- register INT hr, min, sec;
+ register int hr, min, sec;
t += 30;
t /= 60;
}
prn(n)
-INT n;
+int n;
{
itos(n);
prs(numbuf);
{
register char *abuf;
register POS a, i;
- INT pr, d;
+ int pr, d;
abuf = numbuf;
pr = FALSE;
a = n;
STRING icp;
{
register CHAR *cp = icp;
- register INT r = 0;
+ register int r = 0;
register CHAR c;
while ((c = *cp, digit(c)) && c && r >= 0) {
static STRING execs();
static void gsort();
-static INT split();
+static int split();
#define ARGMK 01
-INT errno;
+int errno;
STRING sysmsg[];
/* fault handling */
IOPTR iop;
{
register STRING ion;
- register INT iof, fd;
+ register int iof, fd;
if (iop) {
iof = iop->iofile;
}
}
-INT pathopen(path, name)
+int pathopen(path, name)
register STRING path, name;
{
register UFD f;
/* for processes to be waited for */
#define MAXP 20
-static INT pwlist[MAXP];
-static INT pwc;
+static int pwlist[MAXP];
+static int pwc;
postclr()
{
- register INT *pw = pwlist;
+ register int *pw = pwlist;
while (pw <= &pwlist[pwc]
) {
}
void post(pcsid)
-INT pcsid;
+int pcsid;
{
- register INT *pw = pwlist;
+ register int *pw = pwlist;
if (pcsid) {
while (*pw) {
}
void await(i)
-INT i;
+int i;
{
- INT rc = 0, wx = 0;
- INT w;
- INT ipwc = pwc;
+ int rc = 0, wx = 0;
+ int w;
+ int ipwc = pwc;
post(i);
while (pwc) {
- register INT p;
- register INT sig;
- INT w_hi;
+ register int p;
+ register int sig;
+ int w_hi;
{
- register INT *pw = pwlist;
+ register int *pw = pwlist;
p = wait(&w);
while (pw <= &pwlist[ipwc]
) {
}
STRING *scan(argn)
-INT argn;
+int argn;
{
register ARGPTR argp = (ARGPTR) (Rcheat(gchain) & ~ARGMK);
register STRING *comargn, *comargm;
static void gsort(from, to)
STRING from[], to[];
{
- INT k, m, n;
- register INT i, j;
+ int k, m, n;
+ register int i, j;
if ((n = to - from) <= 1) {
return;
/* Argument list generation */
-INT getarg(ac)
+int getarg(ac)
COMPTR ac;
{
register ARGPTR argp;
- register INT count = 0;
+ register int count = 0;
register COMPTR c;
if (c = ac) {
return (count);
}
-static INT split(s)
+static int split(s)
register STRING s;
{
register STRING argp;
- register INT c;
- INT count = 0;
+ register int c;
+ int count = 0;
for (;;) {
sigchk();
/* ======== storage allocation ======== */
STKPTR getstak(asize)
-INT asize;
+int asize;
{ /* allocate requested stack */
register STKPTR oldstak;
- register INT size;
+ register int size;
size = round(asize, BYTESPERWORD);
oldstak = stakbot;
return (--b);
}
-INT any(c, s)
+int any(c, s)
register CHAR c;
STRING s;
{
return (FALSE);
}
-INT cf(s1, s2)
+int cf(s1, s2)
register STRING s1, s2;
{
while (*s1++ == *s2) {
return (*--s1 - *s2);
}
-INT length(as)
+int length(as)
STRING as;
{
register STRING s;
{
register CHAR c, d;
register CHAR *argp = locstak() + BYTESPERWORD;
- INT alpha = 1;
+ int alpha = 1;
wdnum = 0;
wdset = 0;
readc()
{
register CHAR c;
- register INT len;
+ register int len;
register FILE f;
retry:
static readb()
{
register FILE f = standin;
- register INT len;
+ register int len;
do {
if (trapnote & SIGSET) {
#include "defs.h"
#include "sym.h"
-static INT parent;
+static int parent;
extern SYSTAB commands;
execute(argt, execflg, pf1, pf2)
TREPTR argt;
-INT *pf1, *pf2;
+int *pf1, *pf2;
{
/* `stakbot' is preserved by this routine */
register TREPTR t;
sigchk();
if ((t = argt) && execbrk == 0) {
- register INT treeflgs;
- INT oldexit, type;
+ register int treeflgs;
+ int oldexit, type;
register STRING *com;
treeflgs = t->tretyp;
case TCOM:
{
STRING a1;
- INT argn, internal;
+ int argn, internal;
ARGPTR schain = gchain;
IOPTR io = t->treio;
gchain = 0;
case SYSDOT:
if (a1) {
- register INT f;
+ register int f;
if ((f =
pathopen
;
}
while (*++com) {
- INT i;
+ int i;
if ((i =
stoi
(*com))
;
}
} else { /* print out current traps */
- INT i;
+ int i;
for (i = 0;
i < MAXTRAP;
case SYSSET:
if (a1) {
- INT argc;
+ int argc;
argc =
options(argn,
com);
case TFIL:
{
- INT pv[2];
+ int pv[2];
chkpipe(pv);
if (execute
(((LSTPTR) t)->lstlef, 0, pf1,
case TWH:
case TUN:
{
- INT i = 0;
+ int i = 0;
loopcnt++;
while (execbrk == 0