[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: bterm font reloading patch



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

At 19 Jan 04 00:23:15 GMT,
Matt Kraai wrote:
> The attached patch should make bterm reload the font when it
> receives a SIGHUP.  Would someone please test it?

Thank you Matt!!
It works perfectly on my test environment.

I strongly wish this patch will be merged into bogl-bterm udeb.

And I noticed
- - bterm-unifont uses awk for HUP signal, but awk doesn't exist on 1st
  stage. Does this need to rewrite by sed or another tool?
- - busybox-cvs-floppy-udeb includes /bin/sleep, but busybox-cvs-udeb
  doesn't. Why?

> [2 patch <text/plain; us-ascii (7bit)>]
> diff -ru bogl-0.1.14-old/bterm.c bogl-0.1.14/bterm.c
> --- bogl-0.1.14-old/bterm.c	2004-01-18 15:53:53.000000000 -0800
> +++ bogl-0.1.14/bterm.c	2004-01-18 16:15:41.000000000 -0800
> @@ -153,6 +153,20 @@
>    ioctl(ttyfd, TIOCSWINSZ, &win);
>  }
>  
> +static char *font_name;
> +static struct bogl_term *term;
> +
> +void reload_font(int sig)
> +{
> +  free(term->font);
> +
> +  if ((term->font = bogl_mmap_font(font_name)) == NULL)
> +    fprintf(stderr, "Bad font\n");
> +
> +  term->xstep = bogl_font_glyph(term->font, ' ', 0);
> +  term->ystep = bogl_font_height(term->font);
> +}
> +
>  /*
>   * The usage is very simple:
>   *    bterm -f font.bgf [ -l locale ] [ program ]
> @@ -165,9 +179,8 @@
>    char buf[8192];
>    struct timeval tv;
>    int ptyfd, ttyfd;
> -  struct bogl_term *term;
>    struct bogl_font *font;
> -  char *locale = "", *font_name = NULL, *command = NULL;
> +  char *locale = "", *command = NULL;
>    int i;
>    char o = ' ';
>    int pending = 0;
> @@ -234,6 +247,8 @@
>  
>    spawn_shell(ptyfd, ttyfd, command == NULL ? "/bin/sh" : command);
>  
> +  signal(SIGHUP, reload_font);
> +
>    ntio = ttysave;
>    ntio.c_lflag &= ~(ECHO|ISIG|ICANON|XCASE);
>    ntio.c_iflag = 0;
> diff -ru bogl-0.1.14-old/debian/changelog bogl-0.1.14/debian/changelog
> --- bogl-0.1.14-old/debian/changelog	2004-01-18 15:53:53.000000000 -0800
> +++ bogl-0.1.14/debian/changelog	2004-01-18 16:12:26.000000000 -0800
> @@ -1,3 +1,10 @@
> +bogl (0.1.14-1.2) unstable; urgency=low
> +
> +  * Non-maintainer upload.
> +  * Reload the font when SIGHUP is received (closes: #219333).
> +
> + -- Matt Kraai <kraai@debian.org>  Sun, 18 Jan 2004 16:12:25 -0800
> +
>  bogl (0.1.14-1.1) unstable; urgency=high
>  
>    * Non maintainer upload.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>

iEYEARECAAYFAkANFxcACgkQQKW+7XLQPLEhKgCgzuEDSAQ/KoiYe0xE05oL2AlK
d7QAoJj89J0FpujUmMPQ26OXF58vaauU
=DOxP
-----END PGP SIGNATURE-----



Reply to: