Re: [PATCH 2/4] flock: cleanup usage issues

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

 



On Monday 19 June 2017, Karel Zak wrote:
> On Mon, Jun 19, 2017 at 04:40:14PM +0200, Ruediger Meier wrote:
> > On Monday 19 June 2017, Ruediger Meier wrote:
> > > On Monday 19 June 2017, Karel Zak wrote:
> > > > On Mon, Jun 19, 2017 at 02:36:17PM +0200, Ruediger Meier wrote:
> > > > > Sorry I forgot that the fputs/puts repacement adds another
> > > > > newline.
> > > > >
> > > > > I could either
> > > > >   1. remove the newlines from the strings (but would this
> > > > > cause extra work for translators?)
> > > > >   2. use printf instead of puts
> > > > >   3. don't change anything, just use constant FILE argument
> > > > > stdout.
> > > >
> > > > I think fputs(..., stdout) is non-invasive change, better than
> > > > modify all strings and probably more effective than printf().
> > > >
> > > >     Karel
> > >
> > > I'm using
> > >
> > > -static void usage(FILE * out) {
> > > -    FILE * out = stdout;
> > > -    fputs(USAGE_HEADER, out);
> > > +static void usage(void) {
> > > +    FILE * out = stdout;
> > > +    fputs(USAGE_HEADER, out);
> > >     ...
> > > }
> >
> > Sorry I mean this
> >
> > -static void usage(FILE * out) {
> > +static void usage(void) {
> > +    FILE * out = stdout;
> >      fputs(USAGE_HEADER, out);
> >      ...
> > }
>
> Yes, seems good, but I sure one day someone will ask:
>
>     what the hell are you doing with "out = stdout;" ?
>
> :-)

Hehe I know :)

This is all legacy. It's funny, eventhough I hate usage messages on 
error, my new checkusage.sh script does it also that way. That's how 
most simple commands are born ;)

cu,
Rudi
--
To unsubscribe from this list: send the line "unsubscribe util-linux" 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