Print this page
XXX Remove nawk(1)
*** 47,67 ****
basename_cmd=basename
cp_cmd=cp
egrep_cmd=egrep
mv_cmd=mv
! nawk_cmd=nawk
rm_cmd=rm
sed_cmd=sed
sort_cmd=sort
# $1 is the type
# $2 is the "old/existing file"
# $3 is the "new (to be merged)" file
# $4 is the output file
# returns 0 on success
! # returns 2 on failure if nawk fails with non-zero exit status
#
dbmerge() {
#
# Remove the ident lines.
#
--- 47,67 ----
basename_cmd=basename
cp_cmd=cp
egrep_cmd=egrep
mv_cmd=mv
! awk_cmd=/usr/xpg4/bin/awk
rm_cmd=rm
sed_cmd=sed
sort_cmd=sort
# $1 is the type
# $2 is the "old/existing file"
# $3 is the "new (to be merged)" file
# $4 is the output file
# returns 0 on success
! # returns 2 on failure if awk fails with non-zero exit status
#
dbmerge() {
#
# Remove the ident lines.
#
*** 151,175 ****
-e '/\\$/{N;s/\\\n//;}' -e '/\\$/{N;s/\\\n//;}' \
-e '/\\$/{N;s/\\\n//;}' -e '/\\$/{N;s/\\\n//;}' \
-e '/\\$/{N;s/\\\n//;}' -e '/\\$/{N;s/\\\n//;}' \
$3 > $4.new
#
! # The nawk script below processes the old and new files using up to
# three passes. If the old file is empty, only the final pass over
# the new file is required.
#
if [ -s $4.old ]; then
! nawk_pass1=$4.old
! nawk_pass2=$4.new
! nawk_pass3=$4.new
else
! nawk_pass1=
! nawk_pass2=
! nawk_pass3=$4.new
fi
#
! #!/usr/bin/nawk -f
#
# dbmerge type=[auth|prof|user|exec] [ old-file new-file ] new-file
#
# Merge two versions of an RBAC database file. The output
# consists of the lines from the new-file, while preserving
--- 151,175 ----
-e '/\\$/{N;s/\\\n//;}' -e '/\\$/{N;s/\\\n//;}' \
-e '/\\$/{N;s/\\\n//;}' -e '/\\$/{N;s/\\\n//;}' \
-e '/\\$/{N;s/\\\n//;}' -e '/\\$/{N;s/\\\n//;}' \
$3 > $4.new
#
! # The awk script below processes the old and new files using up to
# three passes. If the old file is empty, only the final pass over
# the new file is required.
#
if [ -s $4.old ]; then
! awk_pass1=$4.old
! awk_pass2=$4.new
! awk_pass3=$4.new
else
! awk_pass1=
! awk_pass2=
! awk_pass3=$4.new
fi
#
! #!/usr/xpg4/bin/awk -f
#
# dbmerge type=[auth|prof|user|exec] [ old-file new-file ] new-file
#
# Merge two versions of an RBAC database file. The output
# consists of the lines from the new-file, while preserving
*** 196,206 ****
#
# The output is run through sort except for the comments
# which will appear first in the output.
#
#
! $nawk_cmd '
# This script may be invoked with up to three file names. Each file
# name corresponds to a separate processing pass. The passes are
# defined as follows:
#
--- 196,206 ----
#
# The output is run through sort except for the comments
# which will appear first in the output.
#
#
! $awk_cmd '
# This script may be invoked with up to three file names. Each file
# name corresponds to a separate processing pass. The passes are
# defined as follows:
#
*** 232,258 ****
keyword_behavior["user", "roles"] = "merge";
FS=":"
}
! # When FNR (current file record number) is 1 it indicates that nawk
# is starting to read the next file specified on its command line,
# and is beginning the next processing pass.
FNR == 1 {
pass++;
}
/^#/ || /^$/ {
! continue;
}
{
! # For each input line, nawk automatically assigns the complete
# line to $0 and also splits the line at field separators and
# assigns each field to a variable $1..$n. Assignment to $0
# re-splits the line into the field variables. Conversely,
! # assgnment to a variable $1..$n will cause $0 to be recomputed
# from the field variable values.
#
# This code adds awareness of escaped field separators by using
# a custom function to split the line into a temporary array.
# It assigns the empty string to $0 to clear any excess field
--- 232,258 ----
keyword_behavior["user", "roles"] = "merge";
FS=":"
}
! # When FNR (current file record number) is 1 it indicates that awk
# is starting to read the next file specified on its command line,
# and is beginning the next processing pass.
FNR == 1 {
pass++;
}
/^#/ || /^$/ {
! next;
}
{
! # For each input line, awk automatically assigns the complete
# line to $0 and also splits the line at field separators and
# assigns each field to a variable $1..$n. Assignment to $0
# re-splits the line into the field variables. Conversely,
! # assignment to a variable $1..$n will cause $0 to be recomputed
# from the field variable values.
#
# This code adds awareness of escaped field separators by using
# a custom function to split the line into a temporary array.
# It assigns the empty string to $0 to clear any excess field
*** 418,428 ****
}
return keyword "=" unsplit(list, cnt, ",");
}
! # This function is similar to the nawk built-in split() function,
# except that a "\" character may be used to escape any subsequent
# character, so that the escaped character will not be treated as a
# field separator or as part of a field separator regular expression.
# The "\" characters will remain in the elements of the output array
# variable upon completion.
--- 418,428 ----
}
return keyword "=" unsplit(list, cnt, ",");
}
! # This function is similar to the awk built-in split() function,
# except that a "\" character may be used to escape any subsequent
# character, so that the escaped character will not be treated as a
# field separator or as part of a field separator regular expression.
# The "\" characters will remain in the elements of the output array
# variable upon completion.
*** 469,479 ****
str = list[1];
for (i = 2; i <= cnt; i++)
str = str delim list[i];
return str;
}' \
! type=$1 $nawk_pass1 $nawk_pass2 $nawk_pass3 > $4.unsorted
rc=$?
$sort_cmd < $4.unsorted >> $4
return $rc
}
--- 469,479 ----
str = list[1];
for (i = 2; i <= cnt; i++)
str = str delim list[i];
return str;
}' \
! type=$1 $awk_pass1 $awk_pass2 $awk_pass3 > $4.unsorted
rc=$?
$sort_cmd < $4.unsorted >> $4
return $rc
}