whitespace
This commit is contained in:
parent
475cafb90e
commit
4e08a79555
5
exec.c
5
exec.c
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.76 2010/08/28 15:39:18 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.77 2010/08/28 15:48:18 tg Exp $");
|
||||||
|
|
||||||
#ifndef MKSH_DEFAULT_EXECSHELL
|
#ifndef MKSH_DEFAULT_EXECSHELL
|
||||||
#define MKSH_DEFAULT_EXECSHELL "/bin/sh"
|
#define MKSH_DEFAULT_EXECSHELL "/bin/sh"
|
||||||
@ -441,7 +441,8 @@ comexec(struct op *t, struct tbl *volatile tp, const char **ap,
|
|||||||
*/
|
*/
|
||||||
keepasn_ok = 1;
|
keepasn_ok = 1;
|
||||||
while (tp && tp->type == CSHELL) {
|
while (tp && tp->type == CSHELL) {
|
||||||
fcflags = FC_BI|FC_FUNC|FC_PATH;/* undo effects of command */
|
/* undo effects of command */
|
||||||
|
fcflags = FC_BI|FC_FUNC|FC_PATH;
|
||||||
if (tp->val.f == c_builtin) {
|
if (tp->val.f == c_builtin) {
|
||||||
if ((cp = *++ap) == NULL) {
|
if ((cp = *++ap) == NULL) {
|
||||||
tp = NULL;
|
tp = NULL;
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
#include <sys/file.h>
|
#include <sys/file.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.98 2010/07/24 17:08:29 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.99 2010/08/28 15:48:18 tg Exp $");
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* MirOS: This is the default mapping type, and need not be specified.
|
* MirOS: This is the default mapping type, and need not be specified.
|
||||||
@ -1096,7 +1096,7 @@ inittraps(void)
|
|||||||
|
|
||||||
sigtraps[SIGINT].flags |= TF_DFL_INTR | TF_TTY_INTR;
|
sigtraps[SIGINT].flags |= TF_DFL_INTR | TF_TTY_INTR;
|
||||||
sigtraps[SIGQUIT].flags |= TF_DFL_INTR | TF_TTY_INTR;
|
sigtraps[SIGQUIT].flags |= TF_DFL_INTR | TF_TTY_INTR;
|
||||||
sigtraps[SIGTERM].flags |= TF_DFL_INTR;/* not fatal for interactive */
|
sigtraps[SIGTERM].flags |= TF_DFL_INTR; /* not fatal for interactive */
|
||||||
sigtraps[SIGHUP].flags |= TF_FATAL;
|
sigtraps[SIGHUP].flags |= TF_FATAL;
|
||||||
sigtraps[SIGCHLD].flags |= TF_SHELL_USES;
|
sigtraps[SIGCHLD].flags |= TF_SHELL_USES;
|
||||||
|
|
||||||
|
16
jobs.c
16
jobs.c
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/jobs.c,v 1.69 2010/07/04 17:33:54 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/jobs.c,v 1.70 2010/08/28 15:48:19 tg Exp $");
|
||||||
|
|
||||||
#if HAVE_KILLPG
|
#if HAVE_KILLPG
|
||||||
#define mksh_killpg killpg
|
#define mksh_killpg killpg
|
||||||
@ -63,7 +63,7 @@ struct proc {
|
|||||||
#define JF_W_ASYNCNOTIFY 0x004 /* set if waiting and async notification ok */
|
#define JF_W_ASYNCNOTIFY 0x004 /* set if waiting and async notification ok */
|
||||||
#define JF_XXCOM 0x008 /* set for $(command) jobs */
|
#define JF_XXCOM 0x008 /* set for $(command) jobs */
|
||||||
#define JF_FG 0x010 /* running in foreground (also has tty pgrp) */
|
#define JF_FG 0x010 /* running in foreground (also has tty pgrp) */
|
||||||
#define JF_SAVEDTTY 0x020 /* j->ttystate is valid */
|
#define JF_SAVEDTTY 0x020 /* j->ttystat is valid */
|
||||||
#define JF_CHANGED 0x040 /* process has changed state */
|
#define JF_CHANGED 0x040 /* process has changed state */
|
||||||
#define JF_KNOWN 0x080 /* $! referenced */
|
#define JF_KNOWN 0x080 /* $! referenced */
|
||||||
#define JF_ZOMBIE 0x100 /* known, unwaited process */
|
#define JF_ZOMBIE 0x100 /* known, unwaited process */
|
||||||
@ -87,7 +87,7 @@ struct job {
|
|||||||
int32_t age; /* number of jobs started */
|
int32_t age; /* number of jobs started */
|
||||||
Coproc_id coproc_id; /* 0 or id of coprocess output pipe */
|
Coproc_id coproc_id; /* 0 or id of coprocess output pipe */
|
||||||
#ifndef MKSH_UNEMPLOYED
|
#ifndef MKSH_UNEMPLOYED
|
||||||
struct termios ttystate;/* saved tty state for stopped jobs */
|
struct termios ttystat; /* saved tty state for stopped jobs */
|
||||||
pid_t saved_ttypgrp; /* saved tty process group for stopped jobs */
|
pid_t saved_ttypgrp; /* saved tty process group for stopped jobs */
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
@ -376,7 +376,7 @@ exchild(struct op *t, int flags,
|
|||||||
last_proc->next = pi.p;
|
last_proc->next = pi.p;
|
||||||
last_proc = pi.p;
|
last_proc = pi.p;
|
||||||
} else {
|
} else {
|
||||||
pi.j = new_job(); /* fills in pi.j->job */
|
pi.j = new_job(); /* fills in pi.j->job */
|
||||||
/*
|
/*
|
||||||
* we don't consider XXCOMs foreground since they don't get
|
* we don't consider XXCOMs foreground since they don't get
|
||||||
* tty process group and we don't save or restore tty modes.
|
* tty process group and we don't save or restore tty modes.
|
||||||
@ -565,7 +565,7 @@ waitlast(void)
|
|||||||
else
|
else
|
||||||
internal_warningf("waitlast: not started");
|
internal_warningf("waitlast: not started");
|
||||||
sigprocmask(SIG_SETMASK, &omask, NULL);
|
sigprocmask(SIG_SETMASK, &omask, NULL);
|
||||||
return (125); /* not so arbitrary, non-zero value */
|
return (125); /* not so arbitrary, non-zero value */
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = j_waitj(j, JW_NONE, "jw:waitlast");
|
rv = j_waitj(j, JW_NONE, "jw:waitlast");
|
||||||
@ -717,7 +717,7 @@ j_resume(const char *cp, int bg)
|
|||||||
/* attach tty to job */
|
/* attach tty to job */
|
||||||
if (j->state == PRUNNING) {
|
if (j->state == PRUNNING) {
|
||||||
if (ttypgrp_ok && (j->flags & JF_SAVEDTTY))
|
if (ttypgrp_ok && (j->flags & JF_SAVEDTTY))
|
||||||
tcsetattr(tty_fd, TCSADRAIN, &j->ttystate);
|
tcsetattr(tty_fd, TCSADRAIN, &j->ttystat);
|
||||||
/* See comment in j_waitj regarding saved_ttypgrp. */
|
/* See comment in j_waitj regarding saved_ttypgrp. */
|
||||||
if (ttypgrp_ok &&
|
if (ttypgrp_ok &&
|
||||||
tcsetpgrp(tty_fd, (j->flags & JF_SAVEDTTYPGRP) ?
|
tcsetpgrp(tty_fd, (j->flags & JF_SAVEDTTYPGRP) ?
|
||||||
@ -993,7 +993,7 @@ j_waitj(Job *j,
|
|||||||
int oldf = j->flags & (JF_WAITING|JF_W_ASYNCNOTIFY);
|
int oldf = j->flags & (JF_WAITING|JF_W_ASYNCNOTIFY);
|
||||||
j->flags &= ~(JF_WAITING|JF_W_ASYNCNOTIFY);
|
j->flags &= ~(JF_WAITING|JF_W_ASYNCNOTIFY);
|
||||||
runtraps(TF_FATAL);
|
runtraps(TF_FATAL);
|
||||||
j->flags |= oldf; /* not reached... */
|
j->flags |= oldf; /* not reached... */
|
||||||
}
|
}
|
||||||
if ((flags & JW_INTERRUPT) && (rv = trap_pending())) {
|
if ((flags & JW_INTERRUPT) && (rv = trap_pending())) {
|
||||||
j->flags &= ~(JF_WAITING|JF_W_ASYNCNOTIFY);
|
j->flags &= ~(JF_WAITING|JF_W_ASYNCNOTIFY);
|
||||||
@ -1026,7 +1026,7 @@ j_waitj(Job *j,
|
|||||||
tty_fd, (long)kshpgrp, strerror(errno));
|
tty_fd, (long)kshpgrp, strerror(errno));
|
||||||
if (j->state == PSTOPPED) {
|
if (j->state == PSTOPPED) {
|
||||||
j->flags |= JF_SAVEDTTY;
|
j->flags |= JF_SAVEDTTY;
|
||||||
tcgetattr(tty_fd, &j->ttystate);
|
tcgetattr(tty_fd, &j->ttystat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
8
misc.c
8
misc.c
@ -29,7 +29,7 @@
|
|||||||
#include <grp.h>
|
#include <grp.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.141 2010/07/17 22:09:36 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.142 2010/08/28 15:48:19 tg Exp $");
|
||||||
|
|
||||||
unsigned char chtypes[UCHAR_MAX + 1]; /* type bits for unsigned char */
|
unsigned char chtypes[UCHAR_MAX + 1]; /* type bits for unsigned char */
|
||||||
|
|
||||||
@ -705,9 +705,11 @@ cclass(const unsigned char *p, int sub)
|
|||||||
if (ISMAGIC(c)) {
|
if (ISMAGIC(c)) {
|
||||||
c = *p++;
|
c = *p++;
|
||||||
if ((c & 0x80) && !ISMAGIC(c)) {
|
if ((c & 0x80) && !ISMAGIC(c)) {
|
||||||
c &= 0x7f;/* extended pattern matching: *+?@! */
|
/* extended pattern matching: *+?@! */
|
||||||
|
c &= 0x7F;
|
||||||
/* XXX the ( char isn't handled as part of [] */
|
/* XXX the ( char isn't handled as part of [] */
|
||||||
if (c == ' ') /* simile for @: plain (..) */
|
if (c == ' ')
|
||||||
|
/* simile for @: plain (..) */
|
||||||
c = '(' /*)*/;
|
c = '(' /*)*/;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
38
sh.h
38
sh.h
@ -150,7 +150,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef EXTERN
|
#ifdef EXTERN
|
||||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.406 2010/08/28 15:39:20 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.407 2010/08/28 15:48:20 tg Exp $");
|
||||||
#endif
|
#endif
|
||||||
#define MKSH_VERSION "R39 2010/08/24"
|
#define MKSH_VERSION "R39 2010/08/24"
|
||||||
|
|
||||||
@ -698,7 +698,7 @@ typedef struct trap {
|
|||||||
|
|
||||||
EXTERN volatile sig_atomic_t trap; /* traps pending? */
|
EXTERN volatile sig_atomic_t trap; /* traps pending? */
|
||||||
EXTERN volatile sig_atomic_t intrsig; /* pending trap interrupts command */
|
EXTERN volatile sig_atomic_t intrsig; /* pending trap interrupts command */
|
||||||
EXTERN volatile sig_atomic_t fatal_trap;/* received a fatal signal */
|
EXTERN volatile sig_atomic_t fatal_trap; /* received a fatal signal */
|
||||||
extern Trap sigtraps[NSIG+1];
|
extern Trap sigtraps[NSIG+1];
|
||||||
|
|
||||||
/* got_winch = 1 when we need to re-adjust the window size */
|
/* got_winch = 1 when we need to re-adjust the window size */
|
||||||
@ -759,13 +759,13 @@ EXTERN int ifs0 I__(' '); /* for "$*" */
|
|||||||
#define GI_MINUSMINUS BIT(2) /* arguments were ended with -- */
|
#define GI_MINUSMINUS BIT(2) /* arguments were ended with -- */
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
const char *optarg;
|
const char *optarg;
|
||||||
int optind;
|
int optind;
|
||||||
int uoptind;/* what user sees in $OPTIND */
|
int uoptind; /* what user sees in $OPTIND */
|
||||||
int flags; /* see GF_* */
|
int flags; /* see GF_* */
|
||||||
int info; /* see GI_* */
|
int info; /* see GI_* */
|
||||||
unsigned int p; /* 0 or index into argv[optind - 1] */
|
unsigned int p; /* 0 or index into argv[optind - 1] */
|
||||||
char buf[2]; /* for bad option OPTARG value */
|
char buf[2]; /* for bad option OPTARG value */
|
||||||
} Getopt;
|
} Getopt;
|
||||||
|
|
||||||
EXTERN Getopt builtin_opt; /* for shell builtin commands */
|
EXTERN Getopt builtin_opt; /* for shell builtin commands */
|
||||||
@ -896,7 +896,7 @@ struct tbl { /* table item */
|
|||||||
char *s; /* string */
|
char *s; /* string */
|
||||||
mksh_ari_t i; /* integer */
|
mksh_ari_t i; /* integer */
|
||||||
mksh_uari_t u; /* unsigned integer */
|
mksh_uari_t u; /* unsigned integer */
|
||||||
int (*f)(const char **);/* int function */
|
int (*f)(const char **); /* int function */
|
||||||
struct op *t; /* "function" tree */
|
struct op *t; /* "function" tree */
|
||||||
} val; /* value */
|
} val; /* value */
|
||||||
union {
|
union {
|
||||||
@ -1115,11 +1115,11 @@ struct op {
|
|||||||
* IO redirection
|
* IO redirection
|
||||||
*/
|
*/
|
||||||
struct ioword {
|
struct ioword {
|
||||||
int unit; /* unit affected */
|
int unit; /* unit affected */
|
||||||
int flag; /* action (below) */
|
int flag; /* action (below) */
|
||||||
char *name; /* file name (unused if heredoc) */
|
char *name; /* file name (unused if heredoc) */
|
||||||
char *delim; /* delimiter for <<,<<- */
|
char *delim; /* delimiter for <<,<<- */
|
||||||
char *heredoc;/* content of heredoc */
|
char *heredoc; /* content of heredoc */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ioword.flag - type of redirection */
|
/* ioword.flag - type of redirection */
|
||||||
@ -1718,15 +1718,15 @@ typedef enum Test_meta Test_meta;
|
|||||||
|
|
||||||
typedef struct test_env {
|
typedef struct test_env {
|
||||||
union {
|
union {
|
||||||
const char **wp;/* used by ptest_* */
|
const char **wp; /* used by ptest_* */
|
||||||
XPtrV *av; /* used by dbtestp_* */
|
XPtrV *av; /* used by dbtestp_* */
|
||||||
} pos;
|
} pos;
|
||||||
const char **wp_end; /* used by ptest_* */
|
const char **wp_end; /* used by ptest_* */
|
||||||
Test_op (*isa)(struct test_env *, Test_meta);
|
Test_op (*isa)(struct test_env *, Test_meta);
|
||||||
const char *(*getopnd) (struct test_env *, Test_op, bool);
|
const char *(*getopnd) (struct test_env *, Test_op, bool);
|
||||||
int (*eval)(struct test_env *, Test_op, const char *, const char *, bool);
|
int (*eval)(struct test_env *, Test_op, const char *, const char *, bool);
|
||||||
void (*error)(struct test_env *, int, const char *);
|
void (*error)(struct test_env *, int, const char *);
|
||||||
int flags; /* TEF_* */
|
int flags; /* TEF_* */
|
||||||
} Test_env;
|
} Test_env;
|
||||||
|
|
||||||
extern const char *const dbtest_tokens[];
|
extern const char *const dbtest_tokens[];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user