CVS commit: src/usr.sbin/wsfontload

2022-06-08 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Wed Jun  8 22:38:29 UTC 2022

Modified Files:
src/usr.sbin/wsfontload: wsfontload.8

Log Message:
wsfontload(8): Mention .wsf font files.  Fix formatting.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/usr.sbin/wsfontload/wsfontload.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/wsfontload/wsfontload.8
diff -u src/usr.sbin/wsfontload/wsfontload.8:1.31 src/usr.sbin/wsfontload/wsfontload.8:1.32
--- src/usr.sbin/wsfontload/wsfontload.8:1.31	Sat Apr 24 09:18:44 2021
+++ src/usr.sbin/wsfontload/wsfontload.8	Wed Jun  8 22:38:29 2022
@@ -1,4 +1,4 @@
-.\"	$NetBSD: wsfontload.8,v 1.31 2021/04/24 09:18:44 nia Exp $
+.\"	$NetBSD: wsfontload.8,v 1.32 2022/06/08 22:38:29 uwe Exp $
 .\"
 .\" Copyright (c) 1999, 2001
 .\" 	Matthias Drochner.  All rights reserved.
@@ -24,7 +24,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd April 24, 2021
+.Dd June 9, 2022
 .Dt WSFONTLOAD 8
 .Os
 .Sh NAME
@@ -39,7 +39,8 @@
 .Op Fl N Ar name
 .Op Fl w Ar width
 .Op Ar fontfile
-.Nm Fl l
+.Nm
+.Fl l
 .Sh DESCRIPTION
 The
 .Nm
@@ -54,7 +55,7 @@ or from standard input if
 is not provided.
 .Pp
 The options are:
-.Bl -tag -width xxx
+.Bl -tag -width Fl
 .It Fl B
 Specifies that the font data is ordered right-to-left byte wise.
 The default is left-to-right.
@@ -63,25 +64,26 @@ Specifies that the font data is ordered 
 The default is left-to-right.
 .It Fl e Ar encoding
 Sets the encoding of the font.
-This can be either a symbolic abbreviation or a numeric value.
-Currently recognized abbreviations are:
-.Bl -tag -width xxx
+This can be either a symbolic name or a numeric value.
+Currently recognized names are:
+.Bl -tag -width Ql
 .It Ql iso
 ISO-8859-1 encoding
 .It Ql ibm
-IBM encoded fonts
+IBM CP437 encoding
 .It Ql pcvt
 the custom encoding of the supplemental fonts which came with the
 .Bx
 .Dq pcvt
 console driver
 .It Ql iso2
-ISO-8859-2 (east european) encoding
+ISO-8859-2 (Eastern European) encoding
 .It Ql iso7
-ISO-8859-7 (greek) encoding
+ISO-8859-7 (Greek) encoding
 .It Ql koi8r
-KOI8-R (russian) encoding
+KOI8-R (Russian) encoding
 .El
+.Pp
 Per default,
 .Ql iso
 is assumed.
@@ -106,43 +108,78 @@ Sets the width of a font character in pi
 Default is 8.
 .El
 .Pp
+.Nm
+supports
+.Ql \&.wsf
+file format that contains the necessary information about the font in
+the font file itself.
+Such files can be loaded without specifying any arguments,
+though
+.Fl N
+can be used to override the font name.
+.Pp
 Typically, the
 .Nm
-utility will be executed in system startup by the
-.Pa /etc/rc.d/wscons
-script, controlled by the
-.Pa /etc/wscons.conf
-configuration file.
+utility will be executed during system startup by the
+.Xr rc 8
+script.
+See
+.Xr wscons.conf 5 .
 .Sh FILES
-.Pa /etc/wscons.conf
+.Bl -item -compact
+.It
 .Pa /usr/share/wscons/fonts
+.El
 .Sh EXAMPLES
-Load the ISO-encoded 16x32 Spleen font and switch the first console
-screen to use it:
+Load ISO-encoded 20-pixel high Terminus font
+and use it on the current console
 .Pp
-.Bd -offset indent -unfilled
-# wsfontload -w 16 -h 32 -e iso -N spleen32 \\
+.Bd -literal -offset indent
+# wsfontload /usr/share/wscons/fonts/ter-120n.wsf
+# wsfontload -l | grep Terminus
+Terminus20-ISO8859-1 10x20
+# wsconsctl -f `tty` -dw font=Terminus20-ISO8859-1
+.Ed
+.Pp
+Load the ISO-encoded 16\[tmu]32 Spleen font
+and switch the first console screen to use it:
+.Pp
+.Bd -literal -offset indent
+# wsfontload -w 16 -h 32 -e iso -N spleen32 \e
 	/usr/share/wscons/fonts/spleen-16x32.fnt
 # wsconsctl -dw font=spleen32
 .Ed
 .Pp
-Load the IBM-encoded 8\(mu8-font from the
+Load the IBM-encoded 8\[tmu]8-font from the
 .Xr wscons 4
 distribution:
 .Pp
-.Bd -offset indent -unfilled
-# wsfontload -N myname -h 8 -e ibm /usr/share/wscons/fonts/vt220l.808
+.Bd -literal -offset indent
+# wsfontload -N myname -h 8 -e ibm \e
+/usr/share/wscons/fonts/vt220l.808
 .Ed
 .Pp
-This (or another 8\(mu8-font) is necessary to use the
+This or another 8\[tmu]8-font is necessary to use the
 50-line screen type on
 .Xr vga 4
 displays.
 .Sh SEE ALSO
 .Xr wscons 4 ,
-.Xr wsconscfg 8 ,
+.Xr wsfont 4 ,
+.Xr wscons.conf 5 ,
+.\" XXX: BUGS: not yet
+.\" .Xr wsf 5 ,
 .Xr wsconsctl 8
+.Sh HISTORY
+Support for
+.Ql \&.wsf
+font files appeared in
+.Nx 10.0 .
 .Sh BUGS
 Many features are missing.
 .Pp
+The
+.Ql \&.wsf
+file format is undocumented.
+.Pp
 There is no way to remove a loaded font.



CVS commit: src/usr.sbin/wsfontload

2022-06-08 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Wed Jun  8 22:38:29 UTC 2022

Modified Files:
src/usr.sbin/wsfontload: wsfontload.8

Log Message:
wsfontload(8): Mention .wsf font files.  Fix formatting.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/usr.sbin/wsfontload/wsfontload.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/wsfontload

2022-05-12 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Thu May 12 22:08:55 UTC 2022

Modified Files:
src/usr.sbin/wsfontload: wsfontload.c

Log Message:
wsfontload: O_RDONLY is enough to list the fonts with -l


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/usr.sbin/wsfontload/wsfontload.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/wsfontload/wsfontload.c
diff -u src/usr.sbin/wsfontload/wsfontload.c:1.23 src/usr.sbin/wsfontload/wsfontload.c:1.24
--- src/usr.sbin/wsfontload/wsfontload.c:1.23	Sat Apr 24 07:52:07 2021
+++ src/usr.sbin/wsfontload/wsfontload.c	Thu May 12 22:08:55 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: wsfontload.c,v 1.23 2021/04/24 07:52:07 wiz Exp $ */
+/* $NetBSD: wsfontload.c,v 1.24 2022/05/12 22:08:55 uwe Exp $ */
 
 /*
  * Copyright (c) 1999
@@ -199,7 +199,7 @@ main(int argc, char **argv)
 	if (argc > 1)
 		usage();
 
-	wsfd = open(wsdev, O_RDWR, 0);
+	wsfd = open(wsdev, listfonts ? O_RDONLY : O_RDWR, 0);
 	if (wsfd < 0)
 		err(2, "open ws-device %s", wsdev);
 



CVS commit: src/usr.sbin/wsfontload

2022-05-12 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Thu May 12 22:08:55 UTC 2022

Modified Files:
src/usr.sbin/wsfontload: wsfontload.c

Log Message:
wsfontload: O_RDONLY is enough to list the fonts with -l


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/usr.sbin/wsfontload/wsfontload.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/wsfontload

2021-04-24 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Sat Apr 24 09:18:44 UTC 2021

Modified Files:
src/usr.sbin/wsfontload: wsfontload.8

Log Message:
wsfontload.8: clean up examples

add an example of loading a larger font since a lot of people ask.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/usr.sbin/wsfontload/wsfontload.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/wsfontload/wsfontload.8
diff -u src/usr.sbin/wsfontload/wsfontload.8:1.30 src/usr.sbin/wsfontload/wsfontload.8:1.31
--- src/usr.sbin/wsfontload/wsfontload.8:1.30	Sat Apr 24 09:03:05 2021
+++ src/usr.sbin/wsfontload/wsfontload.8	Sat Apr 24 09:18:44 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: wsfontload.8,v 1.30 2021/04/24 09:03:05 nia Exp $
+.\"	$NetBSD: wsfontload.8,v 1.31 2021/04/24 09:18:44 nia Exp $
 .\"
 .\" Copyright (c) 1999, 2001
 .\" 	Matthias Drochner.  All rights reserved.
@@ -117,23 +117,27 @@ configuration file.
 .Pa /etc/wscons.conf
 .Pa /usr/share/wscons/fonts
 .Sh EXAMPLES
-.Dl wsfontload -N myname -h 8 -e ibm /usr/share/wscons/fonts/vt220l.808
+Load the ISO-encoded 16x32 Spleen font and switch the first console
+screen to use it:
+.Pp
+.Bd -offset indent -unfilled
+# wsfontload -w 16 -h 32 -e iso -N spleen32 \\
+	/usr/share/wscons/fonts/spleen-16x32.fnt
+# wsconsctl -dw font=spleen32
+.Ed
 .Pp
 Load the IBM-encoded 8\(mu8-font from the
 .Xr wscons 4
-distribution.
+distribution:
+.Pp
+.Bd -offset indent -unfilled
+# wsfontload -N myname -h 8 -e ibm /usr/share/wscons/fonts/vt220l.808
+.Ed
+.Pp
 This (or another 8\(mu8-font) is necessary to use the
 50-line screen type on
 .Xr vga 4
 displays.
-.Pp
-.Dl wsfontload -N orator -e ibm /usr/share/wscons/fonts/orator.816
-.Dl wsconsctl -dw font=orator
-.Pp
-Load the
-.Dq orator
-IBM-encoded 8\(mu16 font and switch the first console screen
-(ttyE0, wsconsctl's default) to this alternate font.
 .Sh SEE ALSO
 .Xr wscons 4 ,
 .Xr wsconscfg 8 ,



CVS commit: src/usr.sbin/wsfontload

2021-04-24 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Sat Apr 24 09:18:44 UTC 2021

Modified Files:
src/usr.sbin/wsfontload: wsfontload.8

Log Message:
wsfontload.8: clean up examples

add an example of loading a larger font since a lot of people ask.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/usr.sbin/wsfontload/wsfontload.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/wsfontload

2021-04-24 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Sat Apr 24 09:03:05 UTC 2021

Modified Files:
src/usr.sbin/wsfontload: wsfontload.8

Log Message:
wsfontload: clarify more


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/usr.sbin/wsfontload/wsfontload.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/wsfontload

2021-04-24 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Sat Apr 24 09:03:05 UTC 2021

Modified Files:
src/usr.sbin/wsfontload: wsfontload.8

Log Message:
wsfontload: clarify more


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/usr.sbin/wsfontload/wsfontload.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/wsfontload/wsfontload.8
diff -u src/usr.sbin/wsfontload/wsfontload.8:1.29 src/usr.sbin/wsfontload/wsfontload.8:1.30
--- src/usr.sbin/wsfontload/wsfontload.8:1.29	Sat Apr 24 08:59:09 2021
+++ src/usr.sbin/wsfontload/wsfontload.8	Sat Apr 24 09:03:05 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: wsfontload.8,v 1.29 2021/04/24 08:59:09 nia Exp $
+.\"	$NetBSD: wsfontload.8,v 1.30 2021/04/24 09:03:05 nia Exp $
 .\"
 .\" Copyright (c) 1999, 2001
 .\" 	Matthias Drochner.  All rights reserved.
@@ -93,8 +93,7 @@ Default is
 Sets the height of a font character in pixels.
 Default is 16.
 .It Fl l
-Print a list of available fonts that are built-in to the kernel
-(as opposed to fonts available to load from the filesystem).
+Print a list of fonts that have been loaded or are built-in to the kernel.
 .It Fl N Ar name
 Specifies a name which can be used later to refer to the font.
 If none is given, the
@@ -143,5 +142,3 @@ IBM-encoded 8\(mu16 font and switch the 
 Many features are missing.
 .Pp
 There is no way to remove a loaded font.
-.Pp
-There is no way to determine which fonts have been loaded.



CVS commit: src/usr.sbin/wsfontload

2021-04-24 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Sat Apr 24 08:59:09 UTC 2021

Modified Files:
src/usr.sbin/wsfontload: wsfontload.8

Log Message:
wsfontload: clarify documentation of -l


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/usr.sbin/wsfontload/wsfontload.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/wsfontload/wsfontload.8
diff -u src/usr.sbin/wsfontload/wsfontload.8:1.28 src/usr.sbin/wsfontload/wsfontload.8:1.29
--- src/usr.sbin/wsfontload/wsfontload.8:1.28	Sat Apr 24 07:52:07 2021
+++ src/usr.sbin/wsfontload/wsfontload.8	Sat Apr 24 08:59:09 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: wsfontload.8,v 1.28 2021/04/24 07:52:07 wiz Exp $
+.\"	$NetBSD: wsfontload.8,v 1.29 2021/04/24 08:59:09 nia Exp $
 .\"
 .\" Copyright (c) 1999, 2001
 .\" 	Matthias Drochner.  All rights reserved.
@@ -93,7 +93,8 @@ Default is
 Sets the height of a font character in pixels.
 Default is 16.
 .It Fl l
-Print a list of available fonts.
+Print a list of available fonts that are built-in to the kernel
+(as opposed to fonts available to load from the filesystem).
 .It Fl N Ar name
 Specifies a name which can be used later to refer to the font.
 If none is given, the



CVS commit: src/usr.sbin/wsfontload

2021-04-24 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Sat Apr 24 08:59:09 UTC 2021

Modified Files:
src/usr.sbin/wsfontload: wsfontload.8

Log Message:
wsfontload: clarify documentation of -l


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/usr.sbin/wsfontload/wsfontload.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/wsfontload

2021-04-24 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Apr 24 07:52:08 UTC 2021

Modified Files:
src/usr.sbin/wsfontload: wsfontload.8 wsfontload.c

Log Message:
wsfontload: make -l mode a separate line in the usage

Document it in the manpage.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/usr.sbin/wsfontload/wsfontload.8
cvs rdiff -u -r1.22 -r1.23 src/usr.sbin/wsfontload/wsfontload.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/wsfontload

2021-04-24 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Apr 24 07:52:08 UTC 2021

Modified Files:
src/usr.sbin/wsfontload: wsfontload.8 wsfontload.c

Log Message:
wsfontload: make -l mode a separate line in the usage

Document it in the manpage.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/usr.sbin/wsfontload/wsfontload.8
cvs rdiff -u -r1.22 -r1.23 src/usr.sbin/wsfontload/wsfontload.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/wsfontload/wsfontload.8
diff -u src/usr.sbin/wsfontload/wsfontload.8:1.27 src/usr.sbin/wsfontload/wsfontload.8:1.28
--- src/usr.sbin/wsfontload/wsfontload.8:1.27	Thu May 30 14:58:51 2019
+++ src/usr.sbin/wsfontload/wsfontload.8	Sat Apr 24 07:52:07 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: wsfontload.8,v 1.27 2019/05/30 14:58:51 pgoyette Exp $
+.\"	$NetBSD: wsfontload.8,v 1.28 2021/04/24 07:52:07 wiz Exp $
 .\"
 .\" Copyright (c) 1999, 2001
 .\" 	Matthias Drochner.  All rights reserved.
@@ -24,7 +24,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd May 30, 2019
+.Dd April 24, 2021
 .Dt WSFONTLOAD 8
 .Os
 .Sh NAME
@@ -39,6 +39,7 @@
 .Op Fl N Ar name
 .Op Fl w Ar width
 .Op Ar fontfile
+.Nm Fl l
 .Sh DESCRIPTION
 The
 .Nm
@@ -91,6 +92,8 @@ Default is
 .It Fl h Ar height
 Sets the height of a font character in pixels.
 Default is 16.
+.It Fl l
+Print a list of available fonts.
 .It Fl N Ar name
 Specifies a name which can be used later to refer to the font.
 If none is given, the

Index: src/usr.sbin/wsfontload/wsfontload.c
diff -u src/usr.sbin/wsfontload/wsfontload.c:1.22 src/usr.sbin/wsfontload/wsfontload.c:1.23
--- src/usr.sbin/wsfontload/wsfontload.c:1.22	Sat Apr 24 00:49:26 2021
+++ src/usr.sbin/wsfontload/wsfontload.c	Sat Apr 24 07:52:07 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: wsfontload.c,v 1.22 2021/04/24 00:49:26 macallan Exp $ */
+/* $NetBSD: wsfontload.c,v 1.23 2021/04/24 07:52:07 wiz Exp $ */
 
 /*
  * Copyright (c) 1999
@@ -76,8 +76,10 @@ usage(void)
 {
 
 	(void)fprintf(stderr,
-		"usage: %s [-Bbvl] [-e encoding] [-f wsdev] [-h height]"
-		" [-N name] [-w width] [fontfile]\n",
+		"usage: %s [-Bbv] [-e encoding] [-f wsdev] [-h height]"
+		" [-N name] [-w width] [fontfile]\n"
+		"   %s -l\n",
+		  getprogname(),
 		  getprogname());
 	exit(1);
 }



CVS commit: src/usr.sbin/wsfontload

2021-04-23 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Apr 24 00:49:26 UTC 2021

Modified Files:
src/usr.sbin/wsfontload: wsfontload.c

Log Message:
add -l option to dump a list of available fonts


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/usr.sbin/wsfontload/wsfontload.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/wsfontload/wsfontload.c
diff -u src/usr.sbin/wsfontload/wsfontload.c:1.21 src/usr.sbin/wsfontload/wsfontload.c:1.22
--- src/usr.sbin/wsfontload/wsfontload.c:1.21	Fri Jun 23 18:40:03 2017
+++ src/usr.sbin/wsfontload/wsfontload.c	Sat Apr 24 00:49:26 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: wsfontload.c,v 1.21 2017/06/23 18:40:03 macallan Exp $ */
+/* $NetBSD: wsfontload.c,v 1.22 2021/04/24 00:49:26 macallan Exp $ */
 
 /*
  * Copyright (c) 1999
@@ -76,7 +76,7 @@ usage(void)
 {
 
 	(void)fprintf(stderr,
-		"usage: %s [-Bbv] [-e encoding] [-f wsdev] [-h height]"
+		"usage: %s [-Bbvl] [-e encoding] [-f wsdev] [-h height]"
 		" [-N name] [-w width] [fontfile]\n",
 		  getprogname());
 	exit(1);
@@ -136,8 +136,8 @@ main(int argc, char **argv)
 	const char *wsdev;
 	struct wsdisplay_font f;
 	struct stat st;
-	int c, res, wsfd, ffd, verbose = 0;
 	size_t len;
+	int c, res, wsfd, ffd, verbose = 0, listfonts = 0;
 	int use_embedded_name = 1;
 	void *buf;
 	char nbuf[65];
@@ -153,11 +153,14 @@ main(int argc, char **argv)
 	f.bitorder = DEFBITORDER;
 	f.byteorder = DEFBYTEORDER;
 
-	while ((c = getopt(argc, argv, "f:w:h:e:N:bBv")) != -1) {
+	while ((c = getopt(argc, argv, "f:w:h:e:N:bBvl")) != -1) {
 		switch (c) {
 		case 'f':
 			wsdev = optarg;
 			break;
+		case 'l':
+			listfonts = 1;
+			break;
 		case 'w':
 			if (sscanf(optarg, "%d", ) != 1)
 errx(1, "invalid font width");
@@ -198,6 +201,25 @@ main(int argc, char **argv)
 	if (wsfd < 0)
 		err(2, "open ws-device %s", wsdev);
 
+	if (listfonts == 1) {
+		struct wsdisplayio_fontinfo fi;
+		int ret;
+		unsigned int i;
+
+		fi.fi_buffersize = 4096;
+		fi.fi_numentries = 0;
+		fi.fi_fonts = malloc(4096);
+		ret = ioctl(wsfd, WSDISPLAYIO_LISTFONTS, );
+		if (fi.fi_fonts == NULL || ret != 0) {
+			err(1, "error fetching font list\n");
+		}
+		for (i = 0; i < fi.fi_numentries; i++) {
+			printf("%s %dx%d\n", fi.fi_fonts[i].fd_name,
+			fi.fi_fonts[i].fd_width, fi.fi_fonts[i].fd_height);
+		}
+		return 0;
+	}	
+
 	if (argc > 0) {
 		ffd = open(argv[0], O_RDONLY, 0);
 		if (ffd < 0)



CVS commit: src/usr.sbin/wsfontload

2021-04-23 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Apr 24 00:49:26 UTC 2021

Modified Files:
src/usr.sbin/wsfontload: wsfontload.c

Log Message:
add -l option to dump a list of available fonts


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/usr.sbin/wsfontload/wsfontload.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/wsfontload

2019-05-30 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu May 30 14:58:52 UTC 2019

Modified Files:
src/usr.sbin/wsfontload: wsfontload.8

Log Message:
Note lack of a method to determine which fonts have been loaded.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/usr.sbin/wsfontload/wsfontload.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/wsfontload

2017-06-23 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Jun 23 18:40:03 UTC 2017

Modified Files:
src/usr.sbin/wsfontload: wsfontload.c

Log Message:
- don't use embedded font name if -N is given
- assume mono bitmap font when reading from stdin


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/usr.sbin/wsfontload/wsfontload.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/wsfontload

2017-06-23 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Jun 23 18:40:03 UTC 2017

Modified Files:
src/usr.sbin/wsfontload: wsfontload.c

Log Message:
- don't use embedded font name if -N is given
- assume mono bitmap font when reading from stdin


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/usr.sbin/wsfontload/wsfontload.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/wsfontload/wsfontload.c
diff -u src/usr.sbin/wsfontload/wsfontload.c:1.20 src/usr.sbin/wsfontload/wsfontload.c:1.21
--- src/usr.sbin/wsfontload/wsfontload.c:1.20	Fri Jun 23 17:40:15 2017
+++ src/usr.sbin/wsfontload/wsfontload.c	Fri Jun 23 18:40:03 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: wsfontload.c,v 1.20 2017/06/23 17:40:15 macallan Exp $ */
+/* $NetBSD: wsfontload.c,v 1.21 2017/06/23 18:40:03 macallan Exp $ */
 
 /*
  * Copyright (c) 1999
@@ -138,6 +138,7 @@ main(int argc, char **argv)
 	struct stat st;
 	int c, res, wsfd, ffd, verbose = 0;
 	size_t len;
+	int use_embedded_name = 1;
 	void *buf;
 	char nbuf[65];
 
@@ -170,6 +171,7 @@ main(int argc, char **argv)
 			break;
 		case 'N':
 			f.name = optarg;
+			use_embedded_name = 0;
 			break;
 		case 'b':
 			f.bitorder = WSDISPLAY_FONTORDER_R2L;
@@ -208,7 +210,7 @@ main(int argc, char **argv)
 	if (!f.stride)
 		f.stride = (f.fontwidth + 7) / 8;
 	len = f.fontheight * f.numchars * f.stride;
-	if (fstat(ffd, ) == 0) {
+	if ((ffd != 0) && (fstat(ffd, ) == 0)) {
 		if ((off_t)len != st.st_size) {
 			uint32_t foo = 0;
 			char b[65];
@@ -218,9 +220,11 @@ main(int argc, char **argv)
 			if (strncmp(b, "WSFT", 4) != 0)
 errx(1, "invalid wsf file ");
 			read(ffd, b, 64);
-			b[64] = 0;
-			strcpy(nbuf, b);
-			f.name = nbuf;
+			if (use_embedded_name) {
+b[64] = 0;
+strcpy(nbuf, b);
+f.name = nbuf;
+			}
 			read(ffd, , 4);
 			f.firstchar = le32toh(foo);
 			read(ffd, , 4);



CVS commit: src/usr.sbin/wsfontload

2017-06-23 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Jun 23 17:40:15 UTC 2017

Modified Files:
src/usr.sbin/wsfontload: wsfontload.c

Log Message:
avoid sign compare error


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/usr.sbin/wsfontload/wsfontload.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/wsfontload/wsfontload.c
diff -u src/usr.sbin/wsfontload/wsfontload.c:1.19 src/usr.sbin/wsfontload/wsfontload.c:1.20
--- src/usr.sbin/wsfontload/wsfontload.c:1.19	Fri Jun 23 02:16:39 2017
+++ src/usr.sbin/wsfontload/wsfontload.c	Fri Jun 23 17:40:15 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: wsfontload.c,v 1.19 2017/06/23 02:16:39 macallan Exp $ */
+/* $NetBSD: wsfontload.c,v 1.20 2017/06/23 17:40:15 macallan Exp $ */
 
 /*
  * Copyright (c) 1999
@@ -209,7 +209,7 @@ main(int argc, char **argv)
 		f.stride = (f.fontwidth + 7) / 8;
 	len = f.fontheight * f.numchars * f.stride;
 	if (fstat(ffd, ) == 0) {
-		if (len != st.st_size) {
+		if ((off_t)len != st.st_size) {
 			uint32_t foo = 0;
 			char b[65];
 			len = st.st_size;



CVS commit: src/usr.sbin/wsfontload

2017-06-23 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Jun 23 17:40:15 UTC 2017

Modified Files:
src/usr.sbin/wsfontload: wsfontload.c

Log Message:
avoid sign compare error


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/usr.sbin/wsfontload/wsfontload.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/wsfontload

2017-06-22 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Jun 23 02:16:39 UTC 2017

Modified Files:
src/usr.sbin/wsfontload: wsfontload.c

Log Message:
load files from ttf2wsfont


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/usr.sbin/wsfontload/wsfontload.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/wsfontload/wsfontload.c
diff -u src/usr.sbin/wsfontload/wsfontload.c:1.18 src/usr.sbin/wsfontload/wsfontload.c:1.19
--- src/usr.sbin/wsfontload/wsfontload.c:1.18	Fri Apr  5 03:18:26 2013
+++ src/usr.sbin/wsfontload/wsfontload.c	Fri Jun 23 02:16:39 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: wsfontload.c,v 1.18 2013/04/05 03:18:26 dholland Exp $ */
+/* $NetBSD: wsfontload.c,v 1.19 2017/06/23 02:16:39 macallan Exp $ */
 
 /*
  * Copyright (c) 1999
@@ -33,6 +33,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -134,9 +135,11 @@ main(int argc, char **argv)
 {
 	const char *wsdev;
 	struct wsdisplay_font f;
+	struct stat st;
 	int c, res, wsfd, ffd, verbose = 0;
 	size_t len;
 	void *buf;
+	char nbuf[65];
 
 	wsdev = DEFDEV;
 	f.fontwidth = DEFWIDTH;
@@ -205,6 +208,39 @@ main(int argc, char **argv)
 	if (!f.stride)
 		f.stride = (f.fontwidth + 7) / 8;
 	len = f.fontheight * f.numchars * f.stride;
+	if (fstat(ffd, ) == 0) {
+		if (len != st.st_size) {
+			uint32_t foo = 0;
+			char b[65];
+			len = st.st_size;
+			/* read header */
+			read(ffd, b, 4);
+			if (strncmp(b, "WSFT", 4) != 0)
+errx(1, "invalid wsf file ");
+			read(ffd, b, 64);
+			b[64] = 0;
+			strcpy(nbuf, b);
+			f.name = nbuf;
+			read(ffd, , 4);
+			f.firstchar = le32toh(foo);
+			read(ffd, , 4);
+			f.numchars = le32toh(foo);
+			read(ffd, , 4);
+			f.encoding = le32toh(foo);
+			read(ffd, , 4);
+			f.fontwidth = le32toh(foo);
+			read(ffd, , 4);
+			f.fontheight = le32toh(foo);
+			read(ffd, , 4);
+			f.stride = le32toh(foo);
+			read(ffd, , 4);
+			f.bitorder = le32toh(foo);
+			read(ffd, , 4);
+			f.byteorder = le32toh(foo);
+			len = f.numchars * f.fontheight * f.stride;
+		}
+	}
+
 	if (!len)
 		errx(1, "invalid font size");
 



CVS commit: src/usr.sbin/wsfontload

2017-06-22 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Jun 23 02:16:39 UTC 2017

Modified Files:
src/usr.sbin/wsfontload: wsfontload.c

Log Message:
load files from ttf2wsfont


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/usr.sbin/wsfontload/wsfontload.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/wsfontload

2013-04-04 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Fri Apr  5 03:18:27 UTC 2013

Modified Files:
src/usr.sbin/wsfontload: wsfontload.c

Log Message:
remove extraneous malloc.h


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/usr.sbin/wsfontload/wsfontload.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/wsfontload/wsfontload.c
diff -u src/usr.sbin/wsfontload/wsfontload.c:1.17 src/usr.sbin/wsfontload/wsfontload.c:1.18
--- src/usr.sbin/wsfontload/wsfontload.c:1.17	Wed Aug 31 13:32:42 2011
+++ src/usr.sbin/wsfontload/wsfontload.c	Fri Apr  5 03:18:26 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: wsfontload.c,v 1.17 2011/08/31 13:32:42 joerg Exp $ */
+/* $NetBSD: wsfontload.c,v 1.18 2013/04/05 03:18:26 dholland Exp $ */
 
 /*
  * Copyright (c) 1999
@@ -34,7 +34,6 @@
 #include sys/types.h
 #include sys/ioctl.h
 #include err.h
-#include malloc.h
 
 #include dev/wscons/wsconsio.h
 



CVS commit: src/usr.sbin/wsfontload

2013-04-04 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Fri Apr  5 03:18:27 UTC 2013

Modified Files:
src/usr.sbin/wsfontload: wsfontload.c

Log Message:
remove extraneous malloc.h


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/usr.sbin/wsfontload/wsfontload.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/wsfontload

2011-06-08 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Jun  8 12:47:51 UTC 2011

Modified Files:
src/usr.sbin/wsfontload: wsfontload.8

Log Message:
Sort options. New sentence, new line.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.sbin/wsfontload/wsfontload.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/wsfontload/wsfontload.8
diff -u src/usr.sbin/wsfontload/wsfontload.8:1.25 src/usr.sbin/wsfontload/wsfontload.8:1.26
--- src/usr.sbin/wsfontload/wsfontload.8:1.25	Wed Jun  8 10:25:21 2011
+++ src/usr.sbin/wsfontload/wsfontload.8	Wed Jun  8 12:47:51 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: wsfontload.8,v 1.25 2011/06/08 10:25:21 drochner Exp $
+.\	$NetBSD: wsfontload.8,v 1.26 2011/06/08 12:47:51 wiz Exp $
 .\
 .\ Copyright (c) 1999, 2001
 .\ 	Matthias Drochner.  All rights reserved.
@@ -32,30 +32,12 @@
 .Nd load a font bitmap into the wsfont pool or a wscons display device
 .Sh SYNOPSIS
 .Nm
-.Bk -words
+.Op Fl Bbv
+.Op Fl e Ar encoding
 .Op Fl f Ar wsdev
-.Ek
-.Bk -words
-.Op Fl w Ar width
-.Ek
-.Bk -words
 .Op Fl h Ar height
-.Ek
-.Bk -words
-.Op Fl e Ar encoding
-.Ek
-.Bk -words
 .Op Fl N Ar name
-.Ek
-.Bk -words
-.Op Fl b
-.Ek
-.Bk -words
-.Op Fl B
-.Ek
-.Bk -words
-.Op Fl v
-.Ek
+.Op Fl w Ar width
 .Op Ar fontfile
 .Sh DESCRIPTION
 The
@@ -72,16 +54,12 @@
 .Pp
 The options are:
 .Bl -tag -width xxx
-.It Fl f Ar wsdev
-Specify the device to operate on.
-Default is
-.Pa /dev/wsfont .
-.It Fl w Ar width
-Sets the width of a font character in pixels.
-Default is 8.
-.It Fl h Ar height
-Sets the height of a font character in pixels.
-Default is 16.
+.It Fl B
+Specifies that the font data is ordered right-to-left byte wise.
+The default is left-to-right.
+.It Fl b
+Specifies that the font data is ordered right-to-left bit wise.
+The default is left-to-right.
 .It Fl e Ar encoding
 Sets the encoding of the font.
 This can be either a symbolic abbreviation or a numeric value.
@@ -106,19 +84,23 @@
 Per default,
 .Ql iso
 is assumed.
+.It Fl f Ar wsdev
+Specify the device to operate on.
+Default is
+.Pa /dev/wsfont .
+.It Fl h Ar height
+Sets the height of a font character in pixels.
+Default is 16.
 .It Fl N Ar name
 Specifies a name which can be used later to refer to the font.
 If none is given, the
 .Ar fontfile
 name is used to create one.
-.It Fl b
-Specifies that the font data is ordered right-to-left bit wise.
-The default is left-to-right.
-.It Fl B
-Specifies that the font data is ordered right-to-left byte wise.
-The default is left-to-right.
 .It Fl v
 Prints the font's properties before loading it.
+.It Fl w Ar width
+Sets the width of a font character in pixels.
+Default is 8.
 .El
 .Pp
 Typically, the
@@ -136,7 +118,8 @@
 .Pp
 Load the IBM-encoded 8\(mu8-font from the
 .Xr wscons 4
-distribution. This (or another 8\(mu8-font) is necessary to use the
+distribution.
+This (or another 8\(mu8-font) is necessary to use the
 50-line screen type on
 .Xr vga 4
 displays.



CVS commit: src/usr.sbin/wsfontload

2011-06-08 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Jun  8 12:49:45 UTC 2011

Modified Files:
src/usr.sbin/wsfontload: wsfontload.c

Log Message:
Sync usage with man page.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.sbin/wsfontload/wsfontload.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/wsfontload/wsfontload.c
diff -u src/usr.sbin/wsfontload/wsfontload.c:1.15 src/usr.sbin/wsfontload/wsfontload.c:1.16
--- src/usr.sbin/wsfontload/wsfontload.c:1.15	Wed Jun  8 10:25:21 2011
+++ src/usr.sbin/wsfontload/wsfontload.c	Wed Jun  8 12:49:45 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: wsfontload.c,v 1.15 2011/06/08 10:25:21 drochner Exp $ */
+/* $NetBSD: wsfontload.c,v 1.16 2011/06/08 12:49:45 wiz Exp $ */
 
 /*
  * Copyright (c) 1999
@@ -76,8 +76,8 @@
 {
 
 	(void)fprintf(stderr,
-		usage: %s [-f wsdev] [-w width] [-h height] [-e encoding]
-		 [-N name] [-b] [-B] [fontfile]\n,
+		usage: %s [-Bbv] [-e encoding] [-f wsdev] [-h height]
+		 [-N name] [-w width] [fontfile]\n,
 		  getprogname());
 	exit(1);
 }



CVS commit: src/usr.sbin/wsfontload

2011-06-08 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Jun  8 12:47:51 UTC 2011

Modified Files:
src/usr.sbin/wsfontload: wsfontload.8

Log Message:
Sort options. New sentence, new line.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.sbin/wsfontload/wsfontload.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/wsfontload

2011-06-08 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Jun  8 12:49:45 UTC 2011

Modified Files:
src/usr.sbin/wsfontload: wsfontload.c

Log Message:
Sync usage with man page.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.sbin/wsfontload/wsfontload.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.