Hello.

Just a though... I was writing a simple awk(1) script and looked
at the options supported by this utility in the hope to make the code
cleaner.  It seems that there is a big difference between the synopsis
in the manual page:

   awk [-safe] [-V] [-d[n]] [-F fs] [-v var=value] [prog | -f progfile]
       file ...
   nawk ...

and the synopsis returned by the usage message in awk(1):

   $ awk
   usage: awk [-F fs] [-v var=value] [-safe] [-mr n] [-mf n] [prog | -f 
progfile] file ...

In fact, the awk(1)'s program usage shows some options that are currently
not supported by awk itself (i.e., -mr and -mf).  It is clear when looking
at the source code of awk:

http://www.openbsd.org/cgi-bin/cvsweb/src/usr.bin/awk/main.c?rev=1.13&content-type=text/x-cvsweb-markup

These options are not described in the manual page for this command
either.  I would suggest a synchronization between the usage message
in the binary and the, more updated, message in the manual page.

As a second change, I would suggest changing the usage message
in the binary to fit on a standard 80 columns display.  In short,
I propose:

  - synchronizing the usage message returned by awk(1) and the
    synopsis in the manual page.
  - splitting the usage message in two lines to fit on standard
    displays.
  - put the options that do not require arguments before the
    options that require arguments.
  - optionally, remove the code that announces that -mr and -mf
    are obsolete options and, as a consequence, ignored.  The
    standard message returned by awk(1) for non-existent options
    provides ALL information required.  For example:

       $ awk -g
       awk: unknown option -g ignored

       awk: no program given

    From this message it is clear that "-g" is ignored because it
    is an unknown option.

Are these changes acceptable for OpenBSD?

If these changes are good, should I submit the patch directly to
Brian Kernighan or put it here?

The patch seems very easy to write, but will be different for the
source code in OpenBSD (the operating system has awk version 20041222)
and the source code currently available at Bell Labs (from april 24,
2005).  Of course, I can write both.

Cheers,
Igor.

Reply via email to