From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1HvdQy-0007XN-3l for mharc-grub-devel@gnu.org; Tue, 05 Jun 2007 14:07:08 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HvdQw-0007XF-C9 for grub-devel@gnu.org; Tue, 05 Jun 2007 14:07:06 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HvdQv-0007X3-S6 for grub-devel@gnu.org; Tue, 05 Jun 2007 14:07:06 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HvdQv-0007X0-Q5 for grub-devel@gnu.org; Tue, 05 Jun 2007 14:07:05 -0400 Received: from smtp-vbr8.xs4all.nl ([194.109.24.28]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1HvdQv-0006Gt-9Q for grub-devel@gnu.org; Tue, 05 Jun 2007 14:07:05 -0400 Received: from localhost.localdomain (249-174.surfsnel.dsl.internl.net [145.99.174.249]) by smtp-vbr8.xs4all.nl (8.13.8/8.13.8) with ESMTP id l55I73l0064140 for ; Tue, 5 Jun 2007 20:07:04 +0200 (CEST) (envelope-from mgerards@xs4all.nl) From: Marco Gerards To: The development of GRUB 2 References: <200706041604.l54G4p0v029961@correoredir01.dinaserver.com> <46659E21.5010805@raulete.net> Mail-Copies-To: mgerards@xs4all.nl Date: Tue, 05 Jun 2007 20:13:07 +0200 In-Reply-To: <46659E21.5010805@raulete.net> (adrian15@raulete.net's message of "Tue, 05 Jun 2007 19:32:17 +0200") Message-ID: <87tztm5ky4.fsf@xs4all.nl> User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by XS4ALL Virus Scanner X-detected-kernel: FreeBSD 4.6-4.9 Subject: Re: test -e patch 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: Tue, 05 Jun 2007 18:07:07 -0000 adrian15 writes: >> adrian15 writes: >> >>> > Attached you will find the patch adding test -e support for grub2. >>> > >>> > This is my first patch. I have compiled it without no errors. >> >> Urgh... I thought/hoped I told you I had a test.c rewrite sitting on >> my harddisk? Or did I tell Robert to poke me until next weekend so I >> will work on it? It includes everything you expect from test.c, >> expect the cleanup and testing. ;-) > > Do you mean you also have the '-e' option ? I mean I have everything that is possible. That includes `-e', but also all other features. Something noone looked at is "expr". >> Please have a look at the wiki. It has quite some information about >> GRUB 2. > Whenever possible I'll download some info from the wiki. > >>> > Should I write "Test if a file exists" instead of "test if a file >>> > exists" or "FILE exists"? >> >> FILE > > FILE > or > FILE exists ? FILE exists > Or have you coded it yourself too? Hm? [...] >> No, the problem is that the design of test.c (which is just a >> placeholder) is wrong. It needs a proper parser for the arguments and >> a way to deal with this... > > Ok. We will wait for your code. :-) Sorry for the confusion :-/ >>> > The question is if the user will see the -e, -f or other options when >>> > querying the test command help or not ? >> >> They should. But I am not sure if the final version will support >> this. Especially because of the nested syntax of the test arguments. > > Do you mean the -e options support > or > do you mean the -e options showing at help test support ? Well, the version for GNU/Linux doesn't show help text. Perhaps it cannot be implemented using the argument parser in a clean way. I do not remember. >>> > +static void >>> > +test_file_exists (const char *key) >> >> Why not filename? > > test_filename_exists > or > filename I mean instead of key. > ? > >>> > { >>> > + >> >> You accidently introduced a whiteline. > > No whitelines after an initial {. I write down it. Well, usually adding whitespaces around code you didn't change is wrong or dirty. >>> > + if (state[0].set) >>> > + test_file_exists (args[0]); >>> > + else >>> > + { >> >> This means that this check is run for any other expression. This is >> quite error sensitive. > > In my code the only implemented option is '-e'. When there will be more > I could add more nested if with the other options, or maybe better we > will enjoy your improved code. Sure. Just poke me a lot during the weekend on IRC ;-) -- Marco