diff options
author | Roland McGrath <roland@gnu.org> | 1994-10-29 01:53:33 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 1994-10-29 01:53:33 +0000 |
commit | 16d932fbe5789433781cf698bcfcf4797d1afe74 (patch) | |
tree | 20c40992fd9ab6b727a826f0ef2e89e74fd880fb /libdiskfs/boot-parse.c | |
parent | f3236663c270a78a1fce85f5cfbc9b115646bf8d (diff) |
entered into RCS
Diffstat (limited to 'libdiskfs/boot-parse.c')
-rw-r--r-- | libdiskfs/boot-parse.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/libdiskfs/boot-parse.c b/libdiskfs/boot-parse.c index 1f83041b..09e3ecb2 100644 --- a/libdiskfs/boot-parse.c +++ b/libdiskfs/boot-parse.c @@ -160,12 +160,25 @@ diskfs_parse_bootargs (int argc, char **argv) if (diskfs_bootflags & RB_ASKNAME) { - char *tmp; + char *line = NULL; + size_t linesz = 0; + ssize_t len; printf ("Bootstrap filesystem device name [%s]: ", devname); - fflush (stdout); - scanf ("%as\n", &tmp); - if (*tmp) - devname = tmp; + switch (len = getline (&line, &linesz, stdin)) + { + case -1: + perror ("getline"); + printf ("Using default of `%s'.\n", devname); + case 0: /* Hmm. */ + case 1: /* Empty line, just a newline. */ + /* Use default. */ + free (line); + break; + default: + line[len - 1] = '\0'; /* Remove the newline. */ + devname = line; + break; + } } printf ("\nInitial bootstrap: %s", argv[0]); |