Re: x86 console size

2022-06-09 Thread Valery Ushakov
On Thu, Jun 09, 2022 at 20:50:07 +, RVP wrote:

> On Thu, 9 Jun 2022, Valery Ushakov wrote:
> 
> > Can't we just fix the font name in wsfont/bold16x32.h to be
> > Boldface-16x32? :) Avoids confusion in wsfontload -l output too.
> 
> Yes! I would prefer that.

Any objections to this from others?  We have that font included into
several kernels but I guess its primary use is to have a large'ish
font for automatic font selection to use for higher-res displays.
I.e. people probably don't have it in their wscons.conf, so renaming
it shouldn't break things too much for people.


> > PS: would be nice to have a version of echo that shqoute(3) its
> > arguments to use for DOIT too.
> 
> This, below, do? (I did the same with printf(1)--"%q", but I was just
> chucking away fieldwidth and precesion there, so echo it is.):

Sorry, I was sloppy in my wording, I didn't mean echo(1), just *some*
echo-like thing (printf, vis, ...).  vis already supports VIS_SHELL
&c, but its output mostly makes me want to claw my eyes out, and not
in a good way.

Since %q is already in bash and zsh there's an argument to be made
that it's the way to go, if only to avoid gratuitous divergence.
Adding flags to echo(1) is probably not the best idea in any case.
ISTR, kre@ commented on that bit of history some time in the past on
one of the lists.

shquote(3) is not intended for human consumption, so we might also
want to think about a pretty-printing version (may be as new vis(3)
flag?)  that tries to DTRT and produce more human-friendly output.  I
think our shell's set -x (that is intended for humans) already has the
code.


-uwe


Re: x86 console size

2022-06-09 Thread RVP

On Thu, 9 Jun 2022, Valery Ushakov wrote:


Uhm, you cite "setvar" in your example, but the patch affects handling
of the "font" command, it seems.



You're right--my mistake. Both `setvar' and `font' need quoting.


Can't we just fix the font name in wsfont/bold16x32.h to be
Boldface-16x32? :) Avoids confusion in wsfontload -l output too.



Yes! I would prefer that.


So I'd rather we avoid it altogether and rewrite the loop to consume
all the arguments first, then use the

   set -- "$@" ...

idiom to construct the command line, something along the lines of:

   set -- "$@" ${enc:+ "-e" "$enc"}
   set -- "$@" ${name:+ "-N" "$name"}
   set -- "$@" ${file:+ "-f" "$file"}
   $DOIT "$cmd" "$@"



Yes, cleaner this way.


PS: would be nice to have a version of echo that shqoute(3) its
arguments to use for DOIT too.



This, below, do? (I did the same with printf(1)--"%q", but I was just
chucking away fieldwidth and precesion there, so echo it is.):

---START---
diff -urN bin/echo.orig/echo.c bin/echo/echo.c
--- bin/echo.orig/echo.c2021-11-16 22:47:05.474277074 +
+++ bin/echo/echo.c 2022-06-09 20:36:13.806784976 +
@@ -47,29 +47,56 @@
 #include 
 #include 

+static char *
+qstr(char *s)
+{
+   char* qs;
+   size_t n;
+
+   if ((n = shquote(s, NULL, 0)) == (size_t)-1)
+   return NULL;
+   n += 1;
+   if ((qs = malloc(n)) == NULL)
+   return NULL;
+   (void)shquote(s, qs, n);
+   return qs;
+}
+
 /* ARGSUSED */
 int
 main(int argc, char *argv[])
 {
-   bool nflag;
+   bool nflag, qflag;
+   int rc = EXIT_FAILURE;

setprogname(argv[0]);
(void)setlocale(LC_ALL, "");

+   nflag = qflag = false;
/* This utility may NOT do getopt(3) option parsing. */
-   nflag = *++argv != NULL && strcmp(*argv, "-n") == 0;
+   if (*++argv != NULL) {
+   nflag = strcmp(*argv, "-n") == 0;
+   qflag = strcmp(*argv, "-q") == 0;
+   if (qflag) nflag = true;/* -q implies -n */
+   }
if (nflag)
++argv;

while (*argv != NULL) {
-   (void)printf("%s", *argv);
+   if (qflag) {
+   char *qs = qstr(*argv);
+   if (qs == NULL)
+   err(rc, "quote error");
+   (void)printf("%s", qs);
+   free(qs);
+   } else
+   (void)printf("%s", *argv);
if (*++argv != NULL)
(void)putchar(' ');
}
if (!nflag)
(void)putchar('\n');
-   (void)fflush(stdout);
-   if (ferror(stdout) != 0)
-   err(1, "write error");
-   return 0;
+   if (fflush(stdout))
+   err(rc, "write error");
+   return EXIT_SUCCESS;
 }
---END---

Man pages, tests to come if OK.

-RVP


Re: x86 console size

2022-06-08 Thread Valery Ushakov
On Wed, Jun 08, 2022 at 21:35:49 +, RVP wrote:

> Apropos that: can this patch be applied so that font-names (and their
> filenames) can be quoted more intuitively?
> Like this:
> 
> setvar ttyE0   fontBoldface\ 16x32
> 
> instead of (currently) this:
> 
> setvar ttyE0   fontBoldface\\\ 16x32
> 
> An example in wscons.conf(5) indicating this would also be helpful.
> 
> -RVP
> 
> ---START---
> diff -u etc/rc.d.orig/wscons etc/rc.d/wscons
> --- etc/rc.d.orig/wscons  2011-08-09 08:08:10.0 +
> +++ etc/rc.d/wscons   2022-06-08 21:21:47.950605000 +
> @@ -87,7 +87,7 @@
>   cmd="$cmd -e $enc"
>   ;;
>   esac
> - cmd="$cmd -N $name $file"
> + cmd="$cmd -N \"$name\" \"$file\""
>   eval $DOIT $cmd
>   ;;
> 
> ---END---

Uhm, you cite "setvar" in your example, but the patch affects handling
of the "font" command, it seems.

Can't we just fix the font name in wsfont/bold16x32.h to be
Boldface-16x32? :) Avoids confusion in wsfontload -l output too.

eval is nasty, but here we currently need it to undo the quoting of
the argument to -N (in your patch) or the extra backspace (before your
patch).

So I'd rather we avoid it altogether and rewrite the loop to consume
all the arguments first, then use the

set -- "$@" ...

idiom to construct the command line, something along the lines of:

set -- "$@" ${enc:+ "-e" "$enc"}
set -- "$@" ${name:+ "-N" "$name"}
set -- "$@" ${file:+ "-f" "$file"}
$DOIT "$cmd" "$@"

PS: would be nice to have a version of echo that shqoute(3) its
arguments to use for DOIT too.

-uwe


Re: x86 console size

2022-06-08 Thread RVP

On Tue, 7 Jun 2022, Valery Ushakov wrote:


On Tue, Jun 07, 2022 at 19:02:08 +0200, Reinoud Zandijk wrote:


These work quite well! Only how to configure this? When and where is
this set and configured?


man 5 wscons.conf



Apropos that: can this patch be applied so that font-names (and their
filenames) can be quoted more intuitively?
Like this:

setvar ttyE0   fontBoldface\ 16x32

instead of (currently) this:

setvar ttyE0   fontBoldface\\\ 16x32

An example in wscons.conf(5) indicating this would also be helpful.

-RVP

---START---
diff -u etc/rc.d.orig/wscons etc/rc.d/wscons
--- etc/rc.d.orig/wscons2011-08-09 08:08:10.0 +
+++ etc/rc.d/wscons 2022-06-08 21:21:47.950605000 +
@@ -87,7 +87,7 @@
cmd="$cmd -e $enc"
;;
esac
-   cmd="$cmd -N $name $file"
+   cmd="$cmd -N \"$name\" \"$file\""
eval $DOIT $cmd
;;

---END---


Re: x86 console size

2022-06-07 Thread Valery Ushakov
On Tue, Jun 07, 2022 at 19:02:08 +0200, Reinoud Zandijk wrote:

> On Sun, Jun 05, 2022 at 11:52:51AM +, RVP wrote:
> > On Sun, 5 Jun 2022, Reinoud Zandijk wrote:
> > 
> > > Could switching to the big fonts be an option?
> > > 
> > 
> > With both fonts compiled in you can switch between them
> > using:
> > 
> > wsconsctl -dw font='Boldface 16x32'
> > wsconsctl -dw font=Boldface
> 
> These work quite well! Only how to configure this? When and where is
> this set and configured?

man 5 wscons.conf

-uwe


Re: x86 console size

2022-06-07 Thread Reinoud Zandijk
Hi :)

On Sun, Jun 05, 2022 at 11:52:51AM +, RVP wrote:
> On Sun, 5 Jun 2022, Reinoud Zandijk wrote:
> 
> > Could switching to the big fonts be an option?
> > 
> 
> With both fonts compiled in you can switch between them
> using:
> 
> wsconsctl -dw font='Boldface 16x32'
> wsconsctl -dw font=Boldface

These work quite well! Only how to configure this? When and where is this set
and configured?

Thanks,
Reinoud



Re: x86 console size

2022-06-05 Thread RVP

On Sun, 5 Jun 2022, Reinoud Zandijk wrote:


Could switching to the big fonts be an option?



With both fonts compiled in you can switch between them
using:

wsconsctl -dw font='Boldface 16x32'
wsconsctl -dw font=Boldface

-RVP



x86 console size

2022-06-05 Thread Reinoud Zandijk
Dear folks,

since some time I noticed that the initial graphical console has small letters
but is later reset to big letters again. Is this intentional? How can I
preserve the smaller font? The 80x25 (or x31?) is quite huge on this monitor
and I really liked the smaller fonts!

Could switching to the big fonts be an option?

With regards,
Reinoud