tech-userlevel archive

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

Re: humanize_number(3) for dd(1) summary?



Jean-Yves Migeon <jeanyves.migeon%free.fr@localhost> writes:

> +static int
> +dd_write_msg(const char *fmt)
> +{
> +     char hbuf[7], nbuf[32];
> +     const char *ptr;
> +     int64_t mS;
> +        struct timeval tv;

This line is indented with whitespaces rather than a tab.

> +             default:
> +                     ADDS("%");
> +                     if (*ptr == '\0')
> +                             goto done;
> +                     /*FALLTHROUGH*/

I guess it would be better to make unknown %-directive an error to
enforce people to use %% instead.  Otherwise working scripts may produce
different output after new directive is introduced in future.

> +done:
> +     /* flush buffer */
> +     buffer_write("\0", 1, 1);

buffer_write() needs an ability to flush internal buffer without adding
any characters.  I guess above code unnecessarily puts NUL to stderr.

enami.


Home | Main Index | Thread Index | Old Index