summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--deleted_files/usr/src/cmd/csh/stubs.c (renamed from usr/src/cmd/csh/stubs.c)0
-rw-r--r--usr/src/cmd/csh/Makefile35
-rw-r--r--usr/src/cmd/csh/csh.xcl38
-rw-r--r--usr/src/cmd/csh/i386/Makefile8
-rw-r--r--usr/src/cmd/csh/i386/signal.c31
-rw-r--r--usr/src/cmd/csh/printf.c4
-rw-r--r--usr/src/cmd/csh/sh.c178
-rw-r--r--usr/src/cmd/csh/sh.debug.c6
-rw-r--r--usr/src/cmd/csh/sh.dir.c93
-rw-r--r--usr/src/cmd/csh/sh.dol.c73
-rw-r--r--usr/src/cmd/csh/sh.err.c32
-rw-r--r--usr/src/cmd/csh/sh.exec.c80
-rw-r--r--usr/src/cmd/csh/sh.exp.c152
-rw-r--r--usr/src/cmd/csh/sh.file.c166
-rw-r--r--usr/src/cmd/csh/sh.func.c58
-rw-r--r--usr/src/cmd/csh/sh.glob.c157
-rw-r--r--usr/src/cmd/csh/sh.h108
-rw-r--r--usr/src/cmd/csh/sh.hist.c42
-rw-r--r--usr/src/cmd/csh/sh.lex.c198
-rw-r--r--usr/src/cmd/csh/sh.misc.c159
-rw-r--r--usr/src/cmd/csh/sh.parse.c115
-rw-r--r--usr/src/cmd/csh/sh.print.c19
-rw-r--r--usr/src/cmd/csh/sh.proc.c196
-rw-r--r--usr/src/cmd/csh/sh.proc.h7
-rw-r--r--usr/src/cmd/csh/sh.sem.c30
-rw-r--r--usr/src/cmd/csh/sh.set.c178
-rw-r--r--usr/src/cmd/csh/sh.tchar.c5
-rw-r--r--usr/src/cmd/csh/sh.time.c6
-rw-r--r--usr/src/cmd/csh/sparc/Makefile8
-rw-r--r--usr/src/cmd/csh/sparc/signal.c31
30 files changed, 1094 insertions, 1119 deletions
diff --git a/usr/src/cmd/csh/stubs.c b/deleted_files/usr/src/cmd/csh/stubs.c
index 8237fc9fb9..8237fc9fb9 100644
--- a/usr/src/cmd/csh/stubs.c
+++ b/deleted_files/usr/src/cmd/csh/stubs.c
diff --git a/usr/src/cmd/csh/Makefile b/usr/src/cmd/csh/Makefile
index 869fe7efc3..ed69dbf093 100644
--- a/usr/src/cmd/csh/Makefile
+++ b/usr/src/cmd/csh/Makefile
@@ -1,4 +1,4 @@
-# Copyright 2003 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
# Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T
@@ -32,15 +32,13 @@ clean := TARGET = clean
clobber := TARGET = clobber
lint := TARGET = lint
-PFOBJS = sh_policy.o
-
POBJS = \
-sh.o sh.char.o sh.debug.o\
+sh.o sh.char.o \
sh.dir.o sh.dol.o sh.err.o sh.exec.o sh.exp.o\
sh.file.o sh.func.o sh.glob.o sh.hist.o\
sh.init.o sh.lex.o sh.misc.o sh.parse.o\
sh.print.o sh.proc.o sh.sem.o sh.set.o\
-sh.tchar.o sh.time.o stubs.o wait3.o printf.o
+sh.tchar.o sh.time.o wait3.o printf.o
CPPFLAGS += -D_FILE_OFFSET_BITS=64
CPPFLAGS += -I ../sh
@@ -49,19 +47,9 @@ CPPFLAGS += -I ../sh
all install clean clobber lint: $(MACH)
-PFPOFILES= $(PFOBJS:%.o=%.po)
-
-POFILES= \
-sh.po sh.char.po sh.debug.po\
-sh.dir.po sh.dol.po sh.err.po sh.exec.po sh.exp.po\
-sh.file.po sh.func.po sh.glob.po sh.hist.po\
-sh.init.po sh.lex.po sh.misc.po sh.parse.po\
-sh.print.po sh.proc.po sh.sem.po sh.set.po\
-sh.tchar.po sh.time.po stubs.po wait3.po\
-$(PFPOFILES)
-
-XGETFLAGS= -a -x csh.xcl
+POFILES= $(POBJS:%.o=%.po)
+XGETFLAGS += -a -x csh.xcl
#
# For message catalogue files
@@ -72,21 +60,12 @@ _msg: $(MSGDOMAIN) sh.tconst.h .WAIT $(POFILE)
$(RM) $(MSGDOMAIN)/$(POFILE)
$(CP) $(POFILE) $(MSGDOMAIN)
+$(MSGDOMAIN):
+ $(INS.dir)
$(POFILE): $(POFILES)
$(RM) $@; cat $(POFILES) > $@
-# based on .c.po, BUILD.po from Makefile.master
-%.po: ../sh/%.c
- $(COMPILE.cpp) $< > $(<F).i
- $(XGETTEXT) $(XGETFLAGS) $(<F).i ;\
- $(RM) $@ ;\
- sed "/^domain/d" < messages.po > $@ ;\
- $(RM) messages.po $(<F).i
-
-$(PROG): $$(POBJS)
- $(LINK.c) $(POBJS) -o $@
-
sh.tconst.h:
$(RM) $@; $(ED) sh.tconst.c < make.sh.tconst.h.ed
diff --git a/usr/src/cmd/csh/csh.xcl b/usr/src/cmd/csh/csh.xcl
index 0ce57aa03f..c628e6fd87 100644
--- a/usr/src/cmd/csh/csh.xcl
+++ b/usr/src/cmd/csh/csh.xcl
@@ -37,7 +37,37 @@ msgid "\r"
msgid "^R\n"
msgid "login"
msgid "vb"
-msgid "getwd: can't stat /"
-msgid "getwd: can't stat ."
-msgid "getwd: can't open .."
-msgid "getwd: read error in .."
+msgid "getwd: can't stat /"
+msgid "getwd: can't stat ."
+msgid "getwd: can't open .."
+msgid "getwd: read error in .."
+msgid "%s\n"
+msgid "\n"
+msgid "%s"
+msgid "/dev/fd/%d"
+msgid "%s: "
+msgid "%t"
+msgid "~%t"
+msgid "%t: "
+msgid "%o\n"
+msgid "%t \t"
+msgid "%s %t"
+msgid "%6d\t"
+msgid "%llu:"
+msgid "%llu"
+msgid "%d:"
+msgid "%d"
+msgid "%llu%llu"
+msgid "%d%d"
+msgid "[%d]"
+msgid " %d"
+msgid "[%d]%s %c "
+msgid "%5d "
+msgid "%-21s"
+msgid " |"
+msgid " &"
+msgid "\n\t"
+msgid "%s "
+msgid "%d: "
+msgid "%d%%"
+msgid "%d.%01d"
diff --git a/usr/src/cmd/csh/i386/Makefile b/usr/src/cmd/csh/i386/Makefile
index 8abdf43d36..7cf378e273 100644
--- a/usr/src/cmd/csh/i386/Makefile
+++ b/usr/src/cmd/csh/i386/Makefile
@@ -1,4 +1,4 @@
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T
@@ -24,8 +24,8 @@ include ../../Makefile.cmd
MBCHAR = -DMBCHAR # Define this line to include multibyte input support
DEFS = -DVFORK -DFILEC -DBSD_COMP -DFIVE # No TELL when MBCHAR
-CPPFLAGS= -I. -s $(DEFS) $(MBCHAR) $(CPPFLAGS.master)
-CPPFLAGS += -I ../../sh
+CPPFLAGS= -I. $(DEFS) $(MBCHAR) $(CPPFLAGS.master)
+CPPFLAGS += -I../../sh
CPPFLAGS += -D_FILE_OFFSET_BITS=64
LAZYLIBS = $(ZLAZYLOAD) -lsecdb $(ZNOLAZYLOAD)
lint := LAZYLIBS = -lsecdb
@@ -74,7 +74,7 @@ $(ROOTPFCSH): $(ROOTPROG)
sh.tconst.h: ../sh.tconst.c ../make.sh.tconst.h.ed
$(RM) $@
ed ../sh.tconst.c < ../make.sh.tconst.h.ed
-
+
$(HDDEP): sh.tconst.h
install: all $(ROOTBINPROG) $(ROOTPROG) $(ROOTPFCSH)
diff --git a/usr/src/cmd/csh/i386/signal.c b/usr/src/cmd/csh/i386/signal.c
index 092a200ab5..d023a9bd88 100644
--- a/usr/src/cmd/csh/i386/signal.c
+++ b/usr/src/cmd/csh/i386/signal.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -64,15 +64,12 @@ void (*_siguhandler[NSIG])() = { 0 };
*/
static void
-sigvechandler(sig, sip, ucp)
- int sig;
- siginfo_t *sip;
- ucontext_t *ucp;
+sigvechandler(int sig, siginfo_t *sip, ucontext_t *ucp)
{
struct sigcontext sc;
int code;
char *addr;
- register int i, j;
+ int i, j;
int gwinswitch = 0;
sc.sc_onstack = ((ucp->uc_stack.ss_flags & SS_ONSTACK) != 0);
@@ -124,8 +121,8 @@ sigvechandler(sig, sip, ucp)
setcontext (ucp);
}
-sigsetmask(mask)
- int mask;
+int
+sigsetmask(int mask)
{
sigset_t oset;
sigset_t nset;
@@ -136,8 +133,8 @@ sigsetmask(mask)
return set2mask(&oset);
}
-sigblock(mask)
- int mask;
+int
+sigblock(int mask)
{
sigset_t oset;
sigset_t nset;
@@ -148,8 +145,8 @@ sigblock(mask)
return set2mask(&oset);
}
-sigpause(mask)
- int mask;
+int
+sigpause(int mask)
{
sigset_t set;
@@ -158,10 +155,8 @@ sigpause(mask)
return (sigsuspend(&set));
}
-sigvec(sig, nvec, ovec)
- int sig;
- struct sigvec *nvec;
- struct sigvec *ovec;
+int
+sigvec(int sig, struct sigvec *nvec, struct sigvec *ovec)
{
struct sigaction nact;
struct sigaction oact;
@@ -223,9 +218,7 @@ sigvec(sig, nvec, ovec)
void (*
-signal(s, a))()
- int s;
- void (*a)();
+signal(int s, void (*a)()))()
{
struct sigvec osv;
struct sigvec nsv;
diff --git a/usr/src/cmd/csh/printf.c b/usr/src/cmd/csh/printf.c
index 68272cb5a4..3867413493 100644
--- a/usr/src/cmd/csh/printf.c
+++ b/usr/src/cmd/csh/printf.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -51,6 +51,8 @@ printf(const char *format, ...)
va_start(stupid, format);
_print(p, &stupid);
va_end(stupid);
+
+ return (0);
}
/*
diff --git a/usr/src/cmd/csh/sh.c b/usr/src/cmd/csh/sh.c
index 9d3e30860a..3a2b7a3d12 100644
--- a/usr/src/cmd/csh/sh.c
+++ b/usr/src/cmd/csh/sh.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -52,15 +52,32 @@ extern gid_t getegid(), getgid();
extern uid_t geteuid(), getuid();
extern tchar **strblktotsblk(/* char **, int */);
-int siglwp();
-int sigwaiting();
-
-main(c, av)
- int c;
- char **av;
+void importpath(tchar *);
+void srccat(tchar *, tchar *);
+void srccat_inlogin(tchar *, tchar *);
+void srcunit(int, bool, bool);
+void rechist(void);
+void goodbye(void);
+void pintr1(bool);
+void process(bool);
+void dosource(tchar **);
+void mailchk(void);
+void printprompt(void);
+void sigwaiting(void);
+void siglwp(void);
+void initdesc(int, char *[]);
+void initdesc_x(int, char *[], int);
+void closem(void);
+void unsetfd(int);
+void secpolicy_print(int, const char *);
+void phup(void);
+
+
+int
+main(int c, char **av)
{
- register tchar **v, *cp, *p, *q, *r;
- register int f;
+ tchar **v, *cp, *p, *q, *r;
+ int f;
struct sigvec osv;
struct sigaction sa;
tchar s_prompt[MAXHOSTNAMELEN+3];
@@ -507,7 +524,8 @@ notty:
exitstat();
}
-untty()
+void
+untty(void)
{
if (tpgrp > 0) {
@@ -516,12 +534,12 @@ untty()
}
}
-importpath(cp)
- tchar *cp;
+void
+importpath(tchar *cp)
{
- register int i = 0;
- register tchar *dp;
- register tchar **pv;
+ int i = 0;
+ tchar *dp;
+ tchar **pv;
int c;
static tchar dot[2] = {'.', 0};
@@ -556,11 +574,11 @@ importpath(cp)
/*
* Source to the file which is the catenation of the argument names.
*/
-srccat(cp, dp)
- tchar *cp, *dp;
+void
+srccat(tchar *cp, tchar *dp)
{
- register tchar *ep = strspl(cp, dp);
- register int unit = dmove(open_(ep, 0), -1);
+ tchar *ep = strspl(cp, dp);
+ int unit = dmove(open_(ep, 0), -1);
(void) fcntl(unit, F_SETFD, 1);
xfree(ep);
@@ -575,11 +593,11 @@ srccat(cp, dp)
* Source to the file which is the catenation of the argument names.
* This one does not check the ownership.
*/
-srccat_inlogin(cp, dp)
- tchar *cp, *dp;
+void
+srccat_inlogin(tchar *cp, tchar *dp)
{
- register tchar *ep = strspl(cp, dp);
- register int unit = dmove(open_(ep, 0), -1);
+ tchar *ep = strspl(cp, dp);
+ int unit = dmove(open_(ep, 0), -1);
(void) fcntl(unit, F_SETFD, 1);
xfree(ep);
@@ -590,10 +608,8 @@ srccat_inlogin(cp, dp)
* Source to a unit. If onlyown it must be our file or our group or
* we don't chance it. This occurs on ".cshrc"s and the like.
*/
-srcunit(unit, onlyown, hflg)
- register int unit;
- bool onlyown;
- bool hflg;
+void
+srcunit(int unit, bool onlyown, bool hflg)
{
/* We have to push down a lot of state here */
/* All this could go into a structure */
@@ -670,7 +686,7 @@ srcunit(unit, onlyown, hflg)
if (setintr)
(void) sigsetmask(omask);
if (oSHIN >= 0) {
- register int i;
+ int i;
/* We made it to the new state... free up its storage */
/* This code could get run twice but xfree doesn't care */
@@ -703,7 +719,8 @@ srcunit(unit, onlyown, hflg)
error(NULL);
}
-rechist()
+void
+rechist(void)
{
tchar buf[BUFSIZ];
int fp, ftmp, oldidfds;
@@ -730,7 +747,8 @@ rechist()
}
}
-goodbye()
+void
+goodbye(void)
{
if (loginsh) {
(void) signal(SIGQUIT, SIG_IGN);
@@ -744,7 +762,8 @@ goodbye()
exitstat();
}
-exitstat()
+void
+exitstat(void)
{
#ifdef PROF
@@ -764,7 +783,7 @@ exitstat()
* in the event of a HUP we want to save the history
*/
void
-phup()
+phup(void)
{
rechist();
exit(1);
@@ -779,15 +798,15 @@ tchar *jobargv[2] = { S_jobs/*"jobs"*/, 0 };
* gets a chance to make the shell go away.
*/
void
-pintr()
+pintr(void)
{
pintr1(1);
}
-pintr1(wantnl)
- bool wantnl;
+void
+pintr1(bool wantnl)
{
- register tchar **v;
+ tchar **v;
int omask;
omask = sigblock(0);
@@ -835,11 +854,11 @@ pintr1(wantnl)
* Note that if catch is not set then we will unwind on any error.
* If an end-of-file occurs, we return.
*/
-process(catch)
- bool catch;
+void
+process(bool catch)
{
jmp_buf osetexit;
- register struct command *t;
+ struct command *t;
getexit(osetexit);
for (;;) {
@@ -977,11 +996,11 @@ process(catch)
resexit(osetexit);
}
-dosource(t)
- register tchar **t;
+void
+dosource(tchar **t)
{
- register tchar *f;
- register int u;
+ tchar *f;
+ int u;
bool hflg = 0;
tchar buf[BUFSIZ];
@@ -1011,10 +1030,11 @@ dosource(t)
* knows, since the login program insists on saying
* "You have mail."
*/
-mailchk()
+void
+mailchk(void)
{
- register struct varent *v;
- register tchar **vp;
+ struct varent *v;
+ tchar **vp;
time_t t;
int intvl, cnt;
struct stat stb;
@@ -1053,13 +1073,13 @@ mailchk()
* user whose home directory is sought is currently.
* We write the home directory of the user back there.
*/
-gethdir(home)
- tchar *home;
+int
+gethdir(tchar *home)
{
/* getpwname will not be modified, so we need temp. buffer */
char home_str[BUFSIZ];
tchar home_ts[BUFSIZ];
- register struct passwd *pp /*= getpwnam(home)*/;
+ struct passwd *pp /*= getpwnam(home)*/;
pp = getpwnam(tstostr(home_str, home));
if (pp == 0)
@@ -1070,12 +1090,12 @@ gethdir(home)
/*
+void
#ifdef PROF
-done(i)
+done(int i)
#else
-exit(i)
+exit(int i)
#endif
- int i;
{
untty();
@@ -1083,9 +1103,10 @@ exit(i)
}
*/
-printprompt()
+void
+printprompt(void)
{
- register tchar *cp;
+ tchar *cp;
if (!whyles) {
/*
@@ -1112,11 +1133,9 @@ printprompt()
* Save char * block.
*/
tchar **
-strblktotsblk(v, num)
- register char **v;
- int num;
+strblktotsblk(char **v, int num)
{
- register tchar **newv =
+ tchar **newv =
(tchar **) calloc((unsigned) (num+ 1), sizeof (tchar **));
tchar **onewv = newv;
@@ -1126,13 +1145,14 @@ strblktotsblk(v, num)
return (onewv);
}
-
-sigwaiting()
+void
+sigwaiting(void)
{
_signal(SIGWAITING, sigwaiting);
}
-siglwp()
+void
+siglwp(void)
{
_signal(SIGLWP, siglwp);
}
@@ -1168,16 +1188,14 @@ static int NoFile = NOFILE; /* The number of files I can use. */
* If is_reinit is set in initdesc_x(), then we only close the file
* descriptors that we actually opened (as recorded in fdinuse).
*/
-initdesc(argc, argv)
- int argc;
- char *argv[];
+void
+initdesc(int argc, char *argv[])
{
initdesc_x(argc, argv, 0);
}
-reinitdesc(argc, argv)
- int argc;
- char *argv[];
+void
+reinitdesc(int argc, char *argv[])
{
initdesc_x(argc, argv, 1);
}
@@ -1208,10 +1226,8 @@ close_inuse(void *cd, int fd)
return (0);
}
-initdesc_x(argc, argv, is_reinit)
- int argc;
- char *argv[];
- int is_reinit;
+void
+initdesc_x(int argc, char *argv[], int is_reinit)
{
int script_fd = -1;
@@ -1292,9 +1308,10 @@ initdesc_x(argc, argv, is_reinit)
* After you have removed the files, you can clear the
* list and max_fd.
*/
-closem()
+void
+closem(void)
{
- register int f;
+ int f;
for (f = 3; f <= max_fd; f++) {
if (CSH_FD_ISSET(f, fdinuse) &&
@@ -1311,7 +1328,8 @@ closem()
* if you want the process to affect fdinuse (e.g., fork, but
* not vfork).
*/
-new_process()
+void
+new_process(void)
{
my_pid = getpid();
}
@@ -1334,8 +1352,8 @@ new_process()
* close(fd);
* unsetfd(fd);
*/
-setfd(fd)
- int fd;
+void
+setfd(int fd)
{
/*
* Because you want to avoid
@@ -1352,10 +1370,10 @@ setfd(fd)
CSH_FD_SET(fd, fdinuse);
}
-unsetfd(fd)
- int fd;
+void
+unsetfd(int fd)
{
- register int i;
+ int i;
/*
* Because you want to avoid
@@ -1392,7 +1410,7 @@ secpolicy_print(int level, const char *msg)
printf("%s: ", msg); /* printf() does gettext() */
break;
case SECPOLICY_ERROR:
- bferr(msg); /* bferr() does gettext() */
+ bferr((char *)msg); /* bferr() does gettext() */
break;
}
}
diff --git a/usr/src/cmd/csh/sh.debug.c b/usr/src/cmd/csh/sh.debug.c
index 379a327f93..4a442e75da 100644
--- a/usr/src/cmd/csh/sh.debug.c
+++ b/usr/src/cmd/csh/sh.debug.c
@@ -1,5 +1,5 @@
/*
- * Copyright 1990 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -29,7 +29,8 @@ FILE *trace;
* Initialie trace file.
* Called from main.
*/
-trace_init()
+void
+trace_init(void)
{
extern char *mktemp();
char name[128];
@@ -44,6 +45,7 @@ trace_init()
* write message to trace file
*/
/*VARARGS1*/
+void
tprintf(fmt,a,b,c,d,e,f,g,h,i,j)
char *fmt;
{
diff --git a/usr/src/cmd/csh/sh.dir.c b/usr/src/cmd/csh/sh.dir.c
index 407b1ec6cc..00fa768e51 100644
--- a/usr/src/cmd/csh/sh.dir.c
+++ b/usr/src/cmd/csh/sh.dir.c
@@ -22,9 +22,13 @@
* C Shell - directory management
*/
-struct directory *dfind();
-tchar *dfollow();
-tchar *dcanon();
+struct directory *dfind(tchar *);
+tchar *dfollow(tchar *);
+tchar *dcanon(tchar *, tchar *);
+void dtildepr(tchar *, tchar *);
+void dfree(struct directory *);
+void dnewcwd(struct directory *);
+
struct directory dhead; /* "head" of loop */
int printd; /* force name to be printed */
static tchar *fakev[] = { S_dirs, NOSTR };
@@ -32,11 +36,11 @@ static tchar *fakev[] = { S_dirs, NOSTR };
/*
* dinit - initialize current working directory
*/
-dinit(hp)
- tchar *hp;
+void
+dinit(tchar *hp)
{
- register tchar *cp;
- register struct directory *dp;
+ tchar *cp;
+ struct directory *dp;
tchar path[MAXPATHLEN];
#ifdef TRACE
@@ -70,10 +74,10 @@ dinit(hp)
/*
* dodirs - list all directories in directory loop
*/
-dodirs(v)
- tchar **v;
+void
+dodirs(tchar **v)
{
- register struct directory *dp;
+ struct directory *dp;
bool lflag;
tchar *hp = value(S_home);
@@ -102,8 +106,8 @@ dodirs(v)
printf("\n");
}
-dtildepr(home, dir)
- register tchar *home, *dir;
+void
+dtildepr(tchar *home, tchar *dir)
{
#ifdef TRACE
@@ -118,11 +122,11 @@ dtildepr(home, dir)
/*
* dochngd - implement chdir command.
*/
-dochngd(v)
- tchar **v;
+void
+dochngd(tchar **v)
{
- register tchar *cp;
- register struct directory *dp;
+ tchar *cp;
+ struct directory *dp;
#ifdef TRACE
tprintf("TRACE- dochngd()\n");
@@ -159,10 +163,9 @@ flushcwd:
* dfollow - change to arg directory; fall back on cdpath if not valid
*/
tchar *
-dfollow(cp)
- register tchar *cp;
+dfollow(tchar *cp)
{
- register tchar *dp;
+ tchar *dp;
struct varent *c;
int cdhashval, cdhashval1;
int index;
@@ -194,9 +197,9 @@ dfollow(cp)
&& !prefix(S_DOTDOTSLA /* "../" */, cp)
&& (c = adrof(S_cdpath))
&& ( !havhash2 || slash) ) {
- tchar **cdp;
- register tchar *p;
- tchar buf[MAXPATHLEN];
+ tchar **cdp;
+ tchar *p;
+ tchar buf[MAXPATHLEN];
for (cdp = c->vec; *cdp; cdp++) {
for (dp = buf, p = *cdp; *dp++ = *p++;)
@@ -263,7 +266,7 @@ dfollow(cp)
* checked manually
*/
else {
- register tchar *p;
+ tchar *p;
tchar buf[MAXPATHLEN];
for (dp = buf, p = *pv; *dp++ = *p++; )
@@ -299,7 +302,7 @@ dfollow(cp)
gotcha:
if (*cp != '/') {
- register tchar *p, *q;
+ tchar *p, *q;
int cwdlen;
int len;
@@ -361,10 +364,10 @@ gotcha:
* with no arguments exchange top and second.
* with numeric argument (+n) bring it to top.
*/
-dopushd(v)
- tchar **v;
+void
+dopushd(tchar **v)
{
- register struct directory *dp;
+ struct directory *dp;
#ifdef TRACE
tprintf("TRACE- dopushd()\n");
@@ -387,7 +390,7 @@ dopushd(v)
if (chdir_(dp->di_name) < 0)
Perror(dp->di_name);
} else {
- register tchar *cp;
+ tchar *cp;
cp = dfollow(*v);
dp = (struct directory *)calloc(sizeof (struct directory), 1);
@@ -405,12 +408,11 @@ dopushd(v)
* dfind - find a directory if specified by numeric (+n) argument
*/
struct directory *
-dfind(cp)
- register tchar *cp;
+dfind(tchar *cp)
{
- register struct directory *dp;
- register int i;
- register tchar *ep;
+ struct directory *dp;
+ int i;
+ tchar *ep;
#ifdef TRACE
tprintf("TRACE- dfind()\n");
@@ -437,10 +439,10 @@ dfind(cp)
* dopopd - pop a directory out of the directory stack
* with a numeric argument just discard it.
*/
-dopopd(v)
- tchar **v;
+void
+dopopd(tchar **v)
{
- register struct directory *dp, *p;
+ struct directory *dp, *p;
#ifdef TRACE
tprintf("TRACE- dopopd()\n");
@@ -470,8 +472,8 @@ dopopd(v)
/*
* dfree - free the directory (or keep it if it still has ref count)
*/
-dfree(dp)
- register struct directory *dp;
+void
+dfree(struct directory *dp)
{
#ifdef TRACE
@@ -492,13 +494,12 @@ dfree(dp)
* resulting pathname to contain no symbolic link components.
*/
tchar *
-dcanon(cp, p)
- register tchar *cp, *p;
+dcanon(tchar *cp, tchar *p)
{
- register tchar *sp; /* rightmost component currently under
+ tchar *sp; /* rightmost component currently under
consideration */
- register tchar *p1, /* general purpose */
- *p2;
+ tchar *p1, /* general purpose */
+ *p2;
bool slash, dotdot, hardpaths;
#ifdef TRACE
@@ -717,8 +718,8 @@ dcanon(cp, p)
* dnewcwd - make a new directory in the loop the current one
* and export its name to the PWD environment variable.
*/
-dnewcwd(dp)
- register struct directory *dp;
+void
+dnewcwd(struct directory *dp)
{
#ifdef TRACE
@@ -732,7 +733,7 @@ dnewcwd(dp)
* here to verify that dcwd->di_name really does
* name the current directory. Later...
*/
-#endif notdef
+#endif /* notdef */
didchdir=1;
set(S_cwd, savestr(dcwd->di_name));
diff --git a/usr/src/cmd/csh/sh.dol.c b/usr/src/cmd/csh/sh.dol.c
index ed97399eb5..57176d0ad6 100644
--- a/usr/src/cmd/csh/sh.dol.c
+++ b/usr/src/cmd/csh/sh.dol.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -52,15 +52,20 @@ int dolcnt; /* Count of further words */
tchar dolmod; /* : modifier character */
int dolmcnt; /* :gx -> 10000, else 1 */
+void Dfix2(tchar **);
+void Dgetdol(void);
+void setDolp(tchar *);
+void unDredc(int);
+
/*
* Fix up the $ expansions and quotations in the
* argument list to command t.
*/
-Dfix(t)
- register struct command *t;
+void
+Dfix(struct command *t)
{
- register tchar **pp;
- register tchar *p;
+ tchar **pp;
+ tchar *p;
#ifdef TRACE
tprintf("TRACE- Dfix()\n");
@@ -83,8 +88,7 @@ Dfix(t)
* $ substitute one word, for i/o redirection
*/
tchar *
-Dfix1(cp)
- register tchar *cp;
+Dfix1(tchar *cp)
{
tchar *Dv[2];
@@ -107,8 +111,8 @@ Dfix1(cp)
/*
* Subroutine to do actual fixing after state initialization.
*/
-Dfix2(v)
- tchar **v;
+void
+Dfix2(tchar **v)
{
tchar *agargv[GAVSIZ];
@@ -130,13 +134,14 @@ Dfix2(v)
* here is that we don't get a newline to terminate our expansion.
* Rather, DgetC will return a DEOF when we hit the end-of-input.
*/
-Dword()
+int
+Dword(void)
{
- register int c, c1;
+ int c, c1;
static tchar *wbuf = NULL;
static int wbufsiz = BUFSIZ;
- register int wp = 0;
- register bool dolflg;
+ int wp = 0;
+ bool dolflg;
bool sofar = 0;
#define DYNAMICBUFFER() \
do { \
@@ -270,10 +275,10 @@ ret:
* Any QUOTES character which is returned from a $ expansion is
* QUOTEd so that it will not be recognized above.
*/
-DgetC(flag)
- register int flag;
+int
+DgetC(int flag)
{
- register int c;
+ int c;
top:
if (c = Dpeekc) {
@@ -326,10 +331,11 @@ struct varent nulargv = { nulvec, S_argv, 0 };
* Handle the multitudinous $ expansion forms.
* Ugh.
*/
-Dgetdol()
+void
+Dgetdol(void)
{
- register tchar *np;
- register struct varent *vp;
+ tchar *np;
+ struct varent *vp;
tchar name[MAX_VREF_LEN];
int c, sc;
int subscr = 0, lwb = 1, upb = 0;
@@ -474,7 +480,7 @@ syntax:
if (!*np)
goto syntax;
if (digit(*np)) {
- register int i = 0;
+ int i = 0;
while (digit(*np))
i = i * 10 + *np++ - '0';
@@ -493,7 +499,7 @@ oob:
else if (*np != '-')
goto syntax;
else {
- register int i = upb;
+ int i = upb;
np++;
if (digit(*np)) {
@@ -553,10 +559,10 @@ eatbrac:
}
}
-setDolp(cp)
- register tchar *cp;
+void
+setDolp(tchar *cp)
{
- register tchar *dp;
+ tchar *dp;
#ifdef TRACE
tprintf("TRACE- setDolp()\n");
@@ -575,16 +581,17 @@ setDolp(cp)
dolp = S_/*""*/;
}
-unDredc(c)
- int c;
+void
+unDredc(int c)
{
Dpeekrd = c;
}
+int
Dredc()
{
- register int c;
+ int c;
if (c = Dpeekrd) {
Dpeekrd = 0;
@@ -600,8 +607,8 @@ Dredc()
return (' ');
}
-Dtestq(c)
- register int c;
+void
+Dtestq(int c)
{
if (cmap(c, QUOTES))
@@ -613,14 +620,14 @@ Dtestq(c)
* of the shell input up to a line the same as "term".
* Unit 0 should have been closed before this call.
*/
-heredoc(term)
- tchar *term;
+void
+heredoc(tchar *term)
{
- register int c;
+ int c;
tchar *Dv[2];
tchar obuf[BUFSIZ], lbuf[BUFSIZ], mbuf[BUFSIZ];
int ocnt, lcnt, mcnt;
- register tchar *lbp, *obp, *mbp;
+ tchar *lbp, *obp, *mbp;
tchar **vp;
bool quoted;
tchar shtemp[] = {'/', 't', 'm', 'p', '/', 's', 'h', 'X', 'X', 'X',
diff --git a/usr/src/cmd/csh/sh.err.c b/usr/src/cmd/csh/sh.err.c
index ee4ebfbb89..813450b297 100644
--- a/usr/src/cmd/csh/sh.err.c
+++ b/usr/src/cmd/csh/sh.err.c
@@ -1,5 +1,5 @@
/*
- * Copyright 1997 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -17,6 +17,7 @@
#include "sh.h"
#include <locale.h>
#include <dirent.h>
+#include <string.h>
/*
* #include <sys/ioctl.h>
* #include <stdlib.h>
@@ -48,11 +49,12 @@ DIR *Dirp = NULL;
* place error unwinds are ever caught.
*/
/*VARARGS1*/
+void
error(s, a1, a2)
char *s;
{
- register tchar **v;
- register char *ep;
+ tchar **v;
+ char *ep;
/*
* Must flush before we print as we wish output before the error
@@ -114,8 +116,8 @@ error(s, a1, a2)
* Perror is the shells version of perror which should otherwise
* never be called.
*/
-Perror(s)
- tchar *s;
+void
+Perror(tchar *s)
{
char chbuf[BUFSIZ];
@@ -124,7 +126,7 @@ Perror(s)
* we must set up unit 2 now else the diagnostic will disappear
*/
if (!didfds) {
- register int oerrno = errno;
+ int oerrno = errno;
(void) dcopy(SHDIAG, 2);
errno = oerrno;
@@ -134,8 +136,8 @@ Perror(s)
error(NULL); /* To exit or unwind */
}
-bferr(cp)
- char *cp;
+void
+bferr(char *cp)
{
flush();
@@ -149,8 +151,8 @@ bferr(cp)
* which sets the variable err as a side effect; later to be tested,
* e.g. in process.
*/
-seterr(s)
- char *s;
+void
+seterr(char *s)
{
if (err == 0)
@@ -158,9 +160,8 @@ seterr(s)
}
/* Set err to a splice of cp and dp, to be freed later in error() */
-seterr2(cp, dp)
- tchar *cp;
- char *dp;
+void
+seterr2(tchar *cp, char *dp)
{
char chbuf[BUFSIZ];
char *gdp;
@@ -179,9 +180,8 @@ seterr2(cp, dp)
}
/* Set err to a splice of cp with a string form of character d */
-seterrc(cp, d)
- char *cp;
- tchar d;
+void
+seterrc(char *cp, tchar d)
{
char chbuf[MB_LEN_MAX+1];
diff --git a/usr/src/cmd/csh/sh.exec.c b/usr/src/cmd/csh/sh.exec.c
index d0dd6dea7f..a696f77c5c 100644
--- a/usr/src/cmd/csh/sh.exec.c
+++ b/usr/src/cmd/csh/sh.exec.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -41,16 +41,22 @@
*/
char *exerr; /* Execution error message */
+void pexerr(void);
+void texec(struct command *, tchar *, tchar **);
+void xechoit(tchar **);
+void dohash(char []);
-extern DIR *opendir_();
+static void tconvert(struct command *, tchar *, tchar **);
-doexec(t)
- register struct command *t;
+extern DIR *opendir_(tchar *);
+
+void
+doexec(struct command *t)
{
tchar *sav;
- register tchar *dp, **pv, **av;
- register struct varent *v;
+ tchar *dp, **pv, **av;
+ struct varent *v;
bool slash;
int hashval, hashval1, i;
tchar *blk[2];
@@ -166,7 +172,8 @@ cont:
pexerr();
}
-pexerr()
+void
+pexerr(void)
{
#ifdef TRACE
@@ -183,14 +190,12 @@ pexerr()
* Record error message if not found.
* Also do shell scripts here.
*/
-texec(cmd, f, t)
- register struct command *cmd;
- tchar *f;
- register tchar **t;
+void
+texec(struct command *cmd, tchar *f, tchar **t)
{
- register int pfstatus = 0;
- register struct varent *v;
- register tchar **vp;
+ int pfstatus = 0;
+ struct varent *v;
+ tchar **vp;
tchar *lastsh[2];
#ifdef TRACE
@@ -224,7 +229,7 @@ texec(cmd, f, t)
case ENOEXEC:
/* check that this is not a binary file */
{
- register int ff = open_(f, 0);
+ int ff = open_(f, 0);
tchar ch;
if (ff != -1 && read_(ff, &ch, 1) == 1 && !isprint(ch)
@@ -247,7 +252,7 @@ texec(cmd, f, t)
v = adrof1(S_shell /*"shell"*/, &aliases);
if (v == 0) {
#ifdef OTHERSH
- register int ff = open_(f, 0);
+ int ff = open_(f, 0);
tchar ch;
#endif
@@ -299,13 +304,11 @@ texec(cmd, f, t)
}
-static
-tconvert(cmd, fname, list)
-register struct command *cmd;
-register tchar *fname, **list;
+static void
+tconvert(struct command *cmd, tchar *fname, tchar **list)
{
- register char **rc;
- register int len;
+ char **rc;
+ int len;
cmd->cfname = tstostr(NULL, fname);
@@ -319,9 +322,8 @@ register tchar *fname, **list;
/*ARGSUSED*/
-execash(t, kp)
- tchar **t;
- register struct command *kp;
+void
+execash(tchar **t, struct command *kp)
{
#ifdef TRACE
tprintf("TRACE- execash()\n");
@@ -337,8 +339,8 @@ execash(t, kp)
/*NOTREACHED*/
}
-xechoit(t)
- tchar **t;
+void
+xechoit(tchar **t)
{
#ifdef TRACE
tprintf("TRACE- xechoit()\n");
@@ -359,8 +361,8 @@ xechoit(t)
* variable is not set with a value, then dohash
* just exits.
*/
-
-dorehash()
+void
+dorehash(void)
{
dohash(xhash);
dohash(xhash2);
@@ -369,13 +371,13 @@ dorehash()
/*
* Fill up caching arrays for path and cdpath
*/
-dohash(cachearray)
-char cachearray[];
+void
+dohash(char cachearray[])
{
struct stat stb;
DIR *dirp;
- register struct dirent *dp;
- register int cnt;
+ struct dirent *dp;
+ int cnt;
int i = 0;
struct varent *v;
tchar **pv;
@@ -426,7 +428,8 @@ char cachearray[];
}
}
-dounhash()
+void
+dounhash(void)
{
#ifdef TRACE
@@ -437,7 +440,8 @@ dounhash()
}
#ifdef VFORK
-hashstat()
+void
+hashstat(void)
{
#ifdef TRACE
tprintf("TRACE- hashstat_()\n");
@@ -452,10 +456,10 @@ hashstat()
/*
* Hash a command name.
*/
-hashname(cp)
- register tchar *cp;
+int
+hashname(tchar *cp)
{
- register long h = 0;
+ long h = 0;
#ifdef TRACE
tprintf("TRACE- hashname()\n");
diff --git a/usr/src/cmd/csh/sh.exp.c b/usr/src/cmd/csh/sh.exp.c
index 2fab609670..9faffc568c 100644
--- a/usr/src/cmd/csh/sh.exp.c
+++ b/usr/src/cmd/csh/sh.exp.c
@@ -1,5 +1,5 @@
/*
- * Copyright 1995 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -38,6 +38,19 @@
#define EQMATCH 7
#define NOTEQMATCH 8
+int exp0(tchar ***, bool);
+int exp1(tchar ***, bool);
+int exp2(tchar ***, bool);
+int exp2a(tchar ***, bool);
+int exp2b(tchar ***, bool);
+int exp2c(tchar ***, bool);
+tchar *exp3(tchar ***, bool);
+tchar *exp3a(tchar ***, bool);
+tchar *exp4(tchar ***, bool);
+tchar *exp5(tchar ***, bool);
+tchar *exp6(tchar ***, bool);
+void evalav(tchar **);
+
/*
* Determine if file given by name is accessible with permissions
* given by mode.
@@ -49,9 +62,8 @@
* set to indicate the error
*/
-chk_access(path, mode)
-register tchar *path;
-mode_t mode;
+int
+chk_access(tchar *path, mode_t mode)
{
static int flag;
static uid_t euid;
@@ -84,8 +96,8 @@ mode_t mode;
return(-1);
}
-exp(vp)
- register tchar ***vp;
+int
+exp(tchar ***vp)
{
#ifdef TRACE
tprintf("TRACE- exp()\n");
@@ -94,11 +106,10 @@ exp(vp)
return (exp0(vp, 0));
}
-exp0(vp, ignore)
- register tchar ***vp;
- bool ignore;
+int
+exp0(tchar ***vp, bool ignore)
{
- register int p1 = exp1(vp, ignore);
+ int p1 = exp1(vp, ignore);
#ifdef TRACE
tprintf("TRACE- exp0()\n");
#endif
@@ -107,7 +118,7 @@ exp0(vp, ignore)
etraci("exp0 p1", p1, vp);
#endif
if (**vp && eq(**vp, S_BARBAR /*"||"*/)) {
- register int p2;
+ int p2;
(*vp)++;
p2 = exp0(vp, (ignore&IGNORE) || p1);
@@ -119,10 +130,10 @@ exp0(vp, ignore)
return (p1);
}
-exp1(vp, ignore)
- register tchar ***vp;
+int
+exp1(tchar ***vp, bool ignore)
{
- register int p1 = exp2(vp, ignore);
+ int p1 = exp2(vp, ignore);
#ifdef TRACE
tprintf("TRACE- exp1()\n");
@@ -131,7 +142,7 @@ exp1(vp, ignore)
etraci("exp1 p1", p1, vp);
#endif
if (**vp && eq(**vp, S_ANDAND /*"&&" */)) {
- register int p2;
+ int p2;
(*vp)++;
p2 = exp1(vp, (ignore&IGNORE) || !p1);
@@ -143,11 +154,10 @@ exp1(vp, ignore)
return (p1);
}
-exp2(vp, ignore)
- register tchar ***vp;
- bool ignore;
+int
+exp2(tchar ***vp, bool ignore)
{
- register int p1 = exp2a(vp, ignore);
+ int p1 = exp2a(vp, ignore);
#ifdef TRACE
tprintf("TRACE- exp2()\n");
@@ -156,7 +166,7 @@ exp2(vp, ignore)
etraci("exp3 p1", p1, vp);
#endif
if (**vp && eq(**vp, S_BAR /*"|" */)) {
- register int p2;
+ int p2;
(*vp)++;
p2 = exp2(vp, ignore);
@@ -168,11 +178,10 @@ exp2(vp, ignore)
return (p1);
}
-exp2a(vp, ignore)
- register tchar ***vp;
- bool ignore;
+int
+exp2a(tchar ***vp, bool ignore)
{
- register int p1 = exp2b(vp, ignore);
+ int p1 = exp2b(vp, ignore);
#ifdef TRACE
tprintf("TRACE- exp2a()\n");
@@ -181,7 +190,7 @@ exp2a(vp, ignore)
etraci("exp2a p1", p1, vp);
#endif
if (**vp && eq(**vp, S_HAT /*"^" */)) {
- register int p2;
+ int p2;
(*vp)++;
p2 = exp2a(vp, ignore);
@@ -193,11 +202,10 @@ exp2a(vp, ignore)
return (p1);
}
-exp2b(vp, ignore)
- register tchar ***vp;
- bool ignore;
+int
+exp2b(tchar ***vp, bool ignore)
{
- register int p1 = exp2c(vp, ignore);
+ int p1 = exp2c(vp, ignore);
#ifdef TRACE
tprintf("TRACE- exp2b()\n");
@@ -206,7 +214,7 @@ exp2b(vp, ignore)
etraci("exp2b p1", p1, vp);
#endif
if (**vp && eq(**vp, S_AND /*"&"*/)) {
- register int p2;
+ int p2;
(*vp)++;
p2 = exp2b(vp, ignore);
@@ -218,13 +226,12 @@ exp2b(vp, ignore)
return (p1);
}
-exp2c(vp, ignore)
- register tchar ***vp;
- bool ignore;
+int
+exp2c(tchar ***vp, bool ignore)
{
- register tchar *p1 = exp3(vp, ignore);
- register tchar *p2;
- register int i;
+ tchar *p1 = exp3(vp, ignore);
+ tchar *p2;
+ int i;
#ifdef TRACE
tprintf("TRACE- exp2c()\n");
@@ -267,12 +274,10 @@ exp2c(vp, ignore)
}
tchar *
-exp3(vp, ignore)
- register tchar ***vp;
- bool ignore;
+exp3(tchar ***vp, bool ignore)
{
- register tchar *p1, *p2;
- register int i;
+ tchar *p1, *p2;
+ int i;
#ifdef TRACE
tprintf("TRACE- exp3()\n");
@@ -314,12 +319,10 @@ exp3(vp, ignore)
}
tchar *
-exp3a(vp, ignore)
- register tchar ***vp;
- bool ignore;
+exp3a(tchar ***vp, bool ignore)
{
- register tchar *p1, *p2, *op;
- register int i;
+ tchar *p1, *p2, *op;
+ int i;
#ifdef TRACE
tprintf("TRACE- exp3a()\n");
@@ -347,12 +350,10 @@ exp3a(vp, ignore)
}
tchar *
-exp4(vp, ignore)
- register tchar ***vp;
- bool ignore;
+exp4(tchar ***vp, bool ignore)
{
- register tchar *p1, *p2;
- register int i = 0;
+ tchar *p1, *p2;
+ int i = 0;
#ifdef TRACE
tprintf("TRACE- exp4()\n");
@@ -362,7 +363,7 @@ exp4(vp, ignore)
etracc("exp4 p1", p1, vp);
#endif
if (isa(**vp, ADDOP)) {
- register tchar *op = *(*vp)++;
+ tchar *op = *(*vp)++;
p2 = exp4(vp, ignore);
#ifdef EDEBUG
@@ -385,12 +386,10 @@ exp4(vp, ignore)
}
tchar *
-exp5(vp, ignore)
- register tchar ***vp;
- bool ignore;
+exp5(tchar ***vp, bool ignore)
{
- register tchar *p1, *p2;
- register int i = 0;
+ tchar *p1, *p2;
+ int i = 0;
#ifdef TRACE
tprintf("TRACE- exp5()\n");
@@ -400,7 +399,7 @@ exp5(vp, ignore)
etracc("exp5 p1", p1, vp);
#endif
if (isa(**vp, MULOP)) {
- register tchar *op = *(*vp)++;
+ tchar *op = *(*vp)++;
p2 = exp5(vp, ignore);
#ifdef EDEBUG
@@ -433,11 +432,10 @@ exp5(vp, ignore)
}
tchar *
-exp6(vp, ignore)
- register tchar ***vp;
+exp6(tchar ***vp, bool ignore)
{
int ccode, i;
- register tchar *cp, *dp, *ep;
+ tchar *cp, *dp, *ep;
#ifdef TRACE
tprintf("TRACE- exp6()\n");
@@ -476,7 +474,7 @@ exp6(vp, ignore)
return (putn(ccode));
}
if (eq(**vp, S_LBRA /* "{" */)) {
- register tchar **v;
+ tchar **v;
struct command faket;
tchar *fakecom[2];
@@ -587,13 +585,13 @@ exp6(vp, ignore)
return (ignore&NOGLOB ? savestr(cp) : globone(cp));
}
-evalav(v)
- register tchar **v;
+void
+evalav(tchar **v)
{
struct wordent paraml;
- register struct wordent *hp = &paraml;
+ struct wordent *hp = &paraml;
struct command *t;
- register struct wordent *wdp = hp;
+ struct wordent *wdp = hp;
#ifdef TRACE
tprintf("TRACE- evalav()\n");
@@ -602,7 +600,7 @@ evalav(v)
hp->prev = hp->next = hp;
hp->word = S_ /*""*/;
while (*v) {
- register struct wordent *new = (struct wordent *) calloc(1, sizeof *wdp);
+ struct wordent *new = (struct wordent *) calloc(1, sizeof *wdp);
new->prev = wdp;
new->next = hp;
@@ -619,9 +617,8 @@ evalav(v)
freelex(&paraml), freesyn(t);
}
-isa(cp, what)
- register tchar *cp;
- register int what;
+int
+isa(tchar *cp, int what)
{
#ifdef TRACE
@@ -669,8 +666,8 @@ isa(cp, what)
return (0);
}
-egetn(cp)
- register tchar *cp;
+int
+egetn(tchar *cp)
{
#ifdef TRACE
@@ -684,10 +681,8 @@ egetn(cp)
/* Phew! */
#ifdef EDEBUG
-etraci(str, i, vp)
- tchar *str;
- int i;
- tchar ***vp;
+void
+etraci(tchar *str, int i, tchar ***vp)
{
printf("%s=%d\t", str, i);
@@ -695,9 +690,8 @@ etraci(str, i, vp)
printf("\n");
}
-etracc(str, cp, vp)
- tchar *str, *cp;
- tchar ***vp;
+void
+etracc(tchar *str, tchar *cp, tchar ***vp)
{
printf("%s=%s\t", str, cp);
diff --git a/usr/src/cmd/csh/sh.file.c b/usr/src/cmd/csh/sh.file.c
index af9e543c52..159ea65faa 100644
--- a/usr/src/cmd/csh/sh.file.c
+++ b/usr/src/cmd/csh/sh.file.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -35,7 +35,7 @@
#define ESC '\033'
-extern DIR *opendir_();
+extern DIR *opendir_(tchar *);
static char *BELL = "\07";
static char *CTRLR = "^R\n";
@@ -46,6 +46,10 @@ static jmp_buf osetexit; /* saved setexit() state */
static struct termios tty_save; /* saved terminal state */
static struct termios tty_new; /* new terminal state */
+static int is_prefix(tchar *, tchar *);
+static int is_suffix(tchar *, tchar *);
+static int ignored(tchar *);
+
/*
* Put this here so the binary can be patched with adb to enable file
* completion by default. Filec controls completion, nobeep controls
@@ -53,9 +57,8 @@ static struct termios tty_new; /* new terminal state */
*/
bool filec = 0;
-static
-setup_tty(on)
- int on;
+static void
+setup_tty(int on)
{
int omask;
#ifdef TRACE
@@ -103,16 +106,16 @@ setup_tty(on)
(void) sigsetmask(omask);
}
-static
-termchars()
+static void
+termchars(void)
{
extern char *tgetstr();
- char bp[1024];
+ char bp[1024];
static char area[256];
static int been_here = 0;
- char *ap = area;
- register char *s;
- char *term;
+ char *ap = area;
+ char *s;
+ char *term;
#ifdef TRACE
tprintf("TRACE- termchars()\n");
@@ -132,8 +135,8 @@ termchars()
/*
* Move back to beginning of current line
*/
-static
-back_to_col_1()
+static void
+back_to_col_1(void)
{
int omask;
@@ -148,12 +151,10 @@ back_to_col_1()
/*
* Push string contents back into tty queue
*/
-static
-pushback(string, echoflag)
- tchar *string;
- int echoflag;
+static void
+pushback(tchar *string, int echoflag)
{
- register tchar *p;
+ tchar *p;
struct termios tty;
int omask;
@@ -190,9 +191,8 @@ pushback(string, echoflag)
* Des is a string whose maximum length is count.
* Always null terminate.
*/
-catn(des, src, count)
- register tchar *des, *src;
- register count;
+void
+catn(tchar *des, tchar *src, int count)
{
#ifdef TRACE
tprintf("TRACE- catn()\n");
@@ -206,7 +206,7 @@ catn(des, src, count)
*des = '\0';
}
-static
+static int
max(a, b)
{
@@ -217,9 +217,8 @@ max(a, b)
* Like strncpy but always leave room for trailing \0
* and always null terminate.
*/
-copyn(des, src, count)
- register tchar *des, *src;
- register count;
+void
+copyn(tchar *des, tchar *src, int count)
{
#ifdef TRACE
@@ -234,9 +233,8 @@ copyn(des, src, count)
/*
* For qsort()
*/
-static
-fcompare(file1, file2)
- tchar **file1, **file2;
+static int
+fcompare(tchar **file1, tchar **file2)
{
#ifdef TRACE
@@ -246,9 +244,7 @@ fcompare(file1, file2)
}
static char
-filetype(dir, file, nosym)
- tchar *dir, *file;
- int nosym;
+filetype(tchar *dir, tchar *file, int nosym)
{
tchar path[MAXPATHLEN + 1];
struct stat statb;
@@ -279,12 +275,10 @@ filetype(dir, file, nosym)
/*
* Print sorted down columns
*/
-static
-print_by_column(dir, items, count, looking_for_command)
- tchar *dir, *items[];
- int looking_for_command;
+static void
+print_by_column(tchar *dir, tchar *items[], int count, int looking_for_command)
{
- register int i, rows, r, c, maxwidth = 0, columns;
+ int i, rows, r, c, maxwidth = 0, columns;
#ifdef TRACE
tprintf("TRACE- print_by_column()\n");
@@ -301,7 +295,7 @@ print_by_column(dir, items, count, looking_for_command)
for (c = 0; c < columns; c++) {
i = c * rows + r;
if (i < count) {
- register int w;
+ int w;
/*
* Print filename followed by
@@ -330,11 +324,10 @@ print_by_column(dir, items, count, looking_for_command)
* home_directory_of_person/mumble
*/
tchar *
-tilde(new, old)
- tchar *new, *old;
+tilde(tchar *new, tchar *old)
{
- register tchar *o, *p;
- register struct passwd *pw;
+ tchar *o, *p;
+ struct passwd *pw;
static tchar person[40];
char person_[40]; /* work */
tchar *pw_dir; /* work */
@@ -365,8 +358,8 @@ tilde(new, old)
/*
* Cause pending line to be printed
*/
-static
-sim_retype()
+static void
+sim_retype(void)
{
#ifdef notdef
struct termios tty_pending;
@@ -387,8 +380,9 @@ sim_retype()
#endif
}
-static
-beep_outc (c) {
+static int
+beep_outc(int c)
+{
char buf[1];
buf[0] = c;
@@ -398,8 +392,8 @@ beep_outc (c) {
return 0;
}
-static
-beep()
+static void
+beep(void)
{
#ifdef TRACE
@@ -412,9 +406,8 @@ beep()
/*
* Erase that silly ^[ and print the recognized part of the string.
*/
-static
-print_recognized_stuff(recognized_part)
- tchar *recognized_part;
+static void
+print_recognized_stuff(tchar *recognized_part)
{
int unit = didfds ? 1 : SHOUT;
@@ -456,11 +449,10 @@ print_recognized_stuff(recognized_part)
* Parse full path in file into 2 parts: directory and file names
* Should leave final slash (/) at end of dir.
*/
-static
-extract_dir_and_name(path, dir, name)
- tchar *path, *dir, *name;
+static void
+extract_dir_and_name(tchar *path, tchar *dir, tchar *name)
{
- register tchar *p;
+ tchar *p;
#ifdef TRACE
tprintf("TRACE- extract_dir_and_name()\n");
@@ -476,11 +468,10 @@ extract_dir_and_name(path, dir, name)
}
tchar *
-getentry(dir_fd, looking_for_lognames)
- DIR *dir_fd;
+getentry(DIR *dir_fd, int looking_for_lognames)
{
- register struct passwd *pw;
- register struct dirent *dirp;
+ struct passwd *pw;
+ struct dirent *dirp;
/*
* For char * -> tchar * Conversion
*/
@@ -499,11 +490,10 @@ getentry(dir_fd, looking_for_lognames)
return (NULL);
}
-static
-free_items(items)
- register tchar **items;
+static void
+free_items(tchar **items)
{
- register int i;
+ int i;
#ifdef TRACE
tprintf("TRACE- free_items()\n");
@@ -525,15 +515,13 @@ free_items(items)
/*
* Perform a RECOGNIZE or LIST command on string "word".
*/
-static
-search2(word, command, max_word_length)
- tchar *word;
- COMMAND command;
+static int
+search2(tchar *word, COMMAND command, int max_word_length)
{
static tchar **items = NULL;
- register DIR *dir_fd;
- register numitems = 0, ignoring = TRUE, nignored = 0;
- register name_length, looking_for_lognames;
+ DIR *dir_fd;
+ int numitems = 0, ignoring = TRUE, nignored = 0;
+ int name_length, looking_for_lognames;
tchar tilded_dir[MAXPATHLEN + 1], dir[MAXPATHLEN + 1];
tchar name[MAXNAMLEN + 1], extended_name[MAXNAMLEN+1];
tchar *entry;
@@ -638,8 +626,8 @@ again: /* search for matches */
* character mismatch between extended_name and entry.
* If we shorten it back to the prefix length, stop searching.
*/
-recognize(extended_name, entry, name_length, numitems)
- tchar *extended_name, *entry;
+int
+recognize(tchar *extended_name, tchar *entry, int name_length, int numitems)
{
#ifdef TRACE
@@ -648,8 +636,8 @@ recognize(extended_name, entry, name_length, numitems)
if (numitems == 1) /* 1st match */
copyn(extended_name, entry, MAXNAMLEN);
else { /* 2nd and subsequent matches */
- register tchar *x, *ent;
- register int len = 0;
+ tchar *x, *ent;
+ int len = 0;
x = extended_name;
for (ent = entry; *x && *x == *ent++; x++, len++)
@@ -666,9 +654,8 @@ recognize(extended_name, entry, name_length, numitems)
* This differs from PWB imatch in that if check is null
* it items anything
*/
-static
-is_prefix(check, template)
- register tchar *check, *template;
+static int
+is_prefix(tchar *check, tchar *template)
{
#ifdef TRACE
tprintf("TRACE- is_prefix()\n");
@@ -685,11 +672,10 @@ is_prefix(check, template)
* Return true if the chars in template appear at the
* end of check, i.e., are its suffix.
*/
-static
-is_suffix(check, template)
- tchar *check, *template;
+static int
+is_suffix(tchar *check, tchar *template)
{
- register tchar *c, *t;
+ tchar *c, *t;
#ifdef TRACE
tprintf("TRACE- is_suffix()\n");
@@ -706,11 +692,10 @@ is_suffix(check, template)
}
}
-tenex(inputline, inputline_size)
- tchar *inputline;
- int inputline_size;
+int
+tenex(tchar *inputline, int inputline_size)
{
- register int numitems, num_read, should_retype;
+ int numitems, num_read, should_retype;
int i;
#ifdef TRACE
@@ -723,8 +708,8 @@ tenex(inputline, inputline_size)
while ((i = read_(SHIN, inputline+num_read, inputline_size-num_read))
> 0) {
static tchar *delims = S_DELIM /*" '\"\t;&<>()|`"*/;
- register tchar *str_end, *word_start, last_char;
- register int space_left;
+ tchar *str_end, *word_start, last_char;
+ int space_left;
struct termios tty;
COMMAND command;
@@ -800,12 +785,11 @@ tenex(inputline, inputline_size)
return (num_read);
}
-static
-ignored(entry)
- register tchar *entry;
+static int
+ignored(tchar *entry)
{
struct varent *vp;
- register tchar **cp;
+ tchar **cp;
#ifdef TRACE
tprintf("TRACE- ignored()\n");
@@ -818,4 +802,4 @@ ignored(entry)
return (TRUE);
return (FALSE);
}
-#endif FILEC
+#endif /* FILEC */
diff --git a/usr/src/cmd/csh/sh.func.c b/usr/src/cmd/csh/sh.func.c
index c69f8882e1..57db65037b 100644
--- a/usr/src/cmd/csh/sh.func.c
+++ b/usr/src/cmd/csh/sh.func.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -50,14 +50,15 @@ struct limits {
-1, 0,
};
+
static int getval(struct limits *lp, tchar **v, rlim_t *);
-void islogin();
-int dolabel();
+void islogin(void);
+int dolabel(void);
void reexecute(struct command *kp);
-void preread_();
-void doagain();
-void toend();
-void wfree();
+void preread_(void);
+void doagain(void);
+void toend(void);
+void wfree(void);
void echo(tchar sep, tchar **v);
void local_setenv(tchar *name, tchar *val);
void local_unsetenv(tchar *name);
@@ -71,8 +72,7 @@ void search();
* C shell
*/
-struct
-biltins *
+struct biltins *
isbfunc(struct command *t)
{
tchar *cp = t->t_dcom[0];
@@ -141,12 +141,12 @@ func(struct command *t, struct biltins *bp)
}
int
-dolabel()
+dolabel(void)
{
#ifdef TRACE
tprintf("TRACE- dolabel()\n");
#endif
-
+ return (0);
}
void
@@ -182,7 +182,7 @@ doonintr(tchar **v)
}
void
-donohup()
+donohup(void)
{
#ifdef TRACE
@@ -200,13 +200,13 @@ donohup()
}
void
-dozip()
+dozip(void)
{
;
}
void
-prvars()
+prvars(void)
{
#ifdef TRACE
tprintf("TRACE- prvars()\n");
@@ -254,7 +254,7 @@ unalias(tchar **v)
}
void
-dologout()
+dologout(void)
{
#ifdef TRACE
@@ -312,7 +312,7 @@ donewgrp(tchar **v)
#endif
void
-islogin()
+islogin(void)
{
#ifdef TRACE
@@ -391,7 +391,7 @@ reexecute(struct command *kp)
}
void
-doelse()
+doelse(void)
{
#ifdef TRACE
@@ -455,7 +455,7 @@ syntax:
}
void
-dobreak()
+dobreak(void)
{
#ifdef TRACE
@@ -585,7 +585,7 @@ dowhile(tchar **v)
}
void
-preread_()
+preread_(void)
{
#ifdef TRACE
tprintf("TRACE- preread()\n");
@@ -603,7 +603,7 @@ preread_()
}
void
-doend()
+doend(void)
{
#ifdef TRACE
@@ -617,7 +617,7 @@ doend()
}
void
-docontin()
+docontin(void)
{
#ifdef TRACE
tprintf("TRACE- docontin()\n");
@@ -630,7 +630,7 @@ docontin()
}
void
-doagain()
+doagain(void)
{
#ifdef TRACE
@@ -681,7 +681,7 @@ dorepeat(tchar **v, struct command *kp)
}
void
-doswbrk()
+doswbrk(void)
{
#ifdef TRACE
@@ -924,10 +924,12 @@ past:
bferr("label not found");
}
/*NOTREACHED*/
+
+ return (0);
}
void
-toend()
+toend(void)
{
#ifdef TRACE
@@ -943,7 +945,7 @@ toend()
}
void
-wfree()
+wfree(void)
{
long o = btell();
@@ -1192,7 +1194,7 @@ local_setenv(tchar *name, tchar *val)
blk[0] = tstostr(NULL, ep_);
blk[1] = 0;
xfree(ep_);
- environ = (char **)blkspl_((unsigned char **)environ, blk);
+ environ = (char **)blkspl_((char **)environ, blk);
xfree((void *)oep);
local_setenv(name, val);
}
@@ -1205,7 +1207,7 @@ local_unsetenv(tchar *name)
char *dp;
char **oep = ep;
char *cp_; /* tmp use */
- static cnt = 0; /* delete counter */
+ static int cnt = 0; /* delete counter */
#ifdef TRACE
tprintf("TRACE- local_unsetenv()\n");
@@ -1242,7 +1244,7 @@ local_unsetenv(tchar *name)
}
cp_ = *ep;
*ep = 0;
- environ = (char **)blkspl_((unsigned char **)environ, ep+1);
+ environ = (char **)blkspl_((char **)environ, ep+1);
*ep = cp_;
xfree(cp_);
xfree((void *)oep);
diff --git a/usr/src/cmd/csh/sh.glob.c b/usr/src/cmd/csh/sh.glob.c
index 1d639392e5..df7b2adec8 100644
--- a/usr/src/cmd/csh/sh.glob.c
+++ b/usr/src/cmd/csh/sh.glob.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2001 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -17,6 +17,7 @@
#include "sh.h"
#include "sh.tconst.h"
#include <dirent.h>
+#include <strings.h>
#ifdef MBCHAR
#include <widec.h> /* wcsetno() */
#include <fnmatch.h> /* fnmatch() */
@@ -34,8 +35,21 @@ bool noglob;
bool nonomatch;
tchar *entp;
tchar **sortbas;
-int sortscmp();
-extern DIR *opendir_();
+int sortscmp(tchar **, tchar **);
+void ginit(tchar **);
+void collect(tchar *);
+void acollect(tchar *);
+void expand(tchar *);
+void matchdir_(tchar *);
+void Gcat(tchar *, tchar *);
+void addpath(tchar);
+void tglob(tchar **);
+tchar **dobackp(tchar *, bool);
+void backeval(tchar *, bool);
+void psave(tchar);
+void pword(void);
+
+extern DIR *opendir_(tchar *);
#define sort() qsort((char *)sortbas, &gargv[gargc] - sortbas, \
sizeof (*sortbas), (int (*)(const void *, \
@@ -43,8 +57,7 @@ extern DIR *opendir_();
tchar **
-glob(v)
- register tchar **v;
+glob(tchar **v)
{
tchar agpath[BUFSIZ];
tchar *agargv[GAVSIZ];
@@ -74,18 +87,18 @@ glob(v)
return (gargv = copyblk(gargv));
}
-ginit(agargv)
- tchar **agargv;
+void
+ginit(tchar **agargv)
{
agargv[0] = 0; gargv = agargv; sortbas = agargv; gargc = 0;
gnleft = NCARGS - 4;
}
-collect(as)
- register tchar *as;
+void
+collect(tchar *as)
{
- register int i;
+ int i;
#ifdef TRACE
tprintf("TRACE- collect()\n");
@@ -124,10 +137,10 @@ collect(as)
acollect(as);
}
-acollect(as)
- register tchar *as;
+void
+acollect(tchar *as)
{
- register long ogargc = gargc;
+ long ogargc = gargc;
#ifdef TRACE
tprintf("TRACE- acollect()\n");
@@ -146,18 +159,18 @@ acollect(as)
/*
* String compare for qsort. Also used by filec code in sh.file.c.
*/
-sortscmp(a1, a2)
- tchar **a1, **a2;
+int
+sortscmp(tchar **a1, tchar **a2)
{
return (strcoll_(*a1, *a2));
}
-expand(as)
- tchar *as;
+void
+expand(tchar *as)
{
- register tchar *cs;
- register tchar *sgpathp, *oldcs;
+ tchar *cs;
+ tchar *sgpathp, *oldcs;
struct stat stb;
#ifdef TRACE
@@ -212,12 +225,12 @@ endit:
*gpathp = 0;
}
-matchdir_(pattern)
- tchar *pattern;
+void
+matchdir_(tchar *pattern)
{
struct stat stb;
- register struct dirent *dp;
- register DIR *dirp;
+ struct dirent *dp;
+ DIR *dirp;
tchar curdir_[MAXNAMLEN+1];
int slproc = 0;
@@ -265,11 +278,11 @@ patherr2:
Perror(gpath);
}
-execbrc(p, s)
- tchar *p, *s;
+int
+execbrc(tchar *p, tchar *s)
{
tchar restbuf[BUFSIZ + 2];
- register tchar *pe, *pm, *pl;
+ tchar *pe, *pm, *pl;
int brclev = 0;
tchar *lm, savec, *sgpathp;
int slproc = 0;
@@ -346,12 +359,11 @@ doit:
return (0);
}
-match(s, p, slproc)
- tchar *s, *p;
- int *slproc;
+int
+match(tchar *s, tchar *p, int *slproc)
{
- register int c;
- register tchar *sentp;
+ int c;
+ tchar *sentp;
tchar sglobbed = globbed;
#ifdef TRACE
@@ -367,11 +379,10 @@ match(s, p, slproc)
return (c);
}
-amatch(s, p, slproc)
- register tchar *s, *p;
- int *slproc;
+int
+amatch(tchar *s, tchar *p, int *slproc)
{
- register int scc;
+ int scc;
int ok, lc;
tchar *sgpathp;
struct stat stb;
@@ -479,10 +490,10 @@ slash:
}
}
-Gmatch(s, p)
- register tchar *s, *p;
+int
+Gmatch(tchar *s, tchar *p)
{
- register int scc;
+ int scc;
int ok, lc;
int c, cc;
@@ -548,10 +559,10 @@ Gmatch(s, p)
}
}
-Gcat(s1, s2)
- tchar *s1, *s2;
+void
+Gcat(tchar *s1, tchar *s2)
{
- register tchar *p, *q;
+ tchar *p, *q;
int n;
#ifdef TRACE
@@ -573,8 +584,8 @@ Gcat(s1, s2)
;
}
-addpath(c)
- tchar c;
+void
+addpath(tchar c)
{
#ifdef TRACE
@@ -586,11 +597,10 @@ addpath(c)
*gpathp = 0;
}
-rscan(t, f)
- register tchar **t;
- int (*f)();
+void
+rscan(tchar **t, int (*f)(int))
{
- register tchar *p;
+ tchar *p;
#ifdef TRACE
tprintf("TRACE- rscan()\n");
@@ -600,10 +610,10 @@ rscan(t, f)
(*f)(*p++);
}
-trim(t)
- register tchar **t;
+void
+trim(tchar **t)
{
- register tchar *p;
+ tchar *p;
#ifdef TRACE
tprintf("TRACE- trim()\n");
@@ -613,10 +623,10 @@ trim(t)
*p++ &= TRIM;
}
-tglob(t)
- register tchar **t;
+void
+tglob(tchar **t)
{
- register tchar *p, c;
+ tchar *p, c;
#ifdef TRACE
tprintf("TRACE- tglob()\n");
@@ -634,12 +644,11 @@ tglob(t)
}
tchar *
-globone(str)
- register tchar *str;
+globone(tchar *str)
{
tchar *gv[2];
- register tchar **gvp;
- register tchar *cp;
+ tchar **gvp;
+ tchar *cp;
#ifdef TRACE
tprintf("TRACE- globone()\n");
@@ -682,11 +691,9 @@ globone(str)
* not crunch blanks and tabs, separating words only at newlines.
*/
tchar **
-dobackp(cp, literal)
- tchar *cp;
- bool literal;
+dobackp(tchar *cp, bool literal)
{
- register tchar *lp, *rp;
+ tchar *lp, *rp;
tchar *ep;
tchar word[BUFSIZ];
tchar *apargv[GAVSIZ + 2];
@@ -734,15 +741,14 @@ oops:
}
}
-backeval(cp, literal)
- tchar *cp;
- bool literal;
+void
+backeval(tchar *cp, bool literal)
{
int pvec[2];
int quoted = (literal || (cp[0] & QUOTE)) ? QUOTE : 0;
tchar ibuf[BUFSIZ];
- register int icnt = 0, c;
- register tchar *ip;
+ int icnt = 0, c;
+ tchar *ip;
bool hadnl = 0;
tchar *fakecom[2];
struct command faket;
@@ -869,8 +875,8 @@ backeval(cp, literal)
prestjob();
}
-psave(c)
- tchar c;
+void
+psave(tchar c)
{
#ifdef TRACE
tprintf("TRACE- psave()\n");
@@ -881,7 +887,8 @@ psave(c)
*pargcp++ = c;
}
-pword()
+void
+pword(void)
{
#ifdef TRACE
tprintf("TRACE- pword()\n");
@@ -906,9 +913,7 @@ pword()
* dir is a null-terminated string;
*/
char *
-makename(dir, file)
- char *dir;
- char *file;
+makename(char *dir, char *file)
{
/*
* Maximum length of a
@@ -918,7 +923,7 @@ makename(dir, file)
*/
static char dfile[MAXNAMLEN];
- register char *dp, *fp;
+ char *dp, *fp;
dp = dfile;
fp = dir;
@@ -937,10 +942,8 @@ makename(dir, file)
return (rindex(dfile, '/') + 1);
}
-sh_bracket_exp(t_ch, t_fch, t_lch)
-tchar t_ch;
-tchar t_fch;
-tchar t_lch;
+int
+sh_bracket_exp(tchar t_ch, tchar t_fch, tchar t_lch)
{
char t_char[MB_LEN_MAX + 1];
char t_patan[MB_LEN_MAX * 2 + 8];
diff --git a/usr/src/cmd/csh/sh.h b/usr/src/cmd/csh/sh.h
index 72cebe7275..a8ba16c5ed 100644
--- a/usr/src/cmd/csh/sh.h
+++ b/usr/src/cmd/csh/sh.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -101,7 +101,6 @@ typedef unsigned short int tchar;
#endif/*!MBCHAR*/
#define eq(a, b) (strcmp_(a, b) == 0)
-extern int Putchar(tchar);
/*
* Global flags
@@ -228,7 +227,7 @@ struct Bin {
#define btell() fseekp
#ifndef btell
-off_t btell();
+off_t btell(void);
#endif
/*
@@ -422,9 +421,9 @@ short gflag; /* After tglob -> is globbing needed? */
*/
#ifdef notyet
#define GAVSIZ (NCARGS / 6)
-#else notyet
+#else /* notyet */
#define GAVSIZ (10240 / 6)
-#endif notyet
+#endif /* notyet */
/*
* Variables for filename expansion
@@ -493,72 +492,39 @@ void *alloctmp;
#define xalloc(i) ((alloctmp = (void *)malloc(i)) ? alloctmp : (void *)nomem(i))/*??*/
#define xrealloc(buf, i) ((alloctmp = (void *)realloc(buf, i)) ? alloctmp : \
(void *)nomem(i))
-
-tchar *Dfix1();
-tchar **blkcat();
-tchar **blkcpy();
-tchar **blkend();
-tchar **blkspl();
-char **blkspl_();
-void *malloc();
-tchar *cname();
-tchar **copyblk();
-tchar **dobackp();
-tchar *domod();
-struct wordent *dosub();
-tchar *exp3();
-tchar *exp3a();
-tchar *exp4();
-tchar *exp5();
-tchar *exp6();
-struct Hist *enthist();
-struct Hist *findev();
-struct wordent *freenod();
-char *getenv();
-tchar *getenv_(/* tchar * */);
-tchar *getenvs_(/* char * */);
-tchar *getinx();
-struct varent *getvx();
-struct passwd *getpwnam();
-struct wordent *gethent();
-struct wordent *getsub();
-char *getwd();
-tchar *getwd_();
-tchar **glob();
-tchar *globone();
-char *index();
-tchar *index_();
-struct biltins *isbfunc();
-off_t lseek();
-tchar *operate();
-void phup();
-void pintr();
-void pchild();
-tchar *putn();
-char *rindex();
-tchar *rindex_();
-tchar **saveblk();
-tchar *savestr();
-char *strcat();
-tchar *strcat_();
-int strlen_(tchar *);
-char *strcpy();
-tchar *strcpy_();
-tchar *strend();
-tchar *strip();
-tchar *strspl();
-tchar *subword();
-struct command *syntax();
-struct command *syn0();
-struct command *syn1();
-struct command *syn1a();
-struct command *syn1b();
-struct command *syn2();
-struct command *syn3();
-tchar *value1();
-tchar *xhome();
-tchar *xname();
-tchar *xset();
+extern void Putchar(tchar);
+extern void bferr(char *) __NORETURN;
+extern void error() __NORETURN;
+extern void exitstat(void) __NORETURN;
+extern tchar *Dfix1(tchar *);
+extern tchar **blkcpy(tchar **, tchar **);
+extern tchar **blkspl(tchar **, tchar **);
+extern char **blkspl_(char **, char **);
+extern tchar **copyblk(tchar **);
+extern tchar **dobackp(tchar *, bool);
+extern tchar *domod(tchar *, int);
+extern struct Hist *enthist(int, struct wordent *, bool);
+extern tchar *getenv_(tchar *);
+extern tchar *getenvs_(char *);
+extern tchar *getwd_(tchar *);
+extern tchar **glob(tchar **);
+extern tchar *globone(tchar *);
+extern tchar *index_(tchar *, tchar);
+extern struct biltins *isbfunc(struct command *);
+extern void pintr(void);
+extern void pchild(void);
+extern tchar *putn(int);
+extern tchar *rindex_(tchar *, tchar);
+extern tchar **saveblk(tchar **);
+extern tchar *savestr(tchar *);
+extern tchar *strcat_(tchar *, tchar *);
+extern int strlen_(tchar *);
+extern tchar *strcpy_(tchar *, tchar *);
+extern tchar *strend(tchar *);
+extern tchar *strip(tchar *);
+extern tchar *strspl(tchar *, tchar *);
+extern struct command *syntax(struct wordent *, struct wordent *, int);
+extern tchar *value1(tchar *, struct varent *);
#define NOSTR ((tchar *) 0)
diff --git a/usr/src/cmd/csh/sh.hist.c b/usr/src/cmd/csh/sh.hist.c
index a4418a95d4..fb8b5e06ce 100644
--- a/usr/src/cmd/csh/sh.hist.c
+++ b/usr/src/cmd/csh/sh.hist.c
@@ -1,5 +1,5 @@
/*
- * Copyright 1990 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -17,15 +17,20 @@
#include "sh.h"
#include "sh.tconst.h"
+struct Hist *enthist(int, struct wordent *, bool);
+void hfree(struct Hist *);
+void dohist1(struct Hist *, int *, int, int);
+void phist(struct Hist *, int);
+
/*
* C shell
*/
-savehist(sp)
- struct wordent *sp;
+void
+savehist(struct wordent *sp)
{
- register struct Hist *hp, *np;
- register int histlen = 0;
+ struct Hist *hp, *np;
+ int histlen = 0;
tchar *cp;
#ifdef TRACE
@@ -36,7 +41,7 @@ savehist(sp)
return;
cp = value(S_history /*"history"*/);
if (*cp) {
- register tchar *p = cp;
+ tchar *p = cp;
while (*p) {
if (!digit(*p)) {
@@ -55,12 +60,9 @@ savehist(sp)
}
struct Hist *
-enthist(event, lp, docopy)
- int event;
- register struct wordent *lp;
- bool docopy;
+enthist(int event, struct wordent *lp, bool docopy)
{
- register struct Hist *np;
+ struct Hist *np;
#ifdef TRACE
tprintf("TRACE- enthist()\n");
@@ -80,8 +82,8 @@ enthist(event, lp, docopy)
return (np);
}
-hfree(hp)
- register struct Hist *hp;
+void
+hfree(struct Hist *hp)
{
#ifdef TRACE
tprintf("TRACE- hfree()\n");
@@ -91,8 +93,8 @@ hfree(hp)
xfree( (tchar *)hp);
}
-dohist(vp)
- tchar **vp;
+void
+dohist(tchar **vp)
{
int n, rflg = 0, hflg = 0;
#ifdef TRACE
@@ -128,9 +130,8 @@ dohist(vp)
dohist1(Histlist.Hnext, &n, rflg, hflg);
}
-dohist1(hp, np, rflg, hflg)
- struct Hist *hp;
- int *np, rflg, hflg;
+void
+dohist1(struct Hist *hp, int *np, int rflg, int hflg)
{
bool print = (*np) > 0;
#ifdef TRACE
@@ -153,9 +154,8 @@ top:
goto top;
}
-phist(hp, hflg)
- register struct Hist *hp;
- int hflg;
+void
+phist(struct Hist *hp, int hflg)
{
#ifdef TRACE
tprintf("TRACE- phist()\n");
diff --git a/usr/src/cmd/csh/sh.lex.c b/usr/src/cmd/csh/sh.lex.c
index 4a743e8e65..322baff951 100644
--- a/usr/src/cmd/csh/sh.lex.c
+++ b/usr/src/cmd/csh/sh.lex.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -30,7 +30,20 @@
* of input buffering, and especially because of history substitution.
*/
-tchar *word();
+tchar *word(void);
+tchar getC1(int);
+tchar *subword(tchar *, int, bool *);
+void getdol(void);
+void addla(tchar *);
+void getexcl(tchar);
+void noev(tchar *);
+void setexclp(tchar *);
+void unreadc(tchar);
+int readc(bool);
+struct wordent *dosub(int, struct wordent *, bool);
+struct Hist *findev(tchar *, bool);
+struct wordent *gethent(int);
+struct wordent *getsub(struct wordent *);
/*
* Peekc is a peek characer for getC, peekread for readc.
@@ -71,10 +84,10 @@ tchar getCtmp;
#define ungetC(c) peekc = c
#define ungetD(c) peekd = c
-lex(hp)
- register struct wordent *hp;
+bool
+lex(struct wordent *hp)
{
- register struct wordent *wdp;
+ struct wordent *wdp;
int c;
#ifdef TRACE
@@ -100,7 +113,7 @@ lex(hp)
* interrupted.
*/
do {
- register struct wordent *new = (struct wordent *) xalloc(sizeof *wdp);
+ struct wordent *new = (struct wordent *) xalloc(sizeof *wdp);
new->word = 0;
new->prev = wdp;
@@ -116,10 +129,10 @@ lex(hp)
return (hadhist);
}
-prlex(sp0)
- struct wordent *sp0;
+void
+prlex(struct wordent *sp0)
{
- register struct wordent *sp = sp0->next;
+ struct wordent *sp = sp0->next;
#ifdef TRACE
tprintf("TRACE- prlex()\n");
@@ -134,11 +147,10 @@ prlex(sp0)
}
}
-copylex(hp, fp)
- register struct wordent *hp;
- register struct wordent *fp;
+void
+copylex(struct wordent *hp, struct wordent *fp)
{
- register struct wordent *wdp;
+ struct wordent *wdp;
#ifdef TRACE
tprintf("TRACE- copylex()\n");
@@ -146,7 +158,7 @@ copylex(hp, fp)
wdp = hp;
fp = fp->next;
do {
- register struct wordent *new = (struct wordent *) xalloc(sizeof *wdp);
+ struct wordent *new = (struct wordent *) xalloc(sizeof *wdp);
new->prev = wdp;
new->next = hp;
@@ -158,10 +170,10 @@ copylex(hp, fp)
hp->prev = wdp;
}
-freelex(vp)
- register struct wordent *vp;
+void
+freelex(struct wordent *vp)
{
- register struct wordent *fp;
+ struct wordent *fp;
#ifdef TRACE
tprintf("TRACE- freelex()\n");
@@ -176,13 +188,13 @@ freelex(vp)
}
tchar *
-word()
+word(void)
{
- register tchar c, c1;
- register tchar *wp;
+ tchar c, c1;
+ tchar *wp;
tchar wbuf[BUFSIZ];
- register bool dolflg;
- register int i;
+ bool dolflg;
+ int i;
#ifdef TRACE
tprintf("TRACE- word()\n");
@@ -299,10 +311,10 @@ ret:
return (savestr(wbuf));
}
-getC1(flag)
- register int flag;
+tchar
+getC1(int flag)
{
- register tchar c;
+ tchar c;
top:
if (c = peekc) {
@@ -358,11 +370,12 @@ top:
return (c);
}
-getdol()
+void
+getdol(void)
{
- register tchar *np, *p;
+ tchar *np, *p;
tchar name[MAX_VREF_LEN];
- register int c;
+ int c;
int sc;
bool special = 0;
@@ -463,8 +476,8 @@ vsyn:
goto ret;
}
-addla(cp)
- tchar *cp;
+void
+addla(tchar *cp)
{
tchar *buf;
int len = 0;
@@ -494,12 +507,12 @@ tchar slhs[32];
tchar rhsb[64];
int quesarg;
-getexcl(sc)
- tchar sc;
+void
+getexcl(tchar sc)
{
- register struct wordent *hp, *ip;
+ struct wordent *hp, *ip;
int left, right, dol;
- register int c;
+ int c;
#ifdef TRACE
tprintf("TRACE- getexcl()\n");
@@ -575,12 +588,11 @@ subst:
}
struct wordent *
-getsub(en)
- struct wordent *en;
+getsub(struct wordent *en)
{
- register tchar *cp;
+ tchar *cp;
int delim;
- register int c;
+ int c;
int sc;
bool global = 0;
tchar orhsb[(sizeof rhsb)/(sizeof rhsb[0])];
@@ -707,23 +719,20 @@ ret:
}
struct wordent *
-dosub(sc, en, global)
- int sc;
- struct wordent *en;
- bool global;
+dosub(int sc, struct wordent *en, bool global)
{
struct wordent lex;
bool didsub = 0;
struct wordent *hp = &lex;
- register struct wordent *wdp;
- register int i = exclc;
+ struct wordent *wdp;
+ int i = exclc;
#ifdef TRACE
tprintf("TRACE- dosub()\n");
#endif
wdp = hp;
while (--i >= 0) {
- register struct wordent *new = (struct wordent *) calloc(1, sizeof *wdp);
+ struct wordent *new = (struct wordent *) calloc(1, sizeof *wdp);
new->prev = wdp;
new->next = hp;
@@ -740,14 +749,11 @@ dosub(sc, en, global)
}
tchar *
-subword(cp, type, adid)
- tchar *cp;
- int type;
- bool *adid;
+subword(tchar *cp, int type, bool *adid)
{
tchar wbuf[BUFSIZ];
- register tchar *wp, *mp, *np;
- register int i;
+ tchar *wp, *mp, *np;
+ int i;
#ifdef TRACE
tprintf("TRACE- subword()\n");
@@ -812,12 +818,10 @@ ovflo:
}
tchar *
-domod(cp, type)
- tchar *cp;
- int type;
+domod(tchar *cp, int type)
{
- register tchar *wp, *xp;
- register int c;
+ tchar *wp, *xp;
+ int c;
#ifdef TRACE
tprintf("TRACE- domod()\n");
@@ -861,8 +865,8 @@ domod(cp, type)
return (0);
}
-matchs(str, pat)
- register tchar *str, *pat;
+int
+matchs(tchar *str, tchar *pat)
{
#ifdef TRACE
@@ -873,12 +877,11 @@ matchs(str, pat)
return (*pat == 0);
}
-getsel(al, ar, dol)
- register int *al, *ar;
- int dol;
+int
+getsel(int *al, int *ar, int dol)
{
- register int c = getC(0);
- register int i;
+ int c = getC(0);
+ int i;
bool first = *al < 0;
#ifdef TRACE
@@ -962,12 +965,11 @@ bad:
}
struct wordent *
-gethent(sc)
- int sc;
+gethent(int sc)
{
- register struct Hist *hp;
- register tchar *np;
- register int c;
+ struct Hist *hp;
+ tchar *np;
+ int c;
int event;
bool back = 0;
@@ -1078,19 +1080,17 @@ skip:
}
struct Hist *
-findev(cp, anyarg)
- tchar *cp;
- bool anyarg;
+findev(tchar *cp, bool anyarg)
{
- register struct Hist *hp;
+ struct Hist *hp;
#ifdef TRACE
tprintf("TRACE- findev()\n");
#endif
for (hp = Histlist.Hnext; hp; hp = hp->Hnext) {
- tchar *dp;
- register tchar *p, *q;
- register struct wordent *lp = hp->Hlex.next;
+ tchar *dp;
+ tchar *p, *q;
+ struct wordent *lp = hp->Hlex.next;
int argno = 0;
if (lp->word[0] == '\n')
@@ -1123,8 +1123,8 @@ findev(cp, anyarg)
return (0);
}
-noev(cp)
- tchar *cp;
+void
+noev(tchar *cp)
{
#ifdef TRACE
@@ -1133,8 +1133,8 @@ noev(cp)
seterr2(cp, ": Event not found");
}
-setexclp(cp)
- register tchar *cp;
+void
+setexclp(tchar *cp)
{
#ifdef TRACE
@@ -1145,18 +1145,18 @@ setexclp(cp)
exclp = cp;
}
-unreadc(c)
- tchar c;
+void
+unreadc(tchar c)
{
peekread = c;
}
-readc(wanteof)
- bool wanteof;
+int
+readc(bool wanteof)
{
- register int c;
- static sincereal;
+ int c;
+ static int sincereal;
if (c = peekread) {
peekread = 0;
@@ -1259,12 +1259,13 @@ oops:
return (c);
}
-bgetc()
+int
+bgetc(void)
{
- register int buf, off, c;
+ int buf, off, c;
#ifdef FILEC
tchar ttyline[BUFSIZ];
- register int numleft = 0, roomleft;
+ int numleft = 0, roomleft;
#endif
#ifdef TELL
@@ -1290,7 +1291,7 @@ bgetc()
again:
buf = (int) fseekp / BUFSIZ;
if (buf >= fblocks) {
- register tchar **nfbuf =
+ tchar **nfbuf =
(tchar **) calloc((unsigned) (fblocks + 2),
sizeof (tchar **));
@@ -1350,9 +1351,10 @@ again:
return (c);
}
-bfree()
+void
+bfree(void)
{
- register int sb, i;
+ int sb, i;
#ifdef TELL
if (cantell)
@@ -1371,10 +1373,10 @@ bfree()
}
}
-bseek(l)
- off_t l;
+void
+bseek(off_t l)
{
- register struct whyle *wp;
+ struct whyle *wp;
fseekp = l;
#ifdef TELL
@@ -1394,14 +1396,15 @@ bseek(l)
/* any similarity to bell telephone is purely accidental */
#ifndef btell
off_t
-btell()
+btell(void)
{
return (fseekp);
}
#endif
-btoeof()
+void
+btoeof(void)
{
(void) lseek(SHIN, (off_t)0, 2);
@@ -1411,7 +1414,8 @@ btoeof()
}
#ifdef TELL
-settell()
+void
+settell(void)
{
cantell = 0;
diff --git a/usr/src/cmd/csh/sh.misc.c b/usr/src/cmd/csh/sh.misc.c
index 4f67243a5f..6ee722cc69 100644
--- a/usr/src/cmd/csh/sh.misc.c
+++ b/usr/src/cmd/csh/sh.misc.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2000 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -22,10 +22,11 @@
/*
* C Shell
*/
+tchar **blkcat(tchar **, tchar **);
+tchar **blkend(tchar **);
-any(c, s)
- register int c;
- register tchar *s;
+int
+any(int c, tchar *s)
{
while (s && *s)
@@ -34,8 +35,8 @@ any(c, s)
return (0);
}
-onlyread(cp)
- tchar *cp;
+int
+onlyread(tchar *cp)
{
extern char end[];
@@ -46,9 +47,8 @@ onlyread(cp)
/*
* WARNING: changes here also need to occur in the XFREE macro in sh.h.
*/
-
-xfree(cp)
- char *cp;
+void
+xfree(char *cp)
{
extern char end[];
@@ -64,11 +64,10 @@ xfree(cp)
}
tchar *
-savestr(s)
- register tchar *s;
+savestr(tchar *s)
{
tchar *n;
- register tchar *p;
+ tchar *p;
if (s == 0)
s = S_ /* "" */;
@@ -87,11 +86,9 @@ savestr(s)
}
void *
-calloc(i, j)
- register unsigned i;
- unsigned j;
+calloc(size_t i, size_t j)
{
- register char *cp;
+ char *cp;
i *= j;
cp = (char *)xalloc(i);
@@ -99,8 +96,8 @@ calloc(i, j)
return (cp);
}
-nomem(i)
- unsigned i;
+int
+nomem(unsigned i)
{
#ifdef debug
static tchar *av[2] = {0, 0};
@@ -122,8 +119,7 @@ nomem(i)
}
tchar **
-blkend(up)
- register tchar **up;
+blkend(tchar **up)
{
while (*up)
@@ -131,8 +127,8 @@ blkend(up)
return (up);
}
-blkpr(av)
- register tchar **av;
+void
+blkpr(tchar **av)
{
for (; *av; av++) {
@@ -142,10 +138,10 @@ blkpr(av)
}
}
-blklen(av)
- register tchar **av;
+int
+blklen(tchar **av)
{
- register int i = 0;
+ int i = 0;
while (*av++)
i++;
@@ -153,11 +149,9 @@ blklen(av)
}
tchar **
-blkcpy(oav, bv)
- tchar **oav;
- register tchar **bv;
+blkcpy(tchar **oav, tchar **bv)
{
- register tchar **av = oav;
+ tchar **av = oav;
while (*av++ = *bv++)
continue;
@@ -165,18 +159,17 @@ blkcpy(oav, bv)
}
tchar **
-blkcat(up, vp)
- tchar **up, **vp;
+blkcat(tchar **up, tchar **vp)
{
(void) blkcpy(blkend(up), vp);
return (up);
}
-blkfree(av0)
- tchar **av0;
+void
+blkfree(tchar **av0)
{
- register tchar **av = av0;
+ tchar **av = av0;
for (; *av; av++)
XFREE(*av)
@@ -184,10 +177,9 @@ blkfree(av0)
}
tchar **
-saveblk(v)
- register tchar **v;
+saveblk(tchar **v)
{
- register tchar **newv =
+ tchar **newv =
(tchar **) calloc((unsigned) (blklen(v) + 1),
sizeof (tchar **));
tchar **onewv = newv;
@@ -198,11 +190,10 @@ saveblk(v)
}
tchar *
-strspl(cp, dp)
- tchar *cp, *dp;
+strspl(tchar *cp, tchar *dp)
{
tchar *ep;
- register tchar *p, *q;
+ tchar *p, *q;
#ifndef m32
for (p = cp; *p++; )
@@ -227,10 +218,9 @@ strspl(cp, dp)
}
tchar **
-blkspl(up, vp)
- register tchar **up, **vp;
+blkspl(tchar **up, tchar **vp)
{
- register tchar **wp =
+ tchar **wp =
(tchar **) calloc((unsigned) (blklen(up) + blklen(vp) + 1),
sizeof (tchar **));
@@ -238,8 +228,8 @@ blkspl(up, vp)
return (blkcat(wp, vp));
}
-lastchr(cp)
- register tchar *cp;
+int
+lastchr(tchar *cp)
{
if (!*cp)
@@ -249,7 +239,8 @@ lastchr(cp)
return (*cp);
}
-donefds()
+void
+donefds(void)
{
(void) close(0);
(void) close(1);
@@ -269,8 +260,8 @@ donefds()
* If j is -1 then we just want to get i to a safe place,
* i.e. to a unit > 2. This also happens in dcopy.
*/
-dmove(i, j)
- register int i, j;
+int
+dmove(int i, int j)
{
int fd;
@@ -289,8 +280,8 @@ dmove(i, j)
return (j);
}
-dcopy(i, j)
- register int i, j;
+int
+dcopy(int i, int j)
{
int fd;
@@ -308,10 +299,10 @@ dcopy(i, j)
return (renum(i, j));
}
-renum(i, j)
- register int i, j;
+int
+renum(int i, int j)
{
- register int k = dup(i);
+ int k = dup(i);
if (k < 0)
return (-1);
@@ -328,9 +319,8 @@ renum(i, j)
}
#ifndef copy
-copy(to, from, size)
- register tchar *to, *from;
- register int size;
+void
+copy(tchar *to, tchar *from, int size)
{
if (size)
@@ -345,19 +335,18 @@ copy(to, from, size)
* the first c arguments. Used in "shift" commands
* as well as by commands like "repeat".
*/
-lshift(v, c)
- register tchar **v;
- register int c;
+void
+lshift(tchar **v, int c)
{
- register tchar **u = v;
+ tchar **u = v;
while (*u && --c >= 0)
- xfree(*u++);
+ xfree((char *)*u++);
(void) blkcpy(v, u);
}
-number(cp)
- tchar *cp;
+int
+number(tchar *cp)
{
if (*cp == '-') {
@@ -371,10 +360,9 @@ number(cp)
}
tchar **
-copyblk(v)
- register tchar **v;
+copyblk(tchar **v)
{
- register tchar **nv =
+ tchar **nv =
(tchar **) calloc((unsigned) (blklen(v) + 1),
sizeof (tchar **));
@@ -382,8 +370,7 @@ copyblk(v)
}
tchar *
-strend(cp)
- register tchar *cp;
+strend(tchar *cp)
{
while (*cp)
@@ -392,26 +379,25 @@ strend(cp)
}
tchar *
-strip(cp)
- tchar *cp;
+strip(tchar *cp)
{
- register tchar *dp = cp;
+ tchar *dp = cp;
while (*dp++ &= TRIM)
continue;
return (cp);
}
-udvar(name)
- tchar *name;
+void
+udvar(tchar *name)
{
setname(name);
bferr("Undefined variable");
}
-prefix(sub, str)
- register tchar *sub, *str;
+int
+prefix(tchar *sub, tchar *str)
{
for (;;) {
@@ -429,8 +415,7 @@ prefix(sub, str)
*/
char **
-blkend_(up)
- register char **up;
+blkend_(char **up)
{
while (*up)
@@ -438,10 +423,10 @@ blkend_(up)
return (up);
}
-blklen_(av)
- register char **av;
+int
+blklen_(char **av)
{
- register int i = 0;
+ int i = 0;
while (*av++)
i++;
@@ -449,11 +434,9 @@ blklen_(av)
}
char **
-blkcpy_(oav, bv)
- char **oav;
- register char **bv;
+blkcpy_(char **oav, char **bv)
{
- register char **av = oav;
+ char **av = oav;
while (*av++ = *bv++)
continue;
@@ -461,8 +444,7 @@ blkcpy_(oav, bv)
}
char **
-blkcat_(up, vp)
- char **up, **vp;
+blkcat_(char **up, char **vp)
{
(void) blkcpy_(blkend_(up), vp);
@@ -470,10 +452,9 @@ blkcat_(up, vp)
}
char **
-blkspl_(up, vp)
- register char **up, **vp;
+blkspl_(char **up, char **vp)
{
- register char **wp =
+ char **wp =
(char **) calloc((unsigned) (blklen_(up) + blklen_(vp) + 1),
sizeof (char **));
diff --git a/usr/src/cmd/csh/sh.parse.c b/usr/src/cmd/csh/sh.parse.c
index f77feca7bc..e6e7231a9f 100644
--- a/usr/src/cmd/csh/sh.parse.c
+++ b/usr/src/cmd/csh/sh.parse.c
@@ -1,5 +1,5 @@
/*
- * Copyright 1995 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -21,14 +21,26 @@
* C shell
*/
+void asyntax(struct wordent *, struct wordent *);
+void asyn0(struct wordent *, struct wordent *);
+void asyn3(struct wordent *, struct wordent *);
+void chr_blkfree(char **);
+struct command *syn0(struct wordent *, struct wordent *, int);
+struct command *syn1(struct wordent *, struct wordent *, int);
+struct command *syn1a(struct wordent *, struct wordent *, int);
+struct command *syn1b(struct wordent *, struct wordent *, int);
+struct command *syn2(struct wordent *, struct wordent *, int);
+struct command *syn3(struct wordent *, struct wordent *, int);
+struct wordent *freenod(struct wordent *, struct wordent *);
+
/*
* Perform aliasing on the word list lex
* Do a (very rudimentary) parse to separate into commands.
* If word 0 of a command has an alias, do it.
* Repeat a maximum of 20 times.
*/
-alias(lex)
- register struct wordent *lex;
+void
+alias(struct wordent *lex)
{
int aleft = 21;
jmp_buf osetexit;
@@ -48,8 +60,8 @@ alias(lex)
resexit(osetexit);
}
-asyntax(p1, p2)
- register struct wordent *p1, *p2;
+void
+asyntax(struct wordent *p1, struct wordent *p2)
{
#ifdef TRACE
tprintf("TRACE- asyntax()\n");
@@ -67,12 +79,11 @@ asyntax(p1, p2)
}
}
-asyn0(p1, p2)
- struct wordent *p1;
- register struct wordent *p2;
+void
+asyn0(struct wordent *p1, struct wordent *p2)
{
- register struct wordent *p;
- register int l = 0;
+ struct wordent *p;
+ int l = 0;
#ifdef TRACE
tprintf("TRACE- asyn0()\n");
@@ -109,13 +120,12 @@ asyn0(p1, p2)
asyn3(p1, p2);
}
-asyn3(p1, p2)
- struct wordent *p1;
- register struct wordent *p2;
+void
+asyn3(struct wordent *p1, struct wordent *p2)
{
- register struct varent *ap;
+ struct varent *ap;
struct wordent alout;
- register bool redid;
+ bool redid;
#ifdef TRACE
tprintf("TRACE- asyn3()\n");
@@ -163,10 +173,9 @@ asyn3(p1, p2)
}
struct wordent *
-freenod(p1, p2)
- register struct wordent *p1, *p2;
+freenod(struct wordent *p1, struct wordent *p2)
{
- register struct wordent *retp = p1->prev;
+ struct wordent *retp = p1->prev;
#ifdef TRACE
tprintf("TRACE- freenod()\n");
@@ -192,9 +201,7 @@ freenod(p1, p2)
* syn0
*/
struct command *
-syntax(p1, p2, flags)
- register struct wordent *p1, *p2;
- int flags;
+syntax(struct wordent *p1, struct wordent *p2, int flags)
{
#ifdef TRACE
tprintf("TRACE- syntax()\n");
@@ -217,12 +224,10 @@ syntax(p1, p2, flags)
* syn1 & syntax
*/
struct command *
-syn0(p1, p2, flags)
- struct wordent *p1, *p2;
- int flags;
+syn0(struct wordent *p1, struct wordent *p2, int flags)
{
- register struct wordent *p;
- register struct command *t, *t1;
+ struct wordent *p;
+ struct command *t, *t1;
int l;
#ifdef TRACE
@@ -287,12 +292,10 @@ syn0(p1, p2, flags)
* syn1a ; syntax
*/
struct command *
-syn1(p1, p2, flags)
- struct wordent *p1, *p2;
- int flags;
+syn1(struct wordent *p1, struct wordent *p2, int flags)
{
- register struct wordent *p;
- register struct command *t;
+ struct wordent *p;
+ struct command *t;
int l;
#ifdef TRACE
@@ -331,13 +334,11 @@ syn1(p1, p2, flags)
* syn1b || syn1a
*/
struct command *
-syn1a(p1, p2, flags)
- struct wordent *p1, *p2;
- int flags;
+syn1a(struct wordent *p1, struct wordent *p2, int flags)
{
- register struct wordent *p;
- register struct command *t;
- register int l = 0;
+ struct wordent *p;
+ struct command *t;
+ int l = 0;
#ifdef TRACE
tprintf("TRACE- syn1a()\n");
@@ -375,13 +376,11 @@ syn1a(p1, p2, flags)
* syn2 && syn1b
*/
struct command *
-syn1b(p1, p2, flags)
- struct wordent *p1, *p2;
- int flags;
+syn1b(struct wordent *p1, struct wordent *p2, int flags)
{
- register struct wordent *p;
- register struct command *t;
- register int l = 0;
+ struct wordent *p;
+ struct command *t;
+ int l = 0;
#ifdef TRACE
tprintf("TRACE- syn1b()\n");
@@ -419,13 +418,11 @@ syn1b(p1, p2, flags)
* syn3 |& syn2
*/
struct command *
-syn2(p1, p2, flags)
- struct wordent *p1, *p2;
- int flags;
+syn2(struct wordent *p1, struct wordent *p2, int flags)
{
- register struct wordent *p, *pn;
- register struct command *t;
- register int l = 0;
+ struct wordent *p, *pn;
+ struct command *t;
+ int l = 0;
int f;
#ifdef TRACE
@@ -473,14 +470,12 @@ tchar RELPAR[] = {'<', '>', '(', ')', 0}; /* "<>()" */
* KEYWORD = (@ exit foreach if set switch test while)
*/
struct command *
-syn3(p1, p2, flags)
- struct wordent *p1, *p2;
- int flags;
+syn3(struct wordent *p1, struct wordent *p2, int flags)
{
- register struct wordent *p;
+ struct wordent *p;
struct wordent *lp, *rp;
- register struct command *t;
- register int l;
+ struct command *t;
+ int l;
tchar **av;
int n, c;
bool specp = 0;
@@ -647,8 +642,8 @@ savep:
return (t);
}
-freesyn(t)
- register struct command *t;
+void
+freesyn(struct command *t)
{
#ifdef TRACE
tprintf("TRACE- freesyn()\n");
@@ -685,10 +680,10 @@ lr:
}
-chr_blkfree(vec)
-register char **vec;
+void
+chr_blkfree(char **vec)
{
- register char **av;
+ char **av;
for (av = vec; *av; av++)
xfree(*av);
diff --git a/usr/src/cmd/csh/sh.print.c b/usr/src/cmd/csh/sh.print.c
index 29fc570a09..34cd721e93 100644
--- a/usr/src/cmd/csh/sh.print.c
+++ b/usr/src/cmd/csh/sh.print.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -16,9 +16,11 @@
#include "sh.h"
-void p2dig_ull(unsigned long long i);
-void p2dig_int(int i);
-void flush();
+void p2dig_ull(unsigned long long);
+void p2dig_int(int);
+void flush(void);
+void Putchar(tchar);
+
/*
* C Shell
@@ -115,6 +117,7 @@ putbyte(int c)
* character tc to some byte sequnce that represents the character
* in EUC form.
*/
+void
Putchar(tchar tc)
{
int n;
@@ -166,8 +169,8 @@ putbyte(int c)
* For single-byte character only environment, there is no
* difference between Putchar() and putbyte() though.
*/
-Putchar(tc)
- tchar tc;
+void
+Putchar(tchar tc)
{
putbyte((int)tc);
}
@@ -175,13 +178,13 @@ Putchar(tc)
#endif /* !MBCHAR */
void
-draino()
+draino(void)
{
linp = linbuf;
}
void
-flush()
+flush(void)
{
int unit;
int lmode;
diff --git a/usr/src/cmd/csh/sh.proc.c b/usr/src/cmd/csh/sh.proc.c
index 2e4bfc4ea9..d29a5ae8d9 100644
--- a/usr/src/cmd/csh/sh.proc.c
+++ b/usr/src/cmd/csh/sh.proc.c
@@ -26,6 +26,18 @@
#define BIGINDEX 9 /* largest desirable job index */
+void pjwait(struct process *);
+void pflush(struct process *);
+void pclrcurr(struct process *);
+void padd(struct command *);
+void pads(tchar *);
+void ptprint(struct process *);
+void pkill(tchar **, int);
+void pstart(struct process *, int);
+void okpcntl(void);
+struct process *pgetcurr(struct process *);
+struct process *pfind(tchar *);
+
/*
* pchild - called at interrupt level by the SIGCHLD signal
* indicating that at least one child has terminated or stopped
@@ -34,11 +46,11 @@
* to mask interrupts when playing with the proclist data structures!
*/
void
-pchild()
+pchild(void)
{
- register struct process *pp;
- register struct process *fp;
- register int pid;
+ struct process *pp;
+ struct process *fp;
+ int pid;
union wait w;
int jobflags;
struct rusage ru;
@@ -146,9 +158,10 @@ found:
goto loop;
}
-pnote()
+void
+pnote(void)
{
- register struct process *pp;
+ struct process *pp;
int flags, omask;
#ifdef TRACE
@@ -171,9 +184,10 @@ pnote()
* pwait - wait for current job to terminate, maintaining integrity
* of current and previous job indicators.
*/
-pwait()
+void
+pwait(void)
{
- register struct process *fp, *pp;
+ struct process *fp, *pp;
int omask;
#ifdef TRACE
@@ -201,10 +215,10 @@ pwait()
* pjwait - wait for a job to finish or become stopped
* It is assumed to be in the foreground state (PFOREGND)
*/
-pjwait(pp)
- register struct process *pp;
+void
+pjwait(struct process *pp)
{
- register struct process *fp;
+ struct process *fp;
int jobflags, reason, omask;
#ifdef TRACE
@@ -286,9 +300,10 @@ pjwait(pp)
/*
* dowait - wait for all processes to finish
*/
-dowait()
+void
+dowait(void)
{
- register struct process *pp;
+ struct process *pp;
int omask;
#ifdef TRACE
@@ -310,9 +325,10 @@ loop:
/*
* pflushall - flush all jobs from list (e.g. at fork())
*/
-pflushall()
+void
+pflushall(void)
{
- register struct process *pp;
+ struct process *pp;
#ifdef TRACE
tprintf("TRACE- pflush()\n");
@@ -327,11 +343,11 @@ pflushall()
* the argument process for deletion. The actual free of the
* space is not done here since pflush is called at interrupt level.
*/
-pflush(pp)
- register struct process *pp;
+void
+pflush(struct process *pp)
{
- register struct process *np;
- register int index;
+ struct process *np;
+ int index;
#ifdef TRACE
tprintf("TRACE- pflush()\n");
@@ -363,8 +379,8 @@ pflush(pp)
* pclrcurr - make sure the given job is not the current or previous job;
* pp MUST be the job leader
*/
-pclrcurr(pp)
- register struct process *pp;
+void
+pclrcurr(struct process *pp)
{
#ifdef TRACE
@@ -390,11 +406,10 @@ tchar *cmdp;
* palloc - allocate a process structure and fill it up.
* an important assumption is made that the process is running.
*/
-palloc(pid, t)
- int pid;
- register struct command *t;
+void
+palloc(int pid, struct command *t)
{
- register struct process *pp;
+ struct process *pp;
int i;
#ifdef TRACE
@@ -455,8 +470,8 @@ palloc(pid, t)
(void) gettimeofday(&pp->p_btime, (struct timezone *)0);
}
-padd(t)
- register struct command *t;
+void
+padd(struct command *t)
{
tchar **argp;
@@ -516,10 +531,10 @@ padd(t)
}
}
-pads(cp)
- tchar *cp;
+void
+pads(tchar *cp)
{
- register int i = strlen_(cp);
+ int i = strlen_(cp);
#ifdef TRACE
tprintf("TRACE- pads()\n");
@@ -542,7 +557,8 @@ pads(cp)
* so another job can be created. Used for { } in exp6
* and `` in globbing.
*/
-psavejob()
+void
+psavejob(void)
{
#ifdef TRACE
@@ -556,7 +572,8 @@ psavejob()
* prestjob - opposite of psavejob. This may be missed if we are interrupted
* somewhere, but pendjob cleans up anyway.
*/
-prestjob()
+void
+prestjob(void)
{
#ifdef TRACE
@@ -570,9 +587,10 @@ prestjob()
* pendjob - indicate that a job (set of commands) has been completed
* or is about to begin.
*/
-pendjob()
+void
+pendjob(void)
{
- register struct process *pp, *tp;
+ struct process *pp, *tp;
#ifdef TRACE
tprintf("TRACE- pendjob()\n");
@@ -595,10 +613,10 @@ pendjob()
/*
* pprint - print a job
*/
-pprint(pp, flag)
- register struct process *pp;
+int
+pprint(struct process *pp, int flag)
{
- register status, reason;
+ int status, reason;
struct process *tp;
extern char *linp, linbuf[];
int jobflags, pstatus;
@@ -728,14 +746,14 @@ prcomd:
return (jobflags);
}
-ptprint(tp)
- register struct process *tp;
+void
+ptprint(struct process *tp)
{
struct timeval tetime, diff;
static struct timeval ztime;
struct rusage ru;
static struct rusage zru;
- register struct process *pp = tp;
+ struct process *pp = tp;
#ifdef TRACE
tprintf("TRACE- ptprint()\n");
@@ -754,11 +772,11 @@ ptprint(tp)
/*
* dojobs - print all jobs
*/
-dojobs(v)
- tchar **v;
+void
+dojobs(tchar **v)
{
- register struct process *pp;
- register int flag = NUMBER|NAME|REASON;
+ struct process *pp;
+ int flag = NUMBER|NAME|REASON;
int i;
#ifdef TRACE
@@ -784,10 +802,10 @@ dojobs(v)
/*
* dofg - builtin - put the job into the foreground
*/
-dofg(v)
- tchar **v;
+void
+dofg(tchar **v)
{
- register struct process *pp;
+ struct process *pp;
#ifdef TRACE
tprintf("TRACE- dofg()\n");
@@ -804,10 +822,10 @@ dofg(v)
/*
* %... - builtin - put the job into the foreground
*/
-dofg1(v)
- tchar **v;
+void
+dofg1(tchar **v)
{
- register struct process *pp;
+ struct process *pp;
#ifdef TRACE
tprintf("TRACE- untty()\n");
@@ -821,10 +839,10 @@ dofg1(v)
/*
* dobg - builtin - put the job into the background
*/
-dobg(v)
- tchar **v;
+void
+dobg(tchar **v)
{
- register struct process *pp;
+ struct process *pp;
#ifdef TRACE
tprintf("TRACE- dobg()\n");
@@ -840,10 +858,10 @@ dobg(v)
/*
* %... & - builtin - put the job into the background
*/
-dobg1(v)
- tchar **v;
+void
+dobg1(tchar **v)
{
- register struct process *pp;
+ struct process *pp;
#ifdef TRACE
tprintf("TRACE- dobg1()\n");
@@ -855,8 +873,8 @@ dobg1(v)
/*
* dostop - builtin - stop the job
*/
-dostop(v)
- tchar **v;
+void
+dostop(tchar **v)
{
#ifdef TRACE
@@ -868,11 +886,11 @@ dostop(v)
/*
* dokill - builtin - superset of kill (1)
*/
-dokill(v)
- tchar **v;
+void
+dokill(tchar **v)
{
- register int signum;
- register tchar *name;
+ int signum;
+ tchar *name;
#ifdef TRACE
tprintf("TRACE- dokill()\n");
@@ -917,12 +935,11 @@ gotsig:
pkill(v, signum);
}
-pkill(v, signum)
- tchar **v;
- int signum;
+void
+pkill(tchar **v, int signum)
{
- register struct process *pp, *np;
- register int jobflags = 0;
+ struct process *pp, *np;
+ int jobflags = 0;
int omask, pid, err = 0;
tchar *cp;
@@ -986,11 +1003,10 @@ cont:
/*
* pstart - start the job in foreground/background
*/
-pstart(pp, foregnd)
- register struct process *pp;
- int foregnd;
+void
+pstart(struct process *pp, int foregnd)
{
- register struct process *np;
+ struct process *np;
int omask, jobflags = 0;
#ifdef TRACE
@@ -1036,9 +1052,10 @@ pstart(pp, foregnd)
(void) sigsetmask(omask);
}
-panystop(neednl)
+void
+panystop(int neednl)
{
- register struct process *pp;
+ struct process *pp;
#ifdef TRACE
tprintf("TRACE- panystop()\n");
@@ -1050,10 +1067,9 @@ panystop(neednl)
}
struct process *
-pfind(cp)
- tchar *cp;
+pfind(tchar *cp)
{
- register struct process *pp, *np;
+ struct process *pp, *np;
#ifdef TRACE
tprintf("TRACE- pfind()\n");
@@ -1082,7 +1098,7 @@ pfind(cp)
for (pp = proclist.p_next; pp; pp = pp->p_next)
if (pp->p_pid == pp->p_jobid) {
if (cp[1] == '?') {
- register tchar *dp;
+ tchar *dp;
for (dp = pp->p_command; *dp; dp++) {
if (*dp != cp[2])
continue;
@@ -1109,11 +1125,10 @@ match:
* pgetcurr - find most recent job that is not pp, preferably stopped
*/
struct process *
-pgetcurr(pp)
- register struct process *pp;
+pgetcurr(struct process *pp)
{
- register struct process *np;
- register struct process *xp = PNULL;
+ struct process *np;
+ struct process *xp = PNULL;
#ifdef TRACE
tprintf("TRACE- pgetcurr()\n");
@@ -1132,10 +1147,10 @@ pgetcurr(pp)
/*
* donotify - flag the job so as to report termination asynchronously
*/
-donotify(v)
- tchar **v;
+void
+donotify(tchar **v)
{
- register struct process *pp;
+ struct process *pp;
#ifdef TRACE
tprintf("TRACE- donotify()\n");
@@ -1154,12 +1169,14 @@ donotify(v)
* 0: already have tty; manipulate process pgrps only
* 1: want to claim tty; manipulate process and tty pgrps
* It is usually just the value of tpgrp.
+ *
+ * argument:
+ * t: command we are forking for
*/
-pfork(t, wanttty)
- struct command *t; /* command we are forking for */
- int wanttty;
+int
+pfork(struct command *t, int wanttty)
{
- register int pid;
+ int pid;
bool ignint = 0;
int pgrp, omask;
int child_pid;
@@ -1255,7 +1272,8 @@ pfork(t, wanttty)
return (pid);
}
-okpcntl()
+void
+okpcntl(void)
{
#ifdef TRACE
tprintf("TRACE- okpcntl()\n");
diff --git a/usr/src/cmd/csh/sh.proc.h b/usr/src/cmd/csh/sh.proc.h
index 63e39ef437..67aa69f763 100644
--- a/usr/src/cmd/csh/sh.proc.h
+++ b/usr/src/cmd/csh/sh.proc.h
@@ -1,5 +1,5 @@
/*
- * Copyright 1999 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -88,8 +88,3 @@ struct process *pcurrent; /* current job in table */
struct process *pprevious; /* previous job in table */
short pmaxindex; /* current maximum job index */
-
-int psigint();
-struct process *pgetcurr();
-struct process *plookup();
-struct process *pfind();
diff --git a/usr/src/cmd/csh/sh.sem.c b/usr/src/cmd/csh/sh.sem.c
index e55a747e12..1cec053ba5 100644
--- a/usr/src/cmd/csh/sh.sem.c
+++ b/usr/src/cmd/csh/sh.sem.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -24,6 +24,10 @@
* C shell
*/
+void doio(struct command *, int *, int *);
+void mypipe(int *);
+void chkclob(tchar *);
+
/*
* Return true if there is a back-quote (`) anywhere in the argument list.
* Its presence would cause glob() to be invoked in the child process
@@ -45,8 +49,9 @@ AnyBquote(struct command *t)
}
/*VARARGS 1*/
+void
execute(t, wanttty, pipein, pipeout)
- register struct command *t;
+ struct command *t;
int wanttty, *pipein, *pipeout;
{
bool forked = 0;
@@ -382,9 +387,9 @@ execute(t, wanttty, pipein, pipeout)
#ifdef VFORK
void
-vffree()
+vffree(void)
{
- register tchar **v;
+ tchar **v;
#ifdef TRACE
tprintf("TRACE- vffree()\n");
@@ -401,12 +406,11 @@ vffree()
* Perform io redirection.
* We may or maynot be forked here.
*/
-doio(t, pipein, pipeout)
- register struct command *t;
- int *pipein, *pipeout;
+void
+doio(struct command *t, int *pipein, int *pipeout)
{
- register tchar *cp, *dp;
- register int flags = t->t_dflg;
+ tchar *cp, *dp;
+ int flags = t->t_dflg;
int fd;
#ifdef TRACE
@@ -485,8 +489,8 @@ doio(t, pipein, pipeout)
didfds = 1;
}
-mypipe(pv)
- register int *pv;
+void
+mypipe(int *pv)
{
#ifdef TRACE
@@ -505,8 +509,8 @@ oops:
error("Can't make pipe");
}
-chkclob(cp)
- register tchar *cp;
+void
+chkclob(tchar *cp)
{
struct stat stb;
unsigned short type;
diff --git a/usr/src/cmd/csh/sh.set.c b/usr/src/cmd/csh/sh.set.c
index b6d03027b6..5c8a070817 100644
--- a/usr/src/cmd/csh/sh.set.c
+++ b/usr/src/cmd/csh/sh.set.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -16,16 +16,30 @@
#include "sh.h"
#include "sh.tconst.h"
-extern didchdir;
+extern int didchdir;
/*
* C Shell
*/
-doset(v)
- register tchar **v;
+void asx(tchar *, int, tchar *);
+void putn1(int);
+void set(tchar *, tchar *);
+void set1(tchar *, tchar **, struct varent *);
+void setq(tchar *, tchar **, struct varent *);
+void unset1(tchar *[], struct varent *);
+void unsetv1(struct varent *);
+void exportpath(tchar **);
+void balance(struct varent *, int, int);
+tchar *operate(tchar, tchar *, tchar *);
+tchar *getinx(tchar *, int *);
+tchar *xset(tchar *, tchar ***);
+struct varent *getvx(tchar *, int);
+
+void
+doset(tchar **v)
{
- register tchar *p;
+ tchar *p;
tchar *vp, op;
tchar **vecp;
bool hadsub;
@@ -71,7 +85,7 @@ doset(v)
setsyn:
bferr("Syntax error");
if (eq(p, S_LPAR/*"("*/)) {
- register tchar **e = v;
+ tchar **e = v;
if (hadsub)
goto setsyn;
@@ -99,7 +113,7 @@ setsyn:
exportpath(adrof(S_path/*"path"*/)->vec);
dohash(xhash);
} else if (eq(vp, S_histchars/*"histchars"*/)) {
- register tchar *p = value(S_histchars/*"histchars"*/);
+ tchar *p = value(S_histchars/*"histchars"*/);
HIST = *p++;
HISTSUB = *p;
} else if (eq(vp, S_user/*"user"*/))
@@ -118,9 +132,7 @@ setsyn:
}
tchar *
-getinx(cp, ip)
- register tchar *cp;
- register int *ip;
+getinx(tchar *cp, int *ip)
{
#ifdef TRACE
@@ -135,12 +147,10 @@ getinx(cp, ip)
return (cp);
}
-asx(vp, subscr, p)
- tchar *vp;
- int subscr;
- tchar *p;
+void
+asx(tchar *vp, int subscr, tchar *p)
{
- register struct varent *v = getvx(vp, subscr);
+ struct varent *v = getvx(vp, subscr);
#ifdef TRACE
tprintf("TRACE- asx()\n");
@@ -150,10 +160,9 @@ asx(vp, subscr, p)
}
struct varent *
-getvx(vp, subscr)
- tchar *vp;
+getvx(tchar *vp, int subscr)
{
- register struct varent *v = adrof(vp);
+ struct varent *v = adrof(vp);
#ifdef TRACE
tprintf("TRACE- getvx()\n");
@@ -167,10 +176,10 @@ getvx(vp, subscr)
tchar plusplus[2] = { '1', 0 };
-dolet(v)
- tchar **v;
+void
+dolet(tchar **v)
{
- register tchar *p;
+ tchar *p;
tchar *vp, c, op;
bool hadsub;
int subscr;
@@ -256,10 +265,9 @@ letsyn:
}
tchar *
-xset(cp, vp)
- tchar *cp, ***vp;
+xset(tchar *cp, tchar ***vp)
{
- register tchar *dp;
+ tchar *dp;
#ifdef TRACE
tprintf("TRACE- xset()\n");
@@ -274,14 +282,13 @@ xset(cp, vp)
}
tchar *
-operate(op, vp, p)
- tchar op, *vp, *p;
+operate(tchar op, tchar *vp, tchar *p)
{
tchar opr[2];
tchar *vec[5];
- register tchar **v = vec;
+ tchar **v = vec;
tchar **vecp = v;
- register int i;
+ int i;
if (op != '=') {
if (*vp)
@@ -303,8 +310,7 @@ operate(op, vp, p)
static tchar *putp;
tchar *
-putn(n)
- register int n;
+putn(int n)
{
static tchar number[15];
@@ -332,8 +338,8 @@ putn(n)
return (savestr(number));
}
-putn1(n)
- register int n;
+void
+putn1(int n)
{
#ifdef TRACE
tprintf("TRACE- putn1()\n");
@@ -343,10 +349,10 @@ putn1(n)
*putp++ = n % 10 + '0';
}
-getn(cp)
- register tchar *cp;
+int
+getn(tchar *cp)
{
- register int n;
+ int n;
int sign;
#ifdef TRACE
@@ -373,11 +379,9 @@ badnum:
}
tchar *
-value1(var, head)
- tchar *var;
- struct varent *head;
+value1(tchar *var, struct varent *head)
{
- register struct varent *vp;
+ struct varent *vp;
#ifdef TRACE
tprintf("TRACE- value1()\n");
@@ -387,11 +391,9 @@ value1(var, head)
}
struct varent *
-madrof(pat, vp)
- tchar *pat;
- register struct varent *vp;
+madrof(tchar *pat, struct varent *vp)
{
- register struct varent *vp1;
+ struct varent *vp1;
#ifdef TRACE
tprintf("TRACE- madrof()\n");
@@ -406,11 +408,9 @@ madrof(pat, vp)
}
struct varent *
-adrof1(name, v)
- register tchar *name;
- register struct varent *v;
+adrof1(tchar *name, struct varent *v)
{
- register cmp;
+ int cmp;
#ifdef TRACE
tprintf("TRACE- adrof1()\n");
@@ -428,10 +428,10 @@ adrof1(name, v)
/*
* The caller is responsible for putting value in a safe place
*/
-set(var, val)
- tchar *var, *val;
+void
+set(tchar *var, tchar *val)
{
- register tchar **vec = (tchar **) xalloc(2 * sizeof (tchar **));
+ tchar **vec = (tchar **) xalloc(2 * sizeof (tchar **));
#ifdef TRACE
tprintf("TRACE- set()\n");
@@ -441,11 +441,10 @@ set(var, val)
set1(var, vec, &shvhed);
}
-set1(var, vec, head)
- tchar *var, **vec;
- struct varent *head;
+void
+set1(tchar *var, tchar **vec, struct varent *head)
{
- register tchar **oldv = vec;
+ tchar **oldv = vec;
#ifdef TRACE
tprintf("TRACE- set1()\n");
@@ -472,12 +471,11 @@ set1(var, vec, head)
setq(var, vec, head);
}
-setq(name, vec, p)
- tchar *name, **vec;
- register struct varent *p;
+void
+setq(tchar *name, tchar **vec, struct varent *p)
{
- register struct varent *c;
- register f;
+ struct varent *c;
+ int f;
#ifdef TRACE
tprintf("TRACE- setq()\n");
@@ -502,8 +500,8 @@ found:
trim(c->vec = vec);
}
-unset(v)
- tchar *v[];
+void
+unset(tchar *v[])
{
#ifdef TRACE
@@ -520,12 +518,11 @@ unset(v)
#endif
}
-unset1(v, head)
- register tchar *v[];
- struct varent *head;
+void
+unset1(tchar *v[], struct varent *head)
{
- register struct varent *vp;
- register int cnt;
+ struct varent *vp;
+ int cnt;
#ifdef TRACE
tprintf("TRACE- unset1()\n");
@@ -539,10 +536,10 @@ unset1(v, head)
}
}
-unsetv(var)
- tchar *var;
+void
+unsetv(tchar *var)
{
- register struct varent *vp;
+ struct varent *vp;
#ifdef TRACE
tprintf("TRACE- unsetv()\n");
@@ -552,11 +549,11 @@ unsetv(var)
unsetv1(vp);
}
-unsetv1(p)
- register struct varent *p;
+void
+unsetv1(struct varent *p)
{
- register struct varent *c, *pp;
- register f;
+ struct varent *c, *pp;
+ int f;
#ifdef TRACE
tprintf("TRACE- unsetv1()\n");
@@ -598,8 +595,8 @@ unsetv1(p)
balance(pp, f, 1);
}
-setNS(cp)
- tchar *cp;
+void
+setNS(tchar *cp)
{
#ifdef TRACE
tprintf("TRACE- setNS()\n");
@@ -608,11 +605,11 @@ setNS(cp)
set(cp, S_/*""*/);
}
-shift(v)
- register tchar **v;
+void
+shift(tchar **v)
{
- register struct varent *argv;
- register tchar *name;
+ struct varent *argv;
+ tchar *name;
#ifdef TRACE
tprintf("TRACE- shift()\n");
@@ -631,8 +628,8 @@ shift(v)
lshift(argv->vec, 1);
}
-exportpath(val)
- tchar **val;
+void
+exportpath(tchar **val)
{
tchar exppath[PATHSIZ];
@@ -673,13 +670,12 @@ exportpath(val)
* F == 0 means we've come from p's left child.
* D == 1 means we've just done a delete, otherwise an insert.
*/
-balance(p, f, d)
- register struct varent *p;
- register f;
+void
+balance(struct varent *p, int f, int d)
{
- register struct varent *pp;
- register struct varent *t; /* used by the rotate macros */
- register ff;
+ struct varent *pp;
+ struct varent *t; /* used by the rotate macros */
+ int ff;
#ifdef TRACE
tprintf("TRACE- balance()\n");
@@ -765,11 +761,11 @@ balance(p, f, d)
}
}
-plist(p)
- register struct varent *p;
+void
+plist(struct varent *p)
{
- register struct varent *c;
- register len;
+ struct varent *c;
+ int len;
#ifdef TRACE
tprintf("TRACE- plist()\n");
diff --git a/usr/src/cmd/csh/sh.tchar.c b/usr/src/cmd/csh/sh.tchar.c
index 9c75f0e72d..6672e36f1d 100644
--- a/usr/src/cmd/csh/sh.tchar.c
+++ b/usr/src/cmd/csh/sh.tchar.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2000 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -301,6 +301,7 @@ rindex_(tchar *sp, tchar c)
/* Additional misc functions. */
/* Calculate the display width of a string. */
+int
tswidth(tchar *ts)
{
#ifdef MBCHAR
@@ -844,7 +845,7 @@ atoi_(tchar *str)
tchar *
simple(tchar *s)
{
- register tchar *sname = s;
+ tchar *sname = s;
while (1) {
if (any('/', sname)) {
diff --git a/usr/src/cmd/csh/sh.time.c b/usr/src/cmd/csh/sh.time.c
index 0564f29e07..1c92bc61ef 100644
--- a/usr/src/cmd/csh/sh.time.c
+++ b/usr/src/cmd/csh/sh.time.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -29,7 +29,7 @@ void tvsub(struct timeval *tdiff, struct timeval *t1, struct timeval *t0);
*/
void
-settimes()
+settimes(void)
{
struct rusage ruch;
@@ -47,7 +47,7 @@ settimes()
* prefix to another command
*/
void
-dotime()
+dotime(void)
{
struct timeval timedol;
struct rusage ru1, ruch;
diff --git a/usr/src/cmd/csh/sparc/Makefile b/usr/src/cmd/csh/sparc/Makefile
index a70d8110c7..e55f26110a 100644
--- a/usr/src/cmd/csh/sparc/Makefile
+++ b/usr/src/cmd/csh/sparc/Makefile
@@ -1,4 +1,4 @@
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
# Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T
@@ -24,8 +24,8 @@ include ../../Makefile.cmd
MBCHAR = -DMBCHAR # Define this line to include multibyte input support
DEFS = -DVFORK -DFILEC -DBSD_COMP -DFIVE # No TELL when MBCHAR
-CPPFLAGS= -I. -s $(DEFS) $(MBCHAR) $(CPPFLAGS.master)
-CPPFLAGS += -I ../../sh
+CPPFLAGS= -I. $(DEFS) $(MBCHAR) $(CPPFLAGS.master)
+CPPFLAGS += -I../../sh
CPPFLAGS += -D_FILE_OFFSET_BITS=64
LAZYLIBS = $(ZLAZYLOAD) -lsecdb $(ZNOLAZYLOAD)
lint := LAZYLIBS = -lsecdb
@@ -74,7 +74,7 @@ $(ROOTPFCSH): $(ROOTPROG)
sh.tconst.h: ../sh.tconst.c ../make.sh.tconst.h.ed
$(RM) $@
ed ../sh.tconst.c < ../make.sh.tconst.h.ed
-
+
$(HDDEP): sh.tconst.h
install: all $(ROOTBINPROG) $(ROOTPROG) $(ROOTPFCSH)
diff --git a/usr/src/cmd/csh/sparc/signal.c b/usr/src/cmd/csh/sparc/signal.c
index 02447723ff..9502940859 100644
--- a/usr/src/cmd/csh/sparc/signal.c
+++ b/usr/src/cmd/csh/sparc/signal.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -64,15 +64,12 @@ void (*_siguhandler[NSIG])() = { 0 };
*/
static void
-sigvechandler(sig, sip, ucp)
- int sig;
- siginfo_t *sip;
- ucontext_t *ucp;
+sigvechandler(int sig, siginfo_t *sip, ucontext_t *ucp)
{
struct sigcontext sc;
int code;
char *addr;
- register int i, j;
+ int i, j;
int gwinswitch = 0;
sc.sc_onstack = ((ucp->uc_stack.ss_flags & SS_ONSTACK) != 0);
@@ -148,8 +145,8 @@ sigvechandler(sig, sip, ucp)
setcontext (ucp);
}
-sigsetmask(mask)
- int mask;
+int
+sigsetmask(int mask)
{
sigset_t oset;
sigset_t nset;
@@ -160,8 +157,8 @@ sigsetmask(mask)
return set2mask(&oset);
}
-sigblock(mask)
- int mask;
+int
+sigblock(int mask)
{
sigset_t oset;
sigset_t nset;
@@ -172,8 +169,8 @@ sigblock(mask)
return set2mask(&oset);
}
-sigpause(mask)
- int mask;
+int
+sigpause(int mask)
{
sigset_t set;
@@ -182,10 +179,8 @@ sigpause(mask)
return (sigsuspend(&set));
}
-sigvec(sig, nvec, ovec)
- int sig;
- struct sigvec *nvec;
- struct sigvec *ovec;
+int
+sigvec(int sig, struct sigvec *nvec, struct sigvec *ovec)
{
struct sigaction nact;
struct sigaction oact;
@@ -247,9 +242,7 @@ sigvec(sig, nvec, ovec)
void (*
-signal(s, a))()
- int s;
- void (*a)();
+signal(int s, void (*a)()))()
{
struct sigvec osv;
struct sigvec nsv;