/* guestfish - the filesystem interactive shell
- * Copyright (C) 2009 Red Hat Inc.
+ * Copyright (C) 2009 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
static int parse_size (const char *str, off_t *size_rtn);
int
-do_alloc (int argc, char *argv[])
+do_alloc (const char *cmd, int argc, char *argv[])
{
off_t size;
int fd;
if (argc != 2) {
- fprintf (stderr, "use 'alloc file size' to create an image\n");
+ fprintf (stderr, _("use 'alloc file size' to create an image\n"));
return -1;
}
if (parse_size (argv[1], &size) == -1)
return -1;
- if (g_launched) {
- fprintf (stderr, "can't allocate or add disks after launching\n");
+ if (!guestfs_is_config (g)) {
+ fprintf (stderr, _("can't allocate or add disks after launching\n"));
return -1;
}
- fd = open (argv[0], O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK|O_TRUNC, 0666);
+ fd = open (argv[0], O_WRONLY|O_CREAT|O_NOCTTY|O_TRUNC, 0666);
if (fd == -1) {
perror (argv[0]);
return -1;
case 'g': case 'G': size *= 1024 * 1024 * 1024; break;
case 's': size *= 512; break;
default:
- fprintf (stderr, "could not parse size specification '%s'\n", str);
+ fprintf (stderr, _("could not parse size specification '%s'\n"), str);
return -1;
}
}
else if (sscanf (str, "%"SCNu64, &size) == 1)
size *= 1024;
else {
- fprintf (stderr, "could not parse size specification '%s'\n", str);
+ fprintf (stderr, _("could not parse size specification '%s'\n"), str);
return -1;
}