Changes include: sccsid -> rcsid, bcopy -> memcpy, don't use the
register keyword, and -Wall cleaning. Obtained from: similar changes in NetBSD
This commit is contained in:
+11
-11
@@ -1,5 +1,5 @@
|
|||||||
|
# $Id: Makefile,v 1.7 1997/02/22 14:01:36 peter Exp $
|
||||||
# @(#)Makefile 8.1 (Berkeley) 5/31/93
|
# @(#)Makefile 8.1 (Berkeley) 5/31/93
|
||||||
# $Id$
|
|
||||||
#
|
#
|
||||||
# C Shell with process control; VM/UNIX VAX Makefile
|
# C Shell with process control; VM/UNIX VAX Makefile
|
||||||
# Bill Joy UC Berkeley; Jim Kulp IIASA, Austria
|
# Bill Joy UC Berkeley; Jim Kulp IIASA, Austria
|
||||||
@@ -11,7 +11,7 @@ DFLAGS=-DBUILTIN -DFILEC -DNLS -DSHORT_STRINGS
|
|||||||
CFLAGS+=-I${.CURDIR} -I. ${DFLAGS}
|
CFLAGS+=-I${.CURDIR} -I. ${DFLAGS}
|
||||||
SRCS= alloc.c char.c const.c csh.c dir.c dol.c err.c exec.c exp.c file.c \
|
SRCS= alloc.c char.c const.c csh.c dir.c dol.c err.c exec.c exp.c file.c \
|
||||||
func.c glob.c hist.c init.c lex.c misc.c parse.c printf.c proc.c \
|
func.c glob.c hist.c init.c lex.c misc.c parse.c printf.c proc.c \
|
||||||
sem.c set.c str.c time.c const.h err.h
|
sem.c set.c str.c time.c const.h errnum.h
|
||||||
.PATH: ${.CURDIR}/../../usr.bin/printf
|
.PATH: ${.CURDIR}/../../usr.bin/printf
|
||||||
|
|
||||||
MAN1= csh.1
|
MAN1= csh.1
|
||||||
@@ -19,17 +19,17 @@ MLINKS= csh.1 limit.1 csh.1 alias.1 csh.1 bg.1 csh.1 dirs.1 csh.1 fg.1 \
|
|||||||
csh.1 foreach.1 csh.1 history.1 csh.1 jobs.1 csh.1 popd.1 \
|
csh.1 foreach.1 csh.1 history.1 csh.1 jobs.1 csh.1 popd.1 \
|
||||||
csh.1 pushd.1 csh.1 rehash.1 csh.1 repeat.1 csh.1 suspend.1 \
|
csh.1 pushd.1 csh.1 rehash.1 csh.1 repeat.1 csh.1 suspend.1 \
|
||||||
csh.1 stop.1 csh.1 source.1
|
csh.1 stop.1 csh.1 source.1
|
||||||
CLEANFILES+=err.h const.h
|
CLEANFILES+=const.h errnum.h
|
||||||
|
|
||||||
const.h: err.h
|
const.h: errnum.h
|
||||||
|
|
||||||
err.h: err.c
|
errnum.h: err.c
|
||||||
@rm -f $@
|
@rm -f ${.TARGET}
|
||||||
@echo '/* Do not edit this file, make creates it. */' > $@
|
@echo '/* Do not edit this file, make creates it. */' > ${.TARGET}
|
||||||
@echo '#ifndef _h_sh_err' >> $@
|
@echo '#ifndef _h_sh_error' >> ${.TARGET}
|
||||||
@echo '#define _h_sh_err' >> $@
|
@echo '#define _h_sh_error' >> ${.TARGET}
|
||||||
egrep 'ERR_' ${.CURDIR}/$*.c | egrep '^#define' >> $@
|
egrep 'ERR_' ${.ALLSRC} | egrep '^#define' >> ${.TARGET}
|
||||||
@echo '#endif /* _h_sh_err */' >> $@
|
@echo '#endif /* _h_sh_error */' >> ${.TARGET}
|
||||||
|
|
||||||
const.h: const.c
|
const.h: const.c
|
||||||
@rm -f $@
|
@rm -f $@
|
||||||
|
|||||||
+5
-2
@@ -29,12 +29,15 @@
|
|||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static char sccsid[] = "@(#)alloc.c 8.1 (Berkeley) 5/31/93";
|
static char sccsid[] = "@(#)alloc.c 8.1 (Berkeley) 5/31/93";
|
||||||
|
#else
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id: alloc.c,v 1.6 1997/02/22 14:01:37 peter Exp $";
|
||||||
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|||||||
+5
-2
@@ -29,12 +29,15 @@
|
|||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static char sccsid[] = "@(#)char.c 8.1 (Berkeley) 5/31/93";
|
static char sccsid[] = "@(#)char.c 8.1 (Berkeley) 5/31/93";
|
||||||
|
#else
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id: char.c,v 1.4 1997/02/22 14:01:37 peter Exp $";
|
||||||
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include "char.h"
|
#include "char.h"
|
||||||
|
|||||||
+5
-2
@@ -29,12 +29,15 @@
|
|||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static char sccsid[] = "@(#)const.c 8.1 (Berkeley) 5/31/93";
|
static char sccsid[] = "@(#)const.c 8.1 (Berkeley) 5/31/93";
|
||||||
|
#else
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id: const.c,v 1.6 1997/02/22 14:01:39 peter Exp $";
|
||||||
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
+24
-21
@@ -29,18 +29,21 @@
|
|||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char copyright[] =
|
static const char copyright[] =
|
||||||
"@(#) Copyright (c) 1980, 1991, 1993\n\
|
"@(#) Copyright (c) 1980, 1991, 1993\n\
|
||||||
The Regents of the University of California. All rights reserved.\n";
|
The Regents of the University of California. All rights reserved.\n";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static char sccsid[] = "@(#)csh.c 8.2 (Berkeley) 10/12/93";
|
static char sccsid[] = "@(#)csh.c 8.2 (Berkeley) 10/12/93";
|
||||||
|
#else
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id: csh.c,v 1.8 1997/02/22 14:01:41 peter Exp $";
|
||||||
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@@ -114,10 +117,10 @@ main(argc, argv)
|
|||||||
int argc;
|
int argc;
|
||||||
char **argv;
|
char **argv;
|
||||||
{
|
{
|
||||||
register Char *cp;
|
Char *cp;
|
||||||
register char *tcp;
|
char *tcp;
|
||||||
register int f;
|
int f;
|
||||||
register char **tempv;
|
char **tempv;
|
||||||
struct sigvec osv;
|
struct sigvec osv;
|
||||||
|
|
||||||
cshin = stdin;
|
cshin = stdin;
|
||||||
@@ -603,9 +606,9 @@ void
|
|||||||
importpath(cp)
|
importpath(cp)
|
||||||
Char *cp;
|
Char *cp;
|
||||||
{
|
{
|
||||||
register int i = 0;
|
int i = 0;
|
||||||
register Char *dp;
|
Char *dp;
|
||||||
register Char **pv;
|
Char **pv;
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
for (dp = cp; *dp; dp++)
|
for (dp = cp; *dp; dp++)
|
||||||
@@ -623,7 +626,7 @@ importpath(cp)
|
|||||||
if ((c = *dp) == ':' || c == 0) {
|
if ((c = *dp) == ':' || c == 0) {
|
||||||
*dp = 0;
|
*dp = 0;
|
||||||
if (*cp != '/' && (euid == 0 || uid == 0) &&
|
if (*cp != '/' && (euid == 0 || uid == 0) &&
|
||||||
(intact || intty && isatty(SHOUT)))
|
(intact || (intty && isatty(SHOUT))))
|
||||||
(void) fprintf(csherr,
|
(void) fprintf(csherr,
|
||||||
"Warning: imported path contains relative components\n");
|
"Warning: imported path contains relative components\n");
|
||||||
pv[i++] = Strsave(*cp ? cp : STRdot);
|
pv[i++] = Strsave(*cp ? cp : STRdot);
|
||||||
@@ -647,7 +650,7 @@ static int
|
|||||||
srccat(cp, dp)
|
srccat(cp, dp)
|
||||||
Char *cp, *dp;
|
Char *cp, *dp;
|
||||||
{
|
{
|
||||||
register Char *ep = Strspl(cp, dp);
|
Char *ep = Strspl(cp, dp);
|
||||||
char *ptr = short2str(ep);
|
char *ptr = short2str(ep);
|
||||||
|
|
||||||
xfree((ptr_t) ep);
|
xfree((ptr_t) ep);
|
||||||
@@ -662,7 +665,7 @@ srcfile(f, onlyown, flag)
|
|||||||
char *f;
|
char *f;
|
||||||
bool onlyown, flag;
|
bool onlyown, flag;
|
||||||
{
|
{
|
||||||
register int unit;
|
int unit;
|
||||||
|
|
||||||
if ((unit = open(f, O_RDONLY)) == -1)
|
if ((unit = open(f, O_RDONLY)) == -1)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -680,7 +683,7 @@ srcfile(f, onlyown, flag)
|
|||||||
int insource;
|
int insource;
|
||||||
static void
|
static void
|
||||||
srcunit(unit, onlyown, hflg)
|
srcunit(unit, onlyown, hflg)
|
||||||
register int unit;
|
int unit;
|
||||||
bool onlyown, hflg;
|
bool onlyown, hflg;
|
||||||
{
|
{
|
||||||
/* We have to push down a lot of state here */
|
/* We have to push down a lot of state here */
|
||||||
@@ -731,7 +734,7 @@ srcunit(unit, onlyown, hflg)
|
|||||||
if (setintr)
|
if (setintr)
|
||||||
omask = sigblock(sigmask(SIGINT));
|
omask = sigblock(sigmask(SIGINT));
|
||||||
/* Setup the new values of the state stuff saved above */
|
/* Setup the new values of the state stuff saved above */
|
||||||
bcopy((char *) &B, (char *) &(saveB), sizeof(B));
|
memcpy((char *) &(saveB), (char *) &B, sizeof(B));
|
||||||
fbuf = NULL;
|
fbuf = NULL;
|
||||||
fseekp = feobp = fblocks = 0;
|
fseekp = feobp = fblocks = 0;
|
||||||
oSHIN = SHIN, SHIN = unit, arginp = 0, onelflg = 0;
|
oSHIN = SHIN, SHIN = unit, arginp = 0, onelflg = 0;
|
||||||
@@ -756,7 +759,7 @@ srcunit(unit, onlyown, hflg)
|
|||||||
if (setintr)
|
if (setintr)
|
||||||
(void) sigsetmask(omask);
|
(void) sigsetmask(omask);
|
||||||
if (oSHIN >= 0) {
|
if (oSHIN >= 0) {
|
||||||
register int i;
|
int i;
|
||||||
|
|
||||||
/* We made it to the new state... free up its storage */
|
/* We made it to the new state... free up its storage */
|
||||||
/* This code could get run twice but xfree doesn't care */
|
/* This code could get run twice but xfree doesn't care */
|
||||||
@@ -765,7 +768,7 @@ srcunit(unit, onlyown, hflg)
|
|||||||
xfree((ptr_t) fbuf);
|
xfree((ptr_t) fbuf);
|
||||||
|
|
||||||
/* Reset input arena */
|
/* Reset input arena */
|
||||||
bcopy((char *) &(saveB), (char *) &B, sizeof(B));
|
memcpy((char *) &B, (char *) &(saveB), sizeof(B));
|
||||||
|
|
||||||
(void) close(SHIN), SHIN = oSHIN;
|
(void) close(SHIN), SHIN = oSHIN;
|
||||||
arginp = oarginp, onelflg = oonelflg;
|
arginp = oarginp, onelflg = oonelflg;
|
||||||
@@ -1120,7 +1123,7 @@ dosource(v, t)
|
|||||||
struct command *t;
|
struct command *t;
|
||||||
|
|
||||||
{
|
{
|
||||||
register Char *f;
|
Char *f;
|
||||||
bool hflg = 0;
|
bool hflg = 0;
|
||||||
Char buf[BUFSIZ];
|
Char buf[BUFSIZ];
|
||||||
|
|
||||||
@@ -1150,8 +1153,8 @@ dosource(v, t)
|
|||||||
static void
|
static void
|
||||||
mailchk()
|
mailchk()
|
||||||
{
|
{
|
||||||
register struct varent *v;
|
struct varent *v;
|
||||||
register Char **vp;
|
Char **vp;
|
||||||
time_t t;
|
time_t t;
|
||||||
int intvl, cnt;
|
int intvl, cnt;
|
||||||
struct stat stb;
|
struct stat stb;
|
||||||
@@ -1338,7 +1341,7 @@ defaultpath()
|
|||||||
void
|
void
|
||||||
printprompt()
|
printprompt()
|
||||||
{
|
{
|
||||||
register Char *cp;
|
Char *cp;
|
||||||
|
|
||||||
if (!whyles) {
|
if (!whyles) {
|
||||||
for (cp = value(STRprompt); *cp; cp++)
|
for (cp = value(STRprompt); *cp; cp++)
|
||||||
|
|||||||
+4
-4
@@ -31,7 +31,7 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* @(#)csh.h 8.1 (Berkeley) 5/31/93
|
* @(#)csh.h 8.1 (Berkeley) 5/31/93
|
||||||
* $Id$
|
* $Id: csh.h,v 1.4 1997/02/22 14:01:41 peter Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -84,7 +84,7 @@ typedef void *ptr_t;
|
|||||||
|
|
||||||
#include "const.h"
|
#include "const.h"
|
||||||
#include "char.h"
|
#include "char.h"
|
||||||
#include "err.h"
|
#include "errnum.h"
|
||||||
|
|
||||||
#define xmalloc(i) Malloc(i)
|
#define xmalloc(i) Malloc(i)
|
||||||
#define xrealloc(p, i) Realloc(p, i)
|
#define xrealloc(p, i) Realloc(p, i)
|
||||||
@@ -187,8 +187,8 @@ jmp_buf reslab;
|
|||||||
#define setexit() (setjmp(reslab))
|
#define setexit() (setjmp(reslab))
|
||||||
#define reset() longjmp(reslab, 1)
|
#define reset() longjmp(reslab, 1)
|
||||||
/* Should use structure assignment here */
|
/* Should use structure assignment here */
|
||||||
#define getexit(a) bcopy((char *)reslab, ((char *)(a)), sizeof reslab)
|
#define getexit(a) memcpy(((char *)(a)), (char *)reslab, sizeof reslab)
|
||||||
#define resexit(a) bcopy((char *)(a), (char *)reslab, sizeof reslab)
|
#define resexit(a) memcpy((char *)reslab, (char *)(a), sizeof reslab)
|
||||||
|
|
||||||
Char *gointr; /* Label for an onintr transfer */
|
Char *gointr; /* Label for an onintr transfer */
|
||||||
|
|
||||||
|
|||||||
+29
-26
@@ -29,12 +29,15 @@
|
|||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static char sccsid[] = "@(#)dir.c 8.1 (Berkeley) 5/31/93";
|
static char sccsid[] = "@(#)dir.c 8.1 (Berkeley) 5/31/93";
|
||||||
|
#else
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id: dir.c,v 1.6 1997/02/22 14:01:42 peter Exp $";
|
||||||
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
@@ -75,9 +78,9 @@ void
|
|||||||
dinit(hp)
|
dinit(hp)
|
||||||
Char *hp;
|
Char *hp;
|
||||||
{
|
{
|
||||||
register char *tcp;
|
char *tcp;
|
||||||
register Char *cp;
|
Char *cp;
|
||||||
register struct directory *dp;
|
struct directory *dp;
|
||||||
char path[MAXPATHLEN];
|
char path[MAXPATHLEN];
|
||||||
static char *emsg = "csh: Trying to start from \"%s\"\n";
|
static char *emsg = "csh: Trying to start from \"%s\"\n";
|
||||||
|
|
||||||
@@ -145,7 +148,7 @@ Char *dp;
|
|||||||
* Don't call set() directly cause if the directory contains ` or
|
* Don't call set() directly cause if the directory contains ` or
|
||||||
* other junk characters glob will fail.
|
* other junk characters glob will fail.
|
||||||
*/
|
*/
|
||||||
register Char **vec = (Char **) xmalloc((size_t) (2 * sizeof(Char **)));
|
Char **vec = (Char **) xmalloc((size_t) (2 * sizeof(Char **)));
|
||||||
|
|
||||||
vec[0] = Strsave(dp);
|
vec[0] = Strsave(dp);
|
||||||
vec[1] = 0;
|
vec[1] = 0;
|
||||||
@@ -203,7 +206,7 @@ dodirs(v, t)
|
|||||||
static void
|
static void
|
||||||
printdirs()
|
printdirs()
|
||||||
{
|
{
|
||||||
register struct directory *dp;
|
struct directory *dp;
|
||||||
Char *s, *hp = value(STRhome);
|
Char *s, *hp = value(STRhome);
|
||||||
int idx, len, cur;
|
int idx, len, cur;
|
||||||
|
|
||||||
@@ -240,7 +243,7 @@ printdirs()
|
|||||||
|
|
||||||
void
|
void
|
||||||
dtildepr(home, dir)
|
dtildepr(home, dir)
|
||||||
register Char *home, *dir;
|
Char *home, *dir;
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!eq(home, STRslash) && prefix(home, dir))
|
if (!eq(home, STRslash) && prefix(home, dir))
|
||||||
@@ -340,8 +343,8 @@ dochngd(v, t)
|
|||||||
Char **v;
|
Char **v;
|
||||||
struct command *t;
|
struct command *t;
|
||||||
{
|
{
|
||||||
register Char *cp;
|
Char *cp;
|
||||||
register struct directory *dp;
|
struct directory *dp;
|
||||||
|
|
||||||
skipargs(&v, " [<dir>]");
|
skipargs(&v, " [<dir>]");
|
||||||
printd = 0;
|
printd = 0;
|
||||||
@@ -389,7 +392,7 @@ dgoto(cp)
|
|||||||
Char *dp;
|
Char *dp;
|
||||||
|
|
||||||
if (*cp != '/') {
|
if (*cp != '/') {
|
||||||
register Char *p, *q;
|
Char *p, *q;
|
||||||
int cwdlen;
|
int cwdlen;
|
||||||
|
|
||||||
for (p = dcwd->di_name; *p++;)
|
for (p = dcwd->di_name; *p++;)
|
||||||
@@ -423,9 +426,9 @@ dgoto(cp)
|
|||||||
*/
|
*/
|
||||||
static Char *
|
static Char *
|
||||||
dfollow(cp)
|
dfollow(cp)
|
||||||
register Char *cp;
|
Char *cp;
|
||||||
{
|
{
|
||||||
register Char *dp;
|
Char *dp;
|
||||||
struct varent *c;
|
struct varent *c;
|
||||||
char ebuf[MAXPATHLEN];
|
char ebuf[MAXPATHLEN];
|
||||||
int serrno;
|
int serrno;
|
||||||
@@ -449,7 +452,7 @@ dfollow(cp)
|
|||||||
if (cp[0] != '/' && !prefix(STRdotsl, cp) && !prefix(STRdotdotsl, cp)
|
if (cp[0] != '/' && !prefix(STRdotsl, cp) && !prefix(STRdotdotsl, cp)
|
||||||
&& (c = adrof(STRcdpath))) {
|
&& (c = adrof(STRcdpath))) {
|
||||||
Char **cdp;
|
Char **cdp;
|
||||||
register Char *p;
|
Char *p;
|
||||||
Char buf[MAXPATHLEN];
|
Char buf[MAXPATHLEN];
|
||||||
|
|
||||||
for (cdp = c->vec; *cdp; cdp++) {
|
for (cdp = c->vec; *cdp; cdp++) {
|
||||||
@@ -491,7 +494,7 @@ dopushd(v, t)
|
|||||||
Char **v;
|
Char **v;
|
||||||
struct command *t;
|
struct command *t;
|
||||||
{
|
{
|
||||||
register struct directory *dp;
|
struct directory *dp;
|
||||||
|
|
||||||
skipargs(&v, " [<dir>|+<n>]");
|
skipargs(&v, " [<dir>|+<n>]");
|
||||||
printd = 1;
|
printd = 1;
|
||||||
@@ -523,7 +526,7 @@ dopushd(v, t)
|
|||||||
stderror(ERR_SYSTEM, tmp, strerror(errno));
|
stderror(ERR_SYSTEM, tmp, strerror(errno));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
register Char *ccp;
|
Char *ccp;
|
||||||
|
|
||||||
ccp = dfollow(*v);
|
ccp = dfollow(*v);
|
||||||
dp = (struct directory *) xcalloc(sizeof(struct directory), 1);
|
dp = (struct directory *) xcalloc(sizeof(struct directory), 1);
|
||||||
@@ -542,11 +545,11 @@ dopushd(v, t)
|
|||||||
*/
|
*/
|
||||||
static struct directory *
|
static struct directory *
|
||||||
dfind(cp)
|
dfind(cp)
|
||||||
register Char *cp;
|
Char *cp;
|
||||||
{
|
{
|
||||||
register struct directory *dp;
|
struct directory *dp;
|
||||||
register int i;
|
int i;
|
||||||
register Char *ep;
|
Char *ep;
|
||||||
|
|
||||||
if (*cp++ != '+')
|
if (*cp++ != '+')
|
||||||
return (0);
|
return (0);
|
||||||
@@ -576,7 +579,7 @@ dopopd(v, t)
|
|||||||
Char **v;
|
Char **v;
|
||||||
struct command *t;
|
struct command *t;
|
||||||
{
|
{
|
||||||
register struct directory *dp, *p = NULL;
|
struct directory *dp, *p = NULL;
|
||||||
|
|
||||||
skipargs(&v, " [+<n>]");
|
skipargs(&v, " [+<n>]");
|
||||||
printd = 1;
|
printd = 1;
|
||||||
@@ -614,7 +617,7 @@ dopopd(v, t)
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
dfree(dp)
|
dfree(dp)
|
||||||
register struct directory *dp;
|
struct directory *dp;
|
||||||
{
|
{
|
||||||
|
|
||||||
if (dp->di_count != 0) {
|
if (dp->di_count != 0) {
|
||||||
@@ -633,10 +636,10 @@ dfree(dp)
|
|||||||
*/
|
*/
|
||||||
Char *
|
Char *
|
||||||
dcanon(cp, p)
|
dcanon(cp, p)
|
||||||
register Char *cp, *p;
|
Char *cp, *p;
|
||||||
{
|
{
|
||||||
register Char *sp;
|
Char *sp;
|
||||||
register Char *p1, *p2; /* general purpose */
|
Char *p1, *p2; /* general purpose */
|
||||||
bool slash;
|
bool slash;
|
||||||
|
|
||||||
Char link[MAXPATHLEN];
|
Char link[MAXPATHLEN];
|
||||||
@@ -923,7 +926,7 @@ dcanon(cp, p)
|
|||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
dnewcwd(dp)
|
dnewcwd(dp)
|
||||||
register struct directory *dp;
|
struct directory *dp;
|
||||||
{
|
{
|
||||||
dcwd = dp;
|
dcwd = dp;
|
||||||
dset(dcwd->di_name);
|
dset(dcwd->di_name);
|
||||||
|
|||||||
+27
-24
@@ -29,12 +29,15 @@
|
|||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static char sccsid[] = "@(#)dol.c 8.1 (Berkeley) 5/31/93";
|
static char sccsid[] = "@(#)dol.c 8.1 (Berkeley) 5/31/93";
|
||||||
|
#else
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id: dol.c,v 1.5 1997/02/22 14:01:47 peter Exp $";
|
||||||
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@@ -105,10 +108,10 @@ static void Dtestq __P((int));
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
Dfix(t)
|
Dfix(t)
|
||||||
register struct command *t;
|
struct command *t;
|
||||||
{
|
{
|
||||||
register Char **pp;
|
Char **pp;
|
||||||
register Char *p;
|
Char *p;
|
||||||
|
|
||||||
if (noexec)
|
if (noexec)
|
||||||
return;
|
return;
|
||||||
@@ -130,7 +133,7 @@ Dfix(t)
|
|||||||
*/
|
*/
|
||||||
Char *
|
Char *
|
||||||
Dfix1(cp)
|
Dfix1(cp)
|
||||||
register Char *cp;
|
Char *cp;
|
||||||
{
|
{
|
||||||
Char *Dv[2];
|
Char *Dv[2];
|
||||||
|
|
||||||
@@ -173,8 +176,8 @@ static Char *
|
|||||||
Dpack(wbuf, wp)
|
Dpack(wbuf, wp)
|
||||||
Char *wbuf, *wp;
|
Char *wbuf, *wp;
|
||||||
{
|
{
|
||||||
register int c;
|
int c;
|
||||||
register int i = MAXWLEN - (wp - wbuf);
|
int i = MAXWLEN - (wp - wbuf);
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
c = DgetC(DODOL);
|
c = DgetC(DODOL);
|
||||||
@@ -220,11 +223,11 @@ Dpack(wbuf, wp)
|
|||||||
static int
|
static int
|
||||||
Dword()
|
Dword()
|
||||||
{
|
{
|
||||||
register int c, c1;
|
int c, c1;
|
||||||
Char wbuf[BUFSIZ];
|
Char wbuf[BUFSIZ];
|
||||||
register Char *wp = wbuf;
|
Char *wp = wbuf;
|
||||||
register int i = MAXWLEN;
|
int i = MAXWLEN;
|
||||||
register bool dolflg;
|
bool dolflg;
|
||||||
bool sofar = 0, done = 0;
|
bool sofar = 0, done = 0;
|
||||||
|
|
||||||
while (!done) {
|
while (!done) {
|
||||||
@@ -340,9 +343,9 @@ Dword()
|
|||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
DgetC(flag)
|
DgetC(flag)
|
||||||
register int flag;
|
int flag;
|
||||||
{
|
{
|
||||||
register int c;
|
int c;
|
||||||
|
|
||||||
top:
|
top:
|
||||||
if ((c = Dpeekc) != '\0') {
|
if ((c = Dpeekc) != '\0') {
|
||||||
@@ -401,8 +404,8 @@ dolerror(s)
|
|||||||
static void
|
static void
|
||||||
Dgetdol()
|
Dgetdol()
|
||||||
{
|
{
|
||||||
register Char *np;
|
Char *np;
|
||||||
register struct varent *vp = NULL;
|
struct varent *vp = NULL;
|
||||||
Char name[4 * MAXVARLEN + 1];
|
Char name[4 * MAXVARLEN + 1];
|
||||||
int c, sc;
|
int c, sc;
|
||||||
int subscr = 0, lwb = 1, upb = 0;
|
int subscr = 0, lwb = 1, upb = 0;
|
||||||
@@ -574,7 +577,7 @@ Dgetdol()
|
|||||||
else if (*np != '-')
|
else if (*np != '-')
|
||||||
stderror(ERR_MISSING, '-');
|
stderror(ERR_MISSING, '-');
|
||||||
else {
|
else {
|
||||||
register int i = upb;
|
int i = upb;
|
||||||
|
|
||||||
np++;
|
np++;
|
||||||
if (Isdigit(*np)) {
|
if (Isdigit(*np)) {
|
||||||
@@ -632,7 +635,7 @@ Dgetdol()
|
|||||||
static void
|
static void
|
||||||
fixDolMod()
|
fixDolMod()
|
||||||
{
|
{
|
||||||
register int c;
|
int c;
|
||||||
|
|
||||||
c = DgetC(0);
|
c = DgetC(0);
|
||||||
if (c == ':') {
|
if (c == ':') {
|
||||||
@@ -691,9 +694,9 @@ fixDolMod()
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
setDolp(cp)
|
setDolp(cp)
|
||||||
register Char *cp;
|
Char *cp;
|
||||||
{
|
{
|
||||||
register Char *dp;
|
Char *dp;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (dolnmod == 0 || dolmcnt == 0) {
|
if (dolnmod == 0 || dolmcnt == 0) {
|
||||||
@@ -804,7 +807,7 @@ unDredc(c)
|
|||||||
static int
|
static int
|
||||||
Dredc()
|
Dredc()
|
||||||
{
|
{
|
||||||
register int c;
|
int c;
|
||||||
|
|
||||||
if ((c = Dpeekrd) != '\0') {
|
if ((c = Dpeekrd) != '\0') {
|
||||||
Dpeekrd = 0;
|
Dpeekrd = 0;
|
||||||
@@ -822,7 +825,7 @@ Dredc()
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
Dtestq(c)
|
Dtestq(c)
|
||||||
register int c;
|
int c;
|
||||||
{
|
{
|
||||||
|
|
||||||
if (cmap(c, QUOTES))
|
if (cmap(c, QUOTES))
|
||||||
@@ -839,11 +842,11 @@ void
|
|||||||
heredoc(term)
|
heredoc(term)
|
||||||
Char *term;
|
Char *term;
|
||||||
{
|
{
|
||||||
register int c;
|
int c;
|
||||||
Char *Dv[2];
|
Char *Dv[2];
|
||||||
Char obuf[BUFSIZ], lbuf[BUFSIZ], mbuf[BUFSIZ];
|
Char obuf[BUFSIZ], lbuf[BUFSIZ], mbuf[BUFSIZ];
|
||||||
int ocnt, lcnt, mcnt;
|
int ocnt, lcnt, mcnt;
|
||||||
register Char *lbp, *obp, *mbp;
|
Char *lbp, *obp, *mbp;
|
||||||
Char **vp;
|
Char **vp;
|
||||||
bool quoted;
|
bool quoted;
|
||||||
char *tmp;
|
char *tmp;
|
||||||
|
|||||||
+6
-3
@@ -29,12 +29,15 @@
|
|||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static char sccsid[] = "@(#)err.c 8.1 (Berkeley) 5/31/93";
|
static char sccsid[] = "@(#)err.c 8.1 (Berkeley) 5/31/93";
|
||||||
|
#else
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id: err.c,v 1.4 1997/02/22 14:01:48 peter Exp $";
|
||||||
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@@ -342,7 +345,7 @@ stderror(id, va_alist)
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
va_list va;
|
va_list va;
|
||||||
register Char **v;
|
Char **v;
|
||||||
int flags = id & ERR_FLAGS;
|
int flags = id & ERR_FLAGS;
|
||||||
|
|
||||||
id &= ~ERR_FLAGS;
|
id &= ~ERR_FLAGS;
|
||||||
|
|||||||
+30
-27
@@ -29,12 +29,15 @@
|
|||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static char sccsid[] = "@(#)exec.c 8.1 (Berkeley) 5/31/93";
|
static char sccsid[] = "@(#)exec.c 8.1 (Berkeley) 5/31/93";
|
||||||
|
#else
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id: exec.c,v 1.6 1997/02/22 14:01:50 peter Exp $";
|
||||||
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@@ -113,10 +116,10 @@ doexec(v, t)
|
|||||||
Char **v;
|
Char **v;
|
||||||
struct command *t;
|
struct command *t;
|
||||||
{
|
{
|
||||||
register Char *dp, **pv, **av, *sav;
|
Char *dp, **pv, **av, *sav;
|
||||||
register struct varent *pathv;
|
struct varent *pathv;
|
||||||
register bool slash;
|
bool slash;
|
||||||
register int hashval = 0, hashval1, i;
|
int hashval = 0, hashval1, i;
|
||||||
Char *blk[2];
|
Char *blk[2];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -265,12 +268,12 @@ pexerr()
|
|||||||
static void
|
static void
|
||||||
texec(sf, st)
|
texec(sf, st)
|
||||||
Char *sf;
|
Char *sf;
|
||||||
register Char **st;
|
Char **st;
|
||||||
{
|
{
|
||||||
register char **t;
|
char **t;
|
||||||
register char *f;
|
char *f;
|
||||||
register struct varent *v;
|
struct varent *v;
|
||||||
register Char **vp;
|
Char **vp;
|
||||||
Char *lastsh[2];
|
Char *lastsh[2];
|
||||||
int fd;
|
int fd;
|
||||||
unsigned char c;
|
unsigned char c;
|
||||||
@@ -361,7 +364,7 @@ texec(sf, st)
|
|||||||
void
|
void
|
||||||
execash(t, kp)
|
execash(t, kp)
|
||||||
Char **t;
|
Char **t;
|
||||||
register struct command *kp;
|
struct command *kp;
|
||||||
{
|
{
|
||||||
int saveIN, saveOUT, saveDIAG, saveSTD;
|
int saveIN, saveOUT, saveDIAG, saveSTD;
|
||||||
int oSHIN;
|
int oSHIN;
|
||||||
@@ -446,8 +449,8 @@ dohash(v, t)
|
|||||||
struct command *t;
|
struct command *t;
|
||||||
{
|
{
|
||||||
DIR *dirp;
|
DIR *dirp;
|
||||||
register struct dirent *dp;
|
struct dirent *dp;
|
||||||
register int cnt;
|
int cnt;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
struct varent *pathv = adrof(STRpath);
|
struct varent *pathv = adrof(STRpath);
|
||||||
Char **pv;
|
Char **pv;
|
||||||
@@ -504,9 +507,9 @@ hashstat(v, t)
|
|||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
hashname(cp)
|
hashname(cp)
|
||||||
register Char *cp;
|
Char *cp;
|
||||||
{
|
{
|
||||||
register long h = 0;
|
long h = 0;
|
||||||
|
|
||||||
while (*cp)
|
while (*cp)
|
||||||
h = hash(h, *cp++);
|
h = hash(h, *cp++);
|
||||||
@@ -517,11 +520,11 @@ static int
|
|||||||
iscommand(name)
|
iscommand(name)
|
||||||
Char *name;
|
Char *name;
|
||||||
{
|
{
|
||||||
register Char **pv;
|
Char **pv;
|
||||||
register Char *sav;
|
Char *sav;
|
||||||
register struct varent *v;
|
struct varent *v;
|
||||||
register bool slash = any(short2str(name), '/');
|
bool slash = any(short2str(name), '/');
|
||||||
register int hashval = 0, hashval1, i;
|
int hashval = 0, hashval1, i;
|
||||||
|
|
||||||
v = adrof(STRpath);
|
v = adrof(STRpath);
|
||||||
if (v == 0 || v->vec[0] == 0 || slash)
|
if (v == 0 || v->vec[0] == 0 || slash)
|
||||||
@@ -618,7 +621,7 @@ executable(dir, name, dir_ok)
|
|||||||
/*ARGSUSED*/
|
/*ARGSUSED*/
|
||||||
void
|
void
|
||||||
dowhich(v, c)
|
dowhich(v, c)
|
||||||
register Char **v;
|
Char **v;
|
||||||
struct command *c;
|
struct command *c;
|
||||||
{
|
{
|
||||||
struct wordent lex[3];
|
struct wordent lex[3];
|
||||||
@@ -652,9 +655,9 @@ static void
|
|||||||
tellmewhat(lex)
|
tellmewhat(lex)
|
||||||
struct wordent *lex;
|
struct wordent *lex;
|
||||||
{
|
{
|
||||||
register int i;
|
int i;
|
||||||
register struct biltins *bptr;
|
struct biltins *bptr;
|
||||||
register struct wordent *sp = lex->next;
|
struct wordent *sp = lex->next;
|
||||||
bool aliased = 0;
|
bool aliased = 0;
|
||||||
Char *s0, *s1, *s2, *cmd;
|
Char *s0, *s1, *s2, *cmd;
|
||||||
Char qc;
|
Char qc;
|
||||||
@@ -706,8 +709,8 @@ tellmewhat(lex)
|
|||||||
sp->word = cmd = globone(sp->word, G_IGNORE);
|
sp->word = cmd = globone(sp->word, G_IGNORE);
|
||||||
|
|
||||||
if ((i = iscommand(strip(sp->word))) != 0) {
|
if ((i = iscommand(strip(sp->word))) != 0) {
|
||||||
register Char **pv;
|
Char **pv;
|
||||||
register struct varent *v;
|
struct varent *v;
|
||||||
bool slash = any(short2str(sp->word), '/');
|
bool slash = any(short2str(sp->word), '/');
|
||||||
|
|
||||||
v = adrof(STRpath);
|
v = adrof(STRpath);
|
||||||
|
|||||||
+49
-46
@@ -29,12 +29,15 @@
|
|||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static char sccsid[] = "@(#)exp.c 8.1 (Berkeley) 5/31/93";
|
static char sccsid[] = "@(#)exp.c 8.1 (Berkeley) 5/31/93";
|
||||||
|
#else
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id: exp.c,v 1.4 1997/02/22 14:01:52 peter Exp $";
|
||||||
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@@ -91,23 +94,23 @@ static void etraci __P((char *, int, Char ***));
|
|||||||
|
|
||||||
int
|
int
|
||||||
expr(vp)
|
expr(vp)
|
||||||
register Char ***vp;
|
Char ***vp;
|
||||||
{
|
{
|
||||||
return (exp0(vp, 0));
|
return (exp0(vp, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
exp0(vp, ignore)
|
exp0(vp, ignore)
|
||||||
register Char ***vp;
|
Char ***vp;
|
||||||
bool ignore;
|
bool ignore;
|
||||||
{
|
{
|
||||||
register int p1 = exp1(vp, ignore);
|
int p1 = exp1(vp, ignore);
|
||||||
|
|
||||||
#ifdef EDEBUG
|
#ifdef EDEBUG
|
||||||
etraci("exp0 p1", p1, vp);
|
etraci("exp0 p1", p1, vp);
|
||||||
#endif
|
#endif
|
||||||
if (**vp && eq(**vp, STRor2)) {
|
if (**vp && eq(**vp, STRor2)) {
|
||||||
register int p2;
|
int p2;
|
||||||
|
|
||||||
(*vp)++;
|
(*vp)++;
|
||||||
p2 = exp0(vp, (ignore & IGNORE) || p1);
|
p2 = exp0(vp, (ignore & IGNORE) || p1);
|
||||||
@@ -121,16 +124,16 @@ exp0(vp, ignore)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
exp1(vp, ignore)
|
exp1(vp, ignore)
|
||||||
register Char ***vp;
|
Char ***vp;
|
||||||
bool ignore;
|
bool ignore;
|
||||||
{
|
{
|
||||||
register int p1 = exp2(vp, ignore);
|
int p1 = exp2(vp, ignore);
|
||||||
|
|
||||||
#ifdef EDEBUG
|
#ifdef EDEBUG
|
||||||
etraci("exp1 p1", p1, vp);
|
etraci("exp1 p1", p1, vp);
|
||||||
#endif
|
#endif
|
||||||
if (**vp && eq(**vp, STRand2)) {
|
if (**vp && eq(**vp, STRand2)) {
|
||||||
register int p2;
|
int p2;
|
||||||
|
|
||||||
(*vp)++;
|
(*vp)++;
|
||||||
p2 = exp1(vp, (ignore & IGNORE) || !p1);
|
p2 = exp1(vp, (ignore & IGNORE) || !p1);
|
||||||
@@ -144,16 +147,16 @@ exp1(vp, ignore)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
exp2(vp, ignore)
|
exp2(vp, ignore)
|
||||||
register Char ***vp;
|
Char ***vp;
|
||||||
bool ignore;
|
bool ignore;
|
||||||
{
|
{
|
||||||
register int p1 = exp2a(vp, ignore);
|
int p1 = exp2a(vp, ignore);
|
||||||
|
|
||||||
#ifdef EDEBUG
|
#ifdef EDEBUG
|
||||||
etraci("exp3 p1", p1, vp);
|
etraci("exp3 p1", p1, vp);
|
||||||
#endif
|
#endif
|
||||||
if (**vp && eq(**vp, STRor)) {
|
if (**vp && eq(**vp, STRor)) {
|
||||||
register int p2;
|
int p2;
|
||||||
|
|
||||||
(*vp)++;
|
(*vp)++;
|
||||||
p2 = exp2(vp, ignore);
|
p2 = exp2(vp, ignore);
|
||||||
@@ -167,16 +170,16 @@ exp2(vp, ignore)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
exp2a(vp, ignore)
|
exp2a(vp, ignore)
|
||||||
register Char ***vp;
|
Char ***vp;
|
||||||
bool ignore;
|
bool ignore;
|
||||||
{
|
{
|
||||||
register int p1 = exp2b(vp, ignore);
|
int p1 = exp2b(vp, ignore);
|
||||||
|
|
||||||
#ifdef EDEBUG
|
#ifdef EDEBUG
|
||||||
etraci("exp2a p1", p1, vp);
|
etraci("exp2a p1", p1, vp);
|
||||||
#endif
|
#endif
|
||||||
if (**vp && eq(**vp, STRcaret)) {
|
if (**vp && eq(**vp, STRcaret)) {
|
||||||
register int p2;
|
int p2;
|
||||||
|
|
||||||
(*vp)++;
|
(*vp)++;
|
||||||
p2 = exp2a(vp, ignore);
|
p2 = exp2a(vp, ignore);
|
||||||
@@ -190,16 +193,16 @@ exp2a(vp, ignore)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
exp2b(vp, ignore)
|
exp2b(vp, ignore)
|
||||||
register Char ***vp;
|
Char ***vp;
|
||||||
bool ignore;
|
bool ignore;
|
||||||
{
|
{
|
||||||
register int p1 = exp2c(vp, ignore);
|
int p1 = exp2c(vp, ignore);
|
||||||
|
|
||||||
#ifdef EDEBUG
|
#ifdef EDEBUG
|
||||||
etraci("exp2b p1", p1, vp);
|
etraci("exp2b p1", p1, vp);
|
||||||
#endif
|
#endif
|
||||||
if (**vp && eq(**vp, STRand)) {
|
if (**vp && eq(**vp, STRand)) {
|
||||||
register int p2;
|
int p2;
|
||||||
|
|
||||||
(*vp)++;
|
(*vp)++;
|
||||||
p2 = exp2b(vp, ignore);
|
p2 = exp2b(vp, ignore);
|
||||||
@@ -213,12 +216,12 @@ exp2b(vp, ignore)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
exp2c(vp, ignore)
|
exp2c(vp, ignore)
|
||||||
register Char ***vp;
|
Char ***vp;
|
||||||
bool ignore;
|
bool ignore;
|
||||||
{
|
{
|
||||||
register Char *p1 = exp3(vp, ignore);
|
Char *p1 = exp3(vp, ignore);
|
||||||
register Char *p2;
|
Char *p2;
|
||||||
register int i;
|
int i;
|
||||||
|
|
||||||
#ifdef EDEBUG
|
#ifdef EDEBUG
|
||||||
etracc("exp2c p1", p1, vp);
|
etracc("exp2c p1", p1, vp);
|
||||||
@@ -261,11 +264,11 @@ exp2c(vp, ignore)
|
|||||||
|
|
||||||
static Char *
|
static Char *
|
||||||
exp3(vp, ignore)
|
exp3(vp, ignore)
|
||||||
register Char ***vp;
|
Char ***vp;
|
||||||
bool ignore;
|
bool ignore;
|
||||||
{
|
{
|
||||||
register Char *p1, *p2;
|
Char *p1, *p2;
|
||||||
register int i;
|
int i;
|
||||||
|
|
||||||
p1 = exp3a(vp, ignore);
|
p1 = exp3a(vp, ignore);
|
||||||
#ifdef EDEBUG
|
#ifdef EDEBUG
|
||||||
@@ -307,11 +310,11 @@ exp3(vp, ignore)
|
|||||||
|
|
||||||
static Char *
|
static Char *
|
||||||
exp3a(vp, ignore)
|
exp3a(vp, ignore)
|
||||||
register Char ***vp;
|
Char ***vp;
|
||||||
bool ignore;
|
bool ignore;
|
||||||
{
|
{
|
||||||
register Char *p1, *p2, *op;
|
Char *p1, *p2, *op;
|
||||||
register int i;
|
int i;
|
||||||
|
|
||||||
p1 = exp4(vp, ignore);
|
p1 = exp4(vp, ignore);
|
||||||
#ifdef EDEBUG
|
#ifdef EDEBUG
|
||||||
@@ -337,18 +340,18 @@ exp3a(vp, ignore)
|
|||||||
|
|
||||||
static Char *
|
static Char *
|
||||||
exp4(vp, ignore)
|
exp4(vp, ignore)
|
||||||
register Char ***vp;
|
Char ***vp;
|
||||||
bool ignore;
|
bool ignore;
|
||||||
{
|
{
|
||||||
register Char *p1, *p2;
|
Char *p1, *p2;
|
||||||
register int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
p1 = exp5(vp, ignore);
|
p1 = exp5(vp, ignore);
|
||||||
#ifdef EDEBUG
|
#ifdef EDEBUG
|
||||||
etracc("exp4 p1", p1, vp);
|
etracc("exp4 p1", p1, vp);
|
||||||
#endif
|
#endif
|
||||||
if (isa(**vp, ADDOP)) {
|
if (isa(**vp, ADDOP)) {
|
||||||
register Char *op = *(*vp)++;
|
Char *op = *(*vp)++;
|
||||||
|
|
||||||
p2 = exp4(vp, ignore);
|
p2 = exp4(vp, ignore);
|
||||||
#ifdef EDEBUG
|
#ifdef EDEBUG
|
||||||
@@ -374,18 +377,18 @@ exp4(vp, ignore)
|
|||||||
|
|
||||||
static Char *
|
static Char *
|
||||||
exp5(vp, ignore)
|
exp5(vp, ignore)
|
||||||
register Char ***vp;
|
Char ***vp;
|
||||||
bool ignore;
|
bool ignore;
|
||||||
{
|
{
|
||||||
register Char *p1, *p2;
|
Char *p1, *p2;
|
||||||
register int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
p1 = exp6(vp, ignore);
|
p1 = exp6(vp, ignore);
|
||||||
#ifdef EDEBUG
|
#ifdef EDEBUG
|
||||||
etracc("exp5 p1", p1, vp);
|
etracc("exp5 p1", p1, vp);
|
||||||
#endif
|
#endif
|
||||||
if (isa(**vp, MULOP)) {
|
if (isa(**vp, MULOP)) {
|
||||||
register Char *op = *(*vp)++;
|
Char *op = *(*vp)++;
|
||||||
|
|
||||||
p2 = exp5(vp, ignore);
|
p2 = exp5(vp, ignore);
|
||||||
#ifdef EDEBUG
|
#ifdef EDEBUG
|
||||||
@@ -421,11 +424,11 @@ exp5(vp, ignore)
|
|||||||
|
|
||||||
static Char *
|
static Char *
|
||||||
exp6(vp, ignore)
|
exp6(vp, ignore)
|
||||||
register Char ***vp;
|
Char ***vp;
|
||||||
bool ignore;
|
bool ignore;
|
||||||
{
|
{
|
||||||
int ccode, i = 0;
|
int ccode, i = 0;
|
||||||
register Char *cp, *dp, *ep;
|
Char *cp, *dp, *ep;
|
||||||
|
|
||||||
if (**vp == 0)
|
if (**vp == 0)
|
||||||
stderror(ERR_NAME | ERR_EXPRESSION);
|
stderror(ERR_NAME | ERR_EXPRESSION);
|
||||||
@@ -461,7 +464,7 @@ exp6(vp, ignore)
|
|||||||
return (putn(ccode));
|
return (putn(ccode));
|
||||||
}
|
}
|
||||||
if (eq(**vp, STRLbrace)) {
|
if (eq(**vp, STRLbrace)) {
|
||||||
register Char **v;
|
Char **v;
|
||||||
struct command faket;
|
struct command faket;
|
||||||
Char *fakecom[2];
|
Char *fakecom[2];
|
||||||
|
|
||||||
@@ -600,18 +603,18 @@ exp6(vp, ignore)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
evalav(v)
|
evalav(v)
|
||||||
register Char **v;
|
Char **v;
|
||||||
{
|
{
|
||||||
struct wordent paraml1;
|
struct wordent paraml1;
|
||||||
register struct wordent *hp = ¶ml1;
|
struct wordent *hp = ¶ml1;
|
||||||
struct command *t;
|
struct command *t;
|
||||||
register struct wordent *wdp = hp;
|
struct wordent *wdp = hp;
|
||||||
|
|
||||||
set(STRstatus, Strsave(STR0));
|
set(STRstatus, Strsave(STR0));
|
||||||
hp->prev = hp->next = hp;
|
hp->prev = hp->next = hp;
|
||||||
hp->word = STRNULL;
|
hp->word = STRNULL;
|
||||||
while (*v) {
|
while (*v) {
|
||||||
register struct wordent *new =
|
struct wordent *new =
|
||||||
(struct wordent *) xcalloc(1, sizeof *wdp);
|
(struct wordent *) xcalloc(1, sizeof *wdp);
|
||||||
|
|
||||||
new->prev = wdp;
|
new->prev = wdp;
|
||||||
@@ -631,8 +634,8 @@ evalav(v)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
isa(cp, what)
|
isa(cp, what)
|
||||||
register Char *cp;
|
Char *cp;
|
||||||
register int what;
|
int what;
|
||||||
{
|
{
|
||||||
if (cp == 0)
|
if (cp == 0)
|
||||||
return ((what & RESTOP) != 0);
|
return ((what & RESTOP) != 0);
|
||||||
@@ -680,7 +683,7 @@ isa(cp, what)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
egetn(cp)
|
egetn(cp)
|
||||||
register Char *cp;
|
Char *cp;
|
||||||
{
|
{
|
||||||
if (*cp && *cp != '-' && !Isdigit(*cp))
|
if (*cp && *cp != '-' && !Isdigit(*cp))
|
||||||
stderror(ERR_NAME | ERR_EXPRESSION);
|
stderror(ERR_NAME | ERR_EXPRESSION);
|
||||||
|
|||||||
+31
-28
@@ -29,12 +29,15 @@
|
|||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static char sccsid[] = "@(#)file.c 8.2 (Berkeley) 3/19/94";
|
static char sccsid[] = "@(#)file.c 8.2 (Berkeley) 3/19/94";
|
||||||
|
#else
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id: file.c,v 1.6 1997/02/22 14:01:54 peter Exp $";
|
||||||
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#ifdef FILEC
|
#ifdef FILEC
|
||||||
@@ -160,7 +163,7 @@ static void
|
|||||||
pushback(string)
|
pushback(string)
|
||||||
Char *string;
|
Char *string;
|
||||||
{
|
{
|
||||||
register Char *p;
|
Char *p;
|
||||||
struct termios tty, tty_normal;
|
struct termios tty, tty_normal;
|
||||||
int omask;
|
int omask;
|
||||||
char c;
|
char c;
|
||||||
@@ -184,8 +187,8 @@ pushback(string)
|
|||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
catn(des, src, count)
|
catn(des, src, count)
|
||||||
register Char *des, *src;
|
Char *des, *src;
|
||||||
register int count;
|
int count;
|
||||||
{
|
{
|
||||||
while (--count >= 0 && *des)
|
while (--count >= 0 && *des)
|
||||||
des++;
|
des++;
|
||||||
@@ -201,8 +204,8 @@ catn(des, src, count)
|
|||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
copyn(des, src, count)
|
copyn(des, src, count)
|
||||||
register Char *des, *src;
|
Char *des, *src;
|
||||||
register int count;
|
int count;
|
||||||
{
|
{
|
||||||
while (--count >= 0)
|
while (--count >= 0)
|
||||||
if ((*des++ = *src++) == 0)
|
if ((*des++ = *src++) == 0)
|
||||||
@@ -251,7 +254,7 @@ print_by_column(dir, items, count)
|
|||||||
Char *dir, *items[];
|
Char *dir, *items[];
|
||||||
int count;
|
int count;
|
||||||
{
|
{
|
||||||
register int i, rows, r, c, maxwidth = 0, columns;
|
int i, rows, r, c, maxwidth = 0, columns;
|
||||||
|
|
||||||
if (ioctl(SHOUT, TIOCGWINSZ, (ioctl_t) & win) < 0 || win.ws_col == 0)
|
if (ioctl(SHOUT, TIOCGWINSZ, (ioctl_t) & win) < 0 || win.ws_col == 0)
|
||||||
win.ws_col = 80;
|
win.ws_col = 80;
|
||||||
@@ -266,7 +269,7 @@ print_by_column(dir, items, count)
|
|||||||
for (c = 0; c < columns; c++) {
|
for (c = 0; c < columns; c++) {
|
||||||
i = c * rows + r;
|
i = c * rows + r;
|
||||||
if (i < count) {
|
if (i < count) {
|
||||||
register int w;
|
int w;
|
||||||
|
|
||||||
(void) fprintf(cshout, "%s", vis_str(items[i]));
|
(void) fprintf(cshout, "%s", vis_str(items[i]));
|
||||||
(void) fputc(dir ? filetype(dir, items[i]) : ' ', cshout);
|
(void) fputc(dir ? filetype(dir, items[i]) : ' ', cshout);
|
||||||
@@ -292,8 +295,8 @@ static Char *
|
|||||||
tilde(new, old)
|
tilde(new, old)
|
||||||
Char *new, *old;
|
Char *new, *old;
|
||||||
{
|
{
|
||||||
register Char *o, *p;
|
Char *o, *p;
|
||||||
register struct passwd *pw;
|
struct passwd *pw;
|
||||||
static Char person[40];
|
static Char person[40];
|
||||||
|
|
||||||
if (old[0] != '~')
|
if (old[0] != '~')
|
||||||
@@ -375,7 +378,7 @@ static void
|
|||||||
extract_dir_and_name(path, dir, name)
|
extract_dir_and_name(path, dir, name)
|
||||||
Char *path, *dir, *name;
|
Char *path, *dir, *name;
|
||||||
{
|
{
|
||||||
register Char *p;
|
Char *p;
|
||||||
|
|
||||||
p = Strrchr(path, '/');
|
p = Strrchr(path, '/');
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
@@ -393,8 +396,8 @@ getentry(dir_fd, looking_for_lognames)
|
|||||||
DIR *dir_fd;
|
DIR *dir_fd;
|
||||||
int looking_for_lognames;
|
int looking_for_lognames;
|
||||||
{
|
{
|
||||||
register struct passwd *pw;
|
struct passwd *pw;
|
||||||
register struct dirent *dirp;
|
struct dirent *dirp;
|
||||||
|
|
||||||
if (looking_for_lognames) {
|
if (looking_for_lognames) {
|
||||||
if ((pw = getpwent()) == NULL)
|
if ((pw = getpwent()) == NULL)
|
||||||
@@ -408,9 +411,9 @@ getentry(dir_fd, looking_for_lognames)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
free_items(items)
|
free_items(items)
|
||||||
register Char **items;
|
Char **items;
|
||||||
{
|
{
|
||||||
register int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; items[i]; i++)
|
for (i = 0; items[i]; i++)
|
||||||
xfree((ptr_t) items[i]);
|
xfree((ptr_t) items[i]);
|
||||||
@@ -436,9 +439,9 @@ tsearch(word, command, max_word_length)
|
|||||||
int max_word_length;
|
int max_word_length;
|
||||||
{
|
{
|
||||||
static Char **items = NULL;
|
static Char **items = NULL;
|
||||||
register DIR *dir_fd;
|
DIR *dir_fd;
|
||||||
register numitems = 0, ignoring = TRUE, nignored = 0;
|
int numitems = 0, ignoring = TRUE, nignored = 0;
|
||||||
register name_length, looking_for_lognames;
|
int name_length, looking_for_lognames;
|
||||||
Char tilded_dir[MAXPATHLEN + 1], dir[MAXPATHLEN + 1];
|
Char tilded_dir[MAXPATHLEN + 1], dir[MAXPATHLEN + 1];
|
||||||
Char name[MAXNAMLEN + 1], extended_name[MAXNAMLEN + 1];
|
Char name[MAXNAMLEN + 1], extended_name[MAXNAMLEN + 1];
|
||||||
Char *entry;
|
Char *entry;
|
||||||
@@ -547,8 +550,8 @@ recognize(extended_name, entry, name_length, numitems)
|
|||||||
if (numitems == 1) /* 1st match */
|
if (numitems == 1) /* 1st match */
|
||||||
copyn(extended_name, entry, MAXNAMLEN);
|
copyn(extended_name, entry, MAXNAMLEN);
|
||||||
else { /* 2nd & subsequent matches */
|
else { /* 2nd & subsequent matches */
|
||||||
register Char *x, *ent;
|
Char *x, *ent;
|
||||||
register int len = 0;
|
int len = 0;
|
||||||
|
|
||||||
x = extended_name;
|
x = extended_name;
|
||||||
for (ent = entry; *x && *x == *ent++; x++, len++)
|
for (ent = entry; *x && *x == *ent++; x++, len++)
|
||||||
@@ -567,7 +570,7 @@ recognize(extended_name, entry, name_length, numitems)
|
|||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
is_prefix(check, template)
|
is_prefix(check, template)
|
||||||
register Char *check, *template;
|
Char *check, *template;
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
if (*check == 0)
|
if (*check == 0)
|
||||||
@@ -584,7 +587,7 @@ static int
|
|||||||
is_suffix(check, template)
|
is_suffix(check, template)
|
||||||
Char *check, *template;
|
Char *check, *template;
|
||||||
{
|
{
|
||||||
register Char *c, *t;
|
Char *c, *t;
|
||||||
|
|
||||||
for (c = check; *c++;)
|
for (c = check; *c++;)
|
||||||
continue;
|
continue;
|
||||||
@@ -603,7 +606,7 @@ tenex(inputline, inputline_size)
|
|||||||
Char *inputline;
|
Char *inputline;
|
||||||
int inputline_size;
|
int inputline_size;
|
||||||
{
|
{
|
||||||
register int numitems, num_read;
|
int numitems, num_read;
|
||||||
char tinputline[BUFSIZ];
|
char tinputline[BUFSIZ];
|
||||||
|
|
||||||
|
|
||||||
@@ -613,8 +616,8 @@ tenex(inputline, inputline_size)
|
|||||||
int i;
|
int i;
|
||||||
static Char delims[] = {' ', '\'', '"', '\t', ';', '&', '<',
|
static Char delims[] = {' ', '\'', '"', '\t', ';', '&', '<',
|
||||||
'>', '(', ')', '|', '^', '%', '\0'};
|
'>', '(', ')', '|', '^', '%', '\0'};
|
||||||
register Char *str_end, *word_start, last_Char, should_retype;
|
Char *str_end, *word_start, last_Char, should_retype;
|
||||||
register int space_left;
|
int space_left;
|
||||||
COMMAND command;
|
COMMAND command;
|
||||||
|
|
||||||
for (i = 0; i < num_read; i++)
|
for (i = 0; i < num_read; i++)
|
||||||
@@ -671,10 +674,10 @@ tenex(inputline, inputline_size)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
ignored(entry)
|
ignored(entry)
|
||||||
register Char *entry;
|
Char *entry;
|
||||||
{
|
{
|
||||||
struct varent *vp;
|
struct varent *vp;
|
||||||
register Char **cp;
|
Char **cp;
|
||||||
|
|
||||||
if ((vp = adrof(STRfignore)) == NULL || (cp = vp->vec) == NULL)
|
if ((vp = adrof(STRfignore)) == NULL || (cp = vp->vec) == NULL)
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
|
|||||||
+54
-51
@@ -29,12 +29,15 @@
|
|||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static char sccsid[] = "@(#)func.c 8.1 (Berkeley) 5/31/93";
|
static char sccsid[] = "@(#)func.c 8.1 (Berkeley) 5/31/93";
|
||||||
|
#else
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id: func.c,v 1.7 1997/02/22 14:01:55 peter Exp $";
|
||||||
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@@ -72,8 +75,8 @@ struct biltins *
|
|||||||
isbfunc(t)
|
isbfunc(t)
|
||||||
struct command *t;
|
struct command *t;
|
||||||
{
|
{
|
||||||
register Char *cp = t->t_dcom[0];
|
Char *cp = t->t_dcom[0];
|
||||||
register struct biltins *bp, *bp1, *bp2;
|
struct biltins *bp, *bp1, *bp2;
|
||||||
static struct biltins label = {"", dozip, 0, 0};
|
static struct biltins label = {"", dozip, 0, 0};
|
||||||
static struct biltins foregnd = {"%job", dofg1, 0, 0};
|
static struct biltins foregnd = {"%job", dofg1, 0, 0};
|
||||||
static struct biltins backgnd = {"%job &", dobg1, 0, 0};
|
static struct biltins backgnd = {"%job &", dobg1, 0, 0};
|
||||||
@@ -96,7 +99,7 @@ isbfunc(t)
|
|||||||
* one past the end.
|
* one past the end.
|
||||||
*/
|
*/
|
||||||
for (bp1 = bfunc, bp2 = bfunc + nbfunc; bp1 < bp2;) {
|
for (bp1 = bfunc, bp2 = bfunc + nbfunc; bp1 < bp2;) {
|
||||||
register i;
|
int i;
|
||||||
|
|
||||||
bp = bp1 + ((bp2 - bp1) >> 1);
|
bp = bp1 + ((bp2 - bp1) >> 1);
|
||||||
if ((i = *cp - *bp->bname) == 0 &&
|
if ((i = *cp - *bp->bname) == 0 &&
|
||||||
@@ -112,8 +115,8 @@ isbfunc(t)
|
|||||||
|
|
||||||
void
|
void
|
||||||
func(t, bp)
|
func(t, bp)
|
||||||
register struct command *t;
|
struct command *t;
|
||||||
register struct biltins *bp;
|
struct biltins *bp;
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -133,8 +136,8 @@ doonintr(v, t)
|
|||||||
Char **v;
|
Char **v;
|
||||||
struct command *t;
|
struct command *t;
|
||||||
{
|
{
|
||||||
register Char *cp;
|
Char *cp;
|
||||||
register Char *vv = v[1];
|
Char *vv = v[1];
|
||||||
|
|
||||||
if (parintr == SIG_IGN)
|
if (parintr == SIG_IGN)
|
||||||
return;
|
return;
|
||||||
@@ -194,8 +197,8 @@ doalias(v, t)
|
|||||||
Char **v;
|
Char **v;
|
||||||
struct command *t;
|
struct command *t;
|
||||||
{
|
{
|
||||||
register struct varent *vp;
|
struct varent *vp;
|
||||||
register Char *p;
|
Char *p;
|
||||||
|
|
||||||
v++;
|
v++;
|
||||||
p = *v++;
|
p = *v++;
|
||||||
@@ -265,8 +268,8 @@ doif(v, kp)
|
|||||||
Char **v;
|
Char **v;
|
||||||
struct command *kp;
|
struct command *kp;
|
||||||
{
|
{
|
||||||
register int i;
|
int i;
|
||||||
register Char **vv;
|
Char **vv;
|
||||||
|
|
||||||
v++;
|
v++;
|
||||||
i = expr(&v);
|
i = expr(&v);
|
||||||
@@ -302,7 +305,7 @@ doif(v, kp)
|
|||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
reexecute(kp)
|
reexecute(kp)
|
||||||
register struct command *kp;
|
struct command *kp;
|
||||||
{
|
{
|
||||||
kp->t_dflg &= F_SAVE;
|
kp->t_dflg &= F_SAVE;
|
||||||
kp->t_dflg |= F_REPEAT;
|
kp->t_dflg |= F_REPEAT;
|
||||||
@@ -339,7 +342,7 @@ void
|
|||||||
gotolab(lab)
|
gotolab(lab)
|
||||||
Char *lab;
|
Char *lab;
|
||||||
{
|
{
|
||||||
register struct whyle *wp;
|
struct whyle *wp;
|
||||||
/*
|
/*
|
||||||
* While we still can, locate any unknown ends of existing loops. This
|
* While we still can, locate any unknown ends of existing loops. This
|
||||||
* obscure code is the WORST result of the fact that we don't really parse.
|
* obscure code is the WORST result of the fact that we don't really parse.
|
||||||
@@ -365,7 +368,7 @@ doswitch(v, t)
|
|||||||
Char **v;
|
Char **v;
|
||||||
struct command *t;
|
struct command *t;
|
||||||
{
|
{
|
||||||
register Char *cp, *lp;
|
Char *cp, *lp;
|
||||||
|
|
||||||
v++;
|
v++;
|
||||||
if (!*v || *(*v++) != '(')
|
if (!*v || *(*v++) != '(')
|
||||||
@@ -419,8 +422,8 @@ doforeach(v, t)
|
|||||||
Char **v;
|
Char **v;
|
||||||
struct command *t;
|
struct command *t;
|
||||||
{
|
{
|
||||||
register Char *cp, *sp;
|
Char *cp, *sp;
|
||||||
register struct whyle *nwp;
|
struct whyle *nwp;
|
||||||
|
|
||||||
v++;
|
v++;
|
||||||
sp = cp = strip(*v);
|
sp = cp = strip(*v);
|
||||||
@@ -463,8 +466,8 @@ dowhile(v, t)
|
|||||||
Char **v;
|
Char **v;
|
||||||
struct command *t;
|
struct command *t;
|
||||||
{
|
{
|
||||||
register int status;
|
int status;
|
||||||
register bool again = whyles != 0 && SEEKEQ(&whyles->w_start, &lineloc) &&
|
bool again = whyles != 0 && SEEKEQ(&whyles->w_start, &lineloc) &&
|
||||||
whyles->w_fename == 0;
|
whyles->w_fename == 0;
|
||||||
|
|
||||||
v++;
|
v++;
|
||||||
@@ -479,7 +482,7 @@ dowhile(v, t)
|
|||||||
if (*v)
|
if (*v)
|
||||||
stderror(ERR_NAME | ERR_EXPRESSION);
|
stderror(ERR_NAME | ERR_EXPRESSION);
|
||||||
if (!again) {
|
if (!again) {
|
||||||
register struct whyle *nwp =
|
struct whyle *nwp =
|
||||||
(struct whyle *) xcalloc(1, sizeof(*nwp));
|
(struct whyle *) xcalloc(1, sizeof(*nwp));
|
||||||
|
|
||||||
nwp->w_start = lineloc;
|
nwp->w_start = lineloc;
|
||||||
@@ -564,8 +567,8 @@ dorepeat(v, kp)
|
|||||||
Char **v;
|
Char **v;
|
||||||
struct command *kp;
|
struct command *kp;
|
||||||
{
|
{
|
||||||
register int i;
|
int i;
|
||||||
register sigset_t omask = 0;
|
sigset_t omask = 0;
|
||||||
|
|
||||||
i = getn(v[1]);
|
i = getn(v[1]);
|
||||||
if (setintr)
|
if (setintr)
|
||||||
@@ -593,10 +596,10 @@ doswbrk(v, t)
|
|||||||
|
|
||||||
int
|
int
|
||||||
srchx(cp)
|
srchx(cp)
|
||||||
register Char *cp;
|
Char *cp;
|
||||||
{
|
{
|
||||||
register struct srch *sp, *sp1, *sp2;
|
struct srch *sp, *sp1, *sp2;
|
||||||
register i;
|
int i;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Binary search Sp1 is the beginning of the current search range. Sp2 is
|
* Binary search Sp1 is the beginning of the current search range. Sp2 is
|
||||||
@@ -622,12 +625,12 @@ static Char *Sgoal;
|
|||||||
static void
|
static void
|
||||||
search(type, level, goal)
|
search(type, level, goal)
|
||||||
int type;
|
int type;
|
||||||
register int level;
|
int level;
|
||||||
Char *goal;
|
Char *goal;
|
||||||
{
|
{
|
||||||
Char wordbuf[BUFSIZ];
|
Char wordbuf[BUFSIZ];
|
||||||
register Char *aword = wordbuf;
|
Char *aword = wordbuf;
|
||||||
register Char *cp;
|
Char *cp;
|
||||||
|
|
||||||
Stype = type;
|
Stype = type;
|
||||||
Sgoal = goal;
|
Sgoal = goal;
|
||||||
@@ -722,10 +725,10 @@ search(type, level, goal)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
getword(wp)
|
getword(wp)
|
||||||
register Char *wp;
|
Char *wp;
|
||||||
{
|
{
|
||||||
register int found = 0;
|
int found = 0;
|
||||||
register int c, d;
|
int c, d;
|
||||||
int kwd = 0;
|
int kwd = 0;
|
||||||
Char *owp = wp;
|
Char *owp = wp;
|
||||||
|
|
||||||
@@ -851,7 +854,7 @@ wfree()
|
|||||||
btell(&o);
|
btell(&o);
|
||||||
|
|
||||||
for (; whyles; whyles = nwp) {
|
for (; whyles; whyles = nwp) {
|
||||||
register struct whyle *wp = whyles;
|
struct whyle *wp = whyles;
|
||||||
nwp = wp->w_next;
|
nwp = wp->w_next;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -901,9 +904,9 @@ doglob(v, t)
|
|||||||
static void
|
static void
|
||||||
xecho(sep, v)
|
xecho(sep, v)
|
||||||
int sep;
|
int sep;
|
||||||
register Char **v;
|
Char **v;
|
||||||
{
|
{
|
||||||
register Char *cp;
|
Char *cp;
|
||||||
int nonl = 0;
|
int nonl = 0;
|
||||||
|
|
||||||
if (setintr)
|
if (setintr)
|
||||||
@@ -924,7 +927,7 @@ xecho(sep, v)
|
|||||||
if (sep == ' ' && *v && eq(*v, STRmn))
|
if (sep == ' ' && *v && eq(*v, STRmn))
|
||||||
nonl++, v++;
|
nonl++, v++;
|
||||||
while ((cp = *v++) != NULL) {
|
while ((cp = *v++) != NULL) {
|
||||||
register int c;
|
int c;
|
||||||
|
|
||||||
while ((c = *cp++) != '\0')
|
while ((c = *cp++) != '\0')
|
||||||
(void) vis_fputc(c | QUOTE, cshout);
|
(void) vis_fputc(c | QUOTE, cshout);
|
||||||
@@ -952,7 +955,7 @@ dosetenv(v, t)
|
|||||||
|
|
||||||
v++;
|
v++;
|
||||||
if ((vp = *v++) == 0) {
|
if ((vp = *v++) == 0) {
|
||||||
register Char **ep;
|
Char **ep;
|
||||||
|
|
||||||
if (setintr)
|
if (setintr)
|
||||||
(void) sigsetmask(sigblock((sigset_t) 0) & ~sigmask(SIGINT));
|
(void) sigsetmask(sigblock((sigset_t) 0) & ~sigmask(SIGINT));
|
||||||
@@ -1045,8 +1048,8 @@ void
|
|||||||
Setenv(name, val)
|
Setenv(name, val)
|
||||||
Char *name, *val;
|
Char *name, *val;
|
||||||
{
|
{
|
||||||
register Char **ep = STR_environ;
|
Char **ep = STR_environ;
|
||||||
register Char *cp, *dp;
|
Char *cp, *dp;
|
||||||
Char *blk[2];
|
Char *blk[2];
|
||||||
Char **oep = ep;
|
Char **oep = ep;
|
||||||
|
|
||||||
@@ -1078,8 +1081,8 @@ static void
|
|||||||
Unsetenv(name)
|
Unsetenv(name)
|
||||||
Char *name;
|
Char *name;
|
||||||
{
|
{
|
||||||
register Char **ep = STR_environ;
|
Char **ep = STR_environ;
|
||||||
register Char *cp, *dp;
|
Char *cp, *dp;
|
||||||
Char **oep = ep;
|
Char **oep = ep;
|
||||||
|
|
||||||
for (; *ep; ep++) {
|
for (; *ep; ep++) {
|
||||||
@@ -1104,8 +1107,8 @@ doumask(v, t)
|
|||||||
Char **v;
|
Char **v;
|
||||||
struct command *t;
|
struct command *t;
|
||||||
{
|
{
|
||||||
register Char *cp = v[1];
|
Char *cp = v[1];
|
||||||
register int i;
|
int i;
|
||||||
|
|
||||||
if (cp == 0) {
|
if (cp == 0) {
|
||||||
i = umask(0);
|
i = umask(0);
|
||||||
@@ -1151,7 +1154,7 @@ static struct limits *
|
|||||||
findlim(cp)
|
findlim(cp)
|
||||||
Char *cp;
|
Char *cp;
|
||||||
{
|
{
|
||||||
register struct limits *lp, *res;
|
struct limits *lp, *res;
|
||||||
|
|
||||||
res = (struct limits *) NULL;
|
res = (struct limits *) NULL;
|
||||||
for (lp = limits; lp->limconst >= 0; lp++)
|
for (lp = limits; lp->limconst >= 0; lp++)
|
||||||
@@ -1173,8 +1176,8 @@ dolimit(v, t)
|
|||||||
Char **v;
|
Char **v;
|
||||||
struct command *t;
|
struct command *t;
|
||||||
{
|
{
|
||||||
register struct limits *lp;
|
struct limits *lp;
|
||||||
register RLIM_TYPE limit;
|
RLIM_TYPE limit;
|
||||||
char hard = 0;
|
char hard = 0;
|
||||||
|
|
||||||
v++;
|
v++;
|
||||||
@@ -1199,10 +1202,10 @@ dolimit(v, t)
|
|||||||
|
|
||||||
static RLIM_TYPE
|
static RLIM_TYPE
|
||||||
getval(lp, v)
|
getval(lp, v)
|
||||||
register struct limits *lp;
|
struct limits *lp;
|
||||||
Char **v;
|
Char **v;
|
||||||
{
|
{
|
||||||
register float f;
|
float f;
|
||||||
double atof();
|
double atof();
|
||||||
Char *cp = *v++;
|
Char *cp = *v++;
|
||||||
|
|
||||||
@@ -1283,7 +1286,7 @@ limtail(cp, str)
|
|||||||
/*ARGSUSED*/
|
/*ARGSUSED*/
|
||||||
static void
|
static void
|
||||||
plim(lp, hard)
|
plim(lp, hard)
|
||||||
register struct limits *lp;
|
struct limits *lp;
|
||||||
Char hard;
|
Char hard;
|
||||||
{
|
{
|
||||||
struct rlimit rlim;
|
struct rlimit rlim;
|
||||||
@@ -1310,7 +1313,7 @@ dounlimit(v, t)
|
|||||||
Char **v;
|
Char **v;
|
||||||
struct command *t;
|
struct command *t;
|
||||||
{
|
{
|
||||||
register struct limits *lp;
|
struct limits *lp;
|
||||||
int lerr = 0;
|
int lerr = 0;
|
||||||
Char hard = 0;
|
Char hard = 0;
|
||||||
|
|
||||||
@@ -1336,7 +1339,7 @@ dounlimit(v, t)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
setlim(lp, hard, limit)
|
setlim(lp, hard, limit)
|
||||||
register struct limits *lp;
|
struct limits *lp;
|
||||||
Char hard;
|
Char hard;
|
||||||
RLIM_TYPE limit;
|
RLIM_TYPE limit;
|
||||||
{
|
{
|
||||||
|
|||||||
+18
-15
@@ -29,12 +29,15 @@
|
|||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static char sccsid[] = "@(#)glob.c 8.1 (Berkeley) 5/31/93";
|
static char sccsid[] = "@(#)glob.c 8.1 (Berkeley) 5/31/93";
|
||||||
|
#else
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id: glob.c,v 1.8 1997/02/22 14:01:58 peter Exp $";
|
||||||
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
@@ -553,10 +556,10 @@ ginit()
|
|||||||
|
|
||||||
void
|
void
|
||||||
rscan(t, f)
|
rscan(t, f)
|
||||||
register Char **t;
|
Char **t;
|
||||||
void (*f) ();
|
void (*f) ();
|
||||||
{
|
{
|
||||||
register Char *p;
|
Char *p;
|
||||||
|
|
||||||
while ((p = *t++) != NULL)
|
while ((p = *t++) != NULL)
|
||||||
while (*p)
|
while (*p)
|
||||||
@@ -565,9 +568,9 @@ rscan(t, f)
|
|||||||
|
|
||||||
void
|
void
|
||||||
trim(t)
|
trim(t)
|
||||||
register Char **t;
|
Char **t;
|
||||||
{
|
{
|
||||||
register Char *p;
|
Char *p;
|
||||||
|
|
||||||
while ((p = *t++) != NULL)
|
while ((p = *t++) != NULL)
|
||||||
while (*p)
|
while (*p)
|
||||||
@@ -576,9 +579,9 @@ trim(t)
|
|||||||
|
|
||||||
void
|
void
|
||||||
tglob(t)
|
tglob(t)
|
||||||
register Char **t;
|
Char **t;
|
||||||
{
|
{
|
||||||
register Char *p, c;
|
Char *p, c;
|
||||||
|
|
||||||
while ((p = *t++) != NULL) {
|
while ((p = *t++) != NULL) {
|
||||||
if (*p == '~' || *p == '=')
|
if (*p == '~' || *p == '=')
|
||||||
@@ -622,7 +625,7 @@ dobackp(cp, literal)
|
|||||||
Char *cp;
|
Char *cp;
|
||||||
bool literal;
|
bool literal;
|
||||||
{
|
{
|
||||||
register Char *lp, *rp;
|
Char *lp, *rp;
|
||||||
Char *ep, word[MAXPATHLEN];
|
Char *ep, word[MAXPATHLEN];
|
||||||
|
|
||||||
if (pargv) {
|
if (pargv) {
|
||||||
@@ -667,8 +670,8 @@ backeval(cp, literal)
|
|||||||
Char *cp;
|
Char *cp;
|
||||||
bool literal;
|
bool literal;
|
||||||
{
|
{
|
||||||
register int icnt, c;
|
int icnt, c;
|
||||||
register Char *ip;
|
Char *ip;
|
||||||
struct command faket;
|
struct command faket;
|
||||||
bool hadnl;
|
bool hadnl;
|
||||||
int pvec[2], quoted;
|
int pvec[2], quoted;
|
||||||
@@ -851,9 +854,9 @@ Gmatch(string, pattern)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
pmatch(string, pattern)
|
pmatch(string, pattern)
|
||||||
register Char *string, *pattern;
|
Char *string, *pattern;
|
||||||
{
|
{
|
||||||
register Char stringc, patternc;
|
Char stringc, patternc;
|
||||||
int match, negate_range;
|
int match, negate_range;
|
||||||
Char rangec;
|
Char rangec;
|
||||||
|
|
||||||
@@ -910,7 +913,7 @@ void
|
|||||||
Gcat(s1, s2)
|
Gcat(s1, s2)
|
||||||
Char *s1, *s2;
|
Char *s1, *s2;
|
||||||
{
|
{
|
||||||
register Char *p, *q;
|
Char *p, *q;
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
for (p = s1; *p++;)
|
for (p = s1; *p++;)
|
||||||
@@ -934,7 +937,7 @@ Gcat(s1, s2)
|
|||||||
#ifdef FILEC
|
#ifdef FILEC
|
||||||
int
|
int
|
||||||
sortscmp(a, b)
|
sortscmp(a, b)
|
||||||
register const ptr_t a, b;
|
const ptr_t a, b;
|
||||||
{
|
{
|
||||||
#if defined(NLS) && !defined(NOSTRCOLL)
|
#if defined(NLS) && !defined(NOSTRCOLL)
|
||||||
char buf[2048];
|
char buf[2048];
|
||||||
|
|||||||
+12
-9
@@ -29,12 +29,15 @@
|
|||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static char sccsid[] = "@(#)hist.c 8.1 (Berkeley) 5/31/93";
|
static char sccsid[] = "@(#)hist.c 8.1 (Berkeley) 5/31/93";
|
||||||
|
#else
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id: hist.c,v 1.4 1997/02/22 14:01:59 peter Exp $";
|
||||||
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@@ -56,8 +59,8 @@ void
|
|||||||
savehist(sp)
|
savehist(sp)
|
||||||
struct wordent *sp;
|
struct wordent *sp;
|
||||||
{
|
{
|
||||||
register struct Hist *hp, *np;
|
struct Hist *hp, *np;
|
||||||
register int histlen = 0;
|
int histlen = 0;
|
||||||
Char *cp;
|
Char *cp;
|
||||||
|
|
||||||
/* throw away null lines */
|
/* throw away null lines */
|
||||||
@@ -65,7 +68,7 @@ savehist(sp)
|
|||||||
return;
|
return;
|
||||||
cp = value(STRhistory);
|
cp = value(STRhistory);
|
||||||
if (*cp) {
|
if (*cp) {
|
||||||
register Char *p = cp;
|
Char *p = cp;
|
||||||
|
|
||||||
while (*p) {
|
while (*p) {
|
||||||
if (!Isdigit(*p)) {
|
if (!Isdigit(*p)) {
|
||||||
@@ -86,10 +89,10 @@ savehist(sp)
|
|||||||
struct Hist *
|
struct Hist *
|
||||||
enthist(event, lp, docopy)
|
enthist(event, lp, docopy)
|
||||||
int event;
|
int event;
|
||||||
register struct wordent *lp;
|
struct wordent *lp;
|
||||||
bool docopy;
|
bool docopy;
|
||||||
{
|
{
|
||||||
register struct Hist *np;
|
struct Hist *np;
|
||||||
|
|
||||||
np = (struct Hist *) xmalloc((size_t) sizeof(*np));
|
np = (struct Hist *) xmalloc((size_t) sizeof(*np));
|
||||||
np->Hnum = np->Href = event;
|
np->Hnum = np->Href = event;
|
||||||
@@ -109,7 +112,7 @@ enthist(event, lp, docopy)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
hfree(hp)
|
hfree(hp)
|
||||||
register struct Hist *hp;
|
struct Hist *hp;
|
||||||
{
|
{
|
||||||
|
|
||||||
freelex(&hp->Hlex);
|
freelex(&hp->Hlex);
|
||||||
@@ -177,7 +180,7 @@ dohist1(hp, np, rflg, hflg)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
phist(hp, hflg)
|
phist(hp, hflg)
|
||||||
register struct Hist *hp;
|
struct Hist *hp;
|
||||||
int hflg;
|
int hflg;
|
||||||
{
|
{
|
||||||
if (hflg == 0)
|
if (hflg == 0)
|
||||||
|
|||||||
+5
-3
@@ -29,13 +29,15 @@
|
|||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
/*###9 [cc] warning: `sccsid' defined but not used%%%*/
|
#if 0
|
||||||
static char sccsid[] = "@(#)init.c 8.1 (Berkeley) 5/31/93";
|
static char sccsid[] = "@(#)init.c 8.1 (Berkeley) 5/31/93";
|
||||||
|
#else
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id: init.c,v 1.4 1997/02/22 14:02:00 peter Exp $";
|
||||||
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#if __STDC__
|
#if __STDC__
|
||||||
|
|||||||
+51
-48
@@ -29,12 +29,15 @@
|
|||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static char sccsid[] = "@(#)lex.c 8.1 (Berkeley) 5/31/93";
|
static char sccsid[] = "@(#)lex.c 8.1 (Berkeley) 5/31/93";
|
||||||
|
#else
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id: lex.c,v 1.6 1997/02/22 14:02:01 peter Exp $";
|
||||||
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@@ -142,9 +145,9 @@ static Char getCtmp;
|
|||||||
|
|
||||||
int
|
int
|
||||||
lex(hp)
|
lex(hp)
|
||||||
register struct wordent *hp;
|
struct wordent *hp;
|
||||||
{
|
{
|
||||||
register struct wordent *wdp;
|
struct wordent *wdp;
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
btell(&lineloc);
|
btell(&lineloc);
|
||||||
@@ -165,7 +168,7 @@ lex(hp)
|
|||||||
* be ready and rarin to go even if it is interrupted.
|
* be ready and rarin to go even if it is interrupted.
|
||||||
*/
|
*/
|
||||||
do {
|
do {
|
||||||
register struct wordent *new;
|
struct wordent *new;
|
||||||
|
|
||||||
new = (struct wordent *) xmalloc((size_t) sizeof(*wdp));
|
new = (struct wordent *) xmalloc((size_t) sizeof(*wdp));
|
||||||
new->word = 0;
|
new->word = 0;
|
||||||
@@ -184,7 +187,7 @@ prlex(fp, sp0)
|
|||||||
FILE *fp;
|
FILE *fp;
|
||||||
struct wordent *sp0;
|
struct wordent *sp0;
|
||||||
{
|
{
|
||||||
register struct wordent *sp = sp0->next;
|
struct wordent *sp = sp0->next;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
(void) fprintf(fp, "%s", vis_str(sp->word));
|
(void) fprintf(fp, "%s", vis_str(sp->word));
|
||||||
@@ -198,15 +201,15 @@ prlex(fp, sp0)
|
|||||||
|
|
||||||
void
|
void
|
||||||
copylex(hp, fp)
|
copylex(hp, fp)
|
||||||
register struct wordent *hp;
|
struct wordent *hp;
|
||||||
register struct wordent *fp;
|
struct wordent *fp;
|
||||||
{
|
{
|
||||||
register struct wordent *wdp;
|
struct wordent *wdp;
|
||||||
|
|
||||||
wdp = hp;
|
wdp = hp;
|
||||||
fp = fp->next;
|
fp = fp->next;
|
||||||
do {
|
do {
|
||||||
register struct wordent *new;
|
struct wordent *new;
|
||||||
|
|
||||||
new = (struct wordent *) xmalloc((size_t) sizeof(*wdp));
|
new = (struct wordent *) xmalloc((size_t) sizeof(*wdp));
|
||||||
new->prev = wdp;
|
new->prev = wdp;
|
||||||
@@ -221,9 +224,9 @@ copylex(hp, fp)
|
|||||||
|
|
||||||
void
|
void
|
||||||
freelex(vp)
|
freelex(vp)
|
||||||
register struct wordent *vp;
|
struct wordent *vp;
|
||||||
{
|
{
|
||||||
register struct wordent *fp;
|
struct wordent *fp;
|
||||||
|
|
||||||
while (vp->next != vp) {
|
while (vp->next != vp) {
|
||||||
fp = vp->next;
|
fp = vp->next;
|
||||||
@@ -237,11 +240,11 @@ freelex(vp)
|
|||||||
static Char *
|
static Char *
|
||||||
word()
|
word()
|
||||||
{
|
{
|
||||||
register Char c, c1;
|
Char c, c1;
|
||||||
register Char *wp;
|
Char *wp;
|
||||||
Char wbuf[BUFSIZ];
|
Char wbuf[BUFSIZ];
|
||||||
register bool dolflg;
|
bool dolflg;
|
||||||
register int i;
|
int i;
|
||||||
|
|
||||||
wp = wbuf;
|
wp = wbuf;
|
||||||
i = BUFSIZ - 4;
|
i = BUFSIZ - 4;
|
||||||
@@ -358,9 +361,9 @@ word()
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
getC1(flag)
|
getC1(flag)
|
||||||
register int flag;
|
int flag;
|
||||||
{
|
{
|
||||||
register Char c;
|
Char c;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
if ((c = peekc) != '\0') {
|
if ((c = peekc) != '\0') {
|
||||||
@@ -416,9 +419,9 @@ getC1(flag)
|
|||||||
static void
|
static void
|
||||||
getdol()
|
getdol()
|
||||||
{
|
{
|
||||||
register Char *np, *ep;
|
Char *np, *ep;
|
||||||
Char name[4 * MAXVARLEN + 1];
|
Char name[4 * MAXVARLEN + 1];
|
||||||
register int c;
|
int c;
|
||||||
int sc;
|
int sc;
|
||||||
bool special = 0, toolong;
|
bool special = 0, toolong;
|
||||||
|
|
||||||
@@ -650,9 +653,9 @@ static void
|
|||||||
getexcl(sc)
|
getexcl(sc)
|
||||||
int sc;
|
int sc;
|
||||||
{
|
{
|
||||||
register struct wordent *hp, *ip;
|
struct wordent *hp, *ip;
|
||||||
int left, right, dol;
|
int left, right, dol;
|
||||||
register int c;
|
int c;
|
||||||
|
|
||||||
if (sc == 0) {
|
if (sc == 0) {
|
||||||
sc = getC(0);
|
sc = getC(0);
|
||||||
@@ -727,9 +730,9 @@ static struct wordent *
|
|||||||
getsub(en)
|
getsub(en)
|
||||||
struct wordent *en;
|
struct wordent *en;
|
||||||
{
|
{
|
||||||
register Char *cp;
|
Char *cp;
|
||||||
int delim;
|
int delim;
|
||||||
register int c;
|
int c;
|
||||||
int sc;
|
int sc;
|
||||||
bool global;
|
bool global;
|
||||||
Char orhsb[sizeof(rhsb) / sizeof(Char)];
|
Char orhsb[sizeof(rhsb) / sizeof(Char)];
|
||||||
@@ -872,12 +875,12 @@ dosub(sc, en, global)
|
|||||||
struct wordent lexi;
|
struct wordent lexi;
|
||||||
bool didsub = 0, didone = 0;
|
bool didsub = 0, didone = 0;
|
||||||
struct wordent *hp = &lexi;
|
struct wordent *hp = &lexi;
|
||||||
register struct wordent *wdp;
|
struct wordent *wdp;
|
||||||
register int i = exclc;
|
int i = exclc;
|
||||||
|
|
||||||
wdp = hp;
|
wdp = hp;
|
||||||
while (--i >= 0) {
|
while (--i >= 0) {
|
||||||
register struct wordent *new =
|
struct wordent *new =
|
||||||
(struct wordent *) xcalloc(1, sizeof *wdp);
|
(struct wordent *) xcalloc(1, sizeof *wdp);
|
||||||
|
|
||||||
new->word = 0;
|
new->word = 0;
|
||||||
@@ -924,8 +927,8 @@ subword(cp, type, adid)
|
|||||||
bool *adid;
|
bool *adid;
|
||||||
{
|
{
|
||||||
Char wbuf[BUFSIZ];
|
Char wbuf[BUFSIZ];
|
||||||
register Char *wp, *mp, *np;
|
Char *wp, *mp, *np;
|
||||||
register int i;
|
int i;
|
||||||
|
|
||||||
*adid = 0;
|
*adid = 0;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
@@ -996,8 +999,8 @@ domod(cp, type)
|
|||||||
Char *cp;
|
Char *cp;
|
||||||
int type;
|
int type;
|
||||||
{
|
{
|
||||||
register Char *wp, *xp;
|
Char *wp, *xp;
|
||||||
register int c;
|
int c;
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
|
||||||
@@ -1042,7 +1045,7 @@ domod(cp, type)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
matchs(str, pat)
|
matchs(str, pat)
|
||||||
register Char *str, *pat;
|
Char *str, *pat;
|
||||||
{
|
{
|
||||||
while (*str && *pat && *str == *pat)
|
while (*str && *pat && *str == *pat)
|
||||||
str++, pat++;
|
str++, pat++;
|
||||||
@@ -1051,11 +1054,11 @@ matchs(str, pat)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
getsel(al, ar, dol)
|
getsel(al, ar, dol)
|
||||||
register int *al, *ar;
|
int *al, *ar;
|
||||||
int dol;
|
int dol;
|
||||||
{
|
{
|
||||||
register int c = getC(0);
|
int c = getC(0);
|
||||||
register int i;
|
int i;
|
||||||
bool first = *al < 0;
|
bool first = *al < 0;
|
||||||
|
|
||||||
switch (c) {
|
switch (c) {
|
||||||
@@ -1139,9 +1142,9 @@ static struct wordent *
|
|||||||
gethent(sc)
|
gethent(sc)
|
||||||
int sc;
|
int sc;
|
||||||
{
|
{
|
||||||
register struct Hist *hp;
|
struct Hist *hp;
|
||||||
register Char *np;
|
Char *np;
|
||||||
register int c;
|
int c;
|
||||||
int event;
|
int event;
|
||||||
bool back = 0;
|
bool back = 0;
|
||||||
|
|
||||||
@@ -1258,12 +1261,12 @@ findev(cp, anyarg)
|
|||||||
Char *cp;
|
Char *cp;
|
||||||
bool anyarg;
|
bool anyarg;
|
||||||
{
|
{
|
||||||
register struct Hist *hp;
|
struct Hist *hp;
|
||||||
|
|
||||||
for (hp = Histlist.Hnext; hp; hp = hp->Hnext) {
|
for (hp = Histlist.Hnext; hp; hp = hp->Hnext) {
|
||||||
Char *dp;
|
Char *dp;
|
||||||
register Char *p, *q;
|
Char *p, *q;
|
||||||
register struct wordent *lp = hp->Hlex.next;
|
struct wordent *lp = hp->Hlex.next;
|
||||||
int argno = 0;
|
int argno = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1307,7 +1310,7 @@ findev(cp, anyarg)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
setexclp(cp)
|
setexclp(cp)
|
||||||
register Char *cp;
|
Char *cp;
|
||||||
{
|
{
|
||||||
if (cp && cp[0] == '\n')
|
if (cp && cp[0] == '\n')
|
||||||
return;
|
return;
|
||||||
@@ -1325,7 +1328,7 @@ int
|
|||||||
readc(wanteof)
|
readc(wanteof)
|
||||||
bool wanteof;
|
bool wanteof;
|
||||||
{
|
{
|
||||||
register int c;
|
int c;
|
||||||
static sincereal;
|
static sincereal;
|
||||||
|
|
||||||
aret = F_SEEK;
|
aret = F_SEEK;
|
||||||
@@ -1440,10 +1443,10 @@ readc(wanteof)
|
|||||||
static int
|
static int
|
||||||
bgetc()
|
bgetc()
|
||||||
{
|
{
|
||||||
register int buf, off, c;
|
int buf, off, c;
|
||||||
|
|
||||||
#ifdef FILEC
|
#ifdef FILEC
|
||||||
register int numleft = 0, roomleft;
|
int numleft = 0, roomleft;
|
||||||
Char ttyline[BUFSIZ];
|
Char ttyline[BUFSIZ];
|
||||||
#endif
|
#endif
|
||||||
char tbuf[BUFSIZ + 1];
|
char tbuf[BUFSIZ + 1];
|
||||||
@@ -1474,7 +1477,7 @@ bgetc()
|
|||||||
again:
|
again:
|
||||||
buf = (int) fseekp / BUFSIZ;
|
buf = (int) fseekp / BUFSIZ;
|
||||||
if (buf >= fblocks) {
|
if (buf >= fblocks) {
|
||||||
register Char **nfbuf =
|
Char **nfbuf =
|
||||||
(Char **) xcalloc((size_t) (fblocks + 2),
|
(Char **) xcalloc((size_t) (fblocks + 2),
|
||||||
sizeof(Char **));
|
sizeof(Char **));
|
||||||
|
|
||||||
@@ -1505,7 +1508,7 @@ bgetc()
|
|||||||
goto again;
|
goto again;
|
||||||
}
|
}
|
||||||
if (c > 0)
|
if (c > 0)
|
||||||
bcopy(ttyline, fbuf[buf] + off, c * sizeof(Char));
|
memcpy(fbuf[buf] + off, ttyline, c * sizeof(Char));
|
||||||
numleft = 0;
|
numleft = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -1549,7 +1552,7 @@ bgetc()
|
|||||||
static void
|
static void
|
||||||
bfree()
|
bfree()
|
||||||
{
|
{
|
||||||
register int sb, i;
|
int sb, i;
|
||||||
|
|
||||||
if (cantell)
|
if (cantell)
|
||||||
return;
|
return;
|
||||||
|
|||||||
+37
-34
@@ -29,12 +29,15 @@
|
|||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static char sccsid[] = "@(#)misc.c 8.1 (Berkeley) 5/31/93";
|
static char sccsid[] = "@(#)misc.c 8.1 (Berkeley) 5/31/93";
|
||||||
|
#else
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id: misc.c,v 1.5 1997/02/22 14:02:02 peter Exp $";
|
||||||
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
@@ -53,8 +56,8 @@ static int renum __P((int, int));
|
|||||||
|
|
||||||
int
|
int
|
||||||
any(s, c)
|
any(s, c)
|
||||||
register char *s;
|
char *s;
|
||||||
register int c;
|
int c;
|
||||||
{
|
{
|
||||||
if (!s)
|
if (!s)
|
||||||
return (0); /* Check for nil pointer */
|
return (0); /* Check for nil pointer */
|
||||||
@@ -77,10 +80,10 @@ setzero(cp, i)
|
|||||||
|
|
||||||
char *
|
char *
|
||||||
strsave(s)
|
strsave(s)
|
||||||
register char *s;
|
char *s;
|
||||||
{
|
{
|
||||||
char *n;
|
char *n;
|
||||||
register char *p;
|
char *p;
|
||||||
|
|
||||||
if (s == NULL)
|
if (s == NULL)
|
||||||
s = "";
|
s = "";
|
||||||
@@ -94,7 +97,7 @@ strsave(s)
|
|||||||
|
|
||||||
Char **
|
Char **
|
||||||
blkend(up)
|
blkend(up)
|
||||||
register Char **up;
|
Char **up;
|
||||||
{
|
{
|
||||||
|
|
||||||
while (*up)
|
while (*up)
|
||||||
@@ -106,7 +109,7 @@ blkend(up)
|
|||||||
void
|
void
|
||||||
blkpr(fp, av)
|
blkpr(fp, av)
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
register Char **av;
|
Char **av;
|
||||||
{
|
{
|
||||||
|
|
||||||
for (; *av; av++) {
|
for (; *av; av++) {
|
||||||
@@ -118,9 +121,9 @@ blkpr(fp, av)
|
|||||||
|
|
||||||
int
|
int
|
||||||
blklen(av)
|
blklen(av)
|
||||||
register Char **av;
|
Char **av;
|
||||||
{
|
{
|
||||||
register int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
while (*av++)
|
while (*av++)
|
||||||
i++;
|
i++;
|
||||||
@@ -130,9 +133,9 @@ blklen(av)
|
|||||||
Char **
|
Char **
|
||||||
blkcpy(oav, bv)
|
blkcpy(oav, bv)
|
||||||
Char **oav;
|
Char **oav;
|
||||||
register Char **bv;
|
Char **bv;
|
||||||
{
|
{
|
||||||
register Char **av = oav;
|
Char **av = oav;
|
||||||
|
|
||||||
while ((*av++ = *bv++) != NULL)
|
while ((*av++ = *bv++) != NULL)
|
||||||
continue;
|
continue;
|
||||||
@@ -152,7 +155,7 @@ void
|
|||||||
blkfree(av0)
|
blkfree(av0)
|
||||||
Char **av0;
|
Char **av0;
|
||||||
{
|
{
|
||||||
register Char **av = av0;
|
Char **av = av0;
|
||||||
|
|
||||||
if (!av0)
|
if (!av0)
|
||||||
return;
|
return;
|
||||||
@@ -163,9 +166,9 @@ blkfree(av0)
|
|||||||
|
|
||||||
Char **
|
Char **
|
||||||
saveblk(v)
|
saveblk(v)
|
||||||
register Char **v;
|
Char **v;
|
||||||
{
|
{
|
||||||
register Char **newv =
|
Char **newv =
|
||||||
(Char **) xcalloc((size_t) (blklen(v) + 1), sizeof(Char **));
|
(Char **) xcalloc((size_t) (blklen(v) + 1), sizeof(Char **));
|
||||||
Char **onewv = newv;
|
Char **onewv = newv;
|
||||||
|
|
||||||
@@ -177,11 +180,11 @@ saveblk(v)
|
|||||||
#ifdef NOTUSED
|
#ifdef NOTUSED
|
||||||
char *
|
char *
|
||||||
strstr(s, t)
|
strstr(s, t)
|
||||||
register char *s, *t;
|
char *s, *t;
|
||||||
{
|
{
|
||||||
do {
|
do {
|
||||||
register char *ss = s;
|
char *ss = s;
|
||||||
register char *tt = t;
|
char *tt = t;
|
||||||
|
|
||||||
do
|
do
|
||||||
if (*tt == '\0')
|
if (*tt == '\0')
|
||||||
@@ -199,7 +202,7 @@ strspl(cp, dp)
|
|||||||
char *cp, *dp;
|
char *cp, *dp;
|
||||||
{
|
{
|
||||||
char *ep;
|
char *ep;
|
||||||
register char *p, *q;
|
char *p, *q;
|
||||||
|
|
||||||
if (!cp)
|
if (!cp)
|
||||||
cp = "";
|
cp = "";
|
||||||
@@ -221,9 +224,9 @@ strspl(cp, dp)
|
|||||||
|
|
||||||
Char **
|
Char **
|
||||||
blkspl(up, vp)
|
blkspl(up, vp)
|
||||||
register Char **up, **vp;
|
Char **up, **vp;
|
||||||
{
|
{
|
||||||
register Char **wp =
|
Char **wp =
|
||||||
(Char **) xcalloc((size_t) (blklen(up) + blklen(vp) + 1),
|
(Char **) xcalloc((size_t) (blklen(up) + blklen(vp) + 1),
|
||||||
sizeof(Char **));
|
sizeof(Char **));
|
||||||
|
|
||||||
@@ -233,7 +236,7 @@ blkspl(up, vp)
|
|||||||
|
|
||||||
Char
|
Char
|
||||||
lastchr(cp)
|
lastchr(cp)
|
||||||
register Char *cp;
|
Char *cp;
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!cp)
|
if (!cp)
|
||||||
@@ -252,7 +255,7 @@ lastchr(cp)
|
|||||||
void
|
void
|
||||||
closem()
|
closem()
|
||||||
{
|
{
|
||||||
register int f, flimit;
|
int f, flimit;
|
||||||
|
|
||||||
for (f = 0, flimit = getdtablesize(); f < flimit; f++)
|
for (f = 0, flimit = getdtablesize(); f < flimit; f++)
|
||||||
if (f != SHIN && f != SHOUT && f != SHERR && f != OLDSTD &&
|
if (f != SHIN && f != SHOUT && f != SHERR && f != OLDSTD &&
|
||||||
@@ -277,7 +280,7 @@ donefds()
|
|||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
dmove(i, j)
|
dmove(i, j)
|
||||||
register int i, j;
|
int i, j;
|
||||||
{
|
{
|
||||||
|
|
||||||
if (i == j || i < 0)
|
if (i == j || i < 0)
|
||||||
@@ -296,7 +299,7 @@ dmove(i, j)
|
|||||||
|
|
||||||
int
|
int
|
||||||
dcopy(i, j)
|
dcopy(i, j)
|
||||||
register int i, j;
|
int i, j;
|
||||||
{
|
{
|
||||||
|
|
||||||
if (i == j || i < 0 || (j < 0 && i > 2))
|
if (i == j || i < 0 || (j < 0 && i > 2))
|
||||||
@@ -311,9 +314,9 @@ dcopy(i, j)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
renum(i, j)
|
renum(i, j)
|
||||||
register int i, j;
|
int i, j;
|
||||||
{
|
{
|
||||||
register int k = dup(i);
|
int k = dup(i);
|
||||||
|
|
||||||
if (k < 0)
|
if (k < 0)
|
||||||
return (-1);
|
return (-1);
|
||||||
@@ -334,10 +337,10 @@ renum(i, j)
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
lshift(v, c)
|
lshift(v, c)
|
||||||
register Char **v;
|
Char **v;
|
||||||
register int c;
|
int c;
|
||||||
{
|
{
|
||||||
register Char **u;
|
Char **u;
|
||||||
|
|
||||||
for (u = v; *u && --c >= 0; u++)
|
for (u = v; *u && --c >= 0; u++)
|
||||||
xfree((ptr_t) *u);
|
xfree((ptr_t) *u);
|
||||||
@@ -363,7 +366,7 @@ number(cp)
|
|||||||
|
|
||||||
Char **
|
Char **
|
||||||
copyblk(v)
|
copyblk(v)
|
||||||
register Char **v;
|
Char **v;
|
||||||
{
|
{
|
||||||
Char **nv = (Char **) xcalloc((size_t) (blklen(v) + 1), sizeof(Char **));
|
Char **nv = (Char **) xcalloc((size_t) (blklen(v) + 1), sizeof(Char **));
|
||||||
|
|
||||||
@@ -373,7 +376,7 @@ copyblk(v)
|
|||||||
#ifndef SHORT_STRINGS
|
#ifndef SHORT_STRINGS
|
||||||
char *
|
char *
|
||||||
strend(cp)
|
strend(cp)
|
||||||
register char *cp;
|
char *cp;
|
||||||
{
|
{
|
||||||
if (!cp)
|
if (!cp)
|
||||||
return (cp);
|
return (cp);
|
||||||
@@ -388,7 +391,7 @@ Char *
|
|||||||
strip(cp)
|
strip(cp)
|
||||||
Char *cp;
|
Char *cp;
|
||||||
{
|
{
|
||||||
register Char *dp = cp;
|
Char *dp = cp;
|
||||||
|
|
||||||
if (!cp)
|
if (!cp)
|
||||||
return (cp);
|
return (cp);
|
||||||
@@ -408,7 +411,7 @@ udvar(name)
|
|||||||
|
|
||||||
int
|
int
|
||||||
prefix(sub, str)
|
prefix(sub, str)
|
||||||
register Char *sub, *str;
|
Char *sub, *str;
|
||||||
{
|
{
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
|||||||
+34
-31
@@ -29,12 +29,15 @@
|
|||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static char sccsid[] = "@(#)parse.c 8.1 (Berkeley) 5/31/93";
|
static char sccsid[] = "@(#)parse.c 8.1 (Berkeley) 5/31/93";
|
||||||
|
#else
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id: parse.c,v 1.5 1997/02/22 14:02:03 peter Exp $";
|
||||||
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@@ -79,7 +82,7 @@ static int aleft;
|
|||||||
extern int hleft;
|
extern int hleft;
|
||||||
void
|
void
|
||||||
alias(lex)
|
alias(lex)
|
||||||
register struct wordent *lex;
|
struct wordent *lex;
|
||||||
{
|
{
|
||||||
jmp_buf osetexit;
|
jmp_buf osetexit;
|
||||||
|
|
||||||
@@ -99,7 +102,7 @@ alias(lex)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
asyntax(p1, p2)
|
asyntax(p1, p2)
|
||||||
register struct wordent *p1, *p2;
|
struct wordent *p1, *p2;
|
||||||
{
|
{
|
||||||
while (p1 != p2)
|
while (p1 != p2)
|
||||||
if (any(";&\n", p1->word[0]))
|
if (any(";&\n", p1->word[0]))
|
||||||
@@ -113,10 +116,10 @@ asyntax(p1, p2)
|
|||||||
static void
|
static void
|
||||||
asyn0(p1, p2)
|
asyn0(p1, p2)
|
||||||
struct wordent *p1;
|
struct wordent *p1;
|
||||||
register struct wordent *p2;
|
struct wordent *p2;
|
||||||
{
|
{
|
||||||
register struct wordent *p;
|
struct wordent *p;
|
||||||
register int l = 0;
|
int l = 0;
|
||||||
|
|
||||||
for (p = p1; p != p2; p = p->next)
|
for (p = p1; p != p2; p = p->next)
|
||||||
switch (p->word[0]) {
|
switch (p->word[0]) {
|
||||||
@@ -153,11 +156,11 @@ asyn0(p1, p2)
|
|||||||
static void
|
static void
|
||||||
asyn3(p1, p2)
|
asyn3(p1, p2)
|
||||||
struct wordent *p1;
|
struct wordent *p1;
|
||||||
register struct wordent *p2;
|
struct wordent *p2;
|
||||||
{
|
{
|
||||||
register struct varent *ap;
|
struct varent *ap;
|
||||||
struct wordent alout;
|
struct wordent alout;
|
||||||
register bool redid;
|
bool redid;
|
||||||
|
|
||||||
if (p1 == p2)
|
if (p1 == p2)
|
||||||
return;
|
return;
|
||||||
@@ -203,9 +206,9 @@ asyn3(p1, p2)
|
|||||||
|
|
||||||
static struct wordent *
|
static struct wordent *
|
||||||
freenod(p1, p2)
|
freenod(p1, p2)
|
||||||
register struct wordent *p1, *p2;
|
struct wordent *p1, *p2;
|
||||||
{
|
{
|
||||||
register struct wordent *retp = p1->prev;
|
struct wordent *retp = p1->prev;
|
||||||
|
|
||||||
while (p1 != p2) {
|
while (p1 != p2) {
|
||||||
xfree((ptr_t) p1->word);
|
xfree((ptr_t) p1->word);
|
||||||
@@ -229,7 +232,7 @@ freenod(p1, p2)
|
|||||||
*/
|
*/
|
||||||
struct command *
|
struct command *
|
||||||
syntax(p1, p2, flags)
|
syntax(p1, p2, flags)
|
||||||
register struct wordent *p1, *p2;
|
struct wordent *p1, *p2;
|
||||||
int flags;
|
int flags;
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -251,8 +254,8 @@ syn0(p1, p2, flags)
|
|||||||
struct wordent *p1, *p2;
|
struct wordent *p1, *p2;
|
||||||
int flags;
|
int flags;
|
||||||
{
|
{
|
||||||
register struct wordent *p;
|
struct wordent *p;
|
||||||
register struct command *t, *t1;
|
struct command *t, *t1;
|
||||||
int l;
|
int l;
|
||||||
|
|
||||||
l = 0;
|
l = 0;
|
||||||
@@ -319,8 +322,8 @@ syn1(p1, p2, flags)
|
|||||||
struct wordent *p1, *p2;
|
struct wordent *p1, *p2;
|
||||||
int flags;
|
int flags;
|
||||||
{
|
{
|
||||||
register struct wordent *p;
|
struct wordent *p;
|
||||||
register struct command *t;
|
struct command *t;
|
||||||
int l;
|
int l;
|
||||||
|
|
||||||
l = 0;
|
l = 0;
|
||||||
@@ -360,9 +363,9 @@ syn1a(p1, p2, flags)
|
|||||||
struct wordent *p1, *p2;
|
struct wordent *p1, *p2;
|
||||||
int flags;
|
int flags;
|
||||||
{
|
{
|
||||||
register struct wordent *p;
|
struct wordent *p;
|
||||||
register struct command *t;
|
struct command *t;
|
||||||
register int l = 0;
|
int l = 0;
|
||||||
|
|
||||||
for (p = p1; p != p2; p = p->next)
|
for (p = p1; p != p2; p = p->next)
|
||||||
switch (p->word[0]) {
|
switch (p->word[0]) {
|
||||||
@@ -401,9 +404,9 @@ syn1b(p1, p2, flags)
|
|||||||
struct wordent *p1, *p2;
|
struct wordent *p1, *p2;
|
||||||
int flags;
|
int flags;
|
||||||
{
|
{
|
||||||
register struct wordent *p;
|
struct wordent *p;
|
||||||
register struct command *t;
|
struct command *t;
|
||||||
register int l = 0;
|
int l = 0;
|
||||||
|
|
||||||
for (p = p1; p != p2; p = p->next)
|
for (p = p1; p != p2; p = p->next)
|
||||||
switch (p->word[0]) {
|
switch (p->word[0]) {
|
||||||
@@ -441,9 +444,9 @@ syn2(p1, p2, flags)
|
|||||||
struct wordent *p1, *p2;
|
struct wordent *p1, *p2;
|
||||||
int flags;
|
int flags;
|
||||||
{
|
{
|
||||||
register struct wordent *p, *pn;
|
struct wordent *p, *pn;
|
||||||
register struct command *t;
|
struct command *t;
|
||||||
register int l = 0;
|
int l = 0;
|
||||||
int f;
|
int f;
|
||||||
|
|
||||||
for (p = p1; p != p2; p = p->next)
|
for (p = p1; p != p2; p = p->next)
|
||||||
@@ -492,10 +495,10 @@ syn3(p1, p2, flags)
|
|||||||
struct wordent *p1, *p2;
|
struct wordent *p1, *p2;
|
||||||
int flags;
|
int flags;
|
||||||
{
|
{
|
||||||
register struct wordent *p;
|
struct wordent *p;
|
||||||
struct wordent *lp, *rp;
|
struct wordent *lp, *rp;
|
||||||
register struct command *t;
|
struct command *t;
|
||||||
register int l;
|
int l;
|
||||||
Char **av;
|
Char **av;
|
||||||
int n, c;
|
int n, c;
|
||||||
bool specp = 0;
|
bool specp = 0;
|
||||||
@@ -668,9 +671,9 @@ syn3(p1, p2, flags)
|
|||||||
|
|
||||||
void
|
void
|
||||||
freesyn(t)
|
freesyn(t)
|
||||||
register struct command *t;
|
struct command *t;
|
||||||
{
|
{
|
||||||
register Char **v;
|
Char **v;
|
||||||
|
|
||||||
if (t == 0)
|
if (t == 0)
|
||||||
return;
|
return;
|
||||||
|
|||||||
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
/*
|
/*-
|
||||||
* Copyright (c) 1988, 1993
|
* Copyright (c) 1988, 1993
|
||||||
* The Regents of the University of California. All rights reserved.
|
* The Regents of the University of California. All rights reserved.
|
||||||
*
|
*
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* @(#)pathnames.h 8.1 (Berkeley) 5/31/93
|
* @(#)pathnames.h 8.1 (Berkeley) 5/31/93
|
||||||
* $Id$
|
* $Id: pathnames.h,v 1.4 1997/02/22 14:02:05 peter Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define _PATH_BIN "/bin"
|
#define _PATH_BIN "/bin"
|
||||||
|
|||||||
+48
-45
@@ -29,12 +29,15 @@
|
|||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static char sccsid[] = "@(#)proc.c 8.1 (Berkeley) 5/31/93";
|
static char sccsid[] = "@(#)proc.c 8.1 (Berkeley) 5/31/93";
|
||||||
|
#else
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id: proc.c,v 1.4 1997/02/22 14:02:06 peter Exp $";
|
||||||
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@@ -82,9 +85,9 @@ void
|
|||||||
pchild(notused)
|
pchild(notused)
|
||||||
int notused;
|
int notused;
|
||||||
{
|
{
|
||||||
register struct process *pp;
|
struct process *pp;
|
||||||
register struct process *fp;
|
struct process *fp;
|
||||||
register int pid;
|
int pid;
|
||||||
extern int insource;
|
extern int insource;
|
||||||
union wait w;
|
union wait w;
|
||||||
int jobflags;
|
int jobflags;
|
||||||
@@ -201,7 +204,7 @@ pchild(notused)
|
|||||||
void
|
void
|
||||||
pnote()
|
pnote()
|
||||||
{
|
{
|
||||||
register struct process *pp;
|
struct process *pp;
|
||||||
int flags;
|
int flags;
|
||||||
sigset_t omask;
|
sigset_t omask;
|
||||||
|
|
||||||
@@ -225,7 +228,7 @@ pnote()
|
|||||||
void
|
void
|
||||||
pwait()
|
pwait()
|
||||||
{
|
{
|
||||||
register struct process *fp, *pp;
|
struct process *fp, *pp;
|
||||||
sigset_t omask;
|
sigset_t omask;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -253,9 +256,9 @@ pwait()
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pjwait(pp)
|
pjwait(pp)
|
||||||
register struct process *pp;
|
struct process *pp;
|
||||||
{
|
{
|
||||||
register struct process *fp;
|
struct process *fp;
|
||||||
int jobflags, reason;
|
int jobflags, reason;
|
||||||
sigset_t omask;
|
sigset_t omask;
|
||||||
|
|
||||||
@@ -345,7 +348,7 @@ dowait(v, t)
|
|||||||
Char **v;
|
Char **v;
|
||||||
struct command *t;
|
struct command *t;
|
||||||
{
|
{
|
||||||
register struct process *pp;
|
struct process *pp;
|
||||||
sigset_t omask;
|
sigset_t omask;
|
||||||
|
|
||||||
pjobs++;
|
pjobs++;
|
||||||
@@ -367,7 +370,7 @@ dowait(v, t)
|
|||||||
static void
|
static void
|
||||||
pflushall()
|
pflushall()
|
||||||
{
|
{
|
||||||
register struct process *pp;
|
struct process *pp;
|
||||||
|
|
||||||
for (pp = proclist.p_next; pp != NULL; pp = pp->p_next)
|
for (pp = proclist.p_next; pp != NULL; pp = pp->p_next)
|
||||||
if (pp->p_pid)
|
if (pp->p_pid)
|
||||||
@@ -381,10 +384,10 @@ pflushall()
|
|||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
pflush(pp)
|
pflush(pp)
|
||||||
register struct process *pp;
|
struct process *pp;
|
||||||
{
|
{
|
||||||
register struct process *np;
|
struct process *np;
|
||||||
register int idx;
|
int idx;
|
||||||
|
|
||||||
if (pp->p_pid == 0) {
|
if (pp->p_pid == 0) {
|
||||||
(void) fprintf(csherr, "BUG: process flushed twice");
|
(void) fprintf(csherr, "BUG: process flushed twice");
|
||||||
@@ -415,7 +418,7 @@ pflush(pp)
|
|||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
pclrcurr(pp)
|
pclrcurr(pp)
|
||||||
register struct process *pp;
|
struct process *pp;
|
||||||
{
|
{
|
||||||
|
|
||||||
if (pp == pcurrent)
|
if (pp == pcurrent)
|
||||||
@@ -443,9 +446,9 @@ static Char *cmdp;
|
|||||||
void
|
void
|
||||||
palloc(pid, t)
|
palloc(pid, t)
|
||||||
int pid;
|
int pid;
|
||||||
register struct command *t;
|
struct command *t;
|
||||||
{
|
{
|
||||||
register struct process *pp;
|
struct process *pp;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
pp = (struct process *) xcalloc(1, (size_t) sizeof(struct process));
|
pp = (struct process *) xcalloc(1, (size_t) sizeof(struct process));
|
||||||
@@ -509,7 +512,7 @@ palloc(pid, t)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
padd(t)
|
padd(t)
|
||||||
register struct command *t;
|
struct command *t;
|
||||||
{
|
{
|
||||||
Char **argp;
|
Char **argp;
|
||||||
|
|
||||||
@@ -570,7 +573,7 @@ static void
|
|||||||
pads(cp)
|
pads(cp)
|
||||||
Char *cp;
|
Char *cp;
|
||||||
{
|
{
|
||||||
register int i;
|
int i;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Avoid the Quoted Space alias hack! Reported by:
|
* Avoid the Quoted Space alias hack! Reported by:
|
||||||
@@ -626,7 +629,7 @@ prestjob()
|
|||||||
void
|
void
|
||||||
pendjob()
|
pendjob()
|
||||||
{
|
{
|
||||||
register struct process *pp, *tp;
|
struct process *pp, *tp;
|
||||||
|
|
||||||
if (pcurrjob && (pcurrjob->p_flags & (PFOREGND | PSTOPPED)) == 0) {
|
if (pcurrjob && (pcurrjob->p_flags & (PFOREGND | PSTOPPED)) == 0) {
|
||||||
pp = pcurrjob;
|
pp = pcurrjob;
|
||||||
@@ -648,10 +651,10 @@ pendjob()
|
|||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
pprint(pp, flag)
|
pprint(pp, flag)
|
||||||
register struct process *pp;
|
struct process *pp;
|
||||||
bool flag;
|
bool flag;
|
||||||
{
|
{
|
||||||
register status, reason;
|
int status, reason;
|
||||||
struct process *tp;
|
struct process *tp;
|
||||||
int jobflags, pstatus;
|
int jobflags, pstatus;
|
||||||
bool hadnl = 1; /* did we just have a newline */
|
bool hadnl = 1; /* did we just have a newline */
|
||||||
@@ -814,13 +817,13 @@ pprint(pp, flag)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
ptprint(tp)
|
ptprint(tp)
|
||||||
register struct process *tp;
|
struct process *tp;
|
||||||
{
|
{
|
||||||
struct timeval tetime, diff;
|
struct timeval tetime, diff;
|
||||||
static struct timeval ztime;
|
static struct timeval ztime;
|
||||||
struct rusage ru;
|
struct rusage ru;
|
||||||
static struct rusage zru;
|
static struct rusage zru;
|
||||||
register struct process *pp = tp;
|
struct process *pp = tp;
|
||||||
|
|
||||||
ru = zru;
|
ru = zru;
|
||||||
tetime = ztime;
|
tetime = ztime;
|
||||||
@@ -842,8 +845,8 @@ dojobs(v, t)
|
|||||||
Char **v;
|
Char **v;
|
||||||
struct command *t;
|
struct command *t;
|
||||||
{
|
{
|
||||||
register struct process *pp;
|
struct process *pp;
|
||||||
register int flag = NUMBER | NAME | REASON;
|
int flag = NUMBER | NAME | REASON;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (chkstop)
|
if (chkstop)
|
||||||
@@ -872,7 +875,7 @@ dofg(v, t)
|
|||||||
Char **v;
|
Char **v;
|
||||||
struct command *t;
|
struct command *t;
|
||||||
{
|
{
|
||||||
register struct process *pp;
|
struct process *pp;
|
||||||
|
|
||||||
okpcntl();
|
okpcntl();
|
||||||
++v;
|
++v;
|
||||||
@@ -892,7 +895,7 @@ dofg1(v, t)
|
|||||||
Char **v;
|
Char **v;
|
||||||
struct command *t;
|
struct command *t;
|
||||||
{
|
{
|
||||||
register struct process *pp;
|
struct process *pp;
|
||||||
|
|
||||||
okpcntl();
|
okpcntl();
|
||||||
pp = pfind(v[0]);
|
pp = pfind(v[0]);
|
||||||
@@ -909,7 +912,7 @@ dobg(v, t)
|
|||||||
Char **v;
|
Char **v;
|
||||||
struct command *t;
|
struct command *t;
|
||||||
{
|
{
|
||||||
register struct process *pp;
|
struct process *pp;
|
||||||
|
|
||||||
okpcntl();
|
okpcntl();
|
||||||
++v;
|
++v;
|
||||||
@@ -928,7 +931,7 @@ dobg1(v, t)
|
|||||||
Char **v;
|
Char **v;
|
||||||
struct command *t;
|
struct command *t;
|
||||||
{
|
{
|
||||||
register struct process *pp;
|
struct process *pp;
|
||||||
|
|
||||||
pp = pfind(v[0]);
|
pp = pfind(v[0]);
|
||||||
pstart(pp, 0);
|
pstart(pp, 0);
|
||||||
@@ -955,8 +958,8 @@ dokill(v, t)
|
|||||||
Char **v;
|
Char **v;
|
||||||
struct command *t;
|
struct command *t;
|
||||||
{
|
{
|
||||||
register int signum = SIGTERM;
|
int signum = SIGTERM;
|
||||||
register char *name;
|
char *name;
|
||||||
|
|
||||||
v++;
|
v++;
|
||||||
if (v[0] && v[0][0] == '-') {
|
if (v[0] && v[0][0] == '-') {
|
||||||
@@ -998,8 +1001,8 @@ pkill(v, signum)
|
|||||||
Char **v;
|
Char **v;
|
||||||
int signum;
|
int signum;
|
||||||
{
|
{
|
||||||
register struct process *pp, *np;
|
struct process *pp, *np;
|
||||||
register int jobflags = 0;
|
int jobflags = 0;
|
||||||
int pid, err1 = 0;
|
int pid, err1 = 0;
|
||||||
sigset_t omask;
|
sigset_t omask;
|
||||||
Char *cp;
|
Char *cp;
|
||||||
@@ -1081,10 +1084,10 @@ pkill(v, signum)
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pstart(pp, foregnd)
|
pstart(pp, foregnd)
|
||||||
register struct process *pp;
|
struct process *pp;
|
||||||
int foregnd;
|
int foregnd;
|
||||||
{
|
{
|
||||||
register struct process *np;
|
struct process *np;
|
||||||
sigset_t omask;
|
sigset_t omask;
|
||||||
long jobflags = 0;
|
long jobflags = 0;
|
||||||
|
|
||||||
@@ -1115,7 +1118,7 @@ void
|
|||||||
panystop(neednl)
|
panystop(neednl)
|
||||||
bool neednl;
|
bool neednl;
|
||||||
{
|
{
|
||||||
register struct process *pp;
|
struct process *pp;
|
||||||
|
|
||||||
chkstop = 2;
|
chkstop = 2;
|
||||||
for (pp = proclist.p_next; pp; pp = pp->p_next)
|
for (pp = proclist.p_next; pp; pp = pp->p_next)
|
||||||
@@ -1127,7 +1130,7 @@ struct process *
|
|||||||
pfind(cp)
|
pfind(cp)
|
||||||
Char *cp;
|
Char *cp;
|
||||||
{
|
{
|
||||||
register struct process *pp, *np;
|
struct process *pp, *np;
|
||||||
|
|
||||||
if (cp == 0 || cp[1] == 0 || eq(cp, STRcent2) || eq(cp, STRcentplus)) {
|
if (cp == 0 || cp[1] == 0 || eq(cp, STRcent2) || eq(cp, STRcentplus)) {
|
||||||
if (pcurrent == NULL)
|
if (pcurrent == NULL)
|
||||||
@@ -1151,7 +1154,7 @@ pfind(cp)
|
|||||||
for (pp = proclist.p_next; pp; pp = pp->p_next)
|
for (pp = proclist.p_next; pp; pp = pp->p_next)
|
||||||
if (pp->p_pid == pp->p_jobid) {
|
if (pp->p_pid == pp->p_jobid) {
|
||||||
if (cp[1] == '?') {
|
if (cp[1] == '?') {
|
||||||
register Char *dp;
|
Char *dp;
|
||||||
|
|
||||||
for (dp = pp->p_command; *dp; dp++) {
|
for (dp = pp->p_command; *dp; dp++) {
|
||||||
if (*dp != cp[2])
|
if (*dp != cp[2])
|
||||||
@@ -1169,7 +1172,7 @@ pfind(cp)
|
|||||||
}
|
}
|
||||||
if (np)
|
if (np)
|
||||||
return (np);
|
return (np);
|
||||||
stderror(ERR_NAME | cp[1] == '?' ? ERR_JOBPAT : ERR_NOSUCHJOB);
|
stderror((ERR_NAME | cp[1]) == '?' ? ERR_JOBPAT : ERR_NOSUCHJOB);
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
@@ -1180,10 +1183,10 @@ pfind(cp)
|
|||||||
*/
|
*/
|
||||||
static struct process *
|
static struct process *
|
||||||
pgetcurr(pp)
|
pgetcurr(pp)
|
||||||
register struct process *pp;
|
struct process *pp;
|
||||||
{
|
{
|
||||||
register struct process *np;
|
struct process *np;
|
||||||
register struct process *xp = NULL;
|
struct process *xp = NULL;
|
||||||
|
|
||||||
for (np = proclist.p_next; np; np = np->p_next)
|
for (np = proclist.p_next; np; np = np->p_next)
|
||||||
if (np != pcurrent && np != pp && np->p_pid &&
|
if (np != pcurrent && np != pp && np->p_pid &&
|
||||||
@@ -1205,7 +1208,7 @@ donotify(v, t)
|
|||||||
Char **v;
|
Char **v;
|
||||||
struct command *t;
|
struct command *t;
|
||||||
{
|
{
|
||||||
register struct process *pp;
|
struct process *pp;
|
||||||
|
|
||||||
pp = pfind(*++v);
|
pp = pfind(*++v);
|
||||||
pp->p_flags |= PNOTIFY;
|
pp->p_flags |= PNOTIFY;
|
||||||
@@ -1228,7 +1231,7 @@ pfork(t, wanttty)
|
|||||||
struct command *t; /* command we are forking for */
|
struct command *t; /* command we are forking for */
|
||||||
int wanttty;
|
int wanttty;
|
||||||
{
|
{
|
||||||
register int pid;
|
int pid;
|
||||||
bool ignint = 0;
|
bool ignint = 0;
|
||||||
int pgrp;
|
int pgrp;
|
||||||
sigset_t omask;
|
sigset_t omask;
|
||||||
|
|||||||
+14
-11
@@ -29,12 +29,15 @@
|
|||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static char sccsid[] = "@(#)sem.c 8.1 (Berkeley) 5/31/93";
|
static char sccsid[] = "@(#)sem.c 8.1 (Berkeley) 5/31/93";
|
||||||
|
#else
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id: sem.c,v 1.5 1997/02/22 14:02:07 peter Exp $";
|
||||||
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
@@ -62,7 +65,7 @@ static void chkclob __P((char *));
|
|||||||
|
|
||||||
void
|
void
|
||||||
execute(t, wanttty, pipein, pipeout)
|
execute(t, wanttty, pipein, pipeout)
|
||||||
register struct command *t;
|
struct command *t;
|
||||||
int wanttty, *pipein, *pipeout;
|
int wanttty, *pipein, *pipeout;
|
||||||
{
|
{
|
||||||
bool forked = 0;
|
bool forked = 0;
|
||||||
@@ -451,7 +454,7 @@ static void
|
|||||||
vffree(i)
|
vffree(i)
|
||||||
int i;
|
int i;
|
||||||
{
|
{
|
||||||
register Char **v;
|
Char **v;
|
||||||
|
|
||||||
if ((v = gargv) != NULL) {
|
if ((v = gargv) != NULL) {
|
||||||
gargv = 0;
|
gargv = 0;
|
||||||
@@ -481,7 +484,7 @@ int i;
|
|||||||
*/
|
*/
|
||||||
static Char *
|
static Char *
|
||||||
splicepipe(t, cp)
|
splicepipe(t, cp)
|
||||||
register struct command *t;
|
struct command *t;
|
||||||
Char *cp; /* word after < or > */
|
Char *cp; /* word after < or > */
|
||||||
{
|
{
|
||||||
Char *blk[2];
|
Char *blk[2];
|
||||||
@@ -524,12 +527,12 @@ splicepipe(t, cp)
|
|||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
doio(t, pipein, pipeout)
|
doio(t, pipein, pipeout)
|
||||||
register struct command *t;
|
struct command *t;
|
||||||
int *pipein, *pipeout;
|
int *pipein, *pipeout;
|
||||||
{
|
{
|
||||||
register int fd;
|
int fd;
|
||||||
register Char *cp;
|
Char *cp;
|
||||||
register int flags = t->t_dflg;
|
int flags = t->t_dflg;
|
||||||
|
|
||||||
if (didfds || (flags & F_REPEAT))
|
if (didfds || (flags & F_REPEAT))
|
||||||
return;
|
return;
|
||||||
@@ -620,7 +623,7 @@ doio(t, pipein, pipeout)
|
|||||||
|
|
||||||
void
|
void
|
||||||
mypipe(pv)
|
mypipe(pv)
|
||||||
register int *pv;
|
int *pv;
|
||||||
{
|
{
|
||||||
|
|
||||||
if (pipe(pv) < 0)
|
if (pipe(pv) < 0)
|
||||||
@@ -635,7 +638,7 @@ mypipe(pv)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
chkclob(cp)
|
chkclob(cp)
|
||||||
register char *cp;
|
char *cp;
|
||||||
{
|
{
|
||||||
struct stat stb;
|
struct stat stb;
|
||||||
|
|
||||||
|
|||||||
+51
-47
@@ -29,12 +29,15 @@
|
|||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static char sccsid[] = "@(#)set.c 8.1 (Berkeley) 5/31/93";
|
static char sccsid[] = "@(#)set.c 8.1 (Berkeley) 5/31/93";
|
||||||
|
#else
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id: set.c,v 1.6 1997/02/22 14:02:08 peter Exp $";
|
||||||
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@@ -47,6 +50,7 @@ static char sccsid[] = "@(#)set.c 8.1 (Berkeley) 5/31/93";
|
|||||||
#else
|
#else
|
||||||
# include <varargs.h>
|
# include <varargs.h>
|
||||||
#endif
|
#endif
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "csh.h"
|
#include "csh.h"
|
||||||
#include "extern.h"
|
#include "extern.h"
|
||||||
@@ -75,7 +79,7 @@ doset(v, t)
|
|||||||
Char **v;
|
Char **v;
|
||||||
struct command *t;
|
struct command *t;
|
||||||
{
|
{
|
||||||
register Char *p;
|
Char *p;
|
||||||
Char *vp, op;
|
Char *vp, op;
|
||||||
Char **vecp;
|
Char **vecp;
|
||||||
bool hadsub;
|
bool hadsub;
|
||||||
@@ -116,7 +120,7 @@ doset(v, t)
|
|||||||
if (op && op != '=')
|
if (op && op != '=')
|
||||||
stderror(ERR_NAME | ERR_SYNTAX);
|
stderror(ERR_NAME | ERR_SYNTAX);
|
||||||
if (eq(p, STRLparen)) {
|
if (eq(p, STRLparen)) {
|
||||||
register Char **e = v;
|
Char **e = v;
|
||||||
|
|
||||||
if (hadsub)
|
if (hadsub)
|
||||||
stderror(ERR_NAME | ERR_SYNTAX);
|
stderror(ERR_NAME | ERR_SYNTAX);
|
||||||
@@ -143,7 +147,7 @@ doset(v, t)
|
|||||||
dohash(NULL, NULL);
|
dohash(NULL, NULL);
|
||||||
}
|
}
|
||||||
else if (eq(vp, STRhistchars)) {
|
else if (eq(vp, STRhistchars)) {
|
||||||
register Char *pn = value(STRhistchars);
|
Char *pn = value(STRhistchars);
|
||||||
|
|
||||||
HIST = *pn++;
|
HIST = *pn++;
|
||||||
HISTSUB = *pn;
|
HISTSUB = *pn;
|
||||||
@@ -158,7 +162,7 @@ doset(v, t)
|
|||||||
else if (eq(vp, STRterm))
|
else if (eq(vp, STRterm))
|
||||||
Setenv(STRTERM, value(vp));
|
Setenv(STRTERM, value(vp));
|
||||||
else if (eq(vp, STRhome)) {
|
else if (eq(vp, STRhome)) {
|
||||||
register Char *cp;
|
Char *cp;
|
||||||
|
|
||||||
cp = Strsave(value(vp)); /* get the old value back */
|
cp = Strsave(value(vp)); /* get the old value back */
|
||||||
|
|
||||||
@@ -184,8 +188,8 @@ doset(v, t)
|
|||||||
|
|
||||||
static Char *
|
static Char *
|
||||||
getinx(cp, ip)
|
getinx(cp, ip)
|
||||||
register Char *cp;
|
Char *cp;
|
||||||
register int *ip;
|
int *ip;
|
||||||
{
|
{
|
||||||
|
|
||||||
*ip = 0;
|
*ip = 0;
|
||||||
@@ -203,7 +207,7 @@ asx(vp, subscr, p)
|
|||||||
int subscr;
|
int subscr;
|
||||||
Char *p;
|
Char *p;
|
||||||
{
|
{
|
||||||
register struct varent *v = getvx(vp, subscr);
|
struct varent *v = getvx(vp, subscr);
|
||||||
|
|
||||||
xfree((ptr_t) v->vec[subscr - 1]);
|
xfree((ptr_t) v->vec[subscr - 1]);
|
||||||
v->vec[subscr - 1] = globone(p, G_APPEND);
|
v->vec[subscr - 1] = globone(p, G_APPEND);
|
||||||
@@ -214,7 +218,7 @@ getvx(vp, subscr)
|
|||||||
Char *vp;
|
Char *vp;
|
||||||
int subscr;
|
int subscr;
|
||||||
{
|
{
|
||||||
register struct varent *v = adrof(vp);
|
struct varent *v = adrof(vp);
|
||||||
|
|
||||||
if (v == 0)
|
if (v == 0)
|
||||||
udvar(vp);
|
udvar(vp);
|
||||||
@@ -229,7 +233,7 @@ dolet(v, t)
|
|||||||
Char **v;
|
Char **v;
|
||||||
struct command *t;
|
struct command *t;
|
||||||
{
|
{
|
||||||
register Char *p;
|
Char *p;
|
||||||
Char *vp, c, op;
|
Char *vp, c, op;
|
||||||
bool hadsub;
|
bool hadsub;
|
||||||
int subscr;
|
int subscr;
|
||||||
@@ -314,7 +318,7 @@ static Char *
|
|||||||
xset(cp, vp)
|
xset(cp, vp)
|
||||||
Char *cp, ***vp;
|
Char *cp, ***vp;
|
||||||
{
|
{
|
||||||
register Char *dp;
|
Char *dp;
|
||||||
|
|
||||||
if (*cp) {
|
if (*cp) {
|
||||||
dp = Strsave(cp);
|
dp = Strsave(cp);
|
||||||
@@ -332,9 +336,9 @@ operate(op, vp, p)
|
|||||||
{
|
{
|
||||||
Char opr[2];
|
Char opr[2];
|
||||||
Char *vec[5];
|
Char *vec[5];
|
||||||
register Char **v = vec;
|
Char **v = vec;
|
||||||
Char **vecp = v;
|
Char **vecp = v;
|
||||||
register int i;
|
int i;
|
||||||
|
|
||||||
if (op != '=') {
|
if (op != '=') {
|
||||||
if (*vp)
|
if (*vp)
|
||||||
@@ -357,7 +361,7 @@ static Char *putp;
|
|||||||
|
|
||||||
Char *
|
Char *
|
||||||
putn(n)
|
putn(n)
|
||||||
register int n;
|
int n;
|
||||||
{
|
{
|
||||||
int num;
|
int num;
|
||||||
static Char number[15];
|
static Char number[15];
|
||||||
@@ -390,7 +394,7 @@ putn(n)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
putn1(n)
|
putn1(n)
|
||||||
register int n;
|
int n;
|
||||||
{
|
{
|
||||||
if (n > 9)
|
if (n > 9)
|
||||||
putn1(n / 10);
|
putn1(n / 10);
|
||||||
@@ -399,9 +403,9 @@ putn1(n)
|
|||||||
|
|
||||||
int
|
int
|
||||||
getn(cp)
|
getn(cp)
|
||||||
register Char *cp;
|
Char *cp;
|
||||||
{
|
{
|
||||||
register int n;
|
int n;
|
||||||
int sign;
|
int sign;
|
||||||
|
|
||||||
sign = 0;
|
sign = 0;
|
||||||
@@ -426,7 +430,7 @@ value1(var, head)
|
|||||||
Char *var;
|
Char *var;
|
||||||
struct varent *head;
|
struct varent *head;
|
||||||
{
|
{
|
||||||
register struct varent *vp;
|
struct varent *vp;
|
||||||
|
|
||||||
vp = adrof1(var, head);
|
vp = adrof1(var, head);
|
||||||
return (vp == 0 || vp->vec[0] == 0 ? STRNULL : vp->vec[0]);
|
return (vp == 0 || vp->vec[0] == 0 ? STRNULL : vp->vec[0]);
|
||||||
@@ -435,9 +439,9 @@ value1(var, head)
|
|||||||
static struct varent *
|
static struct varent *
|
||||||
madrof(pat, vp)
|
madrof(pat, vp)
|
||||||
Char *pat;
|
Char *pat;
|
||||||
register struct varent *vp;
|
struct varent *vp;
|
||||||
{
|
{
|
||||||
register struct varent *vp1;
|
struct varent *vp1;
|
||||||
|
|
||||||
for (; vp; vp = vp->v_right) {
|
for (; vp; vp = vp->v_right) {
|
||||||
if (vp->v_left && (vp1 = madrof(pat, vp->v_left)))
|
if (vp->v_left && (vp1 = madrof(pat, vp->v_left)))
|
||||||
@@ -450,10 +454,10 @@ madrof(pat, vp)
|
|||||||
|
|
||||||
struct varent *
|
struct varent *
|
||||||
adrof1(name, v)
|
adrof1(name, v)
|
||||||
register Char *name;
|
Char *name;
|
||||||
register struct varent *v;
|
struct varent *v;
|
||||||
{
|
{
|
||||||
register cmp;
|
int cmp;
|
||||||
|
|
||||||
v = v->v_left;
|
v = v->v_left;
|
||||||
while (v && ((cmp = *name - *v->v_name) ||
|
while (v && ((cmp = *name - *v->v_name) ||
|
||||||
@@ -472,7 +476,7 @@ void
|
|||||||
set(var, val)
|
set(var, val)
|
||||||
Char *var, *val;
|
Char *var, *val;
|
||||||
{
|
{
|
||||||
register Char **vec = (Char **) xmalloc((size_t) (2 * sizeof(Char **)));
|
Char **vec = (Char **) xmalloc((size_t) (2 * sizeof(Char **)));
|
||||||
|
|
||||||
vec[0] = val;
|
vec[0] = val;
|
||||||
vec[1] = 0;
|
vec[1] = 0;
|
||||||
@@ -484,7 +488,7 @@ set1(var, vec, head)
|
|||||||
Char *var, **vec;
|
Char *var, **vec;
|
||||||
struct varent *head;
|
struct varent *head;
|
||||||
{
|
{
|
||||||
register Char **oldv = vec;
|
Char **oldv = vec;
|
||||||
|
|
||||||
gflag = 0;
|
gflag = 0;
|
||||||
tglob(oldv);
|
tglob(oldv);
|
||||||
@@ -505,10 +509,10 @@ set1(var, vec, head)
|
|||||||
void
|
void
|
||||||
setq(name, vec, p)
|
setq(name, vec, p)
|
||||||
Char *name, **vec;
|
Char *name, **vec;
|
||||||
register struct varent *p;
|
struct varent *p;
|
||||||
{
|
{
|
||||||
register struct varent *c;
|
struct varent *c;
|
||||||
register f;
|
int f;
|
||||||
|
|
||||||
f = 0; /* tree hangs off the header's left link */
|
f = 0; /* tree hangs off the header's left link */
|
||||||
while ((c = p->v_link[f]) != NULL) {
|
while ((c = p->v_link[f]) != NULL) {
|
||||||
@@ -551,11 +555,11 @@ unset(v, t)
|
|||||||
|
|
||||||
void
|
void
|
||||||
unset1(v, head)
|
unset1(v, head)
|
||||||
register Char *v[];
|
Char *v[];
|
||||||
struct varent *head;
|
struct varent *head;
|
||||||
{
|
{
|
||||||
register struct varent *vp;
|
struct varent *vp;
|
||||||
register int cnt;
|
int cnt;
|
||||||
|
|
||||||
while (*++v) {
|
while (*++v) {
|
||||||
cnt = 0;
|
cnt = 0;
|
||||||
@@ -570,7 +574,7 @@ void
|
|||||||
unsetv(var)
|
unsetv(var)
|
||||||
Char *var;
|
Char *var;
|
||||||
{
|
{
|
||||||
register struct varent *vp;
|
struct varent *vp;
|
||||||
|
|
||||||
if ((vp = adrof1(var, &shvhed)) == 0)
|
if ((vp = adrof1(var, &shvhed)) == 0)
|
||||||
udvar(var);
|
udvar(var);
|
||||||
@@ -579,10 +583,10 @@ unsetv(var)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
unsetv1(p)
|
unsetv1(p)
|
||||||
register struct varent *p;
|
struct varent *p;
|
||||||
{
|
{
|
||||||
register struct varent *c, *pp;
|
struct varent *c, *pp;
|
||||||
register f;
|
int f;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Free associated memory first to avoid complications.
|
* Free associated memory first to avoid complications.
|
||||||
@@ -633,8 +637,8 @@ shift(v, t)
|
|||||||
Char **v;
|
Char **v;
|
||||||
struct command *t;
|
struct command *t;
|
||||||
{
|
{
|
||||||
register struct varent *argv;
|
struct varent *argv;
|
||||||
register Char *name;
|
Char *name;
|
||||||
|
|
||||||
v++;
|
v++;
|
||||||
name = *v;
|
name = *v;
|
||||||
@@ -665,7 +669,7 @@ exportpath(val)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (**val != '/' && (euid == 0 || uid == 0) &&
|
if (**val != '/' && (euid == 0 || uid == 0) &&
|
||||||
(intact || intty && isatty(SHOUT)))
|
(intact || (intty && isatty(SHOUT))))
|
||||||
(void) fprintf(csherr,
|
(void) fprintf(csherr,
|
||||||
"Warning: exported path contains relative components.\n");
|
"Warning: exported path contains relative components.\n");
|
||||||
(void) Strcat(exppath, *val++);
|
(void) Strcat(exppath, *val++);
|
||||||
@@ -717,16 +721,16 @@ rright(p)
|
|||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
balance(p, f, d)
|
balance(p, f, d)
|
||||||
register struct varent *p;
|
struct varent *p;
|
||||||
register int f, d;
|
int f, d;
|
||||||
{
|
{
|
||||||
register struct varent *pp;
|
struct varent *pp;
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
register struct varent *t; /* used by the rotate macros */
|
struct varent *t; /* used by the rotate macros */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
register ff;
|
int ff;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Ok, from here on, p is the node we're operating on; pp is it's parent; f
|
* Ok, from here on, p is the node we're operating on; pp is it's parent; f
|
||||||
@@ -812,10 +816,10 @@ balance(p, f, d)
|
|||||||
|
|
||||||
void
|
void
|
||||||
plist(p)
|
plist(p)
|
||||||
register struct varent *p;
|
struct varent *p;
|
||||||
{
|
{
|
||||||
register struct varent *c;
|
struct varent *c;
|
||||||
register len;
|
int len;
|
||||||
|
|
||||||
if (setintr)
|
if (setintr)
|
||||||
(void) sigsetmask(sigblock((sigset_t) 0) & ~sigmask(SIGINT));
|
(void) sigsetmask(sigblock((sigset_t) 0) & ~sigmask(SIGINT));
|
||||||
|
|||||||
+40
-37
@@ -29,12 +29,15 @@
|
|||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static char sccsid[] = "@(#)str.c 8.1 (Berkeley) 5/31/93";
|
static char sccsid[] = "@(#)str.c 8.1 (Berkeley) 5/31/93";
|
||||||
|
#else
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id: str.c,v 1.5 1997/02/22 14:02:09 peter Exp $";
|
||||||
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#define MALLOC_INCR 128
|
#define MALLOC_INCR 128
|
||||||
@@ -59,10 +62,10 @@ static char sccsid[] = "@(#)str.c 8.1 (Berkeley) 5/31/93";
|
|||||||
|
|
||||||
Char **
|
Char **
|
||||||
blk2short(src)
|
blk2short(src)
|
||||||
register char **src;
|
char **src;
|
||||||
{
|
{
|
||||||
size_t n;
|
size_t n;
|
||||||
register Char **sdst, **dst;
|
Char **sdst, **dst;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Count
|
* Count
|
||||||
@@ -79,10 +82,10 @@ blk2short(src)
|
|||||||
|
|
||||||
char **
|
char **
|
||||||
short2blk(src)
|
short2blk(src)
|
||||||
register Char **src;
|
Char **src;
|
||||||
{
|
{
|
||||||
size_t n;
|
size_t n;
|
||||||
register char **sdst, **dst;
|
char **sdst, **dst;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Count
|
* Count
|
||||||
@@ -99,11 +102,11 @@ short2blk(src)
|
|||||||
|
|
||||||
Char *
|
Char *
|
||||||
str2short(src)
|
str2short(src)
|
||||||
register char *src;
|
char *src;
|
||||||
{
|
{
|
||||||
static Char *sdst;
|
static Char *sdst;
|
||||||
static size_t dstsize = 0;
|
static size_t dstsize = 0;
|
||||||
register Char *dst, *edst;
|
Char *dst, *edst;
|
||||||
|
|
||||||
if (src == NULL)
|
if (src == NULL)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
@@ -131,11 +134,11 @@ str2short(src)
|
|||||||
|
|
||||||
char *
|
char *
|
||||||
short2str(src)
|
short2str(src)
|
||||||
register Char *src;
|
Char *src;
|
||||||
{
|
{
|
||||||
static char *sdst = NULL;
|
static char *sdst = NULL;
|
||||||
static size_t dstsize = 0;
|
static size_t dstsize = 0;
|
||||||
register char *dst, *edst;
|
char *dst, *edst;
|
||||||
|
|
||||||
if (src == NULL)
|
if (src == NULL)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
@@ -162,9 +165,9 @@ short2str(src)
|
|||||||
|
|
||||||
Char *
|
Char *
|
||||||
s_strcpy(dst, src)
|
s_strcpy(dst, src)
|
||||||
register Char *dst, *src;
|
Char *dst, *src;
|
||||||
{
|
{
|
||||||
register Char *sdst;
|
Char *sdst;
|
||||||
|
|
||||||
sdst = dst;
|
sdst = dst;
|
||||||
while ((*dst++ = *src++) != '\0')
|
while ((*dst++ = *src++) != '\0')
|
||||||
@@ -174,10 +177,10 @@ s_strcpy(dst, src)
|
|||||||
|
|
||||||
Char *
|
Char *
|
||||||
s_strncpy(dst, src, n)
|
s_strncpy(dst, src, n)
|
||||||
register Char *dst, *src;
|
Char *dst, *src;
|
||||||
register size_t n;
|
size_t n;
|
||||||
{
|
{
|
||||||
register Char *sdst;
|
Char *sdst;
|
||||||
|
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
return(dst);
|
return(dst);
|
||||||
@@ -195,9 +198,9 @@ s_strncpy(dst, src, n)
|
|||||||
|
|
||||||
Char *
|
Char *
|
||||||
s_strcat(dst, src)
|
s_strcat(dst, src)
|
||||||
register Char *dst, *src;
|
Char *dst, *src;
|
||||||
{
|
{
|
||||||
register short *sdst;
|
short *sdst;
|
||||||
|
|
||||||
sdst = dst;
|
sdst = dst;
|
||||||
while (*dst++)
|
while (*dst++)
|
||||||
@@ -211,10 +214,10 @@ s_strcat(dst, src)
|
|||||||
#ifdef NOTUSED
|
#ifdef NOTUSED
|
||||||
Char *
|
Char *
|
||||||
s_strncat(dst, src, n)
|
s_strncat(dst, src, n)
|
||||||
register Char *dst, *src;
|
Char *dst, *src;
|
||||||
register size_t n;
|
size_t n;
|
||||||
{
|
{
|
||||||
register Char *sdst;
|
Char *sdst;
|
||||||
|
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
return (dst);
|
return (dst);
|
||||||
@@ -239,7 +242,7 @@ s_strncat(dst, src, n)
|
|||||||
|
|
||||||
Char *
|
Char *
|
||||||
s_strchr(str, ch)
|
s_strchr(str, ch)
|
||||||
register Char *str;
|
Char *str;
|
||||||
int ch;
|
int ch;
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
@@ -251,10 +254,10 @@ s_strchr(str, ch)
|
|||||||
|
|
||||||
Char *
|
Char *
|
||||||
s_strrchr(str, ch)
|
s_strrchr(str, ch)
|
||||||
register Char *str;
|
Char *str;
|
||||||
int ch;
|
int ch;
|
||||||
{
|
{
|
||||||
register Char *rstr;
|
Char *rstr;
|
||||||
|
|
||||||
rstr = NULL;
|
rstr = NULL;
|
||||||
do
|
do
|
||||||
@@ -266,9 +269,9 @@ s_strrchr(str, ch)
|
|||||||
|
|
||||||
size_t
|
size_t
|
||||||
s_strlen(str)
|
s_strlen(str)
|
||||||
register Char *str;
|
Char *str;
|
||||||
{
|
{
|
||||||
register size_t n;
|
size_t n;
|
||||||
|
|
||||||
for (n = 0; *str++; n++)
|
for (n = 0; *str++; n++)
|
||||||
continue;
|
continue;
|
||||||
@@ -277,7 +280,7 @@ s_strlen(str)
|
|||||||
|
|
||||||
int
|
int
|
||||||
s_strcmp(str1, str2)
|
s_strcmp(str1, str2)
|
||||||
register Char *str1, *str2;
|
Char *str1, *str2;
|
||||||
{
|
{
|
||||||
for (; *str1 && *str1 == *str2; str1++, str2++)
|
for (; *str1 && *str1 == *str2; str1++, str2++)
|
||||||
continue;
|
continue;
|
||||||
@@ -298,8 +301,8 @@ s_strcmp(str1, str2)
|
|||||||
|
|
||||||
int
|
int
|
||||||
s_strncmp(str1, str2, n)
|
s_strncmp(str1, str2, n)
|
||||||
register Char *str1, *str2;
|
Char *str1, *str2;
|
||||||
register size_t n;
|
size_t n;
|
||||||
{
|
{
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
return (0);
|
return (0);
|
||||||
@@ -327,10 +330,10 @@ s_strncmp(str1, str2, n)
|
|||||||
|
|
||||||
Char *
|
Char *
|
||||||
s_strsave(s)
|
s_strsave(s)
|
||||||
register Char *s;
|
Char *s;
|
||||||
{
|
{
|
||||||
Char *n;
|
Char *n;
|
||||||
register Char *p;
|
Char *p;
|
||||||
|
|
||||||
if (s == 0)
|
if (s == 0)
|
||||||
s = STRNULL;
|
s = STRNULL;
|
||||||
@@ -347,7 +350,7 @@ s_strspl(cp, dp)
|
|||||||
Char *cp, *dp;
|
Char *cp, *dp;
|
||||||
{
|
{
|
||||||
Char *ep;
|
Char *ep;
|
||||||
register Char *p, *q;
|
Char *p, *q;
|
||||||
|
|
||||||
if (!cp)
|
if (!cp)
|
||||||
cp = STRNULL;
|
cp = STRNULL;
|
||||||
@@ -368,7 +371,7 @@ s_strspl(cp, dp)
|
|||||||
|
|
||||||
Char *
|
Char *
|
||||||
s_strend(cp)
|
s_strend(cp)
|
||||||
register Char *cp;
|
Char *cp;
|
||||||
{
|
{
|
||||||
if (!cp)
|
if (!cp)
|
||||||
return (cp);
|
return (cp);
|
||||||
@@ -379,11 +382,11 @@ s_strend(cp)
|
|||||||
|
|
||||||
Char *
|
Char *
|
||||||
s_strstr(s, t)
|
s_strstr(s, t)
|
||||||
register Char *s, *t;
|
Char *s, *t;
|
||||||
{
|
{
|
||||||
do {
|
do {
|
||||||
register Char *ss = s;
|
Char *ss = s;
|
||||||
register Char *tt = t;
|
Char *tt = t;
|
||||||
|
|
||||||
do
|
do
|
||||||
if (*tt == '\0')
|
if (*tt == '\0')
|
||||||
@@ -396,11 +399,11 @@ s_strstr(s, t)
|
|||||||
|
|
||||||
char *
|
char *
|
||||||
short2qstr(src)
|
short2qstr(src)
|
||||||
register Char *src;
|
Char *src;
|
||||||
{
|
{
|
||||||
static char *sdst = NULL;
|
static char *sdst = NULL;
|
||||||
static size_t dstsize = 0;
|
static size_t dstsize = 0;
|
||||||
register char *dst, *edst;
|
char *dst, *edst;
|
||||||
|
|
||||||
if (src == NULL)
|
if (src == NULL)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|||||||
+14
-11
@@ -29,12 +29,15 @@
|
|||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
|
#if 0
|
||||||
static char sccsid[] = "@(#)time.c 8.1 (Berkeley) 5/31/93";
|
static char sccsid[] = "@(#)time.c 8.1 (Berkeley) 5/31/93";
|
||||||
|
#else
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id: time.c,v 1.7 1997/02/22 14:02:09 peter Exp $";
|
||||||
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@@ -92,7 +95,7 @@ donice(v, t)
|
|||||||
Char **v;
|
Char **v;
|
||||||
struct command *t;
|
struct command *t;
|
||||||
{
|
{
|
||||||
register Char *cp;
|
Char *cp;
|
||||||
int nval = 0;
|
int nval = 0;
|
||||||
|
|
||||||
v++, cp = *v++;
|
v++, cp = *v++;
|
||||||
@@ -105,7 +108,7 @@ donice(v, t)
|
|||||||
|
|
||||||
void
|
void
|
||||||
ruadd(ru, ru2)
|
ruadd(ru, ru2)
|
||||||
register struct rusage *ru, *ru2;
|
struct rusage *ru, *ru2;
|
||||||
{
|
{
|
||||||
tvadd(&ru->ru_utime, &ru2->ru_utime);
|
tvadd(&ru->ru_utime, &ru2->ru_utime);
|
||||||
tvadd(&ru->ru_stime, &ru2->ru_stime);
|
tvadd(&ru->ru_stime, &ru2->ru_stime);
|
||||||
@@ -129,17 +132,17 @@ ruadd(ru, ru2)
|
|||||||
|
|
||||||
void
|
void
|
||||||
prusage(r0, r1, e, b)
|
prusage(r0, r1, e, b)
|
||||||
register struct rusage *r0, *r1;
|
struct rusage *r0, *r1;
|
||||||
struct timeval *e, *b;
|
struct timeval *e, *b;
|
||||||
{
|
{
|
||||||
register time_t t =
|
time_t t =
|
||||||
(r1->ru_utime.tv_sec - r0->ru_utime.tv_sec) * 100 +
|
(r1->ru_utime.tv_sec - r0->ru_utime.tv_sec) * 100 +
|
||||||
(r1->ru_utime.tv_usec - r0->ru_utime.tv_usec) / 10000 +
|
(r1->ru_utime.tv_usec - r0->ru_utime.tv_usec) / 10000 +
|
||||||
(r1->ru_stime.tv_sec - r0->ru_stime.tv_sec) * 100 +
|
(r1->ru_stime.tv_sec - r0->ru_stime.tv_sec) * 100 +
|
||||||
(r1->ru_stime.tv_usec - r0->ru_stime.tv_usec) / 10000;
|
(r1->ru_stime.tv_usec - r0->ru_stime.tv_usec) / 10000;
|
||||||
register char *cp;
|
char *cp;
|
||||||
register long i;
|
long i;
|
||||||
register struct varent *vp = adrof(STRtime);
|
struct varent *vp = adrof(STRtime);
|
||||||
|
|
||||||
int ms =
|
int ms =
|
||||||
(e->tv_sec - b->tv_sec) * 100 + (e->tv_usec - b->tv_usec) / 10000;
|
(e->tv_sec - b->tv_sec) * 100 + (e->tv_usec - b->tv_usec) / 10000;
|
||||||
@@ -277,7 +280,7 @@ void
|
|||||||
psecs(l)
|
psecs(l)
|
||||||
long l;
|
long l;
|
||||||
{
|
{
|
||||||
register int i;
|
int i;
|
||||||
|
|
||||||
i = l / 3600;
|
i = l / 3600;
|
||||||
if (i) {
|
if (i) {
|
||||||
@@ -298,7 +301,7 @@ void
|
|||||||
pcsecs(l) /* PWP: print mm:ss.dd, l is in sec*100 */
|
pcsecs(l) /* PWP: print mm:ss.dd, l is in sec*100 */
|
||||||
long l;
|
long l;
|
||||||
{
|
{
|
||||||
register int i;
|
int i;
|
||||||
|
|
||||||
i = l / 360000;
|
i = l / 360000;
|
||||||
if (i) {
|
if (i) {
|
||||||
|
|||||||
Reference in New Issue
Block a user