Subject: Re: international wscons
To: None <tech-kern@netbsd.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-kern
Date: 03/21/2002 16:54:26
> No userland util currently issues WSDISPLAYIO_USEFONT.
I came to the same conclusion a while ago. Here's a (slightly more
general than the other one) hack I wrote. Usage is like
wsusefont iso8x16 > /dev/ttyE3
As the comment says, it's public domain; feel free to rip it off for
any purpose you care to.
/~\ The ASCII der Mouse
\ / Ribbon Campaign
X Against HTML mouse@rodents.montreal.qc.ca
/ \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B
/* This file is in the public domain. */
#include <stdio.h>
#include <errno.h>
#include <strings.h>
#include <sys/time.h>
#include <sys/ioctl.h>
extern const char *__progname;
#include <dev/wscons/wsconsio.h>
static const char *font = 0;
static void handleargs(int ac, char **av)
{
int skip;
int errs;
skip = 0;
errs = 0;
for (ac--,av++;ac;ac--,av++)
{ if (skip > 0)
{ skip --;
continue;
}
if (**av != '-')
{ if (! font)
{ font = *av;
}
else
{ fprintf(stderr,"%s: extra argument `%s'\n",__progname,*av);
errs ++;
}
continue;
}
#if 0
if (0)
{
needarg:;
fprintf(stderr,"%s: %s needs a following argument\n",__progname,*av);
errs ++;
continue;
}
#define WANTARG() do { if (++skip >= ac) goto needarg; } while (0)
if (!strcmp(*av,"-dev"))
{ WANTARG();
cfdev = av[skip];
continue;
}
#undef WANTARG
#endif
fprintf(stderr,"%s: unrecognized option `%s'\n",__progname,*av);
errs ++;
}
if (! font)
{ fprintf(stderr,"%s: need a font name\n",__progname);
errs ++;
}
if (errs)
{ exit(1);
}
}
int main(int, char **);
int main(int ac, char **av)
{
struct wsdisplay_usefontdata ufd;
handleargs(ac,av);
{ /* why the hell is wsdisplay_usefontdata.name not const char *? */
char *fnc;
bcopy(&font,&fnc,sizeof(char *));
ufd.name = fnc;
}
if (ioctl(1,WSDISPLAYIO_USEFONT,&ufd) < 0)
{ fprintf(stderr,"%s: WSDISPLAYIO_USEFONT: %s\n",__progname,strerror(errno));
exit(1);
}
exit(0);
}