/* grub-editenv.c - tool to edit environment block. */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008,2009,2010 Free Software Foundation, Inc.
*
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <argp.h>
#include "progname.h"
N_("Create a blank environment block file."), 0},
N_("List the current variables."), 0},
N_("Set variables."), 0},
N_("Delete variables."), 0},
{ 0, 0, 0, 0, 0, 0 }
};
/* Print the version information. */
static void
{
}
/* Set the bug report address */
{
switch (key)
{
case 'v':
verbosity++;
break;
case ARGP_KEY_NO_ARGS:
_("You need to specify at least one command.\n"));
argp_usage (state);
break;
default:
return ARGP_ERR_UNKNOWN;
}
return 0;
}
static char *
{
switch (key)
{
case ARGP_KEY_HELP_POST_DOC:
default:
return (char *) text;
}
}
Tool to edit environment block.")
If FILENAME is '-', the default value %s is used."),
};
static void
{
char *buf;
char *namenew;
if (! buf)
grub_util_error (_("out of memory"));
if (! fp)
}
static grub_envblk_t
{
char *buf;
if (! fp)
{
/* Create the file implicitly. */
if (! fp)
}
if (! buf)
grub_util_error (_("out of memory"));
if (! envblk)
grub_util_error (_("invalid environment block"));
return envblk;
}
static void
{
{
return 0;
}
}
static void
{
if (! fp)
!= grub_envblk_size (envblk))
}
static void
{
while (argc)
{
char *p;
if (! p)
*(p++) = 0;
grub_util_error (_("environment block too small"));
argc--;
argv++;
}
}
static void
{
while (argc)
{
argc--;
argv++;
}
}
int
{
char *filename;
char *command;
set_program_name (argv[0]);
/* Parse our arguments */
{
exit(1);
}
if (arg_count == 1)
{
}
else
{
}
else
{
exit(1);
}
return 0;
}