kiss-repository

personal kiss repository
git clone git://git.ckyln.com/~cem/kiss-repository.git
Log | Files | Refs | Submodules | README | LICENSE

nvi-24-fallback_to_dumb_term.patch (968B)


      1 #! /bin/sh /usr/share/dpatch/dpatch-run
      2 ## 24fallback_to_dumb_term.dpatch by  <hesso@pool.math.tu-berlin.de>
      3 ##
      4 ## DP: If there's no $TERM around, just fall back to "dumb".
      5 
      6 @DPATCH@
      7 diff -Naur nvi-1.81.6.orig/cl/cl_main.c nvi-1.81.6/cl/cl_main.c
      8 --- nvi-1.81.6.orig/cl/cl_main.c	2007-11-18 17:41:42.000000000 +0100
      9 +++ nvi-1.81.6/cl/cl_main.c	2008-05-01 18:29:13.000000000 +0200
     10 @@ -96,6 +96,7 @@
     11  	if ((ttype = getenv("TERM")) == NULL)
     12  		ttype = "unknown";
     13  	term_init(gp->progname, ttype);
     14 +	ttype = getenv("TERM");
     15  
     16  	/* Add the terminal type to the global structure. */
     17  	if ((OG_D_STR(gp, GO_TERM) =
     18 @@ -233,6 +234,11 @@
     19  
     20  	/* Set up the terminal database information. */
     21  	setupterm(ttype, STDOUT_FILENO, &err);
     22 +	if (err == 0) {
     23 +		(void)fprintf(stderr, "%s: %s: unknown terminal type, falling back to 'dumb'\n", name, ttype);
     24 +		setenv("TERM", "dumb", 1);
     25 +		setupterm("dumb", STDOUT_FILENO, &err);
     26 +	}
     27  	switch (err) {
     28  	case -1:
     29  		(void)fprintf(stderr,