Cover V06, I06
Article
Figure 1
Figure 2
Figure 3
Figure 4
Figure 5
Listing 1
Listing 2
Listing 3
Sidebar 1
Sidebar 2
Sidebar 3
Sidebar 4

jun97.tar


Listing 2: prpw Display the translated values of the system's default database or a users protected password database in a concise, two-column listing

# ------------------------------------------------------------------------- # prpw Concise display the translated values of the systems # Default Database or a users Protected Password Database # # usage: prpw arg # # args: # default : display system default pdb # [-m] logonid : display users pdb # # -m will merge unspecified values with # their defaults. The merged default # values be noted by => # ------------------------------------------------------------------------- #!/usr/bin/sh case "$1" in "") echo "usage: prpw default List system Default Database" echo " [-m] logonid List Private Password Database for" echo " a user. -m will merge unspecified" echo " values with their defaults. The" echo " merged default values be shown" echo " with =>" exit 1 ;; -m) if [ $# -eq 2 ] then user=$2 merge=yes else echo "prpw -m requires a logonid as an argument" exit 1 fi ;; default) cmd="/usr/lbin/getprdef -p -b -t" ;; *) cmd="/usr/lbin/getprpw $1" ;; esac if [ "$merge" = "yes" ] then _parse_pdb_() { /sbin/awk 'BEGIN { RS=""; FS="," } { gsub(/, /, ",") for (i = 1; i <= NF; i++) { printf "%-35s\n",$i } } ' | sort > $1 } get_default='/usr/lbin/getprdef -p -b -t' get_user="/usr/lbin/getprpw $user" tmp_default=/tmp/prpw.$$.default tmp_user=/tmp/prpw.$$.user $get_default | _parse_pdb_ $tmp_default $get_user | _parse_pdb_ $tmp_user join -j 1 -t"=" -a 1 $tmp_user $tmp_default \ | sed -e 's/=-1 .* =/=>/' \ -e 's/=DFT .* =/=>/' \ -e 's/ .* =*//' \ | awk 'BEGIN { RS=""; FS="" } { for (i = 1; i <= int(NF/2 + 0.5); i++) { j = i + int(NF/2 + 0.5) if (j <= NF) printf "%-35s %-35s\n",$i,$j else printf "%-35s\n",$i } } ' rm $tmp_user rm $tmp_default else $cmd | \ /sbin/awk 'BEGIN { RS=""; FS="," } { gsub(/, /, ",") for (i = 1; i <= int(NF/2 + 0.5); i++) { j = i + int(NF/2 + 0.5) if (j <= NF) printf "%-35s %-35s\n",$i,$j else printf "%-35s\n",$i } } ' fi # ------------------------------------------------------------------------- # End of File