/* parttool.c - common dispatcher and parser for partition operations */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc.
*
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <grub/partition.h>
#include <grub/parttool.h>
GRUB_MOD_LICENSE ("GPLv2+");
static int curhandle = 0;
static char helpmsg[] =
N_("Perform COMMANDS on partition.\n"
"Use \"parttool PARTITION help\" for the list "
"of available commands.");
int
const grub_parttool_function_t func,
const struct grub_parttool_argdesc *args)
{
int nargs = 0;
if (! parts)
grub_dl_ref (mymod);
}
void
{
{
if (prev)
else
t = cur;
grub_free (t);
}
else
{
}
if (! parts)
}
static grub_err_t
{
int *parsed;
int i, j;
auto grub_err_t show_help (void);
{
int found = 0;
{
found = 1;
{
{
case GRUB_PARTTOOL_ARG_BOOL:
grub_printf ("+/-");
spacing -= 3;
break;
case GRUB_PARTTOOL_ARG_VAL:
grub_xputs (_("=VAL"));
spacing -= 4;
break;
case GRUB_PARTTOOL_ARG_END:
break;
}
while (spacing-- > 0)
grub_printf (" ");
}
}
if (! found)
return GRUB_ERR_NONE;
}
if (argc < 1)
{
}
{
}
else
if (! dev)
return grub_errno;
{
}
{
}
/* Load modules. */
if (! grub_no_autoload)
{
const char *prefix;
if (prefix)
{
char *filename;
if (filename)
{
if (file)
{
char *buf = 0;
{
char *p, *name;
if (! buf)
break;
if (! grub_isgraph (name[0]))
continue;
if (! p)
continue;
*p = '\0';
while (*++p == ' ')
;
if (! grub_isgraph (*p))
continue;
!= 0)
continue;
grub_dl_load (p);
}
}
}
}
/* Ignore errors. */
}
if (argc == 1)
return show_help ();
for (i = 1; i < argc; i++)
return show_help ();
for (i = 1; i < argc; i++)
if (! parsed[i])
{
{
break;
break;
}
if (! cur)
args[i]);
pargs = (struct grub_parttool_args *)
for (j = i; j < argc; j++)
if (! parsed[j])
{
{
parsed[j] = 1;
{
case GRUB_PARTTOOL_ARG_BOOL:
break;
case GRUB_PARTTOOL_ARG_VAL:
break;
case GRUB_PARTTOOL_ARG_END:
break;
}
}
}
if (err)
break;
}
return err;
}
{
N_("PARTITION COMMANDS"),
helpmsg);
}
{
}