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 #!/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, # Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011, 2012 # 2011, 2012
@ -1410,7 +1410,7 @@ else
#define EXTERN #define EXTERN
#define MKSH_INCLUDES_ONLY #define MKSH_INCLUDES_ONLY
#include "sh.h" #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); } int main(void) { printf("Hello, World!\n"); return (0); }
EOF EOF
case $cm in 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_EXECSHELL "/bin/sh" (do not change)
MKSH_DEFAULT_TMPDIR "/tmp" (do not change) MKSH_DEFAULT_TMPDIR "/tmp" (do not change)
MKSH_DISABLE_DEPRECATED disable code paths scheduled for later removal 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_DONT_EMIT_IDSTRING omit RCS IDs from binary
MKSH_MIDNIGHTBSD01ASH_COMPAT set -o sh: additional compatibility quirk MKSH_MIDNIGHTBSD01ASH_COMPAT set -o sh: additional compatibility quirk
MKSH_NOPROSPECTOFWORK disable jobs, co-processes, etc. (do not use) MKSH_NOPROSPECTOFWORK disable jobs, co-processes, etc. (do not use)

4
jobs.c
View File

@ -22,7 +22,7 @@
#include "sh.h" #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 #if HAVE_KILLPG
#define mksh_killpg killpg #define mksh_killpg killpg
@ -329,9 +329,11 @@ j_change(void)
kshpgrp = kshpid; kshpgrp = kshpid;
} }
} }
#ifndef MKSH_DISABLE_TTY_WARNING
if (use_tty && !ttypgrp_ok) if (use_tty && !ttypgrp_ok)
warningf(false, "%s: %s", "warning", warningf(false, "%s: %s", "warning",
"won't have full job control"); "won't have full job control");
#endif
if (tty_fd >= 0) if (tty_fd >= 0)
mksh_tcget(tty_fd, &tty_state); mksh_tcget(tty_fd, &tty_state);
} else { } else {

6
main.c
View File

@ -34,7 +34,7 @@
#include <locale.h> #include <locale.h>
#endif #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; extern char **environ;
@ -1048,10 +1048,12 @@ tty_init(bool init_ttystate, bool need_tty)
#endif #endif
if ((tfd = open("/dev/tty", O_RDWR, 0)) < 0) { if ((tfd = open("/dev/tty", O_RDWR, 0)) < 0) {
tty_devtty = false; tty_devtty = false;
#ifndef MKSH_DISABLE_TTY_WARNING
if (need_tty) if (need_tty)
warningf(false, "%s: %s %s: %s", warningf(false, "%s: %s %s: %s",
"No controlling tty", "open", "/dev/tty", "No controlling tty", "open", "/dev/tty",
strerror(errno)); strerror(errno));
#endif
} }
if (tfd < 0) { if (tfd < 0) {
do_close = false; do_close = false;
@ -1060,8 +1062,10 @@ tty_init(bool init_ttystate, bool need_tty)
else if (isatty(2)) else if (isatty(2))
tfd = 2; tfd = 2;
else { else {
#ifndef MKSH_DISABLE_TTY_WARNING
if (need_tty) if (need_tty)
warningf(false, "can't find tty fd"); warningf(false, "can't find tty fd");
#endif
return; return;
} }
} }