From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EYoey-0008T9-79 for mharc-grub-devel@gnu.org; Sun, 06 Nov 2005 12:50:28 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EYoex-0008T4-Ao for grub-devel@gnu.org; Sun, 06 Nov 2005 12:50:27 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EYoev-0008Sr-Fv for grub-devel@gnu.org; Sun, 06 Nov 2005 12:50:26 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EYoev-0008So-Aj for grub-devel@gnu.org; Sun, 06 Nov 2005 12:50:25 -0500 Received: from [145.74.66.11] (helo=mail-cn.han.nl) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EYoev-0004gI-CD for grub-devel@gnu.org; Sun, 06 Nov 2005 12:50:25 -0500 Received: from vscan-cn.han.nl (venus.han.nl [145.74.65.6]) by mail-cn.han.nl (Postfix) with ESMTP id B7C878E85 for ; Sun, 6 Nov 2005 18:50:23 +0100 (CET) Received: from mail-cn.han.nl ([145.74.66.11]) by vscan-cn.han.nl (venus.han.nl [145.74.65.6]) (amavisd-new, port 10024) with ESMTP id 27344-04 for ; Sun, 6 Nov 2005 18:50:23 +0100 (CET) Received: from mail1.han.nl (mail1.han.nl [145.74.103.11]) by mail-cn.han.nl (Postfix) with ESMTP id D470A880A for ; Sun, 6 Nov 2005 18:50:22 +0100 (CET) Received: from localhost.localdomain (mgerards.xs4all.nl [82.92.27.129]) by mail1.han.nl (Postfix) with ESMTP id 959F8C045 for ; Sun, 6 Nov 2005 18:50:22 +0100 (CET) Mail-Copies-To: metgerards@student.han.nl To: The development of GRUB 2 References: <436CBF00.1060304@yahoo.fr> From: Marco Gerards Date: Sun, 06 Nov 2005 18:50:26 +0100 In-Reply-To: <436CBF00.1060304@yahoo.fr> (Vincent Pelletier's message of "Sat, 05 Nov 2005 15:17:36 +0100") Message-ID: <87irv5zmvx.fsf@student.han.nl> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new (2.2.0) at vscan-cn.han.nl Subject: Re: play.c X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Nov 2005 17:50:27 -0000 Vincent Pelletier 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