All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marco Gerards <mgerards@xs4all.nl>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: [rfc] User definable terminfo support
Date: Wed, 04 Jan 2006 00:09:12 +0100	[thread overview]
Message-ID: <87acecgb8n.fsf@xs4all.nl> (raw)
In-Reply-To: <43BAF893.5080205@omniflux.com> (omniflux+lists@omniflux.com's message of "Tue, 03 Jan 2006 15:20:03 -0700")

Omniflux <omniflux+lists@omniflux.com> writes:

Hi,

> This code is incomplete, but I want to get some feedback from you,
> Marco, to ensure I am going down the correct path.

Hopefully my understanding of the code is correct so the comments are
sane :)

> -/* Free *PTR and set *PTR to NULL, to prevent double-free.  */
> +/* Set terminfo definition.  */
>  static void
> -grub_terminfo_free (char **ptr)
> +set_definition (const char *name, const char *definition)
> +{
> +  unset_definition ();
> +
> +  /* terminfo definition variable set to "".  */
> +  if (grub_strcmp (definition, "") == 0 )
> +      return;
> +
> +  /* Parse new definition and save as terminal_definition.  */
> +  /* FIXME: Write a parser. :)  */
> +  terminfo_definition->name = grub_strdup (name);
> +}
> +
> +/* Write hook for the terminfo environment variable.  */
> +static char *
> +set_definition_hook (struct grub_env_var *var, const char *val)
>  {
> -  grub_free (*ptr);
> -  *ptr = 0;
> +  set_definition (var->name, val);
> +  return grub_strdup (val);
>  }

Why do you have a hook for variables?

For example, when I do:

set vt100=...  

It's ok that is does not take effect until you change TERM, IMO.

So what happens is:

1)  VT100 is set
2)  TERM is set
2a) The hook is executed
2b) VT100 is read by the hook.
2c) The contents of VT100 is read and parsed.
2d) From this point of the VT100 stuff can be used and the hook
    returns.

Does this make sense and does it fit well in the design of the
terminfo code?

> +/* Write hook for the environment variable "TERM".  */
> +static char *
> +select_definition_hook (struct grub_env_var *var __attribute__ ((unused)),
> +                        const char *val)
> +{
> +  select_definition (val);
> +  return grub_strdup (val);
> +}

Perhaps you can even return 0 when the definition was not valid.  In
that case TERM is set to 0, IIRC?

Thanks,
Marco




  parent reply	other threads:[~2006-01-03 23:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-03 22:20 [rfc] User definable terminfo support Omniflux
2006-01-03 22:59 ` Marco Gerards
2006-01-03 23:09 ` Marco Gerards [this message]
2006-01-03 23:23   ` Omniflux
2006-01-03 23:59     ` Marco Gerards

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87acecgb8n.fsf@xs4all.nl \
    --to=mgerards@xs4all.nl \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.