]> xenbits.xensource.com Git - freebsd.git/commitdiff
loader: vidconsole should set LINES and COLUMNS
authortsoome <tsoome@FreeBSD.org>
Tue, 10 Sep 2019 21:53:42 +0000 (21:53 +0000)
committertsoome <tsoome@FreeBSD.org>
Tue, 10 Sep 2019 21:53:42 +0000 (21:53 +0000)
Set LINES and COLUMNS based on terminal dimensions.

stand/i386/libi386/vidconsole.c
stand/i386/loader/main.c

index 854a7f16e4cc4ba7b42d37db27bab26eaf38eb7e..e947d274e89a0d9705f377324494550fc5f49320 100644 (file)
@@ -574,6 +574,7 @@ vidc_init(int arg)
 {
        const teken_attr_t *a;
        int val;
+       char env[8];
 
        if (vidc_started && arg == 0)
                return (0);
@@ -606,6 +607,11 @@ vidc_init(int arg)
        teken_set_winsize(&teken, &tp);
        a = teken_get_defattr(&teken);
 
+       snprintf(env, sizeof (env), "%u", tp.tp_row);
+       setenv("LINES", env, 1);
+       snprintf(env, sizeof (env), "%u", tp.tp_col);
+       setenv("COLUMNS", env, 1);
+
        for (int row = 0; row < tp.tp_row; row++)
                for (int col = 0; col < tp.tp_col; col++) {
                        buffer[col + row * tp.tp_col].c = ' ';
index a7d1e82fd4886585fb6d140b6595d726c1d8ee2c..b988ebaf9e4e498f308315a3446c92a8347d240a 100644 (file)
@@ -238,7 +238,6 @@ main(void)
     printf("\n%s", bootprog_info);
 
     extract_currdev();                         /* set $currdev and $loaddev */
-    setenv("LINES", "24", 1);                  /* optional */
     
     bios_getsmap();