new MKSH_DISABLE_TTY_WARNING for ports that just can’t help it

TODO: add_cppflags this automatically in the TARGET_OS switch for some
This commit is contained in:
tg 2012-05-04 22:34:51 +00:00
parent e6ace01f12
commit 27387673a4
3 changed files with 11 additions and 4 deletions

View File

@ -1,5 +1,5 @@
#!/bin/sh
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.562 2012/05/04 22:18:22 tg Exp $'
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.563 2012/05/04 22:34:49 tg Exp $'
#-
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011, 2012
@ -1410,7 +1410,7 @@ else
#define EXTERN
#define MKSH_INCLUDES_ONLY
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/Build.sh,v 1.562 2012/05/04 22:18:22 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/Build.sh,v 1.563 2012/05/04 22:34:49 tg Exp $");
int main(void) { printf("Hello, World!\n"); return (0); }
EOF
case $cm in
@ -2108,6 +2108,7 @@ MKSH_CONSERVATIVE_FDS fd 0-9 for scripts, shell only up to 31
MKSH_DEFAULT_EXECSHELL "/bin/sh" (do not change)
MKSH_DEFAULT_TMPDIR "/tmp" (do not change)
MKSH_DISABLE_DEPRECATED disable code paths scheduled for later removal
MKSH_DISABLE_TTY_WARNING shut up warning about ctty if OS cant be fixed
MKSH_DONT_EMIT_IDSTRING omit RCS IDs from binary
MKSH_MIDNIGHTBSD01ASH_COMPAT set -o sh: additional compatibility quirk
MKSH_NOPROSPECTOFWORK disable jobs, co-processes, etc. (do not use)

4
jobs.c
View File

@ -22,7 +22,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/jobs.c,v 1.87 2012/05/04 22:18:25 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/jobs.c,v 1.88 2012/05/04 22:34:50 tg Exp $");
#if HAVE_KILLPG
#define mksh_killpg killpg
@ -329,9 +329,11 @@ j_change(void)
kshpgrp = kshpid;
}
}
#ifndef MKSH_DISABLE_TTY_WARNING
if (use_tty && !ttypgrp_ok)
warningf(false, "%s: %s", "warning",
"won't have full job control");
#endif
if (tty_fd >= 0)
mksh_tcget(tty_fd, &tty_state);
} else {

6
main.c
View File

@ -34,7 +34,7 @@
#include <locale.h>
#endif
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.220 2012/05/04 22:18:26 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.221 2012/05/04 22:34:51 tg Exp $");
extern char **environ;
@ -1048,10 +1048,12 @@ tty_init(bool init_ttystate, bool need_tty)
#endif
if ((tfd = open("/dev/tty", O_RDWR, 0)) < 0) {
tty_devtty = false;
#ifndef MKSH_DISABLE_TTY_WARNING
if (need_tty)
warningf(false, "%s: %s %s: %s",
"No controlling tty", "open", "/dev/tty",
strerror(errno));
#endif
}
if (tfd < 0) {
do_close = false;
@ -1060,8 +1062,10 @@ tty_init(bool init_ttystate, bool need_tty)
else if (isatty(2))
tfd = 2;
else {
#ifndef MKSH_DISABLE_TTY_WARNING
if (need_tty)
warningf(false, "can't find tty fd");
#endif
return;
}
}