char *first,
char *second )
{
- register unsigned char *ap, *bp;
+ unsigned char *ap, *bp;
for (ap = (unsigned char *) first, bp = (unsigned char *) second;
*ap && *bp; ap++, bp++) {
- register unsigned char a, b;
+ unsigned char a, b;
if ((a = *ap) != (b = *bp)) {
/* try lowercasing and try again */
char *p;
char dorun, promptflag;
unsigned char freeval, ret_type;
- register int i, j, ret;
+ int i, j, ret;
char * msg;
char * errbuf;
char * errmsg;
#include "msgs.h"
#include <locale.h>
-extern Namval_t *sh_assignok(register Namval_t *np,int add);
+extern Namval_t *sh_assignok(Namval_t *np,int add);
static void PendingDestroy(
char ** pargv ,
Boolean postponePixmaps )
{
- register int i;
- register char *colon, *resource, *val, *p;
+ int i;
+ char *colon, *resource, *val, *p;
XtArgVal argval;
int freeflag, len;
char * errmsg;
int n,
Arg *args )
{
- register int i;
+ int i;
/*
* Free up argument pointers
wtab_t *w, *pw, *wtab;
char *wname, *wclass, *parentid, *var;
Arg args[MAXARGS];
- register int i;
+ int i;
int n;
char * errmsg;
int pargc;
wtab_t *w, *wtab;
char *wname, *wclass, *var;
Arg args[MAXARGS];
- register int i;
+ int i;
int n;
char * errmsg;
int pargc;
char **argv )
{
wtab_t *w;
- register int i;
+ int i;
char * errmsg;
if (argc < 2) {
char **argv )
{
wtab_t *w;
- register int i;
+ int i;
char * errmsg;
if (argc != 2) {
char *argv[] )
{
wtab_t *w;
- register int i;
+ int i;
char * errmsg;
if (argc != 2)
char *argv[] )
{
wtab_t *w;
- register int i;
+ int i;
char * errmsg;
if (argc < 2) {
char **argv )
{
wtab_t *w;
- register int i;
+ int i;
char * errmsg;
if (argc < 2) {
int argc,
char **argv )
{
- register int i, j;
+ int i, j;
int n;
char *arg0 = argv[0];
char *val, *p, *str;
int (*func)() )
{
wtab_t *w;
- register int i;
+ int i;
Widget widgets[MAXARGS];
Cardinal nwidgets;
char * errmsg;
char *argv[] )
{
wtab_t *w;
- register int i;
+ int i;
char * errmsg;
if (argc != 3)
char *argv[] )
{
wtab_t *w;
- register int i;
+ int i;
char * errmsg;
WidgetClass class;
char *argv[] )
{
wtab_t *w;
- register int i;
+ int i;
char * errmsg;
if (argc != 3) {
unsigned int width, height;
char *s;
char *sp;
- register int i;
+ int i;
int mode, parse;
int text = FALSE;
int (*func)();
int argc,
char *argv[] )
{
- register int i, j;
+ int i, j;
int fd;
char *arg0 = argv[0];
char *variable;
char cmdbuf[LINESIZE];
int cmd;
char *p;
- register int i, n, j;
+ int i, n, j;
char * errmsg;
int len;
{
XtCallbackList cb;
char buf[2048];
- register char *p;
+ char *p;
char * errmsg;
Boolean count = 0;
unsigned long *old_v )
{
- register int i, printed = 0;
+ int i, printed = 0;
struct symlist *sym;
unsigned long v;
long *v,
struct envsymbols *env )
{
- register int ret, base;
+ int ret, base;
char *p, *q, *pp;
char nbuf[512];
unsigned char *str,
int len )
{
- register int i;
+ int i;
if (str == NULL)
*buf += lsprintf(*buf, "NULL");
char *str,
int len )
{
- register int i;
+ int i;
unsigned char tempc;
if (str == NULL)
char **str,
int *len )
{
- register int i;
+ int i;
char delim;
int didmalloc = FALSE, getmode;
char cbuf[3]; /* conversion buffer for hex strings */
memtbl_t *(*tbl_find)() )
{
memtbl_t *ntbl;
- register int i = 0;
+ int i = 0;
int skind, delim_type;
long val = 0; /* used for choice selection */
char *np;
memtbl_t *(*tbl_find)() )
{
memtbl_t *ntbl;
- register int i;
+ int i;
long val; /* used for choice selection */
char *np;
int delim = _Delim;
memtbl_t *(*tbl_find)() )
{
memtbl_t *ntbl;
- register int i;
+ int i;
long val; /* used for choice selection */
char *np;
int delim = _Delim;
char *var,
char *val )
{
- register int len;
+ int len;
char tmp[512];
char *set = &tmp[0];
*/
static int
-shipnewer __PARAM__((register char** argv), (argv)) __OTORP__(register char** argv;){
+shipnewer __PARAM__((char** argv), (argv)) __OTORP__(char** argv;){
unsigned long ref;
struct stat st;
static unsigned long
sealfile __PARAM__((char* file, int fd, unsigned long s), (file, fd, s)) __OTORP__(char* file; int fd; unsigned long s;){
- register unsigned char* b;
- register unsigned char* e;
- register int n;
+ unsigned char* b;
+ unsigned char* e;
+ int n;
HASHPART(s, 0);
while ((n = read(fd, buf, sizeof(buf))) > 0)
*/
static int
-shipseal __PARAM__((register char** argv), (argv)) __OTORP__(register char** argv;){
- register char* f;
- register int fd;
+shipseal __PARAM__((char** argv), (argv)) __OTORP__(char** argv;){
+ char* f;
+ int fd;
unsigned long s;
s = 0;
*/
static int
-shipstate __PARAM__((register char** argv), (argv)) __OTORP__(register char** argv;){
- register char* s;
- register int c;
+shipstate __PARAM__((char** argv), (argv)) __OTORP__(char** argv;){
+ char* s;
+ int c;
long ref;
struct stat st;
*/
static int
-shiptime __PARAM__((register char** argv), (argv)) __OTORP__(register char** argv;){
+shiptime __PARAM__((char** argv), (argv)) __OTORP__(char** argv;){
struct stat st;
time_t date;
int
main __PARAM__((int argc, char** argv), (argc, argv)) __OTORP__(int argc; char** argv;){
- register char* s;
- register int i;
+ char* s;
+ int i;
if (!(s = *++argv))
exit(0);
void
-ppfsm __PARAM__((int op, register char* s), (op, s)) __OTORP__(int op; register char* s;){
- register int c;
- register int n;
- register int i;
- register short* rp;
- register struct fsminit* fp;
+ppfsm __PARAM__((int op, char* s), (op, s)) __OTORP__(int op; char* s;){
+ int c;
+ int n;
+ int i;
+ short* rp;
+ struct fsminit* fp;
static int
-sstrlen __PARAM__((register char* s), (s)) __OTORP__(register char* s;){
- register char* b;
+sstrlen __PARAM__((char* s), (s)) __OTORP__(char* s;){
+ char* b;
for (b = s; *s; s++);
return(s - b);
static int
-sstrncmp __PARAM__((register char* s, register char* t, register int n), (s, t, n)) __OTORP__(register char* s; register char* t; register int n;){
- register char* e = s + n;
+sstrncmp __PARAM__((char* s, char* t, int n), (s, t, n)) __OTORP__(char* s; char* t; int n;){
+ char* e = s + n;
while (s < e)
{
static char*
-memcopy __PARAM__((register char* s, register char* t, int n), (s, t, n)) __OTORP__(register char* s; register char* t; int n;){
- register char* e = t + n;
+memcopy __PARAM__((char* s, char* t, int n), (s, t, n)) __OTORP__(char* s; char* t; int n;){
+ char* e = t + n;
while (t < e) *s++ = *t++;
return(s);
static char*
-strcopy __PARAM__((register char* s, register char* t), (s, t)) __OTORP__(register char* s; register char* t;){
+strcopy __PARAM__((char* s, char* t), (s, t)) __OTORP__(char* s; char* t;){
while (*s++ = *t++);
return(s - 1);
}
static char*
-comment __PARAM__((register char* p, register char* s, register int n, int u), (p, s, n, u)) __OTORP__(register char* p; register char* s; register int n; int u;){
- register char* e;
+comment __PARAM__((char* p, char* s, int n, int u), (p, s, n, u)) __OTORP__(char* p; char* s; int n; int u;){
+ char* e;
char* m;
if (!s)
} Notice_t;
static char*
-copyright __PARAM__((register char* p, register char* s), (p, s)) __OTORP__(register char* p; register char* s;){
- register char* v;
- register char* x;
- register int c;
+copyright __PARAM__((char* p, char* s), (p, s)) __OTORP__(char* p; char* s;){
+ char* v;
+ char* x;
+ int c;
int i;
int n;
unsigned long h;
static char*
-number __PARAM__((register char* p, register long n), (p, n)) __OTORP__(register char* p; register long n;){
- register long d;
+number __PARAM__((char* p, long n), (p, n)) __OTORP__(char* p; long n;){
+ long d;
for (d = 1000000; d > 1; d /= 10)
if (n >= d) *p++ = '0' + (n / d) % 10;
static void
proto_error __PARAM__((char* iob, int level, char* msg, char* arg), (iob, level, msg, arg)) __OTORP__(char* iob; int level; char* msg; char* arg;){
- register char* p;
+ char* p;
char buf[1024];
p = strcopy(buf, "proto: ");
if (iob)
{
- register struct proto* proto = (struct proto*)(iob - sizeof(struct proto));
+ struct proto* proto = (struct proto*)(iob - sizeof(struct proto));
if (proto->line)
{
static char*
-linesync __PARAM__((register struct proto* proto, register char* p, register long n), (proto, p, n)) __OTORP__(register struct proto* proto; register char* p; register long n;){
+linesync __PARAM__((struct proto* proto, char* p, long n), (proto, p, n)) __OTORP__(struct proto* proto; char* p; long n;){
if (proto->flags & (1L<<12))
static int
-lex __PARAM__((register struct proto* proto, register long flags), (proto, flags)) __OTORP__(register struct proto* proto; register long flags;){
- register char* ip;
- register char* op;
- register int c;
- register int state;
- register short* rp;
+lex __PARAM__((struct proto* proto, long flags), (proto, flags)) __OTORP__(struct proto* proto; long flags;){
+ char* ip;
+ char* op;
+ int c;
+ int state;
+ short* rp;
char* m;
char* e;
char* t;
void
pppclose __PARAM__((char* iob), (iob)) __OTORP__(char* iob;){
- register struct proto* proto = (struct proto*)(iob - sizeof(struct proto));
+ struct proto* proto = (struct proto*)(iob - sizeof(struct proto));
if (proto->flags & (1L<<15)) close(proto->fd);
free((char*)proto);
char*
pppopen __PARAM__((char* file, int fd, char* notice, int flags), (file, fd, notice, flags)) __OTORP__(char* file; int fd; char* notice; int flags;){
- register struct proto* proto;
- register char* iob;
- register long n;
- register char* s;
+ struct proto* proto;
+ char* iob;
+ long n;
+ char* s;
int pragma;
char* b;
int
pppread __PARAM__((char* iob), (iob)) __OTORP__(char* iob;){
- register struct proto* proto = (struct proto*)(iob - sizeof(struct proto));
- register int n;
+ struct proto* proto = (struct proto*)(iob - sizeof(struct proto));
+ int n;
if (proto->flags & (1L<<17))
{
if (proto->flags & (1L<<29))
{
- register char* ip = proto->ip;
- register char* op = proto->ob;
- register char* ep = proto->ob + proto->oz - 2;
+ char* ip = proto->ip;
+ char* op = proto->ob;
+ char* ep = proto->ob + proto->oz - 2;
if (!*ip)
{
* insert timeout item on current given list in sorted order
*/
static __V_ *time_add __PARAM__((struct tevent *item, __V_ *list), (item, list)) __OTORP__(struct tevent *item; __V_ *list;){
- register struct tevent *tp = (struct tevent*)list;
+ struct tevent *tp = (struct tevent*)list;
if(!tp || item->milli < tp->milli)
{
item->next = tp;
/*
* delete timeout item from current given list, delete timer
*/
-static __V_ *time_delete __PARAM__((register struct tevent *item, __V_ *list), (item, list)) __OTORP__(register struct tevent *item; __V_ *list;){
- register struct tevent *tp = (struct tevent*)list;
+static __V_ *time_delete __PARAM__((struct tevent *item, __V_ *list), (item, list)) __OTORP__(struct tevent *item; __V_ *list;){
+ struct tevent *tp = (struct tevent*)list;
if(item==tp)
list = (__V_*)tp->next;
else
}
static void print_alarms __PARAM__((__V_ *list), (list)) __OTORP__(__V_ *list;){
- register struct tevent *tp = (struct tevent*)list;
+ struct tevent *tp = (struct tevent*)list;
while(tp)
{
if(tp->timeout)
{
- register char *name = nv_name(tp->node);
+ char *name = nv_name(tp->node);
if(tp->flags&R_FLAG)
{
double d = tp->milli;
}
static void trap_timeout __PARAM__((__V_* handle), (handle)) __OTORP__(__V_* handle;){
- register struct tevent *tp = (struct tevent*)handle;
+ struct tevent *tp = (struct tevent*)handle;
sh.trapnote |= SH_SIGTRAP;
if(!(tp->flags&R_FLAG))
tp->timeout = 0;
}
void sh_timetraps __PARAM__((void), ()){
- register struct tevent *tp, *tpnext;
- register struct tevent *tptop;
+ struct tevent *tp, *tpnext;
+ struct tevent *tptop;
while(1)
{
sh.sigflag[SIGALRM] &= ~SH_SIGTRAP;
static char *setdisc __PARAM__((Namval_t *np, const char *event, Namval_t* action, Namfun_t
*fp), (np, event, action, fp)) __OTORP__(Namval_t *np; const char *event; Namval_t* action; Namfun_t
*fp;){
- register struct tevent *tp = (struct tevent*)fp;
+ struct tevent *tp = (struct tevent*)fp;
if(!event)
return(action?"":(char*)ALARM);
if(strcmp(event,ALARM)!=0)
* catch assignments and set alarm traps
*/
static void putval __PARAM__((Namval_t* np, const char* val, int flag, Namfun_t* fp), (np, val, flag, fp)) __OTORP__(Namval_t* np; const char* val; int flag; Namfun_t* fp;){
- register struct tevent *tp;
- register double d;
+ struct tevent *tp;
+ double d;
if(val)
{
double now;
};
int b_alarm __PARAM__((int argc,char *argv[],__V_ *extra), (argc, argv, extra)) __OTORP__(int argc;char *argv[];__V_ *extra;){
- register int n,rflag=0;
- register Namval_t *np;
- register struct tevent *tp;
+ int n,rflag=0;
+ Namval_t *np;
+ struct tevent *tp;
NOT_USED(extra);
while (n = optget(argv, sh_optalarm)) switch (n)
{
#include <ls.h>
int b_cd __PARAM__((int argc, char *argv[],__V_ *extra), (argc, argv, extra)) __OTORP__(int argc; char *argv[];__V_ *extra;){
- register char *dir, *cdpath="";
- register const char *dp;
+ char *dir, *cdpath="";
+ const char *dp;
int saverrno=0;
int rval,flag = (sh_isoption(SH_PHYSICAL)!=0);
char *oldpwd;
}
if(!flag)
{
- register char *cp;
+ char *cp;
stakseek(PATH_MAX+PATH_OFFSET);
#ifdef SHOPT_FS_3D
if(!(cp = pathcanon(stakptr(PATH_OFFSET),PATH_DOTDOT)))
}
int b_pwd __PARAM__((int argc, char *argv[],__V_ *extra), (argc, argv, extra)) __OTORP__(int argc; char *argv[];__V_ *extra;){
- register int n, flag = (sh_isoption(SH_PHYSICAL)!=0);
- register char *cp;
+ int n, flag = (sh_isoption(SH_PHYSICAL)!=0);
+ char *cp;
NOT_USED(extra);
NOT_USED(argc);
while((n = optget(argv,sh_optpwd))) switch(n)
/*
* return and exit
*/
-int b_ret_exit __PARAM__((register int n, register char *argv[],__V_ *extra), (n, argv, extra)) __OTORP__(register int n; register char *argv[];__V_ *extra;){
+int b_ret_exit __PARAM__((int n, char *argv[],__V_ *extra), (n, argv, extra)) __OTORP__(int n; char *argv[];__V_ *extra;){
struct checkpt *pp = (struct checkpt*)sh.jmplist;
- register char *arg;
+ char *arg;
NOT_USED(extra);
while((n = optget(argv,sh_optcflow))) switch(n)
{
/*
* break and continue
*/
-int b_brk_cont __PARAM__((register int n, register char *argv[],__V_ *extra), (n, argv, extra)) __OTORP__(register int n; register char *argv[];__V_ *extra;){
+int b_brk_cont __PARAM__((int n, char *argv[],__V_ *extra), (n, argv, extra)) __OTORP__(int n; char *argv[];__V_ *extra;){
char *arg;
- register int cont= **argv=='c';
+ int cont= **argv=='c';
NOT_USED(extra);
while((n = optget(argv,sh_optcflow))) switch(n)
{
#define next_config(p) ((Shtable_t*)((char*)(p) + sizeof(*shtab_config)))
#define MIN_LEN 20
-int b_getconf __PARAM__((register int argc, char *argv[]), (argc, argv)) __OTORP__(register int argc; char *argv[];){
- register int m,n;
- register long val;
- register const char *name, *path="";
+int b_getconf __PARAM__((int argc, char *argv[]), (argc, argv)) __OTORP__(int argc; char *argv[];){
+ int m,n;
+ long val;
+ const char *name, *path="";
int offset = staktell();
const Shtable_t *tp = shtab_config;
error_info.id = argv[0];
#include "builtins.h"
int b_getopts __PARAM__((int argc,char *argv[],__V_ *extra), (argc, argv, extra)) __OTORP__(int argc;char *argv[];__V_ *extra;){
- register char *options=error_info.context->id;
- register Namval_t *np;
- register int flag, mode, r=0;
+ char *options=error_info.context->id;
+ Namval_t *np;
+ int flag, mode, r=0;
static char value[2], key[2];
NOT_USED(extra);
while((flag = optget(argv,sh_optgetopts))) switch(flag)
static void hist_subst __PROTO__((const char*, int fd, char*));
int b_hist __PARAM__((int argc,char *argv[], __V_ *extra), (argc, argv, extra)) __OTORP__(int argc;char *argv[]; __V_ *extra;){
- register History_t *hp;
- register char *arg;
- register int flag,fdo;
+ History_t *hp;
+ char *arg;
+ int flag,fdo;
struct stat statb;
time_t before;
Sfio_t *outfile;
*/
static void hist_subst __PARAM__((const char *command,int fd,char *replace), (command, fd, replace)) __OTORP__(const char *command;int fd;char *replace;){
- register char *newp=replace;
- register char *sp;
- register int c;
+ char *newp=replace;
+ char *sp;
+ int c;
off_t size;
char *string;
while(*++newp != '='); /* skip to '=' */
static char *arg0;
int b_exec __PARAM__((int argc,char *argv[], __V_ *extra), (argc, argv, extra)) __OTORP__(int argc;char *argv[]; __V_ *extra;){
- register int n;
+ int n;
sh.st.ioset = 0;
clear = 0;
NOT_USED(extra);
return(0);
}
-static void noexport __PARAM__((register Namval_t* np), (np)) __OTORP__(register Namval_t* np;){
+static void noexport __PARAM__((Namval_t* np), (np)) __OTORP__(Namval_t* np;){
nv_offattr(np,NV_EXPORT);
}
error(ERROR_exit(1),e_restricted,argv[0]);
else
{
- register struct argnod *arg=sh.envlist;
- register Namval_t* np;
- register char *cp;
+ struct argnod *arg=sh.envlist;
+ Namval_t* np;
+ char *cp;
if(sh.subshell)
sh_subfork();
if(clear)
}
int b_let __PARAM__((int argc,char *argv[],__V_ *extra), (argc, argv, extra)) __OTORP__(int argc;char *argv[];__V_ *extra;){
- register int r;
- register char *arg;
+ int r;
+ char *arg;
NOT_USED(argc);
NOT_USED(extra);
while (r = optget(argv,sh_optlet)) switch (r)
}
int b_eval __PARAM__((int argc,char *argv[], __V_ *extra), (argc, argv, extra)) __OTORP__(int argc;char *argv[]; __V_ *extra;){
- register int r;
+ int r;
NOT_USED(argc);
NOT_USED(extra);
while (r = optget(argv,sh_opteval)) switch (r)
return(sh.exitval);
}
-int b_dot_cmd __PARAM__((register int n,char *argv[],__V_* extra), (n, argv, extra)) __OTORP__(register int n;char *argv[];__V_* extra;){
- register char *script;
- register Namval_t *np;
- register int jmpval;
+int b_dot_cmd __PARAM__((int n,char *argv[],__V_* extra), (n, argv, extra)) __OTORP__(int n;char *argv[];__V_* extra;){
+ char *script;
+ Namval_t *np;
+ int jmpval;
int fd;
struct dolnod *argsave=0, *saveargfor;
char **saveargv;
/*
* null, true command
*/
-int b_true __PARAM__((int argc,register char *argv[],__V_ *extra), (argc, argv, extra)) __OTORP__(int argc;register char *argv[];__V_ *extra;){
+int b_true __PARAM__((int argc,char *argv[],__V_ *extra), (argc, argv, extra)) __OTORP__(int argc;char *argv[];__V_ *extra;){
NOT_USED(argc);
NOT_USED(argv[0]);
NOT_USED(extra);
/*
* false command
*/
-int b_false __PARAM__((int argc,register char *argv[], __V_ *extra), (argc, argv, extra)) __OTORP__(int argc;register char *argv[]; __V_ *extra;){
+int b_false __PARAM__((int argc,char *argv[], __V_ *extra), (argc, argv, extra)) __OTORP__(int argc;char *argv[]; __V_ *extra;){
NOT_USED(argc);
NOT_USED(argv[0]);
NOT_USED(extra);
return(1);
}
-int b_shift __PARAM__((register int n, register char *argv[], __V_ *extra), (n, argv, extra)) __OTORP__(register int n; register char *argv[]; __V_ *extra;){
- register char *arg;
+int b_shift __PARAM__((int n, char *argv[], __V_ *extra), (n, argv, extra)) __OTORP__(int n; char *argv[]; __V_ *extra;){
+ char *arg;
NOT_USED(extra);
while((n = optget(argv,sh_optcflow))) switch(n)
{
return(0);
}
-int b_wait __PARAM__((register int n,register char *argv[],__V_ *extra), (n, argv, extra)) __OTORP__(register int n;register char *argv[];__V_ *extra;){
+int b_wait __PARAM__((int n,char *argv[],__V_ *extra), (n, argv, extra)) __OTORP__(int n;char *argv[];__V_ *extra;){
NOT_USED(extra);
while((n = optget(argv,sh_optjoblist))) switch(n)
{
}
#ifdef JOBS
-int b_bg_fg __PARAM__((register int n,register char *argv[],__V_ *extra), (n, argv, extra)) __OTORP__(register int n;register char *argv[];__V_ *extra;){
- register int flag = **argv;
+int b_bg_fg __PARAM__((int n,char *argv[],__V_ *extra), (n, argv, extra)) __OTORP__(int n;char *argv[];__V_ *extra;){
+ int flag = **argv;
NOT_USED(extra);
while((n = optget(argv,sh_optjoblist))) switch(n)
{
return(sh.exitval);
}
-int b_jobs __PARAM__((register int n,char *argv[],__V_ *extra), (n, argv, extra)) __OTORP__(register int n;char *argv[];__V_ *extra;){
- register int flag = 0;
+int b_jobs __PARAM__((int n,char *argv[],__V_ *extra), (n, argv, extra)) __OTORP__(int n;char *argv[];__V_ *extra;){
+ int flag = 0;
NOT_USED(extra);
while((n = optget(argv,sh_optjobs))) switch(n)
{
* setuniv() calls.
*/
int b_universe __PARAM__((int argc, char *argv[],__V_ *extra), (argc, argv, extra)) __OTORP__(int argc; char *argv[];__V_ *extra;){
- register char *arg;
- register int n;
+ char *arg;
+ int n;
NOT_USED(extra);
while((n = optget(argv,sh_optuniverse))) switch(n)
{
#endif /* cmd_universe */
#ifdef SHOPT_FS_3D
- int b_vpath_map __PARAM__((register int argc,char *argv[], __V_ *extra), (argc, argv, extra)) __OTORP__(register int argc;char *argv[]; __V_ *extra;){
- register int flag, n;
- register const char *optstr;
- register char *vend;
+ int b_vpath_map __PARAM__((int argc,char *argv[], __V_ *extra), (argc, argv, extra)) __OTORP__(int argc;char *argv[]; __V_ *extra;){
+ int flag, n;
+ const char *optstr;
+ char *vend;
NOT_USED(extra);
if(argv[0][1]=='p')
{
/* This mess is because /bin/echo on BSD is different */
if(!sh.universe)
{
- register char *universe;
+ char *universe;
if(universe=astconf("_AST_UNIVERSE",0,0))
bsd_univ = (strcmp(universe,"ucb")==0);
sh.universe = 1;
*/
int b_print __PARAM__((int argc, char *argv[], __V_ *extra), (argc, argv, extra)) __OTORP__(int argc; char *argv[]; __V_ *extra;){
- register Sfio_t *outfile;
- register int n, fd = 1;
+ Sfio_t *outfile;
+ int n, fd = 1;
const char *msg = e_file+4;
char *format = 0;
int sflag = 0, nflag, rflag;
*/
int sh_echolist __PARAM__((Sfio_t *outfile, int raw, char *argv[]), (outfile, raw, argv)) __OTORP__(Sfio_t *outfile; int raw; char *argv[];){
- register char *cp;
- register int n;
+ char *cp;
+ int n;
while(!cescape && (cp= *argv++))
{
if(!raw && (n=fmtvecho(cp))>=0)
static char *genformat __PARAM__((char *format), (format)) __OTORP__(char *format;){
- register char *fp;
+ char *fp;
stakseek(0);
stakputs(preformat);
stakputs(format);
}
static int getarg __PARAM__((int format,union types_t *value), (format, value)) __OTORP__(int format;union types_t *value;){
- register char *argp = *nextarg;
+ char *argp = *nextarg;
char *lastchar = "";
- register int neg = 0;
+ int neg = 0;
if(!argp)
{
switch(format)
* This routine adds new % escape sequences to printf
*/
static int extend __PARAM__((char *invalue,int format,int precis,char **outval), (invalue, format, precis, outval)) __OTORP__(char *invalue;int format;int precis;char **outval;){
- register int n;
+ int n;
NOT_USED(precis);
switch(format)
{
static int fmtvecho __PARAM__((const char *string), (string)) __OTORP__(const char *string;){
static char *nullarg;
- register const char *cp = string, *cpmax;
- register int c;
- register int offset = staktell();
+ const char *cp = string, *cpmax;
+ int c;
+ int offset = staktell();
int chlen;
if (MB_CUR_MAX > 1)
{
#define D_FLAG 6 /* must be number of bits for all flags */
int b_read __PARAM__((int argc,char *argv[], __V_ *extra), (argc, argv, extra)) __OTORP__(int argc;char *argv[]; __V_ *extra;){
- register char *name;
- register int r, flags=0, fd=0;
+ char *name;
+ int r, flags=0, fd=0;
long timeout = 1000*sh.tmout;
int save_prompt;
NOT_USED(argc);
*/
int sh_readline __PARAM__((char **names, int fd, int flags,long timeout), (names, fd, flags, timeout)) __OTORP__(char **names; int fd; int flags;long timeout;){
- register int c;
- register unsigned char *cp;
- register Namval_t *np;
- register char *name, *val;
- register Sfio_t *iop;
+ int c;
+ unsigned char *cp;
+ Namval_t *np;
+ char *name, *val;
+ Sfio_t *iop;
char *ifs;
unsigned char *cpmax;
char was_escape = 0;
if(!name && *val)
{
/* strip off trailing delimiters */
- register char *cp = val + strlen(val);
- register int n;
+ char *cp = val + strlen(val);
+ int n;
while((n=sh.ifstable[*--cp])==S_DELIM || n==S_SPACE);
cp[1] = 0;
}
# undef _lib_poll
#endif /* _lib_poll_notimer */
-int b_sleep __PARAM__((register int argc,char *argv[],__V_ *extra), (argc, argv, extra)) __OTORP__(register int argc;char *argv[];__V_ *extra;){
- register char *cp;
- register double d;
+int b_sleep __PARAM__((int argc,char *argv[],__V_ *extra), (argc, argv, extra)) __OTORP__(int argc;char *argv[];__V_ *extra;){
+ char *cp;
+ double d;
time_t tloc = 0;
NOT_USED(extra);
while((argc = optget(argv,sh_optsleep))) switch(argc)
*/
void sh_delay __PARAM__((double t), (t)) __OTORP__(double t;){
- register int n = (int)t;
+ int n = (int)t;
#ifdef _lib_poll
struct pollfd fd;
if(t<=0)
static char **av;
int b_test __PARAM__((int argc, char *argv[],__V_ *extra), (argc, argv, extra)) __OTORP__(int argc; char *argv[];__V_ *extra;){
- register char *cp = argv[0];
- register int not;
+ char *cp = argv[0];
+ int not;
NOT_USED(extra);
av = argv;
ap = 1;
/* fall through */
case 4:
{
- register int op = sh_lookup(cp=argv[2],shtab_testops);
+ int op = sh_lookup(cp=argv[2],shtab_testops);
if(op&TEST_BINOP)
break;
if(!op)
* flag is 1 when in parenthesis
* flag is 2 when evaluating -a
*/
-static int expr __PARAM__((int register flag), (flag)) __OTORP__(int register flag;){
- register int r;
- register char *p;
+static int expr __PARAM__((int flag), (flag)) __OTORP__(int flag;){
+ int r;
+ char *p;
r = e3();
while(ap < ac)
{
static e3 __PARAM__((void), ()){
- register char *arg, *cp;
- register int op;
+ char *arg, *cp;
+ int op;
char *binop;
arg=nxtarg(0);
if(c_eq(arg, '!'))
return(test_binop(op,arg,cp));
}
-int test_unop __PARAM__((register int op,register const char *arg), (op, arg)) __OTORP__(register int op;register const char *arg;){
+int test_unop __PARAM__((int op,const char *arg), (op, arg)) __OTORP__(int op;const char *arg;){
switch(op)
{
case 'r':
case 'V':
#ifdef SHOPT_FS_3D
{
- register int offset = staktell();
+ int offset = staktell();
if(stat(arg,&statb)<0 || !S_ISREG(statb.st_mode))
return(0);
/* add trailing / */
case 'H':
#ifdef S_ISCDF
{
- register int offset = staktell();
+ int offset = staktell();
if(test_stat(arg,&statb)>=0 && S_ISCDF(statb.st_mode))
return(1);
stakputs(arg);
}
}
-test_binop __PARAM__((register int op,const char *left,const char *right), (op, left, right)) __OTORP__(register int op;const char *left;const char *right;){
- register double lnum,rnum;
+test_binop __PARAM__((int op,const char *left,const char *right), (op, left, right)) __OTORP__(int op;const char *left;const char *right;){
+ double lnum,rnum;
if(op&TEST_ARITH)
{
lnum = sh_arith(left);
* The static buffer statb is shared with test_mode.
*/
-sh_access __PARAM__((register const char *name, register int mode), (name, mode)) __OTORP__(register const char *name; register int mode;){
+sh_access __PARAM__((const char *name, int mode), (name, mode)) __OTORP__(const char *name; int mode;){
if(*name==0)
return(-1);
if(strmatch(name,(char*)e_devfdNN))
{
static int maxgroups = 0;
gid_t *groups;
- register int n;
+ int n;
if(maxgroups==0)
{
/* first time */
* The mode bits are zero if the file doesn't exist.
*/
-static int test_mode __PARAM__((register const char *file), (file)) __OTORP__(register const char *file;){
+static int test_mode __PARAM__((const char *file), (file)) __OTORP__(const char *file;){
if(file && (*file==0 || test_stat(file,&statb)<0))
return(0);
return(statb.st_mode);
static void sig_list __PROTO__((int));
int b_trap __PARAM__((int argc,char *argv[],__V_ *extra), (argc, argv, extra)) __OTORP__(int argc;char *argv[];__V_ *extra;){
- register char *arg = argv[1];
- register int sig, pflag = 0;
+ char *arg = argv[1];
+ int sig, pflag = 0;
NOT_USED(argc);
NOT_USED(extra);
while (sig = optget(argv, sh_opttrap)) switch (sig)
error(ERROR_usage(2),optusage((char*)0));
if(arg = *argv)
{
- register int clear;
+ int clear;
char *action = arg;
if(!pflag)
{
}
int b_kill __PARAM__((int argc,char *argv[],__V_ *extra), (argc, argv, extra)) __OTORP__(int argc;char *argv[];__V_ *extra;){
- register char *signame;
- register int sig=SIGTERM, flag=0, n;
+ char *signame;
+ int sig=SIGTERM, flag=0, n;
NOT_USED(argc);
NOT_USED(extra);
while((n = optget(argv,sh_optkill))) switch(n)
*/
static int sig_number __PARAM__((const char *string), (string)) __OTORP__(const char *string;){
- register int n;
+ int n;
char *last;
if(isdigit(*string))
{
}
else
{
- register int c;
+ int c;
n = staktell();
do
{
* if <flag> is zero, then print all signal names
* if <flag> is negative, then print all traps
*/
-static void sig_list __PARAM__((register int flag), (flag)) __OTORP__(register int flag;){
- register const struct shtable2 *tp;
- register int sig = sh.sigmax+1;
+static void sig_list __PARAM__((int flag), (flag)) __OTORP__(int flag;){
+ const struct shtable2 *tp;
+ int sig = sh.sigmax+1;
const char *names[SH_TRAP];
const char *traps[SH_DEBUGTRAP+1];
else if(flag<0)
{
/* print the traps */
- register char *trap,*sname,**trapcom;
+ char *trap,*sname,**trapcom;
sig = sh.st.trapmax;
/* use parent traps if otrapcom is set (for $(trap) */
trapcom = (sh.st.otrapcom?sh.st.otrapcom:sh.st.trapcom);
*/
int b_read_export __PARAM__((int argc,char *argv[],__V_ *extra), (argc, argv, extra)) __OTORP__(int argc;char *argv[];__V_ *extra;){
- register int flag;
+ int flag;
char *command = argv[0];
NOT_USED(argc);
NOT_USED(extra);
}
-int b_alias __PARAM__((int argc,register char *argv[],__V_ *extra), (argc, argv, extra)) __OTORP__(int argc;register char *argv[];__V_ *extra;){
- register unsigned flag = NV_ARRAY|NV_NOSCOPE|NV_ASSIGN;
- register Hashtab_t *troot = sh.alias_tree;
- register int n;
+int b_alias __PARAM__((int argc,char *argv[],__V_ *extra), (argc, argv, extra)) __OTORP__(int argc;char *argv[];__V_ *extra;){
+ unsigned flag = NV_ARRAY|NV_NOSCOPE|NV_ASSIGN;
+ Hashtab_t *troot = sh.alias_tree;
+ int n;
NOT_USED(argc);
NOT_USED(extra);
prefix=0;
}
-int b_typeset __PARAM__((int argc,register char *argv[],__V_ *extra), (argc, argv, extra)) __OTORP__(int argc;register char *argv[];__V_ *extra;){
- register int flag = NV_VARNAME|NV_ASSIGN;
- register int n;
+int b_typeset __PARAM__((int argc,char *argv[],__V_ *extra), (argc, argv, extra)) __OTORP__(int argc;char *argv[];__V_ *extra;){
+ int flag = NV_VARNAME|NV_ASSIGN;
+ int n;
Hashtab_t *troot = sh.var_tree;
int isfloat = 0;
NOT_USED(argc);
return(b_common(argv,flag,troot));
}
-static int b_common __PARAM__((char **argv,register int flag,Hashtab_t *troot), (argv, flag, troot)) __OTORP__(char **argv;register int flag;Hashtab_t *troot;){
- register char *name;
+static int b_common __PARAM__((char **argv,int flag,Hashtab_t *troot), (argv, flag, troot)) __OTORP__(char **argv;int flag;Hashtab_t *troot;){
+ char *name;
int nvflags=(flag&(NV_ARRAY|NV_NOSCOPE|NV_VARNAME|NV_IDENT|NV_ASSIGN));
int r=0, ref=0;
#ifdef SHOPT_OO
}
while(name = *++argv)
{
- register unsigned newflag;
- register Namval_t *np;
+ unsigned newflag;
+ Namval_t *np;
unsigned curflag;
if(troot == sh.fun_tree)
{
* adding builtins requires dlopen() interface
*/
int b_builtin __PARAM__((int argc,char *argv[],__V_ *extra), (argc, argv, extra)) __OTORP__(int argc;char *argv[];__V_ *extra;){
- register char *arg=0, *name;
- register int n, r=0, flag=0;
- register Namval_t *np;
+ char *arg=0, *name;
+ int n, r=0, flag=0;
+ Namval_t *np;
int dlete=0;
static int maxlib, nlib;
Fptr_t addr;
return(r);
}
-int b_set __PARAM__((int argc,register char *argv[],__V_ *extra), (argc, argv, extra)) __OTORP__(int argc;register char *argv[];__V_ *extra;){
+int b_set __PARAM__((int argc,char *argv[],__V_ *extra), (argc, argv, extra)) __OTORP__(int argc;char *argv[];__V_ *extra;){
NOT_USED(extra);
prefix=0;
if(argv[1])
* Non-existent items being deleted give non-zero exit status
*/
-int b_unalias __PARAM__((int argc,register char *argv[],__V_ *extra), (argc, argv, extra)) __OTORP__(int argc;register char *argv[];__V_ *extra;){
+int b_unalias __PARAM__((int argc,char *argv[],__V_ *extra), (argc, argv, extra)) __OTORP__(int argc;char *argv[];__V_ *extra;){
NOT_USED(extra);
return(b_unall(argc,argv,sh.alias_tree));
}
-int b_unset __PARAM__((int argc,register char *argv[],__V_ *extra), (argc, argv, extra)) __OTORP__(int argc;register char *argv[];__V_ *extra;){
+int b_unset __PARAM__((int argc,char *argv[],__V_ *extra), (argc, argv, extra)) __OTORP__(int argc;char *argv[];__V_ *extra;){
NOT_USED(extra);
return(b_unall(argc,argv,sh.var_tree));
}
-static int b_unall __PARAM__((int argc, char **argv, register Hashtab_t *troot), (argc, argv, troot)) __OTORP__(int argc; char **argv; register Hashtab_t *troot;){
- register Namval_t *np;
- register struct slnod *slp;
- register const char *name;
- register int r;
+static int b_unall __PARAM__((int argc, char **argv, Hashtab_t *troot), (argc, argv, troot)) __OTORP__(int argc; char **argv; Hashtab_t *troot;){
+ Namval_t *np;
+ struct slnod *slp;
+ const char *name;
+ int r;
int nflag = 0;
int all=0;
NOT_USED(argc);
else if(slp=(struct slnod*)(np->nvenv))
{
/* free function definition */
- register char *cp= strrchr(name,'.');
+ char *cp= strrchr(name,'.');
if(cp)
{
Namval_t *npv;
* print out the name and value of a name-value pair <np>
*/
-static int print_namval __PARAM__((Sfio_t *file,register Namval_t *np,register int flag), (file, np, flag)) __OTORP__(Sfio_t *file;register Namval_t *np;register int flag;){
- register char *cp;
+static int print_namval __PARAM__((Sfio_t *file,Namval_t *np,int flag), (file, np, flag)) __OTORP__(Sfio_t *file;Namval_t *np;int flag;){
+ char *cp;
sh_sigcheck();
if(flag)
flag = '\n';
}
if(cp=nv_getval(np))
{
- register Namarr_t *ap;
+ Namarr_t *ap;
sfputr(file,sh_fmtq(nv_name(np)),-1);
if(!flag)
{
* format initialization list given a list of assignments <argp>
*/
static void genvalue __PARAM__((struct argnod *argp, const char *prefix, int n, int indent), (argp, prefix, n, indent)) __OTORP__(struct argnod *argp; const char *prefix; int n; int indent;){
- register struct argnod *ap;
- register char *cp,*nextcp;
- register int m,isarray;
+ struct argnod *ap;
+ char *cp,*nextcp;
+ int m,isarray;
Namval_t *np;
if(n==0)
m = strlen(prefix);
/*
* walk the virtual tree and print or delete name-value pairs
*/
-static char *walk_tree __PARAM__((register Namval_t *np, int dlete), (np, dlete)) __OTORP__(register Namval_t *np; int dlete;){
+static char *walk_tree __PARAM__((Namval_t *np, int dlete), (np, dlete)) __OTORP__(Namval_t *np; int dlete;){
static Sfio_t *out;
int n;
Fcin_t save;
int savtop = staktell();
char *savptr = stakfreeze(0);
- register struct argnod *ap;
+ struct argnod *ap;
struct argnod *arglist=0;
char *name = nv_name(np);
stakseek(ARGVAL);
/*
* get discipline for compound initializations
*/
-static char *get_tree __PARAM__((register Namval_t *np, Namfun_t *fp), (np, fp)) __OTORP__(register Namval_t *np; Namfun_t *fp;){
+static char *get_tree __PARAM__((Namval_t *np, Namfun_t *fp), (np, fp)) __OTORP__(Namval_t *np; Namfun_t *fp;){
NOT_USED(fp);
return(walk_tree(np,0));
}
/*
* put discipline for compound initializations
*/
-static void put_tree __PARAM__((register Namval_t *np, const char *val, int flags,Namfun_t *fp), (np, val, flags, fp)) __OTORP__(register Namval_t *np; const char *val; int flags;Namfun_t *fp;){
+static void put_tree __PARAM__((Namval_t *np, const char *val, int flags,Namfun_t *fp), (np, val, flags, fp)) __OTORP__(Namval_t *np; const char *val; int flags;Namfun_t *fp;){
walk_tree(np,1);
if(fp = nv_stack(np,NIL(Namfun_t*)))
{
/*
* Insert discipline to cause $x to print current tree
*/
-void nv_setvtree __PARAM__((register Namval_t *np), (np)) __OTORP__(register Namval_t *np;){
- register Namfun_t *nfp = newof(NIL(__V_*),Namfun_t,1,0);
+void nv_setvtree __PARAM__((Namval_t *np), (np)) __OTORP__(Namval_t *np;){
+ Namfun_t *nfp = newof(NIL(__V_*),Namfun_t,1,0);
nfp->disc = &treedisc;
nv_stack(np, nfp);
}
/*
* print the attributes of name value pair give by <np>
*/
-static void print_attribute __PARAM__((register Namval_t *np), (np)) __OTORP__(register Namval_t *np;){
- register const Shtable_t *tp;
- register char *cp;
- register unsigned val;
- register unsigned mask;
+static void print_attribute __PARAM__((Namval_t *np), (np)) __OTORP__(Namval_t *np;){
+ const Shtable_t *tp;
+ char *cp;
+ unsigned val;
+ unsigned mask;
#ifdef SHOPT_OO
Namval_t *nq;
char *cclass=0;
*/
static void print_scan __PARAM__((Sfio_t *file, int flag, Hashtab_t *root, int option), (file, flag, root, option)) __OTORP__(Sfio_t *file; int flag; Hashtab_t *root; int option;){
- register char **argv;
- register Namval_t *np;
- register int namec;
+ char **argv;
+ Namval_t *np;
+ int namec;
Namval_t *onp = 0;
flag &= ~NV_ASSIGN;
scanmask = flag;
/*
* The inverse of creating a reference node
*/
-static void unref __PARAM__((register Namval_t *np), (np)) __OTORP__(register Namval_t *np;){
+static void unref __PARAM__((Namval_t *np), (np)) __OTORP__(Namval_t *np;){
if(!nv_isattr(np,NV_REF))
return;
nv_offattr(np,NV_NOFREE|NV_REF);
#define SOFT 2
int b_ulimit __PARAM__((int argc,char *argv[],__V_ *extra), (argc, argv, extra)) __OTORP__(int argc;char *argv[];__V_ *extra;){
- register char *limit;
- register int flag = 0, mode=0, n;
+ char *limit;
+ int flag = 0, mode=0, n;
#ifdef _lib_getrlimit
struct rlimit rlp;
#endif /* _lib_getrlimit */
#include "builtins.h"
int b_umask __PARAM__((int argc,char *argv[],__V_ *extra), (argc, argv, extra)) __OTORP__(int argc;char *argv[];__V_ *extra;){
- register char *mask;
- register int flag = 0, sflag = 0;
+ char *mask;
+ int flag = 0, sflag = 0;
NOT_USED(extra);
while((argc = optget(argv,sh_optumask))) switch(argc)
{
argv += opt_index;
if(mask = *argv)
{
- register int c;
+ int c;
if(isdigit(*mask))
{
while(c = *mask++)
* In this case return 0 when -v or -V or unknown option, otherwise
* the shift count to the command is returned
*/
-int b_command __PARAM__((register int argc,char *argv[],__V_ *extra), (argc, argv, extra)) __OTORP__(register int argc;char *argv[];__V_ *extra;){
- register int n, flags=0;
+int b_command __PARAM__((int argc,char *argv[],__V_ *extra), (argc, argv, extra)) __OTORP__(int argc;char *argv[];__V_ *extra;){
+ int n, flags=0;
NOT_USED(extra);
opt_index = opt_char = 0;
while((n = optget(argv,sh_optcommand))) switch(n)
* for the whence command
*/
int b_whence __PARAM__((int argc,char *argv[],__V_ *extra), (argc, argv, extra)) __OTORP__(int argc;char *argv[];__V_ *extra;){
- register int flags=0, n;
+ int flags=0, n;
NOT_USED(argc);
NOT_USED(extra);
if(*argv[0]=='t')
return(whence(argv, flags));
}
-static int whence __PARAM__((char **argv, register int flags), (argv, flags)) __OTORP__(char **argv; register int flags;){
- register const char *name;
- register Namval_t *np;
- register const char *cp;
- register aflag,r=0;
- register const char *msg;
+static int whence __PARAM__((char **argv, int flags), (argv, flags)) __OTORP__(char **argv; int flags;){
+ const char *name;
+ Namval_t *np;
+ const char *cp;
+ int aflag,r=0;
+ const char *msg;
int notrack = 1;
while(name= *argv++)
{
* if <str> is equal to <newstr> returns <str>+strlen(<str>)+1
* otherwise returns <str>+strlen(<str>)
*/
-static char *overlay __PARAM__((register char *str,register const char *newstr), (str, newstr)) __OTORP__(register char *str;register const char *newstr;){
+static char *overlay __PARAM__((char *str,const char *newstr), (str, newstr)) __OTORP__(char *str;const char *newstr;){
while(*str && *str == *newstr++)
str++;
if(*str)
char *staksav = stakptr(0);
struct comnod *comptr = (struct comnod*)stakalloc(sizeof(struct comnod));
struct argnod *ap = (struct argnod*)stakseek(ARGVAL);
- register char *out;
+ char *out;
char *begin;
int addstar;
int rval = 0;
int nomarkdirs = !sh_isoption(SH_MARKDIRS);
#ifdef SHOPT_MULTIBYTE
{
- register int c = *cur;
- register genchar *cp;
+ int c = *cur;
+ genchar *cp;
/* adjust cur */
cp = (genchar *)outbuff + *cur;
c = *cp;
ap->argflag = (ARG_MAC|ARG_EXP);
ap->argnxt.ap = 0;
{
- register int c;
+ int c;
if(out>outbuff)
{
/* go to beginning of word */
if(mode!='*')
sh_onoption(SH_MARKDIRS);
{
- register char **com;
+ char **com;
char *cp=begin;
int narg,cmd_completion=0;
- register int size;
+ int size;
while(cp>outbuff && ((size=cp[-1])==' ' || size=='\t'))
cp--;
if((cp==outbuff || strchr(";&|(",size)) && *begin!='~' && !strchr(ap->argval,'/'))
{
if (strip && !cmd_completion)
{
- register char **ptrcom;
+ char **ptrcom;
for(ptrcom=com;*ptrcom;ptrcom++)
/* trim directory prefix */
*ptrcom = path_basename(*ptrcom);
sh_offoption(SH_MARKDIRS);
#ifdef SHOPT_MULTIBYTE
{
- register int c;
+ int c;
/* first re-adjust cur */
out = outbuff + *cur;
c = *out;
* look for edit macro named _i
* if found, puts the macro definition into lookahead buffer and returns 1
*/
-ed_macro __PARAM__((register int i), (i)) __OTORP__(register int i;){
- register char *out;
+ed_macro __PARAM__((int i), (i)) __OTORP__(int i;){
+ char *out;
Namval_t *np;
genchar buff[LOOKAHEAD+1];
if(i != '@')
* Enter the fc command on the current history line
*/
ed_fulledit __PARAM__((void), ()){
- register char *cp;
+ char *cp;
if(!sh.hist_ptr)
return(-1);
/* use EDITOR on current command */
* is called again without an intervening tty_set()
*/
-int tty_get __PARAM__((register int fd, register struct termios *tty), (fd, tty)) __OTORP__(register int fd; register struct termios *tty;){
+int tty_get __PARAM__((int fd, struct termios *tty), (fd, tty)) __OTORP__(int fd; struct termios *tty;){
if(fd == savefd)
*tty = savetty;
else
*
}*/
-void tty_cooked __PARAM__((register int fd), (fd)) __OTORP__(register int fd;){
+void tty_cooked __PARAM__((int fd), (fd)) __OTORP__(int fd;){
if(editb.e_raw==0)
return;
*
}*/
-tty_raw __PARAM__((register int fd, int echo), (fd, echo)) __OTORP__(register int fd; int echo;){
+tty_raw __PARAM__((int fd, int echo), (fd, echo)) __OTORP__(int fd; int echo;){
#ifdef L_MASK
struct ltchars lchars;
#endif /* L_MASK */
*/
# ifdef TIOCGETC
-tty_alt __PARAM__((register int fd), (fd)) __OTORP__(register int fd;){
+tty_alt __PARAM__((int fd), (fd)) __OTORP__(int fd;){
int mask;
struct tchars ttychars;
switch(editb.e_raw)
# define IEXTEN 0
# endif /* IEXTEN */
-tty_alt __PARAM__((register int fd), (fd)) __OTORP__(register int fd;){
+tty_alt __PARAM__((int fd), (fd)) __OTORP__(int fd;){
switch(editb.e_raw)
{
case ECHOMODE:
*/
int ed_window __PARAM__((void), ()){
int rows,cols;
- register char *cp = nv_getval(COLUMNS);
+ char *cp = nv_getval(COLUMNS);
if(cp)
cols = atoi(cp)-1;
else
*/
void ed_flush __PARAM__((void), ()){
- register int n = editb.e_outptr-editb.e_outbase;
- register int fd = ERRIO;
+ int n = editb.e_outptr-editb.e_outbase;
+ int fd = ERRIO;
if(n<=0)
return;
write(fd,editb.e_outbase,(unsigned)n);
*/
void ed_setup __PARAM__((int fd), (fd)) __OTORP__(int fd;){
- register char *pp;
- register char *last;
+ char *pp;
+ char *last;
char *ppmax;
int myquote = 0;
- register int qlen = 1;
+ int qlen = 1;
char inquote = 0;
editb.e_fd = fd;
#ifdef KSHELL
#endif /* KSHELL */
if(sh.hist_ptr)
{
- register History_t *hp = sh.hist_ptr;
+ History_t *hp = sh.hist_ptr;
editb.e_hismax = hist_max(hp);
editb.e_hismin = hist_min(hp);
}
ppmax = pp+PRSIZE-1;
*pp++ = '\r';
{
- register int c;
+ int c;
while(c= *last++) switch(c)
{
case '\r':
*pp = 0;
if((editb.e_wsize -= editb.e_plen) < 7)
{
- register int shift = 7-editb.e_wsize;
+ int shift = 7-editb.e_wsize;
editb.e_wsize = 7;
pp = editb.e_prompt+1;
strcpy(pp,pp+shift);
* sfpkrd() correctly (i,e., those that support poll() or select()
*/
int ed_read __PARAM__((int fd, char *buff, int size), (fd, buff, size)) __OTORP__(int fd; char *buff; int size;){
- register int rv= -1;
- register int delim = (editb.e_raw==RAWMODE?'\r':'\n');
+ int rv= -1;
+ int delim = (editb.e_raw==RAWMODE?'\r':'\n');
sh_onstate(SH_TTYWAIT);
errno = EINTR;
while(rv<0 && errno==EINTR)
* onto the stack so that it can be checked for KEYTRAP
* putstack() returns 1 except when in the middle of a multi-byte char
*/
-static int putstack __PARAM__((char string[], register int nbyte, int type), (string, nbyte, type)) __OTORP__(char string[]; register int nbyte; int type;){
- register int c;
+static int putstack __PARAM__((char string[], int nbyte, int type), (string, nbyte, type)) __OTORP__(char string[]; int nbyte; int type;){
+ int c;
#ifdef SHOPT_MULTIBYTE
- register int max,last;
+ int max,last;
static int curchar, cursize=0;
last = max = nbyte;
nbyte = 0;
* 2 Next key is literal
*/
int ed_getchar __PARAM__((int mode), (mode)) __OTORP__(int mode;){
- register int n, c;
+ int n, c;
char readin[LOOKAHEAD+1];
if(!lookahead)
{
return(c);
}
-void ed_ungetchar __PARAM__((register int c), (c)) __OTORP__(register int c;){
+void ed_ungetchar __PARAM__((int c), (c)) __OTORP__(int c;){
if (lookahead < LOOKAHEAD)
previous[lookahead++] = c;
return;
* put a character into the output buffer
*/
-void ed_putchar __PARAM__((register int c), (c)) __OTORP__(register int c;){
- register char *dp = editb.e_outptr;
+void ed_putchar __PARAM__((int c), (c)) __OTORP__(int c;){
+ char *dp = editb.e_outptr;
#ifdef SHOPT_MULTIBYTE
- register int d;
+ int d;
/* check for place holder */
if(c == MARKER)
return;
*/
ed_virt_to_phys __PARAM__((genchar *virt,genchar *phys,int cur,int voff,int poff), (virt, phys, cur, voff, poff)) __OTORP__(genchar *virt;genchar *phys;int cur;int voff;int poff;){
- register genchar *sp = virt;
- register genchar *dp = phys;
- register int c;
+ genchar *sp = virt;
+ genchar *dp = phys;
+ int c;
genchar *curp = sp + cur;
genchar *dpmax = phys+MAXLINE;
int r;
*/
int ed_internal __PARAM__((const char *src, genchar *dest), (src, dest)) __OTORP__(const char *src; genchar *dest;){
- register const unsigned char *cp = (unsigned char *)src;
- register int c;
- register genchar *dp = dest;
- register int d;
- register int size;
+ const unsigned char *cp = (unsigned char *)src;
+ int c;
+ genchar *dp = dest;
+ int d;
+ int size;
if((unsigned char*)dest == cp)
{
genchar buffer[MAXLINE];
*/
int ed_external __PARAM__((const genchar *src, char *dest), (src, dest)) __OTORP__(const genchar *src; char *dest;){
- register int c;
- register char *dp = dest;
- register int d;
+ int c;
+ char *dp = dest;
+ int d;
char *dpmax = dp+sizeof(genchar)*MAXLINE-2;
if((char*)src == dp)
{
* copy at most <n> items from <sp> to <dp>
*/
-void ed_genncpy __PARAM__((register genchar *dp,register const genchar *sp, int n), (dp, sp, n)) __OTORP__(register genchar *dp;register const genchar *sp; int n;){
+void ed_genncpy __PARAM__((genchar *dp,const genchar *sp, int n), (dp, sp, n)) __OTORP__(genchar *dp;const genchar *sp; int n;){
while(n-->0 && (*dp++ = *sp++));
}
* find the string length of <str>
*/
-int ed_genlen __PARAM__((register const genchar *str), (str)) __OTORP__(register const genchar *str;){
- register const genchar *sp = str;
+int ed_genlen __PARAM__((const genchar *str), (str)) __OTORP__(const genchar *str;){
+ const genchar *sp = str;
while(*sp++);
return(sp-str-1);
}
*/
ed_setwidth __PARAM__((const char *string), (string)) __OTORP__(const char *string;){
- register int indx = 0;
- register int state = 0;
- register int c;
- register int n = 0;
+ int indx = 0;
+ int state = 0;
+ int c;
+ int n = 0;
static char widths[6] = {1,1};
while(1) switch(c = *string++)
{
/*
* returns 1 when <n> bytes starting at <a> and <b> are equal
*/
-static int compare __PARAM__((register const char *a,register const char *b,register int n), (a, b, n)) __OTORP__(register const char *a;register const char *b;register int n;){
+static int compare __PARAM__((const char *a,const char *b,int n), (a, b, n)) __OTORP__(const char *a;const char *b;int n;){
while(n-->0)
{
if(*a++ != *b++)
tcgetattr __PARAM__((int fd, struct termios *tt), (fd, tt)) __OTORP__(int fd; struct termios *tt;){
- register int r;
- register int i;
+ int r;
+ int i;
tcgeta = 0;
echoctl = (ECHOCTL!=0);
if((r=ioctl(fd,TCGETS,tt))>=0 || errno!=EINVAL)
}
tcsetattr __PARAM__((int fd,int mode,struct termios *tt), (fd, mode, tt)) __OTORP__(int fd;int mode;struct termios *tt;){
- register int r;
+ int r;
if(tcgeta)
{
- register int i;
+ int i;
ott.c_lflag = tt->c_lflag;
ott.c_oflag = tt->c_oflag;
ott.c_iflag = tt->c_iflag;
* Execute keyboard trap on given buffer <inbuff> of given size <isize>
* <mode> < 0 for vi insert mode
*/
-static int keytrap __PARAM__((char *inbuff,register int insize, int bufsize, int mode), (inbuff, insize, bufsize, mode)) __OTORP__(char *inbuff;register int insize; int bufsize; int mode;){
+static int keytrap __PARAM__((char *inbuff,int insize, int bufsize, int mode), (inbuff, insize, bufsize, mode)) __OTORP__(char *inbuff;int insize; int bufsize; int mode;){
static char vi_insert[2];
static long col;
- register char *cp;
+ char *cp;
inbuff[insize] = 0;
col = editb.e_cur;
if(mode== -2)
static Histloc_t location = { -5, 0 };
ed_emacsread __PARAM__((int fd,char *buff,int scend), (fd, buff, scend)) __OTORP__(int fd;char *buff;int scend;){
- register int c;
- register int i;
- register genchar *out;
- register int count;
+ int c;
+ int i;
+ genchar *out;
+ int count;
int adjust,oadjust;
char backslash;
genchar *kptr;
}
static void show_info __PARAM__((const char *str), (str)) __OTORP__(const char *str;){
- register genchar *out = drawbuff;
- register int c;
+ genchar *out = drawbuff;
+ int c;
genchar string[LBUF];
int sav_cur = cur;
/* save current line */
draw(UPDATE);
}
-static void putstring __PARAM__((register char *sp), (sp)) __OTORP__(register char *sp;){
- register int c;
+static void putstring __PARAM__((char *sp), (sp)) __OTORP__(char *sp;){
+ int c;
while (c= *sp++)
putchar(c);
}
-static int escape __PARAM__((register genchar *out,int count), (out, count)) __OTORP__(register genchar *out;int count;){
- register int i,value;
+static int escape __PARAM__((genchar *out,int count), (out, count)) __OTORP__(genchar *out;int count;){
+ int i,value;
int digit,ch;
digit = 0;
value = 0;
*/
static void xcommands __PARAM__((int count), (count)) __OTORP__(int count;){
- register int i = ed_getchar(0);
+ int i = ed_getchar(0);
NOT_USED(count);
switch(i)
{
#ifndef ESH_NFIRST
Histloc_t location;
#endif
- register int i,sl;
+ int i,sl;
genchar str_buff[LBUF];
- register genchar *string = drawbuff;
+ genchar *string = drawbuff;
/* save current line */
char sav_cur = cur;
genncpy(str_buff,string,sizeof(str_buff)/CHARSIZE-1);
#define UPPER '>'
static char overflow; /* Screen overflow flag set */
- register genchar *sptr; /* Pointer within screen */
+ genchar *sptr; /* Pointer within screen */
static int offset; /* Screen offset */
static char scvalid; /* Screen is up to date */
genchar nscreen[2*MAXLINE]; /* New entire screen */
genchar *ncursor; /* New cursor */
- register genchar *nptr; /* Pointer to New screen */
+ genchar *nptr; /* Pointer to New screen */
char longline; /* Line overflow */
genchar *logcursor;
genchar *nscend; /* end of logical screen */
- register int i;
+ int i;
nptr = nscreen;
sptr = drawbuff;
* cursor is set to reflect the change
*/
-static void setcursor __PARAM__((register int newp,int c), (newp, c)) __OTORP__(register int newp;int c;){
- register int oldp = cursor - screen;
+static void setcursor __PARAM__((int newp,int c), (newp, c)) __OTORP__(int newp;int c;){
+ int oldp = cursor - screen;
if (oldp > newp)
{
if (!cr_ok || (2*(newp+plen)>(oldp+plen)))
}
#ifdef SHOPT_MULTIBYTE
-static int print __PARAM__((register int c), (c)) __OTORP__(register int c;){
+static int print __PARAM__((int c), (c)) __OTORP__(int c;){
return((c&~STRIP)==0 && isprint(c));
}
-static int isword __PARAM__((register int i), (i)) __OTORP__(register int i;){
- register int c = drawbuff[i];
+static int isword __PARAM__((int i), (i)) __OTORP__(int i;){
+ int c = drawbuff[i];
return((c&~STRIP) || isalnum(c));
}
#endif /* SHOPT_MULTIBYTE */
# include <pwd.h>
int acctinit __PARAM__((void), ()){
- register char *cp, *acctfile;
+ char *cp, *acctfile;
Namval_t *np = nv_search("ACCTFILE",sh.var_tree,0);
if(!np || !(acctfile=nv_getval(np)))
* hist_open() returns 1, if history file is open
*/
int sh_histinit __PARAM__((void), ()){
- register int fd;
- register History_t *hp;
- register char *histname;
+ int fd;
+ History_t *hp;
+ char *histname;
char *fname=0;
int histmask, maxlines, hist_start;
- register char *cp;
- register off_t hsize = 0;
+ char *cp;
+ off_t hsize = 0;
if(sh.hist_ptr=hist_ptr)
return(1);
* close the history file and free the space
*/
-void hist_close __PARAM__((register History_t *hp), (hp)) __OTORP__(register History_t *hp;){
+void hist_close __PARAM__((History_t *hp), (hp)) __OTORP__(History_t *hp;){
sfclose(hp->histfp);
free((char*)hp);
hist_ptr = 0;
/*
* check history file format to see if it begins with special byte
*/
-static int hist_check __PARAM__((register int fd), (fd)) __OTORP__(register int fd;){
+static int hist_check __PARAM__((int fd), (fd)) __OTORP__(int fd;){
unsigned char magic[2];
lseek(fd,(off_t)0,SEEK_SET);
if((read(fd,(char*)magic,2)!=2) || (magic[0]!=HIST_UNDO))
*/
static void hist_trim __PARAM__((int n), (n)) __OTORP__(int n;){
- register char *cp;
- register int incmd=1, c=0;
- register History_t *hist_new, *hist_old = hist_ptr;
+ char *cp;
+ int incmd=1, c=0;
+ History_t *hist_new, *hist_old = hist_ptr;
char *buff, *endbuff;
off_t oldp,newp;
struct stat statb;
/*
* position history file at size and find next command number
*/
-static int hist_nearend __PARAM__((Sfio_t *iop, register off_t size), (iop, size)) __OTORP__(Sfio_t *iop; register off_t size;){
- register unsigned char *cp, *endbuff;
- register int n, incmd=1;
+static int hist_nearend __PARAM__((Sfio_t *iop, off_t size), (iop, size)) __OTORP__(Sfio_t *iop; off_t size;){
+ unsigned char *cp, *endbuff;
+ int n, incmd=1;
unsigned char *buff, marker[4];
if(size <= 2L || sfseek(iop,size,SEEK_SET)<0)
goto begin;
* the previous command.
*/
-void hist_eof __PARAM__((register History_t *hp), (hp)) __OTORP__(register History_t *hp;){
- register char *cp,*first,*endbuff;
- register int incmd = 0;
- register off_t count = hp->histcnt;
+void hist_eof __PARAM__((History_t *hp), (hp)) __OTORP__(History_t *hp;){
+ char *cp,*first,*endbuff;
+ int incmd = 0;
+ off_t count = hp->histcnt;
int n,skip=0;
char *buff;
sfseek(hp->histfp,count,SEEK_SET);
* This routine will cause the previous command to be cancelled
*/
-void hist_cancel __PARAM__((register History_t *hp), (hp)) __OTORP__(register History_t *hp;){
- register int c;
+void hist_cancel __PARAM__((History_t *hp), (hp)) __OTORP__(History_t *hp;){
+ int c;
if(!hp)
return;
sfputc(hp->histfp,HIST_UNDO);
* flush the current history command
*/
-void hist_flush __PARAM__((register History_t *hp), (hp)) __OTORP__(register History_t *hp;){
- register char *buff;
+void hist_flush __PARAM__((History_t *hp), (hp)) __OTORP__(History_t *hp;){
+ char *buff;
if(hp)
{
if(buff=(char*)sfreserve(hp->histfp,0,1))
* a zero byte. Line sequencing is added as required
*/
-static int hist_write __PARAM__((Sfio_t *iop,const __V_ *buff,register int insize,Sfdisc_t* handle), (iop, buff, insize, handle)) __OTORP__(Sfio_t *iop;const __V_ *buff;register int insize;Sfdisc_t* handle;){
- register char *bufptr = ((char*)buff)+insize;
- register History_t *hp = hist_ptr;
- register int c,size = insize;
- register off_t cur;
+static int hist_write __PARAM__((Sfio_t *iop,const __V_ *buff,int insize,Sfdisc_t* handle), (iop, buff, insize, handle)) __OTORP__(Sfio_t *iop;const __V_ *buff;int insize;Sfdisc_t* handle;){
+ char *bufptr = ((char*)buff)+insize;
+ History_t *hp = hist_ptr;
+ int c,size = insize;
+ off_t cur;
NOT_USED(handle);
if(!histflush)
return(write(sffileno(iop),(char*)buff,size));
* The buffer must be large enough to hold HIST_MARKSZ chars
*/
-static void hist_marker __PARAM__((register char *buff,register long cmdno), (buff, cmdno)) __OTORP__(register char *buff;register long cmdno;){
+static void hist_marker __PARAM__((char *buff,long cmdno), (buff, cmdno)) __OTORP__(char *buff;long cmdno;){
*buff++ = HIST_CMDNO;
*buff++ = 0;
*buff++ = (cmdno>>16);
/*
* return byte offset in history file for command <n>
*/
-off_t hist_tell __PARAM__((register History_t *hp, int n), (hp, n)) __OTORP__(register History_t *hp; int n;){
+off_t hist_tell __PARAM__((History_t *hp, int n), (hp, n)) __OTORP__(History_t *hp; int n;){
return(hp->histcmds[hist_ind(hp,n)]);
}
/*
* seek to the position of command <n>
*/
-off_t hist_seek __PARAM__((register History_t *hp, int n), (hp, n)) __OTORP__(register History_t *hp; int n;){
+off_t hist_seek __PARAM__((History_t *hp, int n), (hp, n)) __OTORP__(History_t *hp; int n;){
return(sfseek(hp->histfp,hp->histcmds[hist_ind(hp,n)],SEEK_SET));
}
* each new-line character is replaced with string <nl>.
*/
-void hist_list __PARAM__((register History_t *hp,Sfio_t *outfile, off_t offset,int last, char *nl), (hp, outfile, offset, last, nl)) __OTORP__(register History_t *hp;Sfio_t *outfile; off_t offset;int last; char *nl;){
- register int oldc=0;
- register int c;
+void hist_list __PARAM__((History_t *hp,Sfio_t *outfile, off_t offset,int last, char *nl), (hp, outfile, offset, last, nl)) __OTORP__(History_t *hp;Sfio_t *outfile; off_t offset;int last; char *nl;){
+ int oldc=0;
+ int c;
if(offset<0 || !hp)
{
sfputr(outfile,e_unknown,'\n');
* direction < 1 for backwards search
*/
-Histloc_t hist_find __PARAM__((register History_t*hp,char *string,register int index1,int flag,int direction), (hp, string, index1, flag, direction)) __OTORP__(register History_t*hp;char *string;register int index1;int flag;int direction;){
- register int index2;
+Histloc_t hist_find __PARAM__((History_t*hp,char *string,int index1,int flag,int direction), (hp, string, index1, flag, direction)) __OTORP__(History_t*hp;char *string;int index1;int flag;int direction;){
+ int index2;
off_t offset;
int *coffset=0;
Histloc_t location;
* returns the line number of the match if successful, otherwise -1
*/
-int hist_match __PARAM__((register History_t *hp,off_t offset,char *string,int *coffset), (hp, offset, string, coffset)) __OTORP__(register History_t *hp;off_t offset;char *string;int *coffset;){
- register unsigned char *cp;
- register int c;
- register off_t count;
+int hist_match __PARAM__((History_t *hp,off_t offset,char *string,int *coffset), (hp, offset, string, coffset)) __OTORP__(History_t *hp;off_t offset;char *string;int *coffset;){
+ unsigned char *cp;
+ int c;
+ off_t count;
int line = 0;
int chrs=0;
#ifdef SHOPT_MULTIBYTE
*/
int hist_copy __PARAM__((char *s1,int size,int command,int line), (s1, size, command, line)) __OTORP__(char *s1;int size;int command;int line;){
- register int c;
- register History_t *hp = hist_ptr;
- register int count = 0;
- register char *s1max = s1+size;
+ int c;
+ History_t *hp = hist_ptr;
+ int count = 0;
+ char *s1max = s1+size;
off_t offset;
if(!hp)
return(-1);
*/
char *hist_word __PARAM__((char *string,int size,int word), (string, size, word)) __OTORP__(char *string;int size;int word;){
- register int c;
- register char *s1 = string;
- register unsigned char *cp = (unsigned char*)s1;
- register int flag = 0;
+ int c;
+ char *s1 = string;
+ unsigned char *cp = (unsigned char*)s1;
+ int flag = 0;
if(!hist_ptr)
#ifdef KSHELL
{
* compute the new command and line number.
*/
-Histloc_t hist_locate __PARAM__((History_t *hp,register int command,register int line,int lines), (hp, command, line, lines)) __OTORP__(History_t *hp;register int command;register int line;int lines;){
+Histloc_t hist_locate __PARAM__((History_t *hp,int command,int line,int lines), (hp, command, line, lines)) __OTORP__(History_t *hp;int command;int line;int lines;){
Histloc_t next;
line += lines;
if(!hp)
}
if(lines > 0)
{
- register int count;
+ int count;
while(command <= hp->histind)
{
count = hist_copy(NIL(char*),0, command,-1);
}
else
{
- register int least = (int)hp->histind-hp->histsize;
+ int least = (int)hp->histind-hp->histsize;
while(1)
{
if(line >=0)
* Handle history file exceptions
*/
static int hist_exceptf __PARAM__((Sfio_t* fp, int type, Sfdisc_t *handle), (fp, type, handle)) __OTORP__(Sfio_t* fp; int type; Sfdisc_t *handle;){
- register int newfd,oldfd;
+ int newfd,oldfd;
History_t *hp = (History_t*)handle;
if(type==SF_WRITE)
{
close(newfd);
if(lseek(oldfd,(off_t)0,SEEK_END) < hp->histcnt)
{
- register int index = hp->histind;
+ int index = hp->histind;
lseek(oldfd,(off_t)2,SEEK_SET);
hp->histcnt = 2;
hp->histind = 1;
*
-*/
-ed_viread __PARAM__((int fd, register char *shbuf, int nchar), (fd, shbuf, nchar)) __OTORP__(int fd; register char *shbuf; int nchar;){
- register int i; /* general variable */
- register int term_char; /* read() termination character */
+ed_viread __PARAM__((int fd, char *shbuf, int nchar), (fd, shbuf, nchar)) __OTORP__(int fd; char *shbuf; int nchar;){
+ int i; /* general variable */
+ int term_char; /* read() termination character */
char prompt[PRSIZE+2]; /* prompt */
genchar Physical[2*MAXLINE]; /* physical image */
genchar Ubuf[MAXLINE]; /* used for U command */
}
else
{
- register int c = shbuf[0];
+ int c = shbuf[0];
/*** Save and remove the last character if its an eol, ***/
/* changing '\r' to '\n' */
virtual[i] = '\n';
if(!echoctl)
{
- register int c = virtual[i];
+ int c = virtual[i];
if( c<=usrerase)
{
/*** user typed escaped erase or kill char ***/
#define virtual editb.e_inbuf /* pointer to virtual image buffer */
static void append __PARAM__((int c, int mode), (c, mode)) __OTORP__(int c; int mode;){
- register int i,j;
+ int i,j;
if( last_virt<max_col && last_phys<max_col )
{
*
}*/
-static void backword __PARAM__((int nwords, register int cmd), (nwords, cmd)) __OTORP__(int nwords; register int cmd;){
- register int tcur_virt = cur_virt;
+static void backword __PARAM__((int nwords, int cmd), (nwords, cmd)) __OTORP__(int nwords; int cmd;){
+ int tcur_virt = cur_virt;
while( nwords-- && tcur_virt > first_virt )
{
if( !kshisblank(tcur_virt) && kshisblank(tcur_virt-1)
--tcur_virt;
else if(cmd != 'B')
{
- register int last = isalph(tcur_virt-1);
- register int cur = isalph(tcur_virt);
+ int last = isalph(tcur_virt-1);
+ int cur = isalph(tcur_virt);
if((!cur && last) || (cur && !last))
--tcur_virt;
}
}*/
static int cntlmode __PARAM__((void), ()){
- register int c;
- register int i;
+ int c;
+ int i;
genchar tmp_u_space[MAXLINE]; /* temporary u_space */
genchar *real_u_space; /* points to real u_space */
int tmp_u_column = INVALID; /* temporary u_column */
case cntl('V'):
{
- register const char *p = &e_version[5];
+ const char *p = &e_version[5];
save_v();
del_line(BAD);
while(c = *p++)
case '#': /** insert(delete) # to (no)comment command **/
if( cur_virt != INVALID )
{
- register genchar *p = &virtual[last_virt+1];
+ genchar *p = &virtual[last_virt+1];
*p = 0;
/*** see whether first char is comment char ***/
c = (virtual[0]=='#');
*
}*/
-static void cursor __PARAM__((register int x), (x)) __OTORP__(register int x;){
- register int delta;
+static void cursor __PARAM__((int x), (x)) __OTORP__(int x;){
+ int delta;
#ifdef SHOPT_MULTIBYTE
while(physical[x]==MARKER)
*
}*/
-static void cdelete __PARAM__((register int nchars, int mode), (nchars, mode)) __OTORP__(register int nchars; int mode;){
- register int i;
- register genchar *vp;
+static void cdelete __PARAM__((int nchars, int mode), (nchars, mode)) __OTORP__(int nchars; int mode;){
+ int i;
+ genchar *vp;
if( cur_virt < first_virt )
{
}*/
static int delmotion __PARAM__((int motion, int mode), (motion, mode)) __OTORP__(int motion; int mode;){
- register int begin, end, delta;
- /* the following saves a register */
+ int begin, end, delta;
+ /* the following saves a */
if( cur_virt == INVALID )
return(0);
*
}*/
-static void endword __PARAM__((int nwords, register int cmd), (nwords, cmd)) __OTORP__(int nwords; register int cmd;){
- register int tcur_virt = cur_virt;
+static void endword __PARAM__((int nwords, int cmd), (nwords, cmd)) __OTORP__(int nwords; int cmd;){
+ int tcur_virt = cur_virt;
while( nwords-- )
{
if( !kshisblank(tcur_virt) && tcur_virt<=last_virt )
*
}*/
-static void forward __PARAM__((register int nwords, int cmd), (nwords, cmd)) __OTORP__(register int nwords; int cmd;){
- register int tcur_virt = cur_virt;
+static void forward __PARAM__((int nwords, int cmd), (nwords, cmd)) __OTORP__(int nwords; int cmd;){
+ int tcur_virt = cur_virt;
while( nwords-- )
{
if( cmd == 'W' )
*
}*/
-static int getcount __PARAM__((register int c), (c)) __OTORP__(register int c;){
- register int i;
+static int getcount __PARAM__((int c), (c)) __OTORP__(int c;){
+ int i;
/*** get any repeat count ***/
*
}*/
-static void getline __PARAM__((register int mode), (mode)) __OTORP__(register int mode;){
- register int c;
- register int tmp;
+static void getline __PARAM__((int mode), (mode)) __OTORP__(int mode;){
+ int c;
+ int tmp;
addnl = 1;
*
}*/
-static int mvcursor __PARAM__((register int motion), (motion)) __OTORP__(register int motion;){
- register int count;
- register int tcur_virt;
- register int incr = -1;
- register int bound = 0;
+static int mvcursor __PARAM__((int motion), (motion)) __OTORP__(int motion;){
+ int count;
+ int tcur_virt;
+ int incr = -1;
+ int bound = 0;
static int last_find = 0; /* last find command */
switch(motion)
* print a string
*/
-static void pr_string __PARAM__((register const char *sp), (sp)) __OTORP__(register const char *sp;){
+static void pr_string __PARAM__((const char *sp), (sp)) __OTORP__(const char *sp;){
/*** copy string sp ***/
- register char *ptr = editb.e_outptr;
+ char *ptr = editb.e_outptr;
while(*sp)
*ptr++ = *sp++;
editb.e_outptr = ptr;
*
}*/
-static void putstring __PARAM__((register int col, register int nchars), (col, nchars)) __OTORP__(register int col; register int nchars;){
+static void putstring __PARAM__((int col, int nchars), (col, nchars)) __OTORP__(int col; int nchars;){
while( nchars-- )
putchar(physical[col++]);
return;
}*/
static void refresh __PARAM__((int mode), (mode)) __OTORP__(int mode;){
- register int p;
- register int regb;
- register int first_w = first_wind;
+ int p;
+ int regb;
+ int first_w = first_wind;
int p_differ;
int new_lw;
int ncur_phys;
*
}*/
-static void replace __PARAM__((register int c, register int increment), (c, increment)) __OTORP__(register int c; register int increment;){
- register int cur_window;
+static void replace __PARAM__((int c, int increment), (c, increment)) __OTORP__(int c; int increment;){
+ int cur_window;
if( cur_virt == INVALID )
{
}*/
static void restore_v __PARAM__((void), ()){
- register int tmpcol;
+ int tmpcol;
genchar tmpspace[MAXLINE];
if( u_column == INVALID-1 )
}*/
static void save_last __PARAM__((void), ()){
- register int i;
+ int i;
if( (i = cur_virt - first_virt + 1) > 0 )
{
* search for <string> in the current command
*/
static int curline_search __PARAM__((const char *string), (string)) __OTORP__(const char *string;){
- register int len=strlen(string);
- register const char *dp,*cp=string, *dpmax;
+ int len=strlen(string);
+ const char *dp,*cp=string, *dpmax;
#ifdef SHOPT_MULTIBYTE
ed_external(u_space,(char*)u_space);
#endif /* SHOPT_MULTIBYTE */
return(-1);
}
-static int search __PARAM__((register int mode), (mode)) __OTORP__(register int mode;){
- register int new_direction;
- register int oldcurhline;
- register int i;
+static int search __PARAM__((int mode), (mode)) __OTORP__(int mode;){
+ int new_direction;
+ int oldcurhline;
+ int i;
static int direction = -1;
Histloc_t location;
}*/
static void sync_cursor __PARAM__((void), ()){
- register int p;
- register int v;
- register int c;
+ int p;
+ int v;
+ int c;
int new_phys;
if( cur_virt == INVALID )
*
}*/
-static int textmod __PARAM__((register int c, int mode), (c, mode)) __OTORP__(register int c; int mode;){
- register int i;
- register genchar *p = lastline;
- register int trepeat = repeat;
+static int textmod __PARAM__((int c, int mode), (c, mode)) __OTORP__(int c; int mode;){
+ int i;
+ genchar *p = lastline;
+ int trepeat = repeat;
static int lastmacro;
genchar *savep;
#ifdef SHOPT_MULTIBYTE
- static int isalph __PARAM__((register int c), (c)) __OTORP__(register int c;){
- register int v = virtual[c];
+ static int isalph __PARAM__((int c), (c)) __OTORP__(int c;){
+ int v = virtual[c];
return((v&~STRIP) || isalnum(v) || v=='_');
}
- static int kshisblank __PARAM__((register int c), (c)) __OTORP__(register int c;){
- register int v = virtual[c];
+ static int kshisblank __PARAM__((int c), (c)) __OTORP__(int c;){
+ int v = virtual[c];
return((v&~STRIP)==0 && isspace(v));
}
- static int ismetach __PARAM__((register int c), (c)) __OTORP__(register int c;){
- register int v = virtual[c];
+ static int ismetach __PARAM__((int c), (c)) __OTORP__(int c;){
+ int v = virtual[c];
return((v&~STRIP)==0 && ismeta(v));
}
*/
static int getrchar()
{
- register int c;
+ int c;
if((c=ed_getchar(1))== usrlnext)
c = ed_getchar(2);
return(c);
main(argc, argv)
int argc;
-register char** argv;
+char** argv;
{
- register char* s;
- register int c;
+ char* s;
+ int c;
long ref;
struct stat st;
char buf[1024];
* The -o option is used to set option by name
* This routine returns the number of non-option arguments
*/
-int sh_argopts __PARAM__((int argc,register char *argv[]), (argc, argv)) __OTORP__(int argc;register char *argv[];){
- register int n;
- register Shopt_t newflags=sh.options, opt;
+int sh_argopts __PARAM__((int argc,char *argv[]), (argc, argv)) __OTORP__(int argc;char *argv[];){
+ int n;
+ Shopt_t newflags=sh.options, opt;
int setflag=0, action=0, trace=(int)sh_isoption(SH_XTRACE);
Namval_t *np = NIL(Namval_t*);
const char *cp;
* returns the value of $-
*/
char *sh_argdolminus __PARAM__((void), ()){
- register const char *cp=sh_optksh;
- register char *flagp=flagadr;
+ const char *cp=sh_optksh;
+ char *flagp=flagadr;
while(cp< &sh_optksh[NUM_OPTS])
{
if(sh.options&flagval[cp-sh_optksh])
* If flag is set, then the block dolh is not freed
*/
struct dolnod *sh_argfree __PARAM__((struct dolnod *blk,int flag), (blk, flag)) __OTORP__(struct dolnod *blk;int flag;){
- register struct dolnod* argr=blk;
- register struct dolnod* argblk;
+ struct dolnod* argr=blk;
+ struct dolnod* argblk;
if(argblk=argr)
{
if((--argblk->dolrefcnt)==0)
* grab space for arglist and copy args
* The strings are copied after the argument vector
*/
-struct dolnod *sh_argcreate __PARAM__((register char *argv[]), (argv)) __OTORP__(register char *argv[];){
- register struct dolnod *dp;
- register char **pp=argv, *sp;
- register int size=0,n;
+struct dolnod *sh_argcreate __PARAM__((char *argv[]), (argv)) __OTORP__(char *argv[];){
+ struct dolnod *dp;
+ char **pp=argv, *sp;
+ int size=0,n;
/* count args and number of bytes of arglist */
while(sp= *pp++)
size += strlen(sp);
* used to set new arguments for functions
*/
struct dolnod *sh_argnew __PARAM__((char *argi[], struct dolnod **savargfor), (argi, savargfor)) __OTORP__(char *argi[]; struct dolnod **savargfor;){
- register struct dolnod *olddolh = dolh;
+ struct dolnod *olddolh = dolh;
*savargfor = argfor;
dolh = 0;
argfor = 0;
* increase the use count so that an sh_argset will not make it go away
*/
struct dolnod *sh_arguse __PARAM__((void), ()){
- register struct dolnod *dh;
+ struct dolnod *dh;
if(dh=dolh)
dh->dolrefcnt++;
return(dh);
* Print option settings on standard output
* if mode==1 for -o format, otherwise +o format
*/
-static void print_opts __PARAM__((Shopt_t oflags,register int mode), (oflags, mode)) __OTORP__(Shopt_t oflags;register int mode;){
- register const Shtable_t *tp = shtab_options;
+static void print_opts __PARAM__((Shopt_t oflags,int mode), (oflags, mode)) __OTORP__(Shopt_t oflags;int mode;){
+ const Shtable_t *tp = shtab_options;
Shopt_t value;
if(mode)
sfputr(sfstdout,ERROR_translate(e_heading,1),'\n');
* build an argument list
*/
char **sh_argbuild __PARAM__((int *nargs, const struct comnod *comptr), (nargs, comptr)) __OTORP__(int *nargs; const struct comnod *comptr;){
- register struct argnod *argp;
+ struct argnod *argp;
struct argnod *arghead=0;
{
- register const struct comnod *ac = comptr;
+ const struct comnod *ac = comptr;
/* see if the arguments have already been expanded */
if(!ac->comarg)
{
}
else if(!(ac->comtyp&COMSCAN))
{
- register struct dolnod *ap = (struct dolnod*)ac->comarg;
+ struct dolnod *ap = (struct dolnod*)ac->comarg;
*nargs = ap->dolnum;
return(ap->dolval+ap->dolbot);
}
}
}
{
- register char **comargn;
- register int argn;
- register char **comargm;
+ char **comargn;
+ int argn;
+ char **comargm;
argn = *nargs;
/* allow room to prepend args */
#ifdef SHOPT_VPIX
}
/* Argument expansion */
-static int arg_expand __PARAM__((register struct argnod *argp, struct argnod **argchain), (argp, argchain)) __OTORP__(register struct argnod *argp; struct argnod **argchain;){
- register int count = 0;
+static int arg_expand __PARAM__((struct argnod *argp, struct argnod **argchain), (argp, argchain)) __OTORP__(struct argnod *argp; struct argnod **argchain;){
+ int count = 0;
argp->argflag &= ~ARG_MAKE;
#ifdef SHOPT_DEVFD
if(*argp->argval==0 && (argp->argflag&ARG_EXP))
{
/* argument of the form (cmd) */
- register struct argnod *ap;
+ struct argnod *ap;
int monitor, fd, pv[2];
ap = (struct argnod*)stakseek(ARGVAL);
ap->argflag |= ARG_MAKE;
static int level;
static double arith __PARAM__((const char **ptr, struct lval *lvalue, int type, double n), (ptr, lvalue, type, n)) __OTORP__(const char **ptr; struct lval *lvalue; int type; double n;){
- register double r= 0;
+ double r= 0;
char *str = (char*)*ptr;
switch(type)
{
case ASSIGN:
{
- register Namval_t *np = (Namval_t*)(lvalue->value);
- register Namarr_t *ap;
+ Namval_t *np = (Namval_t*)(lvalue->value);
+ Namarr_t *ap;
if(ap = nv_arrayptr(np))
{
if(!array_assoc(ap))
}
case LOOKUP:
{
- register int c = *str;
+ int c = *str;
lvalue->value = (char*)0;
if(c=='.')
c = str[1];
if(isaletter(c))
{
- register Namval_t *np;
+ Namval_t *np;
while(c= *++str, isaname(c)||c=='.');
if(c=='(')
{
}
case VALUE:
{
- register Namval_t *np = (Namval_t*)(lvalue->value);
+ Namval_t *np = (Namval_t*)(lvalue->value);
if(sh_isoption(SH_NOEXEC))
return(0);
if((level || sh_isoption(SH_NOUNSET)) && nv_isnull(np) && !nv_isattr(np,NV_INTEGER))
return(r);
}
-double sh_strnum __PARAM__((register const char *str, char** ptr), (str, ptr)) __OTORP__(register const char *str; char** ptr;){
+double sh_strnum __PARAM__((const char *str, char** ptr), (str, ptr)) __OTORP__(const char *str; char** ptr;){
return(strval(str,(char**)ptr, arith));
}
-double sh_arith __PARAM__((register const char *str), (str)) __OTORP__(register const char *str;){
+double sh_arith __PARAM__((const char *str), (str)) __OTORP__(const char *str;){
const char *ptr = str;
- register double d;
+ double d;
if(*str==0)
return(0);
d = strval(str,(char**)&ptr,arith);
* but <= ARRAY_MAX) is returned.
*
*/
-static int arsize __PARAM__((register int maxi), (maxi)) __OTORP__(register int maxi;){
- register int i = roundof(maxi,ARRAY_INCR);
+static int arsize __PARAM__((int maxi), (maxi)) __OTORP__(int maxi;){
+ int i = roundof(maxi,ARRAY_INCR);
return (i>ARRAY_MAX?ARRAY_MAX:i);
}
* allocated Namarr_t structure is returned.
* <maxi> becomes the current index of the array.
*/
-static struct index_array *array_grow __PARAM__((register struct index_array *arp,int maxi), (arp, maxi)) __OTORP__(register struct index_array *arp;int maxi;){
- register struct index_array *ap;
- register int i=0;
- register int newsize = arsize(maxi+1);
+static struct index_array *array_grow __PARAM__((struct index_array *arp,int maxi), (arp, maxi)) __OTORP__(struct index_array *arp;int maxi;){
+ struct index_array *ap;
+ int i=0;
+ int newsize = arsize(maxi+1);
if (maxi >= ARRAY_MAX)
error(ERROR_exit(1),e_subscript, fmtbase((long)maxi,10,0));
ap = new_of(struct index_array,(newsize-1)*sizeof(union Value*));
* Check for bounds violation for indexed array
*/
void array_check __PARAM__((Namval_t *np,int flag), (np, flag)) __OTORP__(Namval_t *np;int flag;){
- register struct index_array *ap = (struct index_array*)nv_arrayptr(np);
+ struct index_array *ap = (struct index_array*)nv_arrayptr(np);
if(ap->header.nelem&ARRAY_UNDEF)
{
ap->header.nelem &= ~ARRAY_UNDEF;
* After the lookup is done the last @ or * subscript is incremented
*/
union Value *array_find __PARAM__((Namval_t *np,int flag), (np, flag)) __OTORP__(Namval_t *np;int flag;){
- register struct index_array *ap = (struct index_array*)nv_arrayptr(np);
- register union Value *up;
- register unsigned dot=0;
+ struct index_array *ap = (struct index_array*)nv_arrayptr(np);
+ union Value *up;
+ unsigned dot=0;
if(is_associative(ap))
up = (union Value*)((*ap->header.fun)(np,NIL(char*),0));
else
* freeing relevant storage
*/
static Namarr_t *nv_changearray __PARAM__((Namval_t *np, __V_ *(*fun)(Namval_t*,const char*,int)), (np, fun)) __OTORP__(Namval_t *np; __V_ *(*fun)();){
- register Namarr_t *ap;
+ Namarr_t *ap;
char numbuff[NUMSIZE];
unsigned dot, digit, n;
union Value *up;
struct index_array *save_ap;
- register char *string_index= &numbuff[NUMSIZE];
+ char *string_index= &numbuff[NUMSIZE];
numbuff[NUMSIZE]='\0';
if(!fun || !(ap = nv_arrayptr(np)) || is_associative(ap))
* The array pointer is returned if sucessful.
*/
Namarr_t *nv_setarray __PARAM__((Namval_t *np, __V_ *(*fun)(Namval_t*,const char*,int)), (np, fun)) __OTORP__(Namval_t *np; __V_ *(*fun)();){
- register Namarr_t *ap;
+ Namarr_t *ap;
if(fun && (ap = nv_arrayptr(np)) && !is_associative(ap))
{
* Otherwise, 1 is returned.
*/
int nv_nextsub __PARAM__((Namval_t *np), (np)) __OTORP__(Namval_t *np;){
- register struct index_array *ap = (struct index_array*)nv_arrayptr(np);
- register unsigned dot;
+ struct index_array *ap = (struct index_array*)nv_arrayptr(np);
+ unsigned dot;
if(!ap || !(ap->header.nelem&ARRAY_SCAN))
return(0);
if(is_associative(ap))
* The node pointer is returned which can be NULL if <np> is
* not already array and the ARRAY_ADD bit of <mode> is not set.
*/
-Namval_t *nv_putsub __PARAM__((Namval_t *np,register char *sp,register long mode), (np, sp, mode)) __OTORP__(Namval_t *np;register char *sp;register long mode;){
- register struct index_array *ap = (struct index_array*)nv_arrayptr(np);
- register int size = (mode&ARRAY_MASK);
+Namval_t *nv_putsub __PARAM__((Namval_t *np,char *sp,long mode), (np, sp, mode)) __OTORP__(Namval_t *np;char *sp;long mode;){
+ struct index_array *ap = (struct index_array*)nv_arrayptr(np);
+ int size = (mode&ARRAY_MASK);
if(!ap || !ap->header.fun)
{
if(sp)
}
if(!ap || size>=ap->maxi)
{
- register struct index_array *apold;
+ struct index_array *apold;
if(size==0)
return(NIL(Namval_t*));
ap = array_grow(apold=ap,size);
* process an array subscript for node <np> given the subscript <cp>
* returns pointer to character after the subscript
*/
-char *nv_endsubscript __PARAM__((Namval_t *np, register char *cp, int mode), (np, cp, mode)) __OTORP__(Namval_t *np; register char *cp; int mode;){
- register int count=1, quoted=0, c;
- register char *sp = cp+1;
+char *nv_endsubscript __PARAM__((Namval_t *np, char *cp, int mode), (np, cp, mode)) __OTORP__(Namval_t *np; char *cp; int mode;){
+ int count=1, quoted=0, c;
+ char *sp = cp+1;
/* first find matching ']' */
while(count>0 && (c= *++cp))
{
char *nv_getsub __PARAM__((Namval_t* np), (np)) __OTORP__(Namval_t* np;){
static char numbuff[NUMSIZE];
- register struct index_array *ap = (struct index_array*)nv_arrayptr(np);
- register unsigned dot, n;
- register char *cp = &numbuff[NUMSIZE];
+ struct index_array *ap = (struct index_array*)nv_arrayptr(np);
+ unsigned dot, n;
+ char *cp = &numbuff[NUMSIZE];
if(!ap)
return(NIL(char*));
if(is_associative(ap))
* If <np> is an indexed array node, the current subscript index
* retuned, otherwise returns -1
*/
-int nv_aindex __PARAM__((register Namval_t* np), (np)) __OTORP__(register Namval_t* np;){
+int nv_aindex __PARAM__((Namval_t* np), (np)) __OTORP__(Namval_t* np;){
Namarr_t *ap = nv_arrayptr(np);
if(!ap || is_associative(ap))
return(-1);
/*
* This is the default implementation for associate arrays
*/
-__V_ *nv_associative __PARAM__((register Namval_t *np,const char *sp,int mode), (np, sp, mode)) __OTORP__(register Namval_t *np;const char *sp;int mode;){
- register struct assoc_array *ap = (struct assoc_array*)nv_arrayptr(np);
- register int type;
+__V_ *nv_associative __PARAM__((Namval_t *np,const char *sp,int mode), (np, sp, mode)) __OTORP__(Namval_t *np;const char *sp;int mode;){
+ struct assoc_array *ap = (struct assoc_array*)nv_arrayptr(np);
+ int type;
switch(mode)
{
case NV_AINIT:
/*
* Assign values to an array
*/
-void nv_setvec __PARAM__((register Namval_t *np,register int argc,register char *argv[]), (np, argc, argv)) __OTORP__(register Namval_t *np;register int argc;register char *argv[];){
+void nv_setvec __PARAM__((Namval_t *np,int argc,char *argv[]), (np, argc, argv)) __OTORP__(Namval_t *np;int argc;char *argv[];){
while(--argc >= 0)
{
if(argc>0 || nv_isattr(np,NV_ARRAY))
/*
* print script corresponding to shell tree <t>
*/
-static void p_tree __PARAM__((register const union anynode *t,register int tflags), (t, tflags)) __OTORP__(register const union anynode *t;register int tflags;){
- register char *cp;
+static void p_tree __PARAM__((const union anynode *t,int tflags), (t, tflags)) __OTORP__(const union anynode *t;int tflags;){
+ char *cp;
int save = end_line;
int needbrace = (tflags&NEED_BRACE);
tflags &= ~NEED_BRACE;
case TARITH:
{
- register struct argnod *ap = t->ar.arexpr;
+ struct argnod *ap = t->ar.arexpr;
if(begin_line && level)
sfnputc(outfile,'\t',level);
sfprintf(outfile,"(( %s ))%c",ap->argflag&ARG_RAW?sh_fmtq(ap->argval):ap->argval,end_line);
* decrement indent level for flag==END
*/
static void p_keyword __PARAM__((const char *word,int flag), (word, flag)) __OTORP__(const char *word;int flag;){
- register int sep;
+ int sep;
if(flag==END)
sep = end_line;
else if(*word=='[')
level++;
}
-static void p_arg __PARAM__((register const struct argnod *arg,register int endchar,int opts), (arg, endchar, opts)) __OTORP__(register const struct argnod *arg;register int endchar;int opts;){
- register const char *cp;
- register int flag;
+static void p_arg __PARAM__((const struct argnod *arg,int endchar,int opts), (arg, endchar, opts)) __OTORP__(const struct argnod *arg;int endchar;int opts;){
+ const char *cp;
+ int flag;
do
{
if(!arg->argnxt.ap)
return;
}
-static void p_redirect __PARAM__((register const struct ionod *iop), (iop)) __OTORP__(register const struct ionod *iop;){
- register int iof;
- register char *cp;
+static void p_redirect __PARAM__((const struct ionod *iop), (iop)) __OTORP__(const struct ionod *iop;){
+ int iof;
+ char *cp;
for(;iop;iop=iop->ionxt)
{
iof=iop->iofile;
return;
}
-static void p_comarg __PARAM__((const register struct comnod *com), (com)) __OTORP__(const register struct comnod *com;){
- register int flag = end_line;
+static void p_comarg __PARAM__((const struct comnod *com), (com)) __OTORP__(const struct comnod *com;){
+ int flag = end_line;
if(com->comarg || com->comio)
flag = ' ';
if(com->comset)
}
static void p_comlist __PARAM__((const struct dolnod *dol,int endchar), (dol, endchar)) __OTORP__(const struct dolnod *dol;int endchar;){
- register char *cp, *const*argv;
- register int flag = ' ', special;
+ char *cp, *const*argv;
+ int flag = ' ', special;
argv = dol->dolval+ARG_SPARE;
cp = *argv;
special = (*cp=='[' && cp[1]==0);
return;
}
-static void p_switch __PARAM__((register const struct regnod *reg), (reg)) __OTORP__(register const struct regnod *reg;){
+static void p_switch __PARAM__((const struct regnod *reg), (reg)) __OTORP__(const struct regnod *reg;){
if(level>1)
sfnputc(outfile,'\t',level-1);
p_arg(reg->regptr,')',PRE);
/*
* output here documents
*/
-static void here_body __PARAM__((register const struct ionod *iop), (iop)) __OTORP__(register const struct ionod *iop;){
+static void here_body __PARAM__((const struct ionod *iop), (iop)) __OTORP__(const struct ionod *iop;){
Sfio_t *infile;
#ifdef xxx
if(iop->iolink)
*/
static struct ld_info *getinfo __PARAM__((__V_ *module), (module)) __OTORP__(__V_ *module;){
struct ld_info *info=ld_info;
- register int n=1;
+ int n=1;
if (!ld_info || module != last_module)
{
last_module = module;
#ifdef SHOPT_NOCASE
# include <ctype.h>
- static void utol __PARAM__((register char const *str1,register char *str2), (str1, str2)) __OTORP__(register char const *str1;register char *str2;){
- register int c;
+ static void utol __PARAM__((char const *str1,char *str2), (str1, str2)) __OTORP__(char const *str1;char *str2;){
+ int c;
for(; c= *((unsigned char*)str1); str1++,str2++)
{
if(isupper(c))
int path_expand __PARAM__((const char *pattern, struct argnod **arghead), (pattern, arghead)) __OTORP__(const char *pattern; struct argnod **arghead;){
- register struct argnod *ap;
- register struct glob *gp;
- register char *pat;
+ struct argnod *ap;
+ struct glob *gp;
+ char *pat;
#ifdef KSHELL
struct glob globdata;
membase = &globdata;
}
static void glob_dir __PARAM__((struct argnod *ap), (ap)) __OTORP__(struct argnod *ap;){
- register char *rescan;
- register char *prefix;
- register char *pat;
- register struct dirent *dirp;
+ char *rescan;
+ char *prefix;
+ char *pat;
+ struct dirent *dirp;
DIR *dirf;
char *path=0;
char quote = 0;
#endif /* SHOPT_NOCASE */
while(dirp = readdir(dirf))
{
- register int c;
+ int c;
if(!D_FILENO(dirp))
continue;
if(fignore && *fignore && strmatch(dirp->d_name, fignore))
return;
}
-static void addmatch __PARAM__((const char *dir,const char *pat,const register char *rescan,char *endslash), (dir, pat, rescan, endslash)) __OTORP__(const char *dir;const char *pat;const register char *rescan;char *endslash;){
- register struct argnod *ap = (struct argnod*)stakseek(ARGVAL);
- register struct glob *gp = globptr();
+static void addmatch __PARAM__((const char *dir,const char *pat,const char *rescan,char *endslash), (dir, pat, rescan, endslash)) __OTORP__(const char *dir;const char *pat;const char *rescan;char *endslash;){
+ struct argnod *ap = (struct argnod*)stakseek(ARGVAL);
+ struct glob *gp = globptr();
struct stat statb;
if(dir)
{
* scan tree and add each name that matches the given pattern
*/
static void scantree __PARAM__((Hashtab_t *tree, const char *pattern), (tree, pattern)) __OTORP__(Hashtab_t *tree; const char *pattern;){
- register Hashpos_t *hp;
- register Namval_t *np;
- register struct argnod *ap;
- register struct glob *gp = globptr();
- register char *cp;
+ Hashpos_t *hp;
+ Namval_t *np;
+ struct argnod *ap;
+ struct glob *gp = globptr();
+ char *cp;
if(hp = hashscan(tree,0))
{
while((np = (Namval_t*)hashnext(hp)) && !nv_isnull(np))
* The number of matches is returned
*/
-int path_complete __PARAM__((const char *name,register const char *suffix, struct argnod **arghead), (name, suffix, arghead)) __OTORP__(const char *name;register const char *suffix; struct argnod **arghead;){
+int path_complete __PARAM__((const char *name,const char *suffix, struct argnod **arghead), (name, suffix, arghead)) __OTORP__(const char *name;const char *suffix; struct argnod **arghead;){
sufstr = suffix;
suflen = strlen(suffix);
return(path_expand(name,arghead));
*/
static void sh_trim(sp)
-register char *sp;
+char *sp;
{
- register char *dp = sp;
- register int c;
+ char *dp = sp;
+ int c;
while(1)
{
if((c= *sp++) == '\\')
#ifdef SHOPT_BRACEPAT
int path_generate __PARAM__((struct argnod *todo, struct argnod **arghead), (todo, arghead)) __OTORP__(struct argnod *todo; struct argnod **arghead;){
- register char *cp;
- register int brace;
- register struct argnod *ap;
+ char *cp;
+ int brace;
+ struct argnod *ap;
struct argnod *top = 0;
struct argnod *apin;
char *pat, *rescan, *bracep;
/*
* Most signals caught or ignored by the shell come here
*/
-void sh_fault __PARAM__((register int sig), (sig)) __OTORP__(register int sig;){
- register int flag;
- register char *trap;
- register struct checkpt *pp = (struct checkpt*)sh.jmplist;
+void sh_fault __PARAM__((int sig), (sig)) __OTORP__(int sig;){
+ int flag;
+ char *trap;
+ struct checkpt *pp = (struct checkpt*)sh.jmplist;
/* reset handler */
signal(sig, sh_fault);
/* handle ignored signals */
* initialize signal handling
*/
void sh_siginit __PARAM__((void), ()){
- register int sig, n=SIGTERM+1;
- register const struct shtable2 *tp = shtab_signals;
+ int sig, n=SIGTERM+1;
+ const struct shtable2 *tp = shtab_signals;
init_shtab_signals();
sig_begin();
/* find the largest signal number in the table */
/*
* Turn on trap handler for signal <sig>
*/
-void sh_sigtrap __PARAM__((register int sig), (sig)) __OTORP__(register int sig;){
- register int flag;
+void sh_sigtrap __PARAM__((int sig), (sig)) __OTORP__(int sig;){
+ int flag;
sh.st.otrapcom = 0;
if(sig==0)
sh_sigdone();
* set signal handler so sh_done is called for all caught signals
*/
void sh_sigdone __PARAM__((void), ()){
- register int flag, sig = sh.sigmax;
+ int flag, sig = sh.sigmax;
setdone=1;
sh.sigflag[0] |= SH_SIGFAULT;
while(--sig>0)
* Free the trap strings if mode is non-zero
* If mode>1 then ignored traps cause signal to be ignored
*/
-void sh_sigreset __PARAM__((register int mode), (mode)) __OTORP__(register int mode;){
- register char *trap;
- register int flag, sig=sh.st.trapmax;
+void sh_sigreset __PARAM__((int mode), (mode)) __OTORP__(int mode;){
+ char *trap;
+ int flag, sig=sh.st.trapmax;
while(sig-- > 0)
{
if(trap=sh.st.trapcom[sig])
/*
* free up trap if set and restore signal handler if modified
*/
-void sh_sigclear __PARAM__((register int sig), (sig)) __OTORP__(register int sig;){
- register int flag = sh.sigflag[sig];
- register char *trap;
+void sh_sigclear __PARAM__((int sig), (sig)) __OTORP__(int sig;){
+ int flag = sh.sigflag[sig];
+ char *trap;
sh.st.otrapcom=0;
if(!(flag&SH_SIGFAULT))
return;
*/
void sh_chktrap __PARAM__((void), ()){
- register int sig=sh.st.trapmax;
- register char *trap;
+ int sig=sh.st.trapmax;
+ char *trap;
if(!sh.trapnote)
sig=0;
sh.trapnote &= ~SH_SIGTRAP;
/*
* exit the current scope and jump to an earlier one based on pp->mode
*/
-void sh_exit __PARAM__((register int xno), (xno)) __OTORP__(register int xno;){
- register struct checkpt *pp = (struct checkpt*)sh.jmplist;
- register int sig=0;
+void sh_exit __PARAM__((int xno), (xno)) __OTORP__(int xno;){
+ struct checkpt *pp = (struct checkpt*)sh.jmplist;
+ int sig=0;
sh.exitval=xno;
if(xno==SH_EXITSIG)
sh.exitval |= (sig=sh.lastsig);
* This is the exit routine for the shell
*/
-void sh_done __PARAM__((register int sig), (sig)) __OTORP__(register int sig;){
- register char *t;
- register int savxit = sh.exitval;
+void sh_done __PARAM__((int sig), (sig)) __OTORP__(int sig;){
+ char *t;
+ int savxit = sh.exitval;
sh.trapnote = 0;
indone=1;
if(sig==0)
/*
* open stream <f> for fast character input
*/
-int fcfopen __PARAM__((register Sfio_t* f), (f)) __OTORP__(register Sfio_t* f;){
- register int n;
+int fcfopen __PARAM__((Sfio_t* f), (f)) __OTORP__(Sfio_t* f;){
+ int n;
char *buff;
Fcin_t save;
errno = 0;
* the previous character is a 0 byte.
*/
int fcfill __PARAM__((void), ()){
- register int n;
- register Sfio_t *f;
- register unsigned char *last=_Fcin.fclast, *ptr=_Fcin.fcptr;
+ int n;
+ Sfio_t *f;
+ unsigned char *last=_Fcin.fclast, *ptr=_Fcin.fcptr;
if(!(f=fcfile()))
{
/* see whether pointer has passed null byte */
* Synchronize and close the current stream
*/
int fcclose __PARAM__((void), ()){
- register unsigned char *ptr;
+ unsigned char *ptr;
if(_Fcin.fclast==0)
return(0);
if((ptr=_Fcin.fcptr)>_Fcin.fcbuff && *(ptr-1)==0)
/*
* Invalidate all path name bindings
*/
-static void rehash __PARAM__((register Namval_t *np), (np)) __OTORP__(register Namval_t *np;){
+static void rehash __PARAM__((Namval_t *np), (np)) __OTORP__(Namval_t *np;){
nv_onattr(np,NV_NOALIAS);
}
# include "edit.h"
/* Trap for CSWIDTH variable */
static void put_cswidth __PARAM__((Namval_t* np,const char *val,int flags,Namfun_t *fp), (np, val, flags, fp)) __OTORP__(Namval_t* np;const char *val;int flags;Namfun_t *fp;){
- register char *cp;
- register char *name = nv_name(np);
+ char *cp;
+ char *name = nv_name(np);
if(ed_setwidth(val?val:"") && !(flags&NV_IMPORT))
error(ERROR_exit(1),e_format,nv_name(np));
nv_putv(np, val, flags, fp);
#endif /* SHOPT_MULTIBYTE */
/* Trap for VISUAL and EDITOR variables */
-static void put_ed __PARAM__((register Namval_t* np,const char *val,int flags,Namfun_t *fp), (np, val, flags, fp)) __OTORP__(register Namval_t* np;const char *val;int flags;Namfun_t *fp;){
- register const char *cp, *name=nv_name(np);
+static void put_ed __PARAM__((Namval_t* np,const char *val,int flags,Namfun_t *fp), (np, val, flags, fp)) __OTORP__(Namval_t* np;const char *val;int flags;Namfun_t *fp;){
+ const char *cp, *name=nv_name(np);
if(*name=='E' && nv_getval(nv_scoped(VISINOD)))
goto done;
sh_offoption(SH_VI|SH_EMACS|SH_GMACS);
}
/* Trap for restricted variables PATH, SHELL, ENV */
-static void put_restricted __PARAM__((register Namval_t* np,const char *val,int flags,Namfun_t *fp), (np, val, flags, fp)) __OTORP__(register Namval_t* np;const char *val;int flags;Namfun_t *fp;){
+static void put_restricted __PARAM__((Namval_t* np,const char *val,int flags,Namfun_t *fp), (np, val, flags, fp)) __OTORP__(Namval_t* np;const char *val;int flags;Namfun_t *fp;){
if(!(flags&NV_RDONLY) && sh_isoption(SH_RESTRICTED))
error(ERROR_exit(1),e_restricted,nv_name(np));
if(nv_name(np)==nv_name(PATHNOD))
/*
* Without this proto, standard C says that _DtGetMessage() returns
* an int, even though it really returns a pointer. The compiler is
- * then free to use the high 32-bits of the return register for
+ * then free to use the high 32-bits of the return for
* something else (like scratch), and that can garble the pointer.
*/
char *_DtGetMessage __PROTO__((char *filename, int set, int n, char *s));
void charsize_init __PARAM__((void), ()){
static char fc[3] = { 0301, ESS2, ESS3};
char buff[8];
- register int i,n;
+ int i,n;
wchar_t wc;
memset(buff,0301,MB_CUR_MAX);
for(i=0; i<=2; i++)
free((__V_*)sh_lexstates[ST_BEGIN]);
if(ast.locale.set&LC_SET_CTYPE)
{
- register int c;
+ int c;
char *state[4];
sh_lexstates[ST_BEGIN] = state[0] = (char*)malloc(4*(1<<CHAR_BIT));
memcpy(state[0],sh_lexrstates[ST_BEGIN],(1<<CHAR_BIT));
#endif /* _hdr_locale */
/* Trap for IFS assignment and invalidates state table */
-static void put_ifs __PARAM__((register Namval_t* np,const char *val,int flags,Namfun_t *fp), (np, val, flags, fp)) __OTORP__(register Namval_t* np;const char *val;int flags;Namfun_t *fp;){
+static void put_ifs __PARAM__((Namval_t* np,const char *val,int flags,Namfun_t *fp), (np, val, flags, fp)) __OTORP__(Namval_t* np;const char *val;int flags;Namfun_t *fp;){
ifsnp = 0;
nv_putv(np, val, flags, fp);
}
* This is the lookup function for IFS
* It keeps the sh.ifstable up to date
*/
-static char* get_ifs __PARAM__((register Namval_t* np, Namfun_t *fp), (np, fp)) __OTORP__(register Namval_t* np; Namfun_t *fp;){
- register char *cp, *value;
- register int c,n;
+static char* get_ifs __PARAM__((Namval_t* np, Namfun_t *fp), (np, fp)) __OTORP__(Namval_t* np; Namfun_t *fp;){
+ char *cp, *value;
+ int c,n;
value = nv_getv(np,fp);
if(np!=ifsnp)
{
# define gettimeofday(a,b)
#endif
-static void put_seconds __PARAM__((register Namval_t* np,const char *val,int flags,Namfun_t *fp), (np, val, flags, fp)) __OTORP__(register Namval_t* np;const char *val;int flags;Namfun_t *fp;){
+static void put_seconds __PARAM__((Namval_t* np,const char *val,int flags,Namfun_t *fp), (np, val, flags, fp)) __OTORP__(Namval_t* np;const char *val;int flags;Namfun_t *fp;){
static double sec_offset;
double d;
struct tms tp;
}
}
-static char* get_seconds __PARAM__((register Namval_t* np, Namfun_t *fp), (np, fp)) __OTORP__(register Namval_t* np; Namfun_t *fp;){
+static char* get_seconds __PARAM__((Namval_t* np, Namfun_t *fp), (np, fp)) __OTORP__(Namval_t* np; Namfun_t *fp;){
struct tms tp;
double d;
NOT_USED(fp);
return(sh_ftos(d,nv_size(np)));
}
-static double nget_seconds __PARAM__((register Namval_t* np, Namfun_t *fp), (np, fp)) __OTORP__(register Namval_t* np; Namfun_t *fp;){
+static double nget_seconds __PARAM__((Namval_t* np, Namfun_t *fp), (np, fp)) __OTORP__(Namval_t* np; Namfun_t *fp;){
struct tms tp;
NOT_USED(fp);
gettimeofday(&tp,NIL(void *));
/*
* These three functions are used to get and set the RANDOM variable
*/
-static void put_rand __PARAM__((register Namval_t* np,const char *val,int flags,Namfun_t *fp), (np, val, flags, fp)) __OTORP__(register Namval_t* np;const char *val;int flags;Namfun_t *fp;){
+static void put_rand __PARAM__((Namval_t* np,const char *val,int flags,Namfun_t *fp), (np, val, flags, fp)) __OTORP__(Namval_t* np;const char *val;int flags;Namfun_t *fp;){
static long rand_last;
- register long n;
+ long n;
NOT_USED(fp);
if(!val)
{
* get random number in range of 0 - 2**15
* never pick same number twice in a row
*/
-static double nget_rand __PARAM__((register Namval_t* np, Namfun_t *fp), (np, fp)) __OTORP__(register Namval_t* np; Namfun_t *fp;){
- register long cur, last= *np->nvalue.lp;
+static double nget_rand __PARAM__((Namval_t* np, Namfun_t *fp), (np, fp)) __OTORP__(Namval_t* np; Namfun_t *fp;){
+ long cur, last= *np->nvalue.lp;
NOT_USED(fp);
do
cur = (rand()>>rand_shift)&RANDMASK;
return((double)cur);
}
-static char* get_rand __PARAM__((register Namval_t* np, Namfun_t *fp), (np, fp)) __OTORP__(register Namval_t* np; Namfun_t *fp;){
- register long n = nget_rand(np,fp);
+static char* get_rand __PARAM__((Namval_t* np, Namfun_t *fp), (np, fp)) __OTORP__(Namval_t* np; Namfun_t *fp;){
+ long n = nget_rand(np,fp);
return(fmtbase(n, 10, 0));
}
}
static void put_lineno __PARAM__((Namval_t* np,const char *val,int flags,Namfun_t *fp), (np, val, flags, fp)) __OTORP__(Namval_t* np;const char *val;int flags;Namfun_t *fp;){
- register long n;
+ long n;
NOT_USED(fp);
if(!val)
{
sh.st.firstline += nget_lineno(np,fp)+1-n;
}
-static char* get_lineno __PARAM__((register Namval_t* np, Namfun_t *fp), (np, fp)) __OTORP__(register Namval_t* np; Namfun_t *fp;){
- register long n = nget_lineno(np,fp);
+static char* get_lineno __PARAM__((Namval_t* np, Namfun_t *fp), (np, fp)) __OTORP__(Namval_t* np; Namfun_t *fp;){
+ long n = nget_lineno(np,fp);
return(fmtbase(n, 10, 0));
}
* set or unset the mappings given a colon separated list of directories
*/
static void vpath_set __PARAM__((char *str, int mode), (str, mode)) __OTORP__(char *str; int mode;){
- register char *lastp, *oldp=str, *newp=strchr(oldp,':');
+ char *lastp, *oldp=str, *newp=strchr(oldp,':');
if(!sh.lim.fs3d)
return;
while(newp)
}
/* catch vpath assignments */
- static void put_vpath __PARAM__((register Namval_t* np,const char *val,int flags,Namfun_t *fp), (np, val, flags, fp)) __OTORP__(register Namval_t* np;const char *val;int flags;Namfun_t *fp;){
- register char *cp;
+ static void put_vpath __PARAM__((Namval_t* np,const char *val,int flags,Namfun_t *fp), (np, val, flags, fp)) __OTORP__(Namval_t* np;const char *val;int flags;Namfun_t *fp;){
+ char *cp;
if(cp = nv_getval(np))
vpath_set(cp,0);
if(val)
* This function will get called whenever a configuration parameter changes
*/
static int newconf __PARAM__((const char *name, const char *path, const char *value), (name, path, value)) __OTORP__(const char *name; const char *path; const char *value;){
- register char *arg;
+ char *arg;
if(strcmp(name,"UNIVERSE")==0 && strcmp(astconf(name,0,0),value))
{
sh.universe = 0;
/*
* initialize the shell
*/
-int sh_init __PARAM__((register int argc,register char *argv[]), (argc, argv)) __OTORP__(register int argc;register char *argv[];){
- register char *name;
- register int n,prof;
+int sh_init __PARAM__((int argc,char *argv[]), (argc, argv)) __OTORP__(int argc;char *argv[];){
+ char *name;
+ int n,prof;
#ifdef MTRACE
Mt_certify = 1;
#endif /* MTRACE */
/*
* set when creating a local variable of this name
*/
-Namfun_t *nv_cover __PARAM__((register Namval_t *np), (np)) __OTORP__(register Namval_t *np;){
- register Namfun_t *nfp=0;
+Namfun_t *nv_cover __PARAM__((Namval_t *np), (np)) __OTORP__(Namval_t *np;){
+ Namfun_t *nfp=0;
if(np==IFSNOD)
nfp = &IFS_init;
else if(np==PATHNOD)
*/
static Hashtab_t *inittree __PARAM__((const struct shtable2 *name_vals), (name_vals)) __OTORP__(const struct shtable2 *name_vals;){
- register Namval_t *np;
- register const struct shtable2 *tp;
- register unsigned n = 0;
- register Hashtab_t *treep;
+ Namval_t *np;
+ const struct shtable2 *tp;
+ unsigned n = 0;
+ Hashtab_t *treep;
for(tp=name_vals;*tp->sh_name;tp++)
n++;
np = (Namval_t*)calloc(n,sizeof(Namval_t));
*/
static void env_init __PARAM__((void), ()){
- register char *cp;
- register Namval_t *np;
- register char **ep=environ;
- register char *next=0;
+ char *cp;
+ Namval_t *np;
+ char **ep=environ;
+ char *next=0;
if(ep)
{
while(cp= *ep++)
static int slowexcept __PROTO__((Sfio_t*, int, Sfdisc_t*));
static int pipeexcept __PROTO__((Sfio_t*, int, Sfdisc_t*));
static int io_prompt __PROTO__((int));
-static int io_heredoc __PROTO__((register struct ionod*));
+static int io_heredoc __PROTO__((struct ionod*));
static void sftrack __PROTO__((Sfio_t*,int,int));
static int tee_write __PROTO__((Sfio_t*,const __V_*,int,Sfdisc_t*));
static const Sfdisc_t eval_disc = { NULL, NULL, NULL, eval_exceptf, NULL};
/* ======== input output and file copying ======== */
void sh_ioinit __PARAM__((void), ()){
- register int n;
+ int n;
filemapsize = 8;
filemap = (struct fdsave*)malloc(8*sizeof(struct fdsave));
#ifdef SHOPT_FASTPIPE
* For output streams, the buffer is set to sh.output and put into
* the sh.outpool synchronization pool
*/
-Sfio_t *sh_iostream __PARAM__((register int fd), (fd)) __OTORP__(register int fd;){
- register Sfio_t *iop;
- register int status = sh_iocheckfd(fd);
- register int flags = SF_WRITE;
+Sfio_t *sh_iostream __PARAM__((int fd), (fd)) __OTORP__(int fd;){
+ Sfio_t *iop;
+ int status = sh_iocheckfd(fd);
+ int flags = SF_WRITE;
char *bp;
int size;
#ifdef SHOPT_FASTPIPE
/*
* preserve the file descriptor or stream by moving it
*/
-static void io_preserve __PARAM__((register Sfio_t *sp, register int f2), (sp, f2)) __OTORP__(register Sfio_t *sp; register int f2;){
- register int fd;
+static void io_preserve __PARAM__((Sfio_t *sp, int f2), (sp, f2)) __OTORP__(Sfio_t *sp; int f2;){
+ int fd;
if(sp)
fd = sfsetfd(sp,10);
else
* The original stream <f1> is closed.
* The new file descriptor <f2> is returned;
*/
-int sh_iorenumber __PARAM__((register int f1,register int f2), (f1, f2)) __OTORP__(register int f1;register int f2;){
- register Sfio_t *sp = sh.sftable[f2];
+int sh_iorenumber __PARAM__((int f1,int f2), (f1, f2)) __OTORP__(int f1;int f2;){
+ Sfio_t *sp = sh.sftable[f2];
if(f1!=f2)
{
/* see whether file descriptor is in use */
sh_close(f2);
if(f2<=2 && sp)
{
- register Sfio_t *spnew = sh_iostream(f1);
+ Sfio_t *spnew = sh_iostream(f1);
sh.fdstatus[f2] = (sh.fdstatus[f1]&~IOCLEX);
sfsetfd(spnew,f2);
sfswap(spnew,sp);
/*
* close a file descriptor and update stream table and attributes
*/
-int sh_close __PARAM__((register int fd), (fd)) __OTORP__(register int fd;){
- register Sfio_t *sp;
- register int r = 0;
+int sh_close __PARAM__((int fd), (fd)) __OTORP__(int fd;){
+ Sfio_t *sp;
+ int r = 0;
if(fd<0)
return(-1);
if(fd==sh.coutpipe)
* Open a file for reading
* On failure, print message.
*/
-int sh_open __PARAM__((register const char *path, int flags, ...), (va_alist)) __OTORP__(va_dcl)
-{ __OTORP__(register const char *path; int flags; )
- register int fd;
+int sh_open __PARAM__((const char *path, int flags, ...), (va_alist)) __OTORP__(va_dcl)
+{ __OTORP__(const char *path; int flags; )
+ int fd;
mode_t mode;
#ifdef SOCKET
struct sockaddr_in addr;
return(fd);
}
-int sh_chkopen __PARAM__((register const char *name), (name)) __OTORP__(register const char *name;){
- register int fd = sh_open(name,O_RDONLY,0);
+int sh_chkopen __PARAM__((const char *name), (name)) __OTORP__(const char *name;){
+ int fd = sh_open(name,O_RDONLY,0);
if(fd < 0)
error(ERROR_system(1),e_open,name);
return(fd);
/*
* move open file descriptor to a number > 2
*/
-int sh_iomovefd __PARAM__((register int fdold), (fdold)) __OTORP__(register int fdold;){
- register int fdnew;
+int sh_iomovefd __PARAM__((int fdold), (fdold)) __OTORP__(int fdold;){
+ int fdnew;
if(fdold<0 || fdold>2)
return(fdold);
fdnew = sh_iomovefd(dup(fdold));
/*
* create a pipe and print message on failure
*/
-int sh_pipe __PARAM__((register int pv[]), (pv)) __OTORP__(register int pv[];){
+int sh_pipe __PARAM__((int pv[]), (pv)) __OTORP__(int pv[];){
int fd[2];
if(pipe(fd)<0 || (pv[0]=fd[0])<0 || (pv[1]=fd[1])<0)
error(ERROR_system(1),e_pipe);
/*
* close a pipe
*/
-void sh_pclose __PARAM__((register int pv[]), (pv)) __OTORP__(register int pv[];){
+void sh_pclose __PARAM__((int pv[]), (pv)) __OTORP__(int pv[];){
if(pv[0]>=2)
sh_close(pv[0]);
if(pv[1]>=2)
* flag = 3 when called from $( < ...), just open file and return
*/
int sh_redirect __PARAM__((struct ionod *iop, int flag), (iop, flag)) __OTORP__(struct ionod *iop; int flag;){
- register char *fname;
- register int fd, iof;
- register Namval_t *np=0;
+ char *fname;
+ int fd, iof;
+ Namval_t *np=0;
const char *message = e_open;
int o_mode; /* mode flag for open */
static char io_op[5]; /* used for -x trace info */
/*
* Create a tmp file for the here-document
*/
-static int io_heredoc __PARAM__((register struct ionod *iop), (iop)) __OTORP__(register struct ionod *iop;){
- register Sfio_t *infile = 0, *outfile;
- register char fd;
+static int io_heredoc __PARAM__((struct ionod *iop), (iop)) __OTORP__(struct ionod *iop;){
+ Sfio_t *infile = 0, *outfile;
+ char fd;
/* create an unnamed temporary file */
if(!(outfile=sftmp(0)))
error(ERROR_system(1),e_tmpcreate);
* if <origfd> < 0, then -origfd is saved, but not duped so that it
* will be closed with sh_iorestore.
*/
-void sh_iosave __PARAM__((register int origfd, int oldtop), (origfd, oldtop)) __OTORP__(register int origfd; int oldtop;){
+void sh_iosave __PARAM__((int origfd, int oldtop), (origfd, oldtop)) __OTORP__(int origfd; int oldtop;){
/*@
assume oldtop>=0 && oldtop<sh.lim.open_max;
@*/
- register int savefd;
+ int savefd;
/* see if already saved, only save once */
for(savefd=sh.topfd; --savefd>=oldtop; )
{
filemap[sh.topfd++].save_fd = savefd;
if(savefd >=0)
{
- register Sfio_t* sp = sh.sftable[origfd];
+ Sfio_t* sp = sh.sftable[origfd];
/* make saved file close-on-exec */
fcntl(savefd,F_SETFD,FD_CLOEXEC);
if(origfd==job.fd)
* close all saved file descriptors
*/
void sh_iounsave __PARAM__((void), ()){
- register int fd, savefd, newfd;
+ int fd, savefd, newfd;
for(newfd=fd=0; fd < sh.topfd; fd++)
{
if((savefd = filemap[fd].save_fd)< 0)
* restore saved file descriptors from <last> on
*/
void sh_iorestore __PARAM__((int last), (last)) __OTORP__(int last;){
- register int origfd, savefd, fd;
+ int origfd, savefd, fd;
for (fd = sh.topfd - 1; fd >= last; fd--)
{
origfd = filemap[fd].orig_fd;
* returns -1 for failure, 0 for success
* <mode> is the same as for access()
*/
-sh_ioaccess __PARAM__((int fd,register int mode), (fd, mode)) __OTORP__(int fd;register int mode;){
- register int flags;
+sh_ioaccess __PARAM__((int fd,int mode), (fd, mode)) __OTORP__(int fd;int mode;){
+ int flags;
if(mode==X_OK)
return(-1);
if((flags=sh_iocheckfd(fd))!=IOCLOSE)
* 0 returned on error
*/
-static int str2inet __PARAM__((register const char *sp, struct sockaddr_in *addr), (sp, addr)) __OTORP__(register const char *sp; struct sockaddr_in *addr;){
- register int n=0,c,v;
+static int str2inet __PARAM__((const char *sp, struct sockaddr_in *addr), (sp, addr)) __OTORP__(const char *sp; struct sockaddr_in *addr;){
+ int n=0,c,v;
unsigned long a=0;
unsigned short p;
/*
* Handle interrupts for slow streams
*/
-static int slowexcept __PARAM__((register Sfio_t *iop, int type, Sfdisc_t *handle), (iop, type, handle)) __OTORP__(register Sfio_t *iop; int type; Sfdisc_t *handle;){
- register int n,fno;
+static int slowexcept __PARAM__((Sfio_t *iop, int type, Sfdisc_t *handle), (iop, type, handle)) __OTORP__(Sfio_t *iop; int type; Sfdisc_t *handle;){
+ int n,fno;
NOT_USED(handle);
if(type!=SF_READ)
return(0);
sh.trapnote |= SH_SIGTRAP;
}
-static int piperead __PARAM__((Sfio_t *iop,__V_ *buff,register int size,Sfdisc_t *handle), (iop, buff, size, handle)) __OTORP__(Sfio_t *iop;__V_ *buff;register int size;Sfdisc_t *handle;){
+static int piperead __PARAM__((Sfio_t *iop,__V_ *buff,int size,Sfdisc_t *handle), (iop, buff, size, handle)) __OTORP__(Sfio_t *iop;__V_ *buff;int size;Sfdisc_t *handle;){
NOT_USED(handle);
size = ed_read(sffileno(iop), (char*)buff, size);
return(size);
* This is the read discipline that is applied to slow devices
* This routine takes care of prompting for input
*/
-static int slowread __PARAM__((Sfio_t *iop,__V_ *buff,register int size,Sfdisc_t *handle), (iop, buff, size, handle)) __OTORP__(Sfio_t *iop;__V_ *buff;register int size;Sfdisc_t *handle;){
+static int slowread __PARAM__((Sfio_t *iop,__V_ *buff,int size,Sfdisc_t *handle), (iop, buff, size, handle)) __OTORP__(Sfio_t *iop;__V_ *buff;int size;Sfdisc_t *handle;){
int (*readf) __PROTO__((int, char*, int));
NOT_USED(handle);
if(io_prompt(sh.nextprompt)<0 && errno==EIO)
* check and return the attributes for a file descriptor
*/
-int sh_iocheckfd __PARAM__((register int fd), (fd)) __OTORP__(register int fd;){
- register int flags, n;
+int sh_iocheckfd __PARAM__((int fd), (fd)) __OTORP__(int fd;){
+ int flags, n;
if((n=sh.fdstatus[fd])&IOCLOSE)
return(n);
if(!(n&(IOREAD|IOWRITE)))
* Display prompt PS<flag> on standard error
*/
-static int io_prompt __PARAM__((register int flag), (flag)) __OTORP__(register int flag;){
- register char *cp;
+static int io_prompt __PARAM__((int flag), (flag)) __OTORP__(int flag;){
+ char *cp;
char *endprompt;
static short cmdno;
int sfflags;
{
case 1:
{
- register int c;
+ int c;
#if defined(TIOCLBIC) && defined(LFLUSHO)
if(!sh_isoption(SH_VI|SH_EMACS|SH_GMACS))
{
* keep track of each stream that is opened and closed
*/
static void sftrack __PARAM__((Sfio_t* sp,int flag, int newfd), (sp, flag, newfd)) __OTORP__(Sfio_t* sp;int flag; int newfd;){
- register int fd = sffileno(sp);
- register struct checkpt *pp;
- register int mode;
+ int fd = sffileno(sp);
+ struct checkpt *pp;
+ int mode;
if(flag==SF_SETFD && newfd<0)
{
flag = SF_CLOSE;
* Create a stream consisting of a space separated argv[] list
*/
-Sfio_t *sh_sfeval __PARAM__((register char *argv[]), (argv)) __OTORP__(register char *argv[];){
- register Sfio_t *iop;
- register char *cp;
+Sfio_t *sh_sfeval __PARAM__((char *argv[]), (argv)) __OTORP__(char *argv[];){
+ Sfio_t *iop;
+ char *cp;
if(argv[1])
cp = "";
else
iop = sfopen(NIL(Sfio_t*),(char*)cp,"s");
if(argv[1])
{
- register struct eval *ep;
+ struct eval *ep;
if(!(ep = new_of(struct eval,0)))
return(NIL(Sfio_t*));
ep->disc = eval_disc;
*/
static int eval_exceptf __PARAM__((Sfio_t *iop,int type, Sfdisc_t *handle), (iop, type, handle)) __OTORP__(Sfio_t *iop;int type; Sfdisc_t *handle;){
- register struct eval *ep = (struct eval*)handle;
- register char *cp;
- register int len;
+ struct eval *ep = (struct eval*)handle;
+ char *cp;
+ int len;
/* no more to do */
if(type!=SF_READ || !(cp = ep->argv[0]))
*/
static Sfio_t *subopen __PARAM__((Sfio_t* sp, off_t offset, long size), (sp, offset, size)) __OTORP__(Sfio_t* sp; off_t offset; long size;){
- register struct subfile *disp;
- register int fd = sffileno(sp);
+ struct subfile *disp;
+ int fd = sffileno(sp);
if(sfseek(sp,offset,SEEK_SET) <0)
return(NIL(Sfio_t*));
if(!(disp = (struct subfile*)malloc(sizeof(struct subfile)+IOBSIZE+1)))
/*
* read function for subfile discipline
*/
-static int subread __PARAM__((Sfio_t* sp,__V_* buff,register int size,Sfdisc_t* handle), (sp, buff, size, handle)) __OTORP__(Sfio_t* sp;__V_* buff;register int size;Sfdisc_t* handle;){
- register struct subfile *disp = (struct subfile*)handle;
+static int subread __PARAM__((Sfio_t* sp,__V_* buff,int size,Sfdisc_t* handle), (sp, buff, size, handle)) __OTORP__(Sfio_t* sp;__V_* buff;int size;Sfdisc_t* handle;){
+ struct subfile *disp = (struct subfile*)handle;
NOT_USED(sp);
if(disp->left == 0)
return(0);
/*
* exception handler for subfile discipline
*/
-static int subexcept __PARAM__((Sfio_t* sp,register int mode, Sfdisc_t* handle), (sp, mode, handle)) __OTORP__(Sfio_t* sp;register int mode; Sfdisc_t* handle;){
- register struct subfile *disp = (struct subfile*)handle;
+static int subexcept __PARAM__((Sfio_t* sp,int mode, Sfdisc_t* handle), (sp, mode, handle)) __OTORP__(Sfio_t* sp;int mode; Sfdisc_t* handle;){
+ struct subfile *disp = (struct subfile*)handle;
if(mode==SF_CLOSE)
{
sfdisc(sp,SF_POPDISC);
* print a list of arguments in columns
*/
void sh_menu __PARAM__((Sfio_t *outfile,int argn,char *argv[]), (outfile, argn, argv)) __OTORP__(Sfio_t *outfile;int argn;char *argv[];){
- register int i,j;
- register char **arg;
+ int i,j;
+ char **arg;
int nrow, ncol=1, ndigits=1;
int fldsize, wsize = ed_window();
char *cp = nv_getval(nv_scoped(LINES));
/*
* shell version of read() for user added builtins
*/
-ssize_t sh_read __PARAM__((register int fd, __V_* buff, size_t n), (fd, buff, n)) __OTORP__(register int fd; __V_* buff; size_t n;){
- register Sfio_t *sp;
+ssize_t sh_read __PARAM__((int fd, __V_* buff, size_t n), (fd, buff, n)) __OTORP__(int fd; __V_* buff; size_t n;){
+ Sfio_t *sp;
if(sp=sh.sftable[fd])
return(sfread(sp,buff,n));
else
/*
* shell version of write() for user added builtins
*/
-ssize_t sh_write __PARAM__((register int fd, const __V_* buff, size_t n), (fd, buff, n)) __OTORP__(register int fd; const __V_* buff; size_t n;){
- register Sfio_t *sp;
+ssize_t sh_write __PARAM__((int fd, const __V_* buff, size_t n), (fd, buff, n)) __OTORP__(int fd; const __V_* buff; size_t n;){
+ Sfio_t *sp;
if(sp=sh.sftable[fd])
return(sfwrite(sp,buff,n));
else
/*
* shell version of lseek() for user added builtins
*/
-off_t sh_seek __PARAM__((register int fd, off_t offset, int whence), (fd, offset, whence)) __OTORP__(register int fd; off_t offset; int whence;){
- register Sfio_t *sp;
+off_t sh_seek __PARAM__((int fd, off_t offset, int whence), (fd, offset, whence)) __OTORP__(int fd; off_t offset; int whence;){
+ Sfio_t *sp;
if(sp=sh.sftable[fd])
return(sfseek(sp,offset,whence));
else
}
#undef dup
-int sh_dup __PARAM__((register int old), (old)) __OTORP__(register int old;){
- register int fd = dup(old);
+int sh_dup __PARAM__((int old), (old)) __OTORP__(int old;){
+ int fd = dup(old);
if(fd>=0)
sh.fdstatus[fd] = (sh.fdstatus[old]&~IOCLEX);
return(fd);
* This is the SIGCLD interrupt routine
* When called with sig==0, it does a blocking wait
*/
-static void job_waitsafe __PARAM__((register int sig), (sig)) __OTORP__(register int sig;){
- register pid_t pid;
- register struct process *pw;
- register int flags;
+static void job_waitsafe __PARAM__((int sig), (sig)) __OTORP__(int sig;){
+ pid_t pid;
+ struct process *pw;
+ int flags;
struct process dummy;
struct jobsave *jp;
int wstat;
* if lflag is set the switching driver message will not print
*/
void job_init __PARAM__((int lflag), (lflag)) __OTORP__(int lflag;){
- register int ntry=0;
+ int ntry=0;
job.fd = JOBTTY;
signal(SIGCHLD,job_waitsafe);
{
/* Get a controlling terminal and set process group */
/* This should have already been done by rlogin */
- register int fd;
- register char *ttynam;
+ int fd;
+ char *ttynam;
#ifndef SIGTSTP
setpgid(0,sh.pid);
#endif /*SIGTSTP */
* restore tty driver and pgrp
*/
int job_close __PARAM__((void), ()){
- register struct process *pw = job.pwlist;
- register int count = 0, running = 0;
+ struct process *pw = job.pwlist;
+ int count = 0, running = 0;
if(possible && !job.jobcontrol)
return(0);
else if(!possible && (!sh_isstate(SH_MONITOR) || sh_isstate(SH_FORKED)))
return(0);
}
-static void job_set __PARAM__((register struct process *pw), (pw)) __OTORP__(register struct process *pw;){
+static void job_set __PARAM__((struct process *pw), (pw)) __OTORP__(struct process *pw;){
/* save current terminal state */
tty_get(job.fd,&my_stty);
if(pw->p_flag&P_STTY)
#endif /* SIGTSTP */
}
-static void job_reset __PARAM__((register struct process *pw), (pw)) __OTORP__(register struct process *pw;){
+static void job_reset __PARAM__((struct process *pw), (pw)) __OTORP__(struct process *pw;){
/* save the terminal state for current job */
#ifdef SIGTSTP
job_fgrp(pw,tcgetpgrp(job.fd));
*/
void job_bwait __PARAM__((char **jobs), (jobs)) __OTORP__(char **jobs;){
- register char *job;
- register struct process *pw;
- register pid_t pid;
+ char *job;
+ struct process *pw;
+ pid_t pid;
if(*jobs==0)
job_wait((pid_t)-1);
else while(job = *jobs++)
*/
int job_walk __PARAM__((Sfio_t *file,int (*fun)(struct process*,int),int arg,char *joblist[]), (file, fun, arg, joblist)) __OTORP__(Sfio_t *file;int (*fun)();int arg;char *joblist[];){
- register struct process *pw = job.pwlist;
- register int r = 0;
- register char *jobid, **jobs=joblist;
- register struct process *px;
+ struct process *pw = job.pwlist;
+ int r = 0;
+ char *jobid, **jobs=joblist;
+ struct process *px;
job_string = 0;
outfile = file;
by_number = 0;
/*
* send signal <sig> to background process group if not disowned
*/
-int job_terminate __PARAM__((register struct process *pw,register int sig), (pw, sig)) __OTORP__(register struct process *pw;register int sig;){
+int job_terminate __PARAM__((struct process *pw,int sig), (pw, sig)) __OTORP__(struct process *pw;int sig;){
if(pw->p_pgrp && !(pw->p_flag&P_DISOWN))
job_kill(pw,sig);
return(0);
* flag JOB_PFLAG for process id(s) only
*/
-int job_list __PARAM__((struct process *pw,register int flag), (pw, flag)) __OTORP__(struct process *pw;register int flag;){
- register struct process *px = pw;
- register int n;
- register const char *msg;
- register int msize;
+int job_list __PARAM__((struct process *pw,int flag), (pw, flag)) __OTORP__(struct process *pw;int flag;){
+ struct process *px = pw;
+ int n;
+ const char *msg;
+ int msize;
if(!pw || pw->p_job<=0)
return(1);
if(pw->p_env != sh.jobenv)
* get the process group given the job number
* This routine returns the process group number or -1
*/
-static struct process *job_bystring __PARAM__((register char *ajob), (ajob)) __OTORP__(register char *ajob;){
- register struct process *pw=job.pwlist;
- register int c;
+static struct process *job_bystring __PARAM__((char *ajob), (ajob)) __OTORP__(char *ajob;){
+ struct process *pw=job.pwlist;
+ int c;
if(*ajob++ != '%' || !pw)
return(NIL(struct process*));
c = *ajob;
* Kill a job or process
*/
-int job_kill __PARAM__((register struct process *pw,register int sig), (pw, sig)) __OTORP__(register struct process *pw;register int sig;){
- register pid_t pid;
- register int r;
+int job_kill __PARAM__((struct process *pw,int sig), (pw, sig)) __OTORP__(struct process *pw;int sig;){
+ pid_t pid;
+ int r;
const char *msg;
#ifdef SIGTSTP
int stopsig = (sig==SIGSTOP||sig==SIGTSTP||sig==SIGTTIN||sig==SIGTTOU);
*/
static struct process *job_byname __PARAM__((char *name), (name)) __OTORP__(char *name;){
- register struct process *pw = job.pwlist;
- register struct process *pz = 0;
- register int *flag = 0;
- register char *cp = name;
+ struct process *pw = job.pwlist;
+ struct process *pz = 0;
+ int *flag = 0;
+ char *cp = name;
int offset;
if(!sh.hist_ptr)
return(NIL(struct process*));
*/
void job_clear __PARAM__((void), ()){
- register struct process *pw, *px;
- register struct process *pwnext;
- register int j = BYTE(sh.lim.child_max);
- register struct jobsave *jp;
+ struct process *pw, *px;
+ struct process *pwnext;
+ int j = BYTE(sh.lim.child_max);
+ struct jobsave *jp;
for(pw=job.pwlist; pw; pw=pwnext)
{
pwnext = pw->p_nxtjob;
*/
int job_post __PARAM__((pid_t pid, pid_t join), (pid, join)) __OTORP__(pid_t pid; pid_t join;){
- register struct process *pw;
- register History_t *hp = sh.hist_ptr;
+ struct process *pw;
+ History_t *hp = sh.hist_ptr;
sh.jobenv = sh.curenv;
if(job.toclear)
{
*/
static struct process *job_bypid __PARAM__((pid_t pid), (pid)) __OTORP__(pid_t pid;){
- register struct process *pw, *px;
+ struct process *pw, *px;
for(pw=job.pwlist; pw; pw=pw->p_nxtjob)
for(px=pw; px; px=px->p_nxtproc)
{
*/
static struct process *job_byjid __PARAM__((int jobid), (jobid)) __OTORP__(int jobid;){
- register struct process *pw;
+ struct process *pw;
for(pw=job.pwlist;pw; pw = pw->p_nxtjob)
{
if(pw->p_job==jobid)
/*
* print a signal message
*/
-static void job_prmsg __PARAM__((register struct process *pw), (pw)) __OTORP__(register struct process *pw;){
+static void job_prmsg __PARAM__((struct process *pw), (pw)) __OTORP__(struct process *pw;){
if(pw->p_exit!=SIGINT && pw->p_exit!=SIGPIPE)
{
- register const char *msg, *dump;
+ const char *msg, *dump;
msg = job_sigmsg((int)(pw->p_exit));
msg = ERROR_translate(msg,1);
if(pw->p_flag&P_COREDUMP)
* pid=-1 to wait for all runing processes
*/
-void job_wait __PARAM__((register pid_t pid), (pid)) __OTORP__(register pid_t pid;){
- register struct process *pw=0,*px;
- register int jobid = 0;
+void job_wait __PARAM__((pid_t pid), (pid)) __OTORP__(pid_t pid;){
+ struct process *pw=0,*px;
+ int jobid = 0;
char intr = 0;
if(pid <= 0)
{
* disown job if bgflag == 'd'
*/
-job_switch __PARAM__((register struct process *pw,int bgflag), (pw, bgflag)) __OTORP__(register struct process *pw;int bgflag;){
- register const char *msg;
+job_switch __PARAM__((struct process *pw,int bgflag), (pw, bgflag)) __OTORP__(struct process *pw;int bgflag;){
+ const char *msg;
if(!pw || !(pw=job_byjid((int)pw->p_job)))
return(1);
if(bgflag=='d')
* Set the foreground group associated with a job
*/
-static void job_fgrp __PARAM__((register struct process *pw, int newgrp), (pw, newgrp)) __OTORP__(register struct process *pw; int newgrp;){
+static void job_fgrp __PARAM__((struct process *pw, int newgrp), (pw, newgrp)) __OTORP__(struct process *pw; int newgrp;){
for(; pw; pw=pw->p_nxtproc)
pw->p_fgrp = newgrp;
}
* turn off STOP state of a process group and send CONT signals
*/
-static void job_unstop __PARAM__((register struct process *px), (px)) __OTORP__(register struct process *px;){
- register struct process *pw;
- register int num = 0;
+static void job_unstop __PARAM__((struct process *px), (px)) __OTORP__(struct process *px;){
+ struct process *pw;
+ int num = 0;
for(pw=px ;pw ;pw=pw->p_nxtproc)
{
if(pw->p_flag&P_STOPPED)
* if <notify> is non-zero, then jobs with pending notifications are unposted
*/
-static struct process *job_unpost __PARAM__((register struct process *pwtop,int notify), (pwtop, notify)) __OTORP__(register struct process *pwtop;int notify;){
- register struct process *pw;
+static struct process *job_unpost __PARAM__((struct process *pwtop,int notify), (pwtop, notify)) __OTORP__(struct process *pwtop;int notify;){
+ struct process *pw;
/* make sure all processes are done */
#ifdef DEBUG
sfprintf(sfstderr,"%ld: unpost pid=%ld\n",(long)getpid(),(long)pwtop->p_pid);
/*
* unlink a job form the job list
*/
-static void job_unlink __PARAM__((register struct process *pw), (pw)) __OTORP__(register struct process *pw;){
- register struct process *px;
+static void job_unlink __PARAM__((struct process *pw), (pw)) __OTORP__(struct process *pw;){
+ struct process *px;
if(pw==job.pwlist)
{
job.pwlist = pw->p_nxtjob;
*/
static int job_alloc __PARAM__((void), ()){
- register int j=0;
- register unsigned mask = 1;
- register unsigned char *freeword;
- register int jmax = BYTE(sh.lim.child_max);
+ int j=0;
+ unsigned mask = 1;
+ unsigned char *freeword;
+ int jmax = BYTE(sh.lim.child_max);
/* skip to first word with a free slot */
for(j=0;job.freejobs[j] == UCHAR_MAX; j++);
if(j >= jmax)
{
- register struct process *pw;
+ struct process *pw;
for(j=1; j < sh.lim.child_max; j++)
{
if((pw=job_byjid(j))&& !job_unpost(pw,0))
* return a job number
*/
-static void job_free __PARAM__((register int n), (n)) __OTORP__(register int n;){
- register int j = (--n)/CHAR_BIT;
- register unsigned mask;
+static void job_free __PARAM__((int n), (n)) __OTORP__(int n;){
+ int j = (--n)/CHAR_BIT;
+ unsigned mask;
n -= j*CHAR_BIT;
mask = 1 << n;
job.freejobs[j] &= ~mask;
* if pid==0, then oldest saved process is deleted
* If pid is not found a -1 is returned.
*/
-int job_chksave __PARAM__((register pid_t pid), (pid)) __OTORP__(register pid_t pid;){
- register struct jobsave *jp = bck_list, *jpold=0;
- register int r= -1;
+int job_chksave __PARAM__((pid_t pid), (pid)) __OTORP__(pid_t pid;){
+ struct jobsave *jp = bck_list, *jpold=0;
+ int r= -1;
while(jp)
{
if(jp->pid==pid)
* This routine gets called when reading across a buffer boundary
* If lexd.nocopy is off, then current token is saved on the stack
*/
-static void lex_advance __PARAM__((Sfio_t *iop, const char *buff, register int size), (iop, buff, size)) __OTORP__(Sfio_t *iop; const char *buff; register int size;){
+static void lex_advance __PARAM__((Sfio_t *iop, const char *buff, int size), (iop, buff, size)) __OTORP__(Sfio_t *iop; const char *buff; int size;){
#ifdef KSHELL
/* write to history file and to stderr if necessary */
if(!sfstacked(iop))
* preserves lexical state
*/
static int lexfill __PARAM__((void), ()){
- register int c;
+ int c;
struct lexdata savedata;
struct lexstate savestate;
savedata = lexd;
#ifdef DBUG
int sh_lex __PARAM__((void), ()){
- register int flag;
+ int flag;
extern __MANGLE__ int lextoken __PROTO__((void));
char *quoted, *macro, *split, *expand;
- register int tok = lextoken();
+ int tok = lextoken();
quoted = macro = split = expand = "";
if(tok==0 && (flag=shlex.arg->argflag))
{
* Returns the token type
*/
int sh_lex __PARAM__((void), ()){
- register const char *state;
- register int n, c, mode=ST_BEGIN, wordflags=0;
+ const char *state;
+ int n, c, mode=ST_BEGIN, wordflags=0;
int len, inlevel=lexd.level, assignment=0, ingrave=0;
Sfio_t *sp;
if(lexd.paren)
* read to end of command substitution
*/
static int comsub __PARAM__((void), ()){
- register int n,c,count=1;
- register int line=sh.inlineno;
+ int n,c,count=1;
+ int line=sh.inlineno;
char word[5];
int messages=0;
struct lexstate save;
* allocate ionode with delimiter filled in without disturbing stak
*/
static void nested_here __PARAM__((void), ()){
- register struct ionod *iop;
- register int n,offset;
+ struct ionod *iop;
+ int n,offset;
struct argnod *arg = shlex.arg;
char *base;
if(offset=staktell())
* if <copy> is non,zero, then the characters are copied to the stack
* <state> is the initial lexical state
*/
-void sh_lexskip __PARAM__((int close, register int copy, int state), (close, copy, state)) __OTORP__(int close; register int copy; int state;){
- register char *cp;
+void sh_lexskip __PARAM__((int close, int copy, int state), (close, copy, state)) __OTORP__(int close; int copy; int state;){
+ char *cp;
lexd.nest = close;
lex_state = state;
lexd.nocopy += !copy;
* returns 1 for complete here-doc, 0 for EOF
*/
-static int here_copy __PARAM__((register struct ionod *iop), (iop)) __OTORP__(register struct ionod *iop;){
- register const char *state;
- register int c,n;
- register char *bufp,*cp;
- register Sfio_t *sp;
+static int here_copy __PARAM__((struct ionod *iop), (iop)) __OTORP__(struct ionod *iop;){
+ const char *state;
+ int c,n;
+ char *bufp,*cp;
+ Sfio_t *sp;
int stripflg, nsave, special=0;
if(iop->iolst)
here_copy(iop->iolst);
/*
* generates string for given token
*/
-static char *fmttoken __PARAM__((register int sym), (sym)) __OTORP__(register int sym;){
+static char *fmttoken __PARAM__((int sym), (sym)) __OTORP__(int sym;){
static char tok[3];
if(sym < 0)
return((char*)e_lexzerobyte);
return(shlex.arg?shlex.arg->argval:"?");
if(sym&SYMRES)
{
- register const Shtable_t *tp=shtab_reserved;
+ const Shtable_t *tp=shtab_reserved;
while(tp->sh_number && tp->sh_number!=sym)
tp++;
return((char*)tp->sh_name);
*/
void sh_syntax __PARAM__((void), ()){
- register const char *cp = e_unexpected;
- register int tok = shlex.token;
- register char *tokstr;
+ const char *cp = e_unexpected;
+ int tok = shlex.token;
+ char *tokstr;
Sfio_t *sp;
if((tok==EOFSYM) && shlex.lasttok)
{
if((sp=fcfile()) || (sh.infd>=0 && (sp=sh.sftable[sh.infd])))
{
/* clear out any pending input */
- register Sfio_t *top;
+ Sfio_t *top;
while(fcget()>0);
fcclose();
while(top=sfstack(sp,SF_POPSTACK))
* If mode==2, the each $"" string is printed on standard output
*/
struct argnod *sh_endword __PARAM__((int mode), (mode)) __OTORP__(int mode;){
- register const char *state = sh_lexstates[ST_NESTED];
- register int n;
- register char *sp,*dp;
- register int inquote=0, inlit=0; /* set within quoted strings */
+ const char *state = sh_lexstates[ST_NESTED];
+ int n;
+ char *sp,*dp;
+ int inquote=0, inlit=0; /* set within quoted strings */
struct argnod* argp;
char *ep=0;
int offset = staktell();
* This code gets called whenever an end of string is found with alias
*/
static int alias_exceptf __PARAM__((Sfio_t *iop,int type,Sfdisc_t *handle), (iop, type, handle)) __OTORP__(Sfio_t *iop;int type;Sfdisc_t *handle;){
- register struct alias *ap = (struct alias*)handle;
- register Namval_t *np;
+ struct alias *ap = (struct alias*)handle;
+ Namval_t *np;
static char buf[2];
if(type==0 || !ap)
return(0);
{
if(type==SF_CLOSE)
{
- register Sfdisc_t *dp = sfdisc(iop,SF_POPDISC);
+ Sfdisc_t *dp = sfdisc(iop,SF_POPDISC);
if(dp!=handle)
sfdisc(iop,dp);
else if(ap)
if(ap->nextc)
{
/* if last character is a blank, then next work can be alias */
- register int c = fcpeek(-1);
+ int c = fcpeek(-1);
if(isblank(c))
shlex.aliasok = 1;
*buf = ap->nextc;
static void setupalias __PARAM__((const char *string,Namval_t *np), (string, np)) __OTORP__(const char *string;Namval_t *np;){
- register Sfio_t *iop, *base;
+ Sfio_t *iop, *base;
struct alias *ap = (struct alias*)malloc(sizeof(struct alias));
ap->disc = alias_disc;
iop = sfopen(NIL(Sfio_t*),(char*)string,"s");
/*
* perform only parameter substitution and catch failures
*/
-char *sh_mactry __PARAM__((register char *string), (string)) __OTORP__(register char *string;){
+char *sh_mactry __PARAM__((char *string), (string)) __OTORP__(char *string;){
if(string)
{
int jmp_val;
* yields a single pathname.
* If <mode> negative, than expansion rules for assignment are applied.
*/
-char *sh_mactrim __PARAM__((char *str, register int mode), (str, mode)) __OTORP__(char *str; register int mode;){
+char *sh_mactrim __PARAM__((char *str, int mode), (str, mode)) __OTORP__(char *str; int mode;){
struct _mac_ savemac;
savemac = mac;
stakseek(0);
/*
* Perform all the expansions on the argument <argp>
*/
-int sh_macexpand __PARAM__((register struct argnod *argp, struct argnod **arghead), (argp, arghead)) __OTORP__(register struct argnod *argp; struct argnod **arghead;){
- register int flags = argp->argflag;
- register char *str = argp->argval;
+int sh_macexpand __PARAM__((struct argnod *argp, struct argnod **arghead), (argp, arghead)) __OTORP__(struct argnod *argp; struct argnod **arghead;){
+ int flags = argp->argflag;
+ char *str = argp->argval;
struct _mac_ savemac;
savemac = mac;
stakseek(ARGVAL);
* The result is written to <outfile>
*/
void sh_machere __PARAM__((Sfio_t *infile, Sfio_t *outfile, char *string), (infile, outfile, string)) __OTORP__(Sfio_t *infile; Sfio_t *outfile; char *string;){
- register int c,n;
- register const char *state = sh_lexstates[ST_QUOTE];
- register char *cp;
+ int c,n;
+ const char *state = sh_lexstates[ST_QUOTE];
+ char *cp;
Fcin_t save;
struct _mac_ savemac;
savemac = mac;
* Process the characters up to <endch> or end of input string
*/
static void copyto __PARAM__((int endch, int newquote), (endch, newquote)) __OTORP__(int endch; int newquote;){
- register int c,n;
- register const char *state = sh_lexstates[ST_MACRO];
- register char *cp,*first;
+ int c,n;
+ const char *state = sh_lexstates[ST_MACRO];
+ char *cp,*first;
int tilde = -1;
int oldquote = mac.quote;
int ansi_c = 0;
* This will be in libast some day
*/
static int strgrpmatch __PARAM__((char *string, char *pattern, int match[], int nmatch,int flags), (string, pattern, match, nmatch, flags)) __OTORP__(char *string; char *pattern; int match[]; int nmatch;int flags;){
- register char *cp=string, *dp;
+ char *cp=string, *dp;
int c=0,anchor = (flags&STR_LEFT);
flags &= ~STR_LEFT;
/* optimize a little */
/*
* copy <str> to stack performing sub-expression substitutions
*/
-static void mac_substitute __PARAM__((register char *cp,char *str,register int subexp[],int subsize), (cp, str, subexp, subsize)) __OTORP__(register char *cp;char *str;register int subexp[];int subsize;){
- register int c,n;
- register char *first=cp;
+static void mac_substitute __PARAM__((char *cp,char *str,int subexp[],int subsize), (cp, str, subexp, subsize)) __OTORP__(char *cp;char *str;int subexp[];int subsize;){
+ int c,n;
+ char *first=cp;
while(1)
{
while((c= *cp++) && c!=ESCAPE);
*/
static int varsub __PARAM__((void), ()){
static char idbuff[2];
- register int c;
- register int type=0; /* M_xxx */
- register char *v,*argp=0;
- register Namval_t *np = NIL(Namval_t*);
- register int dolg=0, mode=0;
+ int c;
+ int type=0; /* M_xxx */
+ char *v,*argp=0;
+ Namval_t *np = NIL(Namval_t*);
+ int dolg=0, mode=0;
Namarr_t *ap=0;
int dolmax=0, vsize= -1, offset, nulflg, replen=0, bysub=0;
char *id = idbuff, *pattern=0, *repstr;
c -= '0';
if(type)
{
- register int d;
+ int d;
while((d=fcget()),isadigit(d))
c = 10*c + (d-'0');
fcseek(-1);
retry2:
if(v && (!nulflg || *v ) && c!='+')
{
- register int d = (mode=='@'?' ':mac.ifs);
+ int d = (mode=='@'?' ':mac.ifs);
int match[20], nmatch;
while(1)
{
* <type> is 0 for older `...` version
*/
static void comsubst __PARAM__((int type), (type)) __OTORP__(int type;){
- register int c;
- register char *str;
+ int c;
+ char *str;
Sfio_t *sp;
Fcin_t save;
struct slnod *saveslp = sh.st.staklist;
char *savptr = stakfreeze(0);
int saveflags = sh_isstate(SH_HISTORY|SH_VERBOSE);
int newlines;
- register union anynode *t;
+ union anynode *t;
savemac = mac;
sh.st.staklist=0;
if(type)
if(t->tre.tretyp==0 && !t->com.comarg)
{
/* special case $( < file) */
- register int fd;
+ int fd;
struct checkpt buff;
sh_pushcontext(&buff,SH_JMPIO);
if(t->tre.treio && !(((t->tre.treio)->iofile)&IOUFD) &&
/*
* copy <str> onto the stack
*/
-static void mac_copy __PARAM__((register const char *str, register int size), (str, size)) __OTORP__(register const char *str; register int size;){
- register char *state;
- register const char *cp=str;
- register int c,n,nopat;
+static void mac_copy __PARAM__((const char *str, int size), (str, size)) __OTORP__(const char *str; int size;){
+ char *state;
+ const char *cp=str;
+ int c,n,nopat;
nopat = (mac.quote||mac.assign==1||mac.arith);
if(mac.sp)
sfwrite(mac.sp,str,size);
* Do filename expansion of required
*/
static void endfield __PARAM__((int split), (split)) __OTORP__(int split;){
- register struct argnod *argp;
+ struct argnod *argp;
if(staktell() > ARGVAL || split)
{
argp = (struct argnod*)stakfreeze(1);
* Finds the right substring of STRING using the expression PAT
* the longest substring is found when FLAG is set.
*/
-static int substring __PARAM__((register const char *string,const char *pat,int match[], int flag), (string, pat, match, flag)) __OTORP__(register const char *string;const char *pat;int match[]; int flag;){
- register const char *sp=string;
- register int size,len,nmatch,n;
+static int substring __PARAM__((const char *string,const char *pat,int match[], int flag), (string, pat, match, flag)) __OTORP__(const char *string;const char *pat;int match[]; int flag;){
+ const char *sp=string;
+ int size,len,nmatch,n;
int smatch[20];
sp += (len=strlen(sp));
size = sp-string;
#ifdef SHOPT_MULTIBYTE
static char *lastchar __PARAM__((const char *string, const char *endstring), (string, endstring)) __OTORP__(const char *string; const char *endstring;){
- register char *str = (char*)string;
- register int c;
+ char *str = (char*)string;
+ int c;
mblen(NIL(char*),MB_CUR_MAX);
while(*str)
{
return(str);
}
static int charlen __PARAM__((const char *string), (string)) __OTORP__(const char *string;){
- register const char *str = string;
- register int n=0;
- register int c;
+ const char *str = string;
+ int n=0;
+ int c;
wchar_t w;
mblen(NIL(char*),MB_CUR_MAX);
while(*str)
* <offset> is byte offset for beginning of tilde string
*/
-static void tilde_expand2 __PARAM__((register int offset), (offset)) __OTORP__(register int offset;){
- register char *cp;
+static void tilde_expand2 __PARAM__((int offset), (offset)) __OTORP__(int offset;){
+ char *cp;
int curoff = staktell();
stakputc(0);
if(cp = sh_tilde(stakptr(offset)))
* If string doesn't start with ~ or ~... not found then 0 returned.
*/
-static char *sh_tilde __PARAM__((register const char *string), (string)) __OTORP__(register const char *string;){
- register char *cp;
- register int c;
- register struct passwd *pw;
- register Namval_t *np;
+static char *sh_tilde __PARAM__((const char *string), (string)) __OTORP__(const char *string;){
+ char *cp;
+ int c;
+ struct passwd *pw;
+ Namval_t *np;
static Hashtab_t *logins_tree;
if(*string++!='~')
return(NIL(char*));
/*
* return values for special macros
*/
-static char *special __PARAM__((register int c), (c)) __OTORP__(register int c;){
- register Namval_t *np;
+static char *special __PARAM__((int c), (c)) __OTORP__(int c;){
+ Namval_t *np;
switch(c)
{
case '@':
* \ characters are stripped from string.
*/
static char *mac_getstring __PARAM__((char *pattern), (pattern)) __OTORP__(char *pattern;){
- register char *cp = pattern;
- register int c;
+ char *cp = pattern;
+ int c;
while(c = *cp++)
{
if(c==ESCAPE)
*/
static char *nextname __PARAM__((const char *prefix, int len), (prefix, len)) __OTORP__(const char *prefix; int len;){
static Hashpos_t *hp;
- register Namval_t *np;
- register char *cp;
+ Namval_t *np;
+ char *cp;
if(!prefix)
hp = hashscan(sh.var_tree,0);
else if(hp)
static char beenhere = 0;
#ifdef _lib_sigvec
- void clearsigmask __PARAM__((register int sig), (sig)) __OTORP__(register int sig;){
+ void clearsigmask __PARAM__((int sig), (sig)) __OTORP__(int sig;){
struct sigvec vec;
if(sigvec(sig,NIL(struct sigvec*),&vec)>=0 && vec.sv_mask)
{
#endif /* _lib_sigvec */
main __PARAM__((int ac, char *av[]), (ac, av)) __OTORP__(int ac; char *av[];){
- register char *name;
- register int fdin;
- register Sfio_t *iop;
- register int rshflag; /* set for restricted shell */
+ char *name;
+ int fdin;
+ Sfio_t *iop;
+ int rshflag; /* set for restricted shell */
struct checkpt buff;
int prof;
char *command;
* fdin is the input file descriptor
*/
-static void exfile __PARAM__((register Sfio_t *iop,register int fno), (iop, fno)) __OTORP__(register Sfio_t *iop;register int fno;){
+static void exfile __PARAM__((Sfio_t *iop,int fno), (iop, fno)) __OTORP__(Sfio_t *iop;int fno;){
time_t curtime;
union anynode *t;
int maxtry=IOMAXTRY, tdone=0, execflags;
sh_offstate(SH_INTERACTIVE|SH_ERREXIT|SH_MONITOR);
if(sh_isstate(SH_INTERACTIVE) && !tdone)
{
- register char *mail;
+ char *mail;
#ifdef JOBS
sh_offstate(SH_MONITOR);
sh_onstate(sh_isoption(SH_MONITOR));
/* prints out messages if files in list have been modified since last call */
static void chkmail __PARAM__((char *files), (files)) __OTORP__(char *files;){
- register char *cp,*sp,*qp;
- register char save;
+ char *cp,*sp,*qp;
+ char save;
struct argnod *arglist=0;
int offset = staktell();
char *savstak=stakptr(0);
#else
static char *buff;
static int command_len;
- register char *cp;
+ char *cp;
int offset=0,size;
# ifdef PSTAT
union pstun un;
* Perform parameter assignment for a linked list of parameters
* <flags> contains attributes for the parameters
*/
-void nv_setlist __PARAM__((register struct argnod *arg,register int flags), (arg, flags)) __OTORP__(register struct argnod *arg;register int flags;){
- register char *cp;
- register Namval_t *np;
+void nv_setlist __PARAM__((struct argnod *arg,int flags), (arg, flags)) __OTORP__(struct argnod *arg;int flags;){
+ char *cp;
+ Namval_t *np;
int traceon = (sh_isoption(SH_XTRACE)!=0);
if(sh_isoption(SH_ALLEXPORT))
flags |= NV_EXPORT;
{
int flag = (NV_VARNAME|NV_ARRAY|NV_ASSIGN);
struct fornod *fp=(struct fornod*)arg->argchn.ap;
- register union anynode *tp=fp->fortre;
+ union anynode *tp=fp->fortre;
char *prefix = sh.prefix;
cp = fp->fornam;
error_info.line = fp->fortyp-sh.st.firstline;
np->nvsize &= ~NV_PARAM;
if(traceon)
{
- register char *sp=cp;
+ char *sp=cp;
sh_trace(NIL(char**),0);
sfputr(sfstderr,nv_name(np),-1);
if(nv_isattr(np,NV_ARRAY) && (cp=strchr(sp,'[')))
/*
* construct a new name from a prefix and base name on the stack
*/
-static char *newname __PARAM__((register const char *prefix, register const char *name), (prefix, name)) __OTORP__(register const char *prefix; register const char *name;){
- register int offset = staktell();
+static char *newname __PARAM__((const char *prefix, const char *name), (prefix, name)) __OTORP__(const char *prefix; const char *name;){
+ int offset = staktell();
stakputs(prefix);
if(*name!='[')
stakputc('.');
* SH_INIT is only set while initializing the environment
*/
Namval_t *nv_open __PARAM__((const char *name,Hashtab_t *root,int flags), (name, root, flags)) __OTORP__(const char *name;Hashtab_t *root;int flags;){
- register char *cp = (char*)name;
- register Namval_t *np=0;
- register int sep = *cp;
- register char *lastdot = 0;
- register long mode = ((flags&NV_NOADD)?0:NV_ADD);
+ char *cp = (char*)name;
+ Namval_t *np=0;
+ int sep = *cp;
+ char *lastdot = 0;
+ long mode = ((flags&NV_NOADD)?0:NV_ADD);
if(root==sh.alias_tree)
{
while((sep= *(unsigned char*)cp) && (sep!='=') && (sep!='/') &&
* If <flags> contains NV_NOFREE, previous value is freed, and <string>
* becomes value of node and <flags> becomes attributes
*/
-void nv_putval __PARAM__((register Namval_t *np, const char *string, int flags), (np, string, flags)) __OTORP__(register Namval_t *np; const char *string; int flags;){
- register const char *sp=string;
- register union Value *up;
- register char *cp;
- register int size = 0;
- register int dot;
+void nv_putval __PARAM__((Namval_t *np, const char *string, int flags), (np, string, flags)) __OTORP__(Namval_t *np; const char *string; int flags;){
+ const char *sp=string;
+ union Value *up;
+ char *cp;
+ int size = 0;
+ int dot;
if(!(flags&NV_RDONLY) && nv_isattr (np, NV_RDONLY))
error(ERROR_exit(1),e_readonly, nv_name(np));
/* The following could cause the shell to fork if assignment
rightjust(cp,size,' ');
else if(nv_isattr(np, NV_LJUST))
{
- register char *dp;
+ char *dp;
dp = strlen (cp) + cp;
*(cp = (cp + size)) = 0;
for (; dp < cp; *dp++ = ' ');
* will default to a blank.
*/
static void rightjust __PARAM__((char *str, int size, int fill), (str, size, fill)) __OTORP__(char *str; int size; int fill;){
- register int n;
- register char *cp,*sp;
+ int n;
+ char *cp,*sp;
n = strlen(str);
/* ignore trailing blanks */
*/
static int ja_size __PARAM__((char *str,int size,int type), (str, size, type)) __OTORP__(char *str;int size;int type;){
- register char *cp = str;
- register int c, n=size;
+ char *cp = str;
+ int c, n=size;
int oldn;
wchar_t w;
while(*cp)
oldn = n;
if((c=mbtowc(&w,cp,MB_CUR_MAX))>0)
{
- register int outsize = wcwidth(w);
+ int outsize = wcwidth(w);
/* allow room for excess input bytes */
n += (c-outsize);
size -= outsize;
}
static void ja_restore __PARAM__((void), ()){
- register char *cp = savechars;
+ char *cp = savechars;
while(*cp)
*savep++ = *cp++;
savep = 0;
}
#endif /* SHOPT_MULTIBYTE */
-static char *staknam __PARAM__((register Namval_t *np, char *value), (np, value)) __OTORP__(register Namval_t *np; char *value;){
- register char *p,*q;
+static char *staknam __PARAM__((Namval_t *np, char *value), (np, value)) __OTORP__(Namval_t *np; char *value;){
+ char *p,*q;
q = stakalloc(strlen(nv_name(np))+(value?strlen(value):0)+2);
p=strcopy(q,nv_name(np));
if(value)
/*
* put the name and attribute into value of attributes variable
*/
-static void attstore __PARAM__((register Namval_t *np), (np)) __OTORP__(register Namval_t *np;){
- register int flag = np->nvflag;
+static void attstore __PARAM__((Namval_t *np), (np)) __OTORP__(Namval_t *np;){
+ int flag = np->nvflag;
if(!(flag&NV_EXPORT) || (flag&NV_FUNCT))
return;
flag &= (NV_RDONLY|NV_UTOL|NV_LTOU|NV_RJUST|NV_LJUST|NV_ZFILL|NV_INTEGER);
}
static void pushnam __PARAM__((Namval_t *np), (np)) __OTORP__(Namval_t *np;){
- register char *value;
+ char *value;
if(nv_isattr(np,NV_IMPORT))
{
if(np->nvenv)
*/
char **sh_envgen __PARAM__((void), ()){
- register char **er;
- register int namec;
- register char *cp;
+ char **er;
+ int namec;
+ char *cp;
/* L_ARGNOD gets generated automatically as full path name of command */
nv_offattr(L_ARGNOD,NV_EXPORT);
attsize = 6;
static int scancount = 0;
static int scanfilter __PARAM__((const char *name, char *arg, __V_ *notused), (name, arg, notused)) __OTORP__(const char *name; char *arg; __V_ *notused;){
- register Namval_t *np = (Namval_t*)arg;
- register int k=np->nvflag;
+ Namval_t *np = (Namval_t*)arg;
+ int k=np->nvflag;
NOT_USED(name);
NOT_USED(notused);
if(scanmask?(k&scanmask)==scanflags:(!scanflags || (k&scanflags)))
* create a new environment scope
*/
void nv_scope __PARAM__((struct argnod *envlist), (envlist)) __OTORP__(struct argnod *envlist;){
- register Hashtab_t *newscope;
+ Hashtab_t *newscope;
newscope = hashalloc(sh.var_tree,HASH_set,HASH_SCOPE|HASH_ALLOCATE,0);
sh.var_tree = newscope;
nv_setlist(envlist,NV_EXPORT|NV_NOSCOPE|NV_IDENT|NV_ASSIGN);
* node, as well as its dope vector, if it is an array.
*/
-void sh_envnolocal __PARAM__((register Namval_t *np), (np)) __OTORP__(register Namval_t *np;){
+void sh_envnolocal __PARAM__((Namval_t *np), (np)) __OTORP__(Namval_t *np;){
if(nv_isattr(np,NV_EXPORT|NV_NOFREE))
{
if(nv_isattr(np,NV_REF))
* by the value of <np>. If <np> denotes an array member, it
* will retain its attributes.
*/
-void nv_unset __PARAM__((register Namval_t *np), (np)) __OTORP__(register Namval_t *np;){
- register union Value *up = &np->nvalue;
- register Namarr_t *ap;
+void nv_unset __PARAM__((Namval_t *np), (np)) __OTORP__(Namval_t *np;){
+ union Value *up = &np->nvalue;
+ Namarr_t *ap;
if(!forced && nv_isattr (np,NV_RDONLY))
error(ERROR_exit(1),e_readonly, nv_name(np));
if(sh.subshell && !nv_isnull(np))
/*
* return the node pointer in the highest level scope
*/
-Namval_t *nv_scoped __PARAM__((register Namval_t *np), (np)) __OTORP__(register Namval_t *np;){
+Namval_t *nv_scoped __PARAM__((Namval_t *np), (np)) __OTORP__(Namval_t *np;){
if(hashscope(sh.var_tree))
return(nv_search((char*)np,sh.var_tree,HASH_BUCKET));
else
* If <np> has no value, 0 is returned.
*/
-char *nv_getval __PARAM__((register Namval_t *np), (np)) __OTORP__(register Namval_t *np;){
- register union Value *up= &np->nvalue;
- register int numeric;
- register Namarr_t *ap;
+char *nv_getval __PARAM__((Namval_t *np), (np)) __OTORP__(Namval_t *np;){
+ union Value *up= &np->nvalue;
+ int numeric;
+ Namarr_t *ap;
if(!np->nvfun && !nv_isattr(np,NV_ARRAY|NV_INTEGER|NV_FUNCT|NV_REF))
goto done;
if(ap = nv_arrayptr(np))
}
if(numeric)
{
- register long l;
+ long l;
if(!up->cp || nv_isattr (np,NV_CPOINTER))
return((char*)up->cp);
else if(nv_isattr (np,NV_DOUBLE))
return ((char*)up->cp);
}
-double nv_getnum __PARAM__((register Namval_t *np), (np)) __OTORP__(register Namval_t *np;){
- register union Value *up;
- register double r=0;
- register char *str;
+double nv_getnum __PARAM__((Namval_t *np), (np)) __OTORP__(Namval_t *np;){
+ union Value *up;
+ double r=0;
+ char *str;
if(np->nvfun)
{
if(!local)
* value to conform to <newatts>. The <size> of left and right
* justified fields may be given.
*/
-void nv_newattr __PARAM__((register Namval_t *np, unsigned newatts, int size), (np, newatts, size)) __OTORP__(register Namval_t *np; unsigned newatts; int size;){
- register char *sp;
- register char *cp = 0;
- register unsigned int n;
+void nv_newattr __PARAM__((Namval_t *np, unsigned newatts, int size), (np, newatts, size)) __OTORP__(Namval_t *np; unsigned newatts; int size;){
+ char *sp;
+ char *cp = 0;
+ unsigned int n;
Namarr_t *ap = 0;
int oldsize,oldatts;
#ifndef _NEXT_SOURCE
static char *oldgetenv __PARAM__((const char *string), (string)) __OTORP__(const
char *string;){
- register char c0,c1;
- register const char *cp, *sp;
- register char **av = environ;
+ char c0,c1;
+ const char *cp, *sp;
+ char **av = environ;
if(!string || (c0= *string)==0)
return(0);
if((c1= *++string)==0)
* around the problems, others don't.
*/
char *ksh_getenv __PARAM__((const char *name), (name)) __OTORP__(const char *name;){
- register Namval_t *np;
+ Namval_t *np;
if(!sh.var_tree)
return(oldgetenv(name));
if((np = nv_search(name,sh.var_tree,0)) && nv_isattr(np,NV_EXPORT))
* no calls to this routine. - harry phinney 8/15/1994.
*/
int ksh_putenv __PARAM__((const char *name), (name)) __OTORP__(const char *name;){
- register Namval_t *np;
+ Namval_t *np;
if(name)
{
np = nv_open(name,sh.var_tree,NV_EXPORT|NV_IDENT|NV_ARRAY|NV_ASSIGN);
* Override libast setenv()
*/
char* setenviron __PARAM__((const char *name), (name)) __OTORP__(const char *name;){
- register Namval_t *np;
+ Namval_t *np;
if(name)
{
np = nv_open(name,sh.var_tree,NV_EXPORT|NV_IDENT|NV_ARRAY|NV_ASSIGN);
* <str1> and <str2> may point to the same place.
*/
-static void ltou __PARAM__((register char const *str1,register char *str2), (str1, str2)) __OTORP__(register char const *str1;register char *str2;){
- register int c;
+static void ltou __PARAM__((char const *str1,char *str2), (str1, str2)) __OTORP__(char const *str1;char *str2;){
+ int c;
for(; c= *((unsigned char*)str1); str1++,str2++)
{
if(islower(c))
* <str1> and <str2> may point to the same place.
*/
-static void utol __PARAM__((register char const *str1,register char *str2), (str1, str2)) __OTORP__(register char const *str1;register char *str2;){
- register int c;
+static void utol __PARAM__((char const *str1,char *str2), (str1, str2)) __OTORP__(char const *str1;char *str2;){
+ int c;
for(; c= *((unsigned char*)str1); str1++,str2++)
{
if(isupper(c))
* <fp> is null to pop, otherwise, <fp> is pushed onto stack
* The top of the stack is returned
*/
-Namfun_t *nv_stack __PARAM__((register Namval_t *np, register Namfun_t* fp), (np, fp)) __OTORP__(register Namval_t *np; register Namfun_t* fp;){
- register Namfun_t *lp;
+Namfun_t *nv_stack __PARAM__((Namval_t *np, Namfun_t* fp), (np, fp)) __OTORP__(Namval_t *np; Namfun_t* fp;){
+ Namfun_t *lp;
if(fp)
{
if((lp=np->nvfun)==fp)
* Special builtins cannot be replaced and return -1
*/
int sh_addbuiltin __PARAM__((const char *path, int (*bltin)(int, char*[],__V_*),__V_ *extra), (path, bltin, extra)) __OTORP__(const char *path; int (*bltin)();__V_ *extra;){
- register const char *cp, *name = path_basename(path);
- register Namval_t *np, *nq=0;
+ const char *cp, *name = path_basename(path);
+ Namval_t *np, *nq=0;
if(name==path && (cp=strchr(name,'.')) && cp!=name)
{
int offset = staktell();
* with <places> places after the decimal point. The string
* will be stored within static variable <numbuf>.
*/
-char *sh_ftos __PARAM__((double val,register int places), (val, places)) __OTORP__(double val;register int places;){
- register char *cp, *sp;
+char *sh_ftos __PARAM__((double val,int places), (val, places)) __OTORP__(double val;int places;){
+ char *cp, *sp;
int decpt,sign;
cp = sffcvt(val,places,&decpt,&sign);
* convert <val> to a string with <places> significant figures
* The result is placed in a local buffer and a pointer returned
*/
-char *sh_etos __PARAM__((double val,register int places), (val, places)) __OTORP__(double val;register int places;){
- register int bufsize = places+8;
+char *sh_etos __PARAM__((double val,int places), (val, places)) __OTORP__(double val;int places;){
+ int bufsize = places+8;
if(!curbuf)
curbuf = (char*)malloc(maxbufsize=bufsize);
else if(bufsize > maxbufsize)
/*
* call the next getval function in the chain
*/
-char *nv_getv __PARAM__((Namval_t *np, register Namfun_t *nfp), (np, nfp)) __OTORP__(Namval_t *np; register Namfun_t *nfp;){
- register Namfun_t *fp;
- register char *cp;
+char *nv_getv __PARAM__((Namval_t *np, Namfun_t *nfp), (np, nfp)) __OTORP__(Namval_t *np; Namfun_t *nfp;){
+ Namfun_t *fp;
+ char *cp;
if((fp = nfp) != NIL(Namfun_t*) && !local)
fp = nfp = nfp->next;
local=0;
/*
* call the next getnum function in the chain
*/
-double nv_getn __PARAM__((Namval_t *np, register Namfun_t *nfp), (np, nfp)) __OTORP__(Namval_t *np; register Namfun_t *nfp;){
- register Namfun_t *fp;
- register double d=0;
+double nv_getn __PARAM__((Namval_t *np, Namfun_t *nfp), (np, nfp)) __OTORP__(Namval_t *np; Namfun_t *nfp;){
+ Namfun_t *fp;
+ double d=0;
if((fp = nfp) != NIL(Namfun_t*) && !local)
fp = nfp = nfp->next;
local=0;
/*
* call the next assign function in the chain
*/
-void nv_putv __PARAM__((Namval_t *np, const char *value, int flags, register Namfun_t *nfp), (np, value, flags, nfp)) __OTORP__(Namval_t *np; const char *value; int flags; register Namfun_t *nfp;){
- register Namfun_t *fp;
+void nv_putv __PARAM__((Namval_t *np, const char *value, int flags, Namfun_t *nfp), (np, value, flags, nfp)) __OTORP__(Namval_t *np; const char *value; int flags; Namfun_t *nfp;){
+ Namfun_t *fp;
if((fp=nfp) != NIL(Namfun_t*) && !local)
fp = nfp = nfp->next;
local=0;
/*
* free discipline if no more discipline functions
*/
-static void chktfree __PARAM__((register Namval_t *np, register struct vardisc *vp), (np, vp)) __OTORP__(register Namval_t *np; register struct vardisc *vp;){
- register int n;
+static void chktfree __PARAM__((Namval_t *np, struct vardisc *vp), (np, vp)) __OTORP__(Namval_t *np; struct vardisc *vp;){
+ int n;
for(n=0; n< sizeof(vp->disc)/sizeof(*vp->disc); n++)
{
if(vp->disc[n])
* This function performs an assignment disc on the given node <np>
*/
static void assign __PARAM__((Namval_t *np,const char* val,int flags,Namfun_t *handle), (np, val, flags, handle)) __OTORP__(Namval_t *np;const char* val;int flags;Namfun_t *handle;){
- register struct vardisc *vp = (struct vardisc*)handle;
- register Namval_t *nq, **disc;
+ struct vardisc *vp = (struct vardisc*)handle;
+ Namval_t *nq, **disc;
if(val)
{
if(!(nq=vp->disc[ASSIGN]))
}
if(val)
{
- register char *cp;
+ char *cp;
double d;
if(nv_isnull(SH_VALNOD))
cp=0;
* the lookup on the given node <np>
*/
static char* lookup __PARAM__((Namval_t *np, Namfun_t *handle), (np, handle)) __OTORP__(Namval_t *np; Namfun_t *handle;){
- register struct vardisc *vp = (struct vardisc*)handle;
- register Namval_t *nq;
- register char *cp=0;
+ struct vardisc *vp = (struct vardisc*)handle;
+ Namval_t *nq;
+ char *cp=0;
if((nq=vp->disc[LOOKUP]) && nq!=BLOCKED)
{
nv_unset(SH_VALNOD);
/*
* node creation discipline
*/
-Namval_t *nv_create __PARAM__((register Namval_t* np,const char *name,register Namfun_t *fp), (np, name, fp)) __OTORP__(register Namval_t* np;const char *name;register Namfun_t *fp;){
+Namval_t *nv_create __PARAM__((Namval_t* np,const char *name,Namfun_t *fp), (np, name, fp)) __OTORP__(Namval_t* np;const char *name;Namfun_t *fp;){
if(np == (Namval_t*)fp)
fp = np->nvfun;
else if(fp)
* If <event> is NULL, then return the event name after <action>
* If <event> is NULL, and <action> is NULL, return the first event
*/
-char *nv_setdisc __PARAM__((register Namval_t* np,register const char *event,Namval_t *action,register Namfun_t *fp), (np, event, action, fp)) __OTORP__(register Namval_t* np;register const char *event;Namval_t *action;register Namfun_t *fp;){
- register struct vardisc *vp = (struct vardisc*)np->nvfun;
- register int type;
+char *nv_setdisc __PARAM__((Namval_t* np,const char *event,Namval_t *action,Namfun_t *fp), (np, event, action, fp)) __OTORP__(Namval_t* np;const char *event;Namval_t *action;Namfun_t *fp;){
+ struct vardisc *vp = (struct vardisc*)np->nvfun;
+ int type;
if(np == (Namval_t*)fp)
{
static const char *discnames[] = { "get", "set", "unset", 0 };
- register const char *name;
- register int getname=0;
+ const char *name;
+ int getname=0;
/* top level call, check for get/set */
if(!event)
{
/*
* Create a reference node from <np>
*/
-void nv_setref __PARAM__((register Namval_t *np), (np)) __OTORP__(register Namval_t *np;){
- register Namval_t *nq, *nr;
- register char *cp;
- register int flags = NV_ARRAY|NV_VARNAME|NV_REF;
+void nv_setref __PARAM__((Namval_t *np), (np)) __OTORP__(Namval_t *np;){
+ Namval_t *nq, *nr;
+ char *cp;
+ int flags = NV_ARRAY|NV_VARNAME|NV_REF;
Hashtab_t *hp=sh.var_tree;
if(nv_isattr(np,NV_REF))
return;
* type=='V' for variable assignment lists
* Otherwise type is determined by the command */
static void writedefs __PARAM__((struct argnod *arglist, int line, int type, struct argnod *cmd), (arglist, line, type, cmd)) __OTORP__(struct argnod *arglist; int line; int type; struct argnod *cmd;){
- register struct argnod *argp = arglist;
- register char *cp;
- register int n;
+ struct argnod *argp = arglist;
+ char *cp;
+ int n;
int width=0;
static char atbuff[20];
static char justify[2];
* Make a parent node for fork() or io-redirection
*/
static union anynode *makeparent __PARAM__((int flag, union anynode *child), (flag, child)) __OTORP__(int flag; union anynode *child;){
- register union anynode *par = getnode(forknod);
+ union anynode *par = getnode(forknod);
par->fork.forktyp = flag;
par->fork.forktre = child;
par->fork.forkio = 0;
* Make a node corresponding to a command list
*/
static union anynode *makelist __PARAM__((int type, union anynode *l, union anynode *r), (type, l, r)) __OTORP__(int type; union anynode *l; union anynode *r;){
- register union anynode *t;
+ union anynode *t;
if(!l || !r)
sh_syntax();
else
*/
union anynode *sh_parse __PARAM__((Sfio_t *iop, int flag), (iop, flag)) __OTORP__(Sfio_t *iop; int flag;){
- register union anynode *t;
+ union anynode *t;
Fcin_t sav_input;
int sav_prompt = sh.nextprompt;
if(sh.binscript && sffileno(iop)==sh.infd)
* the parse tree
*/
union anynode *sh_dolparen __PARAM__((void), ()){
- register union anynode *t=0;
+ union anynode *t=0;
Sfio_t *sp = fcfile();
int line = sh.inlineno;
sh.inlineno = error_info.line+sh.st.firstline;
* This code handles the case where string has been converted
* to a file by an alias setup
*/
- register int c;
+ int c;
char *cp;
if(fcgetc(c) > 0)
fcseek(-1);
* stack is freed when reference count is zero
*/
-void sh_funstaks __PARAM__((register struct slnod *slp,int flag), (slp, flag)) __OTORP__(register struct slnod *slp;int flag;){
- register struct slnod *slpold;
+void sh_funstaks __PARAM__((struct slnod *slp,int flag), (slp, flag)) __OTORP__(struct slnod *slp;int flag;){
+ struct slnod *slpold;
while(slpold=slp)
{
if(slp->slchild)
* list [ ; cmd ]
*/
-static union anynode *sh_cmd __PARAM__((register int sym, int flag), (sym, flag)) __OTORP__(register int sym; int flag;){
- register union anynode *left, *right;
- register int type = FINT|FAMP;
+static union anynode *sh_cmd __PARAM__((int sym, int flag), (sym, flag)) __OTORP__(int sym; int flag;){
+ union anynode *left, *right;
+ int type = FINT|FAMP;
if(sym==NL)
shlex.lasttok = 0;
left = list(flag);
* list || term
* unfortunately, these are equal precedence
*/
-static union anynode *list __PARAM__((register int flag), (flag)) __OTORP__(register int flag;){
- register union anynode *t = term(flag);
- register int token;
+static union anynode *list __PARAM__((int flag), (flag)) __OTORP__(int flag;){
+ union anynode *t = term(flag);
+ int token;
while(t && ((token=shlex.token)==ANDFSYM || token==ORFSYM))
t = makelist((token==ANDFSYM?TAND:TORF), t, term(SH_NL));
return(t);
* item
* item | term
*/
-static union anynode *term __PARAM__((register int flag), (flag)) __OTORP__(register int flag;){
- register union anynode *t;
- register int token;
+static union anynode *term __PARAM__((int flag), (flag)) __OTORP__(int flag;){
+ union anynode *t;
+ int token;
if(flag&SH_NL)
token = skipnl();
else
}
else if((t=item(SH_NL|SH_EMPTY)) && shlex.token=='|')
{
- register union anynode *tt;
+ union anynode *tt;
t = makeparent(TFORK|FPOU,t);
if(tt=term(SH_NL))
{
/*
* case statement
*/
-static struct regnod* syncase __PARAM__((register int esym), (esym)) __OTORP__(register int esym;){
- register int tok = skipnl();
- register struct regnod *r;
+static struct regnod* syncase __PARAM__((int esym), (esym)) __OTORP__(int esym;){
+ int tok = skipnl();
+ struct regnod *r;
if(tok==esym)
return(NIL(struct regnod*));
r = (struct regnod*)stakalloc(sizeof(struct regnod));
* Otherise a list containing an arithmetic command and a while
* is returned.
*/
-static union anynode *arithfor __PARAM__((register union anynode *tf), (tf)) __OTORP__(register union anynode *tf;){
- register union anynode *t, *tw = tf;
- register int offset;
- register struct argnod *argp;
- register int n;
+static union anynode *arithfor __PARAM__((union anynode *tf), (tf)) __OTORP__(union anynode *tf;){
+ union anynode *t, *tw = tf;
+ int offset;
+ struct argnod *argp;
+ int n;
int argflag = shlex.arg->argflag;
/* save current input */
Fcin_t sav_input;
/* split ((...)) into three expressions */
for(n=0; ; n++)
{
- register int c;
+ int c;
argp = (struct argnod*)stakseek(ARGVAL);
argp->argnxt.ap = 0;
argp->argflag = argflag;
}
static union anynode *funct __PARAM__((void), ()){
- register union anynode *t;
- register int flag;
+ union anynode *t;
+ int flag;
struct slnod *volatile slp=0;
Stak_t *savstak;
#ifdef SHOPT_KIA
/*
* Compound assignment
*/
-static struct argnod *assign __PARAM__((register struct argnod *ap), (ap)) __OTORP__(register struct argnod *ap;){
- register int n;
- register union anynode *t ,**tp;
- register struct comnod *ac;
+static struct argnod *assign __PARAM__((struct argnod *ap), (ap)) __OTORP__(struct argnod *ap;){
+ int n;
+ union anynode *t ,**tp;
+ struct comnod *ac;
int array=0;
Namval_t *np;
n = strlen(ap->argval)-1;
*/
static union anynode *item __PARAM__((int flag), (flag)) __OTORP__(int flag;){
- register union anynode *t;
- register struct ionod *io;
- register int tok = (shlex.token&0xff);
+ union anynode *t;
+ struct ionod *io;
+ int tok = (shlex.token&0xff);
int savwdval = shlex.lasttok;
int savline = shlex.lastline;
if(!(flag&SH_NOIO) && (tok=='<' || tok=='>'))
/* if statement */
case IFSYM:
{
- register union anynode *tt;
+ union anynode *tt;
t = getnode(ifnod);
t->if_.iftyp=TIF;
t->if_.iftre=sh_cmd(THENSYM,SH_NL);
case LABLSYM:
{
- register struct argnod *argp = label_list;
+ struct argnod *argp = label_list;
while(argp)
{
if(strcmp(argp->argval,shlex.arg->argval)==0)
* This is for a simple command, for list, or compound assignment
*/
static union anynode *simple __PARAM__((int flag, struct ionod *io), (flag, io)) __OTORP__(int flag; struct ionod *io;){
- register struct comnod *t;
- register struct argnod *argp;
- register int tok;
+ struct comnod *t;
+ struct argnod *argp;
+ int tok;
struct argnod **argtail;
struct argnod **settail;
int keywd=1;
#ifdef SHOPT_KIA
if(shlex.kiafile)
{
- register Namval_t *np=(Namval_t*)t->comnamp;
+ Namval_t *np=(Namval_t*)t->comnamp;
int line = t->comline;
argp = t->comarg;
if(argp)
Namval_t *np=(Namval_t*)t->comnamp;
if((np==SYSBREAK || np==SYSCONT) && (argp->argflag&ARG_RAW) && !isdigit(*argp->argval))
{
- register char *cp = argp->argval;
+ char *cp = argp->argval;
/* convert break/continue labels to numbers */
tok = 0;
for(argp=label_list;argp!=label_last;argp=argp->argnxt.ap)
* skip past newlines but issue prompt if interactive
*/
static int skipnl __PARAM__((void), ()){
- register int token;
+ int token;
while((token=sh_lex())==NL);
if(token==';')
sh_syntax();
* if flag is set then an alias can be in the next word
*/
static struct ionod *inout __PARAM__((struct ionod *lastio,int flag), (lastio, flag)) __OTORP__(struct ionod *lastio;int flag;){
- register int iof = shlex.digits, token=shlex.token;
- register struct ionod *iop;
+ int iof = shlex.digits, token=shlex.token;
+ struct ionod *iop;
switch(token&0xff)
{
case '<':
*/
static struct argnod *qscan __PARAM__((struct comnod *ac,int argn), (ac, argn)) __OTORP__(struct comnod *ac;int argn;){
- register char **cp;
- register struct argnod *ap;
- register struct dolnod* dp;
- register int special=0;
+ char **cp;
+ struct argnod *ap;
+ struct dolnod* dp;
+ int special=0;
/* special hack for test -t compatibility */
if((Namval_t*)ac->comnamp==SYSTEST)
special = 2;
}
static union anynode *test_expr __PARAM__((int sym), (sym)) __OTORP__(int sym;){
- register union anynode *t = test_or();
+ union anynode *t = test_or();
if(shlex.token!=sym)
sh_syntax();
return(t);
}
static union anynode *test_or __PARAM__((void), ()){
- register union anynode *t = test_and();
+ union anynode *t = test_and();
while(shlex.token==ORFSYM)
t = makelist(TORF|TTEST,t,test_and());
return(t);
}
static union anynode *test_and __PARAM__((void), ()){
- register union anynode *t = test_primary();
+ union anynode *t = test_primary();
while(shlex.token==ANDFSYM)
t = makelist(TAND|TTEST,t,test_primary());
return(t);
}
static union anynode *test_primary __PARAM__((void), ()){
- register struct argnod *arg;
- register union anynode *t;
- register int num,token;
+ struct argnod *arg;
+ union anynode *t;
+ int num,token;
token = skipnl();
num = shlex.digits;
switch(token)
#ifdef SHOPT_KIA
int kiaclose __PARAM__((void), ()){
- register off_t off1,off2;
- register int n;
+ off_t off1,off2;
+ int n;
if(shlex.kiafile)
{
sfseek(shlex.kiafile,shlex.kiabegin,SEEK_SET);
* Sets the PWD variable to this value
*/
char *path_pwd __PARAM__((int flag), (flag)) __OTORP__(int flag;){
- register char *cp;
- register char *dfault = (char*)e_dot;
- register int count = 0;
+ char *cp;
+ char *dfault = (char*)e_dot;
+ int count = 0;
if(sh.pwd)
return((char*)sh.pwd);
while(1)
*/
char *path_get __PARAM__((const char *name), (name)) __OTORP__(const char *name;){
- register char *path=0;
- register char *sp = sh.lastpath;
+ char *path=0;
+ char *sp = sh.lastpath;
static int bin_is_usrbin = -1;
if(strchr(name,'/'))
return("");
* convert each /usr/bin to /bin and eliminate multiple /bin from <path>
* The resulting path is placed on the stack
*/
-static char *path_to_stak __PARAM__((register const char *path), (path)) __OTORP__(register const char *path;){
- register const char *cp=path, *base;
- register int n, nbin=0;
+static char *path_to_stak __PARAM__((const char *path), (path)) __OTORP__(const char *path;){
+ const char *cp=path, *base;
+ int n, nbin=0;
stakseek(0);
while(*cp)
{
}
int path_open __PARAM__((const char *name,char *path), (name, path)) __OTORP__(const char *name;char *path;){
- register int fd;
+ int fd;
struct stat statb;
if(strchr(name,'/'))
{
*/
static int path_inpath __PARAM__((const char *path, const char *fpath), (path, fpath)) __OTORP__(const char *path; const char *fpath;){
- register const char *dp = fpath;
- register const char *sp = path;
- register int c, match=1;
+ const char *dp = fpath;
+ const char *sp = path;
+ int c, match=1;
if(!dp || !sp || *sp==0)
return(0);
if(*sp==':' || (*sp=='.' && ((c=sp[1])==0 || c==':')))
* set tracked alias node <np> to value <sp>
*/
-void path_alias __PARAM__((register Namval_t *np,register char *sp), (np, sp)) __OTORP__(register Namval_t *np;register char *sp;){
+void path_alias __PARAM__((Namval_t *np,char *sp), (np, sp)) __OTORP__(Namval_t *np;char *sp;){
if(!sp)
nv_unset(np);
else
{
- register const char *vp = np->nvalue.cp;
- register int n = 1;
- register int nofree = nv_isattr(np,NV_NOFREE);
+ const char *vp = np->nvalue.cp;
+ int n = 1;
+ int nofree = nv_isattr(np,NV_NOFREE);
nv_offattr(np,NV_NOPRINT);
if(!vp || (n=strcmp(sp,vp))!=0)
{
* given a pathname return the base name
*/
-char *path_basename __PARAM__((register const char *name), (name)) __OTORP__(register const char *name;){
- register const char *start = name;
+char *path_basename __PARAM__((const char *name), (name)) __OTORP__(const char *name;){
+ const char *start = name;
while (*name)
if ((*name++ == '/') && *name) /* don't trim trailing / */
start = name;
* If endpath!=NULL, Path search ends when path matches endpath.
*/
-int path_search __PARAM__((register const char *name,const char *endpath, int flag), (name, endpath, flag)) __OTORP__(register const char *name;const char *endpath; int flag;){
- register Namval_t *np;
- register int fno;
+int path_search __PARAM__((const char *name,const char *endpath, int flag), (name, endpath, flag)) __OTORP__(const char *name;const char *endpath; int flag;){
+ Namval_t *np;
+ int fno;
if(flag)
{
/* if not found on pruned path, rehash and try again */
}
if(flag==0 || !sh.lastpath)
{
- register char *path=0;
+ char *path=0;
if(strmatch(name,e_alphanum))
path = nv_getval(nv_scoped(FPATHNOD));
if(path && (fno=path_open(name,path))>=0)
* end search of path matches endpath without checking execute permission
*/
-char *path_absolute __PARAM__((register const char *name, const char *endpath), (name, endpath)) __OTORP__(register const char *name; const char *endpath;){
- register int f;
- register char *path;
- register const char *fpath=0;
- register int isfun;
+char *path_absolute __PARAM__((const char *name, const char *endpath), (name, endpath)) __OTORP__(const char *name; const char *endpath;){
+ int f;
+ char *path;
+ const char *fpath=0;
+ int isfun;
#ifdef SHOPT_VPIX
char **suffix = 0;
char *top;
# endif /*S_EXEC */
#endif /* S_IXUSR */
-static int canexecute __PARAM__((register char *path, int isfun), (path, isfun)) __OTORP__(register char *path; int isfun;){
+static int canexecute __PARAM__((char *path, int isfun), (path, isfun)) __OTORP__(char *path; int isfun;){
struct stat statb;
- register int fd=0;
+ int fd=0;
path = path_relative(path);
if(isfun)
{
* Return path relative to present working directory
*/
-char *path_relative __PARAM__((register const char* file), (file)) __OTORP__(register const char* file;){
- register const char *pwd;
- register const char *fp = file;
+char *path_relative __PARAM__((const char* file), (file)) __OTORP__(const char* file;){
+ const char *pwd;
+ const char *fp = file;
/* can't relpath when sh.pwd not set */
if(!(pwd=sh.pwd))
return((char*)fp);
return((char*)file);
}
-char *path_join __PARAM__((register char *path,const char *name), (path, name)) __OTORP__(register char *path;const char *name;){
+char *path_join __PARAM__((char *path,const char *name), (path, name)) __OTORP__(char *path;const char *name;){
/* leaves result on top of stack */
- register char *scanp = path;
- register int c;
+ char *scanp = path;
+ int c;
stakseek(PATH_OFFSET);
if(*scanp=='.')
{
}
-void path_exec __PARAM__((register const char *arg0,register char *argv[],struct argnod *local), (arg0, argv, local)) __OTORP__(register const char *arg0;register char *argv[];struct argnod *local;){
- register const char *path = "";
+void path_exec __PARAM__((const char *arg0,char *argv[],struct argnod *local), (arg0, argv, local)) __OTORP__(const char *arg0;char *argv[];struct argnod *local;){
+ const char *path = "";
nv_setlist(local,NV_EXPORT|NV_IDENT|NV_ASSIGN);
xecenv=sh_envgen();
if(strchr(arg0,'/'))
* This routine constructs a short path consisting of all
* Relative directories up to the directory of fullname <name>
*/
-static char *prune __PARAM__((register char *path,const char *fullname), (path, fullname)) __OTORP__(register char *path;const char *fullname;){
- register char *p = path;
- register char *s;
+static char *prune __PARAM__((char *path,const char *fullname), (path, fullname)) __OTORP__(char *path;const char *fullname;){
+ char *p = path;
+ char *s;
int n = 1;
const char *base;
char *inpath = path;
}
-static char *execs __PARAM__((const char *ap,const char *arg0,register char **argv), (ap, arg0, argv)) __OTORP__(const char *ap;const char *arg0;register char **argv;){
- register char *path, *prefix;
+static char *execs __PARAM__((const char *ap,const char *arg0,char **argv), (ap, arg0, argv)) __OTORP__(const char *ap;const char *arg0;char **argv;){
+ char *path, *prefix;
sh_sigcheck();
prefix=path_join((char*)ap,arg0);
xecenv[0] = stakptr(0);
*/
-static void exscript __PARAM__((register char *path,register char *argv[]), (path, argv)) __OTORP__(register char *path;register char *argv[];){
- register Sfio_t *sp;
+static void exscript __PARAM__((char *path,char *argv[]), (path, argv)) __OTORP__(char *path;char *argv[];){
+ Sfio_t *sp;
sh.comdiv=0;
sh.bckpid = 0;
sh.st.ioset=0;
/* check if file cannot open for read or script is setuid/setgid */
{
static char name[] = "/tmp/euidXXXXXXXXXX";
- register int n;
- register uid_t euserid;
+ int n;
+ uid_t euserid;
char *savet;
struct stat statb;
if((n=sh_open(path,O_RDONLY,0)) >= 0)
* Produce a pseudo-floating point representation
* with 3 bits base-8 exponent, 13 bits fraction.
*/
- static int compress __PARAM__((register time_t t), (t)) __OTORP__(register time_t t;){
- register int exp = 0, rund = 0;
+ static int compress __PARAM__((time_t t), (t)) __OTORP__(time_t t;){
+ int exp = 0, rund = 0;
while (t >= 8192)
{
*/
double strval __PARAM__((const char *s, char** end, double(*conv)(const char**,struct lval*,int,double)), (s, end, conv)) __OTORP__(const char *s; char** end; double(*conv)();){
- register double n;
+ double n;
pushchr(s);
cur.isfloat = 0;
* evaluate a subexpression with precedence
*/
-static double expr __PARAM__((register int precedence), (precedence)) __OTORP__(register int precedence;){
- register int c, op;
- register double n, x;
+static double expr __PARAM__((int precedence), (precedence)) __OTORP__(int precedence;){
+ int c, op;
+ double n, x;
int wasop, incr=0;
struct lval lvalue, assignop;
const char *pos;
* This is only used for small tables and is used to save non-sharable memory
*/
-int sh_locate __PARAM__((register const char *sp,const Shtable_t *table,int size), (sp, table, size)) __OTORP__(register const char *sp;const Shtable_t *table;int size;){
- register int first;
- register const Shtable_t *tp;
- register int c;
+int sh_locate __PARAM__((const char *sp,const Shtable_t *table,int size), (sp, table, size)) __OTORP__(const char *sp;const Shtable_t *table;int size;){
+ int first;
+ const Shtable_t *tp;
+ int c;
if(sp==0 || (first= *sp)==0)
return(0);
tp=table;
* The new string is put on top of the stack
*/
char *sh_substitute __PARAM__((const char *string,const char *oldsp,char *newsp), (string, oldsp, newsp)) __OTORP__(const char *string;const char *oldsp;char *newsp;){
- register const char *sp = string;
- register const char *cp;
+ const char *sp = string;
+ const char *cp;
const char *savesp = 0;
stakseek(0);
if(*sp==0)
* Remove escape characters from characters in <sp> and eliminate quoted nulls.
*/
-void sh_trim __PARAM__((register char *sp), (sp)) __OTORP__(register char *sp;){
- register char *dp;
- register int c;
+void sh_trim __PARAM__((char *sp), (sp)) __OTORP__(char *sp;){
+ char *dp;
+ int c;
if(sp)
{
dp = sp;
* puts null terminated result on stack, but doesn't freeze it
*/
char *sh_fmtq __PARAM__((const char *string), (string)) __OTORP__(const char *string;){
- register const char *cp = string;
- register int c, state;
+ const char *cp = string;
+ int c, state;
int offset;
if(!cp)
return((char*)0);
}
#ifdef SHOPT_MULTIBYTE
- int sh_strchr __PARAM__((const char *string, register const char *dp), (string, dp)) __OTORP__(const char *string; register const char *dp;){
+ int sh_strchr __PARAM__((const char *string, const char *dp), (string, dp)) __OTORP__(const char *string; const char *dp;){
wchar_t c,d;
- register int m;
- register const char *cp=string;
+ int m;
+ const char *cp=string;
int n = mbtowc(&d,dp,MB_CUR_MAX);
while((m=mbtowc(&c,cp,MB_CUR_MAX)) && c)
{
void sh_subtmpfile __PARAM__((void), ()){
if(sfset(sfstdout,0,0)&SF_STRING)
{
- register int fd;
- register struct checkpt *pp = (struct checkpt*)sh.jmplist;
- register struct subshell *sp = subshell_data->pipe;
+ int fd;
+ struct checkpt *pp = (struct checkpt*)sh.jmplist;
+ struct subshell *sp = subshell_data->pipe;
/* save file descriptor 1 if open */
if((sp->tmpfd = fd = fcntl(1,F_DUPFD,10)) >= 0)
{
* The child continues possibly with its standard output replaced by temp file
*/
void sh_subfork __PARAM__((void), ()){
- register struct subshell *sp = subshell_data;
+ struct subshell *sp = subshell_data;
pid_t pid;
/* see whether inside $(...) */
if(sp->pipe)
* layer created by the most recent subshell_fork if the
* node hasn't already been copied
*/
-Namval_t *sh_assignok __PARAM__((register Namval_t *np,int add), (np, add)) __OTORP__(register Namval_t *np;int add;){
- register Namval_t *mp;
+Namval_t *sh_assignok __PARAM__((Namval_t *np,int add), (np, add)) __OTORP__(Namval_t *np;int add;){
+ Namval_t *mp;
if(nv_isnull(np) && !add) /* don't bother with this */
return(np);
/* don't bother to save if in newer scope */
* restore the variables
*/
static void nv_restore __PARAM__((struct subshell *sp), (sp)) __OTORP__(struct subshell *sp;){
- register Namval_t *mp, *np;
- register Hashpos_t *pos = hashscan(sp->svar,0);
+ Namval_t *mp, *np;
+ Hashpos_t *pos = hashscan(sp->svar,0);
while(np=(Namval_t*)hashnext(pos))
{
if(mp = nv_search((char*)np,sp->var,HASH_BUCKET))
Sfio_t *sh_subshell __PARAM__((union anynode *t, int flags, int comsub), (t, flags, comsub)) __OTORP__(union anynode *t; int flags; int comsub;){
struct subshell sub_data;
- register struct subshell *sp = &sub_data;
+ struct subshell *sp = &sub_data;
int jmpval,nsig;
int savecurenv = sh.curenv;
char *savstak;
static struct stat statb;
main __PARAM__((int argc,char *argv[]), (argc, argv)) __OTORP__(int argc;char *argv[];){
- register int m,n;
- register char *p;
+ int m,n;
+ char *p;
struct stat statx;
int mode;
uid_t effuid;
* return true of shell ends in sh
*/
-static int endsh __PARAM__((register const char *shell), (shell)) __OTORP__(register const char *shell;){
+static int endsh __PARAM__((const char *shell), (shell)) __OTORP__(const char *shell;){
while(*shell)
shell++;
if(*--shell != 'h' || *--shell != 's')
* return true of shell is in <dir> directory
*/
-static int in_dir __PARAM__((register const char *dir,register const char *shell), (dir, shell)) __OTORP__(register const char *dir;register const char *shell;){
+static int in_dir __PARAM__((const char *dir,const char *shell), (dir, shell)) __OTORP__(const char *dir;const char *shell;){
while(*dir)
{
if(*dir++ != *shell++)
* This version of access checks against effective uid and effective gid
*/
-eaccess __PARAM__((register const char *name, register int mode), (name, mode)) __OTORP__(register const char *name; register int mode;){
+eaccess __PARAM__((const char *name, int mode), (name, mode)) __OTORP__(const char *name; int mode;){
struct stat statb;
if (stat(name, &statb) == 0)
{
{
static int maxgroups = 0;
gid_t *groups;
- register int n;
+ int n;
if(maxgroups==0)
{
/* first time */
*/
setids __PARAM__((int mode,uid_t owner,gid_t group), (mode, owner, group)) __OTORP__(int mode;uid_t owner;gid_t group;){
- register int n,m;
+ int n,m;
int pv[2];
/*
*/
static void maketemp __PARAM__((char *template), (template)) __OTORP__(char *template;){
- register char *cp = template;
- register pid_t n = getpid();
+ char *cp = template;
+ pid_t n = getpid();
/* skip to end of string */
while(*++cp);
/* convert process id to string */
static int mycopy __PARAM__((int fdi, int fdo), (fdi, fdo)) __OTORP__(int fdi; int fdo;){
char buffer[BLKSIZE];
- register int n;
+ int n;
while((n = read(fdi,buffer,BLKSIZE)) > 0)
if(write(fdo,buffer,n) != n)
/*
* print script corresponding to shell tree <t>
*/
-static int p_tree __PARAM__((register const union anynode *t), (t)) __OTORP__(register const union anynode *t;){
+static int p_tree __PARAM__((const union anynode *t), (t)) __OTORP__(const union anynode *t;){
if(!t)
return(sfputl(outfile,-1));
if(sfputl(outfile,t->tre.tretyp)<0)
}
}
-static int p_arg __PARAM__((register const struct argnod *arg), (arg)) __OTORP__(register const struct argnod *arg;){
- register int n;
+static int p_arg __PARAM__((const struct argnod *arg), (arg)) __OTORP__(const struct argnod *arg;){
+ int n;
struct fornod *fp;
while(arg)
{
return(sfputu(outfile,0));
}
-static int p_redirect __PARAM__((register const struct ionod *iop), (iop)) __OTORP__(register const struct ionod *iop;){
+static int p_redirect __PARAM__((const struct ionod *iop), (iop)) __OTORP__(const struct ionod *iop;){
while(iop)
{
sfputl(outfile,iop->iofile);
return(sfputl(outfile,-1));
}
-static int p_comarg __PARAM__((const register struct comnod *com), (com)) __OTORP__(const register struct comnod *com;){
+static int p_comarg __PARAM__((const struct comnod *com), (com)) __OTORP__(const struct comnod *com;){
p_redirect(com->comio);
p_arg(com->comset);
if(!com->comarg)
}
static int p_comlist __PARAM__((const struct dolnod *dol), (dol)) __OTORP__(const struct dolnod *dol;){
- register char *cp, *const*argv;
- register int n;
+ char *cp, *const*argv;
+ int n;
argv = dol->dolval+ARG_SPARE;
while(cp = *argv)
argv++;
return(sfputu(outfile,0));
}
-static int p_switch __PARAM__((register const struct regnod *reg), (reg)) __OTORP__(register const struct regnod *reg;){
+static int p_switch __PARAM__((const struct regnod *reg), (reg)) __OTORP__(const struct regnod *reg;){
while(reg)
{
sfputl(outfile,reg->regflag);
return(sfputl(outfile,-1));
}
-static int p_string __PARAM__((register const char *string), (string)) __OTORP__(register const char *string;){
- register size_t n=strlen(string);
+static int p_string __PARAM__((const char *string), (string)) __OTORP__(const char *string;){
+ size_t n=strlen(string);
if(sfputu(outfile,n+1)<0)
return(-1);
return(sfwrite(outfile,string,n));
static char time_state;
static double getnow __PARAM__((void), ()){
- register double now;
+ double now;
#ifdef _lib_gettimeofday
struct timeval tp;
gettimeofday(&tp,(void *)0);
/*
* set an alarm for <t> seconds
*/
-static double setalarm __PARAM__((register double t), (t)) __OTORP__(register double t;){
+static double setalarm __PARAM__((double t), (t)) __OTORP__(double t;){
#if defined(_lib_setitimer) && defined(ITIMER_REAL)
struct itimerval tnew, told;
tnew.it_value.tv_sec = t;
/* signal handler for alarm call */
static void sigalrm __PARAM__((int sig), (sig)) __OTORP__(int sig;){
- register Timer_t *tp, *tplast, *tpold;
+ Timer_t *tp, *tplast, *tpold;
double now;
static double left;
NOT_USED(sig);
}
__V_ *kshtimeradd __PARAM__((unsigned long msec,int flags,void (*action)(__V_*),__V_ *handle), (msec, flags, action, handle)) __OTORP__(unsigned long msec;int flags;void (*action)();__V_ *handle;){
- register Timer_t *tp;
+ Timer_t *tp;
double t;
Handler_t fn;
t = ((double)msec)/1000.;
* delete timer <tp>. If <tp> is NULL, all timers are deleted
*/
void timerdel __PARAM__((__V_ *handle), (handle)) __OTORP__(__V_ *handle;){
- register Timer_t *tp = (Timer_t*)handle;
+ Timer_t *tp = (Timer_t*)handle;
if(tp)
tp->action = 0;
else
static union anynode *r_tree()
{
long l = sfgetl(infile);
- register int type;
- register union anynode *t=0;
+ int type;
+ union anynode *t=0;
if(l<0)
return(t);
type = l;
}
static struct argnod *r_arg __PARAM__((void), ()){
- register struct argnod *ap=0, *apold, *aptop=0;
- register long l;
+ struct argnod *ap=0, *apold, *aptop=0;
+ long l;
while((l=sfgetu(infile))>0)
{
ap = (struct argnod*)stakseek((unsigned)l+ARGVAL);
}
static struct ionod *r_redirect __PARAM__((void), ()){
- register long l;
- register struct ionod *iop=0, *iopold, *ioptop=0;
+ long l;
+ struct ionod *iop=0, *iopold, *ioptop=0;
while((l=sfgetl(infile))>=0)
{
iop = (struct ionod*)getnode(ionod);
}
static struct dolnod *r_comlist __PARAM__((void), ()){
- register struct dolnod *dol=0;
- register long l;
- register char **argv;
+ struct dolnod *dol=0;
+ long l;
+ char **argv;
if((l=sfgetl(infile))>0)
{
dol = (struct dolnod*)stakalloc(sizeof(struct dolnod) + sizeof(char*)*(l+ARG_SPARE));
}
static struct regnod *r_switch __PARAM__((void), ()){
- register long l;
+ long l;
struct regnod *reg=0,*regold,*regtop=0;
while((l=sfgetl(infile))>=0)
{
}
static char *r_string __PARAM__((void), ()){
- register Sfio_t *in = infile;
- register unsigned long l = sfgetu(in);
- register char *ptr;
+ Sfio_t *in = infile;
+ unsigned long l = sfgetu(in);
+ char *ptr;
if(l == 0)
return(NIL(char*));
ptr = stakalloc((unsigned)l);
int sh_vforksave __PARAM__((void), ())
#line 35
{
- register struct f_save *fp;
+ struct f_save *fp;
if(!(fp = new_of(struct f_save,0)))
return(0);
fp->f_save_fork = save_fork;
void sh_vforkrestore __PARAM__((void), ())
#line 55
{
- register struct f_save *fp = save_fork;
+ struct f_save *fp = save_fork;
if(!sh_isstate(SH_VFORKED))
return;
/*
* Given stream <iop> compile and execute
*/
-int sh_eval __PARAM__((register Sfio_t *iop, int mode), (iop, mode)) __OTORP__(register Sfio_t *iop; int mode;){
- register union anynode *t;
+int sh_eval __PARAM__((Sfio_t *iop, int mode), (iop, mode)) __OTORP__(Sfio_t *iop; int mode;){
+ union anynode *t;
struct slnod *saveslp = sh.st.staklist;
int jmpval;
struct checkpt *pp = (struct checkpt*)sh.jmplist;
#ifdef SHOPT_FASTPIPE
static int pipe_exec __PARAM__((int pv[], union anynode *t, int errorflg), (pv, t, errorflg)) __OTORP__(int pv[]; union anynode *t; int errorflg;){
struct checkpt buff;
- register union anynode *tchild = t->fork.forktre;
+ union anynode *tchild = t->fork.forktre;
Namval_t *np;
Sfile_t *iop;
int jmpval,r;
}
#endif /* SHOPT_FASTPIPE */
-sh_exec __PARAM__((register const union anynode *t, int flags), (t, flags)) __OTORP__(register const union anynode *t; int flags;){
+sh_exec __PARAM__((const union anynode *t, int flags), (t, flags)) __OTORP__(const union anynode *t; int flags;){
sh_sigcheck();
if(t && !sh.st.execbrk && !sh_isoption(SH_NOEXEC))
{
- register int type = flags;
- register char *com0 = 0;
+ int type = flags;
+ char *com0 = 0;
int errorflg = (type&SH_ERREXIT);
int execflg = (type&SH_NOFORK);
int mainloop = (type&SH_INTERACTIVE);
{
case TCOM:
{
- register struct argnod *argp;
+ struct argnod *argp;
char *trap;
Namval_t *np;
struct ionod *io;
com0 = com[0];
if(!(np=(Namval_t*)(t->com.comnamp)) && com0)
{
- register char *cp;
+ char *cp;
Namval_t *nq=0;
/* check for reference to discipline function */
if((cp=strchr(com0,'.')) && cp!=com0)
}
while(np==SYSCOMMAND)
{
- register int n = b_command(0,com,0);
+ int n = b_command(0,com,0);
if(n==0)
break;
command += n;
{
if(argn==0 || (np && !command && nv_isattr(np,BLT_SPC)))
{
- register int flags=NV_VARNAME|NV_ASSIGN;
+ int flags=NV_VARNAME|NV_ASSIGN;
if(np==SYSTYPESET)
{
if(sh.fn_depth)
if(!command && np && nv_isattr(np,NV_FUNCTION))
{
int indx;
- register struct slnod *slp;
+ struct slnod *slp;
if(!np->nvalue.ip)
{
path_search(com0,NIL(char*),0);
}
case TFORK:
{
- register pid_t parent;
+ pid_t parent;
int no_fork,jobid;
int pipes[2];
no_fork = (execflg && !(type&(FAMP|FPOU)) &&
case TFOR: /* for and select */
{
- register char **args;
- register int nargs;
- register Namval_t *np;
+ char **args;
+ int nargs;
+ Namval_t *np;
struct dolnod *argsav=0;
struct comnod *tp;
char *cp, *nullptr = 0;
{
char *val;
int save_prompt;
- /* reuse register */
+ /* reuse */
if(refresh)
{
sh_menu(sfstderr,nargs,args);
case TWH: /* while and until */
{
- register int r=0;
+ int r=0;
sh.st.loopcnt++;
while(sh.st.execbrk==0 && (sh_exec(t->wh.whtre,0)==0)==(type==TWH))
{
}
case TARITH: /* (( expression )) */
{
- register char *trap;
+ char *trap;
static char *arg[4]= {"((", 0, "))"};
error_info.line = t->ar.arline-sh.st.firstline;
if(trap=sh.st.trap[SH_DEBUGTRAP])
t= (union anynode*)(t->sw.swlst);
while(t)
{
- register struct argnod *rex=(struct argnod*)t->reg.regptr;
+ struct argnod *rex=(struct argnod*)t->reg.regptr;
while(rex)
{
- register char *s;
+ char *s;
if(rex->argflag&ARG_MAC)
{
s = sh_mactrim(rex->argval,1);
}
case TFUN:
{
- register Namval_t *np;
- register struct slnod *slp;
- register char *fname = ((struct functnod*)t)->functnam;
- register char *cp;
- register Namval_t *npv=0;
+ Namval_t *np;
+ struct slnod *slp;
+ char *fname = ((struct functnod*)t)->functnam;
+ char *cp;
+ Namval_t *npv=0;
/* look for discipline functions */
error_info.line = t->funct.functline-sh.st.firstline;
if(cp = strrchr(fname,'.'))
/* new test compound command */
case TTST:
{
- register int n;
- register char *left;
+ int n;
+ char *left;
if(type&TTEST)
skipexitset++;
error_info.line = t->tst.tstline-sh.st.firstline;
}
else
{
- register int traceon=0;
- register char *right;
- register char *trap;
+ int traceon=0;
+ char *right;
+ char *trap;
n = type>>TSHIFT;
left = word_trim(&(t->lst.lstlef->arg),0);
if(type&TBINARY)
* returns 1 if r == trim(s) otherwise 0
*/
-static trim_eq __PARAM__((register const char *r,register const char *s), (r, s)) __OTORP__(register const char *r;register const char *s;){
- register char c;
+static trim_eq __PARAM__((const char *r,const char *s), (r, s)) __OTORP__(const char *r;const char *s;){
+ char c;
while(c = *s++)
{
if(c=='\\')
* print out the command line if set -x is on
*/
-int sh_trace __PARAM__((register char *argv[], register int nl), (argv, nl)) __OTORP__(register char *argv[]; register int nl;){
- register char *cp;
- register int bracket = 0;
+int sh_trace __PARAM__((char *argv[], int nl), (argv, nl)) __OTORP__(char *argv[]; int nl;){
+ char *cp;
+ int bracket = 0;
if(sh_isoption(SH_XTRACE))
{
/* make this trace atomic */
}
-static char *word_trim __PARAM__((register struct argnod *arg, int flag), (arg, flag)) __OTORP__(register struct argnod *arg; int flag;){
- register char *sp = arg->argval;
+static char *word_trim __PARAM__((struct argnod *arg, int flag), (arg, flag)) __OTORP__(struct argnod *arg; int flag;){
+ char *sp = arg->argval;
if((arg->argflag&ARG_RAW))
return(sp);
return(sh_mactrim(sp,flag));
/*
* called by parent and child after fork by sh_fork()
*/
-pid_t _sh_fork __PARAM__((register pid_t parent,int flags,int *jobid), (parent, flags, jobid)) __OTORP__(register pid_t parent;int flags;int *jobid;){
- register struct checkpt *pp = (struct checkpt*)sh.jmplist;
+pid_t _sh_fork __PARAM__((pid_t parent,int flags,int *jobid), (parent, flags, jobid)) __OTORP__(pid_t parent;int flags;int *jobid;){
+ struct checkpt *pp = (struct checkpt*)sh.jmplist;
static long forkcnt = 1000L;
pid_t curpgid = job.curpgid;
pid_t postid = (flags&FAMP)?0:curpgid;
}
pid_t sh_fork __PARAM__((int flags, int *jobid), (flags, jobid)) __OTORP__(int flags; int *jobid;){
- register pid_t parent;
+ pid_t parent;
#ifdef SHOPT_FASTPIPE
if(sffileno(sfstdin)<0)
{
* The environment modification list <envlist> is ignored for posix functions
*/
static void sh_funct __PARAM__((Namval_t *np,int argn, char *argv[],int execflg,struct argnod *envlist), (np, argn, argv, execflg, envlist)) __OTORP__(Namval_t *np;int argn; char *argv[];int execflg;struct argnod *envlist;){
- register char *trap;
- register int nsig;
+ char *trap;
+ int nsig;
struct dolnod *argsav=0,*saveargfor;
struct sh_scoped savst;
Shopt_t savopt;
*/
int sh_fun __PARAM__((Namval_t *np, Namval_t *nq), (np, nq)) __OTORP__(Namval_t *np; Namval_t *nq;){
char *argv[2];
- register Namarr_t *ap;
- register int offset;
- register char *base;
+ Namarr_t *ap;
+ int offset;
+ char *base;
Fcin_t save;
fcsave(&save);
if((offset=staktell())>0)
/*
* print a time and a separator
*/
-static void p_time __PARAM__((Sfio_t *outfile,register clock_t t,int c), (outfile, t, c)) __OTORP__(Sfio_t *outfile;register clock_t t;int c;){
- register int min, sec, frac;
- register int hr;
+static void p_time __PARAM__((Sfio_t *outfile,clock_t t,int c), (outfile, t, c)) __OTORP__(Sfio_t *outfile;clock_t t;int c;){
+ int min, sec, frac;
+ int hr;
frac = t%sh.lim.clk_tck;
frac = (frac*100)/sh.lim.clk_tck;
t /= sh.lim.clk_tck;
/*
* print out function definition
*/
-static void print_fun __PARAM__((register Namval_t* np), (np)) __OTORP__(register Namval_t* np;){
- register char *format;
+static void print_fun __PARAM__((Namval_t* np), (np)) __OTORP__(Namval_t* np;){
+ char *format;
if(!is_afunction(np) || !np->nvalue.ip)
return;
if(nv_isattr(np,NV_FPOSIX))
*/
static int run_subshell __PARAM__((const union anynode *t,pid_t grp), (t, grp)) __OTORP__(const union anynode *t;pid_t grp;){
static char prolog[] = "set; typeset -p; print .sh.dollar=$$";
- register int i, fd, trace = sh_isoption(SH_XTRACE);
+ int i, fd, trace = sh_isoption(SH_XTRACE);
pid_t pid;
char *arglist[3], devfd[12], *cp;
Sfio_t *sp = sftmp(0);
# ifndef _lib_fork
if(!argv)
{
- register union anynode *tchild = t->fork.forktre;
+ union anynode *tchild = t->fork.forktre;
int optimize=0;
otype = t->tre.tretyp;
savetype = otype;
*/
static int
-blokread __PARAM__((register Archive_t* ap, char* buf, int n), (ap, buf, n)) __OTORP__(register Archive_t* ap; char* buf; int n;){
- register int i;
- register int j;
+blokread __PARAM__((Archive_t* ap, char* buf, int n), (ap, buf, n)) __OTORP__(Archive_t* ap; char* buf; int n;){
+ int i;
+ int j;
char c;
static int eof;
}
static int
-blokwrite __PARAM__((register Archive_t* ap, char* buf, int n), (ap, buf, n)) __OTORP__(register Archive_t* ap; char* buf; int n;){
- register char* s;
- register int i;
- register int j;
+blokwrite __PARAM__((Archive_t* ap, char* buf, int n), (ap, buf, n)) __OTORP__(Archive_t* ap; char* buf; int n;){
+ char* s;
+ int i;
+ int j;
char blk[9];
if (ap->io.blok)
*/
void
-binit __PARAM__((register Archive_t* ap), (ap)) __OTORP__(register Archive_t* ap;){
+binit __PARAM__((Archive_t* ap), (ap)) __OTORP__(Archive_t* ap;){
unsigned long n;
if (ap->delta)
*/
int
-bskip __PARAM__((register Archive_t* ap), (ap)) __OTORP__(register Archive_t* ap;){
+bskip __PARAM__((Archive_t* ap), (ap)) __OTORP__(Archive_t* ap;){
long c;
int skip = ap->io.skip;
#ifdef MTIOCTOP
*/
static int
-bfill __PARAM__((register Archive_t* ap, int must), (ap, must)) __OTORP__(register Archive_t* ap; int must;){
- register int c;
+bfill __PARAM__((Archive_t* ap, int must), (ap, must)) __OTORP__(Archive_t* ap; int must;){
+ int c;
if (ap->io.eof) return(-1);
if (ap->io.skip) ap->io.skip = bskip(ap);
*/
int
-bread __PARAM__((register Archive_t* ap, __V_* ab, register long n, long m, int must), (ap, ab, n, m, must)) __OTORP__(register Archive_t* ap; __V_* ab; register long n; long m; int must;){
- register char* b = (char*)ab;
- register int c;
- register char* ob;
+bread __PARAM__((Archive_t* ap, __V_* ab, long n, long m, int must), (ap, ab, n, m, must)) __OTORP__(Archive_t* ap; __V_* ab; long n; long m; int must;){
+ char* b = (char*)ab;
+ int c;
+ char* ob;
if (ap->io.eof) return(-1);
if (m <= 0) return(0);
*/
void
-bunread __PARAM__((register Archive_t* ap, __V_* ab, register int n), (ap, ab, n)) __OTORP__(register Archive_t* ap; __V_* ab; register int n;){
- register char* b = (char*)ab;
+bunread __PARAM__((Archive_t* ap, __V_* ab, int n), (ap, ab, n)) __OTORP__(Archive_t* ap; __V_* ab; int n;){
+ char* b = (char*)ab;
ap->io.eof = 0;
ap->io.count -= n;
*/
char*
-bget __PARAM__((register Archive_t* ap, register int n), (ap, n)) __OTORP__(register Archive_t* ap; register int n;){
- register char* s;
+bget __PARAM__((Archive_t* ap, int n), (ap, n)) __OTORP__(Archive_t* ap; int n;){
+ char* s;
ap->io.count += n;
s = ap->io.next;
{
if (ap->io.last > ap->io.buffer + MAXUNREAD + state.buffersize)
{
- register char* b;
- register int k;
- register int m;
+ char* b;
+ int k;
+ int m;
k = ap->io.last - s;
m = roundof(k, IOALIGN) - k;
*/
void
-backup __PARAM__((register Archive_t* ap), (ap)) __OTORP__(register Archive_t* ap;){
- register long n;
- register long m;
+backup __PARAM__((Archive_t* ap), (ap)) __OTORP__(Archive_t* ap;){
+ long n;
+ long m;
#ifdef MTIOCTOP
struct mtop mt;
#endif
*/
void
-bflushin __PARAM__((register Archive_t* ap), (ap)) __OTORP__(register Archive_t* ap;){
+bflushin __PARAM__((Archive_t* ap), (ap)) __OTORP__(Archive_t* ap;){
ap->io.count += ap->io.last - ap->io.next;
ap->io.next = ap->io.last = ap->io.buffer + MAXUNREAD;
if (!ap->io.eof)
*/
off_t
-bseek __PARAM__((register Archive_t* ap, off_t pos, int op), (ap, pos, op)) __OTORP__(register Archive_t* ap; off_t pos; int op;){
+bseek __PARAM__((Archive_t* ap, off_t pos, int op), (ap, pos, op)) __OTORP__(Archive_t* ap; off_t pos; int op;){
ap->io.next = ap->io.last = ap->io.buffer + MAXUNREAD;
if ((pos = lseek(ap->io.fd, pos, op)) >= 0)
{
*/
void
-bflushout __PARAM__((register Archive_t* ap), (ap)) __OTORP__(register Archive_t* ap;){
- register int n;
- register int c;
+bflushout __PARAM__((Archive_t* ap), (ap)) __OTORP__(Archive_t* ap;){
+ int n;
+ int c;
if (n = ap->io.next - ap->io.buffer)
{
*/
void
-bwrite __PARAM__((register Archive_t* ap, __V_* ab, register int n), (ap, ab, n)) __OTORP__(register Archive_t* ap; __V_* ab; register int n;){
- register char* b = (char*)ab;
- register int c;
+bwrite __PARAM__((Archive_t* ap, __V_* ab, int n), (ap, ab, n)) __OTORP__(Archive_t* ap; __V_* ab; int n;){
+ char* b = (char*)ab;
+ int c;
if (ap->sum > 0)
ap->memsum = memsum(b, n, ap->memsum);
*/
void
-bput __PARAM__((register Archive_t* ap, register int n), (ap, n)) __OTORP__(register Archive_t* ap; register int n;){
+bput __PARAM__((Archive_t* ap, int n), (ap, n)) __OTORP__(Archive_t* ap; int n;){
ap->io.count += n;
message((-7, "bput(%s,%d@%ld): %-.*s%s", ap->name, n, ap->io.count, n > 32 ? 32 : n, ap->io.next, n > 32 ? "..." : ""));
if (ap->sum > 0)
*/
static int
-devpath __PARAM__((register Ftw_t* ftw), (ftw)) __OTORP__(register Ftw_t* ftw;){
+devpath __PARAM__((Ftw_t* ftw), (ftw)) __OTORP__(Ftw_t* ftw;){
if (ftw->info == FTW_F && ftw->statb.st_dev == dev.st->st_dev && ftw->statb.st_ino == dev.st->st_ino)
{
message((-1, "device name is %s", ftw->path));
*/
void
-newio __PARAM__((register Archive_t* ap, int c, int n), (ap, c, n)) __OTORP__(register Archive_t* ap; int c; int n;){
- register char* s;
- register char* rw;
+newio __PARAM__((Archive_t* ap, int c, int n), (ap, c, n)) __OTORP__(Archive_t* ap; int c; int n;){
+ char* s;
+ char* rw;
char* file;
char* io;
char* t;
*/
char*
-strlower __PARAM__((register char* s), (s)) __OTORP__(register char* s;){
- register int c;
- register char* t;
+strlower __PARAM__((char* s), (s)) __OTORP__(char* s;){
+ int c;
+ char* t;
for (t = s; c = *t; t++)
if (isupper(c))
*/
char*
-strupper __PARAM__((register char* s), (s)) __OTORP__(register char* s;){
- register int c;
- register char* t;
+strupper __PARAM__((char* s), (s)) __OTORP__(char* s;){
+ int c;
+ char* t;
for (t = s; c = *t; t++)
if (islower(c))
*/
long
-cpio_long __PARAM__((register unsigned short* s), (s)) __OTORP__(register unsigned short* s;){
+cpio_long __PARAM__((unsigned short* s), (s)) __OTORP__(unsigned short* s;){
Integral_t u;
u.l = 1;
*/
void
-cpio_short __PARAM__((register unsigned short* s, long n), (s, n)) __OTORP__(register unsigned short* s; long n;){
+cpio_short __PARAM__((unsigned short* s, long n), (s, n)) __OTORP__(unsigned short* s; long n;){
Integral_t u;
u.l = 1;
int
tar_checksum __PARAM__((void), ()){
- register char* p;
- register int n;
+ char* p;
+ int n;
p = tar_header.chksum;
while (p < &tar_header.chksum[sizeof(tar_header.chksum)]) *p++ = ' ';
*/
long
-asc_checksum __PARAM__((char* ab, int n, register unsigned long sum), (ab, n, sum)) __OTORP__(char* ab; int n; register unsigned long sum;){
- register unsigned char* b = (unsigned char*)ab;
- register unsigned char* e;
+asc_checksum __PARAM__((char* ab, int n, unsigned long sum), (ab, n, sum)) __OTORP__(char* ab; int n; unsigned long sum;){
+ unsigned char* b = (unsigned char*)ab;
+ unsigned char* e;
e = b + n;
while (b < e) sum += *b++;
*/
long
-getlabnum __PARAM__((register char* p, int byte, int width, int base), (p, byte, width, base)) __OTORP__(register char* p; int byte; int width; int base;){
- register char* e;
- register int c;
+getlabnum __PARAM__((char* p, int byte, int width, int base), (p, byte, width, base)) __OTORP__(char* p; int byte; int width; int base;){
+ char* e;
+ int c;
long n;
p += byte - 1;
*/
char*
-getlabstr __PARAM__((register char* p, int byte, int width, register char* s), (p, byte, width, s)) __OTORP__(register char* p; int byte; int width; register char* s;){
+getlabstr __PARAM__((char* p, int byte, int width, char* s), (p, byte, width, s)) __OTORP__(char* p; int byte; int width; char* s;){
- register char* e;
+ char* e;
char* v;
v = s;
#define OHASHLPART(h,c) OHASHPART(31, h, c, 3, 2)
unsigned long
-omemsum __PARAM__((const __V_* b, int n, register unsigned long c), (b, n, c)) __OTORP__(const __V_* b; int n; register unsigned long c;){
- register unsigned char* p;
- register unsigned char* e;
+omemsum __PARAM__((const __V_* b, int n, unsigned long c), (b, n, c)) __OTORP__(const __V_* b; int n; unsigned long c;){
+ unsigned char* p;
+ unsigned char* e;
p = (unsigned char*)b;
e = p + n;
*/
void
-copyin __PARAM__((register Archive_t* ap), (ap)) __OTORP__(register Archive_t* ap;){
- register File_t* f = &ap->file;
+copyin __PARAM__((Archive_t* ap), (ap)) __OTORP__(Archive_t* ap;){
+ File_t* f = &ap->file;
deltabase(ap);
while (getprologue(ap))
*/
int
-copyout __PARAM__((register Ftw_t* ftw), (ftw)) __OTORP__(register Ftw_t* ftw;){
- register Archive_t* ap = state.out;
- register File_t* f = &ap->file;
+copyout __PARAM__((Ftw_t* ftw), (ftw)) __OTORP__(Ftw_t* ftw;){
+ Archive_t* ap = state.out;
+ File_t* f = &ap->file;
if (getfile(ap, f, ftw))
{
static void
recordout __PARAM__((Archive_t* ap, File_t* f, Sfio_t* fp), (ap, f, fp)) __OTORP__(Archive_t* ap; File_t* f; Sfio_t* fp;){
- register int c;
- register char* p;
- register char* recdat;
- register char* blkdat;
+ int c;
+ char* p;
+ char* recdat;
+ char* blkdat;
char* rec;
char* blk;
int span;
*/
void
-fileout __PARAM__((register Archive_t* ap, register File_t* f), (ap, f)) __OTORP__(register Archive_t* ap; register File_t* f;){
- register int n;
- register long c;
+fileout __PARAM__((Archive_t* ap, File_t* f), (ap, f)) __OTORP__(Archive_t* ap; File_t* f;){
+ int n;
+ long c;
int err;
Buffer_t* bp;
Sfio_t* rfp;
*/
static void
-recordin __PARAM__((register Archive_t* ap, register File_t* f, int wfd), (ap, f, wfd)) __OTORP__(register Archive_t* ap; register File_t* f; int wfd;){
- register long n;
- register long size;
+recordin __PARAM__((Archive_t* ap, File_t* f, int wfd), (ap, f, wfd)) __OTORP__(Archive_t* ap; File_t* f; int wfd;){
+ long n;
+ long size;
int c;
int i;
int j;
*/
static void
-savesetin __PARAM__((register Archive_t* ap, register File_t* f, int wfd), (ap, f, wfd)) __OTORP__(register Archive_t* ap; register File_t* f; int wfd;){
- register long c;
+savesetin __PARAM__((Archive_t* ap, File_t* f, int wfd), (ap, f, wfd)) __OTORP__(Archive_t* ap; File_t* f; int wfd;){
+ long c;
int i;
int j;
int k;
*/
void
-filein __PARAM__((register Archive_t* ap, register File_t* f), (ap, f)) __OTORP__(register Archive_t* ap; register File_t* f;){
- register long c;
- register int n;
- register char* s;
+filein __PARAM__((Archive_t* ap, File_t* f), (ap, f)) __OTORP__(Archive_t* ap; File_t* f;){
+ long c;
+ int n;
+ char* s;
int dfd;
int wfd;
long checksum;
*/
void
-fileskip __PARAM__((register Archive_t* ap, register File_t* f), (ap, f)) __OTORP__(register Archive_t* ap; register File_t* f;){
+fileskip __PARAM__((Archive_t* ap, File_t* f), (ap, f)) __OTORP__(Archive_t* ap; File_t* f;){
switch (ap->format)
{
case ALAR:
int
copyinout __PARAM__((Ftw_t* ftw), (ftw)) __OTORP__(Ftw_t* ftw;){
- register long c;
- register long n;
- register int rfd;
- register int wfd;
- register File_t* f = &state.out->file;
+ long c;
+ long n;
+ int rfd;
+ int wfd;
+ File_t* f = &state.out->file;
static char path[PATH_MAX];
typedef int (*Ftw_cmp_t) __PROTO__((Ftw_t*, Ftw_t*));
void
-copy __PARAM__((register Archive_t* ap, register int (*copyfile)(Ftw_t*)), (ap, copyfile)) __OTORP__(register Archive_t* ap; register int (*copyfile)();){
- register char* s;
- register int n;
+copy __PARAM__((Archive_t* ap, int (*copyfile)(Ftw_t*)), (ap, copyfile)) __OTORP__(Archive_t* ap; int (*copyfile)();){
+ char* s;
+ int n;
if (ap)
{
*/
void
-append __PARAM__((register Archive_t* ap), (ap)) __OTORP__(register Archive_t* ap;){
+append __PARAM__((Archive_t* ap), (ap)) __OTORP__(Archive_t* ap;){
if (state.update) initdelta(ap);
ap->format = IN_DEFAULT;
copyin(ap);
static void
getdeltaops __PARAM__((Archive_t* ap, File_t* f), (ap, f)) __OTORP__(Archive_t* ap; File_t* f;){
- register char* s;
- register char* e;
- register int n;
+ char* s;
+ char* e;
+ int n;
unsigned long x;
char c;
*/
void
-getdeltaheader __PARAM__((register Archive_t* ap, register File_t* f), (ap, f)) __OTORP__(register Archive_t* ap; register File_t* f;){
- register char* s;
+getdeltaheader __PARAM__((Archive_t* ap, File_t* f), (ap, f)) __OTORP__(Archive_t* ap; File_t* f;){
+ char* s;
char c;
int n;
unsigned long sum;
*/
void
-getdeltatrailer __PARAM__((register Archive_t* ap, register File_t* f), (ap, f)) __OTORP__(register Archive_t* ap; register File_t* f;){
+getdeltatrailer __PARAM__((Archive_t* ap, File_t* f), (ap, f)) __OTORP__(Archive_t* ap; File_t* f;){
if (ap->delta && ap->delta->trailer)
{
f->st->st_size += ap->delta->trailer;
*/
void
-setdeltaheader __PARAM__((register Archive_t* ap, register File_t* f), (ap, f)) __OTORP__(register Archive_t* ap; register File_t* f;){
- register char* s;
- register int n;
+setdeltaheader __PARAM__((Archive_t* ap, File_t* f), (ap, f)) __OTORP__(Archive_t* ap; File_t* f;){
+ char* s;
+ int n;
if (f->delta.op && ap->delta)
{
*/
void
-putdeltaheader __PARAM__((register Archive_t* ap, register File_t* f), (ap, f)) __OTORP__(register Archive_t* ap; register File_t* f;){
+putdeltaheader __PARAM__((Archive_t* ap, File_t* f), (ap, f)) __OTORP__(Archive_t* ap; File_t* f;){
int n;
if (f->delta.op && ap->delta && (n = ap->delta->hdr - ap->delta->hdrbuf))
*/
void
-putdeltatrailer __PARAM__((register Archive_t* ap, register File_t* f), (ap, f)) __OTORP__(register Archive_t* ap; register File_t* f;){
- register char* s;
- register int n;
+putdeltatrailer __PARAM__((Archive_t* ap, File_t* f), (ap, f)) __OTORP__(Archive_t* ap; File_t* f;){
+ char* s;
+ int n;
if (f->delta.op && ap->delta)
{
*/
void
-deltabase __PARAM__((register Archive_t* ap), (ap)) __OTORP__(register Archive_t* ap;){
- register Archive_t* bp;
+deltabase __PARAM__((Archive_t* ap), (ap)) __OTORP__(Archive_t* ap;){
+ Archive_t* bp;
struct stat st;
if (!ap->delta)
void
deltaverify __PARAM__((Archive_t* ap), (ap)) __OTORP__(Archive_t* ap;){
- register int wfd;
- register Member_t* d;
- register long c;
- register long n;
+ int wfd;
+ Member_t* d;
+ long c;
+ long n;
Hash_position_t* pos;
if (!state.list && ap->delta && (pos = hashscan(ap->delta->tab, 0)))
*/
static void
-deltaprefix __PARAM__((Archive_t* ip, Archive_t* op, register Member_t* d), (ip, op, d)) __OTORP__(Archive_t* ip; Archive_t* op; register Member_t* d;){
- register char* s;
- register Member_t* m;
+deltaprefix __PARAM__((Archive_t* ip, Archive_t* op, Member_t* d), (ip, op, d)) __OTORP__(Archive_t* ip; Archive_t* op; Member_t* d;){
+ char* s;
+ Member_t* m;
d->mark = 1;
if (s = strrchr(d->info->path, '/'))
*/
void
-deltaout __PARAM__((Archive_t* ip, Archive_t* op, register File_t* f), (ip, op, f)) __OTORP__(Archive_t* ip; Archive_t* op; register File_t* f;){
- register Member_t* d;
+deltaout __PARAM__((Archive_t* ip, Archive_t* op, File_t* f), (ip, op, f)) __OTORP__(Archive_t* ip; Archive_t* op; File_t* f;){
+ Member_t* d;
int dfd;
if (d = op->delta && op->delta->tab && f->name ? (Member_t*)hashget(op->delta->tab, f->name) : (Member_t*)0)
}
if (!d || d->mtime != f->st->st_mtime)
{
- register char* s;
+ char* s;
if (ip && ip->delta && ip->delta->tab && f->name && (s = strrchr(f->name, '/')))
{
*/
static void
-deltacopy __PARAM__((Archive_t* ip, Archive_t* op, register File_t* f), (ip, op, f)) __OTORP__(Archive_t* ip; Archive_t* op; register File_t* f;){
+deltacopy __PARAM__((Archive_t* ip, Archive_t* op, File_t* f), (ip, op, f)) __OTORP__(Archive_t* ip; Archive_t* op; File_t* f;){
f->st->st_size = f->delta.base->size;
if (f->delta.base->expand >= 0)
{
*/
void
-deltadelete __PARAM__((register Archive_t* ap), (ap)) __OTORP__(register Archive_t* ap;){
- register File_t* f;
- register Member_t* d;
+deltadelete __PARAM__((Archive_t* ap), (ap)) __OTORP__(Archive_t* ap;){
+ File_t* f;
+ Member_t* d;
Hash_position_t* pos;
if (!state.ordered && ap->delta && ap->delta->tab)
void
deltapass __PARAM__((Archive_t* ip, Archive_t* op), (ip, op)) __OTORP__(Archive_t* ip; Archive_t* op;){
- register File_t* f;
- register long c;
- register long n;
+ File_t* f;
+ long c;
+ long n;
Member_t* d;
char* p;
Hash_position_t* pos;
static int
delread __PARAM__((__V_* buf, int n, long off, Vddisc_t* vd), (buf, n, off, vd)) __OTORP__(__V_* buf; int n; long off; Vddisc_t* vd;){
- register Vdio_t* dp = (Vdio_t*)vd;
+ Vdio_t* dp = (Vdio_t*)vd;
if (off != dp->offset)
{
static int
delwrite __PARAM__((__V_* buf, int n, long off, Vddisc_t* vd), (buf, n, off, vd)) __OTORP__(__V_* buf; int n; long off; Vddisc_t* vd;){
- register Vdio_t* dp = (Vdio_t*)vd;
+ Vdio_t* dp = (Vdio_t*)vd;
Buffer_t* bp;
if (dp->op & DELTA_BIO)
int
paxdelta __PARAM__((Archive_t* ip, Archive_t* ap, File_t* f, int op, ...), (va_alist)) __OTORP__(va_dcl)
{ __OTORP__(Archive_t* ip; Archive_t* ap; File_t* f; int op; )
- register Vdio_t* dp;
+ Vdio_t* dp;
va_list vp;
long n;
int bufferclash = 0;
*/
char*
-fgetline __PARAM__((register FILE* fp, int op), (fp, op)) __OTORP__(register FILE* fp; int op;)
+fgetline __PARAM__((FILE* fp, int op), (fp, op)) __OTORP__(FILE* fp; int op;)
#line 29
{
- register int c;
- register char* s;
- register char* end;
+ int c;
+ char* s;
+ char* end;
static char* buf;
static int siz;
*/
int
-filter __PARAM__((register Archive_t* ap, register File_t* f), (ap, f)) __OTORP__(register Archive_t* ap; register File_t* f;){
- register int n;
+filter __PARAM__((Archive_t* ap, File_t* f), (ap, f)) __OTORP__(Archive_t* ap; File_t* f;){
+ int n;
int rfd;
int wfd;
Proc_t* proc;
*/
int
-openin __PARAM__((register Archive_t* ap, register File_t* f), (ap, f)) __OTORP__(register Archive_t* ap; register File_t* f;){
- register int n;
+openin __PARAM__((Archive_t* ap, File_t* f), (ap, f)) __OTORP__(Archive_t* ap; File_t* f;){
+ int n;
int rfd;
if (f->type != X_IFREG)
*/
static int
-missdir __PARAM__((register Archive_t* ap, register File_t* f), (ap, f)) __OTORP__(register Archive_t* ap; register File_t* f;){
- register char* s;
- register char* t;
+missdir __PARAM__((Archive_t* ap, File_t* f), (ap, f)) __OTORP__(Archive_t* ap; File_t* f;){
+ char* s;
+ char* t;
long pp;
struct stat* st;
struct stat* sp;
*/
int
-openout __PARAM__((register Archive_t* ap, register File_t* f), (ap, f)) __OTORP__(register Archive_t* ap; register File_t* f;){
- register int fd;
+openout __PARAM__((Archive_t* ap, File_t* f), (ap, f)) __OTORP__(Archive_t* ap; File_t* f;){
+ int fd;
int exists;
struct stat st;
*/
int
-getfile __PARAM__((register Archive_t* ap, register File_t* f, register Ftw_t* ftw), (ap, f, ftw)) __OTORP__(register Archive_t* ap; register File_t* f; register Ftw_t* ftw;){
- register char* name;
+getfile __PARAM__((Archive_t* ap, File_t* f, Ftw_t* ftw), (ap, f, ftw)) __OTORP__(Archive_t* ap; File_t* f; Ftw_t* ftw;){
+ char* name;
static struct stat st;
static char pathbuffer[PATH_MAX];
*/
int
-validout __PARAM__((register Archive_t* ap, register File_t* f), (ap, f)) __OTORP__(register Archive_t* ap; register File_t* f;){
- register char* s;
+validout __PARAM__((Archive_t* ap, File_t* f), (ap, f)) __OTORP__(Archive_t* ap; File_t* f;){
+ char* s;
static char linkbuffer[PATH_MAX];
static char idbuffer[ALAR_NAMESIZE + 1];
*/
int
-addlink __PARAM__((register Archive_t* ap, register File_t* f), (ap, f)) __OTORP__(register Archive_t* ap; register File_t* f;){
- register Link_t* p;
- register char* s;
+addlink __PARAM__((Archive_t* ap, File_t* f), (ap, f)) __OTORP__(Archive_t* ap; File_t* f;){
+ Link_t* p;
+ char* s;
Fileid_t id;
unsigned short us;
*/
void
-getidnames __PARAM__((register File_t* f), (f)) __OTORP__(register File_t* f;){
+getidnames __PARAM__((File_t* f), (f)) __OTORP__(File_t* f;){
if (!f->uidname) f->uidname = fmtuid(f->st->st_uid);
if (!f->gidname) f->gidname = fmtgid(f->st->st_gid);
}
*/
void
-setidnames __PARAM__((register File_t* f), (f)) __OTORP__(register File_t* f;){
- register int id;
+setidnames __PARAM__((File_t* f), (f)) __OTORP__(File_t* f;){
+ int id;
if (f->uidname)
{
*/
void
-initfile __PARAM__((register Archive_t* ap, register File_t* f, register char* name, int mode), (ap, f, name, mode)) __OTORP__(register Archive_t* ap; register File_t* f; register char* name; int mode;){
+initfile __PARAM__((Archive_t* ap, File_t* f, char* name, int mode), (ap, f, name, mode)) __OTORP__(Archive_t* ap; File_t* f; char* name; int mode;){
static struct stat st;
memzero(f, sizeof(*f));
*/
void
-setfile __PARAM__((register Archive_t* ap, register File_t* f), (ap, f)) __OTORP__(register Archive_t* ap; register File_t* f;){
- register Post_t* p;
+setfile __PARAM__((Archive_t* ap, File_t* f), (ap, f)) __OTORP__(Archive_t* ap; File_t* f;){
+ Post_t* p;
Post_t post;
if (!ap->pass) switch (f->type)
*/
int
-restore __PARAM__((register const char* name, char* ap, __V_* handle), (name, ap, handle)) __OTORP__(register const char* name; char* ap; __V_* handle;){
- register Post_t* p = (Post_t*)ap;
+restore __PARAM__((const char* name, char* ap, __V_* handle), (name, ap, handle)) __OTORP__(const char* name; char* ap; __V_* handle;){
+ Post_t* p = (Post_t*)ap;
int m;
struct stat st;
*/
int
-prune __PARAM__((register Archive_t* ap, register File_t* f, register struct stat* st), (ap, f, st)) __OTORP__(register Archive_t* ap; register File_t* f; register struct stat* st;){
+prune __PARAM__((Archive_t* ap, File_t* f, struct stat* st), (ap, f, st)) __OTORP__(Archive_t* ap; File_t* f; struct stat* st;){
if (st->st_mode == f->st->st_mode && (ap->delta && f->st->st_mtime == st->st_mtime || state.update && (unsigned long)f->st->st_mtime <= (unsigned long)st->st_mtime))
return(1);
return(0);
ssize_t
holewrite __PARAM__((int fd, __V_* buf, size_t siz), (fd, buf, siz)) __OTORP__(int fd; __V_* buf; size_t siz;){
- register char* t = (char*)buf;
- register char* e = t + siz;
- register char* b = 0;
- register char* s;
+ char* t = (char*)buf;
+ char* e = t + siz;
+ char* b = 0;
+ char* s;
ssize_t i;
ssize_t n = 0;
*/
static int
-isalar __PARAM__((Archive_t* ap, register char* hdr), (ap, hdr)) __OTORP__(Archive_t* ap; register char* hdr;){
+isalar __PARAM__((Archive_t* ap, char* hdr), (ap, hdr)) __OTORP__(Archive_t* ap; char* hdr;){
char buf[4];
if (!strneq(hdr, "VOL1", 4))
*/
int
-getprologue __PARAM__((register Archive_t* ap), (ap)) __OTORP__(register Archive_t* ap;){
+getprologue __PARAM__((Archive_t* ap), (ap)) __OTORP__(Archive_t* ap;){
int n;
long size;
*/
static void
-setinfo __PARAM__((register Archive_t* ap, register File_t* f), (ap, f)) __OTORP__(register Archive_t* ap; register File_t* f;){
+setinfo __PARAM__((Archive_t* ap, File_t* f), (ap, f)) __OTORP__(Archive_t* ap; File_t* f;){
long n;
if (ap->delta)
*/
static void
-putinfo __PARAM__((register Archive_t* ap, char* file, unsigned long mtime, unsigned long checksum), (ap, file, mtime, checksum)) __OTORP__(register Archive_t* ap; char* file; unsigned long mtime; unsigned long checksum;){
- register File_t* f = &ap->file;
+putinfo __PARAM__((Archive_t* ap, char* file, unsigned long mtime, unsigned long checksum), (ap, file, mtime, checksum)) __OTORP__(Archive_t* ap; char* file; unsigned long mtime; unsigned long checksum;){
+ File_t* f = &ap->file;
Sfio_t* np = 0;
if (!file)
*/
void
-putprologue __PARAM__((register Archive_t* ap), (ap)) __OTORP__(register Archive_t* ap;){
+putprologue __PARAM__((Archive_t* ap), (ap)) __OTORP__(Archive_t* ap;){
if (ap->delta && ap->delta->version == DELTA_88)
ap->checksum = ap->old.checksum;
switch (ap->format)
*/
void
-getepilogue __PARAM__((register Archive_t* ap), (ap)) __OTORP__(register Archive_t* ap;){
- register char* s;
- register long n;
- register long i;
+getepilogue __PARAM__((Archive_t* ap), (ap)) __OTORP__(Archive_t* ap;){
+ char* s;
+ long n;
+ long i;
if (ap->delta && ap->delta->epilogue < 0)
error(3, "%s: corrupt archive: missing epilogue", ap->name);
*/
void
-putepilogue __PARAM__((register Archive_t* ap), (ap)) __OTORP__(register Archive_t* ap;){
- register long n;
- register unsigned long boundary;
+putepilogue __PARAM__((Archive_t* ap), (ap)) __OTORP__(Archive_t* ap;){
+ long n;
+ unsigned long boundary;
static int selected;
*/
static void
-getxops __PARAM__((register Archive_t* ap, register File_t* f), (ap, f)) __OTORP__(register Archive_t* ap; register File_t* f;){
- register char* p;
- register char* s;
- register int c;
+getxops __PARAM__((Archive_t* ap, File_t* f), (ap, f)) __OTORP__(Archive_t* ap; File_t* f;){
+ char* p;
+ char* s;
+ int c;
long n;
if (f->namesize > (n = strlen(f->name) + 1)) for (p = f->name + n; c = *p++;)
*/
static void
-setxops __PARAM__((Archive_t* ap, register File_t* f), (ap, f)) __OTORP__(Archive_t* ap; register File_t* f;){
- register int n;
+setxops __PARAM__((Archive_t* ap, File_t* f), (ap, f)) __OTORP__(Archive_t* ap; File_t* f;){
+ int n;
NoP(ap);
if (n = ops - opsbuf)
*/
static void
-putxops __PARAM__((Archive_t* ap, register File_t* f), (ap, f)) __OTORP__(Archive_t* ap; register File_t* f;){
- register int n;
+putxops __PARAM__((Archive_t* ap, File_t* f), (ap, f)) __OTORP__(Archive_t* ap; File_t* f;){
+ int n;
n = ops - opsbuf;
bwrite(ap, f->name, f->namesize -= n);
*/
static void
-addxopstr __PARAM__((Archive_t* ap, int op, register char* s), (ap, op, s)) __OTORP__(Archive_t* ap; int op; register char* s;){
- register char* p = ops;
- register char* e = opsbuf + sizeof(opsbuf) - 3;
+addxopstr __PARAM__((Archive_t* ap, int op, char* s), (ap, op, s)) __OTORP__(Archive_t* ap; int op; char* s;){
+ char* p = ops;
+ char* e = opsbuf + sizeof(opsbuf) - 3;
NoP(ap);
if (p < e)
static void
getkeyname __PARAM__((Archive_t* ap, File_t* f, int index, char** nm), (ap, f, index, nm)) __OTORP__(Archive_t* ap; File_t* f; int index; char** nm;){
- register Option_t* op;
+ Option_t* op;
static int uinit;
static int ginit;
static void
getkeytime __PARAM__((Archive_t* ap, File_t* f, int index, time_t* tm), (ap, f, index, tm)) __OTORP__(Archive_t* ap; File_t* f; int index; time_t* tm;){
- register Option_t* op;
+ Option_t* op;
NoP(f);
op = &options[index];
*/
int
-getheader __PARAM__((register Archive_t* ap, register File_t* f), (ap, f)) __OTORP__(register Archive_t* ap; register File_t* f;){
- register char* s;
- register int i;
- register long n;
+getheader __PARAM__((Archive_t* ap, File_t* f), (ap, f)) __OTORP__(Archive_t* ap; File_t* f;){
+ char* s;
+ int i;
+ long n;
char* t;
long num;
int warned;
static void
putkey __PARAM__((Sfio_t* sp, Sfio_t* tp, const char* name, int op, const char* value), (sp, tp, name, op, value)) __OTORP__(Sfio_t* sp; Sfio_t* tp; const char* name; int op; const char* value;){
- register const char* s;
- register int c;
- register int n;
+ const char* s;
+ int c;
+ int n;
sfprintf(tp, " %s", name);
if (op) sfputc(tp, op);
*/
void
-putheader __PARAM__((register Archive_t* ap, register File_t* f), (ap, f)) __OTORP__(register Archive_t* ap; register File_t* f;){
- register char* s;
- register int n;
+putheader __PARAM__((Archive_t* ap, File_t* f), (ap, f)) __OTORP__(Archive_t* ap; File_t* f;){
+ char* s;
+ int n;
int c;
setdeltaheader(ap, f);
*/
void
-gettrailer __PARAM__((register Archive_t* ap, File_t* f), (ap, f)) __OTORP__(register Archive_t* ap; File_t* f;){
- register long n;
+gettrailer __PARAM__((Archive_t* ap, File_t* f), (ap, f)) __OTORP__(Archive_t* ap; File_t* f;){
+ long n;
NoP(f);
if (ap->sum-- > 0)
*/
void
-puttrailer __PARAM__((register Archive_t* ap, register File_t* f), (ap, f)) __OTORP__(register Archive_t* ap; register File_t* f;){
- register int n;
+puttrailer __PARAM__((Archive_t* ap, File_t* f), (ap, f)) __OTORP__(Archive_t* ap; File_t* f;){
+ int n;
putdeltatrailer(ap, f);
switch (ap->format)
*/
int
-getlabel __PARAM__((register Archive_t* ap, register File_t* f), (ap, f)) __OTORP__(register Archive_t* ap; register File_t* f;){
- register int c;
- register int n;
+getlabel __PARAM__((Archive_t* ap, File_t* f), (ap, f)) __OTORP__(Archive_t* ap; File_t* f;){
+ int c;
+ int n;
static char last[5];
static int done;
*/
void
-putlabels __PARAM__((register Archive_t* ap, register File_t* f, char* type), (ap, f, type)) __OTORP__(register Archive_t* ap; register File_t* f; char* type;){
+putlabels __PARAM__((Archive_t* ap, File_t* f, char* type), (ap, f, type)) __OTORP__(Archive_t* ap; File_t* f; char* type;){
struct tm* tm;
static int section = 1;
*/
int
-getsaveset __PARAM__((register Archive_t* ap, register File_t* f, int header), (ap, f, header)) __OTORP__(register Archive_t* ap; register File_t* f; int header;){
- register char* p;
- register char* s;
+getsaveset __PARAM__((Archive_t* ap, File_t* f, int header), (ap, f, header)) __OTORP__(Archive_t* ap; File_t* f; int header;){
+ char* p;
+ char* s;
char* t;
int i;
long n;
*/
int
-getformat __PARAM__((register char* name), (name)) __OTORP__(register char* name;){
- register int i;
+getformat __PARAM__((char* name), (name)) __OTORP__(char* name;){
+ int i;
strlower(name);
for (i = 0; format[i].name; i++)
*/
static int
-pathcmp __PARAM__((register const char* s, register const char* t), (s, t)) __OTORP__(register const char* s; register const char* t;){
- register int sc;
- register int tc;
+pathcmp __PARAM__((const char* s, const char* t), (s, t)) __OTORP__(const char* s; const char* t;){
+ int sc;
+ int tc;
for (;;)
{
*/
int
-selectfile __PARAM__((register Archive_t* ap, register File_t* f), (ap, f)) __OTORP__(register Archive_t* ap; register File_t* f;){
- register Archive_t* bp;
- register Member_t* d;
+selectfile __PARAM__((Archive_t* ap, File_t* f), (ap, f)) __OTORP__(Archive_t* ap; File_t* f;){
+ Archive_t* bp;
+ Member_t* d;
int linked = 0;
if (f->skip || f->namesize <= 1)
addlink(ap, f);
if (state.ordered && ap->delta && ap->delta->format != COMPRESS && (bp = ap->delta->base))
{
- register int n;
- register int m;
+ int n;
+ int m;
for (;;)
{
*/
int
-verify __PARAM__((Archive_t* ap, register File_t* f), (ap, f)) __OTORP__(Archive_t* ap; register File_t* f;){
- register char* prompt;
- register char* name;
+verify __PARAM__((Archive_t* ap, File_t* f), (ap, f)) __OTORP__(Archive_t* ap; File_t* f;){
+ char* prompt;
+ char* name;
NoP(ap);
if (state.yesno) switch (state.operation)
*/
char*
-map __PARAM__((register char* name), (name)) __OTORP__(register char* name;){
- register Map_t* mp;
+map __PARAM__((char* name), (name)) __OTORP__(char* name;){
+ Map_t* mp;
char* to;
char* from;
*/
static int
-listlookup __PARAM__((__V_* handle, register const char* name, const char* arg, int cc, char** ps, long* pn), (handle, name, arg, cc, ps, pn)) __OTORP__(__V_* handle; register const char* name; const char* arg; int cc; char** ps; long* pn;){
+listlookup __PARAM__((__V_* handle, const char* name, const char* arg, int cc, char** ps, long* pn), (handle, name, arg, cc, ps, pn)) __OTORP__(__V_* handle; const char* name; const char* arg; int cc; char** ps; long* pn;){
List_handle_t* gp = (List_handle_t*)handle;
- register File_t* f = gp->file;
- register struct stat* st = f->st;
- register char* s = 0;
- register long n = 0;
+ File_t* f = gp->file;
+ struct stat* st = f->st;
+ char* s = 0;
+ long n = 0;
Option_t* op;
static Sfio_t* mp;
*/
void
-listentry __PARAM__((register File_t* f), (f)) __OTORP__(register File_t* f;){
+listentry __PARAM__((File_t* f), (f)) __OTORP__(File_t* f;){
if (!f->extended && !f->skip && (state.drop || state.list || state.verbose))
{
if (state.drop)
char**
initmatch __PARAM__((char** p), (p)) __OTORP__(char** p;){
- register char** a;
+ char** a;
a = p;
while (*a)
*/
int
-match __PARAM__((register char* s), (s)) __OTORP__(register char* s;){
- register char** p;
- register char* t;
+match __PARAM__((char* s), (s)) __OTORP__(char* s;){
+ char** p;
+ char* t;
int n;
if (!(p = state.patterns)) return(state.matchsense);
*/
int
-dirprefix __PARAM__((register char* p, register char* s), (p, s)) __OTORP__(register char* p; register char* s;){
+dirprefix __PARAM__((char* p, char* s), (p, s)) __OTORP__(char* p; char* s;){
if (*p == '.' && !*(p + 1) && *s != '/' && (*s != '.' || *(s + 1) != '.' || *(s + 2) && *(s + 2) != '/'))
return(1);
if (*p == '/' && !*(p + 1))
int
portable __PARAM__((const char* s), (s)) __OTORP__(const char* s;){
- register unsigned char* u = (unsigned char*)s;
- register int c;
+ unsigned char* u = (unsigned char*)s;
+ int c;
while (c = *s++)
if (c > 0177)
*/
static void
-nocom __PARAM__((register Sfio_t* sp, char* file), (sp, file)) __OTORP__(register Sfio_t* sp; char* file;){
- register int c = 0;
- register int p;
- register int data = 0;
+nocom __PARAM__((Sfio_t* sp, char* file), (sp, file)) __OTORP__(Sfio_t* sp; char* file;){
+ int c = 0;
+ int p;
+ int data = 0;
int sync = 0;
unsigned long line = 0;
unsigned long prev = 0;
}
main __PARAM__((int argc, char** argv), (argc, argv)) __OTORP__(int argc; char** argv;){
- register int c;
- register char* s;
- register Sfio_t* sp;
+ int c;
+ char* s;
+ Sfio_t* sp;
NoP(argc);
error_info.id = "nocom";
*/
static void
-substitute __PARAM__((Map_t** lastmap, register char* s), (lastmap, s)) __OTORP__(Map_t** lastmap; register char* s;){
- register Map_t* mp;
- register int n;
+substitute __PARAM__((Map_t** lastmap, char* s), (lastmap, s)) __OTORP__(Map_t** lastmap; char* s;){
+ Map_t* mp;
+ int n;
char* p;
for (;;)
static void
help __PARAM__((void), ()){
- register char* s;
- register char* e;
- register Sfio_t* sp;
+ char* s;
+ char* e;
+ Sfio_t* sp;
int n;
sp = sfstropen();
*/
int
-setoption __PARAM__((__V_* a, const __V_* p, register int n, register const char* v), (a, p, n, v)) __OTORP__(__V_* a; const __V_* p; register int n; register const char* v;){
+setoption __PARAM__((__V_* a, const __V_* p, int n, const char* v), (a, p, n, v)) __OTORP__(__V_* a; const __V_* p; int n; const char* v;){
int c;
char* e;
char* s;
static void
ignore __PARAM__((void), ()){
- register Option_t* op;
+ Option_t* op;
Hash_position_t* pos;
char* all;
char* ext;
int
main __PARAM__((int argc, char** argv), (argc, argv)) __OTORP__(int argc; char** argv;){
- register int i;
- register char* s;
- register Archive_t* ap;
+ int i;
+ char* s;
+ Archive_t* ap;
char* p;
Hash_position_t* pos;
Option_t* op;
void
finish __PARAM__((int code), (code)) __OTORP__(int code;){
- register Archive_t* ap;
- register char* x1 = &state.tmp.buffer[0];
- register char* x2 = &state.tmp.buffer[state.buffersize / 2];
- register unsigned long n;
+ Archive_t* ap;
+ char* x1 = &state.tmp.buffer[0];
+ char* x2 = &state.tmp.buffer[state.buffersize / 2];
+ unsigned long n;
while (state.proc)
{
cat > $tmp.c <<!
main()
{
- register unsigned long i;
- register unsigned long j;
- register unsigned long k = 0;
+ unsigned long i;
+ unsigned long j;
+ unsigned long k = 0;
for (i = 0; i < 5000; i++)
for (j = 0; j < 50000; j++)
k += j;
int
atexit __PARAM__((void (*func)(void)), (func)) __OTORP__(void (*func)();){
- register struct list* p;
+ struct list* p;
if (!(p = newof(0, struct list, 1, 0))) return(-1);
p->func = func;
void
_ast_atexit __PARAM__((void), ()){
- register struct list* p;
+ struct list* p;
while (p = funclist)
{
#undef NGROUPS_MAX
#define NGROUPS_MAX 1
#endif
- register int i;
+ int i;
int big[NGROUPS_MAX];
#else
#undef NGROUPS_MAX
*/
__V_*
-memccpy __PARAM__((__V_* as1, const __V_* as2, register int c, size_t n), (as1, as2, c, n)) __OTORP__(__V_* as1; const __V_* as2; register int c; size_t n;){
- register char* s1 = (char*)as1;
- register const char* s2 = (char*)as2;
- register const char* ep = s2 + n;
+memccpy __PARAM__((__V_* as1, const __V_* as2, int c, size_t n), (as1, as2, c, n)) __OTORP__(__V_* as1; const __V_* as2; int c; size_t n;){
+ char* s1 = (char*)as1;
+ const char* s2 = (char*)as2;
+ const char* ep = s2 + n;
while (s2 < ep)
if ((*s1++ = *s2++) == c)
*/
__V_*
-memchr __PARAM__((const __V_* asp, register int c, size_t n), (asp, c, n)) __OTORP__(const __V_* asp; register int c; size_t n;){
- register const char* sp = (char*)asp;
- register const char* ep = sp + n;
+memchr __PARAM__((const __V_* asp, int c, size_t n), (asp, c, n)) __OTORP__(const __V_* asp; int c; size_t n;){
+ const char* sp = (char*)asp;
+ const char* ep = sp + n;
while (sp < ep)
if (*sp++ == c)
int
memcmp __PARAM__((const __V_* ab1, const __V_* ab2, size_t n), (ab1, ab2, n)) __OTORP__(const __V_* ab1; const __V_* ab2; size_t n;){
- register const unsigned char* b1 = (const unsigned char*)ab1;
- register const unsigned char* b2 = (const unsigned char*)ab2;
- register const unsigned char* e = b1 + n;
+ const unsigned char* b1 = (const unsigned char*)ab1;
+ const unsigned char* b2 = (const unsigned char*)ab2;
+ const unsigned char* e = b1 + n;
while (b1 < e)
if (*b1++ != *b2++)
#else
__V_*
-memcpy __PARAM__((__V_* as1, const __V_* as2, register size_t n), (as1, as2, n)) __OTORP__(__V_* as1; const __V_* as2; register size_t n;){
- register char* s1 = (char*)as1;
- register const char* s2 = (const char*)as2;
+memcpy __PARAM__((__V_* as1, const __V_* as2, size_t n), (as1, as2, n)) __OTORP__(__V_* as1; const __V_* as2; size_t n;){
+ char* s1 = (char*)as1;
+ const char* s2 = (const char*)as2;
while (n-- > 0)
*s1++ = *s2++;
#else
__V_*
-memmove __PARAM__((__V_* to, const __V_* from, register size_t n), (to, from, n)) __OTORP__(__V_* to; const __V_* from; register size_t n;){
- register char* out = (char*)to;
- register char* in = (char*)from;
+memmove __PARAM__((__V_* to, const __V_* from, size_t n), (to, from, n)) __OTORP__(__V_* to; const __V_* from; size_t n;){
+ char* out = (char*)to;
+ char* in = (char*)from;
if (n <= 0) /* works if size_t is signed or not */
;
#else
__V_*
-memset __PARAM__((__V_* asp, register int c, register size_t n), (asp, c, n)) __OTORP__(__V_* asp; register int c; register size_t n;){
- register char* sp = (char*)asp;
+memset __PARAM__((__V_* asp, int c, size_t n), (asp, c, n)) __OTORP__(__V_* asp; int c; size_t n;){
+ char* sp = (char*)asp;
while (n-- > 0)
*sp++ = c;
int
mkdir __PARAM__((const char* path, mode_t mode), (path, mode)) __OTORP__(const char* path; mode_t mode;){
- register int n;
+ int n;
char* av[3];
static char* cmd[] = { "/bin/mkdir", "/usr/5bin/mkdir", 0 };
int
rmdir __PARAM__((const char* path), (path)) __OTORP__(const char* path;){
- register int n;
+ int n;
struct stat st;
char* av[3];
} Locale_t;
char*
-_ast_setlocale __PARAM__((register int category, const char* locale), (category, locale)) __OTORP__(register int category; const char* locale;){
+_ast_setlocale __PARAM__((int category, const char* locale), (category, locale)) __OTORP__(int category; const char* locale;){
#if _hdr_locale && _lib_setlocale
- register Locale_t* lc;
- register char* p;
+ Locale_t* lc;
+ char* p;
static Locale_t def[] =
{
execve(cmd, argv, envv);
if (errno == ENOEXEC)
{
- register char** o;
- register char** p;
- register char** v;
+ char** o;
+ char** p;
+ char** v;
for (p = o = (char**)argv; *p; p++);
if (v = newof(0, char*, p - o + 2, 0))
#endif
static void
-us2v __PARAM__((register struct statfs* ufs, register struct stat* st, register struct statvfs* vfs), (ufs, st, vfs)) __OTORP__(register struct statfs* ufs; register struct stat* st; register struct statvfs* vfs;){
+us2v __PARAM__((struct statfs* ufs, struct stat* st, struct statvfs* vfs), (ufs, st, vfs)) __OTORP__(struct statfs* ufs; struct stat* st; struct statvfs* vfs;){
memset(vfs, 0, sizeof(*vfs));
vfs->f_bsize = vfs->f_frsize = ufs->f_bsize;
vfs->f_blocks = ufs->f_blocks;
#else
static void
-s2v __PARAM__((register struct stat* st, register struct statvfs* vfs), (st, vfs)) __OTORP__(register struct stat* st; register struct statvfs* vfs;){
+s2v __PARAM__((struct stat* st, struct statvfs* vfs), (st, vfs)) __OTORP__(struct stat* st; struct statvfs* vfs;){
memset(vfs, 0, sizeof(*vfs));
vfs->f_bsize = vfs->f_frsize =
#if _mem_st_blksize_stat
#else
char*
-strchr __PARAM__((register const char* s, register int c), (s, c)) __OTORP__(register const char* s; register int c;){
+strchr __PARAM__((const char* s, int c), (s, c)) __OTORP__(const char* s; int c;){
do if (*s == c) return((char*)s); while(*s++);
return(0);
}
#else
char*
-strrchr __PARAM__((register const char* s, register int c), (s, c)) __OTORP__(register const char* s; register int c;){
- register const char* r;
+strrchr __PARAM__((const char* s, int c), (s, c)) __OTORP__(const char* s; int c;){
+ const char* r;
r = 0;
do if (*s == c) r = s; while(*s++);
extern __MANGLE__ double atof __PROTO__((const char*));
double
-strtod __PARAM__((register const char* s, char** e), (s, e)) __OTORP__(register const char* s; char** e;){
+strtod __PARAM__((const char* s, char** e), (s, e)) __OTORP__(const char* s; char** e;){
double n;
n = atof(s);
#define MBASE ('z' - 'a' + 1 + 10)
long
-strtol __PARAM__((register const char* str, char** ptr, register int base), (str, ptr, base)) __OTORP__(register const char* str; char** ptr; register int base;){
- register long val;
- register int c;
+strtol __PARAM__((const char* str, char** ptr, int base), (str, ptr, base)) __OTORP__(const char* str; char** ptr; int base;){
+ long val;
+ int c;
int xx, neg = 0;
if (ptr)
static char seed[] = { 'a', 'a', 'a', 0 };
char*
-tmpnam __PARAM__((register char* p), (p)) __OTORP__(register char* p;){
- register char* q;
+tmpnam __PARAM__((char* p), (p)) __OTORP__(char* p;){
+ char* q;
if (!p) p = buf;
strcopy(strcopy(strcopy(p, P_tmpdir), seed), "XXXXXX");
pid_t
waitpid __PARAM__((pid_t pid, int* status, int flags), (pid, status, flags)) __OTORP__(pid_t pid; int* status; int flags;){
- register struct zombie* zp;
- register struct zombie* pp;
- register int p;
+ struct zombie* zp;
+ struct zombie* pp;
+ int p;
int s;
#if !_lib_wait2 && !_lib_wait3
#if !defined(SIGCLD)
#else
#if _lib_dirread
{
- register char* sp; /* system */
- register struct dirent* up; /* user */
+ char* sp; /* system */
+ struct dirent* up; /* user */
char* u;
int n;
int m;
#define MAXREC roundof(sizeof(*up)-sizeof(up->d_name)+sizeof(sp->d_name)+1,8)
- register struct direct* sp; /* system */
- register struct dirent* up; /* user */
- register char* s;
- register char* u;
+ struct direct* sp; /* system */
+ struct dirent* up; /* user */
+ char* s;
+ char* u;
int n;
int m;
char tmp[sizeof(sp->d_name) + 1];
static DIR* freedirp; /* always keep one dirp */
DIR*
-opendir __PARAM__((register const char* path), (path)) __OTORP__(register const char* path;){
- register DIR* dirp = 0;
- register int fd;
+opendir __PARAM__((const char* path), (path)) __OTORP__(const char* path;){
+ DIR* dirp = 0;
+ int fd;
struct stat st;
if ((fd = open(path, 0)) < 0) return(0);
}
void
-closedir __PARAM__((register DIR* dirp), (dirp)) __OTORP__(register DIR* dirp;){
+closedir __PARAM__((DIR* dirp), (dirp)) __OTORP__(DIR* dirp;){
if (dirp)
{
close(dirp->dd_fd);
#else
struct dirent*
-readdir __PARAM__((register DIR* dirp), (dirp)) __OTORP__(register DIR* dirp;){
- register struct dirent* dp;
+readdir __PARAM__((DIR* dirp), (dirp)) __OTORP__(DIR* dirp;){
+ struct dirent* dp;
for (;;)
{
#else
void
-seekdir __PARAM__((register DIR* dirp, long loc), (dirp, loc)) __OTORP__(register DIR* dirp; long loc;){
+seekdir __PARAM__((DIR* dirp, long loc), (dirp, loc)) __OTORP__(DIR* dirp; long loc;){
off_t base; /* file location of block */
off_t offset; /* offset within block */
#define initfield(f,s) ((f)->first = (f)->delimiter = *((f)->next = (s)))
static char*
-getfield __PARAM__((register Field_t* f, int restore), (f, restore)) __OTORP__(register Field_t* f; int restore;){
- register char* s;
- register int n;
- register int c;
- register int lp;
- register int rp;
+getfield __PARAM__((Field_t* f, int restore), (f, restore)) __OTORP__(Field_t* f; int restore;){
+ char* s;
+ int n;
+ int c;
+ int lp;
+ int rp;
char* b;
if (!f->delimiter)
int
sfkeyprintf __PARAM__((Sfio_t* sp, __V_* handle, const char* format, Sf_key_lookup_t lookup, Sf_key_convert_t convert), (sp, handle, format, lookup, convert)) __OTORP__(Sfio_t* sp; __V_* handle; const char* format; Sf_key_lookup_t lookup; Sf_key_convert_t convert;){
- register int i;
+ int i;
for (i = 0; i < elementsof(state.tmp); i++)
if (!state.tmp[i] && !(state.tmp[i] = sfstropen()))
main()
{
- register int i;
- register int j;
- register int k;
+ int i;
+ int j;
+ int k;
int align0;
int align1;
#if _lib_getgroups
if (sizeof(gid_t) < sizeof(int))
{
- register int n;
+ int n;
gid_t groups[32 * sizeof(int) / sizeof(gid_t)];
for (n = 0; n < sizeof(int) / sizeof(gid_t); n++)
main()
{
- register int t;
- register int s;
- register int m = 1;
+ int t;
+ int s;
+ int m = 1;
for (s = 0; s < elementsof(size); s++)
{
main()
{
- register int i;
- register int n;
+ int i;
+ int n;
char c;
unsigned char uc;
main()
{
- register int i;
- register int j;
- register int k;
+ int i;
+ int j;
+ int k;
k = 0;
for (i = 0; map[i].name; i++)
main()
{
- register int i;
- register int j;
- register int k;
+ int i;
+ int j;
+ int k;
int align0;
int align1;
#if _lib_getgroups
if (sizeof(gid_t) < sizeof(int))
{
- register int n;
+ int n;
gid_t groups[32 * sizeof(int) / sizeof(gid_t)];
for (n = 0; n < sizeof(int) / sizeof(gid_t); n++)
main()
{
- register int t;
- register int s;
- register int m = 1;
+ int t;
+ int s;
+ int m = 1;
for (s = 0; s < elementsof(size); s++)
{
main()
{
- register int i;
- register int n;
+ int i;
+ int n;
char c;
unsigned char uc;
main()
{
- register int i;
- register int j;
- register int k;
+ int i;
+ int j;
+ int k;
int n;
k = 0;
Hash_table_t*
hashalloc __PARAM__((Hash_table_t* ref, ...), (va_alist)) __OTORP__(va_dcl)
{ __OTORP__(Hash_table_t* ref; )
- register Hash_table_t* tab;
- register Hash_table_t* ret = 0;
- register int internal;
+ Hash_table_t* tab;
+ Hash_table_t* ret = 0;
+ int internal;
int n;
va_list ap;
va_list va[4];
*/
static void
-dumpflags __PARAM__((register int flags), (flags)) __OTORP__(register int flags;){
+dumpflags __PARAM__((int flags), (flags)) __OTORP__(int flags;){
if (flags & HASH_ALLOCATE) sfprintf(sfstderr, "allocate ");
if (flags & HASH_BUCKET) sfprintf(sfstderr, "bucket ");
if (flags & HASH_FIXED) sfprintf(sfstderr, "fixed ");
*/
static void
-dumpbucket __PARAM__((register Hash_table_t* tab, int flags), (tab, flags)) __OTORP__(register Hash_table_t* tab; int flags;){
- register Hash_bucket_t** sp;
- register Hash_bucket_t* b;
+dumpbucket __PARAM__((Hash_table_t* tab, int flags), (tab, flags)) __OTORP__(Hash_table_t* tab; int flags;){
+ Hash_bucket_t** sp;
+ Hash_bucket_t* b;
Hash_bucket_t** sx;
int n;
unsigned char* s;
*/
static void
-dumptable __PARAM__((register Hash_table_t* tab, register int flags), (tab, flags)) __OTORP__(register Hash_table_t* tab; register int flags;){
+dumptable __PARAM__((Hash_table_t* tab, int flags), (tab, flags)) __OTORP__(Hash_table_t* tab; int flags;){
Hash_table_t* scope;
int level;
*/
static void
-dumproot __PARAM__((register Hash_root_t* root, register int flags), (root, flags)) __OTORP__(register Hash_root_t* root; register int flags;){
- register Hash_table_t* tab;
+dumproot __PARAM__((Hash_root_t* root, int flags), (root, flags)) __OTORP__(Hash_root_t* root; int flags;){
+ Hash_table_t* tab;
sfprintf(sfstderr, " root\n");
sfprintf(sfstderr, " address: 0x%08lx\n", (unsigned long)root);
*/
void
-hashdump __PARAM__((register Hash_table_t* tab, int flags), (tab, flags)) __OTORP__(register Hash_table_t* tab; int flags;){
- register Hash_root_t* root;
+hashdump __PARAM__((Hash_table_t* tab, int flags), (tab, flags)) __OTORP__(Hash_table_t* tab; int flags;){
+ Hash_root_t* root;
sfprintf(sfstderr, "\nhash table information:\n\n");
if (tab) dumproot(tab->root, flags);
*/
Hash_table_t*
-hashfree __PARAM__((register Hash_table_t* tab), (tab)) __OTORP__(register Hash_table_t* tab;){
- register Hash_bucket_t** sp;
- register Hash_bucket_t* b;
- register Hash_bucket_t* p;
+hashfree __PARAM__((Hash_table_t* tab), (tab)) __OTORP__(Hash_table_t* tab;){
+ Hash_bucket_t** sp;
+ Hash_bucket_t* b;
+ Hash_bucket_t* p;
Hash_bucket_t** sx;
Hash_root_t* rp;
Hash_table_t* tp;
#define HASH(r,n,h) if (r->local->hash) h = r->namesize ? (*r->local->hash)(n, r->namesize) : (*r->local->hash)(n);\
else\
{\
- register const char* _hash_s1 = n;\
+ const char* _hash_s1 = n;\
h = 0;\
if (r->namesize)\
{\
- register const char* _hash_s2 = _hash_s1 + r->namesize;\
+ const char* _hash_s2 = _hash_s1 + r->namesize;\
while (_hash_s1 < _hash_s2) HASHPART(h, *_hash_s1++);\
}\
else while (*_hash_s1) HASHPART(h, *_hash_s1++);\
*/
char*
-hashlook __PARAM__((register Hash_table_t* tab, const char* name, long flags, const char* value), (tab, name, flags, value)) __OTORP__(register Hash_table_t* tab; const char* name; long flags; const char* value;){
- register Hash_bucket_t* b;
- register unsigned int n;
- register Hash_last_t* last;
+hashlook __PARAM__((Hash_table_t* tab, const char* name, long flags, const char* value), (tab, name, flags, value)) __OTORP__(Hash_table_t* tab; const char* name; long flags; const char* value;){
+ Hash_bucket_t* b;
+ unsigned int n;
+ Hash_last_t* last;
Hash_table_t* top;
Hash_bucket_t* prev;
unsigned int i;
if ((flags & (HASH_LOOKUP|HASH_INTERNAL)) == (HASH_LOOKUP|HASH_INTERNAL))
{
- register char* s1;
- register const char* s2;
- register int c;
+ char* s1;
+ const char* s2;
+ int c;
if (flags & HASH_HASHED) n = *((unsigned int*)value);
else
{
if (!tab->root->local->compare)
{
- register char* s1 = hashname(b);
- register const char* s2 = name;
+ char* s1 = hashname(b);
+ const char* s2 = name;
if (tab->root->namesize)
{
- register char* s3 = s1 + tab->root->namesize;
+ char* s3 = s1 + tab->root->namesize;
while (*s1++ == *s2++)
if (s1 >= s3) goto found;
*/
Hash_position_t*
-hashscan __PARAM__((register Hash_table_t* tab, register int flags), (tab, flags)) __OTORP__(register Hash_table_t* tab; register int flags;){
- register Hash_position_t* pos;
+hashscan __PARAM__((Hash_table_t* tab, int flags), (tab, flags)) __OTORP__(Hash_table_t* tab; int flags;){
+ Hash_position_t* pos;
static Hash_bucket_t empty;
pos->flags = HASH_SCOPE;
do
{
- register Hash_bucket_t* b;
+ Hash_bucket_t* b;
if (tab->flags & HASH_SCANNING)
{
- register Hash_bucket_t** sp = tab->table;
- register Hash_bucket_t** sx = tab->table + tab->size;
+ Hash_bucket_t** sp = tab->table;
+ Hash_bucket_t** sx = tab->table + tab->size;
while (sp < sx)
for (b = *sp++; b; b = b->next)
*/
Hash_bucket_t*
-hashnext __PARAM__((register Hash_position_t* pos), (pos)) __OTORP__(register Hash_position_t* pos;){
- register Hash_bucket_t* b;
+hashnext __PARAM__((Hash_position_t* pos), (pos)) __OTORP__(Hash_position_t* pos;){
+ Hash_bucket_t* b;
if (!pos) return(hash_info.last = pos->tab->root->last.bucket = 0);
b = pos->bucket;
if (!(b->hash & HASH_DELETED) && (!(pos->tab->flags & HASH_VALUE) || b->value) && (!pos->flags || !(b->hash & (HASH_HIDDEN|HASH_HIDES)))) break;
if (b->hash & HASH_HIDES)
{
- register Hash_bucket_t* h = (Hash_bucket_t*)b->name;
+ Hash_bucket_t* h = (Hash_bucket_t*)b->name;
if (!(h->hash & HASH_HIDDEN))
{
*/
void
-hashdone __PARAM__((register Hash_position_t* pos), (pos)) __OTORP__(register Hash_position_t* pos;){
+hashdone __PARAM__((Hash_position_t* pos), (pos)) __OTORP__(Hash_position_t* pos;){
if (pos)
{
if (pos->tab->flags & HASH_SCANNING)
*/
void
-hashsize __PARAM__((register Hash_table_t* tab, int size), (tab, size)) __OTORP__(register Hash_table_t* tab; int size;){
- register Hash_bucket_t** old_s;
- register Hash_bucket_t** new_s;
- register Hash_bucket_t* old_b;
- register Hash_bucket_t* new_b;
+hashsize __PARAM__((Hash_table_t* tab, int size), (tab, size)) __OTORP__(Hash_table_t* tab; int size;){
+ Hash_bucket_t** old_s;
+ Hash_bucket_t** new_s;
+ Hash_bucket_t* old_b;
+ Hash_bucket_t* new_b;
Hash_bucket_t** old_sx;
unsigned int index;
HASHregion region;
int
hashwalk __PARAM__((Hash_table_t* tab, int flags, register(*walker)(const char*, char*, __V_*), __V_* handle), (tab, flags, walker, handle)) __OTORP__(Hash_table_t* tab; int flags; register(*walker)(); __V_* handle;){
- register Hash_bucket_t* b;
- register int v;
+ Hash_bucket_t* b;
+ int v;
Hash_position_t* pos;
if (!(pos = hashscan(tab, flags))) return(-1);
unsigned int
memhash __PARAM__((const __V_* as, int n), (as, n)) __OTORP__(const __V_* as; int n;){
- register const unsigned char* s = (const unsigned char*)as;
- register const unsigned char* e = s + n;
- register unsigned int c = 0;
+ const unsigned char* s = (const unsigned char*)as;
+ const unsigned char* e = s + n;
+ unsigned int c = 0;
while (s < e) HASHPART(c, *s++);
return(c);
*/
unsigned long
-memsum __PARAM__((const __V_* ap, int n, register unsigned long c), (ap, n, c)) __OTORP__(const __V_* ap; int n; register unsigned long c;){
- register const unsigned char* p = (const unsigned char*)ap;
- register const unsigned char* e = p + n;
+memsum __PARAM__((const __V_* ap, int n, unsigned long c), (ap, n, c)) __OTORP__(const __V_* ap; int n; unsigned long c;){
+ const unsigned char* p = (const unsigned char*)ap;
+ const unsigned char* e = p + n;
while (p < e) HASHPART(c, *p++);
#if LONG_MAX > 2147483647
unsigned int
strhash __PARAM__((const char* as), (as)) __OTORP__(const char* as;){
- register const unsigned char* s = (const unsigned char*)as;
- register unsigned int i = 0;
- register unsigned int c;
+ const unsigned char* s = (const unsigned char*)as;
+ unsigned int i = 0;
+ unsigned int c;
while (c = *s++) HASHPART(i, c);
return(i);
*/
unsigned long
-strsum __PARAM__((const char* as, register unsigned long c), (as, c)) __OTORP__(const char* as; register unsigned long c;){
- register const unsigned char* s = (const unsigned char*)as;
- register int n;
+strsum __PARAM__((const char* as, unsigned long c), (as, c)) __OTORP__(const char* as; unsigned long c;){
+ const unsigned char* s = (const unsigned char*)as;
+ int n;
while (n = *s++) HASHPART(c, n);
#if LONG_MAX > 2147483647
#undef calloc
__V_*
-calloc __PARAM__((register size_t count, register size_t size), (count, size)) __OTORP__(register size_t count; register size_t size;)
+calloc __PARAM__((size_t count, size_t size), (count, size)) __OTORP__(size_t count; size_t size;)
#line 15
{
- register __V_* ptr;
+ __V_* ptr;
if (ptr = malloc(size *= count))
memzero(ptr, size);
#include <wait.h>
int
-cmdclose __PARAM__((register int fd), (fd)) __OTORP__(register int fd;)
+cmdclose __PARAM__((int fd), (fd)) __OTORP__(int fd;)
#line 17
{
- register struct cmdinfo* cmd;
+ struct cmdinfo* cmd;
int status = -1;
for (cmd = cmds; cmd; cmd = cmd->next)
#include "cmdlib.h"
int
-cmdkill __PARAM__((register int fd, int sig), (fd, sig)) __OTORP__(register int fd; int sig;)
+cmdkill __PARAM__((int fd, int sig), (fd, sig)) __OTORP__(int fd; int sig;)
#line 13
{
- register struct cmdinfo* cmd;
+ struct cmdinfo* cmd;
for (cmd = cmds; cmd; cmd = cmd->next)
if (cmd->fd == fd)
*/
static int
-setopt __PARAM__((register __V_* a, register const __V_* p, register int n, const char* v), (a, p, n, v)) __OTORP__(register __V_* a; register const __V_* p; register int n; const char* v;)
+setopt __PARAM__((__V_* a, const __V_* p, int n, const char* v), (a, p, n, v)) __OTORP__(__V_* a; const __V_* p; int n; const char* v;)
#line 66
{
NoP(v);
cmdopen __PARAM__((const char* cmd, char** argv, char** envv, int* redv, const char* mode), (cmd, argv, envv, redv, mode)) __OTORP__(const char* cmd; char** argv; char** envv; int* redv; const char* mode;)
#line 119
{
- register struct cmdinfo* proc;
- register int cmdfd = -1;
- register char** p;
+ struct cmdinfo* proc;
+ int cmdfd = -1;
+ char** p;
char** v;
int* r;
int flags = 0;
*/
static int
-setopt __PARAM__((__V_* a, const __V_* p, register int n, register const char* v), (a, p, n, v)) __OTORP__(__V_* a; const __V_* p; register int n; register const char* v;){
+setopt __PARAM__((__V_* a, const __V_* p, int n, const char* v), (a, p, n, v)) __OTORP__(__V_* a; const __V_* p; int n; const char* v;){
NoP(a);
if (p) switch (((Namval_t*)p)->value)
{
*/
static void
-print __PARAM__((register Sfio_t* sp, register char* name, char* delim), (sp, name, delim)) __OTORP__(register Sfio_t* sp; register char* name; char* delim;){
- register int c;
+print __PARAM__((Sfio_t* sp, char* name, char* delim), (sp, name, delim)) __OTORP__(Sfio_t* sp; char* name; char* delim;){
+ int c;
while (c = *name++)
{
*/
static void
-context __PARAM__((register Sfio_t* sp, register Error_context_t* cp), (sp, cp)) __OTORP__(register Sfio_t* sp; register Error_context_t* cp;){
+context __PARAM__((Sfio_t* sp, Error_context_t* cp), (sp, cp)) __OTORP__(Sfio_t* sp; Error_context_t* cp;){
if (cp->context) context(sp, cp->context);
if (!(cp->flags & ERROR_SILENT))
{
void
errorv __PARAM__((const char* lib, int level, va_list ap), (lib, level, ap)) __OTORP__(const char* lib; int level; va_list ap;){
- register int n;
+ int n;
int fd;
int flags;
char* s;
__V_*
findopen __PARAM__((const char* pattern), (pattern)) __OTORP__(const char* pattern;){
- register Find_t* fp;
- register char* p;
- register char* s;
- register char* b;
- register int i;
+ Find_t* fp;
+ char* p;
+ char* s;
+ char* b;
+ int i;
int brace = 0;
int paren = 0;
void
findclose __PARAM__((__V_* handle), (handle)) __OTORP__(__V_* handle;){
- register Find_t* fp = (Find_t*)handle;
+ Find_t* fp = (Find_t*)handle;
sfclose(fp->fp);
free(fp);
char*
findnext __PARAM__((__V_* handle), (handle)) __OTORP__(__V_* handle;){
- register Find_t* fp = (Find_t*)handle;
- register char* p;
- register char* q;
- register char* s;
- register char* b;
- register int c;
+ Find_t* fp = (Find_t*)handle;
+ char* p;
+ char* q;
+ char* s;
+ char* b;
+ int c;
int n;
for (c = fp->peek; c != EOF;)
#include <fs3d.h>
int
-fs3d __PARAM__((register int op), (op)) __OTORP__(register int op;){
- register int cur;
- register char* v;
+fs3d __PARAM__((int op), (op)) __OTORP__(int op;){
+ int cur;
+ char* v;
char val[sizeof(FS3D_off) + 8];
static int fsview;
static Ftw_t *Free;
#define freeFtw(f) ((f)->link = Free, Free = (f))
-static Ftw_t *newFtw __PARAM__((register char* name, register int namelen), (name, namelen)) __OTORP__(register char* name; register int namelen;){
- register Ftw_t *f;
- register int amount;
+static Ftw_t *newFtw __PARAM__((char* name, int namelen), (name, namelen)) __OTORP__(char* name; int namelen;){
+ Ftw_t *f;
+ int amount;
if(Free && namelen < MINNAME)
f = Free, Free = f->link;
return f;
}
-static int freeAll __PARAM__((register Ftw_t* f, register int rv), (f, rv)) __OTORP__(register Ftw_t* f; register int rv;){
- register Ftw_t *next;
- register int freeing;
+static int freeAll __PARAM__((Ftw_t* f, int rv), (f, rv)) __OTORP__(Ftw_t* f; int rv;){
+ Ftw_t *next;
+ int freeing;
for(freeing = 0; freeing < 2; ++freeing)
{
/*
To compare directories by device/inode.
*/
-static int statcmp __PARAM__((register Ftw_t* f1, register Ftw_t* f2), (f1, f2)) __OTORP__(register Ftw_t* f1; register Ftw_t* f2;){
- register int d;
+static int statcmp __PARAM__((Ftw_t* f1, Ftw_t* f2), (f1, f2)) __OTORP__(Ftw_t* f1; Ftw_t* f2;){
+ int d;
if((d = f1->statb.st_ino - f2->statb.st_ino) != 0)
return d;
if((d = f1->statb.st_dev - f2->statb.st_dev) != 0)
#define RROTATE(r) (t = r->left, r->left = t->right, t->right = r, r = t)
#define LROTATE(r) (t = r->right, r->right = t->left, t->left = r, r = t)
-static Ftw_t *search __PARAM__((register Ftw_t* e, register Ftw_t* root, int(*comparf)(Ftw_t*, Ftw_t*), int insert), (e, root, comparf, insert)) __OTORP__(register Ftw_t* e; register Ftw_t* root; int(*comparf)(); int insert;){
- register int cmp;
- register Ftw_t *t, *left, *right, *lroot, *rroot;
+static Ftw_t *search __PARAM__((Ftw_t* e, Ftw_t* root, int(*comparf)(Ftw_t*, Ftw_t*), int insert), (e, root, comparf, insert)) __OTORP__(Ftw_t* e; Ftw_t* root; int(*comparf)(); int insert;){
+ int cmp;
+ Ftw_t *t, *left, *right, *lroot, *rroot;
left = right = lroot = rroot = 0;
while(root)
/*
** Delete the root element from the tree
*/
-static Ftw_t *deleteroot __PARAM__((register Ftw_t* root), (root)) __OTORP__(register Ftw_t* root;){
- register Ftw_t *t, *left, *right;
+static Ftw_t *deleteroot __PARAM__((Ftw_t* root), (root)) __OTORP__(Ftw_t* root;){
+ Ftw_t *t, *left, *right;
left = root->left;
right = root->right;
/*
Convert a binary search tree into a sorted todo (link) list
*/
-static void getlist __PARAM__((register Ftw_t** top, register Ftw_t** bot, register Ftw_t* root), (top, bot, root)) __OTORP__(register Ftw_t** top; register Ftw_t** bot; register Ftw_t* root;){
+static void getlist __PARAM__((Ftw_t** top, Ftw_t** bot, Ftw_t* root), (top, bot, root)) __OTORP__(Ftw_t** top; Ftw_t** bot; Ftw_t* root;){
if(root->left)
getlist(top,bot,root->left);
if (*top) (*bot)->link = root, *bot = root;
/*
Set directory when curdir is lost in space
*/
-static int setdir __PARAM__((register char* home, register char* path), (home, path)) __OTORP__(register char* home; register char* path;){
- register int cdrv;
+static int setdir __PARAM__((char* home, char* path), (home, path)) __OTORP__(char* home; char* path;){
+ int cdrv;
if(path[0] == '/')
cdrv = pathcd(path,NiL);
/*
Set to parent dir
*/
-static int setpdir __PARAM__((register char* home, register char* path, register char* base), (home, path, base)) __OTORP__(register char* home; register char* path; register char* base;){
- register int cdrv, c;
+static int setpdir __PARAM__((char* home, char* path, char* base), (home, path, base)) __OTORP__(char* home; char* path; char* base;){
+ int cdrv, c;
if(base > path)
{
/*
Pop a set of directories
*/
-static int popdirs __PARAM__((register int n_dir, register Ftw_t* ftw), (n_dir, ftw)) __OTORP__(register int n_dir; register Ftw_t* ftw;){
+static int popdirs __PARAM__((int n_dir, Ftw_t* ftw), (n_dir, ftw)) __OTORP__(int n_dir; Ftw_t* ftw;){
struct stat sb;
- register char *s, *endbuf;
+ char *s, *endbuf;
char buf[PATH_MAX];
if(!ftw || ftw->level < 0)
/*
Get top list of elt to process
*/
-static Ftw_t *toplist __PARAM__((register char** paths, int(*statf)(const char*, struct stat*),int(*comparf)(Ftw_t*, Ftw_t*), int metaphysical), (paths, statf, comparf, metaphysical)) __OTORP__(register char** paths; int(*statf)();int(*comparf)(); int metaphysical;){
- register char *path;
- register Ftw_t *f, *root;
+static Ftw_t *toplist __PARAM__((char** paths, int(*statf)(const char*, struct stat*),int(*comparf)(Ftw_t*, Ftw_t*), int metaphysical), (paths, statf, comparf, metaphysical)) __OTORP__(char** paths; int(*statf)();int(*comparf)(); int metaphysical;){
+ char *path;
+ Ftw_t *f, *root;
Ftw_t *top, *bot;
- register struct stat *sb;
+ struct stat *sb;
struct stat st;
top = bot = root = 0;
Note that free() is not used because we may need to chdir(home)
if there isn't enough space to continue
*/
-static int resize __PARAM__((register char** home, register char** endbuf, register char** path, register char** base, int n_buf, int incre), (home, endbuf, path, base, n_buf, incre)) __OTORP__(register char** home; register char** endbuf; register char** path; register char** base; int n_buf; int incre;){
- register char *old, *newp;
- register int n_old;
+static int resize __PARAM__((char** home, char** endbuf, char** path, char** base, int n_buf, int incre), (home, endbuf, path, base, n_buf, incre)) __OTORP__(char** home; char** endbuf; char** path; char** base; int n_buf; int incre;){
+ char *old, *newp;
+ int n_old;
/* add space for "/." used in testing FTW_DNX */
n_old = n_buf;
*/
ftwalk __PARAM__((const char *cpath, int (*userf)(Ftw_t*), int flags, int (*comparf)(Ftw_t*, Ftw_t*)), (cpath, userf, flags, comparf)) __OTORP__(const char *cpath; int (*userf)(); int flags; int (*comparf)();){
char *path = (char*)cpath;
- register int cdrv; /* chdir value */
+ int cdrv; /* chdir value */
int fnrv; /* return value from user function */
Ftw_t topf, /* the parent of top elt */
*todo, *top, *bot;
dirfp = 0;
while(todo)
{
- register int i, nd;
- register Ftw_t *ftw, *f;
- register struct stat *sb;
- register char *name, *endbase;
+ int i, nd;
+ Ftw_t *ftw, *f;
+ struct stat *sb;
+ char *name, *endbase;
Ftw_t *link, *root, *curdir, *diroot, *dotdot;
struct dirent *dir;
char *base;
- register int level, n_base, nostat, cpname;
+ int level, n_base, nostat, cpname;
/* process the top object on the stack */
ftw = todo;
int
ftwflags __PARAM__((void), ()){
- register char* s;
+ char* s;
s = astconf("PATH_RESOLVE", NiL, NiL);
if (streq(s, "physical"))
*/
static int
-popdir __PARAM__((register struct dirlist* d, register char* end), (d, end)) __OTORP__(register struct dirlist* d; register char* end;){
- register struct dirlist* dp;
+popdir __PARAM__((struct dirlist* d, char* end), (d, end)) __OTORP__(struct dirlist* d; char* end;){
+ struct dirlist* dp;
int v;
v = 0;
*/
static struct dirlist*
-pushdir __PARAM__((register struct dirlist* d, char* dots, char* path, char* end), (d, dots, path, end)) __OTORP__(register struct dirlist* d; char* dots; char* path; char* end;){
- register struct dirlist* p;
+pushdir __PARAM__((struct dirlist* d, char* dots, char* path, char* end), (d, dots, path, end)) __OTORP__(struct dirlist* d; char* dots; char* path; char* end;){
+ struct dirlist* p;
if (!(p = newof(0, struct dirlist, 1, 0)) || chdir(dots))
{
char*
getcwd __PARAM__((char* buf, size_t len), (buf, len)) __OTORP__(char* buf; size_t len;){
- register char* d;
- register char* p;
- register char* s;
+ char* d;
+ char* p;
+ char* s;
DIR* dirp = 0;
int n;
int x;
getpath __PARAM__((void), ())
#line 13
{
- register char* s;
+ char* s;
if (!(s = getenv("PATH")) || !*s) s = ":/bin:/usr/bin:/usr/ucb";
return(s);
getshell __PARAM__((void), ())
#line 28
{
- register char* s;
- register char* sh;
- register int i;
+ char* s;
+ char* sh;
+ int i;
if ((sh = getenv("SHELL")) && *sh == '/' && strmatch(sh, "*/(sh|*[!cC]sh)"))
{
#ifdef UNIV_MAX
if (isspace(*buf))
{
- register char* s;
- register char* t;
- register char* u;
- register char* v;
+ char* s;
+ char* t;
+ char* u;
+ char* v;
int match = 0;
char tmp[PATH_MAX];
return(getuniverse(buf) < 0 ? 0 : buf);
#else
#ifndef UNIV_MAX
- register char* u;
- register char* p;
+ char* u;
+ char* p;
if (!(u = getenv(univ_env)) || !*u)
{
u = _UNIV_DEFAULT;
if (p = getenv("PATH"))
{
- register int r = 1;
- register char* d = p;
+ int r = 1;
+ char* d = p;
int offset = staktell();
for (;;)
return(buf);
#else
#if defined(ATT_UNIV) || defined(U_GET)
- register int n;
+ int n;
#if defined(ATT_UNIV)
if ((n = setuniverse(ATT_UNIV)) < 0) return(0);
hsort __PARAM__((char** argv, int n, int(*fn)(const char*, const char*)), (argv, n, fn)) __OTORP__(char** argv; int n; int(*fn)();)
#line 15
{
- register int i;
- register int j;
- register int m;
- register char** ap;
+ int i;
+ int j;
+ int m;
+ char** ap;
char* s;
int k;
}
static void
-vmclose __PARAM__((register Vmalloc_t* vp), (vp)) __OTORP__(register Vmalloc_t* vp;){
- register Vmchunk_t* cp;
- register Vmchunk_t* np;
+vmclose __PARAM__((Vmalloc_t* vp), (vp)) __OTORP__(Vmalloc_t* vp;){
+ Vmchunk_t* cp;
+ Vmchunk_t* np;
if (vp)
{
}
static __V_*
-vmalloc __PARAM__((register Vmalloc_t* vp, size_t size), (vp, size)) __OTORP__(register Vmalloc_t* vp; size_t size;){
+vmalloc __PARAM__((Vmalloc_t* vp, size_t size), (vp, size)) __OTORP__(Vmalloc_t* vp; size_t size;){
char* p;
size_t n;
*/
static char*
-getdata __PARAM__((register Magic_t* mp, register long off, register int siz), (mp, off, siz)) __OTORP__(register Magic_t* mp; register long off; register int siz;){
- register long n;
+getdata __PARAM__((Magic_t* mp, long off, int siz), (mp, off, siz)) __OTORP__(Magic_t* mp; long off; int siz;){
+ long n;
if (off + siz <= mp->fbsz) return(mp->fbuf + off);
if (off < mp->xoff || off + siz > mp->xoff + mp->xbsz)
static long
indirect __PARAM__((const char* cs, char** e, __V_* handle), (cs, e, handle)) __OTORP__(const char* cs; char** e; __V_* handle;){
- register char* s = (char*)cs;
- register Magic_t* mp = (Magic_t*)handle;
- register long n = 0;
- register char* p;
+ char* s = (char*)cs;
+ Magic_t* mp = (Magic_t*)handle;
+ long n = 0;
+ char* p;
if (!s) liberror(lib, 2, "%s in indirect expression", *e);
else
*/
static char*
-ckmagic __PARAM__((register Magic_t* mp, const char* file, char* buf, struct stat* st, unsigned long off), (mp, file, buf, st, off)) __OTORP__(register Magic_t* mp; const char* file; char* buf; struct stat* st; unsigned long off;){
- register Entry_t* ep;
- register char* p;
- register char* b;
- register int level = 0;
+ckmagic __PARAM__((Magic_t* mp, const char* file, char* buf, struct stat* st, unsigned long off), (mp, file, buf, st, off)) __OTORP__(Magic_t* mp; const char* file; char* buf; struct stat* st; unsigned long off;){
+ Entry_t* ep;
+ char* p;
+ char* b;
+ int level = 0;
int call = -1;
int c;
char* t;
*/
static int
-ckenglish __PARAM__((register Magic_t* mp, int pun, int badpun), (mp, pun, badpun)) __OTORP__(register Magic_t* mp; int pun; int badpun;){
- register char* s;
- register int vowl = 0;
- register int freq = 0;
- register int rare = 0;
+ckenglish __PARAM__((Magic_t* mp, int pun, int badpun), (mp, pun, badpun)) __OTORP__(Magic_t* mp; int pun; int badpun;){
+ char* s;
+ int vowl = 0;
+ int freq = 0;
+ int rare = 0;
if (5 * badpun > pun)
return(0);
#define F_eascii (1<<2)
static char*
-cklang __PARAM__((register Magic_t* mp, const char* file, char* buf, struct stat* st), (mp, file, buf, st)) __OTORP__(register Magic_t* mp; const char* file; char* buf; struct stat* st;){
- register int c;
- register unsigned char* b;
- register unsigned char* e;
- register int q;
- register char* s;
+cklang __PARAM__((Magic_t* mp, const char* file, char* buf, struct stat* st), (mp, file, buf, st)) __OTORP__(Magic_t* mp; const char* file; char* buf; struct stat* st;){
+ int c;
+ unsigned char* b;
+ unsigned char* e;
+ int q;
+ char* s;
char* t;
char* base;
char* suff;
*/
static char*
-type __PARAM__((register Magic_t* mp, const char* file, struct stat* st, char* buf, int size), (mp, file, st, buf, size)) __OTORP__(register Magic_t* mp; const char* file; struct stat* st; char* buf; int size;){
+type __PARAM__((Magic_t* mp, const char* file, struct stat* st, char* buf, int size), (mp, file, st, buf, size)) __OTORP__(Magic_t* mp; const char* file; struct stat* st; char* buf; int size;){
char* s;
if (!S_ISREG(st->st_mode))
*/
int
-magicload __PARAM__((register Magic_t* mp, const char* file, unsigned long flags), (mp, file, flags)) __OTORP__(register Magic_t* mp; const char* file; unsigned long flags;){
- register Entry_t* ep;
- register Sfio_t* fp;
- register char* p;
+magicload __PARAM__((Magic_t* mp, const char* file, unsigned long flags), (mp, file, flags)) __OTORP__(Magic_t* mp; const char* file; unsigned long flags;){
+ Entry_t* ep;
+ Sfio_t* fp;
+ char* p;
int n;
int lge;
int lev;
first = ep = vmnewof(mp->region, 0, Entry_t, 1, 0);
while (p = sfgetr(fp, '\n', 1))
{
- register char* p2;
+ char* p2;
char* next;
error_info.line++;
Magic_t*
magicopen __PARAM__((unsigned long flags), (flags)) __OTORP__(unsigned long flags;){
- register Magic_t* mp;
- register int n;
- register Vmalloc_t* vp;
+ Magic_t* mp;
+ int n;
+ Vmalloc_t* vp;
if (!(vp = vmopen(Vmdcheap, Vmbest, 0)))
return(0);
*/
void
-magicclose __PARAM__((register Magic_t* mp), (mp)) __OTORP__(register Magic_t* mp;){
+magicclose __PARAM__((Magic_t* mp), (mp)) __OTORP__(Magic_t* mp;){
#if USE_VMALLOC
if (mp) vmclose(mp->region);
#else
*/
char*
-magictype __PARAM__((register Magic_t* mp, const char* file, struct stat* st), (mp, file, st)) __OTORP__(register Magic_t* mp; const char* file; struct stat* st;){
+magictype __PARAM__((Magic_t* mp, const char* file, struct stat* st), (mp, file, st)) __OTORP__(Magic_t* mp; const char* file; struct stat* st;){
char* s;
struct stat statb;
*/
int
-magiclist __PARAM__((register Magic_t* mp, register Sfio_t* sp), (mp, sp)) __OTORP__(register Magic_t* mp; register Sfio_t* sp;){
- register Entry_t* ep = mp->magic;
- register Entry_t* rp = 0;
+magiclist __PARAM__((Magic_t* mp, Sfio_t* sp), (mp, sp)) __OTORP__(Magic_t* mp; Sfio_t* sp;){
+ Entry_t* ep = mp->magic;
+ Entry_t* rp = 0;
sfprintf(sp, "cont\toffset\ttype\top\tmask\tvalue\tdesc\n");
while (ep)
int Mt_trace = -1; /* print trace of mallocs and frees */
/* Convert an int to a string */
-static itoa __PARAM__((register size_t i, register char* buf), (i, buf)) __OTORP__(register size_t i; register char* buf;)
+static itoa __PARAM__((size_t i, char* buf), (i, buf)) __OTORP__(size_t i; char* buf;)
#line 281
{
- register int k, c;
+ int k, c;
k = 0;
do
}
/* Convert an int to a hex string */
-static xtoa __PARAM__((register size_t i, register char* buf), (i, buf)) __OTORP__(register size_t i; register char* buf;)
+static xtoa __PARAM__((size_t i, char* buf), (i, buf)) __OTORP__(size_t i; char* buf;)
#line 301
{
- register int k;
+ int k;
static char dig[] = "0123456789ABCDEF";
}
/* internal function for warning on corruption */
-static int mt_corrupt __PARAM__((register VOID* addr, register size_t usize, register VOID* stamp), (addr, usize, stamp)) __OTORP__(register VOID* addr; register size_t usize; register VOID* stamp;)
+static int mt_corrupt __PARAM__((VOID* addr, size_t usize, VOID* stamp), (addr, usize, stamp)) __OTORP__(VOID* addr; size_t usize; VOID* stamp;)
#line 316
{
char buf[64], *mesg;
}
/* Print trace information */
-static mt_trace __PARAM__((register VOID* addr, register int type), (addr, type)) __OTORP__(register VOID* addr; register int type;)
+static mt_trace __PARAM__((VOID* addr, int type), (addr, type)) __OTORP__(VOID* addr; int type;)
#line 339
{
char *mesg, buf[64];
}
/* Print a warning */
-static mt_didfree __PARAM__((register VOID* addr, register int type), (addr, type)) __OTORP__(register VOID* addr; register int type;)
+static mt_didfree __PARAM__((VOID* addr, int type), (addr, type)) __OTORP__(VOID* addr; int type;)
#line 360
{
char *mesg, buf[64];
}
/* Set trace info for a block */
-static mt_setinfo __PARAM__((register TREE* bp, register size_t usize, int type), (bp, usize, type)) __OTORP__(register TREE* bp; register size_t usize; int type;)
+static mt_setinfo __PARAM__((TREE* bp, size_t usize, int type), (bp, usize, type)) __OTORP__(TREE* bp; size_t usize; int type;)
#line 373
{
- register uchar *magic, *emagic;
+ uchar *magic, *emagic;
USIZE(bp) = usize;
USTAMP(bp) = NIL(VOID*);
}
/* Set a stamp */
-mt_stamp __PARAM__((register VOID* addr, register VOID* stamp), (addr, stamp)) __OTORP__(register VOID* addr; register VOID* stamp;)
+mt_stamp __PARAM__((VOID* addr, VOID* stamp), (addr, stamp)) __OTORP__(VOID* addr; VOID* stamp;)
#line 387
{
USTAMP(BLOCK(addr)) = stamp;
mt_certify __PARAM__((void), ())
#line 393
{
- register TREE *bp, *endb;
- register uchar *magic, *endm;
+ TREE *bp, *endb;
+ uchar *magic, *endm;
if(!Mt_corrupt)
Mt_corrupt = mt_corrupt;
mt_stat __PARAM__((int fd), (fd)) __OTORP__(int fd;)
#line 417
{
- register TREE *bp, *endb;
- register size_t nbusy, sfree, sbusy, mbusy;
+ TREE *bp, *endb;
+ size_t nbusy, sfree, sbusy, mbusy;
char buf[64], *mesg;
nbusy = sfree = sbusy = mbusy = 0;
/*
** Get more core. Gaps in memory are noted as busy blocks.
*/
-static TREE *morecore __PARAM__((register size_t size), (size)) __OTORP__(register size_t size;)
+static TREE *morecore __PARAM__((size_t size), (size)) __OTORP__(size_t size;)
#line 463
{
- register TREE *tp, *bp;
- register VOID *addr;
+ TREE *tp, *bp;
+ VOID *addr;
/* space for queue of delayed free blocks */
if(!Qfree)
#ifndef SEGMENT
if((((size_t)addr)%ALIGN) != 0)
{ /* make sure alignment is correct */
- register size_t n = ALIGN - ((size_t)addr)%ALIGN;
+ size_t n = ALIGN - ((size_t)addr)%ALIGN;
if((VOID*)GETCORE(n) == ERRCORE)
{
Bottom = bp;
** the tree and return its address.
** This uses the top-down splay strategy.
*/
-static TREE *t_search __PARAM__((register int size), (size)) __OTORP__(register int size;)
+static TREE *t_search __PARAM__((int size), (size)) __OTORP__(int size;)
#line 559
{
- register int cmp;
- register TREE *t, *del, *left, *right, *lroot, *rroot;
+ int cmp;
+ TREE *t, *del, *left, *right, *lroot, *rroot;
/* find the right one to delete */
del = Root;
/*
** malloc().
*/
-__V_* malloc __PARAM__((register size_t size), (size)) __OTORP__(register size_t size;)
+__V_* malloc __PARAM__((size_t size), (size)) __OTORP__(size_t size;)
#line 681
{
- register TREE *tp, *np, *fp;
- register int n, i;
+ TREE *tp, *np, *fp;
+ int n, i;
#ifdef MTRACE
/* save true size and make size large enough to hold our data */
- register size_t mtsize = size;
+ size_t mtsize = size;
size = size <= (MINSIZE-MTSPACE) ? MINSIZE : size + MTSPACE;
if(Mt_certify)
mt_certify();
/*
** realloc().
*/
-__V_* realloc __PARAM__((__V_* old, register size_t size), (old, size)) __OTORP__(__V_* old; register size_t size;)
+__V_* realloc __PARAM__((__V_* old, size_t size), (old, size)) __OTORP__(__V_* old; size_t size;)
#line 790
{
- register TREE *tp, *np;
- register int n, ts;
- register VOID *newp;
+ TREE *tp, *np;
+ int n, ts;
+ VOID *newp;
#ifdef MTRACE
- register size_t mtsize = size;
+ size_t mtsize = size;
if(old)
{
size = size < (MINSIZE-MTSPACE) ? MINSIZE : size + MTSPACE;
void free __PARAM__((__V_* aold), (aold)) __OTORP__(__V_* aold;)
#line 879
{
- register VOID* old = (VOID*)aold;
- register int size;
- register TREE *tp, *np, *sp;
- register VOID *dequeue;
+ VOID* old = (VOID*)aold;
+ int size;
+ TREE *tp, *np, *sp;
+ VOID *dequeue;
#ifdef MTRACE
if(Lfree != old)
{
*/
static int
-error __PARAM__((register char* p), (p)) __OTORP__(register char* p;){
- register char* s;
- register char* t;
+error __PARAM__((char* p), (p)) __OTORP__(char* p;){
+ char* s;
+ char* t;
int n;
if (!opt_info.msg && !(opt_info.msg = newof(0, char, OPT_MSG, 0))) opt_info.arg = "[* out of space *]";
static void
optadd __PARAM__((const char* opts), (opts)) __OTORP__(const char* opts;){
- register int n;
+ int n;
if ((!opt_info.nopt || opt_info.opts[opt_info.nopt - 1] != (char*)opts) && opt_info.nopt < elementsof(opt_info.opts) - 1)
{
*/
int
-optget __PARAM__((register char** argv, const char* oopts), (argv, oopts)) __OTORP__(register char** argv; const char* oopts;){
- register int c;
- register char* s;
+optget __PARAM__((char** argv, const char* oopts), (argv, oopts)) __OTORP__(char** argv; const char* oopts;){
+ int c;
+ char* s;
char* e;
char* opts;
int n;
char*
optusage __PARAM__((const char* oopts), (oopts)) __OTORP__(const char* oopts;){
char* opts = (char*)oopts;
- register Sfio_t* sp;
- register int c;
- register char* p;
+ Sfio_t* sp;
+ int c;
+ char* p;
char* t;
char* x;
char** o;
optjoin __PARAM__((char** argv, ...), (va_alist)) __OTORP__(va_dcl)
{ __OTORP__(char** argv; )
va_list ap;
- register OPTFUN fun;
- register OPTFUN rep;
+ OPTFUN fun;
+ OPTFUN rep;
OPTFUN err;
int more;
int user;
#include <ls.h>
char*
-pathaccess __PARAM__((register char* path, register const char* dirs, const char* a, const char* b, register int mode), (path, dirs, a, b, mode)) __OTORP__(register char* path; register const char* dirs; const char* a; const char* b; register int mode;)
+pathaccess __PARAM__((char* path, const char* dirs, const char* a, const char* b, int mode), (path, dirs, a, b, mode)) __OTORP__(char* path; const char* dirs; const char* a; const char* b; int mode;)
#line 18
{
int sep = ':';
pathcanon __PARAM__((char* path, int flags), (path, flags)) __OTORP__(char* path; int flags;)
#line 33
{
- register char* p;
- register char* r;
- register char* s;
- register char* t;
- register int dots;
+ char* p;
+ char* r;
+ char* s;
+ char* t;
+ int dots;
int loop;
int oerrno;
#if defined(FS_3D)
#include <ast.h>
char*
-pathcat __PARAM__((char* path, register const char* dirs, int sep, const char* a, register const char* b), (path, dirs, sep, a, b)) __OTORP__(char* path; register const char* dirs; int sep; const char* a; register const char* b;)
+pathcat __PARAM__((char* path, const char* dirs, int sep, const char* a, const char* b), (path, dirs, sep, a, b)) __OTORP__(char* path; const char* dirs; int sep; const char* a; const char* b;)
#line 13
{
- register char* s;
+ char* s;
s = path;
while (*dirs && *dirs != sep) *s++ = *dirs++;
pathkey __PARAM__((char* key, char* attr, const char* lang, const char* apath), (key, attr, lang, apath)) __OTORP__(char* key; char* attr; const char* lang; const char* apath;)
#line 24
{
- register char* path = (char*)apath;
- register char* s;
- register char* k;
+ char* path = (char*)apath;
+ char* s;
+ char* k;
char* t;
char* flags;
char** p;
extern __MANGLE__ char** environ;
char*
-pathpath __PARAM__((register char* path, const char* p, const char* a, int mode), (path, p, a, mode)) __OTORP__(register char* path; const char* p; const char* a; int mode;)
+pathpath __PARAM__((char* path, const char* p, const char* a, int mode), (path, p, a, mode)) __OTORP__(char* path; const char* p; const char* a; int mode;)
#line 20
{
- register char* s;
+ char* s;
char* x;
static char* cmd;
#line 32
{
char* proc = (char*)aproc;
- register char* p;
- register char* k;
- register char** ap;
+ char* p;
+ char* k;
+ char** ap;
int n;
char* e;
char* probe;
#include <ast.h>
char*
-pathrepl __PARAM__((register char* path, const char* match, register const char* replace), (path, match, replace)) __OTORP__(register char* path; const char* match; register const char* replace;)
+pathrepl __PARAM__((char* path, const char* match, const char* replace), (path, match, replace)) __OTORP__(char* path; const char* match; const char* replace;)
#line 14
{
- register const char* m = match;
- register const char* r;
+ const char* m = match;
+ const char* r;
char* t;
if (!match) match = "";
while (*m && *m++ == *path) path++;
if (!*m && *path == '/')
{
- register char* p;
+ char* p;
p = t;
r = replace;
if (p < path) while (*p++ = *path++);
else if (*r && p >= path)
{
- register char* u;
+ char* u;
t = path + strlen(path);
u = t + strlen(r);
pathtemp __PARAM__((char* buf, const char* adir, const char* apfx), (buf, adir, apfx)) __OTORP__(char* buf; const char* adir; const char* apfx;)
#line 39
{
- register char* dir = (char*)adir;
+ char* dir = (char*)adir;
char* pfx = (char*)apfx;
- register char* p;
- register char* s;
+ char* p;
+ char* s;
int pid;
static char* tmpdir;
#include <wait.h>
int
-procclose __PARAM__((register Proc_t* p), (p)) __OTORP__(register Proc_t* p;){
+procclose __PARAM__((Proc_t* p), (p)) __OTORP__(Proc_t* p;){
int status = -1;
if (p)
#include "proclib.h"
int
-procfree __PARAM__((register Proc_t* p), (p)) __OTORP__(register Proc_t* p;){
+procfree __PARAM__((Proc_t* p), (p)) __OTORP__(Proc_t* p;){
if (!p) return(-1);
if (p == &proc_default) p->pid = -1;
else free(p);
*/
static int
-setopt __PARAM__((register __V_* a, register const __V_* p, register int n, const char* v), (a, p, n, v)) __OTORP__(register __V_* a; register const __V_* p; register int n; const char* v;){
+setopt __PARAM__((__V_* a, const __V_* p, int n, const char* v), (a, p, n, v)) __OTORP__(__V_* a; const __V_* p; int n; const char* v;){
NoP(v);
if (p)
{
#endif
#if USE_SPAWN
{
- register Modify_t* m;
+ Modify_t* m;
if (!(m = newof(NiL, Modify_t, 1, 0))) return(-1);
m->next = mods;
static void
restore __PARAM__((Proc_t* proc), (proc)) __OTORP__(Proc_t* proc;){
- register Modify_t* m;
- register Modify_t* p;
+ Modify_t* m;
+ Modify_t* p;
int oerrno;
NoP(proc);
Proc_t*
procopen __PARAM__((const char* cmd, char** argv, char** envv, long* modv, long flags), (cmd, argv, envv, modv, flags)) __OTORP__(const char* cmd; char** argv; char** envv; long* modv; long flags;){
- register Proc_t* proc = 0;
- register int procfd;
- register char** p;
+ Proc_t* proc = 0;
+ int procfd;
+ char** p;
char** v;
int i;
int forked = 0;
static char** last; /* last free slot (0) */
char* key = (char*)akey;
- register char** v = environ;
- register char** p = envv;
- register char* s;
- register char* t;
+ char** v = environ;
+ char** p = envv;
+ char* s;
+ char* t;
int n;
if (p && !v)
putsymlink __PARAM__((const char* buf, const char* name), (buf, name)) __OTORP__(const char* buf; const char* name;)
#line 16
{
- register char* t = (char*)buf;
+ char* t = (char*)buf;
#ifdef UNIV_MAX
- register char* s = (char*)buf;
- register char* v;
+ char* s = (char*)buf;
+ char* v;
int n;
char tmp[PATH_MAX];
#line 26
va_list ap;
- register int n;
- register int c;
+ int n;
+ int c;
static Sfio_t* rfp;
static Sfio_t* wfp;
*/
int
-setcwd __PARAM__((register char* path, char* home), (path, home)) __OTORP__(register char* path; char* home;)
+setcwd __PARAM__((char* path, char* home), (path, home)) __OTORP__(char* path; char* home;)
#line 48
{
- register char* s;
- register int n;
+ char* s;
+ int n;
int r;
r = 0;
static char** last; /* last free slot (0) */
char* key = (char*)akey;
- register char** v = environ;
- register char** p = envv;
- register char* s;
- register char* t;
+ char** v = environ;
+ char** p = envv;
+ char* s;
+ char* t;
int n;
if (p && !v)
static char ok[] = ""; /* delete/optimization ok return*/
char* key = (char*)akey;
- register char** v = environ;
- register char** p = envv;
- register char* s;
- register char* t;
+ char** v = environ;
+ char** p = envv;
+ char* s;
+ char* t;
int n;
if (p && !v)
return(-1);
#else
#if defined(ATT_UNIV) || defined(U_GET)
- register int n;
+ int n;
for (n = 0; n < UNIV_MAX; n++)
if (streq(buf, univ_name[n]))
int
sigcritical __PARAM__((int op), (op)) __OTORP__(int op;){
- register int i;
+ int i;
static int level;
#if _lib_sigprocmask
static sigset_t mask;
*/
STACK
-stackalloc __PARAM__((register int size, __V_* error), (size, error)) __OTORP__(register int size; __V_* error;){
- register STACK stack;
- register struct stackblock *b;
+stackalloc __PARAM__((int size, __V_* error), (size, error)) __OTORP__(int size; __V_* error;){
+ STACK stack;
+ struct stackblock *b;
if (size <= 0) size = 100;
if (!(stack = newof(0, struct stacktable, 1, 0))) return(0);
*/
void
-stackfree __PARAM__((register STACK stack), (stack)) __OTORP__(register STACK stack;){
- register struct stackblock* b;
- register struct stackblock* p;
+stackfree __PARAM__((STACK stack), (stack)) __OTORP__(STACK stack;){
+ struct stackblock* b;
+ struct stackblock* p;
b = stack->blocks;
while (p = b)
*/
void
-stackclear __PARAM__((register STACK stack), (stack)) __OTORP__(register STACK stack;){
+stackclear __PARAM__((STACK stack), (stack)) __OTORP__(STACK stack;){
stack->position.block = stack->blocks;
stack->position.index = -1;
}
*/
__V_*
-stackget __PARAM__((register STACK stack), (stack)) __OTORP__(register STACK stack;){
+stackget __PARAM__((STACK stack), (stack)) __OTORP__(STACK stack;){
if (stack->position.index < 0) return(stack->error);
else return(stack->position.block->stack[stack->position.index]);
}
*/
int
-stackpush __PARAM__((register STACK stack, __V_* value), (stack, value)) __OTORP__(register STACK stack; __V_* value;){
- register struct stackblock *b;
+stackpush __PARAM__((STACK stack, __V_* value), (stack, value)) __OTORP__(STACK stack; __V_* value;){
+ struct stackblock *b;
if (++stack->position.index >= stack->size)
{
*/
int
-stackpop __PARAM__((register STACK stack), (stack)) __OTORP__(register STACK stack;){
+stackpop __PARAM__((STACK stack), (stack)) __OTORP__(STACK stack;){
/*
* return:
*
*/
void
-stacktell __PARAM__((register STACK stack, int set, STACKPOS* position), (stack, set, position)) __OTORP__(register STACK stack; int set; STACKPOS* position;){
+stacktell __PARAM__((STACK stack, int set, STACKPOS* position), (stack, set, position)) __OTORP__(STACK stack; int set; STACKPOS* position;){
if (set) stack->position = *position;
else *position = stack->position;
}
static void stakinit __PARAM__((int size), (size)) __OTORP__(int size;)
#line 109
{
- register Sfile_t *sp;
+ Sfile_t *sp;
init = size;
sp = stakcreate(0);
init = 1;
Sfile_t *stakcreate __PARAM__((int flags), (flags)) __OTORP__(int flags;)
#line 148
{
- register int bsize;
- register Sfile_t *stream;
- register struct stak *sp;
- register struct frame *fp;
- register Sfdisc_t *dp;
- register char *cp;
+ int bsize;
+ Sfile_t *stream;
+ struct stak *sp;
+ struct frame *fp;
+ Sfdisc_t *dp;
+ char *cp;
if(!(stream=newof((char*)0,Sfile_t, 1, sizeof(*dp)+sizeof(*sp))))
return(0);
increment(create);
#line 195
{
Sfile_t *old;
- register struct stak *sp;
+ struct stak *sp;
if(!init)
{
stakinit(1);
/*
* increase the reference count on the given <stack>
*/
-int staklink __PARAM__((register Sfile_t* stream), (stream)) __OTORP__(register Sfile_t* stream;)
+int staklink __PARAM__((Sfile_t* stream), (stream)) __OTORP__(Sfile_t* stream;)
#line 229
{
- register struct stak *sp = stream2stak(stream);
+ struct stak *sp = stream2stak(stream);
return(sp->stakref++);
}
int stakdelete __PARAM__((Sfile_t* stream), (stream)) __OTORP__(Sfile_t* stream;)
#line 238
{
- register struct stak *sp = stream2stak(stream);
- register char *cp = sp->stakbase;
- register struct frame *fp;
+ struct stak *sp = stream2stak(stream);
+ char *cp = sp->stakbase;
+ struct frame *fp;
if(--sp->stakref>0)
return(1);
increment(delete);
* otherwise, the top of the stack is set to stakbot+<offset>
*
*/
-char *stakset __PARAM__((register char* loc, unsigned offset), (loc, offset)) __OTORP__(register char* loc; unsigned offset;)
+char *stakset __PARAM__((char* loc, unsigned offset), (loc, offset)) __OTORP__(char* loc; unsigned offset;)
#line 271
{
- register struct stak *sp=stakcur;
- register char *cp;
- register struct frame *fp;
- register int frames = 0;
+ struct stak *sp=stakcur;
+ char *cp;
+ struct frame *fp;
+ int frames = 0;
if(!init)
stakinit(offset+1);
increment(set);
/*
* allocate <n> bytes on the current stack
*/
-char *stakalloc __PARAM__((register unsigned int n), (n)) __OTORP__(register unsigned int n;)
+char *stakalloc __PARAM__((unsigned int n), (n)) __OTORP__(unsigned int n;)
#line 316
{
- register unsigned char *old;
+ unsigned char *old;
if(!init)
stakinit(n);
increment(alloc);
/*
* begin a new stack word of at least <n> bytes
*/
-char *_stakseek __PARAM__((register unsigned n), (n)) __OTORP__(register unsigned n;)
+char *_stakseek __PARAM__((unsigned n), (n)) __OTORP__(unsigned n;)
#line 333
{
if(!init)
* advance the stack to the current top
* if extra is non-zero, first add a extra bytes and zero the first
*/
-char *stakfreeze __PARAM__((register unsigned extra), (extra)) __OTORP__(register unsigned extra;)
+char *stakfreeze __PARAM__((unsigned extra), (extra)) __OTORP__(unsigned extra;)
#line 348
{
- register unsigned char *old, *top;
+ unsigned char *old, *top;
if(!init)
stakinit(extra);
old = staksp->data;
char *stakcopy __PARAM__((const char* str), (str)) __OTORP__(const char* str;)
#line 372
{
- register unsigned char *cp = (unsigned char*)str;
- register int n;
+ unsigned char *cp = (unsigned char*)str;
+ int n;
while(*cp++);
n = roundof(cp-(unsigned char*)str,sizeof(char*));
if(!init)
static char *stakgrow __PARAM__((unsigned size), (size)) __OTORP__(unsigned size;)
#line 395
{
- register int n = size;
- register struct stak *sp = stakcur;
- register struct frame *fp;
- register char *cp;
- register unsigned m = staktell();
- register int reused = 0;
+ int n = size;
+ struct stak *sp = stakcur;
+ struct frame *fp;
+ char *cp;
+ unsigned m = staktell();
+ int reused = 0;
n += (m + sizeof(struct frame)+1);
if(sp->stakflags&STAK_SMALL)
#ifndef USE_REALLOC
* initialize stkstd, sfio operations may have already occcured
*/
static void stkinit __PARAM__((int size), (size)) __OTORP__(int size;){
- register Sfio_t *sp;
+ Sfio_t *sp;
init = size;
sp = stkopen(0);
init = 1;
stkinstall(sp,overflow);
}
-static int stkexcept __PARAM__((register Sfio_t *stream, int type, Sfdisc_t* dp), (stream, type, dp)) __OTORP__(register Sfio_t *stream; int type; Sfdisc_t* dp;){
+static int stkexcept __PARAM__((Sfio_t *stream, int type, Sfdisc_t* dp), (stream, type, dp)) __OTORP__(Sfio_t *stream; int type; Sfdisc_t* dp;){
NoP(dp);
switch(type)
{
* create a stack
*/
Sfio_t *stkopen __PARAM__((int flags), (flags)) __OTORP__(int flags;){
- register int bsize;
- register Sfio_t *stream;
- register struct stk *sp;
- register struct frame *fp;
- register Sfdisc_t *dp;
- register char *cp;
+ int bsize;
+ Sfio_t *stream;
+ struct stk *sp;
+ struct frame *fp;
+ Sfdisc_t *dp;
+ char *cp;
if(!(stream=newof((char*)0,Sfio_t, 1, sizeof(*dp)+sizeof(*sp))))
return(0);
increment(create);
*/
Sfio_t *stkinstall __PARAM__((Sfio_t *stream, _stk_overflow_ oflow), (stream, oflow)) __OTORP__(Sfio_t *stream; _stk_overflow_ oflow;){
Sfio_t *old;
- register struct stk *sp;
+ struct stk *sp;
if(!init)
{
stkinit(1);
/*
* increase the reference count on the given <stack>
*/
-int stklink __PARAM__((register Sfio_t* stream), (stream)) __OTORP__(register Sfio_t* stream;){
- register struct stk *sp = stream2stk(stream);
+int stklink __PARAM__((Sfio_t* stream), (stream)) __OTORP__(Sfio_t* stream;){
+ struct stk *sp = stream2stk(stream);
return(sp->stkref++);
}
* terminate a stack and free up the space
*/
int stkclose __PARAM__((Sfio_t* stream), (stream)) __OTORP__(Sfio_t* stream;){
- register struct stk *sp = stream2stk(stream);
- register char *cp = sp->stkbase;
- register struct frame *fp;
+ struct stk *sp = stream2stk(stream);
+ char *cp = sp->stkbase;
+ struct frame *fp;
if(--sp->stkref>0)
return(1);
increment(delete);
* otherwise, the top of the stack is set to stkbot+<offset>
*
*/
-char *stkset __PARAM__((register Sfio_t * stream, register char* loc, unsigned offset), (stream, loc, offset)) __OTORP__(register Sfio_t * stream; register char* loc; unsigned offset;){
- register struct stk *sp = stream2stk(stream);
- register char *cp;
- register struct frame *fp;
- register int frames = 0;
+char *stkset __PARAM__((Sfio_t * stream, char* loc, unsigned offset), (stream, loc, offset)) __OTORP__(Sfio_t * stream; char* loc; unsigned offset;){
+ struct stk *sp = stream2stk(stream);
+ char *cp;
+ struct frame *fp;
+ int frames = 0;
if(!init)
stkinit(offset+1);
increment(set);
/*
* allocate <n> bytes on the current stack
*/
-char *stkalloc __PARAM__((register Sfio_t *stream, register unsigned int n), (stream, n)) __OTORP__(register Sfio_t *stream; register unsigned int n;){
- register unsigned char *old;
+char *stkalloc __PARAM__((Sfio_t *stream, unsigned int n), (stream, n)) __OTORP__(Sfio_t *stream; unsigned int n;){
+ unsigned char *old;
if(!init)
stkinit(n);
increment(alloc);
/*
* begin a new stack word of at least <n> bytes
*/
-char *_stkseek __PARAM__((register Sfio_t *stream, register unsigned n), (stream, n)) __OTORP__(register Sfio_t *stream; register unsigned n;){
+char *_stkseek __PARAM__((Sfio_t *stream, unsigned n), (stream, n)) __OTORP__(Sfio_t *stream; unsigned n;){
if(!init)
stkinit(n);
increment(seek);
* advance the stack to the current top
* if extra is non-zero, first add a extra bytes and zero the first
*/
-char *stkfreeze __PARAM__((register Sfio_t *stream, register unsigned extra), (stream, extra)) __OTORP__(register Sfio_t *stream; register unsigned extra;){
- register unsigned char *old, *top;
+char *stkfreeze __PARAM__((Sfio_t *stream, unsigned extra), (stream, extra)) __OTORP__(Sfio_t *stream; unsigned extra;){
+ unsigned char *old, *top;
if(!init)
stkinit(extra);
old = stream->data;
* copy string <str> onto the stack as a new stack word
*/
char *stkcopy __PARAM__((Sfio_t *stream, const char* str), (stream, str)) __OTORP__(Sfio_t *stream; const char* str;){
- register unsigned char *cp = (unsigned char*)str;
- register int n;
+ unsigned char *cp = (unsigned char*)str;
+ int n;
while(*cp++);
n = roundof(cp-(unsigned char*)str,sizeof(char*));
if(!init)
* to the end is copied into the new stack frame
*/
-static char *stkgrow __PARAM__((register Sfio_t *stream, unsigned size), (stream, size)) __OTORP__(register Sfio_t *stream; unsigned size;){
- register int n = size;
- register struct stk *sp = stream2stk(stream);
- register struct frame *fp;
- register char *cp;
- register unsigned m = stktell(stream);
- register int reused = 0;
+static char *stkgrow __PARAM__((Sfio_t *stream, unsigned size), (stream, size)) __OTORP__(Sfio_t *stream; unsigned size;){
+ int n = size;
+ struct stk *sp = stream2stk(stream);
+ struct frame *fp;
+ char *cp;
+ unsigned m = stktell(stream);
+ int reused = 0;
n += (m + sizeof(struct frame)+1);
if(sp->stkflags&STK_SMALL)
#ifndef USE_REALLOC
void
systrace __PARAM__((const char* id), (id)) __OTORP__(const char* id;){
- register int n;
- register char* out;
+ int n;
+ char* out;
char* s;
char buf[PATH_MAX];
char* av[7];
*/
char*
-fgetline __PARAM__((register FILE* fp, int op), (fp, op)) __OTORP__(register FILE* fp; int op;)
+fgetline __PARAM__((FILE* fp, int op), (fp, op)) __OTORP__(FILE* fp; int op;)
#line 29
{
- register int c;
- register char* s;
- register char* end;
+ int c;
+ char* s;
+ char* end;
static char* buf;
static int siz;
#include <ast.h>
void
-getwinsize __PARAM__((int fd, register int* rows, register int* cols), (fd, rows, cols)) __OTORP__(int fd; register int* rows; register int* cols;){
+getwinsize __PARAM__((int fd, int* rows, int* cols), (fd, rows, cols)) __OTORP__(int fd; int* rows; int* cols;){
astwinsize(fd, rows, cols);
}
query __PARAM__((int quit, const char* format, ...), (va_alist)) __OTORP__(va_dcl)
{ __OTORP__(int quit; const char* format; )
va_list ap;
- register int n;
- register int c;
+ int n;
+ int c;
static Sfio_t* rfp;
static Sfio_t* wfp;
#include <ast.h>
__V_*
-tablook __PARAM__((const __V_* tab, int siz, register const char* name), (tab, siz, name)) __OTORP__(const __V_* tab; int siz; register const char* name;){
+tablook __PARAM__((const __V_* tab, int siz, const char* name), (tab, siz, name)) __OTORP__(const __V_* tab; int siz; const char* name;){
return(strlook(tab, siz, name));
}
#include <ls.h>
char*
-pathaccess __PARAM__((register char* path, register const char* dirs, const char* a, const char* b, register int mode), (path, dirs, a, b, mode)) __OTORP__(register char* path; register const char* dirs; const char* a; const char* b; register int mode;){
- register int m = 0;
+pathaccess __PARAM__((char* path, const char* dirs, const char* a, const char* b, int mode), (path, dirs, a, b, mode)) __OTORP__(char* path; const char* dirs; const char* a; const char* b; int mode;){
+ int m = 0;
int sep = ':';
char cwd[PATH_MAX];
struct stat st;
char*
pathbin __PARAM__((void), ()){
- register char* bin;
+ char* bin;
static char* val;
char*
pathcanon __PARAM__((char* path, int flags), (path, flags)) __OTORP__(char* path; int flags;){
- register char* p;
- register char* r;
- register char* s;
- register char* t;
- register int dots;
+ char* p;
+ char* r;
+ char* s;
+ char* t;
+ int dots;
int loop;
int oerrno;
#if defined(FS_3D)
#include <ast.h>
char*
-pathcat __PARAM__((char* path, register const char* dirs, int sep, const char* a, register const char* b), (path, dirs, sep, a, b)) __OTORP__(char* path; register const char* dirs; int sep; const char* a; register const char* b;){
- register char* s;
+pathcat __PARAM__((char* path, const char* dirs, int sep, const char* a, const char* b), (path, dirs, sep, a, b)) __OTORP__(char* path; const char* dirs; int sep; const char* a; const char* b;){
+ char* s;
s = path;
while (*dirs && *dirs != sep) *s++ = *dirs++;
int
pathcd __PARAM__((const char* path, const char* home), (path, home)) __OTORP__(const char* path; const char* home;){
- register char* p = (char*)path;
- register char* s;
- register int n;
+ char* p = (char*)path;
+ char* s;
+ int n;
int i;
int r;
int
pathcheck __PARAM__((const char* package, const char* tool, Pathcheck_t* pc), (package, tool, pc)) __OTORP__(const char* package; const char* tool; Pathcheck_t* pc;){
#ifdef PARANOID
- register char* s;
+ char* s;
struct stat st;
if (strmatch(tool, PARANOID) && environ && (s = *environ) && *s++ == '_' && *s++ == '=' && !stat(s, &st))
#ifdef UNIV_MAX
if (isspace(*buf))
{
- register char* s;
- register char* t;
- register char* u;
- register char* v;
+ char* s;
+ char* t;
+ char* u;
+ char* v;
int match = 0;
char tmp[PATH_MAX];
char*
pathkey __PARAM__((char* key, char* attr, const char* lang, const char* apath), (key, attr, lang, apath)) __OTORP__(char* key; char* attr; const char* lang; const char* apath;){
- register char* path = (char*)apath;
- register char* s;
- register char* k;
+ char* path = (char*)apath;
+ char* s;
+ char* k;
char* t;
char* flags;
char** p;
#include <option.h>
char*
-pathpath __PARAM__((register char* path, const char* p, const char* a, int mode), (path, p, a, mode)) __OTORP__(register char* path; const char* p; const char* a; int mode;){
- register char* s;
+pathpath __PARAM__((char* path, const char* p, const char* a, int mode), (path, p, a, mode)) __OTORP__(char* path; const char* p; const char* a; int mode;){
+ char* s;
char* x;
static char* cmd;
char*
pathprobe __PARAM__((char* path, char* attr, const char* lang, const char* tool, const char* aproc, int op), (path, attr, lang, tool, aproc, op)) __OTORP__(char* path; char* attr; const char* lang; const char* tool; const char* aproc; int op;){
char* proc = (char*)aproc;
- register char* p;
- register char* k;
- register char** ap;
+ char* p;
+ char* k;
+ char** ap;
int n;
char* e;
char* probe;
#include <ast.h>
char*
-pathrepl __PARAM__((register char* path, const char* match, register const char* replace), (path, match, replace)) __OTORP__(register char* path; const char* match; register const char* replace;){
- register const char* m = match;
- register const char* r;
+pathrepl __PARAM__((char* path, const char* match, const char* replace), (path, match, replace)) __OTORP__(char* path; const char* match; const char* replace;){
+ const char* m = match;
+ const char* r;
char* t;
if (!match) match = "";
while (*m && *m++ == *path) path++;
if (!*m && *path == '/')
{
- register char* p;
+ char* p;
p = t;
r = replace;
if (p < path) while (*p++ = *path++);
else if (*r && p >= path)
{
- register char* u;
+ char* u;
t = path + strlen(path);
u = t + strlen(r);
int
pathsetlink __PARAM__((const char* buf, const char* name), (buf, name)) __OTORP__(const char* buf; const char* name;){
- register char* t = (char*)buf;
+ char* t = (char*)buf;
#ifdef UNIV_MAX
- register char* s = (char*)buf;
- register char* v;
+ char* s = (char*)buf;
+ char* v;
int n;
char tmp[PATH_MAX];
char*
pathshell __PARAM__((void), ()){
- register char* s;
- register char* sh;
- register int i;
+ char* s;
+ char* sh;
+ int i;
static char* val;
char*
pathtemp __PARAM__((char* buf, const char* dir, const char* pfx), (buf, dir, pfx)) __OTORP__(char* buf; const char* dir; const char* pfx;){
- register char* d = (char*)dir;
+ char* d = (char*)dir;
char* p = (char*)pfx;
- register char* b;
- register char* s;
+ char* b;
+ char* s;
unsigned long loop;
static char* tmpdir;
*/
static char*
-synthesize __PARAM__((register Feature_t* fp, const char* path, const char* value), (fp, path, value)) __OTORP__(register Feature_t* fp; const char* path; const char* value;){
- register char* s;
- register char* d;
- register char* v;
- register int n;
+synthesize __PARAM__((Feature_t* fp, const char* path, const char* value), (fp, path, value)) __OTORP__(Feature_t* fp; const char* path; const char* value;){
+ char* s;
+ char* d;
+ char* v;
+ int n;
static char* data;
static char* last;
*/
static void
-initialize __PARAM__((register Feature_t* fp, const char* path, const char* command, const char* succeed, const char* fail), (fp, path, command, succeed, fail)) __OTORP__(register Feature_t* fp; const char* path; const char* command; const char* succeed; const char* fail;){
- register char* p;
- register int ok = 1;
+initialize __PARAM__((Feature_t* fp, const char* path, const char* command, const char* succeed, const char* fail), (fp, path, command, succeed, fail)) __OTORP__(Feature_t* fp; const char* path; const char* command; const char* succeed; const char* fail;){
+ char* p;
+ int ok = 1;
if (fp->op != OP_path_resolve || !fs3d(FS3D_TEST))
{
if (p = getenv("PATH"))
{
- register int r = 1;
- register char* d = p;
+ int r = 1;
+ char* d = p;
int offset = stktell(stkstd);
for (;;)
static char*
feature __PARAM__((const char* name, const char* path, const char* value), (name, path, value)) __OTORP__(const char* name; const char* path; const char* value;){
- register Feature_t* fp;
- register int n;
+ Feature_t* fp;
+ int n;
if (value)
{
*/
static int
-lookup __PARAM__((register Lookup_t* look, const char* name), (look, name)) __OTORP__(register Lookup_t* look; const char* name;){
- register Conf_t* mid = (Conf_t*)conf;
- register Conf_t* lo = mid;
- register Conf_t* hi = mid + conf_elements;
- register int v;
- register int c;
+lookup __PARAM__((Lookup_t* look, const char* name), (look, name)) __OTORP__(Lookup_t* look; const char* name;){
+ Conf_t* mid = (Conf_t*)conf;
+ Conf_t* lo = mid;
+ Conf_t* hi = mid + conf_elements;
+ int v;
+ int c;
const char* oldname = name;
const Prefix_t* p;
*/
static char*
-print __PARAM__((Sfio_t* sp, register Lookup_t* look, const char* name, const char* path), (sp, look, name, path)) __OTORP__(Sfio_t* sp; register Lookup_t* look; const char* name; const char* path;){
- register Conf_t* p = look->conf;
- register int flags = look->flags|CONF_DEFINED;
+print __PARAM__((Sfio_t* sp, Lookup_t* look, const char* name, const char* path), (sp, look, name, path)) __OTORP__(Sfio_t* sp; Lookup_t* look; const char* name; const char* path;){
+ Conf_t* p = look->conf;
+ int flags = look->flags|CONF_DEFINED;
char* call;
int offset;
long v;
char*
astconf __PARAM__((const char* name, const char* path, const char* value), (name, path, value)) __OTORP__(const char* name; const char* path; const char* value;){
- register char* s;
+ char* s;
Lookup_t look;
if (!path)
off_t
astcopy __PARAM__((int rfd, int wfd, off_t n), (rfd, wfd, n)) __OTORP__(int rfd; int wfd; off_t n;){
- register off_t c;
+ off_t c;
#ifdef MAPSIZE
off_t pos;
off_t mapsize;
astquery __PARAM__((int quit, const char* format, ...), (va_alist)) __OTORP__(va_dcl)
{ __OTORP__(int quit; const char* format; )
va_list ap;
- register int n;
- register int c;
+ int n;
+ int c;
static Sfio_t* rfp;
static Sfio_t* wfp;
static int ttctl __PROTO__((int, int, __V_*));
void
-astwinsize __PARAM__((int fd, register int* rows, register int* cols), (fd, rows, cols)) __OTORP__(int fd; register int* rows; register int* cols;){
+astwinsize __PARAM__((int fd, int* rows, int* cols), (fd, rows, cols)) __OTORP__(int fd; int* rows; int* cols;){
#ifdef TIOCGWINSZ
#define NEED_ttctl
struct winsize ws;
*/
static int
-ttctl __PARAM__((register int fd, int op, __V_* tt), (fd, op, tt)) __OTORP__(register int fd; int op; __V_* tt;){
- register int v;
+ttctl __PARAM__((int fd, int op, __V_* tt), (fd, op, tt)) __OTORP__(int fd; int op; __V_* tt;){
+ int v;
if (fd < 0)
{
fdcopy __PARAM__((int rfd, int wfd, off_t n), (rfd, wfd, n)) __OTORP__(int rfd; int wfd; off_t n;)
#line 55
{
- register off_t c;
+ off_t c;
#ifdef MAPSIZE
off_t pos;
off_t mapsize;
static int ttctl __PROTO__((int, int, __V_*));
void
-getwinsize __PARAM__((int fd, register int* rows, register int* cols), (fd, rows, cols)) __OTORP__(int fd; register int* rows; register int* cols;)
+getwinsize __PARAM__((int fd, int* rows, int* cols), (fd, rows, cols)) __OTORP__(int fd; int* rows; int* cols;)
#line 48
{
#ifdef TIOCGSIZE
*/
static int
-ttctl __PARAM__((register int fd, int op, __V_* tt), (fd, op, tt)) __OTORP__(register int fd; int op; __V_* tt;)
+ttctl __PARAM__((int fd, int op, __V_* tt), (fd, op, tt)) __OTORP__(int fd; int op; __V_* tt;)
#line 100
{
- register int v;
+ int v;
if (fd < 0)
{
char*
getpreroot __PARAM__((char* path, const char* cmd), (path, cmd)) __OTORP__(char* path; const char* cmd;){
- register int c;
- register FILE* fp;
- register char* p;
+ int c;
+ FILE* fp;
+ char* p;
char buf[PATH_MAX];
if (!path) path = buf;
#include <option.h>
void
-setpreroot __PARAM__((register char** argv, const char* dir), (argv, dir)) __OTORP__(register char** argv; const char* dir;){
- register char* s;
- register char** ap;
+setpreroot __PARAM__((char** argv, const char* dir), (argv, dir)) __OTORP__(char** argv; const char* dir;){
+ char* s;
+ char** ap;
int argc;
char* cmd;
char** av;
}
static void
-reerr2 __PARAM__((register char* s, int c), (s, c)) __OTORP__(register char* s; int c;){
+reerr2 __PARAM__((char* s, int c), (s, c)) __OTORP__(char* s; int c;){
char buf[100];
s = strcopy(buf, s);
static Node_t*
popand __PARAM__((int op), (op)) __OTORP__(int op;){
- register Inst_t* inst;
+ Inst_t* inst;
if (re->andp <= &re->andstack[0])
{
}
static void
-evaluntil __PARAM__((register int pri), (pri)) __OTORP__(register int pri;){
- register Node_t* op1;
- register Node_t* op2;
- register Inst_t* inst1;
- register Inst_t* inst2;
+evaluntil __PARAM__((int pri), (pri)) __OTORP__(int pri;){
+ Node_t* op1;
+ Node_t* op2;
+ Inst_t* inst1;
+ Inst_t* inst2;
while (pri == RBRA || re->atorp[-1] >= pri)
{
}
static void
-operation __PARAM__((register int t), (t)) __OTORP__(register int t;){
- register int thisisand = 0;
+operation __PARAM__((int t), (t)) __OTORP__(int t;){
+ int thisisand = 0;
switch (t)
{
static void
operand __PARAM__((int t), (t)) __OTORP__(int t;){
- register Inst_t* i;
+ Inst_t* i;
/*
* catenate is implicit
static void
optimize __PARAM__((Re_program_t* pp), (pp)) __OTORP__(Re_program_t* pp;){
- register Inst_t* inst;
- register Inst_t* target;
+ Inst_t* inst;
+ Inst_t* target;
for (inst = pp->firstinst; inst->type != END; inst++)
{
static int
nextc __PARAM__((void), ()){
- register int c;
+ int c;
switch (c = *re->exprp++)
{
static void
bldcclass __PARAM__((void), ()){
- register int c1;
- register int c2;
- register char* map;
- register int negate;
+ int c1;
+ int c2;
+ char* map;
+ int negate;
if (re->nclass >= NCLASS) reerr2("too many character classes -- limit ", NCLASS + '0');
map = re->classp[re->nclass++].map;
static int
lex __PARAM__((void), ()){
- register int c;
+ int c;
switch(c = *re->exprp++)
{
reprogram*
recomp __PARAM__((const char* s, int reflags), (s, reflags)) __OTORP__(const char* s; int reflags;){
- register int token;
+ int token;
Re_program_t* pp;
State_t restate;
*/
static List_t*
-newthread __PARAM__((register List_t* p, register Inst_t* ip, register Subexp_t* sep), (p, ip, sep)) __OTORP__(register List_t* p; register Inst_t* ip; register Subexp_t* sep;){
+newthread __PARAM__((List_t* p, Inst_t* ip, Subexp_t* sep), (p, ip, sep)) __OTORP__(List_t* p; Inst_t* ip; Subexp_t* sep;){
for (; p->inst; p++)
if (p->inst == ip)
{
}
static void
-newmatch __PARAM__((register Subexp_t* mp, register Subexp_t* np), (mp, np)) __OTORP__(register Subexp_t* mp; register Subexp_t* np;){
+newmatch __PARAM__((Subexp_t* mp, Subexp_t* np), (mp, np)) __OTORP__(Subexp_t* mp; Subexp_t* np;){
if (!mp->m[0].sp || np->m[0].sp < mp->m[0].sp || np->m[0].sp == mp->m[0].sp && np->m[0].ep > mp->m[0].ep)
*mp = *np;
}
int
reexec __PARAM__((Re_program_t* aprogp, const char* starts), (aprogp, starts)) __OTORP__(Re_program_t* aprogp; const char* starts;){
Re_program_t* progp = (Re_program_t*)aprogp;
- register int flag = 0;
- register Inst_t* inst;
- register List_t* tlp;
- register const char* s;
+ int flag = 0;
+ Inst_t* inst;
+ List_t* tlp;
+ const char* s;
Subexp_t* mp;
int checkstart;
int startchar;
*/
static void
-sub __PARAM__((register Sfio_t* dp, register const char* sp, register Match_t* mp, register int flags), (dp, sp, mp, flags)) __OTORP__(register Sfio_t* dp; register const char* sp; register Match_t* mp; register int flags;){
- register int c;
+sub __PARAM__((Sfio_t* dp, const char* sp, Match_t* mp, int flags), (dp, sp, mp, flags)) __OTORP__(Sfio_t* dp; const char* sp; Match_t* mp; int flags;){
+ int c;
char* s;
char* e;
*/
void
-ressub __PARAM__((Re_program_t* re, Sfio_t* dp, register const char* op, const char* sp, int flags), (re, dp, op, sp, flags)) __OTORP__(Re_program_t* re; Sfio_t* dp; register const char* op; const char* sp; int flags;){
- register Match_t* mp;
+ressub __PARAM__((Re_program_t* re, Sfio_t* dp, const char* op, const char* sp, int flags), (re, dp, op, sp, flags)) __OTORP__(Re_program_t* re; Sfio_t* dp; const char* op; const char* sp; int flags;){
+ Match_t* mp;
mp = re->subexp.m;
do
*/
static char*
-sub __PARAM__((register const char* sp, register char* dp, register Match_t* mp, int flags), (sp, dp, mp, flags)) __OTORP__(register const char* sp; register char* dp; register Match_t* mp; int flags;){
- register int i;
+sub __PARAM__((const char* sp, char* dp, Match_t* mp, int flags), (sp, dp, mp, flags)) __OTORP__(const char* sp; char* dp; Match_t* mp; int flags;){
+ int i;
char* s;
NoP(flags);
*/
char*
-resub __PARAM__((Re_program_t* re, register const char* op, const char* sp, register char* dp, int flags), (re, op, sp, dp, flags)) __OTORP__(Re_program_t* re; register const char* op; const char* sp; register char* dp; int flags;){
- register Match_t* mp;
+resub __PARAM__((Re_program_t* re, const char* op, const char* sp, char* dp, int flags), (re, op, sp, dp, flags)) __OTORP__(Re_program_t* re; const char* op; const char* sp; char* dp; int flags;){
+ Match_t* mp;
mp = re->subexp.m;
do
f->disc = NIL(Sfdisc_t*);
}
- /* tell the register function */
+ /* tell the function */
if(_Sfnotify)
(*_Sfnotify)(f,SF_CLOSE,f->file);
#define uchar unsigned char
#define ulong unsigned long
#define uint unsigned int
-#define reg register
-#define REG register
+#define reg /*NO register keyword*/
+#define REG reg
#define SECOND 1000 /* millisecond units */
_stdvsprintf(char *s, const char *form, va_list args)
#else
_stdvsprintf(s,form,args)
-register char *s;
-register char *form;
+char *s;
+char *form;
va_list args;
#endif
{
_stdvsscanf(char *s, const char *form, va_list args)
#else
_stdvsscanf(s,form,args)
-register char *s;
-register char *form;
+char *s;
+char *form;
va_list args;
#endif
{
#include <ast.h>
int
-chresc __PARAM__((register const char* s, char** p), (s, p)) __OTORP__(register const char* s; char** p;){
- register const char* q;
- register int c;
+chresc __PARAM__((const char* s, char** p), (s, p)) __OTORP__(const char* s; char** p;){
+ const char* q;
+ int c;
switch (c = *s++)
{
#include <ast.h>
int
-chrtoi __PARAM__((register const char* s), (s)) __OTORP__(register const char* s;){
- register int c;
- register int n;
- register int x;
+chrtoi __PARAM__((const char* s), (s)) __OTORP__(const char* s;){
+ int c;
+ int n;
+ int x;
char* p;
c = 0;
#include <ast.h>
char*
-fmtbase __PARAM__((register long n, register int b, int p), (n, b, p)) __OTORP__(register long n; register int b; int p;){
+fmtbase __PARAM__((long n, int b, int p), (n, b, p)) __OTORP__(long n; int b; int p;){
static char buf[36];
if (n == 0 || b == 0) sfsprintf(buf, sizeof(buf), "%ld", n);
#include <ast.h>
char*
-fmtelapsed __PARAM__((register unsigned long t, register int n), (t, n)) __OTORP__(register unsigned long t; register int n;){
- register unsigned long s;
+fmtelapsed __PARAM__((unsigned long t, int n), (t, n)) __OTORP__(unsigned long t; int n;){
+ unsigned long s;
static int amt[] = { 1, 60, 60, 24, 7, 4, 12, 20 };
static char chr[] = "smhdwMYS";
char*
fmtesc __PARAM__((const char* as), (as)) __OTORP__(const char* as;){
- register unsigned char* s = (unsigned char*)as;
- register char* b;
- register int c;
+ unsigned char* s = (unsigned char*)as;
+ char* b;
+ int c;
static char* buf;
static int bufsiz;
static struct mntent*
getmntent __PARAM__((FILE* mp), (mp)) __OTORP__(FILE* mp;){
- register int c;
- register char* s;
- register char* m;
- register int q;
+ int c;
+ char* s;
+ char* m;
+ int q;
static struct mntent e;
q = 0;
char*
fmtfs __PARAM__((struct stat* st), (st)) __OTORP__(struct stat* st;){
- register FILE* mp;
- register struct mntent* mnt;
- register char* s;
+ FILE* mp;
+ struct mntent* mnt;
+ char* s;
struct stat rt;
static Hash_table_t* tab;
char*
fmtgid __PARAM__((int gid), (gid)) __OTORP__(int gid;){
- register char* name;
- register struct group* gr;
+ char* name;
+ struct group* gr;
static Hash_table_t* gidtab;
static char buf[sizeof(int) * 3 + 1];
*/
char*
-fmtls __PARAM__((char* buf, const char* name, register struct stat* st, const char* info, const char* link, register int flags), (buf, name, st, info, link, flags)) __OTORP__(char* buf; const char* name; register struct stat* st; const char* info; const char* link; register int flags;){
- register char* s;
+fmtls __PARAM__((char* buf, const char* name, struct stat* st, const char* info, const char* link, int flags), (buf, name, st, info, link, flags)) __OTORP__(char* buf; const char* name; struct stat* st; const char* info; const char* link; int flags;){
+ char* s;
time_t tm;
s = buf;
char*
fmtmatch __PARAM__((const char* as), (as)) __OTORP__(const char* as;){
- register char* s = (char*)as;
- register int c;
- register char* t;
- register char** p;
- register char* b;
+ char* s = (char*)as;
+ int c;
+ char* t;
+ char** p;
+ char* b;
char* x;
char* y;
int a;
#include "modelib.h"
char*
-fmtmode __PARAM__((register int mode, int external), (mode, external)) __OTORP__(register int mode; int external;){
- register char* s;
- register struct modeop* p;
+fmtmode __PARAM__((int mode, int external), (mode, external)) __OTORP__(int mode; int external;){
+ char* s;
+ struct modeop* p;
static char buf[MODELEN + 1];
#include <ls.h>
char*
-fmtperm __PARAM__((register int perm), (perm)) __OTORP__(register int perm;){
- register char* s;
- register char* p;
+fmtperm __PARAM__((int perm), (perm)) __OTORP__(int perm;){
+ char* s;
+ char* p;
char* o;
int c;
char*
fmtre __PARAM__((const char* as), (as)) __OTORP__(const char* as;){
- register char* s = (char*)as;
- register int c;
- register char* t;
- register char* p;
+ char* s = (char*)as;
+ int c;
+ char* t;
+ char* p;
int n;
char stack[32];
#include <sig.h>
char*
-fmtsignal __PARAM__((register int sig), (sig)) __OTORP__(register int sig;){
+fmtsignal __PARAM__((int sig), (sig)) __OTORP__(int sig;){
static char buf[20];
if (sig >= 0)
char*
fmtuid __PARAM__((int uid), (uid)) __OTORP__(int uid;){
- register char* name;
- register struct passwd* pw;
+ char* name;
+ struct passwd* pw;
static Hash_table_t* uidtab;
static char buf[sizeof(int) * 3 + 1];
*/
void
-mematoe __PARAM__((__V_* aop, const __V_* aip, register size_t n), (aop, aip, n)) __OTORP__(__V_* aop; const __V_* aip; register size_t n;){
- register unsigned char* op = (unsigned char*)aop;
- register const unsigned char* ip = (const unsigned char*)aip;
+mematoe __PARAM__((__V_* aop, const __V_* aip, size_t n), (aop, aip, n)) __OTORP__(__V_* aop; const __V_* aip; size_t n;){
+ unsigned char* op = (unsigned char*)aop;
+ const unsigned char* ip = (const unsigned char*)aip;
while (n-- > 0) *op++ = atoe[*ip++];
}
*/
__V_*
-memdup __PARAM__((register const __V_* s, register size_t n), (s, n)) __OTORP__(register const __V_* s; register size_t n;){
- register __V_* t;
+memdup __PARAM__((const __V_* s, size_t n), (s, n)) __OTORP__(const __V_* s; size_t n;){
+ __V_* t;
return((t = (__V_*)newof(0, char, n, 0)) ? memcpy(t, s, n) : 0);
}
*/
void
-memetoa __PARAM__((__V_* aop, const __V_* aip, register size_t n), (aop, aip, n)) __OTORP__(__V_* aop; const __V_* aip; register size_t n;){
- register unsigned char* op = (unsigned char*)aop;
- register const unsigned char* ip = (const unsigned char*)aip;
+memetoa __PARAM__((__V_* aop, const __V_* aip, size_t n), (aop, aip, n)) __OTORP__(__V_* aop; const __V_* aip; size_t n;){
+ unsigned char* op = (unsigned char*)aop;
+ const unsigned char* ip = (const unsigned char*)aip;
while (n-- > 0) *op++ = etoa[*ip++];
}
#undef modei
int
-modei __PARAM__((register int x), (x)) __OTORP__(register int x;){
+modei __PARAM__((int x), (x)) __OTORP__(int x;){
#if _S_IDPERM
return(x & X_IPERM);
#else
- register int i;
- register int c;
+ int i;
+ int c;
i = 0;
for (c = 0; c < PERMLEN; c += 2)
#undef modex
int
-modex __PARAM__((register int i), (i)) __OTORP__(register int i;){
+modex __PARAM__((int i), (i)) __OTORP__(int i;){
#if _S_IDPERM && _S_IDTYPE
return(i);
#else
- register int x;
- register int c;
+ int x;
+ int c;
x = 0;
#if _S_IDPERM
*/
char*
-strcopy __PARAM__((register char* s, register const char* t), (s, t)) __OTORP__(register char* s; register const char* t;){
+strcopy __PARAM__((char* s, const char* t), (s, t)) __OTORP__(char* s; const char* t;){
if (!t) return(s);
while (*s++ = *t++);
return(--s);
*/
char*
-strdup __PARAM__((register const char* s), (s)) __OTORP__(register const char* s;){
- register char* t;
- register int n;
+strdup __PARAM__((const char* s), (s)) __OTORP__(const char* s;){
+ char* t;
+ int n;
return((t = newof(0, char, n = strlen(s) + 1, 0)) ? (char*)memcpy(t, s, n) : 0);
}
#include <ctype.h>
unsigned long
-strelapsed __PARAM__((register const char* s, char** e, int n), (s, e, n)) __OTORP__(register const char* s; char** e; int n;){
- register int c;
- register unsigned long v;
+strelapsed __PARAM__((const char* s, char** e, int n), (s, e, n)) __OTORP__(const char* s; char** e; int n;){
+ int c;
+ unsigned long v;
unsigned long t = 0;
int f = 0;
int m;
#include <ast.h>
int
-stresc __PARAM__((register char* s), (s)) __OTORP__(register char* s;){
- register char* t;
- register int c;
+stresc __PARAM__((char* s), (s)) __OTORP__(char* s;){
+ char* t;
+ int c;
char* b;
char* p;
*/
static long
-seterror __PARAM__((register Expr_t* ex, char* msg), (ex, msg)) __OTORP__(register Expr_t* ex; char* msg;){
+seterror __PARAM__((Expr_t* ex, char* msg), (ex, msg)) __OTORP__(Expr_t* ex; char* msg;){
if (!ex->errmsg) ex->errmsg = msg;
ex->errchr = ex->nextchr;
ex->nextchr = "";
*/
static long
-expr __PARAM__((register Expr_t* ex, register int precedence), (ex, precedence)) __OTORP__(register Expr_t* ex; register int precedence;){
- register int c;
- register long n;
- register long x;
+expr __PARAM__((Expr_t* ex, int precedence), (ex, precedence)) __OTORP__(Expr_t* ex; int precedence;){
+ int c;
+ long n;
+ long x;
char* pos;
int operand = 1;
int
strgid __PARAM__((const char* name), (name)) __OTORP__(const char* name;){
- register struct group* gr;
- register struct passwd* pw;
- register bucket* b;
+ struct group* gr;
+ struct passwd* pw;
+ bucket* b;
char* e;
static Hash_table_t* gidtab;
*/
__V_*
-strlook __PARAM__((const __V_* tab, int siz, register const char* name), (tab, siz, name)) __OTORP__(const __V_* tab; int siz; register const char* name;){
- register char* t = (char*)tab;
- register char* s;
+strlook __PARAM__((const __V_* tab, int siz, const char* name), (tab, siz, name)) __OTORP__(const __V_* tab; int siz; const char* name;){
+ char* t = (char*)tab;
+ char* s;
for (; s = *((char**)t); t += siz)
if (streq(s, name))
*/
static char*
-gobble __PARAM__((Match_t* mp, register char* s, register int sub, int* g, int clear), (mp, s, sub, g, clear)) __OTORP__(Match_t* mp; register char* s; register int sub; int* g; int clear;){
- register int p = 0;
- register char* b = 0;
+gobble __PARAM__((Match_t* mp, char* s, int sub, int* g, int clear), (mp, s, sub, g, clear)) __OTORP__(Match_t* mp; char* s; int sub; int* g; int clear;){
+ int p = 0;
+ char* b = 0;
int c = 0;
int n;
}
}
-static int grpmatch __PROTO__((Match_t*, int, char*, register char*, char*, int));
+static int grpmatch __PROTO__((Match_t*, int, char*, char*, char*, int));
#if _DEBUG_MATCH
static long test;
static int
onematch __PARAM__((Match_t* mp, int g, char* s, char* p, char* e, char* r, int flags), (mp, g, s, p, e, r, flags)) __OTORP__(Match_t* mp; int g; char* s; char* p; char* e; char* r; int flags;){
- register int pc;
- register int sc;
- register int n;
+ int pc;
+ int sc;
+ int n;
char* olds;
char* oldp;
*/
static int
-grpmatch __PARAM__((Match_t* mp, int g, char* s, register char* p, char* e, int flags), (mp, g, s, p, e, flags)) __OTORP__(Match_t* mp; int g; char* s; register char* p; char* e; int flags;){
- register char* a;
+grpmatch __PARAM__((Match_t* mp, int g, char* s, char* p, char* e, int flags), (mp, g, s, p, e, flags)) __OTORP__(Match_t* mp; int g; char* s; char* p; char* e; int flags;){
+ char* a;
#if _DEBUG_MATCH
error_info.indent++;
int
strgrpmatch __PARAM__((const char* b, const char* p, int* sub, int n, int flags), (b, p, sub, n, flags)) __OTORP__(const char* b; const char* p; int* sub; int n; int flags;){
- register int i;
- register char* s;
+ int i;
+ char* s;
char* e;
Match_t match;
#include "modelib.h"
int
-strmode __PARAM__((register const char* s), (s)) __OTORP__(register const char* s;){
- register int c;
- register char* t;
- register struct modeop* p;
+strmode __PARAM__((const char* s), (s)) __OTORP__(const char* s;){
+ int c;
+ char* t;
+ struct modeop* p;
int mode;
mode = 0;
int
stropt __PARAM__((const char* as, const __V_* tab, int siz, int(*f)(__V_*, const __V_*, int, const char*), __V_* a), (as, tab, siz, f, a)) __OTORP__(const char* as; const __V_* tab; int siz; int(*f)(); __V_* a;){
- register int c;
- register char* s;
- register char* v;
- register char* t;
+ int c;
+ char* s;
+ char* v;
+ char* t;
char** p;
char* u;
char* x;
#include <modex.h>
int
-strperm __PARAM__((const char* aexpr, char** e, register int perm), (aexpr, e, perm)) __OTORP__(const char* aexpr; char** e; register int perm;){
- register char* expr = (char*)aexpr;
- register int c;
- register int typ;
- register int who;
+strperm __PARAM__((const char* aexpr, char** e, int perm), (aexpr, e, perm)) __OTORP__(const char* aexpr; char** e; int perm;){
+ char* expr = (char*)aexpr;
+ int c;
+ int typ;
+ int who;
int num;
int op;
#include <sig.h>
char*
-strsignal __PARAM__((register int sig), (sig)) __OTORP__(register int sig;)
+strsignal __PARAM__((int sig), (sig)) __OTORP__(int sig;)
#line 17
{
static char buf[20];
#endif
void
strsort __PARAM__((char** argv, int n, int(*fn)(const char*, const char*)), (argv, n, fn)) __OTORP__(char** argv; int n; int(*fn)();){
- register int i;
- register int j;
- register int m;
- register char** ap;
+ int i;
+ int j;
+ int m;
+ char** ap;
char* s;
int k;
#include <ast.h>
char*
-strtape __PARAM__((register const char* s, register char** e), (s, e)) __OTORP__(register const char* s; register char** e;){
+strtape __PARAM__((const char* s, char** e), (s, e)) __OTORP__(const char* s; char** e;){
int mtunit = '0';
int mtdensity = 0;
char mtrewind[2];
#include <ctype.h>
long
-strton __PARAM__((register const char* s, char** e, char* b, int m), (s, e, b, m)) __OTORP__(register const char* s; char** e; char* b; int m;){
- register long n;
- register int c;
- register int r;
- register const char* p;
+strton __PARAM__((const char* s, char** e, char* b, int m), (s, e, b, m)) __OTORP__(const char* s; char** e; char* b; int m;){
+ long n;
+ int c;
+ int r;
+ const char* p;
int z;
if (!b || (r = *b) < 0 || r > 64) r = 0;
int
struid __PARAM__((const char* name), (name)) __OTORP__(const char* name;){
- register struct passwd* pw;
- register bucket* b;
+ struct passwd* pw;
+ bucket* b;
char* e;
static Hash_table_t* uidtab;
int_max
swapget __PARAM__((int op, const __V_* b, int n), (op, b, n)) __OTORP__(int op; const __V_* b; int n;){
- register unsigned char* p;
- register unsigned char* d;
+ unsigned char* p;
+ unsigned char* d;
int_max v;
unsigned char tmp[sizeof(int_max)];
*/
__V_*
-swapmem __PARAM__((int op, const __V_* from, __V_* to, register size_t n), (op, from, to, n)) __OTORP__(int op; const __V_* from; __V_* to; register size_t n;){
- register char* f = (char*)from;
- register char* t = (char*)to;
- register int c;
+swapmem __PARAM__((int op, const __V_* from, __V_* to, size_t n), (op, from, to, n)) __OTORP__(int op; const __V_* from; __V_* to; size_t n;){
+ char* f = (char*)from;
+ char* t = (char*)to;
+ int c;
switch ((op ^ int_swap) & (n - 1))
{
int
swapop __PARAM__((const __V_* internal, const __V_* external, int size), (internal, external, size)) __OTORP__(const __V_* internal; const __V_* external; int size;){
- register int op;
+ int op;
char tmp[sizeof(int_max)];
if (size <= 1)
__V_*
swapput __PARAM__((int op, __V_* b, int n, int_max v), (op, b, n, v)) __OTORP__(int op; __V_* b; int n; int_max v;){
- register char* p = (char*)b + n;
+ char* p = (char*)b + n;
while (p > (char*)b)
{
*/
int
-tabindex __PARAM__((char* tab, int siz, register char* name), (tab, siz, name)) __OTORP__(char* tab; int siz; register char* name;)
+tabindex __PARAM__((char* tab, int siz, char* name), (tab, siz, name)) __OTORP__(char* tab; int siz; char* name;)
#line 18
{
- register char* p;
- register char* s;
+ char* p;
+ char* s;
for (p = tab; s = *((char**)p); p += siz)
if (streq(s, name))
*/
char*
-tablook __PARAM__((register char* tab, int siz, register char* name), (tab, siz, name)) __OTORP__(register char* tab; int siz; register char* name;)
+tablook __PARAM__((char* tab, int siz, char* name), (tab, siz, name)) __OTORP__(char* tab; int siz; char* name;)
#line 18
{
- register char* s;
+ char* s;
for (; s = *((char**)tab); tab += siz)
if (streq(s, name))
*/
char*
-tokopen __PARAM__((register char* s, int f), (s, f)) __OTORP__(register char* s; int f;){
- register TOK* p;
+tokopen __PARAM__((char* s, int f), (s, f)) __OTORP__(char* s; int f;){
+ TOK* p;
if (p = freelist) freelist = freelist->ptr.nxt;
else if (!(p = newof(0, TOK, 1, 0))) return(0);
void
tokclose __PARAM__((char* u), (u)) __OTORP__(char* u;){
- register TOK* p = (TOK*)u;
+ TOK* p = (TOK*)u;
if (p->flg) *p->ptr.end = p->chr;
p->ptr.nxt = freelist;
char*
tokread __PARAM__((char* u), (u)) __OTORP__(char* u;){
- register TOK* p = (TOK*)u;
- register char* s;
- register char* r;
- register int q;
- register int c;
+ TOK* p = (TOK*)u;
+ char* s;
+ char* r;
+ int q;
+ int c;
/*
* restore string on each call
static int
splice __PARAM__((Sfio_t* s, int op, Sfdisc_t* ad), (s, op, ad)) __OTORP__(Sfio_t* s; int op; Sfdisc_t* ad;){
SPLICE* d = (SPLICE*)ad;
- register char* b;
- register int c;
- register int n;
- register int q;
- register char* e;
+ char* b;
+ int c;
+ int n;
+ int q;
+ char* e;
char* buf;
switch (op)
*/
static char*
-lextok __PARAM__((register char* s, register int c, char** p, int* n), (s, c, p, n)) __OTORP__(register char* s; register int c; char** p; int* n;){
- register char* t;
- register int q;
+lextok __PARAM__((char* s, int c, char** p, int* n), (s, c, p, n)) __OTORP__(char* s; int c; char** p; int* n;){
+ char* t;
+ int q;
char* b;
char* u;
*/
int
-tokscan __PARAM__((register char* s, char** nxt, const char* fmt, ...), (va_alist)) __OTORP__(va_dcl)
-{ __OTORP__(register char* s; char** nxt; const char* fmt; )
- register int c;
- register char* f;
+tokscan __PARAM__((char* s, char** nxt, const char* fmt, ...), (va_alist)) __OTORP__(va_dcl)
+{ __OTORP__(char* s; char** nxt; const char* fmt; )
+ int c;
+ char* f;
int num = 0;
char* skip = 0;
int q;
*/
time_t
-tmdate __PARAM__((register const char* s, char** e, time_t* clock), (s, e, clock)) __OTORP__(register const char* s; char** e; time_t* clock;){
- register Tm_t* tm;
- register int n;
+tmdate __PARAM__((const char* s, char** e, time_t* clock), (s, e, clock)) __OTORP__(const char* s; char** e; time_t* clock;){
+ Tm_t* tm;
+ int n;
int state;
time_t now;
char* t;
*/
Tm_t*
-tmfix __PARAM__((register Tm_t* tp), (tp)) __OTORP__(register Tm_t* tp;){
- register int n;
+tmfix __PARAM__((Tm_t* tp), (tp)) __OTORP__(Tm_t* tp;){
+ int n;
if ((n = tp->tm_sec) < 0)
{
*/
static char*
-number __PARAM__((register char* s, register char* e, register long n, register int p), (s, e, n, p)) __OTORP__(register char* s; register char* e; register long n; register int p;){
+number __PARAM__((char* s, char* e, long n, int p), (s, e, n, p)) __OTORP__(char* s; char* e; long n; int p;){
if (p > 0) s += sfsprintf(s, 64, "%0*lu", p, n);
else if (p < 0) s += sfsprintf(s, 64, "%*lu", -p, n);
else s += sfsprintf(s, e - s, "%lu", n);
char*
tmfmt __PARAM__((char* buf, size_t len, const char* format, time_t* clock), (buf, len, format, clock)) __OTORP__(char* buf; size_t len; const char* format; time_t* clock;){
- register char* cp;
- register char* ep;
- register char* p;
- register int n;
+ char* cp;
+ char* ep;
+ char* p;
+ int n;
int c;
int i;
int flags;
*/
int
-tmgoff __PARAM__((register const char* s, char** e, int d), (s, e, d)) __OTORP__(register const char* s; char** e; int d;){
- register int n;
+tmgoff __PARAM__((const char* s, char** e, int d), (s, e, d)) __OTORP__(const char* s; char** e; int d;){
+ int n;
char* t;
if (isdigit(n = *s) || n == '-' || n == '+')
static int
tzwest __PARAM__((time_t* clock, int* isdst), (clock, isdst)) __OTORP__(time_t* clock; int* isdst;){
- register Tm_t* tp;
- register int n;
- register int m;
+ Tm_t* tp;
+ int n;
+ int m;
int h;
/*
static void
tmlocal __PARAM__((void), ()){
- register Tm_zone_t* zp;
- register int n;
- register char* s;
+ Tm_zone_t* zp;
+ int n;
+ char* s;
int i;
int m;
int isdst;
*/
void
-tminit __PARAM__((register Tm_zone_t* zp), (zp)) __OTORP__(register Tm_zone_t* zp;){
+tminit __PARAM__((Tm_zone_t* zp), (zp)) __OTORP__(Tm_zone_t* zp;){
if (!tm_info.local) tmlocal();
if (!zp) zp = tm_info.local;
#if HUH950804 /* it only worked on systems that ignored TZ=...! */
if (zp != tm_info.zone)
{
- register char* s;
+ char* s;
time_t clock;
char buf[128];
*/
time_t
-tmleap __PARAM__((register time_t* clock), (clock)) __OTORP__(register time_t* clock;){
- register Tm_leap_t* lp;
+tmleap __PARAM__((time_t* clock), (clock)) __OTORP__(time_t* clock;){
+ Tm_leap_t* lp;
time_t now;
tmset(tm_info.zone);
*/
int
-tmlex __PARAM__((register const char* s, char** e, char** tab, register int ntab, char** suf, int nsuf), (s, e, tab, ntab, suf, nsuf)) __OTORP__(register const char* s; char** e; char** tab; register int ntab; char** suf; int nsuf;){
- register char** p;
+tmlex __PARAM__((const char* s, char** e, char** tab, int ntab, char** suf, int nsuf), (s, e, tab, ntab, suf, nsuf)) __OTORP__(const char* s; char** e; char** tab; int ntab; char** suf; int nsuf;){
+ char** p;
for (p = tab; ntab-- && *p; p++)
if (tmword(s, e, *p, suf, nsuf))
Tm_t*
tmmake __PARAM__((time_t* clock), (clock)) __OTORP__(time_t* clock;){
- register Tm_t* tp;
- register Tm_leap_t* lp;
+ Tm_t* tp;
+ Tm_leap_t* lp;
int leapsec;
time_t now;
*/
char*
-tmpoff __PARAM__((register char* s, register const char* p, register int n, int d), (s, p, n, d)) __OTORP__(register char* s; register const char* p; register int n; int d;){
+tmpoff __PARAM__((char* s, const char* p, int n, int d), (s, p, n, d)) __OTORP__(char* s; const char* p; int n; int d;){
while (*s = *p++) s++;
if (n != d)
{
*/
time_t
-tmtime __PARAM__((register Tm_t* tp, int west), (tp, west)) __OTORP__(register Tm_t* tp; int west;){
- register time_t clock;
- register Tm_leap_t* lp;
+tmtime __PARAM__((Tm_t* tp, int west), (tp, west)) __OTORP__(Tm_t* tp; int west;){
+ time_t clock;
+ Tm_leap_t* lp;
int n;
int sec;
time_t now;
*/
Tm_zone_t*
-tmtype __PARAM__((register const char* s, char** e), (s, e)) __OTORP__(register const char* s; char** e;){
- register Tm_zone_t* zp;
- register char* t;
+tmtype __PARAM__((const char* s, char** e), (s, e)) __OTORP__(const char* s; char** e;){
+ Tm_zone_t* zp;
+ char* t;
tmset(tm_info.zone);
zp = tm_info.local;
*/
int
-tmword __PARAM__((register const char* s, char** e, register const char* t, char** suf, int n), (s, e, t, suf, n)) __OTORP__(register const char* s; char** e; register const char* t; char** suf; int n;){
- register int c;
+tmword __PARAM__((const char* s, char** e, const char* t, char** suf, int n), (s, e, t, suf, n)) __OTORP__(const char* s; char** e; const char* t; char** suf; int n;){
+ int c;
const char* b;
if (*s && *t)
*/
Tm_zone_t*
-tmzone __PARAM__((register const char* name, char** end, const char* type, int* dst), (name, end, type, dst)) __OTORP__(register const char* name; char** end; const char* type; int* dst;){
- register Tm_zone_t* zp;
- register char* prev;
+tmzone __PARAM__((const char* name, char** end, const char* type, int* dst), (name, end, type, dst)) __OTORP__(const char* name; char** end; const char* type; int* dst;){
+ Tm_zone_t* zp;
+ char* prev;
tmset(tm_info.zone);
zp = tm_info.local;
*/
int
-vecargs __PARAM__((register char** vec, int* argcp, char*** argvp), (vec, argcp, argvp)) __OTORP__(register char** vec; int* argcp; char*** argvp;){
- register char** argv;
- register char** oargv;
+vecargs __PARAM__((char** vec, int* argcp, char*** argvp), (vec, argcp, argvp)) __OTORP__(char** vec; int* argcp; char*** argvp;){
+ char** argv;
+ char** oargv;
char** ovec;
char* s;
int num;
char**
vecfile __PARAM__((const char* file), (file)) __OTORP__(const char* file;){
- register int n;
- register char* buf;
- register char** vec;
+ int n;
+ char* buf;
+ char** vec;
int fd;
struct stat st;
*/
void
-vecfree __PARAM__((register char** vec, int retain), (vec, retain)) __OTORP__(register char** vec; int retain;){
+vecfree __PARAM__((char** vec, int retain), (vec, retain)) __OTORP__(char** vec; int retain;){
if (vec)
{
if (*(vec -= 2) && !retain) free(*vec);
char**
vecload __PARAM__((char* buf), (buf)) __OTORP__(char* buf;){
- register char* s;
- register int n;
- register char** p;
+ char* s;
+ int n;
+ char** p;
char** vec;
vec = 0;
char**
vecstring __PARAM__((const char* str), (str)) __OTORP__(const char* str;){
- register char* buf;
- register char** vec;
+ char* buf;
+ char** vec;
if (!str || !*str || !(buf = strdup(str))) vec = 0;
else if (!(vec = vecload(buf))) free(buf);
typedef struct _seg_ Seg_t;
typedef struct _pfobj_ Pfobj_t;
-#define reg register
+#define reg /*no register keywords*/
#define NOTUSED(x) (&x,1)
/* convert an address to an integral value */
*/
char*
-vmstrdup __PARAM__((Vmalloc_t* v, register const char* s), (v, s)) __OTORP__(Vmalloc_t* v; register const char* s;){
- register char* t;
- register int n;
+vmstrdup __PARAM__((Vmalloc_t* v, const char* s), (v, s)) __OTORP__(Vmalloc_t* v; const char* s;){
+ char* t;
+ int n;
return((t = vmalloc(v, n = strlen(s) + 1)) ? (char*)memcpy(t, s, n) : (char*)0);
}
#include <cmdlib.h>
-static void namebase __PARAM__((Sfio_t *outfile, register char *pathname, char *suffix), (outfile, pathname, suffix)) __OTORP__(Sfio_t *outfile; register char *pathname; char *suffix;){
- register char *first, *last;
- register int n=0;
+static void namebase __PARAM__((Sfio_t *outfile, char *pathname, char *suffix), (outfile, pathname, suffix)) __OTORP__(Sfio_t *outfile; char *pathname; char *suffix;){
+ char *first, *last;
+ int n=0;
for(first=last=pathname; *last; last++);
/* back over trailing '/' */
if(last>first)
}
int
-b_basename __PARAM__((int argc,register char *argv[]), (argc, argv)) __OTORP__(int argc;register char *argv[];){
- register int n;
+b_basename __PARAM__((int argc,char *argv[]), (argc, argv)) __OTORP__(int argc;char *argv[];){
+ int n;
NoP(id[0]);
cmdinit(argv);
static int
vcat __PARAM__((Sfio_t *fdin, Sfio_t *fdout, int flags), (fdin, fdout, flags)) __OTORP__(Sfio_t *fdin; Sfio_t *fdout; int flags;){
- register unsigned char* cp;
- register unsigned char* cpold;
- register int n;
- register int line = 1;
- register unsigned char* endbuff;
+ unsigned char* cp;
+ unsigned char* cpold;
+ int n;
+ int line = 1;
+ unsigned char* endbuff;
unsigned char* inbuff;
int printdefer = (flags&(B_FLAG|N_FLAG));
int lastchar;
int
b_cat __PARAM__((int argc, char** argv), (argc, argv)) __OTORP__(int argc; char** argv;){
- register int n;
- register int flags = 0;
- register char* cp;
- register Sfio_t* fp;
+ int n;
+ int flags = 0;
+ char* cp;
+ Sfio_t* fp;
int att;
NoP(id[0]);
*/
static void
-getids __PARAM__((register char* s, char** e, int* uid, int* gid, int flags), (s, e, uid, gid, flags)) __OTORP__(register char* s; char** e; int* uid; int* gid; int flags;){
- register char* t;
- register int n;
+getids __PARAM__((char* s, char** e, int* uid, int* gid, int flags), (s, e, uid, gid, flags)) __OTORP__(char* s; char** e; int* uid; int* gid; int flags;){
+ char* t;
+ int n;
char* z;
char buf[64];
int
b_chgrp __PARAM__((int argc, char *argv[]), (argc, argv)) __OTORP__(int argc; char *argv[];){
- register int flags = 0;
- register char* file;
- register char* s;
- register Map_t* m;
+ int flags = 0;
+ char* file;
+ char* s;
+ Map_t* m;
Hash_table_t* map = 0;
int resolve;
int n;
int
b_chmod __PARAM__((int argc, char* argv[]), (argc, argv)) __OTORP__(int argc; char* argv[];){
- register int mode;
- register int force = 0;
- register int recurse = 0;
- register int resolve;
- register char* amode;
- register char* file;
+ int mode;
+ int force = 0;
+ int recurse = 0;
+ int resolve;
+ char* amode;
+ char* file;
char* last;
struct stat st;
int (*chmodf) __PROTO__((const char*, mode_t));
*/
static void
-cmdinit __PARAM__((register char** argv), (argv)) __OTORP__(register char** argv;){
- register char* cp;
+cmdinit __PARAM__((char** argv), (argv)) __OTORP__(char** argv;){
+ char* cp;
if (cp = strrchr(argv[0], '/')) cp++;
else cp = argv[0];
#include <cmdlib.h>
void
-cmdinit __PARAM__((register char** argv), (argv)) __OTORP__(register char** argv;){
- register char* cp;
+cmdinit __PARAM__((char** argv), (argv)) __OTORP__(char** argv;){
+ char* cp;
if (cp = strrchr(argv[0], '/')) cp++;
else cp = argv[0];
int
cmdrecurse __PARAM__((int argc, char** argv, int pfxc, char** pfxv), (argc, argv, pfxc, pfxv)) __OTORP__(int argc; char** argv; int pfxc; char** pfxv;){
- register char** v;
- register char** a;
+ char** v;
+ char** a;
int resolve = 'L';
char arg[16];
static int
cmp __PARAM__((const char* file1, Sfio_t* f1, const char* file2, Sfio_t* f2, int flags), (file1, f1, file2, f2, flags)) __OTORP__(const char* file1; Sfio_t* f1; const char* file2; Sfio_t* f2; int flags;){
- register int c1;
- register int c2;
- register unsigned char* p1 = 0;
- register unsigned char* p2 = 0;
- register int lines = 1;
- register unsigned char* e1 = 0;
- register unsigned char* e2 = 0;
+ int c1;
+ int c2;
+ unsigned char* p1 = 0;
+ unsigned char* p2 = 0;
+ int lines = 1;
+ unsigned char* e1 = 0;
+ unsigned char* e2 = 0;
unsigned long pos = 0;
int ret = 0;
unsigned char* last;
}
int
-b_cmp __PARAM__((int argc, register char** argv), (argc, argv)) __OTORP__(int argc; register char** argv;){
+b_cmp __PARAM__((int argc, char** argv), (argc, argv)) __OTORP__(int argc; char** argv;){
char* s;
char* e;
Sfio_t* f1 = 0;
#define C_COMMON 4
#define C_ALL (C_FILE1|C_FILE2|C_COMMON)
-static int comm __PARAM__((Sfio_t *in1, Sfio_t *in2, register Sfio_t *out,register int mode), (in1, in2, out, mode)) __OTORP__(Sfio_t *in1; Sfio_t *in2; register Sfio_t *out;register int mode;){
- register char *cp1, *cp2;
- register int n1, n2, n, comp;
+static int comm __PARAM__((Sfio_t *in1, Sfio_t *in2, Sfio_t *out,int mode), (in1, in2, out, mode)) __OTORP__(Sfio_t *in1; Sfio_t *in2; Sfio_t *out;int mode;){
+ char *cp1, *cp2;
+ int n1, n2, n, comp;
if(cp1 = sfgetr(in1,'\n',0))
n1 = sfslen();
if(cp2 = sfgetr(in2,'\n',0))
int
b_comm __PARAM__((int argc, char *argv[]), (argc, argv)) __OTORP__(int argc; char *argv[];){
- register int n;
- register int mode = C_FILE1|C_FILE2|C_COMMON;
- register char *cp;
+ int n;
+ int mode = C_FILE1|C_FILE2|C_COMMON;
+ char *cp;
Sfio_t *f1, *f2;
NoP(id[0]);
* compare the first of an array of integers
*/
-static int mycomp __PARAM__((register const __V_ *a,register const __V_ *b), (a, b)) __OTORP__(register const __V_ *a;register const __V_ *b;){
+static int mycomp __PARAM__((const __V_ *a,const __V_ *b), (a, b)) __OTORP__(const __V_ *a;const __V_ *b;){
return(*((int*)a) - *((int*)b));
}
static Cut_t *cutinit __PARAM__((int mode,char *str,int wdelim,int ldelim), (mode, str, wdelim, ldelim)) __OTORP__(int mode;char *str;int wdelim;int ldelim;){
- register int *lp, c, n=0;
- register int range = 0;
- register char *cp = str;
+ int *lp, c, n=0;
+ int range = 0;
+ char *cp = str;
Cut_t *cuthdr;
cuthdr = (Cut_t*)stakalloc(sizeof(Cut_t)+strlen(cp)*sizeof(int));
cuthdr->cflag = ((mode&C_CHARS)!=0);
}
if(c==0)
{
- register int *dp;
+ int *dp;
*lp = HUGE;
n = 1 + (lp-cuthdr->list)/2;
qsort(lp=cuthdr->list,n,2*sizeof(*lp),mycomp);
*/
static int cutcols __PARAM__((const Cut_t *cuthdr,Sfio_t *fdin,Sfio_t *fdout), (cuthdr, fdin, fdout)) __OTORP__(const Cut_t *cuthdr;Sfio_t *fdin;Sfio_t *fdout;){
- register int c, ncol=0;
- register const int *lp = cuthdr->list;
- register char *inp, *inend;
- register int skip; /* non-zero for don't copy */
+ int c, ncol=0;
+ const int *lp = cuthdr->list;
+ char *inp, *inend;
+ int skip; /* non-zero for don't copy */
int inword = 0;
while(inp = sfgetr(fdin,'\n', 0))
{
static int cutfields __PARAM__((const Cut_t *cuthdr,Sfio_t *fdin,Sfio_t *fdout), (cuthdr, fdin, fdout)) __OTORP__(const Cut_t *cuthdr;Sfio_t *fdin;Sfio_t *fdout;){
static signed char space[1<<CHAR_BIT];
static int lastseq, lastwdelim = 0, lastldelim = '\n';
- register unsigned char *cp;
- register int c, nfields;
- register const int *lp = cuthdr->list;
- register unsigned char *copy;
- register int nodelim, empty, inword=0;
- register unsigned char *endbuff;
+ unsigned char *cp;
+ int c, nfields;
+ const int *lp = cuthdr->list;
+ unsigned char *copy;
+ int nodelim, empty, inword=0;
+ unsigned char *endbuff;
unsigned char *inbuff, *first;
int lastchar;
Sfio_t *fdtmp = 0;
int
b_cut __PARAM__((int argc,char *argv[]), (argc, argv)) __OTORP__(int argc;char *argv[];){
- register char *cp;
- register Sfio_t *fp;
+ char *cp;
+ Sfio_t *fp;
int n;
Cut_t *cuthdr;
int mode = 0;
#include <cmdlib.h>
-static void dirname __PARAM__((register Sfio_t *outfile, register const char *pathname), (outfile, pathname)) __OTORP__(register Sfio_t *outfile; register const char *pathname;){
- register const char *last;
+static void dirname __PARAM__((Sfio_t *outfile, const char *pathname), (outfile, pathname)) __OTORP__(Sfio_t *outfile; const char *pathname;){
+ const char *last;
/* go to end of path */
for(last=pathname; *last; last++);
/* back over trailing '/' */
}
int
-b_dirname __PARAM__((int argc,register char *argv[]), (argc, argv)) __OTORP__(int argc;register char *argv[];){
- register int n;
+b_dirname __PARAM__((int argc,char *argv[]), (argc, argv)) __OTORP__(int argc;char *argv[];){
+ int n;
NoP(id[0]);
cmdinit(argv);
static char cols[1<<CHAR_BIT];
-static void fold __PARAM__((Sfio_t *in, Sfio_t *out, register int width), (in, out, width)) __OTORP__(Sfio_t *in; Sfio_t *out; register int width;){
- register char *cp, *first;
- register int n, col=0;
- register char *last_space=0;
+static void fold __PARAM__((Sfio_t *in, Sfio_t *out, int width), (in, out, width)) __OTORP__(Sfio_t *in; Sfio_t *out; int width;){
+ char *cp, *first;
+ int n, col=0;
+ char *last_space=0;
cols[0] = 0;
while(cp = sfgetr(in,'\n',0))
{
int
b_fold __PARAM__((int argc, char *argv[]), (argc, argv)) __OTORP__(int argc; char *argv[];){
- register int n, width=WIDTH;
- register Sfio_t *fp;
- register char *cp;
+ int n, width=WIDTH;
+ Sfio_t *fp;
+ char *cp;
NoP(id[0]);
cmdinit(argv);
int
b_getconf __PARAM__((int argc, char** argv), (argc, argv)) __OTORP__(int argc; char** argv;){
- register char* name;
- register char* path;
- register char* value;
- register char* s;
- register int n;
+ char* name;
+ char* path;
+ char* value;
+ char* s;
+ int n;
int flags;
static char empty[] = "-";
#include <cmdlib.h>
int
-b_head __PARAM__((int argc, register char *argv[]), (argc, argv)) __OTORP__(int argc; register char *argv[];){
+b_head __PARAM__((int argc, char *argv[]), (argc, argv)) __OTORP__(int argc; char *argv[];){
static char header_fmt[] = "\n==> %s <==\n";
- register Sfio_t *fp;
- register char *cp;
- register long number = 10;
- register off_t skip = 0;
- register int n;
- register int delim = '\n';
+ Sfio_t *fp;
+ char *cp;
+ long number = 10;
+ off_t skip = 0;
+ int n;
+ int delim = '\n';
char *format = header_fmt+1;
NoP(id[0]);
#if _lib_fsid
static void
-getfsids __PARAM__((Sfio_t* sp, const char* name, int flags, register int lastchar), (sp, name, flags, lastchar)) __OTORP__(Sfio_t* sp; const char* name; int flags; register int lastchar;){
- register struct fsg* fs;
- register char* s;
- register char** p;
+getfsids __PARAM__((Sfio_t* sp, const char* name, int flags, int lastchar), (sp, name, flags, lastchar)) __OTORP__(Sfio_t* sp; const char* name; int flags; int lastchar;){
+ struct fsg* fs;
+ char* s;
+ char** p;
char** x;
if (lastchar)
if (flags > 0) x = 0;
else
{
- register char** q;
- register char* t;
- register int n;
+ char** q;
+ char* t;
+ int n;
n = 0;
q = p;
}
static int
-getids __PARAM__((Sfio_t* sp, const char* name, register int flags), (sp, name, flags)) __OTORP__(Sfio_t* sp; const char* name; register int flags;){
- register struct passwd* pw;
- register struct group* grp;
- register int i;
- register int j;
- register int k;
+getids __PARAM__((Sfio_t* sp, const char* name, int flags), (sp, name, flags)) __OTORP__(Sfio_t* sp; const char* name; int flags;){
+ struct passwd* pw;
+ struct group* grp;
+ int i;
+ int j;
+ int k;
#if _lib_fsid
- register struct fsg* fs;
+ struct fsg* fs;
const char* fs_name;
int fs_id;
#endif
int
b_id __PARAM__((int argc, char *argv[]), (argc, argv)) __OTORP__(int argc; char *argv[];){
- register int flags = 0;
- register int n;
+ int flags = 0;
+ int n;
NoP(id[0]);
cmdinit(argv);
#define S_SPACE 2
#define S_NL 3
-static void join_free __PARAM__((register Join_t *jp), (jp)) __OTORP__(register Join_t *jp;){
+static void join_free __PARAM__((Join_t *jp), (jp)) __OTORP__(Join_t *jp;){
if(jp->outlist)
free(jp->outlist);
free(jp->file[0].fieldlist);
}
static int getolist __PARAM__((Join_t* jp, const char *first, char** arglist), (jp, first, arglist)) __OTORP__(Join_t* jp; const char *first; char** arglist;){
- register const char *cp = first;
+ const char *cp = first;
char **argv = arglist;
- register int c;
+ int c;
int *outptr, *outmax;
int nfield = NFIELD;
char *str;
* reads in a record from file <index> and splits into fields
*/
static char *getrec __PARAM__((Join_t* jp, int index), (jp, index)) __OTORP__(Join_t* jp; int index;){
- register unsigned char *state = jp->state;
- register struct jfile *fp = &jp->file[index];
- register char *cp, **ptr = fp->fieldlist;
- register int n=0;
- register char **ptrmax = ptr + fp->maxfields;
+ unsigned char *state = jp->state;
+ struct jfile *fp = &jp->file[index];
+ char *cp, **ptr = fp->fieldlist;
+ int n=0;
+ char **ptrmax = ptr + fp->maxfields;
fp->spaces = 0;
if(!(cp = sfgetr(fp->iop, '\n', 0)))
return(0);
/*
* print field <n> from file <index>
*/
-static int outfield __PARAM__((Join_t* jp, int index, register int n, int last), (jp, index, n, last)) __OTORP__(Join_t* jp; int index; register int n; int last;){
- register struct jfile *fp = &jp->file[index];
- register char *cp, *cpmax;
- register int size;
- register Sfio_t *iop = jp->outfile;
+static int outfield __PARAM__((Join_t* jp, int index, int n, int last), (jp, index, n, last)) __OTORP__(Join_t* jp; int index; int n; int last;){
+ struct jfile *fp = &jp->file[index];
+ char *cp, *cpmax;
+ int size;
+ Sfio_t *iop = jp->outfile;
{
if(n < fp->nfields)
{
return(0);
}
-static int joinout __PARAM__((register Join_t *jp, int mode), (jp, mode)) __OTORP__(register Join_t *jp; int mode;){
- register struct jfile *fp;
- register int i,j,n;
+static int joinout __PARAM__((Join_t *jp, int mode), (jp, mode)) __OTORP__(Join_t *jp; int mode;){
+ struct jfile *fp;
+ int i,j,n;
int last,*out;
if(out= jp->outlist)
{
}
static Join_t *join_init __PARAM__((void), ()){
- register Join_t *jp;
+ Join_t *jp;
static Join_t Join;
jp = &Join;
memzero(jp->state, sizeof(jp->state));
}
static int join __PARAM__((Join_t *jp), (jp)) __OTORP__(Join_t *jp;){
- register char *cp1, *cp2;
- register int n1, n2, n, comp;
+ char *cp1, *cp2;
+ int n1, n2, n, comp;
off_t offset = -1;
int ndup=0;
cp1 = getrec(jp,0);
int
b_join __PARAM__((int argc, char *argv[]), (argc, argv)) __OTORP__(int argc; char *argv[];){
- register int n;
- register char *cp;
- register Join_t *jp = join_init();
+ int n;
+ char *cp;
+ Join_t *jp = join_init();
NoP(id[0]);
cmdinit(argv);
int
b_logname __PARAM__((int argc, char *argv[]), (argc, argv)) __OTORP__(int argc; char *argv[];){
- register int n;
- register char* logname;
+ int n;
+ char* logname;
NoP(argc);
NoP(id[0]);
int
b_mkdir __PARAM__((int argc, char *argv[]), (argc, argv)) __OTORP__(int argc; char *argv[];){
- register char *arg;
- register mode_t mode=DIRMODE, mask;
- register int n, mflag=0, pflag=0;
+ char *arg;
+ mode_t mode=DIRMODE, mask;
+ int n, mflag=0, pflag=0;
mode_t dmode;
NoP(argc);
int
b_mkfifo __PARAM__((int argc, char *argv[]), (argc, argv)) __OTORP__(int argc; char *argv[];){
- register char *arg;
- register mode_t mode=RWALL, mask=0;
- register int n, mflag=0;
+ char *arg;
+ mode_t mode=RWALL, mask=0;
+ int n, mflag=0;
NoP(argc);
NoP(id[0]);
* to <out>
*/
-static int paste __PARAM__((int nstream,Sfio_t* streams[],Sfio_t *out, register const char *delim,int dlen), (nstream, streams, out, delim, dlen)) __OTORP__(int nstream;Sfio_t* streams[];Sfio_t *out; register const char *delim;int dlen;){
- register const char *cp;
- register int d, n, more=1;
- register Sfio_t *fp;
+static int paste __PARAM__((int nstream,Sfio_t* streams[],Sfio_t *out, const char *delim,int dlen), (nstream, streams, out, delim, dlen)) __OTORP__(int nstream;Sfio_t* streams[];Sfio_t *out; const char *delim;int dlen;){
+ const char *cp;
+ int d, n, more=1;
+ Sfio_t *fp;
do
{
d = (dlen>0?0:-1);
}
if(++n<nstream && more && d>=0)
{
- register int c;
+ int c;
if(d >= dlen)
d = 0;
if(c=delim[d++])
/*
* Handles paste -s, for file <in> to file <out> using delimiters <delim>
*/
-static int spaste __PARAM__((Sfio_t *in,register Sfio_t* out,register const char *delim,int dlen), (in, out, delim, dlen)) __OTORP__(Sfio_t *in;register Sfio_t* out;register const char *delim;int dlen;){
- register const char *cp;
- register int d=0;
+static int spaste __PARAM__((Sfio_t *in,Sfio_t* out,const char *delim,int dlen), (in, out, delim, dlen)) __OTORP__(Sfio_t *in;Sfio_t* out;const char *delim;int dlen;){
+ const char *cp;
+ int d=0;
if(cp = sfgetr(in,'\n',0))
{
if(sfwrite(out,cp,sfslen()-1) < 0)
{
if(dlen)
{
- register int c;
+ int c;
if(d >= dlen)
d = 0;
if(c=delim[d++])
}
int
-b_paste __PARAM__((int argc,register char *argv[]), (argc, argv)) __OTORP__(int argc;register char *argv[];){
- register int n, sflag=0;
- register Sfio_t *fp, **streams;
- register char *cp, *delim = "\t"; /* default delimiter */
+b_paste __PARAM__((int argc,char *argv[]), (argc, argv)) __OTORP__(int argc;char *argv[];){
+ int n, sflag=0;
+ Sfio_t *fp, **streams;
+ char *cp, *delim = "\t"; /* default delimiter */
int dlen;
NoP(id[0]);
* call pathconf and handle unlimited sizes
*/
static long mypathconf __PARAM__((const char *path, int op), (path, op)) __OTORP__(const char *path; int op;){
- register long r;
+ long r;
errno=0;
if((r=pathconf(path, op))<0 && errno==0)
return(LONG_MAX);
* returns 1 if <path> passes test
*/
static int pathchk __PARAM__((char* path, int mode), (path, mode)) __OTORP__(char* path; int mode;){
- register char *cp=path, *cpold;
- register int c;
- register long r,name_max,path_max;
+ char *cp=path, *cpold;
+ int c;
+ long r,name_max,path_max;
if(mode)
{
name_max = _POSIX_NAME_MAX;
int
b_pathchk __PARAM__((int argc, char** argv), (argc, argv)) __OTORP__(int argc; char** argv;){
- register int n, mode=0;
- register char *cp;
+ int n, mode=0;
+ char *cp;
NoP(argc);
cmdinit(argv);
* reverse the characters within a line
*/
static int rev_char __PARAM__((Sfio_t *in, Sfio_t *out), (in, out)) __OTORP__(Sfio_t *in; Sfio_t *out;){
- register int c;
- register char *ep, *bp, *cp;
- register int n;
+ int c;
+ char *ep, *bp, *cp;
+ int n;
while(cp = bp = sfgetr(in,'\n',0))
{
ep = bp + (n=sfslen()) -1;
}
int
-b_rev __PARAM__((int argc, register char** argv), (argc, argv)) __OTORP__(int argc; register char** argv;){
- register Sfio_t *fp;
- register char *cp;
- register int n, line=0;
+b_rev __PARAM__((int argc, char** argv), (argc, argv)) __OTORP__(int argc; char** argv;){
+ Sfio_t *fp;
+ char *cp;
+ int n, line=0;
NOT_USED(argc);
NoP(id[0]);
* in reverse order
*/
int rev_line __PARAM__((Sfio_t *in, Sfio_t *out, off_t start), (in, out, start)) __OTORP__(Sfio_t *in; Sfio_t *out; off_t start;){
- register char *cp, *cpold;
- register int n, nleft=0;
+ char *cp, *cpold;
+ int n, nleft=0;
char buff[BUFSIZE];
off_t offset;
if(sfseek(in,(off_t)0,SEEK_CUR) < 0)
int
b_rmdir __PARAM__((int argc, char** argv), (argc, argv)) __OTORP__(int argc; char** argv;){
- register char* dir;
- register int n;
+ char* dir;
+ int n;
NoP(argc);
NoP(id[0]);
* If file is seekable, position file to tail location and return offset
* Otherwise, return -1
*/
-static off_t tailpos __PARAM__((register Sfio_t *fp, register long nitems, int delim), (fp, nitems, delim)) __OTORP__(register Sfio_t *fp; register long nitems; int delim;){
- register int nleft,n;
- register off_t offset, first, last;
+static off_t tailpos __PARAM__((Sfio_t *fp, long nitems, int delim), (fp, nitems, delim)) __OTORP__(Sfio_t *fp; long nitems; int delim;){
+ int nleft,n;
+ off_t offset, first, last;
if((first=sfseek(fp,(off_t)0,SEEK_CUR))<0)
return((off_t)-1);
last = sfsize(fp);
* This code handles tail from a pipe without any size limits
*/
static void pipetail __PARAM__((Sfio_t *infile, Sfio_t *outfile, int nitems, int delim), (infile, outfile, nitems, delim)) __OTORP__(Sfio_t *infile; Sfio_t *outfile; int nitems; int delim;){
- register Sfio_t *out;
- register int n=(2*SF_BUFSIZE), nleft=nitems, fno=0;
+ Sfio_t *out;
+ int n=(2*SF_BUFSIZE), nleft=nitems, fno=0;
off_t offset[2];
Sfio_t *tmp[2];
if(delim<0 && nitems < n)
int
b_tail __PARAM__((int argc, char** argv), (argc, argv)) __OTORP__(int argc; char** argv;){
- register Sfio_t *fp;
- register int n, delim='\n', flags=0;
+ Sfio_t *fp;
+ int n, delim='\n', flags=0;
char *cp;
off_t offset;
long number = 10;
}
if(flags&F_FLAG)
{
- register char *bufp;
+ char *bufp;
while(1)
{
sfsync(sfstdout);
*/
static int tee_write __PARAM__((Sfio_t* fp, const __V_* buf, int n, Sfdisc_t* handle), (fp, buf, n, handle)) __OTORP__(Sfio_t* fp; const __V_* buf; int n; Sfdisc_t* handle;){
- register const char* bp;
- register const char* ep;
- register int* hp = ((struct tee*)handle)->fd;
- register int fd = sffileno(fp);
- register int r;
+ const char* bp;
+ const char* ep;
+ int* hp = ((struct tee*)handle)->fd;
+ int fd = sffileno(fp);
+ int r;
do
{
static Sfdisc_t tee_disc = { 0, tee_write, 0, 0, 0 };
int
-b_tee __PARAM__((int argc, register char** argv), (argc, argv)) __OTORP__(int argc; register char** argv;){
- register struct tee* tp = 0;
- register int oflag = O_WRONLY|O_TRUNC|O_CREAT;
- register int n;
- register int* hp;
- register char* cp;
+b_tee __PARAM__((int argc, char** argv), (argc, argv)) __OTORP__(int argc; char** argv;){
+ struct tee* tp = 0;
+ int oflag = O_WRONLY|O_TRUNC|O_CREAT;
+ int n;
+ int* hp;
+ char* cp;
NoP(id[0]);
cmdinit(argv);
int
b_tty __PARAM__((int argc, char *argv[]), (argc, argv)) __OTORP__(int argc; char *argv[];){
- register int n,sflag=0;
- register char *tty;
+ int n,sflag=0;
+ char *tty;
NoP(argc);
NoP(id[0]);
};
int
-uname __PARAM__((register struct utsname* ut), (ut)) __OTORP__(register struct utsname* ut;){
+uname __PARAM__((struct utsname* ut), (ut)) __OTORP__(struct utsname* ut;){
#ifdef HOSTTYPE
char* sys = 0;
char* arch = 0;
int
b_uname __PARAM__((int argc, char** argv), (argc, argv)) __OTORP__(int argc; char** argv;){
- register int n;
- register int flags = 0;
- register char* s;
+ int n;
+ int flags = 0;
+ char* s;
char* sethost = 0;
struct utsname ut;
char* last = (char*)&ut.machine + sizeof(ut.machine);
static char *sidebuff __PARAM__((int size), (size)) __OTORP__(int size;){
static int maxbuff;
static char *buff;
- register char *cp=0;
+ char *cp=0;
if(size)
{
if(size <= maxbuff)
}
static int uniq __PARAM__((Sfio_t *fdin, Sfio_t *fdout, int fields, int chars, int mode), (fdin, fdout, fields, chars, mode)) __OTORP__(Sfio_t *fdin; Sfio_t *fdout; int fields; int chars; int mode;){
- register int n, outsize=0;
- register char *cp, *bufp, *outp;
+ int n, outsize=0;
+ char *cp, *bufp, *outp;
char *orecp, *sbufp=0, *outbuff;
int reclen,oreclen= -1,count=0, cwidth=0;
if(mode&C_FLAG)
int
b_uniq __PARAM__((int argc, char** argv), (argc, argv)) __OTORP__(int argc; char** argv;){
- register int n, mode=0;
- register char *cp;
+ int n, mode=0;
+ char *cp;
int fields=0, chars=0;
Sfio_t *fpin, *fpout;
#define ERRORMAX 125
-static void printout __PARAM__((register Wc_t *wp, register char *name,register int mode), (wp, name, mode)) __OTORP__(register Wc_t *wp; register char *name;register int mode;){
+static void printout __PARAM__((Wc_t *wp, char *name,int mode), (wp, name, mode)) __OTORP__(Wc_t *wp; char *name;int mode;){
if(mode&WC_LINES)
sfprintf(sfstdout," %7lu",wp->lines);
if(mode&WC_WORDS)
}
int
-b_wc __PARAM__((int argc,register char **argv), (argc, argv)) __OTORP__(int argc;register char **argv;){
- register char *cp;
- register int mode=0, n;
- register Wc_t *wp;
+b_wc __PARAM__((int argc,char **argv), (argc, argv)) __OTORP__(int argc;char **argv;){
+ char *cp;
+ int mode=0, n;
+ Wc_t *wp;
Sfio_t *fp;
long tlines=0, twords=0, tchars=0;
struct stat statb;
#define endline(c) (((signed char)-1)<0?(c)<0:(c)==((char)-1))
Wc_t *wc_init __PARAM__((char *space), (space)) __OTORP__(char *space;){
- register int n;
+ int n;
Wc_t *wp;
if(!(wp = (Wc_t*)stakalloc(sizeof(Wc_t))))
* compute the line, word, and character count for file <fd>
*/
wc_count __PARAM__((Wc_t *wp, Sfio_t *fd), (wp, fd)) __OTORP__(Wc_t *wp; Sfio_t *fd;){
- register signed char *space = wp->space;
- register unsigned char *cp;
- register long nwords;
- register int c;
- register unsigned char *endbuff;
- register int lasttype = 1;
+ signed char *space = wp->space;
+ unsigned char *cp;
+ long nwords;
+ int c;
+ unsigned char *endbuff;
+ int lasttype = 1;
unsigned int lastchar;
unsigned char *buff;
wp->lines = nwords = wp->chars = 0;
return 0;
}
-static int delputl __PARAM__((register int n, register long v), (n, v)) __OTORP__(register int n; register long v;){
- register int i;
+static int delputl __PARAM__((int n, long v), (n, v)) __OTORP__(int n; long v;){
+ int i;
unsigned char c[4];
for(i = 0; i < n; ++i)
return 0;
}
-static int delputs __PARAM__((register long n, register long addr), (n, addr)) __OTORP__(register long n; register long addr;){
+static int delputs __PARAM__((long n, long addr), (n, addr)) __OTORP__(long n; long addr;){
if(n < (Dend-Dnext))
{
memcpy(Dnext,Btar+addr,n);
/* write an instruction */
static int putMove __PARAM__((Move* ip), (ip)) __OTORP__(Move* ip;){
- register char inst;
+ char inst;
inst = ip->type;
inst |= (NBYTE(ip->size)&07) << 3;
/* constructor for Move */
static Move *newMove __PARAM__((int type, long size, long addr, Move* last), (type, size, addr, last)) __OTORP__(int type; long size; long addr; Move* last;){
- register Move *ip = (Move*) malloc(sizeof(Move));
+ Move *ip = (Move*) malloc(sizeof(Move));
if(!ip) return 0;
ip->type = type;
ip->size = size;
/* destructor for Move, return the elt after move */
static Move *delMove __PARAM__((Move* ip), (ip)) __OTORP__(Move* ip;){
- register Move *next = ip->next;
- register Move *last = ip->last;
+ Move *next = ip->next;
+ Move *last = ip->last;
if(last)
last->next = next;
if(next)
/* make a new add command */
static Move *makeAdd __PARAM__((char* beg, char* end, Move* last), (beg, end, last)) __OTORP__(char* beg; char* end; Move* last;){
- register Move *ip;
+ Move *ip;
ip = newMove(DELTA_ADD,(long)(end-beg),(long)(beg-Btar),NiL);
if(!ip)
/* remove small previous adjacent moves */
while(last)
{
- register int a_size, cost_m, cost_a;
+ int a_size, cost_m, cost_a;
if(last->type == DELTA_ADD)
break;
/* check to see if a move is appropriate */
static int chkMove __PARAM__((long m_size, long m_addr, long a_size), (m_size, m_addr, a_size)) __OTORP__(long m_size; long m_addr; long a_size;){
- register int cost_m, cost_a;
+ int cost_m, cost_a;
cost_m = NBYTE(m_size) + NBYTE(m_addr);
cost_a = NBYTE(m_size) + m_size;
/* it's good but it may be better to merge it to an add */
if(a_size > 0)
{
- register int m_cost, a_cost;
+ int m_cost, a_cost;
m_cost = cost_m + NBYTE(a_size) + a_size;
a_size += m_size;
}
/* optimize a sequence of moves */
-static Move *optMove __PARAM__((register Move* s), (s)) __OTORP__(register Move* s;){
- register long add, m_cost, a_cost;
- register Move *ip, *last;
+static Move *optMove __PARAM__((Move* s), (s)) __OTORP__(Move* s;){
+ long add, m_cost, a_cost;
+ Move *ip, *last;
add = (s->last && s->last->type == DELTA_ADD) ? s->last->size : 0;
a_cost = 0;
for(ip = s; ip; ip = ip->next)
{
- register long cost_m, cost_a;
+ long cost_m, cost_a;
if(ip->type == DELTA_ADD || ip->size > (M_MAX+A_MAX))
break;
/* the real thing */
int
delta __PARAM__((char* src, long n_src, char* tar, long n_tar, int delfd), (src, n_src, tar, n_tar, delfd)) __OTORP__(char* src; long n_src; char* tar; long n_tar; int delfd;){
- register char *sp, *tp, *esrc, *etar;
- register long size, addr;
+ char *sp, *tp, *esrc, *etar;
+ long size, addr;
Suftree *tree;
Move *moves, *last;
char inst, buf[BUFSIZE];
break;
if((size = src-Bsrc) > 0)
{
- register int cost_m, cost_a;
+ int cost_m, cost_a;
cost_m = NBYTE(size) + NBYTE(0);
cost_a = NBYTE(size) + size;
/* optimize move instructions */
if(moves)
{
- register Move *ip;
+ Move *ip;
ip = moves;
while(ip->last)
#define ALPHA (256) /* alphabet size */
static void freemem __PARAM__((long* n_index, char*** index), (n_index, index)) __OTORP__(long* n_index; char*** index;){
- register int i;
+ int i;
if(n_index && index)
{
for(i = 0; i < ALPHA; ++i)
/* initial assumptions: src[0] == tar[0] && src+n_match <= endsrc */
static long domatch __PARAM__((char* src, char* endsrc, char* tar, char* endtar, long n_match), (src, endsrc, tar, endtar, n_match)) __OTORP__(char* src; char* endsrc; char* tar; char* endtar; long n_match;){
- register char *sp, *tp;
+ char *sp, *tp;
/* see if this really improves on the current match */
for(sp = src+n_match, tp = tar+n_match; sp > src; --sp, --tp)
long mtchstring __PARAM__((char* src, long n_src, char* tar, long n_tar, char** match), (src, n_src, tar, n_tar, match)) __OTORP__(char* src; long n_src; char* tar; long n_tar; char** match;){
char *endsrc, *endtar;
long n_match;
- register int i;
- register long n_ind;
- register char **ind;
+ int i;
+ long n_ind;
+ char **ind;
static long *N_index = 0;
static char *Cursrc = 0, ***Index = 0;
static int Alloced = 0;
Alloced = 1;
if(N_index = (long*) malloc(ALPHA*sizeof(long)))
{
- register char *sp;
+ char *sp;
memzero(N_index,ALPHA*sizeof(long));
if(!(Index = (char ***) malloc(ALPHA*sizeof(char**))))
n_match = 0;
while(1)
{
- register long m;
+ long m;
if(ind)
{
root -= 1;
while(root)
{
- register Suftree *next;
+ Suftree *next;
next = NEXT(root);
free(root);
root = next;
/* Find a child whose label string starts with a given character */
static Suftree *child_find __PARAM__((Suftree* node, Element c), (node, c)) __OTORP__(Suftree* node; Element c;){
- register Suftree *np, *last;
+ Suftree *np, *last;
last = 0;
for(np = CHILD(node); np; np = SIBLING(np))
** of the previously inserted suffix.
*/
Suftree *bldsuftree __PARAM__((Element* src, long len), (src, len)) __OTORP__(Element* src; long len;){
- register Element *sp, *mp, *rescan, *endmatch, *endsrc;
- register Suftree *match, *clocus, *locus, *link;
- register long mtlen, relen;
- register int n;
+ Element *sp, *mp, *rescan, *endmatch, *endsrc;
+ Suftree *match, *clocus, *locus, *link;
+ long mtlen, relen;
+ int n;
Suftree *root, *list, *endlist;
if(len == 0)
string represented by the tree.
*/
long mtchsuftree __PARAM__((Suftree* tree, Element* str, long len, Element** mtchp), (tree, str, len, mtchp)) __OTORP__(Suftree* tree; Element* str; long len; Element** mtchp;){
- register Suftree *match;
- register Element *sp, *mp, *endmp, *endstr;
- register long mlen;
+ Suftree *match;
+ Element *sp, *mp, *endmp, *endstr;
+ long mlen;
mlen = 0;
endstr = str + len;
static int delgetc __PARAM__((void), ()){
if(Dnext >= Dend)
{
- register int n;
+ int n;
if((n = read(Dfd,(char*)Ddata,BUFSIZE)) <= 0)
return -1;
Dnext = Ddata, Dend = Ddata+n;
}
/* read a long value from delta file */
-static long delgetl __PARAM__((register int n), (n)) __OTORP__(register int n;){
- register long lv;
+static long delgetl __PARAM__((int n), (n)) __OTORP__(int n;){
+ long lv;
lv = 0;
for(; n > 0; --n)
{
- register int v;
+ int v;
if((v = delgetc()) < 0)
return -1;
lv = lv*256 + v;
static int filetransfer __PARAM__((int fd, long n), (fd, n)) __OTORP__(int fd; long n;){
while(n > 0)
{
- register int r;
+ int r;
if(Tnext >= Tend)
if(tarflush() < 0)
}
/* transfer a number of bytes from a memory area to the target file */
-static int memtransfer __PARAM__((unsigned char* addr, register long n), (addr, n)) __OTORP__(unsigned char* addr; register long n;){
+static int memtransfer __PARAM__((unsigned char* addr, long n), (addr, n)) __OTORP__(unsigned char* addr; long n;){
while(n > 0)
{
- register int r;
+ int r;
if(Tnext >= Tend)
if(tarflush() < 0)
/* transfer a number of bytes from delta to target */
static int deltransfer __PARAM__((long n), (n)) __OTORP__(long n;){
- register int d;
+ int d;
/* transfer what's already in core */
if((d = Dend-Dnext) > 0)
{
- register int w = n <= d ? n : d;
+ int w = n <= d ? n : d;
if(w > (Tend-Tnext))
if(tarflush() < 0)
int
update __PARAM__((int srcfd, long offset, int delfd, int tarfd), (srcfd, offset, delfd, tarfd)) __OTORP__(int srcfd; long offset; int delfd; int tarfd;){
- register int i;
- register long n_src, n_tar;
+ int i;
+ long n_src, n_tar;
unsigned char delbuf[BUFSIZE], tarbuf[BUFSIZE];
unsigned char *src, *tar;
while((i = delgetc()) >= 0)
{
- register long size, addr;
+ long size, addr;
if((size = delgetl((i>>3)&07)) < 0)
return -1;
#endif
/* short-hand notations */
-#define reg register
+#define reg /*no register keywords*/
#define uchar unsigned char
#define uint unsigned int
#define ulong unsigned long
/*
* Without this proto, standard C says that _DtGetMessage() returns
* an int, even though it really returns a pointer. The compiler is
- * then free to use the high 32-bits of the return register for
+ * then free to use the high 32-bits of the return for
* something else (like scratch), and that can garble the pointer.
*/
# ifdef _NO_PROTO
char *name,
int flag )
{
- register int i;
+ int i;
void *found;
if (!structInited)
if (found = (void *) xkhash_find(Hashnams, name))
return((memtbl_t *) found);
else {
- register int j;
- register memtbl_t **subtbl;
+ int j;
+ memtbl_t **subtbl;
for (i = 0; i < Nstructlist; i++) {
if (subtbl = Structlist[i].mem)
void
init_widgets( void )
{
- register int i, n = 0;
+ int i, n = 0;
char *nam;
wtab_t *wentries;
char * errmsg;
char *arg0,
char *s )
{
- register int i, j, n;
+ int i, j, n;
Widget w;
char *nam;
classtab_t *ret;
widget_to_wtab(
Widget w )
{
- register int i;
+ int i;
char * errmsg;
if (w == NULL)
char *name )
{
- register int i;
+ int i;
/*
* If there has been a destroywidget call, then one or more
if (NumW < MaxW) {
i = NumW++;
} else {
- register int j;
+ int j;
int oldmax = MaxW;
wtab_t *wentries;
resfixup_t *fixups )
{
XtResource *resource;
- register int i;
+ int i;
char *nam;
if (fixups == NULL)
static void
sort_and_print_res( void )
{
- register int i;
+ int i;
qsort(Res, Nres, sizeof(XtResource *), (int (*)())rescompare);
for (i = 0; i < Nres; i++) {
_pr_resource_list(Res[i]);
int argc,
char *argv[] )
{
- register int i, j;
+ int i, j;
char buf[1024];
wtab_t *w;
classtab_t *c;
wtab_t *w, *pw, *wtab, *parenttab;
char *wname, *parentid, *var;
Arg args[MAXARGS];
- register int i;
+ int i;
int n;
char * errmsg;
int pargc;
{
char *arg0 = argv[0];
wtab_t *w[6];
- register int i;
+ int i;
char * errmsg;
if (argc != 7)
char *arg0 = argv[0];
wtab_t *w, *pw, *wtab, *parenttab;
char *parentid, *var;
- register int i;
+ int i;
int n;
char * errmsg;
WidgetClass wclass;
struct named_integer *table;
int numtable;
long value;
- register int i;
+ int i;
char * errmsg;
switch(fval->size)
struct named_integer *table;
int numtable;
char *value;
- register int i;
+ int i;
char * errbuf;
char * errmsg;
void
toolkit_init_widgets( void )
{
- register int i, n = 0;
+ int i, n = 0;
struct namnod *nam;
if (C[0].class != NULL)