diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-01-22 07:21:38 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-01-22 07:21:38 +0000 |
commit | 8e1c71529c2bf38a04d4a117e625e59044a0785a (patch) | |
tree | 2f115293c25e7ee9307f268ec198e2cf486ff070 /util-linux/fdisk_osf.c | |
parent | 00cdbd8fc20a4e2e2208f90a2691a3806c931b06 (diff) | |
download | busybox-w32-8e1c71529c2bf38a04d4a117e625e59044a0785a.tar.gz busybox-w32-8e1c71529c2bf38a04d4a117e625e59044a0785a.tar.bz2 busybox-w32-8e1c71529c2bf38a04d4a117e625e59044a0785a.zip |
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.c | 46 |
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) | |||
308 | static void | 308 | static void |
309 | bsd_menu(void) | 309 | bsd_menu(void) |
310 | { | 310 | { |
311 | puts(_("Command action")); | 311 | puts(_("Command Action")); |
312 | puts(_("\td\tdelete a BSD partition")); | 312 | puts(_("d\tdelete a BSD partition")); |
313 | puts(_("\te\tedit drive data")); | 313 | puts(_("e\tedit drive data")); |
314 | puts(_("\ti\tinstall bootstrap")); | 314 | puts(_("i\tinstall bootstrap")); |
315 | puts(_("\tl\tlist known filesystem types")); | 315 | puts(_("l\tlist known filesystem types")); |
316 | puts(_("\tm\tprint this menu")); | 316 | puts(_("n\tadd a new BSD partition")); |
317 | puts(_("\tn\tadd a new BSD partition")); | 317 | puts(_("p\tprint BSD partition table")); |
318 | puts(_("\tp\tprint BSD partition table")); | 318 | puts(_("q\tquit without saving changes")); |
319 | puts(_("\tq\tquit without saving changes")); | 319 | puts(_("r\treturn to main menu")); |
320 | puts(_("\tr\treturn to main menu")); | 320 | puts(_("s\tshow complete disklabel")); |
321 | puts(_("\ts\tshow complete disklabel")); | 321 | puts(_("t\tchange a partition's filesystem id")); |
322 | puts(_("\tt\tchange a partition's filesystem id")); | 322 | puts(_("u\tchange units (cylinders/sectors)")); |
323 | puts(_("\tu\tchange units (cylinders/sectors)")); | 323 | puts(_("w\twrite disklabel to disk")); |
324 | puts(_("\tw\twrite disklabel to disk")); | ||
325 | #if !defined(__alpha__) | 324 | #if !defined(__alpha__) |
326 | puts(_("\tx\tlink BSD partition to non-BSD partition")); | 325 | puts(_("x\tlink BSD partition to non-BSD partition")); |
327 | #endif | 326 | #endif |
328 | } | 327 | } |
329 | 328 | ||
@@ -633,13 +632,15 @@ xbsd_create_disklabel(void) | |||
633 | static int | 632 | static int |
634 | edit_int(int def, char *mesg) | 633 | edit_int(int def, char *mesg) |
635 | { | 634 | { |
635 | mesg = xasprintf("%s (%d): ", mesg, def); | ||
636 | do { | 636 | do { |
637 | fputs(mesg, stdout); | 637 | if (!read_line(mesg)) |
638 | printf(" (%d): ", def); | 638 | goto ret; |
639 | if (!read_line()) | ||
640 | return def; | ||
641 | } while (!isdigit(*line_ptr)); | 639 | } while (!isdigit(*line_ptr)); |
642 | return atoi(line_ptr); | 640 | def = atoi(line_ptr); |
641 | ret: | ||
642 | free(mesg); | ||
643 | return def; | ||
643 | } | 644 | } |
644 | 645 | ||
645 | static void | 646 | static void |
@@ -718,10 +719,9 @@ xbsd_write_bootstrap(void) | |||
718 | else | 719 | else |
719 | dkbasename = "wd"; | 720 | dkbasename = "wd"; |
720 | 721 | ||
721 | printf(_("Bootstrap: %sboot -> boot%s (%s): "), | 722 | snprintf(path, sizeof(path), "Bootstrap: %sboot -> boot%s (%s): ", |
722 | dkbasename, dkbasename, dkbasename); | 723 | dkbasename, dkbasename, dkbasename); |
723 | if (read_line()) { | 724 | if (read_line(path)) { |
724 | line_ptr[strlen(line_ptr)-1] = '\0'; | ||
725 | dkbasename = line_ptr; | 725 | dkbasename = line_ptr; |
726 | } | 726 | } |
727 | snprintf(path, sizeof(path), "%s/%sboot", bootdir, dkbasename); | 727 | snprintf(path, sizeof(path), "%s/%sboot", bootdir, dkbasename); |