-Wall -Werror -W -pedantic clean

This commit is contained in:
tg
2004-10-28 11:03:24 +00:00
parent 06411e2978
commit 7ad780aa98
28 changed files with 442 additions and 465 deletions

46
eval.c
View File

@ -1,4 +1,4 @@
/** $MirBSD: eval.c,v 1.3 2004/09/21 11:57:08 tg Exp $ */
/** $MirBSD: eval.c,v 1.4 2004/10/28 11:03:22 tg Exp $ */
/* $OpenBSD: eval.c,v 1.14 2003/11/10 21:26:39 millert Exp $ */
/*
@ -10,6 +10,8 @@
#include "ksh_dir.h"
#include "ksh_stat.h"
__RCSID("$MirBSD: eval.c,v 1.4 2004/10/28 11:03:22 tg Exp $");
/*
* string expansion
*
@ -80,7 +82,7 @@ substitute(cp, f)
*/
char **
eval(ap, f)
register char **ap;
char **ap;
int f;
{
XPtrV w;
@ -125,7 +127,7 @@ evalstr(cp, f)
*/
char *
evalonestr(cp, f)
register char *cp;
char *cp;
int f;
{
XPtrV w;
@ -161,14 +163,14 @@ typedef struct SubType {
void
expand(cp, wp, f)
char *cp; /* input word */
register XPtrV *wp; /* output words */
XPtrV *wp; /* output words */
int f; /* DO* flags */
{
register int UNINITIALIZED(c);
register int type; /* expansion type */
register int quote = 0; /* quoted */
int UNINITIALIZED(c);
int type; /* expansion type */
int quote = 0; /* quoted */
XString ds; /* destination string */
register char *dp, *sp; /* dest., source */
char *dp, *sp; /* dest., source */
int fdo, word; /* second pass flags; have word */
int doblank; /* field splitting of parameter/command subst */
Expand x; /* expansion variables */
@ -335,7 +337,7 @@ expand(cp, wp, f)
* expected)
*/
*dp++ = MAGIC;
*dp++ = '@' + 0x80;
*dp++ = (char)('@' + 0x80);
break;
case '=':
/* Enabling tilde expansion
@ -841,11 +843,11 @@ varsub(xp, sp, word, stypep, slenp)
*/
static int
comsub(xp, cp)
register Expand *xp;
Expand *xp;
char *cp;
{
Source *s, *sold;
register struct op *t;
struct op *t;
struct shf *shf;
s = pushs(SSTRING, ATEMP);
@ -859,7 +861,7 @@ comsub(xp, cp)
if (t != NULL && t->type == TCOM && /* $(<file) */
*t->args == NULL && *t->vars == NULL && t->ioact != NULL) {
register struct ioword *io = *t->ioact;
struct ioword *io = *t->ioact;
char *name;
if ((io->flag&IOTYPE) != IOREAD)
@ -895,12 +897,12 @@ comsub(xp, cp)
static char *
trimsub(str, pat, how)
register char *str;
char *str;
char *pat;
int how;
{
register char *end = strchr(str, 0);
register char *p, c;
char *end = strchr(str, 0);
char *p, c;
switch (how&0xff) { /* UCHAR_MAX maybe? */
case '#': /* shortest at beginning */
@ -949,7 +951,7 @@ trimsub(str, pat, how)
static void
glob(cp, wp, markdirs)
char *cp;
register XPtrV *wp;
XPtrV *wp;
int markdirs;
{
int oldsize = XPsize(*wp);
@ -991,10 +993,10 @@ globit(xs, xpp, sp, wp, check)
XString *xs; /* dest string */
char **xpp; /* ptr to dest end */
char *sp; /* source path */
register XPtrV *wp; /* output list */
XPtrV *wp; /* output list */
int check; /* GF_* flags */
{
register char *np; /* next source component */
char *np; /* next source component */
char *xp = *xpp;
char *se;
char odirsep;
@ -1187,10 +1189,10 @@ debunk(dp, sp, dlen)
char *d, *s;
if ((s = strchr(sp, MAGIC))) {
if (s - sp >= dlen)
if ((size_t)(s - sp) >= dlen)
return dp;
memcpy(dp, sp, s - sp);
for (d = dp + (s - sp); *s && (d - dp < dlen); s++)
for (d = dp + (s - sp); *s && ((size_t)(d - dp) < dlen); s++)
if (!ISMAGIC(*s) || !(*++s & 0x80)
|| !strchr("*+?@! ", *s & 0x7f))
*d++ = *s;
@ -1198,7 +1200,7 @@ debunk(dp, sp, dlen)
/* extended pattern operators: *+?@! */
if ((*s & 0x7f) != ' ')
*d++ = *s & 0x7f;
if (d - dp < dlen)
if ((size_t)(d - dp) < dlen)
*d++ = '(';
}
*d = '\0';
@ -1284,7 +1286,7 @@ static char *
homedir(name)
char *name;
{
register struct tbl *ap;
struct tbl *ap;
ap = tenter(&homedirs, name, hash(name));
if (!(ap->flag & ISSET)) {