Print this page
XXX Remove nawk(1)

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/mdb/tools/scripts/hdr2map.sh
          +++ new/usr/src/cmd/mdb/tools/scripts/hdr2map.sh
↓ open down ↓ 15 lines elided ↑ open up ↑
  16   16  # If applicable, add the following below this CDDL HEADER, with the
  17   17  # fields enclosed by brackets "[]" replaced with your own identifying
  18   18  # information: Portions Copyright [yyyy] [name of copyright owner]
  19   19  #
  20   20  # CDDL HEADER END
  21   21  #
  22   22  #
  23   23  # Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  24   24  # Use is subject to license terms.
  25   25  #
  26      -#ident  "%Z%%M% %I%     %E% SMI"
  27      -#
  28   26  
  29   27  #
  30   28  # Given a header file, extract function prototypes and global variable
  31   29  # declarations in a form that can be used in a mapfile.  The list of extracted
  32   30  # functions and variables will be combined with a user-specified template to
  33   31  # create a complete mapfile.
  34   32  #
  35   33  # Template
  36   34  # --------
  37   35  #
↓ open down ↓ 67 lines elided ↑ open up ↑
 105  103  #       int, void *);
 106  104  #
 107  105  # Selective Exclusion may not be used in the same file as Selective Exportation.
 108  106  #
 109  107  
 110  108  function extract_prototypes
 111  109  {
 112  110          typeset header="$1"
 113  111          typeset prefix="$2"
 114  112  
 115      -        nawk -v prefix="$prefix" <$header '
      113 +        /usr/xpg4/bin/awk -v prefix="$prefix" <$header '
 116  114                  /^.*MAPFILE: export \"[^\"]*\"$/ {
 117  115                          if (protoexclude) {
 118  116                                  print "ERROR: export after exclude\n";
 119  117                                  exit(1);
 120  118                          }
 121  119                  
 122  120                          sub(/^[^\"]*\"/, "");
 123  121                          sub(/\"$/, "");
 124  122  
 125  123                          exportmark=sprintf("/* %s */", $0);
↓ open down ↓ 61 lines elided ↑ open up ↑
 187  185                          next;
 188  186                  }
 189  187          ' || die "Extraction failed"
 190  188  }
 191  189  
 192  190  function extract_section
 193  191  {
 194  192          typeset skel="$1"
 195  193          typeset secname="$2"
 196  194  
 197      -        nawk <$skel -v name=$secname -v skel=$skel '
      195 +        /usr/xpg4/bin/awk <$skel -v name=$secname -v skel=$skel '
 198  196              /\/\* [^ ]* [^ ]* \*\// && $3 == name {
 199  197                  if ($2 == "BEGIN") {
 200  198                          printing = 1;
 201  199                  } else {
 202  200                          printing = 0;
 203  201                  }
 204  202                  next;
 205  203              }
 206  204  
 207  205              printing != 0 { print; }
↓ open down ↓ 50 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX