run GNU protoize
protect header files nuke some dead code regenerate configure script let silly code die
This commit is contained in:
88
tree.c
88
tree.c
@ -1,4 +1,4 @@
|
||||
/** $MirBSD: tree.c,v 1.5 2004/10/28 11:11:19 tg Exp $ */
|
||||
/** $MirBSD: tree.c,v 1.6 2004/10/28 11:53:43 tg Exp $ */
|
||||
/* $OpenBSD: tree.c,v 1.10 2002/02/27 19:37:09 dhartmei Exp $ */
|
||||
|
||||
/*
|
||||
@ -7,7 +7,7 @@
|
||||
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirBSD: tree.c,v 1.5 2004/10/28 11:11:19 tg Exp $");
|
||||
__RCSID("$MirBSD: tree.c,v 1.6 2004/10/28 11:53:43 tg Exp $");
|
||||
|
||||
#define INDENT 4
|
||||
|
||||
@ -25,10 +25,7 @@ static void iofree(struct ioword **iow, Area *ap);
|
||||
*/
|
||||
|
||||
static void
|
||||
ptree(t, indent, shf)
|
||||
struct op *t;
|
||||
int indent;
|
||||
struct shf *shf;
|
||||
ptree(struct op *t, int indent, struct shf *shf)
|
||||
{
|
||||
char **w;
|
||||
struct ioword **ioact;
|
||||
@ -51,25 +48,8 @@ ptree(t, indent, shf)
|
||||
fptreef(shf, indent, "#no-args# ");
|
||||
break;
|
||||
case TEXEC:
|
||||
#if 0 /* ?not useful - can't be called? */
|
||||
/* Print original vars */
|
||||
if (t->left->vars)
|
||||
for (w = t->left->vars; *w != NULL; )
|
||||
fptreef(shf, indent, "%S ", *w++);
|
||||
else
|
||||
fptreef(shf, indent, "#no-vars# ");
|
||||
/* Print expanded vars */
|
||||
if (t->args)
|
||||
for (w = t->args; *w != NULL; )
|
||||
fptreef(shf, indent, "%s ", *w++);
|
||||
else
|
||||
fptreef(shf, indent, "#no-args# ");
|
||||
/* Print original io */
|
||||
t = t->left;
|
||||
#else
|
||||
t = t->left;
|
||||
goto Chain;
|
||||
#endif
|
||||
case TPAREN:
|
||||
fptreef(shf, indent + 2, "( %T) ", t->left);
|
||||
break;
|
||||
@ -212,10 +192,7 @@ ptree(t, indent, shf)
|
||||
}
|
||||
|
||||
static void
|
||||
pioact(shf, indent, iop)
|
||||
struct shf *shf;
|
||||
int indent;
|
||||
struct ioword *iop;
|
||||
pioact(struct shf *shf, int indent, struct ioword *iop)
|
||||
{
|
||||
int flag = iop->flag;
|
||||
int type = flag & IOTYPE;
|
||||
@ -273,9 +250,7 @@ pioact(shf, indent, iop)
|
||||
*/
|
||||
|
||||
static void
|
||||
tputC(c, shf)
|
||||
int c;
|
||||
struct shf *shf;
|
||||
tputC(int c, struct shf *shf)
|
||||
{
|
||||
if ((c&0x60) == 0) { /* C0|C1 */
|
||||
tputc((c&0x80) ? '$' : '^', shf);
|
||||
@ -288,9 +263,7 @@ tputC(c, shf)
|
||||
}
|
||||
|
||||
static void
|
||||
tputS(wp, shf)
|
||||
char *wp;
|
||||
struct shf *shf;
|
||||
tputS(char *wp, struct shf *shf)
|
||||
{
|
||||
int c, quoted=0;
|
||||
|
||||
@ -372,15 +345,7 @@ tputS(wp, shf)
|
||||
*/
|
||||
/* VARARGS */
|
||||
int
|
||||
#ifdef HAVE_PROTOTYPES
|
||||
fptreef(struct shf *shf, int indent, const char *fmt, ...)
|
||||
#else
|
||||
fptreef(shf, indent, fmt, va_alist)
|
||||
struct shf *shf;
|
||||
int indent;
|
||||
const char *fmt;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list va;
|
||||
|
||||
@ -393,15 +358,7 @@ fptreef(shf, indent, fmt, va_alist)
|
||||
|
||||
/* VARARGS */
|
||||
char *
|
||||
#ifdef HAVE_PROTOTYPES
|
||||
snptreef(char *s, int n, const char *fmt, ...)
|
||||
#else
|
||||
snptreef(s, n, fmt, va_alist)
|
||||
char *s;
|
||||
int n;
|
||||
const char *fmt;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list va;
|
||||
struct shf shf;
|
||||
@ -416,11 +373,7 @@ snptreef(s, n, fmt, va_alist)
|
||||
}
|
||||
|
||||
static void
|
||||
vfptreef(shf, indent, fmt, va)
|
||||
struct shf *shf;
|
||||
int indent;
|
||||
const char *fmt;
|
||||
va_list va;
|
||||
vfptreef(struct shf *shf, int indent, const char *fmt, va_list va)
|
||||
{
|
||||
int c;
|
||||
|
||||
@ -488,9 +441,7 @@ vfptreef(shf, indent, fmt, va)
|
||||
*/
|
||||
|
||||
struct op *
|
||||
tcopy(t, ap)
|
||||
struct op *t;
|
||||
Area *ap;
|
||||
tcopy(struct op *t, Area *ap)
|
||||
{
|
||||
struct op *r;
|
||||
char **tw, **rw;
|
||||
@ -539,9 +490,7 @@ tcopy(t, ap)
|
||||
}
|
||||
|
||||
char *
|
||||
wdcopy(wp, ap)
|
||||
const char *wp;
|
||||
Area *ap;
|
||||
wdcopy(const char *wp, Area *ap)
|
||||
{
|
||||
size_t len = wdscan(wp, EOS) - wp;
|
||||
return memcpy(alloc(len, ap), wp, len);
|
||||
@ -549,9 +498,7 @@ wdcopy(wp, ap)
|
||||
|
||||
/* return the position of prefix c in wp plus 1 */
|
||||
char *
|
||||
wdscan(wp, c)
|
||||
const char *wp;
|
||||
int c;
|
||||
wdscan(const char *wp, int c)
|
||||
{
|
||||
int nest = 0;
|
||||
|
||||
@ -607,8 +554,7 @@ wdscan(wp, c)
|
||||
* (string is allocated from ATEMP)
|
||||
*/
|
||||
char *
|
||||
wdstrip(wp)
|
||||
const char *wp;
|
||||
wdstrip(const char *wp)
|
||||
{
|
||||
struct shf shf;
|
||||
int c;
|
||||
@ -675,9 +621,7 @@ wdstrip(wp)
|
||||
}
|
||||
|
||||
static struct ioword **
|
||||
iocopy(iow, ap)
|
||||
struct ioword **iow;
|
||||
Area *ap;
|
||||
iocopy(struct ioword **iow, Area *ap)
|
||||
{
|
||||
struct ioword **ior;
|
||||
int i;
|
||||
@ -710,9 +654,7 @@ iocopy(iow, ap)
|
||||
*/
|
||||
|
||||
void
|
||||
tfree(t, ap)
|
||||
struct op *t;
|
||||
Area *ap;
|
||||
tfree(struct op *t, Area *ap)
|
||||
{
|
||||
char **w;
|
||||
|
||||
@ -744,9 +686,7 @@ tfree(t, ap)
|
||||
}
|
||||
|
||||
static void
|
||||
iofree(iow, ap)
|
||||
struct ioword **iow;
|
||||
Area *ap;
|
||||
iofree(struct ioword **iow, Area *ap)
|
||||
{
|
||||
struct ioword **iop;
|
||||
struct ioword *p;
|
||||
|
Reference in New Issue
Block a user