aboutsummaryrefslogtreecommitdiff
path: root/util-linux/fdisk_osf.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-01-22 07:21:38 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-01-22 07:21:38 +0000
commit8e1c71529c2bf38a04d4a117e625e59044a0785a (patch)
tree2f115293c25e7ee9307f268ec198e2cf486ff070 /util-linux/fdisk_osf.c
parent00cdbd8fc20a4e2e2208f90a2691a3806c931b06 (diff)
downloadbusybox-8e1c71529c2bf38a04d4a117e625e59044a0785a.tar.gz
Convert cmdedit into more generic line input facility
(make history and completion optional at runtime). Use it for fdisk, as an example. Some unrelated fixes in fdisk are also here.
Diffstat (limited to 'util-linux/fdisk_osf.c')
-rw-r--r--util-linux/fdisk_osf.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/util-linux/fdisk_osf.c b/util-linux/fdisk_osf.c
index 16a046ea3..3f56bd27d 100644
--- a/util-linux/fdisk_osf.c
+++ b/util-linux/fdisk_osf.c
@@ -308,22 +308,21 @@ bsd_trydev(const char * dev)
static void
bsd_menu(void)
{
- puts(_("Command action"));
- puts(_("\td\tdelete a BSD partition"));
- puts(_("\te\tedit drive data"));
- puts(_("\ti\tinstall bootstrap"));
- puts(_("\tl\tlist known filesystem types"));
- puts(_("\tm\tprint this menu"));
- puts(_("\tn\tadd a new BSD partition"));
- puts(_("\tp\tprint BSD partition table"));
- puts(_("\tq\tquit without saving changes"));
- puts(_("\tr\treturn to main menu"));
- puts(_("\ts\tshow complete disklabel"));
- puts(_("\tt\tchange a partition's filesystem id"));
- puts(_("\tu\tchange units (cylinders/sectors)"));
- puts(_("\tw\twrite disklabel to disk"));
+ puts(_("Command Action"));
+ puts(_("d\tdelete a BSD partition"));
+ puts(_("e\tedit drive data"));
+ puts(_("i\tinstall bootstrap"));
+ puts(_("l\tlist known filesystem types"));
+ puts(_("n\tadd a new BSD partition"));
+ puts(_("p\tprint BSD partition table"));
+ puts(_("q\tquit without saving changes"));
+ puts(_("r\treturn to main menu"));
+ puts(_("s\tshow complete disklabel"));
+ puts(_("t\tchange a partition's filesystem id"));
+ puts(_("u\tchange units (cylinders/sectors)"));
+ puts(_("w\twrite disklabel to disk"));
#if !defined(__alpha__)
- puts(_("\tx\tlink BSD partition to non-BSD partition"));
+ puts(_("x\tlink BSD partition to non-BSD partition"));
#endif
}
@@ -633,13 +632,15 @@ xbsd_create_disklabel(void)
static int
edit_int(int def, char *mesg)
{
+ mesg = xasprintf("%s (%d): ", mesg, def);
do {
- fputs(mesg, stdout);
- printf(" (%d): ", def);
- if (!read_line())
- return def;
+ if (!read_line(mesg))
+ goto ret;
} while (!isdigit(*line_ptr));
- return atoi(line_ptr);
+ def = atoi(line_ptr);
+ ret:
+ free(mesg);
+ return def;
}
static void
@@ -718,10 +719,9 @@ xbsd_write_bootstrap(void)
else
dkbasename = "wd";
- printf(_("Bootstrap: %sboot -> boot%s (%s): "),
+ snprintf(path, sizeof(path), "Bootstrap: %sboot -> boot%s (%s): ",
dkbasename, dkbasename, dkbasename);
- if (read_line()) {
- line_ptr[strlen(line_ptr)-1] = '\0';
+ if (read_line(path)) {
dkbasename = line_ptr;
}
snprintf(path, sizeof(path), "%s/%sboot", bootdir, dkbasename);