Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/dist/nvi/cl Print a warning if TERM is not set and stdin is ...



details:   https://anonhg.NetBSD.org/src/rev/17440231838d
branches:  trunk
changeset: 748322:17440231838d
user:      tnn <tnn%NetBSD.org@localhost>
date:      Tue Oct 20 16:17:07 2009 +0000

description:
Print a warning if TERM is not set and stdin is a tty. PR bin/42144.

diffstat:

 dist/nvi/cl/cl_main.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (23 lines):

diff -r 0eae10e2230a -r 17440231838d dist/nvi/cl/cl_main.c
--- a/dist/nvi/cl/cl_main.c     Tue Oct 20 14:49:03 2009 +0000
+++ b/dist/nvi/cl/cl_main.c     Tue Oct 20 16:17:07 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cl_main.c,v 1.2 2008/12/05 22:51:42 christos Exp $ */
+/*     $NetBSD: cl_main.c,v 1.3 2009/10/20 16:17:07 tnn Exp $ */
 
 /*-
  * Copyright (c) 1993, 1994
@@ -98,8 +98,12 @@
         * We have to know what terminal it is from the start, since we may
         * have to use termcap/terminfo to find out how big the screen is.
         */
-       if ((ttype = getenv("TERM")) == NULL)
+       if ((ttype = getenv("TERM")) == NULL) {
+               if (isatty(STDIN_FILENO))
+                       fprintf(stderr, "%s: warning: TERM is not set\n",
+                           gp->progname);
                ttype = "unknown";
+       }
        term_init(gp->progname, ttype);
 
        /* Add the terminal type to the global structure. */



Home | Main Index | Thread Index | Old Index