grub-devel
[Top][All Lists]
Advanced

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

Re: play.c


From: Marco Gerards
Subject: Re: play.c
Date: Sun, 06 Nov 2005 18:50:26 +0100
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

Vincent Pelletier <address@hidden> writes:

Hi Vincent,

> Here is the play command, along with some songs.

Cool, thanks for this neat patch. :-)

> Vincent Pelletier
> Index: commands/i386/pc/play.c
> ===================================================================
> RCS file: commands/i386/pc/play.c
> diff -N commands/i386/pc/play.c
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ commands/i386/pc/play.c   5 Nov 2005 14:06:00 -0000
> @@ -0,0 +1,248 @@
> +/* play.c - command to play a tune  */
> +/*
> + *  GRUB  --  GRand Unified Bootloader
> + *  Copyright (C) 2003  Free Software Foundation, Inc.

Shouldn't it be (C) 2003, 2005 or so?

> +static grub_err_t
> +grub_cmd_play (struct grub_arg_list *state __attribute__ ((unused)),
> +           int argc, char **args)
> +{
> +  grub_file_t file;
> +  struct note buf;
> +  int tempo;
> +  unsigned int to;
> +
> +  if (argc != 1)
> +    return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required");
> +
> +  file = grub_file_open (args[0]);
> +  if (! file)
> +    return 0;
> +
> +  if (grub_file_read (file, (void *) &tempo, sizeof(tempo)) != sizeof(tempo))
> +    return 0;

You have to close the file here.


> +#ifdef GRUB_UTIL
> +void
> +grub_play_init (void)
> +{
> +  grub_register_command ("play", grub_cmd_play, GRUB_COMMAND_FLAG_BOTH,
> +                      "play FILE", "Play a tune", 0);
> +}
> +
> +void
> +grub_play_fini (void)
> +{
> +  grub_unregister_command ("play");
> +}
> +#else /* ! GRUB_UTIL */

This code is quite low level and not needed in GRUB_UTIL.  So you can
just leave this away.  Perhaps the same needs to be done for some
commands that are already in CVS, I'll look at that.

Thanks,
Marco





reply via email to

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