[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] New command checktime
From: |
Robert Millan |
Subject: |
Re: [PATCH] New command checktime |
Date: |
Thu, 7 Aug 2008 21:06:52 +0200 |
User-agent: |
Mutt/1.5.13 (2006-08-11) |
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."
- Re: [PATCH] New command checktime, (continued)
- Re: [PATCH] New command checktime, Bean, 2008/08/07
- Re: [PATCH] New command checktime, Colin D Bennett, 2008/08/07
- Re: [PATCH] New command checktime, Robert Millan, 2008/08/07
- Re: [PATCH] New command checktime, Bean, 2008/08/09
- Re: [PATCH] New command checktime, Isaac Dupree, 2008/08/09
- Re: [PATCH] New command checktime, Bean, 2008/08/09
- Re: [PATCH] New command checktime, Robert Millan, 2008/08/10
- Re: [PATCH] New command checktime, Bean, 2008/08/10
- Re: [PATCH] New command checktime, Isaac Dupree, 2008/08/10
- Re: [PATCH] New command checktime, Robert Millan, 2008/08/10
- Re: [PATCH] New command checktime,
Robert Millan <=
Re: [PATCH] New command checktime, Marco Gerards, 2008/08/10
- Re: [PATCH] New command checktime, Bean, 2008/08/11
- Re: [PATCH] New command checktime, Robert Millan, 2008/08/11
- Re: [PATCH] New command checktime, Marco Gerards, 2008/08/11
- Re: [PATCH] New command checktime, Bean, 2008/08/12
- Re: [PATCH] New command checktime, Marco Gerards, 2008/08/12
- Re: [PATCH] New command checktime, Bean, 2008/08/12
- Re: [PATCH] New command checktime, Bean, 2008/08/12
- Re: [PATCH] New command checktime, Marco Gerards, 2008/08/13
- Re: [PATCH] New command checktime, Bean, 2008/08/15