All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Millan <rmh@aybabtu.com>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: [PATCH] New command checktime
Date: Thu, 7 Aug 2008 21:06:52 +0200	[thread overview]
Message-ID: <20080807190652.GA4413@thorin> (raw)
In-Reply-To: <ca0f59980808071052h2c94ba23qa30057c934dd1545@mail.gmail.com>

On Fri, Aug 08, 2008 at 01:52:07AM +0800, Bean wrote:
> date 10-05-13-15
> Oct 5, 13:15

Nice.  Btw this will be real fun for translators when we have gettext
support ;-)

> +      if (n < 0)
> +        return grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid date");
> +
> +      switch (pos)
> +        {
> +        case 0:
> +          if ((n < 1) || (n > 12))
> +            return grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid date");
> +
> +          mask |= GRUB_DATETIME_SET_MONTH;
> +          datetime.month = n;
> +          break;
> +
> +        case 1:
> +          if ((n < 1) || (n > 31))
> +            return grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid date");
> +
> +          mask |= GRUB_DATETIME_SET_DAY;
> +          datetime.day = n;
> +          break;
> +
> +        case 2:
> +          if (n > 23)
> +            return grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid date");
> +
> +          mask |= GRUB_DATETIME_SET_HOUR;
> +          datetime.hour = n;
> +          break;
> +
> +        case 3:
> +          if (n > 59)
> +            return grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid date");
> +
> +          mask |= GRUB_DATETIME_SET_MINUTE;
> +          datetime.minute = n;
> +          break;
> +
> +        case 4:
> +          if (n > 99)
> +            return grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid date");

Since those grub_error calls are always the same, I think it'd be a good
idea to group them together in a "fail:" section to save space.

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."



  parent reply	other threads:[~2008-08-07 19:08 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-06 11:02 [PATCH] New command checktime Bean
2008-08-06 11:35 ` Robert Millan
2008-08-06 15:09   ` Bean
2008-08-06 19:57     ` Robert Millan
2008-08-07  8:05       ` Bean
2008-08-07 10:21         ` Robert Millan
2008-08-07 11:19           ` Bean
2008-08-07 17:52             ` Bean
2008-08-07 18:17               ` Colin D Bennett
2008-08-07 19:12                 ` Robert Millan
2008-08-09  4:34                   ` Bean
2008-08-09 11:20                     ` Isaac Dupree
2008-08-09 11:37                       ` Bean
2008-08-10  9:32                         ` Robert Millan
2008-08-10 11:10                           ` Bean
2008-08-10 15:15                             ` Isaac Dupree
2008-08-10 17:22                               ` Robert Millan
2008-08-07 19:06               ` Robert Millan [this message]
2008-08-10 18:04 ` Marco Gerards
2008-08-11 11:06   ` Bean
2008-08-11 14:18     ` Robert Millan
2008-08-11 21:07     ` Marco Gerards
2008-08-12 17:13       ` Bean
2008-08-12 21:49         ` Marco Gerards
2008-08-13  1:46           ` Bean
2008-08-13  3:26             ` Bean
2008-08-13 10:17             ` Marco Gerards
2008-08-15 15:38               ` Bean

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=20080807190652.GA4413@thorin \
    --to=rmh@aybabtu.com \
    --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.