Re: [PATCH] mount: make the --offset option support hex number

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

 



Hi Yann,

On Thu, Mar 25, 2010 at 5:05 AM, Yann Droneaud <yann@xxxxxxxxxxx> wrote:
>
> Le mercredi 24 mars 2010 à 14:38 +0800, Liu Aleaxander a écrit :
>
> > +       if (offset) {
> > +               int ret = 0;
> > +               if (offset[0] == '0' && offset[1] == 'x')
> > +                       ret = sscanf(offset, "%llx", &off);
> > +               else
> > +                       ret = sscanf(offset, "%llu", &off);
> > +               if (ret != 1)
> > +                       usage();
> > +       }
> >
>
> Why not using strtoull(), which handle decimal, hexadecimal and octal
> for free ?
>

Thanks for your good point. But I found that the strtoull can't
recognize  the difference between non-digit case  and zero number
case, since it will both returns 0. But when we meet the non-digit, we
should pop the usage message, while it's normal to meet a zero offset
case.

Thanks!

--
regards
Liu Aleaxander
--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux