summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rw-r--r--bin/sh/histedit.c5
-rw-r--r--bin/sh/input.c6
-rw-r--r--bin/sh/jobs.c4
-rw-r--r--bin/sh/main.c4
-rw-r--r--bin/sh/output.c6
-rw-r--r--bin/sh/output.h2
-rw-r--r--bin/sh/parser.c3
7 files changed, 16 insertions, 14 deletions
diff --git a/bin/sh/histedit.c b/bin/sh/histedit.c
index 32b0448..0c2def8 100644
--- a/bin/sh/histedit.c
+++ b/bin/sh/histedit.c
@@ -92,7 +92,7 @@ histedit(void)
if (hist != NULL)
sethistsize(histsizeval());
else
- out2str("sh: can't initialize history\n");
+ out2fmt_flush("sh: can't initialize history\n");
}
if (editing && !el && isatty(0)) { /* && isatty(2) ??? */
/*
@@ -114,7 +114,7 @@ histedit(void)
el_set(el, EL_PROMPT, getprompt);
} else {
bad:
- out2str("sh: can't initialize editing\n");
+ out2fmt_flush("sh: can't initialize editing\n");
}
INTON;
} else if (!editing && el) {
@@ -336,6 +336,7 @@ histcmd(int argc, char **argv)
if (sflg) {
if (displayhist) {
out2str(s);
+ flushout(out2);
}
evalstring(s, 0);
if (displayhist && hist) {
diff --git a/bin/sh/input.c b/bin/sh/input.c
index f709b8c..3d8f90c 100644
--- a/bin/sh/input.c
+++ b/bin/sh/input.c
@@ -215,7 +215,7 @@ retry:
if (flags >= 0 && flags & O_NONBLOCK) {
flags &=~ O_NONBLOCK;
if (fcntl(0, F_SETFL, flags) >= 0) {
- out2str("sh: turning off NDELAY mode\n");
+ out2fmt_flush("sh: turning off NDELAY mode\n");
goto retry;
}
}
@@ -359,7 +359,7 @@ pushstring(char *s, int len, void *ap)
struct strpush *sp;
INTOFF;
-/*dprintf("*** calling pushstring: %s, %d\n", s, len);*/
+/*out2fmt_flush("*** calling pushstring: %s, %d\n", s, len);*/
if (parsefile->strpush) {
sp = ckmalloc(sizeof (struct strpush));
sp->prev = parsefile->strpush;
@@ -386,7 +386,7 @@ popstring(void)
parsenextc = sp->prevstring;
parsenleft = sp->prevnleft;
parselleft = sp->prevlleft;
-/*dprintf("*** calling popstring: restoring to '%s'\n", parsenextc);*/
+/*out2fmt_flush("*** calling popstring: restoring to '%s'\n", parsenextc);*/
if (sp->ap)
sp->ap->flag &= ~ALIASINUSE;
parsefile->strpush = sp->prev;
diff --git a/bin/sh/jobs.c b/bin/sh/jobs.c
index be9acab..1ebf722 100644
--- a/bin/sh/jobs.c
+++ b/bin/sh/jobs.c
@@ -146,7 +146,7 @@ setjobctl(int on)
do { /* while we are in the background */
initialpgrp = tcgetpgrp(ttyfd);
if (initialpgrp < 0) {
-out: out2str("sh: can't access tty; job control turned off\n");
+out: out2fmt_flush("sh: can't access tty; job control turned off\n");
mflag = 0;
return;
}
@@ -1046,7 +1046,7 @@ stoppedjobs(void)
if (jp->used == 0)
continue;
if (jp->state == JOBSTOPPED) {
- out2str("You have stopped jobs.\n");
+ out2fmt_flush("You have stopped jobs.\n");
job_warning = 2;
return (1);
}
diff --git a/bin/sh/main.c b/bin/sh/main.c
index 85a6d20..f26e611 100644
--- a/bin/sh/main.c
+++ b/bin/sh/main.c
@@ -154,7 +154,7 @@ main(int argc, char *argv[])
setstackmark(&smark);
procargs(argc, argv);
if (getpwd() == NULL && iflag)
- out2str("sh: cannot determine working directory\n");
+ out2fmt_flush("sh: cannot determine working directory\n");
if (getpwd() != NULL)
setvar ("PWD", getpwd(), VEXPORT);
if (argv[0] && argv[0][0] == '-') {
@@ -223,7 +223,7 @@ cmdloop(int top)
if (!stoppedjobs()) {
if (!Iflag)
break;
- out2str("\nUse \"exit\" to leave shell.\n");
+ out2fmt_flush("\nUse \"exit\" to leave shell.\n");
}
numeof++;
} else if (n != NULL && nflag == 0) {
diff --git a/bin/sh/output.c b/bin/sh/output.c
index 0d55fdf..f1d2072 100644
--- a/bin/sh/output.c
+++ b/bin/sh/output.c
@@ -71,7 +71,7 @@ __FBSDID("$FreeBSD$");
static int doformat_wr(void *, const char *, int);
struct output output = {NULL, 0, NULL, OUTBUFSIZ, 1, 0};
-struct output errout = {NULL, 0, NULL, 100, 2, 0};
+struct output errout = {NULL, 0, NULL, 256, 2, 0};
struct output memout = {NULL, 0, NULL, 0, MEM_OUT, 0};
struct output *out1 = &output;
struct output *out2 = &errout;
@@ -124,8 +124,6 @@ outstr(const char *p, struct output *file)
{
while (*p)
outc(*p++, file);
- if (file == out2)
- flushout(file);
}
/* Like outstr(), but quote for re-input into the shell. */
@@ -255,7 +253,7 @@ out1fmt(const char *fmt, ...)
}
void
-dprintf(const char *fmt, ...)
+out2fmt_flush(const char *fmt, ...)
{
va_list ap;
diff --git a/bin/sh/output.h b/bin/sh/output.h
index bafd8687..d34c792 100644
--- a/bin/sh/output.h
+++ b/bin/sh/output.h
@@ -65,7 +65,7 @@ void flushout(struct output *);
void freestdout(void);
void outfmt(struct output *, const char *, ...) __printflike(2, 3);
void out1fmt(const char *, ...) __printflike(1, 2);
-void dprintf(const char *, ...) __printflike(1, 2);
+void out2fmt_flush(const char *, ...) __printflike(1, 2);
void fmtstr(char *, int, const char *, ...) __printflike(3, 4);
void doformat(struct output *, const char *, va_list) __printflike(2, 0);
int xwrite(int, char *, int);
diff --git a/bin/sh/parser.c b/bin/sh/parser.c
index 46f5199..5218dc0 100644
--- a/bin/sh/parser.c
+++ b/bin/sh/parser.c
@@ -1563,7 +1563,10 @@ setprompt(int which)
#ifndef NO_HISTORY
if (!el)
#endif
+ {
out2str(getprompt(NULL));
+ flushout(out2);
+ }
}
/*
OpenPOWER on IntegriCloud