-Wall -Werror -W -pedantic clean
This commit is contained in:
parent
06411e2978
commit
7ad780aa98
4
Makefile
4
Makefile
@ -1,4 +1,4 @@
|
||||
# $MirBSD: Makefile,v 1.6 2004/07/15 16:21:04 tg Stab $
|
||||
# $MirBSD: Makefile,v 1.7 2004/10/28 11:03:21 tg Exp $
|
||||
# $OpenBSD: Makefile,v 1.18 2004/02/16 19:07:19 deraadt Exp $
|
||||
|
||||
PROG= ksh
|
||||
@ -9,7 +9,7 @@ SRCS= alloc.c c_ksh.c c_sh.c c_test.c c_ulimit.c edit.c emacs.c \
|
||||
MAN= ksh.1tbl sh.1tbl
|
||||
|
||||
CPPFLAGS+= -DHAVE_CONFIG_H -I. -DKSH
|
||||
CFLAGS+= -Wall -Werror
|
||||
CFLAGS+= -Wall -Werror -W -pedantic
|
||||
CLEANFILES+= siglist.out emacs.out
|
||||
|
||||
LINKS= ${BINDIR}/ksh ${BINDIR}/rksh
|
||||
|
20
c_ksh.c
20
c_ksh.c
@ -1,4 +1,4 @@
|
||||
/** $MirBSD: c_ksh.c,v 1.6 2004/09/21 11:57:07 tg Exp $ */
|
||||
/** $MirBSD: c_ksh.c,v 1.7 2004/10/28 11:03:21 tg Exp $ */
|
||||
/* $OpenBSD: c_ksh.c,v 1.18 2004/02/10 13:03:36 jmc Exp $ */
|
||||
|
||||
/*
|
||||
@ -13,6 +13,8 @@
|
||||
#include <sys/cygwin.h>
|
||||
#endif /* __CYGWIN__ */
|
||||
|
||||
__RCSID("$MirBSD: c_ksh.c,v 1.7 2004/10/28 11:03:21 tg Exp $");
|
||||
|
||||
int
|
||||
c_cd(wp)
|
||||
char **wp;
|
||||
@ -331,7 +333,7 @@ c_print(wp)
|
||||
Xinit(xs, xp, 128, ATEMP);
|
||||
|
||||
while (*wp != NULL) {
|
||||
register int c;
|
||||
int c;
|
||||
s = *wp;
|
||||
while ((c = *s++) != '\0') {
|
||||
Xcheck(xs, xp);
|
||||
@ -1016,8 +1018,8 @@ int
|
||||
c_unalias(wp)
|
||||
char **wp;
|
||||
{
|
||||
register struct table *t = &aliases;
|
||||
register struct tbl *ap;
|
||||
struct table *t = &aliases;
|
||||
struct tbl *ap;
|
||||
int rv = 0, all = 0;
|
||||
int optc;
|
||||
|
||||
@ -1152,8 +1154,8 @@ c_fgbg(wp)
|
||||
#endif
|
||||
|
||||
struct kill_info {
|
||||
int num_width;
|
||||
int name_width;
|
||||
size_t num_width;
|
||||
size_t name_width;
|
||||
};
|
||||
static char *kill_fmt_entry ARGS((void *arg, int i, char *buf, int buflen));
|
||||
|
||||
@ -1246,8 +1248,8 @@ c_kill(wp)
|
||||
shprintf("%s%s", p, sigtraps[i].name);
|
||||
shprintf(newline);
|
||||
} else {
|
||||
int w, i;
|
||||
int mess_width;
|
||||
int i;
|
||||
size_t w, mess_width;
|
||||
struct kill_info ki;
|
||||
|
||||
for (i = SIGNALS, ki.num_width = 1; i >= 10; i /= 10)
|
||||
@ -1408,7 +1410,7 @@ c_bind(wp)
|
||||
char **wp;
|
||||
{
|
||||
int rv = 0, macro = 0, list = 0;
|
||||
register char *cp;
|
||||
char *cp;
|
||||
int optc;
|
||||
|
||||
while ((optc = ksh_getopt(wp, &builtin_opt, "lm")) != EOF)
|
||||
|
37
c_sh.c
37
c_sh.c
@ -1,4 +1,4 @@
|
||||
/** $MirBSD: c_sh.c,v 1.4 2004/09/21 11:57:07 tg Exp $ */
|
||||
/** $MirBSD: c_sh.c,v 1.5 2004/10/28 11:03:22 tg Exp $ */
|
||||
/* $OpenBSD: c_sh.c,v 1.17 2003/03/13 09:03:07 deraadt Exp $ */
|
||||
|
||||
/*
|
||||
@ -10,6 +10,8 @@
|
||||
#include "ksh_time.h"
|
||||
#include "ksh_times.h"
|
||||
|
||||
__RCSID("$MirBSD: c_sh.c,v 1.5 2004/10/28 11:03:22 tg Exp $");
|
||||
|
||||
static char *clocktos ARGS((clock_t t));
|
||||
|
||||
|
||||
@ -25,8 +27,8 @@ int
|
||||
c_shift(wp)
|
||||
char **wp;
|
||||
{
|
||||
register struct block *l = e->loc;
|
||||
register int n;
|
||||
struct block *l = e->loc;
|
||||
int n;
|
||||
long val;
|
||||
char *arg;
|
||||
|
||||
@ -57,8 +59,8 @@ int
|
||||
c_umask(wp)
|
||||
char **wp;
|
||||
{
|
||||
register int i;
|
||||
register char *cp;
|
||||
int i;
|
||||
char *cp;
|
||||
int symbolic = 0;
|
||||
int old_umask;
|
||||
int optc;
|
||||
@ -239,11 +241,11 @@ int
|
||||
c_read(wp)
|
||||
char **wp;
|
||||
{
|
||||
register int c = 0;
|
||||
int c = 0;
|
||||
int expand = 1, history = 0;
|
||||
int expanding;
|
||||
int ecode = 0;
|
||||
register char *cp;
|
||||
char *cp;
|
||||
int fd = 0;
|
||||
struct shf *shf;
|
||||
int optc;
|
||||
@ -425,7 +427,7 @@ int
|
||||
c_eval(wp)
|
||||
char **wp;
|
||||
{
|
||||
register struct source *s;
|
||||
struct source *s;
|
||||
|
||||
if (ksh_getopt(wp, &builtin_opt, null) == '?')
|
||||
return 1;
|
||||
@ -468,7 +470,7 @@ c_trap(wp)
|
||||
{
|
||||
int i;
|
||||
char *s;
|
||||
register Trap *p;
|
||||
Trap *p;
|
||||
|
||||
if (ksh_getopt(wp, &builtin_opt, null) == '?')
|
||||
return 1;
|
||||
@ -625,7 +627,7 @@ c_set(wp)
|
||||
{
|
||||
int argi, setargs;
|
||||
struct block *l = e->loc;
|
||||
register char **owp = wp;
|
||||
char **owp = wp;
|
||||
|
||||
if (wp[1] == NULL) {
|
||||
static const char *const args [] = { "set", "-", NULL };
|
||||
@ -659,7 +661,7 @@ int
|
||||
c_unset(wp)
|
||||
char **wp;
|
||||
{
|
||||
register char *id;
|
||||
char *id;
|
||||
int optc, unset_var = 1;
|
||||
int ret = 0;
|
||||
|
||||
@ -694,8 +696,7 @@ c_unset(wp)
|
||||
}
|
||||
|
||||
int
|
||||
c_times(wp)
|
||||
char **wp;
|
||||
c_times(char **wp GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
struct tms all;
|
||||
|
||||
@ -808,8 +809,8 @@ clocktos(t)
|
||||
clock_t t;
|
||||
{
|
||||
static char temp[22]; /* enough for 64 bit clock_t */
|
||||
register int i;
|
||||
register char *cp = temp + sizeof(temp);
|
||||
int i;
|
||||
char *cp = temp + sizeof(temp);
|
||||
|
||||
/* note: posix says must use max precision, ie, if clk_tck is
|
||||
* 1000, must print 3 places after decimal (if non-zero, else 1).
|
||||
@ -830,8 +831,7 @@ clocktos(t)
|
||||
|
||||
/* exec with no args - args case is taken care of in comexec() */
|
||||
int
|
||||
c_exec(wp)
|
||||
char ** wp;
|
||||
c_exec(char **wp GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -858,8 +858,7 @@ c_exec(wp)
|
||||
|
||||
/* dummy function, special case in comexec() */
|
||||
int
|
||||
c_builtin(wp)
|
||||
char ** wp;
|
||||
c_builtin(char **wp GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
9
c_test.c
9
c_test.c
@ -1,4 +1,4 @@
|
||||
/** $MirBSD: c_test.c,v 1.4 2004/09/21 11:57:07 tg Exp $ */
|
||||
/** $MirBSD: c_test.c,v 1.5 2004/10/28 11:03:22 tg Exp $ */
|
||||
/* $OpenBSD: c_test.c,v 1.10 2003/10/10 19:09:07 millert Exp $ */
|
||||
|
||||
/*
|
||||
@ -14,6 +14,8 @@
|
||||
#include "ksh_stat.h"
|
||||
#include "c_test.h"
|
||||
|
||||
__RCSID("$MirBSD: c_test.c,v 1.5 2004/10/28 11:03:22 tg Exp $");
|
||||
|
||||
/* test(1) accepts the following grammar:
|
||||
oexpr ::= aexpr | aexpr "-o" oexpr ;
|
||||
aexpr ::= nexpr | nexpr "-a" aexpr ;
|
||||
@ -623,10 +625,7 @@ ptest_isa(te, meta)
|
||||
}
|
||||
|
||||
static const char *
|
||||
ptest_getopnd(te, op, do_eval)
|
||||
Test_env *te;
|
||||
Test_op op;
|
||||
int do_eval;
|
||||
ptest_getopnd(Test_env *te, Test_op op, int do_eval GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
if (te->pos.wp >= te->wp_end)
|
||||
return op == TO_FILTT ? "1" : (const char *) 0;
|
||||
|
18
c_ulimit.c
18
c_ulimit.c
@ -1,4 +1,4 @@
|
||||
/** $MirBSD: c_ulimit.c,v 1.6 2004/09/21 11:57:07 tg Exp $ */
|
||||
/** $MirBSD: c_ulimit.c,v 1.7 2004/10/28 11:03:22 tg Exp $ */
|
||||
/* $OpenBSD: c_ulimit.c,v 1.10 2003/10/22 07:40:38 jmc Exp $ */
|
||||
|
||||
/*
|
||||
@ -32,6 +32,8 @@ extern long ulimit();
|
||||
# endif /* HAVE_ULIMIT */
|
||||
#endif /* HAVE_ULIMIT_H */
|
||||
|
||||
__RCSID("$MirBSD: c_ulimit.c,v 1.7 2004/10/28 11:03:22 tg Exp $");
|
||||
|
||||
#define SOFT 0x1
|
||||
#define HARD 0x2
|
||||
|
||||
@ -115,9 +117,9 @@ c_ulimit(wp)
|
||||
# endif /* UL_GMEMLIM */
|
||||
#endif /* RLIMIT_VMEM */
|
||||
#ifdef RLIMIT_SWAP
|
||||
{ "swap(KiB)", RLIMIT_SWAP, RLIMIT_SWAP, 1024, 'w' },
|
||||
{ "swap(KiB)", RLIMIT, RLIMIT_SWAP, RLIMIT_SWAP, 1024, 'w' },
|
||||
#endif
|
||||
{ (char *) 0 }
|
||||
{ NULL, RLIMIT, 0, 0, 0, 0 }
|
||||
};
|
||||
static char options[3 + NELEM(limits)];
|
||||
rlim_t UNINITIALIZED(val);
|
||||
@ -200,7 +202,10 @@ c_ulimit(wp)
|
||||
val = limit.rlim_cur;
|
||||
else if (how & HARD)
|
||||
val = limit.rlim_max;
|
||||
} else
|
||||
}
|
||||
#ifdef HAVE_ULIMIT
|
||||
else
|
||||
#endif
|
||||
#endif /* HAVE_SETRLIMIT */
|
||||
#ifdef HAVE_ULIMIT
|
||||
{
|
||||
@ -244,7 +249,10 @@ c_ulimit(wp)
|
||||
else if (how & HARD)
|
||||
val = limit.rlim_max;
|
||||
}
|
||||
} else
|
||||
}
|
||||
#ifdef HAVE_ULIMIT
|
||||
else
|
||||
#endif
|
||||
#endif /* HAVE_SETRLIMIT */
|
||||
#ifdef HAVE_ULIMIT
|
||||
{
|
||||
|
15
edit.c
15
edit.c
@ -1,4 +1,4 @@
|
||||
/** $MirBSD: edit.c,v 1.7 2004/09/21 11:57:08 tg Exp $ */
|
||||
/** $MirBSD: edit.c,v 1.8 2004/10/28 11:03:22 tg Exp $ */
|
||||
/* $OpenBSD: edit.c,v 1.18 2003/08/22 18:17:10 fgsch Exp $ */
|
||||
|
||||
/*
|
||||
@ -22,6 +22,7 @@
|
||||
#include <ctype.h>
|
||||
#include "ksh_stat.h"
|
||||
|
||||
__RCSID("$MirBSD: edit.c,v 1.8 2004/10/28 11:03:22 tg Exp $");
|
||||
|
||||
#if defined(TIOCGWINSZ)
|
||||
static RETSIGTYPE x_sigwinch ARGS((int sig));
|
||||
@ -82,8 +83,7 @@ x_init()
|
||||
|
||||
#if defined(TIOCGWINSZ)
|
||||
static RETSIGTYPE
|
||||
x_sigwinch(sig)
|
||||
int sig;
|
||||
x_sigwinch(int sig GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
got_sigwinch = 1;
|
||||
return RETSIGVAL;
|
||||
@ -385,7 +385,7 @@ set_editmode(ed)
|
||||
#endif
|
||||
};
|
||||
char *rcp;
|
||||
int i;
|
||||
unsigned i;
|
||||
|
||||
if ((rcp = ksh_strrchr_dirsep(ed)))
|
||||
ed = ++rcp;
|
||||
@ -548,11 +548,8 @@ x_print_expansions(nwords, words, is_command)
|
||||
* - returns number of matching strings
|
||||
*/
|
||||
static int
|
||||
x_file_glob(flags, str, slen, wordsp)
|
||||
int flags;
|
||||
const char *str;
|
||||
int slen;
|
||||
char ***wordsp;
|
||||
x_file_glob(int flags GCC_FUNC_ATTR(unused), const char *str,
|
||||
int slen, char ***wordsp)
|
||||
{
|
||||
char *toglob;
|
||||
char **words;
|
||||
|
251
emacs.c
251
emacs.c
@ -1,4 +1,4 @@
|
||||
/** $MirBSD: emacs.c,v 1.9 2004/09/21 11:57:08 tg Exp $ */
|
||||
/** $MirBSD: emacs.c,v 1.10 2004/10/28 11:03:22 tg Exp $ */
|
||||
/* $OpenBSD: emacs.c,v 1.28 2003/10/22 07:40:38 jmc Exp $ */
|
||||
|
||||
/*
|
||||
@ -19,6 +19,8 @@
|
||||
#include <locale.h>
|
||||
#include "edit.h"
|
||||
|
||||
__RCSID("$MirBSD: emacs.c,v 1.10 2004/10/28 11:03:22 tg Exp $");
|
||||
|
||||
static Area aedit;
|
||||
#define AEDIT &aedit /* area for kill ring and macro defns */
|
||||
|
||||
@ -403,8 +405,7 @@ x_emacs(buf, len)
|
||||
}
|
||||
|
||||
static int
|
||||
x_insert(c)
|
||||
int c;
|
||||
x_insert(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
char str[2];
|
||||
|
||||
@ -423,8 +424,7 @@ x_insert(c)
|
||||
}
|
||||
|
||||
static int
|
||||
x_ins_string(c)
|
||||
int c;
|
||||
x_ins_string(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
if (macroptr) {
|
||||
x_e_putc(BEL);
|
||||
@ -462,7 +462,7 @@ x_ins(s)
|
||||
char *s;
|
||||
{
|
||||
char *cp = xcp;
|
||||
register int adj = x_adj_done;
|
||||
int adj = x_adj_done;
|
||||
|
||||
if (x_do_ins(s, strlen(s)) < 0)
|
||||
return -1;
|
||||
@ -501,8 +501,7 @@ x_emacs_putbuf(s, len)
|
||||
}
|
||||
|
||||
static int
|
||||
x_del_back(c)
|
||||
int c;
|
||||
x_del_back(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
int col = xcp - xbuf;
|
||||
|
||||
@ -518,8 +517,7 @@ x_del_back(c)
|
||||
}
|
||||
|
||||
static int
|
||||
x_del_char(c)
|
||||
int c;
|
||||
x_del_char(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
int nleft = xep - xcp;
|
||||
|
||||
@ -592,32 +590,28 @@ x_delete(nc, push)
|
||||
}
|
||||
|
||||
static int
|
||||
x_del_bword(c)
|
||||
int c;
|
||||
x_del_bword(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
x_delete(x_bword(), TRUE);
|
||||
return KSTD;
|
||||
}
|
||||
|
||||
static int
|
||||
x_mv_bword(c)
|
||||
int c;
|
||||
x_mv_bword(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
(void)x_bword();
|
||||
return KSTD;
|
||||
}
|
||||
|
||||
static int
|
||||
x_mv_fword(c)
|
||||
int c;
|
||||
x_mv_fword(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
x_goto(xcp + x_fword());
|
||||
return KSTD;
|
||||
}
|
||||
|
||||
static int
|
||||
x_del_fword(c)
|
||||
int c;
|
||||
x_del_fword(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
x_delete(x_fword(), TRUE);
|
||||
return KSTD;
|
||||
@ -627,7 +621,7 @@ static int
|
||||
x_bword()
|
||||
{
|
||||
int nc = 0;
|
||||
register char *cp = xcp;
|
||||
char *cp = xcp;
|
||||
|
||||
if (cp == xbuf) {
|
||||
x_e_putc(BEL);
|
||||
@ -654,7 +648,7 @@ static int
|
||||
x_fword()
|
||||
{
|
||||
int nc = 0;
|
||||
register char *cp = xcp;
|
||||
char *cp = xcp;
|
||||
|
||||
if (cp == xep) {
|
||||
x_e_putc(BEL);
|
||||
@ -678,7 +672,7 @@ x_fword()
|
||||
|
||||
static void
|
||||
x_goto(cp)
|
||||
register char *cp;
|
||||
char *cp;
|
||||
{
|
||||
if (cp < xbp || cp >= (xbp + x_displen))
|
||||
{
|
||||
@ -705,10 +699,9 @@ x_goto(cp)
|
||||
}
|
||||
|
||||
static void
|
||||
x_bs(c)
|
||||
int c;
|
||||
x_bs(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
register int i;
|
||||
int i;
|
||||
i = x_size(c);
|
||||
while (i--)
|
||||
x_e_putc('\b');
|
||||
@ -716,17 +709,16 @@ x_bs(c)
|
||||
|
||||
static int
|
||||
x_size_str(cp)
|
||||
register char *cp;
|
||||
char *cp;
|
||||
{
|
||||
register int size = 0;
|
||||
int size = 0;
|
||||
while (*cp)
|
||||
size += x_size(*cp++);
|
||||
return size;
|
||||
}
|
||||
|
||||
static int
|
||||
x_size(c)
|
||||
int c;
|
||||
x_size(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
if (c=='\t')
|
||||
return 4; /* Kludge, tabs are always four spaces. */
|
||||
@ -737,9 +729,9 @@ x_size(c)
|
||||
|
||||
static void
|
||||
x_zots(str)
|
||||
register char *str;
|
||||
char *str;
|
||||
{
|
||||
register int adj = x_adj_done;
|
||||
int adj = x_adj_done;
|
||||
|
||||
x_lastcp();
|
||||
while (*str && str < xlp && adj == x_adj_done)
|
||||
@ -747,8 +739,7 @@ x_zots(str)
|
||||
}
|
||||
|
||||
static void
|
||||
x_zotc(c)
|
||||
int c;
|
||||
x_zotc(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
if (c == '\t') {
|
||||
/* Kludge, tabs are always four spaces. */
|
||||
@ -761,8 +752,7 @@ x_zotc(c)
|
||||
}
|
||||
|
||||
static int
|
||||
x_mv_back(c)
|
||||
int c;
|
||||
x_mv_back(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
int col = xcp - xbuf;
|
||||
|
||||
@ -777,8 +767,7 @@ x_mv_back(c)
|
||||
}
|
||||
|
||||
static int
|
||||
x_mv_forw(c)
|
||||
int c;
|
||||
x_mv_forw(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
int nleft = xep - xcp;
|
||||
|
||||
@ -793,8 +782,7 @@ x_mv_forw(c)
|
||||
}
|
||||
|
||||
static int
|
||||
x_search_char_forw(c)
|
||||
int c;
|
||||
x_search_char_forw(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
char *cp = xcp;
|
||||
|
||||
@ -814,8 +802,7 @@ x_search_char_forw(c)
|
||||
}
|
||||
|
||||
static int
|
||||
x_search_char_back(c)
|
||||
int c;
|
||||
x_search_char_back(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
char *cp = xcp, *p;
|
||||
|
||||
@ -836,8 +823,7 @@ x_search_char_back(c)
|
||||
}
|
||||
|
||||
static int
|
||||
x_newline(c)
|
||||
int c;
|
||||
x_newline(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
x_e_putc('\r');
|
||||
x_e_putc('\n');
|
||||
@ -847,27 +833,45 @@ x_newline(c)
|
||||
}
|
||||
|
||||
static int
|
||||
x_end_of_text(c)
|
||||
int c;
|
||||
x_end_of_text(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
return KEOL;
|
||||
}
|
||||
|
||||
static int x_beg_hist(c) int c; { x_load_hist(history); return KSTD;}
|
||||
static int
|
||||
x_beg_hist(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
x_load_hist(history);
|
||||
return KSTD;
|
||||
}
|
||||
|
||||
static int x_end_hist(c) int c; { x_load_hist(histptr); return KSTD;}
|
||||
static int
|
||||
x_end_hist(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
x_load_hist(histptr);
|
||||
return KSTD;
|
||||
}
|
||||
|
||||
static int x_prev_com(c) int c; { x_load_hist(x_histp - x_arg); return KSTD;}
|
||||
static int
|
||||
x_prev_com(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
x_load_hist(x_histp - x_arg);
|
||||
return KSTD;
|
||||
}
|
||||
|
||||
static int x_next_com(c) int c; { x_load_hist(x_histp + x_arg); return KSTD;}
|
||||
static int
|
||||
x_next_com(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
x_load_hist(x_histp + x_arg);
|
||||
return KSTD;
|
||||
}
|
||||
|
||||
/* Goto a particular history number obtained from argument.
|
||||
* If no argument is given history 1 is probably not what you
|
||||
* want so we'll simply go to the oldest one.
|
||||
*/
|
||||
static int
|
||||
x_goto_hist(c)
|
||||
int c;
|
||||
x_goto_hist(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
if (x_arg_defaulted)
|
||||
x_load_hist(history);
|
||||
@ -878,7 +882,7 @@ x_goto_hist(c)
|
||||
|
||||
static void
|
||||
x_load_hist(hp)
|
||||
register char **hp;
|
||||
char **hp;
|
||||
{
|
||||
int oldsize;
|
||||
|
||||
@ -918,12 +922,11 @@ x_eot_del(c)
|
||||
|
||||
/* reverse incremental history search */
|
||||
static int
|
||||
x_search_hist(c)
|
||||
int c;
|
||||
x_search_hist(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
int offset = -1; /* offset of match in xbuf, else -1 */
|
||||
char pat [256+1]; /* pattern buffer */
|
||||
register char *p = pat;
|
||||
char *p = pat;
|
||||
Findex f;
|
||||
|
||||
*p = '\0';
|
||||
@ -986,7 +989,7 @@ x_search(pat, sameline, offset)
|
||||
int sameline;
|
||||
int offset;
|
||||
{
|
||||
register char **hp;
|
||||
char **hp;
|
||||
int i;
|
||||
|
||||
for (hp = x_histp - (sameline ? 0 : 1) ; hp >= history; --hp) {
|
||||
@ -1018,8 +1021,7 @@ x_match(str, pat)
|
||||
}
|
||||
|
||||
static int
|
||||
x_del_line(c)
|
||||
int c;
|
||||
x_del_line(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
int i, j;
|
||||
|
||||
@ -1037,24 +1039,21 @@ x_del_line(c)
|
||||
}
|
||||
|
||||
static int
|
||||
x_mv_end(c)
|
||||
int c;
|
||||
x_mv_end(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
x_goto(xep);
|
||||
return KSTD;
|
||||
}
|
||||
|
||||
static int
|
||||
x_mv_begin(c)
|
||||
int c;
|
||||
x_mv_begin(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
x_goto(xbuf);
|
||||
return KSTD;
|
||||
}
|
||||
|
||||
static int
|
||||
x_draw_line(c)
|
||||
int c;
|
||||
x_draw_line(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
x_redraw(-1);
|
||||
return KSTD;
|
||||
@ -1122,8 +1121,7 @@ x_redraw(limit)
|
||||
}
|
||||
|
||||
static int
|
||||
x_transpose(c)
|
||||
int c;
|
||||
x_transpose(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
char tmp;
|
||||
|
||||
@ -1175,24 +1173,21 @@ x_transpose(c)
|
||||
}
|
||||
|
||||
static int
|
||||
x_literal(c)
|
||||
int c;
|
||||
x_literal(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
x_curprefix = -1;
|
||||
return KSTD;
|
||||
}
|
||||
|
||||
static int
|
||||
x_meta1(c)
|
||||
int c;
|
||||
x_meta1(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
x_curprefix = 1;
|
||||
return KSTD;
|
||||
}
|
||||
|
||||
static int
|
||||
x_meta2(c)
|
||||
int c;
|
||||
x_meta2(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
x_curprefix = 2;
|
||||
return KSTD;
|
||||
@ -1200,8 +1195,7 @@ x_meta2(c)
|
||||
|
||||
#ifdef OS2
|
||||
static int
|
||||
x_meta3(c)
|
||||
int c;
|
||||
x_meta3(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
x_curprefix = 3;
|
||||
return KSTD;
|
||||
@ -1209,8 +1203,7 @@ x_meta3(c)
|
||||
#endif /* OS2 */
|
||||
|
||||
static int
|
||||
x_kill(c)
|
||||
int c;
|
||||
x_kill(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
int col = xcp - xbuf;
|
||||
int lastcol = xep - xbuf;
|
||||
@ -1241,8 +1234,7 @@ x_push(nchars)
|
||||
}
|
||||
|
||||
static int
|
||||
x_yank(c)
|
||||
int c;
|
||||
x_yank(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
if (killsp == 0)
|
||||
killtp = KILLSIZE;
|
||||
@ -1260,8 +1252,7 @@ x_yank(c)
|
||||
}
|
||||
|
||||
static int
|
||||
x_meta_yank(c)
|
||||
int c;
|
||||
x_meta_yank(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
int len;
|
||||
if ((x_last_command != XFUNC_yank && x_last_command != XFUNC_meta_yank)
|
||||
@ -1285,8 +1276,7 @@ x_meta_yank(c)
|
||||
}
|
||||
|
||||
static int
|
||||
x_abort(c)
|
||||
int c;
|
||||
x_abort(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
/* x_zotc(c); */
|
||||
xlp = xep = xcp = xbp = xbuf;
|
||||
@ -1296,16 +1286,14 @@ x_abort(c)
|
||||
}
|
||||
|
||||
static int
|
||||
x_error(c)
|
||||
int c;
|
||||
x_error(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
x_e_putc(BEL);
|
||||
return KSTD;
|
||||
}
|
||||
|
||||
static int
|
||||
x_stuffreset(c)
|
||||
int c;
|
||||
x_stuffreset(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
#ifdef TIOCSTI
|
||||
(void)x_stuff(c);
|
||||
@ -1321,8 +1309,7 @@ x_stuffreset(c)
|
||||
}
|
||||
|
||||
static int
|
||||
x_stuff(c)
|
||||
int c;
|
||||
x_stuff(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
#if 0 || defined TIOCSTI
|
||||
char ch = c;
|
||||
@ -1367,11 +1354,10 @@ x_mapin(cp)
|
||||
}
|
||||
|
||||
static char *
|
||||
x_mapout(c)
|
||||
int c;
|
||||
x_mapout(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
static char buf[8];
|
||||
register char *p = buf;
|
||||
char *p = buf;
|
||||
|
||||
#ifdef OS2
|
||||
if (c == 0xE0) {
|
||||
@ -1507,7 +1493,8 @@ x_bind(a1, a2, macro, list)
|
||||
void
|
||||
x_init_emacs()
|
||||
{
|
||||
register int i, j;
|
||||
unsigned i;
|
||||
int j;
|
||||
char *locale;
|
||||
|
||||
ainit(AEDIT);
|
||||
@ -1571,16 +1558,14 @@ x_emacs_keys(ec)
|
||||
}
|
||||
|
||||
static int
|
||||
x_set_mark(c)
|
||||
int c;
|
||||
x_set_mark(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
xmp = xcp;
|
||||
return KSTD;
|
||||
}
|
||||
|
||||
static int
|
||||
x_kill_region(c)
|
||||
int c;
|
||||
x_kill_region(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
int rsize;
|
||||
char *xr;
|
||||
@ -1603,8 +1588,7 @@ x_kill_region(c)
|
||||
}
|
||||
|
||||
static int
|
||||
x_xchg_point_mark(c)
|
||||
int c;
|
||||
x_xchg_point_mark(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
char *tmp;
|
||||
|
||||
@ -1619,8 +1603,7 @@ x_xchg_point_mark(c)
|
||||
}
|
||||
|
||||
static int
|
||||
x_version(c)
|
||||
int c;
|
||||
x_version(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
char *o_xbuf = xbuf, *o_xend = xend;
|
||||
char *o_xbp = xbp, *o_xep = xep, *o_xcp = xcp;
|
||||
@ -1649,19 +1632,17 @@ x_version(c)
|
||||
}
|
||||
|
||||
static int
|
||||
x_noop(c)
|
||||
int c;
|
||||
x_noop(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
return KSTD;
|
||||
}
|
||||
|
||||
#ifdef SILLY
|
||||
static int
|
||||
x_game_of_life(c)
|
||||
int c;
|
||||
x_game_of_life(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
char newbuf [256+1];
|
||||
register char *ip, *op;
|
||||
char *ip, *op;
|
||||
int i, len;
|
||||
|
||||
i = xep - xbuf;
|
||||
@ -1714,57 +1695,49 @@ x_game_of_life(c)
|
||||
|
||||
|
||||
static int
|
||||
x_comp_comm(c)
|
||||
int c;
|
||||
x_comp_comm(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
do_complete(XCF_COMMAND, CT_COMPLETE);
|
||||
return KSTD;
|
||||
}
|
||||
static int
|
||||
x_list_comm(c)
|
||||
int c;
|
||||
x_list_comm(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
do_complete(XCF_COMMAND, CT_LIST);
|
||||
return KSTD;
|
||||
}
|
||||
static int
|
||||
x_complete(c)
|
||||
int c;
|
||||
x_complete(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
do_complete(XCF_COMMAND_FILE, CT_COMPLETE);
|
||||
return KSTD;
|
||||
}
|
||||
static int
|
||||
x_enumerate(c)
|
||||
int c;
|
||||
x_enumerate(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
do_complete(XCF_COMMAND_FILE, CT_LIST);
|
||||
return KSTD;
|
||||
}
|
||||
static int
|
||||
x_comp_file(c)
|
||||
int c;
|
||||
x_comp_file(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
do_complete(XCF_FILE, CT_COMPLETE);
|
||||
return KSTD;
|
||||
}
|
||||
static int
|
||||
x_list_file(c)
|
||||
int c;
|
||||
x_list_file(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
do_complete(XCF_FILE, CT_LIST);
|
||||
return KSTD;
|
||||
}
|
||||
static int
|
||||
x_comp_list(c)
|
||||
int c;
|
||||
x_comp_list(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
do_complete(XCF_COMMAND_FILE, CT_COMPLIST);
|
||||
return KSTD;
|
||||
}
|
||||
static int
|
||||
x_expand(c)
|
||||
int c;
|
||||
x_expand(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
char **words;
|
||||
int nwords = 0;
|
||||
@ -1881,8 +1854,7 @@ x_adjust()
|
||||
static int unget_char = -1;
|
||||
|
||||
static void
|
||||
x_e_ungetc(c)
|
||||
int c;
|
||||
x_e_ungetc(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
unget_char = c;
|
||||
}
|
||||
@ -1908,8 +1880,7 @@ x_e_getc()
|
||||
}
|
||||
|
||||
static void
|
||||
x_e_putc(c)
|
||||
int c;
|
||||
x_e_putc(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
if (c == '\r' || c == '\n')
|
||||
x_col = 0;
|
||||
@ -1939,8 +1910,7 @@ x_e_putc(c)
|
||||
|
||||
#ifdef DEBUG
|
||||
static int
|
||||
x_debug_info(c)
|
||||
int c;
|
||||
x_debug_info(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
x_flush();
|
||||
shellf("\nksh debug:\n");
|
||||
@ -1960,7 +1930,7 @@ static void
|
||||
x_e_puts(s)
|
||||
const char *s;
|
||||
{
|
||||
register int adj = x_adj_done;
|
||||
int adj = x_adj_done;
|
||||
|
||||
while (*s && adj == x_adj_done)
|
||||
x_e_putc(*s++);
|
||||
@ -1977,8 +1947,7 @@ x_e_puts(s)
|
||||
*/
|
||||
|
||||
static int
|
||||
x_set_arg(c)
|
||||
int c;
|
||||
x_set_arg(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
int n = 0;
|
||||
int first = 1;
|
||||
@ -2001,8 +1970,7 @@ x_set_arg(c)
|
||||
|
||||
/* Comment or uncomment the current line. */
|
||||
static int
|
||||
x_comment(c)
|
||||
int c;
|
||||
x_comment(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
int oldsize = x_size_str(xbuf);
|
||||
int len = xep - xbuf;
|
||||
@ -2038,10 +2006,9 @@ x_comment(c)
|
||||
*/
|
||||
|
||||
static int
|
||||
x_prev_histword(c)
|
||||
int c;
|
||||
x_prev_histword(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
register char *rcp;
|
||||
char *rcp;
|
||||
char *cp;
|
||||
|
||||
cp = *histptr;
|
||||
@ -2088,24 +2055,21 @@ x_prev_histword(c)
|
||||
|
||||
/* Uppercase N(1) words */
|
||||
static int
|
||||
x_fold_upper(c)
|
||||
int c;
|
||||
x_fold_upper(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
return x_fold_case('U');
|
||||
}
|
||||
|
||||
/* Lowercase N(1) words */
|
||||
static int
|
||||
x_fold_lower(c)
|
||||
int c;
|
||||
x_fold_lower(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
return x_fold_case('L');
|
||||
}
|
||||
|
||||
/* Lowercase N(1) words */
|
||||
static int
|
||||
x_fold_capitalize(c)
|
||||
int c;
|
||||
x_fold_capitalize(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
return x_fold_case('C');
|
||||
}
|
||||
@ -2122,8 +2086,7 @@ x_fold_capitalize(c)
|
||||
*/
|
||||
|
||||
static int
|
||||
x_fold_case(c)
|
||||
int c;
|
||||
x_fold_case(int c GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
char *cp = xcp;
|
||||
|
||||
@ -2192,8 +2155,8 @@ x_fold_case(c)
|
||||
static char *
|
||||
x_lastcp()
|
||||
{
|
||||
register char *rcp;
|
||||
register int i;
|
||||
char *rcp;
|
||||
int i;
|
||||
|
||||
if (!xlp_valid)
|
||||
{
|
||||
|
46
eval.c
46
eval.c
@ -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)) {
|
||||
|
28
exec.c
28
exec.c
@ -1,4 +1,4 @@
|
||||
/** $MirBSD: exec.c,v 1.3 2004/09/21 11:57:08 tg Exp $ */
|
||||
/** $MirBSD: exec.c,v 1.4 2004/10/28 11:03:23 tg Exp $ */
|
||||
/* $OpenBSD: exec.c,v 1.31 2003/12/15 05:25:52 otto Exp $ */
|
||||
|
||||
/*
|
||||
@ -449,13 +449,13 @@ static int
|
||||
comexec(t, tp, ap, flags)
|
||||
struct op *t;
|
||||
struct tbl *volatile tp;
|
||||
register char **ap;
|
||||
char **ap;
|
||||
int volatile flags;
|
||||
{
|
||||
int i;
|
||||
volatile int rv = 0;
|
||||
register char *cp;
|
||||
register char **lastp;
|
||||
char *cp;
|
||||
char **lastp;
|
||||
static struct op texec; /* Must be static (XXX but why?) */
|
||||
int type_flags;
|
||||
int keepasn_ok;
|
||||
@ -753,8 +753,8 @@ comexec(t, tp, ap, flags)
|
||||
|
||||
static void
|
||||
scriptexec(tp, ap)
|
||||
register struct op *tp;
|
||||
register char **ap;
|
||||
struct op *tp;
|
||||
char **ap;
|
||||
{
|
||||
char *shell;
|
||||
|
||||
@ -768,8 +768,8 @@ scriptexec(tp, ap)
|
||||
#ifdef SHARPBANG
|
||||
{
|
||||
char buf[LINE];
|
||||
register char *cp;
|
||||
register int fd, n;
|
||||
char *cp;
|
||||
int fd, n;
|
||||
|
||||
buf[0] = '\0';
|
||||
if ((fd = open(tp->str, O_RDONLY)) >= 0) {
|
||||
@ -867,9 +867,9 @@ scriptexec(tp, ap)
|
||||
|
||||
int
|
||||
shcomexec(wp)
|
||||
register char **wp;
|
||||
char **wp;
|
||||
{
|
||||
register struct tbl *tp;
|
||||
struct tbl *tp;
|
||||
|
||||
tp = tsearch(&builtins, *wp, hash(*wp));
|
||||
if (tp == NULL)
|
||||
@ -959,7 +959,7 @@ builtin(name, func)
|
||||
const char *name;
|
||||
int (*func) ARGS((char **));
|
||||
{
|
||||
register struct tbl *tp;
|
||||
struct tbl *tp;
|
||||
Tflag flag;
|
||||
|
||||
/* see if any flags should be set for this builtin */
|
||||
@ -1293,10 +1293,10 @@ call_builtin(tp, wp)
|
||||
*/
|
||||
static int
|
||||
iosetup(iop, tp)
|
||||
register struct ioword *iop;
|
||||
struct ioword *iop;
|
||||
struct tbl *tp;
|
||||
{
|
||||
register int u = -1;
|
||||
int u = -1;
|
||||
char *cp = iop->name;
|
||||
int iotype = iop->flag & IOTYPE;
|
||||
int do_open = 1, do_close = 0, UNINITIALIZED(flags);
|
||||
@ -1508,7 +1508,7 @@ herein(content, sub)
|
||||
*/
|
||||
static char *
|
||||
do_selectargs(ap, print_menu)
|
||||
register char **ap;
|
||||
char **ap;
|
||||
bool_t print_menu;
|
||||
{
|
||||
static const char *const read_args[] = {
|
||||
|
6
expand.h
6
expand.h
@ -1,4 +1,4 @@
|
||||
/** $MirBSD: expand.h,v 1.3 2004/09/21 11:57:09 tg Exp $ */
|
||||
/** $MirBSD: expand.h,v 1.4 2004/10/28 11:03:23 tg Exp $ */
|
||||
/* $OpenBSD: expand.h,v 1.3 2001/03/26 16:19:45 todd Exp $ */
|
||||
|
||||
/*
|
||||
@ -70,7 +70,7 @@ typedef char * XStringP;
|
||||
#define Xsavepos(xs, xp) ((xp) - (xs).beg)
|
||||
#define Xrestpos(xs, xp, n) ((xs).beg + (n))
|
||||
|
||||
char * Xcheck_grow_ ARGS((XString *xsp, char *xp, int more));
|
||||
char * Xcheck_grow_ ARGS((XString *xsp, char *xp, size_t more));
|
||||
|
||||
/*
|
||||
* expandable vector of generic pointers
|
||||
@ -82,7 +82,7 @@ typedef struct XPtrV {
|
||||
} XPtrV;
|
||||
|
||||
#define XPinit(x, n) do { \
|
||||
register void **vp__; \
|
||||
void **vp__; \
|
||||
vp__ = (void**) alloc(sizeofN(void*, n), ATEMP); \
|
||||
(x).cur = (x).beg = vp__; \
|
||||
(x).end = vp__ + n; \
|
||||
|
4
expr.c
4
expr.c
@ -1,4 +1,4 @@
|
||||
/** $MirBSD: expr.c,v 1.4 2004/09/21 11:57:09 tg Exp $ */
|
||||
/** $MirBSD: expr.c,v 1.5 2004/10/28 11:03:23 tg Exp $ */
|
||||
/* $OpenBSD: expr.c,v 1.9 2003/10/22 07:40:38 jmc Exp $ */
|
||||
|
||||
/*
|
||||
@ -567,7 +567,7 @@ assign_check(es, op, vasn)
|
||||
static struct tbl *
|
||||
tempvar()
|
||||
{
|
||||
register struct tbl *vp;
|
||||
struct tbl *vp;
|
||||
|
||||
vp = (struct tbl*) alloc(sizeof(struct tbl), ATEMP);
|
||||
vp->flag = ISSET|INTEGER;
|
||||
|
24
history.c
24
history.c
@ -1,4 +1,4 @@
|
||||
/** $MirBSD: history.c,v 1.11 2004/09/21 11:57:09 tg Exp $ */
|
||||
/** $MirBSD: history.c,v 1.12 2004/10/28 11:03:23 tg Exp $ */
|
||||
/* $OpenBSD: history.c,v 1.24 2004/08/03 12:44:59 danh Exp $ */
|
||||
|
||||
/*
|
||||
@ -617,7 +617,7 @@ histsave(lno, cmd, dowrite)
|
||||
const char *cmd;
|
||||
int dowrite; /* ignored (compatibility with COMPLEX_HISTORY) */
|
||||
{
|
||||
register char **hp = histptr;
|
||||
char **hp = histptr;
|
||||
char *cp;
|
||||
|
||||
if (++hp >= history + histsize) { /* remove oldest command */
|
||||
@ -737,8 +737,8 @@ hist_finish()
|
||||
{
|
||||
static int once;
|
||||
FILE *fh;
|
||||
register int i;
|
||||
register char **hp;
|
||||
int i;
|
||||
char **hp;
|
||||
|
||||
if (once++)
|
||||
return;
|
||||
@ -776,7 +776,7 @@ histsave(lno, cmd, dowrite)
|
||||
const char *cmd;
|
||||
int dowrite;
|
||||
{
|
||||
register char **hp;
|
||||
char **hp;
|
||||
char *c, *cp;
|
||||
|
||||
c = str_save(cmd, APERM);
|
||||
@ -901,8 +901,8 @@ typedef enum state {
|
||||
|
||||
static int
|
||||
hist_count_lines(base, bytes)
|
||||
register unsigned char *base;
|
||||
register int bytes;
|
||||
unsigned char *base;
|
||||
int bytes;
|
||||
{
|
||||
State state = shdr;
|
||||
int lines = 0;
|
||||
@ -994,8 +994,8 @@ hist_skip_back(base, bytes, no)
|
||||
int *bytes;
|
||||
int no;
|
||||
{
|
||||
register int lines = 0;
|
||||
register unsigned char *ep;
|
||||
int lines = 0;
|
||||
unsigned char *ep;
|
||||
|
||||
for (ep = base + *bytes; --ep > base; ) {
|
||||
/* this doesn't really work: the 4 byte line number that is
|
||||
@ -1020,8 +1020,8 @@ hist_skip_back(base, bytes, no)
|
||||
static void
|
||||
histload(s, base, bytes)
|
||||
Source *s;
|
||||
register unsigned char *base;
|
||||
register int bytes;
|
||||
unsigned char *base;
|
||||
int bytes;
|
||||
{
|
||||
State state;
|
||||
int lno = 0;
|
||||
@ -1076,7 +1076,7 @@ histinsert(s, lno, line)
|
||||
int lno;
|
||||
unsigned char *line;
|
||||
{
|
||||
register char **hp;
|
||||
char **hp;
|
||||
|
||||
if (lno >= s->line-(histptr-history) && lno <= s->line) {
|
||||
hp = &histptr[lno-s->line];
|
||||
|
6
io.c
6
io.c
@ -1,4 +1,4 @@
|
||||
/** $MirBSD: io.c,v 1.5 2004/09/21 11:57:09 tg Exp $ */
|
||||
/** $MirBSD: io.c,v 1.6 2004/10/28 11:03:23 tg Exp $ */
|
||||
/* $OpenBSD: io.c,v 1.13 2003/11/10 21:26:39 millert Exp $ */
|
||||
|
||||
/*
|
||||
@ -330,7 +330,7 @@ restfd(fd, ofd)
|
||||
|
||||
void
|
||||
openpipe(pv)
|
||||
register int *pv;
|
||||
int *pv;
|
||||
{
|
||||
if (pipe(pv) < 0)
|
||||
errorf("can't create pipe - try again");
|
||||
@ -340,7 +340,7 @@ openpipe(pv)
|
||||
|
||||
void
|
||||
closepipe(pv)
|
||||
register int *pv;
|
||||
int *pv;
|
||||
{
|
||||
close(pv[0]);
|
||||
close(pv[1]);
|
||||
|
7
jobs.c
7
jobs.c
@ -1,4 +1,4 @@
|
||||
/** $MirBSD: jobs.c,v 1.5 2004/09/21 11:57:10 tg Exp $ */
|
||||
/** $MirBSD: jobs.c,v 1.6 2004/10/28 11:03:23 tg Exp $ */
|
||||
/* $OpenBSD: jobs.c,v 1.21 2003/11/10 21:26:39 millert Exp $ */
|
||||
|
||||
/*
|
||||
@ -31,6 +31,8 @@
|
||||
#include "ksh_times.h"
|
||||
#include "tty.h"
|
||||
|
||||
__RCSID("$MirBSD: jobs.c,v 1.6 2004/10/28 11:03:23 tg Exp $");
|
||||
|
||||
/* Start of system configuration stuff */
|
||||
|
||||
/* We keep CHILD_MAX zombie processes around (exact value isn't critical) */
|
||||
@ -1309,8 +1311,7 @@ j_waitj(j, flags, where)
|
||||
* If jobs are compiled in then this routine expects sigchld to be blocked.
|
||||
*/
|
||||
static RETSIGTYPE
|
||||
j_sigchld(sig)
|
||||
int sig;
|
||||
j_sigchld(int sig GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
int errno_ = errno;
|
||||
Job *j;
|
||||
|
18
lex.c
18
lex.c
@ -1,4 +1,4 @@
|
||||
/** $MirBSD: lex.c,v 1.4 2004/09/21 11:57:12 tg Exp $ */
|
||||
/** $MirBSD: lex.c,v 1.5 2004/10/28 11:03:23 tg Exp $ */
|
||||
/* $OpenBSD: lex.c,v 1.18 2003/08/06 21:08:05 millert Exp $ */
|
||||
|
||||
/*
|
||||
@ -103,9 +103,9 @@ yylex(cf)
|
||||
{
|
||||
Lex_state states[STATE_BSIZE], *statep;
|
||||
State_info state_info;
|
||||
register int c, state;
|
||||
int c, state;
|
||||
XString ws; /* expandable output word */
|
||||
register char *wp; /* output word pointer */
|
||||
char *wp; /* output word pointer */
|
||||
char *sp, *dp;
|
||||
int c2;
|
||||
|
||||
@ -750,7 +750,7 @@ Done:
|
||||
if ((cf & ALIAS) && (p = tsearch(&aliases, ident, h))
|
||||
&& (p->flag & ISSET))
|
||||
{
|
||||
register Source *s;
|
||||
Source *s;
|
||||
|
||||
for (s = source; s->type == SALIAS; s = s->next)
|
||||
if (s->u.tblp == p)
|
||||
@ -772,7 +772,7 @@ Done:
|
||||
static void
|
||||
gethere()
|
||||
{
|
||||
register struct ioword **p;
|
||||
struct ioword **p;
|
||||
|
||||
for (p = heres; p < herep; p++)
|
||||
readhere(*p);
|
||||
@ -787,7 +787,7 @@ static void
|
||||
readhere(iop)
|
||||
struct ioword *iop;
|
||||
{
|
||||
register int c;
|
||||
int c;
|
||||
char *volatile eof;
|
||||
char *eofp;
|
||||
int skiptabs;
|
||||
@ -874,7 +874,7 @@ pushs(type, areap)
|
||||
int type;
|
||||
Area *areap;
|
||||
{
|
||||
register Source *s;
|
||||
Source *s;
|
||||
|
||||
s = (Source *) alloc(sizeof(Source), areap);
|
||||
s->type = type;
|
||||
@ -897,8 +897,8 @@ pushs(type, areap)
|
||||
static int
|
||||
getsc__()
|
||||
{
|
||||
register Source *s = source;
|
||||
register int c;
|
||||
Source *s = source;
|
||||
int c;
|
||||
|
||||
while ((c = *s->str++) == 0) {
|
||||
s->str = NULL; /* return 0 for EOF by default */
|
||||
|
18
mail.c
18
mail.c
@ -1,4 +1,4 @@
|
||||
/** $MirBSD: mail.c,v 1.3 2004/09/21 11:57:13 tg Exp $ */
|
||||
/** $MirBSD: mail.c,v 1.4 2004/10/28 11:03:23 tg Exp $ */
|
||||
/* $OpenBSD: mail.c,v 1.9 1999/06/15 01:18:35 millert Exp $ */
|
||||
|
||||
/*
|
||||
@ -40,7 +40,7 @@ static void mprintit ARGS((mbox_t *mbp));
|
||||
void
|
||||
mcheck()
|
||||
{
|
||||
register mbox_t *mbp;
|
||||
mbox_t *mbp;
|
||||
time_t now;
|
||||
struct tbl *vp;
|
||||
struct stat stbuf;
|
||||
@ -90,7 +90,7 @@ mcset(interval)
|
||||
|
||||
void
|
||||
mbset(p)
|
||||
register char *p;
|
||||
char *p;
|
||||
{
|
||||
struct stat stbuf;
|
||||
|
||||
@ -109,10 +109,10 @@ mbset(p)
|
||||
|
||||
void
|
||||
mpset(mptoparse)
|
||||
register char *mptoparse;
|
||||
char *mptoparse;
|
||||
{
|
||||
register mbox_t *mbp;
|
||||
register char *mpath, *mmsg, *mval;
|
||||
mbox_t *mbp;
|
||||
char *mpath, *mmsg, *mval;
|
||||
char *p;
|
||||
|
||||
munset( mplist );
|
||||
@ -149,9 +149,9 @@ mpset(mptoparse)
|
||||
|
||||
static void
|
||||
munset(mlist)
|
||||
register mbox_t *mlist;
|
||||
mbox_t *mlist;
|
||||
{
|
||||
register mbox_t *mbp;
|
||||
mbox_t *mbp;
|
||||
|
||||
while (mlist != NULL) {
|
||||
mbp = mlist;
|
||||
@ -168,7 +168,7 @@ mballoc(p, m)
|
||||
char *m;
|
||||
{
|
||||
struct stat stbuf;
|
||||
register mbox_t *mbp;
|
||||
mbox_t *mbp;
|
||||
|
||||
mbp = (mbox_t *)alloc(sizeof(mbox_t), APERM);
|
||||
mbp->mb_next = NULL;
|
||||
|
20
main.c
20
main.c
@ -1,4 +1,4 @@
|
||||
/** $MirBSD: main.c,v 1.9 2004/08/27 14:08:35 tg Stab $ */
|
||||
/** $MirBSD: main.c,v 1.10 2004/10/28 11:03:23 tg Exp $ */
|
||||
/* $OpenBSD: main.c,v 1.28 2004/08/23 14:56:32 millert Exp $ */
|
||||
|
||||
/*
|
||||
@ -11,6 +11,8 @@
|
||||
#include "ksh_stat.h"
|
||||
#include "ksh_time.h"
|
||||
|
||||
__RCSID("$MirBSD: main.c,v 1.10 2004/10/28 11:03:23 tg Exp $");
|
||||
|
||||
extern char **environ;
|
||||
|
||||
/*
|
||||
@ -86,7 +88,7 @@ static const char *const initcoms [] = {
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
register int i;
|
||||
int i;
|
||||
int argi;
|
||||
Source *s;
|
||||
struct block *l;
|
||||
@ -458,7 +460,7 @@ include(name, argc, argv, intr_ok)
|
||||
char **argv;
|
||||
int intr_ok;
|
||||
{
|
||||
register Source *volatile s = NULL;
|
||||
Source *volatile s = NULL;
|
||||
struct shf *shf;
|
||||
char **volatile old_argv;
|
||||
volatile int old_argc;
|
||||
@ -527,7 +529,7 @@ int
|
||||
command(comm)
|
||||
const char *comm;
|
||||
{
|
||||
register Source *s;
|
||||
Source *s;
|
||||
|
||||
s = pushs(SSTRING, ATEMP);
|
||||
s->start = s->str = comm;
|
||||
@ -687,7 +689,7 @@ void
|
||||
newenv(type)
|
||||
int type;
|
||||
{
|
||||
register struct env *ep;
|
||||
struct env *ep;
|
||||
|
||||
ep = (struct env *) alloc(sizeof(*ep), ATEMP);
|
||||
ep->type = type;
|
||||
@ -703,8 +705,8 @@ newenv(type)
|
||||
void
|
||||
quitenv()
|
||||
{
|
||||
register struct env *ep = e;
|
||||
register int fd;
|
||||
struct env *ep = e;
|
||||
int fd;
|
||||
|
||||
if (ep->oenv && ep->oenv->loc != ep->loc)
|
||||
popblock();
|
||||
@ -856,9 +858,7 @@ is_restricted(name)
|
||||
}
|
||||
|
||||
void
|
||||
aerror(ap, msg)
|
||||
Area *ap;
|
||||
const char *msg;
|
||||
aerror(Area *ap GCC_FUNC_ATTR(unused), const char *msg)
|
||||
{
|
||||
internal_errorf(1, "alloc: %s", msg);
|
||||
errorf(null); /* this is never executed - keeps gcc quiet */
|
||||
|
69
misc.c
69
misc.c
@ -1,4 +1,4 @@
|
||||
/** $MirBSD: misc.c,v 1.9 2004/09/21 11:57:13 tg Exp $ */
|
||||
/** $MirBSD: misc.c,v 1.10 2004/10/28 11:03:23 tg Exp $ */
|
||||
/* $OpenBSD: misc.c,v 1.20 2003/10/22 07:40:38 jmc Exp $ */
|
||||
|
||||
/*
|
||||
@ -11,6 +11,8 @@
|
||||
# include <limits.h>
|
||||
#endif
|
||||
|
||||
__RCSID("$MirBSD: misc.c,v 1.10 2004/10/28 11:03:23 tg Exp $");
|
||||
|
||||
#ifndef UCHAR_MAX
|
||||
# define UCHAR_MAX 0xFF
|
||||
#endif
|
||||
@ -27,10 +29,10 @@ static const unsigned char *cclass ARGS((const unsigned char *p, int sub));
|
||||
*/
|
||||
void
|
||||
setctypes(s, t)
|
||||
register const char *s;
|
||||
register int t;
|
||||
const char *s;
|
||||
int t;
|
||||
{
|
||||
register int i;
|
||||
unsigned i;
|
||||
|
||||
if (t & C_IFS) {
|
||||
for (i = 0; i < UCHAR_MAX+1; i++)
|
||||
@ -44,7 +46,7 @@ setctypes(s, t)
|
||||
void
|
||||
initctypes()
|
||||
{
|
||||
register int c;
|
||||
int c;
|
||||
|
||||
for (c = 'a'; c <= 'z'; c++)
|
||||
ctypes[c] |= C_ALPHA;
|
||||
@ -64,10 +66,10 @@ initctypes()
|
||||
|
||||
char *
|
||||
ulton(n, base)
|
||||
register unsigned long n;
|
||||
unsigned long n;
|
||||
int base;
|
||||
{
|
||||
register char *p;
|
||||
char *p;
|
||||
static char buf [20];
|
||||
|
||||
p = &buf[sizeof(buf)];
|
||||
@ -81,7 +83,7 @@ ulton(n, base)
|
||||
|
||||
char *
|
||||
str_save(s, ap)
|
||||
register const char *s;
|
||||
const char *s;
|
||||
Area *ap;
|
||||
{
|
||||
size_t len;
|
||||
@ -101,7 +103,7 @@ str_save(s, ap)
|
||||
*/
|
||||
char *
|
||||
str_nsave(s, n, ap)
|
||||
register const char *s;
|
||||
const char *s;
|
||||
int n;
|
||||
Area *ap;
|
||||
{
|
||||
@ -119,7 +121,7 @@ char *
|
||||
Xcheck_grow_(xsp, xp, more)
|
||||
XString *xsp;
|
||||
char *xp;
|
||||
int more;
|
||||
size_t more;
|
||||
{
|
||||
char *old_beg = xsp->beg;
|
||||
|
||||
@ -196,7 +198,7 @@ int
|
||||
option(n)
|
||||
const char *n;
|
||||
{
|
||||
int i;
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < NELEM(options); i++)
|
||||
if (options[i].name && strcmp(options[i].name, n) == 0)
|
||||
@ -236,7 +238,7 @@ static void
|
||||
printoptions(verbose)
|
||||
int verbose;
|
||||
{
|
||||
int i;
|
||||
unsigned i;
|
||||
|
||||
if (verbose) {
|
||||
struct options_info oi;
|
||||
@ -268,9 +270,9 @@ printoptions(verbose)
|
||||
char *
|
||||
getoptions()
|
||||
{
|
||||
int i;
|
||||
unsigned i;
|
||||
char m[(int) FNFLAGS + 1];
|
||||
register char *cp = m;
|
||||
char *cp = m;
|
||||
|
||||
for (i = 0; i < NELEM(options); i++)
|
||||
if (options[i].c && Flag(i))
|
||||
@ -355,6 +357,7 @@ parse_args(argv, what, setargsp)
|
||||
char *array = (char *) 0;
|
||||
Getopt go;
|
||||
int i, optc, set, sortargs = 0, arrayset = 0;
|
||||
unsigned u;
|
||||
|
||||
/* First call? Build option strings... */
|
||||
if (cmd_opts[0] == '\0') {
|
||||
@ -366,12 +369,12 @@ parse_args(argv, what, setargsp)
|
||||
/* see set_opts[] declaration */
|
||||
strlcpy(set_opts, "A:o;s", sizeof set_opts);
|
||||
q = set_opts + strlen(set_opts);
|
||||
for (i = 0; i < NELEM(options); i++) {
|
||||
if (options[i].c) {
|
||||
if (options[i].flags & OF_CMDLINE)
|
||||
*p++ = options[i].c;
|
||||
if (options[i].flags & OF_SET)
|
||||
*q++ = options[i].c;
|
||||
for (u = 0; u < NELEM(options); u++) {
|
||||
if (options[u].c) {
|
||||
if (options[u].flags & OF_CMDLINE)
|
||||
*p++ = options[u].c;
|
||||
if (options[u].flags & OF_SET)
|
||||
*q++ = options[u].c;
|
||||
}
|
||||
}
|
||||
*p = '\0';
|
||||
@ -434,15 +437,15 @@ parse_args(argv, what, setargsp)
|
||||
sortargs = 1;
|
||||
break;
|
||||
}
|
||||
for (i = 0; i < NELEM(options); i++)
|
||||
if (optc == options[i].c
|
||||
&& (what & options[i].flags))
|
||||
for (u = 0; u < NELEM(options); u++)
|
||||
if (optc == options[u].c
|
||||
&& (what & options[u].flags))
|
||||
{
|
||||
change_flag((enum sh_flag) i, what,
|
||||
change_flag((enum sh_flag) u, what,
|
||||
set);
|
||||
break;
|
||||
}
|
||||
if (i == NELEM(options)) {
|
||||
if (u == NELEM(options)) {
|
||||
internal_errorf(1, "parse_args: '%c'", optc);
|
||||
return -1; /* not reached */
|
||||
}
|
||||
@ -538,7 +541,7 @@ gmatch(s, p, isfile)
|
||||
* the pattern. If check fails, just to a strcmp().
|
||||
*/
|
||||
if (!isfile && !has_globbing(p, pe)) {
|
||||
int len = pe - p + 1;
|
||||
size_t len = pe - p + 1;
|
||||
char tbuf[64];
|
||||
char *t = len <= sizeof(tbuf) ? tbuf
|
||||
: (char *) alloc(len, ATEMP);
|
||||
@ -627,7 +630,7 @@ do_gmatch(s, se, p, pe, isfile)
|
||||
const unsigned char *se, *pe;
|
||||
int isfile;
|
||||
{
|
||||
register int sc, pc;
|
||||
int sc, pc;
|
||||
const unsigned char *prest, *psub, *pnext;
|
||||
const unsigned char *srest;
|
||||
|
||||
@ -759,9 +762,9 @@ do_gmatch(s, se, p, pe, isfile)
|
||||
static const unsigned char *
|
||||
cclass(p, sub)
|
||||
const unsigned char *p;
|
||||
register int sub;
|
||||
int sub;
|
||||
{
|
||||
register int c, d, not, found = 0;
|
||||
int c, d, not, found = 0;
|
||||
const unsigned char *orig_p = p;
|
||||
|
||||
if ((not = (ISMAGIC(*p) && *++p == NOT)))
|
||||
@ -841,10 +844,10 @@ qsortp(base, n, f)
|
||||
}
|
||||
|
||||
#define swap2(a, b) {\
|
||||
register void *t; t = *(a); *(a) = *(b); *(b) = t;\
|
||||
void *t; t = *(a); *(a) = *(b); *(b) = t;\
|
||||
}
|
||||
#define swap3(a, b, c) {\
|
||||
register void *t; t = *(a); *(a) = *(c); *(c) = *(b); *(b) = t;\
|
||||
void *t; t = *(a); *(a) = *(c); *(c) = *(b); *(b) = t;\
|
||||
}
|
||||
|
||||
static void
|
||||
@ -852,8 +855,8 @@ qsort1(base, lim, f)
|
||||
void **base, **lim;
|
||||
int (*f) ARGS((void *, void *));
|
||||
{
|
||||
register void **i, **j;
|
||||
register void **lptr, **hptr;
|
||||
void **i, **j;
|
||||
void **lptr, **hptr;
|
||||
size_t n;
|
||||
int c;
|
||||
|
||||
|
10
path.c
10
path.c
@ -1,9 +1,11 @@
|
||||
/** $MirBSD: path.c,v 1.4 2004/09/21 14:03:58 tg Exp $ */
|
||||
/** $MirBSD: path.c,v 1.5 2004/10/28 11:03:24 tg Exp $ */
|
||||
/* $OpenBSD: path.c,v 1.9 2003/10/22 07:40:38 jmc Exp $ */
|
||||
|
||||
#include "sh.h"
|
||||
#include "ksh_stat.h"
|
||||
|
||||
__RCSID("$MirBSD: path.c,v 1.5 2004/10/28 11:03:24 tg Exp $");
|
||||
|
||||
/*
|
||||
* Contains a routine to search a : separated list of
|
||||
* paths (a la CDPATH) and make appropriate file names.
|
||||
@ -241,8 +243,8 @@ do_phys_path(xsp, xp, path)
|
||||
const char *path;
|
||||
{
|
||||
const char *p, *q;
|
||||
int len, llen;
|
||||
int savepos;
|
||||
size_t len;
|
||||
int savepos, llen;
|
||||
char lbuf[PATH_MAX];
|
||||
|
||||
Xcheck(*xsp, xp);
|
||||
@ -251,7 +253,7 @@ do_phys_path(xsp, xp, path)
|
||||
p++;
|
||||
if (!*p)
|
||||
break;
|
||||
len = (q = ksh_strchr_dirsep(p)) ? q - p : strlen(p);
|
||||
len = (q = ksh_strchr_dirsep(p)) ? (size_t)(q - p) : strlen(p);
|
||||
if (len == 1 && p[0] == '.')
|
||||
continue;
|
||||
if (len == 2 && p[0] == '.' && p[1] == '.') {
|
||||
|
4
proto.h
4
proto.h
@ -1,4 +1,4 @@
|
||||
/** $MirBSD: proto.h,v 1.5 2004/09/21 11:57:13 tg Exp $ */
|
||||
/** $MirBSD: proto.h,v 1.6 2004/10/28 11:03:24 tg Exp $ */
|
||||
/* $OpenBSD: proto.h,v 1.11 2003/05/16 19:58:57 jsyn Exp $ */
|
||||
/* $From: proto.h,v 1.3 1994/05/19 18:32:40 michael Exp michael $ */
|
||||
|
||||
@ -89,7 +89,7 @@ void hist_init ARGS((Source *s));
|
||||
void hist_finish ARGS((void));
|
||||
void histsave ARGS((int lno, const char *cmd, int dowrite));
|
||||
#ifdef HISTORY
|
||||
int c_fc ARGS((register char **wp));
|
||||
int c_fc ARGS((char **wp));
|
||||
void sethistsize ARGS((int n));
|
||||
void sethistfile ARGS((const char *name));
|
||||
# ifdef EASY_HISTORY
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
# $MirBSD: siglist.sh,v 1.2 2004/05/24 19:56:19 tg Stab $
|
||||
# $MirBSD: siglist.sh,v 1.3 2004/10/28 11:03:24 tg Exp $
|
||||
# $OpenBSD: siglist.sh,v 1.4 1997/06/19 13:58:47 kstailey Exp $
|
||||
#
|
||||
# Script to generate a sorted, complete list of signals, suitable
|
||||
@ -18,9 +18,9 @@ CPP="${1-cc -E}"
|
||||
# The trap here to make up for a bug in bash (1.14.3(1)) that calls the trap
|
||||
(trap $trapsigs;
|
||||
echo '#include "sh.h"';
|
||||
echo ' { QwErTy SIGNALS , "DUMMY" , "hook for number of signals" },';
|
||||
echo ' { QwErTy SIGNALS , "DUMMY" , "hook for number of signals", 0, 0, 0, 0, 0 },';
|
||||
sed -e '/^[ ]*#/d' -e 's/^[ ]*\([^ ][^ ]*\)[ ][ ]*\(.*[^ ]\)[ ]*$/#ifdef SIG\1\
|
||||
{ QwErTy SIG\1 , "\1", "\2" },\
|
||||
{ QwErTy SIG\1 , "\1", "\2", 0, 0, 0, 0, 0 },\
|
||||
#endif/') > $in
|
||||
$CPP $in > $out
|
||||
sed -n 's/{ QwErTy/{/p' < $out | awk '{print NR, $0}' | sort +2n +0n |
|
||||
|
65
syn.c
65
syn.c
@ -1,4 +1,4 @@
|
||||
/** $MirBSD: syn.c,v 1.4 2004/09/21 11:57:14 tg Exp $ */
|
||||
/** $MirBSD: syn.c,v 1.5 2004/10/28 11:03:24 tg Exp $ */
|
||||
/* $OpenBSD: syn.c,v 1.14 2003/10/22 07:40:38 jmc Exp $ */
|
||||
|
||||
/*
|
||||
@ -8,6 +8,8 @@
|
||||
#include "sh.h"
|
||||
#include "c_test.h"
|
||||
|
||||
__RCSID("$MirBSD: syn.c,v 1.5 2004/10/28 11:03:24 tg Exp $");
|
||||
|
||||
struct nesting_state {
|
||||
int start_token; /* token than began nesting (eg, FOR) */
|
||||
int start_line; /* line nesting began on */
|
||||
@ -79,7 +81,7 @@ static struct op *
|
||||
pipeline(cf)
|
||||
int cf;
|
||||
{
|
||||
register struct op *t, *p, *tl = NULL;
|
||||
struct op *t, *p, *tl = NULL;
|
||||
|
||||
t = get_command(cf);
|
||||
if (t != NULL) {
|
||||
@ -99,8 +101,8 @@ pipeline(cf)
|
||||
static struct op *
|
||||
andor()
|
||||
{
|
||||
register struct op *t, *p;
|
||||
register int c;
|
||||
struct op *t, *p;
|
||||
int c;
|
||||
|
||||
t = pipeline(0);
|
||||
if (t != NULL) {
|
||||
@ -118,8 +120,8 @@ static struct op *
|
||||
c_list(multi)
|
||||
int multi;
|
||||
{
|
||||
register struct op *t = NULL, *p, *tl = NULL;
|
||||
register int c;
|
||||
struct op *t = NULL, *p, *tl = NULL;
|
||||
int c;
|
||||
int have_sep;
|
||||
|
||||
while (1) {
|
||||
@ -156,7 +158,7 @@ static struct ioword *
|
||||
synio(cf)
|
||||
int cf;
|
||||
{
|
||||
register struct ioword *iop;
|
||||
struct ioword *iop;
|
||||
int ishere;
|
||||
|
||||
if (tpeek(cf) != REDIR)
|
||||
@ -189,7 +191,7 @@ static struct op *
|
||||
nested(type, smark, emark)
|
||||
int type, smark, emark;
|
||||
{
|
||||
register struct op *t;
|
||||
struct op *t;
|
||||
struct nesting_state old_nesting;
|
||||
|
||||
nesting_push(&old_nesting, smark);
|
||||
@ -203,8 +205,8 @@ static struct op *
|
||||
get_command(cf)
|
||||
int cf;
|
||||
{
|
||||
register struct op *t;
|
||||
register int c, iopn = 0, syniocf;
|
||||
struct op *t;
|
||||
int c, iopn = 0, syniocf;
|
||||
struct ioword *iop, **iops;
|
||||
XPtrV args, vars;
|
||||
struct nesting_state old_nesting;
|
||||
@ -419,8 +421,8 @@ get_command(cf)
|
||||
static struct op *
|
||||
dogroup()
|
||||
{
|
||||
register int c;
|
||||
register struct op *list;
|
||||
int c;
|
||||
struct op *list;
|
||||
|
||||
c = token(CONTIN|KEYWORD|ALIAS);
|
||||
/* A {...} can be used instead of do...done for for/select loops
|
||||
@ -442,7 +444,7 @@ dogroup()
|
||||
static struct op *
|
||||
thenpart()
|
||||
{
|
||||
register struct op *t;
|
||||
struct op *t;
|
||||
|
||||
musthave(THEN, KEYWORD|ALIAS);
|
||||
t = newtp(0);
|
||||
@ -456,7 +458,7 @@ thenpart()
|
||||
static struct op *
|
||||
elsepart()
|
||||
{
|
||||
register struct op *t;
|
||||
struct op *t;
|
||||
|
||||
switch (token(KEYWORD|ALIAS|VARASN)) {
|
||||
case ELSE:
|
||||
@ -479,7 +481,7 @@ elsepart()
|
||||
static struct op *
|
||||
caselist()
|
||||
{
|
||||
register struct op *t, *tl;
|
||||
struct op *t, *tl;
|
||||
int c;
|
||||
|
||||
c = token(CONTIN|KEYWORD|ALIAS);
|
||||
@ -506,8 +508,8 @@ static struct op *
|
||||
casepart(endtok)
|
||||
int endtok;
|
||||
{
|
||||
register struct op *t;
|
||||
register int c;
|
||||
struct op *t;
|
||||
int c;
|
||||
XPtrV ptns;
|
||||
|
||||
XPinit(ptns, 16);
|
||||
@ -595,7 +597,7 @@ function_body(name, ksh_func)
|
||||
static char **
|
||||
wordlist()
|
||||
{
|
||||
register int c;
|
||||
int c;
|
||||
XPtrV args;
|
||||
|
||||
XPinit(args, 16);
|
||||
@ -628,7 +630,7 @@ block(type, t1, t2, wp)
|
||||
struct op *t1, *t2;
|
||||
char **wp;
|
||||
{
|
||||
register struct op *t;
|
||||
struct op *t;
|
||||
|
||||
t = newtp(type);
|
||||
t->left = t1;
|
||||
@ -677,14 +679,14 @@ const struct tokeninfo {
|
||||
#endif /* KSH */
|
||||
/* and some special cases... */
|
||||
{ "newline", '\n', FALSE },
|
||||
{ 0 }
|
||||
{ NULL, 0, FALSE }
|
||||
};
|
||||
|
||||
void
|
||||
initkeywords()
|
||||
{
|
||||
register struct tokeninfo const *tt;
|
||||
register struct tbl *p;
|
||||
struct tokeninfo const *tt;
|
||||
struct tbl *p;
|
||||
|
||||
tinit(&keywords, APERM, 32); /* must be 2^n (currently 20 keywords) */
|
||||
for (tt = tokentab; tt->name; tt++) {
|
||||
@ -771,7 +773,7 @@ static struct op *
|
||||
newtp(type)
|
||||
int type;
|
||||
{
|
||||
register struct op *t;
|
||||
struct op *t;
|
||||
|
||||
t = (struct op *) alloc(sizeof(*t), ATEMP);
|
||||
t->type = type;
|
||||
@ -901,10 +903,8 @@ dbtestp_isa(te, meta)
|
||||
}
|
||||
|
||||
static const char *
|
||||
dbtestp_getopnd(te, op, do_eval)
|
||||
Test_env *te;
|
||||
Test_op op;
|
||||
int do_eval;
|
||||
dbtestp_getopnd(Test_env *te, Test_op op GCC_FUNC_ATTR(unused),
|
||||
int do_eval GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
int c = tpeek(ARRAYVAR);
|
||||
|
||||
@ -918,12 +918,11 @@ dbtestp_getopnd(te, op, do_eval)
|
||||
}
|
||||
|
||||
static int
|
||||
dbtestp_eval(te, op, opnd1, opnd2, do_eval)
|
||||
Test_env *te;
|
||||
Test_op op;
|
||||
const char *opnd1;
|
||||
const char *opnd2;
|
||||
int do_eval;
|
||||
dbtestp_eval(Test_env *te GCC_FUNC_ATTR(unused),
|
||||
Test_op op GCC_FUNC_ATTR(unused),
|
||||
const char *opnd1 GCC_FUNC_ATTR(unused),
|
||||
const char *opnd2 GCC_FUNC_ATTR(unused),
|
||||
int do_eval GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
42
table.c
42
table.c
@ -1,4 +1,4 @@
|
||||
/** $MirBSD: table.c,v 1.3 2004/09/21 11:57:15 tg Exp $ */
|
||||
/** $MirBSD: table.c,v 1.4 2004/10/28 11:03:24 tg Exp $ */
|
||||
/* $OpenBSD: table.c,v 1.5 1999/01/10 17:55:03 millert Exp $ */
|
||||
|
||||
/*
|
||||
@ -15,9 +15,9 @@ static int tnamecmp ARGS((void *p1, void *p2));
|
||||
|
||||
unsigned int
|
||||
hash(n)
|
||||
register const char * n;
|
||||
const char * n;
|
||||
{
|
||||
register unsigned int h = 0;
|
||||
unsigned int h = 0;
|
||||
|
||||
while (*n != '\0')
|
||||
h = 2*h + *n++;
|
||||
@ -26,8 +26,8 @@ hash(n)
|
||||
|
||||
void
|
||||
tinit(tp, ap, tsize)
|
||||
register struct table *tp;
|
||||
register Area *ap;
|
||||
struct table *tp;
|
||||
Area *ap;
|
||||
int tsize;
|
||||
{
|
||||
tp->areap = ap;
|
||||
@ -39,12 +39,12 @@ tinit(tp, ap, tsize)
|
||||
|
||||
static void
|
||||
texpand(tp, nsize)
|
||||
register struct table *tp;
|
||||
struct table *tp;
|
||||
int nsize;
|
||||
{
|
||||
register int i;
|
||||
register struct tbl *tblp, **p;
|
||||
register struct tbl **ntblp, **otblp = tp->tbls;
|
||||
int i;
|
||||
struct tbl *tblp, **p;
|
||||
struct tbl **ntblp, **otblp = tp->tbls;
|
||||
int osize = tp->size;
|
||||
|
||||
ntblp = (struct tbl**) alloc(sizeofN(struct tbl *, nsize), tp->areap);
|
||||
@ -74,11 +74,11 @@ texpand(tp, nsize)
|
||||
|
||||
struct tbl *
|
||||
tsearch(tp, n, h)
|
||||
register struct table *tp; /* table */
|
||||
register const char *n; /* name to enter */
|
||||
struct table *tp; /* table */
|
||||
const char *n; /* name to enter */
|
||||
unsigned int h; /* hash(n) */
|
||||
{
|
||||
register struct tbl **pp, *p;
|
||||
struct tbl **pp, *p;
|
||||
|
||||
if (tp->size == 0)
|
||||
return NULL;
|
||||
@ -97,12 +97,12 @@ tsearch(tp, n, h)
|
||||
|
||||
struct tbl *
|
||||
tenter(tp, n, h)
|
||||
register struct table *tp; /* table */
|
||||
register const char *n; /* name to enter */
|
||||
struct table *tp; /* table */
|
||||
const char *n; /* name to enter */
|
||||
unsigned int h; /* hash(n) */
|
||||
{
|
||||
register struct tbl **pp, *p;
|
||||
register int len;
|
||||
struct tbl **pp, *p;
|
||||
int len;
|
||||
|
||||
if (tp->size == 0)
|
||||
texpand(tp, INIT_TBLS);
|
||||
@ -139,7 +139,7 @@ tenter(tp, n, h)
|
||||
|
||||
void
|
||||
tdelete(p)
|
||||
register struct tbl *p;
|
||||
struct tbl *p;
|
||||
{
|
||||
p->flag = 0;
|
||||
}
|
||||
@ -174,10 +174,10 @@ tnamecmp(p1, p2)
|
||||
|
||||
struct tbl **
|
||||
tsort(tp)
|
||||
register struct table *tp;
|
||||
struct table *tp;
|
||||
{
|
||||
register int i;
|
||||
register struct tbl **p, **sp, **dp;
|
||||
int i;
|
||||
struct tbl **p, **sp, **dp;
|
||||
|
||||
p = (struct tbl **)alloc(sizeofN(struct tbl *, tp->size+1), ATEMP);
|
||||
sp = tp->tbls; /* source */
|
||||
@ -212,7 +212,7 @@ tprintinfo(tp)
|
||||
shellf(" Ncmp name\n");
|
||||
twalk(&ts, tp);
|
||||
while ((te = tnext(&ts))) {
|
||||
register struct tbl **pp, *p;
|
||||
struct tbl **pp, *p;
|
||||
|
||||
h = hash(n = te->name);
|
||||
ncmp = 0;
|
||||
|
15
trap.c
15
trap.c
@ -1,4 +1,4 @@
|
||||
/** $MirBSD: trap.c,v 1.3 2004/09/21 11:57:16 tg Exp $ */
|
||||
/** $MirBSD: trap.c,v 1.4 2004/10/28 11:03:24 tg Exp $ */
|
||||
/* $OpenBSD: trap.c,v 1.13 2003/02/28 09:45:09 jmc Exp $ */
|
||||
|
||||
/*
|
||||
@ -9,15 +9,17 @@
|
||||
#define FROM_TRAP_C
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirBSD: trap.c,v 1.4 2004/10/28 11:03:24 tg Exp $");
|
||||
|
||||
/* Table is indexed by signal number
|
||||
*
|
||||
* The script siglist.sh generates siglist.out, which is a sorted, complete
|
||||
* list of signals
|
||||
*/
|
||||
Trap sigtraps[SIGNALS+1] = {
|
||||
{ SIGEXIT_, "EXIT", "Signal 0" },
|
||||
{ SIGEXIT_, "EXIT", "Signal 0", NULL, 0, 0, 0, 0 },
|
||||
#include "siglist.out" /* generated by siglist.sh */
|
||||
{ SIGERR_, "ERR", "Error handler" },
|
||||
{ SIGERR_, "ERR", "Error handler", NULL, 0, 0, 0, 0 },
|
||||
};
|
||||
|
||||
static struct sigaction Sigact_ign, Sigact_trap;
|
||||
@ -68,8 +70,7 @@ alarm_init()
|
||||
}
|
||||
|
||||
static RETSIGTYPE
|
||||
alarm_catcher(sig)
|
||||
int sig;
|
||||
alarm_catcher(int sig GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
int errno_ = errno;
|
||||
|
||||
@ -93,7 +94,7 @@ gettrap(name, igncase)
|
||||
int igncase;
|
||||
{
|
||||
int i;
|
||||
register Trap *p;
|
||||
Trap *p;
|
||||
|
||||
if (digit(*name)) {
|
||||
int n;
|
||||
@ -201,7 +202,7 @@ runtraps(flag)
|
||||
int flag;
|
||||
{
|
||||
int i;
|
||||
register Trap *p;
|
||||
Trap *p;
|
||||
|
||||
#ifdef KSH
|
||||
if (ksh_tmout_state == TMOUT_LEAVING) {
|
||||
|
68
tree.c
68
tree.c
@ -1,4 +1,4 @@
|
||||
/** $MirBSD: tree.c,v 1.3 2004/09/21 11:57:16 tg Exp $ */
|
||||
/** $MirBSD: tree.c,v 1.4 2004/10/28 11:03:24 tg Exp $ */
|
||||
/* $OpenBSD: tree.c,v 1.10 2002/02/27 19:37:09 dhartmei Exp $ */
|
||||
|
||||
/*
|
||||
@ -7,6 +7,8 @@
|
||||
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirBSD: tree.c,v 1.4 2004/10/28 11:03:24 tg Exp $");
|
||||
|
||||
#define INDENT 4
|
||||
|
||||
#define tputc(c, shf) shf_putchar(c, shf);
|
||||
@ -24,11 +26,11 @@ static void iofree ARGS((struct ioword **iow, Area *ap));
|
||||
|
||||
static void
|
||||
ptree(t, indent, shf)
|
||||
register struct op *t;
|
||||
struct op *t;
|
||||
int indent;
|
||||
register struct shf *shf;
|
||||
struct shf *shf;
|
||||
{
|
||||
register char **w;
|
||||
char **w;
|
||||
struct ioword **ioact;
|
||||
struct op *t1;
|
||||
|
||||
@ -211,9 +213,9 @@ ptree(t, indent, shf)
|
||||
|
||||
static void
|
||||
pioact(shf, indent, iop)
|
||||
register struct shf *shf;
|
||||
struct shf *shf;
|
||||
int indent;
|
||||
register struct ioword *iop;
|
||||
struct ioword *iop;
|
||||
{
|
||||
int flag = iop->flag;
|
||||
int type = flag & IOTYPE;
|
||||
@ -272,8 +274,8 @@ pioact(shf, indent, iop)
|
||||
|
||||
static void
|
||||
tputC(c, shf)
|
||||
register int c;
|
||||
register struct shf *shf;
|
||||
int c;
|
||||
struct shf *shf;
|
||||
{
|
||||
if ((c&0x60) == 0) { /* C0|C1 */
|
||||
tputc((c&0x80) ? '$' : '^', shf);
|
||||
@ -287,10 +289,10 @@ tputC(c, shf)
|
||||
|
||||
static void
|
||||
tputS(wp, shf)
|
||||
register char *wp;
|
||||
register struct shf *shf;
|
||||
char *wp;
|
||||
struct shf *shf;
|
||||
{
|
||||
register int c, quoted=0;
|
||||
int c, quoted=0;
|
||||
|
||||
/* problems:
|
||||
* `...` -> $(...)
|
||||
@ -415,17 +417,17 @@ snptreef(s, n, fmt, va_alist)
|
||||
|
||||
static void
|
||||
vfptreef(shf, indent, fmt, va)
|
||||
register struct shf *shf;
|
||||
struct shf *shf;
|
||||
int indent;
|
||||
const char *fmt;
|
||||
register va_list va;
|
||||
va_list va;
|
||||
{
|
||||
register int c;
|
||||
int c;
|
||||
|
||||
while ((c = *fmt++))
|
||||
if (c == '%') {
|
||||
register long n;
|
||||
register char *p;
|
||||
long n;
|
||||
char *p;
|
||||
int neg;
|
||||
|
||||
switch ((c = *fmt++)) {
|
||||
@ -442,9 +444,9 @@ vfptreef(shf, indent, fmt, va)
|
||||
tputS(p, shf);
|
||||
break;
|
||||
case 'd': case 'u': /* decimal */
|
||||
n = (c == 'd') ? va_arg(va, int)
|
||||
: va_arg(va, unsigned int);
|
||||
neg = c=='d' && n<0;
|
||||
n = (c == 'd') ? (long)(va_arg(va, int))
|
||||
: (long)(va_arg(va, unsigned int));
|
||||
neg = (c == 'd') && (n < 0);
|
||||
p = ulton((neg) ? -n : n, 10);
|
||||
if (neg)
|
||||
*--p = '-';
|
||||
@ -487,11 +489,11 @@ vfptreef(shf, indent, fmt, va)
|
||||
|
||||
struct op *
|
||||
tcopy(t, ap)
|
||||
register struct op *t;
|
||||
struct op *t;
|
||||
Area *ap;
|
||||
{
|
||||
register struct op *r;
|
||||
register char **tw, **rw;
|
||||
struct op *r;
|
||||
char **tw, **rw;
|
||||
|
||||
if (t == NULL)
|
||||
return NULL;
|
||||
@ -548,10 +550,10 @@ wdcopy(wp, ap)
|
||||
/* return the position of prefix c in wp plus 1 */
|
||||
char *
|
||||
wdscan(wp, c)
|
||||
register const char *wp;
|
||||
register int c;
|
||||
const char *wp;
|
||||
int c;
|
||||
{
|
||||
register int nest = 0;
|
||||
int nest = 0;
|
||||
|
||||
while (1)
|
||||
switch (*wp++) {
|
||||
@ -674,18 +676,18 @@ wdstrip(wp)
|
||||
|
||||
static struct ioword **
|
||||
iocopy(iow, ap)
|
||||
register struct ioword **iow;
|
||||
struct ioword **iow;
|
||||
Area *ap;
|
||||
{
|
||||
register struct ioword **ior;
|
||||
register int i;
|
||||
struct ioword **ior;
|
||||
int i;
|
||||
|
||||
for (ior = iow; *ior++ != NULL; )
|
||||
;
|
||||
ior = (struct ioword **) alloc((ior - iow + 1) * sizeof(*ior), ap);
|
||||
|
||||
for (i = 0; iow[i] != NULL; i++) {
|
||||
register struct ioword *p, *q;
|
||||
struct ioword *p, *q;
|
||||
|
||||
p = iow[i];
|
||||
q = (struct ioword *) alloc(sizeof(*p), ap);
|
||||
@ -709,10 +711,10 @@ iocopy(iow, ap)
|
||||
|
||||
void
|
||||
tfree(t, ap)
|
||||
register struct op *t;
|
||||
struct op *t;
|
||||
Area *ap;
|
||||
{
|
||||
register char **w;
|
||||
char **w;
|
||||
|
||||
if (t == NULL)
|
||||
return;
|
||||
@ -746,8 +748,8 @@ iofree(iow, ap)
|
||||
struct ioword **iow;
|
||||
Area *ap;
|
||||
{
|
||||
register struct ioword **iop;
|
||||
register struct ioword *p;
|
||||
struct ioword **iop;
|
||||
struct ioword *p;
|
||||
|
||||
for (iop = iow; (p = *iop++) != NULL; ) {
|
||||
if (p->name != NULL)
|
||||
|
9
tty.c
9
tty.c
@ -1,4 +1,4 @@
|
||||
/** $MirBSD: tty.c,v 1.3 2004/09/21 11:57:16 tg Exp $ */
|
||||
/** $MirBSD: tty.c,v 1.4 2004/10/28 11:03:24 tg Exp $ */
|
||||
/* $OpenBSD: tty.c,v 1.2 1996/10/01 02:05:51 downsj Exp $ */
|
||||
|
||||
#include "sh.h"
|
||||
@ -7,6 +7,8 @@
|
||||
#include "tty.h"
|
||||
#undef EXTERN
|
||||
|
||||
__RCSID("$MirBSD: tty.c,v 1.4 2004/10/28 11:03:24 tg Exp $");
|
||||
|
||||
int
|
||||
get_tty(fd, ts)
|
||||
int fd;
|
||||
@ -38,10 +40,7 @@ get_tty(fd, ts)
|
||||
}
|
||||
|
||||
int
|
||||
set_tty(fd, ts, flags)
|
||||
int fd;
|
||||
TTY_state *ts;
|
||||
int flags;
|
||||
set_tty(int fd, TTY_state *ts, int flags GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
|
76
var.c
76
var.c
@ -1,4 +1,4 @@
|
||||
/** $MirBSD: var.c,v 1.8 2004/09/21 11:57:17 tg Exp $ */
|
||||
/** $MirBSD: var.c,v 1.9 2004/10/28 11:03:24 tg Exp $ */
|
||||
/* $OpenBSD: var.c,v 1.17 2004/05/08 19:42:35 deraadt Exp $ */
|
||||
|
||||
#include "sh.h"
|
||||
@ -34,7 +34,7 @@ static struct tbl *arraysearch ARGS((struct tbl *, int));
|
||||
void
|
||||
newblock()
|
||||
{
|
||||
register struct block *l;
|
||||
struct block *l;
|
||||
static char *const empty[] = {null};
|
||||
|
||||
l = (struct block *) alloc(sizeof(struct block), ATEMP);
|
||||
@ -60,9 +60,9 @@ newblock()
|
||||
void
|
||||
popblock()
|
||||
{
|
||||
register struct block *l = e->loc;
|
||||
register struct tbl *vp, **vpp = l->vars.tbls, *vq;
|
||||
register int i;
|
||||
struct block *l = e->loc;
|
||||
struct tbl *vp, **vpp = l->vars.tbls, *vq;
|
||||
int i;
|
||||
|
||||
e->loc = l->next; /* pop block */
|
||||
for (i = l->vars.size; --i >= 0; )
|
||||
@ -163,11 +163,11 @@ array_index_calc(n, arrayp, valp)
|
||||
*/
|
||||
struct tbl *
|
||||
global(n)
|
||||
register const char *n;
|
||||
const char *n;
|
||||
{
|
||||
register struct block *l = e->loc;
|
||||
register struct tbl *vp;
|
||||
register int c;
|
||||
struct block *l = e->loc;
|
||||
struct tbl *vp;
|
||||
int c;
|
||||
unsigned h;
|
||||
bool_t array;
|
||||
int val;
|
||||
@ -246,11 +246,11 @@ global(n)
|
||||
*/
|
||||
struct tbl *
|
||||
local(n, copy)
|
||||
register const char *n;
|
||||
const char *n;
|
||||
bool_t copy;
|
||||
{
|
||||
register struct block *l = e->loc;
|
||||
register struct tbl *vp;
|
||||
struct block *l = e->loc;
|
||||
struct tbl *vp;
|
||||
unsigned h;
|
||||
bool_t array;
|
||||
int val;
|
||||
@ -292,7 +292,7 @@ local(n, copy)
|
||||
/* get variable string value */
|
||||
char *
|
||||
str_val(vp)
|
||||
register struct tbl *vp;
|
||||
struct tbl *vp;
|
||||
{
|
||||
char *s;
|
||||
|
||||
@ -309,8 +309,8 @@ str_val(vp)
|
||||
const char *digits = (vp->flag & UCASEV_AL) ?
|
||||
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
: "0123456789abcdefghijklmnopqrstuvwxyz";
|
||||
register unsigned long n;
|
||||
register int base;
|
||||
unsigned long n;
|
||||
int base;
|
||||
|
||||
s = strbuf + sizeof(strbuf);
|
||||
if (vp->flag & INT_U)
|
||||
@ -341,7 +341,7 @@ str_val(vp)
|
||||
/* get variable integer value, with error checking */
|
||||
long
|
||||
intval(vp)
|
||||
register struct tbl *vp;
|
||||
struct tbl *vp;
|
||||
{
|
||||
long num;
|
||||
int base;
|
||||
@ -356,7 +356,7 @@ intval(vp)
|
||||
/* set variable to string value */
|
||||
int
|
||||
setstr(vq, s, error_ok)
|
||||
register struct tbl *vq;
|
||||
struct tbl *vq;
|
||||
const char *s;
|
||||
int error_ok;
|
||||
{
|
||||
@ -400,11 +400,11 @@ setstr(vq, s, error_ok)
|
||||
/* set variable to integer */
|
||||
void
|
||||
setint(vq, n)
|
||||
register struct tbl *vq;
|
||||
struct tbl *vq;
|
||||
long n;
|
||||
{
|
||||
if (!(vq->flag&INTEGER)) {
|
||||
register struct tbl *vp = &vtemp;
|
||||
struct tbl *vp = &vtemp;
|
||||
vp->flag = (ISSET|INTEGER);
|
||||
vp->type = 0;
|
||||
vp->areap = ATEMP;
|
||||
@ -423,8 +423,8 @@ getint(vp, nump)
|
||||
struct tbl *vp;
|
||||
long *nump;
|
||||
{
|
||||
register char *s;
|
||||
register int c;
|
||||
char *s;
|
||||
int c;
|
||||
int base, neg;
|
||||
int have_base = 0;
|
||||
long num;
|
||||
@ -479,7 +479,7 @@ getint(vp, nump)
|
||||
*/
|
||||
struct tbl *
|
||||
setint_v(vq, vp)
|
||||
register struct tbl *vq, *vp;
|
||||
struct tbl *vq, *vp;
|
||||
{
|
||||
int base;
|
||||
long num;
|
||||
@ -565,10 +565,10 @@ formatstr(vp, s)
|
||||
*/
|
||||
static void
|
||||
export(vp, val)
|
||||
register struct tbl *vp;
|
||||
struct tbl *vp;
|
||||
const char *val;
|
||||
{
|
||||
register char *xp;
|
||||
char *xp;
|
||||
char *op = (vp->flag&ALLOC) ? vp->val.s : NULL;
|
||||
int namelen = strlen(vp->name);
|
||||
int vallen = strlen(val) + 1;
|
||||
@ -591,11 +591,11 @@ export(vp, val)
|
||||
*/
|
||||
struct tbl *
|
||||
typeset(var, set, clr, field, base)
|
||||
register const char *var;
|
||||
const char *var;
|
||||
Tflag clr, set;
|
||||
int field, base;
|
||||
{
|
||||
register struct tbl *vp;
|
||||
struct tbl *vp;
|
||||
struct tbl *vpbase, *t;
|
||||
char *tvar;
|
||||
const char *val;
|
||||
@ -745,7 +745,7 @@ typeset(var, set, clr, field, base)
|
||||
*/
|
||||
void
|
||||
unset(vp, array_ref)
|
||||
register struct tbl *vp;
|
||||
struct tbl *vp;
|
||||
int array_ref;
|
||||
{
|
||||
if (vp->flag & ALLOC)
|
||||
@ -851,16 +851,16 @@ makenv()
|
||||
{
|
||||
struct block *l = e->loc;
|
||||
XPtrV env;
|
||||
register struct tbl *vp, **vpp;
|
||||
register int i;
|
||||
struct tbl *vp, **vpp;
|
||||
int i;
|
||||
|
||||
XPinit(env, 64);
|
||||
for (l = e->loc; l != NULL; l = l->next)
|
||||
for (vpp = l->vars.tbls, i = l->vars.size; --i >= 0; )
|
||||
if ((vp = *vpp++) != NULL
|
||||
&& (vp->flag&(ISSET|EXPORT)) == (ISSET|EXPORT)) {
|
||||
register struct block *l2;
|
||||
register struct tbl *vp2;
|
||||
struct block *l2;
|
||||
struct tbl *vp2;
|
||||
unsigned h = hash(vp->name);
|
||||
|
||||
/* unexport any redefined instances */
|
||||
@ -899,9 +899,9 @@ change_random()
|
||||
/* Test if name is a special parameter */
|
||||
static int
|
||||
special(name)
|
||||
register const char * name;
|
||||
const char * name;
|
||||
{
|
||||
register struct tbl *tp;
|
||||
struct tbl *tp;
|
||||
|
||||
tp = tsearch(&specials, name, hash(name));
|
||||
return tp && (tp->flag & ISSET) ? tp->type : V_NONE;
|
||||
@ -910,9 +910,9 @@ special(name)
|
||||
/* Make a variable non-special */
|
||||
static void
|
||||
unspecial(name)
|
||||
register const char * name;
|
||||
const char * name;
|
||||
{
|
||||
register struct tbl *tp;
|
||||
struct tbl *tp;
|
||||
|
||||
tp = tsearch(&specials, name, hash(name));
|
||||
if (tp)
|
||||
@ -926,7 +926,7 @@ static int user_lineno; /* what user set $LINENO to */
|
||||
|
||||
static void
|
||||
getspec(vp)
|
||||
register struct tbl *vp;
|
||||
struct tbl *vp;
|
||||
{
|
||||
switch (special(vp->name)) {
|
||||
#ifdef KSH
|
||||
@ -968,7 +968,7 @@ getspec(vp)
|
||||
|
||||
static void
|
||||
setspec(vp)
|
||||
register struct tbl *vp;
|
||||
struct tbl *vp;
|
||||
{
|
||||
char *s;
|
||||
|
||||
@ -1069,7 +1069,7 @@ setspec(vp)
|
||||
|
||||
static void
|
||||
unsetspec(vp)
|
||||
register struct tbl *vp;
|
||||
struct tbl *vp;
|
||||
{
|
||||
switch (special(vp->name)) {
|
||||
case V_PATH:
|
||||
|
12
vi.c
12
vi.c
@ -1,4 +1,4 @@
|
||||
/** $MirBSD: vi.c,v 1.7 2004/09/21 11:57:17 tg Exp $ */
|
||||
/** $MirBSD: vi.c,v 1.8 2004/10/28 11:03:24 tg Exp $ */
|
||||
/* $OpenBSD: vi.c,v 1.13 2004/05/10 16:28:47 pvalchev Exp $ */
|
||||
|
||||
/*
|
||||
@ -15,6 +15,8 @@
|
||||
#include "ksh_stat.h" /* completion */
|
||||
#include "edit.h"
|
||||
|
||||
__RCSID("$MirBSD: vi.c,v 1.8 2004/10/28 11:03:24 tg Exp $");
|
||||
|
||||
#define Ctrl(c) (c&0x1f)
|
||||
#define is_wordch(c) (letnum(c))
|
||||
|
||||
@ -238,7 +240,7 @@ x_vi(buf, len)
|
||||
|
||||
x_putc('\r'); x_putc('\n'); x_flush();
|
||||
|
||||
if (c == -1 || len <= es->linelen)
|
||||
if (c == -1 || len <= (size_t)es->linelen)
|
||||
return -1;
|
||||
|
||||
if (es->cbuf != buf)
|
||||
@ -1799,7 +1801,7 @@ outofwin()
|
||||
static void
|
||||
rewindow()
|
||||
{
|
||||
register int tcur, tcol;
|
||||
int tcur, tcol;
|
||||
int holdcur1, holdcol1;
|
||||
int holdcur2, holdcol2;
|
||||
|
||||
@ -2115,9 +2117,7 @@ complete_word(command, count)
|
||||
}
|
||||
|
||||
static int
|
||||
print_expansions(e, command)
|
||||
struct edstate *e;
|
||||
int command;
|
||||
print_expansions(struct edstate *e, int command GCC_FUNC_ATTR(unused))
|
||||
{
|
||||
int nwords;
|
||||
int start, end;
|
||||
|
Loading…
x
Reference in New Issue
Block a user