[PATCH] awk: GNU extension -e

Sven-Göran Bergh svengbergh-busybox at yahoo.com
Tue Nov 5 11:55:49 UTC 2013


This patch adds two GNU extensions to awk. In essence, it allows -f to
be mixed with programs defined on the command line, with or without -e.

I know this is breaks POSIX and is a GNU extension, but it is really
convenient, especially when you want to organize awk functions into
libraries. Thus, it is controlled by FEATURE_AWK_GNU_EXTENSIONS.


Brgds
/S-G

  FEATURE_AWK_GNU_EXTENSIONS
  Add the extension -e to awk.
  Add the ability to mix -f and command line program definitions.
  This enables the use of awk library files that are pulled in
  with -f, while the "main" program is defined on the command line.
  
  Example: awk -f mylib.awk '{print myfunction($1);}' ...
  
  With FEATURE_AWK_GNU_EXTENSIONS:
  function                                             old     new   delta
  awk_main                                            1054    1127     +73
  .rodata                                           149787  149799     +12
  packed_usage                                       29128   29135      +7
  ------------------------------------------------------------------------------
  (add/remove: 0/0 grow/shrink: 3/0 up/down: 92/0)               Total: 92 bytes
  
  Without FEATURE_AWK_GNU_EXTENSIONS:
  function                                             old     new   delta
  awk_main                                            1054    1057      +3
  ------------------------------------------------------------------------------
  (add/remove: 0/0 grow/shrink: 1/0 up/down: 3/0)                 Total: 3 bytes
  
  Signed-off-by: Sven-Göran Bergh <sgb at systemasis.org>

---

Patch attached
-------------- next part --------------
A non-text attachment was scrubbed...
Name: awk-e.patch
Type: text/x-patch
Size: 7995 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20131105/ac47f506/attachment.bin>


More information about the busybox mailing list