grub-devel
[Top][All Lists]
Advanced

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

Re: New command eval.


From: Vladimir 'φ-coder/phcoder' Serbinenko
Subject: Re: New command eval.
Date: Sat, 11 May 2013 19:02:58 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.12) Gecko/20130116 Icedove/10.0.12

On 11.05.2013 18:35, Andrey Borzenkov wrote:

> +  grub_size_t size = argc; /* +1 for final zero */
> +  char *str, *p;
> +  grub_err_t ret;
> +
> +  if (argc == 0)
> +    return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("missing arguments"));
> +

eval with no arguments returns success in bash, to match this behaviour,
it should be GRUB_ERR_NONE and no use of grub_error

> +  for (i = 0; i < argc; i++)
> +    size += grub_strlen (argv[i]);
> +
> +  str = p = grub_malloc (size);
> +  if (!str)
> +    return grub_errno;
> +
> +  for (i = 0; i < argc; i++)
> +    {
> +      grub_strcpy (p, argv[i]);
> +      p += grub_strlen (argv[i]);

These 2 operations should be condensed by using grub_stpcpy

> +      *p++ = ' ';


>-  grub_script_execute_sourcecode (script, 0, dummy);
>+  grub_script_execute_sourcecode (script);
(in menu_entry.c) here you need a new scope for consistency.

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]