From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1MiW5T-0000B9-FP for mharc-grub-devel@gnu.org; Tue, 01 Sep 2009 12:20:03 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MiW5Q-00007r-Je for grub-devel@gnu.org; Tue, 01 Sep 2009 12:20:00 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MiW5L-0008U5-HY for grub-devel@gnu.org; Tue, 01 Sep 2009 12:19:59 -0400 Received: from [199.232.76.173] (port=38991 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MiW5L-0008TZ-5U for grub-devel@gnu.org; Tue, 01 Sep 2009 12:19:55 -0400 Received: from smarthost02.mail.zen.net.uk ([212.23.3.141]:36112) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MiW5K-0007zT-Pz for grub-devel@gnu.org; Tue, 01 Sep 2009 12:19:54 -0400 Received: from [82.69.40.219] (helo=riva.pelham.vpn.ucam.org) by smarthost02.mail.zen.net.uk with esmtp (Exim 4.63) (envelope-from ) id 1MiW5I-0001Bp-VF for grub-devel@gnu.org; Tue, 01 Sep 2009 16:19:53 +0000 Received: from cjwatson by riva.pelham.vpn.ucam.org with local (Exim 3.36 #1 (Debian)) for grub-devel@gnu.org id 1MiW5I-0001GD-00; Tue, 01 Sep 2009 17:19:52 +0100 Date: Tue, 1 Sep 2009 17:19:51 +0100 From: Colin Watson To: grub-devel@gnu.org Message-ID: <20090901161951.GK13423@riva.ucam.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) X-Originating-Smarthost02-IP: [82.69.40.219] X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Subject: [PATCH] Filename default for grub-editenv 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, 01 Sep 2009 16:20:01 -0000 (Per a discussion with Robert on IRC, this can be post-1.97 if you like.) Would it make sense for grub-editenv to have a default for the filename? I dislike hardcoding something in package maintainer scripts that needs to match a #define. The interface would be a little awkward since it's grub-editenv FILENAME COMMAND, but we could just say that if you provide only one argument then we use the default filename. Index: util/grub-editenv.c =================================================================== --- util/grub-editenv.c (revision 2556) +++ util/grub-editenv.c (working copy) @@ -72,7 +72,7 @@ fprintf (stderr, "Try ``grub-editenv --help'' for more information.\n"); else printf ("\ -Usage: grub-editenv [OPTIONS] FILENAME COMMAND\n\ +Usage: grub-editenv [OPTIONS] [FILENAME] COMMAND\n\ \n\ Tool to edit environment block.\n\ \nCommands:\n\ @@ -85,7 +85,10 @@ -V, --version print version information and exit\n\ -v, --verbose print verbose messages\n\ \n\ -Report bugs to <%s>.\n", PACKAGE_BUGREPORT); +If not given explicitly, FILENAME defaults to %s.\n\ +\n\ +Report bugs to <%s>.\n", +DEFAULT_DIRECTORY "/" GRUB_ENVBLK_DEFCFG, PACKAGE_BUGREPORT); exit (status); } @@ -282,13 +285,15 @@ if (optind + 1 >= argc) { - fprintf (stderr, "no command specified\n"); - usage (1); + filename = DEFAULT_DIRECTORY "/" GRUB_ENVBLK_DEFCFG; + command = argv[optind]; } + else + { + filename = argv[optind]; + command = argv[optind + 1]; + } - filename = argv[optind]; - command = argv[optind + 1]; - if (strcmp (command, "create") == 0) create_envblk_file (filename); else if (strcmp (command, "list") == 0) -- Colin Watson [cjwatson@ubuntu.com]