home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / MAWK113.ZIP / mawk113 / NEW < prev    next >
Text File  |  1992-07-08  |  3KB  |  116 lines

  1.  
  2. This file describes the changes from mawk 1.0 to mawk 1.1
  3.  
  4.  
  5. ------------------------------------------------------
  6. CHANGES dictated by posix requirements:
  7.  
  8. command line:
  9.  
  10.   -f file      program can come from multiple -f options
  11.   -v var=value     assignment *before* BEGIN execution
  12.  
  13.   all implementation dependent options are arguments to -W
  14.  
  15.   -W version     replaces -V
  16.   -W dump    replaces -D
  17.   -W sprintf=number     enlarges sprintf buffer to number bytes
  18.   -W posix_space    forces mawk not to consider '\n' space
  19.  
  20.  
  21. new builtin variables:
  22.  
  23.   CONVFMT used for internal conversion from number to
  24.   string, initially = "%.6g"
  25.  
  26.      to convert x to string if x is exact integer
  27.     
  28.     x <- sprintf("%d", x)
  29.  
  30.     else
  31.  
  32.     x <- sprintf(CONVFMT, x)
  33.  
  34.  
  35.   output still uses OFMT except exact integers use "%d"
  36.  
  37.  
  38.   ENVIRON[] array holds inherited environment.  Changes are *not*
  39.   passed to commands executed by mawk.
  40.  
  41.  
  42. new functions:
  43.  
  44.    toupper()
  45.    tolower()
  46.  
  47.  
  48. /regexpr/    can be used anywhere in the program as an expression,
  49.  
  50. so
  51.  
  52.       if ( /^A.*B/ ) {....}
  53.  
  54. is the same as
  55.  
  56.       if ( $0 ~ /^A.*B/ ) {....}
  57.  
  58.  
  59. printf and sprintf are ANSI C compatible, you can for example
  60.  
  61.      printf "%-#0*.*lX", 20,6 , x
  62.  
  63.  
  64.      (mawk passes printf and sprintf to printf(3) and sprintf(3)
  65.       so real ansi compatibility requires an ANSI C library.)
  66.  
  67. RS == ""  now strips blank lines from the front and back of 
  68.       each file, and then acts the same as RS = "\n\n+"
  69.  
  70. ------------------------------------------------------------
  71. Non posix changes:
  72.  
  73.  
  74.     print or printf > "/dev/stderr"   writes to stderr
  75.     (taken from gawk)
  76.  
  77.  
  78. Hardwired limits are mostly gone for example if you have enough
  79. memory you can dynamically allocate up to 32K fields 
  80. (or more by adjusting defines in sizes.h)
  81.  
  82. ---------------------------------------------------------------
  83.  
  84. I "fixed" some things that in hindsight I thought I did wrong the
  85. first time.
  86.  
  87.      array storage is different.
  88.      program flow is entirely controlled in execute().
  89.      there are some new op codes
  90.      grammar is a little cleaner
  91.  
  92. ---------------------
  93.  
  94. DOS:  
  95.  
  96.    1) under command.com for programs from the command line
  97.    The use of " and ' is reversed.  This makes batch files
  98.    easier at the cost of some quote dyslexia.
  99.  
  100.  
  101.    Unix:  mawk '/foo/{print "bar"}'
  102.  
  103.  
  104.    DOS :   mawk "/foo/{print 'bar'}"
  105.  
  106.        but only from the command line, not from files
  107.  
  108.        mawk -f con
  109.        /fool/{print "bar"}
  110.        ^Z
  111.  
  112.    2) System() and pipes, so DOS mawk is now fully compatible with
  113.    unix mawk.
  114.  
  115.  
  116.