]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
ul.c: warn user when command chooses term type
authorSami Kerola <kerolasa@iki.fi>
Sat, 30 Apr 2011 11:06:27 +0000 (13:06 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 17 May 2011 13:58:05 +0000 (15:58 +0200)
Happens usually when user specifies garbage as -t argument.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
text-utils/ul.c

index 42a2ee279d11d16ebc9d3f8c00ee2e8f2fc2946b..1cbacfc07c7264c55a3e5cfa07eef61fc7c9d3cc 100644 (file)
@@ -147,7 +147,7 @@ usage(FILE *out)
 
 int main(int argc, char **argv)
 {
-       int c, ret;
+       int c, ret, tflag = 0;
        char *termtype;
        FILE *f;
 
@@ -184,6 +184,7 @@ int main(int argc, char **argv)
                case 'T':
                        /* for nroff compatibility */
                        termtype = optarg;
+                       tflag = 1;
                        break;
                case 'i':
                        iflag = 1;
@@ -209,7 +210,9 @@ int main(int argc, char **argv)
                /* fall through to ... */
 
        case 0:
-               /* No such terminal type - assume dumb */
+               if (tflag)
+                       warnx(_("terminal `%s' is not known, defaulting to `dumb'"),
+                               termtype);
                setupterm("dumb", STDOUT_FILENO, (int *)0);
                break;
        }