run GNU protoize
protect header files nuke some dead code regenerate configure script let silly code die
This commit is contained in:
122
exec.c
122
exec.c
@ -1,4 +1,4 @@
|
||||
/** $MirBSD: exec.c,v 1.5 2004/10/28 11:11:18 tg Exp $ */
|
||||
/** $MirBSD: exec.c,v 1.6 2004/10/28 11:53:41 tg Exp $ */
|
||||
/* $OpenBSD: exec.c,v 1.31 2003/12/15 05:25:52 otto Exp $ */
|
||||
|
||||
/*
|
||||
@ -10,7 +10,7 @@
|
||||
#include <ctype.h>
|
||||
#include "ksh_stat.h"
|
||||
|
||||
__RCSID("$MirBSD: exec.c,v 1.5 2004/10/28 11:11:18 tg Exp $");
|
||||
__RCSID("$MirBSD: exec.c,v 1.6 2004/10/28 11:53:41 tg Exp $");
|
||||
|
||||
/* Does ps4 get parameter substitutions done? */
|
||||
#ifdef KSH
|
||||
@ -56,8 +56,7 @@ static char clexec_tab[MAXFD+1];
|
||||
* we now use this function always.
|
||||
*/
|
||||
int
|
||||
fd_clexec(fd)
|
||||
int fd;
|
||||
fd_clexec(int fd)
|
||||
{
|
||||
#ifndef F_SETFD
|
||||
if (fd >= 0 && fd < sizeof(clexec_tab)) {
|
||||
@ -75,9 +74,9 @@ fd_clexec(fd)
|
||||
* execute command tree
|
||||
*/
|
||||
int
|
||||
execute(t, flags)
|
||||
struct op * volatile t;
|
||||
volatile int flags; /* if XEXEC don't fork */
|
||||
execute(struct op *volatile t, volatile int flags)
|
||||
|
||||
/* if XEXEC don't fork */
|
||||
{
|
||||
int i;
|
||||
volatile int rv = 0;
|
||||
@ -448,11 +447,7 @@ execute(t, flags)
|
||||
*/
|
||||
|
||||
static int
|
||||
comexec(t, tp, ap, flags)
|
||||
struct op *t;
|
||||
struct tbl *volatile tp;
|
||||
char **ap;
|
||||
int volatile flags;
|
||||
comexec(struct op *t, struct tbl *volatile tp, char **ap, volatile int flags)
|
||||
{
|
||||
int i;
|
||||
volatile int rv = 0;
|
||||
@ -754,9 +749,7 @@ comexec(t, tp, ap, flags)
|
||||
}
|
||||
|
||||
static void
|
||||
scriptexec(tp, ap)
|
||||
struct op *tp;
|
||||
char **ap;
|
||||
scriptexec(struct op *tp, char **ap)
|
||||
{
|
||||
char *shell;
|
||||
|
||||
@ -868,8 +861,7 @@ scriptexec(tp, ap)
|
||||
}
|
||||
|
||||
int
|
||||
shcomexec(wp)
|
||||
char **wp;
|
||||
shcomexec(char **wp)
|
||||
{
|
||||
struct tbl *tp;
|
||||
|
||||
@ -884,10 +876,7 @@ shcomexec(wp)
|
||||
* is created if none is found.
|
||||
*/
|
||||
struct tbl *
|
||||
findfunc(name, h, create)
|
||||
const char *name;
|
||||
unsigned int h;
|
||||
int create;
|
||||
findfunc(const char *name, unsigned int h, int create)
|
||||
{
|
||||
struct block *l;
|
||||
struct tbl *tp = (struct tbl *) 0;
|
||||
@ -912,9 +901,7 @@ findfunc(name, h, create)
|
||||
* function did not exist, returns 0 otherwise.
|
||||
*/
|
||||
int
|
||||
define(name, t)
|
||||
const char *name;
|
||||
struct op *t;
|
||||
define(const char *name, struct op *t)
|
||||
{
|
||||
struct tbl *tp;
|
||||
int was_set = 0;
|
||||
@ -957,9 +944,7 @@ define(name, t)
|
||||
* add builtin
|
||||
*/
|
||||
void
|
||||
builtin(name, func)
|
||||
const char *name;
|
||||
int (*func)(char **);
|
||||
builtin(const char *name, int (*func) (char **))
|
||||
{
|
||||
struct tbl *tp;
|
||||
Tflag flag;
|
||||
@ -987,9 +972,9 @@ builtin(name, func)
|
||||
* either function, hashed command, or built-in (in that order)
|
||||
*/
|
||||
struct tbl *
|
||||
findcom(name, flags)
|
||||
const char *name;
|
||||
int flags; /* FC_* */
|
||||
findcom(const char *name, int flags)
|
||||
|
||||
/* FC_* */
|
||||
{
|
||||
static struct tbl temp;
|
||||
unsigned int h = hash(name);
|
||||
@ -1086,8 +1071,8 @@ findcom(name, flags)
|
||||
* flush executable commands with relative paths
|
||||
*/
|
||||
void
|
||||
flushcom(all)
|
||||
int all; /* just relative or all */
|
||||
flushcom(int all)
|
||||
/* just relative or all */
|
||||
{
|
||||
struct tbl *tp;
|
||||
struct tstate ts;
|
||||
@ -1104,10 +1089,10 @@ flushcom(all)
|
||||
|
||||
/* Check if path is something we want to find. Returns -1 for failure. */
|
||||
int
|
||||
search_access(path, mode, errnop)
|
||||
const char *path;
|
||||
int mode;
|
||||
int *errnop; /* set if candidate found, but not suitable */
|
||||
search_access(const char *path, int mode, int *errnop)
|
||||
|
||||
|
||||
/* set if candidate found, but not suitable */
|
||||
{
|
||||
#ifndef OS2
|
||||
int ret, err = 0;
|
||||
@ -1201,11 +1186,11 @@ search_access1(path, mode, errnop)
|
||||
* search for command with PATH
|
||||
*/
|
||||
char *
|
||||
search(name, path, mode, errnop)
|
||||
const char *name;
|
||||
const char *path;
|
||||
int mode; /* R_OK or X_OK */
|
||||
int *errnop; /* set if candidate found, but not suitable */
|
||||
search(const char *name, const char *path, int mode, int *errnop)
|
||||
|
||||
|
||||
/* R_OK or X_OK */
|
||||
/* set if candidate found, but not suitable */
|
||||
{
|
||||
const char *sp, *p;
|
||||
char *xp;
|
||||
@ -1271,9 +1256,7 @@ search(name, path, mode, errnop)
|
||||
}
|
||||
|
||||
static int
|
||||
call_builtin(tp, wp)
|
||||
struct tbl *tp;
|
||||
char **wp;
|
||||
call_builtin(struct tbl *tp, char **wp)
|
||||
{
|
||||
int rv;
|
||||
|
||||
@ -1294,9 +1277,7 @@ call_builtin(tp, wp)
|
||||
* set up redirection, saving old fd's in e->savefd
|
||||
*/
|
||||
static int
|
||||
iosetup(iop, tp)
|
||||
struct ioword *iop;
|
||||
struct tbl *tp;
|
||||
iosetup(struct ioword *iop, struct tbl *tp)
|
||||
{
|
||||
int u = -1;
|
||||
char *cp = iop->name;
|
||||
@ -1440,9 +1421,7 @@ iosetup(iop, tp)
|
||||
* if unquoted here, expand here temp file into second temp file.
|
||||
*/
|
||||
static int
|
||||
herein(content, sub)
|
||||
const char *content;
|
||||
int sub;
|
||||
herein(const char *content, int sub)
|
||||
{
|
||||
volatile int fd = -1;
|
||||
struct source *s, *volatile osource;
|
||||
@ -1509,9 +1488,7 @@ herein(content, sub)
|
||||
* print the args in column form - assuming that we can
|
||||
*/
|
||||
static char *
|
||||
do_selectargs(ap, print_menu)
|
||||
char **ap;
|
||||
bool_t print_menu;
|
||||
do_selectargs(char **ap, bool_t print_menu)
|
||||
{
|
||||
static const char *const read_args[] = {
|
||||
"read", "-r", "REPLY", (char *) 0
|
||||
@ -1551,11 +1528,7 @@ static char *select_fmt_entry(void *arg, int i, char *buf, int buflen);
|
||||
|
||||
/* format a single select menu item */
|
||||
static char *
|
||||
select_fmt_entry(arg, i, buf, buflen)
|
||||
void *arg;
|
||||
int i;
|
||||
char *buf;
|
||||
int buflen;
|
||||
select_fmt_entry(void *arg, int i, char *buf, int buflen)
|
||||
{
|
||||
struct select_menu_info *smi = (struct select_menu_info *) arg;
|
||||
|
||||
@ -1568,8 +1541,7 @@ select_fmt_entry(arg, i, buf, buflen)
|
||||
* print a select style menu
|
||||
*/
|
||||
int
|
||||
pr_menu(ap)
|
||||
char *const *ap;
|
||||
pr_menu(char *const *ap)
|
||||
{
|
||||
struct select_menu_info smi;
|
||||
char *const *pp;
|
||||
@ -1612,19 +1584,14 @@ pr_menu(ap)
|
||||
static char *plain_fmt_entry(void *arg, int i, char *buf, int buflen);
|
||||
|
||||
static char *
|
||||
plain_fmt_entry(arg, i, buf, buflen)
|
||||
void *arg;
|
||||
int i;
|
||||
char *buf;
|
||||
int buflen;
|
||||
plain_fmt_entry(void *arg, int i, char *buf, int buflen)
|
||||
{
|
||||
shf_snprintf(buf, buflen, "%s", ((char *const *)arg)[i]);
|
||||
return buf;
|
||||
}
|
||||
|
||||
int
|
||||
pr_list(ap)
|
||||
char *const *ap;
|
||||
pr_list(char *const *ap)
|
||||
{
|
||||
char *const *pp;
|
||||
int nwidth;
|
||||
@ -1653,9 +1620,7 @@ extern const char db_close[];
|
||||
* TM_UNOP and TM_BINOP, the returned value is a Test_op).
|
||||
*/
|
||||
static int
|
||||
dbteste_isa(te, meta)
|
||||
Test_env *te;
|
||||
Test_meta meta;
|
||||
dbteste_isa(Test_env *te, Test_meta meta)
|
||||
{
|
||||
int ret = 0;
|
||||
int uqword;
|
||||
@ -1694,10 +1659,7 @@ dbteste_isa(te, meta)
|
||||
}
|
||||
|
||||
static const char *
|
||||
dbteste_getopnd(te, op, do_eval)
|
||||
Test_env *te;
|
||||
Test_op op;
|
||||
int do_eval;
|
||||
dbteste_getopnd(Test_env *te, Test_op op, int do_eval)
|
||||
{
|
||||
char *s = *te->pos.wp;
|
||||
|
||||
@ -1718,21 +1680,13 @@ dbteste_getopnd(te, op, do_eval)
|
||||
}
|
||||
|
||||
static int
|
||||
dbteste_eval(te, op, opnd1, opnd2, do_eval)
|
||||
Test_env *te;
|
||||
Test_op op;
|
||||
const char *opnd1;
|
||||
const char *opnd2;
|
||||
int do_eval;
|
||||
dbteste_eval(Test_env *te, Test_op op, const char *opnd1, const char *opnd2, int do_eval)
|
||||
{
|
||||
return test_eval(te, op, opnd1, opnd2, do_eval);
|
||||
}
|
||||
|
||||
static void
|
||||
dbteste_error(te, offset, msg)
|
||||
Test_env *te;
|
||||
int offset;
|
||||
const char *msg;
|
||||
dbteste_error(Test_env *te, int offset, const char *msg)
|
||||
{
|
||||
te->flags |= TEF_ERROR;
|
||||
internal_errorf(0, "dbteste_error: %s (offset %d)", msg, offset);
|
||||
|
Reference in New Issue
Block a user