[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Creating partitions relative to the end of the disk

From: Timshel Knoll
Subject: Re: Creating partitions relative to the end of the disk
Date: Fri, 15 Mar 2002 02:28:37 +1100
User-agent: Mutt/1.3.27i

On Thu, Mar 14, 2002 at 09:36:38PM +1100, Andrew Clausen wrote:
> On Thu, Mar 14, 2002 at 12:28:35AM +1100, Timshel Knoll wrote:
> > I've hacked command_line_get_sector to allow specifing partitions
> > relative to the end of the disk. If a value has a '-' sign in front of
> > it, it is treated as as being a distance from the end of the disk. (ie.
> > on a 3000MB disk, -60 will yield 2940 in real terms). The patch is
> > trivial, there shouldn't be anything wrong with it (although I haven't
> > tested it extensively, there shouldn't be anything that _can_ go wrong,
> > as the consistency checks happen after this modification is done ...)
> Looks reasonable.  Perhaps there will be i18n issues?  I doubt it.

I wouldn't think so ...

> > Maybe I need to start honing my lex/yacc skills :-)
> My lex/yacc skillz are up-to-scratch.  As much as I love them... NO.
> Go use python or something.

Don't worry, I was joking :-)

> >     snprintf (def_str, 16, "%.4f", (float) def / MEGABYTE_SECTORS);
> >     input = command_line_get_word (prompt, def ? def_str : NULL, NULL, 1);
> >     if (!input)
> >             return 0;
> > -   valid = sscanf (input, "%Lf", &input_double);
> > +   for (i = 0; input[i] != '\0' && isspace (input[i]); i++)
> > +           ;
> Ugly.  Perhaps command_line_get_word() should be doing that.
> (Except when the text is quoted, or something, for partition names,
> etc.)

I didn't have a good look at how the UI handles input - is it possible
to end up with whitespace at the start of a "word"? I basically stuck
that in "just in case" it was needed. Feel free to trash it, or move it
somewhere else as you see fit.



   Timshel Knoll <address@hidden>  for Debian email: <address@hidden>
      Debian GNU/Linux developer, see http://people.debian.org/~timshel/
                For GnuPG public key: finger address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]